Add support for retrieving StyleRule objects by className#1371
Open
joslarson wants to merge 6 commits intovanilla-extract-css:masterfrom
Open
Add support for retrieving StyleRule objects by className#1371joslarson wants to merge 6 commits intovanilla-extract-css:masterfrom
joslarson wants to merge 6 commits intovanilla-extract-css:masterfrom
Conversation
🦋 Changeset detectedLatest commit: f83a5c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For discussion: initial implementation of #1363
The underlying goal here is to provide an API to be able retrieve style rule objects from a list of classNames, in the order they were originally added in. With that we'd be able to build some interesting things
Consider the following idea:
This could also be accomplished like so, but has some drawbacks:
What if the button styles are coming from a library and you don't have access to the raw style objects weren't exported? You're out of luck :(
The ultimate goal of this PR for me is to add what needed underneath to support a recipes API closer to what stitches provides (while still being fully static), where you can define variants and can optionally enable different variants at different breakpoints like so:
My first instinct was that the CSS cache should probably exist in the adapter, but on a first glance it wasn't obvious where the logic lives, so for now I've bolted it on to the
appendCssfunction inpackages/css/src/adapter.ts.