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