Skip to content

Commit

Permalink
Add ::backdrop to universal defaults (#8526)
Browse files Browse the repository at this point in the history
* Add `::backdrop` to universal defaults

* Update changelog
  • Loading branch information
adamwathan committed Jun 6, 2022
1 parent 14f6574 commit 4f40076
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -44,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
- Add `enabled` variant ([#7905](https://github.com/tailwindlabs/tailwindcss/pull/7905))
- Add TypeScript types for the `tailwind.config.js` file ([#7891](https://github.com/tailwindlabs/tailwindcss/pull/7891))
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924))
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924), [#8526](https://github.com/tailwindlabs/tailwindcss/pull/8526))
- Add `grid-flow-dense` utility ([#8193](https://github.com/tailwindlabs/tailwindcss/pull/8193))
- Add `mix-blend-plus-lighter` utility ([#8288](https://github.com/tailwindlabs/tailwindcss/pull/8288))
- Add arbitrary variants ([#8299](https://github.com/tailwindlabs/tailwindcss/pull/8299))
Expand Down
2 changes: 1 addition & 1 deletion src/lib/resolveDefaultsAtRules.js
Expand Up @@ -134,7 +134,7 @@ export default function resolveDefaultsAtRules({ tailwindConfig }) {
source: universal.source,
})

universalRule.selectors = ['*', '::before', '::after']
universalRule.selectors = ['*', '::before', '::after', '::backdrop']

universalRule.append(universal.nodes)
universal.before(universalRule)
Expand Down
128 changes: 91 additions & 37 deletions tests/basic-usage.test.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tests/basic-usage.test.js
Expand Up @@ -151,7 +151,8 @@ test('default ring color can be a function', () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/collapse-adjacent-rules.test.css
Expand Up @@ -9,7 +9,8 @@
}
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/import-syntax.test.css
Expand Up @@ -3,7 +3,8 @@ h1 {
}
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/important-boolean.test.css
@@ -1,6 +1,7 @@
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/important-modifier-prefix.test.css
@@ -1,6 +1,7 @@
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/important-selector.test.css
@@ -1,6 +1,7 @@
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
27 changes: 19 additions & 8 deletions tests/kitchen-sink.test.css
Expand Up @@ -138,7 +138,8 @@ div {
}
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down Expand Up @@ -215,14 +216,16 @@ div {
.test-apply-font-variant {
--tw-ordinal: ordinal;
--tw-numeric-spacing: tabular-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure)
var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.custom-component {
background: #123456;
}
*,
::before,
::after {
::after,
::backdrop {
padding: 5px;
}
.foo .bg-black {
Expand All @@ -234,10 +237,14 @@ div {
.scale-50 {
--tw-scale-x: 0.5;
--tw-scale-y: 0.5;
transform: translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate))
skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x))
scaleY(var(--tw-scale-y));
}
.transform {
transform: translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate))
skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x))
scaleY(var(--tw-scale-y));
}
.grid-cols-\[200px\2c repeat\(auto-fill\2c minmax\(15\%\2c 100px\)\)\2c 300px\] {
grid-template-columns: 200px repeat(auto-fill, minmax(15%, 100px)) 300px;
Expand Down Expand Up @@ -293,7 +300,8 @@ div {
}
*,
::before,
::after {
::after,
::backdrop {
margin: 10px;
}
.first\:pt-0:first-child {
Expand Down Expand Up @@ -330,7 +338,9 @@ div {
.hover\:scale-75:hover {
--tw-scale-x: 0.75;
--tw-scale-y: 0.75;
transform: translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate))
skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x))
scaleY(var(--tw-scale-y));
}
.hover\:font-bold:hover {
font-weight: 700;
Expand Down Expand Up @@ -436,7 +446,8 @@ div {
}
.sm\:tabular-nums {
--tw-numeric-spacing: tabular-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure)
var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.sm\:custom-util {
background: #abcdef;
Expand Down
6 changes: 4 additions & 2 deletions tests/kitchen-sink.test.js
Expand Up @@ -69,7 +69,8 @@ test('it works', () => {
}
*,
::before,
::after {
::after,
::backdrop {
margin: 10px;
}
}
Expand All @@ -82,7 +83,8 @@ test('it works', () => {
}
*,
::before,
::after {
::after,
::backdrop {
padding: 5px;
}
.foo .bg-black {
Expand Down
15 changes: 10 additions & 5 deletions tests/plugins/divide.test.js
Expand Up @@ -10,7 +10,8 @@ it('should add the divide styles for divide-y and a default border color', () =>
expect(result.css).toMatchCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down Expand Up @@ -76,7 +77,8 @@ it('should add the divide styles for divide-x and a default border color', () =>
expect(result.css).toMatchCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down Expand Up @@ -142,7 +144,8 @@ it('should add the divide styles for divide-y-reverse and a default border color
expect(result.css).toMatchCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down Expand Up @@ -206,7 +209,8 @@ it('should add the divide styles for divide-x-reverse and a default border color
expect(result.css).toMatchCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down Expand Up @@ -270,7 +274,8 @@ it('should only inject the base styles once if we use divide and border at the s
expect(result.css).toMatchCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/prefix.test.css
@@ -1,6 +1,7 @@
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
27 changes: 18 additions & 9 deletions tests/resolve-defaults-at-rules.test.js
Expand Up @@ -16,7 +16,8 @@ test('basic utilities', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -67,7 +68,8 @@ test('with pseudo-class variants', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -116,7 +118,8 @@ test('with pseudo-element variants', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -161,7 +164,8 @@ test('with multi-class variants', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -206,7 +210,8 @@ test('with multi-class pseudo-element variants', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -257,7 +262,8 @@ test('with multi-class pseudo-element and pseudo-class variants', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -344,7 +350,8 @@ test('with apply', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down Expand Up @@ -540,7 +547,8 @@ test('with shadows', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-ring-inset: ;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
Expand Down Expand Up @@ -598,7 +606,8 @@ test('when no utilities that need the defaults are used', async () => {
expect(result.css).toMatchFormattedCss(css`
*,
::before,
::after {
::after,
::backdrop {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/util/defaults.js
Expand Up @@ -9,7 +9,8 @@ export function defaults({ defaultRingColor = `rgb(59 130 246 / 0.5)` } = {}) {
return css`
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/variants.test.css
@@ -1,6 +1,7 @@
*,
::before,
::after {
::after,
::backdrop {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
--tw-translate-x: 0;
Expand Down

0 comments on commit 4f40076

Please sign in to comment.