lwc 2.45.0 → 2.45.2
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-dom/esm/es2017/engine-dom.js +158 -83
- package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom.js +158 -83
- package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +75 -18
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/iife/es5/engine-dom.js +162 -79
- package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +83 -16
- package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom.js +158 -83
- package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +75 -18
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es5/engine-dom.js +162 -79
- package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +83 -16
- package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-server/commonjs/es2017/engine-server.js +102 -75
- package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +102 -75
- package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
- package/package.json +7 -7
|
@@ -43,7 +43,16 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
|
43
43
|
*/
|
|
44
44
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
45
45
|
const { isArray: isArray$1 } = Array;
|
|
46
|
-
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
46
|
+
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
47
|
+
// The type of the return value of Array.prototype.every is `this is T[]`. However, once this
|
|
48
|
+
// Array method is pulled out of the prototype, the function is now referencing `this` where
|
|
49
|
+
// `this` is meaningless, resulting in a TypeScript compilation error.
|
|
50
|
+
//
|
|
51
|
+
// Exposing this helper function is the closest we can get to preserving the usage patterns
|
|
52
|
+
// of Array.prototype methods used elsewhere in the codebase.
|
|
53
|
+
function arrayEvery(arr, predicate) {
|
|
54
|
+
return ArrayEvery.call(arr, predicate);
|
|
55
|
+
}
|
|
47
56
|
const { fromCharCode: StringFromCharCode } = String;
|
|
48
57
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
49
58
|
function isUndefined$1(obj) {
|
|
@@ -329,9 +338,9 @@ function htmlAttributeToProperty(attrName) {
|
|
|
329
338
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
330
339
|
*/
|
|
331
340
|
// Increment whenever the LWC template compiler changes
|
|
332
|
-
const LWC_VERSION = "2.45.
|
|
341
|
+
const LWC_VERSION = "2.45.2";
|
|
333
342
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
334
|
-
/** version: 2.45.
|
|
343
|
+
/** version: 2.45.2 */
|
|
335
344
|
|
|
336
345
|
/**
|
|
337
346
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -409,7 +418,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
409
418
|
setFeatureFlag(name, value);
|
|
410
419
|
}
|
|
411
420
|
}
|
|
412
|
-
/** version: 2.45.
|
|
421
|
+
/** version: 2.45.2 */
|
|
413
422
|
|
|
414
423
|
/**
|
|
415
424
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -473,7 +482,7 @@ function applyAriaReflection(prototype = Element.prototype) {
|
|
|
473
482
|
}
|
|
474
483
|
}
|
|
475
484
|
}
|
|
476
|
-
/** version: 2.45.
|
|
485
|
+
/** version: 2.45.2 */
|
|
477
486
|
|
|
478
487
|
/*
|
|
479
488
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1000,8 +1009,9 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
1000
1009
|
get() {
|
|
1001
1010
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
1002
1011
|
},
|
|
1003
|
-
set(
|
|
1004
|
-
|
|
1012
|
+
set(value) {
|
|
1013
|
+
logError(`Invalid attempt to set outerHTML on Element.`);
|
|
1014
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
1005
1015
|
},
|
|
1006
1016
|
}),
|
|
1007
1017
|
};
|
|
@@ -1086,16 +1096,18 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
1086
1096
|
get() {
|
|
1087
1097
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
1088
1098
|
},
|
|
1089
|
-
set(
|
|
1090
|
-
|
|
1099
|
+
set(value) {
|
|
1100
|
+
logError(`Invalid attempt to set innerHTML on ShadowRoot.`);
|
|
1101
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
1091
1102
|
},
|
|
1092
1103
|
}),
|
|
1093
1104
|
textContent: generateAccessorDescriptor({
|
|
1094
1105
|
get() {
|
|
1095
1106
|
return originalTextContentDescriptor.get.call(this);
|
|
1096
1107
|
},
|
|
1097
|
-
set(
|
|
1098
|
-
|
|
1108
|
+
set(value) {
|
|
1109
|
+
logError(`Invalid attempt to set textContent on ShadowRoot.`);
|
|
1110
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
1099
1111
|
},
|
|
1100
1112
|
}),
|
|
1101
1113
|
addEventListener: generateDataDescriptor({
|
|
@@ -1124,24 +1136,27 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
1124
1136
|
get() {
|
|
1125
1137
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
1126
1138
|
},
|
|
1127
|
-
set(
|
|
1128
|
-
|
|
1139
|
+
set(value) {
|
|
1140
|
+
logError(`Invalid attempt to set innerHTML on HTMLElement.`);
|
|
1141
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
1129
1142
|
},
|
|
1130
1143
|
}),
|
|
1131
1144
|
outerHTML: generateAccessorDescriptor({
|
|
1132
1145
|
get() {
|
|
1133
1146
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
1134
1147
|
},
|
|
1135
|
-
set(
|
|
1136
|
-
|
|
1148
|
+
set(value) {
|
|
1149
|
+
logError(`Invalid attempt to set outerHTML on HTMLElement.`);
|
|
1150
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
1137
1151
|
},
|
|
1138
1152
|
}),
|
|
1139
1153
|
textContent: generateAccessorDescriptor({
|
|
1140
1154
|
get() {
|
|
1141
1155
|
return originalTextContentDescriptor.get.call(this);
|
|
1142
1156
|
},
|
|
1143
|
-
set(
|
|
1144
|
-
|
|
1157
|
+
set(value) {
|
|
1158
|
+
logError(`Invalid attempt to set textContent on HTMLElement.`);
|
|
1159
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
1145
1160
|
},
|
|
1146
1161
|
}),
|
|
1147
1162
|
addEventListener: generateDataDescriptor({
|
|
@@ -1157,20 +1172,6 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
1157
1172
|
}),
|
|
1158
1173
|
};
|
|
1159
1174
|
}
|
|
1160
|
-
function getComponentRestrictionsDescriptors() {
|
|
1161
|
-
assertNotProd(); // this method should never leak to prod
|
|
1162
|
-
return {
|
|
1163
|
-
tagName: generateAccessorDescriptor({
|
|
1164
|
-
get() {
|
|
1165
|
-
throw new Error(`Usage of property \`tagName\` is disallowed because the component itself does` +
|
|
1166
|
-
` not know which tagName will be used to create the element, therefore writing` +
|
|
1167
|
-
` code that check for that value is error prone.`);
|
|
1168
|
-
},
|
|
1169
|
-
configurable: true,
|
|
1170
|
-
enumerable: false, // no enumerable properties on component
|
|
1171
|
-
}),
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
1175
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1175
1176
|
assertNotProd(); // this method should never leak to prod
|
|
1176
1177
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
@@ -1203,9 +1204,6 @@ function patchCustomElementWithRestrictions(elm) {
|
|
|
1203
1204
|
const elmProto = getPrototypeOf$1(elm);
|
|
1204
1205
|
setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
|
|
1205
1206
|
}
|
|
1206
|
-
function patchComponentWithRestrictions(cmp) {
|
|
1207
|
-
defineProperties(cmp, getComponentRestrictionsDescriptors());
|
|
1208
|
-
}
|
|
1209
1207
|
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
1210
1208
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1211
1209
|
}
|
|
@@ -1816,16 +1814,10 @@ function markLockerLiveObject(obj) {
|
|
|
1816
1814
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
|
1817
1815
|
const { get, set, enumerable, configurable } = descriptor;
|
|
1818
1816
|
if (!isFunction$1(get)) {
|
|
1819
|
-
|
|
1820
|
-
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
1821
|
-
}
|
|
1822
|
-
throw new TypeError();
|
|
1817
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
1823
1818
|
}
|
|
1824
1819
|
if (!isFunction$1(set)) {
|
|
1825
|
-
|
|
1826
|
-
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
1827
|
-
}
|
|
1828
|
-
throw new TypeError();
|
|
1820
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
1829
1821
|
}
|
|
1830
1822
|
return {
|
|
1831
1823
|
enumerable,
|
|
@@ -1845,10 +1837,18 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1845
1837
|
const vm = getAssociatedVM(this);
|
|
1846
1838
|
if (process.env.NODE_ENV !== 'production') {
|
|
1847
1839
|
const vmBeingRendered = getVMBeingRendered();
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1840
|
+
if (isInvokingRender) {
|
|
1841
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
|
|
1842
|
+
}
|
|
1843
|
+
if (isUpdatingTemplate) {
|
|
1844
|
+
logError(`When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
|
|
1845
|
+
}
|
|
1846
|
+
if (isBeingConstructed(vm)) {
|
|
1847
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1848
|
+
}
|
|
1849
|
+
if (isObject(newValue) && !isNull(newValue)) {
|
|
1850
|
+
logError(`Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1851
|
+
}
|
|
1852
1852
|
}
|
|
1853
1853
|
updateComponentValue(vm, propName, newValue);
|
|
1854
1854
|
return set.call(vm.elm, newValue);
|
|
@@ -1901,7 +1901,6 @@ const LightningElement = function () {
|
|
|
1901
1901
|
// Adding extra guard rails in DEV mode.
|
|
1902
1902
|
if (process.env.NODE_ENV !== 'production') {
|
|
1903
1903
|
patchCustomElementWithRestrictions(elm);
|
|
1904
|
-
patchComponentWithRestrictions(component);
|
|
1905
1904
|
}
|
|
1906
1905
|
return this;
|
|
1907
1906
|
};
|
|
@@ -1937,9 +1936,15 @@ LightningElement.prototype = {
|
|
|
1937
1936
|
const { elm, renderer: { addEventListener }, } = vm;
|
|
1938
1937
|
if (process.env.NODE_ENV !== 'production') {
|
|
1939
1938
|
const vmBeingRendered = getVMBeingRendered();
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1939
|
+
if (isInvokingRender) {
|
|
1940
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
1941
|
+
}
|
|
1942
|
+
if (isUpdatingTemplate) {
|
|
1943
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
1944
|
+
}
|
|
1945
|
+
if (!isFunction$1(listener)) {
|
|
1946
|
+
logError(`Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
1947
|
+
}
|
|
1943
1948
|
}
|
|
1944
1949
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1945
1950
|
addEventListener(elm, type, wrappedListener, options);
|
|
@@ -1989,7 +1994,9 @@ LightningElement.prototype = {
|
|
|
1989
1994
|
const vm = getAssociatedVM(this);
|
|
1990
1995
|
const { elm, renderer: { setAttribute }, } = vm;
|
|
1991
1996
|
if (process.env.NODE_ENV !== 'production') {
|
|
1992
|
-
|
|
1997
|
+
if (isBeingConstructed(vm)) {
|
|
1998
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1999
|
+
}
|
|
1993
2000
|
}
|
|
1994
2001
|
unlockAttribute(elm, name);
|
|
1995
2002
|
setAttribute(elm, name, value);
|
|
@@ -1999,7 +2006,9 @@ LightningElement.prototype = {
|
|
|
1999
2006
|
const vm = getAssociatedVM(this);
|
|
2000
2007
|
const { elm, renderer: { setAttribute }, } = vm;
|
|
2001
2008
|
if (process.env.NODE_ENV !== 'production') {
|
|
2002
|
-
|
|
2009
|
+
if (isBeingConstructed(vm)) {
|
|
2010
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2011
|
+
}
|
|
2003
2012
|
}
|
|
2004
2013
|
unlockAttribute(elm, name);
|
|
2005
2014
|
setAttribute(elm, name, value, namespace);
|
|
@@ -2022,9 +2031,9 @@ LightningElement.prototype = {
|
|
|
2022
2031
|
const vm = getAssociatedVM(this);
|
|
2023
2032
|
const { elm, renderer: { getClassList }, } = vm;
|
|
2024
2033
|
if (process.env.NODE_ENV !== 'production') {
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2034
|
+
if (isBeingConstructed(vm)) {
|
|
2035
|
+
logError(`Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
|
|
2036
|
+
}
|
|
2028
2037
|
}
|
|
2029
2038
|
return getClassList(elm);
|
|
2030
2039
|
},
|
|
@@ -2530,8 +2539,12 @@ function createPublicPropertyDescriptor(key) {
|
|
|
2530
2539
|
const vm = getAssociatedVM(this);
|
|
2531
2540
|
if (process.env.NODE_ENV !== 'production') {
|
|
2532
2541
|
const vmBeingRendered = getVMBeingRendered();
|
|
2533
|
-
|
|
2534
|
-
|
|
2542
|
+
if (isInvokingRender) {
|
|
2543
|
+
logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2544
|
+
}
|
|
2545
|
+
if (isUpdatingTemplate) {
|
|
2546
|
+
logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2547
|
+
}
|
|
2535
2548
|
}
|
|
2536
2549
|
vm.cmpProps[key] = newValue;
|
|
2537
2550
|
componentValueMutated(vm, key);
|
|
@@ -2555,14 +2568,18 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2555
2568
|
const vm = getAssociatedVM(this);
|
|
2556
2569
|
if (process.env.NODE_ENV !== 'production') {
|
|
2557
2570
|
const vmBeingRendered = getVMBeingRendered();
|
|
2558
|
-
|
|
2559
|
-
|
|
2571
|
+
if (isInvokingRender) {
|
|
2572
|
+
logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2573
|
+
}
|
|
2574
|
+
if (isUpdatingTemplate) {
|
|
2575
|
+
logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2576
|
+
}
|
|
2560
2577
|
}
|
|
2561
2578
|
if (set) {
|
|
2562
2579
|
set.call(this, newValue);
|
|
2563
2580
|
}
|
|
2564
2581
|
else if (process.env.NODE_ENV !== 'production') {
|
|
2565
|
-
|
|
2582
|
+
logError(`Invalid attempt to set a new value for property "${toString$1(key)}" that does not has a setter decorated with @api.`, vm);
|
|
2566
2583
|
}
|
|
2567
2584
|
},
|
|
2568
2585
|
enumerable,
|
|
@@ -2596,8 +2613,12 @@ function internalTrackDecorator(key) {
|
|
|
2596
2613
|
const vm = getAssociatedVM(this);
|
|
2597
2614
|
if (process.env.NODE_ENV !== 'production') {
|
|
2598
2615
|
const vmBeingRendered = getVMBeingRendered();
|
|
2599
|
-
|
|
2600
|
-
|
|
2616
|
+
if (isInvokingRender) {
|
|
2617
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2618
|
+
}
|
|
2619
|
+
if (isUpdatingTemplate) {
|
|
2620
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2621
|
+
}
|
|
2601
2622
|
}
|
|
2602
2623
|
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2603
2624
|
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
@@ -3374,13 +3395,20 @@ function createComponentDef(Ctor) {
|
|
|
3374
3395
|
const ctorName = Ctor.name;
|
|
3375
3396
|
// Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
3376
3397
|
// assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3398
|
+
if (!Ctor.constructor) {
|
|
3399
|
+
// This error seems impossible to hit, due to an earlier check in `isComponentConstructor()`.
|
|
3400
|
+
// But we keep it here just in case.
|
|
3401
|
+
logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
3402
|
+
}
|
|
3403
|
+
if (!isUndefined$1(ctorShadowSupportMode) &&
|
|
3404
|
+
ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
|
|
3405
|
+
ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */) {
|
|
3406
|
+
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
3381
3407
|
}
|
|
3382
|
-
if (!isUndefined$1(ctorRenderMode)
|
|
3383
|
-
|
|
3408
|
+
if (!isUndefined$1(ctorRenderMode) &&
|
|
3409
|
+
ctorRenderMode !== 'light' &&
|
|
3410
|
+
ctorRenderMode !== 'shadow') {
|
|
3411
|
+
logError(`Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
|
|
3384
3412
|
}
|
|
3385
3413
|
}
|
|
3386
3414
|
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
@@ -5157,7 +5185,7 @@ function k(compilerKey, obj) {
|
|
|
5157
5185
|
return compilerKey + ':' + obj;
|
|
5158
5186
|
case 'object':
|
|
5159
5187
|
if (process.env.NODE_ENV !== 'production') {
|
|
5160
|
-
|
|
5188
|
+
logError(`Invalid key value "${obj}" in ${getVMBeingRendered()}. Key must be a string or number.`);
|
|
5161
5189
|
}
|
|
5162
5190
|
}
|
|
5163
5191
|
}
|
|
@@ -5447,13 +5475,19 @@ function validateSlots(vm) {
|
|
|
5447
5475
|
}
|
|
5448
5476
|
}
|
|
5449
5477
|
function validateLightDomTemplate(template, vm) {
|
|
5450
|
-
|
|
5478
|
+
assertNotProd(); // should never leak to prod mode
|
|
5479
|
+
if (template === defaultEmptyTemplate) {
|
|
5451
5480
|
return;
|
|
5481
|
+
}
|
|
5452
5482
|
if (vm.renderMode === 0 /* RenderMode.Light */) {
|
|
5453
|
-
|
|
5483
|
+
if (template.renderMode !== 'light') {
|
|
5484
|
+
logError(`Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
|
|
5485
|
+
}
|
|
5454
5486
|
}
|
|
5455
5487
|
else {
|
|
5456
|
-
|
|
5488
|
+
if (!isUndefined$1(template.renderMode)) {
|
|
5489
|
+
logError(`Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
|
|
5490
|
+
}
|
|
5457
5491
|
}
|
|
5458
5492
|
}
|
|
5459
5493
|
function buildParseFragmentFn(createFragmentFn) {
|
|
@@ -5586,7 +5620,9 @@ function evaluateTemplate(vm, html) {
|
|
|
5586
5620
|
logOperationEnd(1 /* OperationId.Render */, vm);
|
|
5587
5621
|
});
|
|
5588
5622
|
if (process.env.NODE_ENV !== 'production') {
|
|
5589
|
-
|
|
5623
|
+
if (!isArray$1(vnodes)) {
|
|
5624
|
+
logError(`Compiler should produce html functions that always return an array.`);
|
|
5625
|
+
}
|
|
5590
5626
|
}
|
|
5591
5627
|
return vnodes;
|
|
5592
5628
|
}
|
|
@@ -6675,6 +6711,27 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
|
|
|
6675
6711
|
}
|
|
6676
6712
|
return false;
|
|
6677
6713
|
}
|
|
6714
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6715
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6716
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6717
|
+
function getValidationPredicate(optOutStaticProp) {
|
|
6718
|
+
if (isUndefined$1(optOutStaticProp)) {
|
|
6719
|
+
return (_attrName) => true;
|
|
6720
|
+
}
|
|
6721
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6722
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6723
|
+
if (isTrue(optOutStaticProp)) {
|
|
6724
|
+
return (_attrName) => false;
|
|
6725
|
+
}
|
|
6726
|
+
// If validationOptOut is an array of strings, attributes specified in the
|
|
6727
|
+
// array will be "opted out". Attributes not specified in the array will still
|
|
6728
|
+
// be validated.
|
|
6729
|
+
if (isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString)) {
|
|
6730
|
+
return (attrName) => !ArrayIncludes.call(optOutStaticProp, attrName);
|
|
6731
|
+
}
|
|
6732
|
+
logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
|
|
6733
|
+
return (_attrName) => true;
|
|
6734
|
+
}
|
|
6678
6735
|
function hydrateText(node, vnode, renderer) {
|
|
6679
6736
|
var _a;
|
|
6680
6737
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -6753,8 +6810,19 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6753
6810
|
return elm;
|
|
6754
6811
|
}
|
|
6755
6812
|
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6813
|
+
const { validationOptOut } = vnode.ctor;
|
|
6814
|
+
const shouldValidateAttr = getValidationPredicate(validationOptOut);
|
|
6815
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6816
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6817
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6818
|
+
//
|
|
6819
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6820
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6821
|
+
//
|
|
6822
|
+
// Therefore, if validationOptOut is falsey or an array of strings, we need to
|
|
6823
|
+
// examine some or all of the custom element's attributes.
|
|
6756
6824
|
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
|
|
6757
|
-
!isMatchingElement(vnode, elm, renderer)) {
|
|
6825
|
+
!isMatchingElement(vnode, elm, renderer, shouldValidateAttr)) {
|
|
6758
6826
|
return handleMismatch(elm, vnode, renderer);
|
|
6759
6827
|
}
|
|
6760
6828
|
const { sel, mode, ctor, owner } = vnode;
|
|
@@ -6848,7 +6916,7 @@ function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
|
6848
6916
|
}
|
|
6849
6917
|
return true;
|
|
6850
6918
|
}
|
|
6851
|
-
function isMatchingElement(vnode, elm, renderer) {
|
|
6919
|
+
function isMatchingElement(vnode, elm, renderer, shouldValidateAttr = () => true) {
|
|
6852
6920
|
const { getProperty } = renderer;
|
|
6853
6921
|
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6854
6922
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6856,10 +6924,14 @@ function isMatchingElement(vnode, elm, renderer) {
|
|
|
6856
6924
|
}
|
|
6857
6925
|
return false;
|
|
6858
6926
|
}
|
|
6859
|
-
const
|
|
6860
|
-
const
|
|
6861
|
-
|
|
6862
|
-
|
|
6927
|
+
const hasCompatibleAttrs = validateAttrs(vnode, elm, renderer, shouldValidateAttr);
|
|
6928
|
+
const hasCompatibleClass = shouldValidateAttr('class')
|
|
6929
|
+
? validateClassAttr(vnode, elm, renderer)
|
|
6930
|
+
: true;
|
|
6931
|
+
const hasCompatibleStyle = shouldValidateAttr('style')
|
|
6932
|
+
? validateStyleAttr(vnode, elm, renderer)
|
|
6933
|
+
: true;
|
|
6934
|
+
return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
|
|
6863
6935
|
}
|
|
6864
6936
|
function attributeValuesAreEqual(vnodeValue, value) {
|
|
6865
6937
|
const vnodeValueAsString = String(vnodeValue);
|
|
@@ -6874,12 +6946,15 @@ function attributeValuesAreEqual(vnodeValue, value) {
|
|
|
6874
6946
|
// In all other cases, the two values are not considered equal
|
|
6875
6947
|
return false;
|
|
6876
6948
|
}
|
|
6877
|
-
function validateAttrs(vnode, elm, renderer) {
|
|
6949
|
+
function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
|
|
6878
6950
|
const { data: { attrs = {} }, } = vnode;
|
|
6879
6951
|
let nodesAreCompatible = true;
|
|
6880
6952
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6881
6953
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6882
6954
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6955
|
+
if (!shouldValidateAttr(attrName)) {
|
|
6956
|
+
continue;
|
|
6957
|
+
}
|
|
6883
6958
|
const { owner } = vnode;
|
|
6884
6959
|
const { getAttribute } = renderer;
|
|
6885
6960
|
const elmAttrValue = getAttribute(elm, attrName);
|
|
@@ -7303,7 +7378,7 @@ function readonly(obj) {
|
|
|
7303
7378
|
}
|
|
7304
7379
|
return getReadOnlyProxy(obj);
|
|
7305
7380
|
}
|
|
7306
|
-
/* version: 2.45.
|
|
7381
|
+
/* version: 2.45.2 */
|
|
7307
7382
|
|
|
7308
7383
|
/*
|
|
7309
7384
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7731,7 +7806,7 @@ function rendererFactory(baseRenderer) {
|
|
|
7731
7806
|
function isNull(obj) {
|
|
7732
7807
|
return obj === null;
|
|
7733
7808
|
}
|
|
7734
|
-
/** version: 2.45.
|
|
7809
|
+
/** version: 2.45.2 */
|
|
7735
7810
|
|
|
7736
7811
|
/*
|
|
7737
7812
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -8350,7 +8425,7 @@ function registerContextProvider(elm, adapterContextToken, onContextSubscription
|
|
|
8350
8425
|
});
|
|
8351
8426
|
}));
|
|
8352
8427
|
}
|
|
8353
|
-
/* version: 2.45.
|
|
8428
|
+
/* version: 2.45.2 */
|
|
8354
8429
|
|
|
8355
8430
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
8356
8431
|
//# sourceMappingURL=engine-dom.js.map
|