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 @@ var LWC = (function (exports) {
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,7 +316,24 @@ var LWC = (function (exports) {
291
316
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
292
317
  return attributeName;
293
318
  }
294
- /** version: 2.30.1 */
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
+ }
336
+ /** version: 2.30.3 */
295
337
 
296
338
  /**
297
339
  * Copyright (C) 2018 salesforce.com, inc.
@@ -373,7 +415,7 @@ var LWC = (function (exports) {
373
415
  patch$1(propName);
374
416
  }
375
417
  }
376
- /** version: 2.30.1 */
418
+ /** version: 2.30.3 */
377
419
 
378
420
  /**
379
421
  * Copyright (C) 2018 salesforce.com, inc.
@@ -2573,7 +2615,7 @@ var LWC = (function (exports) {
2573
2615
  * SPDX-License-Identifier: MIT
2574
2616
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2575
2617
  */
2576
- const ColonCharCode = 58;
2618
+ const ColonCharCode$1 = 58;
2577
2619
  function patchAttributes(oldVnode, vnode, renderer) {
2578
2620
  const { attrs } = vnode.data;
2579
2621
  if (isUndefined$1(attrs)) {
@@ -2590,11 +2632,11 @@ var LWC = (function (exports) {
2590
2632
  const old = oldAttrs[key];
2591
2633
  if (old !== cur) {
2592
2634
  unlockAttribute(elm, key);
2593
- if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
2635
+ if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
2594
2636
  // Assume xml namespace
2595
2637
  setAttribute(elm, key, cur, XML_NAMESPACE);
2596
2638
  }
2597
- else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
2639
+ else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
2598
2640
  // Assume xlink namespace
2599
2641
  setAttribute(elm, key, cur, XLINK_NAMESPACE);
2600
2642
  }
@@ -2609,6 +2651,46 @@ var LWC = (function (exports) {
2609
2651
  }
2610
2652
  }
2611
2653
 
2654
+ /*
2655
+ * Copyright (c) 2018, salesforce.com, inc.
2656
+ * All rights reserved.
2657
+ * SPDX-License-Identifier: MIT
2658
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2659
+ */
2660
+ const ColonCharCode = 58;
2661
+ function patchAttrUnlessProp(oldVnode, vnode, renderer) {
2662
+ const { data: { attrs }, elm, } = vnode;
2663
+ if (isUndefined$1(attrs)) {
2664
+ return;
2665
+ }
2666
+ const { removeAttribute, setAttribute, setProperty } = renderer;
2667
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
2668
+ for (const name in attrs) {
2669
+ const cur = attrs[name];
2670
+ const old = oldAttrs[name];
2671
+ if (old !== cur) {
2672
+ const propName = htmlAttributeToProperty(name);
2673
+ if (propName in elm) {
2674
+ setProperty(elm, name, cur);
2675
+ }
2676
+ else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
2677
+ // Assume xml namespace
2678
+ setAttribute(elm, name, cur, XML_NAMESPACE);
2679
+ }
2680
+ else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
2681
+ // Assume xlink namespace
2682
+ setAttribute(elm, name, cur, XLINK_NAMESPACE);
2683
+ }
2684
+ else if (isNull(cur) || isUndefined$1(cur)) {
2685
+ removeAttribute(elm, name);
2686
+ }
2687
+ else {
2688
+ setAttribute(elm, name, cur);
2689
+ }
2690
+ }
2691
+ }
2692
+ }
2693
+
2612
2694
  /*
2613
2695
  * Copyright (c) 2018, salesforce.com, inc.
2614
2696
  * All rights reserved.
@@ -2993,16 +3075,16 @@ var LWC = (function (exports) {
2993
3075
  // the custom element from the registry is expecting an upgrade callback
2994
3076
  vm = createViewModelHook(elm, vnode, renderer);
2995
3077
  };
2996
- const connectedCallback = elm => {
2997
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3078
+ let connectedCallback;
3079
+ let disconnectedCallback;
3080
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3081
+ connectedCallback = elm => {
2998
3082
  connectRootElement(elm);
2999
- }
3000
- };
3001
- const disconnectedCallback = elm => {
3002
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3083
+ };
3084
+ disconnectedCallback = elm => {
3003
3085
  disconnectRootElement(elm);
3004
- }
3005
- };
3086
+ };
3087
+ }
3006
3088
  // Should never get a tag with upper case letter at this point; the compiler
3007
3089
  // should produce only tags with lowercase letters. However, the Java
3008
3090
  // compiler may generate tagnames with uppercase letters so - for backwards
@@ -3157,7 +3239,11 @@ var LWC = (function (exports) {
3157
3239
  // value is set before type=radio.
3158
3240
  patchClassAttribute(oldVnode, vnode, renderer);
3159
3241
  patchStyleAttribute(oldVnode, vnode, renderer);
3160
- patchAttributes(oldVnode, vnode, renderer);
3242
+ if (vnode.data.external) {
3243
+ patchAttrUnlessProp(oldVnode, vnode, renderer);
3244
+ } else {
3245
+ patchAttributes(oldVnode, vnode, renderer);
3246
+ }
3161
3247
  patchProps(oldVnode, vnode, renderer);
3162
3248
  }
3163
3249
  function applyStyleScoping(elm, owner, renderer) {
@@ -3537,40 +3623,41 @@ var LWC = (function (exports) {
3537
3623
  !isUndefined$1(slotset.slotAssignments) &&
3538
3624
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
3539
3625
  slotset.slotAssignments[slotName].length !== 0) {
3540
- children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
3541
- if (vnode) {
3626
+ const newChildren = [];
3627
+ const slotAssignments = slotset.slotAssignments[slotName];
3628
+ for (let i = 0; i < slotAssignments.length; i++) {
3629
+ const vnode = slotAssignments[i];
3630
+ if (!isNull(vnode)) {
3542
3631
  const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3543
3632
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
3544
3633
  const isScopedSlotElement = !isUndefined$1(data.slotData);
3545
3634
  // Check if slot types of parent and child are matching
3546
3635
  if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
3547
3636
  // Ignore slot content from parent
3548
- return accumulator;
3637
+ continue;
3549
3638
  }
3550
3639
  // If the passed slot content is factory, evaluate it and add the produced vnodes
3551
3640
  if (assignedNodeIsScopedSlot) {
3552
3641
  const vmBeingRenderedInception = getVMBeingRendered();
3553
- let scopedSlotChildren = [];
3554
3642
  // Evaluate in the scope of the slot content's owner
3555
3643
  // if a slotset is provided, there will always be an owner. The only case where owner is
3556
3644
  // undefined is for root components, but root components cannot accept slotted content
3557
3645
  setVMBeingRendered(slotset.owner);
3558
3646
  try {
3559
- scopedSlotChildren = vnode.factory(data.slotData);
3647
+ ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
3560
3648
  }
3561
3649
  finally {
3562
3650
  setVMBeingRendered(vmBeingRenderedInception);
3563
3651
  }
3564
- return ArrayConcat$1.call(accumulator, scopedSlotChildren);
3565
3652
  }
3566
3653
  else {
3567
3654
  // If the slot content is standard type, the content is static, no additional
3568
3655
  // processing needed on the vnode
3569
- return ArrayConcat$1.call(accumulator, vnode);
3656
+ ArrayPush$1.call(newChildren, vnode);
3570
3657
  }
3571
3658
  }
3572
- return accumulator;
3573
- }, []);
3659
+ }
3660
+ children = newChildren;
3574
3661
  }
3575
3662
  const vmBeingRendered = getVMBeingRendered();
3576
3663
  const { renderMode, shadowMode } = vmBeingRendered;
@@ -5528,8 +5615,10 @@ var LWC = (function (exports) {
5528
5615
  // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
5529
5616
  // This class should be created once per tag name.
5530
5617
  const createUpgradableConstructor = (connectedCallback, disconnectedCallback) => {
5618
+ const hasConnectedCallback = !isUndefined$1(connectedCallback);
5619
+ const hasDisconnectedCallback = !isUndefined$1(disconnectedCallback);
5531
5620
  // TODO [#2972]: this class should expose observedAttributes as necessary
5532
- return class UpgradableConstructor extends HTMLElement {
5621
+ class UpgradableConstructor extends HTMLElement {
5533
5622
  constructor(upgradeCallback) {
5534
5623
  super();
5535
5624
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
@@ -5537,25 +5626,33 @@ var LWC = (function (exports) {
5537
5626
  if (elementBeingUpgradedByLWC) {
5538
5627
  upgradeCallback(this);
5539
5628
  }
5540
- else {
5541
- // keep track of elements that were not created by lwc.createElement,
5542
- // so we can ignore their lifecycle hooks
5629
+ else if (hasConnectedCallback || hasDisconnectedCallback) {
5630
+ // If this element has connected or disconnected callbacks, then we need to keep track of
5631
+ // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
5632
+ // If the element has no connected or disconnected callbacks, then we don't need to track this.
5543
5633
  elementsUpgradedOutsideLWC.add(this);
5544
5634
  // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
5545
5635
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
5546
5636
  }
5547
5637
  }
5548
- connectedCallback() {
5638
+ }
5639
+ // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
5640
+ // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
5641
+ if (hasConnectedCallback) {
5642
+ UpgradableConstructor.prototype.connectedCallback = function () {
5549
5643
  if (!elementsUpgradedOutsideLWC.has(this)) {
5550
5644
  connectedCallback(this);
5551
5645
  }
5552
- }
5553
- disconnectedCallback() {
5646
+ };
5647
+ }
5648
+ if (hasDisconnectedCallback) {
5649
+ UpgradableConstructor.prototype.disconnectedCallback = function () {
5554
5650
  if (!elementsUpgradedOutsideLWC.has(this)) {
5555
5651
  disconnectedCallback(this);
5556
5652
  }
5557
- }
5558
- };
5653
+ };
5654
+ }
5655
+ return UpgradableConstructor;
5559
5656
  };
5560
5657
  const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
5561
5658
  // use global custom elements registry
@@ -5608,16 +5705,22 @@ var LWC = (function (exports) {
5608
5705
  const EMPTY_SET = new Set();
5609
5706
  function createDefinitionRecord(constructor) {
5610
5707
  var _a;
5611
- const { connectedCallback, disconnectedCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
5708
+ const { connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback, adoptedCallback, attributeChangedCallback, } = constructor.prototype;
5709
+ const formAssociated = Boolean(constructor.formAssociated);
5612
5710
  const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
5613
5711
  return {
5614
5712
  UserCtor: constructor,
5615
5713
  PivotCtor: undefined,
5616
5714
  connectedCallback,
5617
5715
  disconnectedCallback,
5716
+ formAssociatedCallback,
5717
+ formDisabledCallback,
5718
+ formResetCallback,
5719
+ formStateRestoreCallback,
5618
5720
  adoptedCallback,
5619
5721
  attributeChangedCallback,
5620
5722
  observedAttributes,
5723
+ formAssociated,
5621
5724
  };
5622
5725
  }
5623
5726
  // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
@@ -5692,6 +5795,26 @@ var LWC = (function (exports) {
5692
5795
  }
5693
5796
  }
5694
5797
  }
5798
+ formAssociatedCallback(form) {
5799
+ var _a;
5800
+ const definition = definitionForElement.get(this);
5801
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
5802
+ }
5803
+ formDisabledCallback(disabled) {
5804
+ var _a;
5805
+ const definition = definitionForElement.get(this);
5806
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
5807
+ }
5808
+ formResetCallback() {
5809
+ var _a;
5810
+ const definition = definitionForElement.get(this);
5811
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
5812
+ }
5813
+ formStateRestoreCallback(state, mode) {
5814
+ var _a;
5815
+ const definition = definitionForElement.get(this);
5816
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
5817
+ }
5695
5818
  adoptedCallback() {
5696
5819
  var _a;
5697
5820
  const definition = definitionForElement.get(this);
@@ -5710,6 +5833,8 @@ var LWC = (function (exports) {
5710
5833
  }
5711
5834
  }
5712
5835
  PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
5836
+ // TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
5837
+ PivotCtor.formAssociated = registeredDefinition.formAssociated;
5713
5838
  registeredPivotCtors.add(PivotCtor);
5714
5839
  return PivotCtor;
5715
5840
  }
@@ -6056,27 +6181,34 @@ var LWC = (function (exports) {
6056
6181
  // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
6057
6182
  // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
6058
6183
  // multiple times per tag name.
6059
- const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
6184
+ const createUserConstructor = (HTMLElementToExtend, upgradeCallback, connectedCallback, disconnectedCallback) => {
6060
6185
  // TODO [#2972]: this class should expose observedAttributes as necessary
6061
- return class UserConstructor extends HTMLElementToExtend {
6186
+ class UserConstructor extends HTMLElementToExtend {
6062
6187
  constructor() {
6063
6188
  super();
6064
6189
  upgradeCallback(this);
6065
6190
  }
6066
- connectedCallback() {
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 () {
6067
6196
  connectedCallback(this);
6068
- }
6069
- disconnectedCallback() {
6197
+ };
6198
+ }
6199
+ if (!isUndefined$1(disconnectedCallback)) {
6200
+ UserConstructor.prototype.disconnectedCallback = function () {
6070
6201
  disconnectedCallback(this);
6071
- }
6072
- };
6202
+ };
6203
+ }
6204
+ return UserConstructor;
6073
6205
  };
6074
6206
  function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
6075
6207
  if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
6076
6208
  // This error should be impossible to hit
6077
6209
  throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
6078
6210
  }
6079
- const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
6211
+ const UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
6080
6212
  const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
6081
6213
  return new ScopedConstructor(UserConstructor);
6082
6214
  }
@@ -6173,7 +6305,7 @@ var LWC = (function (exports) {
6173
6305
  function isNull(obj) {
6174
6306
  return obj === null;
6175
6307
  }
6176
- /** version: 2.30.1 */
6308
+ /** version: 2.30.3 */
6177
6309
 
6178
6310
  /*
6179
6311
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6644,16 +6776,16 @@ var LWC = (function (exports) {
6644
6776
  DisconnectingSlot.set(elm, disconnectRootElement);
6645
6777
  }
6646
6778
  };
6647
- const connectedCallback = elm => {
6648
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6779
+ let connectedCallback;
6780
+ let disconnectedCallback;
6781
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6782
+ connectedCallback = elm => {
6649
6783
  connectRootElement(elm);
6650
- }
6651
- };
6652
- const disconnectedCallback = elm => {
6653
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6784
+ };
6785
+ disconnectedCallback = elm => {
6654
6786
  disconnectRootElement(elm);
6655
- }
6656
- };
6787
+ };
6788
+ }
6657
6789
  const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
6658
6790
  return element;
6659
6791
  }
@@ -6726,7 +6858,7 @@ var LWC = (function (exports) {
6726
6858
  });
6727
6859
  freeze(LightningElement);
6728
6860
  seal(LightningElement.prototype);
6729
- /* version: 2.30.1 */
6861
+ /* version: 2.30.3 */
6730
6862
 
6731
6863
  exports.LightningElement = LightningElement;
6732
6864
  exports.__unstable__ProfilerControl = profilerControl;