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
@@ -339,7 +339,7 @@ function htmlPropertyToAttribute(propName) {
339
339
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
340
340
  return attributeName;
341
341
  }
342
- /** version: 2.5.10 */
342
+ /** version: 2.7.1 */
343
343
 
344
344
  /*
345
345
  * Copyright (c) 2020, salesforce.com, inc.
@@ -352,25 +352,28 @@ function htmlPropertyToAttribute(propName) {
352
352
  * The following constructor might be used in either the constructor or the connectedCallback. In
353
353
  * order to ensure that the component evaluates, we attach those mock constructors to the global
354
354
  * object.
355
+ * Also note that Event is defined in Node 16+, but CustomEvent is not, so they have to be
356
+ * polyfilled separately.
355
357
  */
356
358
 
357
359
 
358
- if (typeof Event !== 'function' && typeof CustomEvent !== 'function') {
360
+ if (typeof Event !== 'function') {
359
361
  class Event {}
360
362
 
363
+ defineProperty(_globalThis, 'Event', {
364
+ value: Event,
365
+ configurable: true,
366
+ writable: true
367
+ });
368
+ }
369
+
370
+ if (typeof CustomEvent !== 'function') {
361
371
  class CustomEvent extends Event {}
362
372
 
363
- defineProperties(_globalThis, {
364
- Event: {
365
- value: Event,
366
- configurable: true,
367
- writable: true
368
- },
369
- CustomEvent: {
370
- value: CustomEvent,
371
- configurable: true,
372
- writable: true
373
- }
373
+ defineProperty(_globalThis, 'CustomEvent', {
374
+ value: CustomEvent,
375
+ configurable: true,
376
+ writable: true
374
377
  });
375
378
  }
376
379
  /**
@@ -394,8 +397,6 @@ const features = {
394
397
  ENABLE_NODE_LIST_PATCH: null,
395
398
  ENABLE_HTML_COLLECTIONS_PATCH: null,
396
399
  ENABLE_NODE_PATCH: null,
397
- ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
398
- ENABLE_MIXED_SHADOW_MODE: null,
399
400
  ENABLE_WIRE_SYNC_EMIT: null
400
401
  };
401
402
 
@@ -460,7 +461,7 @@ function setFeatureFlagForTest(name, value) {
460
461
  setFeatureFlag(name, value);
461
462
  }
462
463
  }
463
- /** version: 2.5.10 */
464
+ /** version: 2.7.1 */
464
465
 
465
466
  /* proxy-compat-disable */
466
467
 
@@ -1907,6 +1908,7 @@ const {
1907
1908
  isArray
1908
1909
  } = Array;
1909
1910
  const {
1911
+ prototype: ObjectDotPrototype,
1910
1912
  getPrototypeOf,
1911
1913
  create: ObjectCreate,
1912
1914
  defineProperty: ObjectDefineProperty,
@@ -2556,8 +2558,6 @@ if (process.env.NODE_ENV !== 'production') {
2556
2558
  init();
2557
2559
  }
2558
2560
 
2559
- const ObjectDotPrototype = Object.prototype;
2560
-
2561
2561
  function defaultValueIsObservable(value) {
2562
2562
  // intentionally checking for null
2563
2563
  if (value === null) {
@@ -2585,99 +2585,85 @@ const defaultValueMutated = (obj, key) => {
2585
2585
  /* do nothing */
2586
2586
  };
2587
2587
 
2588
- const defaultValueDistortion = value => value;
2589
-
2590
2588
  function createShadowTarget(value) {
2591
2589
  return isArray(value) ? [] : {};
2592
2590
  }
2593
2591
 
2594
- class ReactiveMembrane {
2595
- constructor(options) {
2596
- this.valueDistortion = defaultValueDistortion;
2597
- this.valueMutated = defaultValueMutated;
2598
- this.valueObserved = defaultValueObserved;
2599
- this.valueIsObservable = defaultValueIsObservable;
2592
+ class ObservableMembrane {
2593
+ constructor(options = {}) {
2600
2594
  this.readOnlyObjectGraph = new WeakMap();
2601
2595
  this.reactiveObjectGraph = new WeakMap();
2602
-
2603
- if (!isUndefined(options)) {
2604
- const {
2605
- valueDistortion,
2606
- valueMutated,
2607
- valueObserved,
2608
- valueIsObservable,
2609
- tagPropertyKey
2610
- } = options;
2611
- this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
2612
- this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2613
- this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2614
- this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2615
- this.tagPropertyKey = tagPropertyKey;
2616
- }
2596
+ const {
2597
+ valueMutated,
2598
+ valueObserved,
2599
+ valueIsObservable,
2600
+ tagPropertyKey
2601
+ } = options;
2602
+ this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
2603
+ this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
2604
+ this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
2605
+ this.tagPropertyKey = tagPropertyKey;
2617
2606
  }
2618
2607
 
2619
2608
  getProxy(value) {
2620
2609
  const unwrappedValue = unwrap$1(value);
2621
- const distorted = this.valueDistortion(unwrappedValue);
2622
2610
 
2623
- if (this.valueIsObservable(distorted)) {
2624
- if (this.readOnlyObjectGraph.get(distorted) === value) {
2625
- // when trying to extract the writable version of a readonly
2626
- // we return the readonly.
2611
+ if (this.valueIsObservable(unwrappedValue)) {
2612
+ // When trying to extract the writable version of a readonly we return the readonly.
2613
+ if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {
2627
2614
  return value;
2628
2615
  }
2629
2616
 
2630
- return this.getReactiveHandler(unwrappedValue, distorted);
2617
+ return this.getReactiveHandler(unwrappedValue);
2631
2618
  }
2632
2619
 
2633
- return distorted;
2620
+ return unwrappedValue;
2634
2621
  }
2635
2622
 
2636
2623
  getReadOnlyProxy(value) {
2637
2624
  value = unwrap$1(value);
2638
- const distorted = this.valueDistortion(value);
2639
2625
 
2640
- if (this.valueIsObservable(distorted)) {
2641
- return this.getReadOnlyHandler(value, distorted);
2626
+ if (this.valueIsObservable(value)) {
2627
+ return this.getReadOnlyHandler(value);
2642
2628
  }
2643
2629
 
2644
- return distorted;
2630
+ return value;
2645
2631
  }
2646
2632
 
2647
2633
  unwrapProxy(p) {
2648
2634
  return unwrap$1(p);
2649
2635
  }
2650
2636
 
2651
- getReactiveHandler(value, distortedValue) {
2652
- let proxy = this.reactiveObjectGraph.get(distortedValue);
2637
+ getReactiveHandler(value) {
2638
+ let proxy = this.reactiveObjectGraph.get(value);
2653
2639
 
2654
2640
  if (isUndefined(proxy)) {
2655
2641
  // caching the proxy after the first time it is accessed
2656
- const handler = new ReactiveProxyHandler(this, distortedValue);
2657
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2642
+ const handler = new ReactiveProxyHandler(this, value);
2643
+ proxy = new Proxy(createShadowTarget(value), handler);
2658
2644
  registerProxy(proxy, value);
2659
- this.reactiveObjectGraph.set(distortedValue, proxy);
2645
+ this.reactiveObjectGraph.set(value, proxy);
2660
2646
  }
2661
2647
 
2662
2648
  return proxy;
2663
2649
  }
2664
2650
 
2665
- getReadOnlyHandler(value, distortedValue) {
2666
- let proxy = this.readOnlyObjectGraph.get(distortedValue);
2651
+ getReadOnlyHandler(value) {
2652
+ let proxy = this.readOnlyObjectGraph.get(value);
2667
2653
 
2668
2654
  if (isUndefined(proxy)) {
2669
2655
  // caching the proxy after the first time it is accessed
2670
- const handler = new ReadOnlyHandler(this, distortedValue);
2671
- proxy = new Proxy(createShadowTarget(distortedValue), handler);
2656
+ const handler = new ReadOnlyHandler(this, value);
2657
+ proxy = new Proxy(createShadowTarget(value), handler);
2672
2658
  registerProxy(proxy, value);
2673
- this.readOnlyObjectGraph.set(distortedValue, proxy);
2659
+ this.readOnlyObjectGraph.set(value, proxy);
2674
2660
  }
2675
2661
 
2676
2662
  return proxy;
2677
2663
  }
2678
2664
 
2679
2665
  }
2680
- /** version: 1.1.5 */
2666
+ /** version: 2.0.0 */
2681
2667
 
2682
2668
  /*
2683
2669
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2688,15 +2674,9 @@ class ReactiveMembrane {
2688
2674
 
2689
2675
 
2690
2676
  const lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
2691
-
2692
- function valueDistortion(value) {
2693
- return value;
2694
- }
2695
-
2696
- const reactiveMembrane = new ReactiveMembrane({
2677
+ const reactiveMembrane = new ObservableMembrane({
2697
2678
  valueObserved,
2698
2679
  valueMutated,
2699
- valueDistortion,
2700
2680
  tagPropertyKey: lockerLivePropertyKey
2701
2681
  });
2702
2682
  /**
@@ -2705,16 +2685,9 @@ const reactiveMembrane = new ReactiveMembrane({
2705
2685
  * change or being removed.
2706
2686
  */
2707
2687
 
2708
- const unwrap = function (value) {
2709
- const unwrapped = reactiveMembrane.unwrapProxy(value);
2710
-
2711
- if (unwrapped !== value) {
2712
- // if value is a proxy, unwrap to access original value and apply distortion
2713
- return valueDistortion(unwrapped);
2714
- }
2715
-
2716
- return value;
2717
- };
2688
+ function unwrap(value) {
2689
+ return reactiveMembrane.unwrapProxy(value);
2690
+ }
2718
2691
  /*
2719
2692
  * Copyright (c) 2018, salesforce.com, inc.
2720
2693
  * All rights reserved.
@@ -4189,10 +4162,6 @@ function createComponentDef(Ctor) {
4189
4162
 
4190
4163
  assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
4191
4164
 
4192
- if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4193
- assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
4194
- }
4195
-
4196
4165
  if (!isUndefined$1(ctorShadowSupportMode)) {
4197
4166
  assert.invariant(ctorShadowSupportMode === "any"
4198
4167
  /* Any */
@@ -4579,13 +4548,15 @@ function updateElmHook(oldVnode, vnode) {
4579
4548
 
4580
4549
  function updateChildrenHook(oldVnode, vnode) {
4581
4550
  const {
4582
- children,
4583
- owner
4551
+ elm,
4552
+ children
4584
4553
  } = vnode;
4585
- const fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
4586
- runWithBoundaryProtection(owner, owner.owner, noop, () => {
4587
- fn(vnode.elm, oldVnode.children, children);
4588
- }, noop);
4554
+
4555
+ if (hasDynamicChildren(children)) {
4556
+ updateDynamicChildren(elm, oldVnode.children, children);
4557
+ } else {
4558
+ updateStaticChildren(elm, oldVnode.children, children);
4559
+ }
4589
4560
  }
4590
4561
 
4591
4562
  function allocateChildrenHook(vnode, vm) {
@@ -5823,6 +5794,7 @@ function updateStylesheetToken(vm, template) {
5823
5794
 
5824
5795
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5825
5796
  const content = [];
5797
+ let root;
5826
5798
 
5827
5799
  for (let i = 0; i < stylesheets.length; i++) {
5828
5800
  let stylesheet = stylesheets[i];
@@ -5835,23 +5807,46 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
5835
5807
  // the component instance might be attempting to use an old version of
5836
5808
  // the stylesheet, while internally, we have a replacement for it.
5837
5809
  stylesheet = getStyleOrSwappedStyle(stylesheet);
5838
- } // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5839
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5810
+ }
5811
+
5812
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5840
5813
 
5814
+ const scopeToken = isScopedCss || vm.shadowMode === 1
5815
+ /* Synthetic */
5816
+ && vm.renderMode === 1
5817
+ /* Shadow */
5818
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
5819
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
5841
5820
 
5842
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
5843
5821
  const useActualHostSelector = vm.renderMode === 0
5844
5822
  /* Light */
5845
5823
  ? !isScopedCss : vm.shadowMode === 0
5846
5824
  /* Native */
5847
- ; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
5825
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
5826
+ // we use an attribute selector on the host to simulate :dir().
5848
5827
 
5849
- const scopeToken = isScopedCss || vm.shadowMode === 1
5850
- /* Synthetic */
5851
- && vm.renderMode === 1
5828
+ let useNativeDirPseudoclass;
5829
+
5830
+ if (vm.renderMode === 1
5852
5831
  /* Shadow */
5853
- ? stylesheetToken : undefined;
5854
- ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
5832
+ ) {
5833
+ useNativeDirPseudoclass = vm.shadowMode === 0
5834
+ /* Native */
5835
+ ;
5836
+ } else {
5837
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
5838
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
5839
+ if (isUndefined$1(root)) {
5840
+ // Only calculate the root once as necessary
5841
+ root = getNearestShadowComponent(vm);
5842
+ }
5843
+
5844
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
5845
+ /* Native */
5846
+ ;
5847
+ }
5848
+
5849
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
5855
5850
  }
5856
5851
  }
5857
5852
 
@@ -5875,14 +5870,12 @@ function getStylesheetsContent(vm, template) {
5875
5870
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
5876
5871
 
5877
5872
 
5878
- function getNearestNativeShadowComponent(vm) {
5873
+ function getNearestShadowComponent(vm) {
5879
5874
  let owner = vm;
5880
5875
 
5881
5876
  while (!isNull(owner)) {
5882
5877
  if (owner.renderMode === 1
5883
5878
  /* Shadow */
5884
- && owner.shadowMode === 0
5885
- /* Native */
5886
5879
  ) {
5887
5880
  return owner;
5888
5881
  }
@@ -5893,6 +5886,20 @@ function getNearestNativeShadowComponent(vm) {
5893
5886
  return owner;
5894
5887
  }
5895
5888
 
5889
+ function getNearestNativeShadowComponent(vm) {
5890
+ const owner = getNearestShadowComponent(vm);
5891
+
5892
+ if (!isNull(owner) && owner.shadowMode === 1
5893
+ /* Synthetic */
5894
+ ) {
5895
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
5896
+ // synthetic, we know we won't find a native component if we go any further.
5897
+ return null;
5898
+ }
5899
+
5900
+ return owner;
5901
+ }
5902
+
5896
5903
  function createStylesheet(vm, stylesheets) {
5897
5904
  const {
5898
5905
  renderer,
@@ -7557,7 +7564,7 @@ function setHooks(hooks) {
7557
7564
  hooksAreSet = true;
7558
7565
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
7559
7566
  }
7560
- /* version: 2.5.10 */
7567
+ /* version: 2.7.1 */
7561
7568
 
7562
7569
  /*
7563
7570
  * Copyright (c) 2020, salesforce.com, inc.
@@ -8053,7 +8060,7 @@ function renderComponent(tagName, Ctor, props = {}) {
8053
8060
 
8054
8061
  freeze(LightningElement);
8055
8062
  seal(LightningElement.prototype);
8056
- /* version: 2.5.10 */
8063
+ /* version: 2.7.1 */
8057
8064
 
8058
8065
  exports.LightningElement = LightningElement;
8059
8066
  exports.api = api$1;