type XastDoctype = { type: 'doctype'; name: string; data: { doctype: string; }; }; type XastInstruction = { type: 'instruction'; name: string; value: string; }; type XastComment = { type: 'comment'; value: string; }; type XastCdata = { type: 'cdata'; value: string; }; type XastText = { type: 'text'; value: string; }; export type XastElement = { type: 'element'; name: string; attributes: Record; children: Array; }; export type XastChild = | XastDoctype | XastInstruction | XastComment | XastCdata | XastText | XastElement; export type XastRoot = { type: 'root'; children: Array; }; export type XastParent = XastRoot | XastElement; export type XastNode = XastRoot | XastChild; type VisitorNode = { enter?: (node: Node, parentNode: XastParent) => void | symbol; exit?: (node: Node, parentNode: XastParent) => void; }; type VisitorRoot = { enter?: (node: XastRoot, parentNode: null) => void; exit?: (node: XastRoot, parentNode: null) => void; }; export type Visitor = { doctype?: VisitorNode; instruction?: VisitorNode; comment?: VisitorNode; cdata?: VisitorNode; text?: VisitorNode; element?: VisitorNode; root?: VisitorRoot; }; export type PluginInfo = { path?: string; multipassCount: number; }; export type Plugin = ( root: XastRoot, params: Params, info: PluginInfo ) => null | Visitor; export type Specificity = [number, number, number, number]; export type StylesheetDeclaration = { name: string; value: string; important: boolean; }; export type StylesheetRule = { dynamic: boolean; selectors: string; specificity: Specificity; declarations: Array; }; type StaticStyle = { type: 'static'; inherited: boolean; value: string; }; type DynamicStyle = { type: 'dynamic'; inherited: boolean; }; export type ComputedStyles = Record; export type PathDataCommand = | 'M' | 'm' | 'Z' | 'z' | 'L' | 'l' | 'H' | 'h' | 'V' | 'v' | 'C' | 'c' | 'S' | 's' | 'Q' | 'q' | 'T' | 't' | 'A' | 'a'; export type PathDataItem = { command: PathDataCommand; args: Array; };