@bagelink/vue 1.6.36 → 1.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/EmailInput.vue.d.ts.map +1 -1
- package/dist/dist-76Ukdba8.js +713 -0
- package/dist/dist-BeGE8xoH.cjs +1 -0
- package/dist/dist-RFX0YUEq.cjs +1 -0
- package/dist/dist-XUySYNnc.js +2 -0
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4951 -4885
- package/dist/plugins/useModal.d.ts +1 -0
- package/dist/plugins/useModal.d.ts.map +1 -1
- package/dist/plugins/useToast.d.ts +15 -0
- package/dist/plugins/useToast.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -3
- package/src/components/Modal.vue +10 -22
- package/src/components/form/inputs/EmailInput.vue +30 -49
- package/src/composables/index.ts +2 -2
- package/src/index.ts +1 -0
- package/src/plugins/useModal.ts +108 -17
- package/src/plugins/useToast.ts +92 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
import { Fragment, TransitionGroup, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, inject, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, provide, renderList, renderSlot, resolveComponent, resolveDynamicComponent, toDisplayString, toHandlers, toRaw, unref, withCtx, withModifiers } from "vue";
|
|
2
|
+
var __defProp = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (g, G, K) => G in g ? __defProp(g, G, {
|
|
3
|
+
enumerable: !0,
|
|
4
|
+
configurable: !0,
|
|
5
|
+
writable: !0,
|
|
6
|
+
value: K
|
|
7
|
+
}) : g[G] = K, __spreadValues = (g, G) => {
|
|
8
|
+
for (var K in G ||= {}) __hasOwnProp.call(G, K) && __defNormalProp(g, K, G[K]);
|
|
9
|
+
if (__getOwnPropSymbols) for (var K of __getOwnPropSymbols(G)) __propIsEnum.call(G, K) && __defNormalProp(g, K, G[K]);
|
|
10
|
+
return g;
|
|
11
|
+
}, isFunction = (g) => typeof g == "function", isString = (g) => typeof g == "string", isNonEmptyString = (g) => isString(g) && g.trim().length > 0, isNumber = (g) => typeof g == "number", isUndefined = (g) => g === void 0, isObject = (g) => typeof g == "object" && !!g, isJSX = (g) => hasProp(g, "tag") && isNonEmptyString(g.tag), isTouchEvent = (g) => window.TouchEvent && g instanceof TouchEvent, isToastComponent = (g) => hasProp(g, "component") && isToastContent(g.component), isVueComponent = (g) => isFunction(g) || isObject(g), isToastContent = (g) => !isUndefined(g) && (isString(g) || isVueComponent(g) || isToastComponent(g)), isDOMRect = (g) => isObject(g) && [
|
|
12
|
+
"height",
|
|
13
|
+
"width",
|
|
14
|
+
"right",
|
|
15
|
+
"left",
|
|
16
|
+
"top",
|
|
17
|
+
"bottom"
|
|
18
|
+
].every((G) => isNumber(g[G])), hasProp = (g, G) => (isObject(g) || isFunction(g)) && G in g, getId = ((g) => () => g++)(0);
|
|
19
|
+
function getX(g) {
|
|
20
|
+
return isTouchEvent(g) ? g.targetTouches[0].clientX : g.clientX;
|
|
21
|
+
}
|
|
22
|
+
function getY(g) {
|
|
23
|
+
return isTouchEvent(g) ? g.targetTouches[0].clientY : g.clientY;
|
|
24
|
+
}
|
|
25
|
+
var removeElement = (g) => {
|
|
26
|
+
isUndefined(g.remove) ? g.parentNode && g.parentNode.removeChild(g) : g.remove();
|
|
27
|
+
}, getVueComponentFromObj = (g) => isToastComponent(g) ? getVueComponentFromObj(g.component) : isJSX(g) ? defineComponent({ render() {
|
|
28
|
+
return g;
|
|
29
|
+
} }) : typeof g == "string" ? g : toRaw(unref(g)), normalizeToastComponent = (g) => {
|
|
30
|
+
if (typeof g == "string") return g;
|
|
31
|
+
let G = hasProp(g, "props") && isObject(g.props) ? g.props : {}, K = hasProp(g, "listeners") && isObject(g.listeners) ? g.listeners : {};
|
|
32
|
+
return {
|
|
33
|
+
component: getVueComponentFromObj(g),
|
|
34
|
+
props: G,
|
|
35
|
+
listeners: K
|
|
36
|
+
};
|
|
37
|
+
}, isBrowser = () => typeof window < "u", EventBus = class {
|
|
38
|
+
constructor() {
|
|
39
|
+
this.allHandlers = {};
|
|
40
|
+
}
|
|
41
|
+
getHandlers(g) {
|
|
42
|
+
return this.allHandlers[g] || [];
|
|
43
|
+
}
|
|
44
|
+
on(g, G) {
|
|
45
|
+
let K = this.getHandlers(g);
|
|
46
|
+
K.push(G), this.allHandlers[g] = K;
|
|
47
|
+
}
|
|
48
|
+
off(g, G) {
|
|
49
|
+
let K = this.getHandlers(g);
|
|
50
|
+
K.splice(K.indexOf(G) >>> 0, 1);
|
|
51
|
+
}
|
|
52
|
+
emit(g, G) {
|
|
53
|
+
this.getHandlers(g).forEach((g) => g(G));
|
|
54
|
+
}
|
|
55
|
+
}, isEventBusInterface = (g) => [
|
|
56
|
+
"on",
|
|
57
|
+
"off",
|
|
58
|
+
"emit"
|
|
59
|
+
].every((G) => hasProp(g, G) && isFunction(g[G])), TYPE;
|
|
60
|
+
(function(g) {
|
|
61
|
+
g.SUCCESS = "success", g.ERROR = "error", g.WARNING = "warning", g.INFO = "info", g.DEFAULT = "default";
|
|
62
|
+
})(TYPE ||= {});
|
|
63
|
+
var POSITION;
|
|
64
|
+
(function(g) {
|
|
65
|
+
g.TOP_LEFT = "top-left", g.TOP_CENTER = "top-center", g.TOP_RIGHT = "top-right", g.BOTTOM_LEFT = "bottom-left", g.BOTTOM_CENTER = "bottom-center", g.BOTTOM_RIGHT = "bottom-right";
|
|
66
|
+
})(POSITION ||= {});
|
|
67
|
+
var EVENTS;
|
|
68
|
+
(function(g) {
|
|
69
|
+
g.ADD = "add", g.DISMISS = "dismiss", g.UPDATE = "update", g.CLEAR = "clear", g.UPDATE_DEFAULTS = "update_defaults";
|
|
70
|
+
})(EVENTS ||= {});
|
|
71
|
+
var VT_NAMESPACE = "Vue-Toastification", COMMON = {
|
|
72
|
+
type: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: TYPE.DEFAULT
|
|
75
|
+
},
|
|
76
|
+
classNames: {
|
|
77
|
+
type: [String, Array],
|
|
78
|
+
default: () => []
|
|
79
|
+
},
|
|
80
|
+
trueBoolean: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !0
|
|
83
|
+
}
|
|
84
|
+
}, ICON = {
|
|
85
|
+
type: COMMON.type,
|
|
86
|
+
customIcon: {
|
|
87
|
+
type: [
|
|
88
|
+
String,
|
|
89
|
+
Boolean,
|
|
90
|
+
Object,
|
|
91
|
+
Function
|
|
92
|
+
],
|
|
93
|
+
default: !0
|
|
94
|
+
}
|
|
95
|
+
}, CLOSE_BUTTON = {
|
|
96
|
+
component: {
|
|
97
|
+
type: [
|
|
98
|
+
String,
|
|
99
|
+
Object,
|
|
100
|
+
Function,
|
|
101
|
+
Boolean
|
|
102
|
+
],
|
|
103
|
+
default: "button"
|
|
104
|
+
},
|
|
105
|
+
classNames: COMMON.classNames,
|
|
106
|
+
showOnHover: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: !1
|
|
109
|
+
},
|
|
110
|
+
ariaLabel: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: "close"
|
|
113
|
+
}
|
|
114
|
+
}, PROGRESS_BAR = {
|
|
115
|
+
timeout: {
|
|
116
|
+
type: [Number, Boolean],
|
|
117
|
+
default: 5e3
|
|
118
|
+
},
|
|
119
|
+
hideProgressBar: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: !1
|
|
122
|
+
},
|
|
123
|
+
isRunning: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: !1
|
|
126
|
+
}
|
|
127
|
+
}, TRANSITION = { transition: {
|
|
128
|
+
type: [Object, String],
|
|
129
|
+
default: `${VT_NAMESPACE}__bounce`
|
|
130
|
+
} }, propValidators_default = {
|
|
131
|
+
CORE_TOAST: {
|
|
132
|
+
position: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: POSITION.TOP_RIGHT
|
|
135
|
+
},
|
|
136
|
+
draggable: COMMON.trueBoolean,
|
|
137
|
+
draggablePercent: {
|
|
138
|
+
type: Number,
|
|
139
|
+
default: .6
|
|
140
|
+
},
|
|
141
|
+
pauseOnFocusLoss: COMMON.trueBoolean,
|
|
142
|
+
pauseOnHover: COMMON.trueBoolean,
|
|
143
|
+
closeOnClick: COMMON.trueBoolean,
|
|
144
|
+
timeout: PROGRESS_BAR.timeout,
|
|
145
|
+
hideProgressBar: PROGRESS_BAR.hideProgressBar,
|
|
146
|
+
toastClassName: COMMON.classNames,
|
|
147
|
+
bodyClassName: COMMON.classNames,
|
|
148
|
+
icon: ICON.customIcon,
|
|
149
|
+
closeButton: CLOSE_BUTTON.component,
|
|
150
|
+
closeButtonClassName: CLOSE_BUTTON.classNames,
|
|
151
|
+
showCloseButtonOnHover: CLOSE_BUTTON.showOnHover,
|
|
152
|
+
accessibility: {
|
|
153
|
+
type: Object,
|
|
154
|
+
default: () => ({
|
|
155
|
+
toastRole: "alert",
|
|
156
|
+
closeButtonLabel: "close"
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
rtl: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: !1
|
|
162
|
+
},
|
|
163
|
+
eventBus: {
|
|
164
|
+
type: Object,
|
|
165
|
+
required: !1,
|
|
166
|
+
default: () => new EventBus()
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
TOAST: {
|
|
170
|
+
id: {
|
|
171
|
+
type: [String, Number],
|
|
172
|
+
required: !0,
|
|
173
|
+
default: 0
|
|
174
|
+
},
|
|
175
|
+
type: COMMON.type,
|
|
176
|
+
content: {
|
|
177
|
+
type: [
|
|
178
|
+
String,
|
|
179
|
+
Object,
|
|
180
|
+
Function
|
|
181
|
+
],
|
|
182
|
+
required: !0,
|
|
183
|
+
default: ""
|
|
184
|
+
},
|
|
185
|
+
onClick: {
|
|
186
|
+
type: Function,
|
|
187
|
+
default: void 0
|
|
188
|
+
},
|
|
189
|
+
onClose: {
|
|
190
|
+
type: Function,
|
|
191
|
+
default: void 0
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
CONTAINER: {
|
|
195
|
+
container: {
|
|
196
|
+
type: [Object, Function],
|
|
197
|
+
default: () => document.body
|
|
198
|
+
},
|
|
199
|
+
newestOnTop: COMMON.trueBoolean,
|
|
200
|
+
maxToasts: {
|
|
201
|
+
type: Number,
|
|
202
|
+
default: 20
|
|
203
|
+
},
|
|
204
|
+
transition: TRANSITION.transition,
|
|
205
|
+
toastDefaults: Object,
|
|
206
|
+
filterBeforeCreate: {
|
|
207
|
+
type: Function,
|
|
208
|
+
default: (g) => g
|
|
209
|
+
},
|
|
210
|
+
filterToasts: {
|
|
211
|
+
type: Function,
|
|
212
|
+
default: (g) => g
|
|
213
|
+
},
|
|
214
|
+
containerClassName: COMMON.classNames,
|
|
215
|
+
onMounted: Function,
|
|
216
|
+
shareAppContext: [Boolean, Object]
|
|
217
|
+
},
|
|
218
|
+
PROGRESS_BAR,
|
|
219
|
+
ICON,
|
|
220
|
+
TRANSITION,
|
|
221
|
+
CLOSE_BUTTON
|
|
222
|
+
}, VtProgressBar_default = defineComponent({
|
|
223
|
+
name: "VtProgressBar",
|
|
224
|
+
props: propValidators_default.PROGRESS_BAR,
|
|
225
|
+
data() {
|
|
226
|
+
return { hasClass: !0 };
|
|
227
|
+
},
|
|
228
|
+
computed: {
|
|
229
|
+
style() {
|
|
230
|
+
return {
|
|
231
|
+
animationDuration: `${this.timeout}ms`,
|
|
232
|
+
animationPlayState: this.isRunning ? "running" : "paused",
|
|
233
|
+
opacity: this.hideProgressBar ? 0 : 1
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
cpClass() {
|
|
237
|
+
return this.hasClass ? `${VT_NAMESPACE}__progress-bar` : "";
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
watch: { timeout() {
|
|
241
|
+
this.hasClass = !1, this.$nextTick(() => this.hasClass = !0);
|
|
242
|
+
} },
|
|
243
|
+
mounted() {
|
|
244
|
+
this.$el.addEventListener("animationend", this.animationEnded);
|
|
245
|
+
},
|
|
246
|
+
beforeUnmount() {
|
|
247
|
+
this.$el.removeEventListener("animationend", this.animationEnded);
|
|
248
|
+
},
|
|
249
|
+
methods: { animationEnded() {
|
|
250
|
+
this.$emit("close-toast");
|
|
251
|
+
} }
|
|
252
|
+
});
|
|
253
|
+
function render(g, G) {
|
|
254
|
+
return openBlock(), createElementBlock("div", {
|
|
255
|
+
style: normalizeStyle(g.style),
|
|
256
|
+
class: normalizeClass(g.cpClass)
|
|
257
|
+
}, null, 6);
|
|
258
|
+
}
|
|
259
|
+
VtProgressBar_default.render = render;
|
|
260
|
+
var VtProgressBar_default2 = VtProgressBar_default, VtCloseButton_default = defineComponent({
|
|
261
|
+
name: "VtCloseButton",
|
|
262
|
+
props: propValidators_default.CLOSE_BUTTON,
|
|
263
|
+
computed: {
|
|
264
|
+
buttonComponent() {
|
|
265
|
+
return this.component === !1 ? "button" : getVueComponentFromObj(this.component);
|
|
266
|
+
},
|
|
267
|
+
classes() {
|
|
268
|
+
let g = [`${VT_NAMESPACE}__close-button`];
|
|
269
|
+
return this.showOnHover && g.push("show-on-hover"), g.concat(this.classNames);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}), _hoisted_1 = /* @__PURE__ */ createTextVNode(" × ");
|
|
273
|
+
function render2(g, G) {
|
|
274
|
+
return openBlock(), createBlock(resolveDynamicComponent(g.buttonComponent), mergeProps({
|
|
275
|
+
"aria-label": g.ariaLabel,
|
|
276
|
+
class: g.classes
|
|
277
|
+
}, g.$attrs), {
|
|
278
|
+
default: withCtx(() => [_hoisted_1]),
|
|
279
|
+
_: 1
|
|
280
|
+
}, 16, ["aria-label", "class"]);
|
|
281
|
+
}
|
|
282
|
+
VtCloseButton_default.render = render2;
|
|
283
|
+
var VtCloseButton_default2 = VtCloseButton_default, VtSuccessIcon_default = {}, _hoisted_12 = {
|
|
284
|
+
"aria-hidden": "true",
|
|
285
|
+
focusable: "false",
|
|
286
|
+
"data-prefix": "fas",
|
|
287
|
+
"data-icon": "check-circle",
|
|
288
|
+
class: "svg-inline--fa fa-check-circle fa-w-16",
|
|
289
|
+
role: "img",
|
|
290
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
291
|
+
viewBox: "0 0 512 512"
|
|
292
|
+
}, _hoisted_3 = [/* @__PURE__ */ createElementVNode("path", {
|
|
293
|
+
fill: "currentColor",
|
|
294
|
+
d: "M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"
|
|
295
|
+
}, null, -1)];
|
|
296
|
+
function render3(g, G) {
|
|
297
|
+
return openBlock(), createElementBlock("svg", _hoisted_12, _hoisted_3);
|
|
298
|
+
}
|
|
299
|
+
VtSuccessIcon_default.render = render3;
|
|
300
|
+
var VtSuccessIcon_default2 = VtSuccessIcon_default, VtInfoIcon_default = {}, _hoisted_13 = {
|
|
301
|
+
"aria-hidden": "true",
|
|
302
|
+
focusable: "false",
|
|
303
|
+
"data-prefix": "fas",
|
|
304
|
+
"data-icon": "info-circle",
|
|
305
|
+
class: "svg-inline--fa fa-info-circle fa-w-16",
|
|
306
|
+
role: "img",
|
|
307
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
308
|
+
viewBox: "0 0 512 512"
|
|
309
|
+
}, _hoisted_32 = [/* @__PURE__ */ createElementVNode("path", {
|
|
310
|
+
fill: "currentColor",
|
|
311
|
+
d: "M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"
|
|
312
|
+
}, null, -1)];
|
|
313
|
+
function render4(g, G) {
|
|
314
|
+
return openBlock(), createElementBlock("svg", _hoisted_13, _hoisted_32);
|
|
315
|
+
}
|
|
316
|
+
VtInfoIcon_default.render = render4;
|
|
317
|
+
var VtInfoIcon_default2 = VtInfoIcon_default, VtWarningIcon_default = {}, _hoisted_14 = {
|
|
318
|
+
"aria-hidden": "true",
|
|
319
|
+
focusable: "false",
|
|
320
|
+
"data-prefix": "fas",
|
|
321
|
+
"data-icon": "exclamation-circle",
|
|
322
|
+
class: "svg-inline--fa fa-exclamation-circle fa-w-16",
|
|
323
|
+
role: "img",
|
|
324
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
325
|
+
viewBox: "0 0 512 512"
|
|
326
|
+
}, _hoisted_33 = [/* @__PURE__ */ createElementVNode("path", {
|
|
327
|
+
fill: "currentColor",
|
|
328
|
+
d: "M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
|
|
329
|
+
}, null, -1)];
|
|
330
|
+
function render5(g, G) {
|
|
331
|
+
return openBlock(), createElementBlock("svg", _hoisted_14, _hoisted_33);
|
|
332
|
+
}
|
|
333
|
+
VtWarningIcon_default.render = render5;
|
|
334
|
+
var VtWarningIcon_default2 = VtWarningIcon_default, VtErrorIcon_default = {}, _hoisted_15 = {
|
|
335
|
+
"aria-hidden": "true",
|
|
336
|
+
focusable: "false",
|
|
337
|
+
"data-prefix": "fas",
|
|
338
|
+
"data-icon": "exclamation-triangle",
|
|
339
|
+
class: "svg-inline--fa fa-exclamation-triangle fa-w-18",
|
|
340
|
+
role: "img",
|
|
341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
342
|
+
viewBox: "0 0 576 512"
|
|
343
|
+
}, _hoisted_34 = [/* @__PURE__ */ createElementVNode("path", {
|
|
344
|
+
fill: "currentColor",
|
|
345
|
+
d: "M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
|
|
346
|
+
}, null, -1)];
|
|
347
|
+
function render6(g, G) {
|
|
348
|
+
return openBlock(), createElementBlock("svg", _hoisted_15, _hoisted_34);
|
|
349
|
+
}
|
|
350
|
+
VtErrorIcon_default.render = render6;
|
|
351
|
+
var VtErrorIcon_default2 = VtErrorIcon_default, VtIcon_default = defineComponent({
|
|
352
|
+
name: "VtIcon",
|
|
353
|
+
props: propValidators_default.ICON,
|
|
354
|
+
computed: {
|
|
355
|
+
customIconChildren() {
|
|
356
|
+
return hasProp(this.customIcon, "iconChildren") ? this.trimValue(this.customIcon.iconChildren) : "";
|
|
357
|
+
},
|
|
358
|
+
customIconClass() {
|
|
359
|
+
return isString(this.customIcon) ? this.trimValue(this.customIcon) : hasProp(this.customIcon, "iconClass") ? this.trimValue(this.customIcon.iconClass) : "";
|
|
360
|
+
},
|
|
361
|
+
customIconTag() {
|
|
362
|
+
return hasProp(this.customIcon, "iconTag") ? this.trimValue(this.customIcon.iconTag, "i") : "i";
|
|
363
|
+
},
|
|
364
|
+
hasCustomIcon() {
|
|
365
|
+
return this.customIconClass.length > 0;
|
|
366
|
+
},
|
|
367
|
+
component() {
|
|
368
|
+
return this.hasCustomIcon ? this.customIconTag : isToastContent(this.customIcon) ? getVueComponentFromObj(this.customIcon) : this.iconTypeComponent;
|
|
369
|
+
},
|
|
370
|
+
iconTypeComponent() {
|
|
371
|
+
return {
|
|
372
|
+
[TYPE.DEFAULT]: VtInfoIcon_default2,
|
|
373
|
+
[TYPE.INFO]: VtInfoIcon_default2,
|
|
374
|
+
[TYPE.SUCCESS]: VtSuccessIcon_default2,
|
|
375
|
+
[TYPE.ERROR]: VtErrorIcon_default2,
|
|
376
|
+
[TYPE.WARNING]: VtWarningIcon_default2
|
|
377
|
+
}[this.type];
|
|
378
|
+
},
|
|
379
|
+
iconClasses() {
|
|
380
|
+
let g = [`${VT_NAMESPACE}__icon`];
|
|
381
|
+
return this.hasCustomIcon ? g.concat(this.customIconClass) : g;
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
methods: { trimValue(g, G = "") {
|
|
385
|
+
return isNonEmptyString(g) ? g.trim() : G;
|
|
386
|
+
} }
|
|
387
|
+
});
|
|
388
|
+
function render7(g, G) {
|
|
389
|
+
return openBlock(), createBlock(resolveDynamicComponent(g.component), { class: normalizeClass(g.iconClasses) }, {
|
|
390
|
+
default: withCtx(() => [createTextVNode(toDisplayString(g.customIconChildren), 1)]),
|
|
391
|
+
_: 1
|
|
392
|
+
}, 8, ["class"]);
|
|
393
|
+
}
|
|
394
|
+
VtIcon_default.render = render7;
|
|
395
|
+
var VtToast_default = defineComponent({
|
|
396
|
+
name: "VtToast",
|
|
397
|
+
components: {
|
|
398
|
+
ProgressBar: VtProgressBar_default2,
|
|
399
|
+
CloseButton: VtCloseButton_default2,
|
|
400
|
+
Icon: VtIcon_default
|
|
401
|
+
},
|
|
402
|
+
inheritAttrs: !1,
|
|
403
|
+
props: Object.assign({}, propValidators_default.CORE_TOAST, propValidators_default.TOAST),
|
|
404
|
+
data() {
|
|
405
|
+
return {
|
|
406
|
+
isRunning: !0,
|
|
407
|
+
disableTransitions: !1,
|
|
408
|
+
beingDragged: !1,
|
|
409
|
+
dragStart: 0,
|
|
410
|
+
dragPos: {
|
|
411
|
+
x: 0,
|
|
412
|
+
y: 0
|
|
413
|
+
},
|
|
414
|
+
dragRect: {}
|
|
415
|
+
};
|
|
416
|
+
},
|
|
417
|
+
computed: {
|
|
418
|
+
classes() {
|
|
419
|
+
let g = [
|
|
420
|
+
`${VT_NAMESPACE}__toast`,
|
|
421
|
+
`${VT_NAMESPACE}__toast--${this.type}`,
|
|
422
|
+
`${this.position}`
|
|
423
|
+
].concat(this.toastClassName);
|
|
424
|
+
return this.disableTransitions && g.push("disable-transition"), this.rtl && g.push(`${VT_NAMESPACE}__toast--rtl`), g;
|
|
425
|
+
},
|
|
426
|
+
bodyClasses() {
|
|
427
|
+
return [`${VT_NAMESPACE}__toast-${isString(this.content) ? "body" : "component-body"}`].concat(this.bodyClassName);
|
|
428
|
+
},
|
|
429
|
+
draggableStyle() {
|
|
430
|
+
return this.dragStart === this.dragPos.x ? {} : this.beingDragged ? {
|
|
431
|
+
transform: `translateX(${this.dragDelta}px)`,
|
|
432
|
+
opacity: 1 - Math.abs(this.dragDelta / this.removalDistance)
|
|
433
|
+
} : {
|
|
434
|
+
transition: "transform 0.2s, opacity 0.2s",
|
|
435
|
+
transform: "translateX(0)",
|
|
436
|
+
opacity: 1
|
|
437
|
+
};
|
|
438
|
+
},
|
|
439
|
+
dragDelta() {
|
|
440
|
+
return this.beingDragged ? this.dragPos.x - this.dragStart : 0;
|
|
441
|
+
},
|
|
442
|
+
removalDistance() {
|
|
443
|
+
return isDOMRect(this.dragRect) ? (this.dragRect.right - this.dragRect.left) * this.draggablePercent : 0;
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
mounted() {
|
|
447
|
+
this.draggable && this.draggableSetup(), this.pauseOnFocusLoss && this.focusSetup();
|
|
448
|
+
},
|
|
449
|
+
beforeUnmount() {
|
|
450
|
+
this.draggable && this.draggableCleanup(), this.pauseOnFocusLoss && this.focusCleanup();
|
|
451
|
+
},
|
|
452
|
+
methods: {
|
|
453
|
+
hasProp,
|
|
454
|
+
getVueComponentFromObj,
|
|
455
|
+
closeToast() {
|
|
456
|
+
this.eventBus.emit(EVENTS.DISMISS, this.id);
|
|
457
|
+
},
|
|
458
|
+
clickHandler() {
|
|
459
|
+
this.onClick && this.onClick(this.closeToast), this.closeOnClick && (!this.beingDragged || this.dragStart === this.dragPos.x) && this.closeToast();
|
|
460
|
+
},
|
|
461
|
+
timeoutHandler() {
|
|
462
|
+
this.closeToast();
|
|
463
|
+
},
|
|
464
|
+
hoverPause() {
|
|
465
|
+
this.pauseOnHover && (this.isRunning = !1);
|
|
466
|
+
},
|
|
467
|
+
hoverPlay() {
|
|
468
|
+
this.pauseOnHover && (this.isRunning = !0);
|
|
469
|
+
},
|
|
470
|
+
focusPause() {
|
|
471
|
+
this.isRunning = !1;
|
|
472
|
+
},
|
|
473
|
+
focusPlay() {
|
|
474
|
+
this.isRunning = !0;
|
|
475
|
+
},
|
|
476
|
+
focusSetup() {
|
|
477
|
+
addEventListener("blur", this.focusPause), addEventListener("focus", this.focusPlay);
|
|
478
|
+
},
|
|
479
|
+
focusCleanup() {
|
|
480
|
+
removeEventListener("blur", this.focusPause), removeEventListener("focus", this.focusPlay);
|
|
481
|
+
},
|
|
482
|
+
draggableSetup() {
|
|
483
|
+
let g = this.$el;
|
|
484
|
+
g.addEventListener("touchstart", this.onDragStart, { passive: !0 }), g.addEventListener("mousedown", this.onDragStart), addEventListener("touchmove", this.onDragMove, { passive: !1 }), addEventListener("mousemove", this.onDragMove), addEventListener("touchend", this.onDragEnd), addEventListener("mouseup", this.onDragEnd);
|
|
485
|
+
},
|
|
486
|
+
draggableCleanup() {
|
|
487
|
+
let g = this.$el;
|
|
488
|
+
g.removeEventListener("touchstart", this.onDragStart), g.removeEventListener("mousedown", this.onDragStart), removeEventListener("touchmove", this.onDragMove), removeEventListener("mousemove", this.onDragMove), removeEventListener("touchend", this.onDragEnd), removeEventListener("mouseup", this.onDragEnd);
|
|
489
|
+
},
|
|
490
|
+
onDragStart(g) {
|
|
491
|
+
this.beingDragged = !0, this.dragPos = {
|
|
492
|
+
x: getX(g),
|
|
493
|
+
y: getY(g)
|
|
494
|
+
}, this.dragStart = getX(g), this.dragRect = this.$el.getBoundingClientRect();
|
|
495
|
+
},
|
|
496
|
+
onDragMove(g) {
|
|
497
|
+
this.beingDragged && (g.preventDefault(), this.isRunning &&= !1, this.dragPos = {
|
|
498
|
+
x: getX(g),
|
|
499
|
+
y: getY(g)
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
onDragEnd() {
|
|
503
|
+
this.beingDragged && (Math.abs(this.dragDelta) >= this.removalDistance ? (this.disableTransitions = !0, this.$nextTick(() => this.closeToast())) : setTimeout(() => {
|
|
504
|
+
this.beingDragged = !1, isDOMRect(this.dragRect) && this.pauseOnHover && this.dragRect.bottom >= this.dragPos.y && this.dragPos.y >= this.dragRect.top && this.dragRect.left <= this.dragPos.x && this.dragPos.x <= this.dragRect.right ? this.isRunning = !1 : this.isRunning = !0;
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}), _hoisted_16 = ["role"];
|
|
509
|
+
function render8(G, K) {
|
|
510
|
+
let Z = resolveComponent("Icon"), Q = resolveComponent("CloseButton"), $ = resolveComponent("ProgressBar");
|
|
511
|
+
return openBlock(), createElementBlock("div", {
|
|
512
|
+
class: normalizeClass(G.classes),
|
|
513
|
+
style: normalizeStyle(G.draggableStyle),
|
|
514
|
+
onClick: K[0] ||= (...g) => G.clickHandler && G.clickHandler(...g),
|
|
515
|
+
onMouseenter: K[1] ||= (...g) => G.hoverPause && G.hoverPause(...g),
|
|
516
|
+
onMouseleave: K[2] ||= (...g) => G.hoverPlay && G.hoverPlay(...g)
|
|
517
|
+
}, [
|
|
518
|
+
G.icon ? (openBlock(), createBlock(Z, {
|
|
519
|
+
key: 0,
|
|
520
|
+
"custom-icon": G.icon,
|
|
521
|
+
type: G.type
|
|
522
|
+
}, null, 8, ["custom-icon", "type"])) : createCommentVNode("v-if", !0),
|
|
523
|
+
createElementVNode("div", {
|
|
524
|
+
role: G.accessibility.toastRole || "alert",
|
|
525
|
+
class: normalizeClass(G.bodyClasses)
|
|
526
|
+
}, [typeof G.content == "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(G.content), 1)], 2112)) : (openBlock(), createBlock(resolveDynamicComponent(G.getVueComponentFromObj(G.content)), mergeProps({
|
|
527
|
+
key: 1,
|
|
528
|
+
"toast-id": G.id
|
|
529
|
+
}, G.hasProp(G.content, "props") ? G.content.props : {}, toHandlers(G.hasProp(G.content, "listeners") ? G.content.listeners : {}), { onCloseToast: G.closeToast }), null, 16, ["toast-id", "onCloseToast"]))], 10, _hoisted_16),
|
|
530
|
+
G.closeButton ? (openBlock(), createBlock(Q, {
|
|
531
|
+
key: 1,
|
|
532
|
+
component: G.closeButton,
|
|
533
|
+
"class-names": G.closeButtonClassName,
|
|
534
|
+
"show-on-hover": G.showCloseButtonOnHover,
|
|
535
|
+
"aria-label": G.accessibility.closeButtonLabel,
|
|
536
|
+
onClick: withModifiers(G.closeToast, ["stop"])
|
|
537
|
+
}, null, 8, [
|
|
538
|
+
"component",
|
|
539
|
+
"class-names",
|
|
540
|
+
"show-on-hover",
|
|
541
|
+
"aria-label",
|
|
542
|
+
"onClick"
|
|
543
|
+
])) : createCommentVNode("v-if", !0),
|
|
544
|
+
G.timeout ? (openBlock(), createBlock($, {
|
|
545
|
+
key: 2,
|
|
546
|
+
"is-running": G.isRunning,
|
|
547
|
+
"hide-progress-bar": G.hideProgressBar,
|
|
548
|
+
timeout: G.timeout,
|
|
549
|
+
onCloseToast: G.timeoutHandler
|
|
550
|
+
}, null, 8, [
|
|
551
|
+
"is-running",
|
|
552
|
+
"hide-progress-bar",
|
|
553
|
+
"timeout",
|
|
554
|
+
"onCloseToast"
|
|
555
|
+
])) : createCommentVNode("v-if", !0)
|
|
556
|
+
], 38);
|
|
557
|
+
}
|
|
558
|
+
VtToast_default.render = render8;
|
|
559
|
+
var VtToast_default2 = VtToast_default, VtTransition_default = defineComponent({
|
|
560
|
+
name: "VtTransition",
|
|
561
|
+
props: propValidators_default.TRANSITION,
|
|
562
|
+
emits: ["leave"],
|
|
563
|
+
methods: {
|
|
564
|
+
hasProp,
|
|
565
|
+
leave(g) {
|
|
566
|
+
g instanceof HTMLElement && (g.style.left = g.offsetLeft + "px", g.style.top = g.offsetTop + "px", g.style.width = getComputedStyle(g).width, g.style.position = "absolute");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
function render9(g, K) {
|
|
571
|
+
return openBlock(), createBlock(TransitionGroup, {
|
|
572
|
+
tag: "div",
|
|
573
|
+
"enter-active-class": g.transition.enter ? g.transition.enter : `${g.transition}-enter-active`,
|
|
574
|
+
"move-class": g.transition.move ? g.transition.move : `${g.transition}-move`,
|
|
575
|
+
"leave-active-class": g.transition.leave ? g.transition.leave : `${g.transition}-leave-active`,
|
|
576
|
+
onLeave: g.leave
|
|
577
|
+
}, {
|
|
578
|
+
default: withCtx(() => [renderSlot(g.$slots, "default")]),
|
|
579
|
+
_: 3
|
|
580
|
+
}, 8, [
|
|
581
|
+
"enter-active-class",
|
|
582
|
+
"move-class",
|
|
583
|
+
"leave-active-class",
|
|
584
|
+
"onLeave"
|
|
585
|
+
]);
|
|
586
|
+
}
|
|
587
|
+
VtTransition_default.render = render9;
|
|
588
|
+
var VtToastContainer_default = defineComponent({
|
|
589
|
+
name: "VueToastification",
|
|
590
|
+
devtools: { hide: !0 },
|
|
591
|
+
components: {
|
|
592
|
+
Toast: VtToast_default2,
|
|
593
|
+
VtTransition: VtTransition_default
|
|
594
|
+
},
|
|
595
|
+
props: Object.assign({}, propValidators_default.CORE_TOAST, propValidators_default.CONTAINER, propValidators_default.TRANSITION),
|
|
596
|
+
data() {
|
|
597
|
+
return {
|
|
598
|
+
count: 0,
|
|
599
|
+
positions: Object.values(POSITION),
|
|
600
|
+
toasts: {},
|
|
601
|
+
defaults: {}
|
|
602
|
+
};
|
|
603
|
+
},
|
|
604
|
+
computed: {
|
|
605
|
+
toastArray() {
|
|
606
|
+
return Object.values(this.toasts);
|
|
607
|
+
},
|
|
608
|
+
filteredToasts() {
|
|
609
|
+
return this.defaults.filterToasts(this.toastArray);
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
beforeMount() {
|
|
613
|
+
let g = this.eventBus;
|
|
614
|
+
g.on(EVENTS.ADD, this.addToast), g.on(EVENTS.CLEAR, this.clearToasts), g.on(EVENTS.DISMISS, this.dismissToast), g.on(EVENTS.UPDATE, this.updateToast), g.on(EVENTS.UPDATE_DEFAULTS, this.updateDefaults), this.defaults = this.$props;
|
|
615
|
+
},
|
|
616
|
+
mounted() {
|
|
617
|
+
this.setup(this.container);
|
|
618
|
+
},
|
|
619
|
+
methods: {
|
|
620
|
+
async setup(g) {
|
|
621
|
+
isFunction(g) && (g = await g()), removeElement(this.$el), g.appendChild(this.$el);
|
|
622
|
+
},
|
|
623
|
+
setToast(g) {
|
|
624
|
+
isUndefined(g.id) || (this.toasts[g.id] = g);
|
|
625
|
+
},
|
|
626
|
+
addToast(g) {
|
|
627
|
+
g.content = normalizeToastComponent(g.content);
|
|
628
|
+
let G = Object.assign({}, this.defaults, g.type && this.defaults.toastDefaults && this.defaults.toastDefaults[g.type], g), K = this.defaults.filterBeforeCreate(G, this.toastArray);
|
|
629
|
+
K && this.setToast(K);
|
|
630
|
+
},
|
|
631
|
+
dismissToast(g) {
|
|
632
|
+
let G = this.toasts[g];
|
|
633
|
+
!isUndefined(G) && !isUndefined(G.onClose) && G.onClose(), delete this.toasts[g];
|
|
634
|
+
},
|
|
635
|
+
clearToasts() {
|
|
636
|
+
Object.keys(this.toasts).forEach((g) => {
|
|
637
|
+
this.dismissToast(g);
|
|
638
|
+
});
|
|
639
|
+
},
|
|
640
|
+
getPositionToasts(g) {
|
|
641
|
+
let G = this.filteredToasts.filter((G) => G.position === g).slice(0, this.defaults.maxToasts);
|
|
642
|
+
return this.defaults.newestOnTop ? G.reverse() : G;
|
|
643
|
+
},
|
|
644
|
+
updateDefaults(g) {
|
|
645
|
+
isUndefined(g.container) || this.setup(g.container), this.defaults = Object.assign({}, this.defaults, g);
|
|
646
|
+
},
|
|
647
|
+
updateToast({ id: g, options: G, create: K }) {
|
|
648
|
+
this.toasts[g] ? (G.timeout && G.timeout === this.toasts[g].timeout && G.timeout++, this.setToast(Object.assign({}, this.toasts[g], G))) : K && this.addToast(Object.assign({}, { id: g }, G));
|
|
649
|
+
},
|
|
650
|
+
getClasses(g) {
|
|
651
|
+
return [`${VT_NAMESPACE}__container`, g].concat(this.defaults.containerClassName);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
function render10(G, K) {
|
|
656
|
+
let J = resolveComponent("Toast"), X = resolveComponent("VtTransition");
|
|
657
|
+
return openBlock(), createElementBlock("div", null, [(openBlock(!0), createElementBlock(Fragment, null, renderList(G.positions, (K) => (openBlock(), createElementBlock("div", { key: K }, [createVNode(X, {
|
|
658
|
+
transition: G.defaults.transition,
|
|
659
|
+
class: normalizeClass(G.getClasses(K))
|
|
660
|
+
}, {
|
|
661
|
+
default: withCtx(() => [(openBlock(!0), createElementBlock(Fragment, null, renderList(G.getPositionToasts(K), (g) => (openBlock(), createBlock(J, mergeProps({ key: g.id }, g), null, 16))), 128))]),
|
|
662
|
+
_: 2
|
|
663
|
+
}, 1032, ["transition", "class"])]))), 128))]);
|
|
664
|
+
}
|
|
665
|
+
VtToastContainer_default.render = render10;
|
|
666
|
+
var VtToastContainer_default2 = VtToastContainer_default, buildInterface = (g = {}, G = !0) => {
|
|
667
|
+
let q = g.eventBus = g.eventBus || new EventBus();
|
|
668
|
+
G && nextTick(() => {
|
|
669
|
+
let G = createApp(VtToastContainer_default2, __spreadValues({}, g)), q = G.mount(document.createElement("div")), J = g.onMounted;
|
|
670
|
+
if (isUndefined(J) || J(q, G), g.shareAppContext) {
|
|
671
|
+
let K = g.shareAppContext;
|
|
672
|
+
K === !0 ? console.warn(`[${VT_NAMESPACE}] App to share context with was not provided.`) : (G._context.components = K._context.components, G._context.directives = K._context.directives, G._context.mixins = K._context.mixins, G._context.provides = K._context.provides, G.config.globalProperties = K.config.globalProperties);
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
let J = (g, G) => {
|
|
676
|
+
let K = Object.assign({}, {
|
|
677
|
+
id: getId(),
|
|
678
|
+
type: TYPE.DEFAULT
|
|
679
|
+
}, G, { content: g });
|
|
680
|
+
return q.emit(EVENTS.ADD, K), K.id;
|
|
681
|
+
};
|
|
682
|
+
J.clear = () => q.emit(EVENTS.CLEAR, void 0), J.updateDefaults = (g) => {
|
|
683
|
+
q.emit(EVENTS.UPDATE_DEFAULTS, g);
|
|
684
|
+
}, J.dismiss = (g) => {
|
|
685
|
+
q.emit(EVENTS.DISMISS, g);
|
|
686
|
+
};
|
|
687
|
+
function Y(g, { content: G, options: K }, J = !1) {
|
|
688
|
+
let Y = Object.assign({}, K, { content: G });
|
|
689
|
+
q.emit(EVENTS.UPDATE, {
|
|
690
|
+
id: g,
|
|
691
|
+
options: Y,
|
|
692
|
+
create: J
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
return J.update = Y, J.success = (g, G) => J(g, Object.assign({}, G, { type: TYPE.SUCCESS })), J.info = (g, G) => J(g, Object.assign({}, G, { type: TYPE.INFO })), J.error = (g, G) => J(g, Object.assign({}, G, { type: TYPE.ERROR })), J.warning = (g, G) => J(g, Object.assign({}, G, { type: TYPE.WARNING })), J;
|
|
696
|
+
}, createMockToastInterface = () => {
|
|
697
|
+
let g = () => console.warn(`[${VT_NAMESPACE}] This plugin does not support SSR!`);
|
|
698
|
+
return new Proxy(g, { get() {
|
|
699
|
+
return g;
|
|
700
|
+
} });
|
|
701
|
+
};
|
|
702
|
+
function createToastInterface(g) {
|
|
703
|
+
return isBrowser() ? isEventBusInterface(g) ? buildInterface({ eventBus: g }, !1) : buildInterface(g, !0) : createMockToastInterface();
|
|
704
|
+
}
|
|
705
|
+
var toastInjectionKey = Symbol("VueToastification"), globalEventBus = new EventBus(), VueToastificationPlugin = (g, G) => {
|
|
706
|
+
G?.shareAppContext === !0 && (G.shareAppContext = g);
|
|
707
|
+
let K = createToastInterface(__spreadValues({ eventBus: globalEventBus }, G));
|
|
708
|
+
g.provide(toastInjectionKey, K);
|
|
709
|
+
}, provideToast = (g) => {
|
|
710
|
+
let G = createToastInterface(g);
|
|
711
|
+
getCurrentInstance() && provide(toastInjectionKey, G);
|
|
712
|
+
}, useToast = (g) => g ? createToastInterface(g) : (getCurrentInstance() ? inject(toastInjectionKey, void 0) : void 0) || createToastInterface(globalEventBus), src_default = VueToastificationPlugin;
|
|
713
|
+
export { globalEventBus as a, toastInjectionKey as c, createToastInterface as i, useToast as l, POSITION as n, provideToast as o, TYPE as r, src_default as s, EventBus as t };
|