Skip to content

Commit 4fbe1dd

Browse files
committed
fix: keyframes on native mode
1 parent d700119 commit 4fbe1dd

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

example/webpack/components/Time.svelte

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script>
22
import { onDestroy } from 'svelte';
33
4+
let className;
5+
export { className as class };
6+
47
let date = new Date();
58
const active = true;
69
$: time = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
@@ -12,7 +15,7 @@
1215
})
1316
</script>
1417

15-
<style module>
18+
<style module="mixed">
1619
:local(div) {
1720
text-align: right;
1821
font-size: 1.2rem;
@@ -47,8 +50,28 @@
4750
:global(div) :local(p > strong) { font-weight: 600; }
4851
4952
:local(div) *.bold { font-size: 12px;}
53+
54+
.btn {
55+
float:right;
56+
animation: opacity 4s infinite alternate;
57+
}
58+
59+
@media screen {
60+
.btn {
61+
color: red;
62+
}
63+
}
64+
65+
@keyframes opacity {
66+
0% {
67+
opacity: 0;
68+
}
69+
100% {
70+
opacity: 1;
71+
}
72+
}
5073
</style>
5174
<div
52-
class=" bolder light { true ? 'lighter red' : ''}"
75+
class="btn bolder light { true ? 'lighter red' : ''}"
5376
class:bold={true}
5477
>{time}</div>

src/processors/native.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ const parser = (processor: Processor): void => {
4141
if (node.type === 'Script' || node.type === 'Fragment') {
4242
this.skip();
4343
}
44+
45+
if (node.type === 'Atrule' && node.name === 'keyframes') {
46+
processor.parseKeyframes(node);
47+
this.skip();
48+
}
49+
4450
if (node.type === 'Selector') {
4551
let start = 0;
4652
let end = 0;
@@ -70,11 +76,11 @@ const parser = (processor: Processor): void => {
7076
}
7177
});
7278
}
73-
74-
processor.parsePseudoLocalSelectors(node);
7579
}
7680

7781
processor.parseBoundVariables(node);
82+
processor.parsePseudoLocalSelectors(node);
83+
processor.storeAnimationProperties(node);
7884

7985
if (node.type === 'ClassSelector') {
8086
const generatedClassName = processor.createModuleClassname(node.name);
@@ -84,6 +90,8 @@ const parser = (processor: Processor): void => {
8490
},
8591
});
8692

93+
processor.overwriteAnimationProperties();
94+
8795
selectorBoundaries.forEach((boundary) => {
8896
processor.magicContent.appendLeft(boundary.start, ':global(');
8997
processor.magicContent.appendRight(boundary.end, ')');

0 commit comments

Comments
 (0)