@tbela99/css-parser 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -2
- package/dist/config.json.js +386 -4
- package/dist/index-umd-web.js +1540 -665
- package/dist/index.cjs +1540 -665
- package/dist/index.d.ts +498 -692
- package/dist/lib/ast/expand.js +11 -11
- package/dist/lib/ast/features/calc.js +17 -48
- package/dist/lib/ast/features/inlinecssvariables.js +42 -27
- package/dist/lib/ast/features/shorthand.js +4 -3
- package/dist/lib/ast/features/utils/math.js +95 -0
- package/dist/lib/ast/minify.js +34 -29
- package/dist/lib/ast/types.js +91 -78
- package/dist/lib/ast/walk.js +18 -5
- package/dist/lib/iterable/set.js +48 -0
- package/dist/lib/iterable/weakmap.js +53 -0
- package/dist/lib/parser/declaration/list.js +3 -3
- package/dist/lib/parser/declaration/map.js +53 -5
- package/dist/lib/parser/declaration/set.js +2 -2
- package/dist/lib/parser/parse.js +561 -361
- package/dist/lib/parser/tokenize.js +42 -13
- package/dist/lib/parser/utils/type.js +7 -2
- package/dist/lib/renderer/render.js +88 -41
- package/dist/node/index.js +8 -12
- package/dist/web/index.js +8 -12
- package/package.json +7 -5
- /package/dist/lib/ast/{utiles → utils}/minifyfeature.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,818 +1,726 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare enum EnumToken {
|
|
2
|
+
CommentTokenType = 0,
|
|
3
|
+
CDOCOMMTokenType = 1,
|
|
4
4
|
StyleSheetNodeType = 2,
|
|
5
5
|
AtRuleNodeType = 3,
|
|
6
6
|
RuleNodeType = 4,
|
|
7
|
-
DeclarationNodeType = 5
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
StringTokenType =
|
|
23
|
-
UnclosedStringTokenType =
|
|
24
|
-
DimensionTokenType =
|
|
25
|
-
LengthTokenType =
|
|
26
|
-
AngleTokenType =
|
|
27
|
-
TimeTokenType =
|
|
28
|
-
FrequencyTokenType =
|
|
29
|
-
ResolutionTokenType =
|
|
30
|
-
HashTokenType =
|
|
31
|
-
BlockStartTokenType =
|
|
32
|
-
BlockEndTokenType =
|
|
33
|
-
AttrStartTokenType =
|
|
34
|
-
AttrEndTokenType =
|
|
35
|
-
StartParensTokenType =
|
|
36
|
-
EndParensTokenType =
|
|
37
|
-
ParensTokenType =
|
|
38
|
-
WhitespaceTokenType =
|
|
39
|
-
|
|
40
|
-
DashMatchTokenType =
|
|
41
|
-
LtTokenType =
|
|
42
|
-
LteTokenType =
|
|
43
|
-
GtTokenType =
|
|
44
|
-
GteTokenType =
|
|
45
|
-
PseudoClassTokenType =
|
|
46
|
-
PseudoClassFuncTokenType =
|
|
47
|
-
DelimTokenType =
|
|
48
|
-
UrlTokenTokenType =
|
|
49
|
-
EOFTokenType =
|
|
50
|
-
ImportantTokenType =
|
|
51
|
-
ColorTokenType =
|
|
52
|
-
AttrTokenType =
|
|
53
|
-
BadCommentTokenType =
|
|
54
|
-
BadCdoTokenType =
|
|
55
|
-
BadUrlTokenType =
|
|
56
|
-
BadStringTokenType =
|
|
57
|
-
BinaryExpressionTokenType =
|
|
58
|
-
UnaryExpressionTokenType =
|
|
59
|
-
ListToken =
|
|
60
|
-
Add =
|
|
61
|
-
Mul =
|
|
62
|
-
Div =
|
|
63
|
-
Sub =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
7
|
+
DeclarationNodeType = 5,
|
|
8
|
+
LiteralTokenType = 6,
|
|
9
|
+
IdenTokenType = 7,
|
|
10
|
+
DashedIdenTokenType = 8,
|
|
11
|
+
CommaTokenType = 9,
|
|
12
|
+
ColonTokenType = 10,
|
|
13
|
+
SemiColonTokenType = 11,
|
|
14
|
+
NumberTokenType = 12,
|
|
15
|
+
AtRuleTokenType = 13,
|
|
16
|
+
PercentageTokenType = 14,
|
|
17
|
+
FunctionTokenType = 15,
|
|
18
|
+
TimelineFunctionTokenType = 16,
|
|
19
|
+
TimingFunctionTokenType = 17,
|
|
20
|
+
UrlFunctionTokenType = 18,
|
|
21
|
+
ImageFunctionTokenType = 19,
|
|
22
|
+
StringTokenType = 20,
|
|
23
|
+
UnclosedStringTokenType = 21,
|
|
24
|
+
DimensionTokenType = 22,
|
|
25
|
+
LengthTokenType = 23,
|
|
26
|
+
AngleTokenType = 24,
|
|
27
|
+
TimeTokenType = 25,
|
|
28
|
+
FrequencyTokenType = 26,
|
|
29
|
+
ResolutionTokenType = 27,
|
|
30
|
+
HashTokenType = 28,
|
|
31
|
+
BlockStartTokenType = 29,
|
|
32
|
+
BlockEndTokenType = 30,
|
|
33
|
+
AttrStartTokenType = 31,
|
|
34
|
+
AttrEndTokenType = 32,
|
|
35
|
+
StartParensTokenType = 33,
|
|
36
|
+
EndParensTokenType = 34,
|
|
37
|
+
ParensTokenType = 35,
|
|
38
|
+
WhitespaceTokenType = 36,
|
|
39
|
+
IncludeMatchTokenType = 37,
|
|
40
|
+
DashMatchTokenType = 38,
|
|
41
|
+
LtTokenType = 39,
|
|
42
|
+
LteTokenType = 40,
|
|
43
|
+
GtTokenType = 41,
|
|
44
|
+
GteTokenType = 42,
|
|
45
|
+
PseudoClassTokenType = 43,
|
|
46
|
+
PseudoClassFuncTokenType = 44,
|
|
47
|
+
DelimTokenType = 45,
|
|
48
|
+
UrlTokenTokenType = 46,
|
|
49
|
+
EOFTokenType = 47,
|
|
50
|
+
ImportantTokenType = 48,
|
|
51
|
+
ColorTokenType = 49,
|
|
52
|
+
AttrTokenType = 50,
|
|
53
|
+
BadCommentTokenType = 51,
|
|
54
|
+
BadCdoTokenType = 52,
|
|
55
|
+
BadUrlTokenType = 53,
|
|
56
|
+
BadStringTokenType = 54,
|
|
57
|
+
BinaryExpressionTokenType = 55,
|
|
58
|
+
UnaryExpressionTokenType = 56,
|
|
59
|
+
ListToken = 57,
|
|
60
|
+
Add = 58,
|
|
61
|
+
Mul = 59,
|
|
62
|
+
Div = 60,
|
|
63
|
+
Sub = 61,
|
|
64
|
+
ColumnCombinatorTokenType = 62,
|
|
65
|
+
ContainMatchTokenType = 63,
|
|
66
|
+
StartMatchTokenType = 64,
|
|
67
|
+
EndMatchTokenType = 65,
|
|
68
|
+
MatchExpressionTokenType = 66,
|
|
69
|
+
NameSpaceAttributeTokenType = 67,
|
|
70
|
+
FractionTokenType = 68,
|
|
71
|
+
Time = 25,
|
|
72
|
+
Iden = 7,
|
|
73
|
+
Hash = 28,
|
|
74
|
+
Angle = 24,
|
|
75
|
+
Color = 49,
|
|
76
|
+
Comma = 9,
|
|
77
|
+
String = 20,
|
|
78
|
+
Length = 23,
|
|
79
|
+
Number = 12,
|
|
80
|
+
Perc = 14,
|
|
81
|
+
Literal = 6,
|
|
75
82
|
Comment = 0,
|
|
76
|
-
UrlFunc =
|
|
77
|
-
Dimension =
|
|
78
|
-
Frequency =
|
|
79
|
-
Resolution =
|
|
80
|
-
Whitespace =
|
|
83
|
+
UrlFunc = 18,
|
|
84
|
+
Dimension = 22,
|
|
85
|
+
Frequency = 26,
|
|
86
|
+
Resolution = 27,
|
|
87
|
+
Whitespace = 36,
|
|
88
|
+
DashedIden = 8,
|
|
89
|
+
ImageFunc = 19,
|
|
90
|
+
CommentNodeType = 0,
|
|
91
|
+
CDOCOMMNodeType = 1,
|
|
92
|
+
TimingFunction = 17,
|
|
93
|
+
TimelineFunction = 16
|
|
81
94
|
}
|
|
82
95
|
|
|
83
|
-
declare const combinators: string[];
|
|
84
96
|
declare function minify(ast: AstNode, options?: ParserOptions | MinifyOptions, recursive?: boolean, errors?: ErrorDescription[], nestingContent?: boolean, context?: {
|
|
85
97
|
[key: string]: any;
|
|
86
98
|
}): AstNode;
|
|
87
|
-
declare function reduceSelector(selector: string[][]): {
|
|
88
|
-
match: boolean;
|
|
89
|
-
optimized: string[];
|
|
90
|
-
selector: string[][];
|
|
91
|
-
reducible: boolean;
|
|
92
|
-
} | null;
|
|
93
|
-
declare function hasDeclaration(node: AstRule): boolean;
|
|
94
|
-
declare function splitRule(buffer: string): string[][];
|
|
95
99
|
|
|
96
|
-
declare function walk(node: AstNode): Generator<WalkResult>;
|
|
100
|
+
declare function walk(node: AstNode, filter?: WalkerFilter): Generator<WalkResult>;
|
|
97
101
|
declare function walkValues(values: Token[]): Generator<WalkAttributesResult>;
|
|
98
102
|
|
|
99
103
|
declare function expand(ast: AstNode): AstNode;
|
|
100
|
-
declare function replaceCompound(input: string, replace: string): string;
|
|
101
104
|
|
|
102
|
-
declare const colorsFunc: string[];
|
|
103
|
-
declare function reduceNumber(val: string | number): string;
|
|
104
|
-
declare function doRender(data: AstNode, options?: RenderOptions): RenderResult;
|
|
105
105
|
declare function renderToken(token: Token, options?: RenderOptions, cache?: {
|
|
106
106
|
[key: string]: any;
|
|
107
107
|
}, reducer?: (acc: string, curr: Token) => string, errors?: ErrorDescription[]): string;
|
|
108
108
|
|
|
109
|
-
declare const urlTokenMatcher: RegExp;
|
|
110
|
-
declare function doParse(iterator: string, options?: ParserOptions): Promise<ParseResult>;
|
|
111
109
|
declare function parseString(src: string, options?: {
|
|
112
110
|
location: boolean;
|
|
113
111
|
}): Token[];
|
|
114
112
|
declare function parseTokens(tokens: Token[], options?: ParseTokenOptions): Token[];
|
|
115
113
|
|
|
116
|
-
declare
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
declare function isResolution(dimension: DimensionToken): boolean;
|
|
120
|
-
declare function isAngle(dimension: DimensionToken): boolean;
|
|
121
|
-
declare function isTime(dimension: DimensionToken): boolean;
|
|
122
|
-
declare function isFrequency(dimension: DimensionToken): boolean;
|
|
123
|
-
declare function isColor(token: Token): boolean;
|
|
124
|
-
declare function isIdentStart(codepoint: number): boolean;
|
|
125
|
-
declare function isDigit(codepoint: number): boolean;
|
|
126
|
-
declare function isIdentCodepoint(codepoint: number): boolean;
|
|
127
|
-
declare function isIdent(name: string): boolean;
|
|
128
|
-
declare function isNonPrintable(codepoint: number): boolean;
|
|
129
|
-
declare function isPseudo(name: string): boolean;
|
|
130
|
-
declare function isHash(name: string): boolean;
|
|
131
|
-
declare function isNumber(name: string): boolean;
|
|
132
|
-
declare function isDimension(name: string): boolean;
|
|
133
|
-
declare function isPercentage(name: string): boolean;
|
|
134
|
-
declare function parseDimension(name: string): DimensionToken | LengthToken | AngleToken;
|
|
135
|
-
declare function isHexColor(name: string): boolean;
|
|
136
|
-
declare function isFunction(name: string): boolean;
|
|
137
|
-
declare function isAtKeyword(name: string): boolean;
|
|
138
|
-
declare function isNewLine(codepoint: number): boolean;
|
|
139
|
-
declare function isWhiteSpace(codepoint: number): boolean;
|
|
140
|
-
|
|
141
|
-
declare const getConfig: () => PropertiesConfig;
|
|
142
|
-
|
|
143
|
-
declare const funcList: string[];
|
|
144
|
-
declare function matchType(val: Token, properties: PropertyMapType): boolean;
|
|
145
|
-
|
|
146
|
-
interface BaseToken {
|
|
147
|
-
|
|
148
|
-
typ: EnumToken$1;
|
|
114
|
+
export declare interface BaseToken {
|
|
115
|
+
|
|
116
|
+
typ: EnumToken;
|
|
149
117
|
loc?: Location;
|
|
150
118
|
}
|
|
151
119
|
|
|
152
|
-
interface LiteralToken extends BaseToken {
|
|
120
|
+
export declare interface LiteralToken extends BaseToken {
|
|
153
121
|
|
|
154
|
-
typ: EnumToken
|
|
122
|
+
typ: EnumToken.LiteralTokenType;
|
|
155
123
|
val: string;
|
|
156
124
|
}
|
|
157
125
|
|
|
158
|
-
interface IdentToken extends BaseToken {
|
|
126
|
+
export declare interface IdentToken extends BaseToken {
|
|
159
127
|
|
|
160
|
-
typ: EnumToken
|
|
128
|
+
typ: EnumToken.IdenTokenType,
|
|
161
129
|
val: string;
|
|
162
130
|
}
|
|
163
131
|
|
|
164
|
-
interface
|
|
132
|
+
export declare interface DashedIdentToken extends BaseToken {
|
|
165
133
|
|
|
166
|
-
typ: EnumToken
|
|
134
|
+
typ: EnumToken.DashedIdenTokenType,
|
|
135
|
+
val: string;
|
|
167
136
|
}
|
|
168
137
|
|
|
169
|
-
interface
|
|
138
|
+
export declare interface CommaToken extends BaseToken {
|
|
170
139
|
|
|
171
|
-
typ: EnumToken
|
|
140
|
+
typ: EnumToken.CommaTokenType
|
|
172
141
|
}
|
|
173
142
|
|
|
174
|
-
interface
|
|
143
|
+
export declare interface ColonToken extends BaseToken {
|
|
175
144
|
|
|
176
|
-
typ: EnumToken
|
|
145
|
+
typ: EnumToken.ColonTokenType
|
|
177
146
|
}
|
|
178
147
|
|
|
179
|
-
interface
|
|
148
|
+
export declare interface SemiColonToken extends BaseToken {
|
|
180
149
|
|
|
181
|
-
typ: EnumToken
|
|
182
|
-
val: string;
|
|
150
|
+
typ: EnumToken.SemiColonTokenType
|
|
183
151
|
}
|
|
184
152
|
|
|
185
|
-
interface
|
|
153
|
+
export declare interface NumberToken extends BaseToken {
|
|
186
154
|
|
|
187
|
-
typ: EnumToken
|
|
188
|
-
val: string;
|
|
155
|
+
typ: EnumToken.NumberTokenType,
|
|
156
|
+
val: string | FractionToken;
|
|
189
157
|
}
|
|
190
158
|
|
|
191
|
-
interface
|
|
159
|
+
export declare interface AtRuleToken extends BaseToken {
|
|
192
160
|
|
|
193
|
-
typ: EnumToken
|
|
161
|
+
typ: EnumToken.AtRuleTokenType,
|
|
194
162
|
val: string;
|
|
195
163
|
}
|
|
196
164
|
|
|
197
|
-
interface
|
|
165
|
+
export declare interface PercentageToken extends BaseToken {
|
|
166
|
+
|
|
167
|
+
typ: EnumToken.PercentageTokenType,
|
|
168
|
+
val: string | FractionToken;
|
|
169
|
+
}
|
|
198
170
|
|
|
199
|
-
|
|
171
|
+
export declare interface FunctionToken extends BaseToken {
|
|
172
|
+
|
|
173
|
+
typ: EnumToken.FunctionTokenType,
|
|
200
174
|
val: string;
|
|
201
175
|
chi: Token[];
|
|
202
176
|
}
|
|
203
177
|
|
|
204
|
-
interface FunctionURLToken extends BaseToken {
|
|
178
|
+
export declare interface FunctionURLToken extends BaseToken {
|
|
205
179
|
|
|
206
|
-
typ: EnumToken
|
|
180
|
+
typ: EnumToken.UrlFunctionTokenType,
|
|
207
181
|
val: 'url';
|
|
208
182
|
chi: Array<UrlToken | CommentToken>;
|
|
209
183
|
}
|
|
210
184
|
|
|
211
|
-
interface
|
|
185
|
+
export declare interface FunctionImageToken extends BaseToken {
|
|
186
|
+
|
|
187
|
+
typ: EnumToken.ImageFunctionTokenType,
|
|
188
|
+
val: 'linear-gradient' | 'radial-gradient' | 'repeating-linear-gradient' | 'repeating-radial-gradient' | 'conic-gradient' | 'image' | 'image-set' | 'element' | 'cross-fade';
|
|
189
|
+
chi: Array<UrlToken | CommentToken>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export declare interface TimingFunctionToken extends BaseToken {
|
|
212
193
|
|
|
213
|
-
typ: EnumToken
|
|
194
|
+
typ: EnumToken.TimingFunctionTokenType;
|
|
195
|
+
val: string;
|
|
196
|
+
chi: Token[];
|
|
197
|
+
}
|
|
198
|
+
export declare interface TimelineFunctionToken extends BaseToken {
|
|
199
|
+
|
|
200
|
+
typ: EnumToken.TimelineFunctionTokenType;
|
|
201
|
+
val: string;
|
|
202
|
+
chi: Token[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare interface StringToken extends BaseToken {
|
|
206
|
+
|
|
207
|
+
typ: EnumToken.StringTokenType;
|
|
214
208
|
val: string;
|
|
215
209
|
}
|
|
216
210
|
|
|
217
|
-
interface BadStringToken extends BaseToken {
|
|
211
|
+
export declare interface BadStringToken extends BaseToken {
|
|
218
212
|
|
|
219
|
-
typ: EnumToken
|
|
213
|
+
typ: EnumToken.BadStringTokenType;
|
|
220
214
|
val: string;
|
|
221
215
|
}
|
|
222
216
|
|
|
223
|
-
interface UnclosedStringToken extends BaseToken {
|
|
217
|
+
export declare interface UnclosedStringToken extends BaseToken {
|
|
224
218
|
|
|
225
|
-
typ: EnumToken
|
|
219
|
+
typ: EnumToken.UnclosedStringTokenType;
|
|
226
220
|
val: string;
|
|
227
221
|
}
|
|
228
222
|
|
|
229
|
-
interface DimensionToken extends BaseToken {
|
|
223
|
+
export declare interface DimensionToken extends BaseToken {
|
|
230
224
|
|
|
231
|
-
typ: EnumToken
|
|
232
|
-
val: string |
|
|
225
|
+
typ: EnumToken.DimensionTokenType;
|
|
226
|
+
val: string | FractionToken;
|
|
233
227
|
unit: string;
|
|
234
228
|
}
|
|
235
229
|
|
|
236
|
-
interface LengthToken extends BaseToken {
|
|
230
|
+
export declare interface LengthToken extends BaseToken {
|
|
237
231
|
|
|
238
|
-
typ: EnumToken
|
|
239
|
-
val: string |
|
|
232
|
+
typ: EnumToken.LengthTokenType;
|
|
233
|
+
val: string | FractionToken;
|
|
240
234
|
unit: string;
|
|
241
235
|
}
|
|
242
236
|
|
|
243
|
-
interface AngleToken extends BaseToken {
|
|
237
|
+
export declare interface AngleToken extends BaseToken {
|
|
244
238
|
|
|
245
|
-
typ: EnumToken
|
|
246
|
-
val: string |
|
|
239
|
+
typ: EnumToken.AngleTokenType;
|
|
240
|
+
val: string | FractionToken;
|
|
247
241
|
unit: string;
|
|
248
242
|
}
|
|
249
243
|
|
|
250
|
-
interface TimeToken extends BaseToken {
|
|
244
|
+
export declare interface TimeToken extends BaseToken {
|
|
251
245
|
|
|
252
|
-
typ: EnumToken
|
|
253
|
-
val: string |
|
|
246
|
+
typ: EnumToken.TimeTokenType;
|
|
247
|
+
val: string | FractionToken;
|
|
254
248
|
unit: 'ms' | 's';
|
|
255
249
|
}
|
|
256
250
|
|
|
257
|
-
interface FrequencyToken extends BaseToken {
|
|
251
|
+
export declare interface FrequencyToken extends BaseToken {
|
|
258
252
|
|
|
259
|
-
typ: EnumToken
|
|
260
|
-
val: string |
|
|
253
|
+
typ: EnumToken.FrequencyTokenType;
|
|
254
|
+
val: string | FractionToken;
|
|
261
255
|
unit: 'Hz' | 'Khz';
|
|
262
256
|
}
|
|
263
257
|
|
|
264
|
-
interface ResolutionToken extends BaseToken {
|
|
258
|
+
export declare interface ResolutionToken extends BaseToken {
|
|
265
259
|
|
|
266
|
-
typ: EnumToken
|
|
267
|
-
val: string |
|
|
260
|
+
typ: EnumToken.ResolutionTokenType;
|
|
261
|
+
val: string | FractionToken;
|
|
268
262
|
unit: 'dpi' | 'dpcm' | 'dppx' | 'x';
|
|
269
263
|
}
|
|
270
264
|
|
|
271
|
-
interface HashToken extends BaseToken {
|
|
265
|
+
export declare interface HashToken extends BaseToken {
|
|
272
266
|
|
|
273
|
-
typ: EnumToken
|
|
267
|
+
typ: EnumToken.HashTokenType;
|
|
274
268
|
val: string;
|
|
275
269
|
}
|
|
276
270
|
|
|
277
|
-
interface BlockStartToken extends BaseToken {
|
|
271
|
+
export declare interface BlockStartToken extends BaseToken {
|
|
278
272
|
|
|
279
|
-
typ: EnumToken
|
|
273
|
+
typ: EnumToken.BlockStartTokenType
|
|
280
274
|
}
|
|
281
275
|
|
|
282
|
-
interface BlockEndToken extends BaseToken {
|
|
276
|
+
export declare interface BlockEndToken extends BaseToken {
|
|
283
277
|
|
|
284
|
-
typ: EnumToken
|
|
278
|
+
typ: EnumToken.BlockEndTokenType
|
|
285
279
|
}
|
|
286
280
|
|
|
287
|
-
interface AttrStartToken extends BaseToken {
|
|
281
|
+
export declare interface AttrStartToken extends BaseToken {
|
|
288
282
|
|
|
289
|
-
typ: EnumToken
|
|
283
|
+
typ: EnumToken.AttrStartTokenType;
|
|
290
284
|
chi?: Token[];
|
|
291
285
|
}
|
|
292
286
|
|
|
293
|
-
interface AttrEndToken extends BaseToken {
|
|
287
|
+
export declare interface AttrEndToken extends BaseToken {
|
|
294
288
|
|
|
295
|
-
typ: EnumToken
|
|
289
|
+
typ: EnumToken.AttrEndTokenType
|
|
296
290
|
}
|
|
297
291
|
|
|
298
|
-
interface ParensStartToken extends BaseToken {
|
|
292
|
+
export declare interface ParensStartToken extends BaseToken {
|
|
299
293
|
|
|
300
|
-
typ: EnumToken
|
|
294
|
+
typ: EnumToken.StartParensTokenType;
|
|
301
295
|
}
|
|
302
296
|
|
|
303
|
-
interface ParensEndToken extends BaseToken {
|
|
297
|
+
export declare interface ParensEndToken extends BaseToken {
|
|
304
298
|
|
|
305
|
-
typ: EnumToken
|
|
299
|
+
typ: EnumToken.EndParensTokenType
|
|
306
300
|
}
|
|
307
301
|
|
|
308
|
-
interface ParensToken extends BaseToken {
|
|
302
|
+
export declare interface ParensToken extends BaseToken {
|
|
309
303
|
|
|
310
|
-
typ: EnumToken
|
|
304
|
+
typ: EnumToken.ParensTokenType;
|
|
311
305
|
chi: Token[];
|
|
312
306
|
}
|
|
313
307
|
|
|
314
|
-
interface WhitespaceToken extends BaseToken {
|
|
308
|
+
export declare interface WhitespaceToken extends BaseToken {
|
|
315
309
|
|
|
316
|
-
typ: EnumToken
|
|
310
|
+
typ: EnumToken.WhitespaceTokenType
|
|
317
311
|
}
|
|
318
312
|
|
|
319
|
-
interface CommentToken extends BaseToken {
|
|
313
|
+
export declare interface CommentToken extends BaseToken {
|
|
320
314
|
|
|
321
|
-
typ: EnumToken
|
|
315
|
+
typ: EnumToken.CommentTokenType;
|
|
322
316
|
val: string;
|
|
323
317
|
}
|
|
324
318
|
|
|
325
|
-
interface BadCommentToken extends BaseToken {
|
|
319
|
+
export declare interface BadCommentToken extends BaseToken {
|
|
326
320
|
|
|
327
|
-
typ: EnumToken
|
|
321
|
+
typ: EnumToken.BadCommentTokenType;
|
|
328
322
|
val: string;
|
|
329
323
|
}
|
|
330
324
|
|
|
331
|
-
interface CDOCommentToken extends BaseToken {
|
|
325
|
+
export declare interface CDOCommentToken extends BaseToken {
|
|
332
326
|
|
|
333
|
-
typ: EnumToken
|
|
327
|
+
typ: EnumToken.CDOCOMMTokenType;
|
|
334
328
|
val: string;
|
|
335
329
|
}
|
|
336
330
|
|
|
337
|
-
interface BadCDOCommentToken extends BaseToken {
|
|
331
|
+
export declare interface BadCDOCommentToken extends BaseToken {
|
|
338
332
|
|
|
339
|
-
typ: EnumToken
|
|
333
|
+
typ: EnumToken.BadCdoTokenType;
|
|
340
334
|
val: string;
|
|
341
335
|
}
|
|
342
336
|
|
|
343
|
-
interface
|
|
337
|
+
export declare interface IncludeMatchToken extends BaseToken {
|
|
338
|
+
|
|
339
|
+
typ: EnumToken.IncludeMatchTokenType;
|
|
340
|
+
// val: '~=';
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export declare interface DashMatchToken extends BaseToken {
|
|
344
344
|
|
|
345
|
-
typ: EnumToken
|
|
346
|
-
val: '
|
|
345
|
+
typ: EnumToken.DashMatchTokenType;
|
|
346
|
+
// val: '|=';
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
interface
|
|
349
|
+
export declare interface StartMatchToken extends BaseToken {
|
|
350
350
|
|
|
351
|
-
typ: EnumToken
|
|
352
|
-
val: '
|
|
351
|
+
typ: EnumToken.StartMatchTokenType;
|
|
352
|
+
// val: '^=';
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
interface
|
|
355
|
+
export declare interface EndMatchToken extends BaseToken {
|
|
356
356
|
|
|
357
|
-
typ: EnumToken
|
|
357
|
+
typ: EnumToken.EndMatchTokenType;
|
|
358
|
+
// val: '|=';
|
|
358
359
|
}
|
|
359
360
|
|
|
360
|
-
interface
|
|
361
|
+
export declare interface ContainMatchToken extends BaseToken {
|
|
361
362
|
|
|
362
|
-
typ: EnumToken
|
|
363
|
+
typ: EnumToken.ContainMatchTokenType;
|
|
364
|
+
// val: '|=';
|
|
363
365
|
}
|
|
364
366
|
|
|
365
|
-
interface
|
|
367
|
+
export declare interface LessThanToken extends BaseToken {
|
|
366
368
|
|
|
367
|
-
typ: EnumToken
|
|
369
|
+
typ: EnumToken.LtTokenType;
|
|
368
370
|
}
|
|
369
371
|
|
|
370
|
-
interface
|
|
372
|
+
export declare interface LessThanOrEqualToken extends BaseToken {
|
|
371
373
|
|
|
372
|
-
typ: EnumToken
|
|
374
|
+
typ: EnumToken.LteTokenType;
|
|
373
375
|
}
|
|
374
376
|
|
|
375
|
-
interface
|
|
377
|
+
export declare interface GreaterThanToken extends BaseToken {
|
|
376
378
|
|
|
377
|
-
typ: EnumToken
|
|
379
|
+
typ: EnumToken.GtTokenType;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export declare interface GreaterThanOrEqualToken extends BaseToken {
|
|
383
|
+
|
|
384
|
+
typ: EnumToken.GteTokenType;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export declare interface ColumnCombinatorToken extends BaseToken {
|
|
388
|
+
|
|
389
|
+
typ: EnumToken.ColumnCombinatorTokenType;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export declare interface PseudoClassToken extends BaseToken {
|
|
393
|
+
|
|
394
|
+
typ: EnumToken.PseudoClassTokenType;
|
|
378
395
|
val: string;
|
|
379
396
|
}
|
|
380
397
|
|
|
381
|
-
interface PseudoClassFunctionToken extends BaseToken {
|
|
398
|
+
export declare interface PseudoClassFunctionToken extends BaseToken {
|
|
382
399
|
|
|
383
|
-
typ: EnumToken
|
|
400
|
+
typ: EnumToken.PseudoClassFuncTokenType;
|
|
384
401
|
val: string;
|
|
385
402
|
chi: Token[];
|
|
386
403
|
}
|
|
387
404
|
|
|
388
|
-
interface DelimToken extends BaseToken {
|
|
405
|
+
export declare interface DelimToken extends BaseToken {
|
|
389
406
|
|
|
390
|
-
typ: EnumToken
|
|
407
|
+
typ: EnumToken.DelimTokenType;
|
|
391
408
|
val: '=';
|
|
392
409
|
}
|
|
393
410
|
|
|
394
|
-
interface BadUrlToken extends BaseToken {
|
|
411
|
+
export declare interface BadUrlToken extends BaseToken {
|
|
395
412
|
|
|
396
|
-
typ: EnumToken
|
|
413
|
+
typ: EnumToken.BadUrlTokenType,
|
|
397
414
|
val: string;
|
|
398
415
|
}
|
|
399
416
|
|
|
400
|
-
interface UrlToken extends BaseToken {
|
|
417
|
+
export declare interface UrlToken extends BaseToken {
|
|
401
418
|
|
|
402
|
-
typ: EnumToken
|
|
419
|
+
typ: EnumToken.UrlTokenTokenType,
|
|
403
420
|
val: string;
|
|
404
421
|
}
|
|
405
422
|
|
|
406
|
-
interface EOFToken extends BaseToken {
|
|
423
|
+
export declare interface EOFToken extends BaseToken {
|
|
407
424
|
|
|
408
|
-
typ: EnumToken
|
|
425
|
+
typ: EnumToken.EOFTokenType;
|
|
409
426
|
}
|
|
410
427
|
|
|
411
|
-
interface ImportantToken extends BaseToken {
|
|
428
|
+
export declare interface ImportantToken extends BaseToken {
|
|
412
429
|
|
|
413
|
-
typ: EnumToken
|
|
430
|
+
typ: EnumToken.ImportantTokenType;
|
|
414
431
|
}
|
|
415
432
|
|
|
416
|
-
interface ColorToken extends BaseToken {
|
|
433
|
+
export declare interface ColorToken extends BaseToken {
|
|
417
434
|
|
|
418
|
-
typ: EnumToken
|
|
435
|
+
typ: EnumToken.ColorTokenType;
|
|
419
436
|
val: string;
|
|
420
437
|
kin: 'lit' | 'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hwb' | 'device-cmyk';
|
|
421
438
|
chi?: Token[];
|
|
422
439
|
}
|
|
423
440
|
|
|
424
|
-
interface AttrToken extends BaseToken {
|
|
441
|
+
export declare interface AttrToken extends BaseToken {
|
|
425
442
|
|
|
426
|
-
typ: EnumToken
|
|
443
|
+
typ: EnumToken.AttrTokenType,
|
|
427
444
|
chi: Token[]
|
|
428
445
|
}
|
|
429
446
|
|
|
430
|
-
interface AddToken extends BaseToken {
|
|
447
|
+
export declare interface AddToken extends BaseToken {
|
|
431
448
|
|
|
432
|
-
typ: EnumToken
|
|
449
|
+
typ: EnumToken.Add;
|
|
433
450
|
}
|
|
434
451
|
|
|
435
|
-
interface SubToken extends BaseToken {
|
|
452
|
+
export declare interface SubToken extends BaseToken {
|
|
436
453
|
|
|
437
|
-
typ: EnumToken
|
|
454
|
+
typ: EnumToken.Sub;
|
|
438
455
|
}
|
|
439
456
|
|
|
440
|
-
interface DivToken extends BaseToken {
|
|
457
|
+
export declare interface DivToken extends BaseToken {
|
|
441
458
|
|
|
442
|
-
typ: EnumToken
|
|
459
|
+
typ: EnumToken.Div;
|
|
443
460
|
}
|
|
444
461
|
|
|
445
|
-
interface MulToken extends BaseToken {
|
|
462
|
+
export declare interface MulToken extends BaseToken {
|
|
446
463
|
|
|
447
|
-
typ: EnumToken
|
|
464
|
+
typ: EnumToken.Mul;
|
|
448
465
|
}
|
|
449
466
|
|
|
450
|
-
interface UnaryExpression extends BaseToken {
|
|
467
|
+
export declare interface UnaryExpression extends BaseToken {
|
|
451
468
|
|
|
452
|
-
typ: EnumToken
|
|
453
|
-
sign: EnumToken
|
|
469
|
+
typ: EnumToken.UnaryExpressionTokenType
|
|
470
|
+
sign: EnumToken.Add | EnumToken.Sub;
|
|
454
471
|
val: UnaryExpressionNode;
|
|
455
472
|
}
|
|
456
473
|
|
|
457
|
-
interface
|
|
474
|
+
export declare interface FractionToken extends BaseToken {
|
|
475
|
+
|
|
476
|
+
typ: EnumToken.FractionTokenType;
|
|
477
|
+
l: NumberToken;
|
|
478
|
+
r: NumberToken;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export declare interface BinaryExpressionToken extends BaseToken {
|
|
482
|
+
|
|
483
|
+
typ: EnumToken.BinaryExpressionTokenType
|
|
484
|
+
op: EnumToken.Add | EnumToken.Sub | EnumToken.Div | EnumToken.Mul;
|
|
485
|
+
l: BinaryExpressionNode | Token;
|
|
486
|
+
r: BinaryExpressionNode | Token;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export declare interface MatchExpressionToken extends BaseToken {
|
|
490
|
+
|
|
491
|
+
typ: EnumToken.MatchExpressionTokenType
|
|
492
|
+
op: EnumToken.DashMatchTokenType | EnumToken.StartMatchTokenType | EnumToken.ContainMatchTokenType | EnumToken.EndMatchTokenType | EnumToken.IncludeMatchTokenType;
|
|
493
|
+
l: Token;
|
|
494
|
+
r: Token;
|
|
495
|
+
attr?: 'i' | 's';
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export declare interface NameSpaceAttributeToken extends BaseToken {
|
|
458
499
|
|
|
459
|
-
typ: EnumToken
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
r: BinaryExpressionNode;
|
|
500
|
+
typ: EnumToken.NameSpaceAttributeTokenType
|
|
501
|
+
l?: Token;
|
|
502
|
+
r: Token;
|
|
463
503
|
}
|
|
464
504
|
|
|
465
|
-
interface ListToken extends BaseToken {
|
|
505
|
+
export declare interface ListToken extends BaseToken {
|
|
466
506
|
|
|
467
|
-
typ: EnumToken
|
|
507
|
+
typ: EnumToken.ListToken
|
|
468
508
|
chi: Token[];
|
|
469
509
|
}
|
|
470
510
|
|
|
471
|
-
declare type UnaryExpressionNode =
|
|
511
|
+
export declare type UnaryExpressionNode =
|
|
512
|
+
BinaryExpressionNode
|
|
513
|
+
| NumberToken
|
|
514
|
+
| DimensionToken
|
|
515
|
+
| TimeToken
|
|
516
|
+
| LengthToken
|
|
517
|
+
| AngleToken
|
|
518
|
+
| FrequencyToken;
|
|
472
519
|
|
|
473
|
-
declare type BinaryExpressionNode = NumberToken | DimensionToken | PercentageToken |
|
|
520
|
+
export declare type BinaryExpressionNode = NumberToken | DimensionToken | PercentageToken | FractionToken |
|
|
474
521
|
AngleToken | LengthToken | FrequencyToken | BinaryExpressionToken | FunctionToken | ParensToken;
|
|
475
|
-
declare type Token =
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
522
|
+
export declare type Token =
|
|
523
|
+
LiteralToken
|
|
524
|
+
| IdentToken
|
|
525
|
+
| DashedIdentToken
|
|
526
|
+
| CommaToken
|
|
527
|
+
| ColonToken
|
|
528
|
+
| SemiColonToken
|
|
529
|
+
|
|
|
530
|
+
NumberToken
|
|
531
|
+
| AtRuleToken
|
|
532
|
+
| PercentageToken
|
|
533
|
+
| FunctionURLToken
|
|
534
|
+
| FunctionImageToken
|
|
535
|
+
| TimingFunctionToken
|
|
536
|
+
| TimelineFunctionToken
|
|
537
|
+
| FunctionToken
|
|
538
|
+
| DimensionToken
|
|
539
|
+
| LengthToken
|
|
540
|
+
|
|
|
541
|
+
AngleToken
|
|
542
|
+
| StringToken
|
|
543
|
+
| TimeToken
|
|
544
|
+
| FrequencyToken
|
|
545
|
+
| ResolutionToken
|
|
546
|
+
|
|
|
547
|
+
UnclosedStringToken
|
|
548
|
+
| HashToken
|
|
549
|
+
| BadStringToken
|
|
550
|
+
| BlockStartToken
|
|
551
|
+
| BlockEndToken
|
|
552
|
+
|
|
|
553
|
+
AttrStartToken
|
|
554
|
+
| AttrEndToken
|
|
555
|
+
| ParensStartToken
|
|
556
|
+
| ParensEndToken
|
|
557
|
+
| ParensToken
|
|
558
|
+
| CDOCommentToken
|
|
559
|
+
|
|
|
560
|
+
BadCDOCommentToken
|
|
561
|
+
| CommentToken
|
|
562
|
+
| BadCommentToken
|
|
563
|
+
| WhitespaceToken
|
|
564
|
+
| IncludeMatchToken
|
|
565
|
+
| StartMatchToken
|
|
566
|
+
| EndMatchToken
|
|
567
|
+
| ContainMatchToken | MatchExpressionToken | NameSpaceAttributeToken
|
|
568
|
+
|
|
|
569
|
+
DashMatchToken
|
|
570
|
+
| LessThanToken
|
|
571
|
+
| LessThanOrEqualToken
|
|
572
|
+
| GreaterThanToken
|
|
573
|
+
| GreaterThanOrEqualToken
|
|
574
|
+
| ColumnCombinatorToken
|
|
575
|
+
|
|
|
576
|
+
ListToken
|
|
577
|
+
| PseudoClassToken
|
|
578
|
+
| PseudoClassFunctionToken
|
|
579
|
+
| DelimToken
|
|
580
|
+
| BinaryExpressionToken
|
|
581
|
+
| UnaryExpression
|
|
582
|
+
| FractionToken
|
|
583
|
+
|
|
|
584
|
+
AddToken
|
|
585
|
+
| SubToken
|
|
586
|
+
| DivToken
|
|
587
|
+
| MulToken
|
|
588
|
+
|
|
|
589
|
+
BadUrlToken
|
|
590
|
+
| UrlToken
|
|
591
|
+
| ImportantToken
|
|
592
|
+
| ColorToken
|
|
593
|
+
| AttrToken
|
|
594
|
+
| EOFToken;
|
|
595
|
+
|
|
596
|
+
export declare interface Position {
|
|
499
597
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
[key: string]: {
|
|
504
|
-
[key: string]: any;
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
mapping?: {
|
|
508
|
-
[key: string]: any
|
|
509
|
-
}
|
|
598
|
+
ind: number;
|
|
599
|
+
lin: number;
|
|
600
|
+
col: number;
|
|
510
601
|
}
|
|
511
602
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
interface PropertiesConfig {
|
|
515
|
-
properties: PropertiesConfigProperties;
|
|
516
|
-
map: Map;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
interface Map {
|
|
520
|
-
border: Border;
|
|
521
|
-
"border-color": BackgroundPositionClass;
|
|
522
|
-
"border-style": BackgroundPositionClass;
|
|
523
|
-
"border-width": BackgroundPositionClass;
|
|
524
|
-
outline: Outline;
|
|
525
|
-
"outline-color": BackgroundPositionClass;
|
|
526
|
-
"outline-style": BackgroundPositionClass;
|
|
527
|
-
"outline-width": BackgroundPositionClass;
|
|
528
|
-
font: Font;
|
|
529
|
-
"font-weight": BackgroundPositionClass;
|
|
530
|
-
"font-style": BackgroundPositionClass;
|
|
531
|
-
"font-size": BackgroundPositionClass;
|
|
532
|
-
"line-height": BackgroundPositionClass;
|
|
533
|
-
"font-stretch": BackgroundPositionClass;
|
|
534
|
-
"font-variant": BackgroundPositionClass;
|
|
535
|
-
"font-family": BackgroundPositionClass;
|
|
536
|
-
background: Background;
|
|
537
|
-
"background-repeat": BackgroundPositionClass;
|
|
538
|
-
"background-color": BackgroundPositionClass;
|
|
539
|
-
"background-image": BackgroundPositionClass;
|
|
540
|
-
"background-attachment": BackgroundPositionClass;
|
|
541
|
-
"background-clip": BackgroundPositionClass;
|
|
542
|
-
"background-origin": BackgroundPositionClass;
|
|
543
|
-
"background-position": BackgroundPositionClass;
|
|
544
|
-
"background-size": BackgroundPositionClass;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
interface Background {
|
|
548
|
-
shorthand: string;
|
|
549
|
-
pattern: string;
|
|
550
|
-
keywords: string[];
|
|
551
|
-
default: any[];
|
|
552
|
-
multiple: boolean;
|
|
553
|
-
separator: Separator;
|
|
554
|
-
properties: BackgroundProperties;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
interface BackgroundProperties {
|
|
558
|
-
"background-repeat": BackgroundRepeat;
|
|
559
|
-
"background-color": PurpleBackgroundAttachment;
|
|
560
|
-
"background-image": PurpleBackgroundAttachment;
|
|
561
|
-
"background-attachment": PurpleBackgroundAttachment;
|
|
562
|
-
"background-clip": PurpleBackgroundAttachment;
|
|
563
|
-
"background-origin": PurpleBackgroundAttachment;
|
|
564
|
-
"background-position": BackgroundPosition;
|
|
565
|
-
"background-size": BackgroundSize;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
interface PurpleBackgroundAttachment {
|
|
569
|
-
types: string[];
|
|
570
|
-
default: string[];
|
|
571
|
-
keywords: string[];
|
|
572
|
-
required?: boolean;
|
|
573
|
-
mapping?: BackgroundAttachmentMapping;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
interface BackgroundAttachmentMapping {
|
|
577
|
-
"ultra-condensed": string;
|
|
578
|
-
"extra-condensed": string;
|
|
579
|
-
condensed: string;
|
|
580
|
-
"semi-condensed": string;
|
|
581
|
-
normal: string;
|
|
582
|
-
"semi-expanded": string;
|
|
583
|
-
expanded: string;
|
|
584
|
-
"extra-expanded": string;
|
|
585
|
-
"ultra-expanded": string;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
interface BackgroundPosition {
|
|
589
|
-
multiple: boolean;
|
|
590
|
-
types: string[];
|
|
591
|
-
default: string[];
|
|
592
|
-
keywords: string[];
|
|
593
|
-
mapping: BackgroundPositionMapping;
|
|
594
|
-
constraints: BackgroundPositionConstraints;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
interface BackgroundPositionConstraints {
|
|
598
|
-
mapping: ConstraintsMapping;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
interface ConstraintsMapping {
|
|
602
|
-
max: number;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
interface BackgroundPositionMapping {
|
|
606
|
-
left: string;
|
|
607
|
-
top: string;
|
|
608
|
-
center: string;
|
|
609
|
-
bottom: string;
|
|
610
|
-
right: string;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
interface BackgroundRepeat {
|
|
614
|
-
types: any[];
|
|
615
|
-
default: string[];
|
|
616
|
-
multiple: boolean;
|
|
617
|
-
keywords: string[];
|
|
618
|
-
mapping: BackgroundRepeatMapping;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
interface BackgroundRepeatMapping {
|
|
622
|
-
"repeat no-repeat": string;
|
|
623
|
-
"no-repeat repeat": string;
|
|
624
|
-
"repeat repeat": string;
|
|
625
|
-
"space space": string;
|
|
626
|
-
"round round": string;
|
|
627
|
-
"no-repeat no-repeat": string;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
interface BackgroundSize {
|
|
631
|
-
multiple: boolean;
|
|
632
|
-
previous: string;
|
|
633
|
-
prefix: Prefix;
|
|
634
|
-
types: string[];
|
|
635
|
-
default: string[];
|
|
636
|
-
keywords: string[];
|
|
637
|
-
mapping: BackgroundSizeMapping;
|
|
638
|
-
}
|
|
603
|
+
export declare interface Location {
|
|
639
604
|
|
|
640
|
-
|
|
641
|
-
|
|
605
|
+
sta: Position;
|
|
606
|
+
// end: Position;
|
|
607
|
+
src: string;
|
|
642
608
|
}
|
|
643
609
|
|
|
644
|
-
interface
|
|
645
|
-
|
|
610
|
+
export declare interface Node {
|
|
611
|
+
|
|
612
|
+
typ: EnumToken;
|
|
613
|
+
loc?: Location;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export declare interface AstComment extends Node {
|
|
617
|
+
|
|
618
|
+
typ: EnumToken.CommentNodeType | EnumToken.CDOCOMMNodeType,
|
|
646
619
|
val: string;
|
|
647
620
|
}
|
|
648
621
|
|
|
649
|
-
interface
|
|
650
|
-
|
|
622
|
+
export declare interface AstDeclaration extends Node {
|
|
623
|
+
|
|
624
|
+
nam: string,
|
|
625
|
+
val: Token[];
|
|
626
|
+
typ: EnumToken.DeclarationNodeType
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export declare interface AstRule$1 extends Node {
|
|
630
|
+
|
|
631
|
+
typ: EnumToken.RuleNodeType;
|
|
632
|
+
sel: string;
|
|
633
|
+
chi: Array<AstDeclaration | AstComment | AstRuleList>;
|
|
634
|
+
optimized?: OptimizedSelector;
|
|
635
|
+
raw?: RawSelectorTokens;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export declare type RawSelectorTokens = string[][];
|
|
639
|
+
|
|
640
|
+
export declare interface OptimizedSelector {
|
|
641
|
+
match: boolean;
|
|
642
|
+
optimized: string[];
|
|
643
|
+
selector: string[][],
|
|
644
|
+
reducible: boolean;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export declare interface AstAtRule$1 extends Node {
|
|
648
|
+
|
|
649
|
+
typ: AtRuleNodeType,
|
|
650
|
+
nam: string;
|
|
651
|
+
val: string;
|
|
652
|
+
chi?: Array<AstDeclaration | AstComment> | Array<AstRule$1 | AstComment>
|
|
651
653
|
}
|
|
652
654
|
|
|
653
|
-
interface
|
|
654
|
-
|
|
655
|
+
export declare interface AstRuleList extends Node {
|
|
656
|
+
|
|
657
|
+
typ: StyleSheetNodeType | RuleNodeType | AtRuleNodeType,
|
|
658
|
+
chi: Array<Node | AstComment>
|
|
655
659
|
}
|
|
656
660
|
|
|
657
|
-
interface
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
keywords: string[];
|
|
661
|
-
default: string[];
|
|
662
|
-
properties: BorderProperties;
|
|
661
|
+
export declare interface AstRuleStyleSheet$1 extends AstRuleList {
|
|
662
|
+
typ: StyleSheetNodeType,
|
|
663
|
+
chi: Array<AstRuleList | AstComment>
|
|
663
664
|
}
|
|
664
665
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
666
|
+
export declare type AstNode =
|
|
667
|
+
AstRuleStyleSheet$1
|
|
668
|
+
| AstRuleList
|
|
669
|
+
| AstComment
|
|
670
|
+
| AstAtRule$1
|
|
671
|
+
| AstRule$1
|
|
672
|
+
| AstDeclaration;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Declaration visitor handler
|
|
676
|
+
*/
|
|
677
|
+
export declare type DeclarationVisitorHandler = (node: AstDeclaration) => AstDeclaration | AstDeclaration[] | null;
|
|
678
|
+
/**
|
|
679
|
+
* Rule visitor handler
|
|
680
|
+
*/
|
|
681
|
+
export declare type RuleVisitorHandler = (node: AstRule$1) => AstRule$1 | AstRule$1[] | null;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* AtRule visitor handler
|
|
685
|
+
*/
|
|
686
|
+
export declare type AtRuleVisitorHandler = (node: AstAtRule$1) => AstAtRule$1 | AstAtRule$1[] | null;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Value visitor handler
|
|
690
|
+
*/
|
|
691
|
+
export declare type ValueVisitorHandler = (node: Token) => Token | Token[] | null;
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
export declare interface VisitorNodeMap {
|
|
695
|
+
|
|
696
|
+
AtRule?: Record<string, AtRuleVisitorHandler> | AtRuleVisitorHandler;
|
|
697
|
+
Declaration?: Record<string, DeclarationVisitorHandler> | DeclarationVisitorHandler;
|
|
698
|
+
Rule?: RuleVisitorHandler;
|
|
699
|
+
Value?: Record<EnumToken, ValueVisitorHandler> | ValueVisitorHandler;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export declare type WalkerOption = 'ignore' | 'stop' | 'children' | 'ignore-children' | null;
|
|
703
|
+
/**
|
|
704
|
+
* return value:
|
|
705
|
+
* - 'ignore': ignore this node and its children
|
|
706
|
+
* - 'stop': stop walking the tree
|
|
707
|
+
* - 'children': walk the children and ignore the node itself
|
|
708
|
+
* - 'ignore-children': walk the node and ignore children
|
|
709
|
+
*/
|
|
710
|
+
export declare type WalkerFilter = (node: AstNode) => WalkerOption;
|
|
711
|
+
|
|
712
|
+
export declare interface WalkResult {
|
|
713
|
+
node: AstNode;
|
|
714
|
+
parent?: AstRuleList;
|
|
715
|
+
root?: AstRuleList;
|
|
669
716
|
}
|
|
670
717
|
|
|
671
|
-
interface
|
|
718
|
+
export declare interface WalkAttributesResult {
|
|
719
|
+
value: Token;
|
|
720
|
+
parent: FunctionToken | ParensToken | null;
|
|
672
721
|
}
|
|
673
722
|
|
|
674
|
-
interface
|
|
675
|
-
shorthand: string;
|
|
676
|
-
pattern: string;
|
|
677
|
-
keywords: string[];
|
|
678
|
-
default: any[];
|
|
679
|
-
properties: FontProperties;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
interface FontProperties {
|
|
683
|
-
"font-weight": FontWeight;
|
|
684
|
-
"font-style": PurpleBackgroundAttachment;
|
|
685
|
-
"font-size": PurpleBackgroundAttachment;
|
|
686
|
-
"line-height": LineHeight;
|
|
687
|
-
"font-stretch": PurpleBackgroundAttachment;
|
|
688
|
-
"font-variant": PurpleBackgroundAttachment;
|
|
689
|
-
"font-family": FontFamily;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
interface FontFamily {
|
|
693
|
-
types: string[];
|
|
694
|
-
default: any[];
|
|
695
|
-
keywords: string[];
|
|
696
|
-
required: boolean;
|
|
697
|
-
multiple: boolean;
|
|
698
|
-
separator: Separator;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
interface FontWeight {
|
|
702
|
-
types: string[];
|
|
703
|
-
default: string[];
|
|
704
|
-
keywords: string[];
|
|
705
|
-
constraints: FontWeightConstraints;
|
|
706
|
-
mapping: FontWeightMapping;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
interface FontWeightConstraints {
|
|
710
|
-
value: Value;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
interface Value {
|
|
714
|
-
min: string;
|
|
715
|
-
max: string;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
interface FontWeightMapping {
|
|
719
|
-
thin: string;
|
|
720
|
-
hairline: string;
|
|
721
|
-
"extra light": string;
|
|
722
|
-
"ultra light": string;
|
|
723
|
-
light: string;
|
|
724
|
-
normal: string;
|
|
725
|
-
regular: string;
|
|
726
|
-
medium: string;
|
|
727
|
-
"semi bold": string;
|
|
728
|
-
"demi bold": string;
|
|
729
|
-
bold: string;
|
|
730
|
-
"extra bold": string;
|
|
731
|
-
"ultra bold": string;
|
|
732
|
-
black: string;
|
|
733
|
-
heavy: string;
|
|
734
|
-
"extra black": string;
|
|
735
|
-
"ultra black": string;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
interface LineHeight {
|
|
739
|
-
types: string[];
|
|
740
|
-
default: string[];
|
|
741
|
-
keywords: string[];
|
|
742
|
-
previous: string;
|
|
743
|
-
prefix: Prefix;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
interface Outline {
|
|
747
|
-
shorthand: string;
|
|
748
|
-
pattern: string;
|
|
749
|
-
keywords: string[];
|
|
750
|
-
default: string[];
|
|
751
|
-
properties: OutlineProperties;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
interface OutlineProperties {
|
|
755
|
-
"outline-color": PurpleBackgroundAttachment;
|
|
756
|
-
"outline-style": PurpleBackgroundAttachment;
|
|
757
|
-
"outline-width": PurpleBackgroundAttachment;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
interface PropertiesConfigProperties {
|
|
761
|
-
inset: BorderRadius;
|
|
762
|
-
top: BackgroundPositionClass;
|
|
763
|
-
right: BackgroundPositionClass;
|
|
764
|
-
bottom: BackgroundPositionClass;
|
|
765
|
-
left: BackgroundPositionClass;
|
|
766
|
-
margin: BorderRadius;
|
|
767
|
-
"margin-top": BackgroundPositionClass;
|
|
768
|
-
"margin-right": BackgroundPositionClass;
|
|
769
|
-
"margin-bottom": BackgroundPositionClass;
|
|
770
|
-
"margin-left": BackgroundPositionClass;
|
|
771
|
-
padding: BorderColor;
|
|
772
|
-
"padding-top": BackgroundPositionClass;
|
|
773
|
-
"padding-right": BackgroundPositionClass;
|
|
774
|
-
"padding-bottom": BackgroundPositionClass;
|
|
775
|
-
"padding-left": BackgroundPositionClass;
|
|
776
|
-
"border-radius": BorderRadius;
|
|
777
|
-
"border-top-left-radius": BackgroundPositionClass;
|
|
778
|
-
"border-top-right-radius": BackgroundPositionClass;
|
|
779
|
-
"border-bottom-right-radius": BackgroundPositionClass;
|
|
780
|
-
"border-bottom-left-radius": BackgroundPositionClass;
|
|
781
|
-
"border-width": BorderColor;
|
|
782
|
-
"border-top-width": BackgroundPositionClass;
|
|
783
|
-
"border-right-width": BackgroundPositionClass;
|
|
784
|
-
"border-bottom-width": BackgroundPositionClass;
|
|
785
|
-
"border-left-width": BackgroundPositionClass;
|
|
786
|
-
"border-style": BorderColor;
|
|
787
|
-
"border-top-style": BackgroundPositionClass;
|
|
788
|
-
"border-right-style": BackgroundPositionClass;
|
|
789
|
-
"border-bottom-style": BackgroundPositionClass;
|
|
790
|
-
"border-left-style": BackgroundPositionClass;
|
|
791
|
-
"border-color": BorderColor;
|
|
792
|
-
"border-top-color": BackgroundPositionClass;
|
|
793
|
-
"border-right-color": BackgroundPositionClass;
|
|
794
|
-
"border-bottom-color": BackgroundPositionClass;
|
|
795
|
-
"border-left-color": BackgroundPositionClass;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
interface BorderColor {
|
|
799
|
-
shorthand: string;
|
|
800
|
-
map?: string;
|
|
801
|
-
properties: string[];
|
|
802
|
-
types: string[];
|
|
803
|
-
keywords: string[];
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
interface BorderRadius {
|
|
807
|
-
shorthand: string;
|
|
808
|
-
properties: string[];
|
|
809
|
-
types: string[];
|
|
810
|
-
multiple: boolean;
|
|
811
|
-
separator: null | string;
|
|
812
|
-
keywords: string[];
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
interface ErrorDescription {
|
|
723
|
+
export declare interface ErrorDescription {
|
|
816
724
|
|
|
817
725
|
// drop rule or declaration | fix rule or declaration
|
|
818
726
|
action: 'drop' | 'ignore';
|
|
@@ -825,13 +733,7 @@ interface ErrorDescription {
|
|
|
825
733
|
error?: Error;
|
|
826
734
|
}
|
|
827
735
|
|
|
828
|
-
interface
|
|
829
|
-
|
|
830
|
-
removeDuplicateDeclarations?: boolean;
|
|
831
|
-
computeShorthand?: boolean;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
interface MinifyFeature {
|
|
736
|
+
export declare interface MinifyFeature {
|
|
835
737
|
|
|
836
738
|
ordering: number;
|
|
837
739
|
|
|
@@ -842,7 +744,7 @@ interface MinifyFeature {
|
|
|
842
744
|
cleanup?: (ast: AstRuleStyleSheet, options: ParserOptions = {}, context: { [key: string]: any }) => void;
|
|
843
745
|
}
|
|
844
746
|
|
|
845
|
-
interface ParserOptions extends PropertyListOptions {
|
|
747
|
+
export declare interface ParserOptions extends PropertyListOptions {
|
|
846
748
|
|
|
847
749
|
minify?: boolean;
|
|
848
750
|
src?: string;
|
|
@@ -861,23 +763,24 @@ interface ParserOptions extends PropertyListOptions {
|
|
|
861
763
|
load?: (url: string, currentUrl: string) => Promise<string>;
|
|
862
764
|
dirname?: (path: string) => string;
|
|
863
765
|
resolve?: (url: string, currentUrl: string, currentWorkingDirectory?: string) => {
|
|
864
|
-
absolute: string
|
|
865
|
-
relative: string
|
|
766
|
+
absolute: string;
|
|
767
|
+
relative: string;
|
|
866
768
|
};
|
|
867
|
-
|
|
769
|
+
visitor?: VisitorNodeMap;
|
|
770
|
+
signal?: AbortSignal;
|
|
868
771
|
}
|
|
869
772
|
|
|
870
|
-
interface MinifyOptions extends ParserOptions {
|
|
773
|
+
export declare interface MinifyOptions extends ParserOptions {
|
|
871
774
|
|
|
872
775
|
features: MinifyFeature[];
|
|
873
776
|
}
|
|
874
777
|
|
|
875
|
-
interface
|
|
778
|
+
export declare interface ResolvedPath {
|
|
876
779
|
absolute: string;
|
|
877
780
|
relative: string;
|
|
878
781
|
}
|
|
879
782
|
|
|
880
|
-
interface RenderOptions {
|
|
783
|
+
export declare interface RenderOptions {
|
|
881
784
|
|
|
882
785
|
minify?: boolean;
|
|
883
786
|
expandNestingRules?: boolean;
|
|
@@ -890,15 +793,15 @@ interface RenderOptions {
|
|
|
890
793
|
output?: string;
|
|
891
794
|
cwd?: string;
|
|
892
795
|
load?: (url: string, currentUrl: string) => Promise<string>;
|
|
893
|
-
resolve?: (url: string, currentUrl: string, currentWorkingDirectory?: string) =>
|
|
796
|
+
resolve?: (url: string, currentUrl: string, currentWorkingDirectory?: string) => ResolvedPath;
|
|
894
797
|
|
|
895
798
|
}
|
|
896
799
|
|
|
897
|
-
interface TransformOptions extends ParserOptions, RenderOptions {
|
|
800
|
+
export declare interface TransformOptions extends ParserOptions, RenderOptions {
|
|
898
801
|
|
|
899
802
|
}
|
|
900
803
|
|
|
901
|
-
interface ParseResult {
|
|
804
|
+
export declare interface ParseResult {
|
|
902
805
|
ast: AstRuleStyleSheet;
|
|
903
806
|
errors: ErrorDescription[];
|
|
904
807
|
stats: {
|
|
@@ -909,7 +812,7 @@ interface ParseResult {
|
|
|
909
812
|
}
|
|
910
813
|
}
|
|
911
814
|
|
|
912
|
-
interface RenderResult {
|
|
815
|
+
export declare interface RenderResult {
|
|
913
816
|
code: string;
|
|
914
817
|
errors: ErrorDescription[];
|
|
915
818
|
stats: {
|
|
@@ -918,7 +821,7 @@ interface RenderResult {
|
|
|
918
821
|
map?: SourceMapObject
|
|
919
822
|
}
|
|
920
823
|
|
|
921
|
-
interface TransformResult extends ParseResult, RenderResult {
|
|
824
|
+
export declare interface TransformResult extends ParseResult, RenderResult {
|
|
922
825
|
|
|
923
826
|
stats: {
|
|
924
827
|
bytesIn: number;
|
|
@@ -930,107 +833,11 @@ interface TransformResult extends ParseResult, RenderResult {
|
|
|
930
833
|
}
|
|
931
834
|
}
|
|
932
835
|
|
|
933
|
-
interface ParseTokenOptions extends ParserOptions {
|
|
836
|
+
export declare interface ParseTokenOptions extends ParserOptions {
|
|
934
837
|
parseColor?: boolean;
|
|
935
838
|
}
|
|
936
839
|
|
|
937
|
-
interface
|
|
938
|
-
token: string;
|
|
939
|
-
hint?: EnumToken;
|
|
940
|
-
position: Position;
|
|
941
|
-
bytesIn: number;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
interface Position {
|
|
945
|
-
|
|
946
|
-
ind: number;
|
|
947
|
-
lin: number;
|
|
948
|
-
col: number;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
interface Location {
|
|
952
|
-
|
|
953
|
-
sta: Position;
|
|
954
|
-
// end: Position;
|
|
955
|
-
src: string;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
interface Node {
|
|
959
|
-
|
|
960
|
-
typ: NodeType;
|
|
961
|
-
loc?: Location;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
interface AstComment extends Node {
|
|
965
|
-
|
|
966
|
-
typ: NodeType.CommentNodeType | NodeType.CDOCOMMNodeType,
|
|
967
|
-
val: string;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
interface AstDeclaration extends Node {
|
|
971
|
-
|
|
972
|
-
nam: string,
|
|
973
|
-
val: Token[];
|
|
974
|
-
typ: NodeType.DeclarationNodeType
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
interface AstRule extends Node {
|
|
978
|
-
|
|
979
|
-
typ: NodeType.RuleNodeType;
|
|
980
|
-
sel: string;
|
|
981
|
-
chi: Array<AstDeclaration | AstComment | AstRuleList>;
|
|
982
|
-
optimized?: OptimizedSelector;
|
|
983
|
-
raw?: RawSelectorTokens;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
declare type RawSelectorTokens = string[][];
|
|
987
|
-
|
|
988
|
-
interface OptimizedSelector {
|
|
989
|
-
match: boolean;
|
|
990
|
-
optimized: string[];
|
|
991
|
-
selector: string[][],
|
|
992
|
-
reducible: boolean;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
interface AstAtRule extends Node {
|
|
996
|
-
|
|
997
|
-
typ: AtRuleNodeType,
|
|
998
|
-
nam: string;
|
|
999
|
-
val: string;
|
|
1000
|
-
chi?: Array<AstDeclaration | AstComment> | Array<AstRule | AstComment>
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
interface AstRuleList extends Node {
|
|
1004
|
-
|
|
1005
|
-
typ: StyleSheetNodeType | RuleNodeType | AtRuleNodeType,
|
|
1006
|
-
chi: Array<Node | AstComment>
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
interface AstRuleStyleSheet extends AstRuleList {
|
|
1010
|
-
typ: StyleSheetNodeType,
|
|
1011
|
-
chi: Array<AstRuleList | AstComment>
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
type AstNode =
|
|
1015
|
-
AstRuleStyleSheet
|
|
1016
|
-
| AstRuleList
|
|
1017
|
-
| AstComment
|
|
1018
|
-
| AstAtRule
|
|
1019
|
-
| AstRule
|
|
1020
|
-
| AstDeclaration;
|
|
1021
|
-
|
|
1022
|
-
interface WalkResult {
|
|
1023
|
-
node: AstNode;
|
|
1024
|
-
parent?: AstRuleList;
|
|
1025
|
-
root?: AstRuleList;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
interface WalkAttributesResult {
|
|
1029
|
-
value: Token;
|
|
1030
|
-
parent: FunctionToken | ParensToken | null;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
interface SourceMapObject {
|
|
840
|
+
export declare interface SourceMapObject {
|
|
1034
841
|
version: number;
|
|
1035
842
|
file?: string;
|
|
1036
843
|
sourceRoot?: string;
|
|
@@ -1040,17 +847,16 @@ interface SourceMapObject {
|
|
|
1040
847
|
mappings: string;
|
|
1041
848
|
}
|
|
1042
849
|
|
|
1043
|
-
declare function load(url: string, currentFile: string): Promise<string>;
|
|
1044
|
-
|
|
1045
|
-
declare const matchUrl: RegExp;
|
|
1046
850
|
declare function dirname(path: string): string;
|
|
1047
851
|
declare function resolve(url: string, currentDirectory: string, cwd?: string): {
|
|
1048
852
|
absolute: string;
|
|
1049
853
|
relative: string;
|
|
1050
854
|
};
|
|
1051
855
|
|
|
856
|
+
declare function load(url: string, currentFile: string): Promise<string>;
|
|
857
|
+
|
|
1052
858
|
declare function render(data: AstNode, options?: RenderOptions): RenderResult;
|
|
1053
859
|
declare function parse(iterator: string, opt?: ParserOptions): Promise<ParseResult>;
|
|
1054
860
|
declare function transform(css: string, options?: TransformOptions): Promise<TransformResult>;
|
|
1055
861
|
|
|
1056
|
-
export { EnumToken
|
|
862
|
+
export { EnumToken, dirname, expand, load, minify, parse, parseString, parseTokens, render, renderToken, resolve, transform, walk, walkValues };
|