@tbela99/css-parser 1.6.1 → 1.6.3
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 +119 -2
- package/README.md +1 -0
- package/dist/index-umd-web.js +1214 -247
- package/dist/index.cjs +1214 -247
- package/dist/index.d.ts +71 -6
- package/dist/lib/ast/features/prefix.js +9 -1
- package/dist/lib/ast/features/shorthand.js +1 -1
- package/dist/lib/ast/math/expression.js +156 -1
- package/dist/lib/ast/transform/compute.js +4 -8
- package/dist/lib/ast/types.js +12 -0
- package/dist/lib/parser/declaration/list.js +8 -10
- package/dist/lib/parser/parse.js +2 -9
- package/dist/lib/parser/tokenize.js +50 -18
- package/dist/lib/parser/utils/at-rule-font-feature-values.js +1 -1
- package/dist/lib/parser/utils/at-rule-media.js +66 -0
- package/dist/lib/parser/utils/at-rule-when-else.js +2 -2
- package/dist/lib/parser/utils/base64.js +14 -0
- package/dist/lib/parser/utils/declaration.js +7 -14
- package/dist/lib/parser/utils/eq.js +6 -0
- package/dist/lib/parser/utils/hash.js +1 -0
- package/dist/lib/parser/utils/selector.js +1 -1
- package/dist/lib/parser/utils/text.js +16 -0
- package/dist/lib/renderer/render.js +18 -4
- package/dist/lib/renderer/sourcemap/lib/codec.js +5 -0
- package/dist/lib/renderer/sourcemap/sourcemap.js +35 -5
- package/dist/lib/syntax/color/alpha.js +57 -22
- package/dist/lib/syntax/color/color-mix.js +18 -18
- package/dist/lib/syntax/color/srgb.js +10 -5
- package/dist/lib/syntax/color/utils/components.js +1 -1
- package/dist/lib/syntax/color/utils/distance.js +2 -2
- package/dist/lib/syntax/color/utils/matrix.js +1 -0
- package/dist/lib/syntax/color/xyz.js +5 -0
- package/dist/lib/syntax/color/xyzd50.js +17 -0
- package/dist/lib/syntax/syntax.js +549 -13
- package/dist/lib/validation/config.js +26 -0
- package/dist/lib/validation/match.js +16 -4
- package/dist/node.js +8 -14
- package/dist/web.js +8 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,125 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v1.6.3
|
|
4
|
+
|
|
5
|
+
## Fix
|
|
6
|
+
- [x] fix infinity rendering as 1/0 instead of 0/0 (NaN)
|
|
7
|
+
|
|
8
|
+
```css
|
|
9
|
+
|
|
10
|
+
@media (min-width: 300px) and (max-width: 768px){
|
|
11
|
+
.s {
|
|
12
|
+
|
|
13
|
+
margin-left: calc(infinity + 1 + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
14
|
+
margin-right: calc(infinity + 1px + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
is parsed as
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
@media (300px<=width<=768px) {
|
|
23
|
+
.s {
|
|
24
|
+
margin-left: calc(1/0);
|
|
25
|
+
margin-right: calc(1/0 + 1px)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
# v1.6.2
|
|
31
|
+
|
|
32
|
+
## Fix
|
|
33
|
+
- [x] fix base64 encoding error when inline sourcemap is enabled
|
|
34
|
+
|
|
35
|
+
## Improvements
|
|
36
|
+
- [x] handle division by zero in calc()
|
|
37
|
+
- [x] strip escaped new line from string
|
|
38
|
+
- [x] range media query : parse more expression as range query
|
|
39
|
+
- [x] handle NaN and Infinity in computation
|
|
40
|
+
- [x] parse \<url-modifiers\>
|
|
41
|
+
|
|
42
|
+
strip escaped new line from string
|
|
43
|
+
```css
|
|
44
|
+
a[title="a not s\
|
|
45
|
+
o very long title"] {
|
|
46
|
+
|
|
47
|
+
color: blue;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
is escaped as
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
a[title="a not so very long title"] {
|
|
54
|
+
color: blue
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
parsing range query is improved
|
|
58
|
+
|
|
59
|
+
```css
|
|
60
|
+
|
|
61
|
+
@media (min-resolution: 2dppx) {}
|
|
62
|
+
```
|
|
63
|
+
is parsed as
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
@media (resolution>=2x) {}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
NaN and Infinity are now handled in calc().
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
|
|
73
|
+
@media (min-width: 300px) and (max-width: 768px){
|
|
74
|
+
.s {
|
|
75
|
+
|
|
76
|
+
top: calc(NaN * 1px);
|
|
77
|
+
line-height: calc(NaN * 1);
|
|
78
|
+
color: alpha(from red/calc(0/0));
|
|
79
|
+
background: alpha(from red/calc(pi/0));
|
|
80
|
+
height: calc(1px * (NaN + 1));
|
|
81
|
+
width: calc(NaN + 1 + calc(NaN - 1 + calc(NaN / 1 + calc(NaN * 1))));
|
|
82
|
+
margin-left: calc(infinity + 1 + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
83
|
+
margin-right: calc(infinity + 1px + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
is parsed as
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
@media (300px<=width<=768px) {
|
|
92
|
+
.s {
|
|
93
|
+
top: calc(NaN*1px);
|
|
94
|
+
line-height: calc(NaN);
|
|
95
|
+
color: alpha(from red/calc(NaN));
|
|
96
|
+
background: alpha(from red/calc(1/0));
|
|
97
|
+
height: calc(1px*NaN);
|
|
98
|
+
width: calc(NaN);
|
|
99
|
+
margin-left: calc(0/0);
|
|
100
|
+
margin-right: calc(0/0 + 1px)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
Parsing url() \<url-modifiers\> is supported.
|
|
105
|
+
|
|
106
|
+
```css
|
|
107
|
+
|
|
108
|
+
.s {
|
|
109
|
+
background: url("star.gif" crossorigin(anonymous));
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
is parsed as
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
.s {
|
|
116
|
+
background: url(star.gif crossorigin(anonymous))
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
3
120
|
# v1.6.1
|
|
4
121
|
|
|
122
|
+
## Fixes
|
|
5
123
|
- [x] fix bugs when computing math functions.
|
|
6
124
|
- [x] reduce array mutations
|
|
7
125
|
- [x] supporting additional shorthands: scroll-timeline, scroll-padding, scroll-margin.
|
|
@@ -28,9 +146,8 @@ a:hover {
|
|
|
28
146
|
|
|
29
147
|
# v1.6.0
|
|
30
148
|
|
|
31
|
-
- [x] added support for math function `tan()`.
|
|
32
|
-
|
|
33
149
|
## Improvements
|
|
150
|
+
- [x] added support for math function `tan()`.
|
|
34
151
|
- [x] faster tokenizer
|
|
35
152
|
- [x] ensure transform: rotate(360deg) is not minified to transform: none
|
|
36
153
|
- [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
|
|