@lwc/engine-core 2.45.1 → 2.45.3
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/framework/attributes.d.ts +1 -0
- package/{types → dist}/framework/wiring/types.d.ts +3 -1
- package/dist/{engine-core.cjs.js → index.cjs.js} +77 -46
- package/dist/index.cjs.js.map +1 -0
- package/dist/{engine-core.js → index.js} +76 -47
- package/dist/index.js.map +1 -0
- package/package.json +27 -22
- package/dist/engine-core.cjs.js.map +0 -1
- package/dist/engine-core.js.map +0 -1
- package/types/framework/attributes.d.ts +0 -4
- /package/{types → dist}/framework/api.d.ts +0 -0
- /package/{types → dist}/framework/base-bridge-element.d.ts +0 -0
- /package/{types → dist}/framework/base-lightning-element.d.ts +0 -0
- /package/{types → dist}/framework/check-version-mismatch.d.ts +0 -0
- /package/{types → dist}/framework/component.d.ts +0 -0
- /package/{types → dist}/framework/decorators/api.d.ts +0 -0
- /package/{types → dist}/framework/decorators/register.d.ts +0 -0
- /package/{types → dist}/framework/decorators/track.d.ts +0 -0
- /package/{types → dist}/framework/decorators/wire.d.ts +0 -0
- /package/{types → dist}/framework/def.d.ts +0 -0
- /package/{types → dist}/framework/freeze-template.d.ts +0 -0
- /package/{types → dist}/framework/get-component-constructor.d.ts +0 -0
- /package/{types → dist}/framework/hot-swaps.d.ts +0 -0
- /package/{types → dist}/framework/html-element.d.ts +0 -0
- /package/{types → dist}/framework/html-properties.d.ts +0 -0
- /package/{types → dist}/framework/hydration.d.ts +0 -0
- /package/{types → dist}/framework/invoker.d.ts +0 -0
- /package/{types → dist}/framework/main.d.ts +0 -0
- /package/{types → dist}/framework/membrane.d.ts +0 -0
- /package/{types → dist}/framework/modules/attr-unless-prop.d.ts +0 -0
- /package/{types → dist}/framework/modules/attrs.d.ts +0 -0
- /package/{types → dist}/framework/modules/computed-class-attr.d.ts +0 -0
- /package/{types → dist}/framework/modules/computed-style-attr.d.ts +0 -0
- /package/{types → dist}/framework/modules/events.d.ts +0 -0
- /package/{types → dist}/framework/modules/props.d.ts +0 -0
- /package/{types → dist}/framework/modules/static-class-attr.d.ts +0 -0
- /package/{types → dist}/framework/modules/static-style-attr.d.ts +0 -0
- /package/{types → dist}/framework/mutation-tracker.d.ts +0 -0
- /package/{types → dist}/framework/observed-fields.d.ts +0 -0
- /package/{types → dist}/framework/overridable-hooks.d.ts +0 -0
- /package/{types → dist}/framework/profiler.d.ts +0 -0
- /package/{types → dist}/framework/readonly.d.ts +0 -0
- /package/{types → dist}/framework/renderer.d.ts +0 -0
- /package/{types → dist}/framework/rendering.d.ts +0 -0
- /package/{types → dist}/framework/reporting.d.ts +0 -0
- /package/{types → dist}/framework/restrictions.d.ts +0 -0
- /package/{types → dist}/framework/secure-template.d.ts +0 -0
- /package/{types → dist}/framework/services.d.ts +0 -0
- /package/{types → dist}/framework/stylesheet.d.ts +0 -0
- /package/{types → dist}/framework/template.d.ts +0 -0
- /package/{types → dist}/framework/update-component-value.d.ts +0 -0
- /package/{types → dist}/framework/utils.d.ts +0 -0
- /package/{types → dist}/framework/vm.d.ts +0 -0
- /package/{types → dist}/framework/vnodes.d.ts +0 -0
- /package/{types → dist}/framework/weak-multimap.d.ts +0 -0
- /package/{types → dist}/framework/wiring/context.d.ts +0 -0
- /package/{types → dist}/framework/wiring/index.d.ts +0 -0
- /package/{types → dist}/framework/wiring/wiring.d.ts +0 -0
- /package/{types → dist}/index.d.ts +0 -0
- /package/{types → dist}/libs/mutation-tracker/index.d.ts +0 -0
- /package/{types → dist}/patches/detect-non-standard-aria.d.ts +0 -0
- /package/{types → dist}/patches/detect-synthetic-cross-root-aria.d.ts +0 -0
- /package/{types → dist}/shared/circular-module-dependencies.d.ts +0 -0
- /package/{types → dist}/shared/error.d.ts +0 -0
- /package/{types → dist}/shared/format.d.ts +0 -0
- /package/{types → dist}/shared/logger.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultDefHTMLPropertyNames: string[];
|
|
@@ -10,7 +10,9 @@ export interface WireAdapter {
|
|
|
10
10
|
disconnect(): void;
|
|
11
11
|
}
|
|
12
12
|
export interface WireAdapterConstructor {
|
|
13
|
-
new (callback: DataCallback
|
|
13
|
+
new (callback: DataCallback, sourceContext?: {
|
|
14
|
+
tagName: string;
|
|
15
|
+
}): WireAdapter;
|
|
14
16
|
configSchema?: Record<string, WireAdapterSchemaValue>;
|
|
15
17
|
contextSchema?: Record<string, WireAdapterSchemaValue>;
|
|
16
18
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
3
|
+
*/
|
|
2
4
|
'use strict';
|
|
3
5
|
|
|
6
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
|
+
|
|
4
8
|
var shared = require('@lwc/shared');
|
|
5
9
|
var ariaReflection = require('@lwc/aria-reflection');
|
|
6
10
|
var features = require('@lwc/features');
|
|
@@ -446,19 +450,6 @@ const defaultDefHTMLPropertyNames = [
|
|
|
446
450
|
'tabIndex',
|
|
447
451
|
'title',
|
|
448
452
|
];
|
|
449
|
-
let controlledElement = null;
|
|
450
|
-
let controlledAttributeName;
|
|
451
|
-
function isAttributeLocked(elm, attrName) {
|
|
452
|
-
return elm !== controlledElement || attrName !== controlledAttributeName;
|
|
453
|
-
}
|
|
454
|
-
function lockAttribute(_elm, _key) {
|
|
455
|
-
controlledElement = null;
|
|
456
|
-
controlledAttributeName = undefined;
|
|
457
|
-
}
|
|
458
|
-
function unlockAttribute(elm, key) {
|
|
459
|
-
controlledElement = elm;
|
|
460
|
-
controlledAttributeName = key;
|
|
461
|
-
}
|
|
462
453
|
|
|
463
454
|
/*
|
|
464
455
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -497,6 +488,7 @@ shared.forEach.call(defaultDefHTMLPropertyNames, (propName) => {
|
|
|
497
488
|
* SPDX-License-Identifier: MIT
|
|
498
489
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
499
490
|
*/
|
|
491
|
+
/* eslint @lwc/lwc-internal/no-production-assert: "off" */
|
|
500
492
|
function generateDataDescriptor(options) {
|
|
501
493
|
return shared.assign({
|
|
502
494
|
configurable: true,
|
|
@@ -1326,6 +1318,14 @@ function markLockerLiveObject(obj) {
|
|
|
1326
1318
|
* SPDX-License-Identifier: MIT
|
|
1327
1319
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1328
1320
|
*/
|
|
1321
|
+
/**
|
|
1322
|
+
* This module is responsible for producing the ComponentDef object that is always
|
|
1323
|
+
* accessible via `vm.def`. This is lazily created during the creation of the first
|
|
1324
|
+
* instance of a component class, and shared across all instances.
|
|
1325
|
+
*
|
|
1326
|
+
* This structure can be used to synthetically create proxies, and understand the
|
|
1327
|
+
* shape of a component. It is also used internally to apply extra optimizations.
|
|
1328
|
+
*/
|
|
1329
1329
|
/**
|
|
1330
1330
|
* This operation is called with a descriptor of an standard html property
|
|
1331
1331
|
* that a Custom Element can support (including AOM properties), which
|
|
@@ -1489,15 +1489,11 @@ LightningElement.prototype = {
|
|
|
1489
1489
|
removeAttribute(name) {
|
|
1490
1490
|
const vm = getAssociatedVM(this);
|
|
1491
1491
|
const { elm, renderer: { removeAttribute }, } = vm;
|
|
1492
|
-
unlockAttribute(elm, name);
|
|
1493
1492
|
removeAttribute(elm, name);
|
|
1494
|
-
lockAttribute();
|
|
1495
1493
|
},
|
|
1496
1494
|
removeAttributeNS(namespace, name) {
|
|
1497
1495
|
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
1498
|
-
unlockAttribute(elm, name);
|
|
1499
1496
|
removeAttribute(elm, name, namespace);
|
|
1500
|
-
lockAttribute();
|
|
1501
1497
|
},
|
|
1502
1498
|
getAttribute(name) {
|
|
1503
1499
|
const vm = getAssociatedVM(this);
|
|
@@ -1519,9 +1515,7 @@ LightningElement.prototype = {
|
|
|
1519
1515
|
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1520
1516
|
}
|
|
1521
1517
|
}
|
|
1522
|
-
unlockAttribute(elm, name);
|
|
1523
1518
|
setAttribute(elm, name, value);
|
|
1524
|
-
lockAttribute();
|
|
1525
1519
|
},
|
|
1526
1520
|
setAttributeNS(namespace, name, value) {
|
|
1527
1521
|
const vm = getAssociatedVM(this);
|
|
@@ -1531,9 +1525,7 @@ LightningElement.prototype = {
|
|
|
1531
1525
|
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1532
1526
|
}
|
|
1533
1527
|
}
|
|
1534
|
-
unlockAttribute(elm, name);
|
|
1535
1528
|
setAttribute(elm, name, value, namespace);
|
|
1536
|
-
lockAttribute();
|
|
1537
1529
|
},
|
|
1538
1530
|
getBoundingClientRect() {
|
|
1539
1531
|
const vm = getAssociatedVM(this);
|
|
@@ -1915,7 +1907,7 @@ function createConnector(vm, name, wireDef) {
|
|
|
1915
1907
|
});
|
|
1916
1908
|
runWithBoundaryProtection(vm, vm, shared.noop, () => {
|
|
1917
1909
|
// job
|
|
1918
|
-
connector = new adapter(dataCallback);
|
|
1910
|
+
connector = new adapter(dataCallback, { tagName: vm.tagName });
|
|
1919
1911
|
}, shared.noop);
|
|
1920
1912
|
const updateConnectorConfig = (config) => {
|
|
1921
1913
|
// every time the config is recomputed due to tracking,
|
|
@@ -2483,6 +2475,10 @@ function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
|
|
2483
2475
|
* SPDX-License-Identifier: MIT
|
|
2484
2476
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2485
2477
|
*/
|
|
2478
|
+
/**
|
|
2479
|
+
* This module is responsible for creating the base bridge class BaseBridgeElement
|
|
2480
|
+
* that represents the HTMLElement extension used for any LWC inserted in the DOM.
|
|
2481
|
+
*/
|
|
2486
2482
|
// A bridge descriptor is a descriptor whose job is just to get the component instance
|
|
2487
2483
|
// from the element instance, and get the value or set a new value on the component.
|
|
2488
2484
|
// This means that across different elements, similar names can get the exact same
|
|
@@ -2536,14 +2532,6 @@ function createAttributeChangedCallback(attributeToPropMap, superAttributeChange
|
|
|
2536
2532
|
}
|
|
2537
2533
|
return;
|
|
2538
2534
|
}
|
|
2539
|
-
if (!isAttributeLocked(this, attrName)) {
|
|
2540
|
-
// Ignore changes triggered by the engine itself during:
|
|
2541
|
-
// * diffing when public props are attempting to reflect to the DOM
|
|
2542
|
-
// * component via `this.setAttribute()`, should never update the prop
|
|
2543
|
-
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
2544
|
-
// attribute to be changed
|
|
2545
|
-
return;
|
|
2546
|
-
}
|
|
2547
2535
|
// Reflect attribute change to the corresponding property when changed from outside.
|
|
2548
2536
|
this[propName] = newValue;
|
|
2549
2537
|
};
|
|
@@ -2888,6 +2876,14 @@ function swapStyle(oldStyle, newStyle) {
|
|
|
2888
2876
|
* SPDX-License-Identifier: MIT
|
|
2889
2877
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2890
2878
|
*/
|
|
2879
|
+
/**
|
|
2880
|
+
* This module is responsible for producing the ComponentDef object that is always
|
|
2881
|
+
* accessible via `vm.def`. This is lazily created during the creation of the first
|
|
2882
|
+
* instance of a component class, and shared across all instances.
|
|
2883
|
+
*
|
|
2884
|
+
* This structure can be used to synthetically create proxies, and understand the
|
|
2885
|
+
* shape of a component. It is also used internally to apply extra optimizations.
|
|
2886
|
+
*/
|
|
2891
2887
|
const CtorToDefMap = new WeakMap();
|
|
2892
2888
|
function getCtorProto(Ctor) {
|
|
2893
2889
|
let proto = shared.getPrototypeOf(Ctor);
|
|
@@ -3329,7 +3325,6 @@ function patchAttributes(oldVnode, vnode, renderer) {
|
|
|
3329
3325
|
const cur = attrs[key];
|
|
3330
3326
|
const old = oldAttrs[key];
|
|
3331
3327
|
if (old !== cur) {
|
|
3332
|
-
unlockAttribute(elm, key);
|
|
3333
3328
|
if (shared.StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
|
|
3334
3329
|
// Assume xml namespace
|
|
3335
3330
|
setAttribute(elm, key, cur, shared.XML_NAMESPACE);
|
|
@@ -3344,7 +3339,6 @@ function patchAttributes(oldVnode, vnode, renderer) {
|
|
|
3344
3339
|
else {
|
|
3345
3340
|
setAttribute(elm, key, cur);
|
|
3346
3341
|
}
|
|
3347
|
-
lockAttribute();
|
|
3348
3342
|
}
|
|
3349
3343
|
}
|
|
3350
3344
|
}
|
|
@@ -6240,6 +6234,27 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
|
|
|
6240
6234
|
}
|
|
6241
6235
|
return false;
|
|
6242
6236
|
}
|
|
6237
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6238
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6239
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6240
|
+
function getValidationPredicate(optOutStaticProp) {
|
|
6241
|
+
if (shared.isUndefined(optOutStaticProp)) {
|
|
6242
|
+
return (_attrName) => true;
|
|
6243
|
+
}
|
|
6244
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6245
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6246
|
+
if (shared.isTrue(optOutStaticProp)) {
|
|
6247
|
+
return (_attrName) => false;
|
|
6248
|
+
}
|
|
6249
|
+
// If validationOptOut is an array of strings, attributes specified in the
|
|
6250
|
+
// array will be "opted out". Attributes not specified in the array will still
|
|
6251
|
+
// be validated.
|
|
6252
|
+
if (shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString)) {
|
|
6253
|
+
return (attrName) => !shared.ArrayIncludes.call(optOutStaticProp, attrName);
|
|
6254
|
+
}
|
|
6255
|
+
logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
|
|
6256
|
+
return (_attrName) => true;
|
|
6257
|
+
}
|
|
6243
6258
|
function hydrateText(node, vnode, renderer) {
|
|
6244
6259
|
var _a;
|
|
6245
6260
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -6318,8 +6333,19 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6318
6333
|
return elm;
|
|
6319
6334
|
}
|
|
6320
6335
|
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6336
|
+
const { validationOptOut } = vnode.ctor;
|
|
6337
|
+
const shouldValidateAttr = getValidationPredicate(validationOptOut);
|
|
6338
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6339
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6340
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6341
|
+
//
|
|
6342
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6343
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6344
|
+
//
|
|
6345
|
+
// Therefore, if validationOptOut is falsey or an array of strings, we need to
|
|
6346
|
+
// examine some or all of the custom element's attributes.
|
|
6321
6347
|
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
|
|
6322
|
-
!isMatchingElement(vnode, elm, renderer)) {
|
|
6348
|
+
!isMatchingElement(vnode, elm, renderer, shouldValidateAttr)) {
|
|
6323
6349
|
return handleMismatch(elm, vnode, renderer);
|
|
6324
6350
|
}
|
|
6325
6351
|
const { sel, mode, ctor, owner } = vnode;
|
|
@@ -6350,14 +6376,12 @@ function hydrateCustomElement(elm, vnode, renderer) {
|
|
|
6350
6376
|
function hydrateChildren(node, children, parentNode, owner) {
|
|
6351
6377
|
let hasWarned = false;
|
|
6352
6378
|
let nextNode = node;
|
|
6353
|
-
let anchor = null;
|
|
6354
6379
|
const { renderer } = owner;
|
|
6355
6380
|
for (let i = 0; i < children.length; i++) {
|
|
6356
6381
|
const childVnode = children[i];
|
|
6357
6382
|
if (!shared.isNull(childVnode)) {
|
|
6358
6383
|
if (nextNode) {
|
|
6359
6384
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6360
|
-
anchor = childVnode.elm;
|
|
6361
6385
|
}
|
|
6362
6386
|
else {
|
|
6363
6387
|
hasMismatch = true;
|
|
@@ -6367,8 +6391,8 @@ function hydrateChildren(node, children, parentNode, owner) {
|
|
|
6367
6391
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6368
6392
|
}
|
|
6369
6393
|
}
|
|
6370
|
-
mount(childVnode, parentNode, renderer,
|
|
6371
|
-
|
|
6394
|
+
mount(childVnode, parentNode, renderer, nextNode);
|
|
6395
|
+
nextNode = renderer.nextSibling(childVnode.elm);
|
|
6372
6396
|
}
|
|
6373
6397
|
}
|
|
6374
6398
|
}
|
|
@@ -6413,7 +6437,7 @@ function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
|
6413
6437
|
}
|
|
6414
6438
|
return true;
|
|
6415
6439
|
}
|
|
6416
|
-
function isMatchingElement(vnode, elm, renderer) {
|
|
6440
|
+
function isMatchingElement(vnode, elm, renderer, shouldValidateAttr = () => true) {
|
|
6417
6441
|
const { getProperty } = renderer;
|
|
6418
6442
|
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6419
6443
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6421,10 +6445,14 @@ function isMatchingElement(vnode, elm, renderer) {
|
|
|
6421
6445
|
}
|
|
6422
6446
|
return false;
|
|
6423
6447
|
}
|
|
6424
|
-
const
|
|
6425
|
-
const
|
|
6426
|
-
|
|
6427
|
-
|
|
6448
|
+
const hasCompatibleAttrs = validateAttrs(vnode, elm, renderer, shouldValidateAttr);
|
|
6449
|
+
const hasCompatibleClass = shouldValidateAttr('class')
|
|
6450
|
+
? validateClassAttr(vnode, elm, renderer)
|
|
6451
|
+
: true;
|
|
6452
|
+
const hasCompatibleStyle = shouldValidateAttr('style')
|
|
6453
|
+
? validateStyleAttr(vnode, elm, renderer)
|
|
6454
|
+
: true;
|
|
6455
|
+
return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
|
|
6428
6456
|
}
|
|
6429
6457
|
function attributeValuesAreEqual(vnodeValue, value) {
|
|
6430
6458
|
const vnodeValueAsString = String(vnodeValue);
|
|
@@ -6439,12 +6467,15 @@ function attributeValuesAreEqual(vnodeValue, value) {
|
|
|
6439
6467
|
// In all other cases, the two values are not considered equal
|
|
6440
6468
|
return false;
|
|
6441
6469
|
}
|
|
6442
|
-
function validateAttrs(vnode, elm, renderer) {
|
|
6470
|
+
function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
|
|
6443
6471
|
const { data: { attrs = {} }, } = vnode;
|
|
6444
6472
|
let nodesAreCompatible = true;
|
|
6445
6473
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6446
6474
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6447
6475
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6476
|
+
if (!shouldValidateAttr(attrName)) {
|
|
6477
|
+
continue;
|
|
6478
|
+
}
|
|
6448
6479
|
const { owner } = vnode;
|
|
6449
6480
|
const { getAttribute } = renderer;
|
|
6450
6481
|
const elmAttrValue = getAttribute(elm, attrName);
|
|
@@ -6907,5 +6938,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
6907
6938
|
exports.track = track;
|
|
6908
6939
|
exports.unwrap = unwrap;
|
|
6909
6940
|
exports.wire = wire;
|
|
6910
|
-
|
|
6911
|
-
//# sourceMappingURL=
|
|
6941
|
+
/** version: 2.45.3 */
|
|
6942
|
+
//# sourceMappingURL=index.cjs.js.map
|