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
@@ -349,7 +349,7 @@
349
349
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
350
350
  return attributeName;
351
351
  }
352
- /** version: 2.21.1 */
352
+ /** version: 2.22.0 */
353
353
 
354
354
  /*
355
355
  * Copyright (c) 2018, salesforce.com, inc.
@@ -737,20 +737,24 @@
737
737
 
738
738
  return ReactiveObserver;
739
739
  }();
740
- /*
741
- * Copyright (c) 2018, salesforce.com, inc.
742
- * All rights reserved.
743
- * SPDX-License-Identifier: MIT
744
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
745
- */
746
-
747
740
 
748
741
  function componentValueMutated(vm, key) {
749
- valueMutated(vm.component, key);
742
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
743
+ {
744
+ valueMutated(vm.component, key);
745
+ }
750
746
  }
751
747
 
752
748
  function componentValueObserved(vm, key) {
753
- valueObserved(vm.component, key);
749
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
750
+ {
751
+ valueObserved(vm.component, key);
752
+ }
753
+ }
754
+
755
+ function createReactiveObserver(callback) {
756
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
757
+ return new ReactiveObserver(callback);
754
758
  }
755
759
  /*
756
760
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1675,8 +1679,28 @@
1675
1679
  */
1676
1680
 
1677
1681
  function unwrap(value) {
1682
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1678
1683
  return reactiveMembrane.unwrapProxy(value);
1679
1684
  }
1685
+
1686
+ function getReadOnlyProxy(value) {
1687
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1688
+ // them from their parents. This applies to both the client and server.
1689
+ return reactiveMembrane.getReadOnlyProxy(value);
1690
+ }
1691
+
1692
+ function getReactiveProxy(value) {
1693
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1694
+ return reactiveMembrane.getProxy(value);
1695
+ } // Making the component instance a live value when using Locker to support expandos.
1696
+
1697
+
1698
+ function markLockerLiveObject(obj) {
1699
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1700
+ {
1701
+ obj[lockerLivePropertyKey] = undefined;
1702
+ }
1703
+ }
1680
1704
  /*
1681
1705
  * Copyright (c) 2018, salesforce.com, inc.
1682
1706
  * All rights reserved.
@@ -1767,10 +1791,9 @@
1767
1791
  vm.callHook = _callHook;
1768
1792
  vm.setHook = _setHook;
1769
1793
  vm.getHook = _getHook;
1770
- } // Making the component instance a live value when using Locker to support expandos.
1771
-
1794
+ }
1772
1795
 
1773
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
1796
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
1774
1797
 
1775
1798
  associateVM(component, vm);
1776
1799
  associateVM(elm, vm);
@@ -2028,42 +2051,6 @@
2028
2051
  configurable: true
2029
2052
  };
2030
2053
  }
2031
- /*
2032
- * Copyright (c) 2018, salesforce.com, inc.
2033
- * All rights reserved.
2034
- * SPDX-License-Identifier: MIT
2035
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2036
- */
2037
-
2038
-
2039
- function api$1() {
2040
-
2041
- throw new Error();
2042
- }
2043
-
2044
- function createPublicPropertyDescriptor(key) {
2045
- return {
2046
- get: function get() {
2047
- var vm = getAssociatedVM(this);
2048
-
2049
- if (isBeingConstructed(vm)) {
2050
-
2051
- return;
2052
- }
2053
-
2054
- componentValueObserved(vm, key);
2055
- return vm.cmpProps[key];
2056
- },
2057
- set: function set(newValue) {
2058
- var vm = getAssociatedVM(this);
2059
-
2060
- vm.cmpProps[key] = newValue;
2061
- componentValueMutated(vm, key);
2062
- },
2063
- enumerable: true,
2064
- configurable: true
2065
- };
2066
- }
2067
2054
 
2068
2055
  var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2069
2056
  _inherits(AccessorReactiveObserver, _ReactiveObserver);
@@ -2122,6 +2109,47 @@
2122
2109
  return AccessorReactiveObserver;
2123
2110
  }(ReactiveObserver);
2124
2111
 
2112
+ function createAccessorReactiveObserver(vm, set) {
2113
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2114
+ return new AccessorReactiveObserver(vm, set);
2115
+ }
2116
+ /*
2117
+ * Copyright (c) 2018, salesforce.com, inc.
2118
+ * All rights reserved.
2119
+ * SPDX-License-Identifier: MIT
2120
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2121
+ */
2122
+
2123
+
2124
+ function api$1() {
2125
+
2126
+ throw new Error();
2127
+ }
2128
+
2129
+ function createPublicPropertyDescriptor(key) {
2130
+ return {
2131
+ get: function get() {
2132
+ var vm = getAssociatedVM(this);
2133
+
2134
+ if (isBeingConstructed(vm)) {
2135
+
2136
+ return;
2137
+ }
2138
+
2139
+ componentValueObserved(vm, key);
2140
+ return vm.cmpProps[key];
2141
+ },
2142
+ set: function set(newValue) {
2143
+ var vm = getAssociatedVM(this);
2144
+
2145
+ vm.cmpProps[key] = newValue;
2146
+ componentValueMutated(vm, key);
2147
+ },
2148
+ enumerable: true,
2149
+ configurable: true
2150
+ };
2151
+ }
2152
+
2125
2153
  function createPublicAccessorDescriptor(key, descriptor) {
2126
2154
  var _get3 = descriptor.get,
2127
2155
  _set2 = descriptor.set,
@@ -2148,7 +2176,7 @@
2148
2176
  var ro = vm.oar[key];
2149
2177
 
2150
2178
  if (isUndefined$1(ro)) {
2151
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2179
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2152
2180
  } // every time we invoke this setter from outside (through this wrapper setter)
2153
2181
  // we should reset the value and then debounce just in case there is a pending
2154
2182
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2178,7 +2206,7 @@
2178
2206
 
2179
2207
  function track(target) {
2180
2208
  if (arguments.length === 1) {
2181
- return reactiveMembrane.getProxy(target);
2209
+ return getReactiveProxy(target);
2182
2210
  }
2183
2211
 
2184
2212
  throw new Error();
@@ -2194,7 +2222,7 @@
2194
2222
  set: function set(newValue) {
2195
2223
  var vm = getAssociatedVM(this);
2196
2224
 
2197
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2225
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2198
2226
 
2199
2227
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2200
2228
  vm.cmpFields[key] = reactiveOrAnyValue;
@@ -2502,7 +2530,7 @@
2502
2530
  fn = cachedSetterByKey[key] = function (newValue) {
2503
2531
  var vm = getAssociatedVM(this);
2504
2532
  var setHook = vm.setHook;
2505
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2533
+ newValue = getReadOnlyProxy(newValue);
2506
2534
  setHook(vm.component, key, newValue);
2507
2535
  };
2508
2536
  }
@@ -4956,7 +4984,7 @@
4956
4984
  }
4957
4985
 
4958
4986
  function getTemplateReactiveObserver(vm) {
4959
- return new ReactiveObserver(function () {
4987
+ return createReactiveObserver(function () {
4960
4988
  var isDirty = vm.isDirty;
4961
4989
 
4962
4990
  if (isFalse(isDirty)) {
@@ -5691,7 +5719,7 @@
5691
5719
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
5692
5720
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
5693
5721
 
5694
- var ro = new ReactiveObserver(function () {
5722
+ var ro = createReactiveObserver(function () {
5695
5723
  if (hasPendingConfig === false) {
5696
5724
  hasPendingConfig = true; // collect new config in the micro-task
5697
5725
 
@@ -5982,7 +6010,7 @@
5982
6010
 
5983
6011
  function readonly(obj) {
5984
6012
 
5985
- return reactiveMembrane.getReadOnlyProxy(obj);
6013
+ return getReadOnlyProxy(obj);
5986
6014
  }
5987
6015
  /*
5988
6016
  * Copyright (c) 2022, salesforce.com, inc.
@@ -6464,7 +6492,7 @@
6464
6492
 
6465
6493
  return ctor;
6466
6494
  }
6467
- /* version: 2.21.1 */
6495
+ /* version: 2.22.0 */
6468
6496
 
6469
6497
  /*
6470
6498
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6623,6 +6651,85 @@
6623
6651
  */
6624
6652
 
6625
6653
 
6654
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6655
+ var createFragment;
6656
+
6657
+ if (SUPPORTS_TEMPLATE) {
6658
+ // Parse the fragment HTML string into DOM
6659
+ createFragment = function createFragment(html) {
6660
+ var template = document.createElement('template');
6661
+ template.innerHTML = html;
6662
+ return template.content.firstChild;
6663
+ };
6664
+ } else {
6665
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6666
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6667
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6668
+ // With other elements added from:
6669
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6670
+ // Using the test:
6671
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6672
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6673
+ var topLevelWrappingMap = {
6674
+ caption: ['table'],
6675
+ col: ['colgroup', 'table'],
6676
+ colgroup: ['table'],
6677
+ option: ['select'],
6678
+ tbody: ['table'],
6679
+ td: ['tr', 'tbody', 'table'],
6680
+ th: ['tr', 'tbody', 'table'],
6681
+ thead: ['table'],
6682
+ tfoot: ['table'],
6683
+ tr: ['tbody', 'table']
6684
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6685
+
6686
+ var getTagName = function getTagName(text) {
6687
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6688
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6689
+
6690
+
6691
+ createFragment = function createFragment(html) {
6692
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
6693
+
6694
+ if (!isUndefined$1(wrapperTags)) {
6695
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6696
+ _step5;
6697
+
6698
+ try {
6699
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6700
+ var wrapperTag = _step5.value;
6701
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6702
+ }
6703
+ } catch (err) {
6704
+ _iterator5.e(err);
6705
+ } finally {
6706
+ _iterator5.f();
6707
+ }
6708
+ } // For IE11, the document title must not be undefined, but it can be an empty string
6709
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6710
+
6711
+
6712
+ var doc = document.implementation.createHTMLDocument('');
6713
+ doc.body.innerHTML = html;
6714
+ var content = doc.body;
6715
+
6716
+ if (!isUndefined$1(wrapperTags)) {
6717
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6718
+ content = content.firstChild;
6719
+ }
6720
+ }
6721
+
6722
+ return content.firstChild;
6723
+ };
6724
+ }
6725
+ /*
6726
+ * Copyright (c) 2018, salesforce.com, inc.
6727
+ * All rights reserved.
6728
+ * SPDX-License-Identifier: MIT
6729
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6730
+ */
6731
+
6732
+
6626
6733
  var getCustomElement;
6627
6734
  var defineCustomElement;
6628
6735
  var HTMLElementConstructor;
@@ -6723,10 +6830,6 @@
6723
6830
  return node.cloneNode(deep);
6724
6831
  }
6725
6832
 
6726
- function createFragment(html) {
6727
- return document.createRange().createContextualFragment(html).firstChild;
6728
- }
6729
-
6730
6833
  function createElement$1(tagName, namespace) {
6731
6834
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6732
6835
  }
@@ -6945,8 +7048,8 @@
6945
7048
  hydrated: true
6946
7049
  });
6947
7050
 
6948
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
6949
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
7051
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
7052
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
6950
7053
  key = _Object$entries2$_i[0],
6951
7054
  value = _Object$entries2$_i[1];
6952
7055
 
@@ -7271,7 +7374,7 @@
7271
7374
  });
7272
7375
  freeze(LightningElement);
7273
7376
  seal(LightningElement.prototype);
7274
- /* version: 2.21.1 */
7377
+ /* version: 2.22.0 */
7275
7378
 
7276
7379
  exports.LightningElement = LightningElement;
7277
7380
  exports.__unstable__ProfilerControl = profilerControl;