@eslint/css-tree 4.0.5 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/data.cjs CHANGED
@@ -5,7 +5,8 @@ module.exports = {
5
5
  "inherit",
6
6
  "unset",
7
7
  "revert",
8
- "revert-layer"
8
+ "revert-layer",
9
+ "revert-rule"
9
10
  ],
10
11
  "units": {
11
12
  "angle": [
@@ -426,7 +427,7 @@ module.exports = {
426
427
  "superellipse()": "superellipse( [<number>|infinity|-infinity] )",
427
428
  "supports-condition": "not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*",
428
429
  "supports-decl": "( <declaration> )",
429
- "supports-feature": "<supports-decl>|<supports-selector-fn>",
430
+ "supports-feature": "<supports-selector-fn>|<supports-font-tech-fn>|<supports-font-format-fn>|<supports-at-rule-fn>|<supports-named-feature-fn>|<supports-env-fn>|<supports-decl>",
430
431
  "supports-in-parens": "( <supports-condition> )|<supports-feature>|<general-enclosed>",
431
432
  "supports-selector-fn": "selector( <complex-selector> )",
432
433
  "symbol": "<string>|<image>|<custom-ident>",
@@ -497,6 +498,10 @@ module.exports = {
497
498
  "bottom": "<length>|auto",
498
499
  "generic-voice": "[<age>? <gender> <integer>?]",
499
500
  "gender": "male|female|neutral",
501
+ "font-features-tech": "features-opentype|features-aat|features-graphite",
502
+ "font-format": "<string>|collection|embedded-opentype|opentype|svg|truetype|woff|woff2",
503
+ "font-tech": "<font-features-tech>|<color-font-tech>|variations|palettes|incremental",
504
+ "color-font-tech": "color-COLRv0|color-COLRv1|color-SVG|color-sbix|color-CBDT",
500
505
  "generic-script-specific": "generic( kai )|generic( fangsong )|generic( nastaliq )",
501
506
  "-non-standard-generic-family": "-apple-system|BlinkMacSystemFont",
502
507
  "intrinsic-size-keyword": "min-content|max-content|fit-content",
@@ -504,6 +509,7 @@ module.exports = {
504
509
  "device-cmyk()": "<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>",
505
510
  "legacy-device-cmyk-syntax": "device-cmyk( <number>#{4} )",
506
511
  "modern-device-cmyk-syntax": "device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )",
512
+ "param()": "param( <dashed-ident> , <declaration-value>? )",
507
513
  "cmyk-component": "<number>|<percentage>|none",
508
514
  "color-space": "<rectangular-color-space>|<polar-color-space>|<custom-color-space>",
509
515
  "right": "<length>|auto",
@@ -555,6 +561,11 @@ module.exports = {
555
561
  "alpha()": "alpha( [from <color>] [/ [<alpha-value>|none]]? )",
556
562
  "xyz-space": "xyz|xyz-d50|xyz-d65",
557
563
  "style-condition": "not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]",
564
+ "supports-font-tech-fn": "font-tech( <font-tech> )",
565
+ "supports-font-format-fn": "font-format( <font-format> )",
566
+ "supports-at-rule-fn": "at-rule( <at-keyword-token> )",
567
+ "supports-named-feature-fn": "named-feature( <ident> )",
568
+ "supports-env-fn": "env( <ident> )",
558
569
  "-non-standard-display": "-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box",
559
570
  "inset-area": "[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",
560
571
  "syntax": "'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>",
@@ -872,8 +883,9 @@ module.exports = {
872
883
  "flex-direction": "row|row-reverse|column|column-reverse",
873
884
  "flex-flow": "<'flex-direction'>||<'flex-wrap'>",
874
885
  "flex-grow": "<number>",
886
+ "flex-line-count": "<integer [1,∞]>",
875
887
  "flex-shrink": "<number>",
876
- "flex-wrap": "nowrap|wrap|wrap-reverse",
888
+ "flex-wrap": "nowrap|[wrap|wrap-reverse]||balance",
877
889
  "float": "left|right|none|inline-start|inline-end",
878
890
  "flood-color": "<color>",
879
891
  "flood-opacity": "<'opacity'>",
@@ -962,6 +974,7 @@ module.exports = {
962
974
  "line-clamp": "none|<integer>",
963
975
  "line-height": "normal|<number>|<length>|<percentage>",
964
976
  "line-height-step": "<length>",
977
+ "link-parameters": "none|<param()>#",
965
978
  "list-style": "<'list-style-type'>||<'list-style-position'>||<'list-style-image'>",
966
979
  "list-style-image": "<image>|none",
967
980
  "list-style-position": "inside|outside",
@@ -1061,6 +1074,7 @@ module.exports = {
1061
1074
  "page-break-before": "auto|always|avoid|left|right|recto|verso",
1062
1075
  "page-break-inside": "auto|avoid",
1063
1076
  "paint-order": "normal|[fill||stroke||markers]",
1077
+ "path-length": "none|<length> [0 , ∞]",
1064
1078
  "perspective": "none|<length>",
1065
1079
  "perspective-origin": "<position>",
1066
1080
  "place-content": "<'align-content'> <'justify-content'>?",
@@ -1159,7 +1173,7 @@ module.exports = {
1159
1173
  "text-combine-upright": "none|all|[digits <integer>?]",
1160
1174
  "text-decoration": "<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>",
1161
1175
  "text-decoration-color": "<color>",
1162
- "text-decoration-inset": "<length>{1,2}|auto",
1176
+ "text-decoration-inset": "<length-percentage>{1,2}|auto",
1163
1177
  "text-decoration-line": "none|[underline||overline||line-through||blink]|spelling-error|grammar-error",
1164
1178
  "text-decoration-skip": "none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]",
1165
1179
  "text-decoration-skip-ink": "auto|all|none",
@@ -1169,6 +1183,7 @@ module.exports = {
1169
1183
  "text-emphasis-color": "<color>",
1170
1184
  "text-emphasis-position": "auto|[over|under]&&[right|left]?",
1171
1185
  "text-emphasis-style": "none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>",
1186
+ "text-fit": "[none|grow|shrink] [consistent|per-line|per-line-all]? <percentage>?",
1172
1187
  "text-indent": "<length-percentage>&&hanging?&&each-line?",
1173
1188
  "text-justify": "auto|inter-character|inter-word|none",
1174
1189
  "text-orientation": "mixed|upright|sideways",
@@ -1334,7 +1349,9 @@ module.exports = {
1334
1349
  },
1335
1350
  "font-feature-values": {
1336
1351
  "prelude": "<family-name>#",
1337
- "descriptors": null
1352
+ "descriptors": {
1353
+ "font-display": "auto|block|swap|fallback|optional"
1354
+ }
1338
1355
  },
1339
1356
  "font-palette-values": {
1340
1357
  "prelude": "<dashed-ident>",
@@ -1370,7 +1387,12 @@ module.exports = {
1370
1387
  "bleed": "auto|<length>",
1371
1388
  "marks": "none|[crop||cross]",
1372
1389
  "page-orientation": "upright|rotate-left|rotate-right",
1373
- "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]"
1390
+ "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]",
1391
+ "margin-top": "<'margin-top'>",
1392
+ "margin-right": "<'margin-right'>",
1393
+ "margin-bottom": "<'margin-bottom'>",
1394
+ "margin-left": "<'margin-left'>",
1395
+ "margin": "<'margin'>"
1374
1396
  }
1375
1397
  },
1376
1398
  "position-try": {
@@ -1440,12 +1462,6 @@ module.exports = {
1440
1462
  "navigation": "auto|none",
1441
1463
  "types": "none|<custom-ident>+"
1442
1464
  }
1443
- },
1444
- "font-features-values": {
1445
- "prelude": "[<string>|<custom-ident>]+",
1446
- "descriptors": {
1447
- "font-display": "auto|block|swap|fallback|optional"
1448
- }
1449
1465
  }
1450
1466
  }
1451
1467
  };
package/dist/data.js CHANGED
@@ -5,7 +5,8 @@ export default {
5
5
  "inherit",
6
6
  "unset",
7
7
  "revert",
8
- "revert-layer"
8
+ "revert-layer",
9
+ "revert-rule"
9
10
  ],
10
11
  "units": {
11
12
  "angle": [
@@ -426,7 +427,7 @@ export default {
426
427
  "superellipse()": "superellipse( [<number>|infinity|-infinity] )",
427
428
  "supports-condition": "not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*",
428
429
  "supports-decl": "( <declaration> )",
429
- "supports-feature": "<supports-decl>|<supports-selector-fn>",
430
+ "supports-feature": "<supports-selector-fn>|<supports-font-tech-fn>|<supports-font-format-fn>|<supports-at-rule-fn>|<supports-named-feature-fn>|<supports-env-fn>|<supports-decl>",
430
431
  "supports-in-parens": "( <supports-condition> )|<supports-feature>|<general-enclosed>",
431
432
  "supports-selector-fn": "selector( <complex-selector> )",
432
433
  "symbol": "<string>|<image>|<custom-ident>",
@@ -497,6 +498,10 @@ export default {
497
498
  "bottom": "<length>|auto",
498
499
  "generic-voice": "[<age>? <gender> <integer>?]",
499
500
  "gender": "male|female|neutral",
501
+ "font-features-tech": "features-opentype|features-aat|features-graphite",
502
+ "font-format": "<string>|collection|embedded-opentype|opentype|svg|truetype|woff|woff2",
503
+ "font-tech": "<font-features-tech>|<color-font-tech>|variations|palettes|incremental",
504
+ "color-font-tech": "color-COLRv0|color-COLRv1|color-SVG|color-sbix|color-CBDT",
500
505
  "generic-script-specific": "generic( kai )|generic( fangsong )|generic( nastaliq )",
501
506
  "-non-standard-generic-family": "-apple-system|BlinkMacSystemFont",
502
507
  "intrinsic-size-keyword": "min-content|max-content|fit-content",
@@ -504,6 +509,7 @@ export default {
504
509
  "device-cmyk()": "<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>",
505
510
  "legacy-device-cmyk-syntax": "device-cmyk( <number>#{4} )",
506
511
  "modern-device-cmyk-syntax": "device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )",
512
+ "param()": "param( <dashed-ident> , <declaration-value>? )",
507
513
  "cmyk-component": "<number>|<percentage>|none",
508
514
  "color-space": "<rectangular-color-space>|<polar-color-space>|<custom-color-space>",
509
515
  "right": "<length>|auto",
@@ -555,6 +561,11 @@ export default {
555
561
  "alpha()": "alpha( [from <color>] [/ [<alpha-value>|none]]? )",
556
562
  "xyz-space": "xyz|xyz-d50|xyz-d65",
557
563
  "style-condition": "not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]",
564
+ "supports-font-tech-fn": "font-tech( <font-tech> )",
565
+ "supports-font-format-fn": "font-format( <font-format> )",
566
+ "supports-at-rule-fn": "at-rule( <at-keyword-token> )",
567
+ "supports-named-feature-fn": "named-feature( <ident> )",
568
+ "supports-env-fn": "env( <ident> )",
558
569
  "-non-standard-display": "-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box",
559
570
  "inset-area": "[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",
560
571
  "syntax": "'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>",
@@ -872,8 +883,9 @@ export default {
872
883
  "flex-direction": "row|row-reverse|column|column-reverse",
873
884
  "flex-flow": "<'flex-direction'>||<'flex-wrap'>",
874
885
  "flex-grow": "<number>",
886
+ "flex-line-count": "<integer [1,∞]>",
875
887
  "flex-shrink": "<number>",
876
- "flex-wrap": "nowrap|wrap|wrap-reverse",
888
+ "flex-wrap": "nowrap|[wrap|wrap-reverse]||balance",
877
889
  "float": "left|right|none|inline-start|inline-end",
878
890
  "flood-color": "<color>",
879
891
  "flood-opacity": "<'opacity'>",
@@ -962,6 +974,7 @@ export default {
962
974
  "line-clamp": "none|<integer>",
963
975
  "line-height": "normal|<number>|<length>|<percentage>",
964
976
  "line-height-step": "<length>",
977
+ "link-parameters": "none|<param()>#",
965
978
  "list-style": "<'list-style-type'>||<'list-style-position'>||<'list-style-image'>",
966
979
  "list-style-image": "<image>|none",
967
980
  "list-style-position": "inside|outside",
@@ -1061,6 +1074,7 @@ export default {
1061
1074
  "page-break-before": "auto|always|avoid|left|right|recto|verso",
1062
1075
  "page-break-inside": "auto|avoid",
1063
1076
  "paint-order": "normal|[fill||stroke||markers]",
1077
+ "path-length": "none|<length> [0 , ∞]",
1064
1078
  "perspective": "none|<length>",
1065
1079
  "perspective-origin": "<position>",
1066
1080
  "place-content": "<'align-content'> <'justify-content'>?",
@@ -1159,7 +1173,7 @@ export default {
1159
1173
  "text-combine-upright": "none|all|[digits <integer>?]",
1160
1174
  "text-decoration": "<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>",
1161
1175
  "text-decoration-color": "<color>",
1162
- "text-decoration-inset": "<length>{1,2}|auto",
1176
+ "text-decoration-inset": "<length-percentage>{1,2}|auto",
1163
1177
  "text-decoration-line": "none|[underline||overline||line-through||blink]|spelling-error|grammar-error",
1164
1178
  "text-decoration-skip": "none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]",
1165
1179
  "text-decoration-skip-ink": "auto|all|none",
@@ -1169,6 +1183,7 @@ export default {
1169
1183
  "text-emphasis-color": "<color>",
1170
1184
  "text-emphasis-position": "auto|[over|under]&&[right|left]?",
1171
1185
  "text-emphasis-style": "none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>",
1186
+ "text-fit": "[none|grow|shrink] [consistent|per-line|per-line-all]? <percentage>?",
1172
1187
  "text-indent": "<length-percentage>&&hanging?&&each-line?",
1173
1188
  "text-justify": "auto|inter-character|inter-word|none",
1174
1189
  "text-orientation": "mixed|upright|sideways",
@@ -1334,7 +1349,9 @@ export default {
1334
1349
  },
1335
1350
  "font-feature-values": {
1336
1351
  "prelude": "<family-name>#",
1337
- "descriptors": null
1352
+ "descriptors": {
1353
+ "font-display": "auto|block|swap|fallback|optional"
1354
+ }
1338
1355
  },
1339
1356
  "font-palette-values": {
1340
1357
  "prelude": "<dashed-ident>",
@@ -1370,7 +1387,12 @@ export default {
1370
1387
  "bleed": "auto|<length>",
1371
1388
  "marks": "none|[crop||cross]",
1372
1389
  "page-orientation": "upright|rotate-left|rotate-right",
1373
- "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]"
1390
+ "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]",
1391
+ "margin-top": "<'margin-top'>",
1392
+ "margin-right": "<'margin-right'>",
1393
+ "margin-bottom": "<'margin-bottom'>",
1394
+ "margin-left": "<'margin-left'>",
1395
+ "margin": "<'margin'>"
1374
1396
  }
1375
1397
  },
1376
1398
  "position-try": {
@@ -1440,12 +1462,6 @@ export default {
1440
1462
  "navigation": "auto|none",
1441
1463
  "types": "none|<custom-ident>+"
1442
1464
  }
1443
- },
1444
- "font-features-values": {
1445
- "prelude": "[<string>|<custom-ident>]+",
1446
- "descriptors": {
1447
- "font-display": "auto|block|swap|fallback|optional"
1448
- }
1449
1465
  }
1450
1466
  }
1451
1467
  };
package/dist/version.cjs CHANGED
@@ -1 +1 @@
1
- module.exports = "4.0.5";
1
+ module.exports = "4.1.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "4.0.5";
1
+ export const version = "4.1.1";
package/lib/index.d.ts CHANGED
@@ -547,6 +547,11 @@ export interface AnPlusB extends CssNodeCommon {
547
547
  b: string | null;
548
548
  }
549
549
 
550
+ export interface AtKeyword extends CssNodeCommon {
551
+ type: "AtKeyword";
552
+ name: string;
553
+ }
554
+
550
555
  export interface Atrule extends CssNodeCommon {
551
556
  type: "Atrule";
552
557
  name: string;
@@ -665,14 +670,14 @@ export interface FeatureFunction extends CssNodeCommon {
665
670
  type: "FeatureFunction";
666
671
  feature: string;
667
672
  kind: string;
668
- value: Declaration | Selector;
673
+ value: AtKeyword | Declaration | Identifier | Raw | Selector | StringNode;
669
674
  }
670
675
 
671
676
  export interface FeatureFunctionPlain extends CssNodeCommon {
672
677
  type: "FeatureFunction";
673
678
  feature: string;
674
679
  kind: string;
675
- value: DeclarationPlain | SelectorPlain;
680
+ value: AtKeyword | DeclarationPlain | Identifier | Raw | SelectorPlain | StringNode;
676
681
  }
677
682
 
678
683
  export interface FeatureRange extends CssNodeCommon {
@@ -892,6 +897,7 @@ export interface WhiteSpace extends CssNodeCommon {
892
897
  /* IMPORTANT! If you update this, also update `CssNodePlain` */
893
898
  export type CssNode =
894
899
  | AnPlusB
900
+ | AtKeyword
895
901
  | Atrule
896
902
  | AtrulePrelude
897
903
  | AttributeSelector
@@ -943,6 +949,7 @@ export type CssNode =
943
949
  /* IMPORTANT! If you update this, also update `CssNode` */
944
950
  export type CssNodePlain =
945
951
  | AnPlusB
952
+ | AtKeyword
946
953
  | AtrulePlain
947
954
  | AtrulePreludePlain
948
955
  | AttributeSelector
@@ -2381,6 +2388,20 @@ export class SyntaxReferenceError extends SyntaxError {
2381
2388
  reference: string;
2382
2389
  }
2383
2390
 
2391
+ /**
2392
+ * Represents an error that occurs when a value cannot be matched because it
2393
+ * contains a function whose result is unknown at match time, such as `var()`
2394
+ * or `env()`. Extends the standard `SyntaxError`.
2395
+ */
2396
+ export class UnsupportedMatchingTree extends SyntaxError {
2397
+ name: "UnsupportedMatchingTree";
2398
+
2399
+ /**
2400
+ * A stable code identifying which unsupported function prevented matching.
2401
+ */
2402
+ code: "ERR_LEXER_VAR_MATCH_UNSUPPORTED" | "ERR_LEXER_ENV_MATCH_UNSUPPORTED";
2403
+ }
2404
+
2384
2405
  /**
2385
2406
  * Represents the result of a lexer match operation.
2386
2407
  */
@@ -2398,7 +2419,7 @@ export interface LexerMatchResult {
2398
2419
  /**
2399
2420
  * An error object if a matching error occurred, or `null` if no error.
2400
2421
  */
2401
- error: Error | SyntaxMatchError | SyntaxReferenceError | null;
2422
+ error: Error | SyntaxMatchError | SyntaxReferenceError | UnsupportedMatchingTree | null;
2402
2423
 
2403
2424
  /**
2404
2425
  * Retrieves the trace of matching operations for a specific node.
@@ -1,4 +1,4 @@
1
- import { SyntaxReferenceError, SyntaxMatchError } from './error.js';
1
+ import { SyntaxReferenceError, SyntaxMatchError, UnsupportedMatchingTree } from './error.js';
2
2
  import * as names from '../utils/names.js';
3
3
  import { cssWideKeywords } from './generic-const.js';
4
4
  import { createGenericTypes } from './generic.js';
@@ -87,11 +87,11 @@ function matchSyntax(lexer, syntax, value, useCssWideKeywords) {
87
87
  let result;
88
88
 
89
89
  if (valueHasVar(tokens)) {
90
- return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
90
+ return buildMatchResult(null, new UnsupportedMatchingTree('var'));
91
91
  }
92
92
 
93
93
  if (valueHasEnv(tokens)) {
94
- return buildMatchResult(null, new Error('Matching for a tree with env() is not supported'));
94
+ return buildMatchResult(null, new UnsupportedMatchingTree('env'));
95
95
  }
96
96
 
97
97
  if (useCssWideKeywords) {
@@ -92,6 +92,17 @@ export const SyntaxReferenceError = function(type, referenceName) {
92
92
  return error;
93
93
  };
94
94
 
95
+ export const UnsupportedMatchingTree = function(fnName) {
96
+ const error = createCustomError(
97
+ 'UnsupportedMatchingTree',
98
+ `Matching for a tree with ${fnName}() is not supported`
99
+ );
100
+
101
+ error.code = `ERR_LEXER_${fnName.toUpperCase()}_MATCH_UNSUPPORTED`;
102
+
103
+ return error;
104
+ };
105
+
95
106
  export const SyntaxMatchError = function(message, syntax, node, matchResult) {
96
107
  const error = createCustomError('SyntaxMatchError', message);
97
108
  const {
@@ -4,5 +4,6 @@ export const cssWideKeywords = [
4
4
  'inherit',
5
5
  'unset',
6
6
  'revert',
7
- 'revert-layer'
7
+ 'revert-layer',
8
+ 'revert-rule'
8
9
  ];
@@ -4,7 +4,8 @@ import {
4
4
  Url,
5
5
  Function as FunctionToken,
6
6
  LeftParenthesis,
7
- RightParenthesis
7
+ RightParenthesis,
8
+ Colon
8
9
  } from '../../tokenizer/index.js';
9
10
 
10
11
  function parseWithFallback(parse, fallback) {
@@ -42,8 +43,9 @@ const parseFunctions = {
42
43
  const children = this.createList();
43
44
  const node = parseWithFallback.call(
44
45
  this,
45
- this.Declaration,
46
- () => parseWithFallback.call(this, () => this.Condition('supports'))
46
+ this.tokenType === Ident && this.lookupTypeNonSC(1) === Colon
47
+ ? this.Declaration
48
+ : () => this.Condition('supports')
47
49
  );
48
50
 
49
51
  if (node.type !== 'Raw' || node.value !== '') {
@@ -2,7 +2,28 @@ import * as scope from '../scope/index.js';
2
2
  import atrule from '../atrule/index.js';
3
3
  import pseudo from '../pseudo/index.js';
4
4
  import * as node from '../node/index-parse.js';
5
- import { tokenize } from '../../tokenizer/index.js';
5
+ import {
6
+ Ident,
7
+ String as StringToken,
8
+ tokenize
9
+ } from '../../tokenizer/index.js';
10
+
11
+ function identifier() {
12
+ return this.Identifier();
13
+ }
14
+
15
+ function fontFormat() {
16
+ switch (this.tokenType) {
17
+ case Ident:
18
+ return this.Identifier();
19
+
20
+ case StringToken:
21
+ return this.String();
22
+
23
+ default:
24
+ this.error('Identifier or string is expected');
25
+ }
26
+ }
6
27
 
7
28
  export default {
8
29
  parseContext: {
@@ -31,7 +52,14 @@ export default {
31
52
  supports: {
32
53
  selector() {
33
54
  return this.Selector();
34
- }
55
+ },
56
+ 'font-tech': identifier,
57
+ 'font-format': fontFormat,
58
+ 'at-rule'() {
59
+ return this.AtKeyword();
60
+ },
61
+ 'named-feature': identifier,
62
+ env: identifier
35
63
  },
36
64
  container: {
37
65
  style() {
@@ -0,0 +1,22 @@
1
+ import { AtKeyword as AtKeywordToken } from '../../tokenizer/index.js';
2
+
3
+ export const name = 'AtKeyword';
4
+ export const structure = {
5
+ name: String
6
+ };
7
+
8
+ export function parse() {
9
+ const start = this.tokenStart;
10
+
11
+ this.eat(AtKeywordToken);
12
+
13
+ return {
14
+ type: 'AtKeyword',
15
+ loc: this.getLocation(start, this.tokenStart),
16
+ name: this.substrToCursor(start + 1)
17
+ };
18
+ }
19
+
20
+ export function generate(node) {
21
+ this.token(AtKeywordToken, '@' + node.name);
22
+ }
@@ -36,7 +36,12 @@ const parentheses = {
36
36
  media: featureOrRange,
37
37
  container: featureOrRange,
38
38
  supports() {
39
- return this.SupportsDeclaration();
39
+ if (this.lookupTypeNonSC(1) === Ident &&
40
+ this.lookupTypeNonSC(2) === Colon) {
41
+ return this.SupportsDeclaration();
42
+ }
43
+
44
+ return null;
40
45
  }
41
46
  };
42
47
 
@@ -157,9 +157,10 @@ function getImportant() {
157
157
  this.eat(Delim);
158
158
  this.skipSC();
159
159
 
160
+ const isImportant = this.cmpStr(this.tokenStart, this.tokenEnd, 'important');
160
161
  const important = this.consume(Ident);
161
162
 
162
- // store original value in case it differ from `important`
163
- // for better original source restoring and hacks like `!ie` support
164
- return important === 'important' ? true : important;
163
+ // Store non-standard values for better original source restoring and hacks
164
+ // like `!ie` support.
165
+ return isImportant ? true : important;
165
166
  }
@@ -7,7 +7,7 @@ export const name = 'FeatureFunction';
7
7
  export const structure = {
8
8
  kind: String,
9
9
  feature: String,
10
- value: ['Declaration', 'Selector']
10
+ value: ['Declaration', 'Selector', 'Identifier', 'String', 'AtKeyword', 'Raw']
11
11
  };
12
12
 
13
13
  function getFeatureParser(kind, name) {
@@ -33,6 +33,8 @@ export function parse(kind = 'unknown') {
33
33
  const startValueToken = this.tokenIndex;
34
34
  const value = valueParser.call(this);
35
35
 
36
+ this.skipSC();
37
+
36
38
  if (this.eof === false &&
37
39
  this.isBalanceEdge(startValueToken) === false) {
38
40
  this.error();
@@ -1,4 +1,5 @@
1
1
  export { generate as AnPlusB } from './AnPlusB.js';
2
+ export { generate as AtKeyword } from './AtKeyword.js';
2
3
  export { generate as Atrule } from './Atrule.js';
3
4
  export { generate as AtrulePrelude } from './AtrulePrelude.js';
4
5
  export { generate as AttributeSelector } from './AttributeSelector.js';
@@ -1,4 +1,5 @@
1
1
  export { parse as AnPlusB } from './AnPlusB.js';
2
+ export { parse as AtKeyword } from './AtKeyword.js';
2
3
  export { parse as Atrule } from './Atrule.js';
3
4
  export { parse as AtrulePrelude } from './AtrulePrelude.js';
4
5
  export { parse as AttributeSelector } from './AttributeSelector.js';
@@ -1,4 +1,5 @@
1
1
  export * as AnPlusB from './AnPlusB.js';
2
+ export * as AtKeyword from './AtKeyword.js';
2
3
  export * as Atrule from './Atrule.js';
3
4
  export * as AtrulePrelude from './AtrulePrelude.js';
4
5
  export * as AttributeSelector from './AttributeSelector.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/css-tree",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations",
5
5
  "author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)",
6
6
  "license": "MIT",
@@ -107,7 +107,7 @@
107
107
  "test:types": "tsc -p tests/types/tsconfig.json"
108
108
  },
109
109
  "dependencies": {
110
- "mdn-data": "2.29.0",
110
+ "mdn-data": "2.35.0",
111
111
  "source-map-js": "^1.2.1"
112
112
  },
113
113
  "devDependencies": {