tailwindcss/packages
Robin Malfait f2ebb8eb82
Fix var(…) as the opacity value inside the theme(…) function (#14653)
Inside the `theme(…)` function, we can use the `/` character for
applying an opacity. For example `theme(colors.red.500 / 50%)` will
apply a 50% opacity to the `colors.red.500` value.

However, if you used a variable instead of the hardcoded `50%` value,
then this was not parsed correctly. E.g.: `theme(colors.red.500 /
var(--opacity))`

_If_ we have this exact syntax (with the spaces), then it parses, but
some information is lost:

```html
<div class="bg-[theme(colors.red.500_/_var(--opacity))]"></div>
```

Results in:
```css
.bg-\[theme\(colors\.red\.500_\/_var\(--opacity\)\)\] {
  background-color: color-mix(in srgb, #ef4444 calc(var * 100%), transparent);
}
```
Notice that the `var(--opacity)` is just parsed as `var`, and the
`--opacity` is lost.

Additionally, if we drop the spaces, then it doesn't parse at all:

```html
<div class="bg-[theme(colors.red.500/var(--opacity))]"></div>
```

Results in:
```css
```

This means that we have to handle 2 issues to make this work:
1. We have to properly handle the `/` character as a proper separator.
2. If we have sub-functions, we have to make sure to print them in full
(instead of only the very first node (`var` in this case)).
2024-10-14 12:08:41 +00:00
..
@tailwindcss-cli Fix CLI client crash when a file is removed before we process the change notification (#14616) 2024-10-09 14:56:08 +00:00
@tailwindcss-node release v4.0.0-alpha.26 2024-10-03 16:39:59 +02:00
@tailwindcss-postcss Don't set display: none on elements that use hidden="until-found" (#14631) 2024-10-09 13:55:58 +02:00
@tailwindcss-standalone Update bun 1.1.26 → 1.1.29 (patch) (#14608) 2024-10-07 11:24:59 +02:00
@tailwindcss-upgrade Migrate aria-*, data-* and supports-* variants from arbitrary values to bare values (#14644) 2024-10-11 10:41:37 -04:00
@tailwindcss-vite release v4.0.0-alpha.26 2024-10-03 16:39:59 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Fix var(…) as the opacity value inside the theme(…) function (#14653) 2024-10-14 12:08:41 +00:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00