@tbela99/css-parser 1.6.4 → 1.6.6
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 +146 -0
- package/CONTRIBUTING.md +119 -0
- package/README.md +104 -0
- package/dist/data/validation.json.js +4 -1
- package/dist/index-umd-web.js +399 -326
- package/dist/index.cjs +398 -326
- package/dist/index.d.ts +15 -2
- package/dist/lib/ast/features/calc.js +10 -5
- package/dist/lib/ast/features/if.js +1 -1
- package/dist/lib/ast/features/inlinecssvariables.js +2 -2
- package/dist/lib/ast/features/prefix.js +1 -1
- package/dist/lib/ast/features/shorthand.js +1 -4
- package/dist/lib/ast/features/transform.js +1 -1
- package/dist/lib/ast/math/expression.js +70 -36
- package/dist/lib/ast/minify.js +2 -1
- package/dist/lib/parser/declaration/list.js +20 -10
- package/dist/lib/parser/declaration/map.js +39 -26
- package/dist/lib/parser/parse.js +4 -3
- package/dist/lib/parser/tokenize.js +99 -124
- package/dist/lib/parser/utils/at-rule-container.js +70 -1
- package/dist/lib/parser/utils/at-rule-media.js +0 -2
- package/dist/lib/printer/render.js +14 -38
- package/dist/lib/syntax/color/a98rgb.js +1 -1
- package/dist/lib/syntax/color/alpha.js +19 -20
- package/dist/lib/syntax/color/color-mix.js +15 -14
- package/dist/lib/syntax/color/hex.js +4 -1
- package/dist/lib/syntax/color/relative-color.js +11 -11
- package/dist/lib/syntax/color/utils/components.js +0 -20
- package/dist/lib/syntax/constants.js +5 -0
- package/dist/lib/syntax/syntax.js +2 -2
- package/dist/lib/validation/match.js +5 -4
- package/dist/web.js +1 -0
- package/package.json +12 -11
|
@@ -42,6 +42,7 @@ function doRender(data, options = {}, mapping) {
|
|
|
42
42
|
removeEmpty: false,
|
|
43
43
|
removeComments: false,
|
|
44
44
|
}),
|
|
45
|
+
minifyValues: true,
|
|
45
46
|
sourcemap: false,
|
|
46
47
|
convertColor: true,
|
|
47
48
|
expandNestingRules: false,
|
|
@@ -281,7 +282,7 @@ function renderAstNode(data, options, sourcemaps, sourceLocation, linesMap, erro
|
|
|
281
282
|
const indentSub = indents[level + 1];
|
|
282
283
|
switch (data.typ) {
|
|
283
284
|
case EnumToken.DeclarationNodeType:
|
|
284
|
-
return `${data.nam}:${options.indent}${(options.
|
|
285
|
+
return `${data.nam}:${options.indent}${(options.minifyValues
|
|
285
286
|
? filterValues(data.val)
|
|
286
287
|
: data.val).reduce(reducer, "")}`;
|
|
287
288
|
case EnumToken.CommentNodeType:
|
|
@@ -336,7 +337,7 @@ function renderAstNode(data, options, sourcemaps, sourceLocation, linesMap, erro
|
|
|
336
337
|
: node.val;
|
|
337
338
|
}
|
|
338
339
|
else if (node.typ == EnumToken.DeclarationNodeType) {
|
|
339
|
-
str = `${node.nam}:${options.indent}${(options.
|
|
340
|
+
str = `${node.nam}:${options.indent}${(options.minifyValues
|
|
340
341
|
? filterValues(node.val)
|
|
341
342
|
: node.val)
|
|
342
343
|
.reduce(reducer, "")
|
|
@@ -404,9 +405,10 @@ function renderAstNode(data, options, sourcemaps, sourceLocation, linesMap, erro
|
|
|
404
405
|
function renderValue(token, options = {}, cache = Object.create(null), reducer, errors) {
|
|
405
406
|
if (token.typ === EnumToken.WhenElseFunctionTokenType &&
|
|
406
407
|
equalsIgnoreCase(token.val, "supports")) {
|
|
407
|
-
options = { ...options, minify: false, convertColor: false };
|
|
408
|
+
options = { ...options, minifyValues: false, minify: false, convertColor: false };
|
|
408
409
|
reducer = null;
|
|
409
410
|
}
|
|
411
|
+
options.minifyValues ??= options.minify;
|
|
410
412
|
if (reducer == null) {
|
|
411
413
|
reducer = function (acc, curr) {
|
|
412
414
|
if (curr.typ == EnumToken.CommentTokenType && options.removeComments) {
|
|
@@ -563,7 +565,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
563
565
|
")");
|
|
564
566
|
}
|
|
565
567
|
case EnumToken.UrlFunctionTokenType:
|
|
566
|
-
if (options.
|
|
568
|
+
if (options.minifyValues && token.typ === EnumToken.UrlFunctionTokenType) {
|
|
567
569
|
if (token.chi[0]?.typ === EnumToken.BadUrlTokenType) {
|
|
568
570
|
return "url()";
|
|
569
571
|
}
|
|
@@ -584,7 +586,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
584
586
|
case EnumToken.FunctionTokenType:
|
|
585
587
|
case EnumToken.MathFunctionTokenType:
|
|
586
588
|
case EnumToken.ImageFunctionTokenType:
|
|
587
|
-
if (options.
|
|
589
|
+
if (options.minifyValues && token.typ === EnumToken.ImageFunctionTokenType) {
|
|
588
590
|
const slice = token.chi.slice();
|
|
589
591
|
switch (token.val) {
|
|
590
592
|
case "linear-gradient":
|
|
@@ -1070,37 +1072,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
1070
1072
|
renderValue(curr, token.typ == EnumToken.FunctionTokenType ? { minify: false } : options, cache, reducer), "") +
|
|
1071
1073
|
")");
|
|
1072
1074
|
}
|
|
1073
|
-
return (
|
|
1074
|
-
/* options.minify && 'Pseudo-class-func' == token.typ && token.val.slice(0, 2) == '::' ? token.val.slice(1) :*/ (token.val ?? "") +
|
|
1075
|
-
"(" +
|
|
1076
|
-
token.chi.reduce(reducer, "") +
|
|
1077
|
-
")");
|
|
1078
|
-
// case EnumToken.MatchExpressionTokenType:
|
|
1079
|
-
// return (
|
|
1080
|
-
// renderValue((token as MatchExpressionToken).l as Token, options, cache, reducer, errors) +
|
|
1081
|
-
// renderValue((token as MatchExpressionToken).op, options, cache, reducer, errors) +
|
|
1082
|
-
// renderValue((token as MatchExpressionToken).r, options, cache, reducer, errors) +
|
|
1083
|
-
// ((token as MatchExpressionToken).attr ? " " + (token as MatchExpressionToken).attr : "")
|
|
1084
|
-
// );
|
|
1085
|
-
// case EnumToken.NameSpaceAttributeTokenType:
|
|
1086
|
-
// return (
|
|
1087
|
-
// ((token as NameSpaceAttributeToken).l == null
|
|
1088
|
-
// ? ""
|
|
1089
|
-
// : renderValue((token as NameSpaceAttributeToken).l as Token, options, cache, reducer, errors)) +
|
|
1090
|
-
// "|" +
|
|
1091
|
-
// renderValue((token as NameSpaceAttributeToken).r, options, cache, reducer, errors)
|
|
1092
|
-
// );
|
|
1093
|
-
// case EnumToken.ComposesSelectorNodeType:
|
|
1094
|
-
// return (
|
|
1095
|
-
// (token as ComposesSelectorToken).l.reduce(
|
|
1096
|
-
// (acc: string, curr: Token) => acc + renderValue(curr, options, cache),
|
|
1097
|
-
// "",
|
|
1098
|
-
// ) +
|
|
1099
|
-
// ((token as ComposesSelectorToken).r == null
|
|
1100
|
-
// ? ""
|
|
1101
|
-
// : " from " +
|
|
1102
|
-
// renderValue((token as ComposesSelectorToken).r as Token, options, cache, reducer, errors))
|
|
1103
|
-
// );
|
|
1075
|
+
return (token.val ?? "") + "(" + token.chi.reduce(reducer, "") + ")";
|
|
1104
1076
|
case EnumToken.BlockStartTokenType:
|
|
1105
1077
|
return "{";
|
|
1106
1078
|
case EnumToken.BlockEndTokenType:
|
|
@@ -1249,7 +1221,11 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
1249
1221
|
const perc = token.val.typ == EnumToken.FractionTokenType
|
|
1250
1222
|
? renderValue(token.val, options, cache)
|
|
1251
1223
|
: minifyNumber(token.val);
|
|
1252
|
-
return options.
|
|
1224
|
+
return options.minifyValues && perc == "0"
|
|
1225
|
+
? "0"
|
|
1226
|
+
: perc.includes("/")
|
|
1227
|
+
? perc.replace("/", uni + "/")
|
|
1228
|
+
: perc + uni;
|
|
1253
1229
|
case EnumToken.NumberTokenType:
|
|
1254
1230
|
return token.val.typ == EnumToken.FractionTokenType
|
|
1255
1231
|
? renderValue(token.val, options, cache)
|
|
@@ -1314,7 +1290,7 @@ function renderValue(token, options = {}, cache = Object.create(null), reducer,
|
|
|
1314
1290
|
case EnumToken.DeclarationNodeType:
|
|
1315
1291
|
return (token.nam +
|
|
1316
1292
|
":" +
|
|
1317
|
-
(options.
|
|
1293
|
+
(options.minifyValues ? filterValues(token.val) : token.val).reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
1318
1294
|
case EnumToken.MediaQueryUnaryFeatureTokenType:
|
|
1319
1295
|
return (renderValue(token.l, options, cache, reducer) +
|
|
1320
1296
|
" " +
|
|
@@ -37,7 +37,7 @@ function la98rgb2a98rgb(r, g, b, a = null) {
|
|
|
37
37
|
// convert an array of linear-light a98-rgb in the range 0.0-1.0
|
|
38
38
|
// to gamma corrected form
|
|
39
39
|
// negative values are also now accepted
|
|
40
|
-
return [r,
|
|
40
|
+
return [r, g, b]
|
|
41
41
|
.map(function (val) {
|
|
42
42
|
let sign = val < 0 ? -1 : 1;
|
|
43
43
|
let abs = Math.abs(val);
|
|
@@ -24,7 +24,6 @@ function alpha(color, alpha) {
|
|
|
24
24
|
}
|
|
25
25
|
let components = getColorComponents(color);
|
|
26
26
|
if (alpha.typ === EnumToken.MathFunctionTokenType) {
|
|
27
|
-
const originalAlpha = cloneNode(alpha, true);
|
|
28
27
|
for (const { value } of walkValues(alpha.chi, alpha)) {
|
|
29
28
|
if (value.typ === EnumToken.IdenTokenType) {
|
|
30
29
|
if (equalsIgnoreCase(value.val, "alpha")) {
|
|
@@ -36,22 +35,22 @@ function alpha(color, alpha) {
|
|
|
36
35
|
});
|
|
37
36
|
// continue;
|
|
38
37
|
}
|
|
39
|
-
else if (equalsIgnoreCase(value.val, "none")) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
38
|
+
// else if (equalsIgnoreCase((value as IdentToken).val, "none")) {
|
|
39
|
+
// Object.assign(value, {
|
|
40
|
+
// typ: EnumToken.NumberTokenType,
|
|
41
|
+
// val: 0,
|
|
42
|
+
// });
|
|
43
|
+
// }
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
const result = evaluate([alpha]);
|
|
48
47
|
if (result.length == 1) {
|
|
49
48
|
alpha = result[0];
|
|
50
49
|
}
|
|
51
|
-
else {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
50
|
+
// else {
|
|
51
|
+
// // @ts-expect-error
|
|
52
|
+
// alpha = originalAlpha;
|
|
53
|
+
// }
|
|
55
54
|
}
|
|
56
55
|
// console.error({ alpha });
|
|
57
56
|
if (alpha.typ !== EnumToken.IdenTokenType &&
|
|
@@ -77,17 +76,17 @@ function alpha(color, alpha) {
|
|
|
77
76
|
return null;
|
|
78
77
|
}
|
|
79
78
|
if (alpha?.typ === EnumToken.IdenTokenType) {
|
|
80
|
-
if (equalsIgnoreCase(alpha.val, "alpha")) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
alpha
|
|
79
|
+
// if (equalsIgnoreCase((alpha as IdentToken).val, "alpha")) {
|
|
80
|
+
// alpha = components[3] ?? {
|
|
81
|
+
// typ: EnumToken.NumberTokenType,
|
|
82
|
+
// val: 1,
|
|
83
|
+
// };
|
|
84
|
+
// } else
|
|
85
|
+
if (equalsIgnoreCase(alpha.val, "none")) {
|
|
86
|
+
Object.assign(alpha, {
|
|
88
87
|
typ: EnumToken.NumberTokenType,
|
|
89
88
|
val: 0,
|
|
90
|
-
};
|
|
89
|
+
});
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
return makeColor(color.kin, components, alpha);
|
|
@@ -2,9 +2,7 @@ import { EnumToken, ColorType } from '../../ast/types.js';
|
|
|
2
2
|
import { minmax, getNumber } from './color.js';
|
|
3
3
|
import { srgbvalues, srgb2lsrgbvalues } from './srgb.js';
|
|
4
4
|
import { srgb2lch, xyz2lchvalues } from './lch.js';
|
|
5
|
-
import { srgb2rgb } from './rgb.js';
|
|
6
5
|
import { srgb2hslvalues } from './hsl.js';
|
|
7
|
-
import { srgb2hwb } from './hwb.js';
|
|
8
6
|
import { srgb2labvalues } from './lab.js';
|
|
9
7
|
import { srgb2lp3values, srgb2p3values } from './p3.js';
|
|
10
8
|
import { getColorComponents } from './utils/components.js';
|
|
@@ -121,6 +119,9 @@ function colorMix(...args) {
|
|
|
121
119
|
if (values == null) {
|
|
122
120
|
return null;
|
|
123
121
|
}
|
|
122
|
+
if (colorSpace == "hwb") {
|
|
123
|
+
colorSpace = "srgb";
|
|
124
|
+
}
|
|
124
125
|
switch (colorSpace) {
|
|
125
126
|
case "srgb":
|
|
126
127
|
break;
|
|
@@ -150,17 +151,17 @@ function colorMix(...args) {
|
|
|
150
151
|
values = srgb2xyz_d65(values[0], values[1], values[2], values[3]);
|
|
151
152
|
values = XYZ_D65_to_D50(values[0], values[1], values[2], values[3]);
|
|
152
153
|
break;
|
|
153
|
-
case "rgb":
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
// case "rgb":
|
|
155
|
+
// for (let j = 0; j < values.length; j++) {
|
|
156
|
+
// values[j] = j == 3 ? values[j] : srgb2rgb(values[j]);
|
|
157
|
+
// }
|
|
158
|
+
// break;
|
|
158
159
|
case "hsl":
|
|
159
160
|
values = srgb2hslvalues(values[0], values[1], values[2], values[3]);
|
|
160
161
|
break;
|
|
161
|
-
case "hwb":
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
// case "hwb":
|
|
163
|
+
// values = srgb2hwb(values[0], values[1], values[2], values[3]);
|
|
164
|
+
// break;
|
|
164
165
|
case "lab":
|
|
165
166
|
values = srgb2labvalues(values[0], values[1], values[2], values[3]);
|
|
166
167
|
break;
|
|
@@ -359,14 +360,14 @@ function colorMix(...args) {
|
|
|
359
360
|
kin: ColorType.COLOR,
|
|
360
361
|
cal: "col",
|
|
361
362
|
};
|
|
362
|
-
case "rgb":
|
|
363
|
+
// case "rgb":
|
|
363
364
|
case "hsl":
|
|
364
|
-
case "hwb":
|
|
365
|
+
// case "hwb":
|
|
365
366
|
case "lab":
|
|
366
367
|
case "lch":
|
|
367
368
|
case "oklab":
|
|
368
369
|
case "oklch":
|
|
369
|
-
if (colorSpace == "hsl"
|
|
370
|
+
if (colorSpace == "hsl") {
|
|
370
371
|
// @ts-ignore
|
|
371
372
|
if (values[2] < 0) {
|
|
372
373
|
// @ts-ignore
|
|
@@ -396,7 +397,7 @@ function colorMix(...args) {
|
|
|
396
397
|
}),
|
|
397
398
|
kin: ColorType[colorSpace.toUpperCase().replaceAll("-", "_")],
|
|
398
399
|
};
|
|
399
|
-
if (colorSpace == "hsl"
|
|
400
|
+
if (colorSpace == "hsl") {
|
|
400
401
|
// @ts-ignore
|
|
401
402
|
result.chi[0] = { typ: EnumToken.AngleTokenType, val: result.chi[0].val * 360 };
|
|
402
403
|
// @ts-ignore
|
|
@@ -70,7 +70,10 @@ function color2HexToken(token) {
|
|
|
70
70
|
if (value == null) {
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
return hexToken(value.reduce((acc, curr) => acc +
|
|
73
|
+
return hexToken(value.reduce((acc, curr) => acc +
|
|
74
|
+
srgb2rgb(curr + Number.EPSILON)
|
|
75
|
+
.toString(16)
|
|
76
|
+
.padStart(2, "0"), "#"));
|
|
74
77
|
}
|
|
75
78
|
function oklab2HexToken(token) {
|
|
76
79
|
let value = oklab2srgbvalues(token);
|
|
@@ -44,20 +44,20 @@ function parseRelativeColorComponents(relativeKeys, original, rExp, gExp, bExp,
|
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
if (component.typ == EnumToken.IdenTokenType) {
|
|
47
|
-
val = component.val
|
|
47
|
+
val = component.val;
|
|
48
48
|
if (
|
|
49
49
|
// @ts-expect-error
|
|
50
50
|
typeof Math[val.toUpperCase()] !== "number" &&
|
|
51
|
-
val
|
|
52
|
-
val
|
|
53
|
-
val
|
|
54
|
-
val
|
|
55
|
-
val
|
|
56
|
-
val
|
|
57
|
-
val
|
|
58
|
-
val
|
|
59
|
-
val
|
|
60
|
-
!colorsFunc.
|
|
51
|
+
!equalsIgnoreCase(val, "in") &&
|
|
52
|
+
!equalsIgnoreCase(val, "hue") &&
|
|
53
|
+
!equalsIgnoreCase(val, "from") &&
|
|
54
|
+
!equalsIgnoreCase(val, "alpha") &&
|
|
55
|
+
!equalsIgnoreCase(val, "none") &&
|
|
56
|
+
!equalsIgnoreCase(val, "shorter") &&
|
|
57
|
+
!equalsIgnoreCase(val, "longer") &&
|
|
58
|
+
!equalsIgnoreCase(val, "increasing") &&
|
|
59
|
+
!equalsIgnoreCase(val, "decreasing") &&
|
|
60
|
+
!colorsFunc.some((t) => equalsIgnoreCase(t, val)) &&
|
|
61
61
|
!colorFuncColorSpace.includes(val) &&
|
|
62
62
|
!validKeys.includes(val)) {
|
|
63
63
|
return null;
|
|
@@ -4,13 +4,6 @@ import { expandHexValue } from '../hex.js';
|
|
|
4
4
|
import { equalsIgnoreCase } from '../../../parser/utils/text.js';
|
|
5
5
|
|
|
6
6
|
function getColorComponents(token) {
|
|
7
|
-
// if (token.typ === EnumToken.IdenTokenType) {
|
|
8
|
-
// if (isColor(token)) {
|
|
9
|
-
// parseColor(token);
|
|
10
|
-
// } else {
|
|
11
|
-
// return null;
|
|
12
|
-
// }
|
|
13
|
-
// }
|
|
14
7
|
if (token.kin == ColorType.HEX || token.kin == ColorType.LIT) {
|
|
15
8
|
if (equalsIgnoreCase("currentcolor", token.val)) {
|
|
16
9
|
return null;
|
|
@@ -34,25 +27,12 @@ function getColorComponents(token) {
|
|
|
34
27
|
].includes(child.typ)) {
|
|
35
28
|
continue;
|
|
36
29
|
}
|
|
37
|
-
// if (child.typ === EnumToken.IdenTokenType && isColor(child)) {
|
|
38
|
-
// parseColor(child);
|
|
39
|
-
// }
|
|
40
30
|
if (child.typ === EnumToken.FunctionTokenType ||
|
|
41
31
|
child.typ === EnumToken.WildCardFunctionTokenType ||
|
|
42
32
|
child.typ === EnumToken.MathFunctionTokenType) {
|
|
43
33
|
if ("var" == child.val.toLowerCase()) {
|
|
44
34
|
return null;
|
|
45
35
|
}
|
|
46
|
-
// else {
|
|
47
|
-
// for (const { value } of walkValues((child as FunctionToken).chi)) {
|
|
48
|
-
// if (
|
|
49
|
-
// value.typ == EnumToken.WildCardFunctionTokenDefType &&
|
|
50
|
-
// "var" === (value as FunctionToken).val.toLowerCase()
|
|
51
|
-
// ) {
|
|
52
|
-
// return null;
|
|
53
|
-
// }
|
|
54
|
-
// }
|
|
55
|
-
// }
|
|
56
36
|
}
|
|
57
37
|
if (child.typ == EnumToken.ColorTokenType && equalsIgnoreCase("currentcolor", child.val)) {
|
|
58
38
|
return null;
|
|
@@ -16,12 +16,12 @@ import { getSyntaxConfig } from '../validation/config.js';
|
|
|
16
16
|
// '\\'
|
|
17
17
|
const REVERSE_SOLIDUS = 0x5c;
|
|
18
18
|
const flexUnits = ["fr"];
|
|
19
|
-
const frequencyUnits = ["
|
|
19
|
+
const frequencyUnits = ["Hz", "kHz"];
|
|
20
20
|
const timeUnits = ["ms", "s"];
|
|
21
21
|
const angleUnits = ["rad", "turn", "deg", "grad"];
|
|
22
22
|
const resolutionUnits = ["dpi", "dpcm", "dppx", "x"];
|
|
23
23
|
const dimensionUnits = [
|
|
24
|
-
"
|
|
24
|
+
"Q",
|
|
25
25
|
"cap",
|
|
26
26
|
"ch",
|
|
27
27
|
"cm",
|
|
@@ -82,7 +82,8 @@ function isMFValue(featureName, tokens, isMFRange) {
|
|
|
82
82
|
return { valid: true, success: false, isValueAllowed: false };
|
|
83
83
|
}
|
|
84
84
|
featureName = featureName.toLowerCase();
|
|
85
|
-
|
|
85
|
+
// @ts-expect-error
|
|
86
|
+
if (config.mediaFeatures[featureName] == null) {
|
|
86
87
|
return { valid: false, success: false };
|
|
87
88
|
}
|
|
88
89
|
// @ts-expect-error
|
|
@@ -126,8 +127,7 @@ function isMFValue(featureName, tokens, isMFRange) {
|
|
|
126
127
|
return {
|
|
127
128
|
valid: true,
|
|
128
129
|
success: (tokens.length == 1 &&
|
|
129
|
-
tokens[0].typ == EnumToken.NumberTokenType
|
|
130
|
-
tokens[0].val.typ == EnumToken.FractionTokenType) ||
|
|
130
|
+
tokens[0].typ == EnumToken.NumberTokenType) ||
|
|
131
131
|
(tokens.length === 3 &&
|
|
132
132
|
tokens[0].typ == EnumToken.NumberTokenType &&
|
|
133
133
|
typeof tokens[0].val === "number" &&
|
|
@@ -643,7 +643,8 @@ function matchAllSyntaxes(syntaxes, context, options) {
|
|
|
643
643
|
for (let i = index; i < syntaxes.length; i++) {
|
|
644
644
|
if (syntaxes[i].typ == ValidationTokenEnum.Whitespace ||
|
|
645
645
|
syntaxes[i].isOptional ||
|
|
646
|
-
syntaxes[i].isRepeatable
|
|
646
|
+
syntaxes[i].isRepeatable ||
|
|
647
|
+
syntaxes[i].match?.min?.val === 0) {
|
|
647
648
|
continue;
|
|
648
649
|
}
|
|
649
650
|
return {
|
package/dist/web.js
CHANGED
|
@@ -17,6 +17,7 @@ export { isOkLabClose, okLabDistance } from './lib/syntax/color/utils/distance.j
|
|
|
17
17
|
export { find, findAll, findByValue, findLast } from './lib/ast/find.js';
|
|
18
18
|
export { cloneNode } from './lib/ast/clone.js';
|
|
19
19
|
export { replaceNodeOrValue } from './lib/parser/utils/token.js';
|
|
20
|
+
export { PropertyList } from './lib/parser/declaration/list.js';
|
|
20
21
|
export { SourceMap } from './lib/printer/sourcemap/sourcemap.js';
|
|
21
22
|
export { FeatureWalkMode } from './lib/ast/features/type.js';
|
|
22
23
|
export { getNodeProperty, setNodeProperty } from './lib/ast/node.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbela99/css-parser",
|
|
3
3
|
"description": "CSS parser, minifier and validator for node and the browser",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.6",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/node.js",
|
|
7
7
|
"./node": "./dist/node.js",
|
|
@@ -60,22 +60,25 @@
|
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://github.com/tbela99/css-parser#readme",
|
|
62
62
|
"devDependencies": {
|
|
63
|
+
"@boneskull/typedoc-plugin-mermaid": "^0.2.1",
|
|
63
64
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
64
65
|
"@rollup/plugin-json": "^6.1.0",
|
|
65
66
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
66
67
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
67
68
|
"@types/chai": "^5.2.3",
|
|
69
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
68
70
|
"@types/mocha": "^10.0.10",
|
|
69
|
-
"@types/node": "^26.4
|
|
70
|
-
"@types/web": "^0.0.
|
|
71
|
+
"@types/node": "^26.6.4",
|
|
72
|
+
"@types/web": "^0.0.357",
|
|
71
73
|
"@web/test-runner": "^1.0.0",
|
|
72
74
|
"@web/test-runner-playwright": "^1.0.0",
|
|
73
|
-
"chai": "^6.
|
|
75
|
+
"chai": "^6.3.0",
|
|
76
|
+
"chai-as-promised": "^8.0.2",
|
|
74
77
|
"esno": "^4.8.0",
|
|
75
78
|
"markdown-it-task-lists": "^2.1.1",
|
|
76
|
-
"mocha": "^12.0.
|
|
77
|
-
"playwright": "^1.
|
|
78
|
-
"rollup": "^4.63.
|
|
79
|
+
"mocha": "^12.0.3",
|
|
80
|
+
"playwright": "^1.63.0",
|
|
81
|
+
"rollup": "^4.63.6",
|
|
79
82
|
"rollup-plugin-dts": "^6.5.1",
|
|
80
83
|
"superc8": "^12.7.0",
|
|
81
84
|
"tslib": "^2.8.1",
|
|
@@ -83,9 +86,7 @@
|
|
|
83
86
|
"typedoc-plugin-coverage": "^4.0.3",
|
|
84
87
|
"typedoc-plugin-llms-txt": "^0.1.2",
|
|
85
88
|
"typedoc-plugin-redirect": "^1.3.0",
|
|
86
|
-
"typedoc-unhoax-theme": "^0.5.3"
|
|
87
|
-
"@types/chai-as-promised": "^8.0.2",
|
|
88
|
-
"chai-as-promised": "^8.0.2"
|
|
89
|
+
"typedoc-unhoax-theme": "^0.5.3"
|
|
89
90
|
},
|
|
90
91
|
"sideEffects": false
|
|
91
|
-
}
|
|
92
|
+
}
|