@vue/runtime-dom 3.5.17 → 3.6.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-dom.cjs.js +130 -114
- package/dist/runtime-dom.cjs.prod.js +130 -114
- package/dist/runtime-dom.d.ts +4 -4
- package/dist/runtime-dom.esm-browser.js +1915 -1477
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +133 -116
- package/dist/runtime-dom.global.js +1912 -1474
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -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,404 @@ 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
|
-
}
|
|
618
|
-
}
|
|
619
|
-
if (error) throw error;
|
|
620
|
-
}
|
|
621
|
-
function prepareDeps(sub) {
|
|
622
|
-
for (let link = sub.deps; link; link = link.nextDep) {
|
|
623
|
-
link.version = -1;
|
|
624
|
-
link.prevActiveLink = link.dep.activeLink;
|
|
625
|
-
link.dep.activeLink = link;
|
|
440
|
+
if (!--batchDepth && notifyBufferLength) {
|
|
441
|
+
flush();
|
|
626
442
|
}
|
|
627
443
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
return;
|
|
458
|
+
const prevSub = dep.subsTail;
|
|
459
|
+
const newLink = sub.depsTail = dep.subsTail = {
|
|
460
|
+
dep,
|
|
461
|
+
sub,
|
|
462
|
+
prevDep,
|
|
463
|
+
nextDep,
|
|
464
|
+
prevSub,
|
|
465
|
+
nextSub: void 0
|
|
466
|
+
};
|
|
467
|
+
if (nextDep !== void 0) {
|
|
468
|
+
nextDep.prevDep = newLink;
|
|
666
469
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
470
|
+
if (prevDep !== void 0) {
|
|
471
|
+
prevDep.nextDep = newLink;
|
|
472
|
+
} else {
|
|
473
|
+
sub.deps = newLink;
|
|
670
474
|
}
|
|
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;
|
|
475
|
+
if (prevSub !== void 0) {
|
|
476
|
+
prevSub.nextSub = newLink;
|
|
477
|
+
} else {
|
|
478
|
+
dep.subs = newLink;
|
|
693
479
|
}
|
|
694
480
|
}
|
|
695
|
-
function
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
481
|
+
function unlink(link2, sub = link2.sub) {
|
|
482
|
+
const dep = link2.dep;
|
|
483
|
+
const prevDep = link2.prevDep;
|
|
484
|
+
const nextDep = link2.nextDep;
|
|
485
|
+
const nextSub = link2.nextSub;
|
|
486
|
+
const prevSub = link2.prevSub;
|
|
487
|
+
if (nextDep !== void 0) {
|
|
488
|
+
nextDep.prevDep = prevDep;
|
|
489
|
+
} else {
|
|
490
|
+
sub.depsTail = prevDep;
|
|
700
491
|
}
|
|
701
|
-
if (
|
|
702
|
-
|
|
703
|
-
|
|
492
|
+
if (prevDep !== void 0) {
|
|
493
|
+
prevDep.nextDep = nextDep;
|
|
494
|
+
} else {
|
|
495
|
+
sub.deps = nextDep;
|
|
704
496
|
}
|
|
705
|
-
if (
|
|
706
|
-
|
|
497
|
+
if (nextSub !== void 0) {
|
|
498
|
+
nextSub.prevSub = prevSub;
|
|
499
|
+
} else {
|
|
500
|
+
dep.subsTail = prevSub;
|
|
707
501
|
}
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
502
|
+
if (prevSub !== void 0) {
|
|
503
|
+
prevSub.nextSub = nextSub;
|
|
504
|
+
} else if ((dep.subs = nextSub) === void 0) {
|
|
505
|
+
let toRemove = dep.deps;
|
|
506
|
+
if (toRemove !== void 0) {
|
|
507
|
+
do {
|
|
508
|
+
toRemove = unlink(toRemove, dep);
|
|
509
|
+
} while (toRemove !== void 0);
|
|
510
|
+
dep.flags |= 16 /* Dirty */;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return nextDep;
|
|
514
|
+
}
|
|
515
|
+
function propagate(link2) {
|
|
516
|
+
let next = link2.nextSub;
|
|
517
|
+
let stack;
|
|
518
|
+
top: do {
|
|
519
|
+
const sub = link2.sub;
|
|
520
|
+
let flags = sub.flags;
|
|
521
|
+
if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
|
|
522
|
+
if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
|
|
523
|
+
sub.flags = flags | 32 /* Pending */;
|
|
524
|
+
} else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
|
|
525
|
+
flags = 0 /* None */;
|
|
526
|
+
} else if (!(flags & 4 /* RecursedCheck */)) {
|
|
527
|
+
sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
|
|
528
|
+
} else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
|
|
529
|
+
sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
|
|
530
|
+
flags &= 1 /* Mutable */;
|
|
531
|
+
} else {
|
|
532
|
+
flags = 0 /* None */;
|
|
533
|
+
}
|
|
534
|
+
if (flags & 2 /* Watching */) {
|
|
535
|
+
notifyBuffer[notifyBufferLength++] = sub;
|
|
536
|
+
}
|
|
537
|
+
if (flags & 1 /* Mutable */) {
|
|
538
|
+
const subSubs = sub.subs;
|
|
539
|
+
if (subSubs !== void 0) {
|
|
540
|
+
link2 = subSubs;
|
|
541
|
+
if (subSubs.nextSub !== void 0) {
|
|
542
|
+
stack = { value: next, prev: stack };
|
|
543
|
+
next = link2.nextSub;
|
|
544
|
+
}
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
714
547
|
}
|
|
715
548
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
549
|
+
if ((link2 = next) !== void 0) {
|
|
550
|
+
next = link2.nextSub;
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
while (stack !== void 0) {
|
|
554
|
+
link2 = stack.value;
|
|
555
|
+
stack = stack.prev;
|
|
556
|
+
if (link2 !== void 0) {
|
|
557
|
+
next = link2.nextSub;
|
|
558
|
+
continue top;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
break;
|
|
562
|
+
} while (true);
|
|
720
563
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
564
|
+
function startTracking(sub) {
|
|
565
|
+
sub.depsTail = void 0;
|
|
566
|
+
sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
|
|
567
|
+
return setActiveSub(sub);
|
|
568
|
+
}
|
|
569
|
+
function endTracking(sub, prevSub) {
|
|
570
|
+
if (activeSub !== sub) {
|
|
571
|
+
warn$2(
|
|
572
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
573
|
+
);
|
|
726
574
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
575
|
+
activeSub = prevSub;
|
|
576
|
+
const depsTail = sub.depsTail;
|
|
577
|
+
let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
578
|
+
while (toRemove !== void 0) {
|
|
579
|
+
toRemove = unlink(toRemove, sub);
|
|
580
|
+
}
|
|
581
|
+
sub.flags &= -5 /* RecursedCheck */;
|
|
582
|
+
}
|
|
583
|
+
function flush() {
|
|
584
|
+
while (notifyIndex < notifyBufferLength) {
|
|
585
|
+
const effect = notifyBuffer[notifyIndex];
|
|
586
|
+
notifyBuffer[notifyIndex++] = void 0;
|
|
587
|
+
effect.notify();
|
|
588
|
+
}
|
|
589
|
+
notifyIndex = 0;
|
|
590
|
+
notifyBufferLength = 0;
|
|
591
|
+
}
|
|
592
|
+
function checkDirty(link2, sub) {
|
|
593
|
+
let stack;
|
|
594
|
+
let checkDepth = 0;
|
|
595
|
+
top: do {
|
|
596
|
+
const dep = link2.dep;
|
|
597
|
+
const depFlags = dep.flags;
|
|
598
|
+
let dirty = false;
|
|
599
|
+
if (sub.flags & 16 /* Dirty */) {
|
|
600
|
+
dirty = true;
|
|
601
|
+
} else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
|
|
602
|
+
if (dep.update()) {
|
|
603
|
+
const subs = dep.subs;
|
|
604
|
+
if (subs.nextSub !== void 0) {
|
|
605
|
+
shallowPropagate(subs);
|
|
606
|
+
}
|
|
607
|
+
dirty = true;
|
|
608
|
+
}
|
|
609
|
+
} else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
|
|
610
|
+
if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
|
|
611
|
+
stack = { value: link2, prev: stack };
|
|
612
|
+
}
|
|
613
|
+
link2 = dep.deps;
|
|
614
|
+
sub = dep;
|
|
615
|
+
++checkDepth;
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
if (!dirty && link2.nextDep !== void 0) {
|
|
619
|
+
link2 = link2.nextDep;
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
while (checkDepth) {
|
|
623
|
+
--checkDepth;
|
|
624
|
+
const firstSub = sub.subs;
|
|
625
|
+
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
626
|
+
if (hasMultipleSubs) {
|
|
627
|
+
link2 = stack.value;
|
|
628
|
+
stack = stack.prev;
|
|
629
|
+
} else {
|
|
630
|
+
link2 = firstSub;
|
|
631
|
+
}
|
|
632
|
+
if (dirty) {
|
|
633
|
+
if (sub.update()) {
|
|
634
|
+
if (hasMultipleSubs) {
|
|
635
|
+
shallowPropagate(firstSub);
|
|
636
|
+
}
|
|
637
|
+
sub = link2.sub;
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
} else {
|
|
641
|
+
sub.flags &= -33 /* Pending */;
|
|
642
|
+
}
|
|
643
|
+
sub = link2.sub;
|
|
644
|
+
if (link2.nextDep !== void 0) {
|
|
645
|
+
link2 = link2.nextDep;
|
|
646
|
+
continue top;
|
|
647
|
+
}
|
|
648
|
+
dirty = false;
|
|
649
|
+
}
|
|
650
|
+
return dirty;
|
|
651
|
+
} while (true);
|
|
652
|
+
}
|
|
653
|
+
function shallowPropagate(link2) {
|
|
654
|
+
do {
|
|
655
|
+
const sub = link2.sub;
|
|
656
|
+
const nextSub = link2.nextSub;
|
|
657
|
+
const subFlags = sub.flags;
|
|
658
|
+
if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
|
|
659
|
+
sub.flags = subFlags | 16 /* Dirty */;
|
|
660
|
+
}
|
|
661
|
+
link2 = nextSub;
|
|
662
|
+
} while (link2 !== void 0);
|
|
663
|
+
}
|
|
664
|
+
function isValidLink(checkLink, sub) {
|
|
665
|
+
const depsTail = sub.depsTail;
|
|
666
|
+
if (depsTail !== void 0) {
|
|
667
|
+
let link2 = sub.deps;
|
|
668
|
+
do {
|
|
669
|
+
if (link2 === checkLink) {
|
|
670
|
+
return true;
|
|
671
|
+
}
|
|
672
|
+
if (link2 === depsTail) {
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
link2 = link2.nextDep;
|
|
676
|
+
} while (link2 !== void 0);
|
|
730
677
|
}
|
|
678
|
+
return false;
|
|
731
679
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
680
|
+
|
|
681
|
+
const triggerEventInfos = [];
|
|
682
|
+
function onTrack(sub, debugInfo) {
|
|
683
|
+
if (sub.onTrack) {
|
|
684
|
+
sub.onTrack(
|
|
685
|
+
extend(
|
|
686
|
+
{
|
|
687
|
+
effect: sub
|
|
688
|
+
},
|
|
689
|
+
debugInfo
|
|
690
|
+
)
|
|
691
|
+
);
|
|
739
692
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
693
|
+
}
|
|
694
|
+
function onTrigger(sub) {
|
|
695
|
+
if (sub.onTrigger) {
|
|
696
|
+
const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
|
|
697
|
+
sub.onTrigger(
|
|
698
|
+
extend(
|
|
699
|
+
{
|
|
700
|
+
effect: sub
|
|
701
|
+
},
|
|
702
|
+
debugInfo
|
|
703
|
+
)
|
|
704
|
+
);
|
|
745
705
|
}
|
|
746
|
-
const runner = e.run.bind(e);
|
|
747
|
-
runner.effect = e;
|
|
748
|
-
return runner;
|
|
749
706
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
707
|
+
function setupOnTrigger(target) {
|
|
708
|
+
Object.defineProperty(target.prototype, "onTrigger", {
|
|
709
|
+
get() {
|
|
710
|
+
return this._onTrigger;
|
|
711
|
+
},
|
|
712
|
+
set(val) {
|
|
713
|
+
if (val && !this._onTrigger) setupFlagsHandler(this);
|
|
714
|
+
this._onTrigger = val;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
752
717
|
}
|
|
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;
|
|
718
|
+
function setupFlagsHandler(target) {
|
|
719
|
+
target._flags = target.flags;
|
|
720
|
+
Object.defineProperty(target, "flags", {
|
|
721
|
+
get() {
|
|
722
|
+
return target._flags;
|
|
723
|
+
},
|
|
724
|
+
set(value) {
|
|
725
|
+
if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
|
|
726
|
+
onTrigger(this);
|
|
727
|
+
}
|
|
728
|
+
target._flags = value;
|
|
773
729
|
}
|
|
774
|
-
}
|
|
730
|
+
});
|
|
775
731
|
}
|
|
776
732
|
|
|
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
733
|
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
|
-
}
|
|
734
|
+
constructor(map, key) {
|
|
735
|
+
this.map = map;
|
|
736
|
+
this.key = key;
|
|
737
|
+
this._subs = void 0;
|
|
738
|
+
this.subsTail = void 0;
|
|
739
|
+
this.flags = ReactiveFlags.None;
|
|
815
740
|
}
|
|
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);
|
|
741
|
+
get subs() {
|
|
742
|
+
return this._subs;
|
|
864
743
|
}
|
|
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;
|
|
744
|
+
set subs(value) {
|
|
745
|
+
this._subs = value;
|
|
746
|
+
if (value === void 0) {
|
|
747
|
+
this.map.delete(this.key);
|
|
907
748
|
}
|
|
908
|
-
if (link.dep.subsHead === void 0) {
|
|
909
|
-
link.dep.subsHead = link;
|
|
910
|
-
}
|
|
911
|
-
link.dep.subs = link;
|
|
912
749
|
}
|
|
913
750
|
}
|
|
914
751
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -922,36 +759,34 @@ const ARRAY_ITERATE_KEY = Symbol(
|
|
|
922
759
|
"Array iterate"
|
|
923
760
|
);
|
|
924
761
|
function track(target, type, key) {
|
|
925
|
-
if (
|
|
762
|
+
if (activeSub !== void 0) {
|
|
926
763
|
let depsMap = targetMap.get(target);
|
|
927
764
|
if (!depsMap) {
|
|
928
765
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
929
766
|
}
|
|
930
767
|
let dep = depsMap.get(key);
|
|
931
768
|
if (!dep) {
|
|
932
|
-
depsMap.set(key, dep = new Dep());
|
|
933
|
-
dep.map = depsMap;
|
|
934
|
-
dep.key = key;
|
|
769
|
+
depsMap.set(key, dep = new Dep(depsMap, key));
|
|
935
770
|
}
|
|
936
771
|
{
|
|
937
|
-
|
|
772
|
+
onTrack(activeSub, {
|
|
938
773
|
target,
|
|
939
774
|
type,
|
|
940
775
|
key
|
|
941
776
|
});
|
|
942
777
|
}
|
|
778
|
+
link(dep, activeSub);
|
|
943
779
|
}
|
|
944
780
|
}
|
|
945
781
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
946
782
|
const depsMap = targetMap.get(target);
|
|
947
783
|
if (!depsMap) {
|
|
948
|
-
globalVersion++;
|
|
949
784
|
return;
|
|
950
785
|
}
|
|
951
786
|
const run = (dep) => {
|
|
952
|
-
if (dep) {
|
|
787
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
953
788
|
{
|
|
954
|
-
|
|
789
|
+
triggerEventInfos.push({
|
|
955
790
|
target,
|
|
956
791
|
type,
|
|
957
792
|
key,
|
|
@@ -960,6 +795,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
960
795
|
oldTarget
|
|
961
796
|
});
|
|
962
797
|
}
|
|
798
|
+
propagate(dep.subs);
|
|
799
|
+
shallowPropagate(dep.subs);
|
|
800
|
+
{
|
|
801
|
+
triggerEventInfos.pop();
|
|
802
|
+
}
|
|
963
803
|
}
|
|
964
804
|
};
|
|
965
805
|
startBatch();
|
|
@@ -1184,11 +1024,11 @@ function searchProxy(self, method, args) {
|
|
|
1184
1024
|
return res;
|
|
1185
1025
|
}
|
|
1186
1026
|
function noTracking(self, method, args = []) {
|
|
1187
|
-
pauseTracking();
|
|
1188
1027
|
startBatch();
|
|
1028
|
+
const prevSub = setActiveSub();
|
|
1189
1029
|
const res = toRaw(self)[method].apply(self, args);
|
|
1030
|
+
setActiveSub(prevSub);
|
|
1190
1031
|
endBatch();
|
|
1191
|
-
resetTracking();
|
|
1192
1032
|
return res;
|
|
1193
1033
|
}
|
|
1194
1034
|
|
|
@@ -1234,14 +1074,18 @@ class BaseReactiveHandler {
|
|
|
1234
1074
|
return hasOwnProperty;
|
|
1235
1075
|
}
|
|
1236
1076
|
}
|
|
1077
|
+
const wasRef = isRef(target);
|
|
1237
1078
|
const res = Reflect.get(
|
|
1238
1079
|
target,
|
|
1239
1080
|
key,
|
|
1240
1081
|
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1241
1082
|
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1242
1083
|
// its class methods
|
|
1243
|
-
|
|
1084
|
+
wasRef ? target : receiver
|
|
1244
1085
|
);
|
|
1086
|
+
if (wasRef && key !== "value") {
|
|
1087
|
+
return res;
|
|
1088
|
+
}
|
|
1245
1089
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1246
1090
|
return res;
|
|
1247
1091
|
}
|
|
@@ -1693,33 +1537,47 @@ function isRef(r) {
|
|
|
1693
1537
|
return r ? r["__v_isRef"] === true : false;
|
|
1694
1538
|
}
|
|
1695
1539
|
function ref(value) {
|
|
1696
|
-
return createRef(value,
|
|
1540
|
+
return createRef(value, toReactive);
|
|
1697
1541
|
}
|
|
1698
1542
|
function shallowRef(value) {
|
|
1699
|
-
return createRef(value
|
|
1543
|
+
return createRef(value);
|
|
1700
1544
|
}
|
|
1701
|
-
function createRef(rawValue,
|
|
1545
|
+
function createRef(rawValue, wrap) {
|
|
1702
1546
|
if (isRef(rawValue)) {
|
|
1703
1547
|
return rawValue;
|
|
1704
1548
|
}
|
|
1705
|
-
return new RefImpl(rawValue,
|
|
1549
|
+
return new RefImpl(rawValue, wrap);
|
|
1706
1550
|
}
|
|
1707
1551
|
class RefImpl {
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
this
|
|
1711
|
-
this
|
|
1712
|
-
this.
|
|
1713
|
-
|
|
1714
|
-
|
|
1552
|
+
// TODO isolatedDeclarations "__v_isShallow"
|
|
1553
|
+
constructor(value, wrap) {
|
|
1554
|
+
this.subs = void 0;
|
|
1555
|
+
this.subsTail = void 0;
|
|
1556
|
+
this.flags = ReactiveFlags.Mutable;
|
|
1557
|
+
/**
|
|
1558
|
+
* @internal
|
|
1559
|
+
*/
|
|
1560
|
+
this.__v_isRef = true;
|
|
1561
|
+
// TODO isolatedDeclarations "__v_isRef"
|
|
1562
|
+
/**
|
|
1563
|
+
* @internal
|
|
1564
|
+
*/
|
|
1565
|
+
this.__v_isShallow = false;
|
|
1566
|
+
this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
|
|
1567
|
+
this._value = wrap ? wrap(value) : value;
|
|
1568
|
+
this._wrap = wrap;
|
|
1569
|
+
this["__v_isShallow"] = !wrap;
|
|
1570
|
+
}
|
|
1571
|
+
get dep() {
|
|
1572
|
+
return this;
|
|
1715
1573
|
}
|
|
1716
1574
|
get value() {
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
}
|
|
1575
|
+
trackRef(this);
|
|
1576
|
+
if (this.flags & ReactiveFlags.Dirty && this.update()) {
|
|
1577
|
+
const subs = this.subs;
|
|
1578
|
+
if (subs !== void 0) {
|
|
1579
|
+
shallowPropagate(subs);
|
|
1580
|
+
}
|
|
1723
1581
|
}
|
|
1724
1582
|
return this._value;
|
|
1725
1583
|
}
|
|
@@ -1728,30 +1586,55 @@ class RefImpl {
|
|
|
1728
1586
|
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1729
1587
|
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1730
1588
|
if (hasChanged(newValue, oldValue)) {
|
|
1589
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
1731
1590
|
this._rawValue = newValue;
|
|
1732
|
-
this._value = useDirectValue ? newValue :
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1591
|
+
this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
|
|
1592
|
+
const subs = this.subs;
|
|
1593
|
+
if (subs !== void 0) {
|
|
1594
|
+
{
|
|
1595
|
+
triggerEventInfos.push({
|
|
1596
|
+
target: this,
|
|
1597
|
+
type: "set",
|
|
1598
|
+
key: "value",
|
|
1599
|
+
newValue,
|
|
1600
|
+
oldValue
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
propagate(subs);
|
|
1604
|
+
if (!batchDepth) {
|
|
1605
|
+
flush();
|
|
1606
|
+
}
|
|
1607
|
+
{
|
|
1608
|
+
triggerEventInfos.pop();
|
|
1609
|
+
}
|
|
1741
1610
|
}
|
|
1742
1611
|
}
|
|
1743
1612
|
}
|
|
1613
|
+
update() {
|
|
1614
|
+
this.flags &= ~ReactiveFlags.Dirty;
|
|
1615
|
+
return hasChanged(this._oldValue, this._oldValue = this._rawValue);
|
|
1616
|
+
}
|
|
1744
1617
|
}
|
|
1745
1618
|
function triggerRef(ref2) {
|
|
1746
|
-
|
|
1619
|
+
const dep = ref2.dep;
|
|
1620
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
1621
|
+
propagate(dep.subs);
|
|
1622
|
+
shallowPropagate(dep.subs);
|
|
1623
|
+
if (!batchDepth) {
|
|
1624
|
+
flush();
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
function trackRef(dep) {
|
|
1629
|
+
if (activeSub !== void 0) {
|
|
1747
1630
|
{
|
|
1748
|
-
|
|
1749
|
-
target:
|
|
1750
|
-
type: "
|
|
1751
|
-
key: "value"
|
|
1752
|
-
newValue: ref2._value
|
|
1631
|
+
onTrack(activeSub, {
|
|
1632
|
+
target: dep,
|
|
1633
|
+
type: "get",
|
|
1634
|
+
key: "value"
|
|
1753
1635
|
});
|
|
1754
1636
|
}
|
|
1637
|
+
link(dep, activeSub);
|
|
1755
1638
|
}
|
|
1756
1639
|
}
|
|
1757
1640
|
function unref(ref2) {
|
|
@@ -1777,13 +1660,21 @@ function proxyRefs(objectWithRefs) {
|
|
|
1777
1660
|
}
|
|
1778
1661
|
class CustomRefImpl {
|
|
1779
1662
|
constructor(factory) {
|
|
1663
|
+
this.subs = void 0;
|
|
1664
|
+
this.subsTail = void 0;
|
|
1665
|
+
this.flags = ReactiveFlags.None;
|
|
1780
1666
|
this["__v_isRef"] = true;
|
|
1781
1667
|
this._value = void 0;
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1668
|
+
const { get, set } = factory(
|
|
1669
|
+
() => trackRef(this),
|
|
1670
|
+
() => triggerRef(this)
|
|
1671
|
+
);
|
|
1784
1672
|
this._get = get;
|
|
1785
1673
|
this._set = set;
|
|
1786
1674
|
}
|
|
1675
|
+
get dep() {
|
|
1676
|
+
return this;
|
|
1677
|
+
}
|
|
1787
1678
|
get value() {
|
|
1788
1679
|
return this._value = this._get();
|
|
1789
1680
|
}
|
|
@@ -1795,9 +1686,6 @@ function customRef(factory) {
|
|
|
1795
1686
|
return new CustomRefImpl(factory);
|
|
1796
1687
|
}
|
|
1797
1688
|
function toRefs(object) {
|
|
1798
|
-
if (!isProxy(object)) {
|
|
1799
|
-
warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
|
1800
|
-
}
|
|
1801
1689
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1802
1690
|
for (const key in object) {
|
|
1803
1691
|
ret[key] = propertyToRef(object, key);
|
|
@@ -1850,69 +1738,331 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1850
1738
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1851
1739
|
}
|
|
1852
1740
|
|
|
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);
|
|
1741
|
+
class ReactiveEffect {
|
|
1742
|
+
constructor(fn) {
|
|
1743
|
+
this.deps = void 0;
|
|
1744
|
+
this.depsTail = void 0;
|
|
1745
|
+
this.subs = void 0;
|
|
1746
|
+
this.subsTail = void 0;
|
|
1747
|
+
this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
|
|
1865
1748
|
/**
|
|
1866
1749
|
* @internal
|
|
1867
1750
|
*/
|
|
1868
|
-
this.
|
|
1869
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1870
|
-
// A computed is also a subscriber that tracks other deps
|
|
1751
|
+
this.cleanups = [];
|
|
1871
1752
|
/**
|
|
1872
1753
|
* @internal
|
|
1873
1754
|
*/
|
|
1755
|
+
this.cleanupsLength = 0;
|
|
1756
|
+
if (fn !== void 0) {
|
|
1757
|
+
this.fn = fn;
|
|
1758
|
+
}
|
|
1759
|
+
if (activeEffectScope) {
|
|
1760
|
+
link(this, activeEffectScope);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
// @ts-expect-error
|
|
1764
|
+
fn() {
|
|
1765
|
+
}
|
|
1766
|
+
get active() {
|
|
1767
|
+
return !(this.flags & 1024);
|
|
1768
|
+
}
|
|
1769
|
+
pause() {
|
|
1770
|
+
this.flags |= 256;
|
|
1771
|
+
}
|
|
1772
|
+
resume() {
|
|
1773
|
+
const flags = this.flags &= -257;
|
|
1774
|
+
if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
|
|
1775
|
+
this.notify();
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
notify() {
|
|
1779
|
+
if (!(this.flags & 256) && this.dirty) {
|
|
1780
|
+
this.run();
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
run() {
|
|
1784
|
+
if (!this.active) {
|
|
1785
|
+
return this.fn();
|
|
1786
|
+
}
|
|
1787
|
+
cleanup(this);
|
|
1788
|
+
const prevSub = startTracking(this);
|
|
1789
|
+
try {
|
|
1790
|
+
return this.fn();
|
|
1791
|
+
} finally {
|
|
1792
|
+
endTracking(this, prevSub);
|
|
1793
|
+
const flags = this.flags;
|
|
1794
|
+
if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
|
|
1795
|
+
this.flags = flags & ~ReactiveFlags.Recursed;
|
|
1796
|
+
this.notify();
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
stop() {
|
|
1801
|
+
if (!this.active) {
|
|
1802
|
+
return;
|
|
1803
|
+
}
|
|
1804
|
+
this.flags = 1024;
|
|
1805
|
+
let dep = this.deps;
|
|
1806
|
+
while (dep !== void 0) {
|
|
1807
|
+
dep = unlink(dep, this);
|
|
1808
|
+
}
|
|
1809
|
+
const sub = this.subs;
|
|
1810
|
+
if (sub !== void 0) {
|
|
1811
|
+
unlink(sub);
|
|
1812
|
+
}
|
|
1813
|
+
cleanup(this);
|
|
1814
|
+
}
|
|
1815
|
+
get dirty() {
|
|
1816
|
+
const flags = this.flags;
|
|
1817
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1818
|
+
return true;
|
|
1819
|
+
}
|
|
1820
|
+
if (flags & ReactiveFlags.Pending) {
|
|
1821
|
+
if (checkDirty(this.deps, this)) {
|
|
1822
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
1823
|
+
return true;
|
|
1824
|
+
} else {
|
|
1825
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
{
|
|
1832
|
+
setupOnTrigger(ReactiveEffect);
|
|
1833
|
+
}
|
|
1834
|
+
function effect(fn, options) {
|
|
1835
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
1836
|
+
fn = fn.effect.fn;
|
|
1837
|
+
}
|
|
1838
|
+
const e = new ReactiveEffect(fn);
|
|
1839
|
+
if (options) {
|
|
1840
|
+
const { onStop, scheduler } = options;
|
|
1841
|
+
if (onStop) {
|
|
1842
|
+
options.onStop = void 0;
|
|
1843
|
+
const stop2 = e.stop.bind(e);
|
|
1844
|
+
e.stop = () => {
|
|
1845
|
+
stop2();
|
|
1846
|
+
onStop();
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
if (scheduler) {
|
|
1850
|
+
options.scheduler = void 0;
|
|
1851
|
+
e.notify = () => {
|
|
1852
|
+
if (!(e.flags & 256)) {
|
|
1853
|
+
scheduler();
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
extend(e, options);
|
|
1858
|
+
}
|
|
1859
|
+
try {
|
|
1860
|
+
e.run();
|
|
1861
|
+
} catch (err) {
|
|
1862
|
+
e.stop();
|
|
1863
|
+
throw err;
|
|
1864
|
+
}
|
|
1865
|
+
const runner = e.run.bind(e);
|
|
1866
|
+
runner.effect = e;
|
|
1867
|
+
return runner;
|
|
1868
|
+
}
|
|
1869
|
+
function stop(runner) {
|
|
1870
|
+
runner.effect.stop();
|
|
1871
|
+
}
|
|
1872
|
+
function cleanup(sub) {
|
|
1873
|
+
const l = sub.cleanupsLength;
|
|
1874
|
+
if (l) {
|
|
1875
|
+
for (let i = 0; i < l; i++) {
|
|
1876
|
+
sub.cleanups[i]();
|
|
1877
|
+
}
|
|
1878
|
+
sub.cleanupsLength = 0;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
let activeEffectScope;
|
|
1883
|
+
class EffectScope {
|
|
1884
|
+
constructor(detached = false) {
|
|
1874
1885
|
this.deps = void 0;
|
|
1886
|
+
this.depsTail = void 0;
|
|
1887
|
+
this.subs = void 0;
|
|
1888
|
+
this.subsTail = void 0;
|
|
1889
|
+
this.flags = 0;
|
|
1875
1890
|
/**
|
|
1876
1891
|
* @internal
|
|
1877
1892
|
*/
|
|
1878
|
-
this.
|
|
1893
|
+
this.cleanups = [];
|
|
1879
1894
|
/**
|
|
1880
1895
|
* @internal
|
|
1881
1896
|
*/
|
|
1882
|
-
this.
|
|
1897
|
+
this.cleanupsLength = 0;
|
|
1898
|
+
if (!detached && activeEffectScope) {
|
|
1899
|
+
link(this, activeEffectScope);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
get active() {
|
|
1903
|
+
return !(this.flags & 1024);
|
|
1904
|
+
}
|
|
1905
|
+
pause() {
|
|
1906
|
+
if (!(this.flags & 256)) {
|
|
1907
|
+
this.flags |= 256;
|
|
1908
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1909
|
+
const dep = link2.dep;
|
|
1910
|
+
if ("pause" in dep) {
|
|
1911
|
+
dep.pause();
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
1918
|
+
*/
|
|
1919
|
+
resume() {
|
|
1920
|
+
const flags = this.flags;
|
|
1921
|
+
if (flags & 256) {
|
|
1922
|
+
this.flags = flags & -257;
|
|
1923
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1924
|
+
const dep = link2.dep;
|
|
1925
|
+
if ("resume" in dep) {
|
|
1926
|
+
dep.resume();
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
run(fn) {
|
|
1932
|
+
const prevScope = activeEffectScope;
|
|
1933
|
+
try {
|
|
1934
|
+
activeEffectScope = this;
|
|
1935
|
+
return fn();
|
|
1936
|
+
} finally {
|
|
1937
|
+
activeEffectScope = prevScope;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
stop() {
|
|
1941
|
+
if (!this.active) {
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
this.flags = 1024;
|
|
1945
|
+
let dep = this.deps;
|
|
1946
|
+
while (dep !== void 0) {
|
|
1947
|
+
const node = dep.dep;
|
|
1948
|
+
if ("stop" in node) {
|
|
1949
|
+
dep = dep.nextDep;
|
|
1950
|
+
node.stop();
|
|
1951
|
+
} else {
|
|
1952
|
+
dep = unlink(dep, this);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
const sub = this.subs;
|
|
1956
|
+
if (sub !== void 0) {
|
|
1957
|
+
unlink(sub);
|
|
1958
|
+
}
|
|
1959
|
+
cleanup(this);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function effectScope(detached) {
|
|
1963
|
+
return new EffectScope(detached);
|
|
1964
|
+
}
|
|
1965
|
+
function getCurrentScope() {
|
|
1966
|
+
return activeEffectScope;
|
|
1967
|
+
}
|
|
1968
|
+
function setCurrentScope(scope) {
|
|
1969
|
+
try {
|
|
1970
|
+
return activeEffectScope;
|
|
1971
|
+
} finally {
|
|
1972
|
+
activeEffectScope = scope;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
1976
|
+
if (activeEffectScope !== void 0) {
|
|
1977
|
+
activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
|
|
1978
|
+
} else if (!failSilently) {
|
|
1979
|
+
warn$2(
|
|
1980
|
+
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
class ComputedRefImpl {
|
|
1986
|
+
constructor(fn, setter) {
|
|
1987
|
+
this.fn = fn;
|
|
1988
|
+
this.setter = setter;
|
|
1883
1989
|
/**
|
|
1884
1990
|
* @internal
|
|
1885
1991
|
*/
|
|
1886
|
-
this.
|
|
1992
|
+
this._value = void 0;
|
|
1993
|
+
this.subs = void 0;
|
|
1994
|
+
this.subsTail = void 0;
|
|
1995
|
+
this.deps = void 0;
|
|
1996
|
+
this.depsTail = void 0;
|
|
1997
|
+
this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
1887
1998
|
/**
|
|
1888
1999
|
* @internal
|
|
1889
2000
|
*/
|
|
1890
|
-
this.
|
|
1891
|
-
// for backwards compat
|
|
1892
|
-
this.effect = this;
|
|
2001
|
+
this.__v_isRef = true;
|
|
1893
2002
|
this["__v_isReadonly"] = !setter;
|
|
1894
|
-
|
|
2003
|
+
}
|
|
2004
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
2005
|
+
// for backwards compat
|
|
2006
|
+
get effect() {
|
|
2007
|
+
return this;
|
|
2008
|
+
}
|
|
2009
|
+
// for backwards compat
|
|
2010
|
+
get dep() {
|
|
2011
|
+
return this;
|
|
1895
2012
|
}
|
|
1896
2013
|
/**
|
|
1897
2014
|
* @internal
|
|
2015
|
+
* for backwards compat
|
|
1898
2016
|
*/
|
|
1899
|
-
|
|
1900
|
-
this.flags
|
|
1901
|
-
if (
|
|
1902
|
-
activeSub !== this) {
|
|
1903
|
-
batch(this, true);
|
|
2017
|
+
get _dirty() {
|
|
2018
|
+
const flags = this.flags;
|
|
2019
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1904
2020
|
return true;
|
|
1905
2021
|
}
|
|
2022
|
+
if (flags & ReactiveFlags.Pending) {
|
|
2023
|
+
if (checkDirty(this.deps, this)) {
|
|
2024
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
2025
|
+
return true;
|
|
2026
|
+
} else {
|
|
2027
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
return false;
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* @internal
|
|
2034
|
+
* for backwards compat
|
|
2035
|
+
*/
|
|
2036
|
+
set _dirty(v) {
|
|
2037
|
+
if (v) {
|
|
2038
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
2039
|
+
} else {
|
|
2040
|
+
this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
|
|
2041
|
+
}
|
|
1906
2042
|
}
|
|
1907
2043
|
get value() {
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2044
|
+
const flags = this.flags;
|
|
2045
|
+
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
|
|
2046
|
+
if (this.update()) {
|
|
2047
|
+
const subs = this.subs;
|
|
2048
|
+
if (subs !== void 0) {
|
|
2049
|
+
shallowPropagate(subs);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
} else if (flags & ReactiveFlags.Pending) {
|
|
2053
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2054
|
+
}
|
|
2055
|
+
if (activeSub !== void 0) {
|
|
2056
|
+
{
|
|
2057
|
+
onTrack(activeSub, {
|
|
2058
|
+
target: this,
|
|
2059
|
+
type: "get",
|
|
2060
|
+
key: "value"
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
link(this, activeSub);
|
|
2064
|
+
} else if (activeEffectScope !== void 0) {
|
|
2065
|
+
link(this, activeEffectScope);
|
|
1916
2066
|
}
|
|
1917
2067
|
return this._value;
|
|
1918
2068
|
}
|
|
@@ -1923,6 +2073,23 @@ class ComputedRefImpl {
|
|
|
1923
2073
|
warn$2("Write operation failed: computed value is readonly");
|
|
1924
2074
|
}
|
|
1925
2075
|
}
|
|
2076
|
+
update() {
|
|
2077
|
+
const prevSub = startTracking(this);
|
|
2078
|
+
try {
|
|
2079
|
+
const oldValue = this._value;
|
|
2080
|
+
const newValue = this.fn(oldValue);
|
|
2081
|
+
if (hasChanged(oldValue, newValue)) {
|
|
2082
|
+
this._value = newValue;
|
|
2083
|
+
return true;
|
|
2084
|
+
}
|
|
2085
|
+
return false;
|
|
2086
|
+
} finally {
|
|
2087
|
+
endTracking(this, prevSub);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
{
|
|
2092
|
+
setupOnTrigger(ComputedRefImpl);
|
|
1926
2093
|
}
|
|
1927
2094
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1928
2095
|
let getter;
|
|
@@ -1933,7 +2100,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
1933
2100
|
getter = getterOrOptions.get;
|
|
1934
2101
|
setter = getterOrOptions.set;
|
|
1935
2102
|
}
|
|
1936
|
-
const cRef = new ComputedRefImpl(getter, setter
|
|
2103
|
+
const cRef = new ComputedRefImpl(getter, setter);
|
|
1937
2104
|
if (debugOptions && !isSSR) {
|
|
1938
2105
|
cRef.onTrack = debugOptions.onTrack;
|
|
1939
2106
|
cRef.onTrigger = debugOptions.onTrigger;
|
|
@@ -1954,177 +2121,146 @@ const TriggerOpTypes = {
|
|
|
1954
2121
|
};
|
|
1955
2122
|
|
|
1956
2123
|
const INITIAL_WATCHER_VALUE = {};
|
|
1957
|
-
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1958
2124
|
let activeWatcher = void 0;
|
|
1959
2125
|
function getCurrentWatcher() {
|
|
1960
2126
|
return activeWatcher;
|
|
1961
2127
|
}
|
|
1962
2128
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1963
2129
|
if (owner) {
|
|
1964
|
-
|
|
1965
|
-
if (
|
|
1966
|
-
|
|
2130
|
+
const { call } = owner.options;
|
|
2131
|
+
if (call) {
|
|
2132
|
+
owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
|
|
2133
|
+
} else {
|
|
2134
|
+
owner.cleanups[owner.cleanupsLength++] = cleanupFn;
|
|
2135
|
+
}
|
|
1967
2136
|
} else if (!failSilently) {
|
|
1968
2137
|
warn$2(
|
|
1969
2138
|
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1970
2139
|
);
|
|
1971
2140
|
}
|
|
1972
2141
|
}
|
|
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();
|
|
2142
|
+
class WatcherEffect extends ReactiveEffect {
|
|
2143
|
+
constructor(source, cb, options = EMPTY_OBJ) {
|
|
2144
|
+
const { deep, once, call, onWarn } = options;
|
|
2145
|
+
let getter;
|
|
2146
|
+
let forceTrigger = false;
|
|
2147
|
+
let isMultiSource = false;
|
|
2148
|
+
if (isRef(source)) {
|
|
2149
|
+
getter = () => source.value;
|
|
2150
|
+
forceTrigger = isShallow(source);
|
|
2151
|
+
} else if (isReactive(source)) {
|
|
2152
|
+
getter = () => reactiveGetter(source, deep);
|
|
2153
|
+
forceTrigger = true;
|
|
2154
|
+
} else if (isArray(source)) {
|
|
2155
|
+
isMultiSource = true;
|
|
2156
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2157
|
+
getter = () => source.map((s) => {
|
|
2158
|
+
if (isRef(s)) {
|
|
2159
|
+
return s.value;
|
|
2160
|
+
} else if (isReactive(s)) {
|
|
2161
|
+
return reactiveGetter(s, deep);
|
|
2162
|
+
} else if (isFunction(s)) {
|
|
2163
|
+
return call ? call(s, 2) : s();
|
|
2164
|
+
} else {
|
|
2165
|
+
warnInvalidSource(s, onWarn);
|
|
2166
|
+
}
|
|
2167
|
+
});
|
|
2168
|
+
} else if (isFunction(source)) {
|
|
2169
|
+
if (cb) {
|
|
2170
|
+
getter = call ? () => call(source, 2) : source;
|
|
2010
2171
|
} else {
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2172
|
+
getter = () => {
|
|
2173
|
+
if (this.cleanupsLength) {
|
|
2174
|
+
const prevSub = setActiveSub();
|
|
2175
|
+
try {
|
|
2176
|
+
cleanup(this);
|
|
2177
|
+
} finally {
|
|
2178
|
+
setActiveSub(prevSub);
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
const currentEffect = activeWatcher;
|
|
2182
|
+
activeWatcher = this;
|
|
2021
2183
|
try {
|
|
2022
|
-
|
|
2184
|
+
return call ? call(source, 3, [
|
|
2185
|
+
this.boundCleanup
|
|
2186
|
+
]) : source(this.boundCleanup);
|
|
2023
2187
|
} finally {
|
|
2024
|
-
|
|
2188
|
+
activeWatcher = currentEffect;
|
|
2025
2189
|
}
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
} else {
|
|
2193
|
+
getter = NOOP;
|
|
2194
|
+
warnInvalidSource(source, onWarn);
|
|
2195
|
+
}
|
|
2196
|
+
if (cb && deep) {
|
|
2197
|
+
const baseGetter = getter;
|
|
2198
|
+
const depth = deep === true ? Infinity : deep;
|
|
2199
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2200
|
+
}
|
|
2201
|
+
super(getter);
|
|
2202
|
+
this.cb = cb;
|
|
2203
|
+
this.options = options;
|
|
2204
|
+
this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
|
|
2205
|
+
this.forceTrigger = forceTrigger;
|
|
2206
|
+
this.isMultiSource = isMultiSource;
|
|
2207
|
+
if (once && cb) {
|
|
2208
|
+
const _cb = cb;
|
|
2209
|
+
cb = (...args) => {
|
|
2210
|
+
_cb(...args);
|
|
2211
|
+
this.stop();
|
|
2034
2212
|
};
|
|
2035
2213
|
}
|
|
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);
|
|
2214
|
+
this.cb = cb;
|
|
2215
|
+
this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2216
|
+
{
|
|
2217
|
+
this.onTrack = options.onTrack;
|
|
2218
|
+
this.onTrigger = options.onTrigger;
|
|
2050
2219
|
}
|
|
2051
|
-
};
|
|
2052
|
-
if (once && cb) {
|
|
2053
|
-
const _cb = cb;
|
|
2054
|
-
cb = (...args) => {
|
|
2055
|
-
_cb(...args);
|
|
2056
|
-
watchHandle();
|
|
2057
|
-
};
|
|
2058
2220
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2221
|
+
run(initialRun = false) {
|
|
2222
|
+
const oldValue = this.oldValue;
|
|
2223
|
+
const newValue = this.oldValue = super.run();
|
|
2224
|
+
if (!this.cb) {
|
|
2062
2225
|
return;
|
|
2063
2226
|
}
|
|
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();
|
|
2227
|
+
const { immediate, deep, call } = this.options;
|
|
2228
|
+
if (initialRun && !immediate) {
|
|
2229
|
+
return;
|
|
2090
2230
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
call(
|
|
2103
|
-
|
|
2104
|
-
|
|
2231
|
+
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2232
|
+
cleanup(this);
|
|
2233
|
+
const currentWatcher = activeWatcher;
|
|
2234
|
+
activeWatcher = this;
|
|
2235
|
+
try {
|
|
2236
|
+
const args = [
|
|
2237
|
+
newValue,
|
|
2238
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2239
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2240
|
+
this.boundCleanup
|
|
2241
|
+
];
|
|
2242
|
+
call ? call(this.cb, 3, args) : (
|
|
2243
|
+
// @ts-expect-error
|
|
2244
|
+
this.cb(...args)
|
|
2245
|
+
);
|
|
2246
|
+
} finally {
|
|
2247
|
+
activeWatcher = currentWatcher;
|
|
2105
2248
|
}
|
|
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
2249
|
}
|
|
2119
|
-
} else if (scheduler) {
|
|
2120
|
-
scheduler(job.bind(null, true), true);
|
|
2121
|
-
} else {
|
|
2122
|
-
effect.run();
|
|
2123
2250
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2251
|
+
}
|
|
2252
|
+
function reactiveGetter(source, deep) {
|
|
2253
|
+
if (deep) return source;
|
|
2254
|
+
if (isShallow(source) || deep === false || deep === 0)
|
|
2255
|
+
return traverse(source, 1);
|
|
2256
|
+
return traverse(source);
|
|
2257
|
+
}
|
|
2258
|
+
function warnInvalidSource(s, onWarn) {
|
|
2259
|
+
(onWarn || warn$2)(
|
|
2260
|
+
`Invalid watch source: `,
|
|
2261
|
+
s,
|
|
2262
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
2263
|
+
);
|
|
2128
2264
|
}
|
|
2129
2265
|
function traverse(value, depth = Infinity, seen) {
|
|
2130
2266
|
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
@@ -2160,8 +2296,8 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
2160
2296
|
}
|
|
2161
2297
|
|
|
2162
2298
|
const stack = [];
|
|
2163
|
-
function pushWarningContext(
|
|
2164
|
-
stack.push(
|
|
2299
|
+
function pushWarningContext(ctx) {
|
|
2300
|
+
stack.push(ctx);
|
|
2165
2301
|
}
|
|
2166
2302
|
function popWarningContext() {
|
|
2167
2303
|
stack.pop();
|
|
@@ -2170,8 +2306,9 @@ let isWarning = false;
|
|
|
2170
2306
|
function warn$1(msg, ...args) {
|
|
2171
2307
|
if (isWarning) return;
|
|
2172
2308
|
isWarning = true;
|
|
2173
|
-
|
|
2174
|
-
const
|
|
2309
|
+
const prevSub = setActiveSub();
|
|
2310
|
+
const entry = stack.length ? stack[stack.length - 1] : null;
|
|
2311
|
+
const instance = isVNode(entry) ? entry.component : entry;
|
|
2175
2312
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
2176
2313
|
const trace = getComponentTrace();
|
|
2177
2314
|
if (appWarnHandler) {
|
|
@@ -2185,9 +2322,9 @@ function warn$1(msg, ...args) {
|
|
|
2185
2322
|
var _a, _b;
|
|
2186
2323
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
2187
2324
|
}).join(""),
|
|
2188
|
-
instance && instance.proxy,
|
|
2325
|
+
instance && instance.proxy || instance,
|
|
2189
2326
|
trace.map(
|
|
2190
|
-
({
|
|
2327
|
+
({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
|
|
2191
2328
|
).join("\n"),
|
|
2192
2329
|
trace
|
|
2193
2330
|
]
|
|
@@ -2201,27 +2338,31 @@ function warn$1(msg, ...args) {
|
|
|
2201
2338
|
}
|
|
2202
2339
|
console.warn(...warnArgs);
|
|
2203
2340
|
}
|
|
2204
|
-
|
|
2341
|
+
setActiveSub(prevSub);
|
|
2205
2342
|
isWarning = false;
|
|
2206
2343
|
}
|
|
2207
2344
|
function getComponentTrace() {
|
|
2208
|
-
let
|
|
2209
|
-
if (!
|
|
2345
|
+
let currentCtx = stack[stack.length - 1];
|
|
2346
|
+
if (!currentCtx) {
|
|
2210
2347
|
return [];
|
|
2211
2348
|
}
|
|
2212
2349
|
const normalizedStack = [];
|
|
2213
|
-
while (
|
|
2350
|
+
while (currentCtx) {
|
|
2214
2351
|
const last = normalizedStack[0];
|
|
2215
|
-
if (last && last.
|
|
2352
|
+
if (last && last.ctx === currentCtx) {
|
|
2216
2353
|
last.recurseCount++;
|
|
2217
2354
|
} else {
|
|
2218
2355
|
normalizedStack.push({
|
|
2219
|
-
|
|
2356
|
+
ctx: currentCtx,
|
|
2220
2357
|
recurseCount: 0
|
|
2221
2358
|
});
|
|
2222
2359
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2360
|
+
if (isVNode(currentCtx)) {
|
|
2361
|
+
const parent = currentCtx.component && currentCtx.component.parent;
|
|
2362
|
+
currentCtx = parent && parent.vnode || parent;
|
|
2363
|
+
} else {
|
|
2364
|
+
currentCtx = currentCtx.parent;
|
|
2365
|
+
}
|
|
2225
2366
|
}
|
|
2226
2367
|
return normalizedStack;
|
|
2227
2368
|
}
|
|
@@ -2233,16 +2374,13 @@ function formatTrace(trace) {
|
|
|
2233
2374
|
});
|
|
2234
2375
|
return logs;
|
|
2235
2376
|
}
|
|
2236
|
-
function formatTraceEntry({
|
|
2377
|
+
function formatTraceEntry({ ctx, recurseCount }) {
|
|
2237
2378
|
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
2238
|
-
const
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
vnode.type,
|
|
2242
|
-
isRoot
|
|
2243
|
-
)}`;
|
|
2379
|
+
const instance = isVNode(ctx) ? ctx.component : ctx;
|
|
2380
|
+
const isRoot = instance ? instance.parent == null : false;
|
|
2381
|
+
const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
|
|
2244
2382
|
const close = `>` + postfix;
|
|
2245
|
-
return
|
|
2383
|
+
return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
|
|
2246
2384
|
}
|
|
2247
2385
|
function formatProps(props) {
|
|
2248
2386
|
const res = [];
|
|
@@ -2374,11 +2512,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
|
2374
2512
|
}
|
|
2375
2513
|
}
|
|
2376
2514
|
function handleError(err, instance, type, throwInDev = true) {
|
|
2377
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
2378
2515
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
2379
2516
|
if (instance) {
|
|
2380
2517
|
let cur = instance.parent;
|
|
2381
|
-
const exposedInstance = instance.proxy;
|
|
2518
|
+
const exposedInstance = instance.proxy || instance;
|
|
2382
2519
|
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
2383
2520
|
while (cur) {
|
|
2384
2521
|
const errorCapturedHooks = cur.ec;
|
|
@@ -2392,26 +2529,26 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
2392
2529
|
cur = cur.parent;
|
|
2393
2530
|
}
|
|
2394
2531
|
if (errorHandler) {
|
|
2395
|
-
|
|
2532
|
+
const prevSub = setActiveSub();
|
|
2396
2533
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
2397
2534
|
err,
|
|
2398
2535
|
exposedInstance,
|
|
2399
2536
|
errorInfo
|
|
2400
2537
|
]);
|
|
2401
|
-
|
|
2538
|
+
setActiveSub(prevSub);
|
|
2402
2539
|
return;
|
|
2403
2540
|
}
|
|
2404
2541
|
}
|
|
2405
|
-
logError(err, type,
|
|
2542
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
2406
2543
|
}
|
|
2407
|
-
function logError(err, type,
|
|
2544
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
2408
2545
|
{
|
|
2409
2546
|
const info = ErrorTypeStrings$1[type];
|
|
2410
|
-
if (
|
|
2411
|
-
pushWarningContext(
|
|
2547
|
+
if (instance) {
|
|
2548
|
+
pushWarningContext(instance);
|
|
2412
2549
|
}
|
|
2413
2550
|
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
2414
|
-
if (
|
|
2551
|
+
if (instance) {
|
|
2415
2552
|
popWarningContext();
|
|
2416
2553
|
}
|
|
2417
2554
|
if (throwInDev) {
|
|
@@ -2422,26 +2559,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
|
|
|
2422
2559
|
}
|
|
2423
2560
|
}
|
|
2424
2561
|
|
|
2425
|
-
const
|
|
2426
|
-
let
|
|
2427
|
-
|
|
2428
|
-
let
|
|
2562
|
+
const jobs = [];
|
|
2563
|
+
let postJobs = [];
|
|
2564
|
+
let activePostJobs = null;
|
|
2565
|
+
let currentFlushPromise = null;
|
|
2566
|
+
let jobsLength = 0;
|
|
2567
|
+
let flushIndex = 0;
|
|
2429
2568
|
let postFlushIndex = 0;
|
|
2430
2569
|
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
2431
|
-
let currentFlushPromise = null;
|
|
2432
2570
|
const RECURSION_LIMIT = 100;
|
|
2433
2571
|
function nextTick(fn) {
|
|
2434
2572
|
const p = currentFlushPromise || resolvedPromise;
|
|
2435
2573
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2436
2574
|
}
|
|
2437
|
-
function findInsertionIndex(
|
|
2438
|
-
let start = flushIndex + 1;
|
|
2439
|
-
let end = queue.length;
|
|
2575
|
+
function findInsertionIndex(order, queue, start, end) {
|
|
2440
2576
|
while (start < end) {
|
|
2441
2577
|
const middle = start + end >>> 1;
|
|
2442
|
-
|
|
2443
|
-
const middleJobId = getId(middleJob);
|
|
2444
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
2578
|
+
if (queue[middle].order <= order) {
|
|
2445
2579
|
start = middle + 1;
|
|
2446
2580
|
} else {
|
|
2447
2581
|
end = middle;
|
|
@@ -2449,130 +2583,168 @@ function findInsertionIndex(id) {
|
|
|
2449
2583
|
}
|
|
2450
2584
|
return start;
|
|
2451
2585
|
}
|
|
2452
|
-
function queueJob(job) {
|
|
2453
|
-
if (
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2586
|
+
function queueJob(job, id, isPre = false) {
|
|
2587
|
+
if (queueJobWorker(
|
|
2588
|
+
job,
|
|
2589
|
+
id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
|
|
2590
|
+
jobs,
|
|
2591
|
+
jobsLength,
|
|
2592
|
+
flushIndex
|
|
2593
|
+
)) {
|
|
2594
|
+
jobsLength++;
|
|
2595
|
+
queueFlush();
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
function queueJobWorker(job, order, queue, length, flushIndex2) {
|
|
2599
|
+
const flags = job.flags;
|
|
2600
|
+
if (!(flags & 1)) {
|
|
2601
|
+
job.flags = flags | 1;
|
|
2602
|
+
job.order = order;
|
|
2603
|
+
if (flushIndex2 === length || // fast path when the job id is larger than the tail
|
|
2604
|
+
order >= queue[length - 1].order) {
|
|
2605
|
+
queue[length] = job;
|
|
2459
2606
|
} else {
|
|
2460
|
-
queue.splice(findInsertionIndex(
|
|
2607
|
+
queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
|
|
2461
2608
|
}
|
|
2462
|
-
|
|
2463
|
-
queueFlush();
|
|
2609
|
+
return true;
|
|
2464
2610
|
}
|
|
2611
|
+
return false;
|
|
2465
2612
|
}
|
|
2613
|
+
const doFlushJobs = () => {
|
|
2614
|
+
try {
|
|
2615
|
+
flushJobs();
|
|
2616
|
+
} catch (e) {
|
|
2617
|
+
currentFlushPromise = null;
|
|
2618
|
+
throw e;
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2466
2621
|
function queueFlush() {
|
|
2467
2622
|
if (!currentFlushPromise) {
|
|
2468
|
-
currentFlushPromise = resolvedPromise.then(
|
|
2623
|
+
currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
2469
2624
|
}
|
|
2470
2625
|
}
|
|
2471
|
-
function queuePostFlushCb(
|
|
2472
|
-
if (!isArray(
|
|
2473
|
-
if (
|
|
2474
|
-
|
|
2475
|
-
} else
|
|
2476
|
-
|
|
2477
|
-
cb.flags |= 1;
|
|
2626
|
+
function queuePostFlushCb(jobs2, id = Infinity) {
|
|
2627
|
+
if (!isArray(jobs2)) {
|
|
2628
|
+
if (activePostJobs && id === -1) {
|
|
2629
|
+
activePostJobs.splice(postFlushIndex, 0, jobs2);
|
|
2630
|
+
} else {
|
|
2631
|
+
queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
|
|
2478
2632
|
}
|
|
2479
2633
|
} else {
|
|
2480
|
-
|
|
2634
|
+
for (const job of jobs2) {
|
|
2635
|
+
queueJobWorker(job, id, postJobs, postJobs.length, 0);
|
|
2636
|
+
}
|
|
2481
2637
|
}
|
|
2482
2638
|
queueFlush();
|
|
2483
2639
|
}
|
|
2484
|
-
function flushPreFlushCbs(instance, seen
|
|
2640
|
+
function flushPreFlushCbs(instance, seen) {
|
|
2485
2641
|
{
|
|
2486
2642
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2487
2643
|
}
|
|
2488
|
-
for (; i <
|
|
2489
|
-
const cb =
|
|
2490
|
-
if (cb
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2644
|
+
for (let i = flushIndex; i < jobsLength; i++) {
|
|
2645
|
+
const cb = jobs[i];
|
|
2646
|
+
if (cb.order & 1 || cb.order === Infinity) {
|
|
2647
|
+
continue;
|
|
2648
|
+
}
|
|
2649
|
+
if (instance && cb.order !== instance.uid * 2) {
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
2655
|
+
jobs.splice(i, 1);
|
|
2656
|
+
i--;
|
|
2657
|
+
jobsLength--;
|
|
2658
|
+
if (cb.flags & 2) {
|
|
2659
|
+
cb.flags &= -2;
|
|
2660
|
+
}
|
|
2661
|
+
cb();
|
|
2662
|
+
if (!(cb.flags & 2)) {
|
|
2663
|
+
cb.flags &= -2;
|
|
2506
2664
|
}
|
|
2507
2665
|
}
|
|
2508
2666
|
}
|
|
2509
2667
|
function flushPostFlushCbs(seen) {
|
|
2510
|
-
if (
|
|
2511
|
-
|
|
2512
|
-
(
|
|
2513
|
-
|
|
2514
|
-
pendingPostFlushCbs.length = 0;
|
|
2515
|
-
if (activePostFlushCbs) {
|
|
2516
|
-
activePostFlushCbs.push(...deduped);
|
|
2668
|
+
if (postJobs.length) {
|
|
2669
|
+
if (activePostJobs) {
|
|
2670
|
+
activePostJobs.push(...postJobs);
|
|
2671
|
+
postJobs.length = 0;
|
|
2517
2672
|
return;
|
|
2518
2673
|
}
|
|
2519
|
-
|
|
2674
|
+
activePostJobs = postJobs;
|
|
2675
|
+
postJobs = [];
|
|
2520
2676
|
{
|
|
2521
2677
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2522
2678
|
}
|
|
2523
|
-
|
|
2524
|
-
const cb =
|
|
2679
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
2680
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
2525
2681
|
if (checkRecursiveUpdates(seen, cb)) {
|
|
2526
2682
|
continue;
|
|
2527
2683
|
}
|
|
2528
|
-
if (cb.flags &
|
|
2684
|
+
if (cb.flags & 2) {
|
|
2529
2685
|
cb.flags &= -2;
|
|
2530
2686
|
}
|
|
2531
|
-
if (!(cb.flags &
|
|
2532
|
-
|
|
2687
|
+
if (!(cb.flags & 4)) {
|
|
2688
|
+
try {
|
|
2689
|
+
cb();
|
|
2690
|
+
} finally {
|
|
2691
|
+
cb.flags &= -2;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2533
2694
|
}
|
|
2534
|
-
|
|
2695
|
+
activePostJobs = null;
|
|
2535
2696
|
postFlushIndex = 0;
|
|
2536
2697
|
}
|
|
2537
2698
|
}
|
|
2538
|
-
|
|
2699
|
+
let isFlushing = false;
|
|
2700
|
+
function flushOnAppMount() {
|
|
2701
|
+
if (!isFlushing) {
|
|
2702
|
+
isFlushing = true;
|
|
2703
|
+
flushPreFlushCbs();
|
|
2704
|
+
flushPostFlushCbs();
|
|
2705
|
+
isFlushing = false;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2539
2708
|
function flushJobs(seen) {
|
|
2540
2709
|
{
|
|
2541
|
-
seen
|
|
2710
|
+
seen || (seen = /* @__PURE__ */ new Map());
|
|
2542
2711
|
}
|
|
2543
|
-
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2544
2712
|
try {
|
|
2545
|
-
|
|
2546
|
-
const job =
|
|
2547
|
-
|
|
2548
|
-
|
|
2713
|
+
while (flushIndex < jobsLength) {
|
|
2714
|
+
const job = jobs[flushIndex];
|
|
2715
|
+
jobs[flushIndex++] = void 0;
|
|
2716
|
+
if (!(job.flags & 4)) {
|
|
2717
|
+
if (checkRecursiveUpdates(seen, job)) {
|
|
2549
2718
|
continue;
|
|
2550
2719
|
}
|
|
2551
|
-
if (job.flags &
|
|
2720
|
+
if (job.flags & 2) {
|
|
2552
2721
|
job.flags &= ~1;
|
|
2553
2722
|
}
|
|
2554
|
-
|
|
2555
|
-
job
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2723
|
+
try {
|
|
2724
|
+
job();
|
|
2725
|
+
} catch (err) {
|
|
2726
|
+
handleError(
|
|
2727
|
+
err,
|
|
2728
|
+
job.i,
|
|
2729
|
+
job.i ? 15 : 14
|
|
2730
|
+
);
|
|
2731
|
+
} finally {
|
|
2732
|
+
if (!(job.flags & 2)) {
|
|
2733
|
+
job.flags &= ~1;
|
|
2734
|
+
}
|
|
2561
2735
|
}
|
|
2562
2736
|
}
|
|
2563
2737
|
}
|
|
2564
2738
|
} finally {
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
job.flags &= -2;
|
|
2569
|
-
}
|
|
2739
|
+
while (flushIndex < jobsLength) {
|
|
2740
|
+
jobs[flushIndex].flags &= -2;
|
|
2741
|
+
jobs[flushIndex++] = void 0;
|
|
2570
2742
|
}
|
|
2571
|
-
flushIndex =
|
|
2572
|
-
|
|
2743
|
+
flushIndex = 0;
|
|
2744
|
+
jobsLength = 0;
|
|
2573
2745
|
flushPostFlushCbs(seen);
|
|
2574
2746
|
currentFlushPromise = null;
|
|
2575
|
-
if (
|
|
2747
|
+
if (jobsLength || postJobs.length) {
|
|
2576
2748
|
flushJobs(seen);
|
|
2577
2749
|
}
|
|
2578
2750
|
}
|
|
@@ -2639,10 +2811,17 @@ function rerender(id, newRender) {
|
|
|
2639
2811
|
instance.render = newRender;
|
|
2640
2812
|
normalizeClassComponent(instance.type).render = newRender;
|
|
2641
2813
|
}
|
|
2642
|
-
instance.renderCache = [];
|
|
2643
2814
|
isHmrUpdating = true;
|
|
2644
|
-
instance.
|
|
2645
|
-
|
|
2815
|
+
if (instance.vapor) {
|
|
2816
|
+
instance.hmrRerender();
|
|
2817
|
+
} else {
|
|
2818
|
+
const i = instance;
|
|
2819
|
+
i.renderCache = [];
|
|
2820
|
+
i.effect.run();
|
|
2821
|
+
}
|
|
2822
|
+
nextTick(() => {
|
|
2823
|
+
isHmrUpdating = false;
|
|
2824
|
+
});
|
|
2646
2825
|
});
|
|
2647
2826
|
}
|
|
2648
2827
|
function reload(id, newComp) {
|
|
@@ -2651,42 +2830,54 @@ function reload(id, newComp) {
|
|
|
2651
2830
|
newComp = normalizeClassComponent(newComp);
|
|
2652
2831
|
updateComponentDef(record.initialDef, newComp);
|
|
2653
2832
|
const instances = [...record.instances];
|
|
2654
|
-
|
|
2655
|
-
const instance
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
if (instance.ceReload) {
|
|
2833
|
+
if (newComp.__vapor) {
|
|
2834
|
+
for (const instance of instances) {
|
|
2835
|
+
instance.hmrReload(newComp);
|
|
2836
|
+
}
|
|
2837
|
+
} else {
|
|
2838
|
+
for (const instance of instances) {
|
|
2839
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2840
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2841
|
+
if (!dirtyInstances) {
|
|
2842
|
+
if (oldComp !== record.initialDef) {
|
|
2843
|
+
updateComponentDef(oldComp, newComp);
|
|
2844
|
+
}
|
|
2845
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2846
|
+
}
|
|
2669
2847
|
dirtyInstances.add(instance);
|
|
2670
|
-
instance.
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
instance.
|
|
2676
|
-
isHmrUpdating = false;
|
|
2848
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2849
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2850
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2851
|
+
if (instance.ceReload) {
|
|
2852
|
+
dirtyInstances.add(instance);
|
|
2853
|
+
instance.ceReload(newComp.styles);
|
|
2677
2854
|
dirtyInstances.delete(instance);
|
|
2678
|
-
})
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2855
|
+
} else if (instance.parent) {
|
|
2856
|
+
queueJob(() => {
|
|
2857
|
+
isHmrUpdating = true;
|
|
2858
|
+
const parent = instance.parent;
|
|
2859
|
+
if (parent.vapor) {
|
|
2860
|
+
parent.hmrRerender();
|
|
2861
|
+
} else {
|
|
2862
|
+
parent.effect.run();
|
|
2863
|
+
}
|
|
2864
|
+
nextTick(() => {
|
|
2865
|
+
isHmrUpdating = false;
|
|
2866
|
+
});
|
|
2867
|
+
dirtyInstances.delete(instance);
|
|
2868
|
+
});
|
|
2869
|
+
} else if (instance.appContext.reload) {
|
|
2870
|
+
instance.appContext.reload();
|
|
2871
|
+
} else if (typeof window !== "undefined") {
|
|
2872
|
+
window.location.reload();
|
|
2873
|
+
} else {
|
|
2874
|
+
console.warn(
|
|
2875
|
+
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
2876
|
+
);
|
|
2877
|
+
}
|
|
2878
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
2879
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
2880
|
+
}
|
|
2690
2881
|
}
|
|
2691
2882
|
}
|
|
2692
2883
|
queuePostFlushCb(() => {
|
|
@@ -2899,14 +3090,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2899
3090
|
}
|
|
2900
3091
|
let hook = binding.dir[name];
|
|
2901
3092
|
if (hook) {
|
|
2902
|
-
|
|
3093
|
+
const prevSub = setActiveSub();
|
|
2903
3094
|
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2904
3095
|
vnode.el,
|
|
2905
3096
|
binding,
|
|
2906
3097
|
vnode,
|
|
2907
3098
|
prevVNode
|
|
2908
3099
|
]);
|
|
2909
|
-
|
|
3100
|
+
setActiveSub(prevSub);
|
|
2910
3101
|
}
|
|
2911
3102
|
}
|
|
2912
3103
|
}
|
|
@@ -3006,29 +3197,37 @@ const TeleportImpl = {
|
|
|
3006
3197
|
}
|
|
3007
3198
|
if (isTeleportDeferred(n2.props)) {
|
|
3008
3199
|
n2.el.__isMounted = false;
|
|
3009
|
-
queuePostRenderEffect(
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3200
|
+
queuePostRenderEffect(
|
|
3201
|
+
() => {
|
|
3202
|
+
mountToTarget();
|
|
3203
|
+
delete n2.el.__isMounted;
|
|
3204
|
+
},
|
|
3205
|
+
void 0,
|
|
3206
|
+
parentSuspense
|
|
3207
|
+
);
|
|
3013
3208
|
} else {
|
|
3014
3209
|
mountToTarget();
|
|
3015
3210
|
}
|
|
3016
3211
|
} else {
|
|
3017
3212
|
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
|
3018
|
-
queuePostRenderEffect(
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3213
|
+
queuePostRenderEffect(
|
|
3214
|
+
() => {
|
|
3215
|
+
TeleportImpl.process(
|
|
3216
|
+
n1,
|
|
3217
|
+
n2,
|
|
3218
|
+
container,
|
|
3219
|
+
anchor,
|
|
3220
|
+
parentComponent,
|
|
3221
|
+
parentSuspense,
|
|
3222
|
+
namespace,
|
|
3223
|
+
slotScopeIds,
|
|
3224
|
+
optimized,
|
|
3225
|
+
internals
|
|
3226
|
+
);
|
|
3227
|
+
},
|
|
3228
|
+
void 0,
|
|
3229
|
+
parentSuspense
|
|
3230
|
+
);
|
|
3032
3231
|
return;
|
|
3033
3232
|
}
|
|
3034
3233
|
n2.el = n1.el;
|
|
@@ -3075,6 +3274,7 @@ const TeleportImpl = {
|
|
|
3075
3274
|
container,
|
|
3076
3275
|
mainAnchor,
|
|
3077
3276
|
internals,
|
|
3277
|
+
parentComponent,
|
|
3078
3278
|
1
|
|
3079
3279
|
);
|
|
3080
3280
|
} else {
|
|
@@ -3094,6 +3294,7 @@ const TeleportImpl = {
|
|
|
3094
3294
|
nextTarget,
|
|
3095
3295
|
null,
|
|
3096
3296
|
internals,
|
|
3297
|
+
parentComponent,
|
|
3097
3298
|
0
|
|
3098
3299
|
);
|
|
3099
3300
|
} else {
|
|
@@ -3109,6 +3310,7 @@ const TeleportImpl = {
|
|
|
3109
3310
|
target,
|
|
3110
3311
|
targetAnchor,
|
|
3111
3312
|
internals,
|
|
3313
|
+
parentComponent,
|
|
3112
3314
|
1
|
|
3113
3315
|
);
|
|
3114
3316
|
}
|
|
@@ -3148,7 +3350,7 @@ const TeleportImpl = {
|
|
|
3148
3350
|
move: moveTeleport,
|
|
3149
3351
|
hydrate: hydrateTeleport
|
|
3150
3352
|
};
|
|
3151
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
3353
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
|
|
3152
3354
|
if (moveType === 0) {
|
|
3153
3355
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
3154
3356
|
}
|
|
@@ -3164,7 +3366,8 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
3164
3366
|
children[i],
|
|
3165
3367
|
container,
|
|
3166
3368
|
parentAnchor,
|
|
3167
|
-
2
|
|
3369
|
+
2,
|
|
3370
|
+
parentComponent
|
|
3168
3371
|
);
|
|
3169
3372
|
}
|
|
3170
3373
|
}
|
|
@@ -3349,7 +3552,7 @@ const BaseTransitionImpl = {
|
|
|
3349
3552
|
state.isLeaving = true;
|
|
3350
3553
|
leavingHooks.afterLeave = () => {
|
|
3351
3554
|
state.isLeaving = false;
|
|
3352
|
-
if (!(instance.job.flags &
|
|
3555
|
+
if (!(instance.job.flags & 4)) {
|
|
3353
3556
|
instance.update();
|
|
3354
3557
|
}
|
|
3355
3558
|
delete leavingHooks.afterLeave;
|
|
@@ -3628,7 +3831,7 @@ function defineComponent(options, extraOptions) {
|
|
|
3628
3831
|
}
|
|
3629
3832
|
|
|
3630
3833
|
function useId() {
|
|
3631
|
-
const i =
|
|
3834
|
+
const i = getCurrentGenericInstance();
|
|
3632
3835
|
if (i) {
|
|
3633
3836
|
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
3634
3837
|
} else {
|
|
@@ -3644,7 +3847,7 @@ function markAsyncBoundary(instance) {
|
|
|
3644
3847
|
|
|
3645
3848
|
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
3646
3849
|
function useTemplateRef(key) {
|
|
3647
|
-
const i =
|
|
3850
|
+
const i = getCurrentGenericInstance();
|
|
3648
3851
|
const r = shallowRef(null);
|
|
3649
3852
|
if (i) {
|
|
3650
3853
|
const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
@@ -3764,8 +3967,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3764
3967
|
}
|
|
3765
3968
|
};
|
|
3766
3969
|
if (value) {
|
|
3767
|
-
doSet
|
|
3768
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3970
|
+
queuePostRenderEffect(doSet, -1, parentSuspense);
|
|
3769
3971
|
} else {
|
|
3770
3972
|
doSet();
|
|
3771
3973
|
}
|
|
@@ -3933,6 +4135,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3933
4135
|
);
|
|
3934
4136
|
}
|
|
3935
4137
|
} else if (shapeFlag & 6) {
|
|
4138
|
+
if (vnode.type.__vapor) {
|
|
4139
|
+
throw new Error("Vapor component hydration is not supported yet.");
|
|
4140
|
+
}
|
|
3936
4141
|
vnode.slotScopeIds = slotScopeIds;
|
|
3937
4142
|
const container = parentNode(node);
|
|
3938
4143
|
if (isFragmentStart) {
|
|
@@ -4094,11 +4299,15 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4094
4299
|
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
4095
4300
|
}
|
|
4096
4301
|
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
4097
|
-
queueEffectWithSuspense(
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4302
|
+
queueEffectWithSuspense(
|
|
4303
|
+
() => {
|
|
4304
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
4305
|
+
needCallTransitionHooks && transition.enter(el);
|
|
4306
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
4307
|
+
},
|
|
4308
|
+
void 0,
|
|
4309
|
+
parentSuspense
|
|
4310
|
+
);
|
|
4102
4311
|
}
|
|
4103
4312
|
}
|
|
4104
4313
|
return el.nextSibling;
|
|
@@ -4378,14 +4587,16 @@ function resolveCssVars(instance, vnode, expectedMap) {
|
|
|
4378
4587
|
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
4379
4588
|
const cssVars = instance.getCssVars();
|
|
4380
4589
|
for (const key in cssVars) {
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
String(cssVars[key])
|
|
4384
|
-
);
|
|
4590
|
+
const value = normalizeCssVarValue(cssVars[key]);
|
|
4591
|
+
expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
|
|
4385
4592
|
}
|
|
4386
4593
|
}
|
|
4387
4594
|
if (vnode === root && instance.parent) {
|
|
4388
|
-
resolveCssVars(
|
|
4595
|
+
resolveCssVars(
|
|
4596
|
+
instance.parent,
|
|
4597
|
+
instance.vnode,
|
|
4598
|
+
expectedMap
|
|
4599
|
+
);
|
|
4389
4600
|
}
|
|
4390
4601
|
}
|
|
4391
4602
|
const allowMismatchAttr = "data-allow-mismatch";
|
|
@@ -4644,7 +4855,7 @@ function defineAsyncComponent(source) {
|
|
|
4644
4855
|
}
|
|
4645
4856
|
load().then(() => {
|
|
4646
4857
|
loaded.value = true;
|
|
4647
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4858
|
+
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
|
|
4648
4859
|
instance.parent.update();
|
|
4649
4860
|
}
|
|
4650
4861
|
}).catch((err) => {
|
|
@@ -4687,8 +4898,8 @@ const KeepAliveImpl = {
|
|
|
4687
4898
|
max: [String, Number]
|
|
4688
4899
|
},
|
|
4689
4900
|
setup(props, { slots }) {
|
|
4690
|
-
const
|
|
4691
|
-
const sharedContext =
|
|
4901
|
+
const keepAliveInstance = getCurrentInstance();
|
|
4902
|
+
const sharedContext = keepAliveInstance.ctx;
|
|
4692
4903
|
if (!sharedContext.renderer) {
|
|
4693
4904
|
return () => {
|
|
4694
4905
|
const children = slots.default && slots.default();
|
|
@@ -4699,9 +4910,9 @@ const KeepAliveImpl = {
|
|
|
4699
4910
|
const keys = /* @__PURE__ */ new Set();
|
|
4700
4911
|
let current = null;
|
|
4701
4912
|
{
|
|
4702
|
-
|
|
4913
|
+
keepAliveInstance.__v_cache = cache;
|
|
4703
4914
|
}
|
|
4704
|
-
const parentSuspense =
|
|
4915
|
+
const parentSuspense = keepAliveInstance.suspense;
|
|
4705
4916
|
const {
|
|
4706
4917
|
renderer: {
|
|
4707
4918
|
p: patch,
|
|
@@ -4712,58 +4923,80 @@ const KeepAliveImpl = {
|
|
|
4712
4923
|
} = sharedContext;
|
|
4713
4924
|
const storageContainer = createElement("div");
|
|
4714
4925
|
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
4715
|
-
const
|
|
4716
|
-
move(
|
|
4926
|
+
const instance = vnode.component;
|
|
4927
|
+
move(
|
|
4928
|
+
vnode,
|
|
4929
|
+
container,
|
|
4930
|
+
anchor,
|
|
4931
|
+
0,
|
|
4932
|
+
keepAliveInstance,
|
|
4933
|
+
parentSuspense
|
|
4934
|
+
);
|
|
4717
4935
|
patch(
|
|
4718
|
-
|
|
4936
|
+
instance.vnode,
|
|
4719
4937
|
vnode,
|
|
4720
4938
|
container,
|
|
4721
4939
|
anchor,
|
|
4722
|
-
|
|
4940
|
+
instance,
|
|
4723
4941
|
parentSuspense,
|
|
4724
4942
|
namespace,
|
|
4725
4943
|
vnode.slotScopeIds,
|
|
4726
4944
|
optimized
|
|
4727
4945
|
);
|
|
4728
|
-
queuePostRenderEffect(
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4946
|
+
queuePostRenderEffect(
|
|
4947
|
+
() => {
|
|
4948
|
+
instance.isDeactivated = false;
|
|
4949
|
+
if (instance.a) {
|
|
4950
|
+
invokeArrayFns(instance.a);
|
|
4951
|
+
}
|
|
4952
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
4953
|
+
if (vnodeHook) {
|
|
4954
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4955
|
+
}
|
|
4956
|
+
},
|
|
4957
|
+
void 0,
|
|
4958
|
+
parentSuspense
|
|
4959
|
+
);
|
|
4738
4960
|
{
|
|
4739
|
-
devtoolsComponentAdded(
|
|
4961
|
+
devtoolsComponentAdded(instance);
|
|
4740
4962
|
}
|
|
4741
4963
|
};
|
|
4742
4964
|
sharedContext.deactivate = (vnode) => {
|
|
4743
|
-
const
|
|
4744
|
-
invalidateMount(
|
|
4745
|
-
invalidateMount(
|
|
4746
|
-
move(
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4965
|
+
const instance = vnode.component;
|
|
4966
|
+
invalidateMount(instance.m);
|
|
4967
|
+
invalidateMount(instance.a);
|
|
4968
|
+
move(
|
|
4969
|
+
vnode,
|
|
4970
|
+
storageContainer,
|
|
4971
|
+
null,
|
|
4972
|
+
1,
|
|
4973
|
+
keepAliveInstance,
|
|
4974
|
+
parentSuspense
|
|
4975
|
+
);
|
|
4976
|
+
queuePostRenderEffect(
|
|
4977
|
+
() => {
|
|
4978
|
+
if (instance.da) {
|
|
4979
|
+
invokeArrayFns(instance.da);
|
|
4980
|
+
}
|
|
4981
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
4982
|
+
if (vnodeHook) {
|
|
4983
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4984
|
+
}
|
|
4985
|
+
instance.isDeactivated = true;
|
|
4986
|
+
},
|
|
4987
|
+
void 0,
|
|
4988
|
+
parentSuspense
|
|
4989
|
+
);
|
|
4757
4990
|
{
|
|
4758
|
-
devtoolsComponentAdded(
|
|
4991
|
+
devtoolsComponentAdded(instance);
|
|
4759
4992
|
}
|
|
4760
4993
|
{
|
|
4761
|
-
|
|
4994
|
+
instance.__keepAliveStorageContainer = storageContainer;
|
|
4762
4995
|
}
|
|
4763
4996
|
};
|
|
4764
4997
|
function unmount(vnode) {
|
|
4765
4998
|
resetShapeFlag(vnode);
|
|
4766
|
-
_unmount(vnode,
|
|
4999
|
+
_unmount(vnode, keepAliveInstance, parentSuspense, true);
|
|
4767
5000
|
}
|
|
4768
5001
|
function pruneCache(filter) {
|
|
4769
5002
|
cache.forEach((vnode, key) => {
|
|
@@ -4795,12 +5028,19 @@ const KeepAliveImpl = {
|
|
|
4795
5028
|
let pendingCacheKey = null;
|
|
4796
5029
|
const cacheSubtree = () => {
|
|
4797
5030
|
if (pendingCacheKey != null) {
|
|
4798
|
-
if (isSuspense(
|
|
4799
|
-
queuePostRenderEffect(
|
|
4800
|
-
|
|
4801
|
-
|
|
5031
|
+
if (isSuspense(keepAliveInstance.subTree.type)) {
|
|
5032
|
+
queuePostRenderEffect(
|
|
5033
|
+
() => {
|
|
5034
|
+
cache.set(
|
|
5035
|
+
pendingCacheKey,
|
|
5036
|
+
getInnerChild(keepAliveInstance.subTree)
|
|
5037
|
+
);
|
|
5038
|
+
},
|
|
5039
|
+
void 0,
|
|
5040
|
+
keepAliveInstance.subTree.suspense
|
|
5041
|
+
);
|
|
4802
5042
|
} else {
|
|
4803
|
-
cache.set(pendingCacheKey, getInnerChild(
|
|
5043
|
+
cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
4804
5044
|
}
|
|
4805
5045
|
}
|
|
4806
5046
|
};
|
|
@@ -4808,12 +5048,12 @@ const KeepAliveImpl = {
|
|
|
4808
5048
|
onUpdated(cacheSubtree);
|
|
4809
5049
|
onBeforeUnmount(() => {
|
|
4810
5050
|
cache.forEach((cached) => {
|
|
4811
|
-
const { subTree, suspense } =
|
|
5051
|
+
const { subTree, suspense } = keepAliveInstance;
|
|
4812
5052
|
const vnode = getInnerChild(subTree);
|
|
4813
5053
|
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
4814
5054
|
resetShapeFlag(vnode);
|
|
4815
5055
|
const da = vnode.component.da;
|
|
4816
|
-
da && queuePostRenderEffect(da, suspense);
|
|
5056
|
+
da && queuePostRenderEffect(da, void 0, suspense);
|
|
4817
5057
|
return;
|
|
4818
5058
|
}
|
|
4819
5059
|
unmount(cached);
|
|
@@ -4899,7 +5139,7 @@ function onActivated(hook, target) {
|
|
|
4899
5139
|
function onDeactivated(hook, target) {
|
|
4900
5140
|
registerKeepAliveHook(hook, "da", target);
|
|
4901
5141
|
}
|
|
4902
|
-
function registerKeepAliveHook(hook, type, target =
|
|
5142
|
+
function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
|
|
4903
5143
|
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
4904
5144
|
let current = target;
|
|
4905
5145
|
while (current) {
|
|
@@ -4913,7 +5153,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
4913
5153
|
injectHook(type, wrappedHook, target);
|
|
4914
5154
|
if (target) {
|
|
4915
5155
|
let current = target.parent;
|
|
4916
|
-
while (current && current.parent) {
|
|
5156
|
+
while (current && current.parent && current.parent.vnode) {
|
|
4917
5157
|
if (isKeepAlive(current.parent.vnode)) {
|
|
4918
5158
|
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4919
5159
|
}
|
|
@@ -4945,12 +5185,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4945
5185
|
if (target) {
|
|
4946
5186
|
const hooks = target[type] || (target[type] = []);
|
|
4947
5187
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
4948
|
-
|
|
4949
|
-
const
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
5188
|
+
const prevSub = setActiveSub();
|
|
5189
|
+
const prev = setCurrentInstance(target);
|
|
5190
|
+
try {
|
|
5191
|
+
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
5192
|
+
} finally {
|
|
5193
|
+
setCurrentInstance(...prev);
|
|
5194
|
+
setActiveSub(prevSub);
|
|
5195
|
+
}
|
|
4954
5196
|
});
|
|
4955
5197
|
if (prepend) {
|
|
4956
5198
|
hooks.unshift(wrappedHook);
|
|
@@ -5021,7 +5263,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
5021
5263
|
const res = (
|
|
5022
5264
|
// local registration
|
|
5023
5265
|
// check instance[type] first which is resolved for options API
|
|
5024
|
-
resolve(
|
|
5266
|
+
resolve(
|
|
5267
|
+
instance[type] || Component[type],
|
|
5268
|
+
name
|
|
5269
|
+
) || // global registration
|
|
5270
|
+
// @ts-expect-error filters only exist in compat mode
|
|
5025
5271
|
resolve(instance.appContext[type], name)
|
|
5026
5272
|
);
|
|
5027
5273
|
if (!res && maybeSelfReference) {
|
|
@@ -5115,7 +5361,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
5115
5361
|
}
|
|
5116
5362
|
|
|
5117
5363
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
5118
|
-
|
|
5364
|
+
let slot = slots[name];
|
|
5365
|
+
if (slot && slot.__vapor) {
|
|
5366
|
+
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
5367
|
+
ret.vs = { slot, fallback };
|
|
5368
|
+
return ret;
|
|
5369
|
+
}
|
|
5370
|
+
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
5119
5371
|
if (name !== "default") props.name = name;
|
|
5120
5372
|
return openBlock(), createBlock(
|
|
5121
5373
|
Fragment,
|
|
@@ -5124,7 +5376,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
5124
5376
|
64
|
|
5125
5377
|
);
|
|
5126
5378
|
}
|
|
5127
|
-
let slot = slots[name];
|
|
5128
5379
|
if (slot && slot.length > 1) {
|
|
5129
5380
|
warn$1(
|
|
5130
5381
|
`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 +5430,9 @@ function toHandlers(obj, preserveCaseIfNecessary) {
|
|
|
5179
5430
|
}
|
|
5180
5431
|
|
|
5181
5432
|
const getPublicInstance = (i) => {
|
|
5182
|
-
if (!i) return null;
|
|
5183
|
-
if (isStatefulComponent(i))
|
|
5433
|
+
if (!i || i.vapor) return null;
|
|
5434
|
+
if (isStatefulComponent(i))
|
|
5435
|
+
return getComponentPublicInstance(i);
|
|
5184
5436
|
return getPublicInstance(i.parent);
|
|
5185
5437
|
};
|
|
5186
5438
|
const publicPropertiesMap = (
|
|
@@ -5473,11 +5725,16 @@ function useAttrs() {
|
|
|
5473
5725
|
return getContext().attrs;
|
|
5474
5726
|
}
|
|
5475
5727
|
function getContext() {
|
|
5476
|
-
const i =
|
|
5728
|
+
const i = getCurrentGenericInstance();
|
|
5477
5729
|
if (!i) {
|
|
5478
5730
|
warn$1(`useContext() called without active instance.`);
|
|
5479
5731
|
}
|
|
5480
|
-
|
|
5732
|
+
if (i.vapor) {
|
|
5733
|
+
return i;
|
|
5734
|
+
} else {
|
|
5735
|
+
const ii = i;
|
|
5736
|
+
return ii.setupContext || (ii.setupContext = createSetupContext(ii));
|
|
5737
|
+
}
|
|
5481
5738
|
}
|
|
5482
5739
|
function normalizePropsOrEmits(props) {
|
|
5483
5740
|
return isArray(props) ? props.reduce(
|
|
@@ -5525,14 +5782,14 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
5525
5782
|
return ret;
|
|
5526
5783
|
}
|
|
5527
5784
|
function withAsyncContext(getAwaitable) {
|
|
5528
|
-
const ctx =
|
|
5785
|
+
const ctx = getCurrentGenericInstance();
|
|
5529
5786
|
if (!ctx) {
|
|
5530
5787
|
warn$1(
|
|
5531
5788
|
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
5532
5789
|
);
|
|
5533
5790
|
}
|
|
5534
5791
|
let awaitable = getAwaitable();
|
|
5535
|
-
|
|
5792
|
+
setCurrentInstance(null, void 0);
|
|
5536
5793
|
if (isPromise(awaitable)) {
|
|
5537
5794
|
awaitable = awaitable.catch((e) => {
|
|
5538
5795
|
setCurrentInstance(ctx);
|
|
@@ -5979,7 +6236,7 @@ function createAppContext() {
|
|
|
5979
6236
|
};
|
|
5980
6237
|
}
|
|
5981
6238
|
let uid$1 = 0;
|
|
5982
|
-
function createAppAPI(
|
|
6239
|
+
function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
5983
6240
|
return function createApp(rootComponent, rootProps = null) {
|
|
5984
6241
|
if (!isFunction(rootComponent)) {
|
|
5985
6242
|
rootComponent = extend({}, rootComponent);
|
|
@@ -6072,33 +6329,15 @@ function createAppAPI(render, hydrate) {
|
|
|
6072
6329
|
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
6330
|
);
|
|
6074
6331
|
}
|
|
6075
|
-
const
|
|
6076
|
-
vnode.appContext = context;
|
|
6077
|
-
if (namespace === true) {
|
|
6078
|
-
namespace = "svg";
|
|
6079
|
-
} else if (namespace === false) {
|
|
6080
|
-
namespace = void 0;
|
|
6081
|
-
}
|
|
6332
|
+
const instance = mount(app, rootContainer, isHydrate, namespace);
|
|
6082
6333
|
{
|
|
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);
|
|
6334
|
+
app._instance = instance;
|
|
6335
|
+
devtoolsInitApp(app, version);
|
|
6093
6336
|
}
|
|
6094
6337
|
isMounted = true;
|
|
6095
6338
|
app._container = rootContainer;
|
|
6096
6339
|
rootContainer.__vue_app__ = app;
|
|
6097
|
-
|
|
6098
|
-
app._instance = vnode.component;
|
|
6099
|
-
devtoolsInitApp(app, version);
|
|
6100
|
-
}
|
|
6101
|
-
return getComponentPublicInstance(vnode.component);
|
|
6340
|
+
return getPublicInstance(instance);
|
|
6102
6341
|
} else {
|
|
6103
6342
|
warn$1(
|
|
6104
6343
|
`App has already been mounted.
|
|
@@ -6121,7 +6360,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6121
6360
|
app._instance,
|
|
6122
6361
|
16
|
|
6123
6362
|
);
|
|
6124
|
-
|
|
6363
|
+
unmount(app);
|
|
6125
6364
|
{
|
|
6126
6365
|
app._instance = null;
|
|
6127
6366
|
devtoolsUnmountApp(app);
|
|
@@ -6162,6 +6401,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6162
6401
|
let currentApp = null;
|
|
6163
6402
|
|
|
6164
6403
|
function provide(key, value) {
|
|
6404
|
+
const currentInstance = getCurrentGenericInstance();
|
|
6165
6405
|
if (!currentInstance) {
|
|
6166
6406
|
{
|
|
6167
6407
|
warn$1(`provide() can only be used inside setup().`);
|
|
@@ -6176,9 +6416,9 @@ function provide(key, value) {
|
|
|
6176
6416
|
}
|
|
6177
6417
|
}
|
|
6178
6418
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
6179
|
-
const instance =
|
|
6419
|
+
const instance = getCurrentGenericInstance();
|
|
6180
6420
|
if (instance || currentApp) {
|
|
6181
|
-
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.
|
|
6421
|
+
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
|
|
6182
6422
|
if (provides && key in provides) {
|
|
6183
6423
|
return provides[key];
|
|
6184
6424
|
} else if (arguments.length > 1) {
|
|
@@ -6191,7 +6431,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
6191
6431
|
}
|
|
6192
6432
|
}
|
|
6193
6433
|
function hasInjectionContext() {
|
|
6194
|
-
return !!(
|
|
6434
|
+
return !!(getCurrentGenericInstance() || currentApp);
|
|
6195
6435
|
}
|
|
6196
6436
|
|
|
6197
6437
|
const internalObjectProto = {};
|
|
@@ -6199,7 +6439,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
|
|
|
6199
6439
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
6200
6440
|
|
|
6201
6441
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
6202
|
-
const props = {};
|
|
6442
|
+
const props = instance.props = {};
|
|
6203
6443
|
const attrs = createInternalObject();
|
|
6204
6444
|
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
6205
6445
|
setFullProps(instance, rawProps, props, attrs);
|
|
@@ -6209,7 +6449,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
|
6209
6449
|
}
|
|
6210
6450
|
}
|
|
6211
6451
|
{
|
|
6212
|
-
validateProps(rawProps || {}, props, instance);
|
|
6452
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6213
6453
|
}
|
|
6214
6454
|
if (isStateful) {
|
|
6215
6455
|
instance.props = isSSR ? props : shallowReactive(props);
|
|
@@ -6261,11 +6501,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6261
6501
|
const camelizedKey = camelize(key);
|
|
6262
6502
|
props[camelizedKey] = resolvePropValue(
|
|
6263
6503
|
options,
|
|
6264
|
-
rawCurrentProps,
|
|
6265
6504
|
camelizedKey,
|
|
6266
6505
|
value,
|
|
6267
6506
|
instance,
|
|
6268
|
-
|
|
6507
|
+
baseResolveDefault
|
|
6269
6508
|
);
|
|
6270
6509
|
}
|
|
6271
6510
|
} else {
|
|
@@ -6292,10 +6531,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6292
6531
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
6293
6532
|
props[key] = resolvePropValue(
|
|
6294
6533
|
options,
|
|
6295
|
-
rawCurrentProps,
|
|
6296
6534
|
key,
|
|
6297
6535
|
void 0,
|
|
6298
6536
|
instance,
|
|
6537
|
+
baseResolveDefault,
|
|
6299
6538
|
true
|
|
6300
6539
|
);
|
|
6301
6540
|
}
|
|
@@ -6317,7 +6556,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6317
6556
|
trigger(instance.attrs, "set", "");
|
|
6318
6557
|
}
|
|
6319
6558
|
{
|
|
6320
|
-
validateProps(rawProps || {}, props, instance);
|
|
6559
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6321
6560
|
}
|
|
6322
6561
|
}
|
|
6323
6562
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
@@ -6346,39 +6585,37 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
6346
6585
|
}
|
|
6347
6586
|
}
|
|
6348
6587
|
if (needCastKeys) {
|
|
6349
|
-
const rawCurrentProps = toRaw(props);
|
|
6350
6588
|
const castValues = rawCastValues || EMPTY_OBJ;
|
|
6351
6589
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
6352
6590
|
const key = needCastKeys[i];
|
|
6353
6591
|
props[key] = resolvePropValue(
|
|
6354
6592
|
options,
|
|
6355
|
-
rawCurrentProps,
|
|
6356
6593
|
key,
|
|
6357
6594
|
castValues[key],
|
|
6358
6595
|
instance,
|
|
6596
|
+
baseResolveDefault,
|
|
6359
6597
|
!hasOwn(castValues, key)
|
|
6360
6598
|
);
|
|
6361
6599
|
}
|
|
6362
6600
|
}
|
|
6363
6601
|
return hasAttrsChanged;
|
|
6364
6602
|
}
|
|
6365
|
-
function resolvePropValue(options,
|
|
6603
|
+
function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
|
|
6366
6604
|
const opt = options[key];
|
|
6367
6605
|
if (opt != null) {
|
|
6368
6606
|
const hasDefault = hasOwn(opt, "default");
|
|
6369
6607
|
if (hasDefault && value === void 0) {
|
|
6370
6608
|
const defaultValue = opt.default;
|
|
6371
6609
|
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
6372
|
-
const
|
|
6373
|
-
if (key
|
|
6374
|
-
value =
|
|
6610
|
+
const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
|
|
6611
|
+
if (hasOwn(cachedDefaults, key)) {
|
|
6612
|
+
value = cachedDefaults[key];
|
|
6375
6613
|
} else {
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6614
|
+
value = cachedDefaults[key] = resolveDefault(
|
|
6615
|
+
defaultValue,
|
|
6616
|
+
instance,
|
|
6617
|
+
key
|
|
6380
6618
|
);
|
|
6381
|
-
reset();
|
|
6382
6619
|
}
|
|
6383
6620
|
} else {
|
|
6384
6621
|
value = defaultValue;
|
|
@@ -6397,6 +6634,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
6397
6634
|
}
|
|
6398
6635
|
return value;
|
|
6399
6636
|
}
|
|
6637
|
+
function baseResolveDefault(factory, instance, key) {
|
|
6638
|
+
let value;
|
|
6639
|
+
const prev = setCurrentInstance(instance);
|
|
6640
|
+
const props = toRaw(instance.props);
|
|
6641
|
+
value = factory.call(
|
|
6642
|
+
null,
|
|
6643
|
+
props
|
|
6644
|
+
);
|
|
6645
|
+
setCurrentInstance(...prev);
|
|
6646
|
+
return value;
|
|
6647
|
+
}
|
|
6400
6648
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
6401
6649
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
6402
6650
|
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
@@ -6431,6 +6679,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6431
6679
|
}
|
|
6432
6680
|
return EMPTY_ARR;
|
|
6433
6681
|
}
|
|
6682
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
6683
|
+
const res = [normalized, needCastKeys];
|
|
6684
|
+
if (isObject(comp)) {
|
|
6685
|
+
cache.set(comp, res);
|
|
6686
|
+
}
|
|
6687
|
+
return res;
|
|
6688
|
+
}
|
|
6689
|
+
function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
|
|
6434
6690
|
if (isArray(raw)) {
|
|
6435
6691
|
for (let i = 0; i < raw.length; i++) {
|
|
6436
6692
|
if (!isString(raw[i])) {
|
|
@@ -6475,11 +6731,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6475
6731
|
}
|
|
6476
6732
|
}
|
|
6477
6733
|
}
|
|
6478
|
-
const res = [normalized, needCastKeys];
|
|
6479
|
-
if (isObject(comp)) {
|
|
6480
|
-
cache.set(comp, res);
|
|
6481
|
-
}
|
|
6482
|
-
return res;
|
|
6483
6734
|
}
|
|
6484
6735
|
function validatePropName(key) {
|
|
6485
6736
|
if (key[0] !== "$" && !isReservedProp(key)) {
|
|
@@ -6501,26 +6752,26 @@ function getType(ctor) {
|
|
|
6501
6752
|
}
|
|
6502
6753
|
return "";
|
|
6503
6754
|
}
|
|
6504
|
-
function validateProps(rawProps,
|
|
6505
|
-
|
|
6506
|
-
const options = instance.propsOptions[0];
|
|
6755
|
+
function validateProps(rawProps, resolvedProps, options) {
|
|
6756
|
+
resolvedProps = toRaw(resolvedProps);
|
|
6507
6757
|
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
|
6508
6758
|
for (const key in options) {
|
|
6509
|
-
|
|
6510
|
-
if (opt
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6759
|
+
const opt = options[key];
|
|
6760
|
+
if (opt != null) {
|
|
6761
|
+
validateProp(
|
|
6762
|
+
key,
|
|
6763
|
+
resolvedProps[key],
|
|
6764
|
+
opt,
|
|
6765
|
+
resolvedProps,
|
|
6766
|
+
!camelizePropsKey.includes(key)
|
|
6767
|
+
);
|
|
6768
|
+
}
|
|
6518
6769
|
}
|
|
6519
6770
|
}
|
|
6520
|
-
function validateProp(
|
|
6521
|
-
const { type, required, validator, skipCheck } =
|
|
6771
|
+
function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
|
|
6772
|
+
const { type, required, validator, skipCheck } = propOptions;
|
|
6522
6773
|
if (required && isAbsent) {
|
|
6523
|
-
warn$1('Missing required prop: "' +
|
|
6774
|
+
warn$1('Missing required prop: "' + key + '"');
|
|
6524
6775
|
return;
|
|
6525
6776
|
}
|
|
6526
6777
|
if (value == null && !required) {
|
|
@@ -6536,12 +6787,12 @@ function validateProp(name, value, prop, props, isAbsent) {
|
|
|
6536
6787
|
isValid = valid;
|
|
6537
6788
|
}
|
|
6538
6789
|
if (!isValid) {
|
|
6539
|
-
warn$1(getInvalidTypeMessage(
|
|
6790
|
+
warn$1(getInvalidTypeMessage(key, value, expectedTypes));
|
|
6540
6791
|
return;
|
|
6541
6792
|
}
|
|
6542
6793
|
}
|
|
6543
|
-
if (validator && !validator(value,
|
|
6544
|
-
warn$1('Invalid prop: custom validator check failed for prop "' +
|
|
6794
|
+
if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
|
|
6795
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
|
|
6545
6796
|
}
|
|
6546
6797
|
}
|
|
6547
6798
|
const isSimpleType = /* @__PURE__ */ makeMap(
|
|
@@ -6612,7 +6863,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
|
|
|
6612
6863
|
return rawSlot;
|
|
6613
6864
|
}
|
|
6614
6865
|
const normalized = withCtx((...args) => {
|
|
6615
|
-
if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6866
|
+
if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6616
6867
|
warn$1(
|
|
6617
6868
|
`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
6869
|
);
|
|
@@ -6709,12 +6960,15 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6709
6960
|
|
|
6710
6961
|
let supported;
|
|
6711
6962
|
let perf;
|
|
6963
|
+
let cachedNow$1 = 0;
|
|
6964
|
+
const p$1 = /* @__PURE__ */ Promise.resolve();
|
|
6965
|
+
const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
|
|
6712
6966
|
function startMeasure(instance, type) {
|
|
6713
6967
|
if (instance.appContext.config.performance && isSupported()) {
|
|
6714
6968
|
perf.mark(`vue-${type}-${instance.uid}`);
|
|
6715
6969
|
}
|
|
6716
6970
|
{
|
|
6717
|
-
devtoolsPerfStart(instance, type,
|
|
6971
|
+
devtoolsPerfStart(instance, type, getNow$1());
|
|
6718
6972
|
}
|
|
6719
6973
|
}
|
|
6720
6974
|
function endMeasure(instance, type) {
|
|
@@ -6731,7 +6985,7 @@ function endMeasure(instance, type) {
|
|
|
6731
6985
|
perf.clearMarks(endTag);
|
|
6732
6986
|
}
|
|
6733
6987
|
{
|
|
6734
|
-
devtoolsPerfEnd(instance, type,
|
|
6988
|
+
devtoolsPerfEnd(instance, type, getNow$1());
|
|
6735
6989
|
}
|
|
6736
6990
|
}
|
|
6737
6991
|
function isSupported() {
|
|
@@ -6815,6 +7069,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6815
7069
|
optimized
|
|
6816
7070
|
);
|
|
6817
7071
|
break;
|
|
7072
|
+
case VaporSlot:
|
|
7073
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
|
|
7074
|
+
break;
|
|
6818
7075
|
default:
|
|
6819
7076
|
if (shapeFlag & 1) {
|
|
6820
7077
|
processElement(
|
|
@@ -7027,11 +7284,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7027
7284
|
}
|
|
7028
7285
|
hostInsert(el, container, anchor);
|
|
7029
7286
|
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
|
7030
|
-
queuePostRenderEffect(
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7287
|
+
queuePostRenderEffect(
|
|
7288
|
+
() => {
|
|
7289
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7290
|
+
needCallTransitionHooks && transition.enter(el);
|
|
7291
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
7292
|
+
},
|
|
7293
|
+
void 0,
|
|
7294
|
+
parentSuspense
|
|
7295
|
+
);
|
|
7035
7296
|
}
|
|
7036
7297
|
};
|
|
7037
7298
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
@@ -7043,8 +7304,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7043
7304
|
hostSetScopeId(el, slotScopeIds[i]);
|
|
7044
7305
|
}
|
|
7045
7306
|
}
|
|
7046
|
-
|
|
7047
|
-
|
|
7307
|
+
let subTree = parentComponent && parentComponent.subTree;
|
|
7308
|
+
if (subTree) {
|
|
7048
7309
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
7049
7310
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
7050
7311
|
}
|
|
@@ -7161,10 +7422,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7161
7422
|
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
7162
7423
|
}
|
|
7163
7424
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
7164
|
-
queuePostRenderEffect(
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7425
|
+
queuePostRenderEffect(
|
|
7426
|
+
() => {
|
|
7427
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
7428
|
+
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
7429
|
+
},
|
|
7430
|
+
void 0,
|
|
7431
|
+
parentSuspense
|
|
7432
|
+
);
|
|
7168
7433
|
}
|
|
7169
7434
|
};
|
|
7170
7435
|
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
|
@@ -7292,7 +7557,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7292
7557
|
};
|
|
7293
7558
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
7294
7559
|
n2.slotScopeIds = slotScopeIds;
|
|
7295
|
-
if (
|
|
7560
|
+
if (n2.type.__vapor) {
|
|
7561
|
+
if (n1 == null) {
|
|
7562
|
+
getVaporInterface(parentComponent, n2).mount(
|
|
7563
|
+
n2,
|
|
7564
|
+
container,
|
|
7565
|
+
anchor,
|
|
7566
|
+
parentComponent
|
|
7567
|
+
);
|
|
7568
|
+
} else {
|
|
7569
|
+
getVaporInterface(parentComponent, n2).update(
|
|
7570
|
+
n1,
|
|
7571
|
+
n2,
|
|
7572
|
+
shouldUpdateComponent(n1, n2, optimized)
|
|
7573
|
+
);
|
|
7574
|
+
}
|
|
7575
|
+
} else if (n1 == null) {
|
|
7296
7576
|
if (n2.shapeFlag & 512) {
|
|
7297
7577
|
parentComponent.ctx.activate(
|
|
7298
7578
|
n2,
|
|
@@ -7378,15 +7658,52 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7378
7658
|
return;
|
|
7379
7659
|
} else {
|
|
7380
7660
|
instance.next = n2;
|
|
7381
|
-
instance.
|
|
7661
|
+
instance.effect.run();
|
|
7382
7662
|
}
|
|
7383
7663
|
} else {
|
|
7384
7664
|
n2.el = n1.el;
|
|
7385
7665
|
instance.vnode = n2;
|
|
7386
7666
|
}
|
|
7387
7667
|
};
|
|
7388
|
-
|
|
7389
|
-
|
|
7668
|
+
class SetupRenderEffect extends ReactiveEffect {
|
|
7669
|
+
constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
|
|
7670
|
+
const prevScope = setCurrentScope(instance.scope);
|
|
7671
|
+
super();
|
|
7672
|
+
this.instance = instance;
|
|
7673
|
+
this.initialVNode = initialVNode;
|
|
7674
|
+
this.container = container;
|
|
7675
|
+
this.anchor = anchor;
|
|
7676
|
+
this.parentSuspense = parentSuspense;
|
|
7677
|
+
this.namespace = namespace;
|
|
7678
|
+
this.optimized = optimized;
|
|
7679
|
+
setCurrentScope(prevScope);
|
|
7680
|
+
this.job = instance.job = () => {
|
|
7681
|
+
if (this.dirty) {
|
|
7682
|
+
this.run();
|
|
7683
|
+
}
|
|
7684
|
+
};
|
|
7685
|
+
this.job.i = instance;
|
|
7686
|
+
{
|
|
7687
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7688
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
notify() {
|
|
7692
|
+
if (!(this.flags & 256)) {
|
|
7693
|
+
const job = this.job;
|
|
7694
|
+
queueJob(job, job.i.uid);
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
fn() {
|
|
7698
|
+
const {
|
|
7699
|
+
instance,
|
|
7700
|
+
initialVNode,
|
|
7701
|
+
container,
|
|
7702
|
+
anchor,
|
|
7703
|
+
parentSuspense,
|
|
7704
|
+
namespace,
|
|
7705
|
+
optimized
|
|
7706
|
+
} = this;
|
|
7390
7707
|
if (!instance.isMounted) {
|
|
7391
7708
|
let vnodeHook;
|
|
7392
7709
|
const { el, props } = initialVNode;
|
|
@@ -7462,23 +7779,24 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7462
7779
|
initialVNode.el = subTree.el;
|
|
7463
7780
|
}
|
|
7464
7781
|
if (m) {
|
|
7465
|
-
queuePostRenderEffect(m, parentSuspense);
|
|
7782
|
+
queuePostRenderEffect(m, void 0, parentSuspense);
|
|
7466
7783
|
}
|
|
7467
7784
|
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
|
7468
7785
|
const scopedInitialVNode = initialVNode;
|
|
7469
7786
|
queuePostRenderEffect(
|
|
7470
7787
|
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
|
7788
|
+
void 0,
|
|
7471
7789
|
parentSuspense
|
|
7472
7790
|
);
|
|
7473
7791
|
}
|
|
7474
|
-
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7475
|
-
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7792
|
+
if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7793
|
+
instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
|
|
7476
7794
|
}
|
|
7477
7795
|
instance.isMounted = true;
|
|
7478
7796
|
{
|
|
7479
7797
|
devtoolsComponentAdded(instance);
|
|
7480
7798
|
}
|
|
7481
|
-
initialVNode = container = anchor = null;
|
|
7799
|
+
this.initialVNode = this.container = this.anchor = null;
|
|
7482
7800
|
} else {
|
|
7483
7801
|
let { next, bu, u, parent, vnode } = instance;
|
|
7484
7802
|
{
|
|
@@ -7490,7 +7808,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7490
7808
|
}
|
|
7491
7809
|
nonHydratedAsyncRoot.asyncDep.then(() => {
|
|
7492
7810
|
if (!instance.isUnmounted) {
|
|
7493
|
-
|
|
7811
|
+
this.fn();
|
|
7494
7812
|
}
|
|
7495
7813
|
});
|
|
7496
7814
|
return;
|
|
@@ -7546,11 +7864,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7546
7864
|
updateHOCHostEl(instance, nextTree.el);
|
|
7547
7865
|
}
|
|
7548
7866
|
if (u) {
|
|
7549
|
-
queuePostRenderEffect(u, parentSuspense);
|
|
7867
|
+
queuePostRenderEffect(u, void 0, parentSuspense);
|
|
7550
7868
|
}
|
|
7551
7869
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
7552
7870
|
queuePostRenderEffect(
|
|
7553
7871
|
() => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
|
7872
|
+
void 0,
|
|
7554
7873
|
parentSuspense
|
|
7555
7874
|
);
|
|
7556
7875
|
}
|
|
@@ -7561,21 +7880,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7561
7880
|
popWarningContext();
|
|
7562
7881
|
}
|
|
7563
7882
|
}
|
|
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
7883
|
}
|
|
7578
|
-
|
|
7884
|
+
}
|
|
7885
|
+
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
|
7886
|
+
const effect = instance.effect = new SetupRenderEffect(
|
|
7887
|
+
instance,
|
|
7888
|
+
initialVNode,
|
|
7889
|
+
container,
|
|
7890
|
+
anchor,
|
|
7891
|
+
parentSuspense,
|
|
7892
|
+
namespace,
|
|
7893
|
+
optimized
|
|
7894
|
+
);
|
|
7895
|
+
instance.update = effect.run.bind(effect);
|
|
7896
|
+
toggleRecurse(instance, true);
|
|
7897
|
+
effect.run();
|
|
7579
7898
|
};
|
|
7580
7899
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
7581
7900
|
nextVNode.component = instance;
|
|
@@ -7584,9 +7903,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7584
7903
|
instance.next = null;
|
|
7585
7904
|
updateProps(instance, nextVNode.props, prevProps, optimized);
|
|
7586
7905
|
updateSlots(instance, nextVNode.children, optimized);
|
|
7587
|
-
|
|
7906
|
+
const prevSub = setActiveSub();
|
|
7588
7907
|
flushPreFlushCbs(instance);
|
|
7589
|
-
|
|
7908
|
+
setActiveSub(prevSub);
|
|
7590
7909
|
};
|
|
7591
7910
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
|
7592
7911
|
const c1 = n1 && n1.children;
|
|
@@ -7863,7 +8182,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7863
8182
|
);
|
|
7864
8183
|
} else if (moved) {
|
|
7865
8184
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7866
|
-
move(
|
|
8185
|
+
move(
|
|
8186
|
+
nextChild,
|
|
8187
|
+
container,
|
|
8188
|
+
anchor,
|
|
8189
|
+
2,
|
|
8190
|
+
parentComponent
|
|
8191
|
+
);
|
|
7867
8192
|
} else {
|
|
7868
8193
|
j--;
|
|
7869
8194
|
}
|
|
@@ -7871,10 +8196,20 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7871
8196
|
}
|
|
7872
8197
|
}
|
|
7873
8198
|
};
|
|
7874
|
-
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
8199
|
+
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
7875
8200
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7876
8201
|
if (shapeFlag & 6) {
|
|
7877
|
-
|
|
8202
|
+
if (type.__vapor) {
|
|
8203
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
|
|
8204
|
+
} else {
|
|
8205
|
+
move(
|
|
8206
|
+
vnode.component.subTree,
|
|
8207
|
+
container,
|
|
8208
|
+
anchor,
|
|
8209
|
+
moveType,
|
|
8210
|
+
parentComponent
|
|
8211
|
+
);
|
|
8212
|
+
}
|
|
7878
8213
|
return;
|
|
7879
8214
|
}
|
|
7880
8215
|
if (shapeFlag & 128) {
|
|
@@ -7882,13 +8217,25 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7882
8217
|
return;
|
|
7883
8218
|
}
|
|
7884
8219
|
if (shapeFlag & 64) {
|
|
7885
|
-
type.move(
|
|
8220
|
+
type.move(
|
|
8221
|
+
vnode,
|
|
8222
|
+
container,
|
|
8223
|
+
anchor,
|
|
8224
|
+
internals,
|
|
8225
|
+
parentComponent
|
|
8226
|
+
);
|
|
7886
8227
|
return;
|
|
7887
8228
|
}
|
|
7888
8229
|
if (type === Fragment) {
|
|
7889
8230
|
hostInsert(el, container, anchor);
|
|
7890
8231
|
for (let i = 0; i < children.length; i++) {
|
|
7891
|
-
move(
|
|
8232
|
+
move(
|
|
8233
|
+
children[i],
|
|
8234
|
+
container,
|
|
8235
|
+
anchor,
|
|
8236
|
+
moveType,
|
|
8237
|
+
parentComponent
|
|
8238
|
+
);
|
|
7892
8239
|
}
|
|
7893
8240
|
hostInsert(vnode.anchor, container, anchor);
|
|
7894
8241
|
return;
|
|
@@ -7902,7 +8249,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7902
8249
|
if (moveType === 0) {
|
|
7903
8250
|
transition.beforeEnter(el);
|
|
7904
8251
|
hostInsert(el, container, anchor);
|
|
7905
|
-
queuePostRenderEffect(
|
|
8252
|
+
queuePostRenderEffect(
|
|
8253
|
+
() => transition.enter(el),
|
|
8254
|
+
void 0,
|
|
8255
|
+
parentSuspense
|
|
8256
|
+
);
|
|
7906
8257
|
} else {
|
|
7907
8258
|
const { leave, delayLeave, afterLeave } = transition;
|
|
7908
8259
|
const remove2 = () => {
|
|
@@ -7944,9 +8295,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7944
8295
|
optimized = false;
|
|
7945
8296
|
}
|
|
7946
8297
|
if (ref != null) {
|
|
7947
|
-
|
|
8298
|
+
const prevSub = setActiveSub();
|
|
7948
8299
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7949
|
-
|
|
8300
|
+
setActiveSub(prevSub);
|
|
7950
8301
|
}
|
|
7951
8302
|
if (cacheIndex != null) {
|
|
7952
8303
|
parentComponent.renderCache[cacheIndex] = void 0;
|
|
@@ -7962,7 +8313,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7962
8313
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7963
8314
|
}
|
|
7964
8315
|
if (shapeFlag & 6) {
|
|
7965
|
-
|
|
8316
|
+
if (type.__vapor) {
|
|
8317
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8318
|
+
return;
|
|
8319
|
+
} else {
|
|
8320
|
+
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
8321
|
+
}
|
|
7966
8322
|
} else {
|
|
7967
8323
|
if (shapeFlag & 128) {
|
|
7968
8324
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -7996,15 +8352,23 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7996
8352
|
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
|
7997
8353
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7998
8354
|
}
|
|
8355
|
+
if (type === VaporSlot) {
|
|
8356
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8357
|
+
return;
|
|
8358
|
+
}
|
|
7999
8359
|
if (doRemove) {
|
|
8000
8360
|
remove(vnode);
|
|
8001
8361
|
}
|
|
8002
8362
|
}
|
|
8003
8363
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
|
8004
|
-
queuePostRenderEffect(
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8364
|
+
queuePostRenderEffect(
|
|
8365
|
+
() => {
|
|
8366
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
8367
|
+
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
8368
|
+
},
|
|
8369
|
+
void 0,
|
|
8370
|
+
parentSuspense
|
|
8371
|
+
);
|
|
8008
8372
|
}
|
|
8009
8373
|
};
|
|
8010
8374
|
const remove = (vnode) => {
|
|
@@ -8061,7 +8425,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8061
8425
|
const {
|
|
8062
8426
|
bum,
|
|
8063
8427
|
scope,
|
|
8064
|
-
|
|
8428
|
+
effect,
|
|
8065
8429
|
subTree,
|
|
8066
8430
|
um,
|
|
8067
8431
|
m,
|
|
@@ -8080,16 +8444,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8080
8444
|
});
|
|
8081
8445
|
}
|
|
8082
8446
|
scope.stop();
|
|
8083
|
-
if (
|
|
8084
|
-
|
|
8447
|
+
if (effect) {
|
|
8448
|
+
effect.stop();
|
|
8085
8449
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8086
8450
|
}
|
|
8087
8451
|
if (um) {
|
|
8088
|
-
queuePostRenderEffect(um, parentSuspense);
|
|
8452
|
+
queuePostRenderEffect(um, void 0, parentSuspense);
|
|
8089
8453
|
}
|
|
8090
|
-
queuePostRenderEffect(
|
|
8091
|
-
instance.isUnmounted = true
|
|
8092
|
-
|
|
8454
|
+
queuePostRenderEffect(
|
|
8455
|
+
() => instance.isUnmounted = true,
|
|
8456
|
+
void 0,
|
|
8457
|
+
parentSuspense
|
|
8458
|
+
);
|
|
8093
8459
|
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
|
8094
8460
|
parentSuspense.deps--;
|
|
8095
8461
|
if (parentSuspense.deps === 0) {
|
|
@@ -8107,6 +8473,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8107
8473
|
};
|
|
8108
8474
|
const getNextHostNode = (vnode) => {
|
|
8109
8475
|
if (vnode.shapeFlag & 6) {
|
|
8476
|
+
if (vnode.type.__vapor) {
|
|
8477
|
+
return hostNextSibling(vnode.component.block);
|
|
8478
|
+
}
|
|
8110
8479
|
return getNextHostNode(vnode.component.subTree);
|
|
8111
8480
|
}
|
|
8112
8481
|
if (vnode.shapeFlag & 128) {
|
|
@@ -8116,7 +8485,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8116
8485
|
const teleportEnd = el && el[TeleportEndKey];
|
|
8117
8486
|
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
8118
8487
|
};
|
|
8119
|
-
let isFlushing = false;
|
|
8120
8488
|
const render = (vnode, container, namespace) => {
|
|
8121
8489
|
if (vnode == null) {
|
|
8122
8490
|
if (container._vnode) {
|
|
@@ -8133,13 +8501,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8133
8501
|
namespace
|
|
8134
8502
|
);
|
|
8135
8503
|
}
|
|
8136
|
-
container._vnode = vnode;
|
|
8137
|
-
|
|
8138
|
-
isFlushing = true;
|
|
8139
|
-
flushPreFlushCbs();
|
|
8140
|
-
flushPostFlushCbs();
|
|
8141
|
-
isFlushing = false;
|
|
8142
|
-
}
|
|
8504
|
+
container._vnode = vnode;
|
|
8505
|
+
flushOnAppMount();
|
|
8143
8506
|
};
|
|
8144
8507
|
const internals = {
|
|
8145
8508
|
p: patch,
|
|
@@ -8147,6 +8510,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8147
8510
|
m: move,
|
|
8148
8511
|
r: remove,
|
|
8149
8512
|
mt: mountComponent,
|
|
8513
|
+
umt: unmountComponent,
|
|
8150
8514
|
mc: mountChildren,
|
|
8151
8515
|
pc: patchChildren,
|
|
8152
8516
|
pbc: patchBlockChildren,
|
|
@@ -8160,22 +8524,53 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8160
8524
|
internals
|
|
8161
8525
|
);
|
|
8162
8526
|
}
|
|
8527
|
+
const mountApp = (app, container, isHydrate, namespace) => {
|
|
8528
|
+
const vnode = app._ceVNode || createVNode(app._component, app._props);
|
|
8529
|
+
vnode.appContext = app._context;
|
|
8530
|
+
if (namespace === true) {
|
|
8531
|
+
namespace = "svg";
|
|
8532
|
+
} else if (namespace === false) {
|
|
8533
|
+
namespace = void 0;
|
|
8534
|
+
}
|
|
8535
|
+
{
|
|
8536
|
+
app._context.reload = () => {
|
|
8537
|
+
const cloned = cloneVNode(vnode);
|
|
8538
|
+
cloned.el = null;
|
|
8539
|
+
render(cloned, container, namespace);
|
|
8540
|
+
};
|
|
8541
|
+
}
|
|
8542
|
+
if (isHydrate && hydrate) {
|
|
8543
|
+
hydrate(vnode, container);
|
|
8544
|
+
} else {
|
|
8545
|
+
render(vnode, container, namespace);
|
|
8546
|
+
}
|
|
8547
|
+
return vnode.component;
|
|
8548
|
+
};
|
|
8549
|
+
const unmountApp = (app) => {
|
|
8550
|
+
render(null, app._container);
|
|
8551
|
+
};
|
|
8163
8552
|
return {
|
|
8164
8553
|
render,
|
|
8165
8554
|
hydrate,
|
|
8166
|
-
|
|
8555
|
+
internals,
|
|
8556
|
+
createApp: createAppAPI(
|
|
8557
|
+
mountApp,
|
|
8558
|
+
unmountApp,
|
|
8559
|
+
getComponentPublicInstance)
|
|
8167
8560
|
};
|
|
8168
8561
|
}
|
|
8169
8562
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8170
8563
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8171
8564
|
}
|
|
8172
|
-
function toggleRecurse({ effect, job }, allowed) {
|
|
8173
|
-
if (
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8565
|
+
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
8566
|
+
if (!vapor) {
|
|
8567
|
+
if (allowed) {
|
|
8568
|
+
effect.flags |= 128;
|
|
8569
|
+
job.flags |= 2;
|
|
8570
|
+
} else {
|
|
8571
|
+
effect.flags &= -129;
|
|
8572
|
+
job.flags &= -3;
|
|
8573
|
+
}
|
|
8179
8574
|
}
|
|
8180
8575
|
}
|
|
8181
8576
|
function needTransition(parentSuspense, transition) {
|
|
@@ -8208,48 +8603,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
8208
8603
|
}
|
|
8209
8604
|
}
|
|
8210
8605
|
}
|
|
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
8606
|
function locateNonHydratedAsyncRoot(instance) {
|
|
8252
|
-
const subComponent = instance.subTree.component;
|
|
8607
|
+
const subComponent = instance.vapor ? null : instance.subTree.component;
|
|
8253
8608
|
if (subComponent) {
|
|
8254
8609
|
if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
|
8255
8610
|
return subComponent;
|
|
@@ -8261,8 +8616,22 @@ function locateNonHydratedAsyncRoot(instance) {
|
|
|
8261
8616
|
function invalidateMount(hooks) {
|
|
8262
8617
|
if (hooks) {
|
|
8263
8618
|
for (let i = 0; i < hooks.length; i++)
|
|
8264
|
-
hooks[i].flags |=
|
|
8619
|
+
hooks[i].flags |= 4;
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
function getVaporInterface(instance, vnode) {
|
|
8623
|
+
const ctx = instance ? instance.appContext : vnode.appContext;
|
|
8624
|
+
const res = ctx && ctx.vapor;
|
|
8625
|
+
if (!res) {
|
|
8626
|
+
warn$1(
|
|
8627
|
+
`Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
|
|
8628
|
+
\`\`\`
|
|
8629
|
+
import { vaporInteropPlugin } from 'vue'
|
|
8630
|
+
app.use(vaporInteropPlugin)
|
|
8631
|
+
\`\`\``
|
|
8632
|
+
);
|
|
8265
8633
|
}
|
|
8634
|
+
return res;
|
|
8266
8635
|
}
|
|
8267
8636
|
|
|
8268
8637
|
const ssrContextKey = Symbol.for("v-scx");
|
|
@@ -8303,8 +8672,41 @@ function watch(source, cb, options) {
|
|
|
8303
8672
|
}
|
|
8304
8673
|
return doWatch(source, cb, options);
|
|
8305
8674
|
}
|
|
8675
|
+
class RenderWatcherEffect extends WatcherEffect {
|
|
8676
|
+
constructor(instance, source, cb, options, flush) {
|
|
8677
|
+
super(source, cb, options);
|
|
8678
|
+
this.flush = flush;
|
|
8679
|
+
const job = () => {
|
|
8680
|
+
if (this.dirty) {
|
|
8681
|
+
this.run();
|
|
8682
|
+
}
|
|
8683
|
+
};
|
|
8684
|
+
if (cb) {
|
|
8685
|
+
this.flags |= 128;
|
|
8686
|
+
job.flags |= 2;
|
|
8687
|
+
}
|
|
8688
|
+
if (instance) {
|
|
8689
|
+
job.i = instance;
|
|
8690
|
+
}
|
|
8691
|
+
this.job = job;
|
|
8692
|
+
}
|
|
8693
|
+
notify() {
|
|
8694
|
+
const flags = this.flags;
|
|
8695
|
+
if (!(flags & 256)) {
|
|
8696
|
+
const flush = this.flush;
|
|
8697
|
+
const job = this.job;
|
|
8698
|
+
if (flush === "post") {
|
|
8699
|
+
queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
|
|
8700
|
+
} else if (flush === "pre") {
|
|
8701
|
+
queueJob(job, job.i ? job.i.uid : void 0, true);
|
|
8702
|
+
} else {
|
|
8703
|
+
job();
|
|
8704
|
+
}
|
|
8705
|
+
}
|
|
8706
|
+
}
|
|
8707
|
+
}
|
|
8306
8708
|
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8307
|
-
const { immediate, deep, flush, once } = options;
|
|
8709
|
+
const { immediate, deep, flush = "pre", once } = options;
|
|
8308
8710
|
if (!cb) {
|
|
8309
8711
|
if (immediate !== void 0) {
|
|
8310
8712
|
warn$1(
|
|
@@ -8341,42 +8743,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
|
8341
8743
|
}
|
|
8342
8744
|
const instance = currentInstance;
|
|
8343
8745
|
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
};
|
|
8746
|
+
const effect = new RenderWatcherEffect(
|
|
8747
|
+
instance,
|
|
8748
|
+
source,
|
|
8749
|
+
cb,
|
|
8750
|
+
baseWatchOptions,
|
|
8751
|
+
flush
|
|
8752
|
+
);
|
|
8753
|
+
if (cb) {
|
|
8754
|
+
effect.run(true);
|
|
8755
|
+
} else if (flush === "post") {
|
|
8756
|
+
queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
|
|
8757
|
+
} else {
|
|
8758
|
+
effect.run(true);
|
|
8358
8759
|
}
|
|
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);
|
|
8760
|
+
const stop = effect.stop.bind(effect);
|
|
8761
|
+
stop.pause = effect.pause.bind(effect);
|
|
8762
|
+
stop.resume = effect.resume.bind(effect);
|
|
8763
|
+
stop.stop = stop;
|
|
8372
8764
|
if (isInSSRComponentSetup) {
|
|
8373
8765
|
if (ssrCleanup) {
|
|
8374
|
-
ssrCleanup.push(
|
|
8766
|
+
ssrCleanup.push(stop);
|
|
8375
8767
|
} else if (runsImmediately) {
|
|
8376
|
-
|
|
8768
|
+
stop();
|
|
8377
8769
|
}
|
|
8378
8770
|
}
|
|
8379
|
-
return
|
|
8771
|
+
return stop;
|
|
8380
8772
|
}
|
|
8381
8773
|
function instanceWatch(source, value, options) {
|
|
8382
8774
|
const publicThis = this.proxy;
|
|
@@ -8388,9 +8780,9 @@ function instanceWatch(source, value, options) {
|
|
|
8388
8780
|
cb = value.handler;
|
|
8389
8781
|
options = value;
|
|
8390
8782
|
}
|
|
8391
|
-
const
|
|
8783
|
+
const prev = setCurrentInstance(this);
|
|
8392
8784
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
8393
|
-
|
|
8785
|
+
setCurrentInstance(...prev);
|
|
8394
8786
|
return res;
|
|
8395
8787
|
}
|
|
8396
8788
|
function createPathGetter(ctx, path) {
|
|
@@ -8405,7 +8797,7 @@ function createPathGetter(ctx, path) {
|
|
|
8405
8797
|
}
|
|
8406
8798
|
|
|
8407
8799
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8408
|
-
const i =
|
|
8800
|
+
const i = getCurrentGenericInstance();
|
|
8409
8801
|
if (!i) {
|
|
8410
8802
|
warn$1(`useModel() called without active instance.`);
|
|
8411
8803
|
return ref();
|
|
@@ -8416,7 +8808,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8416
8808
|
return ref();
|
|
8417
8809
|
}
|
|
8418
8810
|
const hyphenatedName = hyphenate(name);
|
|
8419
|
-
const modifiers = getModelModifiers(props, camelizedName);
|
|
8811
|
+
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
8420
8812
|
const res = customRef((track, trigger) => {
|
|
8421
8813
|
let localValue;
|
|
8422
8814
|
let prevSetValue = EMPTY_OBJ;
|
|
@@ -8438,9 +8830,25 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8438
8830
|
if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
|
|
8439
8831
|
return;
|
|
8440
8832
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8833
|
+
let rawPropKeys;
|
|
8834
|
+
let parentPassedModelValue = false;
|
|
8835
|
+
let parentPassedModelUpdater = false;
|
|
8836
|
+
if (i.rawKeys) {
|
|
8837
|
+
rawPropKeys = i.rawKeys();
|
|
8838
|
+
} else {
|
|
8839
|
+
const rawProps = i.vnode.props;
|
|
8840
|
+
rawPropKeys = rawProps && Object.keys(rawProps);
|
|
8841
|
+
}
|
|
8842
|
+
if (rawPropKeys) {
|
|
8843
|
+
for (const key of rawPropKeys) {
|
|
8844
|
+
if (key === name || key === camelizedName || key === hyphenatedName) {
|
|
8845
|
+
parentPassedModelValue = true;
|
|
8846
|
+
} else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
|
|
8847
|
+
parentPassedModelUpdater = true;
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8850
|
+
}
|
|
8851
|
+
if (!parentPassedModelValue || !parentPassedModelUpdater) {
|
|
8444
8852
|
localValue = value;
|
|
8445
8853
|
trigger();
|
|
8446
8854
|
}
|
|
@@ -8467,21 +8875,26 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8467
8875
|
};
|
|
8468
8876
|
return res;
|
|
8469
8877
|
}
|
|
8470
|
-
const getModelModifiers = (props, modelName) => {
|
|
8471
|
-
return modelName === "modelValue" || modelName === "model-value" ? props
|
|
8878
|
+
const getModelModifiers = (props, modelName, getter) => {
|
|
8879
|
+
return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
|
|
8472
8880
|
};
|
|
8473
8881
|
|
|
8474
8882
|
function emit(instance, event, ...rawArgs) {
|
|
8883
|
+
return baseEmit(
|
|
8884
|
+
instance,
|
|
8885
|
+
instance.vnode.props || EMPTY_OBJ,
|
|
8886
|
+
defaultPropGetter,
|
|
8887
|
+
event,
|
|
8888
|
+
...rawArgs
|
|
8889
|
+
);
|
|
8890
|
+
}
|
|
8891
|
+
function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
8475
8892
|
if (instance.isUnmounted) return;
|
|
8476
|
-
const props = instance.vnode.props || EMPTY_OBJ;
|
|
8477
8893
|
{
|
|
8478
|
-
const {
|
|
8479
|
-
emitsOptions,
|
|
8480
|
-
propsOptions: [propsOptions]
|
|
8481
|
-
} = instance;
|
|
8894
|
+
const { emitsOptions, propsOptions } = instance;
|
|
8482
8895
|
if (emitsOptions) {
|
|
8483
8896
|
if (!(event in emitsOptions) && true) {
|
|
8484
|
-
if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
|
|
8897
|
+
if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
|
|
8485
8898
|
warn$1(
|
|
8486
8899
|
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
|
|
8487
8900
|
);
|
|
@@ -8501,7 +8914,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8501
8914
|
}
|
|
8502
8915
|
let args = rawArgs;
|
|
8503
8916
|
const isModelListener = event.startsWith("update:");
|
|
8504
|
-
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
8917
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
8505
8918
|
if (modifiers) {
|
|
8506
8919
|
if (modifiers.trim) {
|
|
8507
8920
|
args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
@@ -8515,7 +8928,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8515
8928
|
}
|
|
8516
8929
|
{
|
|
8517
8930
|
const lowerCaseEvent = event.toLowerCase();
|
|
8518
|
-
if (lowerCaseEvent !== event && props
|
|
8931
|
+
if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
|
|
8519
8932
|
warn$1(
|
|
8520
8933
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
8521
8934
|
instance,
|
|
@@ -8527,10 +8940,10 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8527
8940
|
}
|
|
8528
8941
|
}
|
|
8529
8942
|
let handlerName;
|
|
8530
|
-
let handler = props
|
|
8531
|
-
props
|
|
8943
|
+
let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
|
|
8944
|
+
getter(props, handlerName = toHandlerKey(camelize(event)));
|
|
8532
8945
|
if (!handler && isModelListener) {
|
|
8533
|
-
handler = props
|
|
8946
|
+
handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
|
|
8534
8947
|
}
|
|
8535
8948
|
if (handler) {
|
|
8536
8949
|
callWithAsyncErrorHandling(
|
|
@@ -8540,7 +8953,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8540
8953
|
args
|
|
8541
8954
|
);
|
|
8542
8955
|
}
|
|
8543
|
-
const onceHandler = props
|
|
8956
|
+
const onceHandler = getter(props, handlerName + `Once`);
|
|
8544
8957
|
if (onceHandler) {
|
|
8545
8958
|
if (!instance.emitted) {
|
|
8546
8959
|
instance.emitted = {};
|
|
@@ -8556,6 +8969,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8556
8969
|
);
|
|
8557
8970
|
}
|
|
8558
8971
|
}
|
|
8972
|
+
function defaultPropGetter(props, key) {
|
|
8973
|
+
return props[key];
|
|
8974
|
+
}
|
|
8559
8975
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
8560
8976
|
const cache = appContext.emitsCache;
|
|
8561
8977
|
const cached = cache.get(comp);
|
|
@@ -8883,7 +9299,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
8883
9299
|
return false;
|
|
8884
9300
|
}
|
|
8885
9301
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
8886
|
-
while (parent) {
|
|
9302
|
+
while (parent && !parent.vapor) {
|
|
8887
9303
|
const root = parent.subTree;
|
|
8888
9304
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
8889
9305
|
root.el = vnode.el;
|
|
@@ -9234,7 +9650,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9234
9650
|
pendingBranch,
|
|
9235
9651
|
container2,
|
|
9236
9652
|
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
9237
|
-
0
|
|
9653
|
+
0,
|
|
9654
|
+
parentComponent2
|
|
9238
9655
|
);
|
|
9239
9656
|
queuePostFlushCb(effects);
|
|
9240
9657
|
}
|
|
@@ -9247,7 +9664,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9247
9664
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
9248
9665
|
}
|
|
9249
9666
|
if (!delayEnter) {
|
|
9250
|
-
move(
|
|
9667
|
+
move(
|
|
9668
|
+
pendingBranch,
|
|
9669
|
+
container2,
|
|
9670
|
+
anchor,
|
|
9671
|
+
0,
|
|
9672
|
+
parentComponent2
|
|
9673
|
+
);
|
|
9251
9674
|
}
|
|
9252
9675
|
}
|
|
9253
9676
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -9320,7 +9743,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9320
9743
|
}
|
|
9321
9744
|
},
|
|
9322
9745
|
move(container2, anchor2, type) {
|
|
9323
|
-
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
9746
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
|
|
9324
9747
|
suspense.container = container2;
|
|
9325
9748
|
},
|
|
9326
9749
|
next() {
|
|
@@ -9460,7 +9883,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
9460
9883
|
}
|
|
9461
9884
|
return s;
|
|
9462
9885
|
}
|
|
9463
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
9886
|
+
function queueEffectWithSuspense(fn, id, suspense) {
|
|
9464
9887
|
if (suspense && suspense.pendingBranch) {
|
|
9465
9888
|
if (isArray(fn)) {
|
|
9466
9889
|
suspense.effects.push(...fn);
|
|
@@ -9468,7 +9891,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
9468
9891
|
suspense.effects.push(fn);
|
|
9469
9892
|
}
|
|
9470
9893
|
} else {
|
|
9471
|
-
queuePostFlushCb(fn);
|
|
9894
|
+
queuePostFlushCb(fn, id);
|
|
9472
9895
|
}
|
|
9473
9896
|
}
|
|
9474
9897
|
function setActiveBranch(suspense, branch) {
|
|
@@ -9494,6 +9917,7 @@ const Fragment = Symbol.for("v-fgt");
|
|
|
9494
9917
|
const Text = Symbol.for("v-txt");
|
|
9495
9918
|
const Comment = Symbol.for("v-cmt");
|
|
9496
9919
|
const Static = Symbol.for("v-stc");
|
|
9920
|
+
const VaporSlot = Symbol.for("v-vps");
|
|
9497
9921
|
const blockStack = [];
|
|
9498
9922
|
let currentBlock = null;
|
|
9499
9923
|
function openBlock(disableTracking = false) {
|
|
@@ -9867,6 +10291,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
9867
10291
|
]);
|
|
9868
10292
|
}
|
|
9869
10293
|
|
|
10294
|
+
let currentInstance = null;
|
|
10295
|
+
const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
|
|
10296
|
+
const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
|
|
10297
|
+
let isInSSRComponentSetup = false;
|
|
10298
|
+
let setInSSRSetupState;
|
|
10299
|
+
let simpleSetCurrentInstance;
|
|
10300
|
+
{
|
|
10301
|
+
const g = getGlobalThis();
|
|
10302
|
+
const registerGlobalSetter = (key, setter) => {
|
|
10303
|
+
let setters;
|
|
10304
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
10305
|
+
setters.push(setter);
|
|
10306
|
+
return (v) => {
|
|
10307
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
10308
|
+
else setters[0](v);
|
|
10309
|
+
};
|
|
10310
|
+
};
|
|
10311
|
+
simpleSetCurrentInstance = registerGlobalSetter(
|
|
10312
|
+
`__VUE_INSTANCE_SETTERS__`,
|
|
10313
|
+
(v) => currentInstance = v
|
|
10314
|
+
);
|
|
10315
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
10316
|
+
`__VUE_SSR_SETTERS__`,
|
|
10317
|
+
(v) => isInSSRComponentSetup = v
|
|
10318
|
+
);
|
|
10319
|
+
}
|
|
10320
|
+
const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
|
|
10321
|
+
try {
|
|
10322
|
+
return [currentInstance, setCurrentScope(scope)];
|
|
10323
|
+
} finally {
|
|
10324
|
+
simpleSetCurrentInstance(instance);
|
|
10325
|
+
}
|
|
10326
|
+
};
|
|
10327
|
+
|
|
9870
10328
|
const emptyAppContext = createAppContext();
|
|
9871
10329
|
let uid = 0;
|
|
9872
10330
|
function createComponentInstance(vnode, parent, suspense) {
|
|
@@ -9911,7 +10369,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9911
10369
|
// to be set immediately
|
|
9912
10370
|
emitted: null,
|
|
9913
10371
|
// props default value
|
|
9914
|
-
propsDefaults:
|
|
10372
|
+
propsDefaults: null,
|
|
9915
10373
|
// inheritAttrs
|
|
9916
10374
|
inheritAttrs: type.inheritAttrs,
|
|
9917
10375
|
// state
|
|
@@ -9958,44 +10416,6 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9958
10416
|
}
|
|
9959
10417
|
return instance;
|
|
9960
10418
|
}
|
|
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
10419
|
function validateComponentName(name, { isNativeTag }) {
|
|
10000
10420
|
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
10001
10421
|
warn$1(
|
|
@@ -10006,13 +10426,16 @@ function validateComponentName(name, { isNativeTag }) {
|
|
|
10006
10426
|
function isStatefulComponent(instance) {
|
|
10007
10427
|
return instance.vnode.shapeFlag & 4;
|
|
10008
10428
|
}
|
|
10009
|
-
let isInSSRComponentSetup = false;
|
|
10010
10429
|
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
10011
10430
|
isSSR && setInSSRSetupState(isSSR);
|
|
10012
|
-
const { props, children } = instance.vnode;
|
|
10431
|
+
const { props, children, vi } = instance.vnode;
|
|
10013
10432
|
const isStateful = isStatefulComponent(instance);
|
|
10014
|
-
|
|
10015
|
-
|
|
10433
|
+
if (vi) {
|
|
10434
|
+
vi(instance);
|
|
10435
|
+
} else {
|
|
10436
|
+
initProps(instance, props, isStateful, isSSR);
|
|
10437
|
+
initSlots(instance, children, optimized || isSSR);
|
|
10438
|
+
}
|
|
10016
10439
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
10017
10440
|
isSSR && setInSSRSetupState(false);
|
|
10018
10441
|
return setupResult;
|
|
@@ -10049,9 +10472,9 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10049
10472
|
}
|
|
10050
10473
|
const { setup } = Component;
|
|
10051
10474
|
if (setup) {
|
|
10052
|
-
|
|
10475
|
+
const prevSub = setActiveSub();
|
|
10053
10476
|
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
10054
|
-
const
|
|
10477
|
+
const prev = setCurrentInstance(instance);
|
|
10055
10478
|
const setupResult = callWithErrorHandling(
|
|
10056
10479
|
setup,
|
|
10057
10480
|
instance,
|
|
@@ -10062,12 +10485,15 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10062
10485
|
]
|
|
10063
10486
|
);
|
|
10064
10487
|
const isAsyncSetup = isPromise(setupResult);
|
|
10065
|
-
|
|
10066
|
-
|
|
10488
|
+
setActiveSub(prevSub);
|
|
10489
|
+
setCurrentInstance(...prev);
|
|
10067
10490
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
10068
10491
|
markAsyncBoundary(instance);
|
|
10069
10492
|
}
|
|
10070
10493
|
if (isAsyncSetup) {
|
|
10494
|
+
const unsetCurrentInstance = () => {
|
|
10495
|
+
setCurrentInstance(null, void 0);
|
|
10496
|
+
};
|
|
10071
10497
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
10072
10498
|
if (isSSR) {
|
|
10073
10499
|
return setupResult.then((resolvedResult) => {
|
|
@@ -10162,13 +10588,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
10162
10588
|
}
|
|
10163
10589
|
}
|
|
10164
10590
|
{
|
|
10165
|
-
const
|
|
10166
|
-
|
|
10591
|
+
const prevInstance = setCurrentInstance(instance);
|
|
10592
|
+
const prevSub = setActiveSub();
|
|
10167
10593
|
try {
|
|
10168
10594
|
applyOptions(instance);
|
|
10169
10595
|
} finally {
|
|
10170
|
-
|
|
10171
|
-
|
|
10596
|
+
setActiveSub(prevSub);
|
|
10597
|
+
setCurrentInstance(...prevInstance);
|
|
10172
10598
|
}
|
|
10173
10599
|
}
|
|
10174
10600
|
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
@@ -10205,29 +10631,6 @@ function getSlotsProxy(instance) {
|
|
|
10205
10631
|
});
|
|
10206
10632
|
}
|
|
10207
10633
|
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
10634
|
{
|
|
10232
10635
|
let attrsProxy;
|
|
10233
10636
|
let slotsProxy;
|
|
@@ -10241,10 +10644,33 @@ function createSetupContext(instance) {
|
|
|
10241
10644
|
get emit() {
|
|
10242
10645
|
return (event, ...args) => instance.emit(event, ...args);
|
|
10243
10646
|
},
|
|
10244
|
-
expose
|
|
10647
|
+
expose: (exposed) => expose(instance, exposed)
|
|
10245
10648
|
});
|
|
10246
10649
|
}
|
|
10247
10650
|
}
|
|
10651
|
+
function expose(instance, exposed) {
|
|
10652
|
+
{
|
|
10653
|
+
if (instance.exposed) {
|
|
10654
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
10655
|
+
}
|
|
10656
|
+
if (exposed != null) {
|
|
10657
|
+
let exposedType = typeof exposed;
|
|
10658
|
+
if (exposedType === "object") {
|
|
10659
|
+
if (isArray(exposed)) {
|
|
10660
|
+
exposedType = "array";
|
|
10661
|
+
} else if (isRef(exposed)) {
|
|
10662
|
+
exposedType = "ref";
|
|
10663
|
+
}
|
|
10664
|
+
}
|
|
10665
|
+
if (exposedType !== "object") {
|
|
10666
|
+
warn$1(
|
|
10667
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10668
|
+
);
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
}
|
|
10672
|
+
instance.exposed = exposed || {};
|
|
10673
|
+
}
|
|
10248
10674
|
function getComponentPublicInstance(instance) {
|
|
10249
10675
|
if (instance.exposed) {
|
|
10250
10676
|
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
@@ -10252,7 +10678,9 @@ function getComponentPublicInstance(instance) {
|
|
|
10252
10678
|
if (key in target) {
|
|
10253
10679
|
return target[key];
|
|
10254
10680
|
} else if (key in publicPropertiesMap) {
|
|
10255
|
-
return publicPropertiesMap[key](
|
|
10681
|
+
return publicPropertiesMap[key](
|
|
10682
|
+
instance
|
|
10683
|
+
);
|
|
10256
10684
|
}
|
|
10257
10685
|
},
|
|
10258
10686
|
has(target, key) {
|
|
@@ -10295,14 +10723,7 @@ function isClassComponent(value) {
|
|
|
10295
10723
|
}
|
|
10296
10724
|
|
|
10297
10725
|
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;
|
|
10726
|
+
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
10306
10727
|
};
|
|
10307
10728
|
|
|
10308
10729
|
function h(type, propsOrChildren, children) {
|
|
@@ -10343,9 +10764,9 @@ function initCustomFormatter() {
|
|
|
10343
10764
|
if (obj.__isVue) {
|
|
10344
10765
|
return ["div", vueStyle, `VueInstance`];
|
|
10345
10766
|
} else if (isRef(obj)) {
|
|
10346
|
-
|
|
10767
|
+
const prevSub = setActiveSub();
|
|
10347
10768
|
const value = obj.value;
|
|
10348
|
-
|
|
10769
|
+
setActiveSub(prevSub);
|
|
10349
10770
|
return [
|
|
10350
10771
|
"div",
|
|
10351
10772
|
{},
|
|
@@ -10532,7 +10953,7 @@ function isMemoSame(cached, memo) {
|
|
|
10532
10953
|
return true;
|
|
10533
10954
|
}
|
|
10534
10955
|
|
|
10535
|
-
const version = "3.
|
|
10956
|
+
const version = "3.6.0-alpha.2";
|
|
10536
10957
|
const warn = warn$1 ;
|
|
10537
10958
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10538
10959
|
const devtools = devtools$1 ;
|
|
@@ -11045,8 +11466,9 @@ function setVarsOnNode(el, vars) {
|
|
|
11045
11466
|
const style = el.style;
|
|
11046
11467
|
let cssText = "";
|
|
11047
11468
|
for (const key in vars) {
|
|
11048
|
-
|
|
11049
|
-
|
|
11469
|
+
const value = normalizeCssVarValue(vars[key]);
|
|
11470
|
+
style.setProperty(`--${key}`, value);
|
|
11471
|
+
cssText += `--${key}: ${value};`;
|
|
11050
11472
|
}
|
|
11051
11473
|
style[CSS_VAR_TEXT] = cssText;
|
|
11052
11474
|
}
|
|
@@ -11103,11 +11525,11 @@ function patchStyle(el, prev, next) {
|
|
|
11103
11525
|
}
|
|
11104
11526
|
const semicolonRE = /[^\\];\s*$/;
|
|
11105
11527
|
const importantRE = /\s*!important$/;
|
|
11106
|
-
function setStyle(style, name,
|
|
11107
|
-
if (isArray(
|
|
11108
|
-
|
|
11528
|
+
function setStyle(style, name, rawVal) {
|
|
11529
|
+
if (isArray(rawVal)) {
|
|
11530
|
+
rawVal.forEach((v) => setStyle(style, name, v));
|
|
11109
11531
|
} else {
|
|
11110
|
-
|
|
11532
|
+
const val = rawVal == null ? "" : String(rawVal);
|
|
11111
11533
|
{
|
|
11112
11534
|
if (semicolonRE.test(val)) {
|
|
11113
11535
|
warn(
|
|
@@ -11180,8 +11602,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
|
11180
11602
|
return;
|
|
11181
11603
|
}
|
|
11182
11604
|
const tag = el.tagName;
|
|
11183
|
-
if (key === "value" && tag
|
|
11184
|
-
!tag.includes("-")) {
|
|
11605
|
+
if (key === "value" && canSetValueDirectly(tag)) {
|
|
11185
11606
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
11186
11607
|
const newValue = value == null ? (
|
|
11187
11608
|
// #11647: value should be set as empty string for null and undefined,
|
|
@@ -11309,8 +11730,6 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
11309
11730
|
}
|
|
11310
11731
|
}
|
|
11311
11732
|
|
|
11312
|
-
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
11313
|
-
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
11314
11733
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
11315
11734
|
const isSVG = namespace === "svg";
|
|
11316
11735
|
if (key === "class") {
|
|
@@ -11350,24 +11769,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
11350
11769
|
}
|
|
11351
11770
|
return false;
|
|
11352
11771
|
}
|
|
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") {
|
|
11772
|
+
if (shouldSetAsAttr(el.tagName, key)) {
|
|
11363
11773
|
return false;
|
|
11364
11774
|
}
|
|
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
11775
|
if (isNativeOn(key) && isString(value)) {
|
|
11372
11776
|
return false;
|
|
11373
11777
|
}
|
|
@@ -11973,28 +12377,12 @@ const assignKey = Symbol("_assign");
|
|
|
11973
12377
|
const vModelText = {
|
|
11974
12378
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
11975
12379
|
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
|
-
}
|
|
12380
|
+
vModelTextInit(
|
|
12381
|
+
el,
|
|
12382
|
+
trim,
|
|
12383
|
+
number || !!(vnode.props && vnode.props.type === "number"),
|
|
12384
|
+
lazy
|
|
12385
|
+
);
|
|
11998
12386
|
},
|
|
11999
12387
|
// set value on mounted so it's after min/max for type="range"
|
|
12000
12388
|
mounted(el, { value }) {
|
|
@@ -12002,70 +12390,111 @@ const vModelText = {
|
|
|
12002
12390
|
},
|
|
12003
12391
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
12004
12392
|
el[assignKey] = getModelAssigner(vnode);
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12393
|
+
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
12394
|
+
}
|
|
12395
|
+
};
|
|
12396
|
+
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
12397
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
12398
|
+
if (e.target.composing) return;
|
|
12399
|
+
let domValue = el.value;
|
|
12400
|
+
if (trim) {
|
|
12401
|
+
domValue = domValue.trim();
|
|
12402
|
+
}
|
|
12403
|
+
if (number || el.type === "number") {
|
|
12404
|
+
domValue = looseToNumber(domValue);
|
|
12405
|
+
}
|
|
12406
|
+
(0, el[assignKey])(domValue);
|
|
12407
|
+
});
|
|
12408
|
+
if (trim) {
|
|
12409
|
+
addEventListener(el, "change", () => {
|
|
12410
|
+
el.value = el.value.trim();
|
|
12411
|
+
});
|
|
12412
|
+
}
|
|
12413
|
+
if (!lazy) {
|
|
12414
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
12415
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
12416
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
12417
|
+
}
|
|
12418
|
+
};
|
|
12419
|
+
const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
12420
|
+
if (el.composing) return;
|
|
12421
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
12422
|
+
const newValue = value == null ? "" : value;
|
|
12423
|
+
if (elValue === newValue) {
|
|
12424
|
+
return;
|
|
12425
|
+
}
|
|
12426
|
+
if (document.activeElement === el && el.type !== "range") {
|
|
12427
|
+
if (lazy && value === oldValue) {
|
|
12009
12428
|
return;
|
|
12010
12429
|
}
|
|
12011
|
-
if (
|
|
12012
|
-
|
|
12013
|
-
return;
|
|
12014
|
-
}
|
|
12015
|
-
if (trim && el.value.trim() === newValue) {
|
|
12016
|
-
return;
|
|
12017
|
-
}
|
|
12430
|
+
if (trim && el.value.trim() === newValue) {
|
|
12431
|
+
return;
|
|
12018
12432
|
}
|
|
12019
|
-
el.value = newValue;
|
|
12020
12433
|
}
|
|
12434
|
+
el.value = newValue;
|
|
12021
12435
|
};
|
|
12022
12436
|
const vModelCheckbox = {
|
|
12023
12437
|
// #4096 array checkboxes need to be deep traversed
|
|
12024
12438
|
deep: true,
|
|
12025
12439
|
created(el, _, vnode) {
|
|
12026
12440
|
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
|
-
});
|
|
12441
|
+
vModelCheckboxInit(el);
|
|
12054
12442
|
},
|
|
12055
12443
|
// set initial checked on mount to wait for true-value/false-value
|
|
12056
|
-
mounted
|
|
12444
|
+
mounted(el, binding, vnode) {
|
|
12445
|
+
vModelCheckboxUpdate(
|
|
12446
|
+
el,
|
|
12447
|
+
binding.oldValue,
|
|
12448
|
+
binding.value,
|
|
12449
|
+
vnode.props.value
|
|
12450
|
+
);
|
|
12451
|
+
},
|
|
12057
12452
|
beforeUpdate(el, binding, vnode) {
|
|
12058
12453
|
el[assignKey] = getModelAssigner(vnode);
|
|
12059
|
-
|
|
12454
|
+
vModelCheckboxUpdate(
|
|
12455
|
+
el,
|
|
12456
|
+
binding.oldValue,
|
|
12457
|
+
binding.value,
|
|
12458
|
+
vnode.props.value
|
|
12459
|
+
);
|
|
12060
12460
|
}
|
|
12061
12461
|
};
|
|
12062
|
-
|
|
12462
|
+
const vModelCheckboxInit = (el, set) => {
|
|
12463
|
+
addEventListener(el, "change", () => {
|
|
12464
|
+
const assign = el[assignKey];
|
|
12465
|
+
const modelValue = el._modelValue;
|
|
12466
|
+
const elementValue = getValue(el);
|
|
12467
|
+
const checked = el.checked;
|
|
12468
|
+
if (isArray(modelValue)) {
|
|
12469
|
+
const index = looseIndexOf(modelValue, elementValue);
|
|
12470
|
+
const found = index !== -1;
|
|
12471
|
+
if (checked && !found) {
|
|
12472
|
+
assign(modelValue.concat(elementValue));
|
|
12473
|
+
} else if (!checked && found) {
|
|
12474
|
+
const filtered = [...modelValue];
|
|
12475
|
+
filtered.splice(index, 1);
|
|
12476
|
+
assign(filtered);
|
|
12477
|
+
}
|
|
12478
|
+
} else if (isSet(modelValue)) {
|
|
12479
|
+
const cloned = new Set(modelValue);
|
|
12480
|
+
if (checked) {
|
|
12481
|
+
cloned.add(elementValue);
|
|
12482
|
+
} else {
|
|
12483
|
+
cloned.delete(elementValue);
|
|
12484
|
+
}
|
|
12485
|
+
assign(cloned);
|
|
12486
|
+
} else {
|
|
12487
|
+
assign(getCheckboxValue(el, checked));
|
|
12488
|
+
}
|
|
12489
|
+
});
|
|
12490
|
+
};
|
|
12491
|
+
const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
|
|
12063
12492
|
el._modelValue = value;
|
|
12064
12493
|
let checked;
|
|
12065
12494
|
if (isArray(value)) {
|
|
12066
|
-
checked = looseIndexOf(value,
|
|
12495
|
+
checked = looseIndexOf(value, rawValue) > -1;
|
|
12067
12496
|
} else if (isSet(value)) {
|
|
12068
|
-
checked = value.has(
|
|
12497
|
+
checked = value.has(rawValue);
|
|
12069
12498
|
} else {
|
|
12070
12499
|
if (value === oldValue) return;
|
|
12071
12500
|
checked = looseEqual(value, getCheckboxValue(el, true));
|
|
@@ -12073,7 +12502,7 @@ function setChecked(el, { value, oldValue }, vnode) {
|
|
|
12073
12502
|
if (el.checked !== checked) {
|
|
12074
12503
|
el.checked = checked;
|
|
12075
12504
|
}
|
|
12076
|
-
}
|
|
12505
|
+
};
|
|
12077
12506
|
const vModelRadio = {
|
|
12078
12507
|
created(el, { value }, vnode) {
|
|
12079
12508
|
el.checked = looseEqual(value, vnode.props.value);
|
|
@@ -12093,36 +12522,38 @@ const vModelSelect = {
|
|
|
12093
12522
|
// <select multiple> value need to be deep traversed
|
|
12094
12523
|
deep: true,
|
|
12095
12524
|
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
|
-
});
|
|
12525
|
+
vModelSelectInit(el, value, number);
|
|
12109
12526
|
el[assignKey] = getModelAssigner(vnode);
|
|
12110
12527
|
},
|
|
12111
12528
|
// set value in mounted & updated because <select> relies on its children
|
|
12112
12529
|
// <option>s.
|
|
12113
12530
|
mounted(el, { value }) {
|
|
12114
|
-
|
|
12531
|
+
vModelSetSelected(el, value);
|
|
12115
12532
|
},
|
|
12116
12533
|
beforeUpdate(el, _binding, vnode) {
|
|
12117
12534
|
el[assignKey] = getModelAssigner(vnode);
|
|
12118
12535
|
},
|
|
12119
12536
|
updated(el, { value }) {
|
|
12120
|
-
|
|
12121
|
-
setSelected(el, value);
|
|
12122
|
-
}
|
|
12537
|
+
vModelSetSelected(el, value);
|
|
12123
12538
|
}
|
|
12124
12539
|
};
|
|
12125
|
-
|
|
12540
|
+
const vModelSelectInit = (el, value, number, set) => {
|
|
12541
|
+
const isSetModel = isSet(value);
|
|
12542
|
+
addEventListener(el, "change", () => {
|
|
12543
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12544
|
+
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12545
|
+
);
|
|
12546
|
+
(0, el[assignKey])(
|
|
12547
|
+
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12548
|
+
);
|
|
12549
|
+
el._assigning = true;
|
|
12550
|
+
nextTick(() => {
|
|
12551
|
+
el._assigning = false;
|
|
12552
|
+
});
|
|
12553
|
+
});
|
|
12554
|
+
};
|
|
12555
|
+
const vModelSetSelected = (el, value) => {
|
|
12556
|
+
if (el._assigning) return;
|
|
12126
12557
|
const isMultiple = el.multiple;
|
|
12127
12558
|
const isArrayValue = isArray(value);
|
|
12128
12559
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -12153,13 +12584,20 @@ function setSelected(el, value) {
|
|
|
12153
12584
|
if (!isMultiple && el.selectedIndex !== -1) {
|
|
12154
12585
|
el.selectedIndex = -1;
|
|
12155
12586
|
}
|
|
12156
|
-
}
|
|
12587
|
+
};
|
|
12157
12588
|
function getValue(el) {
|
|
12158
12589
|
return "_value" in el ? el._value : el.value;
|
|
12159
12590
|
}
|
|
12160
12591
|
function getCheckboxValue(el, checked) {
|
|
12161
12592
|
const key = checked ? "_trueValue" : "_falseValue";
|
|
12162
|
-
|
|
12593
|
+
if (key in el) {
|
|
12594
|
+
return el[key];
|
|
12595
|
+
}
|
|
12596
|
+
const attr = checked ? "true-value" : "false-value";
|
|
12597
|
+
if (el.hasAttribute(attr)) {
|
|
12598
|
+
return el.getAttribute(attr);
|
|
12599
|
+
}
|
|
12600
|
+
return checked;
|
|
12163
12601
|
}
|
|
12164
12602
|
const vModelDynamic = {
|
|
12165
12603
|
created(el, binding, vnode) {
|