import { type Context, ContextProvider } from '@lit/context'; import { ControllerBase, type ControllerHost } from './Abstracts/ControllerBase'; /** * Configuration options for the InheritanceProviderController. * * @public */ export interface IInheritanceProviderControllerConfig { /** * The context to provide inherited properties to. */ context: Context>; /** * A callback function that returns the current inherited values. * This is called initially and whenever relevant properties change. */ values: () => Partial; /** * Optional: Explicit list of property names to watch. * If not provided, the controller will automatically detect watched properties * from the keys returned by the `values` function. */ properties?: Array; } /** * Controller for parent components that provide inherited properties to child consumers. * * This controller wraps `@lit/context`'s `ContextProvider` and automatically updates * the context when any of the watched properties change. The controller hooks into * Lit's update lifecycle and compares property values to detect changes. * * @example * ```typescript * class ButtonGroupElement extends CustomElement { * private readonly _provider = addInheritanceProviderController(this, { * context: BUTTON_GROUP_INHERITANCE_CONTEXT, * values: () => ({ * disabled: this.disabled, * appearance: this.appearance, * variant: this.variant * }) * }); * // No @Watch handlers needed - the controller automatically * // detects changes to disabled, appearance, and variant! * } * ``` * * @public */ export declare class InheritanceProviderController extends ControllerBase { private readonly _provider; private readonly _getValues; private readonly _watchedProperties; private readonly _previousValues; /** * Creates a new InheritanceProviderController. * * @public * @param host The host element. * @param config The controller configuration. */ constructor(host: ControllerHost, config: IInheritanceProviderControllerConfig); /** * Gets the current inherited values. * * @public * @readonly */ get values(): Partial; /** * Gets the underlying context provider. * * @protected * @readonly */ protected get provider(): ContextProvider>, ControllerHost>; /** * Called before the host element updates. * Automatically detects changes to watched properties and updates the context. * * @public * @override */ hostUpdate(): void; /** * Updates the provided context value. * Call this method when any of the inherited properties change. * All subscribed consumers will be automatically notified. * * @remarks * In most cases, you don't need to call this method manually. * The controller automatically detects property changes during Lit's update cycle. * * @public */ update(): void; /** * Forces an update to all consumers, even if the value hasn't changed. * Useful when you need to ensure all consumers re-read the context. * * @public */ forceUpdate(): void; } /** * Adds an inheritance provider controller to the given host. * * @public * @param host The host element. * @param config The configuration options. * @returns The inheritance provider controller instance. */ export declare function addInheritanceProviderController(host: ControllerHost, config: IInheritanceProviderControllerConfig): InheritanceProviderController; //# sourceMappingURL=InheritanceProviderController.d.ts.map