lwc 2.30.1 → 2.30.3

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 +207 -75
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +207 -75
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +204 -72
  5. package/dist/engine-dom/iife/es5/engine-dom.js +254 -118
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +251 -115
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +207 -75
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +204 -72
  11. package/dist/engine-dom/umd/es5/engine-dom.js +254 -118
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +251 -115
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +128 -48
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +128 -48
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +7 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +7 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +7 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +7 -4
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -4
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +7 -4
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +7 -4
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +7 -4
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -4
  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
@@ -237,32 +237,57 @@ const KEY__SCOPED_CSS = '$scoped$';
237
237
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
238
238
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
239
239
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
240
- /**
241
- * Map composed of properties to attributes not following the HTML property to attribute mapping
242
- * convention.
240
+
241
+ /*
242
+ * Copyright (c) 2020, salesforce.com, inc.
243
+ * All rights reserved.
244
+ * SPDX-License-Identifier: MIT
245
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
243
246
  */
244
- const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([
245
- ['accessKey', 'accesskey'],
246
- ['readOnly', 'readonly'],
247
- ['tabIndex', 'tabindex'],
248
- ['bgColor', 'bgcolor'],
249
- ['colSpan', 'colspan'],
250
- ['rowSpan', 'rowspan'],
251
- ['contentEditable', 'contenteditable'],
252
- ['crossOrigin', 'crossorigin'],
253
- ['dateTime', 'datetime'],
254
- ['formAction', 'formaction'],
255
- ['isMap', 'ismap'],
256
- ['maxLength', 'maxlength'],
257
- ['minLength', 'minlength'],
258
- ['noValidate', 'novalidate'],
259
- ['useMap', 'usemap'],
260
- ['htmlFor', 'for'],
261
- ]);
247
+ const CAMEL_REGEX = /-([a-z])/g;
248
+ // Convoluted map generation so that @lwc/shared remains fully tree-shakable (verify-treeshakable)
249
+ const { NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING, NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING } =
250
+ /*#__PURE__*/ (() => {
251
+ /**
252
+ * Map composed of properties to attributes not following the HTML property to attribute mapping
253
+ * convention.
254
+ */
255
+ const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([
256
+ ['accessKey', 'accesskey'],
257
+ ['readOnly', 'readonly'],
258
+ ['tabIndex', 'tabindex'],
259
+ ['bgColor', 'bgcolor'],
260
+ ['colSpan', 'colspan'],
261
+ ['rowSpan', 'rowspan'],
262
+ ['contentEditable', 'contenteditable'],
263
+ ['crossOrigin', 'crossorigin'],
264
+ ['dateTime', 'datetime'],
265
+ ['formAction', 'formaction'],
266
+ ['isMap', 'ismap'],
267
+ ['maxLength', 'maxlength'],
268
+ ['minLength', 'minlength'],
269
+ ['noValidate', 'novalidate'],
270
+ ['useMap', 'usemap'],
271
+ ['htmlFor', 'for'],
272
+ ]);
273
+ /**
274
+ * Inverted map with attribute name key and property name value.
275
+ */
276
+ const NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING = new Map();
277
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.forEach((value, key) => NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.set(value, key));
278
+ return {
279
+ NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
280
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING,
281
+ };
282
+ })();
262
283
  /**
263
284
  * Map associating previously transformed HTML property into HTML attribute.
264
285
  */
265
286
  const CACHED_PROPERTY_ATTRIBUTE_MAPPING = new Map();
287
+ /**
288
+ * Map associating previously transformed HTML attribute into HTML property.
289
+ */
290
+ const CACHED_ATTRIBUTE_PROPERTY_MAPPING = new Map();
266
291
  function htmlPropertyToAttribute(propName) {
267
292
  const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
268
293
  if (!isUndefined$1(ariaAttributeName)) {
@@ -291,6 +316,23 @@ function htmlPropertyToAttribute(propName) {
291
316
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
292
317
  return attributeName;
293
318
  }
319
+ function htmlAttributeToProperty(attrName) {
320
+ const ariaPropertyName = AriaAttrNameToPropNameMap[attrName];
321
+ if (!isUndefined$1(ariaPropertyName)) {
322
+ return ariaPropertyName;
323
+ }
324
+ const specialPropertyName = NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
325
+ if (!isUndefined$1(specialPropertyName)) {
326
+ return specialPropertyName;
327
+ }
328
+ const cachedPropertyName = CACHED_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
329
+ if (!isUndefined$1(cachedPropertyName)) {
330
+ return cachedPropertyName;
331
+ }
332
+ const propertyName = StringReplace.call(attrName, CAMEL_REGEX, (g) => g[1].toUpperCase());
333
+ CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
334
+ return propertyName;
335
+ }
294
336
 
295
337
  /*
296
338
  * Copyright (c) 2018, salesforce.com, inc.
@@ -299,9 +341,9 @@ function htmlPropertyToAttribute(propName) {
299
341
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
300
342
  */
301
343
  // Increment whenever the LWC template compiler changes
302
- const LWC_VERSION = "2.30.1";
344
+ const LWC_VERSION = "2.30.3";
303
345
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
304
- /** version: 2.30.1 */
346
+ /** version: 2.30.3 */
305
347
 
306
348
  /**
307
349
  * Copyright (C) 2018 salesforce.com, inc.
@@ -383,7 +425,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
383
425
  patch$1(propName);
384
426
  }
385
427
  }
386
- /** version: 2.30.1 */
428
+ /** version: 2.30.3 */
387
429
 
388
430
  /**
389
431
  * Copyright (C) 2018 salesforce.com, inc.
@@ -463,7 +505,7 @@ function setFeatureFlagForTest(name, value) {
463
505
  setFeatureFlag(name, value);
464
506
  }
465
507
  }
466
- /** version: 2.30.1 */
508
+ /** version: 2.30.3 */
467
509
 
468
510
  /*
469
511
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3615,7 +3657,7 @@ function isVScopedSlotFragment(vnode) {
3615
3657
  * SPDX-License-Identifier: MIT
3616
3658
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3617
3659
  */
3618
- const ColonCharCode = 58;
3660
+ const ColonCharCode$1 = 58;
3619
3661
  function patchAttributes(oldVnode, vnode, renderer) {
3620
3662
  const { attrs } = vnode.data;
3621
3663
  if (isUndefined$1(attrs)) {
@@ -3632,11 +3674,11 @@ function patchAttributes(oldVnode, vnode, renderer) {
3632
3674
  const old = oldAttrs[key];
3633
3675
  if (old !== cur) {
3634
3676
  unlockAttribute(elm, key);
3635
- if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
3677
+ if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
3636
3678
  // Assume xml namespace
3637
3679
  setAttribute(elm, key, cur, XML_NAMESPACE);
3638
3680
  }
3639
- else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
3681
+ else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
3640
3682
  // Assume xlink namespace
3641
3683
  setAttribute(elm, key, cur, XLINK_NAMESPACE);
3642
3684
  }
@@ -3651,6 +3693,46 @@ function patchAttributes(oldVnode, vnode, renderer) {
3651
3693
  }
3652
3694
  }
3653
3695
 
3696
+ /*
3697
+ * Copyright (c) 2018, salesforce.com, inc.
3698
+ * All rights reserved.
3699
+ * SPDX-License-Identifier: MIT
3700
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3701
+ */
3702
+ const ColonCharCode = 58;
3703
+ function patchAttrUnlessProp(oldVnode, vnode, renderer) {
3704
+ const { data: { attrs }, elm, } = vnode;
3705
+ if (isUndefined$1(attrs)) {
3706
+ return;
3707
+ }
3708
+ const { removeAttribute, setAttribute, setProperty } = renderer;
3709
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3710
+ for (const name in attrs) {
3711
+ const cur = attrs[name];
3712
+ const old = oldAttrs[name];
3713
+ if (old !== cur) {
3714
+ const propName = htmlAttributeToProperty(name);
3715
+ if (propName in elm) {
3716
+ setProperty(elm, name, cur);
3717
+ }
3718
+ else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
3719
+ // Assume xml namespace
3720
+ setAttribute(elm, name, cur, XML_NAMESPACE);
3721
+ }
3722
+ else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
3723
+ // Assume xlink namespace
3724
+ setAttribute(elm, name, cur, XLINK_NAMESPACE);
3725
+ }
3726
+ else if (isNull(cur) || isUndefined$1(cur)) {
3727
+ removeAttribute(elm, name);
3728
+ }
3729
+ else {
3730
+ setAttribute(elm, name, cur);
3731
+ }
3732
+ }
3733
+ }
3734
+ }
3735
+
3654
3736
  /*
3655
3737
  * Copyright (c) 2018, salesforce.com, inc.
3656
3738
  * All rights reserved.
@@ -4060,16 +4142,16 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4060
4142
  // the custom element from the registry is expecting an upgrade callback
4061
4143
  vm = createViewModelHook(elm, vnode, renderer);
4062
4144
  };
4063
- const connectedCallback = elm => {
4064
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4145
+ let connectedCallback;
4146
+ let disconnectedCallback;
4147
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4148
+ connectedCallback = elm => {
4065
4149
  connectRootElement(elm);
4066
- }
4067
- };
4068
- const disconnectedCallback = elm => {
4069
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4150
+ };
4151
+ disconnectedCallback = elm => {
4070
4152
  disconnectRootElement(elm);
4071
- }
4072
- };
4153
+ };
4154
+ }
4073
4155
  // Should never get a tag with upper case letter at this point; the compiler
4074
4156
  // should produce only tags with lowercase letters. However, the Java
4075
4157
  // compiler may generate tagnames with uppercase letters so - for backwards
@@ -4247,7 +4329,11 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4247
4329
  // value is set before type=radio.
4248
4330
  patchClassAttribute(oldVnode, vnode, renderer);
4249
4331
  patchStyleAttribute(oldVnode, vnode, renderer);
4250
- patchAttributes(oldVnode, vnode, renderer);
4332
+ if (vnode.data.external) {
4333
+ patchAttrUnlessProp(oldVnode, vnode, renderer);
4334
+ } else {
4335
+ patchAttributes(oldVnode, vnode, renderer);
4336
+ }
4251
4337
  patchProps(oldVnode, vnode, renderer);
4252
4338
  }
4253
4339
  function applyStyleScoping(elm, owner, renderer) {
@@ -4680,8 +4766,11 @@ function s(slotName, data, children, slotset) {
4680
4766
  !isUndefined$1(slotset.slotAssignments) &&
4681
4767
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
4682
4768
  slotset.slotAssignments[slotName].length !== 0) {
4683
- children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4684
- if (vnode) {
4769
+ const newChildren = [];
4770
+ const slotAssignments = slotset.slotAssignments[slotName];
4771
+ for (let i = 0; i < slotAssignments.length; i++) {
4772
+ const vnode = slotAssignments[i];
4773
+ if (!isNull(vnode)) {
4685
4774
  const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4686
4775
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
4687
4776
  const isScopedSlotElement = !isUndefined$1(data.slotData);
@@ -4691,32 +4780,30 @@ function s(slotName, data, children, slotset) {
4691
4780
  logError(`Mismatched slot types for ${slotName === '' ? '(default)' : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
4692
4781
  }
4693
4782
  // Ignore slot content from parent
4694
- return accumulator;
4783
+ continue;
4695
4784
  }
4696
4785
  // If the passed slot content is factory, evaluate it and add the produced vnodes
4697
4786
  if (assignedNodeIsScopedSlot) {
4698
4787
  const vmBeingRenderedInception = getVMBeingRendered();
4699
- let scopedSlotChildren = [];
4700
4788
  // Evaluate in the scope of the slot content's owner
4701
4789
  // if a slotset is provided, there will always be an owner. The only case where owner is
4702
4790
  // undefined is for root components, but root components cannot accept slotted content
4703
4791
  setVMBeingRendered(slotset.owner);
4704
4792
  try {
4705
- scopedSlotChildren = vnode.factory(data.slotData);
4793
+ ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
4706
4794
  }
4707
4795
  finally {
4708
4796
  setVMBeingRendered(vmBeingRenderedInception);
4709
4797
  }
4710
- return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4711
4798
  }
4712
4799
  else {
4713
4800
  // If the slot content is standard type, the content is static, no additional
4714
4801
  // processing needed on the vnode
4715
- return ArrayConcat$1.call(accumulator, vnode);
4802
+ ArrayPush$1.call(newChildren, vnode);
4716
4803
  }
4717
4804
  }
4718
- return accumulator;
4719
- }, []);
4805
+ }
4806
+ children = newChildren;
4720
4807
  }
4721
4808
  const vmBeingRendered = getVMBeingRendered();
4722
4809
  const { renderMode, shadowMode } = vmBeingRendered;
@@ -6937,7 +7024,7 @@ function getComponentConstructor(elm) {
6937
7024
  }
6938
7025
  return ctor;
6939
7026
  }
6940
- /* version: 2.30.1 */
7027
+ /* version: 2.30.3 */
6941
7028
 
6942
7029
  /*
6943
7030
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7220,8 +7307,10 @@ let elementBeingUpgradedByLWC = false;
7220
7307
  // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
7221
7308
  // This class should be created once per tag name.
7222
7309
  const createUpgradableConstructor = (connectedCallback, disconnectedCallback) => {
7310
+ const hasConnectedCallback = !isUndefined$1(connectedCallback);
7311
+ const hasDisconnectedCallback = !isUndefined$1(disconnectedCallback);
7223
7312
  // TODO [#2972]: this class should expose observedAttributes as necessary
7224
- return class UpgradableConstructor extends HTMLElement {
7313
+ class UpgradableConstructor extends HTMLElement {
7225
7314
  constructor(upgradeCallback) {
7226
7315
  super();
7227
7316
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
@@ -7229,25 +7318,33 @@ const createUpgradableConstructor = (connectedCallback, disconnectedCallback) =>
7229
7318
  if (elementBeingUpgradedByLWC) {
7230
7319
  upgradeCallback(this);
7231
7320
  }
7232
- else {
7233
- // keep track of elements that were not created by lwc.createElement,
7234
- // so we can ignore their lifecycle hooks
7321
+ else if (hasConnectedCallback || hasDisconnectedCallback) {
7322
+ // If this element has connected or disconnected callbacks, then we need to keep track of
7323
+ // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
7324
+ // If the element has no connected or disconnected callbacks, then we don't need to track this.
7235
7325
  elementsUpgradedOutsideLWC.add(this);
7236
7326
  // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
7237
7327
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
7238
7328
  }
7239
7329
  }
7240
- connectedCallback() {
7330
+ }
7331
+ // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
7332
+ // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
7333
+ if (hasConnectedCallback) {
7334
+ UpgradableConstructor.prototype.connectedCallback = function () {
7241
7335
  if (!elementsUpgradedOutsideLWC.has(this)) {
7242
7336
  connectedCallback(this);
7243
7337
  }
7244
- }
7245
- disconnectedCallback() {
7338
+ };
7339
+ }
7340
+ if (hasDisconnectedCallback) {
7341
+ UpgradableConstructor.prototype.disconnectedCallback = function () {
7246
7342
  if (!elementsUpgradedOutsideLWC.has(this)) {
7247
7343
  disconnectedCallback(this);
7248
7344
  }
7249
- }
7250
- };
7345
+ };
7346
+ }
7347
+ return UpgradableConstructor;
7251
7348
  };
7252
7349
  const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7253
7350
  // use global custom elements registry
@@ -7300,16 +7397,22 @@ function createScopedRegistry() {
7300
7397
  const EMPTY_SET = new Set();
7301
7398
  function createDefinitionRecord(constructor) {
7302
7399
  var _a;
7303
- const { connectedCallback, disconnectedCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
7400
+ const { connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
7401
+ const formAssociated = Boolean(constructor.formAssociated);
7304
7402
  const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
7305
7403
  return {
7306
7404
  UserCtor: constructor,
7307
7405
  PivotCtor: undefined,
7308
7406
  connectedCallback,
7309
7407
  disconnectedCallback,
7408
+ formAssociatedCallback,
7409
+ formDisabledCallback,
7410
+ formResetCallback,
7411
+ formStateRestoreCallback,
7310
7412
  adoptedCallback,
7311
7413
  attributeChangedCallback,
7312
7414
  observedAttributes,
7415
+ formAssociated,
7313
7416
  };
7314
7417
  }
7315
7418
  // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
@@ -7384,6 +7487,26 @@ function createScopedRegistry() {
7384
7487
  }
7385
7488
  }
7386
7489
  }
7490
+ formAssociatedCallback(form) {
7491
+ var _a;
7492
+ const definition = definitionForElement.get(this);
7493
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
7494
+ }
7495
+ formDisabledCallback(disabled) {
7496
+ var _a;
7497
+ const definition = definitionForElement.get(this);
7498
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
7499
+ }
7500
+ formResetCallback() {
7501
+ var _a;
7502
+ const definition = definitionForElement.get(this);
7503
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
7504
+ }
7505
+ formStateRestoreCallback(state, mode) {
7506
+ var _a;
7507
+ const definition = definitionForElement.get(this);
7508
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
7509
+ }
7387
7510
  adoptedCallback() {
7388
7511
  var _a;
7389
7512
  const definition = definitionForElement.get(this);
@@ -7402,6 +7525,8 @@ function createScopedRegistry() {
7402
7525
  }
7403
7526
  }
7404
7527
  PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
7528
+ // TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
7529
+ PivotCtor.formAssociated = registeredDefinition.formAssociated;
7405
7530
  registeredPivotCtors.add(PivotCtor);
7406
7531
  return PivotCtor;
7407
7532
  }
@@ -7748,27 +7873,34 @@ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
7748
7873
  // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
7749
7874
  // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
7750
7875
  // multiple times per tag name.
7751
- const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
7876
+ const createUserConstructor = (HTMLElementToExtend, upgradeCallback, connectedCallback, disconnectedCallback) => {
7752
7877
  // TODO [#2972]: this class should expose observedAttributes as necessary
7753
- return class UserConstructor extends HTMLElementToExtend {
7878
+ class UserConstructor extends HTMLElementToExtend {
7754
7879
  constructor() {
7755
7880
  super();
7756
7881
  upgradeCallback(this);
7757
7882
  }
7758
- connectedCallback() {
7883
+ }
7884
+ // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
7885
+ // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
7886
+ if (!isUndefined$1(connectedCallback)) {
7887
+ UserConstructor.prototype.connectedCallback = function () {
7759
7888
  connectedCallback(this);
7760
- }
7761
- disconnectedCallback() {
7889
+ };
7890
+ }
7891
+ if (!isUndefined$1(disconnectedCallback)) {
7892
+ UserConstructor.prototype.disconnectedCallback = function () {
7762
7893
  disconnectedCallback(this);
7763
- }
7764
- };
7894
+ };
7895
+ }
7896
+ return UserConstructor;
7765
7897
  };
7766
7898
  function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
7767
7899
  if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
7768
7900
  // This error should be impossible to hit
7769
7901
  throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
7770
7902
  }
7771
- const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
7903
+ const UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
7772
7904
  const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
7773
7905
  return new ScopedConstructor(UserConstructor);
7774
7906
  }
@@ -7865,7 +7997,7 @@ function rendererFactory(baseRenderer) {
7865
7997
  function isNull(obj) {
7866
7998
  return obj === null;
7867
7999
  }
7868
- /** version: 2.30.1 */
8000
+ /** version: 2.30.3 */
7869
8001
 
7870
8002
  /*
7871
8003
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8344,16 +8476,16 @@ function createElement(sel, options) {
8344
8476
  DisconnectingSlot.set(elm, disconnectRootElement);
8345
8477
  }
8346
8478
  };
8347
- const connectedCallback = elm => {
8348
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8479
+ let connectedCallback;
8480
+ let disconnectedCallback;
8481
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8482
+ connectedCallback = elm => {
8349
8483
  connectRootElement(elm);
8350
- }
8351
- };
8352
- const disconnectedCallback = elm => {
8353
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8484
+ };
8485
+ disconnectedCallback = elm => {
8354
8486
  disconnectRootElement(elm);
8355
- }
8356
- };
8487
+ };
8488
+ }
8357
8489
  const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
8358
8490
  return element;
8359
8491
  }
@@ -8426,6 +8558,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8426
8558
  });
8427
8559
  freeze(LightningElement);
8428
8560
  seal(LightningElement.prototype);
8429
- /* version: 2.30.1 */
8561
+ /* version: 2.30.3 */
8430
8562
 
8431
8563
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };