4640 Commits

Author SHA1 Message Date
depfu[bot]
c8cca0c608 Update cssnano to version 5.1.9 2022-05-23 21:58:08 +00:00
Jordan Pittman
50024e4603 Fix grouping using different variant types inside nested groups 2022-05-23 15:43:12 -04:00
Jordan Pittman
b0e1f47b94 Be more direct about variant group extractions
Also adds a previously failing but now passing test case
2022-05-23 15:29:29 -04:00
depfu[bot]
770900b77d Update prettier-plugin-tailwindcss to version 0.1.11 2022-05-23 17:43:31 +00:00
Robin Malfait
68ff4ba500
Experimental support for variant grouping (#8405)
* WIP

* use correct separator

* run all tests

* Fix regex

* add a few more tests

* name the experimental feature flag `variantGrouping`

* update changelog

* rename test file `variant-grouping`

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-05-23 17:45:23 +02:00
Robin Malfait
816a0f26c9
Add prefers-contrast media query variants (#8410)
* Add prefers-contrast variants

* add tests for prefers contrast

* dark mode should have precedence over prefers contrast variants

* update changelog

Co-authored-by: Luke Warlow <projects@warlow.dev>
2022-05-23 17:40:14 +02:00
Robin Malfait
83b4811c60
Improve types of the tailwindcss/plugin (#8400)
* improve types of the `tailwindcss/plugin`

This also exposes/types the `plugin.withOptions` as described here: https://tailwindcss.com/docs/plugins#exposing-options

* update changelog
2022-05-23 12:35:19 +02:00
depfu[bot]
81641859cd Update autoprefixer to version 10.4.7 2022-05-21 21:58:47 +00:00
Adam Wathan
128030fcfa
Only apply hover styles when supported (future) (#8394)
* Only apply hover styles when supported (future)

Co-Authored-By: Andrew Brown <browner12@gmail.com>

* update changelog

Co-authored-by: Andrew Brown <browner12@gmail.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-05-20 11:20:20 -04:00
Adam Wathan
bb4f5dab6b
Fix matchVariants that use at-rules and placeholders (#8392)
* Fix matchVariants that use at-rules and placeholders

* update changelog

* Update CHANGELOG.md

* Only parseVariant when result is defined

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-05-20 10:33:36 -04:00
Adam Wathan
1a564fa7e2 Co-locate addVariant and matchVariant 2022-05-20 10:12:58 -04:00
depfu[bot]
23d3a316f5 Update esbuild to version 0.14.39 2022-05-19 22:44:29 +00:00
Jordan Pittman
30538b363f
Update integration tests (#8386)
* Add content glob integration tests

* Use tagged version in parcel integration tests

* Upgrade postcss-cli integration tests

* upgrade integration test deps

* Fix CS

* Fix tests

* Update lockfile

* Fix vite test in CI
2022-05-19 16:44:20 -04:00
Robin Malfait
fc25299aa6
Add matchVariant API (#8310)
* update regex extractor

* implement `matchVariant` API

* add `matchVariant` test

* add `values` option to the `matchVariant` API

* move `matchVariant` tests to own file

* update changelog
2022-05-17 18:08:42 +02:00
Jordan Pittman
6c63f67d20
Create tailwind.config.cjs file in ESM package when running init (#8363)
* refactor

* Adds support for tailwind.config.cjs files to CLI

* Update changelog

Co-authored-by: Nate Moore <nate@natemoo.re>
2022-05-16 10:53:03 -04:00
Jordan Pittman
0313f02e2c
Move some config error checking out of resolveConfig (#8362) 2022-05-16 10:10:40 -04:00
depfu[bot]
638c8f43ea Update @swc/jest to version 0.2.21 2022-05-15 05:12:55 +00:00
Adam Wathan
177a00b156 Update changelog 2022-05-14 14:06:24 -04:00
Adam Wathan
7fa2a200b2
Reject invalid custom and arbitrary variants (#8345)
* WIP

Still need to write error message

* Update error message

first pass at something better

* Detect invalid variant formats returned by functions

* Add proper error message

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-05-14 13:58:02 -04:00
depfu[bot]
e41bf3d2a7 Update eslint to version 8.15.0 2022-05-13 21:44:02 +00:00
depfu[bot]
96a83534b0 Update esbuild to version 0.14.38 2022-05-10 14:27:59 +00:00
Jordan Pittman
b49dc7cafa
Move important selector to the front when @apply-ing selector-modifying variants in custom utilities (#8313)
* Fix generated utilities using `@apply` with important selectors

* Update changelog
2022-05-09 14:20:36 -04:00
Robin Malfait
be51739337
Arbitrary variants (#8299)
* register arbitrary variants

With the new `addVariant` API, we have a beautiful way of creating new
variants.

You can use it as:
```js
addVariant('children', '& > *')
```

Now you can use the `children:` variant. The API uses a `&` as a
reference for the candidate, which means that:
```html
children:pl-4
```

Will result in:
```css
.children\:pl-4 > * { .. }
```

Notice that the `&` was replaced by `.children\:pl-4`.

We can leverage this API to implement arbitrary variants, this means
that you can write those `&>*` (Notice that we don't have spaces) inside
a variant directly. An example of this can be:
```html
<ul class="[&>*]:underline">
  <li>A</li>
  <li>B</li>
  <li>C</li>
</ul>
```
Which generates the following css:
```css
.\[\&\>\*\]\:underline > * {
  text-decoration-line: underline;
}
```

Now all the children of the `ul` will have an `underline`. The selector
itself is a bit crazy since it contains the candidate which is the
selector itself, it is just escaped.

* add tests for arbitrary variants

This still requires some work to the `defaultExtractor` to make sure it
all works with existing code.

* update changelog

* Fix candidate detection for arbitrary variants

* Refactor

* Add support for at rules

* Add test for attribute selectors

* Fix test

* Add attribute selector support

* Split top-level comma parsing into a generalized splitting routine

We can now split on any character at the top level with any nesting. We don’t balance brackets directly here but this is probably “enough”

* Split variants by separator at the top-level only

This means that the separator has to be ouside of balanced brackets

* Fix extraction when using custom variant separators

* Support custom separators when top-level splitting variants

* Add a second multi-character separator test

* Split tests for at-rule and at-rule with selector changes

* Add nested at-rule tests

* Fix space-less at-rule parsing in addVariant

* Add test for using with `@apply`

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2022-05-08 12:24:59 -04:00
Adam Wathan
cea3ccf14d Update changelog 2022-05-07 16:05:34 -04:00
James Ross
f0026a45ba
feat: add plus-lighter support for mix-blend-mode (#8288) 2022-05-07 16:04:53 -04:00
Jordan Pittman
67d2286838
Try using local postcss installation first in the CLI (#8270)
* Load local PostCSS package if available

* Update changelog
2022-05-05 10:43:09 -04:00
Jordan Pittman
d676086a75
Rewrite default class extractor (#8204)
* Rewrite default extractor

* Eliminate lookbehind assertions in expand apply at rules

* Update changelog
2022-05-04 16:08:25 -04:00
Adam Wathan
bb0ab6744b
Update CHANGELOG.md 2022-05-04 13:02:02 -04:00
Nestor Vera
220e3501af
Add missing .grid-flow-dense utility (#8193) 2022-05-04 13:01:26 -04:00
depfu[bot]
94c05d50f2
Update jest-diff to version 28.0.2 (#8257)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2022-05-04 13:00:48 -04:00
depfu[bot]
1c2789dd1e
Update jest to version 28.0.3 (#8266)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2022-05-04 11:11:41 +02:00
Jordan Pittman
1402be2dd0
Handle utilities with multiple and/or grouped selectors better (#8262)
* Add failing test cases

* Flatten finalizeSelector code

* Use AST operations to format selector classes

With this change we only parse the selector once and operate on the AST until we need to turn it back into a selector. In addition this lets us solve an issue where .replace(…) did the wrong thing because it doesn’t understand that .base and .base-foo are two different classes

* Remove extraneous, non-matching selectors from utilities

* Update changelog
2022-05-03 13:10:27 -04:00
Jordan Pittman
7c337f24fc
Only check selectors containing apply candidates for circular dependencies (#8222)
* Only check selectors containing base apply candidates for circular dependencies

When given a two rule like `html.dark .a, .b { … }` and `html.dark .c { @apply b }` we would see `.dark` in both the base rule and the rule being applied and consider it a circular dependency. However, the selectors `html.dark .a` and `.b` are considered on their own and is therefore do not introduce a circular dependency.

This better matches the user’s mental model that the selectors are just two definitions sharing the same properties.

* Update changelog
2022-05-02 11:11:21 -04:00
Jordan Pittman
3989f77dd3 Update PostCSS version 2022-05-02 10:32:00 -04:00
Stefan Rumzucker
c3381d90a5
Remove default [hidden] style in preflight (#8248)
* Remove default `[hidden]` style in preflight

* Update snapshots

* Update changelog

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2022-05-02 10:30:06 -04:00
depfu[bot]
85b8e449e9 Update autoprefixer to version 10.4.5 2022-04-30 21:58:22 +00:00
Jordan Pittman
122fb89e6c
Support postcss config options in config file in the CLI (#8226)
* Support config options from postcss CLI

* Update changelog
2022-04-28 15:14:36 -04:00
Brad Cornes
922191450b Update changelog 2022-04-28 11:20:13 +01:00
Brad Cornes
cc696338b1
Improve type detection for arbitrary color values (#8201) 2022-04-28 11:18:51 +01:00
Jordan Pittman
89bf2ed46d
Fix intellisense for plugins with multiple @apply rules (#8213)
* Fix intellisense for plugins with multiple `@apply` rules

Intellisense uses `expandApplyAtRules` directly and doesn’t partition them. When a plugin registers components using something like `”@apply flex”: {}` more than once in the same component intellisense will break. This isn’t a problem for Tailwind CSS proper because we do rule partitioning. Given that Intellisense is using it directly though we shouldn’t outright break in the face of this situation even if the result isn’t 100% accurate (the source maps won’t be correct in this case).

* Update changelog

Co-authored-by: psucoder <hungle.info@gmail.com>
2022-04-27 12:09:20 -04:00
depfu[bot]
38535511dd Update prettier to version 2.6.2 2022-04-27 13:45:52 +00:00
depfu[bot]
2bf5a5ffb8 Update prettier-plugin-tailwindcss to version 0.1.10 2022-04-26 19:43:16 +00:00
Jordan Pittman
e010788574 Simplify apply handling
Pulling from perParentApplies here is unncessary as it’s never going to get any value
2022-04-26 14:27:28 -04:00
Gerard Nesta
1cc1ace142
Fixed date (#8152)
3.0.24 was released on april, not may
2022-04-19 07:46:48 -04:00
depfu[bot]
3d20308a85 Update esbuild to version 0.14.36 2022-04-19 02:28:01 +00:00
depfu[bot]
c0a4980555 Update @swc/cli to version 0.1.57 2022-04-18 12:29:03 +00:00
depfu[bot]
aedfc6c7dd Update eslint to version 8.13.0 2022-04-15 21:45:01 +00:00
Jordan Pittman
67bf8167d1
Allow arbitrary values with commas in @apply (#8125)
* De-indent code

* Allow arbitrary values with commas in `@apply`

* Update changelog
2022-04-15 16:23:30 -04:00
Jordan Pittman
e5ed08b5cb
Handle duplicate atrules without children (#8122)
* Handle duplicate atrules without children

We assumed that all At Rule nodes had children. Including ones that do not and should not — for example `@import url(…);`. Since this is not the case we’ll skip adding children for nodes that don’t have any.

* Update changelog

Co-authored-by: Jordi Marimon Palarea <jordimarimon7@gmail.com>
2022-04-15 12:24:27 -04:00
Jordan Pittman
5c76de72ba
Require matching prefix when detecting negatives (#8121)
* Require matching prefix when detecting negatives

* Update changelog
2022-04-15 11:57:06 -04:00