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
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LWC = {}));
5
- })(this, (function (exports) { 'use strict';
5
+ }(this, (function (exports) { 'use strict';
6
6
 
7
7
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf2(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
8
8
 
@@ -10,8 +10,6 @@
10
10
 
11
11
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
12
12
 
13
- 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; } } }; }
14
-
15
13
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
16
14
 
17
15
  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."); }
@@ -40,23 +38,25 @@
40
38
 
41
39
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
42
40
 
43
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
41
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44
42
 
45
- 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."); }
43
+ 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); } }
46
44
 
47
- 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); }
45
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
48
46
 
49
- 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; }
47
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
+
49
+ 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."); }
50
50
 
51
51
  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; }
52
52
 
53
53
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
54
54
 
55
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
+ 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; } } }; }
56
56
 
57
- 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); } }
57
+ 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); }
58
58
 
59
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
59
+ 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; }
60
60
 
61
61
  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); }
62
62
 
@@ -123,6 +123,7 @@
123
123
  setPrototypeOf = Object.setPrototypeOf;
124
124
  var isArray$1 = Array.isArray;
125
125
  var _Array$prototype = Array.prototype,
126
+ ArrayFilter = _Array$prototype.filter,
126
127
  ArrayIndexOf = _Array$prototype.indexOf,
127
128
  ArrayJoin = _Array$prototype.join,
128
129
  ArrayMap$1 = _Array$prototype.map,
@@ -350,7 +351,7 @@
350
351
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
351
352
  return attributeName;
352
353
  }
353
- /** version: 2.5.6 */
354
+ /** version: 2.5.10-alpha1 */
354
355
 
355
356
  /*
356
357
  * Copyright (c) 2018, salesforce.com, inc.
@@ -530,7 +531,7 @@
530
531
  setFeatureFlag(name, value);
531
532
  }
532
533
  }
533
- /** version: 2.5.6 */
534
+ /** version: 2.5.10-alpha1 */
534
535
 
535
536
  /* proxy-compat-disable */
536
537
 
@@ -582,6 +583,42 @@
582
583
  }
583
584
 
584
585
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
586
+ } // Borrowed from Vue template compiler.
587
+ // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
588
+
589
+
590
+ var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
591
+ var PROPERTY_DELIMITER = /:(.+)/;
592
+
593
+ function parseStyleText(cssText) {
594
+ var styleMap = {};
595
+ var declarations = cssText.split(DECLARATION_DELIMITER);
596
+
597
+ var _iterator = _createForOfIteratorHelper(declarations),
598
+ _step;
599
+
600
+ try {
601
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
602
+ var declaration = _step.value;
603
+
604
+ if (declaration) {
605
+ var _declaration$split = declaration.split(PROPERTY_DELIMITER),
606
+ _declaration$split2 = _slicedToArray(_declaration$split, 2),
607
+ prop = _declaration$split2[0],
608
+ value = _declaration$split2[1];
609
+
610
+ if (prop !== undefined && value !== undefined) {
611
+ styleMap[prop.trim()] = value.trim();
612
+ }
613
+ }
614
+ }
615
+ } catch (err) {
616
+ _iterator.e(err);
617
+ } finally {
618
+ _iterator.f();
619
+ }
620
+
621
+ return styleMap;
585
622
  }
586
623
  /*
587
624
  * Copyright (c) 2019, salesforce.com, inc.
@@ -770,8 +807,8 @@
770
807
  */
771
808
 
772
809
 
773
- function logError(message, vm) {
774
- var msg = "[LWC error]: ".concat(message);
810
+ function log(method, message, vm) {
811
+ var msg = "[LWC ".concat(method, "]: ").concat(message);
775
812
 
776
813
  if (!isUndefined$1(vm)) {
777
814
  msg = "".concat(msg, "\n").concat(getComponentStack(vm));
@@ -779,7 +816,7 @@
779
816
 
780
817
  if (process.env.NODE_ENV === 'test') {
781
818
  /* eslint-disable-next-line no-console */
782
- console.error(msg);
819
+ console[method](msg);
783
820
  return;
784
821
  }
785
822
 
@@ -787,9 +824,17 @@
787
824
  throw new Error(msg);
788
825
  } catch (e) {
789
826
  /* eslint-disable-next-line no-console */
790
- console.error(e);
827
+ console[method](e);
791
828
  }
792
829
  }
830
+
831
+ function logError(message, vm) {
832
+ log('error', message, vm);
833
+ }
834
+
835
+ function logWarn(message, vm) {
836
+ log('warn', message, vm);
837
+ }
793
838
  /*
794
839
  * Copyright (c) 2018, salesforce.com, inc.
795
840
  * All rights reserved.
@@ -3018,7 +3063,9 @@
3018
3063
  }
3019
3064
 
3020
3065
  return renderer[rendererMethod](elm);
3021
- }
3066
+ },
3067
+ configurable: true,
3068
+ enumerable: true
3022
3069
  };
3023
3070
  };
3024
3071
 
@@ -3041,7 +3088,10 @@
3041
3088
  }
3042
3089
 
3043
3090
  return renderer[queryMethod](elm, arg);
3044
- }
3091
+ },
3092
+ configurable: true,
3093
+ enumerable: true,
3094
+ writable: true
3045
3095
  };
3046
3096
  };
3047
3097
 
@@ -3934,12 +3984,12 @@
3934
3984
  function flattenStylesheets(stylesheets) {
3935
3985
  var list = [];
3936
3986
 
3937
- var _iterator = _createForOfIteratorHelper(stylesheets),
3938
- _step;
3987
+ var _iterator2 = _createForOfIteratorHelper(stylesheets),
3988
+ _step2;
3939
3989
 
3940
3990
  try {
3941
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3942
- var stylesheet = _step.value;
3991
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3992
+ var stylesheet = _step2.value;
3943
3993
 
3944
3994
  if (!Array.isArray(stylesheet)) {
3945
3995
  list.push(stylesheet);
@@ -3948,9 +3998,9 @@
3948
3998
  }
3949
3999
  }
3950
4000
  } catch (err) {
3951
- _iterator.e(err);
4001
+ _iterator2.e(err);
3952
4002
  } finally {
3953
- _iterator.f();
4003
+ _iterator2.f();
3954
4004
  }
3955
4005
 
3956
4006
  return list;
@@ -4214,7 +4264,7 @@
4214
4264
  if (!isUndefined$1(ctorShadowSupportMode)) {
4215
4265
  assert.invariant(ctorShadowSupportMode === "any"
4216
4266
  /* Any */
4217
- || ctorShadowSupportMode === "default"
4267
+ || ctorShadowSupportMode === "reset"
4218
4268
  /* Default */
4219
4269
  , "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
4220
4270
  }
@@ -4372,7 +4422,7 @@
4372
4422
  renderMode: 1
4373
4423
  /* Shadow */
4374
4424
  ,
4375
- shadowSupportMode: "default"
4425
+ shadowSupportMode: "reset"
4376
4426
  /* Default */
4377
4427
  ,
4378
4428
  wire: EmptyObject,
@@ -4509,6 +4559,17 @@
4509
4559
  modComputedStyle.create(vnode);
4510
4560
  }
4511
4561
 
4562
+ function hydrateElmHook(vnode) {
4563
+ modEvents.create(vnode); // Attrs are already on the element.
4564
+ // modAttrs.create(vnode);
4565
+
4566
+ modProps.create(vnode); // Already set.
4567
+ // modStaticClassName.create(vnode);
4568
+ // modStaticStyle.create(vnode);
4569
+ // modComputedClassName.create(vnode);
4570
+ // modComputedStyle.create(vnode);
4571
+ }
4572
+
4512
4573
  function fallbackElmHook(elm, vnode) {
4513
4574
  var owner = vnode.owner;
4514
4575
  setScopeTokenClassIfNecessary(elm, owner);
@@ -4658,6 +4719,174 @@
4658
4719
  }
4659
4720
  }
4660
4721
 
4722
+ function isElementNode(node) {
4723
+ // eslint-disable-next-line lwc-internal/no-global-node
4724
+ return node.nodeType === Node.ELEMENT_NODE;
4725
+ }
4726
+
4727
+ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4728
+ var _vnode$data$attrs = vnode.data.attrs,
4729
+ attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
4730
+ renderer = vnode.owner.renderer;
4731
+ var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
4732
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
4733
+
4734
+ for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
4735
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
4736
+ attrName = _Object$entries$_i[0],
4737
+ attrValue = _Object$entries$_i[1];
4738
+
4739
+ var elmAttrValue = renderer.getAttribute(elm, attrName);
4740
+
4741
+ if (String(attrValue) !== elmAttrValue) {
4742
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
4743
+ nodesAreCompatible = false;
4744
+ }
4745
+ }
4746
+
4747
+ return nodesAreCompatible;
4748
+ }
4749
+
4750
+ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4751
+ var _vnode$data = vnode.data,
4752
+ className = _vnode$data.className,
4753
+ classMap = _vnode$data.classMap,
4754
+ renderer = vnode.owner.renderer;
4755
+ var nodesAreCompatible = true;
4756
+ var vnodeClassName;
4757
+
4758
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4759
+ // className is used when class is bound to an expr.
4760
+ nodesAreCompatible = false;
4761
+ vnodeClassName = className;
4762
+ } else if (!isUndefined$1(classMap)) {
4763
+ // classMap is used when class is set to static value.
4764
+ var classList = renderer.getClassList(elm);
4765
+ var computedClassName = ''; // all classes from the vnode should be in the element.classList
4766
+
4767
+ for (var name in classMap) {
4768
+ computedClassName += ' ' + name;
4769
+
4770
+ if (!classList.contains(name)) {
4771
+ nodesAreCompatible = false;
4772
+ }
4773
+ }
4774
+
4775
+ vnodeClassName = computedClassName.trim();
4776
+
4777
+ if (classList.length > keys(classMap).length) {
4778
+ nodesAreCompatible = false;
4779
+ }
4780
+ }
4781
+
4782
+ if (!nodesAreCompatible) {
4783
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
4784
+ }
4785
+
4786
+ return nodesAreCompatible;
4787
+ }
4788
+
4789
+ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
4790
+ var _vnode$data2 = vnode.data,
4791
+ style = _vnode$data2.style,
4792
+ styleDecls = _vnode$data2.styleDecls,
4793
+ renderer = vnode.owner.renderer;
4794
+ var elmStyle = renderer.getAttribute(elm, 'style') || '';
4795
+ var vnodeStyle;
4796
+ var nodesAreCompatible = true;
4797
+
4798
+ if (!isUndefined$1(style) && style !== elmStyle) {
4799
+ nodesAreCompatible = false;
4800
+ vnodeStyle = style;
4801
+ } else if (!isUndefined$1(styleDecls)) {
4802
+ var parsedVnodeStyle = parseStyleText(elmStyle);
4803
+ var expectedStyle = []; // styleMap is used when style is set to static value.
4804
+
4805
+ for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
4806
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
4807
+ prop = _styleDecls$_i2[0],
4808
+ value = _styleDecls$_i2[1],
4809
+ important = _styleDecls$_i2[2];
4810
+
4811
+ expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
4812
+ var parsedPropValue = parsedVnodeStyle[prop];
4813
+
4814
+ if (isUndefined$1(parsedPropValue)) {
4815
+ nodesAreCompatible = false;
4816
+ } else if (!parsedPropValue.startsWith(value)) {
4817
+ nodesAreCompatible = false;
4818
+ } else if (important && !parsedPropValue.endsWith('!important')) {
4819
+ nodesAreCompatible = false;
4820
+ }
4821
+ }
4822
+
4823
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
4824
+ nodesAreCompatible = false;
4825
+ }
4826
+
4827
+ vnodeStyle = ArrayJoin.call(expectedStyle, ';');
4828
+ }
4829
+
4830
+ if (!nodesAreCompatible) {
4831
+ // style is used when class is bound to an expr.
4832
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
4833
+ }
4834
+
4835
+ return nodesAreCompatible;
4836
+ }
4837
+
4838
+ function throwHydrationError() {
4839
+ assert.fail('Server rendered elements do not match client side generated elements');
4840
+ }
4841
+
4842
+ function hydrateChildrenHook(elmChildren, children, vm) {
4843
+ var _a, _b;
4844
+
4845
+ if (process.env.NODE_ENV !== 'production') {
4846
+ var filteredVNodes = ArrayFilter.call(children, function (vnode) {
4847
+ return !!vnode;
4848
+ });
4849
+
4850
+ if (elmChildren.length !== filteredVNodes.length) {
4851
+ logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
4852
+ throwHydrationError();
4853
+ }
4854
+ }
4855
+
4856
+ var elmCurrentChildIdx = 0;
4857
+
4858
+ for (var j = 0, n = children.length; j < n; j++) {
4859
+ var ch = children[j];
4860
+
4861
+ if (ch != null) {
4862
+ var childNode = elmChildren[elmCurrentChildIdx];
4863
+
4864
+ if (process.env.NODE_ENV !== 'production') {
4865
+ // VComments and VTexts validation is handled in their hooks
4866
+ if (isElementNode(childNode)) {
4867
+ if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
4868
+ 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);
4869
+ throwHydrationError();
4870
+ } // Note: props are not yet set
4871
+
4872
+
4873
+ var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
4874
+ var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
4875
+ var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
4876
+ var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
4877
+
4878
+ if (!isVNodeAndElementCompatible) {
4879
+ throwHydrationError();
4880
+ }
4881
+ }
4882
+ }
4883
+
4884
+ ch.hook.hydrate(ch, childNode);
4885
+ elmCurrentChildIdx++;
4886
+ }
4887
+ }
4888
+ }
4889
+
4661
4890
  function updateCustomElmHook(oldVnode, vnode) {
4662
4891
  // Attrs need to be applied to element before props
4663
4892
  // IE11 will wipe out value on radio inputs if value
@@ -4751,38 +4980,6 @@
4751
4980
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4752
4981
  */
4753
4982
 
4754
- /**
4755
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
4756
- * libraries to sanitize HTML content. This hook process the content passed via the template to
4757
- * lwc:inner-html directive.
4758
- * It is meant to be overridden with setSanitizeHtmlContentHook
4759
- */
4760
-
4761
-
4762
- var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
4763
- // locker-service patches this function during runtime to sanitize HTML content.
4764
- throw new Error('sanitizeHtmlContent hook must be implemented.');
4765
- };
4766
- /**
4767
- * Sets the sanitizeHtmlContentHook.
4768
- *
4769
- * @param newHookImpl
4770
- * @returns oldHookImplementation.
4771
- */
4772
-
4773
-
4774
- function setSanitizeHtmlContentHook(newHookImpl) {
4775
- var currentHook = sanitizeHtmlContentHook;
4776
- sanitizeHtmlContentHook = newHookImpl;
4777
- return currentHook;
4778
- }
4779
- /*
4780
- * Copyright (c) 2018, salesforce.com, inc.
4781
- * All rights reserved.
4782
- * SPDX-License-Identifier: MIT
4783
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4784
- */
4785
-
4786
4983
 
4787
4984
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
4788
4985
  var SymbolIterator = Symbol.iterator;
@@ -4797,7 +4994,26 @@
4797
4994
  update: updateNodeHook,
4798
4995
  insert: insertNodeHook,
4799
4996
  move: insertNodeHook,
4800
- remove: removeNodeHook
4997
+ remove: removeNodeHook,
4998
+ hydrate: function hydrate(vNode, node) {
4999
+ var _a;
5000
+
5001
+ if (process.env.NODE_ENV !== 'production') {
5002
+ // eslint-disable-next-line lwc-internal/no-global-node
5003
+ if (node.nodeType !== Node.TEXT_NODE) {
5004
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5005
+ assert.fail('Hydration mismatch: incorrect node type received.');
5006
+ }
5007
+
5008
+ if (node.nodeValue !== vNode.text) {
5009
+ logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
5010
+ }
5011
+ } // always set the text value to the one from the vnode.
5012
+
5013
+
5014
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5015
+ vNode.elm = node;
5016
+ }
4801
5017
  };
4802
5018
  var CommentHook = {
4803
5019
  create: function create(vnode) {
@@ -4811,7 +5027,26 @@
4811
5027
  update: updateNodeHook,
4812
5028
  insert: insertNodeHook,
4813
5029
  move: insertNodeHook,
4814
- remove: removeNodeHook
5030
+ remove: removeNodeHook,
5031
+ hydrate: function hydrate(vNode, node) {
5032
+ var _a;
5033
+
5034
+ if (process.env.NODE_ENV !== 'production') {
5035
+ // eslint-disable-next-line lwc-internal/no-global-node
5036
+ if (node.nodeType !== Node.COMMENT_NODE) {
5037
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5038
+ assert.fail('Hydration mismatch: incorrect node type received.');
5039
+ }
5040
+
5041
+ if (node.nodeValue !== vNode.text) {
5042
+ logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
5043
+ }
5044
+ } // always set the text value to the one from the vnode.
5045
+
5046
+
5047
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5048
+ vNode.elm = node;
5049
+ }
4815
5050
  }; // insert is called after update, which is used somewhere else (via a module)
4816
5051
  // to mark the vm as inserted, that means we cannot use update as the main channel
4817
5052
  // to rehydrate when dirty, because sometimes the element is not inserted just yet,
@@ -4845,6 +5080,34 @@
4845
5080
  remove: function remove(vnode, parentNode) {
4846
5081
  removeNodeHook(vnode, parentNode);
4847
5082
  removeElmHook(vnode);
5083
+ },
5084
+ hydrate: function hydrate(vnode, node) {
5085
+ var elm = node;
5086
+ vnode.elm = elm;
5087
+ var context = vnode.data.context;
5088
+ var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5089
+ /* manual */
5090
+ );
5091
+
5092
+ if (isDomManual) {
5093
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5094
+ // remove the innerHTML from props so it reuses the existing dom elements.
5095
+ var props = vnode.data.props;
5096
+
5097
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5098
+ if (elm.innerHTML === props.innerHTML) {
5099
+ delete props.innerHTML;
5100
+ } else {
5101
+ logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5102
+ }
5103
+ }
5104
+ }
5105
+
5106
+ hydrateElmHook(vnode);
5107
+
5108
+ if (!isDomManual) {
5109
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
5110
+ }
4848
5111
  }
4849
5112
  };
4850
5113
  var CustomElementHook = {
@@ -4932,6 +5195,42 @@
4932
5195
  // will take care of disconnecting any child VM attached to its shadow as well.
4933
5196
  removeVM(vm);
4934
5197
  }
5198
+ },
5199
+ hydrate: function hydrate(vnode, elm) {
5200
+ // the element is created, but the vm is not
5201
+ var sel = vnode.sel,
5202
+ mode = vnode.mode,
5203
+ ctor = vnode.ctor,
5204
+ owner = vnode.owner;
5205
+ var def = getComponentInternalDef(ctor);
5206
+ createVM(elm, def, {
5207
+ mode: mode,
5208
+ owner: owner,
5209
+ tagName: sel,
5210
+ renderer: owner.renderer
5211
+ });
5212
+ vnode.elm = elm;
5213
+ var vm = getAssociatedVM(elm);
5214
+ allocateChildrenHook(vnode, vm);
5215
+ hydrateElmHook(vnode); // Insert hook section:
5216
+
5217
+ if (process.env.NODE_ENV !== 'production') {
5218
+ assert.isTrue(vm.state === 0
5219
+ /* created */
5220
+ , "".concat(vm, " cannot be recycled."));
5221
+ }
5222
+
5223
+ runConnectedCallback(vm);
5224
+
5225
+ if (vm.renderMode !== 0
5226
+ /* Light */
5227
+ ) {
5228
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5229
+ // Note: for Light DOM, this is handled while hydrating the VM
5230
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
5231
+ }
5232
+
5233
+ hydrateVM(vm);
4935
5234
  }
4936
5235
  };
4937
5236
 
@@ -5234,7 +5533,7 @@
5234
5533
 
5235
5534
 
5236
5535
  function d(value) {
5237
- return value == null ? '' : value;
5536
+ return value == null ? '' : String(value);
5238
5537
  } // [b]ind function
5239
5538
 
5240
5539
 
@@ -5394,6 +5693,26 @@
5394
5693
 
5395
5694
  markAsDynamicChildren(vnodes);
5396
5695
  return vnodes;
5696
+ }
5697
+ /**
5698
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
5699
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
5700
+ * lwc:inner-html directive.
5701
+ * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
5702
+ */
5703
+
5704
+
5705
+ var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
5706
+ // locker-service patches this function during runtime to sanitize HTML content.
5707
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
5708
+ };
5709
+ /**
5710
+ * Sets the sanitizeHtmlContentHook.
5711
+ */
5712
+
5713
+
5714
+ function setSanitizeHtmlContentHook(newHookImpl) {
5715
+ sanitizeHtmlContentHook = newHookImpl;
5397
5716
  } // [s]anitize [h]tml [c]ontent
5398
5717
 
5399
5718
 
@@ -5496,8 +5815,8 @@
5496
5815
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5497
5816
  var content = [];
5498
5817
 
5499
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
5500
- var stylesheet = stylesheets[_i14];
5818
+ for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5819
+ var stylesheet = stylesheets[_i16];
5501
5820
 
5502
5821
  if (isArray$1(stylesheet)) {
5503
5822
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
@@ -5573,10 +5892,13 @@
5573
5892
  && shadowMode === 1
5574
5893
  /* Synthetic */
5575
5894
  ) {
5576
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
5577
- renderer.insertGlobalStylesheet(stylesheets[_i15]);
5895
+ for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5896
+ renderer.insertGlobalStylesheet(stylesheets[_i17]);
5578
5897
  }
5579
- } else if (renderer.ssr) {
5898
+ } else if (renderer.ssr || renderer.isHydrating()) {
5899
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5900
+ // This works in the client, because the stylesheets are created, and cached in the VM
5901
+ // the first time the VM renders.
5580
5902
  // native shadow or light DOM, SSR
5581
5903
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
5582
5904
  return createInlineStyleVNode(combinedStylesheetContent);
@@ -5585,12 +5907,12 @@
5585
5907
  var root = getNearestNativeShadowComponent(vm);
5586
5908
  var isGlobal = isNull(root);
5587
5909
 
5588
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5910
+ for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
5589
5911
  if (isGlobal) {
5590
- renderer.insertGlobalStylesheet(stylesheets[_i16]);
5912
+ renderer.insertGlobalStylesheet(stylesheets[_i18]);
5591
5913
  } else {
5592
5914
  // local level
5593
- renderer.insertStylesheet(stylesheets[_i16], root.cmpRoot);
5915
+ renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
5594
5916
  }
5595
5917
  }
5596
5918
  }
@@ -5867,8 +6189,8 @@
5867
6189
  var stylesheets = template.stylesheets;
5868
6190
 
5869
6191
  if (!isUndefined$1(stylesheets)) {
5870
- for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5871
- if (isTrue(stylesheets[_i17][KEY__SCOPED_CSS])) {
6192
+ for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
6193
+ if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
5872
6194
  return true;
5873
6195
  }
5874
6196
  }
@@ -6098,8 +6420,8 @@
6098
6420
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6099
6421
  }
6100
6422
 
6101
- for (var _i18 = 0; _i18 < hooks.length; ++_i18) {
6102
- var hookName = hooks[_i18];
6423
+ for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
6424
+ var hookName = hooks[_i20];
6103
6425
 
6104
6426
  if (hookName in service) {
6105
6427
  var l = Services[hookName];
@@ -6122,8 +6444,8 @@
6122
6444
  def = vm.def,
6123
6445
  context = vm.context;
6124
6446
 
6125
- for (var _i19 = 0, _len6 = cbs.length; _i19 < _len6; ++_i19) {
6126
- cbs[_i19].call(undefined, component, {}, def, context);
6447
+ for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
6448
+ cbs[_i21].call(undefined, component, {}, def, context);
6127
6449
  }
6128
6450
  }
6129
6451
  /*
@@ -6176,6 +6498,12 @@
6176
6498
  , vm);
6177
6499
  }
6178
6500
 
6501
+ function hydrateRootElement(elm) {
6502
+ var vm = getAssociatedVM(elm);
6503
+ runConnectedCallback(vm);
6504
+ hydrateVM(vm);
6505
+ }
6506
+
6179
6507
  function disconnectRootElement(elm) {
6180
6508
  var vm = getAssociatedVM(elm);
6181
6509
  resetComponentStateWhenRemoved(vm);
@@ -6183,6 +6511,10 @@
6183
6511
 
6184
6512
  function appendVM(vm) {
6185
6513
  rehydrate(vm);
6514
+ }
6515
+
6516
+ function hydrateVM(vm) {
6517
+ hydrate(vm);
6186
6518
  } // just in case the component comes back, with this we guarantee re-rendering it
6187
6519
  // while preventing any attempt to rehydration until after reinsertion.
6188
6520
 
@@ -6406,6 +6738,22 @@
6406
6738
  }
6407
6739
  }
6408
6740
 
6741
+ function hydrate(vm) {
6742
+ if (isTrue(vm.isDirty)) {
6743
+ // manually diffing/patching here.
6744
+ // This routine is:
6745
+ // patchShadowRoot(vm, children);
6746
+ // -> addVnodes.
6747
+ var children = renderComponent(vm);
6748
+ vm.children = children;
6749
+ var vmChildren = vm.renderMode === 0
6750
+ /* Light */
6751
+ ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
6752
+ hydrateChildrenHook(vmChildren, children, vm);
6753
+ runRenderedCallback(vm);
6754
+ }
6755
+ }
6756
+
6409
6757
  function patchShadowRoot(vm, newCh) {
6410
6758
  var oldCh = vm.children; // caching the new children collection
6411
6759
 
@@ -6486,19 +6834,19 @@
6486
6834
  });
6487
6835
  rehydrateQueue = []; // reset to a new queue
6488
6836
 
6489
- for (var _i20 = 0, _len7 = vms.length; _i20 < _len7; _i20 += 1) {
6490
- var vm = vms[_i20];
6837
+ for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
6838
+ var vm = vms[_i22];
6491
6839
 
6492
6840
  try {
6493
6841
  rehydrate(vm);
6494
6842
  } catch (error) {
6495
- if (_i20 + 1 < _len7) {
6843
+ if (_i22 + 1 < _len7) {
6496
6844
  // pieces of the queue are still pending to be rehydrated, those should have priority
6497
6845
  if (rehydrateQueue.length === 0) {
6498
6846
  addCallbackToNextTick(flushRehydrationQueue);
6499
6847
  }
6500
6848
 
6501
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i20 + 1));
6849
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
6502
6850
  } // we need to end the measure before throwing.
6503
6851
 
6504
6852
 
@@ -6602,8 +6950,8 @@
6602
6950
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
6603
6951
  // inserted in reserved order.
6604
6952
 
6605
- for (var _i21 = vCustomElementCollection.length - 1; _i21 >= 0; _i21 -= 1) {
6606
- var elm = vCustomElementCollection[_i21].elm; // There are two cases where the element could be undefined:
6953
+ for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
6954
+ var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
6607
6955
  // * when there is an error during the construction phase, and an error
6608
6956
  // boundary picks it, there is a possibility that the VCustomElement
6609
6957
  // is not properly initialized, and therefore is should be ignored.
@@ -6637,8 +6985,8 @@
6637
6985
 
6638
6986
 
6639
6987
  function recursivelyDisconnectChildren(vnodes) {
6640
- for (var _i22 = 0, _len8 = vnodes.length; _i22 < _len8; _i22 += 1) {
6641
- var vnode = vnodes[_i22];
6988
+ for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
6989
+ var vnode = vnodes[_i24];
6642
6990
 
6643
6991
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
6644
6992
  // vnode is a VElement with children
@@ -6662,8 +7010,8 @@
6662
7010
  renderer = vm.renderer;
6663
7011
  var rootNode = getRenderRoot(vm);
6664
7012
 
6665
- for (var _i23 = 0, _len9 = children.length; _i23 < _len9; _i23++) {
6666
- var child = children[_i23];
7013
+ for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
7014
+ var child = children[_i25];
6667
7015
 
6668
7016
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6669
7017
  renderer.remove(child.elm, rootNode);
@@ -6708,8 +7056,8 @@
6708
7056
  var oldSlots = vm.cmpSlots;
6709
7057
  var cmpSlots = vm.cmpSlots = create(null);
6710
7058
 
6711
- for (var _i24 = 0, _len10 = children.length; _i24 < _len10; _i24 += 1) {
6712
- var vnode = children[_i24];
7059
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
7060
+ var vnode = children[_i26];
6713
7061
 
6714
7062
  if (isNull(vnode)) {
6715
7063
  continue;
@@ -6739,8 +7087,8 @@
6739
7087
  return;
6740
7088
  }
6741
7089
 
6742
- for (var _i25 = 0, _len11 = oldKeys.length; _i25 < _len11; _i25 += 1) {
6743
- var key = oldKeys[_i25];
7090
+ for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
7091
+ var key = oldKeys[_i27];
6744
7092
 
6745
7093
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
6746
7094
  markComponentAsDirty(vm);
@@ -7103,8 +7451,8 @@
7103
7451
  function connectWireAdapters(vm) {
7104
7452
  var wiredConnecting = vm.context.wiredConnecting;
7105
7453
 
7106
- for (var _i26 = 0, _len12 = wiredConnecting.length; _i26 < _len12; _i26 += 1) {
7107
- wiredConnecting[_i26]();
7454
+ for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
7455
+ wiredConnecting[_i28]();
7108
7456
  }
7109
7457
  }
7110
7458
 
@@ -7112,8 +7460,8 @@
7112
7460
  var wiredDisconnecting = vm.context.wiredDisconnecting;
7113
7461
  runWithBoundaryProtection(vm, vm, noop, function () {
7114
7462
  // job
7115
- for (var _i27 = 0, _len13 = wiredDisconnecting.length; _i27 < _len13; _i27 += 1) {
7116
- wiredDisconnecting[_i27]();
7463
+ for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
7464
+ wiredDisconnecting[_i29]();
7117
7465
  }
7118
7466
  }, noop);
7119
7467
  }
@@ -7198,28 +7546,12 @@
7198
7546
 
7199
7547
  var hooksAreSet = false;
7200
7548
 
7201
- function overrideHooks(hooks) {
7202
- var oldHooks = {};
7203
-
7204
- if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
7205
- oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7206
- }
7207
-
7208
- return oldHooks;
7209
- }
7210
-
7211
7549
  function setHooks(hooks) {
7212
7550
  assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
7213
- overrideHooks(hooks);
7214
7551
  hooksAreSet = true;
7552
+ setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7215
7553
  }
7216
-
7217
- function setHooksForTest(hooks) {
7218
- if (process.env.NODE_ENV !== 'production') {
7219
- return overrideHooks(hooks);
7220
- }
7221
- }
7222
- /* version: 2.5.6 */
7554
+ /* version: 2.5.10-alpha1 */
7223
7555
 
7224
7556
  /*
7225
7557
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7234,8 +7566,8 @@
7234
7566
  if (process.env.NODE_ENV === 'development') {
7235
7567
  // @ts-ignore
7236
7568
  window.__lwcResetGlobalStylesheets = function () {
7237
- for (var _i28 = 0, _Object$keys = Object.keys(globalStylesheets); _i28 < _Object$keys.length; _i28++) {
7238
- var key = _Object$keys[_i28];
7569
+ for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
7570
+ var key = _Object$keys[_i30];
7239
7571
  delete globalStylesheets[key];
7240
7572
  }
7241
7573
  };
@@ -7374,8 +7706,17 @@
7374
7706
  HTMLElementConstructor.prototype = HTMLElement.prototype;
7375
7707
  }
7376
7708
 
7709
+ var _isHydrating = false;
7710
+
7711
+ function setIsHydrating(v) {
7712
+ _isHydrating = v;
7713
+ }
7714
+
7377
7715
  var renderer = {
7378
7716
  ssr: false,
7717
+ isHydrating: function isHydrating() {
7718
+ return _isHydrating;
7719
+ },
7379
7720
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7380
7721
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
7381
7722
  createElement: function createElement(tagName, namespace) {
@@ -7397,6 +7738,10 @@
7397
7738
  return node.nextSibling;
7398
7739
  },
7399
7740
  attachShadow: function attachShadow(element, options) {
7741
+ if (_isHydrating) {
7742
+ return element.shadowRoot;
7743
+ }
7744
+
7400
7745
  return element.attachShadow(options);
7401
7746
  },
7402
7747
  setText: function setText(node, content) {
@@ -7507,75 +7852,6 @@
7507
7852
  getCustomElement: getCustomElement,
7508
7853
  HTMLElement: HTMLElementConstructor
7509
7854
  };
7510
- /*
7511
- * Copyright (c) 2018, salesforce.com, inc.
7512
- * All rights reserved.
7513
- * SPDX-License-Identifier: MIT
7514
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7515
- */
7516
-
7517
- /**
7518
- * This function builds a Web Component class from a LWC constructor so it can be
7519
- * registered as a new element via customElements.define() at any given time.
7520
- *
7521
- * @deprecated since version 1.3.11
7522
- *
7523
- * @example
7524
- * ```
7525
- * import { buildCustomElementConstructor } from 'lwc';
7526
- * import Foo from 'ns/foo';
7527
- * const WC = buildCustomElementConstructor(Foo);
7528
- * customElements.define('x-foo', WC);
7529
- * const elm = document.createElement('x-foo');
7530
- * ```
7531
- */
7532
-
7533
- function deprecatedBuildCustomElementConstructor(Ctor) {
7534
- if (process.env.NODE_ENV !== 'production') {
7535
- /* eslint-disable-next-line no-console */
7536
- 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."));
7537
- }
7538
-
7539
- return Ctor.CustomElementConstructor;
7540
- }
7541
-
7542
- function buildCustomElementConstructor(Ctor) {
7543
- var def = getComponentInternalDef(Ctor);
7544
- return /*#__PURE__*/function (_def$bridge) {
7545
- _inherits(_class, _def$bridge);
7546
-
7547
- var _super8 = _createSuper(_class);
7548
-
7549
- function _class() {
7550
- var _this6;
7551
-
7552
- _classCallCheck(this, _class);
7553
-
7554
- _this6 = _super8.call(this);
7555
- createVM(_assertThisInitialized(_this6), def, {
7556
- mode: 'open',
7557
- owner: null,
7558
- tagName: _this6.tagName,
7559
- renderer: renderer
7560
- });
7561
- return _this6;
7562
- }
7563
-
7564
- _createClass(_class, [{
7565
- key: "connectedCallback",
7566
- value: function connectedCallback() {
7567
- connectRootElement(this);
7568
- }
7569
- }, {
7570
- key: "disconnectedCallback",
7571
- value: function disconnectedCallback() {
7572
- disconnectRootElement(this);
7573
- }
7574
- }]);
7575
-
7576
- return _class;
7577
- }(def.bridge);
7578
- }
7579
7855
  /*
7580
7856
  * Copyright (c) 2018, salesforce.com, inc.
7581
7857
  * All rights reserved.
@@ -7585,7 +7861,6 @@
7585
7861
  // TODO [#2472]: Remove this workaround when appropriate.
7586
7862
  // eslint-disable-next-line lwc-internal/no-global-node
7587
7863
 
7588
-
7589
7864
  var _Node$1 = Node;
7590
7865
  var ConnectingSlot = new WeakMap();
7591
7866
  var DisconnectingSlot = new WeakMap();
@@ -7695,6 +7970,142 @@
7695
7970
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7696
7971
  */
7697
7972
 
7973
+
7974
+ function hydrateComponent(element, Ctor) {
7975
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7976
+
7977
+ if (!isFunction$1(Ctor)) {
7978
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
7979
+ }
7980
+
7981
+ if (!isObject(props) || isNull(props)) {
7982
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
7983
+ }
7984
+
7985
+ var def = getComponentInternalDef(Ctor);
7986
+
7987
+ try {
7988
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7989
+ // and uses the same algo to create the stylesheets as in SSR.
7990
+ setIsHydrating(true);
7991
+ createVM(element, def, {
7992
+ mode: 'open',
7993
+ owner: null,
7994
+ renderer: renderer,
7995
+ tagName: element.tagName.toLowerCase()
7996
+ });
7997
+
7998
+ for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
7999
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
8000
+ key = _Object$entries2$_i[0],
8001
+ value = _Object$entries2$_i[1];
8002
+
8003
+ element[key] = value;
8004
+ }
8005
+
8006
+ hydrateRootElement(element); // set it back since now we finished hydration.
8007
+
8008
+ setIsHydrating(false);
8009
+ } catch (e) {
8010
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
8011
+ // the client generated DOM.
8012
+
8013
+ /* eslint-disable-next-line no-console */
8014
+ console.error('Recovering from error while hydrating: ', e);
8015
+ setIsHydrating(false);
8016
+ var newElem = createElement(element.tagName, {
8017
+ is: Ctor,
8018
+ mode: 'open'
8019
+ });
8020
+
8021
+ for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
8022
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
8023
+ _key3 = _Object$entries3$_i[0],
8024
+ _value2 = _Object$entries3$_i[1];
8025
+
8026
+ newElem[_key3] = _value2;
8027
+ }
8028
+
8029
+ element.parentNode.replaceChild(newElem, element);
8030
+ }
8031
+ }
8032
+ /*
8033
+ * Copyright (c) 2018, salesforce.com, inc.
8034
+ * All rights reserved.
8035
+ * SPDX-License-Identifier: MIT
8036
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8037
+ */
8038
+
8039
+ /**
8040
+ * This function builds a Web Component class from a LWC constructor so it can be
8041
+ * registered as a new element via customElements.define() at any given time.
8042
+ *
8043
+ * @deprecated since version 1.3.11
8044
+ *
8045
+ * @example
8046
+ * ```
8047
+ * import { buildCustomElementConstructor } from 'lwc';
8048
+ * import Foo from 'ns/foo';
8049
+ * const WC = buildCustomElementConstructor(Foo);
8050
+ * customElements.define('x-foo', WC);
8051
+ * const elm = document.createElement('x-foo');
8052
+ * ```
8053
+ */
8054
+
8055
+
8056
+ function deprecatedBuildCustomElementConstructor(Ctor) {
8057
+ if (process.env.NODE_ENV !== 'production') {
8058
+ /* eslint-disable-next-line no-console */
8059
+ 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."));
8060
+ }
8061
+
8062
+ return Ctor.CustomElementConstructor;
8063
+ }
8064
+
8065
+ function buildCustomElementConstructor(Ctor) {
8066
+ var def = getComponentInternalDef(Ctor);
8067
+ return /*#__PURE__*/function (_def$bridge) {
8068
+ _inherits(_class, _def$bridge);
8069
+
8070
+ var _super8 = _createSuper(_class);
8071
+
8072
+ function _class() {
8073
+ var _this6;
8074
+
8075
+ _classCallCheck(this, _class);
8076
+
8077
+ _this6 = _super8.call(this);
8078
+ createVM(_assertThisInitialized(_this6), def, {
8079
+ mode: 'open',
8080
+ owner: null,
8081
+ tagName: _this6.tagName,
8082
+ renderer: renderer
8083
+ });
8084
+ return _this6;
8085
+ }
8086
+
8087
+ _createClass(_class, [{
8088
+ key: "connectedCallback",
8089
+ value: function connectedCallback() {
8090
+ connectRootElement(this);
8091
+ }
8092
+ }, {
8093
+ key: "disconnectedCallback",
8094
+ value: function disconnectedCallback() {
8095
+ disconnectRootElement(this);
8096
+ }
8097
+ }]);
8098
+
8099
+ return _class;
8100
+ }(def.bridge);
8101
+ }
8102
+ /*
8103
+ * Copyright (c) 2018, salesforce.com, inc.
8104
+ * All rights reserved.
8105
+ * SPDX-License-Identifier: MIT
8106
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8107
+ */
8108
+
7698
8109
  /**
7699
8110
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
7700
8111
  * This API is subject to change or being removed.
@@ -7793,7 +8204,7 @@
7793
8204
  });
7794
8205
  freeze(LightningElement);
7795
8206
  seal(LightningElement.prototype);
7796
- /* version: 2.5.6 */
8207
+ /* version: 2.5.10-alpha1 */
7797
8208
 
7798
8209
  exports.LightningElement = LightningElement;
7799
8210
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7803,6 +8214,7 @@
7803
8214
  exports.createElement = createElement;
7804
8215
  exports.getComponentConstructor = getComponentConstructor;
7805
8216
  exports.getComponentDef = getComponentDef;
8217
+ exports.hydrateComponent = hydrateComponent;
7806
8218
  exports.isComponentConstructor = isComponentConstructor;
7807
8219
  exports.isNodeFromTemplate = isNodeFromTemplate;
7808
8220
  exports.readonly = readonly;
@@ -7814,7 +8226,6 @@
7814
8226
  exports.setFeatureFlag = setFeatureFlag;
7815
8227
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
7816
8228
  exports.setHooks = setHooks;
7817
- exports.setHooksForTest = setHooksForTest;
7818
8229
  exports.swapComponent = swapComponent;
7819
8230
  exports.swapStyle = swapStyle;
7820
8231
  exports.swapTemplate = swapTemplate;
@@ -7824,4 +8235,4 @@
7824
8235
 
7825
8236
  Object.defineProperty(exports, '__esModule', { value: true });
7826
8237
 
7827
- }));
8238
+ })));