import type { ReactiveController, ReactiveControllerHost } from 'lit'; /** @ignore */ export interface MutationControllerConfig { /** The callback function to run when a mutation occurs. */ callback: MutationControllerCallback; /** The underlying mutation observer configuration parameters. */ config: MutationObserverInit; /** * The element to observe. * If left out, the observer will listen on the host component itself. */ target?: Element; /** * A filter configuration. * See {@link MutationControllerFilter|this} for additional information. */ filter?: MutationControllerFilter; } type MutationControllerCallback = (params: MutationControllerParams) => unknown; /** * Filter configuration to return elements that either match * an array of selector strings or a predicate function. */ type MutationControllerFilter = string[] | ((node: T) => boolean); type MutationDOMChange = { /** The parent of the added/removed element. */ target: Element; /** The added/removed element. */ node: T; }; type MutationAttributeChange = { /** The host element of the changed attribute. */ node: T; /** The changed attribute name. */ attributeName: string | null; }; type MutationChange = { /** Elements that have attribute(s) changes. */ attributes: MutationAttributeChange[]; /** Elements that have been added. */ added: MutationDOMChange[]; /** Elements that have been removed. */ removed: MutationDOMChange[]; }; export type MutationControllerParams = { /** The original mutation records from the underlying observer. */ records: MutationRecord[]; /** The aggregated changes. */ changes: MutationChange; /** The observer controller instance. */ observer: MutationController; }; declare class MutationController implements ReactiveController { private readonly _host; private readonly _observer; private readonly _target; private readonly _config; private readonly _callback; private readonly _filter?; constructor(host: ReactiveControllerHost & Element, options: MutationControllerConfig); /** @internal */ hostConnected(): void; /** @internal */ hostDisconnected(): void; private _process; /** * Begin receiving notifications of changes to the DOM based * on the configured {@link MutationControllerConfig.target|target} and observer {@link MutationControllerConfig.config|options}. */ observe(): void; /** Stop watching for mutations. */ disconnect(): void; } /** * Creates and attaches a mutation controller with `config` to the passed in `host`. * * Automatically starts/stops observing for mutation changes * in the respective component connect/disconnect callbacks. * * The mutation observer is disconnected before invoking the passed in callback and re-attached * after that in order to not loop itself in endless stream of changes. */ export declare function createMutationController(host: ReactiveControllerHost & Element, config: MutationControllerConfig): MutationController; export {};