1
1
( function ( ) { var o ; "use strict" ; 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:white;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 ( i ) { console . error ( "vite-plugin-css-injected-by-js" , i ) } } ) ( ) ;
2
- import { defineComponent as D , createVNode as l , TransitionGroup as H , ref as $ , computed as g , onMounted as et , Fragment as C , isVNode as nt } from "vue" ;
3
- const R = /* @__PURE__ */ new Map ( ) ;
2
+ import { defineComponent as S , createVNode as l , TransitionGroup as R , ref as C , computed as g , onMounted as et , Fragment as M , isVNode as nt } from "vue" ;
3
+ const j = /* @__PURE__ */ new Map ( ) ;
4
4
class it {
5
5
constructor ( n , o , a ) {
6
6
this . remaining = o , this . callback = n , this . notifyItem = a , this . resume ( ) ;
@@ -28,7 +28,7 @@ function ot(t) {
28
28
} ) ;
29
29
} } ;
30
30
}
31
- const b = ot ( ) , T = "[-+]?[0-9]*.?[0-9]+" , M = [
31
+ const b = ot ( ) , T = "[-+]?[0-9]*.?[0-9]+" , k = [
32
32
{
33
33
name : "px" ,
34
34
regexp : new RegExp ( `^${ T } px$` )
@@ -51,8 +51,8 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
51
51
type : t ,
52
52
value : 0
53
53
} ;
54
- for ( let n = 0 ; n < M . length ; n ++ ) {
55
- const o = M [ n ] ;
54
+ for ( let n = 0 ; n < k . length ; n ++ ) {
55
+ const o = k [ n ] ;
56
56
if ( o . regexp . test ( t ) )
57
57
return {
58
58
type : o . name ,
@@ -72,14 +72,14 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
72
72
default :
73
73
return { type : "" , value : t } ;
74
74
}
75
- } , k = {
75
+ } , H = {
76
76
x : /* @__PURE__ */ new Set ( [ "left" , "center" , "right" ] ) ,
77
77
y : /* @__PURE__ */ new Set ( [ "top" , "bottom" ] )
78
78
} , st = ( ( t ) => ( ) => t ++ ) ( 0 ) , lt = ( t ) => typeof t != "string" ? [ ] : t . split ( / \s + / gi) . filter ( Boolean ) , ct = ( t ) => {
79
79
typeof t == "string" && ( t = lt ( t ) ) ;
80
80
let n = null , o = null ;
81
81
return t . forEach ( ( a ) => {
82
- k . y . has ( a ) && ( o = a ) , k . x . has ( a ) && ( n = a ) ;
82
+ H . y . has ( a ) && ( o = a ) , H . x . has ( a ) && ( n = a ) ;
83
83
} ) , { x : n , y : o } ;
84
84
} , E = {
85
85
position : [ "top" , "right" ] ,
@@ -94,7 +94,7 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
94
94
opacity : [ 0 , 1 ]
95
95
}
96
96
}
97
- } , ut = /* @__PURE__ */ D ( {
97
+ } , ut = /* @__PURE__ */ S ( {
98
98
name : "velocity-group" ,
99
99
inheritAttrs : ! 1 ,
100
100
props : {
@@ -121,7 +121,7 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
121
121
} , h = ( ) => {
122
122
o ( "afterLeave" ) ;
123
123
} ;
124
- return ( ) => l ( H , {
124
+ return ( ) => l ( R , {
125
125
tag : "div" ,
126
126
css : ! 1 ,
127
127
name : t . name ,
@@ -135,7 +135,7 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
135
135
}
136
136
} ) ;
137
137
}
138
- } ) , ft = /* @__PURE__ */ D ( {
138
+ } ) , ft = /* @__PURE__ */ S ( {
139
139
name : "css-group" ,
140
140
inheritAttrs : ! 1 ,
141
141
props : {
@@ -146,7 +146,7 @@ const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
146
146
} ,
147
147
setup : ( t , {
148
148
slots : n
149
- } ) => ( ) => l ( H , {
149
+ } ) => ( ) => l ( R , {
150
150
tag : "div" ,
151
151
name : t . name
152
152
} , {
@@ -162,7 +162,7 @@ function dt(t) {
162
162
const x = {
163
163
IDLE : 0 ,
164
164
DESTROYED : 2
165
- } , pt = /* @__PURE__ */ D ( {
165
+ } , pt = /* @__PURE__ */ S ( {
166
166
// eslint-disable-next-line vue/multi-word-component-names
167
167
name : "notifications" ,
168
168
props : {
@@ -255,77 +255,82 @@ const x = {
255
255
slots : o ,
256
256
expose : a
257
257
} ) => {
258
- const s = $ ( [ ] ) , h = $ ( null ) , c = R . get ( "velocity" ) , u = g ( ( ) => t . animationType === "velocity" ) , j = g ( ( ) => u . value ? ut : ft ) , f = g ( ( ) => s . value . filter ( ( e ) => e . state !== x . DESTROYED ) ) , A = g ( ( ) => rt ( t . width ) ) , N = g ( ( ) => {
258
+ const s = C ( [ ] ) , h = C ( null ) , c = j . get ( "velocity" ) , u = g ( ( ) => t . animationType === "velocity" ) , B = g ( ( ) => u . value ? ut : ft ) , f = g ( ( ) => s . value . filter ( ( e ) => e . state !== x . DESTROYED ) ) , N = g ( ( ) => rt ( t . width ) ) , O = g ( ( ) => {
259
259
const {
260
260
x : e ,
261
261
y : i
262
- } = ct ( t . position ) , r = A . value . value , d = A . value . type , m = {
262
+ } = ct ( t . position ) , r = N . value . value , d = N . value . type , m = {
263
263
width : r + d
264
264
} ;
265
265
return i && ( m [ i ] = "0px" ) , e && ( e === "center" ? m . left = `calc(50% - ${ + r / 2 } ${ d } )` : m [ e ] = "0px" ) , m ;
266
- } ) , O = g ( ( ) => "bottom" in N . value ) , B = ( e ) => {
266
+ } ) , w = g ( ( ) => "bottom" in O . value ) , V = ( e ) => {
267
267
n ( "click" , e ) , t . closeOnClick && y ( e ) ;
268
- } , V = ( ) => {
268
+ } , Y = ( ) => {
269
269
var e ;
270
270
t . pauseOnHover && ( ( e = h . value ) == null || e . pause ( ) ) ;
271
- } , Y = ( ) => {
271
+ } , G = ( ) => {
272
272
var e ;
273
273
t . pauseOnHover && ( ( e = h . value ) == null || e . resume ( ) ) ;
274
- } , G = ( e = { } ) => {
274
+ } , _ = ( e = { } ) => {
275
275
if ( e . group || ( e . group = "" ) , e . data || ( e . data = { } ) , t . group !== e . group )
276
276
return ;
277
277
if ( e . clean || e . clear ) {
278
- q ( ) ;
278
+ z ( ) ;
279
279
return ;
280
280
}
281
281
const i = typeof e . duration == "number" ? e . duration : t . duration , r = typeof e . speed == "number" ? e . speed : t . speed , d = typeof e . ignoreDuplicates == "boolean" ? e . ignoreDuplicates : t . ignoreDuplicates , {
282
282
title : m ,
283
- text : K ,
284
- type : Q ,
285
- data : U ,
286
- id : X
283
+ text : Q ,
284
+ type : U ,
285
+ data : X ,
286
+ id : Z
287
287
} = e , p = {
288
- id : X || st ( ) ,
288
+ id : Z || st ( ) ,
289
289
title : m ,
290
- text : K ,
291
- type : Q ,
290
+ text : Q ,
291
+ type : U ,
292
292
state : x . IDLE ,
293
293
speed : r ,
294
294
length : i + 2 * r ,
295
- data : U
295
+ data : X ,
296
+ duplicates : 0
296
297
} ;
297
298
i >= 0 && ( h . value = new it ( ( ) => y ( p ) , p . length , p ) ) ;
298
- const Z = t . reverse ? ! O . value : O . value ;
299
+ const tt = t . reverse ? ! w . value : w . value ;
299
300
let v = - 1 ;
300
- const tt = f . value . some ( ( L ) => L . title === e . title && L . text === e . text ) ;
301
- ( ! d || ! tt ) && ( Z ? ( s . value . push ( p ) , n ( "start" , p ) , f . value . length > t . max && ( v = 0 ) ) : ( s . value . unshift ( p ) , n ( "start" , p ) , f . value . length > t . max && ( v = f . value . length - 1 ) ) , v !== - 1 && y ( f . value [ v ] ) ) ;
302
- } , _ = ( e ) => {
303
- W ( e ) ;
304
- } , F = ( e ) => [ "vue-notification-template" , t . classes , e . type || "" ] , P = ( e ) => u . value ? void 0 : {
301
+ const L = f . value . find ( ( $ ) => $ . title === e . title && $ . text === e . text ) ;
302
+ if ( d && L ) {
303
+ L . duplicates ++ ;
304
+ return ;
305
+ }
306
+ tt ? ( s . value . push ( p ) , n ( "start" , p ) , f . value . length > t . max && ( v = 0 ) ) : ( s . value . unshift ( p ) , n ( "start" , p ) , f . value . length > t . max && ( v = f . value . length - 1 ) ) , v !== - 1 && y ( f . value [ v ] ) ;
307
+ } , F = ( e ) => {
308
+ q ( e ) ;
309
+ } , P = ( e ) => [ "vue-notification-template" , t . classes , e . type || "" ] , W = ( e ) => u . value ? void 0 : {
305
310
transition : `all ${ e . speed } ms`
306
311
} , y = ( e ) => {
307
312
clearTimeout ( e . timer ) , e . state = x . DESTROYED , I ( ) , n ( "destroy" , e ) ;
308
- } , W = ( e ) => {
313
+ } , q = ( e ) => {
309
314
const i = s . value . find ( ( r ) => r . id === e ) ;
310
315
i && y ( i ) ;
311
- } , q = ( ) => {
316
+ } , z = ( ) => {
312
317
f . value . forEach ( y ) ;
313
- } , w = ( e , i ) => {
318
+ } , A = ( e , i ) => {
314
319
var d ;
315
320
const r = ( d = t . animation ) == null ? void 0 : d [ e ] ;
316
321
return typeof r == "function" ? r ( i ) : r ;
317
- } , z = ( e , i ) => {
322
+ } , J = ( e , i ) => {
318
323
if ( ! u . value )
319
324
return ;
320
- const r = w ( "enter" , e ) ;
325
+ const r = A ( "enter" , e ) ;
321
326
c ( e , r , {
322
327
duration : t . speed ,
323
328
complete : i
324
329
} ) ;
325
- } , J = ( e , i ) => {
330
+ } , K = ( e , i ) => {
326
331
if ( ! u . value )
327
332
return ;
328
- const r = w ( "leave" , e ) ;
333
+ const r = A ( "leave" , e ) ;
329
334
c ( e , r , {
330
335
duration : t . speed ,
331
336
complete : i
@@ -335,38 +340,38 @@ const x = {
335
340
s . value = s . value . filter ( ( e ) => e . state !== x . DESTROYED ) ;
336
341
}
337
342
return et ( ( ) => {
338
- b . on ( "add" , G ) , b . on ( "close" , _ ) ;
343
+ b . on ( "add" , _ ) , b . on ( "close" , F ) ;
339
344
} ) , ( ) => {
340
345
let e ;
341
346
return l ( "div" , {
342
347
class : "vue-notification-group" ,
343
- style : N . value
344
- } , [ l ( j . value , {
348
+ style : O . value
349
+ } , [ l ( B . value , {
345
350
name : t . animationName ,
346
- onEnter : z ,
347
- onLeave : J ,
351
+ onEnter : J ,
352
+ onLeave : K ,
348
353
onAfterLeave : I
349
354
} , dt ( e = f . value . map ( ( i ) => l ( "div" , {
350
355
key : i . id ,
351
356
class : "vue-notification-wrapper" ,
352
- style : P ( i ) ,
357
+ style : W ( i ) ,
353
358
"data-id" : i . id ,
354
- onMouseenter : V ,
355
- onMouseleave : Y
359
+ onMouseenter : Y ,
360
+ onMouseleave : G
356
361
} , [ o . body ? o . body ( {
357
362
item : i ,
358
363
class : [ t . classes , i . type ] ,
359
364
close : ( ) => y ( i )
360
365
} ) : l ( "div" , {
361
- class : F ( i ) ,
362
- onClick : ( ) => B ( i )
363
- } , [ t . dangerouslySetInnerHtml ? l ( C , null , [ i . title ? l ( "div" , {
366
+ class : P ( i ) ,
367
+ onClick : ( ) => V ( i )
368
+ } , [ t . dangerouslySetInnerHtml ? l ( M , null , [ i . title ? l ( "div" , {
364
369
class : "notification-title" ,
365
370
innerHTML : i . title
366
371
} , null ) : null , l ( "div" , {
367
372
class : "notification-content" ,
368
373
innerHTML : i . text
369
- } , null ) ] ) : l ( C , null , [ i . title ? l ( "div" , {
374
+ } , null ) ] ) : l ( M , null , [ i . title ? l ( "div" , {
370
375
class : "notification-title"
371
376
} , [ i . title ] ) : null , l ( "div" , {
372
377
class : "notification-content"
@@ -375,24 +380,24 @@ const x = {
375
380
} ) ] ) ;
376
381
} ;
377
382
}
378
- } ) , S = ( t ) => {
383
+ } ) , D = ( t ) => {
379
384
typeof t == "string" && ( t = { title : "" , text : t } ) , typeof t == "object" && b . emit ( "add" , t ) ;
380
385
} ;
381
- S . close = ( t ) => {
386
+ D . close = ( t ) => {
382
387
b . emit ( "close" , t ) ;
383
388
} ;
384
- const vt = ( ) => ( { notify : S } ) , yt = "Notifications" ;
389
+ const ht = ( ) => ( { notify : D } ) , yt = "Notifications" ;
385
390
function mt ( t , n = { } ) {
386
- Object . entries ( n ) . forEach ( ( a ) => R . set ( ...a ) ) ;
391
+ Object . entries ( n ) . forEach ( ( a ) => j . set ( ...a ) ) ;
387
392
const o = n . name || "notify" ;
388
- t . config . globalProperties [ "$" + o ] = S , t . component ( n . componentName || yt , pt ) ;
393
+ t . config . globalProperties [ "$" + o ] = D , t . component ( n . componentName || yt , pt ) ;
389
394
}
390
- const xt = {
395
+ const vt = {
391
396
install : mt
392
397
} ;
393
398
export {
394
399
pt as Notifications ,
395
- xt as default ,
396
- S as notify ,
397
- vt as useNotification
400
+ vt as default ,
401
+ D as notify ,
402
+ ht as useNotification
398
403
} ;
0 commit comments