lwc 2.5.8 → 2.5.9

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 +141 -80
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +141 -80
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +124 -76
  5. package/dist/engine-dom/iife/es5/engine-dom.js +150 -85
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +133 -81
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +141 -80
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +124 -76
  11. package/dist/engine-dom/umd/es5/engine-dom.js +150 -85
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +133 -81
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +141 -80
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +141 -80
  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
@@ -75,7 +75,7 @@
75
75
  find: ArrayFind,
76
76
  indexOf: ArrayIndexOf,
77
77
  join: ArrayJoin,
78
- map: ArrayMap$1,
78
+ map: ArrayMap,
79
79
  push: ArrayPush$1,
80
80
  reduce: ArrayReduce,
81
81
  reverse: ArrayReverse,
@@ -138,7 +138,7 @@
138
138
  // Array.prototype.toString directly will cause an error Iterate through
139
139
  // all the items and handle individually.
140
140
  if (isArray$1(obj)) {
141
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
141
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
142
142
  }
143
143
 
144
144
  return obj.toString();
@@ -301,7 +301,7 @@
301
301
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
302
302
  return attributeName;
303
303
  }
304
- /** version: 2.5.8 */
304
+ /** version: 2.5.9 */
305
305
 
306
306
  /*
307
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -473,7 +473,7 @@
473
473
 
474
474
  function setFeatureFlagForTest(name, value) {
475
475
  }
476
- /** version: 2.5.8 */
476
+ /** version: 2.5.9 */
477
477
 
478
478
  /* proxy-compat-disable */
479
479
 
@@ -1499,7 +1499,6 @@
1499
1499
  getPrototypeOf,
1500
1500
  create: ObjectCreate,
1501
1501
  defineProperty: ObjectDefineProperty,
1502
- defineProperties: ObjectDefineProperties,
1503
1502
  isExtensible,
1504
1503
  getOwnPropertyDescriptor,
1505
1504
  getOwnPropertyNames,
@@ -1509,8 +1508,7 @@
1509
1508
  } = Object;
1510
1509
  const {
1511
1510
  push: ArrayPush,
1512
- concat: ArrayConcat,
1513
- map: ArrayMap
1511
+ concat: ArrayConcat
1514
1512
  } = Array.prototype;
1515
1513
 
1516
1514
  function isUndefined(obj) {
@@ -1564,7 +1562,9 @@
1564
1562
  // but it will always be compatible with the previous descriptor
1565
1563
  // to preserve the object invariants, which makes these lines safe.
1566
1564
 
1567
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1565
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1566
+
1567
+ /* istanbul ignore else */
1568
1568
 
1569
1569
  if (!isUndefined(originalDescriptor)) {
1570
1570
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -1592,11 +1592,17 @@
1592
1592
 
1593
1593
  preventExtensions(shadowTarget);
1594
1594
  } // Shared Traps
1595
+ // TODO: apply() is never called
1596
+
1597
+ /* istanbul ignore next */
1595
1598
 
1596
1599
 
1597
1600
  apply(shadowTarget, thisArg, argArray) {
1598
1601
  /* No op */
1599
- }
1602
+ } // TODO: construct() is never called
1603
+
1604
+ /* istanbul ignore next */
1605
+
1600
1606
 
1601
1607
  construct(shadowTarget, argArray, newTarget) {
1602
1608
  /* No op */
@@ -1709,8 +1715,8 @@
1709
1715
 
1710
1716
  }
1711
1717
 
1712
- const getterMap = new WeakMap();
1713
- const setterMap = new WeakMap();
1718
+ const getterMap$1 = new WeakMap();
1719
+ const setterMap$1 = new WeakMap();
1714
1720
  const reverseGetterMap = new WeakMap();
1715
1721
  const reverseSetterMap = new WeakMap();
1716
1722
 
@@ -1720,7 +1726,7 @@
1720
1726
  }
1721
1727
 
1722
1728
  wrapGetter(originalGet) {
1723
- const wrappedGetter = getterMap.get(originalGet);
1729
+ const wrappedGetter = getterMap$1.get(originalGet);
1724
1730
 
1725
1731
  if (!isUndefined(wrappedGetter)) {
1726
1732
  return wrappedGetter;
@@ -1733,13 +1739,13 @@
1733
1739
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1734
1740
  };
1735
1741
 
1736
- getterMap.set(originalGet, get);
1742
+ getterMap$1.set(originalGet, get);
1737
1743
  reverseGetterMap.set(get, originalGet);
1738
1744
  return get;
1739
1745
  }
1740
1746
 
1741
1747
  wrapSetter(originalSet) {
1742
- const wrappedSetter = setterMap.get(originalSet);
1748
+ const wrappedSetter = setterMap$1.get(originalSet);
1743
1749
 
1744
1750
  if (!isUndefined(wrappedSetter)) {
1745
1751
  return wrappedSetter;
@@ -1750,7 +1756,7 @@
1750
1756
  originalSet.call(unwrap$1(this), unwrap$1(v));
1751
1757
  };
1752
1758
 
1753
- setterMap.set(originalSet, set);
1759
+ setterMap$1.set(originalSet, set);
1754
1760
  reverseSetterMap.set(set, originalSet);
1755
1761
  return set;
1756
1762
  }
@@ -1791,7 +1797,7 @@
1791
1797
  return unwrap$1(redGet.call(handler.wrapValue(this)));
1792
1798
  };
1793
1799
 
1794
- getterMap.set(get, redGet);
1800
+ getterMap$1.set(get, redGet);
1795
1801
  reverseGetterMap.set(redGet, get);
1796
1802
  return get;
1797
1803
  }
@@ -1810,7 +1816,7 @@
1810
1816
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
1811
1817
  };
1812
1818
 
1813
- setterMap.set(set, redSet);
1819
+ setterMap$1.set(set, redSet);
1814
1820
  reverseSetterMap.set(redSet, set);
1815
1821
  return set;
1816
1822
  }
@@ -1861,6 +1867,11 @@
1861
1867
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
1862
1868
  // the preventExtension call, in which case we should not attempt to lock down
1863
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 */
1864
1875
 
1865
1876
  if (isExtensible(originalTarget)) {
1866
1877
  return false;
@@ -1902,8 +1913,8 @@
1902
1913
 
1903
1914
  }
1904
1915
 
1905
- const getterMap$1 = new WeakMap();
1906
- const setterMap$1 = new WeakMap();
1916
+ const getterMap = new WeakMap();
1917
+ const setterMap = new WeakMap();
1907
1918
 
1908
1919
  class ReadOnlyHandler extends BaseProxyHandler {
1909
1920
  wrapValue(value) {
@@ -1911,7 +1922,7 @@
1911
1922
  }
1912
1923
 
1913
1924
  wrapGetter(originalGet) {
1914
- const wrappedGetter = getterMap$1.get(originalGet);
1925
+ const wrappedGetter = getterMap.get(originalGet);
1915
1926
 
1916
1927
  if (!isUndefined(wrappedGetter)) {
1917
1928
  return wrappedGetter;
@@ -1924,12 +1935,12 @@
1924
1935
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1925
1936
  };
1926
1937
 
1927
- getterMap$1.set(originalGet, get);
1938
+ getterMap.set(originalGet, get);
1928
1939
  return get;
1929
1940
  }
1930
1941
 
1931
1942
  wrapSetter(originalSet) {
1932
- const wrappedSetter = setterMap$1.get(originalSet);
1943
+ const wrappedSetter = setterMap.get(originalSet);
1933
1944
 
1934
1945
  if (!isUndefined(wrappedSetter)) {
1935
1946
  return wrappedSetter;
@@ -1938,16 +1949,20 @@
1938
1949
  const set = function (v) {
1939
1950
  };
1940
1951
 
1941
- setterMap$1.set(originalSet, set);
1952
+ setterMap.set(originalSet, set);
1942
1953
  return set;
1943
1954
  }
1944
1955
 
1945
1956
  set(shadowTarget, key, value) {
1957
+ /* istanbul ignore next */
1958
+
1946
1959
 
1947
1960
  return false;
1948
1961
  }
1949
1962
 
1950
1963
  deleteProperty(shadowTarget, key) {
1964
+ /* istanbul ignore next */
1965
+
1951
1966
 
1952
1967
  return false;
1953
1968
  }
@@ -1956,11 +1971,15 @@
1956
1971
  }
1957
1972
 
1958
1973
  preventExtensions(shadowTarget) {
1974
+ /* istanbul ignore next */
1975
+
1959
1976
 
1960
1977
  return false;
1961
1978
  }
1962
1979
 
1963
1980
  defineProperty(shadowTarget, key, descriptor) {
1981
+ /* istanbul ignore next */
1982
+
1964
1983
 
1965
1984
  return false;
1966
1985
  }
@@ -2008,7 +2027,8 @@
2008
2027
  this.valueMutated = defaultValueMutated;
2009
2028
  this.valueObserved = defaultValueObserved;
2010
2029
  this.valueIsObservable = defaultValueIsObservable;
2011
- this.objectGraph = new WeakMap();
2030
+ this.readOnlyObjectGraph = new WeakMap();
2031
+ this.reactiveObjectGraph = new WeakMap();
2012
2032
 
2013
2033
  if (!isUndefined(options)) {
2014
2034
  const {
@@ -2031,10 +2051,13 @@
2031
2051
  const distorted = this.valueDistortion(unwrappedValue);
2032
2052
 
2033
2053
  if (this.valueIsObservable(distorted)) {
2034
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2035
- // we return the readonly.
2054
+ if (this.readOnlyObjectGraph.get(distorted) === value) {
2055
+ // when trying to extract the writable version of a readonly
2056
+ // we return the readonly.
2057
+ return value;
2058
+ }
2036
2059
 
2037
- return o.readOnly === value ? value : o.reactive;
2060
+ return this.getReactiveHandler(unwrappedValue, distorted);
2038
2061
  }
2039
2062
 
2040
2063
  return distorted;
@@ -2045,7 +2068,7 @@
2045
2068
  const distorted = this.valueDistortion(value);
2046
2069
 
2047
2070
  if (this.valueIsObservable(distorted)) {
2048
- return this.getReactiveState(value, distorted).readOnly;
2071
+ return this.getReadOnlyHandler(value, distorted);
2049
2072
  }
2050
2073
 
2051
2074
  return distorted;
@@ -2055,47 +2078,36 @@
2055
2078
  return unwrap$1(p);
2056
2079
  }
2057
2080
 
2058
- getReactiveState(value, distortedValue) {
2059
- const {
2060
- objectGraph
2061
- } = this;
2062
- let reactiveState = objectGraph.get(distortedValue);
2081
+ getReactiveHandler(value, distortedValue) {
2082
+ let proxy = this.reactiveObjectGraph.get(distortedValue);
2063
2083
 
2064
- if (reactiveState) {
2065
- return reactiveState;
2084
+ if (isUndefined(proxy)) {
2085
+ // caching the proxy after the first time it is accessed
2086
+ const handler = new ReactiveProxyHandler(this, distortedValue);
2087
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2088
+ registerProxy(proxy, value);
2089
+ this.reactiveObjectGraph.set(distortedValue, proxy);
2066
2090
  }
2067
2091
 
2068
- const membrane = this;
2069
- reactiveState = {
2070
- get reactive() {
2071
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2072
-
2073
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2074
- registerProxy(proxy, value);
2075
- ObjectDefineProperty(this, 'reactive', {
2076
- value: proxy
2077
- });
2078
- return proxy;
2079
- },
2092
+ return proxy;
2093
+ }
2080
2094
 
2081
- get readOnly() {
2082
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2095
+ getReadOnlyHandler(value, distortedValue) {
2096
+ let proxy = this.readOnlyObjectGraph.get(distortedValue);
2083
2097
 
2084
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2085
- registerProxy(proxy, value);
2086
- ObjectDefineProperty(this, 'readOnly', {
2087
- value: proxy
2088
- });
2089
- return proxy;
2090
- }
2098
+ if (isUndefined(proxy)) {
2099
+ // caching the proxy after the first time it is accessed
2100
+ const handler = new ReadOnlyHandler(this, distortedValue);
2101
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2102
+ registerProxy(proxy, value);
2103
+ this.readOnlyObjectGraph.set(distortedValue, proxy);
2104
+ }
2091
2105
 
2092
- };
2093
- objectGraph.set(distortedValue, reactiveState);
2094
- return reactiveState;
2106
+ return proxy;
2095
2107
  }
2096
2108
 
2097
2109
  }
2098
- /** version: 1.0.0 */
2110
+ /** version: 1.1.5 */
2099
2111
 
2100
2112
  /*
2101
2113
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4179,7 +4191,7 @@
4179
4191
 
4180
4192
 
4181
4193
  function d(value) {
4182
- return value == null ? '' : value;
4194
+ return value == null ? '' : String(value);
4183
4195
  } // [b]ind function
4184
4196
 
4185
4197
 
@@ -4449,6 +4461,7 @@
4449
4461
 
4450
4462
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4451
4463
  const content = [];
4464
+ let root;
4452
4465
 
4453
4466
  for (let i = 0; i < stylesheets.length; i++) {
4454
4467
  let stylesheet = stylesheets[i];
@@ -4456,22 +4469,45 @@
4456
4469
  if (isArray$1(stylesheet)) {
4457
4470
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4458
4471
  } else {
4459
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4460
4472
 
4473
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4474
+
4475
+ const scopeToken = isScopedCss || vm.shadowMode === 1
4476
+ /* Synthetic */
4477
+ && vm.renderMode === 1
4478
+ /* Shadow */
4479
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
4480
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4461
4481
 
4462
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4463
4482
  const useActualHostSelector = vm.renderMode === 0
4464
4483
  /* Light */
4465
4484
  ? !isScopedCss : vm.shadowMode === 0
4466
4485
  /* Native */
4467
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4486
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
4487
+ // we use an attribute selector on the host to simulate :dir().
4468
4488
 
4469
- const scopeToken = isScopedCss || vm.shadowMode === 1
4470
- /* Synthetic */
4471
- && vm.renderMode === 1
4489
+ let useNativeDirPseudoclass;
4490
+
4491
+ if (vm.renderMode === 1
4472
4492
  /* Shadow */
4473
- ? stylesheetToken : undefined;
4474
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4493
+ ) {
4494
+ useNativeDirPseudoclass = vm.shadowMode === 0
4495
+ /* Native */
4496
+ ;
4497
+ } else {
4498
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
4499
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
4500
+ if (isUndefined$1(root)) {
4501
+ // Only calculate the root once as necessary
4502
+ root = getNearestShadowComponent(vm);
4503
+ }
4504
+
4505
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
4506
+ /* Native */
4507
+ ;
4508
+ }
4509
+
4510
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4475
4511
  }
4476
4512
  }
4477
4513
 
@@ -4495,14 +4531,12 @@
4495
4531
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4496
4532
 
4497
4533
 
4498
- function getNearestNativeShadowComponent(vm) {
4534
+ function getNearestShadowComponent(vm) {
4499
4535
  let owner = vm;
4500
4536
 
4501
4537
  while (!isNull(owner)) {
4502
4538
  if (owner.renderMode === 1
4503
4539
  /* Shadow */
4504
- && owner.shadowMode === 0
4505
- /* Native */
4506
4540
  ) {
4507
4541
  return owner;
4508
4542
  }
@@ -4513,6 +4547,20 @@
4513
4547
  return owner;
4514
4548
  }
4515
4549
 
4550
+ function getNearestNativeShadowComponent(vm) {
4551
+ const owner = getNearestShadowComponent(vm);
4552
+
4553
+ if (!isNull(owner) && owner.shadowMode === 1
4554
+ /* Synthetic */
4555
+ ) {
4556
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
4557
+ // synthetic, we know we won't find a native component if we go any further.
4558
+ return null;
4559
+ }
4560
+
4561
+ return owner;
4562
+ }
4563
+
4516
4564
  function createStylesheet(vm, stylesheets) {
4517
4565
  const {
4518
4566
  renderer,
@@ -4528,7 +4576,7 @@
4528
4576
  for (let i = 0; i < stylesheets.length; i++) {
4529
4577
  renderer.insertGlobalStylesheet(stylesheets[i]);
4530
4578
  }
4531
- } else if (renderer.ssr || renderer.isHydrating) {
4579
+ } else if (renderer.ssr || renderer.isHydrating()) {
4532
4580
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4533
4581
  // This works in the client, because the stylesheets are created, and cached in the VM
4534
4582
  // the first time the VM renders.
@@ -6051,7 +6099,7 @@
6051
6099
  hooksAreSet = true;
6052
6100
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6053
6101
  }
6054
- /* version: 2.5.8 */
6102
+ /* version: 2.5.9 */
6055
6103
 
6056
6104
  /*
6057
6105
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6195,7 +6243,7 @@
6195
6243
  const renderer = {
6196
6244
  ssr: false,
6197
6245
 
6198
- get isHydrating() {
6246
+ isHydrating() {
6199
6247
  return isHydrating;
6200
6248
  },
6201
6249
 
@@ -6685,7 +6733,7 @@
6685
6733
  });
6686
6734
  freeze(LightningElement);
6687
6735
  seal(LightningElement.prototype);
6688
- /* version: 2.5.8 */
6736
+ /* version: 2.5.9 */
6689
6737
 
6690
6738
  exports.LightningElement = LightningElement;
6691
6739
  exports.__unstable__ProfilerControl = profilerControl;