From 593294eebcd15794ff721bf03908d264249eed90 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 30 Aug 2023 22:38:43 +0100 Subject: [PATCH 1/7] Add forced-colors-adjust utilities --- src/corePlugins.js | 6 ++++++ tests/plugins/forcedColorsAdjust.test.js | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/plugins/forcedColorsAdjust.test.js diff --git a/src/corePlugins.js b/src/corePlugins.js index b308affe5b21..2b16d16dd34d 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -2877,4 +2877,10 @@ export let corePlugins = { content: createUtilityPlugin('content', [ ['content', ['--tw-content', ['content', 'var(--tw-content)']]], ]), + forcedColorsAdjust: ({ addUtilities }) => { + addUtilities({ + '.forced-colors-auto': { 'forced-colors-adjust': 'auto' }, + '.forced-colors-none': { 'forced-colors-adjust': 'none' }, + }) + }, } diff --git a/tests/plugins/forcedColorsAdjust.test.js b/tests/plugins/forcedColorsAdjust.test.js new file mode 100644 index 000000000000..b05379d10c85 --- /dev/null +++ b/tests/plugins/forcedColorsAdjust.test.js @@ -0,0 +1,10 @@ +import { css, quickPluginTest } from '../util/run' + +quickPluginTest('forcedColorsAdjust').toMatchFormattedCss(css` + .forced-colors-auto { + forced-color-adjust: auto; + } + .forced-colors-none { + forced-color-adjust: none; + } +`) From de67a9e822dcea38f7ff045cbb5089688abb38b7 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 30 Aug 2023 22:57:00 +0100 Subject: [PATCH 2/7] Update forcedColorsAdjust.test.js --- tests/plugins/forcedColorsAdjust.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/plugins/forcedColorsAdjust.test.js b/tests/plugins/forcedColorsAdjust.test.js index b05379d10c85..a964f5eacfc0 100644 --- a/tests/plugins/forcedColorsAdjust.test.js +++ b/tests/plugins/forcedColorsAdjust.test.js @@ -2,9 +2,9 @@ import { css, quickPluginTest } from '../util/run' quickPluginTest('forcedColorsAdjust').toMatchFormattedCss(css` .forced-colors-auto { - forced-color-adjust: auto; + forced-colors-adjust: auto; } .forced-colors-none { - forced-color-adjust: none; + forced-colors-adjust: none; } `) From e26825ae0b7fbf1a048f9a4e34d930d14d0c41a0 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 9 Oct 2023 17:29:50 +0200 Subject: [PATCH 3/7] use `toMatchSnapshot` instead of `toMatchFormattedCss` More info: https://github.com/tailwindlabs/tailwindcss/pull/12170 --- .../__snapshots__/forcedColorsAdjust.test.js.snap | 13 +++++++++++++ tests/plugins/forcedColorsAdjust.test.js | 11 ++--------- 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap diff --git a/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap b/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap new file mode 100644 index 000000000000..b538ac98f215 --- /dev/null +++ b/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should test the 'forcedColorsAdjust' plugin 1`] = ` +" +.forced-colors-auto { + forced-colors-adjust: auto; +} + +.forced-colors-none { + forced-colors-adjust: none; +} +" +`; diff --git a/tests/plugins/forcedColorsAdjust.test.js b/tests/plugins/forcedColorsAdjust.test.js index a964f5eacfc0..8aa338fa3512 100644 --- a/tests/plugins/forcedColorsAdjust.test.js +++ b/tests/plugins/forcedColorsAdjust.test.js @@ -1,10 +1,3 @@ -import { css, quickPluginTest } from '../util/run' +import { quickPluginTest } from '../util/run' -quickPluginTest('forcedColorsAdjust').toMatchFormattedCss(css` - .forced-colors-auto { - forced-colors-adjust: auto; - } - .forced-colors-none { - forced-colors-adjust: none; - } -`) +quickPluginTest('forcedColorsAdjust').toMatchSnapshot() From 6c94c6d022bafd87d2ee2d5b39bc1740cb775ff3 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 2 Nov 2023 16:46:59 +0100 Subject: [PATCH 4/7] rename `forced-colors-adjust` -> `forced-color-adjust` Dropped the `s` in `colors`. --- src/corePlugins.js | 6 +++--- .../__snapshots__/forcedColorAdjust.test.js.snap | 13 +++++++++++++ .../__snapshots__/forcedColorsAdjust.test.js.snap | 13 ------------- tests/plugins/forcedColorAdjust.test.js | 3 +++ tests/plugins/forcedColorsAdjust.test.js | 3 --- 5 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap delete mode 100644 tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap create mode 100644 tests/plugins/forcedColorAdjust.test.js delete mode 100644 tests/plugins/forcedColorsAdjust.test.js diff --git a/src/corePlugins.js b/src/corePlugins.js index 2b16d16dd34d..ffabbc0ecaae 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -2877,10 +2877,10 @@ export let corePlugins = { content: createUtilityPlugin('content', [ ['content', ['--tw-content', ['content', 'var(--tw-content)']]], ]), - forcedColorsAdjust: ({ addUtilities }) => { + forcedColorAdjust: ({ addUtilities }) => { addUtilities({ - '.forced-colors-auto': { 'forced-colors-adjust': 'auto' }, - '.forced-colors-none': { 'forced-colors-adjust': 'none' }, + '.forced-color-auto': { 'forced-color-adjust': 'auto' }, + '.forced-color-none': { 'forced-color-adjust': 'none' }, }) }, } diff --git a/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap b/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap new file mode 100644 index 000000000000..500cbdf0a162 --- /dev/null +++ b/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should test the 'forcedColorAdjust' plugin 1`] = ` +" +.forced-color-auto { + forced-color-adjust: auto; +} + +.forced-color-none { + forced-color-adjust: none; +} +" +`; diff --git a/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap b/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap deleted file mode 100644 index b538ac98f215..000000000000 --- a/tests/plugins/__snapshots__/forcedColorsAdjust.test.js.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should test the 'forcedColorsAdjust' plugin 1`] = ` -" -.forced-colors-auto { - forced-colors-adjust: auto; -} - -.forced-colors-none { - forced-colors-adjust: none; -} -" -`; diff --git a/tests/plugins/forcedColorAdjust.test.js b/tests/plugins/forcedColorAdjust.test.js new file mode 100644 index 000000000000..e8aa4d8efae1 --- /dev/null +++ b/tests/plugins/forcedColorAdjust.test.js @@ -0,0 +1,3 @@ +import { quickPluginTest } from '../util/run' + +quickPluginTest('forcedColorAdjust').toMatchSnapshot() diff --git a/tests/plugins/forcedColorsAdjust.test.js b/tests/plugins/forcedColorsAdjust.test.js deleted file mode 100644 index 8aa338fa3512..000000000000 --- a/tests/plugins/forcedColorsAdjust.test.js +++ /dev/null @@ -1,3 +0,0 @@ -import { quickPluginTest } from '../util/run' - -quickPluginTest('forcedColorsAdjust').toMatchSnapshot() From 1c8af8629751b688f83fa43a806de8f2654b3f4e Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 2 Nov 2023 16:47:38 +0100 Subject: [PATCH 5/7] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83695cd8bf22..46e6a2970a74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Oxide] Process and inline `@import` at-rules natively ([#11239](https://github.com/tailwindlabs/tailwindcss/pull/11239)) - [Oxide] Explicitly configure Lightning CSS features, and prefer user browserslist over default browserslist ([#11402](https://github.com/tailwindlabs/tailwindcss/pull/11402), [#11412](https://github.com/tailwindlabs/tailwindcss/pull/11412)) - [Oxide] Support loading plugins by package / file name ([#12087](https://github.com/tailwindlabs/tailwindcss/pull/12087)) +- Add `forced-colors-adjust` utilities ([#11931](https://github.com/tailwindlabs/tailwindcss/pull/11931)) ### Changed From 5ed1a176d5d51069547e479997c1d897f6e948df Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 2 Nov 2023 16:49:29 +0100 Subject: [PATCH 6/7] fix typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e6a2970a74..d3fb4e5fa4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `size-*` utilities ([#12287](https://github.com/tailwindlabs/tailwindcss/pull/12287)) - Add utilities for CSS subgrid ([#12298](https://github.com/tailwindlabs/tailwindcss/pull/12298)) - Add spacing scale to `min-w-*`, `min-h-*`, and `max-w-*` utilities ([#12300](https://github.com/tailwindlabs/tailwindcss/pull/12300)) +- Add `forced-color-adjust` utilities ([#11931](https://github.com/tailwindlabs/tailwindcss/pull/11931)) - [Oxide] New Rust template parsing engine ([#10252](https://github.com/tailwindlabs/tailwindcss/pull/10252)) - [Oxide] Support `@import "tailwindcss"` using top-level `index.css` file ([#11205](https://github.com/tailwindlabs/tailwindcss/pull/11205), ([#11260](https://github.com/tailwindlabs/tailwindcss/pull/11260))) - [Oxide] Use `lightningcss` for nesting and vendor prefixes in PostCSS plugin ([#10399](https://github.com/tailwindlabs/tailwindcss/pull/10399)) @@ -36,7 +37,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Oxide] Process and inline `@import` at-rules natively ([#11239](https://github.com/tailwindlabs/tailwindcss/pull/11239)) - [Oxide] Explicitly configure Lightning CSS features, and prefer user browserslist over default browserslist ([#11402](https://github.com/tailwindlabs/tailwindcss/pull/11402), [#11412](https://github.com/tailwindlabs/tailwindcss/pull/11412)) - [Oxide] Support loading plugins by package / file name ([#12087](https://github.com/tailwindlabs/tailwindcss/pull/12087)) -- Add `forced-colors-adjust` utilities ([#11931](https://github.com/tailwindlabs/tailwindcss/pull/11931)) ### Changed From 1d7100a87c89fe2bee36f861b21fcba9da53de02 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 2 Nov 2023 16:52:41 +0100 Subject: [PATCH 7/7] use full `forced-color-adjust-auto` and `forced-color-adjust-none` names --- src/corePlugins.js | 4 ++-- tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corePlugins.js b/src/corePlugins.js index ffabbc0ecaae..ae313dc2b775 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -2879,8 +2879,8 @@ export let corePlugins = { ]), forcedColorAdjust: ({ addUtilities }) => { addUtilities({ - '.forced-color-auto': { 'forced-color-adjust': 'auto' }, - '.forced-color-none': { 'forced-color-adjust': 'none' }, + '.forced-color-adjust-auto': { 'forced-color-adjust': 'auto' }, + '.forced-color-adjust-none': { 'forced-color-adjust': 'none' }, }) }, } diff --git a/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap b/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap index 500cbdf0a162..b81fd812d351 100644 --- a/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap +++ b/tests/plugins/__snapshots__/forcedColorAdjust.test.js.snap @@ -2,11 +2,11 @@ exports[`should test the 'forcedColorAdjust' plugin 1`] = ` " -.forced-color-auto { +.forced-color-adjust-auto { forced-color-adjust: auto; } -.forced-color-none { +.forced-color-adjust-none { forced-color-adjust: none; } "