lwc 2.5.8 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +161 -129
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +161 -129
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +144 -125
  5. package/dist/engine-dom/iife/es5/engine-dom.js +174 -138
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +159 -136
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +161 -129
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +144 -125
  11. package/dist/engine-dom/umd/es5/engine-dom.js +174 -138
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +159 -136
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +161 -129
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +161 -129
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +23 -130
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +23 -130
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +23 -130
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +23 -124
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +23 -124
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +23 -130
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +23 -130
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +23 -124
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +23 -124
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +8 -8
@@ -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();
@@ -299,7 +299,7 @@ function htmlPropertyToAttribute(propName) {
299
299
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
300
300
  return attributeName;
301
301
  }
302
- /** version: 2.5.8 */
302
+ /** version: 2.6.1 */
303
303
 
304
304
  /*
305
305
  * Copyright (c) 2018, salesforce.com, inc.
@@ -413,7 +413,6 @@ const features = {
413
413
  ENABLE_NODE_LIST_PATCH: null,
414
414
  ENABLE_HTML_COLLECTIONS_PATCH: null,
415
415
  ENABLE_NODE_PATCH: null,
416
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
417
416
  ENABLE_MIXED_SHADOW_MODE: null,
418
417
  ENABLE_WIRE_SYNC_EMIT: null
419
418
  };
@@ -479,7 +478,7 @@ function setFeatureFlagForTest(name, value) {
479
478
  setFeatureFlag(name, value);
480
479
  }
481
480
  }
482
- /** version: 2.5.8 */
481
+ /** version: 2.6.1 */
483
482
 
484
483
  /* proxy-compat-disable */
485
484
 
@@ -1926,10 +1925,10 @@ const {
1926
1925
  isArray
1927
1926
  } = Array;
1928
1927
  const {
1928
+ prototype: ObjectDotPrototype,
1929
1929
  getPrototypeOf,
1930
1930
  create: ObjectCreate,
1931
1931
  defineProperty: ObjectDefineProperty,
1932
- defineProperties: ObjectDefineProperties,
1933
1932
  isExtensible,
1934
1933
  getOwnPropertyDescriptor,
1935
1934
  getOwnPropertyNames,
@@ -1939,8 +1938,7 @@ const {
1939
1938
  } = Object;
1940
1939
  const {
1941
1940
  push: ArrayPush,
1942
- concat: ArrayConcat,
1943
- map: ArrayMap
1941
+ concat: ArrayConcat
1944
1942
  } = Array.prototype;
1945
1943
  const OtS = {}.toString;
1946
1944
 
@@ -2005,7 +2003,9 @@ class BaseProxyHandler {
2005
2003
  // but it will always be compatible with the previous descriptor
2006
2004
  // to preserve the object invariants, which makes these lines safe.
2007
2005
 
2008
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
2006
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
2007
+
2008
+ /* istanbul ignore else */
2009
2009
 
2010
2010
  if (!isUndefined(originalDescriptor)) {
2011
2011
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2033,11 +2033,17 @@ class BaseProxyHandler {
2033
2033
 
2034
2034
  preventExtensions(shadowTarget);
2035
2035
  } // Shared Traps
2036
+ // TODO: apply() is never called
2037
+
2038
+ /* istanbul ignore next */
2036
2039
 
2037
2040
 
2038
2041
  apply(shadowTarget, thisArg, argArray) {
2039
2042
  /* No op */
2040
- }
2043
+ } // TODO: construct() is never called
2044
+
2045
+ /* istanbul ignore next */
2046
+
2041
2047
 
2042
2048
  construct(shadowTarget, argArray, newTarget) {
2043
2049
  /* No op */
@@ -2150,8 +2156,8 @@ class BaseProxyHandler {
2150
2156
 
2151
2157
  }
2152
2158
 
2153
- const getterMap = new WeakMap();
2154
- const setterMap = new WeakMap();
2159
+ const getterMap$1 = new WeakMap();
2160
+ const setterMap$1 = new WeakMap();
2155
2161
  const reverseGetterMap = new WeakMap();
2156
2162
  const reverseSetterMap = new WeakMap();
2157
2163
 
@@ -2161,7 +2167,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2161
2167
  }
2162
2168
 
2163
2169
  wrapGetter(originalGet) {
2164
- const wrappedGetter = getterMap.get(originalGet);
2170
+ const wrappedGetter = getterMap$1.get(originalGet);
2165
2171
 
2166
2172
  if (!isUndefined(wrappedGetter)) {
2167
2173
  return wrappedGetter;
@@ -2174,13 +2180,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2174
2180
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2175
2181
  };
2176
2182
 
2177
- getterMap.set(originalGet, get);
2183
+ getterMap$1.set(originalGet, get);
2178
2184
  reverseGetterMap.set(get, originalGet);
2179
2185
  return get;
2180
2186
  }
2181
2187
 
2182
2188
  wrapSetter(originalSet) {
2183
- const wrappedSetter = setterMap.get(originalSet);
2189
+ const wrappedSetter = setterMap$1.get(originalSet);
2184
2190
 
2185
2191
  if (!isUndefined(wrappedSetter)) {
2186
2192
  return wrappedSetter;
@@ -2191,7 +2197,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2191
2197
  originalSet.call(unwrap$1(this), unwrap$1(v));
2192
2198
  };
2193
2199
 
2194
- setterMap.set(originalSet, set);
2200
+ setterMap$1.set(originalSet, set);
2195
2201
  reverseSetterMap.set(set, originalSet);
2196
2202
  return set;
2197
2203
  }
@@ -2232,7 +2238,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2232
2238
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2233
2239
  };
2234
2240
 
2235
- getterMap.set(get, redGet);
2241
+ getterMap$1.set(get, redGet);
2236
2242
  reverseGetterMap.set(redGet, get);
2237
2243
  return get;
2238
2244
  }
@@ -2251,7 +2257,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2251
2257
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2252
2258
  };
2253
2259
 
2254
- setterMap.set(set, redSet);
2260
+ setterMap$1.set(set, redSet);
2255
2261
  reverseSetterMap.set(redSet, set);
2256
2262
  return set;
2257
2263
  }
@@ -2292,6 +2298,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2292
2298
  }
2293
2299
 
2294
2300
  setPrototypeOf(shadowTarget, prototype) {
2301
+ /* istanbul ignore else */
2295
2302
  if (process.env.NODE_ENV !== 'production') {
2296
2303
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2297
2304
  }
@@ -2305,6 +2312,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2305
2312
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2306
2313
  // the preventExtension call, in which case we should not attempt to lock down
2307
2314
  // the shadow target.
2315
+ // TODO: It should not actually be possible to reach this `if` statement.
2316
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2317
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2318
+
2319
+ /* istanbul ignore if */
2308
2320
 
2309
2321
  if (isExtensible(originalTarget)) {
2310
2322
  return false;
@@ -2346,8 +2358,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2346
2358
 
2347
2359
  }
2348
2360
 
2349
- const getterMap$1 = new WeakMap();
2350
- const setterMap$1 = new WeakMap();
2361
+ const getterMap = new WeakMap();
2362
+ const setterMap = new WeakMap();
2351
2363
 
2352
2364
  class ReadOnlyHandler extends BaseProxyHandler {
2353
2365
  wrapValue(value) {
@@ -2355,7 +2367,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2355
2367
  }
2356
2368
 
2357
2369
  wrapGetter(originalGet) {
2358
- const wrappedGetter = getterMap$1.get(originalGet);
2370
+ const wrappedGetter = getterMap.get(originalGet);
2359
2371
 
2360
2372
  if (!isUndefined(wrappedGetter)) {
2361
2373
  return wrappedGetter;
@@ -2368,12 +2380,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
2368
2380
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2369
2381
  };
2370
2382
 
2371
- getterMap$1.set(originalGet, get);
2383
+ getterMap.set(originalGet, get);
2372
2384
  return get;
2373
2385
  }
2374
2386
 
2375
2387
  wrapSetter(originalSet) {
2376
- const wrappedSetter = setterMap$1.get(originalSet);
2388
+ const wrappedSetter = setterMap.get(originalSet);
2377
2389
 
2378
2390
  if (!isUndefined(wrappedSetter)) {
2379
2391
  return wrappedSetter;
@@ -2382,6 +2394,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2382
2394
  const handler = this;
2383
2395
 
2384
2396
  const set = function (v) {
2397
+ /* istanbul ignore else */
2385
2398
  if (process.env.NODE_ENV !== 'production') {
2386
2399
  const {
2387
2400
  originalTarget
@@ -2390,33 +2403,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
2390
2403
  }
2391
2404
  };
2392
2405
 
2393
- setterMap$1.set(originalSet, set);
2406
+ setterMap.set(originalSet, set);
2394
2407
  return set;
2395
2408
  }
2396
2409
 
2397
2410
  set(shadowTarget, key, value) {
2411
+ /* istanbul ignore else */
2398
2412
  if (process.env.NODE_ENV !== 'production') {
2399
2413
  const {
2400
2414
  originalTarget
2401
2415
  } = this;
2402
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2416
+ 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.`;
2417
+ throw new Error(msg);
2403
2418
  }
2419
+ /* istanbul ignore next */
2420
+
2404
2421
 
2405
2422
  return false;
2406
2423
  }
2407
2424
 
2408
2425
  deleteProperty(shadowTarget, key) {
2426
+ /* istanbul ignore else */
2409
2427
  if (process.env.NODE_ENV !== 'production') {
2410
2428
  const {
2411
2429
  originalTarget
2412
2430
  } = this;
2413
2431
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2414
2432
  }
2433
+ /* istanbul ignore next */
2434
+
2415
2435
 
2416
2436
  return false;
2417
2437
  }
2418
2438
 
2419
2439
  setPrototypeOf(shadowTarget, prototype) {
2440
+ /* istanbul ignore else */
2420
2441
  if (process.env.NODE_ENV !== 'production') {
2421
2442
  const {
2422
2443
  originalTarget
@@ -2426,23 +2447,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
2426
2447
  }
2427
2448
 
2428
2449
  preventExtensions(shadowTarget) {
2450
+ /* istanbul ignore else */
2429
2451
  if (process.env.NODE_ENV !== 'production') {
2430
2452
  const {
2431
2453
  originalTarget
2432
2454
  } = this;
2433
2455
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2434
2456
  }
2457
+ /* istanbul ignore next */
2458
+
2435
2459
 
2436
2460
  return false;
2437
2461
  }
2438
2462
 
2439
2463
  defineProperty(shadowTarget, key, descriptor) {
2464
+ /* istanbul ignore else */
2440
2465
  if (process.env.NODE_ENV !== 'production') {
2441
2466
  const {
2442
2467
  originalTarget
2443
2468
  } = this;
2444
2469
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2445
2470
  }
2471
+ /* istanbul ignore next */
2472
+
2446
2473
 
2447
2474
  return false;
2448
2475
  }
@@ -2500,6 +2527,8 @@ const formatter = {
2500
2527
  }; // Inspired from paulmillr/es6-shim
2501
2528
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2502
2529
 
2530
+ /* istanbul ignore next */
2531
+
2503
2532
  function getGlobal() {
2504
2533
  // the only reliable means to get the global object is `Function('return this')()`
2505
2534
  // However, this causes CSP violations in Chrome apps.
@@ -2524,6 +2553,7 @@ function getGlobal() {
2524
2553
  }
2525
2554
 
2526
2555
  function init() {
2556
+ /* istanbul ignore if */
2527
2557
  if (process.env.NODE_ENV === 'production') {
2528
2558
  // this method should never leak to prod
2529
2559
  throw new ReferenceError();
@@ -2538,13 +2568,13 @@ function init() {
2538
2568
  ArrayPush.call(devtoolsFormatters, formatter);
2539
2569
  global.devtoolsFormatters = devtoolsFormatters;
2540
2570
  }
2571
+ /* istanbul ignore else */
2572
+
2541
2573
 
2542
2574
  if (process.env.NODE_ENV !== 'production') {
2543
2575
  init();
2544
2576
  }
2545
2577
 
2546
- const ObjectDotPrototype = Object.prototype;
2547
-
2548
2578
  function defaultValueIsObservable(value) {
2549
2579
  // intentionally checking for null
2550
2580
  if (value === null) {
@@ -2572,106 +2602,85 @@ const defaultValueMutated = (obj, key) => {
2572
2602
  /* do nothing */
2573
2603
  };
2574
2604
 
2575
- const defaultValueDistortion = value => value;
2576
-
2577
2605
  function createShadowTarget(value) {
2578
2606
  return isArray(value) ? [] : {};
2579
2607
  }
2580
2608
 
2581
- class ReactiveMembrane {
2582
- constructor(options) {
2583
- this.valueDistortion = defaultValueDistortion;
2584
- this.valueMutated = defaultValueMutated;
2585
- this.valueObserved = defaultValueObserved;
2586
- this.valueIsObservable = defaultValueIsObservable;
2587
- this.objectGraph = new WeakMap();
2588
-
2589
- if (!isUndefined(options)) {
2590
- const {
2591
- valueDistortion,
2592
- valueMutated,
2593
- valueObserved,
2594
- valueIsObservable,
2595
- tagPropertyKey
2596
- } = options;
2597
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2598
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2599
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2600
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2601
- this.tagPropertyKey = tagPropertyKey;
2602
- }
2609
+ class ObservableMembrane {
2610
+ constructor(options = {}) {
2611
+ this.readOnlyObjectGraph = new WeakMap();
2612
+ this.reactiveObjectGraph = new WeakMap();
2613
+ const {
2614
+ valueMutated,
2615
+ valueObserved,
2616
+ valueIsObservable,
2617
+ tagPropertyKey
2618
+ } = options;
2619
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2620
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2621
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2622
+ this.tagPropertyKey = tagPropertyKey;
2603
2623
  }
2604
2624
 
2605
2625
  getProxy(value) {
2606
2626
  const unwrappedValue = unwrap$1(value);
2607
- const distorted = this.valueDistortion(unwrappedValue);
2608
2627
 
2609
- if (this.valueIsObservable(distorted)) {
2610
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2611
- // we return the readonly.
2628
+ if (this.valueIsObservable(unwrappedValue)) {
2629
+ // When trying to extract the writable version of a readonly we return the readonly.
2630
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2631
+ return value;
2632
+ }
2612
2633
 
2613
- return o.readOnly === value ? value : o.reactive;
2634
+ return this.getReactiveHandler(unwrappedValue);
2614
2635
  }
2615
2636
 
2616
- return distorted;
2637
+ return unwrappedValue;
2617
2638
  }
2618
2639
 
2619
2640
  getReadOnlyProxy(value) {
2620
2641
  value = unwrap$1(value);
2621
- const distorted = this.valueDistortion(value);
2622
2642
 
2623
- if (this.valueIsObservable(distorted)) {
2624
- return this.getReactiveState(value, distorted).readOnly;
2643
+ if (this.valueIsObservable(value)) {
2644
+ return this.getReadOnlyHandler(value);
2625
2645
  }
2626
2646
 
2627
- return distorted;
2647
+ return value;
2628
2648
  }
2629
2649
 
2630
2650
  unwrapProxy(p) {
2631
2651
  return unwrap$1(p);
2632
2652
  }
2633
2653
 
2634
- getReactiveState(value, distortedValue) {
2635
- const {
2636
- objectGraph
2637
- } = this;
2638
- let reactiveState = objectGraph.get(distortedValue);
2654
+ getReactiveHandler(value) {
2655
+ let proxy = this.reactiveObjectGraph.get(value);
2639
2656
 
2640
- if (reactiveState) {
2641
- return reactiveState;
2657
+ if (isUndefined(proxy)) {
2658
+ // caching the proxy after the first time it is accessed
2659
+ const handler = new ReactiveProxyHandler(this, value);
2660
+ proxy = new Proxy(createShadowTarget(value), handler);
2661
+ registerProxy(proxy, value);
2662
+ this.reactiveObjectGraph.set(value, proxy);
2642
2663
  }
2643
2664
 
2644
- const membrane = this;
2645
- reactiveState = {
2646
- get reactive() {
2647
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2648
-
2649
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2650
- registerProxy(proxy, value);
2651
- ObjectDefineProperty(this, 'reactive', {
2652
- value: proxy
2653
- });
2654
- return proxy;
2655
- },
2665
+ return proxy;
2666
+ }
2656
2667
 
2657
- get readOnly() {
2658
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2668
+ getReadOnlyHandler(value) {
2669
+ let proxy = this.readOnlyObjectGraph.get(value);
2659
2670
 
2660
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2661
- registerProxy(proxy, value);
2662
- ObjectDefineProperty(this, 'readOnly', {
2663
- value: proxy
2664
- });
2665
- return proxy;
2666
- }
2671
+ if (isUndefined(proxy)) {
2672
+ // caching the proxy after the first time it is accessed
2673
+ const handler = new ReadOnlyHandler(this, value);
2674
+ proxy = new Proxy(createShadowTarget(value), handler);
2675
+ registerProxy(proxy, value);
2676
+ this.readOnlyObjectGraph.set(value, proxy);
2677
+ }
2667
2678
 
2668
- };
2669
- objectGraph.set(distortedValue, reactiveState);
2670
- return reactiveState;
2679
+ return proxy;
2671
2680
  }
2672
2681
 
2673
2682
  }
2674
- /** version: 1.0.0 */
2683
+ /** version: 2.0.0 */
2675
2684
 
2676
2685
  /*
2677
2686
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2682,15 +2691,9 @@ class ReactiveMembrane {
2682
2691
 
2683
2692
 
2684
2693
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2685
-
2686
- function valueDistortion(value) {
2687
- return value;
2688
- }
2689
-
2690
- const reactiveMembrane = new ReactiveMembrane({
2694
+ const reactiveMembrane = new ObservableMembrane({
2691
2695
  valueObserved,
2692
2696
  valueMutated,
2693
- valueDistortion,
2694
2697
  tagPropertyKey: lockerLivePropertyKey
2695
2698
  });
2696
2699
  /**
@@ -2699,16 +2702,9 @@ const reactiveMembrane = new ReactiveMembrane({
2699
2702
  * change or being removed.
2700
2703
  */
2701
2704
 
2702
- const unwrap = function (value) {
2703
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2704
-
2705
- if (unwrapped !== value) {
2706
- // if value is a proxy, unwrap to access original value and apply distortion
2707
- return valueDistortion(unwrapped);
2708
- }
2709
-
2710
- return value;
2711
- };
2705
+ function unwrap(value) {
2706
+ return reactiveMembrane.unwrapProxy(value);
2707
+ }
2712
2708
  /*
2713
2709
  * Copyright (c) 2018, salesforce.com, inc.
2714
2710
  * All rights reserved.
@@ -4823,7 +4819,7 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4823
4819
  for (const [attrName, attrValue] of Object.entries(attrs)) {
4824
4820
  const elmAttrValue = renderer.getAttribute(elm, attrName);
4825
4821
 
4826
- if (attrValue !== elmAttrValue) {
4822
+ if (String(attrValue) !== elmAttrValue) {
4827
4823
  logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
4828
4824
  nodesAreCompatible = false;
4829
4825
  }
@@ -4845,7 +4841,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4845
4841
  let nodesAreCompatible = true;
4846
4842
  let vnodeClassName;
4847
4843
 
4848
- if (!isUndefined$1(className) && className !== elm.className) {
4844
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4849
4845
  // className is used when class is bound to an expr.
4850
4846
  nodesAreCompatible = false;
4851
4847
  vnodeClassName = className;
@@ -5646,7 +5642,7 @@ function co(text) {
5646
5642
 
5647
5643
 
5648
5644
  function d(value) {
5649
- return value == null ? '' : value;
5645
+ return value == null ? '' : String(value);
5650
5646
  } // [b]ind function
5651
5647
 
5652
5648
 
@@ -5937,6 +5933,7 @@ function updateStylesheetToken(vm, template) {
5937
5933
 
5938
5934
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5939
5935
  const content = [];
5936
+ let root;
5940
5937
 
5941
5938
  for (let i = 0; i < stylesheets.length; i++) {
5942
5939
  let stylesheet = stylesheets[i];
@@ -5949,23 +5946,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5949
5946
  // the component instance might be attempting to use an old version of
5950
5947
  // the stylesheet, while internally, we have a replacement for it.
5951
5948
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5952
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5953
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5949
+ }
5950
+
5951
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5954
5952
 
5953
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5954
+ /* Synthetic */
5955
+ && vm.renderMode === 1
5956
+ /* Shadow */
5957
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5958
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5955
5959
 
5956
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5957
5960
  const useActualHostSelector = vm.renderMode === 0
5958
5961
  /* Light */
5959
5962
  ? !isScopedCss : vm.shadowMode === 0
5960
5963
  /* Native */
5961
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5964
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5965
+ // we use an attribute selector on the host to simulate :dir().
5962
5966
 
5963
- const scopeToken = isScopedCss || vm.shadowMode === 1
5964
- /* Synthetic */
5965
- && vm.renderMode === 1
5967
+ let useNativeDirPseudoclass;
5968
+
5969
+ if (vm.renderMode === 1
5966
5970
  /* Shadow */
5967
- ? stylesheetToken : undefined;
5968
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5971
+ ) {
5972
+ useNativeDirPseudoclass = vm.shadowMode === 0
5973
+ /* Native */
5974
+ ;
5975
+ } else {
5976
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5977
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5978
+ if (isUndefined$1(root)) {
5979
+ // Only calculate the root once as necessary
5980
+ root = getNearestShadowComponent(vm);
5981
+ }
5982
+
5983
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5984
+ /* Native */
5985
+ ;
5986
+ }
5987
+
5988
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5969
5989
  }
5970
5990
  }
5971
5991
 
@@ -5989,14 +6009,12 @@ function getStylesheetsContent(vm, template) {
5989
6009
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5990
6010
 
5991
6011
 
5992
- function getNearestNativeShadowComponent(vm) {
6012
+ function getNearestShadowComponent(vm) {
5993
6013
  let owner = vm;
5994
6014
 
5995
6015
  while (!isNull(owner)) {
5996
6016
  if (owner.renderMode === 1
5997
6017
  /* Shadow */
5998
- && owner.shadowMode === 0
5999
- /* Native */
6000
6018
  ) {
6001
6019
  return owner;
6002
6020
  }
@@ -6007,6 +6025,20 @@ function getNearestNativeShadowComponent(vm) {
6007
6025
  return owner;
6008
6026
  }
6009
6027
 
6028
+ function getNearestNativeShadowComponent(vm) {
6029
+ const owner = getNearestShadowComponent(vm);
6030
+
6031
+ if (!isNull(owner) && owner.shadowMode === 1
6032
+ /* Synthetic */
6033
+ ) {
6034
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6035
+ // synthetic, we know we won't find a native component if we go any further.
6036
+ return null;
6037
+ }
6038
+
6039
+ return owner;
6040
+ }
6041
+
6010
6042
  function createStylesheet(vm, stylesheets) {
6011
6043
  const {
6012
6044
  renderer,
@@ -6022,7 +6054,7 @@ function createStylesheet(vm, stylesheets) {
6022
6054
  for (let i = 0; i < stylesheets.length; i++) {
6023
6055
  renderer.insertGlobalStylesheet(stylesheets[i]);
6024
6056
  }
6025
- } else if (renderer.ssr || renderer.isHydrating) {
6057
+ } else if (renderer.ssr || renderer.isHydrating()) {
6026
6058
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
6027
6059
  // This works in the client, because the stylesheets are created, and cached in the VM
6028
6060
  // the first time the VM renders.
@@ -7747,7 +7779,7 @@ function setHooks(hooks) {
7747
7779
  hooksAreSet = true;
7748
7780
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7749
7781
  }
7750
- /* version: 2.5.8 */
7782
+ /* version: 2.6.1 */
7751
7783
 
7752
7784
  /*
7753
7785
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7900,7 +7932,7 @@ function setIsHydrating(v) {
7900
7932
  const renderer = {
7901
7933
  ssr: false,
7902
7934
 
7903
- get isHydrating() {
7935
+ isHydrating() {
7904
7936
  return isHydrating;
7905
7937
  },
7906
7938
 
@@ -8403,6 +8435,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8403
8435
  });
8404
8436
  freeze(LightningElement);
8405
8437
  seal(LightningElement.prototype);
8406
- /* version: 2.5.8 */
8438
+ /* version: 2.6.1 */
8407
8439
 
8408
8440
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };