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