import type { ConfigFile } from '$lib/types/index'; import type { AdaptationConfig } from '$features/adaptation/types'; import { PersistenceManager } from './utils/persistence'; import { IconSettingsStore } from '$features/settings/stores/icon-settings-store.svelte'; export interface RuntimeOptions { configFile: ConfigFile; rootEl?: HTMLElement | undefined; storageKey?: string | undefined; adaptationConfig?: AdaptationConfig | null; } /** * The reactive runtime for CustardUI. Manages the full lifecycle: initialization, * state resolution, reactive side-effects (URL sync, persistence), DOM observation, and teardown. * Components (Toggle, TabGroup) are self-contained and self-managing via the global store. */ export declare class AppRuntime { private rootEl; persistenceManager: PersistenceManager; private focusService; iconSettingsStore: IconSettingsStore; private observer?; private destroyEffectRoot?; private onHashChange?; constructor(opt: RuntimeOptions); /** * Initialize all stores with configuration from the config file. * Populates the singleton sub-stores with real data. */ private initStores; /** * Resolves the starting application state by layering sources: * * 1. **Baseline**: `ActiveStateStore` initializes with defaults from the config file. * 2. **Adaptation Preset**: If an adaptation is active, its preset is applied * on top of the config defaults (before persisted state, so user choices can win). * 3. **Persistence**: If local storage has a saved state, it replaces the baseline (`applyState`). * 4. **URL Overrides**: If the URL contains parameters (`?t-show=X`), these are applied * as **sparse overrides** (`applyDifferenceInState`). Toggles not mentioned in the URL * retain their values from persistence/defaults. */ private resolveInitialState; /** * Starts the CustardUI execution engine. * * Components (Toggle, TabGroup) self-register during their mount lifecycle. * This method starts the global observers for DOM changes and reactive state side-effects. */ start(): void; /** * Performs an initial, non-reactive scan of the DOM for placeholders. */ private scanDOM; /** * Sets up global reactivity using `$effect.root` for persistence and placeholder binding. */ private startGlobalReactivity; /** * Sets up a MutationObserver to detect content added dynamically to the page * (e.g. by other scripts, lazy loading, or client-side routing). */ private startComponentObserver; /** * Processes a newly added DOM node to check for and hydrate placeholders. */ private handleForPlaceholders; resetToDefault(): void; destroy(): void; } //# sourceMappingURL=runtime.svelte.d.ts.map