@lwc/engine-core 2.5.10 → 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.
@@ -1428,6 +1428,7 @@ const {
1428
1428
  isArray
1429
1429
  } = Array;
1430
1430
  const {
1431
+ prototype: ObjectDotPrototype,
1431
1432
  getPrototypeOf,
1432
1433
  create: ObjectCreate,
1433
1434
  defineProperty: ObjectDefineProperty,
@@ -2077,8 +2078,6 @@ if (process.env.NODE_ENV !== 'production') {
2077
2078
  init();
2078
2079
  }
2079
2080
 
2080
- const ObjectDotPrototype = Object.prototype;
2081
-
2082
2081
  function defaultValueIsObservable(value) {
2083
2082
  // intentionally checking for null
2084
2083
  if (value === null) {
@@ -2106,99 +2105,85 @@ const defaultValueMutated = (obj, key) => {
2106
2105
  /* do nothing */
2107
2106
  };
2108
2107
 
2109
- const defaultValueDistortion = value => value;
2110
-
2111
2108
  function createShadowTarget(value) {
2112
2109
  return isArray(value) ? [] : {};
2113
2110
  }
2114
2111
 
2115
- class ReactiveMembrane {
2116
- constructor(options) {
2117
- this.valueDistortion = defaultValueDistortion;
2118
- this.valueMutated = defaultValueMutated;
2119
- this.valueObserved = defaultValueObserved;
2120
- this.valueIsObservable = defaultValueIsObservable;
2112
+ class ObservableMembrane {
2113
+ constructor(options = {}) {
2121
2114
  this.readOnlyObjectGraph = new WeakMap();
2122
2115
  this.reactiveObjectGraph = new WeakMap();
2123
-
2124
- if (!isUndefined(options)) {
2125
- const {
2126
- valueDistortion,
2127
- valueMutated,
2128
- valueObserved,
2129
- valueIsObservable,
2130
- tagPropertyKey
2131
- } = options;
2132
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2133
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2134
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2135
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2136
- this.tagPropertyKey = tagPropertyKey;
2137
- }
2116
+ const {
2117
+ valueMutated,
2118
+ valueObserved,
2119
+ valueIsObservable,
2120
+ tagPropertyKey
2121
+ } = options;
2122
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2123
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2124
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2125
+ this.tagPropertyKey = tagPropertyKey;
2138
2126
  }
2139
2127
 
2140
2128
  getProxy(value) {
2141
2129
  const unwrappedValue = unwrap$1(value);
2142
- const distorted = this.valueDistortion(unwrappedValue);
2143
2130
 
2144
- if (this.valueIsObservable(distorted)) {
2145
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2146
- // when trying to extract the writable version of a readonly
2147
- // we return the readonly.
2131
+ if (this.valueIsObservable(unwrappedValue)) {
2132
+ // When trying to extract the writable version of a readonly we return the readonly.
2133
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2148
2134
  return value;
2149
2135
  }
2150
2136
 
2151
- return this.getReactiveHandler(unwrappedValue, distorted);
2137
+ return this.getReactiveHandler(unwrappedValue);
2152
2138
  }
2153
2139
 
2154
- return distorted;
2140
+ return unwrappedValue;
2155
2141
  }
2156
2142
 
2157
2143
  getReadOnlyProxy(value) {
2158
2144
  value = unwrap$1(value);
2159
- const distorted = this.valueDistortion(value);
2160
2145
 
2161
- if (this.valueIsObservable(distorted)) {
2162
- return this.getReadOnlyHandler(value, distorted);
2146
+ if (this.valueIsObservable(value)) {
2147
+ return this.getReadOnlyHandler(value);
2163
2148
  }
2164
2149
 
2165
- return distorted;
2150
+ return value;
2166
2151
  }
2167
2152
 
2168
2153
  unwrapProxy(p) {
2169
2154
  return unwrap$1(p);
2170
2155
  }
2171
2156
 
2172
- getReactiveHandler(value, distortedValue) {
2173
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2157
+ getReactiveHandler(value) {
2158
+ let proxy = this.reactiveObjectGraph.get(value);
2174
2159
 
2175
2160
  if (isUndefined(proxy)) {
2176
2161
  // caching the proxy after the first time it is accessed
2177
- const handler = new ReactiveProxyHandler(this, distortedValue);
2178
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2162
+ const handler = new ReactiveProxyHandler(this, value);
2163
+ proxy = new Proxy(createShadowTarget(value), handler);
2179
2164
  registerProxy(proxy, value);
2180
- this.reactiveObjectGraph.set(distortedValue, proxy);
2165
+ this.reactiveObjectGraph.set(value, proxy);
2181
2166
  }
2182
2167
 
2183
2168
  return proxy;
2184
2169
  }
2185
2170
 
2186
- getReadOnlyHandler(value, distortedValue) {
2187
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2171
+ getReadOnlyHandler(value) {
2172
+ let proxy = this.readOnlyObjectGraph.get(value);
2188
2173
 
2189
2174
  if (isUndefined(proxy)) {
2190
2175
  // caching the proxy after the first time it is accessed
2191
- const handler = new ReadOnlyHandler(this, distortedValue);
2192
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2176
+ const handler = new ReadOnlyHandler(this, value);
2177
+ proxy = new Proxy(createShadowTarget(value), handler);
2193
2178
  registerProxy(proxy, value);
2194
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2179
+ this.readOnlyObjectGraph.set(value, proxy);
2195
2180
  }
2196
2181
 
2197
2182
  return proxy;
2198
2183
  }
2199
2184
 
2200
2185
  }
2201
- /** version: 1.1.5 */
2186
+ /** version: 2.0.0 */
2202
2187
 
2203
2188
  /*
2204
2189
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2207,15 +2192,9 @@ class ReactiveMembrane {
2207
2192
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2208
2193
  */
2209
2194
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2210
-
2211
- function valueDistortion(value) {
2212
- return value;
2213
- }
2214
-
2215
- const reactiveMembrane = new ReactiveMembrane({
2195
+ const reactiveMembrane = new ObservableMembrane({
2216
2196
  valueObserved,
2217
2197
  valueMutated,
2218
- valueDistortion,
2219
2198
  tagPropertyKey: lockerLivePropertyKey
2220
2199
  });
2221
2200
  /**
@@ -2224,16 +2203,9 @@ const reactiveMembrane = new ReactiveMembrane({
2224
2203
  * change or being removed.
2225
2204
  */
2226
2205
 
2227
- const unwrap = function (value) {
2228
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2229
-
2230
- if (unwrapped !== value) {
2231
- // if value is a proxy, unwrap to access original value and apply distortion
2232
- return valueDistortion(unwrapped);
2233
- }
2234
-
2235
- return value;
2236
- };
2206
+ function unwrap(value) {
2207
+ return reactiveMembrane.unwrapProxy(value);
2208
+ }
2237
2209
 
2238
2210
  /*
2239
2211
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5416,6 +5388,7 @@ function updateStylesheetToken(vm, template) {
5416
5388
 
5417
5389
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5418
5390
  const content = [];
5391
+ let root;
5419
5392
 
5420
5393
  for (let i = 0; i < stylesheets.length; i++) {
5421
5394
  let stylesheet = stylesheets[i];
@@ -5428,23 +5401,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5428
5401
  // the component instance might be attempting to use an old version of
5429
5402
  // the stylesheet, while internally, we have a replacement for it.
5430
5403
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5431
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5432
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5404
+ }
5433
5405
 
5406
+ const isScopedCss = stylesheet[shared.KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5407
+
5408
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5409
+ /* Synthetic */
5410
+ && vm.renderMode === 1
5411
+ /* Shadow */
5412
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5413
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5434
5414
 
5435
- const isScopedCss = stylesheet[shared.KEY__SCOPED_CSS];
5436
5415
  const useActualHostSelector = vm.renderMode === 0
5437
5416
  /* Light */
5438
5417
  ? !isScopedCss : vm.shadowMode === 0
5439
5418
  /* Native */
5440
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5419
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5420
+ // we use an attribute selector on the host to simulate :dir().
5441
5421
 
5442
- const scopeToken = isScopedCss || vm.shadowMode === 1
5443
- /* Synthetic */
5444
- && vm.renderMode === 1
5422
+ let useNativeDirPseudoclass;
5423
+
5424
+ if (vm.renderMode === 1
5445
5425
  /* Shadow */
5446
- ? stylesheetToken : undefined;
5447
- shared.ArrayPush.call(content, stylesheet(useActualHostSelector, scopeToken));
5426
+ ) {
5427
+ useNativeDirPseudoclass = vm.shadowMode === 0
5428
+ /* Native */
5429
+ ;
5430
+ } else {
5431
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5432
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5433
+ if (shared.isUndefined(root)) {
5434
+ // Only calculate the root once as necessary
5435
+ root = getNearestShadowComponent(vm);
5436
+ }
5437
+
5438
+ useNativeDirPseudoclass = shared.isNull(root) || root.shadowMode === 0
5439
+ /* Native */
5440
+ ;
5441
+ }
5442
+
5443
+ shared.ArrayPush.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5448
5444
  }
5449
5445
  }
5450
5446
 
@@ -5467,14 +5463,12 @@ function getStylesheetsContent(vm, template) {
5467
5463
  // perf testing has not shown it to be a huge improvement yet:
5468
5464
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5469
5465
 
5470
- function getNearestNativeShadowComponent(vm) {
5466
+ function getNearestShadowComponent(vm) {
5471
5467
  let owner = vm;
5472
5468
 
5473
5469
  while (!shared.isNull(owner)) {
5474
5470
  if (owner.renderMode === 1
5475
5471
  /* Shadow */
5476
- && owner.shadowMode === 0
5477
- /* Native */
5478
5472
  ) {
5479
5473
  return owner;
5480
5474
  }
@@ -5485,6 +5479,20 @@ function getNearestNativeShadowComponent(vm) {
5485
5479
  return owner;
5486
5480
  }
5487
5481
 
5482
+ function getNearestNativeShadowComponent(vm) {
5483
+ const owner = getNearestShadowComponent(vm);
5484
+
5485
+ if (!shared.isNull(owner) && owner.shadowMode === 1
5486
+ /* Synthetic */
5487
+ ) {
5488
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5489
+ // synthetic, we know we won't find a native component if we go any further.
5490
+ return null;
5491
+ }
5492
+
5493
+ return owner;
5494
+ }
5495
+
5488
5496
  function createStylesheet(vm, stylesheets) {
5489
5497
  const {
5490
5498
  renderer,
@@ -7210,4 +7218,4 @@ exports.swapTemplate = swapTemplate;
7210
7218
  exports.track = track;
7211
7219
  exports.unwrap = unwrap;
7212
7220
  exports.wire = wire;
7213
- /* version: 2.5.10 */
7221
+ /* version: 2.6.1 */
@@ -1425,6 +1425,7 @@ const {
1425
1425
  isArray
1426
1426
  } = Array;
1427
1427
  const {
1428
+ prototype: ObjectDotPrototype,
1428
1429
  getPrototypeOf,
1429
1430
  create: ObjectCreate,
1430
1431
  defineProperty: ObjectDefineProperty,
@@ -2074,8 +2075,6 @@ if (process.env.NODE_ENV !== 'production') {
2074
2075
  init();
2075
2076
  }
2076
2077
 
2077
- const ObjectDotPrototype = Object.prototype;
2078
-
2079
2078
  function defaultValueIsObservable(value) {
2080
2079
  // intentionally checking for null
2081
2080
  if (value === null) {
@@ -2103,99 +2102,85 @@ const defaultValueMutated = (obj, key) => {
2103
2102
  /* do nothing */
2104
2103
  };
2105
2104
 
2106
- const defaultValueDistortion = value => value;
2107
-
2108
2105
  function createShadowTarget(value) {
2109
2106
  return isArray(value) ? [] : {};
2110
2107
  }
2111
2108
 
2112
- class ReactiveMembrane {
2113
- constructor(options) {
2114
- this.valueDistortion = defaultValueDistortion;
2115
- this.valueMutated = defaultValueMutated;
2116
- this.valueObserved = defaultValueObserved;
2117
- this.valueIsObservable = defaultValueIsObservable;
2109
+ class ObservableMembrane {
2110
+ constructor(options = {}) {
2118
2111
  this.readOnlyObjectGraph = new WeakMap();
2119
2112
  this.reactiveObjectGraph = new WeakMap();
2120
-
2121
- if (!isUndefined(options)) {
2122
- const {
2123
- valueDistortion,
2124
- valueMutated,
2125
- valueObserved,
2126
- valueIsObservable,
2127
- tagPropertyKey
2128
- } = options;
2129
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2130
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2131
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2132
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2133
- this.tagPropertyKey = tagPropertyKey;
2134
- }
2113
+ const {
2114
+ valueMutated,
2115
+ valueObserved,
2116
+ valueIsObservable,
2117
+ tagPropertyKey
2118
+ } = options;
2119
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2120
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2121
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2122
+ this.tagPropertyKey = tagPropertyKey;
2135
2123
  }
2136
2124
 
2137
2125
  getProxy(value) {
2138
2126
  const unwrappedValue = unwrap$1(value);
2139
- const distorted = this.valueDistortion(unwrappedValue);
2140
2127
 
2141
- if (this.valueIsObservable(distorted)) {
2142
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2143
- // when trying to extract the writable version of a readonly
2144
- // we return the readonly.
2128
+ if (this.valueIsObservable(unwrappedValue)) {
2129
+ // When trying to extract the writable version of a readonly we return the readonly.
2130
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2145
2131
  return value;
2146
2132
  }
2147
2133
 
2148
- return this.getReactiveHandler(unwrappedValue, distorted);
2134
+ return this.getReactiveHandler(unwrappedValue);
2149
2135
  }
2150
2136
 
2151
- return distorted;
2137
+ return unwrappedValue;
2152
2138
  }
2153
2139
 
2154
2140
  getReadOnlyProxy(value) {
2155
2141
  value = unwrap$1(value);
2156
- const distorted = this.valueDistortion(value);
2157
2142
 
2158
- if (this.valueIsObservable(distorted)) {
2159
- return this.getReadOnlyHandler(value, distorted);
2143
+ if (this.valueIsObservable(value)) {
2144
+ return this.getReadOnlyHandler(value);
2160
2145
  }
2161
2146
 
2162
- return distorted;
2147
+ return value;
2163
2148
  }
2164
2149
 
2165
2150
  unwrapProxy(p) {
2166
2151
  return unwrap$1(p);
2167
2152
  }
2168
2153
 
2169
- getReactiveHandler(value, distortedValue) {
2170
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2154
+ getReactiveHandler(value) {
2155
+ let proxy = this.reactiveObjectGraph.get(value);
2171
2156
 
2172
2157
  if (isUndefined(proxy)) {
2173
2158
  // caching the proxy after the first time it is accessed
2174
- const handler = new ReactiveProxyHandler(this, distortedValue);
2175
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2159
+ const handler = new ReactiveProxyHandler(this, value);
2160
+ proxy = new Proxy(createShadowTarget(value), handler);
2176
2161
  registerProxy(proxy, value);
2177
- this.reactiveObjectGraph.set(distortedValue, proxy);
2162
+ this.reactiveObjectGraph.set(value, proxy);
2178
2163
  }
2179
2164
 
2180
2165
  return proxy;
2181
2166
  }
2182
2167
 
2183
- getReadOnlyHandler(value, distortedValue) {
2184
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2168
+ getReadOnlyHandler(value) {
2169
+ let proxy = this.readOnlyObjectGraph.get(value);
2185
2170
 
2186
2171
  if (isUndefined(proxy)) {
2187
2172
  // caching the proxy after the first time it is accessed
2188
- const handler = new ReadOnlyHandler(this, distortedValue);
2189
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2173
+ const handler = new ReadOnlyHandler(this, value);
2174
+ proxy = new Proxy(createShadowTarget(value), handler);
2190
2175
  registerProxy(proxy, value);
2191
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2176
+ this.readOnlyObjectGraph.set(value, proxy);
2192
2177
  }
2193
2178
 
2194
2179
  return proxy;
2195
2180
  }
2196
2181
 
2197
2182
  }
2198
- /** version: 1.1.5 */
2183
+ /** version: 2.0.0 */
2199
2184
 
2200
2185
  /*
2201
2186
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2204,15 +2189,9 @@ class ReactiveMembrane {
2204
2189
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2205
2190
  */
2206
2191
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2207
-
2208
- function valueDistortion(value) {
2209
- return value;
2210
- }
2211
-
2212
- const reactiveMembrane = new ReactiveMembrane({
2192
+ const reactiveMembrane = new ObservableMembrane({
2213
2193
  valueObserved,
2214
2194
  valueMutated,
2215
- valueDistortion,
2216
2195
  tagPropertyKey: lockerLivePropertyKey
2217
2196
  });
2218
2197
  /**
@@ -2221,16 +2200,9 @@ const reactiveMembrane = new ReactiveMembrane({
2221
2200
  * change or being removed.
2222
2201
  */
2223
2202
 
2224
- const unwrap = function (value) {
2225
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2226
-
2227
- if (unwrapped !== value) {
2228
- // if value is a proxy, unwrap to access original value and apply distortion
2229
- return valueDistortion(unwrapped);
2230
- }
2231
-
2232
- return value;
2233
- };
2203
+ function unwrap(value) {
2204
+ return reactiveMembrane.unwrapProxy(value);
2205
+ }
2234
2206
 
2235
2207
  /*
2236
2208
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5413,6 +5385,7 @@ function updateStylesheetToken(vm, template) {
5413
5385
 
5414
5386
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5415
5387
  const content = [];
5388
+ let root;
5416
5389
 
5417
5390
  for (let i = 0; i < stylesheets.length; i++) {
5418
5391
  let stylesheet = stylesheets[i];
@@ -5425,23 +5398,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5425
5398
  // the component instance might be attempting to use an old version of
5426
5399
  // the stylesheet, while internally, we have a replacement for it.
5427
5400
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5428
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5429
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5401
+ }
5430
5402
 
5403
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5404
+
5405
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5406
+ /* Synthetic */
5407
+ && vm.renderMode === 1
5408
+ /* Shadow */
5409
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5410
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5431
5411
 
5432
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5433
5412
  const useActualHostSelector = vm.renderMode === 0
5434
5413
  /* Light */
5435
5414
  ? !isScopedCss : vm.shadowMode === 0
5436
5415
  /* Native */
5437
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5416
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5417
+ // we use an attribute selector on the host to simulate :dir().
5438
5418
 
5439
- const scopeToken = isScopedCss || vm.shadowMode === 1
5440
- /* Synthetic */
5441
- && vm.renderMode === 1
5419
+ let useNativeDirPseudoclass;
5420
+
5421
+ if (vm.renderMode === 1
5442
5422
  /* Shadow */
5443
- ? stylesheetToken : undefined;
5444
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5423
+ ) {
5424
+ useNativeDirPseudoclass = vm.shadowMode === 0
5425
+ /* Native */
5426
+ ;
5427
+ } else {
5428
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5429
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5430
+ if (isUndefined$1(root)) {
5431
+ // Only calculate the root once as necessary
5432
+ root = getNearestShadowComponent(vm);
5433
+ }
5434
+
5435
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5436
+ /* Native */
5437
+ ;
5438
+ }
5439
+
5440
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5445
5441
  }
5446
5442
  }
5447
5443
 
@@ -5464,14 +5460,12 @@ function getStylesheetsContent(vm, template) {
5464
5460
  // perf testing has not shown it to be a huge improvement yet:
5465
5461
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5466
5462
 
5467
- function getNearestNativeShadowComponent(vm) {
5463
+ function getNearestShadowComponent(vm) {
5468
5464
  let owner = vm;
5469
5465
 
5470
5466
  while (!isNull(owner)) {
5471
5467
  if (owner.renderMode === 1
5472
5468
  /* Shadow */
5473
- && owner.shadowMode === 0
5474
- /* Native */
5475
5469
  ) {
5476
5470
  return owner;
5477
5471
  }
@@ -5482,6 +5476,20 @@ function getNearestNativeShadowComponent(vm) {
5482
5476
  return owner;
5483
5477
  }
5484
5478
 
5479
+ function getNearestNativeShadowComponent(vm) {
5480
+ const owner = getNearestShadowComponent(vm);
5481
+
5482
+ if (!isNull(owner) && owner.shadowMode === 1
5483
+ /* Synthetic */
5484
+ ) {
5485
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5486
+ // synthetic, we know we won't find a native component if we go any further.
5487
+ return null;
5488
+ }
5489
+
5490
+ return owner;
5491
+ }
5492
+
5485
5493
  function createStylesheet(vm, stylesheets) {
5486
5494
  const {
5487
5495
  renderer,
@@ -7174,4 +7182,4 @@ function setHooks(hooks) {
7174
7182
  }
7175
7183
 
7176
7184
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7177
- /* version: 2.5.10 */
7185
+ /* version: 2.6.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.5.10",
3
+ "version": "2.6.1",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,14 +24,14 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.5.10",
28
- "@lwc/shared": "2.5.10"
27
+ "@lwc/features": "2.6.1",
28
+ "@lwc/shared": "2.6.1"
29
29
  },
30
30
  "devDependencies": {
31
- "observable-membrane": "1.1.5"
31
+ "observable-membrane": "2.0.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "44a0ea56fa42bf411aa91514e958f386e3a1d191"
36
+ "gitHead": "65ae5d96106495314904cade2522cceef2067229"
37
37
  }
@@ -1,4 +1,4 @@
1
- import ObservableMembrane from 'observable-membrane';
1
+ import { ObservableMembrane } from 'observable-membrane';
2
2
  export declare const lockerLivePropertyKey: unique symbol;
3
3
  export declare const reactiveMembrane: ObservableMembrane;
4
4
  /**
@@ -6,4 +6,4 @@ export declare const reactiveMembrane: ObservableMembrane;
6
6
  * works for observable membrane objects. This API is subject to
7
7
  * change or being removed.
8
8
  */
9
- export declare const unwrap: (value: any) => any;
9
+ export declare function unwrap(value: any): any;
@@ -5,7 +5,7 @@ import { Template } from './template';
5
5
  * Function producing style based on a host and a shadow selector. This function is invoked by
6
6
  * the engine with different values depending on the mode that the component is running on.
7
7
  */
8
- export declare type StylesheetFactory = (useActualHostSelector: boolean, stylesheetToken: string | undefined) => string;
8
+ export declare type StylesheetFactory = (stylesheetToken: string | undefined, useActualHostSelector: boolean, useNativeDirPseudoclass: boolean) => string;
9
9
  /**
10
10
  * The list of stylesheets associated with a template. Each entry is either a StylesheetFactory or a
11
11
  * TemplateStylesheetFactory a given stylesheet depends on other external stylesheets (via the