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