6200 Commits

Author SHA1 Message Date
Robin Malfait
bbd916aaa0
Ignore binary extensions, except in folder names (#17595)
We generate a glob to ignore binary extensions that looks something like
this:
```
*.{mp4,pages,exe,…}
```

However, if you have a folder that happens to end in `.pages` for
example, then this folder will be ignored in its entirety.

To solve this, we added a new flag to the `Gitignore` struct so we can
register a bunch of ignore rules that _only_ apply to paths and not
folders.

Fixes: #17569

## Test plan

- Added a unit test

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-12 13:30:17 +02:00
Philipp Spiess
d801d8dc54
Fix publish step on CI (#17654)
To publish the newly adde WASM builds, we rely on the
`node-linker=hoisted` `.npmrc` flag that isn't read when `pnpm
--recursive` is used. To work around it, this PR excludes the wasm
package from the `--recursive` part and manually published it
afterwards.


## Test Plan

Ensured this does not error now when trying a `--dry run`.

<img width="1273" alt="Screenshot 2025-04-11 at 17 43 38"
src="https://github.com/user-attachments/assets/68a28552-0125-4da1-92ff-74e58368abe4"
/>
2025-04-11 18:14:48 +02:00
Philipp Spiess
83ce4c0a30
Add experimental @tailwindcss/oxide-wasm32-wasi (#17558)
Closes #17448
Closes #13133

This PR adds an a new Oxide target for `wasm32-wasip1-threads`:
`@tailwindcss/oxide-wasm32-wasi`. The goal of this is to enable more
environments to run Oxide, including (but not limited to) StackBlitz.

We're making use of `napi-rs`'s upcoming v3 features to simplify the
setup here, meaning `napi-rs` will configure the WASM target and create
an npm package that works across Node and browser environments.

## MacOS AArch64 issues

While setting up an integration test for the new WASM target, I ran into
an issue where FS reads where not terminating on macOS. After some
research I found this to be a limitation of the Node.js container
interface right now, see: https://github.com/nodejs/node/issues/47193

### Windows issues

We also found that the Node.js wasi container does not properly support
Windows: https://github.com/nodejs/uvwasi/issues/11

For now we, it's probably best for MacOS AArch64 users and Windows users
to use the native modules instead.

## Test plan

The `@tailwindcss/oxide-wasm32-wasi` npm package can be built locally
via `pnpm build` and then run with the Oxide API. A usage example can be
taken from the newly added integration test.

Furthermore this was tested to work as a polyfill on StackBlitz:
https://stackblitz.com/edit/vitejs-vite-uks3gt5p

[ci-all]

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-04-11 17:19:55 +02:00
Philipp Spiess
6e1f53348d
Workaround Chrome rendering bug for skew-* utilities (#17627)
Closes #17621

Chrome as a pretty ugly rendering glitch when using a `skew-*` utility
in Tailwind 4: https://play.tailwindcss.com/HuiZtbrHOc

The was not an issue in v3 since transforms were set up in a different
way. Without the `var(…)` syntax, the difference boils down to this:

```css
.skew-v3 {
  transform: rotate(0) skewX(-20deg);
}

.skew-v4 {
  transform: rotateX(0) rotateY(0) rotateZ(0) skewX(-20deg);
}
```

It appears that using any of the single-dimension rotate functions will
cause the Chrome rendering to glitch.

After doing some digging, we found [that initially these `@property`s
were defined as type `<transform-function>` and later changed to
`*`](https://github.com/tailwindlabs/tailwindcss/issues/15144). With a
type of `*`, it makes sense that the initial value of these variables
can default to `initial` without any compromises, allowing us to default
to something like this now:

```css
.skew-new {
  transform: skewX(-20deg);
}
```

Tested this change in the latest version of Chrome (135) and it does
make the rendering glitch in the initial issue disappear. By using the
`var(--tw-rotate-x,)` syntax we also ensure this works on older versions
of Safari (tested on Safari 15.5 and 16.4).

Note, however, that there are still glitches happening when you combine
rotate and skew in the latest version of Chrome or when you transition
the `skew(…)` variable. This also happens in plain CSS with no variables
though, so there isn't something we can do about this:
https://play.tailwindcss.com/g3FXPEJHpn

## Test plan

- Tested on latest Chrome, Firefox, and Safari as well as Safari 15.5
and 16.4.

<img width="564" alt="Screenshot 2025-04-09 at 18 01 51"
src="https://github.com/user-attachments/assets/2e0b1c96-7c4d-41a8-b3d0-0f6134a3e635"
/>
2025-04-11 16:38:46 +02:00
Scott Bedard
3bea760ff2
Add test coverage for property-specific colors (#17436)
There are several property-specific color variables available to
maintain compatibility with v3. [My team and I would like to use
them](https://github.com/tailwindlabs/tailwindcss/discussions/17400),
but would feel more comfortable if they were formally supported by v4.
This PR adds test coverage for those features.

@RobinMalfait has confirmed that these features are not intended to be
removed, [see conversation here
&rarr;](https://discord.com/channels/486935104384532500/546706299010678784/1355213322995110171)

@crswll Has opened a PR here for the related documentation
- https://github.com/tailwindlabs/tailwindcss.com/pull/2178
2025-04-11 13:40:10 +02:00
Justin Wong
6d8dd82c40
Fix shadow-inherit, inset-shadow-inherit, drop-shadow-inherit, and text-shadow-inherit (#17647)
Fixes #17643.

This PR completely removes the `color-mix()` function for
`shadow-inherit`. This does mean intensity and alpha channel support has
been removed when using `shadow-inherit`[^1].

With intensity modifiers in #17398, all colors are wrapped in
`color-mix()`. However, it seems `inherit` does not work as a value in
`color-mix()` in Firefox or Chrome (don't have a means to test Safari).

[^1]: While writing this, I noticed other color utilities allow alpha
channel modifier syntax for `inherit` - do we want to look at removing
those too?

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-11 13:36:18 +02:00
Justin Wong
c0af1e2129
Fix fontSize array upgrade (#17630)
Fixes #17622.

Adds a specific handling case in `themeableValues()` in
`packages/tailwindcss/src/compat/apply-config-to-theme.ts`. It seems
like this has unique handling in v3 for an array value, whereby the
second value is treated as a `line-height`.

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-11 13:23:54 +02:00
Justin Wong
3ab7f12563
Fix container names with hyphens (#17628)
Fixes #17614.

Candidate parsing for variants only account for the root `@` if there no
hyphens. It seems like the current logic assumes if it *does* have a
hyphen, then it would be one of `@min` or `@max`. However, with:

```css
@theme {
  --container-foo-bar: 1440px;
}
```
Then `@foo-bar` should be valid. However, we only check for `@foo-bar`
and `@foo` as roots, but never `@`. This PR adds a check for `@` at the
very end after iterating through root permutations.

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-11 12:28:25 +02:00
depfu[bot]
cdecb55702
Update @types/react-dom 19.0.4 → 19.1.1 (minor) (#17619) 2025-04-09 10:26:51 +02:00
Robin Malfait
f66d287436
Fix brace expansion with range going down (#17591) 2025-04-07 15:48:19 +02:00
depfu[bot]
76e18e679c
Update all of react 19.0.0 → 19.1.0 (minor) (#17564)
Here is everything you need to know about this update. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ react (19.0.0 → 19.1.0) ·
[Repo](https://github.com/facebook/react) ·
[Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md)



<details>
<summary>Release Notes</summary>
<h4><a
href="https://github.com/facebook/react/releases/tag/v19.1.0">19.1.0</a></h4>

<blockquote><h3 dir="auto">Owner Stack</h3>
<p dir="auto">An Owner Stack is a string representing the components
that are directly responsible for rendering a particular component. You
can log Owner Stacks when debugging or use Owner Stacks to enhance error
overlays or other development tools. Owner Stacks are only available in
development builds. Component Stacks in production are unchanged.</p>
<ul dir="auto">
<li>An Owner Stack is a development-only stack trace that helps identify
which components are responsible for rendering a particular component.
An Owner Stack is distinct from a Component Stacks, which shows the
hierarchy of components leading to an error.</li>
<li>The <a
href="https://react.dev/reference/react/captureOwnerStack">captureOwnerStack
API</a> is only available in development mode and returns a Owner Stack,
if available. The API can be used to enhance error overlays or log
component relationships when debugging. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/29923">#29923</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32353">#32353</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/30306">#30306</a>,<br>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32538">#32538</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32529">#32529</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32538">#32538</a>
</li>
</ul>
<h3 dir="auto">React</h3>
<ul dir="auto">
<li>Enhanced support for Suspense boundaries to be used anywhere,
including the client, server, and during hydration. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32069">#32069</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32163">#32163</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32224">#32224</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32252">#32252</a>
</li>
<li>Reduced unnecessary client rendering through improved hydration
scheduling <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31751">#31751</a>
</li>
<li>Increased priority of client rendered Suspense boundaries <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31776">#31776</a>
</li>
<li>Fixed frozen fallback states by rendering unfinished Suspense
boundaries on the client. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31620">#31620</a>
</li>
<li>Reduced garbage collection pressure by improving Suspense boundary
retries. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31667">#31667</a>
</li>
<li>Fixed erroneous “Waiting for Paint” log when the passive effect
phase was not delayed <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31526">#31526</a>
</li>
<li>Fixed a regression causing key warnings for flattened positional
children in development mode. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32117">#32117</a>
</li>
<li>Updated <code class="notranslate">useId</code> to use valid CSS
selectors, changing format from <code class="notranslate">:r123:</code>
to <code class="notranslate">«r123»</code>. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32001">#32001</a>
</li>
<li>Added a dev-only warning for null/undefined created in useEffect,
useInsertionEffect, and useLayoutEffect. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32355">#32355</a>
</li>
<li>Fixed a bug where dev-only methods were exported in production
builds. React.act is no longer available in production builds. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32200">#32200</a>
</li>
<li>Improved consistency across prod and dev to improve compatibility
with Google Closure Complier and bindings <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31808">#31808</a>
</li>
<li>Improve passive effect scheduling for consistent task yielding. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31785">#31785</a>
</li>
<li>Fixed asserts in React Native when
passChildrenWhenCloningPersistedNodes is enabled for OffscreenComponent
rendering. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32528">#32528</a>
</li>
<li>Fixed component name resolution for Portal <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32640">#32640</a>
</li>
<li>Added support for beforetoggle and toggle events on the dialog
element. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32479">#32479</a>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32479">#32479</a>
</li>
</ul>
<h3 dir="auto">React DOM</h3>
<ul dir="auto">
<li>Fixed double warning when the <code class="notranslate">href</code>
attribute is an empty string <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31783">#31783</a>
</li>
<li>Fixed an edge case where <code
class="notranslate">getHoistableRoot()</code> didn’t work properly when
the container was a Document <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32321">#32321</a>
</li>
<li>Removed support for using HTML comments (e.g. <code
class="notranslate">&lt;!-- --&gt;</code>) as a DOM container. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32250">#32250</a>
</li>
<li>Added support for <code class="notranslate">&lt;script&gt;</code>
and <code class="notranslate">&lt;template&gt;</code> tags to be nested
within <code class="notranslate">&lt;select&gt;</code> tags. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31837">#31837</a>
</li>
<li>Fixed responsive images to be preloaded as HTML instead of headers
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32445">#32445</a>
</li>
</ul>
<h3 dir="auto">use-sync-external-store</h3>
<ul dir="auto">
<li>Added <code class="notranslate">exports</code> field to <code
class="notranslate">package.json</code> for <code
class="notranslate">use-sync-external-store</code> to support various
entrypoints. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/25231">#25231</a>
</li>
</ul>
<h3 dir="auto">React Server Components</h3>
<ul dir="auto">
<li>Added <code class="notranslate">unstable_prerender</code>, a new
experimental API for prerendering React Server Components on the server
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31724">#31724</a>
</li>
<li>Fixed an issue where streams would hang when receiving new chunks
after a global error <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31840">#31840</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31851">#31851</a>
</li>
<li>Fixed an issue where pending chunks were counted twice. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31833">#31833</a>
</li>
<li>Added support for streaming in edge environments <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31852">#31852</a>
</li>
<li>Added support for sending custom error names from a server so that
they are available in the client for console replaying. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32116">#32116</a>
</li>
<li>Updated the server component wire format to remove IDs for hints and
console.log because they have no return value <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31671">#31671</a>
</li>
<li>Exposed <code class="notranslate">registerServerReference</code> in
client builds to handle server references in different environments. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32534">#32534</a>
</li>
<li>Added react-server-dom-parcel package which integrates Server
Components with the <a href="https://parceljs.org/">Parcel bundler</a>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31725">#31725</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32132">#32132</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31799">#31799</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32294">#32294</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31741">#31741</a>
</li>
</ul></blockquote>
<p><em>Does any of this look wrong? <a
href="https://depfu.com/packages/npm/react/feedback">Please let us
know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a
href="7aa5dda3b3...4a9df08157">See
the full diff on Github</a>. The new version differs by more commits
than we can show here.</p>
</details>




#### ✳️ react-dom (19.0.0 → 19.1.0) ·
[Repo](https://github.com/facebook/react) ·
[Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md)



<details>
<summary>Release Notes</summary>
<h4><a
href="https://github.com/facebook/react/releases/tag/v19.1.0">19.1.0</a></h4>

<blockquote><h3 dir="auto">Owner Stack</h3>
<p dir="auto">An Owner Stack is a string representing the components
that are directly responsible for rendering a particular component. You
can log Owner Stacks when debugging or use Owner Stacks to enhance error
overlays or other development tools. Owner Stacks are only available in
development builds. Component Stacks in production are unchanged.</p>
<ul dir="auto">
<li>An Owner Stack is a development-only stack trace that helps identify
which components are responsible for rendering a particular component.
An Owner Stack is distinct from a Component Stacks, which shows the
hierarchy of components leading to an error.</li>
<li>The <a
href="https://react.dev/reference/react/captureOwnerStack">captureOwnerStack
API</a> is only available in development mode and returns a Owner Stack,
if available. The API can be used to enhance error overlays or log
component relationships when debugging. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/29923">#29923</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32353">#32353</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/30306">#30306</a>,<br>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32538">#32538</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32529">#32529</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32538">#32538</a>
</li>
</ul>
<h3 dir="auto">React</h3>
<ul dir="auto">
<li>Enhanced support for Suspense boundaries to be used anywhere,
including the client, server, and during hydration. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32069">#32069</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32163">#32163</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32224">#32224</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32252">#32252</a>
</li>
<li>Reduced unnecessary client rendering through improved hydration
scheduling <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31751">#31751</a>
</li>
<li>Increased priority of client rendered Suspense boundaries <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31776">#31776</a>
</li>
<li>Fixed frozen fallback states by rendering unfinished Suspense
boundaries on the client. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31620">#31620</a>
</li>
<li>Reduced garbage collection pressure by improving Suspense boundary
retries. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31667">#31667</a>
</li>
<li>Fixed erroneous “Waiting for Paint” log when the passive effect
phase was not delayed <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31526">#31526</a>
</li>
<li>Fixed a regression causing key warnings for flattened positional
children in development mode. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32117">#32117</a>
</li>
<li>Updated <code class="notranslate">useId</code> to use valid CSS
selectors, changing format from <code class="notranslate">:r123:</code>
to <code class="notranslate">«r123»</code>. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32001">#32001</a>
</li>
<li>Added a dev-only warning for null/undefined created in useEffect,
useInsertionEffect, and useLayoutEffect. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32355">#32355</a>
</li>
<li>Fixed a bug where dev-only methods were exported in production
builds. React.act is no longer available in production builds. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32200">#32200</a>
</li>
<li>Improved consistency across prod and dev to improve compatibility
with Google Closure Complier and bindings <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31808">#31808</a>
</li>
<li>Improve passive effect scheduling for consistent task yielding. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31785">#31785</a>
</li>
<li>Fixed asserts in React Native when
passChildrenWhenCloningPersistedNodes is enabled for OffscreenComponent
rendering. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32528">#32528</a>
</li>
<li>Fixed component name resolution for Portal <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32640">#32640</a>
</li>
<li>Added support for beforetoggle and toggle events on the dialog
element. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32479">#32479</a>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32479">#32479</a>
</li>
</ul>
<h3 dir="auto">React DOM</h3>
<ul dir="auto">
<li>Fixed double warning when the <code class="notranslate">href</code>
attribute is an empty string <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31783">#31783</a>
</li>
<li>Fixed an edge case where <code
class="notranslate">getHoistableRoot()</code> didn’t work properly when
the container was a Document <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32321">#32321</a>
</li>
<li>Removed support for using HTML comments (e.g. <code
class="notranslate">&lt;!-- --&gt;</code>) as a DOM container. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32250">#32250</a>
</li>
<li>Added support for <code class="notranslate">&lt;script&gt;</code>
and <code class="notranslate">&lt;template&gt;</code> tags to be nested
within <code class="notranslate">&lt;select&gt;</code> tags. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31837">#31837</a>
</li>
<li>Fixed responsive images to be preloaded as HTML instead of headers
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32445">#32445</a>
</li>
</ul>
<h3 dir="auto">use-sync-external-store</h3>
<ul dir="auto">
<li>Added <code class="notranslate">exports</code> field to <code
class="notranslate">package.json</code> for <code
class="notranslate">use-sync-external-store</code> to support various
entrypoints. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/25231">#25231</a>
</li>
</ul>
<h3 dir="auto">React Server Components</h3>
<ul dir="auto">
<li>Added <code class="notranslate">unstable_prerender</code>, a new
experimental API for prerendering React Server Components on the server
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31724">#31724</a>
</li>
<li>Fixed an issue where streams would hang when receiving new chunks
after a global error <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31840">#31840</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31851">#31851</a>
</li>
<li>Fixed an issue where pending chunks were counted twice. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31833">#31833</a>
</li>
<li>Added support for streaming in edge environments <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31852">#31852</a>
</li>
<li>Added support for sending custom error names from a server so that
they are available in the client for console replaying. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32116">#32116</a>
</li>
<li>Updated the server component wire format to remove IDs for hints and
console.log because they have no return value <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31671">#31671</a>
</li>
<li>Exposed <code class="notranslate">registerServerReference</code> in
client builds to handle server references in different environments. <a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32534">#32534</a>
</li>
<li>Added react-server-dom-parcel package which integrates Server
Components with the <a href="https://parceljs.org/">Parcel bundler</a>
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31725">#31725</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32132">#32132</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31799">#31799</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/32294">#32294</a>,
<a
href="https://bounce.depfu.com/github.com/facebook/react/pull/31741">#31741</a>
</li>
</ul></blockquote>
<p><em>Does any of this look wrong? <a
href="https://depfu.com/packages/npm/react-dom/feedback">Please let us
know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a
href="7aa5dda3b3...4a9df08157">See
the full diff on Github</a>. The new version differs by more commits
than we can show here.</p>
</details>












---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2025-04-07 13:05:56 +00:00
Philipp Spiess
3e9cf87adf
Make polyfill work when the theme variable resolves to another var (#17562)
Discovered while triaging #17556

This PR improves the `color-mix(...)` polyfill to ensure it works when a
theme key links to another theme key via a `var(...)` call.

Imagine this setup:

```css
 @theme {
  --color-red: var(--color-red-500);
  --color-red-500: oklch(63.7% 0.237 25.331);
}
@source inline("text-red/50");
````

Since `--color-red` will link to `--color-red-500` _which is also a
known theme variable_, we can inline the value of `--color-red-500` into
the fallback now:

```css
.text-red\\/50 {
  color: var(--color-red);
}
@supports (color: color-mix(in lab, red, red)) {
  .text-red\\/50 {
    color: color-mix(in oklab, var(--color-red) 50%, transparent);
  }
}
```

This will allow for slightly less confusing behavior.

The code added also handles recursive definitions where a color is
linking to another color that is again linking to the first one (by
adding a `Set` to keep track of already seen variable names).

## Test plan

- Added unit test
2025-04-07 11:42:02 +02:00
Philipp Spiess
811e97d61a
Fix polyfill in combination with unused CSS variable removal (#17555)
This PR fixes an issue we noticed while investigating #17553, where the
unused CSS variable removal didn't work properly when the theme variable
it tried to remove was modified by a polyfill rule.

The way the bookkeeping for the unused CSS variable worked was that it
tired to find the declaration inside it's parent after the traversal.
However, the `color-mix(…)` polyfill has since then made changes to the
declaration so it can't find it's position correctly anymore and will
thus instead delete the last declaration of the node (this caused
unrelated CSS variables to be eliminated while the ones with
`color-mix(…)` were unexpectedly kept).

To fix this, we decided to apply the polyfills after any eventual
deletions. This also ensures that no `@supports` query for the variables
are created and simplifies the code a bit since all polyfills are now
colocated.

## Test plan

- Added a unit test for the example we discovered in #17553
- Luckily the conditions of this seemed rare enough so that it doesn't
cause any other of our tests to update.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-04-07 09:18:47 +00:00
Robin Malfait
5a77c9dfc4
Prepare v4.1.3 release (#17563)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
v4.1.3
2025-04-04 19:54:23 +02:00
Robin Malfait
7d317251f2
Handle Ruby %w syntax in Slim pre processing (#17557)
This PR fixes an issue where the Ruby `%w[…]` syntax causes utilities to
not be properly extracted.

This PR will now ensure that it does get extracted correctly.

Given this input:
```slim
div[
  class=%w[bg-blue-500 w-10 h-10]
]
div[
  class=%w[w-10 bg-green-500 h-10]
]
```

Before this PR, we extracted everything but the `bg-blue-500`. The
`w-10` was extracted but not because of the second div, but because of
the first one.

Fixes: #17542

## Test plan

1. Added a test to ensure it's working correctly.

Looking at the extractor tool, you can see that it now gets extracted
correctly. Top is before, bottom is with this change.

<img width="1199" alt="image"
src="https://github.com/user-attachments/assets/028d9abd-8917-438c-a423-88ba887b7f97"
/>
2025-04-04 17:21:35 +02:00
Philipp Spiess
e085977844
PostCSS: Fix Turbopack 'one-revision-behind' bug (#17554)
Closes #17508

This PR fixes another issue we found that caused dev builds with Next.js
and Turbopack to resolve the CSS file that was saved one revision before
the latest update.

When debugging this we noticed that the PostCSS entry is called twice
for every one update when changing the input CSS file directly. That was
caused by the input file itself being added as a _dependency_ so you
would first get the callback that a _dependency_ has updated (at which
point we look at the file system and figure out we need a full-rebuild
because the input.css file has changed) and then another callback for
when the _input file_ has updated. The problem with the second callback
was that the file-system was already scanned for updates and since this
includes the `mtimes` for the input file, we seemingly thought that the
input file did not change. However, the issue is that the first callback
actually came with an outdated PostCSS input AST...

We found that this problem arises when you register the input CSS as a
dependency of itself. This is not expected and we actually guard against
this in the PostCSS client. However, we found that the input `from`
argument is _a relative path when using Next.js with Turbopack_ so that
check was not working as expected.

## Test plan

Added the change to the repro from #17508 and it seems to work fine now.


https://github.com/user-attachments/assets/2acb0078-f961-4498-be1a-b1c72d5ceda1

Also added a unit test to ensure we document that the input file path
can be a relative path.

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-04-04 14:58:50 +02:00
Robin Malfait
2fd7c8d967
Show warning when using unsupported bare value data type (#17464)
This PR will show a warning if you are using a bare value data type that
is not supported.

Let's say you want to create a new utility that allows `color` to be a
bare value data type like this:
```css
@utility paint-* {
  paint: --value([color], color);
}
```

This means that this would enable new syntax that we don't support yet.
E.g.: `paint-#0088cc`.

The only supported data types for bare values are:

- `number` — `2.5`
- `integer` — `2`
- `ratio` — `1/2`
- `percentage` — `50%`

All other data types are not supported in this position. This PR will
now show a warning:
~~~
Unsupported bare value data type: "color".
Only valid data types are: "number", "integer", "ratio", "percentage".

```css
--value([color],color)
                ^^^^^
```
~~~
Once we have better sourcemap / location tracking support, this warning
will point to the exact spot, but for now, only a re-print of the AST
can be used.


If you _do_ want to use other data types, then you will have to use
arbitrary value syntax with `[…]` instead.


```css
@utility paint-* {
  paint: --value([color]);
}
```

This will allow for `paint-[#0088cc]` for example.

Note: this is not a behavioral change, we already didn't support other
data types, but we silently ignored them. This means that we have to do
more parsing at runtime when evaluating the utility.

With this change, a warning is shown when registering the `@utility`,
not when using it.
2025-04-04 12:20:46 +00:00
depfu[bot]
57e55a6fe4
Update @playwright/test 1.51.0 → 1.51.1 (patch) (#17538) 2025-04-04 10:57:54 +02:00
Robin Malfait
fc94ab4727
update changelog 2025-04-03 19:14:18 +02:00
Philipp Spiess
3f434a6f00
Vite: Don't register the current CSS file as a dependency on itself (#17533)
Closes #17512

One of the changes of the Oxide API in 4.1 is that it now emits the
input CSS file itself as a dependency. This was fine in most of our
testing but it turns out that certain integrations (in this case a Qwik
project) don't like this and will silently crash with no CSS file being
added anymore.

This PR fixes this by making sure we don't add the input file as a
dependency on itself and also adds an integration test to ensure this
won't regress again.

## Test plan

- Tested with the repro provided in #17512
- Added a minimal integration test based on that reproduction that I
also validated will _fail_, if the fix is reverted.
v4.1.2
2025-04-03 18:50:16 +02:00
Robin Malfait
4c99367b7b
Prepare release v4.1.2 (#17530)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2025-04-03 15:36:42 +00:00
Philipp Spiess
5a9d1f4d5c
Fix test that relies on mtimes (#17529)
Fixes a timing issue added to a new unit test on `main`. Going to wait
for the `CI / Linux` unit tests to pass 3 times before merging this.
2025-04-03 15:24:26 +00:00
Philipp Spiess
4200a1ecc4
Fix slow incremental builds (especially on Windows) (#17511)
This PR fixes slow rebuilds on Windows where rebuilds go from ~2s to
~20ms.

Fixes: #16911
Fixes: #17522

## Test plan

1. Tested it on a reproduction with the following results:

Before:


https://github.com/user-attachments/assets/10c5e9e0-3c41-4e1d-95f6-ee8d856577ef

After:


https://github.com/user-attachments/assets/2c7597e9-3fff-4922-a2da-a8d06eab9047

Zooming in on the times, it looks like this:
<img width="674" alt="image"
src="https://github.com/user-attachments/assets/85eee69c-bbf6-4c28-8ce3-6dcdad74be9c"
/>

But with these changes:
<img width="719" alt="image"
src="https://github.com/user-attachments/assets/d89cefda-0711-4f84-bfaf-2bea11977bf7"
/>

We also tested this on Windows with the following results:
Before:
<img width="961" alt="image"
src="https://github.com/user-attachments/assets/3a42f822-f103-4598-9a91-e659ae09800c"
/>

After:
<img width="956" alt="image"
src="https://github.com/user-attachments/assets/05b6b6bc-d107-40d1-a207-3638aba3fc3a"
/>


[ci-all]

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-04-03 17:13:15 +02:00
Philipp Spiess
60b0da90ce
Polyfill: Fall back to first color value when color-mix(…) contains unresolvable var(…) (#17513)
This PR further improves the `color-mix(…)` polyfill to create a
reasonable fallback if dynamic values that can not statically be
resolved are used. This refers to either the use of `currentcolor` or
any variables that are not static theme variables.

Here are two examples that now generate a reasonable fallback instead of
not showing any color at all:

```css
.text-\\(--my-color\\)\\/\\(--my-opacity\\) {
  color: var(--my-color);
}
@supports (color: color-mix(in lab, red, red)) {
  .text-\\(--my-color\\)\\/\\(--my-opacity\\) {
    color: color-mix(in oklab, var(--my-color) var(--my-opacity), transparent);
  }
}
```

```css
.text-current\\/50 {
  color: currentColor;
}

@supports (color: color-mix(in lab, red, red)) {
  .text-current\\/50 {
    color: color-mix(in oklab, currentColor 50%, transparent);
  }
}
```

## Test plan

- Made sure the test diffs are looking reasonable
- Tested this on a production site with `<p className="text-shadow-lg/50
[--my-color:red] text-shadow-(color:--my-color)">shadow test</p>`
- Browsers that do not support `color-mix(…)` will properly show a red
shadow now albeit with 100% opacity: iOS 15.5 and Chrome 110
- Browsers that I have tested to make sure it still works there with
opacity: Firefox 127, Firefox 128, Latest Chrome, Safari, Firefox
- Browsers that do show a black shadow because of `var(…)var(…)` being
chained with no space by lightningcss: Chrome 111
2025-04-03 15:12:34 +00:00
Robin Malfait
81a676f129
Fix race condition in Next.js with --turbopack (#17514)
This PR fixes an issue where if you use Next.js with `--turbopack` a
race condition happens because the `@tailwindcss/postcss` plugin is
called twice in rapid succession.

The first call sees an update and does a partial update with the new
classes. Next some internal `mtimes` are updated. The second call
therefore doesn't see any changes anymore because the `mtimes` are the
same, therefore it's serving its stale data.

Fixes: #17508

## Test plan

- Tested with the repro provided in #17508
- Added a new unit test that calls into the PostCSS plugin directly for
the same change from the same JavaScript run-loop.

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-03 17:07:38 +02:00
Jordan Pittman
e45302b910
Fix drop shadow filters with multiple shadows (#17515)
It seems that I broke support for multiple drop-shadow filters when
`@theme inline` was used in v4.1. This PR fixes that by segmenting the
drop shadow value on top-level commas and wrapping each segment with
`drop-shadow(…)` like we did in v4.0.
2025-04-03 14:37:56 +00:00
Teddy Bradford
3e41e9ffe6
Replace currentColor with currentcolor (lowercase) (#17510)
Replaces `currentColor` with `currentcolor` (lowercase) to match what's
defined in [CSS Color Module Level
4](https://www.w3.org/TR/css-color-4/#currentcolor-color) and
[MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentcolor_keyword)
(see: https://github.com/mdn/content/pull/16592).

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-03 16:09:12 +02:00
depfu[bot]
f8b9aa983a
Update @types/bun 1.2.4 → 1.2.8 (patch) (#17528) 2025-04-03 16:05:41 +02:00
depfu[bot]
e5b2b0f12c
Update bun 1.2.4 → 1.2.8 (patch) (#17527) 2025-04-03 15:53:27 +02:00
Justin Wong
80f9578bfa
Fix multi-value arbitrary inset shadow (#17523)
Fixes #17520

Fixes multi-value inset shadows to apply the `inset` prefix to each
component instead of only the first.

Feel free to make the code nicer 😄

## Test plan

Ensure that a multi-value inset shadow now applies each shadow _inset_: 
<img width="505" alt="Screenshot 2025-04-03 at 10 50 29"
src="https://github.com/user-attachments/assets/5d38de45-a16f-48fd-8e3c-b50d2740eb49"
/>

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-04-03 11:15:30 +02:00
Philipp Spiess
4484192ca3
Use @layer properties for @property polyfills (#17506)
This PR changes how polyfills for `@property` are inserted. The main
motivation is to remove the need to rely on the correct placement of
`@layer base;`—Something that's not really required right not in
Tailwind CSS v4 and we'd like to keep it this way.

The idea is that the polyfills are inserted for you automatically. To
ensure they always take precedence, we insert an empty `@layer
properties;` at the top of the CSS file so that later, when we emit all
`@property` rules and their fallback, we can use this new named layer to
ensure the rules have a higher order.

Unfortunately, just putting `@layer properties;` at the beginning of a
file would not work as `lightningcss` incorrectly hoists all content
into the first occurrence of a layer name meaning these rules might be
inserted _before_ eventual external imports:


![image](https://github.com/user-attachments/assets/c5a1694d-1549-47ed-ad0f-266807be4730)

To work around this, we have to insert that layer name after any
eventual remaining external `@imports` for now.

## Test plan

- Updated snapshot tests
- Deployed a new version of the website with the patch applied to ensure
it works across browsers:
https://tailwindcss-com-git-legacy-browsers-tailwindlabs.vercel.app/.
Tested on: Safari on iOS 15.5, Safari on iOS 16.0, Firefox 127, Firefox
128, Chrome 110, Chrome latest, Safari latest, Firefox latest
2025-04-02 18:16:28 +02:00
Robin Malfait
6a0a3ec0fa
Prepare release v4.1.1 (#17503) v4.1.1 2025-04-02 09:27:58 +00:00
Philipp Spiess
a429462639
Use @tailwindcss/node for import in CLI (#17502)
Closes #17501

Seems like an oversight. The CLI does have a dependency on
`@tailwindcss/node` so it should use it from the public import like the
other stuff.
2025-04-02 09:16:58 +00:00
Robin Malfait
3c937ecee7
Inject polyfills after @import and body-less @layer (#17493)
This PR fixes an issue where polyfills were injected at the top, but
they should be after `@import` and body-less `@layer` rules.

This is necessary in case you are using Google fonts like this for
example:
```css
@import url('https://fonts.google.com');
@import "tailwindcss";
```

While the `@import url(…);` sits above `@import "tailwindcss";` in the
final generated CSS we injected the polyfills at the very beginning.

This PR will inject the polyfills after the first AST Node that is not:
1. A comment
2. An external import — `@import url(…)`
3. A body-less layer — `@layer foo, bar, baz;`

The snapshots look a little confusing, but that's because Lightning CSS
is optimizing the output and moving things around a bit:

<img width="1482" alt="image"
src="https://github.com/user-attachments/assets/a0552c8b-93df-4e1d-ad90-8b8abf9492b1"
/>

[Lightning CSS
Playground](https://lightningcss.dev/playground/index.html#%7B%22minify%22%3Afalse%2C%22customMedia%22%3Atrue%2C%22cssModules%22%3Afalse%2C%22analyzeDependencies%22%3Afalse%2C%22targets%22%3A%7B%22chrome%22%3A6225920%7D%2C%22include%22%3A0%2C%22exclude%22%3A0%2C%22source%22%3A%22%40layer%20theme%2C%20base%2C%20components%2C%20utilities%3B%5Cn%5Cn%40supports%20(((-webkit-hyphens%3A%20none))%20and%20(not%20(margin-trim%3A%20inline)))%20or%20((-moz-orient%3A%20inline)%20and%20(not%20(color%3A%20rgb(from%20red%20r%20g%20b))))%20%7B%5Cn%20%20%40layer%20base%20%7B%5Cn%20%20%20%20*%2C%20%3Abefore%2C%20%3Aafter%2C%20%3A%3Abackdrop%20%7B%5Cn%20%20%20%20%20%20--tw-font-weight%3A%20initial%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%5Cn%40layer%20theme%20%7B%5Cn%20%20%3Aroot%2C%20%3Ahost%20%7B%5Cn%20%20%20%20--font-sans%3A%20ui-sans-serif%2C%20system-ui%2C%20sans-serif%2C%20%5C%22Apple%20Color%20Emoji%5C%22%2C%20%5C%22Segoe%20UI%20Emoji%5C%22%2C%20%5C%22Segoe%20UI%20Symbol%5C%22%2C%20%5C%22Noto%20Color%20Emoji%5C%22%3B%5Cn%20%20%20%20--font-mono%3A%20ui-monospace%2C%20SFMono-Regular%2C%20Menlo%2C%20Monaco%2C%20Consolas%2C%20%5C%22Liberation%20Mono%5C%22%2C%20%5C%22Courier%20New%5C%22%2C%20monospace%3B%5Cn%20%20%20%5Cn%20%20%7D%5Cn%7D%5Cn%5Cn%40layer%20base%20%7B%5Cn%20%20*%2C%20%3Aafter%2C%20%3Abefore%2C%20%3A%3Abackdrop%20%7B%5Cn%20%20%20%20box-sizing%3A%20border-box%3B%5Cn%20%20%20%20border%3A%200%20solid%3B%5Cn%20%20%20%20margin%3A%200%3B%5Cn%20%20%20%20padding%3A%200%3B%5Cn%20%20%7D%5Cn%7D%5Cn%5Cn%40layer%20utilities%20%7B%5Cn%20%20.text-2xl%20%7B%5Cn%20%20%20%20font-size%3A%20var(--text-2xl)%3B%5Cn%20%20%20%20line-height%3A%20var(--tw-leading%2C%20var(--text-2xl--line-height))%3B%5Cn%20%20%7D%5Cn%7D%5Cn%5Cn%40property%20--tw-font-weight%20%7B%5Cn%20%20syntax%3A%20%5C%22*%5C%22%3B%5Cn%20%20inherits%3A%20false%5Cn%7D%22%2C%22visitorEnabled%22%3Afalse%2C%22visitor%22%3A%22%7B%5Cn%20%20Color(color)%20%7B%5Cn%20%20%20%20if%20(color.type%20%3D%3D%3D%20'rgb')%20%7B%5Cn%20%20%20%20%20%20color.g%20%3D%200%3B%5Cn%20%20%20%20%20%20return%20color%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%22%2C%22unusedSymbols%22%3A%5B%5D%2C%22version%22%3A%22local%22%7D)

Fixes: #17494
2025-04-02 11:05:35 +02:00
Philipp Spiess
b069d7a5a1
Disable padding in @source inline(…) brace expansion (#17491)
The padding code we had was incorrect as it would always pad on the
largest string representation. So for an input like this:


```
@source inline("z-{10..100..10}");
```

It would create the following candidates: 

- `z-010`
- `z-020`
- `z-030`
- `z-040`
- `z-050`
- `z-060`
- `z-070`
- `z-060`
- `z-070`
- `z-100`

Instead of fixing the padding logic we realized that Tailwind utilities
don't need padding at all so this PR removes this feature

## Test plan

- Added the following to the Vite playground: `@source
inline("z-{10..100..10}");`
- Ensure it works: 

![image](https://github.com/user-attachments/assets/f4714729-4ef7-4678-a531-70b471e75e6e)
2025-04-01 22:55:03 +02:00
Philipp Spiess
8f631d0d8a
Prepare 4.1.0 release (#17483)
---------

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
v4.1.0
2025-04-01 18:05:18 +02:00
Robin Malfait
b94720aef3
Refactor codemod structure (#17484)
This PR is an internal refactor of the codemods package structure that
will make a few follow-up PRs easier.

Essentially what happens is:


1. Moved `./src/template/` into `src/codemods/template/`
2. Moved `./src/codemods` into `./src/codemods/css` (because the CSS
related codemods already)
3. Moved the migration files for the JS config, PostCSS config and
Prettier config into `./src/codemods/config/`.
4. Made filenames with actual migrations consistent by prefixing them
with `migrate-`.
5. Made sure that all the migration functions also use `migrate…`

When looking at this PR, go commit by commit, it will be easier. In a
lot of cases, it's just moving files around but those commits also come
with changes to the code just to update the imports.

[ci-all]
2025-04-01 17:12:22 +02:00
Jordan Pittman
9374647b86
Add drop-shadow-* color support (#17434)
This PR adds support for two things:

- New `drop-shadow-{color}` utilities which can be used to control the
filder drop shadow color
- New `drop-shadow-*/{alpha}` utilities which can be used to control the
intensity of the drop shadow

Note that drop-shadow-* utilities without a modifier use variables from
your theme.

If you opt into using drop shadow colors or drop-shadow "intensity"
utilities we will inline these values into your CSS when using a drop
shadow color or drop shadow intensity utility and as such can't be
changed by changing the theme variables on a per-element/tree basis.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-04-01 17:11:49 +02:00
Philipp Spiess
55d7a65cfc
Add self-baseline-last (#17476)
This PR also adds a new `self-baseline-last` utility similar to
`items-baseline-last` added previously. We've also discussed adding a
`content-baseline-last` utility but since the browser support for this
[is very
limited](https://caniuse.com/mdn-css_properties_align-content_flex_context_last_baseline)
and we weren't able to get this to do anything even in the supported
browsers, we decided against it.

## Test plan

Updated the utility tests.
2025-04-01 07:55:41 -04:00
Philipp Spiess
f590be43b8 Add changelog for #17435 2025-04-01 13:34:22 +02:00
Philipp Spiess
156afc6d67
Improve compatibility with Safari 15 (#17435)
This PR improves the compatibility with Tailwind CSS v4 with unsupported
browsers with the goal to greatly improve compatibility with Safari 15.

To make this work, this PR makes the following changes to all code

- Change `oklab(…)` default theme values to use a percentage in the
first place (so instead of `--color-red-500: oklch(0.637 0.237 25.331);`
we now define it as `--color-red-500: oklch(63.7% 0.237 25.331);` since
this syntax has much broader support on Safari).
- Polyfill `@property` with a `@supports` query targeting older versions
of Safari and Firefox *
- Create fallbacks for the `color-mix(…)` function that use _inlined
color values from your theme_ so that they can be computed a compile
time by `lightningcss`. These fallbacks will convert to srgb to increase
compatibility.
- Create fallbacks for the _relative color_ feature used in the new
shadow utilities and using `color-mix(…)` in case _relative color_ is
applied on `currentcolor` (due to limited browser support)
- Create fallbacks for gradient interpolation methods (e.g. to support
`bg-linear-to-r/oklab`)
- Polyfill `@media` queries range syntax.

## A simplified example

Given this example CSS input:

```css
@import 'tailwindcss';
@source inline('from-cyan-500/50 bg-linear-45');
```

Here's the updated output CSS including the newly added polyfills and
updated `oklab` values:

```css
.bg-linear-45 {
  --tw-gradient-position: 45deg;
  background-image: linear-gradient(var(--tw-gradient-stops));
}

@supports (background-image: linear-gradient(in lab, red, red)) {
  .bg-linear-45 {
    --tw-gradient-position: 45deg in oklab;
  }
}

.from-cyan-500\\/50 {
  --tw-gradient-from: oklab(71.5% -.11682 -.08247 / .5);
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
}

@supports (color: color-mix(in lab, red, red)) {
  .from-cyan-500\\/50 {
    --tw-gradient-from: color-mix(in oklab, var(--color-cyan-500) 50%, transparent);
  }
}

:root, :host {
  --color-cyan-500: oklch(71.5% .143 215.221);
}

@supports (((-webkit-hyphens: none)) and (not (margin-trim: 1lh))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
  @layer base {
    *, :before, :after, ::backdrop {
      --tw-gradient-position: initial;
      --tw-gradient-from: #0000;
      --tw-gradient-via: #0000;
      --tw-gradient-to: #0000;
      --tw-gradient-stops: initial;
      --tw-gradient-via-stops: initial;
      --tw-gradient-from-position: 0%;
      --tw-gradient-via-position: 50%;
      --tw-gradient-to-position: 100%;
    }
  }
}

@property --tw-gradient-position {
  syntax: "*";
  inherits: false
}

@property --tw-gradient-from {
  syntax: "<color>";
  inherits: false;
  initial-value: #0000;
}

@property --tw-gradient-via {
  syntax: "<color>";
  inherits: false;
  initial-value: #0000;
}

@property --tw-gradient-to {
  syntax: "<color>";
  inherits: false;
  initial-value: #0000;
}

@property --tw-gradient-stops {
  syntax: "*";
  inherits: false
}

@property --tw-gradient-via-stops {
  syntax: "*";
  inherits: false
}

@property --tw-gradient-from-position {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0%;
}

@property --tw-gradient-via-position {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 50%;
}

@property --tw-gradient-to-position {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 100%;
}
```

## \* A note on `@property` polyfills and CSS modules

On Next.js, CSS module files are required to be _pure_, meaning that all
selectors must either be scoped to a class or an ID. Fortunatnyl for us,
this does not apply to `@property` rules which we've been using before
to initialize CSS variables.

However, since we're now bringing back the `@property` polyfills, that
would cause unexpected rules to be exported from the CSS file as this:

```css
@reference "tailwindcss";

.skew {
  @apply skew-7;
}
```

Would turn to the following file:

```css
.skew {
  /* … */
}
@supports (/*…*/) {
  @layer base {
    *, :before, :after, ::backdrop {
      --tw-gradient-position: initial;
    }
  }
}
@property /* … */ 
```

Notice that this adds a `*` selector which is not considered pure.

Unfortunately there is no way for us to silence this warning or work
around it, as the dependency causing this errors
([`postcss-modules-local-by-default`](https://github.com/css-modules/postcss-modules-local-by-default))
is bundled into Next.js. To work around crashes, these polyfills will
not apply to CSS modules processed by the PostCSS extension for now.

## Testing on tailwindcss.com

To see the changes in effect, take a look at this screencast that
compares tailwindcss.com on iOS 15.5 with a version that has the patches
of this PR applied:

https://github.com/user-attachments/assets/1279d6f5-3c63-4f30-839c-198a789f4292

## Test plan

- Tested on tailwindcss.com via a preview build:
https://tailwindcss-com-git-legacy-browsers-tailwindlabs.vercel.app/
- Updated tests
- Ensure we also test on Chrome 111, Safari 16.4, Firefox 128 to
make sure we have no regressions. Also tested on Safari 16.4, 15.5, 18.0
2025-04-01 13:33:22 +02:00
depfu[bot]
80017ebabe
Update all of nextjs 15.2.3 → 15.2.4 (patch) (#17471) 2025-04-01 10:48:54 +02:00
Robin Malfait
d54e23d5a1
Ensure webpack executable is found in CI (#17470)
This PR will fix CI on the main branch where `webpack` could not be
found on macOS (but it worked on Linux).

Going to run [ci-all] to verify the changes.
2025-03-31 19:21:51 +02:00
Robin Malfait
53801091a0
Watch CSS module files for changes (#17467)
This PR is a follow-up PR for:
https://github.com/tailwindlabs/tailwindcss/pull/17433

In the other PR we allow scanning CSS files for extracting usages of CSS
variables. This is important for `.module.css` files that reference
these variables but aren't in the same big AST of the main CSS file.

This PR also makes sure to watch for changes in those registered CSS
files and re-extract the variables when they change.

This PR took a bit longer than expected because I was trying to make
sure that writing to `./dist/out.css` works without infinite-looping
(e.g.: we had issues with this in Tailwind CSS v3 with webpack).

But I couldn't reproduce the issue at all. I did had some code that
tried to detect if the CSS file contained license headers and skip in
(because then it's very likely an output CSS file) but even without it
the tests were fine.

I setup integration tests with `@tailwindcss/cli` itself, and with tools
that use webpack. Added a test for Next.js, and a dedicated webpack test
as well.

Even without tests, locally, I couldn't reproduce an infinite loop due
to changes in an output CSS file...

Eventually dropped the code that tries to detect output CSS files.

One thing to keep in mind is that if you change any of your "main" CSS
files, then we will trigger a full rebuild anyway, so this change is
only required for unrelated CSS files (like CSS module files) that use
CSS variables.

## Test plan

1. Added integration tests for the CLI and Next.js
2. Added new dedicated test for webpack
2025-03-31 18:44:06 +02:00
Philipp Spiess
c7ba564f92
Fix slow unit test (#17465)
This PR reworks a unit test that created a file in the project root and
then proceeded by scanning everything in the git root for candidates.
The issue specifically is that with the `.debug/` folder, our project
root can grow quite a bit which makes this test slower the more you work
on other tests...

To fix this we now simply create a tmp folder with only that one test
file. 🚀
2025-03-31 15:26:01 +02:00
Philipp Spiess
eec1bf2b84
Fix --theme(…) function when legacy JS plugins are used (#17458)
Closes #17346

This PR fixes an issue that caused the `--theme(…)` function to behave
differently after a legacy JS plugin or config was configured. The issue
was that the compatibility layer would patch the theme value resolver to
always inline the value. This, however, is only expected to happen if
the path does not look like a CSS variable in which case this legacy
code path should not be run.

To fix this, I'm now keeping a reference to the regular theme resolution
function and call into it if the path starts with `--`.

## Test plan

- Tested with the repro in #17346 by adding pnpm overrides and confirmed
that this fixes the issue
- Added a unit test to the `--theme(…)` resolution tests
2025-03-31 13:06:28 +02:00
Jordan Pittman
c32b6082a1
Add object-{top,bottom}-{left,right} utilities (#17437)
These match the new `mask-*` and updated `bg-*` utilities.

This is the same as #17378 but for `object-position`.

| Deprecated utility    | New utility           |
| --------------------- | --------------------- |
| `object-left-top`     | `object-top-left`     |
| `object-right-top`    | `object-top-right`    |
| `object-left-bottom`  | `object-bottom-left`  |
| `object-right-bottom` | `object-bottom-right` |
2025-03-28 15:58:17 -04:00
Jordan Pittman
f77226652a
Add new mask-image utilities for Tailwind CSS v4.1 (#17134) 2025-03-28 13:24:40 -04:00
Jordan Pittman
1a68b99368
Add support for “intensity” modifiers on box and text shadows (#17398)
This PR adds support for utilities like:
- `text-shadow-lg/25`

It uses relative color syntax to replace the alpha value of the shadow
from your theme.

When combined with a colors:
- `text-shadow-lg/25 text-shadow-red-500`
- `text-shadow-lg/25 text-shadow-red-500/75`

The alpha values are **multiplied** resulting in a shadow with the color
specified in `--color-red-500` and alpha values of 25% and 18.75%
respectively.
2025-03-28 13:16:00 -04:00
Philipp Spiess
5e255deb0e
Add text-shadow-* utilities (#17389)
This PR adds new `text-shadow-*` utilities and default values courtesy
of @danhollick's.

Usage is similar to the normal `shadow-*` utilities, for example:

```html
<h1 class="text-center text-7xl tracking-tight text-white text-shadow-xl">
  Some fancy <br />
  headline
</h1>
```

Since this PR also adds first-class support for the `--text-shadow`
theme namespace, it also means it resolves #17047.

## Test plan

- Copied @danhollick's [demo
playground](https://play.tailwindcss.com/lbA3Y6VY8u) to the `vite` setup
and ran a production build to ensure it looks correct:
https://tailwind-text-shadows-preview-2kdnjb32b.vercel.app/

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-03-28 13:06:56 -04:00