lwc 2.25.1 → 2.26.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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +890 -411
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +890 -411
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +736 -205
  5. package/dist/engine-dom/iife/es5/engine-dom.js +959 -311
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +888 -224
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +890 -411
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +736 -205
  11. package/dist/engine-dom/umd/es5/engine-dom.js +959 -311
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +888 -224
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +138 -227
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +138 -227
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +8 -8
@@ -125,6 +125,7 @@
125
125
  var _Array$prototype = Array.prototype,
126
126
  ArrayCopyWithin = _Array$prototype.copyWithin,
127
127
  ArrayFill = _Array$prototype.fill,
128
+ ArrayFilter = _Array$prototype.filter,
128
129
  ArrayIndexOf = _Array$prototype.indexOf,
129
130
  ArrayJoin = _Array$prototype.join,
130
131
  ArrayMap = _Array$prototype.map,
@@ -368,9 +369,9 @@
368
369
  // Increment whenever the LWC template compiler changes
369
370
 
370
371
 
371
- var LWC_VERSION = "2.25.1";
372
+ var LWC_VERSION = "2.26.1";
372
373
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.25.1 */
374
+ /** version: 2.26.1 */
374
375
 
375
376
  /**
376
377
  * Copyright (C) 2018 salesforce.com, inc.
@@ -464,7 +465,7 @@
464
465
  patch$1(propName);
465
466
  }
466
467
  }
467
- /** version: 2.25.1 */
468
+ /** version: 2.26.1 */
468
469
 
469
470
  /**
470
471
  * Copyright (C) 2018 salesforce.com, inc.
@@ -482,7 +483,6 @@
482
483
  DUMMY_TEST_FLAG: null,
483
484
  ENABLE_ELEMENT_PATCH: null,
484
485
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
485
- ENABLE_HMR: null,
486
486
  ENABLE_HTML_COLLECTIONS_PATCH: null,
487
487
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
488
488
  ENABLE_MIXED_SHADOW_MODE: null,
@@ -492,7 +492,8 @@
492
492
  ENABLE_REACTIVE_SETTER: null,
493
493
  ENABLE_WIRE_SYNC_EMIT: null,
494
494
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
495
- DISABLE_LIGHT_DOM_UNSCOPED_CSS: null
495
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
496
+ ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null
496
497
  };
497
498
 
498
499
  if (!_globalThis.lwcRuntimeFlags) {
@@ -558,7 +559,7 @@
558
559
  setFeatureFlag(name, value);
559
560
  }
560
561
  }
561
- /** version: 2.25.1 */
562
+ /** version: 2.26.1 */
562
563
 
563
564
  /*
564
565
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2426,7 +2427,9 @@
2426
2427
  var LightningElement = function LightningElement() {
2427
2428
  // This should be as performant as possible, while any initialization should be done lazily
2428
2429
  if (isNull(vmBeingConstructed)) {
2429
- throw new ReferenceError('Illegal constructor');
2430
+ // Thrown when doing something like `new LightningElement()` or
2431
+ // `class Foo extends LightningElement {}; new Foo()`
2432
+ throw new TypeError('Illegal constructor');
2430
2433
  }
2431
2434
 
2432
2435
  var vm = vmBeingConstructed;
@@ -3790,13 +3793,11 @@
3790
3793
  throw new ReferenceError();
3791
3794
  }
3792
3795
 
3793
- if (lwcRuntimeFlags.ENABLE_HMR) {
3794
- var visited = new Set();
3796
+ var visited = new Set();
3795
3797
 
3796
- while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3797
- visited.add(tpl);
3798
- tpl = swappedTemplateMap.get(tpl);
3799
- }
3798
+ while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3799
+ visited.add(tpl);
3800
+ tpl = swappedTemplateMap.get(tpl);
3800
3801
  }
3801
3802
 
3802
3803
  return tpl;
@@ -3808,13 +3809,11 @@
3808
3809
  throw new ReferenceError();
3809
3810
  }
3810
3811
 
3811
- if (lwcRuntimeFlags.ENABLE_HMR) {
3812
- var visited = new Set();
3812
+ var visited = new Set();
3813
3813
 
3814
- while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3815
- visited.add(Ctor);
3816
- Ctor = swappedComponentMap.get(Ctor);
3817
- }
3814
+ while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3815
+ visited.add(Ctor);
3816
+ Ctor = swappedComponentMap.get(Ctor);
3818
3817
  }
3819
3818
 
3820
3819
  return Ctor;
@@ -3826,13 +3825,11 @@
3826
3825
  throw new ReferenceError();
3827
3826
  }
3828
3827
 
3829
- if (lwcRuntimeFlags.ENABLE_HMR) {
3830
- var visited = new Set();
3828
+ var visited = new Set();
3831
3829
 
3832
- while (swappedStyleMap.has(style) && !visited.has(style)) {
3833
- visited.add(style);
3834
- style = swappedStyleMap.get(style);
3835
- }
3830
+ while (swappedStyleMap.has(style) && !visited.has(style)) {
3831
+ visited.add(style);
3832
+ style = swappedStyleMap.get(style);
3836
3833
  }
3837
3834
 
3838
3835
  return style;
@@ -3842,56 +3839,54 @@
3842
3839
  if (process.env.NODE_ENV === 'production') {
3843
3840
  // this method should never leak to prod
3844
3841
  throw new ReferenceError();
3845
- }
3842
+ } // tracking active component
3846
3843
 
3847
- if (lwcRuntimeFlags.ENABLE_HMR) {
3848
- // tracking active component
3849
- var Ctor = vm.def.ctor;
3850
- var componentVMs = activeComponents.get(Ctor);
3851
3844
 
3852
- if (isUndefined$1(componentVMs)) {
3853
- componentVMs = new Set();
3854
- activeComponents.set(Ctor, componentVMs);
3855
- } // this will allow us to keep track of the hot components
3845
+ var Ctor = vm.def.ctor;
3846
+ var componentVMs = activeComponents.get(Ctor);
3856
3847
 
3848
+ if (isUndefined$1(componentVMs)) {
3849
+ componentVMs = new Set();
3850
+ activeComponents.set(Ctor, componentVMs);
3851
+ } // this will allow us to keep track of the hot components
3857
3852
 
3858
- componentVMs.add(vm); // tracking active template
3859
3853
 
3860
- var tpl = vm.cmpTemplate;
3854
+ componentVMs.add(vm); // tracking active template
3861
3855
 
3862
- if (tpl) {
3863
- var templateVMs = activeTemplates.get(tpl);
3856
+ var tpl = vm.cmpTemplate;
3864
3857
 
3865
- if (isUndefined$1(templateVMs)) {
3866
- templateVMs = new Set();
3867
- activeTemplates.set(tpl, templateVMs);
3868
- } // this will allow us to keep track of the templates that are
3869
- // being used by a hot component
3858
+ if (tpl) {
3859
+ var templateVMs = activeTemplates.get(tpl);
3870
3860
 
3861
+ if (isUndefined$1(templateVMs)) {
3862
+ templateVMs = new Set();
3863
+ activeTemplates.set(tpl, templateVMs);
3864
+ } // this will allow us to keep track of the templates that are
3865
+ // being used by a hot component
3871
3866
 
3872
- templateVMs.add(vm); // tracking active styles associated to template
3873
3867
 
3874
- var stylesheets = tpl.stylesheets;
3868
+ templateVMs.add(vm); // tracking active styles associated to template
3875
3869
 
3876
- if (!isUndefined$1(stylesheets)) {
3877
- flattenStylesheets(stylesheets).forEach(function (stylesheet) {
3878
- // this is necessary because we don't hold the list of styles
3879
- // in the vm, we only hold the selected (already swapped template)
3880
- // but the styles attached to the template might not be the actual
3881
- // active ones, but the swapped versions of those.
3882
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3883
- var stylesheetVMs = activeStyles.get(stylesheet);
3870
+ var stylesheets = tpl.stylesheets;
3884
3871
 
3885
- if (isUndefined$1(stylesheetVMs)) {
3886
- stylesheetVMs = new Set();
3887
- activeStyles.set(stylesheet, stylesheetVMs);
3888
- } // this will allow us to keep track of the stylesheet that are
3889
- // being used by a hot component
3872
+ if (!isUndefined$1(stylesheets)) {
3873
+ flattenStylesheets(stylesheets).forEach(function (stylesheet) {
3874
+ // this is necessary because we don't hold the list of styles
3875
+ // in the vm, we only hold the selected (already swapped template)
3876
+ // but the styles attached to the template might not be the actual
3877
+ // active ones, but the swapped versions of those.
3878
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
3879
+ var stylesheetVMs = activeStyles.get(stylesheet);
3890
3880
 
3881
+ if (isUndefined$1(stylesheetVMs)) {
3882
+ stylesheetVMs = new Set();
3883
+ activeStyles.set(stylesheet, stylesheetVMs);
3884
+ } // this will allow us to keep track of the stylesheet that are
3885
+ // being used by a hot component
3891
3886
 
3892
- stylesheetVMs.add(vm);
3893
- });
3894
- }
3887
+
3888
+ stylesheetVMs.add(vm);
3889
+ });
3895
3890
  }
3896
3891
  }
3897
3892
  }
@@ -3900,42 +3895,40 @@
3900
3895
  if (process.env.NODE_ENV === 'production') {
3901
3896
  // this method should never leak to prod
3902
3897
  throw new ReferenceError();
3903
- }
3898
+ } // tracking inactive component
3904
3899
 
3905
- if (lwcRuntimeFlags.ENABLE_HMR) {
3906
- // tracking inactive component
3907
- var Ctor = vm.def.ctor;
3908
- var list = activeComponents.get(Ctor);
3909
3900
 
3910
- if (!isUndefined$1(list)) {
3911
- // deleting the vm from the set to avoid leaking memory
3912
- list.delete(vm);
3913
- } // removing inactive template
3901
+ var Ctor = vm.def.ctor;
3902
+ var list = activeComponents.get(Ctor);
3914
3903
 
3904
+ if (!isUndefined$1(list)) {
3905
+ // deleting the vm from the set to avoid leaking memory
3906
+ list.delete(vm);
3907
+ } // removing inactive template
3915
3908
 
3916
- var tpl = vm.cmpTemplate;
3917
3909
 
3918
- if (tpl) {
3919
- list = activeTemplates.get(tpl);
3910
+ var tpl = vm.cmpTemplate;
3920
3911
 
3921
- if (!isUndefined$1(list)) {
3922
- // deleting the vm from the set to avoid leaking memory
3923
- list.delete(vm);
3924
- } // removing active styles associated to template
3912
+ if (tpl) {
3913
+ list = activeTemplates.get(tpl);
3925
3914
 
3915
+ if (!isUndefined$1(list)) {
3916
+ // deleting the vm from the set to avoid leaking memory
3917
+ list.delete(vm);
3918
+ } // removing active styles associated to template
3926
3919
 
3927
- var styles = tpl.stylesheets;
3928
3920
 
3929
- if (!isUndefined$1(styles)) {
3930
- flattenStylesheets(styles).forEach(function (style) {
3931
- list = activeStyles.get(style);
3921
+ var styles = tpl.stylesheets;
3932
3922
 
3933
- if (!isUndefined$1(list)) {
3934
- // deleting the vm from the set to avoid leaking memory
3935
- list.delete(vm);
3936
- }
3937
- });
3938
- }
3923
+ if (!isUndefined$1(styles)) {
3924
+ flattenStylesheets(styles).forEach(function (style) {
3925
+ list = activeStyles.get(style);
3926
+
3927
+ if (!isUndefined$1(list)) {
3928
+ // deleting the vm from the set to avoid leaking memory
3929
+ list.delete(vm);
3930
+ }
3931
+ });
3939
3932
  }
3940
3933
  }
3941
3934
  }
@@ -3950,10 +3943,6 @@
3950
3943
  }
3951
3944
  }
3952
3945
 
3953
- if (!lwcRuntimeFlags.ENABLE_HMR) {
3954
- throw new Error('HMR is not enabled');
3955
- }
3956
-
3957
3946
  return false;
3958
3947
  }
3959
3948
 
@@ -3967,10 +3956,6 @@
3967
3956
  }
3968
3957
  }
3969
3958
 
3970
- if (!lwcRuntimeFlags.ENABLE_HMR) {
3971
- throw new Error('HMR is not enabled');
3972
- }
3973
-
3974
3959
  return false;
3975
3960
  }
3976
3961
 
@@ -3982,10 +3967,6 @@
3982
3967
  return rehydrateHotStyle(oldStyle);
3983
3968
  }
3984
3969
 
3985
- if (!lwcRuntimeFlags.ENABLE_HMR) {
3986
- throw new Error('HMR is not enabled');
3987
- }
3988
-
3989
3970
  return false;
3990
3971
  }
3991
3972
  /*
@@ -4451,14 +4432,17 @@
4451
4432
  /**
4452
4433
  * This function returns the host style token for a custom element if it
4453
4434
  * exists. Otherwise it returns null.
4435
+ *
4436
+ * A host style token is applied to the component if scoped styles are used.
4454
4437
  */
4455
4438
 
4456
4439
 
4457
4440
  function getStylesheetTokenHost(vnode) {
4458
4441
  var _getComponentInternal = getComponentInternalDef(vnode.ctor),
4459
- stylesheetToken = _getComponentInternal.template.stylesheetToken;
4442
+ template = _getComponentInternal.template;
4460
4443
 
4461
- return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
4444
+ var stylesheetToken = template.stylesheetToken;
4445
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
4462
4446
  }
4463
4447
 
4464
4448
  function getNearestNativeShadowComponent(vm) {
@@ -4507,84 +4491,6 @@
4507
4491
 
4508
4492
  return null;
4509
4493
  }
4510
- /*
4511
- * Copyright (c) 2020, salesforce.com, inc.
4512
- * All rights reserved.
4513
- * SPDX-License-Identifier: MIT
4514
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4515
- */
4516
-
4517
-
4518
- function checkHasVM(elm) {
4519
- var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
4520
-
4521
- if (process.env.NODE_ENV !== 'production' && !hasVM) {
4522
- // Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
4523
- // we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
4524
- logError("VM for tag name \"".concat(elm.tagName.toLowerCase(), "\" is undefined. ") + "This indicates that an element was created with this tag name, " + "which is already reserved by an LWC component. Use lwc.createElement " + "instead to create elements.");
4525
- }
4526
-
4527
- return hasVM;
4528
- }
4529
-
4530
- function getUpgradableConstructor(tagName, renderer) {
4531
- var getCustomElement = renderer.getCustomElement,
4532
- RendererHTMLElement = renderer.HTMLElementExported,
4533
- defineCustomElement = renderer.defineCustomElement; // Should never get a tag with upper case letter at this point, the compiler should
4534
- // produce only tags with lowercase letters
4535
- // But, for backwards compatibility, we will lower case the tagName
4536
-
4537
- tagName = tagName.toLowerCase();
4538
- var CE = getCustomElement(tagName);
4539
-
4540
- if (!isUndefined$1(CE)) {
4541
- return CE;
4542
- }
4543
- /**
4544
- * LWC Upgradable Element reference to an element that was created
4545
- * via the scoped registry mechanism, and that is ready to be upgraded.
4546
- */
4547
-
4548
-
4549
- CE = /*#__PURE__*/function (_RendererHTMLElement) {
4550
- _inherits(LWCUpgradableElement, _RendererHTMLElement);
4551
-
4552
- var _super5 = _createSuper(LWCUpgradableElement);
4553
-
4554
- function LWCUpgradableElement(upgradeCallback) {
4555
- var _this4;
4556
-
4557
- _classCallCheck(this, LWCUpgradableElement);
4558
-
4559
- _this4 = _super5.call(this);
4560
-
4561
- if (isFunction$1(upgradeCallback)) {
4562
- upgradeCallback(_assertThisInitialized(_this4)); // nothing to do with the result for now
4563
- }
4564
-
4565
- return _this4;
4566
- }
4567
-
4568
- return _createClass(LWCUpgradableElement);
4569
- }(RendererHTMLElement);
4570
-
4571
- if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4572
- CE.prototype.connectedCallback = function () {
4573
- if (checkHasVM(this)) {
4574
- connectRootElement(this);
4575
- }
4576
- };
4577
-
4578
- CE.prototype.disconnectedCallback = function () {
4579
- if (checkHasVM(this)) {
4580
- disconnectRootElement(this);
4581
- }
4582
- };
4583
- }
4584
-
4585
- defineCustomElement(tagName, CE);
4586
- return CE;
4587
- }
4588
4494
  /*
4589
4495
  * Copyright (c) 2018, salesforce.com, inc.
4590
4496
  * All rights reserved.
@@ -5144,7 +5050,7 @@
5144
5050
  function mountCustomElement(vnode, parent, anchor, renderer) {
5145
5051
  var sel = vnode.sel,
5146
5052
  owner = vnode.owner;
5147
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
5053
+ var createCustomElement = renderer.createCustomElement;
5148
5054
  /**
5149
5055
  * Note: if the upgradable constructor does not expect, or throw when we new it
5150
5056
  * with a callback as the first argument, we could implement a more advanced
@@ -5153,10 +5059,30 @@
5153
5059
  */
5154
5060
 
5155
5061
  var vm;
5156
- var elm = new UpgradableConstructor(function (elm) {
5062
+
5063
+ var upgradeCallback = function upgradeCallback(elm) {
5157
5064
  // the custom element from the registry is expecting an upgrade callback
5158
5065
  vm = createViewModelHook(elm, vnode, renderer);
5159
- });
5066
+ };
5067
+
5068
+ var connectedCallback = function connectedCallback(elm) {
5069
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
5070
+ connectRootElement(elm);
5071
+ }
5072
+ };
5073
+
5074
+ var disconnectedCallback = function disconnectedCallback(elm) {
5075
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
5076
+ disconnectRootElement(elm);
5077
+ }
5078
+ }; // Should never get a tag with upper case letter at this point; the compiler
5079
+ // should produce only tags with lowercase letters. However, the Java
5080
+ // compiler may generate tagnames with uppercase letters so - for backwards
5081
+ // compatibility, we lower case the tagname here.
5082
+
5083
+
5084
+ var normalizedTagname = sel.toLowerCase();
5085
+ var elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
5160
5086
  vnode.elm = elm;
5161
5087
  vnode.vm = vm;
5162
5088
  linkNodeToShadow(elm, owner, renderer);
@@ -5164,8 +5090,6 @@
5164
5090
 
5165
5091
  if (vm) {
5166
5092
  allocateChildren(vnode, vm);
5167
- } else if (vnode.ctor !== UpgradableConstructor) {
5168
- throw new TypeError("Incorrect Component Constructor");
5169
5093
  }
5170
5094
 
5171
5095
  patchElementPropsAndAttrs$1(null, vnode, renderer);
@@ -7509,21 +7433,21 @@
7509
7433
  var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
7510
7434
  _inherits(WireContextRegistrationEvent, _CustomEvent);
7511
7435
 
7512
- var _super6 = _createSuper(WireContextRegistrationEvent);
7436
+ var _super5 = _createSuper(WireContextRegistrationEvent);
7513
7437
 
7514
7438
  function WireContextRegistrationEvent(adapterToken, _ref3) {
7515
- var _this5;
7439
+ var _this4;
7516
7440
 
7517
7441
  var setNewContext = _ref3.setNewContext,
7518
7442
  setDisconnectedCallback = _ref3.setDisconnectedCallback;
7519
7443
 
7520
7444
  _classCallCheck(this, WireContextRegistrationEvent);
7521
7445
 
7522
- _this5 = _super6.call(this, adapterToken, {
7446
+ _this4 = _super5.call(this, adapterToken, {
7523
7447
  bubbles: true,
7524
7448
  composed: true
7525
7449
  });
7526
- defineProperties(_assertThisInitialized(_this5), {
7450
+ defineProperties(_assertThisInitialized(_this4), {
7527
7451
  setNewContext: {
7528
7452
  value: setNewContext
7529
7453
  },
@@ -7531,7 +7455,7 @@
7531
7455
  value: setDisconnectedCallback
7532
7456
  }
7533
7457
  });
7534
- return _this5;
7458
+ return _this4;
7535
7459
  }
7536
7460
 
7537
7461
  return _createClass(WireContextRegistrationEvent);
@@ -8232,13 +8156,27 @@
8232
8156
  // Consequently, hydration mismatches will occur if scoped CSS token classnames
8233
8157
  // are rendered during SSR. This needs to be accounted for when validating.
8234
8158
 
8235
- if (scopedToken) {
8159
+ if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
8236
8160
  if (!isUndefined$1(className)) {
8237
- className = isNull(stylesheetTokenHost) ? "".concat(scopedToken, " ").concat(className) : "".concat(scopedToken, " ").concat(className, " ").concat(stylesheetTokenHost);
8161
+ // The order of the className should be scopedToken className stylesheetTokenHost
8162
+ var classTokens = [scopedToken, className, stylesheetTokenHost];
8163
+ var classNames = ArrayFilter.call(classTokens, function (token) {
8164
+ return !isNull(token);
8165
+ });
8166
+ className = ArrayJoin.call(classNames, ' ');
8238
8167
  } else if (!isUndefined$1(classMap)) {
8239
- classMap = Object.assign(Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true)), isNull(stylesheetTokenHost) ? {} : _defineProperty({}, stylesheetTokenHost, true));
8168
+ classMap = Object.assign(Object.assign(Object.assign({}, classMap), !isNull(scopedToken) ? _defineProperty({}, scopedToken, true) : {}), !isNull(stylesheetTokenHost) ? _defineProperty({}, stylesheetTokenHost, true) : {});
8240
8169
  } else {
8241
- className = isNull(stylesheetTokenHost) ? "".concat(scopedToken) : "".concat(scopedToken, " ").concat(stylesheetTokenHost);
8170
+ // The order of the className should be scopedToken stylesheetTokenHost
8171
+ var _classTokens = [scopedToken, stylesheetTokenHost];
8172
+
8173
+ var _classNames = ArrayFilter.call(_classTokens, function (token) {
8174
+ return !isNull(token);
8175
+ });
8176
+
8177
+ if (_classNames.length) {
8178
+ className = ArrayJoin.call(_classNames, ' ');
8179
+ }
8242
8180
  }
8243
8181
  }
8244
8182
 
@@ -8554,7 +8492,7 @@
8554
8492
 
8555
8493
  return ctor;
8556
8494
  }
8557
- /* version: 2.25.1 */
8495
+ /* version: 2.26.1 */
8558
8496
 
8559
8497
  /*
8560
8498
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8714,6 +8652,779 @@
8714
8652
  insertLocalStylesheet(content, target);
8715
8653
  }
8716
8654
  }
8655
+ /*
8656
+ * Copyright (c) 2020, salesforce.com, inc.
8657
+ * All rights reserved.
8658
+ * SPDX-License-Identifier: MIT
8659
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8660
+ */
8661
+
8662
+
8663
+ function isCustomElementRegistryAvailable() {
8664
+ if (typeof customElements === 'undefined') {
8665
+ return false;
8666
+ }
8667
+
8668
+ try {
8669
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
8670
+ // _wrapNativeSuper()
8671
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
8672
+ // get wrapped by babel.
8673
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8674
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8675
+ // which are not equipped to be initialized that way.
8676
+
8677
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8678
+ _inherits(clazz, _HTMLElementAlias);
8679
+
8680
+ var _super6 = _createSuper(clazz);
8681
+
8682
+ function clazz() {
8683
+ _classCallCheck(this, clazz);
8684
+
8685
+ return _super6.apply(this, arguments);
8686
+ }
8687
+
8688
+ return _createClass(clazz);
8689
+ }(HTMLElementAlias);
8690
+
8691
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8692
+ new clazz();
8693
+ return true;
8694
+ } catch (_a) {
8695
+ return false;
8696
+ }
8697
+ }
8698
+
8699
+ var hasCustomElements = isCustomElementRegistryAvailable();
8700
+ /*
8701
+ * Copyright (c) 2018, salesforce.com, inc.
8702
+ * All rights reserved.
8703
+ * SPDX-License-Identifier: MIT
8704
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8705
+ */
8706
+ // Creates a custom element for compat (legacy) browser environments
8707
+
8708
+ var createCustomElementCompat = function createCustomElementCompat(tagName, upgradeCallback) {
8709
+ var elm = document.createElement(tagName);
8710
+ upgradeCallback(elm); // nothing to do with the result for now
8711
+
8712
+ return elm;
8713
+ };
8714
+ /*
8715
+ * Copyright (c) 2018, salesforce.com, inc.
8716
+ * All rights reserved.
8717
+ * SPDX-License-Identifier: MIT
8718
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8719
+ */
8720
+
8721
+
8722
+ var cachedConstructors = new Map();
8723
+ var elementsUpgradedOutsideLWC = new WeakSet();
8724
+ var elementBeingUpgradedByLWC = false; // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
8725
+ // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
8726
+ // Another benefit is that only LWC can create components that actually do anything – if you do
8727
+ // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
8728
+ // This class should be created once per tag name.
8729
+
8730
+ var createUpgradableConstructor = function createUpgradableConstructor(_connectedCallback, _disconnectedCallback) {
8731
+ // TODO [#2972]: this class should expose observedAttributes as necessary
8732
+ return /*#__PURE__*/function (_HTMLElement) {
8733
+ _inherits(UpgradableConstructor, _HTMLElement);
8734
+
8735
+ var _super7 = _createSuper(UpgradableConstructor);
8736
+
8737
+ function UpgradableConstructor(upgradeCallback) {
8738
+ var _this5;
8739
+
8740
+ _classCallCheck(this, UpgradableConstructor);
8741
+
8742
+ _this5 = _super7.call(this); // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
8743
+ // then elementBeingUpgraded will be false
8744
+
8745
+ if (elementBeingUpgradedByLWC) {
8746
+ upgradeCallback(_assertThisInitialized(_this5));
8747
+ } else {
8748
+ // keep track of elements that were not created by lwc.createElement,
8749
+ // so we can ignore their lifecycle hooks
8750
+ elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this5)); // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
8751
+ // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8752
+ }
8753
+
8754
+ return _this5;
8755
+ }
8756
+
8757
+ _createClass(UpgradableConstructor, [{
8758
+ key: "connectedCallback",
8759
+ value: function connectedCallback() {
8760
+ if (!elementsUpgradedOutsideLWC.has(this)) {
8761
+ _connectedCallback(this);
8762
+ }
8763
+ }
8764
+ }, {
8765
+ key: "disconnectedCallback",
8766
+ value: function disconnectedCallback() {
8767
+ if (!elementsUpgradedOutsideLWC.has(this)) {
8768
+ _disconnectedCallback(this);
8769
+ }
8770
+ }
8771
+ }]);
8772
+
8773
+ return UpgradableConstructor;
8774
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
8775
+ };
8776
+
8777
+ var createCustomElementVanilla = function createCustomElementVanilla(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
8778
+ // use global custom elements registry
8779
+ var UpgradableConstructor = cachedConstructors.get(tagName);
8780
+
8781
+ if (isUndefined$1(UpgradableConstructor)) {
8782
+ if (!isUndefined$1(customElements.get(tagName))) {
8783
+ throw new Error("Unexpected tag name \"".concat(tagName, "\". This name is a registered custom element, preventing LWC to upgrade the element."));
8784
+ }
8785
+
8786
+ UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
8787
+ customElements.define(tagName, UpgradableConstructor);
8788
+ cachedConstructors.set(tagName, UpgradableConstructor);
8789
+ }
8790
+
8791
+ elementBeingUpgradedByLWC = true;
8792
+
8793
+ try {
8794
+ return new UpgradableConstructor(upgradeCallback);
8795
+ } finally {
8796
+ elementBeingUpgradedByLWC = false;
8797
+ }
8798
+ };
8799
+ /*
8800
+ * Copyright (c) 2020, salesforce.com, inc.
8801
+ * All rights reserved.
8802
+ * SPDX-License-Identifier: MIT
8803
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8804
+ */
8805
+
8806
+ /**
8807
+ * Create a scoped registry, i.e. a function that can create custom elements whose tag names
8808
+ * do not conflict with vanilla custom elements having the same tag name.
8809
+ */
8810
+
8811
+
8812
+ function createScopedRegistry() {
8813
+ if (!hasCustomElements) {
8814
+ // This code should never be reached, because we don't use the pivot registry if
8815
+ // custom elements are unavailable.
8816
+ throw new Error('Custom elements are not supported in this environment.');
8817
+ }
8818
+
8819
+ var _window = window,
8820
+ NativeHTMLElement = _window.HTMLElement;
8821
+ var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
8822
+ nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
8823
+ nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
8824
+ nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
8825
+ nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
8826
+ var definitionForElement = new WeakMap();
8827
+ var pendingRegistryForElement = new WeakMap();
8828
+ var definitionForConstructor = new WeakMap();
8829
+ var registeredUserCtors = new WeakSet();
8830
+ var pivotCtorByTag = new Map();
8831
+ var globalDefinitionsByTag = new Map();
8832
+ var globalDefinitionsByClass = new Map();
8833
+ var awaitingUpgrade = new Map();
8834
+ var EMPTY_SET = new Set();
8835
+
8836
+ function createDefinitionRecord(constructor) {
8837
+ var _a;
8838
+
8839
+ var _constructor$prototyp = constructor.prototype,
8840
+ connectedCallback = _constructor$prototyp.connectedCallback,
8841
+ disconnectedCallback = _constructor$prototyp.disconnectedCallback,
8842
+ adoptedCallback = _constructor$prototyp.adoptedCallback,
8843
+ attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
8844
+ var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
8845
+ return {
8846
+ UserCtor: constructor,
8847
+ PivotCtor: undefined,
8848
+ connectedCallback: connectedCallback,
8849
+ disconnectedCallback: disconnectedCallback,
8850
+ adoptedCallback: adoptedCallback,
8851
+ attributeChangedCallback: attributeChangedCallback,
8852
+ observedAttributes: observedAttributes
8853
+ };
8854
+ } // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
8855
+ // element. Note that the `registeredDefinition` represents the constructor that was used to register during
8856
+ // `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
8857
+ // constructor is invoked with another constructor.
8858
+
8859
+
8860
+ function createPivotingClass(tagName, registeredDefinition) {
8861
+ var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
8862
+ _inherits(PivotCtor, _NativeHTMLElement);
8863
+
8864
+ var _super8 = _createSuper(PivotCtor);
8865
+
8866
+ function PivotCtor(UserCtor) {
8867
+ var _this6;
8868
+
8869
+ _classCallCheck(this, PivotCtor);
8870
+
8871
+ // This constructor can only be invoked by:
8872
+ // a) the browser instantiating an element from parsing or via document.createElement.
8873
+ // b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
8874
+ // b) new UserClass.
8875
+ // When LWC instantiates it, it will pass the upgrading definition as an argument
8876
+ // If the caller signals via UserCtor that this is in fact a controlled
8877
+ // definition, we use that one, otherwise fallback to the global
8878
+ // internal registry.
8879
+ _this6 = _super8.call(this);
8880
+ var userCtorIsDefined = !isUndefined$1(UserCtor);
8881
+
8882
+ if (userCtorIsDefined) {
8883
+ if (!isConstructor(UserCtor)) {
8884
+ throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
8885
+ }
8886
+
8887
+ if (!registeredUserCtors.has(UserCtor)) {
8888
+ throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
8889
+ }
8890
+ }
8891
+
8892
+ var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
8893
+
8894
+ if (!isUndefined$1(definition)) {
8895
+ internalUpgrade(_assertThisInitialized(_this6), registeredDefinition, definition);
8896
+ } else {
8897
+ // This is the case in which there is no global definition, and
8898
+ // it is not handled by LWC (otherwise it will have a valid UserCtor)
8899
+ // so we need to add it to the pending queue just in case it eventually
8900
+ // gets defined in the global registry.
8901
+ pendingRegistryForElement.set(_assertThisInitialized(_this6), registeredDefinition);
8902
+ }
8903
+
8904
+ return _this6;
8905
+ }
8906
+
8907
+ _createClass(PivotCtor, [{
8908
+ key: "connectedCallback",
8909
+ value: function connectedCallback() {
8910
+ var _a;
8911
+
8912
+ var definition = definitionForElement.get(this);
8913
+
8914
+ if (!isUndefined$1(definition)) {
8915
+ // Delegate out to user callback
8916
+ (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8917
+ } else {
8918
+ // Register for upgrade when defined (only when connected, so we don't leak)
8919
+ var awaiting = awaitingUpgrade.get(tagName);
8920
+
8921
+ if (isUndefined$1(awaiting)) {
8922
+ awaitingUpgrade.set(tagName, awaiting = new Set());
8923
+ }
8924
+
8925
+ awaiting.add(this);
8926
+ }
8927
+ }
8928
+ }, {
8929
+ key: "disconnectedCallback",
8930
+ value: function disconnectedCallback() {
8931
+ var _a;
8932
+
8933
+ var definition = definitionForElement.get(this);
8934
+
8935
+ if (!isUndefined$1(definition)) {
8936
+ // Delegate out to user callback
8937
+ (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8938
+ } else {
8939
+ // Un-register for upgrade when defined (so we don't leak)
8940
+ var awaiting = awaitingUpgrade.get(tagName); // At this point, awaiting should never be undefined, because connectedCallback
8941
+ // must have been called before disconnectedCallback. But just to be safe, we check
8942
+
8943
+ if (!isUndefined$1(awaiting)) {
8944
+ awaiting.delete(this);
8945
+ }
8946
+ }
8947
+ }
8948
+ }, {
8949
+ key: "adoptedCallback",
8950
+ value: function adoptedCallback() {
8951
+ var _a;
8952
+
8953
+ var definition = definitionForElement.get(this);
8954
+ (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8955
+ }
8956
+ }, {
8957
+ key: "attributeChangedCallback",
8958
+ value: function attributeChangedCallback(name, oldValue, newValue) {
8959
+ var _a;
8960
+
8961
+ var definition = definitionForElement.get(this); // if both definitions are the same, then the observedAttributes is the same,
8962
+ // but if they are different, only if the runtime definition has the attribute
8963
+ // marked as observed, then it should invoke attributeChangedCallback.
8964
+
8965
+ if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
8966
+ (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
8967
+ }
8968
+ }
8969
+ }]);
8970
+
8971
+ return PivotCtor;
8972
+ }(NativeHTMLElement);
8973
+
8974
+ PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
8975
+ return PivotCtor;
8976
+ }
8977
+
8978
+ function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
8979
+ var observedAttributes = pivotDefinition.observedAttributes,
8980
+ attributeChangedCallback = pivotDefinition.attributeChangedCallback;
8981
+
8982
+ if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
8983
+ // This instance does not need to observe any attributes, no need to patch
8984
+ return EMPTY_SET;
8985
+ } // Natively, the attributes observed by the registered definition are going to be taken
8986
+ // care of by the browser, only the difference between the two sets has to be taken
8987
+ // care by the patched version.
8988
+
8989
+
8990
+ return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
8991
+ return !registeredDefinition.observedAttributes.has(x);
8992
+ }));
8993
+ }
8994
+
8995
+ function throwAsyncError(error) {
8996
+ // Per native custom element behavior, errors thrown in attributeChangedCallback
8997
+ // become unhandled async errors. We use setTimeout() instead of Promise.resolve()
8998
+ // to make it an unhandled error rather than an unhandled rejection.
8999
+ setTimeout(function () {
9000
+ throw error;
9001
+ });
9002
+ } // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
9003
+ // Why is this necessary? Well basically, you can't change the `observedAttributes` after
9004
+ // a custom element is defined. So with pivots, if two classes share the same tag name,
9005
+ // and the second class observes attributes that aren't observed by the first one,
9006
+ // then those attributes can never be observed by the native `observedAttributes` system.
9007
+ // So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
9008
+ // we only do this when absolutely necessary, though; i.e. because we've determined
9009
+ // that we aren't observing the attributes we need to.
9010
+
9011
+
9012
+ function patchAttributes(instance, registeredDefinition, pivotDefinition) {
9013
+ var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
9014
+
9015
+ if (newObservedAttributes.size === 0) {
9016
+ return;
9017
+ }
9018
+
9019
+ var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Patch the instance.
9020
+ // Note we use the native `getAttribute` rather than the super's `getAttribute` because
9021
+ // we don't actually want it to be observable that we're calling `getAttribute` from
9022
+ // `setAttribute` and `removeAttribute`.
9023
+ // TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
9024
+
9025
+ defineProperties(instance, {
9026
+ setAttribute: {
9027
+ value: function setAttribute(name, value) {
9028
+ if (newObservedAttributes.has(name)) {
9029
+ var old = nativeGetAttribute.call(this, name);
9030
+ nativeSetAttribute.call(this, name, value);
9031
+
9032
+ try {
9033
+ attributeChangedCallback.call(this, name, old, value + '');
9034
+ } catch (error) {
9035
+ throwAsyncError(error);
9036
+ }
9037
+ } else {
9038
+ nativeSetAttribute.call(this, name, value);
9039
+ }
9040
+ },
9041
+ writable: true,
9042
+ enumerable: true,
9043
+ configurable: true
9044
+ },
9045
+ removeAttribute: {
9046
+ value: function removeAttribute(name) {
9047
+ if (newObservedAttributes.has(name)) {
9048
+ var old = nativeGetAttribute.call(this, name);
9049
+ nativeRemoveAttribute.call(this, name);
9050
+
9051
+ try {
9052
+ attributeChangedCallback.call(this, name, old, null);
9053
+ } catch (error) {
9054
+ throwAsyncError(error);
9055
+ }
9056
+ } else {
9057
+ nativeRemoveAttribute.call(this, name);
9058
+ }
9059
+ },
9060
+ writable: true,
9061
+ enumerable: true,
9062
+ configurable: true
9063
+ }
9064
+ });
9065
+ }
9066
+
9067
+ function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
9068
+ // The below case patches observed attributes for the case where the HTML element is upgraded
9069
+ // from a pre-existing one in the DOM.
9070
+ var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
9071
+
9072
+ if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
9073
+ return;
9074
+ }
9075
+
9076
+ var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Approximate observedAttributes from the user class, but only for the new observed attributes
9077
+
9078
+ newObservedAttributes.forEach(function (name) {
9079
+ if (nativeHasAttribute.call(instance, name)) {
9080
+ var newValue = nativeGetAttribute.call(instance, name);
9081
+ attributeChangedCallback.call(instance, name, null, newValue);
9082
+ }
9083
+ });
9084
+ } // User extends this HTMLElement, which returns the CE being upgraded
9085
+
9086
+
9087
+ var upgradingInstance; // Helper to upgrade an instance with a CE definition using "constructor call trick"
9088
+
9089
+ function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
9090
+ setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
9091
+ definitionForElement.set(instance, pivotDefinition); // attributes patches when needed
9092
+
9093
+ if (pivotDefinition !== registeredDefinition) {
9094
+ patchAttributes(instance, registeredDefinition, pivotDefinition);
9095
+ } // Tricking the construction path to believe that a new instance is being created,
9096
+ // that way it will execute the super initialization mechanism but the HTMLElement
9097
+ // constructor will reuse the instance by returning the upgradingInstance.
9098
+ // This is by far the most important piece of the puzzle
9099
+
9100
+
9101
+ upgradingInstance = instance; // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
9102
+ // The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
9103
+ // Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
9104
+
9105
+ new pivotDefinition.UserCtor();
9106
+ patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
9107
+ }
9108
+
9109
+ function isConstructor(constructor) {
9110
+ return isFunction$1(constructor) && isObject(constructor.prototype);
9111
+ }
9112
+
9113
+ function getOrCreateDefinitionForConstructor(constructor) {
9114
+ if (!isConstructor(constructor)) {
9115
+ throw new TypeError('The referenced constructor is not a constructor.');
9116
+ }
9117
+
9118
+ var definition = definitionForConstructor.get(constructor);
9119
+
9120
+ if (!isUndefined$1(definition)) {
9121
+ return definition;
9122
+ }
9123
+
9124
+ return createDefinitionRecord(constructor);
9125
+ }
9126
+
9127
+ var _window2 = window,
9128
+ nativeRegistry = _window2.customElements;
9129
+ var nativeDefine = nativeRegistry.define,
9130
+ nativeWhenDefined = nativeRegistry.whenDefined,
9131
+ nativeGet = nativeRegistry.get; // patch for the global registry define mechanism
9132
+
9133
+ CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
9134
+ if (options && options.extends) {
9135
+ // TODO [#2983]: should we support `extends`?
9136
+ throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
9137
+ }
9138
+
9139
+ if (globalDefinitionsByTag.has(tagName)) {
9140
+ throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
9141
+ }
9142
+
9143
+ if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
9144
+ throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
9145
+ }
9146
+
9147
+ var definition = getOrCreateDefinitionForConstructor(constructor);
9148
+ registeredUserCtors.add(constructor);
9149
+ var PivotCtor = pivotCtorByTag.get(tagName);
9150
+
9151
+ if (isUndefined$1(PivotCtor)) {
9152
+ PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class which will handle global registry initializations
9153
+
9154
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
9155
+ } // Only cache after nativeDefine has been called, because if it throws an error
9156
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
9157
+
9158
+
9159
+ definitionForConstructor.set(constructor, definition);
9160
+ pivotCtorByTag.set(tagName, PivotCtor);
9161
+ globalDefinitionsByTag.set(tagName, definition);
9162
+ globalDefinitionsByClass.set(constructor, definition); // For globally defined custom elements, the definition associated
9163
+ // to the UserCtor has a back-pointer to PivotCtor in case the user
9164
+ // new the UserCtor, so we know how to create the underlying element.
9165
+
9166
+ definition.PivotCtor = PivotCtor; // Upgrade any elements created in this scope before customElements.define
9167
+ // was called, which should be exhibited by the following steps:
9168
+ // 1) LWC registers a tagName for an LWC component.
9169
+ // 2) Element with same tagName is created with document.createElement()
9170
+ // and inserted into DOM.
9171
+ // 3) customElements.define() is called with tagName and non-LWC constructor.
9172
+ // This requires immediate upgrade when the new global tagName is defined.
9173
+
9174
+ var awaiting = awaitingUpgrade.get(tagName);
9175
+
9176
+ if (!isUndefined$1(awaiting)) {
9177
+ awaitingUpgrade.delete(tagName);
9178
+
9179
+ var _iterator6 = _createForOfIteratorHelper(awaiting),
9180
+ _step6;
9181
+
9182
+ try {
9183
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
9184
+ var element = _step6.value;
9185
+ var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
9186
+ // is only populated when we haven't run internalUpgrade yet, and we only populate
9187
+ // pendingRegistryForElement when internalUpgrade hasn't run yet.
9188
+ // But just to be safe, we check.
9189
+
9190
+ if (!isUndefined$1(registeredDefinition)) {
9191
+ pendingRegistryForElement.delete(element);
9192
+ internalUpgrade(element, registeredDefinition, definition);
9193
+ }
9194
+ }
9195
+ } catch (err) {
9196
+ _iterator6.e(err);
9197
+ } finally {
9198
+ _iterator6.f();
9199
+ }
9200
+ }
9201
+ };
9202
+
9203
+ CustomElementRegistry.prototype.get = function get(tagName) {
9204
+ var NativeCtor = nativeGet.call(nativeRegistry, tagName);
9205
+
9206
+ if (!isUndefined$1(NativeCtor)) {
9207
+ var definition = globalDefinitionsByTag.get(tagName);
9208
+
9209
+ if (!isUndefined$1(definition)) {
9210
+ return definition.UserCtor; // defined by the patched custom elements registry
9211
+ } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9212
+
9213
+
9214
+ return NativeCtor; // return the pivot constructor or constructor that existed before patching
9215
+ }
9216
+ };
9217
+
9218
+ CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
9219
+ return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
9220
+ var definition = globalDefinitionsByTag.get(tagName);
9221
+
9222
+ if (!isUndefined$1(definition)) {
9223
+ return definition.UserCtor;
9224
+ } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9225
+ // In this case, the custom element must have been defined before the registry patches
9226
+ // were applied. So return the non-pivot constructor
9227
+
9228
+
9229
+ if (isUndefined$1(NativeCtor)) {
9230
+ // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
9231
+ // We can patch the correct behavior using customElements.get()
9232
+ return nativeGet.call(nativeRegistry, tagName);
9233
+ }
9234
+
9235
+ return NativeCtor;
9236
+ });
9237
+ }; // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
9238
+ // @ts-ignore
9239
+
9240
+
9241
+ window.HTMLElement = function HTMLElement() {
9242
+ // Upgrading case: the pivoting class constructor was run by the browser's
9243
+ // native custom elements and we're in the process of running the
9244
+ // "constructor-call trick" on the natively constructed instance, so just
9245
+ // return that here.
9246
+ // This code path is also called when LWC `new`s a PivotCtor.
9247
+ var instance = upgradingInstance;
9248
+
9249
+ if (!isUndefined$1(instance)) {
9250
+ upgradingInstance = undefined;
9251
+ return instance;
9252
+ } // Construction case: we need to construct the pivoting instance and return it.
9253
+ // This is possible when the user register it via global registry and instantiate
9254
+ // it via `new Ctor()`.
9255
+
9256
+
9257
+ var constructor = this.constructor;
9258
+ var definition = globalDefinitionsByClass.get(constructor);
9259
+
9260
+ if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
9261
+ // This code path is hit if someone `new`s a class that extends `HTMLElement` without
9262
+ // doing `customElements.define()` first. This matches native browser behavior:
9263
+ // https://stackoverflow.com/a/61883392
9264
+ throw new TypeError('Illegal constructor');
9265
+ } // This constructor is ONLY invoked when it is the user instantiating
9266
+ // an element via new Ctor while Ctor is a registered global constructor.
9267
+
9268
+
9269
+ var PivotCtor = definition.PivotCtor,
9270
+ UserCtor = definition.UserCtor;
9271
+ return new PivotCtor(UserCtor);
9272
+ };
9273
+
9274
+ HTMLElement.prototype = NativeHTMLElement.prototype;
9275
+ /**
9276
+ * Create a new PivotConstructor for the given tagName, which is capable of being constructed
9277
+ * with a UserConstructor defining the behavior. Passing in the UserConstructor here
9278
+ * is a hint that can be used when registering a custom element with the global custom elements
9279
+ * registry for the first time, which provides certain optimizations. It also marks the UserConstructor
9280
+ * as "safe" to be used when passed in to a PivotConstructor.
9281
+ *
9282
+ * @param tagName - element tag name
9283
+ * @param UserCtor - userland custom element constructor
9284
+ * @returns a new custom element constructor
9285
+ */
9286
+
9287
+ return function createPivotConstructor(tagName, UserCtor) {
9288
+ tagName = StringToLowerCase.call(tagName);
9289
+ var PivotCtor = pivotCtorByTag.get(tagName);
9290
+
9291
+ if (isUndefined$1(PivotCtor)) {
9292
+ var definition = getOrCreateDefinitionForConstructor(UserCtor);
9293
+ PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class as a global custom element
9294
+
9295
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
9296
+ definition.PivotCtor = PivotCtor; // Only cache after nativeDefine has been called, because if it throws an error
9297
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
9298
+
9299
+ definitionForConstructor.set(UserCtor, definition);
9300
+ pivotCtorByTag.set(tagName, PivotCtor);
9301
+ } // Register a UserConstructor as "safe" to be used within a PivotConstructor
9302
+
9303
+
9304
+ registeredUserCtors.add(UserCtor);
9305
+ return PivotCtor;
9306
+ };
9307
+ }
9308
+ /*
9309
+ * Copyright (c) 2018, salesforce.com, inc.
9310
+ * All rights reserved.
9311
+ * SPDX-License-Identifier: MIT
9312
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9313
+ */
9314
+
9315
+
9316
+ var createScopedConstructor;
9317
+ var CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
9318
+ // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
9319
+ // or we're in a legacy browser.
9320
+
9321
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
9322
+ if (hasCustomElements) {
9323
+ // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
9324
+ // It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
9325
+ //
9326
+ // Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
9327
+ //
9328
+ // 1. LWC loads
9329
+ // 2. `const Ctor = class extends HTMLElement {}`
9330
+ // 3. `lwc.createElement(...)` // here we lazily patch
9331
+ // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
9332
+ //
9333
+ // To reduce the risk of this, it's safer to patch the registry eagerly.
9334
+ createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
9335
+ // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
9336
+ // because the HTMLElement prototypes are mixed up.
9337
+ //
9338
+ // The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
9339
+ // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
9340
+ // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
9341
+ // Caching avoids this problem.
9342
+
9343
+ CachedHTMLElement = window.HTMLElement;
9344
+ }
9345
+ } // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
9346
+ // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
9347
+ // multiple times per tag name.
9348
+
9349
+
9350
+ var createUserConstructor = function createUserConstructor(upgradeCallback, _connectedCallback2, _disconnectedCallback2, HTMLElementToExtend) {
9351
+ // TODO [#2972]: this class should expose observedAttributes as necessary
9352
+ return /*#__PURE__*/function (_HTMLElementToExtend) {
9353
+ _inherits(UserConstructor, _HTMLElementToExtend);
9354
+
9355
+ var _super9 = _createSuper(UserConstructor);
9356
+
9357
+ function UserConstructor() {
9358
+ var _this7;
9359
+
9360
+ _classCallCheck(this, UserConstructor);
9361
+
9362
+ _this7 = _super9.call(this);
9363
+ upgradeCallback(_assertThisInitialized(_this7));
9364
+ return _this7;
9365
+ }
9366
+
9367
+ _createClass(UserConstructor, [{
9368
+ key: "connectedCallback",
9369
+ value: function connectedCallback() {
9370
+ _connectedCallback2(this);
9371
+ }
9372
+ }, {
9373
+ key: "disconnectedCallback",
9374
+ value: function disconnectedCallback() {
9375
+ _disconnectedCallback2(this);
9376
+ }
9377
+ }]);
9378
+
9379
+ return UserConstructor;
9380
+ }(HTMLElementToExtend);
9381
+ };
9382
+
9383
+ function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
9384
+ if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
9385
+ // This error should be impossible to hit
9386
+ throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
9387
+ }
9388
+
9389
+ var UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
9390
+ var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
9391
+ return new ScopedConstructor(UserConstructor);
9392
+ }
9393
+ /*
9394
+ * Copyright (c) 2018, salesforce.com, inc.
9395
+ * All rights reserved.
9396
+ * SPDX-License-Identifier: MIT
9397
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9398
+ */
9399
+
9400
+ /**
9401
+ * We have three modes for creating custom elements:
9402
+ *
9403
+ * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
9404
+ * 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
9405
+ * same tag name, via a simple trick: every custom element constructor we define in the registry is basically
9406
+ * the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
9407
+ * constructor, which allows us to have completely customized functionality for different components.
9408
+ * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
9409
+ * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
9410
+ * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
9411
+ * because it must patch the global `customElements` and `HTMLElement` objects.
9412
+ */
9413
+
9414
+
9415
+ var createCustomElement;
9416
+
9417
+ if (hasCustomElements) {
9418
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
9419
+ createCustomElement = createCustomElementScoped;
9420
+ } else {
9421
+ // use global custom elements registry (vanilla)
9422
+ createCustomElement = createCustomElementVanilla;
9423
+ }
9424
+ } else {
9425
+ // no registry available here
9426
+ createCustomElement = createCustomElementCompat;
9427
+ }
8717
9428
  /*
8718
9429
  * Copyright (c) 2018, salesforce.com, inc.
8719
9430
  * All rights reserved.
@@ -8782,7 +9493,7 @@
8782
9493
  function isNull(obj) {
8783
9494
  return obj === null;
8784
9495
  }
8785
- /** version: 2.25.1 */
9496
+ /** version: 2.26.1 */
8786
9497
 
8787
9498
  /*
8788
9499
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8792,87 +9503,6 @@
8792
9503
  */
8793
9504
 
8794
9505
 
8795
- exports.getCustomElement = void 0;
8796
- exports.defineCustomElement = void 0;
8797
- var HTMLElementConstructor;
8798
-
8799
- function isCustomElementRegistryAvailable() {
8800
- if (typeof customElements === 'undefined') {
8801
- return false;
8802
- }
8803
-
8804
- try {
8805
- // dereference HTMLElement global because babel wraps globals in compat mode with a
8806
- // _wrapNativeSuper()
8807
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8808
- // get wrapped by babel.
8809
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8810
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8811
- // which are not equipped to be initialized that way.
8812
-
8813
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8814
- _inherits(clazz, _HTMLElementAlias);
8815
-
8816
- var _super7 = _createSuper(clazz);
8817
-
8818
- function clazz() {
8819
- _classCallCheck(this, clazz);
8820
-
8821
- return _super7.apply(this, arguments);
8822
- }
8823
-
8824
- return _createClass(clazz);
8825
- }(HTMLElementAlias);
8826
-
8827
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8828
- new clazz();
8829
- return true;
8830
- } catch (_a) {
8831
- return false;
8832
- }
8833
- }
8834
-
8835
- if (isCustomElementRegistryAvailable()) {
8836
- exports.getCustomElement = customElements.get.bind(customElements);
8837
- exports.defineCustomElement = customElements.define.bind(customElements);
8838
- HTMLElementConstructor = HTMLElement;
8839
- } else {
8840
- var registry = Object.create(null);
8841
- var reverseRegistry = new WeakMap();
8842
-
8843
- exports.defineCustomElement = function define(name, ctor) {
8844
- if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
8845
- throw new TypeError("Invalid Registration");
8846
- }
8847
-
8848
- registry[name] = ctor;
8849
- reverseRegistry.set(ctor, name);
8850
- };
8851
-
8852
- exports.getCustomElement = function get(name) {
8853
- return registry[name];
8854
- };
8855
-
8856
- HTMLElementConstructor = function HTMLElement() {
8857
- if (!(this instanceof HTMLElement)) {
8858
- throw new TypeError("Invalid Invocation");
8859
- }
8860
-
8861
- var constructor = this.constructor;
8862
- var name = reverseRegistry.get(constructor);
8863
-
8864
- if (!name) {
8865
- throw new TypeError("Invalid Construction");
8866
- }
8867
-
8868
- var elm = document.createElement(name);
8869
- Object.setPrototypeOf(elm, constructor.prototype);
8870
- return elm;
8871
- };
8872
-
8873
- HTMLElementConstructor.prototype = HTMLElement.prototype;
8874
- }
8875
-
8876
9506
  function cloneNode(node, deep) {
8877
9507
  return node.cloneNode(deep);
8878
9508
  }
@@ -8931,18 +9561,18 @@
8931
9561
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8932
9562
 
8933
9563
  if (!isUndefined(wrapperTags)) {
8934
- var _iterator6 = _createForOfIteratorHelper(wrapperTags),
8935
- _step6;
9564
+ var _iterator7 = _createForOfIteratorHelper(wrapperTags),
9565
+ _step7;
8936
9566
 
8937
9567
  try {
8938
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
8939
- var wrapperTag = _step6.value;
9568
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
9569
+ var wrapperTag = _step7.value;
8940
9570
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8941
9571
  }
8942
9572
  } catch (err) {
8943
- _iterator6.e(err);
9573
+ _iterator7.e(err);
8944
9574
  } finally {
8945
- _iterator6.f();
9575
+ _iterator7.f();
8946
9576
  }
8947
9577
  } // For IE11, the document title must not be undefined, but it can be an empty string
8948
9578
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -9088,8 +9718,6 @@
9088
9718
  assert.invariant(elm instanceof HTMLElement, msg);
9089
9719
  }
9090
9720
 
9091
- var HTMLElementExported = HTMLElementConstructor;
9092
- exports.HTMLElementExported = HTMLElementExported;
9093
9721
  exports.addEventListener = addEventListener;
9094
9722
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
9095
9723
  exports.attachShadow = attachShadow;
@@ -9148,6 +9776,8 @@
9148
9776
  {
9149
9777
  // insertStyleSheet implementation shares a global cache of stylesheet data
9150
9778
  insertStylesheet: insertStylesheet,
9779
+ // relies on a shared global cache
9780
+ createCustomElement: createCustomElement,
9151
9781
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
9152
9782
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
9153
9783
  });
@@ -9268,35 +9898,39 @@
9268
9898
  var hydratedCustomElements = new WeakSet();
9269
9899
 
9270
9900
  function buildCustomElementConstructor(Ctor) {
9901
+ var _a;
9902
+
9271
9903
  var HtmlPrototype = getComponentHtmlPrototype(Ctor);
9272
- return /*#__PURE__*/function (_HtmlPrototype) {
9273
- _inherits(_class, _HtmlPrototype);
9904
+ var observedAttributes = HtmlPrototype.observedAttributes;
9905
+ var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
9906
+ return _a = /*#__PURE__*/function (_HTMLElement2) {
9907
+ _inherits(_a, _HTMLElement2);
9274
9908
 
9275
- var _super8 = _createSuper(_class);
9909
+ var _super10 = _createSuper(_a);
9276
9910
 
9277
- function _class() {
9278
- var _this6;
9911
+ function _a() {
9912
+ var _this8;
9279
9913
 
9280
- _classCallCheck(this, _class);
9914
+ _classCallCheck(this, _a);
9281
9915
 
9282
- _this6 = _super8.call(this);
9916
+ _this8 = _super10.call(this);
9283
9917
 
9284
- if (_this6.isConnected) {
9918
+ if (_this8.isConnected) {
9285
9919
  // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
9286
- hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
9287
- hydratedCustomElements.add(_assertThisInitialized(_this6));
9920
+ hydrateComponent(_assertThisInitialized(_this8), Ctor, {});
9921
+ hydratedCustomElements.add(_assertThisInitialized(_this8));
9288
9922
  } else {
9289
- createVM(_assertThisInitialized(_this6), Ctor, renderer, {
9923
+ createVM(_assertThisInitialized(_this8), Ctor, renderer, {
9290
9924
  mode: 'open',
9291
9925
  owner: null,
9292
- tagName: _this6.tagName
9926
+ tagName: _this8.tagName
9293
9927
  });
9294
9928
  }
9295
9929
 
9296
- return _this6;
9930
+ return _this8;
9297
9931
  }
9298
9932
 
9299
- _createClass(_class, [{
9933
+ _createClass(_a, [{
9300
9934
  key: "connectedCallback",
9301
9935
  value: function connectedCallback() {
9302
9936
  if (hydratedCustomElements.has(this)) {
@@ -9311,10 +9945,15 @@
9311
9945
  value: function disconnectedCallback() {
9312
9946
  disconnectRootElement(this);
9313
9947
  }
9948
+ }, {
9949
+ key: "attributeChangedCallback",
9950
+ value: function attributeChangedCallback(name, oldValue, newValue) {
9951
+ _attributeChangedCallback.call(this, name, oldValue, newValue);
9952
+ }
9314
9953
  }]);
9315
9954
 
9316
- return _class;
9317
- }(HtmlPrototype);
9955
+ return _a;
9956
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)), _a.observedAttributes = observedAttributes, _a;
9318
9957
  }
9319
9958
  /*
9320
9959
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9400,8 +10039,11 @@
9400
10039
  throw new TypeError("\"createElement\" function expects an \"is\" option with a valid component constructor.");
9401
10040
  }
9402
10041
 
9403
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
9404
- var wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
10042
+ var createCustomElement = renderer.createCustomElement; // tagName must be all lowercase, unfortunately, we have legacy code that is
10043
+ // passing `sel` as a camel-case, which makes them invalid custom elements name
10044
+ // the following line guarantees that this does not leaks beyond this point.
10045
+
10046
+ var tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
9405
10047
 
9406
10048
  /**
9407
10049
  * Note: if the upgradable constructor does not expect, or throw when we new it
@@ -9410,9 +10052,9 @@
9410
10052
  * an upgradable custom element.
9411
10053
  */
9412
10054
 
9413
- var element = new UpgradableConstructor(function (elm) {
10055
+ var upgradeCallback = function upgradeCallback(elm) {
9414
10056
  createVM(elm, Ctor, renderer, {
9415
- tagName: sel,
10057
+ tagName: tagName,
9416
10058
  mode: options.mode !== 'closed' ? 'open' : 'closed',
9417
10059
  owner: null
9418
10060
  });
@@ -9421,15 +10063,21 @@
9421
10063
  ConnectingSlot.set(elm, connectRootElement);
9422
10064
  DisconnectingSlot.set(elm, disconnectRootElement);
9423
10065
  }
10066
+ };
9424
10067
 
9425
- wasComponentUpgraded = true;
9426
- });
10068
+ var connectedCallback = function connectedCallback(elm) {
10069
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
10070
+ connectRootElement(elm);
10071
+ }
10072
+ };
9427
10073
 
9428
- if (!wasComponentUpgraded) {
9429
- /* eslint-disable-next-line no-console */
9430
- console.error("Unexpected tag name \"".concat(sel, "\". This name is a registered custom element, preventing LWC to upgrade the element."));
9431
- }
10074
+ var disconnectedCallback = function disconnectedCallback(elm) {
10075
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
10076
+ disconnectRootElement(elm);
10077
+ }
10078
+ };
9432
10079
 
10080
+ var element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
9433
10081
  return element;
9434
10082
  }
9435
10083
  /*
@@ -9512,7 +10160,7 @@
9512
10160
  });
9513
10161
  freeze(LightningElement);
9514
10162
  seal(LightningElement.prototype);
9515
- /* version: 2.25.1 */
10163
+ /* version: 2.26.1 */
9516
10164
 
9517
10165
  exports.LightningElement = LightningElement;
9518
10166
  exports.__unstable__ProfilerControl = profilerControl;