Repository navigation
feat(babel-plugin): support top-level @starting-style in cssMap - #1981
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
cssMap treated every at-rule key listed in its at-rule table as having two halves (`'@media': { 'screen and ...': { ... } }`) and merged each child key into the at-rule name. `@starting-style` has no prelude, so a variant such as `{ '@starting-style': { color: 'blue' } }` was rewritten to the key `@starting-style color` with a string value, which ended up as the invalid sheet `@starting-style color: blue{}` and no class name. Only the nested form (inside another at-rule) worked. - Add a list of at-rules without a prelude and, in mergeExtendedSelectorsIntoProperties, pass those blocks through unchanged so buildCss handles them like any other nested block. Keep the duplicate detection (including against the `selectors` object) and report a clear error when the value is not an object. - Update the cssMap / cssMapScoped types so `@starting-style` directly contains styles (and pseudo selectors) instead of a record of preludes, and add type tests for valid and invalid usage. - Replace the TODO in the babel-plugin tests with real coverage for cssMap and cssMapScoped, the `selectors` object, the duplicate error and the non-object error. - Document the syntax in the cssMap API docs and add a changeset.
officialasishkumar
requested review from
JakeLane,
danieldelcore,
dddlr,
kylorhall-atlassian,
liamqma and
pancaspe87
as code owners
November 19, 2026 23:56
|
Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution. Already signed the CLA? To re-check, try refreshing the page. |
👷 Deploy request for compiled-css-in-js pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: f03058a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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.
What is this change?
Adds support for declaring
@starting-styledirectly inside acssMapvariant (not nested within another at-rule or selector), and updates thecssMaptypes so the block is typed as styles.Fixes #1788
Why are we making this change?
cssMaptreats at-rules as having two halves ('@media': { 'screen and ...': {...} }) and merged every child key into the at-rule name.@starting-stylehas no prelude, so{ '@starting-style': { color: 'blue' } }was rewritten into the key@starting-style color, producing the invalid sheet@starting-style color: blue{}with no class name. The types had the same two-halves assumption. Only the nested form worked.How are we making this change?
mergeExtendedSelectorsIntoPropertiespasses at-rules without a prelude through unchanged, keeping duplicate detection (including against theselectorsobject) and erroring when the value isn't an object.cssMap/cssMapScopedtypes accept styles (and pseudo selectors) directly under'@starting-style'.cssMap,cssMapScoped, theselectorsobject and both error cases, plus type tests.api-cssmap.mdxand a changeset.Three
module traversaltests inpackages/babel-pluginfail in my environment with and without this change.PR checklist
I have...
website/