@lwc/engine-core 2.11.1 → 2.11.3-238prod.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.
@@ -1,5 +1,5 @@
1
1
  /* proxy-compat-disable */
2
- import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, isFrozen, defineProperty, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, assert, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, freeze, htmlPropertyToAttribute, ArraySlice, hasOwnProperty as hasOwnProperty$1, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_RESOLVER, isArray as isArray$1, isNumber, StringReplace, KEY__SCOPED_CSS, noop, ArrayUnshift, ArrayFilter } from '@lwc/shared';
2
+ import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, isFrozen, defineProperty, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, assert, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, freeze, htmlPropertyToAttribute, ArraySlice, hasOwnProperty as hasOwnProperty$1, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_RESOLVER, isArray as isArray$1, isNumber, StringReplace, KEY__SCOPED_CSS, noop, ArrayUnshift } from '@lwc/shared';
3
3
  import { runtimeFlags } from '@lwc/features';
4
4
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
5
5
 
@@ -4799,236 +4799,6 @@ function invokeServiceHook(vm, cbs) {
4799
4799
  }
4800
4800
  }
4801
4801
 
4802
- /*
4803
- * Copyright (c) 2022, salesforce.com, inc.
4804
- * All rights reserved.
4805
- * SPDX-License-Identifier: MIT
4806
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4807
- */
4808
- function hydrate(vnode, node) {
4809
- switch (vnode.type) {
4810
- case 0 /* Text */:
4811
- hydrateText(vnode, node);
4812
- break;
4813
- case 1 /* Comment */:
4814
- hydrateComment(vnode, node);
4815
- break;
4816
- case 2 /* Element */:
4817
- hydrateElement(vnode, node);
4818
- break;
4819
- case 3 /* CustomElement */:
4820
- hydrateCustomElement(vnode, node);
4821
- break;
4822
- }
4823
- }
4824
- function hydrateText(vnode, node) {
4825
- var _a;
4826
- if (process.env.NODE_ENV !== 'production') {
4827
- validateNodeType(vnode, node, 3 /* TEXT */);
4828
- const nodeValue = getProperty(node, 'nodeValue');
4829
- if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
4830
- logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
4831
- }
4832
- }
4833
- // always set the text value to the one from the vnode.
4834
- setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
4835
- vnode.elm = node;
4836
- }
4837
- function hydrateComment(vnode, node) {
4838
- var _a;
4839
- if (process.env.NODE_ENV !== 'production') {
4840
- validateNodeType(vnode, node, 8 /* COMMENT */);
4841
- if (getProperty(node, 'nodeValue') !== vnode.text) {
4842
- logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
4843
- }
4844
- }
4845
- // always set the text value to the one from the vnode.
4846
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
4847
- vnode.elm = node;
4848
- }
4849
- function hydrateElement(vnode, node) {
4850
- if (process.env.NODE_ENV !== 'production') {
4851
- validateNodeType(vnode, node, 1 /* ELEMENT */);
4852
- validateElement(vnode, node);
4853
- }
4854
- const elm = node;
4855
- vnode.elm = elm;
4856
- const { context } = vnode.data;
4857
- const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
4858
- if (isDomManual) {
4859
- // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
4860
- // remove the innerHTML from props so it reuses the existing dom elements.
4861
- const { props } = vnode.data;
4862
- if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
4863
- if (getProperty(elm, 'innerHTML') === props.innerHTML) {
4864
- // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
4865
- vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
4866
- }
4867
- else {
4868
- logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
4869
- }
4870
- }
4871
- }
4872
- patchElementPropsAndAttrs(vnode);
4873
- if (!isDomManual) {
4874
- hydrateChildren(getChildNodes(vnode.elm), vnode.children, vnode.owner);
4875
- }
4876
- }
4877
- function hydrateCustomElement(vnode, node) {
4878
- if (process.env.NODE_ENV !== 'production') {
4879
- validateNodeType(vnode, node, 1 /* ELEMENT */);
4880
- validateElement(vnode, node);
4881
- }
4882
- const elm = node;
4883
- const { sel, mode, ctor, owner } = vnode;
4884
- const vm = createVM(elm, ctor, {
4885
- mode,
4886
- owner,
4887
- tagName: sel,
4888
- });
4889
- vnode.elm = elm;
4890
- vnode.vm = vm;
4891
- allocateChildren(vnode, vm);
4892
- patchElementPropsAndAttrs(vnode);
4893
- // Insert hook section:
4894
- if (process.env.NODE_ENV !== 'production') {
4895
- assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
4896
- }
4897
- runConnectedCallback(vm);
4898
- if (vm.renderMode !== 0 /* Light */) {
4899
- // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
4900
- // Note: for Light DOM, this is handled while hydrating the VM
4901
- hydrateChildren(getChildNodes(vnode.elm), vnode.children, vm);
4902
- }
4903
- hydrateVM(vm);
4904
- }
4905
- function hydrateChildren(elmChildren, children, vm) {
4906
- if (process.env.NODE_ENV !== 'production') {
4907
- const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
4908
- if (elmChildren.length !== filteredVNodes.length) {
4909
- logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
4910
- throwHydrationError();
4911
- }
4912
- }
4913
- let childNodeIndex = 0;
4914
- for (let i = 0; i < children.length; i++) {
4915
- const childVnode = children[i];
4916
- if (!isNull(childVnode)) {
4917
- const childNode = elmChildren[childNodeIndex];
4918
- hydrate(childVnode, childNode);
4919
- childNodeIndex++;
4920
- }
4921
- }
4922
- }
4923
- function patchElementPropsAndAttrs(vnode) {
4924
- applyEventListeners(vnode);
4925
- patchProps(null, vnode);
4926
- }
4927
- function throwHydrationError() {
4928
- assert.fail('Server rendered elements do not match client side generated elements');
4929
- }
4930
- function validateNodeType(vnode, node, nodeType) {
4931
- if (getProperty(node, 'nodeType') !== nodeType) {
4932
- logError('Hydration mismatch: incorrect node type received', vnode.owner);
4933
- assert.fail('Hydration mismatch: incorrect node type received.');
4934
- }
4935
- }
4936
- function validateElement(vnode, elm) {
4937
- if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
4938
- logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
4939
- throwHydrationError();
4940
- }
4941
- const hasIncompatibleAttrs = validateAttrs(vnode, elm);
4942
- const hasIncompatibleClass = validateClassAttr(vnode, elm);
4943
- const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
4944
- const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
4945
- if (!isVNodeAndElementCompatible) {
4946
- throwHydrationError();
4947
- }
4948
- }
4949
- function validateAttrs(vnode, elm) {
4950
- const { data: { attrs = {} }, } = vnode;
4951
- let nodesAreCompatible = true;
4952
- // Validate attributes, though we could always recovery from those by running the update mods.
4953
- // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
4954
- for (const [attrName, attrValue] of Object.entries(attrs)) {
4955
- const elmAttrValue = getAttribute(elm, attrName);
4956
- if (String(attrValue) !== elmAttrValue) {
4957
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
4958
- nodesAreCompatible = false;
4959
- }
4960
- }
4961
- return nodesAreCompatible;
4962
- }
4963
- function validateClassAttr(vnode, elm) {
4964
- const { data: { className, classMap }, } = vnode;
4965
- let nodesAreCompatible = true;
4966
- let vnodeClassName;
4967
- if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
4968
- // className is used when class is bound to an expr.
4969
- nodesAreCompatible = false;
4970
- vnodeClassName = className;
4971
- }
4972
- else if (!isUndefined$1(classMap)) {
4973
- // classMap is used when class is set to static value.
4974
- const classList = getClassList(elm);
4975
- let computedClassName = '';
4976
- // all classes from the vnode should be in the element.classList
4977
- for (const name in classMap) {
4978
- computedClassName += ' ' + name;
4979
- if (!classList.contains(name)) {
4980
- nodesAreCompatible = false;
4981
- }
4982
- }
4983
- vnodeClassName = computedClassName.trim();
4984
- if (classList.length > keys(classMap).length) {
4985
- nodesAreCompatible = false;
4986
- }
4987
- }
4988
- if (!nodesAreCompatible) {
4989
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
4990
- }
4991
- return nodesAreCompatible;
4992
- }
4993
- function validateStyleAttr(vnode, elm) {
4994
- const { data: { style, styleDecls }, } = vnode;
4995
- const elmStyle = getAttribute(elm, 'style') || '';
4996
- let vnodeStyle;
4997
- let nodesAreCompatible = true;
4998
- if (!isUndefined$1(style) && style !== elmStyle) {
4999
- nodesAreCompatible = false;
5000
- vnodeStyle = style;
5001
- }
5002
- else if (!isUndefined$1(styleDecls)) {
5003
- const parsedVnodeStyle = parseStyleText(elmStyle);
5004
- const expectedStyle = [];
5005
- // styleMap is used when style is set to static value.
5006
- for (let i = 0, n = styleDecls.length; i < n; i++) {
5007
- const [prop, value, important] = styleDecls[i];
5008
- expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
5009
- const parsedPropValue = parsedVnodeStyle[prop];
5010
- if (isUndefined$1(parsedPropValue)) {
5011
- nodesAreCompatible = false;
5012
- }
5013
- else if (!parsedPropValue.startsWith(value)) {
5014
- nodesAreCompatible = false;
5015
- }
5016
- else if (important && !parsedPropValue.endsWith('!important')) {
5017
- nodesAreCompatible = false;
5018
- }
5019
- }
5020
- if (keys(parsedVnodeStyle).length > styleDecls.length) {
5021
- nodesAreCompatible = false;
5022
- }
5023
- vnodeStyle = ArrayJoin.call(expectedStyle, ';');
5024
- }
5025
- if (!nodesAreCompatible) {
5026
- // style is used when class is bound to an expr.
5027
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
5028
- }
5029
- return nodesAreCompatible;
5030
- }
5031
-
5032
4802
  /*
5033
4803
  * Copyright (c) 2018, salesforce.com, inc.
5034
4804
  * All rights reserved.
@@ -5074,32 +4844,12 @@ function connectRootElement(elm) {
5074
4844
  /* GlobalHydrate */
5075
4845
  , vm);
5076
4846
  }
5077
- function hydrateRootElement(elm) {
5078
- const vm = getAssociatedVM(elm);
5079
- runConnectedCallback(vm);
5080
- hydrateVM(vm);
5081
- }
5082
4847
  function disconnectRootElement(elm) {
5083
4848
  const vm = getAssociatedVM(elm);
5084
4849
  resetComponentStateWhenRemoved(vm);
5085
4850
  }
5086
4851
  function appendVM(vm) {
5087
4852
  rehydrate(vm);
5088
- }
5089
- function hydrateVM(vm) {
5090
- if (isTrue(vm.isDirty)) {
5091
- // manually diffing/patching here.
5092
- // This routine is:
5093
- // patchShadowRoot(vm, children);
5094
- // -> addVnodes.
5095
- const children = renderComponent(vm);
5096
- vm.children = children;
5097
- const vmChildren = vm.renderMode === 0
5098
- /* Light */
5099
- ? getChildNodes(vm.elm) : getChildNodes(vm.elm.shadowRoot);
5100
- hydrateChildren(vmChildren, children, vm);
5101
- runRenderedCallback(vm);
5102
- }
5103
4853
  } // just in case the component comes back, with this we guarantee re-rendering it
5104
4854
  // while preventing any attempt to rehydration until after reinsertion.
5105
4855
 
@@ -5404,7 +5154,6 @@ function runRenderedCallback(vm) {
5404
5154
  , vm);
5405
5155
  }
5406
5156
  }
5407
-
5408
5157
  let rehydrateQueue = [];
5409
5158
 
5410
5159
  function flushRehydrationQueue() {
@@ -6061,6 +5810,298 @@ function readonly(obj) {
6061
5810
  return reactiveMembrane.getReadOnlyProxy(obj);
6062
5811
  }
6063
5812
 
5813
+ /*
5814
+ * Copyright (c) 2022, salesforce.com, inc.
5815
+ * All rights reserved.
5816
+ * SPDX-License-Identifier: MIT
5817
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5818
+ */
5819
+ // flag indicating if the hydration recovered from the DOM mismatch
5820
+ let hasMismatch = false;
5821
+ function hydrateRoot(vm) {
5822
+ hasMismatch = false;
5823
+ runConnectedCallback(vm);
5824
+ hydrateVM(vm);
5825
+ if (hasMismatch) {
5826
+ logError('Hydration completed with errors.', vm);
5827
+ }
5828
+ }
5829
+ function hydrateVM(vm) {
5830
+ const children = renderComponent(vm);
5831
+ vm.children = children;
5832
+ const parentNode = vm.renderRoot;
5833
+ hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
5834
+ runRenderedCallback(vm);
5835
+ }
5836
+ function hydrateNode(node, vnode) {
5837
+ let hydratedNode;
5838
+ switch (vnode.type) {
5839
+ case 0 /* Text */:
5840
+ hydratedNode = hydrateText(node, vnode);
5841
+ break;
5842
+ case 1 /* Comment */:
5843
+ hydratedNode = hydrateComment(node, vnode);
5844
+ break;
5845
+ case 2 /* Element */:
5846
+ hydratedNode = hydrateElement(node, vnode);
5847
+ break;
5848
+ case 3 /* CustomElement */:
5849
+ hydratedNode = hydrateCustomElement(node, vnode);
5850
+ break;
5851
+ }
5852
+ return nextSibling(hydratedNode);
5853
+ }
5854
+ function hydrateText(node, vnode) {
5855
+ var _a;
5856
+ if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
5857
+ return handleMismatch(node, vnode);
5858
+ }
5859
+ if (process.env.NODE_ENV !== 'production') {
5860
+ const nodeValue = getProperty(node, 'nodeValue');
5861
+ if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
5862
+ logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
5863
+ }
5864
+ }
5865
+ setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5866
+ vnode.elm = node;
5867
+ return node;
5868
+ }
5869
+ function hydrateComment(node, vnode) {
5870
+ var _a;
5871
+ if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
5872
+ return handleMismatch(node, vnode);
5873
+ }
5874
+ if (process.env.NODE_ENV !== 'production') {
5875
+ const nodeValue = getProperty(node, 'nodeValue');
5876
+ if (nodeValue !== vnode.text) {
5877
+ logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
5878
+ }
5879
+ }
5880
+ setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5881
+ vnode.elm = node;
5882
+ return node;
5883
+ }
5884
+ function hydrateElement(elm, vnode) {
5885
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
5886
+ !isMatchingElement(vnode, elm)) {
5887
+ return handleMismatch(elm, vnode);
5888
+ }
5889
+ vnode.elm = elm;
5890
+ const { context } = vnode.data;
5891
+ const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
5892
+ if (isDomManual) {
5893
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5894
+ // remove the innerHTML from props so it reuses the existing dom elements.
5895
+ const { props } = vnode.data;
5896
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5897
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
5898
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5899
+ vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
5900
+ }
5901
+ else {
5902
+ if (process.env.NODE_ENV !== 'production') {
5903
+ logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
5904
+ }
5905
+ }
5906
+ }
5907
+ }
5908
+ patchElementPropsAndAttrs(vnode);
5909
+ if (!isDomManual) {
5910
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vnode.owner);
5911
+ }
5912
+ return elm;
5913
+ }
5914
+ function hydrateCustomElement(elm, vnode) {
5915
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
5916
+ !isMatchingElement(vnode, elm)) {
5917
+ return handleMismatch(elm, vnode);
5918
+ }
5919
+ const { sel, mode, ctor, owner } = vnode;
5920
+ const vm = createVM(elm, ctor, {
5921
+ mode,
5922
+ owner,
5923
+ tagName: sel,
5924
+ });
5925
+ vnode.elm = elm;
5926
+ vnode.vm = vm;
5927
+ allocateChildren(vnode, vm);
5928
+ patchElementPropsAndAttrs(vnode);
5929
+ // Insert hook section:
5930
+ if (process.env.NODE_ENV !== 'production') {
5931
+ assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
5932
+ }
5933
+ runConnectedCallback(vm);
5934
+ if (vm.renderMode !== 0 /* Light */) {
5935
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5936
+ // Note: for Light DOM, this is handled while hydrating the VM
5937
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
5938
+ }
5939
+ hydrateVM(vm);
5940
+ return elm;
5941
+ }
5942
+ function hydrateChildren(node, children, parentNode, owner) {
5943
+ let hasWarned = false;
5944
+ let nextNode = node;
5945
+ let anchor = null;
5946
+ for (let i = 0; i < children.length; i++) {
5947
+ const childVnode = children[i];
5948
+ if (!isNull(childVnode)) {
5949
+ if (nextNode) {
5950
+ nextNode = hydrateNode(nextNode, childVnode);
5951
+ anchor = childVnode.elm;
5952
+ }
5953
+ else {
5954
+ hasMismatch = true;
5955
+ if (process.env.NODE_ENV !== 'production') {
5956
+ if (!hasWarned) {
5957
+ hasWarned = true;
5958
+ logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
5959
+ }
5960
+ }
5961
+ mount(childVnode, parentNode, anchor);
5962
+ anchor = childVnode.elm;
5963
+ }
5964
+ }
5965
+ }
5966
+ if (nextNode) {
5967
+ hasMismatch = true;
5968
+ if (process.env.NODE_ENV !== 'production') {
5969
+ if (!hasWarned) {
5970
+ logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
5971
+ }
5972
+ }
5973
+ do {
5974
+ const current = nextNode;
5975
+ nextNode = nextSibling(nextNode);
5976
+ removeNode(current, parentNode);
5977
+ } while (nextNode);
5978
+ }
5979
+ }
5980
+ function handleMismatch(node, vnode, msg) {
5981
+ hasMismatch = true;
5982
+ if (!isUndefined$1(msg)) {
5983
+ if (process.env.NODE_ENV !== 'production') {
5984
+ logError(msg, vnode.owner);
5985
+ }
5986
+ }
5987
+ const parentNode = getProperty(node, 'parentNode');
5988
+ mount(vnode, parentNode, node);
5989
+ removeNode(node, parentNode);
5990
+ return vnode.elm;
5991
+ }
5992
+ function patchElementPropsAndAttrs(vnode) {
5993
+ applyEventListeners(vnode);
5994
+ patchProps(null, vnode);
5995
+ }
5996
+ function hasCorrectNodeType(vnode, node, nodeType) {
5997
+ if (getProperty(node, 'nodeType') !== nodeType) {
5998
+ if (process.env.NODE_ENV !== 'production') {
5999
+ logError('Hydration mismatch: incorrect node type received', vnode.owner);
6000
+ }
6001
+ return false;
6002
+ }
6003
+ return true;
6004
+ }
6005
+ function isMatchingElement(vnode, elm) {
6006
+ if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
6007
+ if (process.env.NODE_ENV !== 'production') {
6008
+ logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, 'tagName').toLowerCase()}".`, vnode.owner);
6009
+ }
6010
+ return false;
6011
+ }
6012
+ const hasIncompatibleAttrs = validateAttrs(vnode, elm);
6013
+ const hasIncompatibleClass = validateClassAttr(vnode, elm);
6014
+ const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
6015
+ return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
6016
+ }
6017
+ function validateAttrs(vnode, elm) {
6018
+ const { data: { attrs = {} }, } = vnode;
6019
+ let nodesAreCompatible = true;
6020
+ // Validate attributes, though we could always recovery from those by running the update mods.
6021
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6022
+ for (const [attrName, attrValue] of Object.entries(attrs)) {
6023
+ const elmAttrValue = getAttribute(elm, attrName);
6024
+ if (String(attrValue) !== elmAttrValue) {
6025
+ if (process.env.NODE_ENV !== 'production') {
6026
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
6027
+ }
6028
+ nodesAreCompatible = false;
6029
+ }
6030
+ }
6031
+ return nodesAreCompatible;
6032
+ }
6033
+ function validateClassAttr(vnode, elm) {
6034
+ const { data: { className, classMap }, } = vnode;
6035
+ let nodesAreCompatible = true;
6036
+ let vnodeClassName;
6037
+ if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
6038
+ // className is used when class is bound to an expr.
6039
+ nodesAreCompatible = false;
6040
+ vnodeClassName = className;
6041
+ }
6042
+ else if (!isUndefined$1(classMap)) {
6043
+ // classMap is used when class is set to static value.
6044
+ const classList = getClassList(elm);
6045
+ let computedClassName = '';
6046
+ // all classes from the vnode should be in the element.classList
6047
+ for (const name in classMap) {
6048
+ computedClassName += ' ' + name;
6049
+ if (!classList.contains(name)) {
6050
+ nodesAreCompatible = false;
6051
+ }
6052
+ }
6053
+ vnodeClassName = computedClassName.trim();
6054
+ if (classList.length > keys(classMap).length) {
6055
+ nodesAreCompatible = false;
6056
+ }
6057
+ }
6058
+ if (!nodesAreCompatible) {
6059
+ if (process.env.NODE_ENV !== 'production') {
6060
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
6061
+ }
6062
+ }
6063
+ return nodesAreCompatible;
6064
+ }
6065
+ function validateStyleAttr(vnode, elm) {
6066
+ const { data: { style, styleDecls }, } = vnode;
6067
+ const elmStyle = getAttribute(elm, 'style') || '';
6068
+ let vnodeStyle;
6069
+ let nodesAreCompatible = true;
6070
+ if (!isUndefined$1(style) && style !== elmStyle) {
6071
+ nodesAreCompatible = false;
6072
+ vnodeStyle = style;
6073
+ }
6074
+ else if (!isUndefined$1(styleDecls)) {
6075
+ const parsedVnodeStyle = parseStyleText(elmStyle);
6076
+ const expectedStyle = [];
6077
+ // styleMap is used when style is set to static value.
6078
+ for (let i = 0, n = styleDecls.length; i < n; i++) {
6079
+ const [prop, value, important] = styleDecls[i];
6080
+ expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
6081
+ const parsedPropValue = parsedVnodeStyle[prop];
6082
+ if (isUndefined$1(parsedPropValue)) {
6083
+ nodesAreCompatible = false;
6084
+ }
6085
+ else if (!parsedPropValue.startsWith(value)) {
6086
+ nodesAreCompatible = false;
6087
+ }
6088
+ else if (important && !parsedPropValue.endsWith('!important')) {
6089
+ nodesAreCompatible = false;
6090
+ }
6091
+ }
6092
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
6093
+ nodesAreCompatible = false;
6094
+ }
6095
+ vnodeStyle = ArrayJoin.call(expectedStyle, ';');
6096
+ }
6097
+ if (!nodesAreCompatible) {
6098
+ if (process.env.NODE_ENV !== 'production') {
6099
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
6100
+ }
6101
+ }
6102
+ return nodesAreCompatible;
6103
+ }
6104
+
6064
6105
  /*
6065
6106
  * Copyright (c) 2018, salesforce.com, inc.
6066
6107
  * All rights reserved.
@@ -6074,5 +6115,5 @@ function setHooks(hooks) {
6074
6115
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6075
6116
  }
6076
6117
 
6077
- export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertGlobalStylesheet, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6078
- /* version: 2.11.1 */
6118
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRoot, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertGlobalStylesheet, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6119
+ /* version: 2.11.3-238prod.0 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.11.1",
3
+ "version": "2.11.3-238prod.0",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.11.1",
28
- "@lwc/shared": "2.11.1"
27
+ "@lwc/features": "2.11.3-238prod.0",
28
+ "@lwc/shared": "2.11.3-238prod.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "94040389ab8fc717b8753e503f659489480a327d"
36
+ "gitHead": "60b8fbcbc31063f87d206edf104f843455a5abd9"
37
37
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ @license
3
+ Copyright (c) 2015 Simon Friis Vindum.
4
+ This code may only be used under the MIT License found at
5
+ https://github.com/snabbdom/snabbdom/blob/master/LICENSE
6
+ Code distributed by Snabbdom as part of the Snabbdom project at
7
+ https://github.com/snabbdom/snabbdom/
8
+ */
9
+ import { VNodes } from './types';
10
+ export declare function updateDynamicChildren(parentElm: Node, oldCh: VNodes, newCh: VNodes): void;
11
+ export declare function updateStaticChildren(parentElm: Node, oldCh: VNodes, newCh: VNodes): void;