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
@@ -72,7 +72,7 @@ var LWC = (function (exports) {
72
72
  find: ArrayFind,
73
73
  indexOf: ArrayIndexOf,
74
74
  join: ArrayJoin,
75
- map: ArrayMap$1,
75
+ map: ArrayMap,
76
76
  push: ArrayPush$1,
77
77
  reduce: ArrayReduce,
78
78
  reverse: ArrayReverse,
@@ -139,7 +139,7 @@ var LWC = (function (exports) {
139
139
  // Array.prototype.toString directly will cause an error Iterate through
140
140
  // all the items and handle individually.
141
141
  if (isArray$1(obj)) {
142
- return ArrayJoin.call(ArrayMap$1.call(obj, toString$1), ',');
142
+ return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
143
143
  }
144
144
 
145
145
  return obj.toString();
@@ -302,7 +302,7 @@ var LWC = (function (exports) {
302
302
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
303
303
  return attributeName;
304
304
  }
305
- /** version: 2.5.10-alpha1 */
305
+ /** version: 2.7.0 */
306
306
 
307
307
  /*
308
308
  * Copyright (c) 2018, salesforce.com, inc.
@@ -416,7 +416,6 @@ var LWC = (function (exports) {
416
416
  ENABLE_NODE_LIST_PATCH: null,
417
417
  ENABLE_HTML_COLLECTIONS_PATCH: null,
418
418
  ENABLE_NODE_PATCH: null,
419
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
420
419
  ENABLE_MIXED_SHADOW_MODE: null,
421
420
  ENABLE_WIRE_SYNC_EMIT: null
422
421
  };
@@ -482,7 +481,7 @@ var LWC = (function (exports) {
482
481
  setFeatureFlag(name, value);
483
482
  }
484
483
  }
485
- /** version: 2.5.10-alpha1 */
484
+ /** version: 2.7.0 */
486
485
 
487
486
  /* proxy-compat-disable */
488
487
 
@@ -1929,10 +1928,10 @@ var LWC = (function (exports) {
1929
1928
  isArray
1930
1929
  } = Array;
1931
1930
  const {
1931
+ prototype: ObjectDotPrototype,
1932
1932
  getPrototypeOf,
1933
1933
  create: ObjectCreate,
1934
1934
  defineProperty: ObjectDefineProperty,
1935
- defineProperties: ObjectDefineProperties,
1936
1935
  isExtensible,
1937
1936
  getOwnPropertyDescriptor,
1938
1937
  getOwnPropertyNames,
@@ -1942,8 +1941,7 @@ var LWC = (function (exports) {
1942
1941
  } = Object;
1943
1942
  const {
1944
1943
  push: ArrayPush,
1945
- concat: ArrayConcat,
1946
- map: ArrayMap
1944
+ concat: ArrayConcat
1947
1945
  } = Array.prototype;
1948
1946
  const OtS = {}.toString;
1949
1947
 
@@ -2008,7 +2006,9 @@ var LWC = (function (exports) {
2008
2006
  // but it will always be compatible with the previous descriptor
2009
2007
  // to preserve the object invariants, which makes these lines safe.
2010
2008
 
2011
- const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
2009
+ const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
2010
+
2011
+ /* istanbul ignore else */
2012
2012
 
2013
2013
  if (!isUndefined(originalDescriptor)) {
2014
2014
  const wrappedDesc = this.wrapDescriptor(originalDescriptor);
@@ -2036,11 +2036,17 @@ var LWC = (function (exports) {
2036
2036
 
2037
2037
  preventExtensions(shadowTarget);
2038
2038
  } // Shared Traps
2039
+ // TODO: apply() is never called
2040
+
2041
+ /* istanbul ignore next */
2039
2042
 
2040
2043
 
2041
2044
  apply(shadowTarget, thisArg, argArray) {
2042
2045
  /* No op */
2043
- }
2046
+ } // TODO: construct() is never called
2047
+
2048
+ /* istanbul ignore next */
2049
+
2044
2050
 
2045
2051
  construct(shadowTarget, argArray, newTarget) {
2046
2052
  /* No op */
@@ -2153,8 +2159,8 @@ var LWC = (function (exports) {
2153
2159
 
2154
2160
  }
2155
2161
 
2156
- const getterMap = new WeakMap();
2157
- const setterMap = new WeakMap();
2162
+ const getterMap$1 = new WeakMap();
2163
+ const setterMap$1 = new WeakMap();
2158
2164
  const reverseGetterMap = new WeakMap();
2159
2165
  const reverseSetterMap = new WeakMap();
2160
2166
 
@@ -2164,7 +2170,7 @@ var LWC = (function (exports) {
2164
2170
  }
2165
2171
 
2166
2172
  wrapGetter(originalGet) {
2167
- const wrappedGetter = getterMap.get(originalGet);
2173
+ const wrappedGetter = getterMap$1.get(originalGet);
2168
2174
 
2169
2175
  if (!isUndefined(wrappedGetter)) {
2170
2176
  return wrappedGetter;
@@ -2177,13 +2183,13 @@ var LWC = (function (exports) {
2177
2183
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2178
2184
  };
2179
2185
 
2180
- getterMap.set(originalGet, get);
2186
+ getterMap$1.set(originalGet, get);
2181
2187
  reverseGetterMap.set(get, originalGet);
2182
2188
  return get;
2183
2189
  }
2184
2190
 
2185
2191
  wrapSetter(originalSet) {
2186
- const wrappedSetter = setterMap.get(originalSet);
2192
+ const wrappedSetter = setterMap$1.get(originalSet);
2187
2193
 
2188
2194
  if (!isUndefined(wrappedSetter)) {
2189
2195
  return wrappedSetter;
@@ -2194,7 +2200,7 @@ var LWC = (function (exports) {
2194
2200
  originalSet.call(unwrap$1(this), unwrap$1(v));
2195
2201
  };
2196
2202
 
2197
- setterMap.set(originalSet, set);
2203
+ setterMap$1.set(originalSet, set);
2198
2204
  reverseSetterMap.set(set, originalSet);
2199
2205
  return set;
2200
2206
  }
@@ -2235,7 +2241,7 @@ var LWC = (function (exports) {
2235
2241
  return unwrap$1(redGet.call(handler.wrapValue(this)));
2236
2242
  };
2237
2243
 
2238
- getterMap.set(get, redGet);
2244
+ getterMap$1.set(get, redGet);
2239
2245
  reverseGetterMap.set(redGet, get);
2240
2246
  return get;
2241
2247
  }
@@ -2254,7 +2260,7 @@ var LWC = (function (exports) {
2254
2260
  redSet.call(handler.wrapValue(this), handler.wrapValue(v));
2255
2261
  };
2256
2262
 
2257
- setterMap.set(set, redSet);
2263
+ setterMap$1.set(set, redSet);
2258
2264
  reverseSetterMap.set(redSet, set);
2259
2265
  return set;
2260
2266
  }
@@ -2295,6 +2301,7 @@ var LWC = (function (exports) {
2295
2301
  }
2296
2302
 
2297
2303
  setPrototypeOf(shadowTarget, prototype) {
2304
+ /* istanbul ignore else */
2298
2305
  if (process.env.NODE_ENV !== 'production') {
2299
2306
  throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);
2300
2307
  }
@@ -2308,6 +2315,11 @@ var LWC = (function (exports) {
2308
2315
  preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
2309
2316
  // the preventExtension call, in which case we should not attempt to lock down
2310
2317
  // the shadow target.
2318
+ // TODO: It should not actually be possible to reach this `if` statement.
2319
+ // If a proxy rejects extensions, then calling preventExtensions will throw an error:
2320
+ // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
2321
+
2322
+ /* istanbul ignore if */
2311
2323
 
2312
2324
  if (isExtensible(originalTarget)) {
2313
2325
  return false;
@@ -2349,8 +2361,8 @@ var LWC = (function (exports) {
2349
2361
 
2350
2362
  }
2351
2363
 
2352
- const getterMap$1 = new WeakMap();
2353
- const setterMap$1 = new WeakMap();
2364
+ const getterMap = new WeakMap();
2365
+ const setterMap = new WeakMap();
2354
2366
 
2355
2367
  class ReadOnlyHandler extends BaseProxyHandler {
2356
2368
  wrapValue(value) {
@@ -2358,7 +2370,7 @@ var LWC = (function (exports) {
2358
2370
  }
2359
2371
 
2360
2372
  wrapGetter(originalGet) {
2361
- const wrappedGetter = getterMap$1.get(originalGet);
2373
+ const wrappedGetter = getterMap.get(originalGet);
2362
2374
 
2363
2375
  if (!isUndefined(wrappedGetter)) {
2364
2376
  return wrappedGetter;
@@ -2371,12 +2383,12 @@ var LWC = (function (exports) {
2371
2383
  return handler.wrapValue(originalGet.call(unwrap$1(this)));
2372
2384
  };
2373
2385
 
2374
- getterMap$1.set(originalGet, get);
2386
+ getterMap.set(originalGet, get);
2375
2387
  return get;
2376
2388
  }
2377
2389
 
2378
2390
  wrapSetter(originalSet) {
2379
- const wrappedSetter = setterMap$1.get(originalSet);
2391
+ const wrappedSetter = setterMap.get(originalSet);
2380
2392
 
2381
2393
  if (!isUndefined(wrappedSetter)) {
2382
2394
  return wrappedSetter;
@@ -2385,6 +2397,7 @@ var LWC = (function (exports) {
2385
2397
  const handler = this;
2386
2398
 
2387
2399
  const set = function (v) {
2400
+ /* istanbul ignore else */
2388
2401
  if (process.env.NODE_ENV !== 'production') {
2389
2402
  const {
2390
2403
  originalTarget
@@ -2393,33 +2406,41 @@ var LWC = (function (exports) {
2393
2406
  }
2394
2407
  };
2395
2408
 
2396
- setterMap$1.set(originalSet, set);
2409
+ setterMap.set(originalSet, set);
2397
2410
  return set;
2398
2411
  }
2399
2412
 
2400
2413
  set(shadowTarget, key, value) {
2414
+ /* istanbul ignore else */
2401
2415
  if (process.env.NODE_ENV !== 'production') {
2402
2416
  const {
2403
2417
  originalTarget
2404
2418
  } = this;
2405
- throw new Error(`Invalid mutation: Cannot set "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2419
+ 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.`;
2420
+ throw new Error(msg);
2406
2421
  }
2422
+ /* istanbul ignore next */
2423
+
2407
2424
 
2408
2425
  return false;
2409
2426
  }
2410
2427
 
2411
2428
  deleteProperty(shadowTarget, key) {
2429
+ /* istanbul ignore else */
2412
2430
  if (process.env.NODE_ENV !== 'production') {
2413
2431
  const {
2414
2432
  originalTarget
2415
2433
  } = this;
2416
2434
  throw new Error(`Invalid mutation: Cannot delete "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2417
2435
  }
2436
+ /* istanbul ignore next */
2437
+
2418
2438
 
2419
2439
  return false;
2420
2440
  }
2421
2441
 
2422
2442
  setPrototypeOf(shadowTarget, prototype) {
2443
+ /* istanbul ignore else */
2423
2444
  if (process.env.NODE_ENV !== 'production') {
2424
2445
  const {
2425
2446
  originalTarget
@@ -2429,23 +2450,29 @@ var LWC = (function (exports) {
2429
2450
  }
2430
2451
 
2431
2452
  preventExtensions(shadowTarget) {
2453
+ /* istanbul ignore else */
2432
2454
  if (process.env.NODE_ENV !== 'production') {
2433
2455
  const {
2434
2456
  originalTarget
2435
2457
  } = this;
2436
2458
  throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}". "${originalTarget} is read-only.`);
2437
2459
  }
2460
+ /* istanbul ignore next */
2461
+
2438
2462
 
2439
2463
  return false;
2440
2464
  }
2441
2465
 
2442
2466
  defineProperty(shadowTarget, key, descriptor) {
2467
+ /* istanbul ignore else */
2443
2468
  if (process.env.NODE_ENV !== 'production') {
2444
2469
  const {
2445
2470
  originalTarget
2446
2471
  } = this;
2447
2472
  throw new Error(`Invalid mutation: Cannot defineProperty "${key.toString()}" on "${originalTarget}". "${originalTarget}" is read-only.`);
2448
2473
  }
2474
+ /* istanbul ignore next */
2475
+
2449
2476
 
2450
2477
  return false;
2451
2478
  }
@@ -2503,6 +2530,8 @@ var LWC = (function (exports) {
2503
2530
  }; // Inspired from paulmillr/es6-shim
2504
2531
  // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185
2505
2532
 
2533
+ /* istanbul ignore next */
2534
+
2506
2535
  function getGlobal() {
2507
2536
  // the only reliable means to get the global object is `Function('return this')()`
2508
2537
  // However, this causes CSP violations in Chrome apps.
@@ -2527,6 +2556,7 @@ var LWC = (function (exports) {
2527
2556
  }
2528
2557
 
2529
2558
  function init() {
2559
+ /* istanbul ignore if */
2530
2560
  if (process.env.NODE_ENV === 'production') {
2531
2561
  // this method should never leak to prod
2532
2562
  throw new ReferenceError();
@@ -2541,13 +2571,13 @@ var LWC = (function (exports) {
2541
2571
  ArrayPush.call(devtoolsFormatters, formatter);
2542
2572
  global.devtoolsFormatters = devtoolsFormatters;
2543
2573
  }
2574
+ /* istanbul ignore else */
2575
+
2544
2576
 
2545
2577
  if (process.env.NODE_ENV !== 'production') {
2546
2578
  init();
2547
2579
  }
2548
2580
 
2549
- const ObjectDotPrototype = Object.prototype;
2550
-
2551
2581
  function defaultValueIsObservable(value) {
2552
2582
  // intentionally checking for null
2553
2583
  if (value === null) {
@@ -2575,106 +2605,85 @@ var LWC = (function (exports) {
2575
2605
  /* do nothing */
2576
2606
  };
2577
2607
 
2578
- const defaultValueDistortion = value => value;
2579
-
2580
2608
  function createShadowTarget(value) {
2581
2609
  return isArray(value) ? [] : {};
2582
2610
  }
2583
2611
 
2584
- class ReactiveMembrane {
2585
- constructor(options) {
2586
- this.valueDistortion = defaultValueDistortion;
2587
- this.valueMutated = defaultValueMutated;
2588
- this.valueObserved = defaultValueObserved;
2589
- this.valueIsObservable = defaultValueIsObservable;
2590
- this.objectGraph = new WeakMap();
2591
-
2592
- if (!isUndefined(options)) {
2593
- const {
2594
- valueDistortion,
2595
- valueMutated,
2596
- valueObserved,
2597
- valueIsObservable,
2598
- tagPropertyKey
2599
- } = options;
2600
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2601
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2602
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2603
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2604
- this.tagPropertyKey = tagPropertyKey;
2605
- }
2612
+ class ObservableMembrane {
2613
+ constructor(options = {}) {
2614
+ this.readOnlyObjectGraph = new WeakMap();
2615
+ this.reactiveObjectGraph = new WeakMap();
2616
+ const {
2617
+ valueMutated,
2618
+ valueObserved,
2619
+ valueIsObservable,
2620
+ tagPropertyKey
2621
+ } = options;
2622
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2623
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2624
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2625
+ this.tagPropertyKey = tagPropertyKey;
2606
2626
  }
2607
2627
 
2608
2628
  getProxy(value) {
2609
2629
  const unwrappedValue = unwrap$1(value);
2610
- const distorted = this.valueDistortion(unwrappedValue);
2611
2630
 
2612
- if (this.valueIsObservable(distorted)) {
2613
- const o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
2614
- // we return the readonly.
2631
+ if (this.valueIsObservable(unwrappedValue)) {
2632
+ // When trying to extract the writable version of a readonly we return the readonly.
2633
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2634
+ return value;
2635
+ }
2615
2636
 
2616
- return o.readOnly === value ? value : o.reactive;
2637
+ return this.getReactiveHandler(unwrappedValue);
2617
2638
  }
2618
2639
 
2619
- return distorted;
2640
+ return unwrappedValue;
2620
2641
  }
2621
2642
 
2622
2643
  getReadOnlyProxy(value) {
2623
2644
  value = unwrap$1(value);
2624
- const distorted = this.valueDistortion(value);
2625
2645
 
2626
- if (this.valueIsObservable(distorted)) {
2627
- return this.getReactiveState(value, distorted).readOnly;
2646
+ if (this.valueIsObservable(value)) {
2647
+ return this.getReadOnlyHandler(value);
2628
2648
  }
2629
2649
 
2630
- return distorted;
2650
+ return value;
2631
2651
  }
2632
2652
 
2633
2653
  unwrapProxy(p) {
2634
2654
  return unwrap$1(p);
2635
2655
  }
2636
2656
 
2637
- getReactiveState(value, distortedValue) {
2638
- const {
2639
- objectGraph
2640
- } = this;
2641
- let reactiveState = objectGraph.get(distortedValue);
2657
+ getReactiveHandler(value) {
2658
+ let proxy = this.reactiveObjectGraph.get(value);
2642
2659
 
2643
- if (reactiveState) {
2644
- return reactiveState;
2660
+ if (isUndefined(proxy)) {
2661
+ // caching the proxy after the first time it is accessed
2662
+ const handler = new ReactiveProxyHandler(this, value);
2663
+ proxy = new Proxy(createShadowTarget(value), handler);
2664
+ registerProxy(proxy, value);
2665
+ this.reactiveObjectGraph.set(value, proxy);
2645
2666
  }
2646
2667
 
2647
- const membrane = this;
2648
- reactiveState = {
2649
- get reactive() {
2650
- const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
2651
-
2652
- const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
2653
- registerProxy(proxy, value);
2654
- ObjectDefineProperty(this, 'reactive', {
2655
- value: proxy
2656
- });
2657
- return proxy;
2658
- },
2668
+ return proxy;
2669
+ }
2659
2670
 
2660
- get readOnly() {
2661
- const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
2671
+ getReadOnlyHandler(value) {
2672
+ let proxy = this.readOnlyObjectGraph.get(value);
2662
2673
 
2663
- const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
2664
- registerProxy(proxy, value);
2665
- ObjectDefineProperty(this, 'readOnly', {
2666
- value: proxy
2667
- });
2668
- return proxy;
2669
- }
2674
+ if (isUndefined(proxy)) {
2675
+ // caching the proxy after the first time it is accessed
2676
+ const handler = new ReadOnlyHandler(this, value);
2677
+ proxy = new Proxy(createShadowTarget(value), handler);
2678
+ registerProxy(proxy, value);
2679
+ this.readOnlyObjectGraph.set(value, proxy);
2680
+ }
2670
2681
 
2671
- };
2672
- objectGraph.set(distortedValue, reactiveState);
2673
- return reactiveState;
2682
+ return proxy;
2674
2683
  }
2675
2684
 
2676
2685
  }
2677
- /** version: 1.0.0 */
2686
+ /** version: 2.0.0 */
2678
2687
 
2679
2688
  /*
2680
2689
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2685,15 +2694,9 @@ var LWC = (function (exports) {
2685
2694
 
2686
2695
 
2687
2696
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2688
-
2689
- function valueDistortion(value) {
2690
- return value;
2691
- }
2692
-
2693
- const reactiveMembrane = new ReactiveMembrane({
2697
+ const reactiveMembrane = new ObservableMembrane({
2694
2698
  valueObserved,
2695
2699
  valueMutated,
2696
- valueDistortion,
2697
2700
  tagPropertyKey: lockerLivePropertyKey
2698
2701
  });
2699
2702
  /**
@@ -2702,16 +2705,9 @@ var LWC = (function (exports) {
2702
2705
  * change or being removed.
2703
2706
  */
2704
2707
 
2705
- const unwrap = function (value) {
2706
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2707
-
2708
- if (unwrapped !== value) {
2709
- // if value is a proxy, unwrap to access original value and apply distortion
2710
- return valueDistortion(unwrapped);
2711
- }
2712
-
2713
- return value;
2714
- };
2708
+ function unwrap(value) {
2709
+ return reactiveMembrane.unwrapProxy(value);
2710
+ }
2715
2711
  /*
2716
2712
  * Copyright (c) 2018, salesforce.com, inc.
2717
2713
  * All rights reserved.
@@ -4696,13 +4692,15 @@ var LWC = (function (exports) {
4696
4692
 
4697
4693
  function updateChildrenHook(oldVnode, vnode) {
4698
4694
  const {
4699
- children,
4700
- owner
4695
+ elm,
4696
+ children
4701
4697
  } = vnode;
4702
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4703
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4704
- fn(vnode.elm, oldVnode.children, children);
4705
- }, noop);
4698
+
4699
+ if (hasDynamicChildren(children)) {
4700
+ updateDynamicChildren(elm, oldVnode.children, children);
4701
+ } else {
4702
+ updateStaticChildren(elm, oldVnode.children, children);
4703
+ }
4706
4704
  }
4707
4705
 
4708
4706
  function allocateChildrenHook(vnode, vm) {
@@ -5940,6 +5938,7 @@ var LWC = (function (exports) {
5940
5938
 
5941
5939
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5942
5940
  const content = [];
5941
+ let root;
5943
5942
 
5944
5943
  for (let i = 0; i < stylesheets.length; i++) {
5945
5944
  let stylesheet = stylesheets[i];
@@ -5952,23 +5951,46 @@ var LWC = (function (exports) {
5952
5951
  // the component instance might be attempting to use an old version of
5953
5952
  // the stylesheet, while internally, we have a replacement for it.
5954
5953
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5955
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5956
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5954
+ }
5957
5955
 
5956
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5957
+
5958
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5959
+ /* Synthetic */
5960
+ && vm.renderMode === 1
5961
+ /* Shadow */
5962
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5963
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5958
5964
 
5959
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5960
5965
  const useActualHostSelector = vm.renderMode === 0
5961
5966
  /* Light */
5962
5967
  ? !isScopedCss : vm.shadowMode === 0
5963
5968
  /* Native */
5964
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5969
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5970
+ // we use an attribute selector on the host to simulate :dir().
5965
5971
 
5966
- const scopeToken = isScopedCss || vm.shadowMode === 1
5967
- /* Synthetic */
5968
- && vm.renderMode === 1
5972
+ let useNativeDirPseudoclass;
5973
+
5974
+ if (vm.renderMode === 1
5969
5975
  /* Shadow */
5970
- ? stylesheetToken : undefined;
5971
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5976
+ ) {
5977
+ useNativeDirPseudoclass = vm.shadowMode === 0
5978
+ /* Native */
5979
+ ;
5980
+ } else {
5981
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5982
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5983
+ if (isUndefined$1(root)) {
5984
+ // Only calculate the root once as necessary
5985
+ root = getNearestShadowComponent(vm);
5986
+ }
5987
+
5988
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5989
+ /* Native */
5990
+ ;
5991
+ }
5992
+
5993
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5972
5994
  }
5973
5995
  }
5974
5996
 
@@ -5992,14 +6014,12 @@ var LWC = (function (exports) {
5992
6014
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5993
6015
 
5994
6016
 
5995
- function getNearestNativeShadowComponent(vm) {
6017
+ function getNearestShadowComponent(vm) {
5996
6018
  let owner = vm;
5997
6019
 
5998
6020
  while (!isNull(owner)) {
5999
6021
  if (owner.renderMode === 1
6000
6022
  /* Shadow */
6001
- && owner.shadowMode === 0
6002
- /* Native */
6003
6023
  ) {
6004
6024
  return owner;
6005
6025
  }
@@ -6010,6 +6030,20 @@ var LWC = (function (exports) {
6010
6030
  return owner;
6011
6031
  }
6012
6032
 
6033
+ function getNearestNativeShadowComponent(vm) {
6034
+ const owner = getNearestShadowComponent(vm);
6035
+
6036
+ if (!isNull(owner) && owner.shadowMode === 1
6037
+ /* Synthetic */
6038
+ ) {
6039
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6040
+ // synthetic, we know we won't find a native component if we go any further.
6041
+ return null;
6042
+ }
6043
+
6044
+ return owner;
6045
+ }
6046
+
6013
6047
  function createStylesheet(vm, stylesheets) {
6014
6048
  const {
6015
6049
  renderer,
@@ -6127,7 +6161,7 @@ var LWC = (function (exports) {
6127
6161
  if (isProfilerEnabled) {
6128
6162
  currentDispatcher(opId, 0
6129
6163
  /* Start */
6130
- , vm.tagName, vm.idx);
6164
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6131
6165
  }
6132
6166
  }
6133
6167
 
@@ -6141,7 +6175,7 @@ var LWC = (function (exports) {
6141
6175
  if (isProfilerEnabled) {
6142
6176
  currentDispatcher(opId, 1
6143
6177
  /* Stop */
6144
- , vm.tagName, vm.idx);
6178
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6145
6179
  }
6146
6180
  }
6147
6181
 
@@ -6155,7 +6189,7 @@ var LWC = (function (exports) {
6155
6189
  if (isProfilerEnabled) {
6156
6190
  currentDispatcher(opId, 0
6157
6191
  /* Start */
6158
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6192
+ , 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);
6159
6193
  }
6160
6194
  }
6161
6195
 
@@ -6169,7 +6203,7 @@ var LWC = (function (exports) {
6169
6203
  if (isProfilerEnabled) {
6170
6204
  currentDispatcher(opId, 1
6171
6205
  /* Stop */
6172
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6206
+ , 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);
6173
6207
  }
6174
6208
  }
6175
6209
  /*
@@ -7750,7 +7784,7 @@ var LWC = (function (exports) {
7750
7784
  hooksAreSet = true;
7751
7785
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7752
7786
  }
7753
- /* version: 2.5.10-alpha1 */
7787
+ /* version: 2.7.0 */
7754
7788
 
7755
7789
  /*
7756
7790
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8406,7 +8440,7 @@ var LWC = (function (exports) {
8406
8440
  });
8407
8441
  freeze(LightningElement);
8408
8442
  seal(LightningElement.prototype);
8409
- /* version: 2.5.10-alpha1 */
8443
+ /* version: 2.7.0 */
8410
8444
 
8411
8445
  exports.LightningElement = LightningElement;
8412
8446
  exports.__unstable__ProfilerControl = profilerControl;
@@ -8439,4 +8473,4 @@ var LWC = (function (exports) {
8439
8473
 
8440
8474
  return exports;
8441
8475
 
8442
- }({}));
8476
+ })({});