lwc 2.22.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +58 -114
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +58 -114
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +56 -112
  5. package/dist/engine-dom/iife/es5/engine-dom.js +61 -123
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +59 -121
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +58 -114
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +56 -112
  11. package/dist/engine-dom/umd/es5/engine-dom.js +61 -123
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +59 -121
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +54 -132
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +54 -132
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +13 -10
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +13 -10
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +13 -10
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +15 -14
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +15 -14
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +13 -10
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +13 -10
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +15 -14
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +15 -14
  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
@@ -349,7 +349,7 @@
349
349
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
350
350
  return attributeName;
351
351
  }
352
- /** version: 2.22.0 */
352
+ /** version: 2.23.0 */
353
353
 
354
354
  /*
355
355
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1019,6 +1019,15 @@
1019
1019
  HTMLElementOriginalDescriptors[propName] = descriptor;
1020
1020
  }
1021
1021
  });
1022
+
1023
+ function updateComponentValue(vm, key, newValue) {
1024
+ var cmpFields = vm.cmpFields;
1025
+
1026
+ if (newValue !== cmpFields[key]) {
1027
+ cmpFields[key] = newValue;
1028
+ componentValueMutated(vm, key);
1029
+ }
1030
+ }
1022
1031
  /**
1023
1032
  * Copyright (C) 2017 salesforce.com, inc.
1024
1033
  */
@@ -1749,11 +1758,7 @@
1749
1758
  set: function set(newValue) {
1750
1759
  var vm = getAssociatedVM(this);
1751
1760
 
1752
- if (newValue !== vm.cmpProps[propName]) {
1753
- vm.cmpProps[propName] = newValue;
1754
- componentValueMutated(vm, propName);
1755
- }
1756
-
1761
+ updateComponentValue(vm, propName, newValue);
1757
1762
  return _set.call(vm.elm, newValue);
1758
1763
  }
1759
1764
  };
@@ -2041,11 +2046,7 @@
2041
2046
  },
2042
2047
  set: function set(newValue) {
2043
2048
  var vm = getAssociatedVM(this);
2044
-
2045
- if (newValue !== vm.cmpFields[key]) {
2046
- vm.cmpFields[key] = newValue;
2047
- componentValueMutated(vm, key);
2048
- }
2049
+ updateComponentValue(vm, key, newValue);
2049
2050
  },
2050
2051
  enumerable: true,
2051
2052
  configurable: true
@@ -2223,11 +2224,7 @@
2223
2224
  var vm = getAssociatedVM(this);
2224
2225
 
2225
2226
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2226
-
2227
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2228
- vm.cmpFields[key] = reactiveOrAnyValue;
2229
- componentValueMutated(vm, key);
2230
- }
2227
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2231
2228
  },
2232
2229
  enumerable: true,
2233
2230
  configurable: true
@@ -2268,10 +2265,7 @@
2268
2265
  * system to be backward compatible.
2269
2266
  */
2270
2267
 
2271
- if (value !== vm.cmpFields[key]) {
2272
- vm.cmpFields[key] = value;
2273
- componentValueMutated(vm, key);
2274
- }
2268
+ updateComponentValue(vm, key, value);
2275
2269
  },
2276
2270
  enumerable: true,
2277
2271
  configurable: true
@@ -3137,9 +3131,7 @@
3137
3131
  function createStylesheet(vm, stylesheets) {
3138
3132
  var renderMode = vm.renderMode,
3139
3133
  shadowMode = vm.shadowMode,
3140
- _vm$renderer2 = vm.renderer,
3141
- ssr = _vm$renderer2.ssr,
3142
- insertStylesheet = _vm$renderer2.insertStylesheet;
3134
+ insertStylesheet = vm.renderer.insertStylesheet;
3143
3135
 
3144
3136
  if (renderMode === 1
3145
3137
  /* RenderMode.Shadow */
@@ -3149,7 +3141,7 @@
3149
3141
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
3150
3142
  insertStylesheet(stylesheets[_i12]);
3151
3143
  }
3152
- } else if (ssr || vm.hydrated) {
3144
+ } else if (vm.hydrated) {
3153
3145
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3154
3146
  // This works in the client, because the stylesheets are created, and cached in the VM
3155
3147
  // the first time the VM renders.
@@ -3530,7 +3522,7 @@
3530
3522
  }
3531
3523
  }
3532
3524
 
3533
- function patch(n1, n2, renderer) {
3525
+ function patch(n1, n2, parent, renderer) {
3534
3526
  var _a, _b;
3535
3527
 
3536
3528
  if (n1 === n2) {
@@ -3567,7 +3559,7 @@
3567
3559
  case 3
3568
3560
  /* VNodeType.CustomElement */
3569
3561
  :
3570
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3562
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3571
3563
  break;
3572
3564
  }
3573
3565
  }
@@ -3732,25 +3724,34 @@
3732
3724
  }
3733
3725
  }
3734
3726
 
3735
- function patchCustomElement(n1, n2, renderer) {
3736
- var elm = n2.elm = n1.elm;
3737
- var vm = n2.vm = n1.vm;
3738
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3727
+ function patchCustomElement(n1, n2, parent, renderer) {
3728
+ if (n1.ctor !== n2.ctor) {
3729
+ // If the constructor, unmount the current component and mount a new one using the new
3730
+ // constructor.
3731
+ var anchor = renderer.nextSibling(n1.elm);
3732
+ unmount(n1, parent, renderer, true);
3733
+ mountCustomElement(n2, parent, anchor, renderer);
3734
+ } else {
3735
+ // Otherwise patch the existing component with new props/attrs/etc.
3736
+ var elm = n2.elm = n1.elm;
3737
+ var vm = n2.vm = n1.vm;
3738
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3739
3739
 
3740
- if (!isUndefined$1(vm)) {
3741
- // in fallback mode, the allocation will always set children to
3742
- // empty and delegate the real allocation to the slot elements
3743
- allocateChildren(n2, vm);
3744
- } // in fallback mode, the children will be always empty, so, nothing
3745
- // will happen, but in native, it does allocate the light dom
3740
+ if (!isUndefined$1(vm)) {
3741
+ // in fallback mode, the allocation will always set children to
3742
+ // empty and delegate the real allocation to the slot elements
3743
+ allocateChildren(n2, vm);
3744
+ } // in fallback mode, the children will be always empty, so, nothing
3745
+ // will happen, but in native, it does allocate the light dom
3746
3746
 
3747
3747
 
3748
- patchChildren(n1.children, n2.children, elm, renderer);
3748
+ patchChildren(n1.children, n2.children, elm, renderer);
3749
3749
 
3750
- if (!isUndefined$1(vm)) {
3751
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3752
- // this is important to preserve the top to bottom synchronous rendering phase.
3753
- rerenderVM(vm);
3750
+ if (!isUndefined$1(vm)) {
3751
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3752
+ // this is important to preserve the top to bottom synchronous rendering phase.
3753
+ rerenderVM(vm);
3754
+ }
3754
3755
  }
3755
3756
  }
3756
3757
 
@@ -4074,22 +4075,22 @@
4074
4075
  } else if (!isVNode(newEndVnode)) {
4075
4076
  newEndVnode = newCh[--newEndIdx];
4076
4077
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
4077
- patch(oldStartVnode, newStartVnode, renderer);
4078
+ patch(oldStartVnode, newStartVnode, parent, renderer);
4078
4079
  oldStartVnode = oldCh[++oldStartIdx];
4079
4080
  newStartVnode = newCh[++newStartIdx];
4080
4081
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
4081
- patch(oldEndVnode, newEndVnode, renderer);
4082
+ patch(oldEndVnode, newEndVnode, parent, renderer);
4082
4083
  oldEndVnode = oldCh[--oldEndIdx];
4083
4084
  newEndVnode = newCh[--newEndIdx];
4084
4085
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
4085
4086
  // Vnode moved right
4086
- patch(oldStartVnode, newEndVnode, renderer);
4087
+ patch(oldStartVnode, newEndVnode, parent, renderer);
4087
4088
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4088
4089
  oldStartVnode = oldCh[++oldStartIdx];
4089
4090
  newEndVnode = newCh[--newEndIdx];
4090
4091
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
4091
4092
  // Vnode moved left
4092
- patch(oldEndVnode, newStartVnode, renderer);
4093
+ patch(oldEndVnode, newStartVnode, parent, renderer);
4093
4094
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4094
4095
  oldEndVnode = oldCh[--oldEndIdx];
4095
4096
  newStartVnode = newCh[++newStartIdx];
@@ -4112,7 +4113,7 @@
4112
4113
  // New element
4113
4114
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4114
4115
  } else {
4115
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
4116
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
4116
4117
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4117
4118
  // so we only care about the `oldCh` object inside this function.
4118
4119
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -4182,7 +4183,7 @@
4182
4183
  if (isVNode(n1)) {
4183
4184
  if (isVNode(n2)) {
4184
4185
  // both vnodes are equivalent, and we just need to patch them
4185
- patch(n1, n2, renderer);
4186
+ patch(n1, n2, parent, renderer);
4186
4187
  anchor = n2.elm;
4187
4188
  } else {
4188
4189
  // removing the old vnode since the new one is null
@@ -4483,19 +4484,11 @@
4483
4484
 
4484
4485
  return url;
4485
4486
  }
4486
- /**
4487
- * Map to store an index value assigned to any dynamic component reference ingested
4488
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4489
- * component reference to avoid diffing algo mismatches.
4490
- */
4491
-
4492
-
4493
- var DynamicImportedComponentMap = new Map();
4494
- var dynamicImportedComponentCounter = 0;
4495
4487
  /**
4496
4488
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4497
4489
  */
4498
4490
 
4491
+
4499
4492
  function dc(sel, Ctor, data) {
4500
4493
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
4501
4494
 
@@ -4508,22 +4501,7 @@
4508
4501
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
4509
4502
  }
4510
4503
 
4511
- var idx = DynamicImportedComponentMap.get(Ctor);
4512
-
4513
- if (isUndefined$1(idx)) {
4514
- idx = dynamicImportedComponentCounter++;
4515
- DynamicImportedComponentMap.set(Ctor, idx);
4516
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4517
- // to identify different constructors as vnodes with different keys to avoid reusing the
4518
- // element used for previous constructors.
4519
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4520
- // hoisting optimization.
4521
-
4522
-
4523
- var newData = Object.assign(Object.assign({}, data), {
4524
- key: "dc:".concat(idx, ":").concat(data.key)
4525
- });
4526
- return c(sel, Ctor, newData, children);
4504
+ return c(sel, Ctor, data, children);
4527
4505
  }
4528
4506
  /**
4529
4507
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5363,13 +5341,7 @@
5363
5341
  }
5364
5342
 
5365
5343
  function runRenderedCallback(vm) {
5366
- var renderedCallback = vm.def.renderedCallback,
5367
- ssr = vm.renderer.ssr;
5368
-
5369
- if (isTrue(ssr)) {
5370
- return;
5371
- }
5372
-
5344
+ var renderedCallback = vm.def.renderedCallback;
5373
5345
  var rendered = Services.rendered;
5374
5346
 
5375
5347
  if (rendered) {
@@ -5592,9 +5564,7 @@
5592
5564
  }
5593
5565
 
5594
5566
  function scheduleRehydration(vm) {
5595
- var ssr = vm.renderer.ssr;
5596
-
5597
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5567
+ if (isTrue(vm.isScheduled)) {
5598
5568
  return;
5599
5569
  }
5600
5570
 
@@ -5696,13 +5666,8 @@
5696
5666
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
5697
5667
 
5698
5668
  function createFieldDataCallback(vm, name) {
5699
- var cmpFields = vm.cmpFields;
5700
5669
  return function (value) {
5701
- if (value !== vm.cmpFields[name]) {
5702
- // storing the value in the underlying storage
5703
- cmpFields[name] = value;
5704
- componentValueMutated(vm, name);
5705
- }
5670
+ updateComponentValue(vm, name, value);
5706
5671
  };
5707
5672
  }
5708
5673
 
@@ -6492,7 +6457,7 @@
6492
6457
 
6493
6458
  return ctor;
6494
6459
  }
6495
- /* version: 2.22.0 */
6460
+ /* version: 2.23.0 */
6496
6461
 
6497
6462
  /*
6498
6463
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6811,18 +6776,6 @@
6811
6776
  HTMLElementConstructor.prototype = HTMLElement.prototype;
6812
6777
  }
6813
6778
 
6814
- var hydrating = false;
6815
-
6816
- function setIsHydrating(value) {
6817
- hydrating = value;
6818
- }
6819
-
6820
- var ssr = false;
6821
-
6822
- function isHydrating() {
6823
- return hydrating;
6824
- }
6825
-
6826
6779
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
6827
6780
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
6828
6781
 
@@ -6855,15 +6808,11 @@
6855
6808
  }
6856
6809
 
6857
6810
  function attachShadow(element, options) {
6858
- // `hydrating` will be true in two cases:
6811
+ // `shadowRoot` will be non-null in two cases:
6859
6812
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
6860
6813
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
6861
- // root component with customeElement.define('c-app', Ctor)
6862
- //
6863
- // The second case can be treated as a failed hydration with nominal impact
6864
- // to performance. However, because <c-app> won't have a <template shadowroot>
6865
- // declarative child, `element.shadowRoot` is `null`.
6866
- if (hydrating && element.shadowRoot) {
6814
+ // root component with customElement.define('c-app', Ctor)
6815
+ if (!isNull(element.shadowRoot)) {
6867
6816
  return element.shadowRoot;
6868
6817
  }
6869
6818
 
@@ -6975,11 +6924,9 @@
6975
6924
 
6976
6925
  var HTMLElementExported = HTMLElementConstructor;
6977
6926
  var renderer = {
6978
- ssr: ssr,
6979
6927
  isNativeShadowDefined: isNativeShadowDefined,
6980
6928
  isSyntheticShadowDefined: isSyntheticShadowDefined,
6981
6929
  HTMLElementExported: HTMLElementExported,
6982
- isHydrating: isHydrating,
6983
6930
  insert: insert,
6984
6931
  remove: remove,
6985
6932
  cloneNode: cloneNode,
@@ -7081,13 +7028,8 @@
7081
7028
  }
7082
7029
 
7083
7030
  try {
7084
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7085
- // and uses the same algo to create the stylesheets as in SSR.
7086
- setIsHydrating(true);
7087
7031
  var vm = createVMWithProps(element, Ctor, props);
7088
- hydrateRoot(vm); // set it back since now we finished hydration.
7089
-
7090
- setIsHydrating(false);
7032
+ hydrateRoot(vm);
7091
7033
  } catch (e) {
7092
7034
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
7093
7035
  // with the client generated DOM.
@@ -7098,11 +7040,7 @@
7098
7040
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
7099
7041
 
7100
7042
  createVMWithProps(element, Ctor, props);
7101
- setIsHydrating(false);
7102
7043
  connectRootElement(element);
7103
- } finally {
7104
- // in case there's an error during recovery
7105
- setIsHydrating(false);
7106
7044
  }
7107
7045
  }
7108
7046
  /*
@@ -7374,7 +7312,7 @@
7374
7312
  });
7375
7313
  freeze(LightningElement);
7376
7314
  seal(LightningElement.prototype);
7377
- /* version: 2.22.0 */
7315
+ /* version: 2.23.0 */
7378
7316
 
7379
7317
  exports.LightningElement = LightningElement;
7380
7318
  exports.__unstable__ProfilerControl = profilerControl;