github
DocsBlog
fontcolor_theme
package

API @deepkit/template

npm install @deepkit/template

Classes

ElementClass [source]
export abstract class ElementClass {
    constructor(protected attributes: Attributes);
    abstract render(): Element;
}

Const

voidElements [source]
{ [name: string]: true; }
noStaticValue [source]
unique symbol

Functions

html [source]
(string: string | HtmlString): HtmlString

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.

isElementStruct [source]
(v: any): v is ElementStruct
isSafeString [source]
(v: any): v is SafeString
render [source]
(injector: Injector, struct: ElementStruct | string | (ElementStruct | string)[], stopwatch?: Stopwatch): Promise<any>
createElement [source]
(element: Element, attributes?: Attributes | null, ...children: (string | ElementStruct | HtmlString)[]): { render: Element; attributes: Attributes<any>; children: (string | ... 1 more ... | HtmlString)[]; }
transform [source]
(code: string, filename: string): string
parseCode [source]
(code: string): any
generateCode [source]
(ast: Node): any
extractStaticString [source]
(e: Expression | SpreadElement): string | typeof noStaticValue
isOptimisedHtmlString [source]
(e: Expression | SpreadElement): boolean
optimizeJSX [source]
(code: string): string
convertJsxCodeToCreateElement [source]
(code: string): string

Types

Attributes [source]
type Attributes<T = any> = {
    [P in keyof T]: T[P];
} & { children?: (ElementStruct | string)[] | ElementStruct | string };
ElementFn [source]
interface ElementFn {
    (attributes: Attributes, children: HtmlString | string): Element;
}
Element [source]
type Element = string | ElementFn | ClassType<ElementClass> | Element[];
ElementStruct [source]
type ElementStruct = { render: string | ElementFn, attributes: Attributes | null | string, children: ElementStructChildren | ElementStructChildren[], childrenEscaped?: ElementStructChildren[] | string };
SafeString [source]
type SafeString = { [safeString]: string };