lwc 2.42.0 → 2.44.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-dom/esm/es2017/engine-dom.js +85 -225
- package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom.js +85 -224
- 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 +35 -20
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/iife/es5/engine-dom.js +85 -226
- 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 +36 -21
- package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom.js +85 -224
- 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 +35 -20
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es5/engine-dom.js +85 -226
- 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 +36 -21
- package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-server/commonjs/es2017/engine-server.js +152 -182
- 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 +133 -183
- package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +89 -74
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +89 -74
- 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 +85 -70
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +88 -71
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +84 -67
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +89 -74
- 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 +85 -70
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +88 -71
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +84 -67
- 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
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var parse5 = require('parse5');
|
|
4
|
+
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var parse5__namespace = /*#__PURE__*/_interopNamespaceDefault(parse5);
|
|
23
|
+
|
|
3
24
|
/* proxy-compat-disable */
|
|
25
|
+
|
|
4
26
|
/**
|
|
5
27
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
6
28
|
*/
|
|
@@ -45,7 +67,7 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
|
45
67
|
*/
|
|
46
68
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
47
69
|
const { isArray: isArray$1 } = Array;
|
|
48
|
-
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, 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;
|
|
70
|
+
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;
|
|
49
71
|
const { fromCharCode: StringFromCharCode } = String;
|
|
50
72
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
51
73
|
function isUndefined$1(obj) {
|
|
@@ -444,9 +466,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
444
466
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
445
467
|
*/
|
|
446
468
|
// Increment whenever the LWC template compiler changes
|
|
447
|
-
const LWC_VERSION = "2.
|
|
469
|
+
const LWC_VERSION = "2.44.0";
|
|
448
470
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
449
|
-
/** version: 2.
|
|
471
|
+
/** version: 2.44.0 */
|
|
450
472
|
|
|
451
473
|
/**
|
|
452
474
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -524,7 +546,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
524
546
|
setFeatureFlag(name, value);
|
|
525
547
|
}
|
|
526
548
|
}
|
|
527
|
-
/** version: 2.
|
|
549
|
+
/** version: 2.44.0 */
|
|
528
550
|
|
|
529
551
|
/*
|
|
530
552
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -620,9 +642,16 @@ function applyAriaReflection(prototype = Element.prototype) {
|
|
|
620
642
|
}
|
|
621
643
|
}
|
|
622
644
|
}
|
|
623
|
-
/** version: 2.
|
|
645
|
+
/** version: 2.44.0 */
|
|
624
646
|
|
|
625
647
|
/* proxy-compat-disable */
|
|
648
|
+
/**
|
|
649
|
+
* Report to the current dispatcher, if there is one.
|
|
650
|
+
* @param reportingEventId
|
|
651
|
+
* @param payload - data to report
|
|
652
|
+
*/
|
|
653
|
+
function report(reportingEventId, payload) {
|
|
654
|
+
}
|
|
626
655
|
|
|
627
656
|
/*
|
|
628
657
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -849,101 +878,6 @@ const defaultDefHTMLPropertyNames = [
|
|
|
849
878
|
'tabIndex',
|
|
850
879
|
'title',
|
|
851
880
|
];
|
|
852
|
-
function offsetPropertyErrorMessage(name) {
|
|
853
|
-
return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
|
|
854
|
-
}
|
|
855
|
-
// Global HTML Attributes & Properties
|
|
856
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
857
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
858
|
-
//
|
|
859
|
-
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
860
|
-
// for e.g. "dropzone" should suffice.
|
|
861
|
-
const globalHTMLProperties = {
|
|
862
|
-
accessKey: {
|
|
863
|
-
attribute: 'accesskey',
|
|
864
|
-
},
|
|
865
|
-
accessKeyLabel: {
|
|
866
|
-
readOnly: true,
|
|
867
|
-
},
|
|
868
|
-
className: {
|
|
869
|
-
attribute: 'class',
|
|
870
|
-
error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.',
|
|
871
|
-
},
|
|
872
|
-
contentEditable: {
|
|
873
|
-
attribute: 'contenteditable',
|
|
874
|
-
},
|
|
875
|
-
dataset: {
|
|
876
|
-
readOnly: true,
|
|
877
|
-
error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.",
|
|
878
|
-
},
|
|
879
|
-
dir: {
|
|
880
|
-
attribute: 'dir',
|
|
881
|
-
},
|
|
882
|
-
draggable: {
|
|
883
|
-
attribute: 'draggable',
|
|
884
|
-
},
|
|
885
|
-
dropzone: {
|
|
886
|
-
attribute: 'dropzone',
|
|
887
|
-
readOnly: true,
|
|
888
|
-
},
|
|
889
|
-
hidden: {
|
|
890
|
-
attribute: 'hidden',
|
|
891
|
-
},
|
|
892
|
-
id: {
|
|
893
|
-
attribute: 'id',
|
|
894
|
-
},
|
|
895
|
-
inputMode: {
|
|
896
|
-
attribute: 'inputmode',
|
|
897
|
-
},
|
|
898
|
-
lang: {
|
|
899
|
-
attribute: 'lang',
|
|
900
|
-
},
|
|
901
|
-
slot: {
|
|
902
|
-
attribute: 'slot',
|
|
903
|
-
error: 'Using the `slot` property is an anti-pattern.',
|
|
904
|
-
},
|
|
905
|
-
spellcheck: {
|
|
906
|
-
attribute: 'spellcheck',
|
|
907
|
-
},
|
|
908
|
-
style: {
|
|
909
|
-
attribute: 'style',
|
|
910
|
-
},
|
|
911
|
-
tabIndex: {
|
|
912
|
-
attribute: 'tabindex',
|
|
913
|
-
},
|
|
914
|
-
title: {
|
|
915
|
-
attribute: 'title',
|
|
916
|
-
},
|
|
917
|
-
translate: {
|
|
918
|
-
attribute: 'translate',
|
|
919
|
-
},
|
|
920
|
-
// additional "global attributes" that are not present in the link above.
|
|
921
|
-
isContentEditable: {
|
|
922
|
-
readOnly: true,
|
|
923
|
-
},
|
|
924
|
-
offsetHeight: {
|
|
925
|
-
readOnly: true,
|
|
926
|
-
error: offsetPropertyErrorMessage('offsetHeight'),
|
|
927
|
-
},
|
|
928
|
-
offsetLeft: {
|
|
929
|
-
readOnly: true,
|
|
930
|
-
error: offsetPropertyErrorMessage('offsetLeft'),
|
|
931
|
-
},
|
|
932
|
-
offsetParent: {
|
|
933
|
-
readOnly: true,
|
|
934
|
-
},
|
|
935
|
-
offsetTop: {
|
|
936
|
-
readOnly: true,
|
|
937
|
-
error: offsetPropertyErrorMessage('offsetTop'),
|
|
938
|
-
},
|
|
939
|
-
offsetWidth: {
|
|
940
|
-
readOnly: true,
|
|
941
|
-
error: offsetPropertyErrorMessage('offsetWidth'),
|
|
942
|
-
},
|
|
943
|
-
role: {
|
|
944
|
-
attribute: 'role',
|
|
945
|
-
},
|
|
946
|
-
};
|
|
947
881
|
let controlledElement = null;
|
|
948
882
|
let controlledAttributeName;
|
|
949
883
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1128,8 +1062,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
1128
1062
|
}),
|
|
1129
1063
|
addEventListener: generateDataDescriptor({
|
|
1130
1064
|
value(type, listener, options) {
|
|
1131
|
-
// TODO [#
|
|
1132
|
-
// programmatically into its Component's shadow root
|
|
1065
|
+
// TODO [#1824]: Potentially relax this restriction
|
|
1133
1066
|
if (!isUndefined$1(options)) {
|
|
1134
1067
|
logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
|
|
1135
1068
|
}
|
|
@@ -1175,8 +1108,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
1175
1108
|
}),
|
|
1176
1109
|
addEventListener: generateDataDescriptor({
|
|
1177
1110
|
value(type, listener, options) {
|
|
1178
|
-
// TODO [#
|
|
1179
|
-
// programmatically into a lighting element node
|
|
1111
|
+
// TODO [#1824]: Potentially relax this restriction
|
|
1180
1112
|
if (!isUndefined$1(options)) {
|
|
1181
1113
|
logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
|
|
1182
1114
|
}
|
|
@@ -1204,7 +1136,7 @@ function getComponentRestrictionsDescriptors() {
|
|
|
1204
1136
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1205
1137
|
assertNotProd(); // this method should never leak to prod
|
|
1206
1138
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
1207
|
-
|
|
1139
|
+
return {
|
|
1208
1140
|
dispatchEvent: generateDataDescriptor({
|
|
1209
1141
|
value(event) {
|
|
1210
1142
|
const vm = getAssociatedVM(this);
|
|
@@ -1222,32 +1154,6 @@ function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
|
1222
1154
|
},
|
|
1223
1155
|
}),
|
|
1224
1156
|
};
|
|
1225
|
-
forEach.call(getOwnPropertyNames$1(globalHTMLProperties), (propName) => {
|
|
1226
|
-
if (propName in proto) {
|
|
1227
|
-
return; // no need to redefine something that we are already exposing
|
|
1228
|
-
}
|
|
1229
|
-
descriptors[propName] = generateAccessorDescriptor({
|
|
1230
|
-
get() {
|
|
1231
|
-
const { error, attribute } = globalHTMLProperties[propName];
|
|
1232
|
-
const msg = [];
|
|
1233
|
-
msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
|
|
1234
|
-
if (error) {
|
|
1235
|
-
msg.push(error);
|
|
1236
|
-
}
|
|
1237
|
-
else if (attribute) {
|
|
1238
|
-
msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
|
|
1239
|
-
}
|
|
1240
|
-
logError(msg.join('\n'), getAssociatedVM(this));
|
|
1241
|
-
},
|
|
1242
|
-
set() {
|
|
1243
|
-
const { readOnly } = globalHTMLProperties[propName];
|
|
1244
|
-
if (readOnly) {
|
|
1245
|
-
logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
|
|
1246
|
-
}
|
|
1247
|
-
},
|
|
1248
|
-
});
|
|
1249
|
-
});
|
|
1250
|
-
return descriptors;
|
|
1251
1157
|
}
|
|
1252
1158
|
// This routine will prevent access to certain properties on a shadow root instance to guarantee
|
|
1253
1159
|
// that all components will work fine in IE11 and other browsers without shadow dom support.
|
|
@@ -2572,12 +2478,7 @@ function createPublicPropertyDescriptor(key) {
|
|
|
2572
2478
|
}
|
|
2573
2479
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2574
2480
|
const { get, set, enumerable, configurable } = descriptor;
|
|
2575
|
-
|
|
2576
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2577
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2578
|
-
}
|
|
2579
|
-
throw new Error();
|
|
2580
|
-
}
|
|
2481
|
+
assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
|
|
2581
2482
|
return {
|
|
2582
2483
|
get() {
|
|
2583
2484
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2697,64 +2598,64 @@ function getClassDescriptorType(descriptor) {
|
|
|
2697
2598
|
}
|
|
2698
2599
|
}
|
|
2699
2600
|
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
2601
|
+
assertNotProd(); // this method should never leak to prod
|
|
2700
2602
|
if (!isUndefined$1(descriptor)) {
|
|
2701
2603
|
const type = getClassDescriptorType(descriptor);
|
|
2702
2604
|
const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
|
|
2703
|
-
// [
|
|
2704
|
-
|
|
2705
|
-
if (type === "accessor" /* DescriptorType.Accessor */) {
|
|
2706
|
-
logError(message);
|
|
2707
|
-
}
|
|
2708
|
-
else {
|
|
2709
|
-
assert.fail(message);
|
|
2710
|
-
}
|
|
2605
|
+
// TODO [#3408]: this should throw, not log
|
|
2606
|
+
logError(message);
|
|
2711
2607
|
}
|
|
2712
2608
|
}
|
|
2713
2609
|
function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
|
|
2610
|
+
assertNotProd(); // this method should never leak to prod
|
|
2714
2611
|
if (!isUndefined$1(descriptor)) {
|
|
2715
2612
|
const type = getClassDescriptorType(descriptor);
|
|
2716
|
-
|
|
2613
|
+
// TODO [#3408]: this should throw, not log
|
|
2614
|
+
logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
|
|
2717
2615
|
}
|
|
2718
2616
|
}
|
|
2719
2617
|
function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
|
|
2618
|
+
assertNotProd(); // this method should never leak to prod
|
|
2720
2619
|
if (!isUndefined$1(descriptor)) {
|
|
2721
2620
|
const type = getClassDescriptorType(descriptor);
|
|
2722
|
-
|
|
2621
|
+
// TODO [#3408]: this should throw, not log
|
|
2622
|
+
logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
|
|
2723
2623
|
}
|
|
2724
2624
|
}
|
|
2725
2625
|
function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
|
|
2626
|
+
assertNotProd(); // this method should never leak to prod
|
|
2726
2627
|
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
2727
|
-
|
|
2628
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2629
|
+
logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
|
|
2728
2630
|
}
|
|
2729
2631
|
}
|
|
2730
2632
|
function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
2633
|
+
assertNotProd(); // this method should never leak to prod
|
|
2731
2634
|
if (!isUndefined$1(descriptor)) {
|
|
2732
2635
|
const type = getClassDescriptorType(descriptor);
|
|
2733
2636
|
const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
|
|
2734
|
-
// [
|
|
2735
|
-
|
|
2736
|
-
if (type === "accessor" /* DescriptorType.Accessor */) {
|
|
2737
|
-
logError(message);
|
|
2738
|
-
}
|
|
2739
|
-
else {
|
|
2740
|
-
assert.fail(message);
|
|
2741
|
-
}
|
|
2637
|
+
// TODO [#3408]: this should throw, not log
|
|
2638
|
+
logError(message);
|
|
2742
2639
|
}
|
|
2743
2640
|
}
|
|
2744
2641
|
function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2642
|
+
assertNotProd(); // this method should never leak to prod
|
|
2643
|
+
if (isFunction$1(descriptor.set)) {
|
|
2644
|
+
if (!isFunction$1(descriptor.get)) {
|
|
2645
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2646
|
+
logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
|
|
2647
|
+
}
|
|
2750
2648
|
}
|
|
2751
2649
|
else if (!isFunction$1(descriptor.get)) {
|
|
2752
|
-
|
|
2650
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2651
|
+
logError(`Missing @api get ${fieldName} accessor.`);
|
|
2753
2652
|
}
|
|
2754
2653
|
}
|
|
2755
2654
|
function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
|
|
2655
|
+
assertNotProd(); // this method should never leak to prod
|
|
2756
2656
|
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
2757
|
-
|
|
2657
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2658
|
+
logError(`Invalid @api ${methodName} method.`);
|
|
2758
2659
|
}
|
|
2759
2660
|
}
|
|
2760
2661
|
/**
|
|
@@ -2777,13 +2678,14 @@ function registerDecorators(Ctor, meta) {
|
|
|
2777
2678
|
apiFieldsConfig[fieldName] = propConfig.config;
|
|
2778
2679
|
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
2779
2680
|
if (propConfig.config > 0) {
|
|
2681
|
+
if (isUndefined$1(descriptor)) {
|
|
2682
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2683
|
+
throw new Error();
|
|
2684
|
+
}
|
|
2780
2685
|
// accessor declaration
|
|
2781
2686
|
if (process.env.NODE_ENV !== 'production') {
|
|
2782
2687
|
validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
2783
2688
|
}
|
|
2784
|
-
if (isUndefined$1(descriptor)) {
|
|
2785
|
-
throw new Error();
|
|
2786
|
-
}
|
|
2787
2689
|
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
2788
2690
|
}
|
|
2789
2691
|
else {
|
|
@@ -2823,7 +2725,10 @@ function registerDecorators(Ctor, meta) {
|
|
|
2823
2725
|
descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
|
|
2824
2726
|
if (method === 1) {
|
|
2825
2727
|
if (process.env.NODE_ENV !== 'production') {
|
|
2826
|
-
|
|
2728
|
+
if (!adapter) {
|
|
2729
|
+
// TODO [#3408]: this should throw, not log
|
|
2730
|
+
logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
|
|
2731
|
+
}
|
|
2827
2732
|
validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
2828
2733
|
}
|
|
2829
2734
|
if (isUndefined$1(descriptor)) {
|
|
@@ -2834,7 +2739,10 @@ function registerDecorators(Ctor, meta) {
|
|
|
2834
2739
|
}
|
|
2835
2740
|
else {
|
|
2836
2741
|
if (process.env.NODE_ENV !== 'production') {
|
|
2837
|
-
|
|
2742
|
+
if (!adapter) {
|
|
2743
|
+
// TODO [#3408]: this should throw, not log
|
|
2744
|
+
logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
|
|
2745
|
+
}
|
|
2838
2746
|
validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
2839
2747
|
}
|
|
2840
2748
|
descriptor = internalWireFieldDecorator(fieldOrMethodName);
|
|
@@ -3534,6 +3442,15 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3534
3442
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3535
3443
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3536
3444
|
}
|
|
3445
|
+
// Check that this stylesheet was generated by our compiler
|
|
3446
|
+
if (!isStylesheetRegistered(stylesheet)) {
|
|
3447
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3448
|
+
logWarnOnce(`TypeError: Unexpected LWC stylesheet content found for component <${vm.tagName.toLowerCase()}>.`);
|
|
3449
|
+
}
|
|
3450
|
+
report("UnexpectedStylesheetContent" /* ReportingEventId.UnexpectedStylesheetContent */, {
|
|
3451
|
+
tagName: vm.tagName.toLowerCase(),
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3537
3454
|
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3538
3455
|
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS &&
|
|
3539
3456
|
!isScopedCss &&
|
|
@@ -3622,6 +3539,18 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3622
3539
|
}
|
|
3623
3540
|
return null;
|
|
3624
3541
|
}
|
|
3542
|
+
const signedStylesheetSet = new Set();
|
|
3543
|
+
/**
|
|
3544
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3545
|
+
* will prevent this function from being imported by userland code.
|
|
3546
|
+
*/
|
|
3547
|
+
function registerStylesheet(stylesheet) {
|
|
3548
|
+
signedStylesheetSet.add(stylesheet);
|
|
3549
|
+
return stylesheet;
|
|
3550
|
+
}
|
|
3551
|
+
function isStylesheetRegistered(stylesheet) {
|
|
3552
|
+
return signedStylesheetSet.has(stylesheet);
|
|
3553
|
+
}
|
|
3625
3554
|
|
|
3626
3555
|
/*
|
|
3627
3556
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5279,18 +5208,12 @@ function getVMBeingRendered() {
|
|
|
5279
5208
|
function setVMBeingRendered(vm) {
|
|
5280
5209
|
vmBeingRendered = vm;
|
|
5281
5210
|
}
|
|
5282
|
-
function validateSlots(vm
|
|
5211
|
+
function validateSlots(vm) {
|
|
5283
5212
|
assertNotProd(); // this method should never leak to prod
|
|
5284
5213
|
const { cmpSlots } = vm;
|
|
5285
|
-
const { slots = EmptyArray } = html;
|
|
5286
5214
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
5287
5215
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5288
5216
|
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}.`);
|
|
5289
|
-
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5290
|
-
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5291
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5292
|
-
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
5293
|
-
}
|
|
5294
5217
|
}
|
|
5295
5218
|
}
|
|
5296
5219
|
function validateLightDomTemplate(template, vm) {
|
|
@@ -5404,7 +5327,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5404
5327
|
}
|
|
5405
5328
|
if (process.env.NODE_ENV !== 'production') {
|
|
5406
5329
|
// validating slots in every rendering since the allocated content might change over time
|
|
5407
|
-
validateSlots(vm
|
|
5330
|
+
validateSlots(vm);
|
|
5408
5331
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5409
5332
|
setActiveVM(vm);
|
|
5410
5333
|
}
|
|
@@ -6340,12 +6263,12 @@ function readonly(obj) {
|
|
|
6340
6263
|
if (process.env.NODE_ENV !== 'production') {
|
|
6341
6264
|
// TODO [#1292]: Remove the readonly decorator
|
|
6342
6265
|
if (arguments.length !== 1) {
|
|
6343
|
-
|
|
6266
|
+
logError('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
6344
6267
|
}
|
|
6345
6268
|
}
|
|
6346
6269
|
return getReadOnlyProxy(obj);
|
|
6347
6270
|
}
|
|
6348
|
-
/* version: 2.
|
|
6271
|
+
/* version: 2.44.0 */
|
|
6349
6272
|
|
|
6350
6273
|
/*
|
|
6351
6274
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6755,6 +6678,38 @@ const renderer = {
|
|
|
6755
6678
|
registerContextConsumer,
|
|
6756
6679
|
};
|
|
6757
6680
|
|
|
6681
|
+
/*
|
|
6682
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
6683
|
+
* All rights reserved.
|
|
6684
|
+
* SPDX-License-Identifier: MIT
|
|
6685
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6686
|
+
*/
|
|
6687
|
+
function isSingleStyleNodeContainingSingleTextNode(node) {
|
|
6688
|
+
if (node.childNodes.length !== 1) {
|
|
6689
|
+
return false;
|
|
6690
|
+
}
|
|
6691
|
+
const style = node.childNodes[0];
|
|
6692
|
+
if (style.nodeName !== 'style' || style.childNodes.length !== 1) {
|
|
6693
|
+
return false;
|
|
6694
|
+
}
|
|
6695
|
+
const textNode = style.childNodes[0];
|
|
6696
|
+
return textNode.nodeName === '#text';
|
|
6697
|
+
}
|
|
6698
|
+
// The text content inside `<style>` is a special case. It is _only_ rendered by the LWC engine itself; <style> tags
|
|
6699
|
+
// are disallowed inside of templates. Also, we want to avoid over-escaping, since CSS containing strings like
|
|
6700
|
+
// `&` and `"` is not valid CSS (even when inside a `<style>` element).
|
|
6701
|
+
//
|
|
6702
|
+
// However, to avoid XSS attacks, we still need to check for things like `</style><script>alert("pwned")</script>`,
|
|
6703
|
+
// since a user could use that inside of a *.css file to break out of a <style> element.
|
|
6704
|
+
// See: https://github.com/salesforce/lwc/issues/3439
|
|
6705
|
+
function validateStyleTextContents(contents) {
|
|
6706
|
+
// If parse5 parses this as more than one `<style>` tag, then it is unsafe to be rendered as-is
|
|
6707
|
+
const fragment = parse5__namespace.parseFragment(`<style>${contents}</style>`);
|
|
6708
|
+
if (!isSingleStyleNodeContainingSingleTextNode(fragment)) {
|
|
6709
|
+
throw new Error('CSS contains unsafe characters and cannot be serialized inside a style element');
|
|
6710
|
+
}
|
|
6711
|
+
}
|
|
6712
|
+
|
|
6758
6713
|
/*
|
|
6759
6714
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6760
6715
|
* All rights reserved.
|
|
@@ -6766,12 +6721,12 @@ function serializeAttributes(attributes) {
|
|
|
6766
6721
|
.map((attr) => attr.value.length ? `${attr.name}="${htmlEscape(attr.value, true)}"` : attr.name)
|
|
6767
6722
|
.join(' ');
|
|
6768
6723
|
}
|
|
6769
|
-
function serializeChildNodes(children) {
|
|
6724
|
+
function serializeChildNodes(children, tagName) {
|
|
6770
6725
|
return children
|
|
6771
6726
|
.map((child) => {
|
|
6772
6727
|
switch (child[HostTypeKey]) {
|
|
6773
6728
|
case HostNodeType.Text:
|
|
6774
|
-
return child[HostValueKey]
|
|
6729
|
+
return serializeTextContent(child[HostValueKey], tagName);
|
|
6775
6730
|
case HostNodeType.Comment:
|
|
6776
6731
|
return `<!--${htmlEscape(child[HostValueKey])}-->`;
|
|
6777
6732
|
case HostNodeType.Raw:
|
|
@@ -6808,12 +6763,26 @@ function serializeElement(element) {
|
|
|
6808
6763
|
if (element[HostShadowRootKey]) {
|
|
6809
6764
|
output += serializeShadowRoot(element[HostShadowRootKey]);
|
|
6810
6765
|
}
|
|
6811
|
-
output += serializeChildNodes(element[HostChildrenKey]);
|
|
6766
|
+
output += serializeChildNodes(element[HostChildrenKey], tagName);
|
|
6812
6767
|
if (!isVoidElement(tagName, namespace) || hasChildren) {
|
|
6813
6768
|
output += `</${tagName}>`;
|
|
6814
6769
|
}
|
|
6815
6770
|
return output;
|
|
6816
6771
|
}
|
|
6772
|
+
function serializeTextContent(contents, tagName) {
|
|
6773
|
+
if (contents === '') {
|
|
6774
|
+
return '\u200D'; // Special serialization for empty text nodes
|
|
6775
|
+
}
|
|
6776
|
+
if (tagName === 'style') {
|
|
6777
|
+
// Special validation for <style> tags since their content must be served unescaped, and we need to validate
|
|
6778
|
+
// that the contents are safe to serialize unescaped.
|
|
6779
|
+
// TODO [#3454]: move this validation to compilation
|
|
6780
|
+
validateStyleTextContents(contents);
|
|
6781
|
+
// If we haven't thrown an error during validation, then the content is safe to serialize unescaped
|
|
6782
|
+
return contents;
|
|
6783
|
+
}
|
|
6784
|
+
return htmlEscape(contents);
|
|
6785
|
+
}
|
|
6817
6786
|
|
|
6818
6787
|
/*
|
|
6819
6788
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6880,7 +6849,7 @@ seal(LightningElement.prototype);
|
|
|
6880
6849
|
function createElement() {
|
|
6881
6850
|
throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
|
|
6882
6851
|
}
|
|
6883
|
-
/* version: 2.
|
|
6852
|
+
/* version: 2.44.0 */
|
|
6884
6853
|
|
|
6885
6854
|
exports.LightningElement = LightningElement;
|
|
6886
6855
|
exports.api = api$1;
|
|
@@ -6895,6 +6864,7 @@ exports.readonly = readonly;
|
|
|
6895
6864
|
exports.register = register;
|
|
6896
6865
|
exports.registerComponent = registerComponent;
|
|
6897
6866
|
exports.registerDecorators = registerDecorators;
|
|
6867
|
+
exports.registerStylesheet = registerStylesheet;
|
|
6898
6868
|
exports.registerTemplate = registerTemplate;
|
|
6899
6869
|
exports.renderComponent = renderComponent;
|
|
6900
6870
|
exports.renderer = renderer;
|