lwc 2.31.1 → 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 +237 -264
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +237 -264
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +109 -160
  5. package/dist/engine-dom/iife/es5/engine-dom.js +233 -242
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +142 -199
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +237 -264
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +109 -160
  11. package/dist/engine-dom/umd/es5/engine-dom.js +233 -242
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +142 -199
  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
@@ -333,7 +333,7 @@ var LWC = (function (exports) {
333
333
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
334
334
  return propertyName;
335
335
  }
336
- /** version: 2.31.1 */
336
+ /** version: 2.32.1 */
337
337
 
338
338
  /**
339
339
  * Copyright (C) 2018 salesforce.com, inc.
@@ -415,7 +415,7 @@ var LWC = (function (exports) {
415
415
  patch$1(propName);
416
416
  }
417
417
  }
418
- /** version: 2.31.1 */
418
+ /** version: 2.32.1 */
419
419
 
420
420
  /**
421
421
  * Copyright (C) 2018 salesforce.com, inc.
@@ -429,19 +429,14 @@ var LWC = (function (exports) {
429
429
  */
430
430
  const features = {
431
431
  DUMMY_TEST_FLAG: null,
432
- ENABLE_ELEMENT_PATCH: null,
433
432
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
434
- ENABLE_HTML_COLLECTIONS_PATCH: null,
435
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
436
433
  ENABLE_MIXED_SHADOW_MODE: null,
437
434
  ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
438
- ENABLE_NODE_LIST_PATCH: null,
439
- ENABLE_NODE_PATCH: null,
440
- ENABLE_REACTIVE_SETTER: null,
441
435
  ENABLE_WIRE_SYNC_EMIT: null,
442
436
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
443
437
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
444
438
  ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
439
+ ENABLE_FROZEN_TEMPLATE: null,
445
440
  };
446
441
  if (!_globalThis.lwcRuntimeFlags) {
447
442
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
@@ -1697,45 +1692,6 @@ var LWC = (function (exports) {
1697
1692
  configurable: true,
1698
1693
  };
1699
1694
  }
1700
- class AccessorReactiveObserver extends ReactiveObserver {
1701
- constructor(vm, set) {
1702
- super(() => {
1703
- if (isFalse(this.debouncing)) {
1704
- this.debouncing = true;
1705
- addCallbackToNextTick(() => {
1706
- if (isTrue(this.debouncing)) {
1707
- const { value } = this;
1708
- const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
1709
- set.call(component, value);
1710
- // de-bouncing after the call to the original setter to prevent
1711
- // infinity loop if the setter itself is mutating things that
1712
- // were accessed during the previous invocation.
1713
- this.debouncing = false;
1714
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
1715
- // immediate rehydration due to a setter driven mutation, otherwise
1716
- // the component will get rendered on the second tick, which it is not
1717
- // desirable.
1718
- rerenderVM(vm);
1719
- }
1720
- }
1721
- });
1722
- }
1723
- });
1724
- this.debouncing = false;
1725
- }
1726
- reset(value) {
1727
- super.reset();
1728
- this.debouncing = false;
1729
- if (arguments.length > 0) {
1730
- this.value = value;
1731
- }
1732
- }
1733
- }
1734
- function createAccessorReactiveObserver(vm, set) {
1735
- // On the server side, we don't need mutation tracking. Skipping it improves performance.
1736
- return new AccessorReactiveObserver(vm, set)
1737
- ;
1738
- }
1739
1695
 
1740
1696
  /*
1741
1697
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1744,65 +1700,45 @@ var LWC = (function (exports) {
1744
1700
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1745
1701
  */
1746
1702
  function api$1() {
1747
- throw new Error();
1703
+ throw new Error();
1748
1704
  }
1749
1705
  function createPublicPropertyDescriptor(key) {
1750
- return {
1751
- get() {
1752
- const vm = getAssociatedVM(this);
1753
- if (isBeingConstructed(vm)) {
1754
- return;
1755
- }
1756
- componentValueObserved(vm, key);
1757
- return vm.cmpProps[key];
1758
- },
1759
- set(newValue) {
1760
- const vm = getAssociatedVM(this);
1761
- vm.cmpProps[key] = newValue;
1762
- componentValueMutated(vm, key);
1763
- },
1764
- enumerable: true,
1765
- configurable: true
1766
- };
1706
+ return {
1707
+ get() {
1708
+ const vm = getAssociatedVM(this);
1709
+ if (isBeingConstructed(vm)) {
1710
+ return;
1711
+ }
1712
+ componentValueObserved(vm, key);
1713
+ return vm.cmpProps[key];
1714
+ },
1715
+ set(newValue) {
1716
+ const vm = getAssociatedVM(this);
1717
+ vm.cmpProps[key] = newValue;
1718
+ componentValueMutated(vm, key);
1719
+ },
1720
+ enumerable: true,
1721
+ configurable: true,
1722
+ };
1767
1723
  }
1768
1724
  function createPublicAccessorDescriptor(key, descriptor) {
1769
- const {
1770
- get,
1771
- set,
1772
- enumerable,
1773
- configurable
1774
- } = descriptor;
1775
- if (!isFunction$1(get)) {
1776
- throw new Error();
1777
- }
1778
- return {
1779
- get() {
1780
- return get.call(this);
1781
- },
1782
- set(newValue) {
1783
- const vm = getAssociatedVM(this);
1784
- if (set) {
1785
- if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
1786
- let ro = vm.oar[key];
1787
- if (isUndefined$1(ro)) {
1788
- ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
1789
- }
1790
- // every time we invoke this setter from outside (through this wrapper setter)
1791
- // we should reset the value and then debounce just in case there is a pending
1792
- // invocation the next tick that is not longer relevant since the value is changing
1793
- // from outside.
1794
- ro.reset(newValue);
1795
- ro.observe(() => {
1796
- set.call(this, newValue);
1797
- });
1798
- } else {
1799
- set.call(this, newValue);
1800
- }
1801
- }
1802
- },
1803
- enumerable,
1804
- configurable
1805
- };
1725
+ const { get, set, enumerable, configurable } = descriptor;
1726
+ if (!isFunction$1(get)) {
1727
+ throw new Error();
1728
+ }
1729
+ return {
1730
+ get() {
1731
+ return get.call(this);
1732
+ },
1733
+ set(newValue) {
1734
+ getAssociatedVM(this);
1735
+ if (set) {
1736
+ set.call(this, newValue);
1737
+ }
1738
+ },
1739
+ enumerable,
1740
+ configurable,
1741
+ };
1806
1742
  }
1807
1743
 
1808
1744
  /*
@@ -1984,12 +1920,6 @@ var LWC = (function (exports) {
1984
1920
  return isUndefined$1(meta) ? defaultMeta : meta;
1985
1921
  }
1986
1922
 
1987
- /*
1988
- * Copyright (c) 2018, salesforce.com, inc.
1989
- * All rights reserved.
1990
- * SPDX-License-Identifier: MIT
1991
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1992
- */
1993
1923
  const signedTemplateSet = new Set();
1994
1924
  function defaultEmptyTemplate() {
1995
1925
  return [];
@@ -2004,32 +1934,6 @@ var LWC = (function (exports) {
2004
1934
  */
2005
1935
  function registerTemplate(tpl) {
2006
1936
  signedTemplateSet.add(tpl);
2007
- // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2008
- // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2009
- // on top of stylesheetToken for anyone who is accessing the old internal API.
2010
- // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2011
- defineProperty(tpl, 'stylesheetTokens', {
2012
- enumerable: true,
2013
- configurable: true,
2014
- get() {
2015
- const { stylesheetToken } = this;
2016
- if (isUndefined$1(stylesheetToken)) {
2017
- return stylesheetToken;
2018
- }
2019
- // Shim for the old `stylesheetTokens` property
2020
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2021
- return {
2022
- hostAttribute: `${stylesheetToken}-host`,
2023
- shadowAttribute: stylesheetToken,
2024
- };
2025
- },
2026
- set(value) {
2027
- // If the value is null or some other exotic object, you would be broken anyway in the past
2028
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2029
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2030
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2031
- },
2032
- });
2033
1937
  // chaining this method as a way to wrap existing
2034
1938
  // assignment of templates easily, without too much transformation
2035
1939
  return tpl;
@@ -3644,7 +3548,7 @@ var LWC = (function (exports) {
3644
3548
  // undefined is for root components, but root components cannot accept slotted content
3645
3549
  setVMBeingRendered(slotset.owner);
3646
3550
  try {
3647
- ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
3551
+ ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
3648
3552
  }
3649
3553
  finally {
3650
3554
  setVMBeingRendered(vmBeingRenderedInception);
@@ -4310,15 +4214,10 @@ var LWC = (function (exports) {
4310
4214
  } = vm;
4311
4215
  if (state !== 2 /* VMState.disconnected */) {
4312
4216
  const {
4313
- oar,
4314
4217
  tro
4315
4218
  } = vm;
4316
4219
  // Making sure that any observing record will not trigger the rehydrated on this vm
4317
4220
  tro.reset();
4318
- // Making sure that any observing accessor record will not trigger the setter to be reinvoked
4319
- for (const key in oar) {
4320
- oar[key].reset();
4321
- }
4322
4221
  runDisconnectedCallback(vm);
4323
4222
  // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
4324
4223
  runChildNodesDisconnectedCallback(vm);
@@ -4365,7 +4264,6 @@ var LWC = (function (exports) {
4365
4264
  cmpSlots: {
4366
4265
  slotAssignments: create(null)
4367
4266
  },
4368
- oar: create(null),
4369
4267
  cmpTemplate: null,
4370
4268
  hydrated: Boolean(hydrated),
4371
4269
  renderMode: def.renderMode,
@@ -5395,9 +5293,60 @@ var LWC = (function (exports) {
5395
5293
  hooksAreSet = true;
5396
5294
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
5397
5295
  }
5398
- // TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
5399
- // just warns on mutation.
5296
+ // Deeply freeze the entire array (of arrays) of stylesheet factory functions
5297
+ function deepFreeze(stylesheets) {
5298
+ traverseStylesheets(stylesheets, subStylesheets => {
5299
+ freeze(subStylesheets);
5300
+ });
5301
+ }
5302
+ // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
5303
+ function traverseStylesheets(stylesheets, callback) {
5304
+ callback(stylesheets);
5305
+ for (let i = 0; i < stylesheets.length; i++) {
5306
+ const stylesheet = stylesheets[i];
5307
+ if (isArray$1(stylesheet)) {
5308
+ traverseStylesheets(stylesheet, callback);
5309
+ } else {
5310
+ callback(stylesheet);
5311
+ }
5312
+ }
5313
+ }
5400
5314
  function freezeTemplate(tmpl) {
5315
+ if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
5316
+ // Deep freeze the template
5317
+ freeze(tmpl);
5318
+ if (!isUndefined$1(tmpl.stylesheets)) {
5319
+ deepFreeze(tmpl.stylesheets);
5320
+ }
5321
+ } else {
5322
+ // TODO [#2782]: remove this flag and delete the legacy behavior
5323
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
5324
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
5325
+ defineProperty(tmpl, 'stylesheetTokens', {
5326
+ enumerable: true,
5327
+ configurable: true,
5328
+ get() {
5329
+ const {
5330
+ stylesheetToken
5331
+ } = this;
5332
+ if (isUndefined$1(stylesheetToken)) {
5333
+ return stylesheetToken;
5334
+ }
5335
+ // Shim for the old `stylesheetTokens` property
5336
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
5337
+ return {
5338
+ hostAttribute: `${stylesheetToken}-host`,
5339
+ shadowAttribute: stylesheetToken
5340
+ };
5341
+ },
5342
+ set(value) {
5343
+ // If the value is null or some other exotic object, you would be broken anyway in the past
5344
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
5345
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
5346
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
5347
+ }
5348
+ });
5349
+ }
5401
5350
  }
5402
5351
 
5403
5352
  /*
@@ -6183,25 +6132,25 @@ var LWC = (function (exports) {
6183
6132
  // multiple times per tag name.
6184
6133
  const createUserConstructor = (HTMLElementToExtend, upgradeCallback, connectedCallback, disconnectedCallback) => {
6185
6134
  // TODO [#2972]: this class should expose observedAttributes as necessary
6186
- class UserConstructor extends HTMLElementToExtend {
6135
+ return class UserConstructor extends HTMLElementToExtend {
6187
6136
  constructor() {
6188
6137
  super();
6189
6138
  upgradeCallback(this);
6190
6139
  }
6191
- }
6192
- // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
6193
- // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
6194
- if (!isUndefined$1(connectedCallback)) {
6195
- UserConstructor.prototype.connectedCallback = function () {
6196
- connectedCallback(this);
6197
- };
6198
- }
6199
- if (!isUndefined$1(disconnectedCallback)) {
6200
- UserConstructor.prototype.disconnectedCallback = function () {
6201
- disconnectedCallback(this);
6202
- };
6203
- }
6204
- return UserConstructor;
6140
+ // Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
6141
+ // here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
6142
+ // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
6143
+ connectedCallback() {
6144
+ if (!isUndefined$1(connectedCallback)) {
6145
+ connectedCallback(this);
6146
+ }
6147
+ }
6148
+ disconnectedCallback() {
6149
+ if (!isUndefined$1(disconnectedCallback)) {
6150
+ disconnectedCallback(this);
6151
+ }
6152
+ }
6153
+ };
6205
6154
  };
6206
6155
  function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
6207
6156
  if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
@@ -6305,7 +6254,7 @@ var LWC = (function (exports) {
6305
6254
  function isNull(obj) {
6306
6255
  return obj === null;
6307
6256
  }
6308
- /** version: 2.31.1 */
6257
+ /** version: 2.32.1 */
6309
6258
 
6310
6259
  /*
6311
6260
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6858,7 +6807,7 @@ var LWC = (function (exports) {
6858
6807
  });
6859
6808
  freeze(LightningElement);
6860
6809
  seal(LightningElement.prototype);
6861
- /* version: 2.31.1 */
6810
+ /* version: 2.32.1 */
6862
6811
 
6863
6812
  exports.LightningElement = LightningElement;
6864
6813
  exports.__unstable__ProfilerControl = profilerControl;