4365 Commits

Author SHA1 Message Date
Robin Malfait
c42ffc10a1
update integration tests for alpha version 2021-10-01 18:56:47 +02:00
Jonathan Reinink
95831fd2f8 Update changelog 2021-10-01 12:50:05 -04:00
Adam Wathan
ac98ff4753 3.0.0-alpha.1 v3.0.0-alpha.1 2021-10-01 11:56:49 -04:00
Adam Wathan
3eb4079d95
Update release.yml 2021-10-01 11:54:43 -04:00
Jonathan Reinink
b8cda161dd
Improve warnings (#5666) 2021-10-01 11:47:02 -04:00
depfu[bot]
55cf56476e Update autoprefixer to version 10.3.6 2021-10-01 15:42:56 +00:00
Robin Malfait
bd21bef99a
Polish match APIs (#5664)
* fix incorrect logic for validating content paths

* remove `includeRules` helper

* generate keyframes as part of the animate plugin

* add matchUtilities

* splitup `variantPlugins` and `corePlugins`
2021-10-01 17:31:09 +02:00
Robin Malfait
d94541cbf3
Handle old to new config when normalizing the config (#5658)
* immediately take the `safelist` values into account

Currently we had to manually add them in the `setupTrackingContext`,
`setupWatchingContext` and the `cli`.

This was a bit cumbersome, because the `safelist` function (to resolve
regex patterns) was implemented on the context. This means that we had
to do something like this:

```js
let changedContent = []
let context = createContext(config, changedContent)
for (let content of context.safelist()) {
  changedContent.push(content)
}
```

This just feels wrong in general, so now it is handled internally for
you which means that we can't mess it up anymore in those 3 spots.

* drop the dot from the extension

Our transformers and extractors are implemented for `html` for example.
However the `path.extname()` returns `.html`.

This isn't an issue by default, but it could be for with custom
extractors / transformers.

* normalize the configuration

* make shared cache local per extractor

* ensure we always have an `extension`

Defaults to `html`

* splitup custom-extractors test

* update old config structure to new structure

* ensure we validate the "old" structure, and warn if invalid

* add tests with "old" config, to ensure it keeps working

* add missing `content` object

* inline unnecessary function abstraction
2021-10-01 12:56:54 +02:00
Jonathan Reinink
109c1c563d Change color warning key 2021-10-01 06:44:05 -04:00
Brad Cornes
ba9d177891
Rename completions and remove color information (#5662) 2021-10-01 09:41:27 +01:00
Jonathan Reinink
84db333d46 Add warning about RTL features being in preview
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-30 21:18:31 -04:00
Jonathan Reinink
cd5cb00266
Implement one-time logging to prevent duplicate warnings (#5661)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-30 21:16:01 -04:00
Adam Wathan
61f881fca1 Remove darkMode from simpleConfig 2021-09-30 15:26:13 -04:00
Adam Wathan
601bc5fc43 Standardize default config to use unified callback argument syntax 2021-09-30 15:25:54 -04:00
Robin Malfait
11bfa0a9bd
Detect ambiguity in arbitrary values (#5634)
* detect ambiguity in arbitrary values

* update warning message
2021-09-30 12:39:41 +02:00
hardfist
ef9187566b
fix: improve negative proformance (#5652) (#5652) 2021-09-30 03:42:49 -04:00
Robin Malfait
39ccd06141
Fix fallback argument in CLI (#5646)
I don't know exactly what happened here, but it seems like I screwed
this trivial fallback up in a spectacular way... anyway, here to fix it!
2021-09-29 23:33:43 +02:00
Jonathan Reinink
71be5a10e9 Update changelog
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-29 10:32:46 -04:00
Jonathan Reinink
ca1dfd6313
Add border-x-{width}, border-y-{width}, border-x-{color} and border-y-{color} utilities (#5639)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-Authored-By: Davy <davy@prepr.io>
2021-09-29 10:32:31 -04:00
Jonathan Reinink
2c73dbcfa3 Update changelog
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-29 09:58:05 -04:00
Jonathan Reinink
753d3f146c
Add scroll-snap utilities (#5637)
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Peter Jonsson <4572231+95jonpet@users.noreply.github.com>
Co-authored-by: Enzo Innocenzi <enzo@innocenzi.dev>
2021-09-29 09:57:26 -04:00
Brad Cornes
484acb3f6b
Fix using backslashes in content globs (#5628)
* Normalize content globs

* Update changelog
2021-09-29 14:13:10 +01:00
Brad Cornes
0b23d2e1d2
Fix using negated content globs (#5625)
* Fix negated content patterns

* Update changelog
2021-09-29 11:15:31 +01:00
depfu[bot]
c5c644f315 Update postcss to version 8.3.8 2021-09-29 06:13:44 +00:00
Jonathan Reinink
4a2f9fb6d8 Update changelog 2021-09-28 14:18:31 -04:00
Jonathan Reinink
77307f5211
Resolve overflow-clip naming collision issue (#5630)
* Rename `overflow-clip` to `text-clip`, add `text-ellipsis`, deprecate `overflow-ellipsis`

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

* Add `overflow-clip` utilities

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

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-28 14:17:41 -04:00
Brad Cornes
2fb33ee578
Update package version import to allow for tree-shaking (#5629) 2021-09-28 17:09:16 +01:00
Jonathan Reinink
8004917618
Add [open] variant (#5627)
* Add `[open]` variant

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

* Add new `applyStateToMarker()` function

This function replaces the existing `applyPseudoToMarker()` and `applyAttributeToMarker()` functions.

Co-Authored-By: Robin Malfait <1834413+RobinMalfait@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Sean Doyle <2575027+seanpdoyle@users.noreply.github.com>
Co-authored-by: Robin Malfait <1834413+RobinMalfait@users.noreply.github.com>
2021-09-28 11:13:58 -04:00
Robin Malfait
c30a32e430
Drop unused tailwindDirectives argument (#5624) 2021-09-28 12:00:27 +02:00
Robin Malfait
5d6d84fda1
Ensure full node stays, if only a partial is used (#5617) 2021-09-28 11:54:39 +02:00
Adam Wathan
6c0b8e8f0f
Support arbitrary color with opacity modifier (#4723) 2021-09-26 11:45:13 -04:00
Adam Wathan
635d0d882e Update changelog 2021-09-26 10:10:36 -04:00
Adam Wathan
2b53b82f62 Update CHANGELOG.md 2021-09-26 10:10:06 -04:00
Adam Wathan
4efc5971f7
Add inherit to color palette (#5597)
Re-implementation of #2706.

Co-Authored-By: Jorge González <yo@jorgeglz.io>

Co-authored-by: Jorge González <yo@jorgeglz.io>
2021-09-26 10:09:43 -04:00
Adam Wathan
e602a3dca7
Add touch-action utilities (#5603)
Co-Authored-By: Mattèo Gauthier <matteo.gauthier@gmail.com>

Co-authored-by: Mattèo Gauthier <matteo.gauthier@gmail.com>
2021-09-26 09:41:36 -04:00
Adam Wathan
2959b83f71 Update changelog 2021-09-26 07:57:28 -04:00
Robin Malfait
4cb1de0f01
ensure we don't override the name (#5602)
Keep track of unknown values (like css variables) in an unknown section.
Currently we only need to know the name, so this will be good enough for now.
2021-09-26 07:44:41 -04:00
Robin Malfait
c03f9ad600
Improve public API (#5526)
* introduce `public` folder

This can contain all of the `public` functions we want to expose.
This will be a bit nicer for example when you want to use
internal/private functions (we use some in the vscode intellisense
plugin).

* use public `resolveConfig` function

* expose resolveConfig in the root

This will use the resolveConfig we expose from the `public` folder. We
can probably generate these as well.

* make `colors` public

* make `default config` public

* make `default theme` public

* make `create plugin` public

* update to public paths

* remove `@tailwindcss/aspect-ratio` from tests

This should be tested in its own repo instead.

* remove `@tailwindcss/aspect-ratio` as a dependency

* drop `Build` step from CI

The build step is not a prerequisite anymore for running the tests. When
we want to release a new (insiders) release, the `prepublishOnly` step
will be executed for us.

Before this change, it would have been executed twice:
- Once before the tests
- Once before the actual release

* improve paths for caching purposes

* add pretest scrip for generating the plugin list

Now that we can use `SWC`, automatically generating the plugin list
before running the tests is super fast and you don't even have to think
about it anymore!
2021-09-26 12:44:13 +02:00
Robin Malfait
c3906b459b
Expose completions API (#5520) 2021-09-26 12:01:07 +02:00
Sachin Raja
00b6ed0a74
bundle cli peer dependencies with esbuild (#5595) 2021-09-24 21:57:17 -04:00
Adam Wathan
ed61821e42
Properly optimize universal defaults for legacy pseudo-element syntax (#5594) 2021-09-24 14:27:42 -04:00
Adam Wathan
991a5989a0 Update CLI test 2021-09-24 14:15:48 -04:00
Adam Wathan
987ea2ab32 Update package-lock.json 2021-09-24 14:07:02 -04:00
Adam Wathan
790b2b7ba0 Update version in package.json 2021-09-24 13:45:02 -04:00
Robin Malfait
164c3d6b50
Switch to swc from babel (#5593)
* refactor: switch to swc from babel

* bump to latest versions of swc

Co-authored-by: Sachin Raja <sachinraja2349@gmail.com>
2021-09-24 19:17:19 +02:00
Robin Malfait
c1a156639e
Restructure core plugins, named exports to default export (#5592)
* use export default instead of named exports

I'm a little sad about this change, but it turns out that the order is
not guaranteed for named exports in ESM. It was the correct order in our
tests because of babel, but not in native ESM.

* update imports
2021-09-24 18:57:01 +02:00
Robin Malfait
1ec5438448
Improve arbitrary value support (#5568)
* simplify `inset` plugin

* run `prettier` on stub file

* simplify `align` utility

* improve arbitrary support for outline

This will allow us to use `outline-[OUTLINE,OPTIONAL_OFFSET]`

Input:
```html
outline-[2px_solid_black]
```

Output:
```css
.outline-\[2px_solid_black\] {
  outline: 2px solid black;
  outline-offset: 0;
}
```

---

Input:
```html
outline-[2px_solid_black,2px]
```

Output:
```css
.outline-\[2px_solid_black\2c 2px\] {
  outline: 2px solid black;
  outline-offset: 2px;
}
```

* remove default `type`

* simplify createUtilityPlugin, use types directly

* find first matching type when coercing the value

* introduce css data types

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types

These data types will be used to "guess" the type of an arbitrary value
if there is some ambiguity going on. For example:

```
bg-[#0088cc]      -> This is a `color`  -> `background-color`
bg-[url('...')]   -> This is a `url`    -> `background-image`
```

If you are using css variables, then there is no way of knowing which
type it is referring to, in that case you can be explicit:

```
bg-[color:var(--value)]   -> This is a `color`  -> `background-color`
bg-[url:var(--value)]     -> This is a `url`    -> `background-image`
```

When you explicitly pass a data type, then we bypass the type system and
assume you are right. This is nice in a way because now we don't have to
run all of the guessing type code. On the other hand, you can introduce
runtime issues that we are not able to detect:

```
:root {
  --value: 12px;
}

/* Later... */
bg-[color:var(--value)] -> Assumes `color` -> *eventually* -> `background-color: 12px`
```

* add a bunch of new tests for advanced arbitrary values
2021-09-24 18:45:42 +02:00
Robin Malfait
ab17c6c427
Handle unknown typehints (#5588)
If you use a typehint like `w-[length:12px]`, then currently that
wouldn't generate anything because we don't have a matchUtilities for
`w` with a `length` type. To fix this, we can detect if this is
unnecessary, if it is we still generate the expected outcome. (In this
case `width: 12px`) but we also warn to the user that we detected this.

Currently we detect this by checking if there is only a single plugin
registered for handling the prefix (e.g.: `w-`). We can probably improve
this by also checking all the types that all plugins are handling for
the resolved plugins.
2021-09-24 18:28:08 +02:00
Robin Malfait
79b37a874c
Ensure invalid typehints are not generated (#5590) 2021-09-24 18:18:48 +02:00
Robin Malfait
abcd9acd18
Support URL in arbitrary values (#5587)
* add url to resolveArbitraryValue list

* add `asURL` data type

* add `bg-[url('..')]` regex

* allow for `resolveArbitraryValue` to be an array

* prevent spaces around `-` when in a `url`

* add tests to verify `bg-[url('...')]` and `stroke-[url(...)]`
2021-09-24 16:13:16 +02:00