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();
@@ -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.8 */
338
+ /** version: 2.6.1 */
339
339
 
340
340
  /*
341
341
  * Copyright (c) 2020, salesforce.com, inc.
@@ -390,7 +390,6 @@ const features = {
390
390
  ENABLE_NODE_LIST_PATCH: null,
391
391
  ENABLE_HTML_COLLECTIONS_PATCH: null,
392
392
  ENABLE_NODE_PATCH: null,
393
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
394
393
  ENABLE_MIXED_SHADOW_MODE: null,
395
394
  ENABLE_WIRE_SYNC_EMIT: null
396
395
  };
@@ -456,7 +455,7 @@ function setFeatureFlagForTest(name, value) {
456
455
  setFeatureFlag(name, value);
457
456
  }
458
457
  }
459
- /** version: 2.5.8 */
458
+ /** version: 2.6.1 */
460
459
 
461
460
  /* proxy-compat-disable */
462
461
 
@@ -1903,10 +1902,10 @@ const {
1903
1902
  isArray
1904
1903
  } = Array;
1905
1904
  const {
1905
+ prototype: ObjectDotPrototype,
1906
1906
  getPrototypeOf,
1907
1907
  create: ObjectCreate,
1908
1908
  defineProperty: ObjectDefineProperty,
1909
- defineProperties: ObjectDefineProperties,
1910
1909
  isExtensible,
1911
1910
  getOwnPropertyDescriptor,
1912
1911
  getOwnPropertyNames,
@@ -1916,8 +1915,7 @@ const {
1916
1915
  } = Object;
1917
1916
  const {
1918
1917
  push: ArrayPush,
1919
- concat: ArrayConcat,
1920
- map: ArrayMap
1918
+ concat: ArrayConcat
1921
1919
  } = Array.prototype;
1922
1920
  const OtS = {}.toString;
1923
1921
 
@@ -1982,7 +1980,9 @@ class BaseProxyHandler {
1982
1980
  // but it will always be compatible with the previous descriptor
1983
1981
  // to preserve the object invariants, which makes these lines safe.
1984
1982
 
1985
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1983
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
1984
+
1985
+ /* istanbul ignore else */
1986
1986
 
1987
1987
  if (!isUndefined(originalDescriptor)) {
1988
1988
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2010,11 +2010,17 @@ class BaseProxyHandler {
2010
2010
 
2011
2011
  preventExtensions(shadowTarget);
2012
2012
  } // Shared Traps
2013
+ // TODO: apply() is never called
2014
+
2015
+ /* istanbul ignore next */
2013
2016
 
2014
2017
 
2015
2018
  apply(shadowTarget, thisArg, argArray) {
2016
2019
  /* No op */
2017
- }
2020
+ } // TODO: construct() is never called
2021
+
2022
+ /* istanbul ignore next */
2023
+
2018
2024
 
2019
2025
  construct(shadowTarget, argArray, newTarget) {
2020
2026
  /* No op */
@@ -2127,8 +2133,8 @@ class BaseProxyHandler {
2127
2133
 
2128
2134
  }
2129
2135
 
2130
- const getterMap = new WeakMap();
2131
- const setterMap = new WeakMap();
2136
+ const getterMap$1 = new WeakMap();
2137
+ const setterMap$1 = new WeakMap();
2132
2138
  const reverseGetterMap = new WeakMap();
2133
2139
  const reverseSetterMap = new WeakMap();
2134
2140
 
@@ -2138,7 +2144,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2138
2144
  }
2139
2145
 
2140
2146
  wrapGetter(originalGet) {
2141
- const wrappedGetter = getterMap.get(originalGet);
2147
+ const wrappedGetter = getterMap$1.get(originalGet);
2142
2148
 
2143
2149
  if (!isUndefined(wrappedGetter)) {
2144
2150
  return wrappedGetter;
@@ -2151,13 +2157,13 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2151
2157
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2152
2158
  };
2153
2159
 
2154
- getterMap.set(originalGet, get);
2160
+ getterMap$1.set(originalGet, get);
2155
2161
  reverseGetterMap.set(get, originalGet);
2156
2162
  return get;
2157
2163
  }
2158
2164
 
2159
2165
  wrapSetter(originalSet) {
2160
- const wrappedSetter = setterMap.get(originalSet);
2166
+ const wrappedSetter = setterMap$1.get(originalSet);
2161
2167
 
2162
2168
  if (!isUndefined(wrappedSetter)) {
2163
2169
  return wrappedSetter;
@@ -2168,7 +2174,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2168
2174
  originalSet.call(unwrap$1(this), unwrap$1(v));
2169
2175
  };
2170
2176
 
2171
- setterMap.set(originalSet, set);
2177
+ setterMap$1.set(originalSet, set);
2172
2178
  reverseSetterMap.set(set, originalSet);
2173
2179
  return set;
2174
2180
  }
@@ -2209,7 +2215,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2209
2215
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2210
2216
  };
2211
2217
 
2212
- getterMap.set(get, redGet);
2218
+ getterMap$1.set(get, redGet);
2213
2219
  reverseGetterMap.set(redGet, get);
2214
2220
  return get;
2215
2221
  }
@@ -2228,7 +2234,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2228
2234
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2229
2235
  };
2230
2236
 
2231
- setterMap.set(set, redSet);
2237
+ setterMap$1.set(set, redSet);
2232
2238
  reverseSetterMap.set(redSet, set);
2233
2239
  return set;
2234
2240
  }
@@ -2269,6 +2275,7 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2269
2275
  }
2270
2276
 
2271
2277
  setPrototypeOf(shadowTarget, prototype) {
2278
+ /* istanbul ignore else */
2272
2279
  if (process.env.NODE_ENV !== 'production') {
2273
2280
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2274
2281
  }
@@ -2282,6 +2289,11 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2282
2289
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2283
2290
  // the preventExtension call, in which case we should not attempt to lock down
2284
2291
  // the shadow target.
2292
+ // TODO: It should not actually be possible to reach this `if` statement.
2293
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2294
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2295
+
2296
+ /* istanbul ignore if */
2285
2297
 
2286
2298
  if (isExtensible(originalTarget)) {
2287
2299
  return false;
@@ -2323,8 +2335,8 @@ class ReactiveProxyHandler extends BaseProxyHandler {
2323
2335
 
2324
2336
  }
2325
2337
 
2326
- const getterMap$1 = new WeakMap();
2327
- const setterMap$1 = new WeakMap();
2338
+ const getterMap = new WeakMap();
2339
+ const setterMap = new WeakMap();
2328
2340
 
2329
2341
  class ReadOnlyHandler extends BaseProxyHandler {
2330
2342
  wrapValue(value) {
@@ -2332,7 +2344,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2332
2344
  }
2333
2345
 
2334
2346
  wrapGetter(originalGet) {
2335
- const wrappedGetter = getterMap$1.get(originalGet);
2347
+ const wrappedGetter = getterMap.get(originalGet);
2336
2348
 
2337
2349
  if (!isUndefined(wrappedGetter)) {
2338
2350
  return wrappedGetter;
@@ -2345,12 +2357,12 @@ class ReadOnlyHandler extends BaseProxyHandler {
2345
2357
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2346
2358
  };
2347
2359
 
2348
- getterMap$1.set(originalGet, get);
2360
+ getterMap.set(originalGet, get);
2349
2361
  return get;
2350
2362
  }
2351
2363
 
2352
2364
  wrapSetter(originalSet) {
2353
- const wrappedSetter = setterMap$1.get(originalSet);
2365
+ const wrappedSetter = setterMap.get(originalSet);
2354
2366
 
2355
2367
  if (!isUndefined(wrappedSetter)) {
2356
2368
  return wrappedSetter;
@@ -2359,6 +2371,7 @@ class ReadOnlyHandler extends BaseProxyHandler {
2359
2371
  const handler = this;
2360
2372
 
2361
2373
  const set = function (v) {
2374
+ /* istanbul ignore else */
2362
2375
  if (process.env.NODE_ENV !== 'production') {
2363
2376
  const {
2364
2377
  originalTarget
@@ -2367,33 +2380,41 @@ class ReadOnlyHandler extends BaseProxyHandler {
2367
2380
  }
2368
2381
  };
2369
2382
 
2370
- setterMap$1.set(originalSet, set);
2383
+ setterMap.set(originalSet, set);
2371
2384
  return set;
2372
2385
  }
2373
2386
 
2374
2387
  set(shadowTarget, key, value) {
2388
+ /* istanbul ignore else */
2375
2389
  if (process.env.NODE_ENV !== 'production') {
2376
2390
  const {
2377
2391
  originalTarget
2378
2392
  } = this;
2379
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2393
+ 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.`;
2394
+ throw new Error(msg);
2380
2395
  }
2396
+ /* istanbul ignore next */
2397
+
2381
2398
 
2382
2399
  return false;
2383
2400
  }
2384
2401
 
2385
2402
  deleteProperty(shadowTarget, key) {
2403
+ /* istanbul ignore else */
2386
2404
  if (process.env.NODE_ENV !== 'production') {
2387
2405
  const {
2388
2406
  originalTarget
2389
2407
  } = this;
2390
2408
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2391
2409
  }
2410
+ /* istanbul ignore next */
2411
+
2392
2412
 
2393
2413
  return false;
2394
2414
  }
2395
2415
 
2396
2416
  setPrototypeOf(shadowTarget, prototype) {
2417
+ /* istanbul ignore else */
2397
2418
  if (process.env.NODE_ENV !== 'production') {
2398
2419
  const {
2399
2420
  originalTarget
@@ -2403,23 +2424,29 @@ class ReadOnlyHandler extends BaseProxyHandler {
2403
2424
  }
2404
2425
 
2405
2426
  preventExtensions(shadowTarget) {
2427
+ /* istanbul ignore else */
2406
2428
  if (process.env.NODE_ENV !== 'production') {
2407
2429
  const {
2408
2430
  originalTarget
2409
2431
  } = this;
2410
2432
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2411
2433
  }
2434
+ /* istanbul ignore next */
2435
+
2412
2436
 
2413
2437
  return false;
2414
2438
  }
2415
2439
 
2416
2440
  defineProperty(shadowTarget, key, descriptor) {
2441
+ /* istanbul ignore else */
2417
2442
  if (process.env.NODE_ENV !== 'production') {
2418
2443
  const {
2419
2444
  originalTarget
2420
2445
  } = this;
2421
2446
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2422
2447
  }
2448
+ /* istanbul ignore next */
2449
+
2423
2450
 
2424
2451
  return false;
2425
2452
  }
@@ -2477,6 +2504,8 @@ const formatter = {
2477
2504
  }; // Inspired from paulmillr/es6-shim
2478
2505
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2479
2506
 
2507
+ /* istanbul ignore next */
2508
+
2480
2509
  function getGlobal() {
2481
2510
  // the only reliable means to get the global object is `Function('return this')()`
2482
2511
  // However, this causes CSP violations in Chrome apps.
@@ -2501,6 +2530,7 @@ function getGlobal() {
2501
2530
  }
2502
2531
 
2503
2532
  function init() {
2533
+ /* istanbul ignore if */
2504
2534
  if (process.env.NODE_ENV === 'production') {
2505
2535
  // this method should never leak to prod
2506
2536
  throw new ReferenceError();
@@ -2515,13 +2545,13 @@ function init() {
2515
2545
  ArrayPush.call(devtoolsFormatters, formatter);
2516
2546
  global.devtoolsFormatters = devtoolsFormatters;
2517
2547
  }
2548
+ /* istanbul ignore else */
2549
+
2518
2550
 
2519
2551
  if (process.env.NODE_ENV !== 'production') {
2520
2552
  init();
2521
2553
  }
2522
2554
 
2523
- const ObjectDotPrototype = Object.prototype;
2524
-
2525
2555
  function defaultValueIsObservable(value) {
2526
2556
  // intentionally checking for null
2527
2557
  if (value === null) {
@@ -2549,106 +2579,85 @@ const defaultValueMutated = (obj, key) => {
2549
2579
  /* do nothing */
2550
2580
  };
2551
2581
 
2552
- const defaultValueDistortion = value => value;
2553
-
2554
2582
  function createShadowTarget(value) {
2555
2583
  return isArray(value) ? [] : {};
2556
2584
  }
2557
2585
 
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
- }
2586
+ class ObservableMembrane {
2587
+ constructor(options = {}) {
2588
+ this.readOnlyObjectGraph = new WeakMap();
2589
+ this.reactiveObjectGraph = new WeakMap();
2590
+ const {
2591
+ valueMutated,
2592
+ valueObserved,
2593
+ valueIsObservable,
2594
+ tagPropertyKey
2595
+ } = options;
2596
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2597
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2598
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2599
+ this.tagPropertyKey = tagPropertyKey;
2580
2600
  }
2581
2601
 
2582
2602
  getProxy(value) {
2583
2603
  const unwrappedValue = unwrap$1(value);
2584
- const distorted = this.valueDistortion(unwrappedValue);
2585
2604
 
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.
2605
+ if (this.valueIsObservable(unwrappedValue)) {
2606
+ // When trying to extract the writable version of a readonly we return the readonly.
2607
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2608
+ return value;
2609
+ }
2589
2610
 
2590
- return o.readOnly === value ? value : o.reactive;
2611
+ return this.getReactiveHandler(unwrappedValue);
2591
2612
  }
2592
2613
 
2593
- return distorted;
2614
+ return unwrappedValue;
2594
2615
  }
2595
2616
 
2596
2617
  getReadOnlyProxy(value) {
2597
2618
  value = unwrap$1(value);
2598
- const distorted = this.valueDistortion(value);
2599
2619
 
2600
- if (this.valueIsObservable(distorted)) {
2601
- return this.getReactiveState(value, distorted).readOnly;
2620
+ if (this.valueIsObservable(value)) {
2621
+ return this.getReadOnlyHandler(value);
2602
2622
  }
2603
2623
 
2604
- return distorted;
2624
+ return value;
2605
2625
  }
2606
2626
 
2607
2627
  unwrapProxy(p) {
2608
2628
  return unwrap$1(p);
2609
2629
  }
2610
2630
 
2611
- getReactiveState(value, distortedValue) {
2612
- const {
2613
- objectGraph
2614
- } = this;
2615
- let reactiveState = objectGraph.get(distortedValue);
2631
+ getReactiveHandler(value) {
2632
+ let proxy = this.reactiveObjectGraph.get(value);
2616
2633
 
2617
- if (reactiveState) {
2618
- return reactiveState;
2634
+ if (isUndefined(proxy)) {
2635
+ // caching the proxy after the first time it is accessed
2636
+ const handler = new ReactiveProxyHandler(this, value);
2637
+ proxy = new Proxy(createShadowTarget(value), handler);
2638
+ registerProxy(proxy, value);
2639
+ this.reactiveObjectGraph.set(value, proxy);
2619
2640
  }
2620
2641
 
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
- },
2642
+ return proxy;
2643
+ }
2633
2644
 
2634
- get readOnly() {
2635
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2645
+ getReadOnlyHandler(value) {
2646
+ let proxy = this.readOnlyObjectGraph.get(value);
2636
2647
 
2637
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2638
- registerProxy(proxy, value);
2639
- ObjectDefineProperty(this, 'readOnly', {
2640
- value: proxy
2641
- });
2642
- return proxy;
2643
- }
2648
+ if (isUndefined(proxy)) {
2649
+ // caching the proxy after the first time it is accessed
2650
+ const handler = new ReadOnlyHandler(this, value);
2651
+ proxy = new Proxy(createShadowTarget(value), handler);
2652
+ registerProxy(proxy, value);
2653
+ this.readOnlyObjectGraph.set(value, proxy);
2654
+ }
2644
2655
 
2645
- };
2646
- objectGraph.set(distortedValue, reactiveState);
2647
- return reactiveState;
2656
+ return proxy;
2648
2657
  }
2649
2658
 
2650
2659
  }
2651
- /** version: 1.0.0 */
2660
+ /** version: 2.0.0 */
2652
2661
 
2653
2662
  /*
2654
2663
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2659,15 +2668,9 @@ class ReactiveMembrane {
2659
2668
 
2660
2669
 
2661
2670
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2662
-
2663
- function valueDistortion(value) {
2664
- return value;
2665
- }
2666
-
2667
- const reactiveMembrane = new ReactiveMembrane({
2671
+ const reactiveMembrane = new ObservableMembrane({
2668
2672
  valueObserved,
2669
2673
  valueMutated,
2670
- valueDistortion,
2671
2674
  tagPropertyKey: lockerLivePropertyKey
2672
2675
  });
2673
2676
  /**
@@ -2676,16 +2679,9 @@ const reactiveMembrane = new ReactiveMembrane({
2676
2679
  * change or being removed.
2677
2680
  */
2678
2681
 
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
- };
2682
+ function unwrap(value) {
2683
+ return reactiveMembrane.unwrapProxy(value);
2684
+ }
2689
2685
  /*
2690
2686
  * Copyright (c) 2018, salesforce.com, inc.
2691
2687
  * All rights reserved.
@@ -4680,7 +4676,7 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
4680
4676
  for (const [attrName, attrValue] of Object.entries(attrs)) {
4681
4677
  const elmAttrValue = renderer.getAttribute(elm, attrName);
4682
4678
 
4683
- if (attrValue !== elmAttrValue) {
4679
+ if (String(attrValue) !== elmAttrValue) {
4684
4680
  logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
4685
4681
  nodesAreCompatible = false;
4686
4682
  }
@@ -4702,7 +4698,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
4702
4698
  let nodesAreCompatible = true;
4703
4699
  let vnodeClassName;
4704
4700
 
4705
- if (!isUndefined$1(className) && className !== elm.className) {
4701
+ if (!isUndefined$1(className) && String(className) !== elm.className) {
4706
4702
  // className is used when class is bound to an expr.
4707
4703
  nodesAreCompatible = false;
4708
4704
  vnodeClassName = className;
@@ -5503,7 +5499,7 @@ function co(text) {
5503
5499
 
5504
5500
 
5505
5501
  function d(value) {
5506
- return value == null ? '' : value;
5502
+ return value == null ? '' : String(value);
5507
5503
  } // [b]ind function
5508
5504
 
5509
5505
 
@@ -5794,6 +5790,7 @@ function updateStylesheetToken(vm, template) {
5794
5790
 
5795
5791
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5796
5792
  const content = [];
5793
+ let root;
5797
5794
 
5798
5795
  for (let i = 0; i < stylesheets.length; i++) {
5799
5796
  let stylesheet = stylesheets[i];
@@ -5806,23 +5803,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5806
5803
  // the component instance might be attempting to use an old version of
5807
5804
  // the stylesheet, while internally, we have a replacement for it.
5808
5805
  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`.
5806
+ }
5807
+
5808
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5811
5809
 
5810
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5811
+ /* Synthetic */
5812
+ && vm.renderMode === 1
5813
+ /* Shadow */
5814
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5815
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5812
5816
 
5813
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5814
5817
  const useActualHostSelector = vm.renderMode === 0
5815
5818
  /* Light */
5816
5819
  ? !isScopedCss : vm.shadowMode === 0
5817
5820
  /* Native */
5818
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5821
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5822
+ // we use an attribute selector on the host to simulate :dir().
5819
5823
 
5820
- const scopeToken = isScopedCss || vm.shadowMode === 1
5821
- /* Synthetic */
5822
- && vm.renderMode === 1
5824
+ let useNativeDirPseudoclass;
5825
+
5826
+ if (vm.renderMode === 1
5823
5827
  /* Shadow */
5824
- ? stylesheetToken : undefined;
5825
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5828
+ ) {
5829
+ useNativeDirPseudoclass = vm.shadowMode === 0
5830
+ /* Native */
5831
+ ;
5832
+ } else {
5833
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5834
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5835
+ if (isUndefined$1(root)) {
5836
+ // Only calculate the root once as necessary
5837
+ root = getNearestShadowComponent(vm);
5838
+ }
5839
+
5840
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5841
+ /* Native */
5842
+ ;
5843
+ }
5844
+
5845
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5826
5846
  }
5827
5847
  }
5828
5848
 
@@ -5846,14 +5866,12 @@ function getStylesheetsContent(vm, template) {
5846
5866
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5847
5867
 
5848
5868
 
5849
- function getNearestNativeShadowComponent(vm) {
5869
+ function getNearestShadowComponent(vm) {
5850
5870
  let owner = vm;
5851
5871
 
5852
5872
  while (!isNull(owner)) {
5853
5873
  if (owner.renderMode === 1
5854
5874
  /* Shadow */
5855
- && owner.shadowMode === 0
5856
- /* Native */
5857
5875
  ) {
5858
5876
  return owner;
5859
5877
  }
@@ -5864,6 +5882,20 @@ function getNearestNativeShadowComponent(vm) {
5864
5882
  return owner;
5865
5883
  }
5866
5884
 
5885
+ function getNearestNativeShadowComponent(vm) {
5886
+ const owner = getNearestShadowComponent(vm);
5887
+
5888
+ if (!isNull(owner) && owner.shadowMode === 1
5889
+ /* Synthetic */
5890
+ ) {
5891
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5892
+ // synthetic, we know we won't find a native component if we go any further.
5893
+ return null;
5894
+ }
5895
+
5896
+ return owner;
5897
+ }
5898
+
5867
5899
  function createStylesheet(vm, stylesheets) {
5868
5900
  const {
5869
5901
  renderer,
@@ -5879,7 +5911,7 @@ function createStylesheet(vm, stylesheets) {
5879
5911
  for (let i = 0; i < stylesheets.length; i++) {
5880
5912
  renderer.insertGlobalStylesheet(stylesheets[i]);
5881
5913
  }
5882
- } else if (renderer.ssr || renderer.isHydrating) {
5914
+ } else if (renderer.ssr || renderer.isHydrating()) {
5883
5915
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
5884
5916
  // This works in the client, because the stylesheets are created, and cached in the VM
5885
5917
  // the first time the VM renders.
@@ -7528,7 +7560,7 @@ function setHooks(hooks) {
7528
7560
  hooksAreSet = true;
7529
7561
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7530
7562
  }
7531
- /* version: 2.5.8 */
7563
+ /* version: 2.6.1 */
7532
7564
 
7533
7565
  /*
7534
7566
  * Copyright (c) 2020, salesforce.com, inc.
@@ -7621,7 +7653,7 @@ class HTMLElement$1 {
7621
7653
  const renderer = {
7622
7654
  ssr: true,
7623
7655
 
7624
- get isHydrating() {
7656
+ isHydrating() {
7625
7657
  return false;
7626
7658
  },
7627
7659
 
@@ -8024,6 +8056,6 @@ function renderComponent(tagName, Ctor, props = {}) {
8024
8056
 
8025
8057
  freeze(LightningElement);
8026
8058
  seal(LightningElement.prototype);
8027
- /* version: 2.5.8 */
8059
+ /* version: 2.6.1 */
8028
8060
 
8029
8061
  export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };