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
@@ -35,23 +35,23 @@ var LWC = (function (exports) {
35
35
 
36
36
  function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
37
37
 
38
- 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"); } }
39
39
 
40
- 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); } }
41
41
 
42
- 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; }
43
43
 
44
- 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."); }
45
47
 
46
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; }
47
49
 
48
50
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
51
 
50
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
51
-
52
- 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); } }
52
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
53
53
 
54
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
54
+ 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; }
55
55
 
56
56
  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); }
57
57
 
@@ -120,7 +120,7 @@ var LWC = (function (exports) {
120
120
  var _Array$prototype = Array.prototype,
121
121
  ArrayIndexOf = _Array$prototype.indexOf,
122
122
  ArrayJoin = _Array$prototype.join,
123
- ArrayMap$1 = _Array$prototype.map,
123
+ ArrayMap = _Array$prototype.map,
124
124
  ArrayPush$1 = _Array$prototype.push,
125
125
  ArraySlice = _Array$prototype.slice,
126
126
  ArraySplice = _Array$prototype.splice,
@@ -177,7 +177,7 @@ var LWC = (function (exports) {
177
177
  // Array.prototype.toString directly will cause an error Iterate through
178
178
  // all the items and handle individually.
179
179
  if (isArray$1(obj)) {
180
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
180
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
181
181
  }
182
182
 
183
183
  return obj.toString();
@@ -341,7 +341,7 @@ var LWC = (function (exports) {
341
341
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
342
342
  return attributeName;
343
343
  }
344
- /** version: 2.5.6 */
344
+ /** version: 2.5.10 */
345
345
 
346
346
  /*
347
347
  * Copyright (c) 2018, salesforce.com, inc.
@@ -513,7 +513,7 @@ var LWC = (function (exports) {
513
513
 
514
514
  function setFeatureFlagForTest(name, value) {
515
515
  }
516
- /** version: 2.5.6 */
516
+ /** version: 2.5.10 */
517
517
 
518
518
  /* proxy-compat-disable */
519
519
 
@@ -555,7 +555,7 @@ var LWC = (function (exports) {
555
555
  }
556
556
 
557
557
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
558
- }
558
+ } // Borrowed from Vue template compiler.
559
559
  /*
560
560
  * Copyright (c) 2019, salesforce.com, inc.
561
561
  * All rights reserved.
@@ -710,6 +710,20 @@ var LWC = (function (exports) {
710
710
  return "<".concat(StringToLowerCase.call(vm.tagName), ">");
711
711
  } // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
712
712
 
713
+
714
+ function getComponentStack(vm) {
715
+ var stack = [];
716
+ var prefix = '';
717
+
718
+ while (!isNull(vm.owner)) {
719
+ ArrayPush$1.call(stack, prefix + getComponentTag(vm));
720
+ vm = vm.owner;
721
+ prefix += '\t';
722
+ }
723
+
724
+ return ArrayJoin.call(stack, '\n');
725
+ }
726
+
713
727
  function getErrorComponentStack(vm) {
714
728
  var wcStack = [];
715
729
  var currentVm = vm;
@@ -729,6 +743,32 @@ var LWC = (function (exports) {
729
743
  */
730
744
 
731
745
 
746
+ function log(method, message, vm) {
747
+ var msg = "[LWC ".concat(method, "]: ").concat(message);
748
+
749
+ if (!isUndefined$1(vm)) {
750
+ msg = "".concat(msg, "\n").concat(getComponentStack(vm));
751
+ }
752
+
753
+ try {
754
+ throw new Error(msg);
755
+ } catch (e) {
756
+ /* eslint-disable-next-line no-console */
757
+ console[method](e);
758
+ }
759
+ }
760
+
761
+ function logWarn(message, vm) {
762
+ log('warn', message, vm);
763
+ }
764
+ /*
765
+ * Copyright (c) 2018, salesforce.com, inc.
766
+ * All rights reserved.
767
+ * SPDX-License-Identifier: MIT
768
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
769
+ */
770
+
771
+
732
772
  function handleEvent(event, vnode) {
733
773
  var type = event.type;
734
774
  var on = vnode.data.on;
@@ -1521,7 +1561,10 @@ var LWC = (function (exports) {
1521
1561
  // but it will always be compatible with the previous descriptor
1522
1562
  // to preserve the object invariants, which makes these lines safe.
1523
1563
 
1524
- var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key);
1564
+ var originalDescriptor = _getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1565
+
1566
+ /* istanbul ignore else */
1567
+
1525
1568
 
1526
1569
  if (!isUndefined(originalDescriptor)) {
1527
1570
  var wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -1546,12 +1589,18 @@ var LWC = (function (exports) {
1546
1589
 
1547
1590
  _preventExtensions(shadowTarget);
1548
1591
  } // Shared Traps
1592
+ // TODO: apply() is never called
1593
+
1594
+ /* istanbul ignore next */
1549
1595
 
1550
1596
  }, {
1551
1597
  key: "apply",
1552
1598
  value: function apply(shadowTarget, thisArg, argArray) {
1553
1599
  /* No op */
1554
- }
1600
+ } // TODO: construct() is never called
1601
+
1602
+ /* istanbul ignore next */
1603
+
1555
1604
  }, {
1556
1605
  key: "construct",
1557
1606
  value: function construct(shadowTarget, argArray, newTarget) {
@@ -1656,8 +1705,8 @@ var LWC = (function (exports) {
1656
1705
  return BaseProxyHandler;
1657
1706
  }();
1658
1707
 
1659
- var getterMap = new WeakMap();
1660
- var setterMap = new WeakMap();
1708
+ var getterMap$1 = new WeakMap();
1709
+ var setterMap$1 = new WeakMap();
1661
1710
  var reverseGetterMap = new WeakMap();
1662
1711
  var reverseSetterMap = new WeakMap();
1663
1712
 
@@ -1680,7 +1729,7 @@ var LWC = (function (exports) {
1680
1729
  }, {
1681
1730
  key: "wrapGetter",
1682
1731
  value: function wrapGetter(originalGet) {
1683
- var wrappedGetter = getterMap.get(originalGet);
1732
+ var wrappedGetter = getterMap$1.get(originalGet);
1684
1733
 
1685
1734
  if (!isUndefined(wrappedGetter)) {
1686
1735
  return wrappedGetter;
@@ -1693,14 +1742,14 @@ var LWC = (function (exports) {
1693
1742
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1694
1743
  };
1695
1744
 
1696
- getterMap.set(originalGet, get);
1745
+ getterMap$1.set(originalGet, get);
1697
1746
  reverseGetterMap.set(get, originalGet);
1698
1747
  return get;
1699
1748
  }
1700
1749
  }, {
1701
1750
  key: "wrapSetter",
1702
1751
  value: function wrapSetter(originalSet) {
1703
- var wrappedSetter = setterMap.get(originalSet);
1752
+ var wrappedSetter = setterMap$1.get(originalSet);
1704
1753
 
1705
1754
  if (!isUndefined(wrappedSetter)) {
1706
1755
  return wrappedSetter;
@@ -1711,7 +1760,7 @@ var LWC = (function (exports) {
1711
1760
  originalSet.call(unwrap$1(this), unwrap$1(v));
1712
1761
  };
1713
1762
 
1714
- setterMap.set(originalSet, set);
1763
+ setterMap$1.set(originalSet, set);
1715
1764
  reverseSetterMap.set(set, originalSet);
1716
1765
  return set;
1717
1766
  }
@@ -1752,7 +1801,7 @@ var LWC = (function (exports) {
1752
1801
  return unwrap$1(redGet.call(handler.wrapValue(this)));
1753
1802
  };
1754
1803
 
1755
- getterMap.set(get, redGet);
1804
+ getterMap$1.set(get, redGet);
1756
1805
  reverseGetterMap.set(redGet, get);
1757
1806
  return get;
1758
1807
  }
@@ -1772,7 +1821,7 @@ var LWC = (function (exports) {
1772
1821
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
1773
1822
  };
1774
1823
 
1775
- setterMap.set(set, redSet);
1824
+ setterMap$1.set(set, redSet);
1776
1825
  reverseSetterMap.set(redSet, set);
1777
1826
  return set;
1778
1827
  }
@@ -1818,6 +1867,11 @@ var LWC = (function (exports) {
1818
1867
  _preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
1819
1868
  // the preventExtension call, in which case we should not attempt to lock down
1820
1869
  // the shadow target.
1870
+ // TODO: It should not actually be possible to reach this `if` statement.
1871
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
1872
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
1873
+
1874
+ /* istanbul ignore if */
1821
1875
 
1822
1876
 
1823
1877
  if (_isExtensible(originalTarget)) {
@@ -1860,8 +1914,8 @@ var LWC = (function (exports) {
1860
1914
  return ReactiveProxyHandler;
1861
1915
  }(BaseProxyHandler);
1862
1916
 
1863
- var getterMap$1 = new WeakMap();
1864
- var setterMap$1 = new WeakMap();
1917
+ var getterMap = new WeakMap();
1918
+ var setterMap = new WeakMap();
1865
1919
 
1866
1920
  var ReadOnlyHandler = /*#__PURE__*/function (_BaseProxyHandler2) {
1867
1921
  _inherits(ReadOnlyHandler, _BaseProxyHandler2);
@@ -1882,7 +1936,7 @@ var LWC = (function (exports) {
1882
1936
  }, {
1883
1937
  key: "wrapGetter",
1884
1938
  value: function wrapGetter(originalGet) {
1885
- var wrappedGetter = getterMap$1.get(originalGet);
1939
+ var wrappedGetter = getterMap.get(originalGet);
1886
1940
 
1887
1941
  if (!isUndefined(wrappedGetter)) {
1888
1942
  return wrappedGetter;
@@ -1895,13 +1949,13 @@ var LWC = (function (exports) {
1895
1949
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1896
1950
  };
1897
1951
 
1898
- getterMap$1.set(originalGet, get);
1952
+ getterMap.set(originalGet, get);
1899
1953
  return get;
1900
1954
  }
1901
1955
  }, {
1902
1956
  key: "wrapSetter",
1903
1957
  value: function wrapSetter(originalSet) {
1904
- var wrappedSetter = setterMap$1.get(originalSet);
1958
+ var wrappedSetter = setterMap.get(originalSet);
1905
1959
 
1906
1960
  if (!isUndefined(wrappedSetter)) {
1907
1961
  return wrappedSetter;
@@ -1910,18 +1964,22 @@ var LWC = (function (exports) {
1910
1964
  var set = function set(v) {
1911
1965
  };
1912
1966
 
1913
- setterMap$1.set(originalSet, set);
1967
+ setterMap.set(originalSet, set);
1914
1968
  return set;
1915
1969
  }
1916
1970
  }, {
1917
1971
  key: "set",
1918
1972
  value: function set(shadowTarget, key, value) {
1973
+ /* istanbul ignore next */
1974
+
1919
1975
 
1920
1976
  return false;
1921
1977
  }
1922
1978
  }, {
1923
1979
  key: "deleteProperty",
1924
1980
  value: function deleteProperty(shadowTarget, key) {
1981
+ /* istanbul ignore next */
1982
+
1925
1983
 
1926
1984
  return false;
1927
1985
  }
@@ -1932,12 +1990,16 @@ var LWC = (function (exports) {
1932
1990
  }, {
1933
1991
  key: "preventExtensions",
1934
1992
  value: function preventExtensions(shadowTarget) {
1993
+ /* istanbul ignore next */
1994
+
1935
1995
 
1936
1996
  return false;
1937
1997
  }
1938
1998
  }, {
1939
1999
  key: "defineProperty",
1940
2000
  value: function defineProperty(shadowTarget, key, descriptor) {
2001
+ /* istanbul ignore next */
2002
+
1941
2003
 
1942
2004
  return false;
1943
2005
  }
@@ -1992,7 +2054,8 @@ var LWC = (function (exports) {
1992
2054
  this.valueMutated = defaultValueMutated;
1993
2055
  this.valueObserved = defaultValueObserved;
1994
2056
  this.valueIsObservable = defaultValueIsObservable;
1995
- this.objectGraph = new WeakMap();
2057
+ this.readOnlyObjectGraph = new WeakMap();
2058
+ this.reactiveObjectGraph = new WeakMap();
1996
2059
 
1997
2060
  if (!isUndefined(options)) {
1998
2061
  var _valueDistortion = options.valueDistortion,
@@ -2015,10 +2078,13 @@ var LWC = (function (exports) {
2015
2078
  var distorted = this.valueDistortion(unwrappedValue);
2016
2079
 
2017
2080
  if (this.valueIsObservable(distorted)) {
2018
- var o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2019
- // we return the readonly.
2081
+ if (this.readOnlyObjectGraph.get(distorted) === value) {
2082
+ // when trying to extract the writable version of a readonly
2083
+ // we return the readonly.
2084
+ return value;
2085
+ }
2020
2086
 
2021
- return o.readOnly === value ? value : o.reactive;
2087
+ return this.getReactiveHandler(unwrappedValue, distorted);
2022
2088
  }
2023
2089
 
2024
2090
  return distorted;
@@ -2030,7 +2096,7 @@ var LWC = (function (exports) {
2030
2096
  var distorted = this.valueDistortion(value);
2031
2097
 
2032
2098
  if (this.valueIsObservable(distorted)) {
2033
- return this.getReactiveState(value, distorted).readOnly;
2099
+ return this.getReadOnlyHandler(value, distorted);
2034
2100
  }
2035
2101
 
2036
2102
  return distorted;
@@ -2041,48 +2107,40 @@ var LWC = (function (exports) {
2041
2107
  return unwrap$1(p);
2042
2108
  }
2043
2109
  }, {
2044
- key: "getReactiveState",
2045
- value: function getReactiveState(value, distortedValue) {
2046
- var objectGraph = this.objectGraph;
2047
- var reactiveState = objectGraph.get(distortedValue);
2048
-
2049
- if (reactiveState) {
2050
- return reactiveState;
2110
+ key: "getReactiveHandler",
2111
+ value: function getReactiveHandler(value, distortedValue) {
2112
+ var proxy = this.reactiveObjectGraph.get(distortedValue);
2113
+
2114
+ if (isUndefined(proxy)) {
2115
+ // caching the proxy after the first time it is accessed
2116
+ var handler = new ReactiveProxyHandler(this, distortedValue);
2117
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2118
+ registerProxy(proxy, value);
2119
+ this.reactiveObjectGraph.set(distortedValue, proxy);
2051
2120
  }
2052
2121
 
2053
- var membrane = this;
2054
- reactiveState = {
2055
- get reactive() {
2056
- var reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2057
-
2058
- var proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2059
- registerProxy(proxy, value);
2060
- ObjectDefineProperty(this, 'reactive', {
2061
- value: proxy
2062
- });
2063
- return proxy;
2064
- },
2065
-
2066
- get readOnly() {
2067
- var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2068
-
2069
- var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2070
- registerProxy(proxy, value);
2071
- ObjectDefineProperty(this, 'readOnly', {
2072
- value: proxy
2073
- });
2074
- return proxy;
2075
- }
2122
+ return proxy;
2123
+ }
2124
+ }, {
2125
+ key: "getReadOnlyHandler",
2126
+ value: function getReadOnlyHandler(value, distortedValue) {
2127
+ var proxy = this.readOnlyObjectGraph.get(distortedValue);
2128
+
2129
+ if (isUndefined(proxy)) {
2130
+ // caching the proxy after the first time it is accessed
2131
+ var handler = new ReadOnlyHandler(this, distortedValue);
2132
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2133
+ registerProxy(proxy, value);
2134
+ this.readOnlyObjectGraph.set(distortedValue, proxy);
2135
+ }
2076
2136
 
2077
- };
2078
- objectGraph.set(distortedValue, reactiveState);
2079
- return reactiveState;
2137
+ return proxy;
2080
2138
  }
2081
2139
  }]);
2082
2140
 
2083
2141
  return ReactiveMembrane;
2084
2142
  }();
2085
- /** version: 1.0.0 */
2143
+ /** version: 1.1.5 */
2086
2144
 
2087
2145
  /*
2088
2146
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2391,7 +2449,9 @@ var LWC = (function (exports) {
2391
2449
  renderer = vm.renderer;
2392
2450
 
2393
2451
  return renderer[rendererMethod](elm);
2394
- }
2452
+ },
2453
+ configurable: true,
2454
+ enumerable: true
2395
2455
  };
2396
2456
  };
2397
2457
 
@@ -2410,7 +2470,10 @@ var LWC = (function (exports) {
2410
2470
  renderer = vm.renderer;
2411
2471
 
2412
2472
  return renderer[queryMethod](elm, arg);
2413
- }
2473
+ },
2474
+ configurable: true,
2475
+ enumerable: true,
2476
+ writable: true
2414
2477
  };
2415
2478
  };
2416
2479
 
@@ -3260,7 +3323,7 @@ var LWC = (function (exports) {
3260
3323
  renderMode: 1
3261
3324
  /* Shadow */
3262
3325
  ,
3263
- shadowSupportMode: "default"
3326
+ shadowSupportMode: "reset"
3264
3327
  /* Default */
3265
3328
  ,
3266
3329
  wire: EmptyObject,
@@ -3374,6 +3437,17 @@ var LWC = (function (exports) {
3374
3437
  modComputedStyle.create(vnode);
3375
3438
  }
3376
3439
 
3440
+ function hydrateElmHook(vnode) {
3441
+ modEvents.create(vnode); // Attrs are already on the element.
3442
+ // modAttrs.create(vnode);
3443
+
3444
+ modProps.create(vnode); // Already set.
3445
+ // modStaticClassName.create(vnode);
3446
+ // modStaticStyle.create(vnode);
3447
+ // modComputedClassName.create(vnode);
3448
+ // modComputedStyle.create(vnode);
3449
+ }
3450
+
3377
3451
  function fallbackElmHook(elm, vnode) {
3378
3452
  var owner = vnode.owner;
3379
3453
  setScopeTokenClassIfNecessary(elm, owner);
@@ -3505,6 +3579,22 @@ var LWC = (function (exports) {
3505
3579
  }
3506
3580
  }
3507
3581
 
3582
+ function hydrateChildrenHook(elmChildren, children, vm) {
3583
+
3584
+ var elmCurrentChildIdx = 0;
3585
+
3586
+ for (var j = 0, n = children.length; j < n; j++) {
3587
+ var ch = children[j];
3588
+
3589
+ if (ch != null) {
3590
+ var childNode = elmChildren[elmCurrentChildIdx];
3591
+
3592
+ ch.hook.hydrate(ch, childNode);
3593
+ elmCurrentChildIdx++;
3594
+ }
3595
+ }
3596
+ }
3597
+
3508
3598
  function updateCustomElmHook(oldVnode, vnode) {
3509
3599
  // Attrs need to be applied to element before props
3510
3600
  // IE11 will wipe out value on radio inputs if value
@@ -3598,38 +3688,6 @@ var LWC = (function (exports) {
3598
3688
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3599
3689
  */
3600
3690
 
3601
- /**
3602
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
3603
- * libraries to sanitize HTML content. This hook process the content passed via the template to
3604
- * lwc:inner-html directive.
3605
- * It is meant to be overridden with setSanitizeHtmlContentHook
3606
- */
3607
-
3608
-
3609
- var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
3610
- // locker-service patches this function during runtime to sanitize HTML content.
3611
- throw new Error('sanitizeHtmlContent hook must be implemented.');
3612
- };
3613
- /**
3614
- * Sets the sanitizeHtmlContentHook.
3615
- *
3616
- * @param newHookImpl
3617
- * @returns oldHookImplementation.
3618
- */
3619
-
3620
-
3621
- function setSanitizeHtmlContentHook(newHookImpl) {
3622
- var currentHook = sanitizeHtmlContentHook;
3623
- sanitizeHtmlContentHook = newHookImpl;
3624
- return currentHook;
3625
- }
3626
- /*
3627
- * Copyright (c) 2018, salesforce.com, inc.
3628
- * All rights reserved.
3629
- * SPDX-License-Identifier: MIT
3630
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3631
- */
3632
-
3633
3691
 
3634
3692
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
3635
3693
  var SymbolIterator = Symbol.iterator;
@@ -3644,7 +3702,14 @@ var LWC = (function (exports) {
3644
3702
  update: updateNodeHook,
3645
3703
  insert: insertNodeHook,
3646
3704
  move: insertNodeHook,
3647
- remove: removeNodeHook
3705
+ remove: removeNodeHook,
3706
+ hydrate: function hydrate(vNode, node) {
3707
+ var _a;
3708
+
3709
+
3710
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
3711
+ vNode.elm = node;
3712
+ }
3648
3713
  };
3649
3714
  var CommentHook = {
3650
3715
  create: function create(vnode) {
@@ -3658,7 +3723,14 @@ var LWC = (function (exports) {
3658
3723
  update: updateNodeHook,
3659
3724
  insert: insertNodeHook,
3660
3725
  move: insertNodeHook,
3661
- remove: removeNodeHook
3726
+ remove: removeNodeHook,
3727
+ hydrate: function hydrate(vNode, node) {
3728
+ var _a;
3729
+
3730
+
3731
+ node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
3732
+ vNode.elm = node;
3733
+ }
3662
3734
  }; // insert is called after update, which is used somewhere else (via a module)
3663
3735
  // to mark the vm as inserted, that means we cannot use update as the main channel
3664
3736
  // to rehydrate when dirty, because sometimes the element is not inserted just yet,
@@ -3692,6 +3764,34 @@ var LWC = (function (exports) {
3692
3764
  remove: function remove(vnode, parentNode) {
3693
3765
  removeNodeHook(vnode, parentNode);
3694
3766
  removeElmHook(vnode);
3767
+ },
3768
+ hydrate: function hydrate(vnode, node) {
3769
+ var elm = node;
3770
+ vnode.elm = elm;
3771
+ var context = vnode.data.context;
3772
+ var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
3773
+ /* manual */
3774
+ );
3775
+
3776
+ if (isDomManual) {
3777
+ // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
3778
+ // remove the innerHTML from props so it reuses the existing dom elements.
3779
+ var props = vnode.data.props;
3780
+
3781
+ if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
3782
+ if (elm.innerHTML === props.innerHTML) {
3783
+ delete props.innerHTML;
3784
+ } else {
3785
+ logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
3786
+ }
3787
+ }
3788
+ }
3789
+
3790
+ hydrateElmHook(vnode);
3791
+
3792
+ if (!isDomManual) {
3793
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
3794
+ }
3695
3795
  }
3696
3796
  };
3697
3797
  var CustomElementHook = {
@@ -3771,6 +3871,36 @@ var LWC = (function (exports) {
3771
3871
  // will take care of disconnecting any child VM attached to its shadow as well.
3772
3872
  removeVM(vm);
3773
3873
  }
3874
+ },
3875
+ hydrate: function hydrate(vnode, elm) {
3876
+ // the element is created, but the vm is not
3877
+ var sel = vnode.sel,
3878
+ mode = vnode.mode,
3879
+ ctor = vnode.ctor,
3880
+ owner = vnode.owner;
3881
+ var def = getComponentInternalDef(ctor);
3882
+ createVM(elm, def, {
3883
+ mode: mode,
3884
+ owner: owner,
3885
+ tagName: sel,
3886
+ renderer: owner.renderer
3887
+ });
3888
+ vnode.elm = elm;
3889
+ var vm = getAssociatedVM(elm);
3890
+ allocateChildrenHook(vnode, vm);
3891
+ hydrateElmHook(vnode); // Insert hook section:
3892
+
3893
+ runConnectedCallback(vm);
3894
+
3895
+ if (vm.renderMode !== 0
3896
+ /* Light */
3897
+ ) {
3898
+ // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
3899
+ // Note: for Light DOM, this is handled while hydrating the VM
3900
+ hydrateChildrenHook(vnode.elm.childNodes, vnode.children);
3901
+ }
3902
+
3903
+ hydrateVM(vm);
3774
3904
  }
3775
3905
  };
3776
3906
 
@@ -3972,7 +4102,7 @@ var LWC = (function (exports) {
3972
4102
 
3973
4103
 
3974
4104
  function d(value) {
3975
- return value == null ? '' : value;
4105
+ return value == null ? '' : String(value);
3976
4106
  } // [b]ind function
3977
4107
 
3978
4108
 
@@ -4111,6 +4241,26 @@ var LWC = (function (exports) {
4111
4241
 
4112
4242
  markAsDynamicChildren(vnodes);
4113
4243
  return vnodes;
4244
+ }
4245
+ /**
4246
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
4247
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
4248
+ * lwc:inner-html directive.
4249
+ * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
4250
+ */
4251
+
4252
+
4253
+ var sanitizeHtmlContentHook = function sanitizeHtmlContentHook() {
4254
+ // locker-service patches this function during runtime to sanitize HTML content.
4255
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
4256
+ };
4257
+ /**
4258
+ * Sets the sanitizeHtmlContentHook.
4259
+ */
4260
+
4261
+
4262
+ function setSanitizeHtmlContentHook(newHookImpl) {
4263
+ sanitizeHtmlContentHook = newHookImpl;
4114
4264
  } // [s]anitize [h]tml [c]ontent
4115
4265
 
4116
4266
 
@@ -4213,8 +4363,8 @@ var LWC = (function (exports) {
4213
4363
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4214
4364
  var content = [];
4215
4365
 
4216
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4217
- var stylesheet = stylesheets[_i14];
4366
+ for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4367
+ var stylesheet = stylesheets[_i16];
4218
4368
 
4219
4369
  if (isArray$1(stylesheet)) {
4220
4370
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
@@ -4284,10 +4434,13 @@ var LWC = (function (exports) {
4284
4434
  && shadowMode === 1
4285
4435
  /* Synthetic */
4286
4436
  ) {
4287
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4288
- renderer.insertGlobalStylesheet(stylesheets[_i15]);
4437
+ for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
4438
+ renderer.insertGlobalStylesheet(stylesheets[_i17]);
4289
4439
  }
4290
- } else if (renderer.ssr) {
4440
+ } else if (renderer.ssr || renderer.isHydrating()) {
4441
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4442
+ // This works in the client, because the stylesheets are created, and cached in the VM
4443
+ // the first time the VM renders.
4291
4444
  // native shadow or light DOM, SSR
4292
4445
  var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
4293
4446
  return createInlineStyleVNode(combinedStylesheetContent);
@@ -4296,12 +4449,12 @@ var LWC = (function (exports) {
4296
4449
  var root = getNearestNativeShadowComponent(vm);
4297
4450
  var isGlobal = isNull(root);
4298
4451
 
4299
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4452
+ for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
4300
4453
  if (isGlobal) {
4301
- renderer.insertGlobalStylesheet(stylesheets[_i16]);
4454
+ renderer.insertGlobalStylesheet(stylesheets[_i18]);
4302
4455
  } else {
4303
4456
  // local level
4304
- renderer.insertStylesheet(stylesheets[_i16], root.cmpRoot);
4457
+ renderer.insertStylesheet(stylesheets[_i18], root.cmpRoot);
4305
4458
  }
4306
4459
  }
4307
4460
  }
@@ -4486,8 +4639,8 @@ var LWC = (function (exports) {
4486
4639
  var stylesheets = template.stylesheets;
4487
4640
 
4488
4641
  if (!isUndefined$1(stylesheets)) {
4489
- for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
4490
- if (isTrue(stylesheets[_i17][KEY__SCOPED_CSS])) {
4642
+ for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
4643
+ if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
4491
4644
  return true;
4492
4645
  }
4493
4646
  }
@@ -4688,8 +4841,8 @@ var LWC = (function (exports) {
4688
4841
 
4689
4842
  function register(service) {
4690
4843
 
4691
- for (var _i18 = 0; _i18 < hooks.length; ++_i18) {
4692
- var hookName = hooks[_i18];
4844
+ for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
4845
+ var hookName = hooks[_i20];
4693
4846
 
4694
4847
  if (hookName in service) {
4695
4848
  var l = Services[hookName];
@@ -4709,8 +4862,8 @@ var LWC = (function (exports) {
4709
4862
  def = vm.def,
4710
4863
  context = vm.context;
4711
4864
 
4712
- for (var _i19 = 0, _len6 = cbs.length; _i19 < _len6; ++_i19) {
4713
- cbs[_i19].call(undefined, component, {}, def, context);
4865
+ for (var _i21 = 0, _len6 = cbs.length; _i21 < _len6; ++_i21) {
4866
+ cbs[_i21].call(undefined, component, {}, def, context);
4714
4867
  }
4715
4868
  }
4716
4869
  /*
@@ -4763,6 +4916,12 @@ var LWC = (function (exports) {
4763
4916
  , vm);
4764
4917
  }
4765
4918
 
4919
+ function hydrateRootElement(elm) {
4920
+ var vm = getAssociatedVM(elm);
4921
+ runConnectedCallback(vm);
4922
+ hydrateVM(vm);
4923
+ }
4924
+
4766
4925
  function disconnectRootElement(elm) {
4767
4926
  var vm = getAssociatedVM(elm);
4768
4927
  resetComponentStateWhenRemoved(vm);
@@ -4770,6 +4929,10 @@ var LWC = (function (exports) {
4770
4929
 
4771
4930
  function appendVM(vm) {
4772
4931
  rehydrate(vm);
4932
+ }
4933
+
4934
+ function hydrateVM(vm) {
4935
+ hydrate(vm);
4773
4936
  } // just in case the component comes back, with this we guarantee re-rendering it
4774
4937
  // while preventing any attempt to rehydration until after reinsertion.
4775
4938
 
@@ -4954,6 +5117,22 @@ var LWC = (function (exports) {
4954
5117
  }
4955
5118
  }
4956
5119
 
5120
+ function hydrate(vm) {
5121
+ if (isTrue(vm.isDirty)) {
5122
+ // manually diffing/patching here.
5123
+ // This routine is:
5124
+ // patchShadowRoot(vm, children);
5125
+ // -> addVnodes.
5126
+ var children = renderComponent(vm);
5127
+ vm.children = children;
5128
+ var vmChildren = vm.renderMode === 0
5129
+ /* Light */
5130
+ ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
5131
+ hydrateChildrenHook(vmChildren, children);
5132
+ runRenderedCallback(vm);
5133
+ }
5134
+ }
5135
+
4957
5136
  function patchShadowRoot(vm, newCh) {
4958
5137
  var oldCh = vm.children; // caching the new children collection
4959
5138
 
@@ -5030,19 +5209,19 @@ var LWC = (function (exports) {
5030
5209
  });
5031
5210
  rehydrateQueue = []; // reset to a new queue
5032
5211
 
5033
- for (var _i20 = 0, _len7 = vms.length; _i20 < _len7; _i20 += 1) {
5034
- var vm = vms[_i20];
5212
+ for (var _i22 = 0, _len7 = vms.length; _i22 < _len7; _i22 += 1) {
5213
+ var vm = vms[_i22];
5035
5214
 
5036
5215
  try {
5037
5216
  rehydrate(vm);
5038
5217
  } catch (error) {
5039
- if (_i20 + 1 < _len7) {
5218
+ if (_i22 + 1 < _len7) {
5040
5219
  // pieces of the queue are still pending to be rehydrated, those should have priority
5041
5220
  if (rehydrateQueue.length === 0) {
5042
5221
  addCallbackToNextTick(flushRehydrationQueue);
5043
5222
  }
5044
5223
 
5045
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i20 + 1));
5224
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i22 + 1));
5046
5225
  } // we need to end the measure before throwing.
5047
5226
 
5048
5227
 
@@ -5141,8 +5320,8 @@ var LWC = (function (exports) {
5141
5320
  var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
5142
5321
  // inserted in reserved order.
5143
5322
 
5144
- for (var _i21 = vCustomElementCollection.length - 1; _i21 >= 0; _i21 -= 1) {
5145
- var elm = vCustomElementCollection[_i21].elm; // There are two cases where the element could be undefined:
5323
+ for (var _i23 = vCustomElementCollection.length - 1; _i23 >= 0; _i23 -= 1) {
5324
+ var elm = vCustomElementCollection[_i23].elm; // There are two cases where the element could be undefined:
5146
5325
  // * when there is an error during the construction phase, and an error
5147
5326
  // boundary picks it, there is a possibility that the VCustomElement
5148
5327
  // is not properly initialized, and therefore is should be ignored.
@@ -5176,8 +5355,8 @@ var LWC = (function (exports) {
5176
5355
 
5177
5356
 
5178
5357
  function recursivelyDisconnectChildren(vnodes) {
5179
- for (var _i22 = 0, _len8 = vnodes.length; _i22 < _len8; _i22 += 1) {
5180
- var vnode = vnodes[_i22];
5358
+ for (var _i24 = 0, _len8 = vnodes.length; _i24 < _len8; _i24 += 1) {
5359
+ var vnode = vnodes[_i24];
5181
5360
 
5182
5361
  if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
5183
5362
  // vnode is a VElement with children
@@ -5201,8 +5380,8 @@ var LWC = (function (exports) {
5201
5380
  renderer = vm.renderer;
5202
5381
  var rootNode = getRenderRoot(vm);
5203
5382
 
5204
- for (var _i23 = 0, _len9 = children.length; _i23 < _len9; _i23++) {
5205
- var child = children[_i23];
5383
+ for (var _i25 = 0, _len9 = children.length; _i25 < _len9; _i25++) {
5384
+ var child = children[_i25];
5206
5385
 
5207
5386
  if (!isNull(child) && !isUndefined$1(child.elm)) {
5208
5387
  renderer.remove(child.elm, rootNode);
@@ -5247,8 +5426,8 @@ var LWC = (function (exports) {
5247
5426
  var oldSlots = vm.cmpSlots;
5248
5427
  var cmpSlots = vm.cmpSlots = create(null);
5249
5428
 
5250
- for (var _i24 = 0, _len10 = children.length; _i24 < _len10; _i24 += 1) {
5251
- var vnode = children[_i24];
5429
+ for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
5430
+ var vnode = children[_i26];
5252
5431
 
5253
5432
  if (isNull(vnode)) {
5254
5433
  continue;
@@ -5278,8 +5457,8 @@ var LWC = (function (exports) {
5278
5457
  return;
5279
5458
  }
5280
5459
 
5281
- for (var _i25 = 0, _len11 = oldKeys.length; _i25 < _len11; _i25 += 1) {
5282
- var key = oldKeys[_i25];
5460
+ for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
5461
+ var key = oldKeys[_i27];
5283
5462
 
5284
5463
  if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
5285
5464
  markComponentAsDirty(vm);
@@ -5618,8 +5797,8 @@ var LWC = (function (exports) {
5618
5797
  function connectWireAdapters(vm) {
5619
5798
  var wiredConnecting = vm.context.wiredConnecting;
5620
5799
 
5621
- for (var _i26 = 0, _len12 = wiredConnecting.length; _i26 < _len12; _i26 += 1) {
5622
- wiredConnecting[_i26]();
5800
+ for (var _i28 = 0, _len12 = wiredConnecting.length; _i28 < _len12; _i28 += 1) {
5801
+ wiredConnecting[_i28]();
5623
5802
  }
5624
5803
  }
5625
5804
 
@@ -5627,8 +5806,8 @@ var LWC = (function (exports) {
5627
5806
  var wiredDisconnecting = vm.context.wiredDisconnecting;
5628
5807
  runWithBoundaryProtection(vm, vm, noop, function () {
5629
5808
  // job
5630
- for (var _i27 = 0, _len13 = wiredDisconnecting.length; _i27 < _len13; _i27 += 1) {
5631
- wiredDisconnecting[_i27]();
5809
+ for (var _i29 = 0, _len13 = wiredDisconnecting.length; _i29 < _len13; _i29 += 1) {
5810
+ wiredDisconnecting[_i29]();
5632
5811
  }
5633
5812
  }, noop);
5634
5813
  }
@@ -5707,25 +5886,12 @@ var LWC = (function (exports) {
5707
5886
 
5708
5887
  var hooksAreSet = false;
5709
5888
 
5710
- function overrideHooks(hooks) {
5711
- var oldHooks = {};
5712
-
5713
- if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
5714
- oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5715
- }
5716
-
5717
- return oldHooks;
5718
- }
5719
-
5720
5889
  function setHooks(hooks) {
5721
5890
  assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
5722
- overrideHooks(hooks);
5723
5891
  hooksAreSet = true;
5892
+ setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5724
5893
  }
5725
-
5726
- function setHooksForTest(hooks) {
5727
- }
5728
- /* version: 2.5.6 */
5894
+ /* version: 2.5.10 */
5729
5895
 
5730
5896
  /*
5731
5897
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5870,8 +6036,17 @@ var LWC = (function (exports) {
5870
6036
  HTMLElementConstructor.prototype = HTMLElement.prototype;
5871
6037
  }
5872
6038
 
6039
+ var _isHydrating = false;
6040
+
6041
+ function setIsHydrating(v) {
6042
+ _isHydrating = v;
6043
+ }
6044
+
5873
6045
  var renderer = {
5874
6046
  ssr: false,
6047
+ isHydrating: function isHydrating() {
6048
+ return _isHydrating;
6049
+ },
5875
6050
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
5876
6051
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
5877
6052
  createElement: function createElement(tagName, namespace) {
@@ -5893,6 +6068,10 @@ var LWC = (function (exports) {
5893
6068
  return node.nextSibling;
5894
6069
  },
5895
6070
  attachShadow: function attachShadow(element, options) {
6071
+ if (_isHydrating) {
6072
+ return element.shadowRoot;
6073
+ }
6074
+
5896
6075
  return element.attachShadow(options);
5897
6076
  },
5898
6077
  setText: function setText(node, content) {
@@ -5997,71 +6176,6 @@ var LWC = (function (exports) {
5997
6176
  getCustomElement: getCustomElement,
5998
6177
  HTMLElement: HTMLElementConstructor
5999
6178
  };
6000
- /*
6001
- * Copyright (c) 2018, salesforce.com, inc.
6002
- * All rights reserved.
6003
- * SPDX-License-Identifier: MIT
6004
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6005
- */
6006
-
6007
- /**
6008
- * This function builds a Web Component class from a LWC constructor so it can be
6009
- * registered as a new element via customElements.define() at any given time.
6010
- *
6011
- * @deprecated since version 1.3.11
6012
- *
6013
- * @example
6014
- * ```
6015
- * import { buildCustomElementConstructor } from 'lwc';
6016
- * import Foo from 'ns/foo';
6017
- * const WC = buildCustomElementConstructor(Foo);
6018
- * customElements.define('x-foo', WC);
6019
- * const elm = document.createElement('x-foo');
6020
- * ```
6021
- */
6022
-
6023
- function deprecatedBuildCustomElementConstructor(Ctor) {
6024
-
6025
- return Ctor.CustomElementConstructor;
6026
- }
6027
-
6028
- function buildCustomElementConstructor(Ctor) {
6029
- var def = getComponentInternalDef(Ctor);
6030
- return /*#__PURE__*/function (_def$bridge) {
6031
- _inherits(_class, _def$bridge);
6032
-
6033
- var _super8 = _createSuper(_class);
6034
-
6035
- function _class() {
6036
- var _this6;
6037
-
6038
- _classCallCheck(this, _class);
6039
-
6040
- _this6 = _super8.call(this);
6041
- createVM(_assertThisInitialized(_this6), def, {
6042
- mode: 'open',
6043
- owner: null,
6044
- tagName: _this6.tagName,
6045
- renderer: renderer
6046
- });
6047
- return _this6;
6048
- }
6049
-
6050
- _createClass(_class, [{
6051
- key: "connectedCallback",
6052
- value: function connectedCallback() {
6053
- connectRootElement(this);
6054
- }
6055
- }, {
6056
- key: "disconnectedCallback",
6057
- value: function disconnectedCallback() {
6058
- disconnectRootElement(this);
6059
- }
6060
- }]);
6061
-
6062
- return _class;
6063
- }(def.bridge);
6064
- }
6065
6179
  /*
6066
6180
  * Copyright (c) 2018, salesforce.com, inc.
6067
6181
  * All rights reserved.
@@ -6071,7 +6185,6 @@ var LWC = (function (exports) {
6071
6185
  // TODO [#2472]: Remove this workaround when appropriate.
6072
6186
  // eslint-disable-next-line lwc-internal/no-global-node
6073
6187
 
6074
-
6075
6188
  var _Node$1 = Node;
6076
6189
  var ConnectingSlot = new WeakMap();
6077
6190
  var DisconnectingSlot = new WeakMap();
@@ -6178,6 +6291,138 @@ var LWC = (function (exports) {
6178
6291
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6179
6292
  */
6180
6293
 
6294
+
6295
+ function hydrateComponent(element, Ctor) {
6296
+ var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6297
+
6298
+ if (!isFunction$1(Ctor)) {
6299
+ throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
6300
+ }
6301
+
6302
+ if (!isObject(props) || isNull(props)) {
6303
+ throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
6304
+ }
6305
+
6306
+ var def = getComponentInternalDef(Ctor);
6307
+
6308
+ try {
6309
+ // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6310
+ // and uses the same algo to create the stylesheets as in SSR.
6311
+ setIsHydrating(true);
6312
+ createVM(element, def, {
6313
+ mode: 'open',
6314
+ owner: null,
6315
+ renderer: renderer,
6316
+ tagName: element.tagName.toLowerCase()
6317
+ });
6318
+
6319
+ for (var _i31 = 0, _Object$entries2 = Object.entries(props); _i31 < _Object$entries2.length; _i31++) {
6320
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i31], 2),
6321
+ key = _Object$entries2$_i[0],
6322
+ value = _Object$entries2$_i[1];
6323
+
6324
+ element[key] = value;
6325
+ }
6326
+
6327
+ hydrateRootElement(element); // set it back since now we finished hydration.
6328
+
6329
+ setIsHydrating(false);
6330
+ } catch (e) {
6331
+ // Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
6332
+ // the client generated DOM.
6333
+
6334
+ /* eslint-disable-next-line no-console */
6335
+ console.error('Recovering from error while hydrating: ', e);
6336
+ setIsHydrating(false);
6337
+ var newElem = createElement(element.tagName, {
6338
+ is: Ctor,
6339
+ mode: 'open'
6340
+ });
6341
+
6342
+ for (var _i32 = 0, _Object$entries3 = Object.entries(props); _i32 < _Object$entries3.length; _i32++) {
6343
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i32], 2),
6344
+ _key3 = _Object$entries3$_i[0],
6345
+ _value2 = _Object$entries3$_i[1];
6346
+
6347
+ newElem[_key3] = _value2;
6348
+ }
6349
+
6350
+ element.parentNode.replaceChild(newElem, element);
6351
+ }
6352
+ }
6353
+ /*
6354
+ * Copyright (c) 2018, salesforce.com, inc.
6355
+ * All rights reserved.
6356
+ * SPDX-License-Identifier: MIT
6357
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6358
+ */
6359
+
6360
+ /**
6361
+ * This function builds a Web Component class from a LWC constructor so it can be
6362
+ * registered as a new element via customElements.define() at any given time.
6363
+ *
6364
+ * @deprecated since version 1.3.11
6365
+ *
6366
+ * @example
6367
+ * ```
6368
+ * import { buildCustomElementConstructor } from 'lwc';
6369
+ * import Foo from 'ns/foo';
6370
+ * const WC = buildCustomElementConstructor(Foo);
6371
+ * customElements.define('x-foo', WC);
6372
+ * const elm = document.createElement('x-foo');
6373
+ * ```
6374
+ */
6375
+
6376
+
6377
+ function deprecatedBuildCustomElementConstructor(Ctor) {
6378
+
6379
+ return Ctor.CustomElementConstructor;
6380
+ }
6381
+
6382
+ function buildCustomElementConstructor(Ctor) {
6383
+ var def = getComponentInternalDef(Ctor);
6384
+ return /*#__PURE__*/function (_def$bridge) {
6385
+ _inherits(_class, _def$bridge);
6386
+
6387
+ var _super8 = _createSuper(_class);
6388
+
6389
+ function _class() {
6390
+ var _this6;
6391
+
6392
+ _classCallCheck(this, _class);
6393
+
6394
+ _this6 = _super8.call(this);
6395
+ createVM(_assertThisInitialized(_this6), def, {
6396
+ mode: 'open',
6397
+ owner: null,
6398
+ tagName: _this6.tagName,
6399
+ renderer: renderer
6400
+ });
6401
+ return _this6;
6402
+ }
6403
+
6404
+ _createClass(_class, [{
6405
+ key: "connectedCallback",
6406
+ value: function connectedCallback() {
6407
+ connectRootElement(this);
6408
+ }
6409
+ }, {
6410
+ key: "disconnectedCallback",
6411
+ value: function disconnectedCallback() {
6412
+ disconnectRootElement(this);
6413
+ }
6414
+ }]);
6415
+
6416
+ return _class;
6417
+ }(def.bridge);
6418
+ }
6419
+ /*
6420
+ * Copyright (c) 2018, salesforce.com, inc.
6421
+ * All rights reserved.
6422
+ * SPDX-License-Identifier: MIT
6423
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6424
+ */
6425
+
6181
6426
  /**
6182
6427
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6183
6428
  * This API is subject to change or being removed.
@@ -6276,7 +6521,7 @@ var LWC = (function (exports) {
6276
6521
  });
6277
6522
  freeze(LightningElement);
6278
6523
  seal(LightningElement.prototype);
6279
- /* version: 2.5.6 */
6524
+ /* version: 2.5.10 */
6280
6525
 
6281
6526
  exports.LightningElement = LightningElement;
6282
6527
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6286,6 +6531,7 @@ var LWC = (function (exports) {
6286
6531
  exports.createElement = createElement;
6287
6532
  exports.getComponentConstructor = getComponentConstructor;
6288
6533
  exports.getComponentDef = getComponentDef;
6534
+ exports.hydrateComponent = hydrateComponent;
6289
6535
  exports.isComponentConstructor = isComponentConstructor;
6290
6536
  exports.isNodeFromTemplate = isNodeFromTemplate;
6291
6537
  exports.readonly = readonly;
@@ -6297,7 +6543,6 @@ var LWC = (function (exports) {
6297
6543
  exports.setFeatureFlag = setFeatureFlag;
6298
6544
  exports.setFeatureFlagForTest = setFeatureFlagForTest;
6299
6545
  exports.setHooks = setHooks;
6300
- exports.setHooksForTest = setHooksForTest;
6301
6546
  exports.swapComponent = swapComponent;
6302
6547
  exports.swapStyle = swapStyle;
6303
6548
  exports.swapTemplate = swapTemplate;