lwc 2.13.0 → 2.13.3

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 (43) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +155 -145
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +155 -145
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +143 -133
  5. package/dist/engine-dom/iife/es5/engine-dom.js +162 -142
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +144 -124
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +155 -145
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +143 -133
  11. package/dist/engine-dom/umd/es5/engine-dom.js +162 -142
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +144 -124
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +132 -124
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +132 -124
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +693 -693
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +693 -693
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +681 -681
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +686 -686
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +1 -1
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +697 -697
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +693 -693
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +681 -681
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +686 -686
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +1 -1
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +697 -697
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
  33. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service.js +5 -5
  35. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  36. package/dist/wire-service/iife/es5/wire-service_debug.js +5 -5
  37. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  39. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  40. package/dist/wire-service/umd/es5/wire-service.js +5 -5
  41. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  42. package/dist/wire-service/umd/es5/wire-service_debug.js +5 -5
  43. package/package.json +7 -7
@@ -293,7 +293,7 @@
293
293
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
294
294
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
295
295
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
296
- /** version: 2.13.0 */
296
+ /** version: 2.13.3 */
297
297
 
298
298
  /*
299
299
  * Copyright (c) 2018, salesforce.com, inc.
@@ -436,7 +436,7 @@
436
436
  */
437
437
  function setFeatureFlagForTest(name, value) {
438
438
  }
439
- /** version: 2.13.0 */
439
+ /** version: 2.13.3 */
440
440
 
441
441
  /* proxy-compat-disable */
442
442
 
@@ -840,6 +840,20 @@
840
840
  log('error', message, vm);
841
841
  }
842
842
 
843
+ /*
844
+ * Copyright (c) 2020, salesforce.com, inc.
845
+ * All rights reserved.
846
+ * SPDX-License-Identifier: MIT
847
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
848
+ */
849
+ function resolveCircularModuleDependency(fn) {
850
+ const module = fn();
851
+ return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
852
+ }
853
+ function isCircularModuleDependency(obj) {
854
+ return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
855
+ }
856
+
843
857
  /*
844
858
  * Copyright (c) 2018, salesforce.com, inc.
845
859
  * All rights reserved.
@@ -1708,58 +1722,7 @@
1708
1722
  configurable: true,
1709
1723
  });
1710
1724
 
1711
- /*
1712
- * Copyright (c) 2018, salesforce.com, inc.
1713
- * All rights reserved.
1714
- * SPDX-License-Identifier: MIT
1715
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1716
- */
1717
- /**
1718
- * @wire decorator to wire fields and methods to a wire adapter in
1719
- * LWC Components. This function implements the internals of this
1720
- * decorator.
1721
- */
1722
- function wire(_adapter, _config) {
1723
- throw new Error();
1724
- }
1725
- function internalWireFieldDecorator(key) {
1726
- return {
1727
- get() {
1728
- const vm = getAssociatedVM(this);
1729
- componentValueObserved(vm, key);
1730
- return vm.cmpFields[key];
1731
- },
1732
- set(value) {
1733
- const vm = getAssociatedVM(this);
1734
- /**
1735
- * Reactivity for wired fields is provided in wiring.
1736
- * We intentionally add reactivity here since this is just
1737
- * letting the author to do the wrong thing, but it will keep our
1738
- * system to be backward compatible.
1739
- */
1740
- if (value !== vm.cmpFields[key]) {
1741
- vm.cmpFields[key] = value;
1742
- componentValueMutated(vm, key);
1743
- }
1744
- },
1745
- enumerable: true,
1746
- configurable: true,
1747
- };
1748
- }
1749
-
1750
- /*
1751
- * Copyright (c) 2018, salesforce.com, inc.
1752
- * All rights reserved.
1753
- * SPDX-License-Identifier: MIT
1754
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1755
- */
1756
- function track(target) {
1757
- if (arguments.length === 1) {
1758
- return reactiveMembrane.getProxy(target);
1759
- }
1760
- throw new Error();
1761
- }
1762
- function internalTrackDecorator(key) {
1725
+ function createObservedFieldPropertyDescriptor(key) {
1763
1726
  return {
1764
1727
  get() {
1765
1728
  const vm = getAssociatedVM(this);
@@ -1768,9 +1731,8 @@
1768
1731
  },
1769
1732
  set(newValue) {
1770
1733
  const vm = getAssociatedVM(this);
1771
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
1772
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
1773
- vm.cmpFields[key] = reactiveOrAnyValue;
1734
+ if (newValue !== vm.cmpFields[key]) {
1735
+ vm.cmpFields[key] = newValue;
1774
1736
  componentValueMutated(vm, key);
1775
1737
  }
1776
1738
  },
@@ -1907,7 +1869,19 @@
1907
1869
  };
1908
1870
  }
1909
1871
 
1910
- function createObservedFieldPropertyDescriptor(key) {
1872
+ /*
1873
+ * Copyright (c) 2018, salesforce.com, inc.
1874
+ * All rights reserved.
1875
+ * SPDX-License-Identifier: MIT
1876
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1877
+ */
1878
+ function track(target) {
1879
+ if (arguments.length === 1) {
1880
+ return reactiveMembrane.getProxy(target);
1881
+ }
1882
+ throw new Error();
1883
+ }
1884
+ function internalTrackDecorator(key) {
1911
1885
  return {
1912
1886
  get() {
1913
1887
  const vm = getAssociatedVM(this);
@@ -1916,8 +1890,48 @@
1916
1890
  },
1917
1891
  set(newValue) {
1918
1892
  const vm = getAssociatedVM(this);
1919
- if (newValue !== vm.cmpFields[key]) {
1920
- vm.cmpFields[key] = newValue;
1893
+ const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
1894
+ if (reactiveOrAnyValue !== vm.cmpFields[key]) {
1895
+ vm.cmpFields[key] = reactiveOrAnyValue;
1896
+ componentValueMutated(vm, key);
1897
+ }
1898
+ },
1899
+ enumerable: true,
1900
+ configurable: true,
1901
+ };
1902
+ }
1903
+
1904
+ /*
1905
+ * Copyright (c) 2018, salesforce.com, inc.
1906
+ * All rights reserved.
1907
+ * SPDX-License-Identifier: MIT
1908
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1909
+ */
1910
+ /**
1911
+ * @wire decorator to wire fields and methods to a wire adapter in
1912
+ * LWC Components. This function implements the internals of this
1913
+ * decorator.
1914
+ */
1915
+ function wire(_adapter, _config) {
1916
+ throw new Error();
1917
+ }
1918
+ function internalWireFieldDecorator(key) {
1919
+ return {
1920
+ get() {
1921
+ const vm = getAssociatedVM(this);
1922
+ componentValueObserved(vm, key);
1923
+ return vm.cmpFields[key];
1924
+ },
1925
+ set(value) {
1926
+ const vm = getAssociatedVM(this);
1927
+ /**
1928
+ * Reactivity for wired fields is provided in wiring.
1929
+ * We intentionally add reactivity here since this is just
1930
+ * letting the author to do the wrong thing, but it will keep our
1931
+ * system to be backward compatible.
1932
+ */
1933
+ if (value !== vm.cmpFields[key]) {
1934
+ vm.cmpFields[key] = value;
1921
1935
  componentValueMutated(vm, key);
1922
1936
  }
1923
1937
  },
@@ -2040,6 +2054,12 @@
2040
2054
  return isUndefined$1(meta) ? defaultMeta : meta;
2041
2055
  }
2042
2056
 
2057
+ /*
2058
+ * Copyright (c) 2018, salesforce.com, inc.
2059
+ * All rights reserved.
2060
+ * SPDX-License-Identifier: MIT
2061
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2062
+ */
2043
2063
  const signedTemplateSet = new Set();
2044
2064
  function defaultEmptyTemplate() {
2045
2065
  return [];
@@ -2054,6 +2074,30 @@
2054
2074
  */
2055
2075
  function registerTemplate(tpl) {
2056
2076
  signedTemplateSet.add(tpl);
2077
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2078
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2079
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2080
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2081
+ defineProperty(tpl, 'stylesheetTokens', {
2082
+ get() {
2083
+ const { stylesheetToken } = this;
2084
+ if (isUndefined$1(stylesheetToken)) {
2085
+ return stylesheetToken;
2086
+ }
2087
+ // Shim for the old `stylesheetTokens` property
2088
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2089
+ return {
2090
+ hostAttribute: `${stylesheetToken}-host`,
2091
+ shadowAttribute: stylesheetToken,
2092
+ };
2093
+ },
2094
+ set(value) {
2095
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2096
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2097
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2098
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2099
+ },
2100
+ });
2057
2101
  // chaining this method as a way to wrap existing
2058
2102
  // assignment of templates easily, without too much transformation
2059
2103
  return tpl;
@@ -2215,20 +2259,6 @@
2215
2259
  const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2216
2260
  freeze(BaseBridgeElement);
2217
2261
  seal(BaseBridgeElement.prototype);
2218
-
2219
- /*
2220
- * Copyright (c) 2020, salesforce.com, inc.
2221
- * All rights reserved.
2222
- * SPDX-License-Identifier: MIT
2223
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2224
- */
2225
- function resolveCircularModuleDependency(fn) {
2226
- const module = fn();
2227
- return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
2228
- }
2229
- function isCircularModuleDependency(obj) {
2230
- return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
2231
- }
2232
2262
  function setActiveVM(vm) {
2233
2263
  {
2234
2264
  // this method should never leak to prod
@@ -4038,20 +4068,9 @@
4038
4068
 
4039
4069
  resetComponentStateWhenRemoved(vm);
4040
4070
  }
4041
-
4042
- function getNearestShadowAncestor(vm) {
4043
- let ancestor = vm.owner;
4044
-
4045
- while (!isNull(ancestor) && ancestor.renderMode === 0
4046
- /* Light */
4047
- ) {
4048
- ancestor = ancestor.owner;
4049
- }
4050
-
4051
- return ancestor;
4052
- }
4053
-
4054
4071
  function createVM(elm, ctor, options) {
4072
+ var _a;
4073
+
4055
4074
  const {
4056
4075
  mode,
4057
4076
  owner,
@@ -4079,6 +4098,8 @@
4079
4098
  oar: create(null),
4080
4099
  cmpTemplate: null,
4081
4100
  renderMode: def.renderMode,
4101
+ shadowMode: computeShadowMode(def, owner),
4102
+ nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
4082
4103
  context: {
4083
4104
  stylesheetToken: undefined,
4084
4105
  hasTokenInClass: undefined,
@@ -4091,7 +4112,6 @@
4091
4112
  },
4092
4113
  // Properties set right after VM creation.
4093
4114
  tro: null,
4094
- shadowMode: null,
4095
4115
  // Properties set by the LightningElement constructor.
4096
4116
  component: null,
4097
4117
  shadowRoot: null,
@@ -4100,7 +4120,6 @@
4100
4120
  setHook,
4101
4121
  getHook
4102
4122
  };
4103
- vm.shadowMode = computeShadowMode(vm);
4104
4123
  vm.tro = getTemplateReactiveObserver(vm);
4105
4124
 
4106
4125
 
@@ -4113,10 +4132,9 @@
4113
4132
  return vm;
4114
4133
  }
4115
4134
 
4116
- function computeShadowMode(vm) {
4117
- const {
4118
- def
4119
- } = vm;
4135
+ function computeShadowMode(def, owner) {
4136
+ var _a;
4137
+
4120
4138
  let shadowMode;
4121
4139
 
4122
4140
  if (isSyntheticShadowDefined$1) {
@@ -4139,23 +4157,13 @@
4139
4157
  /* Native */
4140
4158
  ;
4141
4159
  } else {
4142
- const shadowAncestor = getNearestShadowAncestor(vm);
4143
-
4144
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4145
- /* Native */
4146
- ) {
4147
- // Transitive support for native Shadow DOM. A component in native mode
4148
- // transitively opts all of its descendants into native.
4149
- shadowMode = 0
4150
- /* Native */
4151
- ;
4152
- } else {
4153
- // Synthetic if neither this component nor any of its ancestors are configured
4154
- // to be native.
4155
- shadowMode = 1
4156
- /* Synthetic */
4157
- ;
4158
- }
4160
+ // Transitive support for native Shadow DOM. A component in native mode
4161
+ // transitively opts all of its descendants into native.
4162
+ // Synthetic if neither this component nor any of its ancestors are configured
4163
+ // to be native.
4164
+ shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
4165
+ /* Synthetic */
4166
+ ;
4159
4167
  }
4160
4168
  } else {
4161
4169
  shadowMode = 1
@@ -5131,7 +5139,30 @@
5131
5139
  hooksAreSet = true;
5132
5140
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5133
5141
  }
5134
- /* version: 2.13.0 */
5142
+
5143
+ /*
5144
+ * Copyright (c) 2018, salesforce.com, inc.
5145
+ * All rights reserved.
5146
+ * SPDX-License-Identifier: MIT
5147
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5148
+ */
5149
+ /**
5150
+ * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
5151
+ * This API is subject to change or being removed.
5152
+ */
5153
+ function getComponentConstructor(elm) {
5154
+ let ctor = null;
5155
+ // intentionally checking for undefined due to some funky libraries patching weakmap.get
5156
+ // to throw when undefined.
5157
+ if (!isUndefined$1(elm)) {
5158
+ const vm = getAssociatedVMIfPresent(elm);
5159
+ if (!isUndefined$1(vm)) {
5160
+ ctor = vm.def.ctor;
5161
+ }
5162
+ }
5163
+ return ctor;
5164
+ }
5165
+ /* version: 2.13.3 */
5135
5166
 
5136
5167
  /*
5137
5168
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5649,27 +5680,6 @@
5649
5680
  return element;
5650
5681
  }
5651
5682
 
5652
- /*
5653
- * Copyright (c) 2018, salesforce.com, inc.
5654
- * All rights reserved.
5655
- * SPDX-License-Identifier: MIT
5656
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5657
- */
5658
- /**
5659
- * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
5660
- * This API is subject to change or being removed.
5661
- */
5662
- function getComponentConstructor(elm) {
5663
- let ctor = null;
5664
- if (elm instanceof HTMLElement) {
5665
- const vm = getAssociatedVMIfPresent(elm);
5666
- if (!isUndefined$1(vm)) {
5667
- ctor = vm.def.ctor;
5668
- }
5669
- }
5670
- return ctor;
5671
- }
5672
-
5673
5683
  /*
5674
5684
  * Copyright (c) 2018, salesforce.com, inc.
5675
5685
  * All rights reserved.
@@ -5738,7 +5748,7 @@
5738
5748
  });
5739
5749
  freeze(LightningElement);
5740
5750
  seal(LightningElement.prototype);
5741
- /* version: 2.13.0 */
5751
+ /* version: 2.13.3 */
5742
5752
 
5743
5753
  exports.LightningElement = LightningElement;
5744
5754
  exports.__unstable__ProfilerControl = profilerControl;