@tbela99/css-parser 1.6.9 → 1.7.0
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 +12 -1
- package/dist/index-umd-web.js +221 -244
- package/dist/index.cjs +220 -243
- package/dist/index.d.ts +8 -1
- package/dist/package.json.js +2 -2
- package/dist/src/data/properties.json.js +1 -1
- package/dist/src/data/validation.json.js +8 -2
- package/dist/src/lib/ast/clone.js +1 -1
- package/dist/src/lib/ast/expand.js +1 -1
- package/dist/src/lib/ast/features/calc.js +1 -1
- package/dist/src/lib/ast/features/if.js +1 -1
- package/dist/src/lib/ast/features/index.js +1 -1
- package/dist/src/lib/ast/features/inlinecssvariables.js +1 -1
- package/dist/src/lib/ast/features/prefix.js +1 -1
- package/dist/src/lib/ast/features/shorthand.js +39 -22
- package/dist/src/lib/ast/features/transform.js +1 -1
- package/dist/src/lib/ast/features/type.js +1 -1
- package/dist/src/lib/ast/find.js +1 -1
- package/dist/src/lib/ast/math/expression.js +1 -1
- package/dist/src/lib/ast/math/math.js +1 -1
- package/dist/src/lib/ast/minify.js +31 -3
- package/dist/src/lib/ast/node.js +1 -1
- package/dist/src/lib/ast/transform/compute.js +1 -1
- package/dist/src/lib/ast/transform/matrix.js +1 -1
- package/dist/src/lib/ast/transform/minify.js +1 -1
- package/dist/src/lib/ast/transform/perspective.js +1 -1
- package/dist/src/lib/ast/transform/rotate.js +1 -1
- package/dist/src/lib/ast/transform/scale.js +1 -1
- package/dist/src/lib/ast/transform/skew.js +1 -1
- package/dist/src/lib/ast/transform/translate.js +1 -1
- package/dist/src/lib/ast/transform/utils.js +1 -1
- package/dist/src/lib/ast/types.js +1 -1
- package/dist/src/lib/ast/walk.js +1 -1
- package/dist/src/lib/fs/resolve.js +1 -1
- package/dist/src/lib/parser/declaration/list.js +11 -1
- package/dist/src/lib/parser/declaration/map.js +2 -2
- package/dist/src/lib/parser/declaration/set.js +1 -1
- package/dist/src/lib/parser/linesmap.js +1 -1
- package/dist/src/lib/parser/parse.js +9 -18
- package/dist/src/lib/parser/source.js +1 -1
- package/dist/src/lib/parser/tokenize.js +1 -1
- package/dist/src/lib/parser/utils/angle.js +1 -1
- package/dist/src/lib/parser/utils/at-rule-container.js +1 -1
- package/dist/src/lib/parser/utils/at-rule-font-feature-values.js +1 -1
- package/dist/src/lib/parser/utils/at-rule-generic.js +1 -1
- package/dist/src/lib/parser/utils/at-rule-import.js +1 -1
- package/dist/src/lib/parser/utils/at-rule-media.js +2 -2
- package/dist/src/lib/parser/utils/at-rule-support.js +2 -2
- package/dist/src/lib/parser/utils/at-rule-when-else.js +1 -1
- package/dist/src/lib/parser/utils/at-rule.js +1 -1
- package/dist/src/lib/parser/utils/base64.js +1 -1
- package/dist/src/lib/parser/utils/cache.js +1 -1
- package/dist/src/lib/parser/utils/config.js +1 -1
- package/dist/src/lib/parser/utils/declaration.js +1 -1
- package/dist/src/lib/parser/utils/eq.js +1 -1
- package/dist/src/lib/parser/utils/hash.js +1 -1
- package/dist/src/lib/parser/utils/selector.js +1 -1
- package/dist/src/lib/parser/utils/text.js +1 -1
- package/dist/src/lib/parser/utils/token.js +2 -1
- package/dist/src/lib/parser/utils/type.js +1 -1
- package/dist/src/lib/printer/render.js +2 -2
- package/dist/src/lib/printer/sourcemap/lib/codec.js +1 -1
- package/dist/src/lib/printer/sourcemap/sourcemap.js +1 -1
- package/dist/src/lib/syntax/color/a98rgb.js +1 -1
- package/dist/src/lib/syntax/color/alpha.js +1 -1
- package/dist/src/lib/syntax/color/cmyk.js +1 -1
- package/dist/src/lib/syntax/color/color-mix.js +1 -1
- package/dist/src/lib/syntax/color/color.js +1 -1
- package/dist/src/lib/syntax/color/hex.js +1 -1
- package/dist/src/lib/syntax/color/hsl.js +1 -1
- package/dist/src/lib/syntax/color/hwb.js +1 -1
- package/dist/src/lib/syntax/color/lab.js +1 -1
- package/dist/src/lib/syntax/color/lch.js +1 -1
- package/dist/src/lib/syntax/color/oklab.js +1 -1
- package/dist/src/lib/syntax/color/oklch.js +1 -1
- package/dist/src/lib/syntax/color/p3.js +1 -1
- package/dist/src/lib/syntax/color/prophotorgb.js +1 -1
- package/dist/src/lib/syntax/color/rec2020.js +1 -1
- package/dist/src/lib/syntax/color/relative-color.js +1 -1
- package/dist/src/lib/syntax/color/rgb.js +1 -1
- package/dist/src/lib/syntax/color/srgb.js +1 -1
- package/dist/src/lib/syntax/color/utils/color-type.js +1 -1
- package/dist/src/lib/syntax/color/utils/colorspace.js +1 -1
- package/dist/src/lib/syntax/color/utils/components.js +1 -1
- package/dist/src/lib/syntax/color/utils/distance.js +1 -1
- package/dist/src/lib/syntax/color/utils/make-color.js +1 -1
- package/dist/src/lib/syntax/color/utils/matrix.js +1 -1
- package/dist/src/lib/syntax/color/xyz.js +1 -1
- package/dist/src/lib/syntax/color/xyzd50.js +1 -1
- package/dist/src/lib/syntax/constants.js +1 -1
- package/dist/src/lib/syntax/syntax.js +1 -1
- package/dist/src/lib/validation/config.js +20 -3
- package/dist/src/lib/validation/match.js +98 -196
- package/dist/src/lib/validation/parser/parse.js +8 -3
- package/dist/src/lib/validation/parser/typedef.js +1 -1
- package/dist/src/lib/validation/utils/list.js +1 -1
- package/dist/src/node.js +2 -1
- package/dist/src/types.js +1 -1
- package/dist/src/utils/sync.js +1 -1
- package/dist/src/web.js +2 -1
- package/package.json +6 -5
- package/CONTRIBUTING.md +0 -119
package/dist/index-umd-web.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
CSS parser, minifier and validator for node and the browser
|
|
3
3
|
|
|
4
4
|
Author(s): Thierry Bela
|
|
5
|
-
Version: 1.
|
|
5
|
+
Version: 1.7.0
|
|
6
6
|
License: MIT
|
|
7
7
|
*/
|
|
8
8
|
(function (global, factory) {
|
|
@@ -5721,7 +5721,13 @@
|
|
|
5721
5721
|
syntax: " @bottom-right-corner { <declaration-list> }"
|
|
5722
5722
|
},
|
|
5723
5723
|
"@function": {
|
|
5724
|
-
syntax: " @function <dashed-
|
|
5724
|
+
syntax: " @function <dashed-function> <function-parameter>#?) [returns <css-type>]? { <declaration-rule-list> }"
|
|
5725
|
+
},
|
|
5726
|
+
"@mixin": {
|
|
5727
|
+
syntax: " @mixin [<dashed-function> <function-parameter>#? ) | <ident-token> ]{<block-contents>}"
|
|
5728
|
+
},
|
|
5729
|
+
"@apply": {
|
|
5730
|
+
syntax: " @apply [ <dashed-ident> | <dashed-function> ] [ { <declaration-list> } ]?;"
|
|
5725
5731
|
},
|
|
5726
5732
|
"@left-top": {
|
|
5727
5733
|
syntax: " @left-top { <declaration-list> }"
|
|
@@ -11770,6 +11776,11 @@
|
|
|
11770
11776
|
[LOC]: { ...position },
|
|
11771
11777
|
};
|
|
11772
11778
|
}
|
|
11779
|
+
/**
|
|
11780
|
+
* parse mdn data syntax
|
|
11781
|
+
* @param syntax
|
|
11782
|
+
* @returns
|
|
11783
|
+
*/
|
|
11773
11784
|
function parseSyntax(syntax) {
|
|
11774
11785
|
const stack = [];
|
|
11775
11786
|
let tokens = [];
|
|
@@ -12313,8 +12324,8 @@
|
|
|
12313
12324
|
}
|
|
12314
12325
|
}
|
|
12315
12326
|
}
|
|
12316
|
-
|
|
12317
|
-
|
|
12327
|
+
let block = blockStart == -1 ? null : trimSyntaxArray(syntaxRules.slice(blockStart + 1, blockEnd));
|
|
12328
|
+
let prelude = trimSyntaxArray(blockStart == -1 ? syntaxRules.slice() : syntaxRules.slice(0, blockStart));
|
|
12318
12329
|
let propertyDescriptors = null;
|
|
12319
12330
|
// @ts-expect-error
|
|
12320
12331
|
if (node.descriptors != null) {
|
|
@@ -12325,7 +12336,24 @@
|
|
|
12325
12336
|
propertyDescriptors[key] = parseSyntax(typeof value === "string" ? value : value.syntax);
|
|
12326
12337
|
}
|
|
12327
12338
|
}
|
|
12339
|
+
let optionalBody = false;
|
|
12340
|
+
if (block == null || block.length === 0) {
|
|
12341
|
+
let k = prelude.length - 1;
|
|
12342
|
+
if (ValidationTokenEnum.SemiColon === prelude[k].typ) {
|
|
12343
|
+
k--;
|
|
12344
|
+
}
|
|
12345
|
+
if (k >= 0 && ValidationTokenEnum.Bracket === prelude[k].typ) {
|
|
12346
|
+
if (prelude[k].chi[0].typ ===
|
|
12347
|
+
ValidationTokenEnum.OpenCurlyBrace &&
|
|
12348
|
+
prelude[k].chi.at(-1).typ ===
|
|
12349
|
+
ValidationTokenEnum.CloseCurlyBrace) {
|
|
12350
|
+
block = prelude[k].chi.slice(1, -1);
|
|
12351
|
+
optionalBody = prelude[k].isOptional ?? false;
|
|
12352
|
+
}
|
|
12353
|
+
}
|
|
12354
|
+
}
|
|
12328
12355
|
return {
|
|
12356
|
+
optionalBody,
|
|
12329
12357
|
acceptAnyDeclaration: node.syntax.includes("<declaration-list>"),
|
|
12330
12358
|
acceptAnyRule: node.syntax.includes("<group-rule-body>") ||
|
|
12331
12359
|
node.syntax.includes("<stylesheet>"),
|
|
@@ -12413,15 +12441,6 @@
|
|
|
12413
12441
|
}
|
|
12414
12442
|
return tokens;
|
|
12415
12443
|
}
|
|
12416
|
-
/**
|
|
12417
|
-
* is a media feature
|
|
12418
|
-
* @param featureName
|
|
12419
|
-
* @returns
|
|
12420
|
-
*/
|
|
12421
|
-
// export function isMFName(featureName: string): boolean {
|
|
12422
|
-
// // @ts-expect-error
|
|
12423
|
-
// return featureName.startsWith("--") || config.mediaFeatures[featureName.toLowerCase()] != null;
|
|
12424
|
-
// }
|
|
12425
12444
|
/**
|
|
12426
12445
|
*
|
|
12427
12446
|
* @param featureName
|
|
@@ -12942,9 +12961,6 @@
|
|
|
12942
12961
|
case exports.EnumToken.NumberTokenType:
|
|
12943
12962
|
case exports.EnumToken.LiteralTokenType:
|
|
12944
12963
|
case exports.EnumToken.DimensionTokenType:
|
|
12945
|
-
// if (stack.at(-1)?.typ === EnumToken.CommaTokenType) {
|
|
12946
|
-
// stack.pop();
|
|
12947
|
-
// }
|
|
12948
12964
|
if (stack.at(-1)?.typ === exports.EnumToken.PseudoClassFunctionTokenDefType) {
|
|
12949
12965
|
break;
|
|
12950
12966
|
}
|
|
@@ -13213,43 +13229,9 @@
|
|
|
13213
13229
|
continue;
|
|
13214
13230
|
}
|
|
13215
13231
|
}
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
syntaxes[i + 1]?.typ != ValidationTokenEnum.OpenParenthesis ||
|
|
13220
|
-
syntaxes[i + 2]?.typ == null) {
|
|
13221
|
-
if (!isOptional) {
|
|
13222
|
-
return {
|
|
13223
|
-
success: false,
|
|
13224
|
-
errors: [
|
|
13225
|
-
{
|
|
13226
|
-
action: "drop",
|
|
13227
|
-
message: "could not match syntax",
|
|
13228
|
-
node: token,
|
|
13229
|
-
syntax: syntaxes[i],
|
|
13230
|
-
},
|
|
13231
|
-
],
|
|
13232
|
-
syntaxToken: syntaxes[i],
|
|
13233
|
-
valid: true,
|
|
13234
|
-
context,
|
|
13235
|
-
token: null,
|
|
13236
|
-
};
|
|
13237
|
-
}
|
|
13238
|
-
break;
|
|
13239
|
-
}
|
|
13240
|
-
const range = trimArray(context.peekRange());
|
|
13241
|
-
context.next();
|
|
13242
|
-
i++;
|
|
13243
|
-
result = matchSyntax([syntaxes[i + 1]], createValidationContext(range.slice(1, -1)), options);
|
|
13244
|
-
if (result.success) {
|
|
13245
|
-
context.update(range.at(-1));
|
|
13246
|
-
i += 2;
|
|
13247
|
-
}
|
|
13248
|
-
return result;
|
|
13249
|
-
}
|
|
13250
|
-
if (tokensfuncDefMap.has(token.typ) &&
|
|
13251
|
-
// @ts-ignore
|
|
13252
|
-
token.typ === exports.EnumToken.WildCardFunctionTokenDefType) {
|
|
13232
|
+
if (
|
|
13233
|
+
// @ts-ignore
|
|
13234
|
+
token.typ === exports.EnumToken.WildCardFunctionTokenDefType) {
|
|
13253
13235
|
const range = trimArray(context.peekRange());
|
|
13254
13236
|
result = matchSyntax(getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes, token.val + "()")?.[0]?.chi, createValidationContext(range.slice(1, -1)), options);
|
|
13255
13237
|
if (result.success) {
|
|
@@ -13274,6 +13256,9 @@
|
|
|
13274
13256
|
context.update(result.context.current());
|
|
13275
13257
|
continue;
|
|
13276
13258
|
}
|
|
13259
|
+
if (isOptional) {
|
|
13260
|
+
continue;
|
|
13261
|
+
}
|
|
13277
13262
|
return result;
|
|
13278
13263
|
}
|
|
13279
13264
|
if (syntaxes[i].isList) {
|
|
@@ -13294,6 +13279,9 @@
|
|
|
13294
13279
|
context.update(result.context.current());
|
|
13295
13280
|
continue;
|
|
13296
13281
|
}
|
|
13282
|
+
if (isOptional) {
|
|
13283
|
+
continue;
|
|
13284
|
+
}
|
|
13297
13285
|
return {
|
|
13298
13286
|
success: false,
|
|
13299
13287
|
valid: true,
|
|
@@ -13318,6 +13306,9 @@
|
|
|
13318
13306
|
context.update(result.context.current());
|
|
13319
13307
|
continue;
|
|
13320
13308
|
}
|
|
13309
|
+
if (isOptional) {
|
|
13310
|
+
continue;
|
|
13311
|
+
}
|
|
13321
13312
|
return {
|
|
13322
13313
|
success: false,
|
|
13323
13314
|
valid: true,
|
|
@@ -13722,6 +13713,20 @@
|
|
|
13722
13713
|
syntaxToken: syntaxes[i],
|
|
13723
13714
|
errors: [],
|
|
13724
13715
|
};
|
|
13716
|
+
case ValidationTokenEnum.OpenCurlyBrace:
|
|
13717
|
+
if (token.typ === exports.EnumToken.BlockStartTokenType) {
|
|
13718
|
+
options.visited.get(token).delete(syntaxes[i]);
|
|
13719
|
+
context.next();
|
|
13720
|
+
break;
|
|
13721
|
+
}
|
|
13722
|
+
return {
|
|
13723
|
+
success: false,
|
|
13724
|
+
valid: true,
|
|
13725
|
+
token,
|
|
13726
|
+
context,
|
|
13727
|
+
syntaxToken: syntaxes[i],
|
|
13728
|
+
errors: [],
|
|
13729
|
+
};
|
|
13725
13730
|
case ValidationTokenEnum.CloseParenthesis:
|
|
13726
13731
|
if (token.typ === exports.EnumToken.EndParensTokenType) {
|
|
13727
13732
|
options.visited.get(token).delete(syntaxes[i]);
|
|
@@ -13923,6 +13928,7 @@
|
|
|
13923
13928
|
};
|
|
13924
13929
|
}
|
|
13925
13930
|
switch (property.val) {
|
|
13931
|
+
case "function-parameter":
|
|
13926
13932
|
case "declaration-value":
|
|
13927
13933
|
{
|
|
13928
13934
|
// consume a declaration value
|
|
@@ -13932,18 +13938,43 @@
|
|
|
13932
13938
|
// if semicolon or end curly brace is encountered, stop
|
|
13933
13939
|
let expectToken = true;
|
|
13934
13940
|
let token;
|
|
13941
|
+
const stack = [];
|
|
13935
13942
|
token = context.peek();
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
expectToken
|
|
13943
|
+
if (token != null) {
|
|
13944
|
+
success = false;
|
|
13945
|
+
while ((token = context.peek()) != null) {
|
|
13946
|
+
if (token.typ == exports.EnumToken.StartParensTokenType || tokensfuncDefMap.has(token?.typ)) {
|
|
13947
|
+
stack.push(token);
|
|
13948
|
+
}
|
|
13949
|
+
if (expectToken) {
|
|
13950
|
+
expectToken = false;
|
|
13951
|
+
}
|
|
13952
|
+
if (token.typ == exports.EnumToken.CommaTokenType) {
|
|
13953
|
+
expectToken = true;
|
|
13954
|
+
}
|
|
13955
|
+
if (token.typ == exports.EnumToken.EndParensTokenType) {
|
|
13956
|
+
if (stack.length > 0) {
|
|
13957
|
+
stack.pop();
|
|
13958
|
+
}
|
|
13959
|
+
else {
|
|
13960
|
+
expectToken = false;
|
|
13961
|
+
break;
|
|
13962
|
+
}
|
|
13963
|
+
}
|
|
13964
|
+
context.next();
|
|
13943
13965
|
}
|
|
13944
|
-
context.next();
|
|
13945
13966
|
}
|
|
13946
13967
|
success = !expectToken;
|
|
13968
|
+
if (success) {
|
|
13969
|
+
return {
|
|
13970
|
+
success,
|
|
13971
|
+
valid: true,
|
|
13972
|
+
token: null,
|
|
13973
|
+
context,
|
|
13974
|
+
syntaxToken: property,
|
|
13975
|
+
errors: [],
|
|
13976
|
+
};
|
|
13977
|
+
}
|
|
13947
13978
|
}
|
|
13948
13979
|
break;
|
|
13949
13980
|
case "calc-sum": {
|
|
@@ -13976,9 +14007,6 @@
|
|
|
13976
14007
|
}
|
|
13977
14008
|
break;
|
|
13978
14009
|
}
|
|
13979
|
-
// case "at-keyword-token":
|
|
13980
|
-
// success = context.peek()?.typ === EnumToken.AtRuleTokenType;
|
|
13981
|
-
// break;
|
|
13982
14010
|
case "an+b":
|
|
13983
14011
|
{
|
|
13984
14012
|
let token = context.peek();
|
|
@@ -14043,9 +14071,6 @@
|
|
|
14043
14071
|
Object.assign(token, { typ: exports.EnumToken.Add });
|
|
14044
14072
|
}
|
|
14045
14073
|
token = context.peek(2);
|
|
14046
|
-
// if (token == null) {
|
|
14047
|
-
// break;
|
|
14048
|
-
// }
|
|
14049
14074
|
if (token?.typ === exports.EnumToken.NumberTokenType &&
|
|
14050
14075
|
Number.isInteger(token.val) &&
|
|
14051
14076
|
!token.toString().includes(".") &&
|
|
@@ -14153,9 +14178,6 @@
|
|
|
14153
14178
|
break;
|
|
14154
14179
|
case "dimension": {
|
|
14155
14180
|
const token = context.peek();
|
|
14156
|
-
// if (token == null) {
|
|
14157
|
-
// break;
|
|
14158
|
-
// }
|
|
14159
14181
|
success =
|
|
14160
14182
|
token?.typ == exports.EnumToken.DimensionTokenType ||
|
|
14161
14183
|
token?.typ == exports.EnumToken.AngleTokenType ||
|
|
@@ -14170,18 +14192,12 @@
|
|
|
14170
14192
|
case "angle":
|
|
14171
14193
|
{
|
|
14172
14194
|
const token = context.peek();
|
|
14173
|
-
// if (token == null) {
|
|
14174
|
-
// break;
|
|
14175
|
-
// }
|
|
14176
14195
|
success = token?.typ === exports.EnumToken.AngleTokenType;
|
|
14177
14196
|
}
|
|
14178
14197
|
break;
|
|
14179
14198
|
case "angle-percentage":
|
|
14180
14199
|
{
|
|
14181
14200
|
const token = context.peek();
|
|
14182
|
-
// if (token == null) {
|
|
14183
|
-
// break;
|
|
14184
|
-
// }
|
|
14185
14201
|
success = token?.typ === exports.EnumToken.AngleTokenType || token?.typ === exports.EnumToken.PercentageTokenType;
|
|
14186
14202
|
}
|
|
14187
14203
|
break;
|
|
@@ -14197,9 +14213,6 @@
|
|
|
14197
14213
|
case "length-percentage":
|
|
14198
14214
|
{
|
|
14199
14215
|
const token = context.peek();
|
|
14200
|
-
// if (token == null) {
|
|
14201
|
-
// break;
|
|
14202
|
-
// }
|
|
14203
14216
|
success =
|
|
14204
14217
|
token?.typ == exports.EnumToken.PercentageTokenType ||
|
|
14205
14218
|
token?.typ == exports.EnumToken.LengthTokenType ||
|
|
@@ -14211,9 +14224,6 @@
|
|
|
14211
14224
|
break;
|
|
14212
14225
|
case "length": {
|
|
14213
14226
|
const token = context.peek();
|
|
14214
|
-
// if (token == null) {
|
|
14215
|
-
// break;
|
|
14216
|
-
// }
|
|
14217
14227
|
success =
|
|
14218
14228
|
token?.typ == exports.EnumToken.LengthTokenType ||
|
|
14219
14229
|
(token?.typ == exports.EnumToken.NumberTokenType && token?.val === 0);
|
|
@@ -14228,12 +14238,6 @@
|
|
|
14228
14238
|
success = token.typ == exports.EnumToken.TimeTokenType;
|
|
14229
14239
|
}
|
|
14230
14240
|
break;
|
|
14231
|
-
// case "hex-color": {
|
|
14232
|
-
// const token = context.peek();
|
|
14233
|
-
// success =
|
|
14234
|
-
// token != null && token.typ == EnumToken.ColorTokenType && (token as ColorToken).kin == ColorType.HEX;
|
|
14235
|
-
// break;
|
|
14236
|
-
// }
|
|
14237
14241
|
case "color":
|
|
14238
14242
|
case "color-function":
|
|
14239
14243
|
{
|
|
@@ -14241,13 +14245,6 @@
|
|
|
14241
14245
|
const errors = [];
|
|
14242
14246
|
if (tokensfuncDefMap.has(token?.typ)) {
|
|
14243
14247
|
const range = context.peekRange();
|
|
14244
|
-
// if (
|
|
14245
|
-
// range.some(
|
|
14246
|
-
// (token) =>
|
|
14247
|
-
// token.typ == EnumToken.IdenTokenType &&
|
|
14248
|
-
// "hslrgbchwmyk".split("").some((t) => equalsIgnoreCase(t, (token as IdentToken).val)),
|
|
14249
|
-
// )
|
|
14250
|
-
// ) {
|
|
14251
14248
|
const newRange = range.map((t) => cloneNode(t, true));
|
|
14252
14249
|
// @ts-ignore
|
|
14253
14250
|
parseTokens(newRange, { parseColor: true }, errors);
|
|
@@ -14272,27 +14269,6 @@
|
|
|
14272
14269
|
syntaxToken: null,
|
|
14273
14270
|
errors,
|
|
14274
14271
|
};
|
|
14275
|
-
// }
|
|
14276
|
-
// const result = matchSyntax(
|
|
14277
|
-
// getParsedSyntax(
|
|
14278
|
-
// ValidationSyntaxGroupEnum.Syntaxes,
|
|
14279
|
-
// (token as FunctionToken).val + "()",
|
|
14280
|
-
// ) as ValidationFunctionToken[],
|
|
14281
|
-
// createValidationContext(range),
|
|
14282
|
-
// options,
|
|
14283
|
-
// );
|
|
14284
|
-
// if (result.success) {
|
|
14285
|
-
// context.update(range.at(-1) as Token);
|
|
14286
|
-
// return {
|
|
14287
|
-
// success: true,
|
|
14288
|
-
// valid: true,
|
|
14289
|
-
// token: context.peek(),
|
|
14290
|
-
// context,
|
|
14291
|
-
// syntaxToken: null,
|
|
14292
|
-
// errors: [],
|
|
14293
|
-
// };
|
|
14294
|
-
// }
|
|
14295
|
-
// return result;
|
|
14296
14272
|
}
|
|
14297
14273
|
// @ts-expect-error
|
|
14298
14274
|
else if ("chi" in token) {
|
|
@@ -14311,10 +14287,6 @@
|
|
|
14311
14287
|
}
|
|
14312
14288
|
}
|
|
14313
14289
|
break;
|
|
14314
|
-
// case "url-token":
|
|
14315
|
-
// success =
|
|
14316
|
-
// context.peek()?.typ == EnumToken.StringTokenType || context.peek()?.typ == EnumToken.UrlTokenTokenType;
|
|
14317
|
-
// break;
|
|
14318
14290
|
case "type-selector":
|
|
14319
14291
|
case "compound-selector":
|
|
14320
14292
|
case "complex-selector":
|
|
@@ -14339,15 +14311,6 @@
|
|
|
14339
14311
|
};
|
|
14340
14312
|
}
|
|
14341
14313
|
case "function-token":
|
|
14342
|
-
// if (
|
|
14343
|
-
// context.peek()?.typ == EnumToken.IdenTokenType &&
|
|
14344
|
-
// context.peek(1, false)?.typ == EnumToken.StartParensTokenType
|
|
14345
|
-
// ) {
|
|
14346
|
-
// context.next();
|
|
14347
|
-
// context.next();
|
|
14348
|
-
// success = true;
|
|
14349
|
-
// break;
|
|
14350
|
-
// }
|
|
14351
14314
|
if (tokensfuncDefMap.has(context.peek()?.typ)) {
|
|
14352
14315
|
success = true;
|
|
14353
14316
|
context.next();
|
|
@@ -14369,17 +14332,6 @@
|
|
|
14369
14332
|
config$3.languages.some((t) => t === token.val || token.val.startsWith(t + "-"));
|
|
14370
14333
|
break;
|
|
14371
14334
|
}
|
|
14372
|
-
// case "named-color": {
|
|
14373
|
-
// const token = context.peek();
|
|
14374
|
-
// success =
|
|
14375
|
-
// token != null &&
|
|
14376
|
-
// token.typ == EnumToken.ColorTokenType &&
|
|
14377
|
-
// ((token as ColorToken).kin == ColorType.LIT ||
|
|
14378
|
-
// (token as ColorToken).kin == ColorType.SYS ||
|
|
14379
|
-
// (token as ColorToken).kin == ColorType.DPSYS ||
|
|
14380
|
-
// (token as ColorToken).kin == ColorType.NON_STD);
|
|
14381
|
-
// break;
|
|
14382
|
-
// }
|
|
14383
14335
|
case "size-feature": {
|
|
14384
14336
|
const range = context.peekRange();
|
|
14385
14337
|
const filteredRange = range.filter((token) => token.typ !== exports.EnumToken.WhitespaceTokenType && token.typ !== exports.EnumToken.CommentTokenType);
|
|
@@ -14410,20 +14362,6 @@
|
|
|
14410
14362
|
errors: [],
|
|
14411
14363
|
};
|
|
14412
14364
|
}
|
|
14413
|
-
// if (filteredRange.length === 3) {
|
|
14414
|
-
// success = isValue(filteredRange[2]);
|
|
14415
|
-
// if (success) {
|
|
14416
|
-
// context.update(filteredRange[2]);
|
|
14417
|
-
// return {
|
|
14418
|
-
// success,
|
|
14419
|
-
// valid: true,
|
|
14420
|
-
// token: filteredRange[2],
|
|
14421
|
-
// context,
|
|
14422
|
-
// syntaxToken: property,
|
|
14423
|
-
// errors: [],
|
|
14424
|
-
// };
|
|
14425
|
-
// }
|
|
14426
|
-
// }
|
|
14427
14365
|
break;
|
|
14428
14366
|
}
|
|
14429
14367
|
case "style-feature": {
|
|
@@ -14433,16 +14371,6 @@
|
|
|
14433
14371
|
// match <style-range>
|
|
14434
14372
|
const range = context.peekRange();
|
|
14435
14373
|
const filteredRange = range.filter((token) => token.typ !== exports.EnumToken.WhitespaceTokenType && token.typ !== exports.EnumToken.CommentTokenType);
|
|
14436
|
-
// if (filteredRange.length === 0) {
|
|
14437
|
-
// return {
|
|
14438
|
-
// success: false,
|
|
14439
|
-
// valid: true,
|
|
14440
|
-
// token: context.peek(),
|
|
14441
|
-
// context,
|
|
14442
|
-
// syntaxToken: property,
|
|
14443
|
-
// errors: [],
|
|
14444
|
-
// };
|
|
14445
|
-
// }
|
|
14446
14374
|
if (filteredRange.length === 1) {
|
|
14447
14375
|
success =
|
|
14448
14376
|
filteredRange[0].typ === exports.EnumToken.IdenTokenType ||
|
|
@@ -14457,31 +14385,6 @@
|
|
|
14457
14385
|
errors: [],
|
|
14458
14386
|
};
|
|
14459
14387
|
}
|
|
14460
|
-
// if (
|
|
14461
|
-
// filteredRange[1]?.typ === EnumToken.ColonTokenType ||
|
|
14462
|
-
// filteredRange[1]?.typ === EnumToken.DelimTokenType
|
|
14463
|
-
// ) {
|
|
14464
|
-
// const result = isDeclarationValue(filteredRange.slice(2));
|
|
14465
|
-
// if (result.success) {
|
|
14466
|
-
// context.update(filteredRange.at(-1)!);
|
|
14467
|
-
// return {
|
|
14468
|
-
// success: true,
|
|
14469
|
-
// valid: true,
|
|
14470
|
-
// token: filteredRange.at(-1)!,
|
|
14471
|
-
// context,
|
|
14472
|
-
// syntaxToken: property,
|
|
14473
|
-
// errors: [],
|
|
14474
|
-
// };
|
|
14475
|
-
// }
|
|
14476
|
-
// return {
|
|
14477
|
-
// success: false,
|
|
14478
|
-
// valid: false,
|
|
14479
|
-
// token: context.peek(),
|
|
14480
|
-
// context,
|
|
14481
|
-
// syntaxToken: property,
|
|
14482
|
-
// errors: result.errors,
|
|
14483
|
-
// };
|
|
14484
|
-
// }
|
|
14485
14388
|
return {
|
|
14486
14389
|
success: false,
|
|
14487
14390
|
valid: false,
|
|
@@ -14493,10 +14396,6 @@
|
|
|
14493
14396
|
}
|
|
14494
14397
|
case "url": {
|
|
14495
14398
|
const token = context.peek();
|
|
14496
|
-
// if (token == null) {
|
|
14497
|
-
// success = false;
|
|
14498
|
-
// break;
|
|
14499
|
-
// }
|
|
14500
14399
|
let l;
|
|
14501
14400
|
if (token?.typ == exports.EnumToken.UrlFunctionTokenDefType) {
|
|
14502
14401
|
l = 0;
|
|
@@ -14510,11 +14409,6 @@
|
|
|
14510
14409
|
(token.typ == exports.EnumToken.StringTokenType ||
|
|
14511
14410
|
token.typ == exports.EnumToken.IdenTokenType ||
|
|
14512
14411
|
token.typ == exports.EnumToken.UrlTokenTokenType)) {
|
|
14513
|
-
// if (token.typ === EnumToken.IdenTokenType) {
|
|
14514
|
-
// while (context.peek(l + 1)?.typ === EnumToken.ClassSelectorTokenType) {
|
|
14515
|
-
// l++;
|
|
14516
|
-
// }
|
|
14517
|
-
// }
|
|
14518
14412
|
while ((token = context.peek(++l))) {
|
|
14519
14413
|
if (token.typ !== exports.EnumToken.WhitespaceTokenType && token.typ !== exports.EnumToken.CommentTokenType) {
|
|
14520
14414
|
break;
|
|
@@ -14578,10 +14472,46 @@
|
|
|
14578
14472
|
}
|
|
14579
14473
|
break;
|
|
14580
14474
|
}
|
|
14475
|
+
case "dashed-function": {
|
|
14476
|
+
const token = context.peek();
|
|
14477
|
+
success = token?.typ == exports.EnumToken.CustomFunctionTokenDefType;
|
|
14478
|
+
if (success) {
|
|
14479
|
+
context.next();
|
|
14480
|
+
return {
|
|
14481
|
+
success: true,
|
|
14482
|
+
valid: true,
|
|
14483
|
+
token,
|
|
14484
|
+
context,
|
|
14485
|
+
syntaxToken: null,
|
|
14486
|
+
errors: [],
|
|
14487
|
+
};
|
|
14488
|
+
}
|
|
14489
|
+
break;
|
|
14490
|
+
}
|
|
14491
|
+
case "block-contents":
|
|
14492
|
+
success = context.peek()?.typ == exports.EnumToken.StartParensTokenType;
|
|
14493
|
+
if (success) {
|
|
14494
|
+
context.next();
|
|
14495
|
+
return {
|
|
14496
|
+
success: true,
|
|
14497
|
+
valid: true,
|
|
14498
|
+
token: null,
|
|
14499
|
+
context,
|
|
14500
|
+
syntaxToken: null,
|
|
14501
|
+
errors: [],
|
|
14502
|
+
};
|
|
14503
|
+
}
|
|
14504
|
+
return {
|
|
14505
|
+
success: false,
|
|
14506
|
+
valid: true,
|
|
14507
|
+
token,
|
|
14508
|
+
context,
|
|
14509
|
+
syntaxToken: property,
|
|
14510
|
+
errors: [],
|
|
14511
|
+
};
|
|
14581
14512
|
default:
|
|
14582
14513
|
if (!(property.val in config$3.syntaxes)) {
|
|
14583
14514
|
console.debug("Unknown syntax", context.peek(), property);
|
|
14584
|
-
console.debug(context.getRemainingTokens());
|
|
14585
14515
|
throw new Error(`Unexpected validation property ${property.val}`);
|
|
14586
14516
|
}
|
|
14587
14517
|
return matchSyntax(getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes, property.val), context, options);
|
|
@@ -20085,7 +20015,7 @@
|
|
|
20085
20015
|
if (value instanceof PropertyMap) {
|
|
20086
20016
|
for (const [k, v] of value.declarations) {
|
|
20087
20017
|
if (k == value.config.shorthand) {
|
|
20088
|
-
for (const [key
|
|
20018
|
+
for (const [key] of Object.entries(value.config.properties)) {
|
|
20089
20019
|
mapped[key] = cloneNode(v);
|
|
20090
20020
|
for (let i = 0; i < v.val.length; i++) {
|
|
20091
20021
|
// @ts-ignore
|
|
@@ -20873,6 +20803,16 @@
|
|
|
20873
20803
|
let result;
|
|
20874
20804
|
for (const declaration of declarations) {
|
|
20875
20805
|
name = declaration.typ != exports.EnumToken.DeclarationNodeType ? null : declaration.nam;
|
|
20806
|
+
// do not compute shorthand for invalid declarations
|
|
20807
|
+
if (name == null) {
|
|
20808
|
+
this.declarations.set(objectHash(declaration), declaration);
|
|
20809
|
+
continue;
|
|
20810
|
+
}
|
|
20811
|
+
// @functiom / result
|
|
20812
|
+
if (declaration[STATE] & exports.EnumAstNodeStatus.Unknown && equalsIgnoreCase("result", name)) {
|
|
20813
|
+
this.declarations.set(declaration.nam, declaration);
|
|
20814
|
+
continue;
|
|
20815
|
+
}
|
|
20876
20816
|
if (declaration[STATE] &
|
|
20877
20817
|
(exports.EnumAstNodeStatus.Invalid | exports.EnumAstNodeStatus.Unknown | exports.EnumAstNodeStatus.ValidationFailed) ||
|
|
20878
20818
|
declaration.typ != exports.EnumToken.DeclarationNodeType ||
|
|
@@ -21110,32 +21050,49 @@
|
|
|
21110
21050
|
let l;
|
|
21111
21051
|
const rules = [];
|
|
21112
21052
|
const declarations = [];
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21117
|
-
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
if (node.typ == exports.EnumToken.CommentNodeType) {
|
|
21121
|
-
l++;
|
|
21122
|
-
continue;
|
|
21123
|
-
}
|
|
21124
|
-
break;
|
|
21053
|
+
let doNotSort = false;
|
|
21054
|
+
if (ast.typ == exports.EnumToken.AtRuleNodeType) {
|
|
21055
|
+
switch (ast.nam) {
|
|
21056
|
+
case "function":
|
|
21057
|
+
case "mixin":
|
|
21058
|
+
doNotSort = true;
|
|
21059
|
+
break;
|
|
21125
21060
|
}
|
|
21061
|
+
}
|
|
21062
|
+
// https://drafts.csswg.org/css-mixins/#:~:text=The%20value%20of%20the%20result%20descriptor%20is%20always%2016px%20in%20the%20above%20example
|
|
21063
|
+
if (doNotSort) {
|
|
21064
|
+
for (const node of ast.chi) {
|
|
21065
|
+
declarations.push(node);
|
|
21066
|
+
}
|
|
21067
|
+
}
|
|
21068
|
+
else {
|
|
21126
21069
|
// @ts-ignore
|
|
21127
|
-
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21070
|
+
for (; k < j; k++) {
|
|
21071
|
+
l = k;
|
|
21072
|
+
// capture comments with the next token
|
|
21073
|
+
while (l + 1 < j) {
|
|
21074
|
+
// @ts-ignore
|
|
21075
|
+
const node = ast.chi[l];
|
|
21076
|
+
if (node.typ == exports.EnumToken.CommentNodeType) {
|
|
21077
|
+
l++;
|
|
21078
|
+
continue;
|
|
21079
|
+
}
|
|
21080
|
+
break;
|
|
21131
21081
|
}
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21082
|
+
// @ts-ignore
|
|
21083
|
+
const node = ast.chi[l];
|
|
21084
|
+
if (node.typ == exports.EnumToken.DeclarationNodeType) {
|
|
21085
|
+
for (let m = k; m <= l; m++) {
|
|
21086
|
+
declarations.push(ast.chi[m]);
|
|
21087
|
+
}
|
|
21136
21088
|
}
|
|
21089
|
+
else {
|
|
21090
|
+
for (let m = k; m <= l; m++) {
|
|
21091
|
+
rules.push(ast.chi[m]);
|
|
21092
|
+
}
|
|
21093
|
+
}
|
|
21094
|
+
k = l;
|
|
21137
21095
|
}
|
|
21138
|
-
k = l;
|
|
21139
21096
|
}
|
|
21140
21097
|
if (declarations.length > 0) {
|
|
21141
21098
|
ast.chi.length = 0;
|
|
@@ -21155,6 +21112,7 @@
|
|
|
21155
21112
|
exports.EnumToken.LteTokenType,
|
|
21156
21113
|
exports.EnumToken.ChildCombinatorTokenType,
|
|
21157
21114
|
exports.EnumToken.PipeTokenType,
|
|
21115
|
+
exports.EnumToken.ColonTokenType
|
|
21158
21116
|
]);
|
|
21159
21117
|
const trimSpaceAfter = new Set([
|
|
21160
21118
|
...tokensfuncSet.values(),
|
|
@@ -23343,8 +23301,35 @@
|
|
|
23343
23301
|
previous = ast.chi[--nodeIndex];
|
|
23344
23302
|
}
|
|
23345
23303
|
node = ast.chi[i];
|
|
23346
|
-
if (node.typ === exports.EnumToken.AtRuleNodeType
|
|
23347
|
-
|
|
23304
|
+
if (node.typ === exports.EnumToken.AtRuleNodeType) {
|
|
23305
|
+
if (node.nam === "font-face") {
|
|
23306
|
+
continue;
|
|
23307
|
+
}
|
|
23308
|
+
// https://drafts.csswg.org/css-mixins/#:~:text=The%20value%20of%20the%20result%20descriptor%20is%20always%2016px%20in%20the%20above%20example
|
|
23309
|
+
if (equalsIgnoreCase(node.nam, "function")) {
|
|
23310
|
+
const chi = node.chi;
|
|
23311
|
+
let k = chi?.length;
|
|
23312
|
+
let slice = false;
|
|
23313
|
+
while (k--) {
|
|
23314
|
+
if (chi[k].typ === exports.EnumToken.CommentNodeType ||
|
|
23315
|
+
chi[k].typ === exports.EnumToken.WhitespaceTokenType) {
|
|
23316
|
+
continue;
|
|
23317
|
+
}
|
|
23318
|
+
if (chi[k].typ === exports.EnumToken.DeclarationNodeType &&
|
|
23319
|
+
equalsIgnoreCase(chi[k].nam, "result")) {
|
|
23320
|
+
slice = true;
|
|
23321
|
+
break;
|
|
23322
|
+
}
|
|
23323
|
+
}
|
|
23324
|
+
if (k > 0 && slice) {
|
|
23325
|
+
while (k--) {
|
|
23326
|
+
if (chi[k].typ === exports.EnumToken.AtRuleNodeType) {
|
|
23327
|
+
chi.splice(k, 1);
|
|
23328
|
+
continue;
|
|
23329
|
+
}
|
|
23330
|
+
}
|
|
23331
|
+
}
|
|
23332
|
+
}
|
|
23348
23333
|
}
|
|
23349
23334
|
if (node.typ === exports.EnumToken.KeyframesAtRuleNodeType) {
|
|
23350
23335
|
if (previous?.typ === exports.EnumToken.KeyframesAtRuleNodeType &&
|
|
@@ -25879,7 +25864,7 @@
|
|
|
25879
25864
|
case exports.EnumToken.KeyframesRuleNodeType:
|
|
25880
25865
|
case exports.EnumToken.KeyframesAtRuleNodeType:
|
|
25881
25866
|
if ([exports.EnumToken.AtRuleNodeType, exports.EnumToken.KeyframesAtRuleNodeType].includes(data.typ) && !("chi" in data)) {
|
|
25882
|
-
return `${indent}@${data.nam}${data.val === "" ? "" : options.indent || " "}${data.val};`;
|
|
25867
|
+
return `${(indent.length > 0 ? options.newLine : "") + indent}@${data.nam}${data.val === "" ? "" : options.indent || " "}${data.val};`;
|
|
25883
25868
|
}
|
|
25884
25869
|
const lineMapLength = linesMap ? linesMap.getLineStarts().length : 0;
|
|
25885
25870
|
const prelude = (indent.length > 0 ? options.newLine : "") +
|
|
@@ -29625,7 +29610,7 @@
|
|
|
29625
29610
|
Object.assign(stream[i], {
|
|
29626
29611
|
typ: val === "and" ? exports.EnumToken.AndTokenType : exports.EnumToken.OrTokenType,
|
|
29627
29612
|
});
|
|
29628
|
-
if (val === "or" && scopes.length
|
|
29613
|
+
if (val === "or" && (scopes.length == 1 && scopes[0].size > 0 && !scopes[0].has(exports.EnumToken.OrTokenType))) {
|
|
29629
29614
|
success = false;
|
|
29630
29615
|
errors.push({
|
|
29631
29616
|
action: "drop",
|
|
@@ -30141,7 +30126,7 @@
|
|
|
30141
30126
|
break;
|
|
30142
30127
|
}
|
|
30143
30128
|
if ("and" === val || "or" === val) {
|
|
30144
|
-
if ("or" === val && scopes.length === 1) {
|
|
30129
|
+
if ("or" === val && scopes.length === 1 && scopes[0].size > 0) {
|
|
30145
30130
|
const fileName = options.source.getFileName() ?? "";
|
|
30146
30131
|
const [line, column] = options.source.getOffsets(stream[i]?.[LOCSTA]);
|
|
30147
30132
|
return {
|
|
@@ -31224,19 +31209,10 @@
|
|
|
31224
31209
|
key = visitors[i][0];
|
|
31225
31210
|
value = visitors[i][1];
|
|
31226
31211
|
if (Number.isInteger(+key)) {
|
|
31227
|
-
// if (Array.isArray(value)) {
|
|
31228
|
-
// visitors.splice(i + 1, 0, ...Object.entries(value));
|
|
31229
|
-
// continue;
|
|
31230
|
-
// }
|
|
31231
31212
|
if (typeof value == "function") {
|
|
31232
31213
|
key = value.name;
|
|
31233
31214
|
}
|
|
31234
31215
|
}
|
|
31235
|
-
// if (Array.isArray(value)) {
|
|
31236
|
-
// // @ts-ignore
|
|
31237
|
-
// visitors.splice(i + 1, 0, ...value.map((item) => [key, item]));
|
|
31238
|
-
// continue;
|
|
31239
|
-
// }
|
|
31240
31216
|
if (key in exports.EnumToken) {
|
|
31241
31217
|
if (typeof value == "function") {
|
|
31242
31218
|
if (!valuesHandlers.has(exports.EnumToken[key])) {
|
|
@@ -31596,7 +31572,7 @@
|
|
|
31596
31572
|
if (tokens.length > 0) {
|
|
31597
31573
|
node = parseNode(tokens, context, options, errors, stats, invalidNodes);
|
|
31598
31574
|
if (node != null) {
|
|
31599
|
-
if ("chi" in node
|
|
31575
|
+
if ("chi" in node) {
|
|
31600
31576
|
stack.push(node);
|
|
31601
31577
|
context = node;
|
|
31602
31578
|
}
|
|
@@ -32368,14 +32344,9 @@
|
|
|
32368
32344
|
let parensMatch = 0;
|
|
32369
32345
|
let curlyBracketMatch = 0;
|
|
32370
32346
|
let tokenizer = iter instanceof Promise ? await iter : iter;
|
|
32371
|
-
// ast[ROOT] = ast;
|
|
32372
32347
|
ast[LOCSRCID] = options.source.id;
|
|
32373
32348
|
ast[LOCSTA] = 0;
|
|
32374
32349
|
ast[LOCEND] = 0;
|
|
32375
|
-
// if (Array.isArray(iter)) {
|
|
32376
|
-
// // @ts-expect-error
|
|
32377
|
-
// iter = iter[Symbol.iterator]() as Iterator<TokenizeResult>;
|
|
32378
|
-
// }
|
|
32379
32350
|
while (!tokenizer.done()) {
|
|
32380
32351
|
tokenizer.next();
|
|
32381
32352
|
if (tokenizer.unit != null) {
|
|
@@ -32616,6 +32587,11 @@
|
|
|
32616
32587
|
case exports.EnumToken.AtRuleNodeType:
|
|
32617
32588
|
case exports.EnumToken.KeyframesRuleNodeType:
|
|
32618
32589
|
case exports.EnumToken.KeyframesAtRuleNodeType:
|
|
32590
|
+
if (nodes[i][TOKENS] == null) {
|
|
32591
|
+
if (nodes[i].typ == exports.EnumToken.RuleNodeType) {
|
|
32592
|
+
nodes[i][TOKENS] = parseString(nodes[i].sel);
|
|
32593
|
+
}
|
|
32594
|
+
}
|
|
32619
32595
|
for (const token of nodes[i][TOKENS]) {
|
|
32620
32596
|
subNodes.push(token);
|
|
32621
32597
|
}
|
|
@@ -33610,7 +33586,7 @@
|
|
|
33610
33586
|
else if (context.typ === exports.EnumToken.AtRuleNodeType &&
|
|
33611
33587
|
"page" === context.nam &&
|
|
33612
33588
|
pageMarginBoxType.has(atRuleName.toLowerCase())) {
|
|
33613
|
-
if (parseAsBlock === false) {
|
|
33589
|
+
if (parseAsBlock === false && syntaxRules.optionalBody === false) {
|
|
33614
33590
|
errors.push({
|
|
33615
33591
|
action: "drop",
|
|
33616
33592
|
node: atRule,
|
|
@@ -33649,7 +33625,7 @@
|
|
|
33649
33625
|
if (parseAsBlock === null) {
|
|
33650
33626
|
parseAsBlock = blockAllowed;
|
|
33651
33627
|
}
|
|
33652
|
-
if (syntax != null && atRule.nam !== "layer" && parseAsBlock !== blockAllowed) {
|
|
33628
|
+
if (syntax != null && atRule.nam !== "layer" && parseAsBlock !== blockAllowed && !syntaxRules.optionalBody) {
|
|
33653
33629
|
errors.push({
|
|
33654
33630
|
action: "drop",
|
|
33655
33631
|
node: atRule,
|
|
@@ -34778,7 +34754,7 @@
|
|
|
34778
34754
|
}
|
|
34779
34755
|
}
|
|
34780
34756
|
|
|
34781
|
-
var version = "1.
|
|
34757
|
+
var version = "1.7.0";
|
|
34782
34758
|
|
|
34783
34759
|
/**
|
|
34784
34760
|
* Load file or url
|
|
@@ -35205,6 +35181,7 @@
|
|
|
35205
35181
|
exports.parseFile = parseFile;
|
|
35206
35182
|
exports.parseString = parseString;
|
|
35207
35183
|
exports.parseSync = parseSync;
|
|
35184
|
+
exports.parseSyntax = parseSyntax;
|
|
35208
35185
|
exports.render = render;
|
|
35209
35186
|
exports.renderToken = renderValue;
|
|
35210
35187
|
exports.replaceNodeOrValue = replaceNodeOrValue;
|