From 5f9bd8ff3d5ff6fd6b9292645d462545f81f9904 Mon Sep 17 00:00:00 2001
From: Jordan Pittman
Date: Wed, 2 Apr 2025 12:34:57 -0400
Subject: [PATCH 1/3] fix
wip
wip
---
packages/tailwindcss/src/utilities.test.ts | 10 ++++++++++
packages/tailwindcss/src/utilities.ts | 17 +++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/packages/tailwindcss/src/utilities.test.ts b/packages/tailwindcss/src/utilities.test.ts
index 5e2bf3eb5a47..bac7add94490 100644
--- a/packages/tailwindcss/src/utilities.test.ts
+++ b/packages/tailwindcss/src/utilities.test.ts
@@ -20366,6 +20366,9 @@ test('filter', async () => {
--drop-shadow: 0 1px 1px rgb(0 0 0 / 0.05);
--drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);
}
+ @theme inline {
+ --drop-shadow-multi: 0 1px 1px rgb(0 0 0 / 0.05), 0 9px 7px rgb(0 0 0 / 0.1);
+ }
@tailwind utilities;
`,
[
@@ -20392,6 +20395,7 @@ test('filter', async () => {
'drop-shadow',
'drop-shadow/25',
'drop-shadow-xl',
+ 'drop-shadow-multi',
'drop-shadow-[0_0_red]',
'drop-shadow-red-500',
'drop-shadow-red-500/50',
@@ -20486,6 +20490,12 @@ test('filter', async () => {
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
}
+ .drop-shadow-multi {
+ --tw-drop-shadow-size: drop-shadow(0 1px 1px var(--tw-drop-shadow-color, #0000000d)) drop-shadow(0 9px 7px var(--tw-drop-shadow-color, #0000001a));
+ --tw-drop-shadow: drop-shadow(0 1px 1px #0000000d) drop-shadow(0 9px 7px #0000001a);
+ filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
+ }
+
.drop-shadow-xl {
--tw-drop-shadow-size: drop-shadow(0 9px 7px var(--tw-drop-shadow-color, #0000001a));
--tw-drop-shadow: drop-shadow(var(--drop-shadow-xl));
diff --git a/packages/tailwindcss/src/utilities.ts b/packages/tailwindcss/src/utilities.ts
index a4359c53a1ab..5bc6e59d3dd1 100644
--- a/packages/tailwindcss/src/utilities.ts
+++ b/packages/tailwindcss/src/utilities.ts
@@ -4298,7 +4298,8 @@ export function createUtilities(theme: Theme) {
if (!candidate.value) {
let value = theme.get(['--drop-shadow'])
- if (value === null) return
+ let resolved = theme.resolve(null, ['--drop-shadow'])
+ if (value === null || resolved === null) return
return [
filterProperties(),
@@ -4309,7 +4310,12 @@ export function createUtilities(theme: Theme) {
alpha,
(color) => `var(--tw-drop-shadow-color, ${color})`,
),
- decl('--tw-drop-shadow', `drop-shadow(${theme.resolve(null, ['--drop-shadow'])})`),
+ decl(
+ '--tw-drop-shadow',
+ segment(resolved, ',')
+ .map((value) => `drop-shadow(${value})`)
+ .join(' '),
+ ),
decl('filter', cssFilterValue),
]
}
@@ -4350,7 +4356,8 @@ export function createUtilities(theme: Theme) {
// Shadow size
{
let value = theme.get([`--drop-shadow-${candidate.value.value}`])
- if (value) {
+ let resolved = theme.resolve(candidate.value.value, ['--drop-shadow'])
+ if (value && resolved) {
if (candidate.modifier && !alpha) return
if (alpha) {
@@ -4379,7 +4386,9 @@ export function createUtilities(theme: Theme) {
),
decl(
'--tw-drop-shadow',
- `drop-shadow(${theme.resolve(candidate.value.value, ['--drop-shadow'])})`,
+ segment(resolved, ',')
+ .map((value) => `drop-shadow(${value})`)
+ .join(' '),
),
decl('filter', cssFilterValue),
]
From 689ac3d9f1c0918ab20f0d09a69d5b7ebb397b54 Mon Sep 17 00:00:00 2001
From: Jordan Pittman
Date: Thu, 3 Apr 2025 09:43:12 -0400
Subject: [PATCH 2/3] Add UI test
---
packages/tailwindcss/tests/ui.spec.ts | 42 +++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/packages/tailwindcss/tests/ui.spec.ts b/packages/tailwindcss/tests/ui.spec.ts
index 9aaf0265ab8e..a4efc6468ac3 100644
--- a/packages/tailwindcss/tests/ui.spec.ts
+++ b/packages/tailwindcss/tests/ui.spec.ts
@@ -1863,6 +1863,48 @@ test('drop shadow colors', async ({ page }) => {
])
})
+test('multiple drop shadow filters with `@theme inline`', async ({ page }) => {
+ let { getPropertyList } = await render(
+ page,
+ html`
+
+
+
+
+ `,
+ css`
+ @theme {
+ --drop-shadow-var: 0 1px 1px rgb(0 0 0 / 0.5), 0 10px 10px rgb(0 0 0 / 0.25);
+ }
+ @theme inline {
+ --drop-shadow-inlined: 0 1px 1px rgb(0 0 0 / 0.5), 0 10px 10px rgb(0 0 0 / 0.25);
+ }
+ `,
+ )
+
+ expect(await getPropertyList('#a', 'filter')).toEqual([
+ 'drop-shadow(rgba(0, 0, 0, 0.5) 0px 1px 1px) drop-shadow(rgba(0, 0, 0, 0.25) 0px 10px 10px)',
+ ])
+
+ expect(await getPropertyList('#b', 'filter')).toEqual([
+ expect.stringMatching(
+ /drop-shadow\(oklab\(0\.627\d+ 0\.224\d+ 0\.125\d+\) 0px 1px 1px\) drop-shadow\(oklab\(0\.627\d+ 0\.224\d+ 0\.125\d+\) 0px 10px 10px\)/,
+ ),
+ ])
+
+ expect(await getPropertyList('#c', 'filter')).toEqual([
+ 'drop-shadow(rgba(0, 0, 0, 0.75) 0px 20px 20px)',
+ ])
+
+ // Multiple values are only supported with `@theme inline` because otherwise we use var(…)
+ // inside of drop-shadow(…) which can only ever be a single shadow
+ expect(await getPropertyList('#d', 'filter')).toEqual(['none'])
+})
+
test('outline style is optional', async ({ page }) => {
let { getPropertyValue } = await render(
page,
From 2554f8fca353978c38fc5ccafcaaa65e30f332e5 Mon Sep 17 00:00:00 2001
From: Jordan Pittman
Date: Thu, 3 Apr 2025 10:34:29 -0400
Subject: [PATCH 3/3] Update changelog
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index caaa7b2b7c54..ff31af18925d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Don't rely on `@layer base` for the `@property` polyfills ([#17506](https://github.com/tailwindlabs/tailwindcss/pull/17506))
- Fix multi-value inset shadow ([#17523](https://github.com/tailwindlabs/tailwindcss/pull/17523))
+- Fix `drop-shadow` utility ([#17515](https://github.com/tailwindlabs/tailwindcss/pull/17515))
+- Fix `drop-shadow-*` utilities that use multiple shadows in `@theme inline` ([#17515](https://github.com/tailwindlabs/tailwindcss/pull/17515))
## [4.1.1] - 2025-04-02