From eb4a12e3981d77abd2b65317906a56b44f21ed41 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 5 Nov 2024 15:39:44 +0100 Subject: [PATCH 1/5] add tests for migrating legacy shadow, inset-shadow, drop-shadow, rounded and blur --- .../codemods/simple-legacy-classes.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.test.ts b/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.test.ts index 264d7f0ace9f..f35034447975 100644 --- a/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.test.ts +++ b/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.test.ts @@ -15,6 +15,23 @@ test.each([ ['max-lg:hover:decoration-slice', 'max-lg:hover:box-decoration-slice'], ['max-lg:hover:decoration-slice!', 'max-lg:hover:box-decoration-slice!'], ['max-lg:hover:!decoration-slice', 'max-lg:hover:box-decoration-slice!'], + + ['shadow', 'shadow-sm'], + ['shadow-sm', 'shadow-xs'], + ['shadow-xs', 'shadow-2xs'], + + ['inset-shadow', 'inset-shadow-sm'], + ['inset-shadow-sm', 'inset-shadow-xs'], + ['inset-shadow-xs', 'inset-shadow-2xs'], + + ['drop-shadow', 'drop-shadow-sm'], + ['drop-shadow-sm', 'drop-shadow-xs'], + + ['rounded', 'rounded-sm'], + ['rounded-sm', 'rounded-xs'], + + ['blur', 'blur-sm'], + ['blur-sm', 'blur-xs'], ])('%s => %s', async (candidate, result) => { let designSystem = await __unstable__loadDesignSystem('@import "tailwindcss";', { base: __dirname, From 513e14fe42b0508a4e833989c5d9c2fe32398d41 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 5 Nov 2024 15:40:03 +0100 Subject: [PATCH 2/5] add integration tests This is to ensure that we migrate `blur` to `blur-sm`, and don't migrate again, because then this would be converted to `blur-xs` and that's not what we want. --- integrations/upgrade/index.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/integrations/upgrade/index.test.ts b/integrations/upgrade/index.test.ts index cbc59951370f..1489243a68b1 100644 --- a/integrations/upgrade/index.test.ts +++ b/integrations/upgrade/index.test.ts @@ -71,6 +71,14 @@ test(
+ +
+ + +
+ + +
`, 'src/input.css': css` @tailwind base; @@ -95,6 +103,14 @@ test(
+ +
+ + +
+ + +
--- ./src/input.css --- @import 'tailwindcss'; From cc3a4b886f6a3821a6a504aed4df2ae1f976937e Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 5 Nov 2024 15:40:58 +0100 Subject: [PATCH 3/5] add class migrations --- .../template/codemods/simple-legacy-classes.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.ts b/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.ts index 6d20b8cc87e7..19a5f214c0a6 100644 --- a/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.ts +++ b/packages/@tailwindcss-upgrade/src/template/codemods/simple-legacy-classes.ts @@ -13,6 +13,23 @@ const LEGACY_CLASS_MAP = { 'flex-shrink-0': 'shrink-0', 'decoration-clone': 'box-decoration-clone', 'decoration-slice': 'box-decoration-slice', + + shadow: 'shadow-sm', + 'shadow-sm': 'shadow-xs', + 'shadow-xs': 'shadow-2xs', + + 'inset-shadow': 'inset-shadow-sm', + 'inset-shadow-sm': 'inset-shadow-xs', + 'inset-shadow-xs': 'inset-shadow-2xs', + + 'drop-shadow': 'drop-shadow-sm', + 'drop-shadow-sm': 'drop-shadow-xs', + + rounded: 'rounded-sm', + 'rounded-sm': 'rounded-xs', + + blur: 'blur-sm', + 'blur-sm': 'blur-xs', } const SEEDED = new WeakSet() From 01154b40845e025b437e9586b895b0ec90853c61 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 5 Nov 2024 15:55:38 +0100 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 710e27792480..f1fe1acd516e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `svh`, `dvh`, `svw`, `dvw`, and `auto` values to all width/height/size utilities ([#14857](https://github.com/tailwindlabs/tailwindcss/pull/14857)) - _Upgrade (experimental)_: Migrate `grid-cols-[subgrid]` and `grid-rows-[subgrid]` to `grid-cols-subgrid` and `grid-rows-subgrid` ([#14840](https://github.com/tailwindlabs/tailwindcss/pull/14840)) - _Upgrade (experimental)_: Support migrating projects with multiple config files ([#14863](https://github.com/tailwindlabs/tailwindcss/pull/14863)) +- _Upgrade (experimental)_: Rename default utilities (such `shadow`, `blur` and `rounded`) to have a value prefix ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) ### Fixed From caafd6a4a92290cf0ef354bea4be6207026de5aa Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 6 Nov 2024 12:15:44 +0100 Subject: [PATCH 5/5] explicit changelog entries --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1fe1acd516e..196ba911531d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `svh`, `dvh`, `svw`, `dvw`, and `auto` values to all width/height/size utilities ([#14857](https://github.com/tailwindlabs/tailwindcss/pull/14857)) - _Upgrade (experimental)_: Migrate `grid-cols-[subgrid]` and `grid-rows-[subgrid]` to `grid-cols-subgrid` and `grid-rows-subgrid` ([#14840](https://github.com/tailwindlabs/tailwindcss/pull/14840)) - _Upgrade (experimental)_: Support migrating projects with multiple config files ([#14863](https://github.com/tailwindlabs/tailwindcss/pull/14863)) -- _Upgrade (experimental)_: Rename default utilities (such `shadow`, `blur` and `rounded`) to have a value prefix ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) +- _Upgrade (experimental)_: Rename `shadow` to `shadow-sm`, `shadow-sm` to `shadow-xs`, and `shadow-xs` to `shadow-2xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) +- _Upgrade (experimental)_: Rename `inset-shadow` to `inset-shadow-sm`, `inset-shadow-sm` to `inset-shadow-xs`, and `inset-shadow-xs` to `inset-shadow-2xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) +- _Upgrade (experimental)_: Rename `drop-shadow` to `drop-shadow-sm` and `drop-shadow-sm` to `drop-shadow-xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) +- _Upgrade (experimental)_: Rename `rounded` to `rounded-sm` and `rounded-sm` to `rounded-xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) +- _Upgrade (experimental)_: Rename `blur` to `blur-sm` and `blur-sm` to `blur-xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875)) ### Fixed