import { type PropertyOptionsWithName } from "./decorators/property"; import { addStyleSheetToRoot, removeStyleSheetFromRoot } from "./helpers/css"; import { ICustomElementController } from "./custom-element-controller"; import { Projector, VNode } from "./maquette/interfaces"; export type ElementProjectorMode = "append" | "merge" | "replace"; declare var HTMLElement: { prototype: HTMLElement; new (param?: any): HTMLElement; }; export declare abstract class CustomElement extends HTMLElement { #private; /** * Map of reactive property metadata, indexed by property name * Used by @property decorator and attributeChangedCallback * * @static * @type {Map} */ static readonly _propertyInfo: Map; /** * * Static method to add a stylesheet to a root (Document or ShadowRoot) with optional deduplication key. * * @param root The `Document` or `ShadowRoot` to receive the stylesheet. * @param css The CSS text to add. * @param key Optional unique key used to deduplicate styles. * @returns CSSStyleSheet | HTMLStyleElement | HTMLLinkElement */ static addStyleSheetToRoot: typeof addStyleSheetToRoot; /** * Static method to remove a stylesheet from a root (Document or ShadowRoot) using a deduplication key. * * @param root The `Document` or `ShadowRoot` to remove the stylesheet from. * @param key The unique key used to identify the stylesheet to remove. * @returns void */ static removeStyleSheetFromRoot: typeof removeStyleSheetFromRoot; static add: any; constructor(self?: any); /** * Whether the component is currently connected to the DOM. * * @returns {boolean} True if connected, false otherwise */ get isConnected(): boolean; /** * Promise that resolves when the component has finished updating * and rendering to the DOM. * * @returns {Promise} A promise that resolves after the next render * * @example * ```typescript * component.name = 'new value'; * await component.updateComplete; * // DOM is now updated * ``` */ get updateComplete(): Promise; /** * Gets the ElementInternals for form-associated custom elements. * Initializes internals on first access if the component is form-associated. * * @returns {ElementInternals | null} The element internals or null if not form-associated */ get internals(): ElementInternals | null; protected set internals(elementInternals: ElementInternals); /** * Request an update and re-render of the component. * Creates a promise that resolves when the update is complete. * * @returns {Promise} A promise that resolves after rendering * * @example * ```typescript * await component.requestUpdate(); * // DOM is now updated * ``` */ requestUpdate(): Promise; addController(controller: ICustomElementController): void; scheduleRender(): void; /** * Immediately render the component to its shadow DOM * Calls the abstract render() method and updates DOM via uhtml * Re-injects style elements if necessary * * @public */ renderNow(): void; /** * Lifecycle hook called when a property is updated * Override to perform side effects when properties change * * @param {string} _propertyName - The name of the updated property * @param {any} _oldValue - The previous property value * @param {any} _newValue - The new property value * * @virtual * @example * ```typescript * updated(propertyName: string, oldValue: any, newValue: any) { * if (propertyName === 'count') { * console.log(`Count changed from ${oldValue} to ${newValue}`); * } * } * ``` */ updated(_propertyName: string, _oldValue: any, _newValue: any): void; /** * Determine if component should update when a property changes * Override to add custom logic for skipping updates * * @param {string} _name - The name of the property that changed * @param {any} _oldValue - The previous property value * @param {any} _newValue - The new property value * @returns {boolean} True if the component should update, false otherwise * * @virtual * @default true * @example * ```typescript * shouldUpdate(name: string, oldValue: any, newValue: any): boolean { * if (name === 'internal') { * return false; // Skip updates for 'internal' property * } * return true; * } * ``` */ shouldUpdate(_name: string, _oldValue: any, _newValue: any): boolean; protected createProjector(element: Element, render: () => VNode): Promise; /** * Lifecycle callback invoked when the element is added to the DOM. * Initializes controllers, processes pending property updates, and renders. */ connectedCallback(): void; /** * Lifecycle callback invoked when the element is removed from the DOM. * Marks the component as disconnected. */ disconnectedCallback(): void; /** * Lifecycle hook called when observed attributes change * Synchronizes HTML attribute changes to reactive properties * Prevents infinite loops by skipping updates initiated by property setters * * @param {string} name - The name of the changed attribute * @param {string | null} _oldValue - The previous attribute value (unused) * @param {string | null} newValue - The new attribute value * * @private */ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void; render(): VNode; } export {}; //# sourceMappingURL=custom-element.d.ts.map