source: trip-planner-front/node_modules/svgo/lib/types.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.4 KB
Line 
1export type XastDoctype = {
2 type: 'doctype';
3 name: string;
4 data: {
5 doctype: string;
6 };
7};
8
9export type XastInstruction = {
10 type: 'instruction';
11 name: string;
12 value: string;
13};
14
15export type XastComment = {
16 type: 'comment';
17 value: string;
18};
19
20export type XastCdata = {
21 type: 'cdata';
22 value: string;
23};
24
25export type XastText = {
26 type: 'text';
27 value: string;
28};
29
30export type XastElement = {
31 type: 'element';
32 name: string;
33 attributes: Record<string, string>;
34 children: Array<XastChild>;
35};
36
37export type XastChild =
38 | XastDoctype
39 | XastInstruction
40 | XastComment
41 | XastCdata
42 | XastText
43 | XastElement;
44
45export type XastRoot = {
46 type: 'root';
47 children: Array<XastChild>;
48};
49
50export type XastParent = XastRoot | XastElement;
51
52export type XastNode = XastRoot | XastChild;
53
54type VisitorNode<Node> = {
55 enter?: (node: Node, parentNode: XastParent) => void | symbol;
56 exit?: (node: Node, parentNode: XastParent) => void;
57};
58
59type VisitorRoot = {
60 enter?: (node: XastRoot, parentNode: null) => void;
61 exit?: (node: XastRoot, parentNode: null) => void;
62};
63
64export type Visitor = {
65 doctype?: VisitorNode<XastDoctype>;
66 instruction?: VisitorNode<XastInstruction>;
67 comment?: VisitorNode<XastComment>;
68 cdata?: VisitorNode<XastCdata>;
69 text?: VisitorNode<XastText>;
70 element?: VisitorNode<XastElement>;
71 root?: VisitorRoot;
72};
73
74export type PluginInfo = {
75 path?: string;
76 multipassCount: number;
77};
78
79export type Plugin<Params> = (
80 root: XastRoot,
81 params: Params,
82 info: PluginInfo
83) => null | Visitor;
84
85export type Specificity = [number, number, number, number];
86
87export type StylesheetDeclaration = {
88 name: string;
89 value: string;
90 important: boolean;
91};
92
93export type StylesheetRule = {
94 dynamic: boolean;
95 selectors: string;
96 specificity: Specificity;
97 declarations: Array<StylesheetDeclaration>;
98};
99
100export type Stylesheet = {
101 rules: Array<StylesheetRule>;
102 parents: Map<XastElement, XastParent>;
103};
104
105type StaticStyle = {
106 type: 'static';
107 inherited: boolean;
108 value: string;
109};
110
111type DynamicStyle = {
112 type: 'dynamic';
113 inherited: boolean;
114};
115
116export type ComputedStyles = Record<string, StaticStyle | DynamicStyle>;
117
118export type PathDataCommand =
119 | 'M'
120 | 'm'
121 | 'Z'
122 | 'z'
123 | 'L'
124 | 'l'
125 | 'H'
126 | 'h'
127 | 'V'
128 | 'v'
129 | 'C'
130 | 'c'
131 | 'S'
132 | 's'
133 | 'Q'
134 | 'q'
135 | 'T'
136 | 't'
137 | 'A'
138 | 'a';
139
140export type PathDataItem = {
141 command: PathDataCommand;
142 args: Array<number>;
143};
Note: See TracBrowser for help on using the repository browser.