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,
@@ -142,7 +142,7 @@
142
142
  // Array.prototype.toString directly will cause an error Iterate through
143
143
  // all the items and handle individually.
144
144
  if (isArray$1(obj)) {
145
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
145
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
146
146
  }
147
147
 
148
148
  return obj.toString();
@@ -305,7 +305,7 @@
305
305
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
306
306
  return attributeName;
307
307
  }
308
- /** version: 2.5.8 */
308
+ /** version: 2.5.9 */
309
309
 
310
310
  /*
311
311
  * Copyright (c) 2018, salesforce.com, inc.
@@ -485,7 +485,7 @@
485
485
  setFeatureFlag(name, value);
486
486
  }
487
487
  }
488
- /** version: 2.5.8 */
488
+ /** version: 2.5.9 */
489
489
 
490
490
  /* proxy-compat-disable */
491
491
 
@@ -1935,7 +1935,6 @@
1935
1935
  getPrototypeOf,
1936
1936
  create: ObjectCreate,
1937
1937
  defineProperty: ObjectDefineProperty,
1938
- defineProperties: ObjectDefineProperties,
1939
1938
  isExtensible,
1940
1939
  getOwnPropertyDescriptor,
1941
1940
  getOwnPropertyNames,
@@ -1945,8 +1944,7 @@
1945
1944
  } = Object;
1946
1945
  const {
1947
1946
  push: ArrayPush,
1948
- concat: ArrayConcat,
1949
- map: ArrayMap
1947
+ concat: ArrayConcat
1950
1948
  } = Array.prototype;
1951
1949
  const OtS = {}.toString;
1952
1950
 
@@ -2011,7 +2009,9 @@
2011
2009
  // but it will always be compatible with the previous descriptor
2012
2010
  // to preserve the object invariants, which makes these lines safe.
2013
2011
 
2014
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
2012
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
2013
+
2014
+ /* istanbul ignore else */
2015
2015
 
2016
2016
  if (!isUndefined(originalDescriptor)) {
2017
2017
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2039,11 +2039,17 @@
2039
2039
 
2040
2040
  preventExtensions(shadowTarget);
2041
2041
  } // Shared Traps
2042
+ // TODO: apply() is never called
2043
+
2044
+ /* istanbul ignore next */
2042
2045
 
2043
2046
 
2044
2047
  apply(shadowTarget, thisArg, argArray) {
2045
2048
  /* No op */
2046
- }
2049
+ } // TODO: construct() is never called
2050
+
2051
+ /* istanbul ignore next */
2052
+
2047
2053
 
2048
2054
  construct(shadowTarget, argArray, newTarget) {
2049
2055
  /* No op */
@@ -2156,8 +2162,8 @@
2156
2162
 
2157
2163
  }
2158
2164
 
2159
- const getterMap = new WeakMap();
2160
- const setterMap = new WeakMap();
2165
+ const getterMap$1 = new WeakMap();
2166
+ const setterMap$1 = new WeakMap();
2161
2167
  const reverseGetterMap = new WeakMap();
2162
2168
  const reverseSetterMap = new WeakMap();
2163
2169
 
@@ -2167,7 +2173,7 @@
2167
2173
  }
2168
2174
 
2169
2175
  wrapGetter(originalGet) {
2170
- const wrappedGetter = getterMap.get(originalGet);
2176
+ const wrappedGetter = getterMap$1.get(originalGet);
2171
2177
 
2172
2178
  if (!isUndefined(wrappedGetter)) {
2173
2179
  return wrappedGetter;
@@ -2180,13 +2186,13 @@
2180
2186
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2181
2187
  };
2182
2188
 
2183
- getterMap.set(originalGet, get);
2189
+ getterMap$1.set(originalGet, get);
2184
2190
  reverseGetterMap.set(get, originalGet);
2185
2191
  return get;
2186
2192
  }
2187
2193
 
2188
2194
  wrapSetter(originalSet) {
2189
- const wrappedSetter = setterMap.get(originalSet);
2195
+ const wrappedSetter = setterMap$1.get(originalSet);
2190
2196
 
2191
2197
  if (!isUndefined(wrappedSetter)) {
2192
2198
  return wrappedSetter;
@@ -2197,7 +2203,7 @@
2197
2203
  originalSet.call(unwrap$1(this), unwrap$1(v));
2198
2204
  };
2199
2205
 
2200
- setterMap.set(originalSet, set);
2206
+ setterMap$1.set(originalSet, set);
2201
2207
  reverseSetterMap.set(set, originalSet);
2202
2208
  return set;
2203
2209
  }
@@ -2238,7 +2244,7 @@
2238
2244
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2239
2245
  };
2240
2246
 
2241
- getterMap.set(get, redGet);
2247
+ getterMap$1.set(get, redGet);
2242
2248
  reverseGetterMap.set(redGet, get);
2243
2249
  return get;
2244
2250
  }
@@ -2257,7 +2263,7 @@
2257
2263
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2258
2264
  };
2259
2265
 
2260
- setterMap.set(set, redSet);
2266
+ setterMap$1.set(set, redSet);
2261
2267
  reverseSetterMap.set(redSet, set);
2262
2268
  return set;
2263
2269
  }
@@ -2298,6 +2304,7 @@
2298
2304
  }
2299
2305
 
2300
2306
  setPrototypeOf(shadowTarget, prototype) {
2307
+ /* istanbul ignore else */
2301
2308
  if (process.env.NODE_ENV !== 'production') {
2302
2309
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2303
2310
  }
@@ -2311,6 +2318,11 @@
2311
2318
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2312
2319
  // the preventExtension call, in which case we should not attempt to lock down
2313
2320
  // the shadow target.
2321
+ // TODO: It should not actually be possible to reach this `if` statement.
2322
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2323
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2324
+
2325
+ /* istanbul ignore if */
2314
2326
 
2315
2327
  if (isExtensible(originalTarget)) {
2316
2328
  return false;
@@ -2352,8 +2364,8 @@
2352
2364
 
2353
2365
  }
2354
2366
 
2355
- const getterMap$1 = new WeakMap();
2356
- const setterMap$1 = new WeakMap();
2367
+ const getterMap = new WeakMap();
2368
+ const setterMap = new WeakMap();
2357
2369
 
2358
2370
  class ReadOnlyHandler extends BaseProxyHandler {
2359
2371
  wrapValue(value) {
@@ -2361,7 +2373,7 @@
2361
2373
  }
2362
2374
 
2363
2375
  wrapGetter(originalGet) {
2364
- const wrappedGetter = getterMap$1.get(originalGet);
2376
+ const wrappedGetter = getterMap.get(originalGet);
2365
2377
 
2366
2378
  if (!isUndefined(wrappedGetter)) {
2367
2379
  return wrappedGetter;
@@ -2374,12 +2386,12 @@
2374
2386
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2375
2387
  };
2376
2388
 
2377
- getterMap$1.set(originalGet, get);
2389
+ getterMap.set(originalGet, get);
2378
2390
  return get;
2379
2391
  }
2380
2392
 
2381
2393
  wrapSetter(originalSet) {
2382
- const wrappedSetter = setterMap$1.get(originalSet);
2394
+ const wrappedSetter = setterMap.get(originalSet);
2383
2395
 
2384
2396
  if (!isUndefined(wrappedSetter)) {
2385
2397
  return wrappedSetter;
@@ -2388,6 +2400,7 @@
2388
2400
  const handler = this;
2389
2401
 
2390
2402
  const set = function (v) {
2403
+ /* istanbul ignore else */
2391
2404
  if (process.env.NODE_ENV !== 'production') {
2392
2405
  const {
2393
2406
  originalTarget
@@ -2396,33 +2409,41 @@
2396
2409
  }
2397
2410
  };
2398
2411
 
2399
- setterMap$1.set(originalSet, set);
2412
+ setterMap.set(originalSet, set);
2400
2413
  return set;
2401
2414
  }
2402
2415
 
2403
2416
  set(shadowTarget, key, value) {
2417
+ /* istanbul ignore else */
2404
2418
  if (process.env.NODE_ENV !== 'production') {
2405
2419
  const {
2406
2420
  originalTarget
2407
2421
  } = this;
2408
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2422
+ const msg = isArray(originalTarget) ? `Invalid mutation: Cannot mutate array at index ${key.toString()}. Array is read-only.` : `Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`;
2423
+ throw new Error(msg);
2409
2424
  }
2425
+ /* istanbul ignore next */
2426
+
2410
2427
 
2411
2428
  return false;
2412
2429
  }
2413
2430
 
2414
2431
  deleteProperty(shadowTarget, key) {
2432
+ /* istanbul ignore else */
2415
2433
  if (process.env.NODE_ENV !== 'production') {
2416
2434
  const {
2417
2435
  originalTarget
2418
2436
  } = this;
2419
2437
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2420
2438
  }
2439
+ /* istanbul ignore next */
2440
+
2421
2441
 
2422
2442
  return false;
2423
2443
  }
2424
2444
 
2425
2445
  setPrototypeOf(shadowTarget, prototype) {
2446
+ /* istanbul ignore else */
2426
2447
  if (process.env.NODE_ENV !== 'production') {
2427
2448
  const {
2428
2449
  originalTarget
@@ -2432,23 +2453,29 @@
2432
2453
  }
2433
2454
 
2434
2455
  preventExtensions(shadowTarget) {
2456
+ /* istanbul ignore else */
2435
2457
  if (process.env.NODE_ENV !== 'production') {
2436
2458
  const {
2437
2459
  originalTarget
2438
2460
  } = this;
2439
2461
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2440
2462
  }
2463
+ /* istanbul ignore next */
2464
+
2441
2465
 
2442
2466
  return false;
2443
2467
  }
2444
2468
 
2445
2469
  defineProperty(shadowTarget, key, descriptor) {
2470
+ /* istanbul ignore else */
2446
2471
  if (process.env.NODE_ENV !== 'production') {
2447
2472
  const {
2448
2473
  originalTarget
2449
2474
  } = this;
2450
2475
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2451
2476
  }
2477
+ /* istanbul ignore next */
2478
+
2452
2479
 
2453
2480
  return false;
2454
2481
  }
@@ -2506,6 +2533,8 @@
2506
2533
  }; // Inspired from paulmillr/es6-shim
2507
2534
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2508
2535
 
2536
+ /* istanbul ignore next */
2537
+
2509
2538
  function getGlobal() {
2510
2539
  // the only reliable means to get the global object is `Function('return this')()`
2511
2540
  // However, this causes CSP violations in Chrome apps.
@@ -2530,6 +2559,7 @@
2530
2559
  }
2531
2560
 
2532
2561
  function init() {
2562
+ /* istanbul ignore if */
2533
2563
  if (process.env.NODE_ENV === 'production') {
2534
2564
  // this method should never leak to prod
2535
2565
  throw new ReferenceError();
@@ -2544,6 +2574,8 @@
2544
2574
  ArrayPush.call(devtoolsFormatters, formatter);
2545
2575
  global.devtoolsFormatters = devtoolsFormatters;
2546
2576
  }
2577
+ /* istanbul ignore else */
2578
+
2547
2579
 
2548
2580
  if (process.env.NODE_ENV !== 'production') {
2549
2581
  init();
@@ -2590,7 +2622,8 @@
2590
2622
  this.valueMutated = defaultValueMutated;
2591
2623
  this.valueObserved = defaultValueObserved;
2592
2624
  this.valueIsObservable = defaultValueIsObservable;
2593
- this.objectGraph = new WeakMap();
2625
+ this.readOnlyObjectGraph = new WeakMap();
2626
+ this.reactiveObjectGraph = new WeakMap();
2594
2627
 
2595
2628
  if (!isUndefined(options)) {
2596
2629
  const {
@@ -2613,10 +2646,13 @@
2613
2646
  const distorted = this.valueDistortion(unwrappedValue);
2614
2647
 
2615
2648
  if (this.valueIsObservable(distorted)) {
2616
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2617
- // we return the readonly.
2649
+ if (this.readOnlyObjectGraph.get(distorted) === value) {
2650
+ // when trying to extract the writable version of a readonly
2651
+ // we return the readonly.
2652
+ return value;
2653
+ }
2618
2654
 
2619
- return o.readOnly === value ? value : o.reactive;
2655
+ return this.getReactiveHandler(unwrappedValue, distorted);
2620
2656
  }
2621
2657
 
2622
2658
  return distorted;
@@ -2627,7 +2663,7 @@
2627
2663
  const distorted = this.valueDistortion(value);
2628
2664
 
2629
2665
  if (this.valueIsObservable(distorted)) {
2630
- return this.getReactiveState(value, distorted).readOnly;
2666
+ return this.getReadOnlyHandler(value, distorted);
2631
2667
  }
2632
2668
 
2633
2669
  return distorted;
@@ -2637,47 +2673,36 @@
2637
2673
  return unwrap$1(p);
2638
2674
  }
2639
2675
 
2640
- getReactiveState(value, distortedValue) {
2641
- const {
2642
- objectGraph
2643
- } = this;
2644
- let reactiveState = objectGraph.get(distortedValue);
2676
+ getReactiveHandler(value, distortedValue) {
2677
+ let proxy = this.reactiveObjectGraph.get(distortedValue);
2645
2678
 
2646
- if (reactiveState) {
2647
- return reactiveState;
2679
+ if (isUndefined(proxy)) {
2680
+ // caching the proxy after the first time it is accessed
2681
+ const handler = new ReactiveProxyHandler(this, distortedValue);
2682
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2683
+ registerProxy(proxy, value);
2684
+ this.reactiveObjectGraph.set(distortedValue, proxy);
2648
2685
  }
2649
2686
 
2650
- const membrane = this;
2651
- reactiveState = {
2652
- get reactive() {
2653
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2654
-
2655
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2656
- registerProxy(proxy, value);
2657
- ObjectDefineProperty(this, 'reactive', {
2658
- value: proxy
2659
- });
2660
- return proxy;
2661
- },
2687
+ return proxy;
2688
+ }
2662
2689
 
2663
- get readOnly() {
2664
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2690
+ getReadOnlyHandler(value, distortedValue) {
2691
+ let proxy = this.readOnlyObjectGraph.get(distortedValue);
2665
2692
 
2666
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2667
- registerProxy(proxy, value);
2668
- ObjectDefineProperty(this, 'readOnly', {
2669
- value: proxy
2670
- });
2671
- return proxy;
2672
- }
2693
+ if (isUndefined(proxy)) {
2694
+ // caching the proxy after the first time it is accessed
2695
+ const handler = new ReadOnlyHandler(this, distortedValue);
2696
+ proxy = new Proxy(createShadowTarget(distortedValue), handler);
2697
+ registerProxy(proxy, value);
2698
+ this.readOnlyObjectGraph.set(distortedValue, proxy);
2699
+ }
2673
2700
 
2674
- };
2675
- objectGraph.set(distortedValue, reactiveState);
2676
- return reactiveState;
2701
+ return proxy;
2677
2702
  }
2678
2703
 
2679
2704
  }
2680
- /** version: 1.0.0 */
2705
+ /** version: 1.1.5 */
2681
2706
 
2682
2707
  /*
2683
2708
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4829,7 +4854,7 @@
4829
4854
  for (const [attrName, attrValue] of Object.entries(attrs)) {
4830
4855
  const elmAttrValue = renderer.getAttribute(elm, attrName);
4831
4856
 
4832
- if (attrValue !== elmAttrValue) {
4857
+ if (String(attrValue) !== elmAttrValue) {
4833
4858
  logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
4834
4859
  nodesAreCompatible = false;
4835
4860
  }
@@ -4851,7 +4876,7 @@
4851
4876
  let nodesAreCompatible = true;
4852
4877
  let vnodeClassName;
4853
4878
 
4854
- if (!isUndefined$1(className) && className !== elm.className) {
4879
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4855
4880
  // className is used when class is bound to an expr.
4856
4881
  nodesAreCompatible = false;
4857
4882
  vnodeClassName = className;
@@ -5652,7 +5677,7 @@
5652
5677
 
5653
5678
 
5654
5679
  function d(value) {
5655
- return value == null ? '' : value;
5680
+ return value == null ? '' : String(value);
5656
5681
  } // [b]ind function
5657
5682
 
5658
5683
 
@@ -5943,6 +5968,7 @@
5943
5968
 
5944
5969
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5945
5970
  const content = [];
5971
+ let root;
5946
5972
 
5947
5973
  for (let i = 0; i < stylesheets.length; i++) {
5948
5974
  let stylesheet = stylesheets[i];
@@ -5955,23 +5981,46 @@
5955
5981
  // the component instance might be attempting to use an old version of
5956
5982
  // the stylesheet, while internally, we have a replacement for it.
5957
5983
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5958
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5959
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5984
+ }
5960
5985
 
5986
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5987
+
5988
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5989
+ /* Synthetic */
5990
+ && vm.renderMode === 1
5991
+ /* Shadow */
5992
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5993
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5961
5994
 
5962
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5963
5995
  const useActualHostSelector = vm.renderMode === 0
5964
5996
  /* Light */
5965
5997
  ? !isScopedCss : vm.shadowMode === 0
5966
5998
  /* Native */
5967
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5999
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
6000
+ // we use an attribute selector on the host to simulate :dir().
5968
6001
 
5969
- const scopeToken = isScopedCss || vm.shadowMode === 1
5970
- /* Synthetic */
5971
- && vm.renderMode === 1
6002
+ let useNativeDirPseudoclass;
6003
+
6004
+ if (vm.renderMode === 1
5972
6005
  /* Shadow */
5973
- ? stylesheetToken : undefined;
5974
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
6006
+ ) {
6007
+ useNativeDirPseudoclass = vm.shadowMode === 0
6008
+ /* Native */
6009
+ ;
6010
+ } else {
6011
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
6012
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
6013
+ if (isUndefined$1(root)) {
6014
+ // Only calculate the root once as necessary
6015
+ root = getNearestShadowComponent(vm);
6016
+ }
6017
+
6018
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
6019
+ /* Native */
6020
+ ;
6021
+ }
6022
+
6023
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5975
6024
  }
5976
6025
  }
5977
6026
 
@@ -5995,14 +6044,12 @@
5995
6044
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5996
6045
 
5997
6046
 
5998
- function getNearestNativeShadowComponent(vm) {
6047
+ function getNearestShadowComponent(vm) {
5999
6048
  let owner = vm;
6000
6049
 
6001
6050
  while (!isNull(owner)) {
6002
6051
  if (owner.renderMode === 1
6003
6052
  /* Shadow */
6004
- && owner.shadowMode === 0
6005
- /* Native */
6006
6053
  ) {
6007
6054
  return owner;
6008
6055
  }
@@ -6013,6 +6060,20 @@
6013
6060
  return owner;
6014
6061
  }
6015
6062
 
6063
+ function getNearestNativeShadowComponent(vm) {
6064
+ const owner = getNearestShadowComponent(vm);
6065
+
6066
+ if (!isNull(owner) && owner.shadowMode === 1
6067
+ /* Synthetic */
6068
+ ) {
6069
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6070
+ // synthetic, we know we won't find a native component if we go any further.
6071
+ return null;
6072
+ }
6073
+
6074
+ return owner;
6075
+ }
6076
+
6016
6077
  function createStylesheet(vm, stylesheets) {
6017
6078
  const {
6018
6079
  renderer,
@@ -6028,7 +6089,7 @@
6028
6089
  for (let i = 0; i < stylesheets.length; i++) {
6029
6090
  renderer.insertGlobalStylesheet(stylesheets[i]);
6030
6091
  }
6031
- } else if (renderer.ssr || renderer.isHydrating) {
6092
+ } else if (renderer.ssr || renderer.isHydrating()) {
6032
6093
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
6033
6094
  // This works in the client, because the stylesheets are created, and cached in the VM
6034
6095
  // the first time the VM renders.
@@ -7753,7 +7814,7 @@
7753
7814
  hooksAreSet = true;
7754
7815
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7755
7816
  }
7756
- /* version: 2.5.8 */
7817
+ /* version: 2.5.9 */
7757
7818
 
7758
7819
  /*
7759
7820
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7906,7 +7967,7 @@
7906
7967
  const renderer = {
7907
7968
  ssr: false,
7908
7969
 
7909
- get isHydrating() {
7970
+ isHydrating() {
7910
7971
  return isHydrating;
7911
7972
  },
7912
7973
 
@@ -8409,7 +8470,7 @@
8409
8470
  });
8410
8471
  freeze(LightningElement);
8411
8472
  seal(LightningElement.prototype);
8412
- /* version: 2.5.8 */
8473
+ /* version: 2.5.9 */
8413
8474
 
8414
8475
  exports.LightningElement = LightningElement;
8415
8476
  exports.__unstable__ProfilerControl = profilerControl;