Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twenty-shoes-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: don't include keyframes in global scope in the keyframes to rename
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ function is_global_block_selector(simple_selector) {
);
}

/**
*
* @param {Array<AST.CSS.Node>} path
*/
function is_in_global_block(path) {
return path.some((node) => node.type === 'Rule' && node.metadata.is_global_block);
}

/** @type {CssVisitors} */
const css_visitors = {
Atrule(node, context) {
if (is_keyframes_node(node)) {
if (!node.prelude.startsWith('-global-')) {
if (!node.prelude.startsWith('-global-') && !is_in_global_block(context.path)) {
context.state.keyframes.push(node.prelude);
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte/tests/css/samples/global-block/expected.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
animation: svelte-xyz-test 1s;
}

.y{
animation: test-in 1s;
}

@keyframes test-in{
to{
opacity: 1;
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte/tests/css/samples/global-block/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
animation: test 1s;
}

.y{
animation: test-in 1s;
}

@keyframes test-in{
to{
opacity: 1;
Expand Down
Loading