4185 Commits

Author SHA1 Message Date
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
Robin Malfait
a4d1bdb7fa
Fix angle brackets in content (#5585)
* move to real regexes

These regexes are only calculated once so we don't really have a
performance penalty here. However, it's a bit nicer to do it this way
because now you don't have to think about the proper escapes.

/.*/.source will basically take the source of the regex ".*" without
flags and converts it to a string with the proper escapes for you.

Fun fact, this `.source` property has been supported since Chrome,
Firefox and Safari version 1.

* allow for `'>'` in `content-['>']`
2021-09-24 15:22:23 +02:00
depfu[bot]
77d124368a Update jest-diff to version 27.2.0 2021-09-24 10:13:34 +00:00
Jonathan Reinink
cd3ff42c7e
Fix list item in changelog 2021-09-23 22:23:55 -04:00
Jonathan Reinink
78f0aa4b1b Add file variant to changelog
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-23 16:03:31 -04:00
Luke Warlow
f0ce096d8d
Add variant for ::file-selector-button pseudo element (#4936)
* Add variant for file-selector-button pseudo element

* Rename `file-selector-button` variant to `file`

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

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-23 15:43:37 -04:00
Robin Malfait
a8836eb093
Improve experimental universal selector improvements (#5517)
* add dedicated tests for the experimenal universal selector improvements

* Add failing test

* keep pseudo elements

* re-add logic for special types (class, id, attribute)

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-23 15:05:35 -04:00
Jonathan Reinink
f9ee118c01 Add break utilities to changelog
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-23 14:32:40 -04:00
Jonathan Reinink
744249d631
Add break-before, break-inside and break-after utilities (#5530)
* Add `break-before` utilities

* Add `break-inside` utilities

* Add `break-after` utilities

* Add `break-before/inside/after` utilities to basic usage test

* Remove `break-before` and `break-after` utilities that have no browser support

* Rename `break-inside: avoid-column` utility to `break-inside-avoid-column`
2021-09-23 14:31:23 -04:00
depfu[bot]
f2bc50accf
Update @vercel/ncc to version 0.31.1 (#5547)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2021-09-22 15:52:10 -04:00
Adam Wathan
3d1118f5df Fix svelte test 2021-09-21 12:43:44 -04:00
Adam Wathan
b7d2c8f11e Add test for lit-html syntax 2021-09-21 12:41:58 -04:00
Adam Wathan
a44f58f913 Fix test extension 2021-09-21 12:41:00 -04:00
Adam Wathan
6121cbe22a Remove svelte CSS test file 2021-09-21 12:38:11 -04:00
Adam Wathan
2d9759b604 Rename svelte tests 2021-09-21 12:37:49 -04:00
Robin Malfait
a54521f26a
Fix incorrect import in defaultConfig and defaultTheme (#5527)
We should import from `lib` and not from `src`
2021-09-17 13:16:38 +02:00
depfu[bot]
f4635e0d42 Update prettier to version 2.4.1 2021-09-17 07:35:41 +00:00
Robin Malfait
6c0b7bc8b2
Pattern safelisting (#5511)
* splitup nameClass functionality

We want to separate the logic of the formatting the class and of turning
it into a class with a `.` and escaped values.

* collect base classList

* implement `safelist` where you can use regex patterns
2021-09-16 14:47:41 +02:00
Robin Malfait
14d49a9fd5
Warn when nesting is detected (#5489)
* warn when nesting is detected

* add todo for improving warning messages
2021-09-16 14:13:45 +02:00
Adam Wathan
c64bc1f652
Update README.md 2021-09-14 14:49:09 -04:00
Adam Wathan
ebc1c7a91f Update issue templates 2021-09-14 11:51:35 -04:00
Robin Malfait
516ba530f0
Setup integration tests (#5466)
* setup integration tests

* fix rgb color syntax

* ensure integration tests always exit

If for any reason the integration tests fail, then it will run forever
on CI (~2hours or something). The `--forceExit` is not ideal but it will
prevent long running processes.

* fix incorrect test

We were never properly waiting for the command to finish.

* handle AbortError properly

In CI, when an AbortController gets aborted an error is thrown
(AbortError). If we don't catch it properly then it will "leak" and the
test will fail.

* improve IO functions

* quit integration tests after 10seconds

* only test a few integrations

* test all integrations using matrix

This will cancel other builds when one fails, it will also separate the
output per integration which can be useful especially now that we are
still figuring things out.

* rename `build` to `test`

* add --verbose flag to receive output in the console

* when reading stdout or stderr, wait a certain about to ensure stability

Debouncing for 200ms means that if another message comes in within those
200ms we delay the execution of the callback.

* simplify workflow

* use terminal output instead of disk events

* cache node_modules for integrations

* empty commit, to test cache hits
2021-09-14 16:18:14 +02:00
Adam Wathan
fda1c4403f
Update config.yml 2021-09-13 11:45:01 -04:00
Adam Wathan
e7dbc1a21f
Update config.yml 2021-09-13 11:44:22 -04:00
Adam Wathan
3254e55ec4 Update changelog 2021-09-12 16:40:25 -04:00
Adam Wathan
16a910b0f5 Add arbitrary value support for vertical-align utilities 2021-09-12 16:39:11 -04:00
Adam Wathan
6816ad66a0 Add align-sub and align-super utilities
Co-Authored-By: TCatinaud <5670642+tcatinaud@users.noreply.github.com>
2021-09-12 16:30:45 -04:00
Mattèo Gauthier
df011dc9b4
Added guidelines before running 'npm run test' used to prevent test failure in CONTRIBUTING.md (#4728)
* Added guidelines before running 'npm run test' used to prevent test failure

* Update .github/CONTRIBUTING.md

Co-authored-by: Geshi <ohayo@geshii.moe>

* Update .github/CONTRIBUTING.md

Co-authored-by: Sachin Raja <58836760+sachinraja@users.noreply.github.com>

* Update CONTRIBUTING.md

Co-authored-by: Geshi <ohayo@geshii.moe>
Co-authored-by: Sachin Raja <58836760+sachinraja@users.noreply.github.com>
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-12 16:20:02 -04:00
Adam Wathan
57e504d4cc Update changelog 2021-09-12 16:18:50 -04:00
Adam Wathan
fda68f7138
Add border-hidden utility (#5485)
Co-Authored-By: 藍 <50108258+kwaa@users.noreply.github.com>

Co-authored-by: 藍 <50108258+kwaa@users.noreply.github.com>
2021-09-12 16:18:17 -04:00
Adam Wathan
b16eb2034e
Add arbitrary value support for transition-property (#5481)
Co-Authored-By: Eric F. <2483476+ericbf@users.noreply.github.com>

Co-authored-by: Eric F. <2483476+ericbf@users.noreply.github.com>
2021-09-12 10:07:57 -04:00