lwc 2.11.1 → 2.12.1

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 (34) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +301 -259
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +301 -259
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +258 -124
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1094 -1041
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +384 -179
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +301 -259
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +258 -124
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1094 -1041
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +384 -179
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +6 -7
  15. package/dist/engine-server/esm/es2017/engine-server.js +6 -7
  16. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  17. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  19. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  21. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  23. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  25. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  26. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  28. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  30. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  32. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  34. 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.1 */
350
+ /** version: 2.12.1 */
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.1 */
520
+ /** version: 2.12.1 */
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.
@@ -5054,140 +5092,6 @@ var LWC = (function (exports) {
5054
5092
  cbs[_i22].call(undefined, component, {}, def, context);
5055
5093
  }
5056
5094
  }
5057
- /*
5058
- * Copyright (c) 2022, salesforce.com, inc.
5059
- * All rights reserved.
5060
- * SPDX-License-Identifier: MIT
5061
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5062
- */
5063
-
5064
-
5065
- function hydrate(vnode, node) {
5066
- switch (vnode.type) {
5067
- case 0
5068
- /* Text */
5069
- :
5070
- hydrateText(vnode, node);
5071
- break;
5072
-
5073
- case 1
5074
- /* Comment */
5075
- :
5076
- hydrateComment(vnode, node);
5077
- break;
5078
-
5079
- case 2
5080
- /* Element */
5081
- :
5082
- hydrateElement(vnode, node);
5083
- break;
5084
-
5085
- case 3
5086
- /* CustomElement */
5087
- :
5088
- hydrateCustomElement(vnode, node);
5089
- break;
5090
- }
5091
- }
5092
-
5093
- function hydrateText(vnode, node) {
5094
- var _a;
5095
-
5096
-
5097
- setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5098
- vnode.elm = node;
5099
- }
5100
-
5101
- function hydrateComment(vnode, node) {
5102
- var _a;
5103
-
5104
-
5105
- setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5106
- vnode.elm = node;
5107
- }
5108
-
5109
- function hydrateElement(vnode, node) {
5110
-
5111
- var elm = node;
5112
- vnode.elm = elm;
5113
- var context = vnode.data.context;
5114
- var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5115
- /* Manual */
5116
- );
5117
-
5118
- if (isDomManual) {
5119
- // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5120
- // remove the innerHTML from props so it reuses the existing dom elements.
5121
- var props = vnode.data.props;
5122
-
5123
- if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5124
- if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
5125
- // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
5126
- vnode.data = Object.assign(Object.assign({}, vnode.data), {
5127
- props: cloneAndOmitKey(props, 'innerHTML')
5128
- });
5129
- } else {
5130
- logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5131
- }
5132
- }
5133
- }
5134
-
5135
- patchElementPropsAndAttrs(vnode);
5136
-
5137
- if (!isDomManual) {
5138
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
5139
- }
5140
- }
5141
-
5142
- function hydrateCustomElement(vnode, node) {
5143
-
5144
- var elm = node;
5145
- var sel = vnode.sel,
5146
- mode = vnode.mode,
5147
- ctor = vnode.ctor,
5148
- owner = vnode.owner;
5149
- var vm = createVM(elm, ctor, {
5150
- mode: mode,
5151
- owner: owner,
5152
- tagName: sel
5153
- });
5154
- vnode.elm = elm;
5155
- vnode.vm = vm;
5156
- allocateChildren(vnode, vm);
5157
- patchElementPropsAndAttrs(vnode); // Insert hook section:
5158
-
5159
- runConnectedCallback(vm);
5160
-
5161
- if (vm.renderMode !== 0
5162
- /* Light */
5163
- ) {
5164
- // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5165
- // Note: for Light DOM, this is handled while hydrating the VM
5166
- hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
5167
- }
5168
-
5169
- hydrateVM(vm);
5170
- }
5171
-
5172
- function hydrateChildren(elmChildren, children, vm) {
5173
-
5174
- var childNodeIndex = 0;
5175
-
5176
- for (var _i23 = 0; _i23 < children.length; _i23++) {
5177
- var childVnode = children[_i23];
5178
-
5179
- if (!isNull(childVnode)) {
5180
- var childNode = elmChildren[childNodeIndex];
5181
- hydrate(childVnode, childNode);
5182
- childNodeIndex++;
5183
- }
5184
- }
5185
- }
5186
-
5187
- function patchElementPropsAndAttrs(vnode) {
5188
- applyEventListeners(vnode);
5189
- patchProps(null, vnode);
5190
- }
5191
5095
  /*
5192
5096
  * Copyright (c) 2018, salesforce.com, inc.
5193
5097
  * All rights reserved.
@@ -5238,12 +5142,6 @@ var LWC = (function (exports) {
5238
5142
  , vm);
5239
5143
  }
5240
5144
 
5241
- function hydrateRootElement(elm) {
5242
- var vm = getAssociatedVM(elm);
5243
- runConnectedCallback(vm);
5244
- hydrateVM(vm);
5245
- }
5246
-
5247
5145
  function disconnectRootElement(elm) {
5248
5146
  var vm = getAssociatedVM(elm);
5249
5147
  resetComponentStateWhenRemoved(vm);
@@ -5251,22 +5149,6 @@ var LWC = (function (exports) {
5251
5149
 
5252
5150
  function appendVM(vm) {
5253
5151
  rehydrate(vm);
5254
- }
5255
-
5256
- function hydrateVM(vm) {
5257
- if (isTrue(vm.isDirty)) {
5258
- // manually diffing/patching here.
5259
- // This routine is:
5260
- // patchShadowRoot(vm, children);
5261
- // -> addVnodes.
5262
- var children = renderComponent(vm);
5263
- vm.children = children;
5264
- var vmChildren = vm.renderMode === 0
5265
- /* Light */
5266
- ? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
5267
- hydrateChildren(vmChildren, children);
5268
- runRenderedCallback(vm);
5269
- }
5270
5152
  } // just in case the component comes back, with this we guarantee re-rendering it
5271
5153
  // while preventing any attempt to rehydration until after reinsertion.
5272
5154
 
@@ -5532,19 +5414,19 @@ var LWC = (function (exports) {
5532
5414
  });
5533
5415
  rehydrateQueue = []; // reset to a new queue
5534
5416
 
5535
- for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
5536
- var vm = vms[_i26];
5417
+ for (var _i23 = 0, _len8 = vms.length; _i23 < _len8; _i23 += 1) {
5418
+ var vm = vms[_i23];
5537
5419
 
5538
5420
  try {
5539
5421
  rehydrate(vm);
5540
5422
  } catch (error) {
5541
- if (_i26 + 1 < _len8) {
5423
+ if (_i23 + 1 < _len8) {
5542
5424
  // pieces of the queue are still pending to be rehydrated, those should have priority
5543
5425
  if (rehydrateQueue.length === 0) {
5544
5426
  addCallbackToNextTick(flushRehydrationQueue);
5545
5427
  }
5546
5428
 
5547
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i26 + 1));
5429
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i23 + 1));
5548
5430
  } // we need to end the measure before throwing.
5549
5431
 
5550
5432
 
@@ -5643,8 +5525,8 @@ var LWC = (function (exports) {
5643
5525
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
5644
5526
  // inserted in reserved order.
5645
5527
 
5646
- for (var _i27 = vCustomElementCollection.length - 1; _i27 >= 0; _i27 -= 1) {
5647
- 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:
5648
5530
  // * when there is an error during the construction phase, and an error
5649
5531
  // boundary picks it, there is a possibility that the VCustomElement
5650
5532
  // is not properly initialized, and therefore is should be ignored.
@@ -5678,8 +5560,8 @@ var LWC = (function (exports) {
5678
5560
 
5679
5561
 
5680
5562
  function recursivelyDisconnectChildren(vnodes) {
5681
- for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
5682
- var vnode = vnodes[_i28];
5563
+ for (var _i25 = 0, _len9 = vnodes.length; _i25 < _len9; _i25 += 1) {
5564
+ var vnode = vnodes[_i25];
5683
5565
 
5684
5566
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
5685
5567
  switch (vnode.type) {
@@ -5710,8 +5592,8 @@ var LWC = (function (exports) {
5710
5592
  var children = vm.children,
5711
5593
  renderRoot = vm.renderRoot;
5712
5594
 
5713
- for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
5714
- var child = children[_i29];
5595
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26++) {
5596
+ var child = children[_i26];
5715
5597
 
5716
5598
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5717
5599
  remove$1(child.elm, renderRoot);
@@ -6061,8 +5943,8 @@ var LWC = (function (exports) {
6061
5943
  function connectWireAdapters(vm) {
6062
5944
  var wiredConnecting = vm.context.wiredConnecting;
6063
5945
 
6064
- for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
6065
- wiredConnecting[_i30]();
5946
+ for (var _i27 = 0, _len11 = wiredConnecting.length; _i27 < _len11; _i27 += 1) {
5947
+ wiredConnecting[_i27]();
6066
5948
  }
6067
5949
  }
6068
5950
 
@@ -6070,8 +5952,8 @@ var LWC = (function (exports) {
6070
5952
  var wiredDisconnecting = vm.context.wiredDisconnecting;
6071
5953
  runWithBoundaryProtection(vm, vm, noop, function () {
6072
5954
  // job
6073
- for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
6074
- wiredDisconnecting[_i31]();
5955
+ for (var _i28 = 0, _len12 = wiredDisconnecting.length; _i28 < _len12; _i28 += 1) {
5956
+ wiredDisconnecting[_i28]();
6075
5957
  }
6076
5958
  }, noop);
6077
5959
  }
@@ -6141,6 +6023,327 @@ var LWC = (function (exports) {
6141
6023
 
6142
6024
  return reactiveMembrane.getReadOnlyProxy(obj);
6143
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
+ }
6144
6347
  /*
6145
6348
  * Copyright (c) 2018, salesforce.com, inc.
6146
6349
  * All rights reserved.
@@ -6156,7 +6359,7 @@ var LWC = (function (exports) {
6156
6359
  hooksAreSet = true;
6157
6360
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6158
6361
  }
6159
- /* version: 2.11.1 */
6362
+ /* version: 2.12.1 */
6160
6363
 
6161
6364
  /*
6162
6365
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6543,7 +6746,7 @@ var LWC = (function (exports) {
6543
6746
  }
6544
6747
 
6545
6748
  function createVMWithProps(element, Ctor, props) {
6546
- createVM(element, Ctor, {
6749
+ var vm = createVM(element, Ctor, {
6547
6750
  mode: 'open',
6548
6751
  owner: null,
6549
6752
  tagName: element.tagName.toLowerCase()
@@ -6556,6 +6759,8 @@ var LWC = (function (exports) {
6556
6759
 
6557
6760
  element[key] = value;
6558
6761
  }
6762
+
6763
+ return vm;
6559
6764
  }
6560
6765
 
6561
6766
  function hydrateComponent(element, Ctor) {
@@ -6583,8 +6788,8 @@ var LWC = (function (exports) {
6583
6788
  // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6584
6789
  // and uses the same algo to create the stylesheets as in SSR.
6585
6790
  setIsHydrating(true);
6586
- createVMWithProps(element, Ctor, props);
6587
- 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.
6588
6793
 
6589
6794
  setIsHydrating(false);
6590
6795
  } catch (e) {
@@ -6899,7 +7104,7 @@ var LWC = (function (exports) {
6899
7104
  });
6900
7105
  freeze(LightningElement);
6901
7106
  seal(LightningElement.prototype);
6902
- /* version: 2.11.1 */
7107
+ /* version: 2.12.1 */
6903
7108
 
6904
7109
  exports.LightningElement = LightningElement;
6905
7110
  exports.__unstable__ProfilerControl = profilerControl;