/** * JQHTML Component Cache Integration * * Extracted from component.ts - handles cache key generation, * cache reads during create(), cache checks during reload(), * and HTML cache snapshots during ready() and reload(). * * Uses Jqhtml_Local_Storage as the underlying storage layer. */ /** * Result of generating a cache key for a component. */ interface Cache_Key_Result { cache_key: string | null; uncacheable_property?: string; uncacheable_reason?: string; } /** * Generate a cache key for a component using its name + args. * Supports custom cache_id() override. * * @param component - The component instance * @returns Cache key string or null if caching is disabled */ export declare function generate_cache_key(component: any): Cache_Key_Result; /** * Development warning: this component fetches data but cannot be cached, because * its args do not reduce to a stable key and it defines no cache_id() to say what * its identity is. Nothing is broken - the component works - but it silently opts * out of cache reuse and of load deduplication. * * Controlled by the `warn_uncacheable_args` integration flag (see config.ts). */ export declare function warn_uncacheable_component(component: any, uncacheable_property?: string, uncacheable_reason?: string): void; /** * Keep the element's `data-nocache` marker in step with a cache key result. Boot, * `load()` and `reload()` all call this with the key they just computed, so the marker * always describes the CURRENT args: * * key - remove any `data-nocache` (args that were unkeyable are keyable again) * no key - `data-nocache=":"`, plus the dev warning when `warn` is set * (itself gated by `warn_uncacheable_args`, once per component+arg+reason) */ export declare function mark_cacheability(component: any, result: Cache_Key_Result, warn?: boolean): void; /** * An HTML-cache entry: the inner HTML of a component plus the cid it was rendered * under. Scoped ids inside the markup are ":", so the owner's cid is what * lets a replaying instance tell its own elements from its children's. */ export interface Html_Cache_Snapshot { cid: string; html: string; } /** * Read cache during create() phase. * Sets component._cache_key, _cached_html, _use_cached_data_hit as side effects. * * @param component - The component instance */ export declare function read_cache_in_create(component: any): void; /** * Refresh the cache key at the start of every reload(), then - if args have changed - * check the cache. On a hit, hydrates data/html and triggers an immediate render. * * The recomputed key is ALWAYS assigned, null included: every cache write later in the * reload (data after on_load(), the html snapshot after render) goes to _cache_key, so * a key left over from the previous args would file the new args' content under the * old args' entry. * * @param component - The component instance * @param args_changed - Whether this.args differ from the last render's * @returns true if rendered from cache, false otherwise */ export declare function check_cache_on_reload(component: any, args_changed: boolean): boolean; /** * Write HTML cache snapshot during ready() phase, and at the end of a reload() that * loaded changed data. Only caches if the component is dynamic (data changed during * on_load). * * @param component - The component instance */ export declare function write_html_cache_snapshot(component: any): void; /** * Write data/HTML to cache after on_load() completes, and set component._is_dynamic. * Called from _apply_load_result(). * * A load is written when its data changed to something other than the empty '{}', OR * when its data is unchanged but the cache key moved: a reload() with new args whose * data equals the previous load's must still file that data under the new key, or a * later boot with those args misses. Same key and unchanged data writes nothing. * component._data_cache_key is the key the current this.data is cached under (written * or hydrated from), null when it is not cached. * * @param component - The component instance * @param data_changed - Whether this.data changed during on_load * @param data_text - this.data's serialized text (what it was normalized through) */ export declare function write_cache_on_loaded(component: any, data_changed: boolean, data_text: string): void; export {}; //# sourceMappingURL=component-cache.d.ts.map