lwc 2.32.0 → 2.32.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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +222 -249
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +222 -249
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +94 -145
  5. package/dist/engine-dom/iife/es5/engine-dom.js +211 -226
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +120 -183
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +222 -249
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +94 -145
  11. package/dist/engine-dom/umd/es5/engine-dom.js +211 -226
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +120 -183
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +218 -224
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +218 -224
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +85 -345
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +85 -345
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +85 -345
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +85 -345
  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 +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -336,7 +336,7 @@
336
336
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
337
337
  return propertyName;
338
338
  }
339
- /** version: 2.32.0 */
339
+ /** version: 2.32.1 */
340
340
 
341
341
  /**
342
342
  * Copyright (C) 2018 salesforce.com, inc.
@@ -418,7 +418,7 @@
418
418
  patch$1(propName);
419
419
  }
420
420
  }
421
- /** version: 2.32.0 */
421
+ /** version: 2.32.1 */
422
422
 
423
423
  /**
424
424
  * Copyright (C) 2018 salesforce.com, inc.
@@ -432,19 +432,14 @@
432
432
  */
433
433
  const features = {
434
434
  DUMMY_TEST_FLAG: null,
435
- ENABLE_ELEMENT_PATCH: null,
436
435
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
437
- ENABLE_HTML_COLLECTIONS_PATCH: null,
438
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
439
436
  ENABLE_MIXED_SHADOW_MODE: null,
440
437
  ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
441
- ENABLE_NODE_LIST_PATCH: null,
442
- ENABLE_NODE_PATCH: null,
443
- ENABLE_REACTIVE_SETTER: null,
444
438
  ENABLE_WIRE_SYNC_EMIT: null,
445
439
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
446
440
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
447
441
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
442
+ ENABLE_FROZEN_TEMPLATE: null,
448
443
  };
449
444
  if (!_globalThis.lwcRuntimeFlags) {
450
445
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
@@ -1700,45 +1695,6 @@
1700
1695
  configurable: true,
1701
1696
  };
1702
1697
  }
1703
- class AccessorReactiveObserver extends ReactiveObserver {
1704
- constructor(vm, set) {
1705
- super(() => {
1706
- if (isFalse(this.debouncing)) {
1707
- this.debouncing = true;
1708
- addCallbackToNextTick(() => {
1709
- if (isTrue(this.debouncing)) {
1710
- const { value } = this;
1711
- const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
1712
- set.call(component, value);
1713
- // de-bouncing after the call to the original setter to prevent
1714
- // infinity loop if the setter itself is mutating things that
1715
- // were accessed during the previous invocation.
1716
- this.debouncing = false;
1717
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
1718
- // immediate rehydration due to a setter driven mutation, otherwise
1719
- // the component will get rendered on the second tick, which it is not
1720
- // desirable.
1721
- rerenderVM(vm);
1722
- }
1723
- }
1724
- });
1725
- }
1726
- });
1727
- this.debouncing = false;
1728
- }
1729
- reset(value) {
1730
- super.reset();
1731
- this.debouncing = false;
1732
- if (arguments.length > 0) {
1733
- this.value = value;
1734
- }
1735
- }
1736
- }
1737
- function createAccessorReactiveObserver(vm, set) {
1738
- // On the server side, we don't need mutation tracking. Skipping it improves performance.
1739
- return new AccessorReactiveObserver(vm, set)
1740
- ;
1741
- }
1742
1698
 
1743
1699
  /*
1744
1700
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1747,65 +1703,45 @@
1747
1703
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1748
1704
  */
1749
1705
  function api$1() {
1750
- throw new Error();
1706
+ throw new Error();
1751
1707
  }
1752
1708
  function createPublicPropertyDescriptor(key) {
1753
- return {
1754
- get() {
1755
- const vm = getAssociatedVM(this);
1756
- if (isBeingConstructed(vm)) {
1757
- return;
1758
- }
1759
- componentValueObserved(vm, key);
1760
- return vm.cmpProps[key];
1761
- },
1762
- set(newValue) {
1763
- const vm = getAssociatedVM(this);
1764
- vm.cmpProps[key] = newValue;
1765
- componentValueMutated(vm, key);
1766
- },
1767
- enumerable: true,
1768
- configurable: true
1769
- };
1709
+ return {
1710
+ get() {
1711
+ const vm = getAssociatedVM(this);
1712
+ if (isBeingConstructed(vm)) {
1713
+ return;
1714
+ }
1715
+ componentValueObserved(vm, key);
1716
+ return vm.cmpProps[key];
1717
+ },
1718
+ set(newValue) {
1719
+ const vm = getAssociatedVM(this);
1720
+ vm.cmpProps[key] = newValue;
1721
+ componentValueMutated(vm, key);
1722
+ },
1723
+ enumerable: true,
1724
+ configurable: true,
1725
+ };
1770
1726
  }
1771
1727
  function createPublicAccessorDescriptor(key, descriptor) {
1772
- const {
1773
- get,
1774
- set,
1775
- enumerable,
1776
- configurable
1777
- } = descriptor;
1778
- if (!isFunction$1(get)) {
1779
- throw new Error();
1780
- }
1781
- return {
1782
- get() {
1783
- return get.call(this);
1784
- },
1785
- set(newValue) {
1786
- const vm = getAssociatedVM(this);
1787
- if (set) {
1788
- if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
1789
- let ro = vm.oar[key];
1790
- if (isUndefined$1(ro)) {
1791
- ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
1792
- }
1793
- // every time we invoke this setter from outside (through this wrapper setter)
1794
- // we should reset the value and then debounce just in case there is a pending
1795
- // invocation the next tick that is not longer relevant since the value is changing
1796
- // from outside.
1797
- ro.reset(newValue);
1798
- ro.observe(() => {
1799
- set.call(this, newValue);
1800
- });
1801
- } else {
1802
- set.call(this, newValue);
1803
- }
1804
- }
1805
- },
1806
- enumerable,
1807
- configurable
1808
- };
1728
+ const { get, set, enumerable, configurable } = descriptor;
1729
+ if (!isFunction$1(get)) {
1730
+ throw new Error();
1731
+ }
1732
+ return {
1733
+ get() {
1734
+ return get.call(this);
1735
+ },
1736
+ set(newValue) {
1737
+ getAssociatedVM(this);
1738
+ if (set) {
1739
+ set.call(this, newValue);
1740
+ }
1741
+ },
1742
+ enumerable,
1743
+ configurable,
1744
+ };
1809
1745
  }
1810
1746
 
1811
1747
  /*
@@ -1987,12 +1923,6 @@
1987
1923
  return isUndefined$1(meta) ? defaultMeta : meta;
1988
1924
  }
1989
1925
 
1990
- /*
1991
- * Copyright (c) 2018, salesforce.com, inc.
1992
- * All rights reserved.
1993
- * SPDX-License-Identifier: MIT
1994
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1995
- */
1996
1926
  const signedTemplateSet = new Set();
1997
1927
  function defaultEmptyTemplate() {
1998
1928
  return [];
@@ -2007,32 +1937,6 @@
2007
1937
  */
2008
1938
  function registerTemplate(tpl) {
2009
1939
  signedTemplateSet.add(tpl);
2010
- // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2011
- // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2012
- // on top of stylesheetToken for anyone who is accessing the old internal API.
2013
- // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2014
- defineProperty(tpl, 'stylesheetTokens', {
2015
- enumerable: true,
2016
- configurable: true,
2017
- get() {
2018
- const { stylesheetToken } = this;
2019
- if (isUndefined$1(stylesheetToken)) {
2020
- return stylesheetToken;
2021
- }
2022
- // Shim for the old `stylesheetTokens` property
2023
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2024
- return {
2025
- hostAttribute: `${stylesheetToken}-host`,
2026
- shadowAttribute: stylesheetToken,
2027
- };
2028
- },
2029
- set(value) {
2030
- // If the value is null or some other exotic object, you would be broken anyway in the past
2031
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2032
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2033
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2034
- },
2035
- });
2036
1940
  // chaining this method as a way to wrap existing
2037
1941
  // assignment of templates easily, without too much transformation
2038
1942
  return tpl;
@@ -3647,7 +3551,7 @@
3647
3551
  // undefined is for root components, but root components cannot accept slotted content
3648
3552
  setVMBeingRendered(slotset.owner);
3649
3553
  try {
3650
- ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
3554
+ ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
3651
3555
  }
3652
3556
  finally {
3653
3557
  setVMBeingRendered(vmBeingRenderedInception);
@@ -4313,15 +4217,10 @@
4313
4217
  } = vm;
4314
4218
  if (state !== 2 /* VMState.disconnected */) {
4315
4219
  const {
4316
- oar,
4317
4220
  tro
4318
4221
  } = vm;
4319
4222
  // Making sure that any observing record will not trigger the rehydrated on this vm
4320
4223
  tro.reset();
4321
- // Making sure that any observing accessor record will not trigger the setter to be reinvoked
4322
- for (const key in oar) {
4323
- oar[key].reset();
4324
- }
4325
4224
  runDisconnectedCallback(vm);
4326
4225
  // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
4327
4226
  runChildNodesDisconnectedCallback(vm);
@@ -4368,7 +4267,6 @@
4368
4267
  cmpSlots: {
4369
4268
  slotAssignments: create(null)
4370
4269
  },
4371
- oar: create(null),
4372
4270
  cmpTemplate: null,
4373
4271
  hydrated: Boolean(hydrated),
4374
4272
  renderMode: def.renderMode,
@@ -5398,9 +5296,60 @@
5398
5296
  hooksAreSet = true;
5399
5297
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5400
5298
  }
5401
- // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
5402
- // just warns on mutation.
5299
+ // Deeply freeze the entire array (of arrays) of stylesheet factory functions
5300
+ function deepFreeze(stylesheets) {
5301
+ traverseStylesheets(stylesheets, subStylesheets => {
5302
+ freeze(subStylesheets);
5303
+ });
5304
+ }
5305
+ // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
5306
+ function traverseStylesheets(stylesheets, callback) {
5307
+ callback(stylesheets);
5308
+ for (let i = 0; i < stylesheets.length; i++) {
5309
+ const stylesheet = stylesheets[i];
5310
+ if (isArray$1(stylesheet)) {
5311
+ traverseStylesheets(stylesheet, callback);
5312
+ } else {
5313
+ callback(stylesheet);
5314
+ }
5315
+ }
5316
+ }
5403
5317
  function freezeTemplate(tmpl) {
5318
+ if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
5319
+ // Deep freeze the template
5320
+ freeze(tmpl);
5321
+ if (!isUndefined$1(tmpl.stylesheets)) {
5322
+ deepFreeze(tmpl.stylesheets);
5323
+ }
5324
+ } else {
5325
+ // TODO [#2782]: remove this flag and delete the legacy behavior
5326
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
5327
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
5328
+ defineProperty(tmpl, 'stylesheetTokens', {
5329
+ enumerable: true,
5330
+ configurable: true,
5331
+ get() {
5332
+ const {
5333
+ stylesheetToken
5334
+ } = this;
5335
+ if (isUndefined$1(stylesheetToken)) {
5336
+ return stylesheetToken;
5337
+ }
5338
+ // Shim for the old `stylesheetTokens` property
5339
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
5340
+ return {
5341
+ hostAttribute: `${stylesheetToken}-host`,
5342
+ shadowAttribute: stylesheetToken
5343
+ };
5344
+ },
5345
+ set(value) {
5346
+ // If the value is null or some other exotic object, you would be broken anyway in the past
5347
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
5348
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
5349
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
5350
+ }
5351
+ });
5352
+ }
5404
5353
  }
5405
5354
 
5406
5355
  /*
@@ -6308,7 +6257,7 @@
6308
6257
  function isNull(obj) {
6309
6258
  return obj === null;
6310
6259
  }
6311
- /** version: 2.32.0 */
6260
+ /** version: 2.32.1 */
6312
6261
 
6313
6262
  /*
6314
6263
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6861,7 +6810,7 @@
6861
6810
  });
6862
6811
  freeze(LightningElement);
6863
6812
  seal(LightningElement.prototype);
6864
- /* version: 2.32.0 */
6813
+ /* version: 2.32.1 */
6865
6814
 
6866
6815
  exports.LightningElement = LightningElement;
6867
6816
  exports.__unstable__ProfilerControl = profilerControl;