/** * 表示 DOM 中可能的子元素类型。 */ export type ChildrenType = DomOptionsType | Element | string | null; /** * 表示创建 DOM 元素的选项类型。 */ export type DomOptionsType = { /** * 要创建的元素的标签名。默认为 "div"。 */ tag?: string; /** * 要附加到创建的元素的子元素。可以是单个子元素或子元素数组。 */ children?: ChildrenType | ChildrenType[]; /** * 要设置在创建的元素上的属性。 */ props?: Record; /** * 要设置在创建的元素上的属性。 */ attrs?: Record; /** * 要应用于创建的元素的样式。 */ styles?: Record; }; /** * 使用指定选项创建一个 DOM 元素。 * * @param options - 创建 DOM 元素的选项。 * * @returns 创建的 DOM 元素。 * * @remarks * 此函数旨在浏览器环境中使用。 * * @example * ```typescript * const element = createElement({ * tag: 'button', * children: '点击我', * attrs: { id: 'myButton' }, * styles: { color: 'red' } * }); * document.body.appendChild(element); * ``` */ export declare function createElement({ tag, children, props, attrs, styles, }?: DomOptionsType): HTMLElement; interface VNode { type: string; props: Record | null; children: VNode[] | string | null; } /** * 创建 SVG 元素,根据输入参数的类型选择合适的创建方法。 * * @param {VNode | string} params - VNode 对象或 SVG 字符串。 * @returns {SVGElement} 创建的 SVG 元素。 * @throws {Error} 如果输入字符串无法解析为有效的 SVG 元素。 */ export declare function createSvg(params: VNode | string): SVGSVGElement; /** * 从指定的 URL 加载 SVG 内容并创建 SVG 元素。 * * @param {string} url - 包含 SVG 内容的 URL。 * @returns {Promise} Promise,解析为创建的 SVG 元素。 * @throws {Error} 如果无法获取或解析 SVG 内容。 */ export declare function createSvgFromUrl(url: string): Promise; export {};