/** * Icon data structure containing SVG information */ export interface IconData { /** SVG content as a string */ svg: string; /** Default color for the icon */ defaultColor?: string | null; /** * Determines how the SVG is rendered. * This affects the styling and behavior of the icon. * * - "mask": Uses the SVG as a CSS mask, allowing for color customization. Use this for monochrome icons. * - "background": Uses the SVG as a CSS background image. Use this for colorful icons with no complex styling. * - "inline": Renders the SVG inline, allowing for more complex styling. * **Be cautious with this mode as it can introduce security risks if the SVG content is not trusted.** * * @default "mask" */ mode?: "mask" | "background" | "inline"; } /** * Direct icon registration configuration */ export interface DirectIconRegistration { /** Icon name */ name: string; /** SVG content or icon data */ svg: string | IconData; } /** * Dynamic icon registration configuration using regex pattern matching */ export interface DynamicIconRegistration { /** Regular expression to match icon names */ match: RegExp; /** Function to fetch SVG content for matched names */ fetch: (name: string) => Promise | string | IconData; } /** * Icon registration configuration */ export type IconRegistration = DirectIconRegistration | DynamicIconRegistration; /** * Icon registry class that manages icon registration and retrieval */ export declare class IconRegistry { #private; /** * Get the singleton instance of IconRegistry */ static getGlobalInstance(): IconRegistry; /** * Register an icon or dynamic icon fetcher * @param registration Icon registration configuration * * @example * // Direct registration * registry.register({ name: "custom-icon", svg: "..." }); * * // Dynamic registration * registry.register({ * match: /^custom-/, * fetch: async (name) => { * const response = await fetch(`/icons/${name}.svg`); * return response.text(); * } * }); */ register(registration: IconRegistration): void; /** * Get an icon by name * @param name Icon name * @returns Promise that resolves to IconData or null if not found */ getIcon(name: string): Promise; /** * Check if an icon is registered (either directly or through dynamic registration) * @param name Icon name * @returns true if icon is available */ hasIcon(name: string): boolean; /** * Get all directly registered icon names * @returns Array of icon names */ getRegisteredIconNames(): string[]; /** * Get all dynamic registration patterns * @returns Array of regex patterns */ getDynamicPatterns(): RegExp[]; /** * Clear all registrations and cache */ clear(): void; /** * Remove a specific icon registration * @param name Icon name to remove */ unregister(name: string): boolean; /** * Fetch icon from dynamic registration * @param registration Dynamic registration * @param name Icon name * @returns Promise that resolves to IconData or null */ private fetchDynamicIcon; /** * Perform the actual dynamic fetch * @param registration Dynamic registration * @param name Icon name * @returns Promise that resolves to IconData or null */ private performDynamicFetch; } /** * Global icon registry instance */ export declare const iconRegistry: IconRegistry;