1154 Commits

Author SHA1 Message Date
Robin Malfait
33ee64665d cache className resolve 2020-08-18 08:21:33 -04:00
Robin Malfait
fe70c89718 use append instead of prepend
Same idea, but prepend will internally reverse all nodes.
2020-08-18 08:21:33 -04:00
Robin Malfait
e417da262e cache clone rule
Otherwise every time we read this value it will be re-cloned
2020-08-18 08:21:33 -04:00
Robin Malfait
5260c71c60 only parse the className when needed 2020-08-18 08:21:33 -04:00
Robin Malfait
8ae2a32a0c hoist selectorParser setup code
No need to re-create the selectorParser in every call.
2020-08-18 08:21:33 -04:00
Robin Malfait
fab4d7b8f6 cache buildSelectorVariant 2020-08-18 08:21:33 -04:00
Robin Malfait
0631851b7b introduce a useMemo utility
Naming is hard so I took this name from the React hook 😎

Also use this useMemoy utility to make sure that the extractUtilityNames
is cached. There is no need to re-compute the utility names all the
time.
2020-08-18 08:21:33 -04:00
Robin Malfait
00f4427ea9 improvement cloning of the parent node
We used to clone the full tree and then remove all the children, this
was a bit too slow so therefore we will now create a new tree based on
the old information.
2020-08-18 08:21:33 -04:00
Robin Malfait
78df10020f hoist the selector parser
No need to re-create the selector parser in the loop for each selector.
2020-08-18 08:21:33 -04:00
Robin Malfait
309b8e5bb8 re-use the same tailwindApplyPlaceholder 2020-08-18 08:21:33 -04:00
Robin Malfait
e39fd6f2b3 remove the reversed orderedUtilityMap
We don't require this reversed map since we can already sort by the
index on the node directly. Therefore this can be dropped.
2020-08-18 08:21:33 -04:00
Robin Malfait
88888fd0f8 switch to a do {} while ()
We alreayd know that we have an `@apply` otherwise we would not have
called that function in the first place. Moving to a `do {} while ()`
allows us to skip 1 call to `hasAtRule(css, 'apply')`. Which is nice
because that skips a possible full traversal.
2020-08-18 08:21:33 -04:00
Robin Malfait
f2e3e22c6b make the cloning of the rule in the lookup table lazy
We create a big lookup table so that we can lookup the nodes by its
utilityName. This is used inside the recursive `@apply` code.

This big lookup table will clone every single rule and put it in,
however we don't need to clone everything! We are only interested in the
rules that have been actually applied.

This way we make the cloning of the rule lazy and only when we use this
exact rule.

There is an additional performace "issue" though: When we read the same
rule multiple times, it will clone every time you read from that object.
We could add additional memoization stuff, but so far it doesn't seem to
be the bottleneck. Therefore I've added a perf todo just to leave a mark
when this becomes the bottleneck.
2020-08-18 08:21:33 -04:00
Robin Malfait
5564e0b493 remove unused containsApply check
Currently we will walk the tree for every single rule to see if an
`@apply` exists somewhere in that tree. However we don't use the
`containsApply` anymore so this is a quick win!
2020-08-18 08:21:33 -04:00
Robin Malfait
aa7ae6af37 re-use classNameParser
We were re-creating the classNameParser inside the loop. Since that code
is all pretty pure we can hoist it so that we don't have to recreate
that parser all the time.
2020-08-18 08:21:33 -04:00
Robin Malfait
8c7fb84e58 bail out of the applyComplexClasses when it is not needed
There is no need in re-compiling tailwind or building expensive lookupt
tables when it turns out that we don't even need it.

We have a small overhead by walking the tree to check if `@apply`
exists. However this outweighs the slowness of re-generating tailwind +
expensive lookup tables.
2020-08-18 08:21:33 -04:00
Adam Wathan
7945f0f7c8
Merge pull request #2176 from tailwindlabs/gradients
Add background gradient support
2020-08-18 08:06:50 -04:00
Adam Wathan
1d2dd1a5f4
Merge pull request #1965 from juno-w/master
Divide border style
2020-08-17 21:13:49 -04:00
Adam Wathan
4ca48dbde5 Add catch arg 2020-08-17 14:18:42 -04:00
Adam Wathan
926b6b1fab Rename mid color stop to via 2020-08-17 13:25:18 -04:00
Adam Wathan
8d87445b81 Improve API, support auto-transparent to, rename gradientColor plugin 2020-08-17 11:05:06 -04:00
Adam Wathan
7fb5d4a579 Add support for background images and 2/3-color-stop gradients 2020-08-16 15:23:49 -04:00
Adam Wathan
488c0e35c9 Don't include vendor prefix for background-clip: text
Better to rely on autoprefixer for this for now. If we want to start shipping prefixes we should do it across the board, not just in one spot.
2020-08-15 16:24:21 -04:00
Adam Wathan
5b82b6f5ac Add background-clip utilities 2020-08-15 16:20:33 -04:00
Adam Wathan
8a066c27a2 Merge branch 'apply-complex-classes' 2020-08-15 15:39:48 -04:00
Adam Wathan
6b32635f2c Explain other code branch when processing @apply rules 2020-08-15 15:39:39 -04:00
Adam Wathan
9d257a986c Rename inject instances to apply 2020-08-15 15:31:26 -04:00
Adam Wathan
cebed0e4e0 Only include contents class in modern builds, update fixtures 2020-08-15 15:22:31 -04:00
Adam Wathan
94325f5710 Merge branch 'patch-1' of git://github.com/mtimbs/tailwindcss into mtimbs-patch-1 2020-08-15 15:20:23 -04:00
Adam Wathan
7371ea992b
Merge pull request #1676 from innocenzi/color-closure
Allow colors to be defined as closures
2020-08-15 09:09:46 -04:00
Adam Wathan
e37b665b60 Support applying classes that occur multiple times in a single selector 2020-08-14 19:12:45 -04:00
Adam Wathan
6fe745b908 Improve comment 2020-08-14 13:26:14 -04:00
Adam Wathan
cef0b84abf Reorganize prototype code 2020-08-14 12:23:28 -04:00
Adam Wathan
b518dc3e4c Test applying classes with a prefix configured 2020-08-14 11:15:45 -04:00
Adam Wathan
8646c94dd5 Prepend a shadow lookup table when no @tailwind rules are in the tree 2020-08-13 20:16:56 -04:00
Adam Wathan
c252e33254 Get shadow lookup working-ish with new apply approach 2020-08-13 12:14:26 -04:00
Adam Wathan
6f1fb5c401 Drop entries methods for lodash 2020-08-13 09:35:45 -04:00
Adam Wathan
1c23b0a9ed Use lodash for flatMap 2020-08-13 08:56:27 -04:00
Adam Wathan
e313de6354 Fix lint issues 2020-08-13 07:45:04 -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
a84deb4ac5 Fix bug where theme('fontSize.xl') breaks with default line-height 2020-08-07 14:32:47 -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
cafbc65b3b Merge branch 'master' of github.com:tailwindlabs/tailwindcss 2020-08-06 16:08:49 -04:00
Adam Wathan
6070ba72dc
Merge branch 'master' into patch-2 2020-08-06 16:08:23 -04:00
Adam Wathan
61635f4884 Co-locate feature flag utilities 2020-08-06 16:02:09 -04:00