lwc 2.34.0 → 2.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +939 -763
- package/dist/engine-dom/iife/es2017/engine-dom.js +939 -762
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +846 -684
- package/dist/engine-dom/iife/es5/engine-dom.js +1115 -922
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +801 -619
- package/dist/engine-dom/umd/es2017/engine-dom.js +939 -762
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +846 -684
- package/dist/engine-dom/umd/es5/engine-dom.js +1115 -922
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +801 -619
- package/dist/engine-server/commonjs/es2017/engine-server.js +1025 -1082
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +1025 -1082
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +20 -39
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +24 -38
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +23 -36
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +20 -39
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +24 -38
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +23 -36
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -48,7 +48,7 @@ var LWC = (function (exports) {
|
|
|
48
48
|
const { isArray: isArray$1 } = Array;
|
|
49
49
|
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
50
50
|
const { fromCharCode: StringFromCharCode } = String;
|
|
51
|
-
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
51
|
+
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
52
52
|
function isUndefined$1(obj) {
|
|
53
53
|
return obj === undefined;
|
|
54
54
|
}
|
|
@@ -182,6 +182,19 @@ var LWC = (function (exports) {
|
|
|
182
182
|
});
|
|
183
183
|
return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
|
|
184
184
|
})();
|
|
185
|
+
// These attributes take either an ID or a list of IDs as values.
|
|
186
|
+
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
|
187
|
+
const ID_REFERENCING_ATTRIBUTES_SET = new Set([
|
|
188
|
+
'aria-activedescendant',
|
|
189
|
+
'aria-controls',
|
|
190
|
+
'aria-describedby',
|
|
191
|
+
'aria-details',
|
|
192
|
+
'aria-errormessage',
|
|
193
|
+
'aria-flowto',
|
|
194
|
+
'aria-labelledby',
|
|
195
|
+
'aria-owns',
|
|
196
|
+
'for',
|
|
197
|
+
]);
|
|
185
198
|
|
|
186
199
|
/*
|
|
187
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -189,41 +202,11 @@ var LWC = (function (exports) {
|
|
|
189
202
|
* SPDX-License-Identifier: MIT
|
|
190
203
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
191
204
|
*/
|
|
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
|
-
}
|
|
214
|
-
catch (ex) {
|
|
215
|
-
// In IE8, Object.defineProperty only works on DOM objects.
|
|
216
|
-
}
|
|
217
|
-
finally {
|
|
218
|
-
// If the magic above fails for some reason we assume that we are in a legacy browser.
|
|
219
|
-
// Assume `window` exists in this case.
|
|
220
|
-
if (typeof _globalThis === 'undefined') {
|
|
221
|
-
// @ts-ignore
|
|
222
|
-
_globalThis = window;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return _globalThis;
|
|
226
|
-
})();
|
|
205
|
+
// See browser support for globalThis:
|
|
206
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
|
207
|
+
/* istanbul ignore next */
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
const _globalThis = typeof globalThis === 'object' ? globalThis : window;
|
|
227
210
|
|
|
228
211
|
/*
|
|
229
212
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -237,6 +220,8 @@ var LWC = (function (exports) {
|
|
|
237
220
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
238
221
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
239
222
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
223
|
+
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
224
|
+
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
240
225
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
241
226
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
242
227
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -336,7 +321,7 @@ var LWC = (function (exports) {
|
|
|
336
321
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
337
322
|
return propertyName;
|
|
338
323
|
}
|
|
339
|
-
/** version: 2.
|
|
324
|
+
/** version: 2.35.1 */
|
|
340
325
|
|
|
341
326
|
/**
|
|
342
327
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -386,6 +371,7 @@ var LWC = (function (exports) {
|
|
|
386
371
|
console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
|
|
387
372
|
return;
|
|
388
373
|
}
|
|
374
|
+
// This may seem redundant, but `"production" === 'test-karma-lwc'` is replaced by Karma tests
|
|
389
375
|
{
|
|
390
376
|
// Disallow the same flag to be set more than once in production
|
|
391
377
|
const runtimeValue = lwcRuntimeFlags[name];
|
|
@@ -403,7 +389,7 @@ var LWC = (function (exports) {
|
|
|
403
389
|
*/
|
|
404
390
|
function setFeatureFlagForTest(name, value) {
|
|
405
391
|
}
|
|
406
|
-
/** version: 2.
|
|
392
|
+
/** version: 2.35.1 */
|
|
407
393
|
|
|
408
394
|
/**
|
|
409
395
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -467,7 +453,7 @@ var LWC = (function (exports) {
|
|
|
467
453
|
}
|
|
468
454
|
}
|
|
469
455
|
}
|
|
470
|
-
/** version: 2.
|
|
456
|
+
/** version: 2.35.1 */
|
|
471
457
|
|
|
472
458
|
/*
|
|
473
459
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -487,81 +473,148 @@ var LWC = (function (exports) {
|
|
|
487
473
|
* SPDX-License-Identifier: MIT
|
|
488
474
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
489
475
|
*/
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
476
|
+
/** Callbacks to invoke when reporting is enabled **/
|
|
477
|
+
const onReportingEnabledCallbacks = [];
|
|
478
|
+
/** The currently assigned reporting dispatcher. */
|
|
479
|
+
let currentDispatcher$1 = noop;
|
|
480
|
+
/**
|
|
481
|
+
* Whether reporting is enabled.
|
|
482
|
+
*
|
|
483
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
484
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
485
|
+
*/
|
|
486
|
+
let enabled$1 = false;
|
|
487
|
+
const reportingControl = {
|
|
488
|
+
/**
|
|
489
|
+
* Attach a new reporting control (aka dispatcher).
|
|
490
|
+
*
|
|
491
|
+
* @param dispatcher - reporting control
|
|
492
|
+
*/
|
|
493
|
+
attachDispatcher(dispatcher) {
|
|
494
|
+
enabled$1 = true;
|
|
495
|
+
currentDispatcher$1 = dispatcher;
|
|
496
|
+
for (const callback of onReportingEnabledCallbacks) {
|
|
497
|
+
try {
|
|
498
|
+
callback();
|
|
499
|
+
}
|
|
500
|
+
catch (err) {
|
|
501
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
502
|
+
// eslint-disable-next-line no-console
|
|
503
|
+
console.error('Could not invoke callback', err);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
507
|
+
},
|
|
508
|
+
/**
|
|
509
|
+
* Detach the current reporting control (aka dispatcher).
|
|
510
|
+
*/
|
|
511
|
+
detachDispatcher() {
|
|
512
|
+
enabled$1 = false;
|
|
513
|
+
currentDispatcher$1 = noop;
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
517
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
518
|
+
* Will only ever be called once.
|
|
519
|
+
* @param callback
|
|
520
|
+
*/
|
|
521
|
+
function onReportingEnabled(callback) {
|
|
522
|
+
if (enabled$1) {
|
|
523
|
+
// call immediately
|
|
524
|
+
callback();
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
// call later
|
|
528
|
+
onReportingEnabledCallbacks.push(callback);
|
|
499
529
|
}
|
|
500
530
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
531
|
+
/**
|
|
532
|
+
* Report to the current dispatcher, if there is one.
|
|
533
|
+
* @param reportingEventId
|
|
534
|
+
* @param vm
|
|
535
|
+
*/
|
|
536
|
+
function report(reportingEventId, vm) {
|
|
537
|
+
if (enabled$1) {
|
|
538
|
+
currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
|
|
504
539
|
}
|
|
505
|
-
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
506
540
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
541
|
+
|
|
542
|
+
/*
|
|
543
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
544
|
+
* All rights reserved.
|
|
545
|
+
* SPDX-License-Identifier: MIT
|
|
546
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
547
|
+
*/
|
|
548
|
+
function getComponentTag(vm) {
|
|
549
|
+
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
550
|
+
}
|
|
551
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
552
|
+
function getComponentStack(vm) {
|
|
553
|
+
const stack = [];
|
|
554
|
+
let prefix = '';
|
|
555
|
+
while (!isNull(vm.owner)) {
|
|
556
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
557
|
+
vm = vm.owner;
|
|
558
|
+
prefix += '\t';
|
|
512
559
|
}
|
|
513
|
-
return
|
|
560
|
+
return ArrayJoin.call(stack, '\n');
|
|
514
561
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
522
|
-
for (const declaration of declarations) {
|
|
523
|
-
if (declaration) {
|
|
524
|
-
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
525
|
-
if (prop !== undefined && value !== undefined) {
|
|
526
|
-
styleMap[prop.trim()] = value.trim();
|
|
527
|
-
}
|
|
528
|
-
}
|
|
562
|
+
function getErrorComponentStack(vm) {
|
|
563
|
+
const wcStack = [];
|
|
564
|
+
let currentVm = vm;
|
|
565
|
+
while (!isNull(currentVm)) {
|
|
566
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
567
|
+
currentVm = currentVm.owner;
|
|
529
568
|
}
|
|
530
|
-
return
|
|
569
|
+
return wcStack.reverse().join('\n\t');
|
|
531
570
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
571
|
+
|
|
572
|
+
/*
|
|
573
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
574
|
+
* All rights reserved.
|
|
575
|
+
* SPDX-License-Identifier: MIT
|
|
576
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
577
|
+
*/
|
|
578
|
+
function addErrorComponentStack(vm, error) {
|
|
579
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
580
|
+
const wcStack = getErrorComponentStack(vm);
|
|
581
|
+
defineProperty(error, 'wcStack', {
|
|
582
|
+
get() {
|
|
583
|
+
return wcStack;
|
|
584
|
+
},
|
|
585
|
+
});
|
|
539
586
|
}
|
|
540
|
-
return result;
|
|
541
587
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
588
|
+
|
|
589
|
+
/*
|
|
590
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
591
|
+
* All rights reserved.
|
|
592
|
+
* SPDX-License-Identifier: MIT
|
|
593
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
594
|
+
*/
|
|
595
|
+
const alreadyLoggedMessages = new Set();
|
|
596
|
+
function log(method, message, vm, once) {
|
|
597
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
598
|
+
if (!isUndefined$1(vm)) {
|
|
599
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
600
|
+
}
|
|
601
|
+
if (once) {
|
|
602
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
603
|
+
return;
|
|
550
604
|
}
|
|
605
|
+
alreadyLoggedMessages.add(msg);
|
|
551
606
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const refVNodes = vm.refVNodes;
|
|
559
|
-
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
560
|
-
// in depth-first traversal order.
|
|
561
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
562
|
-
refVNodes[ref] = vnode;
|
|
607
|
+
try {
|
|
608
|
+
throw new Error(msg);
|
|
609
|
+
}
|
|
610
|
+
catch (e) {
|
|
611
|
+
/* eslint-disable-next-line no-console */
|
|
612
|
+
console[method](e);
|
|
563
613
|
}
|
|
564
614
|
}
|
|
615
|
+
function logError(message, vm) {
|
|
616
|
+
log('error', message, vm, false);
|
|
617
|
+
}
|
|
565
618
|
|
|
566
619
|
/*
|
|
567
620
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -683,72 +736,92 @@ var LWC = (function (exports) {
|
|
|
683
736
|
* SPDX-License-Identifier: MIT
|
|
684
737
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
685
738
|
*/
|
|
686
|
-
|
|
687
|
-
|
|
739
|
+
let nextTickCallbackQueue = [];
|
|
740
|
+
const SPACE_CHAR = 32;
|
|
741
|
+
const EmptyObject = seal(create(null));
|
|
742
|
+
const EmptyArray = seal([]);
|
|
743
|
+
function flushCallbackQueue() {
|
|
744
|
+
const callbacks = nextTickCallbackQueue;
|
|
745
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
746
|
+
for (let i = 0, len = callbacks.length; i < len; i += 1) {
|
|
747
|
+
callbacks[i]();
|
|
748
|
+
}
|
|
688
749
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
let prefix = '';
|
|
693
|
-
while (!isNull(vm.owner)) {
|
|
694
|
-
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
695
|
-
vm = vm.owner;
|
|
696
|
-
prefix += '\t';
|
|
750
|
+
function addCallbackToNextTick(callback) {
|
|
751
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
752
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
697
753
|
}
|
|
698
|
-
|
|
754
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
699
755
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
756
|
+
function guid() {
|
|
757
|
+
function s4() {
|
|
758
|
+
return Math.floor((1 + Math.random()) * 0x10000)
|
|
759
|
+
.toString(16)
|
|
760
|
+
.substring(1);
|
|
761
|
+
}
|
|
762
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
763
|
+
}
|
|
764
|
+
// Borrowed from Vue template compiler.
|
|
765
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
766
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
767
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
768
|
+
function parseStyleText(cssText) {
|
|
769
|
+
const styleMap = {};
|
|
770
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
771
|
+
for (const declaration of declarations) {
|
|
772
|
+
if (declaration) {
|
|
773
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
774
|
+
if (prop !== undefined && value !== undefined) {
|
|
775
|
+
styleMap[prop.trim()] = value.trim();
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return styleMap;
|
|
780
|
+
}
|
|
781
|
+
// Make a shallow copy of an object but omit the given key
|
|
782
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
783
|
+
const result = {};
|
|
784
|
+
for (const key of Object.keys(object)) {
|
|
785
|
+
if (key !== keyToOmit) {
|
|
786
|
+
result[key] = object[key];
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return result;
|
|
790
|
+
}
|
|
791
|
+
function flattenStylesheets(stylesheets) {
|
|
792
|
+
const list = [];
|
|
793
|
+
for (const stylesheet of stylesheets) {
|
|
794
|
+
if (!Array.isArray(stylesheet)) {
|
|
795
|
+
list.push(stylesheet);
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return list;
|
|
802
|
+
}
|
|
803
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
804
|
+
function setRefVNode(vm, ref, vnode) {
|
|
805
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
806
|
+
// If not, then something went wrong and we threw an error above.
|
|
807
|
+
const refVNodes = vm.refVNodes;
|
|
808
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
809
|
+
// in depth-first traversal order.
|
|
810
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
811
|
+
refVNodes[ref] = vnode;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
815
|
+
function assertNotProd() {
|
|
816
|
+
/* istanbul ignore if */
|
|
817
|
+
{
|
|
818
|
+
// this method should never leak to prod
|
|
819
|
+
throw new ReferenceError();
|
|
706
820
|
}
|
|
707
|
-
return wcStack.reverse().join('\n\t');
|
|
708
821
|
}
|
|
709
822
|
|
|
710
823
|
/*
|
|
711
|
-
* Copyright (c)
|
|
712
|
-
* All rights reserved.
|
|
713
|
-
* SPDX-License-Identifier: MIT
|
|
714
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
715
|
-
*/
|
|
716
|
-
function addErrorComponentStack(vm, error) {
|
|
717
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
718
|
-
const wcStack = getErrorComponentStack(vm);
|
|
719
|
-
defineProperty(error, 'wcStack', {
|
|
720
|
-
get() {
|
|
721
|
-
return wcStack;
|
|
722
|
-
},
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/*
|
|
728
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
729
|
-
* All rights reserved.
|
|
730
|
-
* SPDX-License-Identifier: MIT
|
|
731
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
732
|
-
*/
|
|
733
|
-
function log(method, message, vm) {
|
|
734
|
-
let msg = `[LWC ${method}]: ${message}`;
|
|
735
|
-
if (!isUndefined$1(vm)) {
|
|
736
|
-
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
737
|
-
}
|
|
738
|
-
try {
|
|
739
|
-
throw new Error(msg);
|
|
740
|
-
}
|
|
741
|
-
catch (e) {
|
|
742
|
-
/* eslint-disable-next-line no-console */
|
|
743
|
-
console[method](e);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
function logError(message, vm) {
|
|
747
|
-
log('error', message, vm);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/*
|
|
751
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
824
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
752
825
|
* All rights reserved.
|
|
753
826
|
* SPDX-License-Identifier: MIT
|
|
754
827
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -790,101 +863,6 @@ var LWC = (function (exports) {
|
|
|
790
863
|
'tabIndex',
|
|
791
864
|
'title',
|
|
792
865
|
];
|
|
793
|
-
function offsetPropertyErrorMessage(name) {
|
|
794
|
-
return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
|
|
795
|
-
}
|
|
796
|
-
// Global HTML Attributes & Properties
|
|
797
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
798
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
799
|
-
//
|
|
800
|
-
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
801
|
-
// for e.g. "dropzone" should suffice.
|
|
802
|
-
assign(create(null), {
|
|
803
|
-
accessKey: {
|
|
804
|
-
attribute: 'accesskey',
|
|
805
|
-
},
|
|
806
|
-
accessKeyLabel: {
|
|
807
|
-
readOnly: true,
|
|
808
|
-
},
|
|
809
|
-
className: {
|
|
810
|
-
attribute: 'class',
|
|
811
|
-
error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.',
|
|
812
|
-
},
|
|
813
|
-
contentEditable: {
|
|
814
|
-
attribute: 'contenteditable',
|
|
815
|
-
},
|
|
816
|
-
dataset: {
|
|
817
|
-
readOnly: true,
|
|
818
|
-
error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.",
|
|
819
|
-
},
|
|
820
|
-
dir: {
|
|
821
|
-
attribute: 'dir',
|
|
822
|
-
},
|
|
823
|
-
draggable: {
|
|
824
|
-
attribute: 'draggable',
|
|
825
|
-
},
|
|
826
|
-
dropzone: {
|
|
827
|
-
attribute: 'dropzone',
|
|
828
|
-
readOnly: true,
|
|
829
|
-
},
|
|
830
|
-
hidden: {
|
|
831
|
-
attribute: 'hidden',
|
|
832
|
-
},
|
|
833
|
-
id: {
|
|
834
|
-
attribute: 'id',
|
|
835
|
-
},
|
|
836
|
-
inputMode: {
|
|
837
|
-
attribute: 'inputmode',
|
|
838
|
-
},
|
|
839
|
-
lang: {
|
|
840
|
-
attribute: 'lang',
|
|
841
|
-
},
|
|
842
|
-
slot: {
|
|
843
|
-
attribute: 'slot',
|
|
844
|
-
error: 'Using the `slot` property is an anti-pattern.',
|
|
845
|
-
},
|
|
846
|
-
spellcheck: {
|
|
847
|
-
attribute: 'spellcheck',
|
|
848
|
-
},
|
|
849
|
-
style: {
|
|
850
|
-
attribute: 'style',
|
|
851
|
-
},
|
|
852
|
-
tabIndex: {
|
|
853
|
-
attribute: 'tabindex',
|
|
854
|
-
},
|
|
855
|
-
title: {
|
|
856
|
-
attribute: 'title',
|
|
857
|
-
},
|
|
858
|
-
translate: {
|
|
859
|
-
attribute: 'translate',
|
|
860
|
-
},
|
|
861
|
-
// additional "global attributes" that are not present in the link above.
|
|
862
|
-
isContentEditable: {
|
|
863
|
-
readOnly: true,
|
|
864
|
-
},
|
|
865
|
-
offsetHeight: {
|
|
866
|
-
readOnly: true,
|
|
867
|
-
error: offsetPropertyErrorMessage('offsetHeight'),
|
|
868
|
-
},
|
|
869
|
-
offsetLeft: {
|
|
870
|
-
readOnly: true,
|
|
871
|
-
error: offsetPropertyErrorMessage('offsetLeft'),
|
|
872
|
-
},
|
|
873
|
-
offsetParent: {
|
|
874
|
-
readOnly: true,
|
|
875
|
-
},
|
|
876
|
-
offsetTop: {
|
|
877
|
-
readOnly: true,
|
|
878
|
-
error: offsetPropertyErrorMessage('offsetTop'),
|
|
879
|
-
},
|
|
880
|
-
offsetWidth: {
|
|
881
|
-
readOnly: true,
|
|
882
|
-
error: offsetPropertyErrorMessage('offsetWidth'),
|
|
883
|
-
},
|
|
884
|
-
role: {
|
|
885
|
-
attribute: 'role',
|
|
886
|
-
},
|
|
887
|
-
});
|
|
888
866
|
let controlledElement = null;
|
|
889
867
|
let controlledAttributeName;
|
|
890
868
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1431,7 +1409,6 @@ var LWC = (function (exports) {
|
|
|
1431
1409
|
}
|
|
1432
1410
|
};
|
|
1433
1411
|
}
|
|
1434
|
-
const EMPTY_REFS = freeze(create(null));
|
|
1435
1412
|
const refsCache = new WeakMap();
|
|
1436
1413
|
/**
|
|
1437
1414
|
* This class is the base class for any LWC element.
|
|
@@ -1669,22 +1646,15 @@ var LWC = (function (exports) {
|
|
|
1669
1646
|
}
|
|
1670
1647
|
const {
|
|
1671
1648
|
refVNodes,
|
|
1672
|
-
hasRefVNodes,
|
|
1673
1649
|
cmpTemplate
|
|
1674
1650
|
} = vm;
|
|
1675
1651
|
// For backwards compatibility with component written before template refs
|
|
1676
1652
|
// were introduced, we return undefined if the template has no refs defined
|
|
1677
1653
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1678
1654
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1679
|
-
// Note
|
|
1680
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1681
|
-
if (!hasRefVNodes) {
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1685
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1655
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
1686
1656
|
if (isNull(refVNodes)) {
|
|
1687
|
-
return
|
|
1657
|
+
return;
|
|
1688
1658
|
}
|
|
1689
1659
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1690
1660
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -1818,107 +1788,371 @@ var LWC = (function (exports) {
|
|
|
1818
1788
|
* SPDX-License-Identifier: MIT
|
|
1819
1789
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1820
1790
|
*/
|
|
1821
|
-
|
|
1822
|
-
|
|
1791
|
+
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
1792
|
+
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
1793
|
+
const WireMetaMap = new Map();
|
|
1794
|
+
class WireContextRegistrationEvent extends CustomEvent {
|
|
1795
|
+
constructor(adapterToken, {
|
|
1796
|
+
setNewContext,
|
|
1797
|
+
setDisconnectedCallback
|
|
1798
|
+
}) {
|
|
1799
|
+
super(adapterToken, {
|
|
1800
|
+
bubbles: true,
|
|
1801
|
+
composed: true
|
|
1802
|
+
});
|
|
1803
|
+
defineProperties(this, {
|
|
1804
|
+
setNewContext: {
|
|
1805
|
+
value: setNewContext
|
|
1806
|
+
},
|
|
1807
|
+
setDisconnectedCallback: {
|
|
1808
|
+
value: setDisconnectedCallback
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1823
1812
|
}
|
|
1824
|
-
function
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
if (isBeingConstructed(vm)) {
|
|
1829
|
-
return;
|
|
1830
|
-
}
|
|
1831
|
-
componentValueObserved(vm, key);
|
|
1832
|
-
return vm.cmpProps[key];
|
|
1833
|
-
},
|
|
1834
|
-
set(newValue) {
|
|
1835
|
-
const vm = getAssociatedVM(this);
|
|
1836
|
-
vm.cmpProps[key] = newValue;
|
|
1837
|
-
componentValueMutated(vm, key);
|
|
1838
|
-
},
|
|
1839
|
-
enumerable: true,
|
|
1840
|
-
configurable: true,
|
|
1841
|
-
};
|
|
1813
|
+
function createFieldDataCallback(vm, name) {
|
|
1814
|
+
return value => {
|
|
1815
|
+
updateComponentValue(vm, name, value);
|
|
1816
|
+
};
|
|
1842
1817
|
}
|
|
1843
|
-
function
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
},
|
|
1852
|
-
set(newValue) {
|
|
1853
|
-
getAssociatedVM(this);
|
|
1854
|
-
if (set) {
|
|
1855
|
-
set.call(this, newValue);
|
|
1856
|
-
}
|
|
1857
|
-
},
|
|
1858
|
-
enumerable,
|
|
1859
|
-
configurable,
|
|
1860
|
-
};
|
|
1818
|
+
function createMethodDataCallback(vm, method) {
|
|
1819
|
+
return value => {
|
|
1820
|
+
// dispatching new value into the wired method
|
|
1821
|
+
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
1822
|
+
// job
|
|
1823
|
+
method.call(vm.component, value);
|
|
1824
|
+
}, noop);
|
|
1825
|
+
};
|
|
1861
1826
|
}
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1827
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
1828
|
+
let hasPendingConfig = false;
|
|
1829
|
+
// creating the reactive observer for reactive params when needed
|
|
1830
|
+
const ro = createReactiveObserver(() => {
|
|
1831
|
+
if (hasPendingConfig === false) {
|
|
1832
|
+
hasPendingConfig = true;
|
|
1833
|
+
// collect new config in the micro-task
|
|
1834
|
+
Promise.resolve().then(() => {
|
|
1835
|
+
hasPendingConfig = false;
|
|
1836
|
+
// resetting current reactive params
|
|
1837
|
+
ro.reset();
|
|
1838
|
+
// dispatching a new config due to a change in the configuration
|
|
1839
|
+
computeConfigAndUpdate();
|
|
1840
|
+
});
|
|
1872
1841
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
},
|
|
1887
|
-
enumerable: true,
|
|
1888
|
-
configurable: true,
|
|
1889
|
-
};
|
|
1842
|
+
});
|
|
1843
|
+
const computeConfigAndUpdate = () => {
|
|
1844
|
+
let config;
|
|
1845
|
+
ro.observe(() => config = configCallback(component));
|
|
1846
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1847
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
1848
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
1849
|
+
callbackWhenConfigIsReady(config);
|
|
1850
|
+
};
|
|
1851
|
+
return {
|
|
1852
|
+
computeConfigAndUpdate,
|
|
1853
|
+
ro
|
|
1854
|
+
};
|
|
1890
1855
|
}
|
|
1856
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
1857
|
+
const {
|
|
1858
|
+
adapter
|
|
1859
|
+
} = wireDef;
|
|
1860
|
+
const adapterContextToken = getAdapterToken(adapter);
|
|
1861
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
1862
|
+
return; // no provider found, nothing to be done
|
|
1863
|
+
}
|
|
1891
1864
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1865
|
+
const {
|
|
1866
|
+
elm,
|
|
1867
|
+
context: {
|
|
1868
|
+
wiredConnecting,
|
|
1869
|
+
wiredDisconnecting
|
|
1870
|
+
},
|
|
1871
|
+
renderer: {
|
|
1872
|
+
dispatchEvent
|
|
1873
|
+
}
|
|
1874
|
+
} = vm;
|
|
1875
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
1876
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
1877
|
+
// This event is responsible for connecting the host element with another
|
|
1878
|
+
// element in the composed path that is providing contextual data. The provider
|
|
1879
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
1880
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
1881
|
+
// guarantee that the linkage can be forged.
|
|
1882
|
+
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
1883
|
+
setNewContext(newContext) {
|
|
1884
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1885
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
1886
|
+
callbackWhenContextIsReady(newContext);
|
|
1887
|
+
},
|
|
1888
|
+
setDisconnectedCallback(disconnectCallback) {
|
|
1889
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
1890
|
+
// the the element hosting the wire is disconnected
|
|
1891
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
1895
|
+
});
|
|
1905
1896
|
}
|
|
1906
|
-
function
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1897
|
+
function createConnector(vm, name, wireDef) {
|
|
1898
|
+
const {
|
|
1899
|
+
method,
|
|
1900
|
+
adapter,
|
|
1901
|
+
configCallback,
|
|
1902
|
+
dynamic
|
|
1903
|
+
} = wireDef;
|
|
1904
|
+
let debugInfo;
|
|
1905
|
+
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
1906
|
+
const dataCallback = value => {
|
|
1907
|
+
fieldOrMethodCallback(value);
|
|
1908
|
+
};
|
|
1909
|
+
let context;
|
|
1910
|
+
let connector;
|
|
1911
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
1912
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
1913
|
+
value: vm.elm
|
|
1914
|
+
});
|
|
1915
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
1916
|
+
value: dynamic
|
|
1917
|
+
});
|
|
1918
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
1919
|
+
// job
|
|
1920
|
+
connector = new adapter(dataCallback);
|
|
1921
|
+
}, noop);
|
|
1922
|
+
const updateConnectorConfig = config => {
|
|
1923
|
+
// every time the config is recomputed due to tracking,
|
|
1924
|
+
// this callback will be invoked with the new computed config
|
|
1925
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
1926
|
+
// job
|
|
1927
|
+
if ("production" !== 'production') ;
|
|
1928
|
+
connector.update(config, context);
|
|
1929
|
+
}, noop);
|
|
1930
|
+
};
|
|
1931
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
1932
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
1933
|
+
const {
|
|
1934
|
+
computeConfigAndUpdate,
|
|
1935
|
+
ro
|
|
1936
|
+
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
1937
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
1938
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
1939
|
+
createContextWatcher(vm, wireDef, newContext => {
|
|
1940
|
+
// every time the context is pushed into this component,
|
|
1941
|
+
// this callback will be invoked with the new computed context
|
|
1942
|
+
if (context !== newContext) {
|
|
1943
|
+
context = newContext;
|
|
1944
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
1945
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
1946
|
+
// (ever), while context can have identity
|
|
1947
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
1948
|
+
computeConfigAndUpdate();
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
return {
|
|
1954
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
1955
|
+
connector,
|
|
1956
|
+
computeConfigAndUpdate,
|
|
1957
|
+
resetConfigWatcher: () => ro.reset()
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
const AdapterToTokenMap = new Map();
|
|
1961
|
+
function getAdapterToken(adapter) {
|
|
1962
|
+
return AdapterToTokenMap.get(adapter);
|
|
1963
|
+
}
|
|
1964
|
+
function setAdapterToken(adapter, token) {
|
|
1965
|
+
AdapterToTokenMap.set(adapter, token);
|
|
1966
|
+
}
|
|
1967
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
1968
|
+
// support for callable adapters
|
|
1969
|
+
if (adapter.adapter) {
|
|
1970
|
+
adapter = adapter.adapter;
|
|
1971
|
+
}
|
|
1972
|
+
const method = descriptor.value;
|
|
1973
|
+
const def = {
|
|
1974
|
+
adapter,
|
|
1975
|
+
method,
|
|
1976
|
+
configCallback,
|
|
1977
|
+
dynamic
|
|
1978
|
+
};
|
|
1979
|
+
WireMetaMap.set(descriptor, def);
|
|
1980
|
+
}
|
|
1981
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
1982
|
+
// support for callable adapters
|
|
1983
|
+
if (adapter.adapter) {
|
|
1984
|
+
adapter = adapter.adapter;
|
|
1985
|
+
}
|
|
1986
|
+
const def = {
|
|
1987
|
+
adapter,
|
|
1988
|
+
configCallback,
|
|
1989
|
+
dynamic
|
|
1990
|
+
};
|
|
1991
|
+
WireMetaMap.set(descriptor, def);
|
|
1992
|
+
}
|
|
1993
|
+
function installWireAdapters(vm) {
|
|
1994
|
+
const {
|
|
1995
|
+
context,
|
|
1996
|
+
def: {
|
|
1997
|
+
wire
|
|
1998
|
+
}
|
|
1999
|
+
} = vm;
|
|
2000
|
+
const wiredConnecting = context.wiredConnecting = [];
|
|
2001
|
+
const wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2002
|
+
for (const fieldNameOrMethod in wire) {
|
|
2003
|
+
const descriptor = wire[fieldNameOrMethod];
|
|
2004
|
+
const wireDef = WireMetaMap.get(descriptor);
|
|
2005
|
+
if (!isUndefined$1(wireDef)) {
|
|
2006
|
+
const {
|
|
2007
|
+
connector,
|
|
2008
|
+
computeConfigAndUpdate,
|
|
2009
|
+
resetConfigWatcher
|
|
2010
|
+
} = createConnector(vm, fieldNameOrMethod, wireDef);
|
|
2011
|
+
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2012
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2013
|
+
connector.connect();
|
|
2014
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2015
|
+
if (hasDynamicParams) {
|
|
2016
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
computeConfigAndUpdate();
|
|
2021
|
+
});
|
|
2022
|
+
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
2023
|
+
connector.disconnect();
|
|
2024
|
+
resetConfigWatcher();
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function connectWireAdapters(vm) {
|
|
2030
|
+
const {
|
|
2031
|
+
wiredConnecting
|
|
2032
|
+
} = vm.context;
|
|
2033
|
+
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
2034
|
+
wiredConnecting[i]();
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
function disconnectWireAdapters(vm) {
|
|
2038
|
+
const {
|
|
2039
|
+
wiredDisconnecting
|
|
2040
|
+
} = vm.context;
|
|
2041
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2042
|
+
// job
|
|
2043
|
+
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
2044
|
+
wiredDisconnecting[i]();
|
|
2045
|
+
}
|
|
2046
|
+
}, noop);
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
/*
|
|
2050
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2051
|
+
* All rights reserved.
|
|
2052
|
+
* SPDX-License-Identifier: MIT
|
|
2053
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2054
|
+
*/
|
|
2055
|
+
function api$1() {
|
|
2056
|
+
throw new Error();
|
|
2057
|
+
}
|
|
2058
|
+
function createPublicPropertyDescriptor(key) {
|
|
2059
|
+
return {
|
|
2060
|
+
get() {
|
|
2061
|
+
const vm = getAssociatedVM(this);
|
|
2062
|
+
if (isBeingConstructed(vm)) {
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2065
|
+
componentValueObserved(vm, key);
|
|
2066
|
+
return vm.cmpProps[key];
|
|
2067
|
+
},
|
|
2068
|
+
set(newValue) {
|
|
2069
|
+
const vm = getAssociatedVM(this);
|
|
2070
|
+
vm.cmpProps[key] = newValue;
|
|
2071
|
+
componentValueMutated(vm, key);
|
|
2072
|
+
},
|
|
2073
|
+
enumerable: true,
|
|
2074
|
+
configurable: true,
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2078
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2079
|
+
if (!isFunction$1(get)) {
|
|
2080
|
+
throw new Error();
|
|
2081
|
+
}
|
|
2082
|
+
return {
|
|
2083
|
+
get() {
|
|
2084
|
+
return get.call(this);
|
|
2085
|
+
},
|
|
2086
|
+
set(newValue) {
|
|
2087
|
+
getAssociatedVM(this);
|
|
2088
|
+
if (set) {
|
|
2089
|
+
set.call(this, newValue);
|
|
2090
|
+
}
|
|
2091
|
+
},
|
|
2092
|
+
enumerable,
|
|
2093
|
+
configurable,
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
/*
|
|
2098
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2099
|
+
* All rights reserved.
|
|
2100
|
+
* SPDX-License-Identifier: MIT
|
|
2101
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2102
|
+
*/
|
|
2103
|
+
function track(target) {
|
|
2104
|
+
if (arguments.length === 1) {
|
|
2105
|
+
return getReactiveProxy(target);
|
|
2106
|
+
}
|
|
2107
|
+
throw new Error();
|
|
2108
|
+
}
|
|
2109
|
+
function internalTrackDecorator(key) {
|
|
2110
|
+
return {
|
|
2111
|
+
get() {
|
|
2112
|
+
const vm = getAssociatedVM(this);
|
|
2113
|
+
componentValueObserved(vm, key);
|
|
2114
|
+
return vm.cmpFields[key];
|
|
2115
|
+
},
|
|
2116
|
+
set(newValue) {
|
|
2117
|
+
const vm = getAssociatedVM(this);
|
|
2118
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2119
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2120
|
+
},
|
|
2121
|
+
enumerable: true,
|
|
2122
|
+
configurable: true,
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
/*
|
|
2127
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2128
|
+
* All rights reserved.
|
|
2129
|
+
* SPDX-License-Identifier: MIT
|
|
2130
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2131
|
+
*/
|
|
2132
|
+
/**
|
|
2133
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2134
|
+
* LWC Components. This function implements the internals of this
|
|
2135
|
+
* decorator.
|
|
2136
|
+
*/
|
|
2137
|
+
function wire(_adapter, _config) {
|
|
2138
|
+
throw new Error();
|
|
2139
|
+
}
|
|
2140
|
+
function internalWireFieldDecorator(key) {
|
|
2141
|
+
return {
|
|
2142
|
+
get() {
|
|
2143
|
+
const vm = getAssociatedVM(this);
|
|
2144
|
+
componentValueObserved(vm, key);
|
|
2145
|
+
return vm.cmpFields[key];
|
|
2146
|
+
},
|
|
2147
|
+
set(value) {
|
|
2148
|
+
const vm = getAssociatedVM(this);
|
|
2149
|
+
/**
|
|
2150
|
+
* Reactivity for wired fields is provided in wiring.
|
|
2151
|
+
* We intentionally add reactivity here since this is just
|
|
2152
|
+
* letting the author to do the wrong thing, but it will keep our
|
|
2153
|
+
* system to be backward compatible.
|
|
2154
|
+
*/
|
|
2155
|
+
updateComponentValue(vm, key, value);
|
|
1922
2156
|
},
|
|
1923
2157
|
enumerable: true,
|
|
1924
2158
|
configurable: true,
|
|
@@ -2237,10 +2471,60 @@ var LWC = (function (exports) {
|
|
|
2237
2471
|
}
|
|
2238
2472
|
freeze(BaseBridgeElement);
|
|
2239
2473
|
seal(BaseBridgeElement.prototype);
|
|
2474
|
+
const swappedStyleMap = new WeakMap();
|
|
2475
|
+
const activeTemplates = new WeakMap();
|
|
2476
|
+
const activeComponents = new WeakMap();
|
|
2477
|
+
const activeStyles = new WeakMap();
|
|
2478
|
+
function getStyleOrSwappedStyle(style) {
|
|
2479
|
+
assertNotProd(); // this method should never leak to prod
|
|
2480
|
+
const visited = new Set();
|
|
2481
|
+
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2482
|
+
visited.add(style);
|
|
2483
|
+
style = swappedStyleMap.get(style);
|
|
2484
|
+
}
|
|
2485
|
+
return style;
|
|
2486
|
+
}
|
|
2240
2487
|
function setActiveVM(vm) {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2488
|
+
assertNotProd(); // this method should never leak to prod
|
|
2489
|
+
// tracking active component
|
|
2490
|
+
const Ctor = vm.def.ctor;
|
|
2491
|
+
let componentVMs = activeComponents.get(Ctor);
|
|
2492
|
+
if (isUndefined$1(componentVMs)) {
|
|
2493
|
+
componentVMs = new Set();
|
|
2494
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2495
|
+
}
|
|
2496
|
+
// this will allow us to keep track of the hot components
|
|
2497
|
+
componentVMs.add(vm);
|
|
2498
|
+
// tracking active template
|
|
2499
|
+
const tpl = vm.cmpTemplate;
|
|
2500
|
+
if (tpl) {
|
|
2501
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2502
|
+
if (isUndefined$1(templateVMs)) {
|
|
2503
|
+
templateVMs = new Set();
|
|
2504
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2505
|
+
}
|
|
2506
|
+
// this will allow us to keep track of the templates that are
|
|
2507
|
+
// being used by a hot component
|
|
2508
|
+
templateVMs.add(vm);
|
|
2509
|
+
// tracking active styles associated to template
|
|
2510
|
+
const stylesheets = tpl.stylesheets;
|
|
2511
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2512
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2513
|
+
// this is necessary because we don't hold the list of styles
|
|
2514
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2515
|
+
// but the styles attached to the template might not be the actual
|
|
2516
|
+
// active ones, but the swapped versions of those.
|
|
2517
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2518
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2519
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2520
|
+
stylesheetVMs = new Set();
|
|
2521
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2522
|
+
}
|
|
2523
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2524
|
+
// being used by a hot component
|
|
2525
|
+
stylesheetVMs.add(vm);
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2244
2528
|
}
|
|
2245
2529
|
}
|
|
2246
2530
|
function swapTemplate(oldTpl, newTpl) {
|
|
@@ -4072,9 +4356,17 @@ var LWC = (function (exports) {
|
|
|
4072
4356
|
vmBeingRendered = vm;
|
|
4073
4357
|
}
|
|
4074
4358
|
function validateSlots(vm, html) {
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4359
|
+
assertNotProd(); // this method should never leak to prod
|
|
4360
|
+
const { cmpSlots } = vm;
|
|
4361
|
+
const { slots = EmptyArray } = html;
|
|
4362
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
4363
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4364
|
+
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4365
|
+
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
4366
|
+
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
4367
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4368
|
+
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
4369
|
+
}
|
|
4078
4370
|
}
|
|
4079
4371
|
}
|
|
4080
4372
|
function validateLightDomTemplate(template, vm) {
|
|
@@ -4184,9 +4476,7 @@ var LWC = (function (exports) {
|
|
|
4184
4476
|
}
|
|
4185
4477
|
if ("production" !== 'production') ;
|
|
4186
4478
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
4187
|
-
|
|
4188
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
4189
|
-
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
4479
|
+
vm.refVNodes = html.hasRefs ? create(null) : null;
|
|
4190
4480
|
// right before producing the vnodes, we clear up all internal references
|
|
4191
4481
|
// to custom elements from the template.
|
|
4192
4482
|
vm.velements = [];
|
|
@@ -4343,7 +4633,7 @@ var LWC = (function (exports) {
|
|
|
4343
4633
|
const cmpEventListenerMap = new WeakMap();
|
|
4344
4634
|
function getWrappedComponentsListener(vm, listener) {
|
|
4345
4635
|
if (!isFunction$1(listener)) {
|
|
4346
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
4636
|
+
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
4347
4637
|
}
|
|
4348
4638
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
4349
4639
|
if (isUndefined$1(wrappedListener)) {
|
|
@@ -4476,7 +4766,6 @@ var LWC = (function (exports) {
|
|
|
4476
4766
|
mode,
|
|
4477
4767
|
owner,
|
|
4478
4768
|
refVNodes: null,
|
|
4479
|
-
hasRefVNodes: false,
|
|
4480
4769
|
children: EmptyArray,
|
|
4481
4770
|
aChildren: EmptyArray,
|
|
4482
4771
|
velements: EmptyArray,
|
|
@@ -4812,338 +5101,210 @@ var LWC = (function (exports) {
|
|
|
4812
5101
|
break;
|
|
4813
5102
|
}
|
|
4814
5103
|
}
|
|
4815
|
-
}
|
|
4816
|
-
}
|
|
4817
|
-
}
|
|
4818
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
4819
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
4820
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
4821
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
4822
|
-
function resetComponentRoot(vm) {
|
|
4823
|
-
const {
|
|
4824
|
-
children,
|
|
4825
|
-
renderRoot,
|
|
4826
|
-
renderer: {
|
|
4827
|
-
remove
|
|
4828
|
-
}
|
|
4829
|
-
} = vm;
|
|
4830
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4831
|
-
const child = children[i];
|
|
4832
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
4833
|
-
remove(child.elm, renderRoot);
|
|
4834
|
-
}
|
|
4835
|
-
}
|
|
4836
|
-
vm.children = EmptyArray;
|
|
4837
|
-
runChildNodesDisconnectedCallback(vm);
|
|
4838
|
-
vm.velements = EmptyArray;
|
|
4839
|
-
}
|
|
4840
|
-
function scheduleRehydration(vm) {
|
|
4841
|
-
if (isTrue(vm.isScheduled)) {
|
|
4842
|
-
return;
|
|
4843
|
-
}
|
|
4844
|
-
vm.isScheduled = true;
|
|
4845
|
-
if (rehydrateQueue.length === 0) {
|
|
4846
|
-
addCallbackToNextTick(flushRehydrationQueue);
|
|
4847
|
-
}
|
|
4848
|
-
ArrayPush$1.call(rehydrateQueue, vm);
|
|
4849
|
-
}
|
|
4850
|
-
function getErrorBoundaryVM(vm) {
|
|
4851
|
-
let currentVm = vm;
|
|
4852
|
-
while (!isNull(currentVm)) {
|
|
4853
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
4854
|
-
return currentVm;
|
|
4855
|
-
}
|
|
4856
|
-
currentVm = currentVm.owner;
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
4860
|
-
let error;
|
|
4861
|
-
pre();
|
|
4862
|
-
try {
|
|
4863
|
-
job();
|
|
4864
|
-
} catch (e) {
|
|
4865
|
-
error = Object(e);
|
|
4866
|
-
} finally {
|
|
4867
|
-
post();
|
|
4868
|
-
if (!isUndefined$1(error)) {
|
|
4869
|
-
addErrorComponentStack(vm, error);
|
|
4870
|
-
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
4871
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
4872
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
4873
|
-
}
|
|
4874
|
-
|
|
4875
|
-
resetComponentRoot(vm); // remove offenders
|
|
4876
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
4877
|
-
// error boundaries must have an ErrorCallback
|
|
4878
|
-
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
4879
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
4880
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
4881
|
-
}
|
|
4882
|
-
}
|
|
4883
|
-
}
|
|
4884
|
-
|
|
4885
|
-
/*
|
|
4886
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4887
|
-
* All rights reserved.
|
|
4888
|
-
* SPDX-License-Identifier: MIT
|
|
4889
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4890
|
-
*/
|
|
4891
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
4892
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
4893
|
-
const WireMetaMap = new Map();
|
|
4894
|
-
class WireContextRegistrationEvent extends CustomEvent {
|
|
4895
|
-
constructor(adapterToken, {
|
|
4896
|
-
setNewContext,
|
|
4897
|
-
setDisconnectedCallback
|
|
4898
|
-
}) {
|
|
4899
|
-
super(adapterToken, {
|
|
4900
|
-
bubbles: true,
|
|
4901
|
-
composed: true
|
|
4902
|
-
});
|
|
4903
|
-
defineProperties(this, {
|
|
4904
|
-
setNewContext: {
|
|
4905
|
-
value: setNewContext
|
|
4906
|
-
},
|
|
4907
|
-
setDisconnectedCallback: {
|
|
4908
|
-
value: setDisconnectedCallback
|
|
4909
|
-
}
|
|
4910
|
-
});
|
|
4911
|
-
}
|
|
4912
|
-
}
|
|
4913
|
-
function createFieldDataCallback(vm, name) {
|
|
4914
|
-
return value => {
|
|
4915
|
-
updateComponentValue(vm, name, value);
|
|
4916
|
-
};
|
|
4917
|
-
}
|
|
4918
|
-
function createMethodDataCallback(vm, method) {
|
|
4919
|
-
return value => {
|
|
4920
|
-
// dispatching new value into the wired method
|
|
4921
|
-
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
4922
|
-
// job
|
|
4923
|
-
method.call(vm.component, value);
|
|
4924
|
-
}, noop);
|
|
4925
|
-
};
|
|
4926
|
-
}
|
|
4927
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
4928
|
-
let hasPendingConfig = false;
|
|
4929
|
-
// creating the reactive observer for reactive params when needed
|
|
4930
|
-
const ro = createReactiveObserver(() => {
|
|
4931
|
-
if (hasPendingConfig === false) {
|
|
4932
|
-
hasPendingConfig = true;
|
|
4933
|
-
// collect new config in the micro-task
|
|
4934
|
-
Promise.resolve().then(() => {
|
|
4935
|
-
hasPendingConfig = false;
|
|
4936
|
-
// resetting current reactive params
|
|
4937
|
-
ro.reset();
|
|
4938
|
-
// dispatching a new config due to a change in the configuration
|
|
4939
|
-
computeConfigAndUpdate();
|
|
4940
|
-
});
|
|
4941
|
-
}
|
|
4942
|
-
});
|
|
4943
|
-
const computeConfigAndUpdate = () => {
|
|
4944
|
-
let config;
|
|
4945
|
-
ro.observe(() => config = configCallback(component));
|
|
4946
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
4947
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
4948
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
4949
|
-
callbackWhenConfigIsReady(config);
|
|
4950
|
-
};
|
|
4951
|
-
return {
|
|
4952
|
-
computeConfigAndUpdate,
|
|
4953
|
-
ro
|
|
4954
|
-
};
|
|
4955
|
-
}
|
|
4956
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
4957
|
-
const {
|
|
4958
|
-
adapter
|
|
4959
|
-
} = wireDef;
|
|
4960
|
-
const adapterContextToken = getAdapterToken(adapter);
|
|
4961
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
4962
|
-
return; // no provider found, nothing to be done
|
|
5104
|
+
}
|
|
4963
5105
|
}
|
|
4964
|
-
|
|
5106
|
+
}
|
|
5107
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
5108
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
5109
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
5110
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
5111
|
+
function resetComponentRoot(vm) {
|
|
4965
5112
|
const {
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
wiredConnecting,
|
|
4969
|
-
wiredDisconnecting
|
|
4970
|
-
},
|
|
5113
|
+
children,
|
|
5114
|
+
renderRoot,
|
|
4971
5115
|
renderer: {
|
|
4972
|
-
|
|
5116
|
+
remove
|
|
4973
5117
|
}
|
|
4974
5118
|
} = vm;
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
4981
|
-
// guarantee that the linkage can be forged.
|
|
4982
|
-
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
4983
|
-
setNewContext(newContext) {
|
|
4984
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
4985
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
4986
|
-
callbackWhenContextIsReady(newContext);
|
|
4987
|
-
},
|
|
4988
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
4989
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
4990
|
-
// the the element hosting the wire is disconnected
|
|
4991
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
4992
|
-
}
|
|
4993
|
-
});
|
|
4994
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
4995
|
-
});
|
|
4996
|
-
}
|
|
4997
|
-
function createConnector(vm, name, wireDef) {
|
|
4998
|
-
const {
|
|
4999
|
-
method,
|
|
5000
|
-
adapter,
|
|
5001
|
-
configCallback,
|
|
5002
|
-
dynamic
|
|
5003
|
-
} = wireDef;
|
|
5004
|
-
let debugInfo;
|
|
5005
|
-
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
5006
|
-
const dataCallback = value => {
|
|
5007
|
-
fieldOrMethodCallback(value);
|
|
5008
|
-
};
|
|
5009
|
-
let context;
|
|
5010
|
-
let connector;
|
|
5011
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
5012
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
5013
|
-
value: vm.elm
|
|
5014
|
-
});
|
|
5015
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
5016
|
-
value: dynamic
|
|
5017
|
-
});
|
|
5018
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
5019
|
-
// job
|
|
5020
|
-
connector = new adapter(dataCallback);
|
|
5021
|
-
}, noop);
|
|
5022
|
-
const updateConnectorConfig = config => {
|
|
5023
|
-
// every time the config is recomputed due to tracking,
|
|
5024
|
-
// this callback will be invoked with the new computed config
|
|
5025
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
5026
|
-
// job
|
|
5027
|
-
if ("production" !== 'production') ;
|
|
5028
|
-
connector.update(config, context);
|
|
5029
|
-
}, noop);
|
|
5030
|
-
};
|
|
5031
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
5032
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
5033
|
-
const {
|
|
5034
|
-
computeConfigAndUpdate,
|
|
5035
|
-
ro
|
|
5036
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
5037
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
5038
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
5039
|
-
createContextWatcher(vm, wireDef, newContext => {
|
|
5040
|
-
// every time the context is pushed into this component,
|
|
5041
|
-
// this callback will be invoked with the new computed context
|
|
5042
|
-
if (context !== newContext) {
|
|
5043
|
-
context = newContext;
|
|
5044
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
5045
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
5046
|
-
// (ever), while context can have identity
|
|
5047
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
5048
|
-
computeConfigAndUpdate();
|
|
5049
|
-
}
|
|
5050
|
-
}
|
|
5051
|
-
});
|
|
5119
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
5120
|
+
const child = children[i];
|
|
5121
|
+
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5122
|
+
remove(child.elm, renderRoot);
|
|
5123
|
+
}
|
|
5052
5124
|
}
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
computeConfigAndUpdate,
|
|
5057
|
-
resetConfigWatcher: () => ro.reset()
|
|
5058
|
-
};
|
|
5059
|
-
}
|
|
5060
|
-
const AdapterToTokenMap = new Map();
|
|
5061
|
-
function getAdapterToken(adapter) {
|
|
5062
|
-
return AdapterToTokenMap.get(adapter);
|
|
5125
|
+
vm.children = EmptyArray;
|
|
5126
|
+
runChildNodesDisconnectedCallback(vm);
|
|
5127
|
+
vm.velements = EmptyArray;
|
|
5063
5128
|
}
|
|
5064
|
-
function
|
|
5065
|
-
|
|
5129
|
+
function scheduleRehydration(vm) {
|
|
5130
|
+
if (isTrue(vm.isScheduled)) {
|
|
5131
|
+
return;
|
|
5132
|
+
}
|
|
5133
|
+
vm.isScheduled = true;
|
|
5134
|
+
if (rehydrateQueue.length === 0) {
|
|
5135
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
5136
|
+
}
|
|
5137
|
+
ArrayPush$1.call(rehydrateQueue, vm);
|
|
5066
5138
|
}
|
|
5067
|
-
function
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5139
|
+
function getErrorBoundaryVM(vm) {
|
|
5140
|
+
let currentVm = vm;
|
|
5141
|
+
while (!isNull(currentVm)) {
|
|
5142
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
5143
|
+
return currentVm;
|
|
5144
|
+
}
|
|
5145
|
+
currentVm = currentVm.owner;
|
|
5071
5146
|
}
|
|
5072
|
-
const method = descriptor.value;
|
|
5073
|
-
const def = {
|
|
5074
|
-
adapter,
|
|
5075
|
-
method,
|
|
5076
|
-
configCallback,
|
|
5077
|
-
dynamic
|
|
5078
|
-
};
|
|
5079
|
-
WireMetaMap.set(descriptor, def);
|
|
5080
5147
|
}
|
|
5081
|
-
function
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5148
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
5149
|
+
let error;
|
|
5150
|
+
pre();
|
|
5151
|
+
try {
|
|
5152
|
+
job();
|
|
5153
|
+
} catch (e) {
|
|
5154
|
+
error = Object(e);
|
|
5155
|
+
} finally {
|
|
5156
|
+
post();
|
|
5157
|
+
if (!isUndefined$1(error)) {
|
|
5158
|
+
addErrorComponentStack(vm, error);
|
|
5159
|
+
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
5160
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
5161
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
5162
|
+
}
|
|
5163
|
+
|
|
5164
|
+
resetComponentRoot(vm); // remove offenders
|
|
5165
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
5166
|
+
// error boundaries must have an ErrorCallback
|
|
5167
|
+
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
5168
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
5169
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
5170
|
+
}
|
|
5085
5171
|
}
|
|
5086
|
-
const def = {
|
|
5087
|
-
adapter,
|
|
5088
|
-
configCallback,
|
|
5089
|
-
dynamic
|
|
5090
|
-
};
|
|
5091
|
-
WireMetaMap.set(descriptor, def);
|
|
5092
5172
|
}
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5173
|
+
|
|
5174
|
+
/*
|
|
5175
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5176
|
+
* All rights reserved.
|
|
5177
|
+
* SPDX-License-Identifier: MIT
|
|
5178
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5179
|
+
*/
|
|
5180
|
+
//
|
|
5181
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
5182
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
5183
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
5184
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
5185
|
+
//
|
|
5186
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
5187
|
+
const getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
5188
|
+
const querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
5189
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
5190
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
5191
|
+
}
|
|
5192
|
+
function reportViolation(source, target, attrName) {
|
|
5193
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
5194
|
+
// shadow for a violation to be detected.
|
|
5195
|
+
let vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
5196
|
+
if (isUndefined$1(vm)) {
|
|
5197
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
5198
|
+
}
|
|
5199
|
+
if (isUndefined$1(vm)) {
|
|
5200
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
5201
|
+
return;
|
|
5098
5202
|
}
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
5115
|
-
if (hasDynamicParams) {
|
|
5116
|
-
Promise.resolve().then(computeConfigAndUpdate);
|
|
5203
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
|
|
5204
|
+
}
|
|
5205
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
5206
|
+
// split on whitespace and skip empty strings after splitting
|
|
5207
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
5208
|
+
}
|
|
5209
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
5210
|
+
const root = elm.getRootNode();
|
|
5211
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
5212
|
+
return;
|
|
5213
|
+
}
|
|
5214
|
+
if (attrName === 'id') {
|
|
5215
|
+
// elm is the target, find the source
|
|
5216
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
5217
|
+
// if our id is null or empty, nobody can reference us
|
|
5117
5218
|
return;
|
|
5118
|
-
}
|
|
5119
5219
|
}
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5220
|
+
for (const idRefAttrName of ID_REFERENCING_ATTRIBUTES_SET) {
|
|
5221
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
5222
|
+
// that reference multiple IDs, separated by whitespace.
|
|
5223
|
+
const query = `[${idRefAttrName}~="${CSS.escape(attrValue)}"]`;
|
|
5224
|
+
const sourceElements = querySelectorAll.call(document, query);
|
|
5225
|
+
for (let i = 0; i < sourceElements.length; i++) {
|
|
5226
|
+
const sourceElement = sourceElements[i];
|
|
5227
|
+
const sourceRoot = sourceElement.getRootNode();
|
|
5228
|
+
if (sourceRoot !== root) {
|
|
5229
|
+
reportViolation(sourceElement, elm);
|
|
5230
|
+
break;
|
|
5231
|
+
}
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
else {
|
|
5236
|
+
// elm is the source, find the target
|
|
5237
|
+
const ids = parseIdRefAttributeValue(attrValue);
|
|
5238
|
+
for (const id of ids) {
|
|
5239
|
+
const target = getElementById.call(document, id);
|
|
5240
|
+
if (!isNull(target)) {
|
|
5241
|
+
const targetRoot = target.getRootNode();
|
|
5242
|
+
if (targetRoot !== root) {
|
|
5243
|
+
// target element's shadow root is not the same as ours
|
|
5244
|
+
reportViolation(elm, target);
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5126
5248
|
}
|
|
5127
|
-
}
|
|
5128
5249
|
}
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5250
|
+
let enabled = false;
|
|
5251
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
5252
|
+
// reporting is not enabled. It should also only run once
|
|
5253
|
+
function enableDetection() {
|
|
5254
|
+
if (enabled) {
|
|
5255
|
+
return; // don't double-apply the patches
|
|
5256
|
+
}
|
|
5257
|
+
enabled = true;
|
|
5258
|
+
const { setAttribute } = Element.prototype;
|
|
5259
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
5260
|
+
assign(Element.prototype, {
|
|
5261
|
+
setAttribute(attrName, attrValue) {
|
|
5262
|
+
setAttribute.call(this, attrName, attrValue);
|
|
5263
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
5264
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
5265
|
+
}
|
|
5266
|
+
},
|
|
5267
|
+
});
|
|
5268
|
+
// Detect `elm.id = 'foo'`
|
|
5269
|
+
const idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
5270
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
5271
|
+
const { get, set } = idDescriptor;
|
|
5272
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
5273
|
+
if (isFunction$1(get) && isFunction$1(set)) {
|
|
5274
|
+
defineProperty(Element.prototype, 'id', {
|
|
5275
|
+
get() {
|
|
5276
|
+
return get.call(this);
|
|
5277
|
+
},
|
|
5278
|
+
set(value) {
|
|
5279
|
+
set.call(this, value);
|
|
5280
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
5281
|
+
},
|
|
5282
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
5283
|
+
enumerable: true,
|
|
5284
|
+
configurable: true,
|
|
5285
|
+
});
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5136
5288
|
}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5289
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
5290
|
+
// for unsupported browsers
|
|
5291
|
+
function supportsCssEscape() {
|
|
5292
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
5293
|
+
}
|
|
5294
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
5295
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
5296
|
+
function isSyntheticShadowLoaded() {
|
|
5297
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
5298
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
5299
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5300
|
+
}
|
|
5301
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
5302
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
5303
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
5304
|
+
{
|
|
5305
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
5306
|
+
onReportingEnabled(enableDetection);
|
|
5145
5307
|
}
|
|
5146
|
-
}, noop);
|
|
5147
5308
|
}
|
|
5148
5309
|
|
|
5149
5310
|
/*
|
|
@@ -6511,7 +6672,7 @@ var LWC = (function (exports) {
|
|
|
6511
6672
|
function isNull(obj) {
|
|
6512
6673
|
return obj === null;
|
|
6513
6674
|
}
|
|
6514
|
-
/** version: 2.
|
|
6675
|
+
/** version: 2.35.1 */
|
|
6515
6676
|
|
|
6516
6677
|
/*
|
|
6517
6678
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7064,10 +7225,11 @@ var LWC = (function (exports) {
|
|
|
7064
7225
|
});
|
|
7065
7226
|
freeze(LightningElement);
|
|
7066
7227
|
seal(LightningElement.prototype);
|
|
7067
|
-
/* version: 2.
|
|
7228
|
+
/* version: 2.35.1 */
|
|
7068
7229
|
|
|
7069
7230
|
exports.LightningElement = LightningElement;
|
|
7070
7231
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
7232
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
7071
7233
|
exports.api = api$1;
|
|
7072
7234
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
7073
7235
|
exports.createContextProvider = createContextProvider;
|