lwc 2.25.1 → 2.26.0

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 +885 -411
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +885 -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 +731 -205
  5. package/dist/engine-dom/iife/es5/engine-dom.js +954 -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 +883 -224
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +885 -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 +731 -205
  11. package/dist/engine-dom/umd/es5/engine-dom.js +954 -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 +883 -224
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +133 -227
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +133 -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 +7 -7
@@ -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.0";
372
373
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.25.1 */
374
+ /** version: 2.26.0 */
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.0 */
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.0 */
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,25 @@
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
+ };
5079
+
5080
+ var elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
5160
5081
  vnode.elm = elm;
5161
5082
  vnode.vm = vm;
5162
5083
  linkNodeToShadow(elm, owner, renderer);
@@ -5164,8 +5085,6 @@
5164
5085
 
5165
5086
  if (vm) {
5166
5087
  allocateChildren(vnode, vm);
5167
- } else if (vnode.ctor !== UpgradableConstructor) {
5168
- throw new TypeError("Incorrect Component Constructor");
5169
5088
  }
5170
5089
 
5171
5090
  patchElementPropsAndAttrs$1(null, vnode, renderer);
@@ -7509,21 +7428,21 @@
7509
7428
  var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
7510
7429
  _inherits(WireContextRegistrationEvent, _CustomEvent);
7511
7430
 
7512
- var _super6 = _createSuper(WireContextRegistrationEvent);
7431
+ var _super5 = _createSuper(WireContextRegistrationEvent);
7513
7432
 
7514
7433
  function WireContextRegistrationEvent(adapterToken, _ref3) {
7515
- var _this5;
7434
+ var _this4;
7516
7435
 
7517
7436
  var setNewContext = _ref3.setNewContext,
7518
7437
  setDisconnectedCallback = _ref3.setDisconnectedCallback;
7519
7438
 
7520
7439
  _classCallCheck(this, WireContextRegistrationEvent);
7521
7440
 
7522
- _this5 = _super6.call(this, adapterToken, {
7441
+ _this4 = _super5.call(this, adapterToken, {
7523
7442
  bubbles: true,
7524
7443
  composed: true
7525
7444
  });
7526
- defineProperties(_assertThisInitialized(_this5), {
7445
+ defineProperties(_assertThisInitialized(_this4), {
7527
7446
  setNewContext: {
7528
7447
  value: setNewContext
7529
7448
  },
@@ -7531,7 +7450,7 @@
7531
7450
  value: setDisconnectedCallback
7532
7451
  }
7533
7452
  });
7534
- return _this5;
7453
+ return _this4;
7535
7454
  }
7536
7455
 
7537
7456
  return _createClass(WireContextRegistrationEvent);
@@ -8232,13 +8151,27 @@
8232
8151
  // Consequently, hydration mismatches will occur if scoped CSS token classnames
8233
8152
  // are rendered during SSR. This needs to be accounted for when validating.
8234
8153
 
8235
- if (scopedToken) {
8154
+ if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
8236
8155
  if (!isUndefined$1(className)) {
8237
- className = isNull(stylesheetTokenHost) ? "".concat(scopedToken, " ").concat(className) : "".concat(scopedToken, " ").concat(className, " ").concat(stylesheetTokenHost);
8156
+ // The order of the className should be scopedToken className stylesheetTokenHost
8157
+ var classTokens = [scopedToken, className, stylesheetTokenHost];
8158
+ var classNames = ArrayFilter.call(classTokens, function (token) {
8159
+ return !isNull(token);
8160
+ });
8161
+ className = ArrayJoin.call(classNames, ' ');
8238
8162
  } else if (!isUndefined$1(classMap)) {
8239
- classMap = Object.assign(Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true)), isNull(stylesheetTokenHost) ? {} : _defineProperty({}, stylesheetTokenHost, true));
8163
+ classMap = Object.assign(Object.assign(Object.assign({}, classMap), !isNull(scopedToken) ? _defineProperty({}, scopedToken, true) : {}), !isNull(stylesheetTokenHost) ? _defineProperty({}, stylesheetTokenHost, true) : {});
8240
8164
  } else {
8241
- className = isNull(stylesheetTokenHost) ? "".concat(scopedToken) : "".concat(scopedToken, " ").concat(stylesheetTokenHost);
8165
+ // The order of the className should be scopedToken stylesheetTokenHost
8166
+ var _classTokens = [scopedToken, stylesheetTokenHost];
8167
+
8168
+ var _classNames = ArrayFilter.call(_classTokens, function (token) {
8169
+ return !isNull(token);
8170
+ });
8171
+
8172
+ if (_classNames.length) {
8173
+ className = ArrayJoin.call(_classNames, ' ');
8174
+ }
8242
8175
  }
8243
8176
  }
8244
8177
 
@@ -8554,7 +8487,7 @@
8554
8487
 
8555
8488
  return ctor;
8556
8489
  }
8557
- /* version: 2.25.1 */
8490
+ /* version: 2.26.0 */
8558
8491
 
8559
8492
  /*
8560
8493
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8714,6 +8647,779 @@
8714
8647
  insertLocalStylesheet(content, target);
8715
8648
  }
8716
8649
  }
8650
+ /*
8651
+ * Copyright (c) 2020, salesforce.com, inc.
8652
+ * All rights reserved.
8653
+ * SPDX-License-Identifier: MIT
8654
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8655
+ */
8656
+
8657
+
8658
+ function isCustomElementRegistryAvailable() {
8659
+ if (typeof customElements === 'undefined') {
8660
+ return false;
8661
+ }
8662
+
8663
+ try {
8664
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
8665
+ // _wrapNativeSuper()
8666
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
8667
+ // get wrapped by babel.
8668
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8669
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8670
+ // which are not equipped to be initialized that way.
8671
+
8672
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8673
+ _inherits(clazz, _HTMLElementAlias);
8674
+
8675
+ var _super6 = _createSuper(clazz);
8676
+
8677
+ function clazz() {
8678
+ _classCallCheck(this, clazz);
8679
+
8680
+ return _super6.apply(this, arguments);
8681
+ }
8682
+
8683
+ return _createClass(clazz);
8684
+ }(HTMLElementAlias);
8685
+
8686
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8687
+ new clazz();
8688
+ return true;
8689
+ } catch (_a) {
8690
+ return false;
8691
+ }
8692
+ }
8693
+
8694
+ var hasCustomElements = isCustomElementRegistryAvailable();
8695
+ /*
8696
+ * Copyright (c) 2018, salesforce.com, inc.
8697
+ * All rights reserved.
8698
+ * SPDX-License-Identifier: MIT
8699
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8700
+ */
8701
+ // Creates a custom element for compat (legacy) browser environments
8702
+
8703
+ var createCustomElementCompat = function createCustomElementCompat(tagName, upgradeCallback) {
8704
+ var elm = document.createElement(tagName);
8705
+ upgradeCallback(elm); // nothing to do with the result for now
8706
+
8707
+ return elm;
8708
+ };
8709
+ /*
8710
+ * Copyright (c) 2018, salesforce.com, inc.
8711
+ * All rights reserved.
8712
+ * SPDX-License-Identifier: MIT
8713
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8714
+ */
8715
+
8716
+
8717
+ var cachedConstructors = new Map();
8718
+ var elementsUpgradedOutsideLWC = new WeakSet();
8719
+ var elementBeingUpgradedByLWC = false; // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
8720
+ // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
8721
+ // Another benefit is that only LWC can create components that actually do anything – if you do
8722
+ // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
8723
+ // This class should be created once per tag name.
8724
+
8725
+ var createUpgradableConstructor = function createUpgradableConstructor(_connectedCallback, _disconnectedCallback) {
8726
+ // TODO [#2972]: this class should expose observedAttributes as necessary
8727
+ return /*#__PURE__*/function (_HTMLElement) {
8728
+ _inherits(UpgradableConstructor, _HTMLElement);
8729
+
8730
+ var _super7 = _createSuper(UpgradableConstructor);
8731
+
8732
+ function UpgradableConstructor(upgradeCallback) {
8733
+ var _this5;
8734
+
8735
+ _classCallCheck(this, UpgradableConstructor);
8736
+
8737
+ _this5 = _super7.call(this); // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
8738
+ // then elementBeingUpgraded will be false
8739
+
8740
+ if (elementBeingUpgradedByLWC) {
8741
+ upgradeCallback(_assertThisInitialized(_this5));
8742
+ } else {
8743
+ // keep track of elements that were not created by lwc.createElement,
8744
+ // so we can ignore their lifecycle hooks
8745
+ elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this5)); // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
8746
+ // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8747
+ }
8748
+
8749
+ return _this5;
8750
+ }
8751
+
8752
+ _createClass(UpgradableConstructor, [{
8753
+ key: "connectedCallback",
8754
+ value: function connectedCallback() {
8755
+ if (!elementsUpgradedOutsideLWC.has(this)) {
8756
+ _connectedCallback(this);
8757
+ }
8758
+ }
8759
+ }, {
8760
+ key: "disconnectedCallback",
8761
+ value: function disconnectedCallback() {
8762
+ if (!elementsUpgradedOutsideLWC.has(this)) {
8763
+ _disconnectedCallback(this);
8764
+ }
8765
+ }
8766
+ }]);
8767
+
8768
+ return UpgradableConstructor;
8769
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
8770
+ };
8771
+
8772
+ var createCustomElementVanilla = function createCustomElementVanilla(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
8773
+ // use global custom elements registry
8774
+ var UpgradableConstructor = cachedConstructors.get(tagName);
8775
+
8776
+ if (isUndefined$1(UpgradableConstructor)) {
8777
+ if (!isUndefined$1(customElements.get(tagName))) {
8778
+ throw new Error("Unexpected tag name \"".concat(tagName, "\". This name is a registered custom element, preventing LWC to upgrade the element."));
8779
+ }
8780
+
8781
+ UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
8782
+ customElements.define(tagName, UpgradableConstructor);
8783
+ cachedConstructors.set(tagName, UpgradableConstructor);
8784
+ }
8785
+
8786
+ elementBeingUpgradedByLWC = true;
8787
+
8788
+ try {
8789
+ return new UpgradableConstructor(upgradeCallback);
8790
+ } finally {
8791
+ elementBeingUpgradedByLWC = false;
8792
+ }
8793
+ };
8794
+ /*
8795
+ * Copyright (c) 2020, salesforce.com, inc.
8796
+ * All rights reserved.
8797
+ * SPDX-License-Identifier: MIT
8798
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8799
+ */
8800
+
8801
+ /**
8802
+ * Create a scoped registry, i.e. a function that can create custom elements whose tag names
8803
+ * do not conflict with vanilla custom elements having the same tag name.
8804
+ */
8805
+
8806
+
8807
+ function createScopedRegistry() {
8808
+ if (!hasCustomElements) {
8809
+ // This code should never be reached, because we don't use the pivot registry if
8810
+ // custom elements are unavailable.
8811
+ throw new Error('Custom elements are not supported in this environment.');
8812
+ }
8813
+
8814
+ var _window = window,
8815
+ NativeHTMLElement = _window.HTMLElement;
8816
+ var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
8817
+ nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
8818
+ nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
8819
+ nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
8820
+ nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
8821
+ var definitionForElement = new WeakMap();
8822
+ var pendingRegistryForElement = new WeakMap();
8823
+ var definitionForConstructor = new WeakMap();
8824
+ var registeredUserCtors = new WeakSet();
8825
+ var pivotCtorByTag = new Map();
8826
+ var globalDefinitionsByTag = new Map();
8827
+ var globalDefinitionsByClass = new Map();
8828
+ var awaitingUpgrade = new Map();
8829
+ var EMPTY_SET = new Set();
8830
+
8831
+ function createDefinitionRecord(constructor) {
8832
+ var _a;
8833
+
8834
+ var _constructor$prototyp = constructor.prototype,
8835
+ connectedCallback = _constructor$prototyp.connectedCallback,
8836
+ disconnectedCallback = _constructor$prototyp.disconnectedCallback,
8837
+ adoptedCallback = _constructor$prototyp.adoptedCallback,
8838
+ attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
8839
+ var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
8840
+ return {
8841
+ UserCtor: constructor,
8842
+ PivotCtor: undefined,
8843
+ connectedCallback: connectedCallback,
8844
+ disconnectedCallback: disconnectedCallback,
8845
+ adoptedCallback: adoptedCallback,
8846
+ attributeChangedCallback: attributeChangedCallback,
8847
+ observedAttributes: observedAttributes
8848
+ };
8849
+ } // Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
8850
+ // element. Note that the `registeredDefinition` represents the constructor that was used to register during
8851
+ // `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
8852
+ // constructor is invoked with another constructor.
8853
+
8854
+
8855
+ function createPivotingClass(tagName, registeredDefinition) {
8856
+ var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
8857
+ _inherits(PivotCtor, _NativeHTMLElement);
8858
+
8859
+ var _super8 = _createSuper(PivotCtor);
8860
+
8861
+ function PivotCtor(UserCtor) {
8862
+ var _this6;
8863
+
8864
+ _classCallCheck(this, PivotCtor);
8865
+
8866
+ // This constructor can only be invoked by:
8867
+ // a) the browser instantiating an element from parsing or via document.createElement.
8868
+ // b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
8869
+ // b) new UserClass.
8870
+ // When LWC instantiates it, it will pass the upgrading definition as an argument
8871
+ // If the caller signals via UserCtor that this is in fact a controlled
8872
+ // definition, we use that one, otherwise fallback to the global
8873
+ // internal registry.
8874
+ _this6 = _super8.call(this);
8875
+ var userCtorIsDefined = !isUndefined$1(UserCtor);
8876
+
8877
+ if (userCtorIsDefined) {
8878
+ if (!isConstructor(UserCtor)) {
8879
+ throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
8880
+ }
8881
+
8882
+ if (!registeredUserCtors.has(UserCtor)) {
8883
+ throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
8884
+ }
8885
+ }
8886
+
8887
+ var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
8888
+
8889
+ if (!isUndefined$1(definition)) {
8890
+ internalUpgrade(_assertThisInitialized(_this6), registeredDefinition, definition);
8891
+ } else {
8892
+ // This is the case in which there is no global definition, and
8893
+ // it is not handled by LWC (otherwise it will have a valid UserCtor)
8894
+ // so we need to add it to the pending queue just in case it eventually
8895
+ // gets defined in the global registry.
8896
+ pendingRegistryForElement.set(_assertThisInitialized(_this6), registeredDefinition);
8897
+ }
8898
+
8899
+ return _this6;
8900
+ }
8901
+
8902
+ _createClass(PivotCtor, [{
8903
+ key: "connectedCallback",
8904
+ value: function connectedCallback() {
8905
+ var _a;
8906
+
8907
+ var definition = definitionForElement.get(this);
8908
+
8909
+ if (!isUndefined$1(definition)) {
8910
+ // Delegate out to user callback
8911
+ (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8912
+ } else {
8913
+ // Register for upgrade when defined (only when connected, so we don't leak)
8914
+ var awaiting = awaitingUpgrade.get(tagName);
8915
+
8916
+ if (isUndefined$1(awaiting)) {
8917
+ awaitingUpgrade.set(tagName, awaiting = new Set());
8918
+ }
8919
+
8920
+ awaiting.add(this);
8921
+ }
8922
+ }
8923
+ }, {
8924
+ key: "disconnectedCallback",
8925
+ value: function disconnectedCallback() {
8926
+ var _a;
8927
+
8928
+ var definition = definitionForElement.get(this);
8929
+
8930
+ if (!isUndefined$1(definition)) {
8931
+ // Delegate out to user callback
8932
+ (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8933
+ } else {
8934
+ // Un-register for upgrade when defined (so we don't leak)
8935
+ var awaiting = awaitingUpgrade.get(tagName); // At this point, awaiting should never be undefined, because connectedCallback
8936
+ // must have been called before disconnectedCallback. But just to be safe, we check
8937
+
8938
+ if (!isUndefined$1(awaiting)) {
8939
+ awaiting.delete(this);
8940
+ }
8941
+ }
8942
+ }
8943
+ }, {
8944
+ key: "adoptedCallback",
8945
+ value: function adoptedCallback() {
8946
+ var _a;
8947
+
8948
+ var definition = definitionForElement.get(this);
8949
+ (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
8950
+ }
8951
+ }, {
8952
+ key: "attributeChangedCallback",
8953
+ value: function attributeChangedCallback(name, oldValue, newValue) {
8954
+ var _a;
8955
+
8956
+ var definition = definitionForElement.get(this); // if both definitions are the same, then the observedAttributes is the same,
8957
+ // but if they are different, only if the runtime definition has the attribute
8958
+ // marked as observed, then it should invoke attributeChangedCallback.
8959
+
8960
+ if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
8961
+ (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
8962
+ }
8963
+ }
8964
+ }]);
8965
+
8966
+ return PivotCtor;
8967
+ }(NativeHTMLElement);
8968
+
8969
+ PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
8970
+ return PivotCtor;
8971
+ }
8972
+
8973
+ function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
8974
+ var observedAttributes = pivotDefinition.observedAttributes,
8975
+ attributeChangedCallback = pivotDefinition.attributeChangedCallback;
8976
+
8977
+ if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
8978
+ // This instance does not need to observe any attributes, no need to patch
8979
+ return EMPTY_SET;
8980
+ } // Natively, the attributes observed by the registered definition are going to be taken
8981
+ // care of by the browser, only the difference between the two sets has to be taken
8982
+ // care by the patched version.
8983
+
8984
+
8985
+ return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
8986
+ return !registeredDefinition.observedAttributes.has(x);
8987
+ }));
8988
+ }
8989
+
8990
+ function throwAsyncError(error) {
8991
+ // Per native custom element behavior, errors thrown in attributeChangedCallback
8992
+ // become unhandled async errors. We use setTimeout() instead of Promise.resolve()
8993
+ // to make it an unhandled error rather than an unhandled rejection.
8994
+ setTimeout(function () {
8995
+ throw error;
8996
+ });
8997
+ } // Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
8998
+ // Why is this necessary? Well basically, you can't change the `observedAttributes` after
8999
+ // a custom element is defined. So with pivots, if two classes share the same tag name,
9000
+ // and the second class observes attributes that aren't observed by the first one,
9001
+ // then those attributes can never be observed by the native `observedAttributes` system.
9002
+ // So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
9003
+ // we only do this when absolutely necessary, though; i.e. because we've determined
9004
+ // that we aren't observing the attributes we need to.
9005
+
9006
+
9007
+ function patchAttributes(instance, registeredDefinition, pivotDefinition) {
9008
+ var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
9009
+
9010
+ if (newObservedAttributes.size === 0) {
9011
+ return;
9012
+ }
9013
+
9014
+ var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Patch the instance.
9015
+ // Note we use the native `getAttribute` rather than the super's `getAttribute` because
9016
+ // we don't actually want it to be observable that we're calling `getAttribute` from
9017
+ // `setAttribute` and `removeAttribute`.
9018
+ // TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
9019
+
9020
+ defineProperties(instance, {
9021
+ setAttribute: {
9022
+ value: function setAttribute(name, value) {
9023
+ if (newObservedAttributes.has(name)) {
9024
+ var old = nativeGetAttribute.call(this, name);
9025
+ nativeSetAttribute.call(this, name, value);
9026
+
9027
+ try {
9028
+ attributeChangedCallback.call(this, name, old, value + '');
9029
+ } catch (error) {
9030
+ throwAsyncError(error);
9031
+ }
9032
+ } else {
9033
+ nativeSetAttribute.call(this, name, value);
9034
+ }
9035
+ },
9036
+ writable: true,
9037
+ enumerable: true,
9038
+ configurable: true
9039
+ },
9040
+ removeAttribute: {
9041
+ value: function removeAttribute(name) {
9042
+ if (newObservedAttributes.has(name)) {
9043
+ var old = nativeGetAttribute.call(this, name);
9044
+ nativeRemoveAttribute.call(this, name);
9045
+
9046
+ try {
9047
+ attributeChangedCallback.call(this, name, old, null);
9048
+ } catch (error) {
9049
+ throwAsyncError(error);
9050
+ }
9051
+ } else {
9052
+ nativeRemoveAttribute.call(this, name);
9053
+ }
9054
+ },
9055
+ writable: true,
9056
+ enumerable: true,
9057
+ configurable: true
9058
+ }
9059
+ });
9060
+ }
9061
+
9062
+ function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
9063
+ // The below case patches observed attributes for the case where the HTML element is upgraded
9064
+ // from a pre-existing one in the DOM.
9065
+ var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
9066
+
9067
+ if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
9068
+ return;
9069
+ }
9070
+
9071
+ var attributeChangedCallback = pivotDefinition.attributeChangedCallback; // Approximate observedAttributes from the user class, but only for the new observed attributes
9072
+
9073
+ newObservedAttributes.forEach(function (name) {
9074
+ if (nativeHasAttribute.call(instance, name)) {
9075
+ var newValue = nativeGetAttribute.call(instance, name);
9076
+ attributeChangedCallback.call(instance, name, null, newValue);
9077
+ }
9078
+ });
9079
+ } // User extends this HTMLElement, which returns the CE being upgraded
9080
+
9081
+
9082
+ var upgradingInstance; // Helper to upgrade an instance with a CE definition using "constructor call trick"
9083
+
9084
+ function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
9085
+ setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
9086
+ definitionForElement.set(instance, pivotDefinition); // attributes patches when needed
9087
+
9088
+ if (pivotDefinition !== registeredDefinition) {
9089
+ patchAttributes(instance, registeredDefinition, pivotDefinition);
9090
+ } // Tricking the construction path to believe that a new instance is being created,
9091
+ // that way it will execute the super initialization mechanism but the HTMLElement
9092
+ // constructor will reuse the instance by returning the upgradingInstance.
9093
+ // This is by far the most important piece of the puzzle
9094
+
9095
+
9096
+ upgradingInstance = instance; // By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
9097
+ // The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
9098
+ // Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
9099
+
9100
+ new pivotDefinition.UserCtor();
9101
+ patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
9102
+ }
9103
+
9104
+ function isConstructor(constructor) {
9105
+ return isFunction$1(constructor) && isObject(constructor.prototype);
9106
+ }
9107
+
9108
+ function getOrCreateDefinitionForConstructor(constructor) {
9109
+ if (!isConstructor(constructor)) {
9110
+ throw new TypeError('The referenced constructor is not a constructor.');
9111
+ }
9112
+
9113
+ var definition = definitionForConstructor.get(constructor);
9114
+
9115
+ if (!isUndefined$1(definition)) {
9116
+ return definition;
9117
+ }
9118
+
9119
+ return createDefinitionRecord(constructor);
9120
+ }
9121
+
9122
+ var _window2 = window,
9123
+ nativeRegistry = _window2.customElements;
9124
+ var nativeDefine = nativeRegistry.define,
9125
+ nativeWhenDefined = nativeRegistry.whenDefined,
9126
+ nativeGet = nativeRegistry.get; // patch for the global registry define mechanism
9127
+
9128
+ CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
9129
+ if (options && options.extends) {
9130
+ // TODO [#2983]: should we support `extends`?
9131
+ throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
9132
+ }
9133
+
9134
+ if (globalDefinitionsByTag.has(tagName)) {
9135
+ throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
9136
+ }
9137
+
9138
+ if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
9139
+ throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
9140
+ }
9141
+
9142
+ var definition = getOrCreateDefinitionForConstructor(constructor);
9143
+ registeredUserCtors.add(constructor);
9144
+ var PivotCtor = pivotCtorByTag.get(tagName);
9145
+
9146
+ if (isUndefined$1(PivotCtor)) {
9147
+ PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class which will handle global registry initializations
9148
+
9149
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
9150
+ } // Only cache after nativeDefine has been called, because if it throws an error
9151
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
9152
+
9153
+
9154
+ definitionForConstructor.set(constructor, definition);
9155
+ pivotCtorByTag.set(tagName, PivotCtor);
9156
+ globalDefinitionsByTag.set(tagName, definition);
9157
+ globalDefinitionsByClass.set(constructor, definition); // For globally defined custom elements, the definition associated
9158
+ // to the UserCtor has a back-pointer to PivotCtor in case the user
9159
+ // new the UserCtor, so we know how to create the underlying element.
9160
+
9161
+ definition.PivotCtor = PivotCtor; // Upgrade any elements created in this scope before customElements.define
9162
+ // was called, which should be exhibited by the following steps:
9163
+ // 1) LWC registers a tagName for an LWC component.
9164
+ // 2) Element with same tagName is created with document.createElement()
9165
+ // and inserted into DOM.
9166
+ // 3) customElements.define() is called with tagName and non-LWC constructor.
9167
+ // This requires immediate upgrade when the new global tagName is defined.
9168
+
9169
+ var awaiting = awaitingUpgrade.get(tagName);
9170
+
9171
+ if (!isUndefined$1(awaiting)) {
9172
+ awaitingUpgrade.delete(tagName);
9173
+
9174
+ var _iterator6 = _createForOfIteratorHelper(awaiting),
9175
+ _step6;
9176
+
9177
+ try {
9178
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
9179
+ var element = _step6.value;
9180
+ var registeredDefinition = pendingRegistryForElement.get(element); // At this point, registeredDefinition should never be undefined because awaitingUpgrade
9181
+ // is only populated when we haven't run internalUpgrade yet, and we only populate
9182
+ // pendingRegistryForElement when internalUpgrade hasn't run yet.
9183
+ // But just to be safe, we check.
9184
+
9185
+ if (!isUndefined$1(registeredDefinition)) {
9186
+ pendingRegistryForElement.delete(element);
9187
+ internalUpgrade(element, registeredDefinition, definition);
9188
+ }
9189
+ }
9190
+ } catch (err) {
9191
+ _iterator6.e(err);
9192
+ } finally {
9193
+ _iterator6.f();
9194
+ }
9195
+ }
9196
+ };
9197
+
9198
+ CustomElementRegistry.prototype.get = function get(tagName) {
9199
+ var NativeCtor = nativeGet.call(nativeRegistry, tagName);
9200
+
9201
+ if (!isUndefined$1(NativeCtor)) {
9202
+ var definition = globalDefinitionsByTag.get(tagName);
9203
+
9204
+ if (!isUndefined$1(definition)) {
9205
+ return definition.UserCtor; // defined by the patched custom elements registry
9206
+ } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9207
+
9208
+
9209
+ return NativeCtor; // return the pivot constructor or constructor that existed before patching
9210
+ }
9211
+ };
9212
+
9213
+ CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
9214
+ return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
9215
+ var definition = globalDefinitionsByTag.get(tagName);
9216
+
9217
+ if (!isUndefined$1(definition)) {
9218
+ return definition.UserCtor;
9219
+ } // TODO [#3073]: return undefined rather than the pivot constructor (NativeCtor)
9220
+ // In this case, the custom element must have been defined before the registry patches
9221
+ // were applied. So return the non-pivot constructor
9222
+
9223
+
9224
+ if (isUndefined$1(NativeCtor)) {
9225
+ // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
9226
+ // We can patch the correct behavior using customElements.get()
9227
+ return nativeGet.call(nativeRegistry, tagName);
9228
+ }
9229
+
9230
+ return NativeCtor;
9231
+ });
9232
+ }; // This constructor is invoked when we call `new pivotDefinition.UserCtor()`
9233
+ // @ts-ignore
9234
+
9235
+
9236
+ window.HTMLElement = function HTMLElement() {
9237
+ // Upgrading case: the pivoting class constructor was run by the browser's
9238
+ // native custom elements and we're in the process of running the
9239
+ // "constructor-call trick" on the natively constructed instance, so just
9240
+ // return that here.
9241
+ // This code path is also called when LWC `new`s a PivotCtor.
9242
+ var instance = upgradingInstance;
9243
+
9244
+ if (!isUndefined$1(instance)) {
9245
+ upgradingInstance = undefined;
9246
+ return instance;
9247
+ } // Construction case: we need to construct the pivoting instance and return it.
9248
+ // This is possible when the user register it via global registry and instantiate
9249
+ // it via `new Ctor()`.
9250
+
9251
+
9252
+ var constructor = this.constructor;
9253
+ var definition = globalDefinitionsByClass.get(constructor);
9254
+
9255
+ if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
9256
+ // This code path is hit if someone `new`s a class that extends `HTMLElement` without
9257
+ // doing `customElements.define()` first. This matches native browser behavior:
9258
+ // https://stackoverflow.com/a/61883392
9259
+ throw new TypeError('Illegal constructor');
9260
+ } // This constructor is ONLY invoked when it is the user instantiating
9261
+ // an element via new Ctor while Ctor is a registered global constructor.
9262
+
9263
+
9264
+ var PivotCtor = definition.PivotCtor,
9265
+ UserCtor = definition.UserCtor;
9266
+ return new PivotCtor(UserCtor);
9267
+ };
9268
+
9269
+ HTMLElement.prototype = NativeHTMLElement.prototype;
9270
+ /**
9271
+ * Create a new PivotConstructor for the given tagName, which is capable of being constructed
9272
+ * with a UserConstructor defining the behavior. Passing in the UserConstructor here
9273
+ * is a hint that can be used when registering a custom element with the global custom elements
9274
+ * registry for the first time, which provides certain optimizations. It also marks the UserConstructor
9275
+ * as "safe" to be used when passed in to a PivotConstructor.
9276
+ *
9277
+ * @param tagName - element tag name
9278
+ * @param UserCtor - userland custom element constructor
9279
+ * @returns a new custom element constructor
9280
+ */
9281
+
9282
+ return function createPivotConstructor(tagName, UserCtor) {
9283
+ tagName = StringToLowerCase.call(tagName);
9284
+ var PivotCtor = pivotCtorByTag.get(tagName);
9285
+
9286
+ if (isUndefined$1(PivotCtor)) {
9287
+ var definition = getOrCreateDefinitionForConstructor(UserCtor);
9288
+ PivotCtor = createPivotingClass(tagName, definition); // Register a pivoting class as a global custom element
9289
+
9290
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
9291
+ definition.PivotCtor = PivotCtor; // Only cache after nativeDefine has been called, because if it throws an error
9292
+ // (e.g. for an invalid tag name), then we don't want to cache anything.
9293
+
9294
+ definitionForConstructor.set(UserCtor, definition);
9295
+ pivotCtorByTag.set(tagName, PivotCtor);
9296
+ } // Register a UserConstructor as "safe" to be used within a PivotConstructor
9297
+
9298
+
9299
+ registeredUserCtors.add(UserCtor);
9300
+ return PivotCtor;
9301
+ };
9302
+ }
9303
+ /*
9304
+ * Copyright (c) 2018, salesforce.com, inc.
9305
+ * All rights reserved.
9306
+ * SPDX-License-Identifier: MIT
9307
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9308
+ */
9309
+
9310
+
9311
+ var createScopedConstructor;
9312
+ var CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
9313
+ // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
9314
+ // or we're in a legacy browser.
9315
+
9316
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
9317
+ if (hasCustomElements) {
9318
+ // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
9319
+ // It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
9320
+ //
9321
+ // Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
9322
+ //
9323
+ // 1. LWC loads
9324
+ // 2. `const Ctor = class extends HTMLElement {}`
9325
+ // 3. `lwc.createElement(...)` // here we lazily patch
9326
+ // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
9327
+ //
9328
+ // To reduce the risk of this, it's safer to patch the registry eagerly.
9329
+ createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
9330
+ // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
9331
+ // because the HTMLElement prototypes are mixed up.
9332
+ //
9333
+ // The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
9334
+ // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
9335
+ // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
9336
+ // Caching avoids this problem.
9337
+
9338
+ CachedHTMLElement = window.HTMLElement;
9339
+ }
9340
+ } // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
9341
+ // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
9342
+ // multiple times per tag name.
9343
+
9344
+
9345
+ var createUserConstructor = function createUserConstructor(upgradeCallback, _connectedCallback2, _disconnectedCallback2, HTMLElementToExtend) {
9346
+ // TODO [#2972]: this class should expose observedAttributes as necessary
9347
+ return /*#__PURE__*/function (_HTMLElementToExtend) {
9348
+ _inherits(UserConstructor, _HTMLElementToExtend);
9349
+
9350
+ var _super9 = _createSuper(UserConstructor);
9351
+
9352
+ function UserConstructor() {
9353
+ var _this7;
9354
+
9355
+ _classCallCheck(this, UserConstructor);
9356
+
9357
+ _this7 = _super9.call(this);
9358
+ upgradeCallback(_assertThisInitialized(_this7));
9359
+ return _this7;
9360
+ }
9361
+
9362
+ _createClass(UserConstructor, [{
9363
+ key: "connectedCallback",
9364
+ value: function connectedCallback() {
9365
+ _connectedCallback2(this);
9366
+ }
9367
+ }, {
9368
+ key: "disconnectedCallback",
9369
+ value: function disconnectedCallback() {
9370
+ _disconnectedCallback2(this);
9371
+ }
9372
+ }]);
9373
+
9374
+ return UserConstructor;
9375
+ }(HTMLElementToExtend);
9376
+ };
9377
+
9378
+ function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
9379
+ if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
9380
+ // This error should be impossible to hit
9381
+ throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
9382
+ }
9383
+
9384
+ var UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
9385
+ var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
9386
+ return new ScopedConstructor(UserConstructor);
9387
+ }
9388
+ /*
9389
+ * Copyright (c) 2018, salesforce.com, inc.
9390
+ * All rights reserved.
9391
+ * SPDX-License-Identifier: MIT
9392
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9393
+ */
9394
+
9395
+ /**
9396
+ * We have three modes for creating custom elements:
9397
+ *
9398
+ * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
9399
+ * 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
9400
+ * same tag name, via a simple trick: every custom element constructor we define in the registry is basically
9401
+ * the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
9402
+ * constructor, which allows us to have completely customized functionality for different components.
9403
+ * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
9404
+ * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
9405
+ * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
9406
+ * because it must patch the global `customElements` and `HTMLElement` objects.
9407
+ */
9408
+
9409
+
9410
+ var createCustomElement;
9411
+
9412
+ if (hasCustomElements) {
9413
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
9414
+ createCustomElement = createCustomElementScoped;
9415
+ } else {
9416
+ // use global custom elements registry (vanilla)
9417
+ createCustomElement = createCustomElementVanilla;
9418
+ }
9419
+ } else {
9420
+ // no registry available here
9421
+ createCustomElement = createCustomElementCompat;
9422
+ }
8717
9423
  /*
8718
9424
  * Copyright (c) 2018, salesforce.com, inc.
8719
9425
  * All rights reserved.
@@ -8782,7 +9488,7 @@
8782
9488
  function isNull(obj) {
8783
9489
  return obj === null;
8784
9490
  }
8785
- /** version: 2.25.1 */
9491
+ /** version: 2.26.0 */
8786
9492
 
8787
9493
  /*
8788
9494
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8792,87 +9498,6 @@
8792
9498
  */
8793
9499
 
8794
9500
 
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
9501
  function cloneNode(node, deep) {
8877
9502
  return node.cloneNode(deep);
8878
9503
  }
@@ -8931,18 +9556,18 @@
8931
9556
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8932
9557
 
8933
9558
  if (!isUndefined(wrapperTags)) {
8934
- var _iterator6 = _createForOfIteratorHelper(wrapperTags),
8935
- _step6;
9559
+ var _iterator7 = _createForOfIteratorHelper(wrapperTags),
9560
+ _step7;
8936
9561
 
8937
9562
  try {
8938
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
8939
- var wrapperTag = _step6.value;
9563
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
9564
+ var wrapperTag = _step7.value;
8940
9565
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8941
9566
  }
8942
9567
  } catch (err) {
8943
- _iterator6.e(err);
9568
+ _iterator7.e(err);
8944
9569
  } finally {
8945
- _iterator6.f();
9570
+ _iterator7.f();
8946
9571
  }
8947
9572
  } // For IE11, the document title must not be undefined, but it can be an empty string
8948
9573
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
@@ -9088,8 +9713,6 @@
9088
9713
  assert.invariant(elm instanceof HTMLElement, msg);
9089
9714
  }
9090
9715
 
9091
- var HTMLElementExported = HTMLElementConstructor;
9092
- exports.HTMLElementExported = HTMLElementExported;
9093
9716
  exports.addEventListener = addEventListener;
9094
9717
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
9095
9718
  exports.attachShadow = attachShadow;
@@ -9148,6 +9771,8 @@
9148
9771
  {
9149
9772
  // insertStyleSheet implementation shares a global cache of stylesheet data
9150
9773
  insertStylesheet: insertStylesheet,
9774
+ // relies on a shared global cache
9775
+ createCustomElement: createCustomElement,
9151
9776
  isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
9152
9777
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
9153
9778
  });
@@ -9268,35 +9893,39 @@
9268
9893
  var hydratedCustomElements = new WeakSet();
9269
9894
 
9270
9895
  function buildCustomElementConstructor(Ctor) {
9896
+ var _a;
9897
+
9271
9898
  var HtmlPrototype = getComponentHtmlPrototype(Ctor);
9272
- return /*#__PURE__*/function (_HtmlPrototype) {
9273
- _inherits(_class, _HtmlPrototype);
9899
+ var observedAttributes = HtmlPrototype.observedAttributes;
9900
+ var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
9901
+ return _a = /*#__PURE__*/function (_HTMLElement2) {
9902
+ _inherits(_a, _HTMLElement2);
9274
9903
 
9275
- var _super8 = _createSuper(_class);
9904
+ var _super10 = _createSuper(_a);
9276
9905
 
9277
- function _class() {
9278
- var _this6;
9906
+ function _a() {
9907
+ var _this8;
9279
9908
 
9280
- _classCallCheck(this, _class);
9909
+ _classCallCheck(this, _a);
9281
9910
 
9282
- _this6 = _super8.call(this);
9911
+ _this8 = _super10.call(this);
9283
9912
 
9284
- if (_this6.isConnected) {
9913
+ if (_this8.isConnected) {
9285
9914
  // 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));
9915
+ hydrateComponent(_assertThisInitialized(_this8), Ctor, {});
9916
+ hydratedCustomElements.add(_assertThisInitialized(_this8));
9288
9917
  } else {
9289
- createVM(_assertThisInitialized(_this6), Ctor, renderer, {
9918
+ createVM(_assertThisInitialized(_this8), Ctor, renderer, {
9290
9919
  mode: 'open',
9291
9920
  owner: null,
9292
- tagName: _this6.tagName
9921
+ tagName: _this8.tagName
9293
9922
  });
9294
9923
  }
9295
9924
 
9296
- return _this6;
9925
+ return _this8;
9297
9926
  }
9298
9927
 
9299
- _createClass(_class, [{
9928
+ _createClass(_a, [{
9300
9929
  key: "connectedCallback",
9301
9930
  value: function connectedCallback() {
9302
9931
  if (hydratedCustomElements.has(this)) {
@@ -9311,10 +9940,15 @@
9311
9940
  value: function disconnectedCallback() {
9312
9941
  disconnectRootElement(this);
9313
9942
  }
9943
+ }, {
9944
+ key: "attributeChangedCallback",
9945
+ value: function attributeChangedCallback(name, oldValue, newValue) {
9946
+ _attributeChangedCallback.call(this, name, oldValue, newValue);
9947
+ }
9314
9948
  }]);
9315
9949
 
9316
- return _class;
9317
- }(HtmlPrototype);
9950
+ return _a;
9951
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)), _a.observedAttributes = observedAttributes, _a;
9318
9952
  }
9319
9953
  /*
9320
9954
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9400,8 +10034,11 @@
9400
10034
  throw new TypeError("\"createElement\" function expects an \"is\" option with a valid component constructor.");
9401
10035
  }
9402
10036
 
9403
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
9404
- var wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
10037
+ var createCustomElement = renderer.createCustomElement; // tagName must be all lowercase, unfortunately, we have legacy code that is
10038
+ // passing `sel` as a camel-case, which makes them invalid custom elements name
10039
+ // the following line guarantees that this does not leaks beyond this point.
10040
+
10041
+ var tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
9405
10042
 
9406
10043
  /**
9407
10044
  * Note: if the upgradable constructor does not expect, or throw when we new it
@@ -9410,9 +10047,9 @@
9410
10047
  * an upgradable custom element.
9411
10048
  */
9412
10049
 
9413
- var element = new UpgradableConstructor(function (elm) {
10050
+ var upgradeCallback = function upgradeCallback(elm) {
9414
10051
  createVM(elm, Ctor, renderer, {
9415
- tagName: sel,
10052
+ tagName: tagName,
9416
10053
  mode: options.mode !== 'closed' ? 'open' : 'closed',
9417
10054
  owner: null
9418
10055
  });
@@ -9421,15 +10058,21 @@
9421
10058
  ConnectingSlot.set(elm, connectRootElement);
9422
10059
  DisconnectingSlot.set(elm, disconnectRootElement);
9423
10060
  }
10061
+ };
9424
10062
 
9425
- wasComponentUpgraded = true;
9426
- });
10063
+ var connectedCallback = function connectedCallback(elm) {
10064
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
10065
+ connectRootElement(elm);
10066
+ }
10067
+ };
9427
10068
 
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
- }
10069
+ var disconnectedCallback = function disconnectedCallback(elm) {
10070
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
10071
+ disconnectRootElement(elm);
10072
+ }
10073
+ };
9432
10074
 
10075
+ var element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
9433
10076
  return element;
9434
10077
  }
9435
10078
  /*
@@ -9512,7 +10155,7 @@
9512
10155
  });
9513
10156
  freeze(LightningElement);
9514
10157
  seal(LightningElement.prototype);
9515
- /* version: 2.25.1 */
10158
+ /* version: 2.26.0 */
9516
10159
 
9517
10160
  exports.LightningElement = LightningElement;
9518
10161
  exports.__unstable__ProfilerControl = profilerControl;