-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(style-compiler): enable :root & :host-context() for native-shado…
…w-only CSS (#4833) Co-authored-by: Nolan Lawson <[email protected]>
- Loading branch information
1 parent
bf231db
commit c6ca331
Showing
18 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...tests__/fixtures/disable-synthetic-shadow-support-host-context-selector-scoped/actual.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:host-context(.foo) {} |
4 changes: 4 additions & 0 deletions
4
...ests__/fixtures/disable-synthetic-shadow-support-host-context-selector-scoped/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"disableSyntheticShadowSupport": true, | ||
"scoped": true | ||
} |
6 changes: 6 additions & 0 deletions
6
...tests__/fixtures/disable-synthetic-shadow-support-host-context-selector-scoped/error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "CssSyntaxError", | ||
"reason": "Invalid usage of unsupported selector \":host-context\". This selector is only supported in non-scoped CSS where the `disableSyntheticShadowSupport` flag is set to true.", | ||
"column": 1, | ||
"line": 1 | ||
} |
1 change: 1 addition & 0 deletions
1
.../src/__tests__/fixtures/disable-synthetic-shadow-support-host-context-selector/actual.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:host-context(.foo) {} |
3 changes: 3 additions & 0 deletions
3
...src/__tests__/fixtures/disable-synthetic-shadow-support-host-context-selector/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"disableSyntheticShadowSupport": true | ||
} |
12 changes: 12 additions & 0 deletions
12
...src/__tests__/fixtures/disable-synthetic-shadow-support-host-context-selector/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function stylesheet() { | ||
var token; | ||
var useActualHostSelector = true; | ||
var useNativeDirPseudoclass = true; | ||
var shadowSelector = token ? ("[" + token + "]") : ""; | ||
var hostSelector = token ? ("[" + token + "-host]") : ""; | ||
var suffixToken = token ? ("-" + token) : ""; | ||
return ":host-context(.foo)" + shadowSelector + " {}"; | ||
/*LWC compiler vX.X.X*/ | ||
} | ||
stylesheet.$nativeOnly$ = true; | ||
export default [stylesheet]; |
1 change: 1 addition & 0 deletions
1
...r/src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector-scoped/actual.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:root {} |
4 changes: 4 additions & 0 deletions
4
.../src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector-scoped/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"disableSyntheticShadowSupport": true, | ||
"scoped": true | ||
} |
6 changes: 6 additions & 0 deletions
6
...r/src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector-scoped/error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "CssSyntaxError", | ||
"reason": "Invalid usage of unsupported selector \":root\". This selector is only supported in non-scoped CSS where the `disableSyntheticShadowSupport` flag is set to true.", | ||
"column": 1, | ||
"line": 1 | ||
} |
1 change: 1 addition & 0 deletions
1
...compiler/src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector/actual.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:root {} |
3 changes: 3 additions & 0 deletions
3
...ompiler/src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"disableSyntheticShadowSupport": true | ||
} |
12 changes: 12 additions & 0 deletions
12
...ompiler/src/__tests__/fixtures/disable-synthetic-shadow-support-root-selector/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function stylesheet() { | ||
var token; | ||
var useActualHostSelector = true; | ||
var useNativeDirPseudoclass = true; | ||
var shadowSelector = token ? ("[" + token + "]") : ""; | ||
var hostSelector = token ? ("[" + token + "-host]") : ""; | ||
var suffixToken = token ? ("-" + token) : ""; | ||
return ":root" + shadowSelector + " {}"; | ||
/*LWC compiler vX.X.X*/ | ||
} | ||
stylesheet.$nativeOnly$ = true; | ||
export default [stylesheet]; |
2 changes: 1 addition & 1 deletion
2
...s/@lwc/style-compiler/src/__tests__/fixtures/unsupported-host-context-selector/error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "CssSyntaxError", | ||
"reason": "Invalid usage of unsupported selector \":host-context\".", | ||
"reason": "Invalid usage of unsupported selector \":host-context\". This selector is only supported in non-scoped CSS where the `disableSyntheticShadowSupport` flag is set to true.", | ||
"column": 1, | ||
"line": 1 | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/@lwc/style-compiler/src/__tests__/fixtures/unsupported-root-selector/error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "CssSyntaxError", | ||
"reason": "Invalid usage of unsupported selector \":root\".", | ||
"reason": "Invalid usage of unsupported selector \":root\". This selector is only supported in non-scoped CSS where the `disableSyntheticShadowSupport` flag is set to true.", | ||
"column": 1, | ||
"line": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters