@eslint/css-tree 4.0.5 → 4.1.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/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": [
@@ -504,6 +505,7 @@ module.exports = {
504
505
  "device-cmyk()": "<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>",
505
506
  "legacy-device-cmyk-syntax": "device-cmyk( <number>#{4} )",
506
507
  "modern-device-cmyk-syntax": "device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )",
508
+ "param()": "param( <dashed-ident> , <declaration-value>? )",
507
509
  "cmyk-component": "<number>|<percentage>|none",
508
510
  "color-space": "<rectangular-color-space>|<polar-color-space>|<custom-color-space>",
509
511
  "right": "<length>|auto",
@@ -872,8 +874,9 @@ module.exports = {
872
874
  "flex-direction": "row|row-reverse|column|column-reverse",
873
875
  "flex-flow": "<'flex-direction'>||<'flex-wrap'>",
874
876
  "flex-grow": "<number>",
877
+ "flex-line-count": "<integer [1,∞]>",
875
878
  "flex-shrink": "<number>",
876
- "flex-wrap": "nowrap|wrap|wrap-reverse",
879
+ "flex-wrap": "nowrap|[wrap|wrap-reverse]||balance",
877
880
  "float": "left|right|none|inline-start|inline-end",
878
881
  "flood-color": "<color>",
879
882
  "flood-opacity": "<'opacity'>",
@@ -962,6 +965,7 @@ module.exports = {
962
965
  "line-clamp": "none|<integer>",
963
966
  "line-height": "normal|<number>|<length>|<percentage>",
964
967
  "line-height-step": "<length>",
968
+ "link-parameters": "none|<param()>#",
965
969
  "list-style": "<'list-style-type'>||<'list-style-position'>||<'list-style-image'>",
966
970
  "list-style-image": "<image>|none",
967
971
  "list-style-position": "inside|outside",
@@ -1061,6 +1065,7 @@ module.exports = {
1061
1065
  "page-break-before": "auto|always|avoid|left|right|recto|verso",
1062
1066
  "page-break-inside": "auto|avoid",
1063
1067
  "paint-order": "normal|[fill||stroke||markers]",
1068
+ "path-length": "none|<length> [0 , ∞]",
1064
1069
  "perspective": "none|<length>",
1065
1070
  "perspective-origin": "<position>",
1066
1071
  "place-content": "<'align-content'> <'justify-content'>?",
@@ -1159,7 +1164,7 @@ module.exports = {
1159
1164
  "text-combine-upright": "none|all|[digits <integer>?]",
1160
1165
  "text-decoration": "<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>",
1161
1166
  "text-decoration-color": "<color>",
1162
- "text-decoration-inset": "<length>{1,2}|auto",
1167
+ "text-decoration-inset": "<length-percentage>{1,2}|auto",
1163
1168
  "text-decoration-line": "none|[underline||overline||line-through||blink]|spelling-error|grammar-error",
1164
1169
  "text-decoration-skip": "none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]",
1165
1170
  "text-decoration-skip-ink": "auto|all|none",
@@ -1169,6 +1174,7 @@ module.exports = {
1169
1174
  "text-emphasis-color": "<color>",
1170
1175
  "text-emphasis-position": "auto|[over|under]&&[right|left]?",
1171
1176
  "text-emphasis-style": "none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>",
1177
+ "text-fit": "[none|grow|shrink] [consistent|per-line|per-line-all]? <percentage>?",
1172
1178
  "text-indent": "<length-percentage>&&hanging?&&each-line?",
1173
1179
  "text-justify": "auto|inter-character|inter-word|none",
1174
1180
  "text-orientation": "mixed|upright|sideways",
@@ -1334,7 +1340,9 @@ module.exports = {
1334
1340
  },
1335
1341
  "font-feature-values": {
1336
1342
  "prelude": "<family-name>#",
1337
- "descriptors": null
1343
+ "descriptors": {
1344
+ "font-display": "auto|block|swap|fallback|optional"
1345
+ }
1338
1346
  },
1339
1347
  "font-palette-values": {
1340
1348
  "prelude": "<dashed-ident>",
@@ -1370,7 +1378,12 @@ module.exports = {
1370
1378
  "bleed": "auto|<length>",
1371
1379
  "marks": "none|[crop||cross]",
1372
1380
  "page-orientation": "upright|rotate-left|rotate-right",
1373
- "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]"
1381
+ "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]",
1382
+ "margin-top": "<'margin-top'>",
1383
+ "margin-right": "<'margin-right'>",
1384
+ "margin-bottom": "<'margin-bottom'>",
1385
+ "margin-left": "<'margin-left'>",
1386
+ "margin": "<'margin'>"
1374
1387
  }
1375
1388
  },
1376
1389
  "position-try": {
@@ -1440,12 +1453,6 @@ module.exports = {
1440
1453
  "navigation": "auto|none",
1441
1454
  "types": "none|<custom-ident>+"
1442
1455
  }
1443
- },
1444
- "font-features-values": {
1445
- "prelude": "[<string>|<custom-ident>]+",
1446
- "descriptors": {
1447
- "font-display": "auto|block|swap|fallback|optional"
1448
- }
1449
1456
  }
1450
1457
  }
1451
1458
  };
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": [
@@ -504,6 +505,7 @@ export default {
504
505
  "device-cmyk()": "<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>",
505
506
  "legacy-device-cmyk-syntax": "device-cmyk( <number>#{4} )",
506
507
  "modern-device-cmyk-syntax": "device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )",
508
+ "param()": "param( <dashed-ident> , <declaration-value>? )",
507
509
  "cmyk-component": "<number>|<percentage>|none",
508
510
  "color-space": "<rectangular-color-space>|<polar-color-space>|<custom-color-space>",
509
511
  "right": "<length>|auto",
@@ -872,8 +874,9 @@ export default {
872
874
  "flex-direction": "row|row-reverse|column|column-reverse",
873
875
  "flex-flow": "<'flex-direction'>||<'flex-wrap'>",
874
876
  "flex-grow": "<number>",
877
+ "flex-line-count": "<integer [1,∞]>",
875
878
  "flex-shrink": "<number>",
876
- "flex-wrap": "nowrap|wrap|wrap-reverse",
879
+ "flex-wrap": "nowrap|[wrap|wrap-reverse]||balance",
877
880
  "float": "left|right|none|inline-start|inline-end",
878
881
  "flood-color": "<color>",
879
882
  "flood-opacity": "<'opacity'>",
@@ -962,6 +965,7 @@ export default {
962
965
  "line-clamp": "none|<integer>",
963
966
  "line-height": "normal|<number>|<length>|<percentage>",
964
967
  "line-height-step": "<length>",
968
+ "link-parameters": "none|<param()>#",
965
969
  "list-style": "<'list-style-type'>||<'list-style-position'>||<'list-style-image'>",
966
970
  "list-style-image": "<image>|none",
967
971
  "list-style-position": "inside|outside",
@@ -1061,6 +1065,7 @@ export default {
1061
1065
  "page-break-before": "auto|always|avoid|left|right|recto|verso",
1062
1066
  "page-break-inside": "auto|avoid",
1063
1067
  "paint-order": "normal|[fill||stroke||markers]",
1068
+ "path-length": "none|<length> [0 , ∞]",
1064
1069
  "perspective": "none|<length>",
1065
1070
  "perspective-origin": "<position>",
1066
1071
  "place-content": "<'align-content'> <'justify-content'>?",
@@ -1159,7 +1164,7 @@ export default {
1159
1164
  "text-combine-upright": "none|all|[digits <integer>?]",
1160
1165
  "text-decoration": "<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>",
1161
1166
  "text-decoration-color": "<color>",
1162
- "text-decoration-inset": "<length>{1,2}|auto",
1167
+ "text-decoration-inset": "<length-percentage>{1,2}|auto",
1163
1168
  "text-decoration-line": "none|[underline||overline||line-through||blink]|spelling-error|grammar-error",
1164
1169
  "text-decoration-skip": "none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]",
1165
1170
  "text-decoration-skip-ink": "auto|all|none",
@@ -1169,6 +1174,7 @@ export default {
1169
1174
  "text-emphasis-color": "<color>",
1170
1175
  "text-emphasis-position": "auto|[over|under]&&[right|left]?",
1171
1176
  "text-emphasis-style": "none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>",
1177
+ "text-fit": "[none|grow|shrink] [consistent|per-line|per-line-all]? <percentage>?",
1172
1178
  "text-indent": "<length-percentage>&&hanging?&&each-line?",
1173
1179
  "text-justify": "auto|inter-character|inter-word|none",
1174
1180
  "text-orientation": "mixed|upright|sideways",
@@ -1334,7 +1340,9 @@ export default {
1334
1340
  },
1335
1341
  "font-feature-values": {
1336
1342
  "prelude": "<family-name>#",
1337
- "descriptors": null
1343
+ "descriptors": {
1344
+ "font-display": "auto|block|swap|fallback|optional"
1345
+ }
1338
1346
  },
1339
1347
  "font-palette-values": {
1340
1348
  "prelude": "<dashed-ident>",
@@ -1370,7 +1378,12 @@ export default {
1370
1378
  "bleed": "auto|<length>",
1371
1379
  "marks": "none|[crop||cross]",
1372
1380
  "page-orientation": "upright|rotate-left|rotate-right",
1373
- "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]"
1381
+ "size": "<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]",
1382
+ "margin-top": "<'margin-top'>",
1383
+ "margin-right": "<'margin-right'>",
1384
+ "margin-bottom": "<'margin-bottom'>",
1385
+ "margin-left": "<'margin-left'>",
1386
+ "margin": "<'margin'>"
1374
1387
  }
1375
1388
  },
1376
1389
  "position-try": {
@@ -1440,12 +1453,6 @@ export default {
1440
1453
  "navigation": "auto|none",
1441
1454
  "types": "none|<custom-ident>+"
1442
1455
  }
1443
- },
1444
- "font-features-values": {
1445
- "prelude": "[<string>|<custom-ident>]+",
1446
- "descriptors": {
1447
- "font-display": "auto|block|swap|fallback|optional"
1448
- }
1449
1456
  }
1450
1457
  }
1451
1458
  };
package/dist/version.cjs CHANGED
@@ -1 +1 @@
1
- module.exports = "4.0.5";
1
+ module.exports = "4.1.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "4.0.5";
1
+ export const version = "4.1.0";
package/lib/index.d.ts CHANGED
@@ -2381,6 +2381,20 @@ export class SyntaxReferenceError extends SyntaxError {
2381
2381
  reference: string;
2382
2382
  }
2383
2383
 
2384
+ /**
2385
+ * Represents an error that occurs when a value cannot be matched because it
2386
+ * contains a function whose result is unknown at match time, such as `var()`
2387
+ * or `env()`. Extends the standard `SyntaxError`.
2388
+ */
2389
+ export class UnsupportedMatchingTree extends SyntaxError {
2390
+ name: "UnsupportedMatchingTree";
2391
+
2392
+ /**
2393
+ * A stable code identifying which unsupported function prevented matching.
2394
+ */
2395
+ code: "ERR_LEXER_VAR_MATCH_UNSUPPORTED" | "ERR_LEXER_ENV_MATCH_UNSUPPORTED";
2396
+ }
2397
+
2384
2398
  /**
2385
2399
  * Represents the result of a lexer match operation.
2386
2400
  */
@@ -2398,7 +2412,7 @@ export interface LexerMatchResult {
2398
2412
  /**
2399
2413
  * An error object if a matching error occurred, or `null` if no error.
2400
2414
  */
2401
- error: Error | SyntaxMatchError | SyntaxReferenceError | null;
2415
+ error: Error | SyntaxMatchError | SyntaxReferenceError | UnsupportedMatchingTree | null;
2402
2416
 
2403
2417
  /**
2404
2418
  * 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
  ];
@@ -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
  }
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.0",
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.34.0",
111
111
  "source-map-js": "^1.2.1"
112
112
  },
113
113
  "devDependencies": {