@cabloy/vue-runtime-core 3.5.30 → 3.5.32
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 +1398 -1399
- package/dist/runtime-core.cjs.prod.js +1171 -1172
- package/dist/runtime-core.esm-bundler.js +1413 -1414
- package/package.json +1 -1
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -1470,1508 +1470,1507 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
1470
1470
|
return ret;
|
|
1471
1471
|
}
|
|
1472
1472
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1494
|
-
function markAsyncBoundary(instance) {
|
|
1495
|
-
instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
1499
|
-
function useTemplateRef(key) {
|
|
1500
|
-
const i = getCurrentInstance();
|
|
1501
|
-
const r = reactivity.shallowRef(null);
|
|
1502
|
-
if (i) {
|
|
1503
|
-
const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
1504
|
-
let desc;
|
|
1505
|
-
if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
|
|
1506
|
-
warn$1(`useTemplateRef('${key}') already exists.`);
|
|
1507
|
-
} else {
|
|
1508
|
-
Object.defineProperty(refs, key, {
|
|
1509
|
-
enumerable: true,
|
|
1510
|
-
get: () => r.value,
|
|
1511
|
-
set: (val) => r.value = val
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
} else {
|
|
1515
|
-
warn$1(
|
|
1516
|
-
`useTemplateRef() is called when there is no active component instance to be associated with.`
|
|
1517
|
-
);
|
|
1518
|
-
}
|
|
1519
|
-
const ret = reactivity.readonly(r) ;
|
|
1520
|
-
{
|
|
1521
|
-
knownTemplateRefs.add(ret);
|
|
1522
|
-
}
|
|
1523
|
-
return ret;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
1527
|
-
if (shared.isArray(rawRef)) {
|
|
1528
|
-
rawRef.forEach(
|
|
1529
|
-
(r, i) => setRef(
|
|
1530
|
-
r,
|
|
1531
|
-
oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
|
1532
|
-
parentSuspense,
|
|
1533
|
-
vnode,
|
|
1534
|
-
isUnmount
|
|
1535
|
-
)
|
|
1536
|
-
);
|
|
1537
|
-
return;
|
|
1538
|
-
}
|
|
1539
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
1540
|
-
if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
|
|
1541
|
-
setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
|
|
1473
|
+
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
1474
|
+
const KeepAliveImpl = {
|
|
1475
|
+
name: `KeepAlive`,
|
|
1476
|
+
// Marker for special handling inside the renderer. We are not using a ===
|
|
1477
|
+
// check directly on KeepAlive in the renderer, because importing it directly
|
|
1478
|
+
// would prevent it from being tree-shaken.
|
|
1479
|
+
__isKeepAlive: true,
|
|
1480
|
+
props: {
|
|
1481
|
+
include: [String, RegExp, Array],
|
|
1482
|
+
exclude: [String, RegExp, Array],
|
|
1483
|
+
max: [String, Number]
|
|
1484
|
+
},
|
|
1485
|
+
setup(props, { slots }) {
|
|
1486
|
+
const instance = getCurrentInstance();
|
|
1487
|
+
const sharedContext = instance.ctx;
|
|
1488
|
+
if (!sharedContext.renderer) {
|
|
1489
|
+
return () => {
|
|
1490
|
+
const children = slots.default && slots.default();
|
|
1491
|
+
return children && children.length === 1 ? children[0] : children;
|
|
1492
|
+
};
|
|
1542
1493
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
const value = isUnmount ? null : refValue;
|
|
1547
|
-
const { i: owner, r: ref } = rawRef;
|
|
1548
|
-
if (!owner) {
|
|
1549
|
-
warn$1(
|
|
1550
|
-
`Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
|
|
1551
|
-
);
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
1555
|
-
const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
|
1556
|
-
const setupState = owner.setupState;
|
|
1557
|
-
const rawSetupState = reactivity.toRaw(setupState);
|
|
1558
|
-
const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
|
|
1494
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1495
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1496
|
+
let current = null;
|
|
1559
1497
|
{
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1498
|
+
instance.__v_cache = cache;
|
|
1499
|
+
}
|
|
1500
|
+
const parentSuspense = instance.suspense;
|
|
1501
|
+
const {
|
|
1502
|
+
renderer: {
|
|
1503
|
+
p: patch,
|
|
1504
|
+
m: move,
|
|
1505
|
+
um: _unmount,
|
|
1506
|
+
o: { createElement }
|
|
1564
1507
|
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1508
|
+
} = sharedContext;
|
|
1509
|
+
const storageContainer = createElement("div");
|
|
1510
|
+
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
1511
|
+
const instance2 = vnode.component;
|
|
1512
|
+
move(vnode, container, anchor, 0, parentSuspense);
|
|
1513
|
+
patch(
|
|
1514
|
+
instance2.vnode,
|
|
1515
|
+
vnode,
|
|
1516
|
+
container,
|
|
1517
|
+
anchor,
|
|
1518
|
+
instance2,
|
|
1519
|
+
parentSuspense,
|
|
1520
|
+
namespace,
|
|
1521
|
+
vnode.slotScopeIds,
|
|
1522
|
+
optimized
|
|
1523
|
+
);
|
|
1524
|
+
queuePostRenderEffect(() => {
|
|
1525
|
+
instance2.isDeactivated = false;
|
|
1526
|
+
if (instance2.a) {
|
|
1527
|
+
shared.invokeArrayFns(instance2.a);
|
|
1528
|
+
}
|
|
1529
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
1530
|
+
if (vnodeHook) {
|
|
1531
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
1532
|
+
}
|
|
1533
|
+
}, parentSuspense);
|
|
1534
|
+
{
|
|
1535
|
+
devtoolsComponentAdded(instance2);
|
|
1567
1536
|
}
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1537
|
+
};
|
|
1538
|
+
sharedContext.deactivate = (vnode) => {
|
|
1539
|
+
const instance2 = vnode.component;
|
|
1540
|
+
invalidateMount(instance2.m);
|
|
1541
|
+
invalidateMount(instance2.a);
|
|
1542
|
+
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
1543
|
+
queuePostRenderEffect(() => {
|
|
1544
|
+
if (instance2.da) {
|
|
1545
|
+
shared.invokeArrayFns(instance2.da);
|
|
1546
|
+
}
|
|
1547
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
1548
|
+
if (vnodeHook) {
|
|
1549
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
1550
|
+
}
|
|
1551
|
+
instance2.isDeactivated = true;
|
|
1552
|
+
}, parentSuspense);
|
|
1553
|
+
{
|
|
1554
|
+
devtoolsComponentAdded(instance2);
|
|
1576
1555
|
}
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1556
|
+
};
|
|
1557
|
+
function unmount(vnode) {
|
|
1558
|
+
resetShapeFlag(vnode);
|
|
1559
|
+
_unmount(vnode, instance, parentSuspense, true);
|
|
1579
1560
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
const _isRef = reactivity.isRef(ref);
|
|
1586
|
-
if (_isString || _isRef) {
|
|
1587
|
-
const doSet = () => {
|
|
1588
|
-
if (rawRef.f) {
|
|
1589
|
-
const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
1590
|
-
if (isUnmount) {
|
|
1591
|
-
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
1592
|
-
} else {
|
|
1593
|
-
if (!shared.isArray(existing)) {
|
|
1594
|
-
if (_isString) {
|
|
1595
|
-
refs[ref] = [refValue];
|
|
1596
|
-
if (canSetSetupRef(ref)) {
|
|
1597
|
-
setupState[ref] = refs[ref];
|
|
1598
|
-
}
|
|
1599
|
-
} else {
|
|
1600
|
-
ref.value = [refValue];
|
|
1601
|
-
if (rawRef.k) refs[rawRef.k] = ref.value;
|
|
1602
|
-
}
|
|
1603
|
-
} else if (!existing.includes(refValue)) {
|
|
1604
|
-
existing.push(refValue);
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
} else if (_isString) {
|
|
1608
|
-
refs[ref] = value;
|
|
1609
|
-
if (canSetSetupRef(ref)) {
|
|
1610
|
-
setupState[ref] = value;
|
|
1611
|
-
}
|
|
1612
|
-
} else if (_isRef) {
|
|
1613
|
-
ref.value = value;
|
|
1614
|
-
if (rawRef.k) refs[rawRef.k] = value;
|
|
1615
|
-
} else {
|
|
1616
|
-
warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
1561
|
+
function pruneCache(filter) {
|
|
1562
|
+
cache.forEach((vnode, key) => {
|
|
1563
|
+
const name = vnode.key;
|
|
1564
|
+
if (name && !filter(name)) {
|
|
1565
|
+
pruneCacheEntry(key);
|
|
1617
1566
|
}
|
|
1618
|
-
};
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
function pruneCacheEntry(key) {
|
|
1570
|
+
const cached = cache.get(key);
|
|
1571
|
+
if (cached && (!current || !isSameVNodeType(cached, current))) {
|
|
1572
|
+
unmount(cached);
|
|
1573
|
+
} else if (current) {
|
|
1574
|
+
resetShapeFlag(current);
|
|
1624
1575
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1576
|
+
cache.delete(key);
|
|
1577
|
+
keys.delete(key);
|
|
1627
1578
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
console.error("Hydration completed but contains mismatches.");
|
|
1637
|
-
hasLoggedMismatchError = true;
|
|
1638
|
-
};
|
|
1639
|
-
const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
|
1640
|
-
const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
|
1641
|
-
const getContainerType = (container) => {
|
|
1642
|
-
if (container.nodeType !== 1) return void 0;
|
|
1643
|
-
if (isSVGContainer(container)) return "svg";
|
|
1644
|
-
if (isMathMLContainer(container)) return "mathml";
|
|
1645
|
-
return void 0;
|
|
1646
|
-
};
|
|
1647
|
-
const isComment = (node) => node.nodeType === 8;
|
|
1648
|
-
function createHydrationFunctions(rendererInternals) {
|
|
1649
|
-
const {
|
|
1650
|
-
mt: mountComponent,
|
|
1651
|
-
p: patch,
|
|
1652
|
-
o: {
|
|
1653
|
-
patchProp,
|
|
1654
|
-
createText,
|
|
1655
|
-
nextSibling,
|
|
1656
|
-
parentNode,
|
|
1657
|
-
remove,
|
|
1658
|
-
insert,
|
|
1659
|
-
createComment
|
|
1660
|
-
}
|
|
1661
|
-
} = rendererInternals;
|
|
1662
|
-
const hydrate = (vnode, container) => {
|
|
1663
|
-
if (!container.hasChildNodes()) {
|
|
1664
|
-
warn$1(
|
|
1665
|
-
`Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
|
|
1666
|
-
);
|
|
1667
|
-
patch(null, vnode, container);
|
|
1668
|
-
flushPostFlushCbs();
|
|
1669
|
-
container._vnode = vnode;
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
hydrateNode(container.firstChild, vnode, null, null, null);
|
|
1673
|
-
flushPostFlushCbs();
|
|
1674
|
-
container._vnode = vnode;
|
|
1675
|
-
};
|
|
1676
|
-
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
1677
|
-
optimized = optimized || !!vnode.dynamicChildren;
|
|
1678
|
-
const isFragmentStart = isComment(node) && node.data === "[";
|
|
1679
|
-
const onMismatch = () => handleMismatch(
|
|
1680
|
-
node,
|
|
1681
|
-
vnode,
|
|
1682
|
-
parentComponent,
|
|
1683
|
-
parentSuspense,
|
|
1684
|
-
slotScopeIds,
|
|
1685
|
-
isFragmentStart
|
|
1579
|
+
watch(
|
|
1580
|
+
() => [props.include, props.exclude],
|
|
1581
|
+
([include, exclude]) => {
|
|
1582
|
+
include && pruneCache((name) => matches(include, name));
|
|
1583
|
+
exclude && pruneCache((name) => !matches(exclude, name));
|
|
1584
|
+
},
|
|
1585
|
+
// prune post-render after `current` has been updated
|
|
1586
|
+
{ flush: "post", deep: true }
|
|
1686
1587
|
);
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
if (patchFlag === -2) {
|
|
1695
|
-
optimized = false;
|
|
1696
|
-
vnode.dynamicChildren = null;
|
|
1697
|
-
}
|
|
1698
|
-
let nextNode = null;
|
|
1699
|
-
switch (type) {
|
|
1700
|
-
case Text:
|
|
1701
|
-
if (domType !== 3) {
|
|
1702
|
-
if (vnode.children === "") {
|
|
1703
|
-
insert(vnode.el = createText(""), parentNode(node), node);
|
|
1704
|
-
nextNode = node;
|
|
1705
|
-
} else {
|
|
1706
|
-
nextNode = onMismatch();
|
|
1707
|
-
}
|
|
1588
|
+
let pendingCacheKey = null;
|
|
1589
|
+
const cacheSubtree = () => {
|
|
1590
|
+
if (pendingCacheKey != null) {
|
|
1591
|
+
if (isSuspense(instance.subTree.type)) {
|
|
1592
|
+
queuePostRenderEffect(() => {
|
|
1593
|
+
cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
|
1594
|
+
}, instance.subTree.suspense);
|
|
1708
1595
|
} else {
|
|
1709
|
-
|
|
1710
|
-
node.data = vnode.children;
|
|
1711
|
-
}
|
|
1712
|
-
nextNode = nextSibling(node);
|
|
1596
|
+
cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
|
1713
1597
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
onMounted(cacheSubtree);
|
|
1601
|
+
onUpdated(cacheSubtree);
|
|
1602
|
+
onBeforeUnmount(() => {
|
|
1603
|
+
cache.forEach((cached) => {
|
|
1604
|
+
const { subTree, suspense } = instance;
|
|
1605
|
+
const vnode = getInnerChild(subTree);
|
|
1606
|
+
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
1607
|
+
resetShapeFlag(vnode);
|
|
1608
|
+
const da = vnode.component.da;
|
|
1609
|
+
da && queuePostRenderEffect(da, suspense);
|
|
1610
|
+
return;
|
|
1727
1611
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1612
|
+
unmount(cached);
|
|
1613
|
+
});
|
|
1614
|
+
});
|
|
1615
|
+
return () => {
|
|
1616
|
+
pendingCacheKey = null;
|
|
1617
|
+
if (!slots.default) {
|
|
1618
|
+
return current = null;
|
|
1619
|
+
}
|
|
1620
|
+
const children = slots.default();
|
|
1621
|
+
const rawVNode = children[0];
|
|
1622
|
+
if (children.length > 1) {
|
|
1623
|
+
{
|
|
1624
|
+
warn$1(`KeepAlive should contain exactly one component child.`);
|
|
1733
1625
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1626
|
+
current = null;
|
|
1627
|
+
return children;
|
|
1628
|
+
} else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
|
1629
|
+
current = null;
|
|
1630
|
+
return rawVNode;
|
|
1631
|
+
}
|
|
1632
|
+
let vnode = getInnerChild(rawVNode);
|
|
1633
|
+
if (vnode.type === Comment) {
|
|
1634
|
+
current = null;
|
|
1635
|
+
return vnode;
|
|
1636
|
+
}
|
|
1637
|
+
const comp = vnode.type;
|
|
1638
|
+
const name = vnode.key;
|
|
1639
|
+
const { include, exclude, max } = props;
|
|
1640
|
+
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
|
1641
|
+
vnode.shapeFlag &= ~256;
|
|
1642
|
+
current = vnode;
|
|
1643
|
+
return rawVNode;
|
|
1644
|
+
}
|
|
1645
|
+
const key = vnode.key == null ? comp : vnode.key;
|
|
1646
|
+
const cachedVNode = cache.get(key);
|
|
1647
|
+
if (vnode.el) {
|
|
1648
|
+
vnode = cloneVNode(vnode);
|
|
1649
|
+
if (rawVNode.shapeFlag & 128) {
|
|
1650
|
+
rawVNode.ssContent = vnode;
|
|
1748
1651
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
parentComponent,
|
|
1758
|
-
parentSuspense,
|
|
1759
|
-
slotScopeIds,
|
|
1760
|
-
optimized
|
|
1761
|
-
);
|
|
1652
|
+
}
|
|
1653
|
+
pendingCacheKey = key;
|
|
1654
|
+
if (cachedVNode) {
|
|
1655
|
+
vnode.el = cachedVNode.el;
|
|
1656
|
+
vnode.component = cachedVNode.component;
|
|
1657
|
+
vnode.component.zovaHostProviders = vnode.zovaHostProviders;
|
|
1658
|
+
if (vnode.transition) {
|
|
1659
|
+
setTransitionHooks(vnode, vnode.transition);
|
|
1762
1660
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
node,
|
|
1771
|
-
vnode,
|
|
1772
|
-
parentComponent,
|
|
1773
|
-
parentSuspense,
|
|
1774
|
-
slotScopeIds,
|
|
1775
|
-
optimized
|
|
1776
|
-
);
|
|
1777
|
-
}
|
|
1778
|
-
} else if (shapeFlag & 6) {
|
|
1779
|
-
vnode.slotScopeIds = slotScopeIds;
|
|
1780
|
-
const container = parentNode(node);
|
|
1781
|
-
if (isFragmentStart) {
|
|
1782
|
-
nextNode = locateClosingAnchor(node);
|
|
1783
|
-
} else if (isComment(node) && node.data === "teleport start") {
|
|
1784
|
-
nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1785
|
-
} else {
|
|
1786
|
-
nextNode = nextSibling(node);
|
|
1787
|
-
}
|
|
1788
|
-
mountComponent(
|
|
1789
|
-
vnode,
|
|
1790
|
-
container,
|
|
1791
|
-
null,
|
|
1792
|
-
parentComponent,
|
|
1793
|
-
parentSuspense,
|
|
1794
|
-
getContainerType(container),
|
|
1795
|
-
optimized
|
|
1796
|
-
);
|
|
1797
|
-
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
|
|
1798
|
-
let subTree;
|
|
1799
|
-
if (isFragmentStart) {
|
|
1800
|
-
subTree = createVNode(Fragment);
|
|
1801
|
-
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
1802
|
-
} else {
|
|
1803
|
-
subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
1804
|
-
}
|
|
1805
|
-
subTree.el = node;
|
|
1806
|
-
vnode.component.subTree = subTree;
|
|
1807
|
-
}
|
|
1808
|
-
} else if (shapeFlag & 64) {
|
|
1809
|
-
if (domType !== 8) {
|
|
1810
|
-
nextNode = onMismatch();
|
|
1811
|
-
} else {
|
|
1812
|
-
nextNode = vnode.type.hydrate(
|
|
1813
|
-
node,
|
|
1814
|
-
vnode,
|
|
1815
|
-
parentComponent,
|
|
1816
|
-
parentSuspense,
|
|
1817
|
-
slotScopeIds,
|
|
1818
|
-
optimized,
|
|
1819
|
-
rendererInternals,
|
|
1820
|
-
hydrateChildren
|
|
1821
|
-
);
|
|
1822
|
-
}
|
|
1823
|
-
} else if (shapeFlag & 128) {
|
|
1824
|
-
nextNode = vnode.type.hydrate(
|
|
1825
|
-
node,
|
|
1826
|
-
vnode,
|
|
1827
|
-
parentComponent,
|
|
1828
|
-
parentSuspense,
|
|
1829
|
-
getContainerType(parentNode(node)),
|
|
1830
|
-
slotScopeIds,
|
|
1831
|
-
optimized,
|
|
1832
|
-
rendererInternals,
|
|
1833
|
-
hydrateNode
|
|
1834
|
-
);
|
|
1835
|
-
} else {
|
|
1836
|
-
warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
|
1661
|
+
vnode.shapeFlag |= 512;
|
|
1662
|
+
keys.delete(key);
|
|
1663
|
+
keys.add(key);
|
|
1664
|
+
} else {
|
|
1665
|
+
keys.add(key);
|
|
1666
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
1667
|
+
pruneCacheEntry(keys.values().next().value);
|
|
1837
1668
|
}
|
|
1669
|
+
}
|
|
1670
|
+
vnode.shapeFlag |= 256;
|
|
1671
|
+
current = vnode;
|
|
1672
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
const KeepAlive = KeepAliveImpl;
|
|
1677
|
+
function matches(pattern, name) {
|
|
1678
|
+
if (shared.isArray(pattern)) {
|
|
1679
|
+
return pattern.some((p) => matches(p, name));
|
|
1680
|
+
} else if (shared.isString(pattern)) {
|
|
1681
|
+
return pattern.split(",").includes(name);
|
|
1682
|
+
} else if (shared.isRegExp(pattern)) {
|
|
1683
|
+
pattern.lastIndex = 0;
|
|
1684
|
+
return pattern.test(name);
|
|
1685
|
+
}
|
|
1686
|
+
return false;
|
|
1687
|
+
}
|
|
1688
|
+
function onActivated(hook, target) {
|
|
1689
|
+
registerKeepAliveHook(hook, "a", target);
|
|
1690
|
+
}
|
|
1691
|
+
function onDeactivated(hook, target) {
|
|
1692
|
+
registerKeepAliveHook(hook, "da", target);
|
|
1693
|
+
}
|
|
1694
|
+
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
1695
|
+
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
1696
|
+
let current = target;
|
|
1697
|
+
while (current) {
|
|
1698
|
+
if (current.isDeactivated) {
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
current = current.parent;
|
|
1838
1702
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1703
|
+
return hook();
|
|
1704
|
+
});
|
|
1705
|
+
injectHook(type, wrappedHook, target);
|
|
1706
|
+
if (target) {
|
|
1707
|
+
let current = target.parent;
|
|
1708
|
+
while (current && current.parent) {
|
|
1709
|
+
if (isKeepAlive(current.parent.vnode)) {
|
|
1710
|
+
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
1711
|
+
}
|
|
1712
|
+
current = current.parent;
|
|
1841
1713
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
1717
|
+
const injected = injectHook(
|
|
1718
|
+
type,
|
|
1719
|
+
hook,
|
|
1720
|
+
keepAliveRoot,
|
|
1721
|
+
true
|
|
1722
|
+
/* prepend */
|
|
1723
|
+
);
|
|
1724
|
+
onUnmounted(() => {
|
|
1725
|
+
shared.remove(keepAliveRoot[type], injected);
|
|
1726
|
+
}, target);
|
|
1727
|
+
}
|
|
1728
|
+
function resetShapeFlag(vnode) {
|
|
1729
|
+
vnode.shapeFlag &= ~256;
|
|
1730
|
+
vnode.shapeFlag &= ~512;
|
|
1731
|
+
}
|
|
1732
|
+
function getInnerChild(vnode) {
|
|
1733
|
+
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
1737
|
+
if (target) {
|
|
1738
|
+
const hooks = target[type] || (target[type] = []);
|
|
1739
|
+
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
1740
|
+
reactivity.pauseTracking();
|
|
1741
|
+
const reset = setCurrentInstance(target);
|
|
1742
|
+
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
1743
|
+
reset();
|
|
1744
|
+
reactivity.resetTracking();
|
|
1745
|
+
return res;
|
|
1746
|
+
});
|
|
1747
|
+
if (prepend) {
|
|
1748
|
+
hooks.unshift(wrappedHook);
|
|
1749
|
+
} else {
|
|
1750
|
+
hooks.push(wrappedHook);
|
|
1848
1751
|
}
|
|
1752
|
+
return wrappedHook;
|
|
1753
|
+
} else {
|
|
1754
|
+
const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
1755
|
+
warn$1(
|
|
1756
|
+
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
1757
|
+
);
|
|
1849
1758
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1759
|
+
}
|
|
1760
|
+
const createHook = (lifecycle) => (hook, target = currentInstance) => {
|
|
1761
|
+
if (!isInSSRComponentSetup || lifecycle === "sp") {
|
|
1762
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
1763
|
+
}
|
|
1764
|
+
if (lifecycle === "m" && target && target.isMounted) {
|
|
1765
|
+
hook();
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
const onBeforeMount = createHook("bm");
|
|
1769
|
+
const onMounted = createHook("m");
|
|
1770
|
+
const onBeforeUpdate = createHook(
|
|
1771
|
+
"bu"
|
|
1772
|
+
);
|
|
1773
|
+
const onUpdated = createHook("u");
|
|
1774
|
+
const onBeforeUnmount = createHook(
|
|
1775
|
+
"bum"
|
|
1776
|
+
);
|
|
1777
|
+
const onUnmounted = createHook("um");
|
|
1778
|
+
const onServerPrefetch = createHook(
|
|
1779
|
+
"sp"
|
|
1780
|
+
);
|
|
1781
|
+
const onRenderTriggered = createHook("rtg");
|
|
1782
|
+
const onRenderTracked = createHook("rtc");
|
|
1783
|
+
function onErrorCaptured(hook, target = currentInstance) {
|
|
1784
|
+
injectHook("ec", hook, target);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
const COMPONENTS = "components";
|
|
1788
|
+
const DIRECTIVES = "directives";
|
|
1789
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
1790
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
1791
|
+
}
|
|
1792
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
1793
|
+
function resolveDynamicComponent(component) {
|
|
1794
|
+
if (shared.isString(component)) {
|
|
1795
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
1796
|
+
} else {
|
|
1797
|
+
return component || NULL_DYNAMIC_COMPONENT;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
function resolveDirective(name) {
|
|
1801
|
+
return resolveAsset(DIRECTIVES, name);
|
|
1802
|
+
}
|
|
1803
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
1804
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
1805
|
+
if (instance) {
|
|
1806
|
+
const Component = instance.type;
|
|
1807
|
+
if (type === COMPONENTS) {
|
|
1808
|
+
const selfName = getComponentName(
|
|
1809
|
+
Component,
|
|
1810
|
+
false
|
|
1811
|
+
);
|
|
1812
|
+
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
1813
|
+
return Component;
|
|
1857
1814
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1815
|
+
}
|
|
1816
|
+
const res = (
|
|
1817
|
+
// local registration
|
|
1818
|
+
// check instance[type] first which is resolved for options API
|
|
1819
|
+
resolve(instance[type] || Component[type], name) || // global registration
|
|
1820
|
+
resolve(instance.appContext[type], name)
|
|
1821
|
+
);
|
|
1822
|
+
if (!res && maybeSelfReference) {
|
|
1823
|
+
return Component;
|
|
1824
|
+
}
|
|
1825
|
+
if (warnMissing && !res) {
|
|
1826
|
+
const extra = type === COMPONENTS ? `
|
|
1827
|
+
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
|
1828
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
1829
|
+
}
|
|
1830
|
+
return res;
|
|
1831
|
+
} else {
|
|
1832
|
+
warn$1(
|
|
1833
|
+
`resolve${shared.capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
|
1834
|
+
);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
function resolve(registry, name) {
|
|
1838
|
+
return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
function renderList(source, renderItem, cache, index) {
|
|
1842
|
+
let ret;
|
|
1843
|
+
const cached = cache && cache[index];
|
|
1844
|
+
const sourceIsArray = shared.isArray(source);
|
|
1845
|
+
if (sourceIsArray || shared.isString(source)) {
|
|
1846
|
+
const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
|
|
1847
|
+
let needsWrap = false;
|
|
1848
|
+
if (sourceIsReactiveArray) {
|
|
1849
|
+
needsWrap = !reactivity.isShallow(source);
|
|
1850
|
+
source = reactivity.shallowReadArray(source);
|
|
1851
|
+
}
|
|
1852
|
+
ret = new Array(source.length);
|
|
1853
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
1854
|
+
ret[i] = renderItem(
|
|
1855
|
+
needsWrap ? reactivity.toReactive(source[i]) : source[i],
|
|
1856
|
+
i,
|
|
1857
|
+
void 0,
|
|
1858
|
+
cached && cached[i]
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
} else if (typeof source === "number") {
|
|
1862
|
+
if (!Number.isInteger(source)) {
|
|
1863
|
+
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
1864
|
+
}
|
|
1865
|
+
ret = new Array(source);
|
|
1866
|
+
for (let i = 0; i < source; i++) {
|
|
1867
|
+
ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
1868
|
+
}
|
|
1869
|
+
} else if (shared.isObject(source)) {
|
|
1870
|
+
if (source[Symbol.iterator]) {
|
|
1871
|
+
ret = Array.from(
|
|
1872
|
+
source,
|
|
1873
|
+
(item, i) => renderItem(item, i, void 0, cached && cached[i])
|
|
1874
|
+
);
|
|
1875
|
+
} else {
|
|
1876
|
+
const keys = Object.keys(source);
|
|
1877
|
+
ret = new Array(keys.length);
|
|
1878
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
1879
|
+
const key = keys[i];
|
|
1880
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
1871
1881
|
}
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
+
}
|
|
1883
|
+
} else {
|
|
1884
|
+
ret = [];
|
|
1885
|
+
}
|
|
1886
|
+
if (cache) {
|
|
1887
|
+
cache[index] = ret;
|
|
1888
|
+
}
|
|
1889
|
+
return ret;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function createSlots(slots, dynamicSlots) {
|
|
1893
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
1894
|
+
const slot = dynamicSlots[i];
|
|
1895
|
+
if (shared.isArray(slot)) {
|
|
1896
|
+
for (let j = 0; j < slot.length; j++) {
|
|
1897
|
+
slots[slot[j].name] = slot[j].fn;
|
|
1898
|
+
}
|
|
1899
|
+
} else if (slot) {
|
|
1900
|
+
slots[slot.name] = slot.key ? (...args) => {
|
|
1901
|
+
const res = slot.fn(...args);
|
|
1902
|
+
if (res) res.key = slot.key;
|
|
1903
|
+
return res;
|
|
1904
|
+
} : slot.fn;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
return slots;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
1911
|
+
// @__NO_SIDE_EFFECTS__
|
|
1912
|
+
function defineComponent(options, extraOptions) {
|
|
1913
|
+
return shared.isFunction(options) ? (
|
|
1914
|
+
// #8236: extend call and options.name access are considered side-effects
|
|
1915
|
+
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
1916
|
+
/* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
|
|
1917
|
+
) : options;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
function useId() {
|
|
1921
|
+
const i = getCurrentInstance();
|
|
1922
|
+
if (i) {
|
|
1923
|
+
return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
|
1924
|
+
} else {
|
|
1925
|
+
warn$1(
|
|
1926
|
+
`useId() is called when there is no active component instance to be associated with.`
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
return "";
|
|
1930
|
+
}
|
|
1931
|
+
function markAsyncBoundary(instance) {
|
|
1932
|
+
instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
|
|
1936
|
+
function useTemplateRef(key) {
|
|
1937
|
+
const i = getCurrentInstance();
|
|
1938
|
+
const r = reactivity.shallowRef(null);
|
|
1939
|
+
if (i) {
|
|
1940
|
+
const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
|
|
1941
|
+
let desc;
|
|
1942
|
+
if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
|
|
1943
|
+
warn$1(`useTemplateRef('${key}') already exists.`);
|
|
1944
|
+
} else {
|
|
1945
|
+
Object.defineProperty(refs, key, {
|
|
1946
|
+
enumerable: true,
|
|
1947
|
+
get: () => r.value,
|
|
1948
|
+
set: (val) => r.value = val
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
} else {
|
|
1952
|
+
warn$1(
|
|
1953
|
+
`useTemplateRef() is called when there is no active component instance to be associated with.`
|
|
1954
|
+
);
|
|
1955
|
+
}
|
|
1956
|
+
const ret = reactivity.readonly(r) ;
|
|
1957
|
+
{
|
|
1958
|
+
knownTemplateRefs.add(ret);
|
|
1959
|
+
}
|
|
1960
|
+
return ret;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
1964
|
+
if (shared.isArray(rawRef)) {
|
|
1965
|
+
rawRef.forEach(
|
|
1966
|
+
(r, i) => setRef(
|
|
1967
|
+
r,
|
|
1968
|
+
oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
|
1969
|
+
parentSuspense,
|
|
1970
|
+
vnode,
|
|
1971
|
+
isUnmount
|
|
1972
|
+
)
|
|
1973
|
+
);
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
1977
|
+
if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
|
|
1978
|
+
setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
|
|
1979
|
+
}
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
|
|
1983
|
+
const value = isUnmount ? null : refValue;
|
|
1984
|
+
const { i: owner, r: ref } = rawRef;
|
|
1985
|
+
if (!owner) {
|
|
1986
|
+
warn$1(
|
|
1987
|
+
`Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
|
|
1988
|
+
);
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
1992
|
+
const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
|
1993
|
+
const setupState = owner.setupState;
|
|
1994
|
+
const rawSetupState = reactivity.toRaw(setupState);
|
|
1995
|
+
const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
|
|
1996
|
+
{
|
|
1997
|
+
if (shared.hasOwn(rawSetupState, key) && !reactivity.isRef(rawSetupState[key])) {
|
|
1998
|
+
warn$1(
|
|
1999
|
+
`Template ref "${key}" used on a non-ref value. It will not work in the production build.`
|
|
1882
2000
|
);
|
|
1883
|
-
let hasWarned = false;
|
|
1884
|
-
while (next) {
|
|
1885
|
-
if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
|
|
1886
|
-
if (!hasWarned) {
|
|
1887
|
-
warn$1(
|
|
1888
|
-
`Hydration children mismatch on`,
|
|
1889
|
-
el,
|
|
1890
|
-
`
|
|
1891
|
-
Server rendered element contains more child nodes than client vdom.`
|
|
1892
|
-
);
|
|
1893
|
-
hasWarned = true;
|
|
1894
|
-
}
|
|
1895
|
-
logMismatchError();
|
|
1896
|
-
}
|
|
1897
|
-
const cur = next;
|
|
1898
|
-
next = next.nextSibling;
|
|
1899
|
-
remove(cur);
|
|
1900
|
-
}
|
|
1901
|
-
} else if (shapeFlag & 8) {
|
|
1902
|
-
let clientText = vnode.children;
|
|
1903
|
-
if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
|
1904
|
-
clientText = clientText.slice(1);
|
|
1905
|
-
}
|
|
1906
|
-
if (el.textContent !== clientText) {
|
|
1907
|
-
if (!isMismatchAllowed(el, 0 /* TEXT */)) {
|
|
1908
|
-
warn$1(
|
|
1909
|
-
`Hydration text content mismatch on`,
|
|
1910
|
-
el,
|
|
1911
|
-
`
|
|
1912
|
-
- rendered on server: ${el.textContent}
|
|
1913
|
-
- expected on client: ${vnode.children}`
|
|
1914
|
-
);
|
|
1915
|
-
logMismatchError();
|
|
1916
|
-
}
|
|
1917
|
-
el.textContent = vnode.children;
|
|
1918
|
-
}
|
|
1919
2001
|
}
|
|
1920
|
-
if (
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
2002
|
+
if (knownTemplateRefs.has(rawSetupState[key])) {
|
|
2003
|
+
return false;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
return shared.hasOwn(rawSetupState, key);
|
|
2007
|
+
};
|
|
2008
|
+
if (oldRef != null && oldRef !== ref) {
|
|
2009
|
+
if (shared.isString(oldRef)) {
|
|
2010
|
+
refs[oldRef] = null;
|
|
2011
|
+
if (canSetSetupRef(oldRef)) {
|
|
2012
|
+
setupState[oldRef] = null;
|
|
2013
|
+
}
|
|
2014
|
+
} else if (reactivity.isRef(oldRef)) {
|
|
2015
|
+
oldRef.value = null;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if (shared.isFunction(ref)) {
|
|
2019
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
2020
|
+
} else {
|
|
2021
|
+
const _isString = shared.isString(ref);
|
|
2022
|
+
const _isRef = reactivity.isRef(ref);
|
|
2023
|
+
if (_isString || _isRef) {
|
|
2024
|
+
const doSet = () => {
|
|
2025
|
+
if (rawRef.f) {
|
|
2026
|
+
const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2027
|
+
if (isUnmount) {
|
|
2028
|
+
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
2029
|
+
} else {
|
|
2030
|
+
if (!shared.isArray(existing)) {
|
|
2031
|
+
if (_isString) {
|
|
2032
|
+
refs[ref] = [refValue];
|
|
2033
|
+
if (canSetSetupRef(ref)) {
|
|
2034
|
+
setupState[ref] = refs[ref];
|
|
2035
|
+
}
|
|
1937
2036
|
} else {
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
}
|
|
1941
|
-
if (!ignore) {
|
|
1942
|
-
if (// #11189 skip if this node has directives that have created hooks
|
|
1943
|
-
// as it could have mutated the DOM in any possible way
|
|
1944
|
-
!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
|
|
1945
|
-
logMismatchError();
|
|
2037
|
+
ref.value = [refValue];
|
|
2038
|
+
if (rawRef.k) refs[rawRef.k] = ref.value;
|
|
1946
2039
|
}
|
|
2040
|
+
} else if (!existing.includes(refValue)) {
|
|
2041
|
+
existing.push(refValue);
|
|
1947
2042
|
}
|
|
1948
|
-
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
1949
|
-
key[0] === "." || isCustomElement) {
|
|
1950
|
-
patchProp(el, key, null, props[key], void 0, parentComponent);
|
|
1951
|
-
}
|
|
1952
2043
|
}
|
|
2044
|
+
} else if (_isString) {
|
|
2045
|
+
refs[ref] = value;
|
|
2046
|
+
if (canSetSetupRef(ref)) {
|
|
2047
|
+
setupState[ref] = value;
|
|
2048
|
+
}
|
|
2049
|
+
} else if (_isRef) {
|
|
2050
|
+
ref.value = value;
|
|
2051
|
+
if (rawRef.k) refs[rawRef.k] = value;
|
|
2052
|
+
} else {
|
|
2053
|
+
warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
1953
2054
|
}
|
|
2055
|
+
};
|
|
2056
|
+
if (value) {
|
|
2057
|
+
doSet.id = -1;
|
|
2058
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
2059
|
+
} else {
|
|
2060
|
+
doSet();
|
|
1954
2061
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
1958
|
-
}
|
|
1959
|
-
if (dirs) {
|
|
1960
|
-
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
1961
|
-
}
|
|
1962
|
-
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
1963
|
-
queueEffectWithSuspense(() => {
|
|
1964
|
-
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
1965
|
-
needCallTransitionHooks && transition.enter(el);
|
|
1966
|
-
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
1967
|
-
}, parentSuspense);
|
|
1968
|
-
}
|
|
2062
|
+
} else {
|
|
2063
|
+
warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
1969
2064
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
insert(vnode.el = createText(""), container);
|
|
2003
|
-
} else {
|
|
2004
|
-
if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
|
|
2005
|
-
if (!hasWarned) {
|
|
2006
|
-
warn$1(
|
|
2007
|
-
`Hydration children mismatch on`,
|
|
2008
|
-
container,
|
|
2009
|
-
`
|
|
2010
|
-
Server rendered element contains fewer child nodes than client vdom.`
|
|
2011
|
-
);
|
|
2012
|
-
hasWarned = true;
|
|
2013
|
-
}
|
|
2014
|
-
logMismatchError();
|
|
2015
|
-
}
|
|
2016
|
-
patch(
|
|
2017
|
-
null,
|
|
2018
|
-
vnode,
|
|
2019
|
-
container,
|
|
2020
|
-
null,
|
|
2021
|
-
parentComponent,
|
|
2022
|
-
parentSuspense,
|
|
2023
|
-
getContainerType(container),
|
|
2024
|
-
slotScopeIds
|
|
2025
|
-
);
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
return node;
|
|
2029
|
-
};
|
|
2030
|
-
const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
2031
|
-
const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
|
2032
|
-
if (fragmentSlotScopeIds) {
|
|
2033
|
-
slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
|
2034
|
-
}
|
|
2035
|
-
const container = parentNode(node);
|
|
2036
|
-
const next = hydrateChildren(
|
|
2037
|
-
nextSibling(node),
|
|
2038
|
-
vnode,
|
|
2039
|
-
container,
|
|
2040
|
-
parentComponent,
|
|
2041
|
-
parentSuspense,
|
|
2042
|
-
slotScopeIds,
|
|
2043
|
-
optimized
|
|
2044
|
-
);
|
|
2045
|
-
if (next && isComment(next) && next.data === "]") {
|
|
2046
|
-
return nextSibling(vnode.anchor = next);
|
|
2047
|
-
} else {
|
|
2048
|
-
logMismatchError();
|
|
2049
|
-
insert(vnode.anchor = createComment(`]`), container, next);
|
|
2050
|
-
return next;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
let hasLoggedMismatchError = false;
|
|
2069
|
+
const logMismatchError = () => {
|
|
2070
|
+
if (hasLoggedMismatchError) {
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
console.error("Hydration completed but contains mismatches.");
|
|
2074
|
+
hasLoggedMismatchError = true;
|
|
2075
|
+
};
|
|
2076
|
+
const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
|
2077
|
+
const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
|
2078
|
+
const getContainerType = (container) => {
|
|
2079
|
+
if (container.nodeType !== 1) return void 0;
|
|
2080
|
+
if (isSVGContainer(container)) return "svg";
|
|
2081
|
+
if (isMathMLContainer(container)) return "mathml";
|
|
2082
|
+
return void 0;
|
|
2083
|
+
};
|
|
2084
|
+
const isComment = (node) => node.nodeType === 8;
|
|
2085
|
+
function createHydrationFunctions(rendererInternals) {
|
|
2086
|
+
const {
|
|
2087
|
+
mt: mountComponent,
|
|
2088
|
+
p: patch,
|
|
2089
|
+
o: {
|
|
2090
|
+
patchProp,
|
|
2091
|
+
createText,
|
|
2092
|
+
nextSibling,
|
|
2093
|
+
parentNode,
|
|
2094
|
+
remove,
|
|
2095
|
+
insert,
|
|
2096
|
+
createComment
|
|
2051
2097
|
}
|
|
2052
|
-
};
|
|
2053
|
-
const
|
|
2054
|
-
if (!
|
|
2098
|
+
} = rendererInternals;
|
|
2099
|
+
const hydrate = (vnode, container) => {
|
|
2100
|
+
if (!container.hasChildNodes()) {
|
|
2055
2101
|
warn$1(
|
|
2056
|
-
`
|
|
2057
|
-
- rendered on server:`,
|
|
2058
|
-
node,
|
|
2059
|
-
node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
|
|
2060
|
-
`
|
|
2061
|
-
- expected on client:`,
|
|
2062
|
-
vnode.type
|
|
2102
|
+
`Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
|
|
2063
2103
|
);
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
const end = locateClosingAnchor(node);
|
|
2069
|
-
while (true) {
|
|
2070
|
-
const next2 = nextSibling(node);
|
|
2071
|
-
if (next2 && next2 !== end) {
|
|
2072
|
-
remove(next2);
|
|
2073
|
-
} else {
|
|
2074
|
-
break;
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2104
|
+
patch(null, vnode, container);
|
|
2105
|
+
flushPostFlushCbs();
|
|
2106
|
+
container._vnode = vnode;
|
|
2107
|
+
return;
|
|
2077
2108
|
}
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2109
|
+
hydrateNode(container.firstChild, vnode, null, null, null);
|
|
2110
|
+
flushPostFlushCbs();
|
|
2111
|
+
container._vnode = vnode;
|
|
2112
|
+
};
|
|
2113
|
+
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
2114
|
+
optimized = optimized || !!vnode.dynamicChildren;
|
|
2115
|
+
const isFragmentStart = isComment(node) && node.data === "[";
|
|
2116
|
+
const onMismatch = () => handleMismatch(
|
|
2117
|
+
node,
|
|
2083
2118
|
vnode,
|
|
2084
|
-
container,
|
|
2085
|
-
next,
|
|
2086
2119
|
parentComponent,
|
|
2087
2120
|
parentSuspense,
|
|
2088
|
-
|
|
2089
|
-
|
|
2121
|
+
slotScopeIds,
|
|
2122
|
+
isFragmentStart
|
|
2090
2123
|
);
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2124
|
+
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
2125
|
+
let domType = node.nodeType;
|
|
2126
|
+
vnode.el = node;
|
|
2127
|
+
{
|
|
2128
|
+
shared.def(node, "__vnode", vnode, true);
|
|
2129
|
+
shared.def(node, "__vueParentComponent", parentComponent, true);
|
|
2094
2130
|
}
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
if (
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2131
|
+
if (patchFlag === -2) {
|
|
2132
|
+
optimized = false;
|
|
2133
|
+
vnode.dynamicChildren = null;
|
|
2134
|
+
}
|
|
2135
|
+
let nextNode = null;
|
|
2136
|
+
switch (type) {
|
|
2137
|
+
case Text:
|
|
2138
|
+
if (domType !== 3) {
|
|
2139
|
+
if (vnode.children === "") {
|
|
2140
|
+
insert(vnode.el = createText(""), parentNode(node), node);
|
|
2141
|
+
nextNode = node;
|
|
2106
2142
|
} else {
|
|
2107
|
-
|
|
2143
|
+
nextNode = onMismatch();
|
|
2144
|
+
}
|
|
2145
|
+
} else {
|
|
2146
|
+
if (node.data !== vnode.children) {
|
|
2147
|
+
node.data = vnode.children;
|
|
2108
2148
|
}
|
|
2149
|
+
nextNode = nextSibling(node);
|
|
2109
2150
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
}
|
|
2124
|
-
parent = parent.parent;
|
|
2125
|
-
}
|
|
2126
|
-
};
|
|
2127
|
-
const isTemplateNode = (node) => {
|
|
2128
|
-
return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
|
2129
|
-
};
|
|
2130
|
-
return [hydrate, hydrateNode];
|
|
2131
|
-
}
|
|
2132
|
-
function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
2133
|
-
let mismatchType;
|
|
2134
|
-
let mismatchKey;
|
|
2135
|
-
let actual;
|
|
2136
|
-
let expected;
|
|
2137
|
-
if (key === "class") {
|
|
2138
|
-
actual = el.getAttribute("class");
|
|
2139
|
-
expected = shared.normalizeClass(clientValue);
|
|
2140
|
-
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
|
2141
|
-
mismatchType = 2 /* CLASS */;
|
|
2142
|
-
mismatchKey = `class`;
|
|
2143
|
-
}
|
|
2144
|
-
} else if (key === "style") {
|
|
2145
|
-
actual = el.getAttribute("style") || "";
|
|
2146
|
-
expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
|
|
2147
|
-
const actualMap = toStyleMap(actual);
|
|
2148
|
-
const expectedMap = toStyleMap(expected);
|
|
2149
|
-
if (vnode.dirs) {
|
|
2150
|
-
for (const { dir, value } of vnode.dirs) {
|
|
2151
|
-
if (dir.name === "show" && !value) {
|
|
2152
|
-
expectedMap.set("display", "none");
|
|
2151
|
+
break;
|
|
2152
|
+
case Comment:
|
|
2153
|
+
if (isTemplateNode(node)) {
|
|
2154
|
+
nextNode = nextSibling(node);
|
|
2155
|
+
replaceNode(
|
|
2156
|
+
vnode.el = node.content.firstChild,
|
|
2157
|
+
node,
|
|
2158
|
+
parentComponent
|
|
2159
|
+
);
|
|
2160
|
+
} else if (domType !== 8 || isFragmentStart) {
|
|
2161
|
+
nextNode = onMismatch();
|
|
2162
|
+
} else {
|
|
2163
|
+
nextNode = nextSibling(node);
|
|
2153
2164
|
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
if (!isMapEqual(actualMap, expectedMap)) {
|
|
2160
|
-
mismatchType = 3 /* STYLE */;
|
|
2161
|
-
mismatchKey = "style";
|
|
2162
|
-
}
|
|
2163
|
-
} else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
|
|
2164
|
-
if (shared.isBooleanAttr(key)) {
|
|
2165
|
-
actual = el.hasAttribute(key);
|
|
2166
|
-
expected = shared.includeBooleanAttr(clientValue);
|
|
2167
|
-
} else if (clientValue == null) {
|
|
2168
|
-
actual = el.hasAttribute(key);
|
|
2169
|
-
expected = false;
|
|
2170
|
-
} else {
|
|
2171
|
-
if (el.hasAttribute(key)) {
|
|
2172
|
-
actual = el.getAttribute(key);
|
|
2173
|
-
} else if (key === "value" && el.tagName === "TEXTAREA") {
|
|
2174
|
-
actual = el.value;
|
|
2175
|
-
} else {
|
|
2176
|
-
actual = false;
|
|
2177
|
-
}
|
|
2178
|
-
expected = shared.isRenderableAttrValue(clientValue) ? String(clientValue) : false;
|
|
2179
|
-
}
|
|
2180
|
-
if (actual !== expected) {
|
|
2181
|
-
mismatchType = 4 /* ATTRIBUTE */;
|
|
2182
|
-
mismatchKey = key;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
|
|
2186
|
-
const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
|
2187
|
-
const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
|
|
2188
|
-
const postSegment = `
|
|
2189
|
-
- rendered on server: ${format(actual)}
|
|
2190
|
-
- expected on client: ${format(expected)}
|
|
2191
|
-
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
|
2192
|
-
You should fix the source of the mismatch.`;
|
|
2193
|
-
{
|
|
2194
|
-
warn$1(preSegment, el, postSegment);
|
|
2195
|
-
}
|
|
2196
|
-
return true;
|
|
2197
|
-
}
|
|
2198
|
-
return false;
|
|
2199
|
-
}
|
|
2200
|
-
function toClassSet(str) {
|
|
2201
|
-
return new Set(str.trim().split(/\s+/));
|
|
2202
|
-
}
|
|
2203
|
-
function isSetEqual(a, b) {
|
|
2204
|
-
if (a.size !== b.size) {
|
|
2205
|
-
return false;
|
|
2206
|
-
}
|
|
2207
|
-
for (const s of a) {
|
|
2208
|
-
if (!b.has(s)) {
|
|
2209
|
-
return false;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
return true;
|
|
2213
|
-
}
|
|
2214
|
-
function toStyleMap(str) {
|
|
2215
|
-
const styleMap = /* @__PURE__ */ new Map();
|
|
2216
|
-
for (const item of str.split(";")) {
|
|
2217
|
-
let [key, value] = item.split(":");
|
|
2218
|
-
key = key.trim();
|
|
2219
|
-
value = value && value.trim();
|
|
2220
|
-
if (key && value) {
|
|
2221
|
-
styleMap.set(key, value);
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
return styleMap;
|
|
2225
|
-
}
|
|
2226
|
-
function isMapEqual(a, b) {
|
|
2227
|
-
if (a.size !== b.size) {
|
|
2228
|
-
return false;
|
|
2229
|
-
}
|
|
2230
|
-
for (const [key, value] of a) {
|
|
2231
|
-
if (value !== b.get(key)) {
|
|
2232
|
-
return false;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
return true;
|
|
2236
|
-
}
|
|
2237
|
-
function resolveCssVars(instance, vnode, expectedMap) {
|
|
2238
|
-
const root = instance.subTree;
|
|
2239
|
-
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
2240
|
-
const cssVars = instance.getCssVars();
|
|
2241
|
-
for (const key in cssVars) {
|
|
2242
|
-
expectedMap.set(
|
|
2243
|
-
`--${shared.getEscapedCssVarName(key, false)}`,
|
|
2244
|
-
String(cssVars[key])
|
|
2245
|
-
);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
if (vnode === root && instance.parent) {
|
|
2249
|
-
resolveCssVars(instance.parent, instance.vnode, expectedMap);
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
const allowMismatchAttr = "data-allow-mismatch";
|
|
2253
|
-
const MismatchTypeString = {
|
|
2254
|
-
[0 /* TEXT */]: "text",
|
|
2255
|
-
[1 /* CHILDREN */]: "children",
|
|
2256
|
-
[2 /* CLASS */]: "class",
|
|
2257
|
-
[3 /* STYLE */]: "style",
|
|
2258
|
-
[4 /* ATTRIBUTE */]: "attribute"
|
|
2259
|
-
};
|
|
2260
|
-
function isMismatchAllowed(el, allowedType) {
|
|
2261
|
-
if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
|
|
2262
|
-
while (el && !el.hasAttribute(allowMismatchAttr)) {
|
|
2263
|
-
el = el.parentElement;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
const allowedAttr = el && el.getAttribute(allowMismatchAttr);
|
|
2267
|
-
if (allowedAttr == null) {
|
|
2268
|
-
return false;
|
|
2269
|
-
} else if (allowedAttr === "") {
|
|
2270
|
-
return true;
|
|
2271
|
-
} else {
|
|
2272
|
-
const list = allowedAttr.split(",");
|
|
2273
|
-
if (allowedType === 0 /* TEXT */ && list.includes("children")) {
|
|
2274
|
-
return true;
|
|
2275
|
-
}
|
|
2276
|
-
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
const requestIdleCallback = shared.getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
2281
|
-
const cancelIdleCallback = shared.getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
|
2282
|
-
const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
|
|
2283
|
-
const id = requestIdleCallback(hydrate, { timeout });
|
|
2284
|
-
return () => cancelIdleCallback(id);
|
|
2285
|
-
};
|
|
2286
|
-
function elementIsVisibleInViewport(el) {
|
|
2287
|
-
const { top, left, bottom, right } = el.getBoundingClientRect();
|
|
2288
|
-
const { innerHeight, innerWidth } = window;
|
|
2289
|
-
return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
|
|
2290
|
-
}
|
|
2291
|
-
const hydrateOnVisible = (opts) => (hydrate, forEach) => {
|
|
2292
|
-
const ob = new IntersectionObserver((entries) => {
|
|
2293
|
-
for (const e of entries) {
|
|
2294
|
-
if (!e.isIntersecting) continue;
|
|
2295
|
-
ob.disconnect();
|
|
2296
|
-
hydrate();
|
|
2297
|
-
break;
|
|
2298
|
-
}
|
|
2299
|
-
}, opts);
|
|
2300
|
-
forEach((el) => {
|
|
2301
|
-
if (!(el instanceof Element)) return;
|
|
2302
|
-
if (elementIsVisibleInViewport(el)) {
|
|
2303
|
-
hydrate();
|
|
2304
|
-
ob.disconnect();
|
|
2305
|
-
return false;
|
|
2306
|
-
}
|
|
2307
|
-
ob.observe(el);
|
|
2308
|
-
});
|
|
2309
|
-
return () => ob.disconnect();
|
|
2310
|
-
};
|
|
2311
|
-
const hydrateOnMediaQuery = (query) => (hydrate) => {
|
|
2312
|
-
if (query) {
|
|
2313
|
-
const mql = matchMedia(query);
|
|
2314
|
-
if (mql.matches) {
|
|
2315
|
-
hydrate();
|
|
2316
|
-
} else {
|
|
2317
|
-
mql.addEventListener("change", hydrate, { once: true });
|
|
2318
|
-
return () => mql.removeEventListener("change", hydrate);
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
};
|
|
2322
|
-
const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
|
2323
|
-
if (shared.isString(interactions)) interactions = [interactions];
|
|
2324
|
-
let hasHydrated = false;
|
|
2325
|
-
const doHydrate = (e) => {
|
|
2326
|
-
if (!hasHydrated) {
|
|
2327
|
-
hasHydrated = true;
|
|
2328
|
-
teardown();
|
|
2329
|
-
hydrate();
|
|
2330
|
-
e.target.dispatchEvent(new e.constructor(e.type, e));
|
|
2331
|
-
}
|
|
2332
|
-
};
|
|
2333
|
-
const teardown = () => {
|
|
2334
|
-
forEach((el) => {
|
|
2335
|
-
for (const i of interactions) {
|
|
2336
|
-
el.removeEventListener(i, doHydrate);
|
|
2337
|
-
}
|
|
2338
|
-
});
|
|
2339
|
-
};
|
|
2340
|
-
forEach((el) => {
|
|
2341
|
-
for (const i of interactions) {
|
|
2342
|
-
el.addEventListener(i, doHydrate, { once: true });
|
|
2343
|
-
}
|
|
2344
|
-
});
|
|
2345
|
-
return teardown;
|
|
2346
|
-
};
|
|
2347
|
-
function forEachElement(node, cb) {
|
|
2348
|
-
if (isComment(node) && node.data === "[") {
|
|
2349
|
-
let depth = 1;
|
|
2350
|
-
let next = node.nextSibling;
|
|
2351
|
-
while (next) {
|
|
2352
|
-
if (next.nodeType === 1) {
|
|
2353
|
-
const result = cb(next);
|
|
2354
|
-
if (result === false) {
|
|
2355
|
-
break;
|
|
2165
|
+
break;
|
|
2166
|
+
case Static:
|
|
2167
|
+
if (isFragmentStart) {
|
|
2168
|
+
node = nextSibling(node);
|
|
2169
|
+
domType = node.nodeType;
|
|
2356
2170
|
}
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2171
|
+
if (domType === 1 || domType === 3) {
|
|
2172
|
+
nextNode = node;
|
|
2173
|
+
const needToAdoptContent = !vnode.children.length;
|
|
2174
|
+
for (let i = 0; i < vnode.staticCount; i++) {
|
|
2175
|
+
if (needToAdoptContent)
|
|
2176
|
+
vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
|
|
2177
|
+
if (i === vnode.staticCount - 1) {
|
|
2178
|
+
vnode.anchor = nextNode;
|
|
2179
|
+
}
|
|
2180
|
+
nextNode = nextSibling(nextNode);
|
|
2181
|
+
}
|
|
2182
|
+
return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
|
2183
|
+
} else {
|
|
2184
|
+
onMismatch();
|
|
2362
2185
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
2379
|
-
// @__NO_SIDE_EFFECTS__
|
|
2380
|
-
function defineAsyncComponent(source) {
|
|
2381
|
-
if (shared.isFunction(source)) {
|
|
2382
|
-
source = { loader: source };
|
|
2383
|
-
}
|
|
2384
|
-
const {
|
|
2385
|
-
loader,
|
|
2386
|
-
loadingComponent,
|
|
2387
|
-
errorComponent,
|
|
2388
|
-
delay = 200,
|
|
2389
|
-
hydrate: hydrateStrategy,
|
|
2390
|
-
timeout,
|
|
2391
|
-
// undefined = never times out
|
|
2392
|
-
suspensible = true,
|
|
2393
|
-
onError: userOnError
|
|
2394
|
-
} = source;
|
|
2395
|
-
let pendingRequest = null;
|
|
2396
|
-
let resolvedComp;
|
|
2397
|
-
let retries = 0;
|
|
2398
|
-
const retry = () => {
|
|
2399
|
-
retries++;
|
|
2400
|
-
pendingRequest = null;
|
|
2401
|
-
return load();
|
|
2402
|
-
};
|
|
2403
|
-
const load = () => {
|
|
2404
|
-
let thisRequest;
|
|
2405
|
-
return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
|
2406
|
-
err = err instanceof Error ? err : new Error(String(err));
|
|
2407
|
-
if (userOnError) {
|
|
2408
|
-
return new Promise((resolve, reject) => {
|
|
2409
|
-
const userRetry = () => resolve(retry());
|
|
2410
|
-
const userFail = () => reject(err);
|
|
2411
|
-
userOnError(err, userRetry, userFail, retries + 1);
|
|
2412
|
-
});
|
|
2413
|
-
} else {
|
|
2414
|
-
throw err;
|
|
2415
|
-
}
|
|
2416
|
-
}).then((comp) => {
|
|
2417
|
-
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
2418
|
-
return pendingRequest;
|
|
2419
|
-
}
|
|
2420
|
-
if (!comp) {
|
|
2421
|
-
warn$1(
|
|
2422
|
-
`Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
|
|
2423
|
-
);
|
|
2424
|
-
}
|
|
2425
|
-
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
|
2426
|
-
comp = comp.default;
|
|
2427
|
-
}
|
|
2428
|
-
if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
|
|
2429
|
-
throw new Error(`Invalid async component load result: ${comp}`);
|
|
2430
|
-
}
|
|
2431
|
-
resolvedComp = comp;
|
|
2432
|
-
return comp;
|
|
2433
|
-
}));
|
|
2434
|
-
};
|
|
2435
|
-
return defineComponent({
|
|
2436
|
-
name: "AsyncComponentWrapper",
|
|
2437
|
-
__asyncLoader: load,
|
|
2438
|
-
__asyncHydrate(el, instance, hydrate) {
|
|
2439
|
-
const doHydrate = hydrateStrategy ? () => {
|
|
2440
|
-
const teardown = hydrateStrategy(
|
|
2441
|
-
hydrate,
|
|
2442
|
-
(cb) => forEachElement(el, cb)
|
|
2443
|
-
);
|
|
2444
|
-
if (teardown) {
|
|
2445
|
-
(instance.bum || (instance.bum = [])).push(teardown);
|
|
2186
|
+
break;
|
|
2187
|
+
case Fragment:
|
|
2188
|
+
if (!isFragmentStart) {
|
|
2189
|
+
nextNode = onMismatch();
|
|
2190
|
+
} else {
|
|
2191
|
+
nextNode = hydrateFragment(
|
|
2192
|
+
node,
|
|
2193
|
+
vnode,
|
|
2194
|
+
parentComponent,
|
|
2195
|
+
parentSuspense,
|
|
2196
|
+
slotScopeIds,
|
|
2197
|
+
optimized
|
|
2198
|
+
);
|
|
2446
2199
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
return resolvedComp;
|
|
2461
|
-
},
|
|
2462
|
-
setup() {
|
|
2463
|
-
const instance = currentInstance;
|
|
2464
|
-
markAsyncBoundary(instance);
|
|
2465
|
-
if (resolvedComp) {
|
|
2466
|
-
return () => createInnerComp(resolvedComp, instance);
|
|
2467
|
-
}
|
|
2468
|
-
const onError = (err) => {
|
|
2469
|
-
pendingRequest = null;
|
|
2470
|
-
handleError(
|
|
2471
|
-
err,
|
|
2472
|
-
instance,
|
|
2473
|
-
13,
|
|
2474
|
-
!errorComponent
|
|
2475
|
-
);
|
|
2476
|
-
};
|
|
2477
|
-
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
2478
|
-
return load().then((comp) => {
|
|
2479
|
-
return () => createInnerComp(comp, instance);
|
|
2480
|
-
}).catch((err) => {
|
|
2481
|
-
onError(err);
|
|
2482
|
-
return () => errorComponent ? createVNode(errorComponent, {
|
|
2483
|
-
error: err
|
|
2484
|
-
}) : null;
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
|
-
const loaded = reactivity.ref(false);
|
|
2488
|
-
const error = reactivity.ref();
|
|
2489
|
-
const delayed = reactivity.ref(!!delay);
|
|
2490
|
-
if (delay) {
|
|
2491
|
-
setTimeout(() => {
|
|
2492
|
-
delayed.value = false;
|
|
2493
|
-
}, delay);
|
|
2494
|
-
}
|
|
2495
|
-
if (timeout != null) {
|
|
2496
|
-
setTimeout(() => {
|
|
2497
|
-
if (!loaded.value && !error.value) {
|
|
2498
|
-
const err = new Error(
|
|
2499
|
-
`Async component timed out after ${timeout}ms.`
|
|
2200
|
+
break;
|
|
2201
|
+
default:
|
|
2202
|
+
if (shapeFlag & 1) {
|
|
2203
|
+
if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
|
|
2204
|
+
nextNode = onMismatch();
|
|
2205
|
+
} else {
|
|
2206
|
+
nextNode = hydrateElement(
|
|
2207
|
+
node,
|
|
2208
|
+
vnode,
|
|
2209
|
+
parentComponent,
|
|
2210
|
+
parentSuspense,
|
|
2211
|
+
slotScopeIds,
|
|
2212
|
+
optimized
|
|
2500
2213
|
);
|
|
2501
|
-
onError(err);
|
|
2502
|
-
error.value = err;
|
|
2503
2214
|
}
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2215
|
+
} else if (shapeFlag & 6) {
|
|
2216
|
+
vnode.slotScopeIds = slotScopeIds;
|
|
2217
|
+
const container = parentNode(node);
|
|
2218
|
+
if (isFragmentStart) {
|
|
2219
|
+
nextNode = locateClosingAnchor(node);
|
|
2220
|
+
} else if (isComment(node) && node.data === "teleport start") {
|
|
2221
|
+
nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
2222
|
+
} else {
|
|
2223
|
+
nextNode = nextSibling(node);
|
|
2224
|
+
}
|
|
2225
|
+
mountComponent(
|
|
2226
|
+
vnode,
|
|
2227
|
+
container,
|
|
2228
|
+
null,
|
|
2229
|
+
parentComponent,
|
|
2230
|
+
parentSuspense,
|
|
2231
|
+
getContainerType(container),
|
|
2232
|
+
optimized
|
|
2233
|
+
);
|
|
2234
|
+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
|
|
2235
|
+
let subTree;
|
|
2236
|
+
if (isFragmentStart) {
|
|
2237
|
+
subTree = createVNode(Fragment);
|
|
2238
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
2239
|
+
} else {
|
|
2240
|
+
subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
2241
|
+
}
|
|
2242
|
+
subTree.el = node;
|
|
2243
|
+
vnode.component.subTree = subTree;
|
|
2244
|
+
}
|
|
2245
|
+
} else if (shapeFlag & 64) {
|
|
2246
|
+
if (domType !== 8) {
|
|
2247
|
+
nextNode = onMismatch();
|
|
2248
|
+
} else {
|
|
2249
|
+
nextNode = vnode.type.hydrate(
|
|
2250
|
+
node,
|
|
2251
|
+
vnode,
|
|
2252
|
+
parentComponent,
|
|
2253
|
+
parentSuspense,
|
|
2254
|
+
slotScopeIds,
|
|
2255
|
+
optimized,
|
|
2256
|
+
rendererInternals,
|
|
2257
|
+
hydrateChildren
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2260
|
+
} else if (shapeFlag & 128) {
|
|
2261
|
+
nextNode = vnode.type.hydrate(
|
|
2262
|
+
node,
|
|
2263
|
+
vnode,
|
|
2264
|
+
parentComponent,
|
|
2265
|
+
parentSuspense,
|
|
2266
|
+
getContainerType(parentNode(node)),
|
|
2267
|
+
slotScopeIds,
|
|
2268
|
+
optimized,
|
|
2269
|
+
rendererInternals,
|
|
2270
|
+
hydrateNode
|
|
2271
|
+
);
|
|
2272
|
+
} else {
|
|
2273
|
+
warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
|
2274
|
+
}
|
|
2559
2275
|
}
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
let current = null;
|
|
2563
|
-
{
|
|
2564
|
-
instance.__v_cache = cache;
|
|
2276
|
+
if (ref != null) {
|
|
2277
|
+
setRef(ref, null, parentSuspense, vnode);
|
|
2565
2278
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2279
|
+
return nextNode;
|
|
2280
|
+
};
|
|
2281
|
+
function _getValidZova(instance) {
|
|
2282
|
+
while (instance) {
|
|
2283
|
+
if (instance.zova) return instance.zova;
|
|
2284
|
+
instance = instance.parent;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
2288
|
+
optimized = optimized || !!vnode.dynamicChildren;
|
|
2289
|
+
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
2290
|
+
const forcePatch = type === "input" || type === "option";
|
|
2291
|
+
{
|
|
2292
|
+
if (dirs) {
|
|
2293
|
+
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
2573
2294
|
}
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
instance2,
|
|
2585
|
-
parentSuspense,
|
|
2586
|
-
namespace,
|
|
2587
|
-
vnode.slotScopeIds,
|
|
2588
|
-
optimized
|
|
2589
|
-
);
|
|
2590
|
-
queuePostRenderEffect(() => {
|
|
2591
|
-
instance2.isDeactivated = false;
|
|
2592
|
-
if (instance2.a) {
|
|
2593
|
-
shared.invokeArrayFns(instance2.a);
|
|
2594
|
-
}
|
|
2595
|
-
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
2596
|
-
if (vnodeHook) {
|
|
2597
|
-
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
2295
|
+
let needCallTransitionHooks = false;
|
|
2296
|
+
if (isTemplateNode(el)) {
|
|
2297
|
+
needCallTransitionHooks = needTransition(
|
|
2298
|
+
null,
|
|
2299
|
+
// no need check parentSuspense in hydration
|
|
2300
|
+
transition
|
|
2301
|
+
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
|
2302
|
+
const content = el.content.firstChild;
|
|
2303
|
+
if (needCallTransitionHooks) {
|
|
2304
|
+
transition.beforeEnter(content);
|
|
2598
2305
|
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
devtoolsComponentAdded(instance2);
|
|
2306
|
+
replaceNode(content, el, parentComponent);
|
|
2307
|
+
vnode.el = el = content;
|
|
2602
2308
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2309
|
+
if (shapeFlag & 16 && // skip if element has innerHTML / textContent
|
|
2310
|
+
!(props && (props.innerHTML || props.textContent))) {
|
|
2311
|
+
let next = hydrateChildren(
|
|
2312
|
+
el.firstChild,
|
|
2313
|
+
vnode,
|
|
2314
|
+
el,
|
|
2315
|
+
parentComponent,
|
|
2316
|
+
parentSuspense,
|
|
2317
|
+
slotScopeIds,
|
|
2318
|
+
optimized
|
|
2319
|
+
);
|
|
2320
|
+
let hasWarned = false;
|
|
2321
|
+
while (next) {
|
|
2322
|
+
if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
|
|
2323
|
+
if (!hasWarned) {
|
|
2324
|
+
warn$1(
|
|
2325
|
+
`Hydration children mismatch on`,
|
|
2326
|
+
el,
|
|
2327
|
+
`
|
|
2328
|
+
Server rendered element contains more child nodes than client vdom.`
|
|
2329
|
+
);
|
|
2330
|
+
hasWarned = true;
|
|
2331
|
+
}
|
|
2332
|
+
logMismatchError();
|
|
2333
|
+
}
|
|
2334
|
+
const cur = next;
|
|
2335
|
+
next = next.nextSibling;
|
|
2336
|
+
remove(cur);
|
|
2612
2337
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2338
|
+
} else if (shapeFlag & 8) {
|
|
2339
|
+
let clientText = vnode.children;
|
|
2340
|
+
if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
|
2341
|
+
clientText = clientText.slice(1);
|
|
2342
|
+
}
|
|
2343
|
+
if (el.textContent !== clientText) {
|
|
2344
|
+
if (!isMismatchAllowed(el, 0 /* TEXT */)) {
|
|
2345
|
+
warn$1(
|
|
2346
|
+
`Hydration text content mismatch on`,
|
|
2347
|
+
el,
|
|
2348
|
+
`
|
|
2349
|
+
- rendered on server: ${el.textContent}
|
|
2350
|
+
- expected on client: ${vnode.children}`
|
|
2351
|
+
);
|
|
2352
|
+
logMismatchError();
|
|
2353
|
+
}
|
|
2354
|
+
el.textContent = vnode.children;
|
|
2616
2355
|
}
|
|
2617
|
-
instance2.isDeactivated = true;
|
|
2618
|
-
}, parentSuspense);
|
|
2619
|
-
{
|
|
2620
|
-
devtoolsComponentAdded(instance2);
|
|
2621
2356
|
}
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2357
|
+
if (props) {
|
|
2358
|
+
{
|
|
2359
|
+
const isCustomElement = el.tagName.includes("-");
|
|
2360
|
+
for (const key in props) {
|
|
2361
|
+
let ignore;
|
|
2362
|
+
let clientValue = props[key];
|
|
2363
|
+
const zova = _getValidZova(parentComponent);
|
|
2364
|
+
if (zova) {
|
|
2365
|
+
const res = zova.meta.$ssr._hydratePropHasMismatch(
|
|
2366
|
+
el,
|
|
2367
|
+
key,
|
|
2368
|
+
clientValue,
|
|
2369
|
+
vnode,
|
|
2370
|
+
parentComponent
|
|
2371
|
+
);
|
|
2372
|
+
if (res.ignore) {
|
|
2373
|
+
ignore = true;
|
|
2374
|
+
} else {
|
|
2375
|
+
clientValue = res.clientValue;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (!ignore) {
|
|
2379
|
+
if (// #11189 skip if this node has directives that have created hooks
|
|
2380
|
+
// as it could have mutated the DOM in any possible way
|
|
2381
|
+
!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
|
|
2382
|
+
logMismatchError();
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
2386
|
+
key[0] === "." || isCustomElement) {
|
|
2387
|
+
patchProp(el, key, null, props[key], void 0, parentComponent);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2632
2390
|
}
|
|
2633
|
-
}
|
|
2391
|
+
}
|
|
2392
|
+
let vnodeHooks;
|
|
2393
|
+
if (vnodeHooks = props && props.onVnodeBeforeMount) {
|
|
2394
|
+
invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
2395
|
+
}
|
|
2396
|
+
if (dirs) {
|
|
2397
|
+
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
2398
|
+
}
|
|
2399
|
+
if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
|
2400
|
+
queueEffectWithSuspense(() => {
|
|
2401
|
+
vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
|
2402
|
+
needCallTransitionHooks && transition.enter(el);
|
|
2403
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
2404
|
+
}, parentSuspense);
|
|
2405
|
+
}
|
|
2634
2406
|
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2407
|
+
return el.nextSibling;
|
|
2408
|
+
};
|
|
2409
|
+
const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
2410
|
+
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
2411
|
+
const children = parentVNode.children;
|
|
2412
|
+
const l = children.length;
|
|
2413
|
+
let hasWarned = false;
|
|
2414
|
+
for (let i = 0; i < l; i++) {
|
|
2415
|
+
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
2416
|
+
const isText = vnode.type === Text;
|
|
2417
|
+
if (node) {
|
|
2418
|
+
if (isText && !optimized) {
|
|
2419
|
+
if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
|
|
2420
|
+
insert(
|
|
2421
|
+
createText(
|
|
2422
|
+
node.data.slice(vnode.children.length)
|
|
2423
|
+
),
|
|
2424
|
+
container,
|
|
2425
|
+
nextSibling(node)
|
|
2426
|
+
);
|
|
2427
|
+
node.data = vnode.children;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
node = hydrateNode(
|
|
2431
|
+
node,
|
|
2432
|
+
vnode,
|
|
2433
|
+
parentComponent,
|
|
2434
|
+
parentSuspense,
|
|
2435
|
+
slotScopeIds,
|
|
2436
|
+
optimized
|
|
2437
|
+
);
|
|
2438
|
+
} else if (isText && !vnode.children) {
|
|
2439
|
+
insert(vnode.el = createText(""), container);
|
|
2440
|
+
} else {
|
|
2441
|
+
if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
|
|
2442
|
+
if (!hasWarned) {
|
|
2443
|
+
warn$1(
|
|
2444
|
+
`Hydration children mismatch on`,
|
|
2445
|
+
container,
|
|
2446
|
+
`
|
|
2447
|
+
Server rendered element contains fewer child nodes than client vdom.`
|
|
2448
|
+
);
|
|
2449
|
+
hasWarned = true;
|
|
2450
|
+
}
|
|
2451
|
+
logMismatchError();
|
|
2452
|
+
}
|
|
2453
|
+
patch(
|
|
2454
|
+
null,
|
|
2455
|
+
vnode,
|
|
2456
|
+
container,
|
|
2457
|
+
null,
|
|
2458
|
+
parentComponent,
|
|
2459
|
+
parentSuspense,
|
|
2460
|
+
getContainerType(container),
|
|
2461
|
+
slotScopeIds
|
|
2462
|
+
);
|
|
2641
2463
|
}
|
|
2642
|
-
cache.delete(key);
|
|
2643
|
-
keys.delete(key);
|
|
2644
2464
|
}
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2465
|
+
return node;
|
|
2466
|
+
};
|
|
2467
|
+
const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
2468
|
+
const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
|
2469
|
+
if (fragmentSlotScopeIds) {
|
|
2470
|
+
slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
|
2471
|
+
}
|
|
2472
|
+
const container = parentNode(node);
|
|
2473
|
+
const next = hydrateChildren(
|
|
2474
|
+
nextSibling(node),
|
|
2475
|
+
vnode,
|
|
2476
|
+
container,
|
|
2477
|
+
parentComponent,
|
|
2478
|
+
parentSuspense,
|
|
2479
|
+
slotScopeIds,
|
|
2480
|
+
optimized
|
|
2653
2481
|
);
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2482
|
+
if (next && isComment(next) && next.data === "]") {
|
|
2483
|
+
return nextSibling(vnode.anchor = next);
|
|
2484
|
+
} else {
|
|
2485
|
+
logMismatchError();
|
|
2486
|
+
insert(vnode.anchor = createComment(`]`), container, next);
|
|
2487
|
+
return next;
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
2491
|
+
if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
|
|
2492
|
+
warn$1(
|
|
2493
|
+
`Hydration node mismatch:
|
|
2494
|
+
- rendered on server:`,
|
|
2495
|
+
node,
|
|
2496
|
+
node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
|
|
2497
|
+
`
|
|
2498
|
+
- expected on client:`,
|
|
2499
|
+
vnode.type
|
|
2500
|
+
);
|
|
2501
|
+
logMismatchError();
|
|
2502
|
+
}
|
|
2503
|
+
vnode.el = null;
|
|
2504
|
+
if (isFragment) {
|
|
2505
|
+
const end = locateClosingAnchor(node);
|
|
2506
|
+
while (true) {
|
|
2507
|
+
const next2 = nextSibling(node);
|
|
2508
|
+
if (next2 && next2 !== end) {
|
|
2509
|
+
remove(next2);
|
|
2661
2510
|
} else {
|
|
2662
|
-
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
|
-
};
|
|
2666
|
-
onMounted(cacheSubtree);
|
|
2667
|
-
onUpdated(cacheSubtree);
|
|
2668
|
-
onBeforeUnmount(() => {
|
|
2669
|
-
cache.forEach((cached) => {
|
|
2670
|
-
const { subTree, suspense } = instance;
|
|
2671
|
-
const vnode = getInnerChild(subTree);
|
|
2672
|
-
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
2673
|
-
resetShapeFlag(vnode);
|
|
2674
|
-
const da = vnode.component.da;
|
|
2675
|
-
da && queuePostRenderEffect(da, suspense);
|
|
2676
|
-
return;
|
|
2511
|
+
break;
|
|
2677
2512
|
}
|
|
2678
|
-
unmount(cached);
|
|
2679
|
-
});
|
|
2680
|
-
});
|
|
2681
|
-
return () => {
|
|
2682
|
-
pendingCacheKey = null;
|
|
2683
|
-
if (!slots.default) {
|
|
2684
|
-
return current = null;
|
|
2685
2513
|
}
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2514
|
+
}
|
|
2515
|
+
const next = nextSibling(node);
|
|
2516
|
+
const container = parentNode(node);
|
|
2517
|
+
remove(node);
|
|
2518
|
+
patch(
|
|
2519
|
+
null,
|
|
2520
|
+
vnode,
|
|
2521
|
+
container,
|
|
2522
|
+
next,
|
|
2523
|
+
parentComponent,
|
|
2524
|
+
parentSuspense,
|
|
2525
|
+
getContainerType(container),
|
|
2526
|
+
slotScopeIds
|
|
2527
|
+
);
|
|
2528
|
+
if (parentComponent) {
|
|
2529
|
+
parentComponent.vnode.el = vnode.el;
|
|
2530
|
+
updateHOCHostEl(parentComponent, vnode.el);
|
|
2531
|
+
}
|
|
2532
|
+
return next;
|
|
2533
|
+
};
|
|
2534
|
+
const locateClosingAnchor = (node, open = "[", close = "]") => {
|
|
2535
|
+
let match = 0;
|
|
2536
|
+
while (node) {
|
|
2537
|
+
node = nextSibling(node);
|
|
2538
|
+
if (node && isComment(node)) {
|
|
2539
|
+
if (node.data === open) match++;
|
|
2540
|
+
if (node.data === close) {
|
|
2541
|
+
if (match === 0) {
|
|
2542
|
+
return nextSibling(node);
|
|
2543
|
+
} else {
|
|
2544
|
+
match--;
|
|
2545
|
+
}
|
|
2691
2546
|
}
|
|
2692
|
-
current = null;
|
|
2693
|
-
return children;
|
|
2694
|
-
} else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
|
2695
|
-
current = null;
|
|
2696
|
-
return rawVNode;
|
|
2697
|
-
}
|
|
2698
|
-
let vnode = getInnerChild(rawVNode);
|
|
2699
|
-
if (vnode.type === Comment) {
|
|
2700
|
-
current = null;
|
|
2701
|
-
return vnode;
|
|
2702
|
-
}
|
|
2703
|
-
const comp = vnode.type;
|
|
2704
|
-
const name = getComponentName(
|
|
2705
|
-
isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
|
2706
|
-
);
|
|
2707
|
-
const { include, exclude, max } = props;
|
|
2708
|
-
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
|
2709
|
-
vnode.shapeFlag &= ~256;
|
|
2710
|
-
current = vnode;
|
|
2711
|
-
return rawVNode;
|
|
2712
2547
|
}
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2548
|
+
}
|
|
2549
|
+
return node;
|
|
2550
|
+
};
|
|
2551
|
+
const replaceNode = (newNode, oldNode, parentComponent) => {
|
|
2552
|
+
const parentNode2 = oldNode.parentNode;
|
|
2553
|
+
if (parentNode2) {
|
|
2554
|
+
parentNode2.replaceChild(newNode, oldNode);
|
|
2555
|
+
}
|
|
2556
|
+
let parent = parentComponent;
|
|
2557
|
+
while (parent) {
|
|
2558
|
+
if (parent.vnode.el === oldNode) {
|
|
2559
|
+
parent.vnode.el = parent.subTree.el = newNode;
|
|
2720
2560
|
}
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2561
|
+
parent = parent.parent;
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
const isTemplateNode = (node) => {
|
|
2565
|
+
return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
|
2566
|
+
};
|
|
2567
|
+
return [hydrate, hydrateNode];
|
|
2568
|
+
}
|
|
2569
|
+
function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
2570
|
+
let mismatchType;
|
|
2571
|
+
let mismatchKey;
|
|
2572
|
+
let actual;
|
|
2573
|
+
let expected;
|
|
2574
|
+
if (key === "class") {
|
|
2575
|
+
actual = el.getAttribute("class");
|
|
2576
|
+
expected = shared.normalizeClass(clientValue);
|
|
2577
|
+
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
|
2578
|
+
mismatchType = 2 /* CLASS */;
|
|
2579
|
+
mismatchKey = `class`;
|
|
2580
|
+
}
|
|
2581
|
+
} else if (key === "style") {
|
|
2582
|
+
actual = el.getAttribute("style") || "";
|
|
2583
|
+
expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
|
|
2584
|
+
const actualMap = toStyleMap(actual);
|
|
2585
|
+
const expectedMap = toStyleMap(expected);
|
|
2586
|
+
if (vnode.dirs) {
|
|
2587
|
+
for (const { dir, value } of vnode.dirs) {
|
|
2588
|
+
if (dir.name === "show" && !value) {
|
|
2589
|
+
expectedMap.set("display", "none");
|
|
2735
2590
|
}
|
|
2736
2591
|
}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
if (shared.
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
|
-
registerKeepAliveHook(hook, "da", target);
|
|
2760
|
-
}
|
|
2761
|
-
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2762
|
-
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
2763
|
-
let current = target;
|
|
2764
|
-
while (current) {
|
|
2765
|
-
if (current.isDeactivated) {
|
|
2766
|
-
return;
|
|
2592
|
+
}
|
|
2593
|
+
if (instance) {
|
|
2594
|
+
resolveCssVars(instance, vnode, expectedMap);
|
|
2595
|
+
}
|
|
2596
|
+
if (!isMapEqual(actualMap, expectedMap)) {
|
|
2597
|
+
mismatchType = 3 /* STYLE */;
|
|
2598
|
+
mismatchKey = "style";
|
|
2599
|
+
}
|
|
2600
|
+
} else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
|
|
2601
|
+
if (shared.isBooleanAttr(key)) {
|
|
2602
|
+
actual = el.hasAttribute(key);
|
|
2603
|
+
expected = shared.includeBooleanAttr(clientValue);
|
|
2604
|
+
} else if (clientValue == null) {
|
|
2605
|
+
actual = el.hasAttribute(key);
|
|
2606
|
+
expected = false;
|
|
2607
|
+
} else {
|
|
2608
|
+
if (el.hasAttribute(key)) {
|
|
2609
|
+
actual = el.getAttribute(key);
|
|
2610
|
+
} else if (key === "value" && el.tagName === "TEXTAREA") {
|
|
2611
|
+
actual = el.value;
|
|
2612
|
+
} else {
|
|
2613
|
+
actual = false;
|
|
2767
2614
|
}
|
|
2768
|
-
|
|
2615
|
+
expected = shared.isRenderableAttrValue(clientValue) ? String(clientValue) : false;
|
|
2769
2616
|
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
if (target) {
|
|
2774
|
-
let current = target.parent;
|
|
2775
|
-
while (current && current.parent) {
|
|
2776
|
-
if (isKeepAlive(current.parent.vnode)) {
|
|
2777
|
-
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
2778
|
-
}
|
|
2779
|
-
current = current.parent;
|
|
2617
|
+
if (actual !== expected) {
|
|
2618
|
+
mismatchType = 4 /* ATTRIBUTE */;
|
|
2619
|
+
mismatchKey = key;
|
|
2780
2620
|
}
|
|
2781
2621
|
}
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
shared.remove(keepAliveRoot[type], injected);
|
|
2793
|
-
}, target);
|
|
2794
|
-
}
|
|
2795
|
-
function resetShapeFlag(vnode) {
|
|
2796
|
-
vnode.shapeFlag &= ~256;
|
|
2797
|
-
vnode.shapeFlag &= ~512;
|
|
2798
|
-
}
|
|
2799
|
-
function getInnerChild(vnode) {
|
|
2800
|
-
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
2801
|
-
}
|
|
2802
|
-
|
|
2803
|
-
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
2804
|
-
if (target) {
|
|
2805
|
-
const hooks = target[type] || (target[type] = []);
|
|
2806
|
-
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
2807
|
-
reactivity.pauseTracking();
|
|
2808
|
-
const reset = setCurrentInstance(target);
|
|
2809
|
-
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
2810
|
-
reset();
|
|
2811
|
-
reactivity.resetTracking();
|
|
2812
|
-
return res;
|
|
2813
|
-
});
|
|
2814
|
-
if (prepend) {
|
|
2815
|
-
hooks.unshift(wrappedHook);
|
|
2816
|
-
} else {
|
|
2817
|
-
hooks.push(wrappedHook);
|
|
2622
|
+
if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
|
|
2623
|
+
const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
|
2624
|
+
const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
|
|
2625
|
+
const postSegment = `
|
|
2626
|
+
- rendered on server: ${format(actual)}
|
|
2627
|
+
- expected on client: ${format(expected)}
|
|
2628
|
+
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
|
2629
|
+
You should fix the source of the mismatch.`;
|
|
2630
|
+
{
|
|
2631
|
+
warn$1(preSegment, el, postSegment);
|
|
2818
2632
|
}
|
|
2819
|
-
return
|
|
2820
|
-
} else {
|
|
2821
|
-
const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2822
|
-
warn$1(
|
|
2823
|
-
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
2824
|
-
);
|
|
2633
|
+
return true;
|
|
2825
2634
|
}
|
|
2635
|
+
return false;
|
|
2826
2636
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2637
|
+
function toClassSet(str) {
|
|
2638
|
+
return new Set(str.trim().split(/\s+/));
|
|
2639
|
+
}
|
|
2640
|
+
function isSetEqual(a, b) {
|
|
2641
|
+
if (a.size !== b.size) {
|
|
2642
|
+
return false;
|
|
2830
2643
|
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2644
|
+
for (const s of a) {
|
|
2645
|
+
if (!b.has(s)) {
|
|
2646
|
+
return false;
|
|
2647
|
+
}
|
|
2833
2648
|
}
|
|
2834
|
-
|
|
2835
|
-
const onBeforeMount = createHook("bm");
|
|
2836
|
-
const onMounted = createHook("m");
|
|
2837
|
-
const onBeforeUpdate = createHook(
|
|
2838
|
-
"bu"
|
|
2839
|
-
);
|
|
2840
|
-
const onUpdated = createHook("u");
|
|
2841
|
-
const onBeforeUnmount = createHook(
|
|
2842
|
-
"bum"
|
|
2843
|
-
);
|
|
2844
|
-
const onUnmounted = createHook("um");
|
|
2845
|
-
const onServerPrefetch = createHook(
|
|
2846
|
-
"sp"
|
|
2847
|
-
);
|
|
2848
|
-
const onRenderTriggered = createHook("rtg");
|
|
2849
|
-
const onRenderTracked = createHook("rtc");
|
|
2850
|
-
function onErrorCaptured(hook, target = currentInstance) {
|
|
2851
|
-
injectHook("ec", hook, target);
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
const COMPONENTS = "components";
|
|
2855
|
-
const DIRECTIVES = "directives";
|
|
2856
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
2857
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
2649
|
+
return true;
|
|
2858
2650
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2651
|
+
function toStyleMap(str) {
|
|
2652
|
+
const styleMap = /* @__PURE__ */ new Map();
|
|
2653
|
+
for (const item of str.split(";")) {
|
|
2654
|
+
let [key, value] = item.split(":");
|
|
2655
|
+
key = key.trim();
|
|
2656
|
+
value = value && value.trim();
|
|
2657
|
+
if (key && value) {
|
|
2658
|
+
styleMap.set(key, value);
|
|
2659
|
+
}
|
|
2865
2660
|
}
|
|
2661
|
+
return styleMap;
|
|
2866
2662
|
}
|
|
2867
|
-
function
|
|
2868
|
-
|
|
2663
|
+
function isMapEqual(a, b) {
|
|
2664
|
+
if (a.size !== b.size) {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
for (const [key, value] of a) {
|
|
2668
|
+
if (value !== b.get(key)) {
|
|
2669
|
+
return false;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
return true;
|
|
2869
2673
|
}
|
|
2870
|
-
function
|
|
2871
|
-
const
|
|
2872
|
-
if (instance) {
|
|
2873
|
-
const
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2674
|
+
function resolveCssVars(instance, vnode, expectedMap) {
|
|
2675
|
+
const root = instance.subTree;
|
|
2676
|
+
if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
|
2677
|
+
const cssVars = instance.getCssVars();
|
|
2678
|
+
for (const key in cssVars) {
|
|
2679
|
+
expectedMap.set(
|
|
2680
|
+
`--${shared.getEscapedCssVarName(key, false)}`,
|
|
2681
|
+
String(cssVars[key])
|
|
2878
2682
|
);
|
|
2879
|
-
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
2880
|
-
return Component;
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
|
-
const res = (
|
|
2884
|
-
// local registration
|
|
2885
|
-
// check instance[type] first which is resolved for options API
|
|
2886
|
-
resolve(instance[type] || Component[type], name) || // global registration
|
|
2887
|
-
resolve(instance.appContext[type], name)
|
|
2888
|
-
);
|
|
2889
|
-
if (!res && maybeSelfReference) {
|
|
2890
|
-
return Component;
|
|
2891
2683
|
}
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2684
|
+
}
|
|
2685
|
+
if (vnode === root && instance.parent) {
|
|
2686
|
+
resolveCssVars(instance.parent, instance.vnode, expectedMap);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
const allowMismatchAttr = "data-allow-mismatch";
|
|
2690
|
+
const MismatchTypeString = {
|
|
2691
|
+
[0 /* TEXT */]: "text",
|
|
2692
|
+
[1 /* CHILDREN */]: "children",
|
|
2693
|
+
[2 /* CLASS */]: "class",
|
|
2694
|
+
[3 /* STYLE */]: "style",
|
|
2695
|
+
[4 /* ATTRIBUTE */]: "attribute"
|
|
2696
|
+
};
|
|
2697
|
+
function isMismatchAllowed(el, allowedType) {
|
|
2698
|
+
if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
|
|
2699
|
+
while (el && !el.hasAttribute(allowMismatchAttr)) {
|
|
2700
|
+
el = el.parentElement;
|
|
2896
2701
|
}
|
|
2897
|
-
|
|
2702
|
+
}
|
|
2703
|
+
const allowedAttr = el && el.getAttribute(allowMismatchAttr);
|
|
2704
|
+
if (allowedAttr == null) {
|
|
2705
|
+
return false;
|
|
2706
|
+
} else if (allowedAttr === "") {
|
|
2707
|
+
return true;
|
|
2898
2708
|
} else {
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2709
|
+
const list = allowedAttr.split(",");
|
|
2710
|
+
if (allowedType === 0 /* TEXT */ && list.includes("children")) {
|
|
2711
|
+
return true;
|
|
2712
|
+
}
|
|
2713
|
+
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
|
|
2902
2714
|
}
|
|
2903
2715
|
}
|
|
2904
|
-
function resolve(registry, name) {
|
|
2905
|
-
return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
|
|
2906
|
-
}
|
|
2907
2716
|
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2717
|
+
const requestIdleCallback = shared.getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
2718
|
+
const cancelIdleCallback = shared.getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
|
2719
|
+
const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
|
|
2720
|
+
const id = requestIdleCallback(hydrate, { timeout });
|
|
2721
|
+
return () => cancelIdleCallback(id);
|
|
2722
|
+
};
|
|
2723
|
+
function elementIsVisibleInViewport(el) {
|
|
2724
|
+
const { top, left, bottom, right } = el.getBoundingClientRect();
|
|
2725
|
+
const { innerHeight, innerWidth } = window;
|
|
2726
|
+
return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
|
|
2727
|
+
}
|
|
2728
|
+
const hydrateOnVisible = (opts) => (hydrate, forEach) => {
|
|
2729
|
+
const ob = new IntersectionObserver((entries) => {
|
|
2730
|
+
for (const e of entries) {
|
|
2731
|
+
if (!e.isIntersecting) continue;
|
|
2732
|
+
ob.disconnect();
|
|
2733
|
+
hydrate();
|
|
2734
|
+
break;
|
|
2918
2735
|
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2736
|
+
}, opts);
|
|
2737
|
+
forEach((el) => {
|
|
2738
|
+
if (!(el instanceof Element)) return;
|
|
2739
|
+
if (elementIsVisibleInViewport(el)) {
|
|
2740
|
+
hydrate();
|
|
2741
|
+
ob.disconnect();
|
|
2742
|
+
return false;
|
|
2743
|
+
}
|
|
2744
|
+
ob.observe(el);
|
|
2745
|
+
});
|
|
2746
|
+
return () => ob.disconnect();
|
|
2747
|
+
};
|
|
2748
|
+
const hydrateOnMediaQuery = (query) => (hydrate) => {
|
|
2749
|
+
if (query) {
|
|
2750
|
+
const mql = matchMedia(query);
|
|
2751
|
+
if (mql.matches) {
|
|
2752
|
+
hydrate();
|
|
2753
|
+
} else {
|
|
2754
|
+
mql.addEventListener("change", hydrate, { once: true });
|
|
2755
|
+
return () => mql.removeEventListener("change", hydrate);
|
|
2927
2756
|
}
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
|
|
2757
|
+
}
|
|
2758
|
+
};
|
|
2759
|
+
const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
|
2760
|
+
if (shared.isString(interactions)) interactions = [interactions];
|
|
2761
|
+
let hasHydrated = false;
|
|
2762
|
+
const doHydrate = (e) => {
|
|
2763
|
+
if (!hasHydrated) {
|
|
2764
|
+
hasHydrated = true;
|
|
2765
|
+
teardown();
|
|
2766
|
+
hydrate();
|
|
2767
|
+
e.target.dispatchEvent(new e.constructor(e.type, e));
|
|
2931
2768
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2769
|
+
};
|
|
2770
|
+
const teardown = () => {
|
|
2771
|
+
forEach((el) => {
|
|
2772
|
+
for (const i of interactions) {
|
|
2773
|
+
el.removeEventListener(i, doHydrate);
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
};
|
|
2777
|
+
forEach((el) => {
|
|
2778
|
+
for (const i of interactions) {
|
|
2779
|
+
el.addEventListener(i, doHydrate, { once: true });
|
|
2935
2780
|
}
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2781
|
+
});
|
|
2782
|
+
return teardown;
|
|
2783
|
+
};
|
|
2784
|
+
function forEachElement(node, cb) {
|
|
2785
|
+
if (isComment(node) && node.data === "[") {
|
|
2786
|
+
let depth = 1;
|
|
2787
|
+
let next = node.nextSibling;
|
|
2788
|
+
while (next) {
|
|
2789
|
+
if (next.nodeType === 1) {
|
|
2790
|
+
const result = cb(next);
|
|
2791
|
+
if (result === false) {
|
|
2792
|
+
break;
|
|
2793
|
+
}
|
|
2794
|
+
} else if (isComment(next)) {
|
|
2795
|
+
if (next.data === "]") {
|
|
2796
|
+
if (--depth === 0) break;
|
|
2797
|
+
} else if (next.data === "[") {
|
|
2798
|
+
depth++;
|
|
2799
|
+
}
|
|
2948
2800
|
}
|
|
2801
|
+
next = next.nextSibling;
|
|
2949
2802
|
}
|
|
2950
2803
|
} else {
|
|
2951
|
-
|
|
2952
|
-
}
|
|
2953
|
-
if (cache) {
|
|
2954
|
-
cache[index] = ret;
|
|
2804
|
+
cb(node);
|
|
2955
2805
|
}
|
|
2956
|
-
return ret;
|
|
2957
2806
|
}
|
|
2958
2807
|
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
if (
|
|
2963
|
-
|
|
2964
|
-
|
|
2808
|
+
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
2809
|
+
function _getValidZova(instance) {
|
|
2810
|
+
while (instance) {
|
|
2811
|
+
if (instance.zova) return instance.zova;
|
|
2812
|
+
instance = instance.parent;
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
2816
|
+
// @__NO_SIDE_EFFECTS__
|
|
2817
|
+
function defineAsyncComponent(source) {
|
|
2818
|
+
if (shared.isFunction(source)) {
|
|
2819
|
+
source = { loader: source };
|
|
2820
|
+
}
|
|
2821
|
+
const {
|
|
2822
|
+
loader,
|
|
2823
|
+
loadingComponent,
|
|
2824
|
+
errorComponent,
|
|
2825
|
+
delay = 200,
|
|
2826
|
+
hydrate: hydrateStrategy,
|
|
2827
|
+
timeout,
|
|
2828
|
+
// undefined = never times out
|
|
2829
|
+
suspensible = true,
|
|
2830
|
+
onError: userOnError
|
|
2831
|
+
} = source;
|
|
2832
|
+
let pendingRequest = null;
|
|
2833
|
+
let resolvedComp;
|
|
2834
|
+
let retries = 0;
|
|
2835
|
+
const retry = () => {
|
|
2836
|
+
retries++;
|
|
2837
|
+
pendingRequest = null;
|
|
2838
|
+
return load();
|
|
2839
|
+
};
|
|
2840
|
+
const load = () => {
|
|
2841
|
+
let thisRequest;
|
|
2842
|
+
return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
|
2843
|
+
err = err instanceof Error ? err : new Error(String(err));
|
|
2844
|
+
if (userOnError) {
|
|
2845
|
+
return new Promise((resolve, reject) => {
|
|
2846
|
+
const userRetry = () => resolve(retry());
|
|
2847
|
+
const userFail = () => reject(err);
|
|
2848
|
+
userOnError(err, userRetry, userFail, retries + 1);
|
|
2849
|
+
});
|
|
2850
|
+
} else {
|
|
2851
|
+
throw err;
|
|
2965
2852
|
}
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2853
|
+
}).then((comp) => {
|
|
2854
|
+
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
2855
|
+
return pendingRequest;
|
|
2856
|
+
}
|
|
2857
|
+
if (!comp) {
|
|
2858
|
+
warn$1(
|
|
2859
|
+
`Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
|
|
2860
|
+
);
|
|
2861
|
+
}
|
|
2862
|
+
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
|
2863
|
+
comp = comp.default;
|
|
2864
|
+
}
|
|
2865
|
+
if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
|
|
2866
|
+
throw new Error(`Invalid async component load result: ${comp}`);
|
|
2867
|
+
}
|
|
2868
|
+
resolvedComp = comp;
|
|
2869
|
+
return comp;
|
|
2870
|
+
}));
|
|
2871
|
+
};
|
|
2872
|
+
return defineComponent({
|
|
2873
|
+
name: "AsyncComponentWrapper",
|
|
2874
|
+
__asyncLoader: load,
|
|
2875
|
+
__asyncHydrate(el, instance, hydrate) {
|
|
2876
|
+
const doHydrate = hydrateStrategy ? () => {
|
|
2877
|
+
const teardown = hydrateStrategy(
|
|
2878
|
+
hydrate,
|
|
2879
|
+
(cb) => forEachElement(el, cb)
|
|
2880
|
+
);
|
|
2881
|
+
if (teardown) {
|
|
2882
|
+
(instance.bum || (instance.bum = [])).push(teardown);
|
|
2883
|
+
}
|
|
2884
|
+
} : hydrate;
|
|
2885
|
+
if (resolvedComp) {
|
|
2886
|
+
doHydrate();
|
|
2887
|
+
} else {
|
|
2888
|
+
const zova = _getValidZova(instance);
|
|
2889
|
+
zova.meta.$ssr._hydratingInc();
|
|
2890
|
+
load().then(() => {
|
|
2891
|
+
!instance.isUnmounted && doHydrate();
|
|
2892
|
+
zova.meta.$ssr._hydratingDec();
|
|
2893
|
+
});
|
|
2894
|
+
}
|
|
2895
|
+
},
|
|
2896
|
+
get __asyncResolved() {
|
|
2897
|
+
return resolvedComp;
|
|
2898
|
+
},
|
|
2899
|
+
setup() {
|
|
2900
|
+
const instance = currentInstance;
|
|
2901
|
+
markAsyncBoundary(instance);
|
|
2902
|
+
if (resolvedComp) {
|
|
2903
|
+
return () => createInnerComp(resolvedComp, instance);
|
|
2904
|
+
}
|
|
2905
|
+
const onError = (err) => {
|
|
2906
|
+
pendingRequest = null;
|
|
2907
|
+
handleError(
|
|
2908
|
+
err,
|
|
2909
|
+
instance,
|
|
2910
|
+
13,
|
|
2911
|
+
!errorComponent
|
|
2912
|
+
);
|
|
2913
|
+
};
|
|
2914
|
+
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
2915
|
+
return load().then((comp) => {
|
|
2916
|
+
return () => createInnerComp(comp, instance);
|
|
2917
|
+
}).catch((err) => {
|
|
2918
|
+
onError(err);
|
|
2919
|
+
return () => errorComponent ? createVNode(errorComponent, {
|
|
2920
|
+
error: err
|
|
2921
|
+
}) : null;
|
|
2922
|
+
});
|
|
2923
|
+
}
|
|
2924
|
+
const loaded = reactivity.ref(false);
|
|
2925
|
+
const error = reactivity.ref();
|
|
2926
|
+
const delayed = reactivity.ref(!!delay);
|
|
2927
|
+
if (delay) {
|
|
2928
|
+
setTimeout(() => {
|
|
2929
|
+
delayed.value = false;
|
|
2930
|
+
}, delay);
|
|
2931
|
+
}
|
|
2932
|
+
if (timeout != null) {
|
|
2933
|
+
setTimeout(() => {
|
|
2934
|
+
if (!loaded.value && !error.value) {
|
|
2935
|
+
const err = new Error(
|
|
2936
|
+
`Async component timed out after ${timeout}ms.`
|
|
2937
|
+
);
|
|
2938
|
+
onError(err);
|
|
2939
|
+
error.value = err;
|
|
2940
|
+
}
|
|
2941
|
+
}, timeout);
|
|
2942
|
+
}
|
|
2943
|
+
load().then(() => {
|
|
2944
|
+
loaded.value = true;
|
|
2945
|
+
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
2946
|
+
instance.parent.update();
|
|
2947
|
+
}
|
|
2948
|
+
}).catch((err) => {
|
|
2949
|
+
onError(err);
|
|
2950
|
+
error.value = err;
|
|
2951
|
+
});
|
|
2952
|
+
return () => {
|
|
2953
|
+
if (loaded.value && resolvedComp) {
|
|
2954
|
+
return createInnerComp(resolvedComp, instance);
|
|
2955
|
+
} else if (error.value && errorComponent) {
|
|
2956
|
+
return createVNode(errorComponent, {
|
|
2957
|
+
error: error.value
|
|
2958
|
+
});
|
|
2959
|
+
} else if (loadingComponent && !delayed.value) {
|
|
2960
|
+
return createVNode(loadingComponent);
|
|
2961
|
+
}
|
|
2962
|
+
};
|
|
2972
2963
|
}
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2964
|
+
});
|
|
2965
|
+
}
|
|
2966
|
+
function createInnerComp(comp, parent) {
|
|
2967
|
+
const { ref: ref2, props, children, ce } = parent.vnode;
|
|
2968
|
+
const vnode = createVNode(comp, props, children);
|
|
2969
|
+
vnode.ref = ref2;
|
|
2970
|
+
vnode.ce = ce;
|
|
2971
|
+
delete parent.vnode.ce;
|
|
2972
|
+
vnode.zovaHostProviders = parent.vnode.zovaHostProviders;
|
|
2973
|
+
return vnode;
|
|
2975
2974
|
}
|
|
2976
2975
|
|
|
2977
2976
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|