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();
@@ -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.10-alpha1 */
302
+ /** version: 2.7.0 */
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.10-alpha1 */
481
+ /** version: 2.7.0 */
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.
@@ -4693,13 +4689,15 @@ function updateElmHook(oldVnode, vnode) {
4693
4689
 
4694
4690
  function updateChildrenHook(oldVnode, vnode) {
4695
4691
  const {
4696
- children,
4697
- owner
4692
+ elm,
4693
+ children
4698
4694
  } = vnode;
4699
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4700
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4701
- fn(vnode.elm, oldVnode.children, children);
4702
- }, noop);
4695
+
4696
+ if (hasDynamicChildren(children)) {
4697
+ updateDynamicChildren(elm, oldVnode.children, children);
4698
+ } else {
4699
+ updateStaticChildren(elm, oldVnode.children, children);
4700
+ }
4703
4701
  }
4704
4702
 
4705
4703
  function allocateChildrenHook(vnode, vm) {
@@ -5937,6 +5935,7 @@ function updateStylesheetToken(vm, template) {
5937
5935
 
5938
5936
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5939
5937
  const content = [];
5938
+ let root;
5940
5939
 
5941
5940
  for (let i = 0; i < stylesheets.length; i++) {
5942
5941
  let stylesheet = stylesheets[i];
@@ -5949,23 +5948,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5949
5948
  // the component instance might be attempting to use an old version of
5950
5949
  // the stylesheet, while internally, we have a replacement for it.
5951
5950
  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`.
5951
+ }
5954
5952
 
5953
+ 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
+
5955
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5956
+ /* Synthetic */
5957
+ && vm.renderMode === 1
5958
+ /* Shadow */
5959
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5960
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5955
5961
 
5956
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5957
5962
  const useActualHostSelector = vm.renderMode === 0
5958
5963
  /* Light */
5959
5964
  ? !isScopedCss : vm.shadowMode === 0
5960
5965
  /* Native */
5961
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5966
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5967
+ // we use an attribute selector on the host to simulate :dir().
5962
5968
 
5963
- const scopeToken = isScopedCss || vm.shadowMode === 1
5964
- /* Synthetic */
5965
- && vm.renderMode === 1
5969
+ let useNativeDirPseudoclass;
5970
+
5971
+ if (vm.renderMode === 1
5966
5972
  /* Shadow */
5967
- ? stylesheetToken : undefined;
5968
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5973
+ ) {
5974
+ useNativeDirPseudoclass = vm.shadowMode === 0
5975
+ /* Native */
5976
+ ;
5977
+ } else {
5978
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5979
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5980
+ if (isUndefined$1(root)) {
5981
+ // Only calculate the root once as necessary
5982
+ root = getNearestShadowComponent(vm);
5983
+ }
5984
+
5985
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5986
+ /* Native */
5987
+ ;
5988
+ }
5989
+
5990
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5969
5991
  }
5970
5992
  }
5971
5993
 
@@ -5989,14 +6011,12 @@ function getStylesheetsContent(vm, template) {
5989
6011
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5990
6012
 
5991
6013
 
5992
- function getNearestNativeShadowComponent(vm) {
6014
+ function getNearestShadowComponent(vm) {
5993
6015
  let owner = vm;
5994
6016
 
5995
6017
  while (!isNull(owner)) {
5996
6018
  if (owner.renderMode === 1
5997
6019
  /* Shadow */
5998
- && owner.shadowMode === 0
5999
- /* Native */
6000
6020
  ) {
6001
6021
  return owner;
6002
6022
  }
@@ -6007,6 +6027,20 @@ function getNearestNativeShadowComponent(vm) {
6007
6027
  return owner;
6008
6028
  }
6009
6029
 
6030
+ function getNearestNativeShadowComponent(vm) {
6031
+ const owner = getNearestShadowComponent(vm);
6032
+
6033
+ if (!isNull(owner) && owner.shadowMode === 1
6034
+ /* Synthetic */
6035
+ ) {
6036
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6037
+ // synthetic, we know we won't find a native component if we go any further.
6038
+ return null;
6039
+ }
6040
+
6041
+ return owner;
6042
+ }
6043
+
6010
6044
  function createStylesheet(vm, stylesheets) {
6011
6045
  const {
6012
6046
  renderer,
@@ -6124,7 +6158,7 @@ function logOperationStart(opId, vm) {
6124
6158
  if (isProfilerEnabled) {
6125
6159
  currentDispatcher(opId, 0
6126
6160
  /* Start */
6127
- , vm.tagName, vm.idx);
6161
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6128
6162
  }
6129
6163
  }
6130
6164
 
@@ -6138,7 +6172,7 @@ function logOperationEnd(opId, vm) {
6138
6172
  if (isProfilerEnabled) {
6139
6173
  currentDispatcher(opId, 1
6140
6174
  /* Stop */
6141
- , vm.tagName, vm.idx);
6175
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6142
6176
  }
6143
6177
  }
6144
6178
 
@@ -6152,7 +6186,7 @@ function logGlobalOperationStart(opId, vm) {
6152
6186
  if (isProfilerEnabled) {
6153
6187
  currentDispatcher(opId, 0
6154
6188
  /* Start */
6155
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6189
+ , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
6156
6190
  }
6157
6191
  }
6158
6192
 
@@ -6166,7 +6200,7 @@ function logGlobalOperationEnd(opId, vm) {
6166
6200
  if (isProfilerEnabled) {
6167
6201
  currentDispatcher(opId, 1
6168
6202
  /* Stop */
6169
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6203
+ , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
6170
6204
  }
6171
6205
  }
6172
6206
  /*
@@ -7747,7 +7781,7 @@ function setHooks(hooks) {
7747
7781
  hooksAreSet = true;
7748
7782
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7749
7783
  }
7750
- /* version: 2.5.10-alpha1 */
7784
+ /* version: 2.7.0 */
7751
7785
 
7752
7786
  /*
7753
7787
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8403,6 +8437,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8403
8437
  });
8404
8438
  freeze(LightningElement);
8405
8439
  seal(LightningElement.prototype);
8406
- /* version: 2.5.10-alpha1 */
8440
+ /* version: 2.7.0 */
8407
8441
 
8408
8442
  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 };