lwc 2.5.10-alpha1 → 2.7.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 (54) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +168 -134
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +169 -135
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +154 -133
  5. package/dist/engine-dom/iife/es5/engine-dom.js +185 -145
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +172 -145
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +170 -136
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +155 -134
  11. package/dist/engine-dom/umd/es5/engine-dom.js +186 -146
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +173 -146
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +179 -142
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +179 -142
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -130
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -131
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +30 -131
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +37 -128
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +37 -128
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +31 -132
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +31 -132
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +38 -129
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +38 -129
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +3 -3
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
  33. package/dist/wire-service/iife/es5/wire-service.js +12 -12
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +12 -12
  36. package/dist/wire-service/umd/es2017/wire-service.js +4 -4
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
  38. package/dist/wire-service/umd/es5/wire-service.js +13 -13
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -13
  41. package/package.json +8 -8
  42. package/dist/engine/esm/es2017/engine.js +0 -7981
  43. package/dist/engine/iife/es2017/engine.js +0 -8013
  44. package/dist/engine/iife/es2017/engine.min.js +0 -9
  45. package/dist/engine/iife/es2017/engine_debug.js +0 -6541
  46. package/dist/engine/iife/es5/engine.js +0 -6060
  47. package/dist/engine/iife/es5/engine.min.js +0 -23
  48. package/dist/engine/iife/es5/engine_debug.js +0 -4856
  49. package/dist/engine/umd/es2017/engine.js +0 -8014
  50. package/dist/engine/umd/es2017/engine.min.js +0 -9
  51. package/dist/engine/umd/es2017/engine_debug.js +0 -6542
  52. package/dist/engine/umd/es5/engine.js +0 -6061
  53. package/dist/engine/umd/es5/engine.min.js +0 -23
  54. package/dist/engine/umd/es5/engine_debug.js +0 -4857
@@ -72,7 +72,7 @@ var LWC = (function (exports) {
72
72
  find: ArrayFind,
73
73
  indexOf: ArrayIndexOf,
74
74
  join: ArrayJoin,
75
- map: ArrayMap$1,
75
+ map: ArrayMap,
76
76
  push: ArrayPush$1,
77
77
  reduce: ArrayReduce,
78
78
  reverse: ArrayReverse,
@@ -135,7 +135,7 @@ var LWC = (function (exports) {
135
135
  // Array.prototype.toString directly will cause an error Iterate through
136
136
  // all the items and handle individually.
137
137
  if (isArray$1(obj)) {
138
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
138
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
139
139
  }
140
140
 
141
141
  return obj.toString();
@@ -298,7 +298,7 @@ var LWC = (function (exports) {
298
298
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
299
299
  return attributeName;
300
300
  }
301
- /** version: 2.5.10-alpha1 */
301
+ /** version: 2.7.0 */
302
302
 
303
303
  /*
304
304
  * Copyright (c) 2018, salesforce.com, inc.
@@ -412,7 +412,6 @@ var LWC = (function (exports) {
412
412
  ENABLE_NODE_LIST_PATCH: null,
413
413
  ENABLE_HTML_COLLECTIONS_PATCH: null,
414
414
  ENABLE_NODE_PATCH: null,
415
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
416
415
  ENABLE_MIXED_SHADOW_MODE: null,
417
416
  ENABLE_WIRE_SYNC_EMIT: null
418
417
  };
@@ -470,7 +469,7 @@ var LWC = (function (exports) {
470
469
 
471
470
  function setFeatureFlagForTest(name, value) {
472
471
  }
473
- /** version: 2.5.10-alpha1 */
472
+ /** version: 2.7.0 */
474
473
 
475
474
  /* proxy-compat-disable */
476
475
 
@@ -1493,10 +1492,10 @@ var LWC = (function (exports) {
1493
1492
  isArray
1494
1493
  } = Array;
1495
1494
  const {
1495
+ prototype: ObjectDotPrototype,
1496
1496
  getPrototypeOf,
1497
1497
  create: ObjectCreate,
1498
1498
  defineProperty: ObjectDefineProperty,
1499
- defineProperties: ObjectDefineProperties,
1500
1499
  isExtensible,
1501
1500
  getOwnPropertyDescriptor,
1502
1501
  getOwnPropertyNames,
@@ -1506,8 +1505,7 @@ var LWC = (function (exports) {
1506
1505
  } = Object;
1507
1506
  const {
1508
1507
  push: ArrayPush,
1509
- concat: ArrayConcat,
1510
- map: ArrayMap
1508
+ concat: ArrayConcat
1511
1509
  } = Array.prototype;
1512
1510
 
1513
1511
  function isUndefined(obj) {
@@ -1561,7 +1559,9 @@ var LWC = (function (exports) {
1561
1559
  // but it will always be compatible with the previous descriptor
1562
1560
  // to preserve the object invariants, which makes these lines safe.
1563
1561
 
1564
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1562
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1563
+
1564
+ /* istanbul ignore else */
1565
1565
 
1566
1566
  if (!isUndefined(originalDescriptor)) {
1567
1567
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -1589,11 +1589,17 @@ var LWC = (function (exports) {
1589
1589
 
1590
1590
  preventExtensions(shadowTarget);
1591
1591
  } // Shared Traps
1592
+ // TODO: apply() is never called
1593
+
1594
+ /* istanbul ignore next */
1592
1595
 
1593
1596
 
1594
1597
  apply(shadowTarget, thisArg, argArray) {
1595
1598
  /* No op */
1596
- }
1599
+ } // TODO: construct() is never called
1600
+
1601
+ /* istanbul ignore next */
1602
+
1597
1603
 
1598
1604
  construct(shadowTarget, argArray, newTarget) {
1599
1605
  /* No op */
@@ -1706,8 +1712,8 @@ var LWC = (function (exports) {
1706
1712
 
1707
1713
  }
1708
1714
 
1709
- const getterMap = new WeakMap();
1710
- const setterMap = new WeakMap();
1715
+ const getterMap$1 = new WeakMap();
1716
+ const setterMap$1 = new WeakMap();
1711
1717
  const reverseGetterMap = new WeakMap();
1712
1718
  const reverseSetterMap = new WeakMap();
1713
1719
 
@@ -1717,7 +1723,7 @@ var LWC = (function (exports) {
1717
1723
  }
1718
1724
 
1719
1725
  wrapGetter(originalGet) {
1720
- const wrappedGetter = getterMap.get(originalGet);
1726
+ const wrappedGetter = getterMap$1.get(originalGet);
1721
1727
 
1722
1728
  if (!isUndefined(wrappedGetter)) {
1723
1729
  return wrappedGetter;
@@ -1730,13 +1736,13 @@ var LWC = (function (exports) {
1730
1736
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1731
1737
  };
1732
1738
 
1733
- getterMap.set(originalGet, get);
1739
+ getterMap$1.set(originalGet, get);
1734
1740
  reverseGetterMap.set(get, originalGet);
1735
1741
  return get;
1736
1742
  }
1737
1743
 
1738
1744
  wrapSetter(originalSet) {
1739
- const wrappedSetter = setterMap.get(originalSet);
1745
+ const wrappedSetter = setterMap$1.get(originalSet);
1740
1746
 
1741
1747
  if (!isUndefined(wrappedSetter)) {
1742
1748
  return wrappedSetter;
@@ -1747,7 +1753,7 @@ var LWC = (function (exports) {
1747
1753
  originalSet.call(unwrap$1(this), unwrap$1(v));
1748
1754
  };
1749
1755
 
1750
- setterMap.set(originalSet, set);
1756
+ setterMap$1.set(originalSet, set);
1751
1757
  reverseSetterMap.set(set, originalSet);
1752
1758
  return set;
1753
1759
  }
@@ -1788,7 +1794,7 @@ var LWC = (function (exports) {
1788
1794
  return unwrap$1(redGet.call(handler.wrapValue(this)));
1789
1795
  };
1790
1796
 
1791
- getterMap.set(get, redGet);
1797
+ getterMap$1.set(get, redGet);
1792
1798
  reverseGetterMap.set(redGet, get);
1793
1799
  return get;
1794
1800
  }
@@ -1807,7 +1813,7 @@ var LWC = (function (exports) {
1807
1813
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
1808
1814
  };
1809
1815
 
1810
- setterMap.set(set, redSet);
1816
+ setterMap$1.set(set, redSet);
1811
1817
  reverseSetterMap.set(redSet, set);
1812
1818
  return set;
1813
1819
  }
@@ -1858,6 +1864,11 @@ var LWC = (function (exports) {
1858
1864
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
1859
1865
  // the preventExtension call, in which case we should not attempt to lock down
1860
1866
  // the shadow target.
1867
+ // TODO: It should not actually be possible to reach this `if` statement.
1868
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
1869
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
1870
+
1871
+ /* istanbul ignore if */
1861
1872
 
1862
1873
  if (isExtensible(originalTarget)) {
1863
1874
  return false;
@@ -1899,8 +1910,8 @@ var LWC = (function (exports) {
1899
1910
 
1900
1911
  }
1901
1912
 
1902
- const getterMap$1 = new WeakMap();
1903
- const setterMap$1 = new WeakMap();
1913
+ const getterMap = new WeakMap();
1914
+ const setterMap = new WeakMap();
1904
1915
 
1905
1916
  class ReadOnlyHandler extends BaseProxyHandler {
1906
1917
  wrapValue(value) {
@@ -1908,7 +1919,7 @@ var LWC = (function (exports) {
1908
1919
  }
1909
1920
 
1910
1921
  wrapGetter(originalGet) {
1911
- const wrappedGetter = getterMap$1.get(originalGet);
1922
+ const wrappedGetter = getterMap.get(originalGet);
1912
1923
 
1913
1924
  if (!isUndefined(wrappedGetter)) {
1914
1925
  return wrappedGetter;
@@ -1921,12 +1932,12 @@ var LWC = (function (exports) {
1921
1932
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
1922
1933
  };
1923
1934
 
1924
- getterMap$1.set(originalGet, get);
1935
+ getterMap.set(originalGet, get);
1925
1936
  return get;
1926
1937
  }
1927
1938
 
1928
1939
  wrapSetter(originalSet) {
1929
- const wrappedSetter = setterMap$1.get(originalSet);
1940
+ const wrappedSetter = setterMap.get(originalSet);
1930
1941
 
1931
1942
  if (!isUndefined(wrappedSetter)) {
1932
1943
  return wrappedSetter;
@@ -1935,16 +1946,20 @@ var LWC = (function (exports) {
1935
1946
  const set = function (v) {
1936
1947
  };
1937
1948
 
1938
- setterMap$1.set(originalSet, set);
1949
+ setterMap.set(originalSet, set);
1939
1950
  return set;
1940
1951
  }
1941
1952
 
1942
1953
  set(shadowTarget, key, value) {
1954
+ /* istanbul ignore next */
1955
+
1943
1956
 
1944
1957
  return false;
1945
1958
  }
1946
1959
 
1947
1960
  deleteProperty(shadowTarget, key) {
1961
+ /* istanbul ignore next */
1962
+
1948
1963
 
1949
1964
  return false;
1950
1965
  }
@@ -1953,19 +1968,21 @@ var LWC = (function (exports) {
1953
1968
  }
1954
1969
 
1955
1970
  preventExtensions(shadowTarget) {
1971
+ /* istanbul ignore next */
1972
+
1956
1973
 
1957
1974
  return false;
1958
1975
  }
1959
1976
 
1960
1977
  defineProperty(shadowTarget, key, descriptor) {
1978
+ /* istanbul ignore next */
1979
+
1961
1980
 
1962
1981
  return false;
1963
1982
  }
1964
1983
 
1965
1984
  }
1966
1985
 
1967
- const ObjectDotPrototype = Object.prototype;
1968
-
1969
1986
  function defaultValueIsObservable(value) {
1970
1987
  // intentionally checking for null
1971
1988
  if (value === null) {
@@ -1993,106 +2010,85 @@ var LWC = (function (exports) {
1993
2010
  /* do nothing */
1994
2011
  };
1995
2012
 
1996
- const defaultValueDistortion = value => value;
1997
-
1998
2013
  function createShadowTarget(value) {
1999
2014
  return isArray(value) ? [] : {};
2000
2015
  }
2001
2016
 
2002
- class ReactiveMembrane {
2003
- constructor(options) {
2004
- this.valueDistortion = defaultValueDistortion;
2005
- this.valueMutated = defaultValueMutated;
2006
- this.valueObserved = defaultValueObserved;
2007
- this.valueIsObservable = defaultValueIsObservable;
2008
- this.objectGraph = new WeakMap();
2009
-
2010
- if (!isUndefined(options)) {
2011
- const {
2012
- valueDistortion,
2013
- valueMutated,
2014
- valueObserved,
2015
- valueIsObservable,
2016
- tagPropertyKey
2017
- } = options;
2018
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2019
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2020
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2021
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2022
- this.tagPropertyKey = tagPropertyKey;
2023
- }
2017
+ class ObservableMembrane {
2018
+ constructor(options = {}) {
2019
+ this.readOnlyObjectGraph = new WeakMap();
2020
+ this.reactiveObjectGraph = new WeakMap();
2021
+ const {
2022
+ valueMutated,
2023
+ valueObserved,
2024
+ valueIsObservable,
2025
+ tagPropertyKey
2026
+ } = options;
2027
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2028
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2029
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2030
+ this.tagPropertyKey = tagPropertyKey;
2024
2031
  }
2025
2032
 
2026
2033
  getProxy(value) {
2027
2034
  const unwrappedValue = unwrap$1(value);
2028
- const distorted = this.valueDistortion(unwrappedValue);
2029
2035
 
2030
- if (this.valueIsObservable(distorted)) {
2031
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2032
- // we return the readonly.
2036
+ if (this.valueIsObservable(unwrappedValue)) {
2037
+ // When trying to extract the writable version of a readonly we return the readonly.
2038
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2039
+ return value;
2040
+ }
2033
2041
 
2034
- return o.readOnly === value ? value : o.reactive;
2042
+ return this.getReactiveHandler(unwrappedValue);
2035
2043
  }
2036
2044
 
2037
- return distorted;
2045
+ return unwrappedValue;
2038
2046
  }
2039
2047
 
2040
2048
  getReadOnlyProxy(value) {
2041
2049
  value = unwrap$1(value);
2042
- const distorted = this.valueDistortion(value);
2043
2050
 
2044
- if (this.valueIsObservable(distorted)) {
2045
- return this.getReactiveState(value, distorted).readOnly;
2051
+ if (this.valueIsObservable(value)) {
2052
+ return this.getReadOnlyHandler(value);
2046
2053
  }
2047
2054
 
2048
- return distorted;
2055
+ return value;
2049
2056
  }
2050
2057
 
2051
2058
  unwrapProxy(p) {
2052
2059
  return unwrap$1(p);
2053
2060
  }
2054
2061
 
2055
- getReactiveState(value, distortedValue) {
2056
- const {
2057
- objectGraph
2058
- } = this;
2059
- let reactiveState = objectGraph.get(distortedValue);
2062
+ getReactiveHandler(value) {
2063
+ let proxy = this.reactiveObjectGraph.get(value);
2060
2064
 
2061
- if (reactiveState) {
2062
- return reactiveState;
2065
+ if (isUndefined(proxy)) {
2066
+ // caching the proxy after the first time it is accessed
2067
+ const handler = new ReactiveProxyHandler(this, value);
2068
+ proxy = new Proxy(createShadowTarget(value), handler);
2069
+ registerProxy(proxy, value);
2070
+ this.reactiveObjectGraph.set(value, proxy);
2063
2071
  }
2064
2072
 
2065
- const membrane = this;
2066
- reactiveState = {
2067
- get reactive() {
2068
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2069
-
2070
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2071
- registerProxy(proxy, value);
2072
- ObjectDefineProperty(this, 'reactive', {
2073
- value: proxy
2074
- });
2075
- return proxy;
2076
- },
2073
+ return proxy;
2074
+ }
2077
2075
 
2078
- get readOnly() {
2079
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2076
+ getReadOnlyHandler(value) {
2077
+ let proxy = this.readOnlyObjectGraph.get(value);
2080
2078
 
2081
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2082
- registerProxy(proxy, value);
2083
- ObjectDefineProperty(this, 'readOnly', {
2084
- value: proxy
2085
- });
2086
- return proxy;
2087
- }
2079
+ if (isUndefined(proxy)) {
2080
+ // caching the proxy after the first time it is accessed
2081
+ const handler = new ReadOnlyHandler(this, value);
2082
+ proxy = new Proxy(createShadowTarget(value), handler);
2083
+ registerProxy(proxy, value);
2084
+ this.readOnlyObjectGraph.set(value, proxy);
2085
+ }
2088
2086
 
2089
- };
2090
- objectGraph.set(distortedValue, reactiveState);
2091
- return reactiveState;
2087
+ return proxy;
2092
2088
  }
2093
2089
 
2094
2090
  }
2095
- /** version: 1.0.0 */
2091
+ /** version: 2.0.0 */
2096
2092
 
2097
2093
  /*
2098
2094
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2103,15 +2099,9 @@ var LWC = (function (exports) {
2103
2099
 
2104
2100
 
2105
2101
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2106
-
2107
- function valueDistortion(value) {
2108
- return value;
2109
- }
2110
-
2111
- const reactiveMembrane = new ReactiveMembrane({
2102
+ const reactiveMembrane = new ObservableMembrane({
2112
2103
  valueObserved,
2113
2104
  valueMutated,
2114
- valueDistortion,
2115
2105
  tagPropertyKey: lockerLivePropertyKey
2116
2106
  });
2117
2107
  /**
@@ -2120,16 +2110,9 @@ var LWC = (function (exports) {
2120
2110
  * change or being removed.
2121
2111
  */
2122
2112
 
2123
- const unwrap = function (value) {
2124
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2125
-
2126
- if (unwrapped !== value) {
2127
- // if value is a proxy, unwrap to access original value and apply distortion
2128
- return valueDistortion(unwrapped);
2129
- }
2130
-
2131
- return value;
2132
- };
2113
+ function unwrap(value) {
2114
+ return reactiveMembrane.unwrapProxy(value);
2115
+ }
2133
2116
  /*
2134
2117
  * Copyright (c) 2018, salesforce.com, inc.
2135
2118
  * All rights reserved.
@@ -3525,13 +3508,15 @@ var LWC = (function (exports) {
3525
3508
 
3526
3509
  function updateChildrenHook(oldVnode, vnode) {
3527
3510
  const {
3528
- children,
3529
- owner
3511
+ elm,
3512
+ children
3530
3513
  } = vnode;
3531
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
3532
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
3533
- fn(vnode.elm, oldVnode.children, children);
3534
- }, noop);
3514
+
3515
+ if (hasDynamicChildren(children)) {
3516
+ updateDynamicChildren(elm, oldVnode.children, children);
3517
+ } else {
3518
+ updateStaticChildren(elm, oldVnode.children, children);
3519
+ }
3535
3520
  }
3536
3521
 
3537
3522
  function allocateChildrenHook(vnode, vm) {
@@ -4446,6 +4431,7 @@ var LWC = (function (exports) {
4446
4431
 
4447
4432
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4448
4433
  const content = [];
4434
+ let root;
4449
4435
 
4450
4436
  for (let i = 0; i < stylesheets.length; i++) {
4451
4437
  let stylesheet = stylesheets[i];
@@ -4453,22 +4439,45 @@ var LWC = (function (exports) {
4453
4439
  if (isArray$1(stylesheet)) {
4454
4440
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4455
4441
  } else {
4456
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4457
4442
 
4443
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4444
+
4445
+ const scopeToken = isScopedCss || vm.shadowMode === 1
4446
+ /* Synthetic */
4447
+ && vm.renderMode === 1
4448
+ /* Shadow */
4449
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
4450
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4458
4451
 
4459
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4460
4452
  const useActualHostSelector = vm.renderMode === 0
4461
4453
  /* Light */
4462
4454
  ? !isScopedCss : vm.shadowMode === 0
4463
4455
  /* Native */
4464
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4456
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
4457
+ // we use an attribute selector on the host to simulate :dir().
4465
4458
 
4466
- const scopeToken = isScopedCss || vm.shadowMode === 1
4467
- /* Synthetic */
4468
- && vm.renderMode === 1
4459
+ let useNativeDirPseudoclass;
4460
+
4461
+ if (vm.renderMode === 1
4469
4462
  /* Shadow */
4470
- ? stylesheetToken : undefined;
4471
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4463
+ ) {
4464
+ useNativeDirPseudoclass = vm.shadowMode === 0
4465
+ /* Native */
4466
+ ;
4467
+ } else {
4468
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
4469
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
4470
+ if (isUndefined$1(root)) {
4471
+ // Only calculate the root once as necessary
4472
+ root = getNearestShadowComponent(vm);
4473
+ }
4474
+
4475
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
4476
+ /* Native */
4477
+ ;
4478
+ }
4479
+
4480
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4472
4481
  }
4473
4482
  }
4474
4483
 
@@ -4492,14 +4501,12 @@ var LWC = (function (exports) {
4492
4501
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4493
4502
 
4494
4503
 
4495
- function getNearestNativeShadowComponent(vm) {
4504
+ function getNearestShadowComponent(vm) {
4496
4505
  let owner = vm;
4497
4506
 
4498
4507
  while (!isNull(owner)) {
4499
4508
  if (owner.renderMode === 1
4500
4509
  /* Shadow */
4501
- && owner.shadowMode === 0
4502
- /* Native */
4503
4510
  ) {
4504
4511
  return owner;
4505
4512
  }
@@ -4510,6 +4517,20 @@ var LWC = (function (exports) {
4510
4517
  return owner;
4511
4518
  }
4512
4519
 
4520
+ function getNearestNativeShadowComponent(vm) {
4521
+ const owner = getNearestShadowComponent(vm);
4522
+
4523
+ if (!isNull(owner) && owner.shadowMode === 1
4524
+ /* Synthetic */
4525
+ ) {
4526
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
4527
+ // synthetic, we know we won't find a native component if we go any further.
4528
+ return null;
4529
+ }
4530
+
4531
+ return owner;
4532
+ }
4533
+
4513
4534
  function createStylesheet(vm, stylesheets) {
4514
4535
  const {
4515
4536
  renderer,
@@ -4583,7 +4604,7 @@ var LWC = (function (exports) {
4583
4604
  if (isProfilerEnabled) {
4584
4605
  currentDispatcher(opId, 0
4585
4606
  /* Start */
4586
- , vm.tagName, vm.idx);
4607
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
4587
4608
  }
4588
4609
  }
4589
4610
 
@@ -4592,7 +4613,7 @@ var LWC = (function (exports) {
4592
4613
  if (isProfilerEnabled) {
4593
4614
  currentDispatcher(opId, 1
4594
4615
  /* Stop */
4595
- , vm.tagName, vm.idx);
4616
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
4596
4617
  }
4597
4618
  }
4598
4619
 
@@ -4601,7 +4622,7 @@ var LWC = (function (exports) {
4601
4622
  if (isProfilerEnabled) {
4602
4623
  currentDispatcher(opId, 0
4603
4624
  /* Start */
4604
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
4625
+ , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
4605
4626
  }
4606
4627
  }
4607
4628
 
@@ -4610,7 +4631,7 @@ var LWC = (function (exports) {
4610
4631
  if (isProfilerEnabled) {
4611
4632
  currentDispatcher(opId, 1
4612
4633
  /* Stop */
4613
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
4634
+ , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
4614
4635
  }
4615
4636
  }
4616
4637
  /*
@@ -6048,7 +6069,7 @@ var LWC = (function (exports) {
6048
6069
  hooksAreSet = true;
6049
6070
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6050
6071
  }
6051
- /* version: 2.5.10-alpha1 */
6072
+ /* version: 2.7.0 */
6052
6073
 
6053
6074
  /*
6054
6075
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6682,7 +6703,7 @@ var LWC = (function (exports) {
6682
6703
  });
6683
6704
  freeze(LightningElement);
6684
6705
  seal(LightningElement.prototype);
6685
- /* version: 2.5.10-alpha1 */
6706
+ /* version: 2.7.0 */
6686
6707
 
6687
6708
  exports.LightningElement = LightningElement;
6688
6709
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6715,4 +6736,4 @@ var LWC = (function (exports) {
6715
6736
 
6716
6737
  return exports;
6717
6738
 
6718
- }({}));
6739
+ })({});