lwc 2.5.10 → 2.7.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 (41) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +100 -96
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +100 -96
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +99 -91
  5. package/dist/engine-dom/iife/es5/engine-dom.js +112 -108
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +111 -103
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +100 -96
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +99 -91
  11. package/dist/engine-dom/umd/es5/engine-dom.js +112 -108
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +111 -103
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +111 -104
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +111 -104
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +56 -133
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +56 -133
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +56 -133
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +67 -130
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +67 -130
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +56 -133
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +56 -133
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +67 -130
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +67 -130
  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 +11 -11
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +11 -11
  36. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service.js +11 -11
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +11 -11
  41. package/package.json +8 -8
@@ -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 */
305
+ /** version: 2.7.1 */
306
306
 
307
307
  /*
308
308
  * Copyright (c) 2018, salesforce.com, inc.
@@ -416,8 +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
- ENABLE_MIXED_SHADOW_MODE: null,
421
419
  ENABLE_WIRE_SYNC_EMIT: null
422
420
  };
423
421
 
@@ -482,7 +480,7 @@ var LWC = (function (exports) {
482
480
  setFeatureFlag(name, value);
483
481
  }
484
482
  }
485
- /** version: 2.5.10 */
483
+ /** version: 2.7.1 */
486
484
 
487
485
  /* proxy-compat-disable */
488
486
 
@@ -1929,6 +1927,7 @@ var LWC = (function (exports) {
1929
1927
  isArray
1930
1928
  } = Array;
1931
1929
  const {
1930
+ prototype: ObjectDotPrototype,
1932
1931
  getPrototypeOf,
1933
1932
  create: ObjectCreate,
1934
1933
  defineProperty: ObjectDefineProperty,
@@ -2578,8 +2577,6 @@ var LWC = (function (exports) {
2578
2577
  init();
2579
2578
  }
2580
2579
 
2581
- const ObjectDotPrototype = Object.prototype;
2582
-
2583
2580
  function defaultValueIsObservable(value) {
2584
2581
  // intentionally checking for null
2585
2582
  if (value === null) {
@@ -2607,99 +2604,85 @@ var LWC = (function (exports) {
2607
2604
  /* do nothing */
2608
2605
  };
2609
2606
 
2610
- const defaultValueDistortion = value => value;
2611
-
2612
2607
  function createShadowTarget(value) {
2613
2608
  return isArray(value) ? [] : {};
2614
2609
  }
2615
2610
 
2616
- class ReactiveMembrane {
2617
- constructor(options) {
2618
- this.valueDistortion = defaultValueDistortion;
2619
- this.valueMutated = defaultValueMutated;
2620
- this.valueObserved = defaultValueObserved;
2621
- this.valueIsObservable = defaultValueIsObservable;
2611
+ class ObservableMembrane {
2612
+ constructor(options = {}) {
2622
2613
  this.readOnlyObjectGraph = new WeakMap();
2623
2614
  this.reactiveObjectGraph = new WeakMap();
2624
-
2625
- if (!isUndefined(options)) {
2626
- const {
2627
- valueDistortion,
2628
- valueMutated,
2629
- valueObserved,
2630
- valueIsObservable,
2631
- tagPropertyKey
2632
- } = options;
2633
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2634
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2635
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2636
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2637
- this.tagPropertyKey = tagPropertyKey;
2638
- }
2615
+ const {
2616
+ valueMutated,
2617
+ valueObserved,
2618
+ valueIsObservable,
2619
+ tagPropertyKey
2620
+ } = options;
2621
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2622
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2623
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2624
+ this.tagPropertyKey = tagPropertyKey;
2639
2625
  }
2640
2626
 
2641
2627
  getProxy(value) {
2642
2628
  const unwrappedValue = unwrap$1(value);
2643
- const distorted = this.valueDistortion(unwrappedValue);
2644
2629
 
2645
- if (this.valueIsObservable(distorted)) {
2646
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2647
- // when trying to extract the writable version of a readonly
2648
- // we return the readonly.
2630
+ if (this.valueIsObservable(unwrappedValue)) {
2631
+ // When trying to extract the writable version of a readonly we return the readonly.
2632
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2649
2633
  return value;
2650
2634
  }
2651
2635
 
2652
- return this.getReactiveHandler(unwrappedValue, distorted);
2636
+ return this.getReactiveHandler(unwrappedValue);
2653
2637
  }
2654
2638
 
2655
- return distorted;
2639
+ return unwrappedValue;
2656
2640
  }
2657
2641
 
2658
2642
  getReadOnlyProxy(value) {
2659
2643
  value = unwrap$1(value);
2660
- const distorted = this.valueDistortion(value);
2661
2644
 
2662
- if (this.valueIsObservable(distorted)) {
2663
- return this.getReadOnlyHandler(value, distorted);
2645
+ if (this.valueIsObservable(value)) {
2646
+ return this.getReadOnlyHandler(value);
2664
2647
  }
2665
2648
 
2666
- return distorted;
2649
+ return value;
2667
2650
  }
2668
2651
 
2669
2652
  unwrapProxy(p) {
2670
2653
  return unwrap$1(p);
2671
2654
  }
2672
2655
 
2673
- getReactiveHandler(value, distortedValue) {
2674
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2656
+ getReactiveHandler(value) {
2657
+ let proxy = this.reactiveObjectGraph.get(value);
2675
2658
 
2676
2659
  if (isUndefined(proxy)) {
2677
2660
  // caching the proxy after the first time it is accessed
2678
- const handler = new ReactiveProxyHandler(this, distortedValue);
2679
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2661
+ const handler = new ReactiveProxyHandler(this, value);
2662
+ proxy = new Proxy(createShadowTarget(value), handler);
2680
2663
  registerProxy(proxy, value);
2681
- this.reactiveObjectGraph.set(distortedValue, proxy);
2664
+ this.reactiveObjectGraph.set(value, proxy);
2682
2665
  }
2683
2666
 
2684
2667
  return proxy;
2685
2668
  }
2686
2669
 
2687
- getReadOnlyHandler(value, distortedValue) {
2688
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2670
+ getReadOnlyHandler(value) {
2671
+ let proxy = this.readOnlyObjectGraph.get(value);
2689
2672
 
2690
2673
  if (isUndefined(proxy)) {
2691
2674
  // caching the proxy after the first time it is accessed
2692
- const handler = new ReadOnlyHandler(this, distortedValue);
2693
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2675
+ const handler = new ReadOnlyHandler(this, value);
2676
+ proxy = new Proxy(createShadowTarget(value), handler);
2694
2677
  registerProxy(proxy, value);
2695
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2678
+ this.readOnlyObjectGraph.set(value, proxy);
2696
2679
  }
2697
2680
 
2698
2681
  return proxy;
2699
2682
  }
2700
2683
 
2701
2684
  }
2702
- /** version: 1.1.5 */
2685
+ /** version: 2.0.0 */
2703
2686
 
2704
2687
  /*
2705
2688
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2710,15 +2693,9 @@ var LWC = (function (exports) {
2710
2693
 
2711
2694
 
2712
2695
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2713
-
2714
- function valueDistortion(value) {
2715
- return value;
2716
- }
2717
-
2718
- const reactiveMembrane = new ReactiveMembrane({
2696
+ const reactiveMembrane = new ObservableMembrane({
2719
2697
  valueObserved,
2720
2698
  valueMutated,
2721
- valueDistortion,
2722
2699
  tagPropertyKey: lockerLivePropertyKey
2723
2700
  });
2724
2701
  /**
@@ -2727,16 +2704,9 @@ var LWC = (function (exports) {
2727
2704
  * change or being removed.
2728
2705
  */
2729
2706
 
2730
- const unwrap = function (value) {
2731
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2732
-
2733
- if (unwrapped !== value) {
2734
- // if value is a proxy, unwrap to access original value and apply distortion
2735
- return valueDistortion(unwrapped);
2736
- }
2737
-
2738
- return value;
2739
- };
2707
+ function unwrap(value) {
2708
+ return reactiveMembrane.unwrapProxy(value);
2709
+ }
2740
2710
  /*
2741
2711
  * Copyright (c) 2018, salesforce.com, inc.
2742
2712
  * All rights reserved.
@@ -4331,10 +4301,6 @@ var LWC = (function (exports) {
4331
4301
 
4332
4302
  assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
4333
4303
 
4334
- if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4335
- assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
4336
- }
4337
-
4338
4304
  if (!isUndefined$1(ctorShadowSupportMode)) {
4339
4305
  assert.invariant(ctorShadowSupportMode === "any"
4340
4306
  /* Any */
@@ -4721,13 +4687,15 @@ var LWC = (function (exports) {
4721
4687
 
4722
4688
  function updateChildrenHook(oldVnode, vnode) {
4723
4689
  const {
4724
- children,
4725
- owner
4690
+ elm,
4691
+ children
4726
4692
  } = vnode;
4727
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4728
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4729
- fn(vnode.elm, oldVnode.children, children);
4730
- }, noop);
4693
+
4694
+ if (hasDynamicChildren(children)) {
4695
+ updateDynamicChildren(elm, oldVnode.children, children);
4696
+ } else {
4697
+ updateStaticChildren(elm, oldVnode.children, children);
4698
+ }
4731
4699
  }
4732
4700
 
4733
4701
  function allocateChildrenHook(vnode, vm) {
@@ -5965,6 +5933,7 @@ var LWC = (function (exports) {
5965
5933
 
5966
5934
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5967
5935
  const content = [];
5936
+ let root;
5968
5937
 
5969
5938
  for (let i = 0; i < stylesheets.length; i++) {
5970
5939
  let stylesheet = stylesheets[i];
@@ -5977,23 +5946,46 @@ var LWC = (function (exports) {
5977
5946
  // the component instance might be attempting to use an old version of
5978
5947
  // the stylesheet, while internally, we have a replacement for it.
5979
5948
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5980
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5981
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5949
+ }
5950
+
5951
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5982
5952
 
5953
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5954
+ /* Synthetic */
5955
+ && vm.renderMode === 1
5956
+ /* Shadow */
5957
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5958
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5983
5959
 
5984
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5985
5960
  const useActualHostSelector = vm.renderMode === 0
5986
5961
  /* Light */
5987
5962
  ? !isScopedCss : vm.shadowMode === 0
5988
5963
  /* Native */
5989
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5964
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5965
+ // we use an attribute selector on the host to simulate :dir().
5990
5966
 
5991
- const scopeToken = isScopedCss || vm.shadowMode === 1
5992
- /* Synthetic */
5993
- && vm.renderMode === 1
5967
+ let useNativeDirPseudoclass;
5968
+
5969
+ if (vm.renderMode === 1
5994
5970
  /* Shadow */
5995
- ? stylesheetToken : undefined;
5996
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5971
+ ) {
5972
+ useNativeDirPseudoclass = vm.shadowMode === 0
5973
+ /* Native */
5974
+ ;
5975
+ } else {
5976
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5977
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5978
+ if (isUndefined$1(root)) {
5979
+ // Only calculate the root once as necessary
5980
+ root = getNearestShadowComponent(vm);
5981
+ }
5982
+
5983
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5984
+ /* Native */
5985
+ ;
5986
+ }
5987
+
5988
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5997
5989
  }
5998
5990
  }
5999
5991
 
@@ -6017,14 +6009,12 @@ var LWC = (function (exports) {
6017
6009
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
6018
6010
 
6019
6011
 
6020
- function getNearestNativeShadowComponent(vm) {
6012
+ function getNearestShadowComponent(vm) {
6021
6013
  let owner = vm;
6022
6014
 
6023
6015
  while (!isNull(owner)) {
6024
6016
  if (owner.renderMode === 1
6025
6017
  /* Shadow */
6026
- && owner.shadowMode === 0
6027
- /* Native */
6028
6018
  ) {
6029
6019
  return owner;
6030
6020
  }
@@ -6035,6 +6025,20 @@ var LWC = (function (exports) {
6035
6025
  return owner;
6036
6026
  }
6037
6027
 
6028
+ function getNearestNativeShadowComponent(vm) {
6029
+ const owner = getNearestShadowComponent(vm);
6030
+
6031
+ if (!isNull(owner) && owner.shadowMode === 1
6032
+ /* Synthetic */
6033
+ ) {
6034
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6035
+ // synthetic, we know we won't find a native component if we go any further.
6036
+ return null;
6037
+ }
6038
+
6039
+ return owner;
6040
+ }
6041
+
6038
6042
  function createStylesheet(vm, stylesheets) {
6039
6043
  const {
6040
6044
  renderer,
@@ -6152,7 +6156,7 @@ var LWC = (function (exports) {
6152
6156
  if (isProfilerEnabled) {
6153
6157
  currentDispatcher(opId, 0
6154
6158
  /* Start */
6155
- , vm.tagName, vm.idx);
6159
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6156
6160
  }
6157
6161
  }
6158
6162
 
@@ -6166,7 +6170,7 @@ var LWC = (function (exports) {
6166
6170
  if (isProfilerEnabled) {
6167
6171
  currentDispatcher(opId, 1
6168
6172
  /* Stop */
6169
- , vm.tagName, vm.idx);
6173
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6170
6174
  }
6171
6175
  }
6172
6176
 
@@ -6180,7 +6184,7 @@ var LWC = (function (exports) {
6180
6184
  if (isProfilerEnabled) {
6181
6185
  currentDispatcher(opId, 0
6182
6186
  /* Start */
6183
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6187
+ , 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);
6184
6188
  }
6185
6189
  }
6186
6190
 
@@ -6194,7 +6198,7 @@ var LWC = (function (exports) {
6194
6198
  if (isProfilerEnabled) {
6195
6199
  currentDispatcher(opId, 1
6196
6200
  /* Stop */
6197
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6201
+ , 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);
6198
6202
  }
6199
6203
  }
6200
6204
  /*
@@ -7775,7 +7779,7 @@ var LWC = (function (exports) {
7775
7779
  hooksAreSet = true;
7776
7780
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7777
7781
  }
7778
- /* version: 2.5.10 */
7782
+ /* version: 2.7.1 */
7779
7783
 
7780
7784
  /*
7781
7785
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8431,7 +8435,7 @@ var LWC = (function (exports) {
8431
8435
  });
8432
8436
  freeze(LightningElement);
8433
8437
  seal(LightningElement.prototype);
8434
- /* version: 2.5.10 */
8438
+ /* version: 2.7.1 */
8435
8439
 
8436
8440
  exports.LightningElement = LightningElement;
8437
8441
  exports.__unstable__ProfilerControl = profilerControl;