mx-ui-components
Version:
mobius ui library
39 lines (38 loc) • 1.29 kB
TypeScript
import type BaseComponent from "../Counter/BaseComponent";
/**
* Recursive function to mount components dynamically based on metadata.
*
* @param metadata - The metadata array describing the components to render.
* @returns heThe created DocumentFragment.
*/
export declare function mountComponents(metadata: ComponentMetadata[], child: BaseComponent | null, suspense?: string | undefined, element?: HTMLElement | undefined): DocumentFragment;
/**
* Creates an HTMLElement from a single metadata object.
*
* @param meta - The metadata describing the component to create.
* @returns The created HTMLElement, or null if the metadata is invalid.
*/
export declare function createElementFromMetadata(meta: ComponentMetadata, child: BaseComponent | null): HTMLElement | null;
/**
* Interface for metadata describing a component.
*/
export interface ComponentMetadata {
id?: string;
provider?: string;
type: string;
styles?: string;
value?: string;
props?: Record<string, unknown>;
bindings?: Record<string, unknown>;
altText?: string;
version?: string;
lang?: string;
name?: string;
role?: string;
onload?: string;
children?: ComponentMetadata[];
events?: string;
store?: any;
services?: any;
title?: string;
}