lwc 2.5.6 → 2.5.10-alpha1

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 (54) hide show
  1. package/dist/engine/esm/es2017/engine.js +7981 -0
  2. package/dist/engine/iife/es2017/engine.js +8013 -0
  3. package/dist/engine/iife/es2017/engine.min.js +9 -0
  4. package/dist/engine/iife/es2017/engine_debug.js +6541 -0
  5. package/dist/engine/iife/es5/engine.js +6060 -0
  6. package/dist/engine/iife/es5/engine.min.js +23 -0
  7. package/dist/engine/iife/es5/engine_debug.js +4856 -0
  8. package/dist/engine/umd/es2017/engine.js +8014 -0
  9. package/dist/engine/umd/es2017/engine.min.js +9 -0
  10. package/dist/engine/umd/es2017/engine_debug.js +6542 -0
  11. package/dist/engine/umd/es5/engine.js +6061 -0
  12. package/dist/engine/umd/es5/engine.min.js +23 -0
  13. package/dist/engine/umd/es5/engine_debug.js +4857 -0
  14. package/dist/engine-dom/esm/es2017/engine-dom.js +521 -122
  15. package/dist/engine-dom/iife/es2017/engine-dom.js +522 -123
  16. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  17. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +337 -112
  18. package/dist/engine-dom/iife/es5/engine-dom.js +596 -185
  19. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  20. package/dist/engine-dom/iife/es5/engine-dom_debug.js +392 -165
  21. package/dist/engine-dom/umd/es2017/engine-dom.js +523 -124
  22. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  23. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +338 -113
  24. package/dist/engine-dom/umd/es5/engine-dom.js +597 -186
  25. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  26. package/dist/engine-dom/umd/es5/engine-dom_debug.js +393 -166
  27. package/dist/engine-server/commonjs/es2017/engine-server.js +400 -74
  28. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  29. package/dist/engine-server/esm/es2017/engine-server.js +401 -74
  30. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  31. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
  32. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  33. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
  34. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4 -4
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4 -4
  37. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +5 -5
  38. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  39. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +5 -5
  40. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +5 -5
  41. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  42. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +5 -5
  43. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  44. package/dist/wire-service/iife/es2017/wire-service.js +3 -3
  45. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
  46. package/dist/wire-service/iife/es5/wire-service.js +3 -3
  47. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  48. package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
  49. package/dist/wire-service/umd/es2017/wire-service.js +4 -4
  50. package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
  51. package/dist/wire-service/umd/es5/wire-service.js +4 -4
  52. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  53. package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
  54. package/package.json +8 -8
@@ -7,8 +7,6 @@ var LWC = (function (exports) {
7
7
 
8
8
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
9
9
 
10
- 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; } } }; }
11
-
12
10
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13
11
 
14
12
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -37,23 +35,25 @@ var LWC = (function (exports) {
37
35
 
38
36
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
39
37
 
40
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
38
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41
39
 
42
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
40
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
43
41
 
44
- 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); }
42
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
45
43
 
46
- 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; }
44
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
45
+
46
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
47
47
 
48
48
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
49
49
 
50
50
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
51
51
 
52
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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
53
 
54
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
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); }
55
55
 
56
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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; }
57
57
 
58
58
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
59
59
 
@@ -120,6 +120,7 @@ var LWC = (function (exports) {
120
120
  setPrototypeOf = Object.setPrototypeOf;
121
121
  var isArray$1 = Array.isArray;
122
122
  var _Array$prototype = Array.prototype,
123
+ ArrayFilter = _Array$prototype.filter,
123
124
  ArrayIndexOf = _Array$prototype.indexOf,
124
125
  ArrayJoin = _Array$prototype.join,
125
126
  ArrayMap$1 = _Array$prototype.map,
@@ -347,7 +348,7 @@ var LWC = (function (exports) {
347
348
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
348
349
  return attributeName;
349
350
  }
350
- /** version: 2.5.6 */
351
+ /** version: 2.5.10-alpha1 */
351
352
 
352
353
  /*
353
354
  * Copyright (c) 2018, salesforce.com, inc.
@@ -527,7 +528,7 @@ var LWC = (function (exports) {
527
528
  setFeatureFlag(name, value);
528
529
  }
529
530
  }
530
- /** version: 2.5.6 */
531
+ /** version: 2.5.10-alpha1 */
531
532
 
532
533
  /* proxy-compat-disable */
533
534
 
@@ -579,6 +580,42 @@ var LWC = (function (exports) {
579
580
  }
580
581
 
581
582
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
583
+ } // Borrowed from Vue template compiler.
584
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
585
+
586
+
587
+ var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
588
+ var PROPERTY_DELIMITER = /:(.+)/;
589
+
590
+ function parseStyleText(cssText) {
591
+ var styleMap = {};
592
+ var declarations = cssText.split(DECLARATION_DELIMITER);
593
+
594
+ var _iterator = _createForOfIteratorHelper(declarations),
595
+ _step;
596
+
597
+ try {
598
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
599
+ var declaration = _step.value;
600
+
601
+ if (declaration) {
602
+ var _declaration$split = declaration.split(PROPERTY_DELIMITER),
603
+ _declaration$split2 = _slicedToArray(_declaration$split, 2),
604
+ prop = _declaration$split2[0],
605
+ value = _declaration$split2[1];
606
+
607
+ if (prop !== undefined && value !== undefined) {
608
+ styleMap[prop.trim()] = value.trim();
609
+ }
610
+ }
611
+ }
612
+ } catch (err) {
613
+ _iterator.e(err);
614
+ } finally {
615
+ _iterator.f();
616
+ }
617
+
618
+ return styleMap;
582
619
  }
583
620
  /*
584
621
  * Copyright (c) 2019, salesforce.com, inc.
@@ -767,8 +804,8 @@ var LWC = (function (exports) {
767
804
  */
768
805
 
769
806
 
770
- function logError(message, vm) {
771
- var msg = "[LWC error]: ".concat(message);
807
+ function log(method, message, vm) {
808
+ var msg = "[LWC ".concat(method, "]: ").concat(message);
772
809
 
773
810
  if (!isUndefined$1(vm)) {
774
811
  msg = "".concat(msg, "\n").concat(getComponentStack(vm));
@@ -776,7 +813,7 @@ var LWC = (function (exports) {
776
813
 
777
814
  if (process.env.NODE_ENV === 'test') {
778
815
  /* eslint-disable-next-line no-console */
779
- console.error(msg);
816
+ console[method](msg);
780
817
  return;
781
818
  }
782
819
 
@@ -784,9 +821,17 @@ var LWC = (function (exports) {
784
821
  throw new Error(msg);
785
822
  } catch (e) {
786
823
  /* eslint-disable-next-line no-console */
787
- console.error(e);
824
+ console[method](e);
788
825
  }
789
826
  }
827
+
828
+ function logError(message, vm) {
829
+ log('error', message, vm);
830
+ }
831
+
832
+ function logWarn(message, vm) {
833
+ log('warn', message, vm);
834
+ }
790
835
  /*
791
836
  * Copyright (c) 2018, salesforce.com, inc.
792
837
  * All rights reserved.
@@ -3015,7 +3060,9 @@ var LWC = (function (exports) {
3015
3060
  }
3016
3061
 
3017
3062
  return renderer[rendererMethod](elm);
3018
- }
3063
+ },
3064
+ configurable: true,
3065
+ enumerable: true
3019
3066
  };
3020
3067
  };
3021
3068
 
@@ -3038,7 +3085,10 @@ var LWC = (function (exports) {
3038
3085
  }
3039
3086
 
3040
3087
  return renderer[queryMethod](elm, arg);
3041
- }
3088
+ },
3089
+ configurable: true,
3090
+ enumerable: true,
3091
+ writable: true
3042
3092
  };
3043
3093
  };
3044
3094
 
@@ -3931,12 +3981,12 @@ var LWC = (function (exports) {
3931
3981
  function flattenStylesheets(stylesheets) {
3932
3982
  var list = [];
3933
3983
 
3934
- var _iterator = _createForOfIteratorHelper(stylesheets),
3935
- _step;
3984
+ var _iterator2 = _createForOfIteratorHelper(stylesheets),
3985
+ _step2;
3936
3986
 
3937
3987
  try {
3938
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3939
- var stylesheet = _step.value;
3988
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3989
+ var stylesheet = _step2.value;
3940
3990
 
3941
3991
  if (!Array.isArray(stylesheet)) {
3942
3992
  list.push(stylesheet);
@@ -3945,9 +3995,9 @@ var LWC = (function (exports) {
3945
3995
  }
3946
3996
  }
3947
3997
  } catch (err) {
3948
- _iterator.e(err);
3998
+ _iterator2.e(err);
3949
3999
  } finally {
3950
- _iterator.f();
4000
+ _iterator2.f();
3951
4001
  }
3952
4002
 
3953
4003
  return list;
@@ -4211,7 +4261,7 @@ var LWC = (function (exports) {
4211
4261
  if (!isUndefined$1(ctorShadowSupportMode)) {
4212
4262
  assert.invariant(ctorShadowSupportMode === "any"
4213
4263
  /* Any */
4214
- || ctorShadowSupportMode === "default"
4264
+ || ctorShadowSupportMode === "reset"
4215
4265
  /* Default */
4216
4266
  , "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
4217
4267
  }
@@ -4369,7 +4419,7 @@ var LWC = (function (exports) {
4369
4419
  renderMode: 1
4370
4420
  /* Shadow */
4371
4421
  ,
4372
- shadowSupportMode: "default"
4422
+ shadowSupportMode: "reset"
4373
4423
  /* Default */
4374
4424
  ,
4375
4425
  wire: EmptyObject,
@@ -4506,6 +4556,17 @@ var LWC = (function (exports) {
4506
4556
  modComputedStyle.create(vnode);
4507
4557
  }
4508
4558
 
4559
+ function hydrateElmHook(vnode) {
4560
+ modEvents.create(vnode); // Attrs are already on the element.
4561
+ // modAttrs.create(vnode);
4562
+
4563
+ modProps.create(vnode); // Already set.
4564
+ // modStaticClassName.create(vnode);
4565
+ // modStaticStyle.create(vnode);
4566
+ // modComputedClassName.create(vnode);
4567
+ // modComputedStyle.create(vnode);
4568
+ }
4569
+
4509
4570
  function fallbackElmHook(elm, vnode) {
4510
4571
  var owner = vnode.owner;
4511
4572
  setScopeTokenClassIfNecessary(elm, owner);
@@ -4655,6 +4716,174 @@ var LWC = (function (exports) {
4655
4716
  }
4656
4717
  }
4657
4718
 
4719
+ function isElementNode(node) {
4720
+ // eslint-disable-next-line lwc-internal/no-global-node
4721
+ return node.nodeType === Node.ELEMENT_NODE;
4722
+ }
4723
+
4724
+ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4725
+ var _vnode$data$attrs = vnode.data.attrs,
4726
+ attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
4727
+ renderer = vnode.owner.renderer;
4728
+ var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
4729
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
4730
+
4731
+ for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
4732
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
4733
+ attrName = _Object$entries$_i[0],
4734
+ attrValue = _Object$entries$_i[1];
4735
+
4736
+ var elmAttrValue = renderer.getAttribute(elm, attrName);
4737
+
4738
+ if (String(attrValue) !== elmAttrValue) {
4739
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
4740
+ nodesAreCompatible = false;
4741
+ }
4742
+ }
4743
+
4744
+ return nodesAreCompatible;
4745
+ }
4746
+
4747
+ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4748
+ var _vnode$data = vnode.data,
4749
+ className = _vnode$data.className,
4750
+ classMap = _vnode$data.classMap,
4751
+ renderer = vnode.owner.renderer;
4752
+ var nodesAreCompatible = true;
4753
+ var vnodeClassName;
4754
+
4755
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4756
+ // className is used when class is bound to an expr.
4757
+ nodesAreCompatible = false;
4758
+ vnodeClassName = className;
4759
+ } else if (!isUndefined$1(classMap)) {
4760
+ // classMap is used when class is set to static value.
4761
+ var classList = renderer.getClassList(elm);
4762
+ var computedClassName = ''; // all classes from the vnode should be in the element.classList
4763
+
4764
+ for (var name in classMap) {
4765
+ computedClassName += ' ' + name;
4766
+
4767
+ if (!classList.contains(name)) {
4768
+ nodesAreCompatible = false;
4769
+ }
4770
+ }
4771
+
4772
+ vnodeClassName = computedClassName.trim();
4773
+
4774
+ if (classList.length > keys(classMap).length) {
4775
+ nodesAreCompatible = false;
4776
+ }
4777
+ }
4778
+
4779
+ if (!nodesAreCompatible) {
4780
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
4781
+ }
4782
+
4783
+ return nodesAreCompatible;
4784
+ }
4785
+
4786
+ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
4787
+ var _vnode$data2 = vnode.data,
4788
+ style = _vnode$data2.style,
4789
+ styleDecls = _vnode$data2.styleDecls,
4790
+ renderer = vnode.owner.renderer;
4791
+ var elmStyle = renderer.getAttribute(elm, 'style') || '';
4792
+ var vnodeStyle;
4793
+ var nodesAreCompatible = true;
4794
+
4795
+ if (!isUndefined$1(style) && style !== elmStyle) {
4796
+ nodesAreCompatible = false;
4797
+ vnodeStyle = style;
4798
+ } else if (!isUndefined$1(styleDecls)) {
4799
+ var parsedVnodeStyle = parseStyleText(elmStyle);
4800
+ var expectedStyle = []; // styleMap is used when style is set to static value.
4801
+
4802
+ for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
4803
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
4804
+ prop = _styleDecls$_i2[0],
4805
+ value = _styleDecls$_i2[1],
4806
+ important = _styleDecls$_i2[2];
4807
+
4808
+ expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
4809
+ var parsedPropValue = parsedVnodeStyle[prop];
4810
+
4811
+ if (isUndefined$1(parsedPropValue)) {
4812
+ nodesAreCompatible = false;
4813
+ } else if (!parsedPropValue.startsWith(value)) {
4814
+ nodesAreCompatible = false;
4815
+ } else if (important && !parsedPropValue.endsWith('!important')) {
4816
+ nodesAreCompatible = false;
4817
+ }
4818
+ }
4819
+
4820
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
4821
+ nodesAreCompatible = false;
4822
+ }
4823
+
4824
+ vnodeStyle = ArrayJoin.call(expectedStyle, ';');
4825
+ }
4826
+
4827
+ if (!nodesAreCompatible) {
4828
+ // style is used when class is bound to an expr.
4829
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
4830
+ }
4831
+
4832
+ return nodesAreCompatible;
4833
+ }
4834
+
4835
+ function throwHydrationError() {
4836
+ assert.fail('Server rendered elements do not match client side generated elements');
4837
+ }
4838
+
4839
+ function hydrateChildrenHook(elmChildren, children, vm) {
4840
+ var _a, _b;
4841
+
4842
+ if (process.env.NODE_ENV !== 'production') {
4843
+ var filteredVNodes = ArrayFilter.call(children, function (vnode) {
4844
+ return !!vnode;
4845
+ });
4846
+
4847
+ if (elmChildren.length !== filteredVNodes.length) {
4848
+ logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
4849
+ throwHydrationError();
4850
+ }
4851
+ }
4852
+
4853
+ var elmCurrentChildIdx = 0;
4854
+
4855
+ for (var j = 0, n = children.length; j < n; j++) {
4856
+ var ch = children[j];
4857
+
4858
+ if (ch != null) {
4859
+ var childNode = elmChildren[elmCurrentChildIdx];
4860
+
4861
+ if (process.env.NODE_ENV !== 'production') {
4862
+ // VComments and VTexts validation is handled in their hooks
4863
+ if (isElementNode(childNode)) {
4864
+ if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
4865
+ logError("Hydration mismatch: expecting element with tag \"".concat((_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase(), "\" but found \"").concat(childNode.tagName.toLowerCase(), "\"."), vm);
4866
+ throwHydrationError();
4867
+ } // Note: props are not yet set
4868
+
4869
+
4870
+ var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
4871
+ var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
4872
+ var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
4873
+ var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
4874
+
4875
+ if (!isVNodeAndElementCompatible) {
4876
+ throwHydrationError();
4877
+ }
4878
+ }
4879
+ }
4880
+
4881
+ ch.hook.hydrate(ch, childNode);
4882
+ elmCurrentChildIdx++;
4883
+ }
4884
+ }
4885
+ }
4886
+
4658
4887
  function updateCustomElmHook(oldVnode, vnode) {
4659
4888
  // Attrs need to be applied to element before props
4660
4889
  // IE11 will wipe out value on radio inputs if value
@@ -4748,38 +4977,6 @@ var LWC = (function (exports) {
4748
4977
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4749
4978
  */
4750
4979
 
4751
- /**
4752
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
4753
- * libraries to sanitize HTML content. This hook process the content passed via the template to
4754
- * lwc:inner-html directive.
4755
- * It is meant to be overridden with setSanitizeHtmlContentHook
4756
- */
4757
-
4758
-
4759
- var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
4760
- // locker-service patches this function during runtime to sanitize HTML content.
4761
- throw new Error('sanitizeHtmlContent hook must be implemented.');
4762
- };
4763
- /**
4764
- * Sets the sanitizeHtmlContentHook.
4765
- *
4766
- * @param newHookImpl
4767
- * @returns oldHookImplementation.
4768
- */
4769
-
4770
-
4771
- function setSanitizeHtmlContentHook(newHookImpl) {
4772
- var currentHook = sanitizeHtmlContentHook;
4773
- sanitizeHtmlContentHook = newHookImpl;
4774
- return currentHook;
4775
- }
4776
- /*
4777
- * Copyright (c) 2018, salesforce.com, inc.
4778
- * All rights reserved.
4779
- * SPDX-License-Identifier: MIT
4780
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4781
- */
4782
-
4783
4980
 
4784
4981
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
4785
4982
  var SymbolIterator = Symbol.iterator;
@@ -4794,7 +4991,26 @@ var LWC = (function (exports) {
4794
4991
  update: updateNodeHook,
4795
4992
  insert: insertNodeHook,
4796
4993
  move: insertNodeHook,
4797
- remove: removeNodeHook
4994
+ remove: removeNodeHook,
4995
+ hydrate: function hydrate(vNode, node) {
4996
+ var _a;
4997
+
4998
+ if (process.env.NODE_ENV !== 'production') {
4999
+ // eslint-disable-next-line lwc-internal/no-global-node
5000
+ if (node.nodeType !== Node.TEXT_NODE) {
5001
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5002
+ assert.fail('Hydration mismatch: incorrect node type received.');
5003
+ }
5004
+
5005
+ if (node.nodeValue !== vNode.text) {
5006
+ logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
5007
+ }
5008
+ } // always set the text value to the one from the vnode.
5009
+
5010
+
5011
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5012
+ vNode.elm = node;
5013
+ }
4798
5014
  };
4799
5015
  var CommentHook = {
4800
5016
  create: function create(vnode) {
@@ -4808,7 +5024,26 @@ var LWC = (function (exports) {
4808
5024
  update: updateNodeHook,
4809
5025
  insert: insertNodeHook,
4810
5026
  move: insertNodeHook,
4811
- remove: removeNodeHook
5027
+ remove: removeNodeHook,
5028
+ hydrate: function hydrate(vNode, node) {
5029
+ var _a;
5030
+
5031
+ if (process.env.NODE_ENV !== 'production') {
5032
+ // eslint-disable-next-line lwc-internal/no-global-node
5033
+ if (node.nodeType !== Node.COMMENT_NODE) {
5034
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5035
+ assert.fail('Hydration mismatch: incorrect node type received.');
5036
+ }
5037
+
5038
+ if (node.nodeValue !== vNode.text) {
5039
+ logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
5040
+ }
5041
+ } // always set the text value to the one from the vnode.
5042
+
5043
+
5044
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5045
+ vNode.elm = node;
5046
+ }
4812
5047
  }; // insert is called after update, which is used somewhere else (via a module)
4813
5048
  // to mark the vm as inserted, that means we cannot use update as the main channel
4814
5049
  // to rehydrate when dirty, because sometimes the element is not inserted just yet,
@@ -4842,6 +5077,34 @@ var LWC = (function (exports) {
4842
5077
  remove: function remove(vnode, parentNode) {
4843
5078
  removeNodeHook(vnode, parentNode);
4844
5079
  removeElmHook(vnode);
5080
+ },
5081
+ hydrate: function hydrate(vnode, node) {
5082
+ var elm = node;
5083
+ vnode.elm = elm;
5084
+ var context = vnode.data.context;
5085
+ var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5086
+ /* manual */
5087
+ );
5088
+
5089
+ if (isDomManual) {
5090
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5091
+ // remove the innerHTML from props so it reuses the existing dom elements.
5092
+ var props = vnode.data.props;
5093
+
5094
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5095
+ if (elm.innerHTML === props.innerHTML) {
5096
+ delete props.innerHTML;
5097
+ } else {
5098
+ logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5099
+ }
5100
+ }
5101
+ }
5102
+
5103
+ hydrateElmHook(vnode);
5104
+
5105
+ if (!isDomManual) {
5106
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
5107
+ }
4845
5108
  }
4846
5109
  };
4847
5110
  var CustomElementHook = {
@@ -4929,6 +5192,42 @@ var LWC = (function (exports) {
4929
5192
  // will take care of disconnecting any child VM attached to its shadow as well.
4930
5193
  removeVM(vm);
4931
5194
  }
5195
+ },
5196
+ hydrate: function hydrate(vnode, elm) {
5197
+ // the element is created, but the vm is not
5198
+ var sel = vnode.sel,
5199
+ mode = vnode.mode,
5200
+ ctor = vnode.ctor,
5201
+ owner = vnode.owner;
5202
+ var def = getComponentInternalDef(ctor);
5203
+ createVM(elm, def, {
5204
+ mode: mode,
5205
+ owner: owner,
5206
+ tagName: sel,
5207
+ renderer: owner.renderer
5208
+ });
5209
+ vnode.elm = elm;
5210
+ var vm = getAssociatedVM(elm);
5211
+ allocateChildrenHook(vnode, vm);
5212
+ hydrateElmHook(vnode); // Insert hook section:
5213
+
5214
+ if (process.env.NODE_ENV !== 'production') {
5215
+ assert.isTrue(vm.state === 0
5216
+ /* created */
5217
+ , "".concat(vm, " cannot be recycled."));
5218
+ }
5219
+
5220
+ runConnectedCallback(vm);
5221
+
5222
+ if (vm.renderMode !== 0
5223
+ /* Light */
5224
+ ) {
5225
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5226
+ // Note: for Light DOM, this is handled while hydrating the VM
5227
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
5228
+ }
5229
+
5230
+ hydrateVM(vm);
4932
5231
  }
4933
5232
  };
4934
5233
 
@@ -5231,7 +5530,7 @@ var LWC = (function (exports) {
5231
5530
 
5232
5531
 
5233
5532
  function d(value) {
5234
- return value == null ? '' : value;
5533
+ return value == null ? '' : String(value);
5235
5534
  } // [b]ind function
5236
5535
 
5237
5536
 
@@ -5391,6 +5690,26 @@ var LWC = (function (exports) {
5391
5690
 
5392
5691
  markAsDynamicChildren(vnodes);
5393
5692
  return vnodes;
5693
+ }
5694
+ /**
5695
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
5696
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
5697
+ * lwc:inner-html directive.
5698
+ * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
5699
+ */
5700
+
5701
+
5702
+ var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
5703
+ // locker-service patches this function during runtime to sanitize HTML content.
5704
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
5705
+ };
5706
+ /**
5707
+ * Sets the sanitizeHtmlContentHook.
5708
+ */
5709
+
5710
+
5711
+ function setSanitizeHtmlContentHook(newHookImpl) {
5712
+ sanitizeHtmlContentHook = newHookImpl;
5394
5713
  } // [s]anitize [h]tml [c]ontent
5395
5714
 
5396
5715
 
@@ -5493,8 +5812,8 @@ var LWC = (function (exports) {
5493
5812
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5494
5813
  var content = [];
5495
5814
 
5496
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
5497
- var stylesheet = stylesheets[_i14];
5815
+ for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5816
+ var stylesheet = stylesheets[_i16];
5498
5817
 
5499
5818
  if (isArray$1(stylesheet)) {
5500
5819
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
@@ -5570,10 +5889,13 @@ var LWC = (function (exports) {
5570
5889
  && shadowMode === 1
5571
5890
  /* Synthetic */
5572
5891
  ) {
5573
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
5574
- renderer.insertGlobalStylesheet(stylesheets[_i15]);
5892
+ for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5893
+ renderer.insertGlobalStylesheet(stylesheets[_i17]);
5575
5894
  }
5576
- } else if (renderer.ssr) {
5895
+ } else if (renderer.ssr || renderer.isHydrating()) {
5896
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5897
+ // This works in the client, because the stylesheets are created, and cached in the VM
5898
+ // the first time the VM renders.
5577
5899
  // native shadow or light DOM, SSR
5578
5900
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
5579
5901
  return createInlineStyleVNode(combinedStylesheetContent);
@@ -5582,12 +5904,12 @@ var LWC = (function (exports) {
5582
5904
  var root = getNearestNativeShadowComponent(vm);
5583
5905
  var isGlobal = isNull(root);
5584
5906
 
5585
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5907
+ for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
5586
5908
  if (isGlobal) {
5587
- renderer.insertGlobalStylesheet(stylesheets[_i16]);
5909
+ renderer.insertGlobalStylesheet(stylesheets[_i18]);
5588
5910
  } else {
5589
5911
  // local level
5590
- renderer.insertStylesheet(stylesheets[_i16], root.cmpRoot);
5912
+ renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
5591
5913
  }
5592
5914
  }
5593
5915
  }
@@ -5864,8 +6186,8 @@ var LWC = (function (exports) {
5864
6186
  var stylesheets = template.stylesheets;
5865
6187
 
5866
6188
  if (!isUndefined$1(stylesheets)) {
5867
- for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5868
- if (isTrue(stylesheets[_i17][KEY__SCOPED_CSS])) {
6189
+ for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
6190
+ if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
5869
6191
  return true;
5870
6192
  }
5871
6193
  }
@@ -6095,8 +6417,8 @@ var LWC = (function (exports) {
6095
6417
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6096
6418
  }
6097
6419
 
6098
- for (var _i18 = 0; _i18 < hooks.length; ++_i18) {
6099
- var hookName = hooks[_i18];
6420
+ for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
6421
+ var hookName = hooks[_i20];
6100
6422
 
6101
6423
  if (hookName in service) {
6102
6424
  var l = Services[hookName];
@@ -6119,8 +6441,8 @@ var LWC = (function (exports) {
6119
6441
  def = vm.def,
6120
6442
  context = vm.context;
6121
6443
 
6122
- for (var _i19 = 0, _len6 = cbs.length; _i19 < _len6; ++_i19) {
6123
- cbs[_i19].call(undefined, component, {}, def, context);
6444
+ for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
6445
+ cbs[_i21].call(undefined, component, {}, def, context);
6124
6446
  }
6125
6447
  }
6126
6448
  /*
@@ -6173,6 +6495,12 @@ var LWC = (function (exports) {
6173
6495
  , vm);
6174
6496
  }
6175
6497
 
6498
+ function hydrateRootElement(elm) {
6499
+ var vm = getAssociatedVM(elm);
6500
+ runConnectedCallback(vm);
6501
+ hydrateVM(vm);
6502
+ }
6503
+
6176
6504
  function disconnectRootElement(elm) {
6177
6505
  var vm = getAssociatedVM(elm);
6178
6506
  resetComponentStateWhenRemoved(vm);
@@ -6180,6 +6508,10 @@ var LWC = (function (exports) {
6180
6508
 
6181
6509
  function appendVM(vm) {
6182
6510
  rehydrate(vm);
6511
+ }
6512
+
6513
+ function hydrateVM(vm) {
6514
+ hydrate(vm);
6183
6515
  } // just in case the component comes back, with this we guarantee re-rendering it
6184
6516
  // while preventing any attempt to rehydration until after reinsertion.
6185
6517
 
@@ -6403,6 +6735,22 @@ var LWC = (function (exports) {
6403
6735
  }
6404
6736
  }
6405
6737
 
6738
+ function hydrate(vm) {
6739
+ if (isTrue(vm.isDirty)) {
6740
+ // manually diffing/patching here.
6741
+ // This routine is:
6742
+ // patchShadowRoot(vm, children);
6743
+ // -> addVnodes.
6744
+ var children = renderComponent(vm);
6745
+ vm.children = children;
6746
+ var vmChildren = vm.renderMode === 0
6747
+ /* Light */
6748
+ ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
6749
+ hydrateChildrenHook(vmChildren, children, vm);
6750
+ runRenderedCallback(vm);
6751
+ }
6752
+ }
6753
+
6406
6754
  function patchShadowRoot(vm, newCh) {
6407
6755
  var oldCh = vm.children; // caching the new children collection
6408
6756
 
@@ -6483,19 +6831,19 @@ var LWC = (function (exports) {
6483
6831
  });
6484
6832
  rehydrateQueue = []; // reset to a new queue
6485
6833
 
6486
- for (var _i20 = 0, _len7 = vms.length; _i20 < _len7; _i20 += 1) {
6487
- var vm = vms[_i20];
6834
+ for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
6835
+ var vm = vms[_i22];
6488
6836
 
6489
6837
  try {
6490
6838
  rehydrate(vm);
6491
6839
  } catch (error) {
6492
- if (_i20 + 1 < _len7) {
6840
+ if (_i22 + 1 < _len7) {
6493
6841
  // pieces of the queue are still pending to be rehydrated, those should have priority
6494
6842
  if (rehydrateQueue.length === 0) {
6495
6843
  addCallbackToNextTick(flushRehydrationQueue);
6496
6844
  }
6497
6845
 
6498
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i20 + 1));
6846
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
6499
6847
  } // we need to end the measure before throwing.
6500
6848
 
6501
6849
 
@@ -6599,8 +6947,8 @@ var LWC = (function (exports) {
6599
6947
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
6600
6948
  // inserted in reserved order.
6601
6949
 
6602
- for (var _i21 = vCustomElementCollection.length - 1; _i21 >= 0; _i21 -= 1) {
6603
- var elm = vCustomElementCollection[_i21].elm; // There are two cases where the element could be undefined:
6950
+ for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
6951
+ var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
6604
6952
  // * when there is an error during the construction phase, and an error
6605
6953
  // boundary picks it, there is a possibility that the VCustomElement
6606
6954
  // is not properly initialized, and therefore is should be ignored.
@@ -6634,8 +6982,8 @@ var LWC = (function (exports) {
6634
6982
 
6635
6983
 
6636
6984
  function recursivelyDisconnectChildren(vnodes) {
6637
- for (var _i22 = 0, _len8 = vnodes.length; _i22 < _len8; _i22 += 1) {
6638
- var vnode = vnodes[_i22];
6985
+ for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
6986
+ var vnode = vnodes[_i24];
6639
6987
 
6640
6988
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
6641
6989
  // vnode is a VElement with children
@@ -6659,8 +7007,8 @@ var LWC = (function (exports) {
6659
7007
  renderer = vm.renderer;
6660
7008
  var rootNode = getRenderRoot(vm);
6661
7009
 
6662
- for (var _i23 = 0, _len9 = children.length; _i23 < _len9; _i23++) {
6663
- var child = children[_i23];
7010
+ for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
7011
+ var child = children[_i25];
6664
7012
 
6665
7013
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6666
7014
  renderer.remove(child.elm, rootNode);
@@ -6705,8 +7053,8 @@ var LWC = (function (exports) {
6705
7053
  var oldSlots = vm.cmpSlots;
6706
7054
  var cmpSlots = vm.cmpSlots = create(null);
6707
7055
 
6708
- for (var _i24 = 0, _len10 = children.length; _i24 < _len10; _i24 += 1) {
6709
- var vnode = children[_i24];
7056
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
7057
+ var vnode = children[_i26];
6710
7058
 
6711
7059
  if (isNull(vnode)) {
6712
7060
  continue;
@@ -6736,8 +7084,8 @@ var LWC = (function (exports) {
6736
7084
  return;
6737
7085
  }
6738
7086
 
6739
- for (var _i25 = 0, _len11 = oldKeys.length; _i25 < _len11; _i25 += 1) {
6740
- var key = oldKeys[_i25];
7087
+ for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
7088
+ var key = oldKeys[_i27];
6741
7089
 
6742
7090
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
6743
7091
  markComponentAsDirty(vm);
@@ -7100,8 +7448,8 @@ var LWC = (function (exports) {
7100
7448
  function connectWireAdapters(vm) {
7101
7449
  var wiredConnecting = vm.context.wiredConnecting;
7102
7450
 
7103
- for (var _i26 = 0, _len12 = wiredConnecting.length; _i26 < _len12; _i26 += 1) {
7104
- wiredConnecting[_i26]();
7451
+ for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
7452
+ wiredConnecting[_i28]();
7105
7453
  }
7106
7454
  }
7107
7455
 
@@ -7109,8 +7457,8 @@ var LWC = (function (exports) {
7109
7457
  var wiredDisconnecting = vm.context.wiredDisconnecting;
7110
7458
  runWithBoundaryProtection(vm, vm, noop, function () {
7111
7459
  // job
7112
- for (var _i27 = 0, _len13 = wiredDisconnecting.length; _i27 < _len13; _i27 += 1) {
7113
- wiredDisconnecting[_i27]();
7460
+ for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
7461
+ wiredDisconnecting[_i29]();
7114
7462
  }
7115
7463
  }, noop);
7116
7464
  }
@@ -7195,28 +7543,12 @@ var LWC = (function (exports) {
7195
7543
 
7196
7544
  var hooksAreSet = false;
7197
7545
 
7198
- function overrideHooks(hooks) {
7199
- var oldHooks = {};
7200
-
7201
- if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
7202
- oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7203
- }
7204
-
7205
- return oldHooks;
7206
- }
7207
-
7208
7546
  function setHooks(hooks) {
7209
7547
  assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
7210
- overrideHooks(hooks);
7211
7548
  hooksAreSet = true;
7549
+ setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7212
7550
  }
7213
-
7214
- function setHooksForTest(hooks) {
7215
- if (process.env.NODE_ENV !== 'production') {
7216
- return overrideHooks(hooks);
7217
- }
7218
- }
7219
- /* version: 2.5.6 */
7551
+ /* version: 2.5.10-alpha1 */
7220
7552
 
7221
7553
  /*
7222
7554
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7231,8 +7563,8 @@ var LWC = (function (exports) {
7231
7563
  if (process.env.NODE_ENV === 'development') {
7232
7564
  // @ts-ignore
7233
7565
  window.__lwcResetGlobalStylesheets = function () {
7234
- for (var _i28 = 0, _Object$keys = Object.keys(globalStylesheets); _i28 < _Object$keys.length; _i28++) {
7235
- var key = _Object$keys[_i28];
7566
+ for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
7567
+ var key = _Object$keys[_i30];
7236
7568
  delete globalStylesheets[key];
7237
7569
  }
7238
7570
  };
@@ -7371,8 +7703,17 @@ var LWC = (function (exports) {
7371
7703
  HTMLElementConstructor.prototype = HTMLElement.prototype;
7372
7704
  }
7373
7705
 
7706
+ var _isHydrating = false;
7707
+
7708
+ function setIsHydrating(v) {
7709
+ _isHydrating = v;
7710
+ }
7711
+
7374
7712
  var renderer = {
7375
7713
  ssr: false,
7714
+ isHydrating: function isHydrating() {
7715
+ return _isHydrating;
7716
+ },
7376
7717
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7377
7718
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
7378
7719
  createElement: function createElement(tagName, namespace) {
@@ -7394,6 +7735,10 @@ var LWC = (function (exports) {
7394
7735
  return node.nextSibling;
7395
7736
  },
7396
7737
  attachShadow: function attachShadow(element, options) {
7738
+ if (_isHydrating) {
7739
+ return element.shadowRoot;
7740
+ }
7741
+
7397
7742
  return element.attachShadow(options);
7398
7743
  },
7399
7744
  setText: function setText(node, content) {
@@ -7504,75 +7849,6 @@ var LWC = (function (exports) {
7504
7849
  getCustomElement: getCustomElement,
7505
7850
  HTMLElement: HTMLElementConstructor
7506
7851
  };
7507
- /*
7508
- * Copyright (c) 2018, salesforce.com, inc.
7509
- * All rights reserved.
7510
- * SPDX-License-Identifier: MIT
7511
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7512
- */
7513
-
7514
- /**
7515
- * This function builds a Web Component class from a LWC constructor so it can be
7516
- * registered as a new element via customElements.define() at any given time.
7517
- *
7518
- * @deprecated since version 1.3.11
7519
- *
7520
- * @example
7521
- * ```
7522
- * import { buildCustomElementConstructor } from 'lwc';
7523
- * import Foo from 'ns/foo';
7524
- * const WC = buildCustomElementConstructor(Foo);
7525
- * customElements.define('x-foo', WC);
7526
- * const elm = document.createElement('x-foo');
7527
- * ```
7528
- */
7529
-
7530
- function deprecatedBuildCustomElementConstructor(Ctor) {
7531
- if (process.env.NODE_ENV !== 'production') {
7532
- /* eslint-disable-next-line no-console */
7533
- console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
7534
- }
7535
-
7536
- return Ctor.CustomElementConstructor;
7537
- }
7538
-
7539
- function buildCustomElementConstructor(Ctor) {
7540
- var def = getComponentInternalDef(Ctor);
7541
- return /*#__PURE__*/function (_def$bridge) {
7542
- _inherits(_class, _def$bridge);
7543
-
7544
- var _super8 = _createSuper(_class);
7545
-
7546
- function _class() {
7547
- var _this6;
7548
-
7549
- _classCallCheck(this, _class);
7550
-
7551
- _this6 = _super8.call(this);
7552
- createVM(_assertThisInitialized(_this6), def, {
7553
- mode: 'open',
7554
- owner: null,
7555
- tagName: _this6.tagName,
7556
- renderer: renderer
7557
- });
7558
- return _this6;
7559
- }
7560
-
7561
- _createClass(_class, [{
7562
- key: "connectedCallback",
7563
- value: function connectedCallback() {
7564
- connectRootElement(this);
7565
- }
7566
- }, {
7567
- key: "disconnectedCallback",
7568
- value: function disconnectedCallback() {
7569
- disconnectRootElement(this);
7570
- }
7571
- }]);
7572
-
7573
- return _class;
7574
- }(def.bridge);
7575
- }
7576
7852
  /*
7577
7853
  * Copyright (c) 2018, salesforce.com, inc.
7578
7854
  * All rights reserved.
@@ -7582,7 +7858,6 @@ var LWC = (function (exports) {
7582
7858
  // TODO [#2472]: Remove this workaround when appropriate.
7583
7859
  // eslint-disable-next-line lwc-internal/no-global-node
7584
7860
 
7585
-
7586
7861
  var _Node$1 = Node;
7587
7862
  var ConnectingSlot = new WeakMap();
7588
7863
  var DisconnectingSlot = new WeakMap();
@@ -7692,6 +7967,142 @@ var LWC = (function (exports) {
7692
7967
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7693
7968
  */
7694
7969
 
7970
+
7971
+ function hydrateComponent(element, Ctor) {
7972
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7973
+
7974
+ if (!isFunction$1(Ctor)) {
7975
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
7976
+ }
7977
+
7978
+ if (!isObject(props) || isNull(props)) {
7979
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
7980
+ }
7981
+
7982
+ var def = getComponentInternalDef(Ctor);
7983
+
7984
+ try {
7985
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7986
+ // and uses the same algo to create the stylesheets as in SSR.
7987
+ setIsHydrating(true);
7988
+ createVM(element, def, {
7989
+ mode: 'open',
7990
+ owner: null,
7991
+ renderer: renderer,
7992
+ tagName: element.tagName.toLowerCase()
7993
+ });
7994
+
7995
+ for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
7996
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
7997
+ key = _Object$entries2$_i[0],
7998
+ value = _Object$entries2$_i[1];
7999
+
8000
+ element[key] = value;
8001
+ }
8002
+
8003
+ hydrateRootElement(element); // set it back since now we finished hydration.
8004
+
8005
+ setIsHydrating(false);
8006
+ } catch (e) {
8007
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
8008
+ // the client generated DOM.
8009
+
8010
+ /* eslint-disable-next-line no-console */
8011
+ console.error('Recovering from error while hydrating: ', e);
8012
+ setIsHydrating(false);
8013
+ var newElem = createElement(element.tagName, {
8014
+ is: Ctor,
8015
+ mode: 'open'
8016
+ });
8017
+
8018
+ for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
8019
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
8020
+ _key3 = _Object$entries3$_i[0],
8021
+ _value2 = _Object$entries3$_i[1];
8022
+
8023
+ newElem[_key3] = _value2;
8024
+ }
8025
+
8026
+ element.parentNode.replaceChild(newElem, element);
8027
+ }
8028
+ }
8029
+ /*
8030
+ * Copyright (c) 2018, salesforce.com, inc.
8031
+ * All rights reserved.
8032
+ * SPDX-License-Identifier: MIT
8033
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8034
+ */
8035
+
8036
+ /**
8037
+ * This function builds a Web Component class from a LWC constructor so it can be
8038
+ * registered as a new element via customElements.define() at any given time.
8039
+ *
8040
+ * @deprecated since version 1.3.11
8041
+ *
8042
+ * @example
8043
+ * ```
8044
+ * import { buildCustomElementConstructor } from 'lwc';
8045
+ * import Foo from 'ns/foo';
8046
+ * const WC = buildCustomElementConstructor(Foo);
8047
+ * customElements.define('x-foo', WC);
8048
+ * const elm = document.createElement('x-foo');
8049
+ * ```
8050
+ */
8051
+
8052
+
8053
+ function deprecatedBuildCustomElementConstructor(Ctor) {
8054
+ if (process.env.NODE_ENV !== 'production') {
8055
+ /* eslint-disable-next-line no-console */
8056
+ console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + "Use \"".concat(Ctor.name, ".CustomElementConstructor\" static property of the component constructor to access the corresponding custom element constructor instead."));
8057
+ }
8058
+
8059
+ return Ctor.CustomElementConstructor;
8060
+ }
8061
+
8062
+ function buildCustomElementConstructor(Ctor) {
8063
+ var def = getComponentInternalDef(Ctor);
8064
+ return /*#__PURE__*/function (_def$bridge) {
8065
+ _inherits(_class, _def$bridge);
8066
+
8067
+ var _super8 = _createSuper(_class);
8068
+
8069
+ function _class() {
8070
+ var _this6;
8071
+
8072
+ _classCallCheck(this, _class);
8073
+
8074
+ _this6 = _super8.call(this);
8075
+ createVM(_assertThisInitialized(_this6), def, {
8076
+ mode: 'open',
8077
+ owner: null,
8078
+ tagName: _this6.tagName,
8079
+ renderer: renderer
8080
+ });
8081
+ return _this6;
8082
+ }
8083
+
8084
+ _createClass(_class, [{
8085
+ key: "connectedCallback",
8086
+ value: function connectedCallback() {
8087
+ connectRootElement(this);
8088
+ }
8089
+ }, {
8090
+ key: "disconnectedCallback",
8091
+ value: function disconnectedCallback() {
8092
+ disconnectRootElement(this);
8093
+ }
8094
+ }]);
8095
+
8096
+ return _class;
8097
+ }(def.bridge);
8098
+ }
8099
+ /*
8100
+ * Copyright (c) 2018, salesforce.com, inc.
8101
+ * All rights reserved.
8102
+ * SPDX-License-Identifier: MIT
8103
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8104
+ */
8105
+
7695
8106
  /**
7696
8107
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
7697
8108
  * This API is subject to change or being removed.
@@ -7790,7 +8201,7 @@ var LWC = (function (exports) {
7790
8201
  });
7791
8202
  freeze(LightningElement);
7792
8203
  seal(LightningElement.prototype);
7793
- /* version: 2.5.6 */
8204
+ /* version: 2.5.10-alpha1 */
7794
8205
 
7795
8206
  exports.LightningElement = LightningElement;
7796
8207
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7800,6 +8211,7 @@ var LWC = (function (exports) {
7800
8211
  exports.createElement = createElement;
7801
8212
  exports.getComponentConstructor = getComponentConstructor;
7802
8213
  exports.getComponentDef = getComponentDef;
8214
+ exports.hydrateComponent = hydrateComponent;
7803
8215
  exports.isComponentConstructor = isComponentConstructor;
7804
8216
  exports.isNodeFromTemplate = isNodeFromTemplate;
7805
8217
  exports.readonly = readonly;
@@ -7811,7 +8223,6 @@ var LWC = (function (exports) {
7811
8223
  exports.setFeatureFlag = setFeatureFlag;
7812
8224
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
7813
8225
  exports.setHooks = setHooks;
7814
- exports.setHooksForTest = setHooksForTest;
7815
8226
  exports.swapComponent = swapComponent;
7816
8227
  exports.swapStyle = swapStyle;
7817
8228
  exports.swapTemplate = swapTemplate;
@@ -7823,4 +8234,4 @@ var LWC = (function (exports) {
7823
8234
 
7824
8235
  return exports;
7825
8236
 
7826
- })({});
8237
+ }({}));