reblendjs
Version:
ReblendJs uses Reactjs pradigm to build UI components, with isolated state for each components.
42 lines (41 loc) • 2.39 kB
TypeScript
import * as ReblendTyping from 'reblend-typing';
/**
* Creates an HTML, SVG, MathML, or XML element based on the provided tag name.
*
* @param {string} tag - The tag name of the element to create.
* @returns {HTMLElement | SVGElement | Element} The created element.
*/
export declare function createElementWithNamespace(tag: string): HTMLElement | SVGElement | Element;
/**
* Sets attributes on the given element, handling namespaces for XML, SVG, MathML, and XLink attributes.
*
* @param {HTMLElement | SVGElement} element - The element on which to set attributes.
* @param {Record<string, string>} attributes - A record of attribute names and values to set.
*/
export declare function setAttributesWithNamespace(element: HTMLElement | SVGElement, attributes: Record<string, string>): void;
/**
* Creates child nodes from the given ReblendTyping.VNode children and appends them to the container array.
* Supports nested arrays, Sets, and various node types such as Reblend, DOM Nodes, React Nodes, and primitive values.
*
* @param {ReblendTyping.VNodeChildren} children - The children to process.
* @param {(ReblendTyping.Component<P, S> | HTMLElement)[]} [containerArr=[]] - The array to store the created child nodes.
* @returns {(ReblendTyping.Component<P, S> | HTMLElement)[]} The array containing the created child nodes.
*/
export declare function createChildren<P, S>(children: ReblendTyping.VNodeChildren, containerArr?: (ReblendTyping.Component<P, S> | HTMLElement)[]): Promise<(ReblendTyping.Component<P, S> | HTMLElement)[]>;
/**
* Creates an element based on the provided virtual node (ReblendTyping.VNode) or primitive value.
* The created element is returned as a `BaseComponent`.
*
* @param {ReblendTyping.VNode | ReblendTyping.VNode[] | ReblendTyping.ReactNode | ReblendTyping.Primitive} ui - The virtual node or primitive to create an element from.
* @returns {ReblendTyping.Component<P, S>[]} The created `BaseComponent` instances.
*/
export declare function createElement<P, S>(ui: ReblendTyping.ReblendNode): Promise<ReblendTyping.Component<P, S>[]>;
/**
* Creates a new Reblend primitive element.
*
* @returns {ReblendTyping.Primitive} The newly created Reblend primitive element.
*/
export declare function newReblendPrimitive(): Text & {
setData: (data: ReblendTyping.Primitive) => Text;
getData: () => ReblendTyping.Primitive;
};