import { VApplication } from "./VApplication"; import { VBindings } from "./VBindings"; import { VCloser } from "./VCloser"; import { VDirectiveManager } from "./directives/VDirectiveManager"; import { VNodeInit } from "./VNodeInit"; /** * Represents a virtual node in the virtual DOM. * A virtual node corresponds to a real DOM node and contains additional information for data binding and directives. * This class is responsible for managing the state and behavior of the virtual node, including its bindings, directives, and child nodes. */ export declare class VNode { #private; /** * Creates an instance of the virtual node. * @param args The initialization arguments for the virtual node. */ constructor(args: VNodeInit); /** * The application instance associated with this virtual node. */ get vApplication(): VApplication; /** * The node associated with this virtual node. */ get node(): Node; /** * The type of the node associated with this virtual node. */ get nodeType(): number; /** * The name of the node associated with this virtual node. */ get nodeName(): string; /** * The parent virtual node, if any. * This is optional and may be undefined for the root node. */ get parentVNode(): VNode | undefined; /** * The child virtual nodes, if any. * This is optional and may be undefined if there are no child nodes. */ get childVNodes(): VNode[] | undefined; /** * The previous sibling virtual node, if any. * This is optional and may be undefined if there is no previous sibling. */ get previousSibling(): VNode | undefined; /** * The next sibling virtual node, if any. * This is optional and may be undefined if there is no next sibling. */ get nextSibling(): VNode | undefined; /** * The data bindings associated with this virtual node, if any. */ get bindings(): VBindings; /** * The directive manager associated with this virtual node. * This manages any directives applied to the node. */ get directiveManager(): VDirectiveManager | undefined; /** * The anchor comment node used to mark the position of the element in the DOM. * This is used for directives that may remove the element from the DOM, * allowing it to be re-inserted at the correct position later. * This is optional and may be undefined if not applicable. */ get anchorNode(): Comment | undefined; /** * Indicates whether the node is currently in the DOM. * This checks if the node has a parent that is not a document fragment. * @return True if the node is in the DOM, otherwise false. */ get isInDOM(): boolean; /** * Indicates whether this virtual node is the root node (i.e., has no parent). * @return True if this is the root node, otherwise false. */ get isRoot(): boolean; /** * The list of identifiers for this virtual node. * This includes variable and function names used in expressions. */ get dependentIdentifiers(): string[]; get preparableIdentifiers(): string[]; /** * Gets the user data storage for this virtual node. * This is lazily initialized and provides a Proxy-free space for storing * arbitrary data associated with lifecycle directives. * @returns A Map for storing user data. */ get userData(): Map; /** * The DOM path of this virtual node. * This is a string representation of the path from the root to this node, * using the node names and their indices among siblings with the same name. * For example: "DIV[0]/SPAN[1]/#text[0]" * @return The DOM path as a string. */ get domPath(): string; /** * Updates the virtual node and its children based on the current bindings. * This method evaluates any expressions in text nodes and applies effectors from directives. * It also recursively updates child virtual nodes. * @param context The context for the update operation. * This includes the current bindings and a list of identifiers that have changed. */ update(): void; /** * Forces an update of the virtual node and its children, regardless of changed identifiers. * This method evaluates any expressions in text nodes and applies effectors from directives. * It also recursively updates child virtual nodes. * This is useful when an immediate update is needed, bypassing the usual change detection. */ forceUpdate(): void; /** * Adds a child virtual node to this virtual node. * @param child The child virtual node to add. */ addChild(child: VNode): void; /** * Adds a dependent virtual node that relies on this node's bindings. * @param dependent The dependent virtual node to add. * @param dependentIdentifiers The identifiers that the dependent node relies on. * If not provided, the dependent node's own identifiers will be used. * @returns A list of closers to unregister the dependency, or undefined if no dependency was added. */ addDependent(dependent: VNode, dependentIdentifiers?: string[] | undefined): VCloser[] | undefined; /** * Cleans up any resources used by this virtual node. * This method is called when the virtual node is no longer needed. * * Cleanup order: * 1. Call onUnmount lifecycle hooks * 2. Auto-cleanup userData (close() on Closeable objects) * 3. Recursively destroy child nodes * 4. Unregister dependencies * 5. Clean up directive manager * 6. Call onUnmounted lifecycle hooks */ destroy(): void; }