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
@@ -368,9 +368,9 @@
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.0";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.22.0 */
373
+ /** version: 2.23.0 */
374
374
 
375
375
  /*
376
376
  * Copyright (c) 2018, salesforce.com, inc.
@@ -549,7 +549,7 @@
549
549
  setFeatureFlag(name, value);
550
550
  }
551
551
  }
552
- /** version: 2.22.0 */
552
+ /** version: 2.23.0 */
553
553
 
554
554
  /*
555
555
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1480,6 +1480,15 @@
1480
1480
  function patchLightningElementPrototypeWithRestrictions(proto) {
1481
1481
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1482
1482
  }
1483
+
1484
+ function updateComponentValue(vm, key, newValue) {
1485
+ var cmpFields = vm.cmpFields;
1486
+
1487
+ if (newValue !== cmpFields[key]) {
1488
+ cmpFields[key] = newValue;
1489
+ componentValueMutated(vm, key);
1490
+ }
1491
+ }
1483
1492
  /**
1484
1493
  * Copyright (C) 2017 salesforce.com, inc.
1485
1494
  */
@@ -2375,11 +2384,7 @@
2375
2384
  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
2385
  }
2377
2386
 
2378
- if (newValue !== vm.cmpProps[propName]) {
2379
- vm.cmpProps[propName] = newValue;
2380
- componentValueMutated(vm, propName);
2381
- }
2382
-
2387
+ updateComponentValue(vm, propName, newValue);
2383
2388
  return _set.call(vm.elm, newValue);
2384
2389
  }
2385
2390
  };
@@ -2755,11 +2760,7 @@
2755
2760
  },
2756
2761
  set: function set(newValue) {
2757
2762
  var vm = getAssociatedVM(this);
2758
-
2759
- if (newValue !== vm.cmpFields[key]) {
2760
- vm.cmpFields[key] = newValue;
2761
- componentValueMutated(vm, key);
2762
- }
2763
+ updateComponentValue(vm, key, newValue);
2763
2764
  },
2764
2765
  enumerable: true,
2765
2766
  configurable: true
@@ -2977,11 +2978,7 @@
2977
2978
  }
2978
2979
 
2979
2980
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2980
-
2981
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2982
- vm.cmpFields[key] = reactiveOrAnyValue;
2983
- componentValueMutated(vm, key);
2984
- }
2981
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2985
2982
  },
2986
2983
  enumerable: true,
2987
2984
  configurable: true
@@ -3025,10 +3022,7 @@
3025
3022
  * system to be backward compatible.
3026
3023
  */
3027
3024
 
3028
- if (value !== vm.cmpFields[key]) {
3029
- vm.cmpFields[key] = value;
3030
- componentValueMutated(vm, key);
3031
- }
3025
+ updateComponentValue(vm, key, value);
3032
3026
  },
3033
3027
  enumerable: true,
3034
3028
  configurable: true
@@ -4351,9 +4345,7 @@
4351
4345
  function createStylesheet(vm, stylesheets) {
4352
4346
  var renderMode = vm.renderMode,
4353
4347
  shadowMode = vm.shadowMode,
4354
- _vm$renderer2 = vm.renderer,
4355
- ssr = _vm$renderer2.ssr,
4356
- insertStylesheet = _vm$renderer2.insertStylesheet;
4348
+ insertStylesheet = vm.renderer.insertStylesheet;
4357
4349
 
4358
4350
  if (renderMode === 1
4359
4351
  /* RenderMode.Shadow */
@@ -4363,7 +4355,7 @@
4363
4355
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4364
4356
  insertStylesheet(stylesheets[_i12]);
4365
4357
  }
4366
- } else if (ssr || vm.hydrated) {
4358
+ } else if (vm.hydrated) {
4367
4359
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4368
4360
  // This works in the client, because the stylesheets are created, and cached in the VM
4369
4361
  // the first time the VM renders.
@@ -4749,7 +4741,7 @@
4749
4741
  }
4750
4742
  }
4751
4743
 
4752
- function patch(n1, n2, renderer) {
4744
+ function patch(n1, n2, parent, renderer) {
4753
4745
  var _a, _b;
4754
4746
 
4755
4747
  if (n1 === n2) {
@@ -4798,7 +4790,7 @@
4798
4790
  case 3
4799
4791
  /* VNodeType.CustomElement */
4800
4792
  :
4801
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4793
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4802
4794
  break;
4803
4795
  }
4804
4796
  }
@@ -4970,25 +4962,34 @@
4970
4962
  }
4971
4963
  }
4972
4964
 
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);
4965
+ function patchCustomElement(n1, n2, parent, renderer) {
4966
+ if (n1.ctor !== n2.ctor) {
4967
+ // If the constructor, unmount the current component and mount a new one using the new
4968
+ // constructor.
4969
+ var anchor = renderer.nextSibling(n1.elm);
4970
+ unmount(n1, parent, renderer, true);
4971
+ mountCustomElement(n2, parent, anchor, renderer);
4972
+ } else {
4973
+ // Otherwise patch the existing component with new props/attrs/etc.
4974
+ var elm = n2.elm = n1.elm;
4975
+ var vm = n2.vm = n1.vm;
4976
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4977
4977
 
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
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
4984
4984
 
4985
4985
 
4986
- patchChildren(n1.children, n2.children, elm, renderer);
4986
+ patchChildren(n1.children, n2.children, elm, renderer);
4987
4987
 
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);
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);
4992
+ }
4992
4993
  }
4993
4994
  }
4994
4995
 
@@ -5357,22 +5358,22 @@
5357
5358
  } else if (!isVNode(newEndVnode)) {
5358
5359
  newEndVnode = newCh[--newEndIdx];
5359
5360
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5360
- patch(oldStartVnode, newStartVnode, renderer);
5361
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5361
5362
  oldStartVnode = oldCh[++oldStartIdx];
5362
5363
  newStartVnode = newCh[++newStartIdx];
5363
5364
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5364
- patch(oldEndVnode, newEndVnode, renderer);
5365
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5365
5366
  oldEndVnode = oldCh[--oldEndIdx];
5366
5367
  newEndVnode = newCh[--newEndIdx];
5367
5368
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5368
5369
  // Vnode moved right
5369
- patch(oldStartVnode, newEndVnode, renderer);
5370
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5370
5371
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5371
5372
  oldStartVnode = oldCh[++oldStartIdx];
5372
5373
  newEndVnode = newCh[--newEndIdx];
5373
5374
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5374
5375
  // Vnode moved left
5375
- patch(oldEndVnode, newStartVnode, renderer);
5376
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5376
5377
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5377
5378
  oldEndVnode = oldCh[--oldEndIdx];
5378
5379
  newStartVnode = newCh[++newStartIdx];
@@ -5395,7 +5396,7 @@
5395
5396
  // New element
5396
5397
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5397
5398
  } else {
5398
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5399
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5399
5400
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5400
5401
  // so we only care about the `oldCh` object inside this function.
5401
5402
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5465,7 +5466,7 @@
5465
5466
  if (isVNode(n1)) {
5466
5467
  if (isVNode(n2)) {
5467
5468
  // both vnodes are equivalent, and we just need to patch them
5468
- patch(n1, n2, renderer);
5469
+ patch(n1, n2, parent, renderer);
5469
5470
  anchor = n2.elm;
5470
5471
  } else {
5471
5472
  // removing the old vnode since the new one is null
@@ -5880,19 +5881,11 @@
5880
5881
 
5881
5882
  return url;
5882
5883
  }
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
5884
  /**
5893
5885
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5894
5886
  */
5895
5887
 
5888
+
5896
5889
  function dc(sel, Ctor, data) {
5897
5890
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5898
5891
 
@@ -5911,22 +5904,7 @@
5911
5904
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5912
5905
  }
5913
5906
 
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);
5907
+ return c(sel, Ctor, data, children);
5930
5908
  }
5931
5909
  /**
5932
5910
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6934,13 +6912,7 @@
6934
6912
  }
6935
6913
 
6936
6914
  function runRenderedCallback(vm) {
6937
- var renderedCallback = vm.def.renderedCallback,
6938
- ssr = vm.renderer.ssr;
6939
-
6940
- if (isTrue(ssr)) {
6941
- return;
6942
- }
6943
-
6915
+ var renderedCallback = vm.def.renderedCallback;
6944
6916
  var rendered = Services.rendered;
6945
6917
 
6946
6918
  if (rendered) {
@@ -7172,9 +7144,7 @@
7172
7144
  }
7173
7145
 
7174
7146
  function scheduleRehydration(vm) {
7175
- var ssr = vm.renderer.ssr;
7176
-
7177
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7147
+ if (isTrue(vm.isScheduled)) {
7178
7148
  return;
7179
7149
  }
7180
7150
 
@@ -7296,13 +7266,8 @@
7296
7266
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7297
7267
 
7298
7268
  function createFieldDataCallback(vm, name) {
7299
- var cmpFields = vm.cmpFields;
7300
7269
  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
- }
7270
+ updateComponentValue(vm, name, value);
7306
7271
  };
7307
7272
  }
7308
7273
 
@@ -8301,7 +8266,7 @@
8301
8266
 
8302
8267
  return ctor;
8303
8268
  }
8304
- /* version: 2.22.0 */
8269
+ /* version: 2.23.0 */
8305
8270
 
8306
8271
  /*
8307
8272
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8629,18 +8594,6 @@
8629
8594
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8630
8595
  }
8631
8596
 
8632
- var hydrating = false;
8633
-
8634
- function setIsHydrating(value) {
8635
- hydrating = value;
8636
- }
8637
-
8638
- var ssr = false;
8639
-
8640
- function isHydrating() {
8641
- return hydrating;
8642
- }
8643
-
8644
8597
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8645
8598
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8646
8599
 
@@ -8673,15 +8626,11 @@
8673
8626
  }
8674
8627
 
8675
8628
  function attachShadow(element, options) {
8676
- // `hydrating` will be true in two cases:
8629
+ // `shadowRoot` will be non-null in two cases:
8677
8630
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8678
8631
  // 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) {
8632
+ // root component with customElement.define('c-app', Ctor)
8633
+ if (!isNull(element.shadowRoot)) {
8685
8634
  return element.shadowRoot;
8686
8635
  }
8687
8636
 
@@ -8799,11 +8748,9 @@
8799
8748
 
8800
8749
  var HTMLElementExported = HTMLElementConstructor;
8801
8750
  var renderer = {
8802
- ssr: ssr,
8803
8751
  isNativeShadowDefined: isNativeShadowDefined,
8804
8752
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8805
8753
  HTMLElementExported: HTMLElementExported,
8806
- isHydrating: isHydrating,
8807
8754
  insert: insert,
8808
8755
  remove: remove,
8809
8756
  cloneNode: cloneNode,
@@ -8905,13 +8852,8 @@
8905
8852
  }
8906
8853
 
8907
8854
  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
8855
  var vm = createVMWithProps(element, Ctor, props);
8912
- hydrateRoot(vm); // set it back since now we finished hydration.
8913
-
8914
- setIsHydrating(false);
8856
+ hydrateRoot(vm);
8915
8857
  } catch (e) {
8916
8858
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8917
8859
  // with the client generated DOM.
@@ -8922,11 +8864,7 @@
8922
8864
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8923
8865
 
8924
8866
  createVMWithProps(element, Ctor, props);
8925
- setIsHydrating(false);
8926
8867
  connectRootElement(element);
8927
- } finally {
8928
- // in case there's an error during recovery
8929
- setIsHydrating(false);
8930
8868
  }
8931
8869
  }
8932
8870
  /*
@@ -9205,7 +9143,7 @@
9205
9143
  });
9206
9144
  freeze(LightningElement);
9207
9145
  seal(LightningElement.prototype);
9208
- /* version: 2.22.0 */
9146
+ /* version: 2.23.0 */
9209
9147
 
9210
9148
  exports.LightningElement = LightningElement;
9211
9149
  exports.__unstable__ProfilerControl = profilerControl;