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
@@ -73,7 +73,7 @@ const {
73
73
  find: ArrayFind,
74
74
  indexOf: ArrayIndexOf,
75
75
  join: ArrayJoin,
76
- map: ArrayMap$1,
76
+ map: ArrayMap,
77
77
  push: ArrayPush$1,
78
78
  reduce: ArrayReduce,
79
79
  reverse: ArrayReverse,
@@ -140,7 +140,7 @@ function toString$1(obj) {
140
140
  // Array.prototype.toString directly will cause an error Iterate through
141
141
  // all the items and handle individually.
142
142
  if (isArray$1(obj)) {
143
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
143
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
144
144
  }
145
145
 
146
146
  return obj.toString();
@@ -339,7 +339,7 @@ function htmlPropertyToAttribute(propName) {
339
339
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
340
340
  return attributeName;
341
341
  }
342
- /** version: 2.5.8 */
342
+ /** version: 2.6.1 */
343
343
 
344
344
  /*
345
345
  * Copyright (c) 2020, salesforce.com, inc.
@@ -394,7 +394,6 @@ const features = {
394
394
  ENABLE_NODE_LIST_PATCH: null,
395
395
  ENABLE_HTML_COLLECTIONS_PATCH: null,
396
396
  ENABLE_NODE_PATCH: null,
397
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
398
397
  ENABLE_MIXED_SHADOW_MODE: null,
399
398
  ENABLE_WIRE_SYNC_EMIT: null
400
399
  };
@@ -460,7 +459,7 @@ function setFeatureFlagForTest(name, value) {
460
459
  setFeatureFlag(name, value);
461
460
  }
462
461
  }
463
- /** version: 2.5.8 */
462
+ /** version: 2.6.1 */
464
463
 
465
464
  /* proxy-compat-disable */
466
465
 
@@ -1907,10 +1906,10 @@ const {
1907
1906
  isArray
1908
1907
  } = Array;
1909
1908
  const {
1909
+ prototype: ObjectDotPrototype,
1910
1910
  getPrototypeOf,
1911
1911
  create: ObjectCreate,
1912
1912
  defineProperty: ObjectDefineProperty,
1913
- defineProperties: ObjectDefineProperties,
1914
1913
  isExtensible,
1915
1914
  getOwnPropertyDescriptor,
1916
1915
  getOwnPropertyNames,
@@ -1920,8 +1919,7 @@ const {
1920
1919
  } = Object;
1921
1920
  const {
1922
1921
  push: ArrayPush,
1923
- concat: ArrayConcat,
1924
- map: ArrayMap
1922
+ concat: ArrayConcat
1925
1923
  } = Array.prototype;
1926
1924
  const OtS = {}.toString;
1927
1925
 
@@ -1986,7 +1984,9 @@ class BaseProxyHandler {
1986
1984
  // but it will always be compatible with the previous descriptor
1987
1985
  // to preserve the object invariants, which makes these lines safe.
1988
1986
 
1989
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1987
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1988
+
1989
+ /* istanbul ignore else */
1990
1990
 
1991
1991
  if (!isUndefined(originalDescriptor)) {
1992
1992
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2014,11 +2014,17 @@ class BaseProxyHandler {
2014
2014
 
2015
2015
  preventExtensions(shadowTarget);
2016
2016
  } // Shared Traps
2017
+ // TODO: apply() is never called
2018
+
2019
+ /* istanbul ignore next */
2017
2020
 
2018
2021
 
2019
2022
  apply(shadowTarget, thisArg, argArray) {
2020
2023
  /* No op */
2021
- }
2024
+ } // TODO: construct() is never called
2025
+
2026
+ /* istanbul ignore next */
2027
+
2022
2028
 
2023
2029
  construct(shadowTarget, argArray, newTarget) {
2024
2030
  /* No op */
@@ -2131,8 +2137,8 @@ class BaseProxyHandler {
2131
2137
 
2132
2138
  }
2133
2139
 
2134
- const getterMap = new WeakMap();
2135
- const setterMap = new WeakMap();
2140
+ const getterMap$1 = new WeakMap();
2141
+ const setterMap$1 = new WeakMap();
2136
2142
  const reverseGetterMap = new WeakMap();
2137
2143
  const reverseSetterMap = new WeakMap();
2138
2144
 
@@ -2142,7 +2148,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2142
2148
  }
2143
2149
 
2144
2150
  wrapGetter(originalGet) {
2145
- const wrappedGetter = getterMap.get(originalGet);
2151
+ const wrappedGetter = getterMap$1.get(originalGet);
2146
2152
 
2147
2153
  if (!isUndefined(wrappedGetter)) {
2148
2154
  return wrappedGetter;
@@ -2155,13 +2161,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2155
2161
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2156
2162
  };
2157
2163
 
2158
- getterMap.set(originalGet, get);
2164
+ getterMap$1.set(originalGet, get);
2159
2165
  reverseGetterMap.set(get, originalGet);
2160
2166
  return get;
2161
2167
  }
2162
2168
 
2163
2169
  wrapSetter(originalSet) {
2164
- const wrappedSetter = setterMap.get(originalSet);
2170
+ const wrappedSetter = setterMap$1.get(originalSet);
2165
2171
 
2166
2172
  if (!isUndefined(wrappedSetter)) {
2167
2173
  return wrappedSetter;
@@ -2172,7 +2178,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2172
2178
  originalSet.call(unwrap$1(this), unwrap$1(v));
2173
2179
  };
2174
2180
 
2175
- setterMap.set(originalSet, set);
2181
+ setterMap$1.set(originalSet, set);
2176
2182
  reverseSetterMap.set(set, originalSet);
2177
2183
  return set;
2178
2184
  }
@@ -2213,7 +2219,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2213
2219
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2214
2220
  };
2215
2221
 
2216
- getterMap.set(get, redGet);
2222
+ getterMap$1.set(get, redGet);
2217
2223
  reverseGetterMap.set(redGet, get);
2218
2224
  return get;
2219
2225
  }
@@ -2232,7 +2238,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2232
2238
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2233
2239
  };
2234
2240
 
2235
- setterMap.set(set, redSet);
2241
+ setterMap$1.set(set, redSet);
2236
2242
  reverseSetterMap.set(redSet, set);
2237
2243
  return set;
2238
2244
  }
@@ -2273,6 +2279,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2273
2279
  }
2274
2280
 
2275
2281
  setPrototypeOf(shadowTarget, prototype) {
2282
+ /* istanbul ignore else */
2276
2283
  if (process.env.NODE_ENV !== 'production') {
2277
2284
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2278
2285
  }
@@ -2286,6 +2293,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2286
2293
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2287
2294
  // the preventExtension call, in which case we should not attempt to lock down
2288
2295
  // the shadow target.
2296
+ // TODO: It should not actually be possible to reach this `if` statement.
2297
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2298
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2299
+
2300
+ /* istanbul ignore if */
2289
2301
 
2290
2302
  if (isExtensible(originalTarget)) {
2291
2303
  return false;
@@ -2327,8 +2339,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2327
2339
 
2328
2340
  }
2329
2341
 
2330
- const getterMap$1 = new WeakMap();
2331
- const setterMap$1 = new WeakMap();
2342
+ const getterMap = new WeakMap();
2343
+ const setterMap = new WeakMap();
2332
2344
 
2333
2345
  class ReadOnlyHandler extends BaseProxyHandler {
2334
2346
  wrapValue(value) {
@@ -2336,7 +2348,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2336
2348
  }
2337
2349
 
2338
2350
  wrapGetter(originalGet) {
2339
- const wrappedGetter = getterMap$1.get(originalGet);
2351
+ const wrappedGetter = getterMap.get(originalGet);
2340
2352
 
2341
2353
  if (!isUndefined(wrappedGetter)) {
2342
2354
  return wrappedGetter;
@@ -2349,12 +2361,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
2349
2361
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2350
2362
  };
2351
2363
 
2352
- getterMap$1.set(originalGet, get);
2364
+ getterMap.set(originalGet, get);
2353
2365
  return get;
2354
2366
  }
2355
2367
 
2356
2368
  wrapSetter(originalSet) {
2357
- const wrappedSetter = setterMap$1.get(originalSet);
2369
+ const wrappedSetter = setterMap.get(originalSet);
2358
2370
 
2359
2371
  if (!isUndefined(wrappedSetter)) {
2360
2372
  return wrappedSetter;
@@ -2363,6 +2375,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2363
2375
  const handler = this;
2364
2376
 
2365
2377
  const set = function (v) {
2378
+ /* istanbul ignore else */
2366
2379
  if (process.env.NODE_ENV !== 'production') {
2367
2380
  const {
2368
2381
  originalTarget
@@ -2371,33 +2384,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
2371
2384
  }
2372
2385
  };
2373
2386
 
2374
- setterMap$1.set(originalSet, set);
2387
+ setterMap.set(originalSet, set);
2375
2388
  return set;
2376
2389
  }
2377
2390
 
2378
2391
  set(shadowTarget, key, value) {
2392
+ /* istanbul ignore else */
2379
2393
  if (process.env.NODE_ENV !== 'production') {
2380
2394
  const {
2381
2395
  originalTarget
2382
2396
  } = this;
2383
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2397
+ 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.`;
2398
+ throw new Error(msg);
2384
2399
  }
2400
+ /* istanbul ignore next */
2401
+
2385
2402
 
2386
2403
  return false;
2387
2404
  }
2388
2405
 
2389
2406
  deleteProperty(shadowTarget, key) {
2407
+ /* istanbul ignore else */
2390
2408
  if (process.env.NODE_ENV !== 'production') {
2391
2409
  const {
2392
2410
  originalTarget
2393
2411
  } = this;
2394
2412
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2395
2413
  }
2414
+ /* istanbul ignore next */
2415
+
2396
2416
 
2397
2417
  return false;
2398
2418
  }
2399
2419
 
2400
2420
  setPrototypeOf(shadowTarget, prototype) {
2421
+ /* istanbul ignore else */
2401
2422
  if (process.env.NODE_ENV !== 'production') {
2402
2423
  const {
2403
2424
  originalTarget
@@ -2407,23 +2428,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
2407
2428
  }
2408
2429
 
2409
2430
  preventExtensions(shadowTarget) {
2431
+ /* istanbul ignore else */
2410
2432
  if (process.env.NODE_ENV !== 'production') {
2411
2433
  const {
2412
2434
  originalTarget
2413
2435
  } = this;
2414
2436
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2415
2437
  }
2438
+ /* istanbul ignore next */
2439
+
2416
2440
 
2417
2441
  return false;
2418
2442
  }
2419
2443
 
2420
2444
  defineProperty(shadowTarget, key, descriptor) {
2445
+ /* istanbul ignore else */
2421
2446
  if (process.env.NODE_ENV !== 'production') {
2422
2447
  const {
2423
2448
  originalTarget
2424
2449
  } = this;
2425
2450
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2426
2451
  }
2452
+ /* istanbul ignore next */
2453
+
2427
2454
 
2428
2455
  return false;
2429
2456
  }
@@ -2481,6 +2508,8 @@ const formatter = {
2481
2508
  }; // Inspired from paulmillr/es6-shim
2482
2509
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2483
2510
 
2511
+ /* istanbul ignore next */
2512
+
2484
2513
  function getGlobal() {
2485
2514
  // the only reliable means to get the global object is `Function('return this')()`
2486
2515
  // However, this causes CSP violations in Chrome apps.
@@ -2505,6 +2534,7 @@ function getGlobal() {
2505
2534
  }
2506
2535
 
2507
2536
  function init() {
2537
+ /* istanbul ignore if */
2508
2538
  if (process.env.NODE_ENV === 'production') {
2509
2539
  // this method should never leak to prod
2510
2540
  throw new ReferenceError();
@@ -2519,13 +2549,13 @@ function init() {
2519
2549
  ArrayPush.call(devtoolsFormatters, formatter);
2520
2550
  global.devtoolsFormatters = devtoolsFormatters;
2521
2551
  }
2552
+ /* istanbul ignore else */
2553
+
2522
2554
 
2523
2555
  if (process.env.NODE_ENV !== 'production') {
2524
2556
  init();
2525
2557
  }
2526
2558
 
2527
- const ObjectDotPrototype = Object.prototype;
2528
-
2529
2559
  function defaultValueIsObservable(value) {
2530
2560
  // intentionally checking for null
2531
2561
  if (value === null) {
@@ -2553,106 +2583,85 @@ const defaultValueMutated = (obj, key) => {
2553
2583
  /* do nothing */
2554
2584
  };
2555
2585
 
2556
- const defaultValueDistortion = value => value;
2557
-
2558
2586
  function createShadowTarget(value) {
2559
2587
  return isArray(value) ? [] : {};
2560
2588
  }
2561
2589
 
2562
- class ReactiveMembrane {
2563
- constructor(options) {
2564
- this.valueDistortion = defaultValueDistortion;
2565
- this.valueMutated = defaultValueMutated;
2566
- this.valueObserved = defaultValueObserved;
2567
- this.valueIsObservable = defaultValueIsObservable;
2568
- this.objectGraph = new WeakMap();
2569
-
2570
- if (!isUndefined(options)) {
2571
- const {
2572
- valueDistortion,
2573
- valueMutated,
2574
- valueObserved,
2575
- valueIsObservable,
2576
- tagPropertyKey
2577
- } = options;
2578
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2579
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2580
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2581
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2582
- this.tagPropertyKey = tagPropertyKey;
2583
- }
2590
+ class ObservableMembrane {
2591
+ constructor(options = {}) {
2592
+ this.readOnlyObjectGraph = new WeakMap();
2593
+ this.reactiveObjectGraph = new WeakMap();
2594
+ const {
2595
+ valueMutated,
2596
+ valueObserved,
2597
+ valueIsObservable,
2598
+ tagPropertyKey
2599
+ } = options;
2600
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2601
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2602
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2603
+ this.tagPropertyKey = tagPropertyKey;
2584
2604
  }
2585
2605
 
2586
2606
  getProxy(value) {
2587
2607
  const unwrappedValue = unwrap$1(value);
2588
- const distorted = this.valueDistortion(unwrappedValue);
2589
2608
 
2590
- if (this.valueIsObservable(distorted)) {
2591
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2592
- // we return the readonly.
2609
+ if (this.valueIsObservable(unwrappedValue)) {
2610
+ // When trying to extract the writable version of a readonly we return the readonly.
2611
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2612
+ return value;
2613
+ }
2593
2614
 
2594
- return o.readOnly === value ? value : o.reactive;
2615
+ return this.getReactiveHandler(unwrappedValue);
2595
2616
  }
2596
2617
 
2597
- return distorted;
2618
+ return unwrappedValue;
2598
2619
  }
2599
2620
 
2600
2621
  getReadOnlyProxy(value) {
2601
2622
  value = unwrap$1(value);
2602
- const distorted = this.valueDistortion(value);
2603
2623
 
2604
- if (this.valueIsObservable(distorted)) {
2605
- return this.getReactiveState(value, distorted).readOnly;
2624
+ if (this.valueIsObservable(value)) {
2625
+ return this.getReadOnlyHandler(value);
2606
2626
  }
2607
2627
 
2608
- return distorted;
2628
+ return value;
2609
2629
  }
2610
2630
 
2611
2631
  unwrapProxy(p) {
2612
2632
  return unwrap$1(p);
2613
2633
  }
2614
2634
 
2615
- getReactiveState(value, distortedValue) {
2616
- const {
2617
- objectGraph
2618
- } = this;
2619
- let reactiveState = objectGraph.get(distortedValue);
2635
+ getReactiveHandler(value) {
2636
+ let proxy = this.reactiveObjectGraph.get(value);
2620
2637
 
2621
- if (reactiveState) {
2622
- return reactiveState;
2638
+ if (isUndefined(proxy)) {
2639
+ // caching the proxy after the first time it is accessed
2640
+ const handler = new ReactiveProxyHandler(this, value);
2641
+ proxy = new Proxy(createShadowTarget(value), handler);
2642
+ registerProxy(proxy, value);
2643
+ this.reactiveObjectGraph.set(value, proxy);
2623
2644
  }
2624
2645
 
2625
- const membrane = this;
2626
- reactiveState = {
2627
- get reactive() {
2628
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2629
-
2630
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2631
- registerProxy(proxy, value);
2632
- ObjectDefineProperty(this, 'reactive', {
2633
- value: proxy
2634
- });
2635
- return proxy;
2636
- },
2646
+ return proxy;
2647
+ }
2637
2648
 
2638
- get readOnly() {
2639
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2649
+ getReadOnlyHandler(value) {
2650
+ let proxy = this.readOnlyObjectGraph.get(value);
2640
2651
 
2641
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2642
- registerProxy(proxy, value);
2643
- ObjectDefineProperty(this, 'readOnly', {
2644
- value: proxy
2645
- });
2646
- return proxy;
2647
- }
2652
+ if (isUndefined(proxy)) {
2653
+ // caching the proxy after the first time it is accessed
2654
+ const handler = new ReadOnlyHandler(this, value);
2655
+ proxy = new Proxy(createShadowTarget(value), handler);
2656
+ registerProxy(proxy, value);
2657
+ this.readOnlyObjectGraph.set(value, proxy);
2658
+ }
2648
2659
 
2649
- };
2650
- objectGraph.set(distortedValue, reactiveState);
2651
- return reactiveState;
2660
+ return proxy;
2652
2661
  }
2653
2662
 
2654
2663
  }
2655
- /** version: 1.0.0 */
2664
+ /** version: 2.0.0 */
2656
2665
 
2657
2666
  /*
2658
2667
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2663,15 +2672,9 @@ class ReactiveMembrane {
2663
2672
 
2664
2673
 
2665
2674
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2666
-
2667
- function valueDistortion(value) {
2668
- return value;
2669
- }
2670
-
2671
- const reactiveMembrane = new ReactiveMembrane({
2675
+ const reactiveMembrane = new ObservableMembrane({
2672
2676
  valueObserved,
2673
2677
  valueMutated,
2674
- valueDistortion,
2675
2678
  tagPropertyKey: lockerLivePropertyKey
2676
2679
  });
2677
2680
  /**
@@ -2680,16 +2683,9 @@ const reactiveMembrane = new ReactiveMembrane({
2680
2683
  * change or being removed.
2681
2684
  */
2682
2685
 
2683
- const unwrap = function (value) {
2684
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2685
-
2686
- if (unwrapped !== value) {
2687
- // if value is a proxy, unwrap to access original value and apply distortion
2688
- return valueDistortion(unwrapped);
2689
- }
2690
-
2691
- return value;
2692
- };
2686
+ function unwrap(value) {
2687
+ return reactiveMembrane.unwrapProxy(value);
2688
+ }
2693
2689
  /*
2694
2690
  * Copyright (c) 2018, salesforce.com, inc.
2695
2691
  * All rights reserved.
@@ -4684,7 +4680,7 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4684
4680
  for (const [attrName, attrValue] of Object.entries(attrs)) {
4685
4681
  const elmAttrValue = renderer.getAttribute(elm, attrName);
4686
4682
 
4687
- if (attrValue !== elmAttrValue) {
4683
+ if (String(attrValue) !== elmAttrValue) {
4688
4684
  logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
4689
4685
  nodesAreCompatible = false;
4690
4686
  }
@@ -4706,7 +4702,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4706
4702
  let nodesAreCompatible = true;
4707
4703
  let vnodeClassName;
4708
4704
 
4709
- if (!isUndefined$1(className) && className !== elm.className) {
4705
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4710
4706
  // className is used when class is bound to an expr.
4711
4707
  nodesAreCompatible = false;
4712
4708
  vnodeClassName = className;
@@ -5507,7 +5503,7 @@ function co(text) {
5507
5503
 
5508
5504
 
5509
5505
  function d(value) {
5510
- return value == null ? '' : value;
5506
+ return value == null ? '' : String(value);
5511
5507
  } // [b]ind function
5512
5508
 
5513
5509
 
@@ -5798,6 +5794,7 @@ function updateStylesheetToken(vm, template) {
5798
5794
 
5799
5795
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5800
5796
  const content = [];
5797
+ let root;
5801
5798
 
5802
5799
  for (let i = 0; i < stylesheets.length; i++) {
5803
5800
  let stylesheet = stylesheets[i];
@@ -5810,23 +5807,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5810
5807
  // the component instance might be attempting to use an old version of
5811
5808
  // the stylesheet, while internally, we have a replacement for it.
5812
5809
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5813
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5814
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5810
+ }
5811
+
5812
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5815
5813
 
5814
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5815
+ /* Synthetic */
5816
+ && vm.renderMode === 1
5817
+ /* Shadow */
5818
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5819
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5816
5820
 
5817
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5818
5821
  const useActualHostSelector = vm.renderMode === 0
5819
5822
  /* Light */
5820
5823
  ? !isScopedCss : vm.shadowMode === 0
5821
5824
  /* Native */
5822
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5825
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5826
+ // we use an attribute selector on the host to simulate :dir().
5823
5827
 
5824
- const scopeToken = isScopedCss || vm.shadowMode === 1
5825
- /* Synthetic */
5826
- && vm.renderMode === 1
5828
+ let useNativeDirPseudoclass;
5829
+
5830
+ if (vm.renderMode === 1
5827
5831
  /* Shadow */
5828
- ? stylesheetToken : undefined;
5829
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5832
+ ) {
5833
+ useNativeDirPseudoclass = vm.shadowMode === 0
5834
+ /* Native */
5835
+ ;
5836
+ } else {
5837
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5838
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5839
+ if (isUndefined$1(root)) {
5840
+ // Only calculate the root once as necessary
5841
+ root = getNearestShadowComponent(vm);
5842
+ }
5843
+
5844
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5845
+ /* Native */
5846
+ ;
5847
+ }
5848
+
5849
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5830
5850
  }
5831
5851
  }
5832
5852
 
@@ -5850,14 +5870,12 @@ function getStylesheetsContent(vm, template) {
5850
5870
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5851
5871
 
5852
5872
 
5853
- function getNearestNativeShadowComponent(vm) {
5873
+ function getNearestShadowComponent(vm) {
5854
5874
  let owner = vm;
5855
5875
 
5856
5876
  while (!isNull(owner)) {
5857
5877
  if (owner.renderMode === 1
5858
5878
  /* Shadow */
5859
- && owner.shadowMode === 0
5860
- /* Native */
5861
5879
  ) {
5862
5880
  return owner;
5863
5881
  }
@@ -5868,6 +5886,20 @@ function getNearestNativeShadowComponent(vm) {
5868
5886
  return owner;
5869
5887
  }
5870
5888
 
5889
+ function getNearestNativeShadowComponent(vm) {
5890
+ const owner = getNearestShadowComponent(vm);
5891
+
5892
+ if (!isNull(owner) && owner.shadowMode === 1
5893
+ /* Synthetic */
5894
+ ) {
5895
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5896
+ // synthetic, we know we won't find a native component if we go any further.
5897
+ return null;
5898
+ }
5899
+
5900
+ return owner;
5901
+ }
5902
+
5871
5903
  function createStylesheet(vm, stylesheets) {
5872
5904
  const {
5873
5905
  renderer,
@@ -5883,7 +5915,7 @@ function createStylesheet(vm, stylesheets) {
5883
5915
  for (let i = 0; i < stylesheets.length; i++) {
5884
5916
  renderer.insertGlobalStylesheet(stylesheets[i]);
5885
5917
  }
5886
- } else if (renderer.ssr || renderer.isHydrating) {
5918
+ } else if (renderer.ssr || renderer.isHydrating()) {
5887
5919
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5888
5920
  // This works in the client, because the stylesheets are created, and cached in the VM
5889
5921
  // the first time the VM renders.
@@ -7532,7 +7564,7 @@ function setHooks(hooks) {
7532
7564
  hooksAreSet = true;
7533
7565
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7534
7566
  }
7535
- /* version: 2.5.8 */
7567
+ /* version: 2.6.1 */
7536
7568
 
7537
7569
  /*
7538
7570
  * Copyright (c) 2020, salesforce.com, inc.
@@ -7625,7 +7657,7 @@ class HTMLElement$1 {
7625
7657
  const renderer = {
7626
7658
  ssr: true,
7627
7659
 
7628
- get isHydrating() {
7660
+ isHydrating() {
7629
7661
  return false;
7630
7662
  },
7631
7663
 
@@ -8028,7 +8060,7 @@ function renderComponent(tagName, Ctor, props = {}) {
8028
8060
 
8029
8061
  freeze(LightningElement);
8030
8062
  seal(LightningElement.prototype);
8031
- /* version: 2.5.8 */
8063
+ /* version: 2.6.1 */
8032
8064
 
8033
8065
  exports.LightningElement = LightningElement;
8034
8066
  exports.api = api$1;