-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrary variants #8299
Merged
Merged
Arbitrary variants #8299
+525
−88
Commits on May 7, 2022
-
With the new `addVariant` API, we have a beautiful way of creating new variants. You can use it as: ```js addVariant('children', '& > *') ``` Now you can use the `children:` variant. The API uses a `&` as a reference for the candidate, which means that: ```html children:pl-4 ``` Will result in: ```css .children\:pl-4 > * { .. } ``` Notice that the `&` was replaced by `.children\:pl-4`. We can leverage this API to implement arbitrary variants, this means that you can write those `&>*` (Notice that we don't have spaces) inside a variant directly. An example of this can be: ```html <ul class="[&>*]:underline"> <li>A</li> <li>B</li> <li>C</li> </ul> ``` Which generates the following css: ```css .\[\&\>\*\]\:underline > * { text-decoration-line: underline; } ``` Now all the children of the `ul` will have an `underline`. The selector itself is a bit crazy since it contains the candidate which is the selector itself, it is just escaped.
Configuration menu - View commit details
-
Copy full SHA for 08b177f - Browse repository at this point
Copy the full SHA 08b177fView commit details -
add tests for arbitrary variants
This still requires some work to the `defaultExtractor` to make sure it all works with existing code.
Configuration menu - View commit details
-
Copy full SHA for e070079 - Browse repository at this point
Copy the full SHA e070079View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d49e55 - Browse repository at this point
Copy the full SHA 7d49e55View commit details
Commits on May 8, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 623718e - Browse repository at this point
Copy the full SHA 623718eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 42296f2 - Browse repository at this point
Copy the full SHA 42296f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 02404ac - Browse repository at this point
Copy the full SHA 02404acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e24b75 - Browse repository at this point
Copy the full SHA 3e24b75View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bd6fba - Browse repository at this point
Copy the full SHA 2bd6fbaView commit details -
Configuration menu - View commit details
-
Copy full SHA for a96eb72 - Browse repository at this point
Copy the full SHA a96eb72View commit details -
Split top-level comma parsing into a generalized splitting routine
We can now split on any character at the top level with any nesting. We don’t balance brackets directly here but this is probably “enough”
Configuration menu - View commit details
-
Copy full SHA for 8d2f6bd - Browse repository at this point
Copy the full SHA 8d2f6bdView commit details -
Split variants by separator at the top-level only
This means that the separator has to be ouside of balanced brackets
Configuration menu - View commit details
-
Copy full SHA for 52baafc - Browse repository at this point
Copy the full SHA 52baafcView commit details -
Configuration menu - View commit details
-
Copy full SHA for fa829f6 - Browse repository at this point
Copy the full SHA fa829f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e04444 - Browse repository at this point
Copy the full SHA 0e04444View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3236eb9 - Browse repository at this point
Copy the full SHA 3236eb9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00a79e6 - Browse repository at this point
Copy the full SHA 00a79e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for a4cff3c - Browse repository at this point
Copy the full SHA a4cff3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8da1948 - Browse repository at this point
Copy the full SHA 8da1948View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5487b27 - Browse repository at this point
Copy the full SHA 5487b27View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.