@@ -83,17 +83,6 @@ const createBehavior = (
8383 ...runtimeSettings ,
8484 } ;
8585
86- // handle case of already animating
87- // handle animation queuing
88- if ( self . isAnimating ( ) ) {
89- if ( settings . queue ) {
90- await self . animationsFinished ( ) ;
91- }
92- else {
93- self . stop ( ) ;
94- }
95- }
96-
9786 // determine canonical animations from css, this is cached between runs
9887 const cssAnimations = self . findCSSAnimation ( animationSettings . animation ) ;
9988
@@ -123,7 +112,6 @@ const createBehavior = (
123112 dispatchGroupEvent ( 'transitionGroupStarted' , {
124113 groupOrder,
125114 } ) ;
126- console . log ( 'group animation started' ) ;
127115 }
128116 if ( self . isLastInGroup ( direction ) ) {
129117 dispatchGroupEvent ( 'transitionGroupEnded' , {
@@ -250,6 +238,17 @@ const createBehavior = (
250238 return ;
251239 }
252240
241+ // handle case of already animating
242+ // handle animation queuing
243+ if ( self . isAnimating ( ) ) {
244+ if ( settings . queue ) {
245+ await $ ( el ) . afterEvent ( 'transition:end' ) ;
246+ }
247+ else {
248+ self . stop ( ) ;
249+ }
250+ }
251+
253252 // find animations for this particular direction (array of animations)
254253 const animationsToPlay = cssAnimations . animations [ direction ] ?? cssAnimations . animations . standard ;
255254
@@ -283,9 +282,9 @@ const createBehavior = (
283282 return el . animate ( animData . keyframes , options ) ;
284283 } ) ;
285284
286- dispatchEvent ( 'transitionScheduled ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
285+ dispatchEvent ( 'scheduled ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
287286 await self . animationsStarted ( activeAnimations ) ;
288- dispatchEvent ( 'transitionStarted ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
287+ dispatchEvent ( 'started ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
289288
290289 // make element visible
291290 self . setInitialDisplayState ( direction ) ;
@@ -300,16 +299,16 @@ const createBehavior = (
300299
301300 // Handle show/hide callbacks based on direction
302301 if ( direction === 'in' ) {
303- dispatchEvent ( 'transitionVisible ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
302+ dispatchEvent ( 'visible ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
304303 settings . onShow . call ( el ) ;
305304 }
306305 else if ( direction === 'out' ) {
307- dispatchEvent ( 'transitionHidden ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
306+ dispatchEvent ( 'hidden ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
308307 settings . onHide . call ( el ) ;
309308 }
310309
311310 // can use callback, event or await this function
312- dispatchEvent ( 'transitionEnded ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
311+ dispatchEvent ( 'end ' , { cssAnimations : cssAnimations , animations : activeAnimations } ) ;
313312 callback . call ( el ) ;
314313 } ,
315314
0 commit comments