import { ClassType } from '@deepkit/core'; import './optimize-tsx'; import { Injector } from '@deepkit/injector'; import { Stopwatch } from '@deepkit/stopwatch'; import { safeString } from './utils.js'; export type Attributes = { [P in keyof T]: T[P]; } & { children?: (ElementStruct | string)[] | ElementStruct | string; }; export declare abstract class ElementClass { protected attributes: Attributes; constructor(attributes: Attributes); abstract render(): Element; } interface HtmlString { htmlString: string; } /** * Tell the template engine to not automatically escape the HTML in the given string. * Per default all dynamic values are automatically HTML escaped. * * This is dangerous: Always validate data that you pass as `string` otherwise this can lead * to Cross-Side Scripting attacks. */ export declare function html(string: string | HtmlString): HtmlString; export interface ElementFn { (attributes: Attributes, children: HtmlString | string): Element; } export type Element = string | ElementFn | ClassType | Element[]; export declare const voidElements: { [name: string]: true; }; type ElementStructChildren = HtmlString | ElementStruct | string | SafeString; export type ElementStruct = { render: string | ElementFn; attributes: Attributes | null | string; children: ElementStructChildren | ElementStructChildren[]; childrenEscaped?: ElementStructChildren[] | string; }; export type SafeString = { [safeString]: string; }; export declare function isElementStruct(v: any): v is ElementStruct; export declare function isSafeString(v: any): v is SafeString; export declare function render(injector: Injector, struct: ElementStruct | string | (ElementStruct | string)[], stopwatch?: Stopwatch): Promise; export declare function createElement(element: Element, attributes?: Attributes | null, ...children: (string | ElementStruct | HtmlString)[]): { render: Element; attributes: Attributes | null | undefined; children: (string | ElementStruct | HtmlString)[]; }; export {}; export declare type __ΩAttributes = any[]; export declare type __ΩElementFn = any[]; export declare type __ΩElement = any[]; export declare type __ΩElementStruct = any[]; export declare type __ΩSafeString = any[];