/** * CSS Scoping Service * * Provides utilities for generating unique scope identifiers and scoping CSS * to prevent style conflicts between different email templates. */ export interface ScopedResult { scopeId: string; scopedCSS: string; wrappedHTML: string; } export declare class CSSScopingService { /** * Generate a unique scope identifier using timestamp and random string * Format: email-tpl-{timestamp}-{random} */ generateScopeId(): string; /** * Scope CSS selectors by prefixing them with the scope identifier * Skips :root and :host pseudo-classes * * @param css - The CSS stylesheet to scope * @param scopeId - The unique scope identifier * @returns Scoped CSS with prefixed selectors */ scopeCSS(css: string, scopeId: string): string; /** * Parse CSS into individual rules * Simple parser that handles basic CSS syntax */ private parseCSS; /** * Scope a single CSS rule */ private scopeRule; /** * Scope a single selector * Skip :root, :host, and other pseudo-classes that shouldn't be scoped */ private scopeSelector; /** * Wrap HTML content with a scope wrapper div * * @param html - The HTML content to wrap * @param scopeId - The unique scope identifier * @returns HTML wrapped with scope div */ wrapHTMLWithScope(html: string, scopeId: string): string; /** * Extract inline styles from HTML elements * Returns a map of element identifiers to their inline styles */ extractInlineStyles(html: string): Map>; /** * Parse inline style attribute into an object */ private parseInlineStyles; /** * Merge two style objects, with override taking precedence */ mergeStyles(base: Record, override: Record): Record; /** * Complete scoping workflow: generate scope ID, scope CSS, and wrap HTML * * @param html - The HTML content * @param css - The CSS stylesheet * @returns Object containing scopeId, scopedCSS, and wrappedHTML */ scopeTemplate(html: string, css?: string): ScopedResult; } export declare const cssScopingService: CSSScopingService;