Add support for @starting-style rules#1566
Add support for @starting-style rules#1566askoufis merged 5 commits intovanilla-extract-css:masterfrom
@starting-style rules#1566Conversation
🦋 Changeset detectedLatest commit: 592b8c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 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 |
|
Is this getting any attention? |
|
I would love to get this merged as soon as possible! Anyone who can review this PR? |
|
@lfantone Thanks for the PR! I have a couple of requests for this PR:
|
|
Thanks for the comment @askoufis, yeah you are right about splitting this into two different PR. I will convert this one to be the Regarding the name for this properties, do you think we should go with |
|
I think I manage to get the e2e test with Playwright but all the parcel cases fails with: {
origin: '@parcel/transformer-css',
message: 'Unknown at rule: @starting-style',
name: 'SyntaxError',
stack: undefined,
codeFrames: undefined
}Which makes me wonder if parcel has support for this new css rule or if I'm missing something in some config. |
It should, though parcel uses |
ec4bbd9 to
efc89b4
Compare
|
PR updated! There were two different parcel versions installed, one in the Let me know if there is anything else that should be addressed |
|
@lfantone It looks like there's still some anchor positioning code lying around. Additionally it looks like you've accidentally deleted the starting-styles changeset instead of the anchor positioning changeset. |
CSS anchor positioning rules@starting-style rules
askoufis
left a comment
There was a problem hiding this comment.
We're pretty close on this. A few tweaks and some unit tests and it should be ready to merge.
There was a problem hiding this comment.
Looks like the newer version of parcel is re-ordering and deduplicating CSS, resulting in these changes. They're not incorrect changes though, just calling them out.
packages/css/src/types.ts
Outdated
| export type FeatureQueries<StyleType> = Query<'@supports', StyleType>; | ||
| export type ContainerQueries<StyleType> = Query<'@container', StyleType>; | ||
| export type Layers<StyleType> = Query<'@layer', StyleType>; | ||
| export type StartingStyleQueries<StyleType> = { |
There was a problem hiding this comment.
Thoughts on the StartingStyleQueries name? While the Queries suffix aligns with most of the other types, it doesn't really make sense since @starting-style isn't a query like @media or @container. It's more similar to @layer in that it declares something. Maybe it should just be called StartingStyle?
There was a problem hiding this comment.
Sounds like a good suggestion!
| if (root.type === 'local') { | ||
| this.transformSimplePseudos(root, rules, conditions); | ||
| this.transformSelectors(root, rules, conditions); | ||
| } |
There was a problem hiding this comment.
This logic should have a unit test too.
|
Hi @askoufis, I'm helping luciano with this PR and I've added the tests you asked about and taken a look through the rest, see that we've gotten out of sync with main so will rebase put please take a look at your convince 🙂 |
49616bc to
1eaa63e
Compare
|
@lfantone I'm keen to get this PR ready for release if you've got some time. I think you need to change some permissions on your fork in order for me to run CI. Assuming CI passes I'd be happy to merge. |
|
There we go! I enable Actions in the fork and sync it with upstream. 🙏 Sorry for the long waiting |
|
@lfantone Could I have permission to push to Alternatively you can apply this patch with |
|
@askoufis Yes! Added you as a collaborator in the repo and also apply the given patch |
--co-authored-by: Viktor Ceder <viktor.ceder@sas.se> --co-authored-by: Luciano Fantone <luciano.alvarezfantone@sas.se>
…ests --co-authored-by: Adam Skoufis <askoufis@users.noreply.github.com>
| // BUG: This is a long-standing bug with all at-rules, not just starting-style. This should result | ||
| // in a runtime error as well as a type error. |
There was a problem hiding this comment.
This is an unrelated bug I found while fixing a bug in this PR. I'll raise a separate issue for it as I don't want it to block this PR.
|
@lfantone Thanks for all your help on this. |
This pull request adds complete support for CSS Anchor positioning.
The update includes implementing all necessary types for rules as well as incorporating the new queries "@starting-style" and "@position-try", allowing for a better experience when using CSS anchor positioning rules
Closes #1521
EDIT: This PR will add support only for
@starting-stylerule. CSS Anchor position will be supported in a separate PR.