lwc 2.21.1 → 2.23.1

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 +222 -199
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +222 -199
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +211 -188
  5. package/dist/engine-dom/iife/es5/engine-dom.js +263 -216
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +239 -192
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +222 -199
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +211 -188
  11. package/dist/engine-dom/umd/es5/engine-dom.js +263 -216
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +239 -192
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +116 -403
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +116 -403
  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
@@ -291,7 +291,11 @@ var LWC = (function (exports) {
291
291
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
292
292
  return attributeName;
293
293
  }
294
- /** version: 2.21.1 */
294
+ /** version: 2.23.1 */
295
+
296
+ /**
297
+ * Copyright (C) 2018 salesforce.com, inc.
298
+ */
295
299
 
296
300
  /*
297
301
  * Copyright (c) 2018, salesforce.com, inc.
@@ -300,7 +304,7 @@ var LWC = (function (exports) {
300
304
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
301
305
  */
302
306
  function detect(propName) {
303
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
307
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
304
308
  }
305
309
 
306
310
  /*
@@ -369,6 +373,7 @@ var LWC = (function (exports) {
369
373
  patch$1(propName);
370
374
  }
371
375
  }
376
+ /** version: 2.23.1 */
372
377
 
373
378
  /**
374
379
  * Copyright (C) 2018 salesforce.com, inc.
@@ -396,7 +401,7 @@ var LWC = (function (exports) {
396
401
  if (!_globalThis.lwcRuntimeFlags) {
397
402
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
398
403
  }
399
- const runtimeFlags = _globalThis.lwcRuntimeFlags;
404
+ const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
400
405
  /**
401
406
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
402
407
  * flag. It is meant to be used during the app initialization.
@@ -420,13 +425,13 @@ var LWC = (function (exports) {
420
425
  }
421
426
  {
422
427
  // Disallow the same flag to be set more than once in production
423
- const runtimeValue = runtimeFlags[name];
428
+ const runtimeValue = lwcRuntimeFlags[name];
424
429
  if (!isUndefined$1(runtimeValue)) {
425
430
  // eslint-disable-next-line no-console
426
431
  console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
427
432
  return;
428
433
  }
429
- defineProperty(runtimeFlags, name, { value });
434
+ defineProperty(lwcRuntimeFlags, name, { value });
430
435
  }
431
436
  }
432
437
  /**
@@ -592,18 +597,21 @@ var LWC = (function (exports) {
592
597
  ArrayPush$1.call(this.listeners, reactiveObservers);
593
598
  }
594
599
  }
595
-
596
- /*
597
- * Copyright (c) 2018, salesforce.com, inc.
598
- * All rights reserved.
599
- * SPDX-License-Identifier: MIT
600
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
601
- */
602
600
  function componentValueMutated(vm, key) {
603
- valueMutated(vm.component, key);
601
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
602
+ {
603
+ valueMutated(vm.component, key);
604
+ }
604
605
  }
605
606
  function componentValueObserved(vm, key) {
606
- valueObserved(vm.component, key);
607
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
608
+ {
609
+ valueObserved(vm.component, key);
610
+ }
611
+ }
612
+ function createReactiveObserver(callback) {
613
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
614
+ return new ReactiveObserver(callback) ;
607
615
  }
608
616
 
609
617
  /*
@@ -856,6 +864,14 @@ var LWC = (function (exports) {
856
864
  }
857
865
  });
858
866
 
867
+ function updateComponentValue(vm, key, newValue) {
868
+ const { cmpFields } = vm;
869
+ if (newValue !== cmpFields[key]) {
870
+ cmpFields[key] = newValue;
871
+ componentValueMutated(vm, key);
872
+ }
873
+ }
874
+
859
875
  /**
860
876
  * Copyright (C) 2017 salesforce.com, inc.
861
877
  */
@@ -1286,7 +1302,24 @@ var LWC = (function (exports) {
1286
1302
  * change or being removed.
1287
1303
  */
1288
1304
  function unwrap(value) {
1289
- return reactiveMembrane.unwrapProxy(value);
1305
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1306
+ return reactiveMembrane.unwrapProxy(value) ;
1307
+ }
1308
+ function getReadOnlyProxy(value) {
1309
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1310
+ // them from their parents. This applies to both the client and server.
1311
+ return reactiveMembrane.getReadOnlyProxy(value);
1312
+ }
1313
+ function getReactiveProxy(value) {
1314
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1315
+ return reactiveMembrane.getProxy(value) ;
1316
+ }
1317
+ // Making the component instance a live value when using Locker to support expandos.
1318
+ function markLockerLiveObject(obj) {
1319
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1320
+ {
1321
+ obj[lockerLivePropertyKey] = undefined;
1322
+ }
1290
1323
  }
1291
1324
 
1292
1325
  /*
@@ -1322,10 +1355,7 @@ var LWC = (function (exports) {
1322
1355
  },
1323
1356
  set(newValue) {
1324
1357
  const vm = getAssociatedVM(this);
1325
- if (newValue !== vm.cmpProps[propName]) {
1326
- vm.cmpProps[propName] = newValue;
1327
- componentValueMutated(vm, propName);
1328
- }
1358
+ updateComponentValue(vm, propName, newValue);
1329
1359
  return set.call(vm.elm, newValue);
1330
1360
  },
1331
1361
  };
@@ -1356,8 +1386,7 @@ var LWC = (function (exports) {
1356
1386
  vm.setHook = setHook;
1357
1387
  vm.getHook = getHook;
1358
1388
  }
1359
- // Making the component instance a live value when using Locker to support expandos.
1360
- this[lockerLivePropertyKey] = undefined;
1389
+ markLockerLiveObject(this);
1361
1390
  // Linking elm, shadow root and component with the VM.
1362
1391
  associateVM(component, vm);
1363
1392
  associateVM(elm, vm);
@@ -1555,15 +1584,51 @@ var LWC = (function (exports) {
1555
1584
  },
1556
1585
  set(newValue) {
1557
1586
  const vm = getAssociatedVM(this);
1558
- if (newValue !== vm.cmpFields[key]) {
1559
- vm.cmpFields[key] = newValue;
1560
- componentValueMutated(vm, key);
1561
- }
1587
+ updateComponentValue(vm, key, newValue);
1562
1588
  },
1563
1589
  enumerable: true,
1564
1590
  configurable: true,
1565
1591
  };
1566
1592
  }
1593
+ class AccessorReactiveObserver extends ReactiveObserver {
1594
+ constructor(vm, set) {
1595
+ super(() => {
1596
+ if (isFalse(this.debouncing)) {
1597
+ this.debouncing = true;
1598
+ addCallbackToNextTick(() => {
1599
+ if (isTrue(this.debouncing)) {
1600
+ const { value } = this;
1601
+ const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
1602
+ set.call(component, value);
1603
+ // de-bouncing after the call to the original setter to prevent
1604
+ // infinity loop if the setter itself is mutating things that
1605
+ // were accessed during the previous invocation.
1606
+ this.debouncing = false;
1607
+ if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
1608
+ // immediate rehydration due to a setter driven mutation, otherwise
1609
+ // the component will get rendered on the second tick, which it is not
1610
+ // desirable.
1611
+ rerenderVM(vm);
1612
+ }
1613
+ }
1614
+ });
1615
+ }
1616
+ });
1617
+ this.debouncing = false;
1618
+ }
1619
+ reset(value) {
1620
+ super.reset();
1621
+ this.debouncing = false;
1622
+ if (arguments.length > 0) {
1623
+ this.value = value;
1624
+ }
1625
+ }
1626
+ }
1627
+ function createAccessorReactiveObserver(vm, set) {
1628
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1629
+ return new AccessorReactiveObserver(vm, set)
1630
+ ;
1631
+ }
1567
1632
 
1568
1633
  /*
1569
1634
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1600,50 +1665,6 @@ var LWC = (function (exports) {
1600
1665
  configurable: true
1601
1666
  };
1602
1667
  }
1603
- class AccessorReactiveObserver extends ReactiveObserver {
1604
- constructor(vm, set) {
1605
- super(() => {
1606
- if (isFalse(this.debouncing)) {
1607
- this.debouncing = true;
1608
- addCallbackToNextTick(() => {
1609
- if (isTrue(this.debouncing)) {
1610
- const {
1611
- value
1612
- } = this;
1613
- const {
1614
- isDirty: dirtyStateBeforeSetterCall,
1615
- component,
1616
- idx
1617
- } = vm;
1618
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
1619
- // infinity loop if the setter itself is mutating things that
1620
- // were accessed during the previous invocation.
1621
-
1622
- this.debouncing = false;
1623
-
1624
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
1625
- // immediate rehydration due to a setter driven mutation, otherwise
1626
- // the component will get rendered on the second tick, which it is not
1627
- // desirable.
1628
- rerenderVM(vm);
1629
- }
1630
- }
1631
- });
1632
- }
1633
- });
1634
- this.debouncing = false;
1635
- }
1636
-
1637
- reset(value) {
1638
- super.reset();
1639
- this.debouncing = false;
1640
-
1641
- if (arguments.length > 0) {
1642
- this.value = value;
1643
- }
1644
- }
1645
-
1646
- }
1647
1668
  function createPublicAccessorDescriptor(key, descriptor) {
1648
1669
  const {
1649
1670
  get,
@@ -1667,11 +1688,11 @@ var LWC = (function (exports) {
1667
1688
  const vm = getAssociatedVM(this);
1668
1689
 
1669
1690
  if (set) {
1670
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
1691
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
1671
1692
  let ro = vm.oar[key];
1672
1693
 
1673
1694
  if (isUndefined$1(ro)) {
1674
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
1695
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
1675
1696
  } // every time we invoke this setter from outside (through this wrapper setter)
1676
1697
  // we should reset the value and then debounce just in case there is a pending
1677
1698
  // invocation the next tick that is not longer relevant since the value is changing
@@ -1701,7 +1722,7 @@ var LWC = (function (exports) {
1701
1722
  */
1702
1723
  function track(target) {
1703
1724
  if (arguments.length === 1) {
1704
- return reactiveMembrane.getProxy(target);
1725
+ return getReactiveProxy(target);
1705
1726
  }
1706
1727
  throw new Error();
1707
1728
  }
@@ -1714,11 +1735,8 @@ var LWC = (function (exports) {
1714
1735
  },
1715
1736
  set(newValue) {
1716
1737
  const vm = getAssociatedVM(this);
1717
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
1718
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
1719
- vm.cmpFields[key] = reactiveOrAnyValue;
1720
- componentValueMutated(vm, key);
1721
- }
1738
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
1739
+ updateComponentValue(vm, key, reactiveOrAnyValue);
1722
1740
  },
1723
1741
  enumerable: true,
1724
1742
  configurable: true,
@@ -1754,10 +1772,7 @@ var LWC = (function (exports) {
1754
1772
  * letting the author to do the wrong thing, but it will keep our
1755
1773
  * system to be backward compatible.
1756
1774
  */
1757
- if (value !== vm.cmpFields[key]) {
1758
- vm.cmpFields[key] = value;
1759
- componentValueMutated(vm, key);
1760
- }
1775
+ updateComponentValue(vm, key, value);
1761
1776
  },
1762
1777
  enumerable: true,
1763
1778
  configurable: true,
@@ -1967,7 +1982,7 @@ var LWC = (function (exports) {
1967
1982
  fn = cachedSetterByKey[key] = function (newValue) {
1968
1983
  const vm = getAssociatedVM(this);
1969
1984
  const { setHook } = vm;
1970
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
1985
+ newValue = getReadOnlyProxy(newValue);
1971
1986
  setHook(vm.component, key, newValue);
1972
1987
  };
1973
1988
  }
@@ -2093,7 +2108,7 @@ var LWC = (function (exports) {
2093
2108
  }
2094
2109
  function swapTemplate(oldTpl, newTpl) {
2095
2110
 
2096
- if (!runtimeFlags.ENABLE_HMR) {
2111
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2097
2112
  throw new Error('HMR is not enabled');
2098
2113
  }
2099
2114
 
@@ -2101,7 +2116,7 @@ var LWC = (function (exports) {
2101
2116
  }
2102
2117
  function swapComponent(oldComponent, newComponent) {
2103
2118
 
2104
- if (!runtimeFlags.ENABLE_HMR) {
2119
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2105
2120
  throw new Error('HMR is not enabled');
2106
2121
  }
2107
2122
 
@@ -2109,7 +2124,7 @@ var LWC = (function (exports) {
2109
2124
  }
2110
2125
  function swapStyle(oldStyle, newStyle) {
2111
2126
 
2112
- if (!runtimeFlags.ENABLE_HMR) {
2127
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
2113
2128
  throw new Error('HMR is not enabled');
2114
2129
  }
2115
2130
 
@@ -2426,13 +2441,13 @@ var LWC = (function (exports) {
2426
2441
  return owner;
2427
2442
  }
2428
2443
  function createStylesheet(vm, stylesheets) {
2429
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
2444
+ const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
2430
2445
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
2431
2446
  for (let i = 0; i < stylesheets.length; i++) {
2432
2447
  insertStylesheet(stylesheets[i]);
2433
2448
  }
2434
2449
  }
2435
- else if (ssr || vm.hydrated) {
2450
+ else if (vm.hydrated) {
2436
2451
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
2437
2452
  // This works in the client, because the stylesheets are created, and cached in the VM
2438
2453
  // the first time the VM renders.
@@ -2729,7 +2744,7 @@ var LWC = (function (exports) {
2729
2744
  updateStaticChildren(c1, c2, parent, renderer);
2730
2745
  }
2731
2746
  }
2732
- function patch(n1, n2, renderer) {
2747
+ function patch(n1, n2, parent, renderer) {
2733
2748
  var _a, _b;
2734
2749
  if (n1 === n2) {
2735
2750
  return;
@@ -2750,7 +2765,7 @@ var LWC = (function (exports) {
2750
2765
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
2751
2766
  break;
2752
2767
  case 3 /* VNodeType.CustomElement */:
2753
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
2768
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
2754
2769
  break;
2755
2770
  }
2756
2771
  }
@@ -2872,22 +2887,32 @@ var LWC = (function (exports) {
2872
2887
  appendVM(vm);
2873
2888
  }
2874
2889
  }
2875
- function patchCustomElement(n1, n2, renderer) {
2876
- const elm = (n2.elm = n1.elm);
2877
- const vm = (n2.vm = n1.vm);
2878
- patchElementPropsAndAttrs$1(n1, n2, renderer);
2879
- if (!isUndefined$1(vm)) {
2880
- // in fallback mode, the allocation will always set children to
2881
- // empty and delegate the real allocation to the slot elements
2882
- allocateChildren(n2, vm);
2890
+ function patchCustomElement(n1, n2, parent, renderer) {
2891
+ if (n1.ctor !== n2.ctor) {
2892
+ // If the constructor, unmount the current component and mount a new one using the new
2893
+ // constructor.
2894
+ const anchor = renderer.nextSibling(n1.elm);
2895
+ unmount(n1, parent, renderer, true);
2896
+ mountCustomElement(n2, parent, anchor, renderer);
2883
2897
  }
2884
- // in fallback mode, the children will be always empty, so, nothing
2885
- // will happen, but in native, it does allocate the light dom
2886
- patchChildren(n1.children, n2.children, elm, renderer);
2887
- if (!isUndefined$1(vm)) {
2888
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
2889
- // this is important to preserve the top to bottom synchronous rendering phase.
2890
- rerenderVM(vm);
2898
+ else {
2899
+ // Otherwise patch the existing component with new props/attrs/etc.
2900
+ const elm = (n2.elm = n1.elm);
2901
+ const vm = (n2.vm = n1.vm);
2902
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
2903
+ if (!isUndefined$1(vm)) {
2904
+ // in fallback mode, the allocation will always set children to
2905
+ // empty and delegate the real allocation to the slot elements
2906
+ allocateChildren(n2, vm);
2907
+ }
2908
+ // in fallback mode, the children will be always empty, so, nothing
2909
+ // will happen, but in native, it does allocate the light dom
2910
+ patchChildren(n1.children, n2.children, elm, renderer);
2911
+ if (!isUndefined$1(vm)) {
2912
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
2913
+ // this is important to preserve the top to bottom synchronous rendering phase.
2914
+ rerenderVM(vm);
2915
+ }
2891
2916
  }
2892
2917
  }
2893
2918
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
@@ -3125,25 +3150,25 @@ var LWC = (function (exports) {
3125
3150
  newEndVnode = newCh[--newEndIdx];
3126
3151
  }
3127
3152
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
3128
- patch(oldStartVnode, newStartVnode, renderer);
3153
+ patch(oldStartVnode, newStartVnode, parent, renderer);
3129
3154
  oldStartVnode = oldCh[++oldStartIdx];
3130
3155
  newStartVnode = newCh[++newStartIdx];
3131
3156
  }
3132
3157
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
3133
- patch(oldEndVnode, newEndVnode, renderer);
3158
+ patch(oldEndVnode, newEndVnode, parent, renderer);
3134
3159
  oldEndVnode = oldCh[--oldEndIdx];
3135
3160
  newEndVnode = newCh[--newEndIdx];
3136
3161
  }
3137
3162
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
3138
3163
  // Vnode moved right
3139
- patch(oldStartVnode, newEndVnode, renderer);
3164
+ patch(oldStartVnode, newEndVnode, parent, renderer);
3140
3165
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
3141
3166
  oldStartVnode = oldCh[++oldStartIdx];
3142
3167
  newEndVnode = newCh[--newEndIdx];
3143
3168
  }
3144
3169
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
3145
3170
  // Vnode moved left
3146
- patch(oldEndVnode, newStartVnode, renderer);
3171
+ patch(oldEndVnode, newStartVnode, parent, renderer);
3147
3172
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
3148
3173
  oldEndVnode = oldCh[--oldEndIdx];
3149
3174
  newStartVnode = newCh[++newStartIdx];
@@ -3166,7 +3191,7 @@ var LWC = (function (exports) {
3166
3191
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3167
3192
  }
3168
3193
  else {
3169
- patch(elmToMove, newStartVnode, renderer);
3194
+ patch(elmToMove, newStartVnode, parent, renderer);
3170
3195
  // Delete the old child, but copy the array since it is read-only.
3171
3196
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3172
3197
  // so we only care about the `oldCh` object inside this function.
@@ -3226,7 +3251,7 @@ var LWC = (function (exports) {
3226
3251
  if (isVNode(n1)) {
3227
3252
  if (isVNode(n2)) {
3228
3253
  // both vnodes are equivalent, and we just need to patch them
3229
- patch(n1, n2, renderer);
3254
+ patch(n1, n2, parent, renderer);
3230
3255
  anchor = n2.elm;
3231
3256
  }
3232
3257
  else {
@@ -3455,13 +3480,6 @@ var LWC = (function (exports) {
3455
3480
  }
3456
3481
  return url;
3457
3482
  }
3458
- /**
3459
- * Map to store an index value assigned to any dynamic component reference ingested
3460
- * by dc() api. This allows us to generate a unique unique per template per dynamic
3461
- * component reference to avoid diffing algo mismatches.
3462
- */
3463
- const DynamicImportedComponentMap = new Map();
3464
- let dynamicImportedComponentCounter = 0;
3465
3483
  /**
3466
3484
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
3467
3485
  */
@@ -3473,18 +3491,7 @@ var LWC = (function (exports) {
3473
3491
  if (!isComponentConstructor(Ctor)) {
3474
3492
  throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
3475
3493
  }
3476
- let idx = DynamicImportedComponentMap.get(Ctor);
3477
- if (isUndefined$1(idx)) {
3478
- idx = dynamicImportedComponentCounter++;
3479
- DynamicImportedComponentMap.set(Ctor, idx);
3480
- }
3481
- // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
3482
- // to identify different constructors as vnodes with different keys to avoid reusing the
3483
- // element used for previous constructors.
3484
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
3485
- // hoisting optimization.
3486
- const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
3487
- return c(sel, Ctor, newData, children);
3494
+ return c(sel, Ctor, data, children);
3488
3495
  }
3489
3496
  /**
3490
3497
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -3840,7 +3847,7 @@ var LWC = (function (exports) {
3840
3847
  return signedTemplateMap.get(Ctor);
3841
3848
  }
3842
3849
  function getTemplateReactiveObserver(vm) {
3843
- return new ReactiveObserver(() => {
3850
+ return createReactiveObserver(() => {
3844
3851
  const { isDirty } = vm;
3845
3852
  if (isFalse(isDirty)) {
3846
3853
  markComponentAsDirty(vm);
@@ -4091,7 +4098,7 @@ var LWC = (function (exports) {
4091
4098
  } else if (isNativeShadowDefined) {
4092
4099
  // Not combined with above condition because @lwc/features only supports identifiers in
4093
4100
  // the if-condition.
4094
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4101
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4095
4102
  if (def.shadowSupportMode === "any"
4096
4103
  /* ShadowSupportMode.Any */
4097
4104
  ) {
@@ -4204,16 +4211,9 @@ var LWC = (function (exports) {
4204
4211
  const {
4205
4212
  def: {
4206
4213
  renderedCallback
4207
- },
4208
- renderer: {
4209
- ssr
4210
4214
  }
4211
4215
  } = vm;
4212
4216
 
4213
- if (isTrue(ssr)) {
4214
- return;
4215
- }
4216
-
4217
4217
  const {
4218
4218
  rendered
4219
4219
  } = Services;
@@ -4454,13 +4454,7 @@ var LWC = (function (exports) {
4454
4454
  vm.velements = EmptyArray;
4455
4455
  }
4456
4456
  function scheduleRehydration(vm) {
4457
- const {
4458
- renderer: {
4459
- ssr
4460
- }
4461
- } = vm;
4462
-
4463
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
4457
+ if (isTrue(vm.isScheduled)) {
4464
4458
  return;
4465
4459
  }
4466
4460
 
@@ -4550,15 +4544,8 @@ var LWC = (function (exports) {
4550
4544
  }
4551
4545
 
4552
4546
  function createFieldDataCallback(vm, name) {
4553
- const {
4554
- cmpFields
4555
- } = vm;
4556
4547
  return value => {
4557
- if (value !== vm.cmpFields[name]) {
4558
- // storing the value in the underlying storage
4559
- cmpFields[name] = value;
4560
- componentValueMutated(vm, name);
4561
- }
4548
+ updateComponentValue(vm, name, value);
4562
4549
  };
4563
4550
  }
4564
4551
 
@@ -4575,7 +4562,7 @@ var LWC = (function (exports) {
4575
4562
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4576
4563
  let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
4577
4564
 
4578
- const ro = new ReactiveObserver(() => {
4565
+ const ro = createReactiveObserver(() => {
4579
4566
  if (hasPendingConfig === false) {
4580
4567
  hasPendingConfig = true; // collect new config in the micro-task
4581
4568
 
@@ -4772,7 +4759,7 @@ var LWC = (function (exports) {
4772
4759
  ArrayPush$1.call(wiredConnecting, () => {
4773
4760
  connector.connect();
4774
4761
 
4775
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
4762
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
4776
4763
  if (hasDynamicParams) {
4777
4764
  Promise.resolve().then(computeConfigAndUpdate);
4778
4765
  return;
@@ -4861,7 +4848,7 @@ var LWC = (function (exports) {
4861
4848
  * being removed.
4862
4849
  */
4863
4850
  function readonly(obj) {
4864
- return reactiveMembrane.getReadOnlyProxy(obj);
4851
+ return getReadOnlyProxy(obj);
4865
4852
  }
4866
4853
 
4867
4854
  /*
@@ -5213,7 +5200,7 @@ var LWC = (function (exports) {
5213
5200
  }
5214
5201
  return ctor;
5215
5202
  }
5216
- /* version: 2.21.1 */
5203
+ /* version: 2.23.1 */
5217
5204
 
5218
5205
  /*
5219
5206
  * Copyright (c) 2018, salesforce.com, inc.
@@ -5348,6 +5335,69 @@ var LWC = (function (exports) {
5348
5335
  }
5349
5336
  }
5350
5337
 
5338
+ /*
5339
+ * Copyright (c) 2018, salesforce.com, inc.
5340
+ * All rights reserved.
5341
+ * SPDX-License-Identifier: MIT
5342
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5343
+ */
5344
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
5345
+ let createFragment;
5346
+ if (SUPPORTS_TEMPLATE) {
5347
+ // Parse the fragment HTML string into DOM
5348
+ createFragment = function (html) {
5349
+ const template = document.createElement('template');
5350
+ template.innerHTML = html;
5351
+ return template.content.firstChild;
5352
+ };
5353
+ }
5354
+ else {
5355
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
5356
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
5357
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
5358
+ // With other elements added from:
5359
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
5360
+ // Using the test:
5361
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
5362
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
5363
+ const topLevelWrappingMap = {
5364
+ caption: ['table'],
5365
+ col: ['colgroup', 'table'],
5366
+ colgroup: ['table'],
5367
+ option: ['select'],
5368
+ tbody: ['table'],
5369
+ td: ['tr', 'tbody', 'table'],
5370
+ th: ['tr', 'tbody', 'table'],
5371
+ thead: ['table'],
5372
+ tfoot: ['table'],
5373
+ tr: ['tbody', 'table'],
5374
+ };
5375
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
5376
+ const getTagName = function (text) {
5377
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
5378
+ };
5379
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
5380
+ createFragment = function (html) {
5381
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
5382
+ if (!isUndefined$1(wrapperTags)) {
5383
+ for (const wrapperTag of wrapperTags) {
5384
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
5385
+ }
5386
+ }
5387
+ // For IE11, the document title must not be undefined, but it can be an empty string
5388
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
5389
+ const doc = document.implementation.createHTMLDocument('');
5390
+ doc.body.innerHTML = html;
5391
+ let content = doc.body;
5392
+ if (!isUndefined$1(wrapperTags)) {
5393
+ for (let i = 0; i < wrapperTags.length; i++) {
5394
+ content = content.firstChild;
5395
+ }
5396
+ }
5397
+ return content.firstChild;
5398
+ };
5399
+ }
5400
+
5351
5401
  /*
5352
5402
  * Copyright (c) 2018, salesforce.com, inc.
5353
5403
  * All rights reserved.
@@ -5413,22 +5463,11 @@ var LWC = (function (exports) {
5413
5463
  };
5414
5464
  HTMLElementConstructor.prototype = HTMLElement.prototype;
5415
5465
  }
5416
- let hydrating = false;
5417
- function setIsHydrating(value) {
5418
- hydrating = value;
5419
- }
5420
- const ssr = false;
5421
- function isHydrating() {
5422
- return hydrating;
5423
- }
5424
5466
  const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
5425
5467
  const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
5426
5468
  function cloneNode(node, deep) {
5427
5469
  return node.cloneNode(deep);
5428
5470
  }
5429
- function createFragment(html) {
5430
- return document.createRange().createContextualFragment(html).firstChild;
5431
- }
5432
5471
  function createElement$1(tagName, namespace) {
5433
5472
  return isUndefined$1(namespace)
5434
5473
  ? document.createElement(tagName)
@@ -5450,15 +5489,11 @@ var LWC = (function (exports) {
5450
5489
  return node.nextSibling;
5451
5490
  }
5452
5491
  function attachShadow(element, options) {
5453
- // `hydrating` will be true in two cases:
5492
+ // `shadowRoot` will be non-null in two cases:
5454
5493
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
5455
5494
  // 2. when a webapp author places <c-app> in their static HTML and mounts their
5456
- // root component with customeElement.define('c-app', Ctor)
5457
- //
5458
- // The second case can be treated as a failed hydration with nominal impact
5459
- // to performance. However, because <c-app> won't have a <template shadowroot>
5460
- // declarative child, `element.shadowRoot` is `null`.
5461
- if (hydrating && element.shadowRoot) {
5495
+ // root component with customElement.define('c-app', Ctor)
5496
+ if (!isNull(element.shadowRoot)) {
5462
5497
  return element.shadowRoot;
5463
5498
  }
5464
5499
  return element.attachShadow(options);
@@ -5548,11 +5583,9 @@ var LWC = (function (exports) {
5548
5583
  }
5549
5584
  const HTMLElementExported = HTMLElementConstructor;
5550
5585
  const renderer = {
5551
- ssr,
5552
5586
  isNativeShadowDefined,
5553
5587
  isSyntheticShadowDefined,
5554
5588
  HTMLElementExported,
5555
- isHydrating,
5556
5589
  insert,
5557
5590
  remove,
5558
5591
  cloneNode,
@@ -5638,13 +5671,8 @@ var LWC = (function (exports) {
5638
5671
  return;
5639
5672
  }
5640
5673
  try {
5641
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
5642
- // and uses the same algo to create the stylesheets as in SSR.
5643
- setIsHydrating(true);
5644
5674
  const vm = createVMWithProps(element, Ctor, props);
5645
5675
  hydrateRoot(vm);
5646
- // set it back since now we finished hydration.
5647
- setIsHydrating(false);
5648
5676
  }
5649
5677
  catch (e) {
5650
5678
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
@@ -5655,13 +5683,8 @@ var LWC = (function (exports) {
5655
5683
  resetShadowRootAndLightDom(element, Ctor);
5656
5684
  // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
5657
5685
  createVMWithProps(element, Ctor, props);
5658
- setIsHydrating(false);
5659
5686
  connectRootElement(element);
5660
5687
  }
5661
- finally {
5662
- // in case there's an error during recovery
5663
- setIsHydrating(false);
5664
- }
5665
5688
  }
5666
5689
 
5667
5690
  /*
@@ -5878,7 +5901,7 @@ var LWC = (function (exports) {
5878
5901
  });
5879
5902
  freeze(LightningElement);
5880
5903
  seal(LightningElement.prototype);
5881
- /* version: 2.21.1 */
5904
+ /* version: 2.23.1 */
5882
5905
 
5883
5906
  exports.LightningElement = LightningElement;
5884
5907
  exports.__unstable__ProfilerControl = profilerControl;