@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
package/dist/index.js
CHANGED
|
@@ -4163,17 +4163,16 @@ function unmount(vnode, parent, renderer, doRemove = false) {
|
|
|
4163
4163
|
const { type, elm, sel } = vnode;
|
|
4164
4164
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4165
4165
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
4166
|
-
if (doRemove) {
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
else {
|
|
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);
|
|
4174
|
-
}
|
|
4166
|
+
if (doRemove && type !== 5 /* VNodeType.Fragment */) {
|
|
4167
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
4168
|
+
// but the removal used here is from the owner instead.
|
|
4169
|
+
removeNode(elm, parent, renderer);
|
|
4175
4170
|
}
|
|
4176
4171
|
switch (type) {
|
|
4172
|
+
case 5 /* VNodeType.Fragment */: {
|
|
4173
|
+
unmountVNodes(vnode.children, parent, renderer, doRemove);
|
|
4174
|
+
break;
|
|
4175
|
+
}
|
|
4177
4176
|
case 2 /* VNodeType.Element */: {
|
|
4178
4177
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
4179
4178
|
// Only required for synthetic shadow.
|
|
@@ -4712,8 +4711,10 @@ function st(fragment, key, parts) {
|
|
|
4712
4711
|
}
|
|
4713
4712
|
// [fr]agment node
|
|
4714
4713
|
function fr(key, children, stable) {
|
|
4715
|
-
const
|
|
4716
|
-
const
|
|
4714
|
+
const owner = getVMBeingRendered();
|
|
4715
|
+
const useCommentNodes = isAPIFeatureEnabled(5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */, owner.apiVersion);
|
|
4716
|
+
const leading = useCommentNodes ? co('') : t('');
|
|
4717
|
+
const trailing = useCommentNodes ? co('') : t('');
|
|
4717
4718
|
return {
|
|
4718
4719
|
type: 5 /* VNodeType.Fragment */,
|
|
4719
4720
|
sel: undefined,
|
|
@@ -4721,7 +4722,7 @@ function fr(key, children, stable) {
|
|
|
4721
4722
|
elm: undefined,
|
|
4722
4723
|
children: [leading, ...children, trailing],
|
|
4723
4724
|
stable,
|
|
4724
|
-
owner
|
|
4725
|
+
owner,
|
|
4725
4726
|
leading,
|
|
4726
4727
|
trailing,
|
|
4727
4728
|
};
|
|
@@ -6567,7 +6568,7 @@ function hydrateVM(vm) {
|
|
|
6567
6568
|
// reset the refs; they will be set during `hydrateChildren`
|
|
6568
6569
|
resetRefVNodes(vm);
|
|
6569
6570
|
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6570
|
-
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6571
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
|
|
6571
6572
|
runRenderedCallback(vm);
|
|
6572
6573
|
}
|
|
6573
6574
|
function hydrateNode(node, vnode, renderer) {
|
|
@@ -6679,7 +6680,7 @@ function hydrateStaticElement(elm, vnode, renderer) {
|
|
|
6679
6680
|
}
|
|
6680
6681
|
function hydrateFragment(elm, vnode, renderer) {
|
|
6681
6682
|
const { children, owner } = vnode;
|
|
6682
|
-
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner);
|
|
6683
|
+
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner, true);
|
|
6683
6684
|
return (vnode.elm = children[children.length - 1].elm);
|
|
6684
6685
|
}
|
|
6685
6686
|
function hydrateElement(elm, vnode, renderer) {
|
|
@@ -6711,7 +6712,7 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6711
6712
|
patchElementPropsAndAttrsAndRefs(vnode, renderer);
|
|
6712
6713
|
if (!isDomManual) {
|
|
6713
6714
|
const { getFirstChild } = renderer;
|
|
6714
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6715
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner, false);
|
|
6715
6716
|
}
|
|
6716
6717
|
return elm;
|
|
6717
6718
|
}
|
|
@@ -6753,12 +6754,16 @@ function hydrateCustomElement(elm, vnode, renderer) {
|
|
|
6753
6754
|
const { getFirstChild } = renderer;
|
|
6754
6755
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6755
6756
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6756
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6757
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm, false);
|
|
6757
6758
|
}
|
|
6758
6759
|
hydrateVM(vm);
|
|
6759
6760
|
return elm;
|
|
6760
6761
|
}
|
|
6761
|
-
function hydrateChildren(node, children, parentNode, owner
|
|
6762
|
+
function hydrateChildren(node, children, parentNode, owner,
|
|
6763
|
+
// When rendering the children of a VFragment, additional siblings may follow the
|
|
6764
|
+
// last node of the fragment. Hydration should not fail if a trailing sibling is
|
|
6765
|
+
// found in this case.
|
|
6766
|
+
expectAddlSiblings) {
|
|
6762
6767
|
let hasWarned = false;
|
|
6763
6768
|
let nextNode = node;
|
|
6764
6769
|
const { renderer } = owner;
|
|
@@ -6781,7 +6786,17 @@ function hydrateChildren(node, children, parentNode, owner) {
|
|
|
6781
6786
|
}
|
|
6782
6787
|
}
|
|
6783
6788
|
}
|
|
6784
|
-
|
|
6789
|
+
const useCommentsForBookends = isAPIFeatureEnabled(5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */, owner.apiVersion);
|
|
6790
|
+
if (
|
|
6791
|
+
// If 1) comments are used for bookends, and 2) we're not expecting additional siblings,
|
|
6792
|
+
// and 3) there exists an additional sibling, that's a hydration failure.
|
|
6793
|
+
//
|
|
6794
|
+
// This preserves the previous behavior for text-node bookends where mismatches
|
|
6795
|
+
// would incorrectly occur but which is unfortunately baked into the SSR hydration
|
|
6796
|
+
// contract. It also preserves the behavior of valid hydration failures where the server
|
|
6797
|
+
// rendered more nodes than the client.
|
|
6798
|
+
(!useCommentsForBookends || !expectAddlSiblings) &&
|
|
6799
|
+
nextNode) {
|
|
6785
6800
|
hasMismatch = true;
|
|
6786
6801
|
if (process.env.NODE_ENV !== 'production') {
|
|
6787
6802
|
if (!hasWarned) {
|
|
@@ -7291,5 +7306,5 @@ function readonly(obj) {
|
|
|
7291
7306
|
}
|
|
7292
7307
|
|
|
7293
7308
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7294
|
-
/** version:
|
|
7309
|
+
/** version: 5.0.0 */
|
|
7295
7310
|
//# sourceMappingURL=index.js.map
|