1964 Commits

Author SHA1 Message Date
Philipp Spiess
680c55c11c
Normalize attribute selector for data-* and aria-* modifiers (#14037)
Fixes #14026 
See #14040 for the v4 fix

When translating `data-` and `aria-` modifiers with attribute selectors,
we currently do not wrap the target attribute in quotes. This only works
for keywords (purely alphabetic words) but breaks as soon as there are
numbers or things like spaces in the attribute:

```html
<div data-id="foo" class="data-[id=foo]:underline">underlined</div>
<div data-id="f1" class="data-[id=1]:underline">not underlined</div>
<div data-id="foo bar" class="data-[id=foo_bar]:underline">not underlined</div>
```

Since it's fairly common to have attribute selectors with `data-` and
`aria-` modifiers, this PR will now wrap the attribute in quotes unless
these are already wrapped.

| Tailwind Modifier  | CSS Selector |
| ------------- | ------------- |
| `.data-[id=foo]`  | `[data-id='foo']`  |
| `.data-[id='foo']`  | `[data-id='foo']`  |
| `.data-[id=foo_i]`  | `[data-id='foo i']`  |
| `.data-[id='foo'_i]`  | `[data-id='foo' i]`  |
| `.data-[id=123]`  | `[data-id='123']`  |

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-07-24 18:46:21 +02:00
Jordan Pittman
bdc87ae1d7
Fix class detection in Slim templates with attached attributes and IDs (#14019)
* Fix class detection in Slim templates with attached attributes and IDs

* Update changelog

* Tweak regex
2024-07-18 11:21:20 -04:00
Josh Wilson
0573c0769a
Loosen :is() wrapping rules in applyImportantSelector for more readable output. (#13900) 2024-07-16 10:51:45 -04:00
Georg Ledermann
ae6a8d532b
Fix extracting utilities from slim/pug templates (#14006)
A class name starting with number like `2xl:bg-red-500` must not be removed.

Resolves #14005
2024-07-16 09:34:20 -04:00
Adam Wathan
9033d625e1
Always generate -webkit-backdrop-filter property (#13997)
* Always generate -webkit-backdrop-filter property

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-07-12 20:48:08 -04:00
Adam Wathan
074736c1d6
Avoid over-extracting utilities from candidates with decimal values (#13959)
* Avoid over-extracting utilities from candidates with decimal values

Prevent candidates like `px-1.5` from generating both the `px-1.5` class and the `px-1` class.

* Update CHANGELOG.md

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-07-05 14:46:51 -04:00
Robin Malfait
588a8225eb
Add .mts and .cts config file detection (#13940)
* add `tailwind.config.cts` and `tailwind.config.mts` as default config files

* always use jiti when working with ESM or TS files

* update changelog

* add integration test for `.cts` and `.mts` configuration files
2024-07-03 23:09:35 +02:00
Simon He
0de1f0cce4
refactor(util): code refactor (#13872)
* refactor(util): code refactor

* refactor(util): code refactor
2024-06-24 09:13:12 -04:00
Simon He
a61e5aa06b
fix: typo (#13864) 2024-06-20 06:02:11 -04:00
Robin Malfait
eef91c9065
Use no value instead of blur(0px) for backdrop-blur-none and blur-none utilities (#13830)
* map `backdrop-blur-none` and `blur-none` to ` ` instead of `blur(0px)`

* add test for `backdrop-blur-none` and `blur-none`

* update changelog
2024-06-13 15:49:59 +02:00
Jordan Pittman
9e928ce0be
Disable automatic var() injection for anchor properties (#13826)
* Disable automatic `var()` injection for CSS anchor positioning properties

* Update tests

* Update changelog
2024-06-13 09:19:08 -04:00
Jordan Pittman
8d66d94182
[v3] Support negative values for {col,row}-{start,end} utilities (#13781)
* Support negative values for `{col,row}-{start,end}` utilities

* Add tests

* Update changelog
2024-06-03 11:34:27 -04:00
victor
669109efdd
Don't prefix classes in arbitrary values of has-*, group-has-*, and peer-has-* variants (#13770)
* Added tests to verify that classes are prefixed when using `has-*` variants with arbitrary values

* Fix test

* Don't prefix classes in arbitrary values in `has-*` variants

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-05-31 20:01:09 -04:00
Maxwell Barvian
9fda4616eb
Fix multiple <alpha-value> in color definitions (#13740)
* Fix multiple <alpha-value> in color definitions

Fixes #13716

* Update CHANGELOG.md

* Use `replace` with global regex

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-05-29 11:32:48 -04:00
Jordan Pittman
e6c1082823
Revert changes to glob handling (#13384)
* Revert "Improve glob handling for folders with `(`, `)`, `[` or `]` in the file path (#12715)"

This reverts commit f2a7c2c4532b76d61351f1ca7e26ec8c93729b5d.

* Update changelog
2024-03-27 15:16:52 -04:00
Jordan Pittman
8b4a2a6770
Change dark selector so @apply works correctly with pseudo elements (#13379)
* Change dark selector so `@apply` hoists pseudo elements properly

* Update tests

* Update changelog
2024-03-27 11:03:49 -04:00
Robin Malfait
97607f1cfb
Ensure that arbitrary properties respect important configuration (#13353)
* ensure we respect important on arbitrary properties

* update changelog

* reword changelog entry
2024-03-26 11:42:41 +01:00
Robin Malfait
bda84210d6
Only detect nesting when using @apply (#13325)
* drop nesting detection for `@tailwind`

* drop separate nesting detection entirely

* detect nesting only when using `@apply` with a class that uses nesting

* drop unnecessary `important` config

* add test to verify applying nested user CSS errors

* add error reason to tests

* update `@apply` error message
2024-03-23 19:10:51 -04:00
Allain Lalonde
3ba51d14c7
Remove leading space in box-shadow's addDefaults call (#13334)
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-03-23 05:35:02 -04:00
Allain Lalonde
a53d854d1d
Fix missing xx-large and remove double x-large absolute size (#13324)
* fixing double x-large absolute size

x-large appears twice in the set of absolute sizes.

I believe the second one is meant to be 'xx-large'.

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-03-22 20:03:21 +01:00
Magnar Ovedal Myrtveit
ea90d3a81c
Reset letter spacing for form elements (#13150)
* Reset letter spacing for form elements

Some browsers, such as Chrome, set `letter-spacing: normal` for form elements. For consistency with the other styles, it should be set to `inherit` by Preflight.

* wip

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-03-22 14:49:22 -04:00
Jordan Pittman
b10b431d97
Transpile import.meta.url in config files (#13322)
* Use Babel to transpile configs when import.meta is present

* Update minimum jiti version

* Update changelog
2024-03-22 12:45:19 -04:00
Robin Malfait
44b3b429a8
Cleanup oxide — Part #2 (#13312)
* remove all oxide related code

* Update lightningcss to version 1.24.1

* update tests to match bumped Lightning CSS output

---------

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2024-03-22 17:12:14 +01:00
Jordan Pittman
27e4b65e0b
Fix crash showing completions in Intellisense when using a custom separator (#13306)
* Fix variant completions in intellisense when using a custom separator

* Update changelog
2024-03-21 19:38:17 -04:00
Robin Malfait
9b90c53bad
Cleanup oxide — Part #1 (#13304)
* swap engines

* remove all oxide related files

* drop swap engine step from CI

* drop oxide tests where we read from a `.oxide.*` file

* drop swap-engines.js file

* drop unused `oxide` variable

Let's make eslint happy!
2024-03-21 18:23:31 +01:00
Robin Malfait
d56d241fd1
Ensure dashes are allowed in variant modifiers (#13303)
* sync package-lock.json

* ensure dashes are allowed in variant modifiers

* update changelog
2024-03-21 15:25:28 +01:00
Kris Braun
780163c58a feat: add contain utilities (#12993)
* feat: add contain utilities

* chore: lint

* Support mulptiple contain properites

Support multiple contain properties, such as "contain-size contain-layout". Drop contain-unset as we haven't added -unset variants for other utilities.

* Update Vite; fix test regex

Vite is generating files like "index--T9oO-MP.css", which required relaxing the regex used in tests.

---------

Co-authored-by: Alexander <github@lichter.io>
2024-02-23 18:16:15 -05:00
Clement Chang
576798620c Add mix-blend-plus-darker utility (#12923)
* feat: add plus-darker support for mix-blend-mode

* Fix failing test

* Update changelog

* Formatting

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2024-02-23 16:37:32 -05:00
Robin Malfait
f2a7c2c453 Improve glob handling for folders with (, ), [ or ] in the file path (#12715)
* sync package-lock.json

* modify `normalizePath` to keep `\\[`, `\\]`, `\\(` and `\\)` into account

* manually escape () and [] characters in globs

* update changelog
2024-02-23 16:35:49 -05:00
Jordan Pittman
240a0addd3 Sort arbitrary properties alphabetically across multiple class lists (#12911)
* Sort arbitrary properties alphabetically across multiple files

* Update test
2024-02-13 14:17:23 -05:00
Jordan Pittman
9e62bf2043 Split :has rules when using experimental.optimizeUniversalDefaults (#12736)
* Split `:has` rules when using optimizeUniversalDefaults

* Update changelog
2024-01-09 15:10:58 -05:00
Adam Wathan
50fa6dd13e Ensure max specificity of 0,0,1 for button and input Preflight rules (#12735)
* Ensure max specificity of 001 in all Preflight rules

* Update changelog

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-01-09 11:08:11 -05:00
Jordan Pittman
3fb57e55ab Restore old behavior for class dark mode, add new selector and variant options for dark mode (#12717)
* Add dark mode variant option

* Tweak warning messages

* Add legacy dark mode option

* wip

* Use `class` for legacy behavior, `selector` for new behavior

* Add simplified failing apply/where test case

* Switch to `where` list, apply changes to `dir` variants

* Don’t let `:where`, `:is:`, or `:has` be attached to pseudo elements

* Updating tests...

* Finish updating tests

* Remove `variant` dark mode strategy

* Update types

* Update comments

* Update changelog

* Revert "Remove `variant` dark mode strategy"

This reverts commit 185250438ccb2f61ba876d4676823c1807891122.

* Add variant back to types

* wip

* Update comments

* Update tests

* Rename variable

* Update changelog

* Update changelog

* Update changelog

* Fix CS

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-01-05 15:20:11 -05:00
Jordan Pittman
78fedd5cc0 Don't add spaces to gradients and grid track names when followed by calc() (#12704)
* Don’t break gradient functions when following `calc()`

* Don’t break CSS grid track names

* Update changelog
2024-01-03 13:05:06 -05:00
Jordan Pittman
88907757c1 Don't remove keyframe stops when using important utilities (#12639)
* Don't remove keyframe stops when using important utilities

* Fix test

* fix linting
2023-12-21 12:20:14 -05:00
Adam Wathan
fbdb858e97 Improve relative precedence of rtl, ltr, forced-colors and dark variants (#12584)
* Reduce specificity of `rtl`, `ltr`, and `dark` variants

Reduce specificity of `rtl`, `ltr`, and `dark` variants (when using `darkMode: 'class'`) to make them the same as other variants. This also sorts the LTR/RTL and dark variants later in the variant plugin list to ensure that the reduced specificity doesn't cause them to start "losing" to other variants to keep things as backwards compatible as possible.

Resolves a long-standing issue where `darkMode: 'media'` and `darkMode: 'class'` had different specificity, which meant switching your dark mode strategy could break your site.

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:58:22 -05:00
Luke Warlow
11a6ba3949 Move forced-colors variant after dark variant (#12582)
Also add test for the order of the forced-colors variant
2023-12-18 13:58:22 -05:00
Adam Wathan
47dbb4a2b3 Add * variant for targeting direct children (#12551)
* add `*` as child variant

* add `*` as allowed variant character

* update test to reflect Lightning CSS output

* add `childVariant` test

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Gregor Kaczmarczyk <github@aggreggator.de>
2023-12-18 13:58:22 -05:00
Jordan Pittman
7642e28cfe Disable tap highlights on iOS (#12299)
* Disable tap highlights on iOS

* Update changelog

* Update snapshots

* Update changelog
2023-12-18 13:58:22 -05:00
Emilia
06972065de feat(preflight): simplify sans-serif font stack (#11748)
* feat(preflight): simplify sans-serif font stack

`-apple-system` and `BlinkMacSystemFont` were historically needed for
IE11 and chakra-based Edge (The one that wasn't chromium-based).

https://caniuse.com/font-family-system-ui has more details around it.

* further simplify `font-family`

* update tests

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-12-18 13:58:22 -05:00
Ngô Quốc Đạt
9129defd0d Add logical properties support for float and clear (#12480) 2023-12-18 13:58:04 -05:00
Adam Wathan
adfcccf57a Add appearance-auto utility (#12404)
* Add `appearance-auto` utility

* Update CHANGELOG

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:58:04 -05:00
Luke Warlow
add51c658c Add forced-colors variant (#11694)
* Add forced-colors variant

Also add a contrast-custom variant to match custom contrast preferences

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: https://github.com/tailwindlabs/tailwindcss/pull/12170

* remove `contrast-custom` variant

* move `forcedColorsVariants` next to `prefersContrastVariants`

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-12-18 13:58:04 -05:00
Luke Warlow
a35e7fc199 Add forced-color-adjust utilities (#11931)
* Add forced-colors-adjust utilities

* Update forcedColorsAdjust.test.js

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: https://github.com/tailwindlabs/tailwindcss/pull/12170

* rename `forced-colors-adjust` -> `forced-color-adjust`

Dropped the `s` in `colors`.

* update changelog

* fix typo

* use full `forced-color-adjust-auto` and `forced-color-adjust-none` names

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-12-18 13:58:04 -05:00
Jordan Pittman
4a2aa1ccb1 Add size-* shorthand (#12287)
* Add `size-*` shorthand

Add plugin tests

Adjust options

wip

* Update changelog
2023-12-18 13:58:04 -05:00
Brandon McConnell
9a26814b8d Update Preflight html styles to include shadow DOM :host pseudo-class (#11200)
* Extend current preflight `html` styles to support other root/host scopes

Supports SVG root scope, ShadowDOM, and presumably other root scopes

* Replace `:root` with `html`

* Update tests

* Update changelog

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2023-12-18 13:58:03 -05:00
Yuhei Yasuda
0183a8442b Add support for text-wrap: pretty (#12031)
* Add support for `text-wrap: pretty`

* Update changelog

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2023-12-18 13:57:39 -05:00
Adam Wathan
9caa9547b2 Add support for text-wrap property (#11320)
Update changelog

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:57:22 -05:00
Adam Wathan
d72c1893c8 Add has-* variants for :has(...) pseudo-class (#11318)
* Add `has-*` variants for `:has(...)` pseudo-class

* Update changelog

* Fix mistake in test

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-12-18 13:57:08 -05:00
Jordan Pittman
67fd939d3e Fix custom config loading in Standalone CLI (#12616)
* Fix custom config loading in Standalone CLI

* Update changelog
2023-12-18 13:50:59 -05:00