2020-07-24 12:15:28 -04:00
|
|
|
import _ from 'lodash'
|
|
|
|
|
|
2020-07-24 11:52:47 -04:00
|
|
|
export default function() {
|
2020-08-02 08:01:16 -04:00
|
|
|
return function({ addUtilities, e, theme, variants }) {
|
2020-07-24 11:52:47 -04:00
|
|
|
const keyframesConfig = theme('keyframes')
|
2020-07-24 12:15:28 -04:00
|
|
|
const keyframesStyles = _.fromPairs(
|
|
|
|
|
_.toPairs(keyframesConfig).map(([name, keyframes]) => {
|
2020-07-24 11:52:47 -04:00
|
|
|
return [`@keyframes ${name}`, keyframes]
|
|
|
|
|
})
|
|
|
|
|
)
|
2020-08-02 08:01:16 -04:00
|
|
|
addUtilities(keyframesStyles)
|
2020-07-24 11:52:47 -04:00
|
|
|
|
|
|
|
|
const animationConfig = theme('animation')
|
2020-07-24 12:15:28 -04:00
|
|
|
const utilities = _.fromPairs(
|
|
|
|
|
_.toPairs(animationConfig).map(([suffix, animation]) => {
|
2020-07-24 11:52:47 -04:00
|
|
|
return [
|
|
|
|
|
`.${e(`animate-${suffix}`)}`,
|
|
|
|
|
{
|
|
|
|
|
animation,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
addUtilities(utilities, variants('animation'))
|
|
|
|
|
}
|
|
|
|
|
}
|