@eslint/css-tree 4.1.2 → 4.1.3
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/README.md +1 -1
- package/cjs/syntax/config/parser.cjs +4 -0
- package/cjs/syntax/node/Block.cjs +25 -35
- package/cjs/syntax/node/Condition.cjs +23 -2
- package/cjs/syntax/pseudo/index.cjs +16 -1
- package/data/patch.json +3 -0
- package/dist/csstree.esm.js +5 -5
- package/dist/csstree.js +5 -5
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/lib/syntax/config/parser.js +5 -0
- package/lib/syntax/node/Block.js +25 -36
- package/lib/syntax/node/Condition.js +24 -3
- package/lib/syntax/pseudo/index.js +16 -1
- package/package.json +1 -1
package/dist/data.cjs
CHANGED
|
@@ -420,7 +420,7 @@ module.exports = {
|
|
|
420
420
|
"step-position": "jump-start|jump-end|jump-none|jump-both|start|end",
|
|
421
421
|
"step-easing-function": "step-start|step-end|<steps()>",
|
|
422
422
|
"steps()": "steps( <integer> , <step-position>? )",
|
|
423
|
-
"style-feature": "<declaration>",
|
|
423
|
+
"style-feature": "<declaration>|<custom-property-name>",
|
|
424
424
|
"style-in-parens": "( <style-condition> )|( <style-feature> )|<general-enclosed>",
|
|
425
425
|
"style-query": "<style-condition>|<style-feature>",
|
|
426
426
|
"subclass-selector": "<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>",
|
package/dist/data.js
CHANGED
|
@@ -420,7 +420,7 @@ export default {
|
|
|
420
420
|
"step-position": "jump-start|jump-end|jump-none|jump-both|start|end",
|
|
421
421
|
"step-easing-function": "step-start|step-end|<steps()>",
|
|
422
422
|
"steps()": "steps( <integer> , <step-position>? )",
|
|
423
|
-
"style-feature": "<declaration>",
|
|
423
|
+
"style-feature": "<declaration>|<custom-property-name>",
|
|
424
424
|
"style-in-parens": "( <style-condition> )|( <style-feature> )|<general-enclosed>",
|
|
425
425
|
"style-query": "<style-condition>|<style-feature>",
|
|
426
426
|
"subclass-selector": "<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>",
|
package/dist/version.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = "4.1.
|
|
1
|
+
module.exports = "4.1.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "4.1.
|
|
1
|
+
export const version = "4.1.3";
|
|
@@ -5,6 +5,7 @@ import * as node from '../node/index-parse.js';
|
|
|
5
5
|
import {
|
|
6
6
|
Ident,
|
|
7
7
|
String as StringToken,
|
|
8
|
+
Colon,
|
|
8
9
|
tokenize
|
|
9
10
|
} from '../../tokenizer/index.js';
|
|
10
11
|
|
|
@@ -63,6 +64,10 @@ export default {
|
|
|
63
64
|
},
|
|
64
65
|
container: {
|
|
65
66
|
style() {
|
|
67
|
+
if (this.tokenType === Ident && this.lookupTypeNonSC(1) !== Colon) {
|
|
68
|
+
return this.Identifier();
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
return this.Declaration();
|
|
67
72
|
}
|
|
68
73
|
}
|
package/lib/syntax/node/Block.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
Hash,
|
|
7
7
|
Colon,
|
|
8
8
|
Ident,
|
|
9
|
-
Function,
|
|
10
9
|
AtKeyword,
|
|
11
10
|
LeftSquareBracket,
|
|
12
11
|
LeftCurlyBracket,
|
|
13
12
|
RightCurlyBracket
|
|
14
13
|
} from '../../tokenizer/index.js';
|
|
14
|
+
import { isCustomProperty } from '../../utils/names.js';
|
|
15
15
|
|
|
16
16
|
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
|
17
17
|
const DOT = 0x002E; // U+002E FULL STOP (.)
|
|
@@ -64,43 +64,32 @@ function isElementSelectorStart() {
|
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let offset = 3;
|
|
79
|
-
let tokenType;
|
|
80
|
-
|
|
81
|
-
// Skip whitespace and look for either a left curly bracket or other tokens
|
|
82
|
-
while (offset <= 15) { // Increased limit to handle function pseudo-classes
|
|
83
|
-
tokenType = this.lookupType(offset);
|
|
84
|
-
|
|
85
|
-
if (tokenType === LeftCurlyBracket) {
|
|
86
|
-
// Found opening brace, this is definitely a selector
|
|
87
|
-
return true;
|
|
88
|
-
} else if (tokenType === Semicolon || tokenType === RightCurlyBracket) {
|
|
89
|
-
// Found semicolon or closing brace before opening brace, likely a property
|
|
90
|
-
return false;
|
|
91
|
-
} else if (tokenType === WhiteSpace || tokenType === Comment) {
|
|
92
|
-
// Skip whitespace and comments
|
|
93
|
-
offset++;
|
|
94
|
-
continue;
|
|
95
|
-
} else {
|
|
96
|
-
// Other tokens might indicate more complex selectors, continue looking
|
|
97
|
-
offset++;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
67
|
+
// Custom property values may contain top-level curly blocks.
|
|
68
|
+
if (isCustomProperty(this.source, this.tokenStart)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Only top-level delimiters distinguish declarations from nested rules.
|
|
73
|
+
for (let offset = 1; this.tokenIndex + offset < this.tokenCount; offset++) {
|
|
74
|
+
const tokenType = this.lookupType(offset);
|
|
75
|
+
|
|
76
|
+
if (tokenType === LeftCurlyBracket) {
|
|
77
|
+
return true;
|
|
100
78
|
}
|
|
101
79
|
|
|
102
|
-
|
|
103
|
-
|
|
80
|
+
if (tokenType === Semicolon || tokenType === RightCurlyBracket) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (this.isBlockOpenerTokenType(tokenType)) {
|
|
85
|
+
const pairIndex = this.getBlockTokenPairIndex(this.tokenIndex + offset);
|
|
86
|
+
|
|
87
|
+
if (pairIndex === -1) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
offset = pairIndex - this.tokenIndex;
|
|
92
|
+
}
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
return false;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
RightParenthesis,
|
|
7
7
|
Function as FunctionToken,
|
|
8
8
|
Colon,
|
|
9
|
+
Delim,
|
|
9
10
|
EOF
|
|
10
11
|
} from '../../tokenizer/index.js';
|
|
11
12
|
|
|
@@ -24,8 +25,29 @@ export const structure = {
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
function featureOrRange(kind) {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const firstToken = this.lookupTypeNonSC(1);
|
|
29
|
+
let secondToken = this.lookupTypeNonSC(2);
|
|
30
|
+
|
|
31
|
+
if (firstToken === FunctionToken) {
|
|
32
|
+
let index = this.getBlockTokenPairIndex(this.tokenIndex + this.lookupOffsetNonSC(1));
|
|
33
|
+
|
|
34
|
+
if (index !== -1) {
|
|
35
|
+
do {
|
|
36
|
+
secondToken = this.getTokenType(++index);
|
|
37
|
+
} while (secondToken === WhiteSpace || secondToken === Comment);
|
|
38
|
+
|
|
39
|
+
if (secondToken !== Delim) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (firstToken === LeftParenthesis ||
|
|
46
|
+
(firstToken === Ident && (secondToken === LeftParenthesis || secondToken === FunctionToken))) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (firstToken === Ident && likelyFeatureToken.has(secondToken)) {
|
|
29
51
|
return this.Feature(kind);
|
|
30
52
|
}
|
|
31
53
|
|
|
@@ -125,4 +147,3 @@ export function generate(node) {
|
|
|
125
147
|
}
|
|
126
148
|
});
|
|
127
149
|
}
|
|
128
|
-
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ident } from '../../tokenizer/index.js';
|
|
1
2
|
import { parseLanguageRangeList } from './lang.js';
|
|
2
3
|
|
|
3
4
|
const selectorList = {
|
|
@@ -24,6 +25,19 @@ const identList = {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
const identSequence = {
|
|
29
|
+
parse() {
|
|
30
|
+
const children = this.createList();
|
|
31
|
+
|
|
32
|
+
do {
|
|
33
|
+
children.push(this.Identifier());
|
|
34
|
+
this.skipSC();
|
|
35
|
+
} while (this.tokenType === Ident);
|
|
36
|
+
|
|
37
|
+
return children;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
27
41
|
const langList = {
|
|
28
42
|
parse: parseLanguageRangeList
|
|
29
43
|
};
|
|
@@ -52,5 +66,6 @@ export default {
|
|
|
52
66
|
'nth-of-type': nth,
|
|
53
67
|
'slotted': selector,
|
|
54
68
|
'host': selector,
|
|
55
|
-
'host-context': selector
|
|
69
|
+
'host-context': selector,
|
|
70
|
+
'part': identSequence
|
|
56
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint/css-tree",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
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",
|