@lwc/engine-core 2.26.0 → 2.27.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.
- package/dist/engine-core.cjs.js +68 -20
- package/dist/engine-core.js +69 -21
- package/package.json +3 -3
- package/types/framework/api.d.ts +3 -1
- package/types/framework/vm.d.ts +6 -2
- package/types/framework/vnodes.d.ts +10 -2
package/dist/engine-core.cjs.js
CHANGED
|
@@ -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 isVScopedSlotFragment(vnode) {
|
|
3233
|
+
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3234
|
+
}
|
|
3232
3235
|
|
|
3233
3236
|
/*
|
|
3234
3237
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4067,7 +4070,7 @@ function allocateChildren(vnode, vm) {
|
|
|
4067
4070
|
/* RenderMode.Light */
|
|
4068
4071
|
) {
|
|
4069
4072
|
// slow path
|
|
4070
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4073
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
4071
4074
|
|
|
4072
4075
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4073
4076
|
|
|
@@ -4103,13 +4106,19 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4103
4106
|
return vm;
|
|
4104
4107
|
}
|
|
4105
4108
|
|
|
4106
|
-
function allocateInSlot(vm, children) {
|
|
4107
|
-
var _a;
|
|
4109
|
+
function allocateInSlot(vm, children, owner) {
|
|
4110
|
+
var _a, _b;
|
|
4108
4111
|
|
|
4109
4112
|
const {
|
|
4110
|
-
cmpSlots:
|
|
4113
|
+
cmpSlots: {
|
|
4114
|
+
slotAssignments: oldSlotsMapping
|
|
4115
|
+
}
|
|
4111
4116
|
} = vm;
|
|
4112
|
-
const
|
|
4117
|
+
const cmpSlotsMapping = shared.create(null);
|
|
4118
|
+
vm.cmpSlots = {
|
|
4119
|
+
owner,
|
|
4120
|
+
slotAssignments: cmpSlotsMapping
|
|
4121
|
+
};
|
|
4113
4122
|
|
|
4114
4123
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4115
4124
|
const vnode = children[i];
|
|
@@ -4121,19 +4130,21 @@ function allocateInSlot(vm, children) {
|
|
|
4121
4130
|
let slotName = '';
|
|
4122
4131
|
|
|
4123
4132
|
if (isVBaseElement(vnode)) {
|
|
4124
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
4133
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4134
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
4135
|
+
slotName = vnode.slotName;
|
|
4125
4136
|
}
|
|
4126
4137
|
|
|
4127
|
-
const vnodes =
|
|
4138
|
+
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4128
4139
|
shared.ArrayPush.call(vnodes, vnode);
|
|
4129
4140
|
}
|
|
4130
4141
|
|
|
4131
4142
|
if (shared.isFalse(vm.isDirty)) {
|
|
4132
4143
|
// We need to determine if the old allocation is really different from the new one
|
|
4133
4144
|
// and mark the vm as dirty
|
|
4134
|
-
const oldKeys = shared.keys(
|
|
4145
|
+
const oldKeys = shared.keys(oldSlotsMapping);
|
|
4135
4146
|
|
|
4136
|
-
if (oldKeys.length !== shared.keys(
|
|
4147
|
+
if (oldKeys.length !== shared.keys(cmpSlotsMapping).length) {
|
|
4137
4148
|
markComponentAsDirty(vm);
|
|
4138
4149
|
return;
|
|
4139
4150
|
}
|
|
@@ -4141,15 +4152,15 @@ function allocateInSlot(vm, children) {
|
|
|
4141
4152
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4142
4153
|
const key = oldKeys[i];
|
|
4143
4154
|
|
|
4144
|
-
if (shared.isUndefined(
|
|
4155
|
+
if (shared.isUndefined(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4145
4156
|
markComponentAsDirty(vm);
|
|
4146
4157
|
return;
|
|
4147
4158
|
}
|
|
4148
4159
|
|
|
4149
|
-
const oldVNodes =
|
|
4150
|
-
const vnodes =
|
|
4160
|
+
const oldVNodes = oldSlotsMapping[key];
|
|
4161
|
+
const vnodes = cmpSlotsMapping[key];
|
|
4151
4162
|
|
|
4152
|
-
for (let j = 0, a =
|
|
4163
|
+
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4153
4164
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4154
4165
|
markComponentAsDirty(vm);
|
|
4155
4166
|
return;
|
|
@@ -4349,6 +4360,18 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4349
4360
|
function addVNodeToChildLWC(vnode) {
|
|
4350
4361
|
shared.ArrayPush.call(getVMBeingRendered().velements, vnode);
|
|
4351
4362
|
}
|
|
4363
|
+
// [s]coped [s]lot [f]actory
|
|
4364
|
+
function ssf(slotName, factory) {
|
|
4365
|
+
return {
|
|
4366
|
+
type: 6 /* VNodeType.ScopedSlotFragment */,
|
|
4367
|
+
factory,
|
|
4368
|
+
owner: getVMBeingRendered(),
|
|
4369
|
+
elm: undefined,
|
|
4370
|
+
sel: undefined,
|
|
4371
|
+
key: undefined,
|
|
4372
|
+
slotName,
|
|
4373
|
+
};
|
|
4374
|
+
}
|
|
4352
4375
|
// [st]atic node
|
|
4353
4376
|
function st(fragment, key) {
|
|
4354
4377
|
return {
|
|
@@ -4432,9 +4455,31 @@ function s(slotName, data, children, slotset) {
|
|
|
4432
4455
|
shared.assert.isTrue(shared.isArray(children), `h() 3rd argument children must be an array.`);
|
|
4433
4456
|
}
|
|
4434
4457
|
if (!shared.isUndefined(slotset) &&
|
|
4435
|
-
!shared.isUndefined(slotset
|
|
4436
|
-
slotset[slotName]
|
|
4437
|
-
|
|
4458
|
+
!shared.isUndefined(slotset.slotAssignments) &&
|
|
4459
|
+
!shared.isUndefined(slotset.slotAssignments[slotName]) &&
|
|
4460
|
+
slotset.slotAssignments[slotName].length !== 0) {
|
|
4461
|
+
children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
|
|
4462
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
4463
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
4464
|
+
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4465
|
+
let children = [];
|
|
4466
|
+
// Evaluate in the scope of the slot content's owner
|
|
4467
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4468
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
4469
|
+
setVMBeingRendered(slotset.owner);
|
|
4470
|
+
try {
|
|
4471
|
+
children = vnode.factory(data.slotData);
|
|
4472
|
+
}
|
|
4473
|
+
finally {
|
|
4474
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
4475
|
+
}
|
|
4476
|
+
return shared.ArrayConcat.call(acc, children);
|
|
4477
|
+
}
|
|
4478
|
+
else {
|
|
4479
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
4480
|
+
return shared.ArrayConcat.call(acc, vnode);
|
|
4481
|
+
}
|
|
4482
|
+
}, []);
|
|
4438
4483
|
}
|
|
4439
4484
|
const vmBeingRendered = getVMBeingRendered();
|
|
4440
4485
|
const { renderMode, shadowMode } = vmBeingRendered;
|
|
@@ -4754,6 +4799,7 @@ const api = shared.freeze({
|
|
|
4754
4799
|
gid,
|
|
4755
4800
|
fid,
|
|
4756
4801
|
shc,
|
|
4802
|
+
ssf,
|
|
4757
4803
|
});
|
|
4758
4804
|
|
|
4759
4805
|
/*
|
|
@@ -4890,9 +4936,9 @@ function validateSlots(vm, html) {
|
|
|
4890
4936
|
}
|
|
4891
4937
|
const { cmpSlots } = vm;
|
|
4892
4938
|
const { slots = EmptyArray } = html;
|
|
4893
|
-
for (const slotName in cmpSlots) {
|
|
4939
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
4894
4940
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4895
|
-
shared.assert.isTrue(shared.isArray(cmpSlots[slotName]), `Slots can only be set to an array, instead received ${shared.toString(cmpSlots[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4941
|
+
shared.assert.isTrue(shared.isArray(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${shared.toString(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4896
4942
|
if (slotName !== '' && shared.ArrayIndexOf.call(slots, slotName) === -1) {
|
|
4897
4943
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
4898
4944
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
@@ -5389,7 +5435,9 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5389
5435
|
velements: EmptyArray,
|
|
5390
5436
|
cmpProps: shared.create(null),
|
|
5391
5437
|
cmpFields: shared.create(null),
|
|
5392
|
-
cmpSlots:
|
|
5438
|
+
cmpSlots: {
|
|
5439
|
+
slotAssignments: shared.create(null)
|
|
5440
|
+
},
|
|
5393
5441
|
oar: shared.create(null),
|
|
5394
5442
|
cmpTemplate: null,
|
|
5395
5443
|
hydrated: Boolean(hydrated),
|
|
@@ -6840,4 +6888,4 @@ exports.swapTemplate = swapTemplate;
|
|
|
6840
6888
|
exports.track = track;
|
|
6841
6889
|
exports.unwrap = unwrap;
|
|
6842
6890
|
exports.wire = wire;
|
|
6843
|
-
/* version: 2.
|
|
6891
|
+
/* version: 2.27.0 */
|
package/dist/engine-core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* proxy-compat-disable */
|
|
2
2
|
import { lwcRuntimeFlags } from '@lwc/features';
|
|
3
3
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
4
|
-
import { seal, create, isUndefined as isUndefined$1, isFunction as isFunction$1, ArrayPush as ArrayPush$1, ArrayIndexOf, ArraySplice, StringToLowerCase, isNull, ArrayJoin, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, freeze, assert, KEY__SYNTHETIC_MODE, isFalse, isTrue, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, isArray as isArray$1, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, isNumber, StringReplace, noop, ArrayUnshift, ArrayFilter, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift, ArrayPop } from '@lwc/shared';
|
|
4
|
+
import { seal, create, isUndefined as isUndefined$1, isFunction as isFunction$1, ArrayPush as ArrayPush$1, ArrayIndexOf, ArraySplice, StringToLowerCase, isNull, ArrayJoin, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, freeze, assert, KEY__SYNTHETIC_MODE, isFalse, isTrue, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, isArray as isArray$1, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArrayConcat as ArrayConcat$1, isNumber, StringReplace, noop, ArrayUnshift, ArrayFilter, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift, ArrayPop } from '@lwc/shared';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -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 isVScopedSlotFragment(vnode) {
|
|
3230
|
+
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3231
|
+
}
|
|
3229
3232
|
|
|
3230
3233
|
/*
|
|
3231
3234
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4064,7 +4067,7 @@ function allocateChildren(vnode, vm) {
|
|
|
4064
4067
|
/* RenderMode.Light */
|
|
4065
4068
|
) {
|
|
4066
4069
|
// slow path
|
|
4067
|
-
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
4070
|
+
allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
|
|
4068
4071
|
|
|
4069
4072
|
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4070
4073
|
|
|
@@ -4100,13 +4103,19 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4100
4103
|
return vm;
|
|
4101
4104
|
}
|
|
4102
4105
|
|
|
4103
|
-
function allocateInSlot(vm, children) {
|
|
4104
|
-
var _a;
|
|
4106
|
+
function allocateInSlot(vm, children, owner) {
|
|
4107
|
+
var _a, _b;
|
|
4105
4108
|
|
|
4106
4109
|
const {
|
|
4107
|
-
cmpSlots:
|
|
4110
|
+
cmpSlots: {
|
|
4111
|
+
slotAssignments: oldSlotsMapping
|
|
4112
|
+
}
|
|
4108
4113
|
} = vm;
|
|
4109
|
-
const
|
|
4114
|
+
const cmpSlotsMapping = create(null);
|
|
4115
|
+
vm.cmpSlots = {
|
|
4116
|
+
owner,
|
|
4117
|
+
slotAssignments: cmpSlotsMapping
|
|
4118
|
+
};
|
|
4110
4119
|
|
|
4111
4120
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4112
4121
|
const vnode = children[i];
|
|
@@ -4118,19 +4127,21 @@ function allocateInSlot(vm, children) {
|
|
|
4118
4127
|
let slotName = '';
|
|
4119
4128
|
|
|
4120
4129
|
if (isVBaseElement(vnode)) {
|
|
4121
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot)
|
|
4130
|
+
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4131
|
+
} else if (isVScopedSlotFragment(vnode)) {
|
|
4132
|
+
slotName = vnode.slotName;
|
|
4122
4133
|
}
|
|
4123
4134
|
|
|
4124
|
-
const vnodes =
|
|
4135
|
+
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4125
4136
|
ArrayPush$1.call(vnodes, vnode);
|
|
4126
4137
|
}
|
|
4127
4138
|
|
|
4128
4139
|
if (isFalse(vm.isDirty)) {
|
|
4129
4140
|
// We need to determine if the old allocation is really different from the new one
|
|
4130
4141
|
// and mark the vm as dirty
|
|
4131
|
-
const oldKeys = keys(
|
|
4142
|
+
const oldKeys = keys(oldSlotsMapping);
|
|
4132
4143
|
|
|
4133
|
-
if (oldKeys.length !== keys(
|
|
4144
|
+
if (oldKeys.length !== keys(cmpSlotsMapping).length) {
|
|
4134
4145
|
markComponentAsDirty(vm);
|
|
4135
4146
|
return;
|
|
4136
4147
|
}
|
|
@@ -4138,15 +4149,15 @@ function allocateInSlot(vm, children) {
|
|
|
4138
4149
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4139
4150
|
const key = oldKeys[i];
|
|
4140
4151
|
|
|
4141
|
-
if (isUndefined$1(
|
|
4152
|
+
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4142
4153
|
markComponentAsDirty(vm);
|
|
4143
4154
|
return;
|
|
4144
4155
|
}
|
|
4145
4156
|
|
|
4146
|
-
const oldVNodes =
|
|
4147
|
-
const vnodes =
|
|
4157
|
+
const oldVNodes = oldSlotsMapping[key];
|
|
4158
|
+
const vnodes = cmpSlotsMapping[key];
|
|
4148
4159
|
|
|
4149
|
-
for (let j = 0, a =
|
|
4160
|
+
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4150
4161
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4151
4162
|
markComponentAsDirty(vm);
|
|
4152
4163
|
return;
|
|
@@ -4346,6 +4357,18 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4346
4357
|
function addVNodeToChildLWC(vnode) {
|
|
4347
4358
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4348
4359
|
}
|
|
4360
|
+
// [s]coped [s]lot [f]actory
|
|
4361
|
+
function ssf(slotName, factory) {
|
|
4362
|
+
return {
|
|
4363
|
+
type: 6 /* VNodeType.ScopedSlotFragment */,
|
|
4364
|
+
factory,
|
|
4365
|
+
owner: getVMBeingRendered(),
|
|
4366
|
+
elm: undefined,
|
|
4367
|
+
sel: undefined,
|
|
4368
|
+
key: undefined,
|
|
4369
|
+
slotName,
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4349
4372
|
// [st]atic node
|
|
4350
4373
|
function st(fragment, key) {
|
|
4351
4374
|
return {
|
|
@@ -4429,9 +4452,31 @@ function s(slotName, data, children, slotset) {
|
|
|
4429
4452
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
4430
4453
|
}
|
|
4431
4454
|
if (!isUndefined$1(slotset) &&
|
|
4432
|
-
!isUndefined$1(slotset
|
|
4433
|
-
slotset[slotName]
|
|
4434
|
-
|
|
4455
|
+
!isUndefined$1(slotset.slotAssignments) &&
|
|
4456
|
+
!isUndefined$1(slotset.slotAssignments[slotName]) &&
|
|
4457
|
+
slotset.slotAssignments[slotName].length !== 0) {
|
|
4458
|
+
children = slotset.slotAssignments[slotName].reduce((acc, vnode) => {
|
|
4459
|
+
// If the passed slot content is factory, evaluate it and use the produced vnodes
|
|
4460
|
+
if (vnode && isVScopedSlotFragment(vnode)) {
|
|
4461
|
+
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4462
|
+
let children = [];
|
|
4463
|
+
// Evaluate in the scope of the slot content's owner
|
|
4464
|
+
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4465
|
+
// undefined is for root components, but root components cannot accept slotted content
|
|
4466
|
+
setVMBeingRendered(slotset.owner);
|
|
4467
|
+
try {
|
|
4468
|
+
children = vnode.factory(data.slotData);
|
|
4469
|
+
}
|
|
4470
|
+
finally {
|
|
4471
|
+
setVMBeingRendered(vmBeingRenderedInception);
|
|
4472
|
+
}
|
|
4473
|
+
return ArrayConcat$1.call(acc, children);
|
|
4474
|
+
}
|
|
4475
|
+
else {
|
|
4476
|
+
// If the slot content is a static list of child nodes provided by the parent, nothing to do
|
|
4477
|
+
return ArrayConcat$1.call(acc, vnode);
|
|
4478
|
+
}
|
|
4479
|
+
}, []);
|
|
4435
4480
|
}
|
|
4436
4481
|
const vmBeingRendered = getVMBeingRendered();
|
|
4437
4482
|
const { renderMode, shadowMode } = vmBeingRendered;
|
|
@@ -4751,6 +4796,7 @@ const api = freeze({
|
|
|
4751
4796
|
gid,
|
|
4752
4797
|
fid,
|
|
4753
4798
|
shc,
|
|
4799
|
+
ssf,
|
|
4754
4800
|
});
|
|
4755
4801
|
|
|
4756
4802
|
/*
|
|
@@ -4887,9 +4933,9 @@ function validateSlots(vm, html) {
|
|
|
4887
4933
|
}
|
|
4888
4934
|
const { cmpSlots } = vm;
|
|
4889
4935
|
const { slots = EmptyArray } = html;
|
|
4890
|
-
for (const slotName in cmpSlots) {
|
|
4936
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
4891
4937
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4892
|
-
assert.isTrue(isArray$1(cmpSlots[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4938
|
+
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4893
4939
|
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
4894
4940
|
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
4895
4941
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
@@ -5386,7 +5432,9 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5386
5432
|
velements: EmptyArray,
|
|
5387
5433
|
cmpProps: create(null),
|
|
5388
5434
|
cmpFields: create(null),
|
|
5389
|
-
cmpSlots:
|
|
5435
|
+
cmpSlots: {
|
|
5436
|
+
slotAssignments: create(null)
|
|
5437
|
+
},
|
|
5390
5438
|
oar: create(null),
|
|
5391
5439
|
cmpTemplate: null,
|
|
5392
5440
|
hydrated: Boolean(hydrated),
|
|
@@ -6801,4 +6849,4 @@ function getComponentConstructor(elm) {
|
|
|
6801
6849
|
}
|
|
6802
6850
|
|
|
6803
6851
|
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 };
|
|
6804
|
-
/* version: 2.
|
|
6852
|
+
/* version: 2.27.0 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/engine-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.0",
|
|
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
|
-
"@lwc/shared": "2.
|
|
27
|
+
"@lwc/features": "2.27.0",
|
|
28
|
+
"@lwc/shared": "2.27.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"observable-membrane": "2.0.0"
|
package/types/framework/api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SlotSet } from './vm';
|
|
2
2
|
import { LightningElementConstructor } from './base-lightning-element';
|
|
3
|
-
import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData, VStatic, Key, VFragment } from './vnodes';
|
|
3
|
+
import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData, VStatic, Key, VFragment, VScopedSlotFragment } from './vnodes';
|
|
4
|
+
declare function ssf(slotName: string, factory: (value: any) => VNodes): VScopedSlotFragment;
|
|
4
5
|
declare function st(fragment: Element, key: Key): VStatic;
|
|
5
6
|
declare function fr(key: Key, children: VNodes, stable: 0 | 1): VFragment;
|
|
6
7
|
declare function h(sel: string, data: VElementData, children?: VNodes): VElement;
|
|
@@ -47,6 +48,7 @@ declare const api: Readonly<{
|
|
|
47
48
|
gid: typeof gid;
|
|
48
49
|
fid: typeof fid;
|
|
49
50
|
shc: typeof shc;
|
|
51
|
+
ssf: typeof ssf;
|
|
50
52
|
}>;
|
|
51
53
|
export default api;
|
|
52
54
|
export declare type RenderAPI = typeof api;
|
package/types/framework/vm.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ export interface TemplateCache {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
12
|
export interface SlotSet {
|
|
13
|
-
|
|
13
|
+
slotAssignments: {
|
|
14
|
+
[key: string]: VNodes;
|
|
15
|
+
};
|
|
16
|
+
owner?: VM;
|
|
14
17
|
}
|
|
15
18
|
export declare const enum VMState {
|
|
16
19
|
created = 0,
|
|
@@ -91,7 +94,8 @@ export interface VM<N = HostNode, E = HostElement> {
|
|
|
91
94
|
cmpProps: {
|
|
92
95
|
[name: string]: any;
|
|
93
96
|
};
|
|
94
|
-
/**
|
|
97
|
+
/** Contains information about the mapping between the slot names and the slotted VNodes, and
|
|
98
|
+
* the owner of the slot content. */
|
|
95
99
|
cmpSlots: SlotSet;
|
|
96
100
|
/** The component internal reactive properties. */
|
|
97
101
|
cmpFields: {
|
|
@@ -7,9 +7,10 @@ export declare const enum VNodeType {
|
|
|
7
7
|
Element = 2,
|
|
8
8
|
CustomElement = 3,
|
|
9
9
|
Static = 4,
|
|
10
|
-
Fragment = 5
|
|
10
|
+
Fragment = 5,
|
|
11
|
+
ScopedSlotFragment = 6
|
|
11
12
|
}
|
|
12
|
-
export declare type VNode = VText | VComment | VElement | VCustomElement | VStatic | VFragment;
|
|
13
|
+
export declare type VNode = VText | VComment | VElement | VCustomElement | VStatic | VFragment | VScopedSlotFragment;
|
|
13
14
|
export declare type VParentElement = VElement | VCustomElement | VFragment;
|
|
14
15
|
export declare type VNodes = Readonly<Array<VNode | null>>;
|
|
15
16
|
export interface BaseVParent {
|
|
@@ -22,6 +23,11 @@ export interface BaseVNode {
|
|
|
22
23
|
key: Key | undefined;
|
|
23
24
|
owner: VM;
|
|
24
25
|
}
|
|
26
|
+
export interface VScopedSlotFragment extends BaseVNode {
|
|
27
|
+
factory: (value: any) => VNodes;
|
|
28
|
+
type: VNodeType.ScopedSlotFragment;
|
|
29
|
+
slotName: string;
|
|
30
|
+
}
|
|
25
31
|
export interface VStatic extends BaseVNode {
|
|
26
32
|
type: VNodeType.Static;
|
|
27
33
|
sel: undefined;
|
|
@@ -77,7 +83,9 @@ export interface VNodeData {
|
|
|
77
83
|
export interface VElementData extends VNodeData {
|
|
78
84
|
readonly key: Key;
|
|
79
85
|
readonly ref?: string;
|
|
86
|
+
readonly slotData?: any;
|
|
80
87
|
}
|
|
81
88
|
export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
|
|
82
89
|
export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
|
|
83
90
|
export declare function isVCustomElement(vnode: VBaseElement): vnode is VCustomElement;
|
|
91
|
+
export declare function isVScopedSlotFragment(vnode: VNode): vnode is VScopedSlotFragment;
|