@@ -15,21 +15,8 @@ import { AnimateRunner } from "./runner/animate-runner.js";
1515import {
1616 ACTIVE_CLASS_SUFFIX ,
1717 ADD_CLASS_SUFFIX ,
18- ANIMATIONEND_EVENT ,
19- ANIMATION_DELAY_PROP ,
20- ANIMATION_DURATION_PROP ,
21- ANIMATION_ITERATION_COUNT_KEY ,
22- ANIMATION_PROP ,
23- DURATION_KEY ,
2418 EVENT_CLASS_PREFIX ,
25- PROPERTY_KEY ,
2619 REMOVE_CLASS_SUFFIX ,
27- SAFE_FAST_FORWARD_DURATION_VALUE ,
28- TIMING_KEY ,
29- TRANSITIONEND_EVENT ,
30- TRANSITION_DELAY_PROP ,
31- TRANSITION_DURATION_PROP ,
32- TRANSITION_PROP ,
3320 applyAnimationClassesFactory ,
3421 applyAnimationFromStyles ,
3522 applyAnimationStyles ,
@@ -46,34 +33,34 @@ const ANIMATE_TIMER_KEY = $injectTokens._animateCss;
4633
4734const ONE_SECOND = 1000 ;
4835
36+ const SAFE_FAST_FORWARD_DURATION_VALUE = 9999 ;
37+
4938const ELAPSED_TIME_MAX_DECIMAL_PLACES = 3 ;
5039
5140const CLOSING_TIME_BUFFER = 1.5 ;
5241
5342const DETECT_CSS_PROPERTIES = {
54- transitionDuration : TRANSITION_DURATION_PROP ,
55- transitionDelay : TRANSITION_DELAY_PROP ,
56- transitionProperty : TRANSITION_PROP + PROPERTY_KEY ,
57- animationDuration : ANIMATION_DURATION_PROP ,
58- animationDelay : ANIMATION_DELAY_PROP ,
59- animationIterationCount : ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY ,
43+ transitionDuration : "transitionDuration" ,
44+ transitionDelay : "transitionDelay" ,
45+ transitionProperty : "transitionProperty" ,
46+ animationDuration : "animationDuration" ,
47+ animationDelay : "animationDelay" ,
48+ animationIterationCount : "animationIterationCount" ,
6049} ;
6150
6251const DETECT_STAGGER_CSS_PROPERTIES = {
63- transitionDuration : TRANSITION_DURATION_PROP ,
64- transitionDelay : TRANSITION_DELAY_PROP ,
65- animationDuration : ANIMATION_DURATION_PROP ,
66- animationDelay : ANIMATION_DELAY_PROP ,
52+ transitionDuration : "transitionDuration" ,
53+ transitionDelay : "transitionDelay" ,
54+ animationDuration : "animationDuration" ,
55+ animationDelay : "animationDelay" ,
6756} ;
6857
6958function getCssKeyframeDurationStyle ( duration ) {
70- return [ ANIMATION_DURATION_PROP , `${ duration } s` ] ;
59+ return [ "animationDuration" , `${ duration } s` ] ;
7160}
7261
7362function getCssDelayStyle ( delay , isKeyframeAnimation ) {
74- const prop = isKeyframeAnimation
75- ? ANIMATION_DELAY_PROP
76- : TRANSITION_DELAY_PROP ;
63+ const prop = isKeyframeAnimation ? "animationDelay" : "transitionDelay" ;
7764
7865 return [ prop , `${ delay } s` ] ;
7966}
@@ -128,12 +115,12 @@ function truthyTimingValue(val) {
128115}
129116
130117function getCssTransitionDurationStyle ( duration , applyOnlyDuration ) {
131- let style = TRANSITION_PROP ;
118+ let style = "transition" ;
132119
133120 let value = `${ duration } s` ;
134121
135122 if ( applyOnlyDuration ) {
136- style += DURATION_KEY ;
123+ style += "Duration" ;
137124 } else {
138125 value += " linear all" ;
139126 }
@@ -445,14 +432,14 @@ export function AnimateCssProvider() {
445432 let applyOnlyDuration ;
446433
447434 if ( options . transitionStyle ) {
448- const transitionStyle = [ TRANSITION_PROP , options . transitionStyle ] ;
435+ const transitionStyle = [ "transition" , options . transitionStyle ] ;
449436
450437 applyInlineStyle ( node , transitionStyle ) ;
451438 temporaryStyles . push ( transitionStyle ) ;
452439 }
453440
454441 if ( options . duration >= 0 ) {
455- applyOnlyDuration = node . style [ TRANSITION_PROP ] . length > 0 ;
442+ applyOnlyDuration = node . style . transition . length > 0 ;
456443 const durationStyle = getCssTransitionDurationStyle (
457444 options . duration ,
458445 applyOnlyDuration ,
@@ -465,7 +452,7 @@ export function AnimateCssProvider() {
465452 }
466453
467454 if ( options . keyframeStyle ) {
468- const keyframeStyle = [ ANIMATION_PROP , options . keyframeStyle ] ;
455+ const keyframeStyle = [ "animation" , options . keyframeStyle ] ;
469456
470457 applyInlineStyle ( node , keyframeStyle ) ;
471458 temporaryStyles . push ( keyframeStyle ) ;
@@ -523,8 +510,7 @@ export function AnimateCssProvider() {
523510 if ( flags . applyTransitionDuration ) {
524511 flags . hasTransitions = true ;
525512 timings . transitionDuration = maxDuration ;
526- applyOnlyDuration =
527- node . style [ TRANSITION_PROP + PROPERTY_KEY ] . length > 0 ;
513+ applyOnlyDuration = node . style . transitionProperty . length > 0 ;
528514 temporaryStyles . push (
529515 getCssTransitionDurationStyle ( maxDuration , applyOnlyDuration ) ,
530516 ) ;
@@ -896,24 +882,24 @@ export function AnimateCssProvider() {
896882 const easeVal = options . easing ;
897883
898884 if ( flags . hasTransitions ) {
899- easeProp = TRANSITION_PROP + TIMING_KEY ;
885+ easeProp = "transitionTimingFunction" ;
900886 temporaryStyles . push ( [ easeProp , easeVal ] ) ;
901887 node . style [ easeProp ] = easeVal ;
902888 }
903889
904890 if ( flags . hasAnimations ) {
905- easeProp = ANIMATION_PROP + TIMING_KEY ;
891+ easeProp = "animationTimingFunction" ;
906892 temporaryStyles . push ( [ easeProp , easeVal ] ) ;
907893 node . style [ easeProp ] = easeVal ;
908894 }
909895 }
910896
911897 if ( timings . transitionDuration ) {
912- events . push ( TRANSITIONEND_EVENT ) ;
898+ events . push ( "transitionend" ) ;
913899 }
914900
915901 if ( timings . animationDuration ) {
916- events . push ( ANIMATIONEND_EVENT ) ;
902+ events . push ( "animationend" ) ;
917903 }
918904
919905 startTime = Date . now ( ) ;
@@ -993,7 +979,7 @@ function blockTransitions(node, duration) {
993979 // same element which makes this safe for class-based animations
994980 const value = duration ? `-${ duration } s` : "" ;
995981
996- applyInlineStyle ( node , [ TRANSITION_DELAY_PROP , value ] ) ;
982+ applyInlineStyle ( node , [ "transitionDelay" , value ] ) ;
997983
998- return [ TRANSITION_DELAY_PROP , value ] ;
984+ return [ "transitionDelay" , value ] ;
999985}
0 commit comments