@tbela99/css-parser 1.3.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.
@@ -11,7 +11,7 @@ var SyntaxValidationResult;
11
11
  SyntaxValidationResult[SyntaxValidationResult["Lenient"] = 2] = "Lenient";
12
12
  })(SyntaxValidationResult || (SyntaxValidationResult = {}));
13
13
  /**
14
- * validation level enum
14
+ * enum of validation levels
15
15
  */
16
16
  var ValidationLevel;
17
17
  (function (ValidationLevel) {
@@ -29,139 +29,504 @@ var ValidationLevel;
29
29
  ValidationLevel[ValidationLevel["All"] = 2] = "All"; // selectors + at-rules + declarations
30
30
  })(ValidationLevel || (ValidationLevel = {}));
31
31
  /**
32
- * token types enum
32
+ * enum of all token types
33
33
  */
34
34
  var EnumToken;
35
35
  (function (EnumToken) {
36
+ /**
37
+ * comment token
38
+ */
36
39
  EnumToken[EnumToken["CommentTokenType"] = 0] = "CommentTokenType";
40
+ /**
41
+ * cdata section token
42
+ */
37
43
  EnumToken[EnumToken["CDOCOMMTokenType"] = 1] = "CDOCOMMTokenType";
44
+ /**
45
+ * style sheet node type
46
+ */
38
47
  EnumToken[EnumToken["StyleSheetNodeType"] = 2] = "StyleSheetNodeType";
48
+ /**
49
+ * at-rule node type
50
+ */
39
51
  EnumToken[EnumToken["AtRuleNodeType"] = 3] = "AtRuleNodeType";
52
+ /**
53
+ * rule node type
54
+ */
40
55
  EnumToken[EnumToken["RuleNodeType"] = 4] = "RuleNodeType";
56
+ /**
57
+ * declaration node type
58
+ */
41
59
  EnumToken[EnumToken["DeclarationNodeType"] = 5] = "DeclarationNodeType";
60
+ /**
61
+ * literal token type
62
+ */
42
63
  EnumToken[EnumToken["LiteralTokenType"] = 6] = "LiteralTokenType";
64
+ /**
65
+ * identifier token type
66
+ */
43
67
  EnumToken[EnumToken["IdenTokenType"] = 7] = "IdenTokenType";
68
+ /**
69
+ * dashed identifier token type
70
+ */
44
71
  EnumToken[EnumToken["DashedIdenTokenType"] = 8] = "DashedIdenTokenType";
72
+ /**
73
+ * comma token type
74
+ */
45
75
  EnumToken[EnumToken["CommaTokenType"] = 9] = "CommaTokenType";
76
+ /**
77
+ * colon token type
78
+ */
46
79
  EnumToken[EnumToken["ColonTokenType"] = 10] = "ColonTokenType";
80
+ /**
81
+ * semicolon token type
82
+ */
47
83
  EnumToken[EnumToken["SemiColonTokenType"] = 11] = "SemiColonTokenType";
84
+ /**
85
+ * number token type
86
+ */
48
87
  EnumToken[EnumToken["NumberTokenType"] = 12] = "NumberTokenType";
88
+ /**
89
+ * at-rule token type
90
+ */
49
91
  EnumToken[EnumToken["AtRuleTokenType"] = 13] = "AtRuleTokenType";
92
+ /**
93
+ * percentage token type
94
+ */
50
95
  EnumToken[EnumToken["PercentageTokenType"] = 14] = "PercentageTokenType";
96
+ /**
97
+ * function token type
98
+ */
51
99
  EnumToken[EnumToken["FunctionTokenType"] = 15] = "FunctionTokenType";
100
+ /**
101
+ * timeline function token type
102
+ */
52
103
  EnumToken[EnumToken["TimelineFunctionTokenType"] = 16] = "TimelineFunctionTokenType";
104
+ /**
105
+ * timing function token type
106
+ */
53
107
  EnumToken[EnumToken["TimingFunctionTokenType"] = 17] = "TimingFunctionTokenType";
108
+ /**
109
+ * url function token type
110
+ */
54
111
  EnumToken[EnumToken["UrlFunctionTokenType"] = 18] = "UrlFunctionTokenType";
112
+ /**
113
+ * image function token type
114
+ */
55
115
  EnumToken[EnumToken["ImageFunctionTokenType"] = 19] = "ImageFunctionTokenType";
116
+ /**
117
+ * string token type
118
+ */
56
119
  EnumToken[EnumToken["StringTokenType"] = 20] = "StringTokenType";
120
+ /**
121
+ * unclosed string token type
122
+ */
57
123
  EnumToken[EnumToken["UnclosedStringTokenType"] = 21] = "UnclosedStringTokenType";
124
+ /**
125
+ * dimension token type
126
+ */
58
127
  EnumToken[EnumToken["DimensionTokenType"] = 22] = "DimensionTokenType";
128
+ /**
129
+ * length token type
130
+ */
59
131
  EnumToken[EnumToken["LengthTokenType"] = 23] = "LengthTokenType";
132
+ /**
133
+ * angle token type
134
+ */
60
135
  EnumToken[EnumToken["AngleTokenType"] = 24] = "AngleTokenType";
136
+ /**
137
+ * time token type
138
+ */
61
139
  EnumToken[EnumToken["TimeTokenType"] = 25] = "TimeTokenType";
140
+ /**
141
+ * frequency token type
142
+ */
62
143
  EnumToken[EnumToken["FrequencyTokenType"] = 26] = "FrequencyTokenType";
144
+ /**
145
+ * resolution token type
146
+ */
63
147
  EnumToken[EnumToken["ResolutionTokenType"] = 27] = "ResolutionTokenType";
148
+ /**
149
+ * hash token type
150
+ */
64
151
  EnumToken[EnumToken["HashTokenType"] = 28] = "HashTokenType";
152
+ /**
153
+ * block start token type
154
+ */
65
155
  EnumToken[EnumToken["BlockStartTokenType"] = 29] = "BlockStartTokenType";
156
+ /**
157
+ * block end token type
158
+ */
66
159
  EnumToken[EnumToken["BlockEndTokenType"] = 30] = "BlockEndTokenType";
160
+ /**
161
+ * attribute start token type
162
+ */
67
163
  EnumToken[EnumToken["AttrStartTokenType"] = 31] = "AttrStartTokenType";
164
+ /**
165
+ * attribute end token type
166
+ */
68
167
  EnumToken[EnumToken["AttrEndTokenType"] = 32] = "AttrEndTokenType";
168
+ /**
169
+ * start parentheses token type
170
+ */
69
171
  EnumToken[EnumToken["StartParensTokenType"] = 33] = "StartParensTokenType";
172
+ /**
173
+ * end parentheses token type
174
+ */
70
175
  EnumToken[EnumToken["EndParensTokenType"] = 34] = "EndParensTokenType";
176
+ /**
177
+ * parentheses token type
178
+ */
71
179
  EnumToken[EnumToken["ParensTokenType"] = 35] = "ParensTokenType";
180
+ /**
181
+ * whitespace token type
182
+ */
72
183
  EnumToken[EnumToken["WhitespaceTokenType"] = 36] = "WhitespaceTokenType";
184
+ /**
185
+ * include match token type
186
+ */
73
187
  EnumToken[EnumToken["IncludeMatchTokenType"] = 37] = "IncludeMatchTokenType";
188
+ /**
189
+ * dash match token type
190
+ */
74
191
  EnumToken[EnumToken["DashMatchTokenType"] = 38] = "DashMatchTokenType";
192
+ /**
193
+ * equal match token type
194
+ */
75
195
  EnumToken[EnumToken["EqualMatchTokenType"] = 39] = "EqualMatchTokenType";
196
+ /**
197
+ * less than token type
198
+ */
76
199
  EnumToken[EnumToken["LtTokenType"] = 40] = "LtTokenType";
200
+ /**
201
+ * less than or equal to token type
202
+ */
77
203
  EnumToken[EnumToken["LteTokenType"] = 41] = "LteTokenType";
204
+ /**
205
+ * greater than token type
206
+ */
78
207
  EnumToken[EnumToken["GtTokenType"] = 42] = "GtTokenType";
208
+ /**
209
+ * greater than or equal to token type
210
+ */
79
211
  EnumToken[EnumToken["GteTokenType"] = 43] = "GteTokenType";
212
+ /**
213
+ * pseudo-class token type
214
+ */
80
215
  EnumToken[EnumToken["PseudoClassTokenType"] = 44] = "PseudoClassTokenType";
216
+ /**
217
+ * pseudo-class function token type
218
+ */
81
219
  EnumToken[EnumToken["PseudoClassFuncTokenType"] = 45] = "PseudoClassFuncTokenType";
220
+ /**
221
+ * delimiter token type
222
+ */
82
223
  EnumToken[EnumToken["DelimTokenType"] = 46] = "DelimTokenType";
224
+ /**
225
+ * URL token type
226
+ */
83
227
  EnumToken[EnumToken["UrlTokenTokenType"] = 47] = "UrlTokenTokenType";
228
+ /**
229
+ * end of file token type
230
+ */
84
231
  EnumToken[EnumToken["EOFTokenType"] = 48] = "EOFTokenType";
232
+ /**
233
+ * important token type
234
+ */
85
235
  EnumToken[EnumToken["ImportantTokenType"] = 49] = "ImportantTokenType";
236
+ /**
237
+ * color token type
238
+ */
86
239
  EnumToken[EnumToken["ColorTokenType"] = 50] = "ColorTokenType";
240
+ /**
241
+ * attribute token type
242
+ */
87
243
  EnumToken[EnumToken["AttrTokenType"] = 51] = "AttrTokenType";
244
+ /**
245
+ * bad comment token type
246
+ */
88
247
  EnumToken[EnumToken["BadCommentTokenType"] = 52] = "BadCommentTokenType";
248
+ /**
249
+ * bad cdo token type
250
+ */
89
251
  EnumToken[EnumToken["BadCdoTokenType"] = 53] = "BadCdoTokenType";
252
+ /**
253
+ * bad URL token type
254
+ */
90
255
  EnumToken[EnumToken["BadUrlTokenType"] = 54] = "BadUrlTokenType";
256
+ /**
257
+ * bad string token type
258
+ */
91
259
  EnumToken[EnumToken["BadStringTokenType"] = 55] = "BadStringTokenType";
260
+ /**
261
+ * binary expression token type
262
+ */
92
263
  EnumToken[EnumToken["BinaryExpressionTokenType"] = 56] = "BinaryExpressionTokenType";
264
+ /**
265
+ * unary expression token type
266
+ */
93
267
  EnumToken[EnumToken["UnaryExpressionTokenType"] = 57] = "UnaryExpressionTokenType";
268
+ /**
269
+ * flex token type
270
+ */
94
271
  EnumToken[EnumToken["FlexTokenType"] = 58] = "FlexTokenType";
95
- /* catch all */
272
+ /**
273
+ * token list token type
274
+ */
96
275
  EnumToken[EnumToken["ListToken"] = 59] = "ListToken";
97
276
  /* arithmetic tokens */
277
+ /**
278
+ * addition token type
279
+ */
98
280
  EnumToken[EnumToken["Add"] = 60] = "Add";
281
+ /**
282
+ * multiplication token type
283
+ */
99
284
  EnumToken[EnumToken["Mul"] = 61] = "Mul";
285
+ /**
286
+ * division token type
287
+ */
100
288
  EnumToken[EnumToken["Div"] = 62] = "Div";
289
+ /**
290
+ * subtraction token type
291
+ */
101
292
  EnumToken[EnumToken["Sub"] = 63] = "Sub";
102
293
  /* new tokens */
294
+ /**
295
+ * column combinator token type
296
+ */
103
297
  EnumToken[EnumToken["ColumnCombinatorTokenType"] = 64] = "ColumnCombinatorTokenType";
298
+ /**
299
+ * contain match token type
300
+ */
104
301
  EnumToken[EnumToken["ContainMatchTokenType"] = 65] = "ContainMatchTokenType";
302
+ /**
303
+ * start match token type
304
+ */
105
305
  EnumToken[EnumToken["StartMatchTokenType"] = 66] = "StartMatchTokenType";
306
+ /**
307
+ * end match token type
308
+ */
106
309
  EnumToken[EnumToken["EndMatchTokenType"] = 67] = "EndMatchTokenType";
310
+ /**
311
+ * match expression token type
312
+ */
107
313
  EnumToken[EnumToken["MatchExpressionTokenType"] = 68] = "MatchExpressionTokenType";
314
+ /**
315
+ * namespace attribute token type
316
+ */
108
317
  EnumToken[EnumToken["NameSpaceAttributeTokenType"] = 69] = "NameSpaceAttributeTokenType";
318
+ /**
319
+ * fraction token type
320
+ */
109
321
  EnumToken[EnumToken["FractionTokenType"] = 70] = "FractionTokenType";
322
+ /**
323
+ * identifier list token type
324
+ */
110
325
  EnumToken[EnumToken["IdenListTokenType"] = 71] = "IdenListTokenType";
326
+ /**
327
+ * grid template function token type
328
+ */
111
329
  EnumToken[EnumToken["GridTemplateFuncTokenType"] = 72] = "GridTemplateFuncTokenType";
330
+ /**
331
+ * keyframe rule node type
332
+ */
112
333
  EnumToken[EnumToken["KeyFrameRuleNodeType"] = 73] = "KeyFrameRuleNodeType";
334
+ /**
335
+ * class selector token type
336
+ */
113
337
  EnumToken[EnumToken["ClassSelectorTokenType"] = 74] = "ClassSelectorTokenType";
338
+ /**
339
+ * universal selector token type
340
+ */
114
341
  EnumToken[EnumToken["UniversalSelectorTokenType"] = 75] = "UniversalSelectorTokenType";
342
+ /**
343
+ * child combinator token type
344
+ */
115
345
  EnumToken[EnumToken["ChildCombinatorTokenType"] = 76] = "ChildCombinatorTokenType";
346
+ /**
347
+ * descendant combinator token type
348
+ */
116
349
  EnumToken[EnumToken["DescendantCombinatorTokenType"] = 77] = "DescendantCombinatorTokenType";
350
+ /**
351
+ * next sibling combinator token type
352
+ */
117
353
  EnumToken[EnumToken["NextSiblingCombinatorTokenType"] = 78] = "NextSiblingCombinatorTokenType";
354
+ /**
355
+ * subsequent sibling combinator token type
356
+ */
118
357
  EnumToken[EnumToken["SubsequentSiblingCombinatorTokenType"] = 79] = "SubsequentSiblingCombinatorTokenType";
358
+ /**
359
+ * nesting selector token type
360
+ */
119
361
  EnumToken[EnumToken["NestingSelectorTokenType"] = 80] = "NestingSelectorTokenType";
362
+ /**
363
+ * invalid rule token type
364
+ */
120
365
  EnumToken[EnumToken["InvalidRuleTokenType"] = 81] = "InvalidRuleTokenType";
366
+ /**
367
+ * invalid class selector token type
368
+ */
121
369
  EnumToken[EnumToken["InvalidClassSelectorTokenType"] = 82] = "InvalidClassSelectorTokenType";
370
+ /**
371
+ * invalid attribute token type
372
+ */
122
373
  EnumToken[EnumToken["InvalidAttrTokenType"] = 83] = "InvalidAttrTokenType";
374
+ /**
375
+ * invalid at rule token type
376
+ */
123
377
  EnumToken[EnumToken["InvalidAtRuleTokenType"] = 84] = "InvalidAtRuleTokenType";
378
+ /**
379
+ * media query condition token type
380
+ */
124
381
  EnumToken[EnumToken["MediaQueryConditionTokenType"] = 85] = "MediaQueryConditionTokenType";
382
+ /**
383
+ * media feature token type
384
+ */
125
385
  EnumToken[EnumToken["MediaFeatureTokenType"] = 86] = "MediaFeatureTokenType";
386
+ /**
387
+ * media feature only token type
388
+ */
126
389
  EnumToken[EnumToken["MediaFeatureOnlyTokenType"] = 87] = "MediaFeatureOnlyTokenType";
390
+ /**
391
+ * media feature not token type
392
+ */
127
393
  EnumToken[EnumToken["MediaFeatureNotTokenType"] = 88] = "MediaFeatureNotTokenType";
394
+ /**
395
+ * media feature and token type
396
+ */
128
397
  EnumToken[EnumToken["MediaFeatureAndTokenType"] = 89] = "MediaFeatureAndTokenType";
398
+ /**
399
+ * media feature or token type
400
+ */
129
401
  EnumToken[EnumToken["MediaFeatureOrTokenType"] = 90] = "MediaFeatureOrTokenType";
402
+ /**
403
+ * pseudo page token type
404
+ */
130
405
  EnumToken[EnumToken["PseudoPageTokenType"] = 91] = "PseudoPageTokenType";
406
+ /**
407
+ * pseudo element token type
408
+ */
131
409
  EnumToken[EnumToken["PseudoElementTokenType"] = 92] = "PseudoElementTokenType";
410
+ /**
411
+ * keyframe at rule node type
412
+ */
132
413
  EnumToken[EnumToken["KeyframeAtRuleNodeType"] = 93] = "KeyframeAtRuleNodeType";
414
+ /**
415
+ * invalid declaration node type
416
+ */
133
417
  EnumToken[EnumToken["InvalidDeclarationNodeType"] = 94] = "InvalidDeclarationNodeType";
134
418
  /* aliases */
419
+ /**
420
+ * alias for time token type
421
+ */
135
422
  EnumToken[EnumToken["Time"] = 25] = "Time";
423
+ /**
424
+ * alias for identifier token type
425
+ */
136
426
  EnumToken[EnumToken["Iden"] = 7] = "Iden";
427
+ /**
428
+ * alias for end of file token type
429
+ */
137
430
  EnumToken[EnumToken["EOF"] = 48] = "EOF";
431
+ /**
432
+ * alias for hash token type
433
+ */
138
434
  EnumToken[EnumToken["Hash"] = 28] = "Hash";
435
+ /**
436
+ * alias for flex token type
437
+ */
139
438
  EnumToken[EnumToken["Flex"] = 58] = "Flex";
439
+ /**
440
+ * alias for angle token type
441
+ */
140
442
  EnumToken[EnumToken["Angle"] = 24] = "Angle";
443
+ /**
444
+ * alias for color token type
445
+ */
141
446
  EnumToken[EnumToken["Color"] = 50] = "Color";
447
+ /**
448
+ * alias for comma token type
449
+ */
142
450
  EnumToken[EnumToken["Comma"] = 9] = "Comma";
451
+ /**
452
+ * alias for string token type
453
+ */
143
454
  EnumToken[EnumToken["String"] = 20] = "String";
455
+ /**
456
+ * alias for length token type
457
+ */
144
458
  EnumToken[EnumToken["Length"] = 23] = "Length";
459
+ /**
460
+ * alias for number token type
461
+ */
145
462
  EnumToken[EnumToken["Number"] = 12] = "Number";
463
+ /**
464
+ * alias for percentage token type
465
+ */
146
466
  EnumToken[EnumToken["Perc"] = 14] = "Perc";
467
+ /**
468
+ * alias for literal token type
469
+ */
147
470
  EnumToken[EnumToken["Literal"] = 6] = "Literal";
471
+ /**
472
+ * alias for comment token type
473
+ */
148
474
  EnumToken[EnumToken["Comment"] = 0] = "Comment";
475
+ /**
476
+ * alias for url function token type
477
+ */
149
478
  EnumToken[EnumToken["UrlFunc"] = 18] = "UrlFunc";
479
+ /**
480
+ * alias for dimension token type
481
+ */
150
482
  EnumToken[EnumToken["Dimension"] = 22] = "Dimension";
483
+ /**
484
+ * alias for frequency token type
485
+ */
151
486
  EnumToken[EnumToken["Frequency"] = 26] = "Frequency";
487
+ /**
488
+ * alias for resolution token type
489
+ */
152
490
  EnumToken[EnumToken["Resolution"] = 27] = "Resolution";
491
+ /**
492
+ * alias for whitespace token type
493
+ */
153
494
  EnumToken[EnumToken["Whitespace"] = 36] = "Whitespace";
495
+ /**
496
+ * alias for identifier list token type
497
+ */
154
498
  EnumToken[EnumToken["IdenList"] = 71] = "IdenList";
499
+ /**
500
+ * alias for dashed identifier token type
501
+ */
155
502
  EnumToken[EnumToken["DashedIden"] = 8] = "DashedIden";
503
+ /**
504
+ * alias for grid template function token type
505
+ */
156
506
  EnumToken[EnumToken["GridTemplateFunc"] = 72] = "GridTemplateFunc";
507
+ /**
508
+ * alias for image function token type
509
+ */
157
510
  EnumToken[EnumToken["ImageFunc"] = 19] = "ImageFunc";
511
+ /**
512
+ * alias for comment node type
513
+ */
158
514
  EnumToken[EnumToken["CommentNodeType"] = 0] = "CommentNodeType";
515
+ /**
516
+ * alias for cdata section node type
517
+ */
159
518
  EnumToken[EnumToken["CDOCOMMNodeType"] = 1] = "CDOCOMMNodeType";
519
+ /**
520
+ * alias for timing function token type
521
+ */
160
522
  EnumToken[EnumToken["TimingFunction"] = 17] = "TimingFunction";
523
+ /**
524
+ * alias for timeline function token type
525
+ */
161
526
  EnumToken[EnumToken["TimelineFunction"] = 16] = "TimelineFunction";
162
527
  })(EnumToken || (EnumToken = {}));
163
528
  /**
164
- * color types enum
529
+ * supported color types enum
165
530
  */
166
531
  var ColorType;
167
532
  (function (ColorType) {
@@ -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
  /**
@@ -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)) {
@@ -7,6 +7,7 @@ import '../../ast/walk.js';
7
7
  import { parseString } from '../parse.js';
8
8
  import '../tokenize.js';
9
9
  import { renderToken } from '../../renderer/render.js';
10
+ import '../../renderer/sourcemap/lib/encode.js';
10
11
  import '../../syntax/color/utils/constants.js';
11
12
  import { PropertySet } from './set.js';
12
13