diff --git a/CHANGELOG.md b/CHANGELOG.md index e070d6c44d..491c9f6c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +* Add support for the new `@view-transition` CSS at rule ([#4313](https://github.com/evanw/esbuild/pull/4313)) + + ```css + /* Original code */ + @view-transition { + navigation: auto; + types: check; + } + /* Output */ + @view-transition{navigation:auto;types:check} + ``` + + This was contributed by [@yisibl](https://github.com/yisibl). + ## 0.25.11 * Add support for `with { type: 'bytes' }` imports ([#4292](https://github.com/evanw/esbuild/issues/4292)) diff --git a/internal/css_parser/css_parser.go b/internal/css_parser/css_parser.go index b45bc08aa5..3f6ca6dc19 100644 --- a/internal/css_parser/css_parser.go +++ b/internal/css_parser/css_parser.go @@ -1109,6 +1109,10 @@ var specialAtRules = map[string]atRuleKind{ // Anchor Positioning // Reference: https://drafts.csswg.org/css-anchor-position-1/#at-ruledef-position-try "position-try": atRuleDeclarations, + + // @view-transition + // Reference: https://drafts.csswg.org/css-view-transitions-2/#view-transition-rule + "view-transition": atRuleDeclarations, } var atKnownRuleCanBeRemovedIfEmpty = map[string]bool{ diff --git a/internal/css_parser/css_parser_test.go b/internal/css_parser/css_parser_test.go index 8b76e801cd..5061e027f1 100644 --- a/internal/css_parser/css_parser_test.go +++ b/internal/css_parser/css_parser_test.go @@ -1516,6 +1516,10 @@ func TestAtRule(t *testing.T) { } } }`, "@supports (container-type: size){@container (width <= 150px){#inner{background-color:#87ceeb}}}", "") + expectPrintedMinify(t, `@view-transition { + navigation: auto; + types: check; +}`, "@view-transition{navigation:auto;types:check}", "") // https://drafts.csswg.org/css-transitions-2/#defining-before-change-style-the-starting-style-rule expectPrinted(t, `