@tbela99/css-parser 1.6.7 → 1.6.8

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +60 -4
  2. package/dist/index-umd-web.js +126 -49
  3. package/dist/index.cjs +119 -49
  4. package/dist/index.d.ts +51 -3
  5. package/dist/package.json.js +10 -0
  6. package/dist/{data → src/data}/properties.json.js +7 -0
  7. package/dist/{data → src/data}/validation.json.js +7 -0
  8. package/dist/{lib → src/lib}/ast/clone.js +7 -0
  9. package/dist/{lib → src/lib}/ast/expand.js +7 -0
  10. package/dist/{lib → src/lib}/ast/features/calc.js +7 -0
  11. package/dist/{lib → src/lib}/ast/features/if.js +7 -0
  12. package/dist/{lib → src/lib}/ast/features/index.js +7 -0
  13. package/dist/{lib → src/lib}/ast/features/inlinecssvariables.js +7 -0
  14. package/dist/{lib → src/lib}/ast/features/prefix.js +7 -0
  15. package/dist/{lib → src/lib}/ast/features/shorthand.js +7 -0
  16. package/dist/{lib → src/lib}/ast/features/transform.js +7 -0
  17. package/dist/{lib → src/lib}/ast/features/type.js +7 -0
  18. package/dist/{lib → src/lib}/ast/find.js +7 -0
  19. package/dist/{lib → src/lib}/ast/math/expression.js +7 -0
  20. package/dist/{lib → src/lib}/ast/math/math.js +7 -0
  21. package/dist/{lib → src/lib}/ast/minify.js +7 -0
  22. package/dist/{lib → src/lib}/ast/node.js +7 -0
  23. package/dist/{lib → src/lib}/ast/transform/compute.js +7 -0
  24. package/dist/{lib → src/lib}/ast/transform/matrix.js +7 -0
  25. package/dist/{lib → src/lib}/ast/transform/minify.js +7 -0
  26. package/dist/{lib → src/lib}/ast/transform/perspective.js +7 -0
  27. package/dist/{lib → src/lib}/ast/transform/rotate.js +7 -0
  28. package/dist/{lib → src/lib}/ast/transform/scale.js +7 -0
  29. package/dist/{lib → src/lib}/ast/transform/skew.js +7 -0
  30. package/dist/{lib → src/lib}/ast/transform/translate.js +7 -0
  31. package/dist/{lib → src/lib}/ast/transform/utils.js +7 -0
  32. package/dist/{lib → src/lib}/ast/types.js +12 -1
  33. package/dist/{lib → src/lib}/ast/walk.js +7 -0
  34. package/dist/{lib → src/lib}/fs/resolve.js +7 -0
  35. package/dist/{lib → src/lib}/parser/declaration/list.js +7 -0
  36. package/dist/{lib → src/lib}/parser/declaration/map.js +7 -0
  37. package/dist/{lib → src/lib}/parser/declaration/set.js +7 -0
  38. package/dist/{lib → src/lib}/parser/linesmap.js +7 -0
  39. package/dist/{lib → src/lib}/parser/parse.js +61 -21
  40. package/dist/{lib → src/lib}/parser/source.js +7 -0
  41. package/dist/{lib → src/lib}/parser/tokenize.js +24 -3
  42. package/dist/{lib → src/lib}/parser/utils/angle.js +7 -0
  43. package/dist/{lib → src/lib}/parser/utils/at-rule-container.js +7 -0
  44. package/dist/{lib → src/lib}/parser/utils/at-rule-font-feature-values.js +7 -0
  45. package/dist/{lib → src/lib}/parser/utils/at-rule-generic.js +7 -0
  46. package/dist/{lib → src/lib}/parser/utils/at-rule-import.js +7 -0
  47. package/dist/{lib → src/lib}/parser/utils/at-rule-media.js +7 -0
  48. package/dist/{lib → src/lib}/parser/utils/at-rule-support.js +7 -0
  49. package/dist/{lib → src/lib}/parser/utils/at-rule-when-else.js +7 -0
  50. package/dist/{lib → src/lib}/parser/utils/at-rule.js +7 -0
  51. package/dist/{lib → src/lib}/parser/utils/base64.js +7 -0
  52. package/dist/{lib → src/lib}/parser/utils/cache.js +7 -0
  53. package/dist/{lib → src/lib}/parser/utils/config.js +7 -0
  54. package/dist/{lib → src/lib}/parser/utils/declaration.js +7 -0
  55. package/dist/{lib → src/lib}/parser/utils/eq.js +7 -0
  56. package/dist/{lib → src/lib}/parser/utils/hash.js +7 -0
  57. package/dist/{lib → src/lib}/parser/utils/selector.js +7 -0
  58. package/dist/{lib → src/lib}/parser/utils/text.js +7 -0
  59. package/dist/{lib → src/lib}/parser/utils/token.js +15 -4
  60. package/dist/{lib → src/lib}/parser/utils/type.js +7 -0
  61. package/dist/{lib → src/lib}/printer/render.js +9 -1
  62. package/dist/{lib → src/lib}/printer/sourcemap/lib/codec.js +7 -0
  63. package/dist/{lib → src/lib}/printer/sourcemap/sourcemap.js +7 -0
  64. package/dist/{lib → src/lib}/syntax/color/a98rgb.js +7 -0
  65. package/dist/{lib → src/lib}/syntax/color/alpha.js +7 -0
  66. package/dist/{lib → src/lib}/syntax/color/cmyk.js +7 -0
  67. package/dist/{lib → src/lib}/syntax/color/color-mix.js +7 -0
  68. package/dist/{lib → src/lib}/syntax/color/color.js +7 -0
  69. package/dist/{lib → src/lib}/syntax/color/hex.js +7 -0
  70. package/dist/{lib → src/lib}/syntax/color/hsl.js +7 -0
  71. package/dist/{lib → src/lib}/syntax/color/hwb.js +7 -0
  72. package/dist/{lib → src/lib}/syntax/color/lab.js +7 -0
  73. package/dist/{lib → src/lib}/syntax/color/lch.js +7 -0
  74. package/dist/{lib → src/lib}/syntax/color/oklab.js +7 -0
  75. package/dist/{lib → src/lib}/syntax/color/oklch.js +7 -0
  76. package/dist/{lib → src/lib}/syntax/color/p3.js +7 -0
  77. package/dist/{lib → src/lib}/syntax/color/prophotorgb.js +7 -0
  78. package/dist/{lib → src/lib}/syntax/color/rec2020.js +7 -0
  79. package/dist/{lib → src/lib}/syntax/color/relative-color.js +7 -0
  80. package/dist/{lib → src/lib}/syntax/color/rgb.js +7 -0
  81. package/dist/{lib → src/lib}/syntax/color/srgb.js +7 -0
  82. package/dist/{lib → src/lib}/syntax/color/utils/color-type.js +7 -0
  83. package/dist/{lib → src/lib}/syntax/color/utils/colorspace.js +7 -0
  84. package/dist/{lib → src/lib}/syntax/color/utils/components.js +7 -0
  85. package/dist/{lib → src/lib}/syntax/color/utils/distance.js +7 -0
  86. package/dist/{lib → src/lib}/syntax/color/utils/make-color.js +7 -0
  87. package/dist/{lib → src/lib}/syntax/color/utils/matrix.js +7 -0
  88. package/dist/{lib → src/lib}/syntax/color/xyz.js +7 -0
  89. package/dist/{lib → src/lib}/syntax/color/xyzd50.js +7 -0
  90. package/dist/{lib → src/lib}/syntax/constants.js +7 -0
  91. package/dist/{lib → src/lib}/syntax/syntax.js +7 -0
  92. package/dist/{lib → src/lib}/validation/config.js +7 -0
  93. package/dist/{lib → src/lib}/validation/match.js +37 -19
  94. package/dist/{lib → src/lib}/validation/parser/parse.js +7 -0
  95. package/dist/{lib → src/lib}/validation/parser/typedef.js +7 -0
  96. package/dist/{lib → src/lib}/validation/utils/list.js +7 -0
  97. package/dist/{node.js → src/node.js} +8 -0
  98. package/dist/{types.js → src/types.js} +7 -0
  99. package/dist/{utils → src/utils}/sync.js +7 -0
  100. package/dist/{web.js → src/web.js} +8 -0
  101. package/package.json +4 -3
  102. package/dist/lib/syntax/color/hsv.js +0 -6
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  * feature walk mode
3
10
  *
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from './types.js';
2
9
  import { walk, walkValues } from './walk.js';
3
10
  import { TOKENS } from '../syntax/constants.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { equalsIgnoreCase } from '../../parser/utils/text.js';
2
9
  import { mathFuncs, PARENT, LOCEND, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
3
10
  import { EnumToken } from '../types.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { minifyNumber } from '../../syntax/syntax.js';
2
9
  import { EnumToken } from '../types.js';
3
10
 
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { eq } from '../parser/utils/eq.js';
2
9
  import { renderValue, doRender } from '../printer/render.js';
3
10
  import * as index from './features/index.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { TOKENS, ERRORS, STATE, LOCSRCID, LOCSTA, LOCEND, PARENT } from '../syntax/constants.js';
2
9
 
3
10
  /**
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply, toZero } from './utils.js';
2
9
  import { EnumToken } from '../types.js';
3
10
  import { stripCommaToken } from '../../validation/utils/list.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, is2DMatrix } from './utils.js';
2
9
  import { EnumToken } from '../types.js';
3
10
  import { eq } from '../../parser/utils/eq.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply, decompose, round, toZero } from './utils.js';
2
9
  import { epsilon } from '../../syntax/constants.js';
3
10
  import { EnumToken } from '../types.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply } from './utils.js';
2
9
 
3
10
  function perspective(x, from) {
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply } from './utils.js';
2
9
 
3
10
  /**
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply } from './utils.js';
2
9
 
3
10
  function scaleX(x, from) {
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply } from './utils.js';
2
9
 
3
10
  function skewX(x, from) {
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { identity, multiply } from './utils.js';
2
9
 
3
10
  function translateX(x, from) {
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { epsilon } from '../../syntax/constants.js';
2
9
 
3
10
  const identityMatrix = new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  * Syntax validation enum
3
10
  */
@@ -541,7 +548,7 @@ var EnumToken;
541
548
  /**
542
549
  * '|'
543
550
  */
544
- EnumToken[EnumToken["Pipe"] = 109] = "Pipe";
551
+ EnumToken[EnumToken["PipeTokenType"] = 109] = "PipeTokenType";
545
552
  /**
546
553
  * '::'
547
554
  */
@@ -680,6 +687,10 @@ var EnumToken;
680
687
  * negative infinity token
681
688
  */
682
689
  EnumToken[EnumToken["NegativeInfinityTokenType"] = 143] = "NegativeInfinityTokenType";
690
+ /**
691
+ * CSS type token
692
+ */
693
+ EnumToken[EnumToken["CssTypeTokenType"] = 144] = "CssTypeTokenType";
683
694
  /* aliases */
684
695
  /**
685
696
  * alias for time token type
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { PARENT, TOKENS } from '../syntax/constants.js';
2
9
 
3
10
  /**
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { memoize } from '../parser/utils/cache.js';
2
9
 
3
10
  /**
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { PropertySet } from './set.js';
2
9
  import { getConfig } from '../utils/config.js';
3
10
  import { PropertyMap } from './map.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { eq } from '../utils/eq.js';
2
9
  import { getConfig } from '../utils/config.js';
3
10
  import { matchType } from '../utils/type.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { eq } from '../utils/eq.js';
2
9
  import { EnumToken } from '../../ast/types.js';
3
10
  import { isLength } from '../../syntax/syntax.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  * Compute line and column of the offset
3
10
  */
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { isIdentColor, parseColor, isColor } from '../syntax/syntax.js';
2
9
  import { camelize, equalsIgnoreCase, dasherize } from './utils/text.js';
3
10
  import { renderValue } from '../printer/render.js';
@@ -304,6 +311,9 @@ function parseVisitors(visitorsDef, errors) {
304
311
  let key;
305
312
  let value;
306
313
  let i;
314
+ const allVisitorsHandlers = new Set();
315
+ const preAllVisitorsHandlers = new Set();
316
+ const postAllVisitorsHandlers = new Set();
307
317
  const valuesHandlers = new Map();
308
318
  const preValuesHandlers = new Map();
309
319
  const postValuesHandlers = new Map();
@@ -404,6 +414,21 @@ function parseVisitors(visitorsDef, errors) {
404
414
  errors.push({ action: "ignore", message: `doParse: visitor.${key} is not a valid key name` });
405
415
  }
406
416
  }
417
+ else if (key == "All" || key == "visitor") {
418
+ if (typeof value == "function") {
419
+ allVisitorsHandlers.add(value);
420
+ }
421
+ else if (typeof value == "object") {
422
+ if ("type" in value && "handler" in value && value.type in WalkerEvent) {
423
+ if (value.type == WalkerEvent.Enter) {
424
+ preAllVisitorsHandlers.add(value.handler);
425
+ }
426
+ else if (value.type == WalkerEvent.Leave) {
427
+ postAllVisitorsHandlers.add(value.handler);
428
+ }
429
+ }
430
+ }
431
+ }
407
432
  else {
408
433
  errors.push({ action: "ignore", message: `doParse: visitor.${key} is not a valid key name` });
409
434
  }
@@ -427,10 +452,25 @@ function parseVisitors(visitorsDef, errors) {
427
452
  if (postValuesHandlers.size > 0) {
428
453
  allHandlers.push(postValuesHandlers);
429
454
  }
430
- return {
455
+ const result = {
431
456
  allHandlers,
432
- includeTokens: preValuesHandlers.size > 0 || valuesHandlers.size > 0 || postValuesHandlers.size > 0,
457
+ includeTokens: preValuesHandlers.size > 0 ||
458
+ valuesHandlers.size > 0 ||
459
+ postValuesHandlers.size > 0 ||
460
+ allVisitorsHandlers.size > 0 ||
461
+ preAllVisitorsHandlers.size > 0 ||
462
+ postAllVisitorsHandlers.size > 0,
433
463
  };
464
+ if (allVisitorsHandlers.size > 0) {
465
+ result.allVisitorsHandlers = allVisitorsHandlers;
466
+ }
467
+ if (preAllVisitorsHandlers.size > 0) {
468
+ result.preAllVisitorsHandlers = preAllVisitorsHandlers;
469
+ }
470
+ if (postAllVisitorsHandlers.size > 0) {
471
+ result.postAllVisitorsHandlers = postAllVisitorsHandlers;
472
+ }
473
+ return result;
434
474
  }
435
475
  /**
436
476
  * Parse css string
@@ -503,12 +543,10 @@ function doParseSync(tokenizer, options = {}) {
503
543
  // @ts-ignore ignore error
504
544
  let parensMatch = 0;
505
545
  let curlyBracketMatch = 0;
506
- // let currentItemIndex: number;
507
546
  ast[LOCSRCID] = options.source.id;
508
547
  ast[LOCSTA] = 0;
509
548
  while (!tokenizer.done()) {
510
549
  tokenizer.next();
511
- // item = (iter as Array<TokenizeResult>)[currentItemIndex];
512
550
  if (tokenizer.unit != null) {
513
551
  item = {
514
552
  typ: tokenizer.typ,
@@ -654,7 +692,6 @@ function doParseSync(tokenizer, options = {}) {
654
692
  parensMatch = 0;
655
693
  curlyBracketMatch = 0;
656
694
  }
657
- // }
658
695
  }
659
696
  if (tokens.length > 0) {
660
697
  node = parseNode(tokens, context, options, errors, stats, invalidNodes);
@@ -724,6 +761,9 @@ function doParseSync(tokenizer, options = {}) {
724
761
  }
725
762
  parens = null;
726
763
  handlers.length = 0;
764
+ if (visitors.preAllVisitorsHandlers?.size > 0) {
765
+ handlers.push(...visitors.preAllVisitorsHandlers);
766
+ }
727
767
  genericKey =
728
768
  nodes[i].typ == EnumToken.DeclarationNodeType
729
769
  ? "Declaration"
@@ -743,6 +783,9 @@ function doParseSync(tokenizer, options = {}) {
743
783
  : nodes[i].typ == EnumToken.KeyframesAtRuleNodeType
744
784
  ? camelize(nodes[i].val)
745
785
  : null;
786
+ if (visitors.allVisitorsHandlers?.size > 0) {
787
+ handlers.push(...visitors.allVisitorsHandlers);
788
+ }
746
789
  for (const map of visitors.allHandlers) {
747
790
  // @ts-ignore
748
791
  if (genericKey != null && map.has(genericKey)) {
@@ -751,20 +794,6 @@ function doParseSync(tokenizer, options = {}) {
751
794
  if (typeof handler == "function") {
752
795
  handlers.push(handler);
753
796
  }
754
- // else if (Array.isArray(handler)) {
755
- // for (const h of handler) {
756
- // if (typeof h == "function") {
757
- // handlers.push(h);
758
- // }
759
- // // @ts-ignore
760
- // else if (h[keyName] != null) {
761
- // // @ts-ignore
762
- // handlers.push(h[keyName]);
763
- // }
764
- // }
765
- // } else if (typeof handler.handler! == "function") {
766
- // handlers.push(handler.handler);
767
- // }
768
797
  // @ts-ignore
769
798
  else if (typeof handler[keyName] == "function") {
770
799
  // @ts-ignore
@@ -797,6 +826,9 @@ function doParseSync(tokenizer, options = {}) {
797
826
  }
798
827
  }
799
828
  }
829
+ if (visitors.postAllVisitorsHandlers?.size > 0) {
830
+ handlers.push(...visitors.postAllVisitorsHandlers);
831
+ }
800
832
  if (handlers.length == 0) {
801
833
  continue;
802
834
  }
@@ -1716,6 +1748,9 @@ async function doParse(iter, options = {}) {
1716
1748
  }
1717
1749
  parens = null;
1718
1750
  handlers.length = 0;
1751
+ if (visitors.preAllVisitorsHandlers?.size > 0) {
1752
+ handlers.push(...visitors.preAllVisitorsHandlers);
1753
+ }
1719
1754
  genericKey =
1720
1755
  nodes[i].typ == EnumToken.DeclarationNodeType
1721
1756
  ? "Declaration"
@@ -1735,6 +1770,9 @@ async function doParse(iter, options = {}) {
1735
1770
  : nodes[i].typ == EnumToken.KeyframesAtRuleNodeType
1736
1771
  ? camelize(nodes[i].val)
1737
1772
  : null;
1773
+ if (visitors.allVisitorsHandlers?.size > 0) {
1774
+ handlers.push(...visitors.allVisitorsHandlers);
1775
+ }
1738
1776
  for (const map of visitors.allHandlers) {
1739
1777
  // @ts-ignore
1740
1778
  if (genericKey != null && map.has(genericKey)) {
@@ -1789,6 +1827,9 @@ async function doParse(iter, options = {}) {
1789
1827
  }
1790
1828
  }
1791
1829
  }
1830
+ if (visitors.postAllVisitorsHandlers?.size > 0) {
1831
+ handlers.push(...visitors.postAllVisitorsHandlers);
1832
+ }
1792
1833
  if (handlers.length == 0) {
1793
1834
  continue;
1794
1835
  }
@@ -2649,7 +2690,6 @@ function parseAtRule(stream, context, options, errors, parseAsBlock = null) {
2649
2690
  const syntax = syntaxRules?.getPreludeRules()?.slice?.(1);
2650
2691
  const blockAllowed = syntaxRules?.getBlockRules() != null;
2651
2692
  if (syntaxRules == null) {
2652
- // if (!options.lenient) {
2653
2693
  errors.push({
2654
2694
  action: "drop",
2655
2695
  node: atRule,
@@ -3366,7 +3406,7 @@ function parseAtRule(stream, context, options, errors, parseAsBlock = null) {
3366
3406
  stream[index][LOCEND] = stream[i][LOCEND];
3367
3407
  Object.assign(stream[index], {
3368
3408
  typ: tokensfuncDefMap.get(stream[index].typ),
3369
- chi: stream.splice(index + 1, i - index - 1),
3409
+ chi: trimWhiteSpaceTokens(stream.splice(index + 1, i - index - 1)),
3370
3410
  });
3371
3411
  i = index;
3372
3412
  stream.splice(index + 1, 1);
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { SourceMap } from '../printer/sourcemap/sourcemap.js';
2
9
  import { LineMap } from './linesmap.js';
3
10
 
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken, ColorType } from '../ast/types.js';
2
9
  import { wildCardFuncs, whenElseFunc, mathFuncs, timingFunc, supportFunc, timelineFunc, imageFunc, gridTemplateFunc, urlFunc, containerFunc, colorsFunc, transformFunctions, pseudoElements } from '../syntax/constants.js';
3
10
  import { isWhiteSpace, isNewLine, isDigit, isLetter, isIdentStart, isIdentCodepoint, isNonPrintable, timeUnits, angleUnits, flexUnits, dimensionUnits, resolutionUnits, frequencyUnits } from '../syntax/syntax.js';
@@ -41,7 +48,7 @@ function assignTokenMap(entries, tokenType, suffix = "", lowercase = false) {
41
48
  SymbolsMapTokens[""] = EnumToken.DelimTokenType;
42
49
  SymbolsMapTokens["+"] = EnumToken.Plus;
43
50
  SymbolsMapTokens["="] = EnumToken.DelimTokenType;
44
- SymbolsMapTokens["|"] = EnumToken.Pipe;
51
+ SymbolsMapTokens["|"] = EnumToken.PipeTokenType;
45
52
  SymbolsMapTokens["||"] = EnumToken.ColumnCombinatorTokenType;
46
53
  SymbolsMapTokens["|="] = EnumToken.DashMatchTokenType;
47
54
  SymbolsMapTokens["&"] = EnumToken.NestingSelectorTokenType;
@@ -700,7 +707,6 @@ class Tokenizer {
700
707
  if (codepoint == 92 /* TokenMap.REVERSE_SOLIDUS */) {
701
708
  // eof
702
709
  if ((codepoint = parseInfo.stream.charCodeAt(position + 1)) != codepoint) {
703
- // this.next(parseInfo, position);
704
710
  return 0;
705
711
  }
706
712
  // \n \r \f \v
@@ -1473,7 +1479,7 @@ class Tokenizer {
1473
1479
  return this.makeToken(parseInfo, EnumToken.DashMatchTokenType);
1474
1480
  }
1475
1481
  this.advance(parseInfo);
1476
- return this.makeToken(parseInfo, EnumToken.Pipe);
1482
+ return this.makeToken(parseInfo, EnumToken.PipeTokenType);
1477
1483
  case 33 /* TokenMap.EXCLAMATION */:
1478
1484
  if (parseInfo.position < parseInfo.currentPosition) {
1479
1485
  return this.makeToken(parseInfo);
@@ -1539,6 +1545,21 @@ class Tokenizer {
1539
1545
  return this.makeToken(parseInfo, EnumToken.CDOCOMMTokenType);
1540
1546
  }
1541
1547
  }
1548
+ {
1549
+ const startPosition = parseInfo.position - parseInfo.offset;
1550
+ let offset = 1;
1551
+ let charCode = parseInfo.stream.charCodeAt(startPosition + offset);
1552
+ if (isLetter(charCode)) {
1553
+ charCode = parseInfo.stream.charCodeAt(++offset + startPosition);
1554
+ while (offset < endPosition && (charCode == 45 /* TokenMap.MINUS */ || isLetter(charCode))) {
1555
+ charCode = parseInfo.stream.charCodeAt(++offset + startPosition);
1556
+ }
1557
+ if (offset > 1 && charCode == 62 /* TokenMap.GREATERTHAN */) {
1558
+ this.advance(parseInfo, offset);
1559
+ return this.makeToken(parseInfo, EnumToken.CssTypeTokenType);
1560
+ }
1561
+ }
1562
+ }
1542
1563
  break;
1543
1564
  case 35 /* TokenMap.HASH */:
1544
1565
  if (parseInfo.position < parseInfo.currentPosition) {
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  * convert angle to degrees
3
10
  * @param angle
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { tokensfuncDefMap, LOCSTA, mFGT, mFLT, LOCEND, LOCSRCID } from '../../syntax/constants.js';
3
10
  import { matchAllSyntaxes, createValidationContext, trimArray } from '../../validation/match.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { getSyntaxRule } from '../../validation/config.js';
2
9
  import { trimArray, matchAllSyntaxes, createValidationContext } from '../../validation/match.js';
3
10
  import { ValidationSyntaxGroupEnum } from '../../validation/parser/typedef.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { tokensfuncDefMap, LOCSTA } from '../../syntax/constants.js';
3
10
  import { equalsIgnoreCase } from './text.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { getSyntaxRule } from '../../validation/config.js';
3
10
  import { trimArray } from '../../validation/match.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { evaluate } from '../../ast/math/expression.js';
3
10
  import { gcd } from '../../ast/math/math.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { pseudoElements, LOCEND, tokensfuncDefMap, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
3
10
  import { getSyntaxConfig, getParsedSyntax } from '../../validation/config.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { EnumToken } from '../../ast/types.js';
2
9
  import { trimArray } from '../../validation/match.js';
3
10
  import { tokensfuncDefMap, LOCEND, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  import { ValidationSyntaxGroupEnum } from '../../validation/parser/typedef.js';
2
9
  import { getSyntaxRule } from '../../validation/config.js';
3
10
  import { trimArray, matchAllSyntaxes, createValidationContext } from '../../validation/match.js';
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  *
3
10
  * @param value
@@ -1,3 +1,10 @@
1
+ /*
2
+ CSS parser, minifier and validator for node and the browser
3
+
4
+ Author(s): Thierry Bela
5
+ Version: 1.6.8
6
+ License: MIT
7
+ */
1
8
  /**
2
9
  *
3
10
  * @param fn