@lwrjs/everywhere 0.12.0-alpha.9 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/28c3664521d56e175d5ca1cf9ebda4e1/config.js +12 -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_1/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/{6_1_1/s/97cfd3dd664529265351b5d32d878542 → 6_3_4/s/5c26ade60a97bb24c64d3829320b13f6}/lwc.js +594 -284
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_12_0-alpha_9 → 0_12_1}/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_9 → 0_12_1}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_12_0-alpha_9/s/79709c70f3d50912fe767acc3258d0f1 → 0_12_1/s/4fe5b82d1f4caa4814301e2ba9a265de}/lwr_loader.js +133 -127
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_9 → 0_12_1}/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_9/s/f3a204ef43fb3057d910f80d7e9f9ba7 → 0_12_1/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_9 → 0_12_1}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_12_0-alpha_9 → 0_12_1}/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_9 → 0_12_1}/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_9 → 0_12_1}/lwr-loader-shim.bundle.js +167 -134
- package/build/assets/amd/lwr-everywhere-debug.js +168 -136
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +168 -136
- package/build/assets/core/lwr-everywhere-debug.js +164 -132
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +164 -132
- 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/3cfc2173fe2c2b9235ae6dd8bc52de62/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_9/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwc/v/
|
1
|
+
LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -12,21 +12,40 @@ LWR.define('lwc/v/6_1_1', ['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/6_1_1', ['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/6_1_1', ['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/6_1_1', ['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/6_1_1', ['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,18 +292,24 @@ LWR.define('lwc/v/6_1_1', ['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 */:
|
179
303
|
case 1 /* APIFeature.TREAT_ALL_PARSE5_ERRORS_AS_ERRORS */:
|
180
304
|
return apiVersion >= 59 /* APIVersion.V59_246_WINTER_24 */;
|
181
|
-
case 2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */:
|
182
305
|
case 3 /* APIFeature.DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION */:
|
183
306
|
case 4 /* APIFeature.SKIP_UNNECESSARY_REGISTER_DECORATORS */:
|
184
307
|
case 5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */:
|
308
|
+
case 2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */:
|
185
309
|
return apiVersion >= 60 /* APIVersion.V60_248_SPRING_24 */;
|
186
|
-
case
|
310
|
+
case 8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */:
|
187
311
|
case 7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */:
|
312
|
+
case 6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */:
|
188
313
|
return apiVersion >= 61 /* APIVersion.V61_250_SUMMER_24 */;
|
189
314
|
}
|
190
315
|
}
|
@@ -259,6 +384,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
259
384
|
* Map associating previously transformed HTML property into HTML attribute.
|
260
385
|
*/
|
261
386
|
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/new Map();
|
387
|
+
/**
|
388
|
+
*
|
389
|
+
* @param propName
|
390
|
+
*/
|
262
391
|
function htmlPropertyToAttribute(propName) {
|
263
392
|
const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
|
264
393
|
if (!isUndefined$1(ariaAttributeName)) {
|
@@ -291,6 +420,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
291
420
|
* Map associating previously transformed kabab-case attributes into camel-case props.
|
292
421
|
*/
|
293
422
|
const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/new Map();
|
423
|
+
/**
|
424
|
+
*
|
425
|
+
* @param attrName
|
426
|
+
*/
|
294
427
|
function kebabCaseToCamelCase(attrName) {
|
295
428
|
let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName);
|
296
429
|
if (isUndefined$1(result)) {
|
@@ -307,42 +440,47 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
307
440
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
308
441
|
*/
|
309
442
|
// Increment whenever the LWC template compiler changes
|
310
|
-
const LWC_VERSION = "6.
|
443
|
+
const LWC_VERSION = "6.3.4";
|
311
444
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
312
|
-
/** version: 6.
|
445
|
+
/** version: 6.3.4 */
|
313
446
|
|
314
447
|
/**
|
315
448
|
* Copyright (c) 2024 Salesforce, Inc.
|
316
449
|
*/
|
317
450
|
|
318
451
|
/*
|
319
|
-
* Copyright (c)
|
452
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
320
453
|
* All rights reserved.
|
321
454
|
* SPDX-License-Identifier: MIT
|
322
455
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
323
456
|
*/
|
324
457
|
// When deprecating a feature flag, ensure that it is also no longer set in the application. For
|
325
458
|
// example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
|
459
|
+
/** List of all feature flags available, with the default value `null`. */
|
326
460
|
const features = {
|
327
461
|
PLACEHOLDER_TEST_FLAG: null,
|
328
|
-
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
329
462
|
DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
330
463
|
ENABLE_WIRE_SYNC_EMIT: null,
|
331
464
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
332
465
|
ENABLE_FROZEN_TEMPLATE: null,
|
333
466
|
ENABLE_LEGACY_SCOPE_TOKENS: null,
|
334
467
|
ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
|
335
|
-
|
468
|
+
ENABLE_EXPERIMENTAL_SIGNALS: null
|
336
469
|
};
|
337
470
|
if (!globalThis.lwcRuntimeFlags) {
|
338
471
|
Object.defineProperty(globalThis, 'lwcRuntimeFlags', {
|
339
472
|
value: create(null)
|
340
473
|
});
|
341
474
|
}
|
475
|
+
/** Feature flags that have been set. */
|
342
476
|
const flags = globalThis.lwcRuntimeFlags;
|
343
477
|
/**
|
344
478
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
345
479
|
* flag. It is meant to be used during the app initialization.
|
480
|
+
* @param name Name of the feature flag to set
|
481
|
+
* @param value Whether the feature flag should be enabled
|
482
|
+
* @throws Will throw if a non-boolean value is provided when running in production.
|
483
|
+
* @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
|
346
484
|
*/
|
347
485
|
function setFeatureFlag(name, value) {
|
348
486
|
if (!isBoolean(value)) {
|
@@ -380,6 +518,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
380
518
|
/**
|
381
519
|
* Set the value at runtime of a given feature flag. This method should only be used for testing
|
382
520
|
* purposes. It is a no-op when invoked in production mode.
|
521
|
+
* @param name Name of the feature flag to enable or disable
|
522
|
+
* @param value Whether the feature flag should be enabled
|
523
|
+
* @example setFeatureFlag("DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE", true)
|
383
524
|
*/
|
384
525
|
function setFeatureFlagForTest(name, value) {
|
385
526
|
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
@@ -387,7 +528,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
387
528
|
setFeatureFlag(name, value);
|
388
529
|
}
|
389
530
|
}
|
390
|
-
/** version: 6.
|
531
|
+
/** version: 6.3.4 */
|
391
532
|
|
392
533
|
/**
|
393
534
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -412,8 +553,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
412
553
|
const reportingControl = {
|
413
554
|
/**
|
414
555
|
* Attach a new reporting control (aka dispatcher).
|
415
|
-
*
|
416
|
-
* @param dispatcher - reporting control
|
556
|
+
* @param dispatcher reporting control
|
417
557
|
*/
|
418
558
|
attachDispatcher(dispatcher) {
|
419
559
|
enabled$1 = true;
|
@@ -454,7 +594,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
454
594
|
/**
|
455
595
|
* Report to the current dispatcher, if there is one.
|
456
596
|
* @param reportingEventId
|
457
|
-
* @param payload
|
597
|
+
* @param payload data to report
|
458
598
|
*/
|
459
599
|
function report(reportingEventId, payload) {
|
460
600
|
if (enabled$1) {
|
@@ -516,7 +656,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
516
656
|
}
|
517
657
|
|
518
658
|
/*
|
519
|
-
* Copyright (c)
|
659
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
520
660
|
* All rights reserved.
|
521
661
|
* SPDX-License-Identifier: MIT
|
522
662
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -524,7 +664,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
524
664
|
const alreadyLoggedMessages = new Set();
|
525
665
|
// Only used in LWC's Karma tests
|
526
666
|
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
527
|
-
// @ts-ignore
|
528
667
|
window.__lwcResetAlreadyLoggedMessages = () => {
|
529
668
|
alreadyLoggedMessages.clear();
|
530
669
|
};
|
@@ -617,6 +756,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
617
756
|
}
|
618
757
|
observe(job) {
|
619
758
|
const inceptionReactiveRecord = currentReactiveObserver;
|
759
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
620
760
|
currentReactiveObserver = this;
|
621
761
|
let error;
|
622
762
|
try {
|
@@ -665,6 +805,78 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
665
805
|
// we keep track of observing records where the observing record was added to so we can do some clean up later on
|
666
806
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
667
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
|
+
}
|
668
880
|
}
|
669
881
|
function componentValueMutated(vm, key) {
|
670
882
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
@@ -672,10 +884,24 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
672
884
|
valueMutated(vm.component, key);
|
673
885
|
}
|
674
886
|
}
|
675
|
-
function componentValueObserved(vm, key) {
|
887
|
+
function componentValueObserved(vm, key, target = {}) {
|
888
|
+
const {
|
889
|
+
component,
|
890
|
+
tro
|
891
|
+
} = vm;
|
676
892
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
677
893
|
{
|
678
|
-
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));
|
679
905
|
}
|
680
906
|
}
|
681
907
|
function createReactiveObserver(callback) {
|
@@ -712,6 +938,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
712
938
|
}
|
713
939
|
}
|
714
940
|
if (nextTickCallbackQueue.length === 0) {
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
715
942
|
Promise.resolve().then(flushCallbackQueue);
|
716
943
|
}
|
717
944
|
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
@@ -776,31 +1003,15 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
776
1003
|
throw new ReferenceError();
|
777
1004
|
}
|
778
1005
|
}
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
if (lwcRuntimeFlags.DISABLE_TEMPORARY_V5_COMPILER_SUPPORT) {
|
787
|
-
return data;
|
788
|
-
}
|
789
|
-
const {
|
790
|
-
attrs
|
791
|
-
} = data;
|
792
|
-
if (!isUndefined$1(attrs)) {
|
793
|
-
const {
|
794
|
-
slot
|
795
|
-
} = attrs;
|
796
|
-
if (!isUndefined$1(slot) && !isNull(slot)) {
|
797
|
-
return Object.assign(Object.assign({}, data), {
|
798
|
-
attrs: cloneAndOmitKey(attrs, 'slot'),
|
799
|
-
slotAssignment: String(slot)
|
800
|
-
});
|
801
|
-
}
|
1006
|
+
function shouldBeFormAssociated(Ctor) {
|
1007
|
+
const ctorFormAssociated = Boolean(Ctor.formAssociated);
|
1008
|
+
const apiVersion = getComponentAPIVersion(Ctor);
|
1009
|
+
const apiFeatureEnabled = isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
|
1010
|
+
if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
|
1011
|
+
const tagName = getComponentRegisteredName(Ctor);
|
1012
|
+
logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` + `association is not enabled because the API version is ${apiVersion}. To enable form association, ` + `update the LWC component API version to 61 or above. https://lwc.dev/guide/versioning`);
|
802
1013
|
}
|
803
|
-
return
|
1014
|
+
return ctorFormAssociated && apiFeatureEnabled;
|
804
1015
|
}
|
805
1016
|
|
806
1017
|
/*
|
@@ -811,14 +1022,20 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
811
1022
|
*/
|
812
1023
|
function resolveCircularModuleDependency(fn) {
|
813
1024
|
const module = fn();
|
814
|
-
return
|
1025
|
+
return module?.__esModule ? module.default : module;
|
815
1026
|
}
|
816
1027
|
function isCircularModuleDependency(obj) {
|
817
1028
|
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
818
1029
|
}
|
819
|
-
|
820
|
-
|
821
|
-
|
1030
|
+
|
1031
|
+
/*
|
1032
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
1033
|
+
* All rights reserved.
|
1034
|
+
* SPDX-License-Identifier: MIT
|
1035
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1036
|
+
*/
|
1037
|
+
const instrumentDef = globalThis.__lwc_instrument_cmp_def ?? noop;
|
1038
|
+
const instrumentInstance = globalThis.__lwc_instrument_cmp_instance ?? noop;
|
822
1039
|
|
823
1040
|
/*
|
824
1041
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -914,7 +1131,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
914
1131
|
* SPDX-License-Identifier: MIT
|
915
1132
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
916
1133
|
*/
|
917
|
-
/* eslint @lwc/lwc-internal/no-production-assert: "off" */
|
918
1134
|
function generateDataDescriptor(options) {
|
919
1135
|
return assign({
|
920
1136
|
configurable: true,
|
@@ -1061,7 +1277,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1061
1277
|
logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));
|
1062
1278
|
}
|
1063
1279
|
// Typescript does not like it when you treat the `arguments` object as an array
|
1064
|
-
// @ts-
|
1280
|
+
// @ts-expect-error type-mismatch
|
1065
1281
|
return originalAddEventListener.apply(this, arguments);
|
1066
1282
|
}
|
1067
1283
|
})
|
@@ -1110,7 +1326,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1110
1326
|
logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));
|
1111
1327
|
}
|
1112
1328
|
// Typescript does not like it when you treat the `arguments` object as an array
|
1113
|
-
// @ts-
|
1329
|
+
// @ts-expect-error type-mismatch
|
1114
1330
|
return originalAddEventListener.apply(this, arguments);
|
1115
1331
|
}
|
1116
1332
|
})
|
@@ -1502,7 +1718,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1502
1718
|
valueMutated(originalTarget, key);
|
1503
1719
|
return true;
|
1504
1720
|
}
|
1505
|
-
/*LWC compiler v6.
|
1721
|
+
/*LWC compiler v6.3.4*/
|
1506
1722
|
}
|
1507
1723
|
const getterMap = new WeakMap();
|
1508
1724
|
const setterMap = new WeakMap();
|
@@ -1595,7 +1811,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1595
1811
|
/* istanbul ignore next */
|
1596
1812
|
return false;
|
1597
1813
|
}
|
1598
|
-
/*LWC compiler v6.
|
1814
|
+
/*LWC compiler v6.3.4*/
|
1599
1815
|
}
|
1600
1816
|
function extract(objectOrArray) {
|
1601
1817
|
if (isArray(objectOrArray)) {
|
@@ -1781,6 +1997,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1781
1997
|
* EXPERIMENTAL: This function implements an unwrap mechanism that
|
1782
1998
|
* works for observable membrane objects. This API is subject to
|
1783
1999
|
* change or being removed.
|
2000
|
+
* @param value
|
1784
2001
|
*/
|
1785
2002
|
function unwrap(value) {
|
1786
2003
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
@@ -1849,6 +2066,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1849
2066
|
}
|
1850
2067
|
return promise;
|
1851
2068
|
});
|
2069
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
1852
2070
|
Promise.all(promises).then(stylesheetTexts => {
|
1853
2071
|
// When replaceSync() is called, the entire contents of the constructable stylesheet are replaced
|
1854
2072
|
// with the copied+concatenated styles. This means that any shadow root's adoptedStyleSheets that
|
@@ -1893,6 +2111,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1893
2111
|
* that a Custom Element can support (including AOM properties), which
|
1894
2112
|
* determines what kind of capabilities the Base Lightning Element should support. When producing the new descriptors
|
1895
2113
|
* for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
|
2114
|
+
* @param propName
|
2115
|
+
* @param descriptor
|
1896
2116
|
*/
|
1897
2117
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
1898
2118
|
const {
|
@@ -1947,8 +2167,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1947
2167
|
/**
|
1948
2168
|
* This class is the base class for any LWC element.
|
1949
2169
|
* Some elements directly extends this class, others implement it via inheritance.
|
1950
|
-
|
1951
|
-
// @ts-
|
2170
|
+
*/
|
2171
|
+
// @ts-expect-error When exported, it will conform, but we need to build it first!
|
1952
2172
|
const LightningElement = function () {
|
1953
2173
|
// This should be as performant as possible, while any initialization should be done lazily
|
1954
2174
|
if (isNull(vmBeingConstructed)) {
|
@@ -1972,7 +2192,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1972
2192
|
} = vm.renderer;
|
1973
2193
|
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
1974
2194
|
}
|
1975
|
-
const component = this;
|
1976
2195
|
setPrototypeOf(elm, bridge.prototype);
|
1977
2196
|
vm.component = this;
|
1978
2197
|
// Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
|
@@ -1991,7 +2210,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
1991
2210
|
}
|
1992
2211
|
markLockerLiveObject(this);
|
1993
2212
|
// Linking elm, shadow root and component with the VM.
|
1994
|
-
associateVM(
|
2213
|
+
associateVM(this, vm);
|
1995
2214
|
associateVM(elm, vm);
|
1996
2215
|
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
1997
2216
|
vm.renderRoot = doAttachShadow(vm);
|
@@ -2036,69 +2255,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2036
2255
|
logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
|
2037
2256
|
}
|
2038
2257
|
}
|
2039
|
-
//
|
2040
|
-
// https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements
|
2041
|
-
const formAssociatedProps = new Set(['setFormValue', 'form', 'setValidity', 'willValidate', 'validity', 'validationMessage', 'checkValidity', 'reportValidity', 'labels']);
|
2042
|
-
// Verify that access to a form-associated property of the ElementInternals proxy has formAssociated set in the LWC.
|
2043
|
-
function verifyPropForFormAssociation(propertyKey, isFormAssociated) {
|
2044
|
-
if (isString(propertyKey) && formAssociatedProps.has(propertyKey) && !isFormAssociated) {
|
2045
|
-
//Note this error message mirrors Chrome and Firefox error messages, in Safari the error is slightly different.
|
2046
|
-
throw new DOMException(`Failed to execute '${propertyKey}' on 'ElementInternals': The target element is not a form-associated custom element.`);
|
2047
|
-
}
|
2048
|
-
}
|
2049
|
-
const elementInternalsAccessorAllowList = new Set(['shadowRoot', 'role', ...formAssociatedProps]);
|
2050
|
-
// Prevent access to properties not defined in the HTML spec in case browsers decide to
|
2051
|
-
// provide new APIs that provide access to form associated properties.
|
2052
|
-
// This can be removed along with UpgradeableConstructor.
|
2053
|
-
function isAllowedElementInternalAccessor(propertyKey) {
|
2054
|
-
let isAllowedAccessor = false;
|
2055
|
-
// As of this writing all ElementInternal property keys as described in the spec are implemented with strings
|
2056
|
-
// in Chrome, Firefox, and Safari
|
2057
|
-
if (isString(propertyKey)) {
|
2058
|
-
// Allow list is based on HTML spec:
|
2059
|
-
// https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface
|
2060
|
-
isAllowedAccessor = elementInternalsAccessorAllowList.has(propertyKey) || /^aria/.test(propertyKey);
|
2061
|
-
if (!isAllowedAccessor && process.env.NODE_ENV !== 'production') {
|
2062
|
-
logWarn('Only properties defined in the ElementInternals HTML spec are available.');
|
2063
|
-
}
|
2064
|
-
}
|
2065
|
-
return isAllowedAccessor;
|
2066
|
-
}
|
2067
|
-
// Wrap all ElementInternal objects in a proxy to prevent form association when `formAssociated` is not set on an LWC.
|
2068
|
-
// This is needed because the 1UpgradeableConstructor1 always sets `formAssociated=true`, which means all
|
2069
|
-
// ElementInternal objects will have form-associated properties set when an LWC is placed in a form.
|
2070
|
-
// We are doing this to guard against customers taking a dependency on form elements being associated to ElementInternals
|
2071
|
-
// when 'formAssociated' has not been set on the LWC.
|
2072
|
-
function createElementInternalsProxy(elementInternals, isFormAssociated) {
|
2073
|
-
const elementInternalsProxy = new Proxy(elementInternals, {
|
2074
|
-
set(target, propertyKey, newValue) {
|
2075
|
-
if (isAllowedElementInternalAccessor(propertyKey)) {
|
2076
|
-
// Verify that formAssociated is set for form associated properties
|
2077
|
-
verifyPropForFormAssociation(propertyKey, isFormAssociated);
|
2078
|
-
return Reflect.set(target, propertyKey, newValue);
|
2079
|
-
}
|
2080
|
-
// As of this writing ElementInternals do not have non-string properties that can be set.
|
2081
|
-
return false;
|
2082
|
-
},
|
2083
|
-
get(target, propertyKey) {
|
2084
|
-
if (
|
2085
|
-
// Pass through Object.prototype methods such as toString()
|
2086
|
-
hasOwnProperty$1.call(Object.prototype, propertyKey) ||
|
2087
|
-
// As of this writing, ElementInternals only uses Symbol.toStringTag which is called
|
2088
|
-
// on Object.hasOwnProperty invocations
|
2089
|
-
Symbol.for('Symbol.toStringTag') === propertyKey ||
|
2090
|
-
// ElementInternals allow listed properties
|
2091
|
-
isAllowedElementInternalAccessor(propertyKey)) {
|
2092
|
-
// Verify that formAssociated is set for form associated properties
|
2093
|
-
verifyPropForFormAssociation(propertyKey, isFormAssociated);
|
2094
|
-
const propertyValue = Reflect.get(target, propertyKey);
|
2095
|
-
return isFunction$1(propertyValue) ? propertyValue.bind(target) : propertyValue;
|
2096
|
-
}
|
2097
|
-
}
|
2098
|
-
});
|
2099
|
-
return elementInternalsProxy;
|
2100
|
-
}
|
2101
|
-
// @ts-ignore
|
2258
|
+
// Type assertion because we need to build the prototype before it satisfies the interface.
|
2102
2259
|
LightningElement.prototype = {
|
2103
2260
|
constructor: LightningElement,
|
2104
2261
|
dispatchEvent(event) {
|
@@ -2251,19 +2408,18 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2251
2408
|
const vm = getAssociatedVM(this);
|
2252
2409
|
const {
|
2253
2410
|
elm,
|
2254
|
-
|
2255
|
-
formAssociated
|
2256
|
-
},
|
2411
|
+
apiVersion,
|
2257
2412
|
renderer: {
|
2258
2413
|
attachInternals
|
2259
2414
|
}
|
2260
2415
|
} = vm;
|
2416
|
+
if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
|
2417
|
+
throw new Error(`The attachInternals API is only supported in API version 61 and above. ` + `The current version is ${apiVersion}. ` + `To use this API, update the LWC component API version. https://lwc.dev/guide/versioning`);
|
2418
|
+
}
|
2261
2419
|
if (vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
2262
|
-
throw new Error('attachInternals API is not supported in
|
2420
|
+
throw new Error('attachInternals API is not supported in synthetic shadow.');
|
2263
2421
|
}
|
2264
|
-
|
2265
|
-
// #TODO[2970]: remove proxy once `UpgradeableConstructor` has been removed
|
2266
|
-
return createElementInternalsProxy(internals, Boolean(formAssociated));
|
2422
|
+
return attachInternals(elm);
|
2267
2423
|
},
|
2268
2424
|
get isConnected() {
|
2269
2425
|
const vm = getAssociatedVM(this);
|
@@ -2375,6 +2531,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2375
2531
|
if (process.env.NODE_ENV !== 'production') {
|
2376
2532
|
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
2377
2533
|
}
|
2534
|
+
// getChildNodes returns a NodeList, which has `item(index: number): Node | null`.
|
2535
|
+
// NodeListOf<T> extends NodeList, but claims to not return null. That seems inaccurate,
|
2536
|
+
// but these are built-in types, so ultimately not our problem.
|
2378
2537
|
return renderer.getChildNodes(vm.elm);
|
2379
2538
|
},
|
2380
2539
|
get firstChild() {
|
@@ -2481,8 +2640,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2481
2640
|
return {
|
2482
2641
|
get() {
|
2483
2642
|
const vm = getAssociatedVM(this);
|
2484
|
-
|
2485
|
-
|
2643
|
+
const val = vm.cmpFields[key];
|
2644
|
+
componentValueObserved(vm, key, val);
|
2645
|
+
return val;
|
2486
2646
|
},
|
2487
2647
|
set(newValue) {
|
2488
2648
|
const vm = getAssociatedVM(this);
|
@@ -2501,11 +2661,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2501
2661
|
*/
|
2502
2662
|
const AdapterToTokenMap = new Map();
|
2503
2663
|
function createContextProviderWithRegister(adapter, registerContextProvider) {
|
2504
|
-
|
2505
|
-
if (!isUndefined$1(adapterContextToken)) {
|
2664
|
+
if (AdapterToTokenMap.has(adapter)) {
|
2506
2665
|
throw new Error(`Adapter already has a context provider.`);
|
2507
2666
|
}
|
2508
|
-
adapterContextToken = guid();
|
2667
|
+
const adapterContextToken = guid();
|
2509
2668
|
AdapterToTokenMap.set(adapter, adapterContextToken);
|
2510
2669
|
const providers = new WeakSet();
|
2511
2670
|
return (elmOrComponent, options) => {
|
@@ -2610,6 +2769,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2610
2769
|
if (hasPendingConfig === false) {
|
2611
2770
|
hasPendingConfig = true;
|
2612
2771
|
// collect new config in the micro-task
|
2772
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2613
2773
|
Promise.resolve().then(() => {
|
2614
2774
|
hasPendingConfig = false;
|
2615
2775
|
// resetting current reactive params
|
@@ -2624,7 +2784,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2624
2784
|
ro.observe(() => config = configCallback(component));
|
2625
2785
|
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
2626
2786
|
// TODO: dev-mode validation of config based on the adapter.configSchema
|
2627
|
-
// @ts-
|
2787
|
+
// @ts-expect-error it is assigned in the observe() callback
|
2628
2788
|
callbackWhenConfigIsReady(config);
|
2629
2789
|
};
|
2630
2790
|
return {
|
@@ -2708,7 +2868,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2708
2868
|
});
|
2709
2869
|
}
|
2710
2870
|
return {
|
2711
|
-
// @ts-
|
2871
|
+
// @ts-expect-error the boundary protection executes sync, connector is always defined
|
2712
2872
|
connector,
|
2713
2873
|
computeConfigAndUpdate,
|
2714
2874
|
resetConfigWatcher: () => ro.reset()
|
@@ -2769,6 +2929,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2769
2929
|
connector.connect();
|
2770
2930
|
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
2771
2931
|
if (hasDynamicParams) {
|
2932
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2772
2933
|
Promise.resolve().then(computeConfigAndUpdate);
|
2773
2934
|
return;
|
2774
2935
|
}
|
@@ -2824,8 +2985,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2824
2985
|
}
|
2825
2986
|
return;
|
2826
2987
|
}
|
2827
|
-
|
2828
|
-
|
2988
|
+
const val = vm.cmpProps[key];
|
2989
|
+
componentValueObserved(vm, key, val);
|
2990
|
+
return val;
|
2829
2991
|
},
|
2830
2992
|
set(newValue) {
|
2831
2993
|
const vm = getAssociatedVM(this);
|
@@ -2902,8 +3064,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2902
3064
|
return {
|
2903
3065
|
get() {
|
2904
3066
|
const vm = getAssociatedVM(this);
|
2905
|
-
|
2906
|
-
|
3067
|
+
const val = vm.cmpFields[key];
|
3068
|
+
componentValueObserved(vm, key, val);
|
3069
|
+
return val;
|
2907
3070
|
},
|
2908
3071
|
set(newValue) {
|
2909
3072
|
const vm = getAssociatedVM(this);
|
@@ -2931,9 +3094,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
2931
3094
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
2932
3095
|
*/
|
2933
3096
|
/**
|
2934
|
-
* @wire decorator
|
3097
|
+
* The @wire decorator wires fields and methods to a wire adapter in
|
2935
3098
|
* LWC Components. This function implements the internals of this
|
2936
3099
|
* decorator.
|
3100
|
+
* @param _adapter
|
3101
|
+
* @param _config
|
2937
3102
|
*/
|
2938
3103
|
function wire(_adapter, _config) {
|
2939
3104
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -3041,6 +3206,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3041
3206
|
/**
|
3042
3207
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
3043
3208
|
* will prevent this function from being imported by user-land code.
|
3209
|
+
* @param Ctor
|
3210
|
+
* @param meta
|
3044
3211
|
*/
|
3045
3212
|
function registerDecorators(Ctor, meta) {
|
3046
3213
|
const proto = Ctor.prototype;
|
@@ -3202,7 +3369,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3202
3369
|
let warned = false;
|
3203
3370
|
// Only used in LWC's Karma tests
|
3204
3371
|
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
3205
|
-
// @ts-ignore
|
3206
3372
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
3207
3373
|
warned = false;
|
3208
3374
|
};
|
@@ -3236,6 +3402,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3236
3402
|
/**
|
3237
3403
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
3238
3404
|
* will prevent this function from being imported by userland code.
|
3405
|
+
* @param tpl
|
3239
3406
|
*/
|
3240
3407
|
function registerTemplate(tpl) {
|
3241
3408
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -3249,6 +3416,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3249
3416
|
/**
|
3250
3417
|
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
3251
3418
|
* libraries to sanitize vulnerable attributes.
|
3419
|
+
* @param tagName
|
3420
|
+
* @param namespaceUri
|
3421
|
+
* @param attrName
|
3422
|
+
* @param attrValue
|
3252
3423
|
*/
|
3253
3424
|
function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
3254
3425
|
// locker-service patches this function during runtime to sanitize vulnerable attributes. When
|
@@ -3321,7 +3492,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3321
3492
|
if (!isUndefined$1(superAttributeChangedCallback)) {
|
3322
3493
|
// delegate unknown attributes to the super.
|
3323
3494
|
// Typescript does not like it when you treat the `arguments` object as an array
|
3324
|
-
// @ts-
|
3495
|
+
// @ts-expect-error type-mismatch
|
3325
3496
|
superAttributeChangedCallback.apply(this, arguments);
|
3326
3497
|
}
|
3327
3498
|
return;
|
@@ -3347,7 +3518,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3347
3518
|
}
|
3348
3519
|
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
|
3349
3520
|
const HTMLBridgeElement = class extends SuperClass {
|
3350
|
-
/*LWC compiler v6.
|
3521
|
+
/*LWC compiler v6.3.4*/
|
3351
3522
|
};
|
3352
3523
|
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
3353
3524
|
// and false positives in case of inheritance.
|
@@ -3803,6 +3974,12 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3803
3974
|
let shadowSupportMode = superDef.shadowSupportMode;
|
3804
3975
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
3805
3976
|
shadowSupportMode = ctorShadowSupportMode;
|
3977
|
+
if (isReportingEnabled() && (shadowSupportMode === "any" /* ShadowSupportMode.Any */ || shadowSupportMode === "native" /* ShadowSupportMode.Native */)) {
|
3978
|
+
report("ShadowSupportModeUsage" /* ReportingEventId.ShadowSupportModeUsage */, {
|
3979
|
+
tagName: Ctor.name,
|
3980
|
+
mode: shadowSupportMode
|
3981
|
+
});
|
3982
|
+
}
|
3806
3983
|
}
|
3807
3984
|
let renderMode = superDef.renderMode;
|
3808
3985
|
if (!isUndefined$1(ctorRenderMode)) {
|
@@ -3848,6 +4025,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3848
4025
|
/**
|
3849
4026
|
* EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
|
3850
4027
|
* subject to change or being removed.
|
4028
|
+
* @param ctor
|
3851
4029
|
*/
|
3852
4030
|
function isComponentConstructor(ctor) {
|
3853
4031
|
if (!isFunction$1(ctor)) {
|
@@ -3921,6 +4099,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
3921
4099
|
/**
|
3922
4100
|
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
3923
4101
|
* subject to change or being removed.
|
4102
|
+
* @param Ctor
|
3924
4103
|
*/
|
3925
4104
|
function getComponentDef(Ctor) {
|
3926
4105
|
const def = getComponentInternalDef(Ctor);
|
@@ -4135,6 +4314,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4135
4314
|
* If the component that is currently being rendered uses scoped styles,
|
4136
4315
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
4137
4316
|
* it returns null.
|
4317
|
+
* @param owner
|
4318
|
+
* @param legacy
|
4138
4319
|
*/
|
4139
4320
|
// TODO [#3733]: remove support for legacy scope tokens
|
4140
4321
|
function getScopeTokenClass(owner, legacy) {
|
@@ -4142,13 +4323,14 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4142
4323
|
cmpTemplate,
|
4143
4324
|
context
|
4144
4325
|
} = owner;
|
4145
|
-
return context.hasScopedStyles && (legacy ? cmpTemplate
|
4326
|
+
return context.hasScopedStyles && (legacy ? cmpTemplate?.legacyStylesheetToken : cmpTemplate?.stylesheetToken) || null;
|
4146
4327
|
}
|
4147
4328
|
/**
|
4148
4329
|
* This function returns the host style token for a custom element if it
|
4149
4330
|
* exists. Otherwise it returns null.
|
4150
4331
|
*
|
4151
4332
|
* A host style token is applied to the component if scoped styles are used.
|
4333
|
+
* @param vnode
|
4152
4334
|
*/
|
4153
4335
|
function getStylesheetTokenHost(vnode) {
|
4154
4336
|
const {
|
@@ -4285,7 +4467,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4285
4467
|
const {
|
4286
4468
|
slotAssignment
|
4287
4469
|
} = vnode;
|
4288
|
-
if (
|
4470
|
+
if (oldVnode?.slotAssignment === slotAssignment) {
|
4289
4471
|
return;
|
4290
4472
|
}
|
4291
4473
|
const {
|
@@ -4372,6 +4554,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4372
4554
|
return EmptyObject;
|
4373
4555
|
}
|
4374
4556
|
// computed class names must be string
|
4557
|
+
// This will throw if className is a symbol or null-prototype object
|
4558
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
4375
4559
|
className = isString(className) ? className : className + '';
|
4376
4560
|
let map = classNameToClassMap[className];
|
4377
4561
|
if (map) {
|
@@ -4466,11 +4650,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4466
4650
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
4467
4651
|
*/
|
4468
4652
|
function applyEventListeners(vnode, renderer) {
|
4469
|
-
var _a;
|
4470
4653
|
const {
|
4471
4654
|
elm
|
4472
4655
|
} = vnode;
|
4473
|
-
const on =
|
4656
|
+
const on = vnode.data?.on;
|
4474
4657
|
if (isUndefined$1(on)) {
|
4475
4658
|
return;
|
4476
4659
|
}
|
@@ -4622,13 +4805,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4622
4805
|
}
|
4623
4806
|
/**
|
4624
4807
|
* Given an array of static parts, do all the mounting required for these parts.
|
4625
|
-
*
|
4626
|
-
* @param
|
4627
|
-
* @param
|
4628
|
-
* @param renderer - the renderer to use
|
4629
|
-
* @param mount - true this is a first (mount) render as opposed to a subsequent (patch) render
|
4808
|
+
* @param root the root element
|
4809
|
+
* @param vnode the parent VStatic
|
4810
|
+
* @param renderer the renderer to use
|
4630
4811
|
*/
|
4631
|
-
function
|
4812
|
+
function mountStaticParts(root, vnode, renderer) {
|
4632
4813
|
const {
|
4633
4814
|
parts,
|
4634
4815
|
owner
|
@@ -4636,20 +4817,45 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4636
4817
|
if (isUndefined$1(parts)) {
|
4637
4818
|
return;
|
4638
4819
|
}
|
4639
|
-
// This adds `part.elm` to each `part`. We have to do this on every mount
|
4820
|
+
// This adds `part.elm` to each `part`. We have to do this on every mount because the `parts`
|
4640
4821
|
// array is recreated from scratch every time, so each `part.elm` is now undefined.
|
4641
|
-
// TODO [#3800]: avoid calling traverseAndSetElements on every re-render
|
4642
4822
|
traverseAndSetElements(root, parts, renderer);
|
4643
4823
|
// Currently only event listeners and refs are supported for static vnodes
|
4644
4824
|
for (const part of parts) {
|
4645
|
-
|
4646
|
-
|
4647
|
-
applyEventListeners(part, renderer);
|
4648
|
-
}
|
4825
|
+
// Event listeners only need to be applied once when mounting
|
4826
|
+
applyEventListeners(part, renderer);
|
4649
4827
|
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4650
4828
|
applyRefs(part, owner);
|
4651
4829
|
}
|
4652
4830
|
}
|
4831
|
+
/**
|
4832
|
+
* Mounts elements to the newly generated VStatic node
|
4833
|
+
* @param n1 the previous VStatic vnode
|
4834
|
+
* @param n2 the current VStatic vnode
|
4835
|
+
*/
|
4836
|
+
function patchStaticParts(n1, n2) {
|
4837
|
+
const {
|
4838
|
+
parts: currParts,
|
4839
|
+
owner: currPartsOwner
|
4840
|
+
} = n2;
|
4841
|
+
if (isUndefined$1(currParts)) {
|
4842
|
+
return;
|
4843
|
+
}
|
4844
|
+
const {
|
4845
|
+
parts: prevParts
|
4846
|
+
} = n1;
|
4847
|
+
if (process.env.NODE_ENV !== 'production') {
|
4848
|
+
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.');
|
4849
|
+
}
|
4850
|
+
for (let i = 0; i < currParts.length; i++) {
|
4851
|
+
const part = currParts[i];
|
4852
|
+
// Patch only occurs if the vnode is newly generated, which means the part.elm is always undefined
|
4853
|
+
// Since the vnode and elements are the same we can safely assume that prevParts[i].elm is defined.
|
4854
|
+
part.elm = prevParts[i].elm;
|
4855
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4856
|
+
applyRefs(part, currPartsOwner);
|
4857
|
+
}
|
4858
|
+
}
|
4653
4859
|
|
4654
4860
|
/*
|
4655
4861
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -4665,7 +4871,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4665
4871
|
}
|
4666
4872
|
}
|
4667
4873
|
function patch(n1, n2, parent, renderer) {
|
4668
|
-
var _a, _b;
|
4669
4874
|
if (n1 === n2) {
|
4670
4875
|
return;
|
4671
4876
|
}
|
@@ -4701,15 +4906,14 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4701
4906
|
patchFragment(n1, n2, parent, renderer);
|
4702
4907
|
break;
|
4703
4908
|
case 2 /* VNodeType.Element */:
|
4704
|
-
patchElement(n1, n2,
|
4909
|
+
patchElement(n1, n2, n2.data.renderer ?? renderer);
|
4705
4910
|
break;
|
4706
4911
|
case 3 /* VNodeType.CustomElement */:
|
4707
|
-
patchCustomElement(n1, n2, parent,
|
4912
|
+
patchCustomElement(n1, n2, parent, n2.data.renderer ?? renderer);
|
4708
4913
|
break;
|
4709
4914
|
}
|
4710
4915
|
}
|
4711
4916
|
function mount(node, parent, renderer, anchor) {
|
4712
|
-
var _a, _b;
|
4713
4917
|
switch (node.type) {
|
4714
4918
|
case 0 /* VNodeType.Text */:
|
4715
4919
|
// VText has no special capability, fallback to the owner's renderer
|
@@ -4728,11 +4932,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4728
4932
|
break;
|
4729
4933
|
case 2 /* VNodeType.Element */:
|
4730
4934
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
4731
|
-
mountElement(node, parent, anchor,
|
4935
|
+
mountElement(node, parent, anchor, node.data.renderer ?? renderer);
|
4732
4936
|
break;
|
4733
4937
|
case 3 /* VNodeType.CustomElement */:
|
4734
4938
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
4735
|
-
mountCustomElement(node, parent, anchor,
|
4939
|
+
mountCustomElement(node, parent, anchor, node.data.renderer ?? renderer);
|
4736
4940
|
break;
|
4737
4941
|
}
|
4738
4942
|
}
|
@@ -4814,11 +5018,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4814
5018
|
mountVNodes(vnode.children, elm, renderer, null);
|
4815
5019
|
}
|
4816
5020
|
function patchStatic(n1, n2, renderer) {
|
4817
|
-
|
5021
|
+
n2.elm = n1.elm;
|
4818
5022
|
// slotAssignments can only apply to the top level element, never to a static part.
|
4819
5023
|
patchSlotAssignment(n1, n2, renderer);
|
4820
5024
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
4821
|
-
|
5025
|
+
patchStaticParts(n1, n2);
|
4822
5026
|
}
|
4823
5027
|
function patchElement(n1, n2, renderer) {
|
4824
5028
|
const elm = n2.elm = n1.elm;
|
@@ -4849,7 +5053,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4849
5053
|
// slotAssignments can only apply to the top level element, never to a static part.
|
4850
5054
|
patchSlotAssignment(null, vnode, renderer);
|
4851
5055
|
insertNode(elm, parent, anchor, renderer);
|
4852
|
-
|
5056
|
+
mountStaticParts(elm, vnode, renderer);
|
4853
5057
|
}
|
4854
5058
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
4855
5059
|
const {
|
@@ -4877,7 +5081,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
4877
5081
|
// compatibility, we lower case the tagname here.
|
4878
5082
|
const normalizedTagname = sel.toLowerCase();
|
4879
5083
|
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
4880
|
-
const
|
5084
|
+
const isFormAssociated = shouldBeFormAssociated(ctor);
|
5085
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle, isFormAssociated);
|
4881
5086
|
vnode.elm = elm;
|
4882
5087
|
vnode.vm = vm;
|
4883
5088
|
linkNodeToShadow(elm, owner, renderer);
|
@@ -5135,22 +5340,20 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5135
5340
|
}
|
5136
5341
|
}
|
5137
5342
|
function applyDomManual(elm, vnode) {
|
5138
|
-
var _a;
|
5139
5343
|
const {
|
5140
5344
|
owner,
|
5141
5345
|
data: {
|
5142
5346
|
context
|
5143
5347
|
}
|
5144
5348
|
} = vnode;
|
5145
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ &&
|
5349
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && context?.lwc?.dom === "manual" /* LwcDomMode.Manual */) {
|
5146
5350
|
elm.$domManual$ = true;
|
5147
5351
|
}
|
5148
5352
|
}
|
5149
5353
|
function applyElementRestrictions(elm, vnode) {
|
5150
|
-
var _a, _b;
|
5151
5354
|
if (process.env.NODE_ENV !== 'production') {
|
5152
5355
|
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
5153
|
-
const isPortal = vnode.type === 2 /* VNodeType.Element */ &&
|
5356
|
+
const isPortal = vnode.type === 2 /* VNodeType.Element */ && vnode.data.context?.lwc?.dom === "manual" /* LwcDomMode.Manual */;
|
5154
5357
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
5155
5358
|
patchElementWithRestrictions(elm, {
|
5156
5359
|
isPortal,
|
@@ -5205,6 +5408,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5205
5408
|
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
5206
5409
|
*
|
5207
5410
|
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
5411
|
+
* @param children
|
5208
5412
|
*/
|
5209
5413
|
function flattenFragmentsInChildren(children) {
|
5210
5414
|
const flattenedChildren = [];
|
@@ -5263,7 +5467,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5263
5467
|
return vm;
|
5264
5468
|
}
|
5265
5469
|
function allocateInSlot(vm, children, owner) {
|
5266
|
-
var _a;
|
5267
5470
|
const {
|
5268
5471
|
cmpSlots: {
|
5269
5472
|
slotAssignments: oldSlotsMapping
|
@@ -5278,7 +5481,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5278
5481
|
}
|
5279
5482
|
let slotName = '';
|
5280
5483
|
if (isVBaseElement(vnode) || isVStatic(vnode)) {
|
5281
|
-
slotName =
|
5484
|
+
slotName = vnode.slotAssignment ?? '';
|
5282
5485
|
} else if (isVScopedSlotFragment(vnode)) {
|
5283
5486
|
slotName = vnode.slotName;
|
5284
5487
|
}
|
@@ -5286,6 +5489,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5286
5489
|
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
5287
5490
|
// the following line also throws same error for symbols
|
5288
5491
|
// Similar for Object.create(null)
|
5492
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
5289
5493
|
const normalizedSlotName = '' + slotName;
|
5290
5494
|
const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
5291
5495
|
ArrayPush$1.call(vnodes, vnode);
|
@@ -5577,8 +5781,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5577
5781
|
}
|
5578
5782
|
});
|
5579
5783
|
}
|
5580
|
-
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
5581
|
-
data = applyTemporaryCompilerV5SlotFix(data);
|
5582
5784
|
const {
|
5583
5785
|
key,
|
5584
5786
|
slotAssignment
|
@@ -5621,8 +5823,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5621
5823
|
renderMode,
|
5622
5824
|
apiVersion
|
5623
5825
|
} = vmBeingRendered;
|
5624
|
-
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
5625
|
-
data = applyTemporaryCompilerV5SlotFix(data);
|
5626
5826
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
5627
5827
|
const newChildren = [];
|
5628
5828
|
const slotAssignments = slotset.slotAssignments[slotName];
|
@@ -5669,13 +5869,14 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5669
5869
|
// to the vnode because the current way the diffing algo works, it will replace the original reference
|
5670
5870
|
// to the host element with a new one. This means the new element will be mounted and immediately unmounted.
|
5671
5871
|
// Creating a copy of the vnode to preserve a reference to the previous host element.
|
5672
|
-
clonedVNode =
|
5872
|
+
clonedVNode = {
|
5873
|
+
...vnode,
|
5673
5874
|
slotAssignment: data.slotAssignment
|
5674
|
-
}
|
5875
|
+
};
|
5675
5876
|
}
|
5676
5877
|
// If the slot content is standard type, the content is static, no additional
|
5677
5878
|
// processing needed on the vnode
|
5678
|
-
ArrayPush$1.call(newChildren, clonedVNode
|
5879
|
+
ArrayPush$1.call(newChildren, clonedVNode ?? vnode);
|
5679
5880
|
}
|
5680
5881
|
}
|
5681
5882
|
}
|
@@ -5721,8 +5922,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5721
5922
|
});
|
5722
5923
|
}
|
5723
5924
|
}
|
5724
|
-
// TODO [#3974]: remove temporary logic to support v5 compiler + v6+ engine
|
5725
|
-
data = applyTemporaryCompilerV5SlotFix(data);
|
5726
5925
|
const {
|
5727
5926
|
key,
|
5728
5927
|
slotAssignment
|
@@ -5818,6 +6017,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5818
6017
|
}
|
5819
6018
|
/**
|
5820
6019
|
* [f]lattening
|
6020
|
+
* @param items
|
5821
6021
|
*/
|
5822
6022
|
function f(items) {
|
5823
6023
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5939,6 +6139,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5939
6139
|
* [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
5940
6140
|
*
|
5941
6141
|
* TODO [#3331]: remove usage of lwc:dynamic in 246
|
6142
|
+
* @param sel
|
6143
|
+
* @param Ctor
|
6144
|
+
* @param data
|
6145
|
+
* @param children
|
5942
6146
|
*/
|
5943
6147
|
function ddc(sel, Ctor, data, children = EmptyArray) {
|
5944
6148
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5957,6 +6161,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5957
6161
|
}
|
5958
6162
|
/**
|
5959
6163
|
* [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
|
6164
|
+
* @param Ctor
|
6165
|
+
* @param data
|
6166
|
+
* @param children
|
5960
6167
|
*/
|
5961
6168
|
function dc(Ctor, data, children = EmptyArray) {
|
5962
6169
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -5984,13 +6191,13 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
5984
6191
|
* to the engine that a particular collection of children must be diffed using the slow
|
5985
6192
|
* algo based on keys due to the nature of the list. E.g.:
|
5986
6193
|
*
|
5987
|
-
*
|
5988
|
-
*
|
5989
|
-
*
|
5990
|
-
*
|
5991
|
-
*
|
5992
|
-
*
|
5993
|
-
*
|
6194
|
+
* - slot element's children: the content of the slot has to be dynamic when in synthetic
|
6195
|
+
* shadow mode because the `vnode.children` might be the slotted
|
6196
|
+
* content vs default content, in which case the size and the
|
6197
|
+
* keys are not matching.
|
6198
|
+
* - children that contain dynamic components
|
6199
|
+
* - children that are produced by iteration
|
6200
|
+
* @param vnodes
|
5994
6201
|
*/
|
5995
6202
|
function sc(vnodes) {
|
5996
6203
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -6014,6 +6221,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6014
6221
|
};
|
6015
6222
|
/**
|
6016
6223
|
* Sets the sanitizeHtmlContentHook.
|
6224
|
+
* @param newHookImpl
|
6017
6225
|
*/
|
6018
6226
|
function setSanitizeHtmlContentHook(newHookImpl) {
|
6019
6227
|
sanitizeHtmlContentHook = newHookImpl;
|
@@ -6126,7 +6334,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6126
6334
|
start(markName);
|
6127
6335
|
}
|
6128
6336
|
if (isProfilerEnabled) {
|
6129
|
-
currentDispatcher(opId, 0 /* Phase.Start */, vm
|
6337
|
+
currentDispatcher(opId, 0 /* Phase.Start */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
6130
6338
|
}
|
6131
6339
|
}
|
6132
6340
|
function logGlobalOperationEnd(opId, vm) {
|
@@ -6136,7 +6344,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6136
6344
|
end(opName, markName);
|
6137
6345
|
}
|
6138
6346
|
if (isProfilerEnabled) {
|
6139
|
-
currentDispatcher(opId, 1 /* Phase.Stop */, vm
|
6347
|
+
currentDispatcher(opId, 1 /* Phase.Stop */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
6140
6348
|
}
|
6141
6349
|
}
|
6142
6350
|
|
@@ -6160,7 +6368,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6160
6368
|
cmpSlots
|
6161
6369
|
} = vm;
|
6162
6370
|
for (const slotName in cmpSlots.slotAssignments) {
|
6163
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
6164
6371
|
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}.`);
|
6165
6372
|
}
|
6166
6373
|
}
|
@@ -6179,9 +6386,27 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6179
6386
|
}
|
6180
6387
|
}
|
6181
6388
|
}
|
6389
|
+
// This should be a no-op outside of LWC's Karma tests, where it's not needed
|
6390
|
+
let registerFragmentCache = noop;
|
6391
|
+
// Only used in LWC's Karma tests
|
6392
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
6393
|
+
// Keep track of fragmentCaches, so we can clear them in LWC's Karma tests
|
6394
|
+
const fragmentCaches = [];
|
6395
|
+
registerFragmentCache = fragmentCache => {
|
6396
|
+
fragmentCaches.push(fragmentCache);
|
6397
|
+
};
|
6398
|
+
window.__lwcResetFragmentCaches = () => {
|
6399
|
+
for (const fragmentCache of fragmentCaches) {
|
6400
|
+
for (const key of keys(fragmentCache)) {
|
6401
|
+
delete fragmentCache[key];
|
6402
|
+
}
|
6403
|
+
}
|
6404
|
+
};
|
6405
|
+
}
|
6182
6406
|
function buildParseFragmentFn(createFragmentFn) {
|
6183
6407
|
return (strings, ...keys) => {
|
6184
6408
|
const cache = create(null);
|
6409
|
+
registerFragmentCache(cache);
|
6185
6410
|
return function () {
|
6186
6411
|
const {
|
6187
6412
|
context: {
|
@@ -6202,11 +6427,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6202
6427
|
if (hasStyleToken && isSyntheticShadow) {
|
6203
6428
|
cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
|
6204
6429
|
}
|
6205
|
-
if (hasLegacyToken) {
|
6206
|
-
// This isn't strictly required for prod, but it's required for our karma tests
|
6207
|
-
// since the lwcRuntimeFlag may change over time
|
6208
|
-
cacheKey |= 4 /* FragmentCache.HAS_LEGACY_SCOPE_TOKEN */;
|
6209
|
-
}
|
6210
6430
|
if (!isUndefined$1(cache[cacheKey])) {
|
6211
6431
|
return cache[cacheKey];
|
6212
6432
|
}
|
@@ -6474,6 +6694,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6474
6694
|
/**
|
6475
6695
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
6476
6696
|
* will prevent this function from being imported by userland code.
|
6697
|
+
* @param Ctor
|
6698
|
+
* @param metadata
|
6477
6699
|
*/
|
6478
6700
|
function registerComponent(
|
6479
6701
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
@@ -6492,16 +6714,14 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6492
6714
|
return Ctor;
|
6493
6715
|
}
|
6494
6716
|
function getComponentRegisteredTemplate(Ctor) {
|
6495
|
-
|
6496
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
|
6717
|
+
return registeredComponentMap.get(Ctor)?.tmpl;
|
6497
6718
|
}
|
6498
6719
|
function getComponentRegisteredName(Ctor) {
|
6499
|
-
|
6500
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
|
6720
|
+
return registeredComponentMap.get(Ctor)?.sel;
|
6501
6721
|
}
|
6502
6722
|
function getComponentAPIVersion(Ctor) {
|
6503
6723
|
const metadata = registeredComponentMap.get(Ctor);
|
6504
|
-
const apiVersion = metadata
|
6724
|
+
const apiVersion = metadata?.apiVersion;
|
6505
6725
|
if (isUndefined$1(apiVersion)) {
|
6506
6726
|
// This should only occur in our Karma tests; in practice every component
|
6507
6727
|
// is registered, and so this code path should not get hit. But to be safe,
|
@@ -6521,11 +6741,30 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6521
6741
|
}
|
6522
6742
|
});
|
6523
6743
|
}
|
6744
|
+
function resetTemplateObserverAndUnsubscribe(vm) {
|
6745
|
+
const {
|
6746
|
+
tro,
|
6747
|
+
component
|
6748
|
+
} = vm;
|
6749
|
+
tro.reset();
|
6750
|
+
// Unsubscribe every time the template reactive observer is reset.
|
6751
|
+
if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
|
6752
|
+
unsubscribeFromSignals(component);
|
6753
|
+
}
|
6754
|
+
}
|
6524
6755
|
function renderComponent(vm) {
|
6525
6756
|
if (process.env.NODE_ENV !== 'production') {
|
6526
6757
|
assert.invariant(vm.isDirty, `${vm} is not dirty.`);
|
6527
6758
|
}
|
6528
|
-
|
6759
|
+
// The engine should only hold a subscription to a signal if it is rendered in the template.
|
6760
|
+
// Because of the potential presence of conditional rendering logic, we unsubscribe on each render
|
6761
|
+
// in the scenario where it is present in one condition but not the other.
|
6762
|
+
// For example:
|
6763
|
+
// 1. There is an lwc:if=true conditional where the signal is present on the template.
|
6764
|
+
// 2. The lwc:if changes to false and the signal is no longer present on the template.
|
6765
|
+
// If the signal is still subscribed to, the template will re-render when it receives a notification
|
6766
|
+
// from the signal, even though we won't be using the new value.
|
6767
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
6529
6768
|
const vnodes = invokeComponentRenderMethod(vm);
|
6530
6769
|
vm.isDirty = false;
|
6531
6770
|
vm.isScheduled = false;
|
@@ -6556,7 +6795,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6556
6795
|
}
|
6557
6796
|
|
6558
6797
|
/*
|
6559
|
-
* Copyright (c)
|
6798
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
6560
6799
|
* All rights reserved.
|
6561
6800
|
* SPDX-License-Identifier: MIT
|
6562
6801
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -6602,11 +6841,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6602
6841
|
state
|
6603
6842
|
} = vm;
|
6604
6843
|
if (state !== 2 /* VMState.disconnected */) {
|
6605
|
-
const {
|
6606
|
-
tro
|
6607
|
-
} = vm;
|
6608
6844
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
6609
|
-
|
6845
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
6610
6846
|
runDisconnectedCallback(vm);
|
6611
6847
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
6612
6848
|
runChildNodesDisconnectedCallback(vm);
|
@@ -6793,13 +7029,12 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6793
7029
|
};
|
6794
7030
|
}
|
6795
7031
|
function computeShadowMode(def, owner, renderer, hydrated) {
|
7032
|
+
if (
|
6796
7033
|
// Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
|
6797
7034
|
// on, but components running in actual native shadow mode
|
6798
|
-
|
6799
|
-
|
6800
|
-
|
6801
|
-
if (isTrue(hydrated)) {
|
6802
|
-
// hydration only supports native shadow
|
7035
|
+
process.env.NODE_ENV === 'test-karma-lwc' && process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST ||
|
7036
|
+
// hydration only supports native shadow
|
7037
|
+
isTrue(hydrated)) {
|
6803
7038
|
return 0 /* ShadowMode.Native */;
|
6804
7039
|
}
|
6805
7040
|
const {
|
@@ -6832,7 +7067,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6832
7067
|
return shadowMode;
|
6833
7068
|
}
|
6834
7069
|
function assertIsVM(obj) {
|
6835
|
-
if (
|
7070
|
+
if (!isObject(obj) || isNull(obj) || !('renderRoot' in obj)) {
|
6836
7071
|
throw new TypeError(`${obj} is not a VM.`);
|
6837
7072
|
}
|
6838
7073
|
}
|
@@ -6931,7 +7166,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
6931
7166
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
6932
7167
|
// re-throwing the original error will break the current tick, but since the next tick is
|
6933
7168
|
// already scheduled, it should continue patching the rest.
|
6934
|
-
throw error;
|
7169
|
+
throw error;
|
6935
7170
|
}
|
6936
7171
|
}
|
6937
7172
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
@@ -7035,6 +7270,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7035
7270
|
* need to continue into its children because by attempting to disconnect the
|
7036
7271
|
* custom element itself will trigger the removal of anything slotted or anything
|
7037
7272
|
* defined on its shadow.
|
7273
|
+
* @param vnodes
|
7038
7274
|
*/
|
7039
7275
|
function recursivelyDisconnectChildren(vnodes) {
|
7040
7276
|
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
@@ -7154,18 +7390,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7154
7390
|
function runFormAssociatedCustomElementCallback(vm, faceCb) {
|
7155
7391
|
const {
|
7156
7392
|
renderMode,
|
7157
|
-
shadowMode
|
7158
|
-
def: {
|
7159
|
-
formAssociated
|
7160
|
-
}
|
7393
|
+
shadowMode
|
7161
7394
|
} = vm;
|
7162
|
-
// Technically the UpgradableConstructor always sets `static formAssociated = true` but silently fail here to match browser behavior.
|
7163
|
-
if (isUndefined$1(formAssociated) || isFalse(formAssociated)) {
|
7164
|
-
if (process.env.NODE_ENV !== 'production') {
|
7165
|
-
logWarn(`Form associated lifecycle methods must have the 'static formAssociated' value set in the component's prototype chain.`);
|
7166
|
-
}
|
7167
|
-
return;
|
7168
|
-
}
|
7169
7395
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode !== 0 /* RenderMode.Light */) {
|
7170
7396
|
throw new Error('Form associated lifecycle methods are not available in synthetic shadow. Please use native shadow or light DOM.');
|
7171
7397
|
}
|
@@ -7420,7 +7646,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7420
7646
|
setValueType = isNull(setValue) ? 'null' : typeof setValue;
|
7421
7647
|
}
|
7422
7648
|
report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
|
7423
|
-
tagName: vm
|
7649
|
+
tagName: vm?.tagName,
|
7424
7650
|
propertyName: prop,
|
7425
7651
|
isSetter,
|
7426
7652
|
setValueType
|
@@ -7441,7 +7667,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7441
7667
|
throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
|
7442
7668
|
}
|
7443
7669
|
}
|
7444
|
-
// @ts-ignore
|
7445
7670
|
const {
|
7446
7671
|
get,
|
7447
7672
|
set
|
@@ -7505,7 +7730,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7505
7730
|
runRenderedCallback(vm);
|
7506
7731
|
}
|
7507
7732
|
function hydrateNode(node, vnode, renderer) {
|
7508
|
-
var _a, _b;
|
7509
7733
|
let hydratedNode;
|
7510
7734
|
switch (vnode.type) {
|
7511
7735
|
case 0 /* VNodeType.Text */:
|
@@ -7525,10 +7749,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7525
7749
|
hydratedNode = hydrateFragment(node, vnode, renderer);
|
7526
7750
|
break;
|
7527
7751
|
case 2 /* VNodeType.Element */:
|
7528
|
-
hydratedNode = hydrateElement(node, vnode,
|
7752
|
+
hydratedNode = hydrateElement(node, vnode, vnode.data.renderer ?? renderer);
|
7529
7753
|
break;
|
7530
7754
|
case 3 /* VNodeType.CustomElement */:
|
7531
|
-
hydratedNode = hydrateCustomElement(node, vnode,
|
7755
|
+
hydratedNode = hydrateCustomElement(node, vnode, vnode.data.renderer ?? renderer);
|
7532
7756
|
break;
|
7533
7757
|
}
|
7534
7758
|
return renderer.nextSibling(hydratedNode);
|
@@ -7573,7 +7797,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7573
7797
|
return _attrName => true;
|
7574
7798
|
}
|
7575
7799
|
function hydrateText(node, vnode, renderer) {
|
7576
|
-
var _a;
|
7577
7800
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
7578
7801
|
return handleMismatch(node, vnode, renderer);
|
7579
7802
|
}
|
@@ -7585,12 +7808,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7585
7808
|
const {
|
7586
7809
|
setText
|
7587
7810
|
} = renderer;
|
7588
|
-
setText(node,
|
7811
|
+
setText(node, vnode.text ?? null);
|
7589
7812
|
vnode.elm = node;
|
7590
7813
|
return node;
|
7591
7814
|
}
|
7592
7815
|
function hydrateComment(node, vnode, renderer) {
|
7593
|
-
var _a;
|
7594
7816
|
if (!hasCorrectNodeType(vnode, node, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
|
7595
7817
|
return handleMismatch(node, vnode, renderer);
|
7596
7818
|
}
|
@@ -7606,7 +7828,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7606
7828
|
const {
|
7607
7829
|
setProperty
|
7608
7830
|
} = renderer;
|
7609
|
-
setProperty(node, NODE_VALUE_PROP,
|
7831
|
+
setProperty(node, NODE_VALUE_PROP, vnode.text ?? null);
|
7610
7832
|
vnode.elm = node;
|
7611
7833
|
return node;
|
7612
7834
|
}
|
@@ -7615,7 +7837,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7615
7837
|
return handleMismatch(elm, vnode, renderer);
|
7616
7838
|
}
|
7617
7839
|
vnode.elm = elm;
|
7618
|
-
|
7840
|
+
mountStaticParts(elm, vnode, renderer);
|
7619
7841
|
return elm;
|
7620
7842
|
}
|
7621
7843
|
function hydrateFragment(elm, vnode, renderer) {
|
@@ -7652,9 +7874,10 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7652
7874
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
7653
7875
|
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
7654
7876
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
7655
|
-
vnode.data =
|
7877
|
+
vnode.data = {
|
7878
|
+
...vnode.data,
|
7656
7879
|
props: cloneAndOmitKey(props, 'innerHTML')
|
7657
|
-
}
|
7880
|
+
};
|
7658
7881
|
} else {
|
7659
7882
|
if (process.env.NODE_ENV !== 'production') {
|
7660
7883
|
logWarn(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
|
@@ -7698,7 +7921,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7698
7921
|
defineCustomElement,
|
7699
7922
|
getTagName
|
7700
7923
|
} = renderer;
|
7701
|
-
|
7924
|
+
const isFormAssociated = shouldBeFormAssociated(ctor);
|
7925
|
+
defineCustomElement(StringToLowerCase.call(getTagName(elm)), isFormAssociated);
|
7702
7926
|
const vm = createVM(elm, ctor, renderer, {
|
7703
7927
|
mode,
|
7704
7928
|
owner,
|
@@ -7901,11 +8125,15 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
7901
8125
|
const classNames = ArrayFilter.call(classTokens, token => !isNull(token));
|
7902
8126
|
className = ArrayJoin.call(classNames, ' ');
|
7903
8127
|
} else if (!isUndefined$1(classMap)) {
|
7904
|
-
classMap =
|
7905
|
-
|
7906
|
-
|
7907
|
-
|
7908
|
-
|
8128
|
+
classMap = {
|
8129
|
+
...classMap,
|
8130
|
+
...(!isNull(scopedToken) ? {
|
8131
|
+
[scopedToken]: true
|
8132
|
+
} : {}),
|
8133
|
+
...(!isNull(stylesheetTokenHost) ? {
|
8134
|
+
[stylesheetTokenHost]: true
|
8135
|
+
} : {})
|
8136
|
+
};
|
7909
8137
|
} else {
|
7910
8138
|
// The order of the className should be scopedToken stylesheetTokenHost
|
7911
8139
|
const classTokens = [scopedToken, stylesheetTokenHost];
|
@@ -8110,7 +8338,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8110
8338
|
const originalArrayMethod = getOriginalArrayMethod(prop);
|
8111
8339
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
8112
8340
|
reportTemplateViolation('stylesheets');
|
8113
|
-
// @ts-
|
8341
|
+
// @ts-expect-error can't properly determine the right `this`
|
8114
8342
|
return originalArrayMethod.apply(this, arguments);
|
8115
8343
|
};
|
8116
8344
|
}
|
@@ -8256,6 +8484,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8256
8484
|
/**
|
8257
8485
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
8258
8486
|
* This API is subject to change or being removed.
|
8487
|
+
* @param elm
|
8259
8488
|
*/
|
8260
8489
|
function getComponentConstructor(elm) {
|
8261
8490
|
let ctor = null;
|
@@ -8280,6 +8509,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8280
8509
|
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
8281
8510
|
* membrane around any object value. This API is subject to change or
|
8282
8511
|
* being removed.
|
8512
|
+
* @param obj
|
8283
8513
|
*/
|
8284
8514
|
function readonly(obj) {
|
8285
8515
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -8290,7 +8520,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8290
8520
|
}
|
8291
8521
|
return getReadOnlyProxy(obj);
|
8292
8522
|
}
|
8293
|
-
/** version: 6.
|
8523
|
+
/** version: 6.3.4 */
|
8294
8524
|
|
8295
8525
|
/*
|
8296
8526
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -8300,8 +8530,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8300
8530
|
*/
|
8301
8531
|
/**
|
8302
8532
|
* Displays the header for a custom element.
|
8303
|
-
*
|
8304
|
-
* @param ce the custom element
|
8533
|
+
* @param ce The custom element to get the header for.
|
8305
8534
|
* @param componentInstance component instance associated with the custom element.
|
8306
8535
|
*/
|
8307
8536
|
function getHeaderForCustomElement(ce, componentInstance) {
|
@@ -8388,7 +8617,6 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8388
8617
|
//
|
8389
8618
|
// Only used in LWC's Karma tests
|
8390
8619
|
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
8391
|
-
// @ts-ignore
|
8392
8620
|
window.__lwcResetGlobalStylesheets = () => {
|
8393
8621
|
stylesheetCache.clear();
|
8394
8622
|
};
|
@@ -8521,7 +8749,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8521
8749
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
8522
8750
|
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
8523
8751
|
// This class should be created once per tag name.
|
8524
|
-
const createUpgradableConstructor =
|
8752
|
+
const createUpgradableConstructor = isFormAssociated => {
|
8525
8753
|
// TODO [#2972]: this class should expose observedAttributes as necessary
|
8526
8754
|
class UpgradableConstructor extends HTMLElement {
|
8527
8755
|
constructor(upgradeCallback, useNativeLifecycle) {
|
@@ -8540,9 +8768,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8540
8768
|
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
8541
8769
|
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
8542
8770
|
}
|
8543
|
-
/*LWC compiler v6.
|
8771
|
+
/*LWC compiler v6.3.4*/
|
8544
8772
|
}
|
8545
|
-
UpgradableConstructor.formAssociated =
|
8773
|
+
UpgradableConstructor.formAssociated = isFormAssociated;
|
8546
8774
|
for (const [propName, callback] of entries(LIFECYCLE_CALLBACKS)) {
|
8547
8775
|
UpgradableConstructor.prototype[propName] = function () {
|
8548
8776
|
// If the element is in the WeakMap (i.e. it's marked as native lifecycle), and if it was upgraded by LWC,
|
@@ -8554,22 +8782,25 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8554
8782
|
}
|
8555
8783
|
return UpgradableConstructor;
|
8556
8784
|
};
|
8557
|
-
function getUpgradableConstructor(tagName) {
|
8785
|
+
function getUpgradableConstructor(tagName, isFormAssociated) {
|
8558
8786
|
let UpgradableConstructor = cachedConstructors.get(tagName);
|
8559
8787
|
if (isUndefined$1(UpgradableConstructor)) {
|
8560
8788
|
if (!isUndefined$1(customElements.get(tagName))) {
|
8561
8789
|
throw new Error(`Unexpected tag name "${tagName}". This name is a registered custom element, preventing LWC to upgrade the element.`);
|
8562
8790
|
}
|
8563
|
-
UpgradableConstructor = createUpgradableConstructor();
|
8791
|
+
UpgradableConstructor = createUpgradableConstructor(isFormAssociated);
|
8564
8792
|
customElements.define(tagName, UpgradableConstructor);
|
8565
8793
|
cachedConstructors.set(tagName, UpgradableConstructor);
|
8566
8794
|
}
|
8567
8795
|
return UpgradableConstructor;
|
8568
8796
|
}
|
8569
|
-
const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle) => {
|
8570
|
-
const UpgradableConstructor = getUpgradableConstructor(tagName);
|
8797
|
+
const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle, isFormAssociated) => {
|
8798
|
+
const UpgradableConstructor = getUpgradableConstructor(tagName, isFormAssociated);
|
8571
8799
|
elementBeingUpgradedByLWC = true;
|
8572
8800
|
try {
|
8801
|
+
if (UpgradableConstructor.formAssociated !== isFormAssociated) {
|
8802
|
+
throw new Error(`<${tagName}> was already registered with formAssociated=${UpgradableConstructor.formAssociated}. It cannot be re-registered with formAssociated=${isFormAssociated}. Please rename your component to have a different name than <${tagName}>`);
|
8803
|
+
}
|
8573
8804
|
return new UpgradableConstructor(upgradeCallback, useNativeLifecycle);
|
8574
8805
|
} finally {
|
8575
8806
|
elementBeingUpgradedByLWC = false;
|
@@ -8577,7 +8808,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8577
8808
|
};
|
8578
8809
|
|
8579
8810
|
/*
|
8580
|
-
* Copyright (c)
|
8811
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
8581
8812
|
* All rights reserved.
|
8582
8813
|
* SPDX-License-Identifier: MIT
|
8583
8814
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -8586,13 +8817,15 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8586
8817
|
* A factory function that produces a renderer.
|
8587
8818
|
* Renderer encapsulates operations that are required to render an LWC component into the underlying
|
8588
8819
|
* runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
|
8589
|
-
*
|
8820
|
+
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
8821
|
+
* @returns The created renderer
|
8822
|
+
* @example
|
8590
8823
|
* import { renderer, rendererFactory } from 'lwc';
|
8591
8824
|
* const customRenderer = rendererFactory(renderer);
|
8592
|
-
*
|
8593
|
-
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
8594
8825
|
*/
|
8595
8826
|
function rendererFactory(baseRenderer) {
|
8827
|
+
// Type assertion because this is replaced by rollup with an object, not a string.
|
8828
|
+
// See `injectInlineRenderer` in /scripts/rollup/rollup.config.js
|
8596
8829
|
const renderer = function (exports) {
|
8597
8830
|
/**
|
8598
8831
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -8603,21 +8836,40 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8603
8836
|
* SPDX-License-Identifier: MIT
|
8604
8837
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
8605
8838
|
*/
|
8839
|
+
/**
|
8840
|
+
*
|
8841
|
+
* @param value
|
8842
|
+
* @param msg
|
8843
|
+
*/
|
8606
8844
|
function invariant(value, msg) {
|
8607
8845
|
if (!value) {
|
8608
8846
|
throw new Error(`Invariant Violation: ${msg}`);
|
8609
8847
|
}
|
8610
8848
|
}
|
8849
|
+
/**
|
8850
|
+
*
|
8851
|
+
* @param value
|
8852
|
+
* @param msg
|
8853
|
+
*/
|
8611
8854
|
function isTrue$1(value, msg) {
|
8612
8855
|
if (!value) {
|
8613
8856
|
throw new Error(`Assert Violation: ${msg}`);
|
8614
8857
|
}
|
8615
8858
|
}
|
8859
|
+
/**
|
8860
|
+
*
|
8861
|
+
* @param value
|
8862
|
+
* @param msg
|
8863
|
+
*/
|
8616
8864
|
function isFalse$1(value, msg) {
|
8617
8865
|
if (value) {
|
8618
8866
|
throw new Error(`Assert Violation: ${msg}`);
|
8619
8867
|
}
|
8620
8868
|
}
|
8869
|
+
/**
|
8870
|
+
*
|
8871
|
+
* @param msg
|
8872
|
+
*/
|
8621
8873
|
function fail(msg) {
|
8622
8874
|
throw new Error(msg);
|
8623
8875
|
}
|
@@ -8628,13 +8880,23 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8628
8880
|
isFalse: isFalse$1,
|
8629
8881
|
isTrue: isTrue$1
|
8630
8882
|
});
|
8883
|
+
/**
|
8884
|
+
* Determines whether the argument is `undefined`.
|
8885
|
+
* @param obj Value to test
|
8886
|
+
* @returns `true` if the value is `undefined`.
|
8887
|
+
*/
|
8631
8888
|
function isUndefined(obj) {
|
8632
8889
|
return obj === undefined;
|
8633
8890
|
}
|
8891
|
+
/**
|
8892
|
+
* Determines whether the argument is `null`.
|
8893
|
+
* @param obj Value to test
|
8894
|
+
* @returns `true` if the value is `null`.
|
8895
|
+
*/
|
8634
8896
|
function isNull(obj) {
|
8635
8897
|
return obj === null;
|
8636
8898
|
}
|
8637
|
-
/** version: 6.
|
8899
|
+
/** version: 6.3.4 */
|
8638
8900
|
|
8639
8901
|
/*
|
8640
8902
|
* Copyright (c) 2023, salesforce.com, inc.
|
@@ -8654,7 +8916,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8654
8916
|
this.setNewContext = setNewContext;
|
8655
8917
|
this.setDisconnectedCallback = setDisconnectedCallback;
|
8656
8918
|
}
|
8657
|
-
/*LWC compiler v6.
|
8919
|
+
/*LWC compiler v6.3.4*/
|
8658
8920
|
}
|
8659
8921
|
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
8660
8922
|
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
@@ -8913,6 +9175,18 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8913
9175
|
}
|
8914
9176
|
return vm;
|
8915
9177
|
}
|
9178
|
+
/**
|
9179
|
+
* Replaces an existing DOM node with an LWC component.
|
9180
|
+
* @param element The existing node in the DOM that where the root component should be attached.
|
9181
|
+
* @param Ctor The LWC class to use as the root component.
|
9182
|
+
* @param props Any props for the root component as part of initial client-side rendering. The props must be identical to those passed to renderComponent during SSR.
|
9183
|
+
* @throws Throws when called with invalid parameters.
|
9184
|
+
* @example
|
9185
|
+
* import { hydrateComponent } from 'lwc';
|
9186
|
+
* import App from 'x/App';
|
9187
|
+
* const elm = document.querySelector('x-app');
|
9188
|
+
* hydrateComponent(elm, App, { name: 'Hello World' });
|
9189
|
+
*/
|
8916
9190
|
function hydrateComponent(element, Ctor, props = {}) {
|
8917
9191
|
if (!(element instanceof Element)) {
|
8918
9192
|
throw new TypeError(`"hydrateComponent" expects a valid DOM element as the first parameter but instead received ${element}.`);
|
@@ -8933,7 +9207,8 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8933
9207
|
defineCustomElement,
|
8934
9208
|
getTagName
|
8935
9209
|
} = renderer;
|
8936
|
-
|
9210
|
+
const isFormAssociated = shouldBeFormAssociated(Ctor);
|
9211
|
+
defineCustomElement(StringToLowerCase.call(getTagName(element)), isFormAssociated);
|
8937
9212
|
const vm = createVMWithProps(element, Ctor, props);
|
8938
9213
|
hydrateRoot(vm);
|
8939
9214
|
} catch (e) {
|
@@ -8958,17 +9233,15 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8958
9233
|
/**
|
8959
9234
|
* This function builds a Web Component class from a LWC constructor so it can be
|
8960
9235
|
* registered as a new element via customElements.define() at any given time.
|
8961
|
-
*
|
8962
|
-
* @
|
8963
|
-
*
|
9236
|
+
* @param Ctor LWC constructor to build
|
9237
|
+
* @returns A Web Component class
|
8964
9238
|
* @example
|
8965
|
-
* ```
|
8966
9239
|
* import { buildCustomElementConstructor } from 'lwc';
|
8967
9240
|
* import Foo from 'ns/foo';
|
8968
9241
|
* const WC = buildCustomElementConstructor(Foo);
|
8969
9242
|
* customElements.define('x-foo', WC);
|
8970
9243
|
* const elm = document.createElement('x-foo');
|
8971
|
-
*
|
9244
|
+
* @deprecated since version 1.3.11
|
8972
9245
|
*/
|
8973
9246
|
function deprecatedBuildCustomElementConstructor(Ctor) {
|
8974
9247
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -8983,6 +9256,13 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
8983
9256
|
renderer.remove(childNodes[i], node);
|
8984
9257
|
}
|
8985
9258
|
}
|
9259
|
+
/**
|
9260
|
+
* The real `buildCustomElementConstructor`. Should not be accessible to external users!
|
9261
|
+
* @internal
|
9262
|
+
* @param Ctor LWC constructor to build
|
9263
|
+
* @returns A Web Component class
|
9264
|
+
* @see {@linkcode deprecatedBuildCustomElementConstructor}
|
9265
|
+
*/
|
8986
9266
|
function buildCustomElementConstructor(Ctor) {
|
8987
9267
|
var _a;
|
8988
9268
|
const HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
@@ -9034,8 +9314,23 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9034
9314
|
attributeChangedCallback(name, oldValue, newValue) {
|
9035
9315
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
9036
9316
|
}
|
9037
|
-
|
9038
|
-
|
9317
|
+
formAssociatedCallback() {
|
9318
|
+
runFormAssociatedCallback(this);
|
9319
|
+
}
|
9320
|
+
formDisabledCallback() {
|
9321
|
+
runFormDisabledCallback(this);
|
9322
|
+
}
|
9323
|
+
formResetCallback() {
|
9324
|
+
runFormResetCallback(this);
|
9325
|
+
}
|
9326
|
+
formStateRestoreCallback() {
|
9327
|
+
runFormStateRestoreCallback(this);
|
9328
|
+
}
|
9329
|
+
/*LWC compiler v6.3.4*/
|
9330
|
+
}, _a.observedAttributes = observedAttributes,
|
9331
|
+
// Note CustomElementConstructor is not upgraded by LWC and inherits directly from HTMLElement which means it calls the native
|
9332
|
+
// attachInternals API.
|
9333
|
+
_a.formAssociated = Boolean(Ctor.formAssociated), _a;
|
9039
9334
|
}
|
9040
9335
|
|
9041
9336
|
/*
|
@@ -9095,18 +9390,25 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9095
9390
|
}
|
9096
9391
|
});
|
9097
9392
|
}
|
9393
|
+
// For some reason, JSDOC says "options.is" is a syntax error. And we can't disable the rule using
|
9394
|
+
// `eslint-disable-next-line` because that gets included in the JSDOC, so we need this workaround.
|
9395
|
+
/* eslint-disable jsdoc/valid-types */
|
9098
9396
|
/**
|
9099
9397
|
* EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
|
9100
9398
|
* difference that in the options, you can pass the `is` property set to a Constructor instead of
|
9101
9399
|
* just a string value. The intent is to allow the creation of an element controlled by LWC without
|
9102
9400
|
* having to register the element as a custom element.
|
9103
|
-
*
|
9401
|
+
* @param sel The tagname of the element to create
|
9402
|
+
* @param options Control the behavior of the created element
|
9403
|
+
* @param options.is The LWC component that the element should be
|
9404
|
+
* @param options.mode What kind of shadow root to use
|
9405
|
+
* @returns The created HTML element
|
9406
|
+
* @throws Throws when called with invalid parameters.
|
9104
9407
|
* @example
|
9105
|
-
* ```
|
9106
9408
|
* const el = createElement('x-foo', { is: FooCtor });
|
9107
|
-
* ```
|
9108
9409
|
*/
|
9109
|
-
function createElement(
|
9410
|
+
function createElement( /* eslint-enable jsdoc/valid-types */
|
9411
|
+
sel, options) {
|
9110
9412
|
if (!isObject(options) || isNull(options)) {
|
9111
9413
|
throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
|
9112
9414
|
}
|
@@ -9125,8 +9427,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9125
9427
|
const useNativeCustomElementLifecycle =
|
9126
9428
|
// temporary "kill switch"
|
9127
9429
|
!lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
9430
|
+
const isFormAssociated = shouldBeFormAssociated(Ctor);
|
9128
9431
|
// the custom element from the registry is expecting an upgrade callback
|
9129
|
-
|
9432
|
+
/*
|
9130
9433
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
9131
9434
|
* with a callback as the first argument, we could implement a more advanced
|
9132
9435
|
* mechanism that only passes that argument if the constructor is known to be
|
@@ -9146,7 +9449,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9146
9449
|
DisconnectingSlot.set(elm, disconnectRootElement);
|
9147
9450
|
}
|
9148
9451
|
};
|
9149
|
-
return createCustomElement(tagName, upgradeCallback, useNativeCustomElementLifecycle);
|
9452
|
+
return createCustomElement(tagName, upgradeCallback, useNativeCustomElementLifecycle, isFormAssociated);
|
9150
9453
|
}
|
9151
9454
|
|
9152
9455
|
/*
|
@@ -9161,6 +9464,9 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9161
9464
|
/**
|
9162
9465
|
* EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
|
9163
9466
|
* ONCE LOCKER V1 IS NO LONGER SUPPORTED.
|
9467
|
+
* @param node Node to check
|
9468
|
+
* @returns `true` if the the node is shadowed
|
9469
|
+
* @example isNodeShadowed(document.querySelector('my-component'))
|
9164
9470
|
*/
|
9165
9471
|
function isNodeShadowed(node) {
|
9166
9472
|
if (isFalse(node instanceof _Node)) {
|
@@ -9202,12 +9508,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9202
9508
|
}
|
9203
9509
|
/**
|
9204
9510
|
* This static getter builds a Web Component class from a LWC constructor so it can be registered
|
9205
|
-
* as a new element via customElements.define() at any given time.
|
9206
|
-
*
|
9207
|
-
*
|
9208
|
-
*
|
9209
|
-
*
|
9210
|
-
*
|
9511
|
+
* as a new element via customElements.define() at any given time.
|
9512
|
+
* @example
|
9513
|
+
* import Foo from 'ns/foo';
|
9514
|
+
* customElements.define('x-foo', Foo.CustomElementConstructor);
|
9515
|
+
* const elm = document.createElement('x-foo');
|
9211
9516
|
*/
|
9212
9517
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
9213
9518
|
get() {
|
@@ -9233,6 +9538,11 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9233
9538
|
* SPDX-License-Identifier: MIT
|
9234
9539
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
9235
9540
|
*/
|
9541
|
+
/**
|
9542
|
+
* Creates a context provider, given a wire adapter constructor.
|
9543
|
+
* @param adapter The wire adapter to create a context provider for.
|
9544
|
+
* @returns A new context provider.
|
9545
|
+
*/
|
9236
9546
|
function createContextProvider(adapter) {
|
9237
9547
|
return createContextProviderWithRegister(adapter, registerContextProvider);
|
9238
9548
|
}
|
@@ -9249,7 +9559,7 @@ LWR.define('lwc/v/6_1_1', ['exports'], (function (exports) { 'use strict';
|
|
9249
9559
|
});
|
9250
9560
|
});
|
9251
9561
|
}
|
9252
|
-
/** version: 6.
|
9562
|
+
/** version: 6.3.4 */
|
9253
9563
|
|
9254
9564
|
exports.LightningElement = LightningElement;
|
9255
9565
|
exports.__unstable__ProfilerControl = profilerControl;
|