@lwc/engine-core 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.
@@ -796,6 +796,14 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
796
796
  shared.defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
797
797
  }
798
798
 
799
+ function updateComponentValue(vm, key, newValue) {
800
+ const { cmpFields } = vm;
801
+ if (newValue !== cmpFields[key]) {
802
+ cmpFields[key] = newValue;
803
+ componentValueMutated(vm, key);
804
+ }
805
+ }
806
+
799
807
  /**
800
808
  * Copyright (C) 2017 salesforce.com, inc.
801
809
  */
@@ -1428,10 +1436,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1428
1436
  shared.assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1429
1437
  shared.assert.invariant(!shared.isObject(newValue) || shared.isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1430
1438
  }
1431
- if (newValue !== vm.cmpProps[propName]) {
1432
- vm.cmpProps[propName] = newValue;
1433
- componentValueMutated(vm, propName);
1434
- }
1439
+ updateComponentValue(vm, propName, newValue);
1435
1440
  return set.call(vm.elm, newValue);
1436
1441
  },
1437
1442
  };
@@ -1726,10 +1731,7 @@ function createObservedFieldPropertyDescriptor(key) {
1726
1731
  },
1727
1732
  set(newValue) {
1728
1733
  const vm = getAssociatedVM(this);
1729
- if (newValue !== vm.cmpFields[key]) {
1730
- vm.cmpFields[key] = newValue;
1731
- componentValueMutated(vm, key);
1732
- }
1734
+ updateComponentValue(vm, key, newValue);
1733
1735
  },
1734
1736
  enumerable: true,
1735
1737
  configurable: true,
@@ -1931,10 +1933,7 @@ function internalTrackDecorator(key) {
1931
1933
  shared.assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${shared.toString(key)}`);
1932
1934
  }
1933
1935
  const reactiveOrAnyValue = getReactiveProxy(newValue);
1934
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
1935
- vm.cmpFields[key] = reactiveOrAnyValue;
1936
- componentValueMutated(vm, key);
1937
- }
1936
+ updateComponentValue(vm, key, reactiveOrAnyValue);
1938
1937
  },
1939
1938
  enumerable: true,
1940
1939
  configurable: true,
@@ -1973,10 +1972,7 @@ function internalWireFieldDecorator(key) {
1973
1972
  * letting the author to do the wrong thing, but it will keep our
1974
1973
  * system to be backward compatible.
1975
1974
  */
1976
- if (value !== vm.cmpFields[key]) {
1977
- vm.cmpFields[key] = value;
1978
- componentValueMutated(vm, key);
1979
- }
1975
+ updateComponentValue(vm, key, value);
1980
1976
  },
1981
1977
  enumerable: true,
1982
1978
  configurable: true,
@@ -3065,13 +3061,13 @@ function getNearestNativeShadowComponent(vm) {
3065
3061
  return owner;
3066
3062
  }
3067
3063
  function createStylesheet(vm, stylesheets) {
3068
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3064
+ const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
3069
3065
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3070
3066
  for (let i = 0; i < stylesheets.length; i++) {
3071
3067
  insertStylesheet(stylesheets[i]);
3072
3068
  }
3073
3069
  }
3074
- else if (ssr || vm.hydrated) {
3070
+ else if (!process.env.IS_BROWSER || vm.hydrated) {
3075
3071
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3076
3072
  // This works in the client, because the stylesheets are created, and cached in the VM
3077
3073
  // the first time the VM renders.
@@ -3372,7 +3368,7 @@ function patchChildren(c1, c2, parent, renderer) {
3372
3368
  updateStaticChildren(c1, c2, parent, renderer);
3373
3369
  }
3374
3370
  }
3375
- function patch(n1, n2, renderer) {
3371
+ function patch(n1, n2, parent, renderer) {
3376
3372
  var _a, _b;
3377
3373
  if (n1 === n2) {
3378
3374
  return;
@@ -3401,7 +3397,7 @@ function patch(n1, n2, renderer) {
3401
3397
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3402
3398
  break;
3403
3399
  case 3 /* VNodeType.CustomElement */:
3404
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3400
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3405
3401
  break;
3406
3402
  }
3407
3403
  }
@@ -3528,22 +3524,32 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3528
3524
  appendVM(vm);
3529
3525
  }
3530
3526
  }
3531
- function patchCustomElement(n1, n2, renderer) {
3532
- const elm = (n2.elm = n1.elm);
3533
- const vm = (n2.vm = n1.vm);
3534
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3535
- if (!shared.isUndefined(vm)) {
3536
- // in fallback mode, the allocation will always set children to
3537
- // empty and delegate the real allocation to the slot elements
3538
- allocateChildren(n2, vm);
3527
+ function patchCustomElement(n1, n2, parent, renderer) {
3528
+ if (n1.ctor !== n2.ctor) {
3529
+ // If the constructor, unmount the current component and mount a new one using the new
3530
+ // constructor.
3531
+ const anchor = renderer.nextSibling(n1.elm);
3532
+ unmount(n1, parent, renderer, true);
3533
+ mountCustomElement(n2, parent, anchor, renderer);
3539
3534
  }
3540
- // in fallback mode, the children will be always empty, so, nothing
3541
- // will happen, but in native, it does allocate the light dom
3542
- patchChildren(n1.children, n2.children, elm, renderer);
3543
- if (!shared.isUndefined(vm)) {
3544
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3545
- // this is important to preserve the top to bottom synchronous rendering phase.
3546
- rerenderVM(vm);
3535
+ else {
3536
+ // Otherwise patch the existing component with new props/attrs/etc.
3537
+ const elm = (n2.elm = n1.elm);
3538
+ const vm = (n2.vm = n1.vm);
3539
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3540
+ if (!shared.isUndefined(vm)) {
3541
+ // in fallback mode, the allocation will always set children to
3542
+ // empty and delegate the real allocation to the slot elements
3543
+ allocateChildren(n2, vm);
3544
+ }
3545
+ // in fallback mode, the children will be always empty, so, nothing
3546
+ // will happen, but in native, it does allocate the light dom
3547
+ patchChildren(n1.children, n2.children, elm, renderer);
3548
+ if (!shared.isUndefined(vm)) {
3549
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3550
+ // this is important to preserve the top to bottom synchronous rendering phase.
3551
+ rerenderVM(vm);
3552
+ }
3547
3553
  }
3548
3554
  }
3549
3555
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
@@ -3813,25 +3819,25 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3813
3819
  newEndVnode = newCh[--newEndIdx];
3814
3820
  }
3815
3821
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
3816
- patch(oldStartVnode, newStartVnode, renderer);
3822
+ patch(oldStartVnode, newStartVnode, parent, renderer);
3817
3823
  oldStartVnode = oldCh[++oldStartIdx];
3818
3824
  newStartVnode = newCh[++newStartIdx];
3819
3825
  }
3820
3826
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
3821
- patch(oldEndVnode, newEndVnode, renderer);
3827
+ patch(oldEndVnode, newEndVnode, parent, renderer);
3822
3828
  oldEndVnode = oldCh[--oldEndIdx];
3823
3829
  newEndVnode = newCh[--newEndIdx];
3824
3830
  }
3825
3831
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
3826
3832
  // Vnode moved right
3827
- patch(oldStartVnode, newEndVnode, renderer);
3833
+ patch(oldStartVnode, newEndVnode, parent, renderer);
3828
3834
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
3829
3835
  oldStartVnode = oldCh[++oldStartIdx];
3830
3836
  newEndVnode = newCh[--newEndIdx];
3831
3837
  }
3832
3838
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
3833
3839
  // Vnode moved left
3834
- patch(oldEndVnode, newStartVnode, renderer);
3840
+ patch(oldEndVnode, newStartVnode, parent, renderer);
3835
3841
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
3836
3842
  oldEndVnode = oldCh[--oldEndIdx];
3837
3843
  newStartVnode = newCh[++newStartIdx];
@@ -3854,7 +3860,7 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3854
3860
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3855
3861
  }
3856
3862
  else {
3857
- patch(elmToMove, newStartVnode, renderer);
3863
+ patch(elmToMove, newStartVnode, parent, renderer);
3858
3864
  // Delete the old child, but copy the array since it is read-only.
3859
3865
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3860
3866
  // so we only care about the `oldCh` object inside this function.
@@ -3914,7 +3920,7 @@ function updateStaticChildren(c1, c2, parent, renderer) {
3914
3920
  if (isVNode(n1)) {
3915
3921
  if (isVNode(n2)) {
3916
3922
  // both vnodes are equivalent, and we just need to patch them
3917
- patch(n1, n2, renderer);
3923
+ patch(n1, n2, parent, renderer);
3918
3924
  anchor = n2.elm;
3919
3925
  }
3920
3926
  else {
@@ -4248,13 +4254,6 @@ function fid(url) {
4248
4254
  }
4249
4255
  return url;
4250
4256
  }
4251
- /**
4252
- * Map to store an index value assigned to any dynamic component reference ingested
4253
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4254
- * component reference to avoid diffing algo mismatches.
4255
- */
4256
- const DynamicImportedComponentMap = new Map();
4257
- let dynamicImportedComponentCounter = 0;
4258
4257
  /**
4259
4258
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4260
4259
  */
@@ -4271,18 +4270,7 @@ function dc(sel, Ctor, data, children = EmptyArray) {
4271
4270
  if (!isComponentConstructor(Ctor)) {
4272
4271
  throw new Error(`Invalid LWC Constructor ${shared.toString(Ctor)} for custom element <${sel}>.`);
4273
4272
  }
4274
- let idx = DynamicImportedComponentMap.get(Ctor);
4275
- if (shared.isUndefined(idx)) {
4276
- idx = dynamicImportedComponentCounter++;
4277
- DynamicImportedComponentMap.set(Ctor, idx);
4278
- }
4279
- // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4280
- // to identify different constructors as vnodes with different keys to avoid reusing the
4281
- // element used for previous constructors.
4282
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4283
- // hoisting optimization.
4284
- const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
4285
- return c(sel, Ctor, newData, children);
4273
+ return c(sel, Ctor, data, children);
4286
4274
  }
4287
4275
  /**
4288
4276
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5176,13 +5164,10 @@ function runRenderedCallback(vm) {
5176
5164
  const {
5177
5165
  def: {
5178
5166
  renderedCallback
5179
- },
5180
- renderer: {
5181
- ssr
5182
5167
  }
5183
5168
  } = vm;
5184
5169
 
5185
- if (shared.isTrue(ssr)) {
5170
+ if (!process.env.IS_BROWSER) {
5186
5171
  return;
5187
5172
  }
5188
5173
 
@@ -5435,13 +5420,7 @@ function resetComponentRoot(vm) {
5435
5420
  vm.velements = EmptyArray;
5436
5421
  }
5437
5422
  function scheduleRehydration(vm) {
5438
- const {
5439
- renderer: {
5440
- ssr
5441
- }
5442
- } = vm;
5443
-
5444
- if (shared.isTrue(ssr) || shared.isTrue(vm.isScheduled)) {
5423
+ if (!process.env.IS_BROWSER || shared.isTrue(vm.isScheduled)) {
5445
5424
  return;
5446
5425
  }
5447
5426
 
@@ -5548,15 +5527,8 @@ class WireContextRegistrationEvent extends CustomEvent {
5548
5527
  }
5549
5528
 
5550
5529
  function createFieldDataCallback(vm, name) {
5551
- const {
5552
- cmpFields
5553
- } = vm;
5554
5530
  return value => {
5555
- if (value !== vm.cmpFields[name]) {
5556
- // storing the value in the underlying storage
5557
- cmpFields[name] = value;
5558
- componentValueMutated(vm, name);
5559
- }
5531
+ updateComponentValue(vm, name, value);
5560
5532
  };
5561
5533
  }
5562
5534
 
@@ -6419,4 +6391,4 @@ exports.swapTemplate = swapTemplate;
6419
6391
  exports.track = track;
6420
6392
  exports.unwrap = unwrap;
6421
6393
  exports.wire = wire;
6422
- /* version: 2.22.0 */
6394
+ /* version: 2.23.0 */
@@ -793,6 +793,14 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
793
793
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
794
794
  }
795
795
 
796
+ function updateComponentValue(vm, key, newValue) {
797
+ const { cmpFields } = vm;
798
+ if (newValue !== cmpFields[key]) {
799
+ cmpFields[key] = newValue;
800
+ componentValueMutated(vm, key);
801
+ }
802
+ }
803
+
796
804
  /**
797
805
  * Copyright (C) 2017 salesforce.com, inc.
798
806
  */
@@ -1425,10 +1433,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1425
1433
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1426
1434
  assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1427
1435
  }
1428
- if (newValue !== vm.cmpProps[propName]) {
1429
- vm.cmpProps[propName] = newValue;
1430
- componentValueMutated(vm, propName);
1431
- }
1436
+ updateComponentValue(vm, propName, newValue);
1432
1437
  return set.call(vm.elm, newValue);
1433
1438
  },
1434
1439
  };
@@ -1723,10 +1728,7 @@ function createObservedFieldPropertyDescriptor(key) {
1723
1728
  },
1724
1729
  set(newValue) {
1725
1730
  const vm = getAssociatedVM(this);
1726
- if (newValue !== vm.cmpFields[key]) {
1727
- vm.cmpFields[key] = newValue;
1728
- componentValueMutated(vm, key);
1729
- }
1731
+ updateComponentValue(vm, key, newValue);
1730
1732
  },
1731
1733
  enumerable: true,
1732
1734
  configurable: true,
@@ -1928,10 +1930,7 @@ function internalTrackDecorator(key) {
1928
1930
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
1929
1931
  }
1930
1932
  const reactiveOrAnyValue = getReactiveProxy(newValue);
1931
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
1932
- vm.cmpFields[key] = reactiveOrAnyValue;
1933
- componentValueMutated(vm, key);
1934
- }
1933
+ updateComponentValue(vm, key, reactiveOrAnyValue);
1935
1934
  },
1936
1935
  enumerable: true,
1937
1936
  configurable: true,
@@ -1970,10 +1969,7 @@ function internalWireFieldDecorator(key) {
1970
1969
  * letting the author to do the wrong thing, but it will keep our
1971
1970
  * system to be backward compatible.
1972
1971
  */
1973
- if (value !== vm.cmpFields[key]) {
1974
- vm.cmpFields[key] = value;
1975
- componentValueMutated(vm, key);
1976
- }
1972
+ updateComponentValue(vm, key, value);
1977
1973
  },
1978
1974
  enumerable: true,
1979
1975
  configurable: true,
@@ -3062,13 +3058,13 @@ function getNearestNativeShadowComponent(vm) {
3062
3058
  return owner;
3063
3059
  }
3064
3060
  function createStylesheet(vm, stylesheets) {
3065
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3061
+ const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
3066
3062
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3067
3063
  for (let i = 0; i < stylesheets.length; i++) {
3068
3064
  insertStylesheet(stylesheets[i]);
3069
3065
  }
3070
3066
  }
3071
- else if (ssr || vm.hydrated) {
3067
+ else if (!process.env.IS_BROWSER || vm.hydrated) {
3072
3068
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3073
3069
  // This works in the client, because the stylesheets are created, and cached in the VM
3074
3070
  // the first time the VM renders.
@@ -3369,7 +3365,7 @@ function patchChildren(c1, c2, parent, renderer) {
3369
3365
  updateStaticChildren(c1, c2, parent, renderer);
3370
3366
  }
3371
3367
  }
3372
- function patch(n1, n2, renderer) {
3368
+ function patch(n1, n2, parent, renderer) {
3373
3369
  var _a, _b;
3374
3370
  if (n1 === n2) {
3375
3371
  return;
@@ -3398,7 +3394,7 @@ function patch(n1, n2, renderer) {
3398
3394
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3399
3395
  break;
3400
3396
  case 3 /* VNodeType.CustomElement */:
3401
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3397
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3402
3398
  break;
3403
3399
  }
3404
3400
  }
@@ -3525,22 +3521,32 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3525
3521
  appendVM(vm);
3526
3522
  }
3527
3523
  }
3528
- function patchCustomElement(n1, n2, renderer) {
3529
- const elm = (n2.elm = n1.elm);
3530
- const vm = (n2.vm = n1.vm);
3531
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3532
- if (!isUndefined$1(vm)) {
3533
- // in fallback mode, the allocation will always set children to
3534
- // empty and delegate the real allocation to the slot elements
3535
- allocateChildren(n2, vm);
3524
+ function patchCustomElement(n1, n2, parent, renderer) {
3525
+ if (n1.ctor !== n2.ctor) {
3526
+ // If the constructor, unmount the current component and mount a new one using the new
3527
+ // constructor.
3528
+ const anchor = renderer.nextSibling(n1.elm);
3529
+ unmount(n1, parent, renderer, true);
3530
+ mountCustomElement(n2, parent, anchor, renderer);
3536
3531
  }
3537
- // in fallback mode, the children will be always empty, so, nothing
3538
- // will happen, but in native, it does allocate the light dom
3539
- patchChildren(n1.children, n2.children, elm, renderer);
3540
- if (!isUndefined$1(vm)) {
3541
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3542
- // this is important to preserve the top to bottom synchronous rendering phase.
3543
- rerenderVM(vm);
3532
+ else {
3533
+ // Otherwise patch the existing component with new props/attrs/etc.
3534
+ const elm = (n2.elm = n1.elm);
3535
+ const vm = (n2.vm = n1.vm);
3536
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
3537
+ if (!isUndefined$1(vm)) {
3538
+ // in fallback mode, the allocation will always set children to
3539
+ // empty and delegate the real allocation to the slot elements
3540
+ allocateChildren(n2, vm);
3541
+ }
3542
+ // in fallback mode, the children will be always empty, so, nothing
3543
+ // will happen, but in native, it does allocate the light dom
3544
+ patchChildren(n1.children, n2.children, elm, renderer);
3545
+ if (!isUndefined$1(vm)) {
3546
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
3547
+ // this is important to preserve the top to bottom synchronous rendering phase.
3548
+ rerenderVM(vm);
3549
+ }
3544
3550
  }
3545
3551
  }
3546
3552
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
@@ -3810,25 +3816,25 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3810
3816
  newEndVnode = newCh[--newEndIdx];
3811
3817
  }
3812
3818
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
3813
- patch(oldStartVnode, newStartVnode, renderer);
3819
+ patch(oldStartVnode, newStartVnode, parent, renderer);
3814
3820
  oldStartVnode = oldCh[++oldStartIdx];
3815
3821
  newStartVnode = newCh[++newStartIdx];
3816
3822
  }
3817
3823
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
3818
- patch(oldEndVnode, newEndVnode, renderer);
3824
+ patch(oldEndVnode, newEndVnode, parent, renderer);
3819
3825
  oldEndVnode = oldCh[--oldEndIdx];
3820
3826
  newEndVnode = newCh[--newEndIdx];
3821
3827
  }
3822
3828
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
3823
3829
  // Vnode moved right
3824
- patch(oldStartVnode, newEndVnode, renderer);
3830
+ patch(oldStartVnode, newEndVnode, parent, renderer);
3825
3831
  insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
3826
3832
  oldStartVnode = oldCh[++oldStartIdx];
3827
3833
  newEndVnode = newCh[--newEndIdx];
3828
3834
  }
3829
3835
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
3830
3836
  // Vnode moved left
3831
- patch(oldEndVnode, newStartVnode, renderer);
3837
+ patch(oldEndVnode, newStartVnode, parent, renderer);
3832
3838
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
3833
3839
  oldEndVnode = oldCh[--oldEndIdx];
3834
3840
  newStartVnode = newCh[++newStartIdx];
@@ -3851,7 +3857,7 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3851
3857
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3852
3858
  }
3853
3859
  else {
3854
- patch(elmToMove, newStartVnode, renderer);
3860
+ patch(elmToMove, newStartVnode, parent, renderer);
3855
3861
  // Delete the old child, but copy the array since it is read-only.
3856
3862
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3857
3863
  // so we only care about the `oldCh` object inside this function.
@@ -3911,7 +3917,7 @@ function updateStaticChildren(c1, c2, parent, renderer) {
3911
3917
  if (isVNode(n1)) {
3912
3918
  if (isVNode(n2)) {
3913
3919
  // both vnodes are equivalent, and we just need to patch them
3914
- patch(n1, n2, renderer);
3920
+ patch(n1, n2, parent, renderer);
3915
3921
  anchor = n2.elm;
3916
3922
  }
3917
3923
  else {
@@ -4245,13 +4251,6 @@ function fid(url) {
4245
4251
  }
4246
4252
  return url;
4247
4253
  }
4248
- /**
4249
- * Map to store an index value assigned to any dynamic component reference ingested
4250
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4251
- * component reference to avoid diffing algo mismatches.
4252
- */
4253
- const DynamicImportedComponentMap = new Map();
4254
- let dynamicImportedComponentCounter = 0;
4255
4254
  /**
4256
4255
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4257
4256
  */
@@ -4268,18 +4267,7 @@ function dc(sel, Ctor, data, children = EmptyArray) {
4268
4267
  if (!isComponentConstructor(Ctor)) {
4269
4268
  throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
4270
4269
  }
4271
- let idx = DynamicImportedComponentMap.get(Ctor);
4272
- if (isUndefined$1(idx)) {
4273
- idx = dynamicImportedComponentCounter++;
4274
- DynamicImportedComponentMap.set(Ctor, idx);
4275
- }
4276
- // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4277
- // to identify different constructors as vnodes with different keys to avoid reusing the
4278
- // element used for previous constructors.
4279
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4280
- // hoisting optimization.
4281
- const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
4282
- return c(sel, Ctor, newData, children);
4270
+ return c(sel, Ctor, data, children);
4283
4271
  }
4284
4272
  /**
4285
4273
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5173,13 +5161,10 @@ function runRenderedCallback(vm) {
5173
5161
  const {
5174
5162
  def: {
5175
5163
  renderedCallback
5176
- },
5177
- renderer: {
5178
- ssr
5179
5164
  }
5180
5165
  } = vm;
5181
5166
 
5182
- if (isTrue(ssr)) {
5167
+ if (!process.env.IS_BROWSER) {
5183
5168
  return;
5184
5169
  }
5185
5170
 
@@ -5432,13 +5417,7 @@ function resetComponentRoot(vm) {
5432
5417
  vm.velements = EmptyArray;
5433
5418
  }
5434
5419
  function scheduleRehydration(vm) {
5435
- const {
5436
- renderer: {
5437
- ssr
5438
- }
5439
- } = vm;
5440
-
5441
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
5420
+ if (!process.env.IS_BROWSER || isTrue(vm.isScheduled)) {
5442
5421
  return;
5443
5422
  }
5444
5423
 
@@ -5545,15 +5524,8 @@ class WireContextRegistrationEvent extends CustomEvent {
5545
5524
  }
5546
5525
 
5547
5526
  function createFieldDataCallback(vm, name) {
5548
- const {
5549
- cmpFields
5550
- } = vm;
5551
5527
  return value => {
5552
- if (value !== vm.cmpFields[name]) {
5553
- // storing the value in the underlying storage
5554
- cmpFields[name] = value;
5555
- componentValueMutated(vm, name);
5556
- }
5528
+ updateComponentValue(vm, name, value);
5557
5529
  };
5558
5530
  }
5559
5531
 
@@ -6379,4 +6351,4 @@ function getComponentConstructor(elm) {
6379
6351
  }
6380
6352
 
6381
6353
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6382
- /* version: 2.22.0 */
6354
+ /* version: 2.23.0 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "types/"
26
26
  ],
27
27
  "dependencies": {
28
- "@lwc/features": "2.22.0",
29
- "@lwc/shared": "2.22.0"
28
+ "@lwc/features": "2.23.0",
29
+ "@lwc/shared": "2.23.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "observable-membrane": "2.0.0"
@@ -3,11 +3,9 @@ export declare type HostElement = any;
3
3
  declare type N = HostNode;
4
4
  declare type E = HostElement;
5
5
  export interface RendererAPI {
6
- ssr: boolean;
7
6
  isNativeShadowDefined: boolean;
8
7
  isSyntheticShadowDefined: boolean;
9
8
  HTMLElementExported: typeof HTMLElement;
10
- isHydrating: () => boolean;
11
9
  insert: (node: N, parent: E, anchor: N | null) => void;
12
10
  remove: (node: N, parent: E) => void;
13
11
  cloneNode: (node: N, deep: boolean) => N;
@@ -0,0 +1,2 @@
1
+ import { VM } from './vm';
2
+ export declare function updateComponentValue(vm: VM, key: string, newValue: any): void;