feat(css): add support for scroll-driven animation keyframe selectors#9788
Conversation
🦋 Changeset detectedLatest commit: dd0180d The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 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 |
Merging this PR will not alter performance
Comparing Footnotes
|
4bbdcbd to
d103b68
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (10)
📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (5)
WalkthroughAdds support for CSS scroll‑driven animation timeline‑range‑name keyframe selectors across parser, lexer, grammar, formatter and tests. Introduces a new CssKeyframesRangeSelector non‑terminal and syntax kind, recognises cover, contain, entry, exit, entry‑crossing, exit‑crossing in the lexer, parses 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_css_parser/src/syntax/at_rule/keyframes.rs`:
- Around line 366-370: The code makes the percentage after a timeline-range-name
optional by calling parse_percentage_dimension(p).ok(); change this so the
percentage is required: after bump_ts(TIMELINE_RANGE_NAME_SET) call
parse_percentage_dimension(p) and if it returns Err/None emit a diagnostic on
the parser (or mark the node as bogus) instead of silently continuing, and only
set kind to CSS_KEYFRAMES_RANGE_SELECTOR when parse_percentage_dimension
succeeds; reference functions/symbols: is_at_timeline_range_name,
parse_percentage_dimension, TIMELINE_RANGE_NAME_SET,
CSS_KEYFRAMES_RANGE_SELECTOR to locate and update the branch to handle missing
percentage as an error/recovery path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6f5f9f02-d8e3-4aa8-a67c-ff886b5fe6e8
⛔ Files ignored due to path filters (9)
crates/biome_css_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_keyframes/at_rule_keyframes.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_keyframes/at_rule_keyframes_1.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_keyframe_range.css.snapis excluded by!**/*.snapand included by**crates/biome_css_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (12)
.changeset/feat-css-keyframes-timeline-range.mdcrates/biome_css_formatter/src/css/any/keyframes_selector.rscrates/biome_css_formatter/src/css/selectors/keyframes_range_selector.rscrates/biome_css_formatter/src/css/selectors/mod.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_parser/src/lexer/mod.rscrates/biome_css_parser/src/syntax/at_rule/keyframes.rscrates/biome_css_parser/src/syntax/at_rule/parse_error.rscrates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_keyframe_range.csscrates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rsxtask/codegen/css.ungramxtask/codegen/src/css_kinds_src.rs
2f50f45 to
62b44e2
Compare
62b44e2 to
dd0180d
Compare
denbezrukov
left a comment
There was a problem hiding this comment.
Looks good!
Thank you so much!
Summary
Fixed #7760: CSS keyframes with timeline-range-name not supported.
Problem
The CSS parser only recognized
from,to, and percentage values (e.g.50%) as valid keyframe selectors. The CSS Scroll-driven Animations spec adds<timeline-range-name> <percentage>selectors, which Biome rejected with a parse error.Approach
CssKeyframesRangeSelectornode type to the CSS grammar (css.ungram) containing a name token and a percentagecover,contain,entry,exit,entry-crossing,exit-crossing) followed by a percentageTest plan
at_rule_keyframe_range.css) covering all 6 timeline-range-names, mixed selectors, and various combinationsAI disclosure
Claude Code was used to understand the problem, research the CSS Scroll-driven Animations spec, write unit tests, and run the PR requirement pipeline.