@idealyst/tooling 1.2.40 → 1.2.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vite-plugin.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts","../src/analyzer/theme-source-analyzer.ts"],"sourcesContent":["/**\n * Idealyst Docs Vite Plugin\n *\n * Generates a component registry at build time by analyzing TypeScript source.\n * Replaces placeholder exports from @idealyst/tooling with actual generated values.\n *\n * Usage:\n * ```ts\n * // vite.config.ts\n * import { idealystDocsPlugin } from '@idealyst/tooling';\n *\n * export default defineConfig({\n * plugins: [\n * idealystDocsPlugin({\n * componentPaths: ['../../packages/components/src'],\n * themePath: '../../packages/theme/src/lightTheme.ts',\n * }),\n * ],\n * });\n * ```\n *\n * Then in your app:\n * ```ts\n * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';\n * ```\n */\n\nimport type { Plugin } from 'vite';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { analyzeComponents } from './analyzer';\nimport type { IdealystDocsPluginOptions, ComponentRegistry } from './analyzer/types';\n\n/**\n * Create the Idealyst Docs Vite plugin.\n */\nexport function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin {\n let registry: ComponentRegistry | null = null;\n\n const { debug = false, output, outputPath } = options;\n\n const log = (...args: any[]) => {\n if (debug) console.log('[idealyst-docs]', ...args);\n };\n\n /**\n * Generate the registry by analyzing components.\n */\n function generateRegistry(): ComponentRegistry {\n log('Generating component registry...');\n log('Component paths:', options.componentPaths);\n log('Theme path:', options.themePath);\n\n try {\n registry = analyzeComponents(options);\n log(`Generated registry with ${Object.keys(registry).length} components`);\n if (debug) {\n log('Components found:', Object.keys(registry));\n }\n\n // Optionally write to file\n if (output === 'file' && outputPath) {\n const outputDir = path.dirname(outputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n fs.writeFileSync(\n outputPath,\n `// Auto-generated by @idealyst/tooling - DO NOT EDIT\\n` +\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)} as const;\\n`\n );\n log(`Wrote registry to ${outputPath}`);\n }\n\n return registry;\n } catch (error) {\n console.error('[idealyst-docs] Error generating registry:', error);\n return {};\n }\n }\n\n return {\n name: 'idealyst-docs',\n\n // Transform @idealyst/tooling to inject the actual registry\n transform(code, id) {\n // Check if this is the tooling package's index file\n const isToolingIndex = id.includes('@idealyst/tooling') && id.endsWith('index.ts');\n const isToolingSrc = id.includes('/packages/tooling/src/index.ts');\n\n if (isToolingIndex || isToolingSrc) {\n console.log(`[idealyst-docs] Transforming tooling index: ${id}`);\n\n if (!registry) {\n registry = generateRegistry();\n }\n\n // Replace the placeholder exports with actual values\n let transformed = code;\n\n // Replace: export const componentRegistry = {};\n // Note: TypeScript types are stripped before transform, so we match JS not TS\n transformed = transformed.replace(\n /export const componentRegistry\\s*=\\s*\\{\\s*\\};?/,\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)};`\n );\n\n log(`Code transformed: ${code !== transformed}`);\n\n // Replace: export const componentNames = [];\n // Note: TypeScript types are stripped before transform\n transformed = transformed.replace(\n /export const componentNames\\s*=\\s*\\[\\s*\\];?/,\n `export const componentNames = ${JSON.stringify(Object.keys(registry))};`\n );\n\n // Replace getComponentsByCategory with actual implementation that uses the real registry\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getComponentsByCategory\\(category\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getComponentsByCategory(category) {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}`\n );\n\n // Replace getPropConfig with actual implementation\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getPropConfig\\(componentName\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getPropConfig(componentName) {\n const def = componentRegistry[componentName];\n if (!def) return {};\n return Object.entries(def.props).reduce((acc, [key, prop]) => {\n if (prop.values && prop.values.length > 0) {\n acc[key] = { type: 'select', options: prop.values, default: prop.default };\n } else if (prop.type === 'boolean') {\n acc[key] = { type: 'boolean', default: prop.default ?? false };\n } else if (prop.type === 'string') {\n acc[key] = { type: 'text', default: prop.default ?? '' };\n } else if (prop.type === 'number') {\n acc[key] = { type: 'number', default: prop.default ?? 0 };\n }\n return acc;\n }, {});\n}`\n );\n\n return {\n code: transformed,\n map: null,\n };\n }\n\n return null;\n },\n\n // Regenerate on component file changes\n handleHotUpdate({ file, server }) {\n // Check if the changed file is a component file\n const isComponentFile =\n options.componentPaths.some(p => file.includes(path.resolve(p))) &&\n (file.endsWith('.ts') || file.endsWith('.tsx'));\n\n // Check if the changed file is the theme file\n const isThemeFile = file.includes(path.resolve(options.themePath));\n\n if (isComponentFile || isThemeFile) {\n log(`File changed: ${file}, regenerating registry...`);\n\n // Clear cached registry\n registry = null;\n\n // Invalidate the tooling module to trigger re-transform\n const toolingMods = Array.from(server.moduleGraph.idToModuleMap.values())\n .filter(m => m.id && (m.id.includes('@idealyst/tooling') || m.id.includes('/packages/tooling/src/index')));\n\n toolingMods.forEach(m => server.moduleGraph.invalidateModule(m));\n\n if (toolingMods.length > 0) {\n return toolingMods;\n }\n }\n },\n\n // Generate on build\n buildStart() {\n registry = generateRegistry();\n },\n };\n}\n\n/**\n * Standalone function to generate registry (for MCP server or CLI).\n */\nexport function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry {\n return analyzeComponents(options);\n}\n","/**\n * Component Analyzer - Extracts component prop definitions using TypeScript Compiler API.\n *\n * Analyzes:\n * - types.ts files for prop interfaces\n * - JSDoc comments for descriptions\n * - Static .description properties on components\n * - Theme-derived types (Intent, Size) resolved to actual values\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n ComponentRegistry,\n ComponentDefinition,\n PropDefinition,\n ComponentAnalyzerOptions,\n ThemeValues,\n ComponentCategory,\n SampleProps,\n} from './types';\nimport { analyzeTheme } from './theme-analyzer';\n\n/**\n * Analyze components and generate a registry.\n */\nexport function analyzeComponents(options: ComponentAnalyzerOptions): ComponentRegistry {\n const { componentPaths, themePath, include, exclude, includeInternal = false } = options;\n\n const registry: ComponentRegistry = {};\n\n // First, analyze the theme to get valid values\n const themeValues = analyzeTheme(themePath, false);\n\n // Scan each component path\n for (const componentPath of componentPaths) {\n const resolvedPath = path.resolve(componentPath);\n\n if (!fs.existsSync(resolvedPath)) {\n console.warn(`[component-analyzer] Path not found: ${resolvedPath}`);\n continue;\n }\n\n // Find all component directories (those with index.ts or types.ts)\n const componentDirs = findComponentDirs(resolvedPath);\n\n for (const dir of componentDirs) {\n const componentName = path.basename(dir);\n\n // Apply include/exclude filters\n if (include && !include.includes(componentName)) continue;\n if (exclude && exclude.includes(componentName)) continue;\n if (!includeInternal && componentName.startsWith('_')) continue;\n\n const definition = analyzeComponentDir(dir, componentName, themeValues);\n if (definition) {\n registry[componentName] = definition;\n }\n }\n }\n\n return registry;\n}\n\n/**\n * Find all component directories in a path.\n */\nfunction findComponentDirs(basePath: string): string[] {\n const dirs: string[] = [];\n\n const entries = fs.readdirSync(basePath, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n const dirPath = path.join(basePath, entry.name);\n\n // Check if it's a component directory (has index.ts or types.ts)\n const hasIndex = fs.existsSync(path.join(dirPath, 'index.ts'));\n const hasTypes = fs.existsSync(path.join(dirPath, 'types.ts'));\n\n if (hasIndex || hasTypes) {\n dirs.push(dirPath);\n }\n }\n\n return dirs;\n}\n\n/**\n * Analyze a single component directory.\n */\nfunction analyzeComponentDir(\n dir: string,\n componentName: string,\n themeValues: ThemeValues\n): ComponentDefinition | null {\n // Find all TypeScript files in the component directory\n const tsFiles = fs.readdirSync(dir)\n .filter(f => f.endsWith('.ts') || f.endsWith('.tsx'))\n .map(f => path.join(dir, f));\n\n if (tsFiles.length === 0) {\n return null;\n }\n\n // Create TypeScript program with all files\n const program = ts.createProgram(tsFiles, {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n });\n\n const typeChecker = program.getTypeChecker();\n\n // Search all files for the props interface\n const propsInterfaceName = `${componentName}Props`;\n const altNames = [`${componentName}ComponentProps`, 'Props'];\n let propsInterface: ts.InterfaceDeclaration | ts.TypeAliasDeclaration | null = null;\n let interfaceDescription: string | undefined;\n\n // Search each file for the props interface\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n // First try the main props interface name\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n if (ts.isTypeAliasDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n\n // If not found, try alternate naming conventions\n if (!propsInterface) {\n for (const altName of altNames) {\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n ts.forEachChild(sourceFile, (node) => {\n if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) && node.name.text === altName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n if (propsInterface) break;\n }\n }\n\n // If we couldn't find a props interface, skip this component\n if (!propsInterface) {\n return null;\n }\n\n // Extract props\n const props: Record<string, PropDefinition> = {};\n\n if (propsInterface) {\n const type = typeChecker.getTypeAtLocation(propsInterface);\n const properties = type.getProperties();\n\n for (const prop of properties) {\n const propDef = analyzeProperty(prop, typeChecker, themeValues);\n if (propDef && !isInternalProp(propDef.name)) {\n props[propDef.name] = propDef;\n }\n }\n }\n\n // Get description from the props interface JSDoc (single source of truth in types.ts)\n const description = interfaceDescription;\n\n // Determine category\n const category = inferCategory(componentName);\n\n // Look for docs.ts to extract sample props\n const sampleProps = extractSampleProps(dir);\n\n return {\n name: componentName,\n description,\n props,\n category,\n filePath: path.relative(process.cwd(), dir),\n sampleProps,\n };\n}\n\n/**\n * Extract sample props from docs.ts file if it exists.\n * The docs.ts file should export a `sampleProps` object.\n */\nfunction extractSampleProps(dir: string): SampleProps | undefined {\n const docsPath = path.join(dir, 'docs.ts');\n\n if (!fs.existsSync(docsPath)) {\n return undefined;\n }\n\n try {\n const content = fs.readFileSync(docsPath, 'utf-8');\n\n // Create a simple TypeScript program to extract the sampleProps export\n const sourceFile = ts.createSourceFile(\n 'docs.ts',\n content,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS\n );\n\n let samplePropsNode: ts.ObjectLiteralExpression | null = null;\n\n // Find the sampleProps export\n ts.forEachChild(sourceFile, (node) => {\n // Handle: export const sampleProps = { ... }\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword);\n if (isExported) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name) && decl.name.text === 'sampleProps' && decl.initializer) {\n if (ts.isObjectLiteralExpression(decl.initializer)) {\n samplePropsNode = decl.initializer;\n }\n }\n }\n }\n }\n });\n\n if (!samplePropsNode) {\n return undefined;\n }\n\n // Extract the object literal as JSON-compatible structure\n // This is a simplified extraction - it handles basic literals\n const result: SampleProps = {};\n const propsNode = samplePropsNode as ts.ObjectLiteralExpression;\n\n for (const prop of propsNode.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const propName = prop.name.text;\n\n if (propName === 'props' && ts.isObjectLiteralExpression(prop.initializer)) {\n result.props = extractObjectLiteral(prop.initializer, content);\n } else if (propName === 'children') {\n // For children, we store the raw source text\n result.children = prop.initializer.getText(sourceFile);\n } else if (propName === 'state' && ts.isObjectLiteralExpression(prop.initializer)) {\n // Extract state configuration for controlled components\n result.state = extractObjectLiteral(prop.initializer, content);\n }\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n } catch (e) {\n console.warn(`[component-analyzer] Error reading docs.ts in ${dir}:`, e);\n return undefined;\n }\n}\n\n/**\n * Extract an object literal to a plain object (for simple literal values).\n */\nfunction extractObjectLiteral(node: ts.ObjectLiteralExpression, sourceContent: string): Record<string, any> {\n const result: Record<string, any> = {};\n\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const key = prop.name.text;\n const init = prop.initializer;\n\n if (ts.isStringLiteral(init)) {\n result[key] = init.text;\n } else if (ts.isNumericLiteral(init)) {\n result[key] = Number(init.text);\n } else if (init.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true;\n } else if (init.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false;\n } else if (ts.isArrayLiteralExpression(init)) {\n result[key] = extractArrayLiteral(init, sourceContent);\n } else if (ts.isObjectLiteralExpression(init)) {\n result[key] = extractObjectLiteral(init, sourceContent);\n } else {\n // For complex expressions (JSX, functions), store the raw source\n result[key] = init.getText();\n }\n }\n }\n\n return result;\n}\n\n/**\n * Extract an array literal to a plain array.\n */\nfunction extractArrayLiteral(node: ts.ArrayLiteralExpression, sourceContent: string): any[] {\n const result: any[] = [];\n\n for (const element of node.elements) {\n if (ts.isStringLiteral(element)) {\n result.push(element.text);\n } else if (ts.isNumericLiteral(element)) {\n result.push(Number(element.text));\n } else if (element.kind === ts.SyntaxKind.TrueKeyword) {\n result.push(true);\n } else if (element.kind === ts.SyntaxKind.FalseKeyword) {\n result.push(false);\n } else if (ts.isObjectLiteralExpression(element)) {\n result.push(extractObjectLiteral(element, sourceContent));\n } else if (ts.isArrayLiteralExpression(element)) {\n result.push(extractArrayLiteral(element, sourceContent));\n } else {\n // For complex expressions, store raw source\n result.push(element.getText());\n }\n }\n\n return result;\n}\n\n/**\n * Analyze a single property symbol.\n */\nfunction analyzeProperty(\n symbol: ts.Symbol,\n typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): PropDefinition | null {\n const name = symbol.getName();\n const declarations = symbol.getDeclarations();\n\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n const type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n const typeString = typeChecker.typeToString(type);\n\n // Get JSDoc description\n const description = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)) || undefined;\n\n // Check if required\n const required = !(symbol.flags & ts.SymbolFlags.Optional);\n\n // Extract values for union types / theme types\n const values = extractPropValues(type, typeString, typeChecker, themeValues);\n\n // Extract default value (from JSDoc @default tag)\n const defaultValue = extractDefaultValue(symbol);\n\n return {\n name,\n type: simplifyTypeName(typeString),\n values: values.length > 0 ? values : undefined,\n default: defaultValue,\n description,\n required,\n };\n}\n\n/**\n * Extract valid values for a prop type.\n */\nfunction extractPropValues(\n type: ts.Type,\n typeString: string,\n _typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): string[] {\n // Handle theme-derived types\n if (typeString === 'Intent' || typeString.includes('Intent')) {\n return themeValues.intents;\n }\n if (typeString === 'Size' || typeString.includes('Size')) {\n // Return generic sizes - most components use the same keys\n return ['xs', 'sm', 'md', 'lg', 'xl'];\n }\n\n // Handle union types\n if (type.isUnion()) {\n const values: string[] = [];\n for (const unionType of type.types) {\n if (unionType.isStringLiteral()) {\n values.push(unionType.value);\n } else if ((unionType as any).intrinsicName === 'true') {\n values.push('true');\n } else if ((unionType as any).intrinsicName === 'false') {\n values.push('false');\n }\n }\n if (values.length > 0) return values;\n }\n\n // Handle boolean\n if (typeString === 'boolean') {\n return ['true', 'false'];\n }\n\n return [];\n}\n\n/**\n * Extract default value from JSDoc @default tag.\n */\nfunction extractDefaultValue(symbol: ts.Symbol): string | number | boolean | undefined {\n const tags = symbol.getJsDocTags();\n for (const tag of tags) {\n if (tag.name === 'default' && tag.text) {\n const value = ts.displayPartsToString(tag.text);\n // Try to parse as JSON\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Get JSDoc description from a node.\n */\nfunction getJSDocDescription(node: ts.Node): string | undefined {\n const jsDocs = (node as any).jsDoc as ts.JSDoc[] | undefined;\n if (!jsDocs || jsDocs.length === 0) return undefined;\n\n const firstDoc = jsDocs[0];\n if (firstDoc.comment) {\n if (typeof firstDoc.comment === 'string') {\n return firstDoc.comment;\n }\n // Handle NodeArray of JSDocComment\n return (firstDoc.comment as ts.NodeArray<ts.JSDocComment>)\n .map(c => (c as any).text || '')\n .join('');\n }\n return undefined;\n}\n\n/**\n * Simplify type names for display.\n */\nfunction simplifyTypeName(typeString: string): string {\n // Remove import paths\n typeString = typeString.replace(/import\\([^)]+\\)\\./g, '');\n\n // Simplify common complex types\n if (typeString.includes('ReactNode')) return 'ReactNode';\n if (typeString.includes('StyleProp')) return 'Style';\n\n return typeString;\n}\n\n/**\n * Check if a prop should be excluded (internal/inherited).\n */\nfunction isInternalProp(name: string): boolean {\n const internalProps = [\n 'ref',\n 'key',\n 'children',\n 'style',\n 'testID',\n 'nativeID',\n 'accessible',\n 'accessibilityActions',\n 'accessibilityComponentType',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLiveRegion',\n 'accessibilityRole',\n 'accessibilityState',\n 'accessibilityTraits',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'collapsable',\n 'focusable',\n 'hasTVPreferredFocus',\n 'hitSlop',\n 'importantForAccessibility',\n 'needsOffscreenAlphaCompositing',\n 'onAccessibilityAction',\n 'onAccessibilityEscape',\n 'onAccessibilityTap',\n 'onLayout',\n 'onMagicTap',\n 'onMoveShouldSetResponder',\n 'onMoveShouldSetResponderCapture',\n 'onResponderEnd',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderReject',\n 'onResponderRelease',\n 'onResponderStart',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'onStartShouldSetResponderCapture',\n 'pointerEvents',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'shouldRasterizeIOS',\n 'tvParallaxMagnification',\n 'tvParallaxProperties',\n 'tvParallaxShiftDistanceX',\n 'tvParallaxShiftDistanceY',\n 'tvParallaxTiltAngle',\n ];\n\n return internalProps.includes(name) || name.startsWith('accessibility');\n}\n\n/**\n * Infer component category from name.\n */\nfunction inferCategory(componentName: string): ComponentCategory {\n const formComponents = ['Button', 'Input', 'Checkbox', 'Select', 'Switch', 'RadioButton', 'Slider', 'TextArea'];\n const displayComponents = ['Text', 'Card', 'Badge', 'Chip', 'Avatar', 'Icon', 'Skeleton', 'Alert', 'Tooltip'];\n const layoutComponents = ['View', 'Screen', 'Divider'];\n const navigationComponents = ['TabBar', 'Breadcrumb', 'Menu', 'List', 'Link'];\n const overlayComponents = ['Dialog', 'Popover', 'Modal'];\n const dataComponents = ['Table', 'Progress', 'Accordion'];\n\n if (formComponents.includes(componentName)) return 'form';\n if (displayComponents.includes(componentName)) return 'display';\n if (layoutComponents.includes(componentName)) return 'layout';\n if (navigationComponents.includes(componentName)) return 'navigation';\n if (overlayComponents.includes(componentName)) return 'overlay';\n if (dataComponents.includes(componentName)) return 'data';\n\n return 'display'; // Default\n}\n","/**\n * Theme Analyzer - Extracts theme keys by statically analyzing theme files.\n *\n * Uses TypeScript Compiler API to trace the declarative builder API:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ button: { xs: {}, sm: {}, ... }, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\nimport { analyzeThemeSource } from './theme-source-analyzer';\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n}\n\n/**\n * Extract theme values from a theme file.\n */\nexport function analyzeTheme(themePath: string, verbose = false): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n const log = (...args: any[]) => {\n if (verbose) console.log('[theme-analyzer]', ...args);\n };\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program\n const program = ts.createProgram([resolvedPath], {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n });\n\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n }\n }\n }\n });\n\n /**\n * Process a builder method call chain.\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression)) {\n const methodName = node.expression.name.text;\n\n if (methodName === 'build') {\n // Trace the full chain\n const calls = traceBuilderCalls(node);\n processCalls(calls);\n return;\n }\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): BuilderCall[] {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n // Analyze base theme\n analyzeBaseTheme(arg.text, imports, values, ctx);\n }\n }\n }\n return calls;\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return calls;\n }\n\n /**\n * Process the collected builder method calls.\n */\n function processCalls(calls: BuilderCall[]): void {\n log('Processing', calls.length, 'builder method calls');\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent':\n case 'setIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(' Found intent:', name);\n }\n break;\n }\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(' Found radius:', name);\n }\n break;\n }\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(' Found shadow:', name);\n }\n break;\n }\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const componentName = getPropertyName(prop.name);\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n values.sizes[componentName] = getObjectKeys(prop.initializer);\n log(' Found sizes for', componentName + ':', values.sizes[componentName]);\n }\n }\n }\n }\n break;\n }\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n values.breakpoints = getObjectKeys(args[0]);\n log(' Found breakpoints:', values.breakpoints);\n }\n break;\n }\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const colorType = getPropertyName(prop.name);\n if (ts.isObjectLiteralExpression(prop.initializer)) {\n const keys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = keys;\n log(' Found surface colors:', keys);\n break;\n case 'text':\n values.textColors = keys;\n log(' Found text colors:', keys);\n break;\n case 'border':\n values.borderColors = keys;\n log(' Found border colors:', keys);\n break;\n }\n }\n }\n }\n }\n break;\n }\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(' Found surface color:', name);\n }\n break;\n }\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(' Found text color:', name);\n }\n break;\n }\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(' Found border color:', name);\n }\n break;\n }\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(' Found pallet color:', name);\n }\n break;\n }\n case 'build':\n // End of chain\n break;\n default:\n log(' Skipping unknown method:', method);\n }\n }\n }\n\n // Second pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n // Handle export statements\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n // Extract typography keys from sizes if present\n if (values.sizes['typography']) {\n values.typography = values.sizes['typography'];\n }\n\n log('Extracted theme values:', values);\n\n return values;\n}\n\n/**\n * Analyze a base theme file referenced by an import.\n */\nfunction analyzeBaseTheme(\n varName: string,\n imports: Map<string, { source: string; imported: string }>,\n values: ThemeValues,\n ctx: AnalyzerContext\n): void {\n const log = (...args: any[]) => {\n if (ctx.verbose) console.log('[theme-analyzer]', ...args);\n };\n\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log('Could not find import for base theme:', varName);\n return;\n }\n\n log('Base theme', varName, 'imported from', importInfo.source);\n\n // For @idealyst/theme imports, try to analyze from source using aliases\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Check if we have an alias for @idealyst/theme\n const aliasPath = packageAliases['@idealyst/theme'];\n if (aliasPath) {\n // Determine which theme file to analyze based on variable name\n const themeFileName = varName.toLowerCase().includes('dark') ? 'darkTheme.ts' : 'lightTheme.ts';\n const themePath = path.join(aliasPath, 'src', themeFileName);\n\n if (fs.existsSync(themePath)) {\n log(`Analyzing @idealyst/theme from source: ${themePath}`);\n try {\n const sourceValues = analyzeThemeSource(themePath, {\n verbose: ctx.verbose,\n aliases: packageAliases,\n });\n mergeThemeValues(values, sourceValues);\n log('Successfully extracted values from source');\n return;\n } catch (err) {\n log('Failed to analyze source, falling back to defaults:', (err as Error).message);\n }\n } else {\n log(`Theme file not found at alias path: ${themePath}`);\n }\n }\n\n // Fall back to default values if alias resolution fails\n log('Using default @idealyst/theme values');\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\n return;\n }\n\n // For relative imports, try to resolve and analyze\n // (This is simplified - full implementation would recursively analyze)\n log('Skipping base theme analysis for:', importInfo.source);\n}\n\n/**\n * Get default theme values from @idealyst/theme.\n */\nfunction getDefaultThemeValues(): ThemeValues {\n return {\n intents: ['primary', 'success', 'danger', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n iconButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n chip: ['xs', 'sm', 'md', 'lg', 'xl'],\n badge: ['xs', 'sm', 'md', 'lg', 'xl'],\n icon: ['xs', 'sm', 'md', 'lg', 'xl'],\n input: ['xs', 'sm', 'md', 'lg', 'xl'],\n radioButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n select: ['xs', 'sm', 'md', 'lg', 'xl'],\n slider: ['xs', 'sm', 'md', 'lg', 'xl'],\n switch: ['xs', 'sm', 'md', 'lg', 'xl'],\n textarea: ['xs', 'sm', 'md', 'lg', 'xl'],\n avatar: ['xs', 'sm', 'md', 'lg', 'xl'],\n progress: ['xs', 'sm', 'md', 'lg', 'xl'],\n accordion: ['xs', 'sm', 'md', 'lg', 'xl'],\n activityIndicator: ['xs', 'sm', 'md', 'lg', 'xl'],\n alert: ['xs', 'sm', 'md', 'lg', 'xl'],\n breadcrumb: ['xs', 'sm', 'md', 'lg', 'xl'],\n list: ['xs', 'sm', 'md', 'lg', 'xl'],\n menu: ['xs', 'sm', 'md', 'lg', 'xl'],\n text: ['xs', 'sm', 'md', 'lg', 'xl'],\n tabBar: ['xs', 'sm', 'md', 'lg', 'xl'],\n table: ['xs', 'sm', 'md', 'lg', 'xl'],\n tooltip: ['xs', 'sm', 'md', 'lg', 'xl'],\n view: ['xs', 'sm', 'md', 'lg', 'xl'],\n // Typography sizes for Text component's $typography iterator\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n },\n radii: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],\n shadows: ['none', 'sm', 'md', 'lg', 'xl'],\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n surfaceColors: ['screen', 'primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n textColors: ['primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n borderColors: ['primary', 'secondary', 'tertiary', 'disabled'],\n };\n}\n\n/**\n * Merge theme values, avoiding duplicates.\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues): void {\n target.intents.push(...source.intents.filter(k => !target.intents.includes(k)));\n target.radii.push(...source.radii.filter(k => !target.radii.includes(k)));\n target.shadows.push(...source.shadows.filter(k => !target.shadows.includes(k)));\n target.breakpoints.push(...source.breakpoints.filter(k => !target.breakpoints.includes(k)));\n target.typography.push(...source.typography.filter(k => !target.typography.includes(k)));\n target.surfaceColors.push(...source.surfaceColors.filter(k => !target.surfaceColors.includes(k)));\n target.textColors.push(...source.textColors.filter(k => !target.textColors.includes(k)));\n target.borderColors.push(...source.borderColors.filter(k => !target.borderColors.includes(k)));\n\n for (const [comp, sizes] of Object.entries(source.sizes)) {\n if (!target.sizes[comp]) {\n target.sizes[comp] = sizes;\n }\n }\n}\n\n// Helper functions\n\nfunction getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n return null;\n}\n\nfunction getPropertyName(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isStringLiteral(node)) return node.text;\n return null;\n}\n\nfunction getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter(ts.isPropertyAssignment)\n .map(prop => getPropertyName(prop.name))\n .filter((k): k is string => k !== null);\n}\n\n// ============================================================================\n// Babel Plugin Compatibility Layer\n// ============================================================================\n\n/**\n * Theme keys format expected by the Babel plugin.\n * This is a subset of ThemeValues for backwards compatibility.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n// Global aliases configuration (set via plugin options)\nlet packageAliases: Record<string, string> = {};\n\n/**\n * Resolve an import source using configured aliases.\n * Returns the resolved path or null if no alias matches.\n */\nfunction resolveWithAliases(source: string, fromDir: string): string | null {\n for (const [aliasPrefix, aliasPath] of Object.entries(packageAliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n // Replace the alias prefix with the actual path\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n\n // If aliasPath is relative, resolve from fromDir\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(fromDir, resolved);\n }\n\n return resolved;\n }\n }\n return null;\n}\n\n/**\n * Load theme keys for the Babel plugin.\n * This is a compatibility wrapper around analyzeTheme() that:\n * - Provides caching (only parses once per build)\n * - Returns the subset of keys needed by the Babel plugin\n * - Handles path resolution based on babel opts\n *\n * @param opts - Babel plugin options (requires themePath, optional aliases)\n * @param rootDir - Root directory for path resolution\n * @param _babelTypes - Unused (kept for backwards compatibility)\n * @param verboseMode - Enable verbose logging\n */\nexport function loadThemeKeys(\n opts: { themePath?: string; aliases?: Record<string, string> },\n rootDir: string,\n _babelTypes?: unknown,\n verboseMode = false\n): BabelThemeKeys {\n if (themeLoadAttempted && themeKeysCache) {\n return themeKeysCache;\n }\n themeLoadAttempted = true;\n\n // Set up package aliases for resolution\n if (opts.aliases && typeof opts.aliases === 'object') {\n packageAliases = opts.aliases;\n if (verboseMode) {\n console.log('[idealyst-plugin] Configured aliases:', packageAliases);\n }\n }\n\n const themePath = opts.themePath;\n\n if (!themePath) {\n throw new Error(\n '[idealyst-plugin] themePath is required!\\n' +\n 'Add it to your babel config:\\n' +\n ' [\"@idealyst/theme/plugin\", { themePath: \"./src/theme/styles.ts\" }]'\n );\n }\n\n // First try to resolve using aliases\n let resolvedPath: string;\n const aliasResolved = resolveWithAliases(themePath, rootDir);\n if (aliasResolved && fs.existsSync(aliasResolved)) {\n resolvedPath = aliasResolved;\n } else {\n resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n }\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Analyzing theme file via @idealyst/tooling:', resolvedPath);\n }\n\n // Use the TypeScript-based analyzer\n const themeValues = analyzeTheme(resolvedPath, verboseMode);\n\n // Convert to Babel-compatible format (subset of ThemeValues)\n themeKeysCache = {\n intents: themeValues.intents,\n sizes: themeValues.sizes,\n radii: themeValues.radii,\n shadows: themeValues.shadows,\n typography: themeValues.typography,\n };\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Extracted theme keys:');\n console.log(' intents:', themeKeysCache.intents);\n console.log(' radii:', themeKeysCache.radii);\n console.log(' shadows:', themeKeysCache.shadows);\n console.log(' sizes:');\n for (const [component, sizes] of Object.entries(themeKeysCache.sizes)) {\n console.log(` ${component}:`, sizes);\n }\n }\n\n return themeKeysCache;\n}\n\n/**\n * Reset the theme cache. Useful for testing or hot reload.\n */\nexport function resetThemeCache(): void {\n themeKeysCache = null;\n themeLoadAttempted = false;\n}\n","/**\n * Theme Source Analyzer - Extracts all theme values directly from TypeScript source.\n *\n * This analyzer parses the theme file and extracts all values from the builder API\n * without relying on hardcoded defaults. It traces:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ component: { size: {...}, ... }, ... })\n * - .setColors({ surface: {...}, text: {...}, border: {...}, pallet: {...} })\n * - .setBreakpoints({ xs: 0, sm: 576, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\n\nexport interface ThemeSourceAnalyzerOptions {\n /** Enable verbose logging */\n verbose?: boolean;\n /** Package aliases for resolving imports (e.g., { '@idealyst/theme': '/path/to/packages/theme' }) */\n aliases?: Record<string, string>;\n}\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n aliases: Record<string, string>;\n /** Track analyzed files to avoid cycles */\n analyzedFiles: Set<string>;\n}\n\n/**\n * Analyze a theme file and extract all theme values.\n * This is the main entry point for theme analysis.\n */\nexport function analyzeThemeSource(\n themePath: string,\n options: ThemeSourceAnalyzerOptions = {}\n): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n const verbose = options.verbose ?? false;\n const aliases = options.aliases ?? {};\n\n const log = (...args: unknown[]) => {\n if (verbose) console.log('[theme-source-analyzer]', ...args);\n };\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program with proper module resolution\n const configPath = ts.findConfigFile(path.dirname(resolvedPath), ts.sys.fileExists, 'tsconfig.json');\n let compilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Node10,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n resolveJsonModule: true,\n };\n\n if (configPath) {\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n if (!configFile.error) {\n const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));\n compilerOptions = { ...compilerOptions, ...parsed.options };\n }\n }\n\n const program = ts.createProgram([resolvedPath], compilerOptions);\n const sourceFile = program.getSourceFile(resolvedPath);\n\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n aliases,\n analyzedFiles: new Set([resolvedPath]),\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n log(` Import: ${localName} from '${source}'`);\n }\n }\n }\n });\n\n /**\n * Resolve an import path using aliases.\n */\n function resolveImportPath(source: string, fromFile: string): string | null {\n // Check aliases first\n for (const [aliasPrefix, aliasPath] of Object.entries(ctx.aliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(path.dirname(fromFile), resolved);\n }\n return resolved;\n }\n }\n\n // Try relative resolution\n if (source.startsWith('.')) {\n return path.resolve(path.dirname(fromFile), source);\n }\n\n // Try node_modules resolution\n try {\n return require.resolve(source, { paths: [path.dirname(fromFile)] });\n } catch {\n return null;\n }\n }\n\n /**\n * Find a theme file from a resolved directory/file path.\n */\n function findThemeFile(basePath: string, preferDark: boolean): string | null {\n const themeFileName = preferDark ? 'darkTheme' : 'lightTheme';\n\n const candidates = [\n basePath,\n `${basePath}.ts`,\n `${basePath}.tsx`,\n path.join(basePath, 'src', `${themeFileName}.ts`),\n path.join(basePath, `${themeFileName}.ts`),\n path.join(basePath, 'src', 'index.ts'),\n path.join(basePath, 'index.ts'),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n }\n\n return null;\n }\n\n /**\n * Analyze a base theme file recursively.\n */\n function analyzeBaseTheme(varName: string): void {\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log(`Could not find import for base theme: ${varName}`);\n return;\n }\n\n log(`Analyzing base theme '${varName}' from '${importInfo.source}'`);\n\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (!resolvedBase) {\n log(`Could not resolve import path: ${importInfo.source}`);\n return;\n }\n\n const preferDark = varName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n\n if (!themeFile) {\n log(`Could not find theme file for: ${resolvedBase}`);\n return;\n }\n\n if (ctx.analyzedFiles.has(themeFile)) {\n log(`Already analyzed: ${themeFile}`);\n return;\n }\n\n ctx.analyzedFiles.add(themeFile);\n log(`Recursively analyzing: ${themeFile}`);\n\n // Parse and analyze the base theme file\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n\n // Merge base values (base values come first, current file can override)\n mergeThemeValues(values, baseValues, false);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): { calls: BuilderCall[]; baseThemeVar: string | null } {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n return { calls, baseThemeVar: arg.text };\n }\n }\n }\n return { calls, baseThemeVar: null };\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return { calls, baseThemeVar: null };\n }\n\n /**\n * Get a string value from an AST node.\n */\n function getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n return null;\n }\n\n /**\n * Get all keys from an object literal.\n */\n function getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter((prop): prop is ts.PropertyAssignment => ts.isPropertyAssignment(prop))\n .map(prop => {\n if (ts.isIdentifier(prop.name)) return prop.name.text;\n if (ts.isStringLiteral(prop.name)) return prop.name.text;\n return null;\n })\n .filter((k): k is string => k !== null);\n }\n\n /**\n * Process the collected builder method calls and extract values.\n */\n function processCalls(calls: BuilderCall[]): void {\n log(`Processing ${calls.length} builder method calls`);\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent':\n case 'setIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(` Found intent: ${name}`);\n }\n break;\n }\n\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(` Found radius: ${name}`);\n }\n break;\n }\n\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(` Found shadow: ${name}`);\n }\n break;\n }\n\n case 'addBreakpoint': {\n const name = getStringValue(args[0]);\n if (name && !values.breakpoints.includes(name)) {\n values.breakpoints.push(name);\n log(` Found breakpoint: ${name}`);\n }\n break;\n }\n\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n const keys = getObjectKeys(args[0]);\n for (const key of keys) {\n if (!values.breakpoints.includes(key)) {\n values.breakpoints.push(key);\n }\n }\n log(` Found breakpoints: ${values.breakpoints.join(', ')}`);\n }\n break;\n }\n\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n let componentName: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n componentName = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n componentName = prop.name.text;\n }\n\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n const sizeKeys = getObjectKeys(prop.initializer);\n values.sizes[componentName] = sizeKeys;\n log(` Found sizes for ${componentName}: ${sizeKeys.join(', ')}`);\n\n // Special case: typography sizes also populate the typography array\n if (componentName === 'typography') {\n for (const key of sizeKeys) {\n if (!values.typography.includes(key)) {\n values.typography.push(key);\n }\n }\n }\n }\n }\n }\n } else if (args[0] && ts.isPropertyAccessExpression(args[0])) {\n // Handle references like: .setSizes(lightTheme.sizes)\n const propAccess = args[0];\n if (ts.isIdentifier(propAccess.expression) && propAccess.name.text === 'sizes') {\n const themeVarName = propAccess.expression.text;\n log(` Found sizes reference: ${themeVarName}.sizes`);\n\n // Try to resolve this by analyzing the referenced theme\n const importInfo = imports.get(themeVarName);\n if (importInfo) {\n log(` Resolving sizes from imported theme: ${importInfo.source}`);\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (resolvedBase) {\n const preferDark = themeVarName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n if (themeFile && !ctx.analyzedFiles.has(themeFile)) {\n ctx.analyzedFiles.add(themeFile);\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n // Copy sizes from base theme\n for (const [comp, sizes] of Object.entries(baseValues.sizes)) {\n if (!values.sizes[comp]) {\n values.sizes[comp] = sizes;\n log(` Inherited sizes for ${comp}: ${sizes.join(', ')}`);\n }\n }\n // Also copy typography if we inherited it\n for (const typo of baseValues.typography) {\n if (!values.typography.includes(typo)) {\n values.typography.push(typo);\n }\n }\n }\n }\n }\n }\n }\n break;\n }\n\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n let colorType: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n colorType = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n colorType = prop.name.text;\n }\n\n if (colorType && ts.isObjectLiteralExpression(prop.initializer)) {\n const colorKeys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = colorKeys;\n log(` Found surface colors: ${colorKeys.join(', ')}`);\n break;\n case 'text':\n values.textColors = colorKeys;\n log(` Found text colors: ${colorKeys.join(', ')}`);\n break;\n case 'border':\n values.borderColors = colorKeys;\n log(` Found border colors: ${colorKeys.join(', ')}`);\n break;\n }\n }\n // Handle function calls like generateColorPallette() for pallet\n // We skip pallet since it's typically generated dynamically\n }\n }\n }\n break;\n }\n\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(` Found surface color: ${name}`);\n }\n break;\n }\n\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(` Found text color: ${name}`);\n }\n break;\n }\n\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(` Found border color: ${name}`);\n }\n break;\n }\n\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(` Found pallet color: ${name}`);\n }\n break;\n }\n\n case 'build':\n // End of chain, nothing to extract\n break;\n\n default:\n log(` Skipping unknown method: ${method}`);\n }\n }\n }\n\n /**\n * Process a node that might be a builder chain ending with .build().\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === 'build') {\n log('Found .build() call, tracing chain...');\n const { calls, baseThemeVar } = traceBuilderCalls(node);\n\n // First analyze base theme if there is one\n if (baseThemeVar) {\n log(`Found fromTheme(${baseThemeVar})`);\n analyzeBaseTheme(baseThemeVar);\n }\n\n // Then process this file's calls (can override base)\n processCalls(calls);\n return;\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n // Main analysis pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations: const lightTheme = createTheme()...build();\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n\n // Handle export statements: export const theme = ...\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n log('Analysis complete:');\n log(` Intents: ${values.intents.join(', ')}`);\n log(` Radii: ${values.radii.join(', ')}`);\n log(` Shadows: ${values.shadows.join(', ')}`);\n log(` Breakpoints: ${values.breakpoints.join(', ')}`);\n log(` Typography: ${values.typography.join(', ')}`);\n log(` Size components: ${Object.keys(values.sizes).join(', ')}`);\n\n return values;\n}\n\n/**\n * Merge source theme values into target.\n * @param target - The target to merge into\n * @param source - The source to merge from\n * @param sourceOverrides - If true, source values replace target; if false, target values take precedence\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues, sourceOverrides: boolean): void {\n // Helper to merge arrays without duplicates\n const mergeArrays = (targetArr: string[], sourceArr: string[]): void => {\n for (const item of sourceArr) {\n if (!targetArr.includes(item)) {\n targetArr.push(item);\n }\n }\n };\n\n mergeArrays(target.intents, source.intents);\n mergeArrays(target.radii, source.radii);\n mergeArrays(target.shadows, source.shadows);\n mergeArrays(target.breakpoints, source.breakpoints);\n mergeArrays(target.typography, source.typography);\n mergeArrays(target.surfaceColors, source.surfaceColors);\n mergeArrays(target.textColors, source.textColors);\n mergeArrays(target.borderColors, source.borderColors);\n\n // Merge sizes - component by component\n for (const [component, sizes] of Object.entries(source.sizes)) {\n if (sourceOverrides || !target.sizes[component]) {\n target.sizes[component] = sizes;\n }\n }\n}\n\n/**\n * Convert ThemeValues to the format expected by the Babel plugin.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n}\n\nexport function toBabelThemeKeys(values: ThemeValues): BabelThemeKeys {\n return {\n intents: values.intents,\n sizes: values.sizes,\n radii: values.radii,\n shadows: values.shadows,\n typography: values.typography,\n };\n}\n"],"mappings":";;;;;;;;AA4BA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;;;ACnBtB,YAAYC,SAAQ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,OAAO,YAAY,cAAc,OAAO,CAAC,EACrE,OAAO,OAAK,EAAE,OAAO,EAAE,GAAG,SAAS,mBAAmB,KAAK,EAAE,GAAG,SAAS,6BAA6B,EAAE;AAE3G,oBAAY,QAAQ,OAAK,OAAO,YAAY,iBAAiB,CAAC,CAAC;AAE/D,YAAI,YAAY,SAAS,GAAG;AAC1B,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,aAAa;AACX,iBAAW,iBAAiB;AAAA,IAC9B;AAAA,EACF;AACF;AAKO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO,kBAAkB,OAAO;AAClC;","names":["fs","path","ts","fs","path","ts","fs","path","analyzeBaseTheme","getStringValue","getObjectKeys","mergeThemeValues"]}
1
+ {"version":3,"sources":["../src/vite-plugin.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts","../src/analyzer/theme-source-analyzer.ts"],"sourcesContent":["/**\n * Idealyst Docs Vite Plugin\n *\n * Generates a component registry at build time by analyzing TypeScript source.\n * Replaces placeholder exports from @idealyst/tooling with actual generated values.\n *\n * Usage:\n * ```ts\n * // vite.config.ts\n * import { idealystDocsPlugin } from '@idealyst/tooling';\n *\n * export default defineConfig({\n * plugins: [\n * idealystDocsPlugin({\n * componentPaths: ['../../packages/components/src'],\n * themePath: '../../packages/theme/src/lightTheme.ts',\n * }),\n * ],\n * });\n * ```\n *\n * Then in your app:\n * ```ts\n * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';\n * ```\n */\n\nimport type { Plugin } from 'vite';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { analyzeComponents } from './analyzer';\nimport type { IdealystDocsPluginOptions, ComponentRegistry } from './analyzer/types';\n\n/**\n * Create the Idealyst Docs Vite plugin.\n */\nexport function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin {\n let registry: ComponentRegistry | null = null;\n\n const { debug = false, output, outputPath } = options;\n\n const log = (...args: any[]) => {\n if (debug) console.log('[idealyst-docs]', ...args);\n };\n\n /**\n * Generate the registry by analyzing components.\n */\n function generateRegistry(): ComponentRegistry {\n log('Generating component registry...');\n log('Component paths:', options.componentPaths);\n log('Theme path:', options.themePath);\n\n try {\n registry = analyzeComponents(options);\n log(`Generated registry with ${Object.keys(registry).length} components`);\n if (debug) {\n log('Components found:', Object.keys(registry));\n }\n\n // Optionally write to file\n if (output === 'file' && outputPath) {\n const outputDir = path.dirname(outputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n fs.writeFileSync(\n outputPath,\n `// Auto-generated by @idealyst/tooling - DO NOT EDIT\\n` +\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)} as const;\\n`\n );\n log(`Wrote registry to ${outputPath}`);\n }\n\n return registry;\n } catch (error) {\n console.error('[idealyst-docs] Error generating registry:', error);\n return {};\n }\n }\n\n return {\n name: 'idealyst-docs',\n\n // Transform @idealyst/tooling to inject the actual registry\n transform(code, id) {\n // Check if this is the tooling package's index file\n const isToolingIndex = id.includes('@idealyst/tooling') && id.endsWith('index.ts');\n const isToolingSrc = id.includes('/packages/tooling/src/index.ts');\n\n if (isToolingIndex || isToolingSrc) {\n console.log(`[idealyst-docs] Transforming tooling index: ${id}`);\n\n if (!registry) {\n registry = generateRegistry();\n }\n\n // Replace the placeholder exports with actual values\n let transformed = code;\n\n // Replace: export const componentRegistry = {};\n // Note: TypeScript types are stripped before transform, so we match JS not TS\n transformed = transformed.replace(\n /export const componentRegistry\\s*=\\s*\\{\\s*\\};?/,\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)};`\n );\n\n log(`Code transformed: ${code !== transformed}`);\n\n // Replace: export const componentNames = [];\n // Note: TypeScript types are stripped before transform\n transformed = transformed.replace(\n /export const componentNames\\s*=\\s*\\[\\s*\\];?/,\n `export const componentNames = ${JSON.stringify(Object.keys(registry))};`\n );\n\n // Replace getComponentsByCategory with actual implementation that uses the real registry\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getComponentsByCategory\\(category\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getComponentsByCategory(category) {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}`\n );\n\n // Replace getPropConfig with actual implementation\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getPropConfig\\(componentName\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getPropConfig(componentName) {\n const def = componentRegistry[componentName];\n if (!def) return {};\n return Object.entries(def.props).reduce((acc, [key, prop]) => {\n if (prop.values && prop.values.length > 0) {\n acc[key] = { type: 'select', options: prop.values, default: prop.default };\n } else if (prop.type === 'boolean') {\n acc[key] = { type: 'boolean', default: prop.default ?? false };\n } else if (prop.type === 'string') {\n acc[key] = { type: 'text', default: prop.default ?? '' };\n } else if (prop.type === 'number') {\n acc[key] = { type: 'number', default: prop.default ?? 0 };\n }\n return acc;\n }, {});\n}`\n );\n\n return {\n code: transformed,\n map: null,\n };\n }\n\n return null;\n },\n\n // Regenerate on component file changes\n handleHotUpdate({ file, server }) {\n // Check if the changed file is a component file\n const isComponentFile =\n options.componentPaths.some(p => file.includes(path.resolve(p))) &&\n (file.endsWith('.ts') || file.endsWith('.tsx'));\n\n // Check if the changed file is the theme file\n const isThemeFile = file.includes(path.resolve(options.themePath));\n\n if (isComponentFile || isThemeFile) {\n log(`File changed: ${file}, regenerating registry...`);\n\n // Clear cached registry\n registry = null;\n\n // Invalidate the tooling module to trigger re-transform\n const toolingMods = Array.from(server.moduleGraph.idToModuleMap.values())\n .filter(m => m.id && (m.id.includes('@idealyst/tooling') || m.id.includes('/packages/tooling/src/index')));\n\n toolingMods.forEach(m => server.moduleGraph.invalidateModule(m));\n\n if (toolingMods.length > 0) {\n return toolingMods;\n }\n }\n },\n\n // Generate on build\n buildStart() {\n registry = generateRegistry();\n },\n };\n}\n\n/**\n * Standalone function to generate registry (for MCP server or CLI).\n */\nexport function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry {\n return analyzeComponents(options);\n}\n","/**\n * Component Analyzer - Extracts component prop definitions using TypeScript Compiler API.\n *\n * Analyzes:\n * - types.ts files for prop interfaces\n * - JSDoc comments for descriptions\n * - Static .description properties on components\n * - Theme-derived types (Intent, Size) resolved to actual values\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n ComponentRegistry,\n ComponentDefinition,\n PropDefinition,\n ComponentAnalyzerOptions,\n ThemeValues,\n ComponentCategory,\n SampleProps,\n} from './types';\nimport { analyzeTheme } from './theme-analyzer';\n\n/**\n * Analyze components and generate a registry.\n */\nexport function analyzeComponents(options: ComponentAnalyzerOptions): ComponentRegistry {\n const { componentPaths, themePath, include, exclude, includeInternal = false } = options;\n\n const registry: ComponentRegistry = {};\n\n // First, analyze the theme to get valid values\n const themeValues = analyzeTheme(themePath, false);\n\n // Scan each component path\n for (const componentPath of componentPaths) {\n const resolvedPath = path.resolve(componentPath);\n\n if (!fs.existsSync(resolvedPath)) {\n console.warn(`[component-analyzer] Path not found: ${resolvedPath}`);\n continue;\n }\n\n // Find all component directories (those with index.ts or types.ts)\n const componentDirs = findComponentDirs(resolvedPath);\n\n for (const dir of componentDirs) {\n const componentName = path.basename(dir);\n\n // Apply include/exclude filters\n if (include && !include.includes(componentName)) continue;\n if (exclude && exclude.includes(componentName)) continue;\n if (!includeInternal && componentName.startsWith('_')) continue;\n\n const definition = analyzeComponentDir(dir, componentName, themeValues);\n if (definition) {\n registry[componentName] = definition;\n }\n }\n }\n\n return registry;\n}\n\n/**\n * Find all component directories in a path.\n */\nfunction findComponentDirs(basePath: string): string[] {\n const dirs: string[] = [];\n\n const entries = fs.readdirSync(basePath, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n const dirPath = path.join(basePath, entry.name);\n\n // Check if it's a component directory (has index.ts or types.ts)\n const hasIndex = fs.existsSync(path.join(dirPath, 'index.ts'));\n const hasTypes = fs.existsSync(path.join(dirPath, 'types.ts'));\n\n if (hasIndex || hasTypes) {\n dirs.push(dirPath);\n }\n }\n\n return dirs;\n}\n\n/**\n * Analyze a single component directory.\n */\nfunction analyzeComponentDir(\n dir: string,\n componentName: string,\n themeValues: ThemeValues\n): ComponentDefinition | null {\n // Find all TypeScript files in the component directory\n const tsFiles = fs.readdirSync(dir)\n .filter(f => f.endsWith('.ts') || f.endsWith('.tsx'))\n .map(f => path.join(dir, f));\n\n if (tsFiles.length === 0) {\n return null;\n }\n\n // Create TypeScript program with all files\n const program = ts.createProgram(tsFiles, {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n });\n\n const typeChecker = program.getTypeChecker();\n\n // Search all files for the props interface\n const propsInterfaceName = `${componentName}Props`;\n const altNames = [`${componentName}ComponentProps`, 'Props'];\n let propsInterface: ts.InterfaceDeclaration | ts.TypeAliasDeclaration | null = null;\n let interfaceDescription: string | undefined;\n\n // Search each file for the props interface\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n // First try the main props interface name\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n if (ts.isTypeAliasDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n\n // If not found, try alternate naming conventions\n if (!propsInterface) {\n for (const altName of altNames) {\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n ts.forEachChild(sourceFile, (node) => {\n if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) && node.name.text === altName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n if (propsInterface) break;\n }\n }\n\n // If we couldn't find a props interface, skip this component\n if (!propsInterface) {\n return null;\n }\n\n // Extract props\n const props: Record<string, PropDefinition> = {};\n\n if (propsInterface) {\n const type = typeChecker.getTypeAtLocation(propsInterface);\n const properties = type.getProperties();\n\n for (const prop of properties) {\n const propDef = analyzeProperty(prop, typeChecker, themeValues);\n if (propDef && !isInternalProp(propDef.name)) {\n props[propDef.name] = propDef;\n }\n }\n }\n\n // Get description from the props interface JSDoc (single source of truth in types.ts)\n const description = interfaceDescription;\n\n // Determine category\n const category = inferCategory(componentName);\n\n // Look for docs.ts to extract sample props\n const sampleProps = extractSampleProps(dir);\n\n return {\n name: componentName,\n description,\n props,\n category,\n filePath: path.relative(process.cwd(), dir),\n sampleProps,\n };\n}\n\n/**\n * Extract sample props from docs.ts file if it exists.\n * The docs.ts file should export a `sampleProps` object.\n */\nfunction extractSampleProps(dir: string): SampleProps | undefined {\n const docsPath = path.join(dir, 'docs.ts');\n\n if (!fs.existsSync(docsPath)) {\n return undefined;\n }\n\n try {\n const content = fs.readFileSync(docsPath, 'utf-8');\n\n // Create a simple TypeScript program to extract the sampleProps export\n const sourceFile = ts.createSourceFile(\n 'docs.ts',\n content,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS\n );\n\n let samplePropsNode: ts.ObjectLiteralExpression | null = null;\n\n // Find the sampleProps export\n ts.forEachChild(sourceFile, (node) => {\n // Handle: export const sampleProps = { ... }\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword);\n if (isExported) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name) && decl.name.text === 'sampleProps' && decl.initializer) {\n if (ts.isObjectLiteralExpression(decl.initializer)) {\n samplePropsNode = decl.initializer;\n }\n }\n }\n }\n }\n });\n\n if (!samplePropsNode) {\n return undefined;\n }\n\n // Extract the object literal as JSON-compatible structure\n // This is a simplified extraction - it handles basic literals\n const result: SampleProps = {};\n const propsNode = samplePropsNode as ts.ObjectLiteralExpression;\n\n for (const prop of propsNode.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const propName = prop.name.text;\n\n if (propName === 'props' && ts.isObjectLiteralExpression(prop.initializer)) {\n result.props = extractObjectLiteral(prop.initializer, content);\n } else if (propName === 'children') {\n // For children, we store the raw source text\n result.children = prop.initializer.getText(sourceFile);\n } else if (propName === 'state' && ts.isObjectLiteralExpression(prop.initializer)) {\n // Extract state configuration for controlled components\n result.state = extractObjectLiteral(prop.initializer, content);\n }\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n } catch (e) {\n console.warn(`[component-analyzer] Error reading docs.ts in ${dir}:`, e);\n return undefined;\n }\n}\n\n/**\n * Extract an object literal to a plain object (for simple literal values).\n */\nfunction extractObjectLiteral(node: ts.ObjectLiteralExpression, sourceContent: string): Record<string, any> {\n const result: Record<string, any> = {};\n\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const key = prop.name.text;\n const init = prop.initializer;\n\n if (ts.isStringLiteral(init)) {\n result[key] = init.text;\n } else if (ts.isNumericLiteral(init)) {\n result[key] = Number(init.text);\n } else if (init.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true;\n } else if (init.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false;\n } else if (ts.isArrayLiteralExpression(init)) {\n result[key] = extractArrayLiteral(init, sourceContent);\n } else if (ts.isObjectLiteralExpression(init)) {\n result[key] = extractObjectLiteral(init, sourceContent);\n } else {\n // For complex expressions (JSX, functions), store the raw source\n result[key] = init.getText();\n }\n }\n }\n\n return result;\n}\n\n/**\n * Extract an array literal to a plain array.\n */\nfunction extractArrayLiteral(node: ts.ArrayLiteralExpression, sourceContent: string): any[] {\n const result: any[] = [];\n\n for (const element of node.elements) {\n if (ts.isStringLiteral(element)) {\n result.push(element.text);\n } else if (ts.isNumericLiteral(element)) {\n result.push(Number(element.text));\n } else if (element.kind === ts.SyntaxKind.TrueKeyword) {\n result.push(true);\n } else if (element.kind === ts.SyntaxKind.FalseKeyword) {\n result.push(false);\n } else if (ts.isObjectLiteralExpression(element)) {\n result.push(extractObjectLiteral(element, sourceContent));\n } else if (ts.isArrayLiteralExpression(element)) {\n result.push(extractArrayLiteral(element, sourceContent));\n } else {\n // For complex expressions, store raw source\n result.push(element.getText());\n }\n }\n\n return result;\n}\n\n/**\n * Analyze a single property symbol.\n */\nfunction analyzeProperty(\n symbol: ts.Symbol,\n typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): PropDefinition | null {\n const name = symbol.getName();\n const declarations = symbol.getDeclarations();\n\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n const type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n const typeString = typeChecker.typeToString(type);\n\n // Get JSDoc description\n const description = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)) || undefined;\n\n // Check if required\n const required = !(symbol.flags & ts.SymbolFlags.Optional);\n\n // Extract values for union types / theme types\n const values = extractPropValues(type, typeString, typeChecker, themeValues);\n\n // Extract default value (from JSDoc @default tag)\n const defaultValue = extractDefaultValue(symbol);\n\n return {\n name,\n type: simplifyTypeName(typeString),\n values: values.length > 0 ? values : undefined,\n default: defaultValue,\n description,\n required,\n };\n}\n\n/**\n * Extract valid values for a prop type.\n */\nfunction extractPropValues(\n type: ts.Type,\n typeString: string,\n _typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): string[] {\n // Handle theme-derived types\n if (typeString === 'Intent' || typeString.includes('Intent')) {\n return themeValues.intents;\n }\n if (typeString === 'Size' || typeString.includes('Size')) {\n // Return generic sizes - most components use the same keys\n return ['xs', 'sm', 'md', 'lg', 'xl'];\n }\n\n // Handle union types\n if (type.isUnion()) {\n const values: string[] = [];\n for (const unionType of type.types) {\n if (unionType.isStringLiteral()) {\n values.push(unionType.value);\n } else if ((unionType as any).intrinsicName === 'true') {\n values.push('true');\n } else if ((unionType as any).intrinsicName === 'false') {\n values.push('false');\n }\n }\n if (values.length > 0) return values;\n }\n\n // Handle boolean\n if (typeString === 'boolean') {\n return ['true', 'false'];\n }\n\n return [];\n}\n\n/**\n * Extract default value from JSDoc @default tag.\n */\nfunction extractDefaultValue(symbol: ts.Symbol): string | number | boolean | undefined {\n const tags = symbol.getJsDocTags();\n for (const tag of tags) {\n if (tag.name === 'default' && tag.text) {\n const value = ts.displayPartsToString(tag.text);\n // Try to parse as JSON\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Get JSDoc description from a node.\n */\nfunction getJSDocDescription(node: ts.Node): string | undefined {\n const jsDocs = (node as any).jsDoc as ts.JSDoc[] | undefined;\n if (!jsDocs || jsDocs.length === 0) return undefined;\n\n const firstDoc = jsDocs[0];\n if (firstDoc.comment) {\n if (typeof firstDoc.comment === 'string') {\n return firstDoc.comment;\n }\n // Handle NodeArray of JSDocComment\n return (firstDoc.comment as ts.NodeArray<ts.JSDocComment>)\n .map(c => (c as any).text || '')\n .join('');\n }\n return undefined;\n}\n\n/**\n * Simplify type names for display.\n */\nfunction simplifyTypeName(typeString: string): string {\n // Remove import paths\n typeString = typeString.replace(/import\\([^)]+\\)\\./g, '');\n\n // Simplify common complex types\n if (typeString.includes('ReactNode')) return 'ReactNode';\n if (typeString.includes('StyleProp')) return 'Style';\n\n return typeString;\n}\n\n/**\n * Check if a prop should be excluded (internal/inherited).\n */\nfunction isInternalProp(name: string): boolean {\n const internalProps = [\n 'ref',\n 'key',\n 'children',\n 'style',\n 'testID',\n 'nativeID',\n 'accessible',\n 'accessibilityActions',\n 'accessibilityComponentType',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLiveRegion',\n 'accessibilityRole',\n 'accessibilityState',\n 'accessibilityTraits',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'collapsable',\n 'focusable',\n 'hasTVPreferredFocus',\n 'hitSlop',\n 'importantForAccessibility',\n 'needsOffscreenAlphaCompositing',\n 'onAccessibilityAction',\n 'onAccessibilityEscape',\n 'onAccessibilityTap',\n 'onLayout',\n 'onMagicTap',\n 'onMoveShouldSetResponder',\n 'onMoveShouldSetResponderCapture',\n 'onResponderEnd',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderReject',\n 'onResponderRelease',\n 'onResponderStart',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'onStartShouldSetResponderCapture',\n 'pointerEvents',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'shouldRasterizeIOS',\n 'tvParallaxMagnification',\n 'tvParallaxProperties',\n 'tvParallaxShiftDistanceX',\n 'tvParallaxShiftDistanceY',\n 'tvParallaxTiltAngle',\n ];\n\n return internalProps.includes(name) || name.startsWith('accessibility');\n}\n\n/**\n * Infer component category from name.\n */\nfunction inferCategory(componentName: string): ComponentCategory {\n const formComponents = ['Button', 'Input', 'Checkbox', 'Select', 'Switch', 'RadioButton', 'Slider', 'TextArea'];\n const displayComponents = ['Text', 'Card', 'Badge', 'Chip', 'Avatar', 'Icon', 'Skeleton', 'Alert', 'Tooltip'];\n const layoutComponents = ['View', 'Screen', 'Divider'];\n const navigationComponents = ['TabBar', 'Breadcrumb', 'Menu', 'List', 'Link'];\n const overlayComponents = ['Dialog', 'Popover', 'Modal'];\n const dataComponents = ['Table', 'Progress', 'Accordion'];\n\n if (formComponents.includes(componentName)) return 'form';\n if (displayComponents.includes(componentName)) return 'display';\n if (layoutComponents.includes(componentName)) return 'layout';\n if (navigationComponents.includes(componentName)) return 'navigation';\n if (overlayComponents.includes(componentName)) return 'overlay';\n if (dataComponents.includes(componentName)) return 'data';\n\n return 'display'; // Default\n}\n","/**\n * Theme Analyzer - Extracts theme keys by statically analyzing theme files.\n *\n * Uses TypeScript Compiler API to trace the declarative builder API:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ button: { xs: {}, sm: {}, ... }, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\nimport { analyzeThemeSource } from './theme-source-analyzer';\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n}\n\n/**\n * Extract theme values from a theme file.\n */\nexport function analyzeTheme(themePath: string, verbose = false): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n const log = (...args: any[]) => {\n if (verbose) console.log('[theme-analyzer]', ...args);\n };\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program\n const program = ts.createProgram([resolvedPath], {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n });\n\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n }\n }\n }\n });\n\n /**\n * Process a builder method call chain.\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression)) {\n const methodName = node.expression.name.text;\n\n if (methodName === 'build') {\n // Trace the full chain\n const calls = traceBuilderCalls(node);\n processCalls(calls);\n return;\n }\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): BuilderCall[] {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n // Analyze base theme\n analyzeBaseTheme(arg.text, imports, values, ctx);\n }\n }\n }\n return calls;\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return calls;\n }\n\n /**\n * Process the collected builder method calls.\n */\n function processCalls(calls: BuilderCall[]): void {\n log('Processing', calls.length, 'builder method calls');\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent':\n case 'setIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(' Found intent:', name);\n }\n break;\n }\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(' Found radius:', name);\n }\n break;\n }\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(' Found shadow:', name);\n }\n break;\n }\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const componentName = getPropertyName(prop.name);\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n values.sizes[componentName] = getObjectKeys(prop.initializer);\n log(' Found sizes for', componentName + ':', values.sizes[componentName]);\n }\n }\n }\n }\n break;\n }\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n values.breakpoints = getObjectKeys(args[0]);\n log(' Found breakpoints:', values.breakpoints);\n }\n break;\n }\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const colorType = getPropertyName(prop.name);\n if (ts.isObjectLiteralExpression(prop.initializer)) {\n const keys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = keys;\n log(' Found surface colors:', keys);\n break;\n case 'text':\n values.textColors = keys;\n log(' Found text colors:', keys);\n break;\n case 'border':\n values.borderColors = keys;\n log(' Found border colors:', keys);\n break;\n }\n }\n }\n }\n }\n break;\n }\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(' Found surface color:', name);\n }\n break;\n }\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(' Found text color:', name);\n }\n break;\n }\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(' Found border color:', name);\n }\n break;\n }\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(' Found pallet color:', name);\n }\n break;\n }\n case 'build':\n // End of chain\n break;\n default:\n log(' Skipping unknown method:', method);\n }\n }\n }\n\n // Second pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n // Handle export statements\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n // Extract typography keys from sizes if present\n if (values.sizes['typography']) {\n values.typography = values.sizes['typography'];\n }\n\n log('Extracted theme values:', values);\n\n return values;\n}\n\n/**\n * Analyze a base theme file referenced by an import.\n */\nfunction analyzeBaseTheme(\n varName: string,\n imports: Map<string, { source: string; imported: string }>,\n values: ThemeValues,\n ctx: AnalyzerContext\n): void {\n const log = (...args: any[]) => {\n if (ctx.verbose) console.log('[theme-analyzer]', ...args);\n };\n\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log('Could not find import for base theme:', varName);\n return;\n }\n\n log('Base theme', varName, 'imported from', importInfo.source);\n\n // For @idealyst/theme imports, try to analyze from source using aliases\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Check if we have an alias for @idealyst/theme\n const aliasPath = packageAliases['@idealyst/theme'];\n if (aliasPath) {\n // Determine which theme file to analyze based on variable name\n const themeFileName = varName.toLowerCase().includes('dark') ? 'darkTheme.ts' : 'lightTheme.ts';\n const themePath = path.join(aliasPath, 'src', themeFileName);\n\n if (fs.existsSync(themePath)) {\n log(`Analyzing @idealyst/theme from source: ${themePath}`);\n try {\n const sourceValues = analyzeThemeSource(themePath, {\n verbose: ctx.verbose,\n aliases: packageAliases,\n });\n mergeThemeValues(values, sourceValues);\n log('Successfully extracted values from source');\n return;\n } catch (err) {\n log('Failed to analyze source, falling back to defaults:', (err as Error).message);\n }\n } else {\n log(`Theme file not found at alias path: ${themePath}`);\n }\n }\n\n // Fall back to default values if alias resolution fails\n log('Using default @idealyst/theme values');\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\n return;\n }\n\n // For relative imports, try to resolve and analyze\n // (This is simplified - full implementation would recursively analyze)\n log('Skipping base theme analysis for:', importInfo.source);\n}\n\n/**\n * Get default theme values from @idealyst/theme.\n */\nfunction getDefaultThemeValues(): ThemeValues {\n return {\n intents: ['primary', 'success', 'danger', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n iconButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n chip: ['xs', 'sm', 'md', 'lg', 'xl'],\n badge: ['xs', 'sm', 'md', 'lg', 'xl'],\n icon: ['xs', 'sm', 'md', 'lg', 'xl'],\n input: ['xs', 'sm', 'md', 'lg', 'xl'],\n radioButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n select: ['xs', 'sm', 'md', 'lg', 'xl'],\n slider: ['xs', 'sm', 'md', 'lg', 'xl'],\n switch: ['xs', 'sm', 'md', 'lg', 'xl'],\n textarea: ['xs', 'sm', 'md', 'lg', 'xl'],\n avatar: ['xs', 'sm', 'md', 'lg', 'xl'],\n progress: ['xs', 'sm', 'md', 'lg', 'xl'],\n accordion: ['xs', 'sm', 'md', 'lg', 'xl'],\n activityIndicator: ['xs', 'sm', 'md', 'lg', 'xl'],\n alert: ['xs', 'sm', 'md', 'lg', 'xl'],\n breadcrumb: ['xs', 'sm', 'md', 'lg', 'xl'],\n list: ['xs', 'sm', 'md', 'lg', 'xl'],\n menu: ['xs', 'sm', 'md', 'lg', 'xl'],\n text: ['xs', 'sm', 'md', 'lg', 'xl'],\n tabBar: ['xs', 'sm', 'md', 'lg', 'xl'],\n table: ['xs', 'sm', 'md', 'lg', 'xl'],\n tooltip: ['xs', 'sm', 'md', 'lg', 'xl'],\n view: ['xs', 'sm', 'md', 'lg', 'xl'],\n // Typography sizes for Text component's $typography iterator\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n },\n radii: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],\n shadows: ['none', 'sm', 'md', 'lg', 'xl'],\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n surfaceColors: ['screen', 'primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n textColors: ['primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n borderColors: ['primary', 'secondary', 'tertiary', 'disabled'],\n };\n}\n\n/**\n * Merge theme values, avoiding duplicates.\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues): void {\n target.intents.push(...source.intents.filter(k => !target.intents.includes(k)));\n target.radii.push(...source.radii.filter(k => !target.radii.includes(k)));\n target.shadows.push(...source.shadows.filter(k => !target.shadows.includes(k)));\n target.breakpoints.push(...source.breakpoints.filter(k => !target.breakpoints.includes(k)));\n target.typography.push(...source.typography.filter(k => !target.typography.includes(k)));\n target.surfaceColors.push(...source.surfaceColors.filter(k => !target.surfaceColors.includes(k)));\n target.textColors.push(...source.textColors.filter(k => !target.textColors.includes(k)));\n target.borderColors.push(...source.borderColors.filter(k => !target.borderColors.includes(k)));\n\n for (const [comp, sizes] of Object.entries(source.sizes)) {\n if (!target.sizes[comp]) {\n target.sizes[comp] = sizes;\n }\n }\n}\n\n// Helper functions\n\nfunction getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n return null;\n}\n\nfunction getPropertyName(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isStringLiteral(node)) return node.text;\n return null;\n}\n\nfunction getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter(ts.isPropertyAssignment)\n .map(prop => getPropertyName(prop.name))\n .filter((k): k is string => k !== null);\n}\n\n// ============================================================================\n// Babel Plugin Compatibility Layer\n// ============================================================================\n\n/**\n * Theme keys format expected by the Babel plugin.\n * This is a subset of ThemeValues for backwards compatibility.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n surfaceColors: string[];\n textColors: string[];\n borderColors: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n// Global aliases configuration (set via plugin options)\nlet packageAliases: Record<string, string> = {};\n\n/**\n * Resolve an import source using configured aliases.\n * Returns the resolved path or null if no alias matches.\n */\nfunction resolveWithAliases(source: string, fromDir: string): string | null {\n for (const [aliasPrefix, aliasPath] of Object.entries(packageAliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n // Replace the alias prefix with the actual path\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n\n // If aliasPath is relative, resolve from fromDir\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(fromDir, resolved);\n }\n\n return resolved;\n }\n }\n return null;\n}\n\n/**\n * Load theme keys for the Babel plugin.\n * This is a compatibility wrapper around analyzeTheme() that:\n * - Provides caching (only parses once per build)\n * - Returns the subset of keys needed by the Babel plugin\n * - Handles path resolution based on babel opts\n *\n * @param opts - Babel plugin options (requires themePath, optional aliases)\n * @param rootDir - Root directory for path resolution\n * @param _babelTypes - Unused (kept for backwards compatibility)\n * @param verboseMode - Enable verbose logging\n */\nexport function loadThemeKeys(\n opts: { themePath?: string; aliases?: Record<string, string> },\n rootDir: string,\n _babelTypes?: unknown,\n verboseMode = false\n): BabelThemeKeys {\n if (themeLoadAttempted && themeKeysCache) {\n return themeKeysCache;\n }\n themeLoadAttempted = true;\n\n // Set up package aliases for resolution\n if (opts.aliases && typeof opts.aliases === 'object') {\n packageAliases = opts.aliases;\n if (verboseMode) {\n console.log('[idealyst-plugin] Configured aliases:', packageAliases);\n }\n }\n\n const themePath = opts.themePath;\n\n if (!themePath) {\n throw new Error(\n '[idealyst-plugin] themePath is required!\\n' +\n 'Add it to your babel config:\\n' +\n ' [\"@idealyst/theme/plugin\", { themePath: \"./src/theme/styles.ts\" }]'\n );\n }\n\n // First try to resolve using aliases\n let resolvedPath: string;\n const aliasResolved = resolveWithAliases(themePath, rootDir);\n if (aliasResolved && fs.existsSync(aliasResolved)) {\n resolvedPath = aliasResolved;\n } else {\n resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n }\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Analyzing theme file via @idealyst/tooling:', resolvedPath);\n }\n\n // Use the TypeScript-based analyzer\n const themeValues = analyzeTheme(resolvedPath, verboseMode);\n\n // Convert to Babel-compatible format (subset of ThemeValues)\n themeKeysCache = {\n intents: themeValues.intents,\n sizes: themeValues.sizes,\n radii: themeValues.radii,\n shadows: themeValues.shadows,\n typography: themeValues.typography,\n surfaceColors: themeValues.surfaceColors,\n textColors: themeValues.textColors,\n borderColors: themeValues.borderColors,\n };\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Extracted theme keys:');\n console.log(' intents:', themeKeysCache.intents);\n console.log(' radii:', themeKeysCache.radii);\n console.log(' shadows:', themeKeysCache.shadows);\n console.log(' surfaceColors:', themeKeysCache.surfaceColors);\n console.log(' textColors:', themeKeysCache.textColors);\n console.log(' borderColors:', themeKeysCache.borderColors);\n console.log(' sizes:');\n for (const [component, sizes] of Object.entries(themeKeysCache.sizes)) {\n console.log(` ${component}:`, sizes);\n }\n }\n\n return themeKeysCache;\n}\n\n/**\n * Reset the theme cache. Useful for testing or hot reload.\n */\nexport function resetThemeCache(): void {\n themeKeysCache = null;\n themeLoadAttempted = false;\n}\n","/**\n * Theme Source Analyzer - Extracts all theme values directly from TypeScript source.\n *\n * This analyzer parses the theme file and extracts all values from the builder API\n * without relying on hardcoded defaults. It traces:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ component: { size: {...}, ... }, ... })\n * - .setColors({ surface: {...}, text: {...}, border: {...}, pallet: {...} })\n * - .setBreakpoints({ xs: 0, sm: 576, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\n\nexport interface ThemeSourceAnalyzerOptions {\n /** Enable verbose logging */\n verbose?: boolean;\n /** Package aliases for resolving imports (e.g., { '@idealyst/theme': '/path/to/packages/theme' }) */\n aliases?: Record<string, string>;\n}\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n aliases: Record<string, string>;\n /** Track analyzed files to avoid cycles */\n analyzedFiles: Set<string>;\n}\n\n/**\n * Analyze a theme file and extract all theme values.\n * This is the main entry point for theme analysis.\n */\nexport function analyzeThemeSource(\n themePath: string,\n options: ThemeSourceAnalyzerOptions = {}\n): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n const verbose = options.verbose ?? false;\n const aliases = options.aliases ?? {};\n\n const log = (...args: unknown[]) => {\n if (verbose) console.log('[theme-source-analyzer]', ...args);\n };\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program with proper module resolution\n const configPath = ts.findConfigFile(path.dirname(resolvedPath), ts.sys.fileExists, 'tsconfig.json');\n let compilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Node10,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n resolveJsonModule: true,\n };\n\n if (configPath) {\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n if (!configFile.error) {\n const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));\n compilerOptions = { ...compilerOptions, ...parsed.options };\n }\n }\n\n const program = ts.createProgram([resolvedPath], compilerOptions);\n const sourceFile = program.getSourceFile(resolvedPath);\n\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n aliases,\n analyzedFiles: new Set([resolvedPath]),\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n log(` Import: ${localName} from '${source}'`);\n }\n }\n }\n });\n\n /**\n * Resolve an import path using aliases.\n */\n function resolveImportPath(source: string, fromFile: string): string | null {\n // Check aliases first\n for (const [aliasPrefix, aliasPath] of Object.entries(ctx.aliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(path.dirname(fromFile), resolved);\n }\n return resolved;\n }\n }\n\n // Try relative resolution\n if (source.startsWith('.')) {\n return path.resolve(path.dirname(fromFile), source);\n }\n\n // Try node_modules resolution\n try {\n return require.resolve(source, { paths: [path.dirname(fromFile)] });\n } catch {\n return null;\n }\n }\n\n /**\n * Find a theme file from a resolved directory/file path.\n */\n function findThemeFile(basePath: string, preferDark: boolean): string | null {\n const themeFileName = preferDark ? 'darkTheme' : 'lightTheme';\n\n const candidates = [\n basePath,\n `${basePath}.ts`,\n `${basePath}.tsx`,\n path.join(basePath, 'src', `${themeFileName}.ts`),\n path.join(basePath, `${themeFileName}.ts`),\n path.join(basePath, 'src', 'index.ts'),\n path.join(basePath, 'index.ts'),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n }\n\n return null;\n }\n\n /**\n * Analyze a base theme file recursively.\n */\n function analyzeBaseTheme(varName: string): void {\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log(`Could not find import for base theme: ${varName}`);\n return;\n }\n\n log(`Analyzing base theme '${varName}' from '${importInfo.source}'`);\n\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (!resolvedBase) {\n log(`Could not resolve import path: ${importInfo.source}`);\n return;\n }\n\n const preferDark = varName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n\n if (!themeFile) {\n log(`Could not find theme file for: ${resolvedBase}`);\n return;\n }\n\n if (ctx.analyzedFiles.has(themeFile)) {\n log(`Already analyzed: ${themeFile}`);\n return;\n }\n\n ctx.analyzedFiles.add(themeFile);\n log(`Recursively analyzing: ${themeFile}`);\n\n // Parse and analyze the base theme file\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n\n // Merge base values (base values come first, current file can override)\n mergeThemeValues(values, baseValues, false);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): { calls: BuilderCall[]; baseThemeVar: string | null } {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n return { calls, baseThemeVar: arg.text };\n }\n }\n }\n return { calls, baseThemeVar: null };\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return { calls, baseThemeVar: null };\n }\n\n /**\n * Get a string value from an AST node.\n */\n function getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n return null;\n }\n\n /**\n * Get all keys from an object literal.\n */\n function getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter((prop): prop is ts.PropertyAssignment => ts.isPropertyAssignment(prop))\n .map(prop => {\n if (ts.isIdentifier(prop.name)) return prop.name.text;\n if (ts.isStringLiteral(prop.name)) return prop.name.text;\n return null;\n })\n .filter((k): k is string => k !== null);\n }\n\n /**\n * Process the collected builder method calls and extract values.\n */\n function processCalls(calls: BuilderCall[]): void {\n log(`Processing ${calls.length} builder method calls`);\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent':\n case 'setIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(` Found intent: ${name}`);\n }\n break;\n }\n\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(` Found radius: ${name}`);\n }\n break;\n }\n\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(` Found shadow: ${name}`);\n }\n break;\n }\n\n case 'addBreakpoint': {\n const name = getStringValue(args[0]);\n if (name && !values.breakpoints.includes(name)) {\n values.breakpoints.push(name);\n log(` Found breakpoint: ${name}`);\n }\n break;\n }\n\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n const keys = getObjectKeys(args[0]);\n for (const key of keys) {\n if (!values.breakpoints.includes(key)) {\n values.breakpoints.push(key);\n }\n }\n log(` Found breakpoints: ${values.breakpoints.join(', ')}`);\n }\n break;\n }\n\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n let componentName: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n componentName = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n componentName = prop.name.text;\n }\n\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n const sizeKeys = getObjectKeys(prop.initializer);\n values.sizes[componentName] = sizeKeys;\n log(` Found sizes for ${componentName}: ${sizeKeys.join(', ')}`);\n\n // Special case: typography sizes also populate the typography array\n if (componentName === 'typography') {\n for (const key of sizeKeys) {\n if (!values.typography.includes(key)) {\n values.typography.push(key);\n }\n }\n }\n }\n }\n }\n } else if (args[0] && ts.isPropertyAccessExpression(args[0])) {\n // Handle references like: .setSizes(lightTheme.sizes)\n const propAccess = args[0];\n if (ts.isIdentifier(propAccess.expression) && propAccess.name.text === 'sizes') {\n const themeVarName = propAccess.expression.text;\n log(` Found sizes reference: ${themeVarName}.sizes`);\n\n // Try to resolve this by analyzing the referenced theme\n const importInfo = imports.get(themeVarName);\n if (importInfo) {\n log(` Resolving sizes from imported theme: ${importInfo.source}`);\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (resolvedBase) {\n const preferDark = themeVarName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n if (themeFile && !ctx.analyzedFiles.has(themeFile)) {\n ctx.analyzedFiles.add(themeFile);\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n // Copy sizes from base theme\n for (const [comp, sizes] of Object.entries(baseValues.sizes)) {\n if (!values.sizes[comp]) {\n values.sizes[comp] = sizes;\n log(` Inherited sizes for ${comp}: ${sizes.join(', ')}`);\n }\n }\n // Also copy typography if we inherited it\n for (const typo of baseValues.typography) {\n if (!values.typography.includes(typo)) {\n values.typography.push(typo);\n }\n }\n }\n }\n }\n }\n }\n break;\n }\n\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n let colorType: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n colorType = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n colorType = prop.name.text;\n }\n\n if (colorType && ts.isObjectLiteralExpression(prop.initializer)) {\n const colorKeys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = colorKeys;\n log(` Found surface colors: ${colorKeys.join(', ')}`);\n break;\n case 'text':\n values.textColors = colorKeys;\n log(` Found text colors: ${colorKeys.join(', ')}`);\n break;\n case 'border':\n values.borderColors = colorKeys;\n log(` Found border colors: ${colorKeys.join(', ')}`);\n break;\n }\n }\n // Handle function calls like generateColorPallette() for pallet\n // We skip pallet since it's typically generated dynamically\n }\n }\n }\n break;\n }\n\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(` Found surface color: ${name}`);\n }\n break;\n }\n\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(` Found text color: ${name}`);\n }\n break;\n }\n\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(` Found border color: ${name}`);\n }\n break;\n }\n\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(` Found pallet color: ${name}`);\n }\n break;\n }\n\n case 'build':\n // End of chain, nothing to extract\n break;\n\n default:\n log(` Skipping unknown method: ${method}`);\n }\n }\n }\n\n /**\n * Process a node that might be a builder chain ending with .build().\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === 'build') {\n log('Found .build() call, tracing chain...');\n const { calls, baseThemeVar } = traceBuilderCalls(node);\n\n // First analyze base theme if there is one\n if (baseThemeVar) {\n log(`Found fromTheme(${baseThemeVar})`);\n analyzeBaseTheme(baseThemeVar);\n }\n\n // Then process this file's calls (can override base)\n processCalls(calls);\n return;\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n // Main analysis pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations: const lightTheme = createTheme()...build();\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n\n // Handle export statements: export const theme = ...\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n log('Analysis complete:');\n log(` Intents: ${values.intents.join(', ')}`);\n log(` Radii: ${values.radii.join(', ')}`);\n log(` Shadows: ${values.shadows.join(', ')}`);\n log(` Breakpoints: ${values.breakpoints.join(', ')}`);\n log(` Typography: ${values.typography.join(', ')}`);\n log(` Size components: ${Object.keys(values.sizes).join(', ')}`);\n\n return values;\n}\n\n/**\n * Merge source theme values into target.\n * @param target - The target to merge into\n * @param source - The source to merge from\n * @param sourceOverrides - If true, source values replace target; if false, target values take precedence\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues, sourceOverrides: boolean): void {\n // Helper to merge arrays without duplicates\n const mergeArrays = (targetArr: string[], sourceArr: string[]): void => {\n for (const item of sourceArr) {\n if (!targetArr.includes(item)) {\n targetArr.push(item);\n }\n }\n };\n\n mergeArrays(target.intents, source.intents);\n mergeArrays(target.radii, source.radii);\n mergeArrays(target.shadows, source.shadows);\n mergeArrays(target.breakpoints, source.breakpoints);\n mergeArrays(target.typography, source.typography);\n mergeArrays(target.surfaceColors, source.surfaceColors);\n mergeArrays(target.textColors, source.textColors);\n mergeArrays(target.borderColors, source.borderColors);\n\n // Merge sizes - component by component\n for (const [component, sizes] of Object.entries(source.sizes)) {\n if (sourceOverrides || !target.sizes[component]) {\n target.sizes[component] = sizes;\n }\n }\n}\n\n/**\n * Convert ThemeValues to the format expected by the Babel plugin.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n surfaceColors: string[];\n textColors: string[];\n borderColors: string[];\n}\n\nexport function toBabelThemeKeys(values: ThemeValues): BabelThemeKeys {\n return {\n intents: values.intents,\n sizes: values.sizes,\n radii: values.radii,\n shadows: values.shadows,\n typography: values.typography,\n surfaceColors: values.surfaceColors,\n textColors: values.textColors,\n borderColors: values.borderColors,\n };\n}\n"],"mappings":";;;;;;;;AA4BA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;;;ACnBtB,YAAYC,SAAQ;AACpB,YAAYC,SAAQ;AACpB,YAAYC,WAAU;;;ACAtB,YAAYC,SAAQ;AACpB,YAAYC,SAAQ;AACpB,YAAYC,WAAU;;;ACCtB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AAuBf,SAAS,mBACd,WACA,UAAsC,CAAC,GAC1B;AACb,QAAM,eAAoB,aAAQ,SAAS;AAC3C,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,UAAU,QAAQ,WAAW,CAAC;AAEpC,QAAM,MAAM,IAAI,SAAoB;AAClC,QAAI,QAAS,SAAQ,IAAI,2BAA2B,GAAG,IAAI;AAAA,EAC7D;AAEA,MAAI,CAAI,cAAW,YAAY,GAAG;AAChC,UAAM,IAAI,MAAM,yBAAyB,YAAY,EAAE;AAAA,EACzD;AAEA,MAAI,yBAAyB,YAAY;AAGzC,QAAM,aAAgB,kBAAoB,aAAQ,YAAY,GAAM,OAAI,YAAY,eAAe;AAC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,UACxB;AAAA,UACA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKF;AAIA,sBAAc,YAAY;AAAA,UACxB;AAAA,UACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAgBF;AAEA,eAAO;AAAA,UACL,MAAM;AAAA,UACN,KAAK;AAAA,QACP;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,IAGA,gBAAgB,EAAE,MAAM,OAAO,GAAG;AAEhC,YAAM,kBACJ,QAAQ,eAAe,KAAK,OAAK,KAAK,SAAc,cAAQ,CAAC,CAAC,CAAC,MAC9D,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,MAAM;AAG/C,YAAM,cAAc,KAAK,SAAc,cAAQ,QAAQ,SAAS,CAAC;AAEjE,UAAI,mBAAmB,aAAa;AAClC,YAAI,iBAAiB,IAAI,4BAA4B;AAGrD,mBAAW;AAGX,cAAM,cAAc,MAAM,KAAK,OAAO,YAAY,cAAc,OAAO,CAAC,EACrE,OAAO,OAAK,EAAE,OAAO,EAAE,GAAG,SAAS,mBAAmB,KAAK,EAAE,GAAG,SAAS,6BAA6B,EAAE;AAE3G,oBAAY,QAAQ,OAAK,OAAO,YAAY,iBAAiB,CAAC,CAAC;AAE/D,YAAI,YAAY,SAAS,GAAG;AAC1B,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,aAAa;AACX,iBAAW,iBAAiB;AAAA,IAC9B;AAAA,EACF;AACF;AAKO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO,kBAAkB,OAAO;AAClC;","names":["fs","path","ts","fs","path","ts","fs","path","analyzeBaseTheme","getStringValue","getObjectKeys","mergeThemeValues"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/tooling",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "type": "module",
5
5
  "description": "Code analysis and validation utilities for Idealyst Framework",
6
6
  "readme": "README.md",