@lwc/engine-core 2.30.2 → 2.31.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.
@@ -3158,7 +3158,7 @@ function isVScopedSlotFragment(vnode) {
3158
3158
  * SPDX-License-Identifier: MIT
3159
3159
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3160
3160
  */
3161
- const ColonCharCode = 58;
3161
+ const ColonCharCode$1 = 58;
3162
3162
  function patchAttributes(oldVnode, vnode, renderer) {
3163
3163
  const { attrs } = vnode.data;
3164
3164
  if (shared.isUndefined(attrs)) {
@@ -3175,11 +3175,11 @@ function patchAttributes(oldVnode, vnode, renderer) {
3175
3175
  const old = oldAttrs[key];
3176
3176
  if (old !== cur) {
3177
3177
  unlockAttribute(elm, key);
3178
- if (shared.StringCharCodeAt.call(key, 3) === ColonCharCode) {
3178
+ if (shared.StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
3179
3179
  // Assume xml namespace
3180
3180
  setAttribute(elm, key, cur, shared.XML_NAMESPACE);
3181
3181
  }
3182
- else if (shared.StringCharCodeAt.call(key, 5) === ColonCharCode) {
3182
+ else if (shared.StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
3183
3183
  // Assume xlink namespace
3184
3184
  setAttribute(elm, key, cur, shared.XLINK_NAMESPACE);
3185
3185
  }
@@ -3194,6 +3194,46 @@ function patchAttributes(oldVnode, vnode, renderer) {
3194
3194
  }
3195
3195
  }
3196
3196
 
3197
+ /*
3198
+ * Copyright (c) 2018, salesforce.com, inc.
3199
+ * All rights reserved.
3200
+ * SPDX-License-Identifier: MIT
3201
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3202
+ */
3203
+ const ColonCharCode = 58;
3204
+ function patchAttrUnlessProp(oldVnode, vnode, renderer) {
3205
+ const { data: { attrs }, elm, } = vnode;
3206
+ if (shared.isUndefined(attrs)) {
3207
+ return;
3208
+ }
3209
+ const { removeAttribute, setAttribute, setProperty } = renderer;
3210
+ const oldAttrs = shared.isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3211
+ for (const name in attrs) {
3212
+ const cur = attrs[name];
3213
+ const old = oldAttrs[name];
3214
+ if (old !== cur) {
3215
+ const propName = shared.htmlAttributeToProperty(name);
3216
+ if (propName in elm) {
3217
+ setProperty(elm, name, cur);
3218
+ }
3219
+ else if (shared.StringCharCodeAt.call(name, 3) === ColonCharCode) {
3220
+ // Assume xml namespace
3221
+ setAttribute(elm, name, cur, shared.XML_NAMESPACE);
3222
+ }
3223
+ else if (shared.StringCharCodeAt.call(name, 5) === ColonCharCode) {
3224
+ // Assume xlink namespace
3225
+ setAttribute(elm, name, cur, shared.XLINK_NAMESPACE);
3226
+ }
3227
+ else if (shared.isNull(cur) || shared.isUndefined(cur)) {
3228
+ removeAttribute(elm, name);
3229
+ }
3230
+ else {
3231
+ setAttribute(elm, name, cur);
3232
+ }
3233
+ }
3234
+ }
3235
+ }
3236
+
3197
3237
  /*
3198
3238
  * Copyright (c) 2018, salesforce.com, inc.
3199
3239
  * All rights reserved.
@@ -3794,7 +3834,11 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3794
3834
  // value is set before type=radio.
3795
3835
  patchClassAttribute(oldVnode, vnode, renderer);
3796
3836
  patchStyleAttribute(oldVnode, vnode, renderer);
3797
- patchAttributes(oldVnode, vnode, renderer);
3837
+ if (vnode.data.external) {
3838
+ patchAttrUnlessProp(oldVnode, vnode, renderer);
3839
+ } else {
3840
+ patchAttributes(oldVnode, vnode, renderer);
3841
+ }
3798
3842
  patchProps(oldVnode, vnode, renderer);
3799
3843
  }
3800
3844
  function applyStyleScoping(elm, owner, renderer) {
@@ -4227,8 +4271,11 @@ function s(slotName, data, children, slotset) {
4227
4271
  !shared.isUndefined(slotset.slotAssignments) &&
4228
4272
  !shared.isUndefined(slotset.slotAssignments[slotName]) &&
4229
4273
  slotset.slotAssignments[slotName].length !== 0) {
4230
- children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4231
- if (vnode) {
4274
+ const newChildren = [];
4275
+ const slotAssignments = slotset.slotAssignments[slotName];
4276
+ for (let i = 0; i < slotAssignments.length; i++) {
4277
+ const vnode = slotAssignments[i];
4278
+ if (!shared.isNull(vnode)) {
4232
4279
  const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4233
4280
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
4234
4281
  const isScopedSlotElement = !shared.isUndefined(data.slotData);
@@ -4238,32 +4285,30 @@ function s(slotName, data, children, slotset) {
4238
4285
  logError(`Mismatched slot types for ${slotName === '' ? '(default)' : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
4239
4286
  }
4240
4287
  // Ignore slot content from parent
4241
- return accumulator;
4288
+ continue;
4242
4289
  }
4243
4290
  // If the passed slot content is factory, evaluate it and add the produced vnodes
4244
4291
  if (assignedNodeIsScopedSlot) {
4245
4292
  const vmBeingRenderedInception = getVMBeingRendered();
4246
- let scopedSlotChildren = [];
4247
4293
  // Evaluate in the scope of the slot content's owner
4248
4294
  // if a slotset is provided, there will always be an owner. The only case where owner is
4249
4295
  // undefined is for root components, but root components cannot accept slotted content
4250
4296
  setVMBeingRendered(slotset.owner);
4251
4297
  try {
4252
- scopedSlotChildren = vnode.factory(data.slotData);
4298
+ shared.ArrayPush.apply(newChildren, vnode.factory(data.slotData));
4253
4299
  }
4254
4300
  finally {
4255
4301
  setVMBeingRendered(vmBeingRenderedInception);
4256
4302
  }
4257
- return shared.ArrayConcat.call(accumulator, scopedSlotChildren);
4258
4303
  }
4259
4304
  else {
4260
4305
  // If the slot content is standard type, the content is static, no additional
4261
4306
  // processing needed on the vnode
4262
- return shared.ArrayConcat.call(accumulator, vnode);
4307
+ shared.ArrayPush.call(newChildren, vnode);
4263
4308
  }
4264
4309
  }
4265
- return accumulator;
4266
- }, []);
4310
+ }
4311
+ children = newChildren;
4267
4312
  }
4268
4313
  const vmBeingRendered = getVMBeingRendered();
4269
4314
  const { renderMode, shadowMode } = vmBeingRendered;
@@ -6525,4 +6570,4 @@ exports.swapTemplate = swapTemplate;
6525
6570
  exports.track = track;
6526
6571
  exports.unwrap = unwrap;
6527
6572
  exports.wire = wire;
6528
- /* version: 2.30.2 */
6573
+ /* version: 2.31.0 */
@@ -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, ArraySome, ArrayConcat as ArrayConcat$1, 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, htmlAttributeToProperty, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, 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.
@@ -3157,7 +3157,7 @@ function isVScopedSlotFragment(vnode) {
3157
3157
  * SPDX-License-Identifier: MIT
3158
3158
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3159
3159
  */
3160
- const ColonCharCode = 58;
3160
+ const ColonCharCode$1 = 58;
3161
3161
  function patchAttributes(oldVnode, vnode, renderer) {
3162
3162
  const { attrs } = vnode.data;
3163
3163
  if (isUndefined$1(attrs)) {
@@ -3174,11 +3174,11 @@ function patchAttributes(oldVnode, vnode, renderer) {
3174
3174
  const old = oldAttrs[key];
3175
3175
  if (old !== cur) {
3176
3176
  unlockAttribute(elm, key);
3177
- if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
3177
+ if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
3178
3178
  // Assume xml namespace
3179
3179
  setAttribute(elm, key, cur, XML_NAMESPACE);
3180
3180
  }
3181
- else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
3181
+ else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
3182
3182
  // Assume xlink namespace
3183
3183
  setAttribute(elm, key, cur, XLINK_NAMESPACE);
3184
3184
  }
@@ -3193,6 +3193,46 @@ function patchAttributes(oldVnode, vnode, renderer) {
3193
3193
  }
3194
3194
  }
3195
3195
 
3196
+ /*
3197
+ * Copyright (c) 2018, salesforce.com, inc.
3198
+ * All rights reserved.
3199
+ * SPDX-License-Identifier: MIT
3200
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3201
+ */
3202
+ const ColonCharCode = 58;
3203
+ function patchAttrUnlessProp(oldVnode, vnode, renderer) {
3204
+ const { data: { attrs }, elm, } = vnode;
3205
+ if (isUndefined$1(attrs)) {
3206
+ return;
3207
+ }
3208
+ const { removeAttribute, setAttribute, setProperty } = renderer;
3209
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3210
+ for (const name in attrs) {
3211
+ const cur = attrs[name];
3212
+ const old = oldAttrs[name];
3213
+ if (old !== cur) {
3214
+ const propName = htmlAttributeToProperty(name);
3215
+ if (propName in elm) {
3216
+ setProperty(elm, name, cur);
3217
+ }
3218
+ else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
3219
+ // Assume xml namespace
3220
+ setAttribute(elm, name, cur, XML_NAMESPACE);
3221
+ }
3222
+ else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
3223
+ // Assume xlink namespace
3224
+ setAttribute(elm, name, cur, XLINK_NAMESPACE);
3225
+ }
3226
+ else if (isNull(cur) || isUndefined$1(cur)) {
3227
+ removeAttribute(elm, name);
3228
+ }
3229
+ else {
3230
+ setAttribute(elm, name, cur);
3231
+ }
3232
+ }
3233
+ }
3234
+ }
3235
+
3196
3236
  /*
3197
3237
  * Copyright (c) 2018, salesforce.com, inc.
3198
3238
  * All rights reserved.
@@ -3793,7 +3833,11 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3793
3833
  // value is set before type=radio.
3794
3834
  patchClassAttribute(oldVnode, vnode, renderer);
3795
3835
  patchStyleAttribute(oldVnode, vnode, renderer);
3796
- patchAttributes(oldVnode, vnode, renderer);
3836
+ if (vnode.data.external) {
3837
+ patchAttrUnlessProp(oldVnode, vnode, renderer);
3838
+ } else {
3839
+ patchAttributes(oldVnode, vnode, renderer);
3840
+ }
3797
3841
  patchProps(oldVnode, vnode, renderer);
3798
3842
  }
3799
3843
  function applyStyleScoping(elm, owner, renderer) {
@@ -4226,8 +4270,11 @@ function s(slotName, data, children, slotset) {
4226
4270
  !isUndefined$1(slotset.slotAssignments) &&
4227
4271
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
4228
4272
  slotset.slotAssignments[slotName].length !== 0) {
4229
- children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
4230
- if (vnode) {
4273
+ const newChildren = [];
4274
+ const slotAssignments = slotset.slotAssignments[slotName];
4275
+ for (let i = 0; i < slotAssignments.length; i++) {
4276
+ const vnode = slotAssignments[i];
4277
+ if (!isNull(vnode)) {
4231
4278
  const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
4232
4279
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
4233
4280
  const isScopedSlotElement = !isUndefined$1(data.slotData);
@@ -4237,32 +4284,30 @@ function s(slotName, data, children, slotset) {
4237
4284
  logError(`Mismatched slot types for ${slotName === '' ? '(default)' : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
4238
4285
  }
4239
4286
  // Ignore slot content from parent
4240
- return accumulator;
4287
+ continue;
4241
4288
  }
4242
4289
  // If the passed slot content is factory, evaluate it and add the produced vnodes
4243
4290
  if (assignedNodeIsScopedSlot) {
4244
4291
  const vmBeingRenderedInception = getVMBeingRendered();
4245
- let scopedSlotChildren = [];
4246
4292
  // Evaluate in the scope of the slot content's owner
4247
4293
  // if a slotset is provided, there will always be an owner. The only case where owner is
4248
4294
  // undefined is for root components, but root components cannot accept slotted content
4249
4295
  setVMBeingRendered(slotset.owner);
4250
4296
  try {
4251
- scopedSlotChildren = vnode.factory(data.slotData);
4297
+ ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
4252
4298
  }
4253
4299
  finally {
4254
4300
  setVMBeingRendered(vmBeingRenderedInception);
4255
4301
  }
4256
- return ArrayConcat$1.call(accumulator, scopedSlotChildren);
4257
4302
  }
4258
4303
  else {
4259
4304
  // If the slot content is standard type, the content is static, no additional
4260
4305
  // processing needed on the vnode
4261
- return ArrayConcat$1.call(accumulator, vnode);
4306
+ ArrayPush$1.call(newChildren, vnode);
4262
4307
  }
4263
4308
  }
4264
- return accumulator;
4265
- }, []);
4309
+ }
4310
+ children = newChildren;
4266
4311
  }
4267
4312
  const vmBeingRendered = getVMBeingRendered();
4268
4313
  const { renderMode, shadowMode } = vmBeingRendered;
@@ -6488,4 +6533,4 @@ function getComponentConstructor(elm) {
6488
6533
  }
6489
6534
 
6490
6535
  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 };
6491
- /* version: 2.30.2 */
6536
+ /* version: 2.31.0 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.30.2",
3
+ "version": "2.31.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.30.2",
28
- "@lwc/shared": "2.30.2"
27
+ "@lwc/features": "2.31.0",
28
+ "@lwc/shared": "2.31.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"
@@ -0,0 +1,3 @@
1
+ import { RendererAPI } from '../renderer';
2
+ import { VBaseElement } from '../vnodes';
3
+ export declare function patchAttrUnlessProp(oldVnode: VBaseElement | null, vnode: VBaseElement, renderer: RendererAPI): void;
@@ -11,7 +11,6 @@ export declare const enum VNodeType {
11
11
  ScopedSlotFragment = 6
12
12
  }
13
13
  export declare type VNode = VText | VComment | VElement | VCustomElement | VStatic | VFragment | VScopedSlotFragment;
14
- export declare type VParentElement = VElement | VCustomElement | VFragment;
15
14
  export declare type VNodes = Readonly<Array<VNode | null>>;
16
15
  export interface BaseVParent {
17
16
  children: VNodes;
@@ -82,6 +81,7 @@ export interface VNodeData {
82
81
  }
83
82
  export interface VElementData extends VNodeData {
84
83
  readonly key: Key;
84
+ readonly external?: boolean;
85
85
  readonly ref?: string;
86
86
  readonly slotData?: any;
87
87
  }