import type { ReactiveController, ReactiveControllerHost } from "lit"; import { type ComponentPresetKey, type ComponentPresetsConfig } from "../utils/component-presets.js"; type PresetHost = ReactiveControllerHost & HTMLElement & { preset?: string; }; export type PresetControllerOptions = { /** * Config key under `defaults` / `presets`. * Prefer the custom element tag (`sky-button`). Defaults to `host.localName`. * Short aliases (`button`) resolve to the same bag. */ componentKey?: ComponentPresetKey; /** * When true, clear preset-applied props (e.g. `sky-button` inside a group * that owns visual knobs). */ isPaused?: () => boolean; /** Called after props are applied / cleared (e.g. mark style cache dirty). */ onChange?: () => void; /** Prop names never written from presets. */ skipKeys?: string[]; }; /** * Consumes nearest `` and **assigns every prop** from the * active defaults + named `preset` bag onto the host (unless the user set that * attribute). Changing the provider config or `preset="…"` re-applies the bag. * * Hosts rendered inside another `sky-*` shadow tree (composite internals) skip * presets entirely so app defaults do not restyle library chrome. Slotted / * light-DOM instances still receive them. See `isSkyCompositeInternal`. * * Timing note (Lit reactive-element ≥2): controller `hostUpdate` runs *after* * the host's `willUpdate` and *before* `update`/render. Components that derive * paint from props must rebuild in `update()`/`updated()` (not `willUpdate`), * or rely on the follow-up `requestUpdate` scheduled when props change. */ export declare class PresetController implements ReactiveController { private readonly host; private readonly options; private readonly _consumer; /** Bumps when context / applied props change. */ revision: number; private _lastPresetName; private _lastPaused; private _applyQueued; constructor(host: PresetHost, options?: PresetControllerOptions); /** Tag name (or explicit override) used to look up config bags. */ get componentKey(): ComponentPresetKey; /** Merged presets from context, or nearest provider via DOM walk. */ get config(): ComponentPresetsConfig | null; hostConnected(): void; hostUpdate(): void; hostDisconnected(): void; /** Force re-apply (e.g. after imperative config tweaks). */ reapply(): void; /** * Skip applying when `isPaused` says so, or when this host is sky composite * chrome (inside another `sky-*` shadow root). */ private _isPaused; private _scheduleApply; private _applyNow; } export {};