lwc 2.11.0 → 2.12.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/dist/engine-dom/esm/es2017/engine-dom.js +309 -263
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +309 -263
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +264 -126
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1104 -1047
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +391 -181
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +309 -263
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +264 -126
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1104 -1047
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +391 -181
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +14 -11
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +14 -11
  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 +10 -10
@@ -49,6 +49,8 @@ var LWC = (function (exports) {
49
49
 
50
50
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
51
51
 
52
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
53
+
52
54
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
53
55
 
54
56
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
@@ -345,7 +347,7 @@ var LWC = (function (exports) {
345
347
  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
346
348
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
347
349
  var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
348
- /** version: 2.11.0 */
350
+ /** version: 2.12.0 */
349
351
 
350
352
  /*
351
353
  * Copyright (c) 2018, salesforce.com, inc.
@@ -515,7 +517,7 @@ var LWC = (function (exports) {
515
517
 
516
518
  function setFeatureFlagForTest(name, value) {
517
519
  }
518
- /** version: 2.11.0 */
520
+ /** version: 2.12.0 */
519
521
 
520
522
  /* proxy-compat-disable */
521
523
 
@@ -558,6 +560,42 @@ var LWC = (function (exports) {
558
560
 
559
561
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
560
562
  } // Borrowed from Vue template compiler.
563
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
564
+
565
+
566
+ var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
567
+ var PROPERTY_DELIMITER = /:(.+)/;
568
+
569
+ function parseStyleText(cssText) {
570
+ var styleMap = {};
571
+ var declarations = cssText.split(DECLARATION_DELIMITER);
572
+
573
+ var _iterator = _createForOfIteratorHelper(declarations),
574
+ _step;
575
+
576
+ try {
577
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
578
+ var declaration = _step.value;
579
+
580
+ if (declaration) {
581
+ var _declaration$split = declaration.split(PROPERTY_DELIMITER),
582
+ _declaration$split2 = _slicedToArray(_declaration$split, 2),
583
+ prop = _declaration$split2[0],
584
+ value = _declaration$split2[1];
585
+
586
+ if (prop !== undefined && value !== undefined) {
587
+ styleMap[prop.trim()] = value.trim();
588
+ }
589
+ }
590
+ }
591
+ } catch (err) {
592
+ _iterator.e(err);
593
+ } finally {
594
+ _iterator.f();
595
+ }
596
+
597
+ return styleMap;
598
+ } // Make a shallow copy of an object but omit the given key
561
599
 
562
600
 
563
601
  function cloneAndOmitKey(object, keyToOmit) {
@@ -1030,8 +1068,8 @@ var LWC = (function (exports) {
1030
1068
  }
1031
1069
  }
1032
1070
 
1033
- function logWarn(message, vm) {
1034
- log('warn', message, vm);
1071
+ function logError(message, vm) {
1072
+ log('error', message, vm);
1035
1073
  }
1036
1074
  /*
1037
1075
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4949,12 +4987,17 @@ var LWC = (function (exports) {
4949
4987
  * will prevent this function from being imported by userland code.
4950
4988
  */
4951
4989
 
4952
- function registerComponent(Ctor, _ref2) {
4990
+ function registerComponent( // We typically expect a LightningElementConstructor, but technically you can call this with anything
4991
+ Ctor, _ref2) {
4953
4992
  var tmpl = _ref2.tmpl;
4954
4993
 
4955
- signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
4994
+ if (isFunction$1(Ctor)) {
4995
+
4996
+ signedTemplateMap.set(Ctor, tmpl);
4997
+ } // chaining this method as a way to wrap existing assignment of component constructor easily,
4956
4998
  // without too much transformation
4957
4999
 
5000
+
4958
5001
  return Ctor;
4959
5002
  }
4960
5003
 
@@ -5049,140 +5092,6 @@ var LWC = (function (exports) {
5049
5092
  cbs[_i22].call(undefined, component, {}, def, context);
5050
5093
  }
5051
5094
  }
5052
- /*
5053
- * Copyright (c) 2022, salesforce.com, inc.
5054
- * All rights reserved.
5055
- * SPDX-License-Identifier: MIT
5056
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5057
- */
5058
-
5059
-
5060
- function hydrate(vnode, node) {
5061
- switch (vnode.type) {
5062
- case 0
5063
- /* Text */
5064
- :
5065
- hydrateText(vnode, node);
5066
- break;
5067
-
5068
- case 1
5069
- /* Comment */
5070
- :
5071
- hydrateComment(vnode, node);
5072
- break;
5073
-
5074
- case 2
5075
- /* Element */
5076
- :
5077
- hydrateElement(vnode, node);
5078
- break;
5079
-
5080
- case 3
5081
- /* CustomElement */
5082
- :
5083
- hydrateCustomElement(vnode, node);
5084
- break;
5085
- }
5086
- }
5087
-
5088
- function hydrateText(vnode, node) {
5089
- var _a;
5090
-
5091
-
5092
- setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5093
- vnode.elm = node;
5094
- }
5095
-
5096
- function hydrateComment(vnode, node) {
5097
- var _a;
5098
-
5099
-
5100
- setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5101
- vnode.elm = node;
5102
- }
5103
-
5104
- function hydrateElement(vnode, node) {
5105
-
5106
- var elm = node;
5107
- vnode.elm = elm;
5108
- var context = vnode.data.context;
5109
- var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5110
- /* Manual */
5111
- );
5112
-
5113
- if (isDomManual) {
5114
- // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5115
- // remove the innerHTML from props so it reuses the existing dom elements.
5116
- var props = vnode.data.props;
5117
-
5118
- if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5119
- if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5120
- // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5121
- vnode.data = Object.assign(Object.assign({}, vnode.data), {
5122
- props: cloneAndOmitKey(props, 'innerHTML')
5123
- });
5124
- } else {
5125
- logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5126
- }
5127
- }
5128
- }
5129
-
5130
- patchElementPropsAndAttrs(vnode);
5131
-
5132
- if (!isDomManual) {
5133
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5134
- }
5135
- }
5136
-
5137
- function hydrateCustomElement(vnode, node) {
5138
-
5139
- var elm = node;
5140
- var sel = vnode.sel,
5141
- mode = vnode.mode,
5142
- ctor = vnode.ctor,
5143
- owner = vnode.owner;
5144
- var vm = createVM(elm, ctor, {
5145
- mode: mode,
5146
- owner: owner,
5147
- tagName: sel
5148
- });
5149
- vnode.elm = elm;
5150
- vnode.vm = vm;
5151
- allocateChildren(vnode, vm);
5152
- patchElementPropsAndAttrs(vnode); // Insert hook section:
5153
-
5154
- runConnectedCallback(vm);
5155
-
5156
- if (vm.renderMode !== 0
5157
- /* Light */
5158
- ) {
5159
- // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5160
- // Note: for Light DOM, this is handled while hydrating the VM
5161
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5162
- }
5163
-
5164
- hydrateVM(vm);
5165
- }
5166
-
5167
- function hydrateChildren(elmChildren, children, vm) {
5168
-
5169
- var childNodeIndex = 0;
5170
-
5171
- for (var _i23 = 0; _i23 < children.length; _i23++) {
5172
- var childVnode = children[_i23];
5173
-
5174
- if (!isNull(childVnode)) {
5175
- var childNode = elmChildren[childNodeIndex];
5176
- hydrate(childVnode, childNode);
5177
- childNodeIndex++;
5178
- }
5179
- }
5180
- }
5181
-
5182
- function patchElementPropsAndAttrs(vnode) {
5183
- applyEventListeners(vnode);
5184
- patchProps(null, vnode);
5185
- }
5186
5095
  /*
5187
5096
  * Copyright (c) 2018, salesforce.com, inc.
5188
5097
  * All rights reserved.
@@ -5233,12 +5142,6 @@ var LWC = (function (exports) {
5233
5142
  , vm);
5234
5143
  }
5235
5144
 
5236
- function hydrateRootElement(elm) {
5237
- var vm = getAssociatedVM(elm);
5238
- runConnectedCallback(vm);
5239
- hydrateVM(vm);
5240
- }
5241
-
5242
5145
  function disconnectRootElement(elm) {
5243
5146
  var vm = getAssociatedVM(elm);
5244
5147
  resetComponentStateWhenRemoved(vm);
@@ -5246,22 +5149,6 @@ var LWC = (function (exports) {
5246
5149
 
5247
5150
  function appendVM(vm) {
5248
5151
  rehydrate(vm);
5249
- }
5250
-
5251
- function hydrateVM(vm) {
5252
- if (isTrue(vm.isDirty)) {
5253
- // manually diffing/patching here.
5254
- // This routine is:
5255
- // patchShadowRoot(vm, children);
5256
- // -> addVnodes.
5257
- var children = renderComponent(vm);
5258
- vm.children = children;
5259
- var vmChildren = vm.renderMode === 0
5260
- /* Light */
5261
- ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5262
- hydrateChildren(vmChildren, children);
5263
- runRenderedCallback(vm);
5264
- }
5265
5152
  } // just in case the component comes back, with this we guarantee re-rendering it
5266
5153
  // while preventing any attempt to rehydration until after reinsertion.
5267
5154
 
@@ -5527,19 +5414,19 @@ var LWC = (function (exports) {
5527
5414
  });
5528
5415
  rehydrateQueue = []; // reset to a new queue
5529
5416
 
5530
- for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
5531
- var vm = vms[_i26];
5417
+ for (var _i23 = 0, _len8 = vms.length; _i23 < _len8; _i23 += 1) {
5418
+ var vm = vms[_i23];
5532
5419
 
5533
5420
  try {
5534
5421
  rehydrate(vm);
5535
5422
  } catch (error) {
5536
- if (_i26 + 1 < _len8) {
5423
+ if (_i23 + 1 < _len8) {
5537
5424
  // pieces of the queue are still pending to be rehydrated, those should have priority
5538
5425
  if (rehydrateQueue.length === 0) {
5539
5426
  addCallbackToNextTick(flushRehydrationQueue);
5540
5427
  }
5541
5428
 
5542
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i26 + 1));
5429
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i23 + 1));
5543
5430
  } // we need to end the measure before throwing.
5544
5431
 
5545
5432
 
@@ -5638,8 +5525,8 @@ var LWC = (function (exports) {
5638
5525
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
5639
5526
  // inserted in reserved order.
5640
5527
 
5641
- for (var _i27 = vCustomElementCollection.length - 1; _i27 >= 0; _i27 -= 1) {
5642
- var elm = vCustomElementCollection[_i27].elm; // There are two cases where the element could be undefined:
5528
+ for (var _i24 = vCustomElementCollection.length - 1; _i24 >= 0; _i24 -= 1) {
5529
+ var elm = vCustomElementCollection[_i24].elm; // There are two cases where the element could be undefined:
5643
5530
  // * when there is an error during the construction phase, and an error
5644
5531
  // boundary picks it, there is a possibility that the VCustomElement
5645
5532
  // is not properly initialized, and therefore is should be ignored.
@@ -5673,8 +5560,8 @@ var LWC = (function (exports) {
5673
5560
 
5674
5561
 
5675
5562
  function recursivelyDisconnectChildren(vnodes) {
5676
- for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
5677
- var vnode = vnodes[_i28];
5563
+ for (var _i25 = 0, _len9 = vnodes.length; _i25 < _len9; _i25 += 1) {
5564
+ var vnode = vnodes[_i25];
5678
5565
 
5679
5566
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
5680
5567
  switch (vnode.type) {
@@ -5705,8 +5592,8 @@ var LWC = (function (exports) {
5705
5592
  var children = vm.children,
5706
5593
  renderRoot = vm.renderRoot;
5707
5594
 
5708
- for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
5709
- var child = children[_i29];
5595
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26++) {
5596
+ var child = children[_i26];
5710
5597
 
5711
5598
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5712
5599
  remove$1(child.elm, renderRoot);
@@ -6056,8 +5943,8 @@ var LWC = (function (exports) {
6056
5943
  function connectWireAdapters(vm) {
6057
5944
  var wiredConnecting = vm.context.wiredConnecting;
6058
5945
 
6059
- for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
6060
- wiredConnecting[_i30]();
5946
+ for (var _i27 = 0, _len11 = wiredConnecting.length; _i27 < _len11; _i27 += 1) {
5947
+ wiredConnecting[_i27]();
6061
5948
  }
6062
5949
  }
6063
5950
 
@@ -6065,8 +5952,8 @@ var LWC = (function (exports) {
6065
5952
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6066
5953
  runWithBoundaryProtection(vm, vm, noop, function () {
6067
5954
  // job
6068
- for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
6069
- wiredDisconnecting[_i31]();
5955
+ for (var _i28 = 0, _len12 = wiredDisconnecting.length; _i28 < _len12; _i28 += 1) {
5956
+ wiredDisconnecting[_i28]();
6070
5957
  }
6071
5958
  }, noop);
6072
5959
  }
@@ -6136,6 +6023,327 @@ var LWC = (function (exports) {
6136
6023
 
6137
6024
  return reactiveMembrane.getReadOnlyProxy(obj);
6138
6025
  }
6026
+ /*
6027
+ * Copyright (c) 2022, salesforce.com, inc.
6028
+ * All rights reserved.
6029
+ * SPDX-License-Identifier: MIT
6030
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6031
+ */
6032
+ // flag indicating if the hydration recovered from the DOM mismatch
6033
+
6034
+
6035
+ var hasMismatch = false;
6036
+
6037
+ function hydrateRoot(vm) {
6038
+ hasMismatch = false;
6039
+ runConnectedCallback(vm);
6040
+ hydrateVM(vm);
6041
+
6042
+ if (hasMismatch) {
6043
+ logError('Hydration completed with errors.', vm);
6044
+ }
6045
+ }
6046
+
6047
+ function hydrateVM(vm) {
6048
+ var children = renderComponent(vm);
6049
+ vm.children = children;
6050
+ var parentNode = vm.renderRoot;
6051
+ hydrateChildren(getFirstChild$1(parentNode), children, parentNode);
6052
+ runRenderedCallback(vm);
6053
+ }
6054
+
6055
+ function hydrateNode(node, vnode) {
6056
+ var hydratedNode;
6057
+
6058
+ switch (vnode.type) {
6059
+ case 0
6060
+ /* Text */
6061
+ :
6062
+ hydratedNode = hydrateText(node, vnode);
6063
+ break;
6064
+
6065
+ case 1
6066
+ /* Comment */
6067
+ :
6068
+ hydratedNode = hydrateComment(node, vnode);
6069
+ break;
6070
+
6071
+ case 2
6072
+ /* Element */
6073
+ :
6074
+ hydratedNode = hydrateElement(node, vnode);
6075
+ break;
6076
+
6077
+ case 3
6078
+ /* CustomElement */
6079
+ :
6080
+ hydratedNode = hydrateCustomElement(node, vnode);
6081
+ break;
6082
+ }
6083
+
6084
+ return nextSibling$1(hydratedNode);
6085
+ }
6086
+
6087
+ function hydrateText(node, vnode) {
6088
+ var _a;
6089
+
6090
+ if (!hasCorrectNodeType(vnode, node, 3
6091
+ /* TEXT */
6092
+ )) {
6093
+ return handleMismatch(node, vnode);
6094
+ }
6095
+
6096
+ setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6097
+ vnode.elm = node;
6098
+ return node;
6099
+ }
6100
+
6101
+ function hydrateComment(node, vnode) {
6102
+ var _a;
6103
+
6104
+ if (!hasCorrectNodeType(vnode, node, 8
6105
+ /* COMMENT */
6106
+ )) {
6107
+ return handleMismatch(node, vnode);
6108
+ }
6109
+
6110
+ setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6111
+ vnode.elm = node;
6112
+ return node;
6113
+ }
6114
+
6115
+ function hydrateElement(elm, vnode) {
6116
+ if (!hasCorrectNodeType(vnode, elm, 1
6117
+ /* ELEMENT */
6118
+ ) || !isMatchingElement(vnode, elm)) {
6119
+ return handleMismatch(elm, vnode);
6120
+ }
6121
+
6122
+ vnode.elm = elm;
6123
+ var context = vnode.data.context;
6124
+ var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
6125
+ /* Manual */
6126
+ );
6127
+
6128
+ if (isDomManual) {
6129
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
6130
+ // remove the innerHTML from props so it reuses the existing dom elements.
6131
+ var props = vnode.data.props;
6132
+
6133
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6134
+ if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
6135
+ // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6136
+ vnode.data = Object.assign(Object.assign({}, vnode.data), {
6137
+ props: cloneAndOmitKey(props, 'innerHTML')
6138
+ });
6139
+ }
6140
+ }
6141
+ }
6142
+
6143
+ patchElementPropsAndAttrs(vnode);
6144
+
6145
+ if (!isDomManual) {
6146
+ hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
6147
+ }
6148
+
6149
+ return elm;
6150
+ }
6151
+
6152
+ function hydrateCustomElement(elm, vnode) {
6153
+ if (!hasCorrectNodeType(vnode, elm, 1
6154
+ /* ELEMENT */
6155
+ ) || !isMatchingElement(vnode, elm)) {
6156
+ return handleMismatch(elm, vnode);
6157
+ }
6158
+
6159
+ var sel = vnode.sel,
6160
+ mode = vnode.mode,
6161
+ ctor = vnode.ctor,
6162
+ owner = vnode.owner;
6163
+ var vm = createVM(elm, ctor, {
6164
+ mode: mode,
6165
+ owner: owner,
6166
+ tagName: sel
6167
+ });
6168
+ vnode.elm = elm;
6169
+ vnode.vm = vm;
6170
+ allocateChildren(vnode, vm);
6171
+ patchElementPropsAndAttrs(vnode); // Insert hook section:
6172
+
6173
+ runConnectedCallback(vm);
6174
+
6175
+ if (vm.renderMode !== 0
6176
+ /* Light */
6177
+ ) {
6178
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6179
+ // Note: for Light DOM, this is handled while hydrating the VM
6180
+ hydrateChildren(getFirstChild$1(elm), vnode.children, elm);
6181
+ }
6182
+
6183
+ hydrateVM(vm);
6184
+ return elm;
6185
+ }
6186
+
6187
+ function hydrateChildren(node, children, parentNode, owner) {
6188
+ var nextNode = node;
6189
+ var anchor = null;
6190
+
6191
+ for (var _i29 = 0; _i29 < children.length; _i29++) {
6192
+ var childVnode = children[_i29];
6193
+
6194
+ if (!isNull(childVnode)) {
6195
+ if (nextNode) {
6196
+ nextNode = hydrateNode(nextNode, childVnode);
6197
+ anchor = childVnode.elm;
6198
+ } else {
6199
+ hasMismatch = true;
6200
+
6201
+ mount(childVnode, parentNode, anchor);
6202
+ anchor = childVnode.elm;
6203
+ }
6204
+ }
6205
+ }
6206
+
6207
+ if (nextNode) {
6208
+ hasMismatch = true;
6209
+
6210
+ do {
6211
+ var current = nextNode;
6212
+ nextNode = nextSibling$1(nextNode);
6213
+ removeNode(current, parentNode);
6214
+ } while (nextNode);
6215
+ }
6216
+ }
6217
+
6218
+ function handleMismatch(node, vnode, msg) {
6219
+ hasMismatch = true;
6220
+
6221
+ var parentNode = getProperty$1(node, 'parentNode');
6222
+ mount(vnode, parentNode, node);
6223
+ removeNode(node, parentNode);
6224
+ return vnode.elm;
6225
+ }
6226
+
6227
+ function patchElementPropsAndAttrs(vnode) {
6228
+ applyEventListeners(vnode);
6229
+ patchProps(null, vnode);
6230
+ }
6231
+
6232
+ function hasCorrectNodeType(vnode, node, nodeType) {
6233
+ if (getProperty$1(node, 'nodeType') !== nodeType) {
6234
+
6235
+ return false;
6236
+ }
6237
+
6238
+ return true;
6239
+ }
6240
+
6241
+ function isMatchingElement(vnode, elm) {
6242
+ if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
6243
+
6244
+ return false;
6245
+ }
6246
+
6247
+ var hasIncompatibleAttrs = validateAttrs(vnode, elm);
6248
+ var hasIncompatibleClass = validateClassAttr(vnode, elm);
6249
+ var hasIncompatibleStyle = validateStyleAttr(vnode, elm);
6250
+ return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
6251
+ }
6252
+
6253
+ function validateAttrs(vnode, elm) {
6254
+ var _vnode$data$attrs = vnode.data.attrs,
6255
+ attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs;
6256
+ var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
6257
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
6258
+
6259
+ for (var _i30 = 0, _Object$entries = Object.entries(attrs); _i30 < _Object$entries.length; _i30++) {
6260
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i30], 2),
6261
+ attrName = _Object$entries$_i[0],
6262
+ attrValue = _Object$entries$_i[1];
6263
+
6264
+ var elmAttrValue = getAttribute$1(elm, attrName);
6265
+
6266
+ if (String(attrValue) !== elmAttrValue) {
6267
+
6268
+ nodesAreCompatible = false;
6269
+ }
6270
+ }
6271
+
6272
+ return nodesAreCompatible;
6273
+ }
6274
+
6275
+ function validateClassAttr(vnode, elm) {
6276
+ var _vnode$data = vnode.data,
6277
+ className = _vnode$data.className,
6278
+ classMap = _vnode$data.classMap;
6279
+ var nodesAreCompatible = true;
6280
+
6281
+ if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
6282
+ // className is used when class is bound to an expr.
6283
+ nodesAreCompatible = false;
6284
+ } else if (!isUndefined$1(classMap)) {
6285
+ // classMap is used when class is set to static value.
6286
+ var classList = getClassList$1(elm);
6287
+ var computedClassName = ''; // all classes from the vnode should be in the element.classList
6288
+
6289
+ for (var name in classMap) {
6290
+ computedClassName += ' ' + name;
6291
+
6292
+ if (!classList.contains(name)) {
6293
+ nodesAreCompatible = false;
6294
+ }
6295
+ }
6296
+
6297
+ computedClassName.trim();
6298
+
6299
+ if (classList.length > keys(classMap).length) {
6300
+ nodesAreCompatible = false;
6301
+ }
6302
+ }
6303
+
6304
+ return nodesAreCompatible;
6305
+ }
6306
+
6307
+ function validateStyleAttr(vnode, elm) {
6308
+ var _vnode$data2 = vnode.data,
6309
+ style = _vnode$data2.style,
6310
+ styleDecls = _vnode$data2.styleDecls;
6311
+ var elmStyle = getAttribute$1(elm, 'style') || '';
6312
+ var nodesAreCompatible = true;
6313
+
6314
+ if (!isUndefined$1(style) && style !== elmStyle) {
6315
+ nodesAreCompatible = false;
6316
+ } else if (!isUndefined$1(styleDecls)) {
6317
+ var parsedVnodeStyle = parseStyleText(elmStyle);
6318
+ var expectedStyle = []; // styleMap is used when style is set to static value.
6319
+
6320
+ for (var _i31 = 0, n = styleDecls.length; _i31 < n; _i31++) {
6321
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i31], 3),
6322
+ prop = _styleDecls$_i2[0],
6323
+ value = _styleDecls$_i2[1],
6324
+ important = _styleDecls$_i2[2];
6325
+
6326
+ expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
6327
+ var parsedPropValue = parsedVnodeStyle[prop];
6328
+
6329
+ if (isUndefined$1(parsedPropValue)) {
6330
+ nodesAreCompatible = false;
6331
+ } else if (!parsedPropValue.startsWith(value)) {
6332
+ nodesAreCompatible = false;
6333
+ } else if (important && !parsedPropValue.endsWith('!important')) {
6334
+ nodesAreCompatible = false;
6335
+ }
6336
+ }
6337
+
6338
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
6339
+ nodesAreCompatible = false;
6340
+ }
6341
+
6342
+ ArrayJoin.call(expectedStyle, ';');
6343
+ }
6344
+
6345
+ return nodesAreCompatible;
6346
+ }
6139
6347
  /*
6140
6348
  * Copyright (c) 2018, salesforce.com, inc.
6141
6349
  * All rights reserved.
@@ -6151,7 +6359,7 @@ var LWC = (function (exports) {
6151
6359
  hooksAreSet = true;
6152
6360
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6153
6361
  }
6154
- /* version: 2.11.0 */
6362
+ /* version: 2.12.0 */
6155
6363
 
6156
6364
  /*
6157
6365
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6538,7 +6746,7 @@ var LWC = (function (exports) {
6538
6746
  }
6539
6747
 
6540
6748
  function createVMWithProps(element, Ctor, props) {
6541
- createVM(element, Ctor, {
6749
+ var vm = createVM(element, Ctor, {
6542
6750
  mode: 'open',
6543
6751
  owner: null,
6544
6752
  tagName: element.tagName.toLowerCase()
@@ -6551,6 +6759,8 @@ var LWC = (function (exports) {
6551
6759
 
6552
6760
  element[key] = value;
6553
6761
  }
6762
+
6763
+ return vm;
6554
6764
  }
6555
6765
 
6556
6766
  function hydrateComponent(element, Ctor) {
@@ -6578,8 +6788,8 @@ var LWC = (function (exports) {
6578
6788
  // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6579
6789
  // and uses the same algo to create the stylesheets as in SSR.
6580
6790
  setIsHydrating(true);
6581
- createVMWithProps(element, Ctor, props);
6582
- hydrateRootElement(element); // set it back since now we finished hydration.
6791
+ var vm = createVMWithProps(element, Ctor, props);
6792
+ hydrateRoot(vm); // set it back since now we finished hydration.
6583
6793
 
6584
6794
  setIsHydrating(false);
6585
6795
  } catch (e) {
@@ -6894,7 +7104,7 @@ var LWC = (function (exports) {
6894
7104
  });
6895
7105
  freeze(LightningElement);
6896
7106
  seal(LightningElement.prototype);
6897
- /* version: 2.11.0 */
7107
+ /* version: 2.12.0 */
6898
7108
 
6899
7109
  exports.LightningElement = LightningElement;
6900
7110
  exports.__unstable__ProfilerControl = profilerControl;