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
@@ -365,9 +365,9 @@ var LWC = (function (exports) {
365
365
  // Increment whenever the LWC template compiler changes
366
366
 
367
367
 
368
- var LWC_VERSION = "2.22.0";
368
+ var LWC_VERSION = "2.23.0";
369
369
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.22.0 */
370
+ /** version: 2.23.0 */
371
371
 
372
372
  /*
373
373
  * Copyright (c) 2018, salesforce.com, inc.
@@ -546,7 +546,7 @@ var LWC = (function (exports) {
546
546
  setFeatureFlag(name, value);
547
547
  }
548
548
  }
549
- /** version: 2.22.0 */
549
+ /** version: 2.23.0 */
550
550
 
551
551
  /*
552
552
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1477,6 +1477,15 @@ var LWC = (function (exports) {
1477
1477
  function patchLightningElementPrototypeWithRestrictions(proto) {
1478
1478
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1479
1479
  }
1480
+
1481
+ function updateComponentValue(vm, key, newValue) {
1482
+ var cmpFields = vm.cmpFields;
1483
+
1484
+ if (newValue !== cmpFields[key]) {
1485
+ cmpFields[key] = newValue;
1486
+ componentValueMutated(vm, key);
1487
+ }
1488
+ }
1480
1489
  /**
1481
1490
  * Copyright (C) 2017 salesforce.com, inc.
1482
1491
  */
@@ -2372,11 +2381,7 @@ var LWC = (function (exports) {
2372
2381
  assert.invariant(!isObject(newValue) || isNull(newValue), "Invalid value \"".concat(newValue, "\" for \"").concat(propName, "\" of ").concat(vm, ". Value cannot be an object, must be a primitive value."));
2373
2382
  }
2374
2383
 
2375
- if (newValue !== vm.cmpProps[propName]) {
2376
- vm.cmpProps[propName] = newValue;
2377
- componentValueMutated(vm, propName);
2378
- }
2379
-
2384
+ updateComponentValue(vm, propName, newValue);
2380
2385
  return _set.call(vm.elm, newValue);
2381
2386
  }
2382
2387
  };
@@ -2752,11 +2757,7 @@ var LWC = (function (exports) {
2752
2757
  },
2753
2758
  set: function set(newValue) {
2754
2759
  var vm = getAssociatedVM(this);
2755
-
2756
- if (newValue !== vm.cmpFields[key]) {
2757
- vm.cmpFields[key] = newValue;
2758
- componentValueMutated(vm, key);
2759
- }
2760
+ updateComponentValue(vm, key, newValue);
2760
2761
  },
2761
2762
  enumerable: true,
2762
2763
  configurable: true
@@ -2974,11 +2975,7 @@ var LWC = (function (exports) {
2974
2975
  }
2975
2976
 
2976
2977
  var reactiveOrAnyValue = getReactiveProxy(newValue);
2977
-
2978
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2979
- vm.cmpFields[key] = reactiveOrAnyValue;
2980
- componentValueMutated(vm, key);
2981
- }
2978
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2982
2979
  },
2983
2980
  enumerable: true,
2984
2981
  configurable: true
@@ -3022,10 +3019,7 @@ var LWC = (function (exports) {
3022
3019
  * system to be backward compatible.
3023
3020
  */
3024
3021
 
3025
- if (value !== vm.cmpFields[key]) {
3026
- vm.cmpFields[key] = value;
3027
- componentValueMutated(vm, key);
3028
- }
3022
+ updateComponentValue(vm, key, value);
3029
3023
  },
3030
3024
  enumerable: true,
3031
3025
  configurable: true
@@ -4348,9 +4342,7 @@ var LWC = (function (exports) {
4348
4342
  function createStylesheet(vm, stylesheets) {
4349
4343
  var renderMode = vm.renderMode,
4350
4344
  shadowMode = vm.shadowMode,
4351
- _vm$renderer2 = vm.renderer,
4352
- ssr = _vm$renderer2.ssr,
4353
- insertStylesheet = _vm$renderer2.insertStylesheet;
4345
+ insertStylesheet = vm.renderer.insertStylesheet;
4354
4346
 
4355
4347
  if (renderMode === 1
4356
4348
  /* RenderMode.Shadow */
@@ -4360,7 +4352,7 @@ var LWC = (function (exports) {
4360
4352
  for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
4361
4353
  insertStylesheet(stylesheets[_i12]);
4362
4354
  }
4363
- } else if (ssr || vm.hydrated) {
4355
+ } else if (vm.hydrated) {
4364
4356
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4365
4357
  // This works in the client, because the stylesheets are created, and cached in the VM
4366
4358
  // the first time the VM renders.
@@ -4746,7 +4738,7 @@ var LWC = (function (exports) {
4746
4738
  }
4747
4739
  }
4748
4740
 
4749
- function patch(n1, n2, renderer) {
4741
+ function patch(n1, n2, parent, renderer) {
4750
4742
  var _a, _b;
4751
4743
 
4752
4744
  if (n1 === n2) {
@@ -4795,7 +4787,7 @@ var LWC = (function (exports) {
4795
4787
  case 3
4796
4788
  /* VNodeType.CustomElement */
4797
4789
  :
4798
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4790
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4799
4791
  break;
4800
4792
  }
4801
4793
  }
@@ -4967,25 +4959,34 @@ var LWC = (function (exports) {
4967
4959
  }
4968
4960
  }
4969
4961
 
4970
- function patchCustomElement(n1, n2, renderer) {
4971
- var elm = n2.elm = n1.elm;
4972
- var vm = n2.vm = n1.vm;
4973
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4962
+ function patchCustomElement(n1, n2, parent, renderer) {
4963
+ if (n1.ctor !== n2.ctor) {
4964
+ // If the constructor, unmount the current component and mount a new one using the new
4965
+ // constructor.
4966
+ var anchor = renderer.nextSibling(n1.elm);
4967
+ unmount(n1, parent, renderer, true);
4968
+ mountCustomElement(n2, parent, anchor, renderer);
4969
+ } else {
4970
+ // Otherwise patch the existing component with new props/attrs/etc.
4971
+ var elm = n2.elm = n1.elm;
4972
+ var vm = n2.vm = n1.vm;
4973
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4974
4974
 
4975
- if (!isUndefined$1(vm)) {
4976
- // in fallback mode, the allocation will always set children to
4977
- // empty and delegate the real allocation to the slot elements
4978
- allocateChildren(n2, vm);
4979
- } // in fallback mode, the children will be always empty, so, nothing
4980
- // will happen, but in native, it does allocate the light dom
4975
+ if (!isUndefined$1(vm)) {
4976
+ // in fallback mode, the allocation will always set children to
4977
+ // empty and delegate the real allocation to the slot elements
4978
+ allocateChildren(n2, vm);
4979
+ } // in fallback mode, the children will be always empty, so, nothing
4980
+ // will happen, but in native, it does allocate the light dom
4981
4981
 
4982
4982
 
4983
- patchChildren(n1.children, n2.children, elm, renderer);
4983
+ patchChildren(n1.children, n2.children, elm, renderer);
4984
4984
 
4985
- if (!isUndefined$1(vm)) {
4986
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
4987
- // this is important to preserve the top to bottom synchronous rendering phase.
4988
- rerenderVM(vm);
4985
+ if (!isUndefined$1(vm)) {
4986
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4987
+ // this is important to preserve the top to bottom synchronous rendering phase.
4988
+ rerenderVM(vm);
4989
+ }
4989
4990
  }
4990
4991
  }
4991
4992
 
@@ -5354,22 +5355,22 @@ var LWC = (function (exports) {
5354
5355
  } else if (!isVNode(newEndVnode)) {
5355
5356
  newEndVnode = newCh[--newEndIdx];
5356
5357
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
5357
- patch(oldStartVnode, newStartVnode, renderer);
5358
+ patch(oldStartVnode, newStartVnode, parent, renderer);
5358
5359
  oldStartVnode = oldCh[++oldStartIdx];
5359
5360
  newStartVnode = newCh[++newStartIdx];
5360
5361
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
5361
- patch(oldEndVnode, newEndVnode, renderer);
5362
+ patch(oldEndVnode, newEndVnode, parent, renderer);
5362
5363
  oldEndVnode = oldCh[--oldEndIdx];
5363
5364
  newEndVnode = newCh[--newEndIdx];
5364
5365
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
5365
5366
  // Vnode moved right
5366
- patch(oldStartVnode, newEndVnode, renderer);
5367
+ patch(oldStartVnode, newEndVnode, parent, renderer);
5367
5368
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
5368
5369
  oldStartVnode = oldCh[++oldStartIdx];
5369
5370
  newEndVnode = newCh[--newEndIdx];
5370
5371
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
5371
5372
  // Vnode moved left
5372
- patch(oldEndVnode, newStartVnode, renderer);
5373
+ patch(oldEndVnode, newStartVnode, parent, renderer);
5373
5374
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
5374
5375
  oldEndVnode = oldCh[--oldEndIdx];
5375
5376
  newStartVnode = newCh[++newStartIdx];
@@ -5392,7 +5393,7 @@ var LWC = (function (exports) {
5392
5393
  // New element
5393
5394
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
5394
5395
  } else {
5395
- patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
5396
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
5396
5397
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
5397
5398
  // so we only care about the `oldCh` object inside this function.
5398
5399
  // To avoid cloning over and over again, we check `clonedOldCh`
@@ -5462,7 +5463,7 @@ var LWC = (function (exports) {
5462
5463
  if (isVNode(n1)) {
5463
5464
  if (isVNode(n2)) {
5464
5465
  // both vnodes are equivalent, and we just need to patch them
5465
- patch(n1, n2, renderer);
5466
+ patch(n1, n2, parent, renderer);
5466
5467
  anchor = n2.elm;
5467
5468
  } else {
5468
5469
  // removing the old vnode since the new one is null
@@ -5877,19 +5878,11 @@ var LWC = (function (exports) {
5877
5878
 
5878
5879
  return url;
5879
5880
  }
5880
- /**
5881
- * Map to store an index value assigned to any dynamic component reference ingested
5882
- * by dc() api. This allows us to generate a unique unique per template per dynamic
5883
- * component reference to avoid diffing algo mismatches.
5884
- */
5885
-
5886
-
5887
- var DynamicImportedComponentMap = new Map();
5888
- var dynamicImportedComponentCounter = 0;
5889
5881
  /**
5890
5882
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5891
5883
  */
5892
5884
 
5885
+
5893
5886
  function dc(sel, Ctor, data) {
5894
5887
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
5895
5888
 
@@ -5908,22 +5901,7 @@ var LWC = (function (exports) {
5908
5901
  throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
5909
5902
  }
5910
5903
 
5911
- var idx = DynamicImportedComponentMap.get(Ctor);
5912
-
5913
- if (isUndefined$1(idx)) {
5914
- idx = dynamicImportedComponentCounter++;
5915
- DynamicImportedComponentMap.set(Ctor, idx);
5916
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
5917
- // to identify different constructors as vnodes with different keys to avoid reusing the
5918
- // element used for previous constructors.
5919
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
5920
- // hoisting optimization.
5921
-
5922
-
5923
- var newData = Object.assign(Object.assign({}, data), {
5924
- key: "dc:".concat(idx, ":").concat(data.key)
5925
- });
5926
- return c(sel, Ctor, newData, children);
5904
+ return c(sel, Ctor, data, children);
5927
5905
  }
5928
5906
  /**
5929
5907
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -6931,13 +6909,7 @@ var LWC = (function (exports) {
6931
6909
  }
6932
6910
 
6933
6911
  function runRenderedCallback(vm) {
6934
- var renderedCallback = vm.def.renderedCallback,
6935
- ssr = vm.renderer.ssr;
6936
-
6937
- if (isTrue(ssr)) {
6938
- return;
6939
- }
6940
-
6912
+ var renderedCallback = vm.def.renderedCallback;
6941
6913
  var rendered = Services.rendered;
6942
6914
 
6943
6915
  if (rendered) {
@@ -7169,9 +7141,7 @@ var LWC = (function (exports) {
7169
7141
  }
7170
7142
 
7171
7143
  function scheduleRehydration(vm) {
7172
- var ssr = vm.renderer.ssr;
7173
-
7174
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
7144
+ if (isTrue(vm.isScheduled)) {
7175
7145
  return;
7176
7146
  }
7177
7147
 
@@ -7293,13 +7263,8 @@ var LWC = (function (exports) {
7293
7263
  }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
7294
7264
 
7295
7265
  function createFieldDataCallback(vm, name) {
7296
- var cmpFields = vm.cmpFields;
7297
7266
  return function (value) {
7298
- if (value !== vm.cmpFields[name]) {
7299
- // storing the value in the underlying storage
7300
- cmpFields[name] = value;
7301
- componentValueMutated(vm, name);
7302
- }
7267
+ updateComponentValue(vm, name, value);
7303
7268
  };
7304
7269
  }
7305
7270
 
@@ -8298,7 +8263,7 @@ var LWC = (function (exports) {
8298
8263
 
8299
8264
  return ctor;
8300
8265
  }
8301
- /* version: 2.22.0 */
8266
+ /* version: 2.23.0 */
8302
8267
 
8303
8268
  /*
8304
8269
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8626,18 +8591,6 @@ var LWC = (function (exports) {
8626
8591
  HTMLElementConstructor.prototype = HTMLElement.prototype;
8627
8592
  }
8628
8593
 
8629
- var hydrating = false;
8630
-
8631
- function setIsHydrating(value) {
8632
- hydrating = value;
8633
- }
8634
-
8635
- var ssr = false;
8636
-
8637
- function isHydrating() {
8638
- return hydrating;
8639
- }
8640
-
8641
8594
  var isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
8642
8595
  var isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
8643
8596
 
@@ -8670,15 +8623,11 @@ var LWC = (function (exports) {
8670
8623
  }
8671
8624
 
8672
8625
  function attachShadow(element, options) {
8673
- // `hydrating` will be true in two cases:
8626
+ // `shadowRoot` will be non-null in two cases:
8674
8627
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
8675
8628
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
8676
- // root component with customeElement.define('c-app', Ctor)
8677
- //
8678
- // The second case can be treated as a failed hydration with nominal impact
8679
- // to performance. However, because <c-app> won't have a <template shadowroot>
8680
- // declarative child, `element.shadowRoot` is `null`.
8681
- if (hydrating && element.shadowRoot) {
8629
+ // root component with customElement.define('c-app', Ctor)
8630
+ if (!isNull(element.shadowRoot)) {
8682
8631
  return element.shadowRoot;
8683
8632
  }
8684
8633
 
@@ -8796,11 +8745,9 @@ var LWC = (function (exports) {
8796
8745
 
8797
8746
  var HTMLElementExported = HTMLElementConstructor;
8798
8747
  var renderer = {
8799
- ssr: ssr,
8800
8748
  isNativeShadowDefined: isNativeShadowDefined,
8801
8749
  isSyntheticShadowDefined: isSyntheticShadowDefined,
8802
8750
  HTMLElementExported: HTMLElementExported,
8803
- isHydrating: isHydrating,
8804
8751
  insert: insert,
8805
8752
  remove: remove,
8806
8753
  cloneNode: cloneNode,
@@ -8902,13 +8849,8 @@ var LWC = (function (exports) {
8902
8849
  }
8903
8850
 
8904
8851
  try {
8905
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
8906
- // and uses the same algo to create the stylesheets as in SSR.
8907
- setIsHydrating(true);
8908
8852
  var vm = createVMWithProps(element, Ctor, props);
8909
- hydrateRoot(vm); // set it back since now we finished hydration.
8910
-
8911
- setIsHydrating(false);
8853
+ hydrateRoot(vm);
8912
8854
  } catch (e) {
8913
8855
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
8914
8856
  // with the client generated DOM.
@@ -8919,11 +8861,7 @@ var LWC = (function (exports) {
8919
8861
  resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
8920
8862
 
8921
8863
  createVMWithProps(element, Ctor, props);
8922
- setIsHydrating(false);
8923
8864
  connectRootElement(element);
8924
- } finally {
8925
- // in case there's an error during recovery
8926
- setIsHydrating(false);
8927
8865
  }
8928
8866
  }
8929
8867
  /*
@@ -9202,7 +9140,7 @@ var LWC = (function (exports) {
9202
9140
  });
9203
9141
  freeze(LightningElement);
9204
9142
  seal(LightningElement.prototype);
9205
- /* version: 2.22.0 */
9143
+ /* version: 2.23.0 */
9206
9144
 
9207
9145
  exports.LightningElement = LightningElement;
9208
9146
  exports.__unstable__ProfilerControl = profilerControl;