@tbela99/css-parser 1.6.4 → 1.6.5
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 +43 -0
- package/README.md +104 -0
- package/dist/index-umd-web.js +283 -282
- package/dist/index.cjs +282 -282
- package/dist/index.d.ts +15 -2
- package/dist/lib/ast/features/calc.js +16 -4
- 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 +24 -1
- 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 -2
- package/dist/lib/parser/tokenize.js +99 -124
- 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 +2 -1
- package/dist/web.js +1 -0
- package/package.json +5 -4
package/dist/index-umd-web.js
CHANGED
|
@@ -6429,6 +6429,11 @@
|
|
|
6429
6429
|
* Color range definitions
|
|
6430
6430
|
*/
|
|
6431
6431
|
const colorRange = {
|
|
6432
|
+
rgb: {
|
|
6433
|
+
r: [0, 255],
|
|
6434
|
+
g: [0, 255],
|
|
6435
|
+
b: [0, 255],
|
|
6436
|
+
},
|
|
6432
6437
|
lab: {
|
|
6433
6438
|
l: [0, 100],
|
|
6434
6439
|
a: [-125, 125],
|
|
@@ -6898,13 +6903,6 @@
|
|
|
6898
6903
|
}
|
|
6899
6904
|
|
|
6900
6905
|
function getColorComponents(token) {
|
|
6901
|
-
// if (token.typ === EnumToken.IdenTokenType) {
|
|
6902
|
-
// if (isColor(token)) {
|
|
6903
|
-
// parseColor(token);
|
|
6904
|
-
// } else {
|
|
6905
|
-
// return null;
|
|
6906
|
-
// }
|
|
6907
|
-
// }
|
|
6908
6906
|
if (token.kin == exports.ColorType.HEX || token.kin == exports.ColorType.LIT) {
|
|
6909
6907
|
if (equalsIgnoreCase("currentcolor", token.val)) {
|
|
6910
6908
|
return null;
|
|
@@ -6928,25 +6926,12 @@
|
|
|
6928
6926
|
].includes(child.typ)) {
|
|
6929
6927
|
continue;
|
|
6930
6928
|
}
|
|
6931
|
-
// if (child.typ === EnumToken.IdenTokenType && isColor(child)) {
|
|
6932
|
-
// parseColor(child);
|
|
6933
|
-
// }
|
|
6934
6929
|
if (child.typ === exports.EnumToken.FunctionTokenType ||
|
|
6935
6930
|
child.typ === exports.EnumToken.WildCardFunctionTokenType ||
|
|
6936
6931
|
child.typ === exports.EnumToken.MathFunctionTokenType) {
|
|
6937
6932
|
if ("var" == child.val.toLowerCase()) {
|
|
6938
6933
|
return null;
|
|
6939
6934
|
}
|
|
6940
|
-
// else {
|
|
6941
|
-
// for (const { value } of walkValues((child as FunctionToken).chi)) {
|
|
6942
|
-
// if (
|
|
6943
|
-
// value.typ == EnumToken.WildCardFunctionTokenDefType &&
|
|
6944
|
-
// "var" === (value as FunctionToken).val.toLowerCase()
|
|
6945
|
-
// ) {
|
|
6946
|
-
// return null;
|
|
6947
|
-
// }
|
|
6948
|
-
// }
|
|
6949
|
-
// }
|
|
6950
6935
|
}
|
|
6951
6936
|
if (child.typ == exports.EnumToken.ColorTokenType && equalsIgnoreCase("currentcolor", child.val)) {
|
|
6952
6937
|
return null;
|
|
@@ -8242,7 +8227,10 @@
|
|
|
8242
8227
|
if (value == null) {
|
|
8243
8228
|
return null;
|
|
8244
8229
|
}
|
|
8245
|
-
return hexToken(value.reduce((acc, curr) => acc +
|
|
8230
|
+
return hexToken(value.reduce((acc, curr) => acc +
|
|
8231
|
+
srgb2rgb(curr + Number.EPSILON)
|
|
8232
|
+
.toString(16)
|
|
8233
|
+
.padStart(2, "0"), "#"));
|
|
8246
8234
|
}
|
|
8247
8235
|
function oklab2HexToken(token) {
|
|
8248
8236
|
let value = oklab2srgbvalues(token);
|
|
@@ -9091,7 +9079,7 @@
|
|
|
9091
9079
|
// convert an array of linear-light a98-rgb in the range 0.0-1.0
|
|
9092
9080
|
// to gamma corrected form
|
|
9093
9081
|
// negative values are also now accepted
|
|
9094
|
-
return [r,
|
|
9082
|
+
return [r, g, b]
|
|
9095
9083
|
.map(function (val) {
|
|
9096
9084
|
let sign = val < 0 ? -1 : 1;
|
|
9097
9085
|
let abs = Math.abs(val);
|
|
@@ -9227,6 +9215,9 @@
|
|
|
9227
9215
|
if (values == null) {
|
|
9228
9216
|
return null;
|
|
9229
9217
|
}
|
|
9218
|
+
if (colorSpace == "hwb") {
|
|
9219
|
+
colorSpace = "srgb";
|
|
9220
|
+
}
|
|
9230
9221
|
switch (colorSpace) {
|
|
9231
9222
|
case "srgb":
|
|
9232
9223
|
break;
|
|
@@ -9256,17 +9247,17 @@
|
|
|
9256
9247
|
values = srgb2xyz_d65(values[0], values[1], values[2], values[3]);
|
|
9257
9248
|
values = XYZ_D65_to_D50(values[0], values[1], values[2], values[3]);
|
|
9258
9249
|
break;
|
|
9259
|
-
case "rgb":
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9250
|
+
// case "rgb":
|
|
9251
|
+
// for (let j = 0; j < values.length; j++) {
|
|
9252
|
+
// values[j] = j == 3 ? values[j] : srgb2rgb(values[j]);
|
|
9253
|
+
// }
|
|
9254
|
+
// break;
|
|
9264
9255
|
case "hsl":
|
|
9265
9256
|
values = srgb2hslvalues(values[0], values[1], values[2], values[3]);
|
|
9266
9257
|
break;
|
|
9267
|
-
case "hwb":
|
|
9268
|
-
|
|
9269
|
-
|
|
9258
|
+
// case "hwb":
|
|
9259
|
+
// values = srgb2hwb(values[0], values[1], values[2], values[3]);
|
|
9260
|
+
// break;
|
|
9270
9261
|
case "lab":
|
|
9271
9262
|
values = srgb2labvalues(values[0], values[1], values[2], values[3]);
|
|
9272
9263
|
break;
|
|
@@ -9465,14 +9456,14 @@
|
|
|
9465
9456
|
kin: exports.ColorType.COLOR,
|
|
9466
9457
|
cal: "col",
|
|
9467
9458
|
};
|
|
9468
|
-
case "rgb":
|
|
9459
|
+
// case "rgb":
|
|
9469
9460
|
case "hsl":
|
|
9470
|
-
case "hwb":
|
|
9461
|
+
// case "hwb":
|
|
9471
9462
|
case "lab":
|
|
9472
9463
|
case "lch":
|
|
9473
9464
|
case "oklab":
|
|
9474
9465
|
case "oklch":
|
|
9475
|
-
if (colorSpace == "hsl"
|
|
9466
|
+
if (colorSpace == "hsl") {
|
|
9476
9467
|
// @ts-ignore
|
|
9477
9468
|
if (values[2] < 0) {
|
|
9478
9469
|
// @ts-ignore
|
|
@@ -9502,7 +9493,7 @@
|
|
|
9502
9493
|
}),
|
|
9503
9494
|
kin: exports.ColorType[colorSpace.toUpperCase().replaceAll("-", "_")],
|
|
9504
9495
|
};
|
|
9505
|
-
if (colorSpace == "hsl"
|
|
9496
|
+
if (colorSpace == "hsl") {
|
|
9506
9497
|
// @ts-ignore
|
|
9507
9498
|
result.chi[0] = { typ: exports.EnumToken.AngleTokenType, val: result.chi[0].val * 360 };
|
|
9508
9499
|
// @ts-ignore
|
|
@@ -10097,6 +10088,7 @@
|
|
|
10097
10088
|
[LOCSRCID]: nodes[0][LOCSRCID],
|
|
10098
10089
|
[LOCSTA]: nodes[0][LOCSTA],
|
|
10099
10090
|
[LOCEND]: nodes[0][LOCEND],
|
|
10091
|
+
[PARENT]: nodes[0][PARENT],
|
|
10100
10092
|
},
|
|
10101
10093
|
];
|
|
10102
10094
|
}
|
|
@@ -10119,6 +10111,7 @@
|
|
|
10119
10111
|
[LOCSRCID]: nodes[i][LOCSRCID],
|
|
10120
10112
|
[LOCSTA]: nodes[i][LOCSTA],
|
|
10121
10113
|
[LOCEND]: nodes[i + 1][LOCEND],
|
|
10114
|
+
[PARENT]: nodes[i + 1][PARENT],
|
|
10122
10115
|
};
|
|
10123
10116
|
}
|
|
10124
10117
|
else {
|
|
@@ -10128,6 +10121,7 @@
|
|
|
10128
10121
|
[LOCSRCID]: nodes[i + 1][LOCSRCID],
|
|
10129
10122
|
[LOCSTA]: nodes[i + 1][LOCSTA],
|
|
10130
10123
|
[LOCEND]: nodes[i + 1][LOCEND],
|
|
10124
|
+
[PARENT]: nodes[i + 1][PARENT],
|
|
10131
10125
|
}, exports.EnumToken.Mul);
|
|
10132
10126
|
}
|
|
10133
10127
|
i++;
|
|
@@ -10148,12 +10142,14 @@
|
|
|
10148
10142
|
[LOCSRCID]: token[LOCSRCID],
|
|
10149
10143
|
[LOCSTA]: token[LOCSTA],
|
|
10150
10144
|
[LOCEND]: token[LOCEND],
|
|
10145
|
+
[PARENT]: token[PARENT],
|
|
10151
10146
|
}, {
|
|
10152
10147
|
...token,
|
|
10153
10148
|
val: -token.val,
|
|
10154
10149
|
[LOCSRCID]: token[LOCSRCID],
|
|
10155
10150
|
[LOCSTA]: token[LOCSTA],
|
|
10156
10151
|
[LOCEND]: token[LOCEND],
|
|
10152
|
+
[PARENT]: token[PARENT],
|
|
10157
10153
|
});
|
|
10158
10154
|
return acc;
|
|
10159
10155
|
}
|
|
@@ -10164,6 +10160,7 @@
|
|
|
10164
10160
|
[LOCSRCID]: token[LOCSRCID],
|
|
10165
10161
|
[LOCSTA]: token[LOCSTA],
|
|
10166
10162
|
[LOCEND]: token[LOCEND],
|
|
10163
|
+
[PARENT]: token[PARENT],
|
|
10167
10164
|
});
|
|
10168
10165
|
}
|
|
10169
10166
|
acc.push(token);
|
|
@@ -10185,6 +10182,7 @@
|
|
|
10185
10182
|
[LOCSRCID]: l[LOCSRCID],
|
|
10186
10183
|
[LOCSTA]: l[LOCSTA],
|
|
10187
10184
|
[LOCEND]: r?.[LOCEND] ?? l[LOCEND],
|
|
10185
|
+
[PARENT]: l[PARENT],
|
|
10188
10186
|
};
|
|
10189
10187
|
if (!isScalarToken(l) || !isScalarToken(r) || (l.typ == r.typ && "unit" in l && "unit" in r && l.unit != r.unit)) {
|
|
10190
10188
|
return defaultReturn;
|
|
@@ -10257,6 +10255,7 @@
|
|
|
10257
10255
|
[LOCSRCID]: l[LOCSRCID],
|
|
10258
10256
|
[LOCSTA]: l[LOCSTA],
|
|
10259
10257
|
[LOCEND]: l[LOCEND],
|
|
10258
|
+
[PARENT]: l[PARENT],
|
|
10260
10259
|
},
|
|
10261
10260
|
r: {
|
|
10262
10261
|
typ: exports.EnumToken.NumberTokenType,
|
|
@@ -10264,6 +10263,7 @@
|
|
|
10264
10263
|
[LOCSRCID]: r[LOCSRCID],
|
|
10265
10264
|
[LOCSTA]: r[LOCSTA],
|
|
10266
10265
|
[LOCEND]: r[LOCEND],
|
|
10266
|
+
[PARENT]: r[PARENT],
|
|
10267
10267
|
},
|
|
10268
10268
|
};
|
|
10269
10269
|
}
|
|
@@ -10276,6 +10276,7 @@
|
|
|
10276
10276
|
[LOCSRCID]: l[LOCSRCID],
|
|
10277
10277
|
[LOCSTA]: l[LOCSTA],
|
|
10278
10278
|
[LOCEND]: l[LOCEND],
|
|
10279
|
+
[PARENT]: l[PARENT],
|
|
10279
10280
|
},
|
|
10280
10281
|
r: {
|
|
10281
10282
|
typ: exports.EnumToken.NumberTokenType,
|
|
@@ -10283,6 +10284,7 @@
|
|
|
10283
10284
|
[LOCSRCID]: r[LOCSRCID],
|
|
10284
10285
|
[LOCSTA]: r[LOCSTA],
|
|
10285
10286
|
[LOCEND]: r[LOCEND],
|
|
10287
|
+
[PARENT]: r[PARENT],
|
|
10286
10288
|
},
|
|
10287
10289
|
};
|
|
10288
10290
|
}
|
|
@@ -10309,6 +10311,7 @@
|
|
|
10309
10311
|
[LOCSRCID]: l[LOCSRCID],
|
|
10310
10312
|
[LOCSTA]: l[LOCSTA],
|
|
10311
10313
|
[LOCEND]: r?.[LOCEND] ?? l[LOCEND],
|
|
10314
|
+
[PARENT]: l[PARENT],
|
|
10312
10315
|
};
|
|
10313
10316
|
if (token.typ == exports.EnumToken.IdenTokenType) {
|
|
10314
10317
|
// @ts-ignore
|
|
@@ -10489,6 +10492,7 @@
|
|
|
10489
10492
|
[LOCSRCID]: value[0][LOCSRCID],
|
|
10490
10493
|
[LOCSTA]: value[0][LOCSTA],
|
|
10491
10494
|
[LOCEND]: value[0][LOCEND],
|
|
10495
|
+
[PARENT]: value[0][PARENT],
|
|
10492
10496
|
}
|
|
10493
10497
|
: {
|
|
10494
10498
|
typ: token.val == "sign" ? exports.EnumToken.NumberTokenType : value[0].typ,
|
|
@@ -10496,6 +10500,7 @@
|
|
|
10496
10500
|
[LOCSRCID]: value[0][LOCSRCID],
|
|
10497
10501
|
[LOCSTA]: value[0][LOCSTA],
|
|
10498
10502
|
[LOCEND]: value[0][LOCEND],
|
|
10503
|
+
[PARENT]: value[0][PARENT],
|
|
10499
10504
|
},
|
|
10500
10505
|
];
|
|
10501
10506
|
}
|
|
@@ -10518,6 +10523,7 @@
|
|
|
10518
10523
|
[LOCSRCID]: token[LOCSRCID],
|
|
10519
10524
|
[LOCSTA]: token[LOCSTA],
|
|
10520
10525
|
[LOCEND]: token[LOCEND],
|
|
10526
|
+
[PARENT]: token[PARENT],
|
|
10521
10527
|
},
|
|
10522
10528
|
];
|
|
10523
10529
|
}
|
|
@@ -10591,6 +10597,7 @@
|
|
|
10591
10597
|
[LOCSRCID]: token[LOCSRCID],
|
|
10592
10598
|
[LOCSTA]: token[LOCSTA],
|
|
10593
10599
|
[LOCEND]: token[LOCEND],
|
|
10600
|
+
[PARENT]: token[PARENT],
|
|
10594
10601
|
},
|
|
10595
10602
|
];
|
|
10596
10603
|
}
|
|
@@ -10605,6 +10612,7 @@
|
|
|
10605
10612
|
[LOCSRCID]: token[LOCSRCID],
|
|
10606
10613
|
[LOCSTA]: token[LOCSTA],
|
|
10607
10614
|
[LOCEND]: token[LOCEND],
|
|
10615
|
+
[PARENT]: token[PARENT],
|
|
10608
10616
|
},
|
|
10609
10617
|
];
|
|
10610
10618
|
}
|
|
@@ -10615,6 +10623,7 @@
|
|
|
10615
10623
|
[LOCSRCID]: token[LOCSRCID],
|
|
10616
10624
|
[LOCSTA]: token[LOCSTA],
|
|
10617
10625
|
[LOCEND]: token[LOCEND],
|
|
10626
|
+
[PARENT]: token[PARENT],
|
|
10618
10627
|
},
|
|
10619
10628
|
];
|
|
10620
10629
|
}
|
|
@@ -10654,6 +10663,7 @@
|
|
|
10654
10663
|
[LOCSRCID]: token[LOCSRCID],
|
|
10655
10664
|
[LOCSTA]: token[LOCSTA],
|
|
10656
10665
|
[LOCEND]: token[LOCEND],
|
|
10666
|
+
[PARENT]: token[PARENT],
|
|
10657
10667
|
},
|
|
10658
10668
|
];
|
|
10659
10669
|
}
|
|
@@ -10696,6 +10706,7 @@
|
|
|
10696
10706
|
[LOCSRCID]: token[LOCSRCID],
|
|
10697
10707
|
[LOCSTA]: token[LOCSTA],
|
|
10698
10708
|
[LOCEND]: token[LOCEND],
|
|
10709
|
+
[PARENT]: token[PARENT],
|
|
10699
10710
|
},
|
|
10700
10711
|
];
|
|
10701
10712
|
}
|
|
@@ -10723,6 +10734,7 @@
|
|
|
10723
10734
|
[LOCSRCID]: token[LOCSRCID],
|
|
10724
10735
|
[LOCSTA]: token[LOCSTA],
|
|
10725
10736
|
[LOCEND]: token[LOCEND],
|
|
10737
|
+
[PARENT]: token[PARENT],
|
|
10726
10738
|
});
|
|
10727
10739
|
for (const child of inlineExpression$1(token.r)) {
|
|
10728
10740
|
result.push(child);
|
|
@@ -10802,6 +10814,7 @@
|
|
|
10802
10814
|
[LOCSRCID]: token[LOCSRCID],
|
|
10803
10815
|
[LOCSTA]: token[LOCSTA],
|
|
10804
10816
|
[LOCEND]: token[LOCEND],
|
|
10817
|
+
[PARENT]: token[PARENT],
|
|
10805
10818
|
};
|
|
10806
10819
|
// @ts-ignore
|
|
10807
10820
|
delete token.val;
|
|
@@ -10843,6 +10856,7 @@
|
|
|
10843
10856
|
[LOCSRCID]: tokens[i - 1][LOCSRCID],
|
|
10844
10857
|
[LOCSTA]: tokens[i - 1][LOCSTA],
|
|
10845
10858
|
[LOCEND]: tokens[i + 1][LOCEND],
|
|
10859
|
+
[PARENT]: tokens[i + 1][PARENT],
|
|
10846
10860
|
});
|
|
10847
10861
|
i--;
|
|
10848
10862
|
}
|
|
@@ -10888,20 +10902,20 @@
|
|
|
10888
10902
|
continue;
|
|
10889
10903
|
}
|
|
10890
10904
|
if (component.typ == exports.EnumToken.IdenTokenType) {
|
|
10891
|
-
val = component.val
|
|
10905
|
+
val = component.val;
|
|
10892
10906
|
if (
|
|
10893
10907
|
// @ts-expect-error
|
|
10894
10908
|
typeof Math[val.toUpperCase()] !== "number" &&
|
|
10895
|
-
val
|
|
10896
|
-
val
|
|
10897
|
-
val
|
|
10898
|
-
val
|
|
10899
|
-
val
|
|
10900
|
-
val
|
|
10901
|
-
val
|
|
10902
|
-
val
|
|
10903
|
-
val
|
|
10904
|
-
!colorsFunc.
|
|
10909
|
+
!equalsIgnoreCase(val, "in") &&
|
|
10910
|
+
!equalsIgnoreCase(val, "hue") &&
|
|
10911
|
+
!equalsIgnoreCase(val, "from") &&
|
|
10912
|
+
!equalsIgnoreCase(val, "alpha") &&
|
|
10913
|
+
!equalsIgnoreCase(val, "none") &&
|
|
10914
|
+
!equalsIgnoreCase(val, "shorter") &&
|
|
10915
|
+
!equalsIgnoreCase(val, "longer") &&
|
|
10916
|
+
!equalsIgnoreCase(val, "increasing") &&
|
|
10917
|
+
!equalsIgnoreCase(val, "decreasing") &&
|
|
10918
|
+
!colorsFunc.some((t) => equalsIgnoreCase(t, val)) &&
|
|
10905
10919
|
!colorFuncColorSpace.includes(val) &&
|
|
10906
10920
|
!validKeys.includes(val)) {
|
|
10907
10921
|
return null;
|
|
@@ -12805,7 +12819,8 @@
|
|
|
12805
12819
|
for (let i = index; i < syntaxes.length; i++) {
|
|
12806
12820
|
if (syntaxes[i].typ == ValidationTokenEnum.Whitespace ||
|
|
12807
12821
|
syntaxes[i].isOptional ||
|
|
12808
|
-
syntaxes[i].isRepeatable
|
|
12822
|
+
syntaxes[i].isRepeatable ||
|
|
12823
|
+
syntaxes[i].match?.min?.val === 0) {
|
|
12809
12824
|
continue;
|
|
12810
12825
|
}
|
|
12811
12826
|
return {
|
|
@@ -14510,7 +14525,6 @@
|
|
|
14510
14525
|
}
|
|
14511
14526
|
let components = getColorComponents(color);
|
|
14512
14527
|
if (alpha.typ === exports.EnumToken.MathFunctionTokenType) {
|
|
14513
|
-
const originalAlpha = cloneNode(alpha, true);
|
|
14514
14528
|
for (const { value } of walkValues(alpha.chi, alpha)) {
|
|
14515
14529
|
if (value.typ === exports.EnumToken.IdenTokenType) {
|
|
14516
14530
|
if (equalsIgnoreCase(value.val, "alpha")) {
|
|
@@ -14522,22 +14536,22 @@
|
|
|
14522
14536
|
});
|
|
14523
14537
|
// continue;
|
|
14524
14538
|
}
|
|
14525
|
-
else if (equalsIgnoreCase(value.val, "none")) {
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
}
|
|
14539
|
+
// else if (equalsIgnoreCase((value as IdentToken).val, "none")) {
|
|
14540
|
+
// Object.assign(value, {
|
|
14541
|
+
// typ: EnumToken.NumberTokenType,
|
|
14542
|
+
// val: 0,
|
|
14543
|
+
// });
|
|
14544
|
+
// }
|
|
14531
14545
|
}
|
|
14532
14546
|
}
|
|
14533
14547
|
const result = evaluate([alpha]);
|
|
14534
14548
|
if (result.length == 1) {
|
|
14535
14549
|
alpha = result[0];
|
|
14536
14550
|
}
|
|
14537
|
-
else {
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
}
|
|
14551
|
+
// else {
|
|
14552
|
+
// // @ts-expect-error
|
|
14553
|
+
// alpha = originalAlpha;
|
|
14554
|
+
// }
|
|
14541
14555
|
}
|
|
14542
14556
|
// console.error({ alpha });
|
|
14543
14557
|
if (alpha.typ !== exports.EnumToken.IdenTokenType &&
|
|
@@ -14563,17 +14577,17 @@
|
|
|
14563
14577
|
return null;
|
|
14564
14578
|
}
|
|
14565
14579
|
if (alpha?.typ === exports.EnumToken.IdenTokenType) {
|
|
14566
|
-
if (equalsIgnoreCase(alpha.val, "alpha")) {
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
}
|
|
14572
|
-
|
|
14573
|
-
alpha
|
|
14580
|
+
// if (equalsIgnoreCase((alpha as IdentToken).val, "alpha")) {
|
|
14581
|
+
// alpha = components[3] ?? {
|
|
14582
|
+
// typ: EnumToken.NumberTokenType,
|
|
14583
|
+
// val: 1,
|
|
14584
|
+
// };
|
|
14585
|
+
// } else
|
|
14586
|
+
if (equalsIgnoreCase(alpha.val, "none")) {
|
|
14587
|
+
Object.assign(alpha, {
|
|
14574
14588
|
typ: exports.EnumToken.NumberTokenType,
|
|
14575
14589
|
val: 0,
|
|
14576
|
-
};
|
|
14590
|
+
});
|
|
14577
14591
|
}
|
|
14578
14592
|
}
|
|
14579
14593
|
return makeColor(color.kin, components, alpha);
|
|
@@ -15294,12 +15308,12 @@
|
|
|
15294
15308
|
// '\\'
|
|
15295
15309
|
const REVERSE_SOLIDUS = 0x5c;
|
|
15296
15310
|
const flexUnits = ["fr"];
|
|
15297
|
-
const frequencyUnits = ["
|
|
15311
|
+
const frequencyUnits = ["Hz", "kHz"];
|
|
15298
15312
|
const timeUnits = ["ms", "s"];
|
|
15299
15313
|
const angleUnits = ["rad", "turn", "deg", "grad"];
|
|
15300
15314
|
const resolutionUnits = ["dpi", "dpcm", "dppx", "x"];
|
|
15301
15315
|
const dimensionUnits = [
|
|
15302
|
-
"
|
|
15316
|
+
"Q",
|
|
15303
15317
|
"cap",
|
|
15304
15318
|
"ch",
|
|
15305
15319
|
"cm",
|
|
@@ -16983,7 +16997,7 @@
|
|
|
16983
16997
|
}
|
|
16984
16998
|
class ComputePrefixFeature {
|
|
16985
16999
|
get ordering() {
|
|
16986
|
-
return
|
|
17000
|
+
return 0;
|
|
16987
17001
|
}
|
|
16988
17002
|
get processMode() {
|
|
16989
17003
|
return exports.FeatureWalkMode.Pre;
|
|
@@ -17427,10 +17441,10 @@
|
|
|
17427
17441
|
class InlineCssVariablesFeature {
|
|
17428
17442
|
accept = new Set([exports.EnumToken.RuleNodeType, exports.EnumToken.AtRuleNodeType]);
|
|
17429
17443
|
get ordering() {
|
|
17430
|
-
return
|
|
17444
|
+
return 2;
|
|
17431
17445
|
}
|
|
17432
17446
|
get processMode() {
|
|
17433
|
-
return exports.FeatureWalkMode.
|
|
17447
|
+
return exports.FeatureWalkMode.Post;
|
|
17434
17448
|
}
|
|
17435
17449
|
static register(options) {
|
|
17436
17450
|
if (options.inlineCssVariables) {
|
|
@@ -19680,8 +19694,8 @@
|
|
|
19680
19694
|
|
|
19681
19695
|
const propertiesConfig = getConfig();
|
|
19682
19696
|
class PropertyMap {
|
|
19683
|
-
config;
|
|
19684
19697
|
declarations;
|
|
19698
|
+
config;
|
|
19685
19699
|
requiredCount;
|
|
19686
19700
|
pattern;
|
|
19687
19701
|
constructor(config) {
|
|
@@ -19695,7 +19709,7 @@
|
|
|
19695
19709
|
}
|
|
19696
19710
|
add(declaration) {
|
|
19697
19711
|
if (declaration.nam == this.config.shorthand) {
|
|
19698
|
-
this.declarations
|
|
19712
|
+
this.declarations.clear();
|
|
19699
19713
|
this.declarations.set(declaration.nam, declaration);
|
|
19700
19714
|
this.matchTypes(declaration);
|
|
19701
19715
|
}
|
|
@@ -19711,23 +19725,17 @@
|
|
|
19711
19725
|
if (this.declarations.has(this.config.shorthand)) {
|
|
19712
19726
|
const tokens = {};
|
|
19713
19727
|
const values = [];
|
|
19714
|
-
|
|
19715
|
-
this.declarations
|
|
19716
|
-
.get(this.config.shorthand)
|
|
19717
|
-
// @ts-ignore
|
|
19718
|
-
.val.slice()
|
|
19719
|
-
.reduce((acc, curr) => {
|
|
19728
|
+
const val = [[]];
|
|
19729
|
+
for (const curr of this.declarations.get(this.config.shorthand).val) { // @ts-ignore
|
|
19720
19730
|
// @ts-ignore
|
|
19721
19731
|
if (separator != null && separator.typ == curr.typ && separator.val == curr.val) {
|
|
19722
|
-
|
|
19723
|
-
|
|
19732
|
+
val.push([]);
|
|
19733
|
+
continue;
|
|
19724
19734
|
}
|
|
19725
19735
|
// @ts-ignore
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
// @ts-ignore
|
|
19730
|
-
.reduce((acc, list, current) => {
|
|
19736
|
+
val.at(-1).push(curr);
|
|
19737
|
+
}
|
|
19738
|
+
for (let current = 0; current < val.length; current++) {
|
|
19731
19739
|
values.push(...this.pattern.reduce((acc, property) => {
|
|
19732
19740
|
// let current: number = 0;
|
|
19733
19741
|
const props = this.config.properties[property];
|
|
@@ -19742,9 +19750,7 @@
|
|
|
19742
19750
|
// @ts-ignore
|
|
19743
19751
|
acc[i][PROPERTYNAME] == property ||
|
|
19744
19752
|
matchType(acc[i], props)) {
|
|
19745
|
-
if ("prefix" in props &&
|
|
19746
|
-
props.previous != null &&
|
|
19747
|
-
!(props.previous in tokens)) {
|
|
19753
|
+
if ("prefix" in props && props.previous != null && !(props.previous in tokens)) {
|
|
19748
19754
|
return acc;
|
|
19749
19755
|
}
|
|
19750
19756
|
if (!(property in tokens)) {
|
|
@@ -19809,9 +19815,8 @@
|
|
|
19809
19815
|
}
|
|
19810
19816
|
}
|
|
19811
19817
|
return acc;
|
|
19812
|
-
},
|
|
19813
|
-
|
|
19814
|
-
}, []);
|
|
19818
|
+
}, val[current]));
|
|
19819
|
+
}
|
|
19815
19820
|
if (values.length == 0) {
|
|
19816
19821
|
this.declarations = Object.entries(tokens).reduce((acc, curr) => {
|
|
19817
19822
|
acc.set(curr[0], {
|
|
@@ -19871,17 +19876,40 @@
|
|
|
19871
19876
|
}
|
|
19872
19877
|
if (hasMapping) {
|
|
19873
19878
|
const mapped = {};
|
|
19874
|
-
|
|
19875
|
-
|
|
19879
|
+
let key;
|
|
19880
|
+
for (const value of declarations.values()) {
|
|
19881
|
+
key = value.nam;
|
|
19876
19882
|
if (value instanceof PropertyMap) {
|
|
19877
19883
|
for (const [k, v] of value.declarations) {
|
|
19878
|
-
|
|
19884
|
+
if (k == value.config.shorthand) {
|
|
19885
|
+
for (const [key, val] of Object.entries(value.config.properties)) {
|
|
19886
|
+
mapped[key] = cloneNode(v);
|
|
19887
|
+
for (let i = 0; i < v.val.length; i++) {
|
|
19888
|
+
// @ts-ignore
|
|
19889
|
+
if (key == v.val[i][PROPERTYNAME]) {
|
|
19890
|
+
if (mapped[key].val.length > 0) {
|
|
19891
|
+
mapped[key].val.push({
|
|
19892
|
+
typ: exports.EnumToken.WhitespaceTokenType,
|
|
19893
|
+
});
|
|
19894
|
+
}
|
|
19895
|
+
mapped[key].val.push(v.val[i]);
|
|
19896
|
+
}
|
|
19897
|
+
}
|
|
19898
|
+
if (mapped[key].val.length == 0) {
|
|
19899
|
+
mapped[key].val.push(...parseString(value.config.properties[key].default[0]));
|
|
19900
|
+
}
|
|
19901
|
+
}
|
|
19902
|
+
}
|
|
19903
|
+
else {
|
|
19904
|
+
mapped[k] = v;
|
|
19905
|
+
}
|
|
19879
19906
|
}
|
|
19880
19907
|
}
|
|
19881
19908
|
else {
|
|
19882
19909
|
mapped[key] = value;
|
|
19883
19910
|
}
|
|
19884
19911
|
}
|
|
19912
|
+
// console.error(mapped);
|
|
19885
19913
|
if (patterns.length === Object.keys(mapped).length) {
|
|
19886
19914
|
declarations = new Map();
|
|
19887
19915
|
for (const key of patterns) {
|
|
@@ -20337,8 +20365,6 @@
|
|
|
20337
20365
|
}
|
|
20338
20366
|
return acc;
|
|
20339
20367
|
}, []);
|
|
20340
|
-
// console.error({hasMapping, shorthand: this.config.shorthand, requiredCount, isShorthand,
|
|
20341
|
-
// declarations: declarations.values(), values});
|
|
20342
20368
|
if (this.config.mapping != null) {
|
|
20343
20369
|
const val = values.reduce((acc, curr) => acc +
|
|
20344
20370
|
renderValue(curr, {
|
|
@@ -20375,6 +20401,7 @@
|
|
|
20375
20401
|
}
|
|
20376
20402
|
}
|
|
20377
20403
|
const iterators = [];
|
|
20404
|
+
// @ts-ignore
|
|
20378
20405
|
return {
|
|
20379
20406
|
// @ts-ignore
|
|
20380
20407
|
next() {
|
|
@@ -20627,6 +20654,9 @@
|
|
|
20627
20654
|
}
|
|
20628
20655
|
|
|
20629
20656
|
const config = getConfig();
|
|
20657
|
+
/**
|
|
20658
|
+
* Represents a list of property declarations, compute shorthand and remove duplicate declarations.
|
|
20659
|
+
*/
|
|
20630
20660
|
class PropertyList {
|
|
20631
20661
|
options = { removeDuplicateDeclarations: true, computeShorthand: true };
|
|
20632
20662
|
declarations;
|
|
@@ -20701,28 +20731,35 @@
|
|
|
20701
20731
|
// @ts-ignore
|
|
20702
20732
|
shorthand = config.property[propertyName];
|
|
20703
20733
|
}
|
|
20704
|
-
// console.error({shortHandType, propertyName, config: config.map[propertyName], map: config.map[shorthand].properties[propertyName]});
|
|
20705
20734
|
// @ts-ignore
|
|
20706
20735
|
if (shortHandType == "map") {
|
|
20707
20736
|
let owner = this;
|
|
20737
|
+
const mapName =
|
|
20708
20738
|
// @ts-ignore
|
|
20709
|
-
|
|
20739
|
+
config.map[propertyName]?.map ?? config.map[shorthand]?.properties?.[propertyName]?.map;
|
|
20710
20740
|
if (typeof mapName === "string") {
|
|
20711
20741
|
if (!this.declarations.has(mapName)) {
|
|
20712
20742
|
// @ts-ignore
|
|
20713
20743
|
this.declarations.set(mapName, new PropertyMap(config.map[mapName]));
|
|
20714
20744
|
}
|
|
20715
20745
|
owner = this.declarations.get(mapName);
|
|
20716
|
-
// console.error({mapName});
|
|
20717
20746
|
}
|
|
20718
|
-
|
|
20719
|
-
if (!owner.declarations.has(shorthand)) {
|
|
20747
|
+
else if (!this.declarations.has(shorthand)) {
|
|
20720
20748
|
// @ts-ignore
|
|
20721
|
-
|
|
20749
|
+
this.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
|
|
20750
|
+
}
|
|
20751
|
+
if (owner == this) {
|
|
20752
|
+
// @ts-ignore
|
|
20753
|
+
owner.declarations.get(shorthand).add(declaration);
|
|
20754
|
+
}
|
|
20755
|
+
else {
|
|
20756
|
+
if (!owner.declarations.has(shorthand)) {
|
|
20757
|
+
// @ts-ignore
|
|
20758
|
+
owner.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
|
|
20759
|
+
}
|
|
20760
|
+
// @ts-ignore
|
|
20761
|
+
owner.declarations.get(shorthand).add(declaration);
|
|
20722
20762
|
}
|
|
20723
|
-
// console.error({propertyName,mapName, owned: owner == this});
|
|
20724
|
-
// @ts-ignore
|
|
20725
|
-
owner.declarations.get(shorthand).add(declaration);
|
|
20726
20763
|
}
|
|
20727
20764
|
// @ts-ignore
|
|
20728
20765
|
else if (shortHandType == "set") {
|
|
@@ -20809,7 +20846,7 @@
|
|
|
20809
20846
|
[Symbol.iterator]() {
|
|
20810
20847
|
let iterator = this.declarations.values();
|
|
20811
20848
|
const iterators = [];
|
|
20812
|
-
//
|
|
20849
|
+
// @ts-ignore
|
|
20813
20850
|
return {
|
|
20814
20851
|
next() {
|
|
20815
20852
|
let value = iterator.next();
|
|
@@ -20840,7 +20877,7 @@
|
|
|
20840
20877
|
exports.EnumToken.KeyframesRuleNodeType,
|
|
20841
20878
|
]);
|
|
20842
20879
|
get ordering() {
|
|
20843
|
-
return
|
|
20880
|
+
return 5;
|
|
20844
20881
|
}
|
|
20845
20882
|
get processMode() {
|
|
20846
20883
|
return exports.FeatureWalkMode.Post;
|
|
@@ -20859,7 +20896,6 @@
|
|
|
20859
20896
|
const j = ast.chi.length;
|
|
20860
20897
|
let k = 0;
|
|
20861
20898
|
let l;
|
|
20862
|
-
// let properties: PropertyList = new PropertyList(options);
|
|
20863
20899
|
const rules = [];
|
|
20864
20900
|
const declarations = [];
|
|
20865
20901
|
// @ts-ignore
|
|
@@ -20880,7 +20916,6 @@
|
|
|
20880
20916
|
if (node.typ == exports.EnumToken.DeclarationNodeType) {
|
|
20881
20917
|
for (let m = k; m <= l; m++) {
|
|
20882
20918
|
declarations.push(ast.chi[m]);
|
|
20883
|
-
// properties.add(ast.chi![m]);
|
|
20884
20919
|
}
|
|
20885
20920
|
}
|
|
20886
20921
|
else {
|
|
@@ -20890,7 +20925,6 @@
|
|
|
20890
20925
|
}
|
|
20891
20926
|
k = l;
|
|
20892
20927
|
}
|
|
20893
|
-
// console.error([...new PropertyList(options).add(declarations)]);
|
|
20894
20928
|
if (declarations.length > 0) {
|
|
20895
20929
|
ast.chi.length = 0;
|
|
20896
20930
|
// @ts-expect-error
|
|
@@ -21001,7 +21035,7 @@
|
|
|
21001
21035
|
class ComputeCalcExpressionFeature {
|
|
21002
21036
|
accept = new Set([exports.EnumToken.RuleNodeType, exports.EnumToken.AtRuleNodeType]);
|
|
21003
21037
|
get ordering() {
|
|
21004
|
-
return
|
|
21038
|
+
return 3;
|
|
21005
21039
|
}
|
|
21006
21040
|
get processMode() {
|
|
21007
21041
|
return exports.FeatureWalkMode.Post;
|
|
@@ -21026,8 +21060,20 @@
|
|
|
21026
21060
|
continue;
|
|
21027
21061
|
}
|
|
21028
21062
|
if (value.typ == exports.EnumToken.BinaryExpressionTokenType) {
|
|
21029
|
-
|
|
21030
|
-
|
|
21063
|
+
const result = evaluate([value]);
|
|
21064
|
+
try {
|
|
21065
|
+
// @ts-ignore
|
|
21066
|
+
replaceNodeOrValue(parent, value, result);
|
|
21067
|
+
}
|
|
21068
|
+
catch (e) {
|
|
21069
|
+
// @ts-ignore
|
|
21070
|
+
if (Array.isArray(parent.chi)) {
|
|
21071
|
+
// @ts-ignore
|
|
21072
|
+
parent.chi.length = 0;
|
|
21073
|
+
// @ts-ignore
|
|
21074
|
+
parent.chi.push(...result);
|
|
21075
|
+
}
|
|
21076
|
+
}
|
|
21031
21077
|
continue;
|
|
21032
21078
|
}
|
|
21033
21079
|
if (value != null && tokensfuncSet.has(value.typ)) {
|
|
@@ -21045,7 +21091,7 @@
|
|
|
21045
21091
|
? value.val
|
|
21046
21092
|
: value.chi;
|
|
21047
21093
|
const values = evaluate(cp);
|
|
21048
|
-
// fix a + -b
|
|
21094
|
+
// fix a + -b into a - b
|
|
21049
21095
|
for (const { value, parent: p } of walkValues(values)) {
|
|
21050
21096
|
if (value.typ === exports.EnumToken.BinaryExpressionTokenType) {
|
|
21051
21097
|
if (value.op === exports.EnumToken.Add &&
|
|
@@ -22311,7 +22357,7 @@
|
|
|
22311
22357
|
exports.EnumToken.KeyframesRuleNodeType,
|
|
22312
22358
|
]);
|
|
22313
22359
|
get ordering() {
|
|
22314
|
-
return
|
|
22360
|
+
return 4;
|
|
22315
22361
|
}
|
|
22316
22362
|
get processMode() {
|
|
22317
22363
|
return exports.FeatureWalkMode.Post;
|
|
@@ -22714,7 +22760,7 @@
|
|
|
22714
22760
|
class ExpandIfFeature {
|
|
22715
22761
|
accept = new Set([exports.EnumToken.DeclarationNodeType]);
|
|
22716
22762
|
get ordering() {
|
|
22717
|
-
return
|
|
22763
|
+
return 1;
|
|
22718
22764
|
}
|
|
22719
22765
|
get processMode() {
|
|
22720
22766
|
return exports.FeatureWalkMode.Pre;
|
|
@@ -23516,7 +23562,8 @@
|
|
|
23516
23562
|
previous = node;
|
|
23517
23563
|
nodeIndex = i;
|
|
23518
23564
|
}
|
|
23519
|
-
|
|
23565
|
+
// @ts-ignore
|
|
23566
|
+
if (recursive && node != null && node.chi != null) {
|
|
23520
23567
|
if (node.typ == exports.EnumToken.KeyframesAtRuleNodeType ||
|
|
23521
23568
|
!node.chi.some((n) => n.typ == exports.EnumToken.DeclarationNodeType)) {
|
|
23522
23569
|
if (!(node.typ == exports.EnumToken.AtRuleNodeType && node.nam != "font-face")) {
|
|
@@ -25349,6 +25396,7 @@
|
|
|
25349
25396
|
removeEmpty: false,
|
|
25350
25397
|
removeComments: false,
|
|
25351
25398
|
}),
|
|
25399
|
+
minifyValues: true,
|
|
25352
25400
|
sourcemap: false,
|
|
25353
25401
|
convertColor: true,
|
|
25354
25402
|
expandNestingRules: false,
|
|
@@ -25588,7 +25636,7 @@
|
|
|
25588
25636
|
const indentSub = indents[level + 1];
|
|
25589
25637
|
switch (data.typ) {
|
|
25590
25638
|
case exports.EnumToken.DeclarationNodeType:
|
|
25591
|
-
return `${data.nam}:${options.indent}${(options.
|
|
25639
|
+
return `${data.nam}:${options.indent}${(options.minifyValues
|
|
25592
25640
|
? filterValues(data.val)
|
|
25593
25641
|
: data.val).reduce(reducer, "")}`;
|
|
25594
25642
|
case exports.EnumToken.CommentNodeType:
|
|
@@ -25643,7 +25691,7 @@
|
|
|
25643
25691
|
: node.val;
|
|
25644
25692
|
}
|
|
25645
25693
|
else if (node.typ == exports.EnumToken.DeclarationNodeType) {
|
|
25646
|
-
str = `${node.nam}:${options.indent}${(options.
|
|
25694
|
+
str = `${node.nam}:${options.indent}${(options.minifyValues
|
|
25647
25695
|
? filterValues(node.val)
|
|
25648
25696
|
: node.val)
|
|
25649
25697
|
.reduce(reducer, "")
|
|
@@ -25711,9 +25759,10 @@
|
|
|
25711
25759
|
function renderValue(token, options = {}, cache = Object.create(null), reducer, errors) {
|
|
25712
25760
|
if (token.typ === exports.EnumToken.WhenElseFunctionTokenType &&
|
|
25713
25761
|
equalsIgnoreCase(token.val, "supports")) {
|
|
25714
|
-
options = { ...options, minify: false, convertColor: false };
|
|
25762
|
+
options = { ...options, minifyValues: false, minify: false, convertColor: false };
|
|
25715
25763
|
reducer = null;
|
|
25716
25764
|
}
|
|
25765
|
+
options.minifyValues ??= options.minify;
|
|
25717
25766
|
if (reducer == null) {
|
|
25718
25767
|
reducer = function (acc, curr) {
|
|
25719
25768
|
if (curr.typ == exports.EnumToken.CommentTokenType && options.removeComments) {
|
|
@@ -25870,7 +25919,7 @@
|
|
|
25870
25919
|
")");
|
|
25871
25920
|
}
|
|
25872
25921
|
case exports.EnumToken.UrlFunctionTokenType:
|
|
25873
|
-
if (options.
|
|
25922
|
+
if (options.minifyValues && token.typ === exports.EnumToken.UrlFunctionTokenType) {
|
|
25874
25923
|
if (token.chi[0]?.typ === exports.EnumToken.BadUrlTokenType) {
|
|
25875
25924
|
return "url()";
|
|
25876
25925
|
}
|
|
@@ -25891,7 +25940,7 @@
|
|
|
25891
25940
|
case exports.EnumToken.FunctionTokenType:
|
|
25892
25941
|
case exports.EnumToken.MathFunctionTokenType:
|
|
25893
25942
|
case exports.EnumToken.ImageFunctionTokenType:
|
|
25894
|
-
if (options.
|
|
25943
|
+
if (options.minifyValues && token.typ === exports.EnumToken.ImageFunctionTokenType) {
|
|
25895
25944
|
const slice = token.chi.slice();
|
|
25896
25945
|
switch (token.val) {
|
|
25897
25946
|
case "linear-gradient":
|
|
@@ -26377,37 +26426,7 @@
|
|
|
26377
26426
|
renderValue(curr, token.typ == exports.EnumToken.FunctionTokenType ? { minify: false } : options, cache, reducer), "") +
|
|
26378
26427
|
")");
|
|
26379
26428
|
}
|
|
26380
|
-
return (
|
|
26381
|
-
/* options.minify && 'Pseudo-class-func' == token.typ && token.val.slice(0, 2) == '::' ? token.val.slice(1) :*/ (token.val ?? "") +
|
|
26382
|
-
"(" +
|
|
26383
|
-
token.chi.reduce(reducer, "") +
|
|
26384
|
-
")");
|
|
26385
|
-
// case EnumToken.MatchExpressionTokenType:
|
|
26386
|
-
// return (
|
|
26387
|
-
// renderValue((token as MatchExpressionToken).l as Token, options, cache, reducer, errors) +
|
|
26388
|
-
// renderValue((token as MatchExpressionToken).op, options, cache, reducer, errors) +
|
|
26389
|
-
// renderValue((token as MatchExpressionToken).r, options, cache, reducer, errors) +
|
|
26390
|
-
// ((token as MatchExpressionToken).attr ? " " + (token as MatchExpressionToken).attr : "")
|
|
26391
|
-
// );
|
|
26392
|
-
// case EnumToken.NameSpaceAttributeTokenType:
|
|
26393
|
-
// return (
|
|
26394
|
-
// ((token as NameSpaceAttributeToken).l == null
|
|
26395
|
-
// ? ""
|
|
26396
|
-
// : renderValue((token as NameSpaceAttributeToken).l as Token, options, cache, reducer, errors)) +
|
|
26397
|
-
// "|" +
|
|
26398
|
-
// renderValue((token as NameSpaceAttributeToken).r, options, cache, reducer, errors)
|
|
26399
|
-
// );
|
|
26400
|
-
// case EnumToken.ComposesSelectorNodeType:
|
|
26401
|
-
// return (
|
|
26402
|
-
// (token as ComposesSelectorToken).l.reduce(
|
|
26403
|
-
// (acc: string, curr: Token) => acc + renderValue(curr, options, cache),
|
|
26404
|
-
// "",
|
|
26405
|
-
// ) +
|
|
26406
|
-
// ((token as ComposesSelectorToken).r == null
|
|
26407
|
-
// ? ""
|
|
26408
|
-
// : " from " +
|
|
26409
|
-
// renderValue((token as ComposesSelectorToken).r as Token, options, cache, reducer, errors))
|
|
26410
|
-
// );
|
|
26429
|
+
return (token.val ?? "") + "(" + token.chi.reduce(reducer, "") + ")";
|
|
26411
26430
|
case exports.EnumToken.BlockStartTokenType:
|
|
26412
26431
|
return "{";
|
|
26413
26432
|
case exports.EnumToken.BlockEndTokenType:
|
|
@@ -26556,7 +26575,11 @@
|
|
|
26556
26575
|
const perc = token.val.typ == exports.EnumToken.FractionTokenType
|
|
26557
26576
|
? renderValue(token.val, options, cache)
|
|
26558
26577
|
: minifyNumber(token.val);
|
|
26559
|
-
return options.
|
|
26578
|
+
return options.minifyValues && perc == "0"
|
|
26579
|
+
? "0"
|
|
26580
|
+
: perc.includes("/")
|
|
26581
|
+
? perc.replace("/", uni + "/")
|
|
26582
|
+
: perc + uni;
|
|
26560
26583
|
case exports.EnumToken.NumberTokenType:
|
|
26561
26584
|
return token.val.typ == exports.EnumToken.FractionTokenType
|
|
26562
26585
|
? renderValue(token.val, options, cache)
|
|
@@ -26621,7 +26644,7 @@
|
|
|
26621
26644
|
case exports.EnumToken.DeclarationNodeType:
|
|
26622
26645
|
return (token.nam +
|
|
26623
26646
|
":" +
|
|
26624
|
-
(options.
|
|
26647
|
+
(options.minifyValues ? filterValues(token.val) : token.val).reduce((acc, curr) => acc + renderValue(curr, options, cache), ""));
|
|
26625
26648
|
case exports.EnumToken.MediaQueryUnaryFeatureTokenType:
|
|
26626
26649
|
return (renderValue(token.l, options, cache, reducer) +
|
|
26627
26650
|
" " +
|
|
@@ -26695,6 +26718,7 @@
|
|
|
26695
26718
|
}
|
|
26696
26719
|
|
|
26697
26720
|
const SymbolsMapTokens = Object.create(null);
|
|
26721
|
+
const SymbolsMapTokensLower = Object.create(null);
|
|
26698
26722
|
// Regex for escape sequence decoding - compile once, reuse many times
|
|
26699
26723
|
const ESCAPE_SEQUENCE_REGEX = /\\((\n|\r|\f|\v|\u2028|\u2029|([0-9a-fA-F]{1,6})) ?)/gms;
|
|
26700
26724
|
function decodeEscapeSequences(value) {
|
|
@@ -26723,7 +26747,9 @@
|
|
|
26723
26747
|
}
|
|
26724
26748
|
function assignTokenMap(entries, tokenType, suffix = "", lowercase = false) {
|
|
26725
26749
|
for (const entry of entries) {
|
|
26726
|
-
|
|
26750
|
+
const key = (lowercase ? entry.toLowerCase() : entry) + suffix;
|
|
26751
|
+
SymbolsMapTokens[key] = tokenType;
|
|
26752
|
+
SymbolsMapTokensLower[key.toLowerCase()] = tokenType;
|
|
26727
26753
|
}
|
|
26728
26754
|
}
|
|
26729
26755
|
SymbolsMapTokens[""] = exports.EnumToken.DelimTokenType;
|
|
@@ -26823,20 +26849,24 @@
|
|
|
26823
26849
|
})(TokenMap || (TokenMap = {}));
|
|
26824
26850
|
function getSymbolHint(parseInfo, start, end) {
|
|
26825
26851
|
const len = end - start;
|
|
26826
|
-
|
|
26827
|
-
// Early exit for impossible lengths
|
|
26828
|
-
if (len < 0)
|
|
26852
|
+
if (len <= 0)
|
|
26829
26853
|
return null;
|
|
26854
|
+
const value = parseInfo.stream.slice(start, end);
|
|
26855
|
+
// Direct lookup handles the hottest punctuation and keyword cases without
|
|
26856
|
+
// scanning the entire symbol table on every token.
|
|
26857
|
+
const match = SymbolsMapTokens[value] ?? SymbolsMapTokensLower[value.toLowerCase()];
|
|
26858
|
+
if (match != null) {
|
|
26859
|
+
return match;
|
|
26860
|
+
}
|
|
26861
|
+
const keysLength = SymbolsMapTokensKeys.length;
|
|
26830
26862
|
for (let i = 0; i < keysLength; i++) {
|
|
26831
26863
|
const key = SymbolsMapTokensKeys[i];
|
|
26832
26864
|
if (key.length !== len)
|
|
26833
26865
|
continue;
|
|
26834
|
-
// Match character by character
|
|
26835
26866
|
let match = true;
|
|
26836
26867
|
for (let j = 0; j < len; j++) {
|
|
26837
26868
|
let ca = key.charCodeAt(j);
|
|
26838
|
-
let cb =
|
|
26839
|
-
// Normalize A-Z to a-z
|
|
26869
|
+
let cb = value.charCodeAt(j);
|
|
26840
26870
|
if (ca >= 65 && ca <= 90)
|
|
26841
26871
|
ca += 32;
|
|
26842
26872
|
if (cb >= 65 && cb <= 90)
|
|
@@ -26854,32 +26884,29 @@
|
|
|
26854
26884
|
}
|
|
26855
26885
|
function searchArray(array, parseInfo, start, end) {
|
|
26856
26886
|
const len = end - start;
|
|
26857
|
-
|
|
26858
|
-
if (len < 0)
|
|
26887
|
+
if (len <= 0)
|
|
26859
26888
|
return null;
|
|
26860
|
-
|
|
26861
|
-
let
|
|
26862
|
-
|
|
26863
|
-
|
|
26889
|
+
let match;
|
|
26890
|
+
let item;
|
|
26891
|
+
for (let i = 0; i < array.length; i++) {
|
|
26892
|
+
item = array[i];
|
|
26893
|
+
if (item.length !== len)
|
|
26864
26894
|
continue;
|
|
26865
|
-
|
|
26866
|
-
let match = true;
|
|
26867
|
-
const arrayItem = array[i];
|
|
26895
|
+
match = true;
|
|
26868
26896
|
for (let j = 0; j < len; j++) {
|
|
26869
|
-
let ca =
|
|
26870
|
-
let cb =
|
|
26871
|
-
// Normalize A-Z to a-z
|
|
26897
|
+
let ca = parseInfo.stream.charCodeAt(start + j);
|
|
26898
|
+
let cb = item.charCodeAt(j);
|
|
26872
26899
|
if (ca >= 65 && ca <= 90)
|
|
26873
26900
|
ca += 32;
|
|
26874
26901
|
if (cb >= 65 && cb <= 90)
|
|
26875
26902
|
cb += 32;
|
|
26876
|
-
if (ca
|
|
26903
|
+
if (ca !== cb) {
|
|
26877
26904
|
match = false;
|
|
26878
26905
|
break;
|
|
26879
26906
|
}
|
|
26880
26907
|
}
|
|
26881
26908
|
if (match) {
|
|
26882
|
-
return
|
|
26909
|
+
return item;
|
|
26883
26910
|
}
|
|
26884
26911
|
}
|
|
26885
26912
|
return null;
|
|
@@ -27817,23 +27844,6 @@
|
|
|
27817
27844
|
}
|
|
27818
27845
|
return true;
|
|
27819
27846
|
}
|
|
27820
|
-
/**
|
|
27821
|
-
*
|
|
27822
|
-
* @param parseInfo
|
|
27823
|
-
* @returns
|
|
27824
|
-
*/
|
|
27825
|
-
// isPseudo(parseInfo: ParseInfo): boolean {
|
|
27826
|
-
// let position: number = parseInfo.currentPosition - parseInfo.offset;
|
|
27827
|
-
// let endPosition: number = parseInfo.currentPosition - parseInfo.offset;
|
|
27828
|
-
// return (parseInfo.stream.charAt(position) == ":" &&
|
|
27829
|
-
// parseInfo.stream.charAt(endPosition - 1) == "(" &&
|
|
27830
|
-
// (parseInfo.stream.charAt(position + 1) == ":"
|
|
27831
|
-
// ? this.isIdentToken(parseInfo, 2, -1)
|
|
27832
|
-
// : this.isIdentToken(parseInfo, 1, -1))) ||
|
|
27833
|
-
// parseInfo.stream.charAt(position + 1) == ":"
|
|
27834
|
-
// ? this.isIdentToken(parseInfo, 2)
|
|
27835
|
-
// : this.isIdentToken(parseInfo, 1);
|
|
27836
|
-
// }
|
|
27837
27847
|
/**
|
|
27838
27848
|
*
|
|
27839
27849
|
* @param parseInfo
|
|
@@ -27964,28 +27974,28 @@
|
|
|
27964
27974
|
// EOF
|
|
27965
27975
|
switch (charCode) {
|
|
27966
27976
|
case 61 /* TokenMap.EQUALS */:
|
|
27967
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
27968
|
-
|
|
27969
|
-
}
|
|
27977
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
27978
|
+
// return this.makeToken(parseInfo);
|
|
27979
|
+
// }
|
|
27970
27980
|
this.advance(parseInfo);
|
|
27971
27981
|
return this.makeToken(parseInfo, exports.EnumToken.DelimTokenType);
|
|
27972
27982
|
// '+' or '-'
|
|
27973
27983
|
case 43 /* TokenMap.PLUS */:
|
|
27974
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
27975
|
-
|
|
27976
|
-
}
|
|
27984
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
27985
|
+
// return this.makeToken(parseInfo);
|
|
27986
|
+
// }
|
|
27977
27987
|
this.advance(parseInfo);
|
|
27978
27988
|
charCode = parseInfo.stream.charCodeAt(parseInfo.currentPosition - parseInfo.offset);
|
|
27979
|
-
if (isDigit(charCode)) {
|
|
27980
|
-
|
|
27981
|
-
|
|
27982
|
-
|
|
27983
|
-
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
27987
|
-
|
|
27988
|
-
}
|
|
27989
|
+
// if (isDigit(charCode)) {
|
|
27990
|
+
// tokensCount = this.consumeNumericToken(parseInfo);
|
|
27991
|
+
// if (tokensCount > 0) {
|
|
27992
|
+
// this.advance(parseInfo, tokensCount);
|
|
27993
|
+
// return this.makeToken(parseInfo, this.hint ?? EnumToken.NumberTokenType, {
|
|
27994
|
+
// slice: this.slice,
|
|
27995
|
+
// sign: "+",
|
|
27996
|
+
// });
|
|
27997
|
+
// }
|
|
27998
|
+
// }
|
|
27989
27999
|
return this.makeToken(parseInfo, exports.EnumToken.Plus);
|
|
27990
28000
|
case 45 /* TokenMap.MINUS */:
|
|
27991
28001
|
if (parseInfo.position == parseInfo.currentPosition) {
|
|
@@ -27995,15 +28005,17 @@
|
|
|
27995
28005
|
this.advance(parseInfo);
|
|
27996
28006
|
return this.makeToken(parseInfo, exports.EnumToken.Sub);
|
|
27997
28007
|
}
|
|
27998
|
-
if (
|
|
27999
|
-
|
|
28000
|
-
|
|
28001
|
-
|
|
28002
|
-
|
|
28003
|
-
|
|
28004
|
-
|
|
28005
|
-
|
|
28006
|
-
|
|
28008
|
+
// if (
|
|
28009
|
+
// charCode == TokenMap.MINUS &&
|
|
28010
|
+
// (nextCharCode == TokenMap.MINUS || isIdentStart(nextCharCode))
|
|
28011
|
+
// ) {
|
|
28012
|
+
// this.advance(parseInfo);
|
|
28013
|
+
// tokensCount = this.consumeIdentToken(parseInfo);
|
|
28014
|
+
// if (tokensCount > 0) {
|
|
28015
|
+
// this.advance(parseInfo, tokensCount);
|
|
28016
|
+
// return this.makeToken(parseInfo, EnumToken.IdenTokenType);
|
|
28017
|
+
// }
|
|
28018
|
+
// }
|
|
28007
28019
|
}
|
|
28008
28020
|
this.advance(parseInfo);
|
|
28009
28021
|
break;
|
|
@@ -28056,28 +28068,28 @@
|
|
|
28056
28068
|
return this.makeToken(parseInfo, exports.EnumToken.EndParensTokenType);
|
|
28057
28069
|
// '['
|
|
28058
28070
|
case 91 /* TokenMap.LEFT_BRACKETS */:
|
|
28059
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28060
|
-
|
|
28061
|
-
}
|
|
28071
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28072
|
+
// return this.makeToken(parseInfo);
|
|
28073
|
+
// }
|
|
28062
28074
|
this.advance(parseInfo);
|
|
28063
28075
|
return this.makeToken(parseInfo, exports.EnumToken.AttrStartTokenType);
|
|
28064
28076
|
// ']'
|
|
28065
28077
|
case 93 /* TokenMap.RIGHT_BRACKETS */:
|
|
28066
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28067
|
-
|
|
28068
|
-
}
|
|
28078
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28079
|
+
// return this.makeToken(parseInfo);
|
|
28080
|
+
// }
|
|
28069
28081
|
this.advance(parseInfo);
|
|
28070
28082
|
return this.makeToken(parseInfo, exports.EnumToken.AttrEndTokenType);
|
|
28071
28083
|
case 59 /* TokenMap.SEMICOLON */:
|
|
28072
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28073
|
-
|
|
28074
|
-
}
|
|
28084
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28085
|
+
// return this.makeToken(parseInfo);
|
|
28086
|
+
// }
|
|
28075
28087
|
this.advance(parseInfo);
|
|
28076
28088
|
return this.makeToken(parseInfo, exports.EnumToken.SemiColonTokenType);
|
|
28077
28089
|
case 58 /* TokenMap.COLON */:
|
|
28078
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28079
|
-
|
|
28080
|
-
}
|
|
28090
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28091
|
+
// return this.makeToken(parseInfo);
|
|
28092
|
+
// }
|
|
28081
28093
|
this.advance(parseInfo);
|
|
28082
28094
|
if (this.peekCharCode(parseInfo) == 58 /* TokenMap.COLON */) {
|
|
28083
28095
|
this.advance(parseInfo);
|
|
@@ -28109,15 +28121,15 @@
|
|
|
28109
28121
|
}
|
|
28110
28122
|
return this.makeToken(parseInfo, exports.EnumToken.WhitespaceTokenType);
|
|
28111
28123
|
case 44 /* TokenMap.COMMA */:
|
|
28112
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28113
|
-
|
|
28114
|
-
}
|
|
28124
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28125
|
+
// return this.makeToken(parseInfo);
|
|
28126
|
+
// }
|
|
28115
28127
|
this.advance(parseInfo);
|
|
28116
28128
|
return this.makeToken(parseInfo, exports.EnumToken.CommaTokenType);
|
|
28117
28129
|
case 36 /* TokenMap.DOLLAR */:
|
|
28118
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28119
|
-
|
|
28120
|
-
}
|
|
28130
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28131
|
+
// return this.makeToken(parseInfo);
|
|
28132
|
+
// }
|
|
28121
28133
|
if (this.match(parseInfo, "$=")) {
|
|
28122
28134
|
this.advance(parseInfo, 2);
|
|
28123
28135
|
return this.makeToken(parseInfo, exports.EnumToken.EndMatchTokenType);
|
|
@@ -28125,9 +28137,9 @@
|
|
|
28125
28137
|
this.advance(parseInfo);
|
|
28126
28138
|
break;
|
|
28127
28139
|
case 126 /* TokenMap.TILDA */:
|
|
28128
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28129
|
-
|
|
28130
|
-
}
|
|
28140
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28141
|
+
// return this.makeToken(parseInfo);
|
|
28142
|
+
// }
|
|
28131
28143
|
if (this.match(parseInfo, "~=")) {
|
|
28132
28144
|
this.advance(parseInfo, 2);
|
|
28133
28145
|
return this.makeToken(parseInfo, exports.EnumToken.IncludeMatchTokenType);
|
|
@@ -28136,9 +28148,9 @@
|
|
|
28136
28148
|
return this.makeToken(parseInfo, exports.EnumToken.Tilda);
|
|
28137
28149
|
// case '^':
|
|
28138
28150
|
case 94 /* TokenMap.CARET */:
|
|
28139
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28140
|
-
|
|
28141
|
-
}
|
|
28151
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28152
|
+
// return this.makeToken(parseInfo);
|
|
28153
|
+
// }
|
|
28142
28154
|
if (this.match(parseInfo, "^=")) {
|
|
28143
28155
|
this.advance(parseInfo, 2);
|
|
28144
28156
|
return this.makeToken(parseInfo, exports.EnumToken.StartMatchTokenType);
|
|
@@ -28146,9 +28158,9 @@
|
|
|
28146
28158
|
this.advance(parseInfo);
|
|
28147
28159
|
break;
|
|
28148
28160
|
case 42 /* TokenMap.STAR */:
|
|
28149
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28150
|
-
|
|
28151
|
-
}
|
|
28161
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28162
|
+
// return this.makeToken(parseInfo);
|
|
28163
|
+
// }
|
|
28152
28164
|
if (this.match(parseInfo, "*=")) {
|
|
28153
28165
|
this.advance(parseInfo, 2);
|
|
28154
28166
|
return this.makeToken(parseInfo, exports.EnumToken.ContainMatchTokenType);
|
|
@@ -28162,9 +28174,9 @@
|
|
|
28162
28174
|
this.advance(parseInfo);
|
|
28163
28175
|
return this.makeToken(parseInfo, exports.EnumToken.NestingSelectorTokenType);
|
|
28164
28176
|
case 124 /* TokenMap.PIPE */:
|
|
28165
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28166
|
-
|
|
28167
|
-
}
|
|
28177
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28178
|
+
// return this.makeToken(parseInfo);
|
|
28179
|
+
// }
|
|
28168
28180
|
// '||'
|
|
28169
28181
|
if (this.match(parseInfo, "||")) {
|
|
28170
28182
|
this.advance(parseInfo, 2);
|
|
@@ -28187,9 +28199,9 @@
|
|
|
28187
28199
|
this.advance(parseInfo);
|
|
28188
28200
|
break;
|
|
28189
28201
|
case 47 /* TokenMap.SLASH */:
|
|
28190
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28191
|
-
|
|
28192
|
-
}
|
|
28202
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28203
|
+
// return this.makeToken(parseInfo);
|
|
28204
|
+
// }
|
|
28193
28205
|
if (!this.match(parseInfo, "/*")) {
|
|
28194
28206
|
this.advance(parseInfo);
|
|
28195
28207
|
return this.makeToken(parseInfo, getSymbolHint(parseInfo, parseInfo.position - parseInfo.offset, parseInfo.currentPosition - parseInfo.offset));
|
|
@@ -28208,9 +28220,9 @@
|
|
|
28208
28220
|
}
|
|
28209
28221
|
break;
|
|
28210
28222
|
case 62 /* TokenMap.GREATERTHAN */:
|
|
28211
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28212
|
-
|
|
28213
|
-
}
|
|
28223
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28224
|
+
// return this.makeToken(parseInfo);
|
|
28225
|
+
// }
|
|
28214
28226
|
if (this.match(parseInfo, ">=")) {
|
|
28215
28227
|
this.advance(parseInfo, 2);
|
|
28216
28228
|
return this.makeToken(parseInfo, exports.EnumToken.GteTokenType);
|
|
@@ -28249,20 +28261,11 @@
|
|
|
28249
28261
|
this.advance(parseInfo);
|
|
28250
28262
|
break;
|
|
28251
28263
|
case 92 /* TokenMap.REVERSE_SOLIDUS */:
|
|
28252
|
-
// if (!yieldEOFToken && parseInfo.stream.length == parseInfo.currentPosition - parseInfo.offset + 1) {
|
|
28253
|
-
// break;
|
|
28254
|
-
// }
|
|
28255
28264
|
this.advance(parseInfo);
|
|
28256
28265
|
// EOF
|
|
28257
|
-
|
|
28258
|
-
|
|
28259
|
-
|
|
28260
|
-
// }
|
|
28261
|
-
// end of stream ignore \\
|
|
28262
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28263
|
-
return this.makeToken(parseInfo);
|
|
28264
|
-
}
|
|
28265
|
-
break;
|
|
28266
|
+
// end of stream ignore \\
|
|
28267
|
+
if (!this.peek(parseInfo) && parseInfo.position < parseInfo.currentPosition) {
|
|
28268
|
+
return this.makeToken(parseInfo);
|
|
28266
28269
|
}
|
|
28267
28270
|
this.advance(parseInfo);
|
|
28268
28271
|
break;
|
|
@@ -28275,9 +28278,9 @@
|
|
|
28275
28278
|
case 46 /* TokenMap.DOT */:
|
|
28276
28279
|
const codepoint = parseInfo.stream.charCodeAt(parseInfo.currentPosition - parseInfo.offset + 1);
|
|
28277
28280
|
if (isIdentStart(codepoint) || codepoint == 45 /* TokenMap.MINUS */) {
|
|
28278
|
-
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28279
|
-
|
|
28280
|
-
}
|
|
28281
|
+
// if (parseInfo.position < parseInfo.currentPosition) {
|
|
28282
|
+
// return this.makeToken(parseInfo);
|
|
28283
|
+
// }
|
|
28281
28284
|
this.advance(parseInfo);
|
|
28282
28285
|
let tokensCount = this.consumeIdentToken(parseInfo);
|
|
28283
28286
|
if (tokensCount > 0) {
|
|
@@ -28285,27 +28288,22 @@
|
|
|
28285
28288
|
return this.makeToken(parseInfo, exports.EnumToken.ClassSelectorTokenType);
|
|
28286
28289
|
}
|
|
28287
28290
|
}
|
|
28288
|
-
if (!isDigit(codepoint) && parseInfo.position !== parseInfo.currentPosition) {
|
|
28289
|
-
|
|
28290
|
-
|
|
28291
|
-
|
|
28292
|
-
}
|
|
28291
|
+
// if (!isDigit(codepoint) && parseInfo.position !== parseInfo.currentPosition) {
|
|
28292
|
+
// this.makeToken(parseInfo);
|
|
28293
|
+
// this.advance(parseInfo, 2);
|
|
28294
|
+
// return this;
|
|
28295
|
+
// }
|
|
28293
28296
|
this.advance(parseInfo);
|
|
28294
28297
|
break;
|
|
28295
28298
|
default:
|
|
28296
28299
|
this.advance(parseInfo);
|
|
28297
28300
|
break;
|
|
28298
28301
|
}
|
|
28299
|
-
// if (!yieldEOFToken && endPosition <= parseInfo.currentPosition - parseInfo.offset + 1) {
|
|
28300
|
-
// break;
|
|
28301
|
-
// }
|
|
28302
28302
|
}
|
|
28303
|
-
// if (yieldEOFToken) {
|
|
28304
28303
|
if (parseInfo.position < parseInfo.currentPosition) {
|
|
28305
28304
|
return this.makeToken(parseInfo);
|
|
28306
28305
|
}
|
|
28307
28306
|
return this.makeToken(parseInfo, exports.EnumToken.EOFTokenType);
|
|
28308
|
-
// }
|
|
28309
28307
|
}
|
|
28310
28308
|
/**
|
|
28311
28309
|
* tokenize readable stream
|
|
@@ -31079,6 +31077,7 @@
|
|
|
31079
31077
|
if (options.expandNestingRules) {
|
|
31080
31078
|
options.nestingRules = false;
|
|
31081
31079
|
}
|
|
31080
|
+
options.minifyAST ??= options.minify;
|
|
31082
31081
|
const startTime = performance.now();
|
|
31083
31082
|
const errors = [];
|
|
31084
31083
|
const stack = [];
|
|
@@ -31458,7 +31457,7 @@
|
|
|
31458
31457
|
}
|
|
31459
31458
|
}
|
|
31460
31459
|
}
|
|
31461
|
-
if (options.
|
|
31460
|
+
if (options.minifyAST) {
|
|
31462
31461
|
if (ast.chi.length > 0) {
|
|
31463
31462
|
let passes = options.pass ?? 1;
|
|
31464
31463
|
while (passes--) {
|
|
@@ -31998,6 +31997,7 @@
|
|
|
31998
31997
|
lenient: true,
|
|
31999
31998
|
...options,
|
|
32000
31999
|
};
|
|
32000
|
+
options.minifyAST ??= options.minify;
|
|
32001
32001
|
if (typeof options.validation !== "boolean") {
|
|
32002
32002
|
options.validation = !!options.validation;
|
|
32003
32003
|
}
|
|
@@ -32452,7 +32452,7 @@
|
|
|
32452
32452
|
}
|
|
32453
32453
|
}
|
|
32454
32454
|
}
|
|
32455
|
-
if (options.
|
|
32455
|
+
if (options.minifyAST) {
|
|
32456
32456
|
if (ast.chi.length > 0) {
|
|
32457
32457
|
let passes = options.pass ?? 1;
|
|
32458
32458
|
while (passes--) {
|
|
@@ -34842,6 +34842,7 @@
|
|
|
34842
34842
|
});
|
|
34843
34843
|
}
|
|
34844
34844
|
|
|
34845
|
+
exports.PropertyList = PropertyList;
|
|
34845
34846
|
exports.SourceMap = SourceMap;
|
|
34846
34847
|
exports.cloneNode = cloneNode;
|
|
34847
34848
|
exports.convertColor = convertColor;
|