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
@@ -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 */
302
+ /** version: 2.7.1 */
303
303
 
304
304
  /*
305
305
  * Copyright (c) 2018, salesforce.com, inc.
@@ -413,8 +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
- ENABLE_MIXED_SHADOW_MODE: null,
418
416
  ENABLE_WIRE_SYNC_EMIT: null
419
417
  };
420
418
 
@@ -479,7 +477,7 @@ function setFeatureFlagForTest(name, value) {
479
477
  setFeatureFlag(name, value);
480
478
  }
481
479
  }
482
- /** version: 2.5.10 */
480
+ /** version: 2.7.1 */
483
481
 
484
482
  /* proxy-compat-disable */
485
483
 
@@ -1926,6 +1924,7 @@ const {
1926
1924
  isArray
1927
1925
  } = Array;
1928
1926
  const {
1927
+ prototype: ObjectDotPrototype,
1929
1928
  getPrototypeOf,
1930
1929
  create: ObjectCreate,
1931
1930
  defineProperty: ObjectDefineProperty,
@@ -2575,8 +2574,6 @@ if (process.env.NODE_ENV !== 'production') {
2575
2574
  init();
2576
2575
  }
2577
2576
 
2578
- const ObjectDotPrototype = Object.prototype;
2579
-
2580
2577
  function defaultValueIsObservable(value) {
2581
2578
  // intentionally checking for null
2582
2579
  if (value === null) {
@@ -2604,99 +2601,85 @@ const defaultValueMutated = (obj, key) => {
2604
2601
  /* do nothing */
2605
2602
  };
2606
2603
 
2607
- const defaultValueDistortion = value => value;
2608
-
2609
2604
  function createShadowTarget(value) {
2610
2605
  return isArray(value) ? [] : {};
2611
2606
  }
2612
2607
 
2613
- class ReactiveMembrane {
2614
- constructor(options) {
2615
- this.valueDistortion = defaultValueDistortion;
2616
- this.valueMutated = defaultValueMutated;
2617
- this.valueObserved = defaultValueObserved;
2618
- this.valueIsObservable = defaultValueIsObservable;
2608
+ class ObservableMembrane {
2609
+ constructor(options = {}) {
2619
2610
  this.readOnlyObjectGraph = new WeakMap();
2620
2611
  this.reactiveObjectGraph = new WeakMap();
2621
-
2622
- if (!isUndefined(options)) {
2623
- const {
2624
- valueDistortion,
2625
- valueMutated,
2626
- valueObserved,
2627
- valueIsObservable,
2628
- tagPropertyKey
2629
- } = options;
2630
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2631
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2632
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2633
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2634
- this.tagPropertyKey = tagPropertyKey;
2635
- }
2612
+ const {
2613
+ valueMutated,
2614
+ valueObserved,
2615
+ valueIsObservable,
2616
+ tagPropertyKey
2617
+ } = options;
2618
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2619
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2620
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2621
+ this.tagPropertyKey = tagPropertyKey;
2636
2622
  }
2637
2623
 
2638
2624
  getProxy(value) {
2639
2625
  const unwrappedValue = unwrap$1(value);
2640
- const distorted = this.valueDistortion(unwrappedValue);
2641
2626
 
2642
- if (this.valueIsObservable(distorted)) {
2643
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2644
- // when trying to extract the writable version of a readonly
2645
- // we return the readonly.
2627
+ if (this.valueIsObservable(unwrappedValue)) {
2628
+ // When trying to extract the writable version of a readonly we return the readonly.
2629
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2646
2630
  return value;
2647
2631
  }
2648
2632
 
2649
- return this.getReactiveHandler(unwrappedValue, distorted);
2633
+ return this.getReactiveHandler(unwrappedValue);
2650
2634
  }
2651
2635
 
2652
- return distorted;
2636
+ return unwrappedValue;
2653
2637
  }
2654
2638
 
2655
2639
  getReadOnlyProxy(value) {
2656
2640
  value = unwrap$1(value);
2657
- const distorted = this.valueDistortion(value);
2658
2641
 
2659
- if (this.valueIsObservable(distorted)) {
2660
- return this.getReadOnlyHandler(value, distorted);
2642
+ if (this.valueIsObservable(value)) {
2643
+ return this.getReadOnlyHandler(value);
2661
2644
  }
2662
2645
 
2663
- return distorted;
2646
+ return value;
2664
2647
  }
2665
2648
 
2666
2649
  unwrapProxy(p) {
2667
2650
  return unwrap$1(p);
2668
2651
  }
2669
2652
 
2670
- getReactiveHandler(value, distortedValue) {
2671
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2653
+ getReactiveHandler(value) {
2654
+ let proxy = this.reactiveObjectGraph.get(value);
2672
2655
 
2673
2656
  if (isUndefined(proxy)) {
2674
2657
  // caching the proxy after the first time it is accessed
2675
- const handler = new ReactiveProxyHandler(this, distortedValue);
2676
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2658
+ const handler = new ReactiveProxyHandler(this, value);
2659
+ proxy = new Proxy(createShadowTarget(value), handler);
2677
2660
  registerProxy(proxy, value);
2678
- this.reactiveObjectGraph.set(distortedValue, proxy);
2661
+ this.reactiveObjectGraph.set(value, proxy);
2679
2662
  }
2680
2663
 
2681
2664
  return proxy;
2682
2665
  }
2683
2666
 
2684
- getReadOnlyHandler(value, distortedValue) {
2685
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2667
+ getReadOnlyHandler(value) {
2668
+ let proxy = this.readOnlyObjectGraph.get(value);
2686
2669
 
2687
2670
  if (isUndefined(proxy)) {
2688
2671
  // caching the proxy after the first time it is accessed
2689
- const handler = new ReadOnlyHandler(this, distortedValue);
2690
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2672
+ const handler = new ReadOnlyHandler(this, value);
2673
+ proxy = new Proxy(createShadowTarget(value), handler);
2691
2674
  registerProxy(proxy, value);
2692
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2675
+ this.readOnlyObjectGraph.set(value, proxy);
2693
2676
  }
2694
2677
 
2695
2678
  return proxy;
2696
2679
  }
2697
2680
 
2698
2681
  }
2699
- /** version: 1.1.5 */
2682
+ /** version: 2.0.0 */
2700
2683
 
2701
2684
  /*
2702
2685
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2707,15 +2690,9 @@ class ReactiveMembrane {
2707
2690
 
2708
2691
 
2709
2692
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2710
-
2711
- function valueDistortion(value) {
2712
- return value;
2713
- }
2714
-
2715
- const reactiveMembrane = new ReactiveMembrane({
2693
+ const reactiveMembrane = new ObservableMembrane({
2716
2694
  valueObserved,
2717
2695
  valueMutated,
2718
- valueDistortion,
2719
2696
  tagPropertyKey: lockerLivePropertyKey
2720
2697
  });
2721
2698
  /**
@@ -2724,16 +2701,9 @@ const reactiveMembrane = new ReactiveMembrane({
2724
2701
  * change or being removed.
2725
2702
  */
2726
2703
 
2727
- const unwrap = function (value) {
2728
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2729
-
2730
- if (unwrapped !== value) {
2731
- // if value is a proxy, unwrap to access original value and apply distortion
2732
- return valueDistortion(unwrapped);
2733
- }
2734
-
2735
- return value;
2736
- };
2704
+ function unwrap(value) {
2705
+ return reactiveMembrane.unwrapProxy(value);
2706
+ }
2737
2707
  /*
2738
2708
  * Copyright (c) 2018, salesforce.com, inc.
2739
2709
  * All rights reserved.
@@ -4328,10 +4298,6 @@ function createComponentDef(Ctor) {
4328
4298
 
4329
4299
  assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
4330
4300
 
4331
- if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4332
- assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
4333
- }
4334
-
4335
4301
  if (!isUndefined$1(ctorShadowSupportMode)) {
4336
4302
  assert.invariant(ctorShadowSupportMode === "any"
4337
4303
  /* Any */
@@ -4718,13 +4684,15 @@ function updateElmHook(oldVnode, vnode) {
4718
4684
 
4719
4685
  function updateChildrenHook(oldVnode, vnode) {
4720
4686
  const {
4721
- children,
4722
- owner
4687
+ elm,
4688
+ children
4723
4689
  } = vnode;
4724
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4725
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4726
- fn(vnode.elm, oldVnode.children, children);
4727
- }, noop);
4690
+
4691
+ if (hasDynamicChildren(children)) {
4692
+ updateDynamicChildren(elm, oldVnode.children, children);
4693
+ } else {
4694
+ updateStaticChildren(elm, oldVnode.children, children);
4695
+ }
4728
4696
  }
4729
4697
 
4730
4698
  function allocateChildrenHook(vnode, vm) {
@@ -5962,6 +5930,7 @@ function updateStylesheetToken(vm, template) {
5962
5930
 
5963
5931
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5964
5932
  const content = [];
5933
+ let root;
5965
5934
 
5966
5935
  for (let i = 0; i < stylesheets.length; i++) {
5967
5936
  let stylesheet = stylesheets[i];
@@ -5974,23 +5943,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5974
5943
  // the component instance might be attempting to use an old version of
5975
5944
  // the stylesheet, while internally, we have a replacement for it.
5976
5945
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5977
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5978
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5946
+ }
5947
+
5948
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5979
5949
 
5950
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5951
+ /* Synthetic */
5952
+ && vm.renderMode === 1
5953
+ /* Shadow */
5954
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5955
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5980
5956
 
5981
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5982
5957
  const useActualHostSelector = vm.renderMode === 0
5983
5958
  /* Light */
5984
5959
  ? !isScopedCss : vm.shadowMode === 0
5985
5960
  /* Native */
5986
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5961
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5962
+ // we use an attribute selector on the host to simulate :dir().
5987
5963
 
5988
- const scopeToken = isScopedCss || vm.shadowMode === 1
5989
- /* Synthetic */
5990
- && vm.renderMode === 1
5964
+ let useNativeDirPseudoclass;
5965
+
5966
+ if (vm.renderMode === 1
5991
5967
  /* Shadow */
5992
- ? stylesheetToken : undefined;
5993
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5968
+ ) {
5969
+ useNativeDirPseudoclass = vm.shadowMode === 0
5970
+ /* Native */
5971
+ ;
5972
+ } else {
5973
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5974
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5975
+ if (isUndefined$1(root)) {
5976
+ // Only calculate the root once as necessary
5977
+ root = getNearestShadowComponent(vm);
5978
+ }
5979
+
5980
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5981
+ /* Native */
5982
+ ;
5983
+ }
5984
+
5985
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5994
5986
  }
5995
5987
  }
5996
5988
 
@@ -6014,14 +6006,12 @@ function getStylesheetsContent(vm, template) {
6014
6006
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
6015
6007
 
6016
6008
 
6017
- function getNearestNativeShadowComponent(vm) {
6009
+ function getNearestShadowComponent(vm) {
6018
6010
  let owner = vm;
6019
6011
 
6020
6012
  while (!isNull(owner)) {
6021
6013
  if (owner.renderMode === 1
6022
6014
  /* Shadow */
6023
- && owner.shadowMode === 0
6024
- /* Native */
6025
6015
  ) {
6026
6016
  return owner;
6027
6017
  }
@@ -6032,6 +6022,20 @@ function getNearestNativeShadowComponent(vm) {
6032
6022
  return owner;
6033
6023
  }
6034
6024
 
6025
+ function getNearestNativeShadowComponent(vm) {
6026
+ const owner = getNearestShadowComponent(vm);
6027
+
6028
+ if (!isNull(owner) && owner.shadowMode === 1
6029
+ /* Synthetic */
6030
+ ) {
6031
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
6032
+ // synthetic, we know we won't find a native component if we go any further.
6033
+ return null;
6034
+ }
6035
+
6036
+ return owner;
6037
+ }
6038
+
6035
6039
  function createStylesheet(vm, stylesheets) {
6036
6040
  const {
6037
6041
  renderer,
@@ -6149,7 +6153,7 @@ function logOperationStart(opId, vm) {
6149
6153
  if (isProfilerEnabled) {
6150
6154
  currentDispatcher(opId, 0
6151
6155
  /* Start */
6152
- , vm.tagName, vm.idx);
6156
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6153
6157
  }
6154
6158
  }
6155
6159
 
@@ -6163,7 +6167,7 @@ function logOperationEnd(opId, vm) {
6163
6167
  if (isProfilerEnabled) {
6164
6168
  currentDispatcher(opId, 1
6165
6169
  /* Stop */
6166
- , vm.tagName, vm.idx);
6170
+ , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
6167
6171
  }
6168
6172
  }
6169
6173
 
@@ -6177,7 +6181,7 @@ function logGlobalOperationStart(opId, vm) {
6177
6181
  if (isProfilerEnabled) {
6178
6182
  currentDispatcher(opId, 0
6179
6183
  /* Start */
6180
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6184
+ , 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);
6181
6185
  }
6182
6186
  }
6183
6187
 
@@ -6191,7 +6195,7 @@ function logGlobalOperationEnd(opId, vm) {
6191
6195
  if (isProfilerEnabled) {
6192
6196
  currentDispatcher(opId, 1
6193
6197
  /* Stop */
6194
- , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
6198
+ , 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);
6195
6199
  }
6196
6200
  }
6197
6201
  /*
@@ -7772,7 +7776,7 @@ function setHooks(hooks) {
7772
7776
  hooksAreSet = true;
7773
7777
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7774
7778
  }
7775
- /* version: 2.5.10 */
7779
+ /* version: 2.7.1 */
7776
7780
 
7777
7781
  /*
7778
7782
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8428,6 +8432,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8428
8432
  });
8429
8433
  freeze(LightningElement);
8430
8434
  seal(LightningElement.prototype);
8431
- /* version: 2.5.10 */
8435
+ /* version: 2.7.1 */
8432
8436
 
8433
8437
  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 };