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
@@ -346,7 +346,11 @@ var LWC = (function (exports) {
346
346
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
347
347
  return attributeName;
348
348
  }
349
- /** version: 2.22.0 */
349
+ /** version: 2.23.2 */
350
+
351
+ /**
352
+ * Copyright (C) 2018 salesforce.com, inc.
353
+ */
350
354
 
351
355
  /*
352
356
  * Copyright (c) 2018, salesforce.com, inc.
@@ -356,7 +360,7 @@ var LWC = (function (exports) {
356
360
  */
357
361
 
358
362
  function detect(propName) {
359
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
363
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
360
364
  }
361
365
  /*
362
366
  * Copyright (c) 2018, salesforce.com, inc.
@@ -436,6 +440,8 @@ var LWC = (function (exports) {
436
440
  patch$1(propName);
437
441
  }
438
442
  }
443
+ /** version: 2.23.2 */
444
+
439
445
  /**
440
446
  * Copyright (C) 2018 salesforce.com, inc.
441
447
  */
@@ -456,6 +462,7 @@ var LWC = (function (exports) {
456
462
  ENABLE_HTML_COLLECTIONS_PATCH: null,
457
463
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
458
464
  ENABLE_MIXED_SHADOW_MODE: null,
465
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
459
466
  ENABLE_NODE_LIST_PATCH: null,
460
467
  ENABLE_NODE_PATCH: null,
461
468
  ENABLE_REACTIVE_SETTER: null,
@@ -468,7 +475,7 @@ var LWC = (function (exports) {
468
475
  });
469
476
  }
470
477
 
471
- var runtimeFlags = _globalThis.lwcRuntimeFlags;
478
+ var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
472
479
  /**
473
480
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
474
481
  * flag. It is meant to be used during the app initialization.
@@ -496,7 +503,7 @@ var LWC = (function (exports) {
496
503
 
497
504
  {
498
505
  // Disallow the same flag to be set more than once in production
499
- var runtimeValue = runtimeFlags[name];
506
+ var runtimeValue = lwcRuntimeFlags[name];
500
507
 
501
508
  if (!isUndefined$1(runtimeValue)) {
502
509
  // eslint-disable-next-line no-console
@@ -504,7 +511,7 @@ var LWC = (function (exports) {
504
511
  return;
505
512
  }
506
513
 
507
- defineProperty(runtimeFlags, name, {
514
+ defineProperty(lwcRuntimeFlags, name, {
508
515
  value: value
509
516
  });
510
517
  }
@@ -860,8 +867,8 @@ var LWC = (function (exports) {
860
867
  // to inject at runtime.
861
868
 
862
869
 
863
- var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
864
- var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
870
+ var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
871
+ var HTMLElementPrototype = HTMLElementConstructor.prototype;
865
872
  /*
866
873
  * Copyright (c) 2018, salesforce.com, inc.
867
874
  * All rights reserved.
@@ -1016,6 +1023,15 @@ var LWC = (function (exports) {
1016
1023
  HTMLElementOriginalDescriptors[propName] = descriptor;
1017
1024
  }
1018
1025
  });
1026
+
1027
+ function updateComponentValue(vm, key, newValue) {
1028
+ var cmpFields = vm.cmpFields;
1029
+
1030
+ if (newValue !== cmpFields[key]) {
1031
+ cmpFields[key] = newValue;
1032
+ componentValueMutated(vm, key);
1033
+ }
1034
+ }
1019
1035
  /**
1020
1036
  * Copyright (C) 2017 salesforce.com, inc.
1021
1037
  */
@@ -1746,11 +1762,7 @@ var LWC = (function (exports) {
1746
1762
  set: function set(newValue) {
1747
1763
  var vm = getAssociatedVM(this);
1748
1764
 
1749
- if (newValue !== vm.cmpProps[propName]) {
1750
- vm.cmpProps[propName] = newValue;
1751
- componentValueMutated(vm, propName);
1752
- }
1753
-
1765
+ updateComponentValue(vm, propName, newValue);
1754
1766
  return _set.call(vm.elm, newValue);
1755
1767
  }
1756
1768
  };
@@ -2038,11 +2050,7 @@ var LWC = (function (exports) {
2038
2050
  },
2039
2051
  set: function set(newValue) {
2040
2052
  var vm = getAssociatedVM(this);
2041
-
2042
- if (newValue !== vm.cmpFields[key]) {
2043
- vm.cmpFields[key] = newValue;
2044
- componentValueMutated(vm, key);
2045
- }
2053
+ updateComponentValue(vm, key, newValue);
2046
2054
  },
2047
2055
  enumerable: true,
2048
2056
  configurable: true
@@ -2169,7 +2177,7 @@ var LWC = (function (exports) {
2169
2177
  var vm = getAssociatedVM(this);
2170
2178
 
2171
2179
  if (_set2) {
2172
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2180
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2173
2181
  var ro = vm.oar[key];
2174
2182
 
2175
2183
  if (isUndefined$1(ro)) {
@@ -2220,11 +2228,7 @@ var LWC = (function (exports) {
2220
2228
  var vm = getAssociatedVM(this);
2221
2229
 
2222
2230
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2223
-
2224
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2225
- vm.cmpFields[key] = reactiveOrAnyValue;
2226
- componentValueMutated(vm, key);
2227
- }
2231
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2228
2232
  },
2229
2233
  enumerable: true,
2230
2234
  configurable: true
@@ -2265,10 +2269,7 @@ var LWC = (function (exports) {
2265
2269
  * system to be backward compatible.
2266
2270
  */
2267
2271
 
2268
- if (value !== vm.cmpFields[key]) {
2269
- vm.cmpFields[key] = value;
2270
- componentValueMutated(vm, key);
2271
- }
2272
+ updateComponentValue(vm, key, value);
2272
2273
  },
2273
2274
  enumerable: true,
2274
2275
  configurable: true
@@ -2669,7 +2670,7 @@ var LWC = (function (exports) {
2669
2670
  return HTMLBridgeElement;
2670
2671
  }
2671
2672
 
2672
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2673
+ var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2673
2674
  freeze(BaseBridgeElement);
2674
2675
  seal(BaseBridgeElement.prototype);
2675
2676
 
@@ -2682,7 +2683,7 @@ var LWC = (function (exports) {
2682
2683
 
2683
2684
  function swapTemplate(oldTpl, newTpl) {
2684
2685
 
2685
- if (!runtimeFlags.ENABLE_HMR) {
2686
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2686
2687
  throw new Error('HMR is not enabled');
2687
2688
  }
2688
2689
 
@@ -2691,7 +2692,7 @@ var LWC = (function (exports) {
2691
2692
 
2692
2693
  function swapComponent(oldComponent, newComponent) {
2693
2694
 
2694
- if (!runtimeFlags.ENABLE_HMR) {
2695
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2695
2696
  throw new Error('HMR is not enabled');
2696
2697
  }
2697
2698
 
@@ -2700,7 +2701,7 @@ var LWC = (function (exports) {
2700
2701
 
2701
2702
  function swapStyle(oldStyle, newStyle) {
2702
2703
 
2703
- if (!runtimeFlags.ENABLE_HMR) {
2704
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2704
2705
  throw new Error('HMR is not enabled');
2705
2706
  }
2706
2707
 
@@ -3134,9 +3135,7 @@ var LWC = (function (exports) {
3134
3135
  function createStylesheet(vm, stylesheets) {
3135
3136
  var renderMode = vm.renderMode,
3136
3137
  shadowMode = vm.shadowMode,
3137
- _vm$renderer2 = vm.renderer,
3138
- ssr = _vm$renderer2.ssr,
3139
- insertStylesheet = _vm$renderer2.insertStylesheet;
3138
+ insertStylesheet = vm.renderer.insertStylesheet;
3140
3139
 
3141
3140
  if (renderMode === 1
3142
3141
  /* RenderMode.Shadow */
@@ -3146,7 +3145,7 @@ var LWC = (function (exports) {
3146
3145
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
3147
3146
  insertStylesheet(stylesheets[_i12]);
3148
3147
  }
3149
- } else if (ssr || vm.hydrated) {
3148
+ } else if (vm.hydrated) {
3150
3149
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3151
3150
  // This works in the client, because the stylesheets are created, and cached in the VM
3152
3151
  // the first time the VM renders.
@@ -3173,6 +3172,12 @@ var LWC = (function (exports) {
3173
3172
  */
3174
3173
 
3175
3174
 
3175
+ function checkHasVM(elm) {
3176
+ var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
3177
+
3178
+ return hasVM;
3179
+ }
3180
+
3176
3181
  function getUpgradableConstructor(tagName, renderer) {
3177
3182
  var getCustomElement = renderer.getCustomElement,
3178
3183
  RendererHTMLElement = renderer.HTMLElementExported,
@@ -3214,6 +3219,20 @@ var LWC = (function (exports) {
3214
3219
  return _createClass(LWCUpgradableElement);
3215
3220
  }(RendererHTMLElement);
3216
3221
 
3222
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3223
+ CE.prototype.connectedCallback = function () {
3224
+ if (checkHasVM(this)) {
3225
+ connectRootElement(this);
3226
+ }
3227
+ };
3228
+
3229
+ CE.prototype.disconnectedCallback = function () {
3230
+ if (checkHasVM(this)) {
3231
+ disconnectRootElement(this);
3232
+ }
3233
+ };
3234
+ }
3235
+
3217
3236
  defineCustomElement(tagName, CE);
3218
3237
  return CE;
3219
3238
  }
@@ -3325,6 +3344,7 @@ var LWC = (function (exports) {
3325
3344
  // different than the one previously set.
3326
3345
 
3327
3346
  if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
3347
+
3328
3348
  setProperty(elm, key, cur);
3329
3349
  }
3330
3350
  }
@@ -3527,7 +3547,7 @@ var LWC = (function (exports) {
3527
3547
  }
3528
3548
  }
3529
3549
 
3530
- function patch(n1, n2, renderer) {
3550
+ function patch(n1, n2, parent, renderer) {
3531
3551
  var _a, _b;
3532
3552
 
3533
3553
  if (n1 === n2) {
@@ -3564,7 +3584,7 @@ var LWC = (function (exports) {
3564
3584
  case 3
3565
3585
  /* VNodeType.CustomElement */
3566
3586
  :
3567
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3587
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3568
3588
  break;
3569
3589
  }
3570
3590
  }
@@ -3718,8 +3738,12 @@ var LWC = (function (exports) {
3718
3738
  insertNode(elm, parent, anchor, renderer);
3719
3739
 
3720
3740
  if (vm) {
3741
+ {
3742
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3721
3743
 
3722
- runConnectedCallback(vm);
3744
+ runConnectedCallback(vm);
3745
+ }
3746
+ }
3723
3747
  }
3724
3748
 
3725
3749
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3729,25 +3753,34 @@ var LWC = (function (exports) {
3729
3753
  }
3730
3754
  }
3731
3755
 
3732
- function patchCustomElement(n1, n2, renderer) {
3733
- var elm = n2.elm = n1.elm;
3734
- var vm = n2.vm = n1.vm;
3735
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3756
+ function patchCustomElement(n1, n2, parent, renderer) {
3757
+ if (n1.ctor !== n2.ctor) {
3758
+ // If the constructor, unmount the current component and mount a new one using the new
3759
+ // constructor.
3760
+ var anchor = renderer.nextSibling(n1.elm);
3761
+ unmount(n1, parent, renderer, true);
3762
+ mountCustomElement(n2, parent, anchor, renderer);
3763
+ } else {
3764
+ // Otherwise patch the existing component with new props/attrs/etc.
3765
+ var elm = n2.elm = n1.elm;
3766
+ var vm = n2.vm = n1.vm;
3767
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3736
3768
 
3737
- if (!isUndefined$1(vm)) {
3738
- // in fallback mode, the allocation will always set children to
3739
- // empty and delegate the real allocation to the slot elements
3740
- allocateChildren(n2, vm);
3741
- } // in fallback mode, the children will be always empty, so, nothing
3742
- // will happen, but in native, it does allocate the light dom
3769
+ if (!isUndefined$1(vm)) {
3770
+ // in fallback mode, the allocation will always set children to
3771
+ // empty and delegate the real allocation to the slot elements
3772
+ allocateChildren(n2, vm);
3773
+ } // in fallback mode, the children will be always empty, so, nothing
3774
+ // will happen, but in native, it does allocate the light dom
3743
3775
 
3744
3776
 
3745
- patchChildren(n1.children, n2.children, elm, renderer);
3777
+ patchChildren(n1.children, n2.children, elm, renderer);
3746
3778
 
3747
- if (!isUndefined$1(vm)) {
3748
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3749
- // this is important to preserve the top to bottom synchronous rendering phase.
3750
- rerenderVM(vm);
3779
+ if (!isUndefined$1(vm)) {
3780
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3781
+ // this is important to preserve the top to bottom synchronous rendering phase.
3782
+ rerenderVM(vm);
3783
+ }
3751
3784
  }
3752
3785
  }
3753
3786
 
@@ -3878,10 +3911,10 @@ var LWC = (function (exports) {
3878
3911
  var scopeToken = getScopeTokenClass(owner);
3879
3912
 
3880
3913
  if (!isNull(scopeToken)) {
3881
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
3914
+ var getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
3882
3915
  // probably we should have a renderer api for just the add operation
3883
3916
 
3884
- _getClassList(elm).add(scopeToken);
3917
+ getClassList(elm).add(scopeToken);
3885
3918
  } // Set property element for synthetic shadow DOM style scoping.
3886
3919
 
3887
3920
 
@@ -4071,22 +4104,22 @@ var LWC = (function (exports) {
4071
4104
  } else if (!isVNode(newEndVnode)) {
4072
4105
  newEndVnode = newCh[--newEndIdx];
4073
4106
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
4074
- patch(oldStartVnode, newStartVnode, renderer);
4107
+ patch(oldStartVnode, newStartVnode, parent, renderer);
4075
4108
  oldStartVnode = oldCh[++oldStartIdx];
4076
4109
  newStartVnode = newCh[++newStartIdx];
4077
4110
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
4078
- patch(oldEndVnode, newEndVnode, renderer);
4111
+ patch(oldEndVnode, newEndVnode, parent, renderer);
4079
4112
  oldEndVnode = oldCh[--oldEndIdx];
4080
4113
  newEndVnode = newCh[--newEndIdx];
4081
4114
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
4082
4115
  // Vnode moved right
4083
- patch(oldStartVnode, newEndVnode, renderer);
4116
+ patch(oldStartVnode, newEndVnode, parent, renderer);
4084
4117
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4085
4118
  oldStartVnode = oldCh[++oldStartIdx];
4086
4119
  newEndVnode = newCh[--newEndIdx];
4087
4120
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
4088
4121
  // Vnode moved left
4089
- patch(oldEndVnode, newStartVnode, renderer);
4122
+ patch(oldEndVnode, newStartVnode, parent, renderer);
4090
4123
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4091
4124
  oldEndVnode = oldCh[--oldEndIdx];
4092
4125
  newStartVnode = newCh[++newStartIdx];
@@ -4109,7 +4142,7 @@ var LWC = (function (exports) {
4109
4142
  // New element
4110
4143
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4111
4144
  } else {
4112
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
4145
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
4113
4146
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4114
4147
  // so we only care about the `oldCh` object inside this function.
4115
4148
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -4179,7 +4212,7 @@ var LWC = (function (exports) {
4179
4212
  if (isVNode(n1)) {
4180
4213
  if (isVNode(n2)) {
4181
4214
  // both vnodes are equivalent, and we just need to patch them
4182
- patch(n1, n2, renderer);
4215
+ patch(n1, n2, parent, renderer);
4183
4216
  anchor = n2.elm;
4184
4217
  } else {
4185
4218
  // removing the old vnode since the new one is null
@@ -4480,19 +4513,11 @@ var LWC = (function (exports) {
4480
4513
 
4481
4514
  return url;
4482
4515
  }
4483
- /**
4484
- * Map to store an index value assigned to any dynamic component reference ingested
4485
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4486
- * component reference to avoid diffing algo mismatches.
4487
- */
4488
-
4489
-
4490
- var DynamicImportedComponentMap = new Map();
4491
- var dynamicImportedComponentCounter = 0;
4492
4516
  /**
4493
4517
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4494
4518
  */
4495
4519
 
4520
+
4496
4521
  function dc(sel, Ctor, data) {
4497
4522
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
4498
4523
 
@@ -4505,22 +4530,7 @@ var LWC = (function (exports) {
4505
4530
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
4506
4531
  }
4507
4532
 
4508
- var idx = DynamicImportedComponentMap.get(Ctor);
4509
-
4510
- if (isUndefined$1(idx)) {
4511
- idx = dynamicImportedComponentCounter++;
4512
- DynamicImportedComponentMap.set(Ctor, idx);
4513
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4514
- // to identify different constructors as vnodes with different keys to avoid reusing the
4515
- // element used for previous constructors.
4516
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4517
- // hoisting optimization.
4518
-
4519
-
4520
- var newData = Object.assign(Object.assign({}, data), {
4521
- key: "dc:".concat(idx, ":").concat(data.key)
4522
- });
4523
- return c(sel, Ctor, newData, children);
4533
+ return c(sel, Ctor, data, children);
4524
4534
  }
4525
4535
  /**
4526
4536
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5250,7 +5260,7 @@ var LWC = (function (exports) {
5250
5260
  } else if (isNativeShadowDefined) {
5251
5261
  // Not combined with above condition because @lwc/features only supports identifiers in
5252
5262
  // the if-condition.
5253
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5263
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5254
5264
  if (def.shadowSupportMode === "any"
5255
5265
  /* ShadowSupportMode.Any */
5256
5266
  ) {
@@ -5360,13 +5370,7 @@ var LWC = (function (exports) {
5360
5370
  }
5361
5371
 
5362
5372
  function runRenderedCallback(vm) {
5363
- var renderedCallback = vm.def.renderedCallback,
5364
- ssr = vm.renderer.ssr;
5365
-
5366
- if (isTrue(ssr)) {
5367
- return;
5368
- }
5369
-
5373
+ var renderedCallback = vm.def.renderedCallback;
5370
5374
  var rendered = Services.rendered;
5371
5375
 
5372
5376
  if (rendered) {
@@ -5589,9 +5593,7 @@ var LWC = (function (exports) {
5589
5593
  }
5590
5594
 
5591
5595
  function scheduleRehydration(vm) {
5592
- var ssr = vm.renderer.ssr;
5593
-
5594
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5596
+ if (isTrue(vm.isScheduled)) {
5595
5597
  return;
5596
5598
  }
5597
5599
 
@@ -5693,13 +5695,8 @@ var LWC = (function (exports) {
5693
5695
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
5694
5696
 
5695
5697
  function createFieldDataCallback(vm, name) {
5696
- var cmpFields = vm.cmpFields;
5697
5698
  return function (value) {
5698
- if (value !== vm.cmpFields[name]) {
5699
- // storing the value in the underlying storage
5700
- cmpFields[name] = value;
5701
- componentValueMutated(vm, name);
5702
- }
5699
+ updateComponentValue(vm, name, value);
5703
5700
  };
5704
5701
  }
5705
5702
 
@@ -5908,7 +5905,7 @@ var LWC = (function (exports) {
5908
5905
  ArrayPush$1.call(wiredConnecting, function () {
5909
5906
  connector.connect();
5910
5907
 
5911
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5908
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5912
5909
  if (hasDynamicParams) {
5913
5910
  Promise.resolve().then(computeConfigAndUpdate);
5914
5911
  return;
@@ -6082,6 +6079,8 @@ var LWC = (function (exports) {
6082
6079
  return renderer.nextSibling(hydratedNode);
6083
6080
  }
6084
6081
 
6082
+ var NODE_VALUE_PROP = 'nodeValue';
6083
+
6085
6084
  function hydrateText(node, vnode, renderer) {
6086
6085
  var _a;
6087
6086
 
@@ -6107,7 +6106,7 @@ var LWC = (function (exports) {
6107
6106
  }
6108
6107
 
6109
6108
  var setProperty = renderer.setProperty;
6110
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6109
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6111
6110
  vnode.elm = node;
6112
6111
  return node;
6113
6112
  }
@@ -6139,10 +6138,10 @@ var LWC = (function (exports) {
6139
6138
  // it may be that this element has lwc:inner-html, we need to diff and in case are the same,
6140
6139
  // remove the innerHTML from props so it reuses the existing dom elements.
6141
6140
  var props = vnode.data.props;
6142
- var _getProperty3 = renderer.getProperty;
6141
+ var getProperty = renderer.getProperty;
6143
6142
 
6144
6143
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
6145
- if (_getProperty3(elm, 'innerHTML') === props.innerHTML) {
6144
+ if (getProperty(elm, 'innerHTML') === props.innerHTML) {
6146
6145
  // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
6147
6146
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
6148
6147
  props: cloneAndOmitKey(props, 'innerHTML')
@@ -6154,8 +6153,8 @@ var LWC = (function (exports) {
6154
6153
  patchElementPropsAndAttrs(vnode, renderer);
6155
6154
 
6156
6155
  if (!isDomManual) {
6157
- var _getFirstChild = renderer.getFirstChild;
6158
- hydrateChildren(_getFirstChild(elm), vnode.children, elm, owner);
6156
+ var getFirstChild = renderer.getFirstChild;
6157
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
6159
6158
  }
6160
6159
 
6161
6160
  return elm;
@@ -6188,10 +6187,10 @@ var LWC = (function (exports) {
6188
6187
  if (vm.renderMode !== 0
6189
6188
  /* RenderMode.Light */
6190
6189
  ) {
6191
- var _getFirstChild2 = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6190
+ var getFirstChild = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
6192
6191
  // Note: for Light DOM, this is handled while hydrating the VM
6193
6192
 
6194
- hydrateChildren(_getFirstChild2(elm), vnode.children, elm, vm);
6193
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
6195
6194
  }
6196
6195
 
6197
6196
  hydrateVM(vm);
@@ -6226,11 +6225,11 @@ var LWC = (function (exports) {
6226
6225
  // next node in the list to be hydrated.
6227
6226
 
6228
6227
 
6229
- var _nextSibling = renderer.nextSibling;
6228
+ var nextSibling = renderer.nextSibling;
6230
6229
 
6231
6230
  do {
6232
6231
  var current = nextNode;
6233
- nextNode = _nextSibling(nextNode);
6232
+ nextNode = nextSibling(nextNode);
6234
6233
  removeNode(current, parentNode, renderer);
6235
6234
  } while (nextNode);
6236
6235
  }
@@ -6287,9 +6286,8 @@ var LWC = (function (exports) {
6287
6286
  attrValue = _Object$entries$_i[1];
6288
6287
 
6289
6288
  vnode.owner;
6290
- var _getAttribute = renderer.getAttribute;
6291
-
6292
- var elmAttrValue = _getAttribute(elm, attrName);
6289
+ var getAttribute = renderer.getAttribute;
6290
+ var elmAttrValue = getAttribute(elm, attrName);
6293
6291
 
6294
6292
  if (String(attrValue) !== elmAttrValue) {
6295
6293
 
@@ -6405,7 +6403,7 @@ var LWC = (function (exports) {
6405
6403
  return false;
6406
6404
  }
6407
6405
 
6408
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6406
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6409
6407
  }
6410
6408
 
6411
6409
  if (getProperty(client, 'nodeType') === 8
@@ -6417,7 +6415,7 @@ var LWC = (function (exports) {
6417
6415
  return false;
6418
6416
  }
6419
6417
 
6420
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6418
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6421
6419
  }
6422
6420
 
6423
6421
  if (!hasCorrectNodeType(vnode, ssr, 1
@@ -6489,7 +6487,7 @@ var LWC = (function (exports) {
6489
6487
 
6490
6488
  return ctor;
6491
6489
  }
6492
- /* version: 2.22.0 */
6490
+ /* version: 2.23.2 */
6493
6491
 
6494
6492
  /*
6495
6493
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6647,373 +6645,395 @@ var LWC = (function (exports) {
6647
6645
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6648
6646
  */
6649
6647
 
6648
+ /**
6649
+ * A factory function that produces a renderer.
6650
+ * Renderer encapsulates operations that are required to render an LWC component into the underlying
6651
+ * runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
6652
+ * Example usage:
6653
+ * import { renderer, rendererFactory } from 'lwc';
6654
+ * const customRenderer = rendererFactory(renderer);
6655
+ *
6656
+ * @param baseRenderer Either null or the base renderer imported from 'lwc'.
6657
+ */
6650
6658
 
6651
- var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6652
- var createFragment;
6653
6659
 
6654
- if (SUPPORTS_TEMPLATE) {
6655
- // Parse the fragment HTML string into DOM
6656
- createFragment = function createFragment(html) {
6657
- var template = document.createElement('template');
6658
- template.innerHTML = html;
6659
- return template.content.firstChild;
6660
- };
6661
- } else {
6662
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6663
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6664
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6665
- // With other elements added from:
6666
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6667
- // Using the test:
6668
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6669
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6670
- var topLevelWrappingMap = {
6671
- caption: ['table'],
6672
- col: ['colgroup', 'table'],
6673
- colgroup: ['table'],
6674
- option: ['select'],
6675
- tbody: ['table'],
6676
- td: ['tr', 'tbody', 'table'],
6677
- th: ['tr', 'tbody', 'table'],
6678
- thead: ['table'],
6679
- tfoot: ['table'],
6680
- tr: ['tbody', 'table']
6681
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6682
-
6683
- var getTagName = function getTagName(text) {
6684
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6685
- }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6686
-
6687
-
6688
- createFragment = function createFragment(html) {
6689
- var wrapperTags = topLevelWrappingMap[getTagName(html)];
6690
-
6691
- if (!isUndefined$1(wrapperTags)) {
6692
- var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6693
- _step5;
6660
+ function rendererFactory(baseRenderer) {
6661
+ // Util functions
6662
+ function assertInvariant(value, msg) {
6663
+ if (!value) {
6664
+ throw new Error("Invariant Violation: ".concat(msg));
6665
+ }
6666
+ }
6694
6667
 
6695
- try {
6696
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6697
- var wrapperTag = _step5.value;
6698
- html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6699
- }
6700
- } catch (err) {
6701
- _iterator5.e(err);
6702
- } finally {
6703
- _iterator5.f();
6704
- }
6705
- } // For IE11, the document title must not be undefined, but it can be an empty string
6706
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6668
+ function isNull(obj) {
6669
+ return obj === null;
6670
+ }
6707
6671
 
6672
+ function isUndefined(obj) {
6673
+ return obj === undefined;
6674
+ }
6708
6675
 
6709
- var doc = document.implementation.createHTMLDocument('');
6710
- doc.body.innerHTML = html;
6711
- var content = doc.body;
6676
+ var getCustomElement;
6677
+ var defineCustomElement;
6678
+ var HTMLElementConstructor;
6712
6679
 
6713
- if (!isUndefined$1(wrapperTags)) {
6714
- for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6715
- content = content.firstChild;
6716
- }
6680
+ function isCustomElementRegistryAvailable() {
6681
+ if (typeof customElements === 'undefined') {
6682
+ return false;
6717
6683
  }
6718
6684
 
6719
- return content.firstChild;
6720
- };
6721
- }
6722
- /*
6723
- * Copyright (c) 2018, salesforce.com, inc.
6724
- * All rights reserved.
6725
- * SPDX-License-Identifier: MIT
6726
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6727
- */
6685
+ try {
6686
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
6687
+ // _wrapNativeSuper()
6688
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
6689
+ // get wrapped by babel.
6690
+ var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
6691
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
6692
+ // which are not equipped to be initialized that way.
6728
6693
 
6694
+ var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
6695
+ _inherits(clazz, _HTMLElementAlias);
6729
6696
 
6730
- var getCustomElement;
6731
- var defineCustomElement;
6732
- var HTMLElementConstructor;
6697
+ var _super7 = _createSuper(clazz);
6733
6698
 
6734
- function isCustomElementRegistryAvailable() {
6735
- if (typeof customElements === 'undefined') {
6736
- return false;
6737
- }
6699
+ function clazz() {
6700
+ _classCallCheck(this, clazz);
6738
6701
 
6739
- try {
6740
- // dereference HTMLElement global because babel wraps globals in compat mode with a
6741
- // _wrapNativeSuper()
6742
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
6743
- // get wrapped by babel.
6744
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
6745
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
6746
- // which are not equipped to be initialized that way.
6702
+ return _super7.apply(this, arguments);
6703
+ }
6747
6704
 
6748
- var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
6749
- _inherits(clazz, _HTMLElementAlias);
6705
+ return _createClass(clazz);
6706
+ }(HTMLElementAlias);
6750
6707
 
6751
- var _super7 = _createSuper(clazz);
6708
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
6709
+ new clazz();
6710
+ return true;
6711
+ } catch (_a) {
6712
+ return false;
6713
+ }
6714
+ }
6752
6715
 
6753
- function clazz() {
6754
- _classCallCheck(this, clazz);
6716
+ if (isCustomElementRegistryAvailable()) {
6717
+ getCustomElement = customElements.get.bind(customElements);
6718
+ defineCustomElement = customElements.define.bind(customElements);
6719
+ HTMLElementConstructor = HTMLElement;
6720
+ } else {
6721
+ var registry = Object.create(null);
6722
+ var reverseRegistry = new WeakMap();
6755
6723
 
6756
- return _super7.apply(this, arguments);
6724
+ defineCustomElement = function define(name, ctor) {
6725
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
6726
+ throw new TypeError("Invalid Registration");
6757
6727
  }
6758
6728
 
6759
- return _createClass(clazz);
6760
- }(HTMLElementAlias);
6729
+ registry[name] = ctor;
6730
+ reverseRegistry.set(ctor, name);
6731
+ };
6761
6732
 
6762
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
6763
- new clazz();
6764
- return true;
6765
- } catch (_a) {
6766
- return false;
6767
- }
6768
- }
6733
+ getCustomElement = function get(name) {
6734
+ return registry[name];
6735
+ };
6769
6736
 
6770
- if (isCustomElementRegistryAvailable()) {
6771
- getCustomElement = customElements.get.bind(customElements);
6772
- defineCustomElement = customElements.define.bind(customElements);
6773
- HTMLElementConstructor = HTMLElement;
6774
- } else {
6775
- var registry = create(null);
6776
- var reverseRegistry = new WeakMap();
6737
+ HTMLElementConstructor = function HTMLElement() {
6738
+ if (!(this instanceof HTMLElement)) {
6739
+ throw new TypeError("Invalid Invocation");
6740
+ }
6777
6741
 
6778
- defineCustomElement = function define(name, ctor) {
6779
- if (name !== StringToLowerCase.call(name) || registry[name]) {
6780
- throw new TypeError("Invalid Registration");
6781
- }
6742
+ var constructor = this.constructor;
6743
+ var name = reverseRegistry.get(constructor);
6782
6744
 
6783
- registry[name] = ctor;
6784
- reverseRegistry.set(ctor, name);
6785
- };
6745
+ if (!name) {
6746
+ throw new TypeError("Invalid Construction");
6747
+ }
6786
6748
 
6787
- getCustomElement = function get(name) {
6788
- return registry[name];
6789
- };
6749
+ var elm = document.createElement(name);
6750
+ Object.setPrototypeOf(elm, constructor.prototype);
6751
+ return elm;
6752
+ };
6790
6753
 
6791
- HTMLElementConstructor = function HTMLElement() {
6792
- if (!(this instanceof HTMLElement)) {
6793
- throw new TypeError("Invalid Invocation");
6794
- }
6754
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
6755
+ }
6795
6756
 
6796
- var constructor = this.constructor;
6797
- var name = reverseRegistry.get(constructor);
6757
+ function cloneNode(node, deep) {
6758
+ return node.cloneNode(deep);
6759
+ }
6798
6760
 
6799
- if (!name) {
6800
- throw new TypeError("Invalid Construction");
6801
- }
6761
+ function createElement(tagName, namespace) {
6762
+ return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6763
+ }
6802
6764
 
6803
- var elm = document.createElement(name);
6804
- setPrototypeOf(elm, constructor.prototype);
6805
- return elm;
6806
- };
6765
+ function createText(content) {
6766
+ return document.createTextNode(content);
6767
+ }
6807
6768
 
6808
- HTMLElementConstructor.prototype = HTMLElement.prototype;
6809
- }
6769
+ function createComment(content) {
6770
+ return document.createComment(content);
6771
+ }
6810
6772
 
6811
- var hydrating = false;
6773
+ var createFragment; // IE11 lacks support for this feature
6812
6774
 
6813
- function setIsHydrating(value) {
6814
- hydrating = value;
6815
- }
6775
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6816
6776
 
6817
- var ssr = false;
6777
+ if (SUPPORTS_TEMPLATE) {
6778
+ // Parse the fragment HTML string into DOM
6779
+ createFragment = function createFragment(html) {
6780
+ var template = document.createElement('template');
6781
+ template.innerHTML = html;
6782
+ return template.content.firstChild;
6783
+ };
6784
+ } else {
6785
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6786
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6787
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6788
+ // With other elements added from:
6789
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6790
+ // Using the test:
6791
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
6792
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
6793
+ var topLevelWrappingMap = {
6794
+ caption: ['table'],
6795
+ col: ['colgroup', 'table'],
6796
+ colgroup: ['table'],
6797
+ option: ['select'],
6798
+ tbody: ['table'],
6799
+ td: ['tr', 'tbody', 'table'],
6800
+ th: ['tr', 'tbody', 'table'],
6801
+ thead: ['table'],
6802
+ tfoot: ['table'],
6803
+ tr: ['tbody', 'table']
6804
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
6805
+
6806
+ var getTagName = function getTagName(text) {
6807
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
6808
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
6809
+
6810
+
6811
+ createFragment = function createFragment(html) {
6812
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
6813
+
6814
+ if (!isUndefined(wrapperTags)) {
6815
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
6816
+ _step5;
6817
+
6818
+ try {
6819
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6820
+ var wrapperTag = _step5.value;
6821
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
6822
+ }
6823
+ } catch (err) {
6824
+ _iterator5.e(err);
6825
+ } finally {
6826
+ _iterator5.f();
6827
+ }
6828
+ } // For IE11, the document title must not be undefined, but it can be an empty string
6829
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
6818
6830
 
6819
- function isHydrating() {
6820
- return hydrating;
6821
- }
6822
6831
 
6823
- var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6824
- var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6832
+ var doc = document.implementation.createHTMLDocument('');
6833
+ doc.body.innerHTML = html;
6834
+ var content = doc.body;
6825
6835
 
6826
- function cloneNode(node, deep) {
6827
- return node.cloneNode(deep);
6828
- }
6836
+ if (!isUndefined(wrapperTags)) {
6837
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
6838
+ content = content.firstChild;
6839
+ }
6840
+ }
6829
6841
 
6830
- function createElement$1(tagName, namespace) {
6831
- return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6832
- }
6842
+ return content.firstChild;
6843
+ };
6844
+ }
6833
6845
 
6834
- function createText(content) {
6835
- return document.createTextNode(content);
6836
- }
6846
+ function insert(node, parent, anchor) {
6847
+ parent.insertBefore(node, anchor);
6848
+ }
6837
6849
 
6838
- function createComment(content) {
6839
- return document.createComment(content);
6840
- }
6850
+ function remove(node, parent) {
6851
+ parent.removeChild(node);
6852
+ }
6841
6853
 
6842
- function insert(node, parent, anchor) {
6843
- parent.insertBefore(node, anchor);
6844
- }
6854
+ function nextSibling(node) {
6855
+ return node.nextSibling;
6856
+ }
6845
6857
 
6846
- function remove(node, parent) {
6847
- parent.removeChild(node);
6848
- }
6858
+ function attachShadow(element, options) {
6859
+ // `shadowRoot` will be non-null in two cases:
6860
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
6861
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
6862
+ // root component with customElement.define('c-app', Ctor)
6863
+ if (!isNull(element.shadowRoot)) {
6864
+ return element.shadowRoot;
6865
+ }
6849
6866
 
6850
- function nextSibling(node) {
6851
- return node.nextSibling;
6852
- }
6867
+ return element.attachShadow(options);
6868
+ }
6853
6869
 
6854
- function attachShadow(element, options) {
6855
- // `hydrating` will be true in two cases:
6856
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
6857
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
6858
- // root component with customeElement.define('c-app', Ctor)
6859
- //
6860
- // The second case can be treated as a failed hydration with nominal impact
6861
- // to performance. However, because <c-app> won't have a <template shadowroot>
6862
- // declarative child, `element.shadowRoot` is `null`.
6863
- if (hydrating && element.shadowRoot) {
6864
- return element.shadowRoot;
6870
+ function setText(node, content) {
6871
+ node.nodeValue = content;
6865
6872
  }
6866
6873
 
6867
- return element.attachShadow(options);
6868
- }
6874
+ function getProperty(node, key) {
6875
+ return node[key];
6876
+ }
6869
6877
 
6870
- function setText(node, content) {
6871
- node.nodeValue = content;
6872
- }
6878
+ function setProperty(node, key, value) {
6879
+ node[key] = value;
6880
+ }
6873
6881
 
6874
- function getProperty(node, key) {
6875
- return node[key];
6876
- }
6882
+ function getAttribute(element, name, namespace) {
6883
+ return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
6884
+ }
6877
6885
 
6878
- function setProperty(node, key, value) {
6886
+ function setAttribute(element, name, value, namespace) {
6887
+ return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6888
+ }
6879
6889
 
6880
- node[key] = value;
6881
- }
6890
+ function removeAttribute(element, name, namespace) {
6891
+ if (isUndefined(namespace)) {
6892
+ element.removeAttribute(name);
6893
+ } else {
6894
+ element.removeAttributeNS(namespace, name);
6895
+ }
6896
+ }
6882
6897
 
6883
- function getAttribute(element, name, namespace) {
6884
- return isUndefined$1(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
6885
- }
6898
+ function addEventListener(target, type, callback, options) {
6899
+ target.addEventListener(type, callback, options);
6900
+ }
6886
6901
 
6887
- function setAttribute(element, name, value, namespace) {
6888
- return isUndefined$1(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6889
- }
6902
+ function removeEventListener(target, type, callback, options) {
6903
+ target.removeEventListener(type, callback, options);
6904
+ }
6890
6905
 
6891
- function removeAttribute(element, name, namespace) {
6892
- if (isUndefined$1(namespace)) {
6893
- element.removeAttribute(name);
6894
- } else {
6895
- element.removeAttributeNS(namespace, name);
6906
+ function dispatchEvent(target, event) {
6907
+ return target.dispatchEvent(event);
6896
6908
  }
6897
- }
6898
6909
 
6899
- function addEventListener(target, type, callback, options) {
6900
- target.addEventListener(type, callback, options);
6901
- }
6910
+ function getClassList(element) {
6911
+ return element.classList;
6912
+ }
6902
6913
 
6903
- function removeEventListener(target, type, callback, options) {
6904
- target.removeEventListener(type, callback, options);
6905
- }
6914
+ function setCSSStyleProperty(element, name, value, important) {
6915
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
6916
+ // represent elements in the engine?
6917
+ element.style.setProperty(name, value, important ? 'important' : '');
6918
+ }
6906
6919
 
6907
- function dispatchEvent(target, event) {
6908
- return target.dispatchEvent(event);
6909
- }
6920
+ function getBoundingClientRect(element) {
6921
+ return element.getBoundingClientRect();
6922
+ }
6910
6923
 
6911
- function getClassList(element) {
6912
- return element.classList;
6913
- }
6924
+ function querySelector(element, selectors) {
6925
+ return element.querySelector(selectors);
6926
+ }
6914
6927
 
6915
- function setCSSStyleProperty(element, name, value, important) {
6916
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
6917
- // represent elements in the engine?
6918
- element.style.setProperty(name, value, important ? 'important' : '');
6919
- }
6928
+ function querySelectorAll(element, selectors) {
6929
+ return element.querySelectorAll(selectors);
6930
+ }
6920
6931
 
6921
- function getBoundingClientRect(element) {
6922
- return element.getBoundingClientRect();
6923
- }
6932
+ function getElementsByTagName(element, tagNameOrWildCard) {
6933
+ return element.getElementsByTagName(tagNameOrWildCard);
6934
+ }
6924
6935
 
6925
- function querySelector(element, selectors) {
6926
- return element.querySelector(selectors);
6927
- }
6936
+ function getElementsByClassName(element, names) {
6937
+ return element.getElementsByClassName(names);
6938
+ }
6928
6939
 
6929
- function querySelectorAll(element, selectors) {
6930
- return element.querySelectorAll(selectors);
6931
- }
6940
+ function getChildren(element) {
6941
+ return element.children;
6942
+ }
6932
6943
 
6933
- function getElementsByTagName(element, tagNameOrWildCard) {
6934
- return element.getElementsByTagName(tagNameOrWildCard);
6935
- }
6944
+ function getChildNodes(element) {
6945
+ return element.childNodes;
6946
+ }
6936
6947
 
6937
- function getElementsByClassName(element, names) {
6938
- return element.getElementsByClassName(names);
6939
- }
6948
+ function getFirstChild(element) {
6949
+ return element.firstChild;
6950
+ }
6940
6951
 
6941
- function getChildren(element) {
6942
- return element.children;
6943
- }
6952
+ function getFirstElementChild(element) {
6953
+ return element.firstElementChild;
6954
+ }
6944
6955
 
6945
- function getChildNodes(element) {
6946
- return element.childNodes;
6947
- }
6956
+ function getLastChild(element) {
6957
+ return element.lastChild;
6958
+ }
6948
6959
 
6949
- function getFirstChild(element) {
6950
- return element.firstChild;
6951
- }
6960
+ function getLastElementChild(element) {
6961
+ return element.lastElementChild;
6962
+ }
6952
6963
 
6953
- function getFirstElementChild(element) {
6954
- return element.firstElementChild;
6955
- }
6964
+ function isConnected(node) {
6965
+ return node.isConnected;
6966
+ }
6956
6967
 
6957
- function getLastChild(element) {
6958
- return element.lastChild;
6959
- }
6968
+ function assertInstanceOfHTMLElement(elm, msg) {
6969
+ assertInvariant(elm instanceof HTMLElement, msg);
6970
+ }
6960
6971
 
6961
- function getLastElementChild(element) {
6962
- return element.lastElementChild;
6963
- }
6972
+ var HTMLElementExported = HTMLElementConstructor;
6973
+ var renderer = {
6974
+ HTMLElementExported: HTMLElementExported,
6975
+ insert: insert,
6976
+ remove: remove,
6977
+ cloneNode: cloneNode,
6978
+ createFragment: createFragment,
6979
+ createElement: createElement,
6980
+ createText: createText,
6981
+ createComment: createComment,
6982
+ nextSibling: nextSibling,
6983
+ attachShadow: attachShadow,
6984
+ getProperty: getProperty,
6985
+ setProperty: setProperty,
6986
+ setText: setText,
6987
+ getAttribute: getAttribute,
6988
+ setAttribute: setAttribute,
6989
+ removeAttribute: removeAttribute,
6990
+ addEventListener: addEventListener,
6991
+ removeEventListener: removeEventListener,
6992
+ dispatchEvent: dispatchEvent,
6993
+ getClassList: getClassList,
6994
+ setCSSStyleProperty: setCSSStyleProperty,
6995
+ getBoundingClientRect: getBoundingClientRect,
6996
+ querySelector: querySelector,
6997
+ querySelectorAll: querySelectorAll,
6998
+ getElementsByTagName: getElementsByTagName,
6999
+ getElementsByClassName: getElementsByClassName,
7000
+ getChildren: getChildren,
7001
+ getChildNodes: getChildNodes,
7002
+ getFirstChild: getFirstChild,
7003
+ getFirstElementChild: getFirstElementChild,
7004
+ getLastChild: getLastChild,
7005
+ getLastElementChild: getLastElementChild,
7006
+ isConnected: isConnected,
7007
+ assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
7008
+ defineCustomElement: defineCustomElement,
7009
+ getCustomElement: getCustomElement
7010
+ }; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
6964
7011
 
6965
- function isConnected(node) {
6966
- return node.isConnected;
7012
+ Object.setPrototypeOf(renderer, baseRenderer);
7013
+ return renderer;
6967
7014
  }
7015
+ /*
7016
+ * Copyright (c) 2018, salesforce.com, inc.
7017
+ * All rights reserved.
7018
+ * SPDX-License-Identifier: MIT
7019
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7020
+ */
7021
+
7022
+ /**
7023
+ * The base renderer that will be used by engine-core.
7024
+ * This will be used for DOM operations when lwc is running in a browser environment.
7025
+ */
6968
7026
 
6969
- function assertInstanceOfHTMLElement(elm, msg) {
6970
- assert.invariant(elm instanceof HTMLElement, msg);
6971
- }
6972
7027
 
6973
- var HTMLElementExported = HTMLElementConstructor;
6974
- var renderer = {
6975
- ssr: ssr,
6976
- isNativeShadowDefined: isNativeShadowDefined,
6977
- isSyntheticShadowDefined: isSyntheticShadowDefined,
6978
- HTMLElementExported: HTMLElementExported,
6979
- isHydrating: isHydrating,
6980
- insert: insert,
6981
- remove: remove,
6982
- cloneNode: cloneNode,
6983
- createFragment: createFragment,
6984
- createElement: createElement$1,
6985
- createText: createText,
6986
- createComment: createComment,
6987
- nextSibling: nextSibling,
6988
- attachShadow: attachShadow,
6989
- getProperty: getProperty,
6990
- setProperty: setProperty,
6991
- setText: setText,
6992
- getAttribute: getAttribute,
6993
- setAttribute: setAttribute,
6994
- removeAttribute: removeAttribute,
6995
- addEventListener: addEventListener,
6996
- removeEventListener: removeEventListener,
6997
- dispatchEvent: dispatchEvent,
6998
- getClassList: getClassList,
6999
- setCSSStyleProperty: setCSSStyleProperty,
7000
- getBoundingClientRect: getBoundingClientRect,
7001
- querySelector: querySelector,
7002
- querySelectorAll: querySelectorAll,
7003
- getElementsByTagName: getElementsByTagName,
7004
- getElementsByClassName: getElementsByClassName,
7005
- getChildren: getChildren,
7006
- getChildNodes: getChildNodes,
7007
- getFirstChild: getFirstChild,
7008
- getFirstElementChild: getFirstElementChild,
7009
- getLastChild: getLastChild,
7010
- getLastElementChild: getLastElementChild,
7011
- isConnected: isConnected,
7028
+ var renderer = assign( // The base renderer will invoke the factory with null and assign additional properties that are
7029
+ // shared across renderers
7030
+ rendererFactory(null), // Properties that are either not required to be sandboxed or rely on a globally shared information
7031
+ {
7032
+ // insertStyleSheet implementation shares a global cache of stylesheet data
7012
7033
  insertStylesheet: insertStylesheet,
7013
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
7014
- defineCustomElement: defineCustomElement,
7015
- getCustomElement: getCustomElement
7016
- };
7034
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7035
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
7036
+ });
7017
7037
  /*
7018
7038
  * Copyright (c) 2018, salesforce.com, inc.
7019
7039
  * All rights reserved.
@@ -7078,13 +7098,8 @@ var LWC = (function (exports) {
7078
7098
  }
7079
7099
 
7080
7100
  try {
7081
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7082
- // and uses the same algo to create the stylesheets as in SSR.
7083
- setIsHydrating(true);
7084
7101
  var vm = createVMWithProps(element, Ctor, props);
7085
- hydrateRoot(vm); // set it back since now we finished hydration.
7086
-
7087
- setIsHydrating(false);
7102
+ hydrateRoot(vm);
7088
7103
  } catch (e) {
7089
7104
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
7090
7105
  // with the client generated DOM.
@@ -7095,11 +7110,7 @@ var LWC = (function (exports) {
7095
7110
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
7096
7111
 
7097
7112
  createVMWithProps(element, Ctor, props);
7098
- setIsHydrating(false);
7099
7113
  connectRootElement(element);
7100
- } finally {
7101
- // in case there's an error during recovery
7102
- setIsHydrating(false);
7103
7114
  }
7104
7115
  }
7105
7116
  /*
@@ -7190,7 +7201,6 @@ var LWC = (function (exports) {
7190
7201
  * SPDX-License-Identifier: MIT
7191
7202
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7192
7203
  */
7193
- // TODO [#2472]: Remove this workaround when appropriate.
7194
7204
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
7195
7205
 
7196
7206
 
@@ -7207,39 +7217,41 @@ var LWC = (function (exports) {
7207
7217
  }
7208
7218
 
7209
7219
  return node; // for convenience
7210
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7211
- // created via createElement.
7212
-
7220
+ }
7213
7221
 
7214
- var _Node$1$prototype = _Node$1.prototype,
7215
- _appendChild2 = _Node$1$prototype.appendChild,
7216
- _insertBefore2 = _Node$1$prototype.insertBefore,
7217
- _removeChild2 = _Node$1$prototype.removeChild,
7218
- _replaceChild2 = _Node$1$prototype.replaceChild;
7219
- assign(_Node$1.prototype, {
7220
- appendChild: function appendChild(newChild) {
7221
- var appendedNode = _appendChild2.call(this, newChild);
7222
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7223
+ // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7224
+ // created via createElement.
7225
+ var _Node$1$prototype = _Node$1.prototype,
7226
+ _appendChild = _Node$1$prototype.appendChild,
7227
+ _insertBefore = _Node$1$prototype.insertBefore,
7228
+ _removeChild = _Node$1$prototype.removeChild,
7229
+ _replaceChild = _Node$1$prototype.replaceChild;
7230
+ assign(_Node$1.prototype, {
7231
+ appendChild: function appendChild(newChild) {
7232
+ var appendedNode = _appendChild.call(this, newChild);
7222
7233
 
7223
- return callNodeSlot(appendedNode, ConnectingSlot);
7224
- },
7225
- insertBefore: function insertBefore(newChild, referenceNode) {
7226
- var insertedNode = _insertBefore2.call(this, newChild, referenceNode);
7234
+ return callNodeSlot(appendedNode, ConnectingSlot);
7235
+ },
7236
+ insertBefore: function insertBefore(newChild, referenceNode) {
7237
+ var insertedNode = _insertBefore.call(this, newChild, referenceNode);
7227
7238
 
7228
- return callNodeSlot(insertedNode, ConnectingSlot);
7229
- },
7230
- removeChild: function removeChild(oldChild) {
7231
- var removedNode = _removeChild2.call(this, oldChild);
7239
+ return callNodeSlot(insertedNode, ConnectingSlot);
7240
+ },
7241
+ removeChild: function removeChild(oldChild) {
7242
+ var removedNode = _removeChild.call(this, oldChild);
7232
7243
 
7233
- return callNodeSlot(removedNode, DisconnectingSlot);
7234
- },
7235
- replaceChild: function replaceChild(newChild, oldChild) {
7236
- var replacedNode = _replaceChild2.call(this, newChild, oldChild);
7244
+ return callNodeSlot(removedNode, DisconnectingSlot);
7245
+ },
7246
+ replaceChild: function replaceChild(newChild, oldChild) {
7247
+ var replacedNode = _replaceChild.call(this, newChild, oldChild);
7237
7248
 
7238
- callNodeSlot(replacedNode, DisconnectingSlot);
7239
- callNodeSlot(newChild, ConnectingSlot);
7240
- return replacedNode;
7241
- }
7242
- });
7249
+ callNodeSlot(replacedNode, DisconnectingSlot);
7250
+ callNodeSlot(newChild, ConnectingSlot);
7251
+ return replacedNode;
7252
+ }
7253
+ });
7254
+ }
7243
7255
  /**
7244
7256
  * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
7245
7257
  * difference that in the options, you can pass the `is` property set to a Constructor instead of
@@ -7252,6 +7264,7 @@ var LWC = (function (exports) {
7252
7264
  * ```
7253
7265
  */
7254
7266
 
7267
+
7255
7268
  function createElement(sel, options) {
7256
7269
  if (!isObject(options) || isNull(options)) {
7257
7270
  throw new TypeError("\"createElement\" function expects an object as second parameter but received \"".concat(toString$1(options), "\"."));
@@ -7279,8 +7292,12 @@ var LWC = (function (exports) {
7279
7292
  mode: options.mode !== 'closed' ? 'open' : 'closed',
7280
7293
  owner: null
7281
7294
  });
7282
- ConnectingSlot.set(elm, connectRootElement);
7283
- DisconnectingSlot.set(elm, disconnectRootElement);
7295
+
7296
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7297
+ ConnectingSlot.set(elm, connectRootElement);
7298
+ DisconnectingSlot.set(elm, disconnectRootElement);
7299
+ }
7300
+
7284
7301
  wasComponentUpgraded = true;
7285
7302
  });
7286
7303
 
@@ -7327,7 +7344,7 @@ var LWC = (function (exports) {
7327
7344
  // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
7328
7345
 
7329
7346
 
7330
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7347
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7331
7348
  }
7332
7349
  /*
7333
7350
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7371,7 +7388,7 @@ var LWC = (function (exports) {
7371
7388
  });
7372
7389
  freeze(LightningElement);
7373
7390
  seal(LightningElement.prototype);
7374
- /* version: 2.22.0 */
7391
+ /* version: 2.23.2 */
7375
7392
 
7376
7393
  exports.LightningElement = LightningElement;
7377
7394
  exports.__unstable__ProfilerControl = profilerControl;
@@ -7393,6 +7410,7 @@ var LWC = (function (exports) {
7393
7410
  exports.registerDecorators = registerDecorators;
7394
7411
  exports.registerTemplate = registerTemplate;
7395
7412
  exports.renderer = renderer;
7413
+ exports.rendererFactory = rendererFactory;
7396
7414
  exports.sanitizeAttribute = sanitizeAttribute;
7397
7415
  exports.setFeatureFlag = setFeatureFlag;
7398
7416
  exports.setFeatureFlagForTest = setFeatureFlagForTest;