42 Commits

Author SHA1 Message Date
Bogdan Chadkin
2dec5649c9
Replace chalk with picocolors (#6039)
* Replace chalk with picocolors

Already used in latest postcss, autoprefixer and browserslist versions.

See https://github.com/alexeyraspopov/picocolors

* Update `dim` function

Co-authored-by: Brad Cornes <bradlc41@gmail.com>
2022-02-24 16:37:31 +00:00
Jordan Pittman
f2d73b8c3d
Change how we handle defaults (optimized or not) (#6926)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2022-01-07 11:39:45 -05:00
Robin Malfait
860c61cd61
temporarily disable optimize universal defaults (#6461)
* temporarily disable optimize universal defaults

* update changelog
2021-12-13 15:39:18 +01: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
Jonathan Reinink
b8cda161dd
Improve warnings (#5666) 2021-10-01 11:47:02 -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
Robin Malfait
a34bd62bb6
Remove lodash (#5390)
* remove `lodash` usage

* implement custom cloneDeep to replace lodash's

* drop lodash in processPlugins

* add `toPath` utility

* add `tap` utility

* add `cloneDeep` utility

* drop lodash in evaluateTailwindFunctions

* add `defaults` utility

* drop lodash from `resolveConfig`

* remove `lodash` dependency
2021-09-06 14:15:10 -04:00
Adam Wathan
a9e160cf9a Reintroduce universal selector optimization behind experimental flag 2021-09-06 13:58:02 -04:00
Adam Wathan
b6598e9898 Remove additionalBreakpoint from flags 2020-10-19 16:47:10 -04:00
Adam Wathan
322d366440 Extend font size scale 2020-10-18 15:43:50 -04:00
Adam Wathan
dc9d510c8a Extend spacing scale
By probably too much.
2020-10-18 15:43:50 -04:00
Adam Wathan
9a8c170223 Remove uniformColorPalette experiment 2020-10-18 15:43:50 -04:00
Adam Wathan
7376d7c8b1 Enable dark mode 2020-10-18 15:43:50 -04:00
Adam Wathan
782a828c81 Switch to new apply implementation 2020-10-18 15:43:50 -04:00
Adam Wathan
998f3ffc03 Move truncate to textOverflow plugin 2020-10-18 15:43:50 -04:00
Adam Wathan
1371e7951e Use standard font weight names by default 2020-10-18 15:43:50 -04:00
Adam Wathan
7d102598f9 Add line-heights to font-size utilities by default 2020-10-18 15:43:50 -04:00
Adam Wathan
b008d0c08a Remove 'conservative' purge mode 2020-10-18 15:43:50 -04:00
Adam Wathan
4959a99f77 Remove deprecated gap utilities 2020-10-18 15:43:50 -04:00
Adam Wathan
38b4eeb288 Prettier likes parens a lot now
git blame is now broken forever.
2020-10-16 15:39:44 -04:00
Adam Wathan
6927155956 Don't warn about future flags 2020-10-16 14:53:27 -04:00
Adam Wathan
ae8b634f33
Move truncate to textOverflow (#2562)
* Move truncate to textOverflow

* Update changelog
2020-10-14 16:54:13 -04:00
Adam Wathan
1067ccee10 Promote defaultLineHeights and standardFontWeights from experimental to future 2020-10-07 14:12:42 -04:00
Adam Wathan
d01636caff Add experimental 2xl breakpoint (#2468) 2020-10-07 14:12:42 -04:00
Adam Wathan
cfd86836c5 Make standardFontWeights experimental until v1.9, update changelog 2020-09-06 20:43:36 -04:00
Adam Wathan
30a4e513ef
Rename hairline and thin font weights to thin and extralight (#2333)
* Add standardFontWeights flag for update thin/extralight font weight names

* Update changelog
2020-09-06 07:06:58 -04:00
Adam Wathan
d44e75fc79
Purge layers by default, deprecate conservative mode (#2288)
* Purge `layers` by default, deprecate `conservative` mode

* Ensure base styles are wrapped in @layer

* Update processPlugins test
2020-09-02 14:42:27 -04:00
Adam Wathan
5701d7847b
Add dark mode variant (#2279)
* Initial dark mode prototype

* Isolate dark mode logic to config extension

* Update fixtures

* Fix lint warnings
2020-09-01 13:16:00 -04:00
Adam Wathan
b17b51811f Remove unused function 2020-08-19 13:34:21 -04:00
Adam Wathan
b3db1053b5 Don't log anything for people who have opted in to future features 2020-08-19 13:28:04 -04:00
Adam Wathan
2d090feb98 Only log purge notice once per process 2020-08-19 10:56:51 -04:00
Adam Wathan
ef149cfafb Optimize rebuilds in long-running processes 2020-08-19 10:21:26 -04:00
Adam Wathan
092009b508 Simplify flag logging 2020-08-18 13:23:08 -04:00
Adam Wathan
cef0b84abf Reorganize prototype code 2020-08-14 12:23:28 -04:00
Adam Wathan
36fc03b16d Add initial support for applying variants and other complex classes 2020-08-12 19:47:21 -04:00
Adam Wathan
aa810673f4 Add experimental extendedFontSizeScale 2020-08-07 15:10:10 -04:00
Adam Wathan
4d2e4119fd Add experimental default line heights 2020-08-07 14:42:43 -04:00
Adam Wathan
30980063e8 Add experimental extended spacing scale 2020-08-07 11:25:22 -04:00
Adam Wathan
feb43849c4 Link to upcoming changes documentation in flag notices 2020-08-07 11:09:53 -04:00
Adam Wathan
338dc12eea Deprecate col-gap and row-gap in favor of gap-x and gap-y 2020-08-06 16:27:35 -04:00
Adam Wathan
80ad8a4c8f Support 'all' keyword for feature flags 2020-08-06 16:26:15 -04:00
Adam Wathan
61635f4884 Co-locate feature flag utilities 2020-08-06 16:02:09 -04:00