@vue/runtime-dom 3.5.17 → 3.6.0-alpha.1
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 +1917 -1474
- 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 +1906 -1463
- 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.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -18,6 +18,8 @@ const NOOP = () => {
|
|
|
18
18
|
const NO = () => false;
|
|
19
19
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
20
20
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
21
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
22
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
21
23
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
22
24
|
const extend = Object.assign;
|
|
23
25
|
const remove = (arr, el) => {
|
|
@@ -51,6 +53,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
51
53
|
// the leading comma is intentional so empty string "" is also included
|
|
52
54
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
53
55
|
);
|
|
56
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
54
57
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
55
58
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
56
59
|
);
|
|
@@ -62,10 +65,9 @@ const cacheStringFunction = (fn) => {
|
|
|
62
65
|
};
|
|
63
66
|
};
|
|
64
67
|
const camelizeRE = /-(\w)/g;
|
|
68
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
65
69
|
const camelize = cacheStringFunction(
|
|
66
|
-
(str) =>
|
|
67
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
68
|
-
}
|
|
70
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
69
71
|
);
|
|
70
72
|
const hyphenateRE = /\B([A-Z])/g;
|
|
71
73
|
const hyphenate = cacheStringFunction(
|
|
@@ -106,6 +108,10 @@ let _globalThis;
|
|
|
106
108
|
const getGlobalThis = () => {
|
|
107
109
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
108
110
|
};
|
|
111
|
+
function canSetValueDirectly(tagName) {
|
|
112
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
113
|
+
!tagName.includes("-");
|
|
114
|
+
}
|
|
109
115
|
|
|
110
116
|
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";
|
|
111
117
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
@@ -213,6 +219,24 @@ function isRenderableAttrValue(value) {
|
|
|
213
219
|
const type = typeof value;
|
|
214
220
|
return type === "string" || type === "number" || type === "boolean";
|
|
215
221
|
}
|
|
222
|
+
function shouldSetAsAttr(tagName, key) {
|
|
223
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
if (key === "form") {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
if (key === "list" && tagName === "INPUT") {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
216
240
|
|
|
217
241
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
218
242
|
function getEscapedCssVarName(key, doubleEscape) {
|
|
@@ -276,7 +300,20 @@ const isRef$1 = (val) => {
|
|
|
276
300
|
return !!(val && val["__v_isRef"] === true);
|
|
277
301
|
};
|
|
278
302
|
const toDisplayString = (val) => {
|
|
279
|
-
|
|
303
|
+
switch (typeof val) {
|
|
304
|
+
case "string":
|
|
305
|
+
return val;
|
|
306
|
+
case "object":
|
|
307
|
+
if (val) {
|
|
308
|
+
if (isRef$1(val)) {
|
|
309
|
+
return toDisplayString(val.value);
|
|
310
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
311
|
+
return JSON.stringify(val, replacer, 2);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
default:
|
|
315
|
+
return val == null ? "" : String(val);
|
|
316
|
+
}
|
|
280
317
|
};
|
|
281
318
|
const replacer = (_key, val) => {
|
|
282
319
|
if (isRef$1(val)) {
|
|
@@ -311,604 +348,407 @@ const stringifySymbol = (v, i = "") => {
|
|
|
311
348
|
);
|
|
312
349
|
};
|
|
313
350
|
|
|
314
|
-
function
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
* @internal track `on` calls, allow `on` call multiple times
|
|
328
|
-
*/
|
|
329
|
-
this._on = 0;
|
|
330
|
-
/**
|
|
331
|
-
* @internal
|
|
332
|
-
*/
|
|
333
|
-
this.effects = [];
|
|
334
|
-
/**
|
|
335
|
-
* @internal
|
|
336
|
-
*/
|
|
337
|
-
this.cleanups = [];
|
|
338
|
-
this._isPaused = false;
|
|
339
|
-
this.parent = activeEffectScope;
|
|
340
|
-
if (!detached && activeEffectScope) {
|
|
341
|
-
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
342
|
-
this
|
|
343
|
-
) - 1;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
get active() {
|
|
347
|
-
return this._active;
|
|
348
|
-
}
|
|
349
|
-
pause() {
|
|
350
|
-
if (this._active) {
|
|
351
|
-
this._isPaused = true;
|
|
352
|
-
let i, l;
|
|
353
|
-
if (this.scopes) {
|
|
354
|
-
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
355
|
-
this.scopes[i].pause();
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
359
|
-
this.effects[i].pause();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Resumes the effect scope, including all child scopes and effects.
|
|
365
|
-
*/
|
|
366
|
-
resume() {
|
|
367
|
-
if (this._active) {
|
|
368
|
-
if (this._isPaused) {
|
|
369
|
-
this._isPaused = false;
|
|
370
|
-
let i, l;
|
|
371
|
-
if (this.scopes) {
|
|
372
|
-
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
373
|
-
this.scopes[i].resume();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
377
|
-
this.effects[i].resume();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
run(fn) {
|
|
383
|
-
if (this._active) {
|
|
384
|
-
const currentEffectScope = activeEffectScope;
|
|
385
|
-
try {
|
|
386
|
-
activeEffectScope = this;
|
|
387
|
-
return fn();
|
|
388
|
-
} finally {
|
|
389
|
-
activeEffectScope = currentEffectScope;
|
|
390
|
-
}
|
|
391
|
-
} else {
|
|
392
|
-
warn$2(`cannot run an inactive effect scope.`);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* This should only be called on non-detached scopes
|
|
397
|
-
* @internal
|
|
398
|
-
*/
|
|
399
|
-
on() {
|
|
400
|
-
if (++this._on === 1) {
|
|
401
|
-
this.prevScope = activeEffectScope;
|
|
402
|
-
activeEffectScope = this;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* This should only be called on non-detached scopes
|
|
407
|
-
* @internal
|
|
408
|
-
*/
|
|
409
|
-
off() {
|
|
410
|
-
if (this._on > 0 && --this._on === 0) {
|
|
411
|
-
activeEffectScope = this.prevScope;
|
|
412
|
-
this.prevScope = void 0;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
stop(fromParent) {
|
|
416
|
-
if (this._active) {
|
|
417
|
-
this._active = false;
|
|
418
|
-
let i, l;
|
|
419
|
-
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
420
|
-
this.effects[i].stop();
|
|
421
|
-
}
|
|
422
|
-
this.effects.length = 0;
|
|
423
|
-
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
|
424
|
-
this.cleanups[i]();
|
|
351
|
+
function getSequence(arr) {
|
|
352
|
+
const p = arr.slice();
|
|
353
|
+
const result = [0];
|
|
354
|
+
let i, j, u, v, c;
|
|
355
|
+
const len = arr.length;
|
|
356
|
+
for (i = 0; i < len; i++) {
|
|
357
|
+
const arrI = arr[i];
|
|
358
|
+
if (arrI !== 0) {
|
|
359
|
+
j = result[result.length - 1];
|
|
360
|
+
if (arr[j] < arrI) {
|
|
361
|
+
p[i] = j;
|
|
362
|
+
result.push(i);
|
|
363
|
+
continue;
|
|
425
364
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
365
|
+
u = 0;
|
|
366
|
+
v = result.length - 1;
|
|
367
|
+
while (u < v) {
|
|
368
|
+
c = u + v >> 1;
|
|
369
|
+
if (arr[result[c]] < arrI) {
|
|
370
|
+
u = c + 1;
|
|
371
|
+
} else {
|
|
372
|
+
v = c;
|
|
430
373
|
}
|
|
431
|
-
this.scopes.length = 0;
|
|
432
374
|
}
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
this.parent.scopes[this.index] = last;
|
|
437
|
-
last.index = this.index;
|
|
375
|
+
if (arrI < arr[result[u]]) {
|
|
376
|
+
if (u > 0) {
|
|
377
|
+
p[i] = result[u - 1];
|
|
438
378
|
}
|
|
379
|
+
result[u] = i;
|
|
439
380
|
}
|
|
440
|
-
this.parent = void 0;
|
|
441
381
|
}
|
|
442
382
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
return activeEffectScope;
|
|
449
|
-
}
|
|
450
|
-
function onScopeDispose(fn, failSilently = false) {
|
|
451
|
-
if (activeEffectScope) {
|
|
452
|
-
activeEffectScope.cleanups.push(fn);
|
|
453
|
-
} else if (!failSilently) {
|
|
454
|
-
warn$2(
|
|
455
|
-
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
456
|
-
);
|
|
383
|
+
u = result.length;
|
|
384
|
+
v = result[u - 1];
|
|
385
|
+
while (u-- > 0) {
|
|
386
|
+
result[u] = v;
|
|
387
|
+
v = p[v];
|
|
457
388
|
}
|
|
389
|
+
return result;
|
|
458
390
|
}
|
|
459
391
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
constructor(fn) {
|
|
464
|
-
this.fn = fn;
|
|
465
|
-
/**
|
|
466
|
-
* @internal
|
|
467
|
-
*/
|
|
468
|
-
this.deps = void 0;
|
|
469
|
-
/**
|
|
470
|
-
* @internal
|
|
471
|
-
*/
|
|
472
|
-
this.depsTail = void 0;
|
|
473
|
-
/**
|
|
474
|
-
* @internal
|
|
475
|
-
*/
|
|
476
|
-
this.flags = 1 | 4;
|
|
477
|
-
/**
|
|
478
|
-
* @internal
|
|
479
|
-
*/
|
|
480
|
-
this.next = void 0;
|
|
481
|
-
/**
|
|
482
|
-
* @internal
|
|
483
|
-
*/
|
|
484
|
-
this.cleanup = void 0;
|
|
485
|
-
this.scheduler = void 0;
|
|
486
|
-
if (activeEffectScope && activeEffectScope.active) {
|
|
487
|
-
activeEffectScope.effects.push(this);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
pause() {
|
|
491
|
-
this.flags |= 64;
|
|
492
|
-
}
|
|
493
|
-
resume() {
|
|
494
|
-
if (this.flags & 64) {
|
|
495
|
-
this.flags &= -65;
|
|
496
|
-
if (pausedQueueEffects.has(this)) {
|
|
497
|
-
pausedQueueEffects.delete(this);
|
|
498
|
-
this.trigger();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* @internal
|
|
504
|
-
*/
|
|
505
|
-
notify() {
|
|
506
|
-
if (this.flags & 2 && !(this.flags & 32)) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
if (!(this.flags & 8)) {
|
|
510
|
-
batch(this);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
run() {
|
|
514
|
-
if (!(this.flags & 1)) {
|
|
515
|
-
return this.fn();
|
|
516
|
-
}
|
|
517
|
-
this.flags |= 2;
|
|
518
|
-
cleanupEffect(this);
|
|
519
|
-
prepareDeps(this);
|
|
520
|
-
const prevEffect = activeSub;
|
|
521
|
-
const prevShouldTrack = shouldTrack;
|
|
522
|
-
activeSub = this;
|
|
523
|
-
shouldTrack = true;
|
|
524
|
-
try {
|
|
525
|
-
return this.fn();
|
|
526
|
-
} finally {
|
|
527
|
-
if (activeSub !== this) {
|
|
528
|
-
warn$2(
|
|
529
|
-
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
cleanupDeps(this);
|
|
533
|
-
activeSub = prevEffect;
|
|
534
|
-
shouldTrack = prevShouldTrack;
|
|
535
|
-
this.flags &= -3;
|
|
536
|
-
}
|
|
392
|
+
function normalizeCssVarValue(value) {
|
|
393
|
+
if (value == null) {
|
|
394
|
+
return "initial";
|
|
537
395
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
for (let link = this.deps; link; link = link.nextDep) {
|
|
541
|
-
removeSub(link);
|
|
542
|
-
}
|
|
543
|
-
this.deps = this.depsTail = void 0;
|
|
544
|
-
cleanupEffect(this);
|
|
545
|
-
this.onStop && this.onStop();
|
|
546
|
-
this.flags &= -2;
|
|
547
|
-
}
|
|
396
|
+
if (typeof value === "string") {
|
|
397
|
+
return value === "" ? " " : value;
|
|
548
398
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
this.runIfDirty();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* @internal
|
|
560
|
-
*/
|
|
561
|
-
runIfDirty() {
|
|
562
|
-
if (isDirty(this)) {
|
|
563
|
-
this.run();
|
|
399
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
400
|
+
{
|
|
401
|
+
console.warn(
|
|
402
|
+
"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
|
|
403
|
+
value
|
|
404
|
+
);
|
|
564
405
|
}
|
|
565
406
|
}
|
|
566
|
-
|
|
567
|
-
return isDirty(this);
|
|
568
|
-
}
|
|
407
|
+
return String(value);
|
|
569
408
|
}
|
|
409
|
+
|
|
410
|
+
function warn$2(msg, ...args) {
|
|
411
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
|
|
415
|
+
ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
|
|
416
|
+
ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
|
|
417
|
+
ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
|
|
418
|
+
ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
|
|
419
|
+
ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
|
|
420
|
+
ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
|
|
421
|
+
ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
|
|
422
|
+
return ReactiveFlags2;
|
|
423
|
+
})(ReactiveFlags || {});
|
|
424
|
+
const notifyBuffer = [];
|
|
570
425
|
let batchDepth = 0;
|
|
571
|
-
let
|
|
572
|
-
let
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
426
|
+
let activeSub = void 0;
|
|
427
|
+
let notifyIndex = 0;
|
|
428
|
+
let notifyBufferLength = 0;
|
|
429
|
+
function setActiveSub(sub) {
|
|
430
|
+
try {
|
|
431
|
+
return activeSub;
|
|
432
|
+
} finally {
|
|
433
|
+
activeSub = sub;
|
|
579
434
|
}
|
|
580
|
-
sub.next = batchedSub;
|
|
581
|
-
batchedSub = sub;
|
|
582
435
|
}
|
|
583
436
|
function startBatch() {
|
|
584
|
-
batchDepth
|
|
437
|
+
++batchDepth;
|
|
585
438
|
}
|
|
586
439
|
function endBatch() {
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
if (batchedComputed) {
|
|
591
|
-
let e = batchedComputed;
|
|
592
|
-
batchedComputed = void 0;
|
|
593
|
-
while (e) {
|
|
594
|
-
const next = e.next;
|
|
595
|
-
e.next = void 0;
|
|
596
|
-
e.flags &= -9;
|
|
597
|
-
e = next;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
let error;
|
|
601
|
-
while (batchedSub) {
|
|
602
|
-
let e = batchedSub;
|
|
603
|
-
batchedSub = void 0;
|
|
604
|
-
while (e) {
|
|
605
|
-
const next = e.next;
|
|
606
|
-
e.next = void 0;
|
|
607
|
-
e.flags &= -9;
|
|
608
|
-
if (e.flags & 1) {
|
|
609
|
-
try {
|
|
610
|
-
;
|
|
611
|
-
e.trigger();
|
|
612
|
-
} catch (err) {
|
|
613
|
-
if (!error) error = err;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
e = next;
|
|
617
|
-
}
|
|
440
|
+
if (!--batchDepth && notifyBufferLength) {
|
|
441
|
+
flush();
|
|
618
442
|
}
|
|
619
|
-
if (error) throw error;
|
|
620
443
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
link.dep.activeLink = link;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function cleanupDeps(sub) {
|
|
629
|
-
let head;
|
|
630
|
-
let tail = sub.depsTail;
|
|
631
|
-
let link = tail;
|
|
632
|
-
while (link) {
|
|
633
|
-
const prev = link.prevDep;
|
|
634
|
-
if (link.version === -1) {
|
|
635
|
-
if (link === tail) tail = prev;
|
|
636
|
-
removeSub(link);
|
|
637
|
-
removeDep(link);
|
|
638
|
-
} else {
|
|
639
|
-
head = link;
|
|
640
|
-
}
|
|
641
|
-
link.dep.activeLink = link.prevActiveLink;
|
|
642
|
-
link.prevActiveLink = void 0;
|
|
643
|
-
link = prev;
|
|
444
|
+
function link(dep, sub) {
|
|
445
|
+
const prevDep = sub.depsTail;
|
|
446
|
+
if (prevDep !== void 0 && prevDep.dep === dep) {
|
|
447
|
+
return;
|
|
644
448
|
}
|
|
645
|
-
|
|
646
|
-
sub.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return
|
|
449
|
+
let nextDep = void 0;
|
|
450
|
+
const recursedCheck = sub.flags & 4 /* RecursedCheck */;
|
|
451
|
+
if (recursedCheck) {
|
|
452
|
+
nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
453
|
+
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
454
|
+
sub.depsTail = nextDep;
|
|
455
|
+
return;
|
|
652
456
|
}
|
|
653
457
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
657
|
-
return false;
|
|
658
|
-
}
|
|
659
|
-
function refreshComputed(computed) {
|
|
660
|
-
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
458
|
+
const prevSub = dep.subsTail;
|
|
459
|
+
if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
|
|
661
460
|
return;
|
|
662
461
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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;
|
|
666
472
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
473
|
+
if (prevDep !== void 0) {
|
|
474
|
+
prevDep.nextDep = newLink;
|
|
475
|
+
} else {
|
|
476
|
+
sub.deps = newLink;
|
|
670
477
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
activeSub = computed;
|
|
676
|
-
shouldTrack = true;
|
|
677
|
-
try {
|
|
678
|
-
prepareDeps(computed);
|
|
679
|
-
const value = computed.fn(computed._value);
|
|
680
|
-
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
681
|
-
computed.flags |= 128;
|
|
682
|
-
computed._value = value;
|
|
683
|
-
dep.version++;
|
|
684
|
-
}
|
|
685
|
-
} catch (err) {
|
|
686
|
-
dep.version++;
|
|
687
|
-
throw err;
|
|
688
|
-
} finally {
|
|
689
|
-
activeSub = prevSub;
|
|
690
|
-
shouldTrack = prevShouldTrack;
|
|
691
|
-
cleanupDeps(computed);
|
|
692
|
-
computed.flags &= -3;
|
|
478
|
+
if (prevSub !== void 0) {
|
|
479
|
+
prevSub.nextSub = newLink;
|
|
480
|
+
} else {
|
|
481
|
+
dep.subs = newLink;
|
|
693
482
|
}
|
|
694
483
|
}
|
|
695
|
-
function
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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;
|
|
700
494
|
}
|
|
701
|
-
if (
|
|
702
|
-
|
|
703
|
-
|
|
495
|
+
if (prevDep !== void 0) {
|
|
496
|
+
prevDep.nextDep = nextDep;
|
|
497
|
+
} else {
|
|
498
|
+
sub.deps = nextDep;
|
|
704
499
|
}
|
|
705
|
-
if (
|
|
706
|
-
|
|
500
|
+
if (nextSub !== void 0) {
|
|
501
|
+
nextSub.prevSub = prevSub;
|
|
502
|
+
} else {
|
|
503
|
+
dep.subsTail = prevSub;
|
|
707
504
|
}
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
+
}
|
|
714
550
|
}
|
|
715
551
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
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);
|
|
720
566
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
567
|
+
function startTracking(sub) {
|
|
568
|
+
sub.depsTail = void 0;
|
|
569
|
+
sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
|
|
570
|
+
return setActiveSub(sub);
|
|
571
|
+
}
|
|
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
|
+
);
|
|
726
577
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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;
|
|
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;
|
|
674
|
+
}
|
|
675
|
+
if (link2 === depsTail) {
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
link2 = link2.nextDep;
|
|
679
|
+
} while (link2 !== void 0);
|
|
730
680
|
}
|
|
681
|
+
return false;
|
|
731
682
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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
|
+
);
|
|
739
695
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
696
|
+
}
|
|
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
|
+
);
|
|
745
708
|
}
|
|
746
|
-
const runner = e.run.bind(e);
|
|
747
|
-
runner.effect = e;
|
|
748
|
-
return runner;
|
|
749
709
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
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
|
+
});
|
|
752
720
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
const { cleanup } = e;
|
|
765
|
-
e.cleanup = void 0;
|
|
766
|
-
if (cleanup) {
|
|
767
|
-
const prevSub = activeSub;
|
|
768
|
-
activeSub = void 0;
|
|
769
|
-
try {
|
|
770
|
-
cleanup();
|
|
771
|
-
} finally {
|
|
772
|
-
activeSub = prevSub;
|
|
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;
|
|
773
732
|
}
|
|
774
|
-
}
|
|
733
|
+
});
|
|
775
734
|
}
|
|
776
735
|
|
|
777
|
-
let globalVersion = 0;
|
|
778
|
-
class Link {
|
|
779
|
-
constructor(sub, dep) {
|
|
780
|
-
this.sub = sub;
|
|
781
|
-
this.dep = dep;
|
|
782
|
-
this.version = dep.version;
|
|
783
|
-
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
736
|
class Dep {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
this.
|
|
790
|
-
this.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
*/
|
|
794
|
-
this.activeLink = void 0;
|
|
795
|
-
/**
|
|
796
|
-
* Doubly linked list representing the subscribing effects (tail)
|
|
797
|
-
*/
|
|
798
|
-
this.subs = void 0;
|
|
799
|
-
/**
|
|
800
|
-
* For object property deps cleanup
|
|
801
|
-
*/
|
|
802
|
-
this.map = void 0;
|
|
803
|
-
this.key = void 0;
|
|
804
|
-
/**
|
|
805
|
-
* Subscriber counter
|
|
806
|
-
*/
|
|
807
|
-
this.sc = 0;
|
|
808
|
-
/**
|
|
809
|
-
* @internal
|
|
810
|
-
*/
|
|
811
|
-
this.__v_skip = true;
|
|
812
|
-
{
|
|
813
|
-
this.subsHead = void 0;
|
|
814
|
-
}
|
|
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;
|
|
815
743
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
let link = this.activeLink;
|
|
821
|
-
if (link === void 0 || link.sub !== activeSub) {
|
|
822
|
-
link = this.activeLink = new Link(activeSub, this);
|
|
823
|
-
if (!activeSub.deps) {
|
|
824
|
-
activeSub.deps = activeSub.depsTail = link;
|
|
825
|
-
} else {
|
|
826
|
-
link.prevDep = activeSub.depsTail;
|
|
827
|
-
activeSub.depsTail.nextDep = link;
|
|
828
|
-
activeSub.depsTail = link;
|
|
829
|
-
}
|
|
830
|
-
addSub(link);
|
|
831
|
-
} else if (link.version === -1) {
|
|
832
|
-
link.version = this.version;
|
|
833
|
-
if (link.nextDep) {
|
|
834
|
-
const next = link.nextDep;
|
|
835
|
-
next.prevDep = link.prevDep;
|
|
836
|
-
if (link.prevDep) {
|
|
837
|
-
link.prevDep.nextDep = next;
|
|
838
|
-
}
|
|
839
|
-
link.prevDep = activeSub.depsTail;
|
|
840
|
-
link.nextDep = void 0;
|
|
841
|
-
activeSub.depsTail.nextDep = link;
|
|
842
|
-
activeSub.depsTail = link;
|
|
843
|
-
if (activeSub.deps === link) {
|
|
844
|
-
activeSub.deps = next;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
if (activeSub.onTrack) {
|
|
849
|
-
activeSub.onTrack(
|
|
850
|
-
extend(
|
|
851
|
-
{
|
|
852
|
-
effect: activeSub
|
|
853
|
-
},
|
|
854
|
-
debugInfo
|
|
855
|
-
)
|
|
856
|
-
);
|
|
857
|
-
}
|
|
858
|
-
return link;
|
|
859
|
-
}
|
|
860
|
-
trigger(debugInfo) {
|
|
861
|
-
this.version++;
|
|
862
|
-
globalVersion++;
|
|
863
|
-
this.notify(debugInfo);
|
|
744
|
+
get subs() {
|
|
745
|
+
return this._subs;
|
|
864
746
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
870
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
871
|
-
head.sub.onTrigger(
|
|
872
|
-
extend(
|
|
873
|
-
{
|
|
874
|
-
effect: head.sub
|
|
875
|
-
},
|
|
876
|
-
debugInfo
|
|
877
|
-
)
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
for (let link = this.subs; link; link = link.prevSub) {
|
|
883
|
-
if (link.sub.notify()) {
|
|
884
|
-
;
|
|
885
|
-
link.sub.dep.notify();
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
} finally {
|
|
889
|
-
endBatch();
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
function addSub(link) {
|
|
894
|
-
link.dep.sc++;
|
|
895
|
-
if (link.sub.flags & 4) {
|
|
896
|
-
const computed = link.dep.computed;
|
|
897
|
-
if (computed && !link.dep.subs) {
|
|
898
|
-
computed.flags |= 4 | 16;
|
|
899
|
-
for (let l = computed.deps; l; l = l.nextDep) {
|
|
900
|
-
addSub(l);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
const currentTail = link.dep.subs;
|
|
904
|
-
if (currentTail !== link) {
|
|
905
|
-
link.prevSub = currentTail;
|
|
906
|
-
if (currentTail) currentTail.nextSub = link;
|
|
747
|
+
set subs(value) {
|
|
748
|
+
this._subs = value;
|
|
749
|
+
if (value === void 0) {
|
|
750
|
+
this.map.delete(this.key);
|
|
907
751
|
}
|
|
908
|
-
if (link.dep.subsHead === void 0) {
|
|
909
|
-
link.dep.subsHead = link;
|
|
910
|
-
}
|
|
911
|
-
link.dep.subs = link;
|
|
912
752
|
}
|
|
913
753
|
}
|
|
914
754
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -922,36 +762,34 @@ const ARRAY_ITERATE_KEY = Symbol(
|
|
|
922
762
|
"Array iterate"
|
|
923
763
|
);
|
|
924
764
|
function track(target, type, key) {
|
|
925
|
-
if (
|
|
765
|
+
if (activeSub !== void 0) {
|
|
926
766
|
let depsMap = targetMap.get(target);
|
|
927
767
|
if (!depsMap) {
|
|
928
768
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
929
769
|
}
|
|
930
770
|
let dep = depsMap.get(key);
|
|
931
771
|
if (!dep) {
|
|
932
|
-
depsMap.set(key, dep = new Dep());
|
|
933
|
-
dep.map = depsMap;
|
|
934
|
-
dep.key = key;
|
|
772
|
+
depsMap.set(key, dep = new Dep(depsMap, key));
|
|
935
773
|
}
|
|
936
774
|
{
|
|
937
|
-
|
|
775
|
+
onTrack(activeSub, {
|
|
938
776
|
target,
|
|
939
777
|
type,
|
|
940
778
|
key
|
|
941
779
|
});
|
|
942
780
|
}
|
|
781
|
+
link(dep, activeSub);
|
|
943
782
|
}
|
|
944
783
|
}
|
|
945
784
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
946
785
|
const depsMap = targetMap.get(target);
|
|
947
786
|
if (!depsMap) {
|
|
948
|
-
globalVersion++;
|
|
949
787
|
return;
|
|
950
788
|
}
|
|
951
789
|
const run = (dep) => {
|
|
952
|
-
if (dep) {
|
|
790
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
953
791
|
{
|
|
954
|
-
|
|
792
|
+
triggerEventInfos.push({
|
|
955
793
|
target,
|
|
956
794
|
type,
|
|
957
795
|
key,
|
|
@@ -960,6 +798,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
960
798
|
oldTarget
|
|
961
799
|
});
|
|
962
800
|
}
|
|
801
|
+
propagate(dep.subs);
|
|
802
|
+
shallowPropagate(dep.subs);
|
|
803
|
+
{
|
|
804
|
+
triggerEventInfos.pop();
|
|
805
|
+
}
|
|
963
806
|
}
|
|
964
807
|
};
|
|
965
808
|
startBatch();
|
|
@@ -1184,11 +1027,11 @@ function searchProxy(self, method, args) {
|
|
|
1184
1027
|
return res;
|
|
1185
1028
|
}
|
|
1186
1029
|
function noTracking(self, method, args = []) {
|
|
1187
|
-
pauseTracking();
|
|
1188
1030
|
startBatch();
|
|
1031
|
+
const prevSub = setActiveSub();
|
|
1189
1032
|
const res = toRaw(self)[method].apply(self, args);
|
|
1033
|
+
setActiveSub(prevSub);
|
|
1190
1034
|
endBatch();
|
|
1191
|
-
resetTracking();
|
|
1192
1035
|
return res;
|
|
1193
1036
|
}
|
|
1194
1037
|
|
|
@@ -1234,14 +1077,18 @@ class BaseReactiveHandler {
|
|
|
1234
1077
|
return hasOwnProperty;
|
|
1235
1078
|
}
|
|
1236
1079
|
}
|
|
1080
|
+
const wasRef = isRef(target);
|
|
1237
1081
|
const res = Reflect.get(
|
|
1238
1082
|
target,
|
|
1239
1083
|
key,
|
|
1240
1084
|
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1241
1085
|
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1242
1086
|
// its class methods
|
|
1243
|
-
|
|
1087
|
+
wasRef ? target : receiver
|
|
1244
1088
|
);
|
|
1089
|
+
if (wasRef && key !== "value") {
|
|
1090
|
+
return res;
|
|
1091
|
+
}
|
|
1245
1092
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1246
1093
|
return res;
|
|
1247
1094
|
}
|
|
@@ -1693,33 +1540,47 @@ function isRef(r) {
|
|
|
1693
1540
|
return r ? r["__v_isRef"] === true : false;
|
|
1694
1541
|
}
|
|
1695
1542
|
function ref(value) {
|
|
1696
|
-
return createRef(value,
|
|
1543
|
+
return createRef(value, toReactive);
|
|
1697
1544
|
}
|
|
1698
1545
|
function shallowRef(value) {
|
|
1699
|
-
return createRef(value
|
|
1546
|
+
return createRef(value);
|
|
1700
1547
|
}
|
|
1701
|
-
function createRef(rawValue,
|
|
1548
|
+
function createRef(rawValue, wrap) {
|
|
1702
1549
|
if (isRef(rawValue)) {
|
|
1703
1550
|
return rawValue;
|
|
1704
1551
|
}
|
|
1705
|
-
return new RefImpl(rawValue,
|
|
1552
|
+
return new RefImpl(rawValue, wrap);
|
|
1706
1553
|
}
|
|
1707
1554
|
class RefImpl {
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
this
|
|
1711
|
-
this
|
|
1712
|
-
this.
|
|
1713
|
-
|
|
1714
|
-
|
|
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;
|
|
1715
1576
|
}
|
|
1716
1577
|
get value() {
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
}
|
|
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
|
+
}
|
|
1723
1584
|
}
|
|
1724
1585
|
return this._value;
|
|
1725
1586
|
}
|
|
@@ -1728,30 +1589,55 @@ class RefImpl {
|
|
|
1728
1589
|
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1729
1590
|
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1730
1591
|
if (hasChanged(newValue, oldValue)) {
|
|
1592
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
1731
1593
|
this._rawValue = newValue;
|
|
1732
|
-
this._value = useDirectValue ? newValue :
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
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
|
+
}
|
|
1741
1613
|
}
|
|
1742
1614
|
}
|
|
1743
1615
|
}
|
|
1616
|
+
update() {
|
|
1617
|
+
this.flags &= ~ReactiveFlags.Dirty;
|
|
1618
|
+
return hasChanged(this._oldValue, this._oldValue = this._rawValue);
|
|
1619
|
+
}
|
|
1744
1620
|
}
|
|
1745
1621
|
function triggerRef(ref2) {
|
|
1746
|
-
|
|
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) {
|
|
1747
1633
|
{
|
|
1748
|
-
|
|
1749
|
-
target:
|
|
1750
|
-
type: "
|
|
1751
|
-
key: "value"
|
|
1752
|
-
newValue: ref2._value
|
|
1634
|
+
onTrack(activeSub, {
|
|
1635
|
+
target: dep,
|
|
1636
|
+
type: "get",
|
|
1637
|
+
key: "value"
|
|
1753
1638
|
});
|
|
1754
1639
|
}
|
|
1640
|
+
link(dep, activeSub);
|
|
1755
1641
|
}
|
|
1756
1642
|
}
|
|
1757
1643
|
function unref(ref2) {
|
|
@@ -1777,13 +1663,21 @@ function proxyRefs(objectWithRefs) {
|
|
|
1777
1663
|
}
|
|
1778
1664
|
class CustomRefImpl {
|
|
1779
1665
|
constructor(factory) {
|
|
1666
|
+
this.subs = void 0;
|
|
1667
|
+
this.subsTail = void 0;
|
|
1668
|
+
this.flags = ReactiveFlags.None;
|
|
1780
1669
|
this["__v_isRef"] = true;
|
|
1781
1670
|
this._value = void 0;
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1671
|
+
const { get, set } = factory(
|
|
1672
|
+
() => trackRef(this),
|
|
1673
|
+
() => triggerRef(this)
|
|
1674
|
+
);
|
|
1784
1675
|
this._get = get;
|
|
1785
1676
|
this._set = set;
|
|
1786
1677
|
}
|
|
1678
|
+
get dep() {
|
|
1679
|
+
return this;
|
|
1680
|
+
}
|
|
1787
1681
|
get value() {
|
|
1788
1682
|
return this._value = this._get();
|
|
1789
1683
|
}
|
|
@@ -1795,9 +1689,6 @@ function customRef(factory) {
|
|
|
1795
1689
|
return new CustomRefImpl(factory);
|
|
1796
1690
|
}
|
|
1797
1691
|
function toRefs(object) {
|
|
1798
|
-
if (!isProxy(object)) {
|
|
1799
|
-
warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
|
1800
|
-
}
|
|
1801
1692
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1802
1693
|
for (const key in object) {
|
|
1803
1694
|
ret[key] = propertyToRef(object, key);
|
|
@@ -1850,69 +1741,333 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1850
1741
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1851
1742
|
}
|
|
1852
1743
|
|
|
1853
|
-
class
|
|
1854
|
-
constructor(fn
|
|
1855
|
-
this.
|
|
1856
|
-
this.
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
this._value = void 0;
|
|
1861
|
-
/**
|
|
1862
|
-
* @internal
|
|
1863
|
-
*/
|
|
1864
|
-
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;
|
|
1865
1751
|
/**
|
|
1866
1752
|
* @internal
|
|
1867
1753
|
*/
|
|
1868
|
-
this.
|
|
1869
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1870
|
-
// A computed is also a subscriber that tracks other deps
|
|
1754
|
+
this.cleanups = [];
|
|
1871
1755
|
/**
|
|
1872
1756
|
* @internal
|
|
1873
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) {
|
|
1874
1888
|
this.deps = void 0;
|
|
1889
|
+
this.depsTail = void 0;
|
|
1890
|
+
this.subs = void 0;
|
|
1891
|
+
this.subsTail = void 0;
|
|
1892
|
+
this.flags = 0;
|
|
1875
1893
|
/**
|
|
1876
1894
|
* @internal
|
|
1877
1895
|
*/
|
|
1878
|
-
this.
|
|
1896
|
+
this.cleanups = [];
|
|
1879
1897
|
/**
|
|
1880
1898
|
* @internal
|
|
1881
1899
|
*/
|
|
1882
|
-
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 prevSub = setActiveSub();
|
|
1936
|
+
const prevScope = activeEffectScope;
|
|
1937
|
+
try {
|
|
1938
|
+
activeEffectScope = this;
|
|
1939
|
+
return fn();
|
|
1940
|
+
} finally {
|
|
1941
|
+
activeEffectScope = prevScope;
|
|
1942
|
+
setActiveSub(prevSub);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
stop() {
|
|
1946
|
+
if (!this.active) {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
this.flags = 1024;
|
|
1950
|
+
let dep = this.deps;
|
|
1951
|
+
while (dep !== void 0) {
|
|
1952
|
+
const node = dep.dep;
|
|
1953
|
+
if ("stop" in node) {
|
|
1954
|
+
dep = dep.nextDep;
|
|
1955
|
+
node.stop();
|
|
1956
|
+
} else {
|
|
1957
|
+
dep = unlink(dep, this);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
const sub = this.subs;
|
|
1961
|
+
if (sub !== void 0) {
|
|
1962
|
+
unlink(sub);
|
|
1963
|
+
}
|
|
1964
|
+
cleanup(this);
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
function effectScope(detached) {
|
|
1968
|
+
return new EffectScope(detached);
|
|
1969
|
+
}
|
|
1970
|
+
function getCurrentScope() {
|
|
1971
|
+
return activeEffectScope;
|
|
1972
|
+
}
|
|
1973
|
+
function setCurrentScope(scope) {
|
|
1974
|
+
try {
|
|
1975
|
+
return activeEffectScope;
|
|
1976
|
+
} finally {
|
|
1977
|
+
activeEffectScope = scope;
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
1981
|
+
if (activeEffectScope !== void 0) {
|
|
1982
|
+
activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
|
|
1983
|
+
} else if (!failSilently) {
|
|
1984
|
+
warn$2(
|
|
1985
|
+
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
1986
|
+
);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
class ComputedRefImpl {
|
|
1991
|
+
constructor(fn, setter) {
|
|
1992
|
+
this.fn = fn;
|
|
1993
|
+
this.setter = setter;
|
|
1883
1994
|
/**
|
|
1884
1995
|
* @internal
|
|
1885
1996
|
*/
|
|
1886
|
-
this.
|
|
1997
|
+
this._value = void 0;
|
|
1998
|
+
this.subs = void 0;
|
|
1999
|
+
this.subsTail = void 0;
|
|
2000
|
+
this.deps = void 0;
|
|
2001
|
+
this.depsTail = void 0;
|
|
2002
|
+
this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
1887
2003
|
/**
|
|
1888
2004
|
* @internal
|
|
1889
2005
|
*/
|
|
1890
|
-
this.
|
|
1891
|
-
// for backwards compat
|
|
1892
|
-
this.effect = this;
|
|
2006
|
+
this.__v_isRef = true;
|
|
1893
2007
|
this["__v_isReadonly"] = !setter;
|
|
1894
|
-
|
|
2008
|
+
}
|
|
2009
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
2010
|
+
// for backwards compat
|
|
2011
|
+
get effect() {
|
|
2012
|
+
return this;
|
|
2013
|
+
}
|
|
2014
|
+
// for backwards compat
|
|
2015
|
+
get dep() {
|
|
2016
|
+
return this;
|
|
1895
2017
|
}
|
|
1896
2018
|
/**
|
|
1897
2019
|
* @internal
|
|
2020
|
+
* for backwards compat
|
|
1898
2021
|
*/
|
|
1899
|
-
|
|
1900
|
-
this.flags
|
|
1901
|
-
if (
|
|
1902
|
-
activeSub !== this) {
|
|
1903
|
-
batch(this, true);
|
|
2022
|
+
get _dirty() {
|
|
2023
|
+
const flags = this.flags;
|
|
2024
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1904
2025
|
return true;
|
|
1905
2026
|
}
|
|
2027
|
+
if (flags & ReactiveFlags.Pending) {
|
|
2028
|
+
if (checkDirty(this.deps, this)) {
|
|
2029
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
2030
|
+
return true;
|
|
2031
|
+
} else {
|
|
2032
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* @internal
|
|
2039
|
+
* for backwards compat
|
|
2040
|
+
*/
|
|
2041
|
+
set _dirty(v) {
|
|
2042
|
+
if (v) {
|
|
2043
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
2044
|
+
} else {
|
|
2045
|
+
this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
|
|
2046
|
+
}
|
|
1906
2047
|
}
|
|
1907
2048
|
get value() {
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2049
|
+
const flags = this.flags;
|
|
2050
|
+
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
|
|
2051
|
+
if (this.update()) {
|
|
2052
|
+
const subs = this.subs;
|
|
2053
|
+
if (subs !== void 0) {
|
|
2054
|
+
shallowPropagate(subs);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
} else if (flags & ReactiveFlags.Pending) {
|
|
2058
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2059
|
+
}
|
|
2060
|
+
if (activeSub !== void 0) {
|
|
2061
|
+
{
|
|
2062
|
+
onTrack(activeSub, {
|
|
2063
|
+
target: this,
|
|
2064
|
+
type: "get",
|
|
2065
|
+
key: "value"
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
link(this, activeSub);
|
|
2069
|
+
} else if (activeEffectScope !== void 0) {
|
|
2070
|
+
link(this, activeEffectScope);
|
|
1916
2071
|
}
|
|
1917
2072
|
return this._value;
|
|
1918
2073
|
}
|
|
@@ -1923,6 +2078,23 @@ class ComputedRefImpl {
|
|
|
1923
2078
|
warn$2("Write operation failed: computed value is readonly");
|
|
1924
2079
|
}
|
|
1925
2080
|
}
|
|
2081
|
+
update() {
|
|
2082
|
+
const prevSub = startTracking(this);
|
|
2083
|
+
try {
|
|
2084
|
+
const oldValue = this._value;
|
|
2085
|
+
const newValue = this.fn(oldValue);
|
|
2086
|
+
if (hasChanged(oldValue, newValue)) {
|
|
2087
|
+
this._value = newValue;
|
|
2088
|
+
return true;
|
|
2089
|
+
}
|
|
2090
|
+
return false;
|
|
2091
|
+
} finally {
|
|
2092
|
+
endTracking(this, prevSub);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
{
|
|
2097
|
+
setupOnTrigger(ComputedRefImpl);
|
|
1926
2098
|
}
|
|
1927
2099
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1928
2100
|
let getter;
|
|
@@ -1933,7 +2105,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
1933
2105
|
getter = getterOrOptions.get;
|
|
1934
2106
|
setter = getterOrOptions.set;
|
|
1935
2107
|
}
|
|
1936
|
-
const cRef = new ComputedRefImpl(getter, setter
|
|
2108
|
+
const cRef = new ComputedRefImpl(getter, setter);
|
|
1937
2109
|
if (debugOptions && !isSSR) {
|
|
1938
2110
|
cRef.onTrack = debugOptions.onTrack;
|
|
1939
2111
|
cRef.onTrigger = debugOptions.onTrigger;
|
|
@@ -1954,177 +2126,146 @@ const TriggerOpTypes = {
|
|
|
1954
2126
|
};
|
|
1955
2127
|
|
|
1956
2128
|
const INITIAL_WATCHER_VALUE = {};
|
|
1957
|
-
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1958
2129
|
let activeWatcher = void 0;
|
|
1959
2130
|
function getCurrentWatcher() {
|
|
1960
2131
|
return activeWatcher;
|
|
1961
2132
|
}
|
|
1962
2133
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1963
2134
|
if (owner) {
|
|
1964
|
-
|
|
1965
|
-
if (
|
|
1966
|
-
|
|
2135
|
+
const { call } = owner.options;
|
|
2136
|
+
if (call) {
|
|
2137
|
+
owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
|
|
2138
|
+
} else {
|
|
2139
|
+
owner.cleanups[owner.cleanupsLength++] = cleanupFn;
|
|
2140
|
+
}
|
|
1967
2141
|
} else if (!failSilently) {
|
|
1968
2142
|
warn$2(
|
|
1969
2143
|
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1970
2144
|
);
|
|
1971
2145
|
}
|
|
1972
2146
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
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
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2003
|
-
getter = () => source.map((s) => {
|
|
2004
|
-
if (isRef(s)) {
|
|
2005
|
-
return s.value;
|
|
2006
|
-
} else if (isReactive(s)) {
|
|
2007
|
-
return reactiveGetter(s);
|
|
2008
|
-
} else if (isFunction(s)) {
|
|
2009
|
-
return call ? call(s, 2) : s();
|
|
2147
|
+
class WatcherEffect extends ReactiveEffect {
|
|
2148
|
+
constructor(source, cb, options = EMPTY_OBJ) {
|
|
2149
|
+
const { deep, once, call, onWarn } = options;
|
|
2150
|
+
let getter;
|
|
2151
|
+
let forceTrigger = false;
|
|
2152
|
+
let isMultiSource = false;
|
|
2153
|
+
if (isRef(source)) {
|
|
2154
|
+
getter = () => source.value;
|
|
2155
|
+
forceTrigger = isShallow(source);
|
|
2156
|
+
} else if (isReactive(source)) {
|
|
2157
|
+
getter = () => reactiveGetter(source, deep);
|
|
2158
|
+
forceTrigger = true;
|
|
2159
|
+
} else if (isArray(source)) {
|
|
2160
|
+
isMultiSource = true;
|
|
2161
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2162
|
+
getter = () => source.map((s) => {
|
|
2163
|
+
if (isRef(s)) {
|
|
2164
|
+
return s.value;
|
|
2165
|
+
} else if (isReactive(s)) {
|
|
2166
|
+
return reactiveGetter(s, deep);
|
|
2167
|
+
} else if (isFunction(s)) {
|
|
2168
|
+
return call ? call(s, 2) : s();
|
|
2169
|
+
} else {
|
|
2170
|
+
warnInvalidSource(s, onWarn);
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
} else if (isFunction(source)) {
|
|
2174
|
+
if (cb) {
|
|
2175
|
+
getter = call ? () => call(source, 2) : source;
|
|
2010
2176
|
} else {
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2177
|
+
getter = () => {
|
|
2178
|
+
if (this.cleanupsLength) {
|
|
2179
|
+
const prevSub = setActiveSub();
|
|
2180
|
+
try {
|
|
2181
|
+
cleanup(this);
|
|
2182
|
+
} finally {
|
|
2183
|
+
setActiveSub(prevSub);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
const currentEffect = activeWatcher;
|
|
2187
|
+
activeWatcher = this;
|
|
2021
2188
|
try {
|
|
2022
|
-
|
|
2189
|
+
return call ? call(source, 3, [
|
|
2190
|
+
this.boundCleanup
|
|
2191
|
+
]) : source(this.boundCleanup);
|
|
2023
2192
|
} finally {
|
|
2024
|
-
|
|
2193
|
+
activeWatcher = currentEffect;
|
|
2025
2194
|
}
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
} else {
|
|
2198
|
+
getter = NOOP;
|
|
2199
|
+
warnInvalidSource(source, onWarn);
|
|
2200
|
+
}
|
|
2201
|
+
if (cb && deep) {
|
|
2202
|
+
const baseGetter = getter;
|
|
2203
|
+
const depth = deep === true ? Infinity : deep;
|
|
2204
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2205
|
+
}
|
|
2206
|
+
super(getter);
|
|
2207
|
+
this.cb = cb;
|
|
2208
|
+
this.options = options;
|
|
2209
|
+
this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
|
|
2210
|
+
this.forceTrigger = forceTrigger;
|
|
2211
|
+
this.isMultiSource = isMultiSource;
|
|
2212
|
+
if (once && cb) {
|
|
2213
|
+
const _cb = cb;
|
|
2214
|
+
cb = (...args) => {
|
|
2215
|
+
_cb(...args);
|
|
2216
|
+
this.stop();
|
|
2034
2217
|
};
|
|
2035
2218
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
const baseGetter = getter;
|
|
2042
|
-
const depth = deep === true ? Infinity : deep;
|
|
2043
|
-
getter = () => traverse(baseGetter(), depth);
|
|
2044
|
-
}
|
|
2045
|
-
const scope = getCurrentScope();
|
|
2046
|
-
const watchHandle = () => {
|
|
2047
|
-
effect.stop();
|
|
2048
|
-
if (scope && scope.active) {
|
|
2049
|
-
remove(scope.effects, effect);
|
|
2219
|
+
this.cb = cb;
|
|
2220
|
+
this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2221
|
+
{
|
|
2222
|
+
this.onTrack = options.onTrack;
|
|
2223
|
+
this.onTrigger = options.onTrigger;
|
|
2050
2224
|
}
|
|
2051
|
-
};
|
|
2052
|
-
if (once && cb) {
|
|
2053
|
-
const _cb = cb;
|
|
2054
|
-
cb = (...args) => {
|
|
2055
|
-
_cb(...args);
|
|
2056
|
-
watchHandle();
|
|
2057
|
-
};
|
|
2058
2225
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2226
|
+
run(initialRun = false) {
|
|
2227
|
+
const oldValue = this.oldValue;
|
|
2228
|
+
const newValue = this.oldValue = super.run();
|
|
2229
|
+
if (!this.cb) {
|
|
2062
2230
|
return;
|
|
2063
2231
|
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
if (cleanup) {
|
|
2068
|
-
cleanup();
|
|
2069
|
-
}
|
|
2070
|
-
const currentWatcher = activeWatcher;
|
|
2071
|
-
activeWatcher = effect;
|
|
2072
|
-
try {
|
|
2073
|
-
const args = [
|
|
2074
|
-
newValue,
|
|
2075
|
-
// pass undefined as the old value when it's changed for the first time
|
|
2076
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2077
|
-
boundCleanup
|
|
2078
|
-
];
|
|
2079
|
-
oldValue = newValue;
|
|
2080
|
-
call ? call(cb, 3, args) : (
|
|
2081
|
-
// @ts-expect-error
|
|
2082
|
-
cb(...args)
|
|
2083
|
-
);
|
|
2084
|
-
} finally {
|
|
2085
|
-
activeWatcher = currentWatcher;
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
} else {
|
|
2089
|
-
effect.run();
|
|
2232
|
+
const { immediate, deep, call } = this.options;
|
|
2233
|
+
if (initialRun && !immediate) {
|
|
2234
|
+
return;
|
|
2090
2235
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
call(
|
|
2103
|
-
|
|
2104
|
-
|
|
2236
|
+
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2237
|
+
cleanup(this);
|
|
2238
|
+
const currentWatcher = activeWatcher;
|
|
2239
|
+
activeWatcher = this;
|
|
2240
|
+
try {
|
|
2241
|
+
const args = [
|
|
2242
|
+
newValue,
|
|
2243
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2244
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2245
|
+
this.boundCleanup
|
|
2246
|
+
];
|
|
2247
|
+
call ? call(this.cb, 3, args) : (
|
|
2248
|
+
// @ts-expect-error
|
|
2249
|
+
this.cb(...args)
|
|
2250
|
+
);
|
|
2251
|
+
} finally {
|
|
2252
|
+
activeWatcher = currentWatcher;
|
|
2105
2253
|
}
|
|
2106
|
-
cleanupMap.delete(effect);
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
{
|
|
2110
|
-
effect.onTrack = options.onTrack;
|
|
2111
|
-
effect.onTrigger = options.onTrigger;
|
|
2112
|
-
}
|
|
2113
|
-
if (cb) {
|
|
2114
|
-
if (immediate) {
|
|
2115
|
-
job(true);
|
|
2116
|
-
} else {
|
|
2117
|
-
oldValue = effect.run();
|
|
2118
2254
|
}
|
|
2119
|
-
} else if (scheduler) {
|
|
2120
|
-
scheduler(job.bind(null, true), true);
|
|
2121
|
-
} else {
|
|
2122
|
-
effect.run();
|
|
2123
2255
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2256
|
+
}
|
|
2257
|
+
function reactiveGetter(source, deep) {
|
|
2258
|
+
if (deep) return source;
|
|
2259
|
+
if (isShallow(source) || deep === false || deep === 0)
|
|
2260
|
+
return traverse(source, 1);
|
|
2261
|
+
return traverse(source);
|
|
2262
|
+
}
|
|
2263
|
+
function warnInvalidSource(s, onWarn) {
|
|
2264
|
+
(onWarn || warn$2)(
|
|
2265
|
+
`Invalid watch source: `,
|
|
2266
|
+
s,
|
|
2267
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
2268
|
+
);
|
|
2128
2269
|
}
|
|
2129
2270
|
function traverse(value, depth = Infinity, seen) {
|
|
2130
2271
|
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
@@ -2160,8 +2301,8 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
2160
2301
|
}
|
|
2161
2302
|
|
|
2162
2303
|
const stack = [];
|
|
2163
|
-
function pushWarningContext(
|
|
2164
|
-
stack.push(
|
|
2304
|
+
function pushWarningContext(ctx) {
|
|
2305
|
+
stack.push(ctx);
|
|
2165
2306
|
}
|
|
2166
2307
|
function popWarningContext() {
|
|
2167
2308
|
stack.pop();
|
|
@@ -2170,8 +2311,9 @@ let isWarning = false;
|
|
|
2170
2311
|
function warn$1(msg, ...args) {
|
|
2171
2312
|
if (isWarning) return;
|
|
2172
2313
|
isWarning = true;
|
|
2173
|
-
|
|
2174
|
-
const
|
|
2314
|
+
const prevSub = setActiveSub();
|
|
2315
|
+
const entry = stack.length ? stack[stack.length - 1] : null;
|
|
2316
|
+
const instance = isVNode(entry) ? entry.component : entry;
|
|
2175
2317
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
2176
2318
|
const trace = getComponentTrace();
|
|
2177
2319
|
if (appWarnHandler) {
|
|
@@ -2185,9 +2327,9 @@ function warn$1(msg, ...args) {
|
|
|
2185
2327
|
var _a, _b;
|
|
2186
2328
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
2187
2329
|
}).join(""),
|
|
2188
|
-
instance && instance.proxy,
|
|
2330
|
+
instance && instance.proxy || instance,
|
|
2189
2331
|
trace.map(
|
|
2190
|
-
({
|
|
2332
|
+
({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
|
|
2191
2333
|
).join("\n"),
|
|
2192
2334
|
trace
|
|
2193
2335
|
]
|
|
@@ -2201,27 +2343,31 @@ function warn$1(msg, ...args) {
|
|
|
2201
2343
|
}
|
|
2202
2344
|
console.warn(...warnArgs);
|
|
2203
2345
|
}
|
|
2204
|
-
|
|
2346
|
+
setActiveSub(prevSub);
|
|
2205
2347
|
isWarning = false;
|
|
2206
2348
|
}
|
|
2207
2349
|
function getComponentTrace() {
|
|
2208
|
-
let
|
|
2209
|
-
if (!
|
|
2350
|
+
let currentCtx = stack[stack.length - 1];
|
|
2351
|
+
if (!currentCtx) {
|
|
2210
2352
|
return [];
|
|
2211
2353
|
}
|
|
2212
2354
|
const normalizedStack = [];
|
|
2213
|
-
while (
|
|
2355
|
+
while (currentCtx) {
|
|
2214
2356
|
const last = normalizedStack[0];
|
|
2215
|
-
if (last && last.
|
|
2357
|
+
if (last && last.ctx === currentCtx) {
|
|
2216
2358
|
last.recurseCount++;
|
|
2217
2359
|
} else {
|
|
2218
2360
|
normalizedStack.push({
|
|
2219
|
-
|
|
2361
|
+
ctx: currentCtx,
|
|
2220
2362
|
recurseCount: 0
|
|
2221
2363
|
});
|
|
2222
2364
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2365
|
+
if (isVNode(currentCtx)) {
|
|
2366
|
+
const parent = currentCtx.component && currentCtx.component.parent;
|
|
2367
|
+
currentCtx = parent && parent.vnode || parent;
|
|
2368
|
+
} else {
|
|
2369
|
+
currentCtx = currentCtx.parent;
|
|
2370
|
+
}
|
|
2225
2371
|
}
|
|
2226
2372
|
return normalizedStack;
|
|
2227
2373
|
}
|
|
@@ -2233,16 +2379,13 @@ function formatTrace(trace) {
|
|
|
2233
2379
|
});
|
|
2234
2380
|
return logs;
|
|
2235
2381
|
}
|
|
2236
|
-
function formatTraceEntry({
|
|
2382
|
+
function formatTraceEntry({ ctx, recurseCount }) {
|
|
2237
2383
|
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
2238
|
-
const
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
vnode.type,
|
|
2242
|
-
isRoot
|
|
2243
|
-
)}`;
|
|
2384
|
+
const instance = isVNode(ctx) ? ctx.component : ctx;
|
|
2385
|
+
const isRoot = instance ? instance.parent == null : false;
|
|
2386
|
+
const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
|
|
2244
2387
|
const close = `>` + postfix;
|
|
2245
|
-
return
|
|
2388
|
+
return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
|
|
2246
2389
|
}
|
|
2247
2390
|
function formatProps(props) {
|
|
2248
2391
|
const res = [];
|
|
@@ -2374,11 +2517,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
|
2374
2517
|
}
|
|
2375
2518
|
}
|
|
2376
2519
|
function handleError(err, instance, type, throwInDev = true) {
|
|
2377
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
2378
2520
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
2379
2521
|
if (instance) {
|
|
2380
2522
|
let cur = instance.parent;
|
|
2381
|
-
const exposedInstance = instance.proxy;
|
|
2523
|
+
const exposedInstance = instance.proxy || instance;
|
|
2382
2524
|
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
2383
2525
|
while (cur) {
|
|
2384
2526
|
const errorCapturedHooks = cur.ec;
|
|
@@ -2392,26 +2534,26 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
2392
2534
|
cur = cur.parent;
|
|
2393
2535
|
}
|
|
2394
2536
|
if (errorHandler) {
|
|
2395
|
-
|
|
2537
|
+
const prevSub = setActiveSub();
|
|
2396
2538
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
2397
2539
|
err,
|
|
2398
2540
|
exposedInstance,
|
|
2399
2541
|
errorInfo
|
|
2400
2542
|
]);
|
|
2401
|
-
|
|
2543
|
+
setActiveSub(prevSub);
|
|
2402
2544
|
return;
|
|
2403
2545
|
}
|
|
2404
2546
|
}
|
|
2405
|
-
logError(err, type,
|
|
2547
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
2406
2548
|
}
|
|
2407
|
-
function logError(err, type,
|
|
2549
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
2408
2550
|
{
|
|
2409
2551
|
const info = ErrorTypeStrings$1[type];
|
|
2410
|
-
if (
|
|
2411
|
-
pushWarningContext(
|
|
2552
|
+
if (instance) {
|
|
2553
|
+
pushWarningContext(instance);
|
|
2412
2554
|
}
|
|
2413
2555
|
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
2414
|
-
if (
|
|
2556
|
+
if (instance) {
|
|
2415
2557
|
popWarningContext();
|
|
2416
2558
|
}
|
|
2417
2559
|
if (throwInDev) {
|
|
@@ -2422,26 +2564,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
|
|
|
2422
2564
|
}
|
|
2423
2565
|
}
|
|
2424
2566
|
|
|
2425
|
-
const
|
|
2426
|
-
let
|
|
2427
|
-
|
|
2428
|
-
let
|
|
2567
|
+
const jobs = [];
|
|
2568
|
+
let postJobs = [];
|
|
2569
|
+
let activePostJobs = null;
|
|
2570
|
+
let currentFlushPromise = null;
|
|
2571
|
+
let jobsLength = 0;
|
|
2572
|
+
let flushIndex = 0;
|
|
2429
2573
|
let postFlushIndex = 0;
|
|
2430
2574
|
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
2431
|
-
let currentFlushPromise = null;
|
|
2432
2575
|
const RECURSION_LIMIT = 100;
|
|
2433
2576
|
function nextTick(fn) {
|
|
2434
2577
|
const p = currentFlushPromise || resolvedPromise;
|
|
2435
2578
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2436
2579
|
}
|
|
2437
|
-
function findInsertionIndex(
|
|
2438
|
-
let start = flushIndex + 1;
|
|
2439
|
-
let end = queue.length;
|
|
2580
|
+
function findInsertionIndex(order, queue, start, end) {
|
|
2440
2581
|
while (start < end) {
|
|
2441
2582
|
const middle = start + end >>> 1;
|
|
2442
|
-
|
|
2443
|
-
const middleJobId = getId(middleJob);
|
|
2444
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
2583
|
+
if (queue[middle].order <= order) {
|
|
2445
2584
|
start = middle + 1;
|
|
2446
2585
|
} else {
|
|
2447
2586
|
end = middle;
|
|
@@ -2449,130 +2588,168 @@ function findInsertionIndex(id) {
|
|
|
2449
2588
|
}
|
|
2450
2589
|
return start;
|
|
2451
2590
|
}
|
|
2452
|
-
function queueJob(job) {
|
|
2453
|
-
if (
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2591
|
+
function queueJob(job, id, isPre = false) {
|
|
2592
|
+
if (queueJobWorker(
|
|
2593
|
+
job,
|
|
2594
|
+
id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
|
|
2595
|
+
jobs,
|
|
2596
|
+
jobsLength,
|
|
2597
|
+
flushIndex
|
|
2598
|
+
)) {
|
|
2599
|
+
jobsLength++;
|
|
2600
|
+
queueFlush();
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
function queueJobWorker(job, order, queue, length, flushIndex2) {
|
|
2604
|
+
const flags = job.flags;
|
|
2605
|
+
if (!(flags & 1)) {
|
|
2606
|
+
job.flags = flags | 1;
|
|
2607
|
+
job.order = order;
|
|
2608
|
+
if (flushIndex2 === length || // fast path when the job id is larger than the tail
|
|
2609
|
+
order >= queue[length - 1].order) {
|
|
2610
|
+
queue[length] = job;
|
|
2459
2611
|
} else {
|
|
2460
|
-
queue.splice(findInsertionIndex(
|
|
2612
|
+
queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
|
|
2461
2613
|
}
|
|
2462
|
-
|
|
2463
|
-
queueFlush();
|
|
2614
|
+
return true;
|
|
2464
2615
|
}
|
|
2616
|
+
return false;
|
|
2465
2617
|
}
|
|
2618
|
+
const doFlushJobs = () => {
|
|
2619
|
+
try {
|
|
2620
|
+
flushJobs();
|
|
2621
|
+
} catch (e) {
|
|
2622
|
+
currentFlushPromise = null;
|
|
2623
|
+
throw e;
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2466
2626
|
function queueFlush() {
|
|
2467
2627
|
if (!currentFlushPromise) {
|
|
2468
|
-
currentFlushPromise = resolvedPromise.then(
|
|
2628
|
+
currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
2469
2629
|
}
|
|
2470
2630
|
}
|
|
2471
|
-
function queuePostFlushCb(
|
|
2472
|
-
if (!isArray(
|
|
2473
|
-
if (
|
|
2474
|
-
|
|
2475
|
-
} else
|
|
2476
|
-
|
|
2477
|
-
cb.flags |= 1;
|
|
2631
|
+
function queuePostFlushCb(jobs2, id = Infinity) {
|
|
2632
|
+
if (!isArray(jobs2)) {
|
|
2633
|
+
if (activePostJobs && id === -1) {
|
|
2634
|
+
activePostJobs.splice(postFlushIndex, 0, jobs2);
|
|
2635
|
+
} else {
|
|
2636
|
+
queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
|
|
2478
2637
|
}
|
|
2479
2638
|
} else {
|
|
2480
|
-
|
|
2639
|
+
for (const job of jobs2) {
|
|
2640
|
+
queueJobWorker(job, id, postJobs, postJobs.length, 0);
|
|
2641
|
+
}
|
|
2481
2642
|
}
|
|
2482
2643
|
queueFlush();
|
|
2483
2644
|
}
|
|
2484
|
-
function flushPreFlushCbs(instance, seen
|
|
2645
|
+
function flushPreFlushCbs(instance, seen) {
|
|
2485
2646
|
{
|
|
2486
2647
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2487
2648
|
}
|
|
2488
|
-
for (; i <
|
|
2489
|
-
const cb =
|
|
2490
|
-
if (cb
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2649
|
+
for (let i = flushIndex; i < jobsLength; i++) {
|
|
2650
|
+
const cb = jobs[i];
|
|
2651
|
+
if (cb.order & 1 || cb.order === Infinity) {
|
|
2652
|
+
continue;
|
|
2653
|
+
}
|
|
2654
|
+
if (instance && cb.order !== instance.uid * 2) {
|
|
2655
|
+
continue;
|
|
2656
|
+
}
|
|
2657
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
2658
|
+
continue;
|
|
2659
|
+
}
|
|
2660
|
+
jobs.splice(i, 1);
|
|
2661
|
+
i--;
|
|
2662
|
+
jobsLength--;
|
|
2663
|
+
if (cb.flags & 2) {
|
|
2664
|
+
cb.flags &= -2;
|
|
2665
|
+
}
|
|
2666
|
+
cb();
|
|
2667
|
+
if (!(cb.flags & 2)) {
|
|
2668
|
+
cb.flags &= -2;
|
|
2506
2669
|
}
|
|
2507
2670
|
}
|
|
2508
2671
|
}
|
|
2509
2672
|
function flushPostFlushCbs(seen) {
|
|
2510
|
-
if (
|
|
2511
|
-
|
|
2512
|
-
(
|
|
2513
|
-
|
|
2514
|
-
pendingPostFlushCbs.length = 0;
|
|
2515
|
-
if (activePostFlushCbs) {
|
|
2516
|
-
activePostFlushCbs.push(...deduped);
|
|
2673
|
+
if (postJobs.length) {
|
|
2674
|
+
if (activePostJobs) {
|
|
2675
|
+
activePostJobs.push(...postJobs);
|
|
2676
|
+
postJobs.length = 0;
|
|
2517
2677
|
return;
|
|
2518
2678
|
}
|
|
2519
|
-
|
|
2679
|
+
activePostJobs = postJobs;
|
|
2680
|
+
postJobs = [];
|
|
2520
2681
|
{
|
|
2521
2682
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2522
2683
|
}
|
|
2523
|
-
|
|
2524
|
-
const cb =
|
|
2684
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
2685
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
2525
2686
|
if (checkRecursiveUpdates(seen, cb)) {
|
|
2526
2687
|
continue;
|
|
2527
2688
|
}
|
|
2528
|
-
if (cb.flags &
|
|
2689
|
+
if (cb.flags & 2) {
|
|
2529
2690
|
cb.flags &= -2;
|
|
2530
2691
|
}
|
|
2531
|
-
if (!(cb.flags &
|
|
2532
|
-
|
|
2692
|
+
if (!(cb.flags & 4)) {
|
|
2693
|
+
try {
|
|
2694
|
+
cb();
|
|
2695
|
+
} finally {
|
|
2696
|
+
cb.flags &= -2;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2533
2699
|
}
|
|
2534
|
-
|
|
2700
|
+
activePostJobs = null;
|
|
2535
2701
|
postFlushIndex = 0;
|
|
2536
2702
|
}
|
|
2537
2703
|
}
|
|
2538
|
-
|
|
2704
|
+
let isFlushing = false;
|
|
2705
|
+
function flushOnAppMount() {
|
|
2706
|
+
if (!isFlushing) {
|
|
2707
|
+
isFlushing = true;
|
|
2708
|
+
flushPreFlushCbs();
|
|
2709
|
+
flushPostFlushCbs();
|
|
2710
|
+
isFlushing = false;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2539
2713
|
function flushJobs(seen) {
|
|
2540
2714
|
{
|
|
2541
|
-
seen
|
|
2715
|
+
seen || (seen = /* @__PURE__ */ new Map());
|
|
2542
2716
|
}
|
|
2543
|
-
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2544
2717
|
try {
|
|
2545
|
-
|
|
2546
|
-
const job =
|
|
2547
|
-
|
|
2548
|
-
|
|
2718
|
+
while (flushIndex < jobsLength) {
|
|
2719
|
+
const job = jobs[flushIndex];
|
|
2720
|
+
jobs[flushIndex++] = void 0;
|
|
2721
|
+
if (!(job.flags & 4)) {
|
|
2722
|
+
if (checkRecursiveUpdates(seen, job)) {
|
|
2549
2723
|
continue;
|
|
2550
2724
|
}
|
|
2551
|
-
if (job.flags &
|
|
2725
|
+
if (job.flags & 2) {
|
|
2552
2726
|
job.flags &= ~1;
|
|
2553
2727
|
}
|
|
2554
|
-
|
|
2555
|
-
job
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2728
|
+
try {
|
|
2729
|
+
job();
|
|
2730
|
+
} catch (err) {
|
|
2731
|
+
handleError(
|
|
2732
|
+
err,
|
|
2733
|
+
job.i,
|
|
2734
|
+
job.i ? 15 : 14
|
|
2735
|
+
);
|
|
2736
|
+
} finally {
|
|
2737
|
+
if (!(job.flags & 2)) {
|
|
2738
|
+
job.flags &= ~1;
|
|
2739
|
+
}
|
|
2561
2740
|
}
|
|
2562
2741
|
}
|
|
2563
2742
|
}
|
|
2564
2743
|
} finally {
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
job.flags &= -2;
|
|
2569
|
-
}
|
|
2744
|
+
while (flushIndex < jobsLength) {
|
|
2745
|
+
jobs[flushIndex].flags &= -2;
|
|
2746
|
+
jobs[flushIndex++] = void 0;
|
|
2570
2747
|
}
|
|
2571
|
-
flushIndex =
|
|
2572
|
-
|
|
2748
|
+
flushIndex = 0;
|
|
2749
|
+
jobsLength = 0;
|
|
2573
2750
|
flushPostFlushCbs(seen);
|
|
2574
2751
|
currentFlushPromise = null;
|
|
2575
|
-
if (
|
|
2752
|
+
if (jobsLength || postJobs.length) {
|
|
2576
2753
|
flushJobs(seen);
|
|
2577
2754
|
}
|
|
2578
2755
|
}
|
|
@@ -2639,10 +2816,17 @@ function rerender(id, newRender) {
|
|
|
2639
2816
|
instance.render = newRender;
|
|
2640
2817
|
normalizeClassComponent(instance.type).render = newRender;
|
|
2641
2818
|
}
|
|
2642
|
-
instance.renderCache = [];
|
|
2643
2819
|
isHmrUpdating = true;
|
|
2644
|
-
instance.
|
|
2645
|
-
|
|
2820
|
+
if (instance.vapor) {
|
|
2821
|
+
instance.hmrRerender();
|
|
2822
|
+
} else {
|
|
2823
|
+
const i = instance;
|
|
2824
|
+
i.renderCache = [];
|
|
2825
|
+
i.effect.run();
|
|
2826
|
+
}
|
|
2827
|
+
nextTick(() => {
|
|
2828
|
+
isHmrUpdating = false;
|
|
2829
|
+
});
|
|
2646
2830
|
});
|
|
2647
2831
|
}
|
|
2648
2832
|
function reload(id, newComp) {
|
|
@@ -2651,42 +2835,54 @@ function reload(id, newComp) {
|
|
|
2651
2835
|
newComp = normalizeClassComponent(newComp);
|
|
2652
2836
|
updateComponentDef(record.initialDef, newComp);
|
|
2653
2837
|
const instances = [...record.instances];
|
|
2654
|
-
|
|
2655
|
-
const instance
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
if (instance.ceReload) {
|
|
2838
|
+
if (newComp.vapor) {
|
|
2839
|
+
for (const instance of instances) {
|
|
2840
|
+
instance.hmrReload(newComp);
|
|
2841
|
+
}
|
|
2842
|
+
} else {
|
|
2843
|
+
for (const instance of instances) {
|
|
2844
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2845
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2846
|
+
if (!dirtyInstances) {
|
|
2847
|
+
if (oldComp !== record.initialDef) {
|
|
2848
|
+
updateComponentDef(oldComp, newComp);
|
|
2849
|
+
}
|
|
2850
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2851
|
+
}
|
|
2669
2852
|
dirtyInstances.add(instance);
|
|
2670
|
-
instance.
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
instance.
|
|
2676
|
-
isHmrUpdating = false;
|
|
2853
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2854
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2855
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2856
|
+
if (instance.ceReload) {
|
|
2857
|
+
dirtyInstances.add(instance);
|
|
2858
|
+
instance.ceReload(newComp.styles);
|
|
2677
2859
|
dirtyInstances.delete(instance);
|
|
2678
|
-
})
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2860
|
+
} else if (instance.parent) {
|
|
2861
|
+
queueJob(() => {
|
|
2862
|
+
isHmrUpdating = true;
|
|
2863
|
+
const parent = instance.parent;
|
|
2864
|
+
if (parent.vapor) {
|
|
2865
|
+
parent.hmrRerender();
|
|
2866
|
+
} else {
|
|
2867
|
+
parent.effect.run();
|
|
2868
|
+
}
|
|
2869
|
+
nextTick(() => {
|
|
2870
|
+
isHmrUpdating = false;
|
|
2871
|
+
});
|
|
2872
|
+
dirtyInstances.delete(instance);
|
|
2873
|
+
});
|
|
2874
|
+
} else if (instance.appContext.reload) {
|
|
2875
|
+
instance.appContext.reload();
|
|
2876
|
+
} else if (typeof window !== "undefined") {
|
|
2877
|
+
window.location.reload();
|
|
2878
|
+
} else {
|
|
2879
|
+
console.warn(
|
|
2880
|
+
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
2881
|
+
);
|
|
2882
|
+
}
|
|
2883
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
2884
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
2885
|
+
}
|
|
2690
2886
|
}
|
|
2691
2887
|
}
|
|
2692
2888
|
queuePostFlushCb(() => {
|
|
@@ -2899,14 +3095,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2899
3095
|
}
|
|
2900
3096
|
let hook = binding.dir[name];
|
|
2901
3097
|
if (hook) {
|
|
2902
|
-
|
|
3098
|
+
const prevSub = setActiveSub();
|
|
2903
3099
|
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2904
3100
|
vnode.el,
|
|
2905
3101
|
binding,
|
|
2906
3102
|
vnode,
|
|
2907
3103
|
prevVNode
|
|
2908
3104
|
]);
|
|
2909
|
-
|
|
3105
|
+
setActiveSub(prevSub);
|
|
2910
3106
|
}
|
|
2911
3107
|
}
|
|
2912
3108
|
}
|
|
@@ -3006,29 +3202,37 @@ const TeleportImpl = {
|
|
|
3006
3202
|
}
|
|
3007
3203
|
if (isTeleportDeferred(n2.props)) {
|
|
3008
3204
|
n2.el.__isMounted = false;
|
|
3009
|
-
queuePostRenderEffect(
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3205
|
+
queuePostRenderEffect(
|
|
3206
|
+
() => {
|
|
3207
|
+
mountToTarget();
|
|
3208
|
+
delete n2.el.__isMounted;
|
|
3209
|
+
},
|
|
3210
|
+
void 0,
|
|
3211
|
+
parentSuspense
|
|
3212
|
+
);
|
|
3013
3213
|
} else {
|
|
3014
3214
|
mountToTarget();
|
|
3015
3215
|
}
|
|
3016
3216
|
} else {
|
|
3017
3217
|
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
|
3018
|
-
queuePostRenderEffect(
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3218
|
+
queuePostRenderEffect(
|
|
3219
|
+
() => {
|
|
3220
|
+
TeleportImpl.process(
|
|
3221
|
+
n1,
|
|
3222
|
+
n2,
|
|
3223
|
+
container,
|
|
3224
|
+
anchor,
|
|
3225
|
+
parentComponent,
|
|
3226
|
+
parentSuspense,
|
|
3227
|
+
namespace,
|
|
3228
|
+
slotScopeIds,
|
|
3229
|
+
optimized,
|
|
3230
|
+
internals
|
|
3231
|
+
);
|
|
3232
|
+
},
|
|
3233
|
+
void 0,
|
|
3234
|
+
parentSuspense
|
|
3235
|
+
);
|
|
3032
3236
|
return;
|
|
3033
3237
|
}
|
|
3034
3238
|
n2.el = n1.el;
|
|
@@ -3075,6 +3279,7 @@ const TeleportImpl = {
|
|
|
3075
3279
|
container,
|
|
3076
3280
|
mainAnchor,
|
|
3077
3281
|
internals,
|
|
3282
|
+
parentComponent,
|
|
3078
3283
|
1
|
|
3079
3284
|
);
|
|
3080
3285
|
} else {
|
|
@@ -3094,6 +3299,7 @@ const TeleportImpl = {
|
|
|
3094
3299
|
nextTarget,
|
|
3095
3300
|
null,
|
|
3096
3301
|
internals,
|
|
3302
|
+
parentComponent,
|
|
3097
3303
|
0
|
|
3098
3304
|
);
|
|
3099
3305
|
} else {
|
|
@@ -3109,6 +3315,7 @@ const TeleportImpl = {
|
|
|
3109
3315
|
target,
|
|
3110
3316
|
targetAnchor,
|
|
3111
3317
|
internals,
|
|
3318
|
+
parentComponent,
|
|
3112
3319
|
1
|
|
3113
3320
|
);
|
|
3114
3321
|
}
|
|
@@ -3148,7 +3355,7 @@ const TeleportImpl = {
|
|
|
3148
3355
|
move: moveTeleport,
|
|
3149
3356
|
hydrate: hydrateTeleport
|
|
3150
3357
|
};
|
|
3151
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
3358
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
|
|
3152
3359
|
if (moveType === 0) {
|
|
3153
3360
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
3154
3361
|
}
|
|
@@ -3164,7 +3371,8 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
3164
3371
|
children[i],
|
|
3165
3372
|
container,
|
|
3166
3373
|
parentAnchor,
|
|
3167
|
-
2
|
|
3374
|
+
2,
|
|
3375
|
+
parentComponent
|
|
3168
3376
|
);
|
|
3169
3377
|
}
|
|
3170
3378
|
}
|
|
@@ -3349,7 +3557,7 @@ const BaseTransitionImpl = {
|
|
|
3349
3557
|
state.isLeaving = true;
|
|
3350
3558
|
leavingHooks.afterLeave = () => {
|
|
3351
3559
|
state.isLeaving = false;
|
|
3352
|
-
if (!(instance.job.flags &
|
|
3560
|
+
if (!(instance.job.flags & 4)) {
|
|
3353
3561
|
instance.update();
|
|
3354
3562
|
}
|
|
3355
3563
|
delete leavingHooks.afterLeave;
|
|
@@ -3628,7 +3836,7 @@ function defineComponent(options, extraOptions) {
|
|
|
3628
3836
|
}
|
|
3629
3837
|
|
|
3630
3838
|
function useId() {
|
|
3631
|
-
const i =
|
|
3839
|
+
const i = getCurrentGenericInstance();
|
|
3632
3840
|
if (i) {
|
|
3633
3841
|
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
3634
3842
|
} else {
|
|
@@ -3644,7 +3852,7 @@ function markAsyncBoundary(instance) {
|
|
|
3644
3852
|
|
|
3645
3853
|
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
3646
3854
|
function useTemplateRef(key) {
|
|
3647
|
-
const i =
|
|
3855
|
+
const i = getCurrentGenericInstance();
|
|
3648
3856
|
const r = shallowRef(null);
|
|
3649
3857
|
if (i) {
|
|
3650
3858
|
const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
@@ -3764,8 +3972,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3764
3972
|
}
|
|
3765
3973
|
};
|
|
3766
3974
|
if (value) {
|
|
3767
|
-
doSet
|
|
3768
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3975
|
+
queuePostRenderEffect(doSet, -1, parentSuspense);
|
|
3769
3976
|
} else {
|
|
3770
3977
|
doSet();
|
|
3771
3978
|
}
|
|
@@ -3933,6 +4140,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3933
4140
|
);
|
|
3934
4141
|
}
|
|
3935
4142
|
} else if (shapeFlag & 6) {
|
|
4143
|
+
if (vnode.type.__vapor) {
|
|
4144
|
+
throw new Error("Vapor component hydration is not supported yet.");
|
|
4145
|
+
}
|
|
3936
4146
|
vnode.slotScopeIds = slotScopeIds;
|
|
3937
4147
|
const container = parentNode(node);
|
|
3938
4148
|
if (isFragmentStart) {
|
|
@@ -4094,11 +4304,15 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4094
4304
|
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
4095
4305
|
}
|
|
4096
4306
|
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
4097
|
-
queueEffectWithSuspense(
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4307
|
+
queueEffectWithSuspense(
|
|
4308
|
+
() => {
|
|
4309
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
4310
|
+
needCallTransitionHooks && transition.enter(el);
|
|
4311
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
4312
|
+
},
|
|
4313
|
+
void 0,
|
|
4314
|
+
parentSuspense
|
|
4315
|
+
);
|
|
4102
4316
|
}
|
|
4103
4317
|
}
|
|
4104
4318
|
return el.nextSibling;
|
|
@@ -4378,14 +4592,16 @@ function resolveCssVars(instance, vnode, expectedMap) {
|
|
|
4378
4592
|
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
4379
4593
|
const cssVars = instance.getCssVars();
|
|
4380
4594
|
for (const key in cssVars) {
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
String(cssVars[key])
|
|
4384
|
-
);
|
|
4595
|
+
const value = normalizeCssVarValue(cssVars[key]);
|
|
4596
|
+
expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
|
|
4385
4597
|
}
|
|
4386
4598
|
}
|
|
4387
4599
|
if (vnode === root && instance.parent) {
|
|
4388
|
-
resolveCssVars(
|
|
4600
|
+
resolveCssVars(
|
|
4601
|
+
instance.parent,
|
|
4602
|
+
instance.vnode,
|
|
4603
|
+
expectedMap
|
|
4604
|
+
);
|
|
4389
4605
|
}
|
|
4390
4606
|
}
|
|
4391
4607
|
const allowMismatchAttr = "data-allow-mismatch";
|
|
@@ -4644,7 +4860,7 @@ function defineAsyncComponent(source) {
|
|
|
4644
4860
|
}
|
|
4645
4861
|
load().then(() => {
|
|
4646
4862
|
loaded.value = true;
|
|
4647
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4863
|
+
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
|
|
4648
4864
|
instance.parent.update();
|
|
4649
4865
|
}
|
|
4650
4866
|
}).catch((err) => {
|
|
@@ -4687,8 +4903,8 @@ const KeepAliveImpl = {
|
|
|
4687
4903
|
max: [String, Number]
|
|
4688
4904
|
},
|
|
4689
4905
|
setup(props, { slots }) {
|
|
4690
|
-
const
|
|
4691
|
-
const sharedContext =
|
|
4906
|
+
const keepAliveInstance = getCurrentInstance();
|
|
4907
|
+
const sharedContext = keepAliveInstance.ctx;
|
|
4692
4908
|
if (!sharedContext.renderer) {
|
|
4693
4909
|
return () => {
|
|
4694
4910
|
const children = slots.default && slots.default();
|
|
@@ -4699,9 +4915,9 @@ const KeepAliveImpl = {
|
|
|
4699
4915
|
const keys = /* @__PURE__ */ new Set();
|
|
4700
4916
|
let current = null;
|
|
4701
4917
|
{
|
|
4702
|
-
|
|
4918
|
+
keepAliveInstance.__v_cache = cache;
|
|
4703
4919
|
}
|
|
4704
|
-
const parentSuspense =
|
|
4920
|
+
const parentSuspense = keepAliveInstance.suspense;
|
|
4705
4921
|
const {
|
|
4706
4922
|
renderer: {
|
|
4707
4923
|
p: patch,
|
|
@@ -4712,58 +4928,80 @@ const KeepAliveImpl = {
|
|
|
4712
4928
|
} = sharedContext;
|
|
4713
4929
|
const storageContainer = createElement("div");
|
|
4714
4930
|
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
4715
|
-
const
|
|
4716
|
-
move(
|
|
4931
|
+
const instance = vnode.component;
|
|
4932
|
+
move(
|
|
4933
|
+
vnode,
|
|
4934
|
+
container,
|
|
4935
|
+
anchor,
|
|
4936
|
+
0,
|
|
4937
|
+
keepAliveInstance,
|
|
4938
|
+
parentSuspense
|
|
4939
|
+
);
|
|
4717
4940
|
patch(
|
|
4718
|
-
|
|
4941
|
+
instance.vnode,
|
|
4719
4942
|
vnode,
|
|
4720
4943
|
container,
|
|
4721
4944
|
anchor,
|
|
4722
|
-
|
|
4945
|
+
instance,
|
|
4723
4946
|
parentSuspense,
|
|
4724
4947
|
namespace,
|
|
4725
4948
|
vnode.slotScopeIds,
|
|
4726
4949
|
optimized
|
|
4727
4950
|
);
|
|
4728
|
-
queuePostRenderEffect(
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4951
|
+
queuePostRenderEffect(
|
|
4952
|
+
() => {
|
|
4953
|
+
instance.isDeactivated = false;
|
|
4954
|
+
if (instance.a) {
|
|
4955
|
+
invokeArrayFns(instance.a);
|
|
4956
|
+
}
|
|
4957
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
4958
|
+
if (vnodeHook) {
|
|
4959
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4960
|
+
}
|
|
4961
|
+
},
|
|
4962
|
+
void 0,
|
|
4963
|
+
parentSuspense
|
|
4964
|
+
);
|
|
4738
4965
|
{
|
|
4739
|
-
devtoolsComponentAdded(
|
|
4966
|
+
devtoolsComponentAdded(instance);
|
|
4740
4967
|
}
|
|
4741
4968
|
};
|
|
4742
4969
|
sharedContext.deactivate = (vnode) => {
|
|
4743
|
-
const
|
|
4744
|
-
invalidateMount(
|
|
4745
|
-
invalidateMount(
|
|
4746
|
-
move(
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4970
|
+
const instance = vnode.component;
|
|
4971
|
+
invalidateMount(instance.m);
|
|
4972
|
+
invalidateMount(instance.a);
|
|
4973
|
+
move(
|
|
4974
|
+
vnode,
|
|
4975
|
+
storageContainer,
|
|
4976
|
+
null,
|
|
4977
|
+
1,
|
|
4978
|
+
keepAliveInstance,
|
|
4979
|
+
parentSuspense
|
|
4980
|
+
);
|
|
4981
|
+
queuePostRenderEffect(
|
|
4982
|
+
() => {
|
|
4983
|
+
if (instance.da) {
|
|
4984
|
+
invokeArrayFns(instance.da);
|
|
4985
|
+
}
|
|
4986
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
4987
|
+
if (vnodeHook) {
|
|
4988
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4989
|
+
}
|
|
4990
|
+
instance.isDeactivated = true;
|
|
4991
|
+
},
|
|
4992
|
+
void 0,
|
|
4993
|
+
parentSuspense
|
|
4994
|
+
);
|
|
4757
4995
|
{
|
|
4758
|
-
devtoolsComponentAdded(
|
|
4996
|
+
devtoolsComponentAdded(instance);
|
|
4759
4997
|
}
|
|
4760
4998
|
{
|
|
4761
|
-
|
|
4999
|
+
instance.__keepAliveStorageContainer = storageContainer;
|
|
4762
5000
|
}
|
|
4763
5001
|
};
|
|
4764
5002
|
function unmount(vnode) {
|
|
4765
5003
|
resetShapeFlag(vnode);
|
|
4766
|
-
_unmount(vnode,
|
|
5004
|
+
_unmount(vnode, keepAliveInstance, parentSuspense, true);
|
|
4767
5005
|
}
|
|
4768
5006
|
function pruneCache(filter) {
|
|
4769
5007
|
cache.forEach((vnode, key) => {
|
|
@@ -4795,12 +5033,19 @@ const KeepAliveImpl = {
|
|
|
4795
5033
|
let pendingCacheKey = null;
|
|
4796
5034
|
const cacheSubtree = () => {
|
|
4797
5035
|
if (pendingCacheKey != null) {
|
|
4798
|
-
if (isSuspense(
|
|
4799
|
-
queuePostRenderEffect(
|
|
4800
|
-
|
|
4801
|
-
|
|
5036
|
+
if (isSuspense(keepAliveInstance.subTree.type)) {
|
|
5037
|
+
queuePostRenderEffect(
|
|
5038
|
+
() => {
|
|
5039
|
+
cache.set(
|
|
5040
|
+
pendingCacheKey,
|
|
5041
|
+
getInnerChild(keepAliveInstance.subTree)
|
|
5042
|
+
);
|
|
5043
|
+
},
|
|
5044
|
+
void 0,
|
|
5045
|
+
keepAliveInstance.subTree.suspense
|
|
5046
|
+
);
|
|
4802
5047
|
} else {
|
|
4803
|
-
cache.set(pendingCacheKey, getInnerChild(
|
|
5048
|
+
cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
4804
5049
|
}
|
|
4805
5050
|
}
|
|
4806
5051
|
};
|
|
@@ -4808,12 +5053,12 @@ const KeepAliveImpl = {
|
|
|
4808
5053
|
onUpdated(cacheSubtree);
|
|
4809
5054
|
onBeforeUnmount(() => {
|
|
4810
5055
|
cache.forEach((cached) => {
|
|
4811
|
-
const { subTree, suspense } =
|
|
5056
|
+
const { subTree, suspense } = keepAliveInstance;
|
|
4812
5057
|
const vnode = getInnerChild(subTree);
|
|
4813
5058
|
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
4814
5059
|
resetShapeFlag(vnode);
|
|
4815
5060
|
const da = vnode.component.da;
|
|
4816
|
-
da && queuePostRenderEffect(da, suspense);
|
|
5061
|
+
da && queuePostRenderEffect(da, void 0, suspense);
|
|
4817
5062
|
return;
|
|
4818
5063
|
}
|
|
4819
5064
|
unmount(cached);
|
|
@@ -4899,7 +5144,7 @@ function onActivated(hook, target) {
|
|
|
4899
5144
|
function onDeactivated(hook, target) {
|
|
4900
5145
|
registerKeepAliveHook(hook, "da", target);
|
|
4901
5146
|
}
|
|
4902
|
-
function registerKeepAliveHook(hook, type, target =
|
|
5147
|
+
function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
|
|
4903
5148
|
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
4904
5149
|
let current = target;
|
|
4905
5150
|
while (current) {
|
|
@@ -4913,7 +5158,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
4913
5158
|
injectHook(type, wrappedHook, target);
|
|
4914
5159
|
if (target) {
|
|
4915
5160
|
let current = target.parent;
|
|
4916
|
-
while (current && current.parent) {
|
|
5161
|
+
while (current && current.parent && current.parent.vnode) {
|
|
4917
5162
|
if (isKeepAlive(current.parent.vnode)) {
|
|
4918
5163
|
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4919
5164
|
}
|
|
@@ -4945,12 +5190,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4945
5190
|
if (target) {
|
|
4946
5191
|
const hooks = target[type] || (target[type] = []);
|
|
4947
5192
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
4948
|
-
|
|
4949
|
-
const
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
5193
|
+
const prevSub = setActiveSub();
|
|
5194
|
+
const prev = setCurrentInstance(target);
|
|
5195
|
+
try {
|
|
5196
|
+
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
5197
|
+
} finally {
|
|
5198
|
+
setCurrentInstance(...prev);
|
|
5199
|
+
setActiveSub(prevSub);
|
|
5200
|
+
}
|
|
4954
5201
|
});
|
|
4955
5202
|
if (prepend) {
|
|
4956
5203
|
hooks.unshift(wrappedHook);
|
|
@@ -5021,7 +5268,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
5021
5268
|
const res = (
|
|
5022
5269
|
// local registration
|
|
5023
5270
|
// check instance[type] first which is resolved for options API
|
|
5024
|
-
resolve(
|
|
5271
|
+
resolve(
|
|
5272
|
+
instance[type] || Component[type],
|
|
5273
|
+
name
|
|
5274
|
+
) || // global registration
|
|
5275
|
+
// @ts-expect-error filters only exist in compat mode
|
|
5025
5276
|
resolve(instance.appContext[type], name)
|
|
5026
5277
|
);
|
|
5027
5278
|
if (!res && maybeSelfReference) {
|
|
@@ -5115,7 +5366,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
5115
5366
|
}
|
|
5116
5367
|
|
|
5117
5368
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
5118
|
-
|
|
5369
|
+
let slot = slots[name];
|
|
5370
|
+
if (slot && slot.__vapor) {
|
|
5371
|
+
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
5372
|
+
ret.vs = { slot, fallback };
|
|
5373
|
+
return ret;
|
|
5374
|
+
}
|
|
5375
|
+
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
5119
5376
|
if (name !== "default") props.name = name;
|
|
5120
5377
|
return openBlock(), createBlock(
|
|
5121
5378
|
Fragment,
|
|
@@ -5124,7 +5381,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
5124
5381
|
64
|
|
5125
5382
|
);
|
|
5126
5383
|
}
|
|
5127
|
-
let slot = slots[name];
|
|
5128
5384
|
if (slot && slot.length > 1) {
|
|
5129
5385
|
warn$1(
|
|
5130
5386
|
`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.`
|
|
@@ -5179,8 +5435,9 @@ function toHandlers(obj, preserveCaseIfNecessary) {
|
|
|
5179
5435
|
}
|
|
5180
5436
|
|
|
5181
5437
|
const getPublicInstance = (i) => {
|
|
5182
|
-
if (!i) return null;
|
|
5183
|
-
if (isStatefulComponent(i))
|
|
5438
|
+
if (!i || i.vapor) return null;
|
|
5439
|
+
if (isStatefulComponent(i))
|
|
5440
|
+
return getComponentPublicInstance(i);
|
|
5184
5441
|
return getPublicInstance(i.parent);
|
|
5185
5442
|
};
|
|
5186
5443
|
const publicPropertiesMap = (
|
|
@@ -5473,11 +5730,16 @@ function useAttrs() {
|
|
|
5473
5730
|
return getContext().attrs;
|
|
5474
5731
|
}
|
|
5475
5732
|
function getContext() {
|
|
5476
|
-
const i =
|
|
5733
|
+
const i = getCurrentGenericInstance();
|
|
5477
5734
|
if (!i) {
|
|
5478
5735
|
warn$1(`useContext() called without active instance.`);
|
|
5479
5736
|
}
|
|
5480
|
-
|
|
5737
|
+
if (i.vapor) {
|
|
5738
|
+
return i;
|
|
5739
|
+
} else {
|
|
5740
|
+
const ii = i;
|
|
5741
|
+
return ii.setupContext || (ii.setupContext = createSetupContext(ii));
|
|
5742
|
+
}
|
|
5481
5743
|
}
|
|
5482
5744
|
function normalizePropsOrEmits(props) {
|
|
5483
5745
|
return isArray(props) ? props.reduce(
|
|
@@ -5525,14 +5787,14 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
5525
5787
|
return ret;
|
|
5526
5788
|
}
|
|
5527
5789
|
function withAsyncContext(getAwaitable) {
|
|
5528
|
-
const ctx =
|
|
5790
|
+
const ctx = getCurrentGenericInstance();
|
|
5529
5791
|
if (!ctx) {
|
|
5530
5792
|
warn$1(
|
|
5531
5793
|
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
5532
5794
|
);
|
|
5533
5795
|
}
|
|
5534
5796
|
let awaitable = getAwaitable();
|
|
5535
|
-
|
|
5797
|
+
setCurrentInstance(null, void 0);
|
|
5536
5798
|
if (isPromise(awaitable)) {
|
|
5537
5799
|
awaitable = awaitable.catch((e) => {
|
|
5538
5800
|
setCurrentInstance(ctx);
|
|
@@ -5979,7 +6241,7 @@ function createAppContext() {
|
|
|
5979
6241
|
};
|
|
5980
6242
|
}
|
|
5981
6243
|
let uid$1 = 0;
|
|
5982
|
-
function createAppAPI(
|
|
6244
|
+
function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
5983
6245
|
return function createApp(rootComponent, rootProps = null) {
|
|
5984
6246
|
if (!isFunction(rootComponent)) {
|
|
5985
6247
|
rootComponent = extend({}, rootComponent);
|
|
@@ -6072,33 +6334,15 @@ function createAppAPI(render, hydrate) {
|
|
|
6072
6334
|
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
6073
6335
|
);
|
|
6074
6336
|
}
|
|
6075
|
-
const
|
|
6076
|
-
vnode.appContext = context;
|
|
6077
|
-
if (namespace === true) {
|
|
6078
|
-
namespace = "svg";
|
|
6079
|
-
} else if (namespace === false) {
|
|
6080
|
-
namespace = void 0;
|
|
6081
|
-
}
|
|
6337
|
+
const instance = mount(app, rootContainer, isHydrate, namespace);
|
|
6082
6338
|
{
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
cloned.el = null;
|
|
6086
|
-
render(cloned, rootContainer, namespace);
|
|
6087
|
-
};
|
|
6088
|
-
}
|
|
6089
|
-
if (isHydrate && hydrate) {
|
|
6090
|
-
hydrate(vnode, rootContainer);
|
|
6091
|
-
} else {
|
|
6092
|
-
render(vnode, rootContainer, namespace);
|
|
6339
|
+
app._instance = instance;
|
|
6340
|
+
devtoolsInitApp(app, version);
|
|
6093
6341
|
}
|
|
6094
6342
|
isMounted = true;
|
|
6095
6343
|
app._container = rootContainer;
|
|
6096
6344
|
rootContainer.__vue_app__ = app;
|
|
6097
|
-
|
|
6098
|
-
app._instance = vnode.component;
|
|
6099
|
-
devtoolsInitApp(app, version);
|
|
6100
|
-
}
|
|
6101
|
-
return getComponentPublicInstance(vnode.component);
|
|
6345
|
+
return getPublicInstance(instance);
|
|
6102
6346
|
} else {
|
|
6103
6347
|
warn$1(
|
|
6104
6348
|
`App has already been mounted.
|
|
@@ -6121,7 +6365,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6121
6365
|
app._instance,
|
|
6122
6366
|
16
|
|
6123
6367
|
);
|
|
6124
|
-
|
|
6368
|
+
unmount(app);
|
|
6125
6369
|
{
|
|
6126
6370
|
app._instance = null;
|
|
6127
6371
|
devtoolsUnmountApp(app);
|
|
@@ -6162,6 +6406,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6162
6406
|
let currentApp = null;
|
|
6163
6407
|
|
|
6164
6408
|
function provide(key, value) {
|
|
6409
|
+
const currentInstance = getCurrentGenericInstance();
|
|
6165
6410
|
if (!currentInstance) {
|
|
6166
6411
|
{
|
|
6167
6412
|
warn$1(`provide() can only be used inside setup().`);
|
|
@@ -6176,9 +6421,9 @@ function provide(key, value) {
|
|
|
6176
6421
|
}
|
|
6177
6422
|
}
|
|
6178
6423
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
6179
|
-
const instance =
|
|
6424
|
+
const instance = getCurrentGenericInstance();
|
|
6180
6425
|
if (instance || currentApp) {
|
|
6181
|
-
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.
|
|
6426
|
+
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
|
|
6182
6427
|
if (provides && key in provides) {
|
|
6183
6428
|
return provides[key];
|
|
6184
6429
|
} else if (arguments.length > 1) {
|
|
@@ -6191,7 +6436,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
6191
6436
|
}
|
|
6192
6437
|
}
|
|
6193
6438
|
function hasInjectionContext() {
|
|
6194
|
-
return !!(
|
|
6439
|
+
return !!(getCurrentGenericInstance() || currentApp);
|
|
6195
6440
|
}
|
|
6196
6441
|
|
|
6197
6442
|
const internalObjectProto = {};
|
|
@@ -6199,7 +6444,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
|
|
|
6199
6444
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
6200
6445
|
|
|
6201
6446
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
6202
|
-
const props = {};
|
|
6447
|
+
const props = instance.props = {};
|
|
6203
6448
|
const attrs = createInternalObject();
|
|
6204
6449
|
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
6205
6450
|
setFullProps(instance, rawProps, props, attrs);
|
|
@@ -6209,7 +6454,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
|
6209
6454
|
}
|
|
6210
6455
|
}
|
|
6211
6456
|
{
|
|
6212
|
-
validateProps(rawProps || {}, props, instance);
|
|
6457
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6213
6458
|
}
|
|
6214
6459
|
if (isStateful) {
|
|
6215
6460
|
instance.props = isSSR ? props : shallowReactive(props);
|
|
@@ -6261,11 +6506,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6261
6506
|
const camelizedKey = camelize(key);
|
|
6262
6507
|
props[camelizedKey] = resolvePropValue(
|
|
6263
6508
|
options,
|
|
6264
|
-
rawCurrentProps,
|
|
6265
6509
|
camelizedKey,
|
|
6266
6510
|
value,
|
|
6267
6511
|
instance,
|
|
6268
|
-
|
|
6512
|
+
baseResolveDefault
|
|
6269
6513
|
);
|
|
6270
6514
|
}
|
|
6271
6515
|
} else {
|
|
@@ -6292,10 +6536,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6292
6536
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
6293
6537
|
props[key] = resolvePropValue(
|
|
6294
6538
|
options,
|
|
6295
|
-
rawCurrentProps,
|
|
6296
6539
|
key,
|
|
6297
6540
|
void 0,
|
|
6298
6541
|
instance,
|
|
6542
|
+
baseResolveDefault,
|
|
6299
6543
|
true
|
|
6300
6544
|
);
|
|
6301
6545
|
}
|
|
@@ -6317,7 +6561,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6317
6561
|
trigger(instance.attrs, "set", "");
|
|
6318
6562
|
}
|
|
6319
6563
|
{
|
|
6320
|
-
validateProps(rawProps || {}, props, instance);
|
|
6564
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6321
6565
|
}
|
|
6322
6566
|
}
|
|
6323
6567
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
@@ -6346,39 +6590,37 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
6346
6590
|
}
|
|
6347
6591
|
}
|
|
6348
6592
|
if (needCastKeys) {
|
|
6349
|
-
const rawCurrentProps = toRaw(props);
|
|
6350
6593
|
const castValues = rawCastValues || EMPTY_OBJ;
|
|
6351
6594
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
6352
6595
|
const key = needCastKeys[i];
|
|
6353
6596
|
props[key] = resolvePropValue(
|
|
6354
6597
|
options,
|
|
6355
|
-
rawCurrentProps,
|
|
6356
6598
|
key,
|
|
6357
6599
|
castValues[key],
|
|
6358
6600
|
instance,
|
|
6601
|
+
baseResolveDefault,
|
|
6359
6602
|
!hasOwn(castValues, key)
|
|
6360
6603
|
);
|
|
6361
6604
|
}
|
|
6362
6605
|
}
|
|
6363
6606
|
return hasAttrsChanged;
|
|
6364
6607
|
}
|
|
6365
|
-
function resolvePropValue(options,
|
|
6608
|
+
function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
|
|
6366
6609
|
const opt = options[key];
|
|
6367
6610
|
if (opt != null) {
|
|
6368
6611
|
const hasDefault = hasOwn(opt, "default");
|
|
6369
6612
|
if (hasDefault && value === void 0) {
|
|
6370
6613
|
const defaultValue = opt.default;
|
|
6371
6614
|
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
6372
|
-
const
|
|
6373
|
-
if (key
|
|
6374
|
-
value =
|
|
6615
|
+
const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
|
|
6616
|
+
if (hasOwn(cachedDefaults, key)) {
|
|
6617
|
+
value = cachedDefaults[key];
|
|
6375
6618
|
} else {
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6619
|
+
value = cachedDefaults[key] = resolveDefault(
|
|
6620
|
+
defaultValue,
|
|
6621
|
+
instance,
|
|
6622
|
+
key
|
|
6380
6623
|
);
|
|
6381
|
-
reset();
|
|
6382
6624
|
}
|
|
6383
6625
|
} else {
|
|
6384
6626
|
value = defaultValue;
|
|
@@ -6397,6 +6639,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
6397
6639
|
}
|
|
6398
6640
|
return value;
|
|
6399
6641
|
}
|
|
6642
|
+
function baseResolveDefault(factory, instance, key) {
|
|
6643
|
+
let value;
|
|
6644
|
+
const prev = setCurrentInstance(instance);
|
|
6645
|
+
const props = toRaw(instance.props);
|
|
6646
|
+
value = factory.call(
|
|
6647
|
+
null,
|
|
6648
|
+
props
|
|
6649
|
+
);
|
|
6650
|
+
setCurrentInstance(...prev);
|
|
6651
|
+
return value;
|
|
6652
|
+
}
|
|
6400
6653
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
6401
6654
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
6402
6655
|
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
@@ -6431,6 +6684,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6431
6684
|
}
|
|
6432
6685
|
return EMPTY_ARR;
|
|
6433
6686
|
}
|
|
6687
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
6688
|
+
const res = [normalized, needCastKeys];
|
|
6689
|
+
if (isObject(comp)) {
|
|
6690
|
+
cache.set(comp, res);
|
|
6691
|
+
}
|
|
6692
|
+
return res;
|
|
6693
|
+
}
|
|
6694
|
+
function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
|
|
6434
6695
|
if (isArray(raw)) {
|
|
6435
6696
|
for (let i = 0; i < raw.length; i++) {
|
|
6436
6697
|
if (!isString(raw[i])) {
|
|
@@ -6475,11 +6736,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6475
6736
|
}
|
|
6476
6737
|
}
|
|
6477
6738
|
}
|
|
6478
|
-
const res = [normalized, needCastKeys];
|
|
6479
|
-
if (isObject(comp)) {
|
|
6480
|
-
cache.set(comp, res);
|
|
6481
|
-
}
|
|
6482
|
-
return res;
|
|
6483
6739
|
}
|
|
6484
6740
|
function validatePropName(key) {
|
|
6485
6741
|
if (key[0] !== "$" && !isReservedProp(key)) {
|
|
@@ -6501,26 +6757,26 @@ function getType(ctor) {
|
|
|
6501
6757
|
}
|
|
6502
6758
|
return "";
|
|
6503
6759
|
}
|
|
6504
|
-
function validateProps(rawProps,
|
|
6505
|
-
|
|
6506
|
-
const options = instance.propsOptions[0];
|
|
6760
|
+
function validateProps(rawProps, resolvedProps, options) {
|
|
6761
|
+
resolvedProps = toRaw(resolvedProps);
|
|
6507
6762
|
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
|
6508
6763
|
for (const key in options) {
|
|
6509
|
-
|
|
6510
|
-
if (opt
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6764
|
+
const opt = options[key];
|
|
6765
|
+
if (opt != null) {
|
|
6766
|
+
validateProp(
|
|
6767
|
+
key,
|
|
6768
|
+
resolvedProps[key],
|
|
6769
|
+
opt,
|
|
6770
|
+
resolvedProps,
|
|
6771
|
+
!camelizePropsKey.includes(key)
|
|
6772
|
+
);
|
|
6773
|
+
}
|
|
6518
6774
|
}
|
|
6519
6775
|
}
|
|
6520
|
-
function validateProp(
|
|
6521
|
-
const { type, required, validator, skipCheck } =
|
|
6776
|
+
function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
|
|
6777
|
+
const { type, required, validator, skipCheck } = propOptions;
|
|
6522
6778
|
if (required && isAbsent) {
|
|
6523
|
-
warn$1('Missing required prop: "' +
|
|
6779
|
+
warn$1('Missing required prop: "' + key + '"');
|
|
6524
6780
|
return;
|
|
6525
6781
|
}
|
|
6526
6782
|
if (value == null && !required) {
|
|
@@ -6536,12 +6792,12 @@ function validateProp(name, value, prop, props, isAbsent) {
|
|
|
6536
6792
|
isValid = valid;
|
|
6537
6793
|
}
|
|
6538
6794
|
if (!isValid) {
|
|
6539
|
-
warn$1(getInvalidTypeMessage(
|
|
6795
|
+
warn$1(getInvalidTypeMessage(key, value, expectedTypes));
|
|
6540
6796
|
return;
|
|
6541
6797
|
}
|
|
6542
6798
|
}
|
|
6543
|
-
if (validator && !validator(value,
|
|
6544
|
-
warn$1('Invalid prop: custom validator check failed for prop "' +
|
|
6799
|
+
if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
|
|
6800
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
|
|
6545
6801
|
}
|
|
6546
6802
|
}
|
|
6547
6803
|
const isSimpleType = /* @__PURE__ */ makeMap(
|
|
@@ -6612,7 +6868,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
|
|
|
6612
6868
|
return rawSlot;
|
|
6613
6869
|
}
|
|
6614
6870
|
const normalized = withCtx((...args) => {
|
|
6615
|
-
if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6871
|
+
if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6616
6872
|
warn$1(
|
|
6617
6873
|
`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.`
|
|
6618
6874
|
);
|
|
@@ -6709,12 +6965,15 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6709
6965
|
|
|
6710
6966
|
let supported;
|
|
6711
6967
|
let perf;
|
|
6968
|
+
let cachedNow$1 = 0;
|
|
6969
|
+
const p$1 = /* @__PURE__ */ Promise.resolve();
|
|
6970
|
+
const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
|
|
6712
6971
|
function startMeasure(instance, type) {
|
|
6713
6972
|
if (instance.appContext.config.performance && isSupported()) {
|
|
6714
6973
|
perf.mark(`vue-${type}-${instance.uid}`);
|
|
6715
6974
|
}
|
|
6716
6975
|
{
|
|
6717
|
-
devtoolsPerfStart(instance, type,
|
|
6976
|
+
devtoolsPerfStart(instance, type, getNow$1());
|
|
6718
6977
|
}
|
|
6719
6978
|
}
|
|
6720
6979
|
function endMeasure(instance, type) {
|
|
@@ -6731,7 +6990,7 @@ function endMeasure(instance, type) {
|
|
|
6731
6990
|
perf.clearMarks(endTag);
|
|
6732
6991
|
}
|
|
6733
6992
|
{
|
|
6734
|
-
devtoolsPerfEnd(instance, type,
|
|
6993
|
+
devtoolsPerfEnd(instance, type, getNow$1());
|
|
6735
6994
|
}
|
|
6736
6995
|
}
|
|
6737
6996
|
function isSupported() {
|
|
@@ -6815,6 +7074,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6815
7074
|
optimized
|
|
6816
7075
|
);
|
|
6817
7076
|
break;
|
|
7077
|
+
case VaporSlot:
|
|
7078
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
|
|
7079
|
+
break;
|
|
6818
7080
|
default:
|
|
6819
7081
|
if (shapeFlag & 1) {
|
|
6820
7082
|
processElement(
|
|
@@ -7027,11 +7289,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7027
7289
|
}
|
|
7028
7290
|
hostInsert(el, container, anchor);
|
|
7029
7291
|
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
|
7030
|
-
queuePostRenderEffect(
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7292
|
+
queuePostRenderEffect(
|
|
7293
|
+
() => {
|
|
7294
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7295
|
+
needCallTransitionHooks && transition.enter(el);
|
|
7296
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
7297
|
+
},
|
|
7298
|
+
void 0,
|
|
7299
|
+
parentSuspense
|
|
7300
|
+
);
|
|
7035
7301
|
}
|
|
7036
7302
|
};
|
|
7037
7303
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
@@ -7043,8 +7309,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7043
7309
|
hostSetScopeId(el, slotScopeIds[i]);
|
|
7044
7310
|
}
|
|
7045
7311
|
}
|
|
7046
|
-
|
|
7047
|
-
|
|
7312
|
+
let subTree = parentComponent && parentComponent.subTree;
|
|
7313
|
+
if (subTree) {
|
|
7048
7314
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
7049
7315
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
7050
7316
|
}
|
|
@@ -7161,10 +7427,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7161
7427
|
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
7162
7428
|
}
|
|
7163
7429
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
7164
|
-
queuePostRenderEffect(
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7430
|
+
queuePostRenderEffect(
|
|
7431
|
+
() => {
|
|
7432
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
7433
|
+
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
7434
|
+
},
|
|
7435
|
+
void 0,
|
|
7436
|
+
parentSuspense
|
|
7437
|
+
);
|
|
7168
7438
|
}
|
|
7169
7439
|
};
|
|
7170
7440
|
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
|
@@ -7292,7 +7562,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7292
7562
|
};
|
|
7293
7563
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
7294
7564
|
n2.slotScopeIds = slotScopeIds;
|
|
7295
|
-
if (
|
|
7565
|
+
if (n2.type.__vapor) {
|
|
7566
|
+
if (n1 == null) {
|
|
7567
|
+
getVaporInterface(parentComponent, n2).mount(
|
|
7568
|
+
n2,
|
|
7569
|
+
container,
|
|
7570
|
+
anchor,
|
|
7571
|
+
parentComponent
|
|
7572
|
+
);
|
|
7573
|
+
} else {
|
|
7574
|
+
getVaporInterface(parentComponent, n2).update(
|
|
7575
|
+
n1,
|
|
7576
|
+
n2,
|
|
7577
|
+
shouldUpdateComponent(n1, n2, optimized)
|
|
7578
|
+
);
|
|
7579
|
+
}
|
|
7580
|
+
} else if (n1 == null) {
|
|
7296
7581
|
if (n2.shapeFlag & 512) {
|
|
7297
7582
|
parentComponent.ctx.activate(
|
|
7298
7583
|
n2,
|
|
@@ -7378,15 +7663,52 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7378
7663
|
return;
|
|
7379
7664
|
} else {
|
|
7380
7665
|
instance.next = n2;
|
|
7381
|
-
instance.
|
|
7666
|
+
instance.effect.run();
|
|
7382
7667
|
}
|
|
7383
7668
|
} else {
|
|
7384
7669
|
n2.el = n1.el;
|
|
7385
7670
|
instance.vnode = n2;
|
|
7386
7671
|
}
|
|
7387
7672
|
};
|
|
7388
|
-
|
|
7389
|
-
|
|
7673
|
+
class SetupRenderEffect extends ReactiveEffect {
|
|
7674
|
+
constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
|
|
7675
|
+
const prevScope = setCurrentScope(instance.scope);
|
|
7676
|
+
super();
|
|
7677
|
+
this.instance = instance;
|
|
7678
|
+
this.initialVNode = initialVNode;
|
|
7679
|
+
this.container = container;
|
|
7680
|
+
this.anchor = anchor;
|
|
7681
|
+
this.parentSuspense = parentSuspense;
|
|
7682
|
+
this.namespace = namespace;
|
|
7683
|
+
this.optimized = optimized;
|
|
7684
|
+
setCurrentScope(prevScope);
|
|
7685
|
+
this.job = instance.job = () => {
|
|
7686
|
+
if (this.dirty) {
|
|
7687
|
+
this.run();
|
|
7688
|
+
}
|
|
7689
|
+
};
|
|
7690
|
+
this.job.i = instance;
|
|
7691
|
+
{
|
|
7692
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7693
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
notify() {
|
|
7697
|
+
if (!(this.flags & 256)) {
|
|
7698
|
+
const job = this.job;
|
|
7699
|
+
queueJob(job, job.i.uid);
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
fn() {
|
|
7703
|
+
const {
|
|
7704
|
+
instance,
|
|
7705
|
+
initialVNode,
|
|
7706
|
+
container,
|
|
7707
|
+
anchor,
|
|
7708
|
+
parentSuspense,
|
|
7709
|
+
namespace,
|
|
7710
|
+
optimized
|
|
7711
|
+
} = this;
|
|
7390
7712
|
if (!instance.isMounted) {
|
|
7391
7713
|
let vnodeHook;
|
|
7392
7714
|
const { el, props } = initialVNode;
|
|
@@ -7462,23 +7784,24 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7462
7784
|
initialVNode.el = subTree.el;
|
|
7463
7785
|
}
|
|
7464
7786
|
if (m) {
|
|
7465
|
-
queuePostRenderEffect(m, parentSuspense);
|
|
7787
|
+
queuePostRenderEffect(m, void 0, parentSuspense);
|
|
7466
7788
|
}
|
|
7467
7789
|
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
|
7468
7790
|
const scopedInitialVNode = initialVNode;
|
|
7469
7791
|
queuePostRenderEffect(
|
|
7470
7792
|
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
|
7793
|
+
void 0,
|
|
7471
7794
|
parentSuspense
|
|
7472
7795
|
);
|
|
7473
7796
|
}
|
|
7474
|
-
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7475
|
-
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7797
|
+
if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7798
|
+
instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
|
|
7476
7799
|
}
|
|
7477
7800
|
instance.isMounted = true;
|
|
7478
7801
|
{
|
|
7479
7802
|
devtoolsComponentAdded(instance);
|
|
7480
7803
|
}
|
|
7481
|
-
initialVNode = container = anchor = null;
|
|
7804
|
+
this.initialVNode = this.container = this.anchor = null;
|
|
7482
7805
|
} else {
|
|
7483
7806
|
let { next, bu, u, parent, vnode } = instance;
|
|
7484
7807
|
{
|
|
@@ -7490,7 +7813,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7490
7813
|
}
|
|
7491
7814
|
nonHydratedAsyncRoot.asyncDep.then(() => {
|
|
7492
7815
|
if (!instance.isUnmounted) {
|
|
7493
|
-
|
|
7816
|
+
this.fn();
|
|
7494
7817
|
}
|
|
7495
7818
|
});
|
|
7496
7819
|
return;
|
|
@@ -7546,11 +7869,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7546
7869
|
updateHOCHostEl(instance, nextTree.el);
|
|
7547
7870
|
}
|
|
7548
7871
|
if (u) {
|
|
7549
|
-
queuePostRenderEffect(u, parentSuspense);
|
|
7872
|
+
queuePostRenderEffect(u, void 0, parentSuspense);
|
|
7550
7873
|
}
|
|
7551
7874
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
7552
7875
|
queuePostRenderEffect(
|
|
7553
7876
|
() => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
|
7877
|
+
void 0,
|
|
7554
7878
|
parentSuspense
|
|
7555
7879
|
);
|
|
7556
7880
|
}
|
|
@@ -7561,21 +7885,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7561
7885
|
popWarningContext();
|
|
7562
7886
|
}
|
|
7563
7887
|
}
|
|
7564
|
-
};
|
|
7565
|
-
instance.scope.on();
|
|
7566
|
-
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7567
|
-
instance.scope.off();
|
|
7568
|
-
const update = instance.update = effect.run.bind(effect);
|
|
7569
|
-
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7570
|
-
job.i = instance;
|
|
7571
|
-
job.id = instance.uid;
|
|
7572
|
-
effect.scheduler = () => queueJob(job);
|
|
7573
|
-
toggleRecurse(instance, true);
|
|
7574
|
-
{
|
|
7575
|
-
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7576
|
-
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7577
7888
|
}
|
|
7578
|
-
|
|
7889
|
+
}
|
|
7890
|
+
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
|
7891
|
+
const effect = instance.effect = new SetupRenderEffect(
|
|
7892
|
+
instance,
|
|
7893
|
+
initialVNode,
|
|
7894
|
+
container,
|
|
7895
|
+
anchor,
|
|
7896
|
+
parentSuspense,
|
|
7897
|
+
namespace,
|
|
7898
|
+
optimized
|
|
7899
|
+
);
|
|
7900
|
+
instance.update = effect.run.bind(effect);
|
|
7901
|
+
toggleRecurse(instance, true);
|
|
7902
|
+
effect.run();
|
|
7579
7903
|
};
|
|
7580
7904
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
7581
7905
|
nextVNode.component = instance;
|
|
@@ -7584,9 +7908,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7584
7908
|
instance.next = null;
|
|
7585
7909
|
updateProps(instance, nextVNode.props, prevProps, optimized);
|
|
7586
7910
|
updateSlots(instance, nextVNode.children, optimized);
|
|
7587
|
-
|
|
7911
|
+
const prevSub = setActiveSub();
|
|
7588
7912
|
flushPreFlushCbs(instance);
|
|
7589
|
-
|
|
7913
|
+
setActiveSub(prevSub);
|
|
7590
7914
|
};
|
|
7591
7915
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
|
7592
7916
|
const c1 = n1 && n1.children;
|
|
@@ -7863,7 +8187,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7863
8187
|
);
|
|
7864
8188
|
} else if (moved) {
|
|
7865
8189
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7866
|
-
move(
|
|
8190
|
+
move(
|
|
8191
|
+
nextChild,
|
|
8192
|
+
container,
|
|
8193
|
+
anchor,
|
|
8194
|
+
2,
|
|
8195
|
+
parentComponent
|
|
8196
|
+
);
|
|
7867
8197
|
} else {
|
|
7868
8198
|
j--;
|
|
7869
8199
|
}
|
|
@@ -7871,10 +8201,20 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7871
8201
|
}
|
|
7872
8202
|
}
|
|
7873
8203
|
};
|
|
7874
|
-
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
8204
|
+
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
7875
8205
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7876
8206
|
if (shapeFlag & 6) {
|
|
7877
|
-
|
|
8207
|
+
if (type.__vapor) {
|
|
8208
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
|
|
8209
|
+
} else {
|
|
8210
|
+
move(
|
|
8211
|
+
vnode.component.subTree,
|
|
8212
|
+
container,
|
|
8213
|
+
anchor,
|
|
8214
|
+
moveType,
|
|
8215
|
+
parentComponent
|
|
8216
|
+
);
|
|
8217
|
+
}
|
|
7878
8218
|
return;
|
|
7879
8219
|
}
|
|
7880
8220
|
if (shapeFlag & 128) {
|
|
@@ -7882,13 +8222,25 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7882
8222
|
return;
|
|
7883
8223
|
}
|
|
7884
8224
|
if (shapeFlag & 64) {
|
|
7885
|
-
type.move(
|
|
8225
|
+
type.move(
|
|
8226
|
+
vnode,
|
|
8227
|
+
container,
|
|
8228
|
+
anchor,
|
|
8229
|
+
internals,
|
|
8230
|
+
parentComponent
|
|
8231
|
+
);
|
|
7886
8232
|
return;
|
|
7887
8233
|
}
|
|
7888
8234
|
if (type === Fragment) {
|
|
7889
8235
|
hostInsert(el, container, anchor);
|
|
7890
8236
|
for (let i = 0; i < children.length; i++) {
|
|
7891
|
-
move(
|
|
8237
|
+
move(
|
|
8238
|
+
children[i],
|
|
8239
|
+
container,
|
|
8240
|
+
anchor,
|
|
8241
|
+
moveType,
|
|
8242
|
+
parentComponent
|
|
8243
|
+
);
|
|
7892
8244
|
}
|
|
7893
8245
|
hostInsert(vnode.anchor, container, anchor);
|
|
7894
8246
|
return;
|
|
@@ -7902,7 +8254,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7902
8254
|
if (moveType === 0) {
|
|
7903
8255
|
transition.beforeEnter(el);
|
|
7904
8256
|
hostInsert(el, container, anchor);
|
|
7905
|
-
queuePostRenderEffect(
|
|
8257
|
+
queuePostRenderEffect(
|
|
8258
|
+
() => transition.enter(el),
|
|
8259
|
+
void 0,
|
|
8260
|
+
parentSuspense
|
|
8261
|
+
);
|
|
7906
8262
|
} else {
|
|
7907
8263
|
const { leave, delayLeave, afterLeave } = transition;
|
|
7908
8264
|
const remove2 = () => {
|
|
@@ -7944,9 +8300,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7944
8300
|
optimized = false;
|
|
7945
8301
|
}
|
|
7946
8302
|
if (ref != null) {
|
|
7947
|
-
|
|
8303
|
+
const prevSub = setActiveSub();
|
|
7948
8304
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7949
|
-
|
|
8305
|
+
setActiveSub(prevSub);
|
|
7950
8306
|
}
|
|
7951
8307
|
if (cacheIndex != null) {
|
|
7952
8308
|
parentComponent.renderCache[cacheIndex] = void 0;
|
|
@@ -7962,7 +8318,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7962
8318
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7963
8319
|
}
|
|
7964
8320
|
if (shapeFlag & 6) {
|
|
7965
|
-
|
|
8321
|
+
if (type.__vapor) {
|
|
8322
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8323
|
+
return;
|
|
8324
|
+
} else {
|
|
8325
|
+
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
8326
|
+
}
|
|
7966
8327
|
} else {
|
|
7967
8328
|
if (shapeFlag & 128) {
|
|
7968
8329
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -7996,15 +8357,23 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7996
8357
|
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
|
7997
8358
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7998
8359
|
}
|
|
8360
|
+
if (type === VaporSlot) {
|
|
8361
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8362
|
+
return;
|
|
8363
|
+
}
|
|
7999
8364
|
if (doRemove) {
|
|
8000
8365
|
remove(vnode);
|
|
8001
8366
|
}
|
|
8002
8367
|
}
|
|
8003
8368
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
|
8004
|
-
queuePostRenderEffect(
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8369
|
+
queuePostRenderEffect(
|
|
8370
|
+
() => {
|
|
8371
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
8372
|
+
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
8373
|
+
},
|
|
8374
|
+
void 0,
|
|
8375
|
+
parentSuspense
|
|
8376
|
+
);
|
|
8008
8377
|
}
|
|
8009
8378
|
};
|
|
8010
8379
|
const remove = (vnode) => {
|
|
@@ -8061,7 +8430,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8061
8430
|
const {
|
|
8062
8431
|
bum,
|
|
8063
8432
|
scope,
|
|
8064
|
-
|
|
8433
|
+
effect,
|
|
8065
8434
|
subTree,
|
|
8066
8435
|
um,
|
|
8067
8436
|
m,
|
|
@@ -8080,16 +8449,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8080
8449
|
});
|
|
8081
8450
|
}
|
|
8082
8451
|
scope.stop();
|
|
8083
|
-
if (
|
|
8084
|
-
|
|
8452
|
+
if (effect) {
|
|
8453
|
+
effect.stop();
|
|
8085
8454
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8086
8455
|
}
|
|
8087
8456
|
if (um) {
|
|
8088
|
-
queuePostRenderEffect(um, parentSuspense);
|
|
8457
|
+
queuePostRenderEffect(um, void 0, parentSuspense);
|
|
8089
8458
|
}
|
|
8090
|
-
queuePostRenderEffect(
|
|
8091
|
-
instance.isUnmounted = true
|
|
8092
|
-
|
|
8459
|
+
queuePostRenderEffect(
|
|
8460
|
+
() => instance.isUnmounted = true,
|
|
8461
|
+
void 0,
|
|
8462
|
+
parentSuspense
|
|
8463
|
+
);
|
|
8093
8464
|
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
|
8094
8465
|
parentSuspense.deps--;
|
|
8095
8466
|
if (parentSuspense.deps === 0) {
|
|
@@ -8107,6 +8478,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8107
8478
|
};
|
|
8108
8479
|
const getNextHostNode = (vnode) => {
|
|
8109
8480
|
if (vnode.shapeFlag & 6) {
|
|
8481
|
+
if (vnode.type.__vapor) {
|
|
8482
|
+
return hostNextSibling(vnode.component.block);
|
|
8483
|
+
}
|
|
8110
8484
|
return getNextHostNode(vnode.component.subTree);
|
|
8111
8485
|
}
|
|
8112
8486
|
if (vnode.shapeFlag & 128) {
|
|
@@ -8116,7 +8490,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8116
8490
|
const teleportEnd = el && el[TeleportEndKey];
|
|
8117
8491
|
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
8118
8492
|
};
|
|
8119
|
-
let isFlushing = false;
|
|
8120
8493
|
const render = (vnode, container, namespace) => {
|
|
8121
8494
|
if (vnode == null) {
|
|
8122
8495
|
if (container._vnode) {
|
|
@@ -8133,13 +8506,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8133
8506
|
namespace
|
|
8134
8507
|
);
|
|
8135
8508
|
}
|
|
8136
|
-
container._vnode = vnode;
|
|
8137
|
-
|
|
8138
|
-
isFlushing = true;
|
|
8139
|
-
flushPreFlushCbs();
|
|
8140
|
-
flushPostFlushCbs();
|
|
8141
|
-
isFlushing = false;
|
|
8142
|
-
}
|
|
8509
|
+
container._vnode = vnode;
|
|
8510
|
+
flushOnAppMount();
|
|
8143
8511
|
};
|
|
8144
8512
|
const internals = {
|
|
8145
8513
|
p: patch,
|
|
@@ -8147,6 +8515,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8147
8515
|
m: move,
|
|
8148
8516
|
r: remove,
|
|
8149
8517
|
mt: mountComponent,
|
|
8518
|
+
umt: unmountComponent,
|
|
8150
8519
|
mc: mountChildren,
|
|
8151
8520
|
pc: patchChildren,
|
|
8152
8521
|
pbc: patchBlockChildren,
|
|
@@ -8160,22 +8529,53 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8160
8529
|
internals
|
|
8161
8530
|
);
|
|
8162
8531
|
}
|
|
8532
|
+
const mountApp = (app, container, isHydrate, namespace) => {
|
|
8533
|
+
const vnode = app._ceVNode || createVNode(app._component, app._props);
|
|
8534
|
+
vnode.appContext = app._context;
|
|
8535
|
+
if (namespace === true) {
|
|
8536
|
+
namespace = "svg";
|
|
8537
|
+
} else if (namespace === false) {
|
|
8538
|
+
namespace = void 0;
|
|
8539
|
+
}
|
|
8540
|
+
{
|
|
8541
|
+
app._context.reload = () => {
|
|
8542
|
+
const cloned = cloneVNode(vnode);
|
|
8543
|
+
cloned.el = null;
|
|
8544
|
+
render(cloned, container, namespace);
|
|
8545
|
+
};
|
|
8546
|
+
}
|
|
8547
|
+
if (isHydrate && hydrate) {
|
|
8548
|
+
hydrate(vnode, container);
|
|
8549
|
+
} else {
|
|
8550
|
+
render(vnode, container, namespace);
|
|
8551
|
+
}
|
|
8552
|
+
return vnode.component;
|
|
8553
|
+
};
|
|
8554
|
+
const unmountApp = (app) => {
|
|
8555
|
+
render(null, app._container);
|
|
8556
|
+
};
|
|
8163
8557
|
return {
|
|
8164
8558
|
render,
|
|
8165
8559
|
hydrate,
|
|
8166
|
-
|
|
8560
|
+
internals,
|
|
8561
|
+
createApp: createAppAPI(
|
|
8562
|
+
mountApp,
|
|
8563
|
+
unmountApp,
|
|
8564
|
+
getComponentPublicInstance)
|
|
8167
8565
|
};
|
|
8168
8566
|
}
|
|
8169
8567
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8170
8568
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8171
8569
|
}
|
|
8172
|
-
function toggleRecurse({ effect, job }, allowed) {
|
|
8173
|
-
if (
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8570
|
+
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
8571
|
+
if (!vapor) {
|
|
8572
|
+
if (allowed) {
|
|
8573
|
+
effect.flags |= 128;
|
|
8574
|
+
job.flags |= 2;
|
|
8575
|
+
} else {
|
|
8576
|
+
effect.flags &= -129;
|
|
8577
|
+
job.flags &= -3;
|
|
8578
|
+
}
|
|
8179
8579
|
}
|
|
8180
8580
|
}
|
|
8181
8581
|
function needTransition(parentSuspense, transition) {
|
|
@@ -8208,46 +8608,6 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
8208
8608
|
}
|
|
8209
8609
|
}
|
|
8210
8610
|
}
|
|
8211
|
-
function getSequence(arr) {
|
|
8212
|
-
const p = arr.slice();
|
|
8213
|
-
const result = [0];
|
|
8214
|
-
let i, j, u, v, c;
|
|
8215
|
-
const len = arr.length;
|
|
8216
|
-
for (i = 0; i < len; i++) {
|
|
8217
|
-
const arrI = arr[i];
|
|
8218
|
-
if (arrI !== 0) {
|
|
8219
|
-
j = result[result.length - 1];
|
|
8220
|
-
if (arr[j] < arrI) {
|
|
8221
|
-
p[i] = j;
|
|
8222
|
-
result.push(i);
|
|
8223
|
-
continue;
|
|
8224
|
-
}
|
|
8225
|
-
u = 0;
|
|
8226
|
-
v = result.length - 1;
|
|
8227
|
-
while (u < v) {
|
|
8228
|
-
c = u + v >> 1;
|
|
8229
|
-
if (arr[result[c]] < arrI) {
|
|
8230
|
-
u = c + 1;
|
|
8231
|
-
} else {
|
|
8232
|
-
v = c;
|
|
8233
|
-
}
|
|
8234
|
-
}
|
|
8235
|
-
if (arrI < arr[result[u]]) {
|
|
8236
|
-
if (u > 0) {
|
|
8237
|
-
p[i] = result[u - 1];
|
|
8238
|
-
}
|
|
8239
|
-
result[u] = i;
|
|
8240
|
-
}
|
|
8241
|
-
}
|
|
8242
|
-
}
|
|
8243
|
-
u = result.length;
|
|
8244
|
-
v = result[u - 1];
|
|
8245
|
-
while (u-- > 0) {
|
|
8246
|
-
result[u] = v;
|
|
8247
|
-
v = p[v];
|
|
8248
|
-
}
|
|
8249
|
-
return result;
|
|
8250
|
-
}
|
|
8251
8611
|
function locateNonHydratedAsyncRoot(instance) {
|
|
8252
8612
|
const subComponent = instance.subTree.component;
|
|
8253
8613
|
if (subComponent) {
|
|
@@ -8261,8 +8621,22 @@ function locateNonHydratedAsyncRoot(instance) {
|
|
|
8261
8621
|
function invalidateMount(hooks) {
|
|
8262
8622
|
if (hooks) {
|
|
8263
8623
|
for (let i = 0; i < hooks.length; i++)
|
|
8264
|
-
hooks[i].flags |=
|
|
8624
|
+
hooks[i].flags |= 4;
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
function getVaporInterface(instance, vnode) {
|
|
8628
|
+
const ctx = instance ? instance.appContext : vnode.appContext;
|
|
8629
|
+
const res = ctx && ctx.vapor;
|
|
8630
|
+
if (!res) {
|
|
8631
|
+
warn$1(
|
|
8632
|
+
`Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
|
|
8633
|
+
\`\`\`
|
|
8634
|
+
import { vaporInteropPlugin } from 'vue'
|
|
8635
|
+
app.use(vaporInteropPlugin)
|
|
8636
|
+
\`\`\``
|
|
8637
|
+
);
|
|
8265
8638
|
}
|
|
8639
|
+
return res;
|
|
8266
8640
|
}
|
|
8267
8641
|
|
|
8268
8642
|
const ssrContextKey = Symbol.for("v-scx");
|
|
@@ -8303,8 +8677,41 @@ function watch(source, cb, options) {
|
|
|
8303
8677
|
}
|
|
8304
8678
|
return doWatch(source, cb, options);
|
|
8305
8679
|
}
|
|
8680
|
+
class RenderWatcherEffect extends WatcherEffect {
|
|
8681
|
+
constructor(instance, source, cb, options, flush) {
|
|
8682
|
+
super(source, cb, options);
|
|
8683
|
+
this.flush = flush;
|
|
8684
|
+
const job = () => {
|
|
8685
|
+
if (this.dirty) {
|
|
8686
|
+
this.run();
|
|
8687
|
+
}
|
|
8688
|
+
};
|
|
8689
|
+
if (cb) {
|
|
8690
|
+
this.flags |= 128;
|
|
8691
|
+
job.flags |= 2;
|
|
8692
|
+
}
|
|
8693
|
+
if (instance) {
|
|
8694
|
+
job.i = instance;
|
|
8695
|
+
}
|
|
8696
|
+
this.job = job;
|
|
8697
|
+
}
|
|
8698
|
+
notify() {
|
|
8699
|
+
const flags = this.flags;
|
|
8700
|
+
if (!(flags & 256)) {
|
|
8701
|
+
const flush = this.flush;
|
|
8702
|
+
const job = this.job;
|
|
8703
|
+
if (flush === "post") {
|
|
8704
|
+
queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
|
|
8705
|
+
} else if (flush === "pre") {
|
|
8706
|
+
queueJob(job, job.i ? job.i.uid : void 0, true);
|
|
8707
|
+
} else {
|
|
8708
|
+
job();
|
|
8709
|
+
}
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8306
8713
|
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8307
|
-
const { immediate, deep, flush, once } = options;
|
|
8714
|
+
const { immediate, deep, flush = "pre", once } = options;
|
|
8308
8715
|
if (!cb) {
|
|
8309
8716
|
if (immediate !== void 0) {
|
|
8310
8717
|
warn$1(
|
|
@@ -8341,42 +8748,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
|
8341
8748
|
}
|
|
8342
8749
|
const instance = currentInstance;
|
|
8343
8750
|
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
};
|
|
8751
|
+
const effect = new RenderWatcherEffect(
|
|
8752
|
+
instance,
|
|
8753
|
+
source,
|
|
8754
|
+
cb,
|
|
8755
|
+
baseWatchOptions,
|
|
8756
|
+
flush
|
|
8757
|
+
);
|
|
8758
|
+
if (cb) {
|
|
8759
|
+
effect.run(true);
|
|
8760
|
+
} else if (flush === "post") {
|
|
8761
|
+
queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
|
|
8762
|
+
} else {
|
|
8763
|
+
effect.run(true);
|
|
8358
8764
|
}
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
if (isPre) {
|
|
8364
|
-
job.flags |= 2;
|
|
8365
|
-
if (instance) {
|
|
8366
|
-
job.id = instance.uid;
|
|
8367
|
-
job.i = instance;
|
|
8368
|
-
}
|
|
8369
|
-
}
|
|
8370
|
-
};
|
|
8371
|
-
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
8765
|
+
const stop = effect.stop.bind(effect);
|
|
8766
|
+
stop.pause = effect.pause.bind(effect);
|
|
8767
|
+
stop.resume = effect.resume.bind(effect);
|
|
8768
|
+
stop.stop = stop;
|
|
8372
8769
|
if (isInSSRComponentSetup) {
|
|
8373
8770
|
if (ssrCleanup) {
|
|
8374
|
-
ssrCleanup.push(
|
|
8771
|
+
ssrCleanup.push(stop);
|
|
8375
8772
|
} else if (runsImmediately) {
|
|
8376
|
-
|
|
8773
|
+
stop();
|
|
8377
8774
|
}
|
|
8378
8775
|
}
|
|
8379
|
-
return
|
|
8776
|
+
return stop;
|
|
8380
8777
|
}
|
|
8381
8778
|
function instanceWatch(source, value, options) {
|
|
8382
8779
|
const publicThis = this.proxy;
|
|
@@ -8388,9 +8785,9 @@ function instanceWatch(source, value, options) {
|
|
|
8388
8785
|
cb = value.handler;
|
|
8389
8786
|
options = value;
|
|
8390
8787
|
}
|
|
8391
|
-
const
|
|
8788
|
+
const prev = setCurrentInstance(this);
|
|
8392
8789
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
8393
|
-
|
|
8790
|
+
setCurrentInstance(...prev);
|
|
8394
8791
|
return res;
|
|
8395
8792
|
}
|
|
8396
8793
|
function createPathGetter(ctx, path) {
|
|
@@ -8405,7 +8802,7 @@ function createPathGetter(ctx, path) {
|
|
|
8405
8802
|
}
|
|
8406
8803
|
|
|
8407
8804
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8408
|
-
const i =
|
|
8805
|
+
const i = getCurrentGenericInstance();
|
|
8409
8806
|
if (!i) {
|
|
8410
8807
|
warn$1(`useModel() called without active instance.`);
|
|
8411
8808
|
return ref();
|
|
@@ -8416,7 +8813,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8416
8813
|
return ref();
|
|
8417
8814
|
}
|
|
8418
8815
|
const hyphenatedName = hyphenate(name);
|
|
8419
|
-
const modifiers = getModelModifiers(props, camelizedName);
|
|
8816
|
+
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
8420
8817
|
const res = customRef((track, trigger) => {
|
|
8421
8818
|
let localValue;
|
|
8422
8819
|
let prevSetValue = EMPTY_OBJ;
|
|
@@ -8438,9 +8835,25 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8438
8835
|
if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
|
|
8439
8836
|
return;
|
|
8440
8837
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8838
|
+
let rawPropKeys;
|
|
8839
|
+
let parentPassedModelValue = false;
|
|
8840
|
+
let parentPassedModelUpdater = false;
|
|
8841
|
+
if (i.rawKeys) {
|
|
8842
|
+
rawPropKeys = i.rawKeys();
|
|
8843
|
+
} else {
|
|
8844
|
+
const rawProps = i.vnode.props;
|
|
8845
|
+
rawPropKeys = rawProps && Object.keys(rawProps);
|
|
8846
|
+
}
|
|
8847
|
+
if (rawPropKeys) {
|
|
8848
|
+
for (const key of rawPropKeys) {
|
|
8849
|
+
if (key === name || key === camelizedName || key === hyphenatedName) {
|
|
8850
|
+
parentPassedModelValue = true;
|
|
8851
|
+
} else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
|
|
8852
|
+
parentPassedModelUpdater = true;
|
|
8853
|
+
}
|
|
8854
|
+
}
|
|
8855
|
+
}
|
|
8856
|
+
if (!parentPassedModelValue || !parentPassedModelUpdater) {
|
|
8444
8857
|
localValue = value;
|
|
8445
8858
|
trigger();
|
|
8446
8859
|
}
|
|
@@ -8467,21 +8880,26 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8467
8880
|
};
|
|
8468
8881
|
return res;
|
|
8469
8882
|
}
|
|
8470
|
-
const getModelModifiers = (props, modelName) => {
|
|
8471
|
-
return modelName === "modelValue" || modelName === "model-value" ? props
|
|
8883
|
+
const getModelModifiers = (props, modelName, getter) => {
|
|
8884
|
+
return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
|
|
8472
8885
|
};
|
|
8473
8886
|
|
|
8474
8887
|
function emit(instance, event, ...rawArgs) {
|
|
8888
|
+
return baseEmit(
|
|
8889
|
+
instance,
|
|
8890
|
+
instance.vnode.props || EMPTY_OBJ,
|
|
8891
|
+
defaultPropGetter,
|
|
8892
|
+
event,
|
|
8893
|
+
...rawArgs
|
|
8894
|
+
);
|
|
8895
|
+
}
|
|
8896
|
+
function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
8475
8897
|
if (instance.isUnmounted) return;
|
|
8476
|
-
const props = instance.vnode.props || EMPTY_OBJ;
|
|
8477
8898
|
{
|
|
8478
|
-
const {
|
|
8479
|
-
emitsOptions,
|
|
8480
|
-
propsOptions: [propsOptions]
|
|
8481
|
-
} = instance;
|
|
8899
|
+
const { emitsOptions, propsOptions } = instance;
|
|
8482
8900
|
if (emitsOptions) {
|
|
8483
8901
|
if (!(event in emitsOptions) && true) {
|
|
8484
|
-
if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
|
|
8902
|
+
if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
|
|
8485
8903
|
warn$1(
|
|
8486
8904
|
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
|
|
8487
8905
|
);
|
|
@@ -8501,7 +8919,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8501
8919
|
}
|
|
8502
8920
|
let args = rawArgs;
|
|
8503
8921
|
const isModelListener = event.startsWith("update:");
|
|
8504
|
-
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
8922
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
8505
8923
|
if (modifiers) {
|
|
8506
8924
|
if (modifiers.trim) {
|
|
8507
8925
|
args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
@@ -8515,7 +8933,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8515
8933
|
}
|
|
8516
8934
|
{
|
|
8517
8935
|
const lowerCaseEvent = event.toLowerCase();
|
|
8518
|
-
if (lowerCaseEvent !== event && props
|
|
8936
|
+
if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
|
|
8519
8937
|
warn$1(
|
|
8520
8938
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
8521
8939
|
instance,
|
|
@@ -8527,10 +8945,10 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8527
8945
|
}
|
|
8528
8946
|
}
|
|
8529
8947
|
let handlerName;
|
|
8530
|
-
let handler = props
|
|
8531
|
-
props
|
|
8948
|
+
let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
|
|
8949
|
+
getter(props, handlerName = toHandlerKey(camelize(event)));
|
|
8532
8950
|
if (!handler && isModelListener) {
|
|
8533
|
-
handler = props
|
|
8951
|
+
handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
|
|
8534
8952
|
}
|
|
8535
8953
|
if (handler) {
|
|
8536
8954
|
callWithAsyncErrorHandling(
|
|
@@ -8540,7 +8958,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8540
8958
|
args
|
|
8541
8959
|
);
|
|
8542
8960
|
}
|
|
8543
|
-
const onceHandler = props
|
|
8961
|
+
const onceHandler = getter(props, handlerName + `Once`);
|
|
8544
8962
|
if (onceHandler) {
|
|
8545
8963
|
if (!instance.emitted) {
|
|
8546
8964
|
instance.emitted = {};
|
|
@@ -8556,6 +8974,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8556
8974
|
);
|
|
8557
8975
|
}
|
|
8558
8976
|
}
|
|
8977
|
+
function defaultPropGetter(props, key) {
|
|
8978
|
+
return props[key];
|
|
8979
|
+
}
|
|
8559
8980
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
8560
8981
|
const cache = appContext.emitsCache;
|
|
8561
8982
|
const cached = cache.get(comp);
|
|
@@ -8883,7 +9304,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
8883
9304
|
return false;
|
|
8884
9305
|
}
|
|
8885
9306
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
8886
|
-
while (parent) {
|
|
9307
|
+
while (parent && !parent.vapor) {
|
|
8887
9308
|
const root = parent.subTree;
|
|
8888
9309
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
8889
9310
|
root.el = vnode.el;
|
|
@@ -9234,7 +9655,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9234
9655
|
pendingBranch,
|
|
9235
9656
|
container2,
|
|
9236
9657
|
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
9237
|
-
0
|
|
9658
|
+
0,
|
|
9659
|
+
parentComponent2
|
|
9238
9660
|
);
|
|
9239
9661
|
queuePostFlushCb(effects);
|
|
9240
9662
|
}
|
|
@@ -9247,7 +9669,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9247
9669
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
9248
9670
|
}
|
|
9249
9671
|
if (!delayEnter) {
|
|
9250
|
-
move(
|
|
9672
|
+
move(
|
|
9673
|
+
pendingBranch,
|
|
9674
|
+
container2,
|
|
9675
|
+
anchor,
|
|
9676
|
+
0,
|
|
9677
|
+
parentComponent2
|
|
9678
|
+
);
|
|
9251
9679
|
}
|
|
9252
9680
|
}
|
|
9253
9681
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -9320,7 +9748,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9320
9748
|
}
|
|
9321
9749
|
},
|
|
9322
9750
|
move(container2, anchor2, type) {
|
|
9323
|
-
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
9751
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
|
|
9324
9752
|
suspense.container = container2;
|
|
9325
9753
|
},
|
|
9326
9754
|
next() {
|
|
@@ -9460,7 +9888,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
9460
9888
|
}
|
|
9461
9889
|
return s;
|
|
9462
9890
|
}
|
|
9463
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
9891
|
+
function queueEffectWithSuspense(fn, id, suspense) {
|
|
9464
9892
|
if (suspense && suspense.pendingBranch) {
|
|
9465
9893
|
if (isArray(fn)) {
|
|
9466
9894
|
suspense.effects.push(...fn);
|
|
@@ -9468,7 +9896,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
9468
9896
|
suspense.effects.push(fn);
|
|
9469
9897
|
}
|
|
9470
9898
|
} else {
|
|
9471
|
-
queuePostFlushCb(fn);
|
|
9899
|
+
queuePostFlushCb(fn, id);
|
|
9472
9900
|
}
|
|
9473
9901
|
}
|
|
9474
9902
|
function setActiveBranch(suspense, branch) {
|
|
@@ -9494,6 +9922,7 @@ const Fragment = Symbol.for("v-fgt");
|
|
|
9494
9922
|
const Text = Symbol.for("v-txt");
|
|
9495
9923
|
const Comment = Symbol.for("v-cmt");
|
|
9496
9924
|
const Static = Symbol.for("v-stc");
|
|
9925
|
+
const VaporSlot = Symbol.for("v-vps");
|
|
9497
9926
|
const blockStack = [];
|
|
9498
9927
|
let currentBlock = null;
|
|
9499
9928
|
function openBlock(disableTracking = false) {
|
|
@@ -9867,6 +10296,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
9867
10296
|
]);
|
|
9868
10297
|
}
|
|
9869
10298
|
|
|
10299
|
+
let currentInstance = null;
|
|
10300
|
+
const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
|
|
10301
|
+
const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
|
|
10302
|
+
let isInSSRComponentSetup = false;
|
|
10303
|
+
let setInSSRSetupState;
|
|
10304
|
+
let simpleSetCurrentInstance;
|
|
10305
|
+
{
|
|
10306
|
+
const g = getGlobalThis();
|
|
10307
|
+
const registerGlobalSetter = (key, setter) => {
|
|
10308
|
+
let setters;
|
|
10309
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
10310
|
+
setters.push(setter);
|
|
10311
|
+
return (v) => {
|
|
10312
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
10313
|
+
else setters[0](v);
|
|
10314
|
+
};
|
|
10315
|
+
};
|
|
10316
|
+
simpleSetCurrentInstance = registerGlobalSetter(
|
|
10317
|
+
`__VUE_INSTANCE_SETTERS__`,
|
|
10318
|
+
(v) => currentInstance = v
|
|
10319
|
+
);
|
|
10320
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
10321
|
+
`__VUE_SSR_SETTERS__`,
|
|
10322
|
+
(v) => isInSSRComponentSetup = v
|
|
10323
|
+
);
|
|
10324
|
+
}
|
|
10325
|
+
const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
|
|
10326
|
+
try {
|
|
10327
|
+
return [currentInstance, setCurrentScope(scope)];
|
|
10328
|
+
} finally {
|
|
10329
|
+
simpleSetCurrentInstance(instance);
|
|
10330
|
+
}
|
|
10331
|
+
};
|
|
10332
|
+
|
|
9870
10333
|
const emptyAppContext = createAppContext();
|
|
9871
10334
|
let uid = 0;
|
|
9872
10335
|
function createComponentInstance(vnode, parent, suspense) {
|
|
@@ -9911,7 +10374,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9911
10374
|
// to be set immediately
|
|
9912
10375
|
emitted: null,
|
|
9913
10376
|
// props default value
|
|
9914
|
-
propsDefaults:
|
|
10377
|
+
propsDefaults: null,
|
|
9915
10378
|
// inheritAttrs
|
|
9916
10379
|
inheritAttrs: type.inheritAttrs,
|
|
9917
10380
|
// state
|
|
@@ -9958,44 +10421,6 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9958
10421
|
}
|
|
9959
10422
|
return instance;
|
|
9960
10423
|
}
|
|
9961
|
-
let currentInstance = null;
|
|
9962
|
-
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
9963
|
-
let internalSetCurrentInstance;
|
|
9964
|
-
let setInSSRSetupState;
|
|
9965
|
-
{
|
|
9966
|
-
const g = getGlobalThis();
|
|
9967
|
-
const registerGlobalSetter = (key, setter) => {
|
|
9968
|
-
let setters;
|
|
9969
|
-
if (!(setters = g[key])) setters = g[key] = [];
|
|
9970
|
-
setters.push(setter);
|
|
9971
|
-
return (v) => {
|
|
9972
|
-
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
9973
|
-
else setters[0](v);
|
|
9974
|
-
};
|
|
9975
|
-
};
|
|
9976
|
-
internalSetCurrentInstance = registerGlobalSetter(
|
|
9977
|
-
`__VUE_INSTANCE_SETTERS__`,
|
|
9978
|
-
(v) => currentInstance = v
|
|
9979
|
-
);
|
|
9980
|
-
setInSSRSetupState = registerGlobalSetter(
|
|
9981
|
-
`__VUE_SSR_SETTERS__`,
|
|
9982
|
-
(v) => isInSSRComponentSetup = v
|
|
9983
|
-
);
|
|
9984
|
-
}
|
|
9985
|
-
const setCurrentInstance = (instance) => {
|
|
9986
|
-
const prev = currentInstance;
|
|
9987
|
-
internalSetCurrentInstance(instance);
|
|
9988
|
-
instance.scope.on();
|
|
9989
|
-
return () => {
|
|
9990
|
-
instance.scope.off();
|
|
9991
|
-
internalSetCurrentInstance(prev);
|
|
9992
|
-
};
|
|
9993
|
-
};
|
|
9994
|
-
const unsetCurrentInstance = () => {
|
|
9995
|
-
currentInstance && currentInstance.scope.off();
|
|
9996
|
-
internalSetCurrentInstance(null);
|
|
9997
|
-
};
|
|
9998
|
-
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
9999
10424
|
function validateComponentName(name, { isNativeTag }) {
|
|
10000
10425
|
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
10001
10426
|
warn$1(
|
|
@@ -10006,13 +10431,16 @@ function validateComponentName(name, { isNativeTag }) {
|
|
|
10006
10431
|
function isStatefulComponent(instance) {
|
|
10007
10432
|
return instance.vnode.shapeFlag & 4;
|
|
10008
10433
|
}
|
|
10009
|
-
let isInSSRComponentSetup = false;
|
|
10010
10434
|
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
10011
10435
|
isSSR && setInSSRSetupState(isSSR);
|
|
10012
|
-
const { props, children } = instance.vnode;
|
|
10436
|
+
const { props, children, vi } = instance.vnode;
|
|
10013
10437
|
const isStateful = isStatefulComponent(instance);
|
|
10014
|
-
|
|
10015
|
-
|
|
10438
|
+
if (vi) {
|
|
10439
|
+
vi(instance);
|
|
10440
|
+
} else {
|
|
10441
|
+
initProps(instance, props, isStateful, isSSR);
|
|
10442
|
+
initSlots(instance, children, optimized || isSSR);
|
|
10443
|
+
}
|
|
10016
10444
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
10017
10445
|
isSSR && setInSSRSetupState(false);
|
|
10018
10446
|
return setupResult;
|
|
@@ -10049,9 +10477,9 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10049
10477
|
}
|
|
10050
10478
|
const { setup } = Component;
|
|
10051
10479
|
if (setup) {
|
|
10052
|
-
|
|
10480
|
+
const prevSub = setActiveSub();
|
|
10053
10481
|
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
10054
|
-
const
|
|
10482
|
+
const prev = setCurrentInstance(instance);
|
|
10055
10483
|
const setupResult = callWithErrorHandling(
|
|
10056
10484
|
setup,
|
|
10057
10485
|
instance,
|
|
@@ -10062,12 +10490,15 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10062
10490
|
]
|
|
10063
10491
|
);
|
|
10064
10492
|
const isAsyncSetup = isPromise(setupResult);
|
|
10065
|
-
|
|
10066
|
-
|
|
10493
|
+
setActiveSub(prevSub);
|
|
10494
|
+
setCurrentInstance(...prev);
|
|
10067
10495
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
10068
10496
|
markAsyncBoundary(instance);
|
|
10069
10497
|
}
|
|
10070
10498
|
if (isAsyncSetup) {
|
|
10499
|
+
const unsetCurrentInstance = () => {
|
|
10500
|
+
setCurrentInstance(null, void 0);
|
|
10501
|
+
};
|
|
10071
10502
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
10072
10503
|
if (isSSR) {
|
|
10073
10504
|
return setupResult.then((resolvedResult) => {
|
|
@@ -10162,13 +10593,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
10162
10593
|
}
|
|
10163
10594
|
}
|
|
10164
10595
|
{
|
|
10165
|
-
const
|
|
10166
|
-
|
|
10596
|
+
const prevInstance = setCurrentInstance(instance);
|
|
10597
|
+
const prevSub = setActiveSub();
|
|
10167
10598
|
try {
|
|
10168
10599
|
applyOptions(instance);
|
|
10169
10600
|
} finally {
|
|
10170
|
-
|
|
10171
|
-
|
|
10601
|
+
setActiveSub(prevSub);
|
|
10602
|
+
setCurrentInstance(...prevInstance);
|
|
10172
10603
|
}
|
|
10173
10604
|
}
|
|
10174
10605
|
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
@@ -10205,29 +10636,6 @@ function getSlotsProxy(instance) {
|
|
|
10205
10636
|
});
|
|
10206
10637
|
}
|
|
10207
10638
|
function createSetupContext(instance) {
|
|
10208
|
-
const expose = (exposed) => {
|
|
10209
|
-
{
|
|
10210
|
-
if (instance.exposed) {
|
|
10211
|
-
warn$1(`expose() should be called only once per setup().`);
|
|
10212
|
-
}
|
|
10213
|
-
if (exposed != null) {
|
|
10214
|
-
let exposedType = typeof exposed;
|
|
10215
|
-
if (exposedType === "object") {
|
|
10216
|
-
if (isArray(exposed)) {
|
|
10217
|
-
exposedType = "array";
|
|
10218
|
-
} else if (isRef(exposed)) {
|
|
10219
|
-
exposedType = "ref";
|
|
10220
|
-
}
|
|
10221
|
-
}
|
|
10222
|
-
if (exposedType !== "object") {
|
|
10223
|
-
warn$1(
|
|
10224
|
-
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10225
|
-
);
|
|
10226
|
-
}
|
|
10227
|
-
}
|
|
10228
|
-
}
|
|
10229
|
-
instance.exposed = exposed || {};
|
|
10230
|
-
};
|
|
10231
10639
|
{
|
|
10232
10640
|
let attrsProxy;
|
|
10233
10641
|
let slotsProxy;
|
|
@@ -10241,10 +10649,33 @@ function createSetupContext(instance) {
|
|
|
10241
10649
|
get emit() {
|
|
10242
10650
|
return (event, ...args) => instance.emit(event, ...args);
|
|
10243
10651
|
},
|
|
10244
|
-
expose
|
|
10652
|
+
expose: (exposed) => expose(instance, exposed)
|
|
10245
10653
|
});
|
|
10246
10654
|
}
|
|
10247
10655
|
}
|
|
10656
|
+
function expose(instance, exposed) {
|
|
10657
|
+
{
|
|
10658
|
+
if (instance.exposed) {
|
|
10659
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
10660
|
+
}
|
|
10661
|
+
if (exposed != null) {
|
|
10662
|
+
let exposedType = typeof exposed;
|
|
10663
|
+
if (exposedType === "object") {
|
|
10664
|
+
if (isArray(exposed)) {
|
|
10665
|
+
exposedType = "array";
|
|
10666
|
+
} else if (isRef(exposed)) {
|
|
10667
|
+
exposedType = "ref";
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
if (exposedType !== "object") {
|
|
10671
|
+
warn$1(
|
|
10672
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10673
|
+
);
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
}
|
|
10677
|
+
instance.exposed = exposed || {};
|
|
10678
|
+
}
|
|
10248
10679
|
function getComponentPublicInstance(instance) {
|
|
10249
10680
|
if (instance.exposed) {
|
|
10250
10681
|
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
@@ -10252,7 +10683,9 @@ function getComponentPublicInstance(instance) {
|
|
|
10252
10683
|
if (key in target) {
|
|
10253
10684
|
return target[key];
|
|
10254
10685
|
} else if (key in publicPropertiesMap) {
|
|
10255
|
-
return publicPropertiesMap[key](
|
|
10686
|
+
return publicPropertiesMap[key](
|
|
10687
|
+
instance
|
|
10688
|
+
);
|
|
10256
10689
|
}
|
|
10257
10690
|
},
|
|
10258
10691
|
has(target, key) {
|
|
@@ -10295,14 +10728,7 @@ function isClassComponent(value) {
|
|
|
10295
10728
|
}
|
|
10296
10729
|
|
|
10297
10730
|
const computed = (getterOrOptions, debugOptions) => {
|
|
10298
|
-
|
|
10299
|
-
{
|
|
10300
|
-
const i = getCurrentInstance();
|
|
10301
|
-
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
10302
|
-
c._warnRecursive = true;
|
|
10303
|
-
}
|
|
10304
|
-
}
|
|
10305
|
-
return c;
|
|
10731
|
+
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
10306
10732
|
};
|
|
10307
10733
|
|
|
10308
10734
|
function h(type, propsOrChildren, children) {
|
|
@@ -10343,9 +10769,9 @@ function initCustomFormatter() {
|
|
|
10343
10769
|
if (obj.__isVue) {
|
|
10344
10770
|
return ["div", vueStyle, `VueInstance`];
|
|
10345
10771
|
} else if (isRef(obj)) {
|
|
10346
|
-
|
|
10772
|
+
const prevSub = setActiveSub();
|
|
10347
10773
|
const value = obj.value;
|
|
10348
|
-
|
|
10774
|
+
setActiveSub(prevSub);
|
|
10349
10775
|
return [
|
|
10350
10776
|
"div",
|
|
10351
10777
|
{},
|
|
@@ -10532,7 +10958,7 @@ function isMemoSame(cached, memo) {
|
|
|
10532
10958
|
return true;
|
|
10533
10959
|
}
|
|
10534
10960
|
|
|
10535
|
-
const version = "3.
|
|
10961
|
+
const version = "3.6.0-alpha.1";
|
|
10536
10962
|
const warn = warn$1 ;
|
|
10537
10963
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10538
10964
|
const devtools = devtools$1 ;
|
|
@@ -11045,8 +11471,9 @@ function setVarsOnNode(el, vars) {
|
|
|
11045
11471
|
const style = el.style;
|
|
11046
11472
|
let cssText = "";
|
|
11047
11473
|
for (const key in vars) {
|
|
11048
|
-
|
|
11049
|
-
|
|
11474
|
+
const value = normalizeCssVarValue(vars[key]);
|
|
11475
|
+
style.setProperty(`--${key}`, value);
|
|
11476
|
+
cssText += `--${key}: ${value};`;
|
|
11050
11477
|
}
|
|
11051
11478
|
style[CSS_VAR_TEXT] = cssText;
|
|
11052
11479
|
}
|
|
@@ -11103,11 +11530,11 @@ function patchStyle(el, prev, next) {
|
|
|
11103
11530
|
}
|
|
11104
11531
|
const semicolonRE = /[^\\];\s*$/;
|
|
11105
11532
|
const importantRE = /\s*!important$/;
|
|
11106
|
-
function setStyle(style, name,
|
|
11107
|
-
if (isArray(
|
|
11108
|
-
|
|
11533
|
+
function setStyle(style, name, rawVal) {
|
|
11534
|
+
if (isArray(rawVal)) {
|
|
11535
|
+
rawVal.forEach((v) => setStyle(style, name, v));
|
|
11109
11536
|
} else {
|
|
11110
|
-
|
|
11537
|
+
const val = rawVal == null ? "" : String(rawVal);
|
|
11111
11538
|
{
|
|
11112
11539
|
if (semicolonRE.test(val)) {
|
|
11113
11540
|
warn(
|
|
@@ -11180,8 +11607,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
|
11180
11607
|
return;
|
|
11181
11608
|
}
|
|
11182
11609
|
const tag = el.tagName;
|
|
11183
|
-
if (key === "value" && tag
|
|
11184
|
-
!tag.includes("-")) {
|
|
11610
|
+
if (key === "value" && canSetValueDirectly(tag)) {
|
|
11185
11611
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
11186
11612
|
const newValue = value == null ? (
|
|
11187
11613
|
// #11647: value should be set as empty string for null and undefined,
|
|
@@ -11309,8 +11735,6 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
11309
11735
|
}
|
|
11310
11736
|
}
|
|
11311
11737
|
|
|
11312
|
-
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
11313
|
-
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
11314
11738
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
11315
11739
|
const isSVG = namespace === "svg";
|
|
11316
11740
|
if (key === "class") {
|
|
@@ -11350,24 +11774,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
11350
11774
|
}
|
|
11351
11775
|
return false;
|
|
11352
11776
|
}
|
|
11353
|
-
if (
|
|
11354
|
-
return false;
|
|
11355
|
-
}
|
|
11356
|
-
if (key === "form") {
|
|
11357
|
-
return false;
|
|
11358
|
-
}
|
|
11359
|
-
if (key === "list" && el.tagName === "INPUT") {
|
|
11360
|
-
return false;
|
|
11361
|
-
}
|
|
11362
|
-
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
11777
|
+
if (shouldSetAsAttr(el.tagName, key)) {
|
|
11363
11778
|
return false;
|
|
11364
11779
|
}
|
|
11365
|
-
if (key === "width" || key === "height") {
|
|
11366
|
-
const tag = el.tagName;
|
|
11367
|
-
if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
|
11368
|
-
return false;
|
|
11369
|
-
}
|
|
11370
|
-
}
|
|
11371
11780
|
if (isNativeOn(key) && isString(value)) {
|
|
11372
11781
|
return false;
|
|
11373
11782
|
}
|
|
@@ -11973,28 +12382,12 @@ const assignKey = Symbol("_assign");
|
|
|
11973
12382
|
const vModelText = {
|
|
11974
12383
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
11975
12384
|
el[assignKey] = getModelAssigner(vnode);
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
}
|
|
11983
|
-
if (castToNumber) {
|
|
11984
|
-
domValue = looseToNumber(domValue);
|
|
11985
|
-
}
|
|
11986
|
-
el[assignKey](domValue);
|
|
11987
|
-
});
|
|
11988
|
-
if (trim) {
|
|
11989
|
-
addEventListener(el, "change", () => {
|
|
11990
|
-
el.value = el.value.trim();
|
|
11991
|
-
});
|
|
11992
|
-
}
|
|
11993
|
-
if (!lazy) {
|
|
11994
|
-
addEventListener(el, "compositionstart", onCompositionStart);
|
|
11995
|
-
addEventListener(el, "compositionend", onCompositionEnd);
|
|
11996
|
-
addEventListener(el, "change", onCompositionEnd);
|
|
11997
|
-
}
|
|
12385
|
+
vModelTextInit(
|
|
12386
|
+
el,
|
|
12387
|
+
trim,
|
|
12388
|
+
number || !!(vnode.props && vnode.props.type === "number"),
|
|
12389
|
+
lazy
|
|
12390
|
+
);
|
|
11998
12391
|
},
|
|
11999
12392
|
// set value on mounted so it's after min/max for type="range"
|
|
12000
12393
|
mounted(el, { value }) {
|
|
@@ -12002,70 +12395,111 @@ const vModelText = {
|
|
|
12002
12395
|
},
|
|
12003
12396
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
12004
12397
|
el[assignKey] = getModelAssigner(vnode);
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12398
|
+
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
12399
|
+
}
|
|
12400
|
+
};
|
|
12401
|
+
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
12402
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
12403
|
+
if (e.target.composing) return;
|
|
12404
|
+
let domValue = el.value;
|
|
12405
|
+
if (trim) {
|
|
12406
|
+
domValue = domValue.trim();
|
|
12407
|
+
}
|
|
12408
|
+
if (number || el.type === "number") {
|
|
12409
|
+
domValue = looseToNumber(domValue);
|
|
12410
|
+
}
|
|
12411
|
+
(0, el[assignKey])(domValue);
|
|
12412
|
+
});
|
|
12413
|
+
if (trim) {
|
|
12414
|
+
addEventListener(el, "change", () => {
|
|
12415
|
+
el.value = el.value.trim();
|
|
12416
|
+
});
|
|
12417
|
+
}
|
|
12418
|
+
if (!lazy) {
|
|
12419
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
12420
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
12421
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
12422
|
+
}
|
|
12423
|
+
};
|
|
12424
|
+
const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
12425
|
+
if (el.composing) return;
|
|
12426
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
12427
|
+
const newValue = value == null ? "" : value;
|
|
12428
|
+
if (elValue === newValue) {
|
|
12429
|
+
return;
|
|
12430
|
+
}
|
|
12431
|
+
if (document.activeElement === el && el.type !== "range") {
|
|
12432
|
+
if (lazy && value === oldValue) {
|
|
12009
12433
|
return;
|
|
12010
12434
|
}
|
|
12011
|
-
if (
|
|
12012
|
-
|
|
12013
|
-
return;
|
|
12014
|
-
}
|
|
12015
|
-
if (trim && el.value.trim() === newValue) {
|
|
12016
|
-
return;
|
|
12017
|
-
}
|
|
12435
|
+
if (trim && el.value.trim() === newValue) {
|
|
12436
|
+
return;
|
|
12018
12437
|
}
|
|
12019
|
-
el.value = newValue;
|
|
12020
12438
|
}
|
|
12439
|
+
el.value = newValue;
|
|
12021
12440
|
};
|
|
12022
12441
|
const vModelCheckbox = {
|
|
12023
12442
|
// #4096 array checkboxes need to be deep traversed
|
|
12024
12443
|
deep: true,
|
|
12025
12444
|
created(el, _, vnode) {
|
|
12026
12445
|
el[assignKey] = getModelAssigner(vnode);
|
|
12027
|
-
|
|
12028
|
-
const modelValue = el._modelValue;
|
|
12029
|
-
const elementValue = getValue(el);
|
|
12030
|
-
const checked = el.checked;
|
|
12031
|
-
const assign = el[assignKey];
|
|
12032
|
-
if (isArray(modelValue)) {
|
|
12033
|
-
const index = looseIndexOf(modelValue, elementValue);
|
|
12034
|
-
const found = index !== -1;
|
|
12035
|
-
if (checked && !found) {
|
|
12036
|
-
assign(modelValue.concat(elementValue));
|
|
12037
|
-
} else if (!checked && found) {
|
|
12038
|
-
const filtered = [...modelValue];
|
|
12039
|
-
filtered.splice(index, 1);
|
|
12040
|
-
assign(filtered);
|
|
12041
|
-
}
|
|
12042
|
-
} else if (isSet(modelValue)) {
|
|
12043
|
-
const cloned = new Set(modelValue);
|
|
12044
|
-
if (checked) {
|
|
12045
|
-
cloned.add(elementValue);
|
|
12046
|
-
} else {
|
|
12047
|
-
cloned.delete(elementValue);
|
|
12048
|
-
}
|
|
12049
|
-
assign(cloned);
|
|
12050
|
-
} else {
|
|
12051
|
-
assign(getCheckboxValue(el, checked));
|
|
12052
|
-
}
|
|
12053
|
-
});
|
|
12446
|
+
vModelCheckboxInit(el);
|
|
12054
12447
|
},
|
|
12055
12448
|
// set initial checked on mount to wait for true-value/false-value
|
|
12056
|
-
mounted
|
|
12449
|
+
mounted(el, binding, vnode) {
|
|
12450
|
+
vModelCheckboxUpdate(
|
|
12451
|
+
el,
|
|
12452
|
+
binding.oldValue,
|
|
12453
|
+
binding.value,
|
|
12454
|
+
vnode.props.value
|
|
12455
|
+
);
|
|
12456
|
+
},
|
|
12057
12457
|
beforeUpdate(el, binding, vnode) {
|
|
12058
12458
|
el[assignKey] = getModelAssigner(vnode);
|
|
12059
|
-
|
|
12459
|
+
vModelCheckboxUpdate(
|
|
12460
|
+
el,
|
|
12461
|
+
binding.oldValue,
|
|
12462
|
+
binding.value,
|
|
12463
|
+
vnode.props.value
|
|
12464
|
+
);
|
|
12060
12465
|
}
|
|
12061
12466
|
};
|
|
12062
|
-
|
|
12467
|
+
const vModelCheckboxInit = (el, set) => {
|
|
12468
|
+
addEventListener(el, "change", () => {
|
|
12469
|
+
const assign = el[assignKey];
|
|
12470
|
+
const modelValue = el._modelValue;
|
|
12471
|
+
const elementValue = getValue(el);
|
|
12472
|
+
const checked = el.checked;
|
|
12473
|
+
if (isArray(modelValue)) {
|
|
12474
|
+
const index = looseIndexOf(modelValue, elementValue);
|
|
12475
|
+
const found = index !== -1;
|
|
12476
|
+
if (checked && !found) {
|
|
12477
|
+
assign(modelValue.concat(elementValue));
|
|
12478
|
+
} else if (!checked && found) {
|
|
12479
|
+
const filtered = [...modelValue];
|
|
12480
|
+
filtered.splice(index, 1);
|
|
12481
|
+
assign(filtered);
|
|
12482
|
+
}
|
|
12483
|
+
} else if (isSet(modelValue)) {
|
|
12484
|
+
const cloned = new Set(modelValue);
|
|
12485
|
+
if (checked) {
|
|
12486
|
+
cloned.add(elementValue);
|
|
12487
|
+
} else {
|
|
12488
|
+
cloned.delete(elementValue);
|
|
12489
|
+
}
|
|
12490
|
+
assign(cloned);
|
|
12491
|
+
} else {
|
|
12492
|
+
assign(getCheckboxValue(el, checked));
|
|
12493
|
+
}
|
|
12494
|
+
});
|
|
12495
|
+
};
|
|
12496
|
+
const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
|
|
12063
12497
|
el._modelValue = value;
|
|
12064
12498
|
let checked;
|
|
12065
12499
|
if (isArray(value)) {
|
|
12066
|
-
checked = looseIndexOf(value,
|
|
12500
|
+
checked = looseIndexOf(value, rawValue) > -1;
|
|
12067
12501
|
} else if (isSet(value)) {
|
|
12068
|
-
checked = value.has(
|
|
12502
|
+
checked = value.has(rawValue);
|
|
12069
12503
|
} else {
|
|
12070
12504
|
if (value === oldValue) return;
|
|
12071
12505
|
checked = looseEqual(value, getCheckboxValue(el, true));
|
|
@@ -12073,7 +12507,7 @@ function setChecked(el, { value, oldValue }, vnode) {
|
|
|
12073
12507
|
if (el.checked !== checked) {
|
|
12074
12508
|
el.checked = checked;
|
|
12075
12509
|
}
|
|
12076
|
-
}
|
|
12510
|
+
};
|
|
12077
12511
|
const vModelRadio = {
|
|
12078
12512
|
created(el, { value }, vnode) {
|
|
12079
12513
|
el.checked = looseEqual(value, vnode.props.value);
|
|
@@ -12093,36 +12527,38 @@ const vModelSelect = {
|
|
|
12093
12527
|
// <select multiple> value need to be deep traversed
|
|
12094
12528
|
deep: true,
|
|
12095
12529
|
created(el, { value, modifiers: { number } }, vnode) {
|
|
12096
|
-
|
|
12097
|
-
addEventListener(el, "change", () => {
|
|
12098
|
-
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12099
|
-
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12100
|
-
);
|
|
12101
|
-
el[assignKey](
|
|
12102
|
-
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12103
|
-
);
|
|
12104
|
-
el._assigning = true;
|
|
12105
|
-
nextTick(() => {
|
|
12106
|
-
el._assigning = false;
|
|
12107
|
-
});
|
|
12108
|
-
});
|
|
12530
|
+
vModelSelectInit(el, value, number);
|
|
12109
12531
|
el[assignKey] = getModelAssigner(vnode);
|
|
12110
12532
|
},
|
|
12111
12533
|
// set value in mounted & updated because <select> relies on its children
|
|
12112
12534
|
// <option>s.
|
|
12113
12535
|
mounted(el, { value }) {
|
|
12114
|
-
|
|
12536
|
+
vModelSetSelected(el, value);
|
|
12115
12537
|
},
|
|
12116
12538
|
beforeUpdate(el, _binding, vnode) {
|
|
12117
12539
|
el[assignKey] = getModelAssigner(vnode);
|
|
12118
12540
|
},
|
|
12119
12541
|
updated(el, { value }) {
|
|
12120
|
-
|
|
12121
|
-
setSelected(el, value);
|
|
12122
|
-
}
|
|
12542
|
+
vModelSetSelected(el, value);
|
|
12123
12543
|
}
|
|
12124
12544
|
};
|
|
12125
|
-
|
|
12545
|
+
const vModelSelectInit = (el, value, number, set) => {
|
|
12546
|
+
const isSetModel = isSet(value);
|
|
12547
|
+
addEventListener(el, "change", () => {
|
|
12548
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12549
|
+
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12550
|
+
);
|
|
12551
|
+
(0, el[assignKey])(
|
|
12552
|
+
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12553
|
+
);
|
|
12554
|
+
el._assigning = true;
|
|
12555
|
+
nextTick(() => {
|
|
12556
|
+
el._assigning = false;
|
|
12557
|
+
});
|
|
12558
|
+
});
|
|
12559
|
+
};
|
|
12560
|
+
const vModelSetSelected = (el, value) => {
|
|
12561
|
+
if (el._assigning) return;
|
|
12126
12562
|
const isMultiple = el.multiple;
|
|
12127
12563
|
const isArrayValue = isArray(value);
|
|
12128
12564
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -12153,13 +12589,20 @@ function setSelected(el, value) {
|
|
|
12153
12589
|
if (!isMultiple && el.selectedIndex !== -1) {
|
|
12154
12590
|
el.selectedIndex = -1;
|
|
12155
12591
|
}
|
|
12156
|
-
}
|
|
12592
|
+
};
|
|
12157
12593
|
function getValue(el) {
|
|
12158
12594
|
return "_value" in el ? el._value : el.value;
|
|
12159
12595
|
}
|
|
12160
12596
|
function getCheckboxValue(el, checked) {
|
|
12161
12597
|
const key = checked ? "_trueValue" : "_falseValue";
|
|
12162
|
-
|
|
12598
|
+
if (key in el) {
|
|
12599
|
+
return el[key];
|
|
12600
|
+
}
|
|
12601
|
+
const attr = checked ? "true-value" : "false-value";
|
|
12602
|
+
if (el.hasAttribute(attr)) {
|
|
12603
|
+
return el.getAttribute(attr);
|
|
12604
|
+
}
|
|
12605
|
+
return checked;
|
|
12163
12606
|
}
|
|
12164
12607
|
const vModelDynamic = {
|
|
12165
12608
|
created(el, binding, vnode) {
|