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