type OnChange = (value: string) => void; export declare const IS_SERVER: boolean; /** * Frequency of retries for CSS variable lookup in milliseconds */ export declare const LOOKUP_FREQUENCY = 5000; /** * Maximum number of retries for a CSS variable lookup */ export declare const LOOKUP_MAX_RETRIES = 5; export declare const convertRemToPixels: (rem: number) => number; /** * Parse CSS variable declared on root to number * * @precondition CSS variable must be declared on root * * @param cssVar - CSS variable string to parse * * @returns string - value of the CSS variable. If not found, returns empty string * */ export declare const getCSSVar: (cssVar: string) => string; /** * Parse size string to number * * @param size - size string to parse * * @precondition size must be in rem or px * * @returns number - parsed value of the size in px * */ export declare const parseSizeString: (size: string) => number; /** * CSSLookup is a singleton class that provides a way to lookup CSS variables * * Recommended not to use this class with variables that depend on light/dark theme * as this class returns memoized values */ declare class CSSLookup { #private; lookupMap: Map; subscribers: Map; private static instance; private constructor(); /** * Returns the singleton instance of the CSSLookup class. * If the instance does not exist, it creates one. */ static getInstance(): CSSLookup; /** * Find CSS variable value. Takes in a CSS variable string of format var(--varName) * or --varName. If the value is not found, it will retry the lookup every second * and will call the onChange function with the value once it is found. * * @param cssVar * @param onChange - callback to call when value is found. if not specified, will * not retry lookup */ findVar(cssVar: string, onChange?: OnChange): string | undefined; /** * Find CSS variable value. Retries if not found initially. * * Lookup max retries and interval specified by LOOKUP_MAX_RETRIES and LOOKUP_FREQUENCY * * If callback is not specified, retries will not be attempted. This is useful for * cursory lookups where the value is not critical (like initial value of useState * hook) * * @param cssVar CSS variable to find * @param onChange callback to call when value is found * @param prevRetries previous number of retries */ findVarHelper(cssVar: string, prevRetries: number, onChange?: OnChange): string; /** * Unsubscribe from CSS variable value * * @param cssVar * @param onChange */ unsubscribe(cssVar: string, onChange: OnChange): void; } export declare const CSSManager: Readonly; export {};