@tbela99/css-parser 1.6.1 → 1.6.2

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 (39) hide show
  1. package/CHANGELOG.md +92 -2
  2. package/README.md +1 -0
  3. package/dist/index-umd-web.js +1214 -247
  4. package/dist/index.cjs +1214 -247
  5. package/dist/index.d.ts +71 -6
  6. package/dist/lib/ast/features/prefix.js +9 -1
  7. package/dist/lib/ast/features/shorthand.js +1 -1
  8. package/dist/lib/ast/math/expression.js +156 -1
  9. package/dist/lib/ast/transform/compute.js +4 -8
  10. package/dist/lib/ast/types.js +12 -0
  11. package/dist/lib/parser/declaration/list.js +8 -10
  12. package/dist/lib/parser/parse.js +2 -9
  13. package/dist/lib/parser/tokenize.js +50 -18
  14. package/dist/lib/parser/utils/at-rule-font-feature-values.js +1 -1
  15. package/dist/lib/parser/utils/at-rule-media.js +66 -0
  16. package/dist/lib/parser/utils/at-rule-when-else.js +2 -2
  17. package/dist/lib/parser/utils/base64.js +14 -0
  18. package/dist/lib/parser/utils/declaration.js +7 -14
  19. package/dist/lib/parser/utils/eq.js +6 -0
  20. package/dist/lib/parser/utils/hash.js +1 -0
  21. package/dist/lib/parser/utils/selector.js +1 -1
  22. package/dist/lib/parser/utils/text.js +16 -0
  23. package/dist/lib/renderer/render.js +18 -4
  24. package/dist/lib/renderer/sourcemap/lib/codec.js +5 -0
  25. package/dist/lib/renderer/sourcemap/sourcemap.js +35 -5
  26. package/dist/lib/syntax/color/alpha.js +57 -22
  27. package/dist/lib/syntax/color/color-mix.js +18 -18
  28. package/dist/lib/syntax/color/srgb.js +10 -5
  29. package/dist/lib/syntax/color/utils/components.js +1 -1
  30. package/dist/lib/syntax/color/utils/distance.js +2 -2
  31. package/dist/lib/syntax/color/utils/matrix.js +1 -0
  32. package/dist/lib/syntax/color/xyz.js +5 -0
  33. package/dist/lib/syntax/color/xyzd50.js +17 -0
  34. package/dist/lib/syntax/syntax.js +549 -13
  35. package/dist/lib/validation/config.js +26 -0
  36. package/dist/lib/validation/match.js +16 -4
  37. package/dist/node.js +8 -14
  38. package/dist/web.js +8 -14
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,7 +1,98 @@
1
1
  # Changelog
2
2
 
3
+ # v1.6.2
4
+
5
+ ## Fix
6
+ - [x] fix base64 encoding error when inline sourcemap is enabled
7
+
8
+ ## Improvements
9
+ - [x] handle division by zero in calc()
10
+ - [x] strip escaped new line from string
11
+ - [x] range media query : parse more expression as range query
12
+ - [x] handle NaN and Infinity in computation
13
+ - [x] parse \<url-modifiers\>
14
+
15
+ strip escaped new line from string
16
+ ```css
17
+ a[title="a not s\
18
+ o very long title"] {
19
+
20
+ color: blue;
21
+ ```
22
+
23
+ is escaped as
24
+
25
+ ```css
26
+ a[title="a not so very long title"] {
27
+ color: blue
28
+ }
29
+ ```
30
+ parsing range query is improved
31
+
32
+ ```css
33
+
34
+ @media (min-resolution: 2dppx) {}
35
+ ```
36
+ is parsed as
37
+
38
+ ```css
39
+ @media (resolution>=2x) {}
40
+ ```
41
+
42
+ NaN and Infinity are now handled in calc().
43
+
44
+ ```css
45
+
46
+ @media (min-width: 300px) and (max-width: 768px){
47
+ .s {
48
+
49
+ top: calc(NaN * 1px);
50
+ line-height: calc(NaN * 1);
51
+ color: alpha(from red/calc(0/0));
52
+ background: alpha(from red/calc(pi/0));
53
+ height: calc(1px * (NaN + 1));
54
+ width: calc(NaN + 1 + calc(NaN - 1 + calc(NaN / 1 + calc(NaN * 1))));
55
+ margin-left: calc(infinity + 1 + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
56
+ margin-right: calc(infinity + 1px + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
57
+
58
+ }
59
+
60
+ ```
61
+ is parsed as
62
+
63
+ ```css
64
+ @media (300px<=width<=768px) {
65
+ .s {
66
+ top: calc(NaN*1px);
67
+ line-height: calc(NaN);
68
+ color: alpha(from red/calc(NaN));
69
+ background: alpha(from red/calc(1/0));
70
+ height: calc(1px*NaN);
71
+ width: calc(NaN);
72
+ margin-left: calc(0/0);
73
+ margin-right: calc(0/0 + 1px)
74
+ }
75
+ }
76
+ ```
77
+ Parsing url() \<url-modifiers\> is supported.
78
+
79
+ ```css
80
+
81
+ .s {
82
+ background: url("star.gif" crossorigin(anonymous));
83
+ }
84
+ ```
85
+ is parsed as
86
+
87
+ ```css
88
+ .s {
89
+ background: url(star.gif crossorigin(anonymous))
90
+ }
91
+ ```
92
+
3
93
  # v1.6.1
4
94
 
95
+ ## Fixes
5
96
  - [x] fix bugs when computing math functions.
6
97
  - [x] reduce array mutations
7
98
  - [x] supporting additional shorthands: scroll-timeline, scroll-padding, scroll-margin.
@@ -28,9 +119,8 @@ a:hover {
28
119
 
29
120
  # v1.6.0
30
121
 
31
- - [x] added support for math function `tan()`.
32
-
33
122
  ## Improvements
123
+ - [x] added support for math function `tan()`.
34
124
  - [x] faster tokenizer
35
125
  - [x] ensure transform: rotate(360deg) is not minified to transform: none
36
126
  - [x] support input sourcemap from inline sourcemap file. This is only supported by the async parser.
package/README.md CHANGED
@@ -139,6 +139,7 @@ Try it [online](https://tbela99.github.io/css-parser/playground/)
139
139
  ## Sourcemap
140
140
 
141
141
  - [x] Sourcemap generation
142
+ - [x] Input sourcemap: when the input CSS comes from another tool, you can pass the sourcemap content to link the generated CSS positions to the original files.
142
143
 
143
144
  ## Computed shorthands properties
144
145