Spaces:
Sleeping
Sleeping
File size: 654 Bytes
56fda74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import { CSSInterpolation } from '@emotion/serialize'
import css from './css'
type Keyframes = {
name: string
styles: string
anim: 1
toString: () => string
} & string
export function keyframes(
template: TemplateStringsArray,
...args: CSSInterpolation[]
): Keyframes
export function keyframes(...args: CSSInterpolation[]): Keyframes
export function keyframes(...args: CSSInterpolation[]) {
let insertable = css(...args)
const name = `animation-${insertable.name}`
return {
name,
styles: `@keyframes ${name}{${insertable.styles}}`,
anim: 1,
toString() {
return `_EMO_${this.name}_${this.styles}_EMO_`
}
}
}
|