@lwc/engine-core 4.0.0 → 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/reporting.d.ts +9 -1
- package/dist/framework/vnodes.d.ts +2 -2
- package/dist/index.cjs.js +58 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +58 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -74,6 +74,12 @@ function report(reportingEventId, payload) {
|
|
|
74
74
|
currentDispatcher$1(reportingEventId, payload);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Return true if reporting is enabled
|
|
79
|
+
*/
|
|
80
|
+
function isReportingEnabled() {
|
|
81
|
+
return enabled$1;
|
|
82
|
+
}
|
|
77
83
|
|
|
78
84
|
/*
|
|
79
85
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4157,17 +4163,16 @@ function unmount(vnode, parent, renderer, doRemove = false) {
|
|
|
4157
4163
|
const { type, elm, sel } = vnode;
|
|
4158
4164
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4159
4165
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
4160
|
-
if (doRemove) {
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
else {
|
|
4165
|
-
// The vnode might or might not have a data.renderer associated to it
|
|
4166
|
-
// but the removal used here is from the owner instead.
|
|
4167
|
-
removeNode(elm, parent, renderer);
|
|
4168
|
-
}
|
|
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);
|
|
4169
4170
|
}
|
|
4170
4171
|
switch (type) {
|
|
4172
|
+
case 5 /* VNodeType.Fragment */: {
|
|
4173
|
+
unmountVNodes(vnode.children, parent, renderer, doRemove);
|
|
4174
|
+
break;
|
|
4175
|
+
}
|
|
4171
4176
|
case 2 /* VNodeType.Element */: {
|
|
4172
4177
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
4173
4178
|
// Only required for synthetic shadow.
|
|
@@ -4706,8 +4711,10 @@ function st(fragment, key, parts) {
|
|
|
4706
4711
|
}
|
|
4707
4712
|
// [fr]agment node
|
|
4708
4713
|
function fr(key, children, stable) {
|
|
4709
|
-
const
|
|
4710
|
-
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('');
|
|
4711
4718
|
return {
|
|
4712
4719
|
type: 5 /* VNodeType.Fragment */,
|
|
4713
4720
|
sel: undefined,
|
|
@@ -4715,7 +4722,7 @@ function fr(key, children, stable) {
|
|
|
4715
4722
|
elm: undefined,
|
|
4716
4723
|
children: [leading, ...children, trailing],
|
|
4717
4724
|
stable,
|
|
4718
|
-
owner
|
|
4725
|
+
owner,
|
|
4719
4726
|
leading,
|
|
4720
4727
|
trailing,
|
|
4721
4728
|
};
|
|
@@ -6034,6 +6041,24 @@ function runConnectedCallback(vm) {
|
|
|
6034
6041
|
invokeComponentCallback(vm, connectedCallback);
|
|
6035
6042
|
logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
|
|
6036
6043
|
}
|
|
6044
|
+
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
|
6045
|
+
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
|
6046
|
+
if (process.env.IS_BROWSER &&
|
|
6047
|
+
!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE &&
|
|
6048
|
+
(process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
|
6049
|
+
if (!vm.renderer.isConnected(vm.elm)) {
|
|
6050
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6051
|
+
logWarnOnce(`Element <${vm.tagName}> ` +
|
|
6052
|
+
`fired a \`connectedCallback\` and rendered, but was not connected to the DOM. ` +
|
|
6053
|
+
`Please ensure all components are actually connected to the DOM, e.g. using ` +
|
|
6054
|
+
`\`document.body.appendChild(element)\`. This will not be supported in future versions of ` +
|
|
6055
|
+
`LWC and could cause component errors. For details, see: https://sfdc.co/synthetic-lifecycle`);
|
|
6056
|
+
}
|
|
6057
|
+
report("ConnectedCallbackWhileDisconnected" /* ReportingEventId.ConnectedCallbackWhileDisconnected */, {
|
|
6058
|
+
tagName: vm.tagName,
|
|
6059
|
+
});
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6037
6062
|
}
|
|
6038
6063
|
function hasWireAdapters(vm) {
|
|
6039
6064
|
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
@@ -6543,7 +6568,7 @@ function hydrateVM(vm) {
|
|
|
6543
6568
|
// reset the refs; they will be set during `hydrateChildren`
|
|
6544
6569
|
resetRefVNodes(vm);
|
|
6545
6570
|
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6546
|
-
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6571
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
|
|
6547
6572
|
runRenderedCallback(vm);
|
|
6548
6573
|
}
|
|
6549
6574
|
function hydrateNode(node, vnode, renderer) {
|
|
@@ -6655,7 +6680,7 @@ function hydrateStaticElement(elm, vnode, renderer) {
|
|
|
6655
6680
|
}
|
|
6656
6681
|
function hydrateFragment(elm, vnode, renderer) {
|
|
6657
6682
|
const { children, owner } = vnode;
|
|
6658
|
-
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner);
|
|
6683
|
+
hydrateChildren(elm, children, renderer.getProperty(elm, 'parentNode'), owner, true);
|
|
6659
6684
|
return (vnode.elm = children[children.length - 1].elm);
|
|
6660
6685
|
}
|
|
6661
6686
|
function hydrateElement(elm, vnode, renderer) {
|
|
@@ -6687,7 +6712,7 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6687
6712
|
patchElementPropsAndAttrsAndRefs(vnode, renderer);
|
|
6688
6713
|
if (!isDomManual) {
|
|
6689
6714
|
const { getFirstChild } = renderer;
|
|
6690
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6715
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner, false);
|
|
6691
6716
|
}
|
|
6692
6717
|
return elm;
|
|
6693
6718
|
}
|
|
@@ -6729,12 +6754,16 @@ function hydrateCustomElement(elm, vnode, renderer) {
|
|
|
6729
6754
|
const { getFirstChild } = renderer;
|
|
6730
6755
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6731
6756
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6732
|
-
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6757
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm, false);
|
|
6733
6758
|
}
|
|
6734
6759
|
hydrateVM(vm);
|
|
6735
6760
|
return elm;
|
|
6736
6761
|
}
|
|
6737
|
-
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) {
|
|
6738
6767
|
let hasWarned = false;
|
|
6739
6768
|
let nextNode = node;
|
|
6740
6769
|
const { renderer } = owner;
|
|
@@ -6757,7 +6786,17 @@ function hydrateChildren(node, children, parentNode, owner) {
|
|
|
6757
6786
|
}
|
|
6758
6787
|
}
|
|
6759
6788
|
}
|
|
6760
|
-
|
|
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) {
|
|
6761
6800
|
hasMismatch = true;
|
|
6762
6801
|
if (process.env.NODE_ENV !== 'production') {
|
|
6763
6802
|
if (!hasWarned) {
|
|
@@ -7267,5 +7306,5 @@ function readonly(obj) {
|
|
|
7267
7306
|
}
|
|
7268
7307
|
|
|
7269
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 };
|
|
7270
|
-
/** version:
|
|
7309
|
+
/** version: 5.0.0 */
|
|
7271
7310
|
//# sourceMappingURL=index.js.map
|