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
@@ -368,9 +368,13 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.22.0";
371
+ var LWC_VERSION = "2.23.2";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.22.0 */
373
+ /** version: 2.23.2 */
374
+
375
+ /**
376
+ * Copyright (C) 2018 salesforce.com, inc.
377
+ */
374
378
 
375
379
  /*
376
380
  * Copyright (c) 2018, salesforce.com, inc.
@@ -380,7 +384,7 @@
380
384
  */
381
385
 
382
386
  function detect(propName) {
383
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
387
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
384
388
  }
385
389
  /*
386
390
  * Copyright (c) 2018, salesforce.com, inc.
@@ -460,6 +464,8 @@
460
464
  patch$1(propName);
461
465
  }
462
466
  }
467
+ /** version: 2.23.2 */
468
+
463
469
  /**
464
470
  * Copyright (C) 2018 salesforce.com, inc.
465
471
  */
@@ -480,6 +486,7 @@
480
486
  ENABLE_HTML_COLLECTIONS_PATCH: null,
481
487
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
482
488
  ENABLE_MIXED_SHADOW_MODE: null,
489
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
483
490
  ENABLE_NODE_LIST_PATCH: null,
484
491
  ENABLE_NODE_PATCH: null,
485
492
  ENABLE_REACTIVE_SETTER: null,
@@ -492,7 +499,7 @@
492
499
  });
493
500
  }
494
501
 
495
- var runtimeFlags = _globalThis.lwcRuntimeFlags;
502
+ var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
496
503
  /**
497
504
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
498
505
  * flag. It is meant to be used during the app initialization.
@@ -522,10 +529,10 @@
522
529
 
523
530
  if (process.env.NODE_ENV !== 'production') {
524
531
  // Allow the same flag to be set more than once outside of production to enable testing
525
- runtimeFlags[name] = value;
532
+ lwcRuntimeFlags[name] = value;
526
533
  } else {
527
534
  // Disallow the same flag to be set more than once in production
528
- var runtimeValue = runtimeFlags[name];
535
+ var runtimeValue = lwcRuntimeFlags[name];
529
536
 
530
537
  if (!isUndefined$1(runtimeValue)) {
531
538
  // eslint-disable-next-line no-console
@@ -533,7 +540,7 @@
533
540
  return;
534
541
  }
535
542
 
536
- defineProperty(runtimeFlags, name, {
543
+ defineProperty(lwcRuntimeFlags, name, {
537
544
  value: value
538
545
  });
539
546
  }
@@ -549,7 +556,7 @@
549
556
  setFeatureFlag(name, value);
550
557
  }
551
558
  }
552
- /** version: 2.22.0 */
559
+ /** version: 2.23.2 */
553
560
 
554
561
  /*
555
562
  * Copyright (c) 2018, salesforce.com, inc.
@@ -564,7 +571,7 @@
564
571
  window.addEventListener('test-dummy-flag', function () {
565
572
  var hasFlag = false;
566
573
 
567
- if (runtimeFlags.DUMMY_TEST_FLAG) {
574
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
568
575
  hasFlag = true;
569
576
  }
570
577
 
@@ -591,7 +598,7 @@
591
598
  window.addEventListener('test-dummy-flag', function () {
592
599
  var hasFlag = false;
593
600
 
594
- if (runtimeFlags.DUMMY_TEST_FLAG) {
601
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
595
602
  hasFlag = true;
596
603
  }
597
604
 
@@ -991,8 +998,8 @@
991
998
  // to inject at runtime.
992
999
 
993
1000
 
994
- var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
995
- var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
1001
+ var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
1002
+ var HTMLElementPrototype = HTMLElementConstructor.prototype;
996
1003
  /*
997
1004
  * Copyright (c) 2018, salesforce.com, inc.
998
1005
  * All rights reserved.
@@ -1212,10 +1219,10 @@
1212
1219
  }; // Apply extra restriction related to DOM manipulation if the element is not a portal.
1213
1220
 
1214
1221
  if (!options.isLight && !options.isPortal) {
1215
- var _appendChild = elm.appendChild,
1216
- _insertBefore = elm.insertBefore,
1217
- _removeChild = elm.removeChild,
1218
- _replaceChild = elm.replaceChild;
1222
+ var appendChild = elm.appendChild,
1223
+ insertBefore = elm.insertBefore,
1224
+ removeChild = elm.removeChild,
1225
+ replaceChild = elm.replaceChild;
1219
1226
  var originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
1220
1227
  var originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1221
1228
  var originalTextContentDescriptor = getPropertyDescriptor(elm, 'textContent');
@@ -1223,7 +1230,7 @@
1223
1230
  appendChild: generateDataDescriptor({
1224
1231
  value: function value(aChild) {
1225
1232
  logMissingPortalError('appendChild', 'method');
1226
- return _appendChild.call(this, aChild);
1233
+ return appendChild.call(this, aChild);
1227
1234
  }
1228
1235
  }),
1229
1236
  insertBefore: generateDataDescriptor({
@@ -1232,7 +1239,7 @@
1232
1239
  logMissingPortalError('insertBefore', 'method');
1233
1240
  }
1234
1241
 
1235
- return _insertBefore.call(this, newNode, referenceNode);
1242
+ return insertBefore.call(this, newNode, referenceNode);
1236
1243
  }
1237
1244
  }),
1238
1245
  removeChild: generateDataDescriptor({
@@ -1241,13 +1248,13 @@
1241
1248
  logMissingPortalError('removeChild', 'method');
1242
1249
  }
1243
1250
 
1244
- return _removeChild.call(this, aChild);
1251
+ return removeChild.call(this, aChild);
1245
1252
  }
1246
1253
  }),
1247
1254
  replaceChild: generateDataDescriptor({
1248
1255
  value: function value(newChild, oldChild) {
1249
1256
  logMissingPortalError('replaceChild', 'method');
1250
- return _replaceChild.call(this, newChild, oldChild);
1257
+ return replaceChild.call(this, newChild, oldChild);
1251
1258
  }
1252
1259
  }),
1253
1260
  nodeValue: generateAccessorDescriptor({
@@ -1480,6 +1487,15 @@
1480
1487
  function patchLightningElementPrototypeWithRestrictions(proto) {
1481
1488
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1482
1489
  }
1490
+
1491
+ function updateComponentValue(vm, key, newValue) {
1492
+ var cmpFields = vm.cmpFields;
1493
+
1494
+ if (newValue !== cmpFields[key]) {
1495
+ cmpFields[key] = newValue;
1496
+ componentValueMutated(vm, key);
1497
+ }
1498
+ }
1483
1499
  /**
1484
1500
  * Copyright (C) 2017 salesforce.com, inc.
1485
1501
  */
@@ -2375,11 +2391,7 @@
2375
2391
  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."));
2376
2392
  }
2377
2393
 
2378
- if (newValue !== vm.cmpProps[propName]) {
2379
- vm.cmpProps[propName] = newValue;
2380
- componentValueMutated(vm, propName);
2381
- }
2382
-
2394
+ updateComponentValue(vm, propName, newValue);
2383
2395
  return _set.call(vm.elm, newValue);
2384
2396
  }
2385
2397
  };
@@ -2403,9 +2415,8 @@
2403
2415
  var bridge = def.bridge;
2404
2416
 
2405
2417
  if (process.env.NODE_ENV !== 'production') {
2406
- var _assertInstanceOfHTMLElement = vm.renderer.assertInstanceOfHTMLElement;
2407
-
2408
- _assertInstanceOfHTMLElement(vm.elm, "Component creation requires a DOM element to be associated to ".concat(vm, "."));
2418
+ var assertInstanceOfHTMLElement = vm.renderer.assertInstanceOfHTMLElement;
2419
+ assertInstanceOfHTMLElement(vm.elm, "Component creation requires a DOM element to be associated to ".concat(vm, "."));
2409
2420
  }
2410
2421
 
2411
2422
  var component = this;
@@ -2755,11 +2766,7 @@
2755
2766
  },
2756
2767
  set: function set(newValue) {
2757
2768
  var vm = getAssociatedVM(this);
2758
-
2759
- if (newValue !== vm.cmpFields[key]) {
2760
- vm.cmpFields[key] = newValue;
2761
- componentValueMutated(vm, key);
2762
- }
2769
+ updateComponentValue(vm, key, newValue);
2763
2770
  },
2764
2771
  enumerable: true,
2765
2772
  configurable: true
@@ -2913,7 +2920,7 @@
2913
2920
  }
2914
2921
 
2915
2922
  if (_set2) {
2916
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2923
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2917
2924
  var ro = vm.oar[key];
2918
2925
 
2919
2926
  if (isUndefined$1(ro)) {
@@ -2977,11 +2984,7 @@
2977
2984
  }
2978
2985
 
2979
2986
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2980
-
2981
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2982
- vm.cmpFields[key] = reactiveOrAnyValue;
2983
- componentValueMutated(vm, key);
2984
- }
2987
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2985
2988
  },
2986
2989
  enumerable: true,
2987
2990
  configurable: true
@@ -3025,10 +3028,7 @@
3025
3028
  * system to be backward compatible.
3026
3029
  */
3027
3030
 
3028
- if (value !== vm.cmpFields[key]) {
3029
- vm.cmpFields[key] = value;
3030
- componentValueMutated(vm, key);
3031
- }
3031
+ updateComponentValue(vm, key, value);
3032
3032
  },
3033
3033
  enumerable: true,
3034
3034
  configurable: true
@@ -3593,7 +3593,7 @@
3593
3593
  return HTMLBridgeElement;
3594
3594
  }
3595
3595
 
3596
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3596
+ var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
3597
3597
  freeze(BaseBridgeElement);
3598
3598
  seal(BaseBridgeElement.prototype);
3599
3599
  /*
@@ -3685,7 +3685,7 @@
3685
3685
  throw new ReferenceError();
3686
3686
  }
3687
3687
 
3688
- if (runtimeFlags.ENABLE_HMR) {
3688
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3689
3689
  var visited = new Set();
3690
3690
 
3691
3691
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
@@ -3703,7 +3703,7 @@
3703
3703
  throw new ReferenceError();
3704
3704
  }
3705
3705
 
3706
- if (runtimeFlags.ENABLE_HMR) {
3706
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3707
3707
  var visited = new Set();
3708
3708
 
3709
3709
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
@@ -3721,7 +3721,7 @@
3721
3721
  throw new ReferenceError();
3722
3722
  }
3723
3723
 
3724
- if (runtimeFlags.ENABLE_HMR) {
3724
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3725
3725
  var visited = new Set();
3726
3726
 
3727
3727
  while (swappedStyleMap.has(style) && !visited.has(style)) {
@@ -3739,7 +3739,7 @@
3739
3739
  throw new ReferenceError();
3740
3740
  }
3741
3741
 
3742
- if (runtimeFlags.ENABLE_HMR) {
3742
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3743
3743
  // tracking active component
3744
3744
  var Ctor = vm.def.ctor;
3745
3745
  var componentVMs = activeComponents.get(Ctor);
@@ -3797,7 +3797,7 @@
3797
3797
  throw new ReferenceError();
3798
3798
  }
3799
3799
 
3800
- if (runtimeFlags.ENABLE_HMR) {
3800
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3801
3801
  // tracking inactive component
3802
3802
  var Ctor = vm.def.ctor;
3803
3803
  var list = activeComponents.get(Ctor);
@@ -3845,7 +3845,7 @@
3845
3845
  }
3846
3846
  }
3847
3847
 
3848
- if (!runtimeFlags.ENABLE_HMR) {
3848
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3849
3849
  throw new Error('HMR is not enabled');
3850
3850
  }
3851
3851
 
@@ -3862,7 +3862,7 @@
3862
3862
  }
3863
3863
  }
3864
3864
 
3865
- if (!runtimeFlags.ENABLE_HMR) {
3865
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3866
3866
  throw new Error('HMR is not enabled');
3867
3867
  }
3868
3868
 
@@ -3877,7 +3877,7 @@
3877
3877
  return rehydrateHotStyle(oldStyle);
3878
3878
  }
3879
3879
 
3880
- if (!runtimeFlags.ENABLE_HMR) {
3880
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3881
3881
  throw new Error('HMR is not enabled');
3882
3882
  }
3883
3883
 
@@ -4351,9 +4351,7 @@
4351
4351
  function createStylesheet(vm, stylesheets) {
4352
4352
  var renderMode = vm.renderMode,
4353
4353
  shadowMode = vm.shadowMode,
4354
- _vm$renderer2 = vm.renderer,
4355
- ssr = _vm$renderer2.ssr,
4356
- insertStylesheet = _vm$renderer2.insertStylesheet;
4354
+ insertStylesheet = vm.renderer.insertStylesheet;
4357
4355
 
4358
4356
  if (renderMode === 1
4359
4357
  /* RenderMode.Shadow */
@@ -4363,7 +4361,7 @@
4363
4361
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4364
4362
  insertStylesheet(stylesheets[_i12]);
4365
4363
  }
4366
- } else if (ssr || vm.hydrated) {
4364
+ } else if (vm.hydrated) {
4367
4365
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4368
4366
  // This works in the client, because the stylesheets are created, and cached in the VM
4369
4367
  // the first time the VM renders.
@@ -4390,6 +4388,18 @@
4390
4388
  */
4391
4389
 
4392
4390
 
4391
+ function checkHasVM(elm) {
4392
+ var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
4393
+
4394
+ if (process.env.NODE_ENV !== 'production' && !hasVM) {
4395
+ // Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
4396
+ // we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
4397
+ 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.");
4398
+ }
4399
+
4400
+ return hasVM;
4401
+ }
4402
+
4393
4403
  function getUpgradableConstructor(tagName, renderer) {
4394
4404
  var getCustomElement = renderer.getCustomElement,
4395
4405
  RendererHTMLElement = renderer.HTMLElementExported,
@@ -4431,6 +4441,20 @@
4431
4441
  return _createClass(LWCUpgradableElement);
4432
4442
  }(RendererHTMLElement);
4433
4443
 
4444
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4445
+ CE.prototype.connectedCallback = function () {
4446
+ if (checkHasVM(this)) {
4447
+ connectRootElement(this);
4448
+ }
4449
+ };
4450
+
4451
+ CE.prototype.disconnectedCallback = function () {
4452
+ if (checkHasVM(this)) {
4453
+ disconnectRootElement(this);
4454
+ }
4455
+ };
4456
+ }
4457
+
4434
4458
  defineCustomElement(tagName, CE);
4435
4459
  return CE;
4436
4460
  }
@@ -4542,6 +4566,15 @@
4542
4566
  // different than the one previously set.
4543
4567
 
4544
4568
  if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
4569
+ // Additional verification if properties are supported by the element
4570
+ // Validation relies on html properties and public properties being defined on the element,
4571
+ // SSR has its own custom validation.
4572
+ if (process.env.NODE_ENV !== 'production') {
4573
+ if (!(key in elm)) {
4574
+ 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."));
4575
+ }
4576
+ }
4577
+
4545
4578
  setProperty(elm, key, cur);
4546
4579
  }
4547
4580
  }
@@ -4749,7 +4782,7 @@
4749
4782
  }
4750
4783
  }
4751
4784
 
4752
- function patch(n1, n2, renderer) {
4785
+ function patch(n1, n2, parent, renderer) {
4753
4786
  var _a, _b;
4754
4787
 
4755
4788
  if (n1 === n2) {
@@ -4798,7 +4831,7 @@
4798
4831
  case 3
4799
4832
  /* VNodeType.CustomElement */
4800
4833
  :
4801
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4834
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4802
4835
  break;
4803
4836
  }
4804
4837
  }
@@ -4954,13 +4987,19 @@
4954
4987
  insertNode(elm, parent, anchor, renderer);
4955
4988
 
4956
4989
  if (vm) {
4957
- if (process.env.NODE_ENV !== 'production') {
4958
- assert.isTrue(vm.state === 0
4959
- /* VMState.created */
4960
- , "".concat(vm, " cannot be recycled."));
4961
- }
4990
+ {
4991
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4992
+ if (process.env.NODE_ENV !== 'production') {
4993
+ // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4994
+ // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
4995
+ assert.isTrue(vm.state === 0
4996
+ /* VMState.created */
4997
+ , "".concat(vm, " cannot be recycled."));
4998
+ }
4962
4999
 
4963
- runConnectedCallback(vm);
5000
+ runConnectedCallback(vm);
5001
+ }
5002
+ }
4964
5003
  }
4965
5004
 
4966
5005
  mountVNodes(vnode.children, elm, renderer, null);
@@ -4970,25 +5009,34 @@
4970
5009
  }
4971
5010
  }
4972
5011
 
4973
- function patchCustomElement(n1, n2, renderer) {
4974
- var elm = n2.elm = n1.elm;
4975
- var vm = n2.vm = n1.vm;
4976
- patchElementPropsAndAttrs$1(n1, n2, renderer);
5012
+ function patchCustomElement(n1, n2, parent, renderer) {
5013
+ if (n1.ctor !== n2.ctor) {
5014
+ // If the constructor, unmount the current component and mount a new one using the new
5015
+ // constructor.
5016
+ var anchor = renderer.nextSibling(n1.elm);
5017
+ unmount(n1, parent, renderer, true);
5018
+ mountCustomElement(n2, parent, anchor, renderer);
5019
+ } else {
5020
+ // Otherwise patch the existing component with new props/attrs/etc.
5021
+ var elm = n2.elm = n1.elm;
5022
+ var vm = n2.vm = n1.vm;
5023
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4977
5024
 
4978
- if (!isUndefined$1(vm)) {
4979
- // in fallback mode, the allocation will always set children to
4980
- // empty and delegate the real allocation to the slot elements
4981
- allocateChildren(n2, vm);
4982
- } // in fallback mode, the children will be always empty, so, nothing
4983
- // will happen, but in native, it does allocate the light dom
5025
+ if (!isUndefined$1(vm)) {
5026
+ // in fallback mode, the allocation will always set children to
5027
+ // empty and delegate the real allocation to the slot elements
5028
+ allocateChildren(n2, vm);
5029
+ } // in fallback mode, the children will be always empty, so, nothing
5030
+ // will happen, but in native, it does allocate the light dom
4984
5031
 
4985
5032
 
4986
- patchChildren(n1.children, n2.children, elm, renderer);
5033
+ patchChildren(n1.children, n2.children, elm, renderer);
4987
5034
 
4988
- if (!isUndefined$1(vm)) {
4989
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4990
- // this is important to preserve the top to bottom synchronous rendering phase.
4991
- rerenderVM(vm);
5035
+ if (!isUndefined$1(vm)) {
5036
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
5037
+ // this is important to preserve the top to bottom synchronous rendering phase.
5038
+ rerenderVM(vm);
5039
+ }
4992
5040
  }
4993
5041
  }
4994
5042
 
@@ -5141,10 +5189,10 @@
5141
5189
  var scopeToken = getScopeTokenClass(owner);
5142
5190
 
5143
5191
  if (!isNull(scopeToken)) {
5144
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5192
+ var getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5145
5193
  // probably we should have a renderer api for just the add operation
5146
5194
 
5147
- _getClassList(elm).add(scopeToken);
5195
+ getClassList(elm).add(scopeToken);
5148
5196
  } // Set property element for synthetic shadow DOM style scoping.
5149
5197
 
5150
5198
 
@@ -5357,22 +5405,22 @@
5357
5405
  } else if (!isVNode(newEndVnode)) {
5358
5406
  newEndVnode = newCh[--newEndIdx];
5359
5407
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5360
- patch(oldStartVnode, newStartVnode, renderer);
5408
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5361
5409
  oldStartVnode = oldCh[++oldStartIdx];
5362
5410
  newStartVnode = newCh[++newStartIdx];
5363
5411
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5364
- patch(oldEndVnode, newEndVnode, renderer);
5412
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5365
5413
  oldEndVnode = oldCh[--oldEndIdx];
5366
5414
  newEndVnode = newCh[--newEndIdx];
5367
5415
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5368
5416
  // Vnode moved right
5369
- patch(oldStartVnode, newEndVnode, renderer);
5417
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5370
5418
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5371
5419
  oldStartVnode = oldCh[++oldStartIdx];
5372
5420
  newEndVnode = newCh[--newEndIdx];
5373
5421
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5374
5422
  // Vnode moved left
5375
- patch(oldEndVnode, newStartVnode, renderer);
5423
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5376
5424
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5377
5425
  oldEndVnode = oldCh[--oldEndIdx];
5378
5426
  newStartVnode = newCh[++newStartIdx];
@@ -5395,7 +5443,7 @@
5395
5443
  // New element
5396
5444
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5397
5445
  } else {
5398
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5446
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5399
5447
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5400
5448
  // so we only care about the `oldCh` object inside this function.
5401
5449
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5465,7 +5513,7 @@
5465
5513
  if (isVNode(n1)) {
5466
5514
  if (isVNode(n2)) {
5467
5515
  // both vnodes are equivalent, and we just need to patch them
5468
- patch(n1, n2, renderer);
5516
+ patch(n1, n2, parent, renderer);
5469
5517
  anchor = n2.elm;
5470
5518
  } else {
5471
5519
  // removing the old vnode since the new one is null
@@ -5880,19 +5928,11 @@
5880
5928
 
5881
5929
  return url;
5882
5930
  }
5883
- /**
5884
- * Map to store an index value assigned to any dynamic component reference ingested
5885
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5886
- * component reference to avoid diffing algo mismatches.
5887
- */
5888
-
5889
-
5890
- var DynamicImportedComponentMap = new Map();
5891
- var dynamicImportedComponentCounter = 0;
5892
5931
  /**
5893
5932
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5894
5933
  */
5895
5934
 
5935
+
5896
5936
  function dc(sel, Ctor, data) {
5897
5937
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5898
5938
 
@@ -5911,22 +5951,7 @@
5911
5951
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5912
5952
  }
5913
5953
 
5914
- var idx = DynamicImportedComponentMap.get(Ctor);
5915
-
5916
- if (isUndefined$1(idx)) {
5917
- idx = dynamicImportedComponentCounter++;
5918
- DynamicImportedComponentMap.set(Ctor, idx);
5919
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5920
- // to identify different constructors as vnodes with different keys to avoid reusing the
5921
- // element used for previous constructors.
5922
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5923
- // hoisting optimization.
5924
-
5925
-
5926
- var newData = Object.assign(Object.assign({}, data), {
5927
- key: "dc:".concat(idx, ":").concat(data.key)
5928
- });
5929
- return c(sel, Ctor, newData, children);
5954
+ return c(sel, Ctor, data, children);
5930
5955
  }
5931
5956
  /**
5932
5957
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6773,7 +6798,7 @@
6773
6798
  return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
6774
6799
  };
6775
6800
 
6776
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6801
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6777
6802
  vm.shadowMode = 0
6778
6803
  /* ShadowMode.Native */
6779
6804
  ;
@@ -6808,7 +6833,7 @@
6808
6833
  } else if (isNativeShadowDefined) {
6809
6834
  // Not combined with above condition because @lwc/features only supports identifiers in
6810
6835
  // the if-condition.
6811
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6836
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6812
6837
  if (def.shadowSupportMode === "any"
6813
6838
  /* ShadowSupportMode.Any */
6814
6839
  ) {
@@ -6934,13 +6959,7 @@
6934
6959
  }
6935
6960
 
6936
6961
  function runRenderedCallback(vm) {
6937
- var renderedCallback = vm.def.renderedCallback,
6938
- ssr = vm.renderer.ssr;
6939
-
6940
- if (isTrue(ssr)) {
6941
- return;
6942
- }
6943
-
6962
+ var renderedCallback = vm.def.renderedCallback;
6944
6963
  var rendered = Services.rendered;
6945
6964
 
6946
6965
  if (rendered) {
@@ -7172,9 +7191,7 @@
7172
7191
  }
7173
7192
 
7174
7193
  function scheduleRehydration(vm) {
7175
- var ssr = vm.renderer.ssr;
7176
-
7177
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7194
+ if (isTrue(vm.isScheduled)) {
7178
7195
  return;
7179
7196
  }
7180
7197
 
@@ -7296,13 +7313,8 @@
7296
7313
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7297
7314
 
7298
7315
  function createFieldDataCallback(vm, name) {
7299
- var cmpFields = vm.cmpFields;
7300
7316
  return function (value) {
7301
- if (value !== vm.cmpFields[name]) {
7302
- // storing the value in the underlying storage
7303
- cmpFields[name] = value;
7304
- componentValueMutated(vm, name);
7305
- }
7317
+ updateComponentValue(vm, name, value);
7306
7318
  };
7307
7319
  }
7308
7320
 
@@ -7515,7 +7527,7 @@
7515
7527
  ArrayPush$1.call(wiredConnecting, function () {
7516
7528
  connector.connect();
7517
7529
 
7518
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7530
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
7519
7531
  if (hasDynamicParams) {
7520
7532
  Promise.resolve().then(computeConfigAndUpdate);
7521
7533
  return;
@@ -7695,6 +7707,8 @@
7695
7707
  return renderer.nextSibling(hydratedNode);
7696
7708
  }
7697
7709
 
7710
+ var NODE_VALUE_PROP = 'nodeValue';
7711
+
7698
7712
  function hydrateText(node, vnode, renderer) {
7699
7713
  var _a;
7700
7714
 
@@ -7705,9 +7719,8 @@
7705
7719
  }
7706
7720
 
7707
7721
  if (process.env.NODE_ENV !== 'production') {
7708
- var _getProperty = renderer.getProperty;
7709
-
7710
- var nodeValue = _getProperty(node, 'nodeValue');
7722
+ var getProperty = renderer.getProperty;
7723
+ var nodeValue = getProperty(node, NODE_VALUE_PROP);
7711
7724
 
7712
7725
  if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === '')) {
7713
7726
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
@@ -7730,9 +7743,8 @@
7730
7743
  }
7731
7744
 
7732
7745
  if (process.env.NODE_ENV !== 'production') {
7733
- var _getProperty2 = renderer.getProperty;
7734
-
7735
- var nodeValue = _getProperty2(node, 'nodeValue');
7746
+ var getProperty = renderer.getProperty;
7747
+ var nodeValue = getProperty(node, NODE_VALUE_PROP);
7736
7748
 
7737
7749
  if (nodeValue !== vnode.text) {
7738
7750
  logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
@@ -7740,7 +7752,7 @@
7740
7752
  }
7741
7753
 
7742
7754
  var setProperty = renderer.setProperty;
7743
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
7755
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
7744
7756
  vnode.elm = node;
7745
7757
  return node;
7746
7758
  }
@@ -7772,17 +7784,17 @@
7772
7784
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
7773
7785
  // remove the innerHTML from props so it reuses the existing dom elements.
7774
7786
  var props = vnode.data.props;
7775
- var _getProperty3 = renderer.getProperty;
7787
+ var getProperty = renderer.getProperty;
7776
7788
 
7777
7789
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
7778
- if (_getProperty3(elm, 'innerHTML') === props.innerHTML) {
7790
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
7779
7791
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
7780
7792
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
7781
7793
  props: cloneAndOmitKey(props, 'innerHTML')
7782
7794
  });
7783
7795
  } else {
7784
7796
  if (process.env.NODE_ENV !== 'production') {
7785
- logWarn("Mismatch hydrating element <".concat(_getProperty3(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), owner);
7797
+ logWarn("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), owner);
7786
7798
  }
7787
7799
  }
7788
7800
  }
@@ -7791,8 +7803,8 @@
7791
7803
  patchElementPropsAndAttrs(vnode, renderer);
7792
7804
 
7793
7805
  if (!isDomManual) {
7794
- var _getFirstChild = renderer.getFirstChild;
7795
- hydrateChildren(_getFirstChild(elm), vnode.children, elm, owner);
7806
+ var getFirstChild = renderer.getFirstChild;
7807
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
7796
7808
  }
7797
7809
 
7798
7810
  return elm;
@@ -7831,10 +7843,10 @@
7831
7843
  if (vm.renderMode !== 0
7832
7844
  /* RenderMode.Light */
7833
7845
  ) {
7834
- var _getFirstChild2 = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
7846
+ var getFirstChild = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
7835
7847
  // Note: for Light DOM, this is handled while hydrating the VM
7836
7848
 
7837
- hydrateChildren(_getFirstChild2(elm), vnode.children, elm, vm);
7849
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
7838
7850
  }
7839
7851
 
7840
7852
  hydrateVM(vm);
@@ -7883,11 +7895,11 @@
7883
7895
  // next node in the list to be hydrated.
7884
7896
 
7885
7897
 
7886
- var _nextSibling = renderer.nextSibling;
7898
+ var nextSibling = renderer.nextSibling;
7887
7899
 
7888
7900
  do {
7889
7901
  var current = nextNode;
7890
- nextNode = _nextSibling(nextNode);
7902
+ nextNode = nextSibling(nextNode);
7891
7903
  removeNode(current, parentNode, renderer);
7892
7904
  } while (nextNode);
7893
7905
  }
@@ -7950,14 +7962,13 @@
7950
7962
  attrValue = _Object$entries$_i[1];
7951
7963
 
7952
7964
  var owner = vnode.owner;
7953
- var _getAttribute = renderer.getAttribute;
7954
-
7955
- var elmAttrValue = _getAttribute(elm, attrName);
7965
+ var getAttribute = renderer.getAttribute;
7966
+ var elmAttrValue = getAttribute(elm, attrName);
7956
7967
 
7957
7968
  if (String(attrValue) !== elmAttrValue) {
7958
7969
  if (process.env.NODE_ENV !== 'production') {
7959
- var _getProperty4 = renderer.getProperty;
7960
- logError("Mismatch hydrating element <".concat(_getProperty4(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), owner);
7970
+ var getProperty = renderer.getProperty;
7971
+ logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), owner);
7961
7972
  }
7962
7973
 
7963
7974
  nodesAreCompatible = false;
@@ -8068,8 +8079,8 @@
8068
8079
 
8069
8080
  if (!nodesAreCompatible) {
8070
8081
  if (process.env.NODE_ENV !== 'production') {
8071
- var _getProperty5 = renderer.getProperty;
8072
- logError("Mismatch hydrating element <".concat(_getProperty5(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
8082
+ var getProperty = renderer.getProperty;
8083
+ logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
8073
8084
  }
8074
8085
  }
8075
8086
 
@@ -8089,7 +8100,7 @@
8089
8100
  return false;
8090
8101
  }
8091
8102
 
8092
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
8103
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
8093
8104
  }
8094
8105
 
8095
8106
  if (getProperty(client, 'nodeType') === 8
@@ -8101,7 +8112,7 @@
8101
8112
  return false;
8102
8113
  }
8103
8114
 
8104
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
8115
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
8105
8116
  }
8106
8117
 
8107
8118
  if (!hasCorrectNodeType(vnode, ssr, 1
@@ -8301,7 +8312,7 @@
8301
8312
 
8302
8313
  return ctor;
8303
8314
  }
8304
- /* version: 2.22.0 */
8315
+ /* version: 2.23.2 */
8305
8316
 
8306
8317
  /*
8307
8318
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8468,379 +8479,395 @@
8468
8479
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8469
8480
  */
8470
8481
 
8482
+ /**
8483
+ * A factory function that produces a renderer.
8484
+ * Renderer encapsulates operations that are required to render an LWC component into the underlying
8485
+ * runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
8486
+ * Example usage:
8487
+ * import { renderer, rendererFactory } from 'lwc';
8488
+ * const customRenderer = rendererFactory(renderer);
8489
+ *
8490
+ * @param baseRenderer Either null or the base renderer imported from 'lwc'.
8491
+ */
8471
8492
 
8472
- var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8473
- var createFragment;
8474
8493
 
8475
- if (SUPPORTS_TEMPLATE) {
8476
- // Parse the fragment HTML string into DOM
8477
- createFragment = function createFragment(html) {
8478
- var template = document.createElement('template');
8479
- template.innerHTML = html;
8480
- return template.content.firstChild;
8481
- };
8482
- } else {
8483
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8484
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8485
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8486
- // With other elements added from:
8487
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8488
- // Using the test:
8489
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8490
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8491
- var topLevelWrappingMap = {
8492
- caption: ['table'],
8493
- col: ['colgroup', 'table'],
8494
- colgroup: ['table'],
8495
- option: ['select'],
8496
- tbody: ['table'],
8497
- td: ['tr', 'tbody', 'table'],
8498
- th: ['tr', 'tbody', 'table'],
8499
- thead: ['table'],
8500
- tfoot: ['table'],
8501
- tr: ['tbody', 'table']
8502
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8503
-
8504
- var getTagName = function getTagName(text) {
8505
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8506
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8507
-
8508
-
8509
- createFragment = function createFragment(html) {
8510
- var wrapperTags = topLevelWrappingMap[getTagName(html)];
8511
-
8512
- if (!isUndefined$1(wrapperTags)) {
8513
- var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8514
- _step5;
8494
+ function rendererFactory(baseRenderer) {
8495
+ // Util functions
8496
+ function assertInvariant(value, msg) {
8497
+ if (!value) {
8498
+ throw new Error("Invariant Violation: ".concat(msg));
8499
+ }
8500
+ }
8515
8501
 
8516
- try {
8517
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8518
- var wrapperTag = _step5.value;
8519
- html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8520
- }
8521
- } catch (err) {
8522
- _iterator5.e(err);
8523
- } finally {
8524
- _iterator5.f();
8525
- }
8526
- } // For IE11, the document title must not be undefined, but it can be an empty string
8527
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8502
+ function isNull(obj) {
8503
+ return obj === null;
8504
+ }
8528
8505
 
8506
+ function isUndefined(obj) {
8507
+ return obj === undefined;
8508
+ }
8529
8509
 
8530
- var doc = document.implementation.createHTMLDocument('');
8531
- doc.body.innerHTML = html;
8532
- var content = doc.body;
8510
+ var getCustomElement;
8511
+ var defineCustomElement;
8512
+ var HTMLElementConstructor;
8533
8513
 
8534
- if (!isUndefined$1(wrapperTags)) {
8535
- for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8536
- content = content.firstChild;
8537
- }
8514
+ function isCustomElementRegistryAvailable() {
8515
+ if (typeof customElements === 'undefined') {
8516
+ return false;
8538
8517
  }
8539
8518
 
8540
- return content.firstChild;
8541
- };
8542
- }
8543
- /*
8544
- * Copyright (c) 2018, salesforce.com, inc.
8545
- * All rights reserved.
8546
- * SPDX-License-Identifier: MIT
8547
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8548
- */
8519
+ try {
8520
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
8521
+ // _wrapNativeSuper()
8522
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8523
+ // get wrapped by babel.
8524
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8525
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8526
+ // which are not equipped to be initialized that way.
8549
8527
 
8528
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8529
+ _inherits(clazz, _HTMLElementAlias);
8550
8530
 
8551
- var getCustomElement;
8552
- var defineCustomElement;
8553
- var HTMLElementConstructor;
8531
+ var _super7 = _createSuper(clazz);
8554
8532
 
8555
- function isCustomElementRegistryAvailable() {
8556
- if (typeof customElements === 'undefined') {
8557
- return false;
8558
- }
8533
+ function clazz() {
8534
+ _classCallCheck(this, clazz);
8559
8535
 
8560
- try {
8561
- // dereference HTMLElement global because babel wraps globals in compat mode with a
8562
- // _wrapNativeSuper()
8563
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
8564
- // get wrapped by babel.
8565
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
8566
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8567
- // which are not equipped to be initialized that way.
8536
+ return _super7.apply(this, arguments);
8537
+ }
8568
8538
 
8569
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
8570
- _inherits(clazz, _HTMLElementAlias);
8539
+ return _createClass(clazz);
8540
+ }(HTMLElementAlias);
8571
8541
 
8572
- var _super7 = _createSuper(clazz);
8542
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8543
+ new clazz();
8544
+ return true;
8545
+ } catch (_a) {
8546
+ return false;
8547
+ }
8548
+ }
8573
8549
 
8574
- function clazz() {
8575
- _classCallCheck(this, clazz);
8550
+ if (isCustomElementRegistryAvailable()) {
8551
+ getCustomElement = customElements.get.bind(customElements);
8552
+ defineCustomElement = customElements.define.bind(customElements);
8553
+ HTMLElementConstructor = HTMLElement;
8554
+ } else {
8555
+ var registry = Object.create(null);
8556
+ var reverseRegistry = new WeakMap();
8576
8557
 
8577
- return _super7.apply(this, arguments);
8558
+ defineCustomElement = function define(name, ctor) {
8559
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
8560
+ throw new TypeError("Invalid Registration");
8578
8561
  }
8579
8562
 
8580
- return _createClass(clazz);
8581
- }(HTMLElementAlias);
8563
+ registry[name] = ctor;
8564
+ reverseRegistry.set(ctor, name);
8565
+ };
8582
8566
 
8583
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8584
- new clazz();
8585
- return true;
8586
- } catch (_a) {
8587
- return false;
8588
- }
8589
- }
8567
+ getCustomElement = function get(name) {
8568
+ return registry[name];
8569
+ };
8590
8570
 
8591
- if (isCustomElementRegistryAvailable()) {
8592
- getCustomElement = customElements.get.bind(customElements);
8593
- defineCustomElement = customElements.define.bind(customElements);
8594
- HTMLElementConstructor = HTMLElement;
8595
- } else {
8596
- var registry = create(null);
8597
- var reverseRegistry = new WeakMap();
8571
+ HTMLElementConstructor = function HTMLElement() {
8572
+ if (!(this instanceof HTMLElement)) {
8573
+ throw new TypeError("Invalid Invocation");
8574
+ }
8598
8575
 
8599
- defineCustomElement = function define(name, ctor) {
8600
- if (name !== StringToLowerCase.call(name) || registry[name]) {
8601
- throw new TypeError("Invalid Registration");
8602
- }
8576
+ var constructor = this.constructor;
8577
+ var name = reverseRegistry.get(constructor);
8603
8578
 
8604
- registry[name] = ctor;
8605
- reverseRegistry.set(ctor, name);
8606
- };
8579
+ if (!name) {
8580
+ throw new TypeError("Invalid Construction");
8581
+ }
8607
8582
 
8608
- getCustomElement = function get(name) {
8609
- return registry[name];
8610
- };
8583
+ var elm = document.createElement(name);
8584
+ Object.setPrototypeOf(elm, constructor.prototype);
8585
+ return elm;
8586
+ };
8611
8587
 
8612
- HTMLElementConstructor = function HTMLElement() {
8613
- if (!(this instanceof HTMLElement)) {
8614
- throw new TypeError("Invalid Invocation");
8615
- }
8588
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
8589
+ }
8616
8590
 
8617
- var constructor = this.constructor;
8618
- var name = reverseRegistry.get(constructor);
8591
+ function cloneNode(node, deep) {
8592
+ return node.cloneNode(deep);
8593
+ }
8619
8594
 
8620
- if (!name) {
8621
- throw new TypeError("Invalid Construction");
8622
- }
8595
+ function createElement(tagName, namespace) {
8596
+ return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8597
+ }
8623
8598
 
8624
- var elm = document.createElement(name);
8625
- setPrototypeOf(elm, constructor.prototype);
8626
- return elm;
8627
- };
8599
+ function createText(content) {
8600
+ return document.createTextNode(content);
8601
+ }
8628
8602
 
8629
- HTMLElementConstructor.prototype = HTMLElement.prototype;
8630
- }
8603
+ function createComment(content) {
8604
+ return document.createComment(content);
8605
+ }
8631
8606
 
8632
- var hydrating = false;
8607
+ var createFragment; // IE11 lacks support for this feature
8633
8608
 
8634
- function setIsHydrating(value) {
8635
- hydrating = value;
8636
- }
8609
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8637
8610
 
8638
- var ssr = false;
8611
+ if (SUPPORTS_TEMPLATE) {
8612
+ // Parse the fragment HTML string into DOM
8613
+ createFragment = function createFragment(html) {
8614
+ var template = document.createElement('template');
8615
+ template.innerHTML = html;
8616
+ return template.content.firstChild;
8617
+ };
8618
+ } else {
8619
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8620
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8621
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8622
+ // With other elements added from:
8623
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8624
+ // Using the test:
8625
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8626
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8627
+ var topLevelWrappingMap = {
8628
+ caption: ['table'],
8629
+ col: ['colgroup', 'table'],
8630
+ colgroup: ['table'],
8631
+ option: ['select'],
8632
+ tbody: ['table'],
8633
+ td: ['tr', 'tbody', 'table'],
8634
+ th: ['tr', 'tbody', 'table'],
8635
+ thead: ['table'],
8636
+ tfoot: ['table'],
8637
+ tr: ['tbody', 'table']
8638
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8639
+
8640
+ var getTagName = function getTagName(text) {
8641
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8642
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8643
+
8644
+
8645
+ createFragment = function createFragment(html) {
8646
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8647
+
8648
+ if (!isUndefined(wrapperTags)) {
8649
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8650
+ _step5;
8651
+
8652
+ try {
8653
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8654
+ var wrapperTag = _step5.value;
8655
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8656
+ }
8657
+ } catch (err) {
8658
+ _iterator5.e(err);
8659
+ } finally {
8660
+ _iterator5.f();
8661
+ }
8662
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8663
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8639
8664
 
8640
- function isHydrating() {
8641
- return hydrating;
8642
- }
8643
8665
 
8644
- var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8645
- var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8666
+ var doc = document.implementation.createHTMLDocument('');
8667
+ doc.body.innerHTML = html;
8668
+ var content = doc.body;
8646
8669
 
8647
- function cloneNode(node, deep) {
8648
- return node.cloneNode(deep);
8649
- }
8670
+ if (!isUndefined(wrapperTags)) {
8671
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8672
+ content = content.firstChild;
8673
+ }
8674
+ }
8650
8675
 
8651
- function createElement$1(tagName, namespace) {
8652
- return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8653
- }
8676
+ return content.firstChild;
8677
+ };
8678
+ }
8654
8679
 
8655
- function createText(content) {
8656
- return document.createTextNode(content);
8657
- }
8680
+ function insert(node, parent, anchor) {
8681
+ parent.insertBefore(node, anchor);
8682
+ }
8658
8683
 
8659
- function createComment(content) {
8660
- return document.createComment(content);
8661
- }
8684
+ function remove(node, parent) {
8685
+ parent.removeChild(node);
8686
+ }
8662
8687
 
8663
- function insert(node, parent, anchor) {
8664
- parent.insertBefore(node, anchor);
8665
- }
8688
+ function nextSibling(node) {
8689
+ return node.nextSibling;
8690
+ }
8666
8691
 
8667
- function remove(node, parent) {
8668
- parent.removeChild(node);
8669
- }
8692
+ function attachShadow(element, options) {
8693
+ // `shadowRoot` will be non-null in two cases:
8694
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8695
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
8696
+ // root component with customElement.define('c-app', Ctor)
8697
+ if (!isNull(element.shadowRoot)) {
8698
+ return element.shadowRoot;
8699
+ }
8670
8700
 
8671
- function nextSibling(node) {
8672
- return node.nextSibling;
8673
- }
8701
+ return element.attachShadow(options);
8702
+ }
8674
8703
 
8675
- function attachShadow(element, options) {
8676
- // `hydrating` will be true in two cases:
8677
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8678
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
8679
- // root component with customeElement.define('c-app', Ctor)
8680
- //
8681
- // The second case can be treated as a failed hydration with nominal impact
8682
- // to performance. However, because <c-app> won't have a <template shadowroot>
8683
- // declarative child, `element.shadowRoot` is `null`.
8684
- if (hydrating && element.shadowRoot) {
8685
- return element.shadowRoot;
8704
+ function setText(node, content) {
8705
+ node.nodeValue = content;
8686
8706
  }
8687
8707
 
8688
- return element.attachShadow(options);
8689
- }
8708
+ function getProperty(node, key) {
8709
+ return node[key];
8710
+ }
8690
8711
 
8691
- function setText(node, content) {
8692
- node.nodeValue = content;
8693
- }
8712
+ function setProperty(node, key, value) {
8713
+ node[key] = value;
8714
+ }
8694
8715
 
8695
- function getProperty(node, key) {
8696
- return node[key];
8697
- }
8716
+ function getAttribute(element, name, namespace) {
8717
+ return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8718
+ }
8698
8719
 
8699
- function setProperty(node, key, value) {
8700
- if (process.env.NODE_ENV !== 'production') {
8701
- if (node instanceof Element && !(key in node)) {
8702
- // TODO [#1297]: Move this validation to the compiler
8703
- assert.fail("Unknown public property \"".concat(key, "\" of element <").concat(node.tagName, ">. This is likely a typo on the corresponding attribute \"").concat(htmlPropertyToAttribute(key), "\"."));
8720
+ function setAttribute(element, name, value, namespace) {
8721
+ return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8722
+ }
8723
+
8724
+ function removeAttribute(element, name, namespace) {
8725
+ if (isUndefined(namespace)) {
8726
+ element.removeAttribute(name);
8727
+ } else {
8728
+ element.removeAttributeNS(namespace, name);
8704
8729
  }
8705
8730
  }
8706
8731
 
8707
- node[key] = value;
8708
- }
8732
+ function addEventListener(target, type, callback, options) {
8733
+ target.addEventListener(type, callback, options);
8734
+ }
8709
8735
 
8710
- function getAttribute(element, name, namespace) {
8711
- return isUndefined$1(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
8712
- }
8736
+ function removeEventListener(target, type, callback, options) {
8737
+ target.removeEventListener(type, callback, options);
8738
+ }
8713
8739
 
8714
- function setAttribute(element, name, value, namespace) {
8715
- return isUndefined$1(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
8716
- }
8740
+ function dispatchEvent(target, event) {
8741
+ return target.dispatchEvent(event);
8742
+ }
8717
8743
 
8718
- function removeAttribute(element, name, namespace) {
8719
- if (isUndefined$1(namespace)) {
8720
- element.removeAttribute(name);
8721
- } else {
8722
- element.removeAttributeNS(namespace, name);
8744
+ function getClassList(element) {
8745
+ return element.classList;
8723
8746
  }
8724
- }
8725
8747
 
8726
- function addEventListener(target, type, callback, options) {
8727
- target.addEventListener(type, callback, options);
8728
- }
8748
+ function setCSSStyleProperty(element, name, value, important) {
8749
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
8750
+ // represent elements in the engine?
8751
+ element.style.setProperty(name, value, important ? 'important' : '');
8752
+ }
8729
8753
 
8730
- function removeEventListener(target, type, callback, options) {
8731
- target.removeEventListener(type, callback, options);
8732
- }
8754
+ function getBoundingClientRect(element) {
8755
+ return element.getBoundingClientRect();
8756
+ }
8733
8757
 
8734
- function dispatchEvent(target, event) {
8735
- return target.dispatchEvent(event);
8736
- }
8758
+ function querySelector(element, selectors) {
8759
+ return element.querySelector(selectors);
8760
+ }
8737
8761
 
8738
- function getClassList(element) {
8739
- return element.classList;
8740
- }
8762
+ function querySelectorAll(element, selectors) {
8763
+ return element.querySelectorAll(selectors);
8764
+ }
8741
8765
 
8742
- function setCSSStyleProperty(element, name, value, important) {
8743
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
8744
- // represent elements in the engine?
8745
- element.style.setProperty(name, value, important ? 'important' : '');
8746
- }
8766
+ function getElementsByTagName(element, tagNameOrWildCard) {
8767
+ return element.getElementsByTagName(tagNameOrWildCard);
8768
+ }
8747
8769
 
8748
- function getBoundingClientRect(element) {
8749
- return element.getBoundingClientRect();
8750
- }
8770
+ function getElementsByClassName(element, names) {
8771
+ return element.getElementsByClassName(names);
8772
+ }
8751
8773
 
8752
- function querySelector(element, selectors) {
8753
- return element.querySelector(selectors);
8754
- }
8774
+ function getChildren(element) {
8775
+ return element.children;
8776
+ }
8755
8777
 
8756
- function querySelectorAll(element, selectors) {
8757
- return element.querySelectorAll(selectors);
8758
- }
8778
+ function getChildNodes(element) {
8779
+ return element.childNodes;
8780
+ }
8759
8781
 
8760
- function getElementsByTagName(element, tagNameOrWildCard) {
8761
- return element.getElementsByTagName(tagNameOrWildCard);
8762
- }
8782
+ function getFirstChild(element) {
8783
+ return element.firstChild;
8784
+ }
8763
8785
 
8764
- function getElementsByClassName(element, names) {
8765
- return element.getElementsByClassName(names);
8766
- }
8786
+ function getFirstElementChild(element) {
8787
+ return element.firstElementChild;
8788
+ }
8767
8789
 
8768
- function getChildren(element) {
8769
- return element.children;
8770
- }
8790
+ function getLastChild(element) {
8791
+ return element.lastChild;
8792
+ }
8771
8793
 
8772
- function getChildNodes(element) {
8773
- return element.childNodes;
8774
- }
8794
+ function getLastElementChild(element) {
8795
+ return element.lastElementChild;
8796
+ }
8775
8797
 
8776
- function getFirstChild(element) {
8777
- return element.firstChild;
8778
- }
8798
+ function isConnected(node) {
8799
+ return node.isConnected;
8800
+ }
8779
8801
 
8780
- function getFirstElementChild(element) {
8781
- return element.firstElementChild;
8782
- }
8802
+ function assertInstanceOfHTMLElement(elm, msg) {
8803
+ assertInvariant(elm instanceof HTMLElement, msg);
8804
+ }
8783
8805
 
8784
- function getLastChild(element) {
8785
- return element.lastChild;
8786
- }
8806
+ var HTMLElementExported = HTMLElementConstructor;
8807
+ var renderer = {
8808
+ HTMLElementExported: HTMLElementExported,
8809
+ insert: insert,
8810
+ remove: remove,
8811
+ cloneNode: cloneNode,
8812
+ createFragment: createFragment,
8813
+ createElement: createElement,
8814
+ createText: createText,
8815
+ createComment: createComment,
8816
+ nextSibling: nextSibling,
8817
+ attachShadow: attachShadow,
8818
+ getProperty: getProperty,
8819
+ setProperty: setProperty,
8820
+ setText: setText,
8821
+ getAttribute: getAttribute,
8822
+ setAttribute: setAttribute,
8823
+ removeAttribute: removeAttribute,
8824
+ addEventListener: addEventListener,
8825
+ removeEventListener: removeEventListener,
8826
+ dispatchEvent: dispatchEvent,
8827
+ getClassList: getClassList,
8828
+ setCSSStyleProperty: setCSSStyleProperty,
8829
+ getBoundingClientRect: getBoundingClientRect,
8830
+ querySelector: querySelector,
8831
+ querySelectorAll: querySelectorAll,
8832
+ getElementsByTagName: getElementsByTagName,
8833
+ getElementsByClassName: getElementsByClassName,
8834
+ getChildren: getChildren,
8835
+ getChildNodes: getChildNodes,
8836
+ getFirstChild: getFirstChild,
8837
+ getFirstElementChild: getFirstElementChild,
8838
+ getLastChild: getLastChild,
8839
+ getLastElementChild: getLastElementChild,
8840
+ isConnected: isConnected,
8841
+ assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
8842
+ defineCustomElement: defineCustomElement,
8843
+ getCustomElement: getCustomElement
8844
+ }; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
8787
8845
 
8788
- function getLastElementChild(element) {
8789
- return element.lastElementChild;
8846
+ Object.setPrototypeOf(renderer, baseRenderer);
8847
+ return renderer;
8790
8848
  }
8849
+ /*
8850
+ * Copyright (c) 2018, salesforce.com, inc.
8851
+ * All rights reserved.
8852
+ * SPDX-License-Identifier: MIT
8853
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8854
+ */
8791
8855
 
8792
- function isConnected(node) {
8793
- return node.isConnected;
8794
- }
8856
+ /**
8857
+ * The base renderer that will be used by engine-core.
8858
+ * This will be used for DOM operations when lwc is running in a browser environment.
8859
+ */
8795
8860
 
8796
- function assertInstanceOfHTMLElement(elm, msg) {
8797
- assert.invariant(elm instanceof HTMLElement, msg);
8798
- }
8799
8861
 
8800
- var HTMLElementExported = HTMLElementConstructor;
8801
- var renderer = {
8802
- ssr: ssr,
8803
- isNativeShadowDefined: isNativeShadowDefined,
8804
- isSyntheticShadowDefined: isSyntheticShadowDefined,
8805
- HTMLElementExported: HTMLElementExported,
8806
- isHydrating: isHydrating,
8807
- insert: insert,
8808
- remove: remove,
8809
- cloneNode: cloneNode,
8810
- createFragment: createFragment,
8811
- createElement: createElement$1,
8812
- createText: createText,
8813
- createComment: createComment,
8814
- nextSibling: nextSibling,
8815
- attachShadow: attachShadow,
8816
- getProperty: getProperty,
8817
- setProperty: setProperty,
8818
- setText: setText,
8819
- getAttribute: getAttribute,
8820
- setAttribute: setAttribute,
8821
- removeAttribute: removeAttribute,
8822
- addEventListener: addEventListener,
8823
- removeEventListener: removeEventListener,
8824
- dispatchEvent: dispatchEvent,
8825
- getClassList: getClassList,
8826
- setCSSStyleProperty: setCSSStyleProperty,
8827
- getBoundingClientRect: getBoundingClientRect,
8828
- querySelector: querySelector,
8829
- querySelectorAll: querySelectorAll,
8830
- getElementsByTagName: getElementsByTagName,
8831
- getElementsByClassName: getElementsByClassName,
8832
- getChildren: getChildren,
8833
- getChildNodes: getChildNodes,
8834
- getFirstChild: getFirstChild,
8835
- getFirstElementChild: getFirstElementChild,
8836
- getLastChild: getLastChild,
8837
- getLastElementChild: getLastElementChild,
8838
- isConnected: isConnected,
8862
+ var renderer = assign( // The base renderer will invoke the factory with null and assign additional properties that are
8863
+ // shared across renderers
8864
+ rendererFactory(null), // Properties that are either not required to be sandboxed or rely on a globally shared information
8865
+ {
8866
+ // insertStyleSheet implementation shares a global cache of stylesheet data
8839
8867
  insertStylesheet: insertStylesheet,
8840
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
8841
- defineCustomElement: defineCustomElement,
8842
- getCustomElement: getCustomElement
8843
- };
8868
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
8869
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
8870
+ });
8844
8871
  /*
8845
8872
  * Copyright (c) 2018, salesforce.com, inc.
8846
8873
  * All rights reserved.
@@ -8905,13 +8932,8 @@
8905
8932
  }
8906
8933
 
8907
8934
  try {
8908
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8909
- // and uses the same algo to create the stylesheets as in SSR.
8910
- setIsHydrating(true);
8911
8935
  var vm = createVMWithProps(element, Ctor, props);
8912
- hydrateRoot(vm); // set it back since now we finished hydration.
8913
-
8914
- setIsHydrating(false);
8936
+ hydrateRoot(vm);
8915
8937
  } catch (e) {
8916
8938
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8917
8939
  // with the client generated DOM.
@@ -8922,11 +8944,7 @@
8922
8944
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8923
8945
 
8924
8946
  createVMWithProps(element, Ctor, props);
8925
- setIsHydrating(false);
8926
8947
  connectRootElement(element);
8927
- } finally {
8928
- // in case there's an error during recovery
8929
- setIsHydrating(false);
8930
8948
  }
8931
8949
  }
8932
8950
  /*
@@ -9021,7 +9039,6 @@
9021
9039
  * SPDX-License-Identifier: MIT
9022
9040
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9023
9041
  */
9024
- // TODO [#2472]: Remove this workaround when appropriate.
9025
9042
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
9026
9043
 
9027
9044
 
@@ -9041,39 +9058,41 @@
9041
9058
  }
9042
9059
 
9043
9060
  return node; // for convenience
9044
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
9045
- // created via createElement.
9046
-
9061
+ }
9047
9062
 
9048
- var _Node$1$prototype = _Node$1.prototype,
9049
- _appendChild2 = _Node$1$prototype.appendChild,
9050
- _insertBefore2 = _Node$1$prototype.insertBefore,
9051
- _removeChild2 = _Node$1$prototype.removeChild,
9052
- _replaceChild2 = _Node$1$prototype.replaceChild;
9053
- assign(_Node$1.prototype, {
9054
- appendChild: function appendChild(newChild) {
9055
- var appendedNode = _appendChild2.call(this, newChild);
9063
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9064
+ // Monkey patching Node methods to be able to detect the insertions and removal of root elements
9065
+ // created via createElement.
9066
+ var _Node$1$prototype = _Node$1.prototype,
9067
+ _appendChild = _Node$1$prototype.appendChild,
9068
+ _insertBefore = _Node$1$prototype.insertBefore,
9069
+ _removeChild = _Node$1$prototype.removeChild,
9070
+ _replaceChild = _Node$1$prototype.replaceChild;
9071
+ assign(_Node$1.prototype, {
9072
+ appendChild: function appendChild(newChild) {
9073
+ var appendedNode = _appendChild.call(this, newChild);
9056
9074
 
9057
- return callNodeSlot(appendedNode, ConnectingSlot);
9058
- },
9059
- insertBefore: function insertBefore(newChild, referenceNode) {
9060
- var insertedNode = _insertBefore2.call(this, newChild, referenceNode);
9075
+ return callNodeSlot(appendedNode, ConnectingSlot);
9076
+ },
9077
+ insertBefore: function insertBefore(newChild, referenceNode) {
9078
+ var insertedNode = _insertBefore.call(this, newChild, referenceNode);
9061
9079
 
9062
- return callNodeSlot(insertedNode, ConnectingSlot);
9063
- },
9064
- removeChild: function removeChild(oldChild) {
9065
- var removedNode = _removeChild2.call(this, oldChild);
9080
+ return callNodeSlot(insertedNode, ConnectingSlot);
9081
+ },
9082
+ removeChild: function removeChild(oldChild) {
9083
+ var removedNode = _removeChild.call(this, oldChild);
9066
9084
 
9067
- return callNodeSlot(removedNode, DisconnectingSlot);
9068
- },
9069
- replaceChild: function replaceChild(newChild, oldChild) {
9070
- var replacedNode = _replaceChild2.call(this, newChild, oldChild);
9085
+ return callNodeSlot(removedNode, DisconnectingSlot);
9086
+ },
9087
+ replaceChild: function replaceChild(newChild, oldChild) {
9088
+ var replacedNode = _replaceChild.call(this, newChild, oldChild);
9071
9089
 
9072
- callNodeSlot(replacedNode, DisconnectingSlot);
9073
- callNodeSlot(newChild, ConnectingSlot);
9074
- return replacedNode;
9075
- }
9076
- });
9090
+ callNodeSlot(replacedNode, DisconnectingSlot);
9091
+ callNodeSlot(newChild, ConnectingSlot);
9092
+ return replacedNode;
9093
+ }
9094
+ });
9095
+ }
9077
9096
  /**
9078
9097
  * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
9079
9098
  * difference that in the options, you can pass the `is` property set to a Constructor instead of
@@ -9086,6 +9105,7 @@
9086
9105
  * ```
9087
9106
  */
9088
9107
 
9108
+
9089
9109
  function createElement(sel, options) {
9090
9110
  if (!isObject(options) || isNull(options)) {
9091
9111
  throw new TypeError("\"createElement\" function expects an object as second parameter but received \"".concat(toString$1(options), "\"."));
@@ -9113,8 +9133,12 @@
9113
9133
  mode: options.mode !== 'closed' ? 'open' : 'closed',
9114
9134
  owner: null
9115
9135
  });
9116
- ConnectingSlot.set(elm, connectRootElement);
9117
- DisconnectingSlot.set(elm, disconnectRootElement);
9136
+
9137
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9138
+ ConnectingSlot.set(elm, connectRootElement);
9139
+ DisconnectingSlot.set(elm, disconnectRootElement);
9140
+ }
9141
+
9118
9142
  wasComponentUpgraded = true;
9119
9143
  });
9120
9144
 
@@ -9161,7 +9185,7 @@
9161
9185
  // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
9162
9186
 
9163
9187
 
9164
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
9188
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
9165
9189
  }
9166
9190
  /*
9167
9191
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9205,7 +9229,7 @@
9205
9229
  });
9206
9230
  freeze(LightningElement);
9207
9231
  seal(LightningElement.prototype);
9208
- /* version: 2.22.0 */
9232
+ /* version: 2.23.2 */
9209
9233
 
9210
9234
  exports.LightningElement = LightningElement;
9211
9235
  exports.__unstable__ProfilerControl = profilerControl;
@@ -9227,6 +9251,7 @@
9227
9251
  exports.registerDecorators = registerDecorators;
9228
9252
  exports.registerTemplate = registerTemplate;
9229
9253
  exports.renderer = renderer;
9254
+ exports.rendererFactory = rendererFactory;
9230
9255
  exports.sanitizeAttribute = sanitizeAttribute;
9231
9256
  exports.setFeatureFlag = setFeatureFlag;
9232
9257
  exports.setFeatureFlagForTest = setFeatureFlagForTest;