@lwrjs/everywhere 0.9.0-alpha.23 → 0.9.0-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/2458c6e319e9056787252989c2e26389/config.js +10 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_33_0/s/90a5f16131da45cef1653112862ca9dc → 2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa}/lwc.js +1504 -1539
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_9_0-alpha_23/s/86fb898552d17d4463bfb8d8ae9300aa → 0_9_0-alpha_26/s/89d1323af34eb6daf9b222fcc6f05f58}/lwr_loader.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/3426e42c3e22ce07ab2adc62c4c523a0/lwr_metrics.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.js/v/{0_9_0-alpha_23 → 0_9_0-alpha_26}/lwr-loader-shim.js +5 -5
- package/build/assets/amd/lwr-everywhere-debug.js +8 -8
- package/build/assets/amd/lwr-everywhere-min.js +1 -1
- package/build/assets/amd/lwr-everywhere.js +8 -8
- package/build/assets/core/lwr-everywhere-debug.js +4 -4
- package/build/assets/core/lwr-everywhere.js +4 -4
- 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 -6
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/6ab3199bf5036a8c00144a25848ce28b/config.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwc/v/
|
|
1
|
+
LWR.define('lwc/v/2_38_1', ['exports'], function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/* proxy-compat-disable */
|
|
4
4
|
/**
|
|
@@ -30,10 +30,10 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
30
30
|
}
|
|
31
31
|
var assert = /*#__PURE__*/Object.freeze({
|
|
32
32
|
__proto__: null,
|
|
33
|
+
fail: fail,
|
|
33
34
|
invariant: invariant,
|
|
34
|
-
isTrue: isTrue$1,
|
|
35
35
|
isFalse: isFalse$1,
|
|
36
|
-
|
|
36
|
+
isTrue: isTrue$1
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
/*
|
|
@@ -87,6 +87,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
87
87
|
const {
|
|
88
88
|
charCodeAt: StringCharCodeAt,
|
|
89
89
|
replace: StringReplace,
|
|
90
|
+
split: StringSplit,
|
|
90
91
|
slice: StringSlice,
|
|
91
92
|
toLowerCase: StringToLowerCase
|
|
92
93
|
} = String.prototype;
|
|
@@ -182,6 +183,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
182
183
|
AriaPropNameToAttrNameMap
|
|
183
184
|
};
|
|
184
185
|
})();
|
|
186
|
+
// These attributes take either an ID or a list of IDs as values.
|
|
187
|
+
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
|
188
|
+
const ID_REFERENCING_ATTRIBUTES_SET = new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
|
|
185
189
|
|
|
186
190
|
/*
|
|
187
191
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -189,39 +193,11 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
189
193
|
* SPDX-License-Identifier: MIT
|
|
190
194
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
191
195
|
*/
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
let _globalThis;
|
|
199
|
-
try {
|
|
200
|
-
// eslint-disable-next-line no-extend-native
|
|
201
|
-
Object.defineProperty(Object.prototype, '__magic__', {
|
|
202
|
-
get: function () {
|
|
203
|
-
return this;
|
|
204
|
-
},
|
|
205
|
-
configurable: true
|
|
206
|
-
});
|
|
207
|
-
// __magic__ is undefined in Safari 10 and IE10 and older.
|
|
208
|
-
// @ts-ignore
|
|
209
|
-
// eslint-disable-next-line no-undef
|
|
210
|
-
_globalThis = __magic__;
|
|
211
|
-
// @ts-ignore
|
|
212
|
-
delete Object.prototype.__magic__;
|
|
213
|
-
} catch (ex) {
|
|
214
|
-
// In IE8, Object.defineProperty only works on DOM objects.
|
|
215
|
-
} finally {
|
|
216
|
-
// If the magic above fails for some reason we assume that we are in a legacy browser.
|
|
217
|
-
// Assume `window` exists in this case.
|
|
218
|
-
if (typeof _globalThis === 'undefined') {
|
|
219
|
-
// @ts-ignore
|
|
220
|
-
_globalThis = window;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return _globalThis;
|
|
224
|
-
}();
|
|
196
|
+
// See browser support for globalThis:
|
|
197
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
|
198
|
+
/* istanbul ignore next */
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
const _globalThis = typeof globalThis === 'object' ? globalThis : window;
|
|
225
201
|
|
|
226
202
|
/*
|
|
227
203
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -235,6 +211,8 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
235
211
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
236
212
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
237
213
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
214
|
+
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
215
|
+
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
238
216
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
239
217
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
240
218
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -320,6 +298,24 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
320
298
|
return propertyName;
|
|
321
299
|
}
|
|
322
300
|
|
|
301
|
+
/*
|
|
302
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
303
|
+
* All rights reserved.
|
|
304
|
+
* SPDX-License-Identifier: MIT
|
|
305
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
306
|
+
*/
|
|
307
|
+
const ESCAPED_CHARS = {
|
|
308
|
+
'"': '"',
|
|
309
|
+
"'": ''',
|
|
310
|
+
'<': '<',
|
|
311
|
+
'>': '>',
|
|
312
|
+
'&': '&'
|
|
313
|
+
};
|
|
314
|
+
function htmlEscape(str, attrMode = false) {
|
|
315
|
+
const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
|
|
316
|
+
return str.replace(searchValue, char => ESCAPED_CHARS[char]);
|
|
317
|
+
}
|
|
318
|
+
|
|
323
319
|
/*
|
|
324
320
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
325
321
|
* All rights reserved.
|
|
@@ -327,9 +323,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
327
323
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
328
324
|
*/
|
|
329
325
|
// Increment whenever the LWC template compiler changes
|
|
330
|
-
const LWC_VERSION = "2.
|
|
326
|
+
const LWC_VERSION = "2.38.1";
|
|
331
327
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
332
|
-
/** version: 2.
|
|
328
|
+
/** version: 2.38.1 */
|
|
333
329
|
|
|
334
330
|
/**
|
|
335
331
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -349,16 +345,17 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
349
345
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
350
346
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
351
347
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
352
|
-
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
353
348
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
354
349
|
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
355
350
|
};
|
|
351
|
+
// eslint-disable-next-line no-restricted-properties
|
|
356
352
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
357
353
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
358
354
|
value: create(null)
|
|
359
355
|
});
|
|
360
356
|
}
|
|
361
|
-
|
|
357
|
+
// eslint-disable-next-line no-restricted-properties
|
|
358
|
+
const flags = _globalThis.lwcRuntimeFlags;
|
|
362
359
|
/**
|
|
363
360
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
364
361
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -380,18 +377,19 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
380
377
|
console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
|
|
381
378
|
return;
|
|
382
379
|
}
|
|
383
|
-
|
|
380
|
+
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
|
381
|
+
if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
|
|
384
382
|
// Allow the same flag to be set more than once outside of production to enable testing
|
|
385
|
-
|
|
383
|
+
flags[name] = value;
|
|
386
384
|
} else {
|
|
387
385
|
// Disallow the same flag to be set more than once in production
|
|
388
|
-
const runtimeValue =
|
|
386
|
+
const runtimeValue = flags[name];
|
|
389
387
|
if (!isUndefined$1(runtimeValue)) {
|
|
390
388
|
// eslint-disable-next-line no-console
|
|
391
389
|
console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
|
|
392
390
|
return;
|
|
393
391
|
}
|
|
394
|
-
defineProperty(
|
|
392
|
+
defineProperty(flags, name, {
|
|
395
393
|
value
|
|
396
394
|
});
|
|
397
395
|
}
|
|
@@ -401,11 +399,12 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
401
399
|
* purposes. It is a no-op when invoked in production mode.
|
|
402
400
|
*/
|
|
403
401
|
function setFeatureFlagForTest(name, value) {
|
|
404
|
-
|
|
402
|
+
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
|
403
|
+
if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
|
|
405
404
|
setFeatureFlag(name, value);
|
|
406
405
|
}
|
|
407
406
|
}
|
|
408
|
-
/** version: 2.
|
|
407
|
+
/** version: 2.38.1 */
|
|
409
408
|
|
|
410
409
|
/**
|
|
411
410
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -468,7 +467,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
468
467
|
}
|
|
469
468
|
}
|
|
470
469
|
}
|
|
471
|
-
/** version: 2.
|
|
470
|
+
/** version: 2.38.1 */
|
|
472
471
|
|
|
473
472
|
/*
|
|
474
473
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -482,30 +481,77 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
482
481
|
applyAriaReflection();
|
|
483
482
|
}
|
|
484
483
|
|
|
484
|
+
/* proxy-compat-disable */
|
|
485
|
+
|
|
485
486
|
/*
|
|
486
487
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
487
488
|
* All rights reserved.
|
|
488
489
|
* SPDX-License-Identifier: MIT
|
|
489
490
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
490
491
|
*/
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
492
|
+
const onReportingEnabledCallbacks = [];
|
|
493
|
+
/** The currently assigned reporting dispatcher. */
|
|
494
|
+
let currentDispatcher$1 = noop;
|
|
495
|
+
/**
|
|
496
|
+
* Whether reporting is enabled.
|
|
497
|
+
*
|
|
498
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
499
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
500
|
+
*/
|
|
501
|
+
let enabled$1 = false;
|
|
502
|
+
const reportingControl = {
|
|
503
|
+
/**
|
|
504
|
+
* Attach a new reporting control (aka dispatcher).
|
|
505
|
+
*
|
|
506
|
+
* @param dispatcher - reporting control
|
|
507
|
+
*/
|
|
508
|
+
attachDispatcher(dispatcher) {
|
|
509
|
+
enabled$1 = true;
|
|
510
|
+
currentDispatcher$1 = dispatcher;
|
|
511
|
+
for (const callback of onReportingEnabledCallbacks) {
|
|
512
|
+
try {
|
|
513
|
+
callback();
|
|
514
|
+
} catch (err) {
|
|
515
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
516
|
+
// eslint-disable-next-line no-console
|
|
517
|
+
console.error('Could not invoke callback', err);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
521
|
+
},
|
|
507
522
|
|
|
508
|
-
|
|
523
|
+
/**
|
|
524
|
+
* Detach the current reporting control (aka dispatcher).
|
|
525
|
+
*/
|
|
526
|
+
detachDispatcher() {
|
|
527
|
+
enabled$1 = false;
|
|
528
|
+
currentDispatcher$1 = noop;
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
533
|
+
* Will only ever be called once.
|
|
534
|
+
* @param callback
|
|
535
|
+
*/
|
|
536
|
+
function onReportingEnabled(callback) {
|
|
537
|
+
if (enabled$1) {
|
|
538
|
+
// call immediately
|
|
539
|
+
callback();
|
|
540
|
+
} else {
|
|
541
|
+
// call later
|
|
542
|
+
onReportingEnabledCallbacks.push(callback);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Report to the current dispatcher, if there is one.
|
|
547
|
+
* @param reportingEventId
|
|
548
|
+
* @param payload - data to report
|
|
549
|
+
*/
|
|
550
|
+
function report(reportingEventId, payload) {
|
|
551
|
+
if (enabled$1) {
|
|
552
|
+
currentDispatcher$1(reportingEventId, payload);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
509
555
|
|
|
510
556
|
/*
|
|
511
557
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -513,21 +559,28 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
513
559
|
* SPDX-License-Identifier: MIT
|
|
514
560
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
515
561
|
*/
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
562
|
+
function getComponentTag(vm) {
|
|
563
|
+
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
564
|
+
}
|
|
565
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
566
|
+
function getComponentStack(vm) {
|
|
567
|
+
const stack = [];
|
|
568
|
+
let prefix = '';
|
|
569
|
+
while (!isNull(vm.owner)) {
|
|
570
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
571
|
+
vm = vm.owner;
|
|
572
|
+
prefix += '\t';
|
|
573
|
+
}
|
|
574
|
+
return ArrayJoin.call(stack, '\n');
|
|
575
|
+
}
|
|
576
|
+
function getErrorComponentStack(vm) {
|
|
577
|
+
const wcStack = [];
|
|
578
|
+
let currentVm = vm;
|
|
579
|
+
while (!isNull(currentVm)) {
|
|
580
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
581
|
+
currentVm = currentVm.owner;
|
|
582
|
+
}
|
|
583
|
+
return wcStack.reverse().join('\n\t');
|
|
531
584
|
}
|
|
532
585
|
|
|
533
586
|
/*
|
|
@@ -536,90 +589,63 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
536
589
|
* SPDX-License-Identifier: MIT
|
|
537
590
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
538
591
|
*/
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
const callbacks = nextTickCallbackQueue;
|
|
550
|
-
nextTickCallbackQueue = []; // reset to a new queue
|
|
551
|
-
for (let i = 0, len = callbacks.length; i < len; i += 1) {
|
|
552
|
-
callbacks[i]();
|
|
592
|
+
function addErrorComponentStack(vm, error) {
|
|
593
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
594
|
+
const wcStack = getErrorComponentStack(vm);
|
|
595
|
+
defineProperty(error, 'wcStack', {
|
|
596
|
+
get() {
|
|
597
|
+
return wcStack;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
553
600
|
}
|
|
554
601
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
602
|
+
|
|
603
|
+
/*
|
|
604
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
605
|
+
* All rights reserved.
|
|
606
|
+
* SPDX-License-Identifier: MIT
|
|
607
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
608
|
+
*/
|
|
609
|
+
const alreadyLoggedMessages = new Set();
|
|
610
|
+
// Only used in LWC's Karma tests
|
|
611
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
612
|
+
// @ts-ignore
|
|
613
|
+
window.__lwcResetAlreadyLoggedMessages = () => {
|
|
614
|
+
alreadyLoggedMessages.clear();
|
|
615
|
+
};
|
|
565
616
|
}
|
|
566
|
-
function
|
|
567
|
-
|
|
568
|
-
|
|
617
|
+
function log(method, message, vm, once) {
|
|
618
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
619
|
+
if (!isUndefined$1(vm)) {
|
|
620
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
569
621
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
574
|
-
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
575
|
-
const PROPERTY_DELIMITER = /:(.+)/;
|
|
576
|
-
function parseStyleText(cssText) {
|
|
577
|
-
const styleMap = {};
|
|
578
|
-
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
579
|
-
for (const declaration of declarations) {
|
|
580
|
-
if (declaration) {
|
|
581
|
-
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
582
|
-
if (prop !== undefined && value !== undefined) {
|
|
583
|
-
styleMap[prop.trim()] = value.trim();
|
|
584
|
-
}
|
|
622
|
+
if (once) {
|
|
623
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
624
|
+
return;
|
|
585
625
|
}
|
|
626
|
+
alreadyLoggedMessages.add(msg);
|
|
586
627
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
for (const key of Object.keys(object)) {
|
|
593
|
-
if (key !== keyToOmit) {
|
|
594
|
-
result[key] = object[key];
|
|
595
|
-
}
|
|
628
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
629
|
+
if (process.env.NODE_ENV === 'test') {
|
|
630
|
+
/* eslint-disable-next-line no-console */
|
|
631
|
+
console[method](msg);
|
|
632
|
+
return;
|
|
596
633
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
if (!Array.isArray(stylesheet)) {
|
|
603
|
-
list.push(stylesheet);
|
|
604
|
-
} else {
|
|
605
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
606
|
-
}
|
|
634
|
+
try {
|
|
635
|
+
throw new Error(msg);
|
|
636
|
+
} catch (e) {
|
|
637
|
+
/* eslint-disable-next-line no-console */
|
|
638
|
+
console[method](e);
|
|
607
639
|
}
|
|
608
|
-
return list;
|
|
609
640
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
619
|
-
// in depth-first traversal order.
|
|
620
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
621
|
-
refVNodes[ref] = vnode;
|
|
622
|
-
}
|
|
641
|
+
function logError(message, vm) {
|
|
642
|
+
log('error', message, vm, false);
|
|
643
|
+
}
|
|
644
|
+
function logWarn(message, vm) {
|
|
645
|
+
log('warn', message, vm, false);
|
|
646
|
+
}
|
|
647
|
+
function logWarnOnce(message, vm) {
|
|
648
|
+
log('warn', message, vm, true);
|
|
623
649
|
}
|
|
624
650
|
|
|
625
651
|
/*
|
|
@@ -742,75 +768,98 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
742
768
|
* SPDX-License-Identifier: MIT
|
|
743
769
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
744
770
|
*/
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
function
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
771
|
+
let nextTickCallbackQueue = [];
|
|
772
|
+
const SPACE_CHAR = 32;
|
|
773
|
+
const EmptyObject = seal(create(null));
|
|
774
|
+
const EmptyArray = seal([]);
|
|
775
|
+
function flushCallbackQueue() {
|
|
776
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
777
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
778
|
+
throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
const callbacks = nextTickCallbackQueue;
|
|
782
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
783
|
+
for (let i = 0, len = callbacks.length; i < len; i += 1) {
|
|
784
|
+
callbacks[i]();
|
|
756
785
|
}
|
|
757
|
-
return ArrayJoin.call(stack, '\n');
|
|
758
786
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
currentVm = currentVm.owner;
|
|
787
|
+
function addCallbackToNextTick(callback) {
|
|
788
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
789
|
+
if (!isFunction$1(callback)) {
|
|
790
|
+
throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);
|
|
791
|
+
}
|
|
765
792
|
}
|
|
766
|
-
|
|
793
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
794
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
795
|
+
}
|
|
796
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
767
797
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
* All rights reserved.
|
|
772
|
-
* SPDX-License-Identifier: MIT
|
|
773
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
774
|
-
*/
|
|
775
|
-
function addErrorComponentStack(vm, error) {
|
|
776
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
777
|
-
const wcStack = getErrorComponentStack(vm);
|
|
778
|
-
defineProperty(error, 'wcStack', {
|
|
779
|
-
get() {
|
|
780
|
-
return wcStack;
|
|
781
|
-
}
|
|
782
|
-
});
|
|
798
|
+
function guid() {
|
|
799
|
+
function s4() {
|
|
800
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
783
801
|
}
|
|
802
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
784
803
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
804
|
+
// Borrowed from Vue template compiler.
|
|
805
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
806
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
807
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
808
|
+
function parseStyleText(cssText) {
|
|
809
|
+
const styleMap = {};
|
|
810
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
811
|
+
for (const declaration of declarations) {
|
|
812
|
+
if (declaration) {
|
|
813
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
814
|
+
if (prop !== undefined && value !== undefined) {
|
|
815
|
+
styleMap[prop.trim()] = value.trim();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
796
818
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
819
|
+
return styleMap;
|
|
820
|
+
}
|
|
821
|
+
// Make a shallow copy of an object but omit the given key
|
|
822
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
823
|
+
const result = {};
|
|
824
|
+
for (const key of keys(object)) {
|
|
825
|
+
if (key !== keyToOmit) {
|
|
826
|
+
result[key] = object[key];
|
|
827
|
+
}
|
|
801
828
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
829
|
+
return result;
|
|
830
|
+
}
|
|
831
|
+
function flattenStylesheets(stylesheets) {
|
|
832
|
+
const list = [];
|
|
833
|
+
for (const stylesheet of stylesheets) {
|
|
834
|
+
if (!isArray$1(stylesheet)) {
|
|
835
|
+
list.push(stylesheet);
|
|
836
|
+
} else {
|
|
837
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
838
|
+
}
|
|
807
839
|
}
|
|
840
|
+
return list;
|
|
808
841
|
}
|
|
809
|
-
|
|
810
|
-
|
|
842
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
843
|
+
function setRefVNode(vm, ref, vnode) {
|
|
844
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
845
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
846
|
+
}
|
|
847
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
848
|
+
// If not, then something went wrong and we threw an error above.
|
|
849
|
+
const refVNodes = vm.refVNodes;
|
|
850
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
851
|
+
// in depth-first traversal order.
|
|
852
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
853
|
+
refVNodes[ref] = vnode;
|
|
854
|
+
}
|
|
811
855
|
}
|
|
812
|
-
|
|
813
|
-
|
|
856
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
857
|
+
function assertNotProd() {
|
|
858
|
+
/* istanbul ignore if */
|
|
859
|
+
if (process.env.NODE_ENV === 'production') {
|
|
860
|
+
// this method should never leak to prod
|
|
861
|
+
throw new ReferenceError();
|
|
862
|
+
}
|
|
814
863
|
}
|
|
815
864
|
|
|
816
865
|
/*
|
|
@@ -852,7 +901,10 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
852
901
|
// Global HTML Attributes & Properties
|
|
853
902
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
854
903
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
855
|
-
|
|
904
|
+
//
|
|
905
|
+
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
906
|
+
// for e.g. "dropzone" should suffice.
|
|
907
|
+
const globalHTMLProperties = {
|
|
856
908
|
accessKey: {
|
|
857
909
|
attribute: 'accesskey'
|
|
858
910
|
},
|
|
@@ -937,7 +989,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
937
989
|
role: {
|
|
938
990
|
attribute: 'role'
|
|
939
991
|
}
|
|
940
|
-
}
|
|
992
|
+
};
|
|
941
993
|
let controlledElement = null;
|
|
942
994
|
let controlledAttributeName;
|
|
943
995
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1004,27 +1056,18 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1004
1056
|
}
|
|
1005
1057
|
let isDomMutationAllowed = false;
|
|
1006
1058
|
function unlockDomMutation() {
|
|
1007
|
-
|
|
1008
|
-
// this method should never leak to prod
|
|
1009
|
-
throw new ReferenceError();
|
|
1010
|
-
}
|
|
1059
|
+
assertNotProd(); // this method should never leak to prod
|
|
1011
1060
|
isDomMutationAllowed = true;
|
|
1012
1061
|
}
|
|
1013
1062
|
function lockDomMutation() {
|
|
1014
|
-
|
|
1015
|
-
// this method should never leak to prod
|
|
1016
|
-
throw new ReferenceError();
|
|
1017
|
-
}
|
|
1063
|
+
assertNotProd(); // this method should never leak to prod
|
|
1018
1064
|
isDomMutationAllowed = false;
|
|
1019
1065
|
}
|
|
1020
1066
|
function logMissingPortalError(name, type) {
|
|
1021
1067
|
return logError(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
|
|
1022
1068
|
}
|
|
1023
1069
|
function patchElementWithRestrictions(elm, options) {
|
|
1024
|
-
|
|
1025
|
-
// this method should never leak to prod
|
|
1026
|
-
throw new ReferenceError();
|
|
1027
|
-
}
|
|
1070
|
+
assertNotProd(); // this method should never leak to prod
|
|
1028
1071
|
const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
1029
1072
|
const descriptors = {
|
|
1030
1073
|
outerHTML: generateAccessorDescriptor({
|
|
@@ -1110,10 +1153,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1110
1153
|
defineProperties(elm, descriptors);
|
|
1111
1154
|
}
|
|
1112
1155
|
function getShadowRootRestrictionsDescriptors(sr) {
|
|
1113
|
-
|
|
1114
|
-
// this method should never leak to prod
|
|
1115
|
-
throw new ReferenceError();
|
|
1116
|
-
}
|
|
1156
|
+
assertNotProd(); // this method should never leak to prod
|
|
1117
1157
|
// Disallowing properties in dev mode only to avoid people doing the wrong
|
|
1118
1158
|
// thing when using the real shadow root, because if that's the case,
|
|
1119
1159
|
// the component will not work when running with synthetic shadow.
|
|
@@ -1154,10 +1194,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1154
1194
|
// Custom Elements Restrictions:
|
|
1155
1195
|
// -----------------------------
|
|
1156
1196
|
function getCustomElementRestrictionsDescriptors(elm) {
|
|
1157
|
-
|
|
1158
|
-
// this method should never leak to prod
|
|
1159
|
-
throw new ReferenceError();
|
|
1160
|
-
}
|
|
1197
|
+
assertNotProd(); // this method should never leak to prod
|
|
1161
1198
|
const originalAddEventListener = elm.addEventListener;
|
|
1162
1199
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
1163
1200
|
const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
@@ -1202,10 +1239,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1202
1239
|
};
|
|
1203
1240
|
}
|
|
1204
1241
|
function getComponentRestrictionsDescriptors() {
|
|
1205
|
-
|
|
1206
|
-
// this method should never leak to prod
|
|
1207
|
-
throw new ReferenceError();
|
|
1208
|
-
}
|
|
1242
|
+
assertNotProd(); // this method should never leak to prod
|
|
1209
1243
|
return {
|
|
1210
1244
|
tagName: generateAccessorDescriptor({
|
|
1211
1245
|
get() {
|
|
@@ -1218,10 +1252,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1218
1252
|
}
|
|
1219
1253
|
|
|
1220
1254
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1221
|
-
|
|
1222
|
-
// this method should never leak to prod
|
|
1223
|
-
throw new ReferenceError();
|
|
1224
|
-
}
|
|
1255
|
+
assertNotProd(); // this method should never leak to prod
|
|
1225
1256
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
1226
1257
|
const descriptors = {
|
|
1227
1258
|
dispatchEvent: generateDataDescriptor({
|
|
@@ -1666,7 +1697,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1666
1697
|
valueMutated(originalTarget, key);
|
|
1667
1698
|
return true;
|
|
1668
1699
|
}
|
|
1669
|
-
/*LWC compiler v2.
|
|
1700
|
+
/*LWC compiler v2.38.1*/
|
|
1670
1701
|
}
|
|
1671
1702
|
const getterMap = new WeakMap();
|
|
1672
1703
|
const setterMap = new WeakMap();
|
|
@@ -1759,7 +1790,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
1759
1790
|
/* istanbul ignore next */
|
|
1760
1791
|
return false;
|
|
1761
1792
|
}
|
|
1762
|
-
/*LWC compiler v2.
|
|
1793
|
+
/*LWC compiler v2.38.1*/
|
|
1763
1794
|
}
|
|
1764
1795
|
function extract(objectOrArray) {
|
|
1765
1796
|
if (isArray(objectOrArray)) {
|
|
@@ -2026,7 +2057,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2026
2057
|
}
|
|
2027
2058
|
};
|
|
2028
2059
|
}
|
|
2029
|
-
const EMPTY_REFS = freeze(create(null));
|
|
2030
2060
|
const refsCache = new WeakMap();
|
|
2031
2061
|
/**
|
|
2032
2062
|
* This class is the base class for any LWC element.
|
|
@@ -2314,7 +2344,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2314
2344
|
}
|
|
2315
2345
|
const {
|
|
2316
2346
|
refVNodes,
|
|
2317
|
-
hasRefVNodes,
|
|
2318
2347
|
cmpTemplate
|
|
2319
2348
|
} = vm;
|
|
2320
2349
|
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
@@ -2328,15 +2357,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2328
2357
|
// were introduced, we return undefined if the template has no refs defined
|
|
2329
2358
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2330
2359
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2331
|
-
// Note
|
|
2332
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2333
|
-
if (!hasRefVNodes) {
|
|
2334
|
-
return;
|
|
2335
|
-
}
|
|
2336
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2337
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2360
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
2338
2361
|
if (isNull(refVNodes)) {
|
|
2339
|
-
return
|
|
2362
|
+
return;
|
|
2340
2363
|
}
|
|
2341
2364
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2342
2365
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -2414,6 +2437,14 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2414
2437
|
}
|
|
2415
2438
|
return renderer.getLastElementChild(vm.elm);
|
|
2416
2439
|
},
|
|
2440
|
+
get ownerDocument() {
|
|
2441
|
+
const vm = getAssociatedVM(this);
|
|
2442
|
+
const renderer = vm.renderer;
|
|
2443
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2444
|
+
warnIfInvokedDuringConstruction(vm, 'ownerDocument');
|
|
2445
|
+
}
|
|
2446
|
+
return renderer.ownerDocument(vm.elm);
|
|
2447
|
+
},
|
|
2417
2448
|
render() {
|
|
2418
2449
|
const vm = getAssociatedVM(this);
|
|
2419
2450
|
return vm.def.template;
|
|
@@ -2456,8 +2487,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2456
2487
|
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
2457
2488
|
applyAriaReflection(LightningElement.prototype);
|
|
2458
2489
|
}
|
|
2459
|
-
// The reason for this odd if/else branching is limitations in @lwc/features:
|
|
2460
|
-
// https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
|
|
2461
2490
|
if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
2462
2491
|
applyAriaReflectionToLightningElement();
|
|
2463
2492
|
}
|
|
@@ -2488,172 +2517,480 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2488
2517
|
}
|
|
2489
2518
|
|
|
2490
2519
|
/*
|
|
2491
|
-
* Copyright (c)
|
|
2520
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
2492
2521
|
* All rights reserved.
|
|
2493
2522
|
* SPDX-License-Identifier: MIT
|
|
2494
2523
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2495
2524
|
*/
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2525
|
+
const AdapterToTokenMap = new Map();
|
|
2526
|
+
function createContextProviderWithRegister(adapter, registerContextProvider) {
|
|
2527
|
+
let adapterContextToken = AdapterToTokenMap.get(adapter);
|
|
2528
|
+
if (!isUndefined$1(adapterContextToken)) {
|
|
2529
|
+
throw new Error(`Adapter already has a context provider.`);
|
|
2499
2530
|
}
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
return {
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2531
|
+
adapterContextToken = guid();
|
|
2532
|
+
AdapterToTokenMap.set(adapter, adapterContextToken);
|
|
2533
|
+
const providers = new WeakSet();
|
|
2534
|
+
return (elmOrComponent, options) => {
|
|
2535
|
+
if (providers.has(elmOrComponent)) {
|
|
2536
|
+
throw new Error(`Adapter was already installed on ${elmOrComponent}.`);
|
|
2537
|
+
}
|
|
2538
|
+
providers.add(elmOrComponent);
|
|
2539
|
+
const {
|
|
2540
|
+
consumerConnectedCallback,
|
|
2541
|
+
consumerDisconnectedCallback
|
|
2542
|
+
} = options;
|
|
2543
|
+
registerContextProvider(elmOrComponent, adapterContextToken, subscriptionPayload => {
|
|
2544
|
+
const {
|
|
2545
|
+
setNewContext,
|
|
2546
|
+
setDisconnectedCallback
|
|
2547
|
+
} = subscriptionPayload;
|
|
2548
|
+
const consumer = {
|
|
2549
|
+
provide(newContext) {
|
|
2550
|
+
setNewContext(newContext);
|
|
2509
2551
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2520
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2521
|
-
}
|
|
2522
|
-
vm.cmpProps[key] = newValue;
|
|
2523
|
-
componentValueMutated(vm, key);
|
|
2524
|
-
},
|
|
2525
|
-
enumerable: true,
|
|
2526
|
-
configurable: true
|
|
2552
|
+
};
|
|
2553
|
+
const disconnectCallback = () => {
|
|
2554
|
+
if (!isUndefined$1(consumerDisconnectedCallback)) {
|
|
2555
|
+
consumerDisconnectedCallback(consumer);
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2558
|
+
setDisconnectedCallback(disconnectCallback);
|
|
2559
|
+
consumerConnectedCallback(consumer);
|
|
2560
|
+
});
|
|
2527
2561
|
};
|
|
2528
2562
|
}
|
|
2529
|
-
function
|
|
2563
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
2530
2564
|
const {
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
if (!isFunction$1(get)) {
|
|
2537
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2538
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2539
|
-
}
|
|
2540
|
-
throw new Error();
|
|
2565
|
+
adapter
|
|
2566
|
+
} = wireDef;
|
|
2567
|
+
const adapterContextToken = AdapterToTokenMap.get(adapter);
|
|
2568
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
2569
|
+
return; // no provider found, nothing to be done
|
|
2541
2570
|
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
return get.call(this);
|
|
2571
|
+
|
|
2572
|
+
const {
|
|
2573
|
+
elm,
|
|
2574
|
+
context: {
|
|
2575
|
+
wiredConnecting,
|
|
2576
|
+
wiredDisconnecting
|
|
2549
2577
|
},
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2578
|
+
renderer: {
|
|
2579
|
+
registerContextConsumer
|
|
2580
|
+
}
|
|
2581
|
+
} = vm;
|
|
2582
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
2583
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2584
|
+
// This will attempt to connect the current element with one of its anscestors
|
|
2585
|
+
// that can provide context for the given wire adapter. This relationship is
|
|
2586
|
+
// keyed on the secret & internal value of `adapterContextToken`, which is unique
|
|
2587
|
+
// to a given wire adapter.
|
|
2588
|
+
//
|
|
2589
|
+
// Depending on the runtime environment, this connection is made using either DOM
|
|
2590
|
+
// events (in the browser) or a custom traversal (on the server).
|
|
2591
|
+
registerContextConsumer(elm, adapterContextToken, {
|
|
2592
|
+
setNewContext(newContext) {
|
|
2593
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2594
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
2595
|
+
callbackWhenContextIsReady(newContext);
|
|
2596
|
+
},
|
|
2597
|
+
setDisconnectedCallback(disconnectCallback) {
|
|
2598
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
2599
|
+
// the the element hosting the wire is disconnected
|
|
2600
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
2561
2601
|
}
|
|
2562
|
-
}
|
|
2563
|
-
|
|
2564
|
-
configurable
|
|
2565
|
-
};
|
|
2602
|
+
});
|
|
2603
|
+
});
|
|
2566
2604
|
}
|
|
2567
2605
|
|
|
2568
2606
|
/*
|
|
2569
|
-
* Copyright (c)
|
|
2607
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
2570
2608
|
* All rights reserved.
|
|
2571
2609
|
* SPDX-License-Identifier: MIT
|
|
2572
2610
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2573
2611
|
*/
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
throw new Error();
|
|
2582
|
-
}
|
|
2583
|
-
function internalTrackDecorator(key) {
|
|
2584
|
-
return {
|
|
2585
|
-
get() {
|
|
2586
|
-
const vm = getAssociatedVM(this);
|
|
2587
|
-
componentValueObserved(vm, key);
|
|
2588
|
-
return vm.cmpFields[key];
|
|
2589
|
-
},
|
|
2590
|
-
set(newValue) {
|
|
2591
|
-
const vm = getAssociatedVM(this);
|
|
2592
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2593
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2594
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2595
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2596
|
-
}
|
|
2597
|
-
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2598
|
-
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2599
|
-
},
|
|
2600
|
-
enumerable: true,
|
|
2601
|
-
configurable: true
|
|
2612
|
+
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
2613
|
+
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
2614
|
+
const WIRE_DEBUG_ENTRY = '@wire';
|
|
2615
|
+
const WireMetaMap = new Map();
|
|
2616
|
+
function createFieldDataCallback(vm, name) {
|
|
2617
|
+
return value => {
|
|
2618
|
+
updateComponentValue(vm, name, value);
|
|
2602
2619
|
};
|
|
2603
2620
|
}
|
|
2604
|
-
|
|
2605
|
-
|
|
2621
|
+
function createMethodDataCallback(vm, method) {
|
|
2622
|
+
return value => {
|
|
2623
|
+
// dispatching new value into the wired method
|
|
2624
|
+
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
2625
|
+
// job
|
|
2626
|
+
method.call(vm.component, value);
|
|
2627
|
+
}, noop);
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
2631
|
+
let hasPendingConfig = false;
|
|
2632
|
+
// creating the reactive observer for reactive params when needed
|
|
2633
|
+
const ro = createReactiveObserver(() => {
|
|
2634
|
+
if (hasPendingConfig === false) {
|
|
2635
|
+
hasPendingConfig = true;
|
|
2636
|
+
// collect new config in the micro-task
|
|
2637
|
+
Promise.resolve().then(() => {
|
|
2638
|
+
hasPendingConfig = false;
|
|
2639
|
+
// resetting current reactive params
|
|
2640
|
+
ro.reset();
|
|
2641
|
+
// dispatching a new config due to a change in the configuration
|
|
2642
|
+
computeConfigAndUpdate();
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
});
|
|
2646
|
+
const computeConfigAndUpdate = () => {
|
|
2647
|
+
let config;
|
|
2648
|
+
ro.observe(() => config = configCallback(component));
|
|
2649
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2650
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
2651
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
2652
|
+
callbackWhenConfigIsReady(config);
|
|
2653
|
+
};
|
|
2654
|
+
return {
|
|
2655
|
+
computeConfigAndUpdate,
|
|
2656
|
+
ro
|
|
2657
|
+
};
|
|
2658
|
+
}
|
|
2659
|
+
function createConnector(vm, name, wireDef) {
|
|
2660
|
+
const {
|
|
2661
|
+
method,
|
|
2662
|
+
adapter,
|
|
2663
|
+
configCallback,
|
|
2664
|
+
dynamic
|
|
2665
|
+
} = wireDef;
|
|
2666
|
+
let debugInfo;
|
|
2667
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2668
|
+
const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
2669
|
+
debugInfo = create(null);
|
|
2670
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2671
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
2672
|
+
}
|
|
2673
|
+
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
2674
|
+
const dataCallback = value => {
|
|
2675
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2676
|
+
debugInfo.data = value;
|
|
2677
|
+
// Note: most of the time, the data provided is for the current config, but there may be
|
|
2678
|
+
// some conditions in which it does not, ex:
|
|
2679
|
+
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
2680
|
+
debugInfo.wasDataProvisionedForConfig = true;
|
|
2681
|
+
}
|
|
2682
|
+
fieldOrMethodCallback(value);
|
|
2683
|
+
};
|
|
2684
|
+
let context;
|
|
2685
|
+
let connector;
|
|
2686
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
2687
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
2688
|
+
value: vm.elm
|
|
2689
|
+
});
|
|
2690
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
2691
|
+
value: dynamic
|
|
2692
|
+
});
|
|
2693
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2694
|
+
// job
|
|
2695
|
+
connector = new adapter(dataCallback);
|
|
2696
|
+
}, noop);
|
|
2697
|
+
const updateConnectorConfig = config => {
|
|
2698
|
+
// every time the config is recomputed due to tracking,
|
|
2699
|
+
// this callback will be invoked with the new computed config
|
|
2700
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2701
|
+
// job
|
|
2702
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2703
|
+
debugInfo.config = config;
|
|
2704
|
+
debugInfo.context = context;
|
|
2705
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2706
|
+
}
|
|
2707
|
+
connector.update(config, context);
|
|
2708
|
+
}, noop);
|
|
2709
|
+
};
|
|
2710
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
2711
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
2712
|
+
const {
|
|
2713
|
+
computeConfigAndUpdate,
|
|
2714
|
+
ro
|
|
2715
|
+
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
2716
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
2717
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
2718
|
+
createContextWatcher(vm, wireDef, newContext => {
|
|
2719
|
+
// every time the context is pushed into this component,
|
|
2720
|
+
// this callback will be invoked with the new computed context
|
|
2721
|
+
if (context !== newContext) {
|
|
2722
|
+
context = newContext;
|
|
2723
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
2724
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
2725
|
+
// (ever), while context can have identity
|
|
2726
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
2727
|
+
computeConfigAndUpdate();
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
return {
|
|
2733
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
2734
|
+
connector,
|
|
2735
|
+
computeConfigAndUpdate,
|
|
2736
|
+
resetConfigWatcher: () => ro.reset()
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2740
|
+
// support for callable adapters
|
|
2741
|
+
if (adapter.adapter) {
|
|
2742
|
+
adapter = adapter.adapter;
|
|
2743
|
+
}
|
|
2744
|
+
const method = descriptor.value;
|
|
2745
|
+
const def = {
|
|
2746
|
+
adapter,
|
|
2747
|
+
method,
|
|
2748
|
+
configCallback,
|
|
2749
|
+
dynamic
|
|
2750
|
+
};
|
|
2751
|
+
WireMetaMap.set(descriptor, def);
|
|
2752
|
+
}
|
|
2753
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2754
|
+
// support for callable adapters
|
|
2755
|
+
if (adapter.adapter) {
|
|
2756
|
+
adapter = adapter.adapter;
|
|
2757
|
+
}
|
|
2758
|
+
const def = {
|
|
2759
|
+
adapter,
|
|
2760
|
+
configCallback,
|
|
2761
|
+
dynamic
|
|
2762
|
+
};
|
|
2763
|
+
WireMetaMap.set(descriptor, def);
|
|
2764
|
+
}
|
|
2765
|
+
function installWireAdapters(vm) {
|
|
2766
|
+
const {
|
|
2767
|
+
context,
|
|
2768
|
+
def: {
|
|
2769
|
+
wire
|
|
2770
|
+
}
|
|
2771
|
+
} = vm;
|
|
2772
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2773
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
|
|
2774
|
+
}
|
|
2775
|
+
const wiredConnecting = context.wiredConnecting = [];
|
|
2776
|
+
const wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2777
|
+
for (const fieldNameOrMethod in wire) {
|
|
2778
|
+
const descriptor = wire[fieldNameOrMethod];
|
|
2779
|
+
const wireDef = WireMetaMap.get(descriptor);
|
|
2780
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2781
|
+
assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
|
|
2782
|
+
}
|
|
2783
|
+
if (!isUndefined$1(wireDef)) {
|
|
2784
|
+
const {
|
|
2785
|
+
connector,
|
|
2786
|
+
computeConfigAndUpdate,
|
|
2787
|
+
resetConfigWatcher
|
|
2788
|
+
} = createConnector(vm, fieldNameOrMethod, wireDef);
|
|
2789
|
+
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2790
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2791
|
+
connector.connect();
|
|
2792
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2793
|
+
if (hasDynamicParams) {
|
|
2794
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
computeConfigAndUpdate();
|
|
2799
|
+
});
|
|
2800
|
+
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
2801
|
+
connector.disconnect();
|
|
2802
|
+
resetConfigWatcher();
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
function connectWireAdapters(vm) {
|
|
2808
|
+
const {
|
|
2809
|
+
wiredConnecting
|
|
2810
|
+
} = vm.context;
|
|
2811
|
+
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
2812
|
+
wiredConnecting[i]();
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
function disconnectWireAdapters(vm) {
|
|
2816
|
+
const {
|
|
2817
|
+
wiredDisconnecting
|
|
2818
|
+
} = vm.context;
|
|
2819
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2820
|
+
// job
|
|
2821
|
+
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
2822
|
+
wiredDisconnecting[i]();
|
|
2823
|
+
}
|
|
2824
|
+
}, noop);
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
/*
|
|
2606
2828
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
2607
2829
|
* All rights reserved.
|
|
2608
2830
|
* SPDX-License-Identifier: MIT
|
|
2609
2831
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2610
2832
|
*/
|
|
2611
|
-
|
|
2612
|
-
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2613
|
-
* LWC Components. This function implements the internals of this
|
|
2614
|
-
* decorator.
|
|
2615
|
-
*/
|
|
2616
|
-
function wire(_adapter, _config) {
|
|
2833
|
+
function api$1() {
|
|
2617
2834
|
if (process.env.NODE_ENV !== 'production') {
|
|
2618
|
-
assert.fail(
|
|
2835
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2619
2836
|
}
|
|
2620
2837
|
throw new Error();
|
|
2621
2838
|
}
|
|
2622
|
-
function
|
|
2839
|
+
function createPublicPropertyDescriptor(key) {
|
|
2623
2840
|
return {
|
|
2624
2841
|
get() {
|
|
2625
2842
|
const vm = getAssociatedVM(this);
|
|
2843
|
+
if (isBeingConstructed(vm)) {
|
|
2844
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2845
|
+
logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
2846
|
+
}
|
|
2847
|
+
return;
|
|
2848
|
+
}
|
|
2626
2849
|
componentValueObserved(vm, key);
|
|
2627
|
-
return vm.
|
|
2850
|
+
return vm.cmpProps[key];
|
|
2628
2851
|
},
|
|
2629
|
-
set(
|
|
2852
|
+
set(newValue) {
|
|
2630
2853
|
const vm = getAssociatedVM(this);
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2854
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2855
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2856
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2857
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2858
|
+
}
|
|
2859
|
+
vm.cmpProps[key] = newValue;
|
|
2860
|
+
componentValueMutated(vm, key);
|
|
2638
2861
|
},
|
|
2639
2862
|
enumerable: true,
|
|
2640
2863
|
configurable: true
|
|
2641
2864
|
};
|
|
2642
2865
|
}
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2866
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2867
|
+
const {
|
|
2868
|
+
get,
|
|
2869
|
+
set,
|
|
2870
|
+
enumerable,
|
|
2871
|
+
configurable
|
|
2872
|
+
} = descriptor;
|
|
2873
|
+
if (!isFunction$1(get)) {
|
|
2874
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2875
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2876
|
+
}
|
|
2877
|
+
throw new Error();
|
|
2878
|
+
}
|
|
2879
|
+
return {
|
|
2880
|
+
get() {
|
|
2881
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2882
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2883
|
+
getAssociatedVM(this);
|
|
2884
|
+
}
|
|
2885
|
+
return get.call(this);
|
|
2886
|
+
},
|
|
2887
|
+
set(newValue) {
|
|
2888
|
+
const vm = getAssociatedVM(this);
|
|
2889
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2890
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2891
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2892
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2893
|
+
}
|
|
2894
|
+
if (set) {
|
|
2895
|
+
set.call(this, newValue);
|
|
2896
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
2897
|
+
assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
|
|
2898
|
+
}
|
|
2899
|
+
},
|
|
2900
|
+
enumerable,
|
|
2901
|
+
configurable
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
/*
|
|
2906
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2907
|
+
* All rights reserved.
|
|
2908
|
+
* SPDX-License-Identifier: MIT
|
|
2909
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2910
|
+
*/
|
|
2911
|
+
function track(target) {
|
|
2912
|
+
if (arguments.length === 1) {
|
|
2913
|
+
return getReactiveProxy(target);
|
|
2914
|
+
}
|
|
2915
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2916
|
+
assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
|
|
2917
|
+
}
|
|
2918
|
+
throw new Error();
|
|
2919
|
+
}
|
|
2920
|
+
function internalTrackDecorator(key) {
|
|
2921
|
+
return {
|
|
2922
|
+
get() {
|
|
2923
|
+
const vm = getAssociatedVM(this);
|
|
2924
|
+
componentValueObserved(vm, key);
|
|
2925
|
+
return vm.cmpFields[key];
|
|
2926
|
+
},
|
|
2927
|
+
set(newValue) {
|
|
2928
|
+
const vm = getAssociatedVM(this);
|
|
2929
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2930
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2931
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2932
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2933
|
+
}
|
|
2934
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2935
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2936
|
+
},
|
|
2937
|
+
enumerable: true,
|
|
2938
|
+
configurable: true
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
/*
|
|
2943
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2944
|
+
* All rights reserved.
|
|
2945
|
+
* SPDX-License-Identifier: MIT
|
|
2946
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2947
|
+
*/
|
|
2948
|
+
/**
|
|
2949
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2950
|
+
* LWC Components. This function implements the internals of this
|
|
2951
|
+
* decorator.
|
|
2952
|
+
*/
|
|
2953
|
+
function wire(_adapter, _config) {
|
|
2954
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2955
|
+
assert.fail('@wire(adapter, config?) may only be used as a decorator.');
|
|
2956
|
+
}
|
|
2957
|
+
throw new Error();
|
|
2958
|
+
}
|
|
2959
|
+
function internalWireFieldDecorator(key) {
|
|
2960
|
+
return {
|
|
2961
|
+
get() {
|
|
2962
|
+
const vm = getAssociatedVM(this);
|
|
2963
|
+
componentValueObserved(vm, key);
|
|
2964
|
+
return vm.cmpFields[key];
|
|
2965
|
+
},
|
|
2966
|
+
set(value) {
|
|
2967
|
+
const vm = getAssociatedVM(this);
|
|
2968
|
+
/**
|
|
2969
|
+
* Reactivity for wired fields is provided in wiring.
|
|
2970
|
+
* We intentionally add reactivity here since this is just
|
|
2971
|
+
* letting the author to do the wrong thing, but it will keep our
|
|
2972
|
+
* system to be backward compatible.
|
|
2973
|
+
*/
|
|
2974
|
+
updateComponentValue(vm, key, value);
|
|
2975
|
+
},
|
|
2976
|
+
enumerable: true,
|
|
2977
|
+
configurable: true
|
|
2978
|
+
};
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
/*
|
|
2982
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2983
|
+
* All rights reserved.
|
|
2984
|
+
* SPDX-License-Identifier: MIT
|
|
2985
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2986
|
+
*/
|
|
2987
|
+
function getClassDescriptorType(descriptor) {
|
|
2988
|
+
if (isFunction$1(descriptor.value)) {
|
|
2989
|
+
return "method" /* DescriptorType.Method */;
|
|
2990
|
+
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
2991
|
+
return "accessor" /* DescriptorType.Accessor */;
|
|
2992
|
+
} else {
|
|
2993
|
+
return "field" /* DescriptorType.Field */;
|
|
2657
2994
|
}
|
|
2658
2995
|
}
|
|
2659
2996
|
|
|
@@ -2869,8 +3206,8 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2869
3206
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2870
3207
|
*/
|
|
2871
3208
|
let warned = false;
|
|
2872
|
-
//
|
|
2873
|
-
if (process.env.NODE_ENV
|
|
3209
|
+
// Only used in LWC's Karma tests
|
|
3210
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
2874
3211
|
// @ts-ignore
|
|
2875
3212
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2876
3213
|
warned = false;
|
|
@@ -2887,6 +3224,10 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
2887
3224
|
// stylesheets and templates do not have user-meaningful names, but components do
|
|
2888
3225
|
const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
|
|
2889
3226
|
logError(`LWC WARNING: current engine is v${LWC_VERSION}, but ${friendlyName} was compiled with v${version}.\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear.`);
|
|
3227
|
+
report("CompilerRuntimeVersionMismatch" /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
|
|
3228
|
+
compilerVersion: version,
|
|
3229
|
+
runtimeVersion: LWC_VERSION
|
|
3230
|
+
});
|
|
2890
3231
|
}
|
|
2891
3232
|
}
|
|
2892
3233
|
}
|
|
@@ -3012,7 +3353,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3012
3353
|
*/
|
|
3013
3354
|
if (isFunction$1(SuperClass)) {
|
|
3014
3355
|
HTMLBridgeElement = class extends SuperClass {
|
|
3015
|
-
/*LWC compiler v2.
|
|
3356
|
+
/*LWC compiler v2.38.1*/
|
|
3016
3357
|
};
|
|
3017
3358
|
} else {
|
|
3018
3359
|
HTMLBridgeElement = function () {
|
|
@@ -3168,10 +3509,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3168
3509
|
return canRefreshAllInstances;
|
|
3169
3510
|
}
|
|
3170
3511
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3171
|
-
|
|
3172
|
-
// this method should never leak to prod
|
|
3173
|
-
throw new ReferenceError();
|
|
3174
|
-
}
|
|
3512
|
+
assertNotProd(); // this method should never leak to prod
|
|
3175
3513
|
const visited = new Set();
|
|
3176
3514
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
3177
3515
|
visited.add(tpl);
|
|
@@ -3180,10 +3518,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3180
3518
|
return tpl;
|
|
3181
3519
|
}
|
|
3182
3520
|
function getComponentOrSwappedComponent(Ctor) {
|
|
3183
|
-
|
|
3184
|
-
// this method should never leak to prod
|
|
3185
|
-
throw new ReferenceError();
|
|
3186
|
-
}
|
|
3521
|
+
assertNotProd(); // this method should never leak to prod
|
|
3187
3522
|
const visited = new Set();
|
|
3188
3523
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
3189
3524
|
visited.add(Ctor);
|
|
@@ -3192,10 +3527,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3192
3527
|
return Ctor;
|
|
3193
3528
|
}
|
|
3194
3529
|
function getStyleOrSwappedStyle(style) {
|
|
3195
|
-
|
|
3196
|
-
// this method should never leak to prod
|
|
3197
|
-
throw new ReferenceError();
|
|
3198
|
-
}
|
|
3530
|
+
assertNotProd(); // this method should never leak to prod
|
|
3199
3531
|
const visited = new Set();
|
|
3200
3532
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3201
3533
|
visited.add(style);
|
|
@@ -3204,10 +3536,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3204
3536
|
return style;
|
|
3205
3537
|
}
|
|
3206
3538
|
function setActiveVM(vm) {
|
|
3207
|
-
|
|
3208
|
-
// this method should never leak to prod
|
|
3209
|
-
throw new ReferenceError();
|
|
3210
|
-
}
|
|
3539
|
+
assertNotProd(); // this method should never leak to prod
|
|
3211
3540
|
// tracking active component
|
|
3212
3541
|
const Ctor = vm.def.ctor;
|
|
3213
3542
|
let componentVMs = activeComponents.get(Ctor);
|
|
@@ -3250,10 +3579,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3250
3579
|
}
|
|
3251
3580
|
}
|
|
3252
3581
|
function removeActiveVM(vm) {
|
|
3253
|
-
|
|
3254
|
-
// this method should never leak to prod
|
|
3255
|
-
throw new ReferenceError();
|
|
3256
|
-
}
|
|
3582
|
+
assertNotProd(); // this method should never leak to prod
|
|
3257
3583
|
// tracking inactive component
|
|
3258
3584
|
const Ctor = vm.def.ctor;
|
|
3259
3585
|
let list = activeComponents.get(Ctor);
|
|
@@ -3567,6 +3893,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3567
3893
|
stylesheets: newStylesheets,
|
|
3568
3894
|
stylesheetToken: newStylesheetToken
|
|
3569
3895
|
} = template;
|
|
3896
|
+
const {
|
|
3897
|
+
stylesheets: newVmStylesheets
|
|
3898
|
+
} = vm;
|
|
3570
3899
|
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3571
3900
|
const {
|
|
3572
3901
|
hasScopedStyles
|
|
@@ -3590,7 +3919,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3590
3919
|
}
|
|
3591
3920
|
// Apply the new template styling token to the host element, if the new template has any
|
|
3592
3921
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3593
|
-
|
|
3922
|
+
const hasNewStylesheets = hasStyles(newStylesheets);
|
|
3923
|
+
const hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
3924
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
3594
3925
|
newToken = newStylesheetToken;
|
|
3595
3926
|
}
|
|
3596
3927
|
// Set the new styling token on the host element
|
|
@@ -3626,11 +3957,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3626
3957
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3627
3958
|
}
|
|
3628
3959
|
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3629
|
-
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
continue;
|
|
3633
|
-
}
|
|
3960
|
+
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS && !isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
|
|
3961
|
+
logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
|
|
3962
|
+
continue;
|
|
3634
3963
|
}
|
|
3635
3964
|
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3636
3965
|
const scopeToken = isScopedCss || vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */ ? stylesheetToken : undefined;
|
|
@@ -3662,10 +3991,17 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3662
3991
|
stylesheets,
|
|
3663
3992
|
stylesheetToken
|
|
3664
3993
|
} = template;
|
|
3994
|
+
const {
|
|
3995
|
+
stylesheets: vmStylesheets
|
|
3996
|
+
} = vm;
|
|
3665
3997
|
let content = [];
|
|
3666
|
-
if (
|
|
3998
|
+
if (hasStyles(stylesheets)) {
|
|
3667
3999
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3668
4000
|
}
|
|
4001
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
4002
|
+
if (hasStyles(vmStylesheets)) {
|
|
4003
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
4004
|
+
}
|
|
3669
4005
|
return content;
|
|
3670
4006
|
}
|
|
3671
4007
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -3703,10 +4039,13 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
3703
4039
|
const {
|
|
3704
4040
|
template
|
|
3705
4041
|
} = getComponentInternalDef(vnode.ctor);
|
|
4042
|
+
const {
|
|
4043
|
+
vm
|
|
4044
|
+
} = vnode;
|
|
3706
4045
|
const {
|
|
3707
4046
|
stylesheetToken
|
|
3708
4047
|
} = template;
|
|
3709
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
4048
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
3710
4049
|
}
|
|
3711
4050
|
function getNearestNativeShadowComponent(vm) {
|
|
3712
4051
|
const owner = getNearestShadowComponent(vm);
|
|
@@ -4376,6 +4715,28 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
4376
4715
|
// in fallback mode, the allocation will always set children to
|
|
4377
4716
|
// empty and delegate the real allocation to the slot elements
|
|
4378
4717
|
allocateChildren(n2, vm);
|
|
4718
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
4719
|
+
//
|
|
4720
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
4721
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
4722
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
4723
|
+
//
|
|
4724
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
4725
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
4726
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
4727
|
+
// mark the new children dynamic.
|
|
4728
|
+
//
|
|
4729
|
+
// Example:
|
|
4730
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
4731
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
4732
|
+
const {
|
|
4733
|
+
shadowMode,
|
|
4734
|
+
renderMode
|
|
4735
|
+
} = vm;
|
|
4736
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
4737
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
4738
|
+
markAsDynamicChildren(n2.children);
|
|
4739
|
+
}
|
|
4379
4740
|
}
|
|
4380
4741
|
// in fallback mode, the children will be always empty, so, nothing
|
|
4381
4742
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -4568,7 +4929,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
4568
4929
|
//
|
|
4569
4930
|
// In case #2, we will always get a fresh VCustomElement.
|
|
4570
4931
|
const children = vnode.aChildren || vnode.children;
|
|
4571
|
-
vm.aChildren = children;
|
|
4572
4932
|
const {
|
|
4573
4933
|
renderMode,
|
|
4574
4934
|
shadowMode
|
|
@@ -4581,15 +4941,61 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
4581
4941
|
logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
|
|
4582
4942
|
}
|
|
4583
4943
|
}
|
|
4944
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
4945
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
4946
|
+
const allocatedChildren = flattenFragmentsInChildren(children);
|
|
4947
|
+
vnode.children = allocatedChildren;
|
|
4948
|
+
vm.aChildren = allocatedChildren;
|
|
4584
4949
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4585
4950
|
// slow path
|
|
4586
|
-
allocateInSlot(vm,
|
|
4951
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
4587
4952
|
// save the allocated children in case this vnode is reused.
|
|
4588
|
-
vnode.aChildren =
|
|
4953
|
+
vnode.aChildren = allocatedChildren;
|
|
4589
4954
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4590
4955
|
vnode.children = EmptyArray;
|
|
4591
4956
|
}
|
|
4592
4957
|
}
|
|
4958
|
+
/**
|
|
4959
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
4960
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
4961
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
4962
|
+
*
|
|
4963
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
4964
|
+
*
|
|
4965
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
4966
|
+
*/
|
|
4967
|
+
function flattenFragmentsInChildren(children) {
|
|
4968
|
+
const flattenedChildren = [];
|
|
4969
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
4970
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4971
|
+
const nodeStack = [];
|
|
4972
|
+
let fragmentFound = false;
|
|
4973
|
+
for (let i = children.length - 1; i > -1; i -= 1) {
|
|
4974
|
+
const child = children[i];
|
|
4975
|
+
ArrayPush$1.call(nodeStack, child);
|
|
4976
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4977
|
+
}
|
|
4978
|
+
if (!fragmentFound) {
|
|
4979
|
+
return children;
|
|
4980
|
+
}
|
|
4981
|
+
let currentNode;
|
|
4982
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
4983
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4984
|
+
const fChildren = currentNode.children;
|
|
4985
|
+
// Ignore the start and end text node delimiters
|
|
4986
|
+
for (let i = fChildren.length - 2; i > 0; i -= 1) {
|
|
4987
|
+
ArrayPush$1.call(nodeStack, fChildren[i]);
|
|
4988
|
+
}
|
|
4989
|
+
} else {
|
|
4990
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
4994
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
4995
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
4996
|
+
markAsDynamicChildren(flattenedChildren);
|
|
4997
|
+
return flattenedChildren;
|
|
4998
|
+
}
|
|
4593
4999
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4594
5000
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4595
5001
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -4614,40 +5020,34 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
4614
5020
|
}
|
|
4615
5021
|
return vm;
|
|
4616
5022
|
}
|
|
4617
|
-
|
|
4618
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4619
|
-
*/
|
|
4620
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
5023
|
+
function allocateInSlot(vm, children, owner) {
|
|
4621
5024
|
var _a, _b;
|
|
5025
|
+
const {
|
|
5026
|
+
cmpSlots: {
|
|
5027
|
+
slotAssignments: oldSlotsMapping
|
|
5028
|
+
}
|
|
5029
|
+
} = vm;
|
|
5030
|
+
const cmpSlotsMapping = create(null);
|
|
5031
|
+
// Collect all slots into cmpSlotsMapping
|
|
4622
5032
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4623
5033
|
const vnode = children[i];
|
|
4624
5034
|
if (isNull(vnode)) {
|
|
4625
5035
|
continue;
|
|
4626
5036
|
}
|
|
4627
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
4628
|
-
if (isVFragment(vnode)) {
|
|
4629
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4630
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4631
|
-
continue;
|
|
4632
|
-
}
|
|
4633
5037
|
let slotName = '';
|
|
4634
5038
|
if (isVBaseElement(vnode)) {
|
|
4635
5039
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4636
5040
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
4637
5041
|
slotName = vnode.slotName;
|
|
4638
5042
|
}
|
|
4639
|
-
|
|
5043
|
+
// Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
|
|
5044
|
+
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
|
5045
|
+
// the following line also throws same error for symbols
|
|
5046
|
+
// Similar for Object.create(null)
|
|
5047
|
+
const normalizedSlotName = '' + slotName;
|
|
5048
|
+
const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
|
4640
5049
|
ArrayPush$1.call(vnodes, vnode);
|
|
4641
5050
|
}
|
|
4642
|
-
}
|
|
4643
|
-
function allocateInSlot(vm, children, owner) {
|
|
4644
|
-
const {
|
|
4645
|
-
cmpSlots: {
|
|
4646
|
-
slotAssignments: oldSlotsMapping
|
|
4647
|
-
}
|
|
4648
|
-
} = vm;
|
|
4649
|
-
const cmpSlotsMapping = create(null);
|
|
4650
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
4651
5051
|
vm.cmpSlots = {
|
|
4652
5052
|
owner,
|
|
4653
5053
|
slotAssignments: cmpSlotsMapping
|
|
@@ -4678,14 +5078,14 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
4678
5078
|
}
|
|
4679
5079
|
}
|
|
4680
5080
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4681
|
-
const
|
|
4682
|
-
// dynamic children means it was generated by an iteration
|
|
4683
|
-
//
|
|
5081
|
+
const DynamicChildren = new WeakMap();
|
|
5082
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
5083
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
4684
5084
|
function markAsDynamicChildren(children) {
|
|
4685
|
-
|
|
5085
|
+
DynamicChildren.set(children, 1);
|
|
4686
5086
|
}
|
|
4687
5087
|
function hasDynamicChildren(children) {
|
|
4688
|
-
return
|
|
5088
|
+
return DynamicChildren.has(children);
|
|
4689
5089
|
}
|
|
4690
5090
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4691
5091
|
const map = {};
|
|
@@ -5420,10 +5820,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5420
5820
|
vmBeingRendered = vm;
|
|
5421
5821
|
}
|
|
5422
5822
|
function validateSlots(vm, html) {
|
|
5423
|
-
|
|
5424
|
-
// this method should never leak to prod
|
|
5425
|
-
throw new ReferenceError();
|
|
5426
|
-
}
|
|
5823
|
+
assertNotProd(); // this method should never leak to prod
|
|
5427
5824
|
const {
|
|
5428
5825
|
cmpSlots
|
|
5429
5826
|
} = vm;
|
|
@@ -5565,7 +5962,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5565
5962
|
// Create a brand new template cache for the swapped templated.
|
|
5566
5963
|
context.tplCache = create(null);
|
|
5567
5964
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5568
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
5965
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
5569
5966
|
// Update the scoping token on the host element.
|
|
5570
5967
|
updateStylesheetToken(vm, html);
|
|
5571
5968
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -5580,9 +5977,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5580
5977
|
setActiveVM(vm);
|
|
5581
5978
|
}
|
|
5582
5979
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
5583
|
-
|
|
5584
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
5585
|
-
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5980
|
+
vm.refVNodes = html.hasRefs ? create(null) : null;
|
|
5586
5981
|
// right before producing the vnodes, we clear up all internal references
|
|
5587
5982
|
// to custom elements from the template.
|
|
5588
5983
|
vm.velements = [];
|
|
@@ -5607,11 +6002,8 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5607
6002
|
}
|
|
5608
6003
|
return vnodes;
|
|
5609
6004
|
}
|
|
5610
|
-
function
|
|
5611
|
-
|
|
5612
|
-
stylesheets
|
|
5613
|
-
} = template;
|
|
5614
|
-
if (!isUndefined$1(stylesheets)) {
|
|
6005
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
6006
|
+
if (hasStyles(stylesheets)) {
|
|
5615
6007
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5616
6008
|
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
5617
6009
|
return true;
|
|
@@ -5620,6 +6012,16 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5620
6012
|
}
|
|
5621
6013
|
return false;
|
|
5622
6014
|
}
|
|
6015
|
+
function computeHasScopedStyles(template, vm) {
|
|
6016
|
+
const {
|
|
6017
|
+
stylesheets
|
|
6018
|
+
} = template;
|
|
6019
|
+
const vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
6020
|
+
return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
|
|
6021
|
+
}
|
|
6022
|
+
function hasStyles(stylesheets) {
|
|
6023
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
6024
|
+
}
|
|
5623
6025
|
|
|
5624
6026
|
/*
|
|
5625
6027
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5738,6 +6140,8 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5738
6140
|
}) {
|
|
5739
6141
|
if (isFunction$1(Ctor)) {
|
|
5740
6142
|
if (process.env.NODE_ENV !== 'production') {
|
|
6143
|
+
// There is no point in running this in production, because the version mismatch check relies
|
|
6144
|
+
// on code comments which are stripped out in production by minifiers
|
|
5741
6145
|
checkVersionMismatch(Ctor, 'component');
|
|
5742
6146
|
}
|
|
5743
6147
|
signedTemplateMap.set(Ctor, tmpl);
|
|
@@ -5782,7 +6186,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5782
6186
|
const cmpEventListenerMap = new WeakMap();
|
|
5783
6187
|
function getWrappedComponentsListener(vm, listener) {
|
|
5784
6188
|
if (!isFunction$1(listener)) {
|
|
5785
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
6189
|
+
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
5786
6190
|
}
|
|
5787
6191
|
|
|
5788
6192
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
@@ -5932,7 +6336,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5932
6336
|
mode,
|
|
5933
6337
|
owner,
|
|
5934
6338
|
refVNodes: null,
|
|
5935
|
-
hasRefVNodes: false,
|
|
5936
6339
|
children: EmptyArray,
|
|
5937
6340
|
aChildren: EmptyArray,
|
|
5938
6341
|
velements: EmptyArray,
|
|
@@ -5957,6 +6360,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5957
6360
|
// Properties set right after VM creation.
|
|
5958
6361
|
tro: null,
|
|
5959
6362
|
shadowMode: null,
|
|
6363
|
+
stylesheets: null,
|
|
5960
6364
|
// Properties set by the LightningElement constructor.
|
|
5961
6365
|
component: null,
|
|
5962
6366
|
shadowRoot: null,
|
|
@@ -5969,6 +6373,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5969
6373
|
if (process.env.NODE_ENV !== 'production') {
|
|
5970
6374
|
vm.debugInfo = create(null);
|
|
5971
6375
|
}
|
|
6376
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
5972
6377
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5973
6378
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5974
6379
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5987,6 +6392,59 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
5987
6392
|
}
|
|
5988
6393
|
return vm;
|
|
5989
6394
|
}
|
|
6395
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
6396
|
+
let valid = true;
|
|
6397
|
+
const validate = arrayOrStylesheet => {
|
|
6398
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
6399
|
+
for (let i = 0; i < arrayOrStylesheet.length; i++) {
|
|
6400
|
+
validate(arrayOrStylesheet[i]);
|
|
6401
|
+
}
|
|
6402
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
6403
|
+
// function assumed to be a stylesheet factory
|
|
6404
|
+
valid = false;
|
|
6405
|
+
}
|
|
6406
|
+
};
|
|
6407
|
+
if (!isArray$1(stylesheets)) {
|
|
6408
|
+
valid = false;
|
|
6409
|
+
} else {
|
|
6410
|
+
validate(stylesheets);
|
|
6411
|
+
}
|
|
6412
|
+
return valid;
|
|
6413
|
+
}
|
|
6414
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
6415
|
+
function computeStylesheets(vm, ctor) {
|
|
6416
|
+
warnOnStylesheetsMutation(ctor);
|
|
6417
|
+
const {
|
|
6418
|
+
stylesheets
|
|
6419
|
+
} = ctor;
|
|
6420
|
+
if (!isUndefined$1(stylesheets)) {
|
|
6421
|
+
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
6422
|
+
if (valid) {
|
|
6423
|
+
return flattenStylesheets(stylesheets);
|
|
6424
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
6425
|
+
logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
return null;
|
|
6429
|
+
}
|
|
6430
|
+
function warnOnStylesheetsMutation(ctor) {
|
|
6431
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6432
|
+
let {
|
|
6433
|
+
stylesheets
|
|
6434
|
+
} = ctor;
|
|
6435
|
+
defineProperty(ctor, 'stylesheets', {
|
|
6436
|
+
enumerable: true,
|
|
6437
|
+
configurable: true,
|
|
6438
|
+
get() {
|
|
6439
|
+
return stylesheets;
|
|
6440
|
+
},
|
|
6441
|
+
set(newValue) {
|
|
6442
|
+
logWarnOnce(`Dynamically setting the "stylesheets" static property on ${ctor.name} ` + 'will not affect the stylesheets injected.');
|
|
6443
|
+
stylesheets = newValue;
|
|
6444
|
+
}
|
|
6445
|
+
});
|
|
6446
|
+
}
|
|
6447
|
+
}
|
|
5990
6448
|
function computeShadowMode(vm, renderer) {
|
|
5991
6449
|
const {
|
|
5992
6450
|
def
|
|
@@ -6253,388 +6711,110 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
6253
6711
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6254
6712
|
switch (vnode.type) {
|
|
6255
6713
|
case 2 /* VNodeType.Element */:
|
|
6256
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
6257
|
-
break;
|
|
6258
|
-
case 3 /* VNodeType.CustomElement */:
|
|
6259
|
-
{
|
|
6260
|
-
const vm = getAssociatedVM(vnode.elm);
|
|
6261
|
-
resetComponentStateWhenRemoved(vm);
|
|
6262
|
-
break;
|
|
6263
|
-
}
|
|
6264
|
-
}
|
|
6265
|
-
}
|
|
6266
|
-
}
|
|
6267
|
-
}
|
|
6268
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6269
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6270
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6271
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
6272
|
-
function resetComponentRoot(vm) {
|
|
6273
|
-
const {
|
|
6274
|
-
children,
|
|
6275
|
-
renderRoot,
|
|
6276
|
-
renderer: {
|
|
6277
|
-
remove
|
|
6278
|
-
}
|
|
6279
|
-
} = vm;
|
|
6280
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
6281
|
-
const child = children[i];
|
|
6282
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6283
|
-
remove(child.elm, renderRoot);
|
|
6284
|
-
}
|
|
6285
|
-
}
|
|
6286
|
-
vm.children = EmptyArray;
|
|
6287
|
-
runChildNodesDisconnectedCallback(vm);
|
|
6288
|
-
vm.velements = EmptyArray;
|
|
6289
|
-
}
|
|
6290
|
-
function scheduleRehydration(vm) {
|
|
6291
|
-
if (isTrue(vm.isScheduled)) {
|
|
6292
|
-
return;
|
|
6293
|
-
}
|
|
6294
|
-
vm.isScheduled = true;
|
|
6295
|
-
if (rehydrateQueue.length === 0) {
|
|
6296
|
-
addCallbackToNextTick(flushRehydrationQueue);
|
|
6297
|
-
}
|
|
6298
|
-
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6299
|
-
}
|
|
6300
|
-
function getErrorBoundaryVM(vm) {
|
|
6301
|
-
let currentVm = vm;
|
|
6302
|
-
while (!isNull(currentVm)) {
|
|
6303
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6304
|
-
return currentVm;
|
|
6305
|
-
}
|
|
6306
|
-
currentVm = currentVm.owner;
|
|
6307
|
-
}
|
|
6308
|
-
}
|
|
6309
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6310
|
-
let error;
|
|
6311
|
-
pre();
|
|
6312
|
-
try {
|
|
6313
|
-
job();
|
|
6314
|
-
} catch (e) {
|
|
6315
|
-
error = Object(e);
|
|
6316
|
-
} finally {
|
|
6317
|
-
post();
|
|
6318
|
-
if (!isUndefined$1(error)) {
|
|
6319
|
-
addErrorComponentStack(vm, error);
|
|
6320
|
-
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6321
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
6322
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
6323
|
-
}
|
|
6324
|
-
|
|
6325
|
-
resetComponentRoot(vm); // remove offenders
|
|
6326
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6327
|
-
// error boundaries must have an ErrorCallback
|
|
6328
|
-
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6329
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6330
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6331
|
-
}
|
|
6332
|
-
}
|
|
6333
|
-
}
|
|
6334
|
-
function forceRehydration(vm) {
|
|
6335
|
-
// if we must reset the shadowRoot content and render the template
|
|
6336
|
-
// from scratch on an active instance, the way to force the reset
|
|
6337
|
-
// is by replacing the value of old template, which is used during
|
|
6338
|
-
// to determine if the template has changed or not during the rendering
|
|
6339
|
-
// process. If the template returned by render() is different from the
|
|
6340
|
-
// previous stored template, the styles will be reset, along with the
|
|
6341
|
-
// content of the shadowRoot, this way we can guarantee that all children
|
|
6342
|
-
// elements will be throw away, and new instances will be created.
|
|
6343
|
-
vm.cmpTemplate = () => [];
|
|
6344
|
-
if (isFalse(vm.isDirty)) {
|
|
6345
|
-
// forcing the vm to rehydrate in the next tick
|
|
6346
|
-
markComponentAsDirty(vm);
|
|
6347
|
-
scheduleRehydration(vm);
|
|
6348
|
-
}
|
|
6349
|
-
}
|
|
6350
|
-
|
|
6351
|
-
/*
|
|
6352
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6353
|
-
* All rights reserved.
|
|
6354
|
-
* SPDX-License-Identifier: MIT
|
|
6355
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6356
|
-
*/
|
|
6357
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
6358
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
6359
|
-
const WIRE_DEBUG_ENTRY = '@wire';
|
|
6360
|
-
const WireMetaMap = new Map();
|
|
6361
|
-
class WireContextRegistrationEvent extends CustomEvent {
|
|
6362
|
-
constructor(adapterToken, {
|
|
6363
|
-
setNewContext,
|
|
6364
|
-
setDisconnectedCallback
|
|
6365
|
-
}) {
|
|
6366
|
-
super(adapterToken, {
|
|
6367
|
-
bubbles: true,
|
|
6368
|
-
composed: true
|
|
6369
|
-
});
|
|
6370
|
-
defineProperties(this, {
|
|
6371
|
-
setNewContext: {
|
|
6372
|
-
value: setNewContext
|
|
6373
|
-
},
|
|
6374
|
-
setDisconnectedCallback: {
|
|
6375
|
-
value: setDisconnectedCallback
|
|
6376
|
-
}
|
|
6377
|
-
});
|
|
6378
|
-
}
|
|
6379
|
-
/*LWC compiler v2.33.0*/
|
|
6380
|
-
}
|
|
6381
|
-
function createFieldDataCallback(vm, name) {
|
|
6382
|
-
return value => {
|
|
6383
|
-
updateComponentValue(vm, name, value);
|
|
6384
|
-
};
|
|
6385
|
-
}
|
|
6386
|
-
function createMethodDataCallback(vm, method) {
|
|
6387
|
-
return value => {
|
|
6388
|
-
// dispatching new value into the wired method
|
|
6389
|
-
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
6390
|
-
// job
|
|
6391
|
-
method.call(vm.component, value);
|
|
6392
|
-
}, noop);
|
|
6393
|
-
};
|
|
6394
|
-
}
|
|
6395
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6396
|
-
let hasPendingConfig = false;
|
|
6397
|
-
// creating the reactive observer for reactive params when needed
|
|
6398
|
-
const ro = createReactiveObserver(() => {
|
|
6399
|
-
if (hasPendingConfig === false) {
|
|
6400
|
-
hasPendingConfig = true;
|
|
6401
|
-
// collect new config in the micro-task
|
|
6402
|
-
Promise.resolve().then(() => {
|
|
6403
|
-
hasPendingConfig = false;
|
|
6404
|
-
// resetting current reactive params
|
|
6405
|
-
ro.reset();
|
|
6406
|
-
// dispatching a new config due to a change in the configuration
|
|
6407
|
-
computeConfigAndUpdate();
|
|
6408
|
-
});
|
|
6409
|
-
}
|
|
6410
|
-
});
|
|
6411
|
-
const computeConfigAndUpdate = () => {
|
|
6412
|
-
let config;
|
|
6413
|
-
ro.observe(() => config = configCallback(component));
|
|
6414
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6415
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
6416
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
6417
|
-
callbackWhenConfigIsReady(config);
|
|
6418
|
-
};
|
|
6419
|
-
return {
|
|
6420
|
-
computeConfigAndUpdate,
|
|
6421
|
-
ro
|
|
6422
|
-
};
|
|
6423
|
-
}
|
|
6424
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
6425
|
-
const {
|
|
6426
|
-
adapter
|
|
6427
|
-
} = wireDef;
|
|
6428
|
-
const adapterContextToken = getAdapterToken(adapter);
|
|
6429
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
6430
|
-
return; // no provider found, nothing to be done
|
|
6431
|
-
}
|
|
6432
|
-
|
|
6433
|
-
const {
|
|
6434
|
-
elm,
|
|
6435
|
-
context: {
|
|
6436
|
-
wiredConnecting,
|
|
6437
|
-
wiredDisconnecting
|
|
6438
|
-
},
|
|
6439
|
-
renderer: {
|
|
6440
|
-
dispatchEvent
|
|
6441
|
-
}
|
|
6442
|
-
} = vm;
|
|
6443
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
6444
|
-
ArrayPush$1.call(wiredConnecting, () => {
|
|
6445
|
-
// This event is responsible for connecting the host element with another
|
|
6446
|
-
// element in the composed path that is providing contextual data. The provider
|
|
6447
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
6448
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
6449
|
-
// guarantee that the linkage can be forged.
|
|
6450
|
-
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
6451
|
-
setNewContext(newContext) {
|
|
6452
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6453
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
6454
|
-
callbackWhenContextIsReady(newContext);
|
|
6455
|
-
},
|
|
6456
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
6457
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
6458
|
-
// the the element hosting the wire is disconnected
|
|
6459
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
6460
|
-
}
|
|
6461
|
-
});
|
|
6462
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
6463
|
-
});
|
|
6464
|
-
}
|
|
6465
|
-
function createConnector(vm, name, wireDef) {
|
|
6466
|
-
const {
|
|
6467
|
-
method,
|
|
6468
|
-
adapter,
|
|
6469
|
-
configCallback,
|
|
6470
|
-
dynamic
|
|
6471
|
-
} = wireDef;
|
|
6472
|
-
let debugInfo;
|
|
6473
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6474
|
-
const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
6475
|
-
debugInfo = create(null);
|
|
6476
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6477
|
-
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
6478
|
-
}
|
|
6479
|
-
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
6480
|
-
const dataCallback = value => {
|
|
6481
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6482
|
-
debugInfo.data = value;
|
|
6483
|
-
// Note: most of the time, the data provided is for the current config, but there may be
|
|
6484
|
-
// some conditions in which it does not, ex:
|
|
6485
|
-
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
6486
|
-
debugInfo.wasDataProvisionedForConfig = true;
|
|
6487
|
-
}
|
|
6488
|
-
fieldOrMethodCallback(value);
|
|
6489
|
-
};
|
|
6490
|
-
let context;
|
|
6491
|
-
let connector;
|
|
6492
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
6493
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
6494
|
-
value: vm.elm
|
|
6495
|
-
});
|
|
6496
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
6497
|
-
value: dynamic
|
|
6498
|
-
});
|
|
6499
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
6500
|
-
// job
|
|
6501
|
-
connector = new adapter(dataCallback);
|
|
6502
|
-
}, noop);
|
|
6503
|
-
const updateConnectorConfig = config => {
|
|
6504
|
-
// every time the config is recomputed due to tracking,
|
|
6505
|
-
// this callback will be invoked with the new computed config
|
|
6506
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
6507
|
-
// job
|
|
6508
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6509
|
-
debugInfo.config = config;
|
|
6510
|
-
debugInfo.context = context;
|
|
6511
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6512
|
-
}
|
|
6513
|
-
connector.update(config, context);
|
|
6514
|
-
}, noop);
|
|
6515
|
-
};
|
|
6516
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6517
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
6518
|
-
const {
|
|
6519
|
-
computeConfigAndUpdate,
|
|
6520
|
-
ro
|
|
6521
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
6522
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6523
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
6524
|
-
createContextWatcher(vm, wireDef, newContext => {
|
|
6525
|
-
// every time the context is pushed into this component,
|
|
6526
|
-
// this callback will be invoked with the new computed context
|
|
6527
|
-
if (context !== newContext) {
|
|
6528
|
-
context = newContext;
|
|
6529
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6530
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6531
|
-
// (ever), while context can have identity
|
|
6532
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
6533
|
-
computeConfigAndUpdate();
|
|
6534
|
-
}
|
|
6535
|
-
}
|
|
6536
|
-
});
|
|
6537
|
-
}
|
|
6538
|
-
return {
|
|
6539
|
-
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
6540
|
-
connector,
|
|
6541
|
-
computeConfigAndUpdate,
|
|
6542
|
-
resetConfigWatcher: () => ro.reset()
|
|
6543
|
-
};
|
|
6544
|
-
}
|
|
6545
|
-
const AdapterToTokenMap = new Map();
|
|
6546
|
-
function getAdapterToken(adapter) {
|
|
6547
|
-
return AdapterToTokenMap.get(adapter);
|
|
6548
|
-
}
|
|
6549
|
-
function setAdapterToken(adapter, token) {
|
|
6550
|
-
AdapterToTokenMap.set(adapter, token);
|
|
6551
|
-
}
|
|
6552
|
-
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
6553
|
-
// support for callable adapters
|
|
6554
|
-
if (adapter.adapter) {
|
|
6555
|
-
adapter = adapter.adapter;
|
|
6714
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
6715
|
+
break;
|
|
6716
|
+
case 3 /* VNodeType.CustomElement */:
|
|
6717
|
+
{
|
|
6718
|
+
const vm = getAssociatedVM(vnode.elm);
|
|
6719
|
+
resetComponentStateWhenRemoved(vm);
|
|
6720
|
+
break;
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6556
6724
|
}
|
|
6557
|
-
const method = descriptor.value;
|
|
6558
|
-
const def = {
|
|
6559
|
-
adapter,
|
|
6560
|
-
method,
|
|
6561
|
-
configCallback,
|
|
6562
|
-
dynamic
|
|
6563
|
-
};
|
|
6564
|
-
WireMetaMap.set(descriptor, def);
|
|
6565
6725
|
}
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
};
|
|
6576
|
-
WireMetaMap.set(descriptor, def);
|
|
6726
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6727
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6728
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6729
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
6730
|
+
function resetComponentRoot(vm) {
|
|
6731
|
+
recursivelyRemoveChildren(vm.children, vm);
|
|
6732
|
+
vm.children = EmptyArray;
|
|
6733
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6734
|
+
vm.velements = EmptyArray;
|
|
6577
6735
|
}
|
|
6578
|
-
function
|
|
6736
|
+
// Helper function to remove all children of the root node.
|
|
6737
|
+
// If the set of children includes VFragment nodes, we need to remove the children of those nodes too.
|
|
6738
|
+
// Since VFragments can contain other VFragments, we need to traverse the entire of tree of VFragments.
|
|
6739
|
+
// If the set contains no VFragment nodes, no traversal is needed.
|
|
6740
|
+
function recursivelyRemoveChildren(vnodes, vm) {
|
|
6579
6741
|
const {
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6742
|
+
renderRoot,
|
|
6743
|
+
renderer: {
|
|
6744
|
+
remove
|
|
6583
6745
|
}
|
|
6584
6746
|
} = vm;
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
|
|
6595
|
-
}
|
|
6596
|
-
if (!isUndefined$1(wireDef)) {
|
|
6597
|
-
const {
|
|
6598
|
-
connector,
|
|
6599
|
-
computeConfigAndUpdate,
|
|
6600
|
-
resetConfigWatcher
|
|
6601
|
-
} = createConnector(vm, fieldNameOrMethod, wireDef);
|
|
6602
|
-
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
6603
|
-
ArrayPush$1.call(wiredConnecting, () => {
|
|
6604
|
-
connector.connect();
|
|
6605
|
-
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6606
|
-
if (hasDynamicParams) {
|
|
6607
|
-
Promise.resolve().then(computeConfigAndUpdate);
|
|
6608
|
-
return;
|
|
6609
|
-
}
|
|
6610
|
-
}
|
|
6611
|
-
computeConfigAndUpdate();
|
|
6612
|
-
});
|
|
6613
|
-
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
6614
|
-
connector.disconnect();
|
|
6615
|
-
resetConfigWatcher();
|
|
6616
|
-
});
|
|
6747
|
+
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
6748
|
+
const vnode = vnodes[i];
|
|
6749
|
+
if (!isNull(vnode)) {
|
|
6750
|
+
// VFragments are special; their .elm property does not point to the root element since they have no single root.
|
|
6751
|
+
if (isVFragment(vnode)) {
|
|
6752
|
+
recursivelyRemoveChildren(vnode.children, vm);
|
|
6753
|
+
} else if (!isUndefined$1(vnode.elm)) {
|
|
6754
|
+
remove(vnode.elm, renderRoot);
|
|
6755
|
+
}
|
|
6617
6756
|
}
|
|
6618
6757
|
}
|
|
6619
6758
|
}
|
|
6620
|
-
function
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
} = vm.context;
|
|
6624
|
-
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
6625
|
-
wiredConnecting[i]();
|
|
6759
|
+
function scheduleRehydration(vm) {
|
|
6760
|
+
if (isTrue(vm.isScheduled)) {
|
|
6761
|
+
return;
|
|
6626
6762
|
}
|
|
6763
|
+
vm.isScheduled = true;
|
|
6764
|
+
if (rehydrateQueue.length === 0) {
|
|
6765
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
6766
|
+
}
|
|
6767
|
+
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6627
6768
|
}
|
|
6628
|
-
function
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
// job
|
|
6634
|
-
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
6635
|
-
wiredDisconnecting[i]();
|
|
6769
|
+
function getErrorBoundaryVM(vm) {
|
|
6770
|
+
let currentVm = vm;
|
|
6771
|
+
while (!isNull(currentVm)) {
|
|
6772
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6773
|
+
return currentVm;
|
|
6636
6774
|
}
|
|
6637
|
-
|
|
6775
|
+
currentVm = currentVm.owner;
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6778
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6779
|
+
let error;
|
|
6780
|
+
pre();
|
|
6781
|
+
try {
|
|
6782
|
+
job();
|
|
6783
|
+
} catch (e) {
|
|
6784
|
+
error = Object(e);
|
|
6785
|
+
} finally {
|
|
6786
|
+
post();
|
|
6787
|
+
if (!isUndefined$1(error)) {
|
|
6788
|
+
addErrorComponentStack(vm, error);
|
|
6789
|
+
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6790
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
6791
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
resetComponentRoot(vm); // remove offenders
|
|
6795
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6796
|
+
// error boundaries must have an ErrorCallback
|
|
6797
|
+
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6798
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6799
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6800
|
+
}
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6803
|
+
function forceRehydration(vm) {
|
|
6804
|
+
// if we must reset the shadowRoot content and render the template
|
|
6805
|
+
// from scratch on an active instance, the way to force the reset
|
|
6806
|
+
// is by replacing the value of old template, which is used during
|
|
6807
|
+
// to determine if the template has changed or not during the rendering
|
|
6808
|
+
// process. If the template returned by render() is different from the
|
|
6809
|
+
// previous stored template, the styles will be reset, along with the
|
|
6810
|
+
// content of the shadowRoot, this way we can guarantee that all children
|
|
6811
|
+
// elements will be throw away, and new instances will be created.
|
|
6812
|
+
vm.cmpTemplate = () => [];
|
|
6813
|
+
if (isFalse(vm.isDirty)) {
|
|
6814
|
+
// forcing the vm to rehydrate in the next tick
|
|
6815
|
+
markComponentAsDirty(vm);
|
|
6816
|
+
scheduleRehydration(vm);
|
|
6817
|
+
}
|
|
6638
6818
|
}
|
|
6639
6819
|
|
|
6640
6820
|
/*
|
|
@@ -6643,44 +6823,152 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
6643
6823
|
* SPDX-License-Identifier: MIT
|
|
6644
6824
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6645
6825
|
*/
|
|
6646
|
-
//
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6826
|
+
//
|
|
6827
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
6828
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
6829
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
6830
|
+
// See: https://sfdc.co/synthetic-aria
|
|
6831
|
+
//
|
|
6832
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6833
|
+
const getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6834
|
+
const querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6835
|
+
// This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
|
|
6836
|
+
// so nobody else can misuse these global APIs.
|
|
6837
|
+
delete _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6838
|
+
delete _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6839
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
6840
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6841
|
+
}
|
|
6842
|
+
function reportViolation$1(source, target, attrName) {
|
|
6843
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
6844
|
+
// shadow for a violation to be detected.
|
|
6845
|
+
let vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
6846
|
+
if (isUndefined$1(vm)) {
|
|
6847
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
6848
|
+
}
|
|
6849
|
+
if (isUndefined$1(vm)) {
|
|
6850
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
6851
|
+
return;
|
|
6651
6852
|
}
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6853
|
+
report("CrossRootAriaInSyntheticShadow" /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
|
|
6854
|
+
tagName: vm.tagName,
|
|
6855
|
+
attributeName: attrName
|
|
6856
|
+
});
|
|
6857
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6858
|
+
// Avoid excessively logging to the console in the case of duplicates.
|
|
6859
|
+
logWarnOnce(`Element <${source.tagName.toLowerCase()}> uses attribute "${attrName}" to reference element ` + `<${target.tagName.toLowerCase()}>, which is not in the same shadow root. This will break in native shadow DOM. ` + `For details, see: https://sfdc.co/synthetic-aria`, vm);
|
|
6860
|
+
}
|
|
6861
|
+
}
|
|
6862
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
6863
|
+
// split on whitespace and skip empty strings after splitting
|
|
6864
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
6865
|
+
}
|
|
6866
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
6867
|
+
const root = elm.getRootNode();
|
|
6868
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
6869
|
+
return;
|
|
6870
|
+
}
|
|
6871
|
+
if (attrName === 'id') {
|
|
6872
|
+
// elm is the target, find the source
|
|
6873
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
6874
|
+
// if our id is null or empty, nobody can reference us
|
|
6875
|
+
return;
|
|
6658
6876
|
}
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
provide(newContext) {
|
|
6671
|
-
setNewContext(newContext);
|
|
6877
|
+
for (const idRefAttrName of ID_REFERENCING_ATTRIBUTES_SET) {
|
|
6878
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
6879
|
+
// that reference multiple IDs, separated by whitespace.
|
|
6880
|
+
const query = `[${idRefAttrName}~="${CSS.escape(attrValue)}"]`;
|
|
6881
|
+
const sourceElements = querySelectorAll.call(document, query);
|
|
6882
|
+
for (let i = 0; i < sourceElements.length; i++) {
|
|
6883
|
+
const sourceElement = sourceElements[i];
|
|
6884
|
+
const sourceRoot = sourceElement.getRootNode();
|
|
6885
|
+
if (sourceRoot !== root) {
|
|
6886
|
+
reportViolation$1(sourceElement, elm, idRefAttrName);
|
|
6887
|
+
break;
|
|
6672
6888
|
}
|
|
6673
|
-
}
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
} else {
|
|
6892
|
+
// elm is the source, find the target
|
|
6893
|
+
const ids = parseIdRefAttributeValue(attrValue);
|
|
6894
|
+
for (const id of ids) {
|
|
6895
|
+
const target = getElementById.call(document, id);
|
|
6896
|
+
if (!isNull(target)) {
|
|
6897
|
+
const targetRoot = target.getRootNode();
|
|
6898
|
+
if (targetRoot !== root) {
|
|
6899
|
+
// target element's shadow root is not the same as ours
|
|
6900
|
+
reportViolation$1(elm, target, attrName);
|
|
6677
6901
|
}
|
|
6678
|
-
}
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6902
|
+
}
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
let enabled = false;
|
|
6907
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
6908
|
+
// reporting is not enabled. It should also only run once
|
|
6909
|
+
function enableDetection$1() {
|
|
6910
|
+
if (enabled) {
|
|
6911
|
+
return; // don't double-apply the patches
|
|
6912
|
+
}
|
|
6913
|
+
|
|
6914
|
+
enabled = true;
|
|
6915
|
+
const {
|
|
6916
|
+
setAttribute
|
|
6917
|
+
} = Element.prototype;
|
|
6918
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
6919
|
+
assign(Element.prototype, {
|
|
6920
|
+
setAttribute(attrName, attrValue) {
|
|
6921
|
+
setAttribute.call(this, attrName, attrValue);
|
|
6922
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
6923
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
});
|
|
6927
|
+
// Detect `elm.id = 'foo'`
|
|
6928
|
+
const idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
6929
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
6930
|
+
const {
|
|
6931
|
+
get,
|
|
6932
|
+
set
|
|
6933
|
+
} = idDescriptor;
|
|
6934
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
6935
|
+
if (isFunction$1(get) && isFunction$1(set)) {
|
|
6936
|
+
defineProperty(Element.prototype, 'id', {
|
|
6937
|
+
get() {
|
|
6938
|
+
return get.call(this);
|
|
6939
|
+
},
|
|
6940
|
+
set(value) {
|
|
6941
|
+
set.call(this, value);
|
|
6942
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
6943
|
+
},
|
|
6944
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
6945
|
+
enumerable: true,
|
|
6946
|
+
configurable: true
|
|
6947
|
+
});
|
|
6948
|
+
}
|
|
6949
|
+
}
|
|
6950
|
+
}
|
|
6951
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
6952
|
+
// for unsupported browsers
|
|
6953
|
+
function supportsCssEscape() {
|
|
6954
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
6955
|
+
}
|
|
6956
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
6957
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
6958
|
+
function isSyntheticShadowLoaded() {
|
|
6959
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
6960
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
6961
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6962
|
+
}
|
|
6963
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
6964
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
6965
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
6966
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6967
|
+
enableDetection$1();
|
|
6968
|
+
} else {
|
|
6969
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
6970
|
+
onReportingEnabled(enableDetection$1);
|
|
6971
|
+
}
|
|
6684
6972
|
}
|
|
6685
6973
|
|
|
6686
6974
|
/*
|
|
@@ -6689,19 +6977,105 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
6689
6977
|
* SPDX-License-Identifier: MIT
|
|
6690
6978
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6691
6979
|
*/
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6980
|
+
//
|
|
6981
|
+
// The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
|
|
6982
|
+
// legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
|
|
6983
|
+
//
|
|
6984
|
+
// See the README for @lwc/aria-reflection
|
|
6985
|
+
const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
|
|
6986
|
+
function isLightningElement(elm) {
|
|
6987
|
+
// The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
|
|
6988
|
+
// In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
|
|
6989
|
+
return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
|
|
6990
|
+
}
|
|
6991
|
+
function findVM(elm) {
|
|
6992
|
+
// If it's a shadow DOM component, then it has a host
|
|
6993
|
+
const {
|
|
6994
|
+
host
|
|
6995
|
+
} = elm.getRootNode();
|
|
6996
|
+
const vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
|
|
6997
|
+
if (!isUndefined$1(vm)) {
|
|
6998
|
+
return vm;
|
|
6999
|
+
}
|
|
7000
|
+
// Else it might be a light DOM component. Walk up the tree trying to find the owner
|
|
7001
|
+
let parentElement = elm;
|
|
7002
|
+
while (!isNull(parentElement = parentElement.parentElement)) {
|
|
7003
|
+
if (isLightningElement(parentElement)) {
|
|
7004
|
+
const vm = getAssociatedVMIfPresent(parentElement);
|
|
7005
|
+
if (!isUndefined$1(vm)) {
|
|
7006
|
+
return vm;
|
|
7007
|
+
}
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
7010
|
+
// If we return undefined, it's because the element was rendered wholly outside a LightningElement
|
|
7011
|
+
}
|
|
7012
|
+
|
|
7013
|
+
function checkAndReportViolation(elm, prop, isSetter, setValue) {
|
|
7014
|
+
if (!isLightningElement(elm)) {
|
|
7015
|
+
const vm = findVM(elm);
|
|
7016
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7017
|
+
logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` + (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) + `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` + `See https://sfdc.co/deprecated-aria`);
|
|
7018
|
+
}
|
|
7019
|
+
let setValueType;
|
|
7020
|
+
if (isSetter) {
|
|
7021
|
+
// `typeof null` is "object" which is not very useful for detecting null.
|
|
7022
|
+
// We mostly want to know null vs undefined vs other types here, due to
|
|
7023
|
+
// https://github.com/salesforce/lwc/issues/3284
|
|
7024
|
+
setValueType = isNull(setValue) ? 'null' : typeof setValue;
|
|
7025
|
+
}
|
|
7026
|
+
report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
|
|
7027
|
+
tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
|
|
7028
|
+
propertyName: prop,
|
|
7029
|
+
isSetter,
|
|
7030
|
+
setValueType
|
|
7031
|
+
});
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
7034
|
+
function enableDetection() {
|
|
7035
|
+
const {
|
|
7036
|
+
prototype
|
|
7037
|
+
} = Element;
|
|
7038
|
+
for (const prop of NON_STANDARD_ARIA_PROPS) {
|
|
7039
|
+
const descriptor = getOwnPropertyDescriptor$1(prototype, prop);
|
|
7040
|
+
// The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
|
|
7041
|
+
// This happens automatically because of the ordering of imports.
|
|
7042
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7043
|
+
/* istanbul ignore if */
|
|
7044
|
+
if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
|
|
7045
|
+
// should never happen
|
|
7046
|
+
throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
|
|
7047
|
+
}
|
|
7048
|
+
}
|
|
7049
|
+
// @ts-ignore
|
|
7050
|
+
const {
|
|
7051
|
+
get,
|
|
7052
|
+
set
|
|
7053
|
+
} = descriptor;
|
|
7054
|
+
defineProperty(prototype, prop, {
|
|
7055
|
+
get() {
|
|
7056
|
+
checkAndReportViolation(this, prop, false, undefined);
|
|
7057
|
+
return get.call(this);
|
|
7058
|
+
},
|
|
7059
|
+
set(val) {
|
|
7060
|
+
checkAndReportViolation(this, prop, true, val);
|
|
7061
|
+
return set.call(this, val);
|
|
7062
|
+
},
|
|
7063
|
+
configurable: true,
|
|
7064
|
+
enumerable: true
|
|
7065
|
+
});
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
// No point in running this code if we're not in a browser, or if the global polyfill is not loaded
|
|
7069
|
+
{
|
|
7070
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
7071
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
7072
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7073
|
+
enableDetection();
|
|
7074
|
+
} else {
|
|
7075
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
7076
|
+
onReportingEnabled(enableDetection);
|
|
6702
7077
|
}
|
|
6703
7078
|
}
|
|
6704
|
-
return getReadOnlyProxy(obj);
|
|
6705
7079
|
}
|
|
6706
7080
|
|
|
6707
7081
|
/*
|
|
@@ -6762,17 +7136,46 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
6762
7136
|
return renderer.nextSibling(hydratedNode);
|
|
6763
7137
|
}
|
|
6764
7138
|
const NODE_VALUE_PROP = 'nodeValue';
|
|
7139
|
+
const PARENT_NODE_PROP = 'parentNode';
|
|
7140
|
+
const TAG_NAME_PROP = 'tagName';
|
|
7141
|
+
function textNodeContentsAreEqual(node, vnode, renderer) {
|
|
7142
|
+
const {
|
|
7143
|
+
getProperty
|
|
7144
|
+
} = renderer;
|
|
7145
|
+
const nodeValue = getProperty(node, NODE_VALUE_PROP);
|
|
7146
|
+
if (nodeValue === vnode.text) {
|
|
7147
|
+
return true;
|
|
7148
|
+
}
|
|
7149
|
+
// Special case for empty text nodes – these are serialized differently on the server
|
|
7150
|
+
// See https://github.com/salesforce/lwc/pull/2656
|
|
7151
|
+
if (nodeValue === '\u200D' && vnode.text === '') {
|
|
7152
|
+
return true;
|
|
7153
|
+
}
|
|
7154
|
+
// Special case for text nodes inside `<style>` tags – these are escaped when rendered server-size,
|
|
7155
|
+
// but not when generated by the engine client-side.
|
|
7156
|
+
const parentNode = getProperty(node, PARENT_NODE_PROP);
|
|
7157
|
+
// Should never be null, but just to be safe, we check.
|
|
7158
|
+
/* istanbul ignore else */
|
|
7159
|
+
if (!isNull(parentNode)) {
|
|
7160
|
+
const tagName = getProperty(parentNode, TAG_NAME_PROP);
|
|
7161
|
+
// If the tagName is STYLE, then the following condition should always be true.
|
|
7162
|
+
// The LWC compiler blocks using `<style>`s inside of templates, so it should be impossible
|
|
7163
|
+
// for component authors to render different `<style>` text content on the client and server.
|
|
7164
|
+
// But just to be safe, we check.
|
|
7165
|
+
/* istanbul ignore next */
|
|
7166
|
+
if (tagName === 'STYLE' && htmlEscape(vnode.text) === nodeValue) {
|
|
7167
|
+
return true;
|
|
7168
|
+
}
|
|
7169
|
+
}
|
|
7170
|
+
return false;
|
|
7171
|
+
}
|
|
6765
7172
|
function hydrateText(node, vnode, renderer) {
|
|
6766
7173
|
var _a;
|
|
6767
7174
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
6768
7175
|
return handleMismatch(node, vnode, renderer);
|
|
6769
7176
|
}
|
|
6770
7177
|
if (process.env.NODE_ENV !== 'production') {
|
|
6771
|
-
|
|
6772
|
-
getProperty
|
|
6773
|
-
} = renderer;
|
|
6774
|
-
const nodeValue = getProperty(node, NODE_VALUE_PROP);
|
|
6775
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
7178
|
+
if (!textNodeContentsAreEqual(node, vnode, renderer)) {
|
|
6776
7179
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6777
7180
|
}
|
|
6778
7181
|
}
|
|
@@ -6988,6 +7391,19 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
6988
7391
|
const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
|
|
6989
7392
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6990
7393
|
}
|
|
7394
|
+
function attributeValuesAreEqual(vnodeValue, value) {
|
|
7395
|
+
const vnodeValueAsString = String(vnodeValue);
|
|
7396
|
+
if (vnodeValueAsString === value) {
|
|
7397
|
+
return true;
|
|
7398
|
+
}
|
|
7399
|
+
// If the expected value is null, this means that the attribute does not exist. In that case,
|
|
7400
|
+
// we accept any nullish value (undefined or null).
|
|
7401
|
+
if (isNull(value) && (isUndefined$1(vnodeValue) || isNull(vnodeValue))) {
|
|
7402
|
+
return true;
|
|
7403
|
+
}
|
|
7404
|
+
// In all other cases, the two values are not considered equal
|
|
7405
|
+
return false;
|
|
7406
|
+
}
|
|
6991
7407
|
function validateAttrs(vnode, elm, renderer) {
|
|
6992
7408
|
const {
|
|
6993
7409
|
data: {
|
|
@@ -7005,12 +7421,12 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7005
7421
|
getAttribute
|
|
7006
7422
|
} = renderer;
|
|
7007
7423
|
const elmAttrValue = getAttribute(elm, attrName);
|
|
7008
|
-
if (
|
|
7424
|
+
if (!attributeValuesAreEqual(attrValue, elmAttrValue)) {
|
|
7009
7425
|
if (process.env.NODE_ENV !== 'production') {
|
|
7010
7426
|
const {
|
|
7011
7427
|
getProperty
|
|
7012
7428
|
} = renderer;
|
|
7013
|
-
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
7429
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found ${isNull(elmAttrValue) ? 'null' : `"${elmAttrValue}"`}`, owner);
|
|
7014
7430
|
}
|
|
7015
7431
|
nodesAreCompatible = false;
|
|
7016
7432
|
}
|
|
@@ -7198,12 +7614,13 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7198
7614
|
*/
|
|
7199
7615
|
// See @lwc/engine-core/src/framework/template.ts
|
|
7200
7616
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
7201
|
-
// Via https://www.npmjs.com/package/object-observer
|
|
7202
|
-
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7203
7617
|
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
7204
|
-
const
|
|
7618
|
+
const STYLESHEET_PROPS = [
|
|
7205
7619
|
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
7206
7620
|
'$scoped$'];
|
|
7621
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
7622
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7623
|
+
let mutationTrackingDisabled = false;
|
|
7207
7624
|
function getOriginalArrayMethod(prop) {
|
|
7208
7625
|
switch (prop) {
|
|
7209
7626
|
case 'pop':
|
|
@@ -7226,7 +7643,20 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7226
7643
|
return ArrayCopyWithin;
|
|
7227
7644
|
}
|
|
7228
7645
|
}
|
|
7229
|
-
|
|
7646
|
+
function reportViolation(type, eventId, prop) {
|
|
7647
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7648
|
+
logWarnOnce(`Mutating the "${prop}" property on a ${type} ` + `is deprecated and will be removed in a future version of LWC. ` + `See: https://sfdc.co/template-mutation`);
|
|
7649
|
+
}
|
|
7650
|
+
report(eventId, {
|
|
7651
|
+
propertyName: prop
|
|
7652
|
+
});
|
|
7653
|
+
}
|
|
7654
|
+
function reportTemplateViolation(prop) {
|
|
7655
|
+
reportViolation('template', "TemplateMutation" /* ReportingEventId.TemplateMutation */, prop);
|
|
7656
|
+
}
|
|
7657
|
+
function reportStylesheetViolation(prop) {
|
|
7658
|
+
reportViolation('stylesheet', "StylesheetMutation" /* ReportingEventId.StylesheetMutation */, prop);
|
|
7659
|
+
}
|
|
7230
7660
|
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
7231
7661
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
7232
7662
|
function warnOnArrayMutation(stylesheets) {
|
|
@@ -7235,7 +7665,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7235
7665
|
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
7236
7666
|
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
7237
7667
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
7238
|
-
|
|
7668
|
+
reportTemplateViolation('stylesheets');
|
|
7239
7669
|
// @ts-ignore
|
|
7240
7670
|
return originalArrayMethod.apply(this, arguments);
|
|
7241
7671
|
};
|
|
@@ -7244,8 +7674,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7244
7674
|
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
7245
7675
|
// `stylesheet.$scoped$ = true`
|
|
7246
7676
|
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
7247
|
-
|
|
7248
|
-
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
7677
|
+
for (const prop of STYLESHEET_PROPS) {
|
|
7249
7678
|
let value = stylesheet[prop];
|
|
7250
7679
|
defineProperty(stylesheet, prop, {
|
|
7251
7680
|
enumerable: true,
|
|
@@ -7254,14 +7683,14 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7254
7683
|
return value;
|
|
7255
7684
|
},
|
|
7256
7685
|
set(newValue) {
|
|
7257
|
-
|
|
7686
|
+
reportStylesheetViolation(prop);
|
|
7258
7687
|
value = newValue;
|
|
7259
7688
|
}
|
|
7260
7689
|
});
|
|
7261
7690
|
}
|
|
7262
7691
|
}
|
|
7263
7692
|
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
7264
|
-
function
|
|
7693
|
+
function trackStylesheetsMutation(stylesheets) {
|
|
7265
7694
|
traverseStylesheets(stylesheets, subStylesheets => {
|
|
7266
7695
|
if (isArray$1(subStylesheets)) {
|
|
7267
7696
|
warnOnArrayMutation(subStylesheets);
|
|
@@ -7288,7 +7717,70 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7288
7717
|
}
|
|
7289
7718
|
}
|
|
7290
7719
|
}
|
|
7720
|
+
function trackMutations(tmpl) {
|
|
7721
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
7722
|
+
trackStylesheetsMutation(tmpl.stylesheets);
|
|
7723
|
+
}
|
|
7724
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
7725
|
+
let value = tmpl[prop];
|
|
7726
|
+
defineProperty(tmpl, prop, {
|
|
7727
|
+
enumerable: true,
|
|
7728
|
+
configurable: true,
|
|
7729
|
+
get() {
|
|
7730
|
+
return value;
|
|
7731
|
+
},
|
|
7732
|
+
set(newValue) {
|
|
7733
|
+
if (!mutationTrackingDisabled) {
|
|
7734
|
+
reportTemplateViolation(prop);
|
|
7735
|
+
}
|
|
7736
|
+
value = newValue;
|
|
7737
|
+
}
|
|
7738
|
+
});
|
|
7739
|
+
}
|
|
7740
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7741
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7742
|
+
enumerable: true,
|
|
7743
|
+
configurable: true,
|
|
7744
|
+
get: originalDescriptor.get,
|
|
7745
|
+
set(value) {
|
|
7746
|
+
reportTemplateViolation('stylesheetTokens');
|
|
7747
|
+
// Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
|
|
7748
|
+
mutationTrackingDisabled = true;
|
|
7749
|
+
originalDescriptor.set.call(this, value);
|
|
7750
|
+
mutationTrackingDisabled = false;
|
|
7751
|
+
}
|
|
7752
|
+
});
|
|
7753
|
+
}
|
|
7754
|
+
function addLegacyStylesheetTokensShim(tmpl) {
|
|
7755
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
7756
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
7757
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7758
|
+
enumerable: true,
|
|
7759
|
+
configurable: true,
|
|
7760
|
+
get() {
|
|
7761
|
+
const {
|
|
7762
|
+
stylesheetToken
|
|
7763
|
+
} = this;
|
|
7764
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
7765
|
+
return stylesheetToken;
|
|
7766
|
+
}
|
|
7767
|
+
// Shim for the old `stylesheetTokens` property
|
|
7768
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7769
|
+
return {
|
|
7770
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
7771
|
+
shadowAttribute: stylesheetToken
|
|
7772
|
+
};
|
|
7773
|
+
},
|
|
7774
|
+
set(value) {
|
|
7775
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7776
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7777
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7778
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7779
|
+
}
|
|
7780
|
+
});
|
|
7781
|
+
}
|
|
7291
7782
|
function freezeTemplate(tmpl) {
|
|
7783
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
7292
7784
|
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
7293
7785
|
// Deep freeze the template
|
|
7294
7786
|
freeze(tmpl);
|
|
@@ -7296,66 +7788,16 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7296
7788
|
deepFreeze(tmpl.stylesheets);
|
|
7297
7789
|
}
|
|
7298
7790
|
} else {
|
|
7299
|
-
//
|
|
7300
|
-
//
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
enumerable: true,
|
|
7304
|
-
configurable: true,
|
|
7305
|
-
get() {
|
|
7306
|
-
const {
|
|
7307
|
-
stylesheetToken
|
|
7308
|
-
} = this;
|
|
7309
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
7310
|
-
return stylesheetToken;
|
|
7311
|
-
}
|
|
7312
|
-
// Shim for the old `stylesheetTokens` property
|
|
7313
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7314
|
-
return {
|
|
7315
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
7316
|
-
shadowAttribute: stylesheetToken
|
|
7317
|
-
};
|
|
7318
|
-
},
|
|
7319
|
-
set(value) {
|
|
7320
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7321
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7322
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7323
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7324
|
-
}
|
|
7325
|
-
});
|
|
7326
|
-
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
7791
|
+
// template is not frozen - shim, report, and warn
|
|
7792
|
+
// this shim should be applied in both dev and prod
|
|
7793
|
+
addLegacyStylesheetTokensShim(tmpl);
|
|
7794
|
+
// When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
|
|
7327
7795
|
if (process.env.NODE_ENV !== 'production') {
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
defineProperty(tmpl, prop, {
|
|
7334
|
-
enumerable: true,
|
|
7335
|
-
configurable: true,
|
|
7336
|
-
get() {
|
|
7337
|
-
return value;
|
|
7338
|
-
},
|
|
7339
|
-
set(newValue) {
|
|
7340
|
-
if (!mutationWarningsSilenced) {
|
|
7341
|
-
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
7342
|
-
}
|
|
7343
|
-
value = newValue;
|
|
7344
|
-
}
|
|
7345
|
-
});
|
|
7346
|
-
}
|
|
7347
|
-
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7348
|
-
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7349
|
-
enumerable: true,
|
|
7350
|
-
configurable: true,
|
|
7351
|
-
get: originalDescriptor.get,
|
|
7352
|
-
set(value) {
|
|
7353
|
-
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
7354
|
-
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
7355
|
-
mutationWarningsSilenced = true;
|
|
7356
|
-
originalDescriptor.set.call(this, value);
|
|
7357
|
-
mutationWarningsSilenced = false;
|
|
7358
|
-
}
|
|
7796
|
+
trackMutations(tmpl);
|
|
7797
|
+
} else {
|
|
7798
|
+
// In prod mode, we only track mutations if reporting is enabled
|
|
7799
|
+
onReportingEnabled(() => {
|
|
7800
|
+
trackMutations(tmpl);
|
|
7359
7801
|
});
|
|
7360
7802
|
}
|
|
7361
7803
|
}
|
|
@@ -7383,7 +7825,28 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7383
7825
|
}
|
|
7384
7826
|
return ctor;
|
|
7385
7827
|
}
|
|
7386
|
-
|
|
7828
|
+
|
|
7829
|
+
/*
|
|
7830
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7831
|
+
* All rights reserved.
|
|
7832
|
+
* SPDX-License-Identifier: MIT
|
|
7833
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7834
|
+
*/
|
|
7835
|
+
/**
|
|
7836
|
+
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
|
7837
|
+
* membrane around any object value. This API is subject to change or
|
|
7838
|
+
* being removed.
|
|
7839
|
+
*/
|
|
7840
|
+
function readonly(obj) {
|
|
7841
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7842
|
+
// TODO [#1292]: Remove the readonly decorator
|
|
7843
|
+
if (arguments.length !== 1) {
|
|
7844
|
+
assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
7845
|
+
}
|
|
7846
|
+
}
|
|
7847
|
+
return getReadOnlyProxy(obj);
|
|
7848
|
+
}
|
|
7849
|
+
/* version: 2.38.1 */
|
|
7387
7850
|
|
|
7388
7851
|
/*
|
|
7389
7852
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7486,7 +7949,8 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7486
7949
|
//
|
|
7487
7950
|
// Test utilities
|
|
7488
7951
|
//
|
|
7489
|
-
|
|
7952
|
+
// Only used in LWC's Karma tests
|
|
7953
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
7490
7954
|
// @ts-ignore
|
|
7491
7955
|
window.__lwcResetGlobalStylesheets = () => {
|
|
7492
7956
|
stylesheetCache.clear();
|
|
@@ -7627,7 +8091,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7627
8091
|
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
7628
8092
|
// which are not equipped to be initialized that way.
|
|
7629
8093
|
class clazz extends HTMLElementAlias {
|
|
7630
|
-
/*LWC compiler v2.
|
|
8094
|
+
/*LWC compiler v2.38.1*/
|
|
7631
8095
|
}
|
|
7632
8096
|
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
7633
8097
|
new clazz();
|
|
@@ -7660,7 +8124,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7660
8124
|
const cachedConstructors = new Map();
|
|
7661
8125
|
const elementsUpgradedOutsideLWC = new WeakSet();
|
|
7662
8126
|
let elementBeingUpgradedByLWC = false;
|
|
7663
|
-
// Creates a constructor that is intended to be used as a
|
|
8127
|
+
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
|
7664
8128
|
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
7665
8129
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
7666
8130
|
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
@@ -7685,7 +8149,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7685
8149
|
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
7686
8150
|
}
|
|
7687
8151
|
}
|
|
7688
|
-
/*LWC compiler v2.
|
|
8152
|
+
/*LWC compiler v2.38.1*/
|
|
7689
8153
|
}
|
|
7690
8154
|
// Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
|
|
7691
8155
|
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
|
@@ -7705,7 +8169,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7705
8169
|
}
|
|
7706
8170
|
return UpgradableConstructor;
|
|
7707
8171
|
};
|
|
7708
|
-
const
|
|
8172
|
+
const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
|
|
7709
8173
|
// use global custom elements registry
|
|
7710
8174
|
let UpgradableConstructor = cachedConstructors.get(tagName);
|
|
7711
8175
|
if (isUndefined$1(UpgradableConstructor)) {
|
|
@@ -7724,574 +8188,6 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
7724
8188
|
}
|
|
7725
8189
|
};
|
|
7726
8190
|
|
|
7727
|
-
/*
|
|
7728
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
7729
|
-
* All rights reserved.
|
|
7730
|
-
* SPDX-License-Identifier: MIT
|
|
7731
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7732
|
-
*/
|
|
7733
|
-
/**
|
|
7734
|
-
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
7735
|
-
* do not conflict with vanilla custom elements having the same tag name.
|
|
7736
|
-
*/
|
|
7737
|
-
function createScopedRegistry() {
|
|
7738
|
-
if (!hasCustomElements) {
|
|
7739
|
-
// This code should never be reached, because we don't use the pivot registry if
|
|
7740
|
-
// custom elements are unavailable.
|
|
7741
|
-
throw new Error('Custom elements are not supported in this environment.');
|
|
7742
|
-
}
|
|
7743
|
-
const {
|
|
7744
|
-
HTMLElement: NativeHTMLElement
|
|
7745
|
-
} = window;
|
|
7746
|
-
const {
|
|
7747
|
-
hasAttribute: nativeHasAttribute,
|
|
7748
|
-
setAttribute: nativeSetAttribute,
|
|
7749
|
-
removeAttribute: nativeRemoveAttribute,
|
|
7750
|
-
getAttribute: nativeGetAttribute
|
|
7751
|
-
} = NativeHTMLElement.prototype;
|
|
7752
|
-
const definitionForElement = new WeakMap();
|
|
7753
|
-
const pendingRegistryForElement = new WeakMap();
|
|
7754
|
-
const definitionForConstructor = new WeakMap();
|
|
7755
|
-
const registeredUserCtors = new WeakSet();
|
|
7756
|
-
const registeredPivotCtors = new WeakSet();
|
|
7757
|
-
const pivotCtorByTag = new Map();
|
|
7758
|
-
const globalDefinitionsByTag = new Map();
|
|
7759
|
-
const globalDefinitionsByClass = new Map();
|
|
7760
|
-
const awaitingUpgrade = new Map();
|
|
7761
|
-
const pendingWhenDefinedCallbacks = new Map();
|
|
7762
|
-
const EMPTY_SET = new Set();
|
|
7763
|
-
function createDefinitionRecord(constructor) {
|
|
7764
|
-
var _a;
|
|
7765
|
-
const {
|
|
7766
|
-
connectedCallback,
|
|
7767
|
-
disconnectedCallback,
|
|
7768
|
-
formAssociatedCallback,
|
|
7769
|
-
formDisabledCallback,
|
|
7770
|
-
formResetCallback,
|
|
7771
|
-
formStateRestoreCallback,
|
|
7772
|
-
adoptedCallback,
|
|
7773
|
-
attributeChangedCallback
|
|
7774
|
-
} = constructor.prototype;
|
|
7775
|
-
const formAssociated = Boolean(constructor.formAssociated);
|
|
7776
|
-
const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
|
|
7777
|
-
return {
|
|
7778
|
-
UserCtor: constructor,
|
|
7779
|
-
PivotCtor: undefined,
|
|
7780
|
-
connectedCallback,
|
|
7781
|
-
disconnectedCallback,
|
|
7782
|
-
formAssociatedCallback,
|
|
7783
|
-
formDisabledCallback,
|
|
7784
|
-
formResetCallback,
|
|
7785
|
-
formStateRestoreCallback,
|
|
7786
|
-
adoptedCallback,
|
|
7787
|
-
attributeChangedCallback,
|
|
7788
|
-
observedAttributes,
|
|
7789
|
-
formAssociated
|
|
7790
|
-
};
|
|
7791
|
-
}
|
|
7792
|
-
// Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
|
|
7793
|
-
// element. Note that the `registeredDefinition` represents the constructor that was used to register during
|
|
7794
|
-
// `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
|
|
7795
|
-
// constructor is invoked with another constructor.
|
|
7796
|
-
function createPivotingClass(tagName, registeredDefinition) {
|
|
7797
|
-
class PivotCtor extends NativeHTMLElement {
|
|
7798
|
-
constructor(UserCtor) {
|
|
7799
|
-
// This constructor can only be invoked by:
|
|
7800
|
-
// a) the browser instantiating an element from parsing or via document.createElement.
|
|
7801
|
-
// b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
|
|
7802
|
-
// b) new UserClass.
|
|
7803
|
-
// When LWC instantiates it, it will pass the upgrading definition as an argument
|
|
7804
|
-
// If the caller signals via UserCtor that this is in fact a controlled
|
|
7805
|
-
// definition, we use that one, otherwise fallback to the global
|
|
7806
|
-
// internal registry.
|
|
7807
|
-
super();
|
|
7808
|
-
const userCtorIsDefined = !isUndefined$1(UserCtor);
|
|
7809
|
-
if (userCtorIsDefined) {
|
|
7810
|
-
if (!isConstructor(UserCtor)) {
|
|
7811
|
-
throw new TypeError(`Failed to create custom element: the provided constructor is not a constructor.`);
|
|
7812
|
-
}
|
|
7813
|
-
if (!registeredUserCtors.has(UserCtor)) {
|
|
7814
|
-
throw new Error(`Failed to create custom element: the provided constructor is unregistered: ${UserCtor.name}.`);
|
|
7815
|
-
}
|
|
7816
|
-
}
|
|
7817
|
-
const definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
|
|
7818
|
-
if (!isUndefined$1(definition)) {
|
|
7819
|
-
internalUpgrade(this, registeredDefinition, definition);
|
|
7820
|
-
} else {
|
|
7821
|
-
// This is the case in which there is no global definition, and
|
|
7822
|
-
// it is not handled by LWC (otherwise it will have a valid UserCtor)
|
|
7823
|
-
// so we need to add it to the pending queue just in case it eventually
|
|
7824
|
-
// gets defined in the global registry.
|
|
7825
|
-
pendingRegistryForElement.set(this, registeredDefinition);
|
|
7826
|
-
}
|
|
7827
|
-
}
|
|
7828
|
-
connectedCallback() {
|
|
7829
|
-
var _a;
|
|
7830
|
-
const definition = definitionForElement.get(this);
|
|
7831
|
-
if (!isUndefined$1(definition)) {
|
|
7832
|
-
// Delegate out to user callback
|
|
7833
|
-
(_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7834
|
-
} else {
|
|
7835
|
-
// Register for upgrade when defined (only when connected, so we don't leak)
|
|
7836
|
-
let awaiting = awaitingUpgrade.get(tagName);
|
|
7837
|
-
if (isUndefined$1(awaiting)) {
|
|
7838
|
-
awaitingUpgrade.set(tagName, awaiting = new Set());
|
|
7839
|
-
}
|
|
7840
|
-
awaiting.add(this);
|
|
7841
|
-
}
|
|
7842
|
-
}
|
|
7843
|
-
disconnectedCallback() {
|
|
7844
|
-
var _a;
|
|
7845
|
-
const definition = definitionForElement.get(this);
|
|
7846
|
-
if (!isUndefined$1(definition)) {
|
|
7847
|
-
// Delegate out to user callback
|
|
7848
|
-
(_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7849
|
-
} else {
|
|
7850
|
-
// Un-register for upgrade when defined (so we don't leak)
|
|
7851
|
-
const awaiting = awaitingUpgrade.get(tagName);
|
|
7852
|
-
// At this point, awaiting should never be undefined, because connectedCallback
|
|
7853
|
-
// must have been called before disconnectedCallback. But just to be safe, we check
|
|
7854
|
-
if (!isUndefined$1(awaiting)) {
|
|
7855
|
-
awaiting.delete(this);
|
|
7856
|
-
}
|
|
7857
|
-
}
|
|
7858
|
-
}
|
|
7859
|
-
formAssociatedCallback(form) {
|
|
7860
|
-
var _a;
|
|
7861
|
-
const definition = definitionForElement.get(this);
|
|
7862
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
|
|
7863
|
-
}
|
|
7864
|
-
formDisabledCallback(disabled) {
|
|
7865
|
-
var _a;
|
|
7866
|
-
const definition = definitionForElement.get(this);
|
|
7867
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
|
|
7868
|
-
}
|
|
7869
|
-
formResetCallback() {
|
|
7870
|
-
var _a;
|
|
7871
|
-
const definition = definitionForElement.get(this);
|
|
7872
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7873
|
-
}
|
|
7874
|
-
formStateRestoreCallback(state, mode) {
|
|
7875
|
-
var _a;
|
|
7876
|
-
const definition = definitionForElement.get(this);
|
|
7877
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
|
|
7878
|
-
}
|
|
7879
|
-
adoptedCallback() {
|
|
7880
|
-
var _a;
|
|
7881
|
-
const definition = definitionForElement.get(this);
|
|
7882
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7883
|
-
}
|
|
7884
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
7885
|
-
var _a;
|
|
7886
|
-
const definition = definitionForElement.get(this);
|
|
7887
|
-
// if both definitions are the same, then the observedAttributes is the same,
|
|
7888
|
-
// but if they are different, only if the runtime definition has the attribute
|
|
7889
|
-
// marked as observed, then it should invoke attributeChangedCallback.
|
|
7890
|
-
if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
|
|
7891
|
-
(_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
|
|
7892
|
-
}
|
|
7893
|
-
}
|
|
7894
|
-
/*LWC compiler v2.33.0*/
|
|
7895
|
-
}
|
|
7896
|
-
PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
|
|
7897
|
-
// TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
|
|
7898
|
-
PivotCtor.formAssociated = registeredDefinition.formAssociated;
|
|
7899
|
-
registeredPivotCtors.add(PivotCtor);
|
|
7900
|
-
return PivotCtor;
|
|
7901
|
-
}
|
|
7902
|
-
function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
|
|
7903
|
-
const {
|
|
7904
|
-
observedAttributes,
|
|
7905
|
-
attributeChangedCallback
|
|
7906
|
-
} = pivotDefinition;
|
|
7907
|
-
if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
|
|
7908
|
-
// This instance does not need to observe any attributes, no need to patch
|
|
7909
|
-
return EMPTY_SET;
|
|
7910
|
-
}
|
|
7911
|
-
// Natively, the attributes observed by the registered definition are going to be taken
|
|
7912
|
-
// care of by the browser, only the difference between the two sets has to be taken
|
|
7913
|
-
// care by the patched version.
|
|
7914
|
-
return new Set([...pivotDefinition.observedAttributes].filter(x => !registeredDefinition.observedAttributes.has(x)));
|
|
7915
|
-
}
|
|
7916
|
-
function throwAsyncError(error) {
|
|
7917
|
-
// Per native custom element behavior, errors thrown in attributeChangedCallback
|
|
7918
|
-
// become unhandled async errors. We use setTimeout() instead of Promise.resolve()
|
|
7919
|
-
// to make it an unhandled error rather than an unhandled rejection.
|
|
7920
|
-
setTimeout(() => {
|
|
7921
|
-
throw error;
|
|
7922
|
-
});
|
|
7923
|
-
}
|
|
7924
|
-
// Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
|
|
7925
|
-
// Why is this necessary? Well basically, you can't change the `observedAttributes` after
|
|
7926
|
-
// a custom element is defined. So with pivots, if two classes share the same tag name,
|
|
7927
|
-
// and the second class observes attributes that aren't observed by the first one,
|
|
7928
|
-
// then those attributes can never be observed by the native `observedAttributes` system.
|
|
7929
|
-
// So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
|
|
7930
|
-
// we only do this when absolutely necessary, though; i.e. because we've determined
|
|
7931
|
-
// that we aren't observing the attributes we need to.
|
|
7932
|
-
function patchAttributes(instance, registeredDefinition, pivotDefinition) {
|
|
7933
|
-
const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
7934
|
-
if (newObservedAttributes.size === 0) {
|
|
7935
|
-
return;
|
|
7936
|
-
}
|
|
7937
|
-
const {
|
|
7938
|
-
attributeChangedCallback
|
|
7939
|
-
} = pivotDefinition;
|
|
7940
|
-
// Patch the instance.
|
|
7941
|
-
// Note we use the native `getAttribute` rather than the super's `getAttribute` because
|
|
7942
|
-
// we don't actually want it to be observable that we're calling `getAttribute` from
|
|
7943
|
-
// `setAttribute` and `removeAttribute`.
|
|
7944
|
-
// TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
|
|
7945
|
-
defineProperties(instance, {
|
|
7946
|
-
setAttribute: {
|
|
7947
|
-
value: function setAttribute(name, value) {
|
|
7948
|
-
if (newObservedAttributes.has(name)) {
|
|
7949
|
-
const old = nativeGetAttribute.call(this, name);
|
|
7950
|
-
nativeSetAttribute.call(this, name, value);
|
|
7951
|
-
try {
|
|
7952
|
-
attributeChangedCallback.call(this, name, old, value + '');
|
|
7953
|
-
} catch (error) {
|
|
7954
|
-
throwAsyncError(error);
|
|
7955
|
-
}
|
|
7956
|
-
} else {
|
|
7957
|
-
nativeSetAttribute.call(this, name, value);
|
|
7958
|
-
}
|
|
7959
|
-
},
|
|
7960
|
-
writable: true,
|
|
7961
|
-
enumerable: true,
|
|
7962
|
-
configurable: true
|
|
7963
|
-
},
|
|
7964
|
-
removeAttribute: {
|
|
7965
|
-
value: function removeAttribute(name) {
|
|
7966
|
-
if (newObservedAttributes.has(name)) {
|
|
7967
|
-
const old = nativeGetAttribute.call(this, name);
|
|
7968
|
-
nativeRemoveAttribute.call(this, name);
|
|
7969
|
-
try {
|
|
7970
|
-
attributeChangedCallback.call(this, name, old, null);
|
|
7971
|
-
} catch (error) {
|
|
7972
|
-
throwAsyncError(error);
|
|
7973
|
-
}
|
|
7974
|
-
} else {
|
|
7975
|
-
nativeRemoveAttribute.call(this, name);
|
|
7976
|
-
}
|
|
7977
|
-
},
|
|
7978
|
-
writable: true,
|
|
7979
|
-
enumerable: true,
|
|
7980
|
-
configurable: true
|
|
7981
|
-
}
|
|
7982
|
-
});
|
|
7983
|
-
}
|
|
7984
|
-
function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
7985
|
-
// The below case patches observed attributes for the case where the HTML element is upgraded
|
|
7986
|
-
// from a pre-existing one in the DOM.
|
|
7987
|
-
const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
7988
|
-
if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
|
|
7989
|
-
return;
|
|
7990
|
-
}
|
|
7991
|
-
const {
|
|
7992
|
-
attributeChangedCallback
|
|
7993
|
-
} = pivotDefinition;
|
|
7994
|
-
// Approximate observedAttributes from the user class, but only for the new observed attributes
|
|
7995
|
-
newObservedAttributes.forEach(name => {
|
|
7996
|
-
if (nativeHasAttribute.call(instance, name)) {
|
|
7997
|
-
const newValue = nativeGetAttribute.call(instance, name);
|
|
7998
|
-
attributeChangedCallback.call(instance, name, null, newValue);
|
|
7999
|
-
}
|
|
8000
|
-
});
|
|
8001
|
-
}
|
|
8002
|
-
// User extends this HTMLElement, which returns the CE being upgraded
|
|
8003
|
-
let upgradingInstance;
|
|
8004
|
-
// Helper to upgrade an instance with a CE definition using "constructor call trick"
|
|
8005
|
-
function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
8006
|
-
setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
|
|
8007
|
-
definitionForElement.set(instance, pivotDefinition);
|
|
8008
|
-
// attributes patches when needed
|
|
8009
|
-
if (pivotDefinition !== registeredDefinition) {
|
|
8010
|
-
patchAttributes(instance, registeredDefinition, pivotDefinition);
|
|
8011
|
-
}
|
|
8012
|
-
// Tricking the construction path to believe that a new instance is being created,
|
|
8013
|
-
// that way it will execute the super initialization mechanism but the HTMLElement
|
|
8014
|
-
// constructor will reuse the instance by returning the upgradingInstance.
|
|
8015
|
-
// This is by far the most important piece of the puzzle
|
|
8016
|
-
upgradingInstance = instance;
|
|
8017
|
-
// By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
|
|
8018
|
-
// The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
|
|
8019
|
-
// Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
|
|
8020
|
-
new pivotDefinition.UserCtor();
|
|
8021
|
-
patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
|
|
8022
|
-
}
|
|
8023
|
-
function isConstructor(constructor) {
|
|
8024
|
-
return isFunction$1(constructor) && isObject(constructor.prototype);
|
|
8025
|
-
}
|
|
8026
|
-
function getOrCreateDefinitionForConstructor(constructor) {
|
|
8027
|
-
if (!isConstructor(constructor)) {
|
|
8028
|
-
throw new TypeError('The referenced constructor is not a constructor.');
|
|
8029
|
-
}
|
|
8030
|
-
const definition = definitionForConstructor.get(constructor);
|
|
8031
|
-
if (!isUndefined$1(definition)) {
|
|
8032
|
-
return definition;
|
|
8033
|
-
}
|
|
8034
|
-
return createDefinitionRecord(constructor);
|
|
8035
|
-
}
|
|
8036
|
-
// Defer a `whenDefined()` callback until an externally-visible custom element is defined
|
|
8037
|
-
function createPendingWhenDefinedCallback(tagName) {
|
|
8038
|
-
return new Promise(resolve => {
|
|
8039
|
-
let resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
8040
|
-
if (isUndefined$1(resolvers)) {
|
|
8041
|
-
resolvers = [];
|
|
8042
|
-
pendingWhenDefinedCallbacks.set(tagName, resolvers);
|
|
8043
|
-
}
|
|
8044
|
-
resolvers.push(resolve);
|
|
8045
|
-
});
|
|
8046
|
-
}
|
|
8047
|
-
// Call any pending `whenDefined()` callbacks
|
|
8048
|
-
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
8049
|
-
const resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
8050
|
-
if (!isUndefined$1(resolvers)) {
|
|
8051
|
-
for (const resolver of resolvers) {
|
|
8052
|
-
resolver(ctor);
|
|
8053
|
-
}
|
|
8054
|
-
}
|
|
8055
|
-
pendingWhenDefinedCallbacks.delete(tagName);
|
|
8056
|
-
}
|
|
8057
|
-
const {
|
|
8058
|
-
customElements: nativeRegistry
|
|
8059
|
-
} = window;
|
|
8060
|
-
const {
|
|
8061
|
-
define: nativeDefine,
|
|
8062
|
-
whenDefined: nativeWhenDefined,
|
|
8063
|
-
get: nativeGet
|
|
8064
|
-
} = nativeRegistry;
|
|
8065
|
-
// patch for the global registry define mechanism
|
|
8066
|
-
CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
|
|
8067
|
-
if (options && options.extends) {
|
|
8068
|
-
// TODO [#2983]: should we support `extends`?
|
|
8069
|
-
throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
|
|
8070
|
-
}
|
|
8071
|
-
if (globalDefinitionsByTag.has(tagName)) {
|
|
8072
|
-
throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${tagName}" has already been used with this registry`);
|
|
8073
|
-
}
|
|
8074
|
-
if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
|
|
8075
|
-
throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`);
|
|
8076
|
-
}
|
|
8077
|
-
const definition = getOrCreateDefinitionForConstructor(constructor);
|
|
8078
|
-
registeredUserCtors.add(constructor);
|
|
8079
|
-
let PivotCtor = pivotCtorByTag.get(tagName);
|
|
8080
|
-
if (isUndefined$1(PivotCtor)) {
|
|
8081
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
8082
|
-
// Register a pivoting class which will handle global registry initializations
|
|
8083
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
8084
|
-
}
|
|
8085
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
8086
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
8087
|
-
definitionForConstructor.set(constructor, definition);
|
|
8088
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
8089
|
-
globalDefinitionsByTag.set(tagName, definition);
|
|
8090
|
-
globalDefinitionsByClass.set(constructor, definition);
|
|
8091
|
-
// For globally defined custom elements, the definition associated
|
|
8092
|
-
// to the UserCtor has a back-pointer to PivotCtor in case the user
|
|
8093
|
-
// new the UserCtor, so we know how to create the underlying element.
|
|
8094
|
-
definition.PivotCtor = PivotCtor;
|
|
8095
|
-
// Upgrade any elements created in this scope before customElements.define
|
|
8096
|
-
// was called, which should be exhibited by the following steps:
|
|
8097
|
-
// 1) LWC registers a tagName for an LWC component.
|
|
8098
|
-
// 2) Element with same tagName is created with document.createElement()
|
|
8099
|
-
// and inserted into DOM.
|
|
8100
|
-
// 3) customElements.define() is called with tagName and non-LWC constructor.
|
|
8101
|
-
// This requires immediate upgrade when the new global tagName is defined.
|
|
8102
|
-
const awaiting = awaitingUpgrade.get(tagName);
|
|
8103
|
-
if (!isUndefined$1(awaiting)) {
|
|
8104
|
-
awaitingUpgrade.delete(tagName);
|
|
8105
|
-
for (const element of awaiting) {
|
|
8106
|
-
const registeredDefinition = pendingRegistryForElement.get(element);
|
|
8107
|
-
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
8108
|
-
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
8109
|
-
// pendingRegistryForElement when internalUpgrade hasn't run yet.
|
|
8110
|
-
// But just to be safe, we check.
|
|
8111
|
-
if (!isUndefined$1(registeredDefinition)) {
|
|
8112
|
-
pendingRegistryForElement.delete(element);
|
|
8113
|
-
internalUpgrade(element, registeredDefinition, definition);
|
|
8114
|
-
}
|
|
8115
|
-
}
|
|
8116
|
-
}
|
|
8117
|
-
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
8118
|
-
flushPendingWhenDefinedCallbacks(tagName, constructor);
|
|
8119
|
-
};
|
|
8120
|
-
CustomElementRegistry.prototype.get = function get(tagName) {
|
|
8121
|
-
const NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
8122
|
-
if (!isUndefined$1(NativeCtor)) {
|
|
8123
|
-
const definition = globalDefinitionsByTag.get(tagName);
|
|
8124
|
-
if (!isUndefined$1(definition)) {
|
|
8125
|
-
return definition.UserCtor; // defined by the patched custom elements registry
|
|
8126
|
-
}
|
|
8127
|
-
|
|
8128
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
8129
|
-
return undefined; // pivot constructors should not be observable, return undefined
|
|
8130
|
-
}
|
|
8131
|
-
|
|
8132
|
-
return NativeCtor; // constructor that existed before patching
|
|
8133
|
-
}
|
|
8134
|
-
};
|
|
8135
|
-
|
|
8136
|
-
CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
|
|
8137
|
-
return nativeWhenDefined.call(nativeRegistry, tagName).then(NativeCtor => {
|
|
8138
|
-
const definition = globalDefinitionsByTag.get(tagName);
|
|
8139
|
-
if (!isUndefined$1(definition)) {
|
|
8140
|
-
return definition.UserCtor;
|
|
8141
|
-
}
|
|
8142
|
-
// In this case, the custom element must have been defined before the registry patches
|
|
8143
|
-
// were applied. So return the non-pivot constructor
|
|
8144
|
-
if (isUndefined$1(NativeCtor)) {
|
|
8145
|
-
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
|
|
8146
|
-
// We can patch the correct behavior using customElements.get()
|
|
8147
|
-
NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
8148
|
-
}
|
|
8149
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
8150
|
-
// Pivot constructors should not be observable. Wait to resolve the promise
|
|
8151
|
-
// if a constructor is ever defined in userland
|
|
8152
|
-
return createPendingWhenDefinedCallback(tagName);
|
|
8153
|
-
}
|
|
8154
|
-
return NativeCtor;
|
|
8155
|
-
});
|
|
8156
|
-
};
|
|
8157
|
-
// This constructor is invoked when we call `new pivotDefinition.UserCtor()`
|
|
8158
|
-
// @ts-ignore
|
|
8159
|
-
window.HTMLElement = function HTMLElement() {
|
|
8160
|
-
// Upgrading case: the pivoting class constructor was run by the browser's
|
|
8161
|
-
// native custom elements and we're in the process of running the
|
|
8162
|
-
// "constructor-call trick" on the natively constructed instance, so just
|
|
8163
|
-
// return that here.
|
|
8164
|
-
// This code path is also called when LWC `new`s a PivotCtor.
|
|
8165
|
-
const instance = upgradingInstance;
|
|
8166
|
-
if (!isUndefined$1(instance)) {
|
|
8167
|
-
upgradingInstance = undefined;
|
|
8168
|
-
return instance;
|
|
8169
|
-
}
|
|
8170
|
-
// Construction case: we need to construct the pivoting instance and return it.
|
|
8171
|
-
// This is possible when the user register it via global registry and instantiate
|
|
8172
|
-
// it via `new Ctor()`.
|
|
8173
|
-
const {
|
|
8174
|
-
constructor
|
|
8175
|
-
} = this;
|
|
8176
|
-
const definition = globalDefinitionsByClass.get(constructor);
|
|
8177
|
-
if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
|
|
8178
|
-
// This code path is hit if someone `new`s a class that extends `HTMLElement` without
|
|
8179
|
-
// doing `customElements.define()` first. This matches native browser behavior:
|
|
8180
|
-
// https://stackoverflow.com/a/61883392
|
|
8181
|
-
throw new TypeError('Illegal constructor');
|
|
8182
|
-
}
|
|
8183
|
-
// This constructor is ONLY invoked when it is the user instantiating
|
|
8184
|
-
// an element via new Ctor while Ctor is a registered global constructor.
|
|
8185
|
-
const {
|
|
8186
|
-
PivotCtor,
|
|
8187
|
-
UserCtor
|
|
8188
|
-
} = definition;
|
|
8189
|
-
return new PivotCtor(UserCtor);
|
|
8190
|
-
};
|
|
8191
|
-
HTMLElement.prototype = NativeHTMLElement.prototype;
|
|
8192
|
-
/**
|
|
8193
|
-
* Create a new PivotConstructor for the given tagName, which is capable of being constructed
|
|
8194
|
-
* with a UserConstructor defining the behavior. Passing in the UserConstructor here
|
|
8195
|
-
* is a hint that can be used when registering a custom element with the global custom elements
|
|
8196
|
-
* registry for the first time, which provides certain optimizations. It also marks the UserConstructor
|
|
8197
|
-
* as "safe" to be used when passed in to a PivotConstructor.
|
|
8198
|
-
*
|
|
8199
|
-
* @param tagName - element tag name
|
|
8200
|
-
* @param UserCtor - userland custom element constructor
|
|
8201
|
-
* @returns a new custom element constructor
|
|
8202
|
-
*/
|
|
8203
|
-
return function createPivotConstructor(tagName, UserCtor) {
|
|
8204
|
-
tagName = StringToLowerCase.call(tagName);
|
|
8205
|
-
let PivotCtor = pivotCtorByTag.get(tagName);
|
|
8206
|
-
if (isUndefined$1(PivotCtor)) {
|
|
8207
|
-
const definition = getOrCreateDefinitionForConstructor(UserCtor);
|
|
8208
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
8209
|
-
// Register a pivoting class as a global custom element
|
|
8210
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
8211
|
-
definition.PivotCtor = PivotCtor;
|
|
8212
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
8213
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
8214
|
-
definitionForConstructor.set(UserCtor, definition);
|
|
8215
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
8216
|
-
}
|
|
8217
|
-
// Register a UserConstructor as "safe" to be used within a PivotConstructor
|
|
8218
|
-
registeredUserCtors.add(UserCtor);
|
|
8219
|
-
return PivotCtor;
|
|
8220
|
-
};
|
|
8221
|
-
}
|
|
8222
|
-
|
|
8223
|
-
/*
|
|
8224
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8225
|
-
* All rights reserved.
|
|
8226
|
-
* SPDX-License-Identifier: MIT
|
|
8227
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8228
|
-
*/
|
|
8229
|
-
let createScopedConstructor;
|
|
8230
|
-
let CachedHTMLElement;
|
|
8231
|
-
// We only call `createScopedRegistry()` if the browser supports custom elements and
|
|
8232
|
-
// ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
|
|
8233
|
-
// or we're in a legacy browser.
|
|
8234
|
-
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
8235
|
-
if (hasCustomElements) {
|
|
8236
|
-
// If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
|
|
8237
|
-
// It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
|
|
8238
|
-
//
|
|
8239
|
-
// Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
|
|
8240
|
-
//
|
|
8241
|
-
// 1. LWC loads
|
|
8242
|
-
// 2. `const Ctor = class extends HTMLElement {}`
|
|
8243
|
-
// 3. `lwc.createElement(...)` // here we lazily patch
|
|
8244
|
-
// 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
|
|
8245
|
-
//
|
|
8246
|
-
// To reduce the risk of this, it's safer to patch the registry eagerly.
|
|
8247
|
-
createScopedConstructor = createScopedRegistry();
|
|
8248
|
-
// It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
|
|
8249
|
-
// another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
|
|
8250
|
-
// because the HTMLElement prototypes are mixed up.
|
|
8251
|
-
//
|
|
8252
|
-
// The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
|
|
8253
|
-
// with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
|
|
8254
|
-
// the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
|
|
8255
|
-
// Caching avoids this problem.
|
|
8256
|
-
CachedHTMLElement = window.HTMLElement;
|
|
8257
|
-
}
|
|
8258
|
-
}
|
|
8259
|
-
// Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
|
|
8260
|
-
// In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
|
|
8261
|
-
// multiple times per tag name.
|
|
8262
|
-
const createUserConstructor = (HTMLElementToExtend, upgradeCallback, connectedCallback, disconnectedCallback) => {
|
|
8263
|
-
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
8264
|
-
return class UserConstructor extends HTMLElementToExtend {
|
|
8265
|
-
constructor() {
|
|
8266
|
-
super();
|
|
8267
|
-
upgradeCallback(this);
|
|
8268
|
-
}
|
|
8269
|
-
// Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
|
|
8270
|
-
// here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
|
|
8271
|
-
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
|
8272
|
-
connectedCallback() {
|
|
8273
|
-
if (!isUndefined$1(connectedCallback)) {
|
|
8274
|
-
connectedCallback(this);
|
|
8275
|
-
}
|
|
8276
|
-
}
|
|
8277
|
-
disconnectedCallback() {
|
|
8278
|
-
if (!isUndefined$1(disconnectedCallback)) {
|
|
8279
|
-
disconnectedCallback(this);
|
|
8280
|
-
}
|
|
8281
|
-
}
|
|
8282
|
-
/*LWC compiler v2.33.0*/
|
|
8283
|
-
};
|
|
8284
|
-
};
|
|
8285
|
-
function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
8286
|
-
if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
|
|
8287
|
-
// This error should be impossible to hit
|
|
8288
|
-
throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
|
|
8289
|
-
}
|
|
8290
|
-
const UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
8291
|
-
const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
|
|
8292
|
-
return new ScopedConstructor(UserConstructor);
|
|
8293
|
-
}
|
|
8294
|
-
|
|
8295
8191
|
/*
|
|
8296
8192
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
8297
8193
|
* All rights reserved.
|
|
@@ -8299,26 +8195,18 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8299
8195
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8300
8196
|
*/
|
|
8301
8197
|
/**
|
|
8302
|
-
* We have
|
|
8198
|
+
* We have two modes for creating custom elements:
|
|
8303
8199
|
*
|
|
8304
8200
|
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
8305
|
-
* 2. "
|
|
8306
|
-
*
|
|
8307
|
-
*
|
|
8308
|
-
* constructor, which allows us to have completely customized functionality for different components.
|
|
8309
|
-
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
8310
|
-
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
8311
|
-
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
8312
|
-
* because it must patch the global `customElements` and `HTMLElement` objects.
|
|
8201
|
+
* 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
|
|
8202
|
+
* via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
|
|
8203
|
+
* a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
|
|
8204
|
+
* constructor"), which allows us to have completely customized functionality for different components.
|
|
8313
8205
|
*/
|
|
8314
8206
|
let createCustomElement;
|
|
8315
8207
|
if (hasCustomElements) {
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
} else {
|
|
8319
|
-
// use global custom elements registry (vanilla)
|
|
8320
|
-
createCustomElement = createCustomElementVanilla;
|
|
8321
|
-
}
|
|
8208
|
+
// use the global registry, with an upgradable constructor for the defined custom element
|
|
8209
|
+
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
8322
8210
|
} else {
|
|
8323
8211
|
// no registry available here
|
|
8324
8212
|
createCustomElement = createCustomElementCompat;
|
|
@@ -8371,10 +8259,10 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8371
8259
|
}
|
|
8372
8260
|
var assert = /*#__PURE__*/Object.freeze({
|
|
8373
8261
|
__proto__: null,
|
|
8262
|
+
fail: fail,
|
|
8374
8263
|
invariant: invariant,
|
|
8375
|
-
isTrue: isTrue$1,
|
|
8376
8264
|
isFalse: isFalse$1,
|
|
8377
|
-
|
|
8265
|
+
isTrue: isTrue$1
|
|
8378
8266
|
});
|
|
8379
8267
|
function isUndefined(obj) {
|
|
8380
8268
|
return obj === undefined;
|
|
@@ -8382,7 +8270,44 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8382
8270
|
function isNull(obj) {
|
|
8383
8271
|
return obj === null;
|
|
8384
8272
|
}
|
|
8385
|
-
/** version: 2.
|
|
8273
|
+
/** version: 2.38.1 */
|
|
8274
|
+
|
|
8275
|
+
/*
|
|
8276
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
8277
|
+
* All rights reserved.
|
|
8278
|
+
* SPDX-License-Identifier: MIT
|
|
8279
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8280
|
+
*/
|
|
8281
|
+
class WireContextSubscriptionEvent extends CustomEvent {
|
|
8282
|
+
constructor(adapterToken, {
|
|
8283
|
+
setNewContext,
|
|
8284
|
+
setDisconnectedCallback
|
|
8285
|
+
}) {
|
|
8286
|
+
super(adapterToken, {
|
|
8287
|
+
bubbles: true,
|
|
8288
|
+
composed: true
|
|
8289
|
+
});
|
|
8290
|
+
this.setNewContext = setNewContext;
|
|
8291
|
+
this.setDisconnectedCallback = setDisconnectedCallback;
|
|
8292
|
+
}
|
|
8293
|
+
/*LWC compiler v2.38.1*/
|
|
8294
|
+
}
|
|
8295
|
+
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
|
8296
|
+
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
|
8297
|
+
}
|
|
8298
|
+
function registerContextProvider(elm, adapterContextToken, onContextSubscription) {
|
|
8299
|
+
addEventListener(elm, adapterContextToken, evt => {
|
|
8300
|
+
evt.stopImmediatePropagation();
|
|
8301
|
+
const {
|
|
8302
|
+
setNewContext,
|
|
8303
|
+
setDisconnectedCallback
|
|
8304
|
+
} = evt;
|
|
8305
|
+
onContextSubscription({
|
|
8306
|
+
setNewContext,
|
|
8307
|
+
setDisconnectedCallback
|
|
8308
|
+
});
|
|
8309
|
+
});
|
|
8310
|
+
}
|
|
8386
8311
|
|
|
8387
8312
|
/*
|
|
8388
8313
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8555,6 +8480,9 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8555
8480
|
function assertInstanceOfHTMLElement(elm, msg) {
|
|
8556
8481
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
8557
8482
|
}
|
|
8483
|
+
function ownerDocument(element) {
|
|
8484
|
+
return element.ownerDocument;
|
|
8485
|
+
}
|
|
8558
8486
|
exports.addEventListener = addEventListener;
|
|
8559
8487
|
exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
|
|
8560
8488
|
exports.attachShadow = attachShadow;
|
|
@@ -8578,8 +8506,11 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8578
8506
|
exports.insert = insert;
|
|
8579
8507
|
exports.isConnected = isConnected;
|
|
8580
8508
|
exports.nextSibling = nextSibling;
|
|
8509
|
+
exports.ownerDocument = ownerDocument;
|
|
8581
8510
|
exports.querySelector = querySelector;
|
|
8582
8511
|
exports.querySelectorAll = querySelectorAll;
|
|
8512
|
+
exports.registerContextConsumer = registerContextConsumer;
|
|
8513
|
+
exports.registerContextProvider = registerContextProvider;
|
|
8583
8514
|
exports.remove = remove;
|
|
8584
8515
|
exports.removeAttribute = removeAttribute;
|
|
8585
8516
|
exports.removeEventListener = removeEventListener;
|
|
@@ -8749,7 +8680,7 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8749
8680
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
8750
8681
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
|
8751
8682
|
}
|
|
8752
|
-
/*LWC compiler v2.
|
|
8683
|
+
/*LWC compiler v2.38.1*/
|
|
8753
8684
|
}, _a.observedAttributes = observedAttributes, _a;
|
|
8754
8685
|
}
|
|
8755
8686
|
|
|
@@ -8930,10 +8861,44 @@ LWR.define('lwc/v/2_33_0', ['exports'], function (exports) { 'use strict';
|
|
|
8930
8861
|
});
|
|
8931
8862
|
freeze(LightningElement);
|
|
8932
8863
|
seal(LightningElement.prototype);
|
|
8933
|
-
|
|
8864
|
+
|
|
8865
|
+
/*
|
|
8866
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8867
|
+
* All rights reserved.
|
|
8868
|
+
* SPDX-License-Identifier: MIT
|
|
8869
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8870
|
+
*/
|
|
8871
|
+
function addEventListener(target, type, callback, options) {
|
|
8872
|
+
target.addEventListener(type, callback, options);
|
|
8873
|
+
}
|
|
8874
|
+
|
|
8875
|
+
/*
|
|
8876
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
8877
|
+
* All rights reserved.
|
|
8878
|
+
* SPDX-License-Identifier: MIT
|
|
8879
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8880
|
+
*/
|
|
8881
|
+
function createContextProvider(adapter) {
|
|
8882
|
+
return createContextProviderWithRegister(adapter, registerContextProvider);
|
|
8883
|
+
}
|
|
8884
|
+
function registerContextProvider(elm, adapterContextToken, onContextSubscription) {
|
|
8885
|
+
addEventListener(elm, adapterContextToken, evt => {
|
|
8886
|
+
evt.stopImmediatePropagation();
|
|
8887
|
+
const {
|
|
8888
|
+
setNewContext,
|
|
8889
|
+
setDisconnectedCallback
|
|
8890
|
+
} = evt;
|
|
8891
|
+
onContextSubscription({
|
|
8892
|
+
setNewContext,
|
|
8893
|
+
setDisconnectedCallback
|
|
8894
|
+
});
|
|
8895
|
+
});
|
|
8896
|
+
}
|
|
8897
|
+
/* version: 2.38.1 */
|
|
8934
8898
|
|
|
8935
8899
|
exports.LightningElement = LightningElement;
|
|
8936
8900
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
8901
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
8937
8902
|
exports.api = api$1;
|
|
8938
8903
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
8939
8904
|
exports.createContextProvider = createContextProvider;
|