lwc 2.21.1 → 2.22.0

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 +145 -71
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +145 -71
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +143 -69
  5. package/dist/engine-dom/iife/es5/engine-dom.js +182 -79
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +167 -64
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +145 -71
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +143 -69
  11. package/dist/engine-dom/umd/es5/engine-dom.js +182 -79
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +167 -64
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +53 -262
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +53 -262
  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 +7 -7
@@ -346,7 +346,7 @@ var LWC = (function (exports) {
346
346
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
347
347
  return attributeName;
348
348
  }
349
- /** version: 2.21.1 */
349
+ /** version: 2.22.0 */
350
350
 
351
351
  /*
352
352
  * Copyright (c) 2018, salesforce.com, inc.
@@ -734,20 +734,24 @@ var LWC = (function (exports) {
734
734
 
735
735
  return ReactiveObserver;
736
736
  }();
737
- /*
738
- * Copyright (c) 2018, salesforce.com, inc.
739
- * All rights reserved.
740
- * SPDX-License-Identifier: MIT
741
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
742
- */
743
-
744
737
 
745
738
  function componentValueMutated(vm, key) {
746
- valueMutated(vm.component, key);
739
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
740
+ {
741
+ valueMutated(vm.component, key);
742
+ }
747
743
  }
748
744
 
749
745
  function componentValueObserved(vm, key) {
750
- valueObserved(vm.component, key);
746
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
747
+ {
748
+ valueObserved(vm.component, key);
749
+ }
750
+ }
751
+
752
+ function createReactiveObserver(callback) {
753
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
754
+ return new ReactiveObserver(callback);
751
755
  }
752
756
  /*
753
757
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1672,8 +1676,28 @@ var LWC = (function (exports) {
1672
1676
  */
1673
1677
 
1674
1678
  function unwrap(value) {
1679
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1675
1680
  return reactiveMembrane.unwrapProxy(value);
1676
1681
  }
1682
+
1683
+ function getReadOnlyProxy(value) {
1684
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1685
+ // them from their parents. This applies to both the client and server.
1686
+ return reactiveMembrane.getReadOnlyProxy(value);
1687
+ }
1688
+
1689
+ function getReactiveProxy(value) {
1690
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1691
+ return reactiveMembrane.getProxy(value);
1692
+ } // Making the component instance a live value when using Locker to support expandos.
1693
+
1694
+
1695
+ function markLockerLiveObject(obj) {
1696
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1697
+ {
1698
+ obj[lockerLivePropertyKey] = undefined;
1699
+ }
1700
+ }
1677
1701
  /*
1678
1702
  * Copyright (c) 2018, salesforce.com, inc.
1679
1703
  * All rights reserved.
@@ -1764,10 +1788,9 @@ var LWC = (function (exports) {
1764
1788
  vm.callHook = _callHook;
1765
1789
  vm.setHook = _setHook;
1766
1790
  vm.getHook = _getHook;
1767
- } // Making the component instance a live value when using Locker to support expandos.
1768
-
1791
+ }
1769
1792
 
1770
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
1793
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
1771
1794
 
1772
1795
  associateVM(component, vm);
1773
1796
  associateVM(elm, vm);
@@ -2025,42 +2048,6 @@ var LWC = (function (exports) {
2025
2048
  configurable: true
2026
2049
  };
2027
2050
  }
2028
- /*
2029
- * Copyright (c) 2018, salesforce.com, inc.
2030
- * All rights reserved.
2031
- * SPDX-License-Identifier: MIT
2032
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2033
- */
2034
-
2035
-
2036
- function api$1() {
2037
-
2038
- throw new Error();
2039
- }
2040
-
2041
- function createPublicPropertyDescriptor(key) {
2042
- return {
2043
- get: function get() {
2044
- var vm = getAssociatedVM(this);
2045
-
2046
- if (isBeingConstructed(vm)) {
2047
-
2048
- return;
2049
- }
2050
-
2051
- componentValueObserved(vm, key);
2052
- return vm.cmpProps[key];
2053
- },
2054
- set: function set(newValue) {
2055
- var vm = getAssociatedVM(this);
2056
-
2057
- vm.cmpProps[key] = newValue;
2058
- componentValueMutated(vm, key);
2059
- },
2060
- enumerable: true,
2061
- configurable: true
2062
- };
2063
- }
2064
2051
 
2065
2052
  var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2066
2053
  _inherits(AccessorReactiveObserver, _ReactiveObserver);
@@ -2119,6 +2106,47 @@ var LWC = (function (exports) {
2119
2106
  return AccessorReactiveObserver;
2120
2107
  }(ReactiveObserver);
2121
2108
 
2109
+ function createAccessorReactiveObserver(vm, set) {
2110
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2111
+ return new AccessorReactiveObserver(vm, set);
2112
+ }
2113
+ /*
2114
+ * Copyright (c) 2018, salesforce.com, inc.
2115
+ * All rights reserved.
2116
+ * SPDX-License-Identifier: MIT
2117
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2118
+ */
2119
+
2120
+
2121
+ function api$1() {
2122
+
2123
+ throw new Error();
2124
+ }
2125
+
2126
+ function createPublicPropertyDescriptor(key) {
2127
+ return {
2128
+ get: function get() {
2129
+ var vm = getAssociatedVM(this);
2130
+
2131
+ if (isBeingConstructed(vm)) {
2132
+
2133
+ return;
2134
+ }
2135
+
2136
+ componentValueObserved(vm, key);
2137
+ return vm.cmpProps[key];
2138
+ },
2139
+ set: function set(newValue) {
2140
+ var vm = getAssociatedVM(this);
2141
+
2142
+ vm.cmpProps[key] = newValue;
2143
+ componentValueMutated(vm, key);
2144
+ },
2145
+ enumerable: true,
2146
+ configurable: true
2147
+ };
2148
+ }
2149
+
2122
2150
  function createPublicAccessorDescriptor(key, descriptor) {
2123
2151
  var _get3 = descriptor.get,
2124
2152
  _set2 = descriptor.set,
@@ -2145,7 +2173,7 @@ var LWC = (function (exports) {
2145
2173
  var ro = vm.oar[key];
2146
2174
 
2147
2175
  if (isUndefined$1(ro)) {
2148
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2176
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2149
2177
  } // every time we invoke this setter from outside (through this wrapper setter)
2150
2178
  // we should reset the value and then debounce just in case there is a pending
2151
2179
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2175,7 +2203,7 @@ var LWC = (function (exports) {
2175
2203
 
2176
2204
  function track(target) {
2177
2205
  if (arguments.length === 1) {
2178
- return reactiveMembrane.getProxy(target);
2206
+ return getReactiveProxy(target);
2179
2207
  }
2180
2208
 
2181
2209
  throw new Error();
@@ -2191,7 +2219,7 @@ var LWC = (function (exports) {
2191
2219
  set: function set(newValue) {
2192
2220
  var vm = getAssociatedVM(this);
2193
2221
 
2194
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2222
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2195
2223
 
2196
2224
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2197
2225
  vm.cmpFields[key] = reactiveOrAnyValue;
@@ -2499,7 +2527,7 @@ var LWC = (function (exports) {
2499
2527
  fn = cachedSetterByKey[key] = function (newValue) {
2500
2528
  var vm = getAssociatedVM(this);
2501
2529
  var setHook = vm.setHook;
2502
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2530
+ newValue = getReadOnlyProxy(newValue);
2503
2531
  setHook(vm.component, key, newValue);
2504
2532
  };
2505
2533
  }
@@ -4953,7 +4981,7 @@ var LWC = (function (exports) {
4953
4981
  }
4954
4982
 
4955
4983
  function getTemplateReactiveObserver(vm) {
4956
- return new ReactiveObserver(function () {
4984
+ return createReactiveObserver(function () {
4957
4985
  var isDirty = vm.isDirty;
4958
4986
 
4959
4987
  if (isFalse(isDirty)) {
@@ -5688,7 +5716,7 @@ var LWC = (function (exports) {
5688
5716
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
5689
5717
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
5690
5718
 
5691
- var ro = new ReactiveObserver(function () {
5719
+ var ro = createReactiveObserver(function () {
5692
5720
  if (hasPendingConfig === false) {
5693
5721
  hasPendingConfig = true; // collect new config in the micro-task
5694
5722
 
@@ -5979,7 +6007,7 @@ var LWC = (function (exports) {
5979
6007
 
5980
6008
  function readonly(obj) {
5981
6009
 
5982
- return reactiveMembrane.getReadOnlyProxy(obj);
6010
+ return getReadOnlyProxy(obj);
5983
6011
  }
5984
6012
  /*
5985
6013
  * Copyright (c) 2022, salesforce.com, inc.
@@ -6461,7 +6489,7 @@ var LWC = (function (exports) {
6461
6489
 
6462
6490
  return ctor;
6463
6491
  }
6464
- /* version: 2.21.1 */
6492
+ /* version: 2.22.0 */
6465
6493
 
6466
6494
  /*
6467
6495
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6620,6 +6648,85 @@ var LWC = (function (exports) {
6620
6648
  */
6621
6649
 
6622
6650
 
6651
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6652
+ var createFragment;
6653
+
6654
+ if (SUPPORTS_TEMPLATE) {
6655
+ // Parse the fragment HTML string into DOM
6656
+ createFragment = function createFragment(html) {
6657
+ var template = document.createElement('template');
6658
+ template.innerHTML = html;
6659
+ return template.content.firstChild;
6660
+ };
6661
+ } else {
6662
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6663
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6664
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6665
+ // With other elements added from:
6666
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6667
+ // Using the test:
6668
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6669
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6670
+ var topLevelWrappingMap = {
6671
+ caption: ['table'],
6672
+ col: ['colgroup', 'table'],
6673
+ colgroup: ['table'],
6674
+ option: ['select'],
6675
+ tbody: ['table'],
6676
+ td: ['tr', 'tbody', 'table'],
6677
+ th: ['tr', 'tbody', 'table'],
6678
+ thead: ['table'],
6679
+ tfoot: ['table'],
6680
+ tr: ['tbody', 'table']
6681
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6682
+
6683
+ var getTagName = function getTagName(text) {
6684
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6685
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6686
+
6687
+
6688
+ createFragment = function createFragment(html) {
6689
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
6690
+
6691
+ if (!isUndefined$1(wrapperTags)) {
6692
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6693
+ _step5;
6694
+
6695
+ try {
6696
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6697
+ var wrapperTag = _step5.value;
6698
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6699
+ }
6700
+ } catch (err) {
6701
+ _iterator5.e(err);
6702
+ } finally {
6703
+ _iterator5.f();
6704
+ }
6705
+ } // For IE11, the document title must not be undefined, but it can be an empty string
6706
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6707
+
6708
+
6709
+ var doc = document.implementation.createHTMLDocument('');
6710
+ doc.body.innerHTML = html;
6711
+ var content = doc.body;
6712
+
6713
+ if (!isUndefined$1(wrapperTags)) {
6714
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6715
+ content = content.firstChild;
6716
+ }
6717
+ }
6718
+
6719
+ return content.firstChild;
6720
+ };
6721
+ }
6722
+ /*
6723
+ * Copyright (c) 2018, salesforce.com, inc.
6724
+ * All rights reserved.
6725
+ * SPDX-License-Identifier: MIT
6726
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6727
+ */
6728
+
6729
+
6623
6730
  var getCustomElement;
6624
6731
  var defineCustomElement;
6625
6732
  var HTMLElementConstructor;
@@ -6720,10 +6827,6 @@ var LWC = (function (exports) {
6720
6827
  return node.cloneNode(deep);
6721
6828
  }
6722
6829
 
6723
- function createFragment(html) {
6724
- return document.createRange().createContextualFragment(html).firstChild;
6725
- }
6726
-
6727
6830
  function createElement$1(tagName, namespace) {
6728
6831
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6729
6832
  }
@@ -6942,8 +7045,8 @@ var LWC = (function (exports) {
6942
7045
  hydrated: true
6943
7046
  });
6944
7047
 
6945
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
6946
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
7048
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
7049
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6947
7050
  key = _Object$entries2$_i[0],
6948
7051
  value = _Object$entries2$_i[1];
6949
7052
 
@@ -7268,7 +7371,7 @@ var LWC = (function (exports) {
7268
7371
  });
7269
7372
  freeze(LightningElement);
7270
7373
  seal(LightningElement.prototype);
7271
- /* version: 2.21.1 */
7374
+ /* version: 2.22.0 */
7272
7375
 
7273
7376
  exports.LightningElement = LightningElement;
7274
7377
  exports.__unstable__ProfilerControl = profilerControl;
@@ -305,9 +305,9 @@
305
305
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
306
306
  */
307
307
  // Increment whenever the LWC template compiler changes
308
- const LWC_VERSION = "2.21.1";
308
+ const LWC_VERSION = "2.22.0";
309
309
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
310
- /** version: 2.21.1 */
310
+ /** version: 2.22.0 */
311
311
 
312
312
  /*
313
313
  * Copyright (c) 2018, salesforce.com, inc.
@@ -461,7 +461,7 @@
461
461
  setFeatureFlag(name, value);
462
462
  }
463
463
  }
464
- /** version: 2.21.1 */
464
+ /** version: 2.22.0 */
465
465
 
466
466
  /*
467
467
  * Copyright (c) 2018, salesforce.com, inc.
@@ -693,18 +693,21 @@
693
693
  ArrayPush$1.call(this.listeners, reactiveObservers);
694
694
  }
695
695
  }
696
-
697
- /*
698
- * Copyright (c) 2018, salesforce.com, inc.
699
- * All rights reserved.
700
- * SPDX-License-Identifier: MIT
701
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
702
- */
703
696
  function componentValueMutated(vm, key) {
704
- valueMutated(vm.component, key);
697
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
698
+ {
699
+ valueMutated(vm.component, key);
700
+ }
705
701
  }
706
702
  function componentValueObserved(vm, key) {
707
- valueObserved(vm.component, key);
703
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
704
+ {
705
+ valueObserved(vm.component, key);
706
+ }
707
+ }
708
+ function createReactiveObserver(callback) {
709
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
710
+ return new ReactiveObserver(callback) ;
708
711
  }
709
712
 
710
713
  /*
@@ -1826,7 +1829,24 @@
1826
1829
  * change or being removed.
1827
1830
  */
1828
1831
  function unwrap(value) {
1829
- return reactiveMembrane.unwrapProxy(value);
1832
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1833
+ return reactiveMembrane.unwrapProxy(value) ;
1834
+ }
1835
+ function getReadOnlyProxy(value) {
1836
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1837
+ // them from their parents. This applies to both the client and server.
1838
+ return reactiveMembrane.getReadOnlyProxy(value);
1839
+ }
1840
+ function getReactiveProxy(value) {
1841
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1842
+ return reactiveMembrane.getProxy(value) ;
1843
+ }
1844
+ // Making the component instance a live value when using Locker to support expandos.
1845
+ function markLockerLiveObject(obj) {
1846
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1847
+ {
1848
+ obj[lockerLivePropertyKey] = undefined;
1849
+ }
1830
1850
  }
1831
1851
 
1832
1852
  /*
@@ -1916,8 +1936,7 @@
1916
1936
  vm.setHook = setHook;
1917
1937
  vm.getHook = getHook;
1918
1938
  }
1919
- // Making the component instance a live value when using Locker to support expandos.
1920
- this[lockerLivePropertyKey] = undefined;
1939
+ markLockerLiveObject(this);
1921
1940
  // Linking elm, shadow root and component with the VM.
1922
1941
  associateVM(component, vm);
1923
1942
  associateVM(elm, vm);
@@ -2186,6 +2205,45 @@
2186
2205
  configurable: true,
2187
2206
  };
2188
2207
  }
2208
+ class AccessorReactiveObserver extends ReactiveObserver {
2209
+ constructor(vm, set) {
2210
+ super(() => {
2211
+ if (isFalse(this.debouncing)) {
2212
+ this.debouncing = true;
2213
+ addCallbackToNextTick(() => {
2214
+ if (isTrue(this.debouncing)) {
2215
+ const { value } = this;
2216
+ const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
2217
+ set.call(component, value);
2218
+ // de-bouncing after the call to the original setter to prevent
2219
+ // infinity loop if the setter itself is mutating things that
2220
+ // were accessed during the previous invocation.
2221
+ this.debouncing = false;
2222
+ if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2223
+ // immediate rehydration due to a setter driven mutation, otherwise
2224
+ // the component will get rendered on the second tick, which it is not
2225
+ // desirable.
2226
+ rerenderVM(vm);
2227
+ }
2228
+ }
2229
+ });
2230
+ }
2231
+ });
2232
+ this.debouncing = false;
2233
+ }
2234
+ reset(value) {
2235
+ super.reset();
2236
+ this.debouncing = false;
2237
+ if (arguments.length > 0) {
2238
+ this.value = value;
2239
+ }
2240
+ }
2241
+ }
2242
+ function createAccessorReactiveObserver(vm, set) {
2243
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2244
+ return new AccessorReactiveObserver(vm, set)
2245
+ ;
2246
+ }
2189
2247
 
2190
2248
  /*
2191
2249
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2234,50 +2292,6 @@
2234
2292
  configurable: true
2235
2293
  };
2236
2294
  }
2237
- class AccessorReactiveObserver extends ReactiveObserver {
2238
- constructor(vm, set) {
2239
- super(() => {
2240
- if (isFalse(this.debouncing)) {
2241
- this.debouncing = true;
2242
- addCallbackToNextTick(() => {
2243
- if (isTrue(this.debouncing)) {
2244
- const {
2245
- value
2246
- } = this;
2247
- const {
2248
- isDirty: dirtyStateBeforeSetterCall,
2249
- component,
2250
- idx
2251
- } = vm;
2252
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2253
- // infinity loop if the setter itself is mutating things that
2254
- // were accessed during the previous invocation.
2255
-
2256
- this.debouncing = false;
2257
-
2258
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2259
- // immediate rehydration due to a setter driven mutation, otherwise
2260
- // the component will get rendered on the second tick, which it is not
2261
- // desirable.
2262
- rerenderVM(vm);
2263
- }
2264
- }
2265
- });
2266
- }
2267
- });
2268
- this.debouncing = false;
2269
- }
2270
-
2271
- reset(value) {
2272
- super.reset();
2273
- this.debouncing = false;
2274
-
2275
- if (arguments.length > 0) {
2276
- this.value = value;
2277
- }
2278
- }
2279
-
2280
- }
2281
2295
  function createPublicAccessorDescriptor(key, descriptor) {
2282
2296
  const {
2283
2297
  get,
@@ -2318,7 +2332,7 @@
2318
2332
  let ro = vm.oar[key];
2319
2333
 
2320
2334
  if (isUndefined$1(ro)) {
2321
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2335
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
2322
2336
  } // every time we invoke this setter from outside (through this wrapper setter)
2323
2337
  // we should reset the value and then debounce just in case there is a pending
2324
2338
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2350,7 +2364,7 @@
2350
2364
  */
2351
2365
  function track(target) {
2352
2366
  if (arguments.length === 1) {
2353
- return reactiveMembrane.getProxy(target);
2367
+ return getReactiveProxy(target);
2354
2368
  }
2355
2369
  if (process.env.NODE_ENV !== 'production') {
2356
2370
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2371,7 +2385,7 @@
2371
2385
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2372
2386
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2373
2387
  }
2374
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2388
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2375
2389
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2376
2390
  vm.cmpFields[key] = reactiveOrAnyValue;
2377
2391
  componentValueMutated(vm, key);
@@ -2763,7 +2777,7 @@
2763
2777
  fn = cachedSetterByKey[key] = function (newValue) {
2764
2778
  const vm = getAssociatedVM(this);
2765
2779
  const { setHook } = vm;
2766
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2780
+ newValue = getReadOnlyProxy(newValue);
2767
2781
  setHook(vm.component, key, newValue);
2768
2782
  };
2769
2783
  }
@@ -5199,7 +5213,7 @@
5199
5213
  return signedTemplateMap.get(Ctor);
5200
5214
  }
5201
5215
  function getTemplateReactiveObserver(vm) {
5202
- return new ReactiveObserver(() => {
5216
+ return createReactiveObserver(() => {
5203
5217
  const { isDirty } = vm;
5204
5218
  if (isFalse(isDirty)) {
5205
5219
  markComponentAsDirty(vm);
@@ -6014,7 +6028,7 @@
6014
6028
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6015
6029
  let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
6016
6030
 
6017
- const ro = new ReactiveObserver(() => {
6031
+ const ro = createReactiveObserver(() => {
6018
6032
  if (hasPendingConfig === false) {
6019
6033
  hasPendingConfig = true; // collect new config in the micro-task
6020
6034
 
@@ -6310,7 +6324,7 @@
6310
6324
  assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6311
6325
  }
6312
6326
  }
6313
- return reactiveMembrane.getReadOnlyProxy(obj);
6327
+ return getReadOnlyProxy(obj);
6314
6328
  }
6315
6329
 
6316
6330
  /*
@@ -6821,7 +6835,7 @@
6821
6835
  }
6822
6836
  return ctor;
6823
6837
  }
6824
- /* version: 2.21.1 */
6838
+ /* version: 2.22.0 */
6825
6839
 
6826
6840
  /*
6827
6841
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6965,6 +6979,69 @@
6965
6979
  }
6966
6980
  }
6967
6981
 
6982
+ /*
6983
+ * Copyright (c) 2018, salesforce.com, inc.
6984
+ * All rights reserved.
6985
+ * SPDX-License-Identifier: MIT
6986
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6987
+ */
6988
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6989
+ let createFragment;
6990
+ if (SUPPORTS_TEMPLATE) {
6991
+ // Parse the fragment HTML string into DOM
6992
+ createFragment = function (html) {
6993
+ const template = document.createElement('template');
6994
+ template.innerHTML = html;
6995
+ return template.content.firstChild;
6996
+ };
6997
+ }
6998
+ else {
6999
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
7000
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
7001
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
7002
+ // With other elements added from:
7003
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
7004
+ // Using the test:
7005
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
7006
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
7007
+ const topLevelWrappingMap = {
7008
+ caption: ['table'],
7009
+ col: ['colgroup', 'table'],
7010
+ colgroup: ['table'],
7011
+ option: ['select'],
7012
+ tbody: ['table'],
7013
+ td: ['tr', 'tbody', 'table'],
7014
+ th: ['tr', 'tbody', 'table'],
7015
+ thead: ['table'],
7016
+ tfoot: ['table'],
7017
+ tr: ['tbody', 'table'],
7018
+ };
7019
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
7020
+ const getTagName = function (text) {
7021
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
7022
+ };
7023
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
7024
+ createFragment = function (html) {
7025
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
7026
+ if (!isUndefined$1(wrapperTags)) {
7027
+ for (const wrapperTag of wrapperTags) {
7028
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
7029
+ }
7030
+ }
7031
+ // For IE11, the document title must not be undefined, but it can be an empty string
7032
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
7033
+ const doc = document.implementation.createHTMLDocument('');
7034
+ doc.body.innerHTML = html;
7035
+ let content = doc.body;
7036
+ if (!isUndefined$1(wrapperTags)) {
7037
+ for (let i = 0; i < wrapperTags.length; i++) {
7038
+ content = content.firstChild;
7039
+ }
7040
+ }
7041
+ return content.firstChild;
7042
+ };
7043
+ }
7044
+
6968
7045
  /*
6969
7046
  * Copyright (c) 2018, salesforce.com, inc.
6970
7047
  * All rights reserved.
@@ -7043,9 +7120,6 @@
7043
7120
  function cloneNode(node, deep) {
7044
7121
  return node.cloneNode(deep);
7045
7122
  }
7046
- function createFragment(html) {
7047
- return document.createRange().createContextualFragment(html).firstChild;
7048
- }
7049
7123
  function createElement$1(tagName, namespace) {
7050
7124
  return isUndefined$1(namespace)
7051
7125
  ? document.createElement(tagName)
@@ -7509,7 +7583,7 @@
7509
7583
  });
7510
7584
  freeze(LightningElement);
7511
7585
  seal(LightningElement.prototype);
7512
- /* version: 2.21.1 */
7586
+ /* version: 2.22.0 */
7513
7587
 
7514
7588
  exports.LightningElement = LightningElement;
7515
7589
  exports.__unstable__ProfilerControl = profilerControl;