Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
28 lines
654 B
Plaintext
28 lines
654 B
Plaintext
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_`
|
|
}
|
|
}
|
|
}
|