marko
Version:
Optimized runtime for Marko templates.
29 lines (28 loc) • 1.45 kB
TypeScript
import { types as t } from "@marko/compiler";
import * as ContentType from "./constants/content-type";
import type { DOMRuntimeFeature, DOMRuntimeHelpers } from "./runtime";
export interface TagFacts {
/** What renders at its edges, `null` for nothing. */
content: ContentType.Value | null | ((tag: t.MarkoTag) => ContentType.Value | null);
/** Its body renders into the section holding the tag. */
inlineBody?: true;
/** Its body is text rather than markup. */
textBody?: true;
/** It renders its body in its own place, with no node of its own. */
controlFlow?: true;
/** One of the document's own elements: the parser implies and moves nodes
* into it, and the page writes assets and resume scripts into it. */
pageElement?: true;
/** Its insertion mode drops an unknown element but keeps its children, so a
* wrapper around content inside it is discarded. */
discardsWrapperChildren?: true;
}
export declare const controllableElements: Map<string, {
attrs: string[];
spreadHelper: DOMRuntimeHelpers;
feature: DOMRuntimeFeature;
}>;
export declare function getTagFacts(tag: t.NodePath<t.MarkoTag>): TagFacts;
export declare function getTagContentType(tag: t.NodePath<t.MarkoTag>): ContentType.Value | null;
export declare function isInTextBody(child: t.NodePath<t.MarkoPlaceholder | t.MarkoText>): boolean;
export declare function isControllableAttr(name: string): boolean;