41 Commits

Author SHA1 Message Date
Adam Wathan
6343d1ec7c Apply configured prefix to the .group class for group-hover variants 2019-11-25 11:47:00 -05:00
Adam Wathan
660ea44db2 Don't mutate nested rules when generating variants 2019-07-28 10:46:59 -04:00
Adam Wathan
604d921a85 Clean up test indentation 2019-07-20 11:24:03 -04:00
Adam Wathan
81b10be134 Fix conflicts 2019-07-20 11:22:09 -04:00
Adam Wathan
78554a34d2 Rename first-child and last-child to first and last 2019-07-20 11:14:25 -04:00
Cody
d4aac290ac add odd and even nth child pseudo selectors 2019-07-14 00:10:08 -05:00
Adam Wathan
893f5c049a Add first-child and last-child variants 2019-07-12 12:53:52 -04:00
Adam Wathan
b1242a0810 Fix conflicts 2019-07-10 08:29:58 -04:00
Adam Wathan
5080129b71
Merge pull request #732 from GeoffSelby/add-disabled-variant
Add `disabled` variant
2019-07-10 08:27:23 -04:00
Christopher Willard
1efc5d1d44 Add support for :visited state variant 2019-06-18 07:27:40 -04:00
Adam Wathan
eeb2947204 Properly handle pseudo-elements with group-hover variant 2019-06-13 07:52:37 -04:00
Adam Wathan
737f1ecde0 Append variant pseudo-selectors after classes instead of replacing entire selector 2019-06-12 09:15:06 -04:00
mattstypa
92b3b0c0a1 Updated CLI init commend 2019-03-14 15:51:21 -05:00
Geoff Selby
64cea138ee Add disabled variant
This commit adds a `disabled` variant to the Tailwind core. Not sure if/where this would be used by default.
2019-03-07 22:37:44 -06:00
Adam Wathan
007231fbfc Require plugin authors to manually escape variants
Not 100% convinced this is a net positive change, but I regret not having done things this way at the beginning.

In 0.x, we pass the `separator` and `className` values already escaped, so `:` comes through as `\:` for example, and `w-1/2` comes through as `w-1\/2`.

At first this sounds fine, less work for the plugin author right? But CSS escaping rules are kind of complicated and you have to escape characters differently depending on whether or not they are at the start of an identifier.

For example, it's totally fine for a class to contain a zero (`0` ), but it can't _start_ with a zero. For a class to start with a zero, it needs to be escaped like this: `\30 `

This means that as a general rule, trying to escape the individual segments of a class separately is a bad idea — you should escape the class as a whole so only the necessary escaping is applied. We break this rule when we pre-escape the separator and className for plugin authors who use the `modifySelectors` function.

We already require users to manually escape class names when they are using `addUtilities` or `addComponents`, so to me it feels more consistent for things to work this way and it's how they should have worked from day one.

Basically this code:

```js
function({ addVariant }) {
  addVariant('first-child', ({ modifySelectors, separator }) => {
    modifySelectors(({ className }) => {
      return `.first-child${separator}${className}:first-child`
    })
  })
},
```

...would need to be re-written like this if I merge this change:

```js
function({ addVariant, e }) {
  addVariant('first-child', ({ modifySelectors, separator }) => {
    modifySelectors(({ className }) => {
      return `.${e(`first-child${separator}${className}`)}:first-child`
    })
  })
},
```

Although I think this is the right way for this to work, I hesitate because it's a breaking change that makes any variant plugins authored for 0.x incompatible with 1.x. It's an easy fix on the plugin author's part, but it's still annoying.

I'm leaning towards merging so I don't regret this even more later when the plugin ecosystem is a lot bigger. Anyone have any thoughts?
2019-02-28 10:17:09 -05:00
Adam Wathan
c0ec2c5fbe Allow users to customize default variant placement 2019-02-15 10:52:01 -05:00
Adam Wathan
5ade923fa4 Fix tests and lint warnings 2019-01-14 15:43:12 -05:00
Adam Wathan
146b984617 Accept plugins as separate processPlugins arg 2019-01-14 15:43:12 -05:00
Adam Wathan
1e8a70b68c Promote pluginVariants from experiment to feature 2018-10-31 15:52:32 -04:00
Adam Wathan
eeb788661c Add test for generating variants for multi-selector rules 2018-09-15 09:01:30 -04:00
Adam Wathan
1a8383c08d
Merge branch 'master' into feature/focus-within 2018-09-13 21:41:16 +09:30
Adam Wathan
7846d2a228 Move plugin variant features behind experiment 2018-07-11 12:13:50 -04:00
Adam Wathan
f974b8df03 Add support for writing variant plugins with raw PostCSS API 2018-06-26 13:44:47 -04:00
Adam Wathan
9b22ff3513 Only process plugins once 2018-06-26 13:44:47 -04:00
Adam Wathan
b21d258f63 Wrap Tailwind plugins in new plugin to only unwrap config once 2018-06-26 13:44:47 -04:00
Adam Wathan
d77bc055ee Support for basic variant generator plugins
Allows you to write a plugin that registers a new variant but only
allows you to modify the selector (like what our built-in generators
do.)

Next steps are to support variants that wrap rules with at-rules
(like @supports for example), variants that can modify properties
(as opposed to just selectors), and to give variant plugin authors
control over how responsive variants interact with their own variants.
2018-06-26 13:44:47 -04:00
Adam Wathan
9d05910507 Generate variants based on the order specified in the modules config 2018-06-26 13:44:47 -04:00
Paulo
9e4e8a6d05 Add focus-within variant 2018-05-04 14:47:28 +02:00
Adam Wathan
cc968d1791 Fix conflics, refactor variant generator 2018-03-13 08:12:20 -04:00
Adam Wathan
fa0e06c2dd Generate focus variants last and group-hover variants first 2018-03-12 15:34:14 -04:00
Adam Wathan
bc05473b37 Add dependencies, fix warnings 2018-03-07 09:37:01 -05:00
fedeTibaldo
b7cb21360d Update priority order to (from the highest): active-hover-focus 2018-02-19 17:23:22 +01:00
fedeTibaldo
62cf25f718 Change priority order to (from the highest): focus-active-hover 2018-02-16 18:09:20 +01:00
fedeTibaldo
2e4e4a79e2 Revert output order from hover-active-focus to focus-active-hover 2018-02-09 20:57:34 +01:00
fedeTibaldo
1f57fbfbaf Add tests for active state variant 2018-02-09 20:20:24 +01:00
Adam Wathan
858b725896
[0.3] Rename parent-hover to group-hover (#271) 2017-12-01 08:14:58 -05:00
Adam Wathan
ad48de9500
[0.3] Escape separator string (#270) 2017-11-30 15:55:06 -05:00
Adam Wathan
ed550b3c5c
[0.3] Add parent-hover variant (#251)
* Add parent-hover variant

* Don't enable parent-hover on textColors module by default

* Add tests, move parent-hover declarations to separate rules

* Prettier-ignore long selector string
2017-11-28 14:44:43 -05:00
dumconstantin
013f845281 Make the hoverable, focusable and responsive separator (default '\:') configurable. 2017-11-24 16:26:40 +02:00
Adam Wathan
28f73f2bf5 Add support for including responsive in variants list 2017-11-23 09:58:42 -05:00
Adam Wathan
12dd81b906 Working on @variants at-rule
Currently supports focus and hover, need to add responsive which will be a whole horrible can of worms.
2017-11-22 18:44:30 -05:00