4293 Commits

Author SHA1 Message Date
Robin Malfait
ef325ea35b
Add tuple syntax to guarantee screens order (#6104)
* add normalizeScreens function

This will allow us to normalize the various kinds of inputs to a stable
version that is consistent regardless of the input.

* use normalized screens

* add dedicated test for new tuple syntax

* make test consistent with other tests

While working on the normalizeScreens feature, some tests started
failing (the one with multiple screens), while looking at them I made
them consistent with the rest of the codebase.

* add test to ensure consistent order in screens output

* update changelog

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-11-16 18:01:06 +01:00
Robin Malfait
6c4b86d438
Add placeholder variant (#6106)
* add `placeholder` variant

* update changelog
2021-11-16 15:33:30 +01:00
depfu[bot]
85320c25f2 Update eslint to version 8.2.0 2021-11-12 23:59:16 +00:00
Robin Malfait
a3579bcf2f
Enforce the order of pseudo elements (#6018)
* enforce the order of some variants

* update changelog

* use better algorithm
2021-11-12 16:38:03 +01:00
Robin Malfait
4e21639903
Improve nesting detection (#6011) 2021-11-10 13:15:32 +01:00
depfu[bot]
4860957148 Update cssnano to version 5.0.10 2021-11-09 12:58:46 +00:00
Robin Malfait
ac5a20420e
make version number dynamic in the test (#6017) 2021-11-08 21:30:37 +01:00
Adam Wathan
6057342593 3.0.0-alpha.2 v3.0.0-alpha.2 2021-11-08 11:49:18 -05:00
Adam Wathan
df7e71c262 Update changelog 2021-11-08 11:48:34 -05:00
depfu[bot]
028daf3ea4 Update esbuild to version 0.13.12 2021-11-07 04:43:59 +00:00
Adam Wathan
a6bcd22722 Add test for using variants with multi-class selectors 2021-11-06 07:25:32 -04:00
Robin Malfait
7eabb74bec
add test to prove @supports is kept in @layer rule (#5992) 2021-11-05 15:12:35 +01:00
Adam Wathan
79e3e098d2 Update changelog 2021-11-04 13:28:48 -04:00
Adam Wathan
d41a739186 Update changelog 2021-11-04 10:16:46 -04:00
Adam Wathan
d1f066d97a
Add support for colored box shadows (#5979)
* WIP

* add box shadow parser

* use box shadow parser

* Update default shadows, add boxShadowColor key, add shadow datatype

* Update tests

* add `valid` flag to `boxShadow` parser

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-11-04 10:14:13 -04:00
depfu[bot]
c25fbc773b Update autoprefixer to version 10.4.0 2021-11-04 10:58:52 +00:00
depfu[bot]
f70175d30a Update @swc/core to version 1.2.106 2021-11-04 02:43:54 +00:00
Adam Wathan
12aa51d61d Update changelog 2021-11-03 10:53:12 -04:00
Adam Wathan
f9fb2cec12
Add full color palette for fill/stroke (#5933)
Historically we've only included `fill-current` and `stroke-current` due to file size considerations, and recommended combining them with text color utilities like this:

```html
<svg class="fill-current text-blue-500">
```

With the JIT engine, there's no real reason for this anymore, so this PR enables all colors by default, allowing you to write this out of the box instead:

```html
<svg class="fill-blue-500">
```

Giddy up.
2021-11-03 10:51:57 -04:00
Robin Malfait
ec1f7b0349
update changelog 2021-10-29 13:43:17 +02:00
Robin Malfait
d6301bd31b
update changelog 2021-10-29 12:19:42 +02:00
Robin Malfait
a82cb7baa0
bump due to security vulnerabilities (#5924) 2021-10-29 11:24:33 +02:00
depfu[bot]
ba2fd32b79 Update postcss to version 8.3.11 2021-10-28 13:14:12 +00:00
depfu[bot]
d563d23a56 Update jest to version 27.3.1 2021-10-27 14:29:30 +00:00
Jonathan Reinink
bf59a88c3e
Add new outline style, color, width and offset utilities (#5887)
* Add new outline style, color, width and offset utilities

Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

* Remove old `outline` property from default config

Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

* Tweak order of outline plugins

Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

* Revert to previous `outline-none` styles

Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

* Drop quotes from outline property

* Add offset back to `outline-none` utility

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-10-27 10:21:24 -04:00
Jonathan Reinink
06cb28d2bd
Add print variant (#5885)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-10-27 10:21:02 -04:00
Robin Malfait
fd9dbe18ac
Allow the use of @media print without parens (#5898) 2021-10-27 15:04:37 +02:00
Robin Malfait
5058275f3b
Handle color transformations properly with theme(...) for all relevant plugins (#5871)
* call function for colors that are not in colors

* add all color related thingies

* transformThemeValue in a very verbose way

* handle functions by default

* cleanup, make sure we handle functions everywhere

* update changelog

Co-authored-by: Bill Criswell <bill_criswell@comcast.com>
2021-10-25 12:17:14 +02:00
Robin Malfait
1218b3ee7e
Ensure @apply of a utility with multiple definitions works (#5870) 2021-10-25 11:35:12 +02:00
Dany Castillo
de1bdb4f5d
Fix debug mode being active although explicitly disabled (#5837)
* fix debug mode being active although explicitly disabled

* also set debug mode correctly in sharedState
2021-10-25 11:25:25 +02:00
depfu[bot]
68f18bfa64 Update autoprefixer to version 10.3.7 2021-10-24 08:14:13 +00:00
Robin Malfait
ee3f3fd0be
Ensure comments in @layer rules don't crash (#5854)
* ensure comments in @layer rules don't crash

* update changelog
2021-10-22 15:19:21 +02:00
Robin Malfait
0ab39c312a
Allow _ inside url() when using arbitrary values (#5853)
* allow for underscores in url()

* update changelog
2021-10-22 14:43:46 +02:00
depfu[bot]
ae0e83dad0
Update eslint to version 8.0.1 (#5807)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2021-10-22 06:40:36 -04:00
Robin Malfait
ea6f14a499
Dedupe duplicate properties (#5830)
* add `collapseDuplicateDeclarations`

This will allow us to remove duplicate declarations. This occurs when
you are using `@apply` for example.

The reason I implemented it as a separate step, is because this doesn't
only happen for `@apply`, but it also happens if you do something like:

```js
addComponents({ '.btn-blue, .btm-red': { padding: '10px' } })
```

So instead of tracking down every place this is happening, it now
happens at the very end.

* use new plugin in processTailwindFeatures

* add/update tests by removing duplicate declarations

* update changelog
2021-10-21 11:54:23 +02:00
Robin Malfait
0c2f1a6472
Remove prefix as a function (#5829)
* mark `prefix` as a function as a breaking change

* remove `prefix` as a function related code

* remove `prefix` as a function related tests

* update changelog
2021-10-19 15:22:49 +02:00
Robin Malfait
36c880abab
Improve before and after variants (#5820)
* remove unused `withRule`

* ensure all ::before and ::after elements have content

* update --tw-content for the content plugin

* simplify `before` and `after` variants

* update tests, to reflect changes

* make new `format` and `wrap` API's private for now

* allow returning a format string from `addVariant` callback

* add `content: var(--tw-content)` for before/after variants

* update tests to add `content: var(--tw-content)`

* update changelog
2021-10-18 18:11:34 +02:00
Robin Malfait
f12c0e1fa5
Improve css expectations in tests (#5819)
* use String.raw for css escapes

This will allow us to write code like:
```css
.mobile\:font-bold {}
```
Instead of
```css
.mobile\\:font-bold {}
```

Which resembles "real" css way better in our tests.

* use String.raw in integration tests as well
2021-10-18 12:08:48 +02:00
Robin Malfait
5809c4d07c
Improve addVariant API (#5809)
* fix incorrect comment

Probably messed this up in another PR, so just a bit of cleaning.

* implement a formatVariantSelector function

This will be used to eventually simplify the addVariant API.

The idea is that it can take a list of strings that define a certain
format. Then it squashes everything to a single format how you would
expect it.

E.g.:

Input:
  - '&:hover'
  - '&:focus'
  - '.dark &'
  - ':merge(.group):hover &'
  - ':merge(.group):focus &'
Output:
  - ':merge(.group):focus:hover .dark &:focus:hover'

The API here is:
  - `&`, this means "The parent" or "The previous selector" (you can
    think of it like if you are using nested selectors)
  - `:merge(.group)`, this means insert a `.group` if it doesn't exist
    yet, but if it does exist already, then merge the new value with the
    old value. This allows us to merge group-focus, group-hover into a
    single `.group:focus:hover ...`

* add new `format`, `withRule` and `wrap` API for addVariant

* implement backwards compatibility

This will ensure that the backwards compatibility for `modifySelectors`
and direct mutations to the `container` will still work.

We will try to capture the changes made to the `rule.selector`, we will
also "backup" the existing selector. This allows us to diff the old and
new selectors and determine what actually happened.

Once we know this, we can restore the selector to the "old" selector and
add the diffed string e.g.: `.foo &`, to the `collectedFormats` as if
you called `format()` directly. This is a bunch of extra work, but it
allows us to be backwards compatible.

In the future we could also warn if you are using `modifySelectors`, but
it is going to be a little bit tricky, because usually that's
implemented by plugin authors and therefore you don't have direct
control over this. Maybe we can figure out the plugin this is used in
and change the warning somehow?

* fix incorrect test

This was clearly a bug, keyframes should not include escaped variants at
all. The reason this is here in the first place is because the nodes in
a keyframe are also "rule" nodes.

* swap the order of pseudo states

The current implementation had a strange side effect, that resulted in
incorrect class definitions. When you are combining the `:hover` and
`:focus` event, then there is no difference between `:hover:focus` and
`:focus:hover`.

However, when you use `:hover::file-selector-button` or `::file-selector-button:hover`,
then there is a big difference. In the first place, you can hover over the full file input
to apply changes to the `File selector button`.
In the second scenario you have to hover over the `File selector button` itself to apply changes.

You can think of it as function calls:
- focus(hover(text-center))

What you would expect is something like this:
`.focus\:hover\:text-center:hover:focus`, where `hover` is on the
inside, and `focus` is on the outside. However in the current
implementation this is implemented as
`.focus\:hover\:text-cener:focus:hover`

* add more variant tests for the new API

* update parallel variants tests to make use of new API

* implement core variants with new API

* simplify/cleanup existing plugin utils

We can get rid of this because we drastically simplified the new
addVariant API.

* add addVariant shorthand signature

The current API looks like this:

```js
addVariant('name', ({ format, wrap }) => {
  // Wrap in an atRule
  wrap(postcss.atRule({ name: 'media', params: '(prefers-reduced-motion: reduce)' }))

  // "Mutate" the selector, for example prepend `.dark`
  format('.dark &')
})
```

It is also pretty common to have this:
```js
addVariant('name', ({ format }) => format('.dark &'))
```
So we simplified this to:
```js
addVariant('name', '.dark &')
```

It is also pretty common to have this:
```js
addVariant('name', ({ wrap }) => wrap(postcss.atRule({ name: 'media', params: '(prefers-reduced-motion: reduce)' })))
```
So we simplified this to:
```js
addVariant('name', '@media (prefers-reduced-motion: reduce)')
```

* improve fontVariantNumeric implementation

We will use `@defaults`, so that only the resets are injected for the
utilities we actually use.

* fix typo

* allow for nested addVariant shorthand

This will allow to write something like:

```js
addVariant('name', `
  @supports (hover: hover) {
    @media (print) {
      &:hover
    }
  }
`)
// Or as a one-liner
addVariant('name', '@supports (hover: hover) { @media (print) { &:hover } }')
```

* update changelog
2021-10-18 11:26:11 +02:00
Sachin Raja
aeaa2a376b
update build script name in CONTRIBUTING.md (#5814) 2021-10-17 10:09:28 -04:00
depfu[bot]
2bef641909 Update @swc/cli to version 0.1.51 2021-10-16 10:58:31 +00:00
depfu[bot]
c4c10d55d4 Update jest-diff to version 27.2.5 2021-10-15 14:14:00 +00:00
Brad Cornes
be36eba7cf Update changelog 2021-10-13 20:06:47 +01:00
Brad Cornes
84a6c5d096
Neaten extract.DEFAULT resolution (#5778) 2021-10-13 19:58:58 +01:00
Brad Cornes
92df04d0c3
Fix CLI --content option (#5775)
* Add failing test

* Fix CLI `--content` option
2021-10-13 19:58:15 +01:00
Adam Wathan
1a08732382 Update changelog 2021-10-13 10:06:12 -04:00
Brad Cornes
f599430d56
Configure awaitWriteFinish for chokidar (#5774)
* Configure `awaitWriteFinish` for chokidar

* Enable `awaitWriteFinish` on Windows only
2021-10-13 12:59:26 +01:00
Adam Wathan
a7c89c8813
Don't use pointer cursor on disabled buttons by default (#5772) 2021-10-13 06:11:28 -04:00
Adam Wathan
25c8223d60 Update changelog 2021-10-12 13:36:44 -04:00
MichaelAllenWarner
8259dfdf48
Add text-decoration-color utilities (#5760)
* utilities and tests in place for textDecorationColor and textDecorationOpacity

* change 'backgroundColor' to 'textDecorationColor' in corePlugin declaration for latter

* remove explicit textDecorationOpacity utility (the JIT slash syntax suffices)

Co-authored-by: Michael Warner <michaelwarner@Michaels-MacBook-Pro.local>
2021-10-12 13:35:59 -04:00