15 Commits

Author SHA1 Message Date
Adam Wathan
d2b53cd3af
Add grow and shrink aliases (#5733)
This adds `grow-*` and `shrink-*` utilities as aliases for `flex-grow-*` and `flex-shrink-*` since those names are unnecessarily verbose. We will stop documenting the long form ones and consider them deprecated.

```diff
- <div class="flex-grow-0 flex-shrink">
+ <div class="grow-0 shrink">
```
2021-10-09 09:48:12 -04:00
Robin Malfait
b661614265
Enable optimize universal defaults by default (#5635)
* enabled `optimizeUniversalDefaults` by default

This PR is done in a way so that the default is set to `true`, but you
can still disable it if it causes issues. In this case we do appreciate
an issue in that case 😅.

* update tests to use optimized universal selector

* update integration tests

* add dedicated tests for the optimized universal selector

* improve minimumImpactSelector algorithm

I think I cracked the algorithm, but I will probably need another pair
of eyes on the subject.

The current implementation works like this:

Prerequisites:

- The selector should already have been parsed using the selectorParser
  from 'postcss-selector-parser'.

Algorithm:

1. Remove all of the pseudo classes from the list of nodes.
  1.1. We do want to keep pseudo elements (E.g.: `::before`, `::first-line`, ...)
  1.2. We do want to keep pseudo classes that contain nodes (E.g.:
    `:not(...)`)
2. Reverse the list of nodes.
  This will make it easier to search from the end to the start. For
  example `.group:hover .group-hover` should result in `.group-hover`
  not `.group`.
  2.1. Find the index of the best match (class, id, attribute), and
    convert the node if required. (E.g.: `span#app` -> `#app` => `[id="app"]`)
  2.2. Remove the rest of the selector that is not important anymore
  2.3. Re-join the left-over nodes together

* update tests using new algorithm

* also look for `tag` types

* take `tag` into account

* simplify logic

* add test to prove `rest.reverse()` in first case is required

In case we don't find a match (idx === -1), we use `rest.reverse()`.
However, it looks like you can just use `nodes` instead.
This is not entirely true, because the `rest` variable will contain only
the nodes that are not pseudo elements.

`*:hover` would result in `*:hover` instead of just `*`

* replace all nodes after > with a single universal selector
2021-10-06 17:45:26 +02:00
Adam Wathan
a2676b0544
Add flex-basis utilities (#5671) 2021-10-04 15:47:14 -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
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
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
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
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
Brad Cornes
4919cbfbb8
Update color parsing and formatting (#5442)
* Replace `culori` with simple color parser

* Use space-separated color syntax

* Update default color values to use space-separated syntax

* Update separator regex

* Fix tests

* add tests for the new `color` util

Also slightly modified the `color` util itself to take `transparent`
into account and also format every value as a string for consistency.

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-09-09 16:15:53 +02:00
Jonathan Reinink
12fa78b9ca
Add column utilities (#5457)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-Authored-By: Cody <codytooker@gmail.com>
2021-09-09 09:29:44 -04:00
Jonathan Reinink
1c10cf261b
Add text-indent utilities (#5449)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-08 15:16:46 -04:00
Jonathan Reinink
b04dab6be6
Add will-change utilities (#5448)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-08 14:50:31 -04:00
Luke Warlow
51f71af62c
Add accent-color utilities (#5387)
* Add accent-color utilities

* Address comments
2021-09-07 21:07:54 -04:00
Adam Wathan
db8b449a67
Enable extended color palette (#5384)
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-06 14:29:03 -04:00
Robin Malfait
e37931ba65
JIT by default - move tests and make them consistent (#5374)
* move `./tests/jit` to `./tests`

* make tests consistent

Abstracted a `run` function and some syntax highlighting helpers for
`html`, `css` and `javascript`.
2021-09-03 13:48:16 +02:00