@tbela99/css-parser 1.4.6 → 1.4.7

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 (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -0
  3. package/dist/index-umd-web.js +6548 -6964
  4. package/dist/index.cjs +7784 -8198
  5. package/dist/index.d.ts +919 -51
  6. package/dist/lib/ast/clone.js +16 -23
  7. package/dist/lib/ast/expand.js +2 -2
  8. package/dist/lib/ast/features/if.js +88 -87
  9. package/dist/lib/ast/features/inlinecssvariables.js +2 -2
  10. package/dist/lib/ast/features/prefix.js +26 -22
  11. package/dist/lib/ast/features/transform.js +3 -3
  12. package/dist/lib/ast/find.js +17 -14
  13. package/dist/lib/ast/minify.js +97 -94
  14. package/dist/lib/ast/types.js +6 -2
  15. package/dist/lib/ast/walk.js +1 -1
  16. package/dist/lib/fs/resolve.js +46 -44
  17. package/dist/lib/parser/declaration/list.js +9 -10
  18. package/dist/lib/parser/declaration/map.js +13 -18
  19. package/dist/lib/parser/parse.js +331 -504
  20. package/dist/lib/parser/tokenize.js +39 -33
  21. package/dist/lib/parser/utils/at-rule-container.js +244 -247
  22. package/dist/lib/parser/utils/at-rule-generic.js +25 -25
  23. package/dist/lib/parser/utils/at-rule-import.js +194 -234
  24. package/dist/lib/parser/utils/at-rule-media.js +286 -286
  25. package/dist/lib/parser/utils/at-rule-support.js +279 -251
  26. package/dist/lib/parser/utils/at-rule-when-else.js +256 -259
  27. package/dist/lib/parser/utils/at-rule.js +19 -16
  28. package/dist/lib/parser/utils/cache.js +33 -5
  29. package/dist/lib/parser/utils/declaration.js +260 -298
  30. package/dist/lib/parser/utils/hash.js +15 -15
  31. package/dist/lib/parser/utils/selector.js +182 -222
  32. package/dist/lib/parser/utils/token.js +4 -7
  33. package/dist/lib/renderer/render.js +150 -120
  34. package/dist/lib/syntax/color/alpha.js +1 -4
  35. package/dist/lib/syntax/color/color.js +5 -5
  36. package/dist/lib/syntax/color/utils/colorspace.js +3 -3
  37. package/dist/lib/syntax/color/utils/components.js +21 -22
  38. package/dist/lib/syntax/color/utils/matrix.js +12 -11
  39. package/dist/lib/syntax/constants.js +22 -3
  40. package/dist/lib/syntax/syntax.js +252 -311
  41. package/dist/lib/validation/config.js +16 -17
  42. package/dist/lib/validation/match.js +1118 -1131
  43. package/dist/lib/validation/parser/parse.js +130 -286
  44. package/dist/node.js +16 -12
  45. package/dist/web.js +10 -8
  46. package/package.json +4 -4
  47. package/dist/lib/validation/utils/whitespace.js +0 -17
@@ -1,6 +1,15 @@
1
1
  import { EnumToken } from '../ast/types.js';
2
2
  import config from '../validation/config.json.js';
3
3
 
4
+ const LOC = Symbol.for("loc");
5
+ const RAW = Symbol.for("raw");
6
+ const STATE = Symbol.for("state");
7
+ const ROOT = Symbol.for("root");
8
+ const ERRORS = Symbol.for("errors");
9
+ const TOKENS = Symbol.for("tokens");
10
+ const PARENT = Symbol.for("parent");
11
+ const OPTIMIZED = Symbol.for("optimized");
12
+ const PROPERTYNAME = Symbol.for("propertyName");
4
13
  const regMatchLinearGradient = /^-((webkit)|o|moz)(-repeating)?-linear-gradient$/i;
5
14
  const regMatchRadialGradient = /^-((webkit)|o|moz)(-repeating)?-radial-gradient$/i;
6
15
  const mFLT = new Set([EnumToken.LtTokenType, EnumToken.LteTokenType]);
@@ -70,6 +79,17 @@ const colorRange = {
70
79
  b: [0, 0.4],
71
80
  },
72
81
  };
82
+ // https://www.w3.org/TR/css-values-4/#math-function
83
+ const pseudoElements = [
84
+ ":before",
85
+ ":after",
86
+ ":first-line",
87
+ ":first-letter",
88
+ "::before",
89
+ "::after",
90
+ "::first-line",
91
+ "::first-letter",
92
+ ];
73
93
  const wildCardFuncs = ["var", "env", "if"];
74
94
  const mathFuncs = [
75
95
  "minmax",
@@ -137,7 +157,7 @@ const pageMarginBoxType = new Set([
137
157
  const urlFunc = ["url"];
138
158
  const timelineFunc = ["view", "scroll"];
139
159
  const gridTemplateFunc = ["minmax", "fit-content", "repeat"];
140
- const generalEnclosedFunc = [];
160
+ // export const generalEnclosedFunc: string[] = [];
141
161
  const supportFunc = ["selector", "font-tech", "font-format", "at-rule", "named-feature"];
142
162
  const whenElseFunc = ["media", "supports"];
143
163
  const containerFunc = ["style", "scroll-state"];
@@ -458,7 +478,6 @@ const trimTokenSpace = new Set([
458
478
  EnumToken.SupportsQueryConditionTokenType,
459
479
  EnumToken.SupportsQueryUnaryConditionTokenType,
460
480
  ]);
461
- const definedPropertySettings = { configurable: true, enumerable: false, writable: true };
462
481
  const combinators = ["+", ">", "~", "||", "|"];
463
482
 
464
- export { COLORS_NAMES, D50, NAMES_COLORS, anglePrecision, colorDistancePrecision, colorFuncColorSpace, colorPrecision, colorRange, colorsFunc, combinators, containerFunc, definedPropertySettings, deprecatedSystemColors, e, epsilon, funcLike, generalEnclosedFunc, gridTemplateFunc, imageFunc, k, mFGT, mFLT, mathFuncs, mediaTypes, nonStandardColors, pageMarginBoxType, regMatchLinearGradient, regMatchRadialGradient, supportFunc, systemColors, timelineFunc, timingFunc, tokensMap, tokensfuncDefMap, tokensfuncSet, transformFunctions, trimTokenSpace, urlFunc, urlTokenMatcher, whenElseFunc, wildCardFuncs };
483
+ export { COLORS_NAMES, D50, ERRORS, LOC, NAMES_COLORS, OPTIMIZED, PARENT, PROPERTYNAME, RAW, ROOT, STATE, TOKENS, anglePrecision, colorDistancePrecision, colorFuncColorSpace, colorPrecision, colorRange, colorsFunc, combinators, containerFunc, deprecatedSystemColors, e, epsilon, funcLike, gridTemplateFunc, imageFunc, k, mFGT, mFLT, mathFuncs, mediaTypes, nonStandardColors, pageMarginBoxType, pseudoElements, regMatchLinearGradient, regMatchRadialGradient, supportFunc, systemColors, timelineFunc, timingFunc, tokensMap, tokensfuncDefMap, tokensfuncSet, transformFunctions, trimTokenSpace, urlFunc, urlTokenMatcher, whenElseFunc, wildCardFuncs };