1
1
const nameClass = require ( 'tailwindcss/lib/util/nameClass' ) . default
2
2
const transformThemeValue = require ( 'tailwindcss/lib/util/transformThemeValue' ) . default
3
3
const parseAnimationValue = require ( 'tailwindcss/lib/util/parseAnimationValue' ) . default
4
+ const { newFormat } = require ( '../pluginUtils' )
4
5
5
6
module . exports = function ( { jit : { theme, addUtilities } } ) {
6
7
let keyframes = Object . fromEntries (
7
8
Object . entries ( theme . keyframes ) . map ( ( [ key , value ] ) => {
8
9
return [
9
10
key ,
10
11
[
11
- `@keyframes ${ key } ` ,
12
- Object . entries ( value ) . map ( ( [ key , value ] ) => {
13
- return [ key , value ]
14
- } ) ,
12
+ {
13
+ [ `@keyframes ${ key } ` ] : value ,
14
+ } ,
15
+ { respectVariants : false } ,
15
16
] ,
16
- { respectVariants : false } ,
17
17
]
18
18
} )
19
19
)
20
20
21
21
let transformValue = transformThemeValue ( 'animation' )
22
22
addUtilities ( {
23
23
animate : [
24
- ( modifier , { theme } ) => {
24
+ newFormat ( ( modifier , { theme } ) => {
25
25
let value = transformValue ( theme . animation [ modifier ] )
26
26
27
27
if ( modifier === '' || value === undefined ) {
@@ -30,8 +30,11 @@ module.exports = function ({ jit: { theme, addUtilities } }) {
30
30
31
31
let { name : animationName } = parseAnimationValue ( value )
32
32
33
- return [ keyframes [ animationName ] , [ nameClass ( 'animate' , modifier ) , { animation : value } ] ]
34
- } ,
33
+ return [
34
+ keyframes [ animationName ] ,
35
+ { [ nameClass ( 'animate' , modifier ) ] : { animation : value } } ,
36
+ ]
37
+ } ) ,
35
38
] ,
36
39
} )
37
40
}
0 commit comments