@lwrjs/everywhere 0.12.0-alpha.2 → 0.12.0-alpha.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -1
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/4566daf7b8cc8ea3da69bc9cac33bfc9/config.js +7 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_21/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{5_1_0/s/aff256c8afef6eb76ff8626ad5f54e3b → 6_2_1/s/2670f5386c68fa67ae710174187505e9}/lwc.js +812 -300
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/s/274c8343f810353bbad085a79709395f/lwr_metrics.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_12_0-alpha_2/s/f3a204ef43fb3057d910f80d7e9f9ba7 → 0_12_0-alpha_21/s/ec0fad0e38a96bb0b88c9f4553460347}/lwr_preInit.js +4 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_12_0-alpha_21/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +89 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_12_0-alpha_2 → 0_12_0-alpha_21}/lwr-loader-shim.bundle.js +10 -9
- package/build/assets/amd/lwr-everywhere-debug.js +11 -11
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +11 -11
- package/build/assets/core/lwr-everywhere-debug.js +7 -7
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +7 -7
- package/build/assets/esm/lwr-everywhere-debug.js +1 -1
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +1 -1
- package/package.json +9 -9
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/3f1cbc09dcda95f1f74fba817c81fa86/config.js +0 -11
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_2/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/0_12_0-alpha_2/s/e11ffe74ed86b1153c4eb8b001587909/lwr_loader.js +0 -1396
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_12_0-alpha_2/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +0 -99
@@ -1,10 +1,10 @@
|
|
1
|
-
LWR.define('lwc/v/
|
1
|
+
LWR.define('lwc/v/6_2_1', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* Copyright (
|
4
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
5
5
|
*/
|
6
6
|
/**
|
7
|
-
* Copyright (
|
7
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
8
8
|
*/
|
9
9
|
/*
|
10
10
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -12,21 +12,40 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
12
12
|
* SPDX-License-Identifier: MIT
|
13
13
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
14
14
|
*/
|
15
|
+
/**
|
16
|
+
*
|
17
|
+
* @param value
|
18
|
+
* @param msg
|
19
|
+
*/
|
15
20
|
function invariant(value, msg) {
|
16
21
|
if (!value) {
|
17
22
|
throw new Error(`Invariant Violation: ${msg}`);
|
18
23
|
}
|
19
24
|
}
|
25
|
+
/**
|
26
|
+
*
|
27
|
+
* @param value
|
28
|
+
* @param msg
|
29
|
+
*/
|
20
30
|
function isTrue$1(value, msg) {
|
21
31
|
if (!value) {
|
22
32
|
throw new Error(`Assert Violation: ${msg}`);
|
23
33
|
}
|
24
34
|
}
|
35
|
+
/**
|
36
|
+
*
|
37
|
+
* @param value
|
38
|
+
* @param msg
|
39
|
+
*/
|
25
40
|
function isFalse$1(value, msg) {
|
26
41
|
if (value) {
|
27
42
|
throw new Error(`Assert Violation: ${msg}`);
|
28
43
|
}
|
29
44
|
}
|
45
|
+
/**
|
46
|
+
*
|
47
|
+
* @param msg
|
48
|
+
*/
|
30
49
|
function fail(msg) {
|
31
50
|
throw new Error(msg);
|
32
51
|
}
|
@@ -39,31 +58,50 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
39
58
|
});
|
40
59
|
|
41
60
|
/*
|
42
|
-
* Copyright (c)
|
61
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
43
62
|
* All rights reserved.
|
44
63
|
* SPDX-License-Identifier: MIT
|
45
64
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
46
65
|
*/
|
47
66
|
const {
|
67
|
+
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
|
48
68
|
assign,
|
69
|
+
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
|
49
70
|
create,
|
71
|
+
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
|
50
72
|
defineProperties,
|
73
|
+
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
|
51
74
|
defineProperty,
|
75
|
+
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
|
52
76
|
entries,
|
77
|
+
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
|
53
78
|
freeze,
|
79
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
|
54
80
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
|
81
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
|
55
82
|
getOwnPropertyDescriptors,
|
83
|
+
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
|
56
84
|
getOwnPropertyNames: getOwnPropertyNames$1,
|
85
|
+
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
|
57
86
|
getPrototypeOf: getPrototypeOf$1,
|
87
|
+
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
|
58
88
|
hasOwnProperty: hasOwnProperty$1,
|
89
|
+
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
|
59
90
|
isFrozen,
|
91
|
+
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
|
60
92
|
keys,
|
93
|
+
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
|
61
94
|
seal,
|
95
|
+
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
|
62
96
|
setPrototypeOf
|
63
97
|
} = Object;
|
98
|
+
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
|
64
99
|
const {
|
65
100
|
isArray: isArray$1
|
66
101
|
} = Array;
|
102
|
+
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
|
103
|
+
// though it works fine for one, e.g. isArray), so comments for these are added to the export
|
104
|
+
// statement, rather than this declaration.
|
67
105
|
const {
|
68
106
|
concat: ArrayConcat$1,
|
69
107
|
copyWithin: ArrayCopyWithin,
|
@@ -86,7 +124,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
86
124
|
sort: ArraySort,
|
87
125
|
splice: ArraySplice,
|
88
126
|
unshift: ArrayUnshift,
|
89
|
-
forEach
|
127
|
+
forEach // Weird anomaly!
|
90
128
|
} = Array.prototype;
|
91
129
|
// The type of the return value of Array.prototype.every is `this is T[]`. However, once this
|
92
130
|
// Array method is pulled out of the prototype, the function is now referencing `this` where
|
@@ -94,12 +132,21 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
94
132
|
//
|
95
133
|
// Exposing this helper function is the closest we can get to preserving the usage patterns
|
96
134
|
// of Array.prototype methods used elsewhere in the codebase.
|
135
|
+
/**
|
136
|
+
* Wrapper for {@linkcode Array.prototype.every} that correctly preserves the type predicate in the
|
137
|
+
* return value; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every MDN Reference}.
|
138
|
+
* @param arr Array to test.
|
139
|
+
* @param predicate A function to execute for each element of the array.
|
140
|
+
* @returns Whether all elements in the array pass the test provided by the predicate.
|
141
|
+
*/
|
97
142
|
function arrayEvery(arr, predicate) {
|
98
143
|
return ArrayEvery.call(arr, predicate);
|
99
144
|
}
|
145
|
+
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
|
100
146
|
const {
|
101
147
|
fromCharCode: StringFromCharCode
|
102
148
|
} = String;
|
149
|
+
// No JSDocs here - see comment for Array.prototype
|
103
150
|
const {
|
104
151
|
charCodeAt: StringCharCodeAt,
|
105
152
|
replace: StringReplace,
|
@@ -107,52 +154,124 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
107
154
|
slice: StringSlice,
|
108
155
|
toLowerCase: StringToLowerCase
|
109
156
|
} = String.prototype;
|
157
|
+
/**
|
158
|
+
* Determines whether the argument is `undefined`.
|
159
|
+
* @param obj Value to test
|
160
|
+
* @returns `true` if the value is `undefined`.
|
161
|
+
*/
|
110
162
|
function isUndefined$1(obj) {
|
111
163
|
return obj === undefined;
|
112
164
|
}
|
165
|
+
/**
|
166
|
+
* Determines whether the argument is `null`.
|
167
|
+
* @param obj Value to test
|
168
|
+
* @returns `true` if the value is `null`.
|
169
|
+
*/
|
113
170
|
function isNull(obj) {
|
114
171
|
return obj === null;
|
115
172
|
}
|
173
|
+
/**
|
174
|
+
* Determines whether the argument is `true`.
|
175
|
+
* @param obj Value to test
|
176
|
+
* @returns `true` if the value is `true`.
|
177
|
+
*/
|
116
178
|
function isTrue(obj) {
|
117
179
|
return obj === true;
|
118
180
|
}
|
181
|
+
/**
|
182
|
+
* Determines whether the argument is `false`.
|
183
|
+
* @param obj Value to test
|
184
|
+
* @returns `true` if the value is `false`.
|
185
|
+
*/
|
119
186
|
function isFalse(obj) {
|
120
187
|
return obj === false;
|
121
188
|
}
|
189
|
+
/**
|
190
|
+
* Determines whether the argument is a boolean.
|
191
|
+
* @param obj Value to test
|
192
|
+
* @returns `true` if the value is a boolean.
|
193
|
+
*/
|
122
194
|
function isBoolean(obj) {
|
123
195
|
return typeof obj === 'boolean';
|
124
196
|
}
|
197
|
+
/**
|
198
|
+
* Determines whether the argument is a function.
|
199
|
+
* @param obj Value to test
|
200
|
+
* @returns `true` if the value is a function.
|
201
|
+
*/
|
202
|
+
// Replacing `Function` with a narrower type that works for all our use cases is tricky...
|
203
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
125
204
|
function isFunction$1(obj) {
|
126
205
|
return typeof obj === 'function';
|
127
206
|
}
|
207
|
+
/**
|
208
|
+
* Determines whether the argument is an object or null.
|
209
|
+
* @param obj Value to test
|
210
|
+
* @returns `true` if the value is an object or null.
|
211
|
+
*/
|
128
212
|
function isObject(obj) {
|
129
213
|
return typeof obj === 'object';
|
130
214
|
}
|
215
|
+
/**
|
216
|
+
* Determines whether the argument is a string.
|
217
|
+
* @param obj Value to test
|
218
|
+
* @returns `true` if the value is a string.
|
219
|
+
*/
|
131
220
|
function isString(obj) {
|
132
221
|
return typeof obj === 'string';
|
133
222
|
}
|
223
|
+
/**
|
224
|
+
* Determines whether the argument is a number.
|
225
|
+
* @param obj Value to test
|
226
|
+
* @returns `true` if the value is a number.
|
227
|
+
*/
|
134
228
|
function isNumber(obj) {
|
135
229
|
return typeof obj === 'number';
|
136
230
|
}
|
231
|
+
/** Does nothing! 🚀 */
|
137
232
|
function noop() {
|
138
233
|
/* Do nothing */
|
139
234
|
}
|
140
235
|
const OtS$1 = {}.toString;
|
236
|
+
/**
|
237
|
+
* Converts the argument to a string, safely accounting for objects with "null" prototype.
|
238
|
+
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
|
239
|
+
* @param obj Value to convert to a string.
|
240
|
+
* @returns String representation of the value.
|
241
|
+
*/
|
141
242
|
function toString$1(obj) {
|
142
|
-
if (obj
|
243
|
+
if (obj?.toString) {
|
143
244
|
// Arrays might hold objects with "null" prototype So using
|
144
245
|
// Array.prototype.toString directly will cause an error Iterate through
|
145
246
|
// all the items and handle individually.
|
146
247
|
if (isArray$1(obj)) {
|
248
|
+
// This behavior is slightly different from Array#toString:
|
249
|
+
// 1. Array#toString calls `this.join`, rather than Array#join
|
250
|
+
// Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
|
251
|
+
// 2. Array#toString delegates to Object#toString if `this.join` is not a function
|
252
|
+
// Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
|
253
|
+
// 3. Array#toString converts null/undefined to ''
|
254
|
+
// Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
|
255
|
+
// 4. Array#toString converts recursive references to arrays to ''
|
256
|
+
// Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
|
257
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
|
147
258
|
return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');
|
148
259
|
}
|
149
260
|
return obj.toString();
|
150
261
|
} else if (typeof obj === 'object') {
|
262
|
+
// This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
|
151
263
|
return OtS$1.call(obj);
|
152
264
|
} else {
|
153
|
-
return obj
|
265
|
+
return String(obj);
|
154
266
|
}
|
155
267
|
}
|
268
|
+
/**
|
269
|
+
* Gets the property descriptor for the given object and property key. Similar to
|
270
|
+
* {@linkcode Object.getOwnPropertyDescriptor}, but looks up the prototype chain.
|
271
|
+
* @param o Value to get the property descriptor for
|
272
|
+
* @param p Property key to get the descriptor for
|
273
|
+
* @returns The property descriptor for the given object and property key.
|
274
|
+
*/
|
156
275
|
function getPropertyDescriptor(o, p) {
|
157
276
|
do {
|
158
277
|
const d = getOwnPropertyDescriptor$1(o, p);
|
@@ -173,6 +292,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
173
292
|
// It's a bit annoying to do have to do this manually, but this makes the file tree-shakeable,
|
174
293
|
// passing the `verify-treeshakeable.js` test.
|
175
294
|
const LOWEST_API_VERSION = 58 /* APIVersion.V58_244_SUMMER_23 */;
|
295
|
+
/**
|
296
|
+
*
|
297
|
+
* @param apiVersionFeature
|
298
|
+
* @param apiVersion
|
299
|
+
*/
|
176
300
|
function isAPIFeatureEnabled(apiVersionFeature, apiVersion) {
|
177
301
|
switch (apiVersionFeature) {
|
178
302
|
case 0 /* APIFeature.LOWERCASE_SCOPE_TOKENS */:
|
@@ -183,6 +307,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
183
307
|
case 4 /* APIFeature.SKIP_UNNECESSARY_REGISTER_DECORATORS */:
|
184
308
|
case 5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */:
|
185
309
|
return apiVersion >= 60 /* APIVersion.V60_248_SPRING_24 */;
|
310
|
+
case 6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */:
|
311
|
+
case 7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */:
|
312
|
+
return apiVersion >= 61 /* APIVersion.V61_250_SUMMER_24 */;
|
186
313
|
}
|
187
314
|
}
|
188
315
|
|
@@ -226,18 +353,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
226
353
|
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
227
354
|
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']);
|
228
355
|
|
229
|
-
/*
|
230
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
231
|
-
* All rights reserved.
|
232
|
-
* SPDX-License-Identifier: MIT
|
233
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
234
|
-
*/
|
235
|
-
// See browser support for globalThis:
|
236
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
237
|
-
/* istanbul ignore next */
|
238
|
-
// @ts-ignore
|
239
|
-
const _globalThis = typeof globalThis === 'object' ? globalThis : window;
|
240
|
-
|
241
356
|
/*
|
242
357
|
* Copyright (c) 2023, Salesforce.com, inc.
|
243
358
|
* All rights reserved.
|
@@ -268,6 +383,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
268
383
|
* Map associating previously transformed HTML property into HTML attribute.
|
269
384
|
*/
|
270
385
|
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/new Map();
|
386
|
+
/**
|
387
|
+
*
|
388
|
+
* @param propName
|
389
|
+
*/
|
271
390
|
function htmlPropertyToAttribute(propName) {
|
272
391
|
const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
|
273
392
|
if (!isUndefined$1(ariaAttributeName)) {
|
@@ -300,6 +419,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
300
419
|
* Map associating previously transformed kabab-case attributes into camel-case props.
|
301
420
|
*/
|
302
421
|
const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/new Map();
|
422
|
+
/**
|
423
|
+
*
|
424
|
+
* @param attrName
|
425
|
+
*/
|
303
426
|
function kebabCaseToCamelCase(attrName) {
|
304
427
|
let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName);
|
305
428
|
if (isUndefined$1(result)) {
|
@@ -316,16 +439,16 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
316
439
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
317
440
|
*/
|
318
441
|
// Increment whenever the LWC template compiler changes
|
319
|
-
const LWC_VERSION = "
|
442
|
+
const LWC_VERSION = "6.2.1";
|
320
443
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
321
|
-
/** version:
|
444
|
+
/** version: 6.2.1 */
|
322
445
|
|
323
446
|
/**
|
324
|
-
* Copyright (
|
447
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
325
448
|
*/
|
326
449
|
|
327
450
|
/*
|
328
|
-
* Copyright (c)
|
451
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
329
452
|
* All rights reserved.
|
330
453
|
* SPDX-License-Identifier: MIT
|
331
454
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -335,24 +458,28 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
335
458
|
const features = {
|
336
459
|
PLACEHOLDER_TEST_FLAG: null,
|
337
460
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
338
|
-
|
339
|
-
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
461
|
+
DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
340
462
|
ENABLE_WIRE_SYNC_EMIT: null,
|
341
463
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
342
464
|
ENABLE_FROZEN_TEMPLATE: null,
|
343
|
-
ENABLE_LEGACY_SCOPE_TOKENS: null
|
465
|
+
ENABLE_LEGACY_SCOPE_TOKENS: null,
|
466
|
+
ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
|
467
|
+
ENABLE_EXPERIMENTAL_SIGNALS: null,
|
468
|
+
DISABLE_TEMPORARY_V5_COMPILER_SUPPORT: null
|
344
469
|
};
|
345
|
-
|
346
|
-
|
347
|
-
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
470
|
+
if (!globalThis.lwcRuntimeFlags) {
|
471
|
+
Object.defineProperty(globalThis, 'lwcRuntimeFlags', {
|
348
472
|
value: create(null)
|
349
473
|
});
|
350
474
|
}
|
351
|
-
|
352
|
-
const flags = _globalThis.lwcRuntimeFlags;
|
475
|
+
const flags = globalThis.lwcRuntimeFlags;
|
353
476
|
/**
|
354
477
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
355
478
|
* flag. It is meant to be used during the app initialization.
|
479
|
+
* @param name Name of the feature flag to set
|
480
|
+
* @param value Whether the feature flag should be enabled
|
481
|
+
* @throws Will throw if a non-boolean value is provided when running in production.
|
482
|
+
* @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
|
356
483
|
*/
|
357
484
|
function setFeatureFlag(name, value) {
|
358
485
|
if (!isBoolean(value)) {
|
@@ -390,6 +517,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
390
517
|
/**
|
391
518
|
* Set the value at runtime of a given feature flag. This method should only be used for testing
|
392
519
|
* purposes. It is a no-op when invoked in production mode.
|
520
|
+
* @param name Name of the feature flag to enable or disable
|
521
|
+
* @param value Whether the feature flag should be enabled
|
522
|
+
* @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
|
393
523
|
*/
|
394
524
|
function setFeatureFlagForTest(name, value) {
|
395
525
|
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
@@ -397,10 +527,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
397
527
|
setFeatureFlag(name, value);
|
398
528
|
}
|
399
529
|
}
|
400
|
-
/** version:
|
530
|
+
/** version: 6.2.1 */
|
401
531
|
|
402
532
|
/**
|
403
|
-
* Copyright (
|
533
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
404
534
|
*/
|
405
535
|
|
406
536
|
/*
|
@@ -422,8 +552,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
422
552
|
const reportingControl = {
|
423
553
|
/**
|
424
554
|
* Attach a new reporting control (aka dispatcher).
|
425
|
-
*
|
426
|
-
* @param dispatcher - reporting control
|
555
|
+
* @param dispatcher reporting control
|
427
556
|
*/
|
428
557
|
attachDispatcher(dispatcher) {
|
429
558
|
enabled$1 = true;
|
@@ -464,7 +593,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
464
593
|
/**
|
465
594
|
* Report to the current dispatcher, if there is one.
|
466
595
|
* @param reportingEventId
|
467
|
-
* @param payload
|
596
|
+
* @param payload data to report
|
468
597
|
*/
|
469
598
|
function report(reportingEventId, payload) {
|
470
599
|
if (enabled$1) {
|
@@ -627,6 +756,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
627
756
|
}
|
628
757
|
observe(job) {
|
629
758
|
const inceptionReactiveRecord = currentReactiveObserver;
|
759
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
630
760
|
currentReactiveObserver = this;
|
631
761
|
let error;
|
632
762
|
try {
|
@@ -675,6 +805,78 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
675
805
|
// we keep track of observing records where the observing record was added to so we can do some clean up later on
|
676
806
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
677
807
|
}
|
808
|
+
isObserving() {
|
809
|
+
return currentReactiveObserver === this;
|
810
|
+
}
|
811
|
+
}
|
812
|
+
|
813
|
+
/*
|
814
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
815
|
+
* All rights reserved.
|
816
|
+
* SPDX-License-Identifier: MIT
|
817
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
818
|
+
*/
|
819
|
+
/**
|
820
|
+
* This map keeps track of objects to signals. There is an assumption that the signal is strongly referenced
|
821
|
+
* on the object which allows the SignalTracker to be garbage collected along with the object.
|
822
|
+
*/
|
823
|
+
const TargetToSignalTrackerMap = new WeakMap();
|
824
|
+
function getSignalTracker(target) {
|
825
|
+
let signalTracker = TargetToSignalTrackerMap.get(target);
|
826
|
+
if (isUndefined$1(signalTracker)) {
|
827
|
+
signalTracker = new SignalTracker();
|
828
|
+
TargetToSignalTrackerMap.set(target, signalTracker);
|
829
|
+
}
|
830
|
+
return signalTracker;
|
831
|
+
}
|
832
|
+
function subscribeToSignal(target, signal, update) {
|
833
|
+
const signalTracker = getSignalTracker(target);
|
834
|
+
if (isFalse(signalTracker.seen(signal))) {
|
835
|
+
signalTracker.subscribeToSignal(signal, update);
|
836
|
+
}
|
837
|
+
}
|
838
|
+
function unsubscribeFromSignals(target) {
|
839
|
+
if (TargetToSignalTrackerMap.has(target)) {
|
840
|
+
const signalTracker = getSignalTracker(target);
|
841
|
+
signalTracker.unsubscribeFromSignals();
|
842
|
+
signalTracker.reset();
|
843
|
+
}
|
844
|
+
}
|
845
|
+
/**
|
846
|
+
* This class is used to keep track of the signals associated to a given object.
|
847
|
+
* It is used to prevent the LWC engine from subscribing duplicate callbacks multiple times
|
848
|
+
* to the same signal. Additionally, it keeps track of all signal unsubscribe callbacks, handles invoking
|
849
|
+
* them when necessary and discarding them.
|
850
|
+
*/
|
851
|
+
class SignalTracker {
|
852
|
+
constructor() {
|
853
|
+
this.signalToUnsubscribeMap = new Map();
|
854
|
+
}
|
855
|
+
seen(signal) {
|
856
|
+
return this.signalToUnsubscribeMap.has(signal);
|
857
|
+
}
|
858
|
+
subscribeToSignal(signal, update) {
|
859
|
+
try {
|
860
|
+
const unsubscribe = signal.subscribe(update);
|
861
|
+
if (isFunction$1(unsubscribe)) {
|
862
|
+
// TODO [#3978]: Evaluate how we should handle the case when unsubscribe is not a function.
|
863
|
+
// Long term we should throw an error or log a warning.
|
864
|
+
this.signalToUnsubscribeMap.set(signal, unsubscribe);
|
865
|
+
}
|
866
|
+
} catch (err) {
|
867
|
+
logWarnOnce(`Attempted to subscribe to an object that has the shape of a signal but received the following error: ${err?.stack ?? err}`);
|
868
|
+
}
|
869
|
+
}
|
870
|
+
unsubscribeFromSignals() {
|
871
|
+
try {
|
872
|
+
this.signalToUnsubscribeMap.forEach(unsubscribe => unsubscribe());
|
873
|
+
} catch (err) {
|
874
|
+
logWarnOnce(`Attempted to call a signal's unsubscribe callback but received the following error: ${err?.stack ?? err}`);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
reset() {
|
878
|
+
this.signalToUnsubscribeMap.clear();
|
879
|
+
}
|
678
880
|
}
|
679
881
|
function componentValueMutated(vm, key) {
|
680
882
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
@@ -682,10 +884,24 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
682
884
|
valueMutated(vm.component, key);
|
683
885
|
}
|
684
886
|
}
|
685
|
-
function componentValueObserved(vm, key) {
|
887
|
+
function componentValueObserved(vm, key, target = {}) {
|
888
|
+
const {
|
889
|
+
component,
|
890
|
+
tro
|
891
|
+
} = vm;
|
686
892
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
687
893
|
{
|
688
|
-
valueObserved(
|
894
|
+
valueObserved(component, key);
|
895
|
+
}
|
896
|
+
// The portion of reactivity that's exposed to signals is to subscribe a callback to re-render the VM (templates).
|
897
|
+
// We check check the following to ensure re-render is subscribed at the correct time.
|
898
|
+
// 1. The template is currently being rendered (there is a template reactive observer)
|
899
|
+
// 2. There was a call to a getter to access the signal (happens during vnode generation)
|
900
|
+
if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS && isObject(target) && !isNull(target) && 'value' in target && 'subscribe' in target && isFunction$1(target.subscribe) &&
|
901
|
+
// Only subscribe if a template is being rendered by the engine
|
902
|
+
tro.isObserving()) {
|
903
|
+
// Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
|
904
|
+
subscribeToSignal(component, target, tro.notify.bind(tro));
|
689
905
|
}
|
690
906
|
}
|
691
907
|
function createReactiveObserver(callback) {
|
@@ -722,6 +938,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
722
938
|
}
|
723
939
|
}
|
724
940
|
if (nextTickCallbackQueue.length === 0) {
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
725
942
|
Promise.resolve().then(flushCallbackQueue);
|
726
943
|
}
|
727
944
|
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
@@ -732,6 +949,14 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
732
949
|
}
|
733
950
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
734
951
|
}
|
952
|
+
function shouldUseNativeCustomElementLifecycle(ctor) {
|
953
|
+
if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
954
|
+
// temporary "kill switch"
|
955
|
+
return false;
|
956
|
+
}
|
957
|
+
const apiVersion = getComponentAPIVersion(ctor);
|
958
|
+
return isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
959
|
+
}
|
735
960
|
// Borrowed from Vue template compiler.
|
736
961
|
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
737
962
|
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
@@ -778,6 +1003,33 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
778
1003
|
throw new ReferenceError();
|
779
1004
|
}
|
780
1005
|
}
|
1006
|
+
// Temporary fix for when the LWC v5 compiler is used in conjunction with a v6+ engine
|
1007
|
+
// The old compiler format used the "slot" attribute in the `data` bag, whereas the new
|
1008
|
+
// format uses the special `slotAssignment` key.
|
1009
|
+
// This should be removed when the LWC v5 compiler is not used anywhere where it could be mismatched
|
1010
|
+
// with another LWC engine version.
|
1011
|
+
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
1012
|
+
function applyTemporaryCompilerV5SlotFix(data) {
|
1013
|
+
if (lwcRuntimeFlags.DISABLE_TEMPORARY_V5_COMPILER_SUPPORT) {
|
1014
|
+
return data;
|
1015
|
+
}
|
1016
|
+
const {
|
1017
|
+
attrs
|
1018
|
+
} = data;
|
1019
|
+
if (!isUndefined$1(attrs)) {
|
1020
|
+
const {
|
1021
|
+
slot
|
1022
|
+
} = attrs;
|
1023
|
+
if (!isUndefined$1(slot) && !isNull(slot)) {
|
1024
|
+
return {
|
1025
|
+
...data,
|
1026
|
+
attrs: cloneAndOmitKey(attrs, 'slot'),
|
1027
|
+
slotAssignment: String(slot)
|
1028
|
+
};
|
1029
|
+
}
|
1030
|
+
}
|
1031
|
+
return data;
|
1032
|
+
}
|
781
1033
|
|
782
1034
|
/*
|
783
1035
|
* Copyright (c) 2020, salesforce.com, inc.
|
@@ -787,14 +1039,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
787
1039
|
*/
|
788
1040
|
function resolveCircularModuleDependency(fn) {
|
789
1041
|
const module = fn();
|
790
|
-
return
|
1042
|
+
return module?.__esModule ? module.default : module;
|
791
1043
|
}
|
792
1044
|
function isCircularModuleDependency(obj) {
|
793
1045
|
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
794
1046
|
}
|
795
|
-
var _a, _b;
|
796
|
-
const instrumentDef = (_a = _globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
|
797
|
-
const instrumentInstance = (_b = _globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
|
798
1047
|
|
799
1048
|
/*
|
800
1049
|
* Copyright (c) 2023, salesforce.com, inc.
|
@@ -802,37 +1051,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
802
1051
|
* SPDX-License-Identifier: MIT
|
803
1052
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
804
1053
|
*/
|
805
|
-
|
806
|
-
|
807
|
-
// needed for backwards compatibility in LEX, whereas `applyAriaReflection` is designed to only apply to our own
|
808
|
-
// LightningElement/BaseBridgeElement prototypes.
|
809
|
-
function applyAriaReflection(prototype) {
|
810
|
-
for (const propName of keys(AriaPropNameToAttrNameMap)) {
|
811
|
-
const attrName = AriaPropNameToAttrNameMap[propName];
|
812
|
-
if (isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName))) {
|
813
|
-
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
814
|
-
// from Element.prototype, because these methods are overridden in LightningElement.
|
815
|
-
defineProperty(prototype, propName, {
|
816
|
-
get() {
|
817
|
-
return this.getAttribute(attrName);
|
818
|
-
},
|
819
|
-
set(newValue) {
|
820
|
-
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
821
|
-
// Our historical behavior is to only treat null as removing the attribute
|
822
|
-
// See also https://github.com/w3c/aria/issues/1858
|
823
|
-
if (isNull(newValue)) {
|
824
|
-
this.removeAttribute(attrName);
|
825
|
-
} else {
|
826
|
-
this.setAttribute(attrName, newValue);
|
827
|
-
}
|
828
|
-
},
|
829
|
-
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
830
|
-
configurable: true,
|
831
|
-
enumerable: true
|
832
|
-
});
|
833
|
-
}
|
834
|
-
}
|
835
|
-
}
|
1054
|
+
const instrumentDef = globalThis.__lwc_instrument_cmp_def ?? noop;
|
1055
|
+
const instrumentInstance = globalThis.__lwc_instrument_cmp_instance ?? noop;
|
836
1056
|
|
837
1057
|
/*
|
838
1058
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -845,6 +1065,43 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
845
1065
|
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
846
1066
|
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
847
1067
|
|
1068
|
+
/*
|
1069
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
1070
|
+
* All rights reserved.
|
1071
|
+
* SPDX-License-Identifier: MIT
|
1072
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1073
|
+
*/
|
1074
|
+
// Apply ARIA string reflection behavior to a prototype.
|
1075
|
+
// This is deliberately kept separate from @lwc/aria-reflection. @lwc/aria-reflection is a global polyfill that is
|
1076
|
+
// needed for backwards compatibility in LEX, whereas this is designed to only apply to our own
|
1077
|
+
// LightningElement/BaseBridgeElement prototypes.
|
1078
|
+
// Note we only need to handle ARIA reflections that aren't already in Element.prototype
|
1079
|
+
const ariaReflectionPolyfillDescriptors = create(null);
|
1080
|
+
for (const [propName, attrName] of entries(AriaPropNameToAttrNameMap)) {
|
1081
|
+
if (isUndefined$1(getPropertyDescriptor(HTMLElementPrototype, propName))) {
|
1082
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
1083
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
1084
|
+
ariaReflectionPolyfillDescriptors[propName] = {
|
1085
|
+
get() {
|
1086
|
+
return this.getAttribute(attrName);
|
1087
|
+
},
|
1088
|
+
set(newValue) {
|
1089
|
+
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
1090
|
+
// Our historical behavior is to only treat null as removing the attribute
|
1091
|
+
// See also https://github.com/w3c/aria/issues/1858
|
1092
|
+
if (isNull(newValue)) {
|
1093
|
+
this.removeAttribute(attrName);
|
1094
|
+
} else {
|
1095
|
+
this.setAttribute(attrName, newValue);
|
1096
|
+
}
|
1097
|
+
},
|
1098
|
+
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
1099
|
+
configurable: true,
|
1100
|
+
enumerable: true
|
1101
|
+
};
|
1102
|
+
}
|
1103
|
+
}
|
1104
|
+
|
848
1105
|
/*
|
849
1106
|
* Copyright (c) 2018, salesforce.com, inc.
|
850
1107
|
* All rights reserved.
|
@@ -1093,28 +1350,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1093
1350
|
})
|
1094
1351
|
};
|
1095
1352
|
}
|
1096
|
-
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
1097
|
-
assertNotProd(); // this method should never leak to prod
|
1098
|
-
const originalDispatchEvent = proto.dispatchEvent;
|
1099
|
-
return {
|
1100
|
-
dispatchEvent: generateDataDescriptor({
|
1101
|
-
value(event) {
|
1102
|
-
const vm = getAssociatedVM(this);
|
1103
|
-
if (!isNull(event) && isObject(event)) {
|
1104
|
-
const {
|
1105
|
-
type
|
1106
|
-
} = event;
|
1107
|
-
if (!/^[a-z][a-z0-9_]*$/.test(type)) {
|
1108
|
-
logError(`Invalid event type "${type}" dispatched in element ${getComponentTag(vm)}.` + ` Event name must start with a lowercase letter and followed only lowercase` + ` letters, numbers, and underscores`, vm);
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
1112
|
-
// @ts-ignore type-mismatch
|
1113
|
-
return originalDispatchEvent.apply(this, arguments);
|
1114
|
-
}
|
1115
|
-
})
|
1116
|
-
};
|
1117
|
-
}
|
1118
1353
|
// This routine will prevent access to certain properties on a shadow root instance to guarantee
|
1119
1354
|
// that all components will work fine in IE11 and other browsers without shadow dom support.
|
1120
1355
|
function patchShadowRootWithRestrictions(sr) {
|
@@ -1125,9 +1360,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1125
1360
|
const elmProto = getPrototypeOf$1(elm);
|
1126
1361
|
setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
|
1127
1362
|
}
|
1128
|
-
function patchLightningElementPrototypeWithRestrictions(proto) {
|
1129
|
-
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
1130
|
-
}
|
1131
1363
|
function updateComponentValue(vm, key, newValue) {
|
1132
1364
|
const {
|
1133
1365
|
cmpFields
|
@@ -1504,7 +1736,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1504
1736
|
valueMutated(originalTarget, key);
|
1505
1737
|
return true;
|
1506
1738
|
}
|
1507
|
-
/*LWC compiler
|
1739
|
+
/*LWC compiler v6.2.1*/
|
1508
1740
|
}
|
1509
1741
|
const getterMap = new WeakMap();
|
1510
1742
|
const setterMap = new WeakMap();
|
@@ -1597,7 +1829,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1597
1829
|
/* istanbul ignore next */
|
1598
1830
|
return false;
|
1599
1831
|
}
|
1600
|
-
/*LWC compiler
|
1832
|
+
/*LWC compiler v6.2.1*/
|
1601
1833
|
}
|
1602
1834
|
function extract(objectOrArray) {
|
1603
1835
|
if (isArray(objectOrArray)) {
|
@@ -1783,6 +2015,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1783
2015
|
* EXPERIMENTAL: This function implements an unwrap mechanism that
|
1784
2016
|
* works for observable membrane objects. This API is subject to
|
1785
2017
|
* change or being removed.
|
2018
|
+
* @param value
|
1786
2019
|
*/
|
1787
2020
|
function unwrap(value) {
|
1788
2021
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
@@ -1805,6 +2038,78 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1805
2038
|
}
|
1806
2039
|
}
|
1807
2040
|
|
2041
|
+
/*
|
2042
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
2043
|
+
* All rights reserved.
|
2044
|
+
* SPDX-License-Identifier: MIT
|
2045
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
2046
|
+
*/
|
2047
|
+
let globalStylesheet;
|
2048
|
+
function isStyleElement(elm) {
|
2049
|
+
return elm.tagName === 'STYLE';
|
2050
|
+
}
|
2051
|
+
async function fetchStylesheet(elm) {
|
2052
|
+
if (isStyleElement(elm)) {
|
2053
|
+
return elm.textContent;
|
2054
|
+
} else {
|
2055
|
+
// <link>
|
2056
|
+
const {
|
2057
|
+
href
|
2058
|
+
} = elm;
|
2059
|
+
try {
|
2060
|
+
return await (await fetch(href)).text();
|
2061
|
+
} catch (err) {
|
2062
|
+
logWarnOnce(`Ignoring cross-origin stylesheet in migrate mode: ${href}`);
|
2063
|
+
// ignore errors with cross-origin stylesheets - nothing we can do for those
|
2064
|
+
return '';
|
2065
|
+
}
|
2066
|
+
}
|
2067
|
+
}
|
2068
|
+
function initGlobalStylesheet() {
|
2069
|
+
const stylesheet = new CSSStyleSheet();
|
2070
|
+
const elmsToPromises = new Map();
|
2071
|
+
let lastSeenLength = 0;
|
2072
|
+
const copyToGlobalStylesheet = () => {
|
2073
|
+
const elms = document.head.querySelectorAll('style:not([data-rendered-by-lwc]),link[rel="stylesheet"]');
|
2074
|
+
if (elms.length === lastSeenLength) {
|
2075
|
+
return; // nothing to update
|
2076
|
+
}
|
2077
|
+
lastSeenLength = elms.length;
|
2078
|
+
const promises = [...elms].map(elm => {
|
2079
|
+
let promise = elmsToPromises.get(elm);
|
2080
|
+
if (!promise) {
|
2081
|
+
// Cache the promise
|
2082
|
+
promise = fetchStylesheet(elm);
|
2083
|
+
elmsToPromises.set(elm, promise);
|
2084
|
+
}
|
2085
|
+
return promise;
|
2086
|
+
});
|
2087
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2088
|
+
Promise.all(promises).then(stylesheetTexts => {
|
2089
|
+
// When replaceSync() is called, the entire contents of the constructable stylesheet are replaced
|
2090
|
+
// with the copied+concatenated styles. This means that any shadow root's adoptedStyleSheets that
|
2091
|
+
// contains this constructable stylesheet will immediately get the new styles.
|
2092
|
+
stylesheet.replaceSync(stylesheetTexts.join('\n'));
|
2093
|
+
});
|
2094
|
+
};
|
2095
|
+
const headObserver = new MutationObserver(copyToGlobalStylesheet);
|
2096
|
+
// By observing only the childList, note that we are not covering the case where someone changes an `href`
|
2097
|
+
// on an existing <link>`, or the textContent on an existing `<style>`. This is assumed to be an uncommon
|
2098
|
+
// case and not worth covering.
|
2099
|
+
headObserver.observe(document.head, {
|
2100
|
+
childList: true
|
2101
|
+
});
|
2102
|
+
copyToGlobalStylesheet();
|
2103
|
+
return stylesheet;
|
2104
|
+
}
|
2105
|
+
function applyShadowMigrateMode(shadowRoot) {
|
2106
|
+
if (!globalStylesheet) {
|
2107
|
+
globalStylesheet = initGlobalStylesheet();
|
2108
|
+
}
|
2109
|
+
shadowRoot.synthetic = true; // pretend to be synthetic mode
|
2110
|
+
shadowRoot.adoptedStyleSheets.push(globalStylesheet);
|
2111
|
+
}
|
2112
|
+
|
1808
2113
|
/*
|
1809
2114
|
* Copyright (c) 2018, salesforce.com, inc.
|
1810
2115
|
* All rights reserved.
|
@@ -1824,6 +2129,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1824
2129
|
* that a Custom Element can support (including AOM properties), which
|
1825
2130
|
* determines what kind of capabilities the Base Lightning Element should support. When producing the new descriptors
|
1826
2131
|
* for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
|
2132
|
+
* @param propName
|
2133
|
+
* @param descriptor
|
1827
2134
|
*/
|
1828
2135
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
1829
2136
|
const {
|
@@ -1878,7 +2185,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1878
2185
|
/**
|
1879
2186
|
* This class is the base class for any LWC element.
|
1880
2187
|
* Some elements directly extends this class, others implement it via inheritance.
|
1881
|
-
|
2188
|
+
*/
|
1882
2189
|
// @ts-ignore
|
1883
2190
|
const LightningElement = function () {
|
1884
2191
|
// This should be as performant as possible, while any initialization should be done lazily
|
@@ -1903,7 +2210,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1903
2210
|
} = vm.renderer;
|
1904
2211
|
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
1905
2212
|
}
|
1906
|
-
const component = this;
|
1907
2213
|
setPrototypeOf(elm, bridge.prototype);
|
1908
2214
|
vm.component = this;
|
1909
2215
|
// Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
|
@@ -1922,7 +2228,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1922
2228
|
}
|
1923
2229
|
markLockerLiveObject(this);
|
1924
2230
|
// Linking elm, shadow root and component with the VM.
|
1925
|
-
associateVM(
|
2231
|
+
associateVM(this, vm);
|
1926
2232
|
associateVM(elm, vm);
|
1927
2233
|
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
1928
2234
|
vm.renderRoot = doAttachShadow(vm);
|
@@ -1957,6 +2263,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
1957
2263
|
if (process.env.NODE_ENV !== 'production') {
|
1958
2264
|
patchShadowRootWithRestrictions(shadowRoot);
|
1959
2265
|
}
|
2266
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE && vm.shadowMigrateMode) {
|
2267
|
+
applyShadowMigrateMode(shadowRoot);
|
2268
|
+
}
|
1960
2269
|
return shadowRoot;
|
1961
2270
|
}
|
1962
2271
|
function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
@@ -2387,11 +2696,17 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2387
2696
|
for (const propName in HTMLElementOriginalDescriptors) {
|
2388
2697
|
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
2389
2698
|
}
|
2390
|
-
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
2391
2699
|
// Apply ARIA reflection to LightningElement.prototype, on both the browser and server.
|
2392
2700
|
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
2393
2701
|
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
2394
|
-
|
2702
|
+
{
|
2703
|
+
// In the browser, we use createBridgeToElementDescriptor, so we can get the normal reactivity lifecycle for
|
2704
|
+
// aria* properties
|
2705
|
+
for (const [propName, descriptor] of entries(ariaReflectionPolyfillDescriptors)) {
|
2706
|
+
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, descriptor);
|
2707
|
+
}
|
2708
|
+
}
|
2709
|
+
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
2395
2710
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
2396
2711
|
get() {
|
2397
2712
|
// If required, a runtime-specific implementation must be defined.
|
@@ -2399,15 +2714,13 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2399
2714
|
},
|
2400
2715
|
configurable: true
|
2401
2716
|
});
|
2402
|
-
if (process.env.NODE_ENV !== 'production') {
|
2403
|
-
patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
|
2404
|
-
}
|
2405
2717
|
function createObservedFieldPropertyDescriptor(key) {
|
2406
2718
|
return {
|
2407
2719
|
get() {
|
2408
2720
|
const vm = getAssociatedVM(this);
|
2409
|
-
|
2410
|
-
|
2721
|
+
const val = vm.cmpFields[key];
|
2722
|
+
componentValueObserved(vm, key, val);
|
2723
|
+
return val;
|
2411
2724
|
},
|
2412
2725
|
set(newValue) {
|
2413
2726
|
const vm = getAssociatedVM(this);
|
@@ -2535,6 +2848,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2535
2848
|
if (hasPendingConfig === false) {
|
2536
2849
|
hasPendingConfig = true;
|
2537
2850
|
// collect new config in the micro-task
|
2851
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2538
2852
|
Promise.resolve().then(() => {
|
2539
2853
|
hasPendingConfig = false;
|
2540
2854
|
// resetting current reactive params
|
@@ -2694,6 +3008,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2694
3008
|
connector.connect();
|
2695
3009
|
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
2696
3010
|
if (hasDynamicParams) {
|
3011
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2697
3012
|
Promise.resolve().then(computeConfigAndUpdate);
|
2698
3013
|
return;
|
2699
3014
|
}
|
@@ -2749,8 +3064,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2749
3064
|
}
|
2750
3065
|
return;
|
2751
3066
|
}
|
2752
|
-
|
2753
|
-
|
3067
|
+
const val = vm.cmpProps[key];
|
3068
|
+
componentValueObserved(vm, key, val);
|
3069
|
+
return val;
|
2754
3070
|
},
|
2755
3071
|
set(newValue) {
|
2756
3072
|
const vm = getAssociatedVM(this);
|
@@ -2827,8 +3143,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2827
3143
|
return {
|
2828
3144
|
get() {
|
2829
3145
|
const vm = getAssociatedVM(this);
|
2830
|
-
|
2831
|
-
|
3146
|
+
const val = vm.cmpFields[key];
|
3147
|
+
componentValueObserved(vm, key, val);
|
3148
|
+
return val;
|
2832
3149
|
},
|
2833
3150
|
set(newValue) {
|
2834
3151
|
const vm = getAssociatedVM(this);
|
@@ -2856,9 +3173,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2856
3173
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
2857
3174
|
*/
|
2858
3175
|
/**
|
2859
|
-
* @wire decorator
|
3176
|
+
* The @wire decorator wires fields and methods to a wire adapter in
|
2860
3177
|
* LWC Components. This function implements the internals of this
|
2861
3178
|
* decorator.
|
3179
|
+
* @param _adapter
|
3180
|
+
* @param _config
|
2862
3181
|
*/
|
2863
3182
|
function wire(_adapter, _config) {
|
2864
3183
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -2966,6 +3285,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
2966
3285
|
/**
|
2967
3286
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
2968
3287
|
* will prevent this function from being imported by user-land code.
|
3288
|
+
* @param Ctor
|
3289
|
+
* @param meta
|
2969
3290
|
*/
|
2970
3291
|
function registerDecorators(Ctor, meta) {
|
2971
3292
|
const proto = Ctor.prototype;
|
@@ -3161,6 +3482,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3161
3482
|
/**
|
3162
3483
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
3163
3484
|
* will prevent this function from being imported by userland code.
|
3485
|
+
* @param tpl
|
3164
3486
|
*/
|
3165
3487
|
function registerTemplate(tpl) {
|
3166
3488
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -3174,6 +3496,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3174
3496
|
/**
|
3175
3497
|
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
3176
3498
|
* libraries to sanitize vulnerable attributes.
|
3499
|
+
* @param tagName
|
3500
|
+
* @param namespaceUri
|
3501
|
+
* @param attrName
|
3502
|
+
* @param attrValue
|
3177
3503
|
*/
|
3178
3504
|
function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
3179
3505
|
// locker-service patches this function during runtime to sanitize vulnerable attributes. When
|
@@ -3272,7 +3598,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3272
3598
|
}
|
3273
3599
|
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
|
3274
3600
|
const HTMLBridgeElement = class extends SuperClass {
|
3275
|
-
/*LWC compiler
|
3601
|
+
/*LWC compiler v6.2.1*/
|
3276
3602
|
};
|
3277
3603
|
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
3278
3604
|
// and false positives in case of inheritance.
|
@@ -3297,7 +3623,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3297
3623
|
// and can break tooling that expects it to be iterable or defined, e.g. Jest:
|
3298
3624
|
// https://github.com/jestjs/jest/blob/b4c9587/packages/pretty-format/src/plugins/DOMElement.ts#L95
|
3299
3625
|
// It also doesn't make sense to override e.g. "constructor".
|
3300
|
-
.filter(propName => !(propName in HTMLElementPrototype)));
|
3626
|
+
.filter(propName => !(propName in HTMLElementPrototype) && !(propName in ariaReflectionPolyfillDescriptors)));
|
3301
3627
|
for (const propName of nonPublicPropertiesToWarnOn) {
|
3302
3628
|
if (ArrayIndexOf.call(publicProperties, propName) === -1) {
|
3303
3629
|
descriptors[propName] = createAccessorThatWarns(propName);
|
@@ -3367,21 +3693,19 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3367
3693
|
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
3368
3694
|
return HTMLBridgeElement;
|
3369
3695
|
}
|
3370
|
-
|
3371
|
-
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3378
|
-
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3383
|
-
applyAriaReflection(BaseBridgeElement.prototype);
|
3384
|
-
}
|
3696
|
+
// We do some special handling of non-standard ARIA props like ariaLabelledBy as well as props without (as of this
|
3697
|
+
// writing) broad cross-browser support like ariaBrailleLabel. This is so the reflection works correctly and preserves
|
3698
|
+
// backwards compatibility with the previous global polyfill approach.
|
3699
|
+
//
|
3700
|
+
// The goal here is to expose `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*`
|
3701
|
+
// attrs. This is especially important because the template compiler compiles aria-* attrs on components to aria* props.
|
3702
|
+
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
3703
|
+
//
|
3704
|
+
// Also note this ARIA reflection only really makes sense in the browser. On the server, there is no
|
3705
|
+
// `renderedCallback()`, so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't
|
3706
|
+
// need to expose ARIA props outside the LightningElement
|
3707
|
+
const basePublicProperties = [...getOwnPropertyNames$1(HTMLElementOriginalDescriptors), ...getOwnPropertyNames$1(ariaReflectionPolyfillDescriptors)];
|
3708
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, basePublicProperties, [], [], null, false);
|
3385
3709
|
freeze(BaseBridgeElement);
|
3386
3710
|
seal(BaseBridgeElement.prototype);
|
3387
3711
|
|
@@ -3681,6 +4005,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3681
4005
|
if (!isUndefined$1(ctorShadowSupportMode) && ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ && ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ && ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
|
3682
4006
|
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
3683
4007
|
}
|
4008
|
+
// TODO [#3971]: Completely remove shadowSupportMode "any"
|
4009
|
+
if (ctorShadowSupportMode === "any" /* ShadowSupportMode.Any */) {
|
4010
|
+
logWarn(`Invalid value 'any' for static property shadowSupportMode. 'any' is deprecated and will be removed in a future release--use 'native' instead.`);
|
4011
|
+
}
|
3684
4012
|
if (!isUndefined$1(ctorRenderMode) && ctorRenderMode !== 'light' && ctorRenderMode !== 'shadow') {
|
3685
4013
|
logError(`Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
|
3686
4014
|
}
|
@@ -3726,6 +4054,12 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3726
4054
|
let shadowSupportMode = superDef.shadowSupportMode;
|
3727
4055
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
3728
4056
|
shadowSupportMode = ctorShadowSupportMode;
|
4057
|
+
if (isReportingEnabled() && (shadowSupportMode === "any" /* ShadowSupportMode.Any */ || shadowSupportMode === "native" /* ShadowSupportMode.Native */)) {
|
4058
|
+
report("ShadowSupportModeUsage" /* ReportingEventId.ShadowSupportModeUsage */, {
|
4059
|
+
tagName: Ctor.name,
|
4060
|
+
mode: shadowSupportMode
|
4061
|
+
});
|
4062
|
+
}
|
3729
4063
|
}
|
3730
4064
|
let renderMode = superDef.renderMode;
|
3731
4065
|
if (!isUndefined$1(ctorRenderMode)) {
|
@@ -3771,6 +4105,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3771
4105
|
/**
|
3772
4106
|
* EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
|
3773
4107
|
* subject to change or being removed.
|
4108
|
+
* @param ctor
|
3774
4109
|
*/
|
3775
4110
|
function isComponentConstructor(ctor) {
|
3776
4111
|
if (!isFunction$1(ctor)) {
|
@@ -3844,6 +4179,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3844
4179
|
/**
|
3845
4180
|
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
3846
4181
|
* subject to change or being removed.
|
4182
|
+
* @param Ctor
|
3847
4183
|
*/
|
3848
4184
|
function getComponentDef(Ctor) {
|
3849
4185
|
const def = getComponentInternalDef(Ctor);
|
@@ -3863,7 +4199,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3863
4199
|
// avoid leaking the reference to the public props descriptors
|
3864
4200
|
publicProps[key] = {
|
3865
4201
|
config: propsConfig[key] || 0,
|
4202
|
+
// a property by default
|
3866
4203
|
type: "any" /* PropDefType.any */,
|
4204
|
+
// no type inference for public services
|
3867
4205
|
attr: htmlPropertyToAttribute(key)
|
3868
4206
|
};
|
3869
4207
|
}
|
@@ -3893,6 +4231,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
3893
4231
|
function createInlineStyleVNode(content) {
|
3894
4232
|
return api.h('style', {
|
3895
4233
|
key: 'style',
|
4234
|
+
// special key
|
3896
4235
|
attrs: {
|
3897
4236
|
type: 'text/css'
|
3898
4237
|
}
|
@@ -4055,6 +4394,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4055
4394
|
* If the component that is currently being rendered uses scoped styles,
|
4056
4395
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
4057
4396
|
* it returns null.
|
4397
|
+
* @param owner
|
4398
|
+
* @param legacy
|
4058
4399
|
*/
|
4059
4400
|
// TODO [#3733]: remove support for legacy scope tokens
|
4060
4401
|
function getScopeTokenClass(owner, legacy) {
|
@@ -4062,13 +4403,14 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4062
4403
|
cmpTemplate,
|
4063
4404
|
context
|
4064
4405
|
} = owner;
|
4065
|
-
return context.hasScopedStyles && (legacy ? cmpTemplate
|
4406
|
+
return context.hasScopedStyles && (legacy ? cmpTemplate?.legacyStylesheetToken : cmpTemplate?.stylesheetToken) || null;
|
4066
4407
|
}
|
4067
4408
|
/**
|
4068
4409
|
* This function returns the host style token for a custom element if it
|
4069
4410
|
* exists. Otherwise it returns null.
|
4070
4411
|
*
|
4071
4412
|
* A host style token is applied to the component if scoped styles are used.
|
4413
|
+
* @param vnode
|
4072
4414
|
*/
|
4073
4415
|
function getStylesheetTokenHost(vnode) {
|
4074
4416
|
const {
|
@@ -4145,6 +4487,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4145
4487
|
function isVScopedSlotFragment(vnode) {
|
4146
4488
|
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
4147
4489
|
}
|
4490
|
+
function isVStatic(vnode) {
|
4491
|
+
return vnode.type === 4 /* VNodeType.Static */;
|
4492
|
+
}
|
4148
4493
|
|
4149
4494
|
/*
|
4150
4495
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -4198,6 +4543,26 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4198
4543
|
}
|
4199
4544
|
}
|
4200
4545
|
}
|
4546
|
+
function patchSlotAssignment(oldVnode, vnode, renderer) {
|
4547
|
+
const {
|
4548
|
+
slotAssignment
|
4549
|
+
} = vnode;
|
4550
|
+
if (oldVnode?.slotAssignment === slotAssignment) {
|
4551
|
+
return;
|
4552
|
+
}
|
4553
|
+
const {
|
4554
|
+
elm
|
4555
|
+
} = vnode;
|
4556
|
+
const {
|
4557
|
+
setAttribute,
|
4558
|
+
removeAttribute
|
4559
|
+
} = renderer;
|
4560
|
+
if (isUndefined$1(slotAssignment) || isNull(slotAssignment)) {
|
4561
|
+
removeAttribute(elm, 'slot');
|
4562
|
+
} else {
|
4563
|
+
setAttribute(elm, 'slot', slotAssignment);
|
4564
|
+
}
|
4565
|
+
}
|
4201
4566
|
|
4202
4567
|
/*
|
4203
4568
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -4269,6 +4634,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4269
4634
|
return EmptyObject;
|
4270
4635
|
}
|
4271
4636
|
// computed class names must be string
|
4637
|
+
// This will throw if className is a symbol or null-prototype object
|
4638
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
4272
4639
|
className = isString(className) ? className : className + '';
|
4273
4640
|
let map = classNameToClassMap[className];
|
4274
4641
|
if (map) {
|
@@ -4363,11 +4730,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4363
4730
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
4364
4731
|
*/
|
4365
4732
|
function applyEventListeners(vnode, renderer) {
|
4366
|
-
var _a;
|
4367
4733
|
const {
|
4368
4734
|
elm
|
4369
4735
|
} = vnode;
|
4370
|
-
const on =
|
4736
|
+
const on = vnode.data?.on;
|
4371
4737
|
if (isUndefined$1(on)) {
|
4372
4738
|
return;
|
4373
4739
|
}
|
@@ -4519,13 +4885,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4519
4885
|
}
|
4520
4886
|
/**
|
4521
4887
|
* Given an array of static parts, do all the mounting required for these parts.
|
4522
|
-
*
|
4523
|
-
* @param
|
4524
|
-
* @param
|
4525
|
-
* @param renderer - the renderer to use
|
4526
|
-
* @param mount - true this is a first (mount) render as opposed to a subsequent (patch) render
|
4888
|
+
* @param root the root element
|
4889
|
+
* @param vnode the parent VStatic
|
4890
|
+
* @param renderer the renderer to use
|
4527
4891
|
*/
|
4528
|
-
function
|
4892
|
+
function mountStaticParts(root, vnode, renderer) {
|
4529
4893
|
const {
|
4530
4894
|
parts,
|
4531
4895
|
owner
|
@@ -4533,20 +4897,45 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4533
4897
|
if (isUndefined$1(parts)) {
|
4534
4898
|
return;
|
4535
4899
|
}
|
4536
|
-
// This adds `part.elm` to each `part`. We have to do this on every mount
|
4900
|
+
// This adds `part.elm` to each `part`. We have to do this on every mount because the `parts`
|
4537
4901
|
// array is recreated from scratch every time, so each `part.elm` is now undefined.
|
4538
|
-
// TODO [#3800]: avoid calling traverseAndSetElements on every re-render
|
4539
4902
|
traverseAndSetElements(root, parts, renderer);
|
4540
4903
|
// Currently only event listeners and refs are supported for static vnodes
|
4541
4904
|
for (const part of parts) {
|
4542
|
-
|
4543
|
-
|
4544
|
-
applyEventListeners(part, renderer);
|
4545
|
-
}
|
4905
|
+
// Event listeners only need to be applied once when mounting
|
4906
|
+
applyEventListeners(part, renderer);
|
4546
4907
|
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4547
4908
|
applyRefs(part, owner);
|
4548
4909
|
}
|
4549
4910
|
}
|
4911
|
+
/**
|
4912
|
+
* Mounts elements to the newly generated VStatic node
|
4913
|
+
* @param n1 the previous VStatic vnode
|
4914
|
+
* @param n2 the current VStatic vnode
|
4915
|
+
*/
|
4916
|
+
function patchStaticParts(n1, n2) {
|
4917
|
+
const {
|
4918
|
+
parts: currParts,
|
4919
|
+
owner: currPartsOwner
|
4920
|
+
} = n2;
|
4921
|
+
if (isUndefined$1(currParts)) {
|
4922
|
+
return;
|
4923
|
+
}
|
4924
|
+
const {
|
4925
|
+
parts: prevParts
|
4926
|
+
} = n1;
|
4927
|
+
if (process.env.NODE_ENV !== 'production') {
|
4928
|
+
assert.isTrue(currParts.length === prevParts?.length, 'Expected static parts to be the same for the same element. This is an error with the LWC framework itself.');
|
4929
|
+
}
|
4930
|
+
for (let i = 0; i < currParts.length; i++) {
|
4931
|
+
const part = currParts[i];
|
4932
|
+
// Patch only occurs if the vnode is newly generated, which means the part.elm is always undefined
|
4933
|
+
// Since the vnode and elements are the same we can safely assume that prevParts[i].elm is defined.
|
4934
|
+
part.elm = prevParts[i].elm;
|
4935
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4936
|
+
applyRefs(part, currPartsOwner);
|
4937
|
+
}
|
4938
|
+
}
|
4550
4939
|
|
4551
4940
|
/*
|
4552
4941
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -4562,7 +4951,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4562
4951
|
}
|
4563
4952
|
}
|
4564
4953
|
function patch(n1, n2, parent, renderer) {
|
4565
|
-
var _a, _b;
|
4566
4954
|
if (n1 === n2) {
|
4567
4955
|
return;
|
4568
4956
|
}
|
@@ -4598,15 +4986,14 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4598
4986
|
patchFragment(n1, n2, parent, renderer);
|
4599
4987
|
break;
|
4600
4988
|
case 2 /* VNodeType.Element */:
|
4601
|
-
patchElement(n1, n2,
|
4989
|
+
patchElement(n1, n2, n2.data.renderer ?? renderer);
|
4602
4990
|
break;
|
4603
4991
|
case 3 /* VNodeType.CustomElement */:
|
4604
|
-
patchCustomElement(n1, n2, parent,
|
4992
|
+
patchCustomElement(n1, n2, parent, n2.data.renderer ?? renderer);
|
4605
4993
|
break;
|
4606
4994
|
}
|
4607
4995
|
}
|
4608
4996
|
function mount(node, parent, renderer, anchor) {
|
4609
|
-
var _a, _b;
|
4610
4997
|
switch (node.type) {
|
4611
4998
|
case 0 /* VNodeType.Text */:
|
4612
4999
|
// VText has no special capability, fallback to the owner's renderer
|
@@ -4625,11 +5012,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4625
5012
|
break;
|
4626
5013
|
case 2 /* VNodeType.Element */:
|
4627
5014
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
4628
|
-
mountElement(node, parent, anchor,
|
5015
|
+
mountElement(node, parent, anchor, node.data.renderer ?? renderer);
|
4629
5016
|
break;
|
4630
5017
|
case 3 /* VNodeType.CustomElement */:
|
4631
5018
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
4632
|
-
mountCustomElement(node, parent, anchor,
|
5019
|
+
mountCustomElement(node, parent, anchor, node.data.renderer ?? renderer);
|
4633
5020
|
break;
|
4634
5021
|
}
|
4635
5022
|
}
|
@@ -4711,9 +5098,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4711
5098
|
mountVNodes(vnode.children, elm, renderer, null);
|
4712
5099
|
}
|
4713
5100
|
function patchStatic(n1, n2, renderer) {
|
4714
|
-
|
5101
|
+
n2.elm = n1.elm;
|
5102
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
5103
|
+
patchSlotAssignment(n1, n2, renderer);
|
4715
5104
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
4716
|
-
|
5105
|
+
patchStaticParts(n1, n2);
|
4717
5106
|
}
|
4718
5107
|
function patchElement(n1, n2, renderer) {
|
4719
5108
|
const elm = n2.elm = n1.elm;
|
@@ -4741,13 +5130,16 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4741
5130
|
elm[KEY__SHADOW_STATIC] = true;
|
4742
5131
|
}
|
4743
5132
|
}
|
5133
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
5134
|
+
patchSlotAssignment(null, vnode, renderer);
|
4744
5135
|
insertNode(elm, parent, anchor, renderer);
|
4745
|
-
|
5136
|
+
mountStaticParts(elm, vnode, renderer);
|
4746
5137
|
}
|
4747
5138
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
4748
5139
|
const {
|
4749
5140
|
sel,
|
4750
|
-
owner
|
5141
|
+
owner,
|
5142
|
+
ctor
|
4751
5143
|
} = vnode;
|
4752
5144
|
const {
|
4753
5145
|
createCustomElement
|
@@ -4768,7 +5160,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4768
5160
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
4769
5161
|
// compatibility, we lower case the tagname here.
|
4770
5162
|
const normalizedTagname = sel.toLowerCase();
|
4771
|
-
const
|
5163
|
+
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
5164
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle);
|
4772
5165
|
vnode.elm = elm;
|
4773
5166
|
vnode.vm = vm;
|
4774
5167
|
linkNodeToShadow(elm, owner, renderer);
|
@@ -4780,7 +5173,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4780
5173
|
insertNode(elm, parent, anchor, renderer);
|
4781
5174
|
if (vm) {
|
4782
5175
|
{
|
4783
|
-
if (!
|
5176
|
+
if (!useNativeLifecycle) {
|
4784
5177
|
if (process.env.NODE_ENV !== 'production') {
|
4785
5178
|
// With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
|
4786
5179
|
// noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
|
@@ -4985,6 +5378,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
4985
5378
|
patchStyleAttribute(oldVnode, vnode, renderer);
|
4986
5379
|
patchAttributes(oldVnode, vnode, renderer);
|
4987
5380
|
patchProps(oldVnode, vnode, renderer);
|
5381
|
+
patchSlotAssignment(oldVnode, vnode, renderer);
|
4988
5382
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
4989
5383
|
applyRefs(vnode, vnode.owner);
|
4990
5384
|
}
|
@@ -5025,22 +5419,20 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5025
5419
|
}
|
5026
5420
|
}
|
5027
5421
|
function applyDomManual(elm, vnode) {
|
5028
|
-
var _a;
|
5029
5422
|
const {
|
5030
5423
|
owner,
|
5031
5424
|
data: {
|
5032
5425
|
context
|
5033
5426
|
}
|
5034
5427
|
} = vnode;
|
5035
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ &&
|
5428
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && context?.lwc?.dom === "manual" /* LwcDomMode.Manual */) {
|
5036
5429
|
elm.$domManual$ = true;
|
5037
5430
|
}
|
5038
5431
|
}
|
5039
5432
|
function applyElementRestrictions(elm, vnode) {
|
5040
|
-
var _a, _b;
|
5041
5433
|
if (process.env.NODE_ENV !== 'production') {
|
5042
5434
|
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
5043
|
-
const isPortal = vnode.type === 2 /* VNodeType.Element */ &&
|
5435
|
+
const isPortal = vnode.type === 2 /* VNodeType.Element */ && vnode.data.context?.lwc?.dom === "manual" /* LwcDomMode.Manual */;
|
5044
5436
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
5045
5437
|
patchElementWithRestrictions(elm, {
|
5046
5438
|
isPortal,
|
@@ -5095,6 +5487,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5095
5487
|
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
5096
5488
|
*
|
5097
5489
|
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
5490
|
+
* @param children
|
5098
5491
|
*/
|
5099
5492
|
function flattenFragmentsInChildren(children) {
|
5100
5493
|
const flattenedChildren = [];
|
@@ -5153,7 +5546,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5153
5546
|
return vm;
|
5154
5547
|
}
|
5155
5548
|
function allocateInSlot(vm, children, owner) {
|
5156
|
-
var _a, _b;
|
5157
5549
|
const {
|
5158
5550
|
cmpSlots: {
|
5159
5551
|
slotAssignments: oldSlotsMapping
|
@@ -5167,8 +5559,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5167
5559
|
continue;
|
5168
5560
|
}
|
5169
5561
|
let slotName = '';
|
5170
|
-
if (isVBaseElement(vnode)) {
|
5171
|
-
slotName =
|
5562
|
+
if (isVBaseElement(vnode) || isVStatic(vnode)) {
|
5563
|
+
slotName = vnode.slotAssignment ?? '';
|
5172
5564
|
} else if (isVScopedSlotFragment(vnode)) {
|
5173
5565
|
slotName = vnode.slotName;
|
5174
5566
|
}
|
@@ -5176,6 +5568,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5176
5568
|
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
5177
5569
|
// the following line also throws same error for symbols
|
5178
5570
|
// Similar for Object.create(null)
|
5571
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
5179
5572
|
const normalizedSlotName = '' + slotName;
|
5180
5573
|
const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
5181
5574
|
ArrayPush$1.call(vnodes, vnode);
|
@@ -5424,7 +5817,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5424
5817
|
elm: undefined,
|
5425
5818
|
fragment,
|
5426
5819
|
owner,
|
5427
|
-
parts
|
5820
|
+
parts,
|
5821
|
+
slotAssignment: undefined
|
5428
5822
|
};
|
5429
5823
|
return vnode;
|
5430
5824
|
}
|
@@ -5466,8 +5860,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5466
5860
|
}
|
5467
5861
|
});
|
5468
5862
|
}
|
5863
|
+
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
5864
|
+
data = applyTemporaryCompilerV5SlotFix(data);
|
5469
5865
|
const {
|
5470
|
-
key
|
5866
|
+
key,
|
5867
|
+
slotAssignment
|
5471
5868
|
} = data;
|
5472
5869
|
const vnode = {
|
5473
5870
|
type: 2 /* VNodeType.Element */,
|
@@ -5476,7 +5873,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5476
5873
|
children,
|
5477
5874
|
elm: undefined,
|
5478
5875
|
key,
|
5479
|
-
owner: vmBeingRendered
|
5876
|
+
owner: vmBeingRendered,
|
5877
|
+
slotAssignment
|
5480
5878
|
};
|
5481
5879
|
return vnode;
|
5482
5880
|
}
|
@@ -5501,6 +5899,13 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5501
5899
|
assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);
|
5502
5900
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
5503
5901
|
}
|
5902
|
+
const vmBeingRendered = getVMBeingRendered();
|
5903
|
+
const {
|
5904
|
+
renderMode,
|
5905
|
+
apiVersion
|
5906
|
+
} = vmBeingRendered;
|
5907
|
+
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
5908
|
+
data = applyTemporaryCompilerV5SlotFix(data);
|
5504
5909
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
5505
5910
|
const newChildren = [];
|
5506
5911
|
const slotAssignments = slotset.slotAssignments[slotName];
|
@@ -5520,7 +5925,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5520
5925
|
}
|
5521
5926
|
// If the passed slot content is factory, evaluate it and add the produced vnodes
|
5522
5927
|
if (assignedNodeIsScopedSlot) {
|
5523
|
-
const vmBeingRenderedInception = getVMBeingRendered();
|
5524
5928
|
// Evaluate in the scope of the slot content's owner
|
5525
5929
|
// if a slotset is provided, there will always be an owner. The only case where owner is
|
5526
5930
|
// undefined is for root components, but root components cannot accept slotted content
|
@@ -5535,22 +5939,34 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5535
5939
|
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
5536
5940
|
});
|
5537
5941
|
} finally {
|
5538
|
-
setVMBeingRendered(
|
5942
|
+
setVMBeingRendered(vmBeingRendered);
|
5539
5943
|
}
|
5540
5944
|
} else {
|
5945
|
+
// This block is for standard slots (non-scoped slots)
|
5946
|
+
let clonedVNode;
|
5947
|
+
if (renderMode === 0 /* RenderMode.Light */ && isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) && (isVBaseElement(vnode) || isVStatic(vnode)) &&
|
5948
|
+
// We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
|
5949
|
+
// disconnected/connected callback firing.
|
5950
|
+
vnode.slotAssignment !== data.slotAssignment) {
|
5951
|
+
// When the light DOM slot assignment (slot attribute) changes we can't use the same reference
|
5952
|
+
// to the vnode because the current way the diffing algo works, it will replace the original reference
|
5953
|
+
// to the host element with a new one. This means the new element will be mounted and immediately unmounted.
|
5954
|
+
// Creating a copy of the vnode to preserve a reference to the previous host element.
|
5955
|
+
clonedVNode = {
|
5956
|
+
...vnode,
|
5957
|
+
slotAssignment: data.slotAssignment
|
5958
|
+
};
|
5959
|
+
}
|
5541
5960
|
// If the slot content is standard type, the content is static, no additional
|
5542
5961
|
// processing needed on the vnode
|
5543
|
-
ArrayPush$1.call(newChildren, vnode);
|
5962
|
+
ArrayPush$1.call(newChildren, clonedVNode ?? vnode);
|
5544
5963
|
}
|
5545
5964
|
}
|
5546
5965
|
}
|
5547
5966
|
children = newChildren;
|
5548
5967
|
}
|
5549
|
-
const vmBeingRendered = getVMBeingRendered();
|
5550
5968
|
const {
|
5551
|
-
|
5552
|
-
shadowMode,
|
5553
|
-
apiVersion
|
5969
|
+
shadowMode
|
5554
5970
|
} = vmBeingRendered;
|
5555
5971
|
if (renderMode === 0 /* RenderMode.Light */) {
|
5556
5972
|
// light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
|
@@ -5589,8 +6005,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5589
6005
|
});
|
5590
6006
|
}
|
5591
6007
|
}
|
6008
|
+
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
6009
|
+
data = applyTemporaryCompilerV5SlotFix(data);
|
5592
6010
|
const {
|
5593
|
-
key
|
6011
|
+
key,
|
6012
|
+
slotAssignment
|
5594
6013
|
} = data;
|
5595
6014
|
let elm, aChildren, vm;
|
5596
6015
|
const vnode = {
|
@@ -5600,9 +6019,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5600
6019
|
children,
|
5601
6020
|
elm,
|
5602
6021
|
key,
|
6022
|
+
slotAssignment,
|
5603
6023
|
ctor: Ctor,
|
5604
6024
|
owner: vmBeingRendered,
|
5605
6025
|
mode: 'open',
|
6026
|
+
// TODO [#1294]: this should be defined in Ctor
|
5606
6027
|
aChildren,
|
5607
6028
|
vm
|
5608
6029
|
};
|
@@ -5681,6 +6102,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5681
6102
|
}
|
5682
6103
|
/**
|
5683
6104
|
* [f]lattening
|
6105
|
+
* @param items
|
5684
6106
|
*/
|
5685
6107
|
function f(items) {
|
5686
6108
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5802,6 +6224,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5802
6224
|
* [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
5803
6225
|
*
|
5804
6226
|
* TODO [#3331]: remove usage of lwc:dynamic in 246
|
6227
|
+
* @param sel
|
6228
|
+
* @param Ctor
|
6229
|
+
* @param data
|
6230
|
+
* @param children
|
5805
6231
|
*/
|
5806
6232
|
function ddc(sel, Ctor, data, children = EmptyArray) {
|
5807
6233
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5820,6 +6246,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5820
6246
|
}
|
5821
6247
|
/**
|
5822
6248
|
* [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
|
6249
|
+
* @param Ctor
|
6250
|
+
* @param data
|
6251
|
+
* @param children
|
5823
6252
|
*/
|
5824
6253
|
function dc(Ctor, data, children = EmptyArray) {
|
5825
6254
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5847,13 +6276,13 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5847
6276
|
* to the engine that a particular collection of children must be diffed using the slow
|
5848
6277
|
* algo based on keys due to the nature of the list. E.g.:
|
5849
6278
|
*
|
5850
|
-
*
|
5851
|
-
*
|
5852
|
-
*
|
5853
|
-
*
|
5854
|
-
*
|
5855
|
-
*
|
5856
|
-
*
|
6279
|
+
* - slot element's children: the content of the slot has to be dynamic when in synthetic
|
6280
|
+
* shadow mode because the `vnode.children` might be the slotted
|
6281
|
+
* content vs default content, in which case the size and the
|
6282
|
+
* keys are not matching.
|
6283
|
+
* - children that contain dynamic components
|
6284
|
+
* - children that are produced by iteration
|
6285
|
+
* @param vnodes
|
5857
6286
|
*/
|
5858
6287
|
function sc(vnodes) {
|
5859
6288
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5877,6 +6306,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5877
6306
|
};
|
5878
6307
|
/**
|
5879
6308
|
* Sets the sanitizeHtmlContentHook.
|
6309
|
+
* @param newHookImpl
|
5880
6310
|
*/
|
5881
6311
|
function setSanitizeHtmlContentHook(newHookImpl) {
|
5882
6312
|
sanitizeHtmlContentHook = newHookImpl;
|
@@ -5989,7 +6419,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5989
6419
|
start(markName);
|
5990
6420
|
}
|
5991
6421
|
if (isProfilerEnabled) {
|
5992
|
-
currentDispatcher(opId, 0 /* Phase.Start */, vm
|
6422
|
+
currentDispatcher(opId, 0 /* Phase.Start */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
5993
6423
|
}
|
5994
6424
|
}
|
5995
6425
|
function logGlobalOperationEnd(opId, vm) {
|
@@ -5999,7 +6429,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
5999
6429
|
end(opName, markName);
|
6000
6430
|
}
|
6001
6431
|
if (isProfilerEnabled) {
|
6002
|
-
currentDispatcher(opId, 1 /* Phase.Stop */, vm
|
6432
|
+
currentDispatcher(opId, 1 /* Phase.Stop */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
6003
6433
|
}
|
6004
6434
|
}
|
6005
6435
|
|
@@ -6023,7 +6453,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6023
6453
|
cmpSlots
|
6024
6454
|
} = vm;
|
6025
6455
|
for (const slotName in cmpSlots.slotAssignments) {
|
6026
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
6027
6456
|
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}.`);
|
6028
6457
|
}
|
6029
6458
|
}
|
@@ -6122,7 +6551,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6122
6551
|
});
|
6123
6552
|
function evaluateTemplate(vm, html) {
|
6124
6553
|
if (process.env.NODE_ENV !== 'production') {
|
6125
|
-
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
6126
6554
|
// in dev-mode, we support hot swapping of templates, which means that
|
6127
6555
|
// the component instance might be attempting to use an old version of
|
6128
6556
|
// the template, while internally, we have a replacement for it.
|
@@ -6147,6 +6575,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6147
6575
|
tro.observe(() => {
|
6148
6576
|
// Reset the cache memoizer for template when needed.
|
6149
6577
|
if (html !== cmpTemplate) {
|
6578
|
+
// Check that the template was built by the compiler.
|
6579
|
+
if (!isTemplateRegistered(html)) {
|
6580
|
+
throw new TypeError(`Invalid template returned by the render() method on ${vm.tagName}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
|
6581
|
+
}
|
6150
6582
|
if (process.env.NODE_ENV !== 'production') {
|
6151
6583
|
validateLightDomTemplate(html, vm);
|
6152
6584
|
}
|
@@ -6158,10 +6590,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6158
6590
|
// and snabbdom just rely on the IDs.
|
6159
6591
|
resetComponentRoot(vm);
|
6160
6592
|
}
|
6161
|
-
// Check that the template was built by the compiler.
|
6162
|
-
if (!isTemplateRegistered(html)) {
|
6163
|
-
throw new TypeError(`Invalid template returned by the render() method on ${vm}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
|
6164
|
-
}
|
6165
6593
|
vm.cmpTemplate = html;
|
6166
6594
|
// Create a brand new template cache for the swapped templated.
|
6167
6595
|
context.tplCache = create(null);
|
@@ -6338,6 +6766,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6338
6766
|
/**
|
6339
6767
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
6340
6768
|
* will prevent this function from being imported by userland code.
|
6769
|
+
* @param Ctor
|
6770
|
+
* @param metadata
|
6341
6771
|
*/
|
6342
6772
|
function registerComponent(
|
6343
6773
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
@@ -6356,16 +6786,14 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6356
6786
|
return Ctor;
|
6357
6787
|
}
|
6358
6788
|
function getComponentRegisteredTemplate(Ctor) {
|
6359
|
-
|
6360
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
|
6789
|
+
return registeredComponentMap.get(Ctor)?.tmpl;
|
6361
6790
|
}
|
6362
6791
|
function getComponentRegisteredName(Ctor) {
|
6363
|
-
|
6364
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
|
6792
|
+
return registeredComponentMap.get(Ctor)?.sel;
|
6365
6793
|
}
|
6366
6794
|
function getComponentAPIVersion(Ctor) {
|
6367
6795
|
const metadata = registeredComponentMap.get(Ctor);
|
6368
|
-
const apiVersion = metadata
|
6796
|
+
const apiVersion = metadata?.apiVersion;
|
6369
6797
|
if (isUndefined$1(apiVersion)) {
|
6370
6798
|
// This should only occur in our Karma tests; in practice every component
|
6371
6799
|
// is registered, and so this code path should not get hit. But to be safe,
|
@@ -6385,11 +6813,30 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6385
6813
|
}
|
6386
6814
|
});
|
6387
6815
|
}
|
6816
|
+
function resetTemplateObserverAndUnsubscribe(vm) {
|
6817
|
+
const {
|
6818
|
+
tro,
|
6819
|
+
component
|
6820
|
+
} = vm;
|
6821
|
+
tro.reset();
|
6822
|
+
// Unsubscribe every time the template reactive observer is reset.
|
6823
|
+
if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
|
6824
|
+
unsubscribeFromSignals(component);
|
6825
|
+
}
|
6826
|
+
}
|
6388
6827
|
function renderComponent(vm) {
|
6389
6828
|
if (process.env.NODE_ENV !== 'production') {
|
6390
6829
|
assert.invariant(vm.isDirty, `${vm} is not dirty.`);
|
6391
6830
|
}
|
6392
|
-
|
6831
|
+
// The engine should only hold a subscription to a signal if it is rendered in the template.
|
6832
|
+
// Because of the potential presence of conditional rendering logic, we unsubscribe on each render
|
6833
|
+
// in the scenario where it is present in one condition but not the other.
|
6834
|
+
// For example:
|
6835
|
+
// 1. There is an lwc:if=true conditional where the signal is present on the template.
|
6836
|
+
// 2. The lwc:if changes to false and the signal is no longer present on the template.
|
6837
|
+
// If the signal is still subscribed to, the template will re-render when it receives a notification
|
6838
|
+
// from the signal, even though we won't be using the new value.
|
6839
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
6393
6840
|
const vnodes = invokeComponentRenderMethod(vm);
|
6394
6841
|
vm.isDirty = false;
|
6395
6842
|
vm.isScheduled = false;
|
@@ -6466,11 +6913,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6466
6913
|
state
|
6467
6914
|
} = vm;
|
6468
6915
|
if (state !== 2 /* VMState.disconnected */) {
|
6469
|
-
const {
|
6470
|
-
tro
|
6471
|
-
} = vm;
|
6472
6916
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
6473
|
-
|
6917
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
6474
6918
|
runDisconnectedCallback(vm);
|
6475
6919
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
6476
6920
|
runChildNodesDisconnectedCallback(vm);
|
@@ -6481,7 +6925,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6481
6925
|
// old vnode.children is removed from the DOM.
|
6482
6926
|
function removeVM(vm) {
|
6483
6927
|
if (process.env.NODE_ENV !== 'production') {
|
6484
|
-
if (!
|
6928
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
|
6485
6929
|
// With native lifecycle, we cannot be certain that connectedCallback was called before a component
|
6486
6930
|
// was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
|
6487
6931
|
// in native mode, although it will fire in synthetic mode due to appendChild triggering it.
|
@@ -6545,6 +6989,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6545
6989
|
// Properties set right after VM creation.
|
6546
6990
|
tro: null,
|
6547
6991
|
shadowMode: null,
|
6992
|
+
shadowMigrateMode: false,
|
6548
6993
|
stylesheets: null,
|
6549
6994
|
// Properties set by the LightningElement constructor.
|
6550
6995
|
component: null,
|
@@ -6560,8 +7005,21 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6560
7005
|
vm.debugInfo = create(null);
|
6561
7006
|
}
|
6562
7007
|
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
6563
|
-
|
7008
|
+
const computedShadowMode = computeShadowMode(def, vm.owner, renderer, hydrated);
|
7009
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
7010
|
+
vm.shadowMode = 0 /* ShadowMode.Native */;
|
7011
|
+
vm.shadowMigrateMode = computedShadowMode === 1 /* ShadowMode.Synthetic */;
|
7012
|
+
} else {
|
7013
|
+
vm.shadowMode = computedShadowMode;
|
7014
|
+
}
|
6564
7015
|
vm.tro = getTemplateReactiveObserver(vm);
|
7016
|
+
// We don't need to report the shadow mode if we're rendering in light DOM
|
7017
|
+
if (isReportingEnabled() && vm.renderMode === 1 /* RenderMode.Shadow */) {
|
7018
|
+
report("ShadowModeUsage" /* ReportingEventId.ShadowModeUsage */, {
|
7019
|
+
tagName: vm.tagName,
|
7020
|
+
mode: vm.shadowMode
|
7021
|
+
});
|
7022
|
+
}
|
6565
7023
|
if (process.env.NODE_ENV !== 'production') {
|
6566
7024
|
vm.toString = () => {
|
6567
7025
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
@@ -6635,44 +7093,45 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6635
7093
|
renderMode
|
6636
7094
|
} = def;
|
6637
7095
|
// Assume null `owner` - this is what happens in hydration cases anyway
|
6638
|
-
|
7096
|
+
// Also assume we are not in hydration mode for this exported API
|
7097
|
+
const shadowMode = computeShadowMode(def, /* owner */null, renderer, false);
|
6639
7098
|
return {
|
6640
7099
|
renderMode,
|
6641
7100
|
shadowMode
|
6642
7101
|
};
|
6643
7102
|
}
|
6644
|
-
function computeShadowMode(def, owner, renderer) {
|
7103
|
+
function computeShadowMode(def, owner, renderer, hydrated) {
|
6645
7104
|
// Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
|
6646
7105
|
// on, but components running in actual native shadow mode
|
6647
7106
|
if (process.env.NODE_ENV !== 'production' && lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
6648
7107
|
return 0 /* ShadowMode.Native */;
|
6649
7108
|
}
|
7109
|
+
if (isTrue(hydrated)) {
|
7110
|
+
// hydration only supports native shadow
|
7111
|
+
return 0 /* ShadowMode.Native */;
|
7112
|
+
}
|
6650
7113
|
const {
|
6651
7114
|
isSyntheticShadowDefined
|
6652
7115
|
} = renderer;
|
6653
7116
|
let shadowMode;
|
6654
|
-
if (isSyntheticShadowDefined) {
|
7117
|
+
if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
6655
7118
|
if (def.renderMode === 0 /* RenderMode.Light */) {
|
6656
7119
|
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
6657
7120
|
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
6658
7121
|
shadowMode = 0 /* ShadowMode.Native */;
|
6659
|
-
} else if (
|
6660
|
-
|
7122
|
+
} else if (def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
|
7123
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
7124
|
+
} else {
|
7125
|
+
const shadowAncestor = getNearestShadowAncestor(owner);
|
7126
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
|
7127
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
7128
|
+
// transitively opts all of its descendants into native.
|
6661
7129
|
shadowMode = 0 /* ShadowMode.Native */;
|
6662
7130
|
} else {
|
6663
|
-
|
6664
|
-
|
6665
|
-
|
6666
|
-
// transitively opts all of its descendants into native.
|
6667
|
-
shadowMode = 0 /* ShadowMode.Native */;
|
6668
|
-
} else {
|
6669
|
-
// Synthetic if neither this component nor any of its ancestors are configured
|
6670
|
-
// to be native.
|
6671
|
-
shadowMode = 1 /* ShadowMode.Synthetic */;
|
6672
|
-
}
|
7131
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
7132
|
+
// to be native.
|
7133
|
+
shadowMode = 1 /* ShadowMode.Synthetic */;
|
6673
7134
|
}
|
6674
|
-
} else {
|
6675
|
-
shadowMode = 1 /* ShadowMode.Synthetic */;
|
6676
7135
|
}
|
6677
7136
|
} else {
|
6678
7137
|
// Native if the synthetic shadow polyfill is unavailable.
|
@@ -6681,7 +7140,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6681
7140
|
return shadowMode;
|
6682
7141
|
}
|
6683
7142
|
function assertIsVM(obj) {
|
6684
|
-
if (
|
7143
|
+
if (!isObject(obj) || isNull(obj) || !('renderRoot' in obj)) {
|
6685
7144
|
throw new TypeError(`${obj} is not a VM.`);
|
6686
7145
|
}
|
6687
7146
|
}
|
@@ -6780,7 +7239,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6780
7239
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
6781
7240
|
// re-throwing the original error will break the current tick, but since the next tick is
|
6782
7241
|
// already scheduled, it should continue patching the rest.
|
6783
|
-
throw error;
|
7242
|
+
throw error;
|
6784
7243
|
}
|
6785
7244
|
}
|
6786
7245
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
@@ -6806,7 +7265,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6806
7265
|
}
|
6807
7266
|
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
6808
7267
|
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
6809
|
-
if (!
|
7268
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor) && (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
6810
7269
|
if (!vm.renderer.isConnected(vm.elm)) {
|
6811
7270
|
if (process.env.NODE_ENV !== 'production') {
|
6812
7271
|
logWarnOnce(`Element <${vm.tagName}> ` + `fired a \`connectedCallback\` and rendered, but was not connected to the DOM. ` + `Please ensure all components are actually connected to the DOM, e.g. using ` + `\`document.body.appendChild(element)\`. This will not be supported in future versions of ` + `LWC and could cause component errors. For details, see: https://sfdc.co/synthetic-lifecycle`);
|
@@ -6884,6 +7343,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
6884
7343
|
* need to continue into its children because by attempting to disconnect the
|
6885
7344
|
* custom element itself will trigger the removal of anything slotted or anything
|
6886
7345
|
* defined on its shadow.
|
7346
|
+
* @param vnodes
|
6887
7347
|
*/
|
6888
7348
|
function recursivelyDisconnectChildren(vnodes) {
|
6889
7349
|
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
@@ -7076,12 +7536,12 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7076
7536
|
// See: https://sfdc.co/synthetic-aria
|
7077
7537
|
//
|
7078
7538
|
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
7079
|
-
const getElementById =
|
7080
|
-
const querySelectorAll =
|
7539
|
+
const getElementById = globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
7540
|
+
const querySelectorAll = globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
7081
7541
|
// This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
|
7082
7542
|
// so nobody else can misuse these global APIs.
|
7083
|
-
delete
|
7084
|
-
delete
|
7543
|
+
delete globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
7544
|
+
delete globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
7085
7545
|
function isSyntheticShadowRootInstance(rootNode) {
|
7086
7546
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
7087
7547
|
}
|
@@ -7269,7 +7729,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7269
7729
|
setValueType = isNull(setValue) ? 'null' : typeof setValue;
|
7270
7730
|
}
|
7271
7731
|
report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
|
7272
|
-
tagName: vm
|
7732
|
+
tagName: vm?.tagName,
|
7273
7733
|
propertyName: prop,
|
7274
7734
|
isSetter,
|
7275
7735
|
setValueType
|
@@ -7354,7 +7814,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7354
7814
|
runRenderedCallback(vm);
|
7355
7815
|
}
|
7356
7816
|
function hydrateNode(node, vnode, renderer) {
|
7357
|
-
var _a, _b;
|
7358
7817
|
let hydratedNode;
|
7359
7818
|
switch (vnode.type) {
|
7360
7819
|
case 0 /* VNodeType.Text */:
|
@@ -7374,10 +7833,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7374
7833
|
hydratedNode = hydrateFragment(node, vnode, renderer);
|
7375
7834
|
break;
|
7376
7835
|
case 2 /* VNodeType.Element */:
|
7377
|
-
hydratedNode = hydrateElement(node, vnode,
|
7836
|
+
hydratedNode = hydrateElement(node, vnode, vnode.data.renderer ?? renderer);
|
7378
7837
|
break;
|
7379
7838
|
case 3 /* VNodeType.CustomElement */:
|
7380
|
-
hydratedNode = hydrateCustomElement(node, vnode,
|
7839
|
+
hydratedNode = hydrateCustomElement(node, vnode, vnode.data.renderer ?? renderer);
|
7381
7840
|
break;
|
7382
7841
|
}
|
7383
7842
|
return renderer.nextSibling(hydratedNode);
|
@@ -7422,7 +7881,6 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7422
7881
|
return _attrName => true;
|
7423
7882
|
}
|
7424
7883
|
function hydrateText(node, vnode, renderer) {
|
7425
|
-
var _a;
|
7426
7884
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
7427
7885
|
return handleMismatch(node, vnode, renderer);
|
7428
7886
|
}
|
@@ -7434,12 +7892,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7434
7892
|
const {
|
7435
7893
|
setText
|
7436
7894
|
} = renderer;
|
7437
|
-
setText(node,
|
7895
|
+
setText(node, vnode.text ?? null);
|
7438
7896
|
vnode.elm = node;
|
7439
7897
|
return node;
|
7440
7898
|
}
|
7441
7899
|
function hydrateComment(node, vnode, renderer) {
|
7442
|
-
var _a;
|
7443
7900
|
if (!hasCorrectNodeType(vnode, node, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
|
7444
7901
|
return handleMismatch(node, vnode, renderer);
|
7445
7902
|
}
|
@@ -7455,7 +7912,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7455
7912
|
const {
|
7456
7913
|
setProperty
|
7457
7914
|
} = renderer;
|
7458
|
-
setProperty(node, NODE_VALUE_PROP,
|
7915
|
+
setProperty(node, NODE_VALUE_PROP, vnode.text ?? null);
|
7459
7916
|
vnode.elm = node;
|
7460
7917
|
return node;
|
7461
7918
|
}
|
@@ -7464,7 +7921,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7464
7921
|
return handleMismatch(elm, vnode, renderer);
|
7465
7922
|
}
|
7466
7923
|
vnode.elm = elm;
|
7467
|
-
|
7924
|
+
mountStaticParts(elm, vnode, renderer);
|
7468
7925
|
return elm;
|
7469
7926
|
}
|
7470
7927
|
function hydrateFragment(elm, vnode, renderer) {
|
@@ -7501,9 +7958,10 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7501
7958
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
7502
7959
|
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
7503
7960
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
7504
|
-
vnode.data =
|
7961
|
+
vnode.data = {
|
7962
|
+
...vnode.data,
|
7505
7963
|
props: cloneAndOmitKey(props, 'innerHTML')
|
7506
|
-
}
|
7964
|
+
};
|
7507
7965
|
} else {
|
7508
7966
|
if (process.env.NODE_ENV !== 'production') {
|
7509
7967
|
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
|
@@ -7750,11 +8208,15 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
7750
8208
|
const classNames = ArrayFilter.call(classTokens, token => !isNull(token));
|
7751
8209
|
className = ArrayJoin.call(classNames, ' ');
|
7752
8210
|
} else if (!isUndefined$1(classMap)) {
|
7753
|
-
classMap =
|
7754
|
-
|
7755
|
-
|
7756
|
-
|
7757
|
-
|
8211
|
+
classMap = {
|
8212
|
+
...classMap,
|
8213
|
+
...(!isNull(scopedToken) ? {
|
8214
|
+
[scopedToken]: true
|
8215
|
+
} : {}),
|
8216
|
+
...(!isNull(stylesheetTokenHost) ? {
|
8217
|
+
[stylesheetTokenHost]: true
|
8218
|
+
} : {})
|
8219
|
+
};
|
7758
8220
|
} else {
|
7759
8221
|
// The order of the className should be scopedToken stylesheetTokenHost
|
7760
8222
|
const classTokens = [scopedToken, stylesheetTokenHost];
|
@@ -8105,6 +8567,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8105
8567
|
/**
|
8106
8568
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
8107
8569
|
* This API is subject to change or being removed.
|
8570
|
+
* @param elm
|
8108
8571
|
*/
|
8109
8572
|
function getComponentConstructor(elm) {
|
8110
8573
|
let ctor = null;
|
@@ -8129,6 +8592,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8129
8592
|
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
8130
8593
|
* membrane around any object value. This API is subject to change or
|
8131
8594
|
* being removed.
|
8595
|
+
* @param obj
|
8132
8596
|
*/
|
8133
8597
|
function readonly(obj) {
|
8134
8598
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -8139,7 +8603,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8139
8603
|
}
|
8140
8604
|
return getReadOnlyProxy(obj);
|
8141
8605
|
}
|
8142
|
-
/** version:
|
8606
|
+
/** version: 6.2.1 */
|
8143
8607
|
|
8144
8608
|
/*
|
8145
8609
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -8149,8 +8613,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8149
8613
|
*/
|
8150
8614
|
/**
|
8151
8615
|
* Displays the header for a custom element.
|
8152
|
-
*
|
8153
|
-
* @param ce the custom element
|
8616
|
+
* @param ce The custom element to get the header for.
|
8154
8617
|
* @param componentInstance component instance associated with the custom element.
|
8155
8618
|
*/
|
8156
8619
|
function getHeaderForCustomElement(ce, componentInstance) {
|
@@ -8210,9 +8673,9 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8210
8673
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
8211
8674
|
*/
|
8212
8675
|
function init() {
|
8213
|
-
const devtoolsFormatters =
|
8676
|
+
const devtoolsFormatters = globalThis.devtoolsFormatters || [];
|
8214
8677
|
ArrayPush$1.call(devtoolsFormatters, LightningElementFormatter);
|
8215
|
-
|
8678
|
+
globalThis.devtoolsFormatters = devtoolsFormatters;
|
8216
8679
|
}
|
8217
8680
|
if (process.env.NODE_ENV !== 'production') {
|
8218
8681
|
init();
|
@@ -8246,6 +8709,8 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8246
8709
|
const elm = document.createElement('style');
|
8247
8710
|
elm.type = 'text/css';
|
8248
8711
|
elm.textContent = content;
|
8712
|
+
// Add an attribute to distinguish global styles added by LWC as opposed to other frameworks/libraries on the page
|
8713
|
+
elm.setAttribute('data-rendered-by-lwc', '');
|
8249
8714
|
return elm;
|
8250
8715
|
}
|
8251
8716
|
function createStyleElement(content, cacheData) {
|
@@ -8352,17 +8817,17 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8352
8817
|
* SPDX-License-Identifier: MIT
|
8353
8818
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
8354
8819
|
*/
|
8355
|
-
const
|
8356
|
-
const elementsUpgradedOutsideLWC = new WeakSet();
|
8357
|
-
let elementBeingUpgradedByLWC = false;
|
8358
|
-
const lifecycleCallbacks = lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE ? {
|
8820
|
+
const LIFECYCLE_CALLBACKS = {
|
8359
8821
|
connectedCallback: connectRootElement,
|
8360
8822
|
disconnectedCallback: disconnectRootElement,
|
8361
8823
|
formAssociatedCallback: runFormAssociatedCallback,
|
8362
8824
|
formDisabledCallback: runFormDisabledCallback,
|
8363
8825
|
formResetCallback: runFormResetCallback,
|
8364
8826
|
formStateRestoreCallback: runFormStateRestoreCallback
|
8365
|
-
}
|
8827
|
+
};
|
8828
|
+
const cachedConstructors = new Map();
|
8829
|
+
const nativeLifecycleElementsToUpgradedByLWC = new WeakMap();
|
8830
|
+
let elementBeingUpgradedByLWC = false;
|
8366
8831
|
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
8367
8832
|
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
8368
8833
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
@@ -8371,34 +8836,34 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8371
8836
|
const createUpgradableConstructor = () => {
|
8372
8837
|
// TODO [#2972]: this class should expose observedAttributes as necessary
|
8373
8838
|
class UpgradableConstructor extends HTMLElement {
|
8374
|
-
|
8839
|
+
// TODO [#3983]: Re-enable formAssociated once there is a solution for the observable behavior it introduces.
|
8840
|
+
// static formAssociated = true;
|
8841
|
+
constructor(upgradeCallback, useNativeLifecycle) {
|
8375
8842
|
super();
|
8843
|
+
if (useNativeLifecycle) {
|
8844
|
+
// When in native lifecycle mode, we need to keep track of instances that were created outside LWC
|
8845
|
+
// (i.e. not created by `lwc.createElement()`). If the element uses synthetic lifecycle, then we don't
|
8846
|
+
// need to track this.
|
8847
|
+
nativeLifecycleElementsToUpgradedByLWC.set(this, elementBeingUpgradedByLWC);
|
8848
|
+
}
|
8376
8849
|
// If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
|
8377
|
-
// then
|
8850
|
+
// then elementBeingUpgradedByLWC will be false
|
8378
8851
|
if (elementBeingUpgradedByLWC) {
|
8379
8852
|
upgradeCallback(this);
|
8380
|
-
}
|
8381
|
-
|
8382
|
-
|
8383
|
-
// If the element has no connected or disconnected callbacks, then we don't need to track this.
|
8384
|
-
elementsUpgradedOutsideLWC.add(this);
|
8385
|
-
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
8386
|
-
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
8387
|
-
}
|
8388
|
-
}
|
8389
|
-
/*LWC compiler v5.1.0*/
|
8390
|
-
}
|
8391
|
-
UpgradableConstructor.formAssociated = true;
|
8392
|
-
// Do not unnecessarily add a connectedCallback/disconnectedCallback/etc., as it introduces perf overhead
|
8393
|
-
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
8394
|
-
if (!isUndefined$1(lifecycleCallbacks)) {
|
8395
|
-
for (const [propName, callback] of entries(lifecycleCallbacks)) {
|
8396
|
-
UpgradableConstructor.prototype[propName] = function () {
|
8397
|
-
if (!elementsUpgradedOutsideLWC.has(this)) {
|
8398
|
-
callback(this);
|
8399
|
-
}
|
8400
|
-
};
|
8853
|
+
}
|
8854
|
+
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
8855
|
+
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
8401
8856
|
}
|
8857
|
+
/*LWC compiler v6.2.1*/
|
8858
|
+
}
|
8859
|
+
for (const [propName, callback] of entries(LIFECYCLE_CALLBACKS)) {
|
8860
|
+
UpgradableConstructor.prototype[propName] = function () {
|
8861
|
+
// If the element is in the WeakMap (i.e. it's marked as native lifecycle), and if it was upgraded by LWC,
|
8862
|
+
// then it can use native lifecycle
|
8863
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8864
|
+
callback(this);
|
8865
|
+
}
|
8866
|
+
};
|
8402
8867
|
}
|
8403
8868
|
return UpgradableConstructor;
|
8404
8869
|
};
|
@@ -8414,18 +8879,18 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8414
8879
|
}
|
8415
8880
|
return UpgradableConstructor;
|
8416
8881
|
}
|
8417
|
-
const createCustomElement = (tagName, upgradeCallback) => {
|
8882
|
+
const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle) => {
|
8418
8883
|
const UpgradableConstructor = getUpgradableConstructor(tagName);
|
8419
8884
|
elementBeingUpgradedByLWC = true;
|
8420
8885
|
try {
|
8421
|
-
return new UpgradableConstructor(upgradeCallback);
|
8886
|
+
return new UpgradableConstructor(upgradeCallback, useNativeLifecycle);
|
8422
8887
|
} finally {
|
8423
8888
|
elementBeingUpgradedByLWC = false;
|
8424
8889
|
}
|
8425
8890
|
};
|
8426
8891
|
|
8427
8892
|
/*
|
8428
|
-
* Copyright (c)
|
8893
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
8429
8894
|
* All rights reserved.
|
8430
8895
|
* SPDX-License-Identifier: MIT
|
8431
8896
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -8437,13 +8902,12 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8437
8902
|
* Example usage:
|
8438
8903
|
* import { renderer, rendererFactory } from 'lwc';
|
8439
8904
|
* const customRenderer = rendererFactory(renderer);
|
8440
|
-
*
|
8441
8905
|
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
8442
8906
|
*/
|
8443
8907
|
function rendererFactory(baseRenderer) {
|
8444
8908
|
const renderer = function (exports) {
|
8445
8909
|
/**
|
8446
|
-
* Copyright (
|
8910
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
8447
8911
|
*/
|
8448
8912
|
/*
|
8449
8913
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -8451,21 +8915,40 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8451
8915
|
* SPDX-License-Identifier: MIT
|
8452
8916
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
8453
8917
|
*/
|
8918
|
+
/**
|
8919
|
+
*
|
8920
|
+
* @param value
|
8921
|
+
* @param msg
|
8922
|
+
*/
|
8454
8923
|
function invariant(value, msg) {
|
8455
8924
|
if (!value) {
|
8456
8925
|
throw new Error(`Invariant Violation: ${msg}`);
|
8457
8926
|
}
|
8458
8927
|
}
|
8928
|
+
/**
|
8929
|
+
*
|
8930
|
+
* @param value
|
8931
|
+
* @param msg
|
8932
|
+
*/
|
8459
8933
|
function isTrue$1(value, msg) {
|
8460
8934
|
if (!value) {
|
8461
8935
|
throw new Error(`Assert Violation: ${msg}`);
|
8462
8936
|
}
|
8463
8937
|
}
|
8938
|
+
/**
|
8939
|
+
*
|
8940
|
+
* @param value
|
8941
|
+
* @param msg
|
8942
|
+
*/
|
8464
8943
|
function isFalse$1(value, msg) {
|
8465
8944
|
if (value) {
|
8466
8945
|
throw new Error(`Assert Violation: ${msg}`);
|
8467
8946
|
}
|
8468
8947
|
}
|
8948
|
+
/**
|
8949
|
+
*
|
8950
|
+
* @param msg
|
8951
|
+
*/
|
8469
8952
|
function fail(msg) {
|
8470
8953
|
throw new Error(msg);
|
8471
8954
|
}
|
@@ -8476,13 +8959,23 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8476
8959
|
isFalse: isFalse$1,
|
8477
8960
|
isTrue: isTrue$1
|
8478
8961
|
});
|
8962
|
+
/**
|
8963
|
+
* Determines whether the argument is `undefined`.
|
8964
|
+
* @param obj Value to test
|
8965
|
+
* @returns `true` if the value is `undefined`.
|
8966
|
+
*/
|
8479
8967
|
function isUndefined(obj) {
|
8480
8968
|
return obj === undefined;
|
8481
8969
|
}
|
8970
|
+
/**
|
8971
|
+
* Determines whether the argument is `null`.
|
8972
|
+
* @param obj Value to test
|
8973
|
+
* @returns `true` if the value is `null`.
|
8974
|
+
*/
|
8482
8975
|
function isNull(obj) {
|
8483
8976
|
return obj === null;
|
8484
8977
|
}
|
8485
|
-
/** version:
|
8978
|
+
/** version: 6.2.1 */
|
8486
8979
|
|
8487
8980
|
/*
|
8488
8981
|
* Copyright (c) 2023, salesforce.com, inc.
|
@@ -8502,7 +8995,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8502
8995
|
this.setNewContext = setNewContext;
|
8503
8996
|
this.setDisconnectedCallback = setDisconnectedCallback;
|
8504
8997
|
}
|
8505
|
-
/*LWC compiler
|
8998
|
+
/*LWC compiler v6.2.1*/
|
8506
8999
|
}
|
8507
9000
|
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
8508
9001
|
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
@@ -8806,9 +9299,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8806
9299
|
/**
|
8807
9300
|
* This function builds a Web Component class from a LWC constructor so it can be
|
8808
9301
|
* registered as a new element via customElements.define() at any given time.
|
8809
|
-
*
|
8810
|
-
* @deprecated since version 1.3.11
|
8811
|
-
*
|
9302
|
+
* @param Ctor
|
8812
9303
|
* @example
|
8813
9304
|
* ```
|
8814
9305
|
* import { buildCustomElementConstructor } from 'lwc';
|
@@ -8817,6 +9308,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8817
9308
|
* customElements.define('x-foo', WC);
|
8818
9309
|
* const elm = document.createElement('x-foo');
|
8819
9310
|
* ```
|
9311
|
+
* @deprecated since version 1.3.11
|
8820
9312
|
*/
|
8821
9313
|
function deprecatedBuildCustomElementConstructor(Ctor) {
|
8822
9314
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -8882,7 +9374,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8882
9374
|
attributeChangedCallback(name, oldValue, newValue) {
|
8883
9375
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
8884
9376
|
}
|
8885
|
-
/*LWC compiler
|
9377
|
+
/*LWC compiler v6.2.1*/
|
8886
9378
|
}, _a.observedAttributes = observedAttributes, _a;
|
8887
9379
|
}
|
8888
9380
|
|
@@ -8907,7 +9399,13 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8907
9399
|
}
|
8908
9400
|
return node; // for convenience
|
8909
9401
|
}
|
8910
|
-
|
9402
|
+
let monkeyPatched = false;
|
9403
|
+
function monkeyPatchDomAPIs() {
|
9404
|
+
if (monkeyPatched) {
|
9405
|
+
// don't double-patch
|
9406
|
+
return;
|
9407
|
+
}
|
9408
|
+
monkeyPatched = true;
|
8911
9409
|
// Monkey patching Node methods to be able to detect the insertions and removal of root elements
|
8912
9410
|
// created via createElement.
|
8913
9411
|
const {
|
@@ -8937,17 +9435,24 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8937
9435
|
}
|
8938
9436
|
});
|
8939
9437
|
}
|
9438
|
+
// For some reason, JSDOC says "options.is" is a syntax error. And we can't disable the rule using
|
9439
|
+
// `eslint-disable-next-line` because that gets included in the JSDOC, so we need this workaround.
|
9440
|
+
/* eslint-disable jsdoc/valid-types */
|
8940
9441
|
/**
|
8941
9442
|
* EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
|
8942
9443
|
* difference that in the options, you can pass the `is` property set to a Constructor instead of
|
8943
9444
|
* just a string value. The intent is to allow the creation of an element controlled by LWC without
|
8944
9445
|
* having to register the element as a custom element.
|
8945
|
-
*
|
9446
|
+
* @param sel
|
9447
|
+
* @param options
|
9448
|
+
* @param options.is description
|
9449
|
+
* @param options.mode
|
8946
9450
|
* @example
|
8947
9451
|
* ```
|
8948
9452
|
* const el = createElement('x-foo', { is: FooCtor });
|
8949
9453
|
* ```
|
8950
9454
|
*/
|
9455
|
+
/* eslint-enable jsdoc/valid-types */
|
8951
9456
|
function createElement(sel, options) {
|
8952
9457
|
if (!isObject(options) || isNull(options)) {
|
8953
9458
|
throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
|
@@ -8963,12 +9468,17 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8963
9468
|
// passing `sel` as a camel-case, which makes them invalid custom elements name
|
8964
9469
|
// the following line guarantees that this does not leaks beyond this point.
|
8965
9470
|
const tagName = StringToLowerCase.call(sel);
|
9471
|
+
const apiVersion = getComponentAPIVersion(Ctor);
|
9472
|
+
const useNativeCustomElementLifecycle =
|
9473
|
+
// temporary "kill switch"
|
9474
|
+
!lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
8966
9475
|
// the custom element from the registry is expecting an upgrade callback
|
8967
9476
|
/**
|
8968
9477
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
8969
9478
|
* with a callback as the first argument, we could implement a more advanced
|
8970
9479
|
* mechanism that only passes that argument if the constructor is known to be
|
8971
9480
|
* an upgradable custom element.
|
9481
|
+
* @param elm
|
8972
9482
|
*/
|
8973
9483
|
const upgradeCallback = elm => {
|
8974
9484
|
createVM(elm, Ctor, renderer, {
|
@@ -8976,13 +9486,15 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8976
9486
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
8977
9487
|
owner: null
|
8978
9488
|
});
|
8979
|
-
if (!
|
9489
|
+
if (!useNativeCustomElementLifecycle) {
|
9490
|
+
// Monkey-patch on-demand, because if there are no components on the page using an old API
|
9491
|
+
// version, then we don't want to monkey patch at all
|
9492
|
+
monkeyPatchDomAPIs();
|
8980
9493
|
ConnectingSlot.set(elm, connectRootElement);
|
8981
9494
|
DisconnectingSlot.set(elm, disconnectRootElement);
|
8982
9495
|
}
|
8983
9496
|
};
|
8984
|
-
|
8985
|
-
return element;
|
9497
|
+
return createCustomElement(tagName, upgradeCallback, useNativeCustomElementLifecycle);
|
8986
9498
|
}
|
8987
9499
|
|
8988
9500
|
/*
|
@@ -8997,6 +9509,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
8997
9509
|
/**
|
8998
9510
|
* EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
|
8999
9511
|
* ONCE LOCKER V1 IS NO LONGER SUPPORTED.
|
9512
|
+
* @param node
|
9000
9513
|
*/
|
9001
9514
|
function isNodeShadowed(node) {
|
9002
9515
|
if (isFalse(node instanceof _Node)) {
|
@@ -9038,12 +9551,11 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
9038
9551
|
}
|
9039
9552
|
/**
|
9040
9553
|
* This static getter builds a Web Component class from a LWC constructor so it can be registered
|
9041
|
-
* as a new element via customElements.define() at any given time.
|
9042
|
-
*
|
9043
|
-
*
|
9044
|
-
*
|
9045
|
-
*
|
9046
|
-
*
|
9554
|
+
* as a new element via customElements.define() at any given time.
|
9555
|
+
* @example
|
9556
|
+
* import Foo from 'ns/foo';
|
9557
|
+
* customElements.define('x-foo', Foo.CustomElementConstructor);
|
9558
|
+
* const elm = document.createElement('x-foo');
|
9047
9559
|
*/
|
9048
9560
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
9049
9561
|
get() {
|
@@ -9085,7 +9597,7 @@ LWR.define('lwc/v/5_1_0', ['exports'], (function (exports) { 'use strict';
|
|
9085
9597
|
});
|
9086
9598
|
});
|
9087
9599
|
}
|
9088
|
-
/** version:
|
9600
|
+
/** version: 6.2.1 */
|
9089
9601
|
|
9090
9602
|
exports.LightningElement = LightningElement;
|
9091
9603
|
exports.__unstable__ProfilerControl = profilerControl;
|