@vue/runtime-dom 3.6.0-beta.8 → 3.6.0-rc.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 +49 -29
- package/dist/runtime-dom.cjs.prod.js +49 -29
- package/dist/runtime-dom.d.ts +8 -2
- package/dist/runtime-dom.esm-browser.js +440 -209
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +50 -30
- package/dist/runtime-dom.global.js +440 -209
- 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.6.0-
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -431,6 +431,13 @@ function warn$2(msg, ...args) {
|
|
|
431
431
|
const notifyBuffer = [];
|
|
432
432
|
let batchDepth = 0;
|
|
433
433
|
let activeSub = void 0;
|
|
434
|
+
let runDepth = 0;
|
|
435
|
+
function incRunDepth() {
|
|
436
|
+
++runDepth;
|
|
437
|
+
}
|
|
438
|
+
function decRunDepth() {
|
|
439
|
+
--runDepth;
|
|
440
|
+
}
|
|
434
441
|
let globalVersion = 0;
|
|
435
442
|
let notifyIndex = 0;
|
|
436
443
|
let notifyBufferLength = 0;
|
|
@@ -504,8 +511,10 @@ function propagate(link) {
|
|
|
504
511
|
const sub = link.sub;
|
|
505
512
|
let flags = sub.flags;
|
|
506
513
|
if (flags & 3) {
|
|
507
|
-
if (!(flags & 60))
|
|
508
|
-
|
|
514
|
+
if (!(flags & 60)) {
|
|
515
|
+
sub.flags = flags | 32;
|
|
516
|
+
if (runDepth) sub.flags |= 8;
|
|
517
|
+
} else if (!(flags & 12)) flags = 0;
|
|
509
518
|
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
510
519
|
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
511
520
|
sub.flags = flags | 40;
|
|
@@ -574,13 +583,13 @@ function checkDirty(link, sub) {
|
|
|
574
583
|
let dirty = false;
|
|
575
584
|
if (sub.flags & 16) dirty = true;
|
|
576
585
|
else if ((depFlags & 17) === 17) {
|
|
586
|
+
const subs = dep.subs;
|
|
577
587
|
if (dep.update()) {
|
|
578
|
-
const subs = dep.subs;
|
|
579
588
|
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
580
589
|
dirty = true;
|
|
581
590
|
}
|
|
582
591
|
} else if ((depFlags & 33) === 33) {
|
|
583
|
-
|
|
592
|
+
stack = {
|
|
584
593
|
value: link,
|
|
585
594
|
prev: stack
|
|
586
595
|
};
|
|
@@ -595,15 +604,12 @@ function checkDirty(link, sub) {
|
|
|
595
604
|
}
|
|
596
605
|
while (checkDepth) {
|
|
597
606
|
--checkDepth;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (hasMultipleSubs) {
|
|
601
|
-
link = stack.value;
|
|
602
|
-
stack = stack.prev;
|
|
603
|
-
} else link = firstSub;
|
|
607
|
+
link = stack.value;
|
|
608
|
+
stack = stack.prev;
|
|
604
609
|
if (dirty) {
|
|
610
|
+
const subs = sub.subs;
|
|
605
611
|
if (sub.update()) {
|
|
606
|
-
if (
|
|
612
|
+
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
607
613
|
sub = link.sub;
|
|
608
614
|
continue;
|
|
609
615
|
}
|
|
@@ -615,7 +621,7 @@ function checkDirty(link, sub) {
|
|
|
615
621
|
}
|
|
616
622
|
dirty = false;
|
|
617
623
|
}
|
|
618
|
-
return dirty;
|
|
624
|
+
return dirty && !!sub.flags;
|
|
619
625
|
} while (true);
|
|
620
626
|
}
|
|
621
627
|
function shallowPropagate(link) {
|
|
@@ -998,7 +1004,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
998
1004
|
}
|
|
999
1005
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
1000
1006
|
const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
1001
|
-
if (target === /* @__PURE__ */ toRaw(receiver)) {
|
|
1007
|
+
if (target === /* @__PURE__ */ toRaw(receiver) && result) {
|
|
1002
1008
|
if (!hadKey) trigger(target, "add", key, value);
|
|
1003
1009
|
else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
1004
1010
|
}
|
|
@@ -1216,9 +1222,6 @@ function targetTypeMap(rawType) {
|
|
|
1216
1222
|
default: return 0;
|
|
1217
1223
|
}
|
|
1218
1224
|
}
|
|
1219
|
-
function getTargetType(value) {
|
|
1220
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
|
1221
|
-
}
|
|
1222
1225
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1223
1226
|
function reactive(target) {
|
|
1224
1227
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
@@ -1331,10 +1334,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1331
1334
|
return target;
|
|
1332
1335
|
}
|
|
1333
1336
|
if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
|
|
1334
|
-
|
|
1335
|
-
if (targetType === 0) return target;
|
|
1337
|
+
if (target["__v_skip"] || !Object.isExtensible(target)) return target;
|
|
1336
1338
|
const existingProxy = proxyMap.get(target);
|
|
1337
1339
|
if (existingProxy) return existingProxy;
|
|
1340
|
+
const targetType = targetTypeMap(toRawType(target));
|
|
1341
|
+
if (targetType === 0) return target;
|
|
1338
1342
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1339
1343
|
proxyMap.set(target, proxy);
|
|
1340
1344
|
return proxy;
|
|
@@ -1682,16 +1686,16 @@ function toRefs(object) {
|
|
|
1682
1686
|
return ret;
|
|
1683
1687
|
}
|
|
1684
1688
|
var ObjectRefImpl = class {
|
|
1685
|
-
constructor(_object,
|
|
1689
|
+
constructor(_object, key, _defaultValue) {
|
|
1686
1690
|
this._object = _object;
|
|
1687
|
-
this._key = _key;
|
|
1688
1691
|
this._defaultValue = _defaultValue;
|
|
1689
1692
|
this["__v_isRef"] = true;
|
|
1690
1693
|
this._value = void 0;
|
|
1694
|
+
this._key = isSymbol(key) ? key : String(key);
|
|
1691
1695
|
this._raw = /* @__PURE__ */ toRaw(_object);
|
|
1692
1696
|
let shallow = true;
|
|
1693
1697
|
let obj = _object;
|
|
1694
|
-
if (!isArray(_object) || !isIntegerKey(
|
|
1698
|
+
if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
|
|
1695
1699
|
shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
|
|
1696
1700
|
while (shallow && (obj = obj["__v_raw"]));
|
|
1697
1701
|
this._shallow = shallow;
|
|
@@ -1767,9 +1771,11 @@ var ReactiveEffect = class {
|
|
|
1767
1771
|
if (!this.active) return this.fn();
|
|
1768
1772
|
cleanup(this);
|
|
1769
1773
|
const prevSub = startTracking(this);
|
|
1774
|
+
incRunDepth();
|
|
1770
1775
|
try {
|
|
1771
1776
|
return this.fn();
|
|
1772
1777
|
} finally {
|
|
1778
|
+
decRunDepth();
|
|
1773
1779
|
endTracking(this, prevSub);
|
|
1774
1780
|
const flags = this.flags;
|
|
1775
1781
|
if ((flags & 136) === 136) {
|
|
@@ -2150,8 +2156,9 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
2150
2156
|
if (once && cb) {
|
|
2151
2157
|
const _cb = cb;
|
|
2152
2158
|
cb = (...args) => {
|
|
2153
|
-
_cb(...args);
|
|
2159
|
+
const res = _cb(...args);
|
|
2154
2160
|
this.stop();
|
|
2161
|
+
return res;
|
|
2155
2162
|
};
|
|
2156
2163
|
}
|
|
2157
2164
|
this.cb = cb;
|
|
@@ -2165,7 +2172,7 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
2165
2172
|
if (!this.cb) return;
|
|
2166
2173
|
const { immediate, deep, call } = this.options;
|
|
2167
2174
|
if (initialRun && !immediate) return;
|
|
2168
|
-
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2175
|
+
if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2169
2176
|
cleanup(this);
|
|
2170
2177
|
const currentWatcher = activeWatcher;
|
|
2171
2178
|
activeWatcher = this;
|
|
@@ -2472,8 +2479,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
2472
2479
|
/**
|
|
2473
2480
|
* @internal for runtime-vapor only
|
|
2474
2481
|
*/
|
|
2475
|
-
function queueJob(job, id, isPre = false) {
|
|
2476
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2482
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
2483
|
+
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2477
2484
|
jobsLength++;
|
|
2478
2485
|
queueFlush();
|
|
2479
2486
|
}
|
|
@@ -2582,6 +2589,7 @@ function flushJobs(seen) {
|
|
|
2582
2589
|
}
|
|
2583
2590
|
flushIndex = 0;
|
|
2584
2591
|
jobsLength = 0;
|
|
2592
|
+
jobs.length = 0;
|
|
2585
2593
|
flushPostFlushCbs(seen);
|
|
2586
2594
|
currentFlushPromise = null;
|
|
2587
2595
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -2601,6 +2609,13 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
2601
2609
|
//#endregion
|
|
2602
2610
|
//#region packages/runtime-core/src/hmr.ts
|
|
2603
2611
|
let isHmrUpdating = false;
|
|
2612
|
+
const setHmrUpdating = (v) => {
|
|
2613
|
+
try {
|
|
2614
|
+
return isHmrUpdating;
|
|
2615
|
+
} finally {
|
|
2616
|
+
isHmrUpdating = v;
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2604
2619
|
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
2605
2620
|
const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
|
|
2606
2621
|
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
@@ -2632,6 +2647,14 @@ function createRecord(id, initialDef) {
|
|
|
2632
2647
|
function normalizeClassComponent(component) {
|
|
2633
2648
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
2634
2649
|
}
|
|
2650
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
2651
|
+
let parent = instance.parent;
|
|
2652
|
+
while (parent) {
|
|
2653
|
+
if (dirtyInstances.has(parent)) return true;
|
|
2654
|
+
parent = parent.parent;
|
|
2655
|
+
}
|
|
2656
|
+
return false;
|
|
2657
|
+
}
|
|
2635
2658
|
function rerender(id, newRender) {
|
|
2636
2659
|
const record = map.get(id);
|
|
2637
2660
|
if (!record) return;
|
|
@@ -2663,42 +2686,69 @@ function reload(id, newComp) {
|
|
|
2663
2686
|
const isVapor = record.initialDef.__vapor;
|
|
2664
2687
|
updateComponentDef(record.initialDef, newComp);
|
|
2665
2688
|
const instances = [...record.instances];
|
|
2666
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
2689
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
2667
2690
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
const
|
|
2671
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2672
|
-
if (!dirtyInstances) {
|
|
2673
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
2674
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2675
|
-
}
|
|
2676
|
-
dirtyInstances.add(instance);
|
|
2677
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
2678
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
2679
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
2680
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
2681
|
-
if (instance.ceReload) {
|
|
2682
|
-
dirtyInstances.add(instance);
|
|
2683
|
-
instance.ceReload(newComp.styles);
|
|
2684
|
-
dirtyInstances.delete(instance);
|
|
2685
|
-
} else if (instance.parent) queueJob(() => {
|
|
2686
|
-
isHmrUpdating = true;
|
|
2691
|
+
const dirtyInstances = new Set(instances);
|
|
2692
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
2693
|
+
for (const instance of instances) {
|
|
2687
2694
|
const parent = instance.parent;
|
|
2688
|
-
if (parent
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2695
|
+
if (parent) {
|
|
2696
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
2697
|
+
rerenderedParents.add(parent);
|
|
2698
|
+
parent.hmrRerender();
|
|
2699
|
+
}
|
|
2700
|
+
} else instance.hmrReload(newComp);
|
|
2701
|
+
}
|
|
2702
|
+
} else {
|
|
2703
|
+
const parentUpdates = /* @__PURE__ */ new Map();
|
|
2704
|
+
const dirtyInstanceSet = new Set(instances);
|
|
2705
|
+
for (const instance of instances) {
|
|
2706
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2707
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2708
|
+
if (!dirtyInstances) {
|
|
2709
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
2710
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2692
2711
|
}
|
|
2693
|
-
|
|
2694
|
-
|
|
2712
|
+
dirtyInstances.add(instance);
|
|
2713
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
2714
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2715
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2716
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2717
|
+
if (instance.ceReload) {
|
|
2718
|
+
dirtyInstances.add(instance);
|
|
2719
|
+
instance.ceReload(newComp.styles);
|
|
2720
|
+
dirtyInstances.delete(instance);
|
|
2721
|
+
} else if (instance.parent) {
|
|
2722
|
+
const parent = instance.parent;
|
|
2723
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
|
|
2724
|
+
let updates = parentUpdates.get(parent);
|
|
2725
|
+
if (!updates) parentUpdates.set(parent, updates = []);
|
|
2726
|
+
updates.push([instance, dirtyInstances]);
|
|
2727
|
+
}
|
|
2728
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
2729
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
2730
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2731
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2732
|
+
}
|
|
2733
|
+
parentUpdates.forEach((updates, parent) => {
|
|
2734
|
+
queueJob(() => {
|
|
2735
|
+
isHmrUpdating = true;
|
|
2736
|
+
if (parent.vapor) parent.hmrRerender();
|
|
2737
|
+
else {
|
|
2738
|
+
const i = parent;
|
|
2739
|
+
if (!(i.effect.flags & 1024)) {
|
|
2740
|
+
i.renderCache = [];
|
|
2741
|
+
i.effect.run();
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
nextTick(() => {
|
|
2745
|
+
isHmrUpdating = false;
|
|
2746
|
+
});
|
|
2747
|
+
updates.forEach(([instance, dirtyInstances]) => {
|
|
2748
|
+
dirtyInstances.delete(instance);
|
|
2749
|
+
});
|
|
2695
2750
|
});
|
|
2696
|
-
dirtyInstances.delete(instance);
|
|
2697
2751
|
});
|
|
2698
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
2699
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
2700
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2701
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2702
2752
|
}
|
|
2703
2753
|
queuePostFlushCb(() => {
|
|
2704
2754
|
hmrDirtyComponents.clear();
|
|
@@ -2841,10 +2891,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
2841
2891
|
const renderFnWithContext = (...args) => {
|
|
2842
2892
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
2843
2893
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
2894
|
+
const prevStackSize = blockStack.length;
|
|
2844
2895
|
let res;
|
|
2845
2896
|
try {
|
|
2846
2897
|
res = fn(...args);
|
|
2847
2898
|
} finally {
|
|
2899
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2848
2900
|
setCurrentRenderingInstance(prevInstance);
|
|
2849
2901
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
2850
2902
|
}
|
|
@@ -3032,6 +3084,7 @@ function createPathGetter(ctx, path) {
|
|
|
3032
3084
|
}
|
|
3033
3085
|
//#endregion
|
|
3034
3086
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
3087
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
3035
3088
|
const TeleportEndKey = Symbol("_vte");
|
|
3036
3089
|
const isTeleport = (type) => type.__isTeleport;
|
|
3037
3090
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -3057,55 +3110,68 @@ const TeleportImpl = {
|
|
|
3057
3110
|
name: "Teleport",
|
|
3058
3111
|
__isTeleport: true,
|
|
3059
3112
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
3060
|
-
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
|
3113
|
+
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
|
|
3061
3114
|
const disabled = isTeleportDisabled(n2.props);
|
|
3062
|
-
let {
|
|
3115
|
+
let { dynamicChildren } = n2;
|
|
3063
3116
|
if (isHmrUpdating) {
|
|
3064
3117
|
optimized = false;
|
|
3065
3118
|
dynamicChildren = null;
|
|
3066
3119
|
}
|
|
3120
|
+
const mount = (vnode, container, anchor) => {
|
|
3121
|
+
if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3122
|
+
};
|
|
3123
|
+
const mountToTarget = (vnode = n2) => {
|
|
3124
|
+
const disabled = isTeleportDisabled(vnode.props);
|
|
3125
|
+
const target = vnode.target = resolveTarget(vnode.props, querySelector);
|
|
3126
|
+
const targetAnchor = prepareAnchor(target, vnode, createText, insert);
|
|
3127
|
+
if (target) {
|
|
3128
|
+
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
3129
|
+
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
3130
|
+
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
3131
|
+
if (!disabled) {
|
|
3132
|
+
mount(vnode, target, targetAnchor);
|
|
3133
|
+
updateCssVars(vnode, false);
|
|
3134
|
+
}
|
|
3135
|
+
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
3136
|
+
};
|
|
3137
|
+
const queuePendingMount = (vnode) => {
|
|
3138
|
+
const mountJob = () => {
|
|
3139
|
+
if (pendingMounts.get(vnode) !== mountJob) return;
|
|
3140
|
+
pendingMounts.delete(vnode);
|
|
3141
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
3142
|
+
mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
|
|
3143
|
+
updateCssVars(vnode, true);
|
|
3144
|
+
}
|
|
3145
|
+
mountToTarget(vnode);
|
|
3146
|
+
};
|
|
3147
|
+
pendingMounts.set(vnode, mountJob);
|
|
3148
|
+
queuePostRenderEffect(mountJob, void 0, parentSuspense);
|
|
3149
|
+
};
|
|
3067
3150
|
if (n1 == null) {
|
|
3068
3151
|
const placeholder = n2.el = createComment("teleport start");
|
|
3069
3152
|
const mainAnchor = n2.anchor = createComment("teleport end");
|
|
3070
3153
|
insert(placeholder, container, anchor);
|
|
3071
3154
|
insert(mainAnchor, container, anchor);
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
3077
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
3078
|
-
if (target) {
|
|
3079
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
3080
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
3081
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
3082
|
-
if (!disabled) {
|
|
3083
|
-
mount(target, targetAnchor);
|
|
3084
|
-
updateCssVars(n2, false);
|
|
3085
|
-
}
|
|
3086
|
-
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
3087
|
-
};
|
|
3155
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
3156
|
+
queuePendingMount(n2);
|
|
3157
|
+
return;
|
|
3158
|
+
}
|
|
3088
3159
|
if (disabled) {
|
|
3089
|
-
mount(container, mainAnchor);
|
|
3160
|
+
mount(n2, container, mainAnchor);
|
|
3090
3161
|
updateCssVars(n2, true);
|
|
3091
3162
|
}
|
|
3092
|
-
|
|
3093
|
-
n2.el.__isMounted = false;
|
|
3094
|
-
queuePostRenderEffect(() => {
|
|
3095
|
-
mountToTarget();
|
|
3096
|
-
delete n2.el.__isMounted;
|
|
3097
|
-
}, void 0, parentSuspense);
|
|
3098
|
-
} else mountToTarget();
|
|
3163
|
+
mountToTarget();
|
|
3099
3164
|
} else {
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3165
|
+
n2.el = n1.el;
|
|
3166
|
+
const mainAnchor = n2.anchor = n1.anchor;
|
|
3167
|
+
const pendingMount = pendingMounts.get(n1);
|
|
3168
|
+
if (pendingMount) {
|
|
3169
|
+
pendingMount.flags |= 4;
|
|
3170
|
+
pendingMounts.delete(n1);
|
|
3171
|
+
queuePendingMount(n2);
|
|
3104
3172
|
return;
|
|
3105
3173
|
}
|
|
3106
|
-
n2.el = n1.el;
|
|
3107
3174
|
n2.targetStart = n1.targetStart;
|
|
3108
|
-
const mainAnchor = n2.anchor = n1.anchor;
|
|
3109
3175
|
const target = n2.target = n1.target;
|
|
3110
3176
|
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
3111
3177
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
@@ -3121,26 +3187,30 @@ const TeleportImpl = {
|
|
|
3121
3187
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
3122
3188
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
3123
3189
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
3124
|
-
const nextTarget =
|
|
3125
|
-
if (nextTarget)
|
|
3126
|
-
|
|
3190
|
+
const nextTarget = resolveTarget(n2.props, querySelector);
|
|
3191
|
+
if (nextTarget) {
|
|
3192
|
+
n2.target = nextTarget;
|
|
3193
|
+
moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
|
|
3194
|
+
} else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
|
|
3127
3195
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
3128
3196
|
updateCssVars(n2, disabled);
|
|
3129
3197
|
}
|
|
3130
3198
|
},
|
|
3131
3199
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
3132
3200
|
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3201
|
+
const disabled = isTeleportDisabled(props);
|
|
3202
|
+
const shouldRemove = doRemove || !disabled;
|
|
3203
|
+
const pendingMount = pendingMounts.get(vnode);
|
|
3204
|
+
if (pendingMount) {
|
|
3205
|
+
pendingMount.flags |= 4;
|
|
3206
|
+
pendingMounts.delete(vnode);
|
|
3207
|
+
}
|
|
3208
|
+
if (targetStart) hostRemove(targetStart);
|
|
3209
|
+
if (targetAnchor) hostRemove(targetAnchor);
|
|
3137
3210
|
doRemove && hostRemove(anchor);
|
|
3138
|
-
if (shapeFlag & 16) {
|
|
3139
|
-
const
|
|
3140
|
-
|
|
3141
|
-
const child = children[i];
|
|
3142
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
3143
|
-
}
|
|
3211
|
+
if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
|
|
3212
|
+
const child = children[i];
|
|
3213
|
+
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
3144
3214
|
}
|
|
3145
3215
|
},
|
|
3146
3216
|
move: moveTeleport,
|
|
@@ -3151,7 +3221,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
3151
3221
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
3152
3222
|
const isReorder = moveType === 2;
|
|
3153
3223
|
if (isReorder) insert(el, container, parentAnchor);
|
|
3154
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
3224
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
3155
3225
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
3156
3226
|
}
|
|
3157
3227
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -3276,8 +3346,8 @@ const BaseTransitionImpl = {
|
|
|
3276
3346
|
const state = useTransitionState();
|
|
3277
3347
|
return () => {
|
|
3278
3348
|
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
3279
|
-
|
|
3280
|
-
|
|
3349
|
+
const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
|
|
3350
|
+
if (!child) return;
|
|
3281
3351
|
const rawProps = /* @__PURE__ */ toRaw(props);
|
|
3282
3352
|
const { mode } = rawProps;
|
|
3283
3353
|
checkTransitionMode(mode);
|
|
@@ -3392,7 +3462,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
3392
3462
|
callHook(hook, [el]);
|
|
3393
3463
|
},
|
|
3394
3464
|
enter(el) {
|
|
3395
|
-
if (isLeaving()) return;
|
|
3465
|
+
if (!isHmrUpdating && isLeaving()) return;
|
|
3396
3466
|
let hook = onEnter;
|
|
3397
3467
|
let afterHook = onAfterEnter;
|
|
3398
3468
|
let cancelHook = onEnterCancelled;
|
|
@@ -3729,7 +3799,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3729
3799
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3730
3800
|
break;
|
|
3731
3801
|
case VaporSlot:
|
|
3732
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
3802
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
|
|
3733
3803
|
break;
|
|
3734
3804
|
default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
3735
3805
|
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -3739,16 +3809,31 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3739
3809
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
3740
3810
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
3741
3811
|
else nextNode = nextSibling(node);
|
|
3742
|
-
if (vnode.type.__vapor)
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3812
|
+
if (vnode.type.__vapor) {
|
|
3813
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
|
|
3814
|
+
getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
|
|
3815
|
+
if (vnode.dirs) {
|
|
3816
|
+
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
3817
|
+
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
3818
|
+
}
|
|
3819
|
+
}, () => {
|
|
3820
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
|
|
3821
|
+
});
|
|
3822
|
+
if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
3823
|
+
const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
|
|
3824
|
+
if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
|
|
3825
|
+
} else {
|
|
3826
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
3827
|
+
const component = vnode.component;
|
|
3828
|
+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
|
|
3829
|
+
let subTree;
|
|
3830
|
+
if (isFragmentStart) {
|
|
3831
|
+
subTree = createVNode(Fragment);
|
|
3832
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
3833
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
3834
|
+
subTree.el = node;
|
|
3835
|
+
component.subTree = subTree;
|
|
3836
|
+
}
|
|
3752
3837
|
}
|
|
3753
3838
|
} else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
|
|
3754
3839
|
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
@@ -3760,7 +3845,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3760
3845
|
};
|
|
3761
3846
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
3762
3847
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
3763
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
3848
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
3764
3849
|
const forcePatch = type === "input" || type === "option";
|
|
3765
3850
|
{
|
|
3766
3851
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
@@ -3778,15 +3863,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3778
3863
|
}
|
|
3779
3864
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
3780
3865
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3781
|
-
|
|
3866
|
+
if (next && !isMismatchAllowed(el, 1)) {
|
|
3867
|
+
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
3868
|
+
logMismatchError();
|
|
3869
|
+
}
|
|
3782
3870
|
while (next) {
|
|
3783
|
-
if (!isMismatchAllowed(el, 1)) {
|
|
3784
|
-
if (!hasWarned) {
|
|
3785
|
-
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
3786
|
-
hasWarned = true;
|
|
3787
|
-
}
|
|
3788
|
-
logMismatchError();
|
|
3789
|
-
}
|
|
3790
3871
|
const cur = next;
|
|
3791
3872
|
next = next.nextSibling;
|
|
3792
3873
|
remove(cur);
|
|
@@ -3805,9 +3886,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3805
3886
|
}
|
|
3806
3887
|
if (props) {
|
|
3807
3888
|
const isCustomElement = el.tagName.includes("-");
|
|
3889
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
3808
3890
|
for (const key in props) {
|
|
3809
3891
|
if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
|
|
3810
|
-
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key)) patchProp(el, key, null, props[key],
|
|
3892
|
+
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) patchProp(el, key, null, props[key], namespace, parentComponent);
|
|
3811
3893
|
}
|
|
3812
3894
|
}
|
|
3813
3895
|
let vnodeHooks;
|
|
@@ -3825,7 +3907,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3825
3907
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
3826
3908
|
const children = parentVNode.children;
|
|
3827
3909
|
const l = children.length;
|
|
3828
|
-
let
|
|
3910
|
+
let hasCheckedMismatch = false;
|
|
3829
3911
|
for (let i = 0; i < l; i++) {
|
|
3830
3912
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
3831
3913
|
const isText = vnode.type === Text;
|
|
@@ -3839,12 +3921,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3839
3921
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3840
3922
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
3841
3923
|
else {
|
|
3842
|
-
if (!
|
|
3843
|
-
|
|
3924
|
+
if (!hasCheckedMismatch) {
|
|
3925
|
+
hasCheckedMismatch = true;
|
|
3926
|
+
if (!isMismatchAllowed(container, 1)) {
|
|
3844
3927
|
warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
|
|
3845
|
-
|
|
3928
|
+
logMismatchError();
|
|
3846
3929
|
}
|
|
3847
|
-
logMismatchError();
|
|
3848
3930
|
}
|
|
3849
3931
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
3850
3932
|
}
|
|
@@ -3864,7 +3946,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3864
3946
|
}
|
|
3865
3947
|
};
|
|
3866
3948
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
3867
|
-
if (!
|
|
3949
|
+
if (!isNodeMismatchAllowed(node, vnode)) {
|
|
3868
3950
|
warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
|
|
3869
3951
|
logMismatchError();
|
|
3870
3952
|
}
|
|
@@ -4028,7 +4110,9 @@ const MismatchTypeString = {
|
|
|
4028
4110
|
};
|
|
4029
4111
|
function isMismatchAllowed(el, allowedType) {
|
|
4030
4112
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
4031
|
-
|
|
4113
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
4114
|
+
}
|
|
4115
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
4032
4116
|
if (allowedAttr == null) return false;
|
|
4033
4117
|
else if (allowedAttr === "") return true;
|
|
4034
4118
|
else {
|
|
@@ -4037,6 +4121,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
4037
4121
|
return list.includes(MismatchTypeString[allowedType]);
|
|
4038
4122
|
}
|
|
4039
4123
|
}
|
|
4124
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
4125
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
4126
|
+
}
|
|
4127
|
+
function isMismatchAllowedByNode(node) {
|
|
4128
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
4129
|
+
}
|
|
4130
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
4131
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
4132
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
4133
|
+
}
|
|
4040
4134
|
//#endregion
|
|
4041
4135
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
4042
4136
|
let requestIdleCallback;
|
|
@@ -4155,11 +4249,16 @@ function defineAsyncComponent(source) {
|
|
|
4155
4249
|
onError(err);
|
|
4156
4250
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
4157
4251
|
});
|
|
4158
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
4252
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
4159
4253
|
load().then(() => {
|
|
4254
|
+
if (instance.isUnmounted) return;
|
|
4160
4255
|
loaded.value = true;
|
|
4161
4256
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
4162
4257
|
}).catch((err) => {
|
|
4258
|
+
if (instance.isUnmounted) {
|
|
4259
|
+
setPendingRequest(null);
|
|
4260
|
+
return;
|
|
4261
|
+
}
|
|
4163
4262
|
onError(err);
|
|
4164
4263
|
error.value = err;
|
|
4165
4264
|
});
|
|
@@ -4217,14 +4316,22 @@ function createAsyncComponentContext(source) {
|
|
|
4217
4316
|
setPendingRequest: (request) => pendingRequest = request
|
|
4218
4317
|
};
|
|
4219
4318
|
}
|
|
4220
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
4319
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
4221
4320
|
const loaded = /* @__PURE__ */ ref(false);
|
|
4222
4321
|
const error = /* @__PURE__ */ ref();
|
|
4223
4322
|
const delayed = /* @__PURE__ */ ref(!!delay);
|
|
4224
|
-
|
|
4323
|
+
let timeoutTimer;
|
|
4324
|
+
let delayTimer;
|
|
4325
|
+
if (instance) onUnmounted(() => {
|
|
4326
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
4327
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
4328
|
+
}, instance);
|
|
4329
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
4330
|
+
if (instance && instance.isUnmounted) return;
|
|
4225
4331
|
delayed.value = false;
|
|
4226
4332
|
}, delay);
|
|
4227
|
-
if (timeout != null) setTimeout(() => {
|
|
4333
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
4334
|
+
if (instance && instance.isUnmounted) return;
|
|
4228
4335
|
if (!loaded.value && !error.value) {
|
|
4229
4336
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
4230
4337
|
onError(err);
|
|
@@ -4242,6 +4349,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
4242
4349
|
* @internal
|
|
4243
4350
|
*/
|
|
4244
4351
|
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
4352
|
+
const wasConnected = el.isConnected;
|
|
4245
4353
|
let patched = false;
|
|
4246
4354
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
4247
4355
|
const performHydrate = () => {
|
|
@@ -4252,6 +4360,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
|
|
|
4252
4360
|
}
|
|
4253
4361
|
return;
|
|
4254
4362
|
}
|
|
4363
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
4255
4364
|
hydrate();
|
|
4256
4365
|
};
|
|
4257
4366
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -4617,8 +4726,9 @@ function createSlots(slots, dynamicSlots) {
|
|
|
4617
4726
|
* Compiler runtime helper for rendering `<slot/>`
|
|
4618
4727
|
* @private
|
|
4619
4728
|
*/
|
|
4620
|
-
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
4729
|
+
function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
|
|
4621
4730
|
let slot = slots[name];
|
|
4731
|
+
if (fallback) fallback.__vdom = true;
|
|
4622
4732
|
const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
|
|
4623
4733
|
if (vaporSlot) {
|
|
4624
4734
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
@@ -4626,25 +4736,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
4626
4736
|
slot: vaporSlot,
|
|
4627
4737
|
fallback
|
|
4628
4738
|
};
|
|
4739
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
4629
4740
|
return ret;
|
|
4630
4741
|
}
|
|
4631
4742
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
4632
|
-
const
|
|
4633
|
-
|
|
4634
|
-
|
|
4743
|
+
const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
|
|
4744
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
4745
|
+
if (name !== "default") slotProps.name = name;
|
|
4746
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
4635
4747
|
}
|
|
4636
4748
|
if (slot && slot.length > 1) {
|
|
4637
4749
|
warn$1("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.");
|
|
4638
4750
|
slot = () => [];
|
|
4639
4751
|
}
|
|
4640
4752
|
if (slot && slot._c) slot._d = false;
|
|
4753
|
+
const prevStackSize = blockStack.length;
|
|
4641
4754
|
openBlock();
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4755
|
+
let rendered;
|
|
4756
|
+
try {
|
|
4757
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4758
|
+
ensureVaporSlotFallback(validSlotContent, fallback);
|
|
4759
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
4760
|
+
rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
4761
|
+
} catch (err) {
|
|
4762
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
4763
|
+
throw err;
|
|
4764
|
+
} finally {
|
|
4765
|
+
if (slot && slot._c) slot._d = true;
|
|
4766
|
+
}
|
|
4646
4767
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
4647
|
-
if (slot && slot._c) slot._d = true;
|
|
4648
4768
|
return rendered;
|
|
4649
4769
|
}
|
|
4650
4770
|
function ensureValidVNode(vnodes) {
|
|
@@ -4657,9 +4777,7 @@ function ensureValidVNode(vnodes) {
|
|
|
4657
4777
|
}
|
|
4658
4778
|
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
4659
4779
|
let vaporSlot;
|
|
4660
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs))
|
|
4661
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
4662
|
-
}
|
|
4780
|
+
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
|
|
4663
4781
|
}
|
|
4664
4782
|
//#endregion
|
|
4665
4783
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
@@ -5025,26 +5143,39 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
5025
5143
|
function withAsyncContext(getAwaitable) {
|
|
5026
5144
|
const ctx = getCurrentGenericInstance();
|
|
5027
5145
|
const inSSRSetup = isInSSRComponentSetup;
|
|
5146
|
+
const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
|
|
5028
5147
|
if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
|
|
5029
5148
|
let awaitable = getAwaitable();
|
|
5030
5149
|
setCurrentInstance(null, void 0);
|
|
5031
5150
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
5032
5151
|
const restore = () => {
|
|
5152
|
+
const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
5033
5153
|
setCurrentInstance(ctx);
|
|
5034
5154
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
5155
|
+
const reset = restoreAsyncContext && restoreAsyncContext();
|
|
5156
|
+
return () => {
|
|
5157
|
+
if (reset) reset();
|
|
5158
|
+
if (resetStoppedScope) resetStoppedScope.reset();
|
|
5159
|
+
};
|
|
5035
5160
|
};
|
|
5036
5161
|
const cleanup = () => {
|
|
5037
5162
|
setCurrentInstance(null, void 0);
|
|
5038
5163
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
5039
5164
|
};
|
|
5040
5165
|
if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
|
|
5041
|
-
restore();
|
|
5042
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
5166
|
+
const reset = restore();
|
|
5167
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
5168
|
+
if (reset) reset();
|
|
5169
|
+
cleanup();
|
|
5170
|
+
}));
|
|
5043
5171
|
throw e;
|
|
5044
5172
|
});
|
|
5045
5173
|
return [awaitable, () => {
|
|
5046
|
-
restore();
|
|
5047
|
-
Promise.resolve().then(
|
|
5174
|
+
const reset = restore();
|
|
5175
|
+
Promise.resolve().then(() => {
|
|
5176
|
+
if (reset) reset();
|
|
5177
|
+
cleanup();
|
|
5178
|
+
});
|
|
5048
5179
|
}];
|
|
5049
5180
|
}
|
|
5050
5181
|
//#endregion
|
|
@@ -5468,12 +5599,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
5468
5599
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
5469
5600
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
5470
5601
|
}
|
|
5471
|
-
|
|
5602
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
5603
|
+
if (!hasVModel) {
|
|
5472
5604
|
localValue = value;
|
|
5473
5605
|
trigger();
|
|
5474
5606
|
}
|
|
5475
5607
|
i.emit(`update:${name}`, emittedValue);
|
|
5476
|
-
if (hasChanged(value,
|
|
5608
|
+
if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
|
|
5477
5609
|
prevSetValue = value;
|
|
5478
5610
|
prevEmittedValue = emittedValue;
|
|
5479
5611
|
}
|
|
@@ -5580,7 +5712,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
5580
5712
|
*/
|
|
5581
5713
|
function isEmitListener(options, key) {
|
|
5582
5714
|
if (!options || !isOn(key)) return false;
|
|
5583
|
-
key = key.slice(2)
|
|
5715
|
+
key = key.slice(2);
|
|
5716
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
5584
5717
|
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
|
5585
5718
|
}
|
|
5586
5719
|
//#endregion
|
|
@@ -5764,15 +5897,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
|
|
|
5764
5897
|
if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
|
|
5765
5898
|
return nextProp !== prevProp;
|
|
5766
5899
|
}
|
|
5767
|
-
function updateHOCHostEl({ vnode, parent }, el) {
|
|
5900
|
+
function updateHOCHostEl({ vnode, parent, suspense }, el) {
|
|
5768
5901
|
while (parent && !parent.vapor) {
|
|
5769
5902
|
const root = parent.subTree;
|
|
5770
|
-
if (root.suspense && root.suspense.activeBranch === vnode)
|
|
5903
|
+
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
5904
|
+
root.suspense.vnode.el = root.el = el;
|
|
5905
|
+
vnode = root;
|
|
5906
|
+
}
|
|
5771
5907
|
if (root === vnode) {
|
|
5772
5908
|
(vnode = parent.vnode).el = el;
|
|
5773
5909
|
parent = parent.parent;
|
|
5774
5910
|
} else break;
|
|
5775
5911
|
}
|
|
5912
|
+
if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
|
|
5776
5913
|
}
|
|
5777
5914
|
//#endregion
|
|
5778
5915
|
//#region packages/runtime-core/src/internalObject.ts
|
|
@@ -6051,7 +6188,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
6051
6188
|
const receivedType = toRawType(value);
|
|
6052
6189
|
const expectedValue = styleValue(value, expectedType);
|
|
6053
6190
|
const receivedValue = styleValue(value, receivedType);
|
|
6054
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
6191
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
6055
6192
|
message += `, got ${receivedType} `;
|
|
6056
6193
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
6057
6194
|
return message;
|
|
@@ -6060,7 +6197,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
6060
6197
|
* dev only
|
|
6061
6198
|
*/
|
|
6062
6199
|
function styleValue(value, type) {
|
|
6063
|
-
if (
|
|
6200
|
+
if (isSymbol(value)) return value.toString();
|
|
6201
|
+
else if (type === "String") return `"${value}"`;
|
|
6064
6202
|
else if (type === "Number") return `${Number(value)}`;
|
|
6065
6203
|
else return `${value}`;
|
|
6066
6204
|
}
|
|
@@ -6077,8 +6215,11 @@ function isExplicable(type) {
|
|
|
6077
6215
|
/**
|
|
6078
6216
|
* dev only
|
|
6079
6217
|
*/
|
|
6080
|
-
function
|
|
6081
|
-
return args.
|
|
6218
|
+
function isCoercible(...args) {
|
|
6219
|
+
return args.every((elem) => {
|
|
6220
|
+
const value = elem.toLowerCase();
|
|
6221
|
+
return value !== "boolean" && value !== "symbol";
|
|
6222
|
+
});
|
|
6082
6223
|
}
|
|
6083
6224
|
//#endregion
|
|
6084
6225
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -6348,10 +6489,19 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6348
6489
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
6349
6490
|
if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
|
|
6350
6491
|
else hostInsert(el, container, anchor);
|
|
6351
|
-
if ((vnodeHook = props && props.onVnodeMounted) || dirs)
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6492
|
+
if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
|
|
6493
|
+
const isHmr = isHmrUpdating;
|
|
6494
|
+
queuePostRenderEffect(() => {
|
|
6495
|
+
let prev;
|
|
6496
|
+
prev = setHmrUpdating(isHmr);
|
|
6497
|
+
try {
|
|
6498
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
6499
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
6500
|
+
} finally {
|
|
6501
|
+
setHmrUpdating(prev);
|
|
6502
|
+
}
|
|
6503
|
+
}, void 0, parentSuspense);
|
|
6504
|
+
}
|
|
6355
6505
|
};
|
|
6356
6506
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
6357
6507
|
if (scopeId) hostSetScopeId(el, scopeId);
|
|
@@ -6374,7 +6524,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6374
6524
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
6375
6525
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
6376
6526
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
6377
|
-
if (isHmrUpdating) {
|
|
6527
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
6378
6528
|
patchFlag = 0;
|
|
6379
6529
|
optimized = false;
|
|
6380
6530
|
dynamicChildren = null;
|
|
@@ -6454,19 +6604,35 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6454
6604
|
n2.slotScopeIds = slotScopeIds;
|
|
6455
6605
|
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
6456
6606
|
else {
|
|
6607
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
6457
6608
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
6458
6609
|
if (n2.dirs) {
|
|
6459
6610
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
6460
6611
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
6461
6612
|
}
|
|
6613
|
+
}, () => {
|
|
6614
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
6462
6615
|
});
|
|
6463
6616
|
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
6617
|
+
const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
|
|
6618
|
+
if (vnodeMountedHook) {
|
|
6619
|
+
const scopedVNode = n2;
|
|
6620
|
+
queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
|
|
6621
|
+
}
|
|
6464
6622
|
}
|
|
6465
6623
|
else {
|
|
6466
|
-
|
|
6624
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
6625
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
6467
6626
|
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
6627
|
+
}, () => {
|
|
6628
|
+
const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
|
|
6629
|
+
if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
|
|
6468
6630
|
});
|
|
6469
|
-
|
|
6631
|
+
const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
|
|
6632
|
+
if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
|
|
6633
|
+
n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
6634
|
+
vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
|
|
6635
|
+
}, void 0, parentSuspense);
|
|
6470
6636
|
}
|
|
6471
6637
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
6472
6638
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -6812,8 +6978,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6812
6978
|
else hostInsert(el, container, anchor);
|
|
6813
6979
|
};
|
|
6814
6980
|
const performLeave = () => {
|
|
6981
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
6815
6982
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
6816
|
-
|
|
6983
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
6984
|
+
else leave(el, () => {
|
|
6817
6985
|
remove();
|
|
6818
6986
|
afterLeave && afterLeave();
|
|
6819
6987
|
});
|
|
@@ -6824,7 +6992,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6824
6992
|
else hostInsert(el, container, anchor);
|
|
6825
6993
|
};
|
|
6826
6994
|
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
|
6827
|
-
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
|
|
6995
|
+
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
|
|
6828
6996
|
if (patchFlag === -2) optimized = false;
|
|
6829
6997
|
if (ref != null) {
|
|
6830
6998
|
const prevSub = setActiveSub();
|
|
@@ -6844,7 +7012,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6844
7012
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
6845
7013
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
6846
7014
|
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
6847
|
-
if (
|
|
7015
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
|
|
7016
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
7017
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7018
|
+
}, void 0, parentSuspense);
|
|
6848
7019
|
return;
|
|
6849
7020
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
6850
7021
|
else {
|
|
@@ -6862,9 +7033,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6862
7033
|
}
|
|
6863
7034
|
if (doRemove) remove(vnode);
|
|
6864
7035
|
}
|
|
6865
|
-
|
|
7036
|
+
const shouldInvalidateMemo = memo != null && cacheIndex == null;
|
|
7037
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
|
|
6866
7038
|
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
6867
7039
|
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
7040
|
+
if (shouldInvalidateMemo) vnode.el = null;
|
|
6868
7041
|
}, void 0, parentSuspense);
|
|
6869
7042
|
};
|
|
6870
7043
|
const remove = (vnode) => {
|
|
@@ -6903,7 +7076,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6903
7076
|
if (effect) {
|
|
6904
7077
|
effect.stop();
|
|
6905
7078
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
6906
|
-
}
|
|
7079
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
6907
7080
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
6908
7081
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
6909
7082
|
devtoolsComponentRemoved(instance);
|
|
@@ -7029,6 +7202,10 @@ function invalidateMount(hooks) {
|
|
|
7029
7202
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
7030
7203
|
}
|
|
7031
7204
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
7205
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
7206
|
+
insert();
|
|
7207
|
+
return;
|
|
7208
|
+
}
|
|
7032
7209
|
if (force || needTransition(parentSuspense, transition)) {
|
|
7033
7210
|
transition.beforeEnter(el);
|
|
7034
7211
|
insert();
|
|
@@ -7217,6 +7394,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7217
7394
|
pendingId: suspenseId++,
|
|
7218
7395
|
timeout: typeof timeout === "number" ? timeout : -1,
|
|
7219
7396
|
activeBranch: null,
|
|
7397
|
+
isFallbackMountPending: false,
|
|
7220
7398
|
pendingBranch: null,
|
|
7221
7399
|
isInFallback: !isHydrating,
|
|
7222
7400
|
isHydrating,
|
|
@@ -7230,20 +7408,25 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7230
7408
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
7231
7409
|
else if (!resume) {
|
|
7232
7410
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
7411
|
+
let hasUpdatedAnchor = false;
|
|
7233
7412
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
7234
7413
|
if (pendingId === suspense.pendingId) {
|
|
7235
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
7414
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
7236
7415
|
queuePostFlushCb(effects);
|
|
7237
7416
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
7238
7417
|
}
|
|
7239
7418
|
};
|
|
7240
|
-
if (activeBranch) {
|
|
7241
|
-
if (parentNode(activeBranch.el) === container)
|
|
7419
|
+
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
7420
|
+
if (parentNode(activeBranch.el) === container) {
|
|
7421
|
+
anchor = next(activeBranch);
|
|
7422
|
+
hasUpdatedAnchor = true;
|
|
7423
|
+
}
|
|
7242
7424
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
7243
7425
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
7244
7426
|
}
|
|
7245
7427
|
if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
|
|
7246
7428
|
}
|
|
7429
|
+
suspense.isFallbackMountPending = false;
|
|
7247
7430
|
setActiveBranch(suspense, pendingBranch);
|
|
7248
7431
|
suspense.pendingBranch = null;
|
|
7249
7432
|
suspense.isInFallback = false;
|
|
@@ -7273,12 +7456,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7273
7456
|
triggerEvent(vnode, "onFallback");
|
|
7274
7457
|
const anchor = next(activeBranch);
|
|
7275
7458
|
const mountFallback = () => {
|
|
7459
|
+
suspense.isFallbackMountPending = false;
|
|
7276
7460
|
if (!suspense.isInFallback) return;
|
|
7277
7461
|
patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
7278
7462
|
setActiveBranch(suspense, fallbackVNode);
|
|
7279
7463
|
};
|
|
7280
7464
|
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
7281
|
-
if (delayEnter)
|
|
7465
|
+
if (delayEnter) {
|
|
7466
|
+
suspense.isFallbackMountPending = true;
|
|
7467
|
+
activeBranch.transition.afterLeave = mountFallback;
|
|
7468
|
+
}
|
|
7282
7469
|
suspense.isInFallback = true;
|
|
7283
7470
|
unmount(activeBranch, parentComponent, null, true);
|
|
7284
7471
|
if (!delayEnter) mountFallback();
|
|
@@ -7297,6 +7484,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7297
7484
|
handleError(err, instance, 0);
|
|
7298
7485
|
}).then((asyncSetupResult) => {
|
|
7299
7486
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
7487
|
+
setCurrentInstance(null, void 0);
|
|
7300
7488
|
instance.asyncResolved = true;
|
|
7301
7489
|
onResolve(asyncSetupResult);
|
|
7302
7490
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -7586,11 +7774,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
7586
7774
|
el: vnode.el,
|
|
7587
7775
|
anchor: vnode.anchor,
|
|
7588
7776
|
ctx: vnode.ctx,
|
|
7589
|
-
ce: vnode.ce
|
|
7777
|
+
ce: vnode.ce,
|
|
7778
|
+
vi: vnode.vi,
|
|
7779
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
7780
|
+
vb: vnode.vb
|
|
7590
7781
|
};
|
|
7591
7782
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
7592
7783
|
return cloned;
|
|
7593
7784
|
}
|
|
7785
|
+
function cloneVaporSlotMeta(vnode) {
|
|
7786
|
+
const vaporSlot = vnode.vs;
|
|
7787
|
+
if (!vaporSlot) return vaporSlot;
|
|
7788
|
+
const cloned = {
|
|
7789
|
+
slot: vaporSlot.slot,
|
|
7790
|
+
fallback: vaporSlot.fallback,
|
|
7791
|
+
outletFallback: vaporSlot.outletFallback
|
|
7792
|
+
};
|
|
7793
|
+
if (vnode.el) {
|
|
7794
|
+
cloned.state = vaporSlot.state;
|
|
7795
|
+
cloned.ref = vaporSlot.ref;
|
|
7796
|
+
cloned.scope = vaporSlot.scope;
|
|
7797
|
+
}
|
|
7798
|
+
return cloned;
|
|
7799
|
+
}
|
|
7594
7800
|
/**
|
|
7595
7801
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7596
7802
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -7653,6 +7859,10 @@ function normalizeChildren(vnode, children) {
|
|
|
7653
7859
|
}
|
|
7654
7860
|
}
|
|
7655
7861
|
else if (isFunction(children)) {
|
|
7862
|
+
if (shapeFlag & 65) {
|
|
7863
|
+
normalizeChildren(vnode, { default: children });
|
|
7864
|
+
return;
|
|
7865
|
+
}
|
|
7656
7866
|
children = {
|
|
7657
7867
|
default: children,
|
|
7658
7868
|
_ctx: currentRenderingInstance
|
|
@@ -7679,6 +7889,7 @@ function mergeProps(...args) {
|
|
|
7679
7889
|
const existing = ret[key];
|
|
7680
7890
|
const incoming = toMerge[key];
|
|
7681
7891
|
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
7892
|
+
else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
|
|
7682
7893
|
} else if (key !== "") ret[key] = toMerge[key];
|
|
7683
7894
|
}
|
|
7684
7895
|
return ret;
|
|
@@ -8245,7 +8456,7 @@ function isMemoSame(cached, memo) {
|
|
|
8245
8456
|
}
|
|
8246
8457
|
//#endregion
|
|
8247
8458
|
//#region packages/runtime-core/src/index.ts
|
|
8248
|
-
const version = "3.6.0-
|
|
8459
|
+
const version = "3.6.0-rc.1";
|
|
8249
8460
|
const warn = warn$1;
|
|
8250
8461
|
/**
|
|
8251
8462
|
* Runtime error messages. Only exposed in dev or esm builds.
|
|
@@ -8708,7 +8919,10 @@ function patchStyle(el, prev, next) {
|
|
|
8708
8919
|
}
|
|
8709
8920
|
for (const key in next) {
|
|
8710
8921
|
if (key === "display") hasControlledDisplay = true;
|
|
8711
|
-
|
|
8922
|
+
const value = next[key];
|
|
8923
|
+
if (value != null) {
|
|
8924
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
8925
|
+
} else setStyle(style, key, "");
|
|
8712
8926
|
}
|
|
8713
8927
|
} else if (isCssString) {
|
|
8714
8928
|
if (prev !== next) {
|
|
@@ -8756,6 +8970,14 @@ function autoPrefix(style, rawName) {
|
|
|
8756
8970
|
}
|
|
8757
8971
|
return rawName;
|
|
8758
8972
|
}
|
|
8973
|
+
/**
|
|
8974
|
+
* Browsers update textarea width/height directly during native resize.
|
|
8975
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
8976
|
+
* still follow normal vnode style patching.
|
|
8977
|
+
*/
|
|
8978
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
8979
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
|
|
8980
|
+
}
|
|
8759
8981
|
//#endregion
|
|
8760
8982
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
8761
8983
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -8814,7 +9036,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
8814
9036
|
const existingInvoker = invokers[rawName];
|
|
8815
9037
|
if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
|
|
8816
9038
|
else {
|
|
8817
|
-
const [name, options] =
|
|
9039
|
+
const [name, options] = parseEventName(rawName);
|
|
8818
9040
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
|
|
8819
9041
|
else if (existingInvoker) {
|
|
8820
9042
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -8822,16 +9044,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
8822
9044
|
}
|
|
8823
9045
|
}
|
|
8824
9046
|
}
|
|
8825
|
-
const optionsModifierRE = /(
|
|
8826
|
-
|
|
9047
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
9048
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
9049
|
+
function parseEventName(name) {
|
|
8827
9050
|
let options;
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
options[m[0].toLowerCase()] = true;
|
|
8834
|
-
}
|
|
9051
|
+
let m;
|
|
9052
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
9053
|
+
if (!options) options = {};
|
|
9054
|
+
name = name.slice(0, name.length - m[1].length);
|
|
9055
|
+
options[m[1].toLowerCase()] = true;
|
|
8835
9056
|
}
|
|
8836
9057
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
8837
9058
|
}
|
|
@@ -8842,7 +9063,21 @@ function createInvoker(initialValue, instance) {
|
|
|
8842
9063
|
const invoker = (e) => {
|
|
8843
9064
|
if (!e._vts) e._vts = Date.now();
|
|
8844
9065
|
else if (e._vts <= invoker.attached) return;
|
|
8845
|
-
|
|
9066
|
+
const value = invoker.value;
|
|
9067
|
+
if (isArray(value)) {
|
|
9068
|
+
const originalStop = e.stopImmediatePropagation;
|
|
9069
|
+
e.stopImmediatePropagation = () => {
|
|
9070
|
+
originalStop.call(e);
|
|
9071
|
+
e._stopped = true;
|
|
9072
|
+
};
|
|
9073
|
+
const handlers = value.slice();
|
|
9074
|
+
const args = [e];
|
|
9075
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
9076
|
+
if (e._stopped) break;
|
|
9077
|
+
const handler = handlers[i];
|
|
9078
|
+
if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
|
|
9079
|
+
}
|
|
9080
|
+
} else callWithAsyncErrorHandling(value, instance, 5, [e]);
|
|
8846
9081
|
};
|
|
8847
9082
|
invoker.value = initialValue;
|
|
8848
9083
|
invoker.attached = getNow();
|
|
@@ -8853,16 +9088,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
8853
9088
|
warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
|
|
8854
9089
|
return NOOP;
|
|
8855
9090
|
}
|
|
8856
|
-
function patchStopImmediatePropagation(e, value) {
|
|
8857
|
-
if (isArray(value)) {
|
|
8858
|
-
const originalStop = e.stopImmediatePropagation;
|
|
8859
|
-
e.stopImmediatePropagation = () => {
|
|
8860
|
-
originalStop.call(e);
|
|
8861
|
-
e._stopped = true;
|
|
8862
|
-
};
|
|
8863
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
8864
|
-
} else return value;
|
|
8865
|
-
}
|
|
8866
9091
|
//#endregion
|
|
8867
9092
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
8868
9093
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -9190,7 +9415,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9190
9415
|
replacementNodes.push(child);
|
|
9191
9416
|
}
|
|
9192
9417
|
parent.removeChild(o);
|
|
9193
|
-
slotReplacements.set(o,
|
|
9418
|
+
slotReplacements.set(o, {
|
|
9419
|
+
nodes: replacementNodes,
|
|
9420
|
+
usedFallback: !content
|
|
9421
|
+
});
|
|
9194
9422
|
}
|
|
9195
9423
|
this._updateSlotNodes(slotReplacements);
|
|
9196
9424
|
}
|
|
@@ -9378,7 +9606,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
9378
9606
|
prevChildren = [];
|
|
9379
9607
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
9380
9608
|
const child = children[i];
|
|
9381
|
-
if (child.el && child.el instanceof Element) {
|
|
9609
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
9382
9610
|
prevChildren.push(child);
|
|
9383
9611
|
setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
9384
9612
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -9519,7 +9747,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
|
9519
9747
|
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
9520
9748
|
const newValue = value == null ? "" : value;
|
|
9521
9749
|
if (elValue === newValue) return;
|
|
9522
|
-
|
|
9750
|
+
const rootNode = el.getRootNode();
|
|
9751
|
+
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
|
|
9523
9752
|
if (lazy && value === oldValue) return;
|
|
9524
9753
|
if (trim && el.value.trim() === newValue) return;
|
|
9525
9754
|
}
|
|
@@ -9601,7 +9830,8 @@ const vModelSelect = {
|
|
|
9601
9830
|
mounted(el, { value }) {
|
|
9602
9831
|
vModelSetSelected(el, value);
|
|
9603
9832
|
},
|
|
9604
|
-
beforeUpdate(el,
|
|
9833
|
+
beforeUpdate(el, { value }, vnode) {
|
|
9834
|
+
el._modelValue = value;
|
|
9605
9835
|
el[assignKey] = getModelAssigner(vnode);
|
|
9606
9836
|
},
|
|
9607
9837
|
updated(el, { value }) {
|
|
@@ -9612,10 +9842,10 @@ const vModelSelect = {
|
|
|
9612
9842
|
* @internal
|
|
9613
9843
|
*/
|
|
9614
9844
|
const vModelSelectInit = (el, value, number, set) => {
|
|
9615
|
-
|
|
9845
|
+
el._modelValue = value;
|
|
9616
9846
|
addEventListener(el, "change", () => {
|
|
9617
9847
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
9618
|
-
(set || el[assignKey])(el.multiple ?
|
|
9848
|
+
(set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
|
|
9619
9849
|
el._assigning = true;
|
|
9620
9850
|
nextTick(() => {
|
|
9621
9851
|
el._assigning = false;
|
|
@@ -9626,6 +9856,7 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
9626
9856
|
* @internal
|
|
9627
9857
|
*/
|
|
9628
9858
|
const vModelSetSelected = (el, value) => {
|
|
9859
|
+
el._modelValue = value;
|
|
9629
9860
|
if (el._assigning) return;
|
|
9630
9861
|
const isMultiple = el.multiple;
|
|
9631
9862
|
const isArrayValue = isArray(value);
|