lwc 2.33.0 → 2.35.0
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 +1022 -649
- package/dist/engine-dom/iife/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/iife/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-dom/umd/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/umd/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-server/commonjs/es2017/engine-server.js +789 -638
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +789 -638
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +18 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +18 -3
- 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.
|
|
@@ -237,6 +250,8 @@ var LWC = (function (exports) {
|
|
|
237
250
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
238
251
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
239
252
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
253
|
+
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
254
|
+
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
240
255
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
241
256
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
242
257
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -336,7 +351,7 @@ var LWC = (function (exports) {
|
|
|
336
351
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
337
352
|
return propertyName;
|
|
338
353
|
}
|
|
339
|
-
/** version: 2.
|
|
354
|
+
/** version: 2.35.0 */
|
|
340
355
|
|
|
341
356
|
/**
|
|
342
357
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -359,6 +374,7 @@ var LWC = (function (exports) {
|
|
|
359
374
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
360
375
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
361
376
|
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
377
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null,
|
|
362
378
|
};
|
|
363
379
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
364
380
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -402,7 +418,7 @@ var LWC = (function (exports) {
|
|
|
402
418
|
*/
|
|
403
419
|
function setFeatureFlagForTest(name, value) {
|
|
404
420
|
}
|
|
405
|
-
/** version: 2.
|
|
421
|
+
/** version: 2.35.0 */
|
|
406
422
|
|
|
407
423
|
/**
|
|
408
424
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -466,7 +482,7 @@ var LWC = (function (exports) {
|
|
|
466
482
|
}
|
|
467
483
|
}
|
|
468
484
|
}
|
|
469
|
-
/** version: 2.
|
|
485
|
+
/** version: 2.35.0 */
|
|
470
486
|
|
|
471
487
|
/*
|
|
472
488
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -486,69 +502,148 @@ var LWC = (function (exports) {
|
|
|
486
502
|
* SPDX-License-Identifier: MIT
|
|
487
503
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
488
504
|
*/
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
505
|
+
/** Callbacks to invoke when reporting is enabled **/
|
|
506
|
+
const onReportingEnabledCallbacks = [];
|
|
507
|
+
/** The currently assigned reporting dispatcher. */
|
|
508
|
+
let currentDispatcher$1 = noop;
|
|
509
|
+
/**
|
|
510
|
+
* Whether reporting is enabled.
|
|
511
|
+
*
|
|
512
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
513
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
514
|
+
*/
|
|
515
|
+
let enabled$1 = false;
|
|
516
|
+
const reportingControl = {
|
|
517
|
+
/**
|
|
518
|
+
* Attach a new reporting control (aka dispatcher).
|
|
519
|
+
*
|
|
520
|
+
* @param dispatcher - reporting control
|
|
521
|
+
*/
|
|
522
|
+
attachDispatcher(dispatcher) {
|
|
523
|
+
enabled$1 = true;
|
|
524
|
+
currentDispatcher$1 = dispatcher;
|
|
525
|
+
for (const callback of onReportingEnabledCallbacks) {
|
|
526
|
+
try {
|
|
527
|
+
callback();
|
|
528
|
+
}
|
|
529
|
+
catch (err) {
|
|
530
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
531
|
+
// eslint-disable-next-line no-console
|
|
532
|
+
console.error('Could not invoke callback', err);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
536
|
+
},
|
|
537
|
+
/**
|
|
538
|
+
* Detach the current reporting control (aka dispatcher).
|
|
539
|
+
*/
|
|
540
|
+
detachDispatcher() {
|
|
541
|
+
enabled$1 = false;
|
|
542
|
+
currentDispatcher$1 = noop;
|
|
543
|
+
},
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
547
|
+
* Will only ever be called once.
|
|
548
|
+
* @param callback
|
|
549
|
+
*/
|
|
550
|
+
function onReportingEnabled(callback) {
|
|
551
|
+
if (enabled$1) {
|
|
552
|
+
// call immediately
|
|
553
|
+
callback();
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
// call later
|
|
557
|
+
onReportingEnabledCallbacks.push(callback);
|
|
498
558
|
}
|
|
499
559
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
560
|
+
/**
|
|
561
|
+
* Report to the current dispatcher, if there is one.
|
|
562
|
+
* @param reportingEventId
|
|
563
|
+
* @param vm
|
|
564
|
+
*/
|
|
565
|
+
function report(reportingEventId, vm) {
|
|
566
|
+
if (enabled$1) {
|
|
567
|
+
currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
|
|
503
568
|
}
|
|
504
|
-
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
505
569
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
570
|
+
|
|
571
|
+
/*
|
|
572
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
573
|
+
* All rights reserved.
|
|
574
|
+
* SPDX-License-Identifier: MIT
|
|
575
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
576
|
+
*/
|
|
577
|
+
function getComponentTag(vm) {
|
|
578
|
+
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
579
|
+
}
|
|
580
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
581
|
+
function getComponentStack(vm) {
|
|
582
|
+
const stack = [];
|
|
583
|
+
let prefix = '';
|
|
584
|
+
while (!isNull(vm.owner)) {
|
|
585
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
586
|
+
vm = vm.owner;
|
|
587
|
+
prefix += '\t';
|
|
511
588
|
}
|
|
512
|
-
return
|
|
589
|
+
return ArrayJoin.call(stack, '\n');
|
|
513
590
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
521
|
-
for (const declaration of declarations) {
|
|
522
|
-
if (declaration) {
|
|
523
|
-
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
524
|
-
if (prop !== undefined && value !== undefined) {
|
|
525
|
-
styleMap[prop.trim()] = value.trim();
|
|
526
|
-
}
|
|
527
|
-
}
|
|
591
|
+
function getErrorComponentStack(vm) {
|
|
592
|
+
const wcStack = [];
|
|
593
|
+
let currentVm = vm;
|
|
594
|
+
while (!isNull(currentVm)) {
|
|
595
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
596
|
+
currentVm = currentVm.owner;
|
|
528
597
|
}
|
|
529
|
-
return
|
|
598
|
+
return wcStack.reverse().join('\n\t');
|
|
530
599
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
600
|
+
|
|
601
|
+
/*
|
|
602
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
603
|
+
* All rights reserved.
|
|
604
|
+
* SPDX-License-Identifier: MIT
|
|
605
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
606
|
+
*/
|
|
607
|
+
function addErrorComponentStack(vm, error) {
|
|
608
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
609
|
+
const wcStack = getErrorComponentStack(vm);
|
|
610
|
+
defineProperty(error, 'wcStack', {
|
|
611
|
+
get() {
|
|
612
|
+
return wcStack;
|
|
613
|
+
},
|
|
614
|
+
});
|
|
538
615
|
}
|
|
539
|
-
return result;
|
|
540
616
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
617
|
+
|
|
618
|
+
/*
|
|
619
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
620
|
+
* All rights reserved.
|
|
621
|
+
* SPDX-License-Identifier: MIT
|
|
622
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
623
|
+
*/
|
|
624
|
+
const alreadyLoggedMessages = new Set();
|
|
625
|
+
function log(method, message, vm, once) {
|
|
626
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
627
|
+
if (!isUndefined$1(vm)) {
|
|
628
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
629
|
+
}
|
|
630
|
+
if (once) {
|
|
631
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
alreadyLoggedMessages.add(msg);
|
|
635
|
+
}
|
|
636
|
+
try {
|
|
637
|
+
throw new Error(msg);
|
|
638
|
+
}
|
|
639
|
+
catch (e) {
|
|
640
|
+
/* eslint-disable-next-line no-console */
|
|
641
|
+
console[method](e);
|
|
550
642
|
}
|
|
551
643
|
}
|
|
644
|
+
function logError(message, vm) {
|
|
645
|
+
log('error', message, vm, false);
|
|
646
|
+
}
|
|
552
647
|
|
|
553
648
|
/*
|
|
554
649
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -670,68 +765,80 @@ var LWC = (function (exports) {
|
|
|
670
765
|
* SPDX-License-Identifier: MIT
|
|
671
766
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
672
767
|
*/
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
function
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
vm = vm.owner;
|
|
683
|
-
prefix += '\t';
|
|
768
|
+
let nextTickCallbackQueue = [];
|
|
769
|
+
const SPACE_CHAR = 32;
|
|
770
|
+
const EmptyObject = seal(create(null));
|
|
771
|
+
const EmptyArray = seal([]);
|
|
772
|
+
function flushCallbackQueue() {
|
|
773
|
+
const callbacks = nextTickCallbackQueue;
|
|
774
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
775
|
+
for (let i = 0, len = callbacks.length; i < len; i += 1) {
|
|
776
|
+
callbacks[i]();
|
|
684
777
|
}
|
|
685
|
-
return ArrayJoin.call(stack, '\n');
|
|
686
778
|
}
|
|
687
|
-
function
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
while (!isNull(currentVm)) {
|
|
691
|
-
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
692
|
-
currentVm = currentVm.owner;
|
|
779
|
+
function addCallbackToNextTick(callback) {
|
|
780
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
781
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
693
782
|
}
|
|
694
|
-
|
|
783
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
695
784
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
702
|
-
*/
|
|
703
|
-
function addErrorComponentStack(vm, error) {
|
|
704
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
705
|
-
const wcStack = getErrorComponentStack(vm);
|
|
706
|
-
defineProperty(error, 'wcStack', {
|
|
707
|
-
get() {
|
|
708
|
-
return wcStack;
|
|
709
|
-
},
|
|
710
|
-
});
|
|
785
|
+
function guid() {
|
|
786
|
+
function s4() {
|
|
787
|
+
return Math.floor((1 + Math.random()) * 0x10000)
|
|
788
|
+
.toString(16)
|
|
789
|
+
.substring(1);
|
|
711
790
|
}
|
|
791
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
712
792
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
793
|
+
// Borrowed from Vue template compiler.
|
|
794
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
795
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
796
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
797
|
+
function parseStyleText(cssText) {
|
|
798
|
+
const styleMap = {};
|
|
799
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
800
|
+
for (const declaration of declarations) {
|
|
801
|
+
if (declaration) {
|
|
802
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
803
|
+
if (prop !== undefined && value !== undefined) {
|
|
804
|
+
styleMap[prop.trim()] = value.trim();
|
|
805
|
+
}
|
|
806
|
+
}
|
|
724
807
|
}
|
|
725
|
-
|
|
726
|
-
|
|
808
|
+
return styleMap;
|
|
809
|
+
}
|
|
810
|
+
// Make a shallow copy of an object but omit the given key
|
|
811
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
812
|
+
const result = {};
|
|
813
|
+
for (const key of Object.keys(object)) {
|
|
814
|
+
if (key !== keyToOmit) {
|
|
815
|
+
result[key] = object[key];
|
|
816
|
+
}
|
|
727
817
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
818
|
+
return result;
|
|
819
|
+
}
|
|
820
|
+
function flattenStylesheets(stylesheets) {
|
|
821
|
+
const list = [];
|
|
822
|
+
for (const stylesheet of stylesheets) {
|
|
823
|
+
if (!Array.isArray(stylesheet)) {
|
|
824
|
+
list.push(stylesheet);
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
828
|
+
}
|
|
731
829
|
}
|
|
830
|
+
return list;
|
|
732
831
|
}
|
|
733
|
-
|
|
734
|
-
|
|
832
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
833
|
+
function setRefVNode(vm, ref, vnode) {
|
|
834
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
835
|
+
// If not, then something went wrong and we threw an error above.
|
|
836
|
+
const refVNodes = vm.refVNodes;
|
|
837
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
838
|
+
// in depth-first traversal order.
|
|
839
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
840
|
+
refVNodes[ref] = vnode;
|
|
841
|
+
}
|
|
735
842
|
}
|
|
736
843
|
|
|
737
844
|
/*
|
|
@@ -777,98 +884,6 @@ var LWC = (function (exports) {
|
|
|
777
884
|
'tabIndex',
|
|
778
885
|
'title',
|
|
779
886
|
];
|
|
780
|
-
function offsetPropertyErrorMessage(name) {
|
|
781
|
-
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.`;
|
|
782
|
-
}
|
|
783
|
-
// Global HTML Attributes & Properties
|
|
784
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
785
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
786
|
-
assign(create(null), {
|
|
787
|
-
accessKey: {
|
|
788
|
-
attribute: 'accesskey',
|
|
789
|
-
},
|
|
790
|
-
accessKeyLabel: {
|
|
791
|
-
readOnly: true,
|
|
792
|
-
},
|
|
793
|
-
className: {
|
|
794
|
-
attribute: 'class',
|
|
795
|
-
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.',
|
|
796
|
-
},
|
|
797
|
-
contentEditable: {
|
|
798
|
-
attribute: 'contenteditable',
|
|
799
|
-
},
|
|
800
|
-
dataset: {
|
|
801
|
-
readOnly: true,
|
|
802
|
-
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.",
|
|
803
|
-
},
|
|
804
|
-
dir: {
|
|
805
|
-
attribute: 'dir',
|
|
806
|
-
},
|
|
807
|
-
draggable: {
|
|
808
|
-
attribute: 'draggable',
|
|
809
|
-
},
|
|
810
|
-
dropzone: {
|
|
811
|
-
attribute: 'dropzone',
|
|
812
|
-
readOnly: true,
|
|
813
|
-
},
|
|
814
|
-
hidden: {
|
|
815
|
-
attribute: 'hidden',
|
|
816
|
-
},
|
|
817
|
-
id: {
|
|
818
|
-
attribute: 'id',
|
|
819
|
-
},
|
|
820
|
-
inputMode: {
|
|
821
|
-
attribute: 'inputmode',
|
|
822
|
-
},
|
|
823
|
-
lang: {
|
|
824
|
-
attribute: 'lang',
|
|
825
|
-
},
|
|
826
|
-
slot: {
|
|
827
|
-
attribute: 'slot',
|
|
828
|
-
error: 'Using the `slot` property is an anti-pattern.',
|
|
829
|
-
},
|
|
830
|
-
spellcheck: {
|
|
831
|
-
attribute: 'spellcheck',
|
|
832
|
-
},
|
|
833
|
-
style: {
|
|
834
|
-
attribute: 'style',
|
|
835
|
-
},
|
|
836
|
-
tabIndex: {
|
|
837
|
-
attribute: 'tabindex',
|
|
838
|
-
},
|
|
839
|
-
title: {
|
|
840
|
-
attribute: 'title',
|
|
841
|
-
},
|
|
842
|
-
translate: {
|
|
843
|
-
attribute: 'translate',
|
|
844
|
-
},
|
|
845
|
-
// additional "global attributes" that are not present in the link above.
|
|
846
|
-
isContentEditable: {
|
|
847
|
-
readOnly: true,
|
|
848
|
-
},
|
|
849
|
-
offsetHeight: {
|
|
850
|
-
readOnly: true,
|
|
851
|
-
error: offsetPropertyErrorMessage('offsetHeight'),
|
|
852
|
-
},
|
|
853
|
-
offsetLeft: {
|
|
854
|
-
readOnly: true,
|
|
855
|
-
error: offsetPropertyErrorMessage('offsetLeft'),
|
|
856
|
-
},
|
|
857
|
-
offsetParent: {
|
|
858
|
-
readOnly: true,
|
|
859
|
-
},
|
|
860
|
-
offsetTop: {
|
|
861
|
-
readOnly: true,
|
|
862
|
-
error: offsetPropertyErrorMessage('offsetTop'),
|
|
863
|
-
},
|
|
864
|
-
offsetWidth: {
|
|
865
|
-
readOnly: true,
|
|
866
|
-
error: offsetPropertyErrorMessage('offsetWidth'),
|
|
867
|
-
},
|
|
868
|
-
role: {
|
|
869
|
-
attribute: 'role',
|
|
870
|
-
},
|
|
871
|
-
});
|
|
872
887
|
let controlledElement = null;
|
|
873
888
|
let controlledAttributeName;
|
|
874
889
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1802,92 +1817,356 @@ var LWC = (function (exports) {
|
|
|
1802
1817
|
* SPDX-License-Identifier: MIT
|
|
1803
1818
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1804
1819
|
*/
|
|
1805
|
-
|
|
1806
|
-
|
|
1820
|
+
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
1821
|
+
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
1822
|
+
const WireMetaMap = new Map();
|
|
1823
|
+
class WireContextRegistrationEvent extends CustomEvent {
|
|
1824
|
+
constructor(adapterToken, {
|
|
1825
|
+
setNewContext,
|
|
1826
|
+
setDisconnectedCallback
|
|
1827
|
+
}) {
|
|
1828
|
+
super(adapterToken, {
|
|
1829
|
+
bubbles: true,
|
|
1830
|
+
composed: true
|
|
1831
|
+
});
|
|
1832
|
+
defineProperties(this, {
|
|
1833
|
+
setNewContext: {
|
|
1834
|
+
value: setNewContext
|
|
1835
|
+
},
|
|
1836
|
+
setDisconnectedCallback: {
|
|
1837
|
+
value: setDisconnectedCallback
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1807
1841
|
}
|
|
1808
|
-
function
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
if (isBeingConstructed(vm)) {
|
|
1813
|
-
return;
|
|
1814
|
-
}
|
|
1815
|
-
componentValueObserved(vm, key);
|
|
1816
|
-
return vm.cmpProps[key];
|
|
1817
|
-
},
|
|
1818
|
-
set(newValue) {
|
|
1819
|
-
const vm = getAssociatedVM(this);
|
|
1820
|
-
vm.cmpProps[key] = newValue;
|
|
1821
|
-
componentValueMutated(vm, key);
|
|
1822
|
-
},
|
|
1823
|
-
enumerable: true,
|
|
1824
|
-
configurable: true,
|
|
1825
|
-
};
|
|
1842
|
+
function createFieldDataCallback(vm, name) {
|
|
1843
|
+
return value => {
|
|
1844
|
+
updateComponentValue(vm, name, value);
|
|
1845
|
+
};
|
|
1826
1846
|
}
|
|
1827
|
-
function
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1847
|
+
function createMethodDataCallback(vm, method) {
|
|
1848
|
+
return value => {
|
|
1849
|
+
// dispatching new value into the wired method
|
|
1850
|
+
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
1851
|
+
// job
|
|
1852
|
+
method.call(vm.component, value);
|
|
1853
|
+
}, noop);
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
1857
|
+
let hasPendingConfig = false;
|
|
1858
|
+
// creating the reactive observer for reactive params when needed
|
|
1859
|
+
const ro = createReactiveObserver(() => {
|
|
1860
|
+
if (hasPendingConfig === false) {
|
|
1861
|
+
hasPendingConfig = true;
|
|
1862
|
+
// collect new config in the micro-task
|
|
1863
|
+
Promise.resolve().then(() => {
|
|
1864
|
+
hasPendingConfig = false;
|
|
1865
|
+
// resetting current reactive params
|
|
1866
|
+
ro.reset();
|
|
1867
|
+
// dispatching a new config due to a change in the configuration
|
|
1868
|
+
computeConfigAndUpdate();
|
|
1869
|
+
});
|
|
1831
1870
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1871
|
+
});
|
|
1872
|
+
const computeConfigAndUpdate = () => {
|
|
1873
|
+
let config;
|
|
1874
|
+
ro.observe(() => config = configCallback(component));
|
|
1875
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1876
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
1877
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
1878
|
+
callbackWhenConfigIsReady(config);
|
|
1879
|
+
};
|
|
1880
|
+
return {
|
|
1881
|
+
computeConfigAndUpdate,
|
|
1882
|
+
ro
|
|
1883
|
+
};
|
|
1845
1884
|
}
|
|
1885
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
1886
|
+
const {
|
|
1887
|
+
adapter
|
|
1888
|
+
} = wireDef;
|
|
1889
|
+
const adapterContextToken = getAdapterToken(adapter);
|
|
1890
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
1891
|
+
return; // no provider found, nothing to be done
|
|
1892
|
+
}
|
|
1846
1893
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
return getReactiveProxy(target);
|
|
1894
|
+
const {
|
|
1895
|
+
elm,
|
|
1896
|
+
context: {
|
|
1897
|
+
wiredConnecting,
|
|
1898
|
+
wiredDisconnecting
|
|
1899
|
+
},
|
|
1900
|
+
renderer: {
|
|
1901
|
+
dispatchEvent
|
|
1856
1902
|
}
|
|
1857
|
-
|
|
1903
|
+
} = vm;
|
|
1904
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
1905
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
1906
|
+
// This event is responsible for connecting the host element with another
|
|
1907
|
+
// element in the composed path that is providing contextual data. The provider
|
|
1908
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
1909
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
1910
|
+
// guarantee that the linkage can be forged.
|
|
1911
|
+
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
1912
|
+
setNewContext(newContext) {
|
|
1913
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1914
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
1915
|
+
callbackWhenContextIsReady(newContext);
|
|
1916
|
+
},
|
|
1917
|
+
setDisconnectedCallback(disconnectCallback) {
|
|
1918
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
1919
|
+
// the the element hosting the wire is disconnected
|
|
1920
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
1921
|
+
}
|
|
1922
|
+
});
|
|
1923
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
1924
|
+
});
|
|
1858
1925
|
}
|
|
1859
|
-
function
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1926
|
+
function createConnector(vm, name, wireDef) {
|
|
1927
|
+
const {
|
|
1928
|
+
method,
|
|
1929
|
+
adapter,
|
|
1930
|
+
configCallback,
|
|
1931
|
+
dynamic
|
|
1932
|
+
} = wireDef;
|
|
1933
|
+
let debugInfo;
|
|
1934
|
+
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
1935
|
+
const dataCallback = value => {
|
|
1936
|
+
fieldOrMethodCallback(value);
|
|
1937
|
+
};
|
|
1938
|
+
let context;
|
|
1939
|
+
let connector;
|
|
1940
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
1941
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
1942
|
+
value: vm.elm
|
|
1943
|
+
});
|
|
1944
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
1945
|
+
value: dynamic
|
|
1946
|
+
});
|
|
1947
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
1948
|
+
// job
|
|
1949
|
+
connector = new adapter(dataCallback);
|
|
1950
|
+
}, noop);
|
|
1951
|
+
const updateConnectorConfig = config => {
|
|
1952
|
+
// every time the config is recomputed due to tracking,
|
|
1953
|
+
// this callback will be invoked with the new computed config
|
|
1954
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
1955
|
+
// job
|
|
1956
|
+
if ("production" !== 'production') ;
|
|
1957
|
+
connector.update(config, context);
|
|
1958
|
+
}, noop);
|
|
1959
|
+
};
|
|
1960
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
1961
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
1962
|
+
const {
|
|
1963
|
+
computeConfigAndUpdate,
|
|
1964
|
+
ro
|
|
1965
|
+
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
1966
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
1967
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
1968
|
+
createContextWatcher(vm, wireDef, newContext => {
|
|
1969
|
+
// every time the context is pushed into this component,
|
|
1970
|
+
// this callback will be invoked with the new computed context
|
|
1971
|
+
if (context !== newContext) {
|
|
1972
|
+
context = newContext;
|
|
1973
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
1974
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
1975
|
+
// (ever), while context can have identity
|
|
1976
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
1977
|
+
computeConfigAndUpdate();
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
return {
|
|
1983
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
1984
|
+
connector,
|
|
1985
|
+
computeConfigAndUpdate,
|
|
1986
|
+
resetConfigWatcher: () => ro.reset()
|
|
1987
|
+
};
|
|
1874
1988
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
* All rights reserved.
|
|
1879
|
-
* SPDX-License-Identifier: MIT
|
|
1880
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1881
|
-
*/
|
|
1882
|
-
/**
|
|
1883
|
-
* @wire decorator to wire fields and methods to a wire adapter in
|
|
1884
|
-
* LWC Components. This function implements the internals of this
|
|
1885
|
-
* decorator.
|
|
1886
|
-
*/
|
|
1887
|
-
function wire(_adapter, _config) {
|
|
1888
|
-
throw new Error();
|
|
1989
|
+
const AdapterToTokenMap = new Map();
|
|
1990
|
+
function getAdapterToken(adapter) {
|
|
1991
|
+
return AdapterToTokenMap.get(adapter);
|
|
1889
1992
|
}
|
|
1890
|
-
function
|
|
1993
|
+
function setAdapterToken(adapter, token) {
|
|
1994
|
+
AdapterToTokenMap.set(adapter, token);
|
|
1995
|
+
}
|
|
1996
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
1997
|
+
// support for callable adapters
|
|
1998
|
+
if (adapter.adapter) {
|
|
1999
|
+
adapter = adapter.adapter;
|
|
2000
|
+
}
|
|
2001
|
+
const method = descriptor.value;
|
|
2002
|
+
const def = {
|
|
2003
|
+
adapter,
|
|
2004
|
+
method,
|
|
2005
|
+
configCallback,
|
|
2006
|
+
dynamic
|
|
2007
|
+
};
|
|
2008
|
+
WireMetaMap.set(descriptor, def);
|
|
2009
|
+
}
|
|
2010
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2011
|
+
// support for callable adapters
|
|
2012
|
+
if (adapter.adapter) {
|
|
2013
|
+
adapter = adapter.adapter;
|
|
2014
|
+
}
|
|
2015
|
+
const def = {
|
|
2016
|
+
adapter,
|
|
2017
|
+
configCallback,
|
|
2018
|
+
dynamic
|
|
2019
|
+
};
|
|
2020
|
+
WireMetaMap.set(descriptor, def);
|
|
2021
|
+
}
|
|
2022
|
+
function installWireAdapters(vm) {
|
|
2023
|
+
const {
|
|
2024
|
+
context,
|
|
2025
|
+
def: {
|
|
2026
|
+
wire
|
|
2027
|
+
}
|
|
2028
|
+
} = vm;
|
|
2029
|
+
const wiredConnecting = context.wiredConnecting = [];
|
|
2030
|
+
const wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2031
|
+
for (const fieldNameOrMethod in wire) {
|
|
2032
|
+
const descriptor = wire[fieldNameOrMethod];
|
|
2033
|
+
const wireDef = WireMetaMap.get(descriptor);
|
|
2034
|
+
if (!isUndefined$1(wireDef)) {
|
|
2035
|
+
const {
|
|
2036
|
+
connector,
|
|
2037
|
+
computeConfigAndUpdate,
|
|
2038
|
+
resetConfigWatcher
|
|
2039
|
+
} = createConnector(vm, fieldNameOrMethod, wireDef);
|
|
2040
|
+
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2041
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2042
|
+
connector.connect();
|
|
2043
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2044
|
+
if (hasDynamicParams) {
|
|
2045
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
computeConfigAndUpdate();
|
|
2050
|
+
});
|
|
2051
|
+
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
2052
|
+
connector.disconnect();
|
|
2053
|
+
resetConfigWatcher();
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
function connectWireAdapters(vm) {
|
|
2059
|
+
const {
|
|
2060
|
+
wiredConnecting
|
|
2061
|
+
} = vm.context;
|
|
2062
|
+
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
2063
|
+
wiredConnecting[i]();
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
function disconnectWireAdapters(vm) {
|
|
2067
|
+
const {
|
|
2068
|
+
wiredDisconnecting
|
|
2069
|
+
} = vm.context;
|
|
2070
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2071
|
+
// job
|
|
2072
|
+
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
2073
|
+
wiredDisconnecting[i]();
|
|
2074
|
+
}
|
|
2075
|
+
}, noop);
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
/*
|
|
2079
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2080
|
+
* All rights reserved.
|
|
2081
|
+
* SPDX-License-Identifier: MIT
|
|
2082
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2083
|
+
*/
|
|
2084
|
+
function api$1() {
|
|
2085
|
+
throw new Error();
|
|
2086
|
+
}
|
|
2087
|
+
function createPublicPropertyDescriptor(key) {
|
|
2088
|
+
return {
|
|
2089
|
+
get() {
|
|
2090
|
+
const vm = getAssociatedVM(this);
|
|
2091
|
+
if (isBeingConstructed(vm)) {
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
componentValueObserved(vm, key);
|
|
2095
|
+
return vm.cmpProps[key];
|
|
2096
|
+
},
|
|
2097
|
+
set(newValue) {
|
|
2098
|
+
const vm = getAssociatedVM(this);
|
|
2099
|
+
vm.cmpProps[key] = newValue;
|
|
2100
|
+
componentValueMutated(vm, key);
|
|
2101
|
+
},
|
|
2102
|
+
enumerable: true,
|
|
2103
|
+
configurable: true,
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2107
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2108
|
+
if (!isFunction$1(get)) {
|
|
2109
|
+
throw new Error();
|
|
2110
|
+
}
|
|
2111
|
+
return {
|
|
2112
|
+
get() {
|
|
2113
|
+
return get.call(this);
|
|
2114
|
+
},
|
|
2115
|
+
set(newValue) {
|
|
2116
|
+
getAssociatedVM(this);
|
|
2117
|
+
if (set) {
|
|
2118
|
+
set.call(this, newValue);
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
enumerable,
|
|
2122
|
+
configurable,
|
|
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
|
+
function track(target) {
|
|
2133
|
+
if (arguments.length === 1) {
|
|
2134
|
+
return getReactiveProxy(target);
|
|
2135
|
+
}
|
|
2136
|
+
throw new Error();
|
|
2137
|
+
}
|
|
2138
|
+
function internalTrackDecorator(key) {
|
|
2139
|
+
return {
|
|
2140
|
+
get() {
|
|
2141
|
+
const vm = getAssociatedVM(this);
|
|
2142
|
+
componentValueObserved(vm, key);
|
|
2143
|
+
return vm.cmpFields[key];
|
|
2144
|
+
},
|
|
2145
|
+
set(newValue) {
|
|
2146
|
+
const vm = getAssociatedVM(this);
|
|
2147
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2148
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2149
|
+
},
|
|
2150
|
+
enumerable: true,
|
|
2151
|
+
configurable: true,
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
/*
|
|
2156
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2157
|
+
* All rights reserved.
|
|
2158
|
+
* SPDX-License-Identifier: MIT
|
|
2159
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2160
|
+
*/
|
|
2161
|
+
/**
|
|
2162
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2163
|
+
* LWC Components. This function implements the internals of this
|
|
2164
|
+
* decorator.
|
|
2165
|
+
*/
|
|
2166
|
+
function wire(_adapter, _config) {
|
|
2167
|
+
throw new Error();
|
|
2168
|
+
}
|
|
2169
|
+
function internalWireFieldDecorator(key) {
|
|
1891
2170
|
return {
|
|
1892
2171
|
get() {
|
|
1893
2172
|
const vm = getAssociatedVM(this);
|
|
@@ -2444,6 +2723,9 @@ var LWC = (function (exports) {
|
|
|
2444
2723
|
stylesheets: newStylesheets,
|
|
2445
2724
|
stylesheetToken: newStylesheetToken
|
|
2446
2725
|
} = template;
|
|
2726
|
+
const {
|
|
2727
|
+
stylesheets: newVmStylesheets
|
|
2728
|
+
} = vm;
|
|
2447
2729
|
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
2448
2730
|
const {
|
|
2449
2731
|
hasScopedStyles
|
|
@@ -2467,7 +2749,9 @@ var LWC = (function (exports) {
|
|
|
2467
2749
|
}
|
|
2468
2750
|
// Apply the new template styling token to the host element, if the new template has any
|
|
2469
2751
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
2470
|
-
|
|
2752
|
+
const hasNewStylesheets = hasStyles(newStylesheets);
|
|
2753
|
+
const hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
2754
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
2471
2755
|
newToken = newStylesheetToken;
|
|
2472
2756
|
}
|
|
2473
2757
|
// Set the new styling token on the host element
|
|
@@ -2531,10 +2815,17 @@ var LWC = (function (exports) {
|
|
|
2531
2815
|
stylesheets,
|
|
2532
2816
|
stylesheetToken
|
|
2533
2817
|
} = template;
|
|
2818
|
+
const {
|
|
2819
|
+
stylesheets: vmStylesheets
|
|
2820
|
+
} = vm;
|
|
2534
2821
|
let content = [];
|
|
2535
|
-
if (
|
|
2822
|
+
if (hasStyles(stylesheets)) {
|
|
2536
2823
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
2537
2824
|
}
|
|
2825
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
2826
|
+
if (hasStyles(vmStylesheets)) {
|
|
2827
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
2828
|
+
}
|
|
2538
2829
|
return content;
|
|
2539
2830
|
}
|
|
2540
2831
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -2572,10 +2863,13 @@ var LWC = (function (exports) {
|
|
|
2572
2863
|
const {
|
|
2573
2864
|
template
|
|
2574
2865
|
} = getComponentInternalDef(vnode.ctor);
|
|
2866
|
+
const {
|
|
2867
|
+
vm
|
|
2868
|
+
} = vnode;
|
|
2575
2869
|
const {
|
|
2576
2870
|
stylesheetToken
|
|
2577
2871
|
} = template;
|
|
2578
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
2872
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
2579
2873
|
}
|
|
2580
2874
|
function getNearestNativeShadowComponent(vm) {
|
|
2581
2875
|
const owner = getNearestShadowComponent(vm);
|
|
@@ -3158,6 +3452,28 @@ var LWC = (function (exports) {
|
|
|
3158
3452
|
// in fallback mode, the allocation will always set children to
|
|
3159
3453
|
// empty and delegate the real allocation to the slot elements
|
|
3160
3454
|
allocateChildren(n2, vm);
|
|
3455
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
3456
|
+
//
|
|
3457
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
3458
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
3459
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
3460
|
+
//
|
|
3461
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
3462
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
3463
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
3464
|
+
// mark the new children dynamic.
|
|
3465
|
+
//
|
|
3466
|
+
// Example:
|
|
3467
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
3468
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
3469
|
+
const {
|
|
3470
|
+
shadowMode,
|
|
3471
|
+
renderMode
|
|
3472
|
+
} = vm;
|
|
3473
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
3474
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
3475
|
+
markAsDynamicChildren(n2.children);
|
|
3476
|
+
}
|
|
3161
3477
|
}
|
|
3162
3478
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3163
3479
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -3319,20 +3635,65 @@ var LWC = (function (exports) {
|
|
|
3319
3635
|
//
|
|
3320
3636
|
// In case #2, we will always get a fresh VCustomElement.
|
|
3321
3637
|
const children = vnode.aChildren || vnode.children;
|
|
3322
|
-
vm.aChildren = children;
|
|
3323
3638
|
const {
|
|
3324
3639
|
renderMode,
|
|
3325
3640
|
shadowMode
|
|
3326
3641
|
} = vm;
|
|
3642
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
3643
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
3644
|
+
const allocatedChildren = flattenFragmentsInChildren(children);
|
|
3645
|
+
vnode.children = allocatedChildren;
|
|
3646
|
+
vm.aChildren = allocatedChildren;
|
|
3327
3647
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
3328
3648
|
// slow path
|
|
3329
|
-
allocateInSlot(vm,
|
|
3649
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
3330
3650
|
// save the allocated children in case this vnode is reused.
|
|
3331
|
-
vnode.aChildren =
|
|
3651
|
+
vnode.aChildren = allocatedChildren;
|
|
3332
3652
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
3333
3653
|
vnode.children = EmptyArray;
|
|
3334
3654
|
}
|
|
3335
3655
|
}
|
|
3656
|
+
/**
|
|
3657
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
3658
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
3659
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
3660
|
+
*
|
|
3661
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
3662
|
+
*
|
|
3663
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
3664
|
+
*/
|
|
3665
|
+
function flattenFragmentsInChildren(children) {
|
|
3666
|
+
const flattenedChildren = [];
|
|
3667
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
3668
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
3669
|
+
const nodeStack = [];
|
|
3670
|
+
let fragmentFound = false;
|
|
3671
|
+
for (let i = children.length - 1; i > -1; i -= 1) {
|
|
3672
|
+
const child = children[i];
|
|
3673
|
+
ArrayPush$1.call(nodeStack, child);
|
|
3674
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
3675
|
+
}
|
|
3676
|
+
if (!fragmentFound) {
|
|
3677
|
+
return children;
|
|
3678
|
+
}
|
|
3679
|
+
let currentNode;
|
|
3680
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
3681
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
3682
|
+
const fChildren = currentNode.children;
|
|
3683
|
+
// Ignore the start and end text node delimiters
|
|
3684
|
+
for (let i = fChildren.length - 2; i > 0; i -= 1) {
|
|
3685
|
+
ArrayPush$1.call(nodeStack, fChildren[i]);
|
|
3686
|
+
}
|
|
3687
|
+
} else {
|
|
3688
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
3692
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
3693
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
3694
|
+
markAsDynamicChildren(flattenedChildren);
|
|
3695
|
+
return flattenedChildren;
|
|
3696
|
+
}
|
|
3336
3697
|
function createViewModelHook(elm, vnode, renderer) {
|
|
3337
3698
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3338
3699
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -3354,22 +3715,20 @@ var LWC = (function (exports) {
|
|
|
3354
3715
|
});
|
|
3355
3716
|
return vm;
|
|
3356
3717
|
}
|
|
3357
|
-
|
|
3358
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
3359
|
-
*/
|
|
3360
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
3718
|
+
function allocateInSlot(vm, children, owner) {
|
|
3361
3719
|
var _a, _b;
|
|
3720
|
+
const {
|
|
3721
|
+
cmpSlots: {
|
|
3722
|
+
slotAssignments: oldSlotsMapping
|
|
3723
|
+
}
|
|
3724
|
+
} = vm;
|
|
3725
|
+
const cmpSlotsMapping = create(null);
|
|
3726
|
+
// Collect all slots into cmpSlotsMapping
|
|
3362
3727
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
3363
3728
|
const vnode = children[i];
|
|
3364
3729
|
if (isNull(vnode)) {
|
|
3365
3730
|
continue;
|
|
3366
3731
|
}
|
|
3367
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
3368
|
-
if (isVFragment(vnode)) {
|
|
3369
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
3370
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
3371
|
-
continue;
|
|
3372
|
-
}
|
|
3373
3732
|
let slotName = '';
|
|
3374
3733
|
if (isVBaseElement(vnode)) {
|
|
3375
3734
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -3379,15 +3738,6 @@ var LWC = (function (exports) {
|
|
|
3379
3738
|
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
3380
3739
|
ArrayPush$1.call(vnodes, vnode);
|
|
3381
3740
|
}
|
|
3382
|
-
}
|
|
3383
|
-
function allocateInSlot(vm, children, owner) {
|
|
3384
|
-
const {
|
|
3385
|
-
cmpSlots: {
|
|
3386
|
-
slotAssignments: oldSlotsMapping
|
|
3387
|
-
}
|
|
3388
|
-
} = vm;
|
|
3389
|
-
const cmpSlotsMapping = create(null);
|
|
3390
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
3391
3741
|
vm.cmpSlots = {
|
|
3392
3742
|
owner,
|
|
3393
3743
|
slotAssignments: cmpSlotsMapping
|
|
@@ -3418,14 +3768,14 @@ var LWC = (function (exports) {
|
|
|
3418
3768
|
}
|
|
3419
3769
|
}
|
|
3420
3770
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3421
|
-
const
|
|
3422
|
-
// dynamic children means it was generated by an iteration
|
|
3423
|
-
//
|
|
3771
|
+
const DynamicChildren = new WeakMap();
|
|
3772
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
3773
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
3424
3774
|
function markAsDynamicChildren(children) {
|
|
3425
|
-
|
|
3775
|
+
DynamicChildren.set(children, 1);
|
|
3426
3776
|
}
|
|
3427
3777
|
function hasDynamicChildren(children) {
|
|
3428
|
-
return
|
|
3778
|
+
return DynamicChildren.has(children);
|
|
3429
3779
|
}
|
|
3430
3780
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
3431
3781
|
const map = {};
|
|
@@ -4084,7 +4434,7 @@ var LWC = (function (exports) {
|
|
|
4084
4434
|
// Create a brand new template cache for the swapped templated.
|
|
4085
4435
|
context.tplCache = create(null);
|
|
4086
4436
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
4087
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
4437
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
4088
4438
|
// Update the scoping token on the host element.
|
|
4089
4439
|
updateStylesheetToken(vm, html);
|
|
4090
4440
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -4119,9 +4469,8 @@ var LWC = (function (exports) {
|
|
|
4119
4469
|
});
|
|
4120
4470
|
return vnodes;
|
|
4121
4471
|
}
|
|
4122
|
-
function
|
|
4123
|
-
|
|
4124
|
-
if (!isUndefined$1(stylesheets)) {
|
|
4472
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
4473
|
+
if (hasStyles(stylesheets)) {
|
|
4125
4474
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4126
4475
|
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
4127
4476
|
return true;
|
|
@@ -4130,6 +4479,15 @@ var LWC = (function (exports) {
|
|
|
4130
4479
|
}
|
|
4131
4480
|
return false;
|
|
4132
4481
|
}
|
|
4482
|
+
function computeHasScopedStyles(template, vm) {
|
|
4483
|
+
const { stylesheets } = template;
|
|
4484
|
+
const vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
4485
|
+
return (computeHasScopedStylesInStylesheets(stylesheets) ||
|
|
4486
|
+
computeHasScopedStylesInStylesheets(vmStylesheets));
|
|
4487
|
+
}
|
|
4488
|
+
function hasStyles(stylesheets) {
|
|
4489
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
4490
|
+
}
|
|
4133
4491
|
let vmBeingConstructed = null;
|
|
4134
4492
|
function isBeingConstructed(vm) {
|
|
4135
4493
|
return vmBeingConstructed === vm;
|
|
@@ -4406,6 +4764,7 @@ var LWC = (function (exports) {
|
|
|
4406
4764
|
// Properties set right after VM creation.
|
|
4407
4765
|
tro: null,
|
|
4408
4766
|
shadowMode: null,
|
|
4767
|
+
stylesheets: null,
|
|
4409
4768
|
// Properties set by the LightningElement constructor.
|
|
4410
4769
|
component: null,
|
|
4411
4770
|
shadowRoot: null,
|
|
@@ -4415,6 +4774,7 @@ var LWC = (function (exports) {
|
|
|
4415
4774
|
getHook,
|
|
4416
4775
|
renderer
|
|
4417
4776
|
};
|
|
4777
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
4418
4778
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
4419
4779
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4420
4780
|
// Create component instance associated to the vm and the element.
|
|
@@ -4425,6 +4785,40 @@ var LWC = (function (exports) {
|
|
|
4425
4785
|
}
|
|
4426
4786
|
return vm;
|
|
4427
4787
|
}
|
|
4788
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
4789
|
+
let valid = true;
|
|
4790
|
+
const validate = arrayOrStylesheet => {
|
|
4791
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
4792
|
+
for (let i = 0; i < arrayOrStylesheet.length; i++) {
|
|
4793
|
+
validate(arrayOrStylesheet[i]);
|
|
4794
|
+
}
|
|
4795
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
4796
|
+
// function assumed to be a stylesheet factory
|
|
4797
|
+
valid = false;
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
if (!isArray$1(stylesheets)) {
|
|
4801
|
+
valid = false;
|
|
4802
|
+
} else {
|
|
4803
|
+
validate(stylesheets);
|
|
4804
|
+
}
|
|
4805
|
+
return valid;
|
|
4806
|
+
}
|
|
4807
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
4808
|
+
function computeStylesheets(vm, ctor) {
|
|
4809
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
4810
|
+
const {
|
|
4811
|
+
stylesheets
|
|
4812
|
+
} = ctor;
|
|
4813
|
+
if (!isUndefined$1(stylesheets)) {
|
|
4814
|
+
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
4815
|
+
if (valid) {
|
|
4816
|
+
return flattenStylesheets(stylesheets);
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
return null;
|
|
4821
|
+
}
|
|
4428
4822
|
function computeShadowMode(vm, renderer) {
|
|
4429
4823
|
const {
|
|
4430
4824
|
def
|
|
@@ -4757,262 +5151,134 @@ var LWC = (function (exports) {
|
|
|
4757
5151
|
* SPDX-License-Identifier: MIT
|
|
4758
5152
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4759
5153
|
*/
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
updateComponentValue(vm, name, value);
|
|
4785
|
-
};
|
|
5154
|
+
//
|
|
5155
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
5156
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
5157
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
5158
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
5159
|
+
//
|
|
5160
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
5161
|
+
const getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
5162
|
+
const querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
5163
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
5164
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
5165
|
+
}
|
|
5166
|
+
function reportViolation(source, target, attrName) {
|
|
5167
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
5168
|
+
// shadow for a violation to be detected.
|
|
5169
|
+
let vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
5170
|
+
if (isUndefined$1(vm)) {
|
|
5171
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
5172
|
+
}
|
|
5173
|
+
if (isUndefined$1(vm)) {
|
|
5174
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
5175
|
+
return;
|
|
5176
|
+
}
|
|
5177
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
|
|
4786
5178
|
}
|
|
4787
|
-
function
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
4791
|
-
// job
|
|
4792
|
-
method.call(vm.component, value);
|
|
4793
|
-
}, noop);
|
|
4794
|
-
};
|
|
5179
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
5180
|
+
// split on whitespace and skip empty strings after splitting
|
|
5181
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
4795
5182
|
}
|
|
4796
|
-
function
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
if (hasPendingConfig === false) {
|
|
4801
|
-
hasPendingConfig = true;
|
|
4802
|
-
// collect new config in the micro-task
|
|
4803
|
-
Promise.resolve().then(() => {
|
|
4804
|
-
hasPendingConfig = false;
|
|
4805
|
-
// resetting current reactive params
|
|
4806
|
-
ro.reset();
|
|
4807
|
-
// dispatching a new config due to a change in the configuration
|
|
4808
|
-
computeConfigAndUpdate();
|
|
4809
|
-
});
|
|
5183
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
5184
|
+
const root = elm.getRootNode();
|
|
5185
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
5186
|
+
return;
|
|
4810
5187
|
}
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
return; // no provider found, nothing to be done
|
|
4832
|
-
}
|
|
4833
|
-
|
|
4834
|
-
const {
|
|
4835
|
-
elm,
|
|
4836
|
-
context: {
|
|
4837
|
-
wiredConnecting,
|
|
4838
|
-
wiredDisconnecting
|
|
4839
|
-
},
|
|
4840
|
-
renderer: {
|
|
4841
|
-
dispatchEvent
|
|
5188
|
+
if (attrName === 'id') {
|
|
5189
|
+
// elm is the target, find the source
|
|
5190
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
5191
|
+
// if our id is null or empty, nobody can reference us
|
|
5192
|
+
return;
|
|
5193
|
+
}
|
|
5194
|
+
for (const idRefAttrName of ID_REFERENCING_ATTRIBUTES_SET) {
|
|
5195
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
5196
|
+
// that reference multiple IDs, separated by whitespace.
|
|
5197
|
+
const query = `[${idRefAttrName}~="${CSS.escape(attrValue)}"]`;
|
|
5198
|
+
const sourceElements = querySelectorAll.call(document, query);
|
|
5199
|
+
for (let i = 0; i < sourceElements.length; i++) {
|
|
5200
|
+
const sourceElement = sourceElements[i];
|
|
5201
|
+
const sourceRoot = sourceElement.getRootNode();
|
|
5202
|
+
if (sourceRoot !== root) {
|
|
5203
|
+
reportViolation(sourceElement, elm);
|
|
5204
|
+
break;
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
4842
5208
|
}
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
callbackWhenContextIsReady(newContext);
|
|
4856
|
-
},
|
|
4857
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
4858
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
4859
|
-
// the the element hosting the wire is disconnected
|
|
4860
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
4861
|
-
}
|
|
4862
|
-
});
|
|
4863
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
4864
|
-
});
|
|
4865
|
-
}
|
|
4866
|
-
function createConnector(vm, name, wireDef) {
|
|
4867
|
-
const {
|
|
4868
|
-
method,
|
|
4869
|
-
adapter,
|
|
4870
|
-
configCallback,
|
|
4871
|
-
dynamic
|
|
4872
|
-
} = wireDef;
|
|
4873
|
-
let debugInfo;
|
|
4874
|
-
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
4875
|
-
const dataCallback = value => {
|
|
4876
|
-
fieldOrMethodCallback(value);
|
|
4877
|
-
};
|
|
4878
|
-
let context;
|
|
4879
|
-
let connector;
|
|
4880
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
4881
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
4882
|
-
value: vm.elm
|
|
4883
|
-
});
|
|
4884
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
4885
|
-
value: dynamic
|
|
4886
|
-
});
|
|
4887
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
4888
|
-
// job
|
|
4889
|
-
connector = new adapter(dataCallback);
|
|
4890
|
-
}, noop);
|
|
4891
|
-
const updateConnectorConfig = config => {
|
|
4892
|
-
// every time the config is recomputed due to tracking,
|
|
4893
|
-
// this callback will be invoked with the new computed config
|
|
4894
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
4895
|
-
// job
|
|
4896
|
-
if ("production" !== 'production') ;
|
|
4897
|
-
connector.update(config, context);
|
|
4898
|
-
}, noop);
|
|
4899
|
-
};
|
|
4900
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
4901
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
4902
|
-
const {
|
|
4903
|
-
computeConfigAndUpdate,
|
|
4904
|
-
ro
|
|
4905
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
4906
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
4907
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
4908
|
-
createContextWatcher(vm, wireDef, newContext => {
|
|
4909
|
-
// every time the context is pushed into this component,
|
|
4910
|
-
// this callback will be invoked with the new computed context
|
|
4911
|
-
if (context !== newContext) {
|
|
4912
|
-
context = newContext;
|
|
4913
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
4914
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
4915
|
-
// (ever), while context can have identity
|
|
4916
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
4917
|
-
computeConfigAndUpdate();
|
|
5209
|
+
else {
|
|
5210
|
+
// elm is the source, find the target
|
|
5211
|
+
const ids = parseIdRefAttributeValue(attrValue);
|
|
5212
|
+
for (const id of ids) {
|
|
5213
|
+
const target = getElementById.call(document, id);
|
|
5214
|
+
if (!isNull(target)) {
|
|
5215
|
+
const targetRoot = target.getRootNode();
|
|
5216
|
+
if (targetRoot !== root) {
|
|
5217
|
+
// target element's shadow root is not the same as ours
|
|
5218
|
+
reportViolation(elm, target);
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
4918
5221
|
}
|
|
4919
|
-
}
|
|
4920
|
-
});
|
|
4921
|
-
}
|
|
4922
|
-
return {
|
|
4923
|
-
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
4924
|
-
connector,
|
|
4925
|
-
computeConfigAndUpdate,
|
|
4926
|
-
resetConfigWatcher: () => ro.reset()
|
|
4927
|
-
};
|
|
4928
|
-
}
|
|
4929
|
-
const AdapterToTokenMap = new Map();
|
|
4930
|
-
function getAdapterToken(adapter) {
|
|
4931
|
-
return AdapterToTokenMap.get(adapter);
|
|
4932
|
-
}
|
|
4933
|
-
function setAdapterToken(adapter, token) {
|
|
4934
|
-
AdapterToTokenMap.set(adapter, token);
|
|
4935
|
-
}
|
|
4936
|
-
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
4937
|
-
// support for callable adapters
|
|
4938
|
-
if (adapter.adapter) {
|
|
4939
|
-
adapter = adapter.adapter;
|
|
4940
|
-
}
|
|
4941
|
-
const method = descriptor.value;
|
|
4942
|
-
const def = {
|
|
4943
|
-
adapter,
|
|
4944
|
-
method,
|
|
4945
|
-
configCallback,
|
|
4946
|
-
dynamic
|
|
4947
|
-
};
|
|
4948
|
-
WireMetaMap.set(descriptor, def);
|
|
4949
|
-
}
|
|
4950
|
-
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
4951
|
-
// support for callable adapters
|
|
4952
|
-
if (adapter.adapter) {
|
|
4953
|
-
adapter = adapter.adapter;
|
|
4954
|
-
}
|
|
4955
|
-
const def = {
|
|
4956
|
-
adapter,
|
|
4957
|
-
configCallback,
|
|
4958
|
-
dynamic
|
|
4959
|
-
};
|
|
4960
|
-
WireMetaMap.set(descriptor, def);
|
|
4961
|
-
}
|
|
4962
|
-
function installWireAdapters(vm) {
|
|
4963
|
-
const {
|
|
4964
|
-
context,
|
|
4965
|
-
def: {
|
|
4966
|
-
wire
|
|
4967
5222
|
}
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5223
|
+
}
|
|
5224
|
+
let enabled = false;
|
|
5225
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
5226
|
+
// reporting is not enabled. It should also only run once
|
|
5227
|
+
function enableDetection() {
|
|
5228
|
+
if (enabled) {
|
|
5229
|
+
return; // don't double-apply the patches
|
|
5230
|
+
}
|
|
5231
|
+
enabled = true;
|
|
5232
|
+
const { setAttribute } = Element.prototype;
|
|
5233
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
5234
|
+
assign(Element.prototype, {
|
|
5235
|
+
setAttribute(attrName, attrValue) {
|
|
5236
|
+
setAttribute.call(this, attrName, attrValue);
|
|
5237
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
5238
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
5239
|
+
}
|
|
5240
|
+
},
|
|
5241
|
+
});
|
|
5242
|
+
// Detect `elm.id = 'foo'`
|
|
5243
|
+
const idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
5244
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
5245
|
+
const { get, set } = idDescriptor;
|
|
5246
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
5247
|
+
if (isFunction$1(get) && isFunction$1(set)) {
|
|
5248
|
+
defineProperty(Element.prototype, 'id', {
|
|
5249
|
+
get() {
|
|
5250
|
+
return get.call(this);
|
|
5251
|
+
},
|
|
5252
|
+
set(value) {
|
|
5253
|
+
set.call(this, value);
|
|
5254
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
5255
|
+
},
|
|
5256
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
5257
|
+
enumerable: true,
|
|
5258
|
+
configurable: true,
|
|
5259
|
+
});
|
|
4988
5260
|
}
|
|
4989
|
-
computeConfigAndUpdate();
|
|
4990
|
-
});
|
|
4991
|
-
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
4992
|
-
connector.disconnect();
|
|
4993
|
-
resetConfigWatcher();
|
|
4994
|
-
});
|
|
4995
5261
|
}
|
|
4996
|
-
}
|
|
4997
5262
|
}
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
5003
|
-
wiredConnecting[i]();
|
|
5004
|
-
}
|
|
5263
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
5264
|
+
// for unsupported browsers
|
|
5265
|
+
function supportsCssEscape() {
|
|
5266
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
5005
5267
|
}
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5268
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
5269
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
5270
|
+
function isSyntheticShadowLoaded() {
|
|
5271
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
5272
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
5273
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5274
|
+
}
|
|
5275
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
5276
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
5277
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
5278
|
+
{
|
|
5279
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
5280
|
+
onReportingEnabled(enableDetection);
|
|
5014
5281
|
}
|
|
5015
|
-
}, noop);
|
|
5016
5282
|
}
|
|
5017
5283
|
|
|
5018
5284
|
/*
|
|
@@ -6380,7 +6646,7 @@ var LWC = (function (exports) {
|
|
|
6380
6646
|
function isNull(obj) {
|
|
6381
6647
|
return obj === null;
|
|
6382
6648
|
}
|
|
6383
|
-
/** version: 2.
|
|
6649
|
+
/** version: 2.35.0 */
|
|
6384
6650
|
|
|
6385
6651
|
/*
|
|
6386
6652
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6933,10 +7199,11 @@ var LWC = (function (exports) {
|
|
|
6933
7199
|
});
|
|
6934
7200
|
freeze(LightningElement);
|
|
6935
7201
|
seal(LightningElement.prototype);
|
|
6936
|
-
/* version: 2.
|
|
7202
|
+
/* version: 2.35.0 */
|
|
6937
7203
|
|
|
6938
7204
|
exports.LightningElement = LightningElement;
|
|
6939
7205
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
7206
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
6940
7207
|
exports.api = api$1;
|
|
6941
7208
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
6942
7209
|
exports.createContextProvider = createContextProvider;
|