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
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LWC = {}));
5
- }(this, (function (exports) { 'use strict';
5
+ })(this, (function (exports) { 'use strict';
6
6
 
7
7
  /* proxy-compat-disable */
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.10-alpha1 */
304
+ /** version: 2.7.0 */
305
305
 
306
306
  /*
307
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -415,7 +415,6 @@
415
415
  ENABLE_NODE_LIST_PATCH: null,
416
416
  ENABLE_HTML_COLLECTIONS_PATCH: null,
417
417
  ENABLE_NODE_PATCH: null,
418
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
419
418
  ENABLE_MIXED_SHADOW_MODE: null,
420
419
  ENABLE_WIRE_SYNC_EMIT: null
421
420
  };
@@ -473,7 +472,7 @@
473
472
 
474
473
  function setFeatureFlagForTest(name, value) {
475
474
  }
476
- /** version: 2.5.10-alpha1 */
475
+ /** version: 2.7.0 */
477
476
 
478
477
  /* proxy-compat-disable */
479
478
 
@@ -1496,10 +1495,10 @@
1496
1495
  isArray
1497
1496
  } = Array;
1498
1497
  const {
1498
+ prototype: ObjectDotPrototype,
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,19 +1971,21 @@
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
  }
1967
1986
 
1968
1987
  }
1969
1988
 
1970
- const ObjectDotPrototype = Object.prototype;
1971
-
1972
1989
  function defaultValueIsObservable(value) {
1973
1990
  // intentionally checking for null
1974
1991
  if (value === null) {
@@ -1996,106 +2013,85 @@
1996
2013
  /* do nothing */
1997
2014
  };
1998
2015
 
1999
- const defaultValueDistortion = value => value;
2000
-
2001
2016
  function createShadowTarget(value) {
2002
2017
  return isArray(value) ? [] : {};
2003
2018
  }
2004
2019
 
2005
- class ReactiveMembrane {
2006
- constructor(options) {
2007
- this.valueDistortion = defaultValueDistortion;
2008
- this.valueMutated = defaultValueMutated;
2009
- this.valueObserved = defaultValueObserved;
2010
- this.valueIsObservable = defaultValueIsObservable;
2011
- this.objectGraph = new WeakMap();
2012
-
2013
- if (!isUndefined(options)) {
2014
- const {
2015
- valueDistortion,
2016
- valueMutated,
2017
- valueObserved,
2018
- valueIsObservable,
2019
- tagPropertyKey
2020
- } = options;
2021
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2022
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2023
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2024
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2025
- this.tagPropertyKey = tagPropertyKey;
2026
- }
2020
+ class ObservableMembrane {
2021
+ constructor(options = {}) {
2022
+ this.readOnlyObjectGraph = new WeakMap();
2023
+ this.reactiveObjectGraph = new WeakMap();
2024
+ const {
2025
+ valueMutated,
2026
+ valueObserved,
2027
+ valueIsObservable,
2028
+ tagPropertyKey
2029
+ } = options;
2030
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2031
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2032
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2033
+ this.tagPropertyKey = tagPropertyKey;
2027
2034
  }
2028
2035
 
2029
2036
  getProxy(value) {
2030
2037
  const unwrappedValue = unwrap$1(value);
2031
- const distorted = this.valueDistortion(unwrappedValue);
2032
2038
 
2033
- 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.
2039
+ if (this.valueIsObservable(unwrappedValue)) {
2040
+ // When trying to extract the writable version of a readonly we return the readonly.
2041
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2042
+ return value;
2043
+ }
2036
2044
 
2037
- return o.readOnly === value ? value : o.reactive;
2045
+ return this.getReactiveHandler(unwrappedValue);
2038
2046
  }
2039
2047
 
2040
- return distorted;
2048
+ return unwrappedValue;
2041
2049
  }
2042
2050
 
2043
2051
  getReadOnlyProxy(value) {
2044
2052
  value = unwrap$1(value);
2045
- const distorted = this.valueDistortion(value);
2046
2053
 
2047
- if (this.valueIsObservable(distorted)) {
2048
- return this.getReactiveState(value, distorted).readOnly;
2054
+ if (this.valueIsObservable(value)) {
2055
+ return this.getReadOnlyHandler(value);
2049
2056
  }
2050
2057
 
2051
- return distorted;
2058
+ return value;
2052
2059
  }
2053
2060
 
2054
2061
  unwrapProxy(p) {
2055
2062
  return unwrap$1(p);
2056
2063
  }
2057
2064
 
2058
- getReactiveState(value, distortedValue) {
2059
- const {
2060
- objectGraph
2061
- } = this;
2062
- let reactiveState = objectGraph.get(distortedValue);
2065
+ getReactiveHandler(value) {
2066
+ let proxy = this.reactiveObjectGraph.get(value);
2063
2067
 
2064
- if (reactiveState) {
2065
- return reactiveState;
2068
+ if (isUndefined(proxy)) {
2069
+ // caching the proxy after the first time it is accessed
2070
+ const handler = new ReactiveProxyHandler(this, value);
2071
+ proxy = new Proxy(createShadowTarget(value), handler);
2072
+ registerProxy(proxy, value);
2073
+ this.reactiveObjectGraph.set(value, proxy);
2066
2074
  }
2067
2075
 
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
- },
2076
+ return proxy;
2077
+ }
2080
2078
 
2081
- get readOnly() {
2082
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2079
+ getReadOnlyHandler(value) {
2080
+ let proxy = this.readOnlyObjectGraph.get(value);
2083
2081
 
2084
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2085
- registerProxy(proxy, value);
2086
- ObjectDefineProperty(this, 'readOnly', {
2087
- value: proxy
2088
- });
2089
- return proxy;
2090
- }
2082
+ if (isUndefined(proxy)) {
2083
+ // caching the proxy after the first time it is accessed
2084
+ const handler = new ReadOnlyHandler(this, value);
2085
+ proxy = new Proxy(createShadowTarget(value), handler);
2086
+ registerProxy(proxy, value);
2087
+ this.readOnlyObjectGraph.set(value, proxy);
2088
+ }
2091
2089
 
2092
- };
2093
- objectGraph.set(distortedValue, reactiveState);
2094
- return reactiveState;
2090
+ return proxy;
2095
2091
  }
2096
2092
 
2097
2093
  }
2098
- /** version: 1.0.0 */
2094
+ /** version: 2.0.0 */
2099
2095
 
2100
2096
  /*
2101
2097
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2106,15 +2102,9 @@
2106
2102
 
2107
2103
 
2108
2104
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2109
-
2110
- function valueDistortion(value) {
2111
- return value;
2112
- }
2113
-
2114
- const reactiveMembrane = new ReactiveMembrane({
2105
+ const reactiveMembrane = new ObservableMembrane({
2115
2106
  valueObserved,
2116
2107
  valueMutated,
2117
- valueDistortion,
2118
2108
  tagPropertyKey: lockerLivePropertyKey
2119
2109
  });
2120
2110
  /**
@@ -2123,16 +2113,9 @@
2123
2113
  * change or being removed.
2124
2114
  */
2125
2115
 
2126
- const unwrap = function (value) {
2127
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2128
-
2129
- if (unwrapped !== value) {
2130
- // if value is a proxy, unwrap to access original value and apply distortion
2131
- return valueDistortion(unwrapped);
2132
- }
2133
-
2134
- return value;
2135
- };
2116
+ function unwrap(value) {
2117
+ return reactiveMembrane.unwrapProxy(value);
2118
+ }
2136
2119
  /*
2137
2120
  * Copyright (c) 2018, salesforce.com, inc.
2138
2121
  * All rights reserved.
@@ -3528,13 +3511,15 @@
3528
3511
 
3529
3512
  function updateChildrenHook(oldVnode, vnode) {
3530
3513
  const {
3531
- children,
3532
- owner
3514
+ elm,
3515
+ children
3533
3516
  } = vnode;
3534
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
3535
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
3536
- fn(vnode.elm, oldVnode.children, children);
3537
- }, noop);
3517
+
3518
+ if (hasDynamicChildren(children)) {
3519
+ updateDynamicChildren(elm, oldVnode.children, children);
3520
+ } else {
3521
+ updateStaticChildren(elm, oldVnode.children, children);
3522
+ }
3538
3523
  }
3539
3524
 
3540
3525
  function allocateChildrenHook(vnode, vm) {
@@ -4449,6 +4434,7 @@
4449
4434
 
4450
4435
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4451
4436
  const content = [];
4437
+ let root;
4452
4438
 
4453
4439
  for (let i = 0; i < stylesheets.length; i++) {
4454
4440
  let stylesheet = stylesheets[i];
@@ -4456,22 +4442,45 @@
4456
4442
  if (isArray$1(stylesheet)) {
4457
4443
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4458
4444
  } else {
4459
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4460
4445
 
4446
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4447
+
4448
+ const scopeToken = isScopedCss || vm.shadowMode === 1
4449
+ /* Synthetic */
4450
+ && vm.renderMode === 1
4451
+ /* Shadow */
4452
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
4453
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4461
4454
 
4462
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4463
4455
  const useActualHostSelector = vm.renderMode === 0
4464
4456
  /* Light */
4465
4457
  ? !isScopedCss : vm.shadowMode === 0
4466
4458
  /* Native */
4467
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4459
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
4460
+ // we use an attribute selector on the host to simulate :dir().
4468
4461
 
4469
- const scopeToken = isScopedCss || vm.shadowMode === 1
4470
- /* Synthetic */
4471
- && vm.renderMode === 1
4462
+ let useNativeDirPseudoclass;
4463
+
4464
+ if (vm.renderMode === 1
4472
4465
  /* Shadow */
4473
- ? stylesheetToken : undefined;
4474
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
4466
+ ) {
4467
+ useNativeDirPseudoclass = vm.shadowMode === 0
4468
+ /* Native */
4469
+ ;
4470
+ } else {
4471
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
4472
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
4473
+ if (isUndefined$1(root)) {
4474
+ // Only calculate the root once as necessary
4475
+ root = getNearestShadowComponent(vm);
4476
+ }
4477
+
4478
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
4479
+ /* Native */
4480
+ ;
4481
+ }
4482
+
4483
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4475
4484
  }
4476
4485
  }
4477
4486
 
@@ -4495,14 +4504,12 @@
4495
4504
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4496
4505
 
4497
4506
 
4498
- function getNearestNativeShadowComponent(vm) {
4507
+ function getNearestShadowComponent(vm) {
4499
4508
  let owner = vm;
4500
4509
 
4501
4510
  while (!isNull(owner)) {
4502
4511
  if (owner.renderMode === 1
4503
4512
  /* Shadow */
4504
- && owner.shadowMode === 0
4505
- /* Native */
4506
4513
  ) {
4507
4514
  return owner;
4508
4515
  }
@@ -4513,6 +4520,20 @@
4513
4520
  return owner;
4514
4521
  }
4515
4522
 
4523
+ function getNearestNativeShadowComponent(vm) {
4524
+ const owner = getNearestShadowComponent(vm);
4525
+
4526
+ if (!isNull(owner) && owner.shadowMode === 1
4527
+ /* Synthetic */
4528
+ ) {
4529
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
4530
+ // synthetic, we know we won't find a native component if we go any further.
4531
+ return null;
4532
+ }
4533
+
4534
+ return owner;
4535
+ }
4536
+
4516
4537
  function createStylesheet(vm, stylesheets) {
4517
4538
  const {
4518
4539
  renderer,
@@ -4586,7 +4607,7 @@
4586
4607
  if (isProfilerEnabled) {
4587
4608
  currentDispatcher(opId, 0
4588
4609
  /* Start */
4589
- , vm.tagName, vm.idx);
4610
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
4590
4611
  }
4591
4612
  }
4592
4613
 
@@ -4595,7 +4616,7 @@
4595
4616
  if (isProfilerEnabled) {
4596
4617
  currentDispatcher(opId, 1
4597
4618
  /* Stop */
4598
- , vm.tagName, vm.idx);
4619
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
4599
4620
  }
4600
4621
  }
4601
4622
 
@@ -4604,7 +4625,7 @@
4604
4625
  if (isProfilerEnabled) {
4605
4626
  currentDispatcher(opId, 0
4606
4627
  /* Start */
4607
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
4628
+ , 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);
4608
4629
  }
4609
4630
  }
4610
4631
 
@@ -4613,7 +4634,7 @@
4613
4634
  if (isProfilerEnabled) {
4614
4635
  currentDispatcher(opId, 1
4615
4636
  /* Stop */
4616
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
4637
+ , 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);
4617
4638
  }
4618
4639
  }
4619
4640
  /*
@@ -6051,7 +6072,7 @@
6051
6072
  hooksAreSet = true;
6052
6073
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6053
6074
  }
6054
- /* version: 2.5.10-alpha1 */
6075
+ /* version: 2.7.0 */
6055
6076
 
6056
6077
  /*
6057
6078
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6685,7 +6706,7 @@
6685
6706
  });
6686
6707
  freeze(LightningElement);
6687
6708
  seal(LightningElement.prototype);
6688
- /* version: 2.5.10-alpha1 */
6709
+ /* version: 2.7.0 */
6689
6710
 
6690
6711
  exports.LightningElement = LightningElement;
6691
6712
  exports.__unstable__ProfilerControl = profilerControl;
@@ -6716,4 +6737,4 @@
6716
6737
 
6717
6738
  Object.defineProperty(exports, '__esModule', { value: true });
6718
6739
 
6719
- })));
6740
+ }));