@tbela99/css-parser 0.5.2 → 0.5.4
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/dist/index-umd-web.js +14 -7
- package/dist/index.cjs +14 -7
- package/dist/lib/ast/expand.js +13 -6
- package/dist/lib/renderer/color/rec2020.js +1 -1
- package/package.json +1 -1
package/dist/index-umd-web.js
CHANGED
|
@@ -1481,7 +1481,7 @@
|
|
|
1481
1481
|
return val / 4.5;
|
|
1482
1482
|
}
|
|
1483
1483
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
1484
|
-
}).concat(
|
|
1484
|
+
}).concat([] );
|
|
1485
1485
|
}
|
|
1486
1486
|
function lrec20202rec2020(r, g, b, a) {
|
|
1487
1487
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|
|
@@ -7201,11 +7201,17 @@
|
|
|
7201
7201
|
const rule = ast.chi[i];
|
|
7202
7202
|
if (!rule.sel.includes('&')) {
|
|
7203
7203
|
const selRule = splitRule(rule.sel);
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7204
|
+
if (selRule.length > 1) {
|
|
7205
|
+
const r = ':is(' + selRule.map(a => a.join('')).join(',') + ')';
|
|
7206
|
+
rule.sel = splitRule(ast.sel).reduce((a, b) => a.concat([b.join('') + r]), []).join(',');
|
|
7207
|
+
}
|
|
7208
|
+
else {
|
|
7209
|
+
selRule.forEach(arr => combinators.includes(arr[0].charAt(0)) ? arr.unshift(ast.sel) : arr.unshift(ast.sel, ' '));
|
|
7210
|
+
rule.sel = selRule.reduce((acc, curr) => {
|
|
7211
|
+
acc.push(curr.join(''));
|
|
7212
|
+
return acc;
|
|
7213
|
+
}, []).join(',');
|
|
7214
|
+
}
|
|
7209
7215
|
}
|
|
7210
7216
|
else {
|
|
7211
7217
|
rule.sel = replaceCompound(rule.sel, ast.sel);
|
|
@@ -7264,7 +7270,8 @@
|
|
|
7264
7270
|
for (const t of walkValues(tokens)) {
|
|
7265
7271
|
if (t.value.typ == exports.EnumToken.LiteralTokenType) {
|
|
7266
7272
|
if (t.value.val == '&') {
|
|
7267
|
-
|
|
7273
|
+
const rule = splitRule(replace);
|
|
7274
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
7268
7275
|
}
|
|
7269
7276
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
7270
7277
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
package/dist/index.cjs
CHANGED
|
@@ -1479,7 +1479,7 @@ function rec20202lrec2020(r, g, b, a) {
|
|
|
1479
1479
|
return val / 4.5;
|
|
1480
1480
|
}
|
|
1481
1481
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
1482
|
-
}).concat(
|
|
1482
|
+
}).concat([] );
|
|
1483
1483
|
}
|
|
1484
1484
|
function lrec20202rec2020(r, g, b, a) {
|
|
1485
1485
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|
|
@@ -7199,11 +7199,17 @@ function expandRule(node) {
|
|
|
7199
7199
|
const rule = ast.chi[i];
|
|
7200
7200
|
if (!rule.sel.includes('&')) {
|
|
7201
7201
|
const selRule = splitRule(rule.sel);
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7202
|
+
if (selRule.length > 1) {
|
|
7203
|
+
const r = ':is(' + selRule.map(a => a.join('')).join(',') + ')';
|
|
7204
|
+
rule.sel = splitRule(ast.sel).reduce((a, b) => a.concat([b.join('') + r]), []).join(',');
|
|
7205
|
+
}
|
|
7206
|
+
else {
|
|
7207
|
+
selRule.forEach(arr => combinators.includes(arr[0].charAt(0)) ? arr.unshift(ast.sel) : arr.unshift(ast.sel, ' '));
|
|
7208
|
+
rule.sel = selRule.reduce((acc, curr) => {
|
|
7209
|
+
acc.push(curr.join(''));
|
|
7210
|
+
return acc;
|
|
7211
|
+
}, []).join(',');
|
|
7212
|
+
}
|
|
7207
7213
|
}
|
|
7208
7214
|
else {
|
|
7209
7215
|
rule.sel = replaceCompound(rule.sel, ast.sel);
|
|
@@ -7262,7 +7268,8 @@ function replaceCompound(input, replace) {
|
|
|
7262
7268
|
for (const t of walkValues(tokens)) {
|
|
7263
7269
|
if (t.value.typ == exports.EnumToken.LiteralTokenType) {
|
|
7264
7270
|
if (t.value.val == '&') {
|
|
7265
|
-
|
|
7271
|
+
const rule = splitRule(replace);
|
|
7272
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
7266
7273
|
}
|
|
7267
7274
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
7268
7275
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
package/dist/lib/ast/expand.js
CHANGED
|
@@ -58,11 +58,17 @@ function expandRule(node) {
|
|
|
58
58
|
const rule = ast.chi[i];
|
|
59
59
|
if (!rule.sel.includes('&')) {
|
|
60
60
|
const selRule = splitRule(rule.sel);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (selRule.length > 1) {
|
|
62
|
+
const r = ':is(' + selRule.map(a => a.join('')).join(',') + ')';
|
|
63
|
+
rule.sel = splitRule(ast.sel).reduce((a, b) => a.concat([b.join('') + r]), []).join(',');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
selRule.forEach(arr => combinators.includes(arr[0].charAt(0)) ? arr.unshift(ast.sel) : arr.unshift(ast.sel, ' '));
|
|
67
|
+
rule.sel = selRule.reduce((acc, curr) => {
|
|
68
|
+
acc.push(curr.join(''));
|
|
69
|
+
return acc;
|
|
70
|
+
}, []).join(',');
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
else {
|
|
68
74
|
rule.sel = replaceCompound(rule.sel, ast.sel);
|
|
@@ -121,7 +127,8 @@ function replaceCompound(input, replace) {
|
|
|
121
127
|
for (const t of walkValues(tokens)) {
|
|
122
128
|
if (t.value.typ == EnumToken.LiteralTokenType) {
|
|
123
129
|
if (t.value.val == '&') {
|
|
124
|
-
|
|
130
|
+
const rule = splitRule(replace);
|
|
131
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
125
132
|
}
|
|
126
133
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
127
134
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
|
@@ -28,7 +28,7 @@ function rec20202lrec2020(r, g, b, a) {
|
|
|
28
28
|
return val / 4.5;
|
|
29
29
|
}
|
|
30
30
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
31
|
-
}).concat(
|
|
31
|
+
}).concat([] );
|
|
32
32
|
}
|
|
33
33
|
function lrec20202rec2020(r, g, b, a) {
|
|
34
34
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|