@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/README.md
CHANGED
|
@@ -201,7 +201,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
|
201
201
|
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
|
202
202
|
|
|
203
203
|
<h3>Gold Sponsors</h3>
|
|
204
|
-
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a> <a href="https://www.coderabbit.ai/?utm_source=cr_org&utm_medium=github"><img src="https://avatars.githubusercontent.com/u/132028505" alt="CodeRabbit" height="96"></a></p><h3>Silver Sponsors</h3>
|
|
204
|
+
<p><a href="#"><img src="https://images.opencollective.com/vite-ecosystem-fund/logo.png" alt="Vite Ecosystem Fund" height="96"></a> <a href="https://forceindexer.com"><img src="https://images.opencollective.com/forceindexer/588566e/logo.png" alt="ForceIndexer" height="96"></a> <a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a> <a href="https://www.coderabbit.ai/?utm_source=cr_org&utm_medium=github"><img src="https://avatars.githubusercontent.com/u/132028505" alt="CodeRabbit" height="96"></a> <a href="https://automattic.com"><img src="https://avatars.githubusercontent.com/u/887802" alt="Automattic" height="96"></a></p><h3>Silver Sponsors</h3>
|
|
205
205
|
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/d472863/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/2d6c3b6/logo.png" alt="Liftoff" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
|
206
206
|
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://opensource.sap.com"><img src="https://avatars.githubusercontent.com/u/2531208" alt="SAP" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://citadel-ai.com"><img src="https://avatars.githubusercontent.com/u/75781367" alt="Citadel AI" height="32"></a> <a href="https://www.testmuai.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="TestMu AI Open Source Office (Formerly LambdaTest)" height="32"></a></p>
|
|
207
207
|
<h3>Technology Sponsors</h3>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const names = require('../../utils/names.cjs');
|
|
3
4
|
const types = require('../../tokenizer/types.cjs');
|
|
4
5
|
|
|
5
6
|
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
|
@@ -53,43 +54,32 @@ function isElementSelectorStart() {
|
|
|
53
54
|
return true;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
let offset = 3;
|
|
68
|
-
let tokenType;
|
|
69
|
-
|
|
70
|
-
// Skip whitespace and look for either a left curly bracket or other tokens
|
|
71
|
-
while (offset <= 15) { // Increased limit to handle function pseudo-classes
|
|
72
|
-
tokenType = this.lookupType(offset);
|
|
73
|
-
|
|
74
|
-
if (tokenType === types.LeftCurlyBracket) {
|
|
75
|
-
// Found opening brace, this is definitely a selector
|
|
76
|
-
return true;
|
|
77
|
-
} else if (tokenType === types.Semicolon || tokenType === types.RightCurlyBracket) {
|
|
78
|
-
// Found semicolon or closing brace before opening brace, likely a property
|
|
79
|
-
return false;
|
|
80
|
-
} else if (tokenType === types.WhiteSpace || tokenType === types.Comment) {
|
|
81
|
-
// Skip whitespace and comments
|
|
82
|
-
offset++;
|
|
83
|
-
continue;
|
|
84
|
-
} else {
|
|
85
|
-
// Other tokens might indicate more complex selectors, continue looking
|
|
86
|
-
offset++;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
57
|
+
// Custom property values may contain top-level curly blocks.
|
|
58
|
+
if (names.isCustomProperty(this.source, this.tokenStart)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Only top-level delimiters distinguish declarations from nested rules.
|
|
63
|
+
for (let offset = 1; this.tokenIndex + offset < this.tokenCount; offset++) {
|
|
64
|
+
const tokenType = this.lookupType(offset);
|
|
65
|
+
|
|
66
|
+
if (tokenType === types.LeftCurlyBracket) {
|
|
67
|
+
return true;
|
|
89
68
|
}
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
if (tokenType === types.Semicolon || tokenType === types.RightCurlyBracket) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this.isBlockOpenerTokenType(tokenType)) {
|
|
75
|
+
const pairIndex = this.getBlockTokenPairIndex(this.tokenIndex + offset);
|
|
76
|
+
|
|
77
|
+
if (pairIndex === -1) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
offset = pairIndex - this.tokenIndex;
|
|
82
|
+
}
|
|
93
83
|
}
|
|
94
84
|
|
|
95
85
|
return false;
|
|
@@ -17,8 +17,29 @@ const structure = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
function featureOrRange(kind) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const firstToken = this.lookupTypeNonSC(1);
|
|
21
|
+
let secondToken = this.lookupTypeNonSC(2);
|
|
22
|
+
|
|
23
|
+
if (firstToken === types.Function) {
|
|
24
|
+
let index = this.getBlockTokenPairIndex(this.tokenIndex + this.lookupOffsetNonSC(1));
|
|
25
|
+
|
|
26
|
+
if (index !== -1) {
|
|
27
|
+
do {
|
|
28
|
+
secondToken = this.getTokenType(++index);
|
|
29
|
+
} while (secondToken === types.WhiteSpace || secondToken === types.Comment);
|
|
30
|
+
|
|
31
|
+
if (secondToken !== types.Delim) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (firstToken === types.LeftParenthesis ||
|
|
38
|
+
(firstToken === types.Ident && (secondToken === types.LeftParenthesis || secondToken === types.Function))) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (firstToken === types.Ident && likelyFeatureToken.has(secondToken)) {
|
|
22
43
|
return this.Feature(kind);
|
|
23
44
|
}
|
|
24
45
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const lang = require('./lang.cjs');
|
|
4
|
+
const types = require('../../tokenizer/types.cjs');
|
|
4
5
|
|
|
5
6
|
const selectorList = {
|
|
6
7
|
parse() {
|
|
@@ -26,6 +27,19 @@ const identList = {
|
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
const identSequence = {
|
|
31
|
+
parse() {
|
|
32
|
+
const children = this.createList();
|
|
33
|
+
|
|
34
|
+
do {
|
|
35
|
+
children.push(this.Identifier());
|
|
36
|
+
this.skipSC();
|
|
37
|
+
} while (this.tokenType === types.Ident);
|
|
38
|
+
|
|
39
|
+
return children;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
29
43
|
const langList = {
|
|
30
44
|
parse: lang.parseLanguageRangeList
|
|
31
45
|
};
|
|
@@ -54,7 +68,8 @@ const pseudo = {
|
|
|
54
68
|
'nth-of-type': nth,
|
|
55
69
|
'slotted': selector,
|
|
56
70
|
'host': selector,
|
|
57
|
-
'host-context': selector
|
|
71
|
+
'host-context': selector,
|
|
72
|
+
'part': identSequence
|
|
58
73
|
};
|
|
59
74
|
|
|
60
75
|
module.exports = pseudo;
|
package/data/patch.json
CHANGED
|
@@ -939,6 +939,9 @@
|
|
|
939
939
|
"comment": "missed, https://drafts.csswg.org/css-contain-3/#container-rule",
|
|
940
940
|
"syntax": "( <style-condition> ) | ( <style-feature> ) | <general-enclosed>"
|
|
941
941
|
},
|
|
942
|
+
"style-feature": {
|
|
943
|
+
"syntax": "<declaration> | <custom-property-name>"
|
|
944
|
+
},
|
|
942
945
|
"supports-feature": {
|
|
943
946
|
"syntax": "<supports-selector-fn> | <supports-font-tech-fn> | <supports-font-format-fn> | <supports-at-rule-fn> | <supports-named-feature-fn> | <supports-env-fn> | <supports-decl>"
|
|
944
947
|
},
|