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