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
@@ -305,7 +305,7 @@
305
305
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
306
306
  return attributeName;
307
307
  }
308
- /** version: 2.5.10 */
308
+ /** version: 2.7.1 */
309
309
 
310
310
  /*
311
311
  * Copyright (c) 2018, salesforce.com, inc.
@@ -419,8 +419,6 @@
419
419
  ENABLE_NODE_LIST_PATCH: null,
420
420
  ENABLE_HTML_COLLECTIONS_PATCH: null,
421
421
  ENABLE_NODE_PATCH: null,
422
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
423
- ENABLE_MIXED_SHADOW_MODE: null,
424
422
  ENABLE_WIRE_SYNC_EMIT: null
425
423
  };
426
424
 
@@ -485,7 +483,7 @@
485
483
  setFeatureFlag(name, value);
486
484
  }
487
485
  }
488
- /** version: 2.5.10 */
486
+ /** version: 2.7.1 */
489
487
 
490
488
  /* proxy-compat-disable */
491
489
 
@@ -1932,6 +1930,7 @@
1932
1930
  isArray
1933
1931
  } = Array;
1934
1932
  const {
1933
+ prototype: ObjectDotPrototype,
1935
1934
  getPrototypeOf,
1936
1935
  create: ObjectCreate,
1937
1936
  defineProperty: ObjectDefineProperty,
@@ -2581,8 +2580,6 @@
2581
2580
  init();
2582
2581
  }
2583
2582
 
2584
- const ObjectDotPrototype = Object.prototype;
2585
-
2586
2583
  function defaultValueIsObservable(value) {
2587
2584
  // intentionally checking for null
2588
2585
  if (value === null) {
@@ -2610,99 +2607,85 @@
2610
2607
  /* do nothing */
2611
2608
  };
2612
2609
 
2613
- const defaultValueDistortion = value => value;
2614
-
2615
2610
  function createShadowTarget(value) {
2616
2611
  return isArray(value) ? [] : {};
2617
2612
  }
2618
2613
 
2619
- class ReactiveMembrane {
2620
- constructor(options) {
2621
- this.valueDistortion = defaultValueDistortion;
2622
- this.valueMutated = defaultValueMutated;
2623
- this.valueObserved = defaultValueObserved;
2624
- this.valueIsObservable = defaultValueIsObservable;
2614
+ class ObservableMembrane {
2615
+ constructor(options = {}) {
2625
2616
  this.readOnlyObjectGraph = new WeakMap();
2626
2617
  this.reactiveObjectGraph = new WeakMap();
2627
-
2628
- if (!isUndefined(options)) {
2629
- const {
2630
- valueDistortion,
2631
- valueMutated,
2632
- valueObserved,
2633
- valueIsObservable,
2634
- tagPropertyKey
2635
- } = options;
2636
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2637
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2638
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2639
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2640
- this.tagPropertyKey = tagPropertyKey;
2641
- }
2618
+ const {
2619
+ valueMutated,
2620
+ valueObserved,
2621
+ valueIsObservable,
2622
+ tagPropertyKey
2623
+ } = options;
2624
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2625
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2626
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2627
+ this.tagPropertyKey = tagPropertyKey;
2642
2628
  }
2643
2629
 
2644
2630
  getProxy(value) {
2645
2631
  const unwrappedValue = unwrap$1(value);
2646
- const distorted = this.valueDistortion(unwrappedValue);
2647
2632
 
2648
- if (this.valueIsObservable(distorted)) {
2649
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2650
- // when trying to extract the writable version of a readonly
2651
- // we return the readonly.
2633
+ if (this.valueIsObservable(unwrappedValue)) {
2634
+ // When trying to extract the writable version of a readonly we return the readonly.
2635
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2652
2636
  return value;
2653
2637
  }
2654
2638
 
2655
- return this.getReactiveHandler(unwrappedValue, distorted);
2639
+ return this.getReactiveHandler(unwrappedValue);
2656
2640
  }
2657
2641
 
2658
- return distorted;
2642
+ return unwrappedValue;
2659
2643
  }
2660
2644
 
2661
2645
  getReadOnlyProxy(value) {
2662
2646
  value = unwrap$1(value);
2663
- const distorted = this.valueDistortion(value);
2664
2647
 
2665
- if (this.valueIsObservable(distorted)) {
2666
- return this.getReadOnlyHandler(value, distorted);
2648
+ if (this.valueIsObservable(value)) {
2649
+ return this.getReadOnlyHandler(value);
2667
2650
  }
2668
2651
 
2669
- return distorted;
2652
+ return value;
2670
2653
  }
2671
2654
 
2672
2655
  unwrapProxy(p) {
2673
2656
  return unwrap$1(p);
2674
2657
  }
2675
2658
 
2676
- getReactiveHandler(value, distortedValue) {
2677
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2659
+ getReactiveHandler(value) {
2660
+ let proxy = this.reactiveObjectGraph.get(value);
2678
2661
 
2679
2662
  if (isUndefined(proxy)) {
2680
2663
  // caching the proxy after the first time it is accessed
2681
- const handler = new ReactiveProxyHandler(this, distortedValue);
2682
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2664
+ const handler = new ReactiveProxyHandler(this, value);
2665
+ proxy = new Proxy(createShadowTarget(value), handler);
2683
2666
  registerProxy(proxy, value);
2684
- this.reactiveObjectGraph.set(distortedValue, proxy);
2667
+ this.reactiveObjectGraph.set(value, proxy);
2685
2668
  }
2686
2669
 
2687
2670
  return proxy;
2688
2671
  }
2689
2672
 
2690
- getReadOnlyHandler(value, distortedValue) {
2691
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2673
+ getReadOnlyHandler(value) {
2674
+ let proxy = this.readOnlyObjectGraph.get(value);
2692
2675
 
2693
2676
  if (isUndefined(proxy)) {
2694
2677
  // caching the proxy after the first time it is accessed
2695
- const handler = new ReadOnlyHandler(this, distortedValue);
2696
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2678
+ const handler = new ReadOnlyHandler(this, value);
2679
+ proxy = new Proxy(createShadowTarget(value), handler);
2697
2680
  registerProxy(proxy, value);
2698
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2681
+ this.readOnlyObjectGraph.set(value, proxy);
2699
2682
  }
2700
2683
 
2701
2684
  return proxy;
2702
2685
  }
2703
2686
 
2704
2687
  }
2705
- /** version: 1.1.5 */
2688
+ /** version: 2.0.0 */
2706
2689
 
2707
2690
  /*
2708
2691
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2713,15 +2696,9 @@
2713
2696
 
2714
2697
 
2715
2698
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2716
-
2717
- function valueDistortion(value) {
2718
- return value;
2719
- }
2720
-
2721
- const reactiveMembrane = new ReactiveMembrane({
2699
+ const reactiveMembrane = new ObservableMembrane({
2722
2700
  valueObserved,
2723
2701
  valueMutated,
2724
- valueDistortion,
2725
2702
  tagPropertyKey: lockerLivePropertyKey
2726
2703
  });
2727
2704
  /**
@@ -2730,16 +2707,9 @@
2730
2707
  * change or being removed.
2731
2708
  */
2732
2709
 
2733
- const unwrap = function (value) {
2734
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2735
-
2736
- if (unwrapped !== value) {
2737
- // if value is a proxy, unwrap to access original value and apply distortion
2738
- return valueDistortion(unwrapped);
2739
- }
2740
-
2741
- return value;
2742
- };
2710
+ function unwrap(value) {
2711
+ return reactiveMembrane.unwrapProxy(value);
2712
+ }
2743
2713
  /*
2744
2714
  * Copyright (c) 2018, salesforce.com, inc.
2745
2715
  * All rights reserved.
@@ -4334,10 +4304,6 @@
4334
4304
 
4335
4305
  assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
4336
4306
 
4337
- if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4338
- assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
4339
- }
4340
-
4341
4307
  if (!isUndefined$1(ctorShadowSupportMode)) {
4342
4308
  assert.invariant(ctorShadowSupportMode === "any"
4343
4309
  /* Any */
@@ -4724,13 +4690,15 @@
4724
4690
 
4725
4691
  function updateChildrenHook(oldVnode, vnode) {
4726
4692
  const {
4727
- children,
4728
- owner
4693
+ elm,
4694
+ children
4729
4695
  } = vnode;
4730
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4731
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4732
- fn(vnode.elm, oldVnode.children, children);
4733
- }, noop);
4696
+
4697
+ if (hasDynamicChildren(children)) {
4698
+ updateDynamicChildren(elm, oldVnode.children, children);
4699
+ } else {
4700
+ updateStaticChildren(elm, oldVnode.children, children);
4701
+ }
4734
4702
  }
4735
4703
 
4736
4704
  function allocateChildrenHook(vnode, vm) {
@@ -5968,6 +5936,7 @@
5968
5936
 
5969
5937
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5970
5938
  const content = [];
5939
+ let root;
5971
5940
 
5972
5941
  for (let i = 0; i < stylesheets.length; i++) {
5973
5942
  let stylesheet = stylesheets[i];
@@ -5980,23 +5949,46 @@
5980
5949
  // the component instance might be attempting to use an old version of
5981
5950
  // the stylesheet, while internally, we have a replacement for it.
5982
5951
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5983
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5984
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5952
+ }
5953
+
5954
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5985
5955
 
5956
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5957
+ /* Synthetic */
5958
+ && vm.renderMode === 1
5959
+ /* Shadow */
5960
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5961
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5986
5962
 
5987
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5988
5963
  const useActualHostSelector = vm.renderMode === 0
5989
5964
  /* Light */
5990
5965
  ? !isScopedCss : vm.shadowMode === 0
5991
5966
  /* Native */
5992
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5967
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5968
+ // we use an attribute selector on the host to simulate :dir().
5993
5969
 
5994
- const scopeToken = isScopedCss || vm.shadowMode === 1
5995
- /* Synthetic */
5996
- && vm.renderMode === 1
5970
+ let useNativeDirPseudoclass;
5971
+
5972
+ if (vm.renderMode === 1
5997
5973
  /* Shadow */
5998
- ? stylesheetToken : undefined;
5999
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5974
+ ) {
5975
+ useNativeDirPseudoclass = vm.shadowMode === 0
5976
+ /* Native */
5977
+ ;
5978
+ } else {
5979
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5980
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5981
+ if (isUndefined$1(root)) {
5982
+ // Only calculate the root once as necessary
5983
+ root = getNearestShadowComponent(vm);
5984
+ }
5985
+
5986
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5987
+ /* Native */
5988
+ ;
5989
+ }
5990
+
5991
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
6000
5992
  }
6001
5993
  }
6002
5994
 
@@ -6020,14 +6012,12 @@
6020
6012
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
6021
6013
 
6022
6014
 
6023
- function getNearestNativeShadowComponent(vm) {
6015
+ function getNearestShadowComponent(vm) {
6024
6016
  let owner = vm;
6025
6017
 
6026
6018
  while (!isNull(owner)) {
6027
6019
  if (owner.renderMode === 1
6028
6020
  /* Shadow */
6029
- && owner.shadowMode === 0
6030
- /* Native */
6031
6021
  ) {
6032
6022
  return owner;
6033
6023
  }
@@ -6038,6 +6028,20 @@
6038
6028
  return owner;
6039
6029
  }
6040
6030
 
6031
+ function getNearestNativeShadowComponent(vm) {
6032
+ const owner = getNearestShadowComponent(vm);
6033
+
6034
+ if (!isNull(owner) && owner.shadowMode === 1
6035
+ /* Synthetic */
6036
+ ) {
6037
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6038
+ // synthetic, we know we won't find a native component if we go any further.
6039
+ return null;
6040
+ }
6041
+
6042
+ return owner;
6043
+ }
6044
+
6041
6045
  function createStylesheet(vm, stylesheets) {
6042
6046
  const {
6043
6047
  renderer,
@@ -6155,7 +6159,7 @@
6155
6159
  if (isProfilerEnabled) {
6156
6160
  currentDispatcher(opId, 0
6157
6161
  /* Start */
6158
- , vm.tagName, vm.idx);
6162
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6159
6163
  }
6160
6164
  }
6161
6165
 
@@ -6169,7 +6173,7 @@
6169
6173
  if (isProfilerEnabled) {
6170
6174
  currentDispatcher(opId, 1
6171
6175
  /* Stop */
6172
- , vm.tagName, vm.idx);
6176
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6173
6177
  }
6174
6178
  }
6175
6179
 
@@ -6183,7 +6187,7 @@
6183
6187
  if (isProfilerEnabled) {
6184
6188
  currentDispatcher(opId, 0
6185
6189
  /* Start */
6186
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6190
+ , 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);
6187
6191
  }
6188
6192
  }
6189
6193
 
@@ -6197,7 +6201,7 @@
6197
6201
  if (isProfilerEnabled) {
6198
6202
  currentDispatcher(opId, 1
6199
6203
  /* Stop */
6200
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6204
+ , 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);
6201
6205
  }
6202
6206
  }
6203
6207
  /*
@@ -7778,7 +7782,7 @@
7778
7782
  hooksAreSet = true;
7779
7783
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7780
7784
  }
7781
- /* version: 2.5.10 */
7785
+ /* version: 2.7.1 */
7782
7786
 
7783
7787
  /*
7784
7788
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8434,7 +8438,7 @@
8434
8438
  });
8435
8439
  freeze(LightningElement);
8436
8440
  seal(LightningElement.prototype);
8437
- /* version: 2.5.10 */
8441
+ /* version: 2.7.1 */
8438
8442
 
8439
8443
  exports.LightningElement = LightningElement;
8440
8444
  exports.__unstable__ProfilerControl = profilerControl;