@lwrjs/everywhere 0.10.0-alpha.2 → 0.10.0-alpha.20
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/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/981eca8f72a57fecd21a35a5dfee2751/config.js +10 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_20/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +18 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa → 2_50_0/s/b40440e2e29d782101f05d6085a324e9}/lwc.js +560 -584
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_10_0-alpha_2/s/c538071acf5bde58e816967a14c465c3 → 0_10_0-alpha_20/s/cb931ebef2b89dcf8ab51456e3a68864}/lwr_everywhereAmd.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0-alpha_20/s/5e6db37af51f0d23be4893abe5eeb913/lwr_init.js +163 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_10_0-alpha_2/s/b9b0d37c87017e0845caa60b6f4b88f9 → 0_10_0-alpha_20/s/e768d044ed1b7b7babca2f39e1cbca58}/lwr_loader.js +105 -14
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_10_0-alpha_2/s/3426e42c3e22ce07ab2adc62c4c523a0 → 0_10_0-alpha_20/s/7a802ee7a2430244c1f66bce2c2eafef}/lwr_metrics.js +14 -2
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0-alpha_20/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +102 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +2 -2
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/lwr-error-shim.js +2 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/lwr-loader-shim.bundle.js +583 -259
- package/build/assets/amd/lwr-everywhere-debug.js +536 -278
- package/build/assets/amd/lwr-everywhere-min.js +6 -1
- package/build/assets/amd/lwr-everywhere.js +536 -278
- package/build/assets/core/lwr-everywhere-debug.js +534 -276
- package/build/assets/core/lwr-everywhere-min.js +6 -1
- package/build/assets/core/lwr-everywhere.js +534 -276
- package/build/assets/esm/lwr-everywhere-debug.js +10 -3
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +10 -3
- package/build/generate.js +5 -10
- package/build/index.js +1 -1
- package/build/modules/lwr/everywhereAmd/everywhereAmd.d.ts +1 -1
- package/build/modules/lwr/host/host.html +1 -1
- package/build/modules/lwr/host/host.js +2 -2
- package/build/modules/lwr/setupLDS/setupLDS.js +8 -5
- package/build/modules/lwr/vault/vault.d.ts +1 -1
- package/build/utils.d.ts +1 -1
- package/package.json +15 -13
- package/src/generate.ts +7 -11
- package/src/index.ts +4 -1
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/e8b5228f499eea69a8f669aada1f8042/config.js +0 -10
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_2/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -18
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0-alpha_2/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js +0 -97
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0-alpha_2/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js +0 -68
- package/build/modules/@salesforce/lds-default-luvio/lds-default-luvio.d.ts +0 -24
- package/build/modules/@salesforce/lds-default-luvio/lds-default-luvio.js +0 -60
- package/build/modules/lwr/setupNodeLDS/network.d.ts +0 -3
- package/build/modules/lwr/setupNodeLDS/network.js +0 -88
- package/build/modules/lwr/setupNodeLDS/setupNodeLDS.d.ts +0 -2
- package/build/modules/lwr/setupNodeLDS/setupNodeLDS.js +0 -14
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
LWR.define('lwc/v/
|
|
1
|
+
LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/* proxy-compat-disable */
|
|
4
4
|
/**
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
6
|
+
*/
|
|
7
|
+
/* proxy-compat-disable */
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
6
10
|
*/
|
|
7
11
|
/*
|
|
8
12
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -63,9 +67,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
63
67
|
const {
|
|
64
68
|
concat: ArrayConcat$1,
|
|
65
69
|
copyWithin: ArrayCopyWithin,
|
|
70
|
+
every: ArrayEvery,
|
|
66
71
|
fill: ArrayFill,
|
|
67
72
|
filter: ArrayFilter,
|
|
68
73
|
find: ArrayFind,
|
|
74
|
+
findIndex: ArrayFindIndex,
|
|
75
|
+
includes: ArrayIncludes,
|
|
69
76
|
indexOf: ArrayIndexOf,
|
|
70
77
|
join: ArrayJoin,
|
|
71
78
|
map: ArrayMap,
|
|
@@ -81,6 +88,15 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
81
88
|
unshift: ArrayUnshift,
|
|
82
89
|
forEach
|
|
83
90
|
} = Array.prototype;
|
|
91
|
+
// The type of the return value of Array.prototype.every is `this is T[]`. However, once this
|
|
92
|
+
// Array method is pulled out of the prototype, the function is now referencing `this` where
|
|
93
|
+
// `this` is meaningless, resulting in a TypeScript compilation error.
|
|
94
|
+
//
|
|
95
|
+
// Exposing this helper function is the closest we can get to preserving the usage patterns
|
|
96
|
+
// of Array.prototype methods used elsewhere in the codebase.
|
|
97
|
+
function arrayEvery(arr, predicate) {
|
|
98
|
+
return ArrayEvery.call(arr, predicate);
|
|
99
|
+
}
|
|
84
100
|
const {
|
|
85
101
|
fromCharCode: StringFromCharCode
|
|
86
102
|
} = String;
|
|
@@ -185,7 +201,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
185
201
|
})();
|
|
186
202
|
// These attributes take either an ID or a list of IDs as values.
|
|
187
203
|
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
|
188
|
-
const ID_REFERENCING_ATTRIBUTES_SET = new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
|
|
204
|
+
const ID_REFERENCING_ATTRIBUTES_SET = /*@__PURE__*/new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
|
|
189
205
|
|
|
190
206
|
/*
|
|
191
207
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -224,40 +240,18 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
224
240
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
225
241
|
*/
|
|
226
242
|
const CAMEL_REGEX = /-([a-z])/g;
|
|
227
|
-
//
|
|
228
|
-
const
|
|
229
|
-
NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
|
|
230
|
-
NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING
|
|
231
|
-
} = /*#__PURE__*/(() => {
|
|
232
|
-
/**
|
|
233
|
-
* Map composed of properties to attributes not following the HTML property to attribute mapping
|
|
234
|
-
* convention.
|
|
235
|
-
*/
|
|
236
|
-
const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([['accessKey', 'accesskey'], ['readOnly', 'readonly'], ['tabIndex', 'tabindex'], ['bgColor', 'bgcolor'], ['colSpan', 'colspan'], ['rowSpan', 'rowspan'], ['contentEditable', 'contenteditable'], ['crossOrigin', 'crossorigin'], ['dateTime', 'datetime'], ['formAction', 'formaction'], ['isMap', 'ismap'], ['maxLength', 'maxlength'], ['minLength', 'minlength'], ['noValidate', 'novalidate'], ['useMap', 'usemap'], ['htmlFor', 'for']]);
|
|
237
|
-
/**
|
|
238
|
-
* Inverted map with attribute name key and property name value.
|
|
239
|
-
*/
|
|
240
|
-
const NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING = new Map();
|
|
241
|
-
NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.forEach((value, key) => NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.set(value, key));
|
|
242
|
-
return {
|
|
243
|
-
NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
|
|
244
|
-
NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING
|
|
245
|
-
};
|
|
246
|
-
})();
|
|
243
|
+
// These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
|
|
244
|
+
const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/new Map([['accessKey', 'accesskey'], ['readOnly', 'readonly'], ['tabIndex', 'tabindex'], ['bgColor', 'bgcolor'], ['colSpan', 'colspan'], ['rowSpan', 'rowspan'], ['contentEditable', 'contenteditable'], ['crossOrigin', 'crossorigin'], ['dateTime', 'datetime'], ['formAction', 'formaction'], ['isMap', 'ismap'], ['maxLength', 'maxlength'], ['minLength', 'minlength'], ['noValidate', 'novalidate'], ['useMap', 'usemap'], ['htmlFor', 'for']]);
|
|
247
245
|
/**
|
|
248
246
|
* Map associating previously transformed HTML property into HTML attribute.
|
|
249
247
|
*/
|
|
250
|
-
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = new Map();
|
|
251
|
-
/**
|
|
252
|
-
* Map associating previously transformed HTML attribute into HTML property.
|
|
253
|
-
*/
|
|
254
|
-
const CACHED_ATTRIBUTE_PROPERTY_MAPPING = new Map();
|
|
248
|
+
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/new Map();
|
|
255
249
|
function htmlPropertyToAttribute(propName) {
|
|
256
250
|
const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
|
|
257
251
|
if (!isUndefined$1(ariaAttributeName)) {
|
|
258
252
|
return ariaAttributeName;
|
|
259
253
|
}
|
|
260
|
-
const specialAttributeName =
|
|
254
|
+
const specialAttributeName = SPECIAL_PROPERTY_ATTRIBUTE_MAPPING.get(propName);
|
|
261
255
|
if (!isUndefined$1(specialAttributeName)) {
|
|
262
256
|
return specialAttributeName;
|
|
263
257
|
}
|
|
@@ -280,40 +274,17 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
280
274
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
281
275
|
return attributeName;
|
|
282
276
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (!isUndefined$1(ariaPropertyName)) {
|
|
286
|
-
return ariaPropertyName;
|
|
287
|
-
}
|
|
288
|
-
const specialPropertyName = NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
|
|
289
|
-
if (!isUndefined$1(specialPropertyName)) {
|
|
290
|
-
return specialPropertyName;
|
|
291
|
-
}
|
|
292
|
-
const cachedPropertyName = CACHED_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
|
|
293
|
-
if (!isUndefined$1(cachedPropertyName)) {
|
|
294
|
-
return cachedPropertyName;
|
|
295
|
-
}
|
|
296
|
-
const propertyName = StringReplace.call(attrName, CAMEL_REGEX, g => g[1].toUpperCase());
|
|
297
|
-
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
298
|
-
return propertyName;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/*
|
|
302
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
303
|
-
* All rights reserved.
|
|
304
|
-
* SPDX-License-Identifier: MIT
|
|
305
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
277
|
+
/**
|
|
278
|
+
* Map associating previously transformed kabab-case attributes into camel-case props.
|
|
306
279
|
*/
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
|
|
316
|
-
return str.replace(searchValue, char => ESCAPED_CHARS[char]);
|
|
280
|
+
const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/new Map();
|
|
281
|
+
function kebabCaseToCamelCase(attrName) {
|
|
282
|
+
let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName);
|
|
283
|
+
if (isUndefined$1(result)) {
|
|
284
|
+
result = StringReplace.call(attrName, CAMEL_REGEX, g => g[1].toUpperCase());
|
|
285
|
+
CACHED_KEBAB_CAMEL_MAPPING.set(attrName, result);
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
317
288
|
}
|
|
318
289
|
|
|
319
290
|
/*
|
|
@@ -323,12 +294,13 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
323
294
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
324
295
|
*/
|
|
325
296
|
// Increment whenever the LWC template compiler changes
|
|
326
|
-
const LWC_VERSION = "2.
|
|
297
|
+
const LWC_VERSION = "2.50.0";
|
|
327
298
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
328
|
-
/** version: 2.
|
|
299
|
+
/** version: 2.50.0 */
|
|
329
300
|
|
|
301
|
+
/* proxy-compat-disable */
|
|
330
302
|
/**
|
|
331
|
-
* Copyright (C)
|
|
303
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
332
304
|
*/
|
|
333
305
|
|
|
334
306
|
/*
|
|
@@ -343,7 +315,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
343
315
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
344
316
|
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
345
317
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
346
|
-
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
347
318
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
348
319
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
349
320
|
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
@@ -404,10 +375,11 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
404
375
|
setFeatureFlag(name, value);
|
|
405
376
|
}
|
|
406
377
|
}
|
|
407
|
-
/** version: 2.
|
|
378
|
+
/** version: 2.50.0 */
|
|
408
379
|
|
|
380
|
+
/* proxy-compat-disable */
|
|
409
381
|
/**
|
|
410
|
-
* Copyright (C)
|
|
382
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
411
383
|
*/
|
|
412
384
|
|
|
413
385
|
/*
|
|
@@ -467,7 +439,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
467
439
|
}
|
|
468
440
|
}
|
|
469
441
|
}
|
|
470
|
-
/** version: 2.
|
|
442
|
+
/** version: 2.50.0 */
|
|
471
443
|
|
|
472
444
|
/*
|
|
473
445
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -482,6 +454,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
482
454
|
}
|
|
483
455
|
|
|
484
456
|
/* proxy-compat-disable */
|
|
457
|
+
/**
|
|
458
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
459
|
+
*/
|
|
485
460
|
|
|
486
461
|
/*
|
|
487
462
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -895,114 +870,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
895
870
|
*/
|
|
896
871
|
// These properties get added to LWCElement.prototype publicProps automatically
|
|
897
872
|
const defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
898
|
-
function offsetPropertyErrorMessage(name) {
|
|
899
|
-
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.`;
|
|
900
|
-
}
|
|
901
|
-
// Global HTML Attributes & Properties
|
|
902
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
903
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
904
|
-
//
|
|
905
|
-
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
906
|
-
// for e.g. "dropzone" should suffice.
|
|
907
|
-
const globalHTMLProperties = {
|
|
908
|
-
accessKey: {
|
|
909
|
-
attribute: 'accesskey'
|
|
910
|
-
},
|
|
911
|
-
accessKeyLabel: {
|
|
912
|
-
readOnly: true
|
|
913
|
-
},
|
|
914
|
-
className: {
|
|
915
|
-
attribute: 'class',
|
|
916
|
-
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.'
|
|
917
|
-
},
|
|
918
|
-
contentEditable: {
|
|
919
|
-
attribute: 'contenteditable'
|
|
920
|
-
},
|
|
921
|
-
dataset: {
|
|
922
|
-
readOnly: true,
|
|
923
|
-
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."
|
|
924
|
-
},
|
|
925
|
-
dir: {
|
|
926
|
-
attribute: 'dir'
|
|
927
|
-
},
|
|
928
|
-
draggable: {
|
|
929
|
-
attribute: 'draggable'
|
|
930
|
-
},
|
|
931
|
-
dropzone: {
|
|
932
|
-
attribute: 'dropzone',
|
|
933
|
-
readOnly: true
|
|
934
|
-
},
|
|
935
|
-
hidden: {
|
|
936
|
-
attribute: 'hidden'
|
|
937
|
-
},
|
|
938
|
-
id: {
|
|
939
|
-
attribute: 'id'
|
|
940
|
-
},
|
|
941
|
-
inputMode: {
|
|
942
|
-
attribute: 'inputmode'
|
|
943
|
-
},
|
|
944
|
-
lang: {
|
|
945
|
-
attribute: 'lang'
|
|
946
|
-
},
|
|
947
|
-
slot: {
|
|
948
|
-
attribute: 'slot',
|
|
949
|
-
error: 'Using the `slot` property is an anti-pattern.'
|
|
950
|
-
},
|
|
951
|
-
spellcheck: {
|
|
952
|
-
attribute: 'spellcheck'
|
|
953
|
-
},
|
|
954
|
-
style: {
|
|
955
|
-
attribute: 'style'
|
|
956
|
-
},
|
|
957
|
-
tabIndex: {
|
|
958
|
-
attribute: 'tabindex'
|
|
959
|
-
},
|
|
960
|
-
title: {
|
|
961
|
-
attribute: 'title'
|
|
962
|
-
},
|
|
963
|
-
translate: {
|
|
964
|
-
attribute: 'translate'
|
|
965
|
-
},
|
|
966
|
-
// additional "global attributes" that are not present in the link above.
|
|
967
|
-
isContentEditable: {
|
|
968
|
-
readOnly: true
|
|
969
|
-
},
|
|
970
|
-
offsetHeight: {
|
|
971
|
-
readOnly: true,
|
|
972
|
-
error: offsetPropertyErrorMessage('offsetHeight')
|
|
973
|
-
},
|
|
974
|
-
offsetLeft: {
|
|
975
|
-
readOnly: true,
|
|
976
|
-
error: offsetPropertyErrorMessage('offsetLeft')
|
|
977
|
-
},
|
|
978
|
-
offsetParent: {
|
|
979
|
-
readOnly: true
|
|
980
|
-
},
|
|
981
|
-
offsetTop: {
|
|
982
|
-
readOnly: true,
|
|
983
|
-
error: offsetPropertyErrorMessage('offsetTop')
|
|
984
|
-
},
|
|
985
|
-
offsetWidth: {
|
|
986
|
-
readOnly: true,
|
|
987
|
-
error: offsetPropertyErrorMessage('offsetWidth')
|
|
988
|
-
},
|
|
989
|
-
role: {
|
|
990
|
-
attribute: 'role'
|
|
991
|
-
}
|
|
992
|
-
};
|
|
993
|
-
let controlledElement = null;
|
|
994
|
-
let controlledAttributeName;
|
|
995
|
-
function isAttributeLocked(elm, attrName) {
|
|
996
|
-
return elm !== controlledElement || attrName !== controlledAttributeName;
|
|
997
|
-
}
|
|
998
|
-
function lockAttribute(_elm, _key) {
|
|
999
|
-
controlledElement = null;
|
|
1000
|
-
controlledAttributeName = undefined;
|
|
1001
|
-
}
|
|
1002
|
-
function unlockAttribute(elm, key) {
|
|
1003
|
-
controlledElement = elm;
|
|
1004
|
-
controlledAttributeName = key;
|
|
1005
|
-
}
|
|
1006
873
|
|
|
1007
874
|
/*
|
|
1008
875
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1041,6 +908,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1041
908
|
* SPDX-License-Identifier: MIT
|
|
1042
909
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1043
910
|
*/
|
|
911
|
+
/* eslint @lwc/lwc-internal/no-production-assert: "off" */
|
|
1044
912
|
function generateDataDescriptor(options) {
|
|
1045
913
|
return assign({
|
|
1046
914
|
configurable: true,
|
|
@@ -1074,8 +942,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1074
942
|
get() {
|
|
1075
943
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
1076
944
|
},
|
|
1077
|
-
set(
|
|
1078
|
-
|
|
945
|
+
set(value) {
|
|
946
|
+
logError(`Invalid attempt to set outerHTML on Element.`);
|
|
947
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
1079
948
|
}
|
|
1080
949
|
})
|
|
1081
950
|
};
|
|
@@ -1165,22 +1034,23 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1165
1034
|
get() {
|
|
1166
1035
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
1167
1036
|
},
|
|
1168
|
-
set(
|
|
1169
|
-
|
|
1037
|
+
set(value) {
|
|
1038
|
+
logError(`Invalid attempt to set innerHTML on ShadowRoot.`);
|
|
1039
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
1170
1040
|
}
|
|
1171
1041
|
}),
|
|
1172
1042
|
textContent: generateAccessorDescriptor({
|
|
1173
1043
|
get() {
|
|
1174
1044
|
return originalTextContentDescriptor.get.call(this);
|
|
1175
1045
|
},
|
|
1176
|
-
set(
|
|
1177
|
-
|
|
1046
|
+
set(value) {
|
|
1047
|
+
logError(`Invalid attempt to set textContent on ShadowRoot.`);
|
|
1048
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
1178
1049
|
}
|
|
1179
1050
|
}),
|
|
1180
1051
|
addEventListener: generateDataDescriptor({
|
|
1181
1052
|
value(type, listener, options) {
|
|
1182
|
-
// TODO [#
|
|
1183
|
-
// programmatically into its Component's shadow root
|
|
1053
|
+
// TODO [#1824]: Potentially relax this restriction
|
|
1184
1054
|
if (!isUndefined$1(options)) {
|
|
1185
1055
|
logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
|
|
1186
1056
|
}
|
|
@@ -1204,30 +1074,32 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1204
1074
|
get() {
|
|
1205
1075
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
1206
1076
|
},
|
|
1207
|
-
set(
|
|
1208
|
-
|
|
1077
|
+
set(value) {
|
|
1078
|
+
logError(`Invalid attempt to set innerHTML on HTMLElement.`);
|
|
1079
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
1209
1080
|
}
|
|
1210
1081
|
}),
|
|
1211
1082
|
outerHTML: generateAccessorDescriptor({
|
|
1212
1083
|
get() {
|
|
1213
1084
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
1214
1085
|
},
|
|
1215
|
-
set(
|
|
1216
|
-
|
|
1086
|
+
set(value) {
|
|
1087
|
+
logError(`Invalid attempt to set outerHTML on HTMLElement.`);
|
|
1088
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
1217
1089
|
}
|
|
1218
1090
|
}),
|
|
1219
1091
|
textContent: generateAccessorDescriptor({
|
|
1220
1092
|
get() {
|
|
1221
1093
|
return originalTextContentDescriptor.get.call(this);
|
|
1222
1094
|
},
|
|
1223
|
-
set(
|
|
1224
|
-
|
|
1095
|
+
set(value) {
|
|
1096
|
+
logError(`Invalid attempt to set textContent on HTMLElement.`);
|
|
1097
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
1225
1098
|
}
|
|
1226
1099
|
}),
|
|
1227
1100
|
addEventListener: generateDataDescriptor({
|
|
1228
1101
|
value(type, listener, options) {
|
|
1229
|
-
// TODO [#
|
|
1230
|
-
// programmatically into a lighting element node
|
|
1102
|
+
// TODO [#1824]: Potentially relax this restriction
|
|
1231
1103
|
if (!isUndefined$1(options)) {
|
|
1232
1104
|
logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
|
|
1233
1105
|
}
|
|
@@ -1238,23 +1110,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1238
1110
|
})
|
|
1239
1111
|
};
|
|
1240
1112
|
}
|
|
1241
|
-
function getComponentRestrictionsDescriptors() {
|
|
1242
|
-
assertNotProd(); // this method should never leak to prod
|
|
1243
|
-
return {
|
|
1244
|
-
tagName: generateAccessorDescriptor({
|
|
1245
|
-
get() {
|
|
1246
|
-
throw new Error(`Usage of property \`tagName\` is disallowed because the component itself does` + ` not know which tagName will be used to create the element, therefore writing` + ` code that check for that value is error prone.`);
|
|
1247
|
-
},
|
|
1248
|
-
configurable: true,
|
|
1249
|
-
enumerable: false // no enumerable properties on component
|
|
1250
|
-
})
|
|
1251
|
-
};
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
1113
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1255
1114
|
assertNotProd(); // this method should never leak to prod
|
|
1256
1115
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
1257
|
-
|
|
1116
|
+
return {
|
|
1258
1117
|
dispatchEvent: generateDataDescriptor({
|
|
1259
1118
|
value(event) {
|
|
1260
1119
|
const vm = getAssociatedVM(this);
|
|
@@ -1272,37 +1131,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1272
1131
|
}
|
|
1273
1132
|
})
|
|
1274
1133
|
};
|
|
1275
|
-
forEach.call(getOwnPropertyNames$1(globalHTMLProperties), propName => {
|
|
1276
|
-
if (propName in proto) {
|
|
1277
|
-
return; // no need to redefine something that we are already exposing
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
descriptors[propName] = generateAccessorDescriptor({
|
|
1281
|
-
get() {
|
|
1282
|
-
const {
|
|
1283
|
-
error,
|
|
1284
|
-
attribute
|
|
1285
|
-
} = globalHTMLProperties[propName];
|
|
1286
|
-
const msg = [];
|
|
1287
|
-
msg.push(`Accessing the global HTML property "${propName}" is disabled.`);
|
|
1288
|
-
if (error) {
|
|
1289
|
-
msg.push(error);
|
|
1290
|
-
} else if (attribute) {
|
|
1291
|
-
msg.push(`Instead access it via \`this.getAttribute("${attribute}")\`.`);
|
|
1292
|
-
}
|
|
1293
|
-
logError(msg.join('\n'), getAssociatedVM(this));
|
|
1294
|
-
},
|
|
1295
|
-
set() {
|
|
1296
|
-
const {
|
|
1297
|
-
readOnly
|
|
1298
|
-
} = globalHTMLProperties[propName];
|
|
1299
|
-
if (readOnly) {
|
|
1300
|
-
logError(`The global HTML property \`${propName}\` is read-only.`, getAssociatedVM(this));
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
});
|
|
1305
|
-
return descriptors;
|
|
1306
1134
|
}
|
|
1307
1135
|
// This routine will prevent access to certain properties on a shadow root instance to guarantee
|
|
1308
1136
|
// that all components will work fine in IE11 and other browsers without shadow dom support.
|
|
@@ -1314,9 +1142,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1314
1142
|
const elmProto = getPrototypeOf$1(elm);
|
|
1315
1143
|
setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
|
|
1316
1144
|
}
|
|
1317
|
-
function patchComponentWithRestrictions(cmp) {
|
|
1318
|
-
defineProperties(cmp, getComponentRestrictionsDescriptors());
|
|
1319
|
-
}
|
|
1320
1145
|
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
1321
1146
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1322
1147
|
}
|
|
@@ -1697,7 +1522,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1697
1522
|
valueMutated(originalTarget, key);
|
|
1698
1523
|
return true;
|
|
1699
1524
|
}
|
|
1700
|
-
/*LWC compiler v2.
|
|
1525
|
+
/*LWC compiler v2.50.0*/
|
|
1701
1526
|
}
|
|
1702
1527
|
const getterMap = new WeakMap();
|
|
1703
1528
|
const setterMap = new WeakMap();
|
|
@@ -1790,7 +1615,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
1790
1615
|
/* istanbul ignore next */
|
|
1791
1616
|
return false;
|
|
1792
1617
|
}
|
|
1793
|
-
/*LWC compiler v2.
|
|
1618
|
+
/*LWC compiler v2.50.0*/
|
|
1794
1619
|
}
|
|
1795
1620
|
function extract(objectOrArray) {
|
|
1796
1621
|
if (isArray(objectOrArray)) {
|
|
@@ -2004,6 +1829,14 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2004
1829
|
* SPDX-License-Identifier: MIT
|
|
2005
1830
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2006
1831
|
*/
|
|
1832
|
+
/**
|
|
1833
|
+
* This module is responsible for producing the ComponentDef object that is always
|
|
1834
|
+
* accessible via `vm.def`. This is lazily created during the creation of the first
|
|
1835
|
+
* instance of a component class, and shared across all instances.
|
|
1836
|
+
*
|
|
1837
|
+
* This structure can be used to synthetically create proxies, and understand the
|
|
1838
|
+
* shape of a component. It is also used internally to apply extra optimizations.
|
|
1839
|
+
*/
|
|
2007
1840
|
/**
|
|
2008
1841
|
* This operation is called with a descriptor of an standard html property
|
|
2009
1842
|
* that a Custom Element can support (including AOM properties), which
|
|
@@ -2018,16 +1851,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2018
1851
|
configurable
|
|
2019
1852
|
} = descriptor;
|
|
2020
1853
|
if (!isFunction$1(get)) {
|
|
2021
|
-
|
|
2022
|
-
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
2023
|
-
}
|
|
2024
|
-
throw new TypeError();
|
|
1854
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
2025
1855
|
}
|
|
2026
1856
|
if (!isFunction$1(set)) {
|
|
2027
|
-
|
|
2028
|
-
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
2029
|
-
}
|
|
2030
|
-
throw new TypeError();
|
|
1857
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
2031
1858
|
}
|
|
2032
1859
|
return {
|
|
2033
1860
|
enumerable,
|
|
@@ -2047,10 +1874,18 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2047
1874
|
const vm = getAssociatedVM(this);
|
|
2048
1875
|
if (process.env.NODE_ENV !== 'production') {
|
|
2049
1876
|
const vmBeingRendered = getVMBeingRendered();
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
1877
|
+
if (isInvokingRender) {
|
|
1878
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
|
|
1879
|
+
}
|
|
1880
|
+
if (isUpdatingTemplate) {
|
|
1881
|
+
logError(`When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
|
|
1882
|
+
}
|
|
1883
|
+
if (isBeingConstructed(vm)) {
|
|
1884
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1885
|
+
}
|
|
1886
|
+
if (isObject(newValue) && !isNull(newValue)) {
|
|
1887
|
+
logError(`Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1888
|
+
}
|
|
2054
1889
|
}
|
|
2055
1890
|
updateComponentValue(vm, propName, newValue);
|
|
2056
1891
|
return set.call(vm.elm, newValue);
|
|
@@ -2113,7 +1948,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2113
1948
|
// Adding extra guard rails in DEV mode.
|
|
2114
1949
|
if (process.env.NODE_ENV !== 'production') {
|
|
2115
1950
|
patchCustomElementWithRestrictions(elm);
|
|
2116
|
-
patchComponentWithRestrictions(component);
|
|
2117
1951
|
}
|
|
2118
1952
|
return this;
|
|
2119
1953
|
};
|
|
@@ -2169,9 +2003,15 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2169
2003
|
} = vm;
|
|
2170
2004
|
if (process.env.NODE_ENV !== 'production') {
|
|
2171
2005
|
const vmBeingRendered = getVMBeingRendered();
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2006
|
+
if (isInvokingRender) {
|
|
2007
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
2008
|
+
}
|
|
2009
|
+
if (isUpdatingTemplate) {
|
|
2010
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
2011
|
+
}
|
|
2012
|
+
if (!isFunction$1(listener)) {
|
|
2013
|
+
logError(`Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2014
|
+
}
|
|
2175
2015
|
}
|
|
2176
2016
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2177
2017
|
addEventListener(elm, type, wrappedListener, options);
|
|
@@ -2215,9 +2055,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2215
2055
|
removeAttribute
|
|
2216
2056
|
}
|
|
2217
2057
|
} = vm;
|
|
2218
|
-
unlockAttribute(elm, name);
|
|
2219
2058
|
removeAttribute(elm, name);
|
|
2220
|
-
lockAttribute();
|
|
2221
2059
|
},
|
|
2222
2060
|
removeAttributeNS(namespace, name) {
|
|
2223
2061
|
const {
|
|
@@ -2226,9 +2064,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2226
2064
|
removeAttribute
|
|
2227
2065
|
}
|
|
2228
2066
|
} = getAssociatedVM(this);
|
|
2229
|
-
unlockAttribute(elm, name);
|
|
2230
2067
|
removeAttribute(elm, name, namespace);
|
|
2231
|
-
lockAttribute();
|
|
2232
2068
|
},
|
|
2233
2069
|
getAttribute(name) {
|
|
2234
2070
|
const vm = getAssociatedVM(this);
|
|
@@ -2259,11 +2095,11 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2259
2095
|
}
|
|
2260
2096
|
} = vm;
|
|
2261
2097
|
if (process.env.NODE_ENV !== 'production') {
|
|
2262
|
-
|
|
2098
|
+
if (isBeingConstructed(vm)) {
|
|
2099
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2100
|
+
}
|
|
2263
2101
|
}
|
|
2264
|
-
unlockAttribute(elm, name);
|
|
2265
2102
|
setAttribute(elm, name, value);
|
|
2266
|
-
lockAttribute();
|
|
2267
2103
|
},
|
|
2268
2104
|
setAttributeNS(namespace, name, value) {
|
|
2269
2105
|
const vm = getAssociatedVM(this);
|
|
@@ -2274,11 +2110,11 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2274
2110
|
}
|
|
2275
2111
|
} = vm;
|
|
2276
2112
|
if (process.env.NODE_ENV !== 'production') {
|
|
2277
|
-
|
|
2113
|
+
if (isBeingConstructed(vm)) {
|
|
2114
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2115
|
+
}
|
|
2278
2116
|
}
|
|
2279
|
-
unlockAttribute(elm, name);
|
|
2280
2117
|
setAttribute(elm, name, value, namespace);
|
|
2281
|
-
lockAttribute();
|
|
2282
2118
|
},
|
|
2283
2119
|
getBoundingClientRect() {
|
|
2284
2120
|
const vm = getAssociatedVM(this);
|
|
@@ -2312,9 +2148,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2312
2148
|
}
|
|
2313
2149
|
} = vm;
|
|
2314
2150
|
if (process.env.NODE_ENV !== 'production') {
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2151
|
+
if (isBeingConstructed(vm)) {
|
|
2152
|
+
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.`);
|
|
2153
|
+
}
|
|
2318
2154
|
}
|
|
2319
2155
|
return getClassList(elm);
|
|
2320
2156
|
},
|
|
@@ -2692,7 +2528,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2692
2528
|
});
|
|
2693
2529
|
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2694
2530
|
// job
|
|
2695
|
-
connector = new adapter(dataCallback
|
|
2531
|
+
connector = new adapter(dataCallback, {
|
|
2532
|
+
tagName: vm.tagName
|
|
2533
|
+
});
|
|
2696
2534
|
}, noop);
|
|
2697
2535
|
const updateConnectorConfig = config => {
|
|
2698
2536
|
// every time the config is recomputed due to tracking,
|
|
@@ -2853,8 +2691,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2853
2691
|
const vm = getAssociatedVM(this);
|
|
2854
2692
|
if (process.env.NODE_ENV !== 'production') {
|
|
2855
2693
|
const vmBeingRendered = getVMBeingRendered();
|
|
2856
|
-
|
|
2857
|
-
|
|
2694
|
+
if (isInvokingRender) {
|
|
2695
|
+
logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2696
|
+
}
|
|
2697
|
+
if (isUpdatingTemplate) {
|
|
2698
|
+
logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2699
|
+
}
|
|
2858
2700
|
}
|
|
2859
2701
|
vm.cmpProps[key] = newValue;
|
|
2860
2702
|
componentValueMutated(vm, key);
|
|
@@ -2870,12 +2712,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2870
2712
|
enumerable,
|
|
2871
2713
|
configurable
|
|
2872
2714
|
} = descriptor;
|
|
2873
|
-
|
|
2874
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2875
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2876
|
-
}
|
|
2877
|
-
throw new Error();
|
|
2878
|
-
}
|
|
2715
|
+
assert.invariant(isFunction$1(get), `Invalid public accessor ${toString$1(key)} decorated with @api. The property is missing a getter.`);
|
|
2879
2716
|
return {
|
|
2880
2717
|
get() {
|
|
2881
2718
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2888,13 +2725,17 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2888
2725
|
const vm = getAssociatedVM(this);
|
|
2889
2726
|
if (process.env.NODE_ENV !== 'production') {
|
|
2890
2727
|
const vmBeingRendered = getVMBeingRendered();
|
|
2891
|
-
|
|
2892
|
-
|
|
2728
|
+
if (isInvokingRender) {
|
|
2729
|
+
logError(`render() method has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2730
|
+
}
|
|
2731
|
+
if (isUpdatingTemplate) {
|
|
2732
|
+
logError(`Updating the template has side effects on the state of property "${toString$1(key)}"`, isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2733
|
+
}
|
|
2893
2734
|
}
|
|
2894
2735
|
if (set) {
|
|
2895
2736
|
set.call(this, newValue);
|
|
2896
2737
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
2897
|
-
|
|
2738
|
+
logError(`Invalid attempt to set a new value for property "${toString$1(key)}" that does not has a setter decorated with @api.`, vm);
|
|
2898
2739
|
}
|
|
2899
2740
|
},
|
|
2900
2741
|
enumerable,
|
|
@@ -2928,8 +2769,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2928
2769
|
const vm = getAssociatedVM(this);
|
|
2929
2770
|
if (process.env.NODE_ENV !== 'production') {
|
|
2930
2771
|
const vmBeingRendered = getVMBeingRendered();
|
|
2931
|
-
|
|
2932
|
-
|
|
2772
|
+
if (isInvokingRender) {
|
|
2773
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2774
|
+
}
|
|
2775
|
+
if (isUpdatingTemplate) {
|
|
2776
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2777
|
+
}
|
|
2933
2778
|
}
|
|
2934
2779
|
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2935
2780
|
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
@@ -2995,60 +2840,63 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
2995
2840
|
}
|
|
2996
2841
|
|
|
2997
2842
|
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
2843
|
+
assertNotProd(); // this method should never leak to prod
|
|
2998
2844
|
if (!isUndefined$1(descriptor)) {
|
|
2999
2845
|
const type = getClassDescriptorType(descriptor);
|
|
3000
2846
|
const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
|
|
3001
|
-
// [
|
|
3002
|
-
|
|
3003
|
-
if (type === "accessor" /* DescriptorType.Accessor */) {
|
|
3004
|
-
logError(message);
|
|
3005
|
-
} else {
|
|
3006
|
-
assert.fail(message);
|
|
3007
|
-
}
|
|
2847
|
+
// TODO [#3408]: this should throw, not log
|
|
2848
|
+
logError(message);
|
|
3008
2849
|
}
|
|
3009
2850
|
}
|
|
3010
2851
|
function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
|
|
2852
|
+
assertNotProd(); // this method should never leak to prod
|
|
3011
2853
|
if (!isUndefined$1(descriptor)) {
|
|
3012
2854
|
const type = getClassDescriptorType(descriptor);
|
|
3013
|
-
|
|
2855
|
+
// TODO [#3408]: this should throw, not log
|
|
2856
|
+
logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
|
|
3014
2857
|
}
|
|
3015
2858
|
}
|
|
3016
2859
|
function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
|
|
2860
|
+
assertNotProd(); // this method should never leak to prod
|
|
3017
2861
|
if (!isUndefined$1(descriptor)) {
|
|
3018
2862
|
const type = getClassDescriptorType(descriptor);
|
|
3019
|
-
|
|
2863
|
+
// TODO [#3408]: this should throw, not log
|
|
2864
|
+
logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
|
|
3020
2865
|
}
|
|
3021
2866
|
}
|
|
3022
2867
|
function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
|
|
2868
|
+
assertNotProd(); // this method should never leak to prod
|
|
3023
2869
|
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
3024
|
-
|
|
2870
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2871
|
+
logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
|
|
3025
2872
|
}
|
|
3026
2873
|
}
|
|
3027
2874
|
function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
2875
|
+
assertNotProd(); // this method should never leak to prod
|
|
3028
2876
|
if (!isUndefined$1(descriptor)) {
|
|
3029
2877
|
const type = getClassDescriptorType(descriptor);
|
|
3030
2878
|
const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
|
|
3031
|
-
// [
|
|
3032
|
-
|
|
3033
|
-
if (type === "accessor" /* DescriptorType.Accessor */) {
|
|
3034
|
-
logError(message);
|
|
3035
|
-
} else {
|
|
3036
|
-
assert.fail(message);
|
|
3037
|
-
}
|
|
2879
|
+
// TODO [#3408]: this should throw, not log
|
|
2880
|
+
logError(message);
|
|
3038
2881
|
}
|
|
3039
2882
|
}
|
|
3040
2883
|
function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
2884
|
+
assertNotProd(); // this method should never leak to prod
|
|
2885
|
+
if (isFunction$1(descriptor.set)) {
|
|
2886
|
+
if (!isFunction$1(descriptor.get)) {
|
|
2887
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2888
|
+
logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
|
|
2889
|
+
}
|
|
3045
2890
|
} else if (!isFunction$1(descriptor.get)) {
|
|
3046
|
-
|
|
2891
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2892
|
+
logError(`Missing @api get ${fieldName} accessor.`);
|
|
3047
2893
|
}
|
|
3048
2894
|
}
|
|
3049
2895
|
function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
|
|
2896
|
+
assertNotProd(); // this method should never leak to prod
|
|
3050
2897
|
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
3051
|
-
|
|
2898
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2899
|
+
logError(`Invalid @api ${methodName} method.`);
|
|
3052
2900
|
}
|
|
3053
2901
|
}
|
|
3054
2902
|
/**
|
|
@@ -3077,13 +2925,14 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3077
2925
|
apiFieldsConfig[fieldName] = propConfig.config;
|
|
3078
2926
|
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
3079
2927
|
if (propConfig.config > 0) {
|
|
2928
|
+
if (isUndefined$1(descriptor)) {
|
|
2929
|
+
// TODO [#3441]: This line of code does not seem possible to reach.
|
|
2930
|
+
throw new Error();
|
|
2931
|
+
}
|
|
3080
2932
|
// accessor declaration
|
|
3081
2933
|
if (process.env.NODE_ENV !== 'production') {
|
|
3082
2934
|
validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
3083
2935
|
}
|
|
3084
|
-
if (isUndefined$1(descriptor)) {
|
|
3085
|
-
throw new Error();
|
|
3086
|
-
}
|
|
3087
2936
|
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
3088
2937
|
} else {
|
|
3089
2938
|
// field declaration
|
|
@@ -3126,7 +2975,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3126
2975
|
descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
|
|
3127
2976
|
if (method === 1) {
|
|
3128
2977
|
if (process.env.NODE_ENV !== 'production') {
|
|
3129
|
-
|
|
2978
|
+
if (!adapter) {
|
|
2979
|
+
// TODO [#3408]: this should throw, not log
|
|
2980
|
+
logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
|
|
2981
|
+
}
|
|
3130
2982
|
validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
3131
2983
|
}
|
|
3132
2984
|
if (isUndefined$1(descriptor)) {
|
|
@@ -3136,7 +2988,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3136
2988
|
storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic);
|
|
3137
2989
|
} else {
|
|
3138
2990
|
if (process.env.NODE_ENV !== 'production') {
|
|
3139
|
-
|
|
2991
|
+
if (!adapter) {
|
|
2992
|
+
// TODO [#3408]: this should throw, not log
|
|
2993
|
+
logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
|
|
2994
|
+
}
|
|
3140
2995
|
validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
3141
2996
|
}
|
|
3142
2997
|
descriptor = internalWireFieldDecorator(fieldOrMethodName);
|
|
@@ -3268,6 +3123,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3268
3123
|
* SPDX-License-Identifier: MIT
|
|
3269
3124
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3270
3125
|
*/
|
|
3126
|
+
/**
|
|
3127
|
+
* This module is responsible for creating the base bridge class BaseBridgeElement
|
|
3128
|
+
* that represents the HTMLElement extension used for any LWC inserted in the DOM.
|
|
3129
|
+
*/
|
|
3271
3130
|
// A bridge descriptor is a descriptor whose job is just to get the component instance
|
|
3272
3131
|
// from the element instance, and get the value or set a new value on the component.
|
|
3273
3132
|
// This means that across different elements, similar names can get the exact same
|
|
@@ -3328,14 +3187,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3328
3187
|
}
|
|
3329
3188
|
return;
|
|
3330
3189
|
}
|
|
3331
|
-
if (!isAttributeLocked(this, attrName)) {
|
|
3332
|
-
// Ignore changes triggered by the engine itself during:
|
|
3333
|
-
// * diffing when public props are attempting to reflect to the DOM
|
|
3334
|
-
// * component via `this.setAttribute()`, should never update the prop
|
|
3335
|
-
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
3336
|
-
// attribute to be changed
|
|
3337
|
-
return;
|
|
3338
|
-
}
|
|
3339
3190
|
// Reflect attribute change to the corresponding property when changed from outside.
|
|
3340
3191
|
this[propName] = newValue;
|
|
3341
3192
|
};
|
|
@@ -3353,7 +3204,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3353
3204
|
*/
|
|
3354
3205
|
if (isFunction$1(SuperClass)) {
|
|
3355
3206
|
HTMLBridgeElement = class extends SuperClass {
|
|
3356
|
-
/*LWC compiler v2.
|
|
3207
|
+
/*LWC compiler v2.50.0*/
|
|
3357
3208
|
};
|
|
3358
3209
|
} else {
|
|
3359
3210
|
HTMLBridgeElement = function () {
|
|
@@ -3435,6 +3286,94 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3435
3286
|
freeze(BaseBridgeElement);
|
|
3436
3287
|
seal(BaseBridgeElement.prototype);
|
|
3437
3288
|
|
|
3289
|
+
/*
|
|
3290
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
3291
|
+
* All rights reserved.
|
|
3292
|
+
* SPDX-License-Identifier: MIT
|
|
3293
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3294
|
+
*/
|
|
3295
|
+
const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
|
|
3296
|
+
// In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
|
|
3297
|
+
class LegacyWeakMultiMap {
|
|
3298
|
+
constructor() {
|
|
3299
|
+
this._map = new WeakMap();
|
|
3300
|
+
}
|
|
3301
|
+
_getValues(key) {
|
|
3302
|
+
let values = this._map.get(key);
|
|
3303
|
+
if (isUndefined$1(values)) {
|
|
3304
|
+
values = new Set();
|
|
3305
|
+
this._map.set(key, values);
|
|
3306
|
+
}
|
|
3307
|
+
return values;
|
|
3308
|
+
}
|
|
3309
|
+
get(key) {
|
|
3310
|
+
return this._getValues(key);
|
|
3311
|
+
}
|
|
3312
|
+
add(key, vm) {
|
|
3313
|
+
const set = this._getValues(key);
|
|
3314
|
+
set.add(vm);
|
|
3315
|
+
}
|
|
3316
|
+
delete(key) {
|
|
3317
|
+
this._map.delete(key);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
// This implementation relies on the WeakRef/FinalizationRegistry proposal.
|
|
3321
|
+
// For some background, see: https://github.com/tc39/proposal-weakrefs
|
|
3322
|
+
class ModernWeakMultiMap {
|
|
3323
|
+
constructor() {
|
|
3324
|
+
this._map = new WeakMap();
|
|
3325
|
+
this._registry = new FinalizationRegistry(weakRefs => {
|
|
3326
|
+
// This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
|
|
3327
|
+
// JS VMs are not obligated to call FinalizationRegistry callbacks.
|
|
3328
|
+
// Work backwards, removing stale VMs
|
|
3329
|
+
for (let i = weakRefs.length - 1; i >= 0; i--) {
|
|
3330
|
+
const vm = weakRefs[i].deref();
|
|
3331
|
+
if (isUndefined$1(vm)) {
|
|
3332
|
+
ArraySplice.call(weakRefs, i, 1); // remove
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
_getWeakRefs(key) {
|
|
3339
|
+
let weakRefs = this._map.get(key);
|
|
3340
|
+
if (isUndefined$1(weakRefs)) {
|
|
3341
|
+
weakRefs = [];
|
|
3342
|
+
this._map.set(key, weakRefs);
|
|
3343
|
+
}
|
|
3344
|
+
return weakRefs;
|
|
3345
|
+
}
|
|
3346
|
+
get(key) {
|
|
3347
|
+
const weakRefs = this._getWeakRefs(key);
|
|
3348
|
+
const result = new Set();
|
|
3349
|
+
for (const weakRef of weakRefs) {
|
|
3350
|
+
const vm = weakRef.deref();
|
|
3351
|
+
if (!isUndefined$1(vm)) {
|
|
3352
|
+
result.add(vm);
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
return result;
|
|
3356
|
+
}
|
|
3357
|
+
add(key, value) {
|
|
3358
|
+
const weakRefs = this._getWeakRefs(key);
|
|
3359
|
+
// We could check for duplicate values here, but it doesn't seem worth it.
|
|
3360
|
+
// We transform the output into a Set anyway
|
|
3361
|
+
ArrayPush$1.call(weakRefs, new WeakRef(value));
|
|
3362
|
+
// It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
|
|
3363
|
+
// effectively creates a strong reference between the first argument (the "target") and the held value. When
|
|
3364
|
+
// the target is GC'ed, the callback is called, and then the held value is GC'ed.
|
|
3365
|
+
// Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
|
|
3366
|
+
// of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
|
|
3367
|
+
// to anything. See also this example:
|
|
3368
|
+
// https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
|
|
3369
|
+
this._registry.register(value, weakRefs);
|
|
3370
|
+
}
|
|
3371
|
+
delete(key) {
|
|
3372
|
+
this._map.delete(key);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
|
|
3376
|
+
|
|
3438
3377
|
/*
|
|
3439
3378
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
3440
3379
|
* All rights reserved.
|
|
@@ -3444,68 +3383,63 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3444
3383
|
const swappedTemplateMap = new WeakMap();
|
|
3445
3384
|
const swappedComponentMap = new WeakMap();
|
|
3446
3385
|
const swappedStyleMap = new WeakMap();
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3386
|
+
// The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
|
|
3387
|
+
// so we don't want to create strong references to them.
|
|
3388
|
+
// The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
|
|
3389
|
+
// never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
|
|
3390
|
+
const activeTemplates = new WeakMultiMap();
|
|
3391
|
+
const activeComponents = new WeakMultiMap();
|
|
3392
|
+
const activeStyles = new WeakMultiMap();
|
|
3450
3393
|
function rehydrateHotTemplate(tpl) {
|
|
3451
3394
|
const list = activeTemplates.get(tpl);
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
}
|
|
3459
|
-
});
|
|
3460
|
-
// resetting the Set to release the memory of those vm references
|
|
3461
|
-
// since they are not longer related to this template, instead
|
|
3462
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3463
|
-
list.clear();
|
|
3395
|
+
for (const vm of list) {
|
|
3396
|
+
if (isFalse(vm.isDirty)) {
|
|
3397
|
+
// forcing the vm to rehydrate in the micro-task:
|
|
3398
|
+
markComponentAsDirty(vm);
|
|
3399
|
+
scheduleRehydration(vm);
|
|
3400
|
+
}
|
|
3464
3401
|
}
|
|
3402
|
+
// Resetting the Set since these VMs are no longer related to this template, instead
|
|
3403
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3404
|
+
activeTemplates.delete(tpl);
|
|
3465
3405
|
return true;
|
|
3466
3406
|
}
|
|
3467
3407
|
function rehydrateHotStyle(style) {
|
|
3468
3408
|
const list = activeStyles.get(style);
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3478
|
-
list.clear();
|
|
3479
|
-
}
|
|
3409
|
+
for (const vm of list) {
|
|
3410
|
+
// if a style definition is swapped, we must reset
|
|
3411
|
+
// vm's template content in the next micro-task:
|
|
3412
|
+
forceRehydration(vm);
|
|
3413
|
+
}
|
|
3414
|
+
// Resetting the Set since these VMs are no longer related to this style, instead
|
|
3415
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3416
|
+
activeStyles.delete(style);
|
|
3480
3417
|
return true;
|
|
3481
3418
|
}
|
|
3482
3419
|
function rehydrateHotComponent(Ctor) {
|
|
3483
3420
|
const list = activeComponents.get(Ctor);
|
|
3484
3421
|
let canRefreshAllInstances = true;
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
if
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3507
|
-
list.clear();
|
|
3508
|
-
}
|
|
3422
|
+
for (const vm of list) {
|
|
3423
|
+
const {
|
|
3424
|
+
owner
|
|
3425
|
+
} = vm;
|
|
3426
|
+
if (!isNull(owner)) {
|
|
3427
|
+
// if a component class definition is swapped, we must reset
|
|
3428
|
+
// owner's template content in the next micro-task:
|
|
3429
|
+
forceRehydration(owner);
|
|
3430
|
+
} else {
|
|
3431
|
+
// the hot swapping for components only work for instances of components
|
|
3432
|
+
// created from a template, root elements can't be swapped because we
|
|
3433
|
+
// don't have a way to force the creation of the element with the same state
|
|
3434
|
+
// of the current element.
|
|
3435
|
+
// Instead, we can report the problem to the caller so it can take action,
|
|
3436
|
+
// for example: reload the entire page.
|
|
3437
|
+
canRefreshAllInstances = false;
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
// resetting the Set since these VMs are no longer related to this constructor, instead
|
|
3441
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3442
|
+
activeComponents.delete(Ctor);
|
|
3509
3443
|
return canRefreshAllInstances;
|
|
3510
3444
|
}
|
|
3511
3445
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
@@ -3539,72 +3473,27 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3539
3473
|
assertNotProd(); // this method should never leak to prod
|
|
3540
3474
|
// tracking active component
|
|
3541
3475
|
const Ctor = vm.def.ctor;
|
|
3542
|
-
let componentVMs = activeComponents.get(Ctor);
|
|
3543
|
-
if (isUndefined$1(componentVMs)) {
|
|
3544
|
-
componentVMs = new Set();
|
|
3545
|
-
activeComponents.set(Ctor, componentVMs);
|
|
3546
|
-
}
|
|
3547
3476
|
// this will allow us to keep track of the hot components
|
|
3548
|
-
|
|
3477
|
+
activeComponents.add(Ctor, vm);
|
|
3549
3478
|
// tracking active template
|
|
3550
3479
|
const tpl = vm.cmpTemplate;
|
|
3551
3480
|
if (tpl) {
|
|
3552
|
-
let templateVMs = activeTemplates.get(tpl);
|
|
3553
|
-
if (isUndefined$1(templateVMs)) {
|
|
3554
|
-
templateVMs = new Set();
|
|
3555
|
-
activeTemplates.set(tpl, templateVMs);
|
|
3556
|
-
}
|
|
3557
3481
|
// this will allow us to keep track of the templates that are
|
|
3558
3482
|
// being used by a hot component
|
|
3559
|
-
|
|
3483
|
+
activeTemplates.add(tpl, vm);
|
|
3560
3484
|
// tracking active styles associated to template
|
|
3561
3485
|
const stylesheets = tpl.stylesheets;
|
|
3562
3486
|
if (!isUndefined$1(stylesheets)) {
|
|
3563
|
-
flattenStylesheets(stylesheets)
|
|
3487
|
+
for (const stylesheet of flattenStylesheets(stylesheets)) {
|
|
3564
3488
|
// this is necessary because we don't hold the list of styles
|
|
3565
3489
|
// in the vm, we only hold the selected (already swapped template)
|
|
3566
3490
|
// but the styles attached to the template might not be the actual
|
|
3567
3491
|
// active ones, but the swapped versions of those.
|
|
3568
|
-
|
|
3569
|
-
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
3570
|
-
if (isUndefined$1(stylesheetVMs)) {
|
|
3571
|
-
stylesheetVMs = new Set();
|
|
3572
|
-
activeStyles.set(stylesheet, stylesheetVMs);
|
|
3573
|
-
}
|
|
3492
|
+
const swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3574
3493
|
// this will allow us to keep track of the stylesheet that are
|
|
3575
3494
|
// being used by a hot component
|
|
3576
|
-
|
|
3577
|
-
}
|
|
3578
|
-
}
|
|
3579
|
-
}
|
|
3580
|
-
}
|
|
3581
|
-
function removeActiveVM(vm) {
|
|
3582
|
-
assertNotProd(); // this method should never leak to prod
|
|
3583
|
-
// tracking inactive component
|
|
3584
|
-
const Ctor = vm.def.ctor;
|
|
3585
|
-
let list = activeComponents.get(Ctor);
|
|
3586
|
-
if (!isUndefined$1(list)) {
|
|
3587
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3588
|
-
list.delete(vm);
|
|
3589
|
-
}
|
|
3590
|
-
// removing inactive template
|
|
3591
|
-
const tpl = vm.cmpTemplate;
|
|
3592
|
-
if (tpl) {
|
|
3593
|
-
list = activeTemplates.get(tpl);
|
|
3594
|
-
if (!isUndefined$1(list)) {
|
|
3595
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3596
|
-
list.delete(vm);
|
|
3597
|
-
}
|
|
3598
|
-
// removing active styles associated to template
|
|
3599
|
-
const styles = tpl.stylesheets;
|
|
3600
|
-
if (!isUndefined$1(styles)) {
|
|
3601
|
-
flattenStylesheets(styles).forEach(style => {
|
|
3602
|
-
list = activeStyles.get(style);
|
|
3603
|
-
if (!isUndefined$1(list)) {
|
|
3604
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3605
|
-
list.delete(vm);
|
|
3606
|
-
}
|
|
3607
|
-
});
|
|
3495
|
+
activeStyles.add(swappedStylesheet, vm);
|
|
3496
|
+
}
|
|
3608
3497
|
}
|
|
3609
3498
|
}
|
|
3610
3499
|
}
|
|
@@ -3646,6 +3535,14 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3646
3535
|
* SPDX-License-Identifier: MIT
|
|
3647
3536
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3648
3537
|
*/
|
|
3538
|
+
/**
|
|
3539
|
+
* This module is responsible for producing the ComponentDef object that is always
|
|
3540
|
+
* accessible via `vm.def`. This is lazily created during the creation of the first
|
|
3541
|
+
* instance of a component class, and shared across all instances.
|
|
3542
|
+
*
|
|
3543
|
+
* This structure can be used to synthetically create proxies, and understand the
|
|
3544
|
+
* shape of a component. It is also used internally to apply extra optimizations.
|
|
3545
|
+
*/
|
|
3649
3546
|
const CtorToDefMap = new WeakMap();
|
|
3650
3547
|
function getCtorProto(Ctor) {
|
|
3651
3548
|
let proto = getPrototypeOf$1(Ctor);
|
|
@@ -3677,12 +3574,16 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3677
3574
|
const ctorName = Ctor.name;
|
|
3678
3575
|
// Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
3679
3576
|
// assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3577
|
+
if (!Ctor.constructor) {
|
|
3578
|
+
// This error seems impossible to hit, due to an earlier check in `isComponentConstructor()`.
|
|
3579
|
+
// But we keep it here just in case.
|
|
3580
|
+
logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
3683
3581
|
}
|
|
3684
|
-
if (!isUndefined$1(
|
|
3685
|
-
|
|
3582
|
+
if (!isUndefined$1(ctorShadowSupportMode) && ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ && ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */) {
|
|
3583
|
+
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
3584
|
+
}
|
|
3585
|
+
if (!isUndefined$1(ctorRenderMode) && ctorRenderMode !== 'light' && ctorRenderMode !== 'shadow') {
|
|
3586
|
+
logError(`Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
|
|
3686
3587
|
}
|
|
3687
3588
|
}
|
|
3688
3589
|
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
@@ -3867,6 +3768,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
3867
3768
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3868
3769
|
*/
|
|
3869
3770
|
function makeHostToken(token) {
|
|
3771
|
+
// Note: if this ever changes, update the `cssScopeTokens` returned by `@lwc/compiler`
|
|
3870
3772
|
return `${token}-host`;
|
|
3871
3773
|
}
|
|
3872
3774
|
function createInlineStyleVNode(content) {
|
|
@@ -4120,15 +4022,17 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4120
4022
|
* SPDX-License-Identifier: MIT
|
|
4121
4023
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4122
4024
|
*/
|
|
4123
|
-
const ColonCharCode
|
|
4025
|
+
const ColonCharCode = 58;
|
|
4124
4026
|
function patchAttributes(oldVnode, vnode, renderer) {
|
|
4125
4027
|
const {
|
|
4126
|
-
attrs
|
|
4028
|
+
attrs,
|
|
4029
|
+
external
|
|
4127
4030
|
} = vnode.data;
|
|
4128
4031
|
if (isUndefined$1(attrs)) {
|
|
4129
4032
|
return;
|
|
4130
4033
|
}
|
|
4131
4034
|
const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
|
|
4035
|
+
// Attrs may be the same due to the static content optimization, so we can skip diffing
|
|
4132
4036
|
if (oldAttrs === attrs) {
|
|
4133
4037
|
return;
|
|
4134
4038
|
}
|
|
@@ -4137,17 +4041,23 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4137
4041
|
} = vnode;
|
|
4138
4042
|
const {
|
|
4139
4043
|
setAttribute,
|
|
4140
|
-
removeAttribute
|
|
4044
|
+
removeAttribute,
|
|
4045
|
+
setProperty
|
|
4141
4046
|
} = renderer;
|
|
4142
4047
|
for (const key in attrs) {
|
|
4143
4048
|
const cur = attrs[key];
|
|
4144
4049
|
const old = oldAttrs[key];
|
|
4145
4050
|
if (old !== cur) {
|
|
4146
|
-
|
|
4147
|
-
|
|
4051
|
+
let propName;
|
|
4052
|
+
// For external custom elements, sniff to see if the attr should be considered a prop.
|
|
4053
|
+
// Use kebabCaseToCamelCase directly because we don't want to set props like `ariaLabel` or `tabIndex`
|
|
4054
|
+
// on a custom element versus just using the more reliable attribute format.
|
|
4055
|
+
if (external && (propName = kebabCaseToCamelCase(key)) in elm) {
|
|
4056
|
+
setProperty(elm, propName, cur);
|
|
4057
|
+
} else if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
4148
4058
|
// Assume xml namespace
|
|
4149
4059
|
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
4150
|
-
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode
|
|
4060
|
+
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
4151
4061
|
// Assume xlink namespace
|
|
4152
4062
|
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
4153
4063
|
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
@@ -4155,52 +4065,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4155
4065
|
} else {
|
|
4156
4066
|
setAttribute(elm, key, cur);
|
|
4157
4067
|
}
|
|
4158
|
-
lockAttribute();
|
|
4159
|
-
}
|
|
4160
|
-
}
|
|
4161
|
-
}
|
|
4162
|
-
|
|
4163
|
-
/*
|
|
4164
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4165
|
-
* All rights reserved.
|
|
4166
|
-
* SPDX-License-Identifier: MIT
|
|
4167
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4168
|
-
*/
|
|
4169
|
-
const ColonCharCode = 58;
|
|
4170
|
-
function patchAttrUnlessProp(oldVnode, vnode, renderer) {
|
|
4171
|
-
const {
|
|
4172
|
-
data: {
|
|
4173
|
-
attrs
|
|
4174
|
-
},
|
|
4175
|
-
elm
|
|
4176
|
-
} = vnode;
|
|
4177
|
-
if (isUndefined$1(attrs)) {
|
|
4178
|
-
return;
|
|
4179
|
-
}
|
|
4180
|
-
const {
|
|
4181
|
-
removeAttribute,
|
|
4182
|
-
setAttribute,
|
|
4183
|
-
setProperty
|
|
4184
|
-
} = renderer;
|
|
4185
|
-
const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
|
|
4186
|
-
for (const name in attrs) {
|
|
4187
|
-
const cur = attrs[name];
|
|
4188
|
-
const old = oldAttrs[name];
|
|
4189
|
-
if (old !== cur) {
|
|
4190
|
-
const propName = htmlAttributeToProperty(name);
|
|
4191
|
-
if (propName in elm) {
|
|
4192
|
-
setProperty(elm, name, cur);
|
|
4193
|
-
} else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
|
|
4194
|
-
// Assume xml namespace
|
|
4195
|
-
setAttribute(elm, name, cur, XML_NAMESPACE);
|
|
4196
|
-
} else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
|
|
4197
|
-
// Assume xlink namespace
|
|
4198
|
-
setAttribute(elm, name, cur, XLINK_NAMESPACE);
|
|
4199
|
-
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
4200
|
-
removeAttribute(elm, name);
|
|
4201
|
-
} else {
|
|
4202
|
-
setAttribute(elm, name, cur);
|
|
4203
|
-
}
|
|
4204
4068
|
}
|
|
4205
4069
|
}
|
|
4206
4070
|
}
|
|
@@ -4230,6 +4094,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4230
4094
|
if (!isNull(oldVnode)) {
|
|
4231
4095
|
oldProps = oldVnode.data.props;
|
|
4232
4096
|
const oldSpread = oldVnode.data.spread;
|
|
4097
|
+
// Props may be the same due to the static content optimization, so we can skip diffing
|
|
4233
4098
|
if (oldProps === props && oldSpread === spread) {
|
|
4234
4099
|
return;
|
|
4235
4100
|
}
|
|
@@ -4378,12 +4243,11 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4378
4243
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4379
4244
|
*/
|
|
4380
4245
|
function applyEventListeners(vnode, renderer) {
|
|
4246
|
+
var _a;
|
|
4381
4247
|
const {
|
|
4382
|
-
elm
|
|
4383
|
-
data: {
|
|
4384
|
-
on
|
|
4385
|
-
}
|
|
4248
|
+
elm
|
|
4386
4249
|
} = vnode;
|
|
4250
|
+
const on = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.on;
|
|
4387
4251
|
if (isUndefined$1(on)) {
|
|
4388
4252
|
return;
|
|
4389
4253
|
}
|
|
@@ -4471,7 +4335,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4471
4335
|
return;
|
|
4472
4336
|
}
|
|
4473
4337
|
if (process.env.NODE_ENV !== 'production') {
|
|
4474
|
-
if (!isSameVnode(n1, n2)
|
|
4338
|
+
if (!isSameVnode(n1, n2) &&
|
|
4339
|
+
// Currently the only scenario when patch does not receive the same vnodes are for
|
|
4340
|
+
// dynamic components. When a dynamic component's constructor changes, the value of its
|
|
4341
|
+
// tag name (sel) will be different. The engine will unmount the previous element
|
|
4342
|
+
// and mount the new one using the new constructor in patchCustomElement.
|
|
4343
|
+
!(isVCustomElement(n1) && isVCustomElement(n2))) {
|
|
4475
4344
|
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
4476
4345
|
sel: n1.sel,
|
|
4477
4346
|
key: n1.key
|
|
@@ -4573,8 +4442,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4573
4442
|
children
|
|
4574
4443
|
} = vnode;
|
|
4575
4444
|
mountVNodes(children, parent, renderer, anchor);
|
|
4576
|
-
|
|
4577
|
-
vnode.elm = children[children.length - 1].elm;
|
|
4445
|
+
vnode.elm = vnode.leading.elm;
|
|
4578
4446
|
}
|
|
4579
4447
|
function patchFragment(n1, n2, parent, renderer) {
|
|
4580
4448
|
const {
|
|
@@ -4587,7 +4455,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4587
4455
|
updateDynamicChildren(n1.children, children, parent, renderer);
|
|
4588
4456
|
}
|
|
4589
4457
|
// Note: not reusing n1.elm, because during patching, it may be patched with another text node.
|
|
4590
|
-
n2.elm =
|
|
4458
|
+
n2.elm = n2.leading.elm;
|
|
4591
4459
|
}
|
|
4592
4460
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
4593
4461
|
const {
|
|
@@ -4637,6 +4505,8 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4637
4505
|
}
|
|
4638
4506
|
}
|
|
4639
4507
|
insertNode(elm, parent, anchor, renderer);
|
|
4508
|
+
// Event listeners are only applied once when mounting, so they are allowed for static vnodes
|
|
4509
|
+
applyEventListeners(vnode, renderer);
|
|
4640
4510
|
}
|
|
4641
4511
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
4642
4512
|
const {
|
|
@@ -4700,8 +4570,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4700
4570
|
}
|
|
4701
4571
|
}
|
|
4702
4572
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
4573
|
+
// TODO [#3331]: This if branch should be removed in 246 with lwc:dynamic
|
|
4703
4574
|
if (n1.ctor !== n2.ctor) {
|
|
4704
|
-
// If the constructor, unmount the current component and mount a new one using the new
|
|
4575
|
+
// If the constructor differs, unmount the current component and mount a new one using the new
|
|
4705
4576
|
// constructor.
|
|
4706
4577
|
const anchor = renderer.nextSibling(n1.elm);
|
|
4707
4578
|
unmount(n1, parent, renderer, true);
|
|
@@ -4838,6 +4709,25 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4838
4709
|
lockDomMutation();
|
|
4839
4710
|
}
|
|
4840
4711
|
}
|
|
4712
|
+
function insertFragmentOrNode(vnode, parent, anchor, renderer) {
|
|
4713
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4714
|
+
unlockDomMutation();
|
|
4715
|
+
}
|
|
4716
|
+
if (isVFragment(vnode)) {
|
|
4717
|
+
const children = vnode.children;
|
|
4718
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
4719
|
+
const child = children[i];
|
|
4720
|
+
if (!isNull(child)) {
|
|
4721
|
+
renderer.insert(child.elm, parent, anchor);
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
} else {
|
|
4725
|
+
renderer.insert(vnode.elm, parent, anchor);
|
|
4726
|
+
}
|
|
4727
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4728
|
+
lockDomMutation();
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4841
4731
|
function insertNode(node, parent, anchor, renderer) {
|
|
4842
4732
|
if (process.env.NODE_ENV !== 'production') {
|
|
4843
4733
|
unlockDomMutation();
|
|
@@ -4866,11 +4756,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
4866
4756
|
// value is set before type=radio.
|
|
4867
4757
|
patchClassAttribute(oldVnode, vnode, renderer);
|
|
4868
4758
|
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
4869
|
-
|
|
4870
|
-
patchAttrUnlessProp(oldVnode, vnode, renderer);
|
|
4871
|
-
} else {
|
|
4872
|
-
patchAttributes(oldVnode, vnode, renderer);
|
|
4873
|
-
}
|
|
4759
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
4874
4760
|
patchProps(oldVnode, vnode, renderer);
|
|
4875
4761
|
}
|
|
4876
4762
|
function applyStyleScoping(elm, owner, renderer) {
|
|
@@ -5138,13 +5024,23 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5138
5024
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
5139
5025
|
// Vnode moved right
|
|
5140
5026
|
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
5141
|
-
|
|
5027
|
+
// In the case of fragments, the `elm` property of a vfragment points to the leading
|
|
5028
|
+
// anchor. To determine the next sibling of the whole fragment, we need to use the
|
|
5029
|
+
// trailing anchor as the argument to nextSibling():
|
|
5030
|
+
// [..., [leading, ...content, trailing], nextSibling, ...]
|
|
5031
|
+
let anchor;
|
|
5032
|
+
if (isVFragment(oldEndVnode)) {
|
|
5033
|
+
anchor = renderer.nextSibling(oldEndVnode.trailing.elm);
|
|
5034
|
+
} else {
|
|
5035
|
+
anchor = renderer.nextSibling(oldEndVnode.elm);
|
|
5036
|
+
}
|
|
5037
|
+
insertFragmentOrNode(oldStartVnode, parent, anchor, renderer);
|
|
5142
5038
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
5143
5039
|
newEndVnode = newCh[--newEndIdx];
|
|
5144
5040
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
5145
5041
|
// Vnode moved left
|
|
5146
5042
|
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
5147
|
-
|
|
5043
|
+
insertFragmentOrNode(newStartVnode, parent, oldStartVnode.elm, renderer);
|
|
5148
5044
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
5149
5045
|
newStartVnode = newCh[++newStartIdx];
|
|
5150
5046
|
} else {
|
|
@@ -5175,7 +5071,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5175
5071
|
}
|
|
5176
5072
|
// We've already cloned at least once, so it's no longer read-only
|
|
5177
5073
|
oldCh[idxInOld] = undefined;
|
|
5178
|
-
|
|
5074
|
+
insertFragmentOrNode(elmToMove, parent, oldStartVnode.elm, renderer);
|
|
5179
5075
|
}
|
|
5180
5076
|
}
|
|
5181
5077
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -5221,9 +5117,16 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5221
5117
|
if (n2 !== n1) {
|
|
5222
5118
|
if (isVNode(n1)) {
|
|
5223
5119
|
if (isVNode(n2)) {
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5120
|
+
if (isSameVnode(n1, n2)) {
|
|
5121
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
5122
|
+
patch(n1, n2, parent, renderer);
|
|
5123
|
+
anchor = n2.elm;
|
|
5124
|
+
} else {
|
|
5125
|
+
// removing the old vnode since the new one is different
|
|
5126
|
+
unmount(n1, parent, renderer, true);
|
|
5127
|
+
mount(n2, parent, renderer, anchor);
|
|
5128
|
+
anchor = n2.elm;
|
|
5129
|
+
}
|
|
5227
5130
|
} else {
|
|
5228
5131
|
// removing the old vnode since the new one is null
|
|
5229
5132
|
unmount(n1, parent, renderer, true);
|
|
@@ -5259,26 +5162,37 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5259
5162
|
};
|
|
5260
5163
|
}
|
|
5261
5164
|
// [st]atic node
|
|
5262
|
-
function st(fragment, key) {
|
|
5263
|
-
|
|
5165
|
+
function st(fragment, key, data) {
|
|
5166
|
+
const owner = getVMBeingRendered();
|
|
5167
|
+
const vnode = {
|
|
5264
5168
|
type: 4 /* VNodeType.Static */,
|
|
5265
5169
|
sel: undefined,
|
|
5266
5170
|
key,
|
|
5267
5171
|
elm: undefined,
|
|
5268
5172
|
fragment,
|
|
5269
|
-
owner
|
|
5173
|
+
owner,
|
|
5174
|
+
data
|
|
5270
5175
|
};
|
|
5176
|
+
const ref = data === null || data === void 0 ? void 0 : data.ref;
|
|
5177
|
+
if (!isUndefined$1(ref)) {
|
|
5178
|
+
setRefVNode(owner, ref, vnode);
|
|
5179
|
+
}
|
|
5180
|
+
return vnode;
|
|
5271
5181
|
}
|
|
5272
5182
|
// [fr]agment node
|
|
5273
5183
|
function fr(key, children, stable) {
|
|
5184
|
+
const leading = t('');
|
|
5185
|
+
const trailing = t('');
|
|
5274
5186
|
return {
|
|
5275
5187
|
type: 5 /* VNodeType.Fragment */,
|
|
5276
5188
|
sel: undefined,
|
|
5277
5189
|
key,
|
|
5278
5190
|
elm: undefined,
|
|
5279
|
-
children: [
|
|
5191
|
+
children: [leading, ...children, trailing],
|
|
5280
5192
|
stable,
|
|
5281
|
-
owner: getVMBeingRendered()
|
|
5193
|
+
owner: getVMBeingRendered(),
|
|
5194
|
+
leading,
|
|
5195
|
+
trailing
|
|
5282
5196
|
};
|
|
5283
5197
|
}
|
|
5284
5198
|
// [h]tml node
|
|
@@ -5365,7 +5279,14 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5365
5279
|
// undefined is for root components, but root components cannot accept slotted content
|
|
5366
5280
|
setVMBeingRendered(slotset.owner);
|
|
5367
5281
|
try {
|
|
5368
|
-
|
|
5282
|
+
// The factory function is a template snippet from the slot set owner's template,
|
|
5283
|
+
// hence switch over to the slot set owner's template reactive observer
|
|
5284
|
+
const {
|
|
5285
|
+
tro
|
|
5286
|
+
} = slotset.owner;
|
|
5287
|
+
tro.observe(() => {
|
|
5288
|
+
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
5289
|
+
});
|
|
5369
5290
|
} finally {
|
|
5370
5291
|
setVMBeingRendered(vmBeingRenderedInception);
|
|
5371
5292
|
}
|
|
@@ -5577,7 +5498,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5577
5498
|
return compilerKey + ':' + obj;
|
|
5578
5499
|
case 'object':
|
|
5579
5500
|
if (process.env.NODE_ENV !== 'production') {
|
|
5580
|
-
|
|
5501
|
+
logError(`Invalid key value "${obj}" in ${getVMBeingRendered()}. Key must be a string or number.`);
|
|
5581
5502
|
}
|
|
5582
5503
|
}
|
|
5583
5504
|
}
|
|
@@ -5629,16 +5550,18 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5629
5550
|
return url;
|
|
5630
5551
|
}
|
|
5631
5552
|
/**
|
|
5632
|
-
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
5553
|
+
* [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
5554
|
+
*
|
|
5555
|
+
* TODO [#3331]: remove usage of lwc:dynamic in 246
|
|
5633
5556
|
*/
|
|
5634
|
-
function
|
|
5557
|
+
function ddc(sel, Ctor, data, children = EmptyArray) {
|
|
5635
5558
|
if (process.env.NODE_ENV !== 'production') {
|
|
5636
5559
|
assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
|
|
5637
5560
|
assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
|
|
5638
5561
|
assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 4nd argument data must be an array.`);
|
|
5639
5562
|
}
|
|
5640
5563
|
// null or undefined values should produce a null value in the VNodes
|
|
5641
|
-
if (Ctor
|
|
5564
|
+
if (isNull(Ctor) || isUndefined$1(Ctor)) {
|
|
5642
5565
|
return null;
|
|
5643
5566
|
}
|
|
5644
5567
|
if (!isComponentConstructor(Ctor)) {
|
|
@@ -5646,6 +5569,30 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5646
5569
|
}
|
|
5647
5570
|
return c(sel, Ctor, data, children);
|
|
5648
5571
|
}
|
|
5572
|
+
/**
|
|
5573
|
+
* [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
|
|
5574
|
+
*/
|
|
5575
|
+
function dc(Ctor, data, children = EmptyArray) {
|
|
5576
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5577
|
+
assert.isTrue(isObject(data), `dc() 2nd argument data must be an object.`);
|
|
5578
|
+
assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 3rd argument data must be an array.`);
|
|
5579
|
+
}
|
|
5580
|
+
// Null or undefined values should produce a null value in the VNodes.
|
|
5581
|
+
// This is the only value at compile time as the constructor will not be known.
|
|
5582
|
+
if (isNull(Ctor) || isUndefined$1(Ctor)) {
|
|
5583
|
+
return null;
|
|
5584
|
+
}
|
|
5585
|
+
if (!isComponentConstructor(Ctor)) {
|
|
5586
|
+
throw new Error(`Invalid constructor ${toString$1(Ctor)} is not a LightningElement constructor.`);
|
|
5587
|
+
}
|
|
5588
|
+
// Look up the dynamic component's name at runtime once the constructor is available.
|
|
5589
|
+
// This information is only known at runtime and is stored as part of registerComponent.
|
|
5590
|
+
const sel = getComponentRegisteredName(Ctor);
|
|
5591
|
+
if (isUndefined$1(sel) || sel === '') {
|
|
5592
|
+
throw new Error(`Invalid LWC constructor ${toString$1(Ctor)} does not have a registered name`);
|
|
5593
|
+
}
|
|
5594
|
+
return c(sel, Ctor, data, children);
|
|
5595
|
+
}
|
|
5649
5596
|
/**
|
|
5650
5597
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
5651
5598
|
* to the engine that a particular collection of children must be diffed using the slow
|
|
@@ -5707,7 +5654,8 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5707
5654
|
gid,
|
|
5708
5655
|
fid,
|
|
5709
5656
|
shc,
|
|
5710
|
-
ssf
|
|
5657
|
+
ssf,
|
|
5658
|
+
ddc
|
|
5711
5659
|
});
|
|
5712
5660
|
|
|
5713
5661
|
/*
|
|
@@ -5819,30 +5767,29 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5819
5767
|
function setVMBeingRendered(vm) {
|
|
5820
5768
|
vmBeingRendered = vm;
|
|
5821
5769
|
}
|
|
5822
|
-
function validateSlots(vm
|
|
5770
|
+
function validateSlots(vm) {
|
|
5823
5771
|
assertNotProd(); // this method should never leak to prod
|
|
5824
5772
|
const {
|
|
5825
5773
|
cmpSlots
|
|
5826
5774
|
} = vm;
|
|
5827
|
-
const {
|
|
5828
|
-
slots = EmptyArray
|
|
5829
|
-
} = html;
|
|
5830
5775
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
5831
5776
|
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5832
5777
|
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}.`);
|
|
5833
|
-
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
5834
|
-
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
5835
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5836
|
-
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
5837
|
-
}
|
|
5838
5778
|
}
|
|
5839
5779
|
}
|
|
5840
5780
|
function validateLightDomTemplate(template, vm) {
|
|
5841
|
-
|
|
5781
|
+
assertNotProd(); // should never leak to prod mode
|
|
5782
|
+
if (template === defaultEmptyTemplate) {
|
|
5783
|
+
return;
|
|
5784
|
+
}
|
|
5842
5785
|
if (vm.renderMode === 0 /* RenderMode.Light */) {
|
|
5843
|
-
|
|
5786
|
+
if (template.renderMode !== 'light') {
|
|
5787
|
+
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)}.`);
|
|
5788
|
+
}
|
|
5844
5789
|
} else {
|
|
5845
|
-
|
|
5790
|
+
if (!isUndefined$1(template.renderMode)) {
|
|
5791
|
+
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"`);
|
|
5792
|
+
}
|
|
5846
5793
|
}
|
|
5847
5794
|
}
|
|
5848
5795
|
function buildParseFragmentFn(createFragmentFn) {
|
|
@@ -5972,7 +5919,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5972
5919
|
}
|
|
5973
5920
|
if (process.env.NODE_ENV !== 'production') {
|
|
5974
5921
|
// validating slots in every rendering since the allocated content might change over time
|
|
5975
|
-
validateSlots(vm
|
|
5922
|
+
validateSlots(vm);
|
|
5976
5923
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5977
5924
|
setActiveVM(vm);
|
|
5978
5925
|
}
|
|
@@ -5998,7 +5945,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
5998
5945
|
logOperationEnd(1 /* OperationId.Render */, vm);
|
|
5999
5946
|
});
|
|
6000
5947
|
if (process.env.NODE_ENV !== 'production') {
|
|
6001
|
-
|
|
5948
|
+
if (!isArray$1(vnodes)) {
|
|
5949
|
+
logError(`Compiler should produce html functions that always return an array.`);
|
|
5950
|
+
}
|
|
6002
5951
|
}
|
|
6003
5952
|
return vnodes;
|
|
6004
5953
|
}
|
|
@@ -6128,30 +6077,34 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
6128
6077
|
* SPDX-License-Identifier: MIT
|
|
6129
6078
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6130
6079
|
*/
|
|
6131
|
-
const
|
|
6080
|
+
const registeredComponentMap = new Map();
|
|
6132
6081
|
/**
|
|
6133
6082
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
6134
6083
|
* will prevent this function from being imported by userland code.
|
|
6135
6084
|
*/
|
|
6136
6085
|
function registerComponent(
|
|
6137
6086
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
6138
|
-
Ctor, {
|
|
6139
|
-
tmpl
|
|
6140
|
-
}) {
|
|
6087
|
+
Ctor, metadata) {
|
|
6141
6088
|
if (isFunction$1(Ctor)) {
|
|
6142
6089
|
if (process.env.NODE_ENV !== 'production') {
|
|
6143
6090
|
// There is no point in running this in production, because the version mismatch check relies
|
|
6144
6091
|
// on code comments which are stripped out in production by minifiers
|
|
6145
6092
|
checkVersionMismatch(Ctor, 'component');
|
|
6146
6093
|
}
|
|
6147
|
-
|
|
6094
|
+
// TODO [#3331]: add validation to check the value of metadata.sel is not an empty string.
|
|
6095
|
+
registeredComponentMap.set(Ctor, metadata);
|
|
6148
6096
|
}
|
|
6149
6097
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
6150
6098
|
// without too much transformation
|
|
6151
6099
|
return Ctor;
|
|
6152
6100
|
}
|
|
6153
6101
|
function getComponentRegisteredTemplate(Ctor) {
|
|
6154
|
-
|
|
6102
|
+
var _a;
|
|
6103
|
+
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
|
|
6104
|
+
}
|
|
6105
|
+
function getComponentRegisteredName(Ctor) {
|
|
6106
|
+
var _a;
|
|
6107
|
+
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
|
|
6155
6108
|
}
|
|
6156
6109
|
function getTemplateReactiveObserver(vm) {
|
|
6157
6110
|
return createReactiveObserver(() => {
|
|
@@ -6298,9 +6251,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
6298
6251
|
runChildNodesDisconnectedCallback(vm);
|
|
6299
6252
|
runLightChildNodesDisconnectedCallback(vm);
|
|
6300
6253
|
}
|
|
6301
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6302
|
-
removeActiveVM(vm);
|
|
6303
|
-
}
|
|
6304
6254
|
}
|
|
6305
6255
|
// this method is triggered by the diffing algo only when a vnode from the
|
|
6306
6256
|
// old vnode.children is removed from the DOM.
|
|
@@ -7090,7 +7040,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7090
7040
|
hasMismatch = false;
|
|
7091
7041
|
runConnectedCallback(vm);
|
|
7092
7042
|
hydrateVM(vm);
|
|
7093
|
-
if (hasMismatch) {
|
|
7043
|
+
if (hasMismatch && process.env.NODE_ENV !== 'production') {
|
|
7094
7044
|
logError('Hydration completed with errors.', vm);
|
|
7095
7045
|
}
|
|
7096
7046
|
}
|
|
@@ -7136,8 +7086,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7136
7086
|
return renderer.nextSibling(hydratedNode);
|
|
7137
7087
|
}
|
|
7138
7088
|
const NODE_VALUE_PROP = 'nodeValue';
|
|
7139
|
-
const PARENT_NODE_PROP = 'parentNode';
|
|
7140
|
-
const TAG_NAME_PROP = 'tagName';
|
|
7141
7089
|
function textNodeContentsAreEqual(node, vnode, renderer) {
|
|
7142
7090
|
const {
|
|
7143
7091
|
getProperty
|
|
@@ -7151,24 +7099,31 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7151
7099
|
if (nodeValue === '\u200D' && vnode.text === '') {
|
|
7152
7100
|
return true;
|
|
7153
7101
|
}
|
|
7154
|
-
// Special case for text nodes inside `<style>` tags – these are escaped when rendered server-size,
|
|
7155
|
-
// but not when generated by the engine client-side.
|
|
7156
|
-
const parentNode = getProperty(node, PARENT_NODE_PROP);
|
|
7157
|
-
// Should never be null, but just to be safe, we check.
|
|
7158
|
-
/* istanbul ignore else */
|
|
7159
|
-
if (!isNull(parentNode)) {
|
|
7160
|
-
const tagName = getProperty(parentNode, TAG_NAME_PROP);
|
|
7161
|
-
// If the tagName is STYLE, then the following condition should always be true.
|
|
7162
|
-
// The LWC compiler blocks using `<style>`s inside of templates, so it should be impossible
|
|
7163
|
-
// for component authors to render different `<style>` text content on the client and server.
|
|
7164
|
-
// But just to be safe, we check.
|
|
7165
|
-
/* istanbul ignore next */
|
|
7166
|
-
if (tagName === 'STYLE' && htmlEscape(vnode.text) === nodeValue) {
|
|
7167
|
-
return true;
|
|
7168
|
-
}
|
|
7169
|
-
}
|
|
7170
7102
|
return false;
|
|
7171
7103
|
}
|
|
7104
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
7105
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
7106
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
7107
|
+
function getValidationPredicate(optOutStaticProp) {
|
|
7108
|
+
if (isUndefined$1(optOutStaticProp)) {
|
|
7109
|
+
return _attrName => true;
|
|
7110
|
+
}
|
|
7111
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
7112
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
7113
|
+
if (isTrue(optOutStaticProp)) {
|
|
7114
|
+
return _attrName => false;
|
|
7115
|
+
}
|
|
7116
|
+
// If validationOptOut is an array of strings, attributes specified in the
|
|
7117
|
+
// array will be "opted out". Attributes not specified in the array will still
|
|
7118
|
+
// be validated.
|
|
7119
|
+
if (isArray$1(optOutStaticProp) && arrayEvery(optOutStaticProp, isString)) {
|
|
7120
|
+
return attrName => !ArrayIncludes.call(optOutStaticProp, attrName);
|
|
7121
|
+
}
|
|
7122
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7123
|
+
logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
|
|
7124
|
+
}
|
|
7125
|
+
return _attrName => true;
|
|
7126
|
+
}
|
|
7172
7127
|
function hydrateText(node, vnode, renderer) {
|
|
7173
7128
|
var _a;
|
|
7174
7129
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -7208,10 +7163,11 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7208
7163
|
return node;
|
|
7209
7164
|
}
|
|
7210
7165
|
function hydrateStaticElement(elm, vnode, renderer) {
|
|
7211
|
-
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
7166
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) || !areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
7212
7167
|
return handleMismatch(elm, vnode, renderer);
|
|
7213
7168
|
}
|
|
7214
7169
|
vnode.elm = elm;
|
|
7170
|
+
applyEventListeners(vnode, renderer);
|
|
7215
7171
|
return elm;
|
|
7216
7172
|
}
|
|
7217
7173
|
function hydrateFragment(elm, vnode, renderer) {
|
|
@@ -7268,7 +7224,20 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7268
7224
|
return elm;
|
|
7269
7225
|
}
|
|
7270
7226
|
function hydrateCustomElement(elm, vnode, renderer) {
|
|
7271
|
-
|
|
7227
|
+
const {
|
|
7228
|
+
validationOptOut
|
|
7229
|
+
} = vnode.ctor;
|
|
7230
|
+
const shouldValidateAttr = getValidationPredicate(validationOptOut);
|
|
7231
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
7232
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
7233
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
7234
|
+
//
|
|
7235
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
7236
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
7237
|
+
//
|
|
7238
|
+
// Therefore, if validationOptOut is falsey or an array of strings, we need to
|
|
7239
|
+
// examine some or all of the custom element's attributes.
|
|
7240
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) || !isMatchingElement(vnode, elm, renderer, shouldValidateAttr)) {
|
|
7272
7241
|
return handleMismatch(elm, vnode, renderer);
|
|
7273
7242
|
}
|
|
7274
7243
|
const {
|
|
@@ -7306,7 +7275,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7306
7275
|
function hydrateChildren(node, children, parentNode, owner) {
|
|
7307
7276
|
let hasWarned = false;
|
|
7308
7277
|
let nextNode = node;
|
|
7309
|
-
let anchor = null;
|
|
7310
7278
|
const {
|
|
7311
7279
|
renderer
|
|
7312
7280
|
} = owner;
|
|
@@ -7315,7 +7283,6 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7315
7283
|
if (!isNull(childVnode)) {
|
|
7316
7284
|
if (nextNode) {
|
|
7317
7285
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
7318
|
-
anchor = childVnode.elm;
|
|
7319
7286
|
} else {
|
|
7320
7287
|
hasMismatch = true;
|
|
7321
7288
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -7324,8 +7291,8 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7324
7291
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
7325
7292
|
}
|
|
7326
7293
|
}
|
|
7327
|
-
mount(childVnode, parentNode, renderer,
|
|
7328
|
-
|
|
7294
|
+
mount(childVnode, parentNode, renderer, nextNode);
|
|
7295
|
+
nextNode = renderer.nextSibling(childVnode.elm);
|
|
7329
7296
|
}
|
|
7330
7297
|
}
|
|
7331
7298
|
}
|
|
@@ -7376,7 +7343,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7376
7343
|
}
|
|
7377
7344
|
return true;
|
|
7378
7345
|
}
|
|
7379
|
-
function isMatchingElement(vnode, elm, renderer) {
|
|
7346
|
+
function isMatchingElement(vnode, elm, renderer, shouldValidateAttr = () => true) {
|
|
7380
7347
|
const {
|
|
7381
7348
|
getProperty
|
|
7382
7349
|
} = renderer;
|
|
@@ -7386,10 +7353,10 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7386
7353
|
}
|
|
7387
7354
|
return false;
|
|
7388
7355
|
}
|
|
7389
|
-
const
|
|
7390
|
-
const
|
|
7391
|
-
const
|
|
7392
|
-
return
|
|
7356
|
+
const hasCompatibleAttrs = validateAttrs(vnode, elm, renderer, shouldValidateAttr);
|
|
7357
|
+
const hasCompatibleClass = shouldValidateAttr('class') ? validateClassAttr(vnode, elm, renderer) : true;
|
|
7358
|
+
const hasCompatibleStyle = shouldValidateAttr('style') ? validateStyleAttr(vnode, elm, renderer) : true;
|
|
7359
|
+
return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
|
|
7393
7360
|
}
|
|
7394
7361
|
function attributeValuesAreEqual(vnodeValue, value) {
|
|
7395
7362
|
const vnodeValueAsString = String(vnodeValue);
|
|
@@ -7404,7 +7371,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7404
7371
|
// In all other cases, the two values are not considered equal
|
|
7405
7372
|
return false;
|
|
7406
7373
|
}
|
|
7407
|
-
function validateAttrs(vnode, elm, renderer) {
|
|
7374
|
+
function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
|
|
7408
7375
|
const {
|
|
7409
7376
|
data: {
|
|
7410
7377
|
attrs = {}
|
|
@@ -7414,6 +7381,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7414
7381
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
7415
7382
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
7416
7383
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
7384
|
+
if (!shouldValidateAttr(attrName)) {
|
|
7385
|
+
continue;
|
|
7386
|
+
}
|
|
7417
7387
|
const {
|
|
7418
7388
|
owner
|
|
7419
7389
|
} = vnode;
|
|
@@ -7444,7 +7414,8 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7444
7414
|
} = data;
|
|
7445
7415
|
const {
|
|
7446
7416
|
getProperty,
|
|
7447
|
-
getClassList
|
|
7417
|
+
getClassList,
|
|
7418
|
+
getAttribute
|
|
7448
7419
|
} = renderer;
|
|
7449
7420
|
const scopedToken = getScopeTokenClass(owner);
|
|
7450
7421
|
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
@@ -7477,11 +7448,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7477
7448
|
}
|
|
7478
7449
|
let nodesAreCompatible = true;
|
|
7479
7450
|
let readableVnodeClassname;
|
|
7480
|
-
const elmClassName =
|
|
7451
|
+
const elmClassName = getAttribute(elm, 'class');
|
|
7481
7452
|
if (!isUndefined$1(className) && String(className) !== elmClassName) {
|
|
7482
7453
|
// className is used when class is bound to an expr.
|
|
7483
7454
|
nodesAreCompatible = false;
|
|
7484
|
-
|
|
7455
|
+
// stringify for pretty-printing
|
|
7456
|
+
readableVnodeClassname = JSON.stringify(className);
|
|
7485
7457
|
} else if (!isUndefined$1(classMap)) {
|
|
7486
7458
|
// classMap is used when class is set to static value.
|
|
7487
7459
|
const classList = getClassList(elm);
|
|
@@ -7493,18 +7465,19 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7493
7465
|
nodesAreCompatible = false;
|
|
7494
7466
|
}
|
|
7495
7467
|
}
|
|
7496
|
-
|
|
7468
|
+
// stringify for pretty-printing
|
|
7469
|
+
readableVnodeClassname = JSON.stringify(computedClassName.trim());
|
|
7497
7470
|
if (classList.length > keys(classMap).length) {
|
|
7498
7471
|
nodesAreCompatible = false;
|
|
7499
7472
|
}
|
|
7500
|
-
} else if (isUndefined$1(className) && elmClassName
|
|
7473
|
+
} else if (isUndefined$1(className) && !isNull(elmClassName)) {
|
|
7501
7474
|
// SSR contains a className but client-side VDOM does not
|
|
7502
7475
|
nodesAreCompatible = false;
|
|
7503
|
-
readableVnodeClassname = '';
|
|
7476
|
+
readableVnodeClassname = '""';
|
|
7504
7477
|
}
|
|
7505
7478
|
if (!nodesAreCompatible) {
|
|
7506
7479
|
if (process.env.NODE_ENV !== 'production') {
|
|
7507
|
-
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected
|
|
7480
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected ${readableVnodeClassname} but found ${JSON.stringify(elmClassName)}`, vnode.owner);
|
|
7508
7481
|
}
|
|
7509
7482
|
}
|
|
7510
7483
|
return nodesAreCompatible;
|
|
@@ -7586,7 +7559,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7586
7559
|
const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
|
|
7587
7560
|
clientAttrsNames.forEach(attrName => {
|
|
7588
7561
|
if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
|
|
7589
|
-
|
|
7562
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7563
|
+
logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
|
|
7564
|
+
}
|
|
7590
7565
|
isCompatibleElements = false;
|
|
7591
7566
|
}
|
|
7592
7567
|
});
|
|
@@ -7841,12 +7816,12 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
7841
7816
|
if (process.env.NODE_ENV !== 'production') {
|
|
7842
7817
|
// TODO [#1292]: Remove the readonly decorator
|
|
7843
7818
|
if (arguments.length !== 1) {
|
|
7844
|
-
|
|
7819
|
+
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.');
|
|
7845
7820
|
}
|
|
7846
7821
|
}
|
|
7847
7822
|
return getReadOnlyProxy(obj);
|
|
7848
7823
|
}
|
|
7849
|
-
|
|
7824
|
+
/** version: 2.50.0 */
|
|
7850
7825
|
|
|
7851
7826
|
/*
|
|
7852
7827
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8091,7 +8066,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8091
8066
|
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
8092
8067
|
// which are not equipped to be initialized that way.
|
|
8093
8068
|
class clazz extends HTMLElementAlias {
|
|
8094
|
-
/*LWC compiler v2.
|
|
8069
|
+
/*LWC compiler v2.50.0*/
|
|
8095
8070
|
}
|
|
8096
8071
|
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
8097
8072
|
new clazz();
|
|
@@ -8149,7 +8124,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8149
8124
|
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
8150
8125
|
}
|
|
8151
8126
|
}
|
|
8152
|
-
/*LWC compiler v2.
|
|
8127
|
+
/*LWC compiler v2.50.0*/
|
|
8153
8128
|
}
|
|
8154
8129
|
// Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
|
|
8155
8130
|
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
|
@@ -8230,8 +8205,9 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8230
8205
|
*/
|
|
8231
8206
|
function rendererFactory(baseRenderer) {
|
|
8232
8207
|
const renderer = function (exports) {
|
|
8208
|
+
/* proxy-compat-disable */
|
|
8233
8209
|
/**
|
|
8234
|
-
* Copyright (C)
|
|
8210
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
8235
8211
|
*/
|
|
8236
8212
|
/*
|
|
8237
8213
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8270,7 +8246,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8270
8246
|
function isNull(obj) {
|
|
8271
8247
|
return obj === null;
|
|
8272
8248
|
}
|
|
8273
|
-
/** version: 2.
|
|
8249
|
+
/** version: 2.50.0 */
|
|
8274
8250
|
|
|
8275
8251
|
/*
|
|
8276
8252
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -8290,7 +8266,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8290
8266
|
this.setNewContext = setNewContext;
|
|
8291
8267
|
this.setDisconnectedCallback = setDisconnectedCallback;
|
|
8292
8268
|
}
|
|
8293
|
-
/*LWC compiler v2.
|
|
8269
|
+
/*LWC compiler v2.50.0*/
|
|
8294
8270
|
}
|
|
8295
8271
|
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
|
8296
8272
|
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
|
@@ -8680,7 +8656,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8680
8656
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
8681
8657
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
|
8682
8658
|
}
|
|
8683
|
-
/*LWC compiler v2.
|
|
8659
|
+
/*LWC compiler v2.50.0*/
|
|
8684
8660
|
}, _a.observedAttributes = observedAttributes, _a;
|
|
8685
8661
|
}
|
|
8686
8662
|
|
|
@@ -8894,7 +8870,7 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8894
8870
|
});
|
|
8895
8871
|
});
|
|
8896
8872
|
}
|
|
8897
|
-
|
|
8873
|
+
/** version: 2.50.0 */
|
|
8898
8874
|
|
|
8899
8875
|
exports.LightningElement = LightningElement;
|
|
8900
8876
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -8931,4 +8907,4 @@ LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
|
8931
8907
|
|
|
8932
8908
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8933
8909
|
|
|
8934
|
-
});
|
|
8910
|
+
}));
|