/** * TyComponent - Base class for all Ty web components * * Provides unified property/attribute lifecycle management: * - Single code path for all property updates * - Declarative property configuration * - Predictable rendering behavior * - Form association support * - Property change events via 'prop:change' (separate from user 'change' events) */ import { PropertyManager, PropertyConfig, PropertyChange } from '../utils/property-manager.js'; /** * Base class for all Ty components with unified property lifecycle */ export declare abstract class TyComponent extends HTMLElement { static formAssociated: boolean; protected static properties: Record; protected props: PropertyManager; protected _internals: ElementInternals; protected _connected: boolean; protected _rendered: boolean; constructor(); /** * Define which attributes to observe * Auto-generated from property configuration * Returns kebab-case attribute names (e.g., 'minHeight' -> 'min-height') */ static get observedAttributes(): string[]; /** * Unified property setter * Use this in your property setters instead of direct field assignment */ protected setProperty(name: string, value: any): void; /** * Unified property getter * Use this in your property getters */ protected getProperty(name: string): any; /** * Sync property value to HTML attribute */ private _syncPropertyToAttribute; /** * Convert camelCase to kebab-case */ private _toKebabCase; /** * Convert kebab-case to camelCase */ private _toCamelCase; /** * Attribute changed callback - unified for all components */ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; /** * Connected callback - handle pre-set properties */ connectedCallback(): void; /** * Disconnected callback */ disconnectedCallback(): void; /** * Capture properties that were set before connectedCallback * (React, Vue, Reagent set properties before element is connected) */ private _capturePreSetProperties; /** * THE CORE LIFECYCLE METHOD * All property changes flow through here * * Lifecycle order: * 1. Update internal state (onPropertiesChanged hook) * 2. Sync form value (if formValue property changed) * 3. Render (if visual property changed) * 4. Emit events (if emitChange property changed) */ private _handlePropertyChanges; /** * Emit property change events for properties that require it * Uses 'prop:change' event to avoid conflicts with user interaction 'change' events */ private _emitChangeEvents; /** * Update form value via ElementInternals * Subclasses can override to customize form value */ protected updateFormValue(): void; /** * Get the form value for this component * Default: return 'value' property * Override for custom behavior */ protected getFormValue(): File | string | FormData | null; /** * Render the component * Subclasses MUST implement this */ protected abstract render(): void; /** * Hook: Called when properties change * Subclasses can override to update internal state * * This is called BEFORE rendering, so you can update * internal state here and it will be reflected in the render */ protected onPropertiesChanged(changes: PropertyChange[]): void; /** * Hook: Called when component is connected * Use this instead of overriding connectedCallback */ protected onConnect(): void; /** * Hook: Called when component is disconnected * Use this for cleanup instead of overriding disconnectedCallback */ protected onDisconnect(): void; /** * Get the form element this component is associated with */ get form(): HTMLFormElement | null; /** * Form reset callback - called when form.reset() is invoked * Resets component to its default value */ formResetCallback(): void; /** * Hook: Called when form is reset * Subclasses can override to perform additional reset actions */ protected onFormReset(): void; } //# sourceMappingURL=ty-component.d.ts.map