@tbela99/css-parser 1.2.0 → 1.3.1
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/CHANGELOG.md +11 -0
- package/README.md +29 -11
- package/dist/index-umd-web.js +2041 -1967
- package/dist/index.cjs +2129 -1964
- package/dist/index.d.ts +1936 -77
- package/dist/lib/ast/expand.js +4 -65
- package/dist/lib/ast/features/calc.js +3 -27
- package/dist/lib/ast/features/inlinecssvariables.js +2 -21
- package/dist/lib/ast/features/prefix.js +2 -1
- package/dist/lib/ast/features/transform.js +4 -3
- package/dist/lib/ast/features/type.js +9 -0
- package/dist/lib/ast/math/expression.js +26 -149
- package/dist/lib/ast/math/math.js +9 -9
- package/dist/lib/ast/minify.js +82 -171
- package/dist/lib/ast/transform/compute.js +4 -37
- package/dist/lib/ast/transform/matrix.js +33 -34
- package/dist/lib/ast/transform/minify.js +32 -51
- package/dist/lib/ast/transform/perspective.js +1 -1
- package/dist/lib/ast/transform/rotate.js +13 -13
- package/dist/lib/ast/transform/scale.js +8 -8
- package/dist/lib/ast/transform/skew.js +4 -4
- package/dist/lib/ast/transform/translate.js +8 -8
- package/dist/lib/ast/transform/utils.js +31 -39
- package/dist/lib/ast/types.js +459 -5
- package/dist/lib/ast/walk.js +18 -0
- package/dist/lib/fs/resolve.js +11 -3
- package/dist/lib/parser/declaration/map.js +1 -0
- package/dist/lib/parser/declaration/set.js +2 -2
- package/dist/lib/parser/parse.js +139 -32
- package/dist/lib/parser/tokenize.js +41 -93
- package/dist/lib/parser/utils/type.js +1 -1
- package/dist/lib/renderer/render.js +61 -30
- package/dist/lib/renderer/sourcemap/sourcemap.js +34 -0
- package/dist/lib/syntax/color/cmyk.js +2 -2
- package/dist/lib/syntax/color/color-mix.js +11 -12
- package/dist/lib/syntax/color/color.js +14 -7
- package/dist/lib/syntax/color/hsl.js +4 -4
- package/dist/lib/syntax/color/hwb.js +27 -8
- package/dist/lib/syntax/color/lab.js +4 -4
- package/dist/lib/syntax/color/lch.js +4 -4
- package/dist/lib/syntax/color/oklab.js +4 -4
- package/dist/lib/syntax/color/oklch.js +4 -4
- package/dist/lib/syntax/color/relativecolor.js +1 -1
- package/dist/lib/syntax/color/rgb.js +4 -4
- package/dist/lib/syntax/color/utils/components.js +15 -3
- package/dist/lib/syntax/color/utils/distance.js +15 -1
- package/dist/lib/syntax/syntax.js +18 -17
- package/dist/lib/syntax/utils.js +1 -1
- package/dist/lib/validation/at-rules/document.js +1 -1
- package/dist/lib/validation/at-rules/import.js +4 -4
- package/dist/lib/validation/at-rules/keyframes.js +0 -11
- package/dist/lib/validation/at-rules/supports.js +6 -6
- package/dist/lib/validation/config.js +0 -4
- package/dist/lib/validation/config.json.js +33 -30
- package/dist/lib/validation/parser/parse.js +0 -8
- package/dist/lib/validation/selector.js +0 -9
- package/dist/lib/validation/syntax.js +17 -135
- package/dist/lib/validation/syntaxes/complex-selector-list.js +0 -11
- package/dist/lib/validation/syntaxes/family-name.js +0 -32
- package/dist/lib/validation/syntaxes/keyframe-selector.js +0 -11
- package/dist/lib/validation/syntaxes/relative-selector-list.js +0 -26
- package/dist/lib/validation/syntaxes/url.js +0 -33
- package/dist/lib/validation/utils/list.js +0 -8
- package/dist/node.js +229 -0
- package/dist/web.js +158 -0
- package/package.json +14 -11
- package/dist/node/index.js +0 -57
- package/dist/node/load.js +0 -20
- package/dist/web/index.js +0 -66
- package/dist/web/load.js +0 -31
package/dist/lib/ast/types.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* syntax validation enum
|
|
3
|
+
*/
|
|
1
4
|
var SyntaxValidationResult;
|
|
2
5
|
(function (SyntaxValidationResult) {
|
|
6
|
+
/** valid syntax */
|
|
3
7
|
SyntaxValidationResult[SyntaxValidationResult["Valid"] = 0] = "Valid";
|
|
8
|
+
/** drop invalid syntax */
|
|
4
9
|
SyntaxValidationResult[SyntaxValidationResult["Drop"] = 1] = "Drop";
|
|
5
|
-
|
|
10
|
+
/** preserve unknown at-rules, declarations and pseudo-classes */
|
|
11
|
+
SyntaxValidationResult[SyntaxValidationResult["Lenient"] = 2] = "Lenient";
|
|
6
12
|
})(SyntaxValidationResult || (SyntaxValidationResult = {}));
|
|
7
13
|
/**
|
|
8
|
-
* validation
|
|
14
|
+
* enum of validation levels
|
|
9
15
|
*/
|
|
10
16
|
var ValidationLevel;
|
|
11
17
|
(function (ValidationLevel) {
|
|
@@ -23,166 +29,614 @@ var ValidationLevel;
|
|
|
23
29
|
ValidationLevel[ValidationLevel["All"] = 2] = "All"; // selectors + at-rules + declarations
|
|
24
30
|
})(ValidationLevel || (ValidationLevel = {}));
|
|
25
31
|
/**
|
|
26
|
-
* token types
|
|
32
|
+
* enum of all token types
|
|
27
33
|
*/
|
|
28
34
|
var EnumToken;
|
|
29
35
|
(function (EnumToken) {
|
|
36
|
+
/**
|
|
37
|
+
* comment token
|
|
38
|
+
*/
|
|
30
39
|
EnumToken[EnumToken["CommentTokenType"] = 0] = "CommentTokenType";
|
|
40
|
+
/**
|
|
41
|
+
* cdata section token
|
|
42
|
+
*/
|
|
31
43
|
EnumToken[EnumToken["CDOCOMMTokenType"] = 1] = "CDOCOMMTokenType";
|
|
44
|
+
/**
|
|
45
|
+
* style sheet node type
|
|
46
|
+
*/
|
|
32
47
|
EnumToken[EnumToken["StyleSheetNodeType"] = 2] = "StyleSheetNodeType";
|
|
48
|
+
/**
|
|
49
|
+
* at-rule node type
|
|
50
|
+
*/
|
|
33
51
|
EnumToken[EnumToken["AtRuleNodeType"] = 3] = "AtRuleNodeType";
|
|
52
|
+
/**
|
|
53
|
+
* rule node type
|
|
54
|
+
*/
|
|
34
55
|
EnumToken[EnumToken["RuleNodeType"] = 4] = "RuleNodeType";
|
|
56
|
+
/**
|
|
57
|
+
* declaration node type
|
|
58
|
+
*/
|
|
35
59
|
EnumToken[EnumToken["DeclarationNodeType"] = 5] = "DeclarationNodeType";
|
|
60
|
+
/**
|
|
61
|
+
* literal token type
|
|
62
|
+
*/
|
|
36
63
|
EnumToken[EnumToken["LiteralTokenType"] = 6] = "LiteralTokenType";
|
|
64
|
+
/**
|
|
65
|
+
* identifier token type
|
|
66
|
+
*/
|
|
37
67
|
EnumToken[EnumToken["IdenTokenType"] = 7] = "IdenTokenType";
|
|
68
|
+
/**
|
|
69
|
+
* dashed identifier token type
|
|
70
|
+
*/
|
|
38
71
|
EnumToken[EnumToken["DashedIdenTokenType"] = 8] = "DashedIdenTokenType";
|
|
72
|
+
/**
|
|
73
|
+
* comma token type
|
|
74
|
+
*/
|
|
39
75
|
EnumToken[EnumToken["CommaTokenType"] = 9] = "CommaTokenType";
|
|
76
|
+
/**
|
|
77
|
+
* colon token type
|
|
78
|
+
*/
|
|
40
79
|
EnumToken[EnumToken["ColonTokenType"] = 10] = "ColonTokenType";
|
|
80
|
+
/**
|
|
81
|
+
* semicolon token type
|
|
82
|
+
*/
|
|
41
83
|
EnumToken[EnumToken["SemiColonTokenType"] = 11] = "SemiColonTokenType";
|
|
84
|
+
/**
|
|
85
|
+
* number token type
|
|
86
|
+
*/
|
|
42
87
|
EnumToken[EnumToken["NumberTokenType"] = 12] = "NumberTokenType";
|
|
88
|
+
/**
|
|
89
|
+
* at-rule token type
|
|
90
|
+
*/
|
|
43
91
|
EnumToken[EnumToken["AtRuleTokenType"] = 13] = "AtRuleTokenType";
|
|
92
|
+
/**
|
|
93
|
+
* percentage token type
|
|
94
|
+
*/
|
|
44
95
|
EnumToken[EnumToken["PercentageTokenType"] = 14] = "PercentageTokenType";
|
|
96
|
+
/**
|
|
97
|
+
* function token type
|
|
98
|
+
*/
|
|
45
99
|
EnumToken[EnumToken["FunctionTokenType"] = 15] = "FunctionTokenType";
|
|
100
|
+
/**
|
|
101
|
+
* timeline function token type
|
|
102
|
+
*/
|
|
46
103
|
EnumToken[EnumToken["TimelineFunctionTokenType"] = 16] = "TimelineFunctionTokenType";
|
|
104
|
+
/**
|
|
105
|
+
* timing function token type
|
|
106
|
+
*/
|
|
47
107
|
EnumToken[EnumToken["TimingFunctionTokenType"] = 17] = "TimingFunctionTokenType";
|
|
108
|
+
/**
|
|
109
|
+
* url function token type
|
|
110
|
+
*/
|
|
48
111
|
EnumToken[EnumToken["UrlFunctionTokenType"] = 18] = "UrlFunctionTokenType";
|
|
112
|
+
/**
|
|
113
|
+
* image function token type
|
|
114
|
+
*/
|
|
49
115
|
EnumToken[EnumToken["ImageFunctionTokenType"] = 19] = "ImageFunctionTokenType";
|
|
116
|
+
/**
|
|
117
|
+
* string token type
|
|
118
|
+
*/
|
|
50
119
|
EnumToken[EnumToken["StringTokenType"] = 20] = "StringTokenType";
|
|
120
|
+
/**
|
|
121
|
+
* unclosed string token type
|
|
122
|
+
*/
|
|
51
123
|
EnumToken[EnumToken["UnclosedStringTokenType"] = 21] = "UnclosedStringTokenType";
|
|
124
|
+
/**
|
|
125
|
+
* dimension token type
|
|
126
|
+
*/
|
|
52
127
|
EnumToken[EnumToken["DimensionTokenType"] = 22] = "DimensionTokenType";
|
|
128
|
+
/**
|
|
129
|
+
* length token type
|
|
130
|
+
*/
|
|
53
131
|
EnumToken[EnumToken["LengthTokenType"] = 23] = "LengthTokenType";
|
|
132
|
+
/**
|
|
133
|
+
* angle token type
|
|
134
|
+
*/
|
|
54
135
|
EnumToken[EnumToken["AngleTokenType"] = 24] = "AngleTokenType";
|
|
136
|
+
/**
|
|
137
|
+
* time token type
|
|
138
|
+
*/
|
|
55
139
|
EnumToken[EnumToken["TimeTokenType"] = 25] = "TimeTokenType";
|
|
140
|
+
/**
|
|
141
|
+
* frequency token type
|
|
142
|
+
*/
|
|
56
143
|
EnumToken[EnumToken["FrequencyTokenType"] = 26] = "FrequencyTokenType";
|
|
144
|
+
/**
|
|
145
|
+
* resolution token type
|
|
146
|
+
*/
|
|
57
147
|
EnumToken[EnumToken["ResolutionTokenType"] = 27] = "ResolutionTokenType";
|
|
148
|
+
/**
|
|
149
|
+
* hash token type
|
|
150
|
+
*/
|
|
58
151
|
EnumToken[EnumToken["HashTokenType"] = 28] = "HashTokenType";
|
|
152
|
+
/**
|
|
153
|
+
* block start token type
|
|
154
|
+
*/
|
|
59
155
|
EnumToken[EnumToken["BlockStartTokenType"] = 29] = "BlockStartTokenType";
|
|
156
|
+
/**
|
|
157
|
+
* block end token type
|
|
158
|
+
*/
|
|
60
159
|
EnumToken[EnumToken["BlockEndTokenType"] = 30] = "BlockEndTokenType";
|
|
160
|
+
/**
|
|
161
|
+
* attribute start token type
|
|
162
|
+
*/
|
|
61
163
|
EnumToken[EnumToken["AttrStartTokenType"] = 31] = "AttrStartTokenType";
|
|
164
|
+
/**
|
|
165
|
+
* attribute end token type
|
|
166
|
+
*/
|
|
62
167
|
EnumToken[EnumToken["AttrEndTokenType"] = 32] = "AttrEndTokenType";
|
|
168
|
+
/**
|
|
169
|
+
* start parentheses token type
|
|
170
|
+
*/
|
|
63
171
|
EnumToken[EnumToken["StartParensTokenType"] = 33] = "StartParensTokenType";
|
|
172
|
+
/**
|
|
173
|
+
* end parentheses token type
|
|
174
|
+
*/
|
|
64
175
|
EnumToken[EnumToken["EndParensTokenType"] = 34] = "EndParensTokenType";
|
|
176
|
+
/**
|
|
177
|
+
* parentheses token type
|
|
178
|
+
*/
|
|
65
179
|
EnumToken[EnumToken["ParensTokenType"] = 35] = "ParensTokenType";
|
|
180
|
+
/**
|
|
181
|
+
* whitespace token type
|
|
182
|
+
*/
|
|
66
183
|
EnumToken[EnumToken["WhitespaceTokenType"] = 36] = "WhitespaceTokenType";
|
|
184
|
+
/**
|
|
185
|
+
* include match token type
|
|
186
|
+
*/
|
|
67
187
|
EnumToken[EnumToken["IncludeMatchTokenType"] = 37] = "IncludeMatchTokenType";
|
|
188
|
+
/**
|
|
189
|
+
* dash match token type
|
|
190
|
+
*/
|
|
68
191
|
EnumToken[EnumToken["DashMatchTokenType"] = 38] = "DashMatchTokenType";
|
|
192
|
+
/**
|
|
193
|
+
* equal match token type
|
|
194
|
+
*/
|
|
69
195
|
EnumToken[EnumToken["EqualMatchTokenType"] = 39] = "EqualMatchTokenType";
|
|
196
|
+
/**
|
|
197
|
+
* less than token type
|
|
198
|
+
*/
|
|
70
199
|
EnumToken[EnumToken["LtTokenType"] = 40] = "LtTokenType";
|
|
200
|
+
/**
|
|
201
|
+
* less than or equal to token type
|
|
202
|
+
*/
|
|
71
203
|
EnumToken[EnumToken["LteTokenType"] = 41] = "LteTokenType";
|
|
204
|
+
/**
|
|
205
|
+
* greater than token type
|
|
206
|
+
*/
|
|
72
207
|
EnumToken[EnumToken["GtTokenType"] = 42] = "GtTokenType";
|
|
208
|
+
/**
|
|
209
|
+
* greater than or equal to token type
|
|
210
|
+
*/
|
|
73
211
|
EnumToken[EnumToken["GteTokenType"] = 43] = "GteTokenType";
|
|
212
|
+
/**
|
|
213
|
+
* pseudo-class token type
|
|
214
|
+
*/
|
|
74
215
|
EnumToken[EnumToken["PseudoClassTokenType"] = 44] = "PseudoClassTokenType";
|
|
216
|
+
/**
|
|
217
|
+
* pseudo-class function token type
|
|
218
|
+
*/
|
|
75
219
|
EnumToken[EnumToken["PseudoClassFuncTokenType"] = 45] = "PseudoClassFuncTokenType";
|
|
220
|
+
/**
|
|
221
|
+
* delimiter token type
|
|
222
|
+
*/
|
|
76
223
|
EnumToken[EnumToken["DelimTokenType"] = 46] = "DelimTokenType";
|
|
224
|
+
/**
|
|
225
|
+
* URL token type
|
|
226
|
+
*/
|
|
77
227
|
EnumToken[EnumToken["UrlTokenTokenType"] = 47] = "UrlTokenTokenType";
|
|
228
|
+
/**
|
|
229
|
+
* end of file token type
|
|
230
|
+
*/
|
|
78
231
|
EnumToken[EnumToken["EOFTokenType"] = 48] = "EOFTokenType";
|
|
232
|
+
/**
|
|
233
|
+
* important token type
|
|
234
|
+
*/
|
|
79
235
|
EnumToken[EnumToken["ImportantTokenType"] = 49] = "ImportantTokenType";
|
|
236
|
+
/**
|
|
237
|
+
* color token type
|
|
238
|
+
*/
|
|
80
239
|
EnumToken[EnumToken["ColorTokenType"] = 50] = "ColorTokenType";
|
|
240
|
+
/**
|
|
241
|
+
* attribute token type
|
|
242
|
+
*/
|
|
81
243
|
EnumToken[EnumToken["AttrTokenType"] = 51] = "AttrTokenType";
|
|
244
|
+
/**
|
|
245
|
+
* bad comment token type
|
|
246
|
+
*/
|
|
82
247
|
EnumToken[EnumToken["BadCommentTokenType"] = 52] = "BadCommentTokenType";
|
|
248
|
+
/**
|
|
249
|
+
* bad cdo token type
|
|
250
|
+
*/
|
|
83
251
|
EnumToken[EnumToken["BadCdoTokenType"] = 53] = "BadCdoTokenType";
|
|
252
|
+
/**
|
|
253
|
+
* bad URL token type
|
|
254
|
+
*/
|
|
84
255
|
EnumToken[EnumToken["BadUrlTokenType"] = 54] = "BadUrlTokenType";
|
|
256
|
+
/**
|
|
257
|
+
* bad string token type
|
|
258
|
+
*/
|
|
85
259
|
EnumToken[EnumToken["BadStringTokenType"] = 55] = "BadStringTokenType";
|
|
260
|
+
/**
|
|
261
|
+
* binary expression token type
|
|
262
|
+
*/
|
|
86
263
|
EnumToken[EnumToken["BinaryExpressionTokenType"] = 56] = "BinaryExpressionTokenType";
|
|
264
|
+
/**
|
|
265
|
+
* unary expression token type
|
|
266
|
+
*/
|
|
87
267
|
EnumToken[EnumToken["UnaryExpressionTokenType"] = 57] = "UnaryExpressionTokenType";
|
|
268
|
+
/**
|
|
269
|
+
* flex token type
|
|
270
|
+
*/
|
|
88
271
|
EnumToken[EnumToken["FlexTokenType"] = 58] = "FlexTokenType";
|
|
89
|
-
|
|
272
|
+
/**
|
|
273
|
+
* token list token type
|
|
274
|
+
*/
|
|
90
275
|
EnumToken[EnumToken["ListToken"] = 59] = "ListToken";
|
|
91
276
|
/* arithmetic tokens */
|
|
277
|
+
/**
|
|
278
|
+
* addition token type
|
|
279
|
+
*/
|
|
92
280
|
EnumToken[EnumToken["Add"] = 60] = "Add";
|
|
281
|
+
/**
|
|
282
|
+
* multiplication token type
|
|
283
|
+
*/
|
|
93
284
|
EnumToken[EnumToken["Mul"] = 61] = "Mul";
|
|
285
|
+
/**
|
|
286
|
+
* division token type
|
|
287
|
+
*/
|
|
94
288
|
EnumToken[EnumToken["Div"] = 62] = "Div";
|
|
289
|
+
/**
|
|
290
|
+
* subtraction token type
|
|
291
|
+
*/
|
|
95
292
|
EnumToken[EnumToken["Sub"] = 63] = "Sub";
|
|
96
293
|
/* new tokens */
|
|
294
|
+
/**
|
|
295
|
+
* column combinator token type
|
|
296
|
+
*/
|
|
97
297
|
EnumToken[EnumToken["ColumnCombinatorTokenType"] = 64] = "ColumnCombinatorTokenType";
|
|
298
|
+
/**
|
|
299
|
+
* contain match token type
|
|
300
|
+
*/
|
|
98
301
|
EnumToken[EnumToken["ContainMatchTokenType"] = 65] = "ContainMatchTokenType";
|
|
302
|
+
/**
|
|
303
|
+
* start match token type
|
|
304
|
+
*/
|
|
99
305
|
EnumToken[EnumToken["StartMatchTokenType"] = 66] = "StartMatchTokenType";
|
|
306
|
+
/**
|
|
307
|
+
* end match token type
|
|
308
|
+
*/
|
|
100
309
|
EnumToken[EnumToken["EndMatchTokenType"] = 67] = "EndMatchTokenType";
|
|
310
|
+
/**
|
|
311
|
+
* match expression token type
|
|
312
|
+
*/
|
|
101
313
|
EnumToken[EnumToken["MatchExpressionTokenType"] = 68] = "MatchExpressionTokenType";
|
|
314
|
+
/**
|
|
315
|
+
* namespace attribute token type
|
|
316
|
+
*/
|
|
102
317
|
EnumToken[EnumToken["NameSpaceAttributeTokenType"] = 69] = "NameSpaceAttributeTokenType";
|
|
318
|
+
/**
|
|
319
|
+
* fraction token type
|
|
320
|
+
*/
|
|
103
321
|
EnumToken[EnumToken["FractionTokenType"] = 70] = "FractionTokenType";
|
|
322
|
+
/**
|
|
323
|
+
* identifier list token type
|
|
324
|
+
*/
|
|
104
325
|
EnumToken[EnumToken["IdenListTokenType"] = 71] = "IdenListTokenType";
|
|
326
|
+
/**
|
|
327
|
+
* grid template function token type
|
|
328
|
+
*/
|
|
105
329
|
EnumToken[EnumToken["GridTemplateFuncTokenType"] = 72] = "GridTemplateFuncTokenType";
|
|
330
|
+
/**
|
|
331
|
+
* keyframe rule node type
|
|
332
|
+
*/
|
|
106
333
|
EnumToken[EnumToken["KeyFrameRuleNodeType"] = 73] = "KeyFrameRuleNodeType";
|
|
334
|
+
/**
|
|
335
|
+
* class selector token type
|
|
336
|
+
*/
|
|
107
337
|
EnumToken[EnumToken["ClassSelectorTokenType"] = 74] = "ClassSelectorTokenType";
|
|
338
|
+
/**
|
|
339
|
+
* universal selector token type
|
|
340
|
+
*/
|
|
108
341
|
EnumToken[EnumToken["UniversalSelectorTokenType"] = 75] = "UniversalSelectorTokenType";
|
|
342
|
+
/**
|
|
343
|
+
* child combinator token type
|
|
344
|
+
*/
|
|
109
345
|
EnumToken[EnumToken["ChildCombinatorTokenType"] = 76] = "ChildCombinatorTokenType";
|
|
346
|
+
/**
|
|
347
|
+
* descendant combinator token type
|
|
348
|
+
*/
|
|
110
349
|
EnumToken[EnumToken["DescendantCombinatorTokenType"] = 77] = "DescendantCombinatorTokenType";
|
|
350
|
+
/**
|
|
351
|
+
* next sibling combinator token type
|
|
352
|
+
*/
|
|
111
353
|
EnumToken[EnumToken["NextSiblingCombinatorTokenType"] = 78] = "NextSiblingCombinatorTokenType";
|
|
354
|
+
/**
|
|
355
|
+
* subsequent sibling combinator token type
|
|
356
|
+
*/
|
|
112
357
|
EnumToken[EnumToken["SubsequentSiblingCombinatorTokenType"] = 79] = "SubsequentSiblingCombinatorTokenType";
|
|
358
|
+
/**
|
|
359
|
+
* nesting selector token type
|
|
360
|
+
*/
|
|
113
361
|
EnumToken[EnumToken["NestingSelectorTokenType"] = 80] = "NestingSelectorTokenType";
|
|
362
|
+
/**
|
|
363
|
+
* invalid rule token type
|
|
364
|
+
*/
|
|
114
365
|
EnumToken[EnumToken["InvalidRuleTokenType"] = 81] = "InvalidRuleTokenType";
|
|
366
|
+
/**
|
|
367
|
+
* invalid class selector token type
|
|
368
|
+
*/
|
|
115
369
|
EnumToken[EnumToken["InvalidClassSelectorTokenType"] = 82] = "InvalidClassSelectorTokenType";
|
|
370
|
+
/**
|
|
371
|
+
* invalid attribute token type
|
|
372
|
+
*/
|
|
116
373
|
EnumToken[EnumToken["InvalidAttrTokenType"] = 83] = "InvalidAttrTokenType";
|
|
374
|
+
/**
|
|
375
|
+
* invalid at rule token type
|
|
376
|
+
*/
|
|
117
377
|
EnumToken[EnumToken["InvalidAtRuleTokenType"] = 84] = "InvalidAtRuleTokenType";
|
|
378
|
+
/**
|
|
379
|
+
* media query condition token type
|
|
380
|
+
*/
|
|
118
381
|
EnumToken[EnumToken["MediaQueryConditionTokenType"] = 85] = "MediaQueryConditionTokenType";
|
|
382
|
+
/**
|
|
383
|
+
* media feature token type
|
|
384
|
+
*/
|
|
119
385
|
EnumToken[EnumToken["MediaFeatureTokenType"] = 86] = "MediaFeatureTokenType";
|
|
386
|
+
/**
|
|
387
|
+
* media feature only token type
|
|
388
|
+
*/
|
|
120
389
|
EnumToken[EnumToken["MediaFeatureOnlyTokenType"] = 87] = "MediaFeatureOnlyTokenType";
|
|
390
|
+
/**
|
|
391
|
+
* media feature not token type
|
|
392
|
+
*/
|
|
121
393
|
EnumToken[EnumToken["MediaFeatureNotTokenType"] = 88] = "MediaFeatureNotTokenType";
|
|
394
|
+
/**
|
|
395
|
+
* media feature and token type
|
|
396
|
+
*/
|
|
122
397
|
EnumToken[EnumToken["MediaFeatureAndTokenType"] = 89] = "MediaFeatureAndTokenType";
|
|
398
|
+
/**
|
|
399
|
+
* media feature or token type
|
|
400
|
+
*/
|
|
123
401
|
EnumToken[EnumToken["MediaFeatureOrTokenType"] = 90] = "MediaFeatureOrTokenType";
|
|
402
|
+
/**
|
|
403
|
+
* pseudo page token type
|
|
404
|
+
*/
|
|
124
405
|
EnumToken[EnumToken["PseudoPageTokenType"] = 91] = "PseudoPageTokenType";
|
|
406
|
+
/**
|
|
407
|
+
* pseudo element token type
|
|
408
|
+
*/
|
|
125
409
|
EnumToken[EnumToken["PseudoElementTokenType"] = 92] = "PseudoElementTokenType";
|
|
410
|
+
/**
|
|
411
|
+
* keyframe at rule node type
|
|
412
|
+
*/
|
|
126
413
|
EnumToken[EnumToken["KeyframeAtRuleNodeType"] = 93] = "KeyframeAtRuleNodeType";
|
|
414
|
+
/**
|
|
415
|
+
* invalid declaration node type
|
|
416
|
+
*/
|
|
127
417
|
EnumToken[EnumToken["InvalidDeclarationNodeType"] = 94] = "InvalidDeclarationNodeType";
|
|
128
418
|
/* aliases */
|
|
419
|
+
/**
|
|
420
|
+
* alias for time token type
|
|
421
|
+
*/
|
|
129
422
|
EnumToken[EnumToken["Time"] = 25] = "Time";
|
|
423
|
+
/**
|
|
424
|
+
* alias for identifier token type
|
|
425
|
+
*/
|
|
130
426
|
EnumToken[EnumToken["Iden"] = 7] = "Iden";
|
|
427
|
+
/**
|
|
428
|
+
* alias for end of file token type
|
|
429
|
+
*/
|
|
131
430
|
EnumToken[EnumToken["EOF"] = 48] = "EOF";
|
|
431
|
+
/**
|
|
432
|
+
* alias for hash token type
|
|
433
|
+
*/
|
|
132
434
|
EnumToken[EnumToken["Hash"] = 28] = "Hash";
|
|
435
|
+
/**
|
|
436
|
+
* alias for flex token type
|
|
437
|
+
*/
|
|
133
438
|
EnumToken[EnumToken["Flex"] = 58] = "Flex";
|
|
439
|
+
/**
|
|
440
|
+
* alias for angle token type
|
|
441
|
+
*/
|
|
134
442
|
EnumToken[EnumToken["Angle"] = 24] = "Angle";
|
|
443
|
+
/**
|
|
444
|
+
* alias for color token type
|
|
445
|
+
*/
|
|
135
446
|
EnumToken[EnumToken["Color"] = 50] = "Color";
|
|
447
|
+
/**
|
|
448
|
+
* alias for comma token type
|
|
449
|
+
*/
|
|
136
450
|
EnumToken[EnumToken["Comma"] = 9] = "Comma";
|
|
451
|
+
/**
|
|
452
|
+
* alias for string token type
|
|
453
|
+
*/
|
|
137
454
|
EnumToken[EnumToken["String"] = 20] = "String";
|
|
455
|
+
/**
|
|
456
|
+
* alias for length token type
|
|
457
|
+
*/
|
|
138
458
|
EnumToken[EnumToken["Length"] = 23] = "Length";
|
|
459
|
+
/**
|
|
460
|
+
* alias for number token type
|
|
461
|
+
*/
|
|
139
462
|
EnumToken[EnumToken["Number"] = 12] = "Number";
|
|
463
|
+
/**
|
|
464
|
+
* alias for percentage token type
|
|
465
|
+
*/
|
|
140
466
|
EnumToken[EnumToken["Perc"] = 14] = "Perc";
|
|
467
|
+
/**
|
|
468
|
+
* alias for literal token type
|
|
469
|
+
*/
|
|
141
470
|
EnumToken[EnumToken["Literal"] = 6] = "Literal";
|
|
471
|
+
/**
|
|
472
|
+
* alias for comment token type
|
|
473
|
+
*/
|
|
142
474
|
EnumToken[EnumToken["Comment"] = 0] = "Comment";
|
|
475
|
+
/**
|
|
476
|
+
* alias for url function token type
|
|
477
|
+
*/
|
|
143
478
|
EnumToken[EnumToken["UrlFunc"] = 18] = "UrlFunc";
|
|
479
|
+
/**
|
|
480
|
+
* alias for dimension token type
|
|
481
|
+
*/
|
|
144
482
|
EnumToken[EnumToken["Dimension"] = 22] = "Dimension";
|
|
483
|
+
/**
|
|
484
|
+
* alias for frequency token type
|
|
485
|
+
*/
|
|
145
486
|
EnumToken[EnumToken["Frequency"] = 26] = "Frequency";
|
|
487
|
+
/**
|
|
488
|
+
* alias for resolution token type
|
|
489
|
+
*/
|
|
146
490
|
EnumToken[EnumToken["Resolution"] = 27] = "Resolution";
|
|
491
|
+
/**
|
|
492
|
+
* alias for whitespace token type
|
|
493
|
+
*/
|
|
147
494
|
EnumToken[EnumToken["Whitespace"] = 36] = "Whitespace";
|
|
495
|
+
/**
|
|
496
|
+
* alias for identifier list token type
|
|
497
|
+
*/
|
|
148
498
|
EnumToken[EnumToken["IdenList"] = 71] = "IdenList";
|
|
499
|
+
/**
|
|
500
|
+
* alias for dashed identifier token type
|
|
501
|
+
*/
|
|
149
502
|
EnumToken[EnumToken["DashedIden"] = 8] = "DashedIden";
|
|
503
|
+
/**
|
|
504
|
+
* alias for grid template function token type
|
|
505
|
+
*/
|
|
150
506
|
EnumToken[EnumToken["GridTemplateFunc"] = 72] = "GridTemplateFunc";
|
|
507
|
+
/**
|
|
508
|
+
* alias for image function token type
|
|
509
|
+
*/
|
|
151
510
|
EnumToken[EnumToken["ImageFunc"] = 19] = "ImageFunc";
|
|
511
|
+
/**
|
|
512
|
+
* alias for comment node type
|
|
513
|
+
*/
|
|
152
514
|
EnumToken[EnumToken["CommentNodeType"] = 0] = "CommentNodeType";
|
|
515
|
+
/**
|
|
516
|
+
* alias for cdata section node type
|
|
517
|
+
*/
|
|
153
518
|
EnumToken[EnumToken["CDOCOMMNodeType"] = 1] = "CDOCOMMNodeType";
|
|
519
|
+
/**
|
|
520
|
+
* alias for timing function token type
|
|
521
|
+
*/
|
|
154
522
|
EnumToken[EnumToken["TimingFunction"] = 17] = "TimingFunction";
|
|
523
|
+
/**
|
|
524
|
+
* alias for timeline function token type
|
|
525
|
+
*/
|
|
155
526
|
EnumToken[EnumToken["TimelineFunction"] = 16] = "TimelineFunction";
|
|
156
527
|
})(EnumToken || (EnumToken = {}));
|
|
157
|
-
|
|
528
|
+
/**
|
|
529
|
+
* supported color types enum
|
|
530
|
+
*/
|
|
158
531
|
var ColorType;
|
|
159
532
|
(function (ColorType) {
|
|
533
|
+
/**
|
|
534
|
+
* system colors
|
|
535
|
+
*/
|
|
160
536
|
ColorType[ColorType["SYS"] = 0] = "SYS";
|
|
537
|
+
/**
|
|
538
|
+
* deprecated system colors
|
|
539
|
+
*/
|
|
161
540
|
ColorType[ColorType["DPSYS"] = 1] = "DPSYS";
|
|
541
|
+
/**
|
|
542
|
+
* colors as literals
|
|
543
|
+
*/
|
|
162
544
|
ColorType[ColorType["LIT"] = 2] = "LIT";
|
|
545
|
+
/**
|
|
546
|
+
* colors as hex values
|
|
547
|
+
*/
|
|
163
548
|
ColorType[ColorType["HEX"] = 3] = "HEX";
|
|
549
|
+
/**
|
|
550
|
+
* colors as rgb values
|
|
551
|
+
*/
|
|
164
552
|
ColorType[ColorType["RGBA"] = 4] = "RGBA";
|
|
553
|
+
/**
|
|
554
|
+
* colors as hsl values
|
|
555
|
+
*/
|
|
165
556
|
ColorType[ColorType["HSLA"] = 5] = "HSLA";
|
|
557
|
+
/**
|
|
558
|
+
* colors as hwb values
|
|
559
|
+
*/
|
|
166
560
|
ColorType[ColorType["HWB"] = 6] = "HWB";
|
|
561
|
+
/**
|
|
562
|
+
* colors as cmyk values
|
|
563
|
+
*/
|
|
167
564
|
ColorType[ColorType["CMYK"] = 7] = "CMYK";
|
|
565
|
+
/**
|
|
566
|
+
* colors as oklab values
|
|
567
|
+
* */
|
|
168
568
|
ColorType[ColorType["OKLAB"] = 8] = "OKLAB";
|
|
569
|
+
/**
|
|
570
|
+
* colors as oklch values
|
|
571
|
+
* */
|
|
169
572
|
ColorType[ColorType["OKLCH"] = 9] = "OKLCH";
|
|
573
|
+
/**
|
|
574
|
+
* colors as lab values
|
|
575
|
+
*/
|
|
170
576
|
ColorType[ColorType["LAB"] = 10] = "LAB";
|
|
577
|
+
/**
|
|
578
|
+
* colors as lch values
|
|
579
|
+
*/
|
|
171
580
|
ColorType[ColorType["LCH"] = 11] = "LCH";
|
|
581
|
+
/**
|
|
582
|
+
* colors using color() function
|
|
583
|
+
*/
|
|
172
584
|
ColorType[ColorType["COLOR"] = 12] = "COLOR";
|
|
585
|
+
/**
|
|
586
|
+
* color using srgb values
|
|
587
|
+
*/
|
|
173
588
|
ColorType[ColorType["SRGB"] = 13] = "SRGB";
|
|
589
|
+
/**
|
|
590
|
+
* color using prophoto-rgb values
|
|
591
|
+
*/
|
|
174
592
|
ColorType[ColorType["PROPHOTO_RGB"] = 14] = "PROPHOTO_RGB";
|
|
593
|
+
/**
|
|
594
|
+
* color using a98-rgb values
|
|
595
|
+
*/
|
|
175
596
|
ColorType[ColorType["A98_RGB"] = 15] = "A98_RGB";
|
|
597
|
+
/**
|
|
598
|
+
* color using rec2020 values
|
|
599
|
+
*/
|
|
176
600
|
ColorType[ColorType["REC2020"] = 16] = "REC2020";
|
|
601
|
+
/**
|
|
602
|
+
* color using display-p3 values
|
|
603
|
+
*/
|
|
177
604
|
ColorType[ColorType["DISPLAY_P3"] = 17] = "DISPLAY_P3";
|
|
605
|
+
/**
|
|
606
|
+
* color using srgb-linear values
|
|
607
|
+
*/
|
|
178
608
|
ColorType[ColorType["SRGB_LINEAR"] = 18] = "SRGB_LINEAR";
|
|
609
|
+
/**
|
|
610
|
+
* color using xyz-d50 values
|
|
611
|
+
*/
|
|
179
612
|
ColorType[ColorType["XYZ_D50"] = 19] = "XYZ_D50";
|
|
613
|
+
/**
|
|
614
|
+
* color using xyz-d65 values
|
|
615
|
+
*/
|
|
180
616
|
ColorType[ColorType["XYZ_D65"] = 20] = "XYZ_D65";
|
|
617
|
+
/**
|
|
618
|
+
* light-dark() color function
|
|
619
|
+
*/
|
|
181
620
|
ColorType[ColorType["LIGHT_DARK"] = 21] = "LIGHT_DARK";
|
|
621
|
+
/**
|
|
622
|
+
* color-mix() color function
|
|
623
|
+
*/
|
|
182
624
|
ColorType[ColorType["COLOR_MIX"] = 22] = "COLOR_MIX";
|
|
625
|
+
/**
|
|
626
|
+
* alias for rgba
|
|
627
|
+
*/
|
|
183
628
|
ColorType[ColorType["RGB"] = 4] = "RGB";
|
|
629
|
+
/**
|
|
630
|
+
* alias for hsl
|
|
631
|
+
*/
|
|
184
632
|
ColorType[ColorType["HSL"] = 5] = "HSL";
|
|
633
|
+
/**
|
|
634
|
+
* alias for xyz-d65
|
|
635
|
+
*/
|
|
185
636
|
ColorType[ColorType["XYZ"] = 20] = "XYZ";
|
|
637
|
+
/**
|
|
638
|
+
* alias for cmyk
|
|
639
|
+
*/
|
|
186
640
|
ColorType[ColorType["DEVICE_CMYK"] = 7] = "DEVICE_CMYK";
|
|
187
641
|
})(ColorType || (ColorType = {}));
|
|
188
642
|
|
package/dist/lib/ast/walk.js
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
var WalkerOptionEnum;
|
|
2
2
|
(function (WalkerOptionEnum) {
|
|
3
|
+
/**
|
|
4
|
+
* ignore the current node and its children
|
|
5
|
+
*/
|
|
3
6
|
WalkerOptionEnum[WalkerOptionEnum["Ignore"] = 0] = "Ignore";
|
|
7
|
+
/**
|
|
8
|
+
* stop walking the tree
|
|
9
|
+
*/
|
|
4
10
|
WalkerOptionEnum[WalkerOptionEnum["Stop"] = 1] = "Stop";
|
|
11
|
+
/**
|
|
12
|
+
* ignore node and process children
|
|
13
|
+
*/
|
|
5
14
|
WalkerOptionEnum[WalkerOptionEnum["Children"] = 2] = "Children";
|
|
15
|
+
/**
|
|
16
|
+
* ignore children
|
|
17
|
+
*/
|
|
6
18
|
WalkerOptionEnum[WalkerOptionEnum["IgnoreChildren"] = 3] = "IgnoreChildren";
|
|
7
19
|
})(WalkerOptionEnum || (WalkerOptionEnum = {}));
|
|
8
20
|
var WalkerValueEvent;
|
|
9
21
|
(function (WalkerValueEvent) {
|
|
22
|
+
/**
|
|
23
|
+
* enter node
|
|
24
|
+
*/
|
|
10
25
|
WalkerValueEvent[WalkerValueEvent["Enter"] = 0] = "Enter";
|
|
26
|
+
/**
|
|
27
|
+
* leave node
|
|
28
|
+
*/
|
|
11
29
|
WalkerValueEvent[WalkerValueEvent["Leave"] = 1] = "Leave";
|
|
12
30
|
})(WalkerValueEvent || (WalkerValueEvent = {}));
|
|
13
31
|
/**
|
package/dist/lib/fs/resolve.js
CHANGED
|
@@ -2,6 +2,7 @@ const matchUrl = /^(https?:)?\/\//;
|
|
|
2
2
|
/**
|
|
3
3
|
* return the directory name of a path
|
|
4
4
|
* @param path
|
|
5
|
+
* @internal
|
|
5
6
|
*/
|
|
6
7
|
function dirname(path) {
|
|
7
8
|
if (path == '/' || path === '') {
|
|
@@ -24,6 +25,11 @@ function dirname(path) {
|
|
|
24
25
|
parts.pop();
|
|
25
26
|
return parts.length == 0 ? '/' : parts.join('/');
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* split path
|
|
30
|
+
* @param result
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
27
33
|
function splitPath(result) {
|
|
28
34
|
const parts = [''];
|
|
29
35
|
let i = 0;
|
|
@@ -53,9 +59,11 @@ function splitPath(result) {
|
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
61
|
* resolve path
|
|
56
|
-
* @param url
|
|
57
|
-
* @param currentDirectory
|
|
58
|
-
* @param cwd
|
|
62
|
+
* @param url url or path to resolve
|
|
63
|
+
* @param currentDirectory directory used to resolve the path
|
|
64
|
+
* @param cwd current working directory
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
59
67
|
*/
|
|
60
68
|
function resolve(url, currentDirectory, cwd) {
|
|
61
69
|
if (matchUrl.test(url)) {
|