@eslint/css-tree 3.6.7 → 3.6.9
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 +3 -3
- package/cjs/syntax/atrule/layer.cjs +2 -2
- package/cjs/syntax/node/Block.cjs +40 -0
- package/cjs/syntax/node/DeclarationList.cjs +18 -6
- package/data/patch.json +6 -0
- package/dist/csstree.esm.js +6 -6
- package/dist/csstree.js +5 -5
- package/dist/data.cjs +2 -1
- package/dist/data.js +2 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/lib/syntax/atrule/layer.js +2 -2
- package/lib/syntax/node/Block.js +41 -0
- package/lib/syntax/node/DeclarationList.js +21 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -201,10 +201,10 @@ 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>Platinum Sponsors</h3>
|
|
204
|
-
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a
|
|
204
|
+
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a></p><h3>Gold Sponsors</h3>
|
|
205
205
|
<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></p><h3>Silver Sponsors</h3>
|
|
206
|
-
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/
|
|
207
|
-
<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://
|
|
206
|
+
<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>
|
|
207
|
+
<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://www.crawljobs.com/"><img src="https://images.opencollective.com/crawljobs-poland/fa43a17/logo.png" alt="CrawlJobs" height="32"></a> <a href="https://depot.dev"><img src="https://images.opencollective.com/depot/39125a1/logo.png" alt="Depot" height="32"></a> <a href="https://www.n-ix.com/"><img src="https://images.opencollective.com/n-ix-ltd/575a7a5/logo.png" alt="N-iX Ltd" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" 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://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="TestMu AI Open Source Office (Formerly LambdaTest)" height="32"></a></p>
|
|
208
208
|
<h3>Technology Sponsors</h3>
|
|
209
209
|
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
|
210
210
|
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
|
@@ -48,10 +48,50 @@ function isElementSelectorStart() {
|
|
|
48
48
|
|
|
49
49
|
const nextTokenType = this.lookupTypeNonSC(1);
|
|
50
50
|
|
|
51
|
+
// If next token is not colon, semicolon, or right curly bracket, it's likely a selector
|
|
51
52
|
if (nextTokenType !== types.Colon && nextTokenType !== types.Semicolon && nextTokenType !== types.RightCurlyBracket) {
|
|
52
53
|
return true;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
// If next token is colon, we need to look further ahead to distinguish
|
|
57
|
+
// between property declarations (p: value) and pseudo-class selectors (p:hover)
|
|
58
|
+
if (nextTokenType === types.Colon) {
|
|
59
|
+
// Look for the token after the colon (skipping whitespace)
|
|
60
|
+
const tokenAfterColon = this.lookupTypeNonSC(2);
|
|
61
|
+
|
|
62
|
+
// If it's an identifier (like 'hover', 'first-of-type') or function (like 'nth-child()', 'not()'),
|
|
63
|
+
// this could be a pseudo-class
|
|
64
|
+
if (tokenAfterColon === types.Ident || tokenAfterColon === types.Function) {
|
|
65
|
+
// Look further ahead to see if there's a left curly bracket
|
|
66
|
+
// which would indicate this is a selector with a block
|
|
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
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// If we can't determine conclusively, default to property behavior
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
55
95
|
return false;
|
|
56
96
|
}
|
|
57
97
|
|
|
@@ -29,12 +29,17 @@ function isElementSelectorStart() {
|
|
|
29
29
|
|
|
30
30
|
const nextTokenType = this.lookupTypeNonSC(1);
|
|
31
31
|
|
|
32
|
-
//
|
|
33
|
-
if (nextTokenType
|
|
32
|
+
// If next token is a left curly bracket, it's definitely a selector (e.g., "div { ... }")
|
|
33
|
+
if (nextTokenType === types.LeftCurlyBracket) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// If next token is semicolon, comma, or closing brace, it's definitely a declaration
|
|
38
|
+
if (nextTokenType === types.Semicolon || nextTokenType === types.Comma || nextTokenType === types.RightCurlyBracket) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Special handling for colon case - could be pseudo-class/pseudo-element or property
|
|
38
43
|
if (nextTokenType === types.Colon) {
|
|
39
44
|
// Look ahead further to see what follows the colon
|
|
40
45
|
const afterColonType = this.lookupTypeNonSC(2);
|
|
@@ -43,12 +48,19 @@ function isElementSelectorStart() {
|
|
|
43
48
|
// check what comes after that
|
|
44
49
|
if (afterColonType === types.Ident) {
|
|
45
50
|
const afterPseudoType = this.lookupTypeNonSC(3);
|
|
46
|
-
// If it's followed by {
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
// If it's followed by {, it's definitely a selector (e.g., "div:hover { ... }")
|
|
52
|
+
if (afterPseudoType === types.LeftCurlyBracket) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
// Otherwise, it's a property (e.g., "transition: opacity 1s")
|
|
56
|
+
return false;
|
|
49
57
|
}
|
|
58
|
+
// If after colon there's not an identifier, it's a property
|
|
59
|
+
return false;
|
|
50
60
|
}
|
|
51
61
|
|
|
62
|
+
// For other token types (dimensions, numbers, strings, etc.), assume it's a declaration
|
|
63
|
+
// This handles cases like multi-value properties
|
|
52
64
|
return false;
|
|
53
65
|
}
|
|
54
66
|
|
package/data/patch.json
CHANGED
|
@@ -649,6 +649,9 @@
|
|
|
649
649
|
"cmyk-component": {
|
|
650
650
|
"syntax": "<number> | <percentage> | none"
|
|
651
651
|
},
|
|
652
|
+
"color-function": {
|
|
653
|
+
"syntax": "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <lab()> | <lch()> | <oklab()> | <oklch()> | <alpha()> | <color()>"
|
|
654
|
+
},
|
|
652
655
|
"color-mix()": {
|
|
653
656
|
"syntax": "color-mix( <color-interpolation-method> , [ <color> && <percentage [0,100]>? ]#{2} )"
|
|
654
657
|
},
|
|
@@ -866,6 +869,9 @@
|
|
|
866
869
|
"oklch()": {
|
|
867
870
|
"syntax": "<legacy-oklch-syntax> | <modern-oklch-syntax>"
|
|
868
871
|
},
|
|
872
|
+
"alpha()": {
|
|
873
|
+
"syntax": "alpha( [ from <color> ] [ / [ <alpha-value> | none ] ]? )"
|
|
874
|
+
},
|
|
869
875
|
"colorspace-params": {
|
|
870
876
|
"syntax": "[ <predefined-rgb-params> | <xyz-params>]"
|
|
871
877
|
},
|