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
@@ -69,7 +69,7 @@ const {
69
69
  find: ArrayFind,
70
70
  indexOf: ArrayIndexOf,
71
71
  join: ArrayJoin,
72
- map: ArrayMap$1,
72
+ map: ArrayMap,
73
73
  push: ArrayPush$1,
74
74
  reduce: ArrayReduce,
75
75
  reverse: ArrayReverse,
@@ -136,7 +136,7 @@ function toString$1(obj) {
136
136
  // Array.prototype.toString directly will cause an error Iterate through
137
137
  // all the items and handle individually.
138
138
  if (isArray$1(obj)) {
139
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
139
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
140
140
  }
141
141
 
142
142
  return obj.toString();
@@ -335,7 +335,7 @@ function htmlPropertyToAttribute(propName) {
335
335
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
336
336
  return attributeName;
337
337
  }
338
- /** version: 2.5.10-alpha1 */
338
+ /** version: 2.7.0 */
339
339
 
340
340
  /*
341
341
  * Copyright (c) 2020, salesforce.com, inc.
@@ -348,25 +348,28 @@ function htmlPropertyToAttribute(propName) {
348
348
  * The following constructor might be used in either the constructor or the connectedCallback. In
349
349
  * order to ensure that the component evaluates, we attach those mock constructors to the global
350
350
  * object.
351
+ * Also note that Event is defined in Node 16+, but CustomEvent is not, so they have to be
352
+ * polyfilled separately.
351
353
  */
352
354
 
353
355
 
354
- if (typeof Event !== 'function' && typeof CustomEvent !== 'function') {
356
+ if (typeof Event !== 'function') {
355
357
  class Event {}
356
358
 
359
+ defineProperty(_globalThis, 'Event', {
360
+ value: Event,
361
+ configurable: true,
362
+ writable: true
363
+ });
364
+ }
365
+
366
+ if (typeof CustomEvent !== 'function') {
357
367
  class CustomEvent extends Event {}
358
368
 
359
- defineProperties(_globalThis, {
360
- Event: {
361
- value: Event,
362
- configurable: true,
363
- writable: true
364
- },
365
- CustomEvent: {
366
- value: CustomEvent,
367
- configurable: true,
368
- writable: true
369
- }
369
+ defineProperty(_globalThis, 'CustomEvent', {
370
+ value: CustomEvent,
371
+ configurable: true,
372
+ writable: true
370
373
  });
371
374
  }
372
375
  /**
@@ -390,7 +393,6 @@ const features = {
390
393
  ENABLE_NODE_LIST_PATCH: null,
391
394
  ENABLE_HTML_COLLECTIONS_PATCH: null,
392
395
  ENABLE_NODE_PATCH: null,
393
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
394
396
  ENABLE_MIXED_SHADOW_MODE: null,
395
397
  ENABLE_WIRE_SYNC_EMIT: null
396
398
  };
@@ -456,7 +458,7 @@ function setFeatureFlagForTest(name, value) {
456
458
  setFeatureFlag(name, value);
457
459
  }
458
460
  }
459
- /** version: 2.5.10-alpha1 */
461
+ /** version: 2.7.0 */
460
462
 
461
463
  /* proxy-compat-disable */
462
464
 
@@ -1903,10 +1905,10 @@ const {
1903
1905
  isArray
1904
1906
  } = Array;
1905
1907
  const {
1908
+ prototype: ObjectDotPrototype,
1906
1909
  getPrototypeOf,
1907
1910
  create: ObjectCreate,
1908
1911
  defineProperty: ObjectDefineProperty,
1909
- defineProperties: ObjectDefineProperties,
1910
1912
  isExtensible,
1911
1913
  getOwnPropertyDescriptor,
1912
1914
  getOwnPropertyNames,
@@ -1916,8 +1918,7 @@ const {
1916
1918
  } = Object;
1917
1919
  const {
1918
1920
  push: ArrayPush,
1919
- concat: ArrayConcat,
1920
- map: ArrayMap
1921
+ concat: ArrayConcat
1921
1922
  } = Array.prototype;
1922
1923
  const OtS = {}.toString;
1923
1924
 
@@ -1982,7 +1983,9 @@ class BaseProxyHandler {
1982
1983
  // but it will always be compatible with the previous descriptor
1983
1984
  // to preserve the object invariants, which makes these lines safe.
1984
1985
 
1985
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1986
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1987
+
1988
+ /* istanbul ignore else */
1986
1989
 
1987
1990
  if (!isUndefined(originalDescriptor)) {
1988
1991
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2010,11 +2013,17 @@ class BaseProxyHandler {
2010
2013
 
2011
2014
  preventExtensions(shadowTarget);
2012
2015
  } // Shared Traps
2016
+ // TODO: apply() is never called
2017
+
2018
+ /* istanbul ignore next */
2013
2019
 
2014
2020
 
2015
2021
  apply(shadowTarget, thisArg, argArray) {
2016
2022
  /* No op */
2017
- }
2023
+ } // TODO: construct() is never called
2024
+
2025
+ /* istanbul ignore next */
2026
+
2018
2027
 
2019
2028
  construct(shadowTarget, argArray, newTarget) {
2020
2029
  /* No op */
@@ -2127,8 +2136,8 @@ class BaseProxyHandler {
2127
2136
 
2128
2137
  }
2129
2138
 
2130
- const getterMap = new WeakMap();
2131
- const setterMap = new WeakMap();
2139
+ const getterMap$1 = new WeakMap();
2140
+ const setterMap$1 = new WeakMap();
2132
2141
  const reverseGetterMap = new WeakMap();
2133
2142
  const reverseSetterMap = new WeakMap();
2134
2143
 
@@ -2138,7 +2147,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2138
2147
  }
2139
2148
 
2140
2149
  wrapGetter(originalGet) {
2141
- const wrappedGetter = getterMap.get(originalGet);
2150
+ const wrappedGetter = getterMap$1.get(originalGet);
2142
2151
 
2143
2152
  if (!isUndefined(wrappedGetter)) {
2144
2153
  return wrappedGetter;
@@ -2151,13 +2160,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2151
2160
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2152
2161
  };
2153
2162
 
2154
- getterMap.set(originalGet, get);
2163
+ getterMap$1.set(originalGet, get);
2155
2164
  reverseGetterMap.set(get, originalGet);
2156
2165
  return get;
2157
2166
  }
2158
2167
 
2159
2168
  wrapSetter(originalSet) {
2160
- const wrappedSetter = setterMap.get(originalSet);
2169
+ const wrappedSetter = setterMap$1.get(originalSet);
2161
2170
 
2162
2171
  if (!isUndefined(wrappedSetter)) {
2163
2172
  return wrappedSetter;
@@ -2168,7 +2177,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2168
2177
  originalSet.call(unwrap$1(this), unwrap$1(v));
2169
2178
  };
2170
2179
 
2171
- setterMap.set(originalSet, set);
2180
+ setterMap$1.set(originalSet, set);
2172
2181
  reverseSetterMap.set(set, originalSet);
2173
2182
  return set;
2174
2183
  }
@@ -2209,7 +2218,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2209
2218
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2210
2219
  };
2211
2220
 
2212
- getterMap.set(get, redGet);
2221
+ getterMap$1.set(get, redGet);
2213
2222
  reverseGetterMap.set(redGet, get);
2214
2223
  return get;
2215
2224
  }
@@ -2228,7 +2237,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2228
2237
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2229
2238
  };
2230
2239
 
2231
- setterMap.set(set, redSet);
2240
+ setterMap$1.set(set, redSet);
2232
2241
  reverseSetterMap.set(redSet, set);
2233
2242
  return set;
2234
2243
  }
@@ -2269,6 +2278,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2269
2278
  }
2270
2279
 
2271
2280
  setPrototypeOf(shadowTarget, prototype) {
2281
+ /* istanbul ignore else */
2272
2282
  if (process.env.NODE_ENV !== 'production') {
2273
2283
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2274
2284
  }
@@ -2282,6 +2292,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2282
2292
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2283
2293
  // the preventExtension call, in which case we should not attempt to lock down
2284
2294
  // the shadow target.
2295
+ // TODO: It should not actually be possible to reach this `if` statement.
2296
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2297
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2298
+
2299
+ /* istanbul ignore if */
2285
2300
 
2286
2301
  if (isExtensible(originalTarget)) {
2287
2302
  return false;
@@ -2323,8 +2338,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2323
2338
 
2324
2339
  }
2325
2340
 
2326
- const getterMap$1 = new WeakMap();
2327
- const setterMap$1 = new WeakMap();
2341
+ const getterMap = new WeakMap();
2342
+ const setterMap = new WeakMap();
2328
2343
 
2329
2344
  class ReadOnlyHandler extends BaseProxyHandler {
2330
2345
  wrapValue(value) {
@@ -2332,7 +2347,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2332
2347
  }
2333
2348
 
2334
2349
  wrapGetter(originalGet) {
2335
- const wrappedGetter = getterMap$1.get(originalGet);
2350
+ const wrappedGetter = getterMap.get(originalGet);
2336
2351
 
2337
2352
  if (!isUndefined(wrappedGetter)) {
2338
2353
  return wrappedGetter;
@@ -2345,12 +2360,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
2345
2360
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2346
2361
  };
2347
2362
 
2348
- getterMap$1.set(originalGet, get);
2363
+ getterMap.set(originalGet, get);
2349
2364
  return get;
2350
2365
  }
2351
2366
 
2352
2367
  wrapSetter(originalSet) {
2353
- const wrappedSetter = setterMap$1.get(originalSet);
2368
+ const wrappedSetter = setterMap.get(originalSet);
2354
2369
 
2355
2370
  if (!isUndefined(wrappedSetter)) {
2356
2371
  return wrappedSetter;
@@ -2359,6 +2374,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2359
2374
  const handler = this;
2360
2375
 
2361
2376
  const set = function (v) {
2377
+ /* istanbul ignore else */
2362
2378
  if (process.env.NODE_ENV !== 'production') {
2363
2379
  const {
2364
2380
  originalTarget
@@ -2367,33 +2383,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
2367
2383
  }
2368
2384
  };
2369
2385
 
2370
- setterMap$1.set(originalSet, set);
2386
+ setterMap.set(originalSet, set);
2371
2387
  return set;
2372
2388
  }
2373
2389
 
2374
2390
  set(shadowTarget, key, value) {
2391
+ /* istanbul ignore else */
2375
2392
  if (process.env.NODE_ENV !== 'production') {
2376
2393
  const {
2377
2394
  originalTarget
2378
2395
  } = this;
2379
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2396
+ 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.`;
2397
+ throw new Error(msg);
2380
2398
  }
2399
+ /* istanbul ignore next */
2400
+
2381
2401
 
2382
2402
  return false;
2383
2403
  }
2384
2404
 
2385
2405
  deleteProperty(shadowTarget, key) {
2406
+ /* istanbul ignore else */
2386
2407
  if (process.env.NODE_ENV !== 'production') {
2387
2408
  const {
2388
2409
  originalTarget
2389
2410
  } = this;
2390
2411
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2391
2412
  }
2413
+ /* istanbul ignore next */
2414
+
2392
2415
 
2393
2416
  return false;
2394
2417
  }
2395
2418
 
2396
2419
  setPrototypeOf(shadowTarget, prototype) {
2420
+ /* istanbul ignore else */
2397
2421
  if (process.env.NODE_ENV !== 'production') {
2398
2422
  const {
2399
2423
  originalTarget
@@ -2403,23 +2427,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
2403
2427
  }
2404
2428
 
2405
2429
  preventExtensions(shadowTarget) {
2430
+ /* istanbul ignore else */
2406
2431
  if (process.env.NODE_ENV !== 'production') {
2407
2432
  const {
2408
2433
  originalTarget
2409
2434
  } = this;
2410
2435
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2411
2436
  }
2437
+ /* istanbul ignore next */
2438
+
2412
2439
 
2413
2440
  return false;
2414
2441
  }
2415
2442
 
2416
2443
  defineProperty(shadowTarget, key, descriptor) {
2444
+ /* istanbul ignore else */
2417
2445
  if (process.env.NODE_ENV !== 'production') {
2418
2446
  const {
2419
2447
  originalTarget
2420
2448
  } = this;
2421
2449
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2422
2450
  }
2451
+ /* istanbul ignore next */
2452
+
2423
2453
 
2424
2454
  return false;
2425
2455
  }
@@ -2477,6 +2507,8 @@ const formatter = {
2477
2507
  }; // Inspired from paulmillr/es6-shim
2478
2508
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2479
2509
 
2510
+ /* istanbul ignore next */
2511
+
2480
2512
  function getGlobal() {
2481
2513
  // the only reliable means to get the global object is `Function('return this')()`
2482
2514
  // However, this causes CSP violations in Chrome apps.
@@ -2501,6 +2533,7 @@ function getGlobal() {
2501
2533
  }
2502
2534
 
2503
2535
  function init() {
2536
+ /* istanbul ignore if */
2504
2537
  if (process.env.NODE_ENV === 'production') {
2505
2538
  // this method should never leak to prod
2506
2539
  throw new ReferenceError();
@@ -2515,13 +2548,13 @@ function init() {
2515
2548
  ArrayPush.call(devtoolsFormatters, formatter);
2516
2549
  global.devtoolsFormatters = devtoolsFormatters;
2517
2550
  }
2551
+ /* istanbul ignore else */
2552
+
2518
2553
 
2519
2554
  if (process.env.NODE_ENV !== 'production') {
2520
2555
  init();
2521
2556
  }
2522
2557
 
2523
- const ObjectDotPrototype = Object.prototype;
2524
-
2525
2558
  function defaultValueIsObservable(value) {
2526
2559
  // intentionally checking for null
2527
2560
  if (value === null) {
@@ -2549,106 +2582,85 @@ const defaultValueMutated = (obj, key) => {
2549
2582
  /* do nothing */
2550
2583
  };
2551
2584
 
2552
- const defaultValueDistortion = value => value;
2553
-
2554
2585
  function createShadowTarget(value) {
2555
2586
  return isArray(value) ? [] : {};
2556
2587
  }
2557
2588
 
2558
- class ReactiveMembrane {
2559
- constructor(options) {
2560
- this.valueDistortion = defaultValueDistortion;
2561
- this.valueMutated = defaultValueMutated;
2562
- this.valueObserved = defaultValueObserved;
2563
- this.valueIsObservable = defaultValueIsObservable;
2564
- this.objectGraph = new WeakMap();
2565
-
2566
- if (!isUndefined(options)) {
2567
- const {
2568
- valueDistortion,
2569
- valueMutated,
2570
- valueObserved,
2571
- valueIsObservable,
2572
- tagPropertyKey
2573
- } = options;
2574
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2575
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2576
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2577
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2578
- this.tagPropertyKey = tagPropertyKey;
2579
- }
2589
+ class ObservableMembrane {
2590
+ constructor(options = {}) {
2591
+ this.readOnlyObjectGraph = new WeakMap();
2592
+ this.reactiveObjectGraph = new WeakMap();
2593
+ const {
2594
+ valueMutated,
2595
+ valueObserved,
2596
+ valueIsObservable,
2597
+ tagPropertyKey
2598
+ } = options;
2599
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2600
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2601
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2602
+ this.tagPropertyKey = tagPropertyKey;
2580
2603
  }
2581
2604
 
2582
2605
  getProxy(value) {
2583
2606
  const unwrappedValue = unwrap$1(value);
2584
- const distorted = this.valueDistortion(unwrappedValue);
2585
2607
 
2586
- if (this.valueIsObservable(distorted)) {
2587
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2588
- // we return the readonly.
2608
+ if (this.valueIsObservable(unwrappedValue)) {
2609
+ // When trying to extract the writable version of a readonly we return the readonly.
2610
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2611
+ return value;
2612
+ }
2589
2613
 
2590
- return o.readOnly === value ? value : o.reactive;
2614
+ return this.getReactiveHandler(unwrappedValue);
2591
2615
  }
2592
2616
 
2593
- return distorted;
2617
+ return unwrappedValue;
2594
2618
  }
2595
2619
 
2596
2620
  getReadOnlyProxy(value) {
2597
2621
  value = unwrap$1(value);
2598
- const distorted = this.valueDistortion(value);
2599
2622
 
2600
- if (this.valueIsObservable(distorted)) {
2601
- return this.getReactiveState(value, distorted).readOnly;
2623
+ if (this.valueIsObservable(value)) {
2624
+ return this.getReadOnlyHandler(value);
2602
2625
  }
2603
2626
 
2604
- return distorted;
2627
+ return value;
2605
2628
  }
2606
2629
 
2607
2630
  unwrapProxy(p) {
2608
2631
  return unwrap$1(p);
2609
2632
  }
2610
2633
 
2611
- getReactiveState(value, distortedValue) {
2612
- const {
2613
- objectGraph
2614
- } = this;
2615
- let reactiveState = objectGraph.get(distortedValue);
2634
+ getReactiveHandler(value) {
2635
+ let proxy = this.reactiveObjectGraph.get(value);
2616
2636
 
2617
- if (reactiveState) {
2618
- return reactiveState;
2637
+ if (isUndefined(proxy)) {
2638
+ // caching the proxy after the first time it is accessed
2639
+ const handler = new ReactiveProxyHandler(this, value);
2640
+ proxy = new Proxy(createShadowTarget(value), handler);
2641
+ registerProxy(proxy, value);
2642
+ this.reactiveObjectGraph.set(value, proxy);
2619
2643
  }
2620
2644
 
2621
- const membrane = this;
2622
- reactiveState = {
2623
- get reactive() {
2624
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2625
-
2626
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2627
- registerProxy(proxy, value);
2628
- ObjectDefineProperty(this, 'reactive', {
2629
- value: proxy
2630
- });
2631
- return proxy;
2632
- },
2645
+ return proxy;
2646
+ }
2633
2647
 
2634
- get readOnly() {
2635
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2648
+ getReadOnlyHandler(value) {
2649
+ let proxy = this.readOnlyObjectGraph.get(value);
2636
2650
 
2637
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2638
- registerProxy(proxy, value);
2639
- ObjectDefineProperty(this, 'readOnly', {
2640
- value: proxy
2641
- });
2642
- return proxy;
2643
- }
2651
+ if (isUndefined(proxy)) {
2652
+ // caching the proxy after the first time it is accessed
2653
+ const handler = new ReadOnlyHandler(this, value);
2654
+ proxy = new Proxy(createShadowTarget(value), handler);
2655
+ registerProxy(proxy, value);
2656
+ this.readOnlyObjectGraph.set(value, proxy);
2657
+ }
2644
2658
 
2645
- };
2646
- objectGraph.set(distortedValue, reactiveState);
2647
- return reactiveState;
2659
+ return proxy;
2648
2660
  }
2649
2661
 
2650
2662
  }
2651
- /** version: 1.0.0 */
2663
+ /** version: 2.0.0 */
2652
2664
 
2653
2665
  /*
2654
2666
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2659,15 +2671,9 @@ class ReactiveMembrane {
2659
2671
 
2660
2672
 
2661
2673
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2662
-
2663
- function valueDistortion(value) {
2664
- return value;
2665
- }
2666
-
2667
- const reactiveMembrane = new ReactiveMembrane({
2674
+ const reactiveMembrane = new ObservableMembrane({
2668
2675
  valueObserved,
2669
2676
  valueMutated,
2670
- valueDistortion,
2671
2677
  tagPropertyKey: lockerLivePropertyKey
2672
2678
  });
2673
2679
  /**
@@ -2676,16 +2682,9 @@ const reactiveMembrane = new ReactiveMembrane({
2676
2682
  * change or being removed.
2677
2683
  */
2678
2684
 
2679
- const unwrap = function (value) {
2680
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2681
-
2682
- if (unwrapped !== value) {
2683
- // if value is a proxy, unwrap to access original value and apply distortion
2684
- return valueDistortion(unwrapped);
2685
- }
2686
-
2687
- return value;
2688
- };
2685
+ function unwrap(value) {
2686
+ return reactiveMembrane.unwrapProxy(value);
2687
+ }
2689
2688
  /*
2690
2689
  * Copyright (c) 2018, salesforce.com, inc.
2691
2690
  * All rights reserved.
@@ -4550,13 +4549,15 @@ function updateElmHook(oldVnode, vnode) {
4550
4549
 
4551
4550
  function updateChildrenHook(oldVnode, vnode) {
4552
4551
  const {
4553
- children,
4554
- owner
4552
+ elm,
4553
+ children
4555
4554
  } = vnode;
4556
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4557
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4558
- fn(vnode.elm, oldVnode.children, children);
4559
- }, noop);
4555
+
4556
+ if (hasDynamicChildren(children)) {
4557
+ updateDynamicChildren(elm, oldVnode.children, children);
4558
+ } else {
4559
+ updateStaticChildren(elm, oldVnode.children, children);
4560
+ }
4560
4561
  }
4561
4562
 
4562
4563
  function allocateChildrenHook(vnode, vm) {
@@ -5794,6 +5795,7 @@ function updateStylesheetToken(vm, template) {
5794
5795
 
5795
5796
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5796
5797
  const content = [];
5798
+ let root;
5797
5799
 
5798
5800
  for (let i = 0; i < stylesheets.length; i++) {
5799
5801
  let stylesheet = stylesheets[i];
@@ -5806,23 +5808,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5806
5808
  // the component instance might be attempting to use an old version of
5807
5809
  // the stylesheet, while internally, we have a replacement for it.
5808
5810
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5809
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5810
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5811
+ }
5811
5812
 
5813
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5814
+
5815
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5816
+ /* Synthetic */
5817
+ && vm.renderMode === 1
5818
+ /* Shadow */
5819
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5820
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5812
5821
 
5813
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5814
5822
  const useActualHostSelector = vm.renderMode === 0
5815
5823
  /* Light */
5816
5824
  ? !isScopedCss : vm.shadowMode === 0
5817
5825
  /* Native */
5818
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5826
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5827
+ // we use an attribute selector on the host to simulate :dir().
5819
5828
 
5820
- const scopeToken = isScopedCss || vm.shadowMode === 1
5821
- /* Synthetic */
5822
- && vm.renderMode === 1
5829
+ let useNativeDirPseudoclass;
5830
+
5831
+ if (vm.renderMode === 1
5823
5832
  /* Shadow */
5824
- ? stylesheetToken : undefined;
5825
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5833
+ ) {
5834
+ useNativeDirPseudoclass = vm.shadowMode === 0
5835
+ /* Native */
5836
+ ;
5837
+ } else {
5838
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5839
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5840
+ if (isUndefined$1(root)) {
5841
+ // Only calculate the root once as necessary
5842
+ root = getNearestShadowComponent(vm);
5843
+ }
5844
+
5845
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5846
+ /* Native */
5847
+ ;
5848
+ }
5849
+
5850
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5826
5851
  }
5827
5852
  }
5828
5853
 
@@ -5846,14 +5871,12 @@ function getStylesheetsContent(vm, template) {
5846
5871
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5847
5872
 
5848
5873
 
5849
- function getNearestNativeShadowComponent(vm) {
5874
+ function getNearestShadowComponent(vm) {
5850
5875
  let owner = vm;
5851
5876
 
5852
5877
  while (!isNull(owner)) {
5853
5878
  if (owner.renderMode === 1
5854
5879
  /* Shadow */
5855
- && owner.shadowMode === 0
5856
- /* Native */
5857
5880
  ) {
5858
5881
  return owner;
5859
5882
  }
@@ -5864,6 +5887,20 @@ function getNearestNativeShadowComponent(vm) {
5864
5887
  return owner;
5865
5888
  }
5866
5889
 
5890
+ function getNearestNativeShadowComponent(vm) {
5891
+ const owner = getNearestShadowComponent(vm);
5892
+
5893
+ if (!isNull(owner) && owner.shadowMode === 1
5894
+ /* Synthetic */
5895
+ ) {
5896
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5897
+ // synthetic, we know we won't find a native component if we go any further.
5898
+ return null;
5899
+ }
5900
+
5901
+ return owner;
5902
+ }
5903
+
5867
5904
  function createStylesheet(vm, stylesheets) {
5868
5905
  const {
5869
5906
  renderer,
@@ -7528,7 +7565,7 @@ function setHooks(hooks) {
7528
7565
  hooksAreSet = true;
7529
7566
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7530
7567
  }
7531
- /* version: 2.5.10-alpha1 */
7568
+ /* version: 2.7.0 */
7532
7569
 
7533
7570
  /*
7534
7571
  * Copyright (c) 2020, salesforce.com, inc.
@@ -8024,6 +8061,6 @@ function renderComponent(tagName, Ctor, props = {}) {
8024
8061
 
8025
8062
  freeze(LightningElement);
8026
8063
  seal(LightningElement.prototype);
8027
- /* version: 2.5.10-alpha1 */
8064
+ /* version: 2.7.0 */
8028
8065
 
8029
8066
  export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };