@vue/runtime-dom 3.5.17 → 3.6.0-alpha.2
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/runtime-dom.cjs.js +130 -114
- package/dist/runtime-dom.cjs.prod.js +130 -114
- package/dist/runtime-dom.d.ts +4 -4
- package/dist/runtime-dom.esm-browser.js +1915 -1477
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +133 -116
- package/dist/runtime-dom.global.js +1912 -1474
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -21,6 +21,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
21
21
|
const NO = () => false;
|
|
22
22
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
23
23
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
24
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
25
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
24
26
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
25
27
|
const extend = Object.assign;
|
|
26
28
|
const remove = (arr, el) => {
|
|
@@ -54,6 +56,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
54
56
|
// the leading comma is intentional so empty string "" is also included
|
|
55
57
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
56
58
|
);
|
|
59
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
57
60
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
58
61
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
59
62
|
);
|
|
@@ -65,10 +68,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
65
68
|
};
|
|
66
69
|
};
|
|
67
70
|
const camelizeRE = /-(\w)/g;
|
|
71
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
68
72
|
const camelize = cacheStringFunction(
|
|
69
|
-
(str) =>
|
|
70
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
71
|
-
}
|
|
73
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
72
74
|
);
|
|
73
75
|
const hyphenateRE = /\B([A-Z])/g;
|
|
74
76
|
const hyphenate = cacheStringFunction(
|
|
@@ -109,6 +111,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
109
111
|
const getGlobalThis = () => {
|
|
110
112
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
111
113
|
};
|
|
114
|
+
function canSetValueDirectly(tagName) {
|
|
115
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
116
|
+
!tagName.includes("-");
|
|
117
|
+
}
|
|
112
118
|
|
|
113
119
|
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
|
|
114
120
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
@@ -216,6 +222,24 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
216
222
|
const type = typeof value;
|
|
217
223
|
return type === "string" || type === "number" || type === "boolean";
|
|
218
224
|
}
|
|
225
|
+
function shouldSetAsAttr(tagName, key) {
|
|
226
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
if (key === "form") {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
if (key === "list" && tagName === "INPUT") {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
219
243
|
|
|
220
244
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
221
245
|
function getEscapedCssVarName(key, doubleEscape) {
|
|
@@ -279,7 +303,20 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
279
303
|
return !!(val && val["__v_isRef"] === true);
|
|
280
304
|
};
|
|
281
305
|
const toDisplayString = (val) => {
|
|
282
|
-
|
|
306
|
+
switch (typeof val) {
|
|
307
|
+
case "string":
|
|
308
|
+
return val;
|
|
309
|
+
case "object":
|
|
310
|
+
if (val) {
|
|
311
|
+
if (isRef$1(val)) {
|
|
312
|
+
return toDisplayString(val.value);
|
|
313
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
314
|
+
return JSON.stringify(val, replacer, 2);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
default:
|
|
318
|
+
return val == null ? "" : String(val);
|
|
319
|
+
}
|
|
283
320
|
};
|
|
284
321
|
const replacer = (_key, val) => {
|
|
285
322
|
if (isRef$1(val)) {
|
|
@@ -314,606 +351,406 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
314
351
|
);
|
|
315
352
|
};
|
|
316
353
|
|
|
317
|
-
function
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
* @internal track `on` calls, allow `on` call multiple times
|
|
331
|
-
*/
|
|
332
|
-
this._on = 0;
|
|
333
|
-
/**
|
|
334
|
-
* @internal
|
|
335
|
-
*/
|
|
336
|
-
this.effects = [];
|
|
337
|
-
/**
|
|
338
|
-
* @internal
|
|
339
|
-
*/
|
|
340
|
-
this.cleanups = [];
|
|
341
|
-
this._isPaused = false;
|
|
342
|
-
this.parent = activeEffectScope;
|
|
343
|
-
if (!detached && activeEffectScope) {
|
|
344
|
-
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
345
|
-
this
|
|
346
|
-
) - 1;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
get active() {
|
|
350
|
-
return this._active;
|
|
351
|
-
}
|
|
352
|
-
pause() {
|
|
353
|
-
if (this._active) {
|
|
354
|
-
this._isPaused = true;
|
|
355
|
-
let i, l;
|
|
356
|
-
if (this.scopes) {
|
|
357
|
-
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
358
|
-
this.scopes[i].pause();
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
362
|
-
this.effects[i].pause();
|
|
354
|
+
function getSequence(arr) {
|
|
355
|
+
const p = arr.slice();
|
|
356
|
+
const result = [0];
|
|
357
|
+
let i, j, u, v, c;
|
|
358
|
+
const len = arr.length;
|
|
359
|
+
for (i = 0; i < len; i++) {
|
|
360
|
+
const arrI = arr[i];
|
|
361
|
+
if (arrI !== 0) {
|
|
362
|
+
j = result[result.length - 1];
|
|
363
|
+
if (arr[j] < arrI) {
|
|
364
|
+
p[i] = j;
|
|
365
|
+
result.push(i);
|
|
366
|
+
continue;
|
|
363
367
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
this._isPaused = false;
|
|
373
|
-
let i, l;
|
|
374
|
-
if (this.scopes) {
|
|
375
|
-
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
376
|
-
this.scopes[i].resume();
|
|
377
|
-
}
|
|
368
|
+
u = 0;
|
|
369
|
+
v = result.length - 1;
|
|
370
|
+
while (u < v) {
|
|
371
|
+
c = u + v >> 1;
|
|
372
|
+
if (arr[result[c]] < arrI) {
|
|
373
|
+
u = c + 1;
|
|
374
|
+
} else {
|
|
375
|
+
v = c;
|
|
378
376
|
}
|
|
379
|
-
|
|
380
|
-
|
|
377
|
+
}
|
|
378
|
+
if (arrI < arr[result[u]]) {
|
|
379
|
+
if (u > 0) {
|
|
380
|
+
p[i] = result[u - 1];
|
|
381
381
|
}
|
|
382
|
+
result[u] = i;
|
|
382
383
|
}
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
return fn();
|
|
391
|
-
} finally {
|
|
392
|
-
activeEffectScope = currentEffectScope;
|
|
393
|
-
}
|
|
394
|
-
} else {
|
|
395
|
-
warn$2(`cannot run an inactive effect scope.`);
|
|
396
|
-
}
|
|
386
|
+
u = result.length;
|
|
387
|
+
v = result[u - 1];
|
|
388
|
+
while (u-- > 0) {
|
|
389
|
+
result[u] = v;
|
|
390
|
+
v = p[v];
|
|
397
391
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.prevScope = activeEffectScope;
|
|
405
|
-
activeEffectScope = this;
|
|
406
|
-
}
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function normalizeCssVarValue(value) {
|
|
396
|
+
if (value == null) {
|
|
397
|
+
return "initial";
|
|
407
398
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
* @internal
|
|
411
|
-
*/
|
|
412
|
-
off() {
|
|
413
|
-
if (this._on > 0 && --this._on === 0) {
|
|
414
|
-
activeEffectScope = this.prevScope;
|
|
415
|
-
this.prevScope = void 0;
|
|
416
|
-
}
|
|
399
|
+
if (typeof value === "string") {
|
|
400
|
+
return value === "" ? " " : value;
|
|
417
401
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
this.effects.length = 0;
|
|
426
|
-
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
|
427
|
-
this.cleanups[i]();
|
|
428
|
-
}
|
|
429
|
-
this.cleanups.length = 0;
|
|
430
|
-
if (this.scopes) {
|
|
431
|
-
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
432
|
-
this.scopes[i].stop(true);
|
|
433
|
-
}
|
|
434
|
-
this.scopes.length = 0;
|
|
435
|
-
}
|
|
436
|
-
if (!this.detached && this.parent && !fromParent) {
|
|
437
|
-
const last = this.parent.scopes.pop();
|
|
438
|
-
if (last && last !== this) {
|
|
439
|
-
this.parent.scopes[this.index] = last;
|
|
440
|
-
last.index = this.index;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
this.parent = void 0;
|
|
402
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
403
|
+
{
|
|
404
|
+
console.warn(
|
|
405
|
+
"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
|
|
406
|
+
value
|
|
407
|
+
);
|
|
444
408
|
}
|
|
445
409
|
}
|
|
410
|
+
return String(value);
|
|
446
411
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
function getCurrentScope() {
|
|
451
|
-
return activeEffectScope;
|
|
452
|
-
}
|
|
453
|
-
function onScopeDispose(fn, failSilently = false) {
|
|
454
|
-
if (activeEffectScope) {
|
|
455
|
-
activeEffectScope.cleanups.push(fn);
|
|
456
|
-
} else if (!failSilently) {
|
|
457
|
-
warn$2(
|
|
458
|
-
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
459
|
-
);
|
|
460
|
-
}
|
|
412
|
+
|
|
413
|
+
function warn$2(msg, ...args) {
|
|
414
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
461
415
|
}
|
|
462
416
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
this.next = void 0;
|
|
484
|
-
/**
|
|
485
|
-
* @internal
|
|
486
|
-
*/
|
|
487
|
-
this.cleanup = void 0;
|
|
488
|
-
this.scheduler = void 0;
|
|
489
|
-
if (activeEffectScope && activeEffectScope.active) {
|
|
490
|
-
activeEffectScope.effects.push(this);
|
|
491
|
-
}
|
|
417
|
+
var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
|
|
418
|
+
ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
|
|
419
|
+
ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
|
|
420
|
+
ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
|
|
421
|
+
ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
|
|
422
|
+
ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
|
|
423
|
+
ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
|
|
424
|
+
ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
|
|
425
|
+
return ReactiveFlags2;
|
|
426
|
+
})(ReactiveFlags || {});
|
|
427
|
+
const notifyBuffer = [];
|
|
428
|
+
let batchDepth = 0;
|
|
429
|
+
let activeSub = void 0;
|
|
430
|
+
let notifyIndex = 0;
|
|
431
|
+
let notifyBufferLength = 0;
|
|
432
|
+
function setActiveSub(sub) {
|
|
433
|
+
try {
|
|
434
|
+
return activeSub;
|
|
435
|
+
} finally {
|
|
436
|
+
activeSub = sub;
|
|
492
437
|
}
|
|
493
|
-
|
|
494
|
-
|
|
438
|
+
}
|
|
439
|
+
function startBatch() {
|
|
440
|
+
++batchDepth;
|
|
441
|
+
}
|
|
442
|
+
function endBatch() {
|
|
443
|
+
if (!--batchDepth && notifyBufferLength) {
|
|
444
|
+
flush();
|
|
495
445
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
this.trigger();
|
|
502
|
-
}
|
|
503
|
-
}
|
|
446
|
+
}
|
|
447
|
+
function link(dep, sub) {
|
|
448
|
+
const prevDep = sub.depsTail;
|
|
449
|
+
if (prevDep !== void 0 && prevDep.dep === dep) {
|
|
450
|
+
return;
|
|
504
451
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (
|
|
452
|
+
let nextDep = void 0;
|
|
453
|
+
const recursedCheck = sub.flags & 4 /* RecursedCheck */;
|
|
454
|
+
if (recursedCheck) {
|
|
455
|
+
nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
456
|
+
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
457
|
+
sub.depsTail = nextDep;
|
|
510
458
|
return;
|
|
511
459
|
}
|
|
512
|
-
if (!(this.flags & 8)) {
|
|
513
|
-
batch(this);
|
|
514
|
-
}
|
|
515
460
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
try {
|
|
528
|
-
return this.fn();
|
|
529
|
-
} finally {
|
|
530
|
-
if (activeSub !== this) {
|
|
531
|
-
warn$2(
|
|
532
|
-
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
cleanupDeps(this);
|
|
536
|
-
activeSub = prevEffect;
|
|
537
|
-
shouldTrack = prevShouldTrack;
|
|
538
|
-
this.flags &= -3;
|
|
539
|
-
}
|
|
461
|
+
const prevSub = dep.subsTail;
|
|
462
|
+
const newLink = sub.depsTail = dep.subsTail = {
|
|
463
|
+
dep,
|
|
464
|
+
sub,
|
|
465
|
+
prevDep,
|
|
466
|
+
nextDep,
|
|
467
|
+
prevSub,
|
|
468
|
+
nextSub: void 0
|
|
469
|
+
};
|
|
470
|
+
if (nextDep !== void 0) {
|
|
471
|
+
nextDep.prevDep = newLink;
|
|
540
472
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
this.deps = this.depsTail = void 0;
|
|
547
|
-
cleanupEffect(this);
|
|
548
|
-
this.onStop && this.onStop();
|
|
549
|
-
this.flags &= -2;
|
|
550
|
-
}
|
|
473
|
+
if (prevDep !== void 0) {
|
|
474
|
+
prevDep.nextDep = newLink;
|
|
475
|
+
} else {
|
|
476
|
+
sub.deps = newLink;
|
|
551
477
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
this.scheduler();
|
|
557
|
-
} else {
|
|
558
|
-
this.runIfDirty();
|
|
559
|
-
}
|
|
478
|
+
if (prevSub !== void 0) {
|
|
479
|
+
prevSub.nextSub = newLink;
|
|
480
|
+
} else {
|
|
481
|
+
dep.subs = newLink;
|
|
560
482
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
483
|
+
}
|
|
484
|
+
function unlink(link2, sub = link2.sub) {
|
|
485
|
+
const dep = link2.dep;
|
|
486
|
+
const prevDep = link2.prevDep;
|
|
487
|
+
const nextDep = link2.nextDep;
|
|
488
|
+
const nextSub = link2.nextSub;
|
|
489
|
+
const prevSub = link2.prevSub;
|
|
490
|
+
if (nextDep !== void 0) {
|
|
491
|
+
nextDep.prevDep = prevDep;
|
|
492
|
+
} else {
|
|
493
|
+
sub.depsTail = prevDep;
|
|
568
494
|
}
|
|
569
|
-
|
|
570
|
-
|
|
495
|
+
if (prevDep !== void 0) {
|
|
496
|
+
prevDep.nextDep = nextDep;
|
|
497
|
+
} else {
|
|
498
|
+
sub.deps = nextDep;
|
|
571
499
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
function batch(sub, isComputed = false) {
|
|
577
|
-
sub.flags |= 8;
|
|
578
|
-
if (isComputed) {
|
|
579
|
-
sub.next = batchedComputed;
|
|
580
|
-
batchedComputed = sub;
|
|
581
|
-
return;
|
|
500
|
+
if (nextSub !== void 0) {
|
|
501
|
+
nextSub.prevSub = prevSub;
|
|
502
|
+
} else {
|
|
503
|
+
dep.subsTail = prevSub;
|
|
582
504
|
}
|
|
583
|
-
|
|
584
|
-
|
|
505
|
+
if (prevSub !== void 0) {
|
|
506
|
+
prevSub.nextSub = nextSub;
|
|
507
|
+
} else if ((dep.subs = nextSub) === void 0) {
|
|
508
|
+
let toRemove = dep.deps;
|
|
509
|
+
if (toRemove !== void 0) {
|
|
510
|
+
do {
|
|
511
|
+
toRemove = unlink(toRemove, dep);
|
|
512
|
+
} while (toRemove !== void 0);
|
|
513
|
+
dep.flags |= 16 /* Dirty */;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return nextDep;
|
|
517
|
+
}
|
|
518
|
+
function propagate(link2) {
|
|
519
|
+
let next = link2.nextSub;
|
|
520
|
+
let stack;
|
|
521
|
+
top: do {
|
|
522
|
+
const sub = link2.sub;
|
|
523
|
+
let flags = sub.flags;
|
|
524
|
+
if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
|
|
525
|
+
if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
|
|
526
|
+
sub.flags = flags | 32 /* Pending */;
|
|
527
|
+
} else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
|
|
528
|
+
flags = 0 /* None */;
|
|
529
|
+
} else if (!(flags & 4 /* RecursedCheck */)) {
|
|
530
|
+
sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
|
|
531
|
+
} else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
|
|
532
|
+
sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
|
|
533
|
+
flags &= 1 /* Mutable */;
|
|
534
|
+
} else {
|
|
535
|
+
flags = 0 /* None */;
|
|
536
|
+
}
|
|
537
|
+
if (flags & 2 /* Watching */) {
|
|
538
|
+
notifyBuffer[notifyBufferLength++] = sub;
|
|
539
|
+
}
|
|
540
|
+
if (flags & 1 /* Mutable */) {
|
|
541
|
+
const subSubs = sub.subs;
|
|
542
|
+
if (subSubs !== void 0) {
|
|
543
|
+
link2 = subSubs;
|
|
544
|
+
if (subSubs.nextSub !== void 0) {
|
|
545
|
+
stack = { value: next, prev: stack };
|
|
546
|
+
next = link2.nextSub;
|
|
547
|
+
}
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if ((link2 = next) !== void 0) {
|
|
553
|
+
next = link2.nextSub;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
while (stack !== void 0) {
|
|
557
|
+
link2 = stack.value;
|
|
558
|
+
stack = stack.prev;
|
|
559
|
+
if (link2 !== void 0) {
|
|
560
|
+
next = link2.nextSub;
|
|
561
|
+
continue top;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
break;
|
|
565
|
+
} while (true);
|
|
585
566
|
}
|
|
586
|
-
function
|
|
587
|
-
|
|
567
|
+
function startTracking(sub) {
|
|
568
|
+
sub.depsTail = void 0;
|
|
569
|
+
sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
|
|
570
|
+
return setActiveSub(sub);
|
|
588
571
|
}
|
|
589
|
-
function
|
|
590
|
-
if (
|
|
591
|
-
|
|
572
|
+
function endTracking(sub, prevSub) {
|
|
573
|
+
if (activeSub !== sub) {
|
|
574
|
+
warn$2(
|
|
575
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
576
|
+
);
|
|
592
577
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
578
|
+
activeSub = prevSub;
|
|
579
|
+
const depsTail = sub.depsTail;
|
|
580
|
+
let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
581
|
+
while (toRemove !== void 0) {
|
|
582
|
+
toRemove = unlink(toRemove, sub);
|
|
583
|
+
}
|
|
584
|
+
sub.flags &= -5 /* RecursedCheck */;
|
|
585
|
+
}
|
|
586
|
+
function flush() {
|
|
587
|
+
while (notifyIndex < notifyBufferLength) {
|
|
588
|
+
const effect = notifyBuffer[notifyIndex];
|
|
589
|
+
notifyBuffer[notifyIndex++] = void 0;
|
|
590
|
+
effect.notify();
|
|
591
|
+
}
|
|
592
|
+
notifyIndex = 0;
|
|
593
|
+
notifyBufferLength = 0;
|
|
594
|
+
}
|
|
595
|
+
function checkDirty(link2, sub) {
|
|
596
|
+
let stack;
|
|
597
|
+
let checkDepth = 0;
|
|
598
|
+
top: do {
|
|
599
|
+
const dep = link2.dep;
|
|
600
|
+
const depFlags = dep.flags;
|
|
601
|
+
let dirty = false;
|
|
602
|
+
if (sub.flags & 16 /* Dirty */) {
|
|
603
|
+
dirty = true;
|
|
604
|
+
} else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
|
|
605
|
+
if (dep.update()) {
|
|
606
|
+
const subs = dep.subs;
|
|
607
|
+
if (subs.nextSub !== void 0) {
|
|
608
|
+
shallowPropagate(subs);
|
|
609
|
+
}
|
|
610
|
+
dirty = true;
|
|
611
|
+
}
|
|
612
|
+
} else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
|
|
613
|
+
if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
|
|
614
|
+
stack = { value: link2, prev: stack };
|
|
615
|
+
}
|
|
616
|
+
link2 = dep.deps;
|
|
617
|
+
sub = dep;
|
|
618
|
+
++checkDepth;
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (!dirty && link2.nextDep !== void 0) {
|
|
622
|
+
link2 = link2.nextDep;
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
while (checkDepth) {
|
|
626
|
+
--checkDepth;
|
|
627
|
+
const firstSub = sub.subs;
|
|
628
|
+
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
629
|
+
if (hasMultipleSubs) {
|
|
630
|
+
link2 = stack.value;
|
|
631
|
+
stack = stack.prev;
|
|
632
|
+
} else {
|
|
633
|
+
link2 = firstSub;
|
|
634
|
+
}
|
|
635
|
+
if (dirty) {
|
|
636
|
+
if (sub.update()) {
|
|
637
|
+
if (hasMultipleSubs) {
|
|
638
|
+
shallowPropagate(firstSub);
|
|
639
|
+
}
|
|
640
|
+
sub = link2.sub;
|
|
641
|
+
continue;
|
|
617
642
|
}
|
|
643
|
+
} else {
|
|
644
|
+
sub.flags &= -33 /* Pending */;
|
|
645
|
+
}
|
|
646
|
+
sub = link2.sub;
|
|
647
|
+
if (link2.nextDep !== void 0) {
|
|
648
|
+
link2 = link2.nextDep;
|
|
649
|
+
continue top;
|
|
650
|
+
}
|
|
651
|
+
dirty = false;
|
|
652
|
+
}
|
|
653
|
+
return dirty;
|
|
654
|
+
} while (true);
|
|
655
|
+
}
|
|
656
|
+
function shallowPropagate(link2) {
|
|
657
|
+
do {
|
|
658
|
+
const sub = link2.sub;
|
|
659
|
+
const nextSub = link2.nextSub;
|
|
660
|
+
const subFlags = sub.flags;
|
|
661
|
+
if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
|
|
662
|
+
sub.flags = subFlags | 16 /* Dirty */;
|
|
663
|
+
}
|
|
664
|
+
link2 = nextSub;
|
|
665
|
+
} while (link2 !== void 0);
|
|
666
|
+
}
|
|
667
|
+
function isValidLink(checkLink, sub) {
|
|
668
|
+
const depsTail = sub.depsTail;
|
|
669
|
+
if (depsTail !== void 0) {
|
|
670
|
+
let link2 = sub.deps;
|
|
671
|
+
do {
|
|
672
|
+
if (link2 === checkLink) {
|
|
673
|
+
return true;
|
|
618
674
|
}
|
|
619
|
-
|
|
620
|
-
|
|
675
|
+
if (link2 === depsTail) {
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
link2 = link2.nextDep;
|
|
679
|
+
} while (link2 !== void 0);
|
|
621
680
|
}
|
|
622
|
-
|
|
681
|
+
return false;
|
|
623
682
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
683
|
+
|
|
684
|
+
const triggerEventInfos = [];
|
|
685
|
+
function onTrack(sub, debugInfo) {
|
|
686
|
+
if (sub.onTrack) {
|
|
687
|
+
sub.onTrack(
|
|
688
|
+
extend(
|
|
689
|
+
{
|
|
690
|
+
effect: sub
|
|
691
|
+
},
|
|
692
|
+
debugInfo
|
|
693
|
+
)
|
|
694
|
+
);
|
|
629
695
|
}
|
|
630
696
|
}
|
|
631
|
-
function
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
head = link;
|
|
643
|
-
}
|
|
644
|
-
link.dep.activeLink = link.prevActiveLink;
|
|
645
|
-
link.prevActiveLink = void 0;
|
|
646
|
-
link = prev;
|
|
697
|
+
function onTrigger(sub) {
|
|
698
|
+
if (sub.onTrigger) {
|
|
699
|
+
const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
|
|
700
|
+
sub.onTrigger(
|
|
701
|
+
extend(
|
|
702
|
+
{
|
|
703
|
+
effect: sub
|
|
704
|
+
},
|
|
705
|
+
debugInfo
|
|
706
|
+
)
|
|
707
|
+
);
|
|
647
708
|
}
|
|
648
|
-
sub.deps = head;
|
|
649
|
-
sub.depsTail = tail;
|
|
650
709
|
}
|
|
651
|
-
function
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
return
|
|
710
|
+
function setupOnTrigger(target) {
|
|
711
|
+
Object.defineProperty(target.prototype, "onTrigger", {
|
|
712
|
+
get() {
|
|
713
|
+
return this._onTrigger;
|
|
714
|
+
},
|
|
715
|
+
set(val) {
|
|
716
|
+
if (val && !this._onTrigger) setupFlagsHandler(this);
|
|
717
|
+
this._onTrigger = val;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function setupFlagsHandler(target) {
|
|
722
|
+
target._flags = target.flags;
|
|
723
|
+
Object.defineProperty(target, "flags", {
|
|
724
|
+
get() {
|
|
725
|
+
return target._flags;
|
|
726
|
+
},
|
|
727
|
+
set(value) {
|
|
728
|
+
if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
|
|
729
|
+
onTrigger(this);
|
|
730
|
+
}
|
|
731
|
+
target._flags = value;
|
|
655
732
|
}
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
class Dep {
|
|
737
|
+
constructor(map, key) {
|
|
738
|
+
this.map = map;
|
|
739
|
+
this.key = key;
|
|
740
|
+
this._subs = void 0;
|
|
741
|
+
this.subsTail = void 0;
|
|
742
|
+
this.flags = ReactiveFlags.None;
|
|
656
743
|
}
|
|
657
|
-
|
|
658
|
-
return
|
|
744
|
+
get subs() {
|
|
745
|
+
return this._subs;
|
|
659
746
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
computed.flags &= -17;
|
|
667
|
-
if (computed.globalVersion === globalVersion) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
computed.globalVersion = globalVersion;
|
|
671
|
-
if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
computed.flags |= 2;
|
|
675
|
-
const dep = computed.dep;
|
|
676
|
-
const prevSub = activeSub;
|
|
677
|
-
const prevShouldTrack = shouldTrack;
|
|
678
|
-
activeSub = computed;
|
|
679
|
-
shouldTrack = true;
|
|
680
|
-
try {
|
|
681
|
-
prepareDeps(computed);
|
|
682
|
-
const value = computed.fn(computed._value);
|
|
683
|
-
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
684
|
-
computed.flags |= 128;
|
|
685
|
-
computed._value = value;
|
|
686
|
-
dep.version++;
|
|
687
|
-
}
|
|
688
|
-
} catch (err) {
|
|
689
|
-
dep.version++;
|
|
690
|
-
throw err;
|
|
691
|
-
} finally {
|
|
692
|
-
activeSub = prevSub;
|
|
693
|
-
shouldTrack = prevShouldTrack;
|
|
694
|
-
cleanupDeps(computed);
|
|
695
|
-
computed.flags &= -3;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
function removeSub(link, soft = false) {
|
|
699
|
-
const { dep, prevSub, nextSub } = link;
|
|
700
|
-
if (prevSub) {
|
|
701
|
-
prevSub.nextSub = nextSub;
|
|
702
|
-
link.prevSub = void 0;
|
|
703
|
-
}
|
|
704
|
-
if (nextSub) {
|
|
705
|
-
nextSub.prevSub = prevSub;
|
|
706
|
-
link.nextSub = void 0;
|
|
707
|
-
}
|
|
708
|
-
if (dep.subsHead === link) {
|
|
709
|
-
dep.subsHead = nextSub;
|
|
710
|
-
}
|
|
711
|
-
if (dep.subs === link) {
|
|
712
|
-
dep.subs = prevSub;
|
|
713
|
-
if (!prevSub && dep.computed) {
|
|
714
|
-
dep.computed.flags &= -5;
|
|
715
|
-
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
716
|
-
removeSub(l, true);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
if (!soft && !--dep.sc && dep.map) {
|
|
721
|
-
dep.map.delete(dep.key);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
function removeDep(link) {
|
|
725
|
-
const { prevDep, nextDep } = link;
|
|
726
|
-
if (prevDep) {
|
|
727
|
-
prevDep.nextDep = nextDep;
|
|
728
|
-
link.prevDep = void 0;
|
|
729
|
-
}
|
|
730
|
-
if (nextDep) {
|
|
731
|
-
nextDep.prevDep = prevDep;
|
|
732
|
-
link.nextDep = void 0;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
function effect(fn, options) {
|
|
736
|
-
if (fn.effect instanceof ReactiveEffect) {
|
|
737
|
-
fn = fn.effect.fn;
|
|
738
|
-
}
|
|
739
|
-
const e = new ReactiveEffect(fn);
|
|
740
|
-
if (options) {
|
|
741
|
-
extend(e, options);
|
|
742
|
-
}
|
|
743
|
-
try {
|
|
744
|
-
e.run();
|
|
745
|
-
} catch (err) {
|
|
746
|
-
e.stop();
|
|
747
|
-
throw err;
|
|
748
|
-
}
|
|
749
|
-
const runner = e.run.bind(e);
|
|
750
|
-
runner.effect = e;
|
|
751
|
-
return runner;
|
|
752
|
-
}
|
|
753
|
-
function stop(runner) {
|
|
754
|
-
runner.effect.stop();
|
|
755
|
-
}
|
|
756
|
-
let shouldTrack = true;
|
|
757
|
-
const trackStack = [];
|
|
758
|
-
function pauseTracking() {
|
|
759
|
-
trackStack.push(shouldTrack);
|
|
760
|
-
shouldTrack = false;
|
|
761
|
-
}
|
|
762
|
-
function resetTracking() {
|
|
763
|
-
const last = trackStack.pop();
|
|
764
|
-
shouldTrack = last === void 0 ? true : last;
|
|
765
|
-
}
|
|
766
|
-
function cleanupEffect(e) {
|
|
767
|
-
const { cleanup } = e;
|
|
768
|
-
e.cleanup = void 0;
|
|
769
|
-
if (cleanup) {
|
|
770
|
-
const prevSub = activeSub;
|
|
771
|
-
activeSub = void 0;
|
|
772
|
-
try {
|
|
773
|
-
cleanup();
|
|
774
|
-
} finally {
|
|
775
|
-
activeSub = prevSub;
|
|
747
|
+
set subs(value) {
|
|
748
|
+
this._subs = value;
|
|
749
|
+
if (value === void 0) {
|
|
750
|
+
this.map.delete(this.key);
|
|
776
751
|
}
|
|
777
752
|
}
|
|
778
753
|
}
|
|
779
|
-
|
|
780
|
-
let globalVersion = 0;
|
|
781
|
-
class Link {
|
|
782
|
-
constructor(sub, dep) {
|
|
783
|
-
this.sub = sub;
|
|
784
|
-
this.dep = dep;
|
|
785
|
-
this.version = dep.version;
|
|
786
|
-
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
class Dep {
|
|
790
|
-
// TODO isolatedDeclarations "__v_skip"
|
|
791
|
-
constructor(computed) {
|
|
792
|
-
this.computed = computed;
|
|
793
|
-
this.version = 0;
|
|
794
|
-
/**
|
|
795
|
-
* Link between this dep and the current active effect
|
|
796
|
-
*/
|
|
797
|
-
this.activeLink = void 0;
|
|
798
|
-
/**
|
|
799
|
-
* Doubly linked list representing the subscribing effects (tail)
|
|
800
|
-
*/
|
|
801
|
-
this.subs = void 0;
|
|
802
|
-
/**
|
|
803
|
-
* For object property deps cleanup
|
|
804
|
-
*/
|
|
805
|
-
this.map = void 0;
|
|
806
|
-
this.key = void 0;
|
|
807
|
-
/**
|
|
808
|
-
* Subscriber counter
|
|
809
|
-
*/
|
|
810
|
-
this.sc = 0;
|
|
811
|
-
/**
|
|
812
|
-
* @internal
|
|
813
|
-
*/
|
|
814
|
-
this.__v_skip = true;
|
|
815
|
-
{
|
|
816
|
-
this.subsHead = void 0;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
track(debugInfo) {
|
|
820
|
-
if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
let link = this.activeLink;
|
|
824
|
-
if (link === void 0 || link.sub !== activeSub) {
|
|
825
|
-
link = this.activeLink = new Link(activeSub, this);
|
|
826
|
-
if (!activeSub.deps) {
|
|
827
|
-
activeSub.deps = activeSub.depsTail = link;
|
|
828
|
-
} else {
|
|
829
|
-
link.prevDep = activeSub.depsTail;
|
|
830
|
-
activeSub.depsTail.nextDep = link;
|
|
831
|
-
activeSub.depsTail = link;
|
|
832
|
-
}
|
|
833
|
-
addSub(link);
|
|
834
|
-
} else if (link.version === -1) {
|
|
835
|
-
link.version = this.version;
|
|
836
|
-
if (link.nextDep) {
|
|
837
|
-
const next = link.nextDep;
|
|
838
|
-
next.prevDep = link.prevDep;
|
|
839
|
-
if (link.prevDep) {
|
|
840
|
-
link.prevDep.nextDep = next;
|
|
841
|
-
}
|
|
842
|
-
link.prevDep = activeSub.depsTail;
|
|
843
|
-
link.nextDep = void 0;
|
|
844
|
-
activeSub.depsTail.nextDep = link;
|
|
845
|
-
activeSub.depsTail = link;
|
|
846
|
-
if (activeSub.deps === link) {
|
|
847
|
-
activeSub.deps = next;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
if (activeSub.onTrack) {
|
|
852
|
-
activeSub.onTrack(
|
|
853
|
-
extend(
|
|
854
|
-
{
|
|
855
|
-
effect: activeSub
|
|
856
|
-
},
|
|
857
|
-
debugInfo
|
|
858
|
-
)
|
|
859
|
-
);
|
|
860
|
-
}
|
|
861
|
-
return link;
|
|
862
|
-
}
|
|
863
|
-
trigger(debugInfo) {
|
|
864
|
-
this.version++;
|
|
865
|
-
globalVersion++;
|
|
866
|
-
this.notify(debugInfo);
|
|
867
|
-
}
|
|
868
|
-
notify(debugInfo) {
|
|
869
|
-
startBatch();
|
|
870
|
-
try {
|
|
871
|
-
if (true) {
|
|
872
|
-
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
873
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
874
|
-
head.sub.onTrigger(
|
|
875
|
-
extend(
|
|
876
|
-
{
|
|
877
|
-
effect: head.sub
|
|
878
|
-
},
|
|
879
|
-
debugInfo
|
|
880
|
-
)
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
for (let link = this.subs; link; link = link.prevSub) {
|
|
886
|
-
if (link.sub.notify()) {
|
|
887
|
-
;
|
|
888
|
-
link.sub.dep.notify();
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
} finally {
|
|
892
|
-
endBatch();
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
function addSub(link) {
|
|
897
|
-
link.dep.sc++;
|
|
898
|
-
if (link.sub.flags & 4) {
|
|
899
|
-
const computed = link.dep.computed;
|
|
900
|
-
if (computed && !link.dep.subs) {
|
|
901
|
-
computed.flags |= 4 | 16;
|
|
902
|
-
for (let l = computed.deps; l; l = l.nextDep) {
|
|
903
|
-
addSub(l);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
const currentTail = link.dep.subs;
|
|
907
|
-
if (currentTail !== link) {
|
|
908
|
-
link.prevSub = currentTail;
|
|
909
|
-
if (currentTail) currentTail.nextSub = link;
|
|
910
|
-
}
|
|
911
|
-
if (link.dep.subsHead === void 0) {
|
|
912
|
-
link.dep.subsHead = link;
|
|
913
|
-
}
|
|
914
|
-
link.dep.subs = link;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
754
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
918
755
|
const ITERATE_KEY = Symbol(
|
|
919
756
|
"Object iterate"
|
|
@@ -925,36 +762,34 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
925
762
|
"Array iterate"
|
|
926
763
|
);
|
|
927
764
|
function track(target, type, key) {
|
|
928
|
-
if (
|
|
765
|
+
if (activeSub !== void 0) {
|
|
929
766
|
let depsMap = targetMap.get(target);
|
|
930
767
|
if (!depsMap) {
|
|
931
768
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
932
769
|
}
|
|
933
770
|
let dep = depsMap.get(key);
|
|
934
771
|
if (!dep) {
|
|
935
|
-
depsMap.set(key, dep = new Dep());
|
|
936
|
-
dep.map = depsMap;
|
|
937
|
-
dep.key = key;
|
|
772
|
+
depsMap.set(key, dep = new Dep(depsMap, key));
|
|
938
773
|
}
|
|
939
774
|
{
|
|
940
|
-
|
|
775
|
+
onTrack(activeSub, {
|
|
941
776
|
target,
|
|
942
777
|
type,
|
|
943
778
|
key
|
|
944
779
|
});
|
|
945
780
|
}
|
|
781
|
+
link(dep, activeSub);
|
|
946
782
|
}
|
|
947
783
|
}
|
|
948
784
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
949
785
|
const depsMap = targetMap.get(target);
|
|
950
786
|
if (!depsMap) {
|
|
951
|
-
globalVersion++;
|
|
952
787
|
return;
|
|
953
788
|
}
|
|
954
789
|
const run = (dep) => {
|
|
955
|
-
if (dep) {
|
|
790
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
956
791
|
{
|
|
957
|
-
|
|
792
|
+
triggerEventInfos.push({
|
|
958
793
|
target,
|
|
959
794
|
type,
|
|
960
795
|
key,
|
|
@@ -963,6 +798,11 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
963
798
|
oldTarget
|
|
964
799
|
});
|
|
965
800
|
}
|
|
801
|
+
propagate(dep.subs);
|
|
802
|
+
shallowPropagate(dep.subs);
|
|
803
|
+
{
|
|
804
|
+
triggerEventInfos.pop();
|
|
805
|
+
}
|
|
966
806
|
}
|
|
967
807
|
};
|
|
968
808
|
startBatch();
|
|
@@ -1187,11 +1027,11 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1187
1027
|
return res;
|
|
1188
1028
|
}
|
|
1189
1029
|
function noTracking(self, method, args = []) {
|
|
1190
|
-
pauseTracking();
|
|
1191
1030
|
startBatch();
|
|
1031
|
+
const prevSub = setActiveSub();
|
|
1192
1032
|
const res = toRaw(self)[method].apply(self, args);
|
|
1033
|
+
setActiveSub(prevSub);
|
|
1193
1034
|
endBatch();
|
|
1194
|
-
resetTracking();
|
|
1195
1035
|
return res;
|
|
1196
1036
|
}
|
|
1197
1037
|
|
|
@@ -1237,14 +1077,18 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1237
1077
|
return hasOwnProperty;
|
|
1238
1078
|
}
|
|
1239
1079
|
}
|
|
1080
|
+
const wasRef = isRef(target);
|
|
1240
1081
|
const res = Reflect.get(
|
|
1241
1082
|
target,
|
|
1242
1083
|
key,
|
|
1243
1084
|
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1244
1085
|
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1245
1086
|
// its class methods
|
|
1246
|
-
|
|
1087
|
+
wasRef ? target : receiver
|
|
1247
1088
|
);
|
|
1089
|
+
if (wasRef && key !== "value") {
|
|
1090
|
+
return res;
|
|
1091
|
+
}
|
|
1248
1092
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1249
1093
|
return res;
|
|
1250
1094
|
}
|
|
@@ -1696,33 +1540,47 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1696
1540
|
return r ? r["__v_isRef"] === true : false;
|
|
1697
1541
|
}
|
|
1698
1542
|
function ref(value) {
|
|
1699
|
-
return createRef(value,
|
|
1543
|
+
return createRef(value, toReactive);
|
|
1700
1544
|
}
|
|
1701
1545
|
function shallowRef(value) {
|
|
1702
|
-
return createRef(value
|
|
1546
|
+
return createRef(value);
|
|
1703
1547
|
}
|
|
1704
|
-
function createRef(rawValue,
|
|
1548
|
+
function createRef(rawValue, wrap) {
|
|
1705
1549
|
if (isRef(rawValue)) {
|
|
1706
1550
|
return rawValue;
|
|
1707
1551
|
}
|
|
1708
|
-
return new RefImpl(rawValue,
|
|
1552
|
+
return new RefImpl(rawValue, wrap);
|
|
1709
1553
|
}
|
|
1710
1554
|
class RefImpl {
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
this
|
|
1714
|
-
this
|
|
1715
|
-
this.
|
|
1716
|
-
|
|
1717
|
-
|
|
1555
|
+
// TODO isolatedDeclarations "__v_isShallow"
|
|
1556
|
+
constructor(value, wrap) {
|
|
1557
|
+
this.subs = void 0;
|
|
1558
|
+
this.subsTail = void 0;
|
|
1559
|
+
this.flags = ReactiveFlags.Mutable;
|
|
1560
|
+
/**
|
|
1561
|
+
* @internal
|
|
1562
|
+
*/
|
|
1563
|
+
this.__v_isRef = true;
|
|
1564
|
+
// TODO isolatedDeclarations "__v_isRef"
|
|
1565
|
+
/**
|
|
1566
|
+
* @internal
|
|
1567
|
+
*/
|
|
1568
|
+
this.__v_isShallow = false;
|
|
1569
|
+
this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
|
|
1570
|
+
this._value = wrap ? wrap(value) : value;
|
|
1571
|
+
this._wrap = wrap;
|
|
1572
|
+
this["__v_isShallow"] = !wrap;
|
|
1573
|
+
}
|
|
1574
|
+
get dep() {
|
|
1575
|
+
return this;
|
|
1718
1576
|
}
|
|
1719
1577
|
get value() {
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
}
|
|
1578
|
+
trackRef(this);
|
|
1579
|
+
if (this.flags & ReactiveFlags.Dirty && this.update()) {
|
|
1580
|
+
const subs = this.subs;
|
|
1581
|
+
if (subs !== void 0) {
|
|
1582
|
+
shallowPropagate(subs);
|
|
1583
|
+
}
|
|
1726
1584
|
}
|
|
1727
1585
|
return this._value;
|
|
1728
1586
|
}
|
|
@@ -1731,30 +1589,55 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1731
1589
|
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1732
1590
|
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1733
1591
|
if (hasChanged(newValue, oldValue)) {
|
|
1592
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
1734
1593
|
this._rawValue = newValue;
|
|
1735
|
-
this._value = useDirectValue ? newValue :
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1594
|
+
this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
|
|
1595
|
+
const subs = this.subs;
|
|
1596
|
+
if (subs !== void 0) {
|
|
1597
|
+
{
|
|
1598
|
+
triggerEventInfos.push({
|
|
1599
|
+
target: this,
|
|
1600
|
+
type: "set",
|
|
1601
|
+
key: "value",
|
|
1602
|
+
newValue,
|
|
1603
|
+
oldValue
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
propagate(subs);
|
|
1607
|
+
if (!batchDepth) {
|
|
1608
|
+
flush();
|
|
1609
|
+
}
|
|
1610
|
+
{
|
|
1611
|
+
triggerEventInfos.pop();
|
|
1612
|
+
}
|
|
1744
1613
|
}
|
|
1745
1614
|
}
|
|
1746
1615
|
}
|
|
1616
|
+
update() {
|
|
1617
|
+
this.flags &= ~ReactiveFlags.Dirty;
|
|
1618
|
+
return hasChanged(this._oldValue, this._oldValue = this._rawValue);
|
|
1619
|
+
}
|
|
1747
1620
|
}
|
|
1748
1621
|
function triggerRef(ref2) {
|
|
1749
|
-
|
|
1622
|
+
const dep = ref2.dep;
|
|
1623
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
1624
|
+
propagate(dep.subs);
|
|
1625
|
+
shallowPropagate(dep.subs);
|
|
1626
|
+
if (!batchDepth) {
|
|
1627
|
+
flush();
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
function trackRef(dep) {
|
|
1632
|
+
if (activeSub !== void 0) {
|
|
1750
1633
|
{
|
|
1751
|
-
|
|
1752
|
-
target:
|
|
1753
|
-
type: "
|
|
1754
|
-
key: "value"
|
|
1755
|
-
newValue: ref2._value
|
|
1634
|
+
onTrack(activeSub, {
|
|
1635
|
+
target: dep,
|
|
1636
|
+
type: "get",
|
|
1637
|
+
key: "value"
|
|
1756
1638
|
});
|
|
1757
1639
|
}
|
|
1640
|
+
link(dep, activeSub);
|
|
1758
1641
|
}
|
|
1759
1642
|
}
|
|
1760
1643
|
function unref(ref2) {
|
|
@@ -1780,13 +1663,21 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1780
1663
|
}
|
|
1781
1664
|
class CustomRefImpl {
|
|
1782
1665
|
constructor(factory) {
|
|
1666
|
+
this.subs = void 0;
|
|
1667
|
+
this.subsTail = void 0;
|
|
1668
|
+
this.flags = ReactiveFlags.None;
|
|
1783
1669
|
this["__v_isRef"] = true;
|
|
1784
1670
|
this._value = void 0;
|
|
1785
|
-
const
|
|
1786
|
-
|
|
1671
|
+
const { get, set } = factory(
|
|
1672
|
+
() => trackRef(this),
|
|
1673
|
+
() => triggerRef(this)
|
|
1674
|
+
);
|
|
1787
1675
|
this._get = get;
|
|
1788
1676
|
this._set = set;
|
|
1789
1677
|
}
|
|
1678
|
+
get dep() {
|
|
1679
|
+
return this;
|
|
1680
|
+
}
|
|
1790
1681
|
get value() {
|
|
1791
1682
|
return this._value = this._get();
|
|
1792
1683
|
}
|
|
@@ -1798,9 +1689,6 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1798
1689
|
return new CustomRefImpl(factory);
|
|
1799
1690
|
}
|
|
1800
1691
|
function toRefs(object) {
|
|
1801
|
-
if (!isProxy(object)) {
|
|
1802
|
-
warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
|
1803
|
-
}
|
|
1804
1692
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1805
1693
|
for (const key in object) {
|
|
1806
1694
|
ret[key] = propertyToRef(object, key);
|
|
@@ -1853,69 +1741,331 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1853
1741
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1854
1742
|
}
|
|
1855
1743
|
|
|
1856
|
-
class
|
|
1857
|
-
constructor(fn
|
|
1858
|
-
this.
|
|
1859
|
-
this.
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
this._value = void 0;
|
|
1864
|
-
/**
|
|
1865
|
-
* @internal
|
|
1866
|
-
*/
|
|
1867
|
-
this.dep = new Dep(this);
|
|
1744
|
+
class ReactiveEffect {
|
|
1745
|
+
constructor(fn) {
|
|
1746
|
+
this.deps = void 0;
|
|
1747
|
+
this.depsTail = void 0;
|
|
1748
|
+
this.subs = void 0;
|
|
1749
|
+
this.subsTail = void 0;
|
|
1750
|
+
this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
|
|
1868
1751
|
/**
|
|
1869
1752
|
* @internal
|
|
1870
1753
|
*/
|
|
1871
|
-
this.
|
|
1872
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1873
|
-
// A computed is also a subscriber that tracks other deps
|
|
1754
|
+
this.cleanups = [];
|
|
1874
1755
|
/**
|
|
1875
1756
|
* @internal
|
|
1876
1757
|
*/
|
|
1758
|
+
this.cleanupsLength = 0;
|
|
1759
|
+
if (fn !== void 0) {
|
|
1760
|
+
this.fn = fn;
|
|
1761
|
+
}
|
|
1762
|
+
if (activeEffectScope) {
|
|
1763
|
+
link(this, activeEffectScope);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
// @ts-expect-error
|
|
1767
|
+
fn() {
|
|
1768
|
+
}
|
|
1769
|
+
get active() {
|
|
1770
|
+
return !(this.flags & 1024);
|
|
1771
|
+
}
|
|
1772
|
+
pause() {
|
|
1773
|
+
this.flags |= 256;
|
|
1774
|
+
}
|
|
1775
|
+
resume() {
|
|
1776
|
+
const flags = this.flags &= -257;
|
|
1777
|
+
if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
|
|
1778
|
+
this.notify();
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
notify() {
|
|
1782
|
+
if (!(this.flags & 256) && this.dirty) {
|
|
1783
|
+
this.run();
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
run() {
|
|
1787
|
+
if (!this.active) {
|
|
1788
|
+
return this.fn();
|
|
1789
|
+
}
|
|
1790
|
+
cleanup(this);
|
|
1791
|
+
const prevSub = startTracking(this);
|
|
1792
|
+
try {
|
|
1793
|
+
return this.fn();
|
|
1794
|
+
} finally {
|
|
1795
|
+
endTracking(this, prevSub);
|
|
1796
|
+
const flags = this.flags;
|
|
1797
|
+
if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
|
|
1798
|
+
this.flags = flags & ~ReactiveFlags.Recursed;
|
|
1799
|
+
this.notify();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
stop() {
|
|
1804
|
+
if (!this.active) {
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
this.flags = 1024;
|
|
1808
|
+
let dep = this.deps;
|
|
1809
|
+
while (dep !== void 0) {
|
|
1810
|
+
dep = unlink(dep, this);
|
|
1811
|
+
}
|
|
1812
|
+
const sub = this.subs;
|
|
1813
|
+
if (sub !== void 0) {
|
|
1814
|
+
unlink(sub);
|
|
1815
|
+
}
|
|
1816
|
+
cleanup(this);
|
|
1817
|
+
}
|
|
1818
|
+
get dirty() {
|
|
1819
|
+
const flags = this.flags;
|
|
1820
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1821
|
+
return true;
|
|
1822
|
+
}
|
|
1823
|
+
if (flags & ReactiveFlags.Pending) {
|
|
1824
|
+
if (checkDirty(this.deps, this)) {
|
|
1825
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
1826
|
+
return true;
|
|
1827
|
+
} else {
|
|
1828
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return false;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
{
|
|
1835
|
+
setupOnTrigger(ReactiveEffect);
|
|
1836
|
+
}
|
|
1837
|
+
function effect(fn, options) {
|
|
1838
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
1839
|
+
fn = fn.effect.fn;
|
|
1840
|
+
}
|
|
1841
|
+
const e = new ReactiveEffect(fn);
|
|
1842
|
+
if (options) {
|
|
1843
|
+
const { onStop, scheduler } = options;
|
|
1844
|
+
if (onStop) {
|
|
1845
|
+
options.onStop = void 0;
|
|
1846
|
+
const stop2 = e.stop.bind(e);
|
|
1847
|
+
e.stop = () => {
|
|
1848
|
+
stop2();
|
|
1849
|
+
onStop();
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
if (scheduler) {
|
|
1853
|
+
options.scheduler = void 0;
|
|
1854
|
+
e.notify = () => {
|
|
1855
|
+
if (!(e.flags & 256)) {
|
|
1856
|
+
scheduler();
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
extend(e, options);
|
|
1861
|
+
}
|
|
1862
|
+
try {
|
|
1863
|
+
e.run();
|
|
1864
|
+
} catch (err) {
|
|
1865
|
+
e.stop();
|
|
1866
|
+
throw err;
|
|
1867
|
+
}
|
|
1868
|
+
const runner = e.run.bind(e);
|
|
1869
|
+
runner.effect = e;
|
|
1870
|
+
return runner;
|
|
1871
|
+
}
|
|
1872
|
+
function stop(runner) {
|
|
1873
|
+
runner.effect.stop();
|
|
1874
|
+
}
|
|
1875
|
+
function cleanup(sub) {
|
|
1876
|
+
const l = sub.cleanupsLength;
|
|
1877
|
+
if (l) {
|
|
1878
|
+
for (let i = 0; i < l; i++) {
|
|
1879
|
+
sub.cleanups[i]();
|
|
1880
|
+
}
|
|
1881
|
+
sub.cleanupsLength = 0;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
let activeEffectScope;
|
|
1886
|
+
class EffectScope {
|
|
1887
|
+
constructor(detached = false) {
|
|
1877
1888
|
this.deps = void 0;
|
|
1889
|
+
this.depsTail = void 0;
|
|
1890
|
+
this.subs = void 0;
|
|
1891
|
+
this.subsTail = void 0;
|
|
1892
|
+
this.flags = 0;
|
|
1878
1893
|
/**
|
|
1879
1894
|
* @internal
|
|
1880
1895
|
*/
|
|
1881
|
-
this.
|
|
1896
|
+
this.cleanups = [];
|
|
1882
1897
|
/**
|
|
1883
1898
|
* @internal
|
|
1884
1899
|
*/
|
|
1885
|
-
this.
|
|
1900
|
+
this.cleanupsLength = 0;
|
|
1901
|
+
if (!detached && activeEffectScope) {
|
|
1902
|
+
link(this, activeEffectScope);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
get active() {
|
|
1906
|
+
return !(this.flags & 1024);
|
|
1907
|
+
}
|
|
1908
|
+
pause() {
|
|
1909
|
+
if (!(this.flags & 256)) {
|
|
1910
|
+
this.flags |= 256;
|
|
1911
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1912
|
+
const dep = link2.dep;
|
|
1913
|
+
if ("pause" in dep) {
|
|
1914
|
+
dep.pause();
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
1921
|
+
*/
|
|
1922
|
+
resume() {
|
|
1923
|
+
const flags = this.flags;
|
|
1924
|
+
if (flags & 256) {
|
|
1925
|
+
this.flags = flags & -257;
|
|
1926
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1927
|
+
const dep = link2.dep;
|
|
1928
|
+
if ("resume" in dep) {
|
|
1929
|
+
dep.resume();
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
run(fn) {
|
|
1935
|
+
const prevScope = activeEffectScope;
|
|
1936
|
+
try {
|
|
1937
|
+
activeEffectScope = this;
|
|
1938
|
+
return fn();
|
|
1939
|
+
} finally {
|
|
1940
|
+
activeEffectScope = prevScope;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
stop() {
|
|
1944
|
+
if (!this.active) {
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
this.flags = 1024;
|
|
1948
|
+
let dep = this.deps;
|
|
1949
|
+
while (dep !== void 0) {
|
|
1950
|
+
const node = dep.dep;
|
|
1951
|
+
if ("stop" in node) {
|
|
1952
|
+
dep = dep.nextDep;
|
|
1953
|
+
node.stop();
|
|
1954
|
+
} else {
|
|
1955
|
+
dep = unlink(dep, this);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
const sub = this.subs;
|
|
1959
|
+
if (sub !== void 0) {
|
|
1960
|
+
unlink(sub);
|
|
1961
|
+
}
|
|
1962
|
+
cleanup(this);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
function effectScope(detached) {
|
|
1966
|
+
return new EffectScope(detached);
|
|
1967
|
+
}
|
|
1968
|
+
function getCurrentScope() {
|
|
1969
|
+
return activeEffectScope;
|
|
1970
|
+
}
|
|
1971
|
+
function setCurrentScope(scope) {
|
|
1972
|
+
try {
|
|
1973
|
+
return activeEffectScope;
|
|
1974
|
+
} finally {
|
|
1975
|
+
activeEffectScope = scope;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
1979
|
+
if (activeEffectScope !== void 0) {
|
|
1980
|
+
activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
|
|
1981
|
+
} else if (!failSilently) {
|
|
1982
|
+
warn$2(
|
|
1983
|
+
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
class ComputedRefImpl {
|
|
1989
|
+
constructor(fn, setter) {
|
|
1990
|
+
this.fn = fn;
|
|
1991
|
+
this.setter = setter;
|
|
1886
1992
|
/**
|
|
1887
1993
|
* @internal
|
|
1888
1994
|
*/
|
|
1889
|
-
this.
|
|
1995
|
+
this._value = void 0;
|
|
1996
|
+
this.subs = void 0;
|
|
1997
|
+
this.subsTail = void 0;
|
|
1998
|
+
this.deps = void 0;
|
|
1999
|
+
this.depsTail = void 0;
|
|
2000
|
+
this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
1890
2001
|
/**
|
|
1891
2002
|
* @internal
|
|
1892
2003
|
*/
|
|
1893
|
-
this.
|
|
1894
|
-
// for backwards compat
|
|
1895
|
-
this.effect = this;
|
|
2004
|
+
this.__v_isRef = true;
|
|
1896
2005
|
this["__v_isReadonly"] = !setter;
|
|
1897
|
-
|
|
2006
|
+
}
|
|
2007
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
2008
|
+
// for backwards compat
|
|
2009
|
+
get effect() {
|
|
2010
|
+
return this;
|
|
2011
|
+
}
|
|
2012
|
+
// for backwards compat
|
|
2013
|
+
get dep() {
|
|
2014
|
+
return this;
|
|
1898
2015
|
}
|
|
1899
2016
|
/**
|
|
1900
2017
|
* @internal
|
|
2018
|
+
* for backwards compat
|
|
1901
2019
|
*/
|
|
1902
|
-
|
|
1903
|
-
this.flags
|
|
1904
|
-
if (
|
|
1905
|
-
activeSub !== this) {
|
|
1906
|
-
batch(this, true);
|
|
2020
|
+
get _dirty() {
|
|
2021
|
+
const flags = this.flags;
|
|
2022
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1907
2023
|
return true;
|
|
1908
2024
|
}
|
|
2025
|
+
if (flags & ReactiveFlags.Pending) {
|
|
2026
|
+
if (checkDirty(this.deps, this)) {
|
|
2027
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
2028
|
+
return true;
|
|
2029
|
+
} else {
|
|
2030
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
return false;
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* @internal
|
|
2037
|
+
* for backwards compat
|
|
2038
|
+
*/
|
|
2039
|
+
set _dirty(v) {
|
|
2040
|
+
if (v) {
|
|
2041
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
2042
|
+
} else {
|
|
2043
|
+
this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
|
|
2044
|
+
}
|
|
1909
2045
|
}
|
|
1910
2046
|
get value() {
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2047
|
+
const flags = this.flags;
|
|
2048
|
+
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
|
|
2049
|
+
if (this.update()) {
|
|
2050
|
+
const subs = this.subs;
|
|
2051
|
+
if (subs !== void 0) {
|
|
2052
|
+
shallowPropagate(subs);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
} else if (flags & ReactiveFlags.Pending) {
|
|
2056
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2057
|
+
}
|
|
2058
|
+
if (activeSub !== void 0) {
|
|
2059
|
+
{
|
|
2060
|
+
onTrack(activeSub, {
|
|
2061
|
+
target: this,
|
|
2062
|
+
type: "get",
|
|
2063
|
+
key: "value"
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
link(this, activeSub);
|
|
2067
|
+
} else if (activeEffectScope !== void 0) {
|
|
2068
|
+
link(this, activeEffectScope);
|
|
1919
2069
|
}
|
|
1920
2070
|
return this._value;
|
|
1921
2071
|
}
|
|
@@ -1926,6 +2076,23 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1926
2076
|
warn$2("Write operation failed: computed value is readonly");
|
|
1927
2077
|
}
|
|
1928
2078
|
}
|
|
2079
|
+
update() {
|
|
2080
|
+
const prevSub = startTracking(this);
|
|
2081
|
+
try {
|
|
2082
|
+
const oldValue = this._value;
|
|
2083
|
+
const newValue = this.fn(oldValue);
|
|
2084
|
+
if (hasChanged(oldValue, newValue)) {
|
|
2085
|
+
this._value = newValue;
|
|
2086
|
+
return true;
|
|
2087
|
+
}
|
|
2088
|
+
return false;
|
|
2089
|
+
} finally {
|
|
2090
|
+
endTracking(this, prevSub);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
{
|
|
2095
|
+
setupOnTrigger(ComputedRefImpl);
|
|
1929
2096
|
}
|
|
1930
2097
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1931
2098
|
let getter;
|
|
@@ -1936,7 +2103,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1936
2103
|
getter = getterOrOptions.get;
|
|
1937
2104
|
setter = getterOrOptions.set;
|
|
1938
2105
|
}
|
|
1939
|
-
const cRef = new ComputedRefImpl(getter, setter
|
|
2106
|
+
const cRef = new ComputedRefImpl(getter, setter);
|
|
1940
2107
|
if (debugOptions && !isSSR) {
|
|
1941
2108
|
cRef.onTrack = debugOptions.onTrack;
|
|
1942
2109
|
cRef.onTrigger = debugOptions.onTrigger;
|
|
@@ -1957,177 +2124,146 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1957
2124
|
};
|
|
1958
2125
|
|
|
1959
2126
|
const INITIAL_WATCHER_VALUE = {};
|
|
1960
|
-
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1961
2127
|
let activeWatcher = void 0;
|
|
1962
2128
|
function getCurrentWatcher() {
|
|
1963
2129
|
return activeWatcher;
|
|
1964
2130
|
}
|
|
1965
2131
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1966
2132
|
if (owner) {
|
|
1967
|
-
|
|
1968
|
-
if (
|
|
1969
|
-
|
|
2133
|
+
const { call } = owner.options;
|
|
2134
|
+
if (call) {
|
|
2135
|
+
owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
|
|
2136
|
+
} else {
|
|
2137
|
+
owner.cleanups[owner.cleanupsLength++] = cleanupFn;
|
|
2138
|
+
}
|
|
1970
2139
|
} else if (!failSilently) {
|
|
1971
2140
|
warn$2(
|
|
1972
2141
|
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1973
2142
|
);
|
|
1974
2143
|
}
|
|
1975
2144
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2006
|
-
getter = () => source.map((s) => {
|
|
2007
|
-
if (isRef(s)) {
|
|
2008
|
-
return s.value;
|
|
2009
|
-
} else if (isReactive(s)) {
|
|
2010
|
-
return reactiveGetter(s);
|
|
2011
|
-
} else if (isFunction(s)) {
|
|
2012
|
-
return call ? call(s, 2) : s();
|
|
2145
|
+
class WatcherEffect extends ReactiveEffect {
|
|
2146
|
+
constructor(source, cb, options = EMPTY_OBJ) {
|
|
2147
|
+
const { deep, once, call, onWarn } = options;
|
|
2148
|
+
let getter;
|
|
2149
|
+
let forceTrigger = false;
|
|
2150
|
+
let isMultiSource = false;
|
|
2151
|
+
if (isRef(source)) {
|
|
2152
|
+
getter = () => source.value;
|
|
2153
|
+
forceTrigger = isShallow(source);
|
|
2154
|
+
} else if (isReactive(source)) {
|
|
2155
|
+
getter = () => reactiveGetter(source, deep);
|
|
2156
|
+
forceTrigger = true;
|
|
2157
|
+
} else if (isArray(source)) {
|
|
2158
|
+
isMultiSource = true;
|
|
2159
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2160
|
+
getter = () => source.map((s) => {
|
|
2161
|
+
if (isRef(s)) {
|
|
2162
|
+
return s.value;
|
|
2163
|
+
} else if (isReactive(s)) {
|
|
2164
|
+
return reactiveGetter(s, deep);
|
|
2165
|
+
} else if (isFunction(s)) {
|
|
2166
|
+
return call ? call(s, 2) : s();
|
|
2167
|
+
} else {
|
|
2168
|
+
warnInvalidSource(s, onWarn);
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
} else if (isFunction(source)) {
|
|
2172
|
+
if (cb) {
|
|
2173
|
+
getter = call ? () => call(source, 2) : source;
|
|
2013
2174
|
} else {
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2175
|
+
getter = () => {
|
|
2176
|
+
if (this.cleanupsLength) {
|
|
2177
|
+
const prevSub = setActiveSub();
|
|
2178
|
+
try {
|
|
2179
|
+
cleanup(this);
|
|
2180
|
+
} finally {
|
|
2181
|
+
setActiveSub(prevSub);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
const currentEffect = activeWatcher;
|
|
2185
|
+
activeWatcher = this;
|
|
2024
2186
|
try {
|
|
2025
|
-
|
|
2187
|
+
return call ? call(source, 3, [
|
|
2188
|
+
this.boundCleanup
|
|
2189
|
+
]) : source(this.boundCleanup);
|
|
2026
2190
|
} finally {
|
|
2027
|
-
|
|
2191
|
+
activeWatcher = currentEffect;
|
|
2028
2192
|
}
|
|
2029
|
-
}
|
|
2030
|
-
const currentEffect = activeWatcher;
|
|
2031
|
-
activeWatcher = effect;
|
|
2032
|
-
try {
|
|
2033
|
-
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
2034
|
-
} finally {
|
|
2035
|
-
activeWatcher = currentEffect;
|
|
2036
|
-
}
|
|
2037
|
-
};
|
|
2038
|
-
}
|
|
2039
|
-
} else {
|
|
2040
|
-
getter = NOOP;
|
|
2041
|
-
warnInvalidSource(source);
|
|
2042
|
-
}
|
|
2043
|
-
if (cb && deep) {
|
|
2044
|
-
const baseGetter = getter;
|
|
2045
|
-
const depth = deep === true ? Infinity : deep;
|
|
2046
|
-
getter = () => traverse(baseGetter(), depth);
|
|
2047
|
-
}
|
|
2048
|
-
const scope = getCurrentScope();
|
|
2049
|
-
const watchHandle = () => {
|
|
2050
|
-
effect.stop();
|
|
2051
|
-
if (scope && scope.active) {
|
|
2052
|
-
remove(scope.effects, effect);
|
|
2053
|
-
}
|
|
2054
|
-
};
|
|
2055
|
-
if (once && cb) {
|
|
2056
|
-
const _cb = cb;
|
|
2057
|
-
cb = (...args) => {
|
|
2058
|
-
_cb(...args);
|
|
2059
|
-
watchHandle();
|
|
2060
|
-
};
|
|
2061
|
-
}
|
|
2062
|
-
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2063
|
-
const job = (immediateFirstRun) => {
|
|
2064
|
-
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
2065
|
-
return;
|
|
2066
|
-
}
|
|
2067
|
-
if (cb) {
|
|
2068
|
-
const newValue = effect.run();
|
|
2069
|
-
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2070
|
-
if (cleanup) {
|
|
2071
|
-
cleanup();
|
|
2072
|
-
}
|
|
2073
|
-
const currentWatcher = activeWatcher;
|
|
2074
|
-
activeWatcher = effect;
|
|
2075
|
-
try {
|
|
2076
|
-
const args = [
|
|
2077
|
-
newValue,
|
|
2078
|
-
// pass undefined as the old value when it's changed for the first time
|
|
2079
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2080
|
-
boundCleanup
|
|
2081
|
-
];
|
|
2082
|
-
oldValue = newValue;
|
|
2083
|
-
call ? call(cb, 3, args) : (
|
|
2084
|
-
// @ts-expect-error
|
|
2085
|
-
cb(...args)
|
|
2086
|
-
);
|
|
2087
|
-
} finally {
|
|
2088
|
-
activeWatcher = currentWatcher;
|
|
2089
|
-
}
|
|
2193
|
+
};
|
|
2090
2194
|
}
|
|
2091
2195
|
} else {
|
|
2092
|
-
|
|
2196
|
+
getter = NOOP;
|
|
2197
|
+
warnInvalidSource(source, onWarn);
|
|
2198
|
+
}
|
|
2199
|
+
if (cb && deep) {
|
|
2200
|
+
const baseGetter = getter;
|
|
2201
|
+
const depth = deep === true ? Infinity : deep;
|
|
2202
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2203
|
+
}
|
|
2204
|
+
super(getter);
|
|
2205
|
+
this.cb = cb;
|
|
2206
|
+
this.options = options;
|
|
2207
|
+
this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
|
|
2208
|
+
this.forceTrigger = forceTrigger;
|
|
2209
|
+
this.isMultiSource = isMultiSource;
|
|
2210
|
+
if (once && cb) {
|
|
2211
|
+
const _cb = cb;
|
|
2212
|
+
cb = (...args) => {
|
|
2213
|
+
_cb(...args);
|
|
2214
|
+
this.stop();
|
|
2215
|
+
};
|
|
2093
2216
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
2100
|
-
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
2101
|
-
cleanup = effect.onStop = () => {
|
|
2102
|
-
const cleanups = cleanupMap.get(effect);
|
|
2103
|
-
if (cleanups) {
|
|
2104
|
-
if (call) {
|
|
2105
|
-
call(cleanups, 4);
|
|
2106
|
-
} else {
|
|
2107
|
-
for (const cleanup2 of cleanups) cleanup2();
|
|
2108
|
-
}
|
|
2109
|
-
cleanupMap.delete(effect);
|
|
2217
|
+
this.cb = cb;
|
|
2218
|
+
this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2219
|
+
{
|
|
2220
|
+
this.onTrack = options.onTrack;
|
|
2221
|
+
this.onTrigger = options.onTrigger;
|
|
2110
2222
|
}
|
|
2111
|
-
};
|
|
2112
|
-
{
|
|
2113
|
-
effect.onTrack = options.onTrack;
|
|
2114
|
-
effect.onTrigger = options.onTrigger;
|
|
2115
2223
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2224
|
+
run(initialRun = false) {
|
|
2225
|
+
const oldValue = this.oldValue;
|
|
2226
|
+
const newValue = this.oldValue = super.run();
|
|
2227
|
+
if (!this.cb) {
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
const { immediate, deep, call } = this.options;
|
|
2231
|
+
if (initialRun && !immediate) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2235
|
+
cleanup(this);
|
|
2236
|
+
const currentWatcher = activeWatcher;
|
|
2237
|
+
activeWatcher = this;
|
|
2238
|
+
try {
|
|
2239
|
+
const args = [
|
|
2240
|
+
newValue,
|
|
2241
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2242
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2243
|
+
this.boundCleanup
|
|
2244
|
+
];
|
|
2245
|
+
call ? call(this.cb, 3, args) : (
|
|
2246
|
+
// @ts-expect-error
|
|
2247
|
+
this.cb(...args)
|
|
2248
|
+
);
|
|
2249
|
+
} finally {
|
|
2250
|
+
activeWatcher = currentWatcher;
|
|
2251
|
+
}
|
|
2121
2252
|
}
|
|
2122
|
-
} else if (scheduler) {
|
|
2123
|
-
scheduler(job.bind(null, true), true);
|
|
2124
|
-
} else {
|
|
2125
|
-
effect.run();
|
|
2126
2253
|
}
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2254
|
+
}
|
|
2255
|
+
function reactiveGetter(source, deep) {
|
|
2256
|
+
if (deep) return source;
|
|
2257
|
+
if (isShallow(source) || deep === false || deep === 0)
|
|
2258
|
+
return traverse(source, 1);
|
|
2259
|
+
return traverse(source);
|
|
2260
|
+
}
|
|
2261
|
+
function warnInvalidSource(s, onWarn) {
|
|
2262
|
+
(onWarn || warn$2)(
|
|
2263
|
+
`Invalid watch source: `,
|
|
2264
|
+
s,
|
|
2265
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
2266
|
+
);
|
|
2131
2267
|
}
|
|
2132
2268
|
function traverse(value, depth = Infinity, seen) {
|
|
2133
2269
|
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
@@ -2163,8 +2299,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2163
2299
|
}
|
|
2164
2300
|
|
|
2165
2301
|
const stack = [];
|
|
2166
|
-
function pushWarningContext(
|
|
2167
|
-
stack.push(
|
|
2302
|
+
function pushWarningContext(ctx) {
|
|
2303
|
+
stack.push(ctx);
|
|
2168
2304
|
}
|
|
2169
2305
|
function popWarningContext() {
|
|
2170
2306
|
stack.pop();
|
|
@@ -2173,8 +2309,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2173
2309
|
function warn$1(msg, ...args) {
|
|
2174
2310
|
if (isWarning) return;
|
|
2175
2311
|
isWarning = true;
|
|
2176
|
-
|
|
2177
|
-
const
|
|
2312
|
+
const prevSub = setActiveSub();
|
|
2313
|
+
const entry = stack.length ? stack[stack.length - 1] : null;
|
|
2314
|
+
const instance = isVNode(entry) ? entry.component : entry;
|
|
2178
2315
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
2179
2316
|
const trace = getComponentTrace();
|
|
2180
2317
|
if (appWarnHandler) {
|
|
@@ -2188,9 +2325,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2188
2325
|
var _a, _b;
|
|
2189
2326
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
2190
2327
|
}).join(""),
|
|
2191
|
-
instance && instance.proxy,
|
|
2328
|
+
instance && instance.proxy || instance,
|
|
2192
2329
|
trace.map(
|
|
2193
|
-
({
|
|
2330
|
+
({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
|
|
2194
2331
|
).join("\n"),
|
|
2195
2332
|
trace
|
|
2196
2333
|
]
|
|
@@ -2204,27 +2341,31 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2204
2341
|
}
|
|
2205
2342
|
console.warn(...warnArgs);
|
|
2206
2343
|
}
|
|
2207
|
-
|
|
2344
|
+
setActiveSub(prevSub);
|
|
2208
2345
|
isWarning = false;
|
|
2209
2346
|
}
|
|
2210
2347
|
function getComponentTrace() {
|
|
2211
|
-
let
|
|
2212
|
-
if (!
|
|
2348
|
+
let currentCtx = stack[stack.length - 1];
|
|
2349
|
+
if (!currentCtx) {
|
|
2213
2350
|
return [];
|
|
2214
2351
|
}
|
|
2215
2352
|
const normalizedStack = [];
|
|
2216
|
-
while (
|
|
2353
|
+
while (currentCtx) {
|
|
2217
2354
|
const last = normalizedStack[0];
|
|
2218
|
-
if (last && last.
|
|
2355
|
+
if (last && last.ctx === currentCtx) {
|
|
2219
2356
|
last.recurseCount++;
|
|
2220
2357
|
} else {
|
|
2221
2358
|
normalizedStack.push({
|
|
2222
|
-
|
|
2359
|
+
ctx: currentCtx,
|
|
2223
2360
|
recurseCount: 0
|
|
2224
2361
|
});
|
|
2225
2362
|
}
|
|
2226
|
-
|
|
2227
|
-
|
|
2363
|
+
if (isVNode(currentCtx)) {
|
|
2364
|
+
const parent = currentCtx.component && currentCtx.component.parent;
|
|
2365
|
+
currentCtx = parent && parent.vnode || parent;
|
|
2366
|
+
} else {
|
|
2367
|
+
currentCtx = currentCtx.parent;
|
|
2368
|
+
}
|
|
2228
2369
|
}
|
|
2229
2370
|
return normalizedStack;
|
|
2230
2371
|
}
|
|
@@ -2236,16 +2377,13 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2236
2377
|
});
|
|
2237
2378
|
return logs;
|
|
2238
2379
|
}
|
|
2239
|
-
function formatTraceEntry({
|
|
2380
|
+
function formatTraceEntry({ ctx, recurseCount }) {
|
|
2240
2381
|
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
2241
|
-
const
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2244
|
-
vnode.type,
|
|
2245
|
-
isRoot
|
|
2246
|
-
)}`;
|
|
2382
|
+
const instance = isVNode(ctx) ? ctx.component : ctx;
|
|
2383
|
+
const isRoot = instance ? instance.parent == null : false;
|
|
2384
|
+
const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
|
|
2247
2385
|
const close = `>` + postfix;
|
|
2248
|
-
return
|
|
2386
|
+
return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
|
|
2249
2387
|
}
|
|
2250
2388
|
function formatProps(props) {
|
|
2251
2389
|
const res = [];
|
|
@@ -2377,11 +2515,10 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2377
2515
|
}
|
|
2378
2516
|
}
|
|
2379
2517
|
function handleError(err, instance, type, throwInDev = true) {
|
|
2380
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
2381
2518
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
2382
2519
|
if (instance) {
|
|
2383
2520
|
let cur = instance.parent;
|
|
2384
|
-
const exposedInstance = instance.proxy;
|
|
2521
|
+
const exposedInstance = instance.proxy || instance;
|
|
2385
2522
|
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
2386
2523
|
while (cur) {
|
|
2387
2524
|
const errorCapturedHooks = cur.ec;
|
|
@@ -2395,26 +2532,26 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2395
2532
|
cur = cur.parent;
|
|
2396
2533
|
}
|
|
2397
2534
|
if (errorHandler) {
|
|
2398
|
-
|
|
2535
|
+
const prevSub = setActiveSub();
|
|
2399
2536
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
2400
2537
|
err,
|
|
2401
2538
|
exposedInstance,
|
|
2402
2539
|
errorInfo
|
|
2403
2540
|
]);
|
|
2404
|
-
|
|
2541
|
+
setActiveSub(prevSub);
|
|
2405
2542
|
return;
|
|
2406
2543
|
}
|
|
2407
2544
|
}
|
|
2408
|
-
logError(err, type,
|
|
2545
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
2409
2546
|
}
|
|
2410
|
-
function logError(err, type,
|
|
2547
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
2411
2548
|
{
|
|
2412
2549
|
const info = ErrorTypeStrings$1[type];
|
|
2413
|
-
if (
|
|
2414
|
-
pushWarningContext(
|
|
2550
|
+
if (instance) {
|
|
2551
|
+
pushWarningContext(instance);
|
|
2415
2552
|
}
|
|
2416
2553
|
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
2417
|
-
if (
|
|
2554
|
+
if (instance) {
|
|
2418
2555
|
popWarningContext();
|
|
2419
2556
|
}
|
|
2420
2557
|
if (throwInDev) {
|
|
@@ -2425,26 +2562,23 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2425
2562
|
}
|
|
2426
2563
|
}
|
|
2427
2564
|
|
|
2428
|
-
const
|
|
2429
|
-
let
|
|
2430
|
-
|
|
2431
|
-
let
|
|
2565
|
+
const jobs = [];
|
|
2566
|
+
let postJobs = [];
|
|
2567
|
+
let activePostJobs = null;
|
|
2568
|
+
let currentFlushPromise = null;
|
|
2569
|
+
let jobsLength = 0;
|
|
2570
|
+
let flushIndex = 0;
|
|
2432
2571
|
let postFlushIndex = 0;
|
|
2433
2572
|
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
2434
|
-
let currentFlushPromise = null;
|
|
2435
2573
|
const RECURSION_LIMIT = 100;
|
|
2436
2574
|
function nextTick(fn) {
|
|
2437
2575
|
const p = currentFlushPromise || resolvedPromise;
|
|
2438
2576
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2439
2577
|
}
|
|
2440
|
-
function findInsertionIndex(
|
|
2441
|
-
let start = flushIndex + 1;
|
|
2442
|
-
let end = queue.length;
|
|
2578
|
+
function findInsertionIndex(order, queue, start, end) {
|
|
2443
2579
|
while (start < end) {
|
|
2444
2580
|
const middle = start + end >>> 1;
|
|
2445
|
-
|
|
2446
|
-
const middleJobId = getId(middleJob);
|
|
2447
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
2581
|
+
if (queue[middle].order <= order) {
|
|
2448
2582
|
start = middle + 1;
|
|
2449
2583
|
} else {
|
|
2450
2584
|
end = middle;
|
|
@@ -2452,130 +2586,168 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2452
2586
|
}
|
|
2453
2587
|
return start;
|
|
2454
2588
|
}
|
|
2455
|
-
function queueJob(job) {
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2589
|
+
function queueJob(job, id, isPre = false) {
|
|
2590
|
+
if (queueJobWorker(
|
|
2591
|
+
job,
|
|
2592
|
+
id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
|
|
2593
|
+
jobs,
|
|
2594
|
+
jobsLength,
|
|
2595
|
+
flushIndex
|
|
2596
|
+
)) {
|
|
2597
|
+
jobsLength++;
|
|
2598
|
+
queueFlush();
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
function queueJobWorker(job, order, queue, length, flushIndex2) {
|
|
2602
|
+
const flags = job.flags;
|
|
2603
|
+
if (!(flags & 1)) {
|
|
2604
|
+
job.flags = flags | 1;
|
|
2605
|
+
job.order = order;
|
|
2606
|
+
if (flushIndex2 === length || // fast path when the job id is larger than the tail
|
|
2607
|
+
order >= queue[length - 1].order) {
|
|
2608
|
+
queue[length] = job;
|
|
2462
2609
|
} else {
|
|
2463
|
-
queue.splice(findInsertionIndex(
|
|
2610
|
+
queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
|
|
2464
2611
|
}
|
|
2465
|
-
|
|
2466
|
-
queueFlush();
|
|
2612
|
+
return true;
|
|
2467
2613
|
}
|
|
2614
|
+
return false;
|
|
2468
2615
|
}
|
|
2616
|
+
const doFlushJobs = () => {
|
|
2617
|
+
try {
|
|
2618
|
+
flushJobs();
|
|
2619
|
+
} catch (e) {
|
|
2620
|
+
currentFlushPromise = null;
|
|
2621
|
+
throw e;
|
|
2622
|
+
}
|
|
2623
|
+
};
|
|
2469
2624
|
function queueFlush() {
|
|
2470
2625
|
if (!currentFlushPromise) {
|
|
2471
|
-
currentFlushPromise = resolvedPromise.then(
|
|
2626
|
+
currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
2472
2627
|
}
|
|
2473
2628
|
}
|
|
2474
|
-
function queuePostFlushCb(
|
|
2475
|
-
if (!isArray(
|
|
2476
|
-
if (
|
|
2477
|
-
|
|
2478
|
-
} else
|
|
2479
|
-
|
|
2480
|
-
cb.flags |= 1;
|
|
2629
|
+
function queuePostFlushCb(jobs2, id = Infinity) {
|
|
2630
|
+
if (!isArray(jobs2)) {
|
|
2631
|
+
if (activePostJobs && id === -1) {
|
|
2632
|
+
activePostJobs.splice(postFlushIndex, 0, jobs2);
|
|
2633
|
+
} else {
|
|
2634
|
+
queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
|
|
2481
2635
|
}
|
|
2482
2636
|
} else {
|
|
2483
|
-
|
|
2637
|
+
for (const job of jobs2) {
|
|
2638
|
+
queueJobWorker(job, id, postJobs, postJobs.length, 0);
|
|
2639
|
+
}
|
|
2484
2640
|
}
|
|
2485
2641
|
queueFlush();
|
|
2486
2642
|
}
|
|
2487
|
-
function flushPreFlushCbs(instance, seen
|
|
2643
|
+
function flushPreFlushCbs(instance, seen) {
|
|
2488
2644
|
{
|
|
2489
2645
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2490
2646
|
}
|
|
2491
|
-
for (; i <
|
|
2492
|
-
const cb =
|
|
2493
|
-
if (cb
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2647
|
+
for (let i = flushIndex; i < jobsLength; i++) {
|
|
2648
|
+
const cb = jobs[i];
|
|
2649
|
+
if (cb.order & 1 || cb.order === Infinity) {
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
if (instance && cb.order !== instance.uid * 2) {
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
2655
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
2656
|
+
continue;
|
|
2657
|
+
}
|
|
2658
|
+
jobs.splice(i, 1);
|
|
2659
|
+
i--;
|
|
2660
|
+
jobsLength--;
|
|
2661
|
+
if (cb.flags & 2) {
|
|
2662
|
+
cb.flags &= -2;
|
|
2663
|
+
}
|
|
2664
|
+
cb();
|
|
2665
|
+
if (!(cb.flags & 2)) {
|
|
2666
|
+
cb.flags &= -2;
|
|
2509
2667
|
}
|
|
2510
2668
|
}
|
|
2511
2669
|
}
|
|
2512
2670
|
function flushPostFlushCbs(seen) {
|
|
2513
|
-
if (
|
|
2514
|
-
|
|
2515
|
-
(
|
|
2516
|
-
|
|
2517
|
-
pendingPostFlushCbs.length = 0;
|
|
2518
|
-
if (activePostFlushCbs) {
|
|
2519
|
-
activePostFlushCbs.push(...deduped);
|
|
2671
|
+
if (postJobs.length) {
|
|
2672
|
+
if (activePostJobs) {
|
|
2673
|
+
activePostJobs.push(...postJobs);
|
|
2674
|
+
postJobs.length = 0;
|
|
2520
2675
|
return;
|
|
2521
2676
|
}
|
|
2522
|
-
|
|
2677
|
+
activePostJobs = postJobs;
|
|
2678
|
+
postJobs = [];
|
|
2523
2679
|
{
|
|
2524
2680
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2525
2681
|
}
|
|
2526
|
-
|
|
2527
|
-
const cb =
|
|
2682
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
2683
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
2528
2684
|
if (checkRecursiveUpdates(seen, cb)) {
|
|
2529
2685
|
continue;
|
|
2530
2686
|
}
|
|
2531
|
-
if (cb.flags &
|
|
2687
|
+
if (cb.flags & 2) {
|
|
2532
2688
|
cb.flags &= -2;
|
|
2533
2689
|
}
|
|
2534
|
-
if (!(cb.flags &
|
|
2535
|
-
|
|
2690
|
+
if (!(cb.flags & 4)) {
|
|
2691
|
+
try {
|
|
2692
|
+
cb();
|
|
2693
|
+
} finally {
|
|
2694
|
+
cb.flags &= -2;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2536
2697
|
}
|
|
2537
|
-
|
|
2698
|
+
activePostJobs = null;
|
|
2538
2699
|
postFlushIndex = 0;
|
|
2539
2700
|
}
|
|
2540
2701
|
}
|
|
2541
|
-
|
|
2702
|
+
let isFlushing = false;
|
|
2703
|
+
function flushOnAppMount() {
|
|
2704
|
+
if (!isFlushing) {
|
|
2705
|
+
isFlushing = true;
|
|
2706
|
+
flushPreFlushCbs();
|
|
2707
|
+
flushPostFlushCbs();
|
|
2708
|
+
isFlushing = false;
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2542
2711
|
function flushJobs(seen) {
|
|
2543
2712
|
{
|
|
2544
|
-
seen
|
|
2713
|
+
seen || (seen = /* @__PURE__ */ new Map());
|
|
2545
2714
|
}
|
|
2546
|
-
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2547
2715
|
try {
|
|
2548
|
-
|
|
2549
|
-
const job =
|
|
2550
|
-
|
|
2551
|
-
|
|
2716
|
+
while (flushIndex < jobsLength) {
|
|
2717
|
+
const job = jobs[flushIndex];
|
|
2718
|
+
jobs[flushIndex++] = void 0;
|
|
2719
|
+
if (!(job.flags & 4)) {
|
|
2720
|
+
if (checkRecursiveUpdates(seen, job)) {
|
|
2552
2721
|
continue;
|
|
2553
2722
|
}
|
|
2554
|
-
if (job.flags &
|
|
2723
|
+
if (job.flags & 2) {
|
|
2555
2724
|
job.flags &= ~1;
|
|
2556
2725
|
}
|
|
2557
|
-
|
|
2558
|
-
job
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2726
|
+
try {
|
|
2727
|
+
job();
|
|
2728
|
+
} catch (err) {
|
|
2729
|
+
handleError(
|
|
2730
|
+
err,
|
|
2731
|
+
job.i,
|
|
2732
|
+
job.i ? 15 : 14
|
|
2733
|
+
);
|
|
2734
|
+
} finally {
|
|
2735
|
+
if (!(job.flags & 2)) {
|
|
2736
|
+
job.flags &= ~1;
|
|
2737
|
+
}
|
|
2564
2738
|
}
|
|
2565
2739
|
}
|
|
2566
2740
|
}
|
|
2567
2741
|
} finally {
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
job.flags &= -2;
|
|
2572
|
-
}
|
|
2742
|
+
while (flushIndex < jobsLength) {
|
|
2743
|
+
jobs[flushIndex].flags &= -2;
|
|
2744
|
+
jobs[flushIndex++] = void 0;
|
|
2573
2745
|
}
|
|
2574
|
-
flushIndex =
|
|
2575
|
-
|
|
2746
|
+
flushIndex = 0;
|
|
2747
|
+
jobsLength = 0;
|
|
2576
2748
|
flushPostFlushCbs(seen);
|
|
2577
2749
|
currentFlushPromise = null;
|
|
2578
|
-
if (
|
|
2750
|
+
if (jobsLength || postJobs.length) {
|
|
2579
2751
|
flushJobs(seen);
|
|
2580
2752
|
}
|
|
2581
2753
|
}
|
|
@@ -2642,10 +2814,17 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2642
2814
|
instance.render = newRender;
|
|
2643
2815
|
normalizeClassComponent(instance.type).render = newRender;
|
|
2644
2816
|
}
|
|
2645
|
-
instance.renderCache = [];
|
|
2646
2817
|
isHmrUpdating = true;
|
|
2647
|
-
instance.
|
|
2648
|
-
|
|
2818
|
+
if (instance.vapor) {
|
|
2819
|
+
instance.hmrRerender();
|
|
2820
|
+
} else {
|
|
2821
|
+
const i = instance;
|
|
2822
|
+
i.renderCache = [];
|
|
2823
|
+
i.effect.run();
|
|
2824
|
+
}
|
|
2825
|
+
nextTick(() => {
|
|
2826
|
+
isHmrUpdating = false;
|
|
2827
|
+
});
|
|
2649
2828
|
});
|
|
2650
2829
|
}
|
|
2651
2830
|
function reload(id, newComp) {
|
|
@@ -2654,42 +2833,54 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2654
2833
|
newComp = normalizeClassComponent(newComp);
|
|
2655
2834
|
updateComponentDef(record.initialDef, newComp);
|
|
2656
2835
|
const instances = [...record.instances];
|
|
2657
|
-
|
|
2658
|
-
const instance
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
if (instance.ceReload) {
|
|
2836
|
+
if (newComp.__vapor) {
|
|
2837
|
+
for (const instance of instances) {
|
|
2838
|
+
instance.hmrReload(newComp);
|
|
2839
|
+
}
|
|
2840
|
+
} else {
|
|
2841
|
+
for (const instance of instances) {
|
|
2842
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2843
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2844
|
+
if (!dirtyInstances) {
|
|
2845
|
+
if (oldComp !== record.initialDef) {
|
|
2846
|
+
updateComponentDef(oldComp, newComp);
|
|
2847
|
+
}
|
|
2848
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2849
|
+
}
|
|
2672
2850
|
dirtyInstances.add(instance);
|
|
2673
|
-
instance.
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
instance.
|
|
2679
|
-
isHmrUpdating = false;
|
|
2851
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2852
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2853
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2854
|
+
if (instance.ceReload) {
|
|
2855
|
+
dirtyInstances.add(instance);
|
|
2856
|
+
instance.ceReload(newComp.styles);
|
|
2680
2857
|
dirtyInstances.delete(instance);
|
|
2681
|
-
})
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2858
|
+
} else if (instance.parent) {
|
|
2859
|
+
queueJob(() => {
|
|
2860
|
+
isHmrUpdating = true;
|
|
2861
|
+
const parent = instance.parent;
|
|
2862
|
+
if (parent.vapor) {
|
|
2863
|
+
parent.hmrRerender();
|
|
2864
|
+
} else {
|
|
2865
|
+
parent.effect.run();
|
|
2866
|
+
}
|
|
2867
|
+
nextTick(() => {
|
|
2868
|
+
isHmrUpdating = false;
|
|
2869
|
+
});
|
|
2870
|
+
dirtyInstances.delete(instance);
|
|
2871
|
+
});
|
|
2872
|
+
} else if (instance.appContext.reload) {
|
|
2873
|
+
instance.appContext.reload();
|
|
2874
|
+
} else if (typeof window !== "undefined") {
|
|
2875
|
+
window.location.reload();
|
|
2876
|
+
} else {
|
|
2877
|
+
console.warn(
|
|
2878
|
+
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
2879
|
+
);
|
|
2880
|
+
}
|
|
2881
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
2882
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
2883
|
+
}
|
|
2693
2884
|
}
|
|
2694
2885
|
}
|
|
2695
2886
|
queuePostFlushCb(() => {
|
|
@@ -2902,14 +3093,14 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
2902
3093
|
}
|
|
2903
3094
|
let hook = binding.dir[name];
|
|
2904
3095
|
if (hook) {
|
|
2905
|
-
|
|
3096
|
+
const prevSub = setActiveSub();
|
|
2906
3097
|
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2907
3098
|
vnode.el,
|
|
2908
3099
|
binding,
|
|
2909
3100
|
vnode,
|
|
2910
3101
|
prevVNode
|
|
2911
3102
|
]);
|
|
2912
|
-
|
|
3103
|
+
setActiveSub(prevSub);
|
|
2913
3104
|
}
|
|
2914
3105
|
}
|
|
2915
3106
|
}
|
|
@@ -3009,29 +3200,37 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3009
3200
|
}
|
|
3010
3201
|
if (isTeleportDeferred(n2.props)) {
|
|
3011
3202
|
n2.el.__isMounted = false;
|
|
3012
|
-
queuePostRenderEffect(
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3203
|
+
queuePostRenderEffect(
|
|
3204
|
+
() => {
|
|
3205
|
+
mountToTarget();
|
|
3206
|
+
delete n2.el.__isMounted;
|
|
3207
|
+
},
|
|
3208
|
+
void 0,
|
|
3209
|
+
parentSuspense
|
|
3210
|
+
);
|
|
3016
3211
|
} else {
|
|
3017
3212
|
mountToTarget();
|
|
3018
3213
|
}
|
|
3019
3214
|
} else {
|
|
3020
3215
|
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
|
3021
|
-
queuePostRenderEffect(
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3216
|
+
queuePostRenderEffect(
|
|
3217
|
+
() => {
|
|
3218
|
+
TeleportImpl.process(
|
|
3219
|
+
n1,
|
|
3220
|
+
n2,
|
|
3221
|
+
container,
|
|
3222
|
+
anchor,
|
|
3223
|
+
parentComponent,
|
|
3224
|
+
parentSuspense,
|
|
3225
|
+
namespace,
|
|
3226
|
+
slotScopeIds,
|
|
3227
|
+
optimized,
|
|
3228
|
+
internals
|
|
3229
|
+
);
|
|
3230
|
+
},
|
|
3231
|
+
void 0,
|
|
3232
|
+
parentSuspense
|
|
3233
|
+
);
|
|
3035
3234
|
return;
|
|
3036
3235
|
}
|
|
3037
3236
|
n2.el = n1.el;
|
|
@@ -3078,6 +3277,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3078
3277
|
container,
|
|
3079
3278
|
mainAnchor,
|
|
3080
3279
|
internals,
|
|
3280
|
+
parentComponent,
|
|
3081
3281
|
1
|
|
3082
3282
|
);
|
|
3083
3283
|
} else {
|
|
@@ -3097,6 +3297,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3097
3297
|
nextTarget,
|
|
3098
3298
|
null,
|
|
3099
3299
|
internals,
|
|
3300
|
+
parentComponent,
|
|
3100
3301
|
0
|
|
3101
3302
|
);
|
|
3102
3303
|
} else {
|
|
@@ -3112,6 +3313,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3112
3313
|
target,
|
|
3113
3314
|
targetAnchor,
|
|
3114
3315
|
internals,
|
|
3316
|
+
parentComponent,
|
|
3115
3317
|
1
|
|
3116
3318
|
);
|
|
3117
3319
|
}
|
|
@@ -3151,7 +3353,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3151
3353
|
move: moveTeleport,
|
|
3152
3354
|
hydrate: hydrateTeleport
|
|
3153
3355
|
};
|
|
3154
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
3356
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
|
|
3155
3357
|
if (moveType === 0) {
|
|
3156
3358
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
3157
3359
|
}
|
|
@@ -3167,7 +3369,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3167
3369
|
children[i],
|
|
3168
3370
|
container,
|
|
3169
3371
|
parentAnchor,
|
|
3170
|
-
2
|
|
3372
|
+
2,
|
|
3373
|
+
parentComponent
|
|
3171
3374
|
);
|
|
3172
3375
|
}
|
|
3173
3376
|
}
|
|
@@ -3352,7 +3555,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3352
3555
|
state.isLeaving = true;
|
|
3353
3556
|
leavingHooks.afterLeave = () => {
|
|
3354
3557
|
state.isLeaving = false;
|
|
3355
|
-
if (!(instance.job.flags &
|
|
3558
|
+
if (!(instance.job.flags & 4)) {
|
|
3356
3559
|
instance.update();
|
|
3357
3560
|
}
|
|
3358
3561
|
delete leavingHooks.afterLeave;
|
|
@@ -3631,7 +3834,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3631
3834
|
}
|
|
3632
3835
|
|
|
3633
3836
|
function useId() {
|
|
3634
|
-
const i =
|
|
3837
|
+
const i = getCurrentGenericInstance();
|
|
3635
3838
|
if (i) {
|
|
3636
3839
|
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
3637
3840
|
} else {
|
|
@@ -3647,7 +3850,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3647
3850
|
|
|
3648
3851
|
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
3649
3852
|
function useTemplateRef(key) {
|
|
3650
|
-
const i =
|
|
3853
|
+
const i = getCurrentGenericInstance();
|
|
3651
3854
|
const r = shallowRef(null);
|
|
3652
3855
|
if (i) {
|
|
3653
3856
|
const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
@@ -3767,8 +3970,7 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3767
3970
|
}
|
|
3768
3971
|
};
|
|
3769
3972
|
if (value) {
|
|
3770
|
-
doSet
|
|
3771
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3973
|
+
queuePostRenderEffect(doSet, -1, parentSuspense);
|
|
3772
3974
|
} else {
|
|
3773
3975
|
doSet();
|
|
3774
3976
|
}
|
|
@@ -3936,6 +4138,9 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
3936
4138
|
);
|
|
3937
4139
|
}
|
|
3938
4140
|
} else if (shapeFlag & 6) {
|
|
4141
|
+
if (vnode.type.__vapor) {
|
|
4142
|
+
throw new Error("Vapor component hydration is not supported yet.");
|
|
4143
|
+
}
|
|
3939
4144
|
vnode.slotScopeIds = slotScopeIds;
|
|
3940
4145
|
const container = parentNode(node);
|
|
3941
4146
|
if (isFragmentStart) {
|
|
@@ -4097,11 +4302,15 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4097
4302
|
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
4098
4303
|
}
|
|
4099
4304
|
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
4100
|
-
queueEffectWithSuspense(
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4305
|
+
queueEffectWithSuspense(
|
|
4306
|
+
() => {
|
|
4307
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
4308
|
+
needCallTransitionHooks && transition.enter(el);
|
|
4309
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
4310
|
+
},
|
|
4311
|
+
void 0,
|
|
4312
|
+
parentSuspense
|
|
4313
|
+
);
|
|
4105
4314
|
}
|
|
4106
4315
|
}
|
|
4107
4316
|
return el.nextSibling;
|
|
@@ -4381,14 +4590,16 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4381
4590
|
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
4382
4591
|
const cssVars = instance.getCssVars();
|
|
4383
4592
|
for (const key in cssVars) {
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
String(cssVars[key])
|
|
4387
|
-
);
|
|
4593
|
+
const value = normalizeCssVarValue(cssVars[key]);
|
|
4594
|
+
expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
|
|
4388
4595
|
}
|
|
4389
4596
|
}
|
|
4390
4597
|
if (vnode === root && instance.parent) {
|
|
4391
|
-
resolveCssVars(
|
|
4598
|
+
resolveCssVars(
|
|
4599
|
+
instance.parent,
|
|
4600
|
+
instance.vnode,
|
|
4601
|
+
expectedMap
|
|
4602
|
+
);
|
|
4392
4603
|
}
|
|
4393
4604
|
}
|
|
4394
4605
|
const allowMismatchAttr = "data-allow-mismatch";
|
|
@@ -4647,7 +4858,7 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4647
4858
|
}
|
|
4648
4859
|
load().then(() => {
|
|
4649
4860
|
loaded.value = true;
|
|
4650
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4861
|
+
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
|
|
4651
4862
|
instance.parent.update();
|
|
4652
4863
|
}
|
|
4653
4864
|
}).catch((err) => {
|
|
@@ -4690,15 +4901,15 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4690
4901
|
max: [String, Number]
|
|
4691
4902
|
},
|
|
4692
4903
|
setup(props, { slots }) {
|
|
4693
|
-
const
|
|
4694
|
-
const sharedContext =
|
|
4904
|
+
const keepAliveInstance = getCurrentInstance();
|
|
4905
|
+
const sharedContext = keepAliveInstance.ctx;
|
|
4695
4906
|
const cache = /* @__PURE__ */ new Map();
|
|
4696
4907
|
const keys = /* @__PURE__ */ new Set();
|
|
4697
4908
|
let current = null;
|
|
4698
4909
|
{
|
|
4699
|
-
|
|
4910
|
+
keepAliveInstance.__v_cache = cache;
|
|
4700
4911
|
}
|
|
4701
|
-
const parentSuspense =
|
|
4912
|
+
const parentSuspense = keepAliveInstance.suspense;
|
|
4702
4913
|
const {
|
|
4703
4914
|
renderer: {
|
|
4704
4915
|
p: patch,
|
|
@@ -4709,58 +4920,80 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4709
4920
|
} = sharedContext;
|
|
4710
4921
|
const storageContainer = createElement("div");
|
|
4711
4922
|
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
4712
|
-
const
|
|
4713
|
-
move(
|
|
4923
|
+
const instance = vnode.component;
|
|
4924
|
+
move(
|
|
4925
|
+
vnode,
|
|
4926
|
+
container,
|
|
4927
|
+
anchor,
|
|
4928
|
+
0,
|
|
4929
|
+
keepAliveInstance,
|
|
4930
|
+
parentSuspense
|
|
4931
|
+
);
|
|
4714
4932
|
patch(
|
|
4715
|
-
|
|
4933
|
+
instance.vnode,
|
|
4716
4934
|
vnode,
|
|
4717
4935
|
container,
|
|
4718
4936
|
anchor,
|
|
4719
|
-
|
|
4937
|
+
instance,
|
|
4720
4938
|
parentSuspense,
|
|
4721
4939
|
namespace,
|
|
4722
4940
|
vnode.slotScopeIds,
|
|
4723
4941
|
optimized
|
|
4724
4942
|
);
|
|
4725
|
-
queuePostRenderEffect(
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4943
|
+
queuePostRenderEffect(
|
|
4944
|
+
() => {
|
|
4945
|
+
instance.isDeactivated = false;
|
|
4946
|
+
if (instance.a) {
|
|
4947
|
+
invokeArrayFns(instance.a);
|
|
4948
|
+
}
|
|
4949
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
4950
|
+
if (vnodeHook) {
|
|
4951
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4952
|
+
}
|
|
4953
|
+
},
|
|
4954
|
+
void 0,
|
|
4955
|
+
parentSuspense
|
|
4956
|
+
);
|
|
4735
4957
|
{
|
|
4736
|
-
devtoolsComponentAdded(
|
|
4958
|
+
devtoolsComponentAdded(instance);
|
|
4737
4959
|
}
|
|
4738
4960
|
};
|
|
4739
4961
|
sharedContext.deactivate = (vnode) => {
|
|
4740
|
-
const
|
|
4741
|
-
invalidateMount(
|
|
4742
|
-
invalidateMount(
|
|
4743
|
-
move(
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4962
|
+
const instance = vnode.component;
|
|
4963
|
+
invalidateMount(instance.m);
|
|
4964
|
+
invalidateMount(instance.a);
|
|
4965
|
+
move(
|
|
4966
|
+
vnode,
|
|
4967
|
+
storageContainer,
|
|
4968
|
+
null,
|
|
4969
|
+
1,
|
|
4970
|
+
keepAliveInstance,
|
|
4971
|
+
parentSuspense
|
|
4972
|
+
);
|
|
4973
|
+
queuePostRenderEffect(
|
|
4974
|
+
() => {
|
|
4975
|
+
if (instance.da) {
|
|
4976
|
+
invokeArrayFns(instance.da);
|
|
4977
|
+
}
|
|
4978
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
4979
|
+
if (vnodeHook) {
|
|
4980
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4981
|
+
}
|
|
4982
|
+
instance.isDeactivated = true;
|
|
4983
|
+
},
|
|
4984
|
+
void 0,
|
|
4985
|
+
parentSuspense
|
|
4986
|
+
);
|
|
4754
4987
|
{
|
|
4755
|
-
devtoolsComponentAdded(
|
|
4988
|
+
devtoolsComponentAdded(instance);
|
|
4756
4989
|
}
|
|
4757
4990
|
{
|
|
4758
|
-
|
|
4991
|
+
instance.__keepAliveStorageContainer = storageContainer;
|
|
4759
4992
|
}
|
|
4760
4993
|
};
|
|
4761
4994
|
function unmount(vnode) {
|
|
4762
4995
|
resetShapeFlag(vnode);
|
|
4763
|
-
_unmount(vnode,
|
|
4996
|
+
_unmount(vnode, keepAliveInstance, parentSuspense, true);
|
|
4764
4997
|
}
|
|
4765
4998
|
function pruneCache(filter) {
|
|
4766
4999
|
cache.forEach((vnode, key) => {
|
|
@@ -4792,12 +5025,19 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4792
5025
|
let pendingCacheKey = null;
|
|
4793
5026
|
const cacheSubtree = () => {
|
|
4794
5027
|
if (pendingCacheKey != null) {
|
|
4795
|
-
if (isSuspense(
|
|
4796
|
-
queuePostRenderEffect(
|
|
4797
|
-
|
|
4798
|
-
|
|
5028
|
+
if (isSuspense(keepAliveInstance.subTree.type)) {
|
|
5029
|
+
queuePostRenderEffect(
|
|
5030
|
+
() => {
|
|
5031
|
+
cache.set(
|
|
5032
|
+
pendingCacheKey,
|
|
5033
|
+
getInnerChild(keepAliveInstance.subTree)
|
|
5034
|
+
);
|
|
5035
|
+
},
|
|
5036
|
+
void 0,
|
|
5037
|
+
keepAliveInstance.subTree.suspense
|
|
5038
|
+
);
|
|
4799
5039
|
} else {
|
|
4800
|
-
cache.set(pendingCacheKey, getInnerChild(
|
|
5040
|
+
cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
4801
5041
|
}
|
|
4802
5042
|
}
|
|
4803
5043
|
};
|
|
@@ -4805,12 +5045,12 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4805
5045
|
onUpdated(cacheSubtree);
|
|
4806
5046
|
onBeforeUnmount(() => {
|
|
4807
5047
|
cache.forEach((cached) => {
|
|
4808
|
-
const { subTree, suspense } =
|
|
5048
|
+
const { subTree, suspense } = keepAliveInstance;
|
|
4809
5049
|
const vnode = getInnerChild(subTree);
|
|
4810
5050
|
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
4811
5051
|
resetShapeFlag(vnode);
|
|
4812
5052
|
const da = vnode.component.da;
|
|
4813
|
-
da && queuePostRenderEffect(da, suspense);
|
|
5053
|
+
da && queuePostRenderEffect(da, void 0, suspense);
|
|
4814
5054
|
return;
|
|
4815
5055
|
}
|
|
4816
5056
|
unmount(cached);
|
|
@@ -4896,7 +5136,7 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4896
5136
|
function onDeactivated(hook, target) {
|
|
4897
5137
|
registerKeepAliveHook(hook, "da", target);
|
|
4898
5138
|
}
|
|
4899
|
-
function registerKeepAliveHook(hook, type, target =
|
|
5139
|
+
function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
|
|
4900
5140
|
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
4901
5141
|
let current = target;
|
|
4902
5142
|
while (current) {
|
|
@@ -4910,7 +5150,7 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4910
5150
|
injectHook(type, wrappedHook, target);
|
|
4911
5151
|
if (target) {
|
|
4912
5152
|
let current = target.parent;
|
|
4913
|
-
while (current && current.parent) {
|
|
5153
|
+
while (current && current.parent && current.parent.vnode) {
|
|
4914
5154
|
if (isKeepAlive(current.parent.vnode)) {
|
|
4915
5155
|
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4916
5156
|
}
|
|
@@ -4942,12 +5182,14 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4942
5182
|
if (target) {
|
|
4943
5183
|
const hooks = target[type] || (target[type] = []);
|
|
4944
5184
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
4945
|
-
|
|
4946
|
-
const
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
5185
|
+
const prevSub = setActiveSub();
|
|
5186
|
+
const prev = setCurrentInstance(target);
|
|
5187
|
+
try {
|
|
5188
|
+
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
5189
|
+
} finally {
|
|
5190
|
+
setCurrentInstance(...prev);
|
|
5191
|
+
setActiveSub(prevSub);
|
|
5192
|
+
}
|
|
4951
5193
|
});
|
|
4952
5194
|
if (prepend) {
|
|
4953
5195
|
hooks.unshift(wrappedHook);
|
|
@@ -5018,7 +5260,11 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
5018
5260
|
const res = (
|
|
5019
5261
|
// local registration
|
|
5020
5262
|
// check instance[type] first which is resolved for options API
|
|
5021
|
-
resolve(
|
|
5263
|
+
resolve(
|
|
5264
|
+
instance[type] || Component[type],
|
|
5265
|
+
name
|
|
5266
|
+
) || // global registration
|
|
5267
|
+
// @ts-expect-error filters only exist in compat mode
|
|
5022
5268
|
resolve(instance.appContext[type], name)
|
|
5023
5269
|
);
|
|
5024
5270
|
if (!res && maybeSelfReference) {
|
|
@@ -5112,7 +5358,13 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5112
5358
|
}
|
|
5113
5359
|
|
|
5114
5360
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
5115
|
-
|
|
5361
|
+
let slot = slots[name];
|
|
5362
|
+
if (slot && slot.__vapor) {
|
|
5363
|
+
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
5364
|
+
ret.vs = { slot, fallback };
|
|
5365
|
+
return ret;
|
|
5366
|
+
}
|
|
5367
|
+
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
5116
5368
|
if (name !== "default") props.name = name;
|
|
5117
5369
|
return openBlock(), createBlock(
|
|
5118
5370
|
Fragment,
|
|
@@ -5121,7 +5373,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5121
5373
|
64
|
|
5122
5374
|
);
|
|
5123
5375
|
}
|
|
5124
|
-
let slot = slots[name];
|
|
5125
5376
|
if (slot && slot.length > 1) {
|
|
5126
5377
|
warn$1(
|
|
5127
5378
|
`SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
|
|
@@ -5176,8 +5427,9 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5176
5427
|
}
|
|
5177
5428
|
|
|
5178
5429
|
const getPublicInstance = (i) => {
|
|
5179
|
-
if (!i) return null;
|
|
5180
|
-
if (isStatefulComponent(i))
|
|
5430
|
+
if (!i || i.vapor) return null;
|
|
5431
|
+
if (isStatefulComponent(i))
|
|
5432
|
+
return getComponentPublicInstance(i);
|
|
5181
5433
|
return getPublicInstance(i.parent);
|
|
5182
5434
|
};
|
|
5183
5435
|
const publicPropertiesMap = (
|
|
@@ -5470,11 +5722,16 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5470
5722
|
return getContext().attrs;
|
|
5471
5723
|
}
|
|
5472
5724
|
function getContext() {
|
|
5473
|
-
const i =
|
|
5725
|
+
const i = getCurrentGenericInstance();
|
|
5474
5726
|
if (!i) {
|
|
5475
5727
|
warn$1(`useContext() called without active instance.`);
|
|
5476
5728
|
}
|
|
5477
|
-
|
|
5729
|
+
if (i.vapor) {
|
|
5730
|
+
return i;
|
|
5731
|
+
} else {
|
|
5732
|
+
const ii = i;
|
|
5733
|
+
return ii.setupContext || (ii.setupContext = createSetupContext(ii));
|
|
5734
|
+
}
|
|
5478
5735
|
}
|
|
5479
5736
|
function normalizePropsOrEmits(props) {
|
|
5480
5737
|
return isArray(props) ? props.reduce(
|
|
@@ -5522,14 +5779,14 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5522
5779
|
return ret;
|
|
5523
5780
|
}
|
|
5524
5781
|
function withAsyncContext(getAwaitable) {
|
|
5525
|
-
const ctx =
|
|
5782
|
+
const ctx = getCurrentGenericInstance();
|
|
5526
5783
|
if (!ctx) {
|
|
5527
5784
|
warn$1(
|
|
5528
5785
|
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
5529
5786
|
);
|
|
5530
5787
|
}
|
|
5531
5788
|
let awaitable = getAwaitable();
|
|
5532
|
-
|
|
5789
|
+
setCurrentInstance(null, void 0);
|
|
5533
5790
|
if (isPromise(awaitable)) {
|
|
5534
5791
|
awaitable = awaitable.catch((e) => {
|
|
5535
5792
|
setCurrentInstance(ctx);
|
|
@@ -5973,7 +6230,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5973
6230
|
};
|
|
5974
6231
|
}
|
|
5975
6232
|
let uid$1 = 0;
|
|
5976
|
-
function createAppAPI(
|
|
6233
|
+
function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
5977
6234
|
return function createApp(rootComponent, rootProps = null) {
|
|
5978
6235
|
if (!isFunction(rootComponent)) {
|
|
5979
6236
|
rootComponent = extend({}, rootComponent);
|
|
@@ -6066,33 +6323,15 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
6066
6323
|
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
6067
6324
|
);
|
|
6068
6325
|
}
|
|
6069
|
-
const
|
|
6070
|
-
vnode.appContext = context;
|
|
6071
|
-
if (namespace === true) {
|
|
6072
|
-
namespace = "svg";
|
|
6073
|
-
} else if (namespace === false) {
|
|
6074
|
-
namespace = void 0;
|
|
6075
|
-
}
|
|
6326
|
+
const instance = mount(app, rootContainer, isHydrate, namespace);
|
|
6076
6327
|
{
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
cloned.el = null;
|
|
6080
|
-
render(cloned, rootContainer, namespace);
|
|
6081
|
-
};
|
|
6082
|
-
}
|
|
6083
|
-
if (isHydrate && hydrate) {
|
|
6084
|
-
hydrate(vnode, rootContainer);
|
|
6085
|
-
} else {
|
|
6086
|
-
render(vnode, rootContainer, namespace);
|
|
6328
|
+
app._instance = instance;
|
|
6329
|
+
devtoolsInitApp(app, version);
|
|
6087
6330
|
}
|
|
6088
6331
|
isMounted = true;
|
|
6089
6332
|
app._container = rootContainer;
|
|
6090
6333
|
rootContainer.__vue_app__ = app;
|
|
6091
|
-
|
|
6092
|
-
app._instance = vnode.component;
|
|
6093
|
-
devtoolsInitApp(app, version);
|
|
6094
|
-
}
|
|
6095
|
-
return getComponentPublicInstance(vnode.component);
|
|
6334
|
+
return getPublicInstance(instance);
|
|
6096
6335
|
} else {
|
|
6097
6336
|
warn$1(
|
|
6098
6337
|
`App has already been mounted.
|
|
@@ -6115,7 +6354,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6115
6354
|
app._instance,
|
|
6116
6355
|
16
|
|
6117
6356
|
);
|
|
6118
|
-
|
|
6357
|
+
unmount(app);
|
|
6119
6358
|
{
|
|
6120
6359
|
app._instance = null;
|
|
6121
6360
|
devtoolsUnmountApp(app);
|
|
@@ -6156,6 +6395,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6156
6395
|
let currentApp = null;
|
|
6157
6396
|
|
|
6158
6397
|
function provide(key, value) {
|
|
6398
|
+
const currentInstance = getCurrentGenericInstance();
|
|
6159
6399
|
if (!currentInstance) {
|
|
6160
6400
|
{
|
|
6161
6401
|
warn$1(`provide() can only be used inside setup().`);
|
|
@@ -6170,9 +6410,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6170
6410
|
}
|
|
6171
6411
|
}
|
|
6172
6412
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
6173
|
-
const instance =
|
|
6413
|
+
const instance = getCurrentGenericInstance();
|
|
6174
6414
|
if (instance || currentApp) {
|
|
6175
|
-
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.
|
|
6415
|
+
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
|
|
6176
6416
|
if (provides && key in provides) {
|
|
6177
6417
|
return provides[key];
|
|
6178
6418
|
} else if (arguments.length > 1) {
|
|
@@ -6185,7 +6425,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6185
6425
|
}
|
|
6186
6426
|
}
|
|
6187
6427
|
function hasInjectionContext() {
|
|
6188
|
-
return !!(
|
|
6428
|
+
return !!(getCurrentGenericInstance() || currentApp);
|
|
6189
6429
|
}
|
|
6190
6430
|
|
|
6191
6431
|
const internalObjectProto = {};
|
|
@@ -6193,7 +6433,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6193
6433
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
6194
6434
|
|
|
6195
6435
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
6196
|
-
const props = {};
|
|
6436
|
+
const props = instance.props = {};
|
|
6197
6437
|
const attrs = createInternalObject();
|
|
6198
6438
|
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
6199
6439
|
setFullProps(instance, rawProps, props, attrs);
|
|
@@ -6203,7 +6443,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6203
6443
|
}
|
|
6204
6444
|
}
|
|
6205
6445
|
{
|
|
6206
|
-
validateProps(rawProps || {}, props, instance);
|
|
6446
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6207
6447
|
}
|
|
6208
6448
|
if (isStateful) {
|
|
6209
6449
|
instance.props = isSSR ? props : shallowReactive(props);
|
|
@@ -6255,11 +6495,10 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6255
6495
|
const camelizedKey = camelize(key);
|
|
6256
6496
|
props[camelizedKey] = resolvePropValue(
|
|
6257
6497
|
options,
|
|
6258
|
-
rawCurrentProps,
|
|
6259
6498
|
camelizedKey,
|
|
6260
6499
|
value,
|
|
6261
6500
|
instance,
|
|
6262
|
-
|
|
6501
|
+
baseResolveDefault
|
|
6263
6502
|
);
|
|
6264
6503
|
}
|
|
6265
6504
|
} else {
|
|
@@ -6286,10 +6525,10 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6286
6525
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
6287
6526
|
props[key] = resolvePropValue(
|
|
6288
6527
|
options,
|
|
6289
|
-
rawCurrentProps,
|
|
6290
6528
|
key,
|
|
6291
6529
|
void 0,
|
|
6292
6530
|
instance,
|
|
6531
|
+
baseResolveDefault,
|
|
6293
6532
|
true
|
|
6294
6533
|
);
|
|
6295
6534
|
}
|
|
@@ -6311,7 +6550,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6311
6550
|
trigger(instance.attrs, "set", "");
|
|
6312
6551
|
}
|
|
6313
6552
|
{
|
|
6314
|
-
validateProps(rawProps || {}, props, instance);
|
|
6553
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6315
6554
|
}
|
|
6316
6555
|
}
|
|
6317
6556
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
@@ -6340,39 +6579,37 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6340
6579
|
}
|
|
6341
6580
|
}
|
|
6342
6581
|
if (needCastKeys) {
|
|
6343
|
-
const rawCurrentProps = toRaw(props);
|
|
6344
6582
|
const castValues = rawCastValues || EMPTY_OBJ;
|
|
6345
6583
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
6346
6584
|
const key = needCastKeys[i];
|
|
6347
6585
|
props[key] = resolvePropValue(
|
|
6348
6586
|
options,
|
|
6349
|
-
rawCurrentProps,
|
|
6350
6587
|
key,
|
|
6351
6588
|
castValues[key],
|
|
6352
6589
|
instance,
|
|
6590
|
+
baseResolveDefault,
|
|
6353
6591
|
!hasOwn(castValues, key)
|
|
6354
6592
|
);
|
|
6355
6593
|
}
|
|
6356
6594
|
}
|
|
6357
6595
|
return hasAttrsChanged;
|
|
6358
6596
|
}
|
|
6359
|
-
function resolvePropValue(options,
|
|
6597
|
+
function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
|
|
6360
6598
|
const opt = options[key];
|
|
6361
6599
|
if (opt != null) {
|
|
6362
6600
|
const hasDefault = hasOwn(opt, "default");
|
|
6363
6601
|
if (hasDefault && value === void 0) {
|
|
6364
6602
|
const defaultValue = opt.default;
|
|
6365
6603
|
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
6366
|
-
const
|
|
6367
|
-
if (key
|
|
6368
|
-
value =
|
|
6604
|
+
const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
|
|
6605
|
+
if (hasOwn(cachedDefaults, key)) {
|
|
6606
|
+
value = cachedDefaults[key];
|
|
6369
6607
|
} else {
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6608
|
+
value = cachedDefaults[key] = resolveDefault(
|
|
6609
|
+
defaultValue,
|
|
6610
|
+
instance,
|
|
6611
|
+
key
|
|
6374
6612
|
);
|
|
6375
|
-
reset();
|
|
6376
6613
|
}
|
|
6377
6614
|
} else {
|
|
6378
6615
|
value = defaultValue;
|
|
@@ -6391,6 +6628,17 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6391
6628
|
}
|
|
6392
6629
|
return value;
|
|
6393
6630
|
}
|
|
6631
|
+
function baseResolveDefault(factory, instance, key) {
|
|
6632
|
+
let value;
|
|
6633
|
+
const prev = setCurrentInstance(instance);
|
|
6634
|
+
const props = toRaw(instance.props);
|
|
6635
|
+
value = factory.call(
|
|
6636
|
+
null,
|
|
6637
|
+
props
|
|
6638
|
+
);
|
|
6639
|
+
setCurrentInstance(...prev);
|
|
6640
|
+
return value;
|
|
6641
|
+
}
|
|
6394
6642
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
6395
6643
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
6396
6644
|
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
@@ -6425,6 +6673,14 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6425
6673
|
}
|
|
6426
6674
|
return EMPTY_ARR;
|
|
6427
6675
|
}
|
|
6676
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
6677
|
+
const res = [normalized, needCastKeys];
|
|
6678
|
+
if (isObject(comp)) {
|
|
6679
|
+
cache.set(comp, res);
|
|
6680
|
+
}
|
|
6681
|
+
return res;
|
|
6682
|
+
}
|
|
6683
|
+
function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
|
|
6428
6684
|
if (isArray(raw)) {
|
|
6429
6685
|
for (let i = 0; i < raw.length; i++) {
|
|
6430
6686
|
if (!isString(raw[i])) {
|
|
@@ -6469,11 +6725,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6469
6725
|
}
|
|
6470
6726
|
}
|
|
6471
6727
|
}
|
|
6472
|
-
const res = [normalized, needCastKeys];
|
|
6473
|
-
if (isObject(comp)) {
|
|
6474
|
-
cache.set(comp, res);
|
|
6475
|
-
}
|
|
6476
|
-
return res;
|
|
6477
6728
|
}
|
|
6478
6729
|
function validatePropName(key) {
|
|
6479
6730
|
if (key[0] !== "$" && !isReservedProp(key)) {
|
|
@@ -6495,26 +6746,26 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6495
6746
|
}
|
|
6496
6747
|
return "";
|
|
6497
6748
|
}
|
|
6498
|
-
function validateProps(rawProps,
|
|
6499
|
-
|
|
6500
|
-
const options = instance.propsOptions[0];
|
|
6749
|
+
function validateProps(rawProps, resolvedProps, options) {
|
|
6750
|
+
resolvedProps = toRaw(resolvedProps);
|
|
6501
6751
|
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
|
6502
6752
|
for (const key in options) {
|
|
6503
|
-
|
|
6504
|
-
if (opt
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6753
|
+
const opt = options[key];
|
|
6754
|
+
if (opt != null) {
|
|
6755
|
+
validateProp(
|
|
6756
|
+
key,
|
|
6757
|
+
resolvedProps[key],
|
|
6758
|
+
opt,
|
|
6759
|
+
resolvedProps,
|
|
6760
|
+
!camelizePropsKey.includes(key)
|
|
6761
|
+
);
|
|
6762
|
+
}
|
|
6512
6763
|
}
|
|
6513
6764
|
}
|
|
6514
|
-
function validateProp(
|
|
6515
|
-
const { type, required, validator, skipCheck } =
|
|
6765
|
+
function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
|
|
6766
|
+
const { type, required, validator, skipCheck } = propOptions;
|
|
6516
6767
|
if (required && isAbsent) {
|
|
6517
|
-
warn$1('Missing required prop: "' +
|
|
6768
|
+
warn$1('Missing required prop: "' + key + '"');
|
|
6518
6769
|
return;
|
|
6519
6770
|
}
|
|
6520
6771
|
if (value == null && !required) {
|
|
@@ -6530,12 +6781,12 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6530
6781
|
isValid = valid;
|
|
6531
6782
|
}
|
|
6532
6783
|
if (!isValid) {
|
|
6533
|
-
warn$1(getInvalidTypeMessage(
|
|
6784
|
+
warn$1(getInvalidTypeMessage(key, value, expectedTypes));
|
|
6534
6785
|
return;
|
|
6535
6786
|
}
|
|
6536
6787
|
}
|
|
6537
|
-
if (validator && !validator(value,
|
|
6538
|
-
warn$1('Invalid prop: custom validator check failed for prop "' +
|
|
6788
|
+
if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
|
|
6789
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
|
|
6539
6790
|
}
|
|
6540
6791
|
}
|
|
6541
6792
|
const isSimpleType = /* @__PURE__ */ makeMap(
|
|
@@ -6606,7 +6857,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6606
6857
|
return rawSlot;
|
|
6607
6858
|
}
|
|
6608
6859
|
const normalized = withCtx((...args) => {
|
|
6609
|
-
if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6860
|
+
if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6610
6861
|
warn$1(
|
|
6611
6862
|
`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.`
|
|
6612
6863
|
);
|
|
@@ -6703,12 +6954,15 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6703
6954
|
|
|
6704
6955
|
let supported;
|
|
6705
6956
|
let perf;
|
|
6957
|
+
let cachedNow$1 = 0;
|
|
6958
|
+
const p$1 = /* @__PURE__ */ Promise.resolve();
|
|
6959
|
+
const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
|
|
6706
6960
|
function startMeasure(instance, type) {
|
|
6707
6961
|
if (instance.appContext.config.performance && isSupported()) {
|
|
6708
6962
|
perf.mark(`vue-${type}-${instance.uid}`);
|
|
6709
6963
|
}
|
|
6710
6964
|
{
|
|
6711
|
-
devtoolsPerfStart(instance, type,
|
|
6965
|
+
devtoolsPerfStart(instance, type, getNow$1());
|
|
6712
6966
|
}
|
|
6713
6967
|
}
|
|
6714
6968
|
function endMeasure(instance, type) {
|
|
@@ -6725,7 +6979,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6725
6979
|
perf.clearMarks(endTag);
|
|
6726
6980
|
}
|
|
6727
6981
|
{
|
|
6728
|
-
devtoolsPerfEnd(instance, type,
|
|
6982
|
+
devtoolsPerfEnd(instance, type, getNow$1());
|
|
6729
6983
|
}
|
|
6730
6984
|
}
|
|
6731
6985
|
function isSupported() {
|
|
@@ -6809,6 +7063,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6809
7063
|
optimized
|
|
6810
7064
|
);
|
|
6811
7065
|
break;
|
|
7066
|
+
case VaporSlot:
|
|
7067
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
|
|
7068
|
+
break;
|
|
6812
7069
|
default:
|
|
6813
7070
|
if (shapeFlag & 1) {
|
|
6814
7071
|
processElement(
|
|
@@ -7021,11 +7278,15 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7021
7278
|
}
|
|
7022
7279
|
hostInsert(el, container, anchor);
|
|
7023
7280
|
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
|
7024
|
-
queuePostRenderEffect(
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7281
|
+
queuePostRenderEffect(
|
|
7282
|
+
() => {
|
|
7283
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7284
|
+
needCallTransitionHooks && transition.enter(el);
|
|
7285
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
7286
|
+
},
|
|
7287
|
+
void 0,
|
|
7288
|
+
parentSuspense
|
|
7289
|
+
);
|
|
7029
7290
|
}
|
|
7030
7291
|
};
|
|
7031
7292
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
@@ -7037,8 +7298,8 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7037
7298
|
hostSetScopeId(el, slotScopeIds[i]);
|
|
7038
7299
|
}
|
|
7039
7300
|
}
|
|
7040
|
-
|
|
7041
|
-
|
|
7301
|
+
let subTree = parentComponent && parentComponent.subTree;
|
|
7302
|
+
if (subTree) {
|
|
7042
7303
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
7043
7304
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
7044
7305
|
}
|
|
@@ -7155,10 +7416,14 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7155
7416
|
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
7156
7417
|
}
|
|
7157
7418
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
7158
|
-
queuePostRenderEffect(
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7419
|
+
queuePostRenderEffect(
|
|
7420
|
+
() => {
|
|
7421
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
7422
|
+
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
7423
|
+
},
|
|
7424
|
+
void 0,
|
|
7425
|
+
parentSuspense
|
|
7426
|
+
);
|
|
7162
7427
|
}
|
|
7163
7428
|
};
|
|
7164
7429
|
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
|
@@ -7286,7 +7551,22 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7286
7551
|
};
|
|
7287
7552
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
7288
7553
|
n2.slotScopeIds = slotScopeIds;
|
|
7289
|
-
if (
|
|
7554
|
+
if (n2.type.__vapor) {
|
|
7555
|
+
if (n1 == null) {
|
|
7556
|
+
getVaporInterface(parentComponent, n2).mount(
|
|
7557
|
+
n2,
|
|
7558
|
+
container,
|
|
7559
|
+
anchor,
|
|
7560
|
+
parentComponent
|
|
7561
|
+
);
|
|
7562
|
+
} else {
|
|
7563
|
+
getVaporInterface(parentComponent, n2).update(
|
|
7564
|
+
n1,
|
|
7565
|
+
n2,
|
|
7566
|
+
shouldUpdateComponent(n1, n2, optimized)
|
|
7567
|
+
);
|
|
7568
|
+
}
|
|
7569
|
+
} else if (n1 == null) {
|
|
7290
7570
|
if (n2.shapeFlag & 512) {
|
|
7291
7571
|
parentComponent.ctx.activate(
|
|
7292
7572
|
n2,
|
|
@@ -7372,15 +7652,52 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7372
7652
|
return;
|
|
7373
7653
|
} else {
|
|
7374
7654
|
instance.next = n2;
|
|
7375
|
-
instance.
|
|
7655
|
+
instance.effect.run();
|
|
7376
7656
|
}
|
|
7377
7657
|
} else {
|
|
7378
7658
|
n2.el = n1.el;
|
|
7379
7659
|
instance.vnode = n2;
|
|
7380
7660
|
}
|
|
7381
7661
|
};
|
|
7382
|
-
|
|
7383
|
-
|
|
7662
|
+
class SetupRenderEffect extends ReactiveEffect {
|
|
7663
|
+
constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
|
|
7664
|
+
const prevScope = setCurrentScope(instance.scope);
|
|
7665
|
+
super();
|
|
7666
|
+
this.instance = instance;
|
|
7667
|
+
this.initialVNode = initialVNode;
|
|
7668
|
+
this.container = container;
|
|
7669
|
+
this.anchor = anchor;
|
|
7670
|
+
this.parentSuspense = parentSuspense;
|
|
7671
|
+
this.namespace = namespace;
|
|
7672
|
+
this.optimized = optimized;
|
|
7673
|
+
setCurrentScope(prevScope);
|
|
7674
|
+
this.job = instance.job = () => {
|
|
7675
|
+
if (this.dirty) {
|
|
7676
|
+
this.run();
|
|
7677
|
+
}
|
|
7678
|
+
};
|
|
7679
|
+
this.job.i = instance;
|
|
7680
|
+
{
|
|
7681
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7682
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7683
|
+
}
|
|
7684
|
+
}
|
|
7685
|
+
notify() {
|
|
7686
|
+
if (!(this.flags & 256)) {
|
|
7687
|
+
const job = this.job;
|
|
7688
|
+
queueJob(job, job.i.uid);
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
fn() {
|
|
7692
|
+
const {
|
|
7693
|
+
instance,
|
|
7694
|
+
initialVNode,
|
|
7695
|
+
container,
|
|
7696
|
+
anchor,
|
|
7697
|
+
parentSuspense,
|
|
7698
|
+
namespace,
|
|
7699
|
+
optimized
|
|
7700
|
+
} = this;
|
|
7384
7701
|
if (!instance.isMounted) {
|
|
7385
7702
|
let vnodeHook;
|
|
7386
7703
|
const { el, props } = initialVNode;
|
|
@@ -7456,23 +7773,24 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7456
7773
|
initialVNode.el = subTree.el;
|
|
7457
7774
|
}
|
|
7458
7775
|
if (m) {
|
|
7459
|
-
queuePostRenderEffect(m, parentSuspense);
|
|
7776
|
+
queuePostRenderEffect(m, void 0, parentSuspense);
|
|
7460
7777
|
}
|
|
7461
7778
|
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
|
7462
7779
|
const scopedInitialVNode = initialVNode;
|
|
7463
7780
|
queuePostRenderEffect(
|
|
7464
7781
|
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
|
7782
|
+
void 0,
|
|
7465
7783
|
parentSuspense
|
|
7466
7784
|
);
|
|
7467
7785
|
}
|
|
7468
|
-
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7469
|
-
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7786
|
+
if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7787
|
+
instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
|
|
7470
7788
|
}
|
|
7471
7789
|
instance.isMounted = true;
|
|
7472
7790
|
{
|
|
7473
7791
|
devtoolsComponentAdded(instance);
|
|
7474
7792
|
}
|
|
7475
|
-
initialVNode = container = anchor = null;
|
|
7793
|
+
this.initialVNode = this.container = this.anchor = null;
|
|
7476
7794
|
} else {
|
|
7477
7795
|
let { next, bu, u, parent, vnode } = instance;
|
|
7478
7796
|
{
|
|
@@ -7484,7 +7802,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7484
7802
|
}
|
|
7485
7803
|
nonHydratedAsyncRoot.asyncDep.then(() => {
|
|
7486
7804
|
if (!instance.isUnmounted) {
|
|
7487
|
-
|
|
7805
|
+
this.fn();
|
|
7488
7806
|
}
|
|
7489
7807
|
});
|
|
7490
7808
|
return;
|
|
@@ -7540,11 +7858,12 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7540
7858
|
updateHOCHostEl(instance, nextTree.el);
|
|
7541
7859
|
}
|
|
7542
7860
|
if (u) {
|
|
7543
|
-
queuePostRenderEffect(u, parentSuspense);
|
|
7861
|
+
queuePostRenderEffect(u, void 0, parentSuspense);
|
|
7544
7862
|
}
|
|
7545
7863
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
7546
7864
|
queuePostRenderEffect(
|
|
7547
7865
|
() => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
|
7866
|
+
void 0,
|
|
7548
7867
|
parentSuspense
|
|
7549
7868
|
);
|
|
7550
7869
|
}
|
|
@@ -7555,21 +7874,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7555
7874
|
popWarningContext();
|
|
7556
7875
|
}
|
|
7557
7876
|
}
|
|
7558
|
-
};
|
|
7559
|
-
instance.scope.on();
|
|
7560
|
-
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7561
|
-
instance.scope.off();
|
|
7562
|
-
const update = instance.update = effect.run.bind(effect);
|
|
7563
|
-
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7564
|
-
job.i = instance;
|
|
7565
|
-
job.id = instance.uid;
|
|
7566
|
-
effect.scheduler = () => queueJob(job);
|
|
7567
|
-
toggleRecurse(instance, true);
|
|
7568
|
-
{
|
|
7569
|
-
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7570
|
-
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7571
7877
|
}
|
|
7572
|
-
|
|
7878
|
+
}
|
|
7879
|
+
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
|
7880
|
+
const effect = instance.effect = new SetupRenderEffect(
|
|
7881
|
+
instance,
|
|
7882
|
+
initialVNode,
|
|
7883
|
+
container,
|
|
7884
|
+
anchor,
|
|
7885
|
+
parentSuspense,
|
|
7886
|
+
namespace,
|
|
7887
|
+
optimized
|
|
7888
|
+
);
|
|
7889
|
+
instance.update = effect.run.bind(effect);
|
|
7890
|
+
toggleRecurse(instance, true);
|
|
7891
|
+
effect.run();
|
|
7573
7892
|
};
|
|
7574
7893
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
7575
7894
|
nextVNode.component = instance;
|
|
@@ -7578,9 +7897,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7578
7897
|
instance.next = null;
|
|
7579
7898
|
updateProps(instance, nextVNode.props, prevProps, optimized);
|
|
7580
7899
|
updateSlots(instance, nextVNode.children, optimized);
|
|
7581
|
-
|
|
7900
|
+
const prevSub = setActiveSub();
|
|
7582
7901
|
flushPreFlushCbs(instance);
|
|
7583
|
-
|
|
7902
|
+
setActiveSub(prevSub);
|
|
7584
7903
|
};
|
|
7585
7904
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
|
7586
7905
|
const c1 = n1 && n1.children;
|
|
@@ -7857,7 +8176,13 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7857
8176
|
);
|
|
7858
8177
|
} else if (moved) {
|
|
7859
8178
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7860
|
-
move(
|
|
8179
|
+
move(
|
|
8180
|
+
nextChild,
|
|
8181
|
+
container,
|
|
8182
|
+
anchor,
|
|
8183
|
+
2,
|
|
8184
|
+
parentComponent
|
|
8185
|
+
);
|
|
7861
8186
|
} else {
|
|
7862
8187
|
j--;
|
|
7863
8188
|
}
|
|
@@ -7865,10 +8190,20 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7865
8190
|
}
|
|
7866
8191
|
}
|
|
7867
8192
|
};
|
|
7868
|
-
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
8193
|
+
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
7869
8194
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7870
8195
|
if (shapeFlag & 6) {
|
|
7871
|
-
|
|
8196
|
+
if (type.__vapor) {
|
|
8197
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
|
|
8198
|
+
} else {
|
|
8199
|
+
move(
|
|
8200
|
+
vnode.component.subTree,
|
|
8201
|
+
container,
|
|
8202
|
+
anchor,
|
|
8203
|
+
moveType,
|
|
8204
|
+
parentComponent
|
|
8205
|
+
);
|
|
8206
|
+
}
|
|
7872
8207
|
return;
|
|
7873
8208
|
}
|
|
7874
8209
|
if (shapeFlag & 128) {
|
|
@@ -7876,13 +8211,25 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7876
8211
|
return;
|
|
7877
8212
|
}
|
|
7878
8213
|
if (shapeFlag & 64) {
|
|
7879
|
-
type.move(
|
|
8214
|
+
type.move(
|
|
8215
|
+
vnode,
|
|
8216
|
+
container,
|
|
8217
|
+
anchor,
|
|
8218
|
+
internals,
|
|
8219
|
+
parentComponent
|
|
8220
|
+
);
|
|
7880
8221
|
return;
|
|
7881
8222
|
}
|
|
7882
8223
|
if (type === Fragment) {
|
|
7883
8224
|
hostInsert(el, container, anchor);
|
|
7884
8225
|
for (let i = 0; i < children.length; i++) {
|
|
7885
|
-
move(
|
|
8226
|
+
move(
|
|
8227
|
+
children[i],
|
|
8228
|
+
container,
|
|
8229
|
+
anchor,
|
|
8230
|
+
moveType,
|
|
8231
|
+
parentComponent
|
|
8232
|
+
);
|
|
7886
8233
|
}
|
|
7887
8234
|
hostInsert(vnode.anchor, container, anchor);
|
|
7888
8235
|
return;
|
|
@@ -7896,7 +8243,11 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7896
8243
|
if (moveType === 0) {
|
|
7897
8244
|
transition.beforeEnter(el);
|
|
7898
8245
|
hostInsert(el, container, anchor);
|
|
7899
|
-
queuePostRenderEffect(
|
|
8246
|
+
queuePostRenderEffect(
|
|
8247
|
+
() => transition.enter(el),
|
|
8248
|
+
void 0,
|
|
8249
|
+
parentSuspense
|
|
8250
|
+
);
|
|
7900
8251
|
} else {
|
|
7901
8252
|
const { leave, delayLeave, afterLeave } = transition;
|
|
7902
8253
|
const remove2 = () => {
|
|
@@ -7938,9 +8289,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7938
8289
|
optimized = false;
|
|
7939
8290
|
}
|
|
7940
8291
|
if (ref != null) {
|
|
7941
|
-
|
|
8292
|
+
const prevSub = setActiveSub();
|
|
7942
8293
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7943
|
-
|
|
8294
|
+
setActiveSub(prevSub);
|
|
7944
8295
|
}
|
|
7945
8296
|
if (cacheIndex != null) {
|
|
7946
8297
|
parentComponent.renderCache[cacheIndex] = void 0;
|
|
@@ -7956,7 +8307,12 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7956
8307
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7957
8308
|
}
|
|
7958
8309
|
if (shapeFlag & 6) {
|
|
7959
|
-
|
|
8310
|
+
if (type.__vapor) {
|
|
8311
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8312
|
+
return;
|
|
8313
|
+
} else {
|
|
8314
|
+
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
8315
|
+
}
|
|
7960
8316
|
} else {
|
|
7961
8317
|
if (shapeFlag & 128) {
|
|
7962
8318
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -7990,15 +8346,23 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7990
8346
|
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
|
7991
8347
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7992
8348
|
}
|
|
8349
|
+
if (type === VaporSlot) {
|
|
8350
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8351
|
+
return;
|
|
8352
|
+
}
|
|
7993
8353
|
if (doRemove) {
|
|
7994
8354
|
remove(vnode);
|
|
7995
8355
|
}
|
|
7996
8356
|
}
|
|
7997
8357
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
|
7998
|
-
queuePostRenderEffect(
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8358
|
+
queuePostRenderEffect(
|
|
8359
|
+
() => {
|
|
8360
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
8361
|
+
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
8362
|
+
},
|
|
8363
|
+
void 0,
|
|
8364
|
+
parentSuspense
|
|
8365
|
+
);
|
|
8002
8366
|
}
|
|
8003
8367
|
};
|
|
8004
8368
|
const remove = (vnode) => {
|
|
@@ -8055,7 +8419,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8055
8419
|
const {
|
|
8056
8420
|
bum,
|
|
8057
8421
|
scope,
|
|
8058
|
-
|
|
8422
|
+
effect,
|
|
8059
8423
|
subTree,
|
|
8060
8424
|
um,
|
|
8061
8425
|
m,
|
|
@@ -8074,16 +8438,18 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8074
8438
|
});
|
|
8075
8439
|
}
|
|
8076
8440
|
scope.stop();
|
|
8077
|
-
if (
|
|
8078
|
-
|
|
8441
|
+
if (effect) {
|
|
8442
|
+
effect.stop();
|
|
8079
8443
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8080
8444
|
}
|
|
8081
8445
|
if (um) {
|
|
8082
|
-
queuePostRenderEffect(um, parentSuspense);
|
|
8446
|
+
queuePostRenderEffect(um, void 0, parentSuspense);
|
|
8083
8447
|
}
|
|
8084
|
-
queuePostRenderEffect(
|
|
8085
|
-
instance.isUnmounted = true
|
|
8086
|
-
|
|
8448
|
+
queuePostRenderEffect(
|
|
8449
|
+
() => instance.isUnmounted = true,
|
|
8450
|
+
void 0,
|
|
8451
|
+
parentSuspense
|
|
8452
|
+
);
|
|
8087
8453
|
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
|
8088
8454
|
parentSuspense.deps--;
|
|
8089
8455
|
if (parentSuspense.deps === 0) {
|
|
@@ -8101,6 +8467,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8101
8467
|
};
|
|
8102
8468
|
const getNextHostNode = (vnode) => {
|
|
8103
8469
|
if (vnode.shapeFlag & 6) {
|
|
8470
|
+
if (vnode.type.__vapor) {
|
|
8471
|
+
return hostNextSibling(vnode.component.block);
|
|
8472
|
+
}
|
|
8104
8473
|
return getNextHostNode(vnode.component.subTree);
|
|
8105
8474
|
}
|
|
8106
8475
|
if (vnode.shapeFlag & 128) {
|
|
@@ -8110,7 +8479,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8110
8479
|
const teleportEnd = el && el[TeleportEndKey];
|
|
8111
8480
|
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
8112
8481
|
};
|
|
8113
|
-
let isFlushing = false;
|
|
8114
8482
|
const render = (vnode, container, namespace) => {
|
|
8115
8483
|
if (vnode == null) {
|
|
8116
8484
|
if (container._vnode) {
|
|
@@ -8128,12 +8496,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8128
8496
|
);
|
|
8129
8497
|
}
|
|
8130
8498
|
container._vnode = vnode;
|
|
8131
|
-
|
|
8132
|
-
isFlushing = true;
|
|
8133
|
-
flushPreFlushCbs();
|
|
8134
|
-
flushPostFlushCbs();
|
|
8135
|
-
isFlushing = false;
|
|
8136
|
-
}
|
|
8499
|
+
flushOnAppMount();
|
|
8137
8500
|
};
|
|
8138
8501
|
const internals = {
|
|
8139
8502
|
p: patch,
|
|
@@ -8141,6 +8504,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8141
8504
|
m: move,
|
|
8142
8505
|
r: remove,
|
|
8143
8506
|
mt: mountComponent,
|
|
8507
|
+
umt: unmountComponent,
|
|
8144
8508
|
mc: mountChildren,
|
|
8145
8509
|
pc: patchChildren,
|
|
8146
8510
|
pbc: patchBlockChildren,
|
|
@@ -8154,22 +8518,53 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8154
8518
|
internals
|
|
8155
8519
|
);
|
|
8156
8520
|
}
|
|
8521
|
+
const mountApp = (app, container, isHydrate, namespace) => {
|
|
8522
|
+
const vnode = app._ceVNode || createVNode(app._component, app._props);
|
|
8523
|
+
vnode.appContext = app._context;
|
|
8524
|
+
if (namespace === true) {
|
|
8525
|
+
namespace = "svg";
|
|
8526
|
+
} else if (namespace === false) {
|
|
8527
|
+
namespace = void 0;
|
|
8528
|
+
}
|
|
8529
|
+
{
|
|
8530
|
+
app._context.reload = () => {
|
|
8531
|
+
const cloned = cloneVNode(vnode);
|
|
8532
|
+
cloned.el = null;
|
|
8533
|
+
render(cloned, container, namespace);
|
|
8534
|
+
};
|
|
8535
|
+
}
|
|
8536
|
+
if (isHydrate && hydrate) {
|
|
8537
|
+
hydrate(vnode, container);
|
|
8538
|
+
} else {
|
|
8539
|
+
render(vnode, container, namespace);
|
|
8540
|
+
}
|
|
8541
|
+
return vnode.component;
|
|
8542
|
+
};
|
|
8543
|
+
const unmountApp = (app) => {
|
|
8544
|
+
render(null, app._container);
|
|
8545
|
+
};
|
|
8157
8546
|
return {
|
|
8158
8547
|
render,
|
|
8159
8548
|
hydrate,
|
|
8160
|
-
|
|
8549
|
+
internals,
|
|
8550
|
+
createApp: createAppAPI(
|
|
8551
|
+
mountApp,
|
|
8552
|
+
unmountApp,
|
|
8553
|
+
getComponentPublicInstance)
|
|
8161
8554
|
};
|
|
8162
8555
|
}
|
|
8163
8556
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8164
8557
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8165
8558
|
}
|
|
8166
|
-
function toggleRecurse({ effect, job }, allowed) {
|
|
8167
|
-
if (
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8559
|
+
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
8560
|
+
if (!vapor) {
|
|
8561
|
+
if (allowed) {
|
|
8562
|
+
effect.flags |= 128;
|
|
8563
|
+
job.flags |= 2;
|
|
8564
|
+
} else {
|
|
8565
|
+
effect.flags &= -129;
|
|
8566
|
+
job.flags &= -3;
|
|
8567
|
+
}
|
|
8173
8568
|
}
|
|
8174
8569
|
}
|
|
8175
8570
|
function needTransition(parentSuspense, transition) {
|
|
@@ -8202,48 +8597,8 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8202
8597
|
}
|
|
8203
8598
|
}
|
|
8204
8599
|
}
|
|
8205
|
-
function getSequence(arr) {
|
|
8206
|
-
const p = arr.slice();
|
|
8207
|
-
const result = [0];
|
|
8208
|
-
let i, j, u, v, c;
|
|
8209
|
-
const len = arr.length;
|
|
8210
|
-
for (i = 0; i < len; i++) {
|
|
8211
|
-
const arrI = arr[i];
|
|
8212
|
-
if (arrI !== 0) {
|
|
8213
|
-
j = result[result.length - 1];
|
|
8214
|
-
if (arr[j] < arrI) {
|
|
8215
|
-
p[i] = j;
|
|
8216
|
-
result.push(i);
|
|
8217
|
-
continue;
|
|
8218
|
-
}
|
|
8219
|
-
u = 0;
|
|
8220
|
-
v = result.length - 1;
|
|
8221
|
-
while (u < v) {
|
|
8222
|
-
c = u + v >> 1;
|
|
8223
|
-
if (arr[result[c]] < arrI) {
|
|
8224
|
-
u = c + 1;
|
|
8225
|
-
} else {
|
|
8226
|
-
v = c;
|
|
8227
|
-
}
|
|
8228
|
-
}
|
|
8229
|
-
if (arrI < arr[result[u]]) {
|
|
8230
|
-
if (u > 0) {
|
|
8231
|
-
p[i] = result[u - 1];
|
|
8232
|
-
}
|
|
8233
|
-
result[u] = i;
|
|
8234
|
-
}
|
|
8235
|
-
}
|
|
8236
|
-
}
|
|
8237
|
-
u = result.length;
|
|
8238
|
-
v = result[u - 1];
|
|
8239
|
-
while (u-- > 0) {
|
|
8240
|
-
result[u] = v;
|
|
8241
|
-
v = p[v];
|
|
8242
|
-
}
|
|
8243
|
-
return result;
|
|
8244
|
-
}
|
|
8245
8600
|
function locateNonHydratedAsyncRoot(instance) {
|
|
8246
|
-
const subComponent = instance.subTree.component;
|
|
8601
|
+
const subComponent = instance.vapor ? null : instance.subTree.component;
|
|
8247
8602
|
if (subComponent) {
|
|
8248
8603
|
if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
|
8249
8604
|
return subComponent;
|
|
@@ -8255,8 +8610,22 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8255
8610
|
function invalidateMount(hooks) {
|
|
8256
8611
|
if (hooks) {
|
|
8257
8612
|
for (let i = 0; i < hooks.length; i++)
|
|
8258
|
-
hooks[i].flags |=
|
|
8613
|
+
hooks[i].flags |= 4;
|
|
8614
|
+
}
|
|
8615
|
+
}
|
|
8616
|
+
function getVaporInterface(instance, vnode) {
|
|
8617
|
+
const ctx = instance ? instance.appContext : vnode.appContext;
|
|
8618
|
+
const res = ctx && ctx.vapor;
|
|
8619
|
+
if (!res) {
|
|
8620
|
+
warn$1(
|
|
8621
|
+
`Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
|
|
8622
|
+
\`\`\`
|
|
8623
|
+
import { vaporInteropPlugin } from 'vue'
|
|
8624
|
+
app.use(vaporInteropPlugin)
|
|
8625
|
+
\`\`\``
|
|
8626
|
+
);
|
|
8259
8627
|
}
|
|
8628
|
+
return res;
|
|
8260
8629
|
}
|
|
8261
8630
|
|
|
8262
8631
|
const ssrContextKey = Symbol.for("v-scx");
|
|
@@ -8291,8 +8660,41 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8291
8660
|
}
|
|
8292
8661
|
return doWatch(source, cb, options);
|
|
8293
8662
|
}
|
|
8663
|
+
class RenderWatcherEffect extends WatcherEffect {
|
|
8664
|
+
constructor(instance, source, cb, options, flush) {
|
|
8665
|
+
super(source, cb, options);
|
|
8666
|
+
this.flush = flush;
|
|
8667
|
+
const job = () => {
|
|
8668
|
+
if (this.dirty) {
|
|
8669
|
+
this.run();
|
|
8670
|
+
}
|
|
8671
|
+
};
|
|
8672
|
+
if (cb) {
|
|
8673
|
+
this.flags |= 128;
|
|
8674
|
+
job.flags |= 2;
|
|
8675
|
+
}
|
|
8676
|
+
if (instance) {
|
|
8677
|
+
job.i = instance;
|
|
8678
|
+
}
|
|
8679
|
+
this.job = job;
|
|
8680
|
+
}
|
|
8681
|
+
notify() {
|
|
8682
|
+
const flags = this.flags;
|
|
8683
|
+
if (!(flags & 256)) {
|
|
8684
|
+
const flush = this.flush;
|
|
8685
|
+
const job = this.job;
|
|
8686
|
+
if (flush === "post") {
|
|
8687
|
+
queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
|
|
8688
|
+
} else if (flush === "pre") {
|
|
8689
|
+
queueJob(job, job.i ? job.i.uid : void 0, true);
|
|
8690
|
+
} else {
|
|
8691
|
+
job();
|
|
8692
|
+
}
|
|
8693
|
+
}
|
|
8694
|
+
}
|
|
8695
|
+
}
|
|
8294
8696
|
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8295
|
-
const { immediate, deep, flush, once } = options;
|
|
8697
|
+
const { immediate, deep, flush = "pre", once } = options;
|
|
8296
8698
|
if (!cb) {
|
|
8297
8699
|
if (immediate !== void 0) {
|
|
8298
8700
|
warn$1(
|
|
@@ -8314,35 +8716,25 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8314
8716
|
baseWatchOptions.onWarn = warn$1;
|
|
8315
8717
|
const instance = currentInstance;
|
|
8316
8718
|
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
};
|
|
8719
|
+
const effect = new RenderWatcherEffect(
|
|
8720
|
+
instance,
|
|
8721
|
+
source,
|
|
8722
|
+
cb,
|
|
8723
|
+
baseWatchOptions,
|
|
8724
|
+
flush
|
|
8725
|
+
);
|
|
8726
|
+
if (cb) {
|
|
8727
|
+
effect.run(true);
|
|
8728
|
+
} else if (flush === "post") {
|
|
8729
|
+
queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
|
|
8730
|
+
} else {
|
|
8731
|
+
effect.run(true);
|
|
8331
8732
|
}
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
job.flags |= 2;
|
|
8338
|
-
if (instance) {
|
|
8339
|
-
job.id = instance.uid;
|
|
8340
|
-
job.i = instance;
|
|
8341
|
-
}
|
|
8342
|
-
}
|
|
8343
|
-
};
|
|
8344
|
-
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
8345
|
-
return watchHandle;
|
|
8733
|
+
const stop = effect.stop.bind(effect);
|
|
8734
|
+
stop.pause = effect.pause.bind(effect);
|
|
8735
|
+
stop.resume = effect.resume.bind(effect);
|
|
8736
|
+
stop.stop = stop;
|
|
8737
|
+
return stop;
|
|
8346
8738
|
}
|
|
8347
8739
|
function instanceWatch(source, value, options) {
|
|
8348
8740
|
const publicThis = this.proxy;
|
|
@@ -8354,9 +8746,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8354
8746
|
cb = value.handler;
|
|
8355
8747
|
options = value;
|
|
8356
8748
|
}
|
|
8357
|
-
const
|
|
8749
|
+
const prev = setCurrentInstance(this);
|
|
8358
8750
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
8359
|
-
|
|
8751
|
+
setCurrentInstance(...prev);
|
|
8360
8752
|
return res;
|
|
8361
8753
|
}
|
|
8362
8754
|
function createPathGetter(ctx, path) {
|
|
@@ -8371,7 +8763,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8371
8763
|
}
|
|
8372
8764
|
|
|
8373
8765
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8374
|
-
const i =
|
|
8766
|
+
const i = getCurrentGenericInstance();
|
|
8375
8767
|
if (!i) {
|
|
8376
8768
|
warn$1(`useModel() called without active instance.`);
|
|
8377
8769
|
return ref();
|
|
@@ -8382,7 +8774,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8382
8774
|
return ref();
|
|
8383
8775
|
}
|
|
8384
8776
|
const hyphenatedName = hyphenate(name);
|
|
8385
|
-
const modifiers = getModelModifiers(props, camelizedName);
|
|
8777
|
+
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
8386
8778
|
const res = customRef((track, trigger) => {
|
|
8387
8779
|
let localValue;
|
|
8388
8780
|
let prevSetValue = EMPTY_OBJ;
|
|
@@ -8404,9 +8796,25 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8404
8796
|
if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
|
|
8405
8797
|
return;
|
|
8406
8798
|
}
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8799
|
+
let rawPropKeys;
|
|
8800
|
+
let parentPassedModelValue = false;
|
|
8801
|
+
let parentPassedModelUpdater = false;
|
|
8802
|
+
if (i.rawKeys) {
|
|
8803
|
+
rawPropKeys = i.rawKeys();
|
|
8804
|
+
} else {
|
|
8805
|
+
const rawProps = i.vnode.props;
|
|
8806
|
+
rawPropKeys = rawProps && Object.keys(rawProps);
|
|
8807
|
+
}
|
|
8808
|
+
if (rawPropKeys) {
|
|
8809
|
+
for (const key of rawPropKeys) {
|
|
8810
|
+
if (key === name || key === camelizedName || key === hyphenatedName) {
|
|
8811
|
+
parentPassedModelValue = true;
|
|
8812
|
+
} else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
|
|
8813
|
+
parentPassedModelUpdater = true;
|
|
8814
|
+
}
|
|
8815
|
+
}
|
|
8816
|
+
}
|
|
8817
|
+
if (!parentPassedModelValue || !parentPassedModelUpdater) {
|
|
8410
8818
|
localValue = value;
|
|
8411
8819
|
trigger();
|
|
8412
8820
|
}
|
|
@@ -8433,21 +8841,26 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8433
8841
|
};
|
|
8434
8842
|
return res;
|
|
8435
8843
|
}
|
|
8436
|
-
const getModelModifiers = (props, modelName) => {
|
|
8437
|
-
return modelName === "modelValue" || modelName === "model-value" ? props
|
|
8844
|
+
const getModelModifiers = (props, modelName, getter) => {
|
|
8845
|
+
return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
|
|
8438
8846
|
};
|
|
8439
8847
|
|
|
8440
8848
|
function emit(instance, event, ...rawArgs) {
|
|
8849
|
+
return baseEmit(
|
|
8850
|
+
instance,
|
|
8851
|
+
instance.vnode.props || EMPTY_OBJ,
|
|
8852
|
+
defaultPropGetter,
|
|
8853
|
+
event,
|
|
8854
|
+
...rawArgs
|
|
8855
|
+
);
|
|
8856
|
+
}
|
|
8857
|
+
function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
8441
8858
|
if (instance.isUnmounted) return;
|
|
8442
|
-
const props = instance.vnode.props || EMPTY_OBJ;
|
|
8443
8859
|
{
|
|
8444
|
-
const {
|
|
8445
|
-
emitsOptions,
|
|
8446
|
-
propsOptions: [propsOptions]
|
|
8447
|
-
} = instance;
|
|
8860
|
+
const { emitsOptions, propsOptions } = instance;
|
|
8448
8861
|
if (emitsOptions) {
|
|
8449
8862
|
if (!(event in emitsOptions) && true) {
|
|
8450
|
-
if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
|
|
8863
|
+
if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
|
|
8451
8864
|
warn$1(
|
|
8452
8865
|
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
|
|
8453
8866
|
);
|
|
@@ -8467,7 +8880,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8467
8880
|
}
|
|
8468
8881
|
let args = rawArgs;
|
|
8469
8882
|
const isModelListener = event.startsWith("update:");
|
|
8470
|
-
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
8883
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
8471
8884
|
if (modifiers) {
|
|
8472
8885
|
if (modifiers.trim) {
|
|
8473
8886
|
args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
@@ -8481,7 +8894,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8481
8894
|
}
|
|
8482
8895
|
{
|
|
8483
8896
|
const lowerCaseEvent = event.toLowerCase();
|
|
8484
|
-
if (lowerCaseEvent !== event && props
|
|
8897
|
+
if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
|
|
8485
8898
|
warn$1(
|
|
8486
8899
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
8487
8900
|
instance,
|
|
@@ -8493,10 +8906,10 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8493
8906
|
}
|
|
8494
8907
|
}
|
|
8495
8908
|
let handlerName;
|
|
8496
|
-
let handler = props
|
|
8497
|
-
props
|
|
8909
|
+
let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
|
|
8910
|
+
getter(props, handlerName = toHandlerKey(camelize(event)));
|
|
8498
8911
|
if (!handler && isModelListener) {
|
|
8499
|
-
handler = props
|
|
8912
|
+
handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
|
|
8500
8913
|
}
|
|
8501
8914
|
if (handler) {
|
|
8502
8915
|
callWithAsyncErrorHandling(
|
|
@@ -8506,7 +8919,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8506
8919
|
args
|
|
8507
8920
|
);
|
|
8508
8921
|
}
|
|
8509
|
-
const onceHandler = props
|
|
8922
|
+
const onceHandler = getter(props, handlerName + `Once`);
|
|
8510
8923
|
if (onceHandler) {
|
|
8511
8924
|
if (!instance.emitted) {
|
|
8512
8925
|
instance.emitted = {};
|
|
@@ -8522,6 +8935,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8522
8935
|
);
|
|
8523
8936
|
}
|
|
8524
8937
|
}
|
|
8938
|
+
function defaultPropGetter(props, key) {
|
|
8939
|
+
return props[key];
|
|
8940
|
+
}
|
|
8525
8941
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
8526
8942
|
const cache = appContext.emitsCache;
|
|
8527
8943
|
const cached = cache.get(comp);
|
|
@@ -8849,7 +9265,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
8849
9265
|
return false;
|
|
8850
9266
|
}
|
|
8851
9267
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
8852
|
-
while (parent) {
|
|
9268
|
+
while (parent && !parent.vapor) {
|
|
8853
9269
|
const root = parent.subTree;
|
|
8854
9270
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
8855
9271
|
root.el = vnode.el;
|
|
@@ -9200,7 +9616,8 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9200
9616
|
pendingBranch,
|
|
9201
9617
|
container2,
|
|
9202
9618
|
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
9203
|
-
0
|
|
9619
|
+
0,
|
|
9620
|
+
parentComponent2
|
|
9204
9621
|
);
|
|
9205
9622
|
queuePostFlushCb(effects);
|
|
9206
9623
|
}
|
|
@@ -9213,7 +9630,13 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9213
9630
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
9214
9631
|
}
|
|
9215
9632
|
if (!delayEnter) {
|
|
9216
|
-
move(
|
|
9633
|
+
move(
|
|
9634
|
+
pendingBranch,
|
|
9635
|
+
container2,
|
|
9636
|
+
anchor,
|
|
9637
|
+
0,
|
|
9638
|
+
parentComponent2
|
|
9639
|
+
);
|
|
9217
9640
|
}
|
|
9218
9641
|
}
|
|
9219
9642
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -9286,7 +9709,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9286
9709
|
}
|
|
9287
9710
|
},
|
|
9288
9711
|
move(container2, anchor2, type) {
|
|
9289
|
-
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
9712
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
|
|
9290
9713
|
suspense.container = container2;
|
|
9291
9714
|
},
|
|
9292
9715
|
next() {
|
|
@@ -9426,7 +9849,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9426
9849
|
}
|
|
9427
9850
|
return s;
|
|
9428
9851
|
}
|
|
9429
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
9852
|
+
function queueEffectWithSuspense(fn, id, suspense) {
|
|
9430
9853
|
if (suspense && suspense.pendingBranch) {
|
|
9431
9854
|
if (isArray(fn)) {
|
|
9432
9855
|
suspense.effects.push(...fn);
|
|
@@ -9434,7 +9857,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9434
9857
|
suspense.effects.push(fn);
|
|
9435
9858
|
}
|
|
9436
9859
|
} else {
|
|
9437
|
-
queuePostFlushCb(fn);
|
|
9860
|
+
queuePostFlushCb(fn, id);
|
|
9438
9861
|
}
|
|
9439
9862
|
}
|
|
9440
9863
|
function setActiveBranch(suspense, branch) {
|
|
@@ -9460,6 +9883,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
9460
9883
|
const Text = Symbol.for("v-txt");
|
|
9461
9884
|
const Comment = Symbol.for("v-cmt");
|
|
9462
9885
|
const Static = Symbol.for("v-stc");
|
|
9886
|
+
const VaporSlot = Symbol.for("v-vps");
|
|
9463
9887
|
const blockStack = [];
|
|
9464
9888
|
let currentBlock = null;
|
|
9465
9889
|
function openBlock(disableTracking = false) {
|
|
@@ -9833,6 +10257,28 @@ Component that was made reactive: `,
|
|
|
9833
10257
|
]);
|
|
9834
10258
|
}
|
|
9835
10259
|
|
|
10260
|
+
let currentInstance = null;
|
|
10261
|
+
const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
|
|
10262
|
+
const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
|
|
10263
|
+
let isInSSRComponentSetup = false;
|
|
10264
|
+
let setInSSRSetupState;
|
|
10265
|
+
let simpleSetCurrentInstance;
|
|
10266
|
+
{
|
|
10267
|
+
simpleSetCurrentInstance = (i) => {
|
|
10268
|
+
currentInstance = i;
|
|
10269
|
+
};
|
|
10270
|
+
setInSSRSetupState = (v) => {
|
|
10271
|
+
isInSSRComponentSetup = v;
|
|
10272
|
+
};
|
|
10273
|
+
}
|
|
10274
|
+
const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
|
|
10275
|
+
try {
|
|
10276
|
+
return [currentInstance, setCurrentScope(scope)];
|
|
10277
|
+
} finally {
|
|
10278
|
+
simpleSetCurrentInstance(instance);
|
|
10279
|
+
}
|
|
10280
|
+
};
|
|
10281
|
+
|
|
9836
10282
|
const emptyAppContext = createAppContext();
|
|
9837
10283
|
let uid = 0;
|
|
9838
10284
|
function createComponentInstance(vnode, parent, suspense) {
|
|
@@ -9877,7 +10323,7 @@ Component that was made reactive: `,
|
|
|
9877
10323
|
// to be set immediately
|
|
9878
10324
|
emitted: null,
|
|
9879
10325
|
// props default value
|
|
9880
|
-
propsDefaults:
|
|
10326
|
+
propsDefaults: null,
|
|
9881
10327
|
// inheritAttrs
|
|
9882
10328
|
inheritAttrs: type.inheritAttrs,
|
|
9883
10329
|
// state
|
|
@@ -9924,32 +10370,6 @@ Component that was made reactive: `,
|
|
|
9924
10370
|
}
|
|
9925
10371
|
return instance;
|
|
9926
10372
|
}
|
|
9927
|
-
let currentInstance = null;
|
|
9928
|
-
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
9929
|
-
let internalSetCurrentInstance;
|
|
9930
|
-
let setInSSRSetupState;
|
|
9931
|
-
{
|
|
9932
|
-
internalSetCurrentInstance = (i) => {
|
|
9933
|
-
currentInstance = i;
|
|
9934
|
-
};
|
|
9935
|
-
setInSSRSetupState = (v) => {
|
|
9936
|
-
isInSSRComponentSetup = v;
|
|
9937
|
-
};
|
|
9938
|
-
}
|
|
9939
|
-
const setCurrentInstance = (instance) => {
|
|
9940
|
-
const prev = currentInstance;
|
|
9941
|
-
internalSetCurrentInstance(instance);
|
|
9942
|
-
instance.scope.on();
|
|
9943
|
-
return () => {
|
|
9944
|
-
instance.scope.off();
|
|
9945
|
-
internalSetCurrentInstance(prev);
|
|
9946
|
-
};
|
|
9947
|
-
};
|
|
9948
|
-
const unsetCurrentInstance = () => {
|
|
9949
|
-
currentInstance && currentInstance.scope.off();
|
|
9950
|
-
internalSetCurrentInstance(null);
|
|
9951
|
-
};
|
|
9952
|
-
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
9953
10373
|
function validateComponentName(name, { isNativeTag }) {
|
|
9954
10374
|
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
9955
10375
|
warn$1(
|
|
@@ -9960,13 +10380,16 @@ Component that was made reactive: `,
|
|
|
9960
10380
|
function isStatefulComponent(instance) {
|
|
9961
10381
|
return instance.vnode.shapeFlag & 4;
|
|
9962
10382
|
}
|
|
9963
|
-
let isInSSRComponentSetup = false;
|
|
9964
10383
|
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
9965
10384
|
isSSR && setInSSRSetupState(isSSR);
|
|
9966
|
-
const { props, children } = instance.vnode;
|
|
10385
|
+
const { props, children, vi } = instance.vnode;
|
|
9967
10386
|
const isStateful = isStatefulComponent(instance);
|
|
9968
|
-
|
|
9969
|
-
|
|
10387
|
+
if (vi) {
|
|
10388
|
+
vi(instance);
|
|
10389
|
+
} else {
|
|
10390
|
+
initProps(instance, props, isStateful, isSSR);
|
|
10391
|
+
initSlots(instance, children, optimized || isSSR);
|
|
10392
|
+
}
|
|
9970
10393
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
9971
10394
|
isSSR && setInSSRSetupState(false);
|
|
9972
10395
|
return setupResult;
|
|
@@ -10003,9 +10426,9 @@ Component that was made reactive: `,
|
|
|
10003
10426
|
}
|
|
10004
10427
|
const { setup } = Component;
|
|
10005
10428
|
if (setup) {
|
|
10006
|
-
|
|
10429
|
+
const prevSub = setActiveSub();
|
|
10007
10430
|
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
10008
|
-
const
|
|
10431
|
+
const prev = setCurrentInstance(instance);
|
|
10009
10432
|
const setupResult = callWithErrorHandling(
|
|
10010
10433
|
setup,
|
|
10011
10434
|
instance,
|
|
@@ -10016,12 +10439,15 @@ Component that was made reactive: `,
|
|
|
10016
10439
|
]
|
|
10017
10440
|
);
|
|
10018
10441
|
const isAsyncSetup = isPromise(setupResult);
|
|
10019
|
-
|
|
10020
|
-
|
|
10442
|
+
setActiveSub(prevSub);
|
|
10443
|
+
setCurrentInstance(...prev);
|
|
10021
10444
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
10022
10445
|
markAsyncBoundary(instance);
|
|
10023
10446
|
}
|
|
10024
10447
|
if (isAsyncSetup) {
|
|
10448
|
+
const unsetCurrentInstance = () => {
|
|
10449
|
+
setCurrentInstance(null, void 0);
|
|
10450
|
+
};
|
|
10025
10451
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
10026
10452
|
if (isSSR) {
|
|
10027
10453
|
return setupResult.then((resolvedResult) => {
|
|
@@ -10114,13 +10540,13 @@ Component that was made reactive: `,
|
|
|
10114
10540
|
}
|
|
10115
10541
|
}
|
|
10116
10542
|
{
|
|
10117
|
-
const
|
|
10118
|
-
|
|
10543
|
+
const prevInstance = setCurrentInstance(instance);
|
|
10544
|
+
const prevSub = setActiveSub();
|
|
10119
10545
|
try {
|
|
10120
10546
|
applyOptions(instance);
|
|
10121
10547
|
} finally {
|
|
10122
|
-
|
|
10123
|
-
|
|
10548
|
+
setActiveSub(prevSub);
|
|
10549
|
+
setCurrentInstance(...prevInstance);
|
|
10124
10550
|
}
|
|
10125
10551
|
}
|
|
10126
10552
|
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
@@ -10157,29 +10583,6 @@ Component that was made reactive: `,
|
|
|
10157
10583
|
});
|
|
10158
10584
|
}
|
|
10159
10585
|
function createSetupContext(instance) {
|
|
10160
|
-
const expose = (exposed) => {
|
|
10161
|
-
{
|
|
10162
|
-
if (instance.exposed) {
|
|
10163
|
-
warn$1(`expose() should be called only once per setup().`);
|
|
10164
|
-
}
|
|
10165
|
-
if (exposed != null) {
|
|
10166
|
-
let exposedType = typeof exposed;
|
|
10167
|
-
if (exposedType === "object") {
|
|
10168
|
-
if (isArray(exposed)) {
|
|
10169
|
-
exposedType = "array";
|
|
10170
|
-
} else if (isRef(exposed)) {
|
|
10171
|
-
exposedType = "ref";
|
|
10172
|
-
}
|
|
10173
|
-
}
|
|
10174
|
-
if (exposedType !== "object") {
|
|
10175
|
-
warn$1(
|
|
10176
|
-
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10177
|
-
);
|
|
10178
|
-
}
|
|
10179
|
-
}
|
|
10180
|
-
}
|
|
10181
|
-
instance.exposed = exposed || {};
|
|
10182
|
-
};
|
|
10183
10586
|
{
|
|
10184
10587
|
let attrsProxy;
|
|
10185
10588
|
let slotsProxy;
|
|
@@ -10193,10 +10596,33 @@ Component that was made reactive: `,
|
|
|
10193
10596
|
get emit() {
|
|
10194
10597
|
return (event, ...args) => instance.emit(event, ...args);
|
|
10195
10598
|
},
|
|
10196
|
-
expose
|
|
10599
|
+
expose: (exposed) => expose(instance, exposed)
|
|
10197
10600
|
});
|
|
10198
10601
|
}
|
|
10199
10602
|
}
|
|
10603
|
+
function expose(instance, exposed) {
|
|
10604
|
+
{
|
|
10605
|
+
if (instance.exposed) {
|
|
10606
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
10607
|
+
}
|
|
10608
|
+
if (exposed != null) {
|
|
10609
|
+
let exposedType = typeof exposed;
|
|
10610
|
+
if (exposedType === "object") {
|
|
10611
|
+
if (isArray(exposed)) {
|
|
10612
|
+
exposedType = "array";
|
|
10613
|
+
} else if (isRef(exposed)) {
|
|
10614
|
+
exposedType = "ref";
|
|
10615
|
+
}
|
|
10616
|
+
}
|
|
10617
|
+
if (exposedType !== "object") {
|
|
10618
|
+
warn$1(
|
|
10619
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10620
|
+
);
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10623
|
+
}
|
|
10624
|
+
instance.exposed = exposed || {};
|
|
10625
|
+
}
|
|
10200
10626
|
function getComponentPublicInstance(instance) {
|
|
10201
10627
|
if (instance.exposed) {
|
|
10202
10628
|
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
@@ -10204,7 +10630,9 @@ Component that was made reactive: `,
|
|
|
10204
10630
|
if (key in target) {
|
|
10205
10631
|
return target[key];
|
|
10206
10632
|
} else if (key in publicPropertiesMap) {
|
|
10207
|
-
return publicPropertiesMap[key](
|
|
10633
|
+
return publicPropertiesMap[key](
|
|
10634
|
+
instance
|
|
10635
|
+
);
|
|
10208
10636
|
}
|
|
10209
10637
|
},
|
|
10210
10638
|
has(target, key) {
|
|
@@ -10247,14 +10675,7 @@ Component that was made reactive: `,
|
|
|
10247
10675
|
}
|
|
10248
10676
|
|
|
10249
10677
|
const computed = (getterOrOptions, debugOptions) => {
|
|
10250
|
-
|
|
10251
|
-
{
|
|
10252
|
-
const i = getCurrentInstance();
|
|
10253
|
-
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
10254
|
-
c._warnRecursive = true;
|
|
10255
|
-
}
|
|
10256
|
-
}
|
|
10257
|
-
return c;
|
|
10678
|
+
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
10258
10679
|
};
|
|
10259
10680
|
|
|
10260
10681
|
function h(type, propsOrChildren, children) {
|
|
@@ -10295,9 +10716,9 @@ Component that was made reactive: `,
|
|
|
10295
10716
|
if (obj.__isVue) {
|
|
10296
10717
|
return ["div", vueStyle, `VueInstance`];
|
|
10297
10718
|
} else if (isRef(obj)) {
|
|
10298
|
-
|
|
10719
|
+
const prevSub = setActiveSub();
|
|
10299
10720
|
const value = obj.value;
|
|
10300
|
-
|
|
10721
|
+
setActiveSub(prevSub);
|
|
10301
10722
|
return [
|
|
10302
10723
|
"div",
|
|
10303
10724
|
{},
|
|
@@ -10484,7 +10905,7 @@ Component that was made reactive: `,
|
|
|
10484
10905
|
return true;
|
|
10485
10906
|
}
|
|
10486
10907
|
|
|
10487
|
-
const version = "3.
|
|
10908
|
+
const version = "3.6.0-alpha.2";
|
|
10488
10909
|
const warn = warn$1 ;
|
|
10489
10910
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10490
10911
|
const devtools = devtools$1 ;
|
|
@@ -10978,8 +11399,9 @@ Component that was made reactive: `,
|
|
|
10978
11399
|
const style = el.style;
|
|
10979
11400
|
let cssText = "";
|
|
10980
11401
|
for (const key in vars) {
|
|
10981
|
-
|
|
10982
|
-
|
|
11402
|
+
const value = normalizeCssVarValue(vars[key]);
|
|
11403
|
+
style.setProperty(`--${key}`, value);
|
|
11404
|
+
cssText += `--${key}: ${value};`;
|
|
10983
11405
|
}
|
|
10984
11406
|
style[CSS_VAR_TEXT] = cssText;
|
|
10985
11407
|
}
|
|
@@ -11036,11 +11458,11 @@ Component that was made reactive: `,
|
|
|
11036
11458
|
}
|
|
11037
11459
|
const semicolonRE = /[^\\];\s*$/;
|
|
11038
11460
|
const importantRE = /\s*!important$/;
|
|
11039
|
-
function setStyle(style, name,
|
|
11040
|
-
if (isArray(
|
|
11041
|
-
|
|
11461
|
+
function setStyle(style, name, rawVal) {
|
|
11462
|
+
if (isArray(rawVal)) {
|
|
11463
|
+
rawVal.forEach((v) => setStyle(style, name, v));
|
|
11042
11464
|
} else {
|
|
11043
|
-
|
|
11465
|
+
const val = rawVal == null ? "" : String(rawVal);
|
|
11044
11466
|
{
|
|
11045
11467
|
if (semicolonRE.test(val)) {
|
|
11046
11468
|
warn(
|
|
@@ -11113,8 +11535,7 @@ Component that was made reactive: `,
|
|
|
11113
11535
|
return;
|
|
11114
11536
|
}
|
|
11115
11537
|
const tag = el.tagName;
|
|
11116
|
-
if (key === "value" && tag
|
|
11117
|
-
!tag.includes("-")) {
|
|
11538
|
+
if (key === "value" && canSetValueDirectly(tag)) {
|
|
11118
11539
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
11119
11540
|
const newValue = value == null ? (
|
|
11120
11541
|
// #11647: value should be set as empty string for null and undefined,
|
|
@@ -11242,8 +11663,6 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11242
11663
|
}
|
|
11243
11664
|
}
|
|
11244
11665
|
|
|
11245
|
-
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
11246
|
-
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
11247
11666
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
11248
11667
|
const isSVG = namespace === "svg";
|
|
11249
11668
|
if (key === "class") {
|
|
@@ -11283,24 +11702,9 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11283
11702
|
}
|
|
11284
11703
|
return false;
|
|
11285
11704
|
}
|
|
11286
|
-
if (
|
|
11287
|
-
return false;
|
|
11288
|
-
}
|
|
11289
|
-
if (key === "form") {
|
|
11290
|
-
return false;
|
|
11291
|
-
}
|
|
11292
|
-
if (key === "list" && el.tagName === "INPUT") {
|
|
11293
|
-
return false;
|
|
11294
|
-
}
|
|
11295
|
-
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
11705
|
+
if (shouldSetAsAttr(el.tagName, key)) {
|
|
11296
11706
|
return false;
|
|
11297
11707
|
}
|
|
11298
|
-
if (key === "width" || key === "height") {
|
|
11299
|
-
const tag = el.tagName;
|
|
11300
|
-
if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
|
11301
|
-
return false;
|
|
11302
|
-
}
|
|
11303
|
-
}
|
|
11304
11708
|
if (isNativeOn(key) && isString(value)) {
|
|
11305
11709
|
return false;
|
|
11306
11710
|
}
|
|
@@ -11894,28 +12298,12 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11894
12298
|
const vModelText = {
|
|
11895
12299
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
11896
12300
|
el[assignKey] = getModelAssigner(vnode);
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
}
|
|
11904
|
-
if (castToNumber) {
|
|
11905
|
-
domValue = looseToNumber(domValue);
|
|
11906
|
-
}
|
|
11907
|
-
el[assignKey](domValue);
|
|
11908
|
-
});
|
|
11909
|
-
if (trim) {
|
|
11910
|
-
addEventListener(el, "change", () => {
|
|
11911
|
-
el.value = el.value.trim();
|
|
11912
|
-
});
|
|
11913
|
-
}
|
|
11914
|
-
if (!lazy) {
|
|
11915
|
-
addEventListener(el, "compositionstart", onCompositionStart);
|
|
11916
|
-
addEventListener(el, "compositionend", onCompositionEnd);
|
|
11917
|
-
addEventListener(el, "change", onCompositionEnd);
|
|
11918
|
-
}
|
|
12301
|
+
vModelTextInit(
|
|
12302
|
+
el,
|
|
12303
|
+
trim,
|
|
12304
|
+
number || !!(vnode.props && vnode.props.type === "number"),
|
|
12305
|
+
lazy
|
|
12306
|
+
);
|
|
11919
12307
|
},
|
|
11920
12308
|
// set value on mounted so it's after min/max for type="range"
|
|
11921
12309
|
mounted(el, { value }) {
|
|
@@ -11923,70 +12311,111 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11923
12311
|
},
|
|
11924
12312
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
11925
12313
|
el[assignKey] = getModelAssigner(vnode);
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
12314
|
+
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
12315
|
+
}
|
|
12316
|
+
};
|
|
12317
|
+
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
12318
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
12319
|
+
if (e.target.composing) return;
|
|
12320
|
+
let domValue = el.value;
|
|
12321
|
+
if (trim) {
|
|
12322
|
+
domValue = domValue.trim();
|
|
12323
|
+
}
|
|
12324
|
+
if (number || el.type === "number") {
|
|
12325
|
+
domValue = looseToNumber(domValue);
|
|
12326
|
+
}
|
|
12327
|
+
(0, el[assignKey])(domValue);
|
|
12328
|
+
});
|
|
12329
|
+
if (trim) {
|
|
12330
|
+
addEventListener(el, "change", () => {
|
|
12331
|
+
el.value = el.value.trim();
|
|
12332
|
+
});
|
|
12333
|
+
}
|
|
12334
|
+
if (!lazy) {
|
|
12335
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
12336
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
12337
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
12338
|
+
}
|
|
12339
|
+
};
|
|
12340
|
+
const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
12341
|
+
if (el.composing) return;
|
|
12342
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
12343
|
+
const newValue = value == null ? "" : value;
|
|
12344
|
+
if (elValue === newValue) {
|
|
12345
|
+
return;
|
|
12346
|
+
}
|
|
12347
|
+
if (document.activeElement === el && el.type !== "range") {
|
|
12348
|
+
if (lazy && value === oldValue) {
|
|
11930
12349
|
return;
|
|
11931
12350
|
}
|
|
11932
|
-
if (
|
|
11933
|
-
|
|
11934
|
-
return;
|
|
11935
|
-
}
|
|
11936
|
-
if (trim && el.value.trim() === newValue) {
|
|
11937
|
-
return;
|
|
11938
|
-
}
|
|
12351
|
+
if (trim && el.value.trim() === newValue) {
|
|
12352
|
+
return;
|
|
11939
12353
|
}
|
|
11940
|
-
el.value = newValue;
|
|
11941
12354
|
}
|
|
12355
|
+
el.value = newValue;
|
|
11942
12356
|
};
|
|
11943
12357
|
const vModelCheckbox = {
|
|
11944
12358
|
// #4096 array checkboxes need to be deep traversed
|
|
11945
12359
|
deep: true,
|
|
11946
12360
|
created(el, _, vnode) {
|
|
11947
12361
|
el[assignKey] = getModelAssigner(vnode);
|
|
11948
|
-
|
|
11949
|
-
const modelValue = el._modelValue;
|
|
11950
|
-
const elementValue = getValue(el);
|
|
11951
|
-
const checked = el.checked;
|
|
11952
|
-
const assign = el[assignKey];
|
|
11953
|
-
if (isArray(modelValue)) {
|
|
11954
|
-
const index = looseIndexOf(modelValue, elementValue);
|
|
11955
|
-
const found = index !== -1;
|
|
11956
|
-
if (checked && !found) {
|
|
11957
|
-
assign(modelValue.concat(elementValue));
|
|
11958
|
-
} else if (!checked && found) {
|
|
11959
|
-
const filtered = [...modelValue];
|
|
11960
|
-
filtered.splice(index, 1);
|
|
11961
|
-
assign(filtered);
|
|
11962
|
-
}
|
|
11963
|
-
} else if (isSet(modelValue)) {
|
|
11964
|
-
const cloned = new Set(modelValue);
|
|
11965
|
-
if (checked) {
|
|
11966
|
-
cloned.add(elementValue);
|
|
11967
|
-
} else {
|
|
11968
|
-
cloned.delete(elementValue);
|
|
11969
|
-
}
|
|
11970
|
-
assign(cloned);
|
|
11971
|
-
} else {
|
|
11972
|
-
assign(getCheckboxValue(el, checked));
|
|
11973
|
-
}
|
|
11974
|
-
});
|
|
12362
|
+
vModelCheckboxInit(el);
|
|
11975
12363
|
},
|
|
11976
12364
|
// set initial checked on mount to wait for true-value/false-value
|
|
11977
|
-
mounted
|
|
12365
|
+
mounted(el, binding, vnode) {
|
|
12366
|
+
vModelCheckboxUpdate(
|
|
12367
|
+
el,
|
|
12368
|
+
binding.oldValue,
|
|
12369
|
+
binding.value,
|
|
12370
|
+
vnode.props.value
|
|
12371
|
+
);
|
|
12372
|
+
},
|
|
11978
12373
|
beforeUpdate(el, binding, vnode) {
|
|
11979
12374
|
el[assignKey] = getModelAssigner(vnode);
|
|
11980
|
-
|
|
12375
|
+
vModelCheckboxUpdate(
|
|
12376
|
+
el,
|
|
12377
|
+
binding.oldValue,
|
|
12378
|
+
binding.value,
|
|
12379
|
+
vnode.props.value
|
|
12380
|
+
);
|
|
11981
12381
|
}
|
|
11982
12382
|
};
|
|
11983
|
-
|
|
12383
|
+
const vModelCheckboxInit = (el, set) => {
|
|
12384
|
+
addEventListener(el, "change", () => {
|
|
12385
|
+
const assign = el[assignKey];
|
|
12386
|
+
const modelValue = el._modelValue;
|
|
12387
|
+
const elementValue = getValue(el);
|
|
12388
|
+
const checked = el.checked;
|
|
12389
|
+
if (isArray(modelValue)) {
|
|
12390
|
+
const index = looseIndexOf(modelValue, elementValue);
|
|
12391
|
+
const found = index !== -1;
|
|
12392
|
+
if (checked && !found) {
|
|
12393
|
+
assign(modelValue.concat(elementValue));
|
|
12394
|
+
} else if (!checked && found) {
|
|
12395
|
+
const filtered = [...modelValue];
|
|
12396
|
+
filtered.splice(index, 1);
|
|
12397
|
+
assign(filtered);
|
|
12398
|
+
}
|
|
12399
|
+
} else if (isSet(modelValue)) {
|
|
12400
|
+
const cloned = new Set(modelValue);
|
|
12401
|
+
if (checked) {
|
|
12402
|
+
cloned.add(elementValue);
|
|
12403
|
+
} else {
|
|
12404
|
+
cloned.delete(elementValue);
|
|
12405
|
+
}
|
|
12406
|
+
assign(cloned);
|
|
12407
|
+
} else {
|
|
12408
|
+
assign(getCheckboxValue(el, checked));
|
|
12409
|
+
}
|
|
12410
|
+
});
|
|
12411
|
+
};
|
|
12412
|
+
const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
|
|
11984
12413
|
el._modelValue = value;
|
|
11985
12414
|
let checked;
|
|
11986
12415
|
if (isArray(value)) {
|
|
11987
|
-
checked = looseIndexOf(value,
|
|
12416
|
+
checked = looseIndexOf(value, rawValue) > -1;
|
|
11988
12417
|
} else if (isSet(value)) {
|
|
11989
|
-
checked = value.has(
|
|
12418
|
+
checked = value.has(rawValue);
|
|
11990
12419
|
} else {
|
|
11991
12420
|
if (value === oldValue) return;
|
|
11992
12421
|
checked = looseEqual(value, getCheckboxValue(el, true));
|
|
@@ -11994,7 +12423,7 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11994
12423
|
if (el.checked !== checked) {
|
|
11995
12424
|
el.checked = checked;
|
|
11996
12425
|
}
|
|
11997
|
-
}
|
|
12426
|
+
};
|
|
11998
12427
|
const vModelRadio = {
|
|
11999
12428
|
created(el, { value }, vnode) {
|
|
12000
12429
|
el.checked = looseEqual(value, vnode.props.value);
|
|
@@ -12014,36 +12443,38 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
12014
12443
|
// <select multiple> value need to be deep traversed
|
|
12015
12444
|
deep: true,
|
|
12016
12445
|
created(el, { value, modifiers: { number } }, vnode) {
|
|
12017
|
-
|
|
12018
|
-
addEventListener(el, "change", () => {
|
|
12019
|
-
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12020
|
-
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12021
|
-
);
|
|
12022
|
-
el[assignKey](
|
|
12023
|
-
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12024
|
-
);
|
|
12025
|
-
el._assigning = true;
|
|
12026
|
-
nextTick(() => {
|
|
12027
|
-
el._assigning = false;
|
|
12028
|
-
});
|
|
12029
|
-
});
|
|
12446
|
+
vModelSelectInit(el, value, number);
|
|
12030
12447
|
el[assignKey] = getModelAssigner(vnode);
|
|
12031
12448
|
},
|
|
12032
12449
|
// set value in mounted & updated because <select> relies on its children
|
|
12033
12450
|
// <option>s.
|
|
12034
12451
|
mounted(el, { value }) {
|
|
12035
|
-
|
|
12452
|
+
vModelSetSelected(el, value);
|
|
12036
12453
|
},
|
|
12037
12454
|
beforeUpdate(el, _binding, vnode) {
|
|
12038
12455
|
el[assignKey] = getModelAssigner(vnode);
|
|
12039
12456
|
},
|
|
12040
12457
|
updated(el, { value }) {
|
|
12041
|
-
|
|
12042
|
-
setSelected(el, value);
|
|
12043
|
-
}
|
|
12458
|
+
vModelSetSelected(el, value);
|
|
12044
12459
|
}
|
|
12045
12460
|
};
|
|
12046
|
-
|
|
12461
|
+
const vModelSelectInit = (el, value, number, set) => {
|
|
12462
|
+
const isSetModel = isSet(value);
|
|
12463
|
+
addEventListener(el, "change", () => {
|
|
12464
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12465
|
+
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12466
|
+
);
|
|
12467
|
+
(0, el[assignKey])(
|
|
12468
|
+
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12469
|
+
);
|
|
12470
|
+
el._assigning = true;
|
|
12471
|
+
nextTick(() => {
|
|
12472
|
+
el._assigning = false;
|
|
12473
|
+
});
|
|
12474
|
+
});
|
|
12475
|
+
};
|
|
12476
|
+
const vModelSetSelected = (el, value) => {
|
|
12477
|
+
if (el._assigning) return;
|
|
12047
12478
|
const isMultiple = el.multiple;
|
|
12048
12479
|
const isArrayValue = isArray(value);
|
|
12049
12480
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -12074,13 +12505,20 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
12074
12505
|
if (!isMultiple && el.selectedIndex !== -1) {
|
|
12075
12506
|
el.selectedIndex = -1;
|
|
12076
12507
|
}
|
|
12077
|
-
}
|
|
12508
|
+
};
|
|
12078
12509
|
function getValue(el) {
|
|
12079
12510
|
return "_value" in el ? el._value : el.value;
|
|
12080
12511
|
}
|
|
12081
12512
|
function getCheckboxValue(el, checked) {
|
|
12082
12513
|
const key = checked ? "_trueValue" : "_falseValue";
|
|
12083
|
-
|
|
12514
|
+
if (key in el) {
|
|
12515
|
+
return el[key];
|
|
12516
|
+
}
|
|
12517
|
+
const attr = checked ? "true-value" : "false-value";
|
|
12518
|
+
if (el.hasAttribute(attr)) {
|
|
12519
|
+
return el.getAttribute(attr);
|
|
12520
|
+
}
|
|
12521
|
+
return checked;
|
|
12084
12522
|
}
|
|
12085
12523
|
const vModelDynamic = {
|
|
12086
12524
|
created(el, binding, vnode) {
|