Scrub :host-context() from everywhere

This commit is contained in:
Lea Verou
2025-03-21 11:52:28 -04:00
parent 899edd1d5e
commit 87c1762146
13 changed files with 15 additions and 29 deletions

View File

@@ -31,8 +31,7 @@ If you're customizing the default dark styles, scope your styles to the followin
```css
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/* your custom styles here */
}
```

View File

@@ -1,6 +1,6 @@
---
title: Themes
description: Themes are collections of design tokens that thread through every Web Awesome component and pattern.
description: Themes are collections of design tokens that thread through every Web Awesome component and pattern.
Themes play a crucial role in [customizing Web Awesome](/docs/customizing).
layout: overview
override:tags: []
@@ -30,7 +30,7 @@ In pre-made themes, we use a light color scheme by default.
Additionally, styles may be scoped to the `:root` selector to be activated automatically.
For pre-made themes, *all* custom properties are scoped to `:root`, the theme class, and `wa-light`.
Finally, we scope themes to `:host` and `:host-context()` to ensure the styles are applied to the shadow roots of custom elements.
Finally, we scope themes to `:host` to ensure the styles are applied to the shadow roots of custom elements.
For example, the default theme is set up like this:
@@ -44,8 +44,7 @@ For example, the default theme is set up like this:
}
.wa-dark,
.wa-invert,
:host-context(.wa-dark) {
.wa-invert {
/* subset of CSS custom properties for a dark color scheme */
}
```

View File

@@ -80,8 +80,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -71,8 +71,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
color-scheme: dark;
color: var(--wa-color-text-normal);

View File

@@ -78,8 +78,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
color-scheme: dark;
color: var(--wa-color-text-normal);

View File

@@ -68,8 +68,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -114,10 +114,8 @@
--wa-color-neutral-on-loud: white;
}
/** need to wrap :host-context() in an :is() selector for unsupported browsers */
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
color-scheme: dark;
color: var(--wa-color-text-normal);

View File

@@ -85,8 +85,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -83,8 +83,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -75,8 +75,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -74,8 +74,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -84,8 +84,7 @@
}
.wa-dark,
.wa-invert,
:is(:host-context(.wa-dark)) {
.wa-invert {
/**
* Foundational Colors
*/

View File

@@ -1,7 +1,6 @@
:where(:root),
:host,
.wa-theme-tailspin,
:is(:host-context(.wa-theme-tailspin)) {
.wa-theme-tailspin {
h1,
h2,
h3,