/** * CSS rule extraction and complexity analysis * Detects CSS rules within variant selectors that may conflict with CSS variables */ import type { Rule } from 'postcss'; import type { Theme } from '../../types'; /** * Represents a CSS rule override found within a variant selector */ export interface CSSRuleOverride { /** CSS selector (e.g., ".rounded-lg", "[data-slot='card']") */ selector: string; /** CSS property (e.g., "border-radius", "box-shadow") */ property: string; /** CSS value (e.g., "0", "none", "calc(var(--spacing) * 4)") */ value: string; /** Variant name (e.g., "themeMono", "themeScaled") */ variantName: string; /** Original parent selector (e.g., ".theme-mono .theme-container") */ originalSelector: string; /** Complexity classification */ complexity: 'simple' | 'complex'; /** Reason for complexity classification (if complex) */ reason?: string; /** Whether the rule is nested in a media query */ inMediaQuery?: boolean; /** Media query params if nested (e.g., "(min-width: 1024px)") */ mediaQuery?: string; } /** * Maps CSS properties to theme namespaces */ interface PropertyMapping { /** Theme property key (e.g., 'radius', 'shadows') */ themeProperty: keyof Theme; /** Function to extract theme key from selector */ keyExtractor: (selector: string) => string | null; } /** * Maps CSS property to theme namespace * @param property - CSS property name * @returns Property mapping or null if not mapped */ export declare function mapPropertyToTheme(property: string): PropertyMapping | null; /** * Extracts CSS rules from a PostCSS Rule node that's a variant selector * * Processes: * - Direct CSS rules (e.g., .rounded-lg { border-radius: 0; }) * - Rules nested in media queries * - Classifies complexity (simple vs complex) * * @param rule - PostCSS Rule node (variant selector) * @param variantName - Variant name (e.g., "themeMono") * @returns Array of CSS rule overrides */ export declare function extractCSSRules(rule: Rule, variantName: string): Array; /** * Filters CSS rules to only include those that can be safely resolved * @param rules - Array of CSS rule overrides * @returns Filtered array of simple, resolvable rules */ export declare function filterResolvableRules(rules: Array): Array; /** * Groups CSS rules by variant name * @param rules - Array of CSS rule overrides * @returns Map of variant name to rules */ export declare function groupRulesByVariant(rules: Array): Map>; export {};