@vue/runtime-core 3.6.0-beta.9 → 3.6.0-rc.10
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-core.cjs.js +897 -505
- package/dist/runtime-core.cjs.prod.js +710 -409
- package/dist/runtime-core.d.ts +618 -612
- package/dist/runtime-core.esm-bundler.js +916 -510
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-
|
|
2
|
+
* @vue/runtime-core v3.6.0-rc.10
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -153,7 +153,7 @@ let currentFlushPromise = null;
|
|
|
153
153
|
let jobsLength = 0;
|
|
154
154
|
let flushIndex = 0;
|
|
155
155
|
let postFlushIndex = 0;
|
|
156
|
-
const resolvedPromise =
|
|
156
|
+
const resolvedPromise = /*@__PURE__*/ Promise.resolve();
|
|
157
157
|
function nextTick(fn) {
|
|
158
158
|
const p = currentFlushPromise || resolvedPromise;
|
|
159
159
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
@@ -169,8 +169,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
169
169
|
/**
|
|
170
170
|
* @internal for runtime-vapor only
|
|
171
171
|
*/
|
|
172
|
-
function queueJob(job, id, isPre = false) {
|
|
173
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
172
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
173
|
+
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)) {
|
|
174
174
|
jobsLength++;
|
|
175
175
|
queueFlush();
|
|
176
176
|
}
|
|
@@ -191,6 +191,7 @@ const doFlushJobs = () => {
|
|
|
191
191
|
flushJobs();
|
|
192
192
|
} catch (e) {
|
|
193
193
|
currentFlushPromise = null;
|
|
194
|
+
if (jobsLength || postJobs.length) queueFlush();
|
|
194
195
|
throw e;
|
|
195
196
|
}
|
|
196
197
|
};
|
|
@@ -198,9 +199,10 @@ function queueFlush() {
|
|
|
198
199
|
if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
199
200
|
}
|
|
200
201
|
function queuePostFlushCb(jobs, id = Infinity) {
|
|
201
|
-
if (!(0, _vue_shared.isArray)(jobs))
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
if (!(0, _vue_shared.isArray)(jobs)) {
|
|
203
|
+
if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
|
|
204
|
+
else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
|
|
205
|
+
} else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
|
|
204
206
|
queueFlush();
|
|
205
207
|
}
|
|
206
208
|
function flushPreFlushCbs(instance, seen) {
|
|
@@ -212,30 +214,37 @@ function flushPreFlushCbs(instance, seen) {
|
|
|
212
214
|
i--;
|
|
213
215
|
jobsLength--;
|
|
214
216
|
if (cb.flags & 2) cb.flags &= -2;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
try {
|
|
218
|
+
cb();
|
|
219
|
+
} finally {
|
|
220
|
+
if (!(cb.flags & 2)) cb.flags &= -2;
|
|
221
|
+
}
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
224
|
function flushPostFlushCbs(seen) {
|
|
220
225
|
if (postJobs.length) {
|
|
221
226
|
if (activePostJobs) {
|
|
222
|
-
activePostJobs.push(
|
|
227
|
+
for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
|
|
223
228
|
postJobs.length = 0;
|
|
224
229
|
return;
|
|
225
230
|
}
|
|
226
231
|
activePostJobs = postJobs;
|
|
227
232
|
postJobs = [];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
cb
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
try {
|
|
234
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
235
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
236
|
+
if (cb.flags & 2) cb.flags &= -2;
|
|
237
|
+
if (!(cb.flags & 4)) try {
|
|
238
|
+
cb();
|
|
239
|
+
} finally {
|
|
240
|
+
if (!(cb.flags & 2)) cb.flags &= -2;
|
|
241
|
+
}
|
|
235
242
|
}
|
|
243
|
+
} finally {
|
|
244
|
+
while (postFlushIndex < activePostJobs.length) activePostJobs[postFlushIndex++].flags &= -2;
|
|
245
|
+
activePostJobs = null;
|
|
246
|
+
postFlushIndex = 0;
|
|
236
247
|
}
|
|
237
|
-
activePostJobs = null;
|
|
238
|
-
postFlushIndex = 0;
|
|
239
248
|
}
|
|
240
249
|
}
|
|
241
250
|
let isFlushing = false;
|
|
@@ -245,9 +254,12 @@ let isFlushing = false;
|
|
|
245
254
|
function flushOnAppMount(instance) {
|
|
246
255
|
if (!isFlushing) {
|
|
247
256
|
isFlushing = true;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
257
|
+
try {
|
|
258
|
+
flushPreFlushCbs(instance);
|
|
259
|
+
flushPostFlushCbs();
|
|
260
|
+
} finally {
|
|
261
|
+
isFlushing = false;
|
|
262
|
+
}
|
|
251
263
|
}
|
|
252
264
|
}
|
|
253
265
|
function flushJobs(seen) {
|
|
@@ -273,9 +285,10 @@ function flushJobs(seen) {
|
|
|
273
285
|
}
|
|
274
286
|
flushIndex = 0;
|
|
275
287
|
jobsLength = 0;
|
|
288
|
+
jobs.length = 0;
|
|
276
289
|
flushPostFlushCbs(seen);
|
|
277
|
-
currentFlushPromise = null;
|
|
278
290
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
291
|
+
else currentFlushPromise = null;
|
|
279
292
|
}
|
|
280
293
|
}
|
|
281
294
|
//#endregion
|
|
@@ -332,10 +345,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
332
345
|
const renderFnWithContext = (...args) => {
|
|
333
346
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
334
347
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
348
|
+
const prevStackSize = blockStack.length;
|
|
335
349
|
let res;
|
|
336
350
|
try {
|
|
337
351
|
res = fn(...args);
|
|
338
352
|
} finally {
|
|
353
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
339
354
|
setCurrentRenderingInstance(prevInstance);
|
|
340
355
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
341
356
|
}
|
|
@@ -512,7 +527,7 @@ function instanceWatch(source, value, options) {
|
|
|
512
527
|
}
|
|
513
528
|
const prev = setCurrentInstance(this);
|
|
514
529
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
515
|
-
|
|
530
|
+
restoreCurrentInstance(prev);
|
|
516
531
|
return res;
|
|
517
532
|
}
|
|
518
533
|
function createPathGetter(ctx, path) {
|
|
@@ -525,6 +540,7 @@ function createPathGetter(ctx, path) {
|
|
|
525
540
|
}
|
|
526
541
|
//#endregion
|
|
527
542
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
543
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
528
544
|
const TeleportEndKey = Symbol("_vte");
|
|
529
545
|
const isTeleport = (type) => type.__isTeleport;
|
|
530
546
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -533,62 +549,76 @@ const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target inst
|
|
|
533
549
|
const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
|
534
550
|
const resolveTarget = (props, select) => {
|
|
535
551
|
const targetSelector = props && props.to;
|
|
536
|
-
if ((0, _vue_shared.isString)(targetSelector))
|
|
537
|
-
|
|
538
|
-
|
|
552
|
+
if ((0, _vue_shared.isString)(targetSelector)) {
|
|
553
|
+
if (!select) return null;
|
|
554
|
+
else return select(targetSelector);
|
|
555
|
+
} else return targetSelector;
|
|
539
556
|
};
|
|
540
557
|
const TeleportImpl = {
|
|
541
558
|
name: "Teleport",
|
|
542
559
|
__isTeleport: true,
|
|
543
560
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
544
|
-
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
|
561
|
+
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
|
|
545
562
|
const disabled = isTeleportDisabled(n2.props);
|
|
546
|
-
let {
|
|
563
|
+
let { dynamicChildren } = n2;
|
|
564
|
+
const mount = (vnode, container, anchor) => {
|
|
565
|
+
if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
566
|
+
};
|
|
567
|
+
const mountToTarget = (vnode = n2) => {
|
|
568
|
+
const disabled = isTeleportDisabled(vnode.props);
|
|
569
|
+
const target = vnode.target = resolveTarget(vnode.props, querySelector);
|
|
570
|
+
const targetAnchor = prepareAnchor(target, vnode, createText, insert);
|
|
571
|
+
if (target) {
|
|
572
|
+
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
573
|
+
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
574
|
+
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
575
|
+
if (!disabled) {
|
|
576
|
+
mount(vnode, target, targetAnchor);
|
|
577
|
+
updateCssVars(vnode, false);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
const queuePendingMount = (vnode) => {
|
|
582
|
+
const mountJob = () => {
|
|
583
|
+
if (pendingMounts.get(vnode) !== mountJob) return;
|
|
584
|
+
pendingMounts.delete(vnode);
|
|
585
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
586
|
+
const mountContainer = parentNode(vnode.el) || container;
|
|
587
|
+
mount(vnode, mountContainer, vnode.anchor);
|
|
588
|
+
updateCssVars(vnode, true);
|
|
589
|
+
}
|
|
590
|
+
mountToTarget(vnode);
|
|
591
|
+
};
|
|
592
|
+
pendingMounts.set(vnode, mountJob);
|
|
593
|
+
queuePostRenderEffect(mountJob, void 0, parentSuspense);
|
|
594
|
+
};
|
|
547
595
|
if (n1 == null) {
|
|
548
596
|
const placeholder = n2.el = createText("");
|
|
549
597
|
const mainAnchor = n2.anchor = createText("");
|
|
550
598
|
insert(placeholder, container, anchor);
|
|
551
599
|
insert(mainAnchor, container, anchor);
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
557
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
558
|
-
if (target) {
|
|
559
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
560
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
561
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
562
|
-
if (!disabled) {
|
|
563
|
-
mount(target, targetAnchor);
|
|
564
|
-
updateCssVars(n2, false);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
};
|
|
600
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
601
|
+
queuePendingMount(n2);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
568
604
|
if (disabled) {
|
|
569
|
-
mount(container, mainAnchor);
|
|
605
|
+
mount(n2, container, mainAnchor);
|
|
570
606
|
updateCssVars(n2, true);
|
|
571
607
|
}
|
|
572
|
-
|
|
573
|
-
n2.el.__isMounted = false;
|
|
574
|
-
queuePostRenderEffect(() => {
|
|
575
|
-
if (n2.el.__isMounted !== false) return;
|
|
576
|
-
mountToTarget();
|
|
577
|
-
delete n2.el.__isMounted;
|
|
578
|
-
}, void 0, parentSuspense);
|
|
579
|
-
} else mountToTarget();
|
|
608
|
+
mountToTarget();
|
|
580
609
|
} else {
|
|
581
610
|
n2.el = n1.el;
|
|
582
|
-
n2.targetStart = n1.targetStart;
|
|
583
611
|
const mainAnchor = n2.anchor = n1.anchor;
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}, void 0, parentSuspense);
|
|
612
|
+
const pendingMount = pendingMounts.get(n1);
|
|
613
|
+
if (pendingMount) {
|
|
614
|
+
pendingMount.flags |= 4;
|
|
615
|
+
pendingMounts.delete(n1);
|
|
616
|
+
queuePendingMount(n2);
|
|
590
617
|
return;
|
|
591
618
|
}
|
|
619
|
+
n2.targetStart = n1.targetStart;
|
|
620
|
+
const target = n2.target = n1.target;
|
|
621
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
592
622
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
593
623
|
const currentContainer = wasDisabled ? container : target;
|
|
594
624
|
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
@@ -602,23 +632,30 @@ const TeleportImpl = {
|
|
|
602
632
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
603
633
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
604
634
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
605
|
-
const nextTarget =
|
|
606
|
-
if (nextTarget)
|
|
635
|
+
const nextTarget = resolveTarget(n2.props, querySelector);
|
|
636
|
+
if (nextTarget) {
|
|
637
|
+
n2.target = nextTarget;
|
|
638
|
+
moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
|
|
639
|
+
}
|
|
607
640
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
608
641
|
updateCssVars(n2, disabled);
|
|
609
642
|
}
|
|
610
643
|
},
|
|
611
644
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
612
|
-
const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
|
|
645
|
+
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
646
|
+
const disabled = isTeleportDisabled(props);
|
|
647
|
+
const shouldRemove = doRemove || !disabled;
|
|
648
|
+
const pendingMount = pendingMounts.get(vnode);
|
|
649
|
+
if (pendingMount) {
|
|
650
|
+
pendingMount.flags |= 4;
|
|
651
|
+
pendingMounts.delete(vnode);
|
|
652
|
+
}
|
|
613
653
|
if (targetStart) hostRemove(targetStart);
|
|
614
654
|
if (targetAnchor) hostRemove(targetAnchor);
|
|
615
655
|
doRemove && hostRemove(anchor);
|
|
616
|
-
if (shapeFlag & 16) {
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
const child = children[i];
|
|
620
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
621
|
-
}
|
|
656
|
+
if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
|
|
657
|
+
const child = children[i];
|
|
658
|
+
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
622
659
|
}
|
|
623
660
|
},
|
|
624
661
|
move: moveTeleport,
|
|
@@ -629,7 +666,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
629
666
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
630
667
|
const isReorder = moveType === 2;
|
|
631
668
|
if (isReorder) insert(el, container, parentAnchor);
|
|
632
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
669
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
633
670
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
634
671
|
}
|
|
635
672
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -656,15 +693,17 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
656
693
|
const disabled = isTeleportDisabled(vnode.props);
|
|
657
694
|
if (target) {
|
|
658
695
|
const targetNode = target._lpa || target.firstChild;
|
|
659
|
-
if (vnode.shapeFlag & 16)
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
696
|
+
if (vnode.shapeFlag & 16) {
|
|
697
|
+
if (disabled) {
|
|
698
|
+
hydrateDisabledTeleport(node, vnode);
|
|
699
|
+
hydrateAnchor(target, targetNode);
|
|
700
|
+
if (!vnode.targetAnchor) prepareAnchor(target, vnode, createText, insert, parentNode(node) === target ? node : null);
|
|
701
|
+
} else {
|
|
702
|
+
vnode.anchor = nextSibling(node);
|
|
703
|
+
hydrateAnchor(target, targetNode);
|
|
704
|
+
if (!vnode.targetAnchor) prepareAnchor(target, vnode, createText, insert);
|
|
705
|
+
hydrateChildren(targetNode && nextSibling(targetNode), vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
706
|
+
}
|
|
668
707
|
}
|
|
669
708
|
updateCssVars(vnode, disabled);
|
|
670
709
|
} else if (disabled) {
|
|
@@ -752,48 +791,15 @@ const BaseTransitionImpl = {
|
|
|
752
791
|
setup(props, { slots }) {
|
|
753
792
|
const instance = getCurrentInstance();
|
|
754
793
|
const state = useTransitionState();
|
|
794
|
+
let resumeAfterLeave;
|
|
755
795
|
return () => {
|
|
756
|
-
const
|
|
757
|
-
if (!
|
|
758
|
-
const child = findNonCommentChild(children);
|
|
796
|
+
const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
|
|
797
|
+
if (!child) return;
|
|
759
798
|
const rawProps = (0, _vue_reactivity.toRaw)(props);
|
|
760
799
|
const { mode } = rawProps;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
|
|
765
|
-
if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
|
|
766
|
-
let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
|
|
767
|
-
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
|
768
|
-
let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
|
|
769
|
-
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
770
|
-
if (mode === "out-in" && innerChild.type !== Comment) {
|
|
771
|
-
state.isLeaving = true;
|
|
772
|
-
leavingHooks.afterLeave = () => {
|
|
773
|
-
state.isLeaving = false;
|
|
774
|
-
if (!(instance.job.flags & 4)) instance.update();
|
|
775
|
-
delete leavingHooks.afterLeave;
|
|
776
|
-
oldInnerChild = void 0;
|
|
777
|
-
};
|
|
778
|
-
return emptyPlaceholder(child);
|
|
779
|
-
} else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
780
|
-
const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
|
|
781
|
-
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
782
|
-
el[leaveCbKey] = () => {
|
|
783
|
-
earlyRemove();
|
|
784
|
-
el[leaveCbKey] = void 0;
|
|
785
|
-
delete enterHooks.delayedLeave;
|
|
786
|
-
oldInnerChild = void 0;
|
|
787
|
-
};
|
|
788
|
-
enterHooks.delayedLeave = () => {
|
|
789
|
-
delayedLeave();
|
|
790
|
-
delete enterHooks.delayedLeave;
|
|
791
|
-
oldInnerChild = void 0;
|
|
792
|
-
};
|
|
793
|
-
};
|
|
794
|
-
else oldInnerChild = void 0;
|
|
795
|
-
} else if (oldInnerChild) oldInnerChild = void 0;
|
|
796
|
-
return child;
|
|
800
|
+
return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
|
|
801
|
+
if (!(instance.job.flags & 4)) instance.update();
|
|
802
|
+
}) : _vue_shared.NOOP);
|
|
797
803
|
};
|
|
798
804
|
}
|
|
799
805
|
};
|
|
@@ -857,8 +863,10 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
857
863
|
persisted,
|
|
858
864
|
beforeEnter(el) {
|
|
859
865
|
let hook = onBeforeEnter;
|
|
860
|
-
if (!state.isMounted)
|
|
861
|
-
|
|
866
|
+
if (!state.isMounted) {
|
|
867
|
+
if (appear) hook = onBeforeAppear || onBeforeEnter;
|
|
868
|
+
else return;
|
|
869
|
+
}
|
|
862
870
|
if (el[leaveCbKey]) el[leaveCbKey](true);
|
|
863
871
|
earlyRemove();
|
|
864
872
|
callHook(hook, [el]);
|
|
@@ -868,11 +876,13 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
868
876
|
let hook = onEnter;
|
|
869
877
|
let afterHook = onAfterEnter;
|
|
870
878
|
let cancelHook = onEnterCancelled;
|
|
871
|
-
if (!state.isMounted)
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
879
|
+
if (!state.isMounted) {
|
|
880
|
+
if (appear) {
|
|
881
|
+
hook = onAppear || onEnter;
|
|
882
|
+
afterHook = onAfterAppear || onAfterEnter;
|
|
883
|
+
cancelHook = onAppearCancelled || onEnterCancelled;
|
|
884
|
+
} else return;
|
|
885
|
+
}
|
|
876
886
|
let called = false;
|
|
877
887
|
el[enterCbKey] = (cancelled) => {
|
|
878
888
|
if (called) return;
|
|
@@ -906,7 +916,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
906
916
|
else done();
|
|
907
917
|
},
|
|
908
918
|
clone(node) {
|
|
909
|
-
return cloneHooks(node);
|
|
919
|
+
return cloneHooks ? cloneHooks(node) : hooks;
|
|
910
920
|
}
|
|
911
921
|
};
|
|
912
922
|
return hooks;
|
|
@@ -930,16 +940,91 @@ function getInnerChild$1(vnode) {
|
|
|
930
940
|
if (shapeFlag & 32 && (0, _vue_shared.isFunction)(children.default)) return children.default();
|
|
931
941
|
}
|
|
932
942
|
}
|
|
943
|
+
function resolveTransitionChild(children, renderEmpty = false) {
|
|
944
|
+
const branches = children && getTransitionRawChildren(children, true);
|
|
945
|
+
return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* @internal
|
|
949
|
+
*/
|
|
950
|
+
function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
|
|
951
|
+
if (state.isLeaving) return emptyPlaceholder(next);
|
|
952
|
+
const nextInner = getInnerChild$1(next);
|
|
953
|
+
if (!nextInner) return emptyPlaceholder(next);
|
|
954
|
+
let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
|
|
955
|
+
if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
|
|
956
|
+
enterHooks = hooks;
|
|
957
|
+
});
|
|
958
|
+
if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
|
|
959
|
+
if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
|
|
960
|
+
const mode = props.mode;
|
|
961
|
+
const previousInner = previous && getInnerChild$1(previous);
|
|
962
|
+
if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
|
|
963
|
+
const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
|
|
964
|
+
if (nextInner.type !== Comment && (mode === "out-in" || mode === "in-out") && applyTransitionModeSwitch(previousInner, leavingHooks, mode === "in-out" ? () => enterHooks : void 0, props, state, resumeAfterLeave)) return emptyPlaceholder(next);
|
|
965
|
+
}
|
|
966
|
+
return next;
|
|
967
|
+
}
|
|
968
|
+
function forwardDelayedLeave(hooks, source) {
|
|
969
|
+
const delayedLeave = source && source.delayedLeave;
|
|
970
|
+
if (!delayedLeave) return;
|
|
971
|
+
hooks.delayedLeave = () => {
|
|
972
|
+
if (source.delayedLeave === delayedLeave) delayedLeave();
|
|
973
|
+
delete hooks.delayedLeave;
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
|
|
977
|
+
return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
|
|
978
|
+
}
|
|
979
|
+
function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
|
|
980
|
+
if (props.mode === "out-in") {
|
|
981
|
+
state.isLeaving = true;
|
|
982
|
+
leavingHooks.afterLeave = () => {
|
|
983
|
+
state.isLeaving = false;
|
|
984
|
+
resumeAfterLeave();
|
|
985
|
+
delete leavingHooks.afterLeave;
|
|
986
|
+
};
|
|
987
|
+
return true;
|
|
988
|
+
} else if (props.mode === "in-out" && getEnterHooks) {
|
|
989
|
+
let delayedLeavingVNode = leavingVNode;
|
|
990
|
+
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
991
|
+
const enterHooks = getEnterHooks();
|
|
992
|
+
if (!enterHooks) {
|
|
993
|
+
delayedLeave();
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const vnode = delayedLeavingVNode;
|
|
997
|
+
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
998
|
+
leavingVNodesCache[String(vnode.key)] = vnode;
|
|
999
|
+
el[leaveCbKey] = () => {
|
|
1000
|
+
earlyRemove();
|
|
1001
|
+
el[leaveCbKey] = void 0;
|
|
1002
|
+
delete enterHooks.delayedLeave;
|
|
1003
|
+
delayedLeavingVNode = void 0;
|
|
1004
|
+
};
|
|
1005
|
+
enterHooks.delayedLeave = () => {
|
|
1006
|
+
delayedLeave();
|
|
1007
|
+
delete enterHooks.delayedLeave;
|
|
1008
|
+
delayedLeavingVNode = void 0;
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
return false;
|
|
1013
|
+
}
|
|
933
1014
|
function setTransitionHooks(vnode, hooks) {
|
|
934
|
-
if (vnode.shapeFlag & 6 && vnode.component)
|
|
935
|
-
else {
|
|
1015
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
936
1016
|
vnode.transition = hooks;
|
|
937
|
-
setTransitionHooks(vnode.component
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1017
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
|
|
1018
|
+
else {
|
|
1019
|
+
const subTree = vnode.component.subTree;
|
|
1020
|
+
return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
|
|
1021
|
+
}
|
|
1022
|
+
} else if (vnode.shapeFlag & 128) {
|
|
1023
|
+
const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
1024
|
+
const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
1025
|
+
return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
|
|
942
1026
|
} else vnode.transition = hooks;
|
|
1027
|
+
return hooks;
|
|
943
1028
|
}
|
|
944
1029
|
function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
945
1030
|
let ret = [];
|
|
@@ -957,9 +1042,9 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
957
1042
|
}
|
|
958
1043
|
//#endregion
|
|
959
1044
|
//#region packages/runtime-core/src/apiDefineComponent.ts
|
|
960
|
-
|
|
1045
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
961
1046
|
function defineComponent(options, extraOptions) {
|
|
962
|
-
return (0, _vue_shared.isFunction)(options) ? (0, _vue_shared.extend)({ name: options.name }, extraOptions, { setup: options }) : options;
|
|
1047
|
+
return (0, _vue_shared.isFunction)(options) ? /*@__PURE__*/ (() => (0, _vue_shared.extend)({ name: options.name }, extraOptions, { setup: options }))() : options;
|
|
963
1048
|
}
|
|
964
1049
|
//#endregion
|
|
965
1050
|
//#region packages/runtime-core/src/helpers/useId.ts
|
|
@@ -1046,15 +1131,16 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
1046
1131
|
if (rawRef.f) {
|
|
1047
1132
|
const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
|
|
1048
1133
|
if (isUnmount) (0, _vue_shared.isArray)(existing) && (0, _vue_shared.remove)(existing, refValue);
|
|
1049
|
-
else if (!(0, _vue_shared.isArray)(existing))
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1134
|
+
else if (!(0, _vue_shared.isArray)(existing)) {
|
|
1135
|
+
if (_isString) {
|
|
1136
|
+
refs[ref] = [refValue];
|
|
1137
|
+
if (canSetSetupRef(ref)) setupState[ref] = refs[ref];
|
|
1138
|
+
} else {
|
|
1139
|
+
const newVal = [refValue];
|
|
1140
|
+
if (canSetRef(ref, rawRef.k)) ref.value = newVal;
|
|
1141
|
+
if (rawRef.k) refs[rawRef.k] = newVal;
|
|
1142
|
+
}
|
|
1143
|
+
} else if (!existing.includes(refValue)) existing.push(refValue);
|
|
1058
1144
|
} else if (_isString) {
|
|
1059
1145
|
refs[ref] = value;
|
|
1060
1146
|
if (canSetSetupRef(ref)) setupState[ref] = value;
|
|
@@ -1104,7 +1190,18 @@ const logMismatchError = () => {
|
|
|
1104
1190
|
hasLoggedMismatchError = true;
|
|
1105
1191
|
};
|
|
1106
1192
|
const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
|
1107
|
-
const isMathMLContainer = (container) =>
|
|
1193
|
+
const isMathMLContainer = (container) => {
|
|
1194
|
+
if (!container.namespaceURI.includes("MathML")) return false;
|
|
1195
|
+
if (container.tagName !== "annotation-xml") return true;
|
|
1196
|
+
const encoding = container.getAttribute("encoding");
|
|
1197
|
+
return !encoding || !encoding.includes("html");
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* Resolve the element namespace a container's children should be created in.
|
|
1201
|
+
* The live DOM is the source of truth, so this also covers containers that are
|
|
1202
|
+
* only known at runtime (interop boundaries, teleport targets).
|
|
1203
|
+
* @internal
|
|
1204
|
+
*/
|
|
1108
1205
|
const getContainerType = (container) => {
|
|
1109
1206
|
if (container.nodeType !== 1) return void 0;
|
|
1110
1207
|
if (isSVGContainer(container)) return "svg";
|
|
@@ -1127,7 +1224,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1127
1224
|
};
|
|
1128
1225
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
1129
1226
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1130
|
-
const isFragmentStart = isComment(node) && node.data === "[";
|
|
1227
|
+
const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(");
|
|
1131
1228
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
1132
1229
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
1133
1230
|
let domType = node.nodeType;
|
|
@@ -1139,11 +1236,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1139
1236
|
let nextNode = null;
|
|
1140
1237
|
switch (type) {
|
|
1141
1238
|
case Text:
|
|
1142
|
-
if (domType !== 3)
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1239
|
+
if (domType !== 3) {
|
|
1240
|
+
if (vnode.children === "") {
|
|
1241
|
+
insert(vnode.el = createText(""), parentNode(node), node);
|
|
1242
|
+
nextNode = node;
|
|
1243
|
+
} else nextNode = onMismatch();
|
|
1244
|
+
} else {
|
|
1147
1245
|
if (node.data !== vnode.children) {
|
|
1148
1246
|
logMismatchError();
|
|
1149
1247
|
node.data = vnode.children;
|
|
@@ -1179,39 +1277,45 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1179
1277
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1180
1278
|
break;
|
|
1181
1279
|
case VaporSlot:
|
|
1182
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
1280
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense, slotScopeIds);
|
|
1183
1281
|
break;
|
|
1184
|
-
default: if (shapeFlag & 1)
|
|
1185
|
-
|
|
1186
|
-
|
|
1282
|
+
default: if (shapeFlag & 1) {
|
|
1283
|
+
if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
1284
|
+
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1285
|
+
} else if (shapeFlag & 6) {
|
|
1187
1286
|
vnode.slotScopeIds = slotScopeIds;
|
|
1188
1287
|
const container = parentNode(node);
|
|
1189
1288
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
1190
1289
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1191
1290
|
else nextNode = nextSibling(node);
|
|
1192
|
-
if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container,
|
|
1193
|
-
else
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
if (
|
|
1197
|
-
subTree
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1291
|
+
if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense);
|
|
1292
|
+
else {
|
|
1293
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
1294
|
+
const component = vnode.component;
|
|
1295
|
+
if (!component.subTree && (isAsyncWrapper(vnode) || component.asyncDep)) {
|
|
1296
|
+
let subTree;
|
|
1297
|
+
if (isFragmentStart) {
|
|
1298
|
+
subTree = createVNode(Static);
|
|
1299
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
1300
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(node.nodeType === 8 ? Comment : "div");
|
|
1301
|
+
subTree.el = node;
|
|
1302
|
+
component.subTree = subTree;
|
|
1303
|
+
}
|
|
1202
1304
|
}
|
|
1203
|
-
} else if (shapeFlag & 64)
|
|
1204
|
-
|
|
1205
|
-
|
|
1305
|
+
} else if (shapeFlag & 64) {
|
|
1306
|
+
if (domType !== 8) nextNode = onMismatch();
|
|
1307
|
+
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
1308
|
+
} else if (shapeFlag & 128) nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, getContainerType(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
1206
1309
|
}
|
|
1207
1310
|
if (ref != null) setRef(ref, null, parentSuspense, vnode);
|
|
1208
1311
|
return nextNode;
|
|
1209
1312
|
};
|
|
1210
1313
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
1211
1314
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1212
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1315
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1213
1316
|
const forcePatch = type === "input" || type === "option";
|
|
1214
|
-
|
|
1317
|
+
const hasDynamicProps = !!dynamicProps;
|
|
1318
|
+
if (forcePatch || hasDynamicProps || patchFlag !== -1) {
|
|
1215
1319
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
1216
1320
|
let needCallTransitionHooks = false;
|
|
1217
1321
|
if (isTemplateNode(el)) {
|
|
@@ -1227,8 +1331,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1227
1331
|
}
|
|
1228
1332
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
1229
1333
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1334
|
+
if (next && !isMismatchAllowed(el, 1)) logMismatchError();
|
|
1230
1335
|
while (next) {
|
|
1231
|
-
if (!isMismatchAllowed(el, 1)) logMismatchError();
|
|
1232
1336
|
const cur = next;
|
|
1233
1337
|
next = next.nextSibling;
|
|
1234
1338
|
remove(cur);
|
|
@@ -1243,9 +1347,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1243
1347
|
}
|
|
1244
1348
|
}
|
|
1245
1349
|
if (props) {
|
|
1246
|
-
if (forcePatch || !optimized || patchFlag & 48) {
|
|
1350
|
+
if (forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
|
|
1247
1351
|
const isCustomElement = el.tagName.includes("-");
|
|
1248
|
-
|
|
1352
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
1353
|
+
for (const key in props) if (forcePatch && (key.endsWith("value") || key === "indeterminate") || (0, _vue_shared.isOn)(key) && !(0, _vue_shared.isReservedProp)(key) || key[0] === "." || isCustomElement && !(0, _vue_shared.isReservedProp)(key) || dynamicProps && dynamicProps.includes(key)) {
|
|
1354
|
+
if (isUnchangedResourceProp(el, key, props[key])) continue;
|
|
1355
|
+
patchProp(el, key, null, props[key], namespace, parentComponent);
|
|
1356
|
+
}
|
|
1249
1357
|
} else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
|
|
1250
1358
|
else if (patchFlag & 4 && (0, _vue_reactivity.isReactive)(props.style)) for (const key in props.style) props.style[key];
|
|
1251
1359
|
}
|
|
@@ -1264,6 +1372,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1264
1372
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
1265
1373
|
const children = parentVNode.children;
|
|
1266
1374
|
const l = children.length;
|
|
1375
|
+
let hasCheckedMismatch = false;
|
|
1267
1376
|
for (let i = 0; i < l; i++) {
|
|
1268
1377
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
1269
1378
|
const isText = vnode.type === Text;
|
|
@@ -1277,7 +1386,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1277
1386
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1278
1387
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
1279
1388
|
else {
|
|
1280
|
-
if (!
|
|
1389
|
+
if (!hasCheckedMismatch) {
|
|
1390
|
+
hasCheckedMismatch = true;
|
|
1391
|
+
if (!isMismatchAllowed(container, 1)) logMismatchError();
|
|
1392
|
+
}
|
|
1281
1393
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1282
1394
|
}
|
|
1283
1395
|
}
|
|
@@ -1287,8 +1399,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1287
1399
|
const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
|
1288
1400
|
if (fragmentSlotScopeIds) slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
|
1289
1401
|
const container = parentNode(node);
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1402
|
+
const first = nextSibling(node);
|
|
1403
|
+
const next = vnode.vo && node.data === "(" ? getVaporInterface(parentComponent, vnode).hydrateSlotOutlet(vnode, node, parentComponent, parentSuspense, slotScopeIds) : hydrateChildren(first, vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1404
|
+
if (next && isComment(next) && next.data === (node.data === "(" ? ")" : "]")) return nextSibling(vnode.anchor = next);
|
|
1292
1405
|
else {
|
|
1293
1406
|
logMismatchError();
|
|
1294
1407
|
insert(vnode.anchor = createComment(`]`), container, next);
|
|
@@ -1296,7 +1409,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1296
1409
|
}
|
|
1297
1410
|
};
|
|
1298
1411
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
1299
|
-
if (!
|
|
1412
|
+
if (!isNodeMismatchAllowed(node, vnode)) logMismatchError();
|
|
1300
1413
|
vnode.el = null;
|
|
1301
1414
|
if (isFragment) {
|
|
1302
1415
|
const end = locateClosingAnchor(node);
|
|
@@ -1310,20 +1423,22 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1310
1423
|
const container = parentNode(node);
|
|
1311
1424
|
remove(node);
|
|
1312
1425
|
patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1313
|
-
if (parentComponent) {
|
|
1426
|
+
if (parentComponent && parentComponent.vnode) {
|
|
1314
1427
|
parentComponent.vnode.el = vnode.el;
|
|
1315
1428
|
updateHOCHostEl(parentComponent, vnode.el);
|
|
1316
1429
|
}
|
|
1317
1430
|
return next;
|
|
1318
1431
|
};
|
|
1319
|
-
const locateClosingAnchor = (node, open = "[", close = "]") => {
|
|
1432
|
+
const locateClosingAnchor = (node, open = node && isComment(node) && node.data === "(" ? "(" : "[", close = open === "(" ? ")" : "]") => {
|
|
1320
1433
|
let match = 0;
|
|
1321
1434
|
while (node) {
|
|
1322
1435
|
node = nextSibling(node);
|
|
1323
1436
|
if (node && isComment(node)) {
|
|
1324
1437
|
if (node.data === open) match++;
|
|
1325
|
-
if (node.data === close)
|
|
1326
|
-
|
|
1438
|
+
if (node.data === close) {
|
|
1439
|
+
if (match === 0) return nextSibling(node);
|
|
1440
|
+
else match--;
|
|
1441
|
+
}
|
|
1327
1442
|
}
|
|
1328
1443
|
}
|
|
1329
1444
|
return node;
|
|
@@ -1333,7 +1448,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1333
1448
|
if (parentNode) parentNode.replaceChild(newNode, oldNode);
|
|
1334
1449
|
let parent = parentComponent;
|
|
1335
1450
|
while (parent) {
|
|
1336
|
-
if (parent.vnode.el === oldNode) parent.vnode.el = parent.subTree.el = newNode;
|
|
1451
|
+
if (parent.vnode && parent.vnode.el === oldNode) parent.vnode.el = parent.subTree.el = newNode;
|
|
1337
1452
|
parent = parent.parent;
|
|
1338
1453
|
}
|
|
1339
1454
|
};
|
|
@@ -1342,6 +1457,16 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1342
1457
|
const isTemplateNode = (node) => {
|
|
1343
1458
|
return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
|
1344
1459
|
};
|
|
1460
|
+
const resourceProps = /*@__PURE__*/ new Set([
|
|
1461
|
+
"src",
|
|
1462
|
+
"srcset",
|
|
1463
|
+
"href",
|
|
1464
|
+
"poster"
|
|
1465
|
+
]);
|
|
1466
|
+
function isUnchangedResourceProp(el, key, clientValue) {
|
|
1467
|
+
if (!resourceProps.has(key)) return false;
|
|
1468
|
+
return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
|
|
1469
|
+
}
|
|
1345
1470
|
const allowMismatchAttr = "data-allow-mismatch";
|
|
1346
1471
|
const MismatchTypeString = {
|
|
1347
1472
|
[0]: "text",
|
|
@@ -1352,7 +1477,9 @@ const MismatchTypeString = {
|
|
|
1352
1477
|
};
|
|
1353
1478
|
function isMismatchAllowed(el, allowedType) {
|
|
1354
1479
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
1355
|
-
|
|
1480
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
1481
|
+
}
|
|
1482
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
1356
1483
|
if (allowedAttr == null) return false;
|
|
1357
1484
|
else if (allowedAttr === "") return true;
|
|
1358
1485
|
else {
|
|
@@ -1361,6 +1488,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
1361
1488
|
return list.includes(MismatchTypeString[allowedType]);
|
|
1362
1489
|
}
|
|
1363
1490
|
}
|
|
1491
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
1492
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
1493
|
+
}
|
|
1494
|
+
function isMismatchAllowedByNode(node) {
|
|
1495
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
1496
|
+
}
|
|
1497
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
1498
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
1499
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
1500
|
+
}
|
|
1364
1501
|
//#endregion
|
|
1365
1502
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
1366
1503
|
let requestIdleCallback;
|
|
@@ -1434,16 +1571,18 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
|
|
1434
1571
|
return teardown;
|
|
1435
1572
|
};
|
|
1436
1573
|
function forEachElement(node, cb) {
|
|
1437
|
-
if (isComment(node) && node.data === "[") {
|
|
1574
|
+
if (isComment(node) && (node.data === "[" || node.data === "(")) {
|
|
1575
|
+
const open = node.data;
|
|
1576
|
+
const close = open === "[" ? "]" : ")";
|
|
1438
1577
|
let depth = 1;
|
|
1439
1578
|
let next = node.nextSibling;
|
|
1440
1579
|
while (next) {
|
|
1441
1580
|
if (next.nodeType === 1) {
|
|
1442
1581
|
if (cb(next) === false) break;
|
|
1443
1582
|
} else if (isComment(next)) {
|
|
1444
|
-
if (next.data ===
|
|
1583
|
+
if (next.data === close) {
|
|
1445
1584
|
if (--depth === 0) break;
|
|
1446
|
-
} else if (next.data ===
|
|
1585
|
+
} else if (next.data === open) depth++;
|
|
1447
1586
|
}
|
|
1448
1587
|
next = next.nextSibling;
|
|
1449
1588
|
}
|
|
@@ -1452,14 +1591,14 @@ function forEachElement(node, cb) {
|
|
|
1452
1591
|
//#endregion
|
|
1453
1592
|
//#region packages/runtime-core/src/apiAsyncComponent.ts
|
|
1454
1593
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
1455
|
-
|
|
1594
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1456
1595
|
function defineAsyncComponent(source) {
|
|
1457
1596
|
const { load, getResolvedComp, setPendingRequest, source: { loadingComponent, errorComponent, delay, hydrate: hydrateStrategy, timeout, suspensible = true } } = createAsyncComponentContext(source);
|
|
1458
1597
|
return /* @__PURE__ */ defineComponent({
|
|
1459
1598
|
name: "AsyncComponentWrapper",
|
|
1460
1599
|
__asyncLoader: load,
|
|
1461
1600
|
__asyncHydrate(el, instance, hydrate) {
|
|
1462
|
-
performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy);
|
|
1601
|
+
performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy, true);
|
|
1463
1602
|
},
|
|
1464
1603
|
get __asyncResolved() {
|
|
1465
1604
|
return getResolvedComp();
|
|
@@ -1479,11 +1618,16 @@ function defineAsyncComponent(source) {
|
|
|
1479
1618
|
onError(err);
|
|
1480
1619
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1481
1620
|
});
|
|
1482
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
1621
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1483
1622
|
load().then(() => {
|
|
1623
|
+
if (instance.isUnmounted) return;
|
|
1484
1624
|
loaded.value = true;
|
|
1485
1625
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1486
1626
|
}).catch((err) => {
|
|
1627
|
+
if (instance.isUnmounted) {
|
|
1628
|
+
setPendingRequest(null);
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1487
1631
|
onError(err);
|
|
1488
1632
|
error.value = err;
|
|
1489
1633
|
});
|
|
@@ -1539,14 +1683,22 @@ function createAsyncComponentContext(source) {
|
|
|
1539
1683
|
setPendingRequest: (request) => pendingRequest = request
|
|
1540
1684
|
};
|
|
1541
1685
|
}
|
|
1542
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
1686
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
1543
1687
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
1544
1688
|
const error = (0, _vue_reactivity.ref)();
|
|
1545
1689
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
1546
|
-
|
|
1690
|
+
let timeoutTimer;
|
|
1691
|
+
let delayTimer;
|
|
1692
|
+
if (instance) onUnmounted(() => {
|
|
1693
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
1694
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
1695
|
+
}, instance);
|
|
1696
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
1697
|
+
if (instance && instance.isUnmounted) return;
|
|
1547
1698
|
delayed.value = false;
|
|
1548
1699
|
}, delay);
|
|
1549
|
-
if (timeout != null) setTimeout(() => {
|
|
1700
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
1701
|
+
if (instance && instance.isUnmounted) return;
|
|
1550
1702
|
if (!loaded.value && !error.value) {
|
|
1551
1703
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
1552
1704
|
onError(err);
|
|
@@ -1563,11 +1715,13 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
1563
1715
|
* shared between core and vapor
|
|
1564
1716
|
* @internal
|
|
1565
1717
|
*/
|
|
1566
|
-
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
1718
|
+
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy, skipIfUpdated) {
|
|
1719
|
+
const wasConnected = el.isConnected;
|
|
1567
1720
|
let patched = false;
|
|
1568
|
-
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
1721
|
+
if (skipIfUpdated) (instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
1569
1722
|
const performHydrate = () => {
|
|
1570
1723
|
if (patched) return;
|
|
1724
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
1571
1725
|
hydrate();
|
|
1572
1726
|
};
|
|
1573
1727
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -1647,10 +1801,13 @@ const KeepAlive = {
|
|
|
1647
1801
|
});
|
|
1648
1802
|
let pendingCacheKey = null;
|
|
1649
1803
|
const cacheSubtree = () => {
|
|
1650
|
-
if (pendingCacheKey != null)
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1804
|
+
if (pendingCacheKey != null) {
|
|
1805
|
+
if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
|
|
1806
|
+
const vnode = getInnerChild(keepAliveInstance.subTree);
|
|
1807
|
+
if (vnode.component) cache.set(pendingCacheKey, vnode);
|
|
1808
|
+
}, void 0, keepAliveInstance.subTree.suspense);
|
|
1809
|
+
else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
1810
|
+
}
|
|
1654
1811
|
};
|
|
1655
1812
|
onMounted(cacheSubtree);
|
|
1656
1813
|
onUpdated(cacheSubtree);
|
|
@@ -1804,7 +1961,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
1804
1961
|
try {
|
|
1805
1962
|
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
1806
1963
|
} finally {
|
|
1807
|
-
|
|
1964
|
+
restoreCurrentInstance(prev);
|
|
1808
1965
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
1809
1966
|
}
|
|
1810
1967
|
});
|
|
@@ -1888,16 +2045,17 @@ function renderList(source, renderItem, cache, index) {
|
|
|
1888
2045
|
} else if (typeof source === "number") {
|
|
1889
2046
|
ret = new Array(source);
|
|
1890
2047
|
for (let i = 0; i < source; i++) ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
1891
|
-
} else if ((0, _vue_shared.isObject)(source))
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
2048
|
+
} else if ((0, _vue_shared.isObject)(source)) {
|
|
2049
|
+
if (source[Symbol.iterator]) ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i]));
|
|
2050
|
+
else {
|
|
2051
|
+
const keys = Object.keys(source);
|
|
2052
|
+
ret = new Array(keys.length);
|
|
2053
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
2054
|
+
const key = keys[i];
|
|
2055
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
2056
|
+
}
|
|
1898
2057
|
}
|
|
1899
|
-
}
|
|
1900
|
-
else ret = [];
|
|
2058
|
+
} else ret = [];
|
|
1901
2059
|
if (cache) cache[index] = ret;
|
|
1902
2060
|
return ret;
|
|
1903
2061
|
}
|
|
@@ -1922,33 +2080,77 @@ function createSlots(slots, dynamicSlots) {
|
|
|
1922
2080
|
//#endregion
|
|
1923
2081
|
//#region packages/runtime-core/src/helpers/renderSlot.ts
|
|
1924
2082
|
/**
|
|
2083
|
+
* Links a slot function to its raw vapor slot: a raw vapor slot carries
|
|
2084
|
+
* itself, and the wrapper the interop slots proxy hands out carries the raw
|
|
2085
|
+
* slot it wraps — one lookup answers both "is this a vapor slot" and
|
|
2086
|
+
* "which one". Internal to vapor interop.
|
|
2087
|
+
*/
|
|
2088
|
+
const rawVaporSlotKey = Symbol(`rawVaporSlot`);
|
|
2089
|
+
/**
|
|
2090
|
+
* Invokes a VDOM slot fallback under the outlet owner that produced it, the
|
|
2091
|
+
* way `renderSlot` would have rendered it inline. Vapor interop invokes
|
|
2092
|
+
* fallbacks late, outside any render, so it passes the owner recorded on the
|
|
2093
|
+
* vapor slot vnode. Internal to vapor interop.
|
|
2094
|
+
*/
|
|
2095
|
+
function invokeSlotFallback(fallback, owner) {
|
|
2096
|
+
if (!owner) return fallback();
|
|
2097
|
+
const prev = setCurrentRenderingInstance(owner);
|
|
2098
|
+
const prevStackSize = blockStack.length;
|
|
2099
|
+
try {
|
|
2100
|
+
return fallback();
|
|
2101
|
+
} finally {
|
|
2102
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2103
|
+
setCurrentRenderingInstance(prev);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
1925
2107
|
* Compiler runtime helper for rendering `<slot/>`
|
|
1926
2108
|
* @private
|
|
1927
2109
|
*/
|
|
1928
|
-
function renderSlot(slots, name, props
|
|
2110
|
+
function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
|
|
2111
|
+
if (props == null) props = {};
|
|
1929
2112
|
let slot = slots[name];
|
|
1930
|
-
const vaporSlot = slot &&
|
|
2113
|
+
const vaporSlot = slot && slot[rawVaporSlotKey];
|
|
1931
2114
|
if (vaporSlot) {
|
|
1932
2115
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
1933
2116
|
ret.vs = {
|
|
1934
2117
|
slot: vaporSlot,
|
|
1935
|
-
fallback
|
|
2118
|
+
outlets: fallback ? [{
|
|
2119
|
+
fallback,
|
|
2120
|
+
owner: currentRenderingInstance
|
|
2121
|
+
}] : void 0
|
|
1936
2122
|
};
|
|
2123
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
1937
2124
|
return ret;
|
|
1938
2125
|
}
|
|
1939
2126
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1942
|
-
|
|
2127
|
+
const slotProps = branchKey != null && props.key == null ? (0, _vue_shared.extend)({}, props, { key: branchKey }) : props;
|
|
2128
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
2129
|
+
if (name !== "default") slotProps.name = name;
|
|
2130
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
1943
2131
|
}
|
|
1944
2132
|
if (slot && slot._c) slot._d = false;
|
|
2133
|
+
const prevStackSize = blockStack.length;
|
|
1945
2134
|
openBlock();
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2135
|
+
let rendered;
|
|
2136
|
+
try {
|
|
2137
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2138
|
+
let attached = false;
|
|
2139
|
+
if (fallback && validSlotContent && currentRenderingInstance) {
|
|
2140
|
+
const interop = currentRenderingInstance.appContext.vapor;
|
|
2141
|
+
if (interop) attached = interop.attachSlotOutlet(validSlotContent, fallback, currentRenderingInstance);
|
|
2142
|
+
}
|
|
2143
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
2144
|
+
rendered = createBlock(Fragment, { key: (slotKey && !(0, _vue_shared.isSymbol)(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
2145
|
+
if (!validSlotContent && fallback) rendered.shapeFlag |= 1024;
|
|
2146
|
+
if (attached) rendered.vo = true;
|
|
2147
|
+
} catch (err) {
|
|
2148
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2149
|
+
throw err;
|
|
2150
|
+
} finally {
|
|
2151
|
+
if (slot && slot._c) slot._d = true;
|
|
2152
|
+
}
|
|
1950
2153
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
1951
|
-
if (slot && slot._c) slot._d = true;
|
|
1952
2154
|
return rendered;
|
|
1953
2155
|
}
|
|
1954
2156
|
function ensureValidVNode(vnodes) {
|
|
@@ -1959,12 +2161,6 @@ function ensureValidVNode(vnodes) {
|
|
|
1959
2161
|
return true;
|
|
1960
2162
|
}) ? vnodes : null;
|
|
1961
2163
|
}
|
|
1962
|
-
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
1963
|
-
let vaporSlot;
|
|
1964
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
|
|
1965
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
2164
|
//#endregion
|
|
1969
2165
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
1970
2166
|
/**
|
|
@@ -2072,7 +2268,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
2072
2268
|
return Reflect.defineProperty(target, key, descriptor);
|
|
2073
2269
|
}
|
|
2074
2270
|
};
|
|
2075
|
-
const RuntimeCompiledPublicInstanceProxyHandlers =
|
|
2271
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*@__PURE__*/ (0, _vue_shared.extend)({}, PublicInstanceProxyHandlers, {
|
|
2076
2272
|
get(target, key) {
|
|
2077
2273
|
if (key === Symbol.unscopables) return;
|
|
2078
2274
|
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
@@ -2185,12 +2381,13 @@ function mergeDefaults(raw, defaults) {
|
|
|
2185
2381
|
for (const key in defaults) {
|
|
2186
2382
|
if (key.startsWith("__skip")) continue;
|
|
2187
2383
|
let opt = props[key];
|
|
2188
|
-
if (opt)
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2384
|
+
if (opt) {
|
|
2385
|
+
if ((0, _vue_shared.isArray)(opt) || (0, _vue_shared.isFunction)(opt)) opt = props[key] = {
|
|
2386
|
+
type: opt,
|
|
2387
|
+
default: defaults[key]
|
|
2388
|
+
};
|
|
2389
|
+
else opt.default = defaults[key];
|
|
2390
|
+
} else if (opt === null) opt = props[key] = { default: defaults[key] };
|
|
2194
2391
|
if (opt && defaults[`__skip_${key}`]) opt.skipFactory = true;
|
|
2195
2392
|
}
|
|
2196
2393
|
return props;
|
|
@@ -2243,21 +2440,29 @@ function withAsyncContext(getAwaitable) {
|
|
|
2243
2440
|
setCurrentInstance(null, void 0);
|
|
2244
2441
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2245
2442
|
const restore = () => {
|
|
2443
|
+
const stoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
2246
2444
|
setCurrentInstance(ctx);
|
|
2247
2445
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
2446
|
+
return stoppedScope;
|
|
2248
2447
|
};
|
|
2249
2448
|
const cleanup = () => {
|
|
2250
2449
|
setCurrentInstance(null, void 0);
|
|
2251
2450
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2252
2451
|
};
|
|
2253
2452
|
if ((0, _vue_shared.isPromise)(awaitable)) awaitable = awaitable.catch((e) => {
|
|
2254
|
-
restore();
|
|
2255
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
2453
|
+
const stoppedScope = restore();
|
|
2454
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
2455
|
+
if (stoppedScope) stoppedScope.reset();
|
|
2456
|
+
cleanup();
|
|
2457
|
+
}));
|
|
2256
2458
|
throw e;
|
|
2257
2459
|
});
|
|
2258
2460
|
return [awaitable, () => {
|
|
2259
|
-
restore();
|
|
2260
|
-
Promise.resolve().then(
|
|
2461
|
+
const stoppedScope = restore();
|
|
2462
|
+
Promise.resolve().then(() => {
|
|
2463
|
+
if (stoppedScope) stoppedScope.reset();
|
|
2464
|
+
cleanup();
|
|
2465
|
+
});
|
|
2261
2466
|
}];
|
|
2262
2467
|
}
|
|
2263
2468
|
//#endregion
|
|
@@ -2283,9 +2488,11 @@ function applyOptions(instance) {
|
|
|
2283
2488
|
shouldCacheAccess = true;
|
|
2284
2489
|
if (computedOptions) for (const key in computedOptions) {
|
|
2285
2490
|
const opt = computedOptions[key];
|
|
2491
|
+
const get = (0, _vue_shared.isFunction)(opt) ? opt.bind(publicThis, publicThis) : (0, _vue_shared.isFunction)(opt.get) ? opt.get.bind(publicThis, publicThis) : _vue_shared.NOOP;
|
|
2492
|
+
const set = !(0, _vue_shared.isFunction)(opt) && (0, _vue_shared.isFunction)(opt.set) ? opt.set.bind(publicThis) : _vue_shared.NOOP;
|
|
2286
2493
|
const c = computed({
|
|
2287
|
-
get
|
|
2288
|
-
set
|
|
2494
|
+
get,
|
|
2495
|
+
set
|
|
2289
2496
|
});
|
|
2290
2497
|
Object.defineProperty(ctx, key, {
|
|
2291
2498
|
enumerable: true,
|
|
@@ -2341,9 +2548,10 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = _vue_s
|
|
|
2341
2548
|
for (const key in injectOptions) {
|
|
2342
2549
|
const opt = injectOptions[key];
|
|
2343
2550
|
let injected;
|
|
2344
|
-
if ((0, _vue_shared.isObject)(opt))
|
|
2345
|
-
|
|
2346
|
-
|
|
2551
|
+
if ((0, _vue_shared.isObject)(opt)) {
|
|
2552
|
+
if ("default" in opt) injected = inject(opt.from || key, opt.default, true);
|
|
2553
|
+
else injected = inject(opt.from || key);
|
|
2554
|
+
} else injected = inject(opt);
|
|
2347
2555
|
if ((0, _vue_reactivity.isRef)(injected)) Object.defineProperty(ctx, key, {
|
|
2348
2556
|
enumerable: true,
|
|
2349
2557
|
configurable: true,
|
|
@@ -2362,10 +2570,12 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
2362
2570
|
const handler = ctx[raw];
|
|
2363
2571
|
if ((0, _vue_shared.isFunction)(handler)) watch(getter, handler);
|
|
2364
2572
|
} else if ((0, _vue_shared.isFunction)(raw)) watch(getter, raw.bind(publicThis));
|
|
2365
|
-
else if ((0, _vue_shared.isObject)(raw))
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2573
|
+
else if ((0, _vue_shared.isObject)(raw)) {
|
|
2574
|
+
if ((0, _vue_shared.isArray)(raw)) raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
2575
|
+
else {
|
|
2576
|
+
const handler = (0, _vue_shared.isFunction)(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
2577
|
+
if ((0, _vue_shared.isFunction)(handler)) watch(getter, handler, raw);
|
|
2578
|
+
}
|
|
2369
2579
|
}
|
|
2370
2580
|
}
|
|
2371
2581
|
/**
|
|
@@ -2451,7 +2661,7 @@ function mergeObjectOptions(to, from) {
|
|
|
2451
2661
|
}
|
|
2452
2662
|
function mergeEmitsOrPropsOptions(to, from) {
|
|
2453
2663
|
if (to) {
|
|
2454
|
-
if ((0, _vue_shared.isArray)(to) && (0, _vue_shared.isArray)(from)) return [
|
|
2664
|
+
if ((0, _vue_shared.isArray)(to) && (0, _vue_shared.isArray)(from)) return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
2455
2665
|
return (0, _vue_shared.extend)(Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from !== null && from !== void 0 ? from : {}));
|
|
2456
2666
|
} else return from;
|
|
2457
2667
|
}
|
|
@@ -2583,13 +2793,17 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
2583
2793
|
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
2584
2794
|
const res = (0, _vue_reactivity.customRef)((track, trigger) => {
|
|
2585
2795
|
let localValue;
|
|
2796
|
+
let prevPropValue = _vue_shared.EMPTY_OBJ;
|
|
2586
2797
|
let prevSetValue = _vue_shared.EMPTY_OBJ;
|
|
2587
2798
|
let prevEmittedValue;
|
|
2588
2799
|
watchSyncEffect(() => {
|
|
2589
2800
|
const propValue = props[camelizedName];
|
|
2590
|
-
if ((0, _vue_shared.hasChanged)(
|
|
2591
|
-
|
|
2592
|
-
|
|
2801
|
+
if ((0, _vue_shared.hasChanged)(prevPropValue, propValue)) {
|
|
2802
|
+
prevPropValue = propValue;
|
|
2803
|
+
if ((0, _vue_shared.hasChanged)(localValue, propValue)) {
|
|
2804
|
+
localValue = propValue;
|
|
2805
|
+
trigger();
|
|
2806
|
+
}
|
|
2593
2807
|
}
|
|
2594
2808
|
});
|
|
2595
2809
|
return {
|
|
@@ -2612,12 +2826,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
2612
2826
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
2613
2827
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
2614
2828
|
}
|
|
2615
|
-
|
|
2829
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
2830
|
+
if (!hasVModel) {
|
|
2616
2831
|
localValue = value;
|
|
2617
2832
|
trigger();
|
|
2618
2833
|
}
|
|
2619
2834
|
i.emit(`update:${name}`, emittedValue);
|
|
2620
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
2835
|
+
if ((0, _vue_shared.hasChanged)(value, prevSetValue) && ((0, _vue_shared.hasChanged)(value, emittedValue) && !(0, _vue_shared.hasChanged)(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== _vue_shared.EMPTY_OBJ && !(0, _vue_shared.hasChanged)(emittedValue, localValue))) trigger();
|
|
2621
2836
|
prevSetValue = value;
|
|
2622
2837
|
prevEmittedValue = emittedValue;
|
|
2623
2838
|
}
|
|
@@ -2653,7 +2868,7 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
|
2653
2868
|
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
2654
2869
|
if (modifiers) {
|
|
2655
2870
|
if (modifiers.trim) args = rawArgs.map((a) => (0, _vue_shared.isString)(a) ? a.trim() : a);
|
|
2656
|
-
if (modifiers.number) args =
|
|
2871
|
+
if (modifiers.number) args = args.map(_vue_shared.looseToNumber);
|
|
2657
2872
|
}
|
|
2658
2873
|
let handlerName;
|
|
2659
2874
|
let handler = getter(props, handlerName = (0, _vue_shared.toHandlerKey)(event)) || getter(props, handlerName = (0, _vue_shared.toHandlerKey)((0, _vue_shared.camelize)(event)));
|
|
@@ -2708,7 +2923,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2708
2923
|
*/
|
|
2709
2924
|
function isEmitListener(options, key) {
|
|
2710
2925
|
if (!options || !(0, _vue_shared.isOn)(key)) return false;
|
|
2711
|
-
key = key.slice(2)
|
|
2926
|
+
key = key.slice(2);
|
|
2927
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
2712
2928
|
return (0, _vue_shared.hasOwn)(options, key[0].toLowerCase() + key.slice(1)) || (0, _vue_shared.hasOwn)(options, (0, _vue_shared.hyphenate)(key)) || (0, _vue_shared.hasOwn)(options, key);
|
|
2713
2929
|
}
|
|
2714
2930
|
//#endregion
|
|
@@ -2753,7 +2969,7 @@ function renderComponentRoot(instance) {
|
|
|
2753
2969
|
root = cloneVNode(root, null, false, true);
|
|
2754
2970
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2755
2971
|
}
|
|
2756
|
-
if (vnode.transition) setTransitionHooks(root, vnode.transition);
|
|
2972
|
+
if (vnode.transition) setTransitionHooks(isTeleport(root.type) ? getInnerChild$1(root) || root : root, vnode.transition);
|
|
2757
2973
|
result = root;
|
|
2758
2974
|
setCurrentRenderingInstance(prev);
|
|
2759
2975
|
return result;
|
|
@@ -2763,15 +2979,18 @@ function filterSingleRoot(children, recurse = true) {
|
|
|
2763
2979
|
for (let i = 0; i < children.length; i++) {
|
|
2764
2980
|
const child = children[i];
|
|
2765
2981
|
if (isVNode(child)) {
|
|
2766
|
-
if (child.type !== Comment || child.children === "v-if")
|
|
2767
|
-
|
|
2982
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
2983
|
+
if (singleRoot) return;
|
|
2984
|
+
else singleRoot = child;
|
|
2985
|
+
}
|
|
2768
2986
|
} else return;
|
|
2769
2987
|
}
|
|
2770
2988
|
return singleRoot;
|
|
2771
2989
|
}
|
|
2990
|
+
const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || (0, _vue_shared.isOn)(key);
|
|
2772
2991
|
const getFunctionalFallthrough = (attrs) => {
|
|
2773
2992
|
let res;
|
|
2774
|
-
for (const key in attrs) if (
|
|
2993
|
+
for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
|
|
2775
2994
|
return res;
|
|
2776
2995
|
};
|
|
2777
2996
|
const filterModelListeners = (attrs, props) => {
|
|
@@ -2872,16 +3091,17 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
2872
3091
|
let key = propsToUpdate[i];
|
|
2873
3092
|
if (isEmitListener(instance.emitsOptions, key)) continue;
|
|
2874
3093
|
const value = rawProps[key];
|
|
2875
|
-
if (options)
|
|
2876
|
-
if (
|
|
2877
|
-
attrs[key]
|
|
2878
|
-
|
|
3094
|
+
if (options) {
|
|
3095
|
+
if ((0, _vue_shared.hasOwn)(attrs, key)) {
|
|
3096
|
+
if (value !== attrs[key]) {
|
|
3097
|
+
attrs[key] = value;
|
|
3098
|
+
hasAttrsChanged = true;
|
|
3099
|
+
}
|
|
3100
|
+
} else {
|
|
3101
|
+
const camelizedKey = (0, _vue_shared.camelize)(key);
|
|
3102
|
+
props[camelizedKey] = resolvePropValue(options, camelizedKey, value, instance, baseResolveDefault);
|
|
2879
3103
|
}
|
|
2880
|
-
} else {
|
|
2881
|
-
const camelizedKey = (0, _vue_shared.camelize)(key);
|
|
2882
|
-
props[camelizedKey] = resolvePropValue(options, camelizedKey, value, instance, baseResolveDefault);
|
|
2883
|
-
}
|
|
2884
|
-
else if (value !== attrs[key]) {
|
|
3104
|
+
} else if (value !== attrs[key]) {
|
|
2885
3105
|
attrs[key] = value;
|
|
2886
3106
|
hasAttrsChanged = true;
|
|
2887
3107
|
}
|
|
@@ -2890,9 +3110,11 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
2890
3110
|
} else {
|
|
2891
3111
|
if (setFullProps(instance, rawProps, props, attrs)) hasAttrsChanged = true;
|
|
2892
3112
|
let kebabKey;
|
|
2893
|
-
for (const key in rawCurrentProps) if (!rawProps || !(0, _vue_shared.hasOwn)(rawProps, key) && ((kebabKey = (0, _vue_shared.hyphenate)(key)) === key || !(0, _vue_shared.hasOwn)(rawProps, kebabKey)))
|
|
2894
|
-
if (
|
|
2895
|
-
|
|
3113
|
+
for (const key in rawCurrentProps) if (!rawProps || !(0, _vue_shared.hasOwn)(rawProps, key) && ((kebabKey = (0, _vue_shared.hyphenate)(key)) === key || !(0, _vue_shared.hasOwn)(rawProps, kebabKey))) {
|
|
3114
|
+
if (options) {
|
|
3115
|
+
if (rawPrevProps && (rawPrevProps[key] !== void 0 || rawPrevProps[kebabKey] !== void 0)) props[key] = resolvePropValue(options, key, void 0, instance, baseResolveDefault, true);
|
|
3116
|
+
} else delete props[key];
|
|
3117
|
+
}
|
|
2896
3118
|
if (attrs !== rawCurrentProps) {
|
|
2897
3119
|
for (const key in attrs) if (!rawProps || !(0, _vue_shared.hasOwn)(rawProps, key) && true) {
|
|
2898
3120
|
delete attrs[key];
|
|
@@ -2910,9 +3132,10 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
2910
3132
|
if ((0, _vue_shared.isReservedProp)(key)) continue;
|
|
2911
3133
|
const value = rawProps[key];
|
|
2912
3134
|
let camelKey;
|
|
2913
|
-
if (options && (0, _vue_shared.hasOwn)(options, camelKey = (0, _vue_shared.camelize)(key)))
|
|
2914
|
-
|
|
2915
|
-
|
|
3135
|
+
if (options && (0, _vue_shared.hasOwn)(options, camelKey = (0, _vue_shared.camelize)(key))) {
|
|
3136
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) props[camelKey] = value;
|
|
3137
|
+
else (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
3138
|
+
} else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2916
3139
|
if (!(key in attrs) || value !== attrs[key]) {
|
|
2917
3140
|
attrs[key] = value;
|
|
2918
3141
|
hasAttrsChanged = true;
|
|
@@ -2959,7 +3182,7 @@ function baseResolveDefault(factory, instance, key) {
|
|
|
2959
3182
|
const prev = setCurrentInstance(instance);
|
|
2960
3183
|
const props = (0, _vue_reactivity.toRaw)(instance.props);
|
|
2961
3184
|
value = factory.call(null, props);
|
|
2962
|
-
|
|
3185
|
+
restoreCurrentInstance(prev);
|
|
2963
3186
|
return value;
|
|
2964
3187
|
}
|
|
2965
3188
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3073,9 +3296,10 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
3073
3296
|
let deletionComparisonTarget = _vue_shared.EMPTY_OBJ;
|
|
3074
3297
|
if (vnode.shapeFlag & 32) {
|
|
3075
3298
|
const type = children._;
|
|
3076
|
-
if (type)
|
|
3077
|
-
|
|
3078
|
-
|
|
3299
|
+
if (type) {
|
|
3300
|
+
if (optimized && type === 1) needDeletionCheck = false;
|
|
3301
|
+
else assignSlots(slots, children, optimized);
|
|
3302
|
+
} else {
|
|
3079
3303
|
needDeletionCheck = !children.$stable;
|
|
3080
3304
|
normalizeObjectSlots(children, slots, instance);
|
|
3081
3305
|
}
|
|
@@ -3135,6 +3359,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3135
3359
|
optimized = false;
|
|
3136
3360
|
n2.dynamicChildren = null;
|
|
3137
3361
|
}
|
|
3362
|
+
if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
|
|
3363
|
+
if (n2.dynamicChildren === _vue_shared.EMPTY_ARR) n2.dynamicChildren = [];
|
|
3364
|
+
n2.dynamicChildren.hasOnce = true;
|
|
3365
|
+
}
|
|
3138
3366
|
const { type, ref, shapeFlag } = n2;
|
|
3139
3367
|
switch (type) {
|
|
3140
3368
|
case Text:
|
|
@@ -3150,7 +3378,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3150
3378
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3151
3379
|
break;
|
|
3152
3380
|
case VaporSlot:
|
|
3153
|
-
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense);
|
|
3381
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense, slotScopeIds);
|
|
3154
3382
|
break;
|
|
3155
3383
|
default: if (shapeFlag & 1) processElement(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3156
3384
|
else if (shapeFlag & 6) processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
@@ -3246,7 +3474,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3246
3474
|
for (let i = 0; i < inheritedScopeIds.length; i++) hostSetScopeId(el, inheritedScopeIds[i]);
|
|
3247
3475
|
};
|
|
3248
3476
|
const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
|
3249
|
-
for (let i = start; i < children.length; i++)
|
|
3477
|
+
for (let i = start; i < children.length; i++) {
|
|
3478
|
+
const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
|
3479
|
+
patch(null, child, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3480
|
+
}
|
|
3250
3481
|
};
|
|
3251
3482
|
const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
3252
3483
|
const el = n2.el = n1.el;
|
|
@@ -3257,8 +3488,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3257
3488
|
let vnodeHook;
|
|
3258
3489
|
parentComponent && toggleRecurse(parentComponent, false);
|
|
3259
3490
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3491
|
+
if (n2.ibu) n2.ibu();
|
|
3260
3492
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3261
3493
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
3494
|
+
if (dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
3495
|
+
patchFlag = 0;
|
|
3496
|
+
optimized = false;
|
|
3497
|
+
dynamicChildren = null;
|
|
3498
|
+
}
|
|
3262
3499
|
if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) hostSetElementText(el, "");
|
|
3263
3500
|
if (dynamicChildren) patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds);
|
|
3264
3501
|
else if (!optimized) patchChildren(n1, n2, el, null, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds, false);
|
|
@@ -3283,8 +3520,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3283
3520
|
if (n1.children !== n2.children) hostSetElementText(el, n2.children);
|
|
3284
3521
|
}
|
|
3285
3522
|
} else if (!optimized && dynamicChildren == null) patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3286
|
-
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) queuePostRenderEffect(() => {
|
|
3523
|
+
if ((vnodeHook = newProps.onVnodeUpdated) || dirs || n2.iu) queuePostRenderEffect(() => {
|
|
3287
3524
|
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3525
|
+
n2.iu && n2.iu();
|
|
3288
3526
|
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
3289
3527
|
}, void 0, parentSuspense);
|
|
3290
3528
|
};
|
|
@@ -3292,7 +3530,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3292
3530
|
for (let i = 0; i < newChildren.length; i++) {
|
|
3293
3531
|
const oldVNode = oldChildren[i];
|
|
3294
3532
|
const newVNode = newChildren[i];
|
|
3295
|
-
|
|
3533
|
+
const container = oldVNode.el && (oldVNode.type === Fragment || !isSameVNodeType(oldVNode, newVNode) || oldVNode.shapeFlag & 198) ? hostParentNode(oldVNode.el) : fallbackContainer;
|
|
3534
|
+
patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, namespace, slotScopeIds, true);
|
|
3296
3535
|
}
|
|
3297
3536
|
};
|
|
3298
3537
|
const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
|
@@ -3325,25 +3564,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3325
3564
|
};
|
|
3326
3565
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
3327
3566
|
n2.slotScopeIds = slotScopeIds;
|
|
3328
|
-
if (n2.type.__vapor)
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
}
|
|
3338
|
-
else {
|
|
3339
|
-
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
|
|
3340
|
-
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3341
|
-
});
|
|
3342
|
-
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
|
|
3343
|
-
}
|
|
3344
|
-
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
3345
|
-
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
3346
|
-
else updateComponent(n1, n2, optimized);
|
|
3567
|
+
if (n2.type.__vapor) {
|
|
3568
|
+
if (n1 == null) {
|
|
3569
|
+
if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
|
|
3570
|
+
else getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense);
|
|
3571
|
+
} else getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized));
|
|
3572
|
+
} else if (n1 == null) {
|
|
3573
|
+
if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
3574
|
+
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
3575
|
+
} else updateComponent(n1, n2, optimized);
|
|
3347
3576
|
};
|
|
3348
3577
|
const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
|
3349
3578
|
const instance = initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense);
|
|
@@ -3374,14 +3603,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3374
3603
|
};
|
|
3375
3604
|
const updateComponent = (n1, n2, optimized) => {
|
|
3376
3605
|
const instance = n2.component = n1.component;
|
|
3377
|
-
if (shouldUpdateComponent(n1, n2, optimized))
|
|
3378
|
-
|
|
3379
|
-
|
|
3606
|
+
if (shouldUpdateComponent(n1, n2, optimized)) {
|
|
3607
|
+
if (instance.asyncDep && !instance.asyncResolved) {
|
|
3608
|
+
n2.el = n1.el;
|
|
3609
|
+
updateComponentPreRender(instance, n2, optimized);
|
|
3610
|
+
return;
|
|
3611
|
+
} else {
|
|
3612
|
+
instance.next = n2;
|
|
3613
|
+
instance.effect.run();
|
|
3614
|
+
}
|
|
3380
3615
|
} else {
|
|
3381
|
-
instance.next = n2;
|
|
3382
|
-
instance.effect.run();
|
|
3383
|
-
}
|
|
3384
|
-
else {
|
|
3385
3616
|
n2.el = n1.el;
|
|
3386
3617
|
instance.vnode = n2;
|
|
3387
3618
|
}
|
|
@@ -3467,6 +3698,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3467
3698
|
} else next = vnode;
|
|
3468
3699
|
if (bu) (0, _vue_shared.invokeArrayFns)(bu);
|
|
3469
3700
|
if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
3701
|
+
if (next.ibu) next.ibu();
|
|
3470
3702
|
toggleRecurse(instance, true);
|
|
3471
3703
|
const nextTree = renderComponentRoot(instance);
|
|
3472
3704
|
const prevTree = instance.subTree;
|
|
@@ -3475,7 +3707,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3475
3707
|
next.el = nextTree.el;
|
|
3476
3708
|
if (originNext === null) updateHOCHostEl(instance, nextTree.el);
|
|
3477
3709
|
if (u) queuePostRenderEffect(u, void 0, parentSuspense);
|
|
3478
|
-
if (vnodeHook = next.props && next.props.onVnodeUpdated) queuePostRenderEffect(() =>
|
|
3710
|
+
if ((vnodeHook = next.props && next.props.onVnodeUpdated) || next.iu) queuePostRenderEffect(() => {
|
|
3711
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
3712
|
+
next.iu && next.iu();
|
|
3713
|
+
}, void 0, parentSuspense);
|
|
3479
3714
|
}
|
|
3480
3715
|
}
|
|
3481
3716
|
}
|
|
@@ -3513,9 +3748,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3513
3748
|
if (shapeFlag & 8) {
|
|
3514
3749
|
if (prevShapeFlag & 16) unmountChildren(c1, parentComponent, parentSuspense);
|
|
3515
3750
|
if (c2 !== c1) hostSetElementText(container, c2);
|
|
3516
|
-
} else if (prevShapeFlag & 16)
|
|
3517
|
-
|
|
3518
|
-
|
|
3751
|
+
} else if (prevShapeFlag & 16) {
|
|
3752
|
+
if (shapeFlag & 16) patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3753
|
+
else unmountChildren(c1, parentComponent, parentSuspense, true);
|
|
3754
|
+
} else {
|
|
3519
3755
|
if (prevShapeFlag & 8) hostSetElementText(container, "");
|
|
3520
3756
|
if (shapeFlag & 16) mountChildren(c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3521
3757
|
}
|
|
@@ -3611,15 +3847,17 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3611
3847
|
const anchorVNode = c2[nextIndex + 1];
|
|
3612
3848
|
const anchor = nextIndex + 1 < l2 ? anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode) : parentAnchor;
|
|
3613
3849
|
if (newIndexToOldIndexMap[i] === 0) patch(null, nextChild, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3614
|
-
else if (moved)
|
|
3615
|
-
|
|
3850
|
+
else if (moved) {
|
|
3851
|
+
if (j < 0 || i !== increasingNewIndexSequence[j]) move(nextChild, container, anchor, 2, parentComponent);
|
|
3852
|
+
else j--;
|
|
3853
|
+
}
|
|
3616
3854
|
}
|
|
3617
3855
|
}
|
|
3618
3856
|
};
|
|
3619
3857
|
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
3620
3858
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
3621
3859
|
if (isVaporComponent(type) || type === VaporSlot) {
|
|
3622
|
-
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
|
|
3860
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
|
|
3623
3861
|
return;
|
|
3624
3862
|
}
|
|
3625
3863
|
if (shapeFlag & 6) {
|
|
@@ -3644,49 +3882,37 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3644
3882
|
moveStaticNode(vnode, container, anchor);
|
|
3645
3883
|
return;
|
|
3646
3884
|
}
|
|
3647
|
-
if (moveType !== 2 && shapeFlag & 1 && transition)
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
const remove = () => {
|
|
3885
|
+
if (moveType !== 2 && shapeFlag & 1 && transition) {
|
|
3886
|
+
if (moveType === 0) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense, true);
|
|
3887
|
+
else performTransitionLeave(el, transition, () => {
|
|
3651
3888
|
if (vnode.ctx.isUnmounted) hostRemove(el);
|
|
3652
3889
|
else hostInsert(el, container, anchor);
|
|
3653
|
-
};
|
|
3654
|
-
|
|
3655
|
-
if (el._isLeaving) el[leaveCbKey](true);
|
|
3656
|
-
leave(el, () => {
|
|
3657
|
-
remove();
|
|
3658
|
-
afterLeave && afterLeave();
|
|
3659
|
-
});
|
|
3660
|
-
};
|
|
3661
|
-
if (delayLeave) delayLeave(el, remove, performLeave);
|
|
3662
|
-
else performLeave();
|
|
3663
|
-
}
|
|
3664
|
-
else hostInsert(el, container, anchor);
|
|
3890
|
+
}, true, true);
|
|
3891
|
+
} else hostInsert(el, container, anchor);
|
|
3665
3892
|
};
|
|
3666
3893
|
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
|
3667
3894
|
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
|
|
3668
|
-
if (patchFlag === -2) optimized = false;
|
|
3895
|
+
if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) optimized = false;
|
|
3669
3896
|
if (ref != null) {
|
|
3670
3897
|
const prevSub = (0, _vue_reactivity.setActiveSub)();
|
|
3671
3898
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
3672
3899
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
3673
3900
|
}
|
|
3674
|
-
if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
|
|
3901
|
+
if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
|
|
3675
3902
|
if (shapeFlag & 256) {
|
|
3676
|
-
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
|
|
3903
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
|
|
3677
3904
|
else parentComponent.ctx.deactivate(vnode);
|
|
3678
3905
|
return;
|
|
3679
3906
|
}
|
|
3907
|
+
if (shapeFlag & 6 && isVaporComponent(type)) {
|
|
3908
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
3909
|
+
return;
|
|
3910
|
+
}
|
|
3680
3911
|
const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
|
3681
3912
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
3682
3913
|
let vnodeHook;
|
|
3683
3914
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
3684
|
-
if (shapeFlag & 6)
|
|
3685
|
-
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
3686
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
3687
|
-
if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
|
|
3688
|
-
return;
|
|
3689
|
-
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
3915
|
+
if (shapeFlag & 6) unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
3690
3916
|
else {
|
|
3691
3917
|
if (shapeFlag & 128) {
|
|
3692
3918
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -3697,7 +3923,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3697
3923
|
else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
3698
3924
|
else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
|
|
3699
3925
|
if (type === VaporSlot) {
|
|
3700
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
3926
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
3701
3927
|
return;
|
|
3702
3928
|
}
|
|
3703
3929
|
if (doRemove) remove(vnode);
|
|
@@ -3717,6 +3943,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3717
3943
|
}
|
|
3718
3944
|
if (type === Static) {
|
|
3719
3945
|
removeStaticNode(vnode);
|
|
3946
|
+
if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
|
|
3720
3947
|
return;
|
|
3721
3948
|
}
|
|
3722
3949
|
if (transition) performTransitionLeave(el, transition, () => hostRemove(el), !!(vnode.shapeFlag & 1));
|
|
@@ -3740,6 +3967,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3740
3967
|
if (effect) {
|
|
3741
3968
|
effect.stop();
|
|
3742
3969
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
3970
|
+
} else if (instance.vnode.el && subTree) {
|
|
3971
|
+
subTree.transition = instance.vnode.transition;
|
|
3972
|
+
unmount(subTree, instance, parentSuspense, doRemove);
|
|
3743
3973
|
}
|
|
3744
3974
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
3745
3975
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
@@ -3808,12 +4038,14 @@ function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
|
3808
4038
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
3809
4039
|
}
|
|
3810
4040
|
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
3811
|
-
if (!vapor)
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
4041
|
+
if (!vapor) {
|
|
4042
|
+
if (allowed) {
|
|
4043
|
+
effect.flags |= 128;
|
|
4044
|
+
job.flags |= 2;
|
|
4045
|
+
} else {
|
|
4046
|
+
effect.flags &= -129;
|
|
4047
|
+
job.flags &= -3;
|
|
4048
|
+
}
|
|
3817
4049
|
}
|
|
3818
4050
|
}
|
|
3819
4051
|
function needTransition(parentSuspense, transition) {
|
|
@@ -3852,13 +4084,19 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
3852
4084
|
}
|
|
3853
4085
|
function locateNonHydratedAsyncRoot(instance) {
|
|
3854
4086
|
const subComponent = instance.subTree && instance.subTree.component;
|
|
3855
|
-
if (subComponent)
|
|
3856
|
-
|
|
4087
|
+
if (subComponent) {
|
|
4088
|
+
if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
|
|
4089
|
+
else return locateNonHydratedAsyncRoot(subComponent);
|
|
4090
|
+
}
|
|
3857
4091
|
}
|
|
3858
4092
|
function invalidateMount(hooks) {
|
|
3859
4093
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
3860
4094
|
}
|
|
3861
4095
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
4096
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
4097
|
+
insert();
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
3862
4100
|
if (force || needTransition(parentSuspense, transition)) {
|
|
3863
4101
|
transition.beforeEnter(el);
|
|
3864
4102
|
insert();
|
|
@@ -3868,13 +4106,15 @@ function performTransitionEnter(el, transition, insert, parentSuspense, force =
|
|
|
3868
4106
|
function performTransitionLeave(el, transition, remove, isElement = true, force = false) {
|
|
3869
4107
|
const performRemove = () => {
|
|
3870
4108
|
remove();
|
|
3871
|
-
if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
|
|
4109
|
+
if (transition && (force || !transition.persisted) && transition.afterLeave) transition.afterLeave();
|
|
3872
4110
|
};
|
|
3873
4111
|
if (force || isElement && transition && !transition.persisted) {
|
|
3874
4112
|
const { leave, delayLeave } = transition;
|
|
3875
4113
|
const performLeave = () => {
|
|
4114
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
3876
4115
|
if (el._isLeaving && force) el[leaveCbKey](true);
|
|
3877
|
-
|
|
4116
|
+
if (force && transition.persisted && !wasLeaving) remove();
|
|
4117
|
+
else leave(el, performRemove);
|
|
3878
4118
|
};
|
|
3879
4119
|
if (delayLeave) delayLeave(el, performRemove, performLeave);
|
|
3880
4120
|
else performLeave();
|
|
@@ -3890,7 +4130,7 @@ function isVaporComponent(type) {
|
|
|
3890
4130
|
/**
|
|
3891
4131
|
* shared between vdom and vapor
|
|
3892
4132
|
*/
|
|
3893
|
-
function getInheritedScopeIds(vnode, parentComponent) {
|
|
4133
|
+
function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true) {
|
|
3894
4134
|
const inheritedScopeIds = [];
|
|
3895
4135
|
let currentParent = parentComponent;
|
|
3896
4136
|
let currentVNode = vnode;
|
|
@@ -3905,6 +4145,8 @@ function getInheritedScopeIds(vnode, parentComponent) {
|
|
|
3905
4145
|
currentParent = currentParent.parent;
|
|
3906
4146
|
} else break;
|
|
3907
4147
|
}
|
|
4148
|
+
const vaporScopeIds = includeVaporRootIds && currentVNode.vaporScopeIds;
|
|
4149
|
+
if (vaporScopeIds) inheritedScopeIds.push(...vaporScopeIds);
|
|
3908
4150
|
return inheritedScopeIds;
|
|
3909
4151
|
}
|
|
3910
4152
|
function resolveAsyncComponentPlaceholder(anchorVnode) {
|
|
@@ -3923,7 +4165,7 @@ const Suspense = {
|
|
|
3923
4165
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
3924
4166
|
if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
|
|
3925
4167
|
else {
|
|
3926
|
-
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
|
4168
|
+
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
|
|
3927
4169
|
n2.suspense = n1.suspense;
|
|
3928
4170
|
n2.suspense.vnode = n2;
|
|
3929
4171
|
n2.el = n1.el;
|
|
@@ -3961,10 +4203,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
|
|
|
3961
4203
|
if (pendingBranch) {
|
|
3962
4204
|
suspense.pendingBranch = newBranch;
|
|
3963
4205
|
if (isSameVNodeType(pendingBranch, newBranch)) {
|
|
3964
|
-
|
|
4206
|
+
suspense.deps++;
|
|
4207
|
+
patch(pendingBranch, newBranch, isHydrating ? container : suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
|
|
4208
|
+
suspense.deps--;
|
|
3965
4209
|
if (suspense.deps <= 0) suspense.resolve();
|
|
3966
4210
|
else if (isInFallback) {
|
|
3967
|
-
if (!isHydrating) {
|
|
4211
|
+
if (!isHydrating && !suspense.isFallbackMountPending) {
|
|
3968
4212
|
patch(activeBranch, newFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
3969
4213
|
setActiveBranch(suspense, newFallback);
|
|
3970
4214
|
}
|
|
@@ -3976,12 +4220,16 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
|
|
|
3976
4220
|
suspense.activeBranch = pendingBranch;
|
|
3977
4221
|
} else unmount(pendingBranch, parentComponent, suspense);
|
|
3978
4222
|
suspense.deps = 0;
|
|
4223
|
+
for (let i = 0; i < suspense.effects.length; i++) {
|
|
4224
|
+
const effect = suspense.effects[i];
|
|
4225
|
+
if (effect.flags & 8) queuePostFlushCb(effect);
|
|
4226
|
+
}
|
|
3979
4227
|
suspense.effects.length = 0;
|
|
3980
4228
|
suspense.hiddenContainer = createElement("div");
|
|
3981
4229
|
if (isInFallback) {
|
|
3982
4230
|
patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
|
|
3983
4231
|
if (suspense.deps <= 0) suspense.resolve();
|
|
3984
|
-
else {
|
|
4232
|
+
else if (!suspense.isFallbackMountPending) {
|
|
3985
4233
|
patch(activeBranch, newFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
3986
4234
|
setActiveBranch(suspense, newFallback);
|
|
3987
4235
|
}
|
|
@@ -4048,15 +4296,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4048
4296
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
4049
4297
|
else if (!resume) {
|
|
4050
4298
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
4299
|
+
let hasUpdatedAnchor = false;
|
|
4051
4300
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
4052
4301
|
if (pendingId === suspense.pendingId) {
|
|
4053
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
4302
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
4054
4303
|
queuePostFlushCb(effects);
|
|
4055
4304
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
4056
4305
|
}
|
|
4057
4306
|
};
|
|
4058
4307
|
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
4059
|
-
if (parentNode(activeBranch.el) === container)
|
|
4308
|
+
if (parentNode(activeBranch.el) === container) {
|
|
4309
|
+
anchor = next(activeBranch);
|
|
4310
|
+
hasUpdatedAnchor = true;
|
|
4311
|
+
}
|
|
4060
4312
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
4061
4313
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
4062
4314
|
}
|
|
@@ -4070,7 +4322,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4070
4322
|
let hasUnresolvedAncestor = false;
|
|
4071
4323
|
while (parent) {
|
|
4072
4324
|
if (parent.pendingBranch) {
|
|
4073
|
-
parent.effects.push(
|
|
4325
|
+
for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
|
|
4074
4326
|
hasUnresolvedAncestor = true;
|
|
4075
4327
|
break;
|
|
4076
4328
|
}
|
|
@@ -4080,6 +4332,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4080
4332
|
suspense.effects = [];
|
|
4081
4333
|
if (isSuspensible) {
|
|
4082
4334
|
if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
|
4335
|
+
parentSuspenseId = void 0;
|
|
4083
4336
|
parentSuspense.deps--;
|
|
4084
4337
|
if (parentSuspense.deps === 0 && !sync) parentSuspense.resolve();
|
|
4085
4338
|
}
|
|
@@ -4094,8 +4347,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4094
4347
|
const mountFallback = () => {
|
|
4095
4348
|
suspense.isFallbackMountPending = false;
|
|
4096
4349
|
if (!suspense.isInFallback) return;
|
|
4097
|
-
|
|
4098
|
-
|
|
4350
|
+
const latestFallback = suspense.vnode.ssFallback;
|
|
4351
|
+
patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
4352
|
+
setActiveBranch(suspense, latestFallback);
|
|
4099
4353
|
};
|
|
4100
4354
|
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
4101
4355
|
if (delayEnter) {
|
|
@@ -4116,10 +4370,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4116
4370
|
registerDep(instance, onResolve) {
|
|
4117
4371
|
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
4118
4372
|
if (isInPendingSuspense) suspense.deps++;
|
|
4373
|
+
const hydratedEl = instance.vnode && instance.vnode.el;
|
|
4119
4374
|
instance.asyncDep.catch((err) => {
|
|
4120
4375
|
handleError(err, instance, 0);
|
|
4121
4376
|
}).then((asyncSetupResult) => {
|
|
4122
4377
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
4378
|
+
setCurrentInstance(null, void 0);
|
|
4379
|
+
if (hydratedEl && !instance.scope.active) {
|
|
4380
|
+
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
4381
|
+
return;
|
|
4382
|
+
}
|
|
4123
4383
|
instance.asyncResolved = true;
|
|
4124
4384
|
onResolve(asyncSetupResult);
|
|
4125
4385
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -4166,9 +4426,10 @@ function normalizeSuspenseSlot(s) {
|
|
|
4166
4426
|
return s;
|
|
4167
4427
|
}
|
|
4168
4428
|
function queueEffectWithSuspense(fn, id, suspense) {
|
|
4169
|
-
if (suspense && suspense.pendingBranch)
|
|
4170
|
-
|
|
4171
|
-
|
|
4429
|
+
if (suspense && suspense.pendingBranch) {
|
|
4430
|
+
if ((0, _vue_shared.isArray)(fn)) suspense.effects.push(...fn);
|
|
4431
|
+
else suspense.effects.push(fn);
|
|
4432
|
+
} else queuePostFlushCb(fn, id);
|
|
4172
4433
|
}
|
|
4173
4434
|
function setActiveBranch(suspense, branch) {
|
|
4174
4435
|
suspense.activeBranch = branch;
|
|
@@ -4329,8 +4590,10 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
4329
4590
|
if (isVNode(type)) {
|
|
4330
4591
|
const cloned = cloneVNode(type, props, true);
|
|
4331
4592
|
if (children) normalizeChildren(cloned, children);
|
|
4332
|
-
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock)
|
|
4333
|
-
|
|
4593
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
4594
|
+
if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
4595
|
+
else currentBlock.push(cloned);
|
|
4596
|
+
}
|
|
4334
4597
|
cloned.patchFlag = -2;
|
|
4335
4598
|
return cloned;
|
|
4336
4599
|
}
|
|
@@ -4383,11 +4646,31 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
4383
4646
|
el: vnode.el,
|
|
4384
4647
|
anchor: vnode.anchor,
|
|
4385
4648
|
ctx: vnode.ctx,
|
|
4386
|
-
ce: vnode.ce
|
|
4649
|
+
ce: vnode.ce,
|
|
4650
|
+
vi: vnode.vi,
|
|
4651
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
4652
|
+
vb: vnode.vb,
|
|
4653
|
+
ibu: vnode.ibu,
|
|
4654
|
+
iu: vnode.iu,
|
|
4655
|
+
cacheIndex: vnode.cacheIndex
|
|
4387
4656
|
};
|
|
4388
4657
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
4389
4658
|
return cloned;
|
|
4390
4659
|
}
|
|
4660
|
+
function cloneVaporSlotMeta(vnode) {
|
|
4661
|
+
const vaporSlot = vnode.vs;
|
|
4662
|
+
if (!vaporSlot) return vaporSlot;
|
|
4663
|
+
const cloned = {
|
|
4664
|
+
slot: vaporSlot.slot,
|
|
4665
|
+
outlets: vaporSlot.outlets
|
|
4666
|
+
};
|
|
4667
|
+
if (vnode.el) {
|
|
4668
|
+
cloned.state = vaporSlot.state;
|
|
4669
|
+
cloned.ref = vaporSlot.ref;
|
|
4670
|
+
cloned.scope = vaporSlot.scope;
|
|
4671
|
+
}
|
|
4672
|
+
return cloned;
|
|
4673
|
+
}
|
|
4391
4674
|
/**
|
|
4392
4675
|
* @private
|
|
4393
4676
|
*/
|
|
@@ -4422,25 +4705,32 @@ function normalizeChildren(vnode, children) {
|
|
|
4422
4705
|
const { shapeFlag } = vnode;
|
|
4423
4706
|
if (children == null) children = null;
|
|
4424
4707
|
else if ((0, _vue_shared.isArray)(children)) type = 16;
|
|
4425
|
-
else if (typeof children === "object")
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4708
|
+
else if (typeof children === "object") {
|
|
4709
|
+
if (shapeFlag & 65) {
|
|
4710
|
+
const slot = children.default;
|
|
4711
|
+
if (slot) {
|
|
4712
|
+
slot._c && (slot._d = false);
|
|
4713
|
+
normalizeChildren(vnode, slot());
|
|
4714
|
+
slot._c && (slot._d = true);
|
|
4715
|
+
}
|
|
4716
|
+
return;
|
|
4717
|
+
} else {
|
|
4718
|
+
type = 32;
|
|
4719
|
+
const slotFlag = children._;
|
|
4720
|
+
if (!slotFlag && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
4721
|
+
else if (slotFlag === 3 && currentRenderingInstance) {
|
|
4722
|
+
if (currentRenderingInstance.slots._ === 1) children._ = 1;
|
|
4723
|
+
else {
|
|
4724
|
+
children._ = 2;
|
|
4725
|
+
vnode.patchFlag |= 1024;
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4431
4728
|
}
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
if (!slotFlag && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
4437
|
-
else if (slotFlag === 3 && currentRenderingInstance) if (currentRenderingInstance.slots._ === 1) children._ = 1;
|
|
4438
|
-
else {
|
|
4439
|
-
children._ = 2;
|
|
4440
|
-
vnode.patchFlag |= 1024;
|
|
4729
|
+
} else if ((0, _vue_shared.isFunction)(children)) {
|
|
4730
|
+
if (shapeFlag & 65) {
|
|
4731
|
+
normalizeChildren(vnode, { default: children });
|
|
4732
|
+
return;
|
|
4441
4733
|
}
|
|
4442
|
-
}
|
|
4443
|
-
else if ((0, _vue_shared.isFunction)(children)) {
|
|
4444
4734
|
children = {
|
|
4445
4735
|
default: children,
|
|
4446
4736
|
_ctx: currentRenderingInstance
|
|
@@ -4513,6 +4803,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
|
|
|
4513
4803
|
simpleSetCurrentInstance(instance);
|
|
4514
4804
|
}
|
|
4515
4805
|
};
|
|
4806
|
+
/**
|
|
4807
|
+
* Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
|
|
4808
|
+
* `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
|
|
4809
|
+
* verbatim instead of re-triggering the `instance.scope` default.
|
|
4810
|
+
* @internal
|
|
4811
|
+
*/
|
|
4812
|
+
const restoreCurrentInstance = (prev) => {
|
|
4813
|
+
(0, _vue_reactivity.setCurrentScope)(prev[1]);
|
|
4814
|
+
simpleSetCurrentInstance(prev[0]);
|
|
4815
|
+
};
|
|
4516
4816
|
const internalOptions = [
|
|
4517
4817
|
"ce",
|
|
4518
4818
|
"type",
|
|
@@ -4538,7 +4838,7 @@ const useInstanceOption = (key, silent = false) => {
|
|
|
4538
4838
|
};
|
|
4539
4839
|
//#endregion
|
|
4540
4840
|
//#region packages/runtime-core/src/component.ts
|
|
4541
|
-
const emptyAppContext =
|
|
4841
|
+
const emptyAppContext = /*@__PURE__*/ createAppContext();
|
|
4542
4842
|
let uid = 0;
|
|
4543
4843
|
function createComponentInstance(vnode, parent, suspense) {
|
|
4544
4844
|
const type = vnode.type;
|
|
@@ -4641,7 +4941,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
4641
4941
|
const setupResult = callWithErrorHandling(setup, instance, 0, [instance.props, setupContext]);
|
|
4642
4942
|
const isAsyncSetup = (0, _vue_shared.isPromise)(setupResult);
|
|
4643
4943
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
4644
|
-
|
|
4944
|
+
restoreCurrentInstance(prev);
|
|
4645
4945
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
|
|
4646
4946
|
if (isAsyncSetup) {
|
|
4647
4947
|
const unsetCurrentInstance = () => {
|
|
@@ -4649,7 +4949,12 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
4649
4949
|
};
|
|
4650
4950
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
4651
4951
|
if (isSSR) return setupResult.then((resolvedResult) => {
|
|
4652
|
-
|
|
4952
|
+
setInSSRSetupState(true);
|
|
4953
|
+
try {
|
|
4954
|
+
handleSetupResult(instance, resolvedResult, isSSR);
|
|
4955
|
+
} finally {
|
|
4956
|
+
setInSSRSetupState(false);
|
|
4957
|
+
}
|
|
4653
4958
|
}).catch((e) => {
|
|
4654
4959
|
handleError(e, instance, 0);
|
|
4655
4960
|
});
|
|
@@ -4658,9 +4963,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
4658
4963
|
} else finishComponentSetup(instance, isSSR);
|
|
4659
4964
|
}
|
|
4660
4965
|
function handleSetupResult(instance, setupResult, isSSR) {
|
|
4661
|
-
if ((0, _vue_shared.isFunction)(setupResult))
|
|
4662
|
-
|
|
4663
|
-
|
|
4966
|
+
if ((0, _vue_shared.isFunction)(setupResult)) {
|
|
4967
|
+
if (instance.type.__ssrInlineRender) instance.ssrRender = setupResult;
|
|
4968
|
+
else instance.render = setupResult;
|
|
4969
|
+
} else if ((0, _vue_shared.isObject)(setupResult)) instance.setupState = (0, _vue_reactivity.proxyRefs)(setupResult);
|
|
4664
4970
|
finishComponentSetup(instance, isSSR);
|
|
4665
4971
|
}
|
|
4666
4972
|
let compile;
|
|
@@ -4701,7 +5007,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
4701
5007
|
applyOptions(instance);
|
|
4702
5008
|
} finally {
|
|
4703
5009
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
4704
|
-
|
|
5010
|
+
restoreCurrentInstance(prevInstance);
|
|
4705
5011
|
}
|
|
4706
5012
|
}
|
|
4707
5013
|
}
|
|
@@ -4727,14 +5033,13 @@ function getComponentPublicInstance(instance) {
|
|
|
4727
5033
|
if (instance.exposed) return instance.exposeProxy || (instance.exposeProxy = new Proxy((0, _vue_reactivity.proxyRefs)((0, _vue_reactivity.markRaw)(instance.exposed)), {
|
|
4728
5034
|
get(target, key) {
|
|
4729
5035
|
if (key in target) return target[key];
|
|
4730
|
-
else {
|
|
5036
|
+
else if (!instance.vapor) {
|
|
4731
5037
|
const publicPropertiesMap = getPublicPropertiesMap();
|
|
4732
5038
|
if (key in publicPropertiesMap) return publicPropertiesMap[key](instance);
|
|
4733
5039
|
}
|
|
4734
5040
|
},
|
|
4735
5041
|
has(target, key) {
|
|
4736
|
-
|
|
4737
|
-
return key in target || key in publicPropertiesMap;
|
|
5042
|
+
return key in target || !instance.vapor && key in getPublicPropertiesMap();
|
|
4738
5043
|
}
|
|
4739
5044
|
}));
|
|
4740
5045
|
else return instance.proxy;
|
|
@@ -4756,11 +5061,12 @@ function h(type, propsOrChildren, children) {
|
|
|
4756
5061
|
try {
|
|
4757
5062
|
setBlockTracking(-1);
|
|
4758
5063
|
const l = arguments.length;
|
|
4759
|
-
if (l === 2)
|
|
4760
|
-
if (
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
5064
|
+
if (l === 2) {
|
|
5065
|
+
if ((0, _vue_shared.isObject)(propsOrChildren) && !(0, _vue_shared.isArray)(propsOrChildren)) {
|
|
5066
|
+
if (isVNode(propsOrChildren)) return createVNode(type, null, [propsOrChildren]);
|
|
5067
|
+
return createVNode(type, propsOrChildren);
|
|
5068
|
+
} else return createVNode(type, null, propsOrChildren);
|
|
5069
|
+
} else {
|
|
4764
5070
|
if (l > 3) children = Array.prototype.slice.call(arguments, 2);
|
|
4765
5071
|
else if (l === 3 && isVNode(children)) children = [children];
|
|
4766
5072
|
return createVNode(type, propsOrChildren, children);
|
|
@@ -4771,15 +5077,7 @@ function h(type, propsOrChildren, children) {
|
|
|
4771
5077
|
}
|
|
4772
5078
|
//#endregion
|
|
4773
5079
|
//#region packages/runtime-core/src/customFormatter.ts
|
|
4774
|
-
function initCustomFormatter() {
|
|
4775
|
-
return;
|
|
4776
|
-
function isKeyOfType(Comp, key, type) {
|
|
4777
|
-
const opts = Comp[type];
|
|
4778
|
-
if ((0, _vue_shared.isArray)(opts) && opts.includes(key) || (0, _vue_shared.isObject)(opts) && key in opts) return true;
|
|
4779
|
-
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) return true;
|
|
4780
|
-
if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) return true;
|
|
4781
|
-
}
|
|
4782
|
-
}
|
|
5080
|
+
function initCustomFormatter() {}
|
|
4783
5081
|
//#endregion
|
|
4784
5082
|
//#region packages/runtime-core/src/helpers/withMemo.ts
|
|
4785
5083
|
function withMemo(memo, render, cache, index) {
|
|
@@ -4799,7 +5097,7 @@ function isMemoSame(cached, memo) {
|
|
|
4799
5097
|
}
|
|
4800
5098
|
//#endregion
|
|
4801
5099
|
//#region packages/runtime-core/src/index.ts
|
|
4802
|
-
const version = "3.6.0-
|
|
5100
|
+
const version = "3.6.0-rc.10";
|
|
4803
5101
|
const warn = _vue_shared.NOOP;
|
|
4804
5102
|
/**
|
|
4805
5103
|
* Runtime error messages. Only exposed in dev or esm builds.
|
|
@@ -4822,7 +5120,10 @@ const ssrUtils = {
|
|
|
4822
5120
|
getComponentPublicInstance,
|
|
4823
5121
|
ensureValidVNode,
|
|
4824
5122
|
pushWarningContext,
|
|
4825
|
-
popWarningContext
|
|
5123
|
+
popWarningContext,
|
|
5124
|
+
VaporSlot,
|
|
5125
|
+
rawVaporSlotKey,
|
|
5126
|
+
invokeSlotFallback
|
|
4826
5127
|
};
|
|
4827
5128
|
/**
|
|
4828
5129
|
* @internal only exposed in compat builds
|