@vue/runtime-dom 3.5.16 → 3.6.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-dom.cjs.js +134 -117
- package/dist/runtime-dom.cjs.prod.js +134 -117
- package/dist/runtime-dom.d.ts +6 -6
- package/dist/runtime-dom.esm-browser.js +1991 -1537
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +137 -119
- package/dist/runtime-dom.global.js +1914 -1460
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -18,6 +18,8 @@ const NOOP = () => {
|
|
|
18
18
|
const NO = () => false;
|
|
19
19
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
20
20
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
21
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
22
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
21
23
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
22
24
|
const extend = Object.assign;
|
|
23
25
|
const remove = (arr, el) => {
|
|
@@ -51,6 +53,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
51
53
|
// the leading comma is intentional so empty string "" is also included
|
|
52
54
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
53
55
|
);
|
|
56
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
54
57
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
55
58
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
56
59
|
);
|
|
@@ -62,10 +65,9 @@ const cacheStringFunction = (fn) => {
|
|
|
62
65
|
};
|
|
63
66
|
};
|
|
64
67
|
const camelizeRE = /-(\w)/g;
|
|
68
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
65
69
|
const camelize = cacheStringFunction(
|
|
66
|
-
(str) =>
|
|
67
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
68
|
-
}
|
|
70
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
69
71
|
);
|
|
70
72
|
const hyphenateRE = /\B([A-Z])/g;
|
|
71
73
|
const hyphenate = cacheStringFunction(
|
|
@@ -106,6 +108,10 @@ let _globalThis;
|
|
|
106
108
|
const getGlobalThis = () => {
|
|
107
109
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
108
110
|
};
|
|
111
|
+
function canSetValueDirectly(tagName) {
|
|
112
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
113
|
+
!tagName.includes("-");
|
|
114
|
+
}
|
|
109
115
|
|
|
110
116
|
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
|
|
111
117
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
@@ -213,6 +219,24 @@ function isRenderableAttrValue(value) {
|
|
|
213
219
|
const type = typeof value;
|
|
214
220
|
return type === "string" || type === "number" || type === "boolean";
|
|
215
221
|
}
|
|
222
|
+
function shouldSetAsAttr(tagName, key) {
|
|
223
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
if (key === "form") {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
if (key === "list" && tagName === "INPUT") {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
216
240
|
|
|
217
241
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
218
242
|
function getEscapedCssVarName(key, doubleEscape) {
|
|
@@ -276,7 +300,20 @@ const isRef$1 = (val) => {
|
|
|
276
300
|
return !!(val && val["__v_isRef"] === true);
|
|
277
301
|
};
|
|
278
302
|
const toDisplayString = (val) => {
|
|
279
|
-
|
|
303
|
+
switch (typeof val) {
|
|
304
|
+
case "string":
|
|
305
|
+
return val;
|
|
306
|
+
case "object":
|
|
307
|
+
if (val) {
|
|
308
|
+
if (isRef$1(val)) {
|
|
309
|
+
return toDisplayString(val.value);
|
|
310
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
311
|
+
return JSON.stringify(val, replacer, 2);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
default:
|
|
315
|
+
return val == null ? "" : String(val);
|
|
316
|
+
}
|
|
280
317
|
};
|
|
281
318
|
const replacer = (_key, val) => {
|
|
282
319
|
if (isRef$1(val)) {
|
|
@@ -311,601 +348,409 @@ 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
|
-
}
|
|
537
|
-
}
|
|
538
|
-
stop() {
|
|
539
|
-
if (this.flags & 1) {
|
|
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
|
-
}
|
|
392
|
+
function normalizeCssVarValue(value) {
|
|
393
|
+
if (value == null) {
|
|
394
|
+
return "initial";
|
|
548
395
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
pausedQueueEffects.add(this);
|
|
552
|
-
} else if (this.scheduler) {
|
|
553
|
-
this.scheduler();
|
|
554
|
-
} else {
|
|
555
|
-
this.runIfDirty();
|
|
556
|
-
}
|
|
396
|
+
if (typeof value === "string") {
|
|
397
|
+
return value === "" ? " " : value;
|
|
557
398
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
399
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
400
|
+
{
|
|
401
|
+
console.warn(
|
|
402
|
+
"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
|
|
403
|
+
value
|
|
404
|
+
);
|
|
564
405
|
}
|
|
565
406
|
}
|
|
566
|
-
|
|
567
|
-
return isDirty(this);
|
|
568
|
-
}
|
|
407
|
+
return String(value);
|
|
569
408
|
}
|
|
409
|
+
|
|
410
|
+
function warn$2(msg, ...args) {
|
|
411
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
|
|
415
|
+
ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
|
|
416
|
+
ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
|
|
417
|
+
ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
|
|
418
|
+
ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
|
|
419
|
+
ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
|
|
420
|
+
ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
|
|
421
|
+
ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
|
|
422
|
+
return ReactiveFlags2;
|
|
423
|
+
})(ReactiveFlags || {});
|
|
424
|
+
const notifyBuffer = [];
|
|
570
425
|
let batchDepth = 0;
|
|
571
|
-
let
|
|
572
|
-
let
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
426
|
+
let activeSub = void 0;
|
|
427
|
+
let notifyIndex = 0;
|
|
428
|
+
let notifyBufferLength = 0;
|
|
429
|
+
function setActiveSub(sub) {
|
|
430
|
+
try {
|
|
431
|
+
return activeSub;
|
|
432
|
+
} finally {
|
|
433
|
+
activeSub = sub;
|
|
579
434
|
}
|
|
580
|
-
sub.next = batchedSub;
|
|
581
|
-
batchedSub = sub;
|
|
582
435
|
}
|
|
583
436
|
function startBatch() {
|
|
584
|
-
batchDepth
|
|
437
|
+
++batchDepth;
|
|
585
438
|
}
|
|
586
439
|
function endBatch() {
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
if (batchedComputed) {
|
|
591
|
-
let e = batchedComputed;
|
|
592
|
-
batchedComputed = void 0;
|
|
593
|
-
while (e) {
|
|
594
|
-
const next = e.next;
|
|
595
|
-
e.next = void 0;
|
|
596
|
-
e.flags &= -9;
|
|
597
|
-
e = next;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
let error;
|
|
601
|
-
while (batchedSub) {
|
|
602
|
-
let e = batchedSub;
|
|
603
|
-
batchedSub = void 0;
|
|
604
|
-
while (e) {
|
|
605
|
-
const next = e.next;
|
|
606
|
-
e.next = void 0;
|
|
607
|
-
e.flags &= -9;
|
|
608
|
-
if (e.flags & 1) {
|
|
609
|
-
try {
|
|
610
|
-
;
|
|
611
|
-
e.trigger();
|
|
612
|
-
} catch (err) {
|
|
613
|
-
if (!error) error = err;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
e = next;
|
|
617
|
-
}
|
|
440
|
+
if (!--batchDepth && notifyBufferLength) {
|
|
441
|
+
flush();
|
|
618
442
|
}
|
|
619
|
-
if (error) throw error;
|
|
620
443
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
link.dep.activeLink = link;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function cleanupDeps(sub) {
|
|
629
|
-
let head;
|
|
630
|
-
let tail = sub.depsTail;
|
|
631
|
-
let link = tail;
|
|
632
|
-
while (link) {
|
|
633
|
-
const prev = link.prevDep;
|
|
634
|
-
if (link.version === -1) {
|
|
635
|
-
if (link === tail) tail = prev;
|
|
636
|
-
removeSub(link);
|
|
637
|
-
removeDep(link);
|
|
638
|
-
} else {
|
|
639
|
-
head = link;
|
|
640
|
-
}
|
|
641
|
-
link.dep.activeLink = link.prevActiveLink;
|
|
642
|
-
link.prevActiveLink = void 0;
|
|
643
|
-
link = prev;
|
|
444
|
+
function link(dep, sub) {
|
|
445
|
+
const prevDep = sub.depsTail;
|
|
446
|
+
if (prevDep !== void 0 && prevDep.dep === dep) {
|
|
447
|
+
return;
|
|
644
448
|
}
|
|
645
|
-
|
|
646
|
-
sub.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return
|
|
449
|
+
let nextDep = void 0;
|
|
450
|
+
const recursedCheck = sub.flags & 4 /* RecursedCheck */;
|
|
451
|
+
if (recursedCheck) {
|
|
452
|
+
nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
453
|
+
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
454
|
+
sub.depsTail = nextDep;
|
|
455
|
+
return;
|
|
652
456
|
}
|
|
653
457
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
657
|
-
return false;
|
|
658
|
-
}
|
|
659
|
-
function refreshComputed(computed) {
|
|
660
|
-
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
458
|
+
const prevSub = dep.subsTail;
|
|
459
|
+
if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
|
|
661
460
|
return;
|
|
662
461
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
462
|
+
const newLink = sub.depsTail = dep.subsTail = {
|
|
463
|
+
dep,
|
|
464
|
+
sub,
|
|
465
|
+
prevDep,
|
|
466
|
+
nextDep,
|
|
467
|
+
prevSub,
|
|
468
|
+
nextSub: void 0
|
|
469
|
+
};
|
|
470
|
+
if (nextDep !== void 0) {
|
|
471
|
+
nextDep.prevDep = newLink;
|
|
666
472
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
473
|
+
if (prevDep !== void 0) {
|
|
474
|
+
prevDep.nextDep = newLink;
|
|
475
|
+
} else {
|
|
476
|
+
sub.deps = newLink;
|
|
670
477
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
activeSub = computed;
|
|
676
|
-
shouldTrack = true;
|
|
677
|
-
try {
|
|
678
|
-
prepareDeps(computed);
|
|
679
|
-
const value = computed.fn(computed._value);
|
|
680
|
-
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
681
|
-
computed.flags |= 128;
|
|
682
|
-
computed._value = value;
|
|
683
|
-
dep.version++;
|
|
684
|
-
}
|
|
685
|
-
} catch (err) {
|
|
686
|
-
dep.version++;
|
|
687
|
-
throw err;
|
|
688
|
-
} finally {
|
|
689
|
-
activeSub = prevSub;
|
|
690
|
-
shouldTrack = prevShouldTrack;
|
|
691
|
-
cleanupDeps(computed);
|
|
692
|
-
computed.flags &= -3;
|
|
478
|
+
if (prevSub !== void 0) {
|
|
479
|
+
prevSub.nextSub = newLink;
|
|
480
|
+
} else {
|
|
481
|
+
dep.subs = newLink;
|
|
693
482
|
}
|
|
694
483
|
}
|
|
695
|
-
function
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
484
|
+
function unlink(link2, sub = link2.sub) {
|
|
485
|
+
const dep = link2.dep;
|
|
486
|
+
const prevDep = link2.prevDep;
|
|
487
|
+
const nextDep = link2.nextDep;
|
|
488
|
+
const nextSub = link2.nextSub;
|
|
489
|
+
const prevSub = link2.prevSub;
|
|
490
|
+
if (nextDep !== void 0) {
|
|
491
|
+
nextDep.prevDep = prevDep;
|
|
492
|
+
} else {
|
|
493
|
+
sub.depsTail = prevDep;
|
|
700
494
|
}
|
|
701
|
-
if (
|
|
702
|
-
|
|
703
|
-
|
|
495
|
+
if (prevDep !== void 0) {
|
|
496
|
+
prevDep.nextDep = nextDep;
|
|
497
|
+
} else {
|
|
498
|
+
sub.deps = nextDep;
|
|
704
499
|
}
|
|
705
|
-
if (
|
|
706
|
-
|
|
500
|
+
if (nextSub !== void 0) {
|
|
501
|
+
nextSub.prevSub = prevSub;
|
|
502
|
+
} else {
|
|
503
|
+
dep.subsTail = prevSub;
|
|
707
504
|
}
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
505
|
+
if (prevSub !== void 0) {
|
|
506
|
+
prevSub.nextSub = nextSub;
|
|
507
|
+
} else if ((dep.subs = nextSub) === void 0) {
|
|
508
|
+
let toRemove = dep.deps;
|
|
509
|
+
if (toRemove !== void 0) {
|
|
510
|
+
do {
|
|
511
|
+
toRemove = unlink(toRemove, dep);
|
|
512
|
+
} while (toRemove !== void 0);
|
|
513
|
+
dep.flags |= 16 /* Dirty */;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return nextDep;
|
|
517
|
+
}
|
|
518
|
+
function propagate(link2) {
|
|
519
|
+
let next = link2.nextSub;
|
|
520
|
+
let stack;
|
|
521
|
+
top: do {
|
|
522
|
+
const sub = link2.sub;
|
|
523
|
+
let flags = sub.flags;
|
|
524
|
+
if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
|
|
525
|
+
if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
|
|
526
|
+
sub.flags = flags | 32 /* Pending */;
|
|
527
|
+
} else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
|
|
528
|
+
flags = 0 /* None */;
|
|
529
|
+
} else if (!(flags & 4 /* RecursedCheck */)) {
|
|
530
|
+
sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
|
|
531
|
+
} else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
|
|
532
|
+
sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
|
|
533
|
+
flags &= 1 /* Mutable */;
|
|
534
|
+
} else {
|
|
535
|
+
flags = 0 /* None */;
|
|
536
|
+
}
|
|
537
|
+
if (flags & 2 /* Watching */) {
|
|
538
|
+
notifyBuffer[notifyBufferLength++] = sub;
|
|
539
|
+
}
|
|
540
|
+
if (flags & 1 /* Mutable */) {
|
|
541
|
+
const subSubs = sub.subs;
|
|
542
|
+
if (subSubs !== void 0) {
|
|
543
|
+
link2 = subSubs;
|
|
544
|
+
if (subSubs.nextSub !== void 0) {
|
|
545
|
+
stack = { value: next, prev: stack };
|
|
546
|
+
next = link2.nextSub;
|
|
547
|
+
}
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
714
550
|
}
|
|
715
551
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
552
|
+
if ((link2 = next) !== void 0) {
|
|
553
|
+
next = link2.nextSub;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
while (stack !== void 0) {
|
|
557
|
+
link2 = stack.value;
|
|
558
|
+
stack = stack.prev;
|
|
559
|
+
if (link2 !== void 0) {
|
|
560
|
+
next = link2.nextSub;
|
|
561
|
+
continue top;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
break;
|
|
565
|
+
} while (true);
|
|
720
566
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
567
|
+
function startTracking(sub) {
|
|
568
|
+
sub.depsTail = void 0;
|
|
569
|
+
sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
|
|
570
|
+
return setActiveSub(sub);
|
|
571
|
+
}
|
|
572
|
+
function endTracking(sub, prevSub) {
|
|
573
|
+
if (activeSub !== sub) {
|
|
574
|
+
warn$2(
|
|
575
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
576
|
+
);
|
|
726
577
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
578
|
+
activeSub = prevSub;
|
|
579
|
+
const depsTail = sub.depsTail;
|
|
580
|
+
let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
581
|
+
while (toRemove !== void 0) {
|
|
582
|
+
toRemove = unlink(toRemove, sub);
|
|
583
|
+
}
|
|
584
|
+
sub.flags &= -5 /* RecursedCheck */;
|
|
585
|
+
}
|
|
586
|
+
function flush() {
|
|
587
|
+
while (notifyIndex < notifyBufferLength) {
|
|
588
|
+
const effect = notifyBuffer[notifyIndex];
|
|
589
|
+
notifyBuffer[notifyIndex++] = void 0;
|
|
590
|
+
effect.notify();
|
|
591
|
+
}
|
|
592
|
+
notifyIndex = 0;
|
|
593
|
+
notifyBufferLength = 0;
|
|
594
|
+
}
|
|
595
|
+
function checkDirty(link2, sub) {
|
|
596
|
+
let stack;
|
|
597
|
+
let checkDepth = 0;
|
|
598
|
+
top: do {
|
|
599
|
+
const dep = link2.dep;
|
|
600
|
+
const depFlags = dep.flags;
|
|
601
|
+
let dirty = false;
|
|
602
|
+
if (sub.flags & 16 /* Dirty */) {
|
|
603
|
+
dirty = true;
|
|
604
|
+
} else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
|
|
605
|
+
if (dep.update()) {
|
|
606
|
+
const subs = dep.subs;
|
|
607
|
+
if (subs.nextSub !== void 0) {
|
|
608
|
+
shallowPropagate(subs);
|
|
609
|
+
}
|
|
610
|
+
dirty = true;
|
|
611
|
+
}
|
|
612
|
+
} else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
|
|
613
|
+
if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
|
|
614
|
+
stack = { value: link2, prev: stack };
|
|
615
|
+
}
|
|
616
|
+
link2 = dep.deps;
|
|
617
|
+
sub = dep;
|
|
618
|
+
++checkDepth;
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (!dirty && link2.nextDep !== void 0) {
|
|
622
|
+
link2 = link2.nextDep;
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
while (checkDepth) {
|
|
626
|
+
--checkDepth;
|
|
627
|
+
const firstSub = sub.subs;
|
|
628
|
+
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
629
|
+
if (hasMultipleSubs) {
|
|
630
|
+
link2 = stack.value;
|
|
631
|
+
stack = stack.prev;
|
|
632
|
+
} else {
|
|
633
|
+
link2 = firstSub;
|
|
634
|
+
}
|
|
635
|
+
if (dirty) {
|
|
636
|
+
if (sub.update()) {
|
|
637
|
+
if (hasMultipleSubs) {
|
|
638
|
+
shallowPropagate(firstSub);
|
|
639
|
+
}
|
|
640
|
+
sub = link2.sub;
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
sub.flags &= -33 /* Pending */;
|
|
645
|
+
}
|
|
646
|
+
sub = link2.sub;
|
|
647
|
+
if (link2.nextDep !== void 0) {
|
|
648
|
+
link2 = link2.nextDep;
|
|
649
|
+
continue top;
|
|
650
|
+
}
|
|
651
|
+
dirty = false;
|
|
652
|
+
}
|
|
653
|
+
return dirty;
|
|
654
|
+
} while (true);
|
|
655
|
+
}
|
|
656
|
+
function shallowPropagate(link2) {
|
|
657
|
+
do {
|
|
658
|
+
const sub = link2.sub;
|
|
659
|
+
const nextSub = link2.nextSub;
|
|
660
|
+
const subFlags = sub.flags;
|
|
661
|
+
if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
|
|
662
|
+
sub.flags = subFlags | 16 /* Dirty */;
|
|
663
|
+
}
|
|
664
|
+
link2 = nextSub;
|
|
665
|
+
} while (link2 !== void 0);
|
|
666
|
+
}
|
|
667
|
+
function isValidLink(checkLink, sub) {
|
|
668
|
+
const depsTail = sub.depsTail;
|
|
669
|
+
if (depsTail !== void 0) {
|
|
670
|
+
let link2 = sub.deps;
|
|
671
|
+
do {
|
|
672
|
+
if (link2 === checkLink) {
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
if (link2 === depsTail) {
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
link2 = link2.nextDep;
|
|
679
|
+
} while (link2 !== void 0);
|
|
730
680
|
}
|
|
681
|
+
return false;
|
|
731
682
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
683
|
+
|
|
684
|
+
const triggerEventInfos = [];
|
|
685
|
+
function onTrack(sub, debugInfo) {
|
|
686
|
+
if (sub.onTrack) {
|
|
687
|
+
sub.onTrack(
|
|
688
|
+
extend(
|
|
689
|
+
{
|
|
690
|
+
effect: sub
|
|
691
|
+
},
|
|
692
|
+
debugInfo
|
|
693
|
+
)
|
|
694
|
+
);
|
|
739
695
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
696
|
+
}
|
|
697
|
+
function onTrigger(sub) {
|
|
698
|
+
if (sub.onTrigger) {
|
|
699
|
+
const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
|
|
700
|
+
sub.onTrigger(
|
|
701
|
+
extend(
|
|
702
|
+
{
|
|
703
|
+
effect: sub
|
|
704
|
+
},
|
|
705
|
+
debugInfo
|
|
706
|
+
)
|
|
707
|
+
);
|
|
745
708
|
}
|
|
746
|
-
const runner = e.run.bind(e);
|
|
747
|
-
runner.effect = e;
|
|
748
|
-
return runner;
|
|
749
709
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
710
|
+
function setupOnTrigger(target) {
|
|
711
|
+
Object.defineProperty(target.prototype, "onTrigger", {
|
|
712
|
+
get() {
|
|
713
|
+
return this._onTrigger;
|
|
714
|
+
},
|
|
715
|
+
set(val) {
|
|
716
|
+
if (val && !this._onTrigger) setupFlagsHandler(this);
|
|
717
|
+
this._onTrigger = val;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
752
720
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
const { cleanup } = e;
|
|
765
|
-
e.cleanup = void 0;
|
|
766
|
-
if (cleanup) {
|
|
767
|
-
const prevSub = activeSub;
|
|
768
|
-
activeSub = void 0;
|
|
769
|
-
try {
|
|
770
|
-
cleanup();
|
|
771
|
-
} finally {
|
|
772
|
-
activeSub = prevSub;
|
|
721
|
+
function setupFlagsHandler(target) {
|
|
722
|
+
target._flags = target.flags;
|
|
723
|
+
Object.defineProperty(target, "flags", {
|
|
724
|
+
get() {
|
|
725
|
+
return target._flags;
|
|
726
|
+
},
|
|
727
|
+
set(value) {
|
|
728
|
+
if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
|
|
729
|
+
onTrigger(this);
|
|
730
|
+
}
|
|
731
|
+
target._flags = value;
|
|
773
732
|
}
|
|
774
|
-
}
|
|
733
|
+
});
|
|
775
734
|
}
|
|
776
735
|
|
|
777
|
-
let globalVersion = 0;
|
|
778
|
-
class Link {
|
|
779
|
-
constructor(sub, dep) {
|
|
780
|
-
this.sub = sub;
|
|
781
|
-
this.dep = dep;
|
|
782
|
-
this.version = dep.version;
|
|
783
|
-
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
736
|
class Dep {
|
|
787
|
-
constructor(
|
|
788
|
-
this.
|
|
789
|
-
this.
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
this.activeLink = void 0;
|
|
794
|
-
/**
|
|
795
|
-
* Doubly linked list representing the subscribing effects (tail)
|
|
796
|
-
*/
|
|
797
|
-
this.subs = void 0;
|
|
798
|
-
/**
|
|
799
|
-
* For object property deps cleanup
|
|
800
|
-
*/
|
|
801
|
-
this.map = void 0;
|
|
802
|
-
this.key = void 0;
|
|
803
|
-
/**
|
|
804
|
-
* Subscriber counter
|
|
805
|
-
*/
|
|
806
|
-
this.sc = 0;
|
|
807
|
-
{
|
|
808
|
-
this.subsHead = void 0;
|
|
809
|
-
}
|
|
737
|
+
constructor(map, key) {
|
|
738
|
+
this.map = map;
|
|
739
|
+
this.key = key;
|
|
740
|
+
this._subs = void 0;
|
|
741
|
+
this.subsTail = void 0;
|
|
742
|
+
this.flags = ReactiveFlags.None;
|
|
810
743
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
let link = this.activeLink;
|
|
816
|
-
if (link === void 0 || link.sub !== activeSub) {
|
|
817
|
-
link = this.activeLink = new Link(activeSub, this);
|
|
818
|
-
if (!activeSub.deps) {
|
|
819
|
-
activeSub.deps = activeSub.depsTail = link;
|
|
820
|
-
} else {
|
|
821
|
-
link.prevDep = activeSub.depsTail;
|
|
822
|
-
activeSub.depsTail.nextDep = link;
|
|
823
|
-
activeSub.depsTail = link;
|
|
824
|
-
}
|
|
825
|
-
addSub(link);
|
|
826
|
-
} else if (link.version === -1) {
|
|
827
|
-
link.version = this.version;
|
|
828
|
-
if (link.nextDep) {
|
|
829
|
-
const next = link.nextDep;
|
|
830
|
-
next.prevDep = link.prevDep;
|
|
831
|
-
if (link.prevDep) {
|
|
832
|
-
link.prevDep.nextDep = next;
|
|
833
|
-
}
|
|
834
|
-
link.prevDep = activeSub.depsTail;
|
|
835
|
-
link.nextDep = void 0;
|
|
836
|
-
activeSub.depsTail.nextDep = link;
|
|
837
|
-
activeSub.depsTail = link;
|
|
838
|
-
if (activeSub.deps === link) {
|
|
839
|
-
activeSub.deps = next;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
if (activeSub.onTrack) {
|
|
844
|
-
activeSub.onTrack(
|
|
845
|
-
extend(
|
|
846
|
-
{
|
|
847
|
-
effect: activeSub
|
|
848
|
-
},
|
|
849
|
-
debugInfo
|
|
850
|
-
)
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
return link;
|
|
854
|
-
}
|
|
855
|
-
trigger(debugInfo) {
|
|
856
|
-
this.version++;
|
|
857
|
-
globalVersion++;
|
|
858
|
-
this.notify(debugInfo);
|
|
744
|
+
get subs() {
|
|
745
|
+
return this._subs;
|
|
859
746
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
865
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
866
|
-
head.sub.onTrigger(
|
|
867
|
-
extend(
|
|
868
|
-
{
|
|
869
|
-
effect: head.sub
|
|
870
|
-
},
|
|
871
|
-
debugInfo
|
|
872
|
-
)
|
|
873
|
-
);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
for (let link = this.subs; link; link = link.prevSub) {
|
|
878
|
-
if (link.sub.notify()) {
|
|
879
|
-
;
|
|
880
|
-
link.sub.dep.notify();
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
} finally {
|
|
884
|
-
endBatch();
|
|
747
|
+
set subs(value) {
|
|
748
|
+
this._subs = value;
|
|
749
|
+
if (value === void 0) {
|
|
750
|
+
this.map.delete(this.key);
|
|
885
751
|
}
|
|
886
752
|
}
|
|
887
753
|
}
|
|
888
|
-
function addSub(link) {
|
|
889
|
-
link.dep.sc++;
|
|
890
|
-
if (link.sub.flags & 4) {
|
|
891
|
-
const computed = link.dep.computed;
|
|
892
|
-
if (computed && !link.dep.subs) {
|
|
893
|
-
computed.flags |= 4 | 16;
|
|
894
|
-
for (let l = computed.deps; l; l = l.nextDep) {
|
|
895
|
-
addSub(l);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
const currentTail = link.dep.subs;
|
|
899
|
-
if (currentTail !== link) {
|
|
900
|
-
link.prevSub = currentTail;
|
|
901
|
-
if (currentTail) currentTail.nextSub = link;
|
|
902
|
-
}
|
|
903
|
-
if (link.dep.subsHead === void 0) {
|
|
904
|
-
link.dep.subsHead = link;
|
|
905
|
-
}
|
|
906
|
-
link.dep.subs = link;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
754
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
910
755
|
const ITERATE_KEY = Symbol(
|
|
911
756
|
"Object iterate"
|
|
@@ -917,36 +762,34 @@ const ARRAY_ITERATE_KEY = Symbol(
|
|
|
917
762
|
"Array iterate"
|
|
918
763
|
);
|
|
919
764
|
function track(target, type, key) {
|
|
920
|
-
if (
|
|
765
|
+
if (activeSub !== void 0) {
|
|
921
766
|
let depsMap = targetMap.get(target);
|
|
922
767
|
if (!depsMap) {
|
|
923
768
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
924
769
|
}
|
|
925
770
|
let dep = depsMap.get(key);
|
|
926
771
|
if (!dep) {
|
|
927
|
-
depsMap.set(key, dep = new Dep());
|
|
928
|
-
dep.map = depsMap;
|
|
929
|
-
dep.key = key;
|
|
772
|
+
depsMap.set(key, dep = new Dep(depsMap, key));
|
|
930
773
|
}
|
|
931
774
|
{
|
|
932
|
-
|
|
775
|
+
onTrack(activeSub, {
|
|
933
776
|
target,
|
|
934
777
|
type,
|
|
935
778
|
key
|
|
936
779
|
});
|
|
937
780
|
}
|
|
781
|
+
link(dep, activeSub);
|
|
938
782
|
}
|
|
939
783
|
}
|
|
940
784
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
941
785
|
const depsMap = targetMap.get(target);
|
|
942
786
|
if (!depsMap) {
|
|
943
|
-
globalVersion++;
|
|
944
787
|
return;
|
|
945
788
|
}
|
|
946
789
|
const run = (dep) => {
|
|
947
|
-
if (dep) {
|
|
790
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
948
791
|
{
|
|
949
|
-
|
|
792
|
+
triggerEventInfos.push({
|
|
950
793
|
target,
|
|
951
794
|
type,
|
|
952
795
|
key,
|
|
@@ -955,6 +798,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
955
798
|
oldTarget
|
|
956
799
|
});
|
|
957
800
|
}
|
|
801
|
+
propagate(dep.subs);
|
|
802
|
+
shallowPropagate(dep.subs);
|
|
803
|
+
{
|
|
804
|
+
triggerEventInfos.pop();
|
|
805
|
+
}
|
|
958
806
|
}
|
|
959
807
|
};
|
|
960
808
|
startBatch();
|
|
@@ -1179,11 +1027,11 @@ function searchProxy(self, method, args) {
|
|
|
1179
1027
|
return res;
|
|
1180
1028
|
}
|
|
1181
1029
|
function noTracking(self, method, args = []) {
|
|
1182
|
-
pauseTracking();
|
|
1183
1030
|
startBatch();
|
|
1031
|
+
const prevSub = setActiveSub();
|
|
1184
1032
|
const res = toRaw(self)[method].apply(self, args);
|
|
1033
|
+
setActiveSub(prevSub);
|
|
1185
1034
|
endBatch();
|
|
1186
|
-
resetTracking();
|
|
1187
1035
|
return res;
|
|
1188
1036
|
}
|
|
1189
1037
|
|
|
@@ -1229,14 +1077,18 @@ class BaseReactiveHandler {
|
|
|
1229
1077
|
return hasOwnProperty;
|
|
1230
1078
|
}
|
|
1231
1079
|
}
|
|
1080
|
+
const wasRef = isRef(target);
|
|
1232
1081
|
const res = Reflect.get(
|
|
1233
1082
|
target,
|
|
1234
1083
|
key,
|
|
1235
1084
|
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1236
1085
|
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1237
1086
|
// its class methods
|
|
1238
|
-
|
|
1087
|
+
wasRef ? target : receiver
|
|
1239
1088
|
);
|
|
1089
|
+
if (wasRef && key !== "value") {
|
|
1090
|
+
return res;
|
|
1091
|
+
}
|
|
1240
1092
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1241
1093
|
return res;
|
|
1242
1094
|
}
|
|
@@ -1688,33 +1540,47 @@ function isRef(r) {
|
|
|
1688
1540
|
return r ? r["__v_isRef"] === true : false;
|
|
1689
1541
|
}
|
|
1690
1542
|
function ref(value) {
|
|
1691
|
-
return createRef(value,
|
|
1543
|
+
return createRef(value, toReactive);
|
|
1692
1544
|
}
|
|
1693
1545
|
function shallowRef(value) {
|
|
1694
|
-
return createRef(value
|
|
1546
|
+
return createRef(value);
|
|
1695
1547
|
}
|
|
1696
|
-
function createRef(rawValue,
|
|
1548
|
+
function createRef(rawValue, wrap) {
|
|
1697
1549
|
if (isRef(rawValue)) {
|
|
1698
1550
|
return rawValue;
|
|
1699
1551
|
}
|
|
1700
|
-
return new RefImpl(rawValue,
|
|
1552
|
+
return new RefImpl(rawValue, wrap);
|
|
1701
1553
|
}
|
|
1702
1554
|
class RefImpl {
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
this
|
|
1706
|
-
this
|
|
1707
|
-
this.
|
|
1708
|
-
|
|
1709
|
-
|
|
1555
|
+
// TODO isolatedDeclarations "__v_isShallow"
|
|
1556
|
+
constructor(value, wrap) {
|
|
1557
|
+
this.subs = void 0;
|
|
1558
|
+
this.subsTail = void 0;
|
|
1559
|
+
this.flags = ReactiveFlags.Mutable;
|
|
1560
|
+
/**
|
|
1561
|
+
* @internal
|
|
1562
|
+
*/
|
|
1563
|
+
this.__v_isRef = true;
|
|
1564
|
+
// TODO isolatedDeclarations "__v_isRef"
|
|
1565
|
+
/**
|
|
1566
|
+
* @internal
|
|
1567
|
+
*/
|
|
1568
|
+
this.__v_isShallow = false;
|
|
1569
|
+
this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
|
|
1570
|
+
this._value = wrap ? wrap(value) : value;
|
|
1571
|
+
this._wrap = wrap;
|
|
1572
|
+
this["__v_isShallow"] = !wrap;
|
|
1573
|
+
}
|
|
1574
|
+
get dep() {
|
|
1575
|
+
return this;
|
|
1710
1576
|
}
|
|
1711
1577
|
get value() {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
1578
|
+
trackRef(this);
|
|
1579
|
+
if (this.flags & ReactiveFlags.Dirty && this.update()) {
|
|
1580
|
+
const subs = this.subs;
|
|
1581
|
+
if (subs !== void 0) {
|
|
1582
|
+
shallowPropagate(subs);
|
|
1583
|
+
}
|
|
1718
1584
|
}
|
|
1719
1585
|
return this._value;
|
|
1720
1586
|
}
|
|
@@ -1723,30 +1589,55 @@ class RefImpl {
|
|
|
1723
1589
|
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1724
1590
|
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1725
1591
|
if (hasChanged(newValue, oldValue)) {
|
|
1592
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
1726
1593
|
this._rawValue = newValue;
|
|
1727
|
-
this._value = useDirectValue ? newValue :
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1594
|
+
this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
|
|
1595
|
+
const subs = this.subs;
|
|
1596
|
+
if (subs !== void 0) {
|
|
1597
|
+
{
|
|
1598
|
+
triggerEventInfos.push({
|
|
1599
|
+
target: this,
|
|
1600
|
+
type: "set",
|
|
1601
|
+
key: "value",
|
|
1602
|
+
newValue,
|
|
1603
|
+
oldValue
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
propagate(subs);
|
|
1607
|
+
if (!batchDepth) {
|
|
1608
|
+
flush();
|
|
1609
|
+
}
|
|
1610
|
+
{
|
|
1611
|
+
triggerEventInfos.pop();
|
|
1612
|
+
}
|
|
1736
1613
|
}
|
|
1737
1614
|
}
|
|
1738
1615
|
}
|
|
1616
|
+
update() {
|
|
1617
|
+
this.flags &= ~ReactiveFlags.Dirty;
|
|
1618
|
+
return hasChanged(this._oldValue, this._oldValue = this._rawValue);
|
|
1619
|
+
}
|
|
1739
1620
|
}
|
|
1740
1621
|
function triggerRef(ref2) {
|
|
1741
|
-
|
|
1622
|
+
const dep = ref2.dep;
|
|
1623
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
1624
|
+
propagate(dep.subs);
|
|
1625
|
+
shallowPropagate(dep.subs);
|
|
1626
|
+
if (!batchDepth) {
|
|
1627
|
+
flush();
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
function trackRef(dep) {
|
|
1632
|
+
if (activeSub !== void 0) {
|
|
1742
1633
|
{
|
|
1743
|
-
|
|
1744
|
-
target:
|
|
1745
|
-
type: "
|
|
1746
|
-
key: "value"
|
|
1747
|
-
newValue: ref2._value
|
|
1634
|
+
onTrack(activeSub, {
|
|
1635
|
+
target: dep,
|
|
1636
|
+
type: "get",
|
|
1637
|
+
key: "value"
|
|
1748
1638
|
});
|
|
1749
1639
|
}
|
|
1640
|
+
link(dep, activeSub);
|
|
1750
1641
|
}
|
|
1751
1642
|
}
|
|
1752
1643
|
function unref(ref2) {
|
|
@@ -1772,13 +1663,21 @@ function proxyRefs(objectWithRefs) {
|
|
|
1772
1663
|
}
|
|
1773
1664
|
class CustomRefImpl {
|
|
1774
1665
|
constructor(factory) {
|
|
1666
|
+
this.subs = void 0;
|
|
1667
|
+
this.subsTail = void 0;
|
|
1668
|
+
this.flags = ReactiveFlags.None;
|
|
1775
1669
|
this["__v_isRef"] = true;
|
|
1776
1670
|
this._value = void 0;
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1671
|
+
const { get, set } = factory(
|
|
1672
|
+
() => trackRef(this),
|
|
1673
|
+
() => triggerRef(this)
|
|
1674
|
+
);
|
|
1779
1675
|
this._get = get;
|
|
1780
1676
|
this._set = set;
|
|
1781
1677
|
}
|
|
1678
|
+
get dep() {
|
|
1679
|
+
return this;
|
|
1680
|
+
}
|
|
1782
1681
|
get value() {
|
|
1783
1682
|
return this._value = this._get();
|
|
1784
1683
|
}
|
|
@@ -1786,128 +1685,389 @@ class CustomRefImpl {
|
|
|
1786
1685
|
this._set(newVal);
|
|
1787
1686
|
}
|
|
1788
1687
|
}
|
|
1789
|
-
function customRef(factory) {
|
|
1790
|
-
return new CustomRefImpl(factory);
|
|
1688
|
+
function customRef(factory) {
|
|
1689
|
+
return new CustomRefImpl(factory);
|
|
1690
|
+
}
|
|
1691
|
+
function toRefs(object) {
|
|
1692
|
+
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1693
|
+
for (const key in object) {
|
|
1694
|
+
ret[key] = propertyToRef(object, key);
|
|
1695
|
+
}
|
|
1696
|
+
return ret;
|
|
1697
|
+
}
|
|
1698
|
+
class ObjectRefImpl {
|
|
1699
|
+
constructor(_object, _key, _defaultValue) {
|
|
1700
|
+
this._object = _object;
|
|
1701
|
+
this._key = _key;
|
|
1702
|
+
this._defaultValue = _defaultValue;
|
|
1703
|
+
this["__v_isRef"] = true;
|
|
1704
|
+
this._value = void 0;
|
|
1705
|
+
}
|
|
1706
|
+
get value() {
|
|
1707
|
+
const val = this._object[this._key];
|
|
1708
|
+
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1709
|
+
}
|
|
1710
|
+
set value(newVal) {
|
|
1711
|
+
this._object[this._key] = newVal;
|
|
1712
|
+
}
|
|
1713
|
+
get dep() {
|
|
1714
|
+
return getDepFromReactive(toRaw(this._object), this._key);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
class GetterRefImpl {
|
|
1718
|
+
constructor(_getter) {
|
|
1719
|
+
this._getter = _getter;
|
|
1720
|
+
this["__v_isRef"] = true;
|
|
1721
|
+
this["__v_isReadonly"] = true;
|
|
1722
|
+
this._value = void 0;
|
|
1723
|
+
}
|
|
1724
|
+
get value() {
|
|
1725
|
+
return this._value = this._getter();
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
function toRef(source, key, defaultValue) {
|
|
1729
|
+
if (isRef(source)) {
|
|
1730
|
+
return source;
|
|
1731
|
+
} else if (isFunction(source)) {
|
|
1732
|
+
return new GetterRefImpl(source);
|
|
1733
|
+
} else if (isObject(source) && arguments.length > 1) {
|
|
1734
|
+
return propertyToRef(source, key, defaultValue);
|
|
1735
|
+
} else {
|
|
1736
|
+
return ref(source);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
function propertyToRef(source, key, defaultValue) {
|
|
1740
|
+
const val = source[key];
|
|
1741
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
class ReactiveEffect {
|
|
1745
|
+
constructor(fn) {
|
|
1746
|
+
this.deps = void 0;
|
|
1747
|
+
this.depsTail = void 0;
|
|
1748
|
+
this.subs = void 0;
|
|
1749
|
+
this.subsTail = void 0;
|
|
1750
|
+
this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
|
|
1751
|
+
/**
|
|
1752
|
+
* @internal
|
|
1753
|
+
*/
|
|
1754
|
+
this.cleanups = [];
|
|
1755
|
+
/**
|
|
1756
|
+
* @internal
|
|
1757
|
+
*/
|
|
1758
|
+
this.cleanupsLength = 0;
|
|
1759
|
+
if (fn !== void 0) {
|
|
1760
|
+
this.fn = fn;
|
|
1761
|
+
}
|
|
1762
|
+
if (activeEffectScope) {
|
|
1763
|
+
link(this, activeEffectScope);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
// @ts-expect-error
|
|
1767
|
+
fn() {
|
|
1768
|
+
}
|
|
1769
|
+
get active() {
|
|
1770
|
+
return !(this.flags & 1024);
|
|
1771
|
+
}
|
|
1772
|
+
pause() {
|
|
1773
|
+
this.flags |= 256;
|
|
1774
|
+
}
|
|
1775
|
+
resume() {
|
|
1776
|
+
const flags = this.flags &= -257;
|
|
1777
|
+
if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
|
|
1778
|
+
this.notify();
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
notify() {
|
|
1782
|
+
if (!(this.flags & 256) && this.dirty) {
|
|
1783
|
+
this.run();
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
run() {
|
|
1787
|
+
if (!this.active) {
|
|
1788
|
+
return this.fn();
|
|
1789
|
+
}
|
|
1790
|
+
cleanup(this);
|
|
1791
|
+
const prevSub = startTracking(this);
|
|
1792
|
+
try {
|
|
1793
|
+
return this.fn();
|
|
1794
|
+
} finally {
|
|
1795
|
+
endTracking(this, prevSub);
|
|
1796
|
+
const flags = this.flags;
|
|
1797
|
+
if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
|
|
1798
|
+
this.flags = flags & ~ReactiveFlags.Recursed;
|
|
1799
|
+
this.notify();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
stop() {
|
|
1804
|
+
if (!this.active) {
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
this.flags = 1024;
|
|
1808
|
+
let dep = this.deps;
|
|
1809
|
+
while (dep !== void 0) {
|
|
1810
|
+
dep = unlink(dep, this);
|
|
1811
|
+
}
|
|
1812
|
+
const sub = this.subs;
|
|
1813
|
+
if (sub !== void 0) {
|
|
1814
|
+
unlink(sub);
|
|
1815
|
+
}
|
|
1816
|
+
cleanup(this);
|
|
1817
|
+
}
|
|
1818
|
+
get dirty() {
|
|
1819
|
+
const flags = this.flags;
|
|
1820
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1821
|
+
return true;
|
|
1822
|
+
}
|
|
1823
|
+
if (flags & ReactiveFlags.Pending) {
|
|
1824
|
+
if (checkDirty(this.deps, this)) {
|
|
1825
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
1826
|
+
return true;
|
|
1827
|
+
} else {
|
|
1828
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return false;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
{
|
|
1835
|
+
setupOnTrigger(ReactiveEffect);
|
|
1836
|
+
}
|
|
1837
|
+
function effect(fn, options) {
|
|
1838
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
1839
|
+
fn = fn.effect.fn;
|
|
1840
|
+
}
|
|
1841
|
+
const e = new ReactiveEffect(fn);
|
|
1842
|
+
if (options) {
|
|
1843
|
+
const { onStop, scheduler } = options;
|
|
1844
|
+
if (onStop) {
|
|
1845
|
+
options.onStop = void 0;
|
|
1846
|
+
const stop2 = e.stop.bind(e);
|
|
1847
|
+
e.stop = () => {
|
|
1848
|
+
stop2();
|
|
1849
|
+
onStop();
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
if (scheduler) {
|
|
1853
|
+
options.scheduler = void 0;
|
|
1854
|
+
e.notify = () => {
|
|
1855
|
+
if (!(e.flags & 256)) {
|
|
1856
|
+
scheduler();
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
extend(e, options);
|
|
1861
|
+
}
|
|
1862
|
+
try {
|
|
1863
|
+
e.run();
|
|
1864
|
+
} catch (err) {
|
|
1865
|
+
e.stop();
|
|
1866
|
+
throw err;
|
|
1867
|
+
}
|
|
1868
|
+
const runner = e.run.bind(e);
|
|
1869
|
+
runner.effect = e;
|
|
1870
|
+
return runner;
|
|
1871
|
+
}
|
|
1872
|
+
function stop(runner) {
|
|
1873
|
+
runner.effect.stop();
|
|
1791
1874
|
}
|
|
1792
|
-
function
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1875
|
+
function cleanup(sub) {
|
|
1876
|
+
const l = sub.cleanupsLength;
|
|
1877
|
+
if (l) {
|
|
1878
|
+
for (let i = 0; i < l; i++) {
|
|
1879
|
+
sub.cleanups[i]();
|
|
1880
|
+
}
|
|
1881
|
+
sub.cleanupsLength = 0;
|
|
1799
1882
|
}
|
|
1800
|
-
return ret;
|
|
1801
1883
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
this.
|
|
1807
|
-
this
|
|
1808
|
-
this.
|
|
1884
|
+
|
|
1885
|
+
let activeEffectScope;
|
|
1886
|
+
class EffectScope {
|
|
1887
|
+
constructor(detached = false) {
|
|
1888
|
+
this.deps = void 0;
|
|
1889
|
+
this.depsTail = void 0;
|
|
1890
|
+
this.subs = void 0;
|
|
1891
|
+
this.subsTail = void 0;
|
|
1892
|
+
this.flags = 0;
|
|
1893
|
+
/**
|
|
1894
|
+
* @internal
|
|
1895
|
+
*/
|
|
1896
|
+
this.cleanups = [];
|
|
1897
|
+
/**
|
|
1898
|
+
* @internal
|
|
1899
|
+
*/
|
|
1900
|
+
this.cleanupsLength = 0;
|
|
1901
|
+
if (!detached && activeEffectScope) {
|
|
1902
|
+
link(this, activeEffectScope);
|
|
1903
|
+
}
|
|
1809
1904
|
}
|
|
1810
|
-
get
|
|
1811
|
-
|
|
1812
|
-
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1905
|
+
get active() {
|
|
1906
|
+
return !(this.flags & 1024);
|
|
1813
1907
|
}
|
|
1814
|
-
|
|
1815
|
-
this.
|
|
1908
|
+
pause() {
|
|
1909
|
+
if (!(this.flags & 256)) {
|
|
1910
|
+
this.flags |= 256;
|
|
1911
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1912
|
+
const dep = link2.dep;
|
|
1913
|
+
if ("pause" in dep) {
|
|
1914
|
+
dep.pause();
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1816
1918
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1919
|
+
/**
|
|
1920
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
1921
|
+
*/
|
|
1922
|
+
resume() {
|
|
1923
|
+
const flags = this.flags;
|
|
1924
|
+
if (flags & 256) {
|
|
1925
|
+
this.flags = flags & -257;
|
|
1926
|
+
for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
|
|
1927
|
+
const dep = link2.dep;
|
|
1928
|
+
if ("resume" in dep) {
|
|
1929
|
+
dep.resume();
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1819
1933
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1934
|
+
run(fn) {
|
|
1935
|
+
const prevSub = setActiveSub();
|
|
1936
|
+
const prevScope = activeEffectScope;
|
|
1937
|
+
try {
|
|
1938
|
+
activeEffectScope = this;
|
|
1939
|
+
return fn();
|
|
1940
|
+
} finally {
|
|
1941
|
+
activeEffectScope = prevScope;
|
|
1942
|
+
setActiveSub(prevSub);
|
|
1943
|
+
}
|
|
1827
1944
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1945
|
+
stop() {
|
|
1946
|
+
if (!this.active) {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
this.flags = 1024;
|
|
1950
|
+
let dep = this.deps;
|
|
1951
|
+
while (dep !== void 0) {
|
|
1952
|
+
const node = dep.dep;
|
|
1953
|
+
if ("stop" in node) {
|
|
1954
|
+
dep = dep.nextDep;
|
|
1955
|
+
node.stop();
|
|
1956
|
+
} else {
|
|
1957
|
+
dep = unlink(dep, this);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
const sub = this.subs;
|
|
1961
|
+
if (sub !== void 0) {
|
|
1962
|
+
unlink(sub);
|
|
1963
|
+
}
|
|
1964
|
+
cleanup(this);
|
|
1830
1965
|
}
|
|
1831
1966
|
}
|
|
1832
|
-
function
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
return
|
|
1967
|
+
function effectScope(detached) {
|
|
1968
|
+
return new EffectScope(detached);
|
|
1969
|
+
}
|
|
1970
|
+
function getCurrentScope() {
|
|
1971
|
+
return activeEffectScope;
|
|
1972
|
+
}
|
|
1973
|
+
function setCurrentScope(scope) {
|
|
1974
|
+
try {
|
|
1975
|
+
return activeEffectScope;
|
|
1976
|
+
} finally {
|
|
1977
|
+
activeEffectScope = scope;
|
|
1841
1978
|
}
|
|
1842
1979
|
}
|
|
1843
|
-
function
|
|
1844
|
-
|
|
1845
|
-
|
|
1980
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
1981
|
+
if (activeEffectScope !== void 0) {
|
|
1982
|
+
activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
|
|
1983
|
+
} else if (!failSilently) {
|
|
1984
|
+
warn$2(
|
|
1985
|
+
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
1986
|
+
);
|
|
1987
|
+
}
|
|
1846
1988
|
}
|
|
1847
1989
|
|
|
1848
1990
|
class ComputedRefImpl {
|
|
1849
|
-
constructor(fn, setter
|
|
1991
|
+
constructor(fn, setter) {
|
|
1850
1992
|
this.fn = fn;
|
|
1851
1993
|
this.setter = setter;
|
|
1852
1994
|
/**
|
|
1853
1995
|
* @internal
|
|
1854
1996
|
*/
|
|
1855
1997
|
this._value = void 0;
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
*/
|
|
1859
|
-
this.dep = new Dep(this);
|
|
1860
|
-
/**
|
|
1861
|
-
* @internal
|
|
1862
|
-
*/
|
|
1863
|
-
this.__v_isRef = true;
|
|
1864
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1865
|
-
// A computed is also a subscriber that tracks other deps
|
|
1866
|
-
/**
|
|
1867
|
-
* @internal
|
|
1868
|
-
*/
|
|
1998
|
+
this.subs = void 0;
|
|
1999
|
+
this.subsTail = void 0;
|
|
1869
2000
|
this.deps = void 0;
|
|
1870
|
-
/**
|
|
1871
|
-
* @internal
|
|
1872
|
-
*/
|
|
1873
2001
|
this.depsTail = void 0;
|
|
2002
|
+
this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
1874
2003
|
/**
|
|
1875
2004
|
* @internal
|
|
1876
2005
|
*/
|
|
1877
|
-
this.
|
|
1878
|
-
/**
|
|
1879
|
-
* @internal
|
|
1880
|
-
*/
|
|
1881
|
-
this.globalVersion = globalVersion - 1;
|
|
1882
|
-
/**
|
|
1883
|
-
* @internal
|
|
1884
|
-
*/
|
|
1885
|
-
this.next = void 0;
|
|
1886
|
-
// for backwards compat
|
|
1887
|
-
this.effect = this;
|
|
2006
|
+
this.__v_isRef = true;
|
|
1888
2007
|
this["__v_isReadonly"] = !setter;
|
|
1889
|
-
|
|
2008
|
+
}
|
|
2009
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
2010
|
+
// for backwards compat
|
|
2011
|
+
get effect() {
|
|
2012
|
+
return this;
|
|
2013
|
+
}
|
|
2014
|
+
// for backwards compat
|
|
2015
|
+
get dep() {
|
|
2016
|
+
return this;
|
|
1890
2017
|
}
|
|
1891
2018
|
/**
|
|
1892
2019
|
* @internal
|
|
2020
|
+
* for backwards compat
|
|
1893
2021
|
*/
|
|
1894
|
-
|
|
1895
|
-
this.flags
|
|
1896
|
-
if (
|
|
1897
|
-
activeSub !== this) {
|
|
1898
|
-
batch(this, true);
|
|
2022
|
+
get _dirty() {
|
|
2023
|
+
const flags = this.flags;
|
|
2024
|
+
if (flags & ReactiveFlags.Dirty) {
|
|
1899
2025
|
return true;
|
|
1900
2026
|
}
|
|
2027
|
+
if (flags & ReactiveFlags.Pending) {
|
|
2028
|
+
if (checkDirty(this.deps, this)) {
|
|
2029
|
+
this.flags = flags | ReactiveFlags.Dirty;
|
|
2030
|
+
return true;
|
|
2031
|
+
} else {
|
|
2032
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* @internal
|
|
2039
|
+
* for backwards compat
|
|
2040
|
+
*/
|
|
2041
|
+
set _dirty(v) {
|
|
2042
|
+
if (v) {
|
|
2043
|
+
this.flags |= ReactiveFlags.Dirty;
|
|
2044
|
+
} else {
|
|
2045
|
+
this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
|
|
2046
|
+
}
|
|
1901
2047
|
}
|
|
1902
2048
|
get value() {
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2049
|
+
const flags = this.flags;
|
|
2050
|
+
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
|
|
2051
|
+
if (this.update()) {
|
|
2052
|
+
const subs = this.subs;
|
|
2053
|
+
if (subs !== void 0) {
|
|
2054
|
+
shallowPropagate(subs);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
} else if (flags & ReactiveFlags.Pending) {
|
|
2058
|
+
this.flags = flags & ~ReactiveFlags.Pending;
|
|
2059
|
+
}
|
|
2060
|
+
if (activeSub !== void 0) {
|
|
2061
|
+
{
|
|
2062
|
+
onTrack(activeSub, {
|
|
2063
|
+
target: this,
|
|
2064
|
+
type: "get",
|
|
2065
|
+
key: "value"
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
link(this, activeSub);
|
|
2069
|
+
} else if (activeEffectScope !== void 0) {
|
|
2070
|
+
link(this, activeEffectScope);
|
|
1911
2071
|
}
|
|
1912
2072
|
return this._value;
|
|
1913
2073
|
}
|
|
@@ -1918,6 +2078,23 @@ class ComputedRefImpl {
|
|
|
1918
2078
|
warn$2("Write operation failed: computed value is readonly");
|
|
1919
2079
|
}
|
|
1920
2080
|
}
|
|
2081
|
+
update() {
|
|
2082
|
+
const prevSub = startTracking(this);
|
|
2083
|
+
try {
|
|
2084
|
+
const oldValue = this._value;
|
|
2085
|
+
const newValue = this.fn(oldValue);
|
|
2086
|
+
if (hasChanged(oldValue, newValue)) {
|
|
2087
|
+
this._value = newValue;
|
|
2088
|
+
return true;
|
|
2089
|
+
}
|
|
2090
|
+
return false;
|
|
2091
|
+
} finally {
|
|
2092
|
+
endTracking(this, prevSub);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
{
|
|
2097
|
+
setupOnTrigger(ComputedRefImpl);
|
|
1921
2098
|
}
|
|
1922
2099
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1923
2100
|
let getter;
|
|
@@ -1928,7 +2105,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
1928
2105
|
getter = getterOrOptions.get;
|
|
1929
2106
|
setter = getterOrOptions.set;
|
|
1930
2107
|
}
|
|
1931
|
-
const cRef = new ComputedRefImpl(getter, setter
|
|
2108
|
+
const cRef = new ComputedRefImpl(getter, setter);
|
|
1932
2109
|
if (debugOptions && !isSSR) {
|
|
1933
2110
|
cRef.onTrack = debugOptions.onTrack;
|
|
1934
2111
|
cRef.onTrigger = debugOptions.onTrigger;
|
|
@@ -1949,177 +2126,146 @@ const TriggerOpTypes = {
|
|
|
1949
2126
|
};
|
|
1950
2127
|
|
|
1951
2128
|
const INITIAL_WATCHER_VALUE = {};
|
|
1952
|
-
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1953
2129
|
let activeWatcher = void 0;
|
|
1954
2130
|
function getCurrentWatcher() {
|
|
1955
2131
|
return activeWatcher;
|
|
1956
2132
|
}
|
|
1957
2133
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1958
2134
|
if (owner) {
|
|
1959
|
-
|
|
1960
|
-
if (
|
|
1961
|
-
|
|
2135
|
+
const { call } = owner.options;
|
|
2136
|
+
if (call) {
|
|
2137
|
+
owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
|
|
2138
|
+
} else {
|
|
2139
|
+
owner.cleanups[owner.cleanupsLength++] = cleanupFn;
|
|
2140
|
+
}
|
|
1962
2141
|
} else if (!failSilently) {
|
|
1963
2142
|
warn$2(
|
|
1964
2143
|
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1965
2144
|
);
|
|
1966
2145
|
}
|
|
1967
2146
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
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
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1998
|
-
getter = () => source.map((s) => {
|
|
1999
|
-
if (isRef(s)) {
|
|
2000
|
-
return s.value;
|
|
2001
|
-
} else if (isReactive(s)) {
|
|
2002
|
-
return reactiveGetter(s);
|
|
2003
|
-
} else if (isFunction(s)) {
|
|
2004
|
-
return call ? call(s, 2) : s();
|
|
2147
|
+
class WatcherEffect extends ReactiveEffect {
|
|
2148
|
+
constructor(source, cb, options = EMPTY_OBJ) {
|
|
2149
|
+
const { deep, once, call, onWarn } = options;
|
|
2150
|
+
let getter;
|
|
2151
|
+
let forceTrigger = false;
|
|
2152
|
+
let isMultiSource = false;
|
|
2153
|
+
if (isRef(source)) {
|
|
2154
|
+
getter = () => source.value;
|
|
2155
|
+
forceTrigger = isShallow(source);
|
|
2156
|
+
} else if (isReactive(source)) {
|
|
2157
|
+
getter = () => reactiveGetter(source, deep);
|
|
2158
|
+
forceTrigger = true;
|
|
2159
|
+
} else if (isArray(source)) {
|
|
2160
|
+
isMultiSource = true;
|
|
2161
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
2162
|
+
getter = () => source.map((s) => {
|
|
2163
|
+
if (isRef(s)) {
|
|
2164
|
+
return s.value;
|
|
2165
|
+
} else if (isReactive(s)) {
|
|
2166
|
+
return reactiveGetter(s, deep);
|
|
2167
|
+
} else if (isFunction(s)) {
|
|
2168
|
+
return call ? call(s, 2) : s();
|
|
2169
|
+
} else {
|
|
2170
|
+
warnInvalidSource(s, onWarn);
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
} else if (isFunction(source)) {
|
|
2174
|
+
if (cb) {
|
|
2175
|
+
getter = call ? () => call(source, 2) : source;
|
|
2005
2176
|
} else {
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2177
|
+
getter = () => {
|
|
2178
|
+
if (this.cleanupsLength) {
|
|
2179
|
+
const prevSub = setActiveSub();
|
|
2180
|
+
try {
|
|
2181
|
+
cleanup(this);
|
|
2182
|
+
} finally {
|
|
2183
|
+
setActiveSub(prevSub);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
const currentEffect = activeWatcher;
|
|
2187
|
+
activeWatcher = this;
|
|
2016
2188
|
try {
|
|
2017
|
-
|
|
2189
|
+
return call ? call(source, 3, [
|
|
2190
|
+
this.boundCleanup
|
|
2191
|
+
]) : source(this.boundCleanup);
|
|
2018
2192
|
} finally {
|
|
2019
|
-
|
|
2193
|
+
activeWatcher = currentEffect;
|
|
2020
2194
|
}
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
} else {
|
|
2198
|
+
getter = NOOP;
|
|
2199
|
+
warnInvalidSource(source, onWarn);
|
|
2200
|
+
}
|
|
2201
|
+
if (cb && deep) {
|
|
2202
|
+
const baseGetter = getter;
|
|
2203
|
+
const depth = deep === true ? Infinity : deep;
|
|
2204
|
+
getter = () => traverse(baseGetter(), depth);
|
|
2205
|
+
}
|
|
2206
|
+
super(getter);
|
|
2207
|
+
this.cb = cb;
|
|
2208
|
+
this.options = options;
|
|
2209
|
+
this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
|
|
2210
|
+
this.forceTrigger = forceTrigger;
|
|
2211
|
+
this.isMultiSource = isMultiSource;
|
|
2212
|
+
if (once && cb) {
|
|
2213
|
+
const _cb = cb;
|
|
2214
|
+
cb = (...args) => {
|
|
2215
|
+
_cb(...args);
|
|
2216
|
+
this.stop();
|
|
2029
2217
|
};
|
|
2030
2218
|
}
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
const baseGetter = getter;
|
|
2037
|
-
const depth = deep === true ? Infinity : deep;
|
|
2038
|
-
getter = () => traverse(baseGetter(), depth);
|
|
2039
|
-
}
|
|
2040
|
-
const scope = getCurrentScope();
|
|
2041
|
-
const watchHandle = () => {
|
|
2042
|
-
effect.stop();
|
|
2043
|
-
if (scope && scope.active) {
|
|
2044
|
-
remove(scope.effects, effect);
|
|
2219
|
+
this.cb = cb;
|
|
2220
|
+
this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2221
|
+
{
|
|
2222
|
+
this.onTrack = options.onTrack;
|
|
2223
|
+
this.onTrigger = options.onTrigger;
|
|
2045
2224
|
}
|
|
2046
|
-
};
|
|
2047
|
-
if (once && cb) {
|
|
2048
|
-
const _cb = cb;
|
|
2049
|
-
cb = (...args) => {
|
|
2050
|
-
_cb(...args);
|
|
2051
|
-
watchHandle();
|
|
2052
|
-
};
|
|
2053
2225
|
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2226
|
+
run(initialRun = false) {
|
|
2227
|
+
const oldValue = this.oldValue;
|
|
2228
|
+
const newValue = this.oldValue = super.run();
|
|
2229
|
+
if (!this.cb) {
|
|
2057
2230
|
return;
|
|
2058
2231
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
if (cleanup) {
|
|
2063
|
-
cleanup();
|
|
2064
|
-
}
|
|
2065
|
-
const currentWatcher = activeWatcher;
|
|
2066
|
-
activeWatcher = effect;
|
|
2067
|
-
try {
|
|
2068
|
-
const args = [
|
|
2069
|
-
newValue,
|
|
2070
|
-
// pass undefined as the old value when it's changed for the first time
|
|
2071
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2072
|
-
boundCleanup
|
|
2073
|
-
];
|
|
2074
|
-
oldValue = newValue;
|
|
2075
|
-
call ? call(cb, 3, args) : (
|
|
2076
|
-
// @ts-expect-error
|
|
2077
|
-
cb(...args)
|
|
2078
|
-
);
|
|
2079
|
-
} finally {
|
|
2080
|
-
activeWatcher = currentWatcher;
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
} else {
|
|
2084
|
-
effect.run();
|
|
2232
|
+
const { immediate, deep, call } = this.options;
|
|
2233
|
+
if (initialRun && !immediate) {
|
|
2234
|
+
return;
|
|
2085
2235
|
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
call(
|
|
2098
|
-
|
|
2099
|
-
|
|
2236
|
+
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2237
|
+
cleanup(this);
|
|
2238
|
+
const currentWatcher = activeWatcher;
|
|
2239
|
+
activeWatcher = this;
|
|
2240
|
+
try {
|
|
2241
|
+
const args = [
|
|
2242
|
+
newValue,
|
|
2243
|
+
// pass undefined as the old value when it's changed for the first time
|
|
2244
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2245
|
+
this.boundCleanup
|
|
2246
|
+
];
|
|
2247
|
+
call ? call(this.cb, 3, args) : (
|
|
2248
|
+
// @ts-expect-error
|
|
2249
|
+
this.cb(...args)
|
|
2250
|
+
);
|
|
2251
|
+
} finally {
|
|
2252
|
+
activeWatcher = currentWatcher;
|
|
2100
2253
|
}
|
|
2101
|
-
cleanupMap.delete(effect);
|
|
2102
|
-
}
|
|
2103
|
-
};
|
|
2104
|
-
{
|
|
2105
|
-
effect.onTrack = options.onTrack;
|
|
2106
|
-
effect.onTrigger = options.onTrigger;
|
|
2107
|
-
}
|
|
2108
|
-
if (cb) {
|
|
2109
|
-
if (immediate) {
|
|
2110
|
-
job(true);
|
|
2111
|
-
} else {
|
|
2112
|
-
oldValue = effect.run();
|
|
2113
2254
|
}
|
|
2114
|
-
} else if (scheduler) {
|
|
2115
|
-
scheduler(job.bind(null, true), true);
|
|
2116
|
-
} else {
|
|
2117
|
-
effect.run();
|
|
2118
2255
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2256
|
+
}
|
|
2257
|
+
function reactiveGetter(source, deep) {
|
|
2258
|
+
if (deep) return source;
|
|
2259
|
+
if (isShallow(source) || deep === false || deep === 0)
|
|
2260
|
+
return traverse(source, 1);
|
|
2261
|
+
return traverse(source);
|
|
2262
|
+
}
|
|
2263
|
+
function warnInvalidSource(s, onWarn) {
|
|
2264
|
+
(onWarn || warn$2)(
|
|
2265
|
+
`Invalid watch source: `,
|
|
2266
|
+
s,
|
|
2267
|
+
`A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
|
2268
|
+
);
|
|
2123
2269
|
}
|
|
2124
2270
|
function traverse(value, depth = Infinity, seen) {
|
|
2125
2271
|
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
@@ -2155,8 +2301,8 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
2155
2301
|
}
|
|
2156
2302
|
|
|
2157
2303
|
const stack = [];
|
|
2158
|
-
function pushWarningContext(
|
|
2159
|
-
stack.push(
|
|
2304
|
+
function pushWarningContext(ctx) {
|
|
2305
|
+
stack.push(ctx);
|
|
2160
2306
|
}
|
|
2161
2307
|
function popWarningContext() {
|
|
2162
2308
|
stack.pop();
|
|
@@ -2165,8 +2311,9 @@ let isWarning = false;
|
|
|
2165
2311
|
function warn$1(msg, ...args) {
|
|
2166
2312
|
if (isWarning) return;
|
|
2167
2313
|
isWarning = true;
|
|
2168
|
-
|
|
2169
|
-
const
|
|
2314
|
+
const prevSub = setActiveSub();
|
|
2315
|
+
const entry = stack.length ? stack[stack.length - 1] : null;
|
|
2316
|
+
const instance = isVNode(entry) ? entry.component : entry;
|
|
2170
2317
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
2171
2318
|
const trace = getComponentTrace();
|
|
2172
2319
|
if (appWarnHandler) {
|
|
@@ -2180,9 +2327,9 @@ function warn$1(msg, ...args) {
|
|
|
2180
2327
|
var _a, _b;
|
|
2181
2328
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
2182
2329
|
}).join(""),
|
|
2183
|
-
instance && instance.proxy,
|
|
2330
|
+
instance && instance.proxy || instance,
|
|
2184
2331
|
trace.map(
|
|
2185
|
-
({
|
|
2332
|
+
({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
|
|
2186
2333
|
).join("\n"),
|
|
2187
2334
|
trace
|
|
2188
2335
|
]
|
|
@@ -2196,27 +2343,31 @@ function warn$1(msg, ...args) {
|
|
|
2196
2343
|
}
|
|
2197
2344
|
console.warn(...warnArgs);
|
|
2198
2345
|
}
|
|
2199
|
-
|
|
2346
|
+
setActiveSub(prevSub);
|
|
2200
2347
|
isWarning = false;
|
|
2201
2348
|
}
|
|
2202
2349
|
function getComponentTrace() {
|
|
2203
|
-
let
|
|
2204
|
-
if (!
|
|
2350
|
+
let currentCtx = stack[stack.length - 1];
|
|
2351
|
+
if (!currentCtx) {
|
|
2205
2352
|
return [];
|
|
2206
2353
|
}
|
|
2207
2354
|
const normalizedStack = [];
|
|
2208
|
-
while (
|
|
2355
|
+
while (currentCtx) {
|
|
2209
2356
|
const last = normalizedStack[0];
|
|
2210
|
-
if (last && last.
|
|
2357
|
+
if (last && last.ctx === currentCtx) {
|
|
2211
2358
|
last.recurseCount++;
|
|
2212
2359
|
} else {
|
|
2213
2360
|
normalizedStack.push({
|
|
2214
|
-
|
|
2361
|
+
ctx: currentCtx,
|
|
2215
2362
|
recurseCount: 0
|
|
2216
2363
|
});
|
|
2217
2364
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2365
|
+
if (isVNode(currentCtx)) {
|
|
2366
|
+
const parent = currentCtx.component && currentCtx.component.parent;
|
|
2367
|
+
currentCtx = parent && parent.vnode || parent;
|
|
2368
|
+
} else {
|
|
2369
|
+
currentCtx = currentCtx.parent;
|
|
2370
|
+
}
|
|
2220
2371
|
}
|
|
2221
2372
|
return normalizedStack;
|
|
2222
2373
|
}
|
|
@@ -2228,16 +2379,13 @@ function formatTrace(trace) {
|
|
|
2228
2379
|
});
|
|
2229
2380
|
return logs;
|
|
2230
2381
|
}
|
|
2231
|
-
function formatTraceEntry({
|
|
2382
|
+
function formatTraceEntry({ ctx, recurseCount }) {
|
|
2232
2383
|
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
2233
|
-
const
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2236
|
-
vnode.type,
|
|
2237
|
-
isRoot
|
|
2238
|
-
)}`;
|
|
2384
|
+
const instance = isVNode(ctx) ? ctx.component : ctx;
|
|
2385
|
+
const isRoot = instance ? instance.parent == null : false;
|
|
2386
|
+
const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
|
|
2239
2387
|
const close = `>` + postfix;
|
|
2240
|
-
return
|
|
2388
|
+
return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
|
|
2241
2389
|
}
|
|
2242
2390
|
function formatProps(props) {
|
|
2243
2391
|
const res = [];
|
|
@@ -2369,11 +2517,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
|
2369
2517
|
}
|
|
2370
2518
|
}
|
|
2371
2519
|
function handleError(err, instance, type, throwInDev = true) {
|
|
2372
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
2373
2520
|
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
2374
2521
|
if (instance) {
|
|
2375
2522
|
let cur = instance.parent;
|
|
2376
|
-
const exposedInstance = instance.proxy;
|
|
2523
|
+
const exposedInstance = instance.proxy || instance;
|
|
2377
2524
|
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
2378
2525
|
while (cur) {
|
|
2379
2526
|
const errorCapturedHooks = cur.ec;
|
|
@@ -2387,26 +2534,26 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
2387
2534
|
cur = cur.parent;
|
|
2388
2535
|
}
|
|
2389
2536
|
if (errorHandler) {
|
|
2390
|
-
|
|
2537
|
+
const prevSub = setActiveSub();
|
|
2391
2538
|
callWithErrorHandling(errorHandler, null, 10, [
|
|
2392
2539
|
err,
|
|
2393
2540
|
exposedInstance,
|
|
2394
2541
|
errorInfo
|
|
2395
2542
|
]);
|
|
2396
|
-
|
|
2543
|
+
setActiveSub(prevSub);
|
|
2397
2544
|
return;
|
|
2398
2545
|
}
|
|
2399
2546
|
}
|
|
2400
|
-
logError(err, type,
|
|
2547
|
+
logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
|
|
2401
2548
|
}
|
|
2402
|
-
function logError(err, type,
|
|
2549
|
+
function logError(err, type, instance, throwInDev = true, throwInProd = false) {
|
|
2403
2550
|
{
|
|
2404
2551
|
const info = ErrorTypeStrings$1[type];
|
|
2405
|
-
if (
|
|
2406
|
-
pushWarningContext(
|
|
2552
|
+
if (instance) {
|
|
2553
|
+
pushWarningContext(instance);
|
|
2407
2554
|
}
|
|
2408
2555
|
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
2409
|
-
if (
|
|
2556
|
+
if (instance) {
|
|
2410
2557
|
popWarningContext();
|
|
2411
2558
|
}
|
|
2412
2559
|
if (throwInDev) {
|
|
@@ -2417,26 +2564,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
|
|
|
2417
2564
|
}
|
|
2418
2565
|
}
|
|
2419
2566
|
|
|
2420
|
-
const
|
|
2421
|
-
let
|
|
2422
|
-
|
|
2423
|
-
let
|
|
2567
|
+
const jobs = [];
|
|
2568
|
+
let postJobs = [];
|
|
2569
|
+
let activePostJobs = null;
|
|
2570
|
+
let currentFlushPromise = null;
|
|
2571
|
+
let jobsLength = 0;
|
|
2572
|
+
let flushIndex = 0;
|
|
2424
2573
|
let postFlushIndex = 0;
|
|
2425
2574
|
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
2426
|
-
let currentFlushPromise = null;
|
|
2427
2575
|
const RECURSION_LIMIT = 100;
|
|
2428
2576
|
function nextTick(fn) {
|
|
2429
2577
|
const p = currentFlushPromise || resolvedPromise;
|
|
2430
2578
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2431
2579
|
}
|
|
2432
|
-
function findInsertionIndex(
|
|
2433
|
-
let start = flushIndex + 1;
|
|
2434
|
-
let end = queue.length;
|
|
2580
|
+
function findInsertionIndex(order, queue, start, end) {
|
|
2435
2581
|
while (start < end) {
|
|
2436
2582
|
const middle = start + end >>> 1;
|
|
2437
|
-
|
|
2438
|
-
const middleJobId = getId(middleJob);
|
|
2439
|
-
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
2583
|
+
if (queue[middle].order <= order) {
|
|
2440
2584
|
start = middle + 1;
|
|
2441
2585
|
} else {
|
|
2442
2586
|
end = middle;
|
|
@@ -2444,130 +2588,168 @@ function findInsertionIndex(id) {
|
|
|
2444
2588
|
}
|
|
2445
2589
|
return start;
|
|
2446
2590
|
}
|
|
2447
|
-
function queueJob(job) {
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2591
|
+
function queueJob(job, id, isPre = false) {
|
|
2592
|
+
if (queueJobWorker(
|
|
2593
|
+
job,
|
|
2594
|
+
id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
|
|
2595
|
+
jobs,
|
|
2596
|
+
jobsLength,
|
|
2597
|
+
flushIndex
|
|
2598
|
+
)) {
|
|
2599
|
+
jobsLength++;
|
|
2600
|
+
queueFlush();
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
function queueJobWorker(job, order, queue, length, flushIndex2) {
|
|
2604
|
+
const flags = job.flags;
|
|
2605
|
+
if (!(flags & 1)) {
|
|
2606
|
+
job.flags = flags | 1;
|
|
2607
|
+
job.order = order;
|
|
2608
|
+
if (flushIndex2 === length || // fast path when the job id is larger than the tail
|
|
2609
|
+
order >= queue[length - 1].order) {
|
|
2610
|
+
queue[length] = job;
|
|
2454
2611
|
} else {
|
|
2455
|
-
queue.splice(findInsertionIndex(
|
|
2612
|
+
queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
|
|
2456
2613
|
}
|
|
2457
|
-
|
|
2458
|
-
queueFlush();
|
|
2614
|
+
return true;
|
|
2459
2615
|
}
|
|
2616
|
+
return false;
|
|
2460
2617
|
}
|
|
2618
|
+
const doFlushJobs = () => {
|
|
2619
|
+
try {
|
|
2620
|
+
flushJobs();
|
|
2621
|
+
} catch (e) {
|
|
2622
|
+
currentFlushPromise = null;
|
|
2623
|
+
throw e;
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2461
2626
|
function queueFlush() {
|
|
2462
2627
|
if (!currentFlushPromise) {
|
|
2463
|
-
currentFlushPromise = resolvedPromise.then(
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
function queuePostFlushCb(cb) {
|
|
2467
|
-
if (!isArray(cb)) {
|
|
2468
|
-
if (activePostFlushCbs && cb.id === -1) {
|
|
2469
|
-
activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
|
2470
|
-
} else if (!(cb.flags & 1)) {
|
|
2471
|
-
pendingPostFlushCbs.push(cb);
|
|
2472
|
-
cb.flags |= 1;
|
|
2473
|
-
}
|
|
2474
|
-
} else {
|
|
2475
|
-
pendingPostFlushCbs.push(...cb);
|
|
2628
|
+
currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
2476
2629
|
}
|
|
2477
|
-
queueFlush();
|
|
2478
2630
|
}
|
|
2479
|
-
function
|
|
2480
|
-
{
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2631
|
+
function queuePostFlushCb(jobs2, id = Infinity) {
|
|
2632
|
+
if (!isArray(jobs2)) {
|
|
2633
|
+
if (activePostJobs && id === -1) {
|
|
2634
|
+
activePostJobs.splice(postFlushIndex, 0, jobs2);
|
|
2635
|
+
} else {
|
|
2636
|
+
queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
|
|
2637
|
+
}
|
|
2638
|
+
} else {
|
|
2639
|
+
for (const job of jobs2) {
|
|
2640
|
+
queueJobWorker(job, id, postJobs, postJobs.length, 0);
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
queueFlush();
|
|
2644
|
+
}
|
|
2645
|
+
function flushPreFlushCbs(instance, seen) {
|
|
2646
|
+
{
|
|
2647
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
2648
|
+
}
|
|
2649
|
+
for (let i = flushIndex; i < jobsLength; i++) {
|
|
2650
|
+
const cb = jobs[i];
|
|
2651
|
+
if (cb.order & 1 || cb.order === Infinity) {
|
|
2652
|
+
continue;
|
|
2653
|
+
}
|
|
2654
|
+
if (instance && cb.order !== instance.uid * 2) {
|
|
2655
|
+
continue;
|
|
2656
|
+
}
|
|
2657
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
2658
|
+
continue;
|
|
2659
|
+
}
|
|
2660
|
+
jobs.splice(i, 1);
|
|
2661
|
+
i--;
|
|
2662
|
+
jobsLength--;
|
|
2663
|
+
if (cb.flags & 2) {
|
|
2664
|
+
cb.flags &= -2;
|
|
2665
|
+
}
|
|
2666
|
+
cb();
|
|
2667
|
+
if (!(cb.flags & 2)) {
|
|
2668
|
+
cb.flags &= -2;
|
|
2501
2669
|
}
|
|
2502
2670
|
}
|
|
2503
2671
|
}
|
|
2504
2672
|
function flushPostFlushCbs(seen) {
|
|
2505
|
-
if (
|
|
2506
|
-
|
|
2507
|
-
(
|
|
2508
|
-
|
|
2509
|
-
pendingPostFlushCbs.length = 0;
|
|
2510
|
-
if (activePostFlushCbs) {
|
|
2511
|
-
activePostFlushCbs.push(...deduped);
|
|
2673
|
+
if (postJobs.length) {
|
|
2674
|
+
if (activePostJobs) {
|
|
2675
|
+
activePostJobs.push(...postJobs);
|
|
2676
|
+
postJobs.length = 0;
|
|
2512
2677
|
return;
|
|
2513
2678
|
}
|
|
2514
|
-
|
|
2679
|
+
activePostJobs = postJobs;
|
|
2680
|
+
postJobs = [];
|
|
2515
2681
|
{
|
|
2516
2682
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2517
2683
|
}
|
|
2518
|
-
|
|
2519
|
-
const cb =
|
|
2684
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
2685
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
2520
2686
|
if (checkRecursiveUpdates(seen, cb)) {
|
|
2521
2687
|
continue;
|
|
2522
2688
|
}
|
|
2523
|
-
if (cb.flags &
|
|
2689
|
+
if (cb.flags & 2) {
|
|
2524
2690
|
cb.flags &= -2;
|
|
2525
2691
|
}
|
|
2526
|
-
if (!(cb.flags &
|
|
2527
|
-
|
|
2692
|
+
if (!(cb.flags & 4)) {
|
|
2693
|
+
try {
|
|
2694
|
+
cb();
|
|
2695
|
+
} finally {
|
|
2696
|
+
cb.flags &= -2;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2528
2699
|
}
|
|
2529
|
-
|
|
2700
|
+
activePostJobs = null;
|
|
2530
2701
|
postFlushIndex = 0;
|
|
2531
2702
|
}
|
|
2532
2703
|
}
|
|
2533
|
-
|
|
2704
|
+
let isFlushing = false;
|
|
2705
|
+
function flushOnAppMount() {
|
|
2706
|
+
if (!isFlushing) {
|
|
2707
|
+
isFlushing = true;
|
|
2708
|
+
flushPreFlushCbs();
|
|
2709
|
+
flushPostFlushCbs();
|
|
2710
|
+
isFlushing = false;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2534
2713
|
function flushJobs(seen) {
|
|
2535
2714
|
{
|
|
2536
|
-
seen
|
|
2715
|
+
seen || (seen = /* @__PURE__ */ new Map());
|
|
2537
2716
|
}
|
|
2538
|
-
const check = (job) => checkRecursiveUpdates(seen, job) ;
|
|
2539
2717
|
try {
|
|
2540
|
-
|
|
2541
|
-
const job =
|
|
2542
|
-
|
|
2543
|
-
|
|
2718
|
+
while (flushIndex < jobsLength) {
|
|
2719
|
+
const job = jobs[flushIndex];
|
|
2720
|
+
jobs[flushIndex++] = void 0;
|
|
2721
|
+
if (!(job.flags & 4)) {
|
|
2722
|
+
if (checkRecursiveUpdates(seen, job)) {
|
|
2544
2723
|
continue;
|
|
2545
2724
|
}
|
|
2546
|
-
if (job.flags &
|
|
2725
|
+
if (job.flags & 2) {
|
|
2547
2726
|
job.flags &= ~1;
|
|
2548
2727
|
}
|
|
2549
|
-
|
|
2550
|
-
job
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2728
|
+
try {
|
|
2729
|
+
job();
|
|
2730
|
+
} catch (err) {
|
|
2731
|
+
handleError(
|
|
2732
|
+
err,
|
|
2733
|
+
job.i,
|
|
2734
|
+
job.i ? 15 : 14
|
|
2735
|
+
);
|
|
2736
|
+
} finally {
|
|
2737
|
+
if (!(job.flags & 2)) {
|
|
2738
|
+
job.flags &= ~1;
|
|
2739
|
+
}
|
|
2556
2740
|
}
|
|
2557
2741
|
}
|
|
2558
2742
|
}
|
|
2559
2743
|
} finally {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
job.flags &= -2;
|
|
2564
|
-
}
|
|
2744
|
+
while (flushIndex < jobsLength) {
|
|
2745
|
+
jobs[flushIndex].flags &= -2;
|
|
2746
|
+
jobs[flushIndex++] = void 0;
|
|
2565
2747
|
}
|
|
2566
|
-
flushIndex =
|
|
2567
|
-
|
|
2748
|
+
flushIndex = 0;
|
|
2749
|
+
jobsLength = 0;
|
|
2568
2750
|
flushPostFlushCbs(seen);
|
|
2569
2751
|
currentFlushPromise = null;
|
|
2570
|
-
if (
|
|
2752
|
+
if (jobsLength || postJobs.length) {
|
|
2571
2753
|
flushJobs(seen);
|
|
2572
2754
|
}
|
|
2573
2755
|
}
|
|
@@ -2634,10 +2816,17 @@ function rerender(id, newRender) {
|
|
|
2634
2816
|
instance.render = newRender;
|
|
2635
2817
|
normalizeClassComponent(instance.type).render = newRender;
|
|
2636
2818
|
}
|
|
2637
|
-
instance.renderCache = [];
|
|
2638
2819
|
isHmrUpdating = true;
|
|
2639
|
-
instance.
|
|
2640
|
-
|
|
2820
|
+
if (instance.vapor) {
|
|
2821
|
+
instance.hmrRerender();
|
|
2822
|
+
} else {
|
|
2823
|
+
const i = instance;
|
|
2824
|
+
i.renderCache = [];
|
|
2825
|
+
i.effect.run();
|
|
2826
|
+
}
|
|
2827
|
+
nextTick(() => {
|
|
2828
|
+
isHmrUpdating = false;
|
|
2829
|
+
});
|
|
2641
2830
|
});
|
|
2642
2831
|
}
|
|
2643
2832
|
function reload(id, newComp) {
|
|
@@ -2646,42 +2835,54 @@ function reload(id, newComp) {
|
|
|
2646
2835
|
newComp = normalizeClassComponent(newComp);
|
|
2647
2836
|
updateComponentDef(record.initialDef, newComp);
|
|
2648
2837
|
const instances = [...record.instances];
|
|
2649
|
-
|
|
2650
|
-
const instance
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
if (instance.ceReload) {
|
|
2838
|
+
if (newComp.vapor) {
|
|
2839
|
+
for (const instance of instances) {
|
|
2840
|
+
instance.hmrReload(newComp);
|
|
2841
|
+
}
|
|
2842
|
+
} else {
|
|
2843
|
+
for (const instance of instances) {
|
|
2844
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2845
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2846
|
+
if (!dirtyInstances) {
|
|
2847
|
+
if (oldComp !== record.initialDef) {
|
|
2848
|
+
updateComponentDef(oldComp, newComp);
|
|
2849
|
+
}
|
|
2850
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2851
|
+
}
|
|
2664
2852
|
dirtyInstances.add(instance);
|
|
2665
|
-
instance.
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
instance.
|
|
2671
|
-
isHmrUpdating = false;
|
|
2853
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2854
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2855
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2856
|
+
if (instance.ceReload) {
|
|
2857
|
+
dirtyInstances.add(instance);
|
|
2858
|
+
instance.ceReload(newComp.styles);
|
|
2672
2859
|
dirtyInstances.delete(instance);
|
|
2673
|
-
})
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2860
|
+
} else if (instance.parent) {
|
|
2861
|
+
queueJob(() => {
|
|
2862
|
+
isHmrUpdating = true;
|
|
2863
|
+
const parent = instance.parent;
|
|
2864
|
+
if (parent.vapor) {
|
|
2865
|
+
parent.hmrRerender();
|
|
2866
|
+
} else {
|
|
2867
|
+
parent.effect.run();
|
|
2868
|
+
}
|
|
2869
|
+
nextTick(() => {
|
|
2870
|
+
isHmrUpdating = false;
|
|
2871
|
+
});
|
|
2872
|
+
dirtyInstances.delete(instance);
|
|
2873
|
+
});
|
|
2874
|
+
} else if (instance.appContext.reload) {
|
|
2875
|
+
instance.appContext.reload();
|
|
2876
|
+
} else if (typeof window !== "undefined") {
|
|
2877
|
+
window.location.reload();
|
|
2878
|
+
} else {
|
|
2879
|
+
console.warn(
|
|
2880
|
+
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
2881
|
+
);
|
|
2882
|
+
}
|
|
2883
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
2884
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
2885
|
+
}
|
|
2685
2886
|
}
|
|
2686
2887
|
}
|
|
2687
2888
|
queuePostFlushCb(() => {
|
|
@@ -2894,14 +3095,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2894
3095
|
}
|
|
2895
3096
|
let hook = binding.dir[name];
|
|
2896
3097
|
if (hook) {
|
|
2897
|
-
|
|
3098
|
+
const prevSub = setActiveSub();
|
|
2898
3099
|
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2899
3100
|
vnode.el,
|
|
2900
3101
|
binding,
|
|
2901
3102
|
vnode,
|
|
2902
3103
|
prevVNode
|
|
2903
3104
|
]);
|
|
2904
|
-
|
|
3105
|
+
setActiveSub(prevSub);
|
|
2905
3106
|
}
|
|
2906
3107
|
}
|
|
2907
3108
|
}
|
|
@@ -3001,29 +3202,37 @@ const TeleportImpl = {
|
|
|
3001
3202
|
}
|
|
3002
3203
|
if (isTeleportDeferred(n2.props)) {
|
|
3003
3204
|
n2.el.__isMounted = false;
|
|
3004
|
-
queuePostRenderEffect(
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3205
|
+
queuePostRenderEffect(
|
|
3206
|
+
() => {
|
|
3207
|
+
mountToTarget();
|
|
3208
|
+
delete n2.el.__isMounted;
|
|
3209
|
+
},
|
|
3210
|
+
void 0,
|
|
3211
|
+
parentSuspense
|
|
3212
|
+
);
|
|
3008
3213
|
} else {
|
|
3009
3214
|
mountToTarget();
|
|
3010
3215
|
}
|
|
3011
3216
|
} else {
|
|
3012
3217
|
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
|
3013
|
-
queuePostRenderEffect(
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3218
|
+
queuePostRenderEffect(
|
|
3219
|
+
() => {
|
|
3220
|
+
TeleportImpl.process(
|
|
3221
|
+
n1,
|
|
3222
|
+
n2,
|
|
3223
|
+
container,
|
|
3224
|
+
anchor,
|
|
3225
|
+
parentComponent,
|
|
3226
|
+
parentSuspense,
|
|
3227
|
+
namespace,
|
|
3228
|
+
slotScopeIds,
|
|
3229
|
+
optimized,
|
|
3230
|
+
internals
|
|
3231
|
+
);
|
|
3232
|
+
},
|
|
3233
|
+
void 0,
|
|
3234
|
+
parentSuspense
|
|
3235
|
+
);
|
|
3027
3236
|
return;
|
|
3028
3237
|
}
|
|
3029
3238
|
n2.el = n1.el;
|
|
@@ -3070,6 +3279,7 @@ const TeleportImpl = {
|
|
|
3070
3279
|
container,
|
|
3071
3280
|
mainAnchor,
|
|
3072
3281
|
internals,
|
|
3282
|
+
parentComponent,
|
|
3073
3283
|
1
|
|
3074
3284
|
);
|
|
3075
3285
|
} else {
|
|
@@ -3089,6 +3299,7 @@ const TeleportImpl = {
|
|
|
3089
3299
|
nextTarget,
|
|
3090
3300
|
null,
|
|
3091
3301
|
internals,
|
|
3302
|
+
parentComponent,
|
|
3092
3303
|
0
|
|
3093
3304
|
);
|
|
3094
3305
|
} else {
|
|
@@ -3104,6 +3315,7 @@ const TeleportImpl = {
|
|
|
3104
3315
|
target,
|
|
3105
3316
|
targetAnchor,
|
|
3106
3317
|
internals,
|
|
3318
|
+
parentComponent,
|
|
3107
3319
|
1
|
|
3108
3320
|
);
|
|
3109
3321
|
}
|
|
@@ -3143,7 +3355,7 @@ const TeleportImpl = {
|
|
|
3143
3355
|
move: moveTeleport,
|
|
3144
3356
|
hydrate: hydrateTeleport
|
|
3145
3357
|
};
|
|
3146
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
3358
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
|
|
3147
3359
|
if (moveType === 0) {
|
|
3148
3360
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
3149
3361
|
}
|
|
@@ -3159,7 +3371,8 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
3159
3371
|
children[i],
|
|
3160
3372
|
container,
|
|
3161
3373
|
parentAnchor,
|
|
3162
|
-
2
|
|
3374
|
+
2,
|
|
3375
|
+
parentComponent
|
|
3163
3376
|
);
|
|
3164
3377
|
}
|
|
3165
3378
|
}
|
|
@@ -3344,7 +3557,7 @@ const BaseTransitionImpl = {
|
|
|
3344
3557
|
state.isLeaving = true;
|
|
3345
3558
|
leavingHooks.afterLeave = () => {
|
|
3346
3559
|
state.isLeaving = false;
|
|
3347
|
-
if (!(instance.job.flags &
|
|
3560
|
+
if (!(instance.job.flags & 4)) {
|
|
3348
3561
|
instance.update();
|
|
3349
3562
|
}
|
|
3350
3563
|
delete leavingHooks.afterLeave;
|
|
@@ -3623,7 +3836,7 @@ function defineComponent(options, extraOptions) {
|
|
|
3623
3836
|
}
|
|
3624
3837
|
|
|
3625
3838
|
function useId() {
|
|
3626
|
-
const i =
|
|
3839
|
+
const i = getCurrentGenericInstance();
|
|
3627
3840
|
if (i) {
|
|
3628
3841
|
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
3629
3842
|
} else {
|
|
@@ -3639,7 +3852,7 @@ function markAsyncBoundary(instance) {
|
|
|
3639
3852
|
|
|
3640
3853
|
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
3641
3854
|
function useTemplateRef(key) {
|
|
3642
|
-
const i =
|
|
3855
|
+
const i = getCurrentGenericInstance();
|
|
3643
3856
|
const r = shallowRef(null);
|
|
3644
3857
|
if (i) {
|
|
3645
3858
|
const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
@@ -3759,8 +3972,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3759
3972
|
}
|
|
3760
3973
|
};
|
|
3761
3974
|
if (value) {
|
|
3762
|
-
doSet
|
|
3763
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3975
|
+
queuePostRenderEffect(doSet, -1, parentSuspense);
|
|
3764
3976
|
} else {
|
|
3765
3977
|
doSet();
|
|
3766
3978
|
}
|
|
@@ -3928,6 +4140,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3928
4140
|
);
|
|
3929
4141
|
}
|
|
3930
4142
|
} else if (shapeFlag & 6) {
|
|
4143
|
+
if (vnode.type.__vapor) {
|
|
4144
|
+
throw new Error("Vapor component hydration is not supported yet.");
|
|
4145
|
+
}
|
|
3931
4146
|
vnode.slotScopeIds = slotScopeIds;
|
|
3932
4147
|
const container = parentNode(node);
|
|
3933
4148
|
if (isFragmentStart) {
|
|
@@ -4089,11 +4304,15 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4089
4304
|
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
4090
4305
|
}
|
|
4091
4306
|
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
4092
|
-
queueEffectWithSuspense(
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4307
|
+
queueEffectWithSuspense(
|
|
4308
|
+
() => {
|
|
4309
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
4310
|
+
needCallTransitionHooks && transition.enter(el);
|
|
4311
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
4312
|
+
},
|
|
4313
|
+
void 0,
|
|
4314
|
+
parentSuspense
|
|
4315
|
+
);
|
|
4097
4316
|
}
|
|
4098
4317
|
}
|
|
4099
4318
|
return el.nextSibling;
|
|
@@ -4373,14 +4592,16 @@ function resolveCssVars(instance, vnode, expectedMap) {
|
|
|
4373
4592
|
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
4374
4593
|
const cssVars = instance.getCssVars();
|
|
4375
4594
|
for (const key in cssVars) {
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
String(cssVars[key])
|
|
4379
|
-
);
|
|
4595
|
+
const value = normalizeCssVarValue(cssVars[key]);
|
|
4596
|
+
expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
|
|
4380
4597
|
}
|
|
4381
4598
|
}
|
|
4382
4599
|
if (vnode === root && instance.parent) {
|
|
4383
|
-
resolveCssVars(
|
|
4600
|
+
resolveCssVars(
|
|
4601
|
+
instance.parent,
|
|
4602
|
+
instance.vnode,
|
|
4603
|
+
expectedMap
|
|
4604
|
+
);
|
|
4384
4605
|
}
|
|
4385
4606
|
}
|
|
4386
4607
|
const allowMismatchAttr = "data-allow-mismatch";
|
|
@@ -4407,7 +4628,7 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
4407
4628
|
if (allowedType === 0 /* TEXT */ && list.includes("children")) {
|
|
4408
4629
|
return true;
|
|
4409
4630
|
}
|
|
4410
|
-
return
|
|
4631
|
+
return list.includes(MismatchTypeString[allowedType]);
|
|
4411
4632
|
}
|
|
4412
4633
|
}
|
|
4413
4634
|
|
|
@@ -4639,7 +4860,7 @@ function defineAsyncComponent(source) {
|
|
|
4639
4860
|
}
|
|
4640
4861
|
load().then(() => {
|
|
4641
4862
|
loaded.value = true;
|
|
4642
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4863
|
+
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
|
|
4643
4864
|
instance.parent.update();
|
|
4644
4865
|
}
|
|
4645
4866
|
}).catch((err) => {
|
|
@@ -4682,8 +4903,8 @@ const KeepAliveImpl = {
|
|
|
4682
4903
|
max: [String, Number]
|
|
4683
4904
|
},
|
|
4684
4905
|
setup(props, { slots }) {
|
|
4685
|
-
const
|
|
4686
|
-
const sharedContext =
|
|
4906
|
+
const keepAliveInstance = getCurrentInstance();
|
|
4907
|
+
const sharedContext = keepAliveInstance.ctx;
|
|
4687
4908
|
if (!sharedContext.renderer) {
|
|
4688
4909
|
return () => {
|
|
4689
4910
|
const children = slots.default && slots.default();
|
|
@@ -4694,9 +4915,9 @@ const KeepAliveImpl = {
|
|
|
4694
4915
|
const keys = /* @__PURE__ */ new Set();
|
|
4695
4916
|
let current = null;
|
|
4696
4917
|
{
|
|
4697
|
-
|
|
4918
|
+
keepAliveInstance.__v_cache = cache;
|
|
4698
4919
|
}
|
|
4699
|
-
const parentSuspense =
|
|
4920
|
+
const parentSuspense = keepAliveInstance.suspense;
|
|
4700
4921
|
const {
|
|
4701
4922
|
renderer: {
|
|
4702
4923
|
p: patch,
|
|
@@ -4707,58 +4928,80 @@ const KeepAliveImpl = {
|
|
|
4707
4928
|
} = sharedContext;
|
|
4708
4929
|
const storageContainer = createElement("div");
|
|
4709
4930
|
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
4710
|
-
const
|
|
4711
|
-
move(
|
|
4931
|
+
const instance = vnode.component;
|
|
4932
|
+
move(
|
|
4933
|
+
vnode,
|
|
4934
|
+
container,
|
|
4935
|
+
anchor,
|
|
4936
|
+
0,
|
|
4937
|
+
keepAliveInstance,
|
|
4938
|
+
parentSuspense
|
|
4939
|
+
);
|
|
4712
4940
|
patch(
|
|
4713
|
-
|
|
4941
|
+
instance.vnode,
|
|
4714
4942
|
vnode,
|
|
4715
4943
|
container,
|
|
4716
4944
|
anchor,
|
|
4717
|
-
|
|
4945
|
+
instance,
|
|
4718
4946
|
parentSuspense,
|
|
4719
4947
|
namespace,
|
|
4720
4948
|
vnode.slotScopeIds,
|
|
4721
4949
|
optimized
|
|
4722
4950
|
);
|
|
4723
|
-
queuePostRenderEffect(
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4951
|
+
queuePostRenderEffect(
|
|
4952
|
+
() => {
|
|
4953
|
+
instance.isDeactivated = false;
|
|
4954
|
+
if (instance.a) {
|
|
4955
|
+
invokeArrayFns(instance.a);
|
|
4956
|
+
}
|
|
4957
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
4958
|
+
if (vnodeHook) {
|
|
4959
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4960
|
+
}
|
|
4961
|
+
},
|
|
4962
|
+
void 0,
|
|
4963
|
+
parentSuspense
|
|
4964
|
+
);
|
|
4733
4965
|
{
|
|
4734
|
-
devtoolsComponentAdded(
|
|
4966
|
+
devtoolsComponentAdded(instance);
|
|
4735
4967
|
}
|
|
4736
4968
|
};
|
|
4737
4969
|
sharedContext.deactivate = (vnode) => {
|
|
4738
|
-
const
|
|
4739
|
-
invalidateMount(
|
|
4740
|
-
invalidateMount(
|
|
4741
|
-
move(
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4970
|
+
const instance = vnode.component;
|
|
4971
|
+
invalidateMount(instance.m);
|
|
4972
|
+
invalidateMount(instance.a);
|
|
4973
|
+
move(
|
|
4974
|
+
vnode,
|
|
4975
|
+
storageContainer,
|
|
4976
|
+
null,
|
|
4977
|
+
1,
|
|
4978
|
+
keepAliveInstance,
|
|
4979
|
+
parentSuspense
|
|
4980
|
+
);
|
|
4981
|
+
queuePostRenderEffect(
|
|
4982
|
+
() => {
|
|
4983
|
+
if (instance.da) {
|
|
4984
|
+
invokeArrayFns(instance.da);
|
|
4985
|
+
}
|
|
4986
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
4987
|
+
if (vnodeHook) {
|
|
4988
|
+
invokeVNodeHook(vnodeHook, instance.parent, vnode);
|
|
4989
|
+
}
|
|
4990
|
+
instance.isDeactivated = true;
|
|
4991
|
+
},
|
|
4992
|
+
void 0,
|
|
4993
|
+
parentSuspense
|
|
4994
|
+
);
|
|
4752
4995
|
{
|
|
4753
|
-
devtoolsComponentAdded(
|
|
4996
|
+
devtoolsComponentAdded(instance);
|
|
4754
4997
|
}
|
|
4755
4998
|
{
|
|
4756
|
-
|
|
4999
|
+
instance.__keepAliveStorageContainer = storageContainer;
|
|
4757
5000
|
}
|
|
4758
5001
|
};
|
|
4759
5002
|
function unmount(vnode) {
|
|
4760
5003
|
resetShapeFlag(vnode);
|
|
4761
|
-
_unmount(vnode,
|
|
5004
|
+
_unmount(vnode, keepAliveInstance, parentSuspense, true);
|
|
4762
5005
|
}
|
|
4763
5006
|
function pruneCache(filter) {
|
|
4764
5007
|
cache.forEach((vnode, key) => {
|
|
@@ -4790,12 +5033,19 @@ const KeepAliveImpl = {
|
|
|
4790
5033
|
let pendingCacheKey = null;
|
|
4791
5034
|
const cacheSubtree = () => {
|
|
4792
5035
|
if (pendingCacheKey != null) {
|
|
4793
|
-
if (isSuspense(
|
|
4794
|
-
queuePostRenderEffect(
|
|
4795
|
-
|
|
4796
|
-
|
|
5036
|
+
if (isSuspense(keepAliveInstance.subTree.type)) {
|
|
5037
|
+
queuePostRenderEffect(
|
|
5038
|
+
() => {
|
|
5039
|
+
cache.set(
|
|
5040
|
+
pendingCacheKey,
|
|
5041
|
+
getInnerChild(keepAliveInstance.subTree)
|
|
5042
|
+
);
|
|
5043
|
+
},
|
|
5044
|
+
void 0,
|
|
5045
|
+
keepAliveInstance.subTree.suspense
|
|
5046
|
+
);
|
|
4797
5047
|
} else {
|
|
4798
|
-
cache.set(pendingCacheKey, getInnerChild(
|
|
5048
|
+
cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
4799
5049
|
}
|
|
4800
5050
|
}
|
|
4801
5051
|
};
|
|
@@ -4803,12 +5053,12 @@ const KeepAliveImpl = {
|
|
|
4803
5053
|
onUpdated(cacheSubtree);
|
|
4804
5054
|
onBeforeUnmount(() => {
|
|
4805
5055
|
cache.forEach((cached) => {
|
|
4806
|
-
const { subTree, suspense } =
|
|
5056
|
+
const { subTree, suspense } = keepAliveInstance;
|
|
4807
5057
|
const vnode = getInnerChild(subTree);
|
|
4808
5058
|
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
4809
5059
|
resetShapeFlag(vnode);
|
|
4810
5060
|
const da = vnode.component.da;
|
|
4811
|
-
da && queuePostRenderEffect(da, suspense);
|
|
5061
|
+
da && queuePostRenderEffect(da, void 0, suspense);
|
|
4812
5062
|
return;
|
|
4813
5063
|
}
|
|
4814
5064
|
unmount(cached);
|
|
@@ -4894,7 +5144,7 @@ function onActivated(hook, target) {
|
|
|
4894
5144
|
function onDeactivated(hook, target) {
|
|
4895
5145
|
registerKeepAliveHook(hook, "da", target);
|
|
4896
5146
|
}
|
|
4897
|
-
function registerKeepAliveHook(hook, type, target =
|
|
5147
|
+
function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
|
|
4898
5148
|
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
4899
5149
|
let current = target;
|
|
4900
5150
|
while (current) {
|
|
@@ -4908,7 +5158,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
4908
5158
|
injectHook(type, wrappedHook, target);
|
|
4909
5159
|
if (target) {
|
|
4910
5160
|
let current = target.parent;
|
|
4911
|
-
while (current && current.parent) {
|
|
5161
|
+
while (current && current.parent && current.parent.vnode) {
|
|
4912
5162
|
if (isKeepAlive(current.parent.vnode)) {
|
|
4913
5163
|
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4914
5164
|
}
|
|
@@ -4940,12 +5190,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4940
5190
|
if (target) {
|
|
4941
5191
|
const hooks = target[type] || (target[type] = []);
|
|
4942
5192
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
4943
|
-
|
|
4944
|
-
const
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
5193
|
+
const prevSub = setActiveSub();
|
|
5194
|
+
const prev = setCurrentInstance(target);
|
|
5195
|
+
try {
|
|
5196
|
+
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
5197
|
+
} finally {
|
|
5198
|
+
setCurrentInstance(...prev);
|
|
5199
|
+
setActiveSub(prevSub);
|
|
5200
|
+
}
|
|
4949
5201
|
});
|
|
4950
5202
|
if (prepend) {
|
|
4951
5203
|
hooks.unshift(wrappedHook);
|
|
@@ -5016,7 +5268,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
5016
5268
|
const res = (
|
|
5017
5269
|
// local registration
|
|
5018
5270
|
// check instance[type] first which is resolved for options API
|
|
5019
|
-
resolve(
|
|
5271
|
+
resolve(
|
|
5272
|
+
instance[type] || Component[type],
|
|
5273
|
+
name
|
|
5274
|
+
) || // global registration
|
|
5275
|
+
// @ts-expect-error filters only exist in compat mode
|
|
5020
5276
|
resolve(instance.appContext[type], name)
|
|
5021
5277
|
);
|
|
5022
5278
|
if (!res && maybeSelfReference) {
|
|
@@ -5110,7 +5366,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
5110
5366
|
}
|
|
5111
5367
|
|
|
5112
5368
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
5113
|
-
|
|
5369
|
+
let slot = slots[name];
|
|
5370
|
+
if (slot && slot.__vapor) {
|
|
5371
|
+
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
5372
|
+
ret.vs = { slot, fallback };
|
|
5373
|
+
return ret;
|
|
5374
|
+
}
|
|
5375
|
+
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
5114
5376
|
if (name !== "default") props.name = name;
|
|
5115
5377
|
return openBlock(), createBlock(
|
|
5116
5378
|
Fragment,
|
|
@@ -5119,7 +5381,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
5119
5381
|
64
|
|
5120
5382
|
);
|
|
5121
5383
|
}
|
|
5122
|
-
let slot = slots[name];
|
|
5123
5384
|
if (slot && slot.length > 1) {
|
|
5124
5385
|
warn$1(
|
|
5125
5386
|
`SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
|
|
@@ -5174,8 +5435,9 @@ function toHandlers(obj, preserveCaseIfNecessary) {
|
|
|
5174
5435
|
}
|
|
5175
5436
|
|
|
5176
5437
|
const getPublicInstance = (i) => {
|
|
5177
|
-
if (!i) return null;
|
|
5178
|
-
if (isStatefulComponent(i))
|
|
5438
|
+
if (!i || i.vapor) return null;
|
|
5439
|
+
if (isStatefulComponent(i))
|
|
5440
|
+
return getComponentPublicInstance(i);
|
|
5179
5441
|
return getPublicInstance(i.parent);
|
|
5180
5442
|
};
|
|
5181
5443
|
const publicPropertiesMap = (
|
|
@@ -5468,11 +5730,16 @@ function useAttrs() {
|
|
|
5468
5730
|
return getContext().attrs;
|
|
5469
5731
|
}
|
|
5470
5732
|
function getContext() {
|
|
5471
|
-
const i =
|
|
5733
|
+
const i = getCurrentGenericInstance();
|
|
5472
5734
|
if (!i) {
|
|
5473
5735
|
warn$1(`useContext() called without active instance.`);
|
|
5474
5736
|
}
|
|
5475
|
-
|
|
5737
|
+
if (i.vapor) {
|
|
5738
|
+
return i;
|
|
5739
|
+
} else {
|
|
5740
|
+
const ii = i;
|
|
5741
|
+
return ii.setupContext || (ii.setupContext = createSetupContext(ii));
|
|
5742
|
+
}
|
|
5476
5743
|
}
|
|
5477
5744
|
function normalizePropsOrEmits(props) {
|
|
5478
5745
|
return isArray(props) ? props.reduce(
|
|
@@ -5520,14 +5787,14 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
5520
5787
|
return ret;
|
|
5521
5788
|
}
|
|
5522
5789
|
function withAsyncContext(getAwaitable) {
|
|
5523
|
-
const ctx =
|
|
5790
|
+
const ctx = getCurrentGenericInstance();
|
|
5524
5791
|
if (!ctx) {
|
|
5525
5792
|
warn$1(
|
|
5526
5793
|
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
5527
5794
|
);
|
|
5528
5795
|
}
|
|
5529
5796
|
let awaitable = getAwaitable();
|
|
5530
|
-
|
|
5797
|
+
setCurrentInstance(null, void 0);
|
|
5531
5798
|
if (isPromise(awaitable)) {
|
|
5532
5799
|
awaitable = awaitable.catch((e) => {
|
|
5533
5800
|
setCurrentInstance(ctx);
|
|
@@ -5974,7 +6241,7 @@ function createAppContext() {
|
|
|
5974
6241
|
};
|
|
5975
6242
|
}
|
|
5976
6243
|
let uid$1 = 0;
|
|
5977
|
-
function createAppAPI(
|
|
6244
|
+
function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
5978
6245
|
return function createApp(rootComponent, rootProps = null) {
|
|
5979
6246
|
if (!isFunction(rootComponent)) {
|
|
5980
6247
|
rootComponent = extend({}, rootComponent);
|
|
@@ -6067,33 +6334,15 @@ function createAppAPI(render, hydrate) {
|
|
|
6067
6334
|
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
6068
6335
|
);
|
|
6069
6336
|
}
|
|
6070
|
-
const
|
|
6071
|
-
vnode.appContext = context;
|
|
6072
|
-
if (namespace === true) {
|
|
6073
|
-
namespace = "svg";
|
|
6074
|
-
} else if (namespace === false) {
|
|
6075
|
-
namespace = void 0;
|
|
6076
|
-
}
|
|
6337
|
+
const instance = mount(app, rootContainer, isHydrate, namespace);
|
|
6077
6338
|
{
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
cloned.el = null;
|
|
6081
|
-
render(cloned, rootContainer, namespace);
|
|
6082
|
-
};
|
|
6083
|
-
}
|
|
6084
|
-
if (isHydrate && hydrate) {
|
|
6085
|
-
hydrate(vnode, rootContainer);
|
|
6086
|
-
} else {
|
|
6087
|
-
render(vnode, rootContainer, namespace);
|
|
6339
|
+
app._instance = instance;
|
|
6340
|
+
devtoolsInitApp(app, version);
|
|
6088
6341
|
}
|
|
6089
6342
|
isMounted = true;
|
|
6090
6343
|
app._container = rootContainer;
|
|
6091
6344
|
rootContainer.__vue_app__ = app;
|
|
6092
|
-
|
|
6093
|
-
app._instance = vnode.component;
|
|
6094
|
-
devtoolsInitApp(app, version);
|
|
6095
|
-
}
|
|
6096
|
-
return getComponentPublicInstance(vnode.component);
|
|
6345
|
+
return getPublicInstance(instance);
|
|
6097
6346
|
} else {
|
|
6098
6347
|
warn$1(
|
|
6099
6348
|
`App has already been mounted.
|
|
@@ -6116,7 +6365,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6116
6365
|
app._instance,
|
|
6117
6366
|
16
|
|
6118
6367
|
);
|
|
6119
|
-
|
|
6368
|
+
unmount(app);
|
|
6120
6369
|
{
|
|
6121
6370
|
app._instance = null;
|
|
6122
6371
|
devtoolsUnmountApp(app);
|
|
@@ -6157,6 +6406,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6157
6406
|
let currentApp = null;
|
|
6158
6407
|
|
|
6159
6408
|
function provide(key, value) {
|
|
6409
|
+
const currentInstance = getCurrentGenericInstance();
|
|
6160
6410
|
if (!currentInstance) {
|
|
6161
6411
|
{
|
|
6162
6412
|
warn$1(`provide() can only be used inside setup().`);
|
|
@@ -6171,9 +6421,9 @@ function provide(key, value) {
|
|
|
6171
6421
|
}
|
|
6172
6422
|
}
|
|
6173
6423
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
6174
|
-
const instance =
|
|
6424
|
+
const instance = getCurrentGenericInstance();
|
|
6175
6425
|
if (instance || currentApp) {
|
|
6176
|
-
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.
|
|
6426
|
+
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
|
|
6177
6427
|
if (provides && key in provides) {
|
|
6178
6428
|
return provides[key];
|
|
6179
6429
|
} else if (arguments.length > 1) {
|
|
@@ -6186,7 +6436,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
6186
6436
|
}
|
|
6187
6437
|
}
|
|
6188
6438
|
function hasInjectionContext() {
|
|
6189
|
-
return !!(
|
|
6439
|
+
return !!(getCurrentGenericInstance() || currentApp);
|
|
6190
6440
|
}
|
|
6191
6441
|
|
|
6192
6442
|
const internalObjectProto = {};
|
|
@@ -6194,7 +6444,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
|
|
|
6194
6444
|
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
6195
6445
|
|
|
6196
6446
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
6197
|
-
const props = {};
|
|
6447
|
+
const props = instance.props = {};
|
|
6198
6448
|
const attrs = createInternalObject();
|
|
6199
6449
|
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
6200
6450
|
setFullProps(instance, rawProps, props, attrs);
|
|
@@ -6204,7 +6454,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
|
6204
6454
|
}
|
|
6205
6455
|
}
|
|
6206
6456
|
{
|
|
6207
|
-
validateProps(rawProps || {}, props, instance);
|
|
6457
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6208
6458
|
}
|
|
6209
6459
|
if (isStateful) {
|
|
6210
6460
|
instance.props = isSSR ? props : shallowReactive(props);
|
|
@@ -6256,11 +6506,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6256
6506
|
const camelizedKey = camelize(key);
|
|
6257
6507
|
props[camelizedKey] = resolvePropValue(
|
|
6258
6508
|
options,
|
|
6259
|
-
rawCurrentProps,
|
|
6260
6509
|
camelizedKey,
|
|
6261
6510
|
value,
|
|
6262
6511
|
instance,
|
|
6263
|
-
|
|
6512
|
+
baseResolveDefault
|
|
6264
6513
|
);
|
|
6265
6514
|
}
|
|
6266
6515
|
} else {
|
|
@@ -6287,10 +6536,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6287
6536
|
rawPrevProps[kebabKey] !== void 0)) {
|
|
6288
6537
|
props[key] = resolvePropValue(
|
|
6289
6538
|
options,
|
|
6290
|
-
rawCurrentProps,
|
|
6291
6539
|
key,
|
|
6292
6540
|
void 0,
|
|
6293
6541
|
instance,
|
|
6542
|
+
baseResolveDefault,
|
|
6294
6543
|
true
|
|
6295
6544
|
);
|
|
6296
6545
|
}
|
|
@@ -6312,7 +6561,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
6312
6561
|
trigger(instance.attrs, "set", "");
|
|
6313
6562
|
}
|
|
6314
6563
|
{
|
|
6315
|
-
validateProps(rawProps || {}, props, instance);
|
|
6564
|
+
validateProps(rawProps || {}, props, instance.propsOptions[0]);
|
|
6316
6565
|
}
|
|
6317
6566
|
}
|
|
6318
6567
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
@@ -6341,39 +6590,37 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
6341
6590
|
}
|
|
6342
6591
|
}
|
|
6343
6592
|
if (needCastKeys) {
|
|
6344
|
-
const rawCurrentProps = toRaw(props);
|
|
6345
6593
|
const castValues = rawCastValues || EMPTY_OBJ;
|
|
6346
6594
|
for (let i = 0; i < needCastKeys.length; i++) {
|
|
6347
6595
|
const key = needCastKeys[i];
|
|
6348
6596
|
props[key] = resolvePropValue(
|
|
6349
6597
|
options,
|
|
6350
|
-
rawCurrentProps,
|
|
6351
6598
|
key,
|
|
6352
6599
|
castValues[key],
|
|
6353
6600
|
instance,
|
|
6601
|
+
baseResolveDefault,
|
|
6354
6602
|
!hasOwn(castValues, key)
|
|
6355
6603
|
);
|
|
6356
6604
|
}
|
|
6357
6605
|
}
|
|
6358
6606
|
return hasAttrsChanged;
|
|
6359
6607
|
}
|
|
6360
|
-
function resolvePropValue(options,
|
|
6608
|
+
function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
|
|
6361
6609
|
const opt = options[key];
|
|
6362
6610
|
if (opt != null) {
|
|
6363
6611
|
const hasDefault = hasOwn(opt, "default");
|
|
6364
6612
|
if (hasDefault && value === void 0) {
|
|
6365
6613
|
const defaultValue = opt.default;
|
|
6366
6614
|
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
6367
|
-
const
|
|
6368
|
-
if (key
|
|
6369
|
-
value =
|
|
6615
|
+
const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
|
|
6616
|
+
if (hasOwn(cachedDefaults, key)) {
|
|
6617
|
+
value = cachedDefaults[key];
|
|
6370
6618
|
} else {
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6619
|
+
value = cachedDefaults[key] = resolveDefault(
|
|
6620
|
+
defaultValue,
|
|
6621
|
+
instance,
|
|
6622
|
+
key
|
|
6375
6623
|
);
|
|
6376
|
-
reset();
|
|
6377
6624
|
}
|
|
6378
6625
|
} else {
|
|
6379
6626
|
value = defaultValue;
|
|
@@ -6392,6 +6639,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
6392
6639
|
}
|
|
6393
6640
|
return value;
|
|
6394
6641
|
}
|
|
6642
|
+
function baseResolveDefault(factory, instance, key) {
|
|
6643
|
+
let value;
|
|
6644
|
+
const prev = setCurrentInstance(instance);
|
|
6645
|
+
const props = toRaw(instance.props);
|
|
6646
|
+
value = factory.call(
|
|
6647
|
+
null,
|
|
6648
|
+
props
|
|
6649
|
+
);
|
|
6650
|
+
setCurrentInstance(...prev);
|
|
6651
|
+
return value;
|
|
6652
|
+
}
|
|
6395
6653
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
6396
6654
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
6397
6655
|
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
@@ -6426,6 +6684,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6426
6684
|
}
|
|
6427
6685
|
return EMPTY_ARR;
|
|
6428
6686
|
}
|
|
6687
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
6688
|
+
const res = [normalized, needCastKeys];
|
|
6689
|
+
if (isObject(comp)) {
|
|
6690
|
+
cache.set(comp, res);
|
|
6691
|
+
}
|
|
6692
|
+
return res;
|
|
6693
|
+
}
|
|
6694
|
+
function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
|
|
6429
6695
|
if (isArray(raw)) {
|
|
6430
6696
|
for (let i = 0; i < raw.length; i++) {
|
|
6431
6697
|
if (!isString(raw[i])) {
|
|
@@ -6470,11 +6736,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
6470
6736
|
}
|
|
6471
6737
|
}
|
|
6472
6738
|
}
|
|
6473
|
-
const res = [normalized, needCastKeys];
|
|
6474
|
-
if (isObject(comp)) {
|
|
6475
|
-
cache.set(comp, res);
|
|
6476
|
-
}
|
|
6477
|
-
return res;
|
|
6478
6739
|
}
|
|
6479
6740
|
function validatePropName(key) {
|
|
6480
6741
|
if (key[0] !== "$" && !isReservedProp(key)) {
|
|
@@ -6496,26 +6757,26 @@ function getType(ctor) {
|
|
|
6496
6757
|
}
|
|
6497
6758
|
return "";
|
|
6498
6759
|
}
|
|
6499
|
-
function validateProps(rawProps,
|
|
6500
|
-
|
|
6501
|
-
const options = instance.propsOptions[0];
|
|
6760
|
+
function validateProps(rawProps, resolvedProps, options) {
|
|
6761
|
+
resolvedProps = toRaw(resolvedProps);
|
|
6502
6762
|
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
|
6503
6763
|
for (const key in options) {
|
|
6504
|
-
|
|
6505
|
-
if (opt
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6764
|
+
const opt = options[key];
|
|
6765
|
+
if (opt != null) {
|
|
6766
|
+
validateProp(
|
|
6767
|
+
key,
|
|
6768
|
+
resolvedProps[key],
|
|
6769
|
+
opt,
|
|
6770
|
+
resolvedProps,
|
|
6771
|
+
!camelizePropsKey.includes(key)
|
|
6772
|
+
);
|
|
6773
|
+
}
|
|
6513
6774
|
}
|
|
6514
6775
|
}
|
|
6515
|
-
function validateProp(
|
|
6516
|
-
const { type, required, validator, skipCheck } =
|
|
6776
|
+
function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
|
|
6777
|
+
const { type, required, validator, skipCheck } = propOptions;
|
|
6517
6778
|
if (required && isAbsent) {
|
|
6518
|
-
warn$1('Missing required prop: "' +
|
|
6779
|
+
warn$1('Missing required prop: "' + key + '"');
|
|
6519
6780
|
return;
|
|
6520
6781
|
}
|
|
6521
6782
|
if (value == null && !required) {
|
|
@@ -6531,12 +6792,12 @@ function validateProp(name, value, prop, props, isAbsent) {
|
|
|
6531
6792
|
isValid = valid;
|
|
6532
6793
|
}
|
|
6533
6794
|
if (!isValid) {
|
|
6534
|
-
warn$1(getInvalidTypeMessage(
|
|
6795
|
+
warn$1(getInvalidTypeMessage(key, value, expectedTypes));
|
|
6535
6796
|
return;
|
|
6536
6797
|
}
|
|
6537
6798
|
}
|
|
6538
|
-
if (validator && !validator(value,
|
|
6539
|
-
warn$1('Invalid prop: custom validator check failed for prop "' +
|
|
6799
|
+
if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
|
|
6800
|
+
warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
|
|
6540
6801
|
}
|
|
6541
6802
|
}
|
|
6542
6803
|
const isSimpleType = /* @__PURE__ */ makeMap(
|
|
@@ -6607,7 +6868,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
|
|
|
6607
6868
|
return rawSlot;
|
|
6608
6869
|
}
|
|
6609
6870
|
const normalized = withCtx((...args) => {
|
|
6610
|
-
if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6871
|
+
if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
|
|
6611
6872
|
warn$1(
|
|
6612
6873
|
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
|
|
6613
6874
|
);
|
|
@@ -6654,6 +6915,8 @@ const assignSlots = (slots, children, optimized) => {
|
|
|
6654
6915
|
const initSlots = (instance, children, optimized) => {
|
|
6655
6916
|
const slots = instance.slots = createInternalObject();
|
|
6656
6917
|
if (instance.vnode.shapeFlag & 32) {
|
|
6918
|
+
const cacheIndexes = children.__;
|
|
6919
|
+
if (cacheIndexes) def(slots, "__", cacheIndexes, true);
|
|
6657
6920
|
const type = children._;
|
|
6658
6921
|
if (type) {
|
|
6659
6922
|
assignSlots(slots, children, optimized);
|
|
@@ -6702,12 +6965,15 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6702
6965
|
|
|
6703
6966
|
let supported;
|
|
6704
6967
|
let perf;
|
|
6968
|
+
let cachedNow$1 = 0;
|
|
6969
|
+
const p$1 = /* @__PURE__ */ Promise.resolve();
|
|
6970
|
+
const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
|
|
6705
6971
|
function startMeasure(instance, type) {
|
|
6706
6972
|
if (instance.appContext.config.performance && isSupported()) {
|
|
6707
6973
|
perf.mark(`vue-${type}-${instance.uid}`);
|
|
6708
6974
|
}
|
|
6709
6975
|
{
|
|
6710
|
-
devtoolsPerfStart(instance, type,
|
|
6976
|
+
devtoolsPerfStart(instance, type, getNow$1());
|
|
6711
6977
|
}
|
|
6712
6978
|
}
|
|
6713
6979
|
function endMeasure(instance, type) {
|
|
@@ -6724,7 +6990,7 @@ function endMeasure(instance, type) {
|
|
|
6724
6990
|
perf.clearMarks(endTag);
|
|
6725
6991
|
}
|
|
6726
6992
|
{
|
|
6727
|
-
devtoolsPerfEnd(instance, type,
|
|
6993
|
+
devtoolsPerfEnd(instance, type, getNow$1());
|
|
6728
6994
|
}
|
|
6729
6995
|
}
|
|
6730
6996
|
function isSupported() {
|
|
@@ -6808,6 +7074,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6808
7074
|
optimized
|
|
6809
7075
|
);
|
|
6810
7076
|
break;
|
|
7077
|
+
case VaporSlot:
|
|
7078
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
|
|
7079
|
+
break;
|
|
6811
7080
|
default:
|
|
6812
7081
|
if (shapeFlag & 1) {
|
|
6813
7082
|
processElement(
|
|
@@ -6865,6 +7134,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6865
7134
|
}
|
|
6866
7135
|
if (ref != null && parentComponent) {
|
|
6867
7136
|
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
|
7137
|
+
} else if (ref == null && n1 && n1.ref != null) {
|
|
7138
|
+
setRef(n1.ref, null, parentSuspense, n1, true);
|
|
6868
7139
|
}
|
|
6869
7140
|
};
|
|
6870
7141
|
const processText = (n1, n2, container, anchor) => {
|
|
@@ -7018,11 +7289,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7018
7289
|
}
|
|
7019
7290
|
hostInsert(el, container, anchor);
|
|
7020
7291
|
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
|
7021
|
-
queuePostRenderEffect(
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7292
|
+
queuePostRenderEffect(
|
|
7293
|
+
() => {
|
|
7294
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7295
|
+
needCallTransitionHooks && transition.enter(el);
|
|
7296
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
7297
|
+
},
|
|
7298
|
+
void 0,
|
|
7299
|
+
parentSuspense
|
|
7300
|
+
);
|
|
7026
7301
|
}
|
|
7027
7302
|
};
|
|
7028
7303
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
@@ -7034,8 +7309,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7034
7309
|
hostSetScopeId(el, slotScopeIds[i]);
|
|
7035
7310
|
}
|
|
7036
7311
|
}
|
|
7037
|
-
|
|
7038
|
-
|
|
7312
|
+
let subTree = parentComponent && parentComponent.subTree;
|
|
7313
|
+
if (subTree) {
|
|
7039
7314
|
if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
|
7040
7315
|
subTree = filterSingleRoot(subTree.children) || subTree;
|
|
7041
7316
|
}
|
|
@@ -7152,10 +7427,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7152
7427
|
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
7153
7428
|
}
|
|
7154
7429
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
7155
|
-
queuePostRenderEffect(
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7430
|
+
queuePostRenderEffect(
|
|
7431
|
+
() => {
|
|
7432
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
7433
|
+
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
7434
|
+
},
|
|
7435
|
+
void 0,
|
|
7436
|
+
parentSuspense
|
|
7437
|
+
);
|
|
7159
7438
|
}
|
|
7160
7439
|
};
|
|
7161
7440
|
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
|
@@ -7283,7 +7562,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7283
7562
|
};
|
|
7284
7563
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
7285
7564
|
n2.slotScopeIds = slotScopeIds;
|
|
7286
|
-
if (
|
|
7565
|
+
if (n2.type.__vapor) {
|
|
7566
|
+
if (n1 == null) {
|
|
7567
|
+
getVaporInterface(parentComponent, n2).mount(
|
|
7568
|
+
n2,
|
|
7569
|
+
container,
|
|
7570
|
+
anchor,
|
|
7571
|
+
parentComponent
|
|
7572
|
+
);
|
|
7573
|
+
} else {
|
|
7574
|
+
getVaporInterface(parentComponent, n2).update(
|
|
7575
|
+
n1,
|
|
7576
|
+
n2,
|
|
7577
|
+
shouldUpdateComponent(n1, n2, optimized)
|
|
7578
|
+
);
|
|
7579
|
+
}
|
|
7580
|
+
} else if (n1 == null) {
|
|
7287
7581
|
if (n2.shapeFlag & 512) {
|
|
7288
7582
|
parentComponent.ctx.activate(
|
|
7289
7583
|
n2,
|
|
@@ -7369,15 +7663,52 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7369
7663
|
return;
|
|
7370
7664
|
} else {
|
|
7371
7665
|
instance.next = n2;
|
|
7372
|
-
instance.
|
|
7666
|
+
instance.effect.run();
|
|
7373
7667
|
}
|
|
7374
7668
|
} else {
|
|
7375
7669
|
n2.el = n1.el;
|
|
7376
7670
|
instance.vnode = n2;
|
|
7377
7671
|
}
|
|
7378
7672
|
};
|
|
7379
|
-
|
|
7380
|
-
|
|
7673
|
+
class SetupRenderEffect extends ReactiveEffect {
|
|
7674
|
+
constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
|
|
7675
|
+
const prevScope = setCurrentScope(instance.scope);
|
|
7676
|
+
super();
|
|
7677
|
+
this.instance = instance;
|
|
7678
|
+
this.initialVNode = initialVNode;
|
|
7679
|
+
this.container = container;
|
|
7680
|
+
this.anchor = anchor;
|
|
7681
|
+
this.parentSuspense = parentSuspense;
|
|
7682
|
+
this.namespace = namespace;
|
|
7683
|
+
this.optimized = optimized;
|
|
7684
|
+
setCurrentScope(prevScope);
|
|
7685
|
+
this.job = instance.job = () => {
|
|
7686
|
+
if (this.dirty) {
|
|
7687
|
+
this.run();
|
|
7688
|
+
}
|
|
7689
|
+
};
|
|
7690
|
+
this.job.i = instance;
|
|
7691
|
+
{
|
|
7692
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7693
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
notify() {
|
|
7697
|
+
if (!(this.flags & 256)) {
|
|
7698
|
+
const job = this.job;
|
|
7699
|
+
queueJob(job, job.i.uid);
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
fn() {
|
|
7703
|
+
const {
|
|
7704
|
+
instance,
|
|
7705
|
+
initialVNode,
|
|
7706
|
+
container,
|
|
7707
|
+
anchor,
|
|
7708
|
+
parentSuspense,
|
|
7709
|
+
namespace,
|
|
7710
|
+
optimized
|
|
7711
|
+
} = this;
|
|
7381
7712
|
if (!instance.isMounted) {
|
|
7382
7713
|
let vnodeHook;
|
|
7383
7714
|
const { el, props } = initialVNode;
|
|
@@ -7424,7 +7755,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7424
7755
|
hydrateSubTree();
|
|
7425
7756
|
}
|
|
7426
7757
|
} else {
|
|
7427
|
-
if (root.ce
|
|
7758
|
+
if (root.ce && // @ts-expect-error _def is private
|
|
7759
|
+
root.ce._def.shadowRoot !== false) {
|
|
7428
7760
|
root.ce._injectChildStyle(type);
|
|
7429
7761
|
}
|
|
7430
7762
|
{
|
|
@@ -7452,23 +7784,24 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7452
7784
|
initialVNode.el = subTree.el;
|
|
7453
7785
|
}
|
|
7454
7786
|
if (m) {
|
|
7455
|
-
queuePostRenderEffect(m, parentSuspense);
|
|
7787
|
+
queuePostRenderEffect(m, void 0, parentSuspense);
|
|
7456
7788
|
}
|
|
7457
7789
|
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
|
7458
7790
|
const scopedInitialVNode = initialVNode;
|
|
7459
7791
|
queuePostRenderEffect(
|
|
7460
7792
|
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
|
7793
|
+
void 0,
|
|
7461
7794
|
parentSuspense
|
|
7462
7795
|
);
|
|
7463
7796
|
}
|
|
7464
|
-
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7465
|
-
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7797
|
+
if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
|
7798
|
+
instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
|
|
7466
7799
|
}
|
|
7467
7800
|
instance.isMounted = true;
|
|
7468
7801
|
{
|
|
7469
7802
|
devtoolsComponentAdded(instance);
|
|
7470
7803
|
}
|
|
7471
|
-
initialVNode = container = anchor = null;
|
|
7804
|
+
this.initialVNode = this.container = this.anchor = null;
|
|
7472
7805
|
} else {
|
|
7473
7806
|
let { next, bu, u, parent, vnode } = instance;
|
|
7474
7807
|
{
|
|
@@ -7480,7 +7813,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7480
7813
|
}
|
|
7481
7814
|
nonHydratedAsyncRoot.asyncDep.then(() => {
|
|
7482
7815
|
if (!instance.isUnmounted) {
|
|
7483
|
-
|
|
7816
|
+
this.fn();
|
|
7484
7817
|
}
|
|
7485
7818
|
});
|
|
7486
7819
|
return;
|
|
@@ -7536,11 +7869,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7536
7869
|
updateHOCHostEl(instance, nextTree.el);
|
|
7537
7870
|
}
|
|
7538
7871
|
if (u) {
|
|
7539
|
-
queuePostRenderEffect(u, parentSuspense);
|
|
7872
|
+
queuePostRenderEffect(u, void 0, parentSuspense);
|
|
7540
7873
|
}
|
|
7541
7874
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
7542
7875
|
queuePostRenderEffect(
|
|
7543
7876
|
() => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
|
7877
|
+
void 0,
|
|
7544
7878
|
parentSuspense
|
|
7545
7879
|
);
|
|
7546
7880
|
}
|
|
@@ -7551,21 +7885,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7551
7885
|
popWarningContext();
|
|
7552
7886
|
}
|
|
7553
7887
|
}
|
|
7554
|
-
};
|
|
7555
|
-
instance.scope.on();
|
|
7556
|
-
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7557
|
-
instance.scope.off();
|
|
7558
|
-
const update = instance.update = effect.run.bind(effect);
|
|
7559
|
-
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7560
|
-
job.i = instance;
|
|
7561
|
-
job.id = instance.uid;
|
|
7562
|
-
effect.scheduler = () => queueJob(job);
|
|
7563
|
-
toggleRecurse(instance, true);
|
|
7564
|
-
{
|
|
7565
|
-
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7566
|
-
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7567
7888
|
}
|
|
7568
|
-
|
|
7889
|
+
}
|
|
7890
|
+
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
|
7891
|
+
const effect = instance.effect = new SetupRenderEffect(
|
|
7892
|
+
instance,
|
|
7893
|
+
initialVNode,
|
|
7894
|
+
container,
|
|
7895
|
+
anchor,
|
|
7896
|
+
parentSuspense,
|
|
7897
|
+
namespace,
|
|
7898
|
+
optimized
|
|
7899
|
+
);
|
|
7900
|
+
instance.update = effect.run.bind(effect);
|
|
7901
|
+
toggleRecurse(instance, true);
|
|
7902
|
+
effect.run();
|
|
7569
7903
|
};
|
|
7570
7904
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
7571
7905
|
nextVNode.component = instance;
|
|
@@ -7574,9 +7908,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7574
7908
|
instance.next = null;
|
|
7575
7909
|
updateProps(instance, nextVNode.props, prevProps, optimized);
|
|
7576
7910
|
updateSlots(instance, nextVNode.children, optimized);
|
|
7577
|
-
|
|
7911
|
+
const prevSub = setActiveSub();
|
|
7578
7912
|
flushPreFlushCbs(instance);
|
|
7579
|
-
|
|
7913
|
+
setActiveSub(prevSub);
|
|
7580
7914
|
};
|
|
7581
7915
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
|
7582
7916
|
const c1 = n1 && n1.children;
|
|
@@ -7853,7 +8187,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7853
8187
|
);
|
|
7854
8188
|
} else if (moved) {
|
|
7855
8189
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7856
|
-
move(
|
|
8190
|
+
move(
|
|
8191
|
+
nextChild,
|
|
8192
|
+
container,
|
|
8193
|
+
anchor,
|
|
8194
|
+
2,
|
|
8195
|
+
parentComponent
|
|
8196
|
+
);
|
|
7857
8197
|
} else {
|
|
7858
8198
|
j--;
|
|
7859
8199
|
}
|
|
@@ -7861,10 +8201,20 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7861
8201
|
}
|
|
7862
8202
|
}
|
|
7863
8203
|
};
|
|
7864
|
-
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
8204
|
+
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
7865
8205
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7866
8206
|
if (shapeFlag & 6) {
|
|
7867
|
-
|
|
8207
|
+
if (type.__vapor) {
|
|
8208
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
|
|
8209
|
+
} else {
|
|
8210
|
+
move(
|
|
8211
|
+
vnode.component.subTree,
|
|
8212
|
+
container,
|
|
8213
|
+
anchor,
|
|
8214
|
+
moveType,
|
|
8215
|
+
parentComponent
|
|
8216
|
+
);
|
|
8217
|
+
}
|
|
7868
8218
|
return;
|
|
7869
8219
|
}
|
|
7870
8220
|
if (shapeFlag & 128) {
|
|
@@ -7872,13 +8222,25 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7872
8222
|
return;
|
|
7873
8223
|
}
|
|
7874
8224
|
if (shapeFlag & 64) {
|
|
7875
|
-
type.move(
|
|
8225
|
+
type.move(
|
|
8226
|
+
vnode,
|
|
8227
|
+
container,
|
|
8228
|
+
anchor,
|
|
8229
|
+
internals,
|
|
8230
|
+
parentComponent
|
|
8231
|
+
);
|
|
7876
8232
|
return;
|
|
7877
8233
|
}
|
|
7878
8234
|
if (type === Fragment) {
|
|
7879
8235
|
hostInsert(el, container, anchor);
|
|
7880
8236
|
for (let i = 0; i < children.length; i++) {
|
|
7881
|
-
move(
|
|
8237
|
+
move(
|
|
8238
|
+
children[i],
|
|
8239
|
+
container,
|
|
8240
|
+
anchor,
|
|
8241
|
+
moveType,
|
|
8242
|
+
parentComponent
|
|
8243
|
+
);
|
|
7882
8244
|
}
|
|
7883
8245
|
hostInsert(vnode.anchor, container, anchor);
|
|
7884
8246
|
return;
|
|
@@ -7892,7 +8254,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7892
8254
|
if (moveType === 0) {
|
|
7893
8255
|
transition.beforeEnter(el);
|
|
7894
8256
|
hostInsert(el, container, anchor);
|
|
7895
|
-
queuePostRenderEffect(
|
|
8257
|
+
queuePostRenderEffect(
|
|
8258
|
+
() => transition.enter(el),
|
|
8259
|
+
void 0,
|
|
8260
|
+
parentSuspense
|
|
8261
|
+
);
|
|
7896
8262
|
} else {
|
|
7897
8263
|
const { leave, delayLeave, afterLeave } = transition;
|
|
7898
8264
|
const remove2 = () => {
|
|
@@ -7934,9 +8300,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7934
8300
|
optimized = false;
|
|
7935
8301
|
}
|
|
7936
8302
|
if (ref != null) {
|
|
7937
|
-
|
|
8303
|
+
const prevSub = setActiveSub();
|
|
7938
8304
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7939
|
-
|
|
8305
|
+
setActiveSub(prevSub);
|
|
7940
8306
|
}
|
|
7941
8307
|
if (cacheIndex != null) {
|
|
7942
8308
|
parentComponent.renderCache[cacheIndex] = void 0;
|
|
@@ -7952,7 +8318,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7952
8318
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7953
8319
|
}
|
|
7954
8320
|
if (shapeFlag & 6) {
|
|
7955
|
-
|
|
8321
|
+
if (type.__vapor) {
|
|
8322
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8323
|
+
return;
|
|
8324
|
+
} else {
|
|
8325
|
+
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
8326
|
+
}
|
|
7956
8327
|
} else {
|
|
7957
8328
|
if (shapeFlag & 128) {
|
|
7958
8329
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -7986,15 +8357,23 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7986
8357
|
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
|
7987
8358
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7988
8359
|
}
|
|
8360
|
+
if (type === VaporSlot) {
|
|
8361
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
8362
|
+
return;
|
|
8363
|
+
}
|
|
7989
8364
|
if (doRemove) {
|
|
7990
8365
|
remove(vnode);
|
|
7991
8366
|
}
|
|
7992
8367
|
}
|
|
7993
8368
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
|
7994
|
-
queuePostRenderEffect(
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
8369
|
+
queuePostRenderEffect(
|
|
8370
|
+
() => {
|
|
8371
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
8372
|
+
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
8373
|
+
},
|
|
8374
|
+
void 0,
|
|
8375
|
+
parentSuspense
|
|
8376
|
+
);
|
|
7998
8377
|
}
|
|
7999
8378
|
};
|
|
8000
8379
|
const remove = (vnode) => {
|
|
@@ -8051,7 +8430,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8051
8430
|
const {
|
|
8052
8431
|
bum,
|
|
8053
8432
|
scope,
|
|
8054
|
-
|
|
8433
|
+
effect,
|
|
8055
8434
|
subTree,
|
|
8056
8435
|
um,
|
|
8057
8436
|
m,
|
|
@@ -8070,16 +8449,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8070
8449
|
});
|
|
8071
8450
|
}
|
|
8072
8451
|
scope.stop();
|
|
8073
|
-
if (
|
|
8074
|
-
|
|
8452
|
+
if (effect) {
|
|
8453
|
+
effect.stop();
|
|
8075
8454
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8076
8455
|
}
|
|
8077
8456
|
if (um) {
|
|
8078
|
-
queuePostRenderEffect(um, parentSuspense);
|
|
8457
|
+
queuePostRenderEffect(um, void 0, parentSuspense);
|
|
8079
8458
|
}
|
|
8080
|
-
queuePostRenderEffect(
|
|
8081
|
-
instance.isUnmounted = true
|
|
8082
|
-
|
|
8459
|
+
queuePostRenderEffect(
|
|
8460
|
+
() => instance.isUnmounted = true,
|
|
8461
|
+
void 0,
|
|
8462
|
+
parentSuspense
|
|
8463
|
+
);
|
|
8083
8464
|
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
|
8084
8465
|
parentSuspense.deps--;
|
|
8085
8466
|
if (parentSuspense.deps === 0) {
|
|
@@ -8097,6 +8478,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8097
8478
|
};
|
|
8098
8479
|
const getNextHostNode = (vnode) => {
|
|
8099
8480
|
if (vnode.shapeFlag & 6) {
|
|
8481
|
+
if (vnode.type.__vapor) {
|
|
8482
|
+
return hostNextSibling(vnode.component.block);
|
|
8483
|
+
}
|
|
8100
8484
|
return getNextHostNode(vnode.component.subTree);
|
|
8101
8485
|
}
|
|
8102
8486
|
if (vnode.shapeFlag & 128) {
|
|
@@ -8106,7 +8490,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8106
8490
|
const teleportEnd = el && el[TeleportEndKey];
|
|
8107
8491
|
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
8108
8492
|
};
|
|
8109
|
-
let isFlushing = false;
|
|
8110
8493
|
const render = (vnode, container, namespace) => {
|
|
8111
8494
|
if (vnode == null) {
|
|
8112
8495
|
if (container._vnode) {
|
|
@@ -8124,12 +8507,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8124
8507
|
);
|
|
8125
8508
|
}
|
|
8126
8509
|
container._vnode = vnode;
|
|
8127
|
-
|
|
8128
|
-
isFlushing = true;
|
|
8129
|
-
flushPreFlushCbs();
|
|
8130
|
-
flushPostFlushCbs();
|
|
8131
|
-
isFlushing = false;
|
|
8132
|
-
}
|
|
8510
|
+
flushOnAppMount();
|
|
8133
8511
|
};
|
|
8134
8512
|
const internals = {
|
|
8135
8513
|
p: patch,
|
|
@@ -8137,35 +8515,67 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8137
8515
|
m: move,
|
|
8138
8516
|
r: remove,
|
|
8139
8517
|
mt: mountComponent,
|
|
8518
|
+
umt: unmountComponent,
|
|
8140
8519
|
mc: mountChildren,
|
|
8141
8520
|
pc: patchChildren,
|
|
8142
8521
|
pbc: patchBlockChildren,
|
|
8143
8522
|
n: getNextHostNode,
|
|
8144
8523
|
o: options
|
|
8145
8524
|
};
|
|
8146
|
-
let hydrate;
|
|
8147
|
-
let hydrateNode;
|
|
8148
|
-
if (createHydrationFns) {
|
|
8149
|
-
[hydrate, hydrateNode] = createHydrationFns(
|
|
8150
|
-
internals
|
|
8151
|
-
);
|
|
8152
|
-
}
|
|
8525
|
+
let hydrate;
|
|
8526
|
+
let hydrateNode;
|
|
8527
|
+
if (createHydrationFns) {
|
|
8528
|
+
[hydrate, hydrateNode] = createHydrationFns(
|
|
8529
|
+
internals
|
|
8530
|
+
);
|
|
8531
|
+
}
|
|
8532
|
+
const mountApp = (app, container, isHydrate, namespace) => {
|
|
8533
|
+
const vnode = app._ceVNode || createVNode(app._component, app._props);
|
|
8534
|
+
vnode.appContext = app._context;
|
|
8535
|
+
if (namespace === true) {
|
|
8536
|
+
namespace = "svg";
|
|
8537
|
+
} else if (namespace === false) {
|
|
8538
|
+
namespace = void 0;
|
|
8539
|
+
}
|
|
8540
|
+
{
|
|
8541
|
+
app._context.reload = () => {
|
|
8542
|
+
const cloned = cloneVNode(vnode);
|
|
8543
|
+
cloned.el = null;
|
|
8544
|
+
render(cloned, container, namespace);
|
|
8545
|
+
};
|
|
8546
|
+
}
|
|
8547
|
+
if (isHydrate && hydrate) {
|
|
8548
|
+
hydrate(vnode, container);
|
|
8549
|
+
} else {
|
|
8550
|
+
render(vnode, container, namespace);
|
|
8551
|
+
}
|
|
8552
|
+
return vnode.component;
|
|
8553
|
+
};
|
|
8554
|
+
const unmountApp = (app) => {
|
|
8555
|
+
render(null, app._container);
|
|
8556
|
+
};
|
|
8153
8557
|
return {
|
|
8154
8558
|
render,
|
|
8155
8559
|
hydrate,
|
|
8156
|
-
|
|
8560
|
+
internals,
|
|
8561
|
+
createApp: createAppAPI(
|
|
8562
|
+
mountApp,
|
|
8563
|
+
unmountApp,
|
|
8564
|
+
getComponentPublicInstance)
|
|
8157
8565
|
};
|
|
8158
8566
|
}
|
|
8159
8567
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8160
8568
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8161
8569
|
}
|
|
8162
|
-
function toggleRecurse({ effect, job }, allowed) {
|
|
8163
|
-
if (
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8570
|
+
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
8571
|
+
if (!vapor) {
|
|
8572
|
+
if (allowed) {
|
|
8573
|
+
effect.flags |= 128;
|
|
8574
|
+
job.flags |= 2;
|
|
8575
|
+
} else {
|
|
8576
|
+
effect.flags &= -129;
|
|
8577
|
+
job.flags &= -3;
|
|
8578
|
+
}
|
|
8169
8579
|
}
|
|
8170
8580
|
}
|
|
8171
8581
|
function needTransition(parentSuspense, transition) {
|
|
@@ -8198,46 +8608,6 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
8198
8608
|
}
|
|
8199
8609
|
}
|
|
8200
8610
|
}
|
|
8201
|
-
function getSequence(arr) {
|
|
8202
|
-
const p = arr.slice();
|
|
8203
|
-
const result = [0];
|
|
8204
|
-
let i, j, u, v, c;
|
|
8205
|
-
const len = arr.length;
|
|
8206
|
-
for (i = 0; i < len; i++) {
|
|
8207
|
-
const arrI = arr[i];
|
|
8208
|
-
if (arrI !== 0) {
|
|
8209
|
-
j = result[result.length - 1];
|
|
8210
|
-
if (arr[j] < arrI) {
|
|
8211
|
-
p[i] = j;
|
|
8212
|
-
result.push(i);
|
|
8213
|
-
continue;
|
|
8214
|
-
}
|
|
8215
|
-
u = 0;
|
|
8216
|
-
v = result.length - 1;
|
|
8217
|
-
while (u < v) {
|
|
8218
|
-
c = u + v >> 1;
|
|
8219
|
-
if (arr[result[c]] < arrI) {
|
|
8220
|
-
u = c + 1;
|
|
8221
|
-
} else {
|
|
8222
|
-
v = c;
|
|
8223
|
-
}
|
|
8224
|
-
}
|
|
8225
|
-
if (arrI < arr[result[u]]) {
|
|
8226
|
-
if (u > 0) {
|
|
8227
|
-
p[i] = result[u - 1];
|
|
8228
|
-
}
|
|
8229
|
-
result[u] = i;
|
|
8230
|
-
}
|
|
8231
|
-
}
|
|
8232
|
-
}
|
|
8233
|
-
u = result.length;
|
|
8234
|
-
v = result[u - 1];
|
|
8235
|
-
while (u-- > 0) {
|
|
8236
|
-
result[u] = v;
|
|
8237
|
-
v = p[v];
|
|
8238
|
-
}
|
|
8239
|
-
return result;
|
|
8240
|
-
}
|
|
8241
8611
|
function locateNonHydratedAsyncRoot(instance) {
|
|
8242
8612
|
const subComponent = instance.subTree.component;
|
|
8243
8613
|
if (subComponent) {
|
|
@@ -8251,8 +8621,22 @@ function locateNonHydratedAsyncRoot(instance) {
|
|
|
8251
8621
|
function invalidateMount(hooks) {
|
|
8252
8622
|
if (hooks) {
|
|
8253
8623
|
for (let i = 0; i < hooks.length; i++)
|
|
8254
|
-
hooks[i].flags |=
|
|
8624
|
+
hooks[i].flags |= 4;
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
function getVaporInterface(instance, vnode) {
|
|
8628
|
+
const ctx = instance ? instance.appContext : vnode.appContext;
|
|
8629
|
+
const res = ctx && ctx.vapor;
|
|
8630
|
+
if (!res) {
|
|
8631
|
+
warn$1(
|
|
8632
|
+
`Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
|
|
8633
|
+
\`\`\`
|
|
8634
|
+
import { vaporInteropPlugin } from 'vue'
|
|
8635
|
+
app.use(vaporInteropPlugin)
|
|
8636
|
+
\`\`\``
|
|
8637
|
+
);
|
|
8255
8638
|
}
|
|
8639
|
+
return res;
|
|
8256
8640
|
}
|
|
8257
8641
|
|
|
8258
8642
|
const ssrContextKey = Symbol.for("v-scx");
|
|
@@ -8293,8 +8677,41 @@ function watch(source, cb, options) {
|
|
|
8293
8677
|
}
|
|
8294
8678
|
return doWatch(source, cb, options);
|
|
8295
8679
|
}
|
|
8680
|
+
class RenderWatcherEffect extends WatcherEffect {
|
|
8681
|
+
constructor(instance, source, cb, options, flush) {
|
|
8682
|
+
super(source, cb, options);
|
|
8683
|
+
this.flush = flush;
|
|
8684
|
+
const job = () => {
|
|
8685
|
+
if (this.dirty) {
|
|
8686
|
+
this.run();
|
|
8687
|
+
}
|
|
8688
|
+
};
|
|
8689
|
+
if (cb) {
|
|
8690
|
+
this.flags |= 128;
|
|
8691
|
+
job.flags |= 2;
|
|
8692
|
+
}
|
|
8693
|
+
if (instance) {
|
|
8694
|
+
job.i = instance;
|
|
8695
|
+
}
|
|
8696
|
+
this.job = job;
|
|
8697
|
+
}
|
|
8698
|
+
notify() {
|
|
8699
|
+
const flags = this.flags;
|
|
8700
|
+
if (!(flags & 256)) {
|
|
8701
|
+
const flush = this.flush;
|
|
8702
|
+
const job = this.job;
|
|
8703
|
+
if (flush === "post") {
|
|
8704
|
+
queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
|
|
8705
|
+
} else if (flush === "pre") {
|
|
8706
|
+
queueJob(job, job.i ? job.i.uid : void 0, true);
|
|
8707
|
+
} else {
|
|
8708
|
+
job();
|
|
8709
|
+
}
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8296
8713
|
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8297
|
-
const { immediate, deep, flush, once } = options;
|
|
8714
|
+
const { immediate, deep, flush = "pre", once } = options;
|
|
8298
8715
|
if (!cb) {
|
|
8299
8716
|
if (immediate !== void 0) {
|
|
8300
8717
|
warn$1(
|
|
@@ -8331,42 +8748,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
|
8331
8748
|
}
|
|
8332
8749
|
const instance = currentInstance;
|
|
8333
8750
|
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
};
|
|
8751
|
+
const effect = new RenderWatcherEffect(
|
|
8752
|
+
instance,
|
|
8753
|
+
source,
|
|
8754
|
+
cb,
|
|
8755
|
+
baseWatchOptions,
|
|
8756
|
+
flush
|
|
8757
|
+
);
|
|
8758
|
+
if (cb) {
|
|
8759
|
+
effect.run(true);
|
|
8760
|
+
} else if (flush === "post") {
|
|
8761
|
+
queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
|
|
8762
|
+
} else {
|
|
8763
|
+
effect.run(true);
|
|
8348
8764
|
}
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
if (isPre) {
|
|
8354
|
-
job.flags |= 2;
|
|
8355
|
-
if (instance) {
|
|
8356
|
-
job.id = instance.uid;
|
|
8357
|
-
job.i = instance;
|
|
8358
|
-
}
|
|
8359
|
-
}
|
|
8360
|
-
};
|
|
8361
|
-
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
8765
|
+
const stop = effect.stop.bind(effect);
|
|
8766
|
+
stop.pause = effect.pause.bind(effect);
|
|
8767
|
+
stop.resume = effect.resume.bind(effect);
|
|
8768
|
+
stop.stop = stop;
|
|
8362
8769
|
if (isInSSRComponentSetup) {
|
|
8363
8770
|
if (ssrCleanup) {
|
|
8364
|
-
ssrCleanup.push(
|
|
8771
|
+
ssrCleanup.push(stop);
|
|
8365
8772
|
} else if (runsImmediately) {
|
|
8366
|
-
|
|
8773
|
+
stop();
|
|
8367
8774
|
}
|
|
8368
8775
|
}
|
|
8369
|
-
return
|
|
8776
|
+
return stop;
|
|
8370
8777
|
}
|
|
8371
8778
|
function instanceWatch(source, value, options) {
|
|
8372
8779
|
const publicThis = this.proxy;
|
|
@@ -8378,9 +8785,9 @@ function instanceWatch(source, value, options) {
|
|
|
8378
8785
|
cb = value.handler;
|
|
8379
8786
|
options = value;
|
|
8380
8787
|
}
|
|
8381
|
-
const
|
|
8788
|
+
const prev = setCurrentInstance(this);
|
|
8382
8789
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
8383
|
-
|
|
8790
|
+
setCurrentInstance(...prev);
|
|
8384
8791
|
return res;
|
|
8385
8792
|
}
|
|
8386
8793
|
function createPathGetter(ctx, path) {
|
|
@@ -8395,7 +8802,7 @@ function createPathGetter(ctx, path) {
|
|
|
8395
8802
|
}
|
|
8396
8803
|
|
|
8397
8804
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8398
|
-
const i =
|
|
8805
|
+
const i = getCurrentGenericInstance();
|
|
8399
8806
|
if (!i) {
|
|
8400
8807
|
warn$1(`useModel() called without active instance.`);
|
|
8401
8808
|
return ref();
|
|
@@ -8406,7 +8813,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8406
8813
|
return ref();
|
|
8407
8814
|
}
|
|
8408
8815
|
const hyphenatedName = hyphenate(name);
|
|
8409
|
-
const modifiers = getModelModifiers(props, camelizedName);
|
|
8816
|
+
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
8410
8817
|
const res = customRef((track, trigger) => {
|
|
8411
8818
|
let localValue;
|
|
8412
8819
|
let prevSetValue = EMPTY_OBJ;
|
|
@@ -8428,9 +8835,25 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8428
8835
|
if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
|
|
8429
8836
|
return;
|
|
8430
8837
|
}
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8838
|
+
let rawPropKeys;
|
|
8839
|
+
let parentPassedModelValue = false;
|
|
8840
|
+
let parentPassedModelUpdater = false;
|
|
8841
|
+
if (i.rawKeys) {
|
|
8842
|
+
rawPropKeys = i.rawKeys();
|
|
8843
|
+
} else {
|
|
8844
|
+
const rawProps = i.vnode.props;
|
|
8845
|
+
rawPropKeys = rawProps && Object.keys(rawProps);
|
|
8846
|
+
}
|
|
8847
|
+
if (rawPropKeys) {
|
|
8848
|
+
for (const key of rawPropKeys) {
|
|
8849
|
+
if (key === name || key === camelizedName || key === hyphenatedName) {
|
|
8850
|
+
parentPassedModelValue = true;
|
|
8851
|
+
} else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
|
|
8852
|
+
parentPassedModelUpdater = true;
|
|
8853
|
+
}
|
|
8854
|
+
}
|
|
8855
|
+
}
|
|
8856
|
+
if (!parentPassedModelValue || !parentPassedModelUpdater) {
|
|
8434
8857
|
localValue = value;
|
|
8435
8858
|
trigger();
|
|
8436
8859
|
}
|
|
@@ -8457,21 +8880,26 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
8457
8880
|
};
|
|
8458
8881
|
return res;
|
|
8459
8882
|
}
|
|
8460
|
-
const getModelModifiers = (props, modelName) => {
|
|
8461
|
-
return modelName === "modelValue" || modelName === "model-value" ? props
|
|
8883
|
+
const getModelModifiers = (props, modelName, getter) => {
|
|
8884
|
+
return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
|
|
8462
8885
|
};
|
|
8463
8886
|
|
|
8464
8887
|
function emit(instance, event, ...rawArgs) {
|
|
8888
|
+
return baseEmit(
|
|
8889
|
+
instance,
|
|
8890
|
+
instance.vnode.props || EMPTY_OBJ,
|
|
8891
|
+
defaultPropGetter,
|
|
8892
|
+
event,
|
|
8893
|
+
...rawArgs
|
|
8894
|
+
);
|
|
8895
|
+
}
|
|
8896
|
+
function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
8465
8897
|
if (instance.isUnmounted) return;
|
|
8466
|
-
const props = instance.vnode.props || EMPTY_OBJ;
|
|
8467
8898
|
{
|
|
8468
|
-
const {
|
|
8469
|
-
emitsOptions,
|
|
8470
|
-
propsOptions: [propsOptions]
|
|
8471
|
-
} = instance;
|
|
8899
|
+
const { emitsOptions, propsOptions } = instance;
|
|
8472
8900
|
if (emitsOptions) {
|
|
8473
8901
|
if (!(event in emitsOptions) && true) {
|
|
8474
|
-
if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
|
|
8902
|
+
if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
|
|
8475
8903
|
warn$1(
|
|
8476
8904
|
`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
|
|
8477
8905
|
);
|
|
@@ -8491,7 +8919,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8491
8919
|
}
|
|
8492
8920
|
let args = rawArgs;
|
|
8493
8921
|
const isModelListener = event.startsWith("update:");
|
|
8494
|
-
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
8922
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
8495
8923
|
if (modifiers) {
|
|
8496
8924
|
if (modifiers.trim) {
|
|
8497
8925
|
args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
@@ -8505,7 +8933,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8505
8933
|
}
|
|
8506
8934
|
{
|
|
8507
8935
|
const lowerCaseEvent = event.toLowerCase();
|
|
8508
|
-
if (lowerCaseEvent !== event && props
|
|
8936
|
+
if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
|
|
8509
8937
|
warn$1(
|
|
8510
8938
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
8511
8939
|
instance,
|
|
@@ -8517,10 +8945,10 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8517
8945
|
}
|
|
8518
8946
|
}
|
|
8519
8947
|
let handlerName;
|
|
8520
|
-
let handler = props
|
|
8521
|
-
props
|
|
8948
|
+
let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
|
|
8949
|
+
getter(props, handlerName = toHandlerKey(camelize(event)));
|
|
8522
8950
|
if (!handler && isModelListener) {
|
|
8523
|
-
handler = props
|
|
8951
|
+
handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
|
|
8524
8952
|
}
|
|
8525
8953
|
if (handler) {
|
|
8526
8954
|
callWithAsyncErrorHandling(
|
|
@@ -8530,7 +8958,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8530
8958
|
args
|
|
8531
8959
|
);
|
|
8532
8960
|
}
|
|
8533
|
-
const onceHandler = props
|
|
8961
|
+
const onceHandler = getter(props, handlerName + `Once`);
|
|
8534
8962
|
if (onceHandler) {
|
|
8535
8963
|
if (!instance.emitted) {
|
|
8536
8964
|
instance.emitted = {};
|
|
@@ -8546,6 +8974,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
8546
8974
|
);
|
|
8547
8975
|
}
|
|
8548
8976
|
}
|
|
8977
|
+
function defaultPropGetter(props, key) {
|
|
8978
|
+
return props[key];
|
|
8979
|
+
}
|
|
8549
8980
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
8550
8981
|
const cache = appContext.emitsCache;
|
|
8551
8982
|
const cached = cache.get(comp);
|
|
@@ -8873,7 +9304,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
8873
9304
|
return false;
|
|
8874
9305
|
}
|
|
8875
9306
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
8876
|
-
while (parent) {
|
|
9307
|
+
while (parent && !parent.vapor) {
|
|
8877
9308
|
const root = parent.subTree;
|
|
8878
9309
|
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
8879
9310
|
root.el = vnode.el;
|
|
@@ -9224,7 +9655,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9224
9655
|
pendingBranch,
|
|
9225
9656
|
container2,
|
|
9226
9657
|
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
9227
|
-
0
|
|
9658
|
+
0,
|
|
9659
|
+
parentComponent2
|
|
9228
9660
|
);
|
|
9229
9661
|
queuePostFlushCb(effects);
|
|
9230
9662
|
}
|
|
@@ -9237,7 +9669,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9237
9669
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
9238
9670
|
}
|
|
9239
9671
|
if (!delayEnter) {
|
|
9240
|
-
move(
|
|
9672
|
+
move(
|
|
9673
|
+
pendingBranch,
|
|
9674
|
+
container2,
|
|
9675
|
+
anchor,
|
|
9676
|
+
0,
|
|
9677
|
+
parentComponent2
|
|
9678
|
+
);
|
|
9241
9679
|
}
|
|
9242
9680
|
}
|
|
9243
9681
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -9310,7 +9748,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9310
9748
|
}
|
|
9311
9749
|
},
|
|
9312
9750
|
move(container2, anchor2, type) {
|
|
9313
|
-
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
9751
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
|
|
9314
9752
|
suspense.container = container2;
|
|
9315
9753
|
},
|
|
9316
9754
|
next() {
|
|
@@ -9450,7 +9888,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
9450
9888
|
}
|
|
9451
9889
|
return s;
|
|
9452
9890
|
}
|
|
9453
|
-
function queueEffectWithSuspense(fn, suspense) {
|
|
9891
|
+
function queueEffectWithSuspense(fn, id, suspense) {
|
|
9454
9892
|
if (suspense && suspense.pendingBranch) {
|
|
9455
9893
|
if (isArray(fn)) {
|
|
9456
9894
|
suspense.effects.push(...fn);
|
|
@@ -9458,7 +9896,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
9458
9896
|
suspense.effects.push(fn);
|
|
9459
9897
|
}
|
|
9460
9898
|
} else {
|
|
9461
|
-
queuePostFlushCb(fn);
|
|
9899
|
+
queuePostFlushCb(fn, id);
|
|
9462
9900
|
}
|
|
9463
9901
|
}
|
|
9464
9902
|
function setActiveBranch(suspense, branch) {
|
|
@@ -9484,6 +9922,7 @@ const Fragment = Symbol.for("v-fgt");
|
|
|
9484
9922
|
const Text = Symbol.for("v-txt");
|
|
9485
9923
|
const Comment = Symbol.for("v-cmt");
|
|
9486
9924
|
const Static = Symbol.for("v-stc");
|
|
9925
|
+
const VaporSlot = Symbol.for("v-vps");
|
|
9487
9926
|
const blockStack = [];
|
|
9488
9927
|
let currentBlock = null;
|
|
9489
9928
|
function openBlock(disableTracking = false) {
|
|
@@ -9857,6 +10296,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
9857
10296
|
]);
|
|
9858
10297
|
}
|
|
9859
10298
|
|
|
10299
|
+
let currentInstance = null;
|
|
10300
|
+
const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
|
|
10301
|
+
const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
|
|
10302
|
+
let isInSSRComponentSetup = false;
|
|
10303
|
+
let setInSSRSetupState;
|
|
10304
|
+
let simpleSetCurrentInstance;
|
|
10305
|
+
{
|
|
10306
|
+
const g = getGlobalThis();
|
|
10307
|
+
const registerGlobalSetter = (key, setter) => {
|
|
10308
|
+
let setters;
|
|
10309
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
10310
|
+
setters.push(setter);
|
|
10311
|
+
return (v) => {
|
|
10312
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
10313
|
+
else setters[0](v);
|
|
10314
|
+
};
|
|
10315
|
+
};
|
|
10316
|
+
simpleSetCurrentInstance = registerGlobalSetter(
|
|
10317
|
+
`__VUE_INSTANCE_SETTERS__`,
|
|
10318
|
+
(v) => currentInstance = v
|
|
10319
|
+
);
|
|
10320
|
+
setInSSRSetupState = registerGlobalSetter(
|
|
10321
|
+
`__VUE_SSR_SETTERS__`,
|
|
10322
|
+
(v) => isInSSRComponentSetup = v
|
|
10323
|
+
);
|
|
10324
|
+
}
|
|
10325
|
+
const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
|
|
10326
|
+
try {
|
|
10327
|
+
return [currentInstance, setCurrentScope(scope)];
|
|
10328
|
+
} finally {
|
|
10329
|
+
simpleSetCurrentInstance(instance);
|
|
10330
|
+
}
|
|
10331
|
+
};
|
|
10332
|
+
|
|
9860
10333
|
const emptyAppContext = createAppContext();
|
|
9861
10334
|
let uid = 0;
|
|
9862
10335
|
function createComponentInstance(vnode, parent, suspense) {
|
|
@@ -9901,7 +10374,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9901
10374
|
// to be set immediately
|
|
9902
10375
|
emitted: null,
|
|
9903
10376
|
// props default value
|
|
9904
|
-
propsDefaults:
|
|
10377
|
+
propsDefaults: null,
|
|
9905
10378
|
// inheritAttrs
|
|
9906
10379
|
inheritAttrs: type.inheritAttrs,
|
|
9907
10380
|
// state
|
|
@@ -9948,44 +10421,6 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
9948
10421
|
}
|
|
9949
10422
|
return instance;
|
|
9950
10423
|
}
|
|
9951
|
-
let currentInstance = null;
|
|
9952
|
-
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
9953
|
-
let internalSetCurrentInstance;
|
|
9954
|
-
let setInSSRSetupState;
|
|
9955
|
-
{
|
|
9956
|
-
const g = getGlobalThis();
|
|
9957
|
-
const registerGlobalSetter = (key, setter) => {
|
|
9958
|
-
let setters;
|
|
9959
|
-
if (!(setters = g[key])) setters = g[key] = [];
|
|
9960
|
-
setters.push(setter);
|
|
9961
|
-
return (v) => {
|
|
9962
|
-
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
9963
|
-
else setters[0](v);
|
|
9964
|
-
};
|
|
9965
|
-
};
|
|
9966
|
-
internalSetCurrentInstance = registerGlobalSetter(
|
|
9967
|
-
`__VUE_INSTANCE_SETTERS__`,
|
|
9968
|
-
(v) => currentInstance = v
|
|
9969
|
-
);
|
|
9970
|
-
setInSSRSetupState = registerGlobalSetter(
|
|
9971
|
-
`__VUE_SSR_SETTERS__`,
|
|
9972
|
-
(v) => isInSSRComponentSetup = v
|
|
9973
|
-
);
|
|
9974
|
-
}
|
|
9975
|
-
const setCurrentInstance = (instance) => {
|
|
9976
|
-
const prev = currentInstance;
|
|
9977
|
-
internalSetCurrentInstance(instance);
|
|
9978
|
-
instance.scope.on();
|
|
9979
|
-
return () => {
|
|
9980
|
-
instance.scope.off();
|
|
9981
|
-
internalSetCurrentInstance(prev);
|
|
9982
|
-
};
|
|
9983
|
-
};
|
|
9984
|
-
const unsetCurrentInstance = () => {
|
|
9985
|
-
currentInstance && currentInstance.scope.off();
|
|
9986
|
-
internalSetCurrentInstance(null);
|
|
9987
|
-
};
|
|
9988
|
-
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
9989
10424
|
function validateComponentName(name, { isNativeTag }) {
|
|
9990
10425
|
if (isBuiltInTag(name) || isNativeTag(name)) {
|
|
9991
10426
|
warn$1(
|
|
@@ -9996,13 +10431,16 @@ function validateComponentName(name, { isNativeTag }) {
|
|
|
9996
10431
|
function isStatefulComponent(instance) {
|
|
9997
10432
|
return instance.vnode.shapeFlag & 4;
|
|
9998
10433
|
}
|
|
9999
|
-
let isInSSRComponentSetup = false;
|
|
10000
10434
|
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
10001
10435
|
isSSR && setInSSRSetupState(isSSR);
|
|
10002
|
-
const { props, children } = instance.vnode;
|
|
10436
|
+
const { props, children, vi } = instance.vnode;
|
|
10003
10437
|
const isStateful = isStatefulComponent(instance);
|
|
10004
|
-
|
|
10005
|
-
|
|
10438
|
+
if (vi) {
|
|
10439
|
+
vi(instance);
|
|
10440
|
+
} else {
|
|
10441
|
+
initProps(instance, props, isStateful, isSSR);
|
|
10442
|
+
initSlots(instance, children, optimized || isSSR);
|
|
10443
|
+
}
|
|
10006
10444
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
10007
10445
|
isSSR && setInSSRSetupState(false);
|
|
10008
10446
|
return setupResult;
|
|
@@ -10039,9 +10477,9 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10039
10477
|
}
|
|
10040
10478
|
const { setup } = Component;
|
|
10041
10479
|
if (setup) {
|
|
10042
|
-
|
|
10480
|
+
const prevSub = setActiveSub();
|
|
10043
10481
|
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
|
10044
|
-
const
|
|
10482
|
+
const prev = setCurrentInstance(instance);
|
|
10045
10483
|
const setupResult = callWithErrorHandling(
|
|
10046
10484
|
setup,
|
|
10047
10485
|
instance,
|
|
@@ -10052,12 +10490,15 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10052
10490
|
]
|
|
10053
10491
|
);
|
|
10054
10492
|
const isAsyncSetup = isPromise(setupResult);
|
|
10055
|
-
|
|
10056
|
-
|
|
10493
|
+
setActiveSub(prevSub);
|
|
10494
|
+
setCurrentInstance(...prev);
|
|
10057
10495
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
10058
10496
|
markAsyncBoundary(instance);
|
|
10059
10497
|
}
|
|
10060
10498
|
if (isAsyncSetup) {
|
|
10499
|
+
const unsetCurrentInstance = () => {
|
|
10500
|
+
setCurrentInstance(null, void 0);
|
|
10501
|
+
};
|
|
10061
10502
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
10062
10503
|
if (isSSR) {
|
|
10063
10504
|
return setupResult.then((resolvedResult) => {
|
|
@@ -10152,13 +10593,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
10152
10593
|
}
|
|
10153
10594
|
}
|
|
10154
10595
|
{
|
|
10155
|
-
const
|
|
10156
|
-
|
|
10596
|
+
const prevInstance = setCurrentInstance(instance);
|
|
10597
|
+
const prevSub = setActiveSub();
|
|
10157
10598
|
try {
|
|
10158
10599
|
applyOptions(instance);
|
|
10159
10600
|
} finally {
|
|
10160
|
-
|
|
10161
|
-
|
|
10601
|
+
setActiveSub(prevSub);
|
|
10602
|
+
setCurrentInstance(...prevInstance);
|
|
10162
10603
|
}
|
|
10163
10604
|
}
|
|
10164
10605
|
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
@@ -10195,29 +10636,6 @@ function getSlotsProxy(instance) {
|
|
|
10195
10636
|
});
|
|
10196
10637
|
}
|
|
10197
10638
|
function createSetupContext(instance) {
|
|
10198
|
-
const expose = (exposed) => {
|
|
10199
|
-
{
|
|
10200
|
-
if (instance.exposed) {
|
|
10201
|
-
warn$1(`expose() should be called only once per setup().`);
|
|
10202
|
-
}
|
|
10203
|
-
if (exposed != null) {
|
|
10204
|
-
let exposedType = typeof exposed;
|
|
10205
|
-
if (exposedType === "object") {
|
|
10206
|
-
if (isArray(exposed)) {
|
|
10207
|
-
exposedType = "array";
|
|
10208
|
-
} else if (isRef(exposed)) {
|
|
10209
|
-
exposedType = "ref";
|
|
10210
|
-
}
|
|
10211
|
-
}
|
|
10212
|
-
if (exposedType !== "object") {
|
|
10213
|
-
warn$1(
|
|
10214
|
-
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10215
|
-
);
|
|
10216
|
-
}
|
|
10217
|
-
}
|
|
10218
|
-
}
|
|
10219
|
-
instance.exposed = exposed || {};
|
|
10220
|
-
};
|
|
10221
10639
|
{
|
|
10222
10640
|
let attrsProxy;
|
|
10223
10641
|
let slotsProxy;
|
|
@@ -10231,10 +10649,33 @@ function createSetupContext(instance) {
|
|
|
10231
10649
|
get emit() {
|
|
10232
10650
|
return (event, ...args) => instance.emit(event, ...args);
|
|
10233
10651
|
},
|
|
10234
|
-
expose
|
|
10652
|
+
expose: (exposed) => expose(instance, exposed)
|
|
10235
10653
|
});
|
|
10236
10654
|
}
|
|
10237
10655
|
}
|
|
10656
|
+
function expose(instance, exposed) {
|
|
10657
|
+
{
|
|
10658
|
+
if (instance.exposed) {
|
|
10659
|
+
warn$1(`expose() should be called only once per setup().`);
|
|
10660
|
+
}
|
|
10661
|
+
if (exposed != null) {
|
|
10662
|
+
let exposedType = typeof exposed;
|
|
10663
|
+
if (exposedType === "object") {
|
|
10664
|
+
if (isArray(exposed)) {
|
|
10665
|
+
exposedType = "array";
|
|
10666
|
+
} else if (isRef(exposed)) {
|
|
10667
|
+
exposedType = "ref";
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
if (exposedType !== "object") {
|
|
10671
|
+
warn$1(
|
|
10672
|
+
`expose() should be passed a plain object, received ${exposedType}.`
|
|
10673
|
+
);
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
}
|
|
10677
|
+
instance.exposed = exposed || {};
|
|
10678
|
+
}
|
|
10238
10679
|
function getComponentPublicInstance(instance) {
|
|
10239
10680
|
if (instance.exposed) {
|
|
10240
10681
|
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
@@ -10242,7 +10683,9 @@ function getComponentPublicInstance(instance) {
|
|
|
10242
10683
|
if (key in target) {
|
|
10243
10684
|
return target[key];
|
|
10244
10685
|
} else if (key in publicPropertiesMap) {
|
|
10245
|
-
return publicPropertiesMap[key](
|
|
10686
|
+
return publicPropertiesMap[key](
|
|
10687
|
+
instance
|
|
10688
|
+
);
|
|
10246
10689
|
}
|
|
10247
10690
|
},
|
|
10248
10691
|
has(target, key) {
|
|
@@ -10285,14 +10728,7 @@ function isClassComponent(value) {
|
|
|
10285
10728
|
}
|
|
10286
10729
|
|
|
10287
10730
|
const computed = (getterOrOptions, debugOptions) => {
|
|
10288
|
-
|
|
10289
|
-
{
|
|
10290
|
-
const i = getCurrentInstance();
|
|
10291
|
-
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
10292
|
-
c._warnRecursive = true;
|
|
10293
|
-
}
|
|
10294
|
-
}
|
|
10295
|
-
return c;
|
|
10731
|
+
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
10296
10732
|
};
|
|
10297
10733
|
|
|
10298
10734
|
function h(type, propsOrChildren, children) {
|
|
@@ -10333,9 +10769,9 @@ function initCustomFormatter() {
|
|
|
10333
10769
|
if (obj.__isVue) {
|
|
10334
10770
|
return ["div", vueStyle, `VueInstance`];
|
|
10335
10771
|
} else if (isRef(obj)) {
|
|
10336
|
-
|
|
10772
|
+
const prevSub = setActiveSub();
|
|
10337
10773
|
const value = obj.value;
|
|
10338
|
-
|
|
10774
|
+
setActiveSub(prevSub);
|
|
10339
10775
|
return [
|
|
10340
10776
|
"div",
|
|
10341
10777
|
{},
|
|
@@ -10522,7 +10958,7 @@ function isMemoSame(cached, memo) {
|
|
|
10522
10958
|
return true;
|
|
10523
10959
|
}
|
|
10524
10960
|
|
|
10525
|
-
const version = "3.
|
|
10961
|
+
const version = "3.6.0-alpha.1";
|
|
10526
10962
|
const warn = warn$1 ;
|
|
10527
10963
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10528
10964
|
const devtools = devtools$1 ;
|
|
@@ -11035,8 +11471,9 @@ function setVarsOnNode(el, vars) {
|
|
|
11035
11471
|
const style = el.style;
|
|
11036
11472
|
let cssText = "";
|
|
11037
11473
|
for (const key in vars) {
|
|
11038
|
-
|
|
11039
|
-
|
|
11474
|
+
const value = normalizeCssVarValue(vars[key]);
|
|
11475
|
+
style.setProperty(`--${key}`, value);
|
|
11476
|
+
cssText += `--${key}: ${value};`;
|
|
11040
11477
|
}
|
|
11041
11478
|
style[CSS_VAR_TEXT] = cssText;
|
|
11042
11479
|
}
|
|
@@ -11093,11 +11530,11 @@ function patchStyle(el, prev, next) {
|
|
|
11093
11530
|
}
|
|
11094
11531
|
const semicolonRE = /[^\\];\s*$/;
|
|
11095
11532
|
const importantRE = /\s*!important$/;
|
|
11096
|
-
function setStyle(style, name,
|
|
11097
|
-
if (isArray(
|
|
11098
|
-
|
|
11533
|
+
function setStyle(style, name, rawVal) {
|
|
11534
|
+
if (isArray(rawVal)) {
|
|
11535
|
+
rawVal.forEach((v) => setStyle(style, name, v));
|
|
11099
11536
|
} else {
|
|
11100
|
-
|
|
11537
|
+
const val = rawVal == null ? "" : String(rawVal);
|
|
11101
11538
|
{
|
|
11102
11539
|
if (semicolonRE.test(val)) {
|
|
11103
11540
|
warn(
|
|
@@ -11170,8 +11607,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
|
11170
11607
|
return;
|
|
11171
11608
|
}
|
|
11172
11609
|
const tag = el.tagName;
|
|
11173
|
-
if (key === "value" && tag
|
|
11174
|
-
!tag.includes("-")) {
|
|
11610
|
+
if (key === "value" && canSetValueDirectly(tag)) {
|
|
11175
11611
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
11176
11612
|
const newValue = value == null ? (
|
|
11177
11613
|
// #11647: value should be set as empty string for null and undefined,
|
|
@@ -11299,8 +11735,6 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
11299
11735
|
}
|
|
11300
11736
|
}
|
|
11301
11737
|
|
|
11302
|
-
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
11303
|
-
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
11304
11738
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
11305
11739
|
const isSVG = namespace === "svg";
|
|
11306
11740
|
if (key === "class") {
|
|
@@ -11340,24 +11774,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
11340
11774
|
}
|
|
11341
11775
|
return false;
|
|
11342
11776
|
}
|
|
11343
|
-
if (
|
|
11344
|
-
return false;
|
|
11345
|
-
}
|
|
11346
|
-
if (key === "form") {
|
|
11347
|
-
return false;
|
|
11348
|
-
}
|
|
11349
|
-
if (key === "list" && el.tagName === "INPUT") {
|
|
11350
|
-
return false;
|
|
11351
|
-
}
|
|
11352
|
-
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
11777
|
+
if (shouldSetAsAttr(el.tagName, key)) {
|
|
11353
11778
|
return false;
|
|
11354
11779
|
}
|
|
11355
|
-
if (key === "width" || key === "height") {
|
|
11356
|
-
const tag = el.tagName;
|
|
11357
|
-
if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
|
11358
|
-
return false;
|
|
11359
|
-
}
|
|
11360
|
-
}
|
|
11361
11780
|
if (isNativeOn(key) && isString(value)) {
|
|
11362
11781
|
return false;
|
|
11363
11782
|
}
|
|
@@ -11525,9 +11944,10 @@ class VueElement extends BaseClass {
|
|
|
11525
11944
|
};
|
|
11526
11945
|
const asyncDef = this._def.__asyncLoader;
|
|
11527
11946
|
if (asyncDef) {
|
|
11528
|
-
this._pendingResolve = asyncDef().then(
|
|
11529
|
-
|
|
11530
|
-
|
|
11947
|
+
this._pendingResolve = asyncDef().then((def) => {
|
|
11948
|
+
def.configureApp = this._def.configureApp;
|
|
11949
|
+
resolve(this._def = def, true);
|
|
11950
|
+
});
|
|
11531
11951
|
} else {
|
|
11532
11952
|
resolve(this._def);
|
|
11533
11953
|
}
|
|
@@ -11962,28 +12382,12 @@ const assignKey = Symbol("_assign");
|
|
|
11962
12382
|
const vModelText = {
|
|
11963
12383
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
11964
12384
|
el[assignKey] = getModelAssigner(vnode);
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
}
|
|
11972
|
-
if (castToNumber) {
|
|
11973
|
-
domValue = looseToNumber(domValue);
|
|
11974
|
-
}
|
|
11975
|
-
el[assignKey](domValue);
|
|
11976
|
-
});
|
|
11977
|
-
if (trim) {
|
|
11978
|
-
addEventListener(el, "change", () => {
|
|
11979
|
-
el.value = el.value.trim();
|
|
11980
|
-
});
|
|
11981
|
-
}
|
|
11982
|
-
if (!lazy) {
|
|
11983
|
-
addEventListener(el, "compositionstart", onCompositionStart);
|
|
11984
|
-
addEventListener(el, "compositionend", onCompositionEnd);
|
|
11985
|
-
addEventListener(el, "change", onCompositionEnd);
|
|
11986
|
-
}
|
|
12385
|
+
vModelTextInit(
|
|
12386
|
+
el,
|
|
12387
|
+
trim,
|
|
12388
|
+
number || !!(vnode.props && vnode.props.type === "number"),
|
|
12389
|
+
lazy
|
|
12390
|
+
);
|
|
11987
12391
|
},
|
|
11988
12392
|
// set value on mounted so it's after min/max for type="range"
|
|
11989
12393
|
mounted(el, { value }) {
|
|
@@ -11991,70 +12395,111 @@ const vModelText = {
|
|
|
11991
12395
|
},
|
|
11992
12396
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
11993
12397
|
el[assignKey] = getModelAssigner(vnode);
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
12398
|
+
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
12399
|
+
}
|
|
12400
|
+
};
|
|
12401
|
+
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
12402
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
12403
|
+
if (e.target.composing) return;
|
|
12404
|
+
let domValue = el.value;
|
|
12405
|
+
if (trim) {
|
|
12406
|
+
domValue = domValue.trim();
|
|
12407
|
+
}
|
|
12408
|
+
if (number || el.type === "number") {
|
|
12409
|
+
domValue = looseToNumber(domValue);
|
|
12410
|
+
}
|
|
12411
|
+
(0, el[assignKey])(domValue);
|
|
12412
|
+
});
|
|
12413
|
+
if (trim) {
|
|
12414
|
+
addEventListener(el, "change", () => {
|
|
12415
|
+
el.value = el.value.trim();
|
|
12416
|
+
});
|
|
12417
|
+
}
|
|
12418
|
+
if (!lazy) {
|
|
12419
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
12420
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
12421
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
12422
|
+
}
|
|
12423
|
+
};
|
|
12424
|
+
const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
12425
|
+
if (el.composing) return;
|
|
12426
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
12427
|
+
const newValue = value == null ? "" : value;
|
|
12428
|
+
if (elValue === newValue) {
|
|
12429
|
+
return;
|
|
12430
|
+
}
|
|
12431
|
+
if (document.activeElement === el && el.type !== "range") {
|
|
12432
|
+
if (lazy && value === oldValue) {
|
|
11998
12433
|
return;
|
|
11999
12434
|
}
|
|
12000
|
-
if (
|
|
12001
|
-
|
|
12002
|
-
return;
|
|
12003
|
-
}
|
|
12004
|
-
if (trim && el.value.trim() === newValue) {
|
|
12005
|
-
return;
|
|
12006
|
-
}
|
|
12435
|
+
if (trim && el.value.trim() === newValue) {
|
|
12436
|
+
return;
|
|
12007
12437
|
}
|
|
12008
|
-
el.value = newValue;
|
|
12009
12438
|
}
|
|
12439
|
+
el.value = newValue;
|
|
12010
12440
|
};
|
|
12011
12441
|
const vModelCheckbox = {
|
|
12012
12442
|
// #4096 array checkboxes need to be deep traversed
|
|
12013
12443
|
deep: true,
|
|
12014
12444
|
created(el, _, vnode) {
|
|
12015
12445
|
el[assignKey] = getModelAssigner(vnode);
|
|
12016
|
-
|
|
12017
|
-
const modelValue = el._modelValue;
|
|
12018
|
-
const elementValue = getValue(el);
|
|
12019
|
-
const checked = el.checked;
|
|
12020
|
-
const assign = el[assignKey];
|
|
12021
|
-
if (isArray(modelValue)) {
|
|
12022
|
-
const index = looseIndexOf(modelValue, elementValue);
|
|
12023
|
-
const found = index !== -1;
|
|
12024
|
-
if (checked && !found) {
|
|
12025
|
-
assign(modelValue.concat(elementValue));
|
|
12026
|
-
} else if (!checked && found) {
|
|
12027
|
-
const filtered = [...modelValue];
|
|
12028
|
-
filtered.splice(index, 1);
|
|
12029
|
-
assign(filtered);
|
|
12030
|
-
}
|
|
12031
|
-
} else if (isSet(modelValue)) {
|
|
12032
|
-
const cloned = new Set(modelValue);
|
|
12033
|
-
if (checked) {
|
|
12034
|
-
cloned.add(elementValue);
|
|
12035
|
-
} else {
|
|
12036
|
-
cloned.delete(elementValue);
|
|
12037
|
-
}
|
|
12038
|
-
assign(cloned);
|
|
12039
|
-
} else {
|
|
12040
|
-
assign(getCheckboxValue(el, checked));
|
|
12041
|
-
}
|
|
12042
|
-
});
|
|
12446
|
+
vModelCheckboxInit(el);
|
|
12043
12447
|
},
|
|
12044
12448
|
// set initial checked on mount to wait for true-value/false-value
|
|
12045
|
-
mounted
|
|
12449
|
+
mounted(el, binding, vnode) {
|
|
12450
|
+
vModelCheckboxUpdate(
|
|
12451
|
+
el,
|
|
12452
|
+
binding.oldValue,
|
|
12453
|
+
binding.value,
|
|
12454
|
+
vnode.props.value
|
|
12455
|
+
);
|
|
12456
|
+
},
|
|
12046
12457
|
beforeUpdate(el, binding, vnode) {
|
|
12047
12458
|
el[assignKey] = getModelAssigner(vnode);
|
|
12048
|
-
|
|
12459
|
+
vModelCheckboxUpdate(
|
|
12460
|
+
el,
|
|
12461
|
+
binding.oldValue,
|
|
12462
|
+
binding.value,
|
|
12463
|
+
vnode.props.value
|
|
12464
|
+
);
|
|
12049
12465
|
}
|
|
12050
12466
|
};
|
|
12051
|
-
|
|
12467
|
+
const vModelCheckboxInit = (el, set) => {
|
|
12468
|
+
addEventListener(el, "change", () => {
|
|
12469
|
+
const assign = el[assignKey];
|
|
12470
|
+
const modelValue = el._modelValue;
|
|
12471
|
+
const elementValue = getValue(el);
|
|
12472
|
+
const checked = el.checked;
|
|
12473
|
+
if (isArray(modelValue)) {
|
|
12474
|
+
const index = looseIndexOf(modelValue, elementValue);
|
|
12475
|
+
const found = index !== -1;
|
|
12476
|
+
if (checked && !found) {
|
|
12477
|
+
assign(modelValue.concat(elementValue));
|
|
12478
|
+
} else if (!checked && found) {
|
|
12479
|
+
const filtered = [...modelValue];
|
|
12480
|
+
filtered.splice(index, 1);
|
|
12481
|
+
assign(filtered);
|
|
12482
|
+
}
|
|
12483
|
+
} else if (isSet(modelValue)) {
|
|
12484
|
+
const cloned = new Set(modelValue);
|
|
12485
|
+
if (checked) {
|
|
12486
|
+
cloned.add(elementValue);
|
|
12487
|
+
} else {
|
|
12488
|
+
cloned.delete(elementValue);
|
|
12489
|
+
}
|
|
12490
|
+
assign(cloned);
|
|
12491
|
+
} else {
|
|
12492
|
+
assign(getCheckboxValue(el, checked));
|
|
12493
|
+
}
|
|
12494
|
+
});
|
|
12495
|
+
};
|
|
12496
|
+
const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
|
|
12052
12497
|
el._modelValue = value;
|
|
12053
12498
|
let checked;
|
|
12054
12499
|
if (isArray(value)) {
|
|
12055
|
-
checked = looseIndexOf(value,
|
|
12500
|
+
checked = looseIndexOf(value, rawValue) > -1;
|
|
12056
12501
|
} else if (isSet(value)) {
|
|
12057
|
-
checked = value.has(
|
|
12502
|
+
checked = value.has(rawValue);
|
|
12058
12503
|
} else {
|
|
12059
12504
|
if (value === oldValue) return;
|
|
12060
12505
|
checked = looseEqual(value, getCheckboxValue(el, true));
|
|
@@ -12062,7 +12507,7 @@ function setChecked(el, { value, oldValue }, vnode) {
|
|
|
12062
12507
|
if (el.checked !== checked) {
|
|
12063
12508
|
el.checked = checked;
|
|
12064
12509
|
}
|
|
12065
|
-
}
|
|
12510
|
+
};
|
|
12066
12511
|
const vModelRadio = {
|
|
12067
12512
|
created(el, { value }, vnode) {
|
|
12068
12513
|
el.checked = looseEqual(value, vnode.props.value);
|
|
@@ -12082,36 +12527,38 @@ const vModelSelect = {
|
|
|
12082
12527
|
// <select multiple> value need to be deep traversed
|
|
12083
12528
|
deep: true,
|
|
12084
12529
|
created(el, { value, modifiers: { number } }, vnode) {
|
|
12085
|
-
|
|
12086
|
-
addEventListener(el, "change", () => {
|
|
12087
|
-
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12088
|
-
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12089
|
-
);
|
|
12090
|
-
el[assignKey](
|
|
12091
|
-
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12092
|
-
);
|
|
12093
|
-
el._assigning = true;
|
|
12094
|
-
nextTick(() => {
|
|
12095
|
-
el._assigning = false;
|
|
12096
|
-
});
|
|
12097
|
-
});
|
|
12530
|
+
vModelSelectInit(el, value, number);
|
|
12098
12531
|
el[assignKey] = getModelAssigner(vnode);
|
|
12099
12532
|
},
|
|
12100
12533
|
// set value in mounted & updated because <select> relies on its children
|
|
12101
12534
|
// <option>s.
|
|
12102
12535
|
mounted(el, { value }) {
|
|
12103
|
-
|
|
12536
|
+
vModelSetSelected(el, value);
|
|
12104
12537
|
},
|
|
12105
12538
|
beforeUpdate(el, _binding, vnode) {
|
|
12106
12539
|
el[assignKey] = getModelAssigner(vnode);
|
|
12107
12540
|
},
|
|
12108
12541
|
updated(el, { value }) {
|
|
12109
|
-
|
|
12110
|
-
setSelected(el, value);
|
|
12111
|
-
}
|
|
12542
|
+
vModelSetSelected(el, value);
|
|
12112
12543
|
}
|
|
12113
12544
|
};
|
|
12114
|
-
|
|
12545
|
+
const vModelSelectInit = (el, value, number, set) => {
|
|
12546
|
+
const isSetModel = isSet(value);
|
|
12547
|
+
addEventListener(el, "change", () => {
|
|
12548
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12549
|
+
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12550
|
+
);
|
|
12551
|
+
(0, el[assignKey])(
|
|
12552
|
+
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12553
|
+
);
|
|
12554
|
+
el._assigning = true;
|
|
12555
|
+
nextTick(() => {
|
|
12556
|
+
el._assigning = false;
|
|
12557
|
+
});
|
|
12558
|
+
});
|
|
12559
|
+
};
|
|
12560
|
+
const vModelSetSelected = (el, value) => {
|
|
12561
|
+
if (el._assigning) return;
|
|
12115
12562
|
const isMultiple = el.multiple;
|
|
12116
12563
|
const isArrayValue = isArray(value);
|
|
12117
12564
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -12142,13 +12589,20 @@ function setSelected(el, value) {
|
|
|
12142
12589
|
if (!isMultiple && el.selectedIndex !== -1) {
|
|
12143
12590
|
el.selectedIndex = -1;
|
|
12144
12591
|
}
|
|
12145
|
-
}
|
|
12592
|
+
};
|
|
12146
12593
|
function getValue(el) {
|
|
12147
12594
|
return "_value" in el ? el._value : el.value;
|
|
12148
12595
|
}
|
|
12149
12596
|
function getCheckboxValue(el, checked) {
|
|
12150
12597
|
const key = checked ? "_trueValue" : "_falseValue";
|
|
12151
|
-
|
|
12598
|
+
if (key in el) {
|
|
12599
|
+
return el[key];
|
|
12600
|
+
}
|
|
12601
|
+
const attr = checked ? "true-value" : "false-value";
|
|
12602
|
+
if (el.hasAttribute(attr)) {
|
|
12603
|
+
return el.getAttribute(attr);
|
|
12604
|
+
}
|
|
12605
|
+
return checked;
|
|
12152
12606
|
}
|
|
12153
12607
|
const vModelDynamic = {
|
|
12154
12608
|
created(el, binding, vnode) {
|