@samline/notify 1.0.2 → 2.0.0
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/{LICENSE → LICENSE.md} +2 -2
- package/README.md +27 -163
- package/dist/_runtime.d.mts +87 -0
- package/dist/_runtime.d.ts +87 -0
- package/dist/_runtime.js +97 -0
- package/dist/_runtime.mjs +83 -0
- package/dist/browser/assets-client-B-VVPPYQ.js +114 -0
- package/dist/browser/assets-client-CUzxHubR.mjs +108 -0
- package/dist/browser/index-client-BBOQyMFk.mjs +173 -0
- package/dist/browser/index-client-Czb7hTpD.js +181 -0
- package/dist/browser/index.d.mts +134 -0
- package/dist/browser/index.d.ts +134 -0
- package/dist/browser/index.js +34 -0
- package/dist/browser/index.mjs +26 -0
- package/dist/browser/render-client-CjcQoukB.js +981 -0
- package/dist/browser/render-client-bGRSTd-L.mjs +974 -0
- package/dist/core/index.d.mts +68 -0
- package/dist/core/index.d.ts +68 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.mjs +1 -0
- package/dist/index.d.mts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +1240 -0
- package/dist/index.mjs +1228 -0
- package/dist/react/index.d.mts +158 -0
- package/dist/react/index.d.ts +158 -0
- package/dist/react/index.js +1116 -0
- package/dist/react/index.mjs +1107 -0
- package/dist/styles.css +589 -422
- package/dist/svelte/assets-client-B-VVPPYQ.js +114 -0
- package/dist/svelte/assets-client-CUzxHubR.mjs +108 -0
- package/dist/svelte/index-client-DbXbWMIe.js +177 -0
- package/dist/svelte/index-client-Dj_WfPK9.mjs +170 -0
- package/dist/svelte/index.d.mts +14 -0
- package/dist/svelte/index.d.ts +14 -0
- package/dist/svelte/index.js +43 -0
- package/dist/svelte/index.mjs +36 -0
- package/dist/svelte/render-client-CjcQoukB.js +981 -0
- package/dist/svelte/render-client-bGRSTd-L.mjs +974 -0
- package/dist/vue/assets-client-B-VVPPYQ.js +114 -0
- package/dist/vue/assets-client-CUzxHubR.mjs +108 -0
- package/dist/vue/index-client-DbXbWMIe.js +177 -0
- package/dist/vue/index-client-Dj_WfPK9.mjs +170 -0
- package/dist/vue/index.d.mts +50 -0
- package/dist/vue/index.d.ts +50 -0
- package/dist/vue/index.js +110 -0
- package/dist/vue/index.mjs +104 -0
- package/dist/vue/render-client-CjcQoukB.js +981 -0
- package/dist/vue/render-client-bGRSTd-L.mjs +974 -0
- package/package.json +140 -95
- package/dist/browser-notify.js +0 -68
- package/dist/cc-2Yt7NqMX.mjs +0 -21
- package/dist/cc-B6peeNak.mjs +0 -33
- package/dist/cc-BWuAzFJ6.js +0 -12
- package/dist/cc-CaBHsjUt.js +0 -34
- package/dist/cc-DGff5sSY.js +0 -21
- package/dist/cc-he3fHS3P.mjs +0 -12
- package/dist/notify.d.mts +0 -48
- package/dist/notify.d.mts.map +0 -1
- package/dist/notify.d.ts +0 -48
- package/dist/notify.d.ts.map +0 -1
- package/dist/notify.js +0 -206
- package/dist/notify.mjs +0 -202
- package/dist/react-notify-12s--2JK5UjB.mjs +0 -1244
- package/dist/react-notify-12s-Kv2M6zlv.js +0 -1247
- package/dist/react.d.mts +0 -70
- package/dist/react.d.mts.map +0 -1
- package/dist/react.d.ts +0 -70
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js +0 -19
- package/dist/react.mjs +0 -10
- package/dist/render-notify-toasts.js +0 -213
- package/dist/svelte.d.mts +0 -49
- package/dist/svelte.d.mts.map +0 -1
- package/dist/svelte.d.ts +0 -49
- package/dist/svelte.d.ts.map +0 -1
- package/dist/svelte.js +0 -284
- package/dist/svelte.mjs +0 -280
- package/dist/vue.d.mts +0 -107
- package/dist/vue.d.mts.map +0 -1
- package/dist/vue.d.ts +0 -107
- package/dist/vue.d.ts.map +0 -1
- package/dist/vue.js +0 -2215
- package/dist/vue.mjs +0 -2211
package/dist/vue.mjs
DELETED
|
@@ -1,2211 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from './cc-he3fHS3P.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @vue/shared v3.5.31
|
|
5
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
6
|
-
* @license MIT
|
|
7
|
-
**/ // @__NO_SIDE_EFFECTS__
|
|
8
|
-
function makeMap(str) {
|
|
9
|
-
const map = /* @__PURE__ */ Object.create(null);
|
|
10
|
-
for (const key of str.split(","))map[key] = 1;
|
|
11
|
-
return (val)=>val in map;
|
|
12
|
-
}
|
|
13
|
-
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
14
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
15
|
-
const NOOP = ()=>{};
|
|
16
|
-
const isOn = (key)=>key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
17
|
-
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
18
|
-
const isModelListener = (key)=>key.startsWith("onUpdate:");
|
|
19
|
-
const extend = Object.assign;
|
|
20
|
-
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
21
|
-
const hasOwn = (val, key)=>hasOwnProperty$1.call(val, key);
|
|
22
|
-
const isArray = Array.isArray;
|
|
23
|
-
const isMap = (val)=>toTypeString(val) === "[object Map]";
|
|
24
|
-
const isFunction = (val)=>typeof val === "function";
|
|
25
|
-
const isString = (val)=>typeof val === "string";
|
|
26
|
-
const isSymbol = (val)=>typeof val === "symbol";
|
|
27
|
-
const isObject = (val)=>val !== null && typeof val === "object";
|
|
28
|
-
const isPromise = (val)=>{
|
|
29
|
-
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
30
|
-
};
|
|
31
|
-
const objectToString = Object.prototype.toString;
|
|
32
|
-
const toTypeString = (value)=>objectToString.call(value);
|
|
33
|
-
const toRawType = (value)=>{
|
|
34
|
-
return toTypeString(value).slice(8, -1);
|
|
35
|
-
};
|
|
36
|
-
const isIntegerKey = (key)=>isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
37
|
-
const cacheStringFunction = (fn)=>{
|
|
38
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
39
|
-
return (str)=>{
|
|
40
|
-
const hit = cache[str];
|
|
41
|
-
return hit || (cache[str] = fn(str));
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const capitalize$1 = cacheStringFunction((str)=>{
|
|
45
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
46
|
-
});
|
|
47
|
-
const toHandlerKey = cacheStringFunction((str)=>{
|
|
48
|
-
const s = str ? `on${capitalize$1(str)}` : ``;
|
|
49
|
-
return s;
|
|
50
|
-
});
|
|
51
|
-
const hasChanged = (value, oldValue)=>!Object.is(value, oldValue);
|
|
52
|
-
let _globalThis;
|
|
53
|
-
const getGlobalThis = ()=>{
|
|
54
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
55
|
-
};
|
|
56
|
-
function normalizeStyle(value) {
|
|
57
|
-
if (isArray(value)) {
|
|
58
|
-
const res = {};
|
|
59
|
-
for(let i = 0; i < value.length; i++){
|
|
60
|
-
const item = value[i];
|
|
61
|
-
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
|
62
|
-
if (normalized) {
|
|
63
|
-
for(const key in normalized){
|
|
64
|
-
res[key] = normalized[key];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return res;
|
|
69
|
-
} else if (isString(value) || isObject(value)) {
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
74
|
-
const propertyDelimiterRE = /:([^]+)/;
|
|
75
|
-
const styleCommentRE = /\/\*[^]*?\*\//g;
|
|
76
|
-
function parseStringStyle(cssText) {
|
|
77
|
-
const ret = {};
|
|
78
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item)=>{
|
|
79
|
-
if (item) {
|
|
80
|
-
const tmp = item.split(propertyDelimiterRE);
|
|
81
|
-
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return ret;
|
|
85
|
-
}
|
|
86
|
-
function normalizeClass(value) {
|
|
87
|
-
let res = "";
|
|
88
|
-
if (isString(value)) {
|
|
89
|
-
res = value;
|
|
90
|
-
} else if (isArray(value)) {
|
|
91
|
-
for(let i = 0; i < value.length; i++){
|
|
92
|
-
const normalized = normalizeClass(value[i]);
|
|
93
|
-
if (normalized) {
|
|
94
|
-
res += normalized + " ";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} else if (isObject(value)) {
|
|
98
|
-
for(const name in value){
|
|
99
|
-
if (value[name]) {
|
|
100
|
-
res += name + " ";
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return res.trim();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function warn(msg, ...args) {
|
|
108
|
-
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
109
|
-
}
|
|
110
|
-
let batchDepth = 0;
|
|
111
|
-
let batchedSub;
|
|
112
|
-
function startBatch() {
|
|
113
|
-
batchDepth++;
|
|
114
|
-
}
|
|
115
|
-
function endBatch() {
|
|
116
|
-
if (--batchDepth > 0) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
let error;
|
|
120
|
-
while(batchedSub){
|
|
121
|
-
let e = batchedSub;
|
|
122
|
-
batchedSub = void 0;
|
|
123
|
-
while(e){
|
|
124
|
-
const next = e.next;
|
|
125
|
-
e.next = void 0;
|
|
126
|
-
e.flags &= -9;
|
|
127
|
-
if (e.flags & 1) {
|
|
128
|
-
try {
|
|
129
|
-
;
|
|
130
|
-
e.trigger();
|
|
131
|
-
} catch (err) {
|
|
132
|
-
if (!error) error = err;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
e = next;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (error) throw error;
|
|
139
|
-
}
|
|
140
|
-
class Dep {
|
|
141
|
-
track(debugInfo) {
|
|
142
|
-
{
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
trigger(debugInfo) {
|
|
147
|
-
this.version++;
|
|
148
|
-
this.notify(debugInfo);
|
|
149
|
-
}
|
|
150
|
-
notify(debugInfo) {
|
|
151
|
-
startBatch();
|
|
152
|
-
try {
|
|
153
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
154
|
-
for(let head = this.subsHead; head; head = head.nextSub){
|
|
155
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
156
|
-
head.sub.onTrigger(extend({
|
|
157
|
-
effect: head.sub
|
|
158
|
-
}, debugInfo));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
for(let link = this.subs; link; link = link.prevSub){
|
|
163
|
-
if (link.sub.notify()) {
|
|
164
|
-
;
|
|
165
|
-
link.sub.dep.notify();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
} finally{
|
|
169
|
-
endBatch();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// TODO isolatedDeclarations "__v_skip"
|
|
173
|
-
constructor(computed){
|
|
174
|
-
this.computed = computed;
|
|
175
|
-
this.version = 0;
|
|
176
|
-
/**
|
|
177
|
-
* Link between this dep and the current active effect
|
|
178
|
-
*/ this.activeLink = void 0;
|
|
179
|
-
/**
|
|
180
|
-
* Doubly linked list representing the subscribing effects (tail)
|
|
181
|
-
*/ this.subs = void 0;
|
|
182
|
-
/**
|
|
183
|
-
* For object property deps cleanup
|
|
184
|
-
*/ this.map = void 0;
|
|
185
|
-
this.key = void 0;
|
|
186
|
-
/**
|
|
187
|
-
* Subscriber counter
|
|
188
|
-
*/ this.sc = 0;
|
|
189
|
-
/**
|
|
190
|
-
* @internal
|
|
191
|
-
*/ this.__v_skip = true;
|
|
192
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
193
|
-
this.subsHead = void 0;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
198
|
-
const ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
|
|
199
|
-
const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
|
|
200
|
-
const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
|
|
201
|
-
function track(target, type, key) {
|
|
202
|
-
}
|
|
203
|
-
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
204
|
-
const depsMap = targetMap.get(target);
|
|
205
|
-
if (!depsMap) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const run = (dep)=>{
|
|
209
|
-
if (dep) {
|
|
210
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
211
|
-
dep.trigger({
|
|
212
|
-
target,
|
|
213
|
-
type,
|
|
214
|
-
key,
|
|
215
|
-
newValue,
|
|
216
|
-
oldValue,
|
|
217
|
-
oldTarget
|
|
218
|
-
});
|
|
219
|
-
} else {
|
|
220
|
-
dep.trigger();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
startBatch();
|
|
225
|
-
if (type === "clear") {
|
|
226
|
-
depsMap.forEach(run);
|
|
227
|
-
} else {
|
|
228
|
-
const targetIsArray = isArray(target);
|
|
229
|
-
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
230
|
-
if (targetIsArray && key === "length") {
|
|
231
|
-
const newLength = Number(newValue);
|
|
232
|
-
depsMap.forEach((dep, key2)=>{
|
|
233
|
-
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
234
|
-
run(dep);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
if (key !== void 0 || depsMap.has(void 0)) {
|
|
239
|
-
run(depsMap.get(key));
|
|
240
|
-
}
|
|
241
|
-
if (isArrayIndex) {
|
|
242
|
-
run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
243
|
-
}
|
|
244
|
-
switch(type){
|
|
245
|
-
case "add":
|
|
246
|
-
if (!targetIsArray) {
|
|
247
|
-
run(depsMap.get(ITERATE_KEY));
|
|
248
|
-
if (isMap(target)) {
|
|
249
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
250
|
-
}
|
|
251
|
-
} else if (isArrayIndex) {
|
|
252
|
-
run(depsMap.get("length"));
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
case "delete":
|
|
256
|
-
if (!targetIsArray) {
|
|
257
|
-
run(depsMap.get(ITERATE_KEY));
|
|
258
|
-
if (isMap(target)) {
|
|
259
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
case "set":
|
|
264
|
-
if (isMap(target)) {
|
|
265
|
-
run(depsMap.get(ITERATE_KEY));
|
|
266
|
-
}
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
endBatch();
|
|
272
|
-
}
|
|
273
|
-
function reactiveReadArray(array) {
|
|
274
|
-
const raw = toRaw(array);
|
|
275
|
-
if (raw === array) return raw;
|
|
276
|
-
return isShallow(array) ? raw : raw.map(toReactive);
|
|
277
|
-
}
|
|
278
|
-
function shallowReadArray(arr) {
|
|
279
|
-
track(arr = toRaw(arr));
|
|
280
|
-
return arr;
|
|
281
|
-
}
|
|
282
|
-
function toWrapped(target, item) {
|
|
283
|
-
if (isReadonly(target)) {
|
|
284
|
-
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
285
|
-
}
|
|
286
|
-
return toReactive(item);
|
|
287
|
-
}
|
|
288
|
-
const arrayInstrumentations = {
|
|
289
|
-
__proto__: null,
|
|
290
|
-
[Symbol.iterator] () {
|
|
291
|
-
return iterator(this, Symbol.iterator, (item)=>toWrapped(this, item));
|
|
292
|
-
},
|
|
293
|
-
concat (...args) {
|
|
294
|
-
return reactiveReadArray(this).concat(...args.map((x)=>isArray(x) ? reactiveReadArray(x) : x));
|
|
295
|
-
},
|
|
296
|
-
entries () {
|
|
297
|
-
return iterator(this, "entries", (value)=>{
|
|
298
|
-
value[1] = toWrapped(this, value[1]);
|
|
299
|
-
return value;
|
|
300
|
-
});
|
|
301
|
-
},
|
|
302
|
-
every (fn, thisArg) {
|
|
303
|
-
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
304
|
-
},
|
|
305
|
-
filter (fn, thisArg) {
|
|
306
|
-
return apply(this, "filter", fn, thisArg, (v)=>v.map((item)=>toWrapped(this, item)), arguments);
|
|
307
|
-
},
|
|
308
|
-
find (fn, thisArg) {
|
|
309
|
-
return apply(this, "find", fn, thisArg, (item)=>toWrapped(this, item), arguments);
|
|
310
|
-
},
|
|
311
|
-
findIndex (fn, thisArg) {
|
|
312
|
-
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
313
|
-
},
|
|
314
|
-
findLast (fn, thisArg) {
|
|
315
|
-
return apply(this, "findLast", fn, thisArg, (item)=>toWrapped(this, item), arguments);
|
|
316
|
-
},
|
|
317
|
-
findLastIndex (fn, thisArg) {
|
|
318
|
-
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
319
|
-
},
|
|
320
|
-
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
321
|
-
forEach (fn, thisArg) {
|
|
322
|
-
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
323
|
-
},
|
|
324
|
-
includes (...args) {
|
|
325
|
-
return searchProxy(this, "includes", args);
|
|
326
|
-
},
|
|
327
|
-
indexOf (...args) {
|
|
328
|
-
return searchProxy(this, "indexOf", args);
|
|
329
|
-
},
|
|
330
|
-
join (separator) {
|
|
331
|
-
return reactiveReadArray(this).join(separator);
|
|
332
|
-
},
|
|
333
|
-
// keys() iterator only reads `length`, no optimization required
|
|
334
|
-
lastIndexOf (...args) {
|
|
335
|
-
return searchProxy(this, "lastIndexOf", args);
|
|
336
|
-
},
|
|
337
|
-
map (fn, thisArg) {
|
|
338
|
-
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
339
|
-
},
|
|
340
|
-
pop () {
|
|
341
|
-
return noTracking(this, "pop");
|
|
342
|
-
},
|
|
343
|
-
push (...args) {
|
|
344
|
-
return noTracking(this, "push", args);
|
|
345
|
-
},
|
|
346
|
-
reduce (fn, ...args) {
|
|
347
|
-
return reduce(this, "reduce", fn, args);
|
|
348
|
-
},
|
|
349
|
-
reduceRight (fn, ...args) {
|
|
350
|
-
return reduce(this, "reduceRight", fn, args);
|
|
351
|
-
},
|
|
352
|
-
shift () {
|
|
353
|
-
return noTracking(this, "shift");
|
|
354
|
-
},
|
|
355
|
-
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
356
|
-
some (fn, thisArg) {
|
|
357
|
-
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
358
|
-
},
|
|
359
|
-
splice (...args) {
|
|
360
|
-
return noTracking(this, "splice", args);
|
|
361
|
-
},
|
|
362
|
-
toReversed () {
|
|
363
|
-
return reactiveReadArray(this).toReversed();
|
|
364
|
-
},
|
|
365
|
-
toSorted (comparer) {
|
|
366
|
-
return reactiveReadArray(this).toSorted(comparer);
|
|
367
|
-
},
|
|
368
|
-
toSpliced (...args) {
|
|
369
|
-
return reactiveReadArray(this).toSpliced(...args);
|
|
370
|
-
},
|
|
371
|
-
unshift (...args) {
|
|
372
|
-
return noTracking(this, "unshift", args);
|
|
373
|
-
},
|
|
374
|
-
values () {
|
|
375
|
-
return iterator(this, "values", (item)=>toWrapped(this, item));
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
function iterator(self, method, wrapValue) {
|
|
379
|
-
const arr = shallowReadArray(self);
|
|
380
|
-
const iter = arr[method]();
|
|
381
|
-
if (arr !== self && !isShallow(self)) {
|
|
382
|
-
iter._next = iter.next;
|
|
383
|
-
iter.next = ()=>{
|
|
384
|
-
const result = iter._next();
|
|
385
|
-
if (!result.done) {
|
|
386
|
-
result.value = wrapValue(result.value);
|
|
387
|
-
}
|
|
388
|
-
return result;
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
return iter;
|
|
392
|
-
}
|
|
393
|
-
const arrayProto = Array.prototype;
|
|
394
|
-
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
395
|
-
const arr = shallowReadArray(self);
|
|
396
|
-
const needsWrap = arr !== self && !isShallow(self);
|
|
397
|
-
const methodFn = arr[method];
|
|
398
|
-
if (methodFn !== arrayProto[method]) {
|
|
399
|
-
const result2 = methodFn.apply(self, args);
|
|
400
|
-
return needsWrap ? toReactive(result2) : result2;
|
|
401
|
-
}
|
|
402
|
-
let wrappedFn = fn;
|
|
403
|
-
if (arr !== self) {
|
|
404
|
-
if (needsWrap) {
|
|
405
|
-
wrappedFn = function(item, index) {
|
|
406
|
-
return fn.call(this, toWrapped(self, item), index, self);
|
|
407
|
-
};
|
|
408
|
-
} else if (fn.length > 2) {
|
|
409
|
-
wrappedFn = function(item, index) {
|
|
410
|
-
return fn.call(this, item, index, self);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
415
|
-
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
416
|
-
}
|
|
417
|
-
function reduce(self, method, fn, args) {
|
|
418
|
-
const arr = shallowReadArray(self);
|
|
419
|
-
const needsWrap = arr !== self && !isShallow(self);
|
|
420
|
-
let wrappedFn = fn;
|
|
421
|
-
let wrapInitialAccumulator = false;
|
|
422
|
-
if (arr !== self) {
|
|
423
|
-
if (needsWrap) {
|
|
424
|
-
wrapInitialAccumulator = args.length === 0;
|
|
425
|
-
wrappedFn = function(acc, item, index) {
|
|
426
|
-
if (wrapInitialAccumulator) {
|
|
427
|
-
wrapInitialAccumulator = false;
|
|
428
|
-
acc = toWrapped(self, acc);
|
|
429
|
-
}
|
|
430
|
-
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
431
|
-
};
|
|
432
|
-
} else if (fn.length > 3) {
|
|
433
|
-
wrappedFn = function(acc, item, index) {
|
|
434
|
-
return fn.call(this, acc, item, index, self);
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
const result = arr[method](wrappedFn, ...args);
|
|
439
|
-
return wrapInitialAccumulator ? toWrapped(self, result) : result;
|
|
440
|
-
}
|
|
441
|
-
function searchProxy(self, method, args) {
|
|
442
|
-
const arr = toRaw(self);
|
|
443
|
-
const res = arr[method](...args);
|
|
444
|
-
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
445
|
-
args[0] = toRaw(args[0]);
|
|
446
|
-
return arr[method](...args);
|
|
447
|
-
}
|
|
448
|
-
return res;
|
|
449
|
-
}
|
|
450
|
-
function noTracking(self, method, args = []) {
|
|
451
|
-
startBatch();
|
|
452
|
-
const res = toRaw(self)[method].apply(self, args);
|
|
453
|
-
endBatch();
|
|
454
|
-
return res;
|
|
455
|
-
}
|
|
456
|
-
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
457
|
-
const builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key)=>key !== "arguments" && key !== "caller").map((key)=>Symbol[key]).filter(isSymbol));
|
|
458
|
-
function hasOwnProperty(key) {
|
|
459
|
-
if (!isSymbol(key)) key = String(key);
|
|
460
|
-
const obj = toRaw(this);
|
|
461
|
-
return obj.hasOwnProperty(key);
|
|
462
|
-
}
|
|
463
|
-
class BaseReactiveHandler {
|
|
464
|
-
get(target, key, receiver) {
|
|
465
|
-
if (key === "__v_skip") return target["__v_skip"];
|
|
466
|
-
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
467
|
-
if (key === "__v_isReactive") {
|
|
468
|
-
return !isReadonly2;
|
|
469
|
-
} else if (key === "__v_isReadonly") {
|
|
470
|
-
return isReadonly2;
|
|
471
|
-
} else if (key === "__v_isShallow") {
|
|
472
|
-
return isShallow2;
|
|
473
|
-
} else if (key === "__v_raw") {
|
|
474
|
-
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
475
|
-
// this means the receiver is a user proxy of the reactive proxy
|
|
476
|
-
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
477
|
-
return target;
|
|
478
|
-
}
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const targetIsArray = isArray(target);
|
|
482
|
-
if (!isReadonly2) {
|
|
483
|
-
let fn;
|
|
484
|
-
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
485
|
-
return fn;
|
|
486
|
-
}
|
|
487
|
-
if (key === "hasOwnProperty") {
|
|
488
|
-
return hasOwnProperty;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
const res = Reflect.get(target, key, // if this is a proxy wrapping a ref, return methods using the raw ref
|
|
492
|
-
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
493
|
-
// its class methods
|
|
494
|
-
isRef(target) ? target : receiver);
|
|
495
|
-
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
496
|
-
return res;
|
|
497
|
-
}
|
|
498
|
-
if (isShallow2) {
|
|
499
|
-
return res;
|
|
500
|
-
}
|
|
501
|
-
if (isRef(res)) {
|
|
502
|
-
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
503
|
-
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
504
|
-
}
|
|
505
|
-
if (isObject(res)) {
|
|
506
|
-
return isReadonly2 ? readonly(res) : reactive(res);
|
|
507
|
-
}
|
|
508
|
-
return res;
|
|
509
|
-
}
|
|
510
|
-
constructor(_isReadonly = false, _isShallow = false){
|
|
511
|
-
this._isReadonly = _isReadonly;
|
|
512
|
-
this._isShallow = _isShallow;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
516
|
-
set(target, key, value, receiver) {
|
|
517
|
-
let oldValue = target[key];
|
|
518
|
-
const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
|
|
519
|
-
if (!this._isShallow) {
|
|
520
|
-
const isOldValueReadonly = isReadonly(oldValue);
|
|
521
|
-
if (!isShallow(value) && !isReadonly(value)) {
|
|
522
|
-
oldValue = toRaw(oldValue);
|
|
523
|
-
value = toRaw(value);
|
|
524
|
-
}
|
|
525
|
-
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
526
|
-
if (isOldValueReadonly) {
|
|
527
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
528
|
-
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
529
|
-
}
|
|
530
|
-
return true;
|
|
531
|
-
} else {
|
|
532
|
-
oldValue.value = value;
|
|
533
|
-
return true;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
538
|
-
const result = Reflect.set(target, key, value, isRef(target) ? target : receiver);
|
|
539
|
-
if (target === toRaw(receiver)) {
|
|
540
|
-
if (!hadKey) {
|
|
541
|
-
trigger(target, "add", key, value);
|
|
542
|
-
} else if (hasChanged(value, oldValue)) {
|
|
543
|
-
trigger(target, "set", key, value, oldValue);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
return result;
|
|
547
|
-
}
|
|
548
|
-
deleteProperty(target, key) {
|
|
549
|
-
const hadKey = hasOwn(target, key);
|
|
550
|
-
const oldValue = target[key];
|
|
551
|
-
const result = Reflect.deleteProperty(target, key);
|
|
552
|
-
if (result && hadKey) {
|
|
553
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
554
|
-
}
|
|
555
|
-
return result;
|
|
556
|
-
}
|
|
557
|
-
has(target, key) {
|
|
558
|
-
const result = Reflect.has(target, key);
|
|
559
|
-
if (!isSymbol(key) || !builtInSymbols.has(key)) ;
|
|
560
|
-
return result;
|
|
561
|
-
}
|
|
562
|
-
ownKeys(target) {
|
|
563
|
-
return Reflect.ownKeys(target);
|
|
564
|
-
}
|
|
565
|
-
constructor(isShallow2 = false){
|
|
566
|
-
super(false, isShallow2);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
570
|
-
set(target, key) {
|
|
571
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
572
|
-
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
573
|
-
}
|
|
574
|
-
return true;
|
|
575
|
-
}
|
|
576
|
-
deleteProperty(target, key) {
|
|
577
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
578
|
-
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
579
|
-
}
|
|
580
|
-
return true;
|
|
581
|
-
}
|
|
582
|
-
constructor(isShallow2 = false){
|
|
583
|
-
super(true, isShallow2);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
587
|
-
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
588
|
-
const toShallow = (value)=>value;
|
|
589
|
-
const getProto = (v)=>Reflect.getPrototypeOf(v);
|
|
590
|
-
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
591
|
-
return function(...args) {
|
|
592
|
-
const target = this["__v_raw"];
|
|
593
|
-
const rawTarget = toRaw(target);
|
|
594
|
-
const targetIsMap = isMap(rawTarget);
|
|
595
|
-
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
596
|
-
const innerIterator = target[method](...args);
|
|
597
|
-
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
598
|
-
return extend(// inheriting all iterator properties
|
|
599
|
-
Object.create(innerIterator), {
|
|
600
|
-
// iterator protocol
|
|
601
|
-
next () {
|
|
602
|
-
const { value, done } = innerIterator.next();
|
|
603
|
-
return done ? {
|
|
604
|
-
value,
|
|
605
|
-
done
|
|
606
|
-
} : {
|
|
607
|
-
value: isPair ? [
|
|
608
|
-
wrap(value[0]),
|
|
609
|
-
wrap(value[1])
|
|
610
|
-
] : wrap(value),
|
|
611
|
-
done
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
function createReadonlyMethod(type) {
|
|
618
|
-
return function(...args) {
|
|
619
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
620
|
-
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
621
|
-
warn(`${capitalize$1(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
622
|
-
}
|
|
623
|
-
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
function createInstrumentations(readonly, shallow) {
|
|
627
|
-
const instrumentations = {
|
|
628
|
-
get (key) {
|
|
629
|
-
const target = this["__v_raw"];
|
|
630
|
-
const rawTarget = toRaw(target);
|
|
631
|
-
const rawKey = toRaw(key);
|
|
632
|
-
const { has } = getProto(rawTarget);
|
|
633
|
-
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
634
|
-
if (has.call(rawTarget, key)) {
|
|
635
|
-
return wrap(target.get(key));
|
|
636
|
-
} else if (has.call(rawTarget, rawKey)) {
|
|
637
|
-
return wrap(target.get(rawKey));
|
|
638
|
-
} else if (target !== rawTarget) {
|
|
639
|
-
target.get(key);
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
get size () {
|
|
643
|
-
const target = this["__v_raw"];
|
|
644
|
-
return target.size;
|
|
645
|
-
},
|
|
646
|
-
has (key) {
|
|
647
|
-
const target = this["__v_raw"];
|
|
648
|
-
const rawKey = toRaw(key);
|
|
649
|
-
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
650
|
-
},
|
|
651
|
-
forEach (callback, thisArg) {
|
|
652
|
-
const observed = this;
|
|
653
|
-
const target = observed["__v_raw"];
|
|
654
|
-
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
655
|
-
return target.forEach((value, key)=>{
|
|
656
|
-
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
extend(instrumentations, readonly ? {
|
|
661
|
-
add: createReadonlyMethod("add"),
|
|
662
|
-
set: createReadonlyMethod("set"),
|
|
663
|
-
delete: createReadonlyMethod("delete"),
|
|
664
|
-
clear: createReadonlyMethod("clear")
|
|
665
|
-
} : {
|
|
666
|
-
add (value) {
|
|
667
|
-
const target = toRaw(this);
|
|
668
|
-
const proto = getProto(target);
|
|
669
|
-
const rawValue = toRaw(value);
|
|
670
|
-
const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
|
|
671
|
-
const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
|
|
672
|
-
if (!hadKey) {
|
|
673
|
-
target.add(valueToAdd);
|
|
674
|
-
trigger(target, "add", valueToAdd, valueToAdd);
|
|
675
|
-
}
|
|
676
|
-
return this;
|
|
677
|
-
},
|
|
678
|
-
set (key, value) {
|
|
679
|
-
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
680
|
-
value = toRaw(value);
|
|
681
|
-
}
|
|
682
|
-
const target = toRaw(this);
|
|
683
|
-
const { has, get } = getProto(target);
|
|
684
|
-
let hadKey = has.call(target, key);
|
|
685
|
-
if (!hadKey) {
|
|
686
|
-
key = toRaw(key);
|
|
687
|
-
hadKey = has.call(target, key);
|
|
688
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
689
|
-
checkIdentityKeys(target, has, key);
|
|
690
|
-
}
|
|
691
|
-
const oldValue = get.call(target, key);
|
|
692
|
-
target.set(key, value);
|
|
693
|
-
if (!hadKey) {
|
|
694
|
-
trigger(target, "add", key, value);
|
|
695
|
-
} else if (hasChanged(value, oldValue)) {
|
|
696
|
-
trigger(target, "set", key, value, oldValue);
|
|
697
|
-
}
|
|
698
|
-
return this;
|
|
699
|
-
},
|
|
700
|
-
delete (key) {
|
|
701
|
-
const target = toRaw(this);
|
|
702
|
-
const { has, get } = getProto(target);
|
|
703
|
-
let hadKey = has.call(target, key);
|
|
704
|
-
if (!hadKey) {
|
|
705
|
-
key = toRaw(key);
|
|
706
|
-
hadKey = has.call(target, key);
|
|
707
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
708
|
-
checkIdentityKeys(target, has, key);
|
|
709
|
-
}
|
|
710
|
-
const oldValue = get ? get.call(target, key) : void 0;
|
|
711
|
-
const result = target.delete(key);
|
|
712
|
-
if (hadKey) {
|
|
713
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
714
|
-
}
|
|
715
|
-
return result;
|
|
716
|
-
},
|
|
717
|
-
clear () {
|
|
718
|
-
const target = toRaw(this);
|
|
719
|
-
const hadItems = target.size !== 0;
|
|
720
|
-
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
721
|
-
const result = target.clear();
|
|
722
|
-
if (hadItems) {
|
|
723
|
-
trigger(target, "clear", void 0, void 0, oldTarget);
|
|
724
|
-
}
|
|
725
|
-
return result;
|
|
726
|
-
}
|
|
727
|
-
});
|
|
728
|
-
const iteratorMethods = [
|
|
729
|
-
"keys",
|
|
730
|
-
"values",
|
|
731
|
-
"entries",
|
|
732
|
-
Symbol.iterator
|
|
733
|
-
];
|
|
734
|
-
iteratorMethods.forEach((method)=>{
|
|
735
|
-
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
736
|
-
});
|
|
737
|
-
return instrumentations;
|
|
738
|
-
}
|
|
739
|
-
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
740
|
-
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
741
|
-
return (target, key, receiver)=>{
|
|
742
|
-
if (key === "__v_isReactive") {
|
|
743
|
-
return !isReadonly2;
|
|
744
|
-
} else if (key === "__v_isReadonly") {
|
|
745
|
-
return isReadonly2;
|
|
746
|
-
} else if (key === "__v_raw") {
|
|
747
|
-
return target;
|
|
748
|
-
}
|
|
749
|
-
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
const mutableCollectionHandlers = {
|
|
753
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
754
|
-
};
|
|
755
|
-
const readonlyCollectionHandlers = {
|
|
756
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
757
|
-
};
|
|
758
|
-
function checkIdentityKeys(target, has, key) {
|
|
759
|
-
const rawKey = toRaw(key);
|
|
760
|
-
if (rawKey !== key && has.call(target, rawKey)) {
|
|
761
|
-
const type = toRawType(target);
|
|
762
|
-
warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
766
|
-
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
767
|
-
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
768
|
-
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
769
|
-
function targetTypeMap(rawType) {
|
|
770
|
-
switch(rawType){
|
|
771
|
-
case "Object":
|
|
772
|
-
case "Array":
|
|
773
|
-
return 1 /* COMMON */ ;
|
|
774
|
-
case "Map":
|
|
775
|
-
case "Set":
|
|
776
|
-
case "WeakMap":
|
|
777
|
-
case "WeakSet":
|
|
778
|
-
return 2 /* COLLECTION */ ;
|
|
779
|
-
default:
|
|
780
|
-
return 0 /* INVALID */ ;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
function getTargetType(value) {
|
|
784
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
|
|
785
|
-
}
|
|
786
|
-
// @__NO_SIDE_EFFECTS__
|
|
787
|
-
function reactive(target) {
|
|
788
|
-
if (/* @__PURE__ */ isReadonly(target)) {
|
|
789
|
-
return target;
|
|
790
|
-
}
|
|
791
|
-
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
792
|
-
}
|
|
793
|
-
// @__NO_SIDE_EFFECTS__
|
|
794
|
-
function readonly(target) {
|
|
795
|
-
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
796
|
-
}
|
|
797
|
-
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
798
|
-
if (!isObject(target)) {
|
|
799
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
800
|
-
warn(`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(target)}`);
|
|
801
|
-
}
|
|
802
|
-
return target;
|
|
803
|
-
}
|
|
804
|
-
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
805
|
-
return target;
|
|
806
|
-
}
|
|
807
|
-
const targetType = getTargetType(target);
|
|
808
|
-
if (targetType === 0 /* INVALID */ ) {
|
|
809
|
-
return target;
|
|
810
|
-
}
|
|
811
|
-
const existingProxy = proxyMap.get(target);
|
|
812
|
-
if (existingProxy) {
|
|
813
|
-
return existingProxy;
|
|
814
|
-
}
|
|
815
|
-
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
816
|
-
proxyMap.set(target, proxy);
|
|
817
|
-
return proxy;
|
|
818
|
-
}
|
|
819
|
-
// @__NO_SIDE_EFFECTS__
|
|
820
|
-
function isReactive(value) {
|
|
821
|
-
if (/* @__PURE__ */ isReadonly(value)) {
|
|
822
|
-
return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
823
|
-
}
|
|
824
|
-
return !!(value && value["__v_isReactive"]);
|
|
825
|
-
}
|
|
826
|
-
// @__NO_SIDE_EFFECTS__
|
|
827
|
-
function isReadonly(value) {
|
|
828
|
-
return !!(value && value["__v_isReadonly"]);
|
|
829
|
-
}
|
|
830
|
-
// @__NO_SIDE_EFFECTS__
|
|
831
|
-
function isShallow(value) {
|
|
832
|
-
return !!(value && value["__v_isShallow"]);
|
|
833
|
-
}
|
|
834
|
-
// @__NO_SIDE_EFFECTS__
|
|
835
|
-
function isProxy(value) {
|
|
836
|
-
return value ? !!value["__v_raw"] : false;
|
|
837
|
-
}
|
|
838
|
-
// @__NO_SIDE_EFFECTS__
|
|
839
|
-
function toRaw(observed) {
|
|
840
|
-
const raw = observed && observed["__v_raw"];
|
|
841
|
-
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
842
|
-
}
|
|
843
|
-
const toReactive = (value)=>isObject(value) ? /* @__PURE__ */ reactive(value) : value;
|
|
844
|
-
const toReadonly = (value)=>isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
845
|
-
// @__NO_SIDE_EFFECTS__
|
|
846
|
-
function isRef(r) {
|
|
847
|
-
return r ? r["__v_isRef"] === true : false;
|
|
848
|
-
}
|
|
849
|
-
// @__NO_SIDE_EFFECTS__
|
|
850
|
-
function ref(value) {
|
|
851
|
-
return createRef(value, false);
|
|
852
|
-
}
|
|
853
|
-
function createRef(rawValue, shallow) {
|
|
854
|
-
if (/* @__PURE__ */ isRef(rawValue)) {
|
|
855
|
-
return rawValue;
|
|
856
|
-
}
|
|
857
|
-
return new RefImpl(rawValue, shallow);
|
|
858
|
-
}
|
|
859
|
-
class RefImpl {
|
|
860
|
-
get value() {
|
|
861
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
862
|
-
this.dep.track({
|
|
863
|
-
target: this,
|
|
864
|
-
type: "get",
|
|
865
|
-
key: "value"
|
|
866
|
-
});
|
|
867
|
-
} else {
|
|
868
|
-
this.dep.track();
|
|
869
|
-
}
|
|
870
|
-
return this._value;
|
|
871
|
-
}
|
|
872
|
-
set value(newValue) {
|
|
873
|
-
const oldValue = this._rawValue;
|
|
874
|
-
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
875
|
-
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
876
|
-
if (hasChanged(newValue, oldValue)) {
|
|
877
|
-
this._rawValue = newValue;
|
|
878
|
-
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
879
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
880
|
-
this.dep.trigger({
|
|
881
|
-
target: this,
|
|
882
|
-
type: "set",
|
|
883
|
-
key: "value",
|
|
884
|
-
newValue,
|
|
885
|
-
oldValue
|
|
886
|
-
});
|
|
887
|
-
} else {
|
|
888
|
-
this.dep.trigger();
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
constructor(value, isShallow2){
|
|
893
|
-
this.dep = new Dep();
|
|
894
|
-
this["__v_isRef"] = true;
|
|
895
|
-
this["__v_isShallow"] = false;
|
|
896
|
-
this._rawValue = isShallow2 ? value : toRaw(value);
|
|
897
|
-
this._value = isShallow2 ? value : toReactive(value);
|
|
898
|
-
this["__v_isShallow"] = isShallow2;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
const stack = [];
|
|
903
|
-
function pushWarningContext(vnode) {
|
|
904
|
-
stack.push(vnode);
|
|
905
|
-
}
|
|
906
|
-
function popWarningContext() {
|
|
907
|
-
stack.pop();
|
|
908
|
-
}
|
|
909
|
-
let isWarning = false;
|
|
910
|
-
function warn$1(msg, ...args) {
|
|
911
|
-
if (isWarning) return;
|
|
912
|
-
isWarning = true;
|
|
913
|
-
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
914
|
-
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
915
|
-
const trace = getComponentTrace();
|
|
916
|
-
if (appWarnHandler) {
|
|
917
|
-
callWithErrorHandling(appWarnHandler, instance, 11, [
|
|
918
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
919
|
-
msg + args.map((a)=>{
|
|
920
|
-
var _a, _b;
|
|
921
|
-
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
922
|
-
}).join(""),
|
|
923
|
-
instance && instance.proxy,
|
|
924
|
-
trace.map(({ vnode })=>`at <${formatComponentName(instance, vnode.type)}>`).join("\n"),
|
|
925
|
-
trace
|
|
926
|
-
]);
|
|
927
|
-
} else {
|
|
928
|
-
const warnArgs = [
|
|
929
|
-
`[Vue warn]: ${msg}`,
|
|
930
|
-
...args
|
|
931
|
-
];
|
|
932
|
-
if (trace.length && // avoid spamming console during tests
|
|
933
|
-
true) {
|
|
934
|
-
warnArgs.push(`
|
|
935
|
-
`, ...formatTrace(trace));
|
|
936
|
-
}
|
|
937
|
-
console.warn(...warnArgs);
|
|
938
|
-
}
|
|
939
|
-
isWarning = false;
|
|
940
|
-
}
|
|
941
|
-
function getComponentTrace() {
|
|
942
|
-
let currentVNode = stack[stack.length - 1];
|
|
943
|
-
if (!currentVNode) {
|
|
944
|
-
return [];
|
|
945
|
-
}
|
|
946
|
-
const normalizedStack = [];
|
|
947
|
-
while(currentVNode){
|
|
948
|
-
const last = normalizedStack[0];
|
|
949
|
-
if (last && last.vnode === currentVNode) {
|
|
950
|
-
last.recurseCount++;
|
|
951
|
-
} else {
|
|
952
|
-
normalizedStack.push({
|
|
953
|
-
vnode: currentVNode,
|
|
954
|
-
recurseCount: 0
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
958
|
-
currentVNode = parentInstance && parentInstance.vnode;
|
|
959
|
-
}
|
|
960
|
-
return normalizedStack;
|
|
961
|
-
}
|
|
962
|
-
function formatTrace(trace) {
|
|
963
|
-
const logs = [];
|
|
964
|
-
trace.forEach((entry, i)=>{
|
|
965
|
-
logs.push(...i === 0 ? [] : [
|
|
966
|
-
`
|
|
967
|
-
`
|
|
968
|
-
], ...formatTraceEntry(entry));
|
|
969
|
-
});
|
|
970
|
-
return logs;
|
|
971
|
-
}
|
|
972
|
-
function formatTraceEntry({ vnode, recurseCount }) {
|
|
973
|
-
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
974
|
-
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
975
|
-
const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
|
976
|
-
const close = `>` + postfix;
|
|
977
|
-
return vnode.props ? [
|
|
978
|
-
open,
|
|
979
|
-
...formatProps(vnode.props),
|
|
980
|
-
close
|
|
981
|
-
] : [
|
|
982
|
-
open + close
|
|
983
|
-
];
|
|
984
|
-
}
|
|
985
|
-
function formatProps(props) {
|
|
986
|
-
const res = [];
|
|
987
|
-
const keys = Object.keys(props);
|
|
988
|
-
keys.slice(0, 3).forEach((key)=>{
|
|
989
|
-
res.push(...formatProp(key, props[key]));
|
|
990
|
-
});
|
|
991
|
-
if (keys.length > 3) {
|
|
992
|
-
res.push(` ...`);
|
|
993
|
-
}
|
|
994
|
-
return res;
|
|
995
|
-
}
|
|
996
|
-
function formatProp(key, value, raw) {
|
|
997
|
-
if (isString(value)) {
|
|
998
|
-
value = JSON.stringify(value);
|
|
999
|
-
return raw ? value : [
|
|
1000
|
-
`${key}=${value}`
|
|
1001
|
-
];
|
|
1002
|
-
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1003
|
-
return raw ? value : [
|
|
1004
|
-
`${key}=${value}`
|
|
1005
|
-
];
|
|
1006
|
-
} else if (isRef(value)) {
|
|
1007
|
-
value = formatProp(key, toRaw(value.value), true);
|
|
1008
|
-
return raw ? value : [
|
|
1009
|
-
`${key}=Ref<`,
|
|
1010
|
-
value,
|
|
1011
|
-
`>`
|
|
1012
|
-
];
|
|
1013
|
-
} else if (isFunction(value)) {
|
|
1014
|
-
return [
|
|
1015
|
-
`${key}=fn${value.name ? `<${value.name}>` : ``}`
|
|
1016
|
-
];
|
|
1017
|
-
} else {
|
|
1018
|
-
value = toRaw(value);
|
|
1019
|
-
return raw ? value : [
|
|
1020
|
-
`${key}=`,
|
|
1021
|
-
value
|
|
1022
|
-
];
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
const ErrorTypeStrings$1 = {
|
|
1026
|
-
["sp"]: "serverPrefetch hook",
|
|
1027
|
-
["bc"]: "beforeCreate hook",
|
|
1028
|
-
["c"]: "created hook",
|
|
1029
|
-
["bm"]: "beforeMount hook",
|
|
1030
|
-
["m"]: "mounted hook",
|
|
1031
|
-
["bu"]: "beforeUpdate hook",
|
|
1032
|
-
["u"]: "updated",
|
|
1033
|
-
["bum"]: "beforeUnmount hook",
|
|
1034
|
-
["um"]: "unmounted hook",
|
|
1035
|
-
["a"]: "activated hook",
|
|
1036
|
-
["da"]: "deactivated hook",
|
|
1037
|
-
["ec"]: "errorCaptured hook",
|
|
1038
|
-
["rtc"]: "renderTracked hook",
|
|
1039
|
-
["rtg"]: "renderTriggered hook",
|
|
1040
|
-
[0]: "setup function",
|
|
1041
|
-
[1]: "render function",
|
|
1042
|
-
[2]: "watcher getter",
|
|
1043
|
-
[3]: "watcher callback",
|
|
1044
|
-
[4]: "watcher cleanup function",
|
|
1045
|
-
[5]: "native event handler",
|
|
1046
|
-
[6]: "component event handler",
|
|
1047
|
-
[7]: "vnode hook",
|
|
1048
|
-
[8]: "directive hook",
|
|
1049
|
-
[9]: "transition hook",
|
|
1050
|
-
[10]: "app errorHandler",
|
|
1051
|
-
[11]: "app warnHandler",
|
|
1052
|
-
[12]: "ref function",
|
|
1053
|
-
[13]: "async component loader",
|
|
1054
|
-
[14]: "scheduler flush",
|
|
1055
|
-
[15]: "component update",
|
|
1056
|
-
[16]: "app unmount cleanup function"
|
|
1057
|
-
};
|
|
1058
|
-
function callWithErrorHandling(fn, instance, type, args) {
|
|
1059
|
-
try {
|
|
1060
|
-
return args ? fn(...args) : fn();
|
|
1061
|
-
} catch (err) {
|
|
1062
|
-
handleError(err, instance, type);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1066
|
-
if (isFunction(fn)) {
|
|
1067
|
-
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1068
|
-
if (res && isPromise(res)) {
|
|
1069
|
-
res.catch((err)=>{
|
|
1070
|
-
handleError(err, instance, type);
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
return res;
|
|
1074
|
-
}
|
|
1075
|
-
if (isArray(fn)) {
|
|
1076
|
-
const values = [];
|
|
1077
|
-
for(let i = 0; i < fn.length; i++){
|
|
1078
|
-
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1079
|
-
}
|
|
1080
|
-
return values;
|
|
1081
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1082
|
-
warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
function handleError(err, instance, type, throwInDev = true) {
|
|
1086
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
1087
|
-
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
1088
|
-
if (instance) {
|
|
1089
|
-
let cur = instance.parent;
|
|
1090
|
-
const exposedInstance = instance.proxy;
|
|
1091
|
-
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
1092
|
-
while(cur){
|
|
1093
|
-
const errorCapturedHooks = cur.ec;
|
|
1094
|
-
if (errorCapturedHooks) {
|
|
1095
|
-
for(let i = 0; i < errorCapturedHooks.length; i++){
|
|
1096
|
-
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
cur = cur.parent;
|
|
1102
|
-
}
|
|
1103
|
-
if (errorHandler) {
|
|
1104
|
-
callWithErrorHandling(errorHandler, null, 10, [
|
|
1105
|
-
err,
|
|
1106
|
-
exposedInstance,
|
|
1107
|
-
errorInfo
|
|
1108
|
-
]);
|
|
1109
|
-
return;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
|
1113
|
-
}
|
|
1114
|
-
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
|
1115
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1116
|
-
const info = ErrorTypeStrings$1[type];
|
|
1117
|
-
if (contextVNode) {
|
|
1118
|
-
pushWarningContext(contextVNode);
|
|
1119
|
-
}
|
|
1120
|
-
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1121
|
-
if (contextVNode) {
|
|
1122
|
-
popWarningContext();
|
|
1123
|
-
}
|
|
1124
|
-
if (throwInDev) {
|
|
1125
|
-
throw err;
|
|
1126
|
-
} else {
|
|
1127
|
-
console.error(err);
|
|
1128
|
-
}
|
|
1129
|
-
} else if (throwInProd) {
|
|
1130
|
-
throw err;
|
|
1131
|
-
} else {
|
|
1132
|
-
console.error(err);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
const queue = [];
|
|
1136
|
-
let flushIndex = -1;
|
|
1137
|
-
const pendingPostFlushCbs = [];
|
|
1138
|
-
let activePostFlushCbs = null;
|
|
1139
|
-
let postFlushIndex = 0;
|
|
1140
|
-
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1141
|
-
let currentFlushPromise = null;
|
|
1142
|
-
const RECURSION_LIMIT = 100;
|
|
1143
|
-
function findInsertionIndex(id) {
|
|
1144
|
-
let start = flushIndex + 1;
|
|
1145
|
-
let end = queue.length;
|
|
1146
|
-
while(start < end){
|
|
1147
|
-
const middle = start + end >>> 1;
|
|
1148
|
-
const middleJob = queue[middle];
|
|
1149
|
-
const middleJobId = getId(middleJob);
|
|
1150
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1151
|
-
start = middle + 1;
|
|
1152
|
-
} else {
|
|
1153
|
-
end = middle;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
return start;
|
|
1157
|
-
}
|
|
1158
|
-
function queueJob(job) {
|
|
1159
|
-
if (!(job.flags & 1)) {
|
|
1160
|
-
const jobId = getId(job);
|
|
1161
|
-
const lastJob = queue[queue.length - 1];
|
|
1162
|
-
if (!lastJob || // fast path when the job id is larger than the tail
|
|
1163
|
-
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
1164
|
-
queue.push(job);
|
|
1165
|
-
} else {
|
|
1166
|
-
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
1167
|
-
}
|
|
1168
|
-
job.flags |= 1;
|
|
1169
|
-
queueFlush();
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
function queueFlush() {
|
|
1173
|
-
if (!currentFlushPromise) {
|
|
1174
|
-
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
function queuePostFlushCb(cb) {
|
|
1178
|
-
if (!isArray(cb)) {
|
|
1179
|
-
if (activePostFlushCbs && cb.id === -1) {
|
|
1180
|
-
activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
|
1181
|
-
} else if (!(cb.flags & 1)) {
|
|
1182
|
-
pendingPostFlushCbs.push(cb);
|
|
1183
|
-
cb.flags |= 1;
|
|
1184
|
-
}
|
|
1185
|
-
} else {
|
|
1186
|
-
pendingPostFlushCbs.push(...cb);
|
|
1187
|
-
}
|
|
1188
|
-
queueFlush();
|
|
1189
|
-
}
|
|
1190
|
-
function flushPostFlushCbs(seen) {
|
|
1191
|
-
if (pendingPostFlushCbs.length) {
|
|
1192
|
-
const deduped = [
|
|
1193
|
-
...new Set(pendingPostFlushCbs)
|
|
1194
|
-
].sort((a, b)=>getId(a) - getId(b));
|
|
1195
|
-
pendingPostFlushCbs.length = 0;
|
|
1196
|
-
if (activePostFlushCbs) {
|
|
1197
|
-
activePostFlushCbs.push(...deduped);
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
activePostFlushCbs = deduped;
|
|
1201
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1202
|
-
seen = seen || /* @__PURE__ */ new Map();
|
|
1203
|
-
}
|
|
1204
|
-
for(postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++){
|
|
1205
|
-
const cb = activePostFlushCbs[postFlushIndex];
|
|
1206
|
-
if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
|
|
1207
|
-
continue;
|
|
1208
|
-
}
|
|
1209
|
-
if (cb.flags & 4) {
|
|
1210
|
-
cb.flags &= -2;
|
|
1211
|
-
}
|
|
1212
|
-
if (!(cb.flags & 8)) cb();
|
|
1213
|
-
cb.flags &= -2;
|
|
1214
|
-
}
|
|
1215
|
-
activePostFlushCbs = null;
|
|
1216
|
-
postFlushIndex = 0;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
const getId = (job)=>job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
1220
|
-
function flushJobs(seen) {
|
|
1221
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1222
|
-
seen = seen || /* @__PURE__ */ new Map();
|
|
1223
|
-
}
|
|
1224
|
-
const check = !!(process.env.NODE_ENV !== "production") ? (job)=>checkRecursiveUpdates(seen, job) : NOOP;
|
|
1225
|
-
try {
|
|
1226
|
-
for(flushIndex = 0; flushIndex < queue.length; flushIndex++){
|
|
1227
|
-
const job = queue[flushIndex];
|
|
1228
|
-
if (job && !(job.flags & 8)) {
|
|
1229
|
-
if (!!(process.env.NODE_ENV !== "production") && check(job)) {
|
|
1230
|
-
continue;
|
|
1231
|
-
}
|
|
1232
|
-
if (job.flags & 4) {
|
|
1233
|
-
job.flags &= ~1;
|
|
1234
|
-
}
|
|
1235
|
-
callWithErrorHandling(job, job.i, job.i ? 15 : 14);
|
|
1236
|
-
if (!(job.flags & 4)) {
|
|
1237
|
-
job.flags &= ~1;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
} finally{
|
|
1242
|
-
for(; flushIndex < queue.length; flushIndex++){
|
|
1243
|
-
const job = queue[flushIndex];
|
|
1244
|
-
if (job) {
|
|
1245
|
-
job.flags &= -2;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
flushIndex = -1;
|
|
1249
|
-
queue.length = 0;
|
|
1250
|
-
flushPostFlushCbs(seen);
|
|
1251
|
-
currentFlushPromise = null;
|
|
1252
|
-
if (queue.length || pendingPostFlushCbs.length) {
|
|
1253
|
-
flushJobs(seen);
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
function checkRecursiveUpdates(seen, fn) {
|
|
1258
|
-
const count = seen.get(fn) || 0;
|
|
1259
|
-
if (count > RECURSION_LIMIT) {
|
|
1260
|
-
const instance = fn.i;
|
|
1261
|
-
const componentName = instance && getComponentName(instance.type);
|
|
1262
|
-
handleError(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10);
|
|
1263
|
-
return true;
|
|
1264
|
-
}
|
|
1265
|
-
seen.set(fn, count + 1);
|
|
1266
|
-
return false;
|
|
1267
|
-
}
|
|
1268
|
-
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
1269
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1270
|
-
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
1271
|
-
createRecord: tryWrap(createRecord),
|
|
1272
|
-
rerender: tryWrap(rerender),
|
|
1273
|
-
reload: tryWrap(reload)
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
const map = /* @__PURE__ */ new Map();
|
|
1277
|
-
function createRecord(id, initialDef) {
|
|
1278
|
-
if (map.has(id)) {
|
|
1279
|
-
return false;
|
|
1280
|
-
}
|
|
1281
|
-
map.set(id, {
|
|
1282
|
-
initialDef: normalizeClassComponent(initialDef),
|
|
1283
|
-
instances: /* @__PURE__ */ new Set()
|
|
1284
|
-
});
|
|
1285
|
-
return true;
|
|
1286
|
-
}
|
|
1287
|
-
function normalizeClassComponent(component) {
|
|
1288
|
-
return isClassComponent(component) ? component.__vccOpts : component;
|
|
1289
|
-
}
|
|
1290
|
-
function rerender(id, newRender) {
|
|
1291
|
-
const record = map.get(id);
|
|
1292
|
-
if (!record) {
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
record.initialDef.render = newRender;
|
|
1296
|
-
[
|
|
1297
|
-
...record.instances
|
|
1298
|
-
].forEach((instance)=>{
|
|
1299
|
-
if (newRender) {
|
|
1300
|
-
instance.render = newRender;
|
|
1301
|
-
normalizeClassComponent(instance.type).render = newRender;
|
|
1302
|
-
}
|
|
1303
|
-
instance.renderCache = [];
|
|
1304
|
-
if (!(instance.job.flags & 8)) {
|
|
1305
|
-
instance.update();
|
|
1306
|
-
}
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
function reload(id, newComp) {
|
|
1310
|
-
const record = map.get(id);
|
|
1311
|
-
if (!record) return;
|
|
1312
|
-
newComp = normalizeClassComponent(newComp);
|
|
1313
|
-
updateComponentDef(record.initialDef, newComp);
|
|
1314
|
-
const instances = [
|
|
1315
|
-
...record.instances
|
|
1316
|
-
];
|
|
1317
|
-
for(let i = 0; i < instances.length; i++){
|
|
1318
|
-
const instance = instances[i];
|
|
1319
|
-
const oldComp = normalizeClassComponent(instance.type);
|
|
1320
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
1321
|
-
if (!dirtyInstances) {
|
|
1322
|
-
if (oldComp !== record.initialDef) {
|
|
1323
|
-
updateComponentDef(oldComp, newComp);
|
|
1324
|
-
}
|
|
1325
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
1326
|
-
}
|
|
1327
|
-
dirtyInstances.add(instance);
|
|
1328
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
1329
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
1330
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
1331
|
-
if (instance.ceReload) {
|
|
1332
|
-
dirtyInstances.add(instance);
|
|
1333
|
-
instance.ceReload(newComp.styles);
|
|
1334
|
-
dirtyInstances.delete(instance);
|
|
1335
|
-
} else if (instance.parent) {
|
|
1336
|
-
queueJob(()=>{
|
|
1337
|
-
if (!(instance.job.flags & 8)) {
|
|
1338
|
-
instance.parent.update();
|
|
1339
|
-
dirtyInstances.delete(instance);
|
|
1340
|
-
}
|
|
1341
|
-
});
|
|
1342
|
-
} else if (instance.appContext.reload) {
|
|
1343
|
-
instance.appContext.reload();
|
|
1344
|
-
} else if (typeof window !== "undefined") {
|
|
1345
|
-
window.location.reload();
|
|
1346
|
-
} else {
|
|
1347
|
-
console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
1348
|
-
}
|
|
1349
|
-
if (instance.root.ce && instance !== instance.root) {
|
|
1350
|
-
instance.root.ce._removeChildStyle(oldComp);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
queuePostFlushCb(()=>{
|
|
1354
|
-
hmrDirtyComponents.clear();
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
function updateComponentDef(oldComp, newComp) {
|
|
1358
|
-
extend(oldComp, newComp);
|
|
1359
|
-
for(const key in oldComp){
|
|
1360
|
-
if (key !== "__file" && !(key in newComp)) {
|
|
1361
|
-
delete oldComp[key];
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
function tryWrap(fn) {
|
|
1366
|
-
return (id, arg)=>{
|
|
1367
|
-
try {
|
|
1368
|
-
return fn(id, arg);
|
|
1369
|
-
} catch (e) {
|
|
1370
|
-
console.error(e);
|
|
1371
|
-
console.warn(`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`);
|
|
1372
|
-
}
|
|
1373
|
-
};
|
|
1374
|
-
}
|
|
1375
|
-
let devtools$1;
|
|
1376
|
-
let buffer = [];
|
|
1377
|
-
function setDevtoolsHook$1(hook, target) {
|
|
1378
|
-
var _a, _b;
|
|
1379
|
-
devtools$1 = hook;
|
|
1380
|
-
if (devtools$1) {
|
|
1381
|
-
devtools$1.enabled = true;
|
|
1382
|
-
buffer.forEach(({ event, args })=>devtools$1.emit(event, ...args));
|
|
1383
|
-
buffer = [];
|
|
1384
|
-
} else if (// handle late devtools injection - only do this if we are in an actual
|
|
1385
|
-
// browser environment to avoid the timer handle stalling test runner exit
|
|
1386
|
-
// (#4815)
|
|
1387
|
-
typeof window !== "undefined" && // some envs mock window but not fully
|
|
1388
|
-
window.HTMLElement && // also exclude jsdom
|
|
1389
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
1390
|
-
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))) {
|
|
1391
|
-
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
|
1392
|
-
replay.push((newHook)=>{
|
|
1393
|
-
setDevtoolsHook$1(newHook, target);
|
|
1394
|
-
});
|
|
1395
|
-
setTimeout(()=>{
|
|
1396
|
-
if (!devtools$1) {
|
|
1397
|
-
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
1398
|
-
buffer = [];
|
|
1399
|
-
}
|
|
1400
|
-
}, 3e3);
|
|
1401
|
-
} else {
|
|
1402
|
-
buffer = [];
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
let currentRenderingInstance = null;
|
|
1406
|
-
let currentScopeId = null;
|
|
1407
|
-
const isTeleport = (type)=>type.__isTeleport;
|
|
1408
|
-
function setTransitionHooks(vnode, hooks) {
|
|
1409
|
-
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
1410
|
-
vnode.transition = hooks;
|
|
1411
|
-
setTransitionHooks(vnode.component.subTree, hooks);
|
|
1412
|
-
} else if (vnode.shapeFlag & 128) {
|
|
1413
|
-
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
1414
|
-
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
1415
|
-
} else {
|
|
1416
|
-
vnode.transition = hooks;
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
getGlobalThis().requestIdleCallback || ((cb)=>setTimeout(cb, 1));
|
|
1420
|
-
getGlobalThis().cancelIdleCallback || ((id)=>clearTimeout(id));
|
|
1421
|
-
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
1422
|
-
if (target) {
|
|
1423
|
-
const hooks = target[type] || (target[type] = []);
|
|
1424
|
-
const wrappedHook = hook.__weh || (hook.__weh = (...args)=>{
|
|
1425
|
-
const reset = setCurrentInstance(target);
|
|
1426
|
-
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
1427
|
-
reset();
|
|
1428
|
-
return res;
|
|
1429
|
-
});
|
|
1430
|
-
if (prepend) {
|
|
1431
|
-
hooks.unshift(wrappedHook);
|
|
1432
|
-
} else {
|
|
1433
|
-
hooks.push(wrappedHook);
|
|
1434
|
-
}
|
|
1435
|
-
return wrappedHook;
|
|
1436
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1437
|
-
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
1438
|
-
warn$1(`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + ` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
const createHook = (lifecycle)=>(hook, target = currentInstance)=>{
|
|
1442
|
-
if (!isInSSRComponentSetup || lifecycle === "sp") {
|
|
1443
|
-
injectHook(lifecycle, (...args)=>hook(...args), target);
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
const onUnmounted = createHook("um");
|
|
1447
|
-
const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
|
|
1448
|
-
const PublicInstanceProxyHandlers = {
|
|
1449
|
-
};
|
|
1450
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
1451
|
-
PublicInstanceProxyHandlers.ownKeys = (target)=>{
|
|
1452
|
-
warn$1(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`);
|
|
1453
|
-
return Reflect.ownKeys(target);
|
|
1454
|
-
};
|
|
1455
|
-
}
|
|
1456
|
-
const internalObjectProto = {};
|
|
1457
|
-
const isInternalObject = (obj)=>Object.getPrototypeOf(obj) === internalObjectProto;
|
|
1458
|
-
const isSuspense = (type)=>type.__isSuspense;
|
|
1459
|
-
const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
|
|
1460
|
-
const Text = /* @__PURE__ */ Symbol.for("v-txt");
|
|
1461
|
-
const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
|
|
1462
|
-
function isVNode(value) {
|
|
1463
|
-
return value ? value.__v_isVNode === true : false;
|
|
1464
|
-
}
|
|
1465
|
-
const createVNodeWithArgsTransform = (...args)=>{
|
|
1466
|
-
return _createVNode(...args);
|
|
1467
|
-
};
|
|
1468
|
-
const normalizeKey = ({ key })=>key != null ? key : null;
|
|
1469
|
-
const normalizeRef = ({ ref, ref_key, ref_for })=>{
|
|
1470
|
-
if (typeof ref === "number") {
|
|
1471
|
-
ref = "" + ref;
|
|
1472
|
-
}
|
|
1473
|
-
return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? {
|
|
1474
|
-
i: currentRenderingInstance,
|
|
1475
|
-
r: ref,
|
|
1476
|
-
k: ref_key,
|
|
1477
|
-
f: !!ref_for
|
|
1478
|
-
} : ref : null;
|
|
1479
|
-
};
|
|
1480
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
1481
|
-
const vnode = {
|
|
1482
|
-
__v_isVNode: true,
|
|
1483
|
-
__v_skip: true,
|
|
1484
|
-
type,
|
|
1485
|
-
props,
|
|
1486
|
-
key: props && normalizeKey(props),
|
|
1487
|
-
ref: props && normalizeRef(props),
|
|
1488
|
-
scopeId: currentScopeId,
|
|
1489
|
-
slotScopeIds: null,
|
|
1490
|
-
children,
|
|
1491
|
-
component: null,
|
|
1492
|
-
suspense: null,
|
|
1493
|
-
ssContent: null,
|
|
1494
|
-
ssFallback: null,
|
|
1495
|
-
dirs: null,
|
|
1496
|
-
transition: null,
|
|
1497
|
-
el: null,
|
|
1498
|
-
anchor: null,
|
|
1499
|
-
target: null,
|
|
1500
|
-
targetStart: null,
|
|
1501
|
-
targetAnchor: null,
|
|
1502
|
-
staticCount: 0,
|
|
1503
|
-
shapeFlag,
|
|
1504
|
-
patchFlag,
|
|
1505
|
-
dynamicProps,
|
|
1506
|
-
dynamicChildren: null,
|
|
1507
|
-
appContext: null,
|
|
1508
|
-
ctx: currentRenderingInstance
|
|
1509
|
-
};
|
|
1510
|
-
if (needFullChildrenNormalization) {
|
|
1511
|
-
normalizeChildren(vnode, children);
|
|
1512
|
-
if (shapeFlag & 128) {
|
|
1513
|
-
type.normalize(vnode);
|
|
1514
|
-
}
|
|
1515
|
-
} else if (children) {
|
|
1516
|
-
vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
1517
|
-
}
|
|
1518
|
-
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
|
|
1519
|
-
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
1520
|
-
}
|
|
1521
|
-
return vnode;
|
|
1522
|
-
}
|
|
1523
|
-
const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
1524
|
-
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
1525
|
-
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
1526
|
-
if (!!(process.env.NODE_ENV !== "production") && !type) {
|
|
1527
|
-
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
1528
|
-
}
|
|
1529
|
-
type = Comment;
|
|
1530
|
-
}
|
|
1531
|
-
if (isVNode(type)) {
|
|
1532
|
-
const cloned = cloneVNode(type, props, true);
|
|
1533
|
-
if (children) {
|
|
1534
|
-
normalizeChildren(cloned, children);
|
|
1535
|
-
}
|
|
1536
|
-
cloned.patchFlag = -2;
|
|
1537
|
-
return cloned;
|
|
1538
|
-
}
|
|
1539
|
-
if (isClassComponent(type)) {
|
|
1540
|
-
type = type.__vccOpts;
|
|
1541
|
-
}
|
|
1542
|
-
if (props) {
|
|
1543
|
-
props = guardReactiveProps(props);
|
|
1544
|
-
let { class: klass, style } = props;
|
|
1545
|
-
if (klass && !isString(klass)) {
|
|
1546
|
-
props.class = normalizeClass(klass);
|
|
1547
|
-
}
|
|
1548
|
-
if (isObject(style)) {
|
|
1549
|
-
if (isProxy(style) && !isArray(style)) {
|
|
1550
|
-
style = extend({}, style);
|
|
1551
|
-
}
|
|
1552
|
-
props.style = normalizeStyle(style);
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
1556
|
-
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
1557
|
-
type = toRaw(type);
|
|
1558
|
-
warn$1(`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`, `
|
|
1559
|
-
Component that was made reactive: `, type);
|
|
1560
|
-
}
|
|
1561
|
-
return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
|
|
1562
|
-
}
|
|
1563
|
-
function guardReactiveProps(props) {
|
|
1564
|
-
if (!props) return null;
|
|
1565
|
-
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
1566
|
-
}
|
|
1567
|
-
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
1568
|
-
const { props, ref, patchFlag, children, transition } = vnode;
|
|
1569
|
-
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
1570
|
-
const cloned = {
|
|
1571
|
-
__v_isVNode: true,
|
|
1572
|
-
__v_skip: true,
|
|
1573
|
-
type: vnode.type,
|
|
1574
|
-
props: mergedProps,
|
|
1575
|
-
key: mergedProps && normalizeKey(mergedProps),
|
|
1576
|
-
ref: extraProps && extraProps.ref ? // #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
1577
|
-
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
1578
|
-
// the refs so the single vnode can be set on multiple refs
|
|
1579
|
-
mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [
|
|
1580
|
-
ref,
|
|
1581
|
-
normalizeRef(extraProps)
|
|
1582
|
-
] : normalizeRef(extraProps) : ref,
|
|
1583
|
-
scopeId: vnode.scopeId,
|
|
1584
|
-
slotScopeIds: vnode.slotScopeIds,
|
|
1585
|
-
children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
|
1586
|
-
target: vnode.target,
|
|
1587
|
-
targetStart: vnode.targetStart,
|
|
1588
|
-
targetAnchor: vnode.targetAnchor,
|
|
1589
|
-
staticCount: vnode.staticCount,
|
|
1590
|
-
shapeFlag: vnode.shapeFlag,
|
|
1591
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
1592
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
1593
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
1594
|
-
// fast paths only.
|
|
1595
|
-
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
1596
|
-
dynamicProps: vnode.dynamicProps,
|
|
1597
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
1598
|
-
appContext: vnode.appContext,
|
|
1599
|
-
dirs: vnode.dirs,
|
|
1600
|
-
transition,
|
|
1601
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
1602
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
1603
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
1604
|
-
// they will simply be overwritten.
|
|
1605
|
-
component: vnode.component,
|
|
1606
|
-
suspense: vnode.suspense,
|
|
1607
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
1608
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
1609
|
-
placeholder: vnode.placeholder,
|
|
1610
|
-
el: vnode.el,
|
|
1611
|
-
anchor: vnode.anchor,
|
|
1612
|
-
ctx: vnode.ctx,
|
|
1613
|
-
ce: vnode.ce
|
|
1614
|
-
};
|
|
1615
|
-
if (transition && cloneTransition) {
|
|
1616
|
-
setTransitionHooks(cloned, transition.clone(cloned));
|
|
1617
|
-
}
|
|
1618
|
-
return cloned;
|
|
1619
|
-
}
|
|
1620
|
-
function deepCloneVNode(vnode) {
|
|
1621
|
-
const cloned = cloneVNode(vnode);
|
|
1622
|
-
if (isArray(vnode.children)) {
|
|
1623
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
1624
|
-
}
|
|
1625
|
-
return cloned;
|
|
1626
|
-
}
|
|
1627
|
-
function createTextVNode(text = " ", flag = 0) {
|
|
1628
|
-
return createVNode(Text, null, text, flag);
|
|
1629
|
-
}
|
|
1630
|
-
function normalizeChildren(vnode, children) {
|
|
1631
|
-
let type = 0;
|
|
1632
|
-
const { shapeFlag } = vnode;
|
|
1633
|
-
if (children == null) {
|
|
1634
|
-
children = null;
|
|
1635
|
-
} else if (isArray(children)) {
|
|
1636
|
-
type = 16;
|
|
1637
|
-
} else if (typeof children === "object") {
|
|
1638
|
-
if (shapeFlag & (1 | 64)) {
|
|
1639
|
-
const slot = children.default;
|
|
1640
|
-
if (slot) {
|
|
1641
|
-
slot._c && (slot._d = false);
|
|
1642
|
-
normalizeChildren(vnode, slot());
|
|
1643
|
-
slot._c && (slot._d = true);
|
|
1644
|
-
}
|
|
1645
|
-
return;
|
|
1646
|
-
} else {
|
|
1647
|
-
type = 32;
|
|
1648
|
-
const slotFlag = children._;
|
|
1649
|
-
if (!slotFlag && !isInternalObject(children)) {
|
|
1650
|
-
children._ctx = currentRenderingInstance;
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
} else if (isFunction(children)) {
|
|
1654
|
-
children = {
|
|
1655
|
-
default: children,
|
|
1656
|
-
_ctx: currentRenderingInstance
|
|
1657
|
-
};
|
|
1658
|
-
type = 32;
|
|
1659
|
-
} else {
|
|
1660
|
-
children = String(children);
|
|
1661
|
-
if (shapeFlag & 64) {
|
|
1662
|
-
type = 16;
|
|
1663
|
-
children = [
|
|
1664
|
-
createTextVNode(children)
|
|
1665
|
-
];
|
|
1666
|
-
} else {
|
|
1667
|
-
type = 8;
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
vnode.children = children;
|
|
1671
|
-
vnode.shapeFlag |= type;
|
|
1672
|
-
}
|
|
1673
|
-
function mergeProps(...args) {
|
|
1674
|
-
const ret = {};
|
|
1675
|
-
for(let i = 0; i < args.length; i++){
|
|
1676
|
-
const toMerge = args[i];
|
|
1677
|
-
for(const key in toMerge){
|
|
1678
|
-
if (key === "class") {
|
|
1679
|
-
if (ret.class !== toMerge.class) {
|
|
1680
|
-
ret.class = normalizeClass([
|
|
1681
|
-
ret.class,
|
|
1682
|
-
toMerge.class
|
|
1683
|
-
]);
|
|
1684
|
-
}
|
|
1685
|
-
} else if (key === "style") {
|
|
1686
|
-
ret.style = normalizeStyle([
|
|
1687
|
-
ret.style,
|
|
1688
|
-
toMerge.style
|
|
1689
|
-
]);
|
|
1690
|
-
} else if (isOn(key)) {
|
|
1691
|
-
const existing = ret[key];
|
|
1692
|
-
const incoming = toMerge[key];
|
|
1693
|
-
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
|
1694
|
-
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
1695
|
-
} else if (incoming == null && existing == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
|
|
1696
|
-
// the model listener.
|
|
1697
|
-
!isModelListener(key)) {
|
|
1698
|
-
ret[key] = incoming;
|
|
1699
|
-
}
|
|
1700
|
-
} else if (key !== "") {
|
|
1701
|
-
ret[key] = toMerge[key];
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
return ret;
|
|
1706
|
-
}
|
|
1707
|
-
let currentInstance = null;
|
|
1708
|
-
const getCurrentInstance = ()=>currentInstance || currentRenderingInstance;
|
|
1709
|
-
let internalSetCurrentInstance;
|
|
1710
|
-
{
|
|
1711
|
-
const g = getGlobalThis();
|
|
1712
|
-
const registerGlobalSetter = (key, setter)=>{
|
|
1713
|
-
let setters;
|
|
1714
|
-
if (!(setters = g[key])) setters = g[key] = [];
|
|
1715
|
-
setters.push(setter);
|
|
1716
|
-
return (v1)=>{
|
|
1717
|
-
if (setters.length > 1) setters.forEach((set)=>set(v1));
|
|
1718
|
-
else setters[0](v1);
|
|
1719
|
-
};
|
|
1720
|
-
};
|
|
1721
|
-
internalSetCurrentInstance = registerGlobalSetter(`__VUE_INSTANCE_SETTERS__`, (v1)=>currentInstance = v1);
|
|
1722
|
-
registerGlobalSetter(`__VUE_SSR_SETTERS__`, (v1)=>isInSSRComponentSetup = v1);
|
|
1723
|
-
}const setCurrentInstance = (instance)=>{
|
|
1724
|
-
const prev = currentInstance;
|
|
1725
|
-
internalSetCurrentInstance(instance);
|
|
1726
|
-
instance.scope.on();
|
|
1727
|
-
return ()=>{
|
|
1728
|
-
instance.scope.off();
|
|
1729
|
-
internalSetCurrentInstance(prev);
|
|
1730
|
-
};
|
|
1731
|
-
};
|
|
1732
|
-
let isInSSRComponentSetup = false;
|
|
1733
|
-
!!(process.env.NODE_ENV !== "production") ? {
|
|
1734
|
-
} : {
|
|
1735
|
-
};
|
|
1736
|
-
const classifyRE = /(?:^|[-_])\w/g;
|
|
1737
|
-
const classify = (str)=>str.replace(classifyRE, (c)=>c.toUpperCase()).replace(/[-_]/g, "");
|
|
1738
|
-
function getComponentName(Component, includeInferred = true) {
|
|
1739
|
-
return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
|
1740
|
-
}
|
|
1741
|
-
function formatComponentName(instance, Component, isRoot = false) {
|
|
1742
|
-
let name = getComponentName(Component);
|
|
1743
|
-
if (!name && Component.__file) {
|
|
1744
|
-
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
1745
|
-
if (match) {
|
|
1746
|
-
name = match[1];
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
if (!name && instance) {
|
|
1750
|
-
const inferFromRegistry = (registry)=>{
|
|
1751
|
-
for(const key in registry){
|
|
1752
|
-
if (registry[key] === Component) {
|
|
1753
|
-
return key;
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
};
|
|
1757
|
-
name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
1758
|
-
}
|
|
1759
|
-
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
1760
|
-
}
|
|
1761
|
-
function isClassComponent(value) {
|
|
1762
|
-
return isFunction(value) && "__vccOpts" in value;
|
|
1763
|
-
}
|
|
1764
|
-
function initCustomFormatter() {
|
|
1765
|
-
if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1768
|
-
const vueStyle = {
|
|
1769
|
-
style: "color:#3ba776"
|
|
1770
|
-
};
|
|
1771
|
-
const numberStyle = {
|
|
1772
|
-
style: "color:#1677ff"
|
|
1773
|
-
};
|
|
1774
|
-
const stringStyle = {
|
|
1775
|
-
style: "color:#f5222d"
|
|
1776
|
-
};
|
|
1777
|
-
const keywordStyle = {
|
|
1778
|
-
style: "color:#eb2f96"
|
|
1779
|
-
};
|
|
1780
|
-
const formatter = {
|
|
1781
|
-
__vue_custom_formatter: true,
|
|
1782
|
-
header (obj) {
|
|
1783
|
-
if (!isObject(obj)) {
|
|
1784
|
-
return null;
|
|
1785
|
-
}
|
|
1786
|
-
if (obj.__isVue) {
|
|
1787
|
-
return [
|
|
1788
|
-
"div",
|
|
1789
|
-
vueStyle,
|
|
1790
|
-
`VueInstance`
|
|
1791
|
-
];
|
|
1792
|
-
} else if (isRef(obj)) {
|
|
1793
|
-
const value = obj.value;
|
|
1794
|
-
return [
|
|
1795
|
-
"div",
|
|
1796
|
-
{},
|
|
1797
|
-
[
|
|
1798
|
-
"span",
|
|
1799
|
-
vueStyle,
|
|
1800
|
-
genRefFlag(obj)
|
|
1801
|
-
],
|
|
1802
|
-
"<",
|
|
1803
|
-
formatValue(value),
|
|
1804
|
-
`>`
|
|
1805
|
-
];
|
|
1806
|
-
} else if (isReactive(obj)) {
|
|
1807
|
-
return [
|
|
1808
|
-
"div",
|
|
1809
|
-
{},
|
|
1810
|
-
[
|
|
1811
|
-
"span",
|
|
1812
|
-
vueStyle,
|
|
1813
|
-
isShallow(obj) ? "ShallowReactive" : "Reactive"
|
|
1814
|
-
],
|
|
1815
|
-
"<",
|
|
1816
|
-
formatValue(obj),
|
|
1817
|
-
`>${isReadonly(obj) ? ` (readonly)` : ``}`
|
|
1818
|
-
];
|
|
1819
|
-
} else if (isReadonly(obj)) {
|
|
1820
|
-
return [
|
|
1821
|
-
"div",
|
|
1822
|
-
{},
|
|
1823
|
-
[
|
|
1824
|
-
"span",
|
|
1825
|
-
vueStyle,
|
|
1826
|
-
isShallow(obj) ? "ShallowReadonly" : "Readonly"
|
|
1827
|
-
],
|
|
1828
|
-
"<",
|
|
1829
|
-
formatValue(obj),
|
|
1830
|
-
">"
|
|
1831
|
-
];
|
|
1832
|
-
}
|
|
1833
|
-
return null;
|
|
1834
|
-
},
|
|
1835
|
-
hasBody (obj) {
|
|
1836
|
-
return obj && obj.__isVue;
|
|
1837
|
-
},
|
|
1838
|
-
body (obj) {
|
|
1839
|
-
if (obj && obj.__isVue) {
|
|
1840
|
-
return [
|
|
1841
|
-
"div",
|
|
1842
|
-
{},
|
|
1843
|
-
...formatInstance(obj.$)
|
|
1844
|
-
];
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
function formatInstance(instance) {
|
|
1849
|
-
const blocks = [];
|
|
1850
|
-
if (instance.type.props && instance.props) {
|
|
1851
|
-
blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
|
1852
|
-
}
|
|
1853
|
-
if (instance.setupState !== EMPTY_OBJ) {
|
|
1854
|
-
blocks.push(createInstanceBlock("setup", instance.setupState));
|
|
1855
|
-
}
|
|
1856
|
-
if (instance.data !== EMPTY_OBJ) {
|
|
1857
|
-
blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
|
1858
|
-
}
|
|
1859
|
-
const computed = extractKeys(instance, "computed");
|
|
1860
|
-
if (computed) {
|
|
1861
|
-
blocks.push(createInstanceBlock("computed", computed));
|
|
1862
|
-
}
|
|
1863
|
-
const injected = extractKeys(instance, "inject");
|
|
1864
|
-
if (injected) {
|
|
1865
|
-
blocks.push(createInstanceBlock("injected", injected));
|
|
1866
|
-
}
|
|
1867
|
-
blocks.push([
|
|
1868
|
-
"div",
|
|
1869
|
-
{},
|
|
1870
|
-
[
|
|
1871
|
-
"span",
|
|
1872
|
-
{
|
|
1873
|
-
style: keywordStyle.style + ";opacity:0.66"
|
|
1874
|
-
},
|
|
1875
|
-
"$ (internal): "
|
|
1876
|
-
],
|
|
1877
|
-
[
|
|
1878
|
-
"object",
|
|
1879
|
-
{
|
|
1880
|
-
object: instance
|
|
1881
|
-
}
|
|
1882
|
-
]
|
|
1883
|
-
]);
|
|
1884
|
-
return blocks;
|
|
1885
|
-
}
|
|
1886
|
-
function createInstanceBlock(type, target) {
|
|
1887
|
-
target = extend({}, target);
|
|
1888
|
-
if (!Object.keys(target).length) {
|
|
1889
|
-
return [
|
|
1890
|
-
"span",
|
|
1891
|
-
{}
|
|
1892
|
-
];
|
|
1893
|
-
}
|
|
1894
|
-
return [
|
|
1895
|
-
"div",
|
|
1896
|
-
{
|
|
1897
|
-
style: "line-height:1.25em;margin-bottom:0.6em"
|
|
1898
|
-
},
|
|
1899
|
-
[
|
|
1900
|
-
"div",
|
|
1901
|
-
{
|
|
1902
|
-
style: "color:#476582"
|
|
1903
|
-
},
|
|
1904
|
-
type
|
|
1905
|
-
],
|
|
1906
|
-
[
|
|
1907
|
-
"div",
|
|
1908
|
-
{
|
|
1909
|
-
style: "padding-left:1.25em"
|
|
1910
|
-
},
|
|
1911
|
-
...Object.keys(target).map((key)=>{
|
|
1912
|
-
return [
|
|
1913
|
-
"div",
|
|
1914
|
-
{},
|
|
1915
|
-
[
|
|
1916
|
-
"span",
|
|
1917
|
-
keywordStyle,
|
|
1918
|
-
key + ": "
|
|
1919
|
-
],
|
|
1920
|
-
formatValue(target[key], false)
|
|
1921
|
-
];
|
|
1922
|
-
})
|
|
1923
|
-
]
|
|
1924
|
-
];
|
|
1925
|
-
}
|
|
1926
|
-
function formatValue(v1, asRaw = true) {
|
|
1927
|
-
if (typeof v1 === "number") {
|
|
1928
|
-
return [
|
|
1929
|
-
"span",
|
|
1930
|
-
numberStyle,
|
|
1931
|
-
v1
|
|
1932
|
-
];
|
|
1933
|
-
} else if (typeof v1 === "string") {
|
|
1934
|
-
return [
|
|
1935
|
-
"span",
|
|
1936
|
-
stringStyle,
|
|
1937
|
-
JSON.stringify(v1)
|
|
1938
|
-
];
|
|
1939
|
-
} else if (typeof v1 === "boolean") {
|
|
1940
|
-
return [
|
|
1941
|
-
"span",
|
|
1942
|
-
keywordStyle,
|
|
1943
|
-
v1
|
|
1944
|
-
];
|
|
1945
|
-
} else if (isObject(v1)) {
|
|
1946
|
-
return [
|
|
1947
|
-
"object",
|
|
1948
|
-
{
|
|
1949
|
-
object: asRaw ? toRaw(v1) : v1
|
|
1950
|
-
}
|
|
1951
|
-
];
|
|
1952
|
-
} else {
|
|
1953
|
-
return [
|
|
1954
|
-
"span",
|
|
1955
|
-
stringStyle,
|
|
1956
|
-
String(v1)
|
|
1957
|
-
];
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
function extractKeys(instance, type) {
|
|
1961
|
-
const Comp = instance.type;
|
|
1962
|
-
if (isFunction(Comp)) {
|
|
1963
|
-
return;
|
|
1964
|
-
}
|
|
1965
|
-
const extracted = {};
|
|
1966
|
-
for(const key in instance.ctx){
|
|
1967
|
-
if (isKeyOfType(Comp, key, type)) {
|
|
1968
|
-
extracted[key] = instance.ctx[key];
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
return extracted;
|
|
1972
|
-
}
|
|
1973
|
-
function isKeyOfType(Comp, key, type) {
|
|
1974
|
-
const opts = Comp[type];
|
|
1975
|
-
if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
|
1976
|
-
return true;
|
|
1977
|
-
}
|
|
1978
|
-
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
1979
|
-
return true;
|
|
1980
|
-
}
|
|
1981
|
-
if (Comp.mixins && Comp.mixins.some((m)=>isKeyOfType(m, key, type))) {
|
|
1982
|
-
return true;
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
function genRefFlag(v1) {
|
|
1986
|
-
if (isShallow(v1)) {
|
|
1987
|
-
return `ShallowRef`;
|
|
1988
|
-
}
|
|
1989
|
-
if (v1.effect) {
|
|
1990
|
-
return `ComputedRef`;
|
|
1991
|
-
}
|
|
1992
|
-
return `Ref`;
|
|
1993
|
-
}
|
|
1994
|
-
if (window.devtoolsFormatters) {
|
|
1995
|
-
window.devtoolsFormatters.push(formatter);
|
|
1996
|
-
} else {
|
|
1997
|
-
window.devtoolsFormatters = [
|
|
1998
|
-
formatter
|
|
1999
|
-
];
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
!!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
2003
|
-
!!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
2004
|
-
!!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
|
|
2005
|
-
|
|
2006
|
-
function initDev() {
|
|
2007
|
-
{
|
|
2008
|
-
initCustomFormatter();
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2012
|
-
initDev();
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
// Notify logic (no React dependencies)
|
|
2016
|
-
// Provides toast management and utilities for VanillaJS, Vue, Svelte, etc.
|
|
2017
|
-
class NotifyCore {
|
|
2018
|
-
generateId() {
|
|
2019
|
-
return `${++this.idCounter}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
2020
|
-
}
|
|
2021
|
-
subscribe(fn) {
|
|
2022
|
-
this.listeners.add(fn);
|
|
2023
|
-
fn(this.toasts);
|
|
2024
|
-
return ()=>this.listeners.delete(fn);
|
|
2025
|
-
}
|
|
2026
|
-
emit() {
|
|
2027
|
-
for (const fn of this.listeners)fn(this.toasts);
|
|
2028
|
-
}
|
|
2029
|
-
update(fn) {
|
|
2030
|
-
this.toasts = fn(this.toasts);
|
|
2031
|
-
this.emit();
|
|
2032
|
-
}
|
|
2033
|
-
dismiss(id) {
|
|
2034
|
-
const item = this.toasts.find((t)=>t.id === id);
|
|
2035
|
-
if (!item || item.exiting) return;
|
|
2036
|
-
this.update((prev)=>prev.map((t)=>t.id === id ? _extends({}, t, {
|
|
2037
|
-
exiting: true
|
|
2038
|
-
}) : t));
|
|
2039
|
-
setTimeout(()=>this.update((prev)=>prev.filter((t)=>t.id !== id)), 600);
|
|
2040
|
-
}
|
|
2041
|
-
show(opts) {
|
|
2042
|
-
var _ref, _ref1, _opts_type;
|
|
2043
|
-
// Use a unique identifier based on options (e.g., the title or a generated key)
|
|
2044
|
-
// If not provided, use a default one
|
|
2045
|
-
const id = opts.title ? `notify-${opts.title}` : "notify-default";
|
|
2046
|
-
const prevItem = this.toasts.find((t)=>t.id === id);
|
|
2047
|
-
const instanceId = (_ref = prevItem == null ? void 0 : prevItem.instanceId) != null ? _ref : this.generateId();
|
|
2048
|
-
// Set the state correctly
|
|
2049
|
-
const state = (_ref1 = (_opts_type = opts.type) != null ? _opts_type : prevItem == null ? void 0 : prevItem.type) != null ? _ref1 : "success";
|
|
2050
|
-
const item = _extends({}, prevItem, opts, {
|
|
2051
|
-
id,
|
|
2052
|
-
instanceId,
|
|
2053
|
-
type: state
|
|
2054
|
-
});
|
|
2055
|
-
this.update((prev)=>{
|
|
2056
|
-
const filtered = prev.filter((t)=>t.id !== id);
|
|
2057
|
-
return [
|
|
2058
|
-
...filtered,
|
|
2059
|
-
item
|
|
2060
|
-
];
|
|
2061
|
-
});
|
|
2062
|
-
return id;
|
|
2063
|
-
}
|
|
2064
|
-
getToasts() {
|
|
2065
|
-
return this.toasts;
|
|
2066
|
-
}
|
|
2067
|
-
constructor(){
|
|
2068
|
-
this.toasts = [];
|
|
2069
|
-
this.listeners = new Set();
|
|
2070
|
-
this.position = "top-right";
|
|
2071
|
-
this.options = undefined;
|
|
2072
|
-
this.idCounter = 0;
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
// Global instance for multiplatform usage
|
|
2076
|
-
const notifyCore = new NotifyCore();
|
|
2077
|
-
|
|
2078
|
-
// Vue wrapper for Notify
|
|
2079
|
-
// Provides a composable and basic component for Vue 3
|
|
2080
|
-
function useNotifyToasts() {
|
|
2081
|
-
const toasts = ref(notifyCore.getToasts());
|
|
2082
|
-
const unsub = notifyCore.subscribe((t)=>toasts.value = t);
|
|
2083
|
-
// In tests the composable can run outside a component setup function.
|
|
2084
|
-
// Register lifecycle cleanup only when there is an active Vue instance.
|
|
2085
|
-
if (getCurrentInstance()) {
|
|
2086
|
-
onUnmounted(unsub);
|
|
2087
|
-
}
|
|
2088
|
-
return {
|
|
2089
|
-
toasts
|
|
2090
|
-
};
|
|
2091
|
-
}
|
|
2092
|
-
function showNotifyToast(options) {
|
|
2093
|
-
return notifyCore.show(options);
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
const ICONS = {
|
|
2097
|
-
success: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>',
|
|
2098
|
-
error: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',
|
|
2099
|
-
warning: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>',
|
|
2100
|
-
info: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="m4.93 4.93 4.24 4.24"/><path d="m14.83 9.17 4.24-4.24"/><path d="m14.83 14.83 4.24 4.24"/><path d="m9.17 14.83-4.24 4.24"/><circle cx="12" cy="12" r="4"/></svg>',
|
|
2101
|
-
loading: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" data-notify-icon="spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>',
|
|
2102
|
-
action: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>'
|
|
2103
|
-
};
|
|
2104
|
-
const EXIT_MS = 600;
|
|
2105
|
-
function capitalize(s) {
|
|
2106
|
-
return s ? s.charAt(0).toUpperCase() + s.slice(1) : "";
|
|
2107
|
-
}
|
|
2108
|
-
let viewport = null;
|
|
2109
|
-
const toastEls = new Map();
|
|
2110
|
-
function getOrCreateViewport(position) {
|
|
2111
|
-
if (!viewport) {
|
|
2112
|
-
viewport = document.createElement("div");
|
|
2113
|
-
viewport.setAttribute("data-notify-viewport", "");
|
|
2114
|
-
viewport.setAttribute("data-position", position);
|
|
2115
|
-
viewport.setAttribute("data-theme", "light");
|
|
2116
|
-
document.body.appendChild(viewport);
|
|
2117
|
-
}
|
|
2118
|
-
return viewport;
|
|
2119
|
-
}
|
|
2120
|
-
function buildToastEl(toast) {
|
|
2121
|
-
const state = toast.type || "success";
|
|
2122
|
-
const btn = document.createElement("button");
|
|
2123
|
-
btn.type = "button";
|
|
2124
|
-
btn.setAttribute("data-notify-toast", "");
|
|
2125
|
-
btn.setAttribute("data-state", state);
|
|
2126
|
-
btn.setAttribute("data-ready", "false");
|
|
2127
|
-
btn.setAttribute("data-exiting", "false");
|
|
2128
|
-
const card = document.createElement("div");
|
|
2129
|
-
card.setAttribute("data-notify-card", "");
|
|
2130
|
-
const header = document.createElement("div");
|
|
2131
|
-
header.setAttribute("data-notify-header", "");
|
|
2132
|
-
const badge = document.createElement("div");
|
|
2133
|
-
badge.setAttribute("data-notify-badge", "");
|
|
2134
|
-
badge.setAttribute("data-state", state);
|
|
2135
|
-
badge.innerHTML = ICONS[state] || ICONS.success;
|
|
2136
|
-
const titleEl = document.createElement("span");
|
|
2137
|
-
titleEl.setAttribute("data-notify-title", "");
|
|
2138
|
-
titleEl.setAttribute("data-state", state);
|
|
2139
|
-
titleEl.textContent = toast.title || capitalize(state);
|
|
2140
|
-
header.appendChild(badge);
|
|
2141
|
-
header.appendChild(titleEl);
|
|
2142
|
-
card.appendChild(header);
|
|
2143
|
-
if (toast.description || toast.button) {
|
|
2144
|
-
const content = document.createElement("div");
|
|
2145
|
-
content.setAttribute("data-notify-content", "");
|
|
2146
|
-
content.setAttribute("data-visible", "true");
|
|
2147
|
-
if (toast.description) {
|
|
2148
|
-
const desc = document.createElement("div");
|
|
2149
|
-
desc.setAttribute("data-notify-description", "");
|
|
2150
|
-
desc.textContent = toast.description;
|
|
2151
|
-
content.appendChild(desc);
|
|
2152
|
-
}
|
|
2153
|
-
if (toast.button) {
|
|
2154
|
-
const actionBtn = document.createElement("button");
|
|
2155
|
-
actionBtn.setAttribute("data-notify-button", "");
|
|
2156
|
-
actionBtn.setAttribute("data-state", state);
|
|
2157
|
-
actionBtn.textContent = toast.button.title;
|
|
2158
|
-
actionBtn.addEventListener("click", (e)=>{
|
|
2159
|
-
var _toast_button;
|
|
2160
|
-
e.stopPropagation();
|
|
2161
|
-
(_toast_button = toast.button) == null ? void 0 : _toast_button.onClick();
|
|
2162
|
-
notifyCore.dismiss(toast.id);
|
|
2163
|
-
});
|
|
2164
|
-
content.appendChild(actionBtn);
|
|
2165
|
-
}
|
|
2166
|
-
card.appendChild(content);
|
|
2167
|
-
}
|
|
2168
|
-
btn.appendChild(card);
|
|
2169
|
-
btn.addEventListener("click", ()=>notifyCore.dismiss(toast.id));
|
|
2170
|
-
requestAnimationFrame(()=>{
|
|
2171
|
-
requestAnimationFrame(()=>{
|
|
2172
|
-
btn.setAttribute("data-ready", "true");
|
|
2173
|
-
});
|
|
2174
|
-
});
|
|
2175
|
-
return btn;
|
|
2176
|
-
}
|
|
2177
|
-
function updateToastEl(el, toast) {
|
|
2178
|
-
const state = toast.type || "success";
|
|
2179
|
-
el.setAttribute("data-state", state);
|
|
2180
|
-
if (toast.exiting) {
|
|
2181
|
-
el.setAttribute("data-exiting", "true");
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
function renderNotifyToasts(options = {}) {
|
|
2185
|
-
var _options_position;
|
|
2186
|
-
const position = (_options_position = options.position) != null ? _options_position : "top-right";
|
|
2187
|
-
const vp = getOrCreateViewport(position);
|
|
2188
|
-
return notifyCore.subscribe((toasts)=>{
|
|
2189
|
-
const liveIds = new Set(toasts.map((t)=>t.id));
|
|
2190
|
-
for (const [id, el] of toastEls){
|
|
2191
|
-
if (!liveIds.has(id)) {
|
|
2192
|
-
el.setAttribute("data-exiting", "true");
|
|
2193
|
-
setTimeout(()=>{
|
|
2194
|
-
el.remove();
|
|
2195
|
-
toastEls.delete(id);
|
|
2196
|
-
}, EXIT_MS);
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
for (const toast of toasts){
|
|
2200
|
-
if (toastEls.has(toast.id)) {
|
|
2201
|
-
updateToastEl(toastEls.get(toast.id), toast);
|
|
2202
|
-
} else {
|
|
2203
|
-
const el = buildToastEl(toast);
|
|
2204
|
-
toastEls.set(toast.id, el);
|
|
2205
|
-
vp.appendChild(el);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
export { renderNotifyToasts, showNotifyToast, useNotifyToasts };
|