11( function ( ) { "use strict" ; var o ; try { if ( typeof document < "u" ) { var e = document . createElement ( "style" ) ; e . nonce = ( o = document . head . querySelector ( "meta[property=csp-nonce]" ) ) == null ?void 0 :o . content , e . appendChild ( document . createTextNode ( ".vue-notification-group{display:block;position:fixed;z-index:5000}.vue-notification-wrapper{display:block;overflow:hidden;width:100%;margin:0;padding:0}.notification-title{font-weight:600}.vue-notification-template{display:block;box-sizing:border-box;background:#fff;text-align:left}.vue-notification{display:block;box-sizing:border-box;text-align:left;font-size:12px;padding:10px;margin:0 5px 5px;color:#fff;background:#44a4fc;border-left:5px solid #187FE7}.vue-notification.warn{background:#ffb648;border-left-color:#f48a06}.vue-notification.error{background:#e54d42;border-left-color:#b82e24}.vue-notification.success{background:#68cd86;border-left-color:#42a85f}.vn-fade-enter-active,.vn-fade-leave-active,.vn-fade-move{transition:all .5s}.vn-fade-enter-from,.vn-fade-leave-to{opacity:0}" ) ) , document . head . appendChild ( e ) } } catch ( n ) { console . error ( "vite-plugin-css-injected-by-js" , n ) } } ) ( ) ;
2- import { defineComponent as Z , ref as M , computed as y , onMounted as tt , createVNode as l , TransitionGroup as et , mergeProps as nt , Fragment as k , isVNode as it } from "vue" ;
3- const j = /* @__PURE__ */ new Map ( ) ;
4- class ot {
5- constructor ( i , o , a ) {
6- this . remaining = o , this . callback = i , this . notifyItem = a , this . resume ( ) ;
7- }
8- pause ( ) {
9- clearTimeout ( this . notifyItem . timer ) , this . remaining -= Date . now ( ) - this . start ;
10- }
11- resume ( ) {
12- this . start = Date . now ( ) , clearTimeout ( this . notifyItem . timer ) , this . notifyItem . timer = setTimeout ( this . callback , this . remaining ) ;
13- }
14- }
15- function at ( t ) {
16- return { all : t = t || /* @__PURE__ */ new Map ( ) , on : function ( i , o ) {
17- var a = t . get ( i ) ;
18- a ? a . push ( o ) : t . set ( i , [ o ] ) ;
19- } , off : function ( i , o ) {
20- var a = t . get ( i ) ;
21- a && ( o ? a . splice ( a . indexOf ( o ) >>> 0 , 1 ) : t . set ( i , [ ] ) ) ;
22- } , emit : function ( i , o ) {
23- var a = t . get ( i ) ;
2+ import { defineComponent as U , ref as X , computed as g , onMounted as Z , createVNode as l , TransitionGroup as tt , mergeProps as et , Fragment as $ , isVNode as nt } from "vue" ;
3+ const R = /* @__PURE__ */ new Map ( ) ;
4+ function ot ( t ) {
5+ return { all : t = t || /* @__PURE__ */ new Map ( ) , on : function ( o , i ) {
6+ var a = t . get ( o ) ;
7+ a ? a . push ( i ) : t . set ( o , [ i ] ) ;
8+ } , off : function ( o , i ) {
9+ var a = t . get ( o ) ;
10+ a && ( i ? a . splice ( a . indexOf ( i ) >>> 0 , 1 ) : t . set ( o , [ ] ) ) ;
11+ } , emit : function ( o , i ) {
12+ var a = t . get ( o ) ;
2413 a && a . slice ( ) . map ( function ( r ) {
25- r ( o ) ;
14+ r ( i ) ;
2615 } ) , ( a = t . get ( "*" ) ) && a . slice ( ) . map ( function ( r ) {
27- r ( i , o ) ;
16+ r ( o , i ) ;
2817 } ) ;
2918 } } ;
3019}
31- const h = at ( ) , b = "[-+]?[0-9]*.?[0-9]+" , H = [
20+ const v = ot ( ) , T = "[-+]?[0-9]*.?[0-9]+" , M = [
3221 {
3322 name : "px" ,
34- regexp : new RegExp ( `^${ b } px$` )
23+ regexp : new RegExp ( `^${ T } px$` )
3524 } ,
3625 {
3726 name : "%" ,
38- regexp : new RegExp ( `^${ b } %$` )
27+ regexp : new RegExp ( `^${ T } %$` )
3928 } ,
4029 /**
4130 * Fallback option
4231 * If no suffix specified, assigning "px"
4332 */
4433 {
4534 name : "px" ,
46- regexp : new RegExp ( `^${ b } $` )
35+ regexp : new RegExp ( `^${ T } $` )
4736 }
48- ] , st = ( t ) => {
37+ ] , it = ( t ) => {
4938 if ( t === "auto" )
5039 return {
5140 type : t ,
5241 value : 0
5342 } ;
54- for ( let i = 0 ; i < H . length ; i ++ ) {
55- const o = H [ i ] ;
56- if ( o . regexp . test ( t ) )
43+ for ( let o = 0 ; o < M . length ; o ++ ) {
44+ const i = M [ o ] ;
45+ if ( i . regexp . test ( t ) )
5746 return {
58- type : o . name ,
47+ type : i . name ,
5948 value : parseFloat ( t )
6049 } ;
6150 }
6251 return {
6352 type : "" ,
6453 value : t
6554 } ;
66- } , rt = ( t ) => {
55+ } , at = ( t ) => {
6756 switch ( typeof t ) {
6857 case "number" :
6958 return { type : "px" , value : t } ;
7059 case "string" :
71- return st ( t ) ;
60+ return it ( t ) ;
7261 default :
7362 return { type : "" , value : t } ;
7463 }
75- } , R = {
64+ } , H = {
7665 x : /* @__PURE__ */ new Set ( [ "left" , "center" , "right" ] ) ,
7766 y : /* @__PURE__ */ new Set ( [ "top" , "bottom" ] )
78- } , lt = /* @__PURE__ */ ( ( t ) => ( ) => t ++ ) ( 0 ) , ct = ( t ) => typeof t != "string" ? [ ] : t . split ( / \s + / gi) . filter ( Boolean ) , ut = ( t ) => {
79- typeof t == "string" && ( t = ct ( t ) ) ;
80- let i = null , o = null ;
67+ } , st = /* @__PURE__ */ ( ( t ) => ( ) => t ++ ) ( 0 ) , rt = ( t ) => typeof t != "string" ? [ ] : t . split ( / \s + / gi) . filter ( Boolean ) , lt = ( t ) => {
68+ typeof t == "string" && ( t = rt ( t ) ) ;
69+ let o = null , i = null ;
8170 return t . forEach ( ( a ) => {
82- R . y . has ( a ) && ( o = a ) , R . x . has ( a ) && ( i = a ) ;
83- } ) , { x : i , y : o } ;
84- } , T = {
71+ H . y . has ( a ) && ( i = a ) , H . x . has ( a ) && ( o = a ) ;
72+ } ) , { x : o , y : i } ;
73+ } , b = {
8574 position : [ "top" , "right" ] ,
8675 cssAnimation : "vn-fade" ,
8776 velocityAnimation : {
@@ -94,14 +83,25 @@ const h = at(), b = "[-+]?[0-9]*.?[0-9]+", H = [
9483 opacity : [ 0 , 1 ]
9584 }
9685 }
86+ } , ct = ( t , o ) => {
87+ let i , a , r = o ;
88+ const y = ( ) => {
89+ a = Date . now ( ) , i = setTimeout ( t , r ) ;
90+ } , m = ( ) => {
91+ clearTimeout ( i ) , r -= Date . now ( ) - a ;
92+ } ;
93+ return y ( ) , {
94+ start : y ,
95+ stop : m
96+ } ;
9797} ;
98- function ft ( t ) {
99- return typeof t == "function" || Object . prototype . toString . call ( t ) === "[object Object]" && ! it ( t ) ;
98+ function ut ( t ) {
99+ return typeof t == "function" || Object . prototype . toString . call ( t ) === "[object Object]" && ! nt ( t ) ;
100100}
101- const g = {
101+ const x = {
102102 IDLE : 0 ,
103103 DESTROYED : 2
104- } , dt = /* @__PURE__ */ Z ( {
104+ } , ft = /* @__PURE__ */ U ( {
105105 // eslint-disable-next-line vue/multi-word-component-names
106106 name : "notifications" ,
107107 props : {
@@ -123,7 +123,7 @@ const g = {
123123 } ,
124124 position : {
125125 type : [ String , Array ] ,
126- default : ( ) => T . position
126+ default : ( ) => b . position
127127 } ,
128128 classes : {
129129 type : [ String , Array ] ,
@@ -139,12 +139,12 @@ const g = {
139139 animation : {
140140 type : Object ,
141141 default ( ) {
142- return T . velocityAnimation ;
142+ return b . velocityAnimation ;
143143 }
144144 } ,
145145 animationName : {
146146 type : String ,
147- default : T . cssAnimation
147+ default : b . cssAnimation
148148 } ,
149149 speed : {
150150 type : Number ,
@@ -190,126 +190,127 @@ const g = {
190190 } ,
191191 slots : Object ,
192192 setup : ( t , {
193- emit : i ,
194- slots : o ,
193+ emit : o ,
194+ slots : i ,
195195 expose : a
196196 } ) => {
197- const r = M ( [ ] ) , x = M ( null ) , D = j . get ( "velocity" ) , v = y ( ( ) => t . animationType === "velocity" ) , c = y ( ( ) => r . value . filter ( ( e ) => e . state !== g . DESTROYED ) ) , S = y ( ( ) => rt ( t . width ) ) , N = y ( ( ) => {
197+ const r = X ( [ ] ) , y = R . get ( "velocity" ) , m = g ( ( ) => t . animationType === "velocity" ) , c = g ( ( ) => r . value . filter ( ( e ) => e . state !== x . DESTROYED ) ) , D = g ( ( ) => at ( t . width ) ) , S = g ( ( ) => {
198198 const {
199199 x : e ,
200200 y : n
201- } = ut ( t . position ) , s = S . value . value , u = S . value . type , p = {
201+ } = lt ( t . position ) , s = D . value . value , u = D . value . type , p = {
202202 width : s + u
203203 } ;
204204 return n && ( p [ n ] = "0px" ) , e && ( e === "center" ? p . left = `calc(50% - ${ + s / 2 } ${ u } )` : p [ e ] = "0px" ) , p ;
205- } ) , B = y ( ( ) => v . value ? {
206- onEnter : q ,
207- onLeave : z ,
208- onAfterLeave : w
209- } : { } ) , C = ( e ) => {
210- i ( "click" , e ) , t . closeOnClick && d ( e ) ;
211- } , L = ( ) => {
212- var e ;
213- t . pauseOnHover && ( ( e = x . value ) == null || e . pause ( ) ) ;
214- } , P = ( ) => {
215- var e ;
216- t . pauseOnHover && ( ( e = x . value ) == null || e . resume ( ) ) ;
217- } , Y = ( e = { } ) => {
205+ } ) , j = g ( ( ) => m . value ? {
206+ onEnter : G ,
207+ onLeave : W ,
208+ onAfterLeave : O
209+ } : { } ) , B = ( e ) => {
210+ o ( "click" , e ) , t . closeOnClick && d ( e ) ;
211+ } , L = ( e ) => {
212+ var n ;
213+ t . pauseOnHover && ( ( n = e . timer ) == null || n . stop ( ) ) ;
214+ } , k = ( e ) => {
215+ var n ;
216+ t . pauseOnHover && ( ( n = e . timer ) == null || n . start ( ) ) ;
217+ } , C = ( e = { } ) => {
218218 if ( e . group || ( e . group = "" ) , e . data || ( e . data = { } ) , t . group !== e . group )
219219 return ;
220220 if ( e . clean || e . clear ) {
221- W ( ) ;
221+ F ( ) ;
222222 return ;
223223 }
224224 const n = typeof e . duration == "number" ? e . duration : t . duration , s = typeof e . speed == "number" ? e . speed : t . speed , u = typeof e . ignoreDuplicates == "boolean" ? e . ignoreDuplicates : t . ignoreDuplicates , {
225225 title : p ,
226- text : J ,
227- type : K ,
228- data : Q ,
229- id : U
226+ text : q ,
227+ type : z ,
228+ data : J ,
229+ id : K
230230 } = e , f = {
231- id : U || lt ( ) ,
231+ id : K || st ( ) ,
232232 title : p ,
233- text : J ,
234- type : K ,
235- state : g . IDLE ,
233+ text : q ,
234+ type : z ,
235+ state : x . IDLE ,
236236 speed : s ,
237237 length : n + 2 * s ,
238- data : Q ,
238+ data : J ,
239239 duplicates : 0
240240 } ;
241- n >= 0 && ( x . value = new ot ( ( ) => d ( f ) , f . length , f ) ) ;
242- const I = "bottom" in N . value , X = t . reverse ? ! I : I ;
243- let m = - 1 ;
244- const A = c . value . find ( ( $ ) => $ . title === e . title && $ . text === e . text ) ;
241+ n >= 0 && ( f . timer = ct ( ( ) => d ( f ) , f . length ) ) ;
242+ const w = "bottom" in S . value , Q = t . reverse ? ! w : w ;
243+ let h = - 1 ;
244+ const A = c . value . find ( ( I ) => I . title === e . title && I . text === e . text ) ;
245245 if ( u && A ) {
246246 A . duplicates ++ ;
247247 return ;
248248 }
249- X ? ( r . value . push ( f ) , i ( "start" , f ) , c . value . length > t . max && ( m = 0 ) ) : ( r . value . unshift ( f ) , i ( "start" , f ) , c . value . length > t . max && ( m = c . value . length - 1 ) ) , m !== - 1 && d ( c . value [ m ] ) ;
250- } , V = ( e ) => {
251- G ( e ) ;
252- } , _ = ( e ) => [ "vue-notification-template" , t . classes , e . type || "" ] , F = ( e ) => v . value ? void 0 : {
249+ Q ? ( r . value . push ( f ) , o ( "start" , f ) , c . value . length > t . max && ( h = 0 ) ) : ( r . value . unshift ( f ) , o ( "start" , f ) , c . value . length > t . max && ( h = c . value . length - 1 ) ) , h !== - 1 && d ( c . value [ h ] ) ;
250+ } , P = ( e ) => {
251+ _ ( e ) ;
252+ } , Y = ( e ) => [ "vue-notification-template" , t . classes , e . type || "" ] , V = ( e ) => m . value ? void 0 : {
253253 transition : `all ${ e . speed } ms`
254254 } , d = ( e ) => {
255- clearTimeout ( e . timer ) , e . state = g . DESTROYED , w ( ) , i ( "destroy" , e ) ;
256- } , G = ( e ) => {
255+ var n ;
256+ ( n = e . timer ) == null || n . stop ( ) , e . state = x . DESTROYED , O ( ) , o ( "destroy" , e ) ;
257+ } , _ = ( e ) => {
257258 const n = r . value . find ( ( s ) => s . id === e ) ;
258259 n && d ( n ) ;
259- } , W = ( ) => {
260+ } , F = ( ) => {
260261 c . value . forEach ( d ) ;
261- } , O = ( e , n ) => {
262+ } , N = ( e , n ) => {
262263 var u ;
263264 const s = ( u = t . animation ) == null ? void 0 : u [ e ] ;
264265 return typeof s == "function" ? s ( n ) : s ;
265- } , q = ( e , n ) => {
266- const s = O ( "enter" , e ) ;
267- D ( e , s , {
266+ } , G = ( e , n ) => {
267+ const s = N ( "enter" , e ) ;
268+ y ( e , s , {
268269 duration : t . speed ,
269270 complete : n
270271 } ) ;
271- } , z = ( e , n ) => {
272- const s = O ( "leave" , e ) ;
273- D ( e , s , {
272+ } , W = ( e , n ) => {
273+ const s = N ( "leave" , e ) ;
274+ y ( e , s , {
274275 duration : t . speed ,
275276 complete : n
276277 } ) ;
277278 } ;
278- function w ( ) {
279- r . value = r . value . filter ( ( e ) => e . state !== g . DESTROYED ) ;
279+ function O ( ) {
280+ r . value = r . value . filter ( ( e ) => e . state !== x . DESTROYED ) ;
280281 }
281- return tt ( ( ) => {
282- h . on ( "add" , Y ) , h . on ( "close" , V ) ;
282+ return Z ( ( ) => {
283+ v . on ( "add" , C ) , v . on ( "close" , P ) ;
283284 } ) , ( ) => {
284285 let e ;
285286 return l ( "div" , {
286287 class : "vue-notification-group" ,
287- style : N . value
288- } , [ l ( et , nt ( B . value , {
288+ style : S . value
289+ } , [ l ( tt , et ( j . value , {
289290 tag : "div" ,
290- css : ! v . value ,
291+ css : ! m . value ,
291292 name : t . animationName
292- } ) , ft ( e = c . value . map ( ( n ) => l ( "div" , {
293+ } ) , ut ( e = c . value . map ( ( n ) => l ( "div" , {
293294 key : n . id ,
294295 class : "vue-notification-wrapper" ,
295- style : F ( n ) ,
296+ style : V ( n ) ,
296297 "data-id" : n . id ,
297- onMouseenter : L ,
298- onMouseleave : P
299- } , [ o . body ? o . body ( {
298+ onMouseenter : ( ) => L ( n ) ,
299+ onMouseleave : ( ) => k ( n )
300+ } , [ i . body ? i . body ( {
300301 item : n ,
301302 class : [ t . classes , n . type ] ,
302303 close : ( ) => d ( n )
303304 } ) : l ( "div" , {
304- class : _ ( n ) ,
305- onClick : ( ) => C ( n )
306- } , [ t . dangerouslySetInnerHtml ? l ( k , null , [ n . title ? l ( "div" , {
305+ class : Y ( n ) ,
306+ onClick : ( ) => B ( n )
307+ } , [ t . dangerouslySetInnerHtml ? l ( $ , null , [ n . title ? l ( "div" , {
307308 class : "notification-title" ,
308309 innerHTML : n . title
309310 } , null ) : null , l ( "div" , {
310311 class : "notification-content" ,
311312 innerHTML : n . text
312- } , null ) ] ) : l ( k , null , [ n . title ? l ( "div" , {
313+ } , null ) ] ) : l ( $ , null , [ n . title ? l ( "div" , {
313314 class : "notification-title"
314315 } , [ n . title ] ) : null , l ( "div" , {
315316 class : "notification-content"
@@ -319,23 +320,23 @@ const g = {
319320 } ;
320321 }
321322} ) , E = ( t ) => {
322- typeof t == "string" && ( t = { title : "" , text : t } ) , typeof t == "object" && h . emit ( "add" , t ) ;
323+ typeof t == "string" && ( t = { title : "" , text : t } ) , typeof t == "object" && v . emit ( "add" , t ) ;
323324} ;
324325E . close = ( t ) => {
325- h . emit ( "close" , t ) ;
326+ v . emit ( "close" , t ) ;
326327} ;
327- const gt = ( ) => ( { notify : E } ) , pt = "Notifications" ;
328- function yt ( t , i = { } ) {
329- Object . entries ( i ) . forEach ( ( a ) => j . set ( ...a ) ) ;
330- const o = i . name || "notify" ;
331- t . config . globalProperties [ "$" + o ] = E , t . component ( i . componentName || pt , dt ) ;
328+ const mt = ( ) => ( { notify : E } ) , dt = "Notifications" ;
329+ function pt ( t , o = { } ) {
330+ Object . entries ( o ) . forEach ( ( a ) => R . set ( ...a ) ) ;
331+ const i = o . name || "notify" ;
332+ t . config . globalProperties [ "$" + i ] = E , t . component ( o . componentName || dt , ft ) ;
332333}
333- const ht = {
334- install : yt
334+ const gt = {
335+ install : pt
335336} ;
336337export {
337- dt as Notifications ,
338- ht as default ,
338+ ft as Notifications ,
339+ gt as default ,
339340 E as notify ,
340- gt as useNotification
341+ mt as useNotification
341342} ;
0 commit comments