lwc 2.5.6 → 2.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +605 -181
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +605 -181
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +406 -169
  5. package/dist/engine-dom/iife/es5/engine-dom.js +684 -242
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +466 -221
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +605 -181
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +406 -169
  11. package/dist/engine-dom/umd/es5/engine-dom.js +684 -242
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +466 -221
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +484 -133
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +485 -133
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +8 -8
@@ -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,9 +120,10 @@ 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
- ArrayMap$1 = _Array$prototype.map,
126
+ ArrayMap = _Array$prototype.map,
126
127
  ArrayPush$1 = _Array$prototype.push,
127
128
  ArraySlice = _Array$prototype.slice,
128
129
  ArraySplice = _Array$prototype.splice,
@@ -183,7 +184,7 @@ var LWC = (function (exports) {
183
184
  // Array.prototype.toString directly will cause an error Iterate through
184
185
  // all the items and handle individually.
185
186
  if (isArray$1(obj)) {
186
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
187
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
187
188
  }
188
189
 
189
190
  return obj.toString();
@@ -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 */
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 */
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.
@@ -1945,7 +1990,10 @@ var LWC = (function (exports) {
1945
1990
  // but it will always be compatible with the previous descriptor
1946
1991
  // to preserve the object invariants, which makes these lines safe.
1947
1992
 
1948
- var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key);
1993
+ var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1994
+
1995
+ /* istanbul ignore else */
1996
+
1949
1997
 
1950
1998
  if (!isUndefined(originalDescriptor)) {
1951
1999
  var wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -1970,12 +2018,18 @@ var LWC = (function (exports) {
1970
2018
 
1971
2019
  _preventExtensions(shadowTarget);
1972
2020
  } // Shared Traps
2021
+ // TODO: apply() is never called
2022
+
2023
+ /* istanbul ignore next */
1973
2024
 
1974
2025
  }, {
1975
2026
  key: "apply",
1976
2027
  value: function apply(shadowTarget, thisArg, argArray) {
1977
2028
  /* No op */
1978
- }
2029
+ } // TODO: construct() is never called
2030
+
2031
+ /* istanbul ignore next */
2032
+
1979
2033
  }, {
1980
2034
  key: "construct",
1981
2035
  value: function construct(shadowTarget, argArray, newTarget) {
@@ -2080,8 +2134,8 @@ var LWC = (function (exports) {
2080
2134
  return BaseProxyHandler;
2081
2135
  }();
2082
2136
 
2083
- var getterMap = new WeakMap();
2084
- var setterMap = new WeakMap();
2137
+ var getterMap$1 = new WeakMap();
2138
+ var setterMap$1 = new WeakMap();
2085
2139
  var reverseGetterMap = new WeakMap();
2086
2140
  var reverseSetterMap = new WeakMap();
2087
2141
 
@@ -2104,7 +2158,7 @@ var LWC = (function (exports) {
2104
2158
  }, {
2105
2159
  key: "wrapGetter",
2106
2160
  value: function wrapGetter(originalGet) {
2107
- var wrappedGetter = getterMap.get(originalGet);
2161
+ var wrappedGetter = getterMap$1.get(originalGet);
2108
2162
 
2109
2163
  if (!isUndefined(wrappedGetter)) {
2110
2164
  return wrappedGetter;
@@ -2117,14 +2171,14 @@ var LWC = (function (exports) {
2117
2171
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2118
2172
  };
2119
2173
 
2120
- getterMap.set(originalGet, get);
2174
+ getterMap$1.set(originalGet, get);
2121
2175
  reverseGetterMap.set(get, originalGet);
2122
2176
  return get;
2123
2177
  }
2124
2178
  }, {
2125
2179
  key: "wrapSetter",
2126
2180
  value: function wrapSetter(originalSet) {
2127
- var wrappedSetter = setterMap.get(originalSet);
2181
+ var wrappedSetter = setterMap$1.get(originalSet);
2128
2182
 
2129
2183
  if (!isUndefined(wrappedSetter)) {
2130
2184
  return wrappedSetter;
@@ -2135,7 +2189,7 @@ var LWC = (function (exports) {
2135
2189
  originalSet.call(unwrap$1(this), unwrap$1(v));
2136
2190
  };
2137
2191
 
2138
- setterMap.set(originalSet, set);
2192
+ setterMap$1.set(originalSet, set);
2139
2193
  reverseSetterMap.set(set, originalSet);
2140
2194
  return set;
2141
2195
  }
@@ -2176,7 +2230,7 @@ var LWC = (function (exports) {
2176
2230
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2177
2231
  };
2178
2232
 
2179
- getterMap.set(get, redGet);
2233
+ getterMap$1.set(get, redGet);
2180
2234
  reverseGetterMap.set(redGet, get);
2181
2235
  return get;
2182
2236
  }
@@ -2196,7 +2250,7 @@ var LWC = (function (exports) {
2196
2250
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2197
2251
  };
2198
2252
 
2199
- setterMap.set(set, redSet);
2253
+ setterMap$1.set(set, redSet);
2200
2254
  reverseSetterMap.set(redSet, set);
2201
2255
  return set;
2202
2256
  }
@@ -2232,6 +2286,7 @@ var LWC = (function (exports) {
2232
2286
  }, {
2233
2287
  key: "setPrototypeOf",
2234
2288
  value: function setPrototypeOf(shadowTarget, prototype) {
2289
+ /* istanbul ignore else */
2235
2290
  if (process.env.NODE_ENV !== 'production') {
2236
2291
  throw new Error("Invalid setPrototypeOf invocation for reactive proxy ".concat(toString(this.originalTarget), ". Prototype of reactive objects cannot be changed."));
2237
2292
  }
@@ -2245,6 +2300,11 @@ var LWC = (function (exports) {
2245
2300
  _preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2246
2301
  // the preventExtension call, in which case we should not attempt to lock down
2247
2302
  // the shadow target.
2303
+ // TODO: It should not actually be possible to reach this `if` statement.
2304
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2305
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2306
+
2307
+ /* istanbul ignore if */
2248
2308
 
2249
2309
 
2250
2310
  if (_isExtensible(originalTarget)) {
@@ -2287,8 +2347,8 @@ var LWC = (function (exports) {
2287
2347
  return ReactiveProxyHandler;
2288
2348
  }(BaseProxyHandler);
2289
2349
 
2290
- var getterMap$1 = new WeakMap();
2291
- var setterMap$1 = new WeakMap();
2350
+ var getterMap = new WeakMap();
2351
+ var setterMap = new WeakMap();
2292
2352
 
2293
2353
  var ReadOnlyHandler = /*#__PURE__*/function (_BaseProxyHandler2) {
2294
2354
  _inherits(ReadOnlyHandler, _BaseProxyHandler2);
@@ -2309,7 +2369,7 @@ var LWC = (function (exports) {
2309
2369
  }, {
2310
2370
  key: "wrapGetter",
2311
2371
  value: function wrapGetter(originalGet) {
2312
- var wrappedGetter = getterMap$1.get(originalGet);
2372
+ var wrappedGetter = getterMap.get(originalGet);
2313
2373
 
2314
2374
  if (!isUndefined(wrappedGetter)) {
2315
2375
  return wrappedGetter;
@@ -2322,13 +2382,13 @@ var LWC = (function (exports) {
2322
2382
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2323
2383
  };
2324
2384
 
2325
- getterMap$1.set(originalGet, get);
2385
+ getterMap.set(originalGet, get);
2326
2386
  return get;
2327
2387
  }
2328
2388
  }, {
2329
2389
  key: "wrapSetter",
2330
2390
  value: function wrapSetter(originalSet) {
2331
- var wrappedSetter = setterMap$1.get(originalSet);
2391
+ var wrappedSetter = setterMap.get(originalSet);
2332
2392
 
2333
2393
  if (!isUndefined(wrappedSetter)) {
2334
2394
  return wrappedSetter;
@@ -2337,38 +2397,47 @@ var LWC = (function (exports) {
2337
2397
  var handler = this;
2338
2398
 
2339
2399
  var set = function set(v) {
2400
+ /* istanbul ignore else */
2340
2401
  if (process.env.NODE_ENV !== 'production') {
2341
2402
  var originalTarget = handler.originalTarget;
2342
2403
  throw new Error("Invalid mutation: Cannot invoke a setter on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
2343
2404
  }
2344
2405
  };
2345
2406
 
2346
- setterMap$1.set(originalSet, set);
2407
+ setterMap.set(originalSet, set);
2347
2408
  return set;
2348
2409
  }
2349
2410
  }, {
2350
2411
  key: "set",
2351
2412
  value: function set(shadowTarget, key, value) {
2413
+ /* istanbul ignore else */
2352
2414
  if (process.env.NODE_ENV !== 'production') {
2353
2415
  var originalTarget = this.originalTarget;
2354
- throw new Error("Invalid mutation: Cannot set \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
2416
+ var msg = isArray(originalTarget) ? "Invalid mutation: Cannot mutate array at index ".concat(key.toString(), ". Array is read-only.") : "Invalid mutation: Cannot set \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only.");
2417
+ throw new Error(msg);
2355
2418
  }
2419
+ /* istanbul ignore next */
2420
+
2356
2421
 
2357
2422
  return false;
2358
2423
  }
2359
2424
  }, {
2360
2425
  key: "deleteProperty",
2361
2426
  value: function deleteProperty(shadowTarget, key) {
2427
+ /* istanbul ignore else */
2362
2428
  if (process.env.NODE_ENV !== 'production') {
2363
2429
  var originalTarget = this.originalTarget;
2364
2430
  throw new Error("Invalid mutation: Cannot delete \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
2365
2431
  }
2432
+ /* istanbul ignore next */
2433
+
2366
2434
 
2367
2435
  return false;
2368
2436
  }
2369
2437
  }, {
2370
2438
  key: "setPrototypeOf",
2371
2439
  value: function setPrototypeOf(shadowTarget, prototype) {
2440
+ /* istanbul ignore else */
2372
2441
  if (process.env.NODE_ENV !== 'production') {
2373
2442
  var originalTarget = this.originalTarget;
2374
2443
  throw new Error("Invalid prototype mutation: Cannot set prototype on \"".concat(originalTarget, "\". \"").concat(originalTarget, "\" prototype is read-only."));
@@ -2377,20 +2446,26 @@ var LWC = (function (exports) {
2377
2446
  }, {
2378
2447
  key: "preventExtensions",
2379
2448
  value: function preventExtensions(shadowTarget) {
2449
+ /* istanbul ignore else */
2380
2450
  if (process.env.NODE_ENV !== 'production') {
2381
2451
  var originalTarget = this.originalTarget;
2382
2452
  throw new Error("Invalid mutation: Cannot preventExtensions on ".concat(originalTarget, "\". \"").concat(originalTarget, " is read-only."));
2383
2453
  }
2454
+ /* istanbul ignore next */
2455
+
2384
2456
 
2385
2457
  return false;
2386
2458
  }
2387
2459
  }, {
2388
2460
  key: "defineProperty",
2389
2461
  value: function defineProperty(shadowTarget, key, descriptor) {
2462
+ /* istanbul ignore else */
2390
2463
  if (process.env.NODE_ENV !== 'production') {
2391
2464
  var originalTarget = this.originalTarget;
2392
2465
  throw new Error("Invalid mutation: Cannot defineProperty \"".concat(key.toString(), "\" on \"").concat(originalTarget, "\". \"").concat(originalTarget, "\" is read-only."));
2393
2466
  }
2467
+ /* istanbul ignore next */
2468
+
2394
2469
 
2395
2470
  return false;
2396
2471
  }
@@ -2450,6 +2525,8 @@ var LWC = (function (exports) {
2450
2525
  }; // Inspired from paulmillr/es6-shim
2451
2526
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2452
2527
 
2528
+ /* istanbul ignore next */
2529
+
2453
2530
  function getGlobal() {
2454
2531
  // the only reliable means to get the global object is `Function('return this')()`
2455
2532
  // However, this causes CSP violations in Chrome apps.
@@ -2474,6 +2551,7 @@ var LWC = (function (exports) {
2474
2551
  }
2475
2552
 
2476
2553
  function init() {
2554
+ /* istanbul ignore if */
2477
2555
  if (process.env.NODE_ENV === 'production') {
2478
2556
  // this method should never leak to prod
2479
2557
  throw new ReferenceError();
@@ -2488,6 +2566,8 @@ var LWC = (function (exports) {
2488
2566
  ArrayPush.call(devtoolsFormatters, formatter);
2489
2567
  global.devtoolsFormatters = devtoolsFormatters;
2490
2568
  }
2569
+ /* istanbul ignore else */
2570
+
2491
2571
 
2492
2572
  if (process.env.NODE_ENV !== 'production') {
2493
2573
  init();
@@ -2539,7 +2619,8 @@ var LWC = (function (exports) {
2539
2619
  this.valueMutated = defaultValueMutated;
2540
2620
  this.valueObserved = defaultValueObserved;
2541
2621
  this.valueIsObservable = defaultValueIsObservable;
2542
- this.objectGraph = new WeakMap();
2622
+ this.readOnlyObjectGraph = new WeakMap();
2623
+ this.reactiveObjectGraph = new WeakMap();
2543
2624
 
2544
2625
  if (!isUndefined(options)) {
2545
2626
  var _valueDistortion = options.valueDistortion,
@@ -2562,10 +2643,13 @@ var LWC = (function (exports) {
2562
2643
  var distorted = this.valueDistortion(unwrappedValue);
2563
2644
 
2564
2645
  if (this.valueIsObservable(distorted)) {
2565
- var o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2566
- // we return the readonly.
2646
+ if (this.readOnlyObjectGraph.get(distorted) === value) {
2647
+ // when trying to extract the writable version of a readonly
2648
+ // we return the readonly.
2649
+ return value;
2650
+ }
2567
2651
 
2568
- return o.readOnly === value ? value : o.reactive;
2652
+ return this.getReactiveHandler(unwrappedValue, distorted);
2569
2653
  }
2570
2654
 
2571
2655
  return distorted;
@@ -2577,7 +2661,7 @@ var LWC = (function (exports) {
2577
2661
  var distorted = this.valueDistortion(value);
2578
2662
 
2579
2663
  if (this.valueIsObservable(distorted)) {
2580
- return this.getReactiveState(value, distorted).readOnly;
2664
+ return this.getReadOnlyHandler(value, distorted);
2581
2665
  }
2582
2666
 
2583
2667
  return distorted;
@@ -2588,48 +2672,40 @@ var LWC = (function (exports) {
2588
2672
  return unwrap$1(p);
2589
2673
  }
2590
2674
  }, {
2591
- key: "getReactiveState",
2592
- value: function getReactiveState(value, distortedValue) {
2593
- var objectGraph = this.objectGraph;
2594
- var reactiveState = objectGraph.get(distortedValue);
2595
-
2596
- if (reactiveState) {
2597
- return reactiveState;
2675
+ key: "getReactiveHandler",
2676
+ value: function getReactiveHandler(value, distortedValue) {
2677
+ var proxy = this.reactiveObjectGraph.get(distortedValue);
2678
+
2679
+ if (isUndefined(proxy)) {
2680
+ // caching the proxy after the first time it is accessed
2681
+ var handler = new ReactiveProxyHandler(this, distortedValue);
2682
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2683
+ registerProxy(proxy, value);
2684
+ this.reactiveObjectGraph.set(distortedValue, proxy);
2598
2685
  }
2599
2686
 
2600
- var membrane = this;
2601
- reactiveState = {
2602
- get reactive() {
2603
- var reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2604
-
2605
- var proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2606
- registerProxy(proxy, value);
2607
- ObjectDefineProperty(this, 'reactive', {
2608
- value: proxy
2609
- });
2610
- return proxy;
2611
- },
2612
-
2613
- get readOnly() {
2614
- var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2615
-
2616
- var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2617
- registerProxy(proxy, value);
2618
- ObjectDefineProperty(this, 'readOnly', {
2619
- value: proxy
2620
- });
2621
- return proxy;
2622
- }
2687
+ return proxy;
2688
+ }
2689
+ }, {
2690
+ key: "getReadOnlyHandler",
2691
+ value: function getReadOnlyHandler(value, distortedValue) {
2692
+ var proxy = this.readOnlyObjectGraph.get(distortedValue);
2693
+
2694
+ if (isUndefined(proxy)) {
2695
+ // caching the proxy after the first time it is accessed
2696
+ var handler = new ReadOnlyHandler(this, distortedValue);
2697
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2698
+ registerProxy(proxy, value);
2699
+ this.readOnlyObjectGraph.set(distortedValue, proxy);
2700
+ }
2623
2701
 
2624
- };
2625
- objectGraph.set(distortedValue, reactiveState);
2626
- return reactiveState;
2702
+ return proxy;
2627
2703
  }
2628
2704
  }]);
2629
2705
 
2630
2706
  return ReactiveMembrane;
2631
2707
  }();
2632
- /** version: 1.0.0 */
2708
+ /** version: 1.1.5 */
2633
2709
 
2634
2710
  /*
2635
2711
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3015,7 +3091,9 @@ var LWC = (function (exports) {
3015
3091
  }
3016
3092
 
3017
3093
  return renderer[rendererMethod](elm);
3018
- }
3094
+ },
3095
+ configurable: true,
3096
+ enumerable: true
3019
3097
  };
3020
3098
  };
3021
3099
 
@@ -3038,7 +3116,10 @@ var LWC = (function (exports) {
3038
3116
  }
3039
3117
 
3040
3118
  return renderer[queryMethod](elm, arg);
3041
- }
3119
+ },
3120
+ configurable: true,
3121
+ enumerable: true,
3122
+ writable: true
3042
3123
  };
3043
3124
  };
3044
3125
 
@@ -3931,12 +4012,12 @@ var LWC = (function (exports) {
3931
4012
  function flattenStylesheets(stylesheets) {
3932
4013
  var list = [];
3933
4014
 
3934
- var _iterator = _createForOfIteratorHelper(stylesheets),
3935
- _step;
4015
+ var _iterator2 = _createForOfIteratorHelper(stylesheets),
4016
+ _step2;
3936
4017
 
3937
4018
  try {
3938
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3939
- var stylesheet = _step.value;
4019
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
4020
+ var stylesheet = _step2.value;
3940
4021
 
3941
4022
  if (!Array.isArray(stylesheet)) {
3942
4023
  list.push(stylesheet);
@@ -3945,9 +4026,9 @@ var LWC = (function (exports) {
3945
4026
  }
3946
4027
  }
3947
4028
  } catch (err) {
3948
- _iterator.e(err);
4029
+ _iterator2.e(err);
3949
4030
  } finally {
3950
- _iterator.f();
4031
+ _iterator2.f();
3951
4032
  }
3952
4033
 
3953
4034
  return list;
@@ -4211,7 +4292,7 @@ var LWC = (function (exports) {
4211
4292
  if (!isUndefined$1(ctorShadowSupportMode)) {
4212
4293
  assert.invariant(ctorShadowSupportMode === "any"
4213
4294
  /* Any */
4214
- || ctorShadowSupportMode === "default"
4295
+ || ctorShadowSupportMode === "reset"
4215
4296
  /* Default */
4216
4297
  , "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
4217
4298
  }
@@ -4369,7 +4450,7 @@ var LWC = (function (exports) {
4369
4450
  renderMode: 1
4370
4451
  /* Shadow */
4371
4452
  ,
4372
- shadowSupportMode: "default"
4453
+ shadowSupportMode: "reset"
4373
4454
  /* Default */
4374
4455
  ,
4375
4456
  wire: EmptyObject,
@@ -4506,6 +4587,17 @@ var LWC = (function (exports) {
4506
4587
  modComputedStyle.create(vnode);
4507
4588
  }
4508
4589
 
4590
+ function hydrateElmHook(vnode) {
4591
+ modEvents.create(vnode); // Attrs are already on the element.
4592
+ // modAttrs.create(vnode);
4593
+
4594
+ modProps.create(vnode); // Already set.
4595
+ // modStaticClassName.create(vnode);
4596
+ // modStaticStyle.create(vnode);
4597
+ // modComputedClassName.create(vnode);
4598
+ // modComputedStyle.create(vnode);
4599
+ }
4600
+
4509
4601
  function fallbackElmHook(elm, vnode) {
4510
4602
  var owner = vnode.owner;
4511
4603
  setScopeTokenClassIfNecessary(elm, owner);
@@ -4655,6 +4747,174 @@ var LWC = (function (exports) {
4655
4747
  }
4656
4748
  }
4657
4749
 
4750
+ function isElementNode(node) {
4751
+ // eslint-disable-next-line lwc-internal/no-global-node
4752
+ return node.nodeType === Node.ELEMENT_NODE;
4753
+ }
4754
+
4755
+ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4756
+ var _vnode$data$attrs = vnode.data.attrs,
4757
+ attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs,
4758
+ renderer = vnode.owner.renderer;
4759
+ var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
4760
+ // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
4761
+
4762
+ for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
4763
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
4764
+ attrName = _Object$entries$_i[0],
4765
+ attrValue = _Object$entries$_i[1];
4766
+
4767
+ var elmAttrValue = renderer.getAttribute(elm, attrName);
4768
+
4769
+ if (String(attrValue) !== elmAttrValue) {
4770
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
4771
+ nodesAreCompatible = false;
4772
+ }
4773
+ }
4774
+
4775
+ return nodesAreCompatible;
4776
+ }
4777
+
4778
+ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4779
+ var _vnode$data = vnode.data,
4780
+ className = _vnode$data.className,
4781
+ classMap = _vnode$data.classMap,
4782
+ renderer = vnode.owner.renderer;
4783
+ var nodesAreCompatible = true;
4784
+ var vnodeClassName;
4785
+
4786
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4787
+ // className is used when class is bound to an expr.
4788
+ nodesAreCompatible = false;
4789
+ vnodeClassName = className;
4790
+ } else if (!isUndefined$1(classMap)) {
4791
+ // classMap is used when class is set to static value.
4792
+ var classList = renderer.getClassList(elm);
4793
+ var computedClassName = ''; // all classes from the vnode should be in the element.classList
4794
+
4795
+ for (var name in classMap) {
4796
+ computedClassName += ' ' + name;
4797
+
4798
+ if (!classList.contains(name)) {
4799
+ nodesAreCompatible = false;
4800
+ }
4801
+ }
4802
+
4803
+ vnodeClassName = computedClassName.trim();
4804
+
4805
+ if (classList.length > keys(classMap).length) {
4806
+ nodesAreCompatible = false;
4807
+ }
4808
+ }
4809
+
4810
+ if (!nodesAreCompatible) {
4811
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
4812
+ }
4813
+
4814
+ return nodesAreCompatible;
4815
+ }
4816
+
4817
+ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
4818
+ var _vnode$data2 = vnode.data,
4819
+ style = _vnode$data2.style,
4820
+ styleDecls = _vnode$data2.styleDecls,
4821
+ renderer = vnode.owner.renderer;
4822
+ var elmStyle = renderer.getAttribute(elm, 'style') || '';
4823
+ var vnodeStyle;
4824
+ var nodesAreCompatible = true;
4825
+
4826
+ if (!isUndefined$1(style) && style !== elmStyle) {
4827
+ nodesAreCompatible = false;
4828
+ vnodeStyle = style;
4829
+ } else if (!isUndefined$1(styleDecls)) {
4830
+ var parsedVnodeStyle = parseStyleText(elmStyle);
4831
+ var expectedStyle = []; // styleMap is used when style is set to static value.
4832
+
4833
+ for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
4834
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
4835
+ prop = _styleDecls$_i2[0],
4836
+ value = _styleDecls$_i2[1],
4837
+ important = _styleDecls$_i2[2];
4838
+
4839
+ expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
4840
+ var parsedPropValue = parsedVnodeStyle[prop];
4841
+
4842
+ if (isUndefined$1(parsedPropValue)) {
4843
+ nodesAreCompatible = false;
4844
+ } else if (!parsedPropValue.startsWith(value)) {
4845
+ nodesAreCompatible = false;
4846
+ } else if (important && !parsedPropValue.endsWith('!important')) {
4847
+ nodesAreCompatible = false;
4848
+ }
4849
+ }
4850
+
4851
+ if (keys(parsedVnodeStyle).length > styleDecls.length) {
4852
+ nodesAreCompatible = false;
4853
+ }
4854
+
4855
+ vnodeStyle = ArrayJoin.call(expectedStyle, ';');
4856
+ }
4857
+
4858
+ if (!nodesAreCompatible) {
4859
+ // style is used when class is bound to an expr.
4860
+ logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
4861
+ }
4862
+
4863
+ return nodesAreCompatible;
4864
+ }
4865
+
4866
+ function throwHydrationError() {
4867
+ assert.fail('Server rendered elements do not match client side generated elements');
4868
+ }
4869
+
4870
+ function hydrateChildrenHook(elmChildren, children, vm) {
4871
+ var _a, _b;
4872
+
4873
+ if (process.env.NODE_ENV !== 'production') {
4874
+ var filteredVNodes = ArrayFilter.call(children, function (vnode) {
4875
+ return !!vnode;
4876
+ });
4877
+
4878
+ if (elmChildren.length !== filteredVNodes.length) {
4879
+ logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
4880
+ throwHydrationError();
4881
+ }
4882
+ }
4883
+
4884
+ var elmCurrentChildIdx = 0;
4885
+
4886
+ for (var j = 0, n = children.length; j < n; j++) {
4887
+ var ch = children[j];
4888
+
4889
+ if (ch != null) {
4890
+ var childNode = elmChildren[elmCurrentChildIdx];
4891
+
4892
+ if (process.env.NODE_ENV !== 'production') {
4893
+ // VComments and VTexts validation is handled in their hooks
4894
+ if (isElementNode(childNode)) {
4895
+ if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
4896
+ 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);
4897
+ throwHydrationError();
4898
+ } // Note: props are not yet set
4899
+
4900
+
4901
+ var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
4902
+ var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
4903
+ var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
4904
+ var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
4905
+
4906
+ if (!isVNodeAndElementCompatible) {
4907
+ throwHydrationError();
4908
+ }
4909
+ }
4910
+ }
4911
+
4912
+ ch.hook.hydrate(ch, childNode);
4913
+ elmCurrentChildIdx++;
4914
+ }
4915
+ }
4916
+ }
4917
+
4658
4918
  function updateCustomElmHook(oldVnode, vnode) {
4659
4919
  // Attrs need to be applied to element before props
4660
4920
  // IE11 will wipe out value on radio inputs if value
@@ -4748,38 +5008,6 @@ var LWC = (function (exports) {
4748
5008
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4749
5009
  */
4750
5010
 
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
5011
 
4784
5012
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
4785
5013
  var SymbolIterator = Symbol.iterator;
@@ -4794,7 +5022,26 @@ var LWC = (function (exports) {
4794
5022
  update: updateNodeHook,
4795
5023
  insert: insertNodeHook,
4796
5024
  move: insertNodeHook,
4797
- remove: removeNodeHook
5025
+ remove: removeNodeHook,
5026
+ hydrate: function hydrate(vNode, node) {
5027
+ var _a;
5028
+
5029
+ if (process.env.NODE_ENV !== 'production') {
5030
+ // eslint-disable-next-line lwc-internal/no-global-node
5031
+ if (node.nodeType !== Node.TEXT_NODE) {
5032
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5033
+ assert.fail('Hydration mismatch: incorrect node type received.');
5034
+ }
5035
+
5036
+ if (node.nodeValue !== vNode.text) {
5037
+ logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
5038
+ }
5039
+ } // always set the text value to the one from the vnode.
5040
+
5041
+
5042
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5043
+ vNode.elm = node;
5044
+ }
4798
5045
  };
4799
5046
  var CommentHook = {
4800
5047
  create: function create(vnode) {
@@ -4808,7 +5055,26 @@ var LWC = (function (exports) {
4808
5055
  update: updateNodeHook,
4809
5056
  insert: insertNodeHook,
4810
5057
  move: insertNodeHook,
4811
- remove: removeNodeHook
5058
+ remove: removeNodeHook,
5059
+ hydrate: function hydrate(vNode, node) {
5060
+ var _a;
5061
+
5062
+ if (process.env.NODE_ENV !== 'production') {
5063
+ // eslint-disable-next-line lwc-internal/no-global-node
5064
+ if (node.nodeType !== Node.COMMENT_NODE) {
5065
+ logError('Hydration mismatch: incorrect node type received', vNode.owner);
5066
+ assert.fail('Hydration mismatch: incorrect node type received.');
5067
+ }
5068
+
5069
+ if (node.nodeValue !== vNode.text) {
5070
+ logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
5071
+ }
5072
+ } // always set the text value to the one from the vnode.
5073
+
5074
+
5075
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
5076
+ vNode.elm = node;
5077
+ }
4812
5078
  }; // insert is called after update, which is used somewhere else (via a module)
4813
5079
  // to mark the vm as inserted, that means we cannot use update as the main channel
4814
5080
  // to rehydrate when dirty, because sometimes the element is not inserted just yet,
@@ -4842,6 +5108,34 @@ var LWC = (function (exports) {
4842
5108
  remove: function remove(vnode, parentNode) {
4843
5109
  removeNodeHook(vnode, parentNode);
4844
5110
  removeElmHook(vnode);
5111
+ },
5112
+ hydrate: function hydrate(vnode, node) {
5113
+ var elm = node;
5114
+ vnode.elm = elm;
5115
+ var context = vnode.data.context;
5116
+ var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5117
+ /* manual */
5118
+ );
5119
+
5120
+ if (isDomManual) {
5121
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
5122
+ // remove the innerHTML from props so it reuses the existing dom elements.
5123
+ var props = vnode.data.props;
5124
+
5125
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5126
+ if (elm.innerHTML === props.innerHTML) {
5127
+ delete props.innerHTML;
5128
+ } else {
5129
+ logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
5130
+ }
5131
+ }
5132
+ }
5133
+
5134
+ hydrateElmHook(vnode);
5135
+
5136
+ if (!isDomManual) {
5137
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
5138
+ }
4845
5139
  }
4846
5140
  };
4847
5141
  var CustomElementHook = {
@@ -4929,6 +5223,42 @@ var LWC = (function (exports) {
4929
5223
  // will take care of disconnecting any child VM attached to its shadow as well.
4930
5224
  removeVM(vm);
4931
5225
  }
5226
+ },
5227
+ hydrate: function hydrate(vnode, elm) {
5228
+ // the element is created, but the vm is not
5229
+ var sel = vnode.sel,
5230
+ mode = vnode.mode,
5231
+ ctor = vnode.ctor,
5232
+ owner = vnode.owner;
5233
+ var def = getComponentInternalDef(ctor);
5234
+ createVM(elm, def, {
5235
+ mode: mode,
5236
+ owner: owner,
5237
+ tagName: sel,
5238
+ renderer: owner.renderer
5239
+ });
5240
+ vnode.elm = elm;
5241
+ var vm = getAssociatedVM(elm);
5242
+ allocateChildrenHook(vnode, vm);
5243
+ hydrateElmHook(vnode); // Insert hook section:
5244
+
5245
+ if (process.env.NODE_ENV !== 'production') {
5246
+ assert.isTrue(vm.state === 0
5247
+ /* created */
5248
+ , "".concat(vm, " cannot be recycled."));
5249
+ }
5250
+
5251
+ runConnectedCallback(vm);
5252
+
5253
+ if (vm.renderMode !== 0
5254
+ /* Light */
5255
+ ) {
5256
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
5257
+ // Note: for Light DOM, this is handled while hydrating the VM
5258
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
5259
+ }
5260
+
5261
+ hydrateVM(vm);
4932
5262
  }
4933
5263
  };
4934
5264
 
@@ -5231,7 +5561,7 @@ var LWC = (function (exports) {
5231
5561
 
5232
5562
 
5233
5563
  function d(value) {
5234
- return value == null ? '' : value;
5564
+ return value == null ? '' : String(value);
5235
5565
  } // [b]ind function
5236
5566
 
5237
5567
 
@@ -5391,6 +5721,26 @@ var LWC = (function (exports) {
5391
5721
 
5392
5722
  markAsDynamicChildren(vnodes);
5393
5723
  return vnodes;
5724
+ }
5725
+ /**
5726
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
5727
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
5728
+ * lwc:inner-html directive.
5729
+ * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
5730
+ */
5731
+
5732
+
5733
+ var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
5734
+ // locker-service patches this function during runtime to sanitize HTML content.
5735
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
5736
+ };
5737
+ /**
5738
+ * Sets the sanitizeHtmlContentHook.
5739
+ */
5740
+
5741
+
5742
+ function setSanitizeHtmlContentHook(newHookImpl) {
5743
+ sanitizeHtmlContentHook = newHookImpl;
5394
5744
  } // [s]anitize [h]tml [c]ontent
5395
5745
 
5396
5746
 
@@ -5493,8 +5843,8 @@ var LWC = (function (exports) {
5493
5843
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5494
5844
  var content = [];
5495
5845
 
5496
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
5497
- var stylesheet = stylesheets[_i14];
5846
+ for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5847
+ var stylesheet = stylesheets[_i16];
5498
5848
 
5499
5849
  if (isArray$1(stylesheet)) {
5500
5850
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
@@ -5570,10 +5920,13 @@ var LWC = (function (exports) {
5570
5920
  && shadowMode === 1
5571
5921
  /* Synthetic */
5572
5922
  ) {
5573
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
5574
- renderer.insertGlobalStylesheet(stylesheets[_i15]);
5923
+ for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5924
+ renderer.insertGlobalStylesheet(stylesheets[_i17]);
5575
5925
  }
5576
- } else if (renderer.ssr) {
5926
+ } else if (renderer.ssr || renderer.isHydrating()) {
5927
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5928
+ // This works in the client, because the stylesheets are created, and cached in the VM
5929
+ // the first time the VM renders.
5577
5930
  // native shadow or light DOM, SSR
5578
5931
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
5579
5932
  return createInlineStyleVNode(combinedStylesheetContent);
@@ -5582,12 +5935,12 @@ var LWC = (function (exports) {
5582
5935
  var root = getNearestNativeShadowComponent(vm);
5583
5936
  var isGlobal = isNull(root);
5584
5937
 
5585
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
5938
+ for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
5586
5939
  if (isGlobal) {
5587
- renderer.insertGlobalStylesheet(stylesheets[_i16]);
5940
+ renderer.insertGlobalStylesheet(stylesheets[_i18]);
5588
5941
  } else {
5589
5942
  // local level
5590
- renderer.insertStylesheet(stylesheets[_i16], root.cmpRoot);
5943
+ renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
5591
5944
  }
5592
5945
  }
5593
5946
  }
@@ -5864,8 +6217,8 @@ var LWC = (function (exports) {
5864
6217
  var stylesheets = template.stylesheets;
5865
6218
 
5866
6219
  if (!isUndefined$1(stylesheets)) {
5867
- for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
5868
- if (isTrue(stylesheets[_i17][KEY__SCOPED_CSS])) {
6220
+ for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
6221
+ if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
5869
6222
  return true;
5870
6223
  }
5871
6224
  }
@@ -6095,8 +6448,8 @@ var LWC = (function (exports) {
6095
6448
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6096
6449
  }
6097
6450
 
6098
- for (var _i18 = 0; _i18 < hooks.length; ++_i18) {
6099
- var hookName = hooks[_i18];
6451
+ for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
6452
+ var hookName = hooks[_i20];
6100
6453
 
6101
6454
  if (hookName in service) {
6102
6455
  var l = Services[hookName];
@@ -6119,8 +6472,8 @@ var LWC = (function (exports) {
6119
6472
  def = vm.def,
6120
6473
  context = vm.context;
6121
6474
 
6122
- for (var _i19 = 0, _len6 = cbs.length; _i19 < _len6; ++_i19) {
6123
- cbs[_i19].call(undefined, component, {}, def, context);
6475
+ for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
6476
+ cbs[_i21].call(undefined, component, {}, def, context);
6124
6477
  }
6125
6478
  }
6126
6479
  /*
@@ -6173,6 +6526,12 @@ var LWC = (function (exports) {
6173
6526
  , vm);
6174
6527
  }
6175
6528
 
6529
+ function hydrateRootElement(elm) {
6530
+ var vm = getAssociatedVM(elm);
6531
+ runConnectedCallback(vm);
6532
+ hydrateVM(vm);
6533
+ }
6534
+
6176
6535
  function disconnectRootElement(elm) {
6177
6536
  var vm = getAssociatedVM(elm);
6178
6537
  resetComponentStateWhenRemoved(vm);
@@ -6180,6 +6539,10 @@ var LWC = (function (exports) {
6180
6539
 
6181
6540
  function appendVM(vm) {
6182
6541
  rehydrate(vm);
6542
+ }
6543
+
6544
+ function hydrateVM(vm) {
6545
+ hydrate(vm);
6183
6546
  } // just in case the component comes back, with this we guarantee re-rendering it
6184
6547
  // while preventing any attempt to rehydration until after reinsertion.
6185
6548
 
@@ -6403,6 +6766,22 @@ var LWC = (function (exports) {
6403
6766
  }
6404
6767
  }
6405
6768
 
6769
+ function hydrate(vm) {
6770
+ if (isTrue(vm.isDirty)) {
6771
+ // manually diffing/patching here.
6772
+ // This routine is:
6773
+ // patchShadowRoot(vm, children);
6774
+ // -> addVnodes.
6775
+ var children = renderComponent(vm);
6776
+ vm.children = children;
6777
+ var vmChildren = vm.renderMode === 0
6778
+ /* Light */
6779
+ ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
6780
+ hydrateChildrenHook(vmChildren, children, vm);
6781
+ runRenderedCallback(vm);
6782
+ }
6783
+ }
6784
+
6406
6785
  function patchShadowRoot(vm, newCh) {
6407
6786
  var oldCh = vm.children; // caching the new children collection
6408
6787
 
@@ -6483,19 +6862,19 @@ var LWC = (function (exports) {
6483
6862
  });
6484
6863
  rehydrateQueue = []; // reset to a new queue
6485
6864
 
6486
- for (var _i20 = 0, _len7 = vms.length; _i20 < _len7; _i20 += 1) {
6487
- var vm = vms[_i20];
6865
+ for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
6866
+ var vm = vms[_i22];
6488
6867
 
6489
6868
  try {
6490
6869
  rehydrate(vm);
6491
6870
  } catch (error) {
6492
- if (_i20 + 1 < _len7) {
6871
+ if (_i22 + 1 < _len7) {
6493
6872
  // pieces of the queue are still pending to be rehydrated, those should have priority
6494
6873
  if (rehydrateQueue.length === 0) {
6495
6874
  addCallbackToNextTick(flushRehydrationQueue);
6496
6875
  }
6497
6876
 
6498
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i20 + 1));
6877
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
6499
6878
  } // we need to end the measure before throwing.
6500
6879
 
6501
6880
 
@@ -6599,8 +6978,8 @@ var LWC = (function (exports) {
6599
6978
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
6600
6979
  // inserted in reserved order.
6601
6980
 
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:
6981
+ for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
6982
+ var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
6604
6983
  // * when there is an error during the construction phase, and an error
6605
6984
  // boundary picks it, there is a possibility that the VCustomElement
6606
6985
  // is not properly initialized, and therefore is should be ignored.
@@ -6634,8 +7013,8 @@ var LWC = (function (exports) {
6634
7013
 
6635
7014
 
6636
7015
  function recursivelyDisconnectChildren(vnodes) {
6637
- for (var _i22 = 0, _len8 = vnodes.length; _i22 < _len8; _i22 += 1) {
6638
- var vnode = vnodes[_i22];
7016
+ for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
7017
+ var vnode = vnodes[_i24];
6639
7018
 
6640
7019
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
6641
7020
  // vnode is a VElement with children
@@ -6659,8 +7038,8 @@ var LWC = (function (exports) {
6659
7038
  renderer = vm.renderer;
6660
7039
  var rootNode = getRenderRoot(vm);
6661
7040
 
6662
- for (var _i23 = 0, _len9 = children.length; _i23 < _len9; _i23++) {
6663
- var child = children[_i23];
7041
+ for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
7042
+ var child = children[_i25];
6664
7043
 
6665
7044
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6666
7045
  renderer.remove(child.elm, rootNode);
@@ -6705,8 +7084,8 @@ var LWC = (function (exports) {
6705
7084
  var oldSlots = vm.cmpSlots;
6706
7085
  var cmpSlots = vm.cmpSlots = create(null);
6707
7086
 
6708
- for (var _i24 = 0, _len10 = children.length; _i24 < _len10; _i24 += 1) {
6709
- var vnode = children[_i24];
7087
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
7088
+ var vnode = children[_i26];
6710
7089
 
6711
7090
  if (isNull(vnode)) {
6712
7091
  continue;
@@ -6736,8 +7115,8 @@ var LWC = (function (exports) {
6736
7115
  return;
6737
7116
  }
6738
7117
 
6739
- for (var _i25 = 0, _len11 = oldKeys.length; _i25 < _len11; _i25 += 1) {
6740
- var key = oldKeys[_i25];
7118
+ for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
7119
+ var key = oldKeys[_i27];
6741
7120
 
6742
7121
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
6743
7122
  markComponentAsDirty(vm);
@@ -7100,8 +7479,8 @@ var LWC = (function (exports) {
7100
7479
  function connectWireAdapters(vm) {
7101
7480
  var wiredConnecting = vm.context.wiredConnecting;
7102
7481
 
7103
- for (var _i26 = 0, _len12 = wiredConnecting.length; _i26 < _len12; _i26 += 1) {
7104
- wiredConnecting[_i26]();
7482
+ for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
7483
+ wiredConnecting[_i28]();
7105
7484
  }
7106
7485
  }
7107
7486
 
@@ -7109,8 +7488,8 @@ var LWC = (function (exports) {
7109
7488
  var wiredDisconnecting = vm.context.wiredDisconnecting;
7110
7489
  runWithBoundaryProtection(vm, vm, noop, function () {
7111
7490
  // job
7112
- for (var _i27 = 0, _len13 = wiredDisconnecting.length; _i27 < _len13; _i27 += 1) {
7113
- wiredDisconnecting[_i27]();
7491
+ for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
7492
+ wiredDisconnecting[_i29]();
7114
7493
  }
7115
7494
  }, noop);
7116
7495
  }
@@ -7195,28 +7574,12 @@ var LWC = (function (exports) {
7195
7574
 
7196
7575
  var hooksAreSet = false;
7197
7576
 
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
7577
  function setHooks(hooks) {
7209
7578
  assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
7210
- overrideHooks(hooks);
7211
7579
  hooksAreSet = true;
7580
+ setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7212
7581
  }
7213
-
7214
- function setHooksForTest(hooks) {
7215
- if (process.env.NODE_ENV !== 'production') {
7216
- return overrideHooks(hooks);
7217
- }
7218
- }
7219
- /* version: 2.5.6 */
7582
+ /* version: 2.5.10 */
7220
7583
 
7221
7584
  /*
7222
7585
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7231,8 +7594,8 @@ var LWC = (function (exports) {
7231
7594
  if (process.env.NODE_ENV === 'development') {
7232
7595
  // @ts-ignore
7233
7596
  window.__lwcResetGlobalStylesheets = function () {
7234
- for (var _i28 = 0, _Object$keys = Object.keys(globalStylesheets); _i28 < _Object$keys.length; _i28++) {
7235
- var key = _Object$keys[_i28];
7597
+ for (var _i30 = 0, _Object$keys = Object.keys(globalStylesheets); _i30 < _Object$keys.length; _i30++) {
7598
+ var key = _Object$keys[_i30];
7236
7599
  delete globalStylesheets[key];
7237
7600
  }
7238
7601
  };
@@ -7371,8 +7734,17 @@ var LWC = (function (exports) {
7371
7734
  HTMLElementConstructor.prototype = HTMLElement.prototype;
7372
7735
  }
7373
7736
 
7737
+ var _isHydrating = false;
7738
+
7739
+ function setIsHydrating(v) {
7740
+ _isHydrating = v;
7741
+ }
7742
+
7374
7743
  var renderer = {
7375
7744
  ssr: false,
7745
+ isHydrating: function isHydrating() {
7746
+ return _isHydrating;
7747
+ },
7376
7748
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7377
7749
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
7378
7750
  createElement: function createElement(tagName, namespace) {
@@ -7394,6 +7766,10 @@ var LWC = (function (exports) {
7394
7766
  return node.nextSibling;
7395
7767
  },
7396
7768
  attachShadow: function attachShadow(element, options) {
7769
+ if (_isHydrating) {
7770
+ return element.shadowRoot;
7771
+ }
7772
+
7397
7773
  return element.attachShadow(options);
7398
7774
  },
7399
7775
  setText: function setText(node, content) {
@@ -7504,75 +7880,6 @@ var LWC = (function (exports) {
7504
7880
  getCustomElement: getCustomElement,
7505
7881
  HTMLElement: HTMLElementConstructor
7506
7882
  };
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
7883
  /*
7577
7884
  * Copyright (c) 2018, salesforce.com, inc.
7578
7885
  * All rights reserved.
@@ -7582,7 +7889,6 @@ var LWC = (function (exports) {
7582
7889
  // TODO [#2472]: Remove this workaround when appropriate.
7583
7890
  // eslint-disable-next-line lwc-internal/no-global-node
7584
7891
 
7585
-
7586
7892
  var _Node$1 = Node;
7587
7893
  var ConnectingSlot = new WeakMap();
7588
7894
  var DisconnectingSlot = new WeakMap();
@@ -7692,6 +7998,142 @@ var LWC = (function (exports) {
7692
7998
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7693
7999
  */
7694
8000
 
8001
+
8002
+ function hydrateComponent(element, Ctor) {
8003
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8004
+
8005
+ if (!isFunction$1(Ctor)) {
8006
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
8007
+ }
8008
+
8009
+ if (!isObject(props) || isNull(props)) {
8010
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
8011
+ }
8012
+
8013
+ var def = getComponentInternalDef(Ctor);
8014
+
8015
+ try {
8016
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8017
+ // and uses the same algo to create the stylesheets as in SSR.
8018
+ setIsHydrating(true);
8019
+ createVM(element, def, {
8020
+ mode: 'open',
8021
+ owner: null,
8022
+ renderer: renderer,
8023
+ tagName: element.tagName.toLowerCase()
8024
+ });
8025
+
8026
+ for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
8027
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
8028
+ key = _Object$entries2$_i[0],
8029
+ value = _Object$entries2$_i[1];
8030
+
8031
+ element[key] = value;
8032
+ }
8033
+
8034
+ hydrateRootElement(element); // set it back since now we finished hydration.
8035
+
8036
+ setIsHydrating(false);
8037
+ } catch (e) {
8038
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
8039
+ // the client generated DOM.
8040
+
8041
+ /* eslint-disable-next-line no-console */
8042
+ console.error('Recovering from error while hydrating: ', e);
8043
+ setIsHydrating(false);
8044
+ var newElem = createElement(element.tagName, {
8045
+ is: Ctor,
8046
+ mode: 'open'
8047
+ });
8048
+
8049
+ for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
8050
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
8051
+ _key3 = _Object$entries3$_i[0],
8052
+ _value2 = _Object$entries3$_i[1];
8053
+
8054
+ newElem[_key3] = _value2;
8055
+ }
8056
+
8057
+ element.parentNode.replaceChild(newElem, element);
8058
+ }
8059
+ }
8060
+ /*
8061
+ * Copyright (c) 2018, salesforce.com, inc.
8062
+ * All rights reserved.
8063
+ * SPDX-License-Identifier: MIT
8064
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8065
+ */
8066
+
8067
+ /**
8068
+ * This function builds a Web Component class from a LWC constructor so it can be
8069
+ * registered as a new element via customElements.define() at any given time.
8070
+ *
8071
+ * @deprecated since version 1.3.11
8072
+ *
8073
+ * @example
8074
+ * ```
8075
+ * import { buildCustomElementConstructor } from 'lwc';
8076
+ * import Foo from 'ns/foo';
8077
+ * const WC = buildCustomElementConstructor(Foo);
8078
+ * customElements.define('x-foo', WC);
8079
+ * const elm = document.createElement('x-foo');
8080
+ * ```
8081
+ */
8082
+
8083
+
8084
+ function deprecatedBuildCustomElementConstructor(Ctor) {
8085
+ if (process.env.NODE_ENV !== 'production') {
8086
+ /* eslint-disable-next-line no-console */
8087
+ 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."));
8088
+ }
8089
+
8090
+ return Ctor.CustomElementConstructor;
8091
+ }
8092
+
8093
+ function buildCustomElementConstructor(Ctor) {
8094
+ var def = getComponentInternalDef(Ctor);
8095
+ return /*#__PURE__*/function (_def$bridge) {
8096
+ _inherits(_class, _def$bridge);
8097
+
8098
+ var _super8 = _createSuper(_class);
8099
+
8100
+ function _class() {
8101
+ var _this6;
8102
+
8103
+ _classCallCheck(this, _class);
8104
+
8105
+ _this6 = _super8.call(this);
8106
+ createVM(_assertThisInitialized(_this6), def, {
8107
+ mode: 'open',
8108
+ owner: null,
8109
+ tagName: _this6.tagName,
8110
+ renderer: renderer
8111
+ });
8112
+ return _this6;
8113
+ }
8114
+
8115
+ _createClass(_class, [{
8116
+ key: "connectedCallback",
8117
+ value: function connectedCallback() {
8118
+ connectRootElement(this);
8119
+ }
8120
+ }, {
8121
+ key: "disconnectedCallback",
8122
+ value: function disconnectedCallback() {
8123
+ disconnectRootElement(this);
8124
+ }
8125
+ }]);
8126
+
8127
+ return _class;
8128
+ }(def.bridge);
8129
+ }
8130
+ /*
8131
+ * Copyright (c) 2018, salesforce.com, inc.
8132
+ * All rights reserved.
8133
+ * SPDX-License-Identifier: MIT
8134
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8135
+ */
8136
+
7695
8137
  /**
7696
8138
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
7697
8139
  * This API is subject to change or being removed.
@@ -7790,7 +8232,7 @@ var LWC = (function (exports) {
7790
8232
  });
7791
8233
  freeze(LightningElement);
7792
8234
  seal(LightningElement.prototype);
7793
- /* version: 2.5.6 */
8235
+ /* version: 2.5.10 */
7794
8236
 
7795
8237
  exports.LightningElement = LightningElement;
7796
8238
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7800,6 +8242,7 @@ var LWC = (function (exports) {
7800
8242
  exports.createElement = createElement;
7801
8243
  exports.getComponentConstructor = getComponentConstructor;
7802
8244
  exports.getComponentDef = getComponentDef;
8245
+ exports.hydrateComponent = hydrateComponent;
7803
8246
  exports.isComponentConstructor = isComponentConstructor;
7804
8247
  exports.isNodeFromTemplate = isNodeFromTemplate;
7805
8248
  exports.readonly = readonly;
@@ -7811,7 +8254,6 @@ var LWC = (function (exports) {
7811
8254
  exports.setFeatureFlag = setFeatureFlag;
7812
8255
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
7813
8256
  exports.setHooks = setHooks;
7814
- exports.setHooksForTest = setHooksForTest;
7815
8257
  exports.swapComponent = swapComponent;
7816
8258
  exports.swapStyle = swapStyle;
7817
8259
  exports.swapTemplate = swapTemplate;