@@ -13,6 +13,7 @@ export default class Stack {
1313 maxStrategy : 'wait' ,
1414 maxClosureCausesWait : true ,
1515 modal : 'ish' ,
16+ modalishFlash : true ,
1617 overlayClose : true ,
1718 overlayClosesPinned : false ,
1819 context : ( window && document . body ) || null
@@ -161,7 +162,7 @@ export default class Stack {
161162 }
162163
163164 // Position the notice.
164- _positionNotice ( notice ) {
165+ _positionNotice ( notice , masking = notice === this . _masking ) {
165166 // Get the notice's stack.
166167 const elem = notice . refs . elem ;
167168 if ( ! elem ) {
@@ -172,7 +173,7 @@ export default class Stack {
172173 if (
173174 ! elem . classList . contains ( 'ui-pnotify-in' ) &&
174175 ! elem . classList . contains ( 'ui-pnotify-initial-hidden' ) &&
175- notice !== this . _masking
176+ ! masking
176177 ) {
177178 return ;
178179 }
@@ -190,7 +191,7 @@ export default class Stack {
190191 // Read from the DOM to cause refresh.
191192 elem . getBoundingClientRect ( ) ;
192193
193- if ( this . _animation && notice !== this . _masking && ! this . _collapsingModalState ) {
194+ if ( this . _animation && ! masking && ! this . _collapsingModalState ) {
194195 // Add animate class.
195196 notice . _setMoveClass ( 'ui-pnotify-move' ) ;
196197 } else {
@@ -265,7 +266,7 @@ export default class Stack {
265266
266267 // Don't move masking notices along dir2. They should always be beside the
267268 // leader along dir1.
268- if ( notice !== this . _masking ) {
269+ if ( ! masking ) {
269270 // Check that it's not beyond the viewport edge.
270271 const endY = _nextpos1 + elem . offsetHeight + this . spacing1 ;
271272 const endX = _nextpos1 + elem . offsetWidth + this . spacing1 ;
@@ -361,7 +362,7 @@ export default class Stack {
361362 }
362363
363364 // If we're not positioning the masking notice, update the stack properties.
364- if ( notice !== this . _masking ) {
365+ if ( ! masking ) {
365366 this . firstpos1 = firstpos1 ;
366367 this . firstpos2 = firstpos2 ;
367368 this . _nextpos1 = _nextpos1 ;
@@ -402,9 +403,22 @@ export default class Stack {
402403 this . context . addEventListener ( 'pnotify:position' , this . _listener ) ;
403404 }
404405
405- // If the notice is already open, handle it immediately.
406406 if ( [ 'open' , 'opening' , 'closing' ] . indexOf ( notice . getState ( ) ) !== - 1 ) {
407+ // If the notice is already open, handle it immediately.
407408 this . _handleNoticeOpened ( notice ) ;
409+ } else if ( this . modal === 'ish' && this . modalishFlash && this . _shouldNoticeWait ( ) ) {
410+ // If it's not open, and it's going to be a waiting notice, flash it.
411+ const off = notice . on ( 'pnotify:mount' , ( ) => {
412+ off ( ) ;
413+ notice . _setMasking ( this . dir1 , false , ( ) => {
414+ notice . _setMasking ( false ) ;
415+ } ) ;
416+ this . _resetPositionData ( ) ;
417+ this . _positionNotice ( this . _leader ) ;
418+ window . requestAnimationFrame ( ( ) => {
419+ this . _positionNotice ( notice , true ) ;
420+ } ) ;
421+ } ) ;
408422 }
409423 }
410424
0 commit comments