@lwc/engine-core 4.0.1 → 5.0.0
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/framework/vnodes.d.ts +2 -2
- package/dist/index.cjs.js +34 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +34 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -45,8 +45,8 @@ export interface VFragment extends BaseVNode, BaseVParent {
|
|
|
45
45
|
sel: undefined;
|
|
46
46
|
type: VNodeType.Fragment;
|
|
47
47
|
stable: 0 | 1;
|
|
48
|
-
leading: VText;
|
|
49
|
-
trailing: VText;
|
|
48
|
+
leading: VText | VComment;
|
|
49
|
+
trailing: VText | VComment;
|
|
50
50
|
}
|
|
51
51
|
export interface VText extends BaseVNode {
|
|
52
52
|
type: VNodeType.Text;
|
package/dist/index.cjs.js
CHANGED
|
@@ -4167,17 +4167,16 @@ function unmount(vnode, parent, renderer, doRemove = false) {
|
|
|
4167
4167
|
const { type, elm, sel } = vnode;
|
|
4168
4168
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4169
4169
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
4170
|
-
if (doRemove) {
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
else {
|
|
4175
|
-
// The vnode might or might not have a data.renderer associated to it
|
|
4176
|
-
// but the removal used here is from the owner instead.
|
|
4177
|
-
removeNode(elm, parent, renderer);
|
|
4178
|
-
}
|
|
4170
|
+
if (doRemove && type !== 5 /* VNodeType.Fragment */) {
|
|
4171
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
4172
|
+
// but the removal used here is from the owner instead.
|
|
4173
|
+
removeNode(elm, parent, renderer);
|
|
4179
4174
|
}
|
|
4180
4175
|
switch (type) {
|
|
4176
|
+
case 5 /* VNodeType.Fragment */: {
|
|
4177
|
+
unmountVNodes(vnode.children, parent, renderer, doRemove);
|
|
4178
|
+
break;
|
|
4179
|
+
}
|
|
4181
4180
|
case 2 /* VNodeType.Element */: {
|
|
4182
4181
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
4183
4182
|
// Only required for synthetic shadow.
|
|
@@ -4716,8 +4715,10 @@ function st(fragment, key, parts) {
|
|
|
4716
4715
|
}
|
|
4717
4716
|
// [fr]agment node
|
|
4718
4717
|
function fr(key, children, stable) {
|
|
4719
|
-
const
|
|
4720
|
-
const
|
|
4718
|
+
const owner = getVMBeingRendered();
|
|
4719
|
+
const useCommentNodes = shared.isAPIFeatureEnabled(5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */, owner.apiVersion);
|
|
4720
|
+
const leading = useCommentNodes ? co('') : t('');
|
|
4721
|
+
const trailing = useCommentNodes ? co('') : t('');
|
|
4721
4722
|
return {
|
|
4722
4723
|
type: 5 /* VNodeType.Fragment */,
|
|
4723
4724
|
sel: undefined,
|
|
@@ -4725,7 +4726,7 @@ function fr(key, children, stable) {
|
|
|
4725
4726
|
elm: undefined,
|
|
4726
4727
|
children: [leading, ...children, trailing],
|
|
4727
4728
|
stable,
|
|
4728
|
-
owner
|
|
4729
|
+
owner,
|
|
4729
4730
|
leading,
|
|
4730
4731
|
trailing,
|
|
4731
4732
|
};
|
|
@@ -6571,7 +6572,7 @@ function hydrateVM(vm) {
|
|
|
6571
6572
|
// reset the refs; they will be set during `hydrateChildren`
|
|
6572
6573
|
resetRefVNodes(vm);
|
|
6573
6574
|
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6574
|
-
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6575
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
|
|
6575
6576
|
runRenderedCallback(vm);
|
|
6576
6577
|
}
|
|
6577
6578
|
function hydrateNode(node, vnode, renderer) {
|
|
@@ -6683,7 +6684,7 @@ function hydrateStaticElement(elm, vnode, renderer) {
|
|
|
6683
6684
|
}
|
|
6684
6685
|
function hydrateFragment(elm, vnode, renderer) {
|
|
6685
6686
|
const { children, owner } = vnode;
|
|
6686
|
-
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner);
|
|
6687
|
+
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner, true);
|
|
6687
6688
|
return (vnode.elm = children[children.length - 1].elm);
|
|
6688
6689
|
}
|
|
6689
6690
|
function hydrateElement(elm, vnode, renderer) {
|
|
@@ -6715,7 +6716,7 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6715
6716
|
patchElementPropsAndAttrsAndRefs(vnode, renderer);
|
|
6716
6717
|
if (!isDomManual) {
|
|
6717
6718
|
const { getFirstChild } = renderer;
|
|
6718
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6719
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner, false);
|
|
6719
6720
|
}
|
|
6720
6721
|
return elm;
|
|
6721
6722
|
}
|
|
@@ -6757,12 +6758,16 @@ function hydrateCustomElement(elm, vnode, renderer) {
|
|
|
6757
6758
|
const { getFirstChild } = renderer;
|
|
6758
6759
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6759
6760
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6760
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6761
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm, false);
|
|
6761
6762
|
}
|
|
6762
6763
|
hydrateVM(vm);
|
|
6763
6764
|
return elm;
|
|
6764
6765
|
}
|
|
6765
|
-
function hydrateChildren(node, children, parentNode, owner
|
|
6766
|
+
function hydrateChildren(node, children, parentNode, owner,
|
|
6767
|
+
// When rendering the children of a VFragment, additional siblings may follow the
|
|
6768
|
+
// last node of the fragment. Hydration should not fail if a trailing sibling is
|
|
6769
|
+
// found in this case.
|
|
6770
|
+
expectAddlSiblings) {
|
|
6766
6771
|
let hasWarned = false;
|
|
6767
6772
|
let nextNode = node;
|
|
6768
6773
|
const { renderer } = owner;
|
|
@@ -6785,7 +6790,17 @@ function hydrateChildren(node, children, parentNode, owner) {
|
|
|
6785
6790
|
}
|
|
6786
6791
|
}
|
|
6787
6792
|
}
|
|
6788
|
-
|
|
6793
|
+
const useCommentsForBookends = shared.isAPIFeatureEnabled(5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */, owner.apiVersion);
|
|
6794
|
+
if (
|
|
6795
|
+
// If 1) comments are used for bookends, and 2) we're not expecting additional siblings,
|
|
6796
|
+
// and 3) there exists an additional sibling, that's a hydration failure.
|
|
6797
|
+
//
|
|
6798
|
+
// This preserves the previous behavior for text-node bookends where mismatches
|
|
6799
|
+
// would incorrectly occur but which is unfortunately baked into the SSR hydration
|
|
6800
|
+
// contract. It also preserves the behavior of valid hydration failures where the server
|
|
6801
|
+
// rendered more nodes than the client.
|
|
6802
|
+
(!useCommentsForBookends || !expectAddlSiblings) &&
|
|
6803
|
+
nextNode) {
|
|
6789
6804
|
hasMismatch = true;
|
|
6790
6805
|
if (process.env.NODE_ENV !== 'production') {
|
|
6791
6806
|
if (!hasWarned) {
|
|
@@ -7337,5 +7352,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7337
7352
|
exports.track = track;
|
|
7338
7353
|
exports.unwrap = unwrap;
|
|
7339
7354
|
exports.wire = wire;
|
|
7340
|
-
/** version:
|
|
7355
|
+
/** version: 5.0.0 */
|
|
7341
7356
|
//# sourceMappingURL=index.cjs.js.map
|