Rework scripting variants (#17431)
This replaces the `scripting`, `scripting-none`, and `scripting-initial` variants with one `noscript` variant that matches the name of the HTML `<noscript>` element. The previous `scripting` can then be represented as `not-noscript` e.g. `not-noscript:flex`.
This commit is contained in:
parent
9cceeaa87f
commit
1b6230f54f
4 changed files with 13 additions and 44 deletions
|
|
@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- _Experimental_: Add `details-content` variant ([#15319](https://github.com/tailwindlabs/tailwindcss/pull/15319))
|
||||
- _Experimental_: Add `inverted-colors` variant ([#11693](https://github.com/tailwindlabs/tailwindcss/pull/11693))
|
||||
- _Experimental_: Add `scripting`, `scripting-none`, and `scripting-initial` variants ([#11929](https://github.com/tailwindlabs/tailwindcss/pull/11929))
|
||||
- _Experimental_: Add `noscript` variant ([#11929](https://github.com/tailwindlabs/tailwindcss/pull/11929), [#17431](https://github.com/tailwindlabs/tailwindcss/pull/17431))
|
||||
- _Experimental_: Add `items-baseline-last` utility ([#13888](https://github.com/tailwindlabs/tailwindcss/pull/13888))
|
||||
- _Experimental_: Add `pointer-none`, `pointer-coarse`, and `pointer-fine` variant ([#16946](https://github.com/tailwindlabs/tailwindcss/pull/16946))
|
||||
- _Experimental_: Add `any-pointer-none`, `any-pointer-coarse`, and `any-pointer-fine` variants ([#16941](https://github.com/tailwindlabs/tailwindcss/pull/16941))
|
||||
|
|
|
|||
|
|
@ -8472,9 +8472,7 @@ exports[`getVariants 1`] = `
|
|||
"any-pointer-none",
|
||||
"any-pointer-coarse",
|
||||
"any-pointer-fine",
|
||||
"scripting-initial",
|
||||
"scripting-none",
|
||||
"scripting",
|
||||
"noscript",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
@ -9255,21 +9253,7 @@ exports[`getVariants 1`] = `
|
|||
{
|
||||
"hasDash": true,
|
||||
"isArbitrary": false,
|
||||
"name": "scripting-initial",
|
||||
"selectors": [Function],
|
||||
"values": [],
|
||||
},
|
||||
{
|
||||
"hasDash": true,
|
||||
"isArbitrary": false,
|
||||
"name": "scripting-none",
|
||||
"selectors": [Function],
|
||||
"values": [],
|
||||
},
|
||||
{
|
||||
"hasDash": true,
|
||||
"isArbitrary": false,
|
||||
"name": "scripting",
|
||||
"name": "noscript",
|
||||
"selectors": [Function],
|
||||
"values": [],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1449,6 +1449,7 @@ test('not', async () => {
|
|||
'not-contrast-less:flex',
|
||||
'not-forced-colors:flex',
|
||||
'not-nth-2:flex',
|
||||
'not-noscript:flex',
|
||||
|
||||
'not-sm:flex',
|
||||
'not-min-sm:flex',
|
||||
|
|
@ -1560,6 +1561,12 @@ test('not', async () => {
|
|||
}
|
||||
}
|
||||
|
||||
@media not (scripting: none) {
|
||||
.not-noscript\\:flex {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.not-hocus\\:flex:not(:hover, :focus), .not-device-hocus\\:flex:not(:hover, :focus) {
|
||||
display: flex;
|
||||
}
|
||||
|
|
@ -1987,30 +1994,10 @@ test('any-pointer-fine', async () => {
|
|||
`)
|
||||
})
|
||||
|
||||
test('scripting-initial', async () => {
|
||||
expect(await run(['scripting-initial:flex'])).toMatchInlineSnapshot(`
|
||||
"@media (scripting: initial-only) {
|
||||
.scripting-initial\\:flex {
|
||||
display: flex;
|
||||
}
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
test('scripting-none', async () => {
|
||||
expect(await run(['scripting-none:flex'])).toMatchInlineSnapshot(`
|
||||
expect(await run(['noscript:flex'])).toMatchInlineSnapshot(`
|
||||
"@media (scripting: none) {
|
||||
.scripting-none\\:flex {
|
||||
display: flex;
|
||||
}
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
test('scripting', async () => {
|
||||
expect(await run(['scripting:flex'])).toMatchInlineSnapshot(`
|
||||
"@media (scripting: enabled) {
|
||||
.scripting\\:flex {
|
||||
.noscript\\:flex {
|
||||
display: flex;
|
||||
}
|
||||
}"
|
||||
|
|
|
|||
|
|
@ -1165,9 +1165,7 @@ export function createVariants(theme: Theme): Variants {
|
|||
}
|
||||
|
||||
if (enableScripting) {
|
||||
staticVariant('scripting-initial', ['@media (scripting: initial-only)'])
|
||||
staticVariant('scripting-none', ['@media (scripting: none)'])
|
||||
staticVariant('scripting', ['@media (scripting: enabled)'])
|
||||
staticVariant('noscript', ['@media (scripting: none)'])
|
||||
}
|
||||
|
||||
return variants
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue