lwc 2.5.8 → 2.6.1

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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +161 -129
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +161 -129
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +144 -125
  5. package/dist/engine-dom/iife/es5/engine-dom.js +174 -138
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +159 -136
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +161 -129
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +144 -125
  11. package/dist/engine-dom/umd/es5/engine-dom.js +174 -138
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +159 -136
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +161 -129
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +161 -129
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +23 -130
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +23 -130
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +23 -130
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +23 -124
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +23 -124
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +23 -130
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +23 -130
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +23 -124
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +23 -124
  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_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +8 -8
@@ -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.8 */
301
+ /** version: 2.6.1 */
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.8 */
472
+ /** version: 2.6.1 */
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.
@@ -4176,7 +4159,7 @@ var LWC = (function (exports) {
4176
4159
 
4177
4160
 
4178
4161
  function d(value) {
4179
- return value == null ? '' : value;
4162
+ return value == null ? '' : String(value);
4180
4163
  } // [b]ind function
4181
4164
 
4182
4165
 
@@ -4446,6 +4429,7 @@ var LWC = (function (exports) {
4446
4429
 
4447
4430
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4448
4431
  const content = [];
4432
+ let root;
4449
4433
 
4450
4434
  for (let i = 0; i < stylesheets.length; i++) {
4451
4435
  let stylesheet = stylesheets[i];
@@ -4453,22 +4437,45 @@ var LWC = (function (exports) {
4453
4437
  if (isArray$1(stylesheet)) {
4454
4438
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4455
4439
  } else {
4456
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4457
4440
 
4441
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4442
+
4443
+ const scopeToken = isScopedCss || vm.shadowMode === 1
4444
+ /* Synthetic */
4445
+ && vm.renderMode === 1
4446
+ /* Shadow */
4447
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
4448
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4458
4449
 
4459
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4460
4450
  const useActualHostSelector = vm.renderMode === 0
4461
4451
  /* Light */
4462
4452
  ? !isScopedCss : vm.shadowMode === 0
4463
4453
  /* Native */
4464
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4454
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
4455
+ // we use an attribute selector on the host to simulate :dir().
4465
4456
 
4466
- const scopeToken = isScopedCss || vm.shadowMode === 1
4467
- /* Synthetic */
4468
- && vm.renderMode === 1
4457
+ let useNativeDirPseudoclass;
4458
+
4459
+ if (vm.renderMode === 1
4469
4460
  /* Shadow */
4470
- ? stylesheetToken : undefined;
4471
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4461
+ ) {
4462
+ useNativeDirPseudoclass = vm.shadowMode === 0
4463
+ /* Native */
4464
+ ;
4465
+ } else {
4466
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
4467
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
4468
+ if (isUndefined$1(root)) {
4469
+ // Only calculate the root once as necessary
4470
+ root = getNearestShadowComponent(vm);
4471
+ }
4472
+
4473
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
4474
+ /* Native */
4475
+ ;
4476
+ }
4477
+
4478
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4472
4479
  }
4473
4480
  }
4474
4481
 
@@ -4492,14 +4499,12 @@ var LWC = (function (exports) {
4492
4499
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4493
4500
 
4494
4501
 
4495
- function getNearestNativeShadowComponent(vm) {
4502
+ function getNearestShadowComponent(vm) {
4496
4503
  let owner = vm;
4497
4504
 
4498
4505
  while (!isNull(owner)) {
4499
4506
  if (owner.renderMode === 1
4500
4507
  /* Shadow */
4501
- && owner.shadowMode === 0
4502
- /* Native */
4503
4508
  ) {
4504
4509
  return owner;
4505
4510
  }
@@ -4510,6 +4515,20 @@ var LWC = (function (exports) {
4510
4515
  return owner;
4511
4516
  }
4512
4517
 
4518
+ function getNearestNativeShadowComponent(vm) {
4519
+ const owner = getNearestShadowComponent(vm);
4520
+
4521
+ if (!isNull(owner) && owner.shadowMode === 1
4522
+ /* Synthetic */
4523
+ ) {
4524
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
4525
+ // synthetic, we know we won't find a native component if we go any further.
4526
+ return null;
4527
+ }
4528
+
4529
+ return owner;
4530
+ }
4531
+
4513
4532
  function createStylesheet(vm, stylesheets) {
4514
4533
  const {
4515
4534
  renderer,
@@ -4525,7 +4544,7 @@ var LWC = (function (exports) {
4525
4544
  for (let i = 0; i < stylesheets.length; i++) {
4526
4545
  renderer.insertGlobalStylesheet(stylesheets[i]);
4527
4546
  }
4528
- } else if (renderer.ssr || renderer.isHydrating) {
4547
+ } else if (renderer.ssr || renderer.isHydrating()) {
4529
4548
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4530
4549
  // This works in the client, because the stylesheets are created, and cached in the VM
4531
4550
  // the first time the VM renders.
@@ -6048,7 +6067,7 @@ var LWC = (function (exports) {
6048
6067
  hooksAreSet = true;
6049
6068
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6050
6069
  }
6051
- /* version: 2.5.8 */
6070
+ /* version: 2.6.1 */
6052
6071
 
6053
6072
  /*
6054
6073
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6192,7 +6211,7 @@ var LWC = (function (exports) {
6192
6211
  const renderer = {
6193
6212
  ssr: false,
6194
6213
 
6195
- get isHydrating() {
6214
+ isHydrating() {
6196
6215
  return isHydrating;
6197
6216
  },
6198
6217
 
@@ -6682,7 +6701,7 @@ var LWC = (function (exports) {
6682
6701
  });
6683
6702
  freeze(LightningElement);
6684
6703
  seal(LightningElement.prototype);
6685
- /* version: 2.5.8 */
6704
+ /* version: 2.6.1 */
6686
6705
 
6687
6706
  exports.LightningElement = LightningElement;
6688
6707
  exports.__unstable__ProfilerControl = profilerControl;