4662 Commits

Author SHA1 Message Date
Jordan Pittman
64b4e6df7b
Replace rgb and hsl helpers with <alpha-value> placeholder for colors with custom properties (#8501)
* implement <alpha-value>

* remove `rgb`/`hsl` helpers, use `<alpha-value>` instead

* never pass undefined to `withAlphaValue`

* WIP

* WIP

* WIP

* WIP

* Update changelog

* Cleanup

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-06-02 10:21:20 -04:00
depfu[bot]
1f74568352 Update @swc/core to version 1.2.196 2022-06-01 21:28:44 +00:00
Adam Wathan
c65a1a2a79
Don't inherit gradient "to" from parent (#8489)
* Don't inherit gradient "to" from parent

* Update changelog
2022-06-01 15:25:45 -04:00
Adam Wathan
fca70850b2
Add optional variant (#8486)
* Add  variant

* Update changelog
2022-06-01 08:39:43 -04:00
Adam Wathan
1bde724d14 Move items in changelog 2022-06-01 06:20:19 -04:00
Adam Wathan
2b944c5b10 Skip tests ending in .test.skip.js 2022-06-01 06:16:39 -04:00
Adam Wathan
5398d57b1a Update changelog 2022-06-01 06:02:59 -04:00
Adam Wathan
a11e0c63be Disable variantGrouping experiment 2022-06-01 06:02:15 -04:00
Jordan Pittman
0744954802 Update changelog 2022-05-31 13:16:36 -04:00
Jordan Pittman
34fd0fb82a Feature flag matchVariant API 2022-05-31 13:15:14 -04:00
Robin Malfait
d2fdf9eb09
Allow returning parallel variants from addVariant or matchVariant callback functions (#8455)
* allow to return an array of format strings from matchVariant or
addVariant

* add parallel variant with function test

* upgrade test to use a function call

* allow to return parallel variants from variant function

Caveat: this now belongs to the same plugin and is not registered as
separate variants which means that sort order can differ.

* prevent crash if `.toMatchFormattedCss()` receives undefined

* update changelog

* ensure that we use a local list of variant functions

Now that a variant function can return a list of variant functions from
within the plugin, we have to make sure to executed and register those
functions as well.

However, we need to make sure that this list is local for the variant
and not "globally" registered otherwise we keep add a dynamic function
to the global list which results in duplicate output becaus multiple
duplicate variants will be registered.

* add little warning regarding potential clashes

* Update CHANGELOG.md
2022-05-31 15:03:06 +02:00
Adam Wathan
2dffc87447 Move stuff in changelog 2022-05-30 16:18:05 -04:00
depfu[bot]
62e3514233 Update postcss to version 8.4.14 2022-05-28 16:49:42 +00:00
Jordan Pittman
ac8fbc680e Update changelog 2022-05-27 10:02:03 -04:00
Jordan Pittman
3f4005e833 Disable filterDefault for ring opacity when using respectDefaultRingColorOpacity 2022-05-27 09:59:52 -04:00
Jordan Pittman
cab1fcecc5
Add future flag to preserve custom, default ring color opacity (#8448)
* Add future flag to preserve ring color opacity

* Update changelog
2022-05-27 09:48:27 -04:00
depfu[bot]
029540893d Update jest to version 28.1.0 2022-05-27 12:30:06 +00:00
Jordan Pittman
c4e443acc0
Add postcss-import support to the CLI (#8437)
* Add postcss-import support to the CLI

* Update changelog
2022-05-25 14:28:52 -04:00
Jordan Pittman
50bed74cdc
Support alpha values for theme() function (#8416)
* Fix typo

* Support alpha modifier for theme color values

* Eliminate redundant object creation in resolveFunctionKeys

Building an object of N keys incrementally using Object.reduce + splat results in N intermediate objects. We should just create one object and assign each key.

* Switch to inline theme values in theme fn in config

* Add test case

And fix typos that were definitely not there

* Update changelog
2022-05-25 13:54:30 -04:00
Brad Cornes
22f9dc8895
Use single-line syntax for private types comments (#8420)
This prevents the comments from appearing in editors
2022-05-25 10:49:20 +01:00
depfu[bot]
33dff03743 Update jest-diff to version 28.1.0 2022-05-25 07:58:17 +00:00
Brad Cornes
c3cf064ae5
Improve theme.extend types (#8419) 2022-05-24 13:26:26 +01:00
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