import { BaseWidget } from "./BaseWidget"; /** * Stateful widget with lifecycle management and hierarchical composition. * * Provides a React-like component system with state management, lifecycle hooks, * and parent-child widget relationships. Extend this class to create custom widgets * compatible with the concept connection system. */ export declare class StatefulWidget extends BaseWidget { /** Optional parameters passed to the widget */ params: any; /** HTML template string for the widget */ html: string; /** CSS styles for the widget */ css: string; /** JavaScript code for the widget */ js: string; /** Current widget state object */ state: { [key: string]: any; }; /** Previous widget state for change detection */ previousState: { [key: string]: any; }; /** Array of child widget instances */ childWidgets: any; /** Array of DOM elements hosting child widgets */ childWidgetElement: any; /** Reference to the parent widget instance */ parentWidget: any; /** Shared state data passed to child widgets */ widgetState: { [key: string]: any; }; /** ID of the parent DOM element containing this widget */ parentElement: string; /** * Finds the first element matching a CSS selector within this widget. * * @param selector - CSS selector string * @returns The first matching element or null */ querySelector(selector: string): Element | null; /** * Finds all elements matching a CSS selector within this widget. * * @param selector - CSS selector string * @returns NodeList of matching elements or null */ querySelectorAll(selector: string): NodeListOf | null; /** * Gets the root DOM element of this widget. * * @returns The widget's root HTML element */ getElement(): HTMLElement | null; /** * Sets the browser document title. * * @param title - The new document title */ setTitle(title: string): void; /** * Gets the HTML template for this widget. * * @returns HTML string to be rendered */ getHtml(): string; /** * Updates a child widget's data and triggers re-render. * * @param value - New data to pass to the child widget * @param widget - The child widget instance to update */ UpdateChildData(value: any, widget: StatefulWidget): void; /** * Lifecycle hook called after widget data is updated. * Override this method to handle post-update logic. */ update(): void; /** * Updates the entire widget state and triggers re-render if changed. * * @param newState - New state data to replace current state */ setState(newState: any): void; /** * Updates specific state properties and triggers re-render if changed. * * @param newProperty - Object containing properties to update */ setStateProperty(newProperty: Object): void; /** * Checks if the widget state has changed since last update. * * @returns True if state changed, false otherwise */ hasStateChanged(): boolean; /** * Compares two state objects for shallow equality. * * @param obj1 - First state object * @param obj2 - Second state object * @returns True if objects are equal, false otherwise */ private isPropertyEqual; /** * Mounts all registered child widgets to their designated parent elements. */ loadChildWidgets(): void; /** * Re-renders the widget by updating the DOM with current HTML template. * Also triggers child widget loading and after_render hook. */ render(): void; /** * Finds all elements with a specific class name within this widget. * * @param identifier - Class name to search for (without '.' prefix) * @returns NodeList of matching elements */ getElementByClassName(identifier: string): never[] | NodeListOf; /** * Lifecycle hook for mounting child widgets. * Override this method to define custom child mounting logic. */ mount_child(): void; /** * Mounts the widget to a parent DOM element and initializes lifecycle. * * Creates a wrapper div, assigns unique ID, renders HTML, and executes * lifecycle hooks in sequence. * * @param parent - The parent HTML element to mount this widget into */ mount(parent: HTMLElement): Promise; /** * Lifecycle hook called before rendering. * Override for initialization logic. Default implementation calls render(). */ before_render(): void; /** * Lifecycle hook called after rendering. * Override to add event listeners or post-render logic. */ after_render(): void; /** * Recursively renders all child widgets in the hierarchy. */ renderChildWidgets(): void; /** * Sets shared state data and propagates to all child widgets recursively. * * @param key - State property key * @param value - State value to set */ setWidgetState(key: string, value: any): void; /** * Retrieves shared state data by key. * * @param key - State property key to retrieve * @param defaultValue - Default value if key doesn't exist * @returns The state value or default value */ getWidgetState(key: string, defaultValue: any): object; }