@@ -314,6 +314,77 @@ export const animationRule: UtilityRule = (parsed) => {
314314 return undefined
315315}
316316
317+ // Animation play state
318+ export const animationPlayStateRule : UtilityRule = ( parsed ) => {
319+ const values : Record < string , string > = {
320+ 'animate-running' : 'running' ,
321+ 'animate-paused' : 'paused' ,
322+ }
323+ return values [ parsed . raw ] ? { 'animation-play-state' : values [ parsed . raw ] } : undefined
324+ }
325+
326+ // Animation direction
327+ export const animationDirectionRule : UtilityRule = ( parsed ) => {
328+ const values : Record < string , string > = {
329+ 'animate-normal' : 'normal' ,
330+ 'animate-reverse' : 'reverse' ,
331+ 'animate-alternate' : 'alternate' ,
332+ 'animate-alternate-reverse' : 'alternate-reverse' ,
333+ }
334+ return values [ parsed . raw ] ? { 'animation-direction' : values [ parsed . raw ] } : undefined
335+ }
336+
337+ // Animation fill mode
338+ export const animationFillModeRule : UtilityRule = ( parsed ) => {
339+ const values : Record < string , string > = {
340+ 'animate-fill-none' : 'none' ,
341+ 'animate-fill-forwards' : 'forwards' ,
342+ 'animate-fill-backwards' : 'backwards' ,
343+ 'animate-fill-both' : 'both' ,
344+ }
345+ return values [ parsed . raw ] ? { 'animation-fill-mode' : values [ parsed . raw ] } : undefined
346+ }
347+
348+ // Animation iteration count
349+ export const animationIterationRule : UtilityRule = ( parsed ) => {
350+ if ( parsed . utility === 'animate-iteration' && parsed . value ) {
351+ return { 'animation-iteration-count' : parsed . value === 'infinite' ? 'infinite' : parsed . value }
352+ }
353+ }
354+
355+ // Animation duration
356+ export const animationDurationRule : UtilityRule = ( parsed ) => {
357+ if ( parsed . utility === 'animate-duration' && parsed . value ) {
358+ const durations : Record < string , string > = {
359+ '75' : '75ms' , '100' : '100ms' , '150' : '150ms' , '200' : '200ms' ,
360+ '300' : '300ms' , '500' : '500ms' , '700' : '700ms' , '1000' : '1000ms' ,
361+ }
362+ return { 'animation-duration' : durations [ parsed . value ] || `${ parsed . value } ms` }
363+ }
364+ }
365+
366+ // Animation delay
367+ export const animationDelayRule : UtilityRule = ( parsed ) => {
368+ if ( parsed . utility === 'animate-delay' && parsed . value ) {
369+ const delays : Record < string , string > = {
370+ '75' : '75ms' , '100' : '100ms' , '150' : '150ms' , '200' : '200ms' ,
371+ '300' : '300ms' , '500' : '500ms' , '700' : '700ms' , '1000' : '1000ms' ,
372+ }
373+ return { 'animation-delay' : delays [ parsed . value ] || `${ parsed . value } ms` }
374+ }
375+ }
376+
377+ // Animation timing function
378+ export const animationTimingRule : UtilityRule = ( parsed ) => {
379+ const values : Record < string , string > = {
380+ 'animate-ease-linear' : 'linear' ,
381+ 'animate-ease-in' : 'cubic-bezier(0.4, 0, 1, 1)' ,
382+ 'animate-ease-out' : 'cubic-bezier(0, 0, 0.2, 1)' ,
383+ 'animate-ease-in-out' : 'cubic-bezier(0.4, 0, 0.2, 1)' ,
384+ }
385+ return values [ parsed . raw ] ? { 'animation-timing-function' : values [ parsed . raw ] } : undefined
386+ }
387+
317388export const transformsRules : UtilityRule [ ] = [
318389 transformRule ,
319390 scaleRule ,
@@ -331,4 +402,11 @@ export const transformsRules: UtilityRule[] = [
331402 transitionTimingRule ,
332403 transitionDelayRule ,
333404 animationRule ,
405+ animationPlayStateRule ,
406+ animationDirectionRule ,
407+ animationFillModeRule ,
408+ animationIterationRule ,
409+ animationDurationRule ,
410+ animationDelayRule ,
411+ animationTimingRule ,
334412]
0 commit comments