@katlux/providers 0.1.0-beta.9 → 0.1.1-alpha.86
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 +200 -21
- package/README.md +8 -3
- package/dist/index.cjs +298 -3031
- package/dist/index.d.cts +27 -1406
- package/dist/index.d.mts +27 -1406
- package/dist/index.d.ts +27 -1406
- package/dist/index.mjs +243 -2976
- package/dist/nuxtAppCompat.cjs +55 -0
- package/dist/nuxtAppCompat.d.cts +31 -0
- package/dist/nuxtAppCompat.d.mts +31 -0
- package/dist/nuxtAppCompat.d.ts +31 -0
- package/dist/nuxtAppCompat.mjs +47 -0
- package/dist/nuxtAppCompat.server.cjs +29 -0
- package/dist/nuxtAppCompat.server.d.cts +21 -0
- package/dist/nuxtAppCompat.server.d.mts +21 -0
- package/dist/nuxtAppCompat.server.d.ts +21 -0
- package/dist/nuxtAppCompat.server.mjs +21 -0
- package/package.json +21 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { ref, watch, computed } from 'vue';
|
|
2
|
+
import { getNuxtApp, getRoute, getRouter, getNuxtData, clearNuxtDataKey, getAsyncData, onNuxtReadyCallback } from '@katlux/providers/nuxtAppCompat';
|
|
1
3
|
import { EDataFilterOperator as EDataFilterOperator$1 } from '@katlux/providers';
|
|
4
|
+
import { parseCookies, getCookie, setCookie, deleteCookie } from 'h3';
|
|
5
|
+
import { $fetch } from 'ofetch';
|
|
2
6
|
|
|
3
7
|
var EDataFilterOperator = /* @__PURE__ */ ((EDataFilterOperator2) => {
|
|
4
8
|
EDataFilterOperator2["Equal"] = "==";
|
|
@@ -25,2840 +29,6 @@ var ECacheStrategy = /* @__PURE__ */ ((ECacheStrategy2) => {
|
|
|
25
29
|
return ECacheStrategy2;
|
|
26
30
|
})(ECacheStrategy || {});
|
|
27
31
|
|
|
28
|
-
/**
|
|
29
|
-
* @vue/shared v3.5.24
|
|
30
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
31
|
-
* @license MIT
|
|
32
|
-
**/
|
|
33
|
-
// @__NO_SIDE_EFFECTS__
|
|
34
|
-
function makeMap(str) {
|
|
35
|
-
const map = /* @__PURE__ */ Object.create(null);
|
|
36
|
-
for (const key of str.split(",")) map[key] = 1;
|
|
37
|
-
return (val) => val in map;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
41
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
42
|
-
const NOOP = () => {
|
|
43
|
-
};
|
|
44
|
-
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
45
|
-
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
46
|
-
const extend = Object.assign;
|
|
47
|
-
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
48
|
-
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
49
|
-
const isArray = Array.isArray;
|
|
50
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
51
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
52
|
-
const isFunction = (val) => typeof val === "function";
|
|
53
|
-
const isString = (val) => typeof val === "string";
|
|
54
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
55
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
56
|
-
const isPromise = (val) => {
|
|
57
|
-
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
58
|
-
};
|
|
59
|
-
const objectToString = Object.prototype.toString;
|
|
60
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
61
|
-
const toRawType = (value) => {
|
|
62
|
-
return toTypeString(value).slice(8, -1);
|
|
63
|
-
};
|
|
64
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
65
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
66
|
-
const cacheStringFunction = (fn) => {
|
|
67
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
68
|
-
return ((str) => {
|
|
69
|
-
const hit = cache[str];
|
|
70
|
-
return hit || (cache[str] = fn(str));
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
const capitalize = cacheStringFunction((str) => {
|
|
74
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
75
|
-
});
|
|
76
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
77
|
-
let _globalThis;
|
|
78
|
-
const getGlobalThis = () => {
|
|
79
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
function normalizeStyle(value) {
|
|
83
|
-
if (isArray(value)) {
|
|
84
|
-
const res = {};
|
|
85
|
-
for (let i = 0; i < value.length; i++) {
|
|
86
|
-
const item = value[i];
|
|
87
|
-
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
|
88
|
-
if (normalized) {
|
|
89
|
-
for (const key in normalized) {
|
|
90
|
-
res[key] = normalized[key];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return res;
|
|
95
|
-
} else if (isString(value) || isObject(value)) {
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
100
|
-
const propertyDelimiterRE = /:([^]+)/;
|
|
101
|
-
const styleCommentRE = /\/\*[^]*?\*\//g;
|
|
102
|
-
function parseStringStyle(cssText) {
|
|
103
|
-
const ret = {};
|
|
104
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
105
|
-
if (item) {
|
|
106
|
-
const tmp = item.split(propertyDelimiterRE);
|
|
107
|
-
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return ret;
|
|
111
|
-
}
|
|
112
|
-
function normalizeClass(value) {
|
|
113
|
-
let res = "";
|
|
114
|
-
if (isString(value)) {
|
|
115
|
-
res = value;
|
|
116
|
-
} else if (isArray(value)) {
|
|
117
|
-
for (let i = 0; i < value.length; i++) {
|
|
118
|
-
const normalized = normalizeClass(value[i]);
|
|
119
|
-
if (normalized) {
|
|
120
|
-
res += normalized + " ";
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} else if (isObject(value)) {
|
|
124
|
-
for (const name in value) {
|
|
125
|
-
if (value[name]) {
|
|
126
|
-
res += name + " ";
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return res.trim();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @vue/reactivity v3.5.24
|
|
135
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
136
|
-
* @license MIT
|
|
137
|
-
**/
|
|
138
|
-
|
|
139
|
-
function warn(msg, ...args) {
|
|
140
|
-
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
let activeSub;
|
|
144
|
-
const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
|
|
145
|
-
class ReactiveEffect {
|
|
146
|
-
constructor(fn) {
|
|
147
|
-
this.fn = fn;
|
|
148
|
-
/**
|
|
149
|
-
* @internal
|
|
150
|
-
*/
|
|
151
|
-
this.deps = void 0;
|
|
152
|
-
/**
|
|
153
|
-
* @internal
|
|
154
|
-
*/
|
|
155
|
-
this.depsTail = void 0;
|
|
156
|
-
/**
|
|
157
|
-
* @internal
|
|
158
|
-
*/
|
|
159
|
-
this.flags = 1 | 4;
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
this.next = void 0;
|
|
164
|
-
/**
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
this.cleanup = void 0;
|
|
168
|
-
this.scheduler = void 0;
|
|
169
|
-
}
|
|
170
|
-
pause() {
|
|
171
|
-
this.flags |= 64;
|
|
172
|
-
}
|
|
173
|
-
resume() {
|
|
174
|
-
if (this.flags & 64) {
|
|
175
|
-
this.flags &= -65;
|
|
176
|
-
if (pausedQueueEffects.has(this)) {
|
|
177
|
-
pausedQueueEffects.delete(this);
|
|
178
|
-
this.trigger();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* @internal
|
|
184
|
-
*/
|
|
185
|
-
notify() {
|
|
186
|
-
if (this.flags & 2 && !(this.flags & 32)) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (!(this.flags & 8)) {
|
|
190
|
-
batch(this);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
run() {
|
|
194
|
-
if (!(this.flags & 1)) {
|
|
195
|
-
return this.fn();
|
|
196
|
-
}
|
|
197
|
-
this.flags |= 2;
|
|
198
|
-
cleanupEffect(this);
|
|
199
|
-
prepareDeps(this);
|
|
200
|
-
const prevEffect = activeSub;
|
|
201
|
-
const prevShouldTrack = shouldTrack;
|
|
202
|
-
activeSub = this;
|
|
203
|
-
shouldTrack = true;
|
|
204
|
-
try {
|
|
205
|
-
return this.fn();
|
|
206
|
-
} finally {
|
|
207
|
-
if (!!(process.env.NODE_ENV !== "production") && activeSub !== this) {
|
|
208
|
-
warn(
|
|
209
|
-
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
cleanupDeps(this);
|
|
213
|
-
activeSub = prevEffect;
|
|
214
|
-
shouldTrack = prevShouldTrack;
|
|
215
|
-
this.flags &= -3;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
stop() {
|
|
219
|
-
if (this.flags & 1) {
|
|
220
|
-
for (let link = this.deps; link; link = link.nextDep) {
|
|
221
|
-
removeSub(link);
|
|
222
|
-
}
|
|
223
|
-
this.deps = this.depsTail = void 0;
|
|
224
|
-
cleanupEffect(this);
|
|
225
|
-
this.onStop && this.onStop();
|
|
226
|
-
this.flags &= -2;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
trigger() {
|
|
230
|
-
if (this.flags & 64) {
|
|
231
|
-
pausedQueueEffects.add(this);
|
|
232
|
-
} else if (this.scheduler) {
|
|
233
|
-
this.scheduler();
|
|
234
|
-
} else {
|
|
235
|
-
this.runIfDirty();
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* @internal
|
|
240
|
-
*/
|
|
241
|
-
runIfDirty() {
|
|
242
|
-
if (isDirty(this)) {
|
|
243
|
-
this.run();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
get dirty() {
|
|
247
|
-
return isDirty(this);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
let batchDepth = 0;
|
|
251
|
-
let batchedSub;
|
|
252
|
-
let batchedComputed;
|
|
253
|
-
function batch(sub, isComputed = false) {
|
|
254
|
-
sub.flags |= 8;
|
|
255
|
-
if (isComputed) {
|
|
256
|
-
sub.next = batchedComputed;
|
|
257
|
-
batchedComputed = sub;
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
sub.next = batchedSub;
|
|
261
|
-
batchedSub = sub;
|
|
262
|
-
}
|
|
263
|
-
function startBatch() {
|
|
264
|
-
batchDepth++;
|
|
265
|
-
}
|
|
266
|
-
function endBatch() {
|
|
267
|
-
if (--batchDepth > 0) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (batchedComputed) {
|
|
271
|
-
let e = batchedComputed;
|
|
272
|
-
batchedComputed = void 0;
|
|
273
|
-
while (e) {
|
|
274
|
-
const next = e.next;
|
|
275
|
-
e.next = void 0;
|
|
276
|
-
e.flags &= -9;
|
|
277
|
-
e = next;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
let error;
|
|
281
|
-
while (batchedSub) {
|
|
282
|
-
let e = batchedSub;
|
|
283
|
-
batchedSub = void 0;
|
|
284
|
-
while (e) {
|
|
285
|
-
const next = e.next;
|
|
286
|
-
e.next = void 0;
|
|
287
|
-
e.flags &= -9;
|
|
288
|
-
if (e.flags & 1) {
|
|
289
|
-
try {
|
|
290
|
-
;
|
|
291
|
-
e.trigger();
|
|
292
|
-
} catch (err) {
|
|
293
|
-
if (!error) error = err;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
e = next;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (error) throw error;
|
|
300
|
-
}
|
|
301
|
-
function prepareDeps(sub) {
|
|
302
|
-
for (let link = sub.deps; link; link = link.nextDep) {
|
|
303
|
-
link.version = -1;
|
|
304
|
-
link.prevActiveLink = link.dep.activeLink;
|
|
305
|
-
link.dep.activeLink = link;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function cleanupDeps(sub) {
|
|
309
|
-
let head;
|
|
310
|
-
let tail = sub.depsTail;
|
|
311
|
-
let link = tail;
|
|
312
|
-
while (link) {
|
|
313
|
-
const prev = link.prevDep;
|
|
314
|
-
if (link.version === -1) {
|
|
315
|
-
if (link === tail) tail = prev;
|
|
316
|
-
removeSub(link);
|
|
317
|
-
removeDep(link);
|
|
318
|
-
} else {
|
|
319
|
-
head = link;
|
|
320
|
-
}
|
|
321
|
-
link.dep.activeLink = link.prevActiveLink;
|
|
322
|
-
link.prevActiveLink = void 0;
|
|
323
|
-
link = prev;
|
|
324
|
-
}
|
|
325
|
-
sub.deps = head;
|
|
326
|
-
sub.depsTail = tail;
|
|
327
|
-
}
|
|
328
|
-
function isDirty(sub) {
|
|
329
|
-
for (let link = sub.deps; link; link = link.nextDep) {
|
|
330
|
-
if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (sub._dirty) {
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
return false;
|
|
338
|
-
}
|
|
339
|
-
function refreshComputed(computed) {
|
|
340
|
-
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
computed.flags &= -17;
|
|
344
|
-
if (computed.globalVersion === globalVersion) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
computed.globalVersion = globalVersion;
|
|
348
|
-
if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
computed.flags |= 2;
|
|
352
|
-
const dep = computed.dep;
|
|
353
|
-
const prevSub = activeSub;
|
|
354
|
-
const prevShouldTrack = shouldTrack;
|
|
355
|
-
activeSub = computed;
|
|
356
|
-
shouldTrack = true;
|
|
357
|
-
try {
|
|
358
|
-
prepareDeps(computed);
|
|
359
|
-
const value = computed.fn(computed._value);
|
|
360
|
-
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
361
|
-
computed.flags |= 128;
|
|
362
|
-
computed._value = value;
|
|
363
|
-
dep.version++;
|
|
364
|
-
}
|
|
365
|
-
} catch (err) {
|
|
366
|
-
dep.version++;
|
|
367
|
-
throw err;
|
|
368
|
-
} finally {
|
|
369
|
-
activeSub = prevSub;
|
|
370
|
-
shouldTrack = prevShouldTrack;
|
|
371
|
-
cleanupDeps(computed);
|
|
372
|
-
computed.flags &= -3;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
function removeSub(link, soft = false) {
|
|
376
|
-
const { dep, prevSub, nextSub } = link;
|
|
377
|
-
if (prevSub) {
|
|
378
|
-
prevSub.nextSub = nextSub;
|
|
379
|
-
link.prevSub = void 0;
|
|
380
|
-
}
|
|
381
|
-
if (nextSub) {
|
|
382
|
-
nextSub.prevSub = prevSub;
|
|
383
|
-
link.nextSub = void 0;
|
|
384
|
-
}
|
|
385
|
-
if (!!(process.env.NODE_ENV !== "production") && dep.subsHead === link) {
|
|
386
|
-
dep.subsHead = nextSub;
|
|
387
|
-
}
|
|
388
|
-
if (dep.subs === link) {
|
|
389
|
-
dep.subs = prevSub;
|
|
390
|
-
if (!prevSub && dep.computed) {
|
|
391
|
-
dep.computed.flags &= -5;
|
|
392
|
-
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
393
|
-
removeSub(l, true);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
if (!soft && !--dep.sc && dep.map) {
|
|
398
|
-
dep.map.delete(dep.key);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function removeDep(link) {
|
|
402
|
-
const { prevDep, nextDep } = link;
|
|
403
|
-
if (prevDep) {
|
|
404
|
-
prevDep.nextDep = nextDep;
|
|
405
|
-
link.prevDep = void 0;
|
|
406
|
-
}
|
|
407
|
-
if (nextDep) {
|
|
408
|
-
nextDep.prevDep = prevDep;
|
|
409
|
-
link.nextDep = void 0;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
let shouldTrack = true;
|
|
413
|
-
const trackStack = [];
|
|
414
|
-
function pauseTracking() {
|
|
415
|
-
trackStack.push(shouldTrack);
|
|
416
|
-
shouldTrack = false;
|
|
417
|
-
}
|
|
418
|
-
function resetTracking() {
|
|
419
|
-
const last = trackStack.pop();
|
|
420
|
-
shouldTrack = last === void 0 ? true : last;
|
|
421
|
-
}
|
|
422
|
-
function cleanupEffect(e) {
|
|
423
|
-
const { cleanup } = e;
|
|
424
|
-
e.cleanup = void 0;
|
|
425
|
-
if (cleanup) {
|
|
426
|
-
const prevSub = activeSub;
|
|
427
|
-
activeSub = void 0;
|
|
428
|
-
try {
|
|
429
|
-
cleanup();
|
|
430
|
-
} finally {
|
|
431
|
-
activeSub = prevSub;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
let globalVersion = 0;
|
|
437
|
-
class Link {
|
|
438
|
-
constructor(sub, dep) {
|
|
439
|
-
this.sub = sub;
|
|
440
|
-
this.dep = dep;
|
|
441
|
-
this.version = dep.version;
|
|
442
|
-
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
class Dep {
|
|
446
|
-
// TODO isolatedDeclarations "__v_skip"
|
|
447
|
-
constructor(computed) {
|
|
448
|
-
this.computed = computed;
|
|
449
|
-
this.version = 0;
|
|
450
|
-
/**
|
|
451
|
-
* Link between this dep and the current active effect
|
|
452
|
-
*/
|
|
453
|
-
this.activeLink = void 0;
|
|
454
|
-
/**
|
|
455
|
-
* Doubly linked list representing the subscribing effects (tail)
|
|
456
|
-
*/
|
|
457
|
-
this.subs = void 0;
|
|
458
|
-
/**
|
|
459
|
-
* For object property deps cleanup
|
|
460
|
-
*/
|
|
461
|
-
this.map = void 0;
|
|
462
|
-
this.key = void 0;
|
|
463
|
-
/**
|
|
464
|
-
* Subscriber counter
|
|
465
|
-
*/
|
|
466
|
-
this.sc = 0;
|
|
467
|
-
/**
|
|
468
|
-
* @internal
|
|
469
|
-
*/
|
|
470
|
-
this.__v_skip = true;
|
|
471
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
472
|
-
this.subsHead = void 0;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
track(debugInfo) {
|
|
476
|
-
if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
let link = this.activeLink;
|
|
480
|
-
if (link === void 0 || link.sub !== activeSub) {
|
|
481
|
-
link = this.activeLink = new Link(activeSub, this);
|
|
482
|
-
if (!activeSub.deps) {
|
|
483
|
-
activeSub.deps = activeSub.depsTail = link;
|
|
484
|
-
} else {
|
|
485
|
-
link.prevDep = activeSub.depsTail;
|
|
486
|
-
activeSub.depsTail.nextDep = link;
|
|
487
|
-
activeSub.depsTail = link;
|
|
488
|
-
}
|
|
489
|
-
addSub(link);
|
|
490
|
-
} else if (link.version === -1) {
|
|
491
|
-
link.version = this.version;
|
|
492
|
-
if (link.nextDep) {
|
|
493
|
-
const next = link.nextDep;
|
|
494
|
-
next.prevDep = link.prevDep;
|
|
495
|
-
if (link.prevDep) {
|
|
496
|
-
link.prevDep.nextDep = next;
|
|
497
|
-
}
|
|
498
|
-
link.prevDep = activeSub.depsTail;
|
|
499
|
-
link.nextDep = void 0;
|
|
500
|
-
activeSub.depsTail.nextDep = link;
|
|
501
|
-
activeSub.depsTail = link;
|
|
502
|
-
if (activeSub.deps === link) {
|
|
503
|
-
activeSub.deps = next;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
if (!!(process.env.NODE_ENV !== "production") && activeSub.onTrack) {
|
|
508
|
-
activeSub.onTrack(
|
|
509
|
-
extend(
|
|
510
|
-
{
|
|
511
|
-
effect: activeSub
|
|
512
|
-
},
|
|
513
|
-
debugInfo
|
|
514
|
-
)
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
return link;
|
|
518
|
-
}
|
|
519
|
-
trigger(debugInfo) {
|
|
520
|
-
this.version++;
|
|
521
|
-
globalVersion++;
|
|
522
|
-
this.notify(debugInfo);
|
|
523
|
-
}
|
|
524
|
-
notify(debugInfo) {
|
|
525
|
-
startBatch();
|
|
526
|
-
try {
|
|
527
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
528
|
-
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
529
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
530
|
-
head.sub.onTrigger(
|
|
531
|
-
extend(
|
|
532
|
-
{
|
|
533
|
-
effect: head.sub
|
|
534
|
-
},
|
|
535
|
-
debugInfo
|
|
536
|
-
)
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
for (let link = this.subs; link; link = link.prevSub) {
|
|
542
|
-
if (link.sub.notify()) {
|
|
543
|
-
;
|
|
544
|
-
link.sub.dep.notify();
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
} finally {
|
|
548
|
-
endBatch();
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function addSub(link) {
|
|
553
|
-
link.dep.sc++;
|
|
554
|
-
if (link.sub.flags & 4) {
|
|
555
|
-
const computed = link.dep.computed;
|
|
556
|
-
if (computed && !link.dep.subs) {
|
|
557
|
-
computed.flags |= 4 | 16;
|
|
558
|
-
for (let l = computed.deps; l; l = l.nextDep) {
|
|
559
|
-
addSub(l);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
const currentTail = link.dep.subs;
|
|
563
|
-
if (currentTail !== link) {
|
|
564
|
-
link.prevSub = currentTail;
|
|
565
|
-
if (currentTail) currentTail.nextSub = link;
|
|
566
|
-
}
|
|
567
|
-
if (!!(process.env.NODE_ENV !== "production") && link.dep.subsHead === void 0) {
|
|
568
|
-
link.dep.subsHead = link;
|
|
569
|
-
}
|
|
570
|
-
link.dep.subs = link;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
574
|
-
const ITERATE_KEY = Symbol(
|
|
575
|
-
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
|
|
576
|
-
);
|
|
577
|
-
const MAP_KEY_ITERATE_KEY = Symbol(
|
|
578
|
-
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
|
|
579
|
-
);
|
|
580
|
-
const ARRAY_ITERATE_KEY = Symbol(
|
|
581
|
-
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
|
|
582
|
-
);
|
|
583
|
-
function track(target, type, key) {
|
|
584
|
-
if (shouldTrack && activeSub) {
|
|
585
|
-
let depsMap = targetMap.get(target);
|
|
586
|
-
if (!depsMap) {
|
|
587
|
-
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
588
|
-
}
|
|
589
|
-
let dep = depsMap.get(key);
|
|
590
|
-
if (!dep) {
|
|
591
|
-
depsMap.set(key, dep = new Dep());
|
|
592
|
-
dep.map = depsMap;
|
|
593
|
-
dep.key = key;
|
|
594
|
-
}
|
|
595
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
596
|
-
dep.track({
|
|
597
|
-
target,
|
|
598
|
-
type,
|
|
599
|
-
key
|
|
600
|
-
});
|
|
601
|
-
} else {
|
|
602
|
-
dep.track();
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
607
|
-
const depsMap = targetMap.get(target);
|
|
608
|
-
if (!depsMap) {
|
|
609
|
-
globalVersion++;
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
const run = (dep) => {
|
|
613
|
-
if (dep) {
|
|
614
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
615
|
-
dep.trigger({
|
|
616
|
-
target,
|
|
617
|
-
type,
|
|
618
|
-
key,
|
|
619
|
-
newValue,
|
|
620
|
-
oldValue,
|
|
621
|
-
oldTarget
|
|
622
|
-
});
|
|
623
|
-
} else {
|
|
624
|
-
dep.trigger();
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
startBatch();
|
|
629
|
-
if (type === "clear") {
|
|
630
|
-
depsMap.forEach(run);
|
|
631
|
-
} else {
|
|
632
|
-
const targetIsArray = isArray(target);
|
|
633
|
-
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
634
|
-
if (targetIsArray && key === "length") {
|
|
635
|
-
const newLength = Number(newValue);
|
|
636
|
-
depsMap.forEach((dep, key2) => {
|
|
637
|
-
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
638
|
-
run(dep);
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
} else {
|
|
642
|
-
if (key !== void 0 || depsMap.has(void 0)) {
|
|
643
|
-
run(depsMap.get(key));
|
|
644
|
-
}
|
|
645
|
-
if (isArrayIndex) {
|
|
646
|
-
run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
647
|
-
}
|
|
648
|
-
switch (type) {
|
|
649
|
-
case "add":
|
|
650
|
-
if (!targetIsArray) {
|
|
651
|
-
run(depsMap.get(ITERATE_KEY));
|
|
652
|
-
if (isMap(target)) {
|
|
653
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
654
|
-
}
|
|
655
|
-
} else if (isArrayIndex) {
|
|
656
|
-
run(depsMap.get("length"));
|
|
657
|
-
}
|
|
658
|
-
break;
|
|
659
|
-
case "delete":
|
|
660
|
-
if (!targetIsArray) {
|
|
661
|
-
run(depsMap.get(ITERATE_KEY));
|
|
662
|
-
if (isMap(target)) {
|
|
663
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
break;
|
|
667
|
-
case "set":
|
|
668
|
-
if (isMap(target)) {
|
|
669
|
-
run(depsMap.get(ITERATE_KEY));
|
|
670
|
-
}
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
endBatch();
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
function reactiveReadArray(array) {
|
|
679
|
-
const raw = toRaw(array);
|
|
680
|
-
if (raw === array) return raw;
|
|
681
|
-
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
682
|
-
return isShallow(array) ? raw : raw.map(toReactive);
|
|
683
|
-
}
|
|
684
|
-
function shallowReadArray(arr) {
|
|
685
|
-
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
686
|
-
return arr;
|
|
687
|
-
}
|
|
688
|
-
const arrayInstrumentations = {
|
|
689
|
-
__proto__: null,
|
|
690
|
-
[Symbol.iterator]() {
|
|
691
|
-
return iterator(this, Symbol.iterator, toReactive);
|
|
692
|
-
},
|
|
693
|
-
concat(...args) {
|
|
694
|
-
return reactiveReadArray(this).concat(
|
|
695
|
-
...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
|
|
696
|
-
);
|
|
697
|
-
},
|
|
698
|
-
entries() {
|
|
699
|
-
return iterator(this, "entries", (value) => {
|
|
700
|
-
value[1] = toReactive(value[1]);
|
|
701
|
-
return value;
|
|
702
|
-
});
|
|
703
|
-
},
|
|
704
|
-
every(fn, thisArg) {
|
|
705
|
-
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
706
|
-
},
|
|
707
|
-
filter(fn, thisArg) {
|
|
708
|
-
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
709
|
-
},
|
|
710
|
-
find(fn, thisArg) {
|
|
711
|
-
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
712
|
-
},
|
|
713
|
-
findIndex(fn, thisArg) {
|
|
714
|
-
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
715
|
-
},
|
|
716
|
-
findLast(fn, thisArg) {
|
|
717
|
-
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
718
|
-
},
|
|
719
|
-
findLastIndex(fn, thisArg) {
|
|
720
|
-
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
721
|
-
},
|
|
722
|
-
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
723
|
-
forEach(fn, thisArg) {
|
|
724
|
-
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
725
|
-
},
|
|
726
|
-
includes(...args) {
|
|
727
|
-
return searchProxy(this, "includes", args);
|
|
728
|
-
},
|
|
729
|
-
indexOf(...args) {
|
|
730
|
-
return searchProxy(this, "indexOf", args);
|
|
731
|
-
},
|
|
732
|
-
join(separator) {
|
|
733
|
-
return reactiveReadArray(this).join(separator);
|
|
734
|
-
},
|
|
735
|
-
// keys() iterator only reads `length`, no optimization required
|
|
736
|
-
lastIndexOf(...args) {
|
|
737
|
-
return searchProxy(this, "lastIndexOf", args);
|
|
738
|
-
},
|
|
739
|
-
map(fn, thisArg) {
|
|
740
|
-
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
741
|
-
},
|
|
742
|
-
pop() {
|
|
743
|
-
return noTracking(this, "pop");
|
|
744
|
-
},
|
|
745
|
-
push(...args) {
|
|
746
|
-
return noTracking(this, "push", args);
|
|
747
|
-
},
|
|
748
|
-
reduce(fn, ...args) {
|
|
749
|
-
return reduce(this, "reduce", fn, args);
|
|
750
|
-
},
|
|
751
|
-
reduceRight(fn, ...args) {
|
|
752
|
-
return reduce(this, "reduceRight", fn, args);
|
|
753
|
-
},
|
|
754
|
-
shift() {
|
|
755
|
-
return noTracking(this, "shift");
|
|
756
|
-
},
|
|
757
|
-
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
758
|
-
some(fn, thisArg) {
|
|
759
|
-
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
760
|
-
},
|
|
761
|
-
splice(...args) {
|
|
762
|
-
return noTracking(this, "splice", args);
|
|
763
|
-
},
|
|
764
|
-
toReversed() {
|
|
765
|
-
return reactiveReadArray(this).toReversed();
|
|
766
|
-
},
|
|
767
|
-
toSorted(comparer) {
|
|
768
|
-
return reactiveReadArray(this).toSorted(comparer);
|
|
769
|
-
},
|
|
770
|
-
toSpliced(...args) {
|
|
771
|
-
return reactiveReadArray(this).toSpliced(...args);
|
|
772
|
-
},
|
|
773
|
-
unshift(...args) {
|
|
774
|
-
return noTracking(this, "unshift", args);
|
|
775
|
-
},
|
|
776
|
-
values() {
|
|
777
|
-
return iterator(this, "values", toReactive);
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
function iterator(self, method, wrapValue) {
|
|
781
|
-
const arr = shallowReadArray(self);
|
|
782
|
-
const iter = arr[method]();
|
|
783
|
-
if (arr !== self && !isShallow(self)) {
|
|
784
|
-
iter._next = iter.next;
|
|
785
|
-
iter.next = () => {
|
|
786
|
-
const result = iter._next();
|
|
787
|
-
if (!result.done) {
|
|
788
|
-
result.value = wrapValue(result.value);
|
|
789
|
-
}
|
|
790
|
-
return result;
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
return iter;
|
|
794
|
-
}
|
|
795
|
-
const arrayProto = Array.prototype;
|
|
796
|
-
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
797
|
-
const arr = shallowReadArray(self);
|
|
798
|
-
const needsWrap = arr !== self && !isShallow(self);
|
|
799
|
-
const methodFn = arr[method];
|
|
800
|
-
if (methodFn !== arrayProto[method]) {
|
|
801
|
-
const result2 = methodFn.apply(self, args);
|
|
802
|
-
return needsWrap ? toReactive(result2) : result2;
|
|
803
|
-
}
|
|
804
|
-
let wrappedFn = fn;
|
|
805
|
-
if (arr !== self) {
|
|
806
|
-
if (needsWrap) {
|
|
807
|
-
wrappedFn = function(item, index) {
|
|
808
|
-
return fn.call(this, toReactive(item), index, self);
|
|
809
|
-
};
|
|
810
|
-
} else if (fn.length > 2) {
|
|
811
|
-
wrappedFn = function(item, index) {
|
|
812
|
-
return fn.call(this, item, index, self);
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
817
|
-
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
818
|
-
}
|
|
819
|
-
function reduce(self, method, fn, args) {
|
|
820
|
-
const arr = shallowReadArray(self);
|
|
821
|
-
let wrappedFn = fn;
|
|
822
|
-
if (arr !== self) {
|
|
823
|
-
if (!isShallow(self)) {
|
|
824
|
-
wrappedFn = function(acc, item, index) {
|
|
825
|
-
return fn.call(this, acc, toReactive(item), index, self);
|
|
826
|
-
};
|
|
827
|
-
} else if (fn.length > 3) {
|
|
828
|
-
wrappedFn = function(acc, item, index) {
|
|
829
|
-
return fn.call(this, acc, item, index, self);
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
return arr[method](wrappedFn, ...args);
|
|
834
|
-
}
|
|
835
|
-
function searchProxy(self, method, args) {
|
|
836
|
-
const arr = toRaw(self);
|
|
837
|
-
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
838
|
-
const res = arr[method](...args);
|
|
839
|
-
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
840
|
-
args[0] = toRaw(args[0]);
|
|
841
|
-
return arr[method](...args);
|
|
842
|
-
}
|
|
843
|
-
return res;
|
|
844
|
-
}
|
|
845
|
-
function noTracking(self, method, args = []) {
|
|
846
|
-
pauseTracking();
|
|
847
|
-
startBatch();
|
|
848
|
-
const res = toRaw(self)[method].apply(self, args);
|
|
849
|
-
endBatch();
|
|
850
|
-
resetTracking();
|
|
851
|
-
return res;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
855
|
-
const builtInSymbols = new Set(
|
|
856
|
-
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
857
|
-
);
|
|
858
|
-
function hasOwnProperty(key) {
|
|
859
|
-
if (!isSymbol(key)) key = String(key);
|
|
860
|
-
const obj = toRaw(this);
|
|
861
|
-
track(obj, "has", key);
|
|
862
|
-
return obj.hasOwnProperty(key);
|
|
863
|
-
}
|
|
864
|
-
class BaseReactiveHandler {
|
|
865
|
-
constructor(_isReadonly = false, _isShallow = false) {
|
|
866
|
-
this._isReadonly = _isReadonly;
|
|
867
|
-
this._isShallow = _isShallow;
|
|
868
|
-
}
|
|
869
|
-
get(target, key, receiver) {
|
|
870
|
-
if (key === "__v_skip") return target["__v_skip"];
|
|
871
|
-
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
872
|
-
if (key === "__v_isReactive") {
|
|
873
|
-
return !isReadonly2;
|
|
874
|
-
} else if (key === "__v_isReadonly") {
|
|
875
|
-
return isReadonly2;
|
|
876
|
-
} else if (key === "__v_isShallow") {
|
|
877
|
-
return isShallow2;
|
|
878
|
-
} else if (key === "__v_raw") {
|
|
879
|
-
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
880
|
-
// this means the receiver is a user proxy of the reactive proxy
|
|
881
|
-
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
882
|
-
return target;
|
|
883
|
-
}
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
const targetIsArray = isArray(target);
|
|
887
|
-
if (!isReadonly2) {
|
|
888
|
-
let fn;
|
|
889
|
-
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
890
|
-
return fn;
|
|
891
|
-
}
|
|
892
|
-
if (key === "hasOwnProperty") {
|
|
893
|
-
return hasOwnProperty;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
const res = Reflect.get(
|
|
897
|
-
target,
|
|
898
|
-
key,
|
|
899
|
-
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
900
|
-
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
901
|
-
// its class methods
|
|
902
|
-
isRef(target) ? target : receiver
|
|
903
|
-
);
|
|
904
|
-
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
905
|
-
return res;
|
|
906
|
-
}
|
|
907
|
-
if (!isReadonly2) {
|
|
908
|
-
track(target, "get", key);
|
|
909
|
-
}
|
|
910
|
-
if (isShallow2) {
|
|
911
|
-
return res;
|
|
912
|
-
}
|
|
913
|
-
if (isRef(res)) {
|
|
914
|
-
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
915
|
-
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
916
|
-
}
|
|
917
|
-
if (isObject(res)) {
|
|
918
|
-
return isReadonly2 ? readonly(res) : reactive(res);
|
|
919
|
-
}
|
|
920
|
-
return res;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
924
|
-
constructor(isShallow2 = false) {
|
|
925
|
-
super(false, isShallow2);
|
|
926
|
-
}
|
|
927
|
-
set(target, key, value, receiver) {
|
|
928
|
-
let oldValue = target[key];
|
|
929
|
-
if (!this._isShallow) {
|
|
930
|
-
const isOldValueReadonly = isReadonly(oldValue);
|
|
931
|
-
if (!isShallow(value) && !isReadonly(value)) {
|
|
932
|
-
oldValue = toRaw(oldValue);
|
|
933
|
-
value = toRaw(value);
|
|
934
|
-
}
|
|
935
|
-
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
936
|
-
if (isOldValueReadonly) {
|
|
937
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
938
|
-
warn(
|
|
939
|
-
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
940
|
-
target[key]
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
return true;
|
|
944
|
-
} else {
|
|
945
|
-
oldValue.value = value;
|
|
946
|
-
return true;
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
951
|
-
const result = Reflect.set(
|
|
952
|
-
target,
|
|
953
|
-
key,
|
|
954
|
-
value,
|
|
955
|
-
isRef(target) ? target : receiver
|
|
956
|
-
);
|
|
957
|
-
if (target === toRaw(receiver)) {
|
|
958
|
-
if (!hadKey) {
|
|
959
|
-
trigger(target, "add", key, value);
|
|
960
|
-
} else if (hasChanged(value, oldValue)) {
|
|
961
|
-
trigger(target, "set", key, value, oldValue);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
return result;
|
|
965
|
-
}
|
|
966
|
-
deleteProperty(target, key) {
|
|
967
|
-
const hadKey = hasOwn(target, key);
|
|
968
|
-
const oldValue = target[key];
|
|
969
|
-
const result = Reflect.deleteProperty(target, key);
|
|
970
|
-
if (result && hadKey) {
|
|
971
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
972
|
-
}
|
|
973
|
-
return result;
|
|
974
|
-
}
|
|
975
|
-
has(target, key) {
|
|
976
|
-
const result = Reflect.has(target, key);
|
|
977
|
-
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
978
|
-
track(target, "has", key);
|
|
979
|
-
}
|
|
980
|
-
return result;
|
|
981
|
-
}
|
|
982
|
-
ownKeys(target) {
|
|
983
|
-
track(
|
|
984
|
-
target,
|
|
985
|
-
"iterate",
|
|
986
|
-
isArray(target) ? "length" : ITERATE_KEY
|
|
987
|
-
);
|
|
988
|
-
return Reflect.ownKeys(target);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
992
|
-
constructor(isShallow2 = false) {
|
|
993
|
-
super(true, isShallow2);
|
|
994
|
-
}
|
|
995
|
-
set(target, key) {
|
|
996
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
997
|
-
warn(
|
|
998
|
-
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
999
|
-
target
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
return true;
|
|
1003
|
-
}
|
|
1004
|
-
deleteProperty(target, key) {
|
|
1005
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1006
|
-
warn(
|
|
1007
|
-
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
1008
|
-
target
|
|
1009
|
-
);
|
|
1010
|
-
}
|
|
1011
|
-
return true;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
1015
|
-
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
1016
|
-
|
|
1017
|
-
const toShallow = (value) => value;
|
|
1018
|
-
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
1019
|
-
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
1020
|
-
return function(...args) {
|
|
1021
|
-
const target = this["__v_raw"];
|
|
1022
|
-
const rawTarget = toRaw(target);
|
|
1023
|
-
const targetIsMap = isMap(rawTarget);
|
|
1024
|
-
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
1025
|
-
const isKeyOnly = method === "keys" && targetIsMap;
|
|
1026
|
-
const innerIterator = target[method](...args);
|
|
1027
|
-
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
1028
|
-
!isReadonly2 && track(
|
|
1029
|
-
rawTarget,
|
|
1030
|
-
"iterate",
|
|
1031
|
-
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
|
1032
|
-
);
|
|
1033
|
-
return {
|
|
1034
|
-
// iterator protocol
|
|
1035
|
-
next() {
|
|
1036
|
-
const { value, done } = innerIterator.next();
|
|
1037
|
-
return done ? { value, done } : {
|
|
1038
|
-
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
1039
|
-
done
|
|
1040
|
-
};
|
|
1041
|
-
},
|
|
1042
|
-
// iterable protocol
|
|
1043
|
-
[Symbol.iterator]() {
|
|
1044
|
-
return this;
|
|
1045
|
-
}
|
|
1046
|
-
};
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
function createReadonlyMethod(type) {
|
|
1050
|
-
return function(...args) {
|
|
1051
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1052
|
-
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1053
|
-
warn(
|
|
1054
|
-
`${capitalize(type)} operation ${key}failed: target is readonly.`,
|
|
1055
|
-
toRaw(this)
|
|
1056
|
-
);
|
|
1057
|
-
}
|
|
1058
|
-
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
function createInstrumentations(readonly, shallow) {
|
|
1062
|
-
const instrumentations = {
|
|
1063
|
-
get(key) {
|
|
1064
|
-
const target = this["__v_raw"];
|
|
1065
|
-
const rawTarget = toRaw(target);
|
|
1066
|
-
const rawKey = toRaw(key);
|
|
1067
|
-
if (!readonly) {
|
|
1068
|
-
if (hasChanged(key, rawKey)) {
|
|
1069
|
-
track(rawTarget, "get", key);
|
|
1070
|
-
}
|
|
1071
|
-
track(rawTarget, "get", rawKey);
|
|
1072
|
-
}
|
|
1073
|
-
const { has } = getProto(rawTarget);
|
|
1074
|
-
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
1075
|
-
if (has.call(rawTarget, key)) {
|
|
1076
|
-
return wrap(target.get(key));
|
|
1077
|
-
} else if (has.call(rawTarget, rawKey)) {
|
|
1078
|
-
return wrap(target.get(rawKey));
|
|
1079
|
-
} else if (target !== rawTarget) {
|
|
1080
|
-
target.get(key);
|
|
1081
|
-
}
|
|
1082
|
-
},
|
|
1083
|
-
get size() {
|
|
1084
|
-
const target = this["__v_raw"];
|
|
1085
|
-
!readonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
|
1086
|
-
return target.size;
|
|
1087
|
-
},
|
|
1088
|
-
has(key) {
|
|
1089
|
-
const target = this["__v_raw"];
|
|
1090
|
-
const rawTarget = toRaw(target);
|
|
1091
|
-
const rawKey = toRaw(key);
|
|
1092
|
-
if (!readonly) {
|
|
1093
|
-
if (hasChanged(key, rawKey)) {
|
|
1094
|
-
track(rawTarget, "has", key);
|
|
1095
|
-
}
|
|
1096
|
-
track(rawTarget, "has", rawKey);
|
|
1097
|
-
}
|
|
1098
|
-
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
1099
|
-
},
|
|
1100
|
-
forEach(callback, thisArg) {
|
|
1101
|
-
const observed = this;
|
|
1102
|
-
const target = observed["__v_raw"];
|
|
1103
|
-
const rawTarget = toRaw(target);
|
|
1104
|
-
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
1105
|
-
!readonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
1106
|
-
return target.forEach((value, key) => {
|
|
1107
|
-
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
|
-
extend(
|
|
1112
|
-
instrumentations,
|
|
1113
|
-
readonly ? {
|
|
1114
|
-
add: createReadonlyMethod("add"),
|
|
1115
|
-
set: createReadonlyMethod("set"),
|
|
1116
|
-
delete: createReadonlyMethod("delete"),
|
|
1117
|
-
clear: createReadonlyMethod("clear")
|
|
1118
|
-
} : {
|
|
1119
|
-
add(value) {
|
|
1120
|
-
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1121
|
-
value = toRaw(value);
|
|
1122
|
-
}
|
|
1123
|
-
const target = toRaw(this);
|
|
1124
|
-
const proto = getProto(target);
|
|
1125
|
-
const hadKey = proto.has.call(target, value);
|
|
1126
|
-
if (!hadKey) {
|
|
1127
|
-
target.add(value);
|
|
1128
|
-
trigger(target, "add", value, value);
|
|
1129
|
-
}
|
|
1130
|
-
return this;
|
|
1131
|
-
},
|
|
1132
|
-
set(key, value) {
|
|
1133
|
-
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1134
|
-
value = toRaw(value);
|
|
1135
|
-
}
|
|
1136
|
-
const target = toRaw(this);
|
|
1137
|
-
const { has, get } = getProto(target);
|
|
1138
|
-
let hadKey = has.call(target, key);
|
|
1139
|
-
if (!hadKey) {
|
|
1140
|
-
key = toRaw(key);
|
|
1141
|
-
hadKey = has.call(target, key);
|
|
1142
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1143
|
-
checkIdentityKeys(target, has, key);
|
|
1144
|
-
}
|
|
1145
|
-
const oldValue = get.call(target, key);
|
|
1146
|
-
target.set(key, value);
|
|
1147
|
-
if (!hadKey) {
|
|
1148
|
-
trigger(target, "add", key, value);
|
|
1149
|
-
} else if (hasChanged(value, oldValue)) {
|
|
1150
|
-
trigger(target, "set", key, value, oldValue);
|
|
1151
|
-
}
|
|
1152
|
-
return this;
|
|
1153
|
-
},
|
|
1154
|
-
delete(key) {
|
|
1155
|
-
const target = toRaw(this);
|
|
1156
|
-
const { has, get } = getProto(target);
|
|
1157
|
-
let hadKey = has.call(target, key);
|
|
1158
|
-
if (!hadKey) {
|
|
1159
|
-
key = toRaw(key);
|
|
1160
|
-
hadKey = has.call(target, key);
|
|
1161
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1162
|
-
checkIdentityKeys(target, has, key);
|
|
1163
|
-
}
|
|
1164
|
-
const oldValue = get ? get.call(target, key) : void 0;
|
|
1165
|
-
const result = target.delete(key);
|
|
1166
|
-
if (hadKey) {
|
|
1167
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
1168
|
-
}
|
|
1169
|
-
return result;
|
|
1170
|
-
},
|
|
1171
|
-
clear() {
|
|
1172
|
-
const target = toRaw(this);
|
|
1173
|
-
const hadItems = target.size !== 0;
|
|
1174
|
-
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
1175
|
-
const result = target.clear();
|
|
1176
|
-
if (hadItems) {
|
|
1177
|
-
trigger(
|
|
1178
|
-
target,
|
|
1179
|
-
"clear",
|
|
1180
|
-
void 0,
|
|
1181
|
-
void 0,
|
|
1182
|
-
oldTarget
|
|
1183
|
-
);
|
|
1184
|
-
}
|
|
1185
|
-
return result;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
);
|
|
1189
|
-
const iteratorMethods = [
|
|
1190
|
-
"keys",
|
|
1191
|
-
"values",
|
|
1192
|
-
"entries",
|
|
1193
|
-
Symbol.iterator
|
|
1194
|
-
];
|
|
1195
|
-
iteratorMethods.forEach((method) => {
|
|
1196
|
-
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
1197
|
-
});
|
|
1198
|
-
return instrumentations;
|
|
1199
|
-
}
|
|
1200
|
-
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1201
|
-
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1202
|
-
return (target, key, receiver) => {
|
|
1203
|
-
if (key === "__v_isReactive") {
|
|
1204
|
-
return !isReadonly2;
|
|
1205
|
-
} else if (key === "__v_isReadonly") {
|
|
1206
|
-
return isReadonly2;
|
|
1207
|
-
} else if (key === "__v_raw") {
|
|
1208
|
-
return target;
|
|
1209
|
-
}
|
|
1210
|
-
return Reflect.get(
|
|
1211
|
-
hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
1212
|
-
key,
|
|
1213
|
-
receiver
|
|
1214
|
-
);
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
const mutableCollectionHandlers = {
|
|
1218
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1219
|
-
};
|
|
1220
|
-
const readonlyCollectionHandlers = {
|
|
1221
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1222
|
-
};
|
|
1223
|
-
function checkIdentityKeys(target, has, key) {
|
|
1224
|
-
const rawKey = toRaw(key);
|
|
1225
|
-
if (rawKey !== key && has.call(target, rawKey)) {
|
|
1226
|
-
const type = toRawType(target);
|
|
1227
|
-
warn(
|
|
1228
|
-
`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.`
|
|
1229
|
-
);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1234
|
-
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1235
|
-
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1236
|
-
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1237
|
-
function targetTypeMap(rawType) {
|
|
1238
|
-
switch (rawType) {
|
|
1239
|
-
case "Object":
|
|
1240
|
-
case "Array":
|
|
1241
|
-
return 1 /* COMMON */;
|
|
1242
|
-
case "Map":
|
|
1243
|
-
case "Set":
|
|
1244
|
-
case "WeakMap":
|
|
1245
|
-
case "WeakSet":
|
|
1246
|
-
return 2 /* COLLECTION */;
|
|
1247
|
-
default:
|
|
1248
|
-
return 0 /* INVALID */;
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
function getTargetType(value) {
|
|
1252
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
|
|
1253
|
-
}
|
|
1254
|
-
function reactive(target) {
|
|
1255
|
-
if (isReadonly(target)) {
|
|
1256
|
-
return target;
|
|
1257
|
-
}
|
|
1258
|
-
return createReactiveObject(
|
|
1259
|
-
target,
|
|
1260
|
-
false,
|
|
1261
|
-
mutableHandlers,
|
|
1262
|
-
mutableCollectionHandlers,
|
|
1263
|
-
reactiveMap
|
|
1264
|
-
);
|
|
1265
|
-
}
|
|
1266
|
-
function readonly(target) {
|
|
1267
|
-
return createReactiveObject(
|
|
1268
|
-
target,
|
|
1269
|
-
true,
|
|
1270
|
-
readonlyHandlers,
|
|
1271
|
-
readonlyCollectionHandlers,
|
|
1272
|
-
readonlyMap
|
|
1273
|
-
);
|
|
1274
|
-
}
|
|
1275
|
-
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1276
|
-
if (!isObject(target)) {
|
|
1277
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1278
|
-
warn(
|
|
1279
|
-
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
|
|
1280
|
-
target
|
|
1281
|
-
)}`
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
|
-
return target;
|
|
1285
|
-
}
|
|
1286
|
-
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1287
|
-
return target;
|
|
1288
|
-
}
|
|
1289
|
-
const targetType = getTargetType(target);
|
|
1290
|
-
if (targetType === 0 /* INVALID */) {
|
|
1291
|
-
return target;
|
|
1292
|
-
}
|
|
1293
|
-
const existingProxy = proxyMap.get(target);
|
|
1294
|
-
if (existingProxy) {
|
|
1295
|
-
return existingProxy;
|
|
1296
|
-
}
|
|
1297
|
-
const proxy = new Proxy(
|
|
1298
|
-
target,
|
|
1299
|
-
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
1300
|
-
);
|
|
1301
|
-
proxyMap.set(target, proxy);
|
|
1302
|
-
return proxy;
|
|
1303
|
-
}
|
|
1304
|
-
function isReactive(value) {
|
|
1305
|
-
if (isReadonly(value)) {
|
|
1306
|
-
return isReactive(value["__v_raw"]);
|
|
1307
|
-
}
|
|
1308
|
-
return !!(value && value["__v_isReactive"]);
|
|
1309
|
-
}
|
|
1310
|
-
function isReadonly(value) {
|
|
1311
|
-
return !!(value && value["__v_isReadonly"]);
|
|
1312
|
-
}
|
|
1313
|
-
function isShallow(value) {
|
|
1314
|
-
return !!(value && value["__v_isShallow"]);
|
|
1315
|
-
}
|
|
1316
|
-
function isProxy(value) {
|
|
1317
|
-
return value ? !!value["__v_raw"] : false;
|
|
1318
|
-
}
|
|
1319
|
-
function toRaw(observed) {
|
|
1320
|
-
const raw = observed && observed["__v_raw"];
|
|
1321
|
-
return raw ? toRaw(raw) : observed;
|
|
1322
|
-
}
|
|
1323
|
-
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1324
|
-
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1325
|
-
|
|
1326
|
-
function isRef(r) {
|
|
1327
|
-
return r ? r["__v_isRef"] === true : false;
|
|
1328
|
-
}
|
|
1329
|
-
function ref(value) {
|
|
1330
|
-
return createRef(value, false);
|
|
1331
|
-
}
|
|
1332
|
-
function createRef(rawValue, shallow) {
|
|
1333
|
-
if (isRef(rawValue)) {
|
|
1334
|
-
return rawValue;
|
|
1335
|
-
}
|
|
1336
|
-
return new RefImpl(rawValue, shallow);
|
|
1337
|
-
}
|
|
1338
|
-
class RefImpl {
|
|
1339
|
-
constructor(value, isShallow2) {
|
|
1340
|
-
this.dep = new Dep();
|
|
1341
|
-
this["__v_isRef"] = true;
|
|
1342
|
-
this["__v_isShallow"] = false;
|
|
1343
|
-
this._rawValue = isShallow2 ? value : toRaw(value);
|
|
1344
|
-
this._value = isShallow2 ? value : toReactive(value);
|
|
1345
|
-
this["__v_isShallow"] = isShallow2;
|
|
1346
|
-
}
|
|
1347
|
-
get value() {
|
|
1348
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1349
|
-
this.dep.track({
|
|
1350
|
-
target: this,
|
|
1351
|
-
type: "get",
|
|
1352
|
-
key: "value"
|
|
1353
|
-
});
|
|
1354
|
-
} else {
|
|
1355
|
-
this.dep.track();
|
|
1356
|
-
}
|
|
1357
|
-
return this._value;
|
|
1358
|
-
}
|
|
1359
|
-
set value(newValue) {
|
|
1360
|
-
const oldValue = this._rawValue;
|
|
1361
|
-
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1362
|
-
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1363
|
-
if (hasChanged(newValue, oldValue)) {
|
|
1364
|
-
this._rawValue = newValue;
|
|
1365
|
-
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1366
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1367
|
-
this.dep.trigger({
|
|
1368
|
-
target: this,
|
|
1369
|
-
type: "set",
|
|
1370
|
-
key: "value",
|
|
1371
|
-
newValue,
|
|
1372
|
-
oldValue
|
|
1373
|
-
});
|
|
1374
|
-
} else {
|
|
1375
|
-
this.dep.trigger();
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
class ComputedRefImpl {
|
|
1382
|
-
constructor(fn, setter, isSSR) {
|
|
1383
|
-
this.fn = fn;
|
|
1384
|
-
this.setter = setter;
|
|
1385
|
-
/**
|
|
1386
|
-
* @internal
|
|
1387
|
-
*/
|
|
1388
|
-
this._value = void 0;
|
|
1389
|
-
/**
|
|
1390
|
-
* @internal
|
|
1391
|
-
*/
|
|
1392
|
-
this.dep = new Dep(this);
|
|
1393
|
-
/**
|
|
1394
|
-
* @internal
|
|
1395
|
-
*/
|
|
1396
|
-
this.__v_isRef = true;
|
|
1397
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1398
|
-
// A computed is also a subscriber that tracks other deps
|
|
1399
|
-
/**
|
|
1400
|
-
* @internal
|
|
1401
|
-
*/
|
|
1402
|
-
this.deps = void 0;
|
|
1403
|
-
/**
|
|
1404
|
-
* @internal
|
|
1405
|
-
*/
|
|
1406
|
-
this.depsTail = void 0;
|
|
1407
|
-
/**
|
|
1408
|
-
* @internal
|
|
1409
|
-
*/
|
|
1410
|
-
this.flags = 16;
|
|
1411
|
-
/**
|
|
1412
|
-
* @internal
|
|
1413
|
-
*/
|
|
1414
|
-
this.globalVersion = globalVersion - 1;
|
|
1415
|
-
/**
|
|
1416
|
-
* @internal
|
|
1417
|
-
*/
|
|
1418
|
-
this.next = void 0;
|
|
1419
|
-
// for backwards compat
|
|
1420
|
-
this.effect = this;
|
|
1421
|
-
this["__v_isReadonly"] = !setter;
|
|
1422
|
-
this.isSSR = isSSR;
|
|
1423
|
-
}
|
|
1424
|
-
/**
|
|
1425
|
-
* @internal
|
|
1426
|
-
*/
|
|
1427
|
-
notify() {
|
|
1428
|
-
this.flags |= 16;
|
|
1429
|
-
if (!(this.flags & 8) && // avoid infinite self recursion
|
|
1430
|
-
activeSub !== this) {
|
|
1431
|
-
batch(this, true);
|
|
1432
|
-
return true;
|
|
1433
|
-
} else if (!!(process.env.NODE_ENV !== "production")) ;
|
|
1434
|
-
}
|
|
1435
|
-
get value() {
|
|
1436
|
-
const link = !!(process.env.NODE_ENV !== "production") ? this.dep.track({
|
|
1437
|
-
target: this,
|
|
1438
|
-
type: "get",
|
|
1439
|
-
key: "value"
|
|
1440
|
-
}) : this.dep.track();
|
|
1441
|
-
refreshComputed(this);
|
|
1442
|
-
if (link) {
|
|
1443
|
-
link.version = this.dep.version;
|
|
1444
|
-
}
|
|
1445
|
-
return this._value;
|
|
1446
|
-
}
|
|
1447
|
-
set value(newValue) {
|
|
1448
|
-
if (this.setter) {
|
|
1449
|
-
this.setter(newValue);
|
|
1450
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1451
|
-
warn("Write operation failed: computed value is readonly");
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1456
|
-
let getter;
|
|
1457
|
-
let setter;
|
|
1458
|
-
if (isFunction(getterOrOptions)) {
|
|
1459
|
-
getter = getterOrOptions;
|
|
1460
|
-
} else {
|
|
1461
|
-
getter = getterOrOptions.get;
|
|
1462
|
-
setter = getterOrOptions.set;
|
|
1463
|
-
}
|
|
1464
|
-
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1465
|
-
if (!!(process.env.NODE_ENV !== "production") && debugOptions) ;
|
|
1466
|
-
return cRef;
|
|
1467
|
-
}
|
|
1468
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
1469
|
-
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1470
|
-
let activeWatcher = void 0;
|
|
1471
|
-
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1472
|
-
if (owner) {
|
|
1473
|
-
let cleanups = cleanupMap.get(owner);
|
|
1474
|
-
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
1475
|
-
cleanups.push(cleanupFn);
|
|
1476
|
-
} else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
|
|
1477
|
-
warn(
|
|
1478
|
-
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1479
|
-
);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
1483
|
-
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1484
|
-
const warnInvalidSource = (s) => {
|
|
1485
|
-
(options.onWarn || warn)(
|
|
1486
|
-
`Invalid watch source: `,
|
|
1487
|
-
s,
|
|
1488
|
-
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
1489
|
-
);
|
|
1490
|
-
};
|
|
1491
|
-
const reactiveGetter = (source2) => {
|
|
1492
|
-
if (deep) return source2;
|
|
1493
|
-
if (isShallow(source2) || deep === false || deep === 0)
|
|
1494
|
-
return traverse(source2, 1);
|
|
1495
|
-
return traverse(source2);
|
|
1496
|
-
};
|
|
1497
|
-
let effect;
|
|
1498
|
-
let getter;
|
|
1499
|
-
let cleanup;
|
|
1500
|
-
let boundCleanup;
|
|
1501
|
-
let forceTrigger = false;
|
|
1502
|
-
let isMultiSource = false;
|
|
1503
|
-
if (isRef(source)) {
|
|
1504
|
-
getter = () => source.value;
|
|
1505
|
-
forceTrigger = isShallow(source);
|
|
1506
|
-
} else if (isReactive(source)) {
|
|
1507
|
-
getter = () => reactiveGetter(source);
|
|
1508
|
-
forceTrigger = true;
|
|
1509
|
-
} else if (isArray(source)) {
|
|
1510
|
-
isMultiSource = true;
|
|
1511
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1512
|
-
getter = () => source.map((s) => {
|
|
1513
|
-
if (isRef(s)) {
|
|
1514
|
-
return s.value;
|
|
1515
|
-
} else if (isReactive(s)) {
|
|
1516
|
-
return reactiveGetter(s);
|
|
1517
|
-
} else if (isFunction(s)) {
|
|
1518
|
-
return call ? call(s, 2) : s();
|
|
1519
|
-
} else {
|
|
1520
|
-
!!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
|
|
1521
|
-
}
|
|
1522
|
-
});
|
|
1523
|
-
} else if (isFunction(source)) {
|
|
1524
|
-
if (cb) {
|
|
1525
|
-
getter = call ? () => call(source, 2) : source;
|
|
1526
|
-
} else {
|
|
1527
|
-
getter = () => {
|
|
1528
|
-
if (cleanup) {
|
|
1529
|
-
pauseTracking();
|
|
1530
|
-
try {
|
|
1531
|
-
cleanup();
|
|
1532
|
-
} finally {
|
|
1533
|
-
resetTracking();
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
const currentEffect = activeWatcher;
|
|
1537
|
-
activeWatcher = effect;
|
|
1538
|
-
try {
|
|
1539
|
-
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
1540
|
-
} finally {
|
|
1541
|
-
activeWatcher = currentEffect;
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
} else {
|
|
1546
|
-
getter = NOOP;
|
|
1547
|
-
!!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
|
|
1548
|
-
}
|
|
1549
|
-
if (cb && deep) {
|
|
1550
|
-
const baseGetter = getter;
|
|
1551
|
-
const depth = deep === true ? Infinity : deep;
|
|
1552
|
-
getter = () => traverse(baseGetter(), depth);
|
|
1553
|
-
}
|
|
1554
|
-
const watchHandle = () => {
|
|
1555
|
-
effect.stop();
|
|
1556
|
-
};
|
|
1557
|
-
if (once && cb) {
|
|
1558
|
-
const _cb = cb;
|
|
1559
|
-
cb = (...args) => {
|
|
1560
|
-
_cb(...args);
|
|
1561
|
-
watchHandle();
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1565
|
-
const job = (immediateFirstRun) => {
|
|
1566
|
-
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
1567
|
-
return;
|
|
1568
|
-
}
|
|
1569
|
-
if (cb) {
|
|
1570
|
-
const newValue = effect.run();
|
|
1571
|
-
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1572
|
-
if (cleanup) {
|
|
1573
|
-
cleanup();
|
|
1574
|
-
}
|
|
1575
|
-
const currentWatcher = activeWatcher;
|
|
1576
|
-
activeWatcher = effect;
|
|
1577
|
-
try {
|
|
1578
|
-
const args = [
|
|
1579
|
-
newValue,
|
|
1580
|
-
// pass undefined as the old value when it's changed for the first time
|
|
1581
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1582
|
-
boundCleanup
|
|
1583
|
-
];
|
|
1584
|
-
oldValue = newValue;
|
|
1585
|
-
call ? call(cb, 3, args) : (
|
|
1586
|
-
// @ts-expect-error
|
|
1587
|
-
cb(...args)
|
|
1588
|
-
);
|
|
1589
|
-
} finally {
|
|
1590
|
-
activeWatcher = currentWatcher;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
} else {
|
|
1594
|
-
effect.run();
|
|
1595
|
-
}
|
|
1596
|
-
};
|
|
1597
|
-
if (augmentJob) {
|
|
1598
|
-
augmentJob(job);
|
|
1599
|
-
}
|
|
1600
|
-
effect = new ReactiveEffect(getter);
|
|
1601
|
-
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
1602
|
-
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
1603
|
-
cleanup = effect.onStop = () => {
|
|
1604
|
-
const cleanups = cleanupMap.get(effect);
|
|
1605
|
-
if (cleanups) {
|
|
1606
|
-
if (call) {
|
|
1607
|
-
call(cleanups, 4);
|
|
1608
|
-
} else {
|
|
1609
|
-
for (const cleanup2 of cleanups) cleanup2();
|
|
1610
|
-
}
|
|
1611
|
-
cleanupMap.delete(effect);
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1615
|
-
effect.onTrack = options.onTrack;
|
|
1616
|
-
effect.onTrigger = options.onTrigger;
|
|
1617
|
-
}
|
|
1618
|
-
if (cb) {
|
|
1619
|
-
if (immediate) {
|
|
1620
|
-
job(true);
|
|
1621
|
-
} else {
|
|
1622
|
-
oldValue = effect.run();
|
|
1623
|
-
}
|
|
1624
|
-
} else if (scheduler) {
|
|
1625
|
-
scheduler(job.bind(null, true), true);
|
|
1626
|
-
} else {
|
|
1627
|
-
effect.run();
|
|
1628
|
-
}
|
|
1629
|
-
watchHandle.pause = effect.pause.bind(effect);
|
|
1630
|
-
watchHandle.resume = effect.resume.bind(effect);
|
|
1631
|
-
watchHandle.stop = watchHandle;
|
|
1632
|
-
return watchHandle;
|
|
1633
|
-
}
|
|
1634
|
-
function traverse(value, depth = Infinity, seen) {
|
|
1635
|
-
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
1636
|
-
return value;
|
|
1637
|
-
}
|
|
1638
|
-
seen = seen || /* @__PURE__ */ new Map();
|
|
1639
|
-
if ((seen.get(value) || 0) >= depth) {
|
|
1640
|
-
return value;
|
|
1641
|
-
}
|
|
1642
|
-
seen.set(value, depth);
|
|
1643
|
-
depth--;
|
|
1644
|
-
if (isRef(value)) {
|
|
1645
|
-
traverse(value.value, depth, seen);
|
|
1646
|
-
} else if (isArray(value)) {
|
|
1647
|
-
for (let i = 0; i < value.length; i++) {
|
|
1648
|
-
traverse(value[i], depth, seen);
|
|
1649
|
-
}
|
|
1650
|
-
} else if (isSet(value) || isMap(value)) {
|
|
1651
|
-
value.forEach((v) => {
|
|
1652
|
-
traverse(v, depth, seen);
|
|
1653
|
-
});
|
|
1654
|
-
} else if (isPlainObject(value)) {
|
|
1655
|
-
for (const key in value) {
|
|
1656
|
-
traverse(value[key], depth, seen);
|
|
1657
|
-
}
|
|
1658
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
1659
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
1660
|
-
traverse(value[key], depth, seen);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
return value;
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
/**
|
|
1668
|
-
* @vue/runtime-core v3.5.24
|
|
1669
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
1670
|
-
* @license MIT
|
|
1671
|
-
**/
|
|
1672
|
-
|
|
1673
|
-
const stack = [];
|
|
1674
|
-
function pushWarningContext(vnode) {
|
|
1675
|
-
stack.push(vnode);
|
|
1676
|
-
}
|
|
1677
|
-
function popWarningContext() {
|
|
1678
|
-
stack.pop();
|
|
1679
|
-
}
|
|
1680
|
-
let isWarning = false;
|
|
1681
|
-
function warn$1(msg, ...args) {
|
|
1682
|
-
if (isWarning) return;
|
|
1683
|
-
isWarning = true;
|
|
1684
|
-
pauseTracking();
|
|
1685
|
-
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1686
|
-
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1687
|
-
const trace = getComponentTrace();
|
|
1688
|
-
if (appWarnHandler) {
|
|
1689
|
-
callWithErrorHandling(
|
|
1690
|
-
appWarnHandler,
|
|
1691
|
-
instance,
|
|
1692
|
-
11,
|
|
1693
|
-
[
|
|
1694
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
1695
|
-
msg + args.map((a) => {
|
|
1696
|
-
var _a, _b;
|
|
1697
|
-
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
1698
|
-
}).join(""),
|
|
1699
|
-
instance && instance.proxy,
|
|
1700
|
-
trace.map(
|
|
1701
|
-
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
|
1702
|
-
).join("\n"),
|
|
1703
|
-
trace
|
|
1704
|
-
]
|
|
1705
|
-
);
|
|
1706
|
-
} else {
|
|
1707
|
-
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1708
|
-
if (trace.length && // avoid spamming console during tests
|
|
1709
|
-
true) {
|
|
1710
|
-
warnArgs.push(`
|
|
1711
|
-
`, ...formatTrace(trace));
|
|
1712
|
-
}
|
|
1713
|
-
console.warn(...warnArgs);
|
|
1714
|
-
}
|
|
1715
|
-
resetTracking();
|
|
1716
|
-
isWarning = false;
|
|
1717
|
-
}
|
|
1718
|
-
function getComponentTrace() {
|
|
1719
|
-
let currentVNode = stack[stack.length - 1];
|
|
1720
|
-
if (!currentVNode) {
|
|
1721
|
-
return [];
|
|
1722
|
-
}
|
|
1723
|
-
const normalizedStack = [];
|
|
1724
|
-
while (currentVNode) {
|
|
1725
|
-
const last = normalizedStack[0];
|
|
1726
|
-
if (last && last.vnode === currentVNode) {
|
|
1727
|
-
last.recurseCount++;
|
|
1728
|
-
} else {
|
|
1729
|
-
normalizedStack.push({
|
|
1730
|
-
vnode: currentVNode,
|
|
1731
|
-
recurseCount: 0
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
1735
|
-
currentVNode = parentInstance && parentInstance.vnode;
|
|
1736
|
-
}
|
|
1737
|
-
return normalizedStack;
|
|
1738
|
-
}
|
|
1739
|
-
function formatTrace(trace) {
|
|
1740
|
-
const logs = [];
|
|
1741
|
-
trace.forEach((entry, i) => {
|
|
1742
|
-
logs.push(...i === 0 ? [] : [`
|
|
1743
|
-
`], ...formatTraceEntry(entry));
|
|
1744
|
-
});
|
|
1745
|
-
return logs;
|
|
1746
|
-
}
|
|
1747
|
-
function formatTraceEntry({ vnode, recurseCount }) {
|
|
1748
|
-
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
1749
|
-
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
1750
|
-
const open = ` at <${formatComponentName(
|
|
1751
|
-
vnode.component,
|
|
1752
|
-
vnode.type,
|
|
1753
|
-
isRoot
|
|
1754
|
-
)}`;
|
|
1755
|
-
const close = `>` + postfix;
|
|
1756
|
-
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
|
1757
|
-
}
|
|
1758
|
-
function formatProps(props) {
|
|
1759
|
-
const res = [];
|
|
1760
|
-
const keys = Object.keys(props);
|
|
1761
|
-
keys.slice(0, 3).forEach((key) => {
|
|
1762
|
-
res.push(...formatProp(key, props[key]));
|
|
1763
|
-
});
|
|
1764
|
-
if (keys.length > 3) {
|
|
1765
|
-
res.push(` ...`);
|
|
1766
|
-
}
|
|
1767
|
-
return res;
|
|
1768
|
-
}
|
|
1769
|
-
function formatProp(key, value, raw) {
|
|
1770
|
-
if (isString(value)) {
|
|
1771
|
-
value = JSON.stringify(value);
|
|
1772
|
-
return raw ? value : [`${key}=${value}`];
|
|
1773
|
-
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1774
|
-
return raw ? value : [`${key}=${value}`];
|
|
1775
|
-
} else if (isRef(value)) {
|
|
1776
|
-
value = formatProp(key, toRaw(value.value), true);
|
|
1777
|
-
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
1778
|
-
} else if (isFunction(value)) {
|
|
1779
|
-
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
1780
|
-
} else {
|
|
1781
|
-
value = toRaw(value);
|
|
1782
|
-
return raw ? value : [`${key}=`, value];
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
const ErrorTypeStrings$1 = {
|
|
1786
|
-
["sp"]: "serverPrefetch hook",
|
|
1787
|
-
["bc"]: "beforeCreate hook",
|
|
1788
|
-
["c"]: "created hook",
|
|
1789
|
-
["bm"]: "beforeMount hook",
|
|
1790
|
-
["m"]: "mounted hook",
|
|
1791
|
-
["bu"]: "beforeUpdate hook",
|
|
1792
|
-
["u"]: "updated",
|
|
1793
|
-
["bum"]: "beforeUnmount hook",
|
|
1794
|
-
["um"]: "unmounted hook",
|
|
1795
|
-
["a"]: "activated hook",
|
|
1796
|
-
["da"]: "deactivated hook",
|
|
1797
|
-
["ec"]: "errorCaptured hook",
|
|
1798
|
-
["rtc"]: "renderTracked hook",
|
|
1799
|
-
["rtg"]: "renderTriggered hook",
|
|
1800
|
-
[0]: "setup function",
|
|
1801
|
-
[1]: "render function",
|
|
1802
|
-
[2]: "watcher getter",
|
|
1803
|
-
[3]: "watcher callback",
|
|
1804
|
-
[4]: "watcher cleanup function",
|
|
1805
|
-
[5]: "native event handler",
|
|
1806
|
-
[6]: "component event handler",
|
|
1807
|
-
[7]: "vnode hook",
|
|
1808
|
-
[8]: "directive hook",
|
|
1809
|
-
[9]: "transition hook",
|
|
1810
|
-
[10]: "app errorHandler",
|
|
1811
|
-
[11]: "app warnHandler",
|
|
1812
|
-
[12]: "ref function",
|
|
1813
|
-
[13]: "async component loader",
|
|
1814
|
-
[14]: "scheduler flush",
|
|
1815
|
-
[15]: "component update",
|
|
1816
|
-
[16]: "app unmount cleanup function"
|
|
1817
|
-
};
|
|
1818
|
-
function callWithErrorHandling(fn, instance, type, args) {
|
|
1819
|
-
try {
|
|
1820
|
-
return args ? fn(...args) : fn();
|
|
1821
|
-
} catch (err) {
|
|
1822
|
-
handleError(err, instance, type);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1826
|
-
if (isFunction(fn)) {
|
|
1827
|
-
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1828
|
-
if (res && isPromise(res)) {
|
|
1829
|
-
res.catch((err) => {
|
|
1830
|
-
handleError(err, instance, type);
|
|
1831
|
-
});
|
|
1832
|
-
}
|
|
1833
|
-
return res;
|
|
1834
|
-
}
|
|
1835
|
-
if (isArray(fn)) {
|
|
1836
|
-
const values = [];
|
|
1837
|
-
for (let i = 0; i < fn.length; i++) {
|
|
1838
|
-
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1839
|
-
}
|
|
1840
|
-
return values;
|
|
1841
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1842
|
-
warn$1(
|
|
1843
|
-
`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
|
1844
|
-
);
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
function handleError(err, instance, type, throwInDev = true) {
|
|
1848
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
1849
|
-
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
1850
|
-
if (instance) {
|
|
1851
|
-
let cur = instance.parent;
|
|
1852
|
-
const exposedInstance = instance.proxy;
|
|
1853
|
-
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
1854
|
-
while (cur) {
|
|
1855
|
-
const errorCapturedHooks = cur.ec;
|
|
1856
|
-
if (errorCapturedHooks) {
|
|
1857
|
-
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
1858
|
-
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1859
|
-
return;
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
cur = cur.parent;
|
|
1864
|
-
}
|
|
1865
|
-
if (errorHandler) {
|
|
1866
|
-
pauseTracking();
|
|
1867
|
-
callWithErrorHandling(errorHandler, null, 10, [
|
|
1868
|
-
err,
|
|
1869
|
-
exposedInstance,
|
|
1870
|
-
errorInfo
|
|
1871
|
-
]);
|
|
1872
|
-
resetTracking();
|
|
1873
|
-
return;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
|
1877
|
-
}
|
|
1878
|
-
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
|
1879
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1880
|
-
const info = ErrorTypeStrings$1[type];
|
|
1881
|
-
if (contextVNode) {
|
|
1882
|
-
pushWarningContext(contextVNode);
|
|
1883
|
-
}
|
|
1884
|
-
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1885
|
-
if (contextVNode) {
|
|
1886
|
-
popWarningContext();
|
|
1887
|
-
}
|
|
1888
|
-
if (throwInDev) {
|
|
1889
|
-
throw err;
|
|
1890
|
-
} else {
|
|
1891
|
-
console.error(err);
|
|
1892
|
-
}
|
|
1893
|
-
} else if (throwInProd) {
|
|
1894
|
-
throw err;
|
|
1895
|
-
} else {
|
|
1896
|
-
console.error(err);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
const queue = [];
|
|
1901
|
-
let flushIndex = -1;
|
|
1902
|
-
const pendingPostFlushCbs = [];
|
|
1903
|
-
let activePostFlushCbs = null;
|
|
1904
|
-
let postFlushIndex = 0;
|
|
1905
|
-
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1906
|
-
let currentFlushPromise = null;
|
|
1907
|
-
const RECURSION_LIMIT = 100;
|
|
1908
|
-
function findInsertionIndex(id) {
|
|
1909
|
-
let start = flushIndex + 1;
|
|
1910
|
-
let end = queue.length;
|
|
1911
|
-
while (start < end) {
|
|
1912
|
-
const middle = start + end >>> 1;
|
|
1913
|
-
const middleJob = queue[middle];
|
|
1914
|
-
const middleJobId = getId(middleJob);
|
|
1915
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1916
|
-
start = middle + 1;
|
|
1917
|
-
} else {
|
|
1918
|
-
end = middle;
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
return start;
|
|
1922
|
-
}
|
|
1923
|
-
function queueJob(job) {
|
|
1924
|
-
if (!(job.flags & 1)) {
|
|
1925
|
-
const jobId = getId(job);
|
|
1926
|
-
const lastJob = queue[queue.length - 1];
|
|
1927
|
-
if (!lastJob || // fast path when the job id is larger than the tail
|
|
1928
|
-
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
1929
|
-
queue.push(job);
|
|
1930
|
-
} else {
|
|
1931
|
-
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
1932
|
-
}
|
|
1933
|
-
job.flags |= 1;
|
|
1934
|
-
queueFlush();
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
function queueFlush() {
|
|
1938
|
-
if (!currentFlushPromise) {
|
|
1939
|
-
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
function queuePostFlushCb(cb) {
|
|
1943
|
-
if (!isArray(cb)) {
|
|
1944
|
-
if (activePostFlushCbs && cb.id === -1) {
|
|
1945
|
-
activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
|
1946
|
-
} else if (!(cb.flags & 1)) {
|
|
1947
|
-
pendingPostFlushCbs.push(cb);
|
|
1948
|
-
cb.flags |= 1;
|
|
1949
|
-
}
|
|
1950
|
-
} else {
|
|
1951
|
-
pendingPostFlushCbs.push(...cb);
|
|
1952
|
-
}
|
|
1953
|
-
queueFlush();
|
|
1954
|
-
}
|
|
1955
|
-
function flushPostFlushCbs(seen) {
|
|
1956
|
-
if (pendingPostFlushCbs.length) {
|
|
1957
|
-
const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
|
1958
|
-
(a, b) => getId(a) - getId(b)
|
|
1959
|
-
);
|
|
1960
|
-
pendingPostFlushCbs.length = 0;
|
|
1961
|
-
if (activePostFlushCbs) {
|
|
1962
|
-
activePostFlushCbs.push(...deduped);
|
|
1963
|
-
return;
|
|
1964
|
-
}
|
|
1965
|
-
activePostFlushCbs = deduped;
|
|
1966
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1967
|
-
seen = seen || /* @__PURE__ */ new Map();
|
|
1968
|
-
}
|
|
1969
|
-
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1970
|
-
const cb = activePostFlushCbs[postFlushIndex];
|
|
1971
|
-
if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
|
|
1972
|
-
continue;
|
|
1973
|
-
}
|
|
1974
|
-
if (cb.flags & 4) {
|
|
1975
|
-
cb.flags &= -2;
|
|
1976
|
-
}
|
|
1977
|
-
if (!(cb.flags & 8)) cb();
|
|
1978
|
-
cb.flags &= -2;
|
|
1979
|
-
}
|
|
1980
|
-
activePostFlushCbs = null;
|
|
1981
|
-
postFlushIndex = 0;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
1985
|
-
function flushJobs(seen) {
|
|
1986
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1987
|
-
seen = seen || /* @__PURE__ */ new Map();
|
|
1988
|
-
}
|
|
1989
|
-
const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
|
|
1990
|
-
try {
|
|
1991
|
-
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1992
|
-
const job = queue[flushIndex];
|
|
1993
|
-
if (job && !(job.flags & 8)) {
|
|
1994
|
-
if (!!(process.env.NODE_ENV !== "production") && check(job)) {
|
|
1995
|
-
continue;
|
|
1996
|
-
}
|
|
1997
|
-
if (job.flags & 4) {
|
|
1998
|
-
job.flags &= ~1;
|
|
1999
|
-
}
|
|
2000
|
-
callWithErrorHandling(
|
|
2001
|
-
job,
|
|
2002
|
-
job.i,
|
|
2003
|
-
job.i ? 15 : 14
|
|
2004
|
-
);
|
|
2005
|
-
if (!(job.flags & 4)) {
|
|
2006
|
-
job.flags &= ~1;
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
} finally {
|
|
2011
|
-
for (; flushIndex < queue.length; flushIndex++) {
|
|
2012
|
-
const job = queue[flushIndex];
|
|
2013
|
-
if (job) {
|
|
2014
|
-
job.flags &= -2;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
flushIndex = -1;
|
|
2018
|
-
queue.length = 0;
|
|
2019
|
-
flushPostFlushCbs(seen);
|
|
2020
|
-
currentFlushPromise = null;
|
|
2021
|
-
if (queue.length || pendingPostFlushCbs.length) {
|
|
2022
|
-
flushJobs(seen);
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
function checkRecursiveUpdates(seen, fn) {
|
|
2027
|
-
const count = seen.get(fn) || 0;
|
|
2028
|
-
if (count > RECURSION_LIMIT) {
|
|
2029
|
-
const instance = fn.i;
|
|
2030
|
-
const componentName = instance && getComponentName(instance.type);
|
|
2031
|
-
handleError(
|
|
2032
|
-
`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.`,
|
|
2033
|
-
null,
|
|
2034
|
-
10
|
|
2035
|
-
);
|
|
2036
|
-
return true;
|
|
2037
|
-
}
|
|
2038
|
-
seen.set(fn, count + 1);
|
|
2039
|
-
return false;
|
|
2040
|
-
}
|
|
2041
|
-
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
2042
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2043
|
-
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
2044
|
-
createRecord: tryWrap(createRecord),
|
|
2045
|
-
rerender: tryWrap(rerender),
|
|
2046
|
-
reload: tryWrap(reload)
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
const map = /* @__PURE__ */ new Map();
|
|
2050
|
-
function createRecord(id, initialDef) {
|
|
2051
|
-
if (map.has(id)) {
|
|
2052
|
-
return false;
|
|
2053
|
-
}
|
|
2054
|
-
map.set(id, {
|
|
2055
|
-
initialDef: normalizeClassComponent(initialDef),
|
|
2056
|
-
instances: /* @__PURE__ */ new Set()
|
|
2057
|
-
});
|
|
2058
|
-
return true;
|
|
2059
|
-
}
|
|
2060
|
-
function normalizeClassComponent(component) {
|
|
2061
|
-
return isClassComponent(component) ? component.__vccOpts : component;
|
|
2062
|
-
}
|
|
2063
|
-
function rerender(id, newRender) {
|
|
2064
|
-
const record = map.get(id);
|
|
2065
|
-
if (!record) {
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
record.initialDef.render = newRender;
|
|
2069
|
-
[...record.instances].forEach((instance) => {
|
|
2070
|
-
if (newRender) {
|
|
2071
|
-
instance.render = newRender;
|
|
2072
|
-
normalizeClassComponent(instance.type).render = newRender;
|
|
2073
|
-
}
|
|
2074
|
-
instance.renderCache = [];
|
|
2075
|
-
if (!(instance.job.flags & 8)) {
|
|
2076
|
-
instance.update();
|
|
2077
|
-
}
|
|
2078
|
-
});
|
|
2079
|
-
}
|
|
2080
|
-
function reload(id, newComp) {
|
|
2081
|
-
const record = map.get(id);
|
|
2082
|
-
if (!record) return;
|
|
2083
|
-
newComp = normalizeClassComponent(newComp);
|
|
2084
|
-
updateComponentDef(record.initialDef, newComp);
|
|
2085
|
-
const instances = [...record.instances];
|
|
2086
|
-
for (let i = 0; i < instances.length; i++) {
|
|
2087
|
-
const instance = instances[i];
|
|
2088
|
-
const oldComp = normalizeClassComponent(instance.type);
|
|
2089
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2090
|
-
if (!dirtyInstances) {
|
|
2091
|
-
if (oldComp !== record.initialDef) {
|
|
2092
|
-
updateComponentDef(oldComp, newComp);
|
|
2093
|
-
}
|
|
2094
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2095
|
-
}
|
|
2096
|
-
dirtyInstances.add(instance);
|
|
2097
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
2098
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
2099
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
2100
|
-
if (instance.ceReload) {
|
|
2101
|
-
dirtyInstances.add(instance);
|
|
2102
|
-
instance.ceReload(newComp.styles);
|
|
2103
|
-
dirtyInstances.delete(instance);
|
|
2104
|
-
} else if (instance.parent) {
|
|
2105
|
-
queueJob(() => {
|
|
2106
|
-
if (!(instance.job.flags & 8)) {
|
|
2107
|
-
instance.parent.update();
|
|
2108
|
-
dirtyInstances.delete(instance);
|
|
2109
|
-
}
|
|
2110
|
-
});
|
|
2111
|
-
} else if (instance.appContext.reload) {
|
|
2112
|
-
instance.appContext.reload();
|
|
2113
|
-
} else if (typeof window !== "undefined") {
|
|
2114
|
-
window.location.reload();
|
|
2115
|
-
} else {
|
|
2116
|
-
console.warn(
|
|
2117
|
-
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
2118
|
-
);
|
|
2119
|
-
}
|
|
2120
|
-
if (instance.root.ce && instance !== instance.root) {
|
|
2121
|
-
instance.root.ce._removeChildStyle(oldComp);
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
queuePostFlushCb(() => {
|
|
2125
|
-
hmrDirtyComponents.clear();
|
|
2126
|
-
});
|
|
2127
|
-
}
|
|
2128
|
-
function updateComponentDef(oldComp, newComp) {
|
|
2129
|
-
extend(oldComp, newComp);
|
|
2130
|
-
for (const key in oldComp) {
|
|
2131
|
-
if (key !== "__file" && !(key in newComp)) {
|
|
2132
|
-
delete oldComp[key];
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
function tryWrap(fn) {
|
|
2137
|
-
return (id, arg) => {
|
|
2138
|
-
try {
|
|
2139
|
-
return fn(id, arg);
|
|
2140
|
-
} catch (e) {
|
|
2141
|
-
console.error(e);
|
|
2142
|
-
console.warn(
|
|
2143
|
-
`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
|
|
2144
|
-
);
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
let devtools$1;
|
|
2150
|
-
let buffer = [];
|
|
2151
|
-
function setDevtoolsHook$1(hook, target) {
|
|
2152
|
-
var _a, _b;
|
|
2153
|
-
devtools$1 = hook;
|
|
2154
|
-
if (devtools$1) {
|
|
2155
|
-
devtools$1.enabled = true;
|
|
2156
|
-
buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
|
|
2157
|
-
buffer = [];
|
|
2158
|
-
} else if (
|
|
2159
|
-
// handle late devtools injection - only do this if we are in an actual
|
|
2160
|
-
// browser environment to avoid the timer handle stalling test runner exit
|
|
2161
|
-
// (#4815)
|
|
2162
|
-
typeof window !== "undefined" && // some envs mock window but not fully
|
|
2163
|
-
window.HTMLElement && // also exclude jsdom
|
|
2164
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
2165
|
-
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
|
2166
|
-
) {
|
|
2167
|
-
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
|
2168
|
-
replay.push((newHook) => {
|
|
2169
|
-
setDevtoolsHook$1(newHook, target);
|
|
2170
|
-
});
|
|
2171
|
-
setTimeout(() => {
|
|
2172
|
-
if (!devtools$1) {
|
|
2173
|
-
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
2174
|
-
buffer = [];
|
|
2175
|
-
}
|
|
2176
|
-
}, 3e3);
|
|
2177
|
-
} else {
|
|
2178
|
-
buffer = [];
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
let currentRenderingInstance = null;
|
|
2183
|
-
let currentScopeId = null;
|
|
2184
|
-
const isTeleport = (type) => type.__isTeleport;
|
|
2185
|
-
function setTransitionHooks(vnode, hooks) {
|
|
2186
|
-
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
2187
|
-
vnode.transition = hooks;
|
|
2188
|
-
setTransitionHooks(vnode.component.subTree, hooks);
|
|
2189
|
-
} else if (vnode.shapeFlag & 128) {
|
|
2190
|
-
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
2191
|
-
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
2192
|
-
} else {
|
|
2193
|
-
vnode.transition = hooks;
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
2198
|
-
getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
|
2199
|
-
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
2200
|
-
const PublicInstanceProxyHandlers = {
|
|
2201
|
-
};
|
|
2202
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
2203
|
-
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
2204
|
-
warn$1(
|
|
2205
|
-
`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
|
2206
|
-
);
|
|
2207
|
-
return Reflect.ownKeys(target);
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
let currentApp = null;
|
|
2211
|
-
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
2212
|
-
const instance = getCurrentInstance();
|
|
2213
|
-
if (instance || currentApp) {
|
|
2214
|
-
let provides = instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
|
2215
|
-
if (provides && key in provides) {
|
|
2216
|
-
return provides[key];
|
|
2217
|
-
} else if (arguments.length > 1) {
|
|
2218
|
-
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
2219
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2220
|
-
warn$1(`injection "${String(key)}" not found.`);
|
|
2221
|
-
}
|
|
2222
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2223
|
-
warn$1(`inject() can only be used inside setup() or functional components.`);
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
const internalObjectProto = {};
|
|
2228
|
-
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
2229
|
-
|
|
2230
|
-
const queuePostRenderEffect = queueEffectWithSuspense ;
|
|
2231
|
-
|
|
2232
|
-
const ssrContextKey = Symbol.for("v-scx");
|
|
2233
|
-
const useSSRContext = () => {
|
|
2234
|
-
{
|
|
2235
|
-
const ctx = inject(ssrContextKey);
|
|
2236
|
-
if (!ctx) {
|
|
2237
|
-
!!(process.env.NODE_ENV !== "production") && warn$1(
|
|
2238
|
-
`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
|
|
2239
|
-
);
|
|
2240
|
-
}
|
|
2241
|
-
return ctx;
|
|
2242
|
-
}
|
|
2243
|
-
};
|
|
2244
|
-
function watch(source, cb, options) {
|
|
2245
|
-
if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) {
|
|
2246
|
-
warn$1(
|
|
2247
|
-
`\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
|
|
2248
|
-
);
|
|
2249
|
-
}
|
|
2250
|
-
return doWatch(source, cb, options);
|
|
2251
|
-
}
|
|
2252
|
-
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
2253
|
-
const { immediate, deep, flush, once } = options;
|
|
2254
|
-
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
2255
|
-
if (immediate !== void 0) {
|
|
2256
|
-
warn$1(
|
|
2257
|
-
`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
|
2258
|
-
);
|
|
2259
|
-
}
|
|
2260
|
-
if (deep !== void 0) {
|
|
2261
|
-
warn$1(
|
|
2262
|
-
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
2263
|
-
);
|
|
2264
|
-
}
|
|
2265
|
-
if (once !== void 0) {
|
|
2266
|
-
warn$1(
|
|
2267
|
-
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
2268
|
-
);
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
const baseWatchOptions = extend({}, options);
|
|
2272
|
-
if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn$1;
|
|
2273
|
-
const runsImmediately = cb && immediate || !cb && flush !== "post";
|
|
2274
|
-
let ssrCleanup;
|
|
2275
|
-
if (isInSSRComponentSetup) {
|
|
2276
|
-
if (flush === "sync") {
|
|
2277
|
-
const ctx = useSSRContext();
|
|
2278
|
-
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
2279
|
-
} else if (!runsImmediately) {
|
|
2280
|
-
const watchStopHandle = () => {
|
|
2281
|
-
};
|
|
2282
|
-
watchStopHandle.stop = NOOP;
|
|
2283
|
-
watchStopHandle.resume = NOOP;
|
|
2284
|
-
watchStopHandle.pause = NOOP;
|
|
2285
|
-
return watchStopHandle;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
const instance = currentInstance;
|
|
2289
|
-
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
2290
|
-
let isPre = false;
|
|
2291
|
-
if (flush === "post") {
|
|
2292
|
-
baseWatchOptions.scheduler = (job) => {
|
|
2293
|
-
queuePostRenderEffect(job, instance && instance.suspense);
|
|
2294
|
-
};
|
|
2295
|
-
} else if (flush !== "sync") {
|
|
2296
|
-
isPre = true;
|
|
2297
|
-
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
2298
|
-
if (isFirstRun) {
|
|
2299
|
-
job();
|
|
2300
|
-
} else {
|
|
2301
|
-
queueJob(job);
|
|
2302
|
-
}
|
|
2303
|
-
};
|
|
2304
|
-
}
|
|
2305
|
-
baseWatchOptions.augmentJob = (job) => {
|
|
2306
|
-
if (cb) {
|
|
2307
|
-
job.flags |= 4;
|
|
2308
|
-
}
|
|
2309
|
-
if (isPre) {
|
|
2310
|
-
job.flags |= 2;
|
|
2311
|
-
if (instance) {
|
|
2312
|
-
job.id = instance.uid;
|
|
2313
|
-
job.i = instance;
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
};
|
|
2317
|
-
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
2318
|
-
if (isInSSRComponentSetup) {
|
|
2319
|
-
if (ssrCleanup) {
|
|
2320
|
-
ssrCleanup.push(watchHandle);
|
|
2321
|
-
} else if (runsImmediately) {
|
|
2322
|
-
watchHandle();
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
return watchHandle;
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
const isSuspense = (type) => type.__isSuspense;
|
|
2329
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
2330
|
-
if (suspense && suspense.pendingBranch) {
|
|
2331
|
-
if (isArray(fn)) {
|
|
2332
|
-
suspense.effects.push(...fn);
|
|
2333
|
-
} else {
|
|
2334
|
-
suspense.effects.push(fn);
|
|
2335
|
-
}
|
|
2336
|
-
} else {
|
|
2337
|
-
queuePostFlushCb(fn);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
const Fragment = Symbol.for("v-fgt");
|
|
2342
|
-
const Text = Symbol.for("v-txt");
|
|
2343
|
-
const Comment = Symbol.for("v-cmt");
|
|
2344
|
-
function isVNode(value) {
|
|
2345
|
-
return value ? value.__v_isVNode === true : false;
|
|
2346
|
-
}
|
|
2347
|
-
const createVNodeWithArgsTransform = (...args) => {
|
|
2348
|
-
return _createVNode(
|
|
2349
|
-
...args
|
|
2350
|
-
);
|
|
2351
|
-
};
|
|
2352
|
-
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
2353
|
-
const normalizeRef = ({
|
|
2354
|
-
ref,
|
|
2355
|
-
ref_key,
|
|
2356
|
-
ref_for
|
|
2357
|
-
}) => {
|
|
2358
|
-
if (typeof ref === "number") {
|
|
2359
|
-
ref = "" + ref;
|
|
2360
|
-
}
|
|
2361
|
-
return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
|
2362
|
-
};
|
|
2363
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
2364
|
-
const vnode = {
|
|
2365
|
-
__v_isVNode: true,
|
|
2366
|
-
__v_skip: true,
|
|
2367
|
-
type,
|
|
2368
|
-
props,
|
|
2369
|
-
key: props && normalizeKey(props),
|
|
2370
|
-
ref: props && normalizeRef(props),
|
|
2371
|
-
scopeId: currentScopeId,
|
|
2372
|
-
slotScopeIds: null,
|
|
2373
|
-
children,
|
|
2374
|
-
component: null,
|
|
2375
|
-
suspense: null,
|
|
2376
|
-
ssContent: null,
|
|
2377
|
-
ssFallback: null,
|
|
2378
|
-
dirs: null,
|
|
2379
|
-
transition: null,
|
|
2380
|
-
el: null,
|
|
2381
|
-
anchor: null,
|
|
2382
|
-
target: null,
|
|
2383
|
-
targetStart: null,
|
|
2384
|
-
targetAnchor: null,
|
|
2385
|
-
staticCount: 0,
|
|
2386
|
-
shapeFlag,
|
|
2387
|
-
patchFlag,
|
|
2388
|
-
dynamicProps,
|
|
2389
|
-
dynamicChildren: null,
|
|
2390
|
-
appContext: null,
|
|
2391
|
-
ctx: currentRenderingInstance
|
|
2392
|
-
};
|
|
2393
|
-
if (needFullChildrenNormalization) {
|
|
2394
|
-
normalizeChildren(vnode, children);
|
|
2395
|
-
if (shapeFlag & 128) {
|
|
2396
|
-
type.normalize(vnode);
|
|
2397
|
-
}
|
|
2398
|
-
} else if (children) {
|
|
2399
|
-
vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
2400
|
-
}
|
|
2401
|
-
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
|
|
2402
|
-
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
2403
|
-
}
|
|
2404
|
-
return vnode;
|
|
2405
|
-
}
|
|
2406
|
-
const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
2407
|
-
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
2408
|
-
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
2409
|
-
if (!!(process.env.NODE_ENV !== "production") && !type) {
|
|
2410
|
-
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
2411
|
-
}
|
|
2412
|
-
type = Comment;
|
|
2413
|
-
}
|
|
2414
|
-
if (isVNode(type)) {
|
|
2415
|
-
const cloned = cloneVNode(
|
|
2416
|
-
type,
|
|
2417
|
-
props,
|
|
2418
|
-
true
|
|
2419
|
-
/* mergeRef: true */
|
|
2420
|
-
);
|
|
2421
|
-
if (children) {
|
|
2422
|
-
normalizeChildren(cloned, children);
|
|
2423
|
-
}
|
|
2424
|
-
cloned.patchFlag = -2;
|
|
2425
|
-
return cloned;
|
|
2426
|
-
}
|
|
2427
|
-
if (isClassComponent(type)) {
|
|
2428
|
-
type = type.__vccOpts;
|
|
2429
|
-
}
|
|
2430
|
-
if (props) {
|
|
2431
|
-
props = guardReactiveProps(props);
|
|
2432
|
-
let { class: klass, style } = props;
|
|
2433
|
-
if (klass && !isString(klass)) {
|
|
2434
|
-
props.class = normalizeClass(klass);
|
|
2435
|
-
}
|
|
2436
|
-
if (isObject(style)) {
|
|
2437
|
-
if (isProxy(style) && !isArray(style)) {
|
|
2438
|
-
style = extend({}, style);
|
|
2439
|
-
}
|
|
2440
|
-
props.style = normalizeStyle(style);
|
|
2441
|
-
}
|
|
2442
|
-
}
|
|
2443
|
-
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
2444
|
-
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
2445
|
-
type = toRaw(type);
|
|
2446
|
-
warn$1(
|
|
2447
|
-
`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\`.`,
|
|
2448
|
-
`
|
|
2449
|
-
Component that was made reactive: `,
|
|
2450
|
-
type
|
|
2451
|
-
);
|
|
2452
|
-
}
|
|
2453
|
-
return createBaseVNode(
|
|
2454
|
-
type,
|
|
2455
|
-
props,
|
|
2456
|
-
children,
|
|
2457
|
-
patchFlag,
|
|
2458
|
-
dynamicProps,
|
|
2459
|
-
shapeFlag,
|
|
2460
|
-
isBlockNode,
|
|
2461
|
-
true
|
|
2462
|
-
);
|
|
2463
|
-
}
|
|
2464
|
-
function guardReactiveProps(props) {
|
|
2465
|
-
if (!props) return null;
|
|
2466
|
-
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
2467
|
-
}
|
|
2468
|
-
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
2469
|
-
const { props, ref, patchFlag, children, transition } = vnode;
|
|
2470
|
-
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
2471
|
-
const cloned = {
|
|
2472
|
-
__v_isVNode: true,
|
|
2473
|
-
__v_skip: true,
|
|
2474
|
-
type: vnode.type,
|
|
2475
|
-
props: mergedProps,
|
|
2476
|
-
key: mergedProps && normalizeKey(mergedProps),
|
|
2477
|
-
ref: extraProps && extraProps.ref ? (
|
|
2478
|
-
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
2479
|
-
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
2480
|
-
// the refs so the single vnode can be set on multiple refs
|
|
2481
|
-
mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
|
2482
|
-
) : ref,
|
|
2483
|
-
scopeId: vnode.scopeId,
|
|
2484
|
-
slotScopeIds: vnode.slotScopeIds,
|
|
2485
|
-
children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
|
2486
|
-
target: vnode.target,
|
|
2487
|
-
targetStart: vnode.targetStart,
|
|
2488
|
-
targetAnchor: vnode.targetAnchor,
|
|
2489
|
-
staticCount: vnode.staticCount,
|
|
2490
|
-
shapeFlag: vnode.shapeFlag,
|
|
2491
|
-
// if the vnode is cloned with extra props, we can no longer assume its
|
|
2492
|
-
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
2493
|
-
// note: preserve flag for fragments since they use the flag for children
|
|
2494
|
-
// fast paths only.
|
|
2495
|
-
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
2496
|
-
dynamicProps: vnode.dynamicProps,
|
|
2497
|
-
dynamicChildren: vnode.dynamicChildren,
|
|
2498
|
-
appContext: vnode.appContext,
|
|
2499
|
-
dirs: vnode.dirs,
|
|
2500
|
-
transition,
|
|
2501
|
-
// These should technically only be non-null on mounted VNodes. However,
|
|
2502
|
-
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
2503
|
-
// them since them being non-null during a mount doesn't affect the logic as
|
|
2504
|
-
// they will simply be overwritten.
|
|
2505
|
-
component: vnode.component,
|
|
2506
|
-
suspense: vnode.suspense,
|
|
2507
|
-
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
2508
|
-
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
2509
|
-
placeholder: vnode.placeholder,
|
|
2510
|
-
el: vnode.el,
|
|
2511
|
-
anchor: vnode.anchor,
|
|
2512
|
-
ctx: vnode.ctx,
|
|
2513
|
-
ce: vnode.ce
|
|
2514
|
-
};
|
|
2515
|
-
if (transition && cloneTransition) {
|
|
2516
|
-
setTransitionHooks(
|
|
2517
|
-
cloned,
|
|
2518
|
-
transition.clone(cloned)
|
|
2519
|
-
);
|
|
2520
|
-
}
|
|
2521
|
-
return cloned;
|
|
2522
|
-
}
|
|
2523
|
-
function deepCloneVNode(vnode) {
|
|
2524
|
-
const cloned = cloneVNode(vnode);
|
|
2525
|
-
if (isArray(vnode.children)) {
|
|
2526
|
-
cloned.children = vnode.children.map(deepCloneVNode);
|
|
2527
|
-
}
|
|
2528
|
-
return cloned;
|
|
2529
|
-
}
|
|
2530
|
-
function createTextVNode(text = " ", flag = 0) {
|
|
2531
|
-
return createVNode(Text, null, text, flag);
|
|
2532
|
-
}
|
|
2533
|
-
function normalizeChildren(vnode, children) {
|
|
2534
|
-
let type = 0;
|
|
2535
|
-
const { shapeFlag } = vnode;
|
|
2536
|
-
if (children == null) {
|
|
2537
|
-
children = null;
|
|
2538
|
-
} else if (isArray(children)) {
|
|
2539
|
-
type = 16;
|
|
2540
|
-
} else if (typeof children === "object") {
|
|
2541
|
-
if (shapeFlag & (1 | 64)) {
|
|
2542
|
-
const slot = children.default;
|
|
2543
|
-
if (slot) {
|
|
2544
|
-
slot._c && (slot._d = false);
|
|
2545
|
-
normalizeChildren(vnode, slot());
|
|
2546
|
-
slot._c && (slot._d = true);
|
|
2547
|
-
}
|
|
2548
|
-
return;
|
|
2549
|
-
} else {
|
|
2550
|
-
type = 32;
|
|
2551
|
-
const slotFlag = children._;
|
|
2552
|
-
if (!slotFlag && !isInternalObject(children)) {
|
|
2553
|
-
children._ctx = currentRenderingInstance;
|
|
2554
|
-
}
|
|
2555
|
-
}
|
|
2556
|
-
} else if (isFunction(children)) {
|
|
2557
|
-
children = { default: children, _ctx: currentRenderingInstance };
|
|
2558
|
-
type = 32;
|
|
2559
|
-
} else {
|
|
2560
|
-
children = String(children);
|
|
2561
|
-
if (shapeFlag & 64) {
|
|
2562
|
-
type = 16;
|
|
2563
|
-
children = [createTextVNode(children)];
|
|
2564
|
-
} else {
|
|
2565
|
-
type = 8;
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
vnode.children = children;
|
|
2569
|
-
vnode.shapeFlag |= type;
|
|
2570
|
-
}
|
|
2571
|
-
function mergeProps(...args) {
|
|
2572
|
-
const ret = {};
|
|
2573
|
-
for (let i = 0; i < args.length; i++) {
|
|
2574
|
-
const toMerge = args[i];
|
|
2575
|
-
for (const key in toMerge) {
|
|
2576
|
-
if (key === "class") {
|
|
2577
|
-
if (ret.class !== toMerge.class) {
|
|
2578
|
-
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
2579
|
-
}
|
|
2580
|
-
} else if (key === "style") {
|
|
2581
|
-
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
2582
|
-
} else if (isOn(key)) {
|
|
2583
|
-
const existing = ret[key];
|
|
2584
|
-
const incoming = toMerge[key];
|
|
2585
|
-
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
|
2586
|
-
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
2587
|
-
}
|
|
2588
|
-
} else if (key !== "") {
|
|
2589
|
-
ret[key] = toMerge[key];
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
return ret;
|
|
2594
|
-
}
|
|
2595
|
-
let currentInstance = null;
|
|
2596
|
-
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
2597
|
-
{
|
|
2598
|
-
const g = getGlobalThis();
|
|
2599
|
-
const registerGlobalSetter = (key, setter) => {
|
|
2600
|
-
let setters;
|
|
2601
|
-
if (!(setters = g[key])) setters = g[key] = [];
|
|
2602
|
-
setters.push(setter);
|
|
2603
|
-
return (v) => {
|
|
2604
|
-
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
2605
|
-
else setters[0](v);
|
|
2606
|
-
};
|
|
2607
|
-
};
|
|
2608
|
-
registerGlobalSetter(
|
|
2609
|
-
`__VUE_INSTANCE_SETTERS__`,
|
|
2610
|
-
(v) => currentInstance = v
|
|
2611
|
-
);
|
|
2612
|
-
registerGlobalSetter(
|
|
2613
|
-
`__VUE_SSR_SETTERS__`,
|
|
2614
|
-
(v) => isInSSRComponentSetup = v
|
|
2615
|
-
);
|
|
2616
|
-
}
|
|
2617
|
-
let isInSSRComponentSetup = false;
|
|
2618
|
-
!!(process.env.NODE_ENV !== "production") ? {
|
|
2619
|
-
} : {
|
|
2620
|
-
};
|
|
2621
|
-
const classifyRE = /(?:^|[-_])\w/g;
|
|
2622
|
-
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
2623
|
-
function getComponentName(Component, includeInferred = true) {
|
|
2624
|
-
return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
|
2625
|
-
}
|
|
2626
|
-
function formatComponentName(instance, Component, isRoot = false) {
|
|
2627
|
-
let name = getComponentName(Component);
|
|
2628
|
-
if (!name && Component.__file) {
|
|
2629
|
-
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
2630
|
-
if (match) {
|
|
2631
|
-
name = match[1];
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
|
-
if (!name && instance && instance.parent) {
|
|
2635
|
-
const inferFromRegistry = (registry) => {
|
|
2636
|
-
for (const key in registry) {
|
|
2637
|
-
if (registry[key] === Component) {
|
|
2638
|
-
return key;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
};
|
|
2642
|
-
name = inferFromRegistry(
|
|
2643
|
-
instance.components || instance.parent.type.components
|
|
2644
|
-
) || inferFromRegistry(instance.appContext.components);
|
|
2645
|
-
}
|
|
2646
|
-
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
2647
|
-
}
|
|
2648
|
-
function isClassComponent(value) {
|
|
2649
|
-
return isFunction(value) && "__vccOpts" in value;
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
const computed = (getterOrOptions, debugOptions) => {
|
|
2653
|
-
const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
2654
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2655
|
-
const i = getCurrentInstance();
|
|
2656
|
-
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
2657
|
-
c._warnRecursive = true;
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
return c;
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
|
-
function initCustomFormatter() {
|
|
2664
|
-
if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
|
|
2665
|
-
return;
|
|
2666
|
-
}
|
|
2667
|
-
const vueStyle = { style: "color:#3ba776" };
|
|
2668
|
-
const numberStyle = { style: "color:#1677ff" };
|
|
2669
|
-
const stringStyle = { style: "color:#f5222d" };
|
|
2670
|
-
const keywordStyle = { style: "color:#eb2f96" };
|
|
2671
|
-
const formatter = {
|
|
2672
|
-
__vue_custom_formatter: true,
|
|
2673
|
-
header(obj) {
|
|
2674
|
-
if (!isObject(obj)) {
|
|
2675
|
-
return null;
|
|
2676
|
-
}
|
|
2677
|
-
if (obj.__isVue) {
|
|
2678
|
-
return ["div", vueStyle, `VueInstance`];
|
|
2679
|
-
} else if (isRef(obj)) {
|
|
2680
|
-
pauseTracking();
|
|
2681
|
-
const value = obj.value;
|
|
2682
|
-
resetTracking();
|
|
2683
|
-
return [
|
|
2684
|
-
"div",
|
|
2685
|
-
{},
|
|
2686
|
-
["span", vueStyle, genRefFlag(obj)],
|
|
2687
|
-
"<",
|
|
2688
|
-
formatValue(value),
|
|
2689
|
-
`>`
|
|
2690
|
-
];
|
|
2691
|
-
} else if (isReactive(obj)) {
|
|
2692
|
-
return [
|
|
2693
|
-
"div",
|
|
2694
|
-
{},
|
|
2695
|
-
["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
|
2696
|
-
"<",
|
|
2697
|
-
formatValue(obj),
|
|
2698
|
-
`>${isReadonly(obj) ? ` (readonly)` : ``}`
|
|
2699
|
-
];
|
|
2700
|
-
} else if (isReadonly(obj)) {
|
|
2701
|
-
return [
|
|
2702
|
-
"div",
|
|
2703
|
-
{},
|
|
2704
|
-
["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
|
2705
|
-
"<",
|
|
2706
|
-
formatValue(obj),
|
|
2707
|
-
">"
|
|
2708
|
-
];
|
|
2709
|
-
}
|
|
2710
|
-
return null;
|
|
2711
|
-
},
|
|
2712
|
-
hasBody(obj) {
|
|
2713
|
-
return obj && obj.__isVue;
|
|
2714
|
-
},
|
|
2715
|
-
body(obj) {
|
|
2716
|
-
if (obj && obj.__isVue) {
|
|
2717
|
-
return [
|
|
2718
|
-
"div",
|
|
2719
|
-
{},
|
|
2720
|
-
...formatInstance(obj.$)
|
|
2721
|
-
];
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
};
|
|
2725
|
-
function formatInstance(instance) {
|
|
2726
|
-
const blocks = [];
|
|
2727
|
-
if (instance.type.props && instance.props) {
|
|
2728
|
-
blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
|
2729
|
-
}
|
|
2730
|
-
if (instance.setupState !== EMPTY_OBJ) {
|
|
2731
|
-
blocks.push(createInstanceBlock("setup", instance.setupState));
|
|
2732
|
-
}
|
|
2733
|
-
if (instance.data !== EMPTY_OBJ) {
|
|
2734
|
-
blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
|
2735
|
-
}
|
|
2736
|
-
const computed = extractKeys(instance, "computed");
|
|
2737
|
-
if (computed) {
|
|
2738
|
-
blocks.push(createInstanceBlock("computed", computed));
|
|
2739
|
-
}
|
|
2740
|
-
const injected = extractKeys(instance, "inject");
|
|
2741
|
-
if (injected) {
|
|
2742
|
-
blocks.push(createInstanceBlock("injected", injected));
|
|
2743
|
-
}
|
|
2744
|
-
blocks.push([
|
|
2745
|
-
"div",
|
|
2746
|
-
{},
|
|
2747
|
-
[
|
|
2748
|
-
"span",
|
|
2749
|
-
{
|
|
2750
|
-
style: keywordStyle.style + ";opacity:0.66"
|
|
2751
|
-
},
|
|
2752
|
-
"$ (internal): "
|
|
2753
|
-
],
|
|
2754
|
-
["object", { object: instance }]
|
|
2755
|
-
]);
|
|
2756
|
-
return blocks;
|
|
2757
|
-
}
|
|
2758
|
-
function createInstanceBlock(type, target) {
|
|
2759
|
-
target = extend({}, target);
|
|
2760
|
-
if (!Object.keys(target).length) {
|
|
2761
|
-
return ["span", {}];
|
|
2762
|
-
}
|
|
2763
|
-
return [
|
|
2764
|
-
"div",
|
|
2765
|
-
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
2766
|
-
[
|
|
2767
|
-
"div",
|
|
2768
|
-
{
|
|
2769
|
-
style: "color:#476582"
|
|
2770
|
-
},
|
|
2771
|
-
type
|
|
2772
|
-
],
|
|
2773
|
-
[
|
|
2774
|
-
"div",
|
|
2775
|
-
{
|
|
2776
|
-
style: "padding-left:1.25em"
|
|
2777
|
-
},
|
|
2778
|
-
...Object.keys(target).map((key) => {
|
|
2779
|
-
return [
|
|
2780
|
-
"div",
|
|
2781
|
-
{},
|
|
2782
|
-
["span", keywordStyle, key + ": "],
|
|
2783
|
-
formatValue(target[key], false)
|
|
2784
|
-
];
|
|
2785
|
-
})
|
|
2786
|
-
]
|
|
2787
|
-
];
|
|
2788
|
-
}
|
|
2789
|
-
function formatValue(v, asRaw = true) {
|
|
2790
|
-
if (typeof v === "number") {
|
|
2791
|
-
return ["span", numberStyle, v];
|
|
2792
|
-
} else if (typeof v === "string") {
|
|
2793
|
-
return ["span", stringStyle, JSON.stringify(v)];
|
|
2794
|
-
} else if (typeof v === "boolean") {
|
|
2795
|
-
return ["span", keywordStyle, v];
|
|
2796
|
-
} else if (isObject(v)) {
|
|
2797
|
-
return ["object", { object: asRaw ? toRaw(v) : v }];
|
|
2798
|
-
} else {
|
|
2799
|
-
return ["span", stringStyle, String(v)];
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
|
-
function extractKeys(instance, type) {
|
|
2803
|
-
const Comp = instance.type;
|
|
2804
|
-
if (isFunction(Comp)) {
|
|
2805
|
-
return;
|
|
2806
|
-
}
|
|
2807
|
-
const extracted = {};
|
|
2808
|
-
for (const key in instance.ctx) {
|
|
2809
|
-
if (isKeyOfType(Comp, key, type)) {
|
|
2810
|
-
extracted[key] = instance.ctx[key];
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
return extracted;
|
|
2814
|
-
}
|
|
2815
|
-
function isKeyOfType(Comp, key, type) {
|
|
2816
|
-
const opts = Comp[type];
|
|
2817
|
-
if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
|
2818
|
-
return true;
|
|
2819
|
-
}
|
|
2820
|
-
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
2821
|
-
return true;
|
|
2822
|
-
}
|
|
2823
|
-
if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
|
2824
|
-
return true;
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
function genRefFlag(v) {
|
|
2828
|
-
if (isShallow(v)) {
|
|
2829
|
-
return `ShallowRef`;
|
|
2830
|
-
}
|
|
2831
|
-
if (v.effect) {
|
|
2832
|
-
return `ComputedRef`;
|
|
2833
|
-
}
|
|
2834
|
-
return `Ref`;
|
|
2835
|
-
}
|
|
2836
|
-
if (window.devtoolsFormatters) {
|
|
2837
|
-
window.devtoolsFormatters.push(formatter);
|
|
2838
|
-
} else {
|
|
2839
|
-
window.devtoolsFormatters = [formatter];
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
!!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
2843
|
-
!!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
2844
|
-
!!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
|
|
2845
|
-
|
|
2846
|
-
/**
|
|
2847
|
-
* vue v3.5.24
|
|
2848
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
2849
|
-
* @license MIT
|
|
2850
|
-
**/
|
|
2851
|
-
|
|
2852
|
-
function initDev() {
|
|
2853
|
-
{
|
|
2854
|
-
initCustomFormatter();
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2859
|
-
initDev();
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
32
|
const useDebounce = (callback, delay) => {
|
|
2863
33
|
let timeoutId = null;
|
|
2864
34
|
return function(...args) {
|
|
@@ -2871,7 +41,6 @@ const useDebounce = (callback, delay) => {
|
|
|
2871
41
|
};
|
|
2872
42
|
};
|
|
2873
43
|
|
|
2874
|
-
const APP_MODULE = "#app";
|
|
2875
44
|
class ADataProvider {
|
|
2876
45
|
filter = ref(null);
|
|
2877
46
|
sortList = ref([]);
|
|
@@ -2889,16 +58,10 @@ class ADataProvider {
|
|
|
2889
58
|
constructor(options) {
|
|
2890
59
|
if (options?.nuxtApp) {
|
|
2891
60
|
this.nuxtApp = options.nuxtApp;
|
|
2892
|
-
} else if (import.meta.
|
|
61
|
+
} else if (import.meta.client) {
|
|
2893
62
|
try {
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
APP_MODULE
|
|
2897
|
-
).then((appModule) => {
|
|
2898
|
-
this.nuxtApp = appModule.useNuxtApp();
|
|
2899
|
-
}).catch(() => {
|
|
2900
|
-
});
|
|
2901
|
-
} catch (e) {
|
|
63
|
+
this.nuxtApp = getNuxtApp();
|
|
64
|
+
} catch {
|
|
2902
65
|
}
|
|
2903
66
|
}
|
|
2904
67
|
if (options?.filter) {
|
|
@@ -2921,33 +84,28 @@ class ADataProvider {
|
|
|
2921
84
|
}
|
|
2922
85
|
if (options?.urlPageParam) {
|
|
2923
86
|
this.urlPageParam.value = options.urlPageParam;
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
this.currentPage.value = parsedPage;
|
|
87
|
+
if (import.meta.client) {
|
|
88
|
+
try {
|
|
89
|
+
const route = getRoute();
|
|
90
|
+
if (route) {
|
|
91
|
+
const pageFromUrl = route.query[options.urlPageParam];
|
|
92
|
+
if (pageFromUrl) {
|
|
93
|
+
const parsedPage = parseInt(pageFromUrl, 10);
|
|
94
|
+
if (!isNaN(parsedPage) && parsedPage > 0) {
|
|
95
|
+
this.currentPage.value = parsedPage;
|
|
96
|
+
}
|
|
2935
97
|
}
|
|
2936
98
|
}
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
} catch (e) {
|
|
99
|
+
} catch (e) {
|
|
100
|
+
}
|
|
2940
101
|
}
|
|
2941
102
|
}
|
|
2942
103
|
watch(this.currentPage, (newPage) => {
|
|
2943
104
|
this.loadPageData();
|
|
2944
105
|
if (import.meta.client && this.urlPageParam.value) {
|
|
2945
106
|
try {
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
APP_MODULE
|
|
2949
|
-
).then((appModule) => {
|
|
2950
|
-
const router = appModule.useRouter();
|
|
107
|
+
const router = getRouter();
|
|
108
|
+
if (router) {
|
|
2951
109
|
const currentQuery = { ...router.currentRoute.value.query };
|
|
2952
110
|
if (newPage === 1) {
|
|
2953
111
|
delete currentQuery[this.urlPageParam.value];
|
|
@@ -2955,8 +113,7 @@ class ADataProvider {
|
|
|
2955
113
|
currentQuery[this.urlPageParam.value] = String(newPage);
|
|
2956
114
|
}
|
|
2957
115
|
router.replace({ query: currentQuery });
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
116
|
+
}
|
|
2960
117
|
} catch (e) {
|
|
2961
118
|
}
|
|
2962
119
|
}
|
|
@@ -2986,6 +143,9 @@ class ADataProvider {
|
|
|
2986
143
|
setPageSize(pageSize) {
|
|
2987
144
|
this.pageSize.value = pageSize;
|
|
2988
145
|
}
|
|
146
|
+
async refresh(hardRefresh = false) {
|
|
147
|
+
this.loadPageData();
|
|
148
|
+
}
|
|
2989
149
|
}
|
|
2990
150
|
|
|
2991
151
|
const useFilterLogic = () => {
|
|
@@ -3244,8 +404,6 @@ class CFlatClientDataProvider extends ADataProvider {
|
|
|
3244
404
|
this.pageData.value = this.filteredData.value.slice(startIndex, endIndex);
|
|
3245
405
|
}
|
|
3246
406
|
}
|
|
3247
|
-
refreshData() {
|
|
3248
|
-
}
|
|
3249
407
|
}
|
|
3250
408
|
|
|
3251
409
|
class ACacheProvider {
|
|
@@ -3375,9 +533,9 @@ class CMemoryCache extends ACacheProvider {
|
|
|
3375
533
|
this._hydrateFromPayload();
|
|
3376
534
|
}
|
|
3377
535
|
}
|
|
3378
|
-
_hydrateFromPayload() {
|
|
536
|
+
async _hydrateFromPayload() {
|
|
3379
537
|
try {
|
|
3380
|
-
const nuxtApp =
|
|
538
|
+
const nuxtApp = await getNuxtApp();
|
|
3381
539
|
const payloadData = nuxtApp?.payload?.data || globalThis.__NUXT__?.payload?.data;
|
|
3382
540
|
if (!payloadData) return;
|
|
3383
541
|
for (const key in payloadData) {
|
|
@@ -3523,9 +681,9 @@ class CLocalStorageCache extends ACacheProvider {
|
|
|
3523
681
|
this._hydrateFromPayload();
|
|
3524
682
|
}
|
|
3525
683
|
}
|
|
3526
|
-
_hydrateFromPayload() {
|
|
684
|
+
async _hydrateFromPayload() {
|
|
3527
685
|
try {
|
|
3528
|
-
const nuxtApp =
|
|
686
|
+
const nuxtApp = await getNuxtApp();
|
|
3529
687
|
const payloadData = nuxtApp?.payload?.data || window.__NUXT__?.payload?.data;
|
|
3530
688
|
if (!payloadData) return;
|
|
3531
689
|
const prefix = "cache:";
|
|
@@ -3725,9 +883,9 @@ class CIndexedDBCache extends ACacheProvider {
|
|
|
3725
883
|
super();
|
|
3726
884
|
this.setStore();
|
|
3727
885
|
}
|
|
3728
|
-
_hydrateFromPayload() {
|
|
886
|
+
async _hydrateFromPayload() {
|
|
3729
887
|
try {
|
|
3730
|
-
const nuxtApp =
|
|
888
|
+
const nuxtApp = await getNuxtApp();
|
|
3731
889
|
const payloadData = nuxtApp?.payload?.data || globalThis.__NUXT__?.payload?.data;
|
|
3732
890
|
if (!payloadData) return;
|
|
3733
891
|
const prefix = "cache:";
|
|
@@ -3987,8 +1145,11 @@ class CCookieCache extends ACacheProvider {
|
|
|
3987
1145
|
if (import.meta.client) {
|
|
3988
1146
|
cookieStr = document.cookie;
|
|
3989
1147
|
} else if (nuxtApp) {
|
|
3990
|
-
const
|
|
3991
|
-
|
|
1148
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1149
|
+
if (event) {
|
|
1150
|
+
const cookies2 = parseCookies(event);
|
|
1151
|
+
return Object.keys(cookies2).filter((k) => k.startsWith(prefix)).map((k) => k.substring(prefix.length));
|
|
1152
|
+
}
|
|
3992
1153
|
}
|
|
3993
1154
|
if (!cookieStr) return [];
|
|
3994
1155
|
const keys = [];
|
|
@@ -4019,21 +1180,14 @@ class CCookieCache extends ACacheProvider {
|
|
|
4019
1180
|
}
|
|
4020
1181
|
}
|
|
4021
1182
|
} else if (nuxtApp) {
|
|
4022
|
-
const
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
const ca = cookieStr.split(";");
|
|
4026
|
-
for (let i = 0; i < ca.length; i++) {
|
|
4027
|
-
let c = ca[i].trim();
|
|
4028
|
-
if (c.indexOf(name) === 0) {
|
|
4029
|
-
cookieValue = c.substring(name.length, c.length);
|
|
4030
|
-
break;
|
|
4031
|
-
}
|
|
1183
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1184
|
+
if (event) {
|
|
1185
|
+
cookieValue = getCookie(event, prefixedKey) ?? null;
|
|
4032
1186
|
}
|
|
4033
1187
|
}
|
|
4034
1188
|
if (!cookieValue) return null;
|
|
4035
1189
|
try {
|
|
4036
|
-
const val = JSON.parse(
|
|
1190
|
+
const val = JSON.parse(cookieValue);
|
|
4037
1191
|
if (val && val.timestamp && val.lifetime) {
|
|
4038
1192
|
if (Date.now() - val.timestamp <= val.lifetime) {
|
|
4039
1193
|
return val.data;
|
|
@@ -4053,42 +1207,30 @@ class CCookieCache extends ACacheProvider {
|
|
|
4053
1207
|
timestamp: Date.now(),
|
|
4054
1208
|
lifetime
|
|
4055
1209
|
};
|
|
4056
|
-
const cookieValue = encodeURIComponent(JSON.stringify(entry));
|
|
4057
1210
|
const maxAge = Math.floor(lifetime / 1e3);
|
|
4058
|
-
new Date(Date.now() + lifetime).toUTCString();
|
|
4059
|
-
const cookieStr = `${prefixedKey}=${cookieValue}; Max-Age=${maxAge}; Path=/; SameSite=Lax${import.meta.server ? "; HttpOnly" : ""}`;
|
|
4060
1211
|
if (import.meta.client) {
|
|
4061
|
-
|
|
1212
|
+
const cookieValue = encodeURIComponent(JSON.stringify(entry));
|
|
1213
|
+
document.cookie = `${prefixedKey}=${cookieValue}; Max-Age=${maxAge}; Path=/; SameSite=Lax`;
|
|
4062
1214
|
} else if (nuxtApp) {
|
|
4063
|
-
const
|
|
4064
|
-
if (
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
}
|
|
4071
|
-
res.setHeader("Set-Cookie", [existing, cookieStr]);
|
|
4072
|
-
}
|
|
1215
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1216
|
+
if (event) {
|
|
1217
|
+
setCookie(event, prefixedKey, JSON.stringify(entry), {
|
|
1218
|
+
maxAge,
|
|
1219
|
+
path: "/",
|
|
1220
|
+
sameSite: "lax",
|
|
1221
|
+
httpOnly: true
|
|
1222
|
+
});
|
|
4073
1223
|
}
|
|
4074
1224
|
}
|
|
4075
1225
|
}
|
|
4076
1226
|
async remove(key, nuxtApp) {
|
|
4077
1227
|
const prefixedKey = "cache:" + key;
|
|
4078
|
-
const cookieStr = `${prefixedKey}=; Max-Age=0; Path=/; SameSite=Lax${import.meta.server ? "; HttpOnly" : ""}`;
|
|
4079
1228
|
if (import.meta.client) {
|
|
4080
|
-
document.cookie =
|
|
1229
|
+
document.cookie = `${prefixedKey}=; Max-Age=0; Path=/; SameSite=Lax`;
|
|
4081
1230
|
} else if (nuxtApp) {
|
|
4082
|
-
const
|
|
4083
|
-
if (
|
|
4084
|
-
|
|
4085
|
-
if (!existing) {
|
|
4086
|
-
res.setHeader("Set-Cookie", cookieStr);
|
|
4087
|
-
} else if (Array.isArray(existing)) {
|
|
4088
|
-
res.setHeader("Set-Cookie", [...existing, cookieStr]);
|
|
4089
|
-
} else {
|
|
4090
|
-
res.setHeader("Set-Cookie", [existing, cookieStr]);
|
|
4091
|
-
}
|
|
1231
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1232
|
+
if (event) {
|
|
1233
|
+
deleteCookie(event, prefixedKey, { path: "/", sameSite: "lax", httpOnly: true });
|
|
4092
1234
|
}
|
|
4093
1235
|
}
|
|
4094
1236
|
}
|
|
@@ -4106,21 +1248,14 @@ class CCookieCache extends ACacheProvider {
|
|
|
4106
1248
|
}
|
|
4107
1249
|
}
|
|
4108
1250
|
} else if (nuxtApp) {
|
|
4109
|
-
const
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
const ca = cookieStr.split(";");
|
|
4113
|
-
for (let i = 0; i < ca.length; i++) {
|
|
4114
|
-
let c = ca[i].trim();
|
|
4115
|
-
if (c.indexOf(name) === 0) {
|
|
4116
|
-
cookieValue = c.substring(name.length, c.length);
|
|
4117
|
-
break;
|
|
4118
|
-
}
|
|
1251
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1252
|
+
if (event) {
|
|
1253
|
+
cookieValue = getCookie(event, prefixedKey) ?? null;
|
|
4119
1254
|
}
|
|
4120
1255
|
}
|
|
4121
1256
|
if (!cookieValue) return null;
|
|
4122
1257
|
try {
|
|
4123
|
-
const val = JSON.parse(
|
|
1258
|
+
const val = JSON.parse(cookieValue);
|
|
4124
1259
|
if (val && val.timestamp && val.lifetime) {
|
|
4125
1260
|
return Math.max(0, val.timestamp + val.lifetime - Date.now());
|
|
4126
1261
|
}
|
|
@@ -4472,6 +1607,9 @@ class RequestProvider {
|
|
|
4472
1607
|
static requestQueue = [];
|
|
4473
1608
|
static executing = false;
|
|
4474
1609
|
static requestsInFlight = /* @__PURE__ */ new Map();
|
|
1610
|
+
lastUrl;
|
|
1611
|
+
lastOptions;
|
|
1612
|
+
dataReceivedCallback;
|
|
4475
1613
|
constructor(provider, lifetime, deduplicate) {
|
|
4476
1614
|
if (provider) this.setCacheProvider(provider);
|
|
4477
1615
|
if (lifetime) this.setCacheLifetime(lifetime);
|
|
@@ -4490,6 +1628,26 @@ class RequestProvider {
|
|
|
4490
1628
|
setDeduplicate(deduplicate) {
|
|
4491
1629
|
this.deduplicate = deduplicate;
|
|
4492
1630
|
}
|
|
1631
|
+
onDataReceived(callback) {
|
|
1632
|
+
this.dataReceivedCallback = callback;
|
|
1633
|
+
}
|
|
1634
|
+
hasLastUrl() {
|
|
1635
|
+
return !!this.lastUrl;
|
|
1636
|
+
}
|
|
1637
|
+
async refresh(hardRefresh = false) {
|
|
1638
|
+
if (!this.dataReceivedCallback) {
|
|
1639
|
+
return null;
|
|
1640
|
+
}
|
|
1641
|
+
if (!this.lastUrl) {
|
|
1642
|
+
console.warn("[RequestProvider] refresh called before any request was made.");
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
const options = { ...this.lastOptions };
|
|
1646
|
+
if (hardRefresh) {
|
|
1647
|
+
options.disableCache = true;
|
|
1648
|
+
}
|
|
1649
|
+
return this.request(this.lastUrl, options);
|
|
1650
|
+
}
|
|
4493
1651
|
getUniqueKey(url, options) {
|
|
4494
1652
|
if (options?.key) return options.key;
|
|
4495
1653
|
const { query, body, headers, method } = options || {};
|
|
@@ -4506,7 +1664,15 @@ class RequestProvider {
|
|
|
4506
1664
|
const uniqueKey = this.getUniqueKey(url, options);
|
|
4507
1665
|
const shouldDeduplicate = options?.deduplicate ?? this.deduplicate;
|
|
4508
1666
|
if (shouldDeduplicate && RequestProvider.requestsInFlight.has(uniqueKey)) {
|
|
4509
|
-
|
|
1667
|
+
const inflightPromise = RequestProvider.requestsInFlight.get(uniqueKey);
|
|
1668
|
+
return inflightPromise.then((result) => {
|
|
1669
|
+
this.lastUrl = url;
|
|
1670
|
+
this.lastOptions = options;
|
|
1671
|
+
if (this.dataReceivedCallback) {
|
|
1672
|
+
this.dataReceivedCallback(result);
|
|
1673
|
+
}
|
|
1674
|
+
return result;
|
|
1675
|
+
});
|
|
4510
1676
|
}
|
|
4511
1677
|
const promise = new Promise((resolve, reject) => {
|
|
4512
1678
|
RequestProvider.requestQueue.push({
|
|
@@ -4549,9 +1715,13 @@ class RequestProvider {
|
|
|
4549
1715
|
const nuxtApp = options?.nuxtApp;
|
|
4550
1716
|
let serverHeaders = {};
|
|
4551
1717
|
if (nuxtApp && import.meta.server) {
|
|
4552
|
-
const
|
|
4553
|
-
if (
|
|
4554
|
-
|
|
1718
|
+
const event = nuxtApp.ssrContext?.event;
|
|
1719
|
+
if (event) {
|
|
1720
|
+
const { getRequestHeader } = await import('h3');
|
|
1721
|
+
const cookieHeader = getRequestHeader(event, "cookie");
|
|
1722
|
+
if (cookieHeader) {
|
|
1723
|
+
serverHeaders = { cookie: cookieHeader };
|
|
1724
|
+
}
|
|
4555
1725
|
}
|
|
4556
1726
|
}
|
|
4557
1727
|
const provider = cacheStrategy ? CacheProviderFactory.getProvider(cacheStrategy) : this.cacheProvider;
|
|
@@ -4562,6 +1732,11 @@ class RequestProvider {
|
|
|
4562
1732
|
const cached = await provider.get(uniqueKey, nuxtApp);
|
|
4563
1733
|
if (cached) {
|
|
4564
1734
|
console.log(`[RequestProvider] CACHE HIT: ${url}`);
|
|
1735
|
+
this.lastUrl = url;
|
|
1736
|
+
this.lastOptions = options;
|
|
1737
|
+
if (this.dataReceivedCallback) {
|
|
1738
|
+
this.dataReceivedCallback(cached);
|
|
1739
|
+
}
|
|
4565
1740
|
return cached;
|
|
4566
1741
|
}
|
|
4567
1742
|
console.log(`[RequestProvider] CACHE MISS: ${url}`);
|
|
@@ -4576,6 +1751,11 @@ class RequestProvider {
|
|
|
4576
1751
|
if (provider && cacheLifetime && responseData && isGetRequest) {
|
|
4577
1752
|
await provider.set(uniqueKey, responseData, cacheLifetime, nuxtApp);
|
|
4578
1753
|
}
|
|
1754
|
+
this.lastUrl = url;
|
|
1755
|
+
this.lastOptions = options;
|
|
1756
|
+
if (this.dataReceivedCallback) {
|
|
1757
|
+
this.dataReceivedCallback(responseData);
|
|
1758
|
+
}
|
|
4579
1759
|
return responseData;
|
|
4580
1760
|
}
|
|
4581
1761
|
}
|
|
@@ -4593,6 +1773,11 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4593
1773
|
if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
|
|
4594
1774
|
if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
|
|
4595
1775
|
if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
|
|
1776
|
+
this.requestProvider.onDataReceived((data) => {
|
|
1777
|
+
if (data) {
|
|
1778
|
+
this.setData(data.rows || data);
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
4596
1781
|
}
|
|
4597
1782
|
setContextKey(key) {
|
|
4598
1783
|
this.contextKey.value = key;
|
|
@@ -4600,22 +1785,35 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4600
1785
|
if (this.cacheStrategy.value) this.requestProvider.setCacheProvider(this.cacheStrategy.value);
|
|
4601
1786
|
if (this.cacheLifetime.value) this.requestProvider.setCacheLifetime(this.cacheLifetime.value);
|
|
4602
1787
|
}
|
|
1788
|
+
async refresh(hardRefresh = false) {
|
|
1789
|
+
await this.refreshData({ disableCache: hardRefresh });
|
|
1790
|
+
}
|
|
4603
1791
|
async refreshData(options) {
|
|
1792
|
+
if (!this.requestProvider.hasLastUrl()) {
|
|
1793
|
+
await this._initialFetch(options?.disableCache ?? false);
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
this.loading.value = true;
|
|
1797
|
+
try {
|
|
1798
|
+
await this.requestProvider.refresh(options?.disableCache ?? false);
|
|
1799
|
+
} finally {
|
|
1800
|
+
this.loading.value = false;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
async _initialFetch(disableCache = false) {
|
|
4604
1804
|
if (!this.SSR.value && import.meta.server) return;
|
|
4605
1805
|
const fetcher = async () => {
|
|
4606
1806
|
const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
|
|
4607
1807
|
deduplicate: this.deduplicate.value,
|
|
4608
1808
|
nuxtApp: this.nuxtApp,
|
|
4609
|
-
disableCache
|
|
1809
|
+
disableCache
|
|
4610
1810
|
});
|
|
4611
|
-
if (this.SSR.value && import.meta.server)
|
|
4612
|
-
return await promise;
|
|
4613
|
-
}
|
|
1811
|
+
if (this.SSR.value && import.meta.server) return await promise;
|
|
4614
1812
|
return promise;
|
|
4615
1813
|
};
|
|
4616
1814
|
const key = `${this.contextKey.value}`;
|
|
4617
|
-
if (this.contextKey.value && this.initialLoad.value) {
|
|
4618
|
-
const { data } =
|
|
1815
|
+
if (this.contextKey.value && this.initialLoad.value && !disableCache) {
|
|
1816
|
+
const { data } = getNuxtData(key, this.nuxtApp);
|
|
4619
1817
|
if (data.value) {
|
|
4620
1818
|
const result = data.value;
|
|
4621
1819
|
this.setData(result.rows);
|
|
@@ -4625,7 +1823,10 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4625
1823
|
}
|
|
4626
1824
|
}
|
|
4627
1825
|
if (import.meta.server && this.contextKey.value) {
|
|
4628
|
-
|
|
1826
|
+
if (disableCache) {
|
|
1827
|
+
clearNuxtDataKey(key, this.nuxtApp);
|
|
1828
|
+
}
|
|
1829
|
+
const { data } = await getAsyncData(key, fetcher, this.nuxtApp);
|
|
4629
1830
|
if (data.value) {
|
|
4630
1831
|
const result = data.value;
|
|
4631
1832
|
this.setData(result.rows);
|
|
@@ -4638,22 +1839,20 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4638
1839
|
const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
|
|
4639
1840
|
deduplicate: this.deduplicate.value,
|
|
4640
1841
|
nuxtApp: this.nuxtApp,
|
|
4641
|
-
disableCache
|
|
1842
|
+
disableCache
|
|
4642
1843
|
});
|
|
4643
|
-
promise.then((
|
|
1844
|
+
promise.then(() => {
|
|
4644
1845
|
this.initialLoad.value = false;
|
|
4645
1846
|
this.loading.value = false;
|
|
4646
|
-
this.setData(returnedData2.rows);
|
|
4647
1847
|
}).catch(() => {
|
|
4648
1848
|
this.initialLoad.value = false;
|
|
4649
1849
|
this.loading.value = false;
|
|
4650
1850
|
});
|
|
4651
1851
|
return;
|
|
4652
1852
|
}
|
|
4653
|
-
|
|
1853
|
+
await fetcher();
|
|
4654
1854
|
this.initialLoad.value = false;
|
|
4655
1855
|
this.loading.value = false;
|
|
4656
|
-
this.setData(returnedData.rows);
|
|
4657
1856
|
}
|
|
4658
1857
|
async setAPIUrl(url) {
|
|
4659
1858
|
this.loading.value = true;
|
|
@@ -4670,19 +1869,18 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4670
1869
|
nuxtApp: this.nuxtApp
|
|
4671
1870
|
});
|
|
4672
1871
|
if (this.refreshOnMutation.value) {
|
|
4673
|
-
await this.
|
|
1872
|
+
await this.refresh(true);
|
|
4674
1873
|
} else {
|
|
4675
1874
|
if (result && result.item) {
|
|
4676
1875
|
this.allData.value.push(result.item);
|
|
4677
1876
|
this.loadPageData();
|
|
4678
|
-
|
|
4679
|
-
await this.refreshData({ disableCache: true });
|
|
1877
|
+
await this.refresh(true);
|
|
4680
1878
|
}
|
|
4681
1879
|
if (this.requestProvider.cacheProvider) {
|
|
4682
1880
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
4683
1881
|
}
|
|
4684
1882
|
if (this.contextKey.value) {
|
|
4685
|
-
|
|
1883
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
4686
1884
|
}
|
|
4687
1885
|
}
|
|
4688
1886
|
}
|
|
@@ -4694,7 +1892,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4694
1892
|
nuxtApp: this.nuxtApp
|
|
4695
1893
|
});
|
|
4696
1894
|
if (this.refreshOnMutation.value) {
|
|
4697
|
-
await this.
|
|
1895
|
+
await this.refresh(true);
|
|
4698
1896
|
} else {
|
|
4699
1897
|
const index = this.allData.value.findIndex((row) => row["id"] === item["id"]);
|
|
4700
1898
|
if (index !== -1) {
|
|
@@ -4709,7 +1907,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4709
1907
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
4710
1908
|
}
|
|
4711
1909
|
if (this.contextKey.value) {
|
|
4712
|
-
|
|
1910
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
4713
1911
|
}
|
|
4714
1912
|
}
|
|
4715
1913
|
}
|
|
@@ -4723,7 +1921,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4723
1921
|
nuxtApp: this.nuxtApp
|
|
4724
1922
|
});
|
|
4725
1923
|
if (this.refreshOnMutation.value) {
|
|
4726
|
-
await this.
|
|
1924
|
+
await this.refresh(true);
|
|
4727
1925
|
} else {
|
|
4728
1926
|
const idsToDelete = new Set(ids);
|
|
4729
1927
|
this.allData.value = this.allData.value.filter((row) => !idsToDelete.has(row["id"]));
|
|
@@ -4731,7 +1929,7 @@ class CAPIFlatClientDataProvider extends CFlatClientDataProvider {
|
|
|
4731
1929
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
4732
1930
|
}
|
|
4733
1931
|
if (this.contextKey.value) {
|
|
4734
|
-
|
|
1932
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
4735
1933
|
}
|
|
4736
1934
|
}
|
|
4737
1935
|
}
|
|
@@ -4768,7 +1966,7 @@ class CFlatServerDataProvider extends ADataProvider {
|
|
|
4768
1966
|
].join("-");
|
|
4769
1967
|
const fetcher = async () => await this.pageDataHandler.value(this.currentPage.value, this.pageSize.value, this.filter.value, this.sortList.value, options);
|
|
4770
1968
|
if (!options?.disableCache && this.SSR.value && this.contextKey.value && this.initialLoad.value) {
|
|
4771
|
-
const { data } =
|
|
1969
|
+
const { data } = getNuxtData(key, this.nuxtApp);
|
|
4772
1970
|
if (data.value) {
|
|
4773
1971
|
const result = data.value;
|
|
4774
1972
|
this.pageData.value = result.rows;
|
|
@@ -4778,9 +1976,9 @@ class CFlatServerDataProvider extends ADataProvider {
|
|
|
4778
1976
|
return;
|
|
4779
1977
|
}
|
|
4780
1978
|
}
|
|
4781
|
-
if (this.SSR.value && this.contextKey.value) {
|
|
1979
|
+
if (this.SSR.value && this.contextKey.value && !options?.disableCache && (import.meta.server || this.initialLoad.value)) {
|
|
4782
1980
|
this.loading.value = true;
|
|
4783
|
-
const { data } = await
|
|
1981
|
+
const { data } = await getAsyncData(key, fetcher, this.nuxtApp);
|
|
4784
1982
|
if (data.value) {
|
|
4785
1983
|
const result = data.value;
|
|
4786
1984
|
this.pageData.value = result.rows;
|
|
@@ -4791,7 +1989,7 @@ class CFlatServerDataProvider extends ADataProvider {
|
|
|
4791
1989
|
}
|
|
4792
1990
|
}
|
|
4793
1991
|
if (!this.SSR.value) {
|
|
4794
|
-
|
|
1992
|
+
onNuxtReadyCallback(() => {
|
|
4795
1993
|
this.loading.value = true;
|
|
4796
1994
|
fetcher().then((returnedData2) => {
|
|
4797
1995
|
this.pageData.value = returnedData2.rows;
|
|
@@ -4812,6 +2010,9 @@ class CFlatServerDataProvider extends ADataProvider {
|
|
|
4812
2010
|
this.initialLoad.value = false;
|
|
4813
2011
|
this.loading.value = false;
|
|
4814
2012
|
}
|
|
2013
|
+
async refresh(hardRefresh = false) {
|
|
2014
|
+
await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
|
|
2015
|
+
}
|
|
4815
2016
|
}
|
|
4816
2017
|
|
|
4817
2018
|
class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
|
|
@@ -4826,6 +2027,28 @@ class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
|
|
|
4826
2027
|
if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
|
|
4827
2028
|
if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
|
|
4828
2029
|
if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
|
|
2030
|
+
this.requestProvider.onDataReceived((data) => {
|
|
2031
|
+
if (data) {
|
|
2032
|
+
this.pageData.value = data.rows || data;
|
|
2033
|
+
if (data.rowCount !== void 0) {
|
|
2034
|
+
this.rowCount.value = data.rowCount;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
async refresh(hardRefresh = false) {
|
|
2040
|
+
if (hardRefresh && this.requestProvider.cacheProvider) {
|
|
2041
|
+
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
2042
|
+
}
|
|
2043
|
+
this.loading.value = true;
|
|
2044
|
+
try {
|
|
2045
|
+
await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
|
|
2046
|
+
} finally {
|
|
2047
|
+
this.loading.value = false;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
async refreshData(options) {
|
|
2051
|
+
await this.refresh(options?.disableCache ?? false);
|
|
4829
2052
|
}
|
|
4830
2053
|
async setAPIUrl(url) {
|
|
4831
2054
|
this.apiUrl.value = url;
|
|
@@ -4861,7 +2084,7 @@ class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
|
|
|
4861
2084
|
if (this.requestProvider.cacheProvider) {
|
|
4862
2085
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
4863
2086
|
}
|
|
4864
|
-
this.
|
|
2087
|
+
await this.refresh(true);
|
|
4865
2088
|
}
|
|
4866
2089
|
}
|
|
4867
2090
|
}
|
|
@@ -5136,6 +2359,11 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5136
2359
|
if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
|
|
5137
2360
|
if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
|
|
5138
2361
|
if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
|
|
2362
|
+
this.requestProvider.onDataReceived((data) => {
|
|
2363
|
+
if (data) {
|
|
2364
|
+
this.setData(data.rows || data);
|
|
2365
|
+
}
|
|
2366
|
+
});
|
|
5139
2367
|
}
|
|
5140
2368
|
setContextKey(key) {
|
|
5141
2369
|
this.contextKey.value = key;
|
|
@@ -5143,22 +2371,35 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5143
2371
|
if (this.cacheStrategy.value) this.requestProvider.setCacheProvider(this.cacheStrategy.value);
|
|
5144
2372
|
if (this.cacheLifetime.value) this.requestProvider.setCacheLifetime(this.cacheLifetime.value);
|
|
5145
2373
|
}
|
|
2374
|
+
async refresh(hardRefresh = false) {
|
|
2375
|
+
await this.refreshData({ disableCache: hardRefresh });
|
|
2376
|
+
}
|
|
5146
2377
|
async refreshData(options) {
|
|
2378
|
+
if (!this.requestProvider.hasLastUrl()) {
|
|
2379
|
+
await this._initialFetch(options?.disableCache ?? false);
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
this.loading.value = true;
|
|
2383
|
+
try {
|
|
2384
|
+
await this.requestProvider.refresh(options?.disableCache ?? false);
|
|
2385
|
+
} finally {
|
|
2386
|
+
this.loading.value = false;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
async _initialFetch(disableCache = false) {
|
|
5147
2390
|
if (!this.SSR.value && import.meta.server) return;
|
|
5148
2391
|
const fetcher = async () => {
|
|
5149
2392
|
const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
|
|
5150
2393
|
deduplicate: this.deduplicate.value,
|
|
5151
2394
|
nuxtApp: this.nuxtApp,
|
|
5152
|
-
disableCache
|
|
2395
|
+
disableCache
|
|
5153
2396
|
});
|
|
5154
|
-
if (this.SSR.value && import.meta.server)
|
|
5155
|
-
return await promise;
|
|
5156
|
-
}
|
|
2397
|
+
if (this.SSR.value && import.meta.server) return await promise;
|
|
5157
2398
|
return promise;
|
|
5158
2399
|
};
|
|
5159
2400
|
const key = `${this.contextKey.value}`;
|
|
5160
|
-
if (this.contextKey.value && this.initialLoad.value) {
|
|
5161
|
-
const { data } =
|
|
2401
|
+
if (this.contextKey.value && this.initialLoad.value && !disableCache) {
|
|
2402
|
+
const { data } = getNuxtData(key, this.nuxtApp);
|
|
5162
2403
|
if (data.value) {
|
|
5163
2404
|
const result = data.value;
|
|
5164
2405
|
this.setData(result.rows);
|
|
@@ -5168,7 +2409,10 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5168
2409
|
}
|
|
5169
2410
|
}
|
|
5170
2411
|
if (import.meta.server && this.contextKey.value) {
|
|
5171
|
-
|
|
2412
|
+
if (disableCache) {
|
|
2413
|
+
clearNuxtDataKey(key, this.nuxtApp);
|
|
2414
|
+
}
|
|
2415
|
+
const { data } = await getAsyncData(key, fetcher, this.nuxtApp);
|
|
5172
2416
|
if (data.value) {
|
|
5173
2417
|
const result = data.value;
|
|
5174
2418
|
this.setData(result.rows);
|
|
@@ -5181,22 +2425,20 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5181
2425
|
const promise = this.requestProvider.registerRequest(this.apiUrl.value, {
|
|
5182
2426
|
deduplicate: this.deduplicate.value,
|
|
5183
2427
|
nuxtApp: this.nuxtApp,
|
|
5184
|
-
disableCache
|
|
2428
|
+
disableCache
|
|
5185
2429
|
});
|
|
5186
|
-
promise.then((
|
|
2430
|
+
promise.then(() => {
|
|
5187
2431
|
this.initialLoad.value = false;
|
|
5188
2432
|
this.loading.value = false;
|
|
5189
|
-
this.setData(returnedData2.rows);
|
|
5190
2433
|
}).catch(() => {
|
|
5191
2434
|
this.initialLoad.value = false;
|
|
5192
2435
|
this.loading.value = false;
|
|
5193
2436
|
});
|
|
5194
2437
|
return;
|
|
5195
2438
|
}
|
|
5196
|
-
|
|
2439
|
+
await fetcher();
|
|
5197
2440
|
this.initialLoad.value = false;
|
|
5198
2441
|
this.loading.value = false;
|
|
5199
|
-
this.setData(returnedData.rows);
|
|
5200
2442
|
}
|
|
5201
2443
|
async setAPIUrl(url) {
|
|
5202
2444
|
this.loading.value = true;
|
|
@@ -5213,18 +2455,18 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5213
2455
|
nuxtApp: this.nuxtApp
|
|
5214
2456
|
});
|
|
5215
2457
|
if (this.refreshOnMutation.value) {
|
|
5216
|
-
await this.
|
|
2458
|
+
await this.refresh(true);
|
|
5217
2459
|
} else {
|
|
5218
2460
|
if (result && result.item) {
|
|
5219
2461
|
this.allData.value.push(result.item);
|
|
5220
2462
|
} else {
|
|
5221
|
-
await this.
|
|
2463
|
+
await this.refresh(true);
|
|
5222
2464
|
}
|
|
5223
2465
|
if (this.requestProvider.cacheProvider) {
|
|
5224
2466
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
5225
2467
|
}
|
|
5226
2468
|
if (this.contextKey.value) {
|
|
5227
|
-
|
|
2469
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
5228
2470
|
}
|
|
5229
2471
|
}
|
|
5230
2472
|
}
|
|
@@ -5236,7 +2478,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5236
2478
|
nuxtApp: this.nuxtApp
|
|
5237
2479
|
});
|
|
5238
2480
|
if (this.refreshOnMutation.value) {
|
|
5239
|
-
await this.
|
|
2481
|
+
await this.refresh(true);
|
|
5240
2482
|
} else {
|
|
5241
2483
|
const index = this.allData.value.findIndex((row) => row[this.idKey] === item[this.idKey]);
|
|
5242
2484
|
if (index !== -1) {
|
|
@@ -5251,7 +2493,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5251
2493
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
5252
2494
|
}
|
|
5253
2495
|
if (this.contextKey.value) {
|
|
5254
|
-
|
|
2496
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
5255
2497
|
}
|
|
5256
2498
|
}
|
|
5257
2499
|
}
|
|
@@ -5265,7 +2507,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5265
2507
|
nuxtApp: this.nuxtApp
|
|
5266
2508
|
});
|
|
5267
2509
|
if (this.refreshOnMutation.value) {
|
|
5268
|
-
await this.
|
|
2510
|
+
await this.refresh(true);
|
|
5269
2511
|
} else {
|
|
5270
2512
|
const idsToDelete = new Set(ids);
|
|
5271
2513
|
this.allData.value = this.allData.value.filter((row) => !idsToDelete.has(row[this.idKey]));
|
|
@@ -5273,7 +2515,7 @@ class CAPITreeClientDataProvider extends CTreeClientDataProvider {
|
|
|
5273
2515
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
5274
2516
|
}
|
|
5275
2517
|
if (this.contextKey.value) {
|
|
5276
|
-
|
|
2518
|
+
clearNuxtDataKey(this.contextKey.value, this.nuxtApp);
|
|
5277
2519
|
}
|
|
5278
2520
|
}
|
|
5279
2521
|
}
|
|
@@ -5342,7 +2584,7 @@ class CTreeServerDataProvider extends ADataProvider {
|
|
|
5342
2584
|
options
|
|
5343
2585
|
);
|
|
5344
2586
|
if (!options?.disableCache && this.SSR.value && this.contextKey.value && this.initialLoad.value) {
|
|
5345
|
-
const { data } =
|
|
2587
|
+
const { data } = getNuxtData(key, this.nuxtApp);
|
|
5346
2588
|
if (data.value) {
|
|
5347
2589
|
const result = data.value;
|
|
5348
2590
|
this.pageData.value = result.rows;
|
|
@@ -5352,9 +2594,9 @@ class CTreeServerDataProvider extends ADataProvider {
|
|
|
5352
2594
|
return;
|
|
5353
2595
|
}
|
|
5354
2596
|
}
|
|
5355
|
-
if (this.SSR.value && this.contextKey.value) {
|
|
2597
|
+
if (this.SSR.value && this.contextKey.value && !options?.disableCache && (import.meta.server || this.initialLoad.value)) {
|
|
5356
2598
|
this.loading.value = true;
|
|
5357
|
-
const { data } = await
|
|
2599
|
+
const { data } = await getAsyncData(key, fetcher, this.nuxtApp);
|
|
5358
2600
|
if (data.value) {
|
|
5359
2601
|
const result = data.value;
|
|
5360
2602
|
this.pageData.value = result.rows;
|
|
@@ -5365,7 +2607,7 @@ class CTreeServerDataProvider extends ADataProvider {
|
|
|
5365
2607
|
}
|
|
5366
2608
|
}
|
|
5367
2609
|
if (!this.SSR.value) {
|
|
5368
|
-
|
|
2610
|
+
onNuxtReadyCallback(() => {
|
|
5369
2611
|
this.loading.value = true;
|
|
5370
2612
|
fetcher().then((returnedData2) => {
|
|
5371
2613
|
this.pageData.value = returnedData2.rows;
|
|
@@ -5386,6 +2628,9 @@ class CTreeServerDataProvider extends ADataProvider {
|
|
|
5386
2628
|
this.initialLoad.value = false;
|
|
5387
2629
|
this.loading.value = false;
|
|
5388
2630
|
}
|
|
2631
|
+
async refresh(hardRefresh = false) {
|
|
2632
|
+
await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
|
|
2633
|
+
}
|
|
5389
2634
|
// ============================================
|
|
5390
2635
|
// Expand/Collapse API
|
|
5391
2636
|
// ============================================
|
|
@@ -5426,6 +2671,28 @@ class CAPITreeServerDataProvider extends CTreeServerDataProvider {
|
|
|
5426
2671
|
if (options?.cacheStrategy) this.cacheStrategy.value = options.cacheStrategy;
|
|
5427
2672
|
if (options?.cacheLifetime) this.cacheLifetime.value = options.cacheLifetime;
|
|
5428
2673
|
if (options?.refreshOnMutation !== void 0) this.refreshOnMutation.value = options.refreshOnMutation;
|
|
2674
|
+
this.requestProvider.onDataReceived((data) => {
|
|
2675
|
+
if (data) {
|
|
2676
|
+
this.pageData.value = data.rows || data;
|
|
2677
|
+
if (data.rowCount !== void 0) {
|
|
2678
|
+
this.rowCount.value = data.rowCount;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
async refresh(hardRefresh = false) {
|
|
2684
|
+
if (hardRefresh && this.requestProvider.cacheProvider) {
|
|
2685
|
+
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
2686
|
+
}
|
|
2687
|
+
this.loading.value = true;
|
|
2688
|
+
try {
|
|
2689
|
+
await this.loadPageData(hardRefresh ? { disableCache: true } : void 0);
|
|
2690
|
+
} finally {
|
|
2691
|
+
this.loading.value = false;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
async refreshData(options) {
|
|
2695
|
+
await this.refresh(options?.disableCache ?? false);
|
|
5429
2696
|
}
|
|
5430
2697
|
async setAPIUrl(url) {
|
|
5431
2698
|
this.apiUrl.value = url;
|
|
@@ -5467,7 +2734,7 @@ class CAPITreeServerDataProvider extends CTreeServerDataProvider {
|
|
|
5467
2734
|
if (this.requestProvider.cacheProvider) {
|
|
5468
2735
|
await this.requestProvider.cacheProvider.removeByPrefix(this.apiUrl.value);
|
|
5469
2736
|
}
|
|
5470
|
-
this.
|
|
2737
|
+
await this.refresh(true);
|
|
5471
2738
|
}
|
|
5472
2739
|
}
|
|
5473
2740
|
}
|