/** * Per-App theme storage + build-time stack. * * Builders call `getActive*()` without an App argument. Wrapping each create/rebuild * in `runWith` makes the correct palette available on the stack (single-threaded JS), * while `WeakMap` keeps an App-scoped snapshot for lookups after build. */ export interface ThemeScope { /** Push theme for the duration of a synchronous factory/rebuild. */ runWithResult: (theme: T, fn: () => R) => R; /** Active palette: stack top → App WeakMap → last sync → fallback. */ getActive: (app?: object | null) => T; /** Store App-scoped snapshot and update last-sync fallback. */ sync: (theme: T, app?: object | null) => T; } export declare function createThemeScope(fallback: () => T): ThemeScope;