lwc 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.
Files changed (35) hide show
  1. package/LICENSE +10 -0
  2. package/dist/engine-dom/esm/es2017/engine-dom.js +301 -259
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +301 -259
  4. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  5. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +258 -124
  6. package/dist/engine-dom/iife/es5/engine-dom.js +1094 -1041
  7. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom_debug.js +384 -179
  9. package/dist/engine-dom/umd/es2017/engine-dom.js +301 -259
  10. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  11. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +258 -124
  12. package/dist/engine-dom/umd/es5/engine-dom.js +1094 -1041
  13. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  14. package/dist/engine-dom/umd/es5/engine-dom_debug.js +384 -179
  15. package/dist/engine-server/commonjs/es2017/engine-server.js +6 -7
  16. package/dist/engine-server/esm/es2017/engine-server.js +6 -7
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +8 -8
@@ -293,7 +293,7 @@
293
293
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
294
294
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
295
295
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
296
- /** version: 2.11.1 */
296
+ /** version: 2.11.3-238prod.0 */
297
297
 
298
298
  /*
299
299
  * Copyright (c) 2018, salesforce.com, inc.
@@ -436,7 +436,7 @@
436
436
  */
437
437
  function setFeatureFlagForTest(name, value) {
438
438
  }
439
- /** version: 2.11.1 */
439
+ /** version: 2.11.3-238prod.0 */
440
440
 
441
441
  /* proxy-compat-disable */
442
442
 
@@ -471,6 +471,23 @@
471
471
  }
472
472
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
473
473
  }
474
+ // Borrowed from Vue template compiler.
475
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
476
+ const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
477
+ const PROPERTY_DELIMITER = /:(.+)/;
478
+ function parseStyleText(cssText) {
479
+ const styleMap = {};
480
+ const declarations = cssText.split(DECLARATION_DELIMITER);
481
+ for (const declaration of declarations) {
482
+ if (declaration) {
483
+ const [prop, value] = declaration.split(PROPERTY_DELIMITER);
484
+ if (prop !== undefined && value !== undefined) {
485
+ styleMap[prop.trim()] = value.trim();
486
+ }
487
+ }
488
+ }
489
+ return styleMap;
490
+ }
474
491
  // Make a shallow copy of an object but omit the given key
475
492
  function cloneAndOmitKey(object, keyToOmit) {
476
493
  const result = {};
@@ -819,8 +836,8 @@
819
836
  console[method](e);
820
837
  }
821
838
  }
822
- function logWarn(message, vm) {
823
- log('warn', message, vm);
839
+ function logError(message, vm) {
840
+ log('error', message, vm);
824
841
  }
825
842
 
826
843
  /*
@@ -3942,100 +3959,6 @@
3942
3959
  }
3943
3960
  }
3944
3961
 
3945
- /*
3946
- * Copyright (c) 2022, salesforce.com, inc.
3947
- * All rights reserved.
3948
- * SPDX-License-Identifier: MIT
3949
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3950
- */
3951
- function hydrate(vnode, node) {
3952
- switch (vnode.type) {
3953
- case 0 /* Text */:
3954
- hydrateText(vnode, node);
3955
- break;
3956
- case 1 /* Comment */:
3957
- hydrateComment(vnode, node);
3958
- break;
3959
- case 2 /* Element */:
3960
- hydrateElement(vnode, node);
3961
- break;
3962
- case 3 /* CustomElement */:
3963
- hydrateCustomElement(vnode, node);
3964
- break;
3965
- }
3966
- }
3967
- function hydrateText(vnode, node) {
3968
- var _a;
3969
- // always set the text value to the one from the vnode.
3970
- setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
3971
- vnode.elm = node;
3972
- }
3973
- function hydrateComment(vnode, node) {
3974
- var _a;
3975
- // always set the text value to the one from the vnode.
3976
- setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
3977
- vnode.elm = node;
3978
- }
3979
- function hydrateElement(vnode, node) {
3980
- const elm = node;
3981
- vnode.elm = elm;
3982
- const { context } = vnode.data;
3983
- const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
3984
- if (isDomManual) {
3985
- // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
3986
- // remove the innerHTML from props so it reuses the existing dom elements.
3987
- const { props } = vnode.data;
3988
- if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
3989
- if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
3990
- // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
3991
- vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
3992
- }
3993
- else {
3994
- logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
3995
- }
3996
- }
3997
- }
3998
- patchElementPropsAndAttrs(vnode);
3999
- if (!isDomManual) {
4000
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
4001
- }
4002
- }
4003
- function hydrateCustomElement(vnode, node) {
4004
- const elm = node;
4005
- const { sel, mode, ctor, owner } = vnode;
4006
- const vm = createVM(elm, ctor, {
4007
- mode,
4008
- owner,
4009
- tagName: sel,
4010
- });
4011
- vnode.elm = elm;
4012
- vnode.vm = vm;
4013
- allocateChildren(vnode, vm);
4014
- patchElementPropsAndAttrs(vnode);
4015
- runConnectedCallback(vm);
4016
- if (vm.renderMode !== 0 /* Light */) {
4017
- // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
4018
- // Note: for Light DOM, this is handled while hydrating the VM
4019
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
4020
- }
4021
- hydrateVM(vm);
4022
- }
4023
- function hydrateChildren(elmChildren, children, vm) {
4024
- let childNodeIndex = 0;
4025
- for (let i = 0; i < children.length; i++) {
4026
- const childVnode = children[i];
4027
- if (!isNull(childVnode)) {
4028
- const childNode = elmChildren[childNodeIndex];
4029
- hydrate(childVnode, childNode);
4030
- childNodeIndex++;
4031
- }
4032
- }
4033
- }
4034
- function patchElementPropsAndAttrs(vnode) {
4035
- applyEventListeners(vnode);
4036
- patchProps(null, vnode);
4037
- }
4038
-
4039
3962
  /*
4040
3963
  * Copyright (c) 2018, salesforce.com, inc.
4041
3964
  * All rights reserved.
@@ -4081,32 +4004,12 @@
4081
4004
  /* GlobalHydrate */
4082
4005
  , vm);
4083
4006
  }
4084
- function hydrateRootElement(elm) {
4085
- const vm = getAssociatedVM(elm);
4086
- runConnectedCallback(vm);
4087
- hydrateVM(vm);
4088
- }
4089
4007
  function disconnectRootElement(elm) {
4090
4008
  const vm = getAssociatedVM(elm);
4091
4009
  resetComponentStateWhenRemoved(vm);
4092
4010
  }
4093
4011
  function appendVM(vm) {
4094
4012
  rehydrate(vm);
4095
- }
4096
- function hydrateVM(vm) {
4097
- if (isTrue(vm.isDirty)) {
4098
- // manually diffing/patching here.
4099
- // This routine is:
4100
- // patchShadowRoot(vm, children);
4101
- // -> addVnodes.
4102
- const children = renderComponent(vm);
4103
- vm.children = children;
4104
- const vmChildren = vm.renderMode === 0
4105
- /* Light */
4106
- ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
4107
- hydrateChildren(vmChildren, children);
4108
- runRenderedCallback(vm);
4109
- }
4110
4013
  } // just in case the component comes back, with this we guarantee re-rendering it
4111
4014
  // while preventing any attempt to rehydration until after reinsertion.
4112
4015
 
@@ -4372,7 +4275,6 @@
4372
4275
  , vm);
4373
4276
  }
4374
4277
  }
4375
-
4376
4278
  let rehydrateQueue = [];
4377
4279
 
4378
4280
  function flushRehydrationQueue() {
@@ -4993,6 +4895,237 @@
4993
4895
  return reactiveMembrane.getReadOnlyProxy(obj);
4994
4896
  }
4995
4897
 
4898
+ /*
4899
+ * Copyright (c) 2022, salesforce.com, inc.
4900
+ * All rights reserved.
4901
+ * SPDX-License-Identifier: MIT
4902
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4903
+ */
4904
+ // flag indicating if the hydration recovered from the DOM mismatch
4905
+ let hasMismatch = false;
4906
+ function hydrateRoot(vm) {
4907
+ hasMismatch = false;
4908
+ runConnectedCallback(vm);
4909
+ hydrateVM(vm);
4910
+ if (hasMismatch) {
4911
+ logError('Hydration completed with errors.', vm);
4912
+ }
4913
+ }
4914
+ function hydrateVM(vm) {
4915
+ const children = renderComponent(vm);
4916
+ vm.children = children;
4917
+ const parentNode = vm.renderRoot;
4918
+ hydrateChildren(getFirstChild$1(parentNode), children, parentNode);
4919
+ runRenderedCallback(vm);
4920
+ }
4921
+ function hydrateNode(node, vnode) {
4922
+ let hydratedNode;
4923
+ switch (vnode.type) {
4924
+ case 0 /* Text */:
4925
+ hydratedNode = hydrateText(node, vnode);
4926
+ break;
4927
+ case 1 /* Comment */:
4928
+ hydratedNode = hydrateComment(node, vnode);
4929
+ break;
4930
+ case 2 /* Element */:
4931
+ hydratedNode = hydrateElement(node, vnode);
4932
+ break;
4933
+ case 3 /* CustomElement */:
4934
+ hydratedNode = hydrateCustomElement(node, vnode);
4935
+ break;
4936
+ }
4937
+ return nextSibling$1(hydratedNode);
4938
+ }
4939
+ function hydrateText(node, vnode) {
4940
+ var _a;
4941
+ if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
4942
+ return handleMismatch(node, vnode);
4943
+ }
4944
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
4945
+ vnode.elm = node;
4946
+ return node;
4947
+ }
4948
+ function hydrateComment(node, vnode) {
4949
+ var _a;
4950
+ if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
4951
+ return handleMismatch(node, vnode);
4952
+ }
4953
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
4954
+ vnode.elm = node;
4955
+ return node;
4956
+ }
4957
+ function hydrateElement(elm, vnode) {
4958
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
4959
+ !isMatchingElement(vnode, elm)) {
4960
+ return handleMismatch(elm, vnode);
4961
+ }
4962
+ vnode.elm = elm;
4963
+ const { context } = vnode.data;
4964
+ const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
4965
+ if (isDomManual) {
4966
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
4967
+ // remove the innerHTML from props so it reuses the existing dom elements.
4968
+ const { props } = vnode.data;
4969
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
4970
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
4971
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
4972
+ vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
4973
+ }
4974
+ }
4975
+ }
4976
+ patchElementPropsAndAttrs(vnode);
4977
+ if (!isDomManual) {
4978
+ hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
4979
+ }
4980
+ return elm;
4981
+ }
4982
+ function hydrateCustomElement(elm, vnode) {
4983
+ if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
4984
+ !isMatchingElement(vnode, elm)) {
4985
+ return handleMismatch(elm, vnode);
4986
+ }
4987
+ const { sel, mode, ctor, owner } = vnode;
4988
+ const vm = createVM(elm, ctor, {
4989
+ mode,
4990
+ owner,
4991
+ tagName: sel,
4992
+ });
4993
+ vnode.elm = elm;
4994
+ vnode.vm = vm;
4995
+ allocateChildren(vnode, vm);
4996
+ patchElementPropsAndAttrs(vnode);
4997
+ runConnectedCallback(vm);
4998
+ if (vm.renderMode !== 0 /* Light */) {
4999
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5000
+ // Note: for Light DOM, this is handled while hydrating the VM
5001
+ hydrateChildren(getFirstChild$1(elm), vnode.children, elm);
5002
+ }
5003
+ hydrateVM(vm);
5004
+ return elm;
5005
+ }
5006
+ function hydrateChildren(node, children, parentNode, owner) {
5007
+ let nextNode = node;
5008
+ let anchor = null;
5009
+ for (let i = 0; i < children.length; i++) {
5010
+ const childVnode = children[i];
5011
+ if (!isNull(childVnode)) {
5012
+ if (nextNode) {
5013
+ nextNode = hydrateNode(nextNode, childVnode);
5014
+ anchor = childVnode.elm;
5015
+ }
5016
+ else {
5017
+ hasMismatch = true;
5018
+ mount(childVnode, parentNode, anchor);
5019
+ anchor = childVnode.elm;
5020
+ }
5021
+ }
5022
+ }
5023
+ if (nextNode) {
5024
+ hasMismatch = true;
5025
+ do {
5026
+ const current = nextNode;
5027
+ nextNode = nextSibling$1(nextNode);
5028
+ removeNode(current, parentNode);
5029
+ } while (nextNode);
5030
+ }
5031
+ }
5032
+ function handleMismatch(node, vnode, msg) {
5033
+ hasMismatch = true;
5034
+ const parentNode = getProperty$1(node, 'parentNode');
5035
+ mount(vnode, parentNode, node);
5036
+ removeNode(node, parentNode);
5037
+ return vnode.elm;
5038
+ }
5039
+ function patchElementPropsAndAttrs(vnode) {
5040
+ applyEventListeners(vnode);
5041
+ patchProps(null, vnode);
5042
+ }
5043
+ function hasCorrectNodeType(vnode, node, nodeType) {
5044
+ if (getProperty$1(node, 'nodeType') !== nodeType) {
5045
+ return false;
5046
+ }
5047
+ return true;
5048
+ }
5049
+ function isMatchingElement(vnode, elm) {
5050
+ if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
5051
+ return false;
5052
+ }
5053
+ const hasIncompatibleAttrs = validateAttrs(vnode, elm);
5054
+ const hasIncompatibleClass = validateClassAttr(vnode, elm);
5055
+ const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
5056
+ return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
5057
+ }
5058
+ function validateAttrs(vnode, elm) {
5059
+ const { data: { attrs = {} }, } = vnode;
5060
+ let nodesAreCompatible = true;
5061
+ // Validate attributes, though we could always recovery from those by running the update mods.
5062
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
5063
+ for (const [attrName, attrValue] of Object.entries(attrs)) {
5064
+ const elmAttrValue = getAttribute$1(elm, attrName);
5065
+ if (String(attrValue) !== elmAttrValue) {
5066
+ nodesAreCompatible = false;
5067
+ }
5068
+ }
5069
+ return nodesAreCompatible;
5070
+ }
5071
+ function validateClassAttr(vnode, elm) {
5072
+ const { data: { className, classMap }, } = vnode;
5073
+ let nodesAreCompatible = true;
5074
+ if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
5075
+ // className is used when class is bound to an expr.
5076
+ nodesAreCompatible = false;
5077
+ }
5078
+ else if (!isUndefined$1(classMap)) {
5079
+ // classMap is used when class is set to static value.
5080
+ const classList = getClassList$1(elm);
5081
+ let computedClassName = '';
5082
+ // all classes from the vnode should be in the element.classList
5083
+ for (const name in classMap) {
5084
+ computedClassName += ' ' + name;
5085
+ if (!classList.contains(name)) {
5086
+ nodesAreCompatible = false;
5087
+ }
5088
+ }
5089
+ computedClassName.trim();
5090
+ if (classList.length > keys(classMap).length) {
5091
+ nodesAreCompatible = false;
5092
+ }
5093
+ }
5094
+ return nodesAreCompatible;
5095
+ }
5096
+ function validateStyleAttr(vnode, elm) {
5097
+ const { data: { style, styleDecls }, } = vnode;
5098
+ const elmStyle = getAttribute$1(elm, 'style') || '';
5099
+ let nodesAreCompatible = true;
5100
+ if (!isUndefined$1(style) && style !== elmStyle) {
5101
+ nodesAreCompatible = false;
5102
+ }
5103
+ else if (!isUndefined$1(styleDecls)) {
5104
+ const parsedVnodeStyle = parseStyleText(elmStyle);
5105
+ const expectedStyle = [];
5106
+ // styleMap is used when style is set to static value.
5107
+ for (let i = 0, n = styleDecls.length; i < n; i++) {
5108
+ const [prop, value, important] = styleDecls[i];
5109
+ expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
5110
+ const parsedPropValue = parsedVnodeStyle[prop];
5111
+ if (isUndefined$1(parsedPropValue)) {
5112
+ nodesAreCompatible = false;
5113
+ }
5114
+ else if (!parsedPropValue.startsWith(value)) {
5115
+ nodesAreCompatible = false;
5116
+ }
5117
+ else if (important && !parsedPropValue.endsWith('!important')) {
5118
+ nodesAreCompatible = false;
5119
+ }
5120
+ }
5121
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
5122
+ nodesAreCompatible = false;
5123
+ }
5124
+ ArrayJoin.call(expectedStyle, ';');
5125
+ }
5126
+ return nodesAreCompatible;
5127
+ }
5128
+
4996
5129
  /*
4997
5130
  * Copyright (c) 2018, salesforce.com, inc.
4998
5131
  * All rights reserved.
@@ -5005,7 +5138,7 @@
5005
5138
  hooksAreSet = true;
5006
5139
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5007
5140
  }
5008
- /* version: 2.11.1 */
5141
+ /* version: 2.11.3-238prod.0 */
5009
5142
 
5010
5143
  /*
5011
5144
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5325,7 +5458,7 @@
5325
5458
  }
5326
5459
  }
5327
5460
  function createVMWithProps(element, Ctor, props) {
5328
- createVM(element, Ctor, {
5461
+ const vm = createVM(element, Ctor, {
5329
5462
  mode: 'open',
5330
5463
  owner: null,
5331
5464
  tagName: element.tagName.toLowerCase(),
@@ -5333,6 +5466,7 @@
5333
5466
  for (const [key, value] of Object.entries(props)) {
5334
5467
  element[key] = value;
5335
5468
  }
5469
+ return vm;
5336
5470
  }
5337
5471
  function hydrateComponent(element, Ctor, props = {}) {
5338
5472
  if (!(element instanceof Element)) {
@@ -5353,8 +5487,8 @@
5353
5487
  // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
5354
5488
  // and uses the same algo to create the stylesheets as in SSR.
5355
5489
  setIsHydrating(true);
5356
- createVMWithProps(element, Ctor, props);
5357
- hydrateRootElement(element);
5490
+ const vm = createVMWithProps(element, Ctor, props);
5491
+ hydrateRoot(vm);
5358
5492
  // set it back since now we finished hydration.
5359
5493
  setIsHydrating(false);
5360
5494
  }
@@ -5611,7 +5745,7 @@
5611
5745
  });
5612
5746
  freeze(LightningElement);
5613
5747
  seal(LightningElement.prototype);
5614
- /* version: 2.11.1 */
5748
+ /* version: 2.11.3-238prod.0 */
5615
5749
 
5616
5750
  exports.LightningElement = LightningElement;
5617
5751
  exports.__unstable__ProfilerControl = profilerControl;