| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- export type XastDoctype = {
- type: 'doctype';
- name: string;
- data: {
- doctype: string;
- };
- };
- export type XastInstruction = {
- type: 'instruction';
- name: string;
- value: string;
- };
- export type XastComment = {
- type: 'comment';
- value: string;
- };
- export type XastCdata = {
- type: 'cdata';
- value: string;
- };
- export type XastText = {
- type: 'text';
- value: string;
- };
- export type XastElement = {
- type: 'element';
- name: string;
- attributes: Record<string, string>;
- children: Array<XastChild>;
- };
- export type XastChild =
- | XastDoctype
- | XastInstruction
- | XastComment
- | XastCdata
- | XastText
- | XastElement;
- export type XastRoot = {
- type: 'root';
- children: Array<XastChild>;
- };
- export type XastParent = XastRoot | XastElement;
- export type XastNode = XastRoot | XastChild;
- export type StringifyOptions = {
- doctypeStart?: string;
- doctypeEnd?: string;
- procInstStart?: string;
- procInstEnd?: string;
- tagOpenStart?: string;
- tagOpenEnd?: string;
- tagCloseStart?: string;
- tagCloseEnd?: string;
- tagShortStart?: string;
- tagShortEnd?: string;
- attrStart?: string;
- attrEnd?: string;
- commentStart?: string;
- commentEnd?: string;
- cdataStart?: string;
- cdataEnd?: string;
- textStart?: string;
- textEnd?: string;
- indent?: number | string;
- regEntities?: RegExp;
- regValEntities?: RegExp;
- encodeEntity?: (char: string) => string;
- pretty?: boolean;
- useShortTags?: boolean;
- eol?: 'lf' | 'crlf';
- finalNewline?: boolean;
- };
- type VisitorNode<Node> = {
- 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<XastDoctype>;
- instruction?: VisitorNode<XastInstruction>;
- comment?: VisitorNode<XastComment>;
- cdata?: VisitorNode<XastCdata>;
- text?: VisitorNode<XastText>;
- element?: VisitorNode<XastElement>;
- root?: VisitorRoot;
- };
- export type PluginInfo = {
- path?: string;
- multipassCount: number;
- };
- export type Plugin<Params> = (
- 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<StylesheetDeclaration>;
- };
- export type Stylesheet = {
- rules: Array<StylesheetRule>;
- parents: Map<XastElement, XastParent>;
- };
- type StaticStyle = {
- type: 'static';
- inherited: boolean;
- value: string;
- };
- type DynamicStyle = {
- type: 'dynamic';
- inherited: boolean;
- };
- export type ComputedStyles = Record<string, StaticStyle | DynamicStyle>;
- 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<number>;
- };
|