@lwc/engine-core 2.28.0 → 2.28.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.
@@ -3229,6 +3229,9 @@ function isSameVnode(vnode1, vnode2) {
3229
3229
  function isVCustomElement(vnode) {
3230
3230
  return vnode.type === 3 /* VNodeType.CustomElement */;
3231
3231
  }
3232
+ function isVFragment(vnode) {
3233
+ return vnode.type === 5 /* VNodeType.Fragment */;
3234
+ }
3232
3235
  function isVScopedSlotFragment(vnode) {
3233
3236
  return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
3234
3237
  }
@@ -4121,26 +4124,26 @@ function createViewModelHook(elm, vnode, renderer) {
4121
4124
 
4122
4125
  return vm;
4123
4126
  }
4127
+ /**
4128
+ * Collects all slots into a SlotSet, traversing through VFragment Nodes
4129
+ */
4124
4130
 
4125
- function allocateInSlot(vm, children, owner) {
4126
- var _a, _b;
4127
4131
 
4128
- const {
4129
- cmpSlots: {
4130
- slotAssignments: oldSlotsMapping
4131
- }
4132
- } = vm;
4133
- const cmpSlotsMapping = shared.create(null);
4134
- vm.cmpSlots = {
4135
- owner,
4136
- slotAssignments: cmpSlotsMapping
4137
- };
4132
+ function collectSlots(vm, children, cmpSlotsMapping) {
4133
+ var _a, _b;
4138
4134
 
4139
4135
  for (let i = 0, len = children.length; i < len; i += 1) {
4140
4136
  const vnode = children[i];
4141
4137
 
4142
4138
  if (shared.isNull(vnode)) {
4143
4139
  continue;
4140
+ } // Dive further iff the content is wrapped in a VFragment
4141
+
4142
+
4143
+ if (isVFragment(vnode)) {
4144
+ // Remove the text delimiter nodes to avoid overriding default slot content
4145
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4146
+ continue;
4144
4147
  }
4145
4148
 
4146
4149
  let slotName = '';
@@ -4154,6 +4157,20 @@ function allocateInSlot(vm, children, owner) {
4154
4157
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4155
4158
  shared.ArrayPush.call(vnodes, vnode);
4156
4159
  }
4160
+ }
4161
+
4162
+ function allocateInSlot(vm, children, owner) {
4163
+ const {
4164
+ cmpSlots: {
4165
+ slotAssignments: oldSlotsMapping
4166
+ }
4167
+ } = vm;
4168
+ const cmpSlotsMapping = shared.create(null);
4169
+ collectSlots(vm, children, cmpSlotsMapping);
4170
+ vm.cmpSlots = {
4171
+ owner,
4172
+ slotAssignments: cmpSlotsMapping
4173
+ };
4157
4174
 
4158
4175
  if (shared.isFalse(vm.isDirty)) {
4159
4176
  // We need to determine if the old allocation is really different from the new one
@@ -6643,11 +6660,12 @@ function validateClassAttr(vnode, elm, renderer) {
6643
6660
  }
6644
6661
  }
6645
6662
  let nodesAreCompatible = true;
6646
- let vnodeClassName;
6647
- if (!shared.isUndefined(className) && String(className) !== getProperty(elm, 'className')) {
6663
+ let readableVnodeClassname;
6664
+ const elmClassName = getProperty(elm, 'className');
6665
+ if (!shared.isUndefined(className) && String(className) !== elmClassName) {
6648
6666
  // className is used when class is bound to an expr.
6649
6667
  nodesAreCompatible = false;
6650
- vnodeClassName = className;
6668
+ readableVnodeClassname = className;
6651
6669
  }
6652
6670
  else if (!shared.isUndefined(classMap)) {
6653
6671
  // classMap is used when class is set to static value.
@@ -6660,14 +6678,19 @@ function validateClassAttr(vnode, elm, renderer) {
6660
6678
  nodesAreCompatible = false;
6661
6679
  }
6662
6680
  }
6663
- vnodeClassName = computedClassName.trim();
6681
+ readableVnodeClassname = computedClassName.trim();
6664
6682
  if (classList.length > shared.keys(classMap).length) {
6665
6683
  nodesAreCompatible = false;
6666
6684
  }
6667
6685
  }
6686
+ else if (shared.isUndefined(className) && elmClassName !== '') {
6687
+ // SSR contains a className but client-side VDOM does not
6688
+ nodesAreCompatible = false;
6689
+ readableVnodeClassname = '';
6690
+ }
6668
6691
  if (!nodesAreCompatible) {
6669
6692
  if (process.env.NODE_ENV !== 'production') {
6670
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
6693
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${readableVnodeClassname}" but found "${elmClassName}"`, vnode.owner);
6671
6694
  }
6672
6695
  }
6673
6696
  return nodesAreCompatible;
@@ -6919,4 +6942,4 @@ exports.swapTemplate = swapTemplate;
6919
6942
  exports.track = track;
6920
6943
  exports.unwrap = unwrap;
6921
6944
  exports.wire = wire;
6922
- /* version: 2.28.0 */
6945
+ /* version: 2.28.1 */
@@ -3226,6 +3226,9 @@ function isSameVnode(vnode1, vnode2) {
3226
3226
  function isVCustomElement(vnode) {
3227
3227
  return vnode.type === 3 /* VNodeType.CustomElement */;
3228
3228
  }
3229
+ function isVFragment(vnode) {
3230
+ return vnode.type === 5 /* VNodeType.Fragment */;
3231
+ }
3229
3232
  function isVScopedSlotFragment(vnode) {
3230
3233
  return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
3231
3234
  }
@@ -4118,26 +4121,26 @@ function createViewModelHook(elm, vnode, renderer) {
4118
4121
 
4119
4122
  return vm;
4120
4123
  }
4124
+ /**
4125
+ * Collects all slots into a SlotSet, traversing through VFragment Nodes
4126
+ */
4121
4127
 
4122
- function allocateInSlot(vm, children, owner) {
4123
- var _a, _b;
4124
4128
 
4125
- const {
4126
- cmpSlots: {
4127
- slotAssignments: oldSlotsMapping
4128
- }
4129
- } = vm;
4130
- const cmpSlotsMapping = create(null);
4131
- vm.cmpSlots = {
4132
- owner,
4133
- slotAssignments: cmpSlotsMapping
4134
- };
4129
+ function collectSlots(vm, children, cmpSlotsMapping) {
4130
+ var _a, _b;
4135
4131
 
4136
4132
  for (let i = 0, len = children.length; i < len; i += 1) {
4137
4133
  const vnode = children[i];
4138
4134
 
4139
4135
  if (isNull(vnode)) {
4140
4136
  continue;
4137
+ } // Dive further iff the content is wrapped in a VFragment
4138
+
4139
+
4140
+ if (isVFragment(vnode)) {
4141
+ // Remove the text delimiter nodes to avoid overriding default slot content
4142
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4143
+ continue;
4141
4144
  }
4142
4145
 
4143
4146
  let slotName = '';
@@ -4151,6 +4154,20 @@ function allocateInSlot(vm, children, owner) {
4151
4154
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4152
4155
  ArrayPush$1.call(vnodes, vnode);
4153
4156
  }
4157
+ }
4158
+
4159
+ function allocateInSlot(vm, children, owner) {
4160
+ const {
4161
+ cmpSlots: {
4162
+ slotAssignments: oldSlotsMapping
4163
+ }
4164
+ } = vm;
4165
+ const cmpSlotsMapping = create(null);
4166
+ collectSlots(vm, children, cmpSlotsMapping);
4167
+ vm.cmpSlots = {
4168
+ owner,
4169
+ slotAssignments: cmpSlotsMapping
4170
+ };
4154
4171
 
4155
4172
  if (isFalse(vm.isDirty)) {
4156
4173
  // We need to determine if the old allocation is really different from the new one
@@ -6640,11 +6657,12 @@ function validateClassAttr(vnode, elm, renderer) {
6640
6657
  }
6641
6658
  }
6642
6659
  let nodesAreCompatible = true;
6643
- let vnodeClassName;
6644
- if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
6660
+ let readableVnodeClassname;
6661
+ const elmClassName = getProperty(elm, 'className');
6662
+ if (!isUndefined$1(className) && String(className) !== elmClassName) {
6645
6663
  // className is used when class is bound to an expr.
6646
6664
  nodesAreCompatible = false;
6647
- vnodeClassName = className;
6665
+ readableVnodeClassname = className;
6648
6666
  }
6649
6667
  else if (!isUndefined$1(classMap)) {
6650
6668
  // classMap is used when class is set to static value.
@@ -6657,14 +6675,19 @@ function validateClassAttr(vnode, elm, renderer) {
6657
6675
  nodesAreCompatible = false;
6658
6676
  }
6659
6677
  }
6660
- vnodeClassName = computedClassName.trim();
6678
+ readableVnodeClassname = computedClassName.trim();
6661
6679
  if (classList.length > keys(classMap).length) {
6662
6680
  nodesAreCompatible = false;
6663
6681
  }
6664
6682
  }
6683
+ else if (isUndefined$1(className) && elmClassName !== '') {
6684
+ // SSR contains a className but client-side VDOM does not
6685
+ nodesAreCompatible = false;
6686
+ readableVnodeClassname = '';
6687
+ }
6665
6688
  if (!nodesAreCompatible) {
6666
6689
  if (process.env.NODE_ENV !== 'production') {
6667
- logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty(elm, 'className')}"`, vnode.owner);
6690
+ logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${readableVnodeClassname}" but found "${elmClassName}"`, vnode.owner);
6668
6691
  }
6669
6692
  }
6670
6693
  return nodesAreCompatible;
@@ -6880,4 +6903,4 @@ function getComponentConstructor(elm) {
6880
6903
  }
6881
6904
 
6882
6905
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6883
- /* version: 2.28.0 */
6906
+ /* version: 2.28.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.28.0",
3
+ "version": "2.28.1",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.28.0",
28
- "@lwc/shared": "2.28.0"
27
+ "@lwc/features": "2.28.1",
28
+ "@lwc/shared": "2.28.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"
@@ -88,4 +88,5 @@ export interface VElementData extends VNodeData {
88
88
  export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
89
89
  export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
90
90
  export declare function isVCustomElement(vnode: VBaseElement): vnode is VCustomElement;
91
+ export declare function isVFragment(vnode: VNode): vnode is VFragment;
91
92
  export declare function isVScopedSlotFragment(vnode: VNode): vnode is VScopedSlotFragment;