lwc 2.22.0 → 2.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +1222 -947
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +1222 -946
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1129 -882
  5. package/dist/engine-dom/iife/es5/engine-dom.js +524 -499
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +475 -457
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +1222 -946
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1129 -882
  11. package/dist/engine-dom/umd/es5/engine-dom.js +524 -499
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +475 -457
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +809 -626
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +809 -626
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +30 -27
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -27
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -26
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +32 -31
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -30
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +30 -27
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -26
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +32 -31
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -30
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -365,9 +365,13 @@ var LWC = (function (exports) {
365
365
  // Increment whenever the LWC template compiler changes
366
366
 
367
367
 
368
- var LWC_VERSION = "2.22.0";
368
+ var LWC_VERSION = "2.23.2";
369
369
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.22.0 */
370
+ /** version: 2.23.2 */
371
+
372
+ /**
373
+ * Copyright (C) 2018 salesforce.com, inc.
374
+ */
371
375
 
372
376
  /*
373
377
  * Copyright (c) 2018, salesforce.com, inc.
@@ -377,7 +381,7 @@ var LWC = (function (exports) {
377
381
  */
378
382
 
379
383
  function detect(propName) {
380
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
384
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
381
385
  }
382
386
  /*
383
387
  * Copyright (c) 2018, salesforce.com, inc.
@@ -457,6 +461,8 @@ var LWC = (function (exports) {
457
461
  patch$1(propName);
458
462
  }
459
463
  }
464
+ /** version: 2.23.2 */
465
+
460
466
  /**
461
467
  * Copyright (C) 2018 salesforce.com, inc.
462
468
  */
@@ -477,6 +483,7 @@ var LWC = (function (exports) {
477
483
  ENABLE_HTML_COLLECTIONS_PATCH: null,
478
484
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
479
485
  ENABLE_MIXED_SHADOW_MODE: null,
486
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
480
487
  ENABLE_NODE_LIST_PATCH: null,
481
488
  ENABLE_NODE_PATCH: null,
482
489
  ENABLE_REACTIVE_SETTER: null,
@@ -489,7 +496,7 @@ var LWC = (function (exports) {
489
496
  });
490
497
  }
491
498
 
492
- var runtimeFlags = _globalThis.lwcRuntimeFlags;
499
+ var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
493
500
  /**
494
501
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
495
502
  * flag. It is meant to be used during the app initialization.
@@ -519,10 +526,10 @@ var LWC = (function (exports) {
519
526
 
520
527
  if (process.env.NODE_ENV !== 'production') {
521
528
  // Allow the same flag to be set more than once outside of production to enable testing
522
- runtimeFlags[name] = value;
529
+ lwcRuntimeFlags[name] = value;
523
530
  } else {
524
531
  // Disallow the same flag to be set more than once in production
525
- var runtimeValue = runtimeFlags[name];
532
+ var runtimeValue = lwcRuntimeFlags[name];
526
533
 
527
534
  if (!isUndefined$1(runtimeValue)) {
528
535
  // eslint-disable-next-line no-console
@@ -530,7 +537,7 @@ var LWC = (function (exports) {
530
537
  return;
531
538
  }
532
539
 
533
- defineProperty(runtimeFlags, name, {
540
+ defineProperty(lwcRuntimeFlags, name, {
534
541
  value: value
535
542
  });
536
543
  }
@@ -546,7 +553,7 @@ var LWC = (function (exports) {
546
553
  setFeatureFlag(name, value);
547
554
  }
548
555
  }
549
- /** version: 2.22.0 */
556
+ /** version: 2.23.2 */
550
557
 
551
558
  /*
552
559
  * Copyright (c) 2018, salesforce.com, inc.
@@ -561,7 +568,7 @@ var LWC = (function (exports) {
561
568
  window.addEventListener('test-dummy-flag', function () {
562
569
  var hasFlag = false;
563
570
 
564
- if (runtimeFlags.DUMMY_TEST_FLAG) {
571
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
565
572
  hasFlag = true;
566
573
  }
567
574
 
@@ -588,7 +595,7 @@ var LWC = (function (exports) {
588
595
  window.addEventListener('test-dummy-flag', function () {
589
596
  var hasFlag = false;
590
597
 
591
- if (runtimeFlags.DUMMY_TEST_FLAG) {
598
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
592
599
  hasFlag = true;
593
600
  }
594
601
 
@@ -988,8 +995,8 @@ var LWC = (function (exports) {
988
995
  // to inject at runtime.
989
996
 
990
997
 
991
- var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
992
- var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
998
+ var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
999
+ var HTMLElementPrototype = HTMLElementConstructor.prototype;
993
1000
  /*
994
1001
  * Copyright (c) 2018, salesforce.com, inc.
995
1002
  * All rights reserved.
@@ -1209,10 +1216,10 @@ var LWC = (function (exports) {
1209
1216
  }; // Apply extra restriction related to DOM manipulation if the element is not a portal.
1210
1217
 
1211
1218
  if (!options.isLight && !options.isPortal) {
1212
- var _appendChild = elm.appendChild,
1213
- _insertBefore = elm.insertBefore,
1214
- _removeChild = elm.removeChild,
1215
- _replaceChild = elm.replaceChild;
1219
+ var appendChild = elm.appendChild,
1220
+ insertBefore = elm.insertBefore,
1221
+ removeChild = elm.removeChild,
1222
+ replaceChild = elm.replaceChild;
1216
1223
  var originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
1217
1224
  var originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1218
1225
  var originalTextContentDescriptor = getPropertyDescriptor(elm, 'textContent');
@@ -1220,7 +1227,7 @@ var LWC = (function (exports) {
1220
1227
  appendChild: generateDataDescriptor({
1221
1228
  value: function value(aChild) {
1222
1229
  logMissingPortalError('appendChild', 'method');
1223
- return _appendChild.call(this, aChild);
1230
+ return appendChild.call(this, aChild);
1224
1231
  }
1225
1232
  }),
1226
1233
  insertBefore: generateDataDescriptor({
@@ -1229,7 +1236,7 @@ var LWC = (function (exports) {
1229
1236
  logMissingPortalError('insertBefore', 'method');
1230
1237
  }
1231
1238
 
1232
- return _insertBefore.call(this, newNode, referenceNode);
1239
+ return insertBefore.call(this, newNode, referenceNode);
1233
1240
  }
1234
1241
  }),
1235
1242
  removeChild: generateDataDescriptor({
@@ -1238,13 +1245,13 @@ var LWC = (function (exports) {
1238
1245
  logMissingPortalError('removeChild', 'method');
1239
1246
  }
1240
1247
 
1241
- return _removeChild.call(this, aChild);
1248
+ return removeChild.call(this, aChild);
1242
1249
  }
1243
1250
  }),
1244
1251
  replaceChild: generateDataDescriptor({
1245
1252
  value: function value(newChild, oldChild) {
1246
1253
  logMissingPortalError('replaceChild', 'method');
1247
- return _replaceChild.call(this, newChild, oldChild);
1254
+ return replaceChild.call(this, newChild, oldChild);
1248
1255
  }
1249
1256
  }),
1250
1257
  nodeValue: generateAccessorDescriptor({
@@ -1477,6 +1484,15 @@ var LWC = (function (exports) {
1477
1484
  function patchLightningElementPrototypeWithRestrictions(proto) {
1478
1485
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1479
1486
  }
1487
+
1488
+ function updateComponentValue(vm, key, newValue) {
1489
+ var cmpFields = vm.cmpFields;
1490
+
1491
+ if (newValue !== cmpFields[key]) {
1492
+ cmpFields[key] = newValue;
1493
+ componentValueMutated(vm, key);
1494
+ }
1495
+ }
1480
1496
  /**
1481
1497
  * Copyright (C) 2017 salesforce.com, inc.
1482
1498
  */
@@ -2372,11 +2388,7 @@ var LWC = (function (exports) {
2372
2388
  assert.invariant(!isObject(newValue) || isNull(newValue), "Invalid value \"".concat(newValue, "\" for \"").concat(propName, "\" of ").concat(vm, ". Value cannot be an object, must be a primitive value."));
2373
2389
  }
2374
2390
 
2375
- if (newValue !== vm.cmpProps[propName]) {
2376
- vm.cmpProps[propName] = newValue;
2377
- componentValueMutated(vm, propName);
2378
- }
2379
-
2391
+ updateComponentValue(vm, propName, newValue);
2380
2392
  return _set.call(vm.elm, newValue);
2381
2393
  }
2382
2394
  };
@@ -2400,9 +2412,8 @@ var LWC = (function (exports) {
2400
2412
  var bridge = def.bridge;
2401
2413
 
2402
2414
  if (process.env.NODE_ENV !== 'production') {
2403
- var _assertInstanceOfHTMLElement = vm.renderer.assertInstanceOfHTMLElement;
2404
-
2405
- _assertInstanceOfHTMLElement(vm.elm, "Component creation requires a DOM element to be associated to ".concat(vm, "."));
2415
+ var assertInstanceOfHTMLElement = vm.renderer.assertInstanceOfHTMLElement;
2416
+ assertInstanceOfHTMLElement(vm.elm, "Component creation requires a DOM element to be associated to ".concat(vm, "."));
2406
2417
  }
2407
2418
 
2408
2419
  var component = this;
@@ -2752,11 +2763,7 @@ var LWC = (function (exports) {
2752
2763
  },
2753
2764
  set: function set(newValue) {
2754
2765
  var vm = getAssociatedVM(this);
2755
-
2756
- if (newValue !== vm.cmpFields[key]) {
2757
- vm.cmpFields[key] = newValue;
2758
- componentValueMutated(vm, key);
2759
- }
2766
+ updateComponentValue(vm, key, newValue);
2760
2767
  },
2761
2768
  enumerable: true,
2762
2769
  configurable: true
@@ -2910,7 +2917,7 @@ var LWC = (function (exports) {
2910
2917
  }
2911
2918
 
2912
2919
  if (_set2) {
2913
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2920
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2914
2921
  var ro = vm.oar[key];
2915
2922
 
2916
2923
  if (isUndefined$1(ro)) {
@@ -2974,11 +2981,7 @@ var LWC = (function (exports) {
2974
2981
  }
2975
2982
 
2976
2983
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2977
-
2978
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2979
- vm.cmpFields[key] = reactiveOrAnyValue;
2980
- componentValueMutated(vm, key);
2981
- }
2984
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2982
2985
  },
2983
2986
  enumerable: true,
2984
2987
  configurable: true
@@ -3022,10 +3025,7 @@ var LWC = (function (exports) {
3022
3025
  * system to be backward compatible.
3023
3026
  */
3024
3027
 
3025
- if (value !== vm.cmpFields[key]) {
3026
- vm.cmpFields[key] = value;
3027
- componentValueMutated(vm, key);
3028
- }
3028
+ updateComponentValue(vm, key, value);
3029
3029
  },
3030
3030
  enumerable: true,
3031
3031
  configurable: true
@@ -3590,7 +3590,7 @@ var LWC = (function (exports) {
3590
3590
  return HTMLBridgeElement;
3591
3591
  }
3592
3592
 
3593
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3593
+ var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3594
3594
  freeze(BaseBridgeElement);
3595
3595
  seal(BaseBridgeElement.prototype);
3596
3596
  /*
@@ -3682,7 +3682,7 @@ var LWC = (function (exports) {
3682
3682
  throw new ReferenceError();
3683
3683
  }
3684
3684
 
3685
- if (runtimeFlags.ENABLE_HMR) {
3685
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3686
3686
  var visited = new Set();
3687
3687
 
3688
3688
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
@@ -3700,7 +3700,7 @@ var LWC = (function (exports) {
3700
3700
  throw new ReferenceError();
3701
3701
  }
3702
3702
 
3703
- if (runtimeFlags.ENABLE_HMR) {
3703
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3704
3704
  var visited = new Set();
3705
3705
 
3706
3706
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
@@ -3718,7 +3718,7 @@ var LWC = (function (exports) {
3718
3718
  throw new ReferenceError();
3719
3719
  }
3720
3720
 
3721
- if (runtimeFlags.ENABLE_HMR) {
3721
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3722
3722
  var visited = new Set();
3723
3723
 
3724
3724
  while (swappedStyleMap.has(style) && !visited.has(style)) {
@@ -3736,7 +3736,7 @@ var LWC = (function (exports) {
3736
3736
  throw new ReferenceError();
3737
3737
  }
3738
3738
 
3739
- if (runtimeFlags.ENABLE_HMR) {
3739
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3740
3740
  // tracking active component
3741
3741
  var Ctor = vm.def.ctor;
3742
3742
  var componentVMs = activeComponents.get(Ctor);
@@ -3794,7 +3794,7 @@ var LWC = (function (exports) {
3794
3794
  throw new ReferenceError();
3795
3795
  }
3796
3796
 
3797
- if (runtimeFlags.ENABLE_HMR) {
3797
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3798
3798
  // tracking inactive component
3799
3799
  var Ctor = vm.def.ctor;
3800
3800
  var list = activeComponents.get(Ctor);
@@ -3842,7 +3842,7 @@ var LWC = (function (exports) {
3842
3842
  }
3843
3843
  }
3844
3844
 
3845
- if (!runtimeFlags.ENABLE_HMR) {
3845
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3846
3846
  throw new Error('HMR is not enabled');
3847
3847
  }
3848
3848
 
@@ -3859,7 +3859,7 @@ var LWC = (function (exports) {
3859
3859
  }
3860
3860
  }
3861
3861
 
3862
- if (!runtimeFlags.ENABLE_HMR) {
3862
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3863
3863
  throw new Error('HMR is not enabled');
3864
3864
  }
3865
3865
 
@@ -3874,7 +3874,7 @@ var LWC = (function (exports) {
3874
3874
  return rehydrateHotStyle(oldStyle);
3875
3875
  }
3876
3876
 
3877
- if (!runtimeFlags.ENABLE_HMR) {
3877
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3878
3878
  throw new Error('HMR is not enabled');
3879
3879
  }
3880
3880
 
@@ -4348,9 +4348,7 @@ var LWC = (function (exports) {
4348
4348
  function createStylesheet(vm, stylesheets) {
4349
4349
  var renderMode = vm.renderMode,
4350
4350
  shadowMode = vm.shadowMode,
4351
- _vm$renderer2 = vm.renderer,
4352
- ssr = _vm$renderer2.ssr,
4353
- insertStylesheet = _vm$renderer2.insertStylesheet;
4351
+ insertStylesheet = vm.renderer.insertStylesheet;
4354
4352
 
4355
4353
  if (renderMode === 1
4356
4354
  /* RenderMode.Shadow */
@@ -4360,7 +4358,7 @@ var LWC = (function (exports) {
4360
4358
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4361
4359
  insertStylesheet(stylesheets[_i12]);
4362
4360
  }
4363
- } else if (ssr || vm.hydrated) {
4361
+ } else if (vm.hydrated) {
4364
4362
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4365
4363
  // This works in the client, because the stylesheets are created, and cached in the VM
4366
4364
  // the first time the VM renders.
@@ -4387,6 +4385,18 @@ var LWC = (function (exports) {
4387
4385
  */
4388
4386
 
4389
4387
 
4388
+ function checkHasVM(elm) {
4389
+ var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
4390
+
4391
+ if (process.env.NODE_ENV !== 'production' && !hasVM) {
4392
+ // Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
4393
+ // we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
4394
+ 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.");
4395
+ }
4396
+
4397
+ return hasVM;
4398
+ }
4399
+
4390
4400
  function getUpgradableConstructor(tagName, renderer) {
4391
4401
  var getCustomElement = renderer.getCustomElement,
4392
4402
  RendererHTMLElement = renderer.HTMLElementExported,
@@ -4428,6 +4438,20 @@ var LWC = (function (exports) {
4428
4438
  return _createClass(LWCUpgradableElement);
4429
4439
  }(RendererHTMLElement);
4430
4440
 
4441
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4442
+ CE.prototype.connectedCallback = function () {
4443
+ if (checkHasVM(this)) {
4444
+ connectRootElement(this);
4445
+ }
4446
+ };
4447
+
4448
+ CE.prototype.disconnectedCallback = function () {
4449
+ if (checkHasVM(this)) {
4450
+ disconnectRootElement(this);
4451
+ }
4452
+ };
4453
+ }
4454
+
4431
4455
  defineCustomElement(tagName, CE);
4432
4456
  return CE;
4433
4457
  }
@@ -4539,6 +4563,15 @@ var LWC = (function (exports) {
4539
4563
  // different than the one previously set.
4540
4564
 
4541
4565
  if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
4566
+ // Additional verification if properties are supported by the element
4567
+ // Validation relies on html properties and public properties being defined on the element,
4568
+ // SSR has its own custom validation.
4569
+ if (process.env.NODE_ENV !== 'production') {
4570
+ if (!(key in elm)) {
4571
+ logWarn("Unknown public property \"".concat(key, "\" of element <").concat(elm.tagName.toLowerCase(), ">. This is either a typo on the corresponding attribute \"").concat(htmlPropertyToAttribute(key), "\", or the attribute does not exist in this browser or DOM implementation."));
4572
+ }
4573
+ }
4574
+
4542
4575
  setProperty(elm, key, cur);
4543
4576
  }
4544
4577
  }
@@ -4746,7 +4779,7 @@ var LWC = (function (exports) {
4746
4779
  }
4747
4780
  }
4748
4781
 
4749
- function patch(n1, n2, renderer) {
4782
+ function patch(n1, n2, parent, renderer) {
4750
4783
  var _a, _b;
4751
4784
 
4752
4785
  if (n1 === n2) {
@@ -4795,7 +4828,7 @@ var LWC = (function (exports) {
4795
4828
  case 3
4796
4829
  /* VNodeType.CustomElement */
4797
4830
  :
4798
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4831
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4799
4832
  break;
4800
4833
  }
4801
4834
  }
@@ -4951,13 +4984,19 @@ var LWC = (function (exports) {
4951
4984
  insertNode(elm, parent, anchor, renderer);
4952
4985
 
4953
4986
  if (vm) {
4954
- if (process.env.NODE_ENV !== 'production') {
4955
- assert.isTrue(vm.state === 0
4956
- /* VMState.created */
4957
- , "".concat(vm, " cannot be recycled."));
4958
- }
4987
+ {
4988
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4989
+ if (process.env.NODE_ENV !== 'production') {
4990
+ // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4991
+ // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
4992
+ assert.isTrue(vm.state === 0
4993
+ /* VMState.created */
4994
+ , "".concat(vm, " cannot be recycled."));
4995
+ }
4959
4996
 
4960
- runConnectedCallback(vm);
4997
+ runConnectedCallback(vm);
4998
+ }
4999
+ }
4961
5000
  }
4962
5001
 
4963
5002
  mountVNodes(vnode.children, elm, renderer, null);
@@ -4967,25 +5006,34 @@ var LWC = (function (exports) {
4967
5006
  }
4968
5007
  }
4969
5008
 
4970
- function patchCustomElement(n1, n2, renderer) {
4971
- var elm = n2.elm = n1.elm;
4972
- var vm = n2.vm = n1.vm;
4973
- patchElementPropsAndAttrs$1(n1, n2, renderer);
5009
+ function patchCustomElement(n1, n2, parent, renderer) {
5010
+ if (n1.ctor !== n2.ctor) {
5011
+ // If the constructor, unmount the current component and mount a new one using the new
5012
+ // constructor.
5013
+ var anchor = renderer.nextSibling(n1.elm);
5014
+ unmount(n1, parent, renderer, true);
5015
+ mountCustomElement(n2, parent, anchor, renderer);
5016
+ } else {
5017
+ // Otherwise patch the existing component with new props/attrs/etc.
5018
+ var elm = n2.elm = n1.elm;
5019
+ var vm = n2.vm = n1.vm;
5020
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4974
5021
 
4975
- if (!isUndefined$1(vm)) {
4976
- // in fallback mode, the allocation will always set children to
4977
- // empty and delegate the real allocation to the slot elements
4978
- allocateChildren(n2, vm);
4979
- } // in fallback mode, the children will be always empty, so, nothing
4980
- // will happen, but in native, it does allocate the light dom
5022
+ if (!isUndefined$1(vm)) {
5023
+ // in fallback mode, the allocation will always set children to
5024
+ // empty and delegate the real allocation to the slot elements
5025
+ allocateChildren(n2, vm);
5026
+ } // in fallback mode, the children will be always empty, so, nothing
5027
+ // will happen, but in native, it does allocate the light dom
4981
5028
 
4982
5029
 
4983
- patchChildren(n1.children, n2.children, elm, renderer);
5030
+ patchChildren(n1.children, n2.children, elm, renderer);
4984
5031
 
4985
- if (!isUndefined$1(vm)) {
4986
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4987
- // this is important to preserve the top to bottom synchronous rendering phase.
4988
- rerenderVM(vm);
5032
+ if (!isUndefined$1(vm)) {
5033
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
5034
+ // this is important to preserve the top to bottom synchronous rendering phase.
5035
+ rerenderVM(vm);
5036
+ }
4989
5037
  }
4990
5038
  }
4991
5039
 
@@ -5138,10 +5186,10 @@ var LWC = (function (exports) {
5138
5186
  var scopeToken = getScopeTokenClass(owner);
5139
5187
 
5140
5188
  if (!isNull(scopeToken)) {
5141
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5189
+ var getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5142
5190
  // probably we should have a renderer api for just the add operation
5143
5191
 
5144
- _getClassList(elm).add(scopeToken);
5192
+ getClassList(elm).add(scopeToken);
5145
5193
  } // Set property element for synthetic shadow DOM style scoping.
5146
5194
 
5147
5195
 
@@ -5354,22 +5402,22 @@ var LWC = (function (exports) {
5354
5402
  } else if (!isVNode(newEndVnode)) {
5355
5403
  newEndVnode = newCh[--newEndIdx];
5356
5404
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5357
- patch(oldStartVnode, newStartVnode, renderer);
5405
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5358
5406
  oldStartVnode = oldCh[++oldStartIdx];
5359
5407
  newStartVnode = newCh[++newStartIdx];
5360
5408
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5361
- patch(oldEndVnode, newEndVnode, renderer);
5409
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5362
5410
  oldEndVnode = oldCh[--oldEndIdx];
5363
5411
  newEndVnode = newCh[--newEndIdx];
5364
5412
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5365
5413
  // Vnode moved right
5366
- patch(oldStartVnode, newEndVnode, renderer);
5414
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5367
5415
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5368
5416
  oldStartVnode = oldCh[++oldStartIdx];
5369
5417
  newEndVnode = newCh[--newEndIdx];
5370
5418
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5371
5419
  // Vnode moved left
5372
- patch(oldEndVnode, newStartVnode, renderer);
5420
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5373
5421
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5374
5422
  oldEndVnode = oldCh[--oldEndIdx];
5375
5423
  newStartVnode = newCh[++newStartIdx];
@@ -5392,7 +5440,7 @@ var LWC = (function (exports) {
5392
5440
  // New element
5393
5441
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5394
5442
  } else {
5395
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5443
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5396
5444
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5397
5445
  // so we only care about the `oldCh` object inside this function.
5398
5446
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5462,7 +5510,7 @@ var LWC = (function (exports) {
5462
5510
  if (isVNode(n1)) {
5463
5511
  if (isVNode(n2)) {
5464
5512
  // both vnodes are equivalent, and we just need to patch them
5465
- patch(n1, n2, renderer);
5513
+ patch(n1, n2, parent, renderer);
5466
5514
  anchor = n2.elm;
5467
5515
  } else {
5468
5516
  // removing the old vnode since the new one is null
@@ -5877,19 +5925,11 @@ var LWC = (function (exports) {
5877
5925
 
5878
5926
  return url;
5879
5927
  }
5880
- /**
5881
- * Map to store an index value assigned to any dynamic component reference ingested
5882
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5883
- * component reference to avoid diffing algo mismatches.
5884
- */
5885
-
5886
-
5887
- var DynamicImportedComponentMap = new Map();
5888
- var dynamicImportedComponentCounter = 0;
5889
5928
  /**
5890
5929
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5891
5930
  */
5892
5931
 
5932
+
5893
5933
  function dc(sel, Ctor, data) {
5894
5934
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5895
5935
 
@@ -5908,22 +5948,7 @@ var LWC = (function (exports) {
5908
5948
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5909
5949
  }
5910
5950
 
5911
- var idx = DynamicImportedComponentMap.get(Ctor);
5912
-
5913
- if (isUndefined$1(idx)) {
5914
- idx = dynamicImportedComponentCounter++;
5915
- DynamicImportedComponentMap.set(Ctor, idx);
5916
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5917
- // to identify different constructors as vnodes with different keys to avoid reusing the
5918
- // element used for previous constructors.
5919
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5920
- // hoisting optimization.
5921
-
5922
-
5923
- var newData = Object.assign(Object.assign({}, data), {
5924
- key: "dc:".concat(idx, ":").concat(data.key)
5925
- });
5926
- return c(sel, Ctor, newData, children);
5951
+ return c(sel, Ctor, data, children);
5927
5952
  }
5928
5953
  /**
5929
5954
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6770,7 +6795,7 @@ var LWC = (function (exports) {
6770
6795
  return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
6771
6796
  };
6772
6797
 
6773
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6798
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6774
6799
  vm.shadowMode = 0
6775
6800
  /* ShadowMode.Native */
6776
6801
  ;
@@ -6805,7 +6830,7 @@ var LWC = (function (exports) {
6805
6830
  } else if (isNativeShadowDefined) {
6806
6831
  // Not combined with above condition because @lwc/features only supports identifiers in
6807
6832
  // the if-condition.
6808
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6833
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6809
6834
  if (def.shadowSupportMode === "any"
6810
6835
  /* ShadowSupportMode.Any */
6811
6836
  ) {
@@ -6931,13 +6956,7 @@ var LWC = (function (exports) {
6931
6956
  }
6932
6957
 
6933
6958
  function runRenderedCallback(vm) {
6934
- var renderedCallback = vm.def.renderedCallback,
6935
- ssr = vm.renderer.ssr;
6936
-
6937
- if (isTrue(ssr)) {
6938
- return;
6939
- }
6940
-
6959
+ var renderedCallback = vm.def.renderedCallback;
6941
6960
  var rendered = Services.rendered;
6942
6961
 
6943
6962
  if (rendered) {
@@ -7169,9 +7188,7 @@ var LWC = (function (exports) {
7169
7188
  }
7170
7189
 
7171
7190
  function scheduleRehydration(vm) {
7172
- var ssr = vm.renderer.ssr;
7173
-
7174
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7191
+ if (isTrue(vm.isScheduled)) {
7175
7192
  return;
7176
7193
  }
7177
7194
 
@@ -7293,13 +7310,8 @@ var LWC = (function (exports) {
7293
7310
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7294
7311
 
7295
7312
  function createFieldDataCallback(vm, name) {
7296
- var cmpFields = vm.cmpFields;
7297
7313
  return function (value) {
7298
- if (value !== vm.cmpFields[name]) {
7299
- // storing the value in the underlying storage
7300
- cmpFields[name] = value;
7301
- componentValueMutated(vm, name);
7302
- }
7314
+ updateComponentValue(vm, name, value);
7303
7315
  };
7304
7316
  }
7305
7317
 
@@ -7512,7 +7524,7 @@ var LWC = (function (exports) {
7512
7524
  ArrayPush$1.call(wiredConnecting, function () {
7513
7525
  connector.connect();
7514
7526
 
7515
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7527
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7516
7528
  if (hasDynamicParams) {
7517
7529
  Promise.resolve().then(computeConfigAndUpdate);
7518
7530
  return;
@@ -7692,6 +7704,8 @@ var LWC = (function (exports) {
7692
7704
  return renderer.nextSibling(hydratedNode);
7693
7705
  }
7694
7706
 
7707
+ var NODE_VALUE_PROP = 'nodeValue';
7708
+
7695
7709
  function hydrateText(node, vnode, renderer) {
7696
7710
  var _a;
7697
7711
 
@@ -7702,9 +7716,8 @@ var LWC = (function (exports) {
7702
7716
  }
7703
7717
 
7704
7718
  if (process.env.NODE_ENV !== 'production') {
7705
- var _getProperty = renderer.getProperty;
7706
-
7707
- var nodeValue = _getProperty(node, 'nodeValue');
7719
+ var getProperty = renderer.getProperty;
7720
+ var nodeValue = getProperty(node, NODE_VALUE_PROP);
7708
7721
 
7709
7722
  if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === '')) {
7710
7723
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
@@ -7727,9 +7740,8 @@ var LWC = (function (exports) {
7727
7740
  }
7728
7741
 
7729
7742
  if (process.env.NODE_ENV !== 'production') {
7730
- var _getProperty2 = renderer.getProperty;
7731
-
7732
- var nodeValue = _getProperty2(node, 'nodeValue');
7743
+ var getProperty = renderer.getProperty;
7744
+ var nodeValue = getProperty(node, NODE_VALUE_PROP);
7733
7745
 
7734
7746
  if (nodeValue !== vnode.text) {
7735
7747
  logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
@@ -7737,7 +7749,7 @@ var LWC = (function (exports) {
7737
7749
  }
7738
7750
 
7739
7751
  var setProperty = renderer.setProperty;
7740
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
7752
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
7741
7753
  vnode.elm = node;
7742
7754
  return node;
7743
7755
  }
@@ -7769,17 +7781,17 @@ var LWC = (function (exports) {
7769
7781
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
7770
7782
  // remove the innerHTML from props so it reuses the existing dom elements.
7771
7783
  var props = vnode.data.props;
7772
- var _getProperty3 = renderer.getProperty;
7784
+ var getProperty = renderer.getProperty;
7773
7785
 
7774
7786
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
7775
- if (_getProperty3(elm, 'innerHTML') === props.innerHTML) {
7787
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
7776
7788
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
7777
7789
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
7778
7790
  props: cloneAndOmitKey(props, 'innerHTML')
7779
7791
  });
7780
7792
  } else {
7781
7793
  if (process.env.NODE_ENV !== 'production') {
7782
- logWarn("Mismatch hydrating element <".concat(_getProperty3(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), owner);
7794
+ logWarn("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), owner);
7783
7795
  }
7784
7796
  }
7785
7797
  }
@@ -7788,8 +7800,8 @@ var LWC = (function (exports) {
7788
7800
  patchElementPropsAndAttrs(vnode, renderer);
7789
7801
 
7790
7802
  if (!isDomManual) {
7791
- var _getFirstChild = renderer.getFirstChild;
7792
- hydrateChildren(_getFirstChild(elm), vnode.children, elm, owner);
7803
+ var getFirstChild = renderer.getFirstChild;
7804
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
7793
7805
  }
7794
7806
 
7795
7807
  return elm;
@@ -7828,10 +7840,10 @@ var LWC = (function (exports) {
7828
7840
  if (vm.renderMode !== 0
7829
7841
  /* RenderMode.Light */
7830
7842
  ) {
7831
- var _getFirstChild2 = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
7843
+ var getFirstChild = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
7832
7844
  // Note: for Light DOM, this is handled while hydrating the VM
7833
7845
 
7834
- hydrateChildren(_getFirstChild2(elm), vnode.children, elm, vm);
7846
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
7835
7847
  }
7836
7848
 
7837
7849
  hydrateVM(vm);
@@ -7880,11 +7892,11 @@ var LWC = (function (exports) {
7880
7892
  // next node in the list to be hydrated.
7881
7893
 
7882
7894
 
7883
- var _nextSibling = renderer.nextSibling;
7895
+ var nextSibling = renderer.nextSibling;
7884
7896
 
7885
7897
  do {
7886
7898
  var current = nextNode;
7887
- nextNode = _nextSibling(nextNode);
7899
+ nextNode = nextSibling(nextNode);
7888
7900
  removeNode(current, parentNode, renderer);
7889
7901
  } while (nextNode);
7890
7902
  }
@@ -7947,14 +7959,13 @@ var LWC = (function (exports) {
7947
7959
  attrValue = _Object$entries$_i[1];
7948
7960
 
7949
7961
  var owner = vnode.owner;
7950
- var _getAttribute = renderer.getAttribute;
7951
-
7952
- var elmAttrValue = _getAttribute(elm, attrName);
7962
+ var getAttribute = renderer.getAttribute;
7963
+ var elmAttrValue = getAttribute(elm, attrName);
7953
7964
 
7954
7965
  if (String(attrValue) !== elmAttrValue) {
7955
7966
  if (process.env.NODE_ENV !== 'production') {
7956
- var _getProperty4 = renderer.getProperty;
7957
- logError("Mismatch hydrating element <".concat(_getProperty4(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), owner);
7967
+ var getProperty = renderer.getProperty;
7968
+ logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), owner);
7958
7969
  }
7959
7970
 
7960
7971
  nodesAreCompatible = false;
@@ -8065,8 +8076,8 @@ var LWC = (function (exports) {
8065
8076
 
8066
8077
  if (!nodesAreCompatible) {
8067
8078
  if (process.env.NODE_ENV !== 'production') {
8068
- var _getProperty5 = renderer.getProperty;
8069
- logError("Mismatch hydrating element <".concat(_getProperty5(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
8079
+ var getProperty = renderer.getProperty;
8080
+ logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
8070
8081
  }
8071
8082
  }
8072
8083
 
@@ -8086,7 +8097,7 @@ var LWC = (function (exports) {
8086
8097
  return false;
8087
8098
  }
8088
8099
 
8089
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
8100
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
8090
8101
  }
8091
8102
 
8092
8103
  if (getProperty(client, 'nodeType') === 8
@@ -8098,7 +8109,7 @@ var LWC = (function (exports) {
8098
8109
  return false;
8099
8110
  }
8100
8111
 
8101
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
8112
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
8102
8113
  }
8103
8114
 
8104
8115
  if (!hasCorrectNodeType(vnode, ssr, 1
@@ -8298,7 +8309,7 @@ var LWC = (function (exports) {
8298
8309
 
8299
8310
  return ctor;
8300
8311
  }
8301
- /* version: 2.22.0 */
8312
+ /* version: 2.23.2 */
8302
8313
 
8303
8314
  /*
8304
8315
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8465,379 +8476,395 @@ var LWC = (function (exports) {
8465
8476
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8466
8477
  */
8467
8478
 
8479
+ /**
8480
+ * A factory function that produces a renderer.
8481
+ * Renderer encapsulates operations that are required to render an LWC component into the underlying
8482
+ * runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
8483
+ * Example usage:
8484
+ * import { renderer, rendererFactory } from 'lwc';
8485
+ * const customRenderer = rendererFactory(renderer);
8486
+ *
8487
+ * @param baseRenderer Either null or the base renderer imported from 'lwc'.
8488
+ */
8468
8489
 
8469
- var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8470
- var createFragment;
8471
8490
 
8472
- if (SUPPORTS_TEMPLATE) {
8473
- // Parse the fragment HTML string into DOM
8474
- createFragment = function createFragment(html) {
8475
- var template = document.createElement('template');
8476
- template.innerHTML = html;
8477
- return template.content.firstChild;
8478
- };
8479
- } else {
8480
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8481
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8482
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8483
- // With other elements added from:
8484
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8485
- // Using the test:
8486
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8487
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8488
- var topLevelWrappingMap = {
8489
- caption: ['table'],
8490
- col: ['colgroup', 'table'],
8491
- colgroup: ['table'],
8492
- option: ['select'],
8493
- tbody: ['table'],
8494
- td: ['tr', 'tbody', 'table'],
8495
- th: ['tr', 'tbody', 'table'],
8496
- thead: ['table'],
8497
- tfoot: ['table'],
8498
- tr: ['tbody', 'table']
8499
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8500
-
8501
- var getTagName = function getTagName(text) {
8502
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8503
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8504
-
8505
-
8506
- createFragment = function createFragment(html) {
8507
- var wrapperTags = topLevelWrappingMap[getTagName(html)];
8508
-
8509
- if (!isUndefined$1(wrapperTags)) {
8510
- var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8511
- _step5;
8491
+ function rendererFactory(baseRenderer) {
8492
+ // Util functions
8493
+ function assertInvariant(value, msg) {
8494
+ if (!value) {
8495
+ throw new Error("Invariant Violation: ".concat(msg));
8496
+ }
8497
+ }
8512
8498
 
8513
- try {
8514
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8515
- var wrapperTag = _step5.value;
8516
- html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8517
- }
8518
- } catch (err) {
8519
- _iterator5.e(err);
8520
- } finally {
8521
- _iterator5.f();
8522
- }
8523
- } // For IE11, the document title must not be undefined, but it can be an empty string
8524
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8499
+ function isNull(obj) {
8500
+ return obj === null;
8501
+ }
8525
8502
 
8503
+ function isUndefined(obj) {
8504
+ return obj === undefined;
8505
+ }
8526
8506
 
8527
- var doc = document.implementation.createHTMLDocument('');
8528
- doc.body.innerHTML = html;
8529
- var content = doc.body;
8507
+ var getCustomElement;
8508
+ var defineCustomElement;
8509
+ var HTMLElementConstructor;
8530
8510
 
8531
- if (!isUndefined$1(wrapperTags)) {
8532
- for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8533
- content = content.firstChild;
8534
- }
8511
+ function isCustomElementRegistryAvailable() {
8512
+ if (typeof customElements === 'undefined') {
8513
+ return false;
8535
8514
  }
8536
8515
 
8537
- return content.firstChild;
8538
- };
8539
- }
8540
- /*
8541
- * Copyright (c) 2018, salesforce.com, inc.
8542
- * All rights reserved.
8543
- * SPDX-License-Identifier: MIT
8544
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8545
- */
8516
+ try {
8517
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
8518
+ // _wrapNativeSuper()
8519
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8520
+ // get wrapped by babel.
8521
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8522
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8523
+ // which are not equipped to be initialized that way.
8546
8524
 
8525
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8526
+ _inherits(clazz, _HTMLElementAlias);
8547
8527
 
8548
- var getCustomElement;
8549
- var defineCustomElement;
8550
- var HTMLElementConstructor;
8528
+ var _super7 = _createSuper(clazz);
8551
8529
 
8552
- function isCustomElementRegistryAvailable() {
8553
- if (typeof customElements === 'undefined') {
8554
- return false;
8555
- }
8530
+ function clazz() {
8531
+ _classCallCheck(this, clazz);
8556
8532
 
8557
- try {
8558
- // dereference HTMLElement global because babel wraps globals in compat mode with a
8559
- // _wrapNativeSuper()
8560
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8561
- // get wrapped by babel.
8562
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8563
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8564
- // which are not equipped to be initialized that way.
8533
+ return _super7.apply(this, arguments);
8534
+ }
8565
8535
 
8566
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8567
- _inherits(clazz, _HTMLElementAlias);
8536
+ return _createClass(clazz);
8537
+ }(HTMLElementAlias);
8568
8538
 
8569
- var _super7 = _createSuper(clazz);
8539
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8540
+ new clazz();
8541
+ return true;
8542
+ } catch (_a) {
8543
+ return false;
8544
+ }
8545
+ }
8570
8546
 
8571
- function clazz() {
8572
- _classCallCheck(this, clazz);
8547
+ if (isCustomElementRegistryAvailable()) {
8548
+ getCustomElement = customElements.get.bind(customElements);
8549
+ defineCustomElement = customElements.define.bind(customElements);
8550
+ HTMLElementConstructor = HTMLElement;
8551
+ } else {
8552
+ var registry = Object.create(null);
8553
+ var reverseRegistry = new WeakMap();
8573
8554
 
8574
- return _super7.apply(this, arguments);
8555
+ defineCustomElement = function define(name, ctor) {
8556
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
8557
+ throw new TypeError("Invalid Registration");
8575
8558
  }
8576
8559
 
8577
- return _createClass(clazz);
8578
- }(HTMLElementAlias);
8560
+ registry[name] = ctor;
8561
+ reverseRegistry.set(ctor, name);
8562
+ };
8579
8563
 
8580
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8581
- new clazz();
8582
- return true;
8583
- } catch (_a) {
8584
- return false;
8585
- }
8586
- }
8564
+ getCustomElement = function get(name) {
8565
+ return registry[name];
8566
+ };
8587
8567
 
8588
- if (isCustomElementRegistryAvailable()) {
8589
- getCustomElement = customElements.get.bind(customElements);
8590
- defineCustomElement = customElements.define.bind(customElements);
8591
- HTMLElementConstructor = HTMLElement;
8592
- } else {
8593
- var registry = create(null);
8594
- var reverseRegistry = new WeakMap();
8568
+ HTMLElementConstructor = function HTMLElement() {
8569
+ if (!(this instanceof HTMLElement)) {
8570
+ throw new TypeError("Invalid Invocation");
8571
+ }
8595
8572
 
8596
- defineCustomElement = function define(name, ctor) {
8597
- if (name !== StringToLowerCase.call(name) || registry[name]) {
8598
- throw new TypeError("Invalid Registration");
8599
- }
8573
+ var constructor = this.constructor;
8574
+ var name = reverseRegistry.get(constructor);
8600
8575
 
8601
- registry[name] = ctor;
8602
- reverseRegistry.set(ctor, name);
8603
- };
8576
+ if (!name) {
8577
+ throw new TypeError("Invalid Construction");
8578
+ }
8604
8579
 
8605
- getCustomElement = function get(name) {
8606
- return registry[name];
8607
- };
8580
+ var elm = document.createElement(name);
8581
+ Object.setPrototypeOf(elm, constructor.prototype);
8582
+ return elm;
8583
+ };
8608
8584
 
8609
- HTMLElementConstructor = function HTMLElement() {
8610
- if (!(this instanceof HTMLElement)) {
8611
- throw new TypeError("Invalid Invocation");
8612
- }
8585
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
8586
+ }
8613
8587
 
8614
- var constructor = this.constructor;
8615
- var name = reverseRegistry.get(constructor);
8588
+ function cloneNode(node, deep) {
8589
+ return node.cloneNode(deep);
8590
+ }
8616
8591
 
8617
- if (!name) {
8618
- throw new TypeError("Invalid Construction");
8619
- }
8592
+ function createElement(tagName, namespace) {
8593
+ return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8594
+ }
8620
8595
 
8621
- var elm = document.createElement(name);
8622
- setPrototypeOf(elm, constructor.prototype);
8623
- return elm;
8624
- };
8596
+ function createText(content) {
8597
+ return document.createTextNode(content);
8598
+ }
8625
8599
 
8626
- HTMLElementConstructor.prototype = HTMLElement.prototype;
8627
- }
8600
+ function createComment(content) {
8601
+ return document.createComment(content);
8602
+ }
8628
8603
 
8629
- var hydrating = false;
8604
+ var createFragment; // IE11 lacks support for this feature
8630
8605
 
8631
- function setIsHydrating(value) {
8632
- hydrating = value;
8633
- }
8606
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8634
8607
 
8635
- var ssr = false;
8608
+ if (SUPPORTS_TEMPLATE) {
8609
+ // Parse the fragment HTML string into DOM
8610
+ createFragment = function createFragment(html) {
8611
+ var template = document.createElement('template');
8612
+ template.innerHTML = html;
8613
+ return template.content.firstChild;
8614
+ };
8615
+ } else {
8616
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8617
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8618
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8619
+ // With other elements added from:
8620
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8621
+ // Using the test:
8622
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8623
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8624
+ var topLevelWrappingMap = {
8625
+ caption: ['table'],
8626
+ col: ['colgroup', 'table'],
8627
+ colgroup: ['table'],
8628
+ option: ['select'],
8629
+ tbody: ['table'],
8630
+ td: ['tr', 'tbody', 'table'],
8631
+ th: ['tr', 'tbody', 'table'],
8632
+ thead: ['table'],
8633
+ tfoot: ['table'],
8634
+ tr: ['tbody', 'table']
8635
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8636
+
8637
+ var getTagName = function getTagName(text) {
8638
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8639
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8640
+
8641
+
8642
+ createFragment = function createFragment(html) {
8643
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8644
+
8645
+ if (!isUndefined(wrapperTags)) {
8646
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8647
+ _step5;
8648
+
8649
+ try {
8650
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8651
+ var wrapperTag = _step5.value;
8652
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8653
+ }
8654
+ } catch (err) {
8655
+ _iterator5.e(err);
8656
+ } finally {
8657
+ _iterator5.f();
8658
+ }
8659
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8660
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8636
8661
 
8637
- function isHydrating() {
8638
- return hydrating;
8639
- }
8640
8662
 
8641
- var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8642
- var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8663
+ var doc = document.implementation.createHTMLDocument('');
8664
+ doc.body.innerHTML = html;
8665
+ var content = doc.body;
8643
8666
 
8644
- function cloneNode(node, deep) {
8645
- return node.cloneNode(deep);
8646
- }
8667
+ if (!isUndefined(wrapperTags)) {
8668
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8669
+ content = content.firstChild;
8670
+ }
8671
+ }
8647
8672
 
8648
- function createElement$1(tagName, namespace) {
8649
- return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8650
- }
8673
+ return content.firstChild;
8674
+ };
8675
+ }
8651
8676
 
8652
- function createText(content) {
8653
- return document.createTextNode(content);
8654
- }
8677
+ function insert(node, parent, anchor) {
8678
+ parent.insertBefore(node, anchor);
8679
+ }
8655
8680
 
8656
- function createComment(content) {
8657
- return document.createComment(content);
8658
- }
8681
+ function remove(node, parent) {
8682
+ parent.removeChild(node);
8683
+ }
8659
8684
 
8660
- function insert(node, parent, anchor) {
8661
- parent.insertBefore(node, anchor);
8662
- }
8685
+ function nextSibling(node) {
8686
+ return node.nextSibling;
8687
+ }
8663
8688
 
8664
- function remove(node, parent) {
8665
- parent.removeChild(node);
8666
- }
8689
+ function attachShadow(element, options) {
8690
+ // `shadowRoot` will be non-null in two cases:
8691
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8692
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
8693
+ // root component with customElement.define('c-app', Ctor)
8694
+ if (!isNull(element.shadowRoot)) {
8695
+ return element.shadowRoot;
8696
+ }
8667
8697
 
8668
- function nextSibling(node) {
8669
- return node.nextSibling;
8670
- }
8698
+ return element.attachShadow(options);
8699
+ }
8671
8700
 
8672
- function attachShadow(element, options) {
8673
- // `hydrating` will be true in two cases:
8674
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8675
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
8676
- // root component with customeElement.define('c-app', Ctor)
8677
- //
8678
- // The second case can be treated as a failed hydration with nominal impact
8679
- // to performance. However, because <c-app> won't have a <template shadowroot>
8680
- // declarative child, `element.shadowRoot` is `null`.
8681
- if (hydrating && element.shadowRoot) {
8682
- return element.shadowRoot;
8701
+ function setText(node, content) {
8702
+ node.nodeValue = content;
8683
8703
  }
8684
8704
 
8685
- return element.attachShadow(options);
8686
- }
8705
+ function getProperty(node, key) {
8706
+ return node[key];
8707
+ }
8687
8708
 
8688
- function setText(node, content) {
8689
- node.nodeValue = content;
8690
- }
8709
+ function setProperty(node, key, value) {
8710
+ node[key] = value;
8711
+ }
8691
8712
 
8692
- function getProperty(node, key) {
8693
- return node[key];
8694
- }
8713
+ function getAttribute(element, name, namespace) {
8714
+ return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8715
+ }
8695
8716
 
8696
- function setProperty(node, key, value) {
8697
- if (process.env.NODE_ENV !== 'production') {
8698
- if (node instanceof Element && !(key in node)) {
8699
- // TODO [#1297]: Move this validation to the compiler
8700
- assert.fail("Unknown public property \"".concat(key, "\" of element <").concat(node.tagName, ">. This is likely a typo on the corresponding attribute \"").concat(htmlPropertyToAttribute(key), "\"."));
8717
+ function setAttribute(element, name, value, namespace) {
8718
+ return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8719
+ }
8720
+
8721
+ function removeAttribute(element, name, namespace) {
8722
+ if (isUndefined(namespace)) {
8723
+ element.removeAttribute(name);
8724
+ } else {
8725
+ element.removeAttributeNS(namespace, name);
8701
8726
  }
8702
8727
  }
8703
8728
 
8704
- node[key] = value;
8705
- }
8729
+ function addEventListener(target, type, callback, options) {
8730
+ target.addEventListener(type, callback, options);
8731
+ }
8706
8732
 
8707
- function getAttribute(element, name, namespace) {
8708
- return isUndefined$1(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8709
- }
8733
+ function removeEventListener(target, type, callback, options) {
8734
+ target.removeEventListener(type, callback, options);
8735
+ }
8710
8736
 
8711
- function setAttribute(element, name, value, namespace) {
8712
- return isUndefined$1(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8713
- }
8737
+ function dispatchEvent(target, event) {
8738
+ return target.dispatchEvent(event);
8739
+ }
8714
8740
 
8715
- function removeAttribute(element, name, namespace) {
8716
- if (isUndefined$1(namespace)) {
8717
- element.removeAttribute(name);
8718
- } else {
8719
- element.removeAttributeNS(namespace, name);
8741
+ function getClassList(element) {
8742
+ return element.classList;
8720
8743
  }
8721
- }
8722
8744
 
8723
- function addEventListener(target, type, callback, options) {
8724
- target.addEventListener(type, callback, options);
8725
- }
8745
+ function setCSSStyleProperty(element, name, value, important) {
8746
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
8747
+ // represent elements in the engine?
8748
+ element.style.setProperty(name, value, important ? 'important' : '');
8749
+ }
8726
8750
 
8727
- function removeEventListener(target, type, callback, options) {
8728
- target.removeEventListener(type, callback, options);
8729
- }
8751
+ function getBoundingClientRect(element) {
8752
+ return element.getBoundingClientRect();
8753
+ }
8730
8754
 
8731
- function dispatchEvent(target, event) {
8732
- return target.dispatchEvent(event);
8733
- }
8755
+ function querySelector(element, selectors) {
8756
+ return element.querySelector(selectors);
8757
+ }
8734
8758
 
8735
- function getClassList(element) {
8736
- return element.classList;
8737
- }
8759
+ function querySelectorAll(element, selectors) {
8760
+ return element.querySelectorAll(selectors);
8761
+ }
8738
8762
 
8739
- function setCSSStyleProperty(element, name, value, important) {
8740
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
8741
- // represent elements in the engine?
8742
- element.style.setProperty(name, value, important ? 'important' : '');
8743
- }
8763
+ function getElementsByTagName(element, tagNameOrWildCard) {
8764
+ return element.getElementsByTagName(tagNameOrWildCard);
8765
+ }
8744
8766
 
8745
- function getBoundingClientRect(element) {
8746
- return element.getBoundingClientRect();
8747
- }
8767
+ function getElementsByClassName(element, names) {
8768
+ return element.getElementsByClassName(names);
8769
+ }
8748
8770
 
8749
- function querySelector(element, selectors) {
8750
- return element.querySelector(selectors);
8751
- }
8771
+ function getChildren(element) {
8772
+ return element.children;
8773
+ }
8752
8774
 
8753
- function querySelectorAll(element, selectors) {
8754
- return element.querySelectorAll(selectors);
8755
- }
8775
+ function getChildNodes(element) {
8776
+ return element.childNodes;
8777
+ }
8756
8778
 
8757
- function getElementsByTagName(element, tagNameOrWildCard) {
8758
- return element.getElementsByTagName(tagNameOrWildCard);
8759
- }
8779
+ function getFirstChild(element) {
8780
+ return element.firstChild;
8781
+ }
8760
8782
 
8761
- function getElementsByClassName(element, names) {
8762
- return element.getElementsByClassName(names);
8763
- }
8783
+ function getFirstElementChild(element) {
8784
+ return element.firstElementChild;
8785
+ }
8764
8786
 
8765
- function getChildren(element) {
8766
- return element.children;
8767
- }
8787
+ function getLastChild(element) {
8788
+ return element.lastChild;
8789
+ }
8768
8790
 
8769
- function getChildNodes(element) {
8770
- return element.childNodes;
8771
- }
8791
+ function getLastElementChild(element) {
8792
+ return element.lastElementChild;
8793
+ }
8772
8794
 
8773
- function getFirstChild(element) {
8774
- return element.firstChild;
8775
- }
8795
+ function isConnected(node) {
8796
+ return node.isConnected;
8797
+ }
8776
8798
 
8777
- function getFirstElementChild(element) {
8778
- return element.firstElementChild;
8779
- }
8799
+ function assertInstanceOfHTMLElement(elm, msg) {
8800
+ assertInvariant(elm instanceof HTMLElement, msg);
8801
+ }
8780
8802
 
8781
- function getLastChild(element) {
8782
- return element.lastChild;
8783
- }
8803
+ var HTMLElementExported = HTMLElementConstructor;
8804
+ var renderer = {
8805
+ HTMLElementExported: HTMLElementExported,
8806
+ insert: insert,
8807
+ remove: remove,
8808
+ cloneNode: cloneNode,
8809
+ createFragment: createFragment,
8810
+ createElement: createElement,
8811
+ createText: createText,
8812
+ createComment: createComment,
8813
+ nextSibling: nextSibling,
8814
+ attachShadow: attachShadow,
8815
+ getProperty: getProperty,
8816
+ setProperty: setProperty,
8817
+ setText: setText,
8818
+ getAttribute: getAttribute,
8819
+ setAttribute: setAttribute,
8820
+ removeAttribute: removeAttribute,
8821
+ addEventListener: addEventListener,
8822
+ removeEventListener: removeEventListener,
8823
+ dispatchEvent: dispatchEvent,
8824
+ getClassList: getClassList,
8825
+ setCSSStyleProperty: setCSSStyleProperty,
8826
+ getBoundingClientRect: getBoundingClientRect,
8827
+ querySelector: querySelector,
8828
+ querySelectorAll: querySelectorAll,
8829
+ getElementsByTagName: getElementsByTagName,
8830
+ getElementsByClassName: getElementsByClassName,
8831
+ getChildren: getChildren,
8832
+ getChildNodes: getChildNodes,
8833
+ getFirstChild: getFirstChild,
8834
+ getFirstElementChild: getFirstElementChild,
8835
+ getLastChild: getLastChild,
8836
+ getLastElementChild: getLastElementChild,
8837
+ isConnected: isConnected,
8838
+ assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
8839
+ defineCustomElement: defineCustomElement,
8840
+ getCustomElement: getCustomElement
8841
+ }; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
8784
8842
 
8785
- function getLastElementChild(element) {
8786
- return element.lastElementChild;
8843
+ Object.setPrototypeOf(renderer, baseRenderer);
8844
+ return renderer;
8787
8845
  }
8846
+ /*
8847
+ * Copyright (c) 2018, salesforce.com, inc.
8848
+ * All rights reserved.
8849
+ * SPDX-License-Identifier: MIT
8850
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8851
+ */
8788
8852
 
8789
- function isConnected(node) {
8790
- return node.isConnected;
8791
- }
8853
+ /**
8854
+ * The base renderer that will be used by engine-core.
8855
+ * This will be used for DOM operations when lwc is running in a browser environment.
8856
+ */
8792
8857
 
8793
- function assertInstanceOfHTMLElement(elm, msg) {
8794
- assert.invariant(elm instanceof HTMLElement, msg);
8795
- }
8796
8858
 
8797
- var HTMLElementExported = HTMLElementConstructor;
8798
- var renderer = {
8799
- ssr: ssr,
8800
- isNativeShadowDefined: isNativeShadowDefined,
8801
- isSyntheticShadowDefined: isSyntheticShadowDefined,
8802
- HTMLElementExported: HTMLElementExported,
8803
- isHydrating: isHydrating,
8804
- insert: insert,
8805
- remove: remove,
8806
- cloneNode: cloneNode,
8807
- createFragment: createFragment,
8808
- createElement: createElement$1,
8809
- createText: createText,
8810
- createComment: createComment,
8811
- nextSibling: nextSibling,
8812
- attachShadow: attachShadow,
8813
- getProperty: getProperty,
8814
- setProperty: setProperty,
8815
- setText: setText,
8816
- getAttribute: getAttribute,
8817
- setAttribute: setAttribute,
8818
- removeAttribute: removeAttribute,
8819
- addEventListener: addEventListener,
8820
- removeEventListener: removeEventListener,
8821
- dispatchEvent: dispatchEvent,
8822
- getClassList: getClassList,
8823
- setCSSStyleProperty: setCSSStyleProperty,
8824
- getBoundingClientRect: getBoundingClientRect,
8825
- querySelector: querySelector,
8826
- querySelectorAll: querySelectorAll,
8827
- getElementsByTagName: getElementsByTagName,
8828
- getElementsByClassName: getElementsByClassName,
8829
- getChildren: getChildren,
8830
- getChildNodes: getChildNodes,
8831
- getFirstChild: getFirstChild,
8832
- getFirstElementChild: getFirstElementChild,
8833
- getLastChild: getLastChild,
8834
- getLastElementChild: getLastElementChild,
8835
- isConnected: isConnected,
8859
+ var renderer = assign( // The base renderer will invoke the factory with null and assign additional properties that are
8860
+ // shared across renderers
8861
+ rendererFactory(null), // Properties that are either not required to be sandboxed or rely on a globally shared information
8862
+ {
8863
+ // insertStyleSheet implementation shares a global cache of stylesheet data
8836
8864
  insertStylesheet: insertStylesheet,
8837
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
8838
- defineCustomElement: defineCustomElement,
8839
- getCustomElement: getCustomElement
8840
- };
8865
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
8866
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
8867
+ });
8841
8868
  /*
8842
8869
  * Copyright (c) 2018, salesforce.com, inc.
8843
8870
  * All rights reserved.
@@ -8902,13 +8929,8 @@ var LWC = (function (exports) {
8902
8929
  }
8903
8930
 
8904
8931
  try {
8905
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8906
- // and uses the same algo to create the stylesheets as in SSR.
8907
- setIsHydrating(true);
8908
8932
  var vm = createVMWithProps(element, Ctor, props);
8909
- hydrateRoot(vm); // set it back since now we finished hydration.
8910
-
8911
- setIsHydrating(false);
8933
+ hydrateRoot(vm);
8912
8934
  } catch (e) {
8913
8935
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8914
8936
  // with the client generated DOM.
@@ -8919,11 +8941,7 @@ var LWC = (function (exports) {
8919
8941
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8920
8942
 
8921
8943
  createVMWithProps(element, Ctor, props);
8922
- setIsHydrating(false);
8923
8944
  connectRootElement(element);
8924
- } finally {
8925
- // in case there's an error during recovery
8926
- setIsHydrating(false);
8927
8945
  }
8928
8946
  }
8929
8947
  /*
@@ -9018,7 +9036,6 @@ var LWC = (function (exports) {
9018
9036
  * SPDX-License-Identifier: MIT
9019
9037
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9020
9038
  */
9021
- // TODO [#2472]: Remove this workaround when appropriate.
9022
9039
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
9023
9040
 
9024
9041
 
@@ -9038,39 +9055,41 @@ var LWC = (function (exports) {
9038
9055
  }
9039
9056
 
9040
9057
  return node; // for convenience
9041
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
9042
- // created via createElement.
9043
-
9058
+ }
9044
9059
 
9045
- var _Node$1$prototype = _Node$1.prototype,
9046
- _appendChild2 = _Node$1$prototype.appendChild,
9047
- _insertBefore2 = _Node$1$prototype.insertBefore,
9048
- _removeChild2 = _Node$1$prototype.removeChild,
9049
- _replaceChild2 = _Node$1$prototype.replaceChild;
9050
- assign(_Node$1.prototype, {
9051
- appendChild: function appendChild(newChild) {
9052
- var appendedNode = _appendChild2.call(this, newChild);
9060
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9061
+ // Monkey patching Node methods to be able to detect the insertions and removal of root elements
9062
+ // created via createElement.
9063
+ var _Node$1$prototype = _Node$1.prototype,
9064
+ _appendChild = _Node$1$prototype.appendChild,
9065
+ _insertBefore = _Node$1$prototype.insertBefore,
9066
+ _removeChild = _Node$1$prototype.removeChild,
9067
+ _replaceChild = _Node$1$prototype.replaceChild;
9068
+ assign(_Node$1.prototype, {
9069
+ appendChild: function appendChild(newChild) {
9070
+ var appendedNode = _appendChild.call(this, newChild);
9053
9071
 
9054
- return callNodeSlot(appendedNode, ConnectingSlot);
9055
- },
9056
- insertBefore: function insertBefore(newChild, referenceNode) {
9057
- var insertedNode = _insertBefore2.call(this, newChild, referenceNode);
9072
+ return callNodeSlot(appendedNode, ConnectingSlot);
9073
+ },
9074
+ insertBefore: function insertBefore(newChild, referenceNode) {
9075
+ var insertedNode = _insertBefore.call(this, newChild, referenceNode);
9058
9076
 
9059
- return callNodeSlot(insertedNode, ConnectingSlot);
9060
- },
9061
- removeChild: function removeChild(oldChild) {
9062
- var removedNode = _removeChild2.call(this, oldChild);
9077
+ return callNodeSlot(insertedNode, ConnectingSlot);
9078
+ },
9079
+ removeChild: function removeChild(oldChild) {
9080
+ var removedNode = _removeChild.call(this, oldChild);
9063
9081
 
9064
- return callNodeSlot(removedNode, DisconnectingSlot);
9065
- },
9066
- replaceChild: function replaceChild(newChild, oldChild) {
9067
- var replacedNode = _replaceChild2.call(this, newChild, oldChild);
9082
+ return callNodeSlot(removedNode, DisconnectingSlot);
9083
+ },
9084
+ replaceChild: function replaceChild(newChild, oldChild) {
9085
+ var replacedNode = _replaceChild.call(this, newChild, oldChild);
9068
9086
 
9069
- callNodeSlot(replacedNode, DisconnectingSlot);
9070
- callNodeSlot(newChild, ConnectingSlot);
9071
- return replacedNode;
9072
- }
9073
- });
9087
+ callNodeSlot(replacedNode, DisconnectingSlot);
9088
+ callNodeSlot(newChild, ConnectingSlot);
9089
+ return replacedNode;
9090
+ }
9091
+ });
9092
+ }
9074
9093
  /**
9075
9094
  * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
9076
9095
  * difference that in the options, you can pass the `is` property set to a Constructor instead of
@@ -9083,6 +9102,7 @@ var LWC = (function (exports) {
9083
9102
  * ```
9084
9103
  */
9085
9104
 
9105
+
9086
9106
  function createElement(sel, options) {
9087
9107
  if (!isObject(options) || isNull(options)) {
9088
9108
  throw new TypeError("\"createElement\" function expects an object as second parameter but received \"".concat(toString$1(options), "\"."));
@@ -9110,8 +9130,12 @@ var LWC = (function (exports) {
9110
9130
  mode: options.mode !== 'closed' ? 'open' : 'closed',
9111
9131
  owner: null
9112
9132
  });
9113
- ConnectingSlot.set(elm, connectRootElement);
9114
- DisconnectingSlot.set(elm, disconnectRootElement);
9133
+
9134
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9135
+ ConnectingSlot.set(elm, connectRootElement);
9136
+ DisconnectingSlot.set(elm, disconnectRootElement);
9137
+ }
9138
+
9115
9139
  wasComponentUpgraded = true;
9116
9140
  });
9117
9141
 
@@ -9158,7 +9182,7 @@ var LWC = (function (exports) {
9158
9182
  // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
9159
9183
 
9160
9184
 
9161
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
9185
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
9162
9186
  }
9163
9187
  /*
9164
9188
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9202,7 +9226,7 @@ var LWC = (function (exports) {
9202
9226
  });
9203
9227
  freeze(LightningElement);
9204
9228
  seal(LightningElement.prototype);
9205
- /* version: 2.22.0 */
9229
+ /* version: 2.23.2 */
9206
9230
 
9207
9231
  exports.LightningElement = LightningElement;
9208
9232
  exports.__unstable__ProfilerControl = profilerControl;
@@ -9224,6 +9248,7 @@ var LWC = (function (exports) {
9224
9248
  exports.registerDecorators = registerDecorators;
9225
9249
  exports.registerTemplate = registerTemplate;
9226
9250
  exports.renderer = renderer;
9251
+ exports.rendererFactory = rendererFactory;
9227
9252
  exports.sanitizeAttribute = sanitizeAttribute;
9228
9253
  exports.setFeatureFlag = setFeatureFlag;
9229
9254
  exports.setFeatureFlagForTest = setFeatureFlagForTest;