lwc 2.38.0 → 2.39.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 (64) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +223 -129
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +223 -129
  4. package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
  5. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  6. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +174 -47
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +371 -214
  9. package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
  10. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  11. package/dist/engine-dom/iife/es5/engine-dom_debug.js +323 -160
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +223 -129
  14. package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
  15. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  16. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +174 -47
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +371 -214
  19. package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
  20. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  21. package/dist/engine-dom/umd/es5/engine-dom_debug.js +323 -160
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  23. package/dist/engine-server/commonjs/es2017/engine-server.js +188 -82
  24. package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
  25. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  26. package/dist/engine-server/esm/es2017/engine-server.js +188 -82
  27. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
  28. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  29. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
  30. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  31. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
  32. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  33. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
  34. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  37. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
  38. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  39. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
  40. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  41. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
  42. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  43. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
  44. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  45. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
  46. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  47. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
  48. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  49. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
  50. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  51. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
  52. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  53. package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
  54. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  55. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
  56. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  57. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
  58. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  59. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
  60. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  61. package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
  62. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  63. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
  64. package/package.json +7 -7
@@ -348,9 +348,9 @@ var LWC = (function (exports) {
348
348
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
349
349
  */
350
350
  // Increment whenever the LWC template compiler changes
351
- var LWC_VERSION = "2.38.0";
351
+ var LWC_VERSION = "2.39.0";
352
352
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
353
- /** version: 2.38.0 */
353
+ /** version: 2.39.0 */
354
354
 
355
355
  /**
356
356
  * Copyright (C) 2018 salesforce.com, inc.
@@ -431,7 +431,7 @@ var LWC = (function (exports) {
431
431
  setFeatureFlag(name, value);
432
432
  }
433
433
  }
434
- /** version: 2.38.0 */
434
+ /** version: 2.39.0 */
435
435
 
436
436
  /**
437
437
  * Copyright (C) 2018 salesforce.com, inc.
@@ -495,7 +495,7 @@ var LWC = (function (exports) {
495
495
  }
496
496
  }
497
497
  }
498
- /** version: 2.38.0 */
498
+ /** version: 2.39.0 */
499
499
 
500
500
  /*
501
501
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3443,6 +3443,123 @@ var LWC = (function (exports) {
3443
3443
  freeze(BaseBridgeElement);
3444
3444
  seal(BaseBridgeElement.prototype);
3445
3445
 
3446
+ /*
3447
+ * Copyright (c) 2023, salesforce.com, inc.
3448
+ * All rights reserved.
3449
+ * SPDX-License-Identifier: MIT
3450
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3451
+ */
3452
+ var supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
3453
+ // In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
3454
+ var LegacyWeakMultiMap = /*#__PURE__*/function () {
3455
+ function LegacyWeakMultiMap() {
3456
+ _classCallCheck(this, LegacyWeakMultiMap);
3457
+ this._map = new WeakMap();
3458
+ }
3459
+ _createClass(LegacyWeakMultiMap, [{
3460
+ key: "_getValues",
3461
+ value: function _getValues(key) {
3462
+ var values = this._map.get(key);
3463
+ if (isUndefined$1(values)) {
3464
+ values = new Set();
3465
+ this._map.set(key, values);
3466
+ }
3467
+ return values;
3468
+ }
3469
+ }, {
3470
+ key: "get",
3471
+ value: function get(key) {
3472
+ return this._getValues(key);
3473
+ }
3474
+ }, {
3475
+ key: "add",
3476
+ value: function add(key, vm) {
3477
+ var set = this._getValues(key);
3478
+ set.add(vm);
3479
+ }
3480
+ }, {
3481
+ key: "delete",
3482
+ value: function _delete(key) {
3483
+ this._map.delete(key);
3484
+ }
3485
+ }]);
3486
+ return LegacyWeakMultiMap;
3487
+ }(); // This implementation relies on the WeakRef/FinalizationRegistry proposal.
3488
+ // For some background, see: https://github.com/tc39/proposal-weakrefs
3489
+ var ModernWeakMultiMap = /*#__PURE__*/function () {
3490
+ function ModernWeakMultiMap() {
3491
+ _classCallCheck(this, ModernWeakMultiMap);
3492
+ this._map = new WeakMap();
3493
+ this._registry = new FinalizationRegistry(function (weakRefs) {
3494
+ // This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
3495
+ // JS VMs are not obligated to call FinalizationRegistry callbacks.
3496
+ // Work backwards, removing stale VMs
3497
+ for (var _i13 = weakRefs.length - 1; _i13 >= 0; _i13--) {
3498
+ var vm = weakRefs[_i13].deref();
3499
+ if (isUndefined$1(vm)) {
3500
+ ArraySplice.call(weakRefs, _i13, 1); // remove
3501
+ }
3502
+ }
3503
+ });
3504
+ }
3505
+ _createClass(ModernWeakMultiMap, [{
3506
+ key: "_getWeakRefs",
3507
+ value: function _getWeakRefs(key) {
3508
+ var weakRefs = this._map.get(key);
3509
+ if (isUndefined$1(weakRefs)) {
3510
+ weakRefs = [];
3511
+ this._map.set(key, weakRefs);
3512
+ }
3513
+ return weakRefs;
3514
+ }
3515
+ }, {
3516
+ key: "get",
3517
+ value: function get(key) {
3518
+ var weakRefs = this._getWeakRefs(key);
3519
+ var result = new Set();
3520
+ var _iterator5 = _createForOfIteratorHelper(weakRefs),
3521
+ _step5;
3522
+ try {
3523
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3524
+ var weakRef = _step5.value;
3525
+ var vm = weakRef.deref();
3526
+ if (!isUndefined$1(vm)) {
3527
+ result.add(vm);
3528
+ }
3529
+ }
3530
+ } catch (err) {
3531
+ _iterator5.e(err);
3532
+ } finally {
3533
+ _iterator5.f();
3534
+ }
3535
+ return result;
3536
+ }
3537
+ }, {
3538
+ key: "add",
3539
+ value: function add(key, value) {
3540
+ var weakRefs = this._getWeakRefs(key);
3541
+ // We could check for duplicate values here, but it doesn't seem worth it.
3542
+ // We transform the output into a Set anyway
3543
+ ArrayPush$1.call(weakRefs, new WeakRef(value));
3544
+ // It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
3545
+ // effectively creates a strong reference between the first argument (the "target") and the held value. When
3546
+ // the target is GC'ed, the callback is called, and then the held value is GC'ed.
3547
+ // Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
3548
+ // of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
3549
+ // to anything. See also this example:
3550
+ // https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
3551
+ this._registry.register(value, weakRefs);
3552
+ }
3553
+ }, {
3554
+ key: "delete",
3555
+ value: function _delete(key) {
3556
+ this._map.delete(key);
3557
+ }
3558
+ }]);
3559
+ return ModernWeakMultiMap;
3560
+ }();
3561
+ var WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
3562
+
3446
3563
  /*
3447
3564
  * Copyright (c) 2020, salesforce.com, inc.
3448
3565
  * All rights reserved.
@@ -3452,46 +3569,65 @@ var LWC = (function (exports) {
3452
3569
  var swappedTemplateMap = new WeakMap();
3453
3570
  var swappedComponentMap = new WeakMap();
3454
3571
  var swappedStyleMap = new WeakMap();
3455
- var activeTemplates = new WeakMap();
3456
- var activeComponents = new WeakMap();
3457
- var activeStyles = new WeakMap();
3572
+ // The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
3573
+ // so we don't want to create strong references to them.
3574
+ // The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
3575
+ // never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
3576
+ var activeTemplates = new WeakMultiMap();
3577
+ var activeComponents = new WeakMultiMap();
3578
+ var activeStyles = new WeakMultiMap();
3458
3579
  function rehydrateHotTemplate(tpl) {
3459
3580
  var list = activeTemplates.get(tpl);
3460
- if (!isUndefined$1(list)) {
3461
- list.forEach(function (vm) {
3581
+ var _iterator6 = _createForOfIteratorHelper(list),
3582
+ _step6;
3583
+ try {
3584
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
3585
+ var vm = _step6.value;
3462
3586
  if (isFalse(vm.isDirty)) {
3463
3587
  // forcing the vm to rehydrate in the micro-task:
3464
3588
  markComponentAsDirty(vm);
3465
3589
  scheduleRehydration(vm);
3466
3590
  }
3467
- });
3468
- // resetting the Set to release the memory of those vm references
3469
- // since they are not longer related to this template, instead
3591
+ }
3592
+ // Resetting the Set since these VMs are no longer related to this template, instead
3470
3593
  // they will get re-associated once these instances are rehydrated.
3471
- list.clear();
3594
+ } catch (err) {
3595
+ _iterator6.e(err);
3596
+ } finally {
3597
+ _iterator6.f();
3472
3598
  }
3599
+ activeTemplates.delete(tpl);
3473
3600
  return true;
3474
3601
  }
3475
3602
  function rehydrateHotStyle(style) {
3476
3603
  var list = activeStyles.get(style);
3477
- if (!isUndefined$1(list)) {
3478
- list.forEach(function (vm) {
3604
+ var _iterator7 = _createForOfIteratorHelper(list),
3605
+ _step7;
3606
+ try {
3607
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
3608
+ var vm = _step7.value;
3479
3609
  // if a style definition is swapped, we must reset
3480
3610
  // vm's template content in the next micro-task:
3481
3611
  forceRehydration(vm);
3482
- });
3483
- // resetting the Set to release the memory of those vm references
3484
- // since they are not longer related to this style, instead
3612
+ }
3613
+ // Resetting the Set since these VMs are no longer related to this style, instead
3485
3614
  // they will get re-associated once these instances are rehydrated.
3486
- list.clear();
3615
+ } catch (err) {
3616
+ _iterator7.e(err);
3617
+ } finally {
3618
+ _iterator7.f();
3487
3619
  }
3620
+ activeStyles.delete(style);
3488
3621
  return true;
3489
3622
  }
3490
3623
  function rehydrateHotComponent(Ctor) {
3491
3624
  var list = activeComponents.get(Ctor);
3492
3625
  var canRefreshAllInstances = true;
3493
- if (!isUndefined$1(list)) {
3494
- list.forEach(function (vm) {
3626
+ var _iterator8 = _createForOfIteratorHelper(list),
3627
+ _step8;
3628
+ try {
3629
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
3630
+ var vm = _step8.value;
3495
3631
  var owner = vm.owner;
3496
3632
  if (!isNull(owner)) {
3497
3633
  // if a component class definition is swapped, we must reset
@@ -3506,12 +3642,15 @@ var LWC = (function (exports) {
3506
3642
  // for example: reload the entire page.
3507
3643
  canRefreshAllInstances = false;
3508
3644
  }
3509
- });
3510
- // resetting the Set to release the memory of those vm references
3511
- // since they are not longer related to this constructor, instead
3645
+ }
3646
+ // resetting the Set since these VMs are no longer related to this constructor, instead
3512
3647
  // they will get re-associated once these instances are rehydrated.
3513
- list.clear();
3648
+ } catch (err) {
3649
+ _iterator8.e(err);
3650
+ } finally {
3651
+ _iterator8.f();
3514
3652
  }
3653
+ activeComponents.delete(Ctor);
3515
3654
  return canRefreshAllInstances;
3516
3655
  }
3517
3656
  function getTemplateOrSwappedTemplate(tpl) {
@@ -3545,72 +3684,36 @@ var LWC = (function (exports) {
3545
3684
  assertNotProd(); // this method should never leak to prod
3546
3685
  // tracking active component
3547
3686
  var Ctor = vm.def.ctor;
3548
- var componentVMs = activeComponents.get(Ctor);
3549
- if (isUndefined$1(componentVMs)) {
3550
- componentVMs = new Set();
3551
- activeComponents.set(Ctor, componentVMs);
3552
- }
3553
3687
  // this will allow us to keep track of the hot components
3554
- componentVMs.add(vm);
3688
+ activeComponents.add(Ctor, vm);
3555
3689
  // tracking active template
3556
3690
  var tpl = vm.cmpTemplate;
3557
3691
  if (tpl) {
3558
- var templateVMs = activeTemplates.get(tpl);
3559
- if (isUndefined$1(templateVMs)) {
3560
- templateVMs = new Set();
3561
- activeTemplates.set(tpl, templateVMs);
3562
- }
3563
3692
  // this will allow us to keep track of the templates that are
3564
3693
  // being used by a hot component
3565
- templateVMs.add(vm);
3694
+ activeTemplates.add(tpl, vm);
3566
3695
  // tracking active styles associated to template
3567
3696
  var stylesheets = tpl.stylesheets;
3568
3697
  if (!isUndefined$1(stylesheets)) {
3569
- flattenStylesheets(stylesheets).forEach(function (stylesheet) {
3570
- // this is necessary because we don't hold the list of styles
3571
- // in the vm, we only hold the selected (already swapped template)
3572
- // but the styles attached to the template might not be the actual
3573
- // active ones, but the swapped versions of those.
3574
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3575
- var stylesheetVMs = activeStyles.get(stylesheet);
3576
- if (isUndefined$1(stylesheetVMs)) {
3577
- stylesheetVMs = new Set();
3578
- activeStyles.set(stylesheet, stylesheetVMs);
3579
- }
3580
- // this will allow us to keep track of the stylesheet that are
3581
- // being used by a hot component
3582
- stylesheetVMs.add(vm);
3583
- });
3584
- }
3585
- }
3586
- }
3587
- function removeActiveVM(vm) {
3588
- assertNotProd(); // this method should never leak to prod
3589
- // tracking inactive component
3590
- var Ctor = vm.def.ctor;
3591
- var list = activeComponents.get(Ctor);
3592
- if (!isUndefined$1(list)) {
3593
- // deleting the vm from the set to avoid leaking memory
3594
- list.delete(vm);
3595
- }
3596
- // removing inactive template
3597
- var tpl = vm.cmpTemplate;
3598
- if (tpl) {
3599
- list = activeTemplates.get(tpl);
3600
- if (!isUndefined$1(list)) {
3601
- // deleting the vm from the set to avoid leaking memory
3602
- list.delete(vm);
3603
- }
3604
- // removing active styles associated to template
3605
- var styles = tpl.stylesheets;
3606
- if (!isUndefined$1(styles)) {
3607
- flattenStylesheets(styles).forEach(function (style) {
3608
- list = activeStyles.get(style);
3609
- if (!isUndefined$1(list)) {
3610
- // deleting the vm from the set to avoid leaking memory
3611
- list.delete(vm);
3698
+ var _iterator9 = _createForOfIteratorHelper(flattenStylesheets(stylesheets)),
3699
+ _step9;
3700
+ try {
3701
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
3702
+ var stylesheet = _step9.value;
3703
+ // this is necessary because we don't hold the list of styles
3704
+ // in the vm, we only hold the selected (already swapped template)
3705
+ // but the styles attached to the template might not be the actual
3706
+ // active ones, but the swapped versions of those.
3707
+ var swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
3708
+ // this will allow us to keep track of the stylesheet that are
3709
+ // being used by a hot component
3710
+ activeStyles.add(swappedStylesheet, vm);
3612
3711
  }
3613
- });
3712
+ } catch (err) {
3713
+ _iterator9.e(err);
3714
+ } finally {
3715
+ _iterator9.f();
3716
+ }
3614
3717
  }
3615
3718
  }
3616
3719
  }
@@ -3930,8 +4033,8 @@ var LWC = (function (exports) {
3930
4033
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3931
4034
  var content = [];
3932
4035
  var root;
3933
- for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
3934
- var stylesheet = stylesheets[_i13];
4036
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4037
+ var stylesheet = stylesheets[_i14];
3935
4038
  if (isArray$1(stylesheet)) {
3936
4039
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3937
4040
  } else {
@@ -4037,8 +4140,8 @@ var LWC = (function (exports) {
4037
4140
  shadowMode = vm.shadowMode,
4038
4141
  insertStylesheet = vm.renderer.insertStylesheet;
4039
4142
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
4040
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4041
- insertStylesheet(stylesheets[_i14]);
4143
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4144
+ insertStylesheet(stylesheets[_i15]);
4042
4145
  }
4043
4146
  } else if (vm.hydrated) {
4044
4147
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
@@ -4051,8 +4154,8 @@ var LWC = (function (exports) {
4051
4154
  var root = getNearestNativeShadowComponent(vm);
4052
4155
  // null root means a global style
4053
4156
  var target = isNull(root) ? undefined : root.shadowRoot;
4054
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4055
- insertStylesheet(stylesheets[_i15], target);
4157
+ for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4158
+ insertStylesheet(stylesheets[_i16], target);
4056
4159
  }
4057
4160
  }
4058
4161
  return null;
@@ -4366,8 +4469,8 @@ var LWC = (function (exports) {
4366
4469
  return;
4367
4470
  }
4368
4471
  var setCSSStyleProperty = renderer.setCSSStyleProperty;
4369
- for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
4370
- var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
4472
+ for (var _i17 = 0; _i17 < styleDecls.length; _i17++) {
4473
+ var _styleDecls$_i = _slicedToArray(styleDecls[_i17], 3),
4371
4474
  prop = _styleDecls$_i[0],
4372
4475
  value = _styleDecls$_i[1],
4373
4476
  important = _styleDecls$_i[2];
@@ -4394,7 +4497,12 @@ var LWC = (function (exports) {
4394
4497
  return;
4395
4498
  }
4396
4499
  if (process.env.NODE_ENV !== 'production') {
4397
- if (!isSameVnode(n1, n2)) {
4500
+ if (!isSameVnode(n1, n2) &&
4501
+ // Currently the only scenario when patch does not receive the same vnodes are for
4502
+ // dynamic components. When a dynamic component's constructor changes, the value of its
4503
+ // tag name (sel) will be different. The engine will unmount the previous element
4504
+ // and mount the new one using the new constructor in patchCustomElement.
4505
+ !(isVCustomElement(n1) && isVCustomElement(n2))) {
4398
4506
  throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
4399
4507
  sel: n1.sel,
4400
4508
  key: n1.key
@@ -4595,8 +4703,9 @@ var LWC = (function (exports) {
4595
4703
  }
4596
4704
  }
4597
4705
  function patchCustomElement(n1, n2, parent, renderer) {
4706
+ // TODO [#3331]: This if branch should be removed in 246 with lwc:dynamic
4598
4707
  if (n1.ctor !== n2.ctor) {
4599
- // If the constructor, unmount the current component and mount a new one using the new
4708
+ // If the constructor differs, unmount the current component and mount a new one using the new
4600
4709
  // constructor.
4601
4710
  var anchor = renderer.nextSibling(n1.elm);
4602
4711
  unmount(n1, parent, renderer, true);
@@ -4849,8 +4958,8 @@ var LWC = (function (exports) {
4849
4958
  // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
4850
4959
  var nodeStack = [];
4851
4960
  var fragmentFound = false;
4852
- for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
4853
- var child = children[_i17];
4961
+ for (var _i18 = children.length - 1; _i18 > -1; _i18 -= 1) {
4962
+ var child = children[_i18];
4854
4963
  ArrayPush$1.call(nodeStack, child);
4855
4964
  fragmentFound = fragmentFound || !!(child && isVFragment(child));
4856
4965
  }
@@ -4862,8 +4971,8 @@ var LWC = (function (exports) {
4862
4971
  if (!isNull(currentNode) && isVFragment(currentNode)) {
4863
4972
  var fChildren = currentNode.children;
4864
4973
  // Ignore the start and end text node delimiters
4865
- for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
4866
- ArrayPush$1.call(nodeStack, fChildren[_i18]);
4974
+ for (var _i19 = fChildren.length - 2; _i19 > 0; _i19 -= 1) {
4975
+ ArrayPush$1.call(nodeStack, fChildren[_i19]);
4867
4976
  }
4868
4977
  } else {
4869
4978
  ArrayPush$1.call(flattenedChildren, currentNode);
@@ -4902,8 +5011,8 @@ var LWC = (function (exports) {
4902
5011
  var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4903
5012
  var cmpSlotsMapping = create(null);
4904
5013
  // Collect all slots into cmpSlotsMapping
4905
- for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
4906
- var vnode = children[_i19];
5014
+ for (var _i20 = 0, len = children.length; _i20 < len; _i20 += 1) {
5015
+ var vnode = children[_i20];
4907
5016
  if (isNull(vnode)) {
4908
5017
  continue;
4909
5018
  }
@@ -4933,8 +5042,8 @@ var LWC = (function (exports) {
4933
5042
  markComponentAsDirty(vm);
4934
5043
  return;
4935
5044
  }
4936
- for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
4937
- var key = oldKeys[_i20];
5045
+ for (var _i21 = 0, _len2 = oldKeys.length; _i21 < _len2; _i21 += 1) {
5046
+ var key = oldKeys[_i21];
4938
5047
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4939
5048
  markComponentAsDirty(vm);
4940
5049
  return;
@@ -5057,11 +5166,11 @@ var LWC = (function (exports) {
5057
5166
  if (oldStartIdx > oldEndIdx) {
5058
5167
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
5059
5168
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
5060
- var _i21 = newEndIdx;
5169
+ var _i22 = newEndIdx;
5061
5170
  var n;
5062
5171
  do {
5063
- n = newCh[++_i21];
5064
- } while (!isVNode(n) && _i21 < newChEnd);
5172
+ n = newCh[++_i22];
5173
+ } while (!isVNode(n) && _i22 < newChEnd);
5065
5174
  before = isVNode(n) ? n.elm : null;
5066
5175
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
5067
5176
  } else {
@@ -5086,15 +5195,22 @@ var LWC = (function (exports) {
5086
5195
  // if the old list is not empty, the new list MUST have the same
5087
5196
  // amount of nodes, that's why we call this static children
5088
5197
  var anchor = null;
5089
- for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
5090
- var n1 = c1[_i22];
5091
- var n2 = c2[_i22];
5198
+ for (var _i23 = c2Length - 1; _i23 >= 0; _i23 -= 1) {
5199
+ var n1 = c1[_i23];
5200
+ var n2 = c2[_i23];
5092
5201
  if (n2 !== n1) {
5093
5202
  if (isVNode(n1)) {
5094
5203
  if (isVNode(n2)) {
5095
- // both vnodes are equivalent, and we just need to patch them
5096
- patch(n1, n2, parent, renderer);
5097
- anchor = n2.elm;
5204
+ if (isSameVnode(n1, n2)) {
5205
+ // both vnodes are equivalent, and we just need to patch them
5206
+ patch(n1, n2, parent, renderer);
5207
+ anchor = n2.elm;
5208
+ } else {
5209
+ // removing the old vnode since the new one is different
5210
+ unmount(n1, parent, renderer, true);
5211
+ mount(n2, parent, renderer, anchor);
5212
+ anchor = n2.elm;
5213
+ }
5098
5214
  } else {
5099
5215
  // removing the old vnode since the new one is null
5100
5216
  unmount(n1, parent, renderer, true);
@@ -5213,8 +5329,8 @@ var LWC = (function (exports) {
5213
5329
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
5214
5330
  var newChildren = [];
5215
5331
  var slotAssignments = slotset.slotAssignments[slotName];
5216
- for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
5217
- var vnode = slotAssignments[_i23];
5332
+ for (var _i24 = 0; _i24 < slotAssignments.length; _i24++) {
5333
+ var vnode = slotAssignments[_i24];
5218
5334
  if (!isNull(vnode)) {
5219
5335
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
5220
5336
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -5491,9 +5607,11 @@ var LWC = (function (exports) {
5491
5607
  return url;
5492
5608
  }
5493
5609
  /**
5494
- * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5610
+ * [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5611
+ *
5612
+ * TODO [#3331]: remove usage of lwc:dynamic in 246
5495
5613
  */
5496
- function dc(sel, Ctor, data) {
5614
+ function ddc(sel, Ctor, data) {
5497
5615
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5498
5616
  if (process.env.NODE_ENV !== 'production') {
5499
5617
  assert.isTrue(isString(sel), "dc() 1st argument sel must be a string.");
@@ -5501,7 +5619,7 @@ var LWC = (function (exports) {
5501
5619
  assert.isTrue(arguments.length === 3 || isArray$1(children), "dc() 4nd argument data must be an array.");
5502
5620
  }
5503
5621
  // null or undefined values should produce a null value in the VNodes
5504
- if (Ctor == null) {
5622
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5505
5623
  return null;
5506
5624
  }
5507
5625
  if (!isComponentConstructor(Ctor)) {
@@ -5509,6 +5627,31 @@ var LWC = (function (exports) {
5509
5627
  }
5510
5628
  return c(sel, Ctor, data, children);
5511
5629
  }
5630
+ /**
5631
+ * [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
5632
+ */
5633
+ function dc(Ctor, data) {
5634
+ var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyArray;
5635
+ if (process.env.NODE_ENV !== 'production') {
5636
+ assert.isTrue(isObject(data), "dc() 2nd argument data must be an object.");
5637
+ assert.isTrue(arguments.length === 3 || isArray$1(children), "dc() 3rd argument data must be an array.");
5638
+ }
5639
+ // Null or undefined values should produce a null value in the VNodes.
5640
+ // This is the only value at compile time as the constructor will not be known.
5641
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5642
+ return null;
5643
+ }
5644
+ if (!isComponentConstructor(Ctor)) {
5645
+ throw new Error("Invalid constructor ".concat(toString$1(Ctor), " is not a LightningElement constructor."));
5646
+ }
5647
+ // Look up the dynamic component's name at runtime once the constructor is available.
5648
+ // This information is only known at runtime and is stored as part of registerComponent.
5649
+ var sel = getComponentRegisteredName(Ctor);
5650
+ if (isUndefined$1(sel) || sel === '') {
5651
+ throw new Error("Invalid LWC constructor ".concat(toString$1(Ctor), " does not have a registered name"));
5652
+ }
5653
+ return c(sel, Ctor, data, children);
5654
+ }
5512
5655
  /**
5513
5656
  * slow children collection marking mechanism. this API allows the compiler to signal
5514
5657
  * to the engine that a particular collection of children must be diffed using the slow
@@ -5570,7 +5713,8 @@ var LWC = (function (exports) {
5570
5713
  gid: gid,
5571
5714
  fid: fid,
5572
5715
  shc: shc,
5573
- ssf: ssf
5716
+ ssf: ssf,
5717
+ ddc: ddc
5574
5718
  });
5575
5719
 
5576
5720
  /*
@@ -5736,23 +5880,23 @@ var LWC = (function (exports) {
5736
5880
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
5737
5881
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
5738
5882
  var htmlFragment = '';
5739
- for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
5740
- switch (keys[_i24]) {
5883
+ for (var _i25 = 0, n = keys.length; _i25 < n; _i25++) {
5884
+ switch (keys[_i25]) {
5741
5885
  case 0:
5742
5886
  // styleToken in existing class attr
5743
- htmlFragment += strings[_i24] + classToken;
5887
+ htmlFragment += strings[_i25] + classToken;
5744
5888
  break;
5745
5889
  case 1:
5746
5890
  // styleToken for added class attr
5747
- htmlFragment += strings[_i24] + classAttrToken;
5891
+ htmlFragment += strings[_i25] + classAttrToken;
5748
5892
  break;
5749
5893
  case 2:
5750
5894
  // styleToken as attr
5751
- htmlFragment += strings[_i24] + attrToken;
5895
+ htmlFragment += strings[_i25] + attrToken;
5752
5896
  break;
5753
5897
  case 3:
5754
5898
  // ${1}${2}
5755
- htmlFragment += strings[_i24] + classAttrToken + attrToken;
5899
+ htmlFragment += strings[_i25] + classAttrToken + attrToken;
5756
5900
  break;
5757
5901
  }
5758
5902
  }
@@ -5857,8 +6001,8 @@ var LWC = (function (exports) {
5857
6001
  }
5858
6002
  function computeHasScopedStylesInStylesheets(stylesheets) {
5859
6003
  if (hasStyles(stylesheets)) {
5860
- for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
5861
- if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
6004
+ for (var _i26 = 0; _i26 < stylesheets.length; _i26++) {
6005
+ if (isTrue(stylesheets[_i26][KEY__SCOPED_CSS])) {
5862
6006
  return true;
5863
6007
  }
5864
6008
  }
@@ -5971,29 +6115,34 @@ var LWC = (function (exports) {
5971
6115
  * SPDX-License-Identifier: MIT
5972
6116
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5973
6117
  */
5974
- var signedTemplateMap = new Map();
6118
+ var registeredComponentMap = new Map();
5975
6119
  /**
5976
6120
  * INTERNAL: This function can only be invoked by compiled code. The compiler
5977
6121
  * will prevent this function from being imported by userland code.
5978
6122
  */
5979
6123
  function registerComponent(
5980
6124
  // We typically expect a LightningElementConstructor, but technically you can call this with anything
5981
- Ctor, _ref3) {
5982
- var tmpl = _ref3.tmpl;
6125
+ Ctor, metadata) {
5983
6126
  if (isFunction$1(Ctor)) {
5984
6127
  if (process.env.NODE_ENV !== 'production') {
5985
6128
  // There is no point in running this in production, because the version mismatch check relies
5986
6129
  // on code comments which are stripped out in production by minifiers
5987
6130
  checkVersionMismatch(Ctor, 'component');
5988
6131
  }
5989
- signedTemplateMap.set(Ctor, tmpl);
6132
+ // TODO [#3331]: add validation to check the value of metadata.sel is not an empty string.
6133
+ registeredComponentMap.set(Ctor, metadata);
5990
6134
  }
5991
6135
  // chaining this method as a way to wrap existing assignment of component constructor easily,
5992
6136
  // without too much transformation
5993
6137
  return Ctor;
5994
6138
  }
5995
6139
  function getComponentRegisteredTemplate(Ctor) {
5996
- return signedTemplateMap.get(Ctor);
6140
+ var _a;
6141
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
6142
+ }
6143
+ function getComponentRegisteredName(Ctor) {
6144
+ var _a;
6145
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
5997
6146
  }
5998
6147
  function getTemplateReactiveObserver(vm) {
5999
6148
  return createReactiveObserver(function () {
@@ -6056,8 +6205,8 @@ var LWC = (function (exports) {
6056
6205
  if (process.env.NODE_ENV !== 'production') {
6057
6206
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6058
6207
  }
6059
- for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
6060
- var hookName = hooks[_i26];
6208
+ for (var _i27 = 0; _i27 < hooks.length; ++_i27) {
6209
+ var hookName = hooks[_i27];
6061
6210
  if (hookName in service) {
6062
6211
  var l = Services[hookName];
6063
6212
  if (isUndefined$1(l)) {
@@ -6074,8 +6223,8 @@ var LWC = (function (exports) {
6074
6223
  var component = vm.component,
6075
6224
  def = vm.def,
6076
6225
  context = vm.context;
6077
- for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
6078
- cbs[_i27].call(undefined, component, {}, def, context);
6226
+ for (var _i28 = 0, len = cbs.length; _i28 < len; ++_i28) {
6227
+ cbs[_i28].call(undefined, component, {}, def, context);
6079
6228
  }
6080
6229
  }
6081
6230
 
@@ -6133,9 +6282,6 @@ var LWC = (function (exports) {
6133
6282
  runChildNodesDisconnectedCallback(vm);
6134
6283
  runLightChildNodesDisconnectedCallback(vm);
6135
6284
  }
6136
- if (process.env.NODE_ENV !== 'production') {
6137
- removeActiveVM(vm);
6138
- }
6139
6285
  }
6140
6286
  // this method is triggered by the diffing algo only when a vnode from the
6141
6287
  // old vnode.children is removed from the DOM.
@@ -6229,8 +6375,8 @@ var LWC = (function (exports) {
6229
6375
  var valid = true;
6230
6376
  var validate = function validate(arrayOrStylesheet) {
6231
6377
  if (isArray$1(arrayOrStylesheet)) {
6232
- for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
6233
- validate(arrayOrStylesheet[_i28]);
6378
+ for (var _i29 = 0; _i29 < arrayOrStylesheet.length; _i29++) {
6379
+ validate(arrayOrStylesheet[_i29]);
6234
6380
  }
6235
6381
  } else if (!isFunction$1(arrayOrStylesheet)) {
6236
6382
  // function assumed to be a stylesheet factory
@@ -6398,17 +6544,17 @@ var LWC = (function (exports) {
6398
6544
  return a.idx - b.idx;
6399
6545
  });
6400
6546
  rehydrateQueue = []; // reset to a new queue
6401
- for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
6402
- var vm = vms[_i29];
6547
+ for (var _i30 = 0, len = vms.length; _i30 < len; _i30 += 1) {
6548
+ var vm = vms[_i30];
6403
6549
  try {
6404
6550
  rehydrate(vm);
6405
6551
  } catch (error) {
6406
- if (_i29 + 1 < len) {
6552
+ if (_i30 + 1 < len) {
6407
6553
  // pieces of the queue are still pending to be rehydrated, those should have priority
6408
6554
  if (rehydrateQueue.length === 0) {
6409
6555
  addCallbackToNextTick(flushRehydrationQueue);
6410
6556
  }
6411
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
6557
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i30 + 1));
6412
6558
  }
6413
6559
  // we need to end the measure before throwing.
6414
6560
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -6477,8 +6623,8 @@ var LWC = (function (exports) {
6477
6623
  var vCustomElementCollection = vm.velements;
6478
6624
  // Reporting disconnection for every child in inverse order since they are
6479
6625
  // inserted in reserved order.
6480
- for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
6481
- var elm = vCustomElementCollection[_i30].elm;
6626
+ for (var _i31 = vCustomElementCollection.length - 1; _i31 >= 0; _i31 -= 1) {
6627
+ var elm = vCustomElementCollection[_i31].elm;
6482
6628
  // There are two cases where the element could be undefined:
6483
6629
  // * when there is an error during the construction phase, and an error
6484
6630
  // boundary picks it, there is a possibility that the VCustomElement
@@ -6509,8 +6655,8 @@ var LWC = (function (exports) {
6509
6655
  * defined on its shadow.
6510
6656
  */
6511
6657
  function recursivelyDisconnectChildren(vnodes) {
6512
- for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
6513
- var vnode = vnodes[_i31];
6658
+ for (var _i32 = 0, len = vnodes.length; _i32 < len; _i32 += 1) {
6659
+ var vnode = vnodes[_i32];
6514
6660
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6515
6661
  switch (vnode.type) {
6516
6662
  case 2 /* VNodeType.Element */:
@@ -6531,19 +6677,30 @@ var LWC = (function (exports) {
6531
6677
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
6532
6678
  // children VNodes might not be representing the current state of the DOM.
6533
6679
  function resetComponentRoot(vm) {
6534
- var children = vm.children,
6535
- renderRoot = vm.renderRoot,
6536
- remove = vm.renderer.remove;
6537
- for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
6538
- var child = children[_i32];
6539
- if (!isNull(child) && !isUndefined$1(child.elm)) {
6540
- remove(child.elm, renderRoot);
6541
- }
6542
- }
6680
+ recursivelyRemoveChildren(vm.children, vm);
6543
6681
  vm.children = EmptyArray;
6544
6682
  runChildNodesDisconnectedCallback(vm);
6545
6683
  vm.velements = EmptyArray;
6546
6684
  }
6685
+ // Helper function to remove all children of the root node.
6686
+ // If the set of children includes VFragment nodes, we need to remove the children of those nodes too.
6687
+ // Since VFragments can contain other VFragments, we need to traverse the entire of tree of VFragments.
6688
+ // If the set contains no VFragment nodes, no traversal is needed.
6689
+ function recursivelyRemoveChildren(vnodes, vm) {
6690
+ var renderRoot = vm.renderRoot,
6691
+ remove = vm.renderer.remove;
6692
+ for (var _i33 = 0, len = vnodes.length; _i33 < len; _i33 += 1) {
6693
+ var vnode = vnodes[_i33];
6694
+ if (!isNull(vnode)) {
6695
+ // VFragments are special; their .elm property does not point to the root element since they have no single root.
6696
+ if (isVFragment(vnode)) {
6697
+ recursivelyRemoveChildren(vnode.children, vm);
6698
+ } else if (!isUndefined$1(vnode.elm)) {
6699
+ remove(vnode.elm, renderRoot);
6700
+ }
6701
+ }
6702
+ }
6703
+ }
6547
6704
  function scheduleRehydration(vm) {
6548
6705
  if (isTrue(vm.isScheduled)) {
6549
6706
  return;
@@ -6664,17 +6821,17 @@ var LWC = (function (exports) {
6664
6821
  // if our id is null or empty, nobody can reference us
6665
6822
  return;
6666
6823
  }
6667
- var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6668
- _step5;
6824
+ var _iterator10 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6825
+ _step10;
6669
6826
  try {
6670
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6671
- var idRefAttrName = _step5.value;
6827
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
6828
+ var idRefAttrName = _step10.value;
6672
6829
  // Query all global elements with this attribute. The attribute selector syntax `~=` is for values
6673
6830
  // that reference multiple IDs, separated by whitespace.
6674
6831
  var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
6675
6832
  var sourceElements = querySelectorAll.call(document, query);
6676
- for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
6677
- var sourceElement = sourceElements[_i33];
6833
+ for (var _i34 = 0; _i34 < sourceElements.length; _i34++) {
6834
+ var sourceElement = sourceElements[_i34];
6678
6835
  var sourceRoot = sourceElement.getRootNode();
6679
6836
  if (sourceRoot !== root) {
6680
6837
  reportViolation$1(sourceElement, elm, idRefAttrName);
@@ -6683,18 +6840,18 @@ var LWC = (function (exports) {
6683
6840
  }
6684
6841
  }
6685
6842
  } catch (err) {
6686
- _iterator5.e(err);
6843
+ _iterator10.e(err);
6687
6844
  } finally {
6688
- _iterator5.f();
6845
+ _iterator10.f();
6689
6846
  }
6690
6847
  } else {
6691
6848
  // elm is the source, find the target
6692
6849
  var ids = parseIdRefAttributeValue(attrValue);
6693
- var _iterator6 = _createForOfIteratorHelper(ids),
6694
- _step6;
6850
+ var _iterator11 = _createForOfIteratorHelper(ids),
6851
+ _step11;
6695
6852
  try {
6696
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
6697
- var id = _step6.value;
6853
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
6854
+ var id = _step11.value;
6698
6855
  var target = getElementById.call(document, id);
6699
6856
  if (!isNull(target)) {
6700
6857
  var targetRoot = target.getRootNode();
@@ -6705,9 +6862,9 @@ var LWC = (function (exports) {
6705
6862
  }
6706
6863
  }
6707
6864
  } catch (err) {
6708
- _iterator6.e(err);
6865
+ _iterator11.e(err);
6709
6866
  } finally {
6710
- _iterator6.f();
6867
+ _iterator11.f();
6711
6868
  }
6712
6869
  }
6713
6870
  }
@@ -6837,11 +6994,11 @@ var LWC = (function (exports) {
6837
6994
  function enableDetection() {
6838
6995
  var _Element = Element,
6839
6996
  prototype = _Element.prototype;
6840
- var _iterator7 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
6841
- _step7;
6997
+ var _iterator12 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
6998
+ _step12;
6842
6999
  try {
6843
7000
  var _loop3 = function _loop3() {
6844
- var prop = _step7.value;
7001
+ var prop = _step12.value;
6845
7002
  var descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6846
7003
  // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6847
7004
  // This happens automatically because of the ordering of imports.
@@ -6868,13 +7025,13 @@ var LWC = (function (exports) {
6868
7025
  enumerable: true
6869
7026
  });
6870
7027
  };
6871
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7028
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
6872
7029
  _loop3();
6873
7030
  }
6874
7031
  } catch (err) {
6875
- _iterator7.e(err);
7032
+ _iterator12.e(err);
6876
7033
  } finally {
6877
- _iterator7.f();
7034
+ _iterator12.f();
6878
7035
  }
6879
7036
  }
6880
7037
  // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
@@ -7090,8 +7247,8 @@ var LWC = (function (exports) {
7090
7247
  var nextNode = node;
7091
7248
  var anchor = null;
7092
7249
  var renderer = owner.renderer;
7093
- for (var _i34 = 0; _i34 < children.length; _i34++) {
7094
- var childVnode = children[_i34];
7250
+ for (var _i35 = 0; _i35 < children.length; _i35++) {
7251
+ var childVnode = children[_i35];
7095
7252
  if (!isNull(childVnode)) {
7096
7253
  if (nextNode) {
7097
7254
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -7182,8 +7339,8 @@ var LWC = (function (exports) {
7182
7339
  var nodesAreCompatible = true;
7183
7340
  // Validate attributes, though we could always recovery from those by running the update mods.
7184
7341
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
7185
- for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
7186
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
7342
+ for (var _i36 = 0, _Object$entries = Object.entries(attrs); _i36 < _Object$entries.length; _i36++) {
7343
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i36], 2),
7187
7344
  attrName = _Object$entries$_i[0],
7188
7345
  attrValue = _Object$entries$_i[1];
7189
7346
  var owner = vnode.owner;
@@ -7284,8 +7441,8 @@ var LWC = (function (exports) {
7284
7441
  var parsedVnodeStyle = parseStyleText(elmStyle);
7285
7442
  var expectedStyle = [];
7286
7443
  // styleMap is used when style is set to static value.
7287
- for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
7288
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
7444
+ for (var _i37 = 0, n = styleDecls.length; _i37 < n; _i37++) {
7445
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i37], 3),
7289
7446
  prop = _styleDecls$_i2[0],
7290
7447
  value = _styleDecls$_i2[1],
7291
7448
  important = _styleDecls$_i2[2];
@@ -7416,11 +7573,11 @@ var LWC = (function (exports) {
7416
7573
  function warnOnArrayMutation(stylesheets) {
7417
7574
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
7418
7575
  // we can at least warn when they use the most common mutation methods.
7419
- var _iterator8 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7420
- _step8;
7576
+ var _iterator13 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7577
+ _step13;
7421
7578
  try {
7422
7579
  var _loop4 = function _loop4() {
7423
- var prop = _step8.value;
7580
+ var prop = _step13.value;
7424
7581
  var originalArrayMethod = getOriginalArrayMethod(prop);
7425
7582
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7426
7583
  reportTemplateViolation('stylesheets');
@@ -7428,23 +7585,23 @@ var LWC = (function (exports) {
7428
7585
  return originalArrayMethod.apply(this, arguments);
7429
7586
  };
7430
7587
  };
7431
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7588
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
7432
7589
  _loop4();
7433
7590
  }
7434
7591
  } catch (err) {
7435
- _iterator8.e(err);
7592
+ _iterator13.e(err);
7436
7593
  } finally {
7437
- _iterator8.f();
7594
+ _iterator13.f();
7438
7595
  }
7439
7596
  }
7440
7597
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7441
7598
  // `stylesheet.$scoped$ = true`
7442
7599
  function warnOnStylesheetFunctionMutation(stylesheet) {
7443
- var _iterator9 = _createForOfIteratorHelper(STYLESHEET_PROPS),
7444
- _step9;
7600
+ var _iterator14 = _createForOfIteratorHelper(STYLESHEET_PROPS),
7601
+ _step14;
7445
7602
  try {
7446
7603
  var _loop5 = function _loop5() {
7447
- var prop = _step9.value;
7604
+ var prop = _step14.value;
7448
7605
  var value = stylesheet[prop];
7449
7606
  defineProperty(stylesheet, prop, {
7450
7607
  enumerable: true,
@@ -7458,13 +7615,13 @@ var LWC = (function (exports) {
7458
7615
  }
7459
7616
  });
7460
7617
  };
7461
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
7618
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
7462
7619
  _loop5();
7463
7620
  }
7464
7621
  } catch (err) {
7465
- _iterator9.e(err);
7622
+ _iterator14.e(err);
7466
7623
  } finally {
7467
- _iterator9.f();
7624
+ _iterator14.f();
7468
7625
  }
7469
7626
  }
7470
7627
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
@@ -7486,8 +7643,8 @@ var LWC = (function (exports) {
7486
7643
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7487
7644
  function traverseStylesheets(stylesheets, callback) {
7488
7645
  callback(stylesheets);
7489
- for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
7490
- var stylesheet = stylesheets[_i37];
7646
+ for (var _i38 = 0; _i38 < stylesheets.length; _i38++) {
7647
+ var stylesheet = stylesheets[_i38];
7491
7648
  if (isArray$1(stylesheet)) {
7492
7649
  traverseStylesheets(stylesheet, callback);
7493
7650
  } else {
@@ -7499,11 +7656,11 @@ var LWC = (function (exports) {
7499
7656
  if (!isUndefined$1(tmpl.stylesheets)) {
7500
7657
  trackStylesheetsMutation(tmpl.stylesheets);
7501
7658
  }
7502
- var _iterator10 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7503
- _step10;
7659
+ var _iterator15 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7660
+ _step15;
7504
7661
  try {
7505
7662
  var _loop6 = function _loop6() {
7506
- var prop = _step10.value;
7663
+ var prop = _step15.value;
7507
7664
  var value = tmpl[prop];
7508
7665
  defineProperty(tmpl, prop, {
7509
7666
  enumerable: true,
@@ -7519,13 +7676,13 @@ var LWC = (function (exports) {
7519
7676
  }
7520
7677
  });
7521
7678
  };
7522
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
7679
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
7523
7680
  _loop6();
7524
7681
  }
7525
7682
  } catch (err) {
7526
- _iterator10.e(err);
7683
+ _iterator15.e(err);
7527
7684
  } finally {
7528
- _iterator10.f();
7685
+ _iterator15.f();
7529
7686
  }
7530
7687
  var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7531
7688
  defineProperty(tmpl, 'stylesheetTokens', {
@@ -7634,7 +7791,7 @@ var LWC = (function (exports) {
7634
7791
  }
7635
7792
  return getReadOnlyProxy(obj);
7636
7793
  }
7637
- /* version: 2.38.0 */
7794
+ /* version: 2.39.0 */
7638
7795
 
7639
7796
  /*
7640
7797
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8060,7 +8217,7 @@ var LWC = (function (exports) {
8060
8217
  function isNull(obj) {
8061
8218
  return obj === null;
8062
8219
  }
8063
- /** version: 2.38.0 */
8220
+ /** version: 2.39.0 */
8064
8221
 
8065
8222
  /*
8066
8223
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8071,10 +8228,10 @@ var LWC = (function (exports) {
8071
8228
  var WireContextSubscriptionEvent = /*#__PURE__*/function (_CustomEvent) {
8072
8229
  _inherits(WireContextSubscriptionEvent, _CustomEvent);
8073
8230
  var _super6 = _createSuper(WireContextSubscriptionEvent);
8074
- function WireContextSubscriptionEvent(adapterToken, _ref6) {
8231
+ function WireContextSubscriptionEvent(adapterToken, _ref5) {
8075
8232
  var _this3;
8076
- var setNewContext = _ref6.setNewContext,
8077
- setDisconnectedCallback = _ref6.setDisconnectedCallback;
8233
+ var setNewContext = _ref5.setNewContext,
8234
+ setDisconnectedCallback = _ref5.setDisconnectedCallback;
8078
8235
  _classCallCheck(this, WireContextSubscriptionEvent);
8079
8236
  _this3 = _super6.call(this, adapterToken, {
8080
8237
  bubbles: true,
@@ -8158,17 +8315,17 @@ var LWC = (function (exports) {
8158
8315
  exports.createFragment = function (html) {
8159
8316
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8160
8317
  if (!isUndefined(wrapperTags)) {
8161
- var _iterator11 = _createForOfIteratorHelper(wrapperTags),
8162
- _step11;
8318
+ var _iterator16 = _createForOfIteratorHelper(wrapperTags),
8319
+ _step16;
8163
8320
  try {
8164
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8165
- var wrapperTag = _step11.value;
8321
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
8322
+ var wrapperTag = _step16.value;
8166
8323
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8167
8324
  }
8168
8325
  } catch (err) {
8169
- _iterator11.e(err);
8326
+ _iterator16.e(err);
8170
8327
  } finally {
8171
- _iterator11.f();
8328
+ _iterator16.f();
8172
8329
  }
8173
8330
  }
8174
8331
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -8177,7 +8334,7 @@ var LWC = (function (exports) {
8177
8334
  doc.body.innerHTML = html;
8178
8335
  var content = doc.body;
8179
8336
  if (!isUndefined(wrapperTags)) {
8180
- for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
8337
+ for (var _i39 = 0; _i39 < wrapperTags.length; _i39++) {
8181
8338
  content = content.firstChild;
8182
8339
  }
8183
8340
  }
@@ -8376,8 +8533,8 @@ var LWC = (function (exports) {
8376
8533
  tagName: element.tagName.toLowerCase(),
8377
8534
  hydrated: true
8378
8535
  });
8379
- for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
8380
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
8536
+ for (var _i40 = 0, _Object$entries2 = Object.entries(props); _i40 < _Object$entries2.length; _i40++) {
8537
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i40], 2),
8381
8538
  key = _Object$entries2$_i[0],
8382
8539
  value = _Object$entries2$_i[1];
8383
8540
  element[key] = value;
@@ -8702,7 +8859,7 @@ var LWC = (function (exports) {
8702
8859
  });
8703
8860
  });
8704
8861
  }
8705
- /* version: 2.38.0 */
8862
+ /* version: 2.39.0 */
8706
8863
 
8707
8864
  exports.LightningElement = LightningElement;
8708
8865
  exports.__unstable__ProfilerControl = profilerControl;