UNPKG

reblendjs

Version:

This is build using react way of handling dom but with web components

135 lines (134 loc) 5.72 kB
import { ReblendTyping } from 'reblend-typing'; import { type BaseComponent } from './BaseComponent'; type SymbolsType = { ReblendNode: symbol; ReblendVNode: symbol; ReactToReblendNode: symbol; ReactToReblendVNode: symbol; ReblendNodeStandard: symbol; ReblendVNodeStandard: symbol; }; export declare class NodeUtil { static addSymbol(type: keyof SymbolsType, obj: object): any; /** * Checks if the given element has a name other than 'BaseComponent'. * * @param {typeof BaseComponent} element - The element to check. * @returns {boolean} `true` if the element has a name and it is not 'BaseComponent', otherwise `false`. */ static hasName(element: typeof BaseComponent): boolean; /** * Checks if the provided node is a rendered Reblend node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a rendered Reblend node, otherwise `false`. */ static isReblendRenderedNode(node: any): boolean; /** * Checks if the provided node is a virtual Reblend node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a virtual Reblend node, otherwise `false`. */ static isReblendVirtualNode(node: any): boolean; /** * Checks if the provided node is a standard rendered Reblend node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a standard rendered Reblend node, otherwise `false`. */ static isReblendRenderedNodeStandard(node: any): boolean; /** * Checks if the provided node is a standard virtual Reblend node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a standard virtual Reblend node, otherwise `false`. */ static isReblendVirtualNodeStandard(node: any): boolean; /** * Checks if the provided node is a React to Reblend rendered node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a React to Reblend rendered node, otherwise `false`. */ static isReactToReblendRenderedNode(node: any): boolean; /** * Checks if the provided node is a React to Reblend virtual node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a React to Reblend virtual node, otherwise `false`. */ static isReactToReblendVirtualNode(node: any): boolean; /** * Checks if the provided node is a standard virtual node. * * @param {any} node - The node to check. * @returns {boolean} `true` if the node is a standard virtual node, otherwise `false`. */ static isStandardVirtualNode(node: any): boolean; /** * Checks if the provided element is a Reblend primitive element. * * @param {any} element - The element to check. * @returns {boolean} `true` if the element is a Reblend primitive element, otherwise `false`. */ static isReblendPrimitiveElement(element: any): boolean; /** * Checks if the provided data is a primitive type. * Primitive types include string, number, boolean, bigint, null, undefined, and symbol. * * @param {any} data - The data to check. * @returns {boolean} `true` if the data is a primitive, otherwise `false`. */ static isPrimitive(data: any): boolean; /** * Checks if the given object is an array-like structure by verifying that it contains array-specific methods and properties. * * @param {unknown} obj - The object to check. * @returns {boolean} `true` if the object is an array-like structure, otherwise `false`. */ static isArray(obj: unknown): boolean; /** * Checks if the provided display name represents a React node. * * @param {ReblendTyping.IAny} displayName - The display name to check. * @returns {boolean} `true` if the display name represents a React node, otherwise `false`. */ static isReactNode(displayName: ReblendTyping.IAny): boolean; /** * Checks if a node is a standard HTML element or a Reblend primitive element. * * @param {ReblendTyping.Component | HTMLElement} node - The node to check. * @returns {boolean} - True if the node is standard or a Reblend primitive element, false otherwise. */ static isStandard<P, S>(node: ReblendTyping.Component<P, S> | HTMLElement): boolean; /** * Checks if a node is a Reblend HTML element or a Reblend React HTML element. * * @param {ReblendTyping.Component | HTMLElement} node - The node to check. * @returns {boolean} - True if the node is Reblend or a Reblend React element, false otherwise. */ static isNonStandard<P, S>(node: ReblendTyping.Component<P, S> | HTMLElement): boolean; /** * Determines if a given node is a text node. * * @param {Node} node - The node to check. * @returns {boolean} - True if the node is a text node, otherwise false. */ static isTextNode(node: Node): node is Text; /** * Checks whether the given data is empty (undefined or null). * * @param {*} data - The data to check. * @returns {boolean} - True if the data is empty, otherwise false. */ static isEmpty(data: any): boolean; /** * Extends the prototype of the target object with the provided prototype, skipping constructors and existing functions. * * @param {any} target - The target object to extend. * @param {any} prototype - The prototype object to copy properties and methods from. */ static extendPrototype(target: any, prototype: any): void; } export {};