@vue/server-renderer 3.4.26 → 3.4.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server-renderer.cjs.js +4002 -193
- package/dist/server-renderer.cjs.prod.js +3042 -31
- package/dist/server-renderer.esm-browser.js +521 -512
- package/dist/server-renderer.esm-browser.prod.js +2 -2
- package/dist/server-renderer.esm-bundler.js +4003 -248
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.4.
|
|
2
|
+
* @vue/server-renderer v3.4.28
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -148,13 +148,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
148
148
|
fallbackRenderFn();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const commentTestRE =
|
|
151
|
+
const commentTestRE = /^<!--[\s\S]*-->$/;
|
|
152
152
|
const commentRE = /<!--[^]*?-->/gm;
|
|
153
153
|
function isComment(item) {
|
|
154
|
-
if (typeof item !== "string" || !commentTestRE.test(item))
|
|
155
|
-
|
|
156
|
-
if (item.length <= 8)
|
|
157
|
-
return true;
|
|
154
|
+
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
|
155
|
+
if (item.length <= 8) return true;
|
|
158
156
|
return !item.replace(commentRE, "").trim();
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -182,230 +180,4017 @@ function ssrInterpolate(value) {
|
|
|
182
180
|
return shared.escapeHtml(shared.toDisplayString(value));
|
|
183
181
|
}
|
|
184
182
|
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
return raw ? toRaw(raw) : observed;
|
|
183
|
+
function warn$2(msg, ...args) {
|
|
184
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
188
185
|
}
|
|
189
186
|
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
let activeEffectScope;
|
|
188
|
+
class EffectScope {
|
|
189
|
+
constructor(detached = false) {
|
|
190
|
+
this.detached = detached;
|
|
191
|
+
/**
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
this._active = true;
|
|
195
|
+
/**
|
|
196
|
+
* @internal
|
|
197
|
+
*/
|
|
198
|
+
this.effects = [];
|
|
199
|
+
/**
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
this.cleanups = [];
|
|
203
|
+
this.parent = activeEffectScope;
|
|
204
|
+
if (!detached && activeEffectScope) {
|
|
205
|
+
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
206
|
+
this
|
|
207
|
+
) - 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
get active() {
|
|
211
|
+
return this._active;
|
|
212
|
+
}
|
|
213
|
+
run(fn) {
|
|
214
|
+
if (this._active) {
|
|
215
|
+
const currentEffectScope = activeEffectScope;
|
|
216
|
+
try {
|
|
217
|
+
activeEffectScope = this;
|
|
218
|
+
return fn();
|
|
219
|
+
} finally {
|
|
220
|
+
activeEffectScope = currentEffectScope;
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
warn$2(`cannot run an inactive effect scope.`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* This should only be called on non-detached scopes
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
on() {
|
|
231
|
+
activeEffectScope = this;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* This should only be called on non-detached scopes
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
off() {
|
|
238
|
+
activeEffectScope = this.parent;
|
|
239
|
+
}
|
|
240
|
+
stop(fromParent) {
|
|
241
|
+
if (this._active) {
|
|
242
|
+
let i, l;
|
|
243
|
+
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
244
|
+
this.effects[i].stop();
|
|
245
|
+
}
|
|
246
|
+
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
|
247
|
+
this.cleanups[i]();
|
|
248
|
+
}
|
|
249
|
+
if (this.scopes) {
|
|
250
|
+
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
251
|
+
this.scopes[i].stop(true);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
255
|
+
const last = this.parent.scopes.pop();
|
|
256
|
+
if (last && last !== this) {
|
|
257
|
+
this.parent.scopes[this.index] = last;
|
|
258
|
+
last.index = this.index;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
this.parent = void 0;
|
|
262
|
+
this._active = false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
267
|
+
if (scope && scope.active) {
|
|
268
|
+
scope.effects.push(effect);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function getCurrentScope() {
|
|
272
|
+
return activeEffectScope;
|
|
192
273
|
}
|
|
193
274
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
275
|
+
let activeEffect;
|
|
276
|
+
class ReactiveEffect {
|
|
277
|
+
constructor(fn, trigger, scheduler, scope) {
|
|
278
|
+
this.fn = fn;
|
|
279
|
+
this.trigger = trigger;
|
|
280
|
+
this.scheduler = scheduler;
|
|
281
|
+
this.active = true;
|
|
282
|
+
this.deps = [];
|
|
283
|
+
/**
|
|
284
|
+
* @internal
|
|
285
|
+
*/
|
|
286
|
+
this._dirtyLevel = 4;
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
this._trackId = 0;
|
|
291
|
+
/**
|
|
292
|
+
* @internal
|
|
293
|
+
*/
|
|
294
|
+
this._runnings = 0;
|
|
295
|
+
/**
|
|
296
|
+
* @internal
|
|
297
|
+
*/
|
|
298
|
+
this._shouldSchedule = false;
|
|
299
|
+
/**
|
|
300
|
+
* @internal
|
|
301
|
+
*/
|
|
302
|
+
this._depsLength = 0;
|
|
303
|
+
recordEffectScope(this, scope);
|
|
304
|
+
}
|
|
305
|
+
get dirty() {
|
|
306
|
+
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
307
|
+
this._dirtyLevel = 1;
|
|
308
|
+
pauseTracking();
|
|
309
|
+
for (let i = 0; i < this._depsLength; i++) {
|
|
310
|
+
const dep = this.deps[i];
|
|
311
|
+
if (dep.computed) {
|
|
312
|
+
triggerComputed(dep.computed);
|
|
313
|
+
if (this._dirtyLevel >= 4) {
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (this._dirtyLevel === 1) {
|
|
319
|
+
this._dirtyLevel = 0;
|
|
320
|
+
}
|
|
321
|
+
resetTracking();
|
|
322
|
+
}
|
|
323
|
+
return this._dirtyLevel >= 4;
|
|
324
|
+
}
|
|
325
|
+
set dirty(v) {
|
|
326
|
+
this._dirtyLevel = v ? 4 : 0;
|
|
327
|
+
}
|
|
328
|
+
run() {
|
|
329
|
+
this._dirtyLevel = 0;
|
|
330
|
+
if (!this.active) {
|
|
331
|
+
return this.fn();
|
|
332
|
+
}
|
|
333
|
+
let lastShouldTrack = shouldTrack;
|
|
334
|
+
let lastEffect = activeEffect;
|
|
335
|
+
try {
|
|
336
|
+
shouldTrack = true;
|
|
337
|
+
activeEffect = this;
|
|
338
|
+
this._runnings++;
|
|
339
|
+
preCleanupEffect(this);
|
|
340
|
+
return this.fn();
|
|
341
|
+
} finally {
|
|
342
|
+
postCleanupEffect(this);
|
|
343
|
+
this._runnings--;
|
|
344
|
+
activeEffect = lastEffect;
|
|
345
|
+
shouldTrack = lastShouldTrack;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
stop() {
|
|
349
|
+
if (this.active) {
|
|
350
|
+
preCleanupEffect(this);
|
|
351
|
+
postCleanupEffect(this);
|
|
352
|
+
this.onStop && this.onStop();
|
|
353
|
+
this.active = false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
197
356
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
357
|
+
function triggerComputed(computed) {
|
|
358
|
+
return computed.value;
|
|
200
359
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
360
|
+
function preCleanupEffect(effect2) {
|
|
361
|
+
effect2._trackId++;
|
|
362
|
+
effect2._depsLength = 0;
|
|
363
|
+
}
|
|
364
|
+
function postCleanupEffect(effect2) {
|
|
365
|
+
if (effect2.deps.length > effect2._depsLength) {
|
|
366
|
+
for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
|
367
|
+
cleanupDepEffect(effect2.deps[i], effect2);
|
|
368
|
+
}
|
|
369
|
+
effect2.deps.length = effect2._depsLength;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function cleanupDepEffect(dep, effect2) {
|
|
373
|
+
const trackId = dep.get(effect2);
|
|
374
|
+
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
|
375
|
+
dep.delete(effect2);
|
|
376
|
+
if (dep.size === 0) {
|
|
377
|
+
dep.cleanup();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
let shouldTrack = true;
|
|
382
|
+
let pauseScheduleStack = 0;
|
|
383
|
+
const trackStack = [];
|
|
384
|
+
function pauseTracking() {
|
|
385
|
+
trackStack.push(shouldTrack);
|
|
386
|
+
shouldTrack = false;
|
|
387
|
+
}
|
|
388
|
+
function resetTracking() {
|
|
389
|
+
const last = trackStack.pop();
|
|
390
|
+
shouldTrack = last === void 0 ? true : last;
|
|
391
|
+
}
|
|
392
|
+
function pauseScheduling() {
|
|
393
|
+
pauseScheduleStack++;
|
|
394
|
+
}
|
|
395
|
+
function resetScheduling() {
|
|
396
|
+
pauseScheduleStack--;
|
|
397
|
+
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
|
398
|
+
queueEffectSchedulers.shift()();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
402
|
+
var _a;
|
|
403
|
+
if (dep.get(effect2) !== effect2._trackId) {
|
|
404
|
+
dep.set(effect2, effect2._trackId);
|
|
405
|
+
const oldDep = effect2.deps[effect2._depsLength];
|
|
406
|
+
if (oldDep !== dep) {
|
|
407
|
+
if (oldDep) {
|
|
408
|
+
cleanupDepEffect(oldDep, effect2);
|
|
409
|
+
}
|
|
410
|
+
effect2.deps[effect2._depsLength++] = dep;
|
|
411
|
+
} else {
|
|
412
|
+
effect2._depsLength++;
|
|
413
|
+
}
|
|
414
|
+
{
|
|
415
|
+
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, shared.extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const queueEffectSchedulers = [];
|
|
420
|
+
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
|
421
|
+
var _a;
|
|
422
|
+
pauseScheduling();
|
|
423
|
+
for (const effect2 of dep.keys()) {
|
|
424
|
+
let tracking;
|
|
425
|
+
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
|
426
|
+
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
|
|
427
|
+
effect2._dirtyLevel = dirtyLevel;
|
|
428
|
+
}
|
|
429
|
+
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
|
430
|
+
{
|
|
431
|
+
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, shared.extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
432
|
+
}
|
|
433
|
+
effect2.trigger();
|
|
434
|
+
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
|
|
435
|
+
effect2._shouldSchedule = false;
|
|
436
|
+
if (effect2.scheduler) {
|
|
437
|
+
queueEffectSchedulers.push(effect2.scheduler);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
resetScheduling();
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const createDep = (cleanup, computed) => {
|
|
446
|
+
const dep = /* @__PURE__ */ new Map();
|
|
447
|
+
dep.cleanup = cleanup;
|
|
448
|
+
dep.computed = computed;
|
|
449
|
+
return dep;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
453
|
+
const ITERATE_KEY = Symbol("iterate" );
|
|
454
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
455
|
+
function track(target, type, key) {
|
|
456
|
+
if (shouldTrack && activeEffect) {
|
|
457
|
+
let depsMap = targetMap.get(target);
|
|
458
|
+
if (!depsMap) {
|
|
459
|
+
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
460
|
+
}
|
|
461
|
+
let dep = depsMap.get(key);
|
|
462
|
+
if (!dep) {
|
|
463
|
+
depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
|
464
|
+
}
|
|
465
|
+
trackEffect(
|
|
466
|
+
activeEffect,
|
|
467
|
+
dep,
|
|
468
|
+
{
|
|
469
|
+
target,
|
|
470
|
+
type,
|
|
471
|
+
key
|
|
472
|
+
}
|
|
221
473
|
);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
477
|
+
const depsMap = targetMap.get(target);
|
|
478
|
+
if (!depsMap) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
let deps = [];
|
|
482
|
+
if (type === "clear") {
|
|
483
|
+
deps = [...depsMap.values()];
|
|
484
|
+
} else if (key === "length" && shared.isArray(target)) {
|
|
485
|
+
const newLength = Number(newValue);
|
|
486
|
+
depsMap.forEach((dep, key2) => {
|
|
487
|
+
if (key2 === "length" || !shared.isSymbol(key2) && key2 >= newLength) {
|
|
488
|
+
deps.push(dep);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
222
491
|
} else {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
492
|
+
if (key !== void 0) {
|
|
493
|
+
deps.push(depsMap.get(key));
|
|
494
|
+
}
|
|
495
|
+
switch (type) {
|
|
496
|
+
case "add":
|
|
497
|
+
if (!shared.isArray(target)) {
|
|
498
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
499
|
+
if (shared.isMap(target)) {
|
|
500
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
501
|
+
}
|
|
502
|
+
} else if (shared.isIntegerKey(key)) {
|
|
503
|
+
deps.push(depsMap.get("length"));
|
|
504
|
+
}
|
|
505
|
+
break;
|
|
506
|
+
case "delete":
|
|
507
|
+
if (!shared.isArray(target)) {
|
|
508
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
509
|
+
if (shared.isMap(target)) {
|
|
510
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
break;
|
|
514
|
+
case "set":
|
|
515
|
+
if (shared.isMap(target)) {
|
|
516
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
517
|
+
}
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
pauseScheduling();
|
|
522
|
+
for (const dep of deps) {
|
|
523
|
+
if (dep) {
|
|
524
|
+
triggerEffects(
|
|
525
|
+
dep,
|
|
526
|
+
4,
|
|
527
|
+
{
|
|
528
|
+
target,
|
|
529
|
+
type,
|
|
530
|
+
key,
|
|
531
|
+
newValue,
|
|
532
|
+
oldValue,
|
|
533
|
+
oldTarget
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
resetScheduling();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
|
|
542
|
+
const builtInSymbols = new Set(
|
|
543
|
+
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
|
|
544
|
+
);
|
|
545
|
+
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
546
|
+
function createArrayInstrumentations() {
|
|
547
|
+
const instrumentations = {};
|
|
548
|
+
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
549
|
+
instrumentations[key] = function(...args) {
|
|
550
|
+
const arr = toRaw(this);
|
|
551
|
+
for (let i = 0, l = this.length; i < l; i++) {
|
|
552
|
+
track(arr, "get", i + "");
|
|
553
|
+
}
|
|
554
|
+
const res = arr[key](...args);
|
|
555
|
+
if (res === -1 || res === false) {
|
|
556
|
+
return arr[key](...args.map(toRaw));
|
|
557
|
+
} else {
|
|
558
|
+
return res;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
});
|
|
562
|
+
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
563
|
+
instrumentations[key] = function(...args) {
|
|
564
|
+
pauseTracking();
|
|
565
|
+
pauseScheduling();
|
|
566
|
+
const res = toRaw(this)[key].apply(this, args);
|
|
567
|
+
resetScheduling();
|
|
568
|
+
resetTracking();
|
|
569
|
+
return res;
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
return instrumentations;
|
|
573
|
+
}
|
|
574
|
+
function hasOwnProperty(key) {
|
|
575
|
+
if (!shared.isSymbol(key)) key = String(key);
|
|
576
|
+
const obj = toRaw(this);
|
|
577
|
+
track(obj, "has", key);
|
|
578
|
+
return obj.hasOwnProperty(key);
|
|
579
|
+
}
|
|
580
|
+
class BaseReactiveHandler {
|
|
581
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
582
|
+
this._isReadonly = _isReadonly;
|
|
583
|
+
this._isShallow = _isShallow;
|
|
584
|
+
}
|
|
585
|
+
get(target, key, receiver) {
|
|
586
|
+
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
587
|
+
if (key === "__v_isReactive") {
|
|
588
|
+
return !isReadonly2;
|
|
589
|
+
} else if (key === "__v_isReadonly") {
|
|
590
|
+
return isReadonly2;
|
|
591
|
+
} else if (key === "__v_isShallow") {
|
|
592
|
+
return isShallow2;
|
|
593
|
+
} else if (key === "__v_raw") {
|
|
594
|
+
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
595
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
596
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
597
|
+
return target;
|
|
598
|
+
}
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const targetIsArray = shared.isArray(target);
|
|
602
|
+
if (!isReadonly2) {
|
|
603
|
+
if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
|
|
604
|
+
return Reflect.get(arrayInstrumentations, key, receiver);
|
|
605
|
+
}
|
|
606
|
+
if (key === "hasOwnProperty") {
|
|
607
|
+
return hasOwnProperty;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
const res = Reflect.get(target, key, receiver);
|
|
611
|
+
if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
612
|
+
return res;
|
|
613
|
+
}
|
|
614
|
+
if (!isReadonly2) {
|
|
615
|
+
track(target, "get", key);
|
|
616
|
+
}
|
|
617
|
+
if (isShallow2) {
|
|
618
|
+
return res;
|
|
619
|
+
}
|
|
620
|
+
if (isRef(res)) {
|
|
621
|
+
return targetIsArray && shared.isIntegerKey(key) ? res : res.value;
|
|
622
|
+
}
|
|
623
|
+
if (shared.isObject(res)) {
|
|
624
|
+
return isReadonly2 ? readonly(res) : reactive(res);
|
|
625
|
+
}
|
|
626
|
+
return res;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
630
|
+
constructor(isShallow2 = false) {
|
|
631
|
+
super(false, isShallow2);
|
|
632
|
+
}
|
|
633
|
+
set(target, key, value, receiver) {
|
|
634
|
+
let oldValue = target[key];
|
|
635
|
+
if (!this._isShallow) {
|
|
636
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
637
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
638
|
+
oldValue = toRaw(oldValue);
|
|
639
|
+
value = toRaw(value);
|
|
640
|
+
}
|
|
641
|
+
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
642
|
+
if (isOldValueReadonly) {
|
|
643
|
+
return false;
|
|
644
|
+
} else {
|
|
645
|
+
oldValue.value = value;
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
651
|
+
const result = Reflect.set(target, key, value, receiver);
|
|
652
|
+
if (target === toRaw(receiver)) {
|
|
653
|
+
if (!hadKey) {
|
|
654
|
+
trigger(target, "add", key, value);
|
|
655
|
+
} else if (shared.hasChanged(value, oldValue)) {
|
|
656
|
+
trigger(target, "set", key, value, oldValue);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return result;
|
|
660
|
+
}
|
|
661
|
+
deleteProperty(target, key) {
|
|
662
|
+
const hadKey = shared.hasOwn(target, key);
|
|
663
|
+
const oldValue = target[key];
|
|
664
|
+
const result = Reflect.deleteProperty(target, key);
|
|
665
|
+
if (result && hadKey) {
|
|
666
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
667
|
+
}
|
|
668
|
+
return result;
|
|
669
|
+
}
|
|
670
|
+
has(target, key) {
|
|
671
|
+
const result = Reflect.has(target, key);
|
|
672
|
+
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
|
673
|
+
track(target, "has", key);
|
|
674
|
+
}
|
|
675
|
+
return result;
|
|
676
|
+
}
|
|
677
|
+
ownKeys(target) {
|
|
678
|
+
track(
|
|
679
|
+
target,
|
|
680
|
+
"iterate",
|
|
681
|
+
shared.isArray(target) ? "length" : ITERATE_KEY
|
|
682
|
+
);
|
|
683
|
+
return Reflect.ownKeys(target);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
687
|
+
constructor(isShallow2 = false) {
|
|
688
|
+
super(true, isShallow2);
|
|
689
|
+
}
|
|
690
|
+
set(target, key) {
|
|
691
|
+
{
|
|
692
|
+
warn$2(
|
|
693
|
+
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
694
|
+
target
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
return true;
|
|
698
|
+
}
|
|
699
|
+
deleteProperty(target, key) {
|
|
700
|
+
{
|
|
701
|
+
warn$2(
|
|
702
|
+
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
703
|
+
target
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
710
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
711
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
712
|
+
true
|
|
713
|
+
);
|
|
714
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
715
|
+
|
|
716
|
+
const toShallow = (value) => value;
|
|
717
|
+
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
718
|
+
function get(target, key, isReadonly = false, isShallow = false) {
|
|
719
|
+
target = target["__v_raw"];
|
|
720
|
+
const rawTarget = toRaw(target);
|
|
721
|
+
const rawKey = toRaw(key);
|
|
722
|
+
if (!isReadonly) {
|
|
723
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
724
|
+
track(rawTarget, "get", key);
|
|
725
|
+
}
|
|
726
|
+
track(rawTarget, "get", rawKey);
|
|
727
|
+
}
|
|
728
|
+
const { has: has2 } = getProto(rawTarget);
|
|
729
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
730
|
+
if (has2.call(rawTarget, key)) {
|
|
731
|
+
return wrap(target.get(key));
|
|
732
|
+
} else if (has2.call(rawTarget, rawKey)) {
|
|
733
|
+
return wrap(target.get(rawKey));
|
|
734
|
+
} else if (target !== rawTarget) {
|
|
735
|
+
target.get(key);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
function has(key, isReadonly = false) {
|
|
739
|
+
const target = this["__v_raw"];
|
|
740
|
+
const rawTarget = toRaw(target);
|
|
741
|
+
const rawKey = toRaw(key);
|
|
742
|
+
if (!isReadonly) {
|
|
743
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
744
|
+
track(rawTarget, "has", key);
|
|
745
|
+
}
|
|
746
|
+
track(rawTarget, "has", rawKey);
|
|
747
|
+
}
|
|
748
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
749
|
+
}
|
|
750
|
+
function size(target, isReadonly = false) {
|
|
751
|
+
target = target["__v_raw"];
|
|
752
|
+
!isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
|
753
|
+
return Reflect.get(target, "size", target);
|
|
754
|
+
}
|
|
755
|
+
function add(value) {
|
|
756
|
+
value = toRaw(value);
|
|
757
|
+
const target = toRaw(this);
|
|
758
|
+
const proto = getProto(target);
|
|
759
|
+
const hadKey = proto.has.call(target, value);
|
|
760
|
+
if (!hadKey) {
|
|
761
|
+
target.add(value);
|
|
762
|
+
trigger(target, "add", value, value);
|
|
763
|
+
}
|
|
764
|
+
return this;
|
|
765
|
+
}
|
|
766
|
+
function set(key, value) {
|
|
767
|
+
value = toRaw(value);
|
|
768
|
+
const target = toRaw(this);
|
|
769
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
770
|
+
let hadKey = has2.call(target, key);
|
|
771
|
+
if (!hadKey) {
|
|
772
|
+
key = toRaw(key);
|
|
773
|
+
hadKey = has2.call(target, key);
|
|
774
|
+
} else {
|
|
775
|
+
checkIdentityKeys(target, has2, key);
|
|
776
|
+
}
|
|
777
|
+
const oldValue = get2.call(target, key);
|
|
778
|
+
target.set(key, value);
|
|
779
|
+
if (!hadKey) {
|
|
780
|
+
trigger(target, "add", key, value);
|
|
781
|
+
} else if (shared.hasChanged(value, oldValue)) {
|
|
782
|
+
trigger(target, "set", key, value, oldValue);
|
|
783
|
+
}
|
|
784
|
+
return this;
|
|
785
|
+
}
|
|
786
|
+
function deleteEntry(key) {
|
|
787
|
+
const target = toRaw(this);
|
|
788
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
789
|
+
let hadKey = has2.call(target, key);
|
|
790
|
+
if (!hadKey) {
|
|
791
|
+
key = toRaw(key);
|
|
792
|
+
hadKey = has2.call(target, key);
|
|
793
|
+
} else {
|
|
794
|
+
checkIdentityKeys(target, has2, key);
|
|
795
|
+
}
|
|
796
|
+
const oldValue = get2 ? get2.call(target, key) : void 0;
|
|
797
|
+
const result = target.delete(key);
|
|
798
|
+
if (hadKey) {
|
|
799
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
800
|
+
}
|
|
801
|
+
return result;
|
|
802
|
+
}
|
|
803
|
+
function clear() {
|
|
804
|
+
const target = toRaw(this);
|
|
805
|
+
const hadItems = target.size !== 0;
|
|
806
|
+
const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target) ;
|
|
807
|
+
const result = target.clear();
|
|
808
|
+
if (hadItems) {
|
|
809
|
+
trigger(target, "clear", void 0, void 0, oldTarget);
|
|
810
|
+
}
|
|
811
|
+
return result;
|
|
812
|
+
}
|
|
813
|
+
function createForEach(isReadonly, isShallow) {
|
|
814
|
+
return function forEach(callback, thisArg) {
|
|
815
|
+
const observed = this;
|
|
816
|
+
const target = observed["__v_raw"];
|
|
817
|
+
const rawTarget = toRaw(target);
|
|
818
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
819
|
+
!isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
820
|
+
return target.forEach((value, key) => {
|
|
821
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function createIterableMethod(method, isReadonly, isShallow) {
|
|
826
|
+
return function(...args) {
|
|
827
|
+
const target = this["__v_raw"];
|
|
828
|
+
const rawTarget = toRaw(target);
|
|
829
|
+
const targetIsMap = shared.isMap(rawTarget);
|
|
830
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
831
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
832
|
+
const innerIterator = target[method](...args);
|
|
833
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
834
|
+
!isReadonly && track(
|
|
835
|
+
rawTarget,
|
|
836
|
+
"iterate",
|
|
837
|
+
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
|
838
|
+
);
|
|
839
|
+
return {
|
|
840
|
+
// iterator protocol
|
|
841
|
+
next() {
|
|
842
|
+
const { value, done } = innerIterator.next();
|
|
843
|
+
return done ? { value, done } : {
|
|
844
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
845
|
+
done
|
|
846
|
+
};
|
|
847
|
+
},
|
|
848
|
+
// iterable protocol
|
|
849
|
+
[Symbol.iterator]() {
|
|
850
|
+
return this;
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function createReadonlyMethod(type) {
|
|
856
|
+
return function(...args) {
|
|
857
|
+
{
|
|
858
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
859
|
+
warn$2(
|
|
860
|
+
`${shared.capitalize(type)} operation ${key}failed: target is readonly.`,
|
|
861
|
+
toRaw(this)
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
function createInstrumentations() {
|
|
868
|
+
const mutableInstrumentations2 = {
|
|
869
|
+
get(key) {
|
|
870
|
+
return get(this, key);
|
|
871
|
+
},
|
|
872
|
+
get size() {
|
|
873
|
+
return size(this);
|
|
874
|
+
},
|
|
875
|
+
has,
|
|
876
|
+
add,
|
|
877
|
+
set,
|
|
878
|
+
delete: deleteEntry,
|
|
879
|
+
clear,
|
|
880
|
+
forEach: createForEach(false, false)
|
|
881
|
+
};
|
|
882
|
+
const shallowInstrumentations2 = {
|
|
883
|
+
get(key) {
|
|
884
|
+
return get(this, key, false, true);
|
|
885
|
+
},
|
|
886
|
+
get size() {
|
|
887
|
+
return size(this);
|
|
888
|
+
},
|
|
889
|
+
has,
|
|
890
|
+
add,
|
|
891
|
+
set,
|
|
892
|
+
delete: deleteEntry,
|
|
893
|
+
clear,
|
|
894
|
+
forEach: createForEach(false, true)
|
|
895
|
+
};
|
|
896
|
+
const readonlyInstrumentations2 = {
|
|
897
|
+
get(key) {
|
|
898
|
+
return get(this, key, true);
|
|
899
|
+
},
|
|
900
|
+
get size() {
|
|
901
|
+
return size(this, true);
|
|
902
|
+
},
|
|
903
|
+
has(key) {
|
|
904
|
+
return has.call(this, key, true);
|
|
905
|
+
},
|
|
906
|
+
add: createReadonlyMethod("add"),
|
|
907
|
+
set: createReadonlyMethod("set"),
|
|
908
|
+
delete: createReadonlyMethod("delete"),
|
|
909
|
+
clear: createReadonlyMethod("clear"),
|
|
910
|
+
forEach: createForEach(true, false)
|
|
911
|
+
};
|
|
912
|
+
const shallowReadonlyInstrumentations2 = {
|
|
913
|
+
get(key) {
|
|
914
|
+
return get(this, key, true, true);
|
|
915
|
+
},
|
|
916
|
+
get size() {
|
|
917
|
+
return size(this, true);
|
|
918
|
+
},
|
|
919
|
+
has(key) {
|
|
920
|
+
return has.call(this, key, true);
|
|
921
|
+
},
|
|
922
|
+
add: createReadonlyMethod("add"),
|
|
923
|
+
set: createReadonlyMethod("set"),
|
|
924
|
+
delete: createReadonlyMethod("delete"),
|
|
925
|
+
clear: createReadonlyMethod("clear"),
|
|
926
|
+
forEach: createForEach(true, true)
|
|
927
|
+
};
|
|
928
|
+
const iteratorMethods = [
|
|
929
|
+
"keys",
|
|
930
|
+
"values",
|
|
931
|
+
"entries",
|
|
932
|
+
Symbol.iterator
|
|
933
|
+
];
|
|
934
|
+
iteratorMethods.forEach((method) => {
|
|
935
|
+
mutableInstrumentations2[method] = createIterableMethod(method, false, false);
|
|
936
|
+
readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
|
|
937
|
+
shallowInstrumentations2[method] = createIterableMethod(method, false, true);
|
|
938
|
+
shallowReadonlyInstrumentations2[method] = createIterableMethod(
|
|
939
|
+
method,
|
|
940
|
+
true,
|
|
941
|
+
true
|
|
942
|
+
);
|
|
943
|
+
});
|
|
944
|
+
return [
|
|
945
|
+
mutableInstrumentations2,
|
|
946
|
+
readonlyInstrumentations2,
|
|
947
|
+
shallowInstrumentations2,
|
|
948
|
+
shallowReadonlyInstrumentations2
|
|
949
|
+
];
|
|
950
|
+
}
|
|
951
|
+
const [
|
|
952
|
+
mutableInstrumentations,
|
|
953
|
+
readonlyInstrumentations,
|
|
954
|
+
shallowInstrumentations,
|
|
955
|
+
shallowReadonlyInstrumentations
|
|
956
|
+
] = /* @__PURE__ */ createInstrumentations();
|
|
957
|
+
function createInstrumentationGetter(isReadonly, shallow) {
|
|
958
|
+
const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
|
|
959
|
+
return (target, key, receiver) => {
|
|
960
|
+
if (key === "__v_isReactive") {
|
|
961
|
+
return !isReadonly;
|
|
962
|
+
} else if (key === "__v_isReadonly") {
|
|
963
|
+
return isReadonly;
|
|
964
|
+
} else if (key === "__v_raw") {
|
|
965
|
+
return target;
|
|
966
|
+
}
|
|
967
|
+
return Reflect.get(
|
|
968
|
+
shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
969
|
+
key,
|
|
970
|
+
receiver
|
|
971
|
+
);
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
const mutableCollectionHandlers = {
|
|
975
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
976
|
+
};
|
|
977
|
+
const shallowCollectionHandlers = {
|
|
978
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
979
|
+
};
|
|
980
|
+
const readonlyCollectionHandlers = {
|
|
981
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
982
|
+
};
|
|
983
|
+
const shallowReadonlyCollectionHandlers = {
|
|
984
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
985
|
+
};
|
|
986
|
+
function checkIdentityKeys(target, has2, key) {
|
|
987
|
+
const rawKey = toRaw(key);
|
|
988
|
+
if (rawKey !== key && has2.call(target, rawKey)) {
|
|
989
|
+
const type = shared.toRawType(target);
|
|
990
|
+
warn$2(
|
|
991
|
+
`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.`
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
997
|
+
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
998
|
+
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
999
|
+
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1000
|
+
function targetTypeMap(rawType) {
|
|
1001
|
+
switch (rawType) {
|
|
1002
|
+
case "Object":
|
|
1003
|
+
case "Array":
|
|
1004
|
+
return 1 /* COMMON */;
|
|
1005
|
+
case "Map":
|
|
1006
|
+
case "Set":
|
|
1007
|
+
case "WeakMap":
|
|
1008
|
+
case "WeakSet":
|
|
1009
|
+
return 2 /* COLLECTION */;
|
|
1010
|
+
default:
|
|
1011
|
+
return 0 /* INVALID */;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function getTargetType(value) {
|
|
1015
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value));
|
|
1016
|
+
}
|
|
1017
|
+
function reactive(target) {
|
|
1018
|
+
if (isReadonly(target)) {
|
|
1019
|
+
return target;
|
|
1020
|
+
}
|
|
1021
|
+
return createReactiveObject(
|
|
1022
|
+
target,
|
|
1023
|
+
false,
|
|
1024
|
+
mutableHandlers,
|
|
1025
|
+
mutableCollectionHandlers,
|
|
1026
|
+
reactiveMap
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
function shallowReactive(target) {
|
|
1030
|
+
return createReactiveObject(
|
|
1031
|
+
target,
|
|
1032
|
+
false,
|
|
1033
|
+
shallowReactiveHandlers,
|
|
1034
|
+
shallowCollectionHandlers,
|
|
1035
|
+
shallowReactiveMap
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
function readonly(target) {
|
|
1039
|
+
return createReactiveObject(
|
|
1040
|
+
target,
|
|
1041
|
+
true,
|
|
1042
|
+
readonlyHandlers,
|
|
1043
|
+
readonlyCollectionHandlers,
|
|
1044
|
+
readonlyMap
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
function shallowReadonly(target) {
|
|
1048
|
+
return createReactiveObject(
|
|
1049
|
+
target,
|
|
1050
|
+
true,
|
|
1051
|
+
shallowReadonlyHandlers,
|
|
1052
|
+
shallowReadonlyCollectionHandlers,
|
|
1053
|
+
shallowReadonlyMap
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1057
|
+
if (!shared.isObject(target)) {
|
|
1058
|
+
{
|
|
1059
|
+
warn$2(
|
|
1060
|
+
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
|
|
1061
|
+
target
|
|
1062
|
+
)}`
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
return target;
|
|
1066
|
+
}
|
|
1067
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1068
|
+
return target;
|
|
1069
|
+
}
|
|
1070
|
+
const existingProxy = proxyMap.get(target);
|
|
1071
|
+
if (existingProxy) {
|
|
1072
|
+
return existingProxy;
|
|
1073
|
+
}
|
|
1074
|
+
const targetType = getTargetType(target);
|
|
1075
|
+
if (targetType === 0 /* INVALID */) {
|
|
1076
|
+
return target;
|
|
1077
|
+
}
|
|
1078
|
+
const proxy = new Proxy(
|
|
1079
|
+
target,
|
|
1080
|
+
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
1081
|
+
);
|
|
1082
|
+
proxyMap.set(target, proxy);
|
|
1083
|
+
return proxy;
|
|
1084
|
+
}
|
|
1085
|
+
function isReactive(value) {
|
|
1086
|
+
if (isReadonly(value)) {
|
|
1087
|
+
return isReactive(value["__v_raw"]);
|
|
1088
|
+
}
|
|
1089
|
+
return !!(value && value["__v_isReactive"]);
|
|
1090
|
+
}
|
|
1091
|
+
function isReadonly(value) {
|
|
1092
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1093
|
+
}
|
|
1094
|
+
function isShallow(value) {
|
|
1095
|
+
return !!(value && value["__v_isShallow"]);
|
|
1096
|
+
}
|
|
1097
|
+
function isProxy(value) {
|
|
1098
|
+
return value ? !!value["__v_raw"] : false;
|
|
1099
|
+
}
|
|
1100
|
+
function toRaw(observed) {
|
|
1101
|
+
const raw = observed && observed["__v_raw"];
|
|
1102
|
+
return raw ? toRaw(raw) : observed;
|
|
1103
|
+
}
|
|
1104
|
+
function markRaw(value) {
|
|
1105
|
+
if (Object.isExtensible(value)) {
|
|
1106
|
+
shared.def(value, "__v_skip", true);
|
|
1107
|
+
}
|
|
1108
|
+
return value;
|
|
1109
|
+
}
|
|
1110
|
+
const toReactive = (value) => shared.isObject(value) ? reactive(value) : value;
|
|
1111
|
+
const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
|
|
1112
|
+
|
|
1113
|
+
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
|
|
1114
|
+
class ComputedRefImpl {
|
|
1115
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1116
|
+
this.getter = getter;
|
|
1117
|
+
this._setter = _setter;
|
|
1118
|
+
this.dep = void 0;
|
|
1119
|
+
this.__v_isRef = true;
|
|
1120
|
+
this["__v_isReadonly"] = false;
|
|
1121
|
+
this.effect = new ReactiveEffect(
|
|
1122
|
+
() => getter(this._value),
|
|
1123
|
+
() => triggerRefValue(
|
|
1124
|
+
this,
|
|
1125
|
+
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1126
|
+
)
|
|
1127
|
+
);
|
|
1128
|
+
this.effect.computed = this;
|
|
1129
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1130
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1131
|
+
}
|
|
1132
|
+
get value() {
|
|
1133
|
+
const self = toRaw(this);
|
|
1134
|
+
if ((!self._cacheable || self.effect.dirty) && shared.hasChanged(self._value, self._value = self.effect.run())) {
|
|
1135
|
+
triggerRefValue(self, 4);
|
|
1136
|
+
}
|
|
1137
|
+
trackRefValue(self);
|
|
1138
|
+
if (self.effect._dirtyLevel >= 2) {
|
|
1139
|
+
if (this._warnRecursive) {
|
|
1140
|
+
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1141
|
+
|
|
1142
|
+
getter: `, this.getter);
|
|
1143
|
+
}
|
|
1144
|
+
triggerRefValue(self, 2);
|
|
1145
|
+
}
|
|
1146
|
+
return self._value;
|
|
1147
|
+
}
|
|
1148
|
+
set value(newValue) {
|
|
1149
|
+
this._setter(newValue);
|
|
1150
|
+
}
|
|
1151
|
+
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1152
|
+
get _dirty() {
|
|
1153
|
+
return this.effect.dirty;
|
|
1154
|
+
}
|
|
1155
|
+
set _dirty(v) {
|
|
1156
|
+
this.effect.dirty = v;
|
|
1157
|
+
}
|
|
1158
|
+
// #endregion
|
|
1159
|
+
}
|
|
1160
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1161
|
+
let getter;
|
|
1162
|
+
let setter;
|
|
1163
|
+
const onlyGetter = shared.isFunction(getterOrOptions);
|
|
1164
|
+
if (onlyGetter) {
|
|
1165
|
+
getter = getterOrOptions;
|
|
1166
|
+
setter = () => {
|
|
1167
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1168
|
+
} ;
|
|
1169
|
+
} else {
|
|
1170
|
+
getter = getterOrOptions.get;
|
|
1171
|
+
setter = getterOrOptions.set;
|
|
1172
|
+
}
|
|
1173
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1174
|
+
return cRef;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
function trackRefValue(ref2) {
|
|
1178
|
+
var _a;
|
|
1179
|
+
if (shouldTrack && activeEffect) {
|
|
1180
|
+
ref2 = toRaw(ref2);
|
|
1181
|
+
trackEffect(
|
|
1182
|
+
activeEffect,
|
|
1183
|
+
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1184
|
+
() => ref2.dep = void 0,
|
|
1185
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1186
|
+
),
|
|
1187
|
+
{
|
|
1188
|
+
target: ref2,
|
|
1189
|
+
type: "get",
|
|
1190
|
+
key: "value"
|
|
1191
|
+
}
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
|
|
1196
|
+
ref2 = toRaw(ref2);
|
|
1197
|
+
const dep = ref2.dep;
|
|
1198
|
+
if (dep) {
|
|
1199
|
+
triggerEffects(
|
|
1200
|
+
dep,
|
|
1201
|
+
dirtyLevel,
|
|
1202
|
+
{
|
|
1203
|
+
target: ref2,
|
|
1204
|
+
type: "set",
|
|
1205
|
+
key: "value",
|
|
1206
|
+
newValue: newVal,
|
|
1207
|
+
oldValue: oldVal
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
function isRef(r) {
|
|
1213
|
+
return !!(r && r.__v_isRef === true);
|
|
1214
|
+
}
|
|
1215
|
+
function unref(ref2) {
|
|
1216
|
+
return isRef(ref2) ? ref2.value : ref2;
|
|
1217
|
+
}
|
|
1218
|
+
const shallowUnwrapHandlers = {
|
|
1219
|
+
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
|
1220
|
+
set: (target, key, value, receiver) => {
|
|
1221
|
+
const oldValue = target[key];
|
|
1222
|
+
if (isRef(oldValue) && !isRef(value)) {
|
|
1223
|
+
oldValue.value = value;
|
|
1224
|
+
return true;
|
|
1225
|
+
} else {
|
|
1226
|
+
return Reflect.set(target, key, value, receiver);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
function proxyRefs(objectWithRefs) {
|
|
1231
|
+
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
const stack = [];
|
|
1235
|
+
function pushWarningContext(vnode) {
|
|
1236
|
+
stack.push(vnode);
|
|
1237
|
+
}
|
|
1238
|
+
function popWarningContext() {
|
|
1239
|
+
stack.pop();
|
|
1240
|
+
}
|
|
1241
|
+
function warn$1(msg, ...args) {
|
|
1242
|
+
pauseTracking();
|
|
1243
|
+
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1244
|
+
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1245
|
+
const trace = getComponentTrace();
|
|
1246
|
+
if (appWarnHandler) {
|
|
1247
|
+
callWithErrorHandling(
|
|
1248
|
+
appWarnHandler,
|
|
1249
|
+
instance,
|
|
1250
|
+
11,
|
|
1251
|
+
[
|
|
1252
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
1253
|
+
msg + args.map((a) => {
|
|
1254
|
+
var _a, _b;
|
|
1255
|
+
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
1256
|
+
}).join(""),
|
|
1257
|
+
instance && instance.proxy,
|
|
1258
|
+
trace.map(
|
|
1259
|
+
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
|
1260
|
+
).join("\n"),
|
|
1261
|
+
trace
|
|
1262
|
+
]
|
|
1263
|
+
);
|
|
1264
|
+
} else {
|
|
1265
|
+
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1266
|
+
if (trace.length && // avoid spamming console during tests
|
|
1267
|
+
true) {
|
|
1268
|
+
warnArgs.push(`
|
|
1269
|
+
`, ...formatTrace(trace));
|
|
1270
|
+
}
|
|
1271
|
+
console.warn(...warnArgs);
|
|
1272
|
+
}
|
|
1273
|
+
resetTracking();
|
|
1274
|
+
}
|
|
1275
|
+
function getComponentTrace() {
|
|
1276
|
+
let currentVNode = stack[stack.length - 1];
|
|
1277
|
+
if (!currentVNode) {
|
|
1278
|
+
return [];
|
|
1279
|
+
}
|
|
1280
|
+
const normalizedStack = [];
|
|
1281
|
+
while (currentVNode) {
|
|
1282
|
+
const last = normalizedStack[0];
|
|
1283
|
+
if (last && last.vnode === currentVNode) {
|
|
1284
|
+
last.recurseCount++;
|
|
1285
|
+
} else {
|
|
1286
|
+
normalizedStack.push({
|
|
1287
|
+
vnode: currentVNode,
|
|
1288
|
+
recurseCount: 0
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
1292
|
+
currentVNode = parentInstance && parentInstance.vnode;
|
|
1293
|
+
}
|
|
1294
|
+
return normalizedStack;
|
|
1295
|
+
}
|
|
1296
|
+
function formatTrace(trace) {
|
|
1297
|
+
const logs = [];
|
|
1298
|
+
trace.forEach((entry, i) => {
|
|
1299
|
+
logs.push(...i === 0 ? [] : [`
|
|
1300
|
+
`], ...formatTraceEntry(entry));
|
|
1301
|
+
});
|
|
1302
|
+
return logs;
|
|
1303
|
+
}
|
|
1304
|
+
function formatTraceEntry({ vnode, recurseCount }) {
|
|
1305
|
+
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
1306
|
+
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
1307
|
+
const open = ` at <${formatComponentName(
|
|
1308
|
+
vnode.component,
|
|
1309
|
+
vnode.type,
|
|
1310
|
+
isRoot
|
|
1311
|
+
)}`;
|
|
1312
|
+
const close = `>` + postfix;
|
|
1313
|
+
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
|
1314
|
+
}
|
|
1315
|
+
function formatProps(props) {
|
|
1316
|
+
const res = [];
|
|
1317
|
+
const keys = Object.keys(props);
|
|
1318
|
+
keys.slice(0, 3).forEach((key) => {
|
|
1319
|
+
res.push(...formatProp(key, props[key]));
|
|
1320
|
+
});
|
|
1321
|
+
if (keys.length > 3) {
|
|
1322
|
+
res.push(` ...`);
|
|
1323
|
+
}
|
|
1324
|
+
return res;
|
|
1325
|
+
}
|
|
1326
|
+
function formatProp(key, value, raw) {
|
|
1327
|
+
if (shared.isString(value)) {
|
|
1328
|
+
value = JSON.stringify(value);
|
|
1329
|
+
return raw ? value : [`${key}=${value}`];
|
|
1330
|
+
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1331
|
+
return raw ? value : [`${key}=${value}`];
|
|
1332
|
+
} else if (isRef(value)) {
|
|
1333
|
+
value = formatProp(key, toRaw(value.value), true);
|
|
1334
|
+
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
1335
|
+
} else if (shared.isFunction(value)) {
|
|
1336
|
+
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
1337
|
+
} else {
|
|
1338
|
+
value = toRaw(value);
|
|
1339
|
+
return raw ? value : [`${key}=`, value];
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
const ErrorTypeStrings = {
|
|
1344
|
+
["sp"]: "serverPrefetch hook",
|
|
1345
|
+
["bc"]: "beforeCreate hook",
|
|
1346
|
+
["c"]: "created hook",
|
|
1347
|
+
["bm"]: "beforeMount hook",
|
|
1348
|
+
["m"]: "mounted hook",
|
|
1349
|
+
["bu"]: "beforeUpdate hook",
|
|
1350
|
+
["u"]: "updated",
|
|
1351
|
+
["bum"]: "beforeUnmount hook",
|
|
1352
|
+
["um"]: "unmounted hook",
|
|
1353
|
+
["a"]: "activated hook",
|
|
1354
|
+
["da"]: "deactivated hook",
|
|
1355
|
+
["ec"]: "errorCaptured hook",
|
|
1356
|
+
["rtc"]: "renderTracked hook",
|
|
1357
|
+
["rtg"]: "renderTriggered hook",
|
|
1358
|
+
[0]: "setup function",
|
|
1359
|
+
[1]: "render function",
|
|
1360
|
+
[2]: "watcher getter",
|
|
1361
|
+
[3]: "watcher callback",
|
|
1362
|
+
[4]: "watcher cleanup function",
|
|
1363
|
+
[5]: "native event handler",
|
|
1364
|
+
[6]: "component event handler",
|
|
1365
|
+
[7]: "vnode hook",
|
|
1366
|
+
[8]: "directive hook",
|
|
1367
|
+
[9]: "transition hook",
|
|
1368
|
+
[10]: "app errorHandler",
|
|
1369
|
+
[11]: "app warnHandler",
|
|
1370
|
+
[12]: "ref function",
|
|
1371
|
+
[13]: "async component loader",
|
|
1372
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
1373
|
+
};
|
|
1374
|
+
function callWithErrorHandling(fn, instance, type, args) {
|
|
1375
|
+
try {
|
|
1376
|
+
return args ? fn(...args) : fn();
|
|
1377
|
+
} catch (err) {
|
|
1378
|
+
handleError(err, instance, type);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1382
|
+
if (shared.isFunction(fn)) {
|
|
1383
|
+
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1384
|
+
if (res && shared.isPromise(res)) {
|
|
1385
|
+
res.catch((err) => {
|
|
1386
|
+
handleError(err, instance, type);
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
return res;
|
|
1390
|
+
}
|
|
1391
|
+
if (shared.isArray(fn)) {
|
|
1392
|
+
const values = [];
|
|
1393
|
+
for (let i = 0; i < fn.length; i++) {
|
|
1394
|
+
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1395
|
+
}
|
|
1396
|
+
return values;
|
|
1397
|
+
} else {
|
|
1398
|
+
warn$1(
|
|
1399
|
+
`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
function handleError(err, instance, type, throwInDev = true) {
|
|
1404
|
+
const contextVNode = instance ? instance.vnode : null;
|
|
1405
|
+
if (instance) {
|
|
1406
|
+
let cur = instance.parent;
|
|
1407
|
+
const exposedInstance = instance.proxy;
|
|
1408
|
+
const errorInfo = ErrorTypeStrings[type] ;
|
|
1409
|
+
while (cur) {
|
|
1410
|
+
const errorCapturedHooks = cur.ec;
|
|
1411
|
+
if (errorCapturedHooks) {
|
|
1412
|
+
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
1413
|
+
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
cur = cur.parent;
|
|
1419
|
+
}
|
|
1420
|
+
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
1421
|
+
if (appErrorHandler) {
|
|
1422
|
+
pauseTracking();
|
|
1423
|
+
callWithErrorHandling(
|
|
1424
|
+
appErrorHandler,
|
|
1425
|
+
null,
|
|
1426
|
+
10,
|
|
1427
|
+
[err, exposedInstance, errorInfo]
|
|
1428
|
+
);
|
|
1429
|
+
resetTracking();
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
logError(err, type, contextVNode, throwInDev);
|
|
1434
|
+
}
|
|
1435
|
+
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1436
|
+
{
|
|
1437
|
+
const info = ErrorTypeStrings[type];
|
|
1438
|
+
if (contextVNode) {
|
|
1439
|
+
pushWarningContext(contextVNode);
|
|
1440
|
+
}
|
|
1441
|
+
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1442
|
+
if (contextVNode) {
|
|
1443
|
+
popWarningContext();
|
|
1444
|
+
}
|
|
1445
|
+
if (throwInDev) {
|
|
1446
|
+
throw err;
|
|
1447
|
+
} else {
|
|
1448
|
+
console.error(err);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
let isFlushing = false;
|
|
1454
|
+
let isFlushPending = false;
|
|
1455
|
+
const queue = [];
|
|
1456
|
+
let flushIndex = 0;
|
|
1457
|
+
const pendingPostFlushCbs = [];
|
|
1458
|
+
let activePostFlushCbs = null;
|
|
1459
|
+
let postFlushIndex = 0;
|
|
1460
|
+
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1461
|
+
let currentFlushPromise = null;
|
|
1462
|
+
const RECURSION_LIMIT = 100;
|
|
1463
|
+
function nextTick(fn) {
|
|
1464
|
+
const p = currentFlushPromise || resolvedPromise;
|
|
1465
|
+
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
1466
|
+
}
|
|
1467
|
+
function findInsertionIndex(id) {
|
|
1468
|
+
let start = flushIndex + 1;
|
|
1469
|
+
let end = queue.length;
|
|
1470
|
+
while (start < end) {
|
|
1471
|
+
const middle = start + end >>> 1;
|
|
1472
|
+
const middleJob = queue[middle];
|
|
1473
|
+
const middleJobId = getId(middleJob);
|
|
1474
|
+
if (middleJobId < id || middleJobId === id && middleJob.pre) {
|
|
1475
|
+
start = middle + 1;
|
|
1476
|
+
} else {
|
|
1477
|
+
end = middle;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return start;
|
|
1481
|
+
}
|
|
1482
|
+
function queueJob(job) {
|
|
1483
|
+
if (!queue.length || !queue.includes(
|
|
1484
|
+
job,
|
|
1485
|
+
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1486
|
+
)) {
|
|
1487
|
+
if (job.id == null) {
|
|
1488
|
+
queue.push(job);
|
|
1489
|
+
} else {
|
|
1490
|
+
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1491
|
+
}
|
|
1492
|
+
queueFlush();
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
function queueFlush() {
|
|
1496
|
+
if (!isFlushing && !isFlushPending) {
|
|
1497
|
+
isFlushPending = true;
|
|
1498
|
+
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
function queuePostFlushCb(cb) {
|
|
1502
|
+
if (!shared.isArray(cb)) {
|
|
1503
|
+
if (!activePostFlushCbs || !activePostFlushCbs.includes(
|
|
1504
|
+
cb,
|
|
1505
|
+
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1506
|
+
)) {
|
|
1507
|
+
pendingPostFlushCbs.push(cb);
|
|
1508
|
+
}
|
|
1509
|
+
} else {
|
|
1510
|
+
pendingPostFlushCbs.push(...cb);
|
|
1511
|
+
}
|
|
1512
|
+
queueFlush();
|
|
1513
|
+
}
|
|
1514
|
+
function flushPostFlushCbs(seen) {
|
|
1515
|
+
if (pendingPostFlushCbs.length) {
|
|
1516
|
+
const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
|
1517
|
+
(a, b) => getId(a) - getId(b)
|
|
1518
|
+
);
|
|
1519
|
+
pendingPostFlushCbs.length = 0;
|
|
1520
|
+
if (activePostFlushCbs) {
|
|
1521
|
+
activePostFlushCbs.push(...deduped);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
activePostFlushCbs = deduped;
|
|
1525
|
+
{
|
|
1526
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1527
|
+
}
|
|
1528
|
+
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1529
|
+
const cb = activePostFlushCbs[postFlushIndex];
|
|
1530
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
1531
|
+
continue;
|
|
1532
|
+
}
|
|
1533
|
+
if (cb.active !== false) cb();
|
|
1534
|
+
}
|
|
1535
|
+
activePostFlushCbs = null;
|
|
1536
|
+
postFlushIndex = 0;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
1540
|
+
const comparator = (a, b) => {
|
|
1541
|
+
const diff = getId(a) - getId(b);
|
|
1542
|
+
if (diff === 0) {
|
|
1543
|
+
if (a.pre && !b.pre) return -1;
|
|
1544
|
+
if (b.pre && !a.pre) return 1;
|
|
1545
|
+
}
|
|
1546
|
+
return diff;
|
|
1547
|
+
};
|
|
1548
|
+
function flushJobs(seen) {
|
|
1549
|
+
isFlushPending = false;
|
|
1550
|
+
isFlushing = true;
|
|
1551
|
+
{
|
|
1552
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1553
|
+
}
|
|
1554
|
+
queue.sort(comparator);
|
|
1555
|
+
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
1556
|
+
try {
|
|
1557
|
+
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1558
|
+
const job = queue[flushIndex];
|
|
1559
|
+
if (job && job.active !== false) {
|
|
1560
|
+
if (check(job)) {
|
|
1561
|
+
continue;
|
|
1562
|
+
}
|
|
1563
|
+
callWithErrorHandling(job, null, 14);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
} finally {
|
|
1567
|
+
flushIndex = 0;
|
|
1568
|
+
queue.length = 0;
|
|
1569
|
+
flushPostFlushCbs(seen);
|
|
1570
|
+
isFlushing = false;
|
|
1571
|
+
currentFlushPromise = null;
|
|
1572
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1573
|
+
flushJobs(seen);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function checkRecursiveUpdates(seen, fn) {
|
|
1578
|
+
if (!seen.has(fn)) {
|
|
1579
|
+
seen.set(fn, 1);
|
|
1580
|
+
} else {
|
|
1581
|
+
const count = seen.get(fn);
|
|
1582
|
+
if (count > RECURSION_LIMIT) {
|
|
1583
|
+
const instance = fn.ownerInstance;
|
|
1584
|
+
const componentName = instance && getComponentName(instance.type);
|
|
1585
|
+
handleError(
|
|
1586
|
+
`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.`,
|
|
1587
|
+
null,
|
|
1588
|
+
10
|
|
1589
|
+
);
|
|
1590
|
+
return true;
|
|
1591
|
+
} else {
|
|
1592
|
+
seen.set(fn, count + 1);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
function emit$1(event, ...args) {
|
|
1598
|
+
}
|
|
1599
|
+
const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
1600
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
1601
|
+
// @__NO_SIDE_EFFECTS__
|
|
1602
|
+
function createDevtoolsComponentHook(hook) {
|
|
1603
|
+
return (component) => {
|
|
1604
|
+
emit$1(
|
|
1605
|
+
hook,
|
|
1606
|
+
component.appContext.app,
|
|
1607
|
+
component.uid,
|
|
1608
|
+
component.parent ? component.parent.uid : void 0,
|
|
1609
|
+
component
|
|
1610
|
+
);
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
|
|
1614
|
+
"perf:start" /* PERFORMANCE_START */
|
|
1615
|
+
);
|
|
1616
|
+
const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
|
|
1617
|
+
"perf:end" /* PERFORMANCE_END */
|
|
1618
|
+
);
|
|
1619
|
+
function createDevtoolsPerformanceHook(hook) {
|
|
1620
|
+
return (component, type, time) => {
|
|
1621
|
+
emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
function devtoolsComponentEmit(component, event, params) {
|
|
1625
|
+
emit$1(
|
|
1626
|
+
"component:emit" /* COMPONENT_EMIT */,
|
|
1627
|
+
component.appContext.app,
|
|
1628
|
+
component,
|
|
1629
|
+
event,
|
|
1630
|
+
params
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
function emit(instance, event, ...rawArgs) {
|
|
1635
|
+
if (instance.isUnmounted) return;
|
|
1636
|
+
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
1637
|
+
{
|
|
1638
|
+
const {
|
|
1639
|
+
emitsOptions,
|
|
1640
|
+
propsOptions: [propsOptions]
|
|
1641
|
+
} = instance;
|
|
1642
|
+
if (emitsOptions) {
|
|
1643
|
+
if (!(event in emitsOptions) && true) {
|
|
1644
|
+
if (!propsOptions || !(shared.toHandlerKey(event) in propsOptions)) {
|
|
1645
|
+
warn$1(
|
|
1646
|
+
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${shared.toHandlerKey(event)}" prop.`
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
} else {
|
|
1650
|
+
const validator = emitsOptions[event];
|
|
1651
|
+
if (shared.isFunction(validator)) {
|
|
1652
|
+
const isValid = validator(...rawArgs);
|
|
1653
|
+
if (!isValid) {
|
|
1654
|
+
warn$1(
|
|
1655
|
+
`Invalid event arguments: event validation failed for event "${event}".`
|
|
1656
|
+
);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
let args = rawArgs;
|
|
1663
|
+
const isModelListener = event.startsWith("update:");
|
|
1664
|
+
const modelArg = isModelListener && event.slice(7);
|
|
1665
|
+
if (modelArg && modelArg in props) {
|
|
1666
|
+
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
|
1667
|
+
const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
|
|
1668
|
+
if (trim) {
|
|
1669
|
+
args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
|
1670
|
+
}
|
|
1671
|
+
if (number) {
|
|
1672
|
+
args = rawArgs.map(shared.looseToNumber);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
{
|
|
1676
|
+
devtoolsComponentEmit(instance, event, args);
|
|
1677
|
+
}
|
|
1678
|
+
{
|
|
1679
|
+
const lowerCaseEvent = event.toLowerCase();
|
|
1680
|
+
if (lowerCaseEvent !== event && props[shared.toHandlerKey(lowerCaseEvent)]) {
|
|
1681
|
+
warn$1(
|
|
1682
|
+
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
1683
|
+
instance,
|
|
1684
|
+
instance.type
|
|
1685
|
+
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${shared.hyphenate(
|
|
1686
|
+
event
|
|
1687
|
+
)}" instead of "${event}".`
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
let handlerName;
|
|
1692
|
+
let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
|
1693
|
+
props[handlerName = shared.toHandlerKey(shared.camelize(event))];
|
|
1694
|
+
if (!handler && isModelListener) {
|
|
1695
|
+
handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
|
|
1696
|
+
}
|
|
1697
|
+
if (handler) {
|
|
1698
|
+
callWithAsyncErrorHandling(
|
|
1699
|
+
handler,
|
|
1700
|
+
instance,
|
|
1701
|
+
6,
|
|
1702
|
+
args
|
|
1703
|
+
);
|
|
1704
|
+
}
|
|
1705
|
+
const onceHandler = props[handlerName + `Once`];
|
|
1706
|
+
if (onceHandler) {
|
|
1707
|
+
if (!instance.emitted) {
|
|
1708
|
+
instance.emitted = {};
|
|
1709
|
+
} else if (instance.emitted[handlerName]) {
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
instance.emitted[handlerName] = true;
|
|
1713
|
+
callWithAsyncErrorHandling(
|
|
1714
|
+
onceHandler,
|
|
1715
|
+
instance,
|
|
1716
|
+
6,
|
|
1717
|
+
args
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
1722
|
+
const cache = appContext.emitsCache;
|
|
1723
|
+
const cached = cache.get(comp);
|
|
1724
|
+
if (cached !== void 0) {
|
|
1725
|
+
return cached;
|
|
1726
|
+
}
|
|
1727
|
+
const raw = comp.emits;
|
|
1728
|
+
let normalized = {};
|
|
1729
|
+
let hasExtends = false;
|
|
1730
|
+
if (!shared.isFunction(comp)) {
|
|
1731
|
+
const extendEmits = (raw2) => {
|
|
1732
|
+
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
|
1733
|
+
if (normalizedFromExtend) {
|
|
1734
|
+
hasExtends = true;
|
|
1735
|
+
shared.extend(normalized, normalizedFromExtend);
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
if (!asMixin && appContext.mixins.length) {
|
|
1739
|
+
appContext.mixins.forEach(extendEmits);
|
|
1740
|
+
}
|
|
1741
|
+
if (comp.extends) {
|
|
1742
|
+
extendEmits(comp.extends);
|
|
1743
|
+
}
|
|
1744
|
+
if (comp.mixins) {
|
|
1745
|
+
comp.mixins.forEach(extendEmits);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
if (!raw && !hasExtends) {
|
|
1749
|
+
if (shared.isObject(comp)) {
|
|
1750
|
+
cache.set(comp, null);
|
|
1751
|
+
}
|
|
1752
|
+
return null;
|
|
1753
|
+
}
|
|
1754
|
+
if (shared.isArray(raw)) {
|
|
1755
|
+
raw.forEach((key) => normalized[key] = null);
|
|
1756
|
+
} else {
|
|
1757
|
+
shared.extend(normalized, raw);
|
|
1758
|
+
}
|
|
1759
|
+
if (shared.isObject(comp)) {
|
|
1760
|
+
cache.set(comp, normalized);
|
|
1761
|
+
}
|
|
1762
|
+
return normalized;
|
|
1763
|
+
}
|
|
1764
|
+
function isEmitListener(options, key) {
|
|
1765
|
+
if (!options || !shared.isOn(key)) {
|
|
1766
|
+
return false;
|
|
1767
|
+
}
|
|
1768
|
+
key = key.slice(2).replace(/Once$/, "");
|
|
1769
|
+
return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
let currentRenderingInstance = null;
|
|
1773
|
+
let currentScopeId = null;
|
|
1774
|
+
function setCurrentRenderingInstance$1(instance) {
|
|
1775
|
+
const prev = currentRenderingInstance;
|
|
1776
|
+
currentRenderingInstance = instance;
|
|
1777
|
+
currentScopeId = instance && instance.type.__scopeId || null;
|
|
1778
|
+
return prev;
|
|
1779
|
+
}
|
|
1780
|
+
function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
1781
|
+
if (!ctx) return fn;
|
|
1782
|
+
if (fn._n) {
|
|
1783
|
+
return fn;
|
|
1784
|
+
}
|
|
1785
|
+
const renderFnWithContext = (...args) => {
|
|
1786
|
+
if (renderFnWithContext._d) {
|
|
1787
|
+
setBlockTracking(-1);
|
|
1788
|
+
}
|
|
1789
|
+
const prevInstance = setCurrentRenderingInstance$1(ctx);
|
|
1790
|
+
let res;
|
|
1791
|
+
try {
|
|
1792
|
+
res = fn(...args);
|
|
1793
|
+
} finally {
|
|
1794
|
+
setCurrentRenderingInstance$1(prevInstance);
|
|
1795
|
+
if (renderFnWithContext._d) {
|
|
1796
|
+
setBlockTracking(1);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
{
|
|
1800
|
+
devtoolsComponentUpdated(ctx);
|
|
1801
|
+
}
|
|
1802
|
+
return res;
|
|
1803
|
+
};
|
|
1804
|
+
renderFnWithContext._n = true;
|
|
1805
|
+
renderFnWithContext._c = true;
|
|
1806
|
+
renderFnWithContext._d = true;
|
|
1807
|
+
return renderFnWithContext;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
let accessedAttrs = false;
|
|
1811
|
+
function markAttrsAccessed() {
|
|
1812
|
+
accessedAttrs = true;
|
|
1813
|
+
}
|
|
1814
|
+
function renderComponentRoot$1(instance) {
|
|
1815
|
+
const {
|
|
1816
|
+
type: Component,
|
|
1817
|
+
vnode,
|
|
1818
|
+
proxy,
|
|
1819
|
+
withProxy,
|
|
1820
|
+
propsOptions: [propsOptions],
|
|
1821
|
+
slots,
|
|
1822
|
+
attrs,
|
|
1823
|
+
emit,
|
|
1824
|
+
render,
|
|
1825
|
+
renderCache,
|
|
1826
|
+
props,
|
|
1827
|
+
data,
|
|
1828
|
+
setupState,
|
|
1829
|
+
ctx,
|
|
1830
|
+
inheritAttrs
|
|
1831
|
+
} = instance;
|
|
1832
|
+
const prev = setCurrentRenderingInstance$1(instance);
|
|
1833
|
+
let result;
|
|
1834
|
+
let fallthroughAttrs;
|
|
1835
|
+
{
|
|
1836
|
+
accessedAttrs = false;
|
|
1837
|
+
}
|
|
1838
|
+
try {
|
|
1839
|
+
if (vnode.shapeFlag & 4) {
|
|
1840
|
+
const proxyToUse = withProxy || proxy;
|
|
1841
|
+
const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
|
1842
|
+
get(target, key, receiver) {
|
|
1843
|
+
warn$1(
|
|
1844
|
+
`Property '${String(
|
|
1845
|
+
key
|
|
1846
|
+
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
1847
|
+
);
|
|
1848
|
+
return Reflect.get(target, key, receiver);
|
|
1849
|
+
}
|
|
1850
|
+
}) : proxyToUse;
|
|
1851
|
+
result = normalizeVNode$1(
|
|
1852
|
+
render.call(
|
|
1853
|
+
thisProxy,
|
|
1854
|
+
proxyToUse,
|
|
1855
|
+
renderCache,
|
|
1856
|
+
true ? shallowReadonly(props) : props,
|
|
1857
|
+
setupState,
|
|
1858
|
+
data,
|
|
1859
|
+
ctx
|
|
1860
|
+
)
|
|
1861
|
+
);
|
|
1862
|
+
fallthroughAttrs = attrs;
|
|
1863
|
+
} else {
|
|
1864
|
+
const render2 = Component;
|
|
1865
|
+
if (attrs === props) {
|
|
1866
|
+
markAttrsAccessed();
|
|
1867
|
+
}
|
|
1868
|
+
result = normalizeVNode$1(
|
|
1869
|
+
render2.length > 1 ? render2(
|
|
1870
|
+
true ? shallowReadonly(props) : props,
|
|
1871
|
+
true ? {
|
|
1872
|
+
get attrs() {
|
|
1873
|
+
markAttrsAccessed();
|
|
1874
|
+
return shallowReadonly(attrs);
|
|
1875
|
+
},
|
|
1876
|
+
slots,
|
|
1877
|
+
emit
|
|
1878
|
+
} : { attrs, slots, emit }
|
|
1879
|
+
) : render2(
|
|
1880
|
+
true ? shallowReadonly(props) : props,
|
|
1881
|
+
null
|
|
1882
|
+
)
|
|
1883
|
+
);
|
|
1884
|
+
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
|
1885
|
+
}
|
|
1886
|
+
} catch (err) {
|
|
1887
|
+
handleError(err, instance, 1);
|
|
1888
|
+
result = createVNode(Comment);
|
|
1889
|
+
}
|
|
1890
|
+
let root = result;
|
|
1891
|
+
let setRoot = void 0;
|
|
1892
|
+
if (result.patchFlag > 0 && result.patchFlag & 2048) {
|
|
1893
|
+
[root, setRoot] = getChildRoot(result);
|
|
1894
|
+
}
|
|
1895
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
1896
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
1897
|
+
const { shapeFlag } = root;
|
|
1898
|
+
if (keys.length) {
|
|
1899
|
+
if (shapeFlag & (1 | 6)) {
|
|
1900
|
+
if (propsOptions && keys.some(shared.isModelListener)) {
|
|
1901
|
+
fallthroughAttrs = filterModelListeners(
|
|
1902
|
+
fallthroughAttrs,
|
|
1903
|
+
propsOptions
|
|
1904
|
+
);
|
|
1905
|
+
}
|
|
1906
|
+
root = cloneVNode(root, fallthroughAttrs, false, true);
|
|
1907
|
+
} else if (!accessedAttrs && root.type !== Comment) {
|
|
1908
|
+
const allAttrs = Object.keys(attrs);
|
|
1909
|
+
const eventAttrs = [];
|
|
1910
|
+
const extraAttrs = [];
|
|
1911
|
+
for (let i = 0, l = allAttrs.length; i < l; i++) {
|
|
1912
|
+
const key = allAttrs[i];
|
|
1913
|
+
if (shared.isOn(key)) {
|
|
1914
|
+
if (!shared.isModelListener(key)) {
|
|
1915
|
+
eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
|
1916
|
+
}
|
|
1917
|
+
} else {
|
|
1918
|
+
extraAttrs.push(key);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
if (extraAttrs.length) {
|
|
1922
|
+
warn$1(
|
|
1923
|
+
`Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
|
|
1924
|
+
);
|
|
1925
|
+
}
|
|
1926
|
+
if (eventAttrs.length) {
|
|
1927
|
+
warn$1(
|
|
1928
|
+
`Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
|
|
1929
|
+
);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
if (vnode.dirs) {
|
|
1935
|
+
if (!isElementRoot(root)) {
|
|
1936
|
+
warn$1(
|
|
1937
|
+
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
1938
|
+
);
|
|
1939
|
+
}
|
|
1940
|
+
root = cloneVNode(root, null, false, true);
|
|
1941
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
1942
|
+
}
|
|
1943
|
+
if (vnode.transition) {
|
|
1944
|
+
if (!isElementRoot(root)) {
|
|
1945
|
+
warn$1(
|
|
1946
|
+
`Component inside <Transition> renders non-element root node that cannot be animated.`
|
|
1947
|
+
);
|
|
1948
|
+
}
|
|
1949
|
+
root.transition = vnode.transition;
|
|
1950
|
+
}
|
|
1951
|
+
if (setRoot) {
|
|
1952
|
+
setRoot(root);
|
|
1953
|
+
} else {
|
|
1954
|
+
result = root;
|
|
1955
|
+
}
|
|
1956
|
+
setCurrentRenderingInstance$1(prev);
|
|
1957
|
+
return result;
|
|
1958
|
+
}
|
|
1959
|
+
const getChildRoot = (vnode) => {
|
|
1960
|
+
const rawChildren = vnode.children;
|
|
1961
|
+
const dynamicChildren = vnode.dynamicChildren;
|
|
1962
|
+
const childRoot = filterSingleRoot(rawChildren, false);
|
|
1963
|
+
if (!childRoot) {
|
|
1964
|
+
return [vnode, void 0];
|
|
1965
|
+
} else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
|
|
1966
|
+
return getChildRoot(childRoot);
|
|
1967
|
+
}
|
|
1968
|
+
const index = rawChildren.indexOf(childRoot);
|
|
1969
|
+
const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
|
1970
|
+
const setRoot = (updatedRoot) => {
|
|
1971
|
+
rawChildren[index] = updatedRoot;
|
|
1972
|
+
if (dynamicChildren) {
|
|
1973
|
+
if (dynamicIndex > -1) {
|
|
1974
|
+
dynamicChildren[dynamicIndex] = updatedRoot;
|
|
1975
|
+
} else if (updatedRoot.patchFlag > 0) {
|
|
1976
|
+
vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
return [normalizeVNode$1(childRoot), setRoot];
|
|
1981
|
+
};
|
|
1982
|
+
function filterSingleRoot(children, recurse = true) {
|
|
1983
|
+
let singleRoot;
|
|
1984
|
+
for (let i = 0; i < children.length; i++) {
|
|
1985
|
+
const child = children[i];
|
|
1986
|
+
if (isVNode$2(child)) {
|
|
1987
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
1988
|
+
if (singleRoot) {
|
|
1989
|
+
return;
|
|
1990
|
+
} else {
|
|
1991
|
+
singleRoot = child;
|
|
1992
|
+
if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
|
|
1993
|
+
return filterSingleRoot(singleRoot.children);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
} else {
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
return singleRoot;
|
|
2002
|
+
}
|
|
2003
|
+
const getFunctionalFallthrough = (attrs) => {
|
|
2004
|
+
let res;
|
|
2005
|
+
for (const key in attrs) {
|
|
2006
|
+
if (key === "class" || key === "style" || shared.isOn(key)) {
|
|
2007
|
+
(res || (res = {}))[key] = attrs[key];
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
return res;
|
|
2011
|
+
};
|
|
2012
|
+
const filterModelListeners = (attrs, props) => {
|
|
2013
|
+
const res = {};
|
|
2014
|
+
for (const key in attrs) {
|
|
2015
|
+
if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
|
|
2016
|
+
res[key] = attrs[key];
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return res;
|
|
2020
|
+
};
|
|
2021
|
+
const isElementRoot = (vnode) => {
|
|
2022
|
+
return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
2026
|
+
|
|
2027
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
2028
|
+
function queueEffectWithSuspense(fn, suspense) {
|
|
2029
|
+
if (suspense && suspense.pendingBranch) {
|
|
2030
|
+
if (shared.isArray(fn)) {
|
|
2031
|
+
suspense.effects.push(...fn);
|
|
2032
|
+
} else {
|
|
2033
|
+
suspense.effects.push(fn);
|
|
2034
|
+
}
|
|
2035
|
+
} else {
|
|
2036
|
+
queuePostFlushCb(fn);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
2041
|
+
if (target) {
|
|
2042
|
+
const hooks = target[type] || (target[type] = []);
|
|
2043
|
+
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
2044
|
+
pauseTracking();
|
|
2045
|
+
const reset = setCurrentInstance(target);
|
|
2046
|
+
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
2047
|
+
reset();
|
|
2048
|
+
resetTracking();
|
|
2049
|
+
return res;
|
|
2050
|
+
});
|
|
2051
|
+
if (prepend) {
|
|
2052
|
+
hooks.unshift(wrappedHook);
|
|
2053
|
+
} else {
|
|
2054
|
+
hooks.push(wrappedHook);
|
|
2055
|
+
}
|
|
2056
|
+
return wrappedHook;
|
|
2057
|
+
} else {
|
|
2058
|
+
const apiName = shared.toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2059
|
+
warn$1(
|
|
2060
|
+
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
const createHook = (lifecycle) => (hook, target = currentInstance) => {
|
|
2065
|
+
if (!isInSSRComponentSetup || lifecycle === "sp") {
|
|
2066
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
const onBeforeMount = createHook("bm");
|
|
2070
|
+
const onMounted = createHook("m");
|
|
2071
|
+
const onBeforeUpdate = createHook("bu");
|
|
2072
|
+
const onUpdated = createHook("u");
|
|
2073
|
+
const onBeforeUnmount = createHook("bum");
|
|
2074
|
+
const onUnmounted = createHook("um");
|
|
2075
|
+
const onServerPrefetch = createHook("sp");
|
|
2076
|
+
const onRenderTriggered = createHook(
|
|
2077
|
+
"rtg"
|
|
2078
|
+
);
|
|
2079
|
+
const onRenderTracked = createHook(
|
|
2080
|
+
"rtc"
|
|
2081
|
+
);
|
|
2082
|
+
function onErrorCaptured(hook, target = currentInstance) {
|
|
2083
|
+
injectHook("ec", hook, target);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
function validateDirectiveName(name) {
|
|
2087
|
+
if (shared.isBuiltInDirective(name)) {
|
|
2088
|
+
warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
const getPublicInstance = (i) => {
|
|
2093
|
+
if (!i) return null;
|
|
2094
|
+
if (isStatefulComponent(i)) return getComponentPublicInstance(i);
|
|
2095
|
+
return getPublicInstance(i.parent);
|
|
2096
|
+
};
|
|
2097
|
+
const publicPropertiesMap = (
|
|
2098
|
+
// Move PURE marker to new line to workaround compiler discarding it
|
|
2099
|
+
// due to type annotation
|
|
2100
|
+
/* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
|
|
2101
|
+
$: (i) => i,
|
|
2102
|
+
$el: (i) => i.vnode.el,
|
|
2103
|
+
$data: (i) => i.data,
|
|
2104
|
+
$props: (i) => shallowReadonly(i.props) ,
|
|
2105
|
+
$attrs: (i) => shallowReadonly(i.attrs) ,
|
|
2106
|
+
$slots: (i) => shallowReadonly(i.slots) ,
|
|
2107
|
+
$refs: (i) => shallowReadonly(i.refs) ,
|
|
2108
|
+
$parent: (i) => getPublicInstance(i.parent),
|
|
2109
|
+
$root: (i) => getPublicInstance(i.root),
|
|
2110
|
+
$emit: (i) => i.emit,
|
|
2111
|
+
$options: (i) => resolveMergedOptions(i) ,
|
|
2112
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2113
|
+
i.effect.dirty = true;
|
|
2114
|
+
queueJob(i.update);
|
|
2115
|
+
}),
|
|
2116
|
+
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2117
|
+
$watch: (i) => instanceWatch.bind(i)
|
|
2118
|
+
})
|
|
2119
|
+
);
|
|
2120
|
+
const isReservedPrefix = (key) => key === "_" || key === "$";
|
|
2121
|
+
const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
|
|
2122
|
+
const PublicInstanceProxyHandlers = {
|
|
2123
|
+
get({ _: instance }, key) {
|
|
2124
|
+
if (key === "__v_skip") {
|
|
2125
|
+
return true;
|
|
2126
|
+
}
|
|
2127
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
2128
|
+
if (key === "__isVue") {
|
|
2129
|
+
return true;
|
|
2130
|
+
}
|
|
2131
|
+
let normalizedProps;
|
|
2132
|
+
if (key[0] !== "$") {
|
|
2133
|
+
const n = accessCache[key];
|
|
2134
|
+
if (n !== void 0) {
|
|
2135
|
+
switch (n) {
|
|
2136
|
+
case 1 /* SETUP */:
|
|
2137
|
+
return setupState[key];
|
|
2138
|
+
case 2 /* DATA */:
|
|
2139
|
+
return data[key];
|
|
2140
|
+
case 4 /* CONTEXT */:
|
|
2141
|
+
return ctx[key];
|
|
2142
|
+
case 3 /* PROPS */:
|
|
2143
|
+
return props[key];
|
|
2144
|
+
}
|
|
2145
|
+
} else if (hasSetupBinding(setupState, key)) {
|
|
2146
|
+
accessCache[key] = 1 /* SETUP */;
|
|
2147
|
+
return setupState[key];
|
|
2148
|
+
} else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2149
|
+
accessCache[key] = 2 /* DATA */;
|
|
2150
|
+
return data[key];
|
|
2151
|
+
} else if (
|
|
2152
|
+
// only cache other properties when instance has declared (thus stable)
|
|
2153
|
+
// props
|
|
2154
|
+
(normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
|
|
2155
|
+
) {
|
|
2156
|
+
accessCache[key] = 3 /* PROPS */;
|
|
2157
|
+
return props[key];
|
|
2158
|
+
} else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2159
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2160
|
+
return ctx[key];
|
|
2161
|
+
} else if (shouldCacheAccess) {
|
|
2162
|
+
accessCache[key] = 0 /* OTHER */;
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
const publicGetter = publicPropertiesMap[key];
|
|
2166
|
+
let cssModule, globalProperties;
|
|
2167
|
+
if (publicGetter) {
|
|
2168
|
+
if (key === "$attrs") {
|
|
2169
|
+
track(instance.attrs, "get", "");
|
|
2170
|
+
markAttrsAccessed();
|
|
2171
|
+
} else if (key === "$slots") {
|
|
2172
|
+
track(instance, "get", key);
|
|
2173
|
+
}
|
|
2174
|
+
return publicGetter(instance);
|
|
2175
|
+
} else if (
|
|
2176
|
+
// css module (injected by vue-loader)
|
|
2177
|
+
(cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
|
2178
|
+
) {
|
|
2179
|
+
return cssModule;
|
|
2180
|
+
} else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2181
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
2182
|
+
return ctx[key];
|
|
2183
|
+
} else if (
|
|
2184
|
+
// global properties
|
|
2185
|
+
globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
|
|
2186
|
+
) {
|
|
2187
|
+
{
|
|
2188
|
+
return globalProperties[key];
|
|
2189
|
+
}
|
|
2190
|
+
} else if (currentRenderingInstance && (!shared.isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
|
|
2191
|
+
// to infinite warning loop
|
|
2192
|
+
key.indexOf("__v") !== 0)) {
|
|
2193
|
+
if (data !== shared.EMPTY_OBJ && isReservedPrefix(key[0]) && shared.hasOwn(data, key)) {
|
|
2194
|
+
warn$1(
|
|
2195
|
+
`Property ${JSON.stringify(
|
|
2196
|
+
key
|
|
2197
|
+
)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
|
|
2198
|
+
);
|
|
2199
|
+
} else if (instance === currentRenderingInstance) {
|
|
2200
|
+
warn$1(
|
|
2201
|
+
`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
set({ _: instance }, key, value) {
|
|
2207
|
+
const { data, setupState, ctx } = instance;
|
|
2208
|
+
if (hasSetupBinding(setupState, key)) {
|
|
2209
|
+
setupState[key] = value;
|
|
2210
|
+
return true;
|
|
2211
|
+
} else if (setupState.__isScriptSetup && shared.hasOwn(setupState, key)) {
|
|
2212
|
+
warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
2213
|
+
return false;
|
|
2214
|
+
} else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2215
|
+
data[key] = value;
|
|
2216
|
+
return true;
|
|
2217
|
+
} else if (shared.hasOwn(instance.props, key)) {
|
|
2218
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
2219
|
+
return false;
|
|
2220
|
+
}
|
|
2221
|
+
if (key[0] === "$" && key.slice(1) in instance) {
|
|
2222
|
+
warn$1(
|
|
2223
|
+
`Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
|
|
2224
|
+
);
|
|
2225
|
+
return false;
|
|
2226
|
+
} else {
|
|
2227
|
+
if (key in instance.appContext.config.globalProperties) {
|
|
2228
|
+
Object.defineProperty(ctx, key, {
|
|
2229
|
+
enumerable: true,
|
|
2230
|
+
configurable: true,
|
|
2231
|
+
value
|
|
2232
|
+
});
|
|
2233
|
+
} else {
|
|
2234
|
+
ctx[key] = value;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
return true;
|
|
2238
|
+
},
|
|
2239
|
+
has({
|
|
2240
|
+
_: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
|
2241
|
+
}, key) {
|
|
2242
|
+
let normalizedProps;
|
|
2243
|
+
return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
|
|
2244
|
+
},
|
|
2245
|
+
defineProperty(target, key, descriptor) {
|
|
2246
|
+
if (descriptor.get != null) {
|
|
2247
|
+
target._.accessCache[key] = 0;
|
|
2248
|
+
} else if (shared.hasOwn(descriptor, "value")) {
|
|
2249
|
+
this.set(target, key, descriptor.value, null);
|
|
2250
|
+
}
|
|
2251
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
{
|
|
2255
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
2256
|
+
warn$1(
|
|
2257
|
+
`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
|
2258
|
+
);
|
|
2259
|
+
return Reflect.ownKeys(target);
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
function createDevRenderContext(instance) {
|
|
2263
|
+
const target = {};
|
|
2264
|
+
Object.defineProperty(target, `_`, {
|
|
2265
|
+
configurable: true,
|
|
2266
|
+
enumerable: false,
|
|
2267
|
+
get: () => instance
|
|
2268
|
+
});
|
|
2269
|
+
Object.keys(publicPropertiesMap).forEach((key) => {
|
|
2270
|
+
Object.defineProperty(target, key, {
|
|
2271
|
+
configurable: true,
|
|
2272
|
+
enumerable: false,
|
|
2273
|
+
get: () => publicPropertiesMap[key](instance),
|
|
2274
|
+
// intercepted by the proxy so no need for implementation,
|
|
2275
|
+
// but needed to prevent set errors
|
|
2276
|
+
set: shared.NOOP
|
|
2277
|
+
});
|
|
2278
|
+
});
|
|
2279
|
+
return target;
|
|
2280
|
+
}
|
|
2281
|
+
function exposePropsOnRenderContext(instance) {
|
|
2282
|
+
const {
|
|
2283
|
+
ctx,
|
|
2284
|
+
propsOptions: [propsOptions]
|
|
2285
|
+
} = instance;
|
|
2286
|
+
if (propsOptions) {
|
|
2287
|
+
Object.keys(propsOptions).forEach((key) => {
|
|
2288
|
+
Object.defineProperty(ctx, key, {
|
|
2289
|
+
enumerable: true,
|
|
2290
|
+
configurable: true,
|
|
2291
|
+
get: () => instance.props[key],
|
|
2292
|
+
set: shared.NOOP
|
|
2293
|
+
});
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function exposeSetupStateOnRenderContext(instance) {
|
|
2298
|
+
const { ctx, setupState } = instance;
|
|
2299
|
+
Object.keys(toRaw(setupState)).forEach((key) => {
|
|
2300
|
+
if (!setupState.__isScriptSetup) {
|
|
2301
|
+
if (isReservedPrefix(key[0])) {
|
|
2302
|
+
warn$1(
|
|
2303
|
+
`setup() return property ${JSON.stringify(
|
|
2304
|
+
key
|
|
2305
|
+
)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
|
|
2306
|
+
);
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
Object.defineProperty(ctx, key, {
|
|
2310
|
+
enumerable: true,
|
|
2311
|
+
configurable: true,
|
|
2312
|
+
get: () => setupState[key],
|
|
2313
|
+
set: shared.NOOP
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
function normalizePropsOrEmits(props) {
|
|
2320
|
+
return shared.isArray(props) ? props.reduce(
|
|
2321
|
+
(normalized, p) => (normalized[p] = null, normalized),
|
|
2322
|
+
{}
|
|
2323
|
+
) : props;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
function createDuplicateChecker() {
|
|
2327
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
2328
|
+
return (type, key) => {
|
|
2329
|
+
if (cache[key]) {
|
|
2330
|
+
warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
2331
|
+
} else {
|
|
2332
|
+
cache[key] = type;
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
let shouldCacheAccess = true;
|
|
2337
|
+
function applyOptions(instance) {
|
|
2338
|
+
const options = resolveMergedOptions(instance);
|
|
2339
|
+
const publicThis = instance.proxy;
|
|
2340
|
+
const ctx = instance.ctx;
|
|
2341
|
+
shouldCacheAccess = false;
|
|
2342
|
+
if (options.beforeCreate) {
|
|
2343
|
+
callHook(options.beforeCreate, instance, "bc");
|
|
2344
|
+
}
|
|
2345
|
+
const {
|
|
2346
|
+
// state
|
|
2347
|
+
data: dataOptions,
|
|
2348
|
+
computed: computedOptions,
|
|
2349
|
+
methods,
|
|
2350
|
+
watch: watchOptions,
|
|
2351
|
+
provide: provideOptions,
|
|
2352
|
+
inject: injectOptions,
|
|
2353
|
+
// lifecycle
|
|
2354
|
+
created,
|
|
2355
|
+
beforeMount,
|
|
2356
|
+
mounted,
|
|
2357
|
+
beforeUpdate,
|
|
2358
|
+
updated,
|
|
2359
|
+
activated,
|
|
2360
|
+
deactivated,
|
|
2361
|
+
beforeDestroy,
|
|
2362
|
+
beforeUnmount,
|
|
2363
|
+
destroyed,
|
|
2364
|
+
unmounted,
|
|
2365
|
+
render,
|
|
2366
|
+
renderTracked,
|
|
2367
|
+
renderTriggered,
|
|
2368
|
+
errorCaptured,
|
|
2369
|
+
serverPrefetch,
|
|
2370
|
+
// public API
|
|
2371
|
+
expose,
|
|
2372
|
+
inheritAttrs,
|
|
2373
|
+
// assets
|
|
2374
|
+
components,
|
|
2375
|
+
directives,
|
|
2376
|
+
filters
|
|
2377
|
+
} = options;
|
|
2378
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
2379
|
+
{
|
|
2380
|
+
const [propsOptions] = instance.propsOptions;
|
|
2381
|
+
if (propsOptions) {
|
|
2382
|
+
for (const key in propsOptions) {
|
|
2383
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
if (injectOptions) {
|
|
2388
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
|
2389
|
+
}
|
|
2390
|
+
if (methods) {
|
|
2391
|
+
for (const key in methods) {
|
|
2392
|
+
const methodHandler = methods[key];
|
|
2393
|
+
if (shared.isFunction(methodHandler)) {
|
|
2394
|
+
{
|
|
2395
|
+
Object.defineProperty(ctx, key, {
|
|
2396
|
+
value: methodHandler.bind(publicThis),
|
|
2397
|
+
configurable: true,
|
|
2398
|
+
enumerable: true,
|
|
2399
|
+
writable: true
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
{
|
|
2403
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
2404
|
+
}
|
|
2405
|
+
} else {
|
|
2406
|
+
warn$1(
|
|
2407
|
+
`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
|
2408
|
+
);
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
if (dataOptions) {
|
|
2413
|
+
if (!shared.isFunction(dataOptions)) {
|
|
2414
|
+
warn$1(
|
|
2415
|
+
`The data option must be a function. Plain object usage is no longer supported.`
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
const data = dataOptions.call(publicThis, publicThis);
|
|
2419
|
+
if (shared.isPromise(data)) {
|
|
2420
|
+
warn$1(
|
|
2421
|
+
`data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
|
|
2422
|
+
);
|
|
2423
|
+
}
|
|
2424
|
+
if (!shared.isObject(data)) {
|
|
2425
|
+
warn$1(`data() should return an object.`);
|
|
2426
|
+
} else {
|
|
2427
|
+
instance.data = reactive(data);
|
|
2428
|
+
{
|
|
2429
|
+
for (const key in data) {
|
|
2430
|
+
checkDuplicateProperties("Data" /* DATA */, key);
|
|
2431
|
+
if (!isReservedPrefix(key[0])) {
|
|
2432
|
+
Object.defineProperty(ctx, key, {
|
|
2433
|
+
configurable: true,
|
|
2434
|
+
enumerable: true,
|
|
2435
|
+
get: () => data[key],
|
|
2436
|
+
set: shared.NOOP
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
shouldCacheAccess = true;
|
|
2444
|
+
if (computedOptions) {
|
|
2445
|
+
for (const key in computedOptions) {
|
|
2446
|
+
const opt = computedOptions[key];
|
|
2447
|
+
const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
|
|
2448
|
+
if (get === shared.NOOP) {
|
|
2449
|
+
warn$1(`Computed property "${key}" has no getter.`);
|
|
2450
|
+
}
|
|
2451
|
+
const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
|
|
2452
|
+
warn$1(
|
|
2453
|
+
`Write operation failed: computed property "${key}" is readonly.`
|
|
2454
|
+
);
|
|
2455
|
+
} ;
|
|
2456
|
+
const c = computed({
|
|
2457
|
+
get,
|
|
2458
|
+
set
|
|
2459
|
+
});
|
|
2460
|
+
Object.defineProperty(ctx, key, {
|
|
2461
|
+
enumerable: true,
|
|
2462
|
+
configurable: true,
|
|
2463
|
+
get: () => c.value,
|
|
2464
|
+
set: (v) => c.value = v
|
|
2465
|
+
});
|
|
2466
|
+
{
|
|
2467
|
+
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
if (watchOptions) {
|
|
2472
|
+
for (const key in watchOptions) {
|
|
2473
|
+
createWatcher(watchOptions[key], ctx, publicThis, key);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
if (provideOptions) {
|
|
2477
|
+
const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
|
2478
|
+
Reflect.ownKeys(provides).forEach((key) => {
|
|
2479
|
+
provide(key, provides[key]);
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
if (created) {
|
|
2483
|
+
callHook(created, instance, "c");
|
|
2484
|
+
}
|
|
2485
|
+
function registerLifecycleHook(register, hook) {
|
|
2486
|
+
if (shared.isArray(hook)) {
|
|
2487
|
+
hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
|
2488
|
+
} else if (hook) {
|
|
2489
|
+
register(hook.bind(publicThis));
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
registerLifecycleHook(onBeforeMount, beforeMount);
|
|
2493
|
+
registerLifecycleHook(onMounted, mounted);
|
|
2494
|
+
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
|
2495
|
+
registerLifecycleHook(onUpdated, updated);
|
|
2496
|
+
registerLifecycleHook(onActivated, activated);
|
|
2497
|
+
registerLifecycleHook(onDeactivated, deactivated);
|
|
2498
|
+
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
|
2499
|
+
registerLifecycleHook(onRenderTracked, renderTracked);
|
|
2500
|
+
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
|
2501
|
+
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
|
2502
|
+
registerLifecycleHook(onUnmounted, unmounted);
|
|
2503
|
+
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
|
2504
|
+
if (shared.isArray(expose)) {
|
|
2505
|
+
if (expose.length) {
|
|
2506
|
+
const exposed = instance.exposed || (instance.exposed = {});
|
|
2507
|
+
expose.forEach((key) => {
|
|
2508
|
+
Object.defineProperty(exposed, key, {
|
|
2509
|
+
get: () => publicThis[key],
|
|
2510
|
+
set: (val) => publicThis[key] = val
|
|
2511
|
+
});
|
|
2512
|
+
});
|
|
2513
|
+
} else if (!instance.exposed) {
|
|
2514
|
+
instance.exposed = {};
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
if (render && instance.render === shared.NOOP) {
|
|
2518
|
+
instance.render = render;
|
|
2519
|
+
}
|
|
2520
|
+
if (inheritAttrs != null) {
|
|
2521
|
+
instance.inheritAttrs = inheritAttrs;
|
|
2522
|
+
}
|
|
2523
|
+
if (components) instance.components = components;
|
|
2524
|
+
if (directives) instance.directives = directives;
|
|
2525
|
+
}
|
|
2526
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
|
|
2527
|
+
if (shared.isArray(injectOptions)) {
|
|
2528
|
+
injectOptions = normalizeInject(injectOptions);
|
|
2529
|
+
}
|
|
2530
|
+
for (const key in injectOptions) {
|
|
2531
|
+
const opt = injectOptions[key];
|
|
2532
|
+
let injected;
|
|
2533
|
+
if (shared.isObject(opt)) {
|
|
2534
|
+
if ("default" in opt) {
|
|
2535
|
+
injected = inject(
|
|
2536
|
+
opt.from || key,
|
|
2537
|
+
opt.default,
|
|
2538
|
+
true
|
|
2539
|
+
);
|
|
2540
|
+
} else {
|
|
2541
|
+
injected = inject(opt.from || key);
|
|
2542
|
+
}
|
|
2543
|
+
} else {
|
|
2544
|
+
injected = inject(opt);
|
|
2545
|
+
}
|
|
2546
|
+
if (isRef(injected)) {
|
|
2547
|
+
Object.defineProperty(ctx, key, {
|
|
2548
|
+
enumerable: true,
|
|
2549
|
+
configurable: true,
|
|
2550
|
+
get: () => injected.value,
|
|
2551
|
+
set: (v) => injected.value = v
|
|
2552
|
+
});
|
|
2553
|
+
} else {
|
|
2554
|
+
ctx[key] = injected;
|
|
2555
|
+
}
|
|
2556
|
+
{
|
|
2557
|
+
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
function callHook(hook, instance, type) {
|
|
2562
|
+
callWithAsyncErrorHandling(
|
|
2563
|
+
shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
|
2564
|
+
instance,
|
|
2565
|
+
type
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
function createWatcher(raw, ctx, publicThis, key) {
|
|
2569
|
+
const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
2570
|
+
if (shared.isString(raw)) {
|
|
2571
|
+
const handler = ctx[raw];
|
|
2572
|
+
if (shared.isFunction(handler)) {
|
|
2573
|
+
watch(getter, handler);
|
|
2574
|
+
} else {
|
|
2575
|
+
warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
2576
|
+
}
|
|
2577
|
+
} else if (shared.isFunction(raw)) {
|
|
2578
|
+
watch(getter, raw.bind(publicThis));
|
|
2579
|
+
} else if (shared.isObject(raw)) {
|
|
2580
|
+
if (shared.isArray(raw)) {
|
|
2581
|
+
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
2582
|
+
} else {
|
|
2583
|
+
const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
2584
|
+
if (shared.isFunction(handler)) {
|
|
2585
|
+
watch(getter, handler, raw);
|
|
2586
|
+
} else {
|
|
2587
|
+
warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
} else {
|
|
2591
|
+
warn$1(`Invalid watch option: "${key}"`, raw);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
function resolveMergedOptions(instance) {
|
|
2595
|
+
const base = instance.type;
|
|
2596
|
+
const { mixins, extends: extendsOptions } = base;
|
|
2597
|
+
const {
|
|
2598
|
+
mixins: globalMixins,
|
|
2599
|
+
optionsCache: cache,
|
|
2600
|
+
config: { optionMergeStrategies }
|
|
2601
|
+
} = instance.appContext;
|
|
2602
|
+
const cached = cache.get(base);
|
|
2603
|
+
let resolved;
|
|
2604
|
+
if (cached) {
|
|
2605
|
+
resolved = cached;
|
|
2606
|
+
} else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2607
|
+
{
|
|
2608
|
+
resolved = base;
|
|
2609
|
+
}
|
|
2610
|
+
} else {
|
|
2611
|
+
resolved = {};
|
|
2612
|
+
if (globalMixins.length) {
|
|
2613
|
+
globalMixins.forEach(
|
|
2614
|
+
(m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2617
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2618
|
+
}
|
|
2619
|
+
if (shared.isObject(base)) {
|
|
2620
|
+
cache.set(base, resolved);
|
|
2621
|
+
}
|
|
2622
|
+
return resolved;
|
|
2623
|
+
}
|
|
2624
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2625
|
+
const { mixins, extends: extendsOptions } = from;
|
|
2626
|
+
if (extendsOptions) {
|
|
2627
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
2628
|
+
}
|
|
2629
|
+
if (mixins) {
|
|
2630
|
+
mixins.forEach(
|
|
2631
|
+
(m) => mergeOptions(to, m, strats, true)
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
for (const key in from) {
|
|
2635
|
+
if (asMixin && key === "expose") {
|
|
2636
|
+
warn$1(
|
|
2637
|
+
`"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
|
2638
|
+
);
|
|
2639
|
+
} else {
|
|
2640
|
+
const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
|
2641
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
return to;
|
|
2645
|
+
}
|
|
2646
|
+
const internalOptionMergeStrats = {
|
|
2647
|
+
data: mergeDataFn,
|
|
2648
|
+
props: mergeEmitsOrPropsOptions,
|
|
2649
|
+
emits: mergeEmitsOrPropsOptions,
|
|
2650
|
+
// objects
|
|
2651
|
+
methods: mergeObjectOptions,
|
|
2652
|
+
computed: mergeObjectOptions,
|
|
2653
|
+
// lifecycle
|
|
2654
|
+
beforeCreate: mergeAsArray,
|
|
2655
|
+
created: mergeAsArray,
|
|
2656
|
+
beforeMount: mergeAsArray,
|
|
2657
|
+
mounted: mergeAsArray,
|
|
2658
|
+
beforeUpdate: mergeAsArray,
|
|
2659
|
+
updated: mergeAsArray,
|
|
2660
|
+
beforeDestroy: mergeAsArray,
|
|
2661
|
+
beforeUnmount: mergeAsArray,
|
|
2662
|
+
destroyed: mergeAsArray,
|
|
2663
|
+
unmounted: mergeAsArray,
|
|
2664
|
+
activated: mergeAsArray,
|
|
2665
|
+
deactivated: mergeAsArray,
|
|
2666
|
+
errorCaptured: mergeAsArray,
|
|
2667
|
+
serverPrefetch: mergeAsArray,
|
|
2668
|
+
// assets
|
|
2669
|
+
components: mergeObjectOptions,
|
|
2670
|
+
directives: mergeObjectOptions,
|
|
2671
|
+
// watch
|
|
2672
|
+
watch: mergeWatchOptions,
|
|
2673
|
+
// provide / inject
|
|
2674
|
+
provide: mergeDataFn,
|
|
2675
|
+
inject: mergeInject
|
|
2676
|
+
};
|
|
2677
|
+
function mergeDataFn(to, from) {
|
|
2678
|
+
if (!from) {
|
|
2679
|
+
return to;
|
|
2680
|
+
}
|
|
2681
|
+
if (!to) {
|
|
2682
|
+
return from;
|
|
2683
|
+
}
|
|
2684
|
+
return function mergedDataFn() {
|
|
2685
|
+
return (shared.extend)(
|
|
2686
|
+
shared.isFunction(to) ? to.call(this, this) : to,
|
|
2687
|
+
shared.isFunction(from) ? from.call(this, this) : from
|
|
2688
|
+
);
|
|
2689
|
+
};
|
|
2690
|
+
}
|
|
2691
|
+
function mergeInject(to, from) {
|
|
2692
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2693
|
+
}
|
|
2694
|
+
function normalizeInject(raw) {
|
|
2695
|
+
if (shared.isArray(raw)) {
|
|
2696
|
+
const res = {};
|
|
2697
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2698
|
+
res[raw[i]] = raw[i];
|
|
2699
|
+
}
|
|
2700
|
+
return res;
|
|
2701
|
+
}
|
|
2702
|
+
return raw;
|
|
2703
|
+
}
|
|
2704
|
+
function mergeAsArray(to, from) {
|
|
2705
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
2706
|
+
}
|
|
2707
|
+
function mergeObjectOptions(to, from) {
|
|
2708
|
+
return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
|
2709
|
+
}
|
|
2710
|
+
function mergeEmitsOrPropsOptions(to, from) {
|
|
2711
|
+
if (to) {
|
|
2712
|
+
if (shared.isArray(to) && shared.isArray(from)) {
|
|
2713
|
+
return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
2714
|
+
}
|
|
2715
|
+
return shared.extend(
|
|
2716
|
+
/* @__PURE__ */ Object.create(null),
|
|
2717
|
+
normalizePropsOrEmits(to),
|
|
2718
|
+
normalizePropsOrEmits(from != null ? from : {})
|
|
2719
|
+
);
|
|
2720
|
+
} else {
|
|
2721
|
+
return from;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
function mergeWatchOptions(to, from) {
|
|
2725
|
+
if (!to) return from;
|
|
2726
|
+
if (!from) return to;
|
|
2727
|
+
const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
|
|
2728
|
+
for (const key in from) {
|
|
2729
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
2730
|
+
}
|
|
2731
|
+
return merged;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
function createAppContext() {
|
|
2735
|
+
return {
|
|
2736
|
+
app: null,
|
|
2737
|
+
config: {
|
|
2738
|
+
isNativeTag: shared.NO,
|
|
2739
|
+
performance: false,
|
|
2740
|
+
globalProperties: {},
|
|
2741
|
+
optionMergeStrategies: {},
|
|
2742
|
+
errorHandler: void 0,
|
|
2743
|
+
warnHandler: void 0,
|
|
2744
|
+
compilerOptions: {}
|
|
2745
|
+
},
|
|
2746
|
+
mixins: [],
|
|
2747
|
+
components: {},
|
|
2748
|
+
directives: {},
|
|
2749
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
2750
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
2751
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
2752
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
2753
|
+
};
|
|
2754
|
+
}
|
|
2755
|
+
let currentApp = null;
|
|
2756
|
+
|
|
2757
|
+
function provide(key, value) {
|
|
2758
|
+
if (!currentInstance) {
|
|
2759
|
+
{
|
|
2760
|
+
warn$1(`provide() can only be used inside setup().`);
|
|
2761
|
+
}
|
|
2762
|
+
} else {
|
|
2763
|
+
let provides = currentInstance.provides;
|
|
2764
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
2765
|
+
if (parentProvides === provides) {
|
|
2766
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
2767
|
+
}
|
|
2768
|
+
provides[key] = value;
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
2772
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
2773
|
+
if (instance || currentApp) {
|
|
2774
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
2775
|
+
if (provides && key in provides) {
|
|
2776
|
+
return provides[key];
|
|
2777
|
+
} else if (arguments.length > 1) {
|
|
2778
|
+
return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
2779
|
+
} else {
|
|
2780
|
+
warn$1(`injection "${String(key)}" not found.`);
|
|
2781
|
+
}
|
|
2782
|
+
} else {
|
|
2783
|
+
warn$1(`inject() can only be used inside setup() or functional components.`);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
const internalObjectProto = {};
|
|
2788
|
+
const createInternalObject = () => Object.create(internalObjectProto);
|
|
2789
|
+
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
2790
|
+
|
|
2791
|
+
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
2792
|
+
const props = {};
|
|
2793
|
+
const attrs = createInternalObject();
|
|
2794
|
+
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
2795
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
2796
|
+
for (const key in instance.propsOptions[0]) {
|
|
2797
|
+
if (!(key in props)) {
|
|
2798
|
+
props[key] = void 0;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
{
|
|
2802
|
+
validateProps(rawProps || {}, props, instance);
|
|
2803
|
+
}
|
|
2804
|
+
if (isStateful) {
|
|
2805
|
+
instance.props = isSSR ? props : shallowReactive(props);
|
|
2806
|
+
} else {
|
|
2807
|
+
if (!instance.type.props) {
|
|
2808
|
+
instance.props = attrs;
|
|
2809
|
+
} else {
|
|
2810
|
+
instance.props = props;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
instance.attrs = attrs;
|
|
2814
|
+
}
|
|
2815
|
+
function setFullProps(instance, rawProps, props, attrs) {
|
|
2816
|
+
const [options, needCastKeys] = instance.propsOptions;
|
|
2817
|
+
let hasAttrsChanged = false;
|
|
2818
|
+
let rawCastValues;
|
|
2819
|
+
if (rawProps) {
|
|
2820
|
+
for (let key in rawProps) {
|
|
2821
|
+
if (shared.isReservedProp(key)) {
|
|
2822
|
+
continue;
|
|
2823
|
+
}
|
|
2824
|
+
const value = rawProps[key];
|
|
2825
|
+
let camelKey;
|
|
2826
|
+
if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
|
|
2827
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
|
2828
|
+
props[camelKey] = value;
|
|
2829
|
+
} else {
|
|
2830
|
+
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
2831
|
+
}
|
|
2832
|
+
} else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2833
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
2834
|
+
attrs[key] = value;
|
|
2835
|
+
hasAttrsChanged = true;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
if (needCastKeys) {
|
|
2841
|
+
const rawCurrentProps = toRaw(props);
|
|
2842
|
+
const castValues = rawCastValues || shared.EMPTY_OBJ;
|
|
2843
|
+
for (let i = 0; i < needCastKeys.length; i++) {
|
|
2844
|
+
const key = needCastKeys[i];
|
|
2845
|
+
props[key] = resolvePropValue(
|
|
2846
|
+
options,
|
|
2847
|
+
rawCurrentProps,
|
|
2848
|
+
key,
|
|
2849
|
+
castValues[key],
|
|
2850
|
+
instance,
|
|
2851
|
+
!shared.hasOwn(castValues, key)
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
return hasAttrsChanged;
|
|
2856
|
+
}
|
|
2857
|
+
function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
2858
|
+
const opt = options[key];
|
|
2859
|
+
if (opt != null) {
|
|
2860
|
+
const hasDefault = shared.hasOwn(opt, "default");
|
|
2861
|
+
if (hasDefault && value === void 0) {
|
|
2862
|
+
const defaultValue = opt.default;
|
|
2863
|
+
if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
|
|
2864
|
+
const { propsDefaults } = instance;
|
|
2865
|
+
if (key in propsDefaults) {
|
|
2866
|
+
value = propsDefaults[key];
|
|
2867
|
+
} else {
|
|
2868
|
+
const reset = setCurrentInstance(instance);
|
|
2869
|
+
value = propsDefaults[key] = defaultValue.call(
|
|
2870
|
+
null,
|
|
2871
|
+
props
|
|
2872
|
+
);
|
|
2873
|
+
reset();
|
|
2874
|
+
}
|
|
2875
|
+
} else {
|
|
2876
|
+
value = defaultValue;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
if (opt[0 /* shouldCast */]) {
|
|
2880
|
+
if (isAbsent && !hasDefault) {
|
|
2881
|
+
value = false;
|
|
2882
|
+
} else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
|
|
2883
|
+
value = true;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
return value;
|
|
2888
|
+
}
|
|
2889
|
+
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
2890
|
+
const cache = appContext.propsCache;
|
|
2891
|
+
const cached = cache.get(comp);
|
|
2892
|
+
if (cached) {
|
|
2893
|
+
return cached;
|
|
2894
|
+
}
|
|
2895
|
+
const raw = comp.props;
|
|
2896
|
+
const normalized = {};
|
|
2897
|
+
const needCastKeys = [];
|
|
2898
|
+
let hasExtends = false;
|
|
2899
|
+
if (!shared.isFunction(comp)) {
|
|
2900
|
+
const extendProps = (raw2) => {
|
|
2901
|
+
hasExtends = true;
|
|
2902
|
+
const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
|
2903
|
+
shared.extend(normalized, props);
|
|
2904
|
+
if (keys) needCastKeys.push(...keys);
|
|
2905
|
+
};
|
|
2906
|
+
if (!asMixin && appContext.mixins.length) {
|
|
2907
|
+
appContext.mixins.forEach(extendProps);
|
|
2908
|
+
}
|
|
2909
|
+
if (comp.extends) {
|
|
2910
|
+
extendProps(comp.extends);
|
|
2911
|
+
}
|
|
2912
|
+
if (comp.mixins) {
|
|
2913
|
+
comp.mixins.forEach(extendProps);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
if (!raw && !hasExtends) {
|
|
2917
|
+
if (shared.isObject(comp)) {
|
|
2918
|
+
cache.set(comp, shared.EMPTY_ARR);
|
|
2919
|
+
}
|
|
2920
|
+
return shared.EMPTY_ARR;
|
|
2921
|
+
}
|
|
2922
|
+
if (shared.isArray(raw)) {
|
|
2923
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2924
|
+
if (!shared.isString(raw[i])) {
|
|
2925
|
+
warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
2926
|
+
}
|
|
2927
|
+
const normalizedKey = shared.camelize(raw[i]);
|
|
2928
|
+
if (validatePropName(normalizedKey)) {
|
|
2929
|
+
normalized[normalizedKey] = shared.EMPTY_OBJ;
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
} else if (raw) {
|
|
2933
|
+
if (!shared.isObject(raw)) {
|
|
2934
|
+
warn$1(`invalid props options`, raw);
|
|
2935
|
+
}
|
|
2936
|
+
for (const key in raw) {
|
|
2937
|
+
const normalizedKey = shared.camelize(key);
|
|
2938
|
+
if (validatePropName(normalizedKey)) {
|
|
2939
|
+
const opt = raw[key];
|
|
2940
|
+
const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
|
|
2941
|
+
if (prop) {
|
|
2942
|
+
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
2943
|
+
const stringIndex = getTypeIndex(String, prop.type);
|
|
2944
|
+
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
2945
|
+
prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
|
|
2946
|
+
if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
|
|
2947
|
+
needCastKeys.push(normalizedKey);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
const res = [normalized, needCastKeys];
|
|
2954
|
+
if (shared.isObject(comp)) {
|
|
2955
|
+
cache.set(comp, res);
|
|
2956
|
+
}
|
|
2957
|
+
return res;
|
|
2958
|
+
}
|
|
2959
|
+
function validatePropName(key) {
|
|
2960
|
+
if (key[0] !== "$" && !shared.isReservedProp(key)) {
|
|
2961
|
+
return true;
|
|
2962
|
+
} else {
|
|
2963
|
+
warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
|
2964
|
+
}
|
|
2965
|
+
return false;
|
|
2966
|
+
}
|
|
2967
|
+
function getType(ctor) {
|
|
2968
|
+
if (ctor === null) {
|
|
2969
|
+
return "null";
|
|
2970
|
+
}
|
|
2971
|
+
if (typeof ctor === "function") {
|
|
2972
|
+
return ctor.name || "";
|
|
2973
|
+
} else if (typeof ctor === "object") {
|
|
2974
|
+
const name = ctor.constructor && ctor.constructor.name;
|
|
2975
|
+
return name || "";
|
|
2976
|
+
}
|
|
2977
|
+
return "";
|
|
2978
|
+
}
|
|
2979
|
+
function isSameType(a, b) {
|
|
2980
|
+
return getType(a) === getType(b);
|
|
2981
|
+
}
|
|
2982
|
+
function getTypeIndex(type, expectedTypes) {
|
|
2983
|
+
if (shared.isArray(expectedTypes)) {
|
|
2984
|
+
return expectedTypes.findIndex((t) => isSameType(t, type));
|
|
2985
|
+
} else if (shared.isFunction(expectedTypes)) {
|
|
2986
|
+
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
2987
|
+
}
|
|
2988
|
+
return -1;
|
|
2989
|
+
}
|
|
2990
|
+
function validateProps(rawProps, props, instance) {
|
|
2991
|
+
const resolvedValues = toRaw(props);
|
|
2992
|
+
const options = instance.propsOptions[0];
|
|
2993
|
+
for (const key in options) {
|
|
2994
|
+
let opt = options[key];
|
|
2995
|
+
if (opt == null) continue;
|
|
2996
|
+
validateProp(
|
|
2997
|
+
key,
|
|
2998
|
+
resolvedValues[key],
|
|
2999
|
+
opt,
|
|
3000
|
+
shallowReadonly(resolvedValues) ,
|
|
3001
|
+
!shared.hasOwn(rawProps, key) && !shared.hasOwn(rawProps, shared.hyphenate(key))
|
|
3002
|
+
);
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
function validateProp(name, value, prop, props, isAbsent) {
|
|
3006
|
+
const { type, required, validator, skipCheck } = prop;
|
|
3007
|
+
if (required && isAbsent) {
|
|
3008
|
+
warn$1('Missing required prop: "' + name + '"');
|
|
3009
|
+
return;
|
|
3010
|
+
}
|
|
3011
|
+
if (value == null && !required) {
|
|
3012
|
+
return;
|
|
3013
|
+
}
|
|
3014
|
+
if (type != null && type !== true && !skipCheck) {
|
|
3015
|
+
let isValid = false;
|
|
3016
|
+
const types = shared.isArray(type) ? type : [type];
|
|
3017
|
+
const expectedTypes = [];
|
|
3018
|
+
for (let i = 0; i < types.length && !isValid; i++) {
|
|
3019
|
+
const { valid, expectedType } = assertType(value, types[i]);
|
|
3020
|
+
expectedTypes.push(expectedType || "");
|
|
3021
|
+
isValid = valid;
|
|
3022
|
+
}
|
|
3023
|
+
if (!isValid) {
|
|
3024
|
+
warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
|
3025
|
+
return;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
if (validator && !validator(value, props)) {
|
|
3029
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
const isSimpleType = /* @__PURE__ */ shared.makeMap(
|
|
3033
|
+
"String,Number,Boolean,Function,Symbol,BigInt"
|
|
3034
|
+
);
|
|
3035
|
+
function assertType(value, type) {
|
|
3036
|
+
let valid;
|
|
3037
|
+
const expectedType = getType(type);
|
|
3038
|
+
if (isSimpleType(expectedType)) {
|
|
3039
|
+
const t = typeof value;
|
|
3040
|
+
valid = t === expectedType.toLowerCase();
|
|
3041
|
+
if (!valid && t === "object") {
|
|
3042
|
+
valid = value instanceof type;
|
|
3043
|
+
}
|
|
3044
|
+
} else if (expectedType === "Object") {
|
|
3045
|
+
valid = shared.isObject(value);
|
|
3046
|
+
} else if (expectedType === "Array") {
|
|
3047
|
+
valid = shared.isArray(value);
|
|
3048
|
+
} else if (expectedType === "null") {
|
|
3049
|
+
valid = value === null;
|
|
3050
|
+
} else {
|
|
3051
|
+
valid = value instanceof type;
|
|
3052
|
+
}
|
|
3053
|
+
return {
|
|
3054
|
+
valid,
|
|
3055
|
+
expectedType
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3058
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
3059
|
+
if (expectedTypes.length === 0) {
|
|
3060
|
+
return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
|
3061
|
+
}
|
|
3062
|
+
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
|
|
3063
|
+
const expectedType = expectedTypes[0];
|
|
3064
|
+
const receivedType = shared.toRawType(value);
|
|
3065
|
+
const expectedValue = styleValue(value, expectedType);
|
|
3066
|
+
const receivedValue = styleValue(value, receivedType);
|
|
3067
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
|
3068
|
+
message += ` with value ${expectedValue}`;
|
|
3069
|
+
}
|
|
3070
|
+
message += `, got ${receivedType} `;
|
|
3071
|
+
if (isExplicable(receivedType)) {
|
|
3072
|
+
message += `with value ${receivedValue}.`;
|
|
3073
|
+
}
|
|
3074
|
+
return message;
|
|
3075
|
+
}
|
|
3076
|
+
function styleValue(value, type) {
|
|
3077
|
+
if (type === "String") {
|
|
3078
|
+
return `"${value}"`;
|
|
3079
|
+
} else if (type === "Number") {
|
|
3080
|
+
return `${Number(value)}`;
|
|
3081
|
+
} else {
|
|
3082
|
+
return `${value}`;
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
function isExplicable(type) {
|
|
3086
|
+
const explicitTypes = ["string", "number", "boolean"];
|
|
3087
|
+
return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
|
3088
|
+
}
|
|
3089
|
+
function isBoolean(...args) {
|
|
3090
|
+
return args.some((elem) => elem.toLowerCase() === "boolean");
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
3094
|
+
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode$1) : [normalizeVNode$1(value)];
|
|
3095
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3096
|
+
if (rawSlot._n) {
|
|
3097
|
+
return rawSlot;
|
|
3098
|
+
}
|
|
3099
|
+
const normalized = withCtx((...args) => {
|
|
3100
|
+
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
|
3101
|
+
warn$1(
|
|
3102
|
+
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
|
|
3103
|
+
);
|
|
3104
|
+
}
|
|
3105
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
3106
|
+
}, ctx);
|
|
3107
|
+
normalized._c = false;
|
|
3108
|
+
return normalized;
|
|
3109
|
+
};
|
|
3110
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
3111
|
+
const ctx = rawSlots._ctx;
|
|
3112
|
+
for (const key in rawSlots) {
|
|
3113
|
+
if (isInternalKey(key)) continue;
|
|
3114
|
+
const value = rawSlots[key];
|
|
3115
|
+
if (shared.isFunction(value)) {
|
|
3116
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
3117
|
+
} else if (value != null) {
|
|
3118
|
+
{
|
|
3119
|
+
warn$1(
|
|
3120
|
+
`Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
|
3121
|
+
);
|
|
3122
|
+
}
|
|
3123
|
+
const normalized = normalizeSlotValue(value);
|
|
3124
|
+
slots[key] = () => normalized;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
3129
|
+
if (!isKeepAlive(instance.vnode) && true) {
|
|
3130
|
+
warn$1(
|
|
3131
|
+
`Non-function value encountered for default slot. Prefer function slots for better performance.`
|
|
3132
|
+
);
|
|
3133
|
+
}
|
|
3134
|
+
const normalized = normalizeSlotValue(children);
|
|
3135
|
+
instance.slots.default = () => normalized;
|
|
3136
|
+
};
|
|
3137
|
+
const initSlots = (instance, children) => {
|
|
3138
|
+
const slots = instance.slots = createInternalObject();
|
|
3139
|
+
if (instance.vnode.shapeFlag & 32) {
|
|
3140
|
+
const type = children._;
|
|
3141
|
+
if (type) {
|
|
3142
|
+
shared.extend(slots, children);
|
|
3143
|
+
shared.def(slots, "_", type, true);
|
|
3144
|
+
} else {
|
|
3145
|
+
normalizeObjectSlots(children, slots);
|
|
3146
|
+
}
|
|
3147
|
+
} else if (children) {
|
|
3148
|
+
normalizeVNodeSlots(instance, children);
|
|
3149
|
+
}
|
|
3150
|
+
};
|
|
3151
|
+
|
|
3152
|
+
let supported;
|
|
3153
|
+
let perf;
|
|
3154
|
+
function startMeasure(instance, type) {
|
|
3155
|
+
if (instance.appContext.config.performance && isSupported()) {
|
|
3156
|
+
perf.mark(`vue-${type}-${instance.uid}`);
|
|
3157
|
+
}
|
|
3158
|
+
{
|
|
3159
|
+
devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
function endMeasure(instance, type) {
|
|
3163
|
+
if (instance.appContext.config.performance && isSupported()) {
|
|
3164
|
+
const startTag = `vue-${type}-${instance.uid}`;
|
|
3165
|
+
const endTag = startTag + `:end`;
|
|
3166
|
+
perf.mark(endTag);
|
|
3167
|
+
perf.measure(
|
|
3168
|
+
`<${formatComponentName(instance, instance.type)}> ${type}`,
|
|
3169
|
+
startTag,
|
|
3170
|
+
endTag
|
|
3171
|
+
);
|
|
3172
|
+
perf.clearMarks(startTag);
|
|
3173
|
+
perf.clearMarks(endTag);
|
|
3174
|
+
}
|
|
3175
|
+
{
|
|
3176
|
+
devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
function isSupported() {
|
|
3180
|
+
if (supported !== void 0) {
|
|
3181
|
+
return supported;
|
|
3182
|
+
}
|
|
3183
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
3184
|
+
supported = true;
|
|
3185
|
+
perf = window.performance;
|
|
3186
|
+
} else {
|
|
3187
|
+
supported = false;
|
|
3188
|
+
}
|
|
3189
|
+
return supported;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
const queuePostRenderEffect = queueEffectWithSuspense ;
|
|
3193
|
+
|
|
3194
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
3195
|
+
const useSSRContext = () => {
|
|
3196
|
+
{
|
|
3197
|
+
const ctx = inject(ssrContextKey);
|
|
3198
|
+
if (!ctx) {
|
|
3199
|
+
warn$1(
|
|
3200
|
+
`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
|
|
3201
|
+
);
|
|
3202
|
+
}
|
|
3203
|
+
return ctx;
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
3208
|
+
function watch(source, cb, options) {
|
|
3209
|
+
if (!shared.isFunction(cb)) {
|
|
3210
|
+
warn$1(
|
|
3211
|
+
`\`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.`
|
|
3212
|
+
);
|
|
3213
|
+
}
|
|
3214
|
+
return doWatch(source, cb, options);
|
|
3215
|
+
}
|
|
3216
|
+
function doWatch(source, cb, {
|
|
3217
|
+
immediate,
|
|
3218
|
+
deep,
|
|
3219
|
+
flush,
|
|
3220
|
+
once,
|
|
3221
|
+
onTrack,
|
|
3222
|
+
onTrigger
|
|
3223
|
+
} = shared.EMPTY_OBJ) {
|
|
3224
|
+
if (cb && once) {
|
|
3225
|
+
const _cb = cb;
|
|
3226
|
+
cb = (...args) => {
|
|
3227
|
+
_cb(...args);
|
|
3228
|
+
unwatch();
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3231
|
+
if (deep !== void 0 && typeof deep === "number") {
|
|
3232
|
+
warn$1(
|
|
3233
|
+
`watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
if (!cb) {
|
|
3237
|
+
if (immediate !== void 0) {
|
|
3238
|
+
warn$1(
|
|
3239
|
+
`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3240
|
+
);
|
|
3241
|
+
}
|
|
3242
|
+
if (deep !== void 0) {
|
|
3243
|
+
warn$1(
|
|
3244
|
+
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3245
|
+
);
|
|
3246
|
+
}
|
|
3247
|
+
if (once !== void 0) {
|
|
3248
|
+
warn$1(
|
|
3249
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3250
|
+
);
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
const warnInvalidSource = (s) => {
|
|
3254
|
+
warn$1(
|
|
3255
|
+
`Invalid watch source: `,
|
|
3256
|
+
s,
|
|
3257
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
3258
|
+
);
|
|
3259
|
+
};
|
|
3260
|
+
const instance = currentInstance;
|
|
3261
|
+
const reactiveGetter = (source2) => deep === true ? source2 : (
|
|
3262
|
+
// for deep: false, only traverse root-level properties
|
|
3263
|
+
traverse(source2, deep === false ? 1 : void 0)
|
|
3264
|
+
);
|
|
3265
|
+
let getter;
|
|
3266
|
+
let forceTrigger = false;
|
|
3267
|
+
let isMultiSource = false;
|
|
3268
|
+
if (isRef(source)) {
|
|
3269
|
+
getter = () => source.value;
|
|
3270
|
+
forceTrigger = isShallow(source);
|
|
3271
|
+
} else if (isReactive(source)) {
|
|
3272
|
+
getter = () => reactiveGetter(source);
|
|
3273
|
+
forceTrigger = true;
|
|
3274
|
+
} else if (shared.isArray(source)) {
|
|
3275
|
+
isMultiSource = true;
|
|
3276
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
3277
|
+
getter = () => source.map((s) => {
|
|
3278
|
+
if (isRef(s)) {
|
|
3279
|
+
return s.value;
|
|
3280
|
+
} else if (isReactive(s)) {
|
|
3281
|
+
return reactiveGetter(s);
|
|
3282
|
+
} else if (shared.isFunction(s)) {
|
|
3283
|
+
return callWithErrorHandling(s, instance, 2);
|
|
3284
|
+
} else {
|
|
3285
|
+
warnInvalidSource(s);
|
|
3286
|
+
}
|
|
3287
|
+
});
|
|
3288
|
+
} else if (shared.isFunction(source)) {
|
|
3289
|
+
if (cb) {
|
|
3290
|
+
getter = () => callWithErrorHandling(source, instance, 2);
|
|
3291
|
+
} else {
|
|
3292
|
+
getter = () => {
|
|
3293
|
+
if (cleanup) {
|
|
3294
|
+
cleanup();
|
|
3295
|
+
}
|
|
3296
|
+
return callWithAsyncErrorHandling(
|
|
3297
|
+
source,
|
|
3298
|
+
instance,
|
|
3299
|
+
3,
|
|
3300
|
+
[onCleanup]
|
|
3301
|
+
);
|
|
3302
|
+
};
|
|
3303
|
+
}
|
|
3304
|
+
} else {
|
|
3305
|
+
getter = shared.NOOP;
|
|
3306
|
+
warnInvalidSource(source);
|
|
3307
|
+
}
|
|
3308
|
+
if (cb && deep) {
|
|
3309
|
+
const baseGetter = getter;
|
|
3310
|
+
getter = () => traverse(baseGetter());
|
|
3311
|
+
}
|
|
3312
|
+
let cleanup;
|
|
3313
|
+
let onCleanup = (fn) => {
|
|
3314
|
+
cleanup = effect.onStop = () => {
|
|
3315
|
+
callWithErrorHandling(fn, instance, 4);
|
|
3316
|
+
cleanup = effect.onStop = void 0;
|
|
3317
|
+
};
|
|
3318
|
+
};
|
|
3319
|
+
let ssrCleanup;
|
|
3320
|
+
if (isInSSRComponentSetup) {
|
|
3321
|
+
onCleanup = shared.NOOP;
|
|
3322
|
+
if (!cb) {
|
|
3323
|
+
getter();
|
|
3324
|
+
} else if (immediate) {
|
|
3325
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3326
|
+
getter(),
|
|
3327
|
+
isMultiSource ? [] : void 0,
|
|
3328
|
+
onCleanup
|
|
3329
|
+
]);
|
|
3330
|
+
}
|
|
3331
|
+
if (flush === "sync") {
|
|
3332
|
+
const ctx = useSSRContext();
|
|
3333
|
+
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
3334
|
+
} else {
|
|
3335
|
+
return shared.NOOP;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3339
|
+
const job = () => {
|
|
3340
|
+
if (!effect.active || !effect.dirty) {
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
if (cb) {
|
|
3344
|
+
const newValue = effect.run();
|
|
3345
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
|
|
3346
|
+
if (cleanup) {
|
|
3347
|
+
cleanup();
|
|
3348
|
+
}
|
|
3349
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3350
|
+
newValue,
|
|
3351
|
+
// pass undefined as the old value when it's changed for the first time
|
|
3352
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
3353
|
+
onCleanup
|
|
3354
|
+
]);
|
|
3355
|
+
oldValue = newValue;
|
|
3356
|
+
}
|
|
3357
|
+
} else {
|
|
3358
|
+
effect.run();
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
job.allowRecurse = !!cb;
|
|
3362
|
+
let scheduler;
|
|
3363
|
+
if (flush === "sync") {
|
|
3364
|
+
scheduler = job;
|
|
3365
|
+
} else if (flush === "post") {
|
|
3366
|
+
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3367
|
+
} else {
|
|
3368
|
+
job.pre = true;
|
|
3369
|
+
if (instance) job.id = instance.uid;
|
|
3370
|
+
scheduler = () => queueJob(job);
|
|
3371
|
+
}
|
|
3372
|
+
const effect = new ReactiveEffect(getter, shared.NOOP, scheduler);
|
|
3373
|
+
const scope = getCurrentScope();
|
|
3374
|
+
const unwatch = () => {
|
|
3375
|
+
effect.stop();
|
|
3376
|
+
if (scope) {
|
|
3377
|
+
shared.remove(scope.effects, effect);
|
|
3378
|
+
}
|
|
3379
|
+
};
|
|
3380
|
+
{
|
|
3381
|
+
effect.onTrack = onTrack;
|
|
3382
|
+
effect.onTrigger = onTrigger;
|
|
3383
|
+
}
|
|
3384
|
+
if (cb) {
|
|
3385
|
+
if (immediate) {
|
|
3386
|
+
job();
|
|
3387
|
+
} else {
|
|
3388
|
+
oldValue = effect.run();
|
|
3389
|
+
}
|
|
3390
|
+
} else if (flush === "post") {
|
|
3391
|
+
queuePostRenderEffect(
|
|
3392
|
+
effect.run.bind(effect),
|
|
3393
|
+
instance && instance.suspense
|
|
3394
|
+
);
|
|
3395
|
+
} else {
|
|
3396
|
+
effect.run();
|
|
3397
|
+
}
|
|
3398
|
+
if (ssrCleanup) ssrCleanup.push(unwatch);
|
|
3399
|
+
return unwatch;
|
|
3400
|
+
}
|
|
3401
|
+
function instanceWatch(source, value, options) {
|
|
3402
|
+
const publicThis = this.proxy;
|
|
3403
|
+
const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
|
3404
|
+
let cb;
|
|
3405
|
+
if (shared.isFunction(value)) {
|
|
3406
|
+
cb = value;
|
|
3407
|
+
} else {
|
|
3408
|
+
cb = value.handler;
|
|
3409
|
+
options = value;
|
|
3410
|
+
}
|
|
3411
|
+
const reset = setCurrentInstance(this);
|
|
3412
|
+
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
3413
|
+
reset();
|
|
3414
|
+
return res;
|
|
3415
|
+
}
|
|
3416
|
+
function createPathGetter(ctx, path) {
|
|
3417
|
+
const segments = path.split(".");
|
|
3418
|
+
return () => {
|
|
3419
|
+
let cur = ctx;
|
|
3420
|
+
for (let i = 0; i < segments.length && cur; i++) {
|
|
3421
|
+
cur = cur[segments[i]];
|
|
3422
|
+
}
|
|
3423
|
+
return cur;
|
|
3424
|
+
};
|
|
3425
|
+
}
|
|
3426
|
+
function traverse(value, depth = Infinity, seen) {
|
|
3427
|
+
if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
|
|
3428
|
+
return value;
|
|
3429
|
+
}
|
|
3430
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
3431
|
+
if (seen.has(value)) {
|
|
3432
|
+
return value;
|
|
3433
|
+
}
|
|
3434
|
+
seen.add(value);
|
|
3435
|
+
depth--;
|
|
3436
|
+
if (isRef(value)) {
|
|
3437
|
+
traverse(value.value, depth, seen);
|
|
3438
|
+
} else if (shared.isArray(value)) {
|
|
3439
|
+
for (let i = 0; i < value.length; i++) {
|
|
3440
|
+
traverse(value[i], depth, seen);
|
|
3441
|
+
}
|
|
3442
|
+
} else if (shared.isSet(value) || shared.isMap(value)) {
|
|
3443
|
+
value.forEach((v) => {
|
|
3444
|
+
traverse(v, depth, seen);
|
|
3445
|
+
});
|
|
3446
|
+
} else if (shared.isPlainObject(value)) {
|
|
3447
|
+
for (const key in value) {
|
|
3448
|
+
traverse(value[key], depth, seen);
|
|
3449
|
+
}
|
|
3450
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
3451
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
3452
|
+
traverse(value[key], depth, seen);
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
return value;
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
3460
|
+
function onActivated(hook, target) {
|
|
3461
|
+
registerKeepAliveHook(hook, "a", target);
|
|
3462
|
+
}
|
|
3463
|
+
function onDeactivated(hook, target) {
|
|
3464
|
+
registerKeepAliveHook(hook, "da", target);
|
|
3465
|
+
}
|
|
3466
|
+
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
3467
|
+
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
3468
|
+
let current = target;
|
|
3469
|
+
while (current) {
|
|
3470
|
+
if (current.isDeactivated) {
|
|
3471
|
+
return;
|
|
3472
|
+
}
|
|
3473
|
+
current = current.parent;
|
|
3474
|
+
}
|
|
3475
|
+
return hook();
|
|
3476
|
+
});
|
|
3477
|
+
injectHook(type, wrappedHook, target);
|
|
3478
|
+
if (target) {
|
|
3479
|
+
let current = target.parent;
|
|
3480
|
+
while (current && current.parent) {
|
|
3481
|
+
if (isKeepAlive(current.parent.vnode)) {
|
|
3482
|
+
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
3483
|
+
}
|
|
3484
|
+
current = current.parent;
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
3489
|
+
const injected = injectHook(
|
|
3490
|
+
type,
|
|
3491
|
+
hook,
|
|
3492
|
+
keepAliveRoot,
|
|
3493
|
+
true
|
|
3494
|
+
/* prepend */
|
|
3495
|
+
);
|
|
3496
|
+
onUnmounted(() => {
|
|
3497
|
+
shared.remove(keepAliveRoot[type], injected);
|
|
3498
|
+
}, target);
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
function setTransitionHooks(vnode, hooks) {
|
|
3502
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
3503
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
3504
|
+
} else if (vnode.shapeFlag & 128) {
|
|
3505
|
+
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
3506
|
+
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
3507
|
+
} else {
|
|
3508
|
+
vnode.transition = hooks;
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
3513
|
+
|
|
3514
|
+
const Fragment = Symbol.for("v-fgt");
|
|
3515
|
+
const Text = Symbol.for("v-txt");
|
|
3516
|
+
const Comment = Symbol.for("v-cmt");
|
|
3517
|
+
let currentBlock = null;
|
|
3518
|
+
let isBlockTreeEnabled = 1;
|
|
3519
|
+
function setBlockTracking(value) {
|
|
3520
|
+
isBlockTreeEnabled += value;
|
|
3521
|
+
}
|
|
3522
|
+
function isVNode$2(value) {
|
|
3523
|
+
return value ? value.__v_isVNode === true : false;
|
|
3524
|
+
}
|
|
3525
|
+
const createVNodeWithArgsTransform = (...args) => {
|
|
3526
|
+
return _createVNode(
|
|
3527
|
+
...args
|
|
3528
|
+
);
|
|
3529
|
+
};
|
|
3530
|
+
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
3531
|
+
const normalizeRef = ({
|
|
3532
|
+
ref,
|
|
3533
|
+
ref_key,
|
|
3534
|
+
ref_for
|
|
3535
|
+
}) => {
|
|
3536
|
+
if (typeof ref === "number") {
|
|
3537
|
+
ref = "" + ref;
|
|
3538
|
+
}
|
|
3539
|
+
return ref != null ? shared.isString(ref) || isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
|
3540
|
+
};
|
|
3541
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
3542
|
+
const vnode = {
|
|
3543
|
+
__v_isVNode: true,
|
|
3544
|
+
__v_skip: true,
|
|
3545
|
+
type,
|
|
3546
|
+
props,
|
|
3547
|
+
key: props && normalizeKey(props),
|
|
3548
|
+
ref: props && normalizeRef(props),
|
|
3549
|
+
scopeId: currentScopeId,
|
|
3550
|
+
slotScopeIds: null,
|
|
3551
|
+
children,
|
|
3552
|
+
component: null,
|
|
3553
|
+
suspense: null,
|
|
3554
|
+
ssContent: null,
|
|
3555
|
+
ssFallback: null,
|
|
3556
|
+
dirs: null,
|
|
3557
|
+
transition: null,
|
|
3558
|
+
el: null,
|
|
3559
|
+
anchor: null,
|
|
3560
|
+
target: null,
|
|
3561
|
+
targetAnchor: null,
|
|
3562
|
+
staticCount: 0,
|
|
3563
|
+
shapeFlag,
|
|
3564
|
+
patchFlag,
|
|
3565
|
+
dynamicProps,
|
|
3566
|
+
dynamicChildren: null,
|
|
3567
|
+
appContext: null,
|
|
3568
|
+
ctx: currentRenderingInstance
|
|
3569
|
+
};
|
|
3570
|
+
if (needFullChildrenNormalization) {
|
|
3571
|
+
normalizeChildren(vnode, children);
|
|
3572
|
+
if (shapeFlag & 128) {
|
|
3573
|
+
type.normalize(vnode);
|
|
3574
|
+
}
|
|
3575
|
+
} else if (children) {
|
|
3576
|
+
vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
|
|
3577
|
+
}
|
|
3578
|
+
if (vnode.key !== vnode.key) {
|
|
3579
|
+
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
3580
|
+
}
|
|
3581
|
+
if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
|
|
3582
|
+
!isBlockNode && // has current parent block
|
|
3583
|
+
currentBlock && // presence of a patch flag indicates this node needs patching on updates.
|
|
3584
|
+
// component nodes also should always be patched, because even if the
|
|
3585
|
+
// component doesn't need to update, it needs to persist the instance on to
|
|
3586
|
+
// the next vnode so that it can be properly unmounted later.
|
|
3587
|
+
(vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
|
|
3588
|
+
// vnode should not be considered dynamic due to handler caching.
|
|
3589
|
+
vnode.patchFlag !== 32) {
|
|
3590
|
+
currentBlock.push(vnode);
|
|
3591
|
+
}
|
|
3592
|
+
return vnode;
|
|
3593
|
+
}
|
|
3594
|
+
const createVNode = createVNodeWithArgsTransform ;
|
|
3595
|
+
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
3596
|
+
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
3597
|
+
if (!type) {
|
|
3598
|
+
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
3599
|
+
}
|
|
3600
|
+
type = Comment;
|
|
3601
|
+
}
|
|
3602
|
+
if (isVNode$2(type)) {
|
|
3603
|
+
const cloned = cloneVNode(
|
|
3604
|
+
type,
|
|
3605
|
+
props,
|
|
3606
|
+
true
|
|
3607
|
+
/* mergeRef: true */
|
|
3608
|
+
);
|
|
3609
|
+
if (children) {
|
|
3610
|
+
normalizeChildren(cloned, children);
|
|
3611
|
+
}
|
|
3612
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
3613
|
+
if (cloned.shapeFlag & 6) {
|
|
3614
|
+
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
3615
|
+
} else {
|
|
3616
|
+
currentBlock.push(cloned);
|
|
3617
|
+
}
|
|
228
3618
|
}
|
|
229
|
-
|
|
3619
|
+
cloned.patchFlag = -2;
|
|
3620
|
+
return cloned;
|
|
230
3621
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
let currentVNode = stack[stack.length - 1];
|
|
234
|
-
if (!currentVNode) {
|
|
235
|
-
return [];
|
|
3622
|
+
if (isClassComponent(type)) {
|
|
3623
|
+
type = type.__vccOpts;
|
|
236
3624
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
3625
|
+
if (props) {
|
|
3626
|
+
props = guardReactiveProps(props);
|
|
3627
|
+
let { class: klass, style } = props;
|
|
3628
|
+
if (klass && !shared.isString(klass)) {
|
|
3629
|
+
props.class = shared.normalizeClass(klass);
|
|
3630
|
+
}
|
|
3631
|
+
if (shared.isObject(style)) {
|
|
3632
|
+
if (isProxy(style) && !shared.isArray(style)) {
|
|
3633
|
+
style = shared.extend({}, style);
|
|
3634
|
+
}
|
|
3635
|
+
props.style = shared.normalizeStyle(style);
|
|
247
3636
|
}
|
|
248
|
-
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
249
|
-
currentVNode = parentInstance && parentInstance.vnode;
|
|
250
3637
|
}
|
|
251
|
-
|
|
3638
|
+
const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
|
|
3639
|
+
if (shapeFlag & 4 && isProxy(type)) {
|
|
3640
|
+
type = toRaw(type);
|
|
3641
|
+
warn$1(
|
|
3642
|
+
`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\`.`,
|
|
3643
|
+
`
|
|
3644
|
+
Component that was made reactive: `,
|
|
3645
|
+
type
|
|
3646
|
+
);
|
|
3647
|
+
}
|
|
3648
|
+
return createBaseVNode(
|
|
3649
|
+
type,
|
|
3650
|
+
props,
|
|
3651
|
+
children,
|
|
3652
|
+
patchFlag,
|
|
3653
|
+
dynamicProps,
|
|
3654
|
+
shapeFlag,
|
|
3655
|
+
isBlockNode,
|
|
3656
|
+
true
|
|
3657
|
+
);
|
|
252
3658
|
}
|
|
253
|
-
function
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
logs.push(...i === 0 ? [] : [`
|
|
257
|
-
`], ...formatTraceEntry(entry));
|
|
258
|
-
});
|
|
259
|
-
return logs;
|
|
3659
|
+
function guardReactiveProps(props) {
|
|
3660
|
+
if (!props) return null;
|
|
3661
|
+
return isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
|
|
260
3662
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
3663
|
+
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
3664
|
+
const { props, ref, patchFlag, children, transition } = vnode;
|
|
3665
|
+
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
3666
|
+
const cloned = {
|
|
3667
|
+
__v_isVNode: true,
|
|
3668
|
+
__v_skip: true,
|
|
3669
|
+
type: vnode.type,
|
|
3670
|
+
props: mergedProps,
|
|
3671
|
+
key: mergedProps && normalizeKey(mergedProps),
|
|
3672
|
+
ref: extraProps && extraProps.ref ? (
|
|
3673
|
+
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
3674
|
+
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
3675
|
+
// the refs so the single vnode can be set on multiple refs
|
|
3676
|
+
mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
|
3677
|
+
) : ref,
|
|
3678
|
+
scopeId: vnode.scopeId,
|
|
3679
|
+
slotScopeIds: vnode.slotScopeIds,
|
|
3680
|
+
children: patchFlag === -1 && shared.isArray(children) ? children.map(deepCloneVNode) : children,
|
|
3681
|
+
target: vnode.target,
|
|
3682
|
+
targetAnchor: vnode.targetAnchor,
|
|
3683
|
+
staticCount: vnode.staticCount,
|
|
3684
|
+
shapeFlag: vnode.shapeFlag,
|
|
3685
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
3686
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
3687
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
3688
|
+
// fast paths only.
|
|
3689
|
+
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
3690
|
+
dynamicProps: vnode.dynamicProps,
|
|
3691
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
3692
|
+
appContext: vnode.appContext,
|
|
3693
|
+
dirs: vnode.dirs,
|
|
3694
|
+
transition,
|
|
3695
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
3696
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
3697
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
3698
|
+
// they will simply be overwritten.
|
|
3699
|
+
component: vnode.component,
|
|
3700
|
+
suspense: vnode.suspense,
|
|
3701
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
3702
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
3703
|
+
el: vnode.el,
|
|
3704
|
+
anchor: vnode.anchor,
|
|
3705
|
+
ctx: vnode.ctx,
|
|
3706
|
+
ce: vnode.ce
|
|
3707
|
+
};
|
|
3708
|
+
if (transition && cloneTransition) {
|
|
3709
|
+
setTransitionHooks(
|
|
3710
|
+
cloned,
|
|
3711
|
+
transition.clone(cloned)
|
|
3712
|
+
);
|
|
3713
|
+
}
|
|
3714
|
+
return cloned;
|
|
271
3715
|
}
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
res.push(...formatProp(key, props[key]));
|
|
277
|
-
});
|
|
278
|
-
if (keys.length > 3) {
|
|
279
|
-
res.push(` ...`);
|
|
3716
|
+
function deepCloneVNode(vnode) {
|
|
3717
|
+
const cloned = cloneVNode(vnode);
|
|
3718
|
+
if (shared.isArray(vnode.children)) {
|
|
3719
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
280
3720
|
}
|
|
281
|
-
return
|
|
3721
|
+
return cloned;
|
|
282
3722
|
}
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return
|
|
289
|
-
} else if (
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
3723
|
+
function createTextVNode(text = " ", flag = 0) {
|
|
3724
|
+
return createVNode(Text, null, text, flag);
|
|
3725
|
+
}
|
|
3726
|
+
function normalizeVNode$1(child) {
|
|
3727
|
+
if (child == null || typeof child === "boolean") {
|
|
3728
|
+
return createVNode(Comment);
|
|
3729
|
+
} else if (shared.isArray(child)) {
|
|
3730
|
+
return createVNode(
|
|
3731
|
+
Fragment,
|
|
3732
|
+
null,
|
|
3733
|
+
// #3666, avoid reference pollution when reusing vnode
|
|
3734
|
+
child.slice()
|
|
3735
|
+
);
|
|
3736
|
+
} else if (typeof child === "object") {
|
|
3737
|
+
return cloneIfMounted(child);
|
|
294
3738
|
} else {
|
|
295
|
-
|
|
296
|
-
return raw ? value : [`${key}=`, value];
|
|
3739
|
+
return createVNode(Text, null, String(child));
|
|
297
3740
|
}
|
|
298
3741
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
["sp"]: "serverPrefetch hook",
|
|
302
|
-
["bc"]: "beforeCreate hook",
|
|
303
|
-
["c"]: "created hook",
|
|
304
|
-
["bm"]: "beforeMount hook",
|
|
305
|
-
["m"]: "mounted hook",
|
|
306
|
-
["bu"]: "beforeUpdate hook",
|
|
307
|
-
["u"]: "updated",
|
|
308
|
-
["bum"]: "beforeUnmount hook",
|
|
309
|
-
["um"]: "unmounted hook",
|
|
310
|
-
["a"]: "activated hook",
|
|
311
|
-
["da"]: "deactivated hook",
|
|
312
|
-
["ec"]: "errorCaptured hook",
|
|
313
|
-
["rtc"]: "renderTracked hook",
|
|
314
|
-
["rtg"]: "renderTriggered hook",
|
|
315
|
-
[0]: "setup function",
|
|
316
|
-
[1]: "render function",
|
|
317
|
-
[2]: "watcher getter",
|
|
318
|
-
[3]: "watcher callback",
|
|
319
|
-
[4]: "watcher cleanup function",
|
|
320
|
-
[5]: "native event handler",
|
|
321
|
-
[6]: "component event handler",
|
|
322
|
-
[7]: "vnode hook",
|
|
323
|
-
[8]: "directive hook",
|
|
324
|
-
[9]: "transition hook",
|
|
325
|
-
[10]: "app errorHandler",
|
|
326
|
-
[11]: "app warnHandler",
|
|
327
|
-
[12]: "ref function",
|
|
328
|
-
[13]: "async component loader",
|
|
329
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
330
|
-
};
|
|
331
|
-
function callWithErrorHandling(fn, instance, type, args) {
|
|
332
|
-
try {
|
|
333
|
-
return args ? fn(...args) : fn();
|
|
334
|
-
} catch (err) {
|
|
335
|
-
handleError(err, instance, type);
|
|
336
|
-
}
|
|
3742
|
+
function cloneIfMounted(child) {
|
|
3743
|
+
return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
|
337
3744
|
}
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
3745
|
+
function normalizeChildren(vnode, children) {
|
|
3746
|
+
let type = 0;
|
|
3747
|
+
const { shapeFlag } = vnode;
|
|
3748
|
+
if (children == null) {
|
|
3749
|
+
children = null;
|
|
3750
|
+
} else if (shared.isArray(children)) {
|
|
3751
|
+
type = 16;
|
|
3752
|
+
} else if (typeof children === "object") {
|
|
3753
|
+
if (shapeFlag & (1 | 64)) {
|
|
3754
|
+
const slot = children.default;
|
|
3755
|
+
if (slot) {
|
|
3756
|
+
slot._c && (slot._d = false);
|
|
3757
|
+
normalizeChildren(vnode, slot());
|
|
3758
|
+
slot._c && (slot._d = true);
|
|
3759
|
+
}
|
|
3760
|
+
return;
|
|
3761
|
+
} else {
|
|
3762
|
+
type = 32;
|
|
3763
|
+
const slotFlag = children._;
|
|
3764
|
+
if (!slotFlag && !isInternalObject(children)) {
|
|
3765
|
+
children._ctx = currentRenderingInstance;
|
|
3766
|
+
} else if (slotFlag === 3 && currentRenderingInstance) {
|
|
3767
|
+
if (currentRenderingInstance.slots._ === 1) {
|
|
3768
|
+
children._ = 1;
|
|
3769
|
+
} else {
|
|
3770
|
+
children._ = 2;
|
|
3771
|
+
vnode.patchFlag |= 1024;
|
|
351
3772
|
}
|
|
352
3773
|
}
|
|
353
|
-
cur = cur.parent;
|
|
354
3774
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
);
|
|
363
|
-
|
|
3775
|
+
} else if (shared.isFunction(children)) {
|
|
3776
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
3777
|
+
type = 32;
|
|
3778
|
+
} else {
|
|
3779
|
+
children = String(children);
|
|
3780
|
+
if (shapeFlag & 64) {
|
|
3781
|
+
type = 16;
|
|
3782
|
+
children = [createTextVNode(children)];
|
|
3783
|
+
} else {
|
|
3784
|
+
type = 8;
|
|
364
3785
|
}
|
|
365
3786
|
}
|
|
366
|
-
|
|
3787
|
+
vnode.children = children;
|
|
3788
|
+
vnode.shapeFlag |= type;
|
|
367
3789
|
}
|
|
368
|
-
function
|
|
369
|
-
{
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
3790
|
+
function mergeProps(...args) {
|
|
3791
|
+
const ret = {};
|
|
3792
|
+
for (let i = 0; i < args.length; i++) {
|
|
3793
|
+
const toMerge = args[i];
|
|
3794
|
+
for (const key in toMerge) {
|
|
3795
|
+
if (key === "class") {
|
|
3796
|
+
if (ret.class !== toMerge.class) {
|
|
3797
|
+
ret.class = shared.normalizeClass([ret.class, toMerge.class]);
|
|
3798
|
+
}
|
|
3799
|
+
} else if (key === "style") {
|
|
3800
|
+
ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
|
|
3801
|
+
} else if (shared.isOn(key)) {
|
|
3802
|
+
const existing = ret[key];
|
|
3803
|
+
const incoming = toMerge[key];
|
|
3804
|
+
if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
|
|
3805
|
+
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
3806
|
+
}
|
|
3807
|
+
} else if (key !== "") {
|
|
3808
|
+
ret[key] = toMerge[key];
|
|
3809
|
+
}
|
|
382
3810
|
}
|
|
383
3811
|
}
|
|
3812
|
+
return ret;
|
|
384
3813
|
}
|
|
385
3814
|
|
|
3815
|
+
const emptyAppContext = createAppContext();
|
|
3816
|
+
let uid = 0;
|
|
3817
|
+
function createComponentInstance$1(vnode, parent, suspense) {
|
|
3818
|
+
const type = vnode.type;
|
|
3819
|
+
const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
|
3820
|
+
const instance = {
|
|
3821
|
+
uid: uid++,
|
|
3822
|
+
vnode,
|
|
3823
|
+
type,
|
|
3824
|
+
parent,
|
|
3825
|
+
appContext,
|
|
3826
|
+
root: null,
|
|
3827
|
+
// to be immediately set
|
|
3828
|
+
next: null,
|
|
3829
|
+
subTree: null,
|
|
3830
|
+
// will be set synchronously right after creation
|
|
3831
|
+
effect: null,
|
|
3832
|
+
update: null,
|
|
3833
|
+
// will be set synchronously right after creation
|
|
3834
|
+
scope: new EffectScope(
|
|
3835
|
+
true
|
|
3836
|
+
/* detached */
|
|
3837
|
+
),
|
|
3838
|
+
render: null,
|
|
3839
|
+
proxy: null,
|
|
3840
|
+
exposed: null,
|
|
3841
|
+
exposeProxy: null,
|
|
3842
|
+
withProxy: null,
|
|
3843
|
+
provides: parent ? parent.provides : Object.create(appContext.provides),
|
|
3844
|
+
accessCache: null,
|
|
3845
|
+
renderCache: [],
|
|
3846
|
+
// local resolved assets
|
|
3847
|
+
components: null,
|
|
3848
|
+
directives: null,
|
|
3849
|
+
// resolved props and emits options
|
|
3850
|
+
propsOptions: normalizePropsOptions(type, appContext),
|
|
3851
|
+
emitsOptions: normalizeEmitsOptions(type, appContext),
|
|
3852
|
+
// emit
|
|
3853
|
+
emit: null,
|
|
3854
|
+
// to be set immediately
|
|
3855
|
+
emitted: null,
|
|
3856
|
+
// props default value
|
|
3857
|
+
propsDefaults: shared.EMPTY_OBJ,
|
|
3858
|
+
// inheritAttrs
|
|
3859
|
+
inheritAttrs: type.inheritAttrs,
|
|
3860
|
+
// state
|
|
3861
|
+
ctx: shared.EMPTY_OBJ,
|
|
3862
|
+
data: shared.EMPTY_OBJ,
|
|
3863
|
+
props: shared.EMPTY_OBJ,
|
|
3864
|
+
attrs: shared.EMPTY_OBJ,
|
|
3865
|
+
slots: shared.EMPTY_OBJ,
|
|
3866
|
+
refs: shared.EMPTY_OBJ,
|
|
3867
|
+
setupState: shared.EMPTY_OBJ,
|
|
3868
|
+
setupContext: null,
|
|
3869
|
+
attrsProxy: null,
|
|
3870
|
+
slotsProxy: null,
|
|
3871
|
+
// suspense related
|
|
3872
|
+
suspense,
|
|
3873
|
+
suspenseId: suspense ? suspense.pendingId : 0,
|
|
3874
|
+
asyncDep: null,
|
|
3875
|
+
asyncResolved: false,
|
|
3876
|
+
// lifecycle hooks
|
|
3877
|
+
// not using enums here because it results in computed properties
|
|
3878
|
+
isMounted: false,
|
|
3879
|
+
isUnmounted: false,
|
|
3880
|
+
isDeactivated: false,
|
|
3881
|
+
bc: null,
|
|
3882
|
+
c: null,
|
|
3883
|
+
bm: null,
|
|
3884
|
+
m: null,
|
|
3885
|
+
bu: null,
|
|
3886
|
+
u: null,
|
|
3887
|
+
um: null,
|
|
3888
|
+
bum: null,
|
|
3889
|
+
da: null,
|
|
3890
|
+
a: null,
|
|
3891
|
+
rtg: null,
|
|
3892
|
+
rtc: null,
|
|
3893
|
+
ec: null,
|
|
3894
|
+
sp: null
|
|
3895
|
+
};
|
|
3896
|
+
{
|
|
3897
|
+
instance.ctx = createDevRenderContext(instance);
|
|
3898
|
+
}
|
|
3899
|
+
instance.root = parent ? parent.root : instance;
|
|
3900
|
+
instance.emit = emit.bind(null, instance);
|
|
3901
|
+
if (vnode.ce) {
|
|
3902
|
+
vnode.ce(instance);
|
|
3903
|
+
}
|
|
3904
|
+
return instance;
|
|
3905
|
+
}
|
|
3906
|
+
let currentInstance = null;
|
|
3907
|
+
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
3908
|
+
let internalSetCurrentInstance;
|
|
3909
|
+
let setInSSRSetupState;
|
|
386
3910
|
{
|
|
387
3911
|
const g = shared.getGlobalThis();
|
|
388
3912
|
const registerGlobalSetter = (key, setter) => {
|
|
389
3913
|
let setters;
|
|
390
|
-
if (!(setters = g[key]))
|
|
391
|
-
setters = g[key] = [];
|
|
3914
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
392
3915
|
setters.push(setter);
|
|
393
3916
|
return (v) => {
|
|
394
|
-
if (setters.length > 1)
|
|
395
|
-
|
|
396
|
-
else
|
|
397
|
-
setters[0](v);
|
|
3917
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
3918
|
+
else setters[0](v);
|
|
398
3919
|
};
|
|
399
3920
|
};
|
|
400
|
-
registerGlobalSetter(
|
|
3921
|
+
internalSetCurrentInstance = registerGlobalSetter(
|
|
401
3922
|
`__VUE_INSTANCE_SETTERS__`,
|
|
402
|
-
(v) => v
|
|
3923
|
+
(v) => currentInstance = v
|
|
403
3924
|
);
|
|
404
|
-
registerGlobalSetter(
|
|
3925
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
405
3926
|
`__VUE_SSR_SETTERS__`,
|
|
406
|
-
(v) => v
|
|
3927
|
+
(v) => isInSSRComponentSetup = v
|
|
407
3928
|
);
|
|
408
3929
|
}
|
|
3930
|
+
const setCurrentInstance = (instance) => {
|
|
3931
|
+
const prev = currentInstance;
|
|
3932
|
+
internalSetCurrentInstance(instance);
|
|
3933
|
+
instance.scope.on();
|
|
3934
|
+
return () => {
|
|
3935
|
+
instance.scope.off();
|
|
3936
|
+
internalSetCurrentInstance(prev);
|
|
3937
|
+
};
|
|
3938
|
+
};
|
|
3939
|
+
const unsetCurrentInstance = () => {
|
|
3940
|
+
currentInstance && currentInstance.scope.off();
|
|
3941
|
+
internalSetCurrentInstance(null);
|
|
3942
|
+
};
|
|
3943
|
+
const isBuiltInTag = /* @__PURE__ */ shared.makeMap("slot,component");
|
|
3944
|
+
function validateComponentName(name, { isNativeTag }) {
|
|
3945
|
+
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
3946
|
+
warn$1(
|
|
3947
|
+
"Do not use built-in or reserved HTML elements as component id: " + name
|
|
3948
|
+
);
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
function isStatefulComponent(instance) {
|
|
3952
|
+
return instance.vnode.shapeFlag & 4;
|
|
3953
|
+
}
|
|
3954
|
+
let isInSSRComponentSetup = false;
|
|
3955
|
+
function setupComponent$1(instance, isSSR = false) {
|
|
3956
|
+
isSSR && setInSSRSetupState(isSSR);
|
|
3957
|
+
const { props, children } = instance.vnode;
|
|
3958
|
+
const isStateful = isStatefulComponent(instance);
|
|
3959
|
+
initProps(instance, props, isStateful, isSSR);
|
|
3960
|
+
initSlots(instance, children);
|
|
3961
|
+
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
3962
|
+
isSSR && setInSSRSetupState(false);
|
|
3963
|
+
return setupResult;
|
|
3964
|
+
}
|
|
3965
|
+
function setupStatefulComponent(instance, isSSR) {
|
|
3966
|
+
var _a;
|
|
3967
|
+
const Component = instance.type;
|
|
3968
|
+
{
|
|
3969
|
+
if (Component.name) {
|
|
3970
|
+
validateComponentName(Component.name, instance.appContext.config);
|
|
3971
|
+
}
|
|
3972
|
+
if (Component.components) {
|
|
3973
|
+
const names = Object.keys(Component.components);
|
|
3974
|
+
for (let i = 0; i < names.length; i++) {
|
|
3975
|
+
validateComponentName(names[i], instance.appContext.config);
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3978
|
+
if (Component.directives) {
|
|
3979
|
+
const names = Object.keys(Component.directives);
|
|
3980
|
+
for (let i = 0; i < names.length; i++) {
|
|
3981
|
+
validateDirectiveName(names[i]);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
if (Component.compilerOptions && isRuntimeOnly()) {
|
|
3985
|
+
warn$1(
|
|
3986
|
+
`"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
|
|
3987
|
+
);
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
instance.accessCache = /* @__PURE__ */ Object.create(null);
|
|
3991
|
+
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
|
3992
|
+
{
|
|
3993
|
+
exposePropsOnRenderContext(instance);
|
|
3994
|
+
}
|
|
3995
|
+
const { setup } = Component;
|
|
3996
|
+
if (setup) {
|
|
3997
|
+
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
3998
|
+
const reset = setCurrentInstance(instance);
|
|
3999
|
+
pauseTracking();
|
|
4000
|
+
const setupResult = callWithErrorHandling(
|
|
4001
|
+
setup,
|
|
4002
|
+
instance,
|
|
4003
|
+
0,
|
|
4004
|
+
[
|
|
4005
|
+
shallowReadonly(instance.props) ,
|
|
4006
|
+
setupContext
|
|
4007
|
+
]
|
|
4008
|
+
);
|
|
4009
|
+
resetTracking();
|
|
4010
|
+
reset();
|
|
4011
|
+
if (shared.isPromise(setupResult)) {
|
|
4012
|
+
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
4013
|
+
if (isSSR) {
|
|
4014
|
+
return setupResult.then((resolvedResult) => {
|
|
4015
|
+
handleSetupResult(instance, resolvedResult, isSSR);
|
|
4016
|
+
}).catch((e) => {
|
|
4017
|
+
handleError(e, instance, 0);
|
|
4018
|
+
});
|
|
4019
|
+
} else {
|
|
4020
|
+
instance.asyncDep = setupResult;
|
|
4021
|
+
if (!instance.suspense) {
|
|
4022
|
+
const name = (_a = Component.name) != null ? _a : "Anonymous";
|
|
4023
|
+
warn$1(
|
|
4024
|
+
`Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
|
|
4025
|
+
);
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
} else {
|
|
4029
|
+
handleSetupResult(instance, setupResult, isSSR);
|
|
4030
|
+
}
|
|
4031
|
+
} else {
|
|
4032
|
+
finishComponentSetup(instance, isSSR);
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
function handleSetupResult(instance, setupResult, isSSR) {
|
|
4036
|
+
if (shared.isFunction(setupResult)) {
|
|
4037
|
+
if (instance.type.__ssrInlineRender) {
|
|
4038
|
+
instance.ssrRender = setupResult;
|
|
4039
|
+
} else {
|
|
4040
|
+
instance.render = setupResult;
|
|
4041
|
+
}
|
|
4042
|
+
} else if (shared.isObject(setupResult)) {
|
|
4043
|
+
if (isVNode$2(setupResult)) {
|
|
4044
|
+
warn$1(
|
|
4045
|
+
`setup() should not return VNodes directly - return a render function instead.`
|
|
4046
|
+
);
|
|
4047
|
+
}
|
|
4048
|
+
{
|
|
4049
|
+
instance.devtoolsRawSetupState = setupResult;
|
|
4050
|
+
}
|
|
4051
|
+
instance.setupState = proxyRefs(setupResult);
|
|
4052
|
+
{
|
|
4053
|
+
exposeSetupStateOnRenderContext(instance);
|
|
4054
|
+
}
|
|
4055
|
+
} else if (setupResult !== void 0) {
|
|
4056
|
+
warn$1(
|
|
4057
|
+
`setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
|
|
4058
|
+
);
|
|
4059
|
+
}
|
|
4060
|
+
finishComponentSetup(instance, isSSR);
|
|
4061
|
+
}
|
|
4062
|
+
let compile;
|
|
4063
|
+
const isRuntimeOnly = () => !compile;
|
|
4064
|
+
function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
4065
|
+
const Component = instance.type;
|
|
4066
|
+
if (!instance.render) {
|
|
4067
|
+
if (!isSSR && compile && !Component.render) {
|
|
4068
|
+
const template = Component.template || resolveMergedOptions(instance).template;
|
|
4069
|
+
if (template) {
|
|
4070
|
+
{
|
|
4071
|
+
startMeasure(instance, `compile`);
|
|
4072
|
+
}
|
|
4073
|
+
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
|
4074
|
+
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
|
4075
|
+
const finalCompilerOptions = shared.extend(
|
|
4076
|
+
shared.extend(
|
|
4077
|
+
{
|
|
4078
|
+
isCustomElement,
|
|
4079
|
+
delimiters
|
|
4080
|
+
},
|
|
4081
|
+
compilerOptions
|
|
4082
|
+
),
|
|
4083
|
+
componentCompilerOptions
|
|
4084
|
+
);
|
|
4085
|
+
Component.render = compile(template, finalCompilerOptions);
|
|
4086
|
+
{
|
|
4087
|
+
endMeasure(instance, `compile`);
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
instance.render = Component.render || shared.NOOP;
|
|
4092
|
+
}
|
|
4093
|
+
{
|
|
4094
|
+
const reset = setCurrentInstance(instance);
|
|
4095
|
+
pauseTracking();
|
|
4096
|
+
try {
|
|
4097
|
+
applyOptions(instance);
|
|
4098
|
+
} finally {
|
|
4099
|
+
resetTracking();
|
|
4100
|
+
reset();
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
if (!Component.render && instance.render === shared.NOOP && !isSSR) {
|
|
4104
|
+
if (Component.template) {
|
|
4105
|
+
warn$1(
|
|
4106
|
+
`Component provided template option but runtime compilation is not supported in this build of Vue.` + (``)
|
|
4107
|
+
);
|
|
4108
|
+
} else {
|
|
4109
|
+
warn$1(`Component is missing template or render function: `, Component);
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
const attrsProxyHandlers = {
|
|
4114
|
+
get(target, key) {
|
|
4115
|
+
markAttrsAccessed();
|
|
4116
|
+
track(target, "get", "");
|
|
4117
|
+
return target[key];
|
|
4118
|
+
},
|
|
4119
|
+
set() {
|
|
4120
|
+
warn$1(`setupContext.attrs is readonly.`);
|
|
4121
|
+
return false;
|
|
4122
|
+
},
|
|
4123
|
+
deleteProperty() {
|
|
4124
|
+
warn$1(`setupContext.attrs is readonly.`);
|
|
4125
|
+
return false;
|
|
4126
|
+
}
|
|
4127
|
+
} ;
|
|
4128
|
+
function getSlotsProxy(instance) {
|
|
4129
|
+
return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
|
4130
|
+
get(target, key) {
|
|
4131
|
+
track(instance, "get", "$slots");
|
|
4132
|
+
return target[key];
|
|
4133
|
+
}
|
|
4134
|
+
}));
|
|
4135
|
+
}
|
|
4136
|
+
function createSetupContext(instance) {
|
|
4137
|
+
const expose = (exposed) => {
|
|
4138
|
+
{
|
|
4139
|
+
if (instance.exposed) {
|
|
4140
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
4141
|
+
}
|
|
4142
|
+
if (exposed != null) {
|
|
4143
|
+
let exposedType = typeof exposed;
|
|
4144
|
+
if (exposedType === "object") {
|
|
4145
|
+
if (shared.isArray(exposed)) {
|
|
4146
|
+
exposedType = "array";
|
|
4147
|
+
} else if (isRef(exposed)) {
|
|
4148
|
+
exposedType = "ref";
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
if (exposedType !== "object") {
|
|
4152
|
+
warn$1(
|
|
4153
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
4154
|
+
);
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
instance.exposed = exposed || {};
|
|
4159
|
+
};
|
|
4160
|
+
{
|
|
4161
|
+
let attrsProxy;
|
|
4162
|
+
return Object.freeze({
|
|
4163
|
+
get attrs() {
|
|
4164
|
+
return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
|
|
4165
|
+
},
|
|
4166
|
+
get slots() {
|
|
4167
|
+
return getSlotsProxy(instance);
|
|
4168
|
+
},
|
|
4169
|
+
get emit() {
|
|
4170
|
+
return (event, ...args) => instance.emit(event, ...args);
|
|
4171
|
+
},
|
|
4172
|
+
expose
|
|
4173
|
+
});
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
function getComponentPublicInstance(instance) {
|
|
4177
|
+
if (instance.exposed) {
|
|
4178
|
+
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
4179
|
+
get(target, key) {
|
|
4180
|
+
if (key in target) {
|
|
4181
|
+
return target[key];
|
|
4182
|
+
} else if (key in publicPropertiesMap) {
|
|
4183
|
+
return publicPropertiesMap[key](instance);
|
|
4184
|
+
}
|
|
4185
|
+
},
|
|
4186
|
+
has(target, key) {
|
|
4187
|
+
return key in target || key in publicPropertiesMap;
|
|
4188
|
+
}
|
|
4189
|
+
}));
|
|
4190
|
+
} else {
|
|
4191
|
+
return instance.proxy;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
409
4194
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
410
4195
|
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
411
4196
|
function getComponentName(Component, includeInferred = true) {
|
|
@@ -433,8 +4218,32 @@ function formatComponentName(instance, Component, isRoot = false) {
|
|
|
433
4218
|
}
|
|
434
4219
|
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
435
4220
|
}
|
|
4221
|
+
function isClassComponent(value) {
|
|
4222
|
+
return shared.isFunction(value) && "__vccOpts" in value;
|
|
4223
|
+
}
|
|
4224
|
+
|
|
4225
|
+
const computed = (getterOrOptions, debugOptions) => {
|
|
4226
|
+
const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
4227
|
+
{
|
|
4228
|
+
const i = getCurrentInstance();
|
|
4229
|
+
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
4230
|
+
c._warnRecursive = true;
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
return c;
|
|
4234
|
+
};
|
|
436
4235
|
|
|
437
4236
|
const warn = warn$1 ;
|
|
4237
|
+
const _ssrUtils = {
|
|
4238
|
+
createComponentInstance: createComponentInstance$1,
|
|
4239
|
+
setupComponent: setupComponent$1,
|
|
4240
|
+
renderComponentRoot: renderComponentRoot$1,
|
|
4241
|
+
setCurrentRenderingInstance: setCurrentRenderingInstance$1,
|
|
4242
|
+
isVNode: isVNode$2,
|
|
4243
|
+
normalizeVNode: normalizeVNode$1,
|
|
4244
|
+
getComponentPublicInstance
|
|
4245
|
+
};
|
|
4246
|
+
const ssrUtils = _ssrUtils ;
|
|
438
4247
|
|
|
439
4248
|
function ssrRenderList(source, renderItem) {
|
|
440
4249
|
if (shared.isArray(source) || shared.isString(source)) {
|
|
@@ -478,7 +4287,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
|
478
4287
|
return dir.getSSRProps(
|
|
479
4288
|
{
|
|
480
4289
|
dir,
|
|
481
|
-
instance,
|
|
4290
|
+
instance: ssrUtils.getComponentPublicInstance(instance.$),
|
|
482
4291
|
value,
|
|
483
4292
|
oldValue: void 0,
|
|
484
4293
|
arg,
|
|
@@ -686,9 +4495,11 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
686
4495
|
}
|
|
687
4496
|
}
|
|
688
4497
|
if (slotScopeId) {
|
|
689
|
-
if (!hasCloned)
|
|
690
|
-
|
|
691
|
-
|
|
4498
|
+
if (!hasCloned) attrs = { ...attrs };
|
|
4499
|
+
const slotScopeIdList = slotScopeId.trim().split(" ");
|
|
4500
|
+
for (let i = 0; i < slotScopeIdList.length; i++) {
|
|
4501
|
+
attrs[slotScopeIdList[i]] = "";
|
|
4502
|
+
}
|
|
692
4503
|
}
|
|
693
4504
|
const prev = setCurrentRenderingInstance(instance);
|
|
694
4505
|
try {
|
|
@@ -835,8 +4646,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
|
|
835
4646
|
} = binding;
|
|
836
4647
|
if (getSSRProps) {
|
|
837
4648
|
const props = getSSRProps(binding, vnode);
|
|
838
|
-
if (props)
|
|
839
|
-
toMerge.push(props);
|
|
4649
|
+
if (props) toMerge.push(props);
|
|
840
4650
|
}
|
|
841
4651
|
}
|
|
842
4652
|
return Vue.mergeProps(rawProps || {}, ...toMerge);
|
|
@@ -1024,8 +4834,7 @@ function renderToWebStream(input, context = {}) {
|
|
|
1024
4834
|
start(controller) {
|
|
1025
4835
|
renderToSimpleStream(input, context, {
|
|
1026
4836
|
push(content) {
|
|
1027
|
-
if (cancelled)
|
|
1028
|
-
return;
|
|
4837
|
+
if (cancelled) return;
|
|
1029
4838
|
if (content != null) {
|
|
1030
4839
|
controller.enqueue(encoder.encode(content));
|
|
1031
4840
|
} else {
|