stoop
Version:
CSS-in-JS library with type inference, theme creation, and variants support.
40 lines (39 loc) • 1.2 kB
TypeScript
/**
* CSS compilation caching system.
* Tracks compiled CSS strings and class names to prevent duplicate work.
* Implements LRU (Least Recently Used) eviction when cache size limits are exceeded.
*/
/**
* LRU Cache implementation for class names and CSS strings.
* Automatically evicts least recently used entries when size limit is exceeded.
*/
declare class LRUCache<K, V> extends Map<K, V> {
private readonly maxSize;
constructor(maxSize: number);
get(key: K): V | undefined;
set(key: K, value: V): this;
}
export declare const classNameCache: LRUCache<string, string>;
export declare const cssStringCache: LRUCache<string, string>;
/**
* Checks if a CSS string is cached.
*
* @param css - CSS string to check
* @returns True if CSS is cached
*/
export declare function isCachedStyle(css: string): boolean;
/**
* Marks a CSS string as cached.
*
* @param css - CSS string to cache
*/
export declare function markStyleAsCached(css: string): void;
/**
* Limits cache size by evicting least recently used entries.
*/
export declare function limitCacheSize(): void;
/**
* Clears all cached styles.
*/
export declare function clearStyleCache(): void;
export {};