lwc 2.34.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 +742 -493
- package/dist/engine-dom/iife/es2017/engine-dom.js +742 -492
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +777 -641
- package/dist/engine-dom/iife/es5/engine-dom.js +882 -618
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +732 -579
- package/dist/engine-dom/umd/es2017/engine-dom.js +742 -492
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +777 -641
- package/dist/engine-dom/umd/es5/engine-dom.js +882 -618
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +732 -579
- package/dist/engine-server/commonjs/es2017/engine-server.js +635 -603
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +635 -603
- 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
|
@@ -47,7 +47,7 @@ const { assign, create, defineProperties, defineProperty, freeze, getOwnProperty
|
|
|
47
47
|
const { isArray: isArray$1 } = Array;
|
|
48
48
|
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;
|
|
49
49
|
const { fromCharCode: StringFromCharCode } = String;
|
|
50
|
-
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
50
|
+
const { charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
51
51
|
function isUndefined$1(obj) {
|
|
52
52
|
return obj === undefined;
|
|
53
53
|
}
|
|
@@ -233,6 +233,8 @@ const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
|
233
233
|
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
234
234
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
235
235
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
236
|
+
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
237
|
+
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
236
238
|
|
|
237
239
|
/*
|
|
238
240
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
@@ -472,9 +474,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
472
474
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
473
475
|
*/
|
|
474
476
|
// Increment whenever the LWC template compiler changes
|
|
475
|
-
const LWC_VERSION = "2.
|
|
477
|
+
const LWC_VERSION = "2.35.0";
|
|
476
478
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
477
|
-
/** version: 2.
|
|
479
|
+
/** version: 2.35.0 */
|
|
478
480
|
|
|
479
481
|
/*
|
|
480
482
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -583,7 +585,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
583
585
|
setFeatureFlag(name, value);
|
|
584
586
|
}
|
|
585
587
|
}
|
|
586
|
-
/** version: 2.
|
|
588
|
+
/** version: 2.35.0 */
|
|
587
589
|
|
|
588
590
|
/**
|
|
589
591
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -647,7 +649,7 @@ function applyAriaReflection(prototype = Element.prototype) {
|
|
|
647
649
|
}
|
|
648
650
|
}
|
|
649
651
|
}
|
|
650
|
-
/** version: 2.
|
|
652
|
+
/** version: 2.35.0 */
|
|
651
653
|
|
|
652
654
|
/* proxy-compat-disable */
|
|
653
655
|
|
|
@@ -673,87 +675,6 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
673
675
|
}));
|
|
674
676
|
});
|
|
675
677
|
}
|
|
676
|
-
const SPACE_CHAR = 32;
|
|
677
|
-
const EmptyObject = seal(create(null));
|
|
678
|
-
const EmptyArray = seal([]);
|
|
679
|
-
function guid() {
|
|
680
|
-
function s4() {
|
|
681
|
-
return Math.floor((1 + Math.random()) * 0x10000)
|
|
682
|
-
.toString(16)
|
|
683
|
-
.substring(1);
|
|
684
|
-
}
|
|
685
|
-
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
686
|
-
}
|
|
687
|
-
function flattenStylesheets(stylesheets) {
|
|
688
|
-
const list = [];
|
|
689
|
-
for (const stylesheet of stylesheets) {
|
|
690
|
-
if (!Array.isArray(stylesheet)) {
|
|
691
|
-
list.push(stylesheet);
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
return list;
|
|
698
|
-
}
|
|
699
|
-
// Set a ref (lwc:ref) on a VM, from a template API
|
|
700
|
-
function setRefVNode(vm, ref, vnode) {
|
|
701
|
-
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
702
|
-
throw new Error('refVNodes must be defined when setting a ref');
|
|
703
|
-
}
|
|
704
|
-
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
705
|
-
// If not, then something went wrong and we threw an error above.
|
|
706
|
-
const refVNodes = vm.refVNodes;
|
|
707
|
-
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
708
|
-
// in depth-first traversal order.
|
|
709
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
710
|
-
refVNodes[ref] = vnode;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/*
|
|
715
|
-
* Copyright (c) 2019, salesforce.com, inc.
|
|
716
|
-
* All rights reserved.
|
|
717
|
-
* SPDX-License-Identifier: MIT
|
|
718
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
719
|
-
*/
|
|
720
|
-
const TargetToReactiveRecordMap = new WeakMap();
|
|
721
|
-
function valueMutated(target, key) {
|
|
722
|
-
const reactiveRecord = TargetToReactiveRecordMap.get(target);
|
|
723
|
-
if (!isUndefined$1(reactiveRecord)) {
|
|
724
|
-
const reactiveObservers = reactiveRecord[key];
|
|
725
|
-
if (!isUndefined$1(reactiveObservers)) {
|
|
726
|
-
for (let i = 0, len = reactiveObservers.length; i < len; i += 1) {
|
|
727
|
-
const ro = reactiveObservers[i];
|
|
728
|
-
ro.notify();
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
function valueObserved(target, key) {
|
|
734
|
-
// We should determine if an active Observing Record is present to track mutations.
|
|
735
|
-
{
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
/*
|
|
741
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
742
|
-
* All rights reserved.
|
|
743
|
-
* SPDX-License-Identifier: MIT
|
|
744
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
745
|
-
*/
|
|
746
|
-
const DUMMY_REACTIVE_OBSERVER = {
|
|
747
|
-
observe(job) {
|
|
748
|
-
job();
|
|
749
|
-
},
|
|
750
|
-
reset() { },
|
|
751
|
-
link() { },
|
|
752
|
-
};
|
|
753
|
-
function createReactiveObserver(callback) {
|
|
754
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
755
|
-
return DUMMY_REACTIVE_OBSERVER;
|
|
756
|
-
}
|
|
757
678
|
|
|
758
679
|
/*
|
|
759
680
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -808,11 +729,25 @@ function addErrorComponentStack(vm, error) {
|
|
|
808
729
|
* SPDX-License-Identifier: MIT
|
|
809
730
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
810
731
|
*/
|
|
811
|
-
|
|
732
|
+
const alreadyLoggedMessages = new Set();
|
|
733
|
+
// @ts-ignore
|
|
734
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
735
|
+
// @ts-ignore
|
|
736
|
+
window.__lwcResetAlreadyLoggedMessages = () => {
|
|
737
|
+
alreadyLoggedMessages.clear();
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function log(method, message, vm, once) {
|
|
812
741
|
let msg = `[LWC ${method}]: ${message}`;
|
|
813
742
|
if (!isUndefined$1(vm)) {
|
|
814
743
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
815
744
|
}
|
|
745
|
+
if (once) {
|
|
746
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
alreadyLoggedMessages.add(msg);
|
|
750
|
+
}
|
|
816
751
|
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
817
752
|
if (process.env.NODE_ENV === 'test') {
|
|
818
753
|
/* eslint-disable-next-line no-console */
|
|
@@ -828,7 +763,88 @@ function log(method, message, vm) {
|
|
|
828
763
|
}
|
|
829
764
|
}
|
|
830
765
|
function logError(message, vm) {
|
|
831
|
-
log('error', message, vm);
|
|
766
|
+
log('error', message, vm, false);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/*
|
|
770
|
+
* Copyright (c) 2019, salesforce.com, inc.
|
|
771
|
+
* All rights reserved.
|
|
772
|
+
* SPDX-License-Identifier: MIT
|
|
773
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
774
|
+
*/
|
|
775
|
+
const TargetToReactiveRecordMap = new WeakMap();
|
|
776
|
+
function valueMutated(target, key) {
|
|
777
|
+
const reactiveRecord = TargetToReactiveRecordMap.get(target);
|
|
778
|
+
if (!isUndefined$1(reactiveRecord)) {
|
|
779
|
+
const reactiveObservers = reactiveRecord[key];
|
|
780
|
+
if (!isUndefined$1(reactiveObservers)) {
|
|
781
|
+
for (let i = 0, len = reactiveObservers.length; i < len; i += 1) {
|
|
782
|
+
const ro = reactiveObservers[i];
|
|
783
|
+
ro.notify();
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function valueObserved(target, key) {
|
|
789
|
+
// We should determine if an active Observing Record is present to track mutations.
|
|
790
|
+
{
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/*
|
|
796
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
797
|
+
* All rights reserved.
|
|
798
|
+
* SPDX-License-Identifier: MIT
|
|
799
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
800
|
+
*/
|
|
801
|
+
const DUMMY_REACTIVE_OBSERVER = {
|
|
802
|
+
observe(job) {
|
|
803
|
+
job();
|
|
804
|
+
},
|
|
805
|
+
reset() { },
|
|
806
|
+
link() { },
|
|
807
|
+
};
|
|
808
|
+
function createReactiveObserver(callback) {
|
|
809
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
810
|
+
return DUMMY_REACTIVE_OBSERVER;
|
|
811
|
+
}
|
|
812
|
+
const SPACE_CHAR = 32;
|
|
813
|
+
const EmptyObject = seal(create(null));
|
|
814
|
+
const EmptyArray = seal([]);
|
|
815
|
+
function guid() {
|
|
816
|
+
function s4() {
|
|
817
|
+
return Math.floor((1 + Math.random()) * 0x10000)
|
|
818
|
+
.toString(16)
|
|
819
|
+
.substring(1);
|
|
820
|
+
}
|
|
821
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
822
|
+
}
|
|
823
|
+
function flattenStylesheets(stylesheets) {
|
|
824
|
+
const list = [];
|
|
825
|
+
for (const stylesheet of stylesheets) {
|
|
826
|
+
if (!Array.isArray(stylesheet)) {
|
|
827
|
+
list.push(stylesheet);
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return list;
|
|
834
|
+
}
|
|
835
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
836
|
+
function setRefVNode(vm, ref, vnode) {
|
|
837
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
838
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
839
|
+
}
|
|
840
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
841
|
+
// If not, then something went wrong and we threw an error above.
|
|
842
|
+
const refVNodes = vm.refVNodes;
|
|
843
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
844
|
+
// in depth-first traversal order.
|
|
845
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
846
|
+
refVNodes[ref] = vnode;
|
|
847
|
+
}
|
|
832
848
|
}
|
|
833
849
|
|
|
834
850
|
/*
|
|
@@ -883,7 +899,7 @@ function offsetPropertyErrorMessage(name) {
|
|
|
883
899
|
//
|
|
884
900
|
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
885
901
|
// for e.g. "dropzone" should suffice.
|
|
886
|
-
const globalHTMLProperties =
|
|
902
|
+
const globalHTMLProperties = {
|
|
887
903
|
accessKey: {
|
|
888
904
|
attribute: 'accesskey',
|
|
889
905
|
},
|
|
@@ -968,7 +984,7 @@ const globalHTMLProperties = assign(create(null), {
|
|
|
968
984
|
role: {
|
|
969
985
|
attribute: 'role',
|
|
970
986
|
},
|
|
971
|
-
}
|
|
987
|
+
};
|
|
972
988
|
let controlledElement = null;
|
|
973
989
|
let controlledAttributeName;
|
|
974
990
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -2421,70 +2437,273 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
2421
2437
|
* SPDX-License-Identifier: MIT
|
|
2422
2438
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2423
2439
|
*/
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2440
|
+
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
2441
|
+
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
2442
|
+
const WIRE_DEBUG_ENTRY = '@wire';
|
|
2443
|
+
const WireMetaMap = new Map();
|
|
2444
|
+
class WireContextRegistrationEvent extends CustomEvent {
|
|
2445
|
+
constructor(adapterToken, {
|
|
2446
|
+
setNewContext,
|
|
2447
|
+
setDisconnectedCallback
|
|
2448
|
+
}) {
|
|
2449
|
+
super(adapterToken, {
|
|
2450
|
+
bubbles: true,
|
|
2451
|
+
composed: true
|
|
2452
|
+
});
|
|
2453
|
+
defineProperties(this, {
|
|
2454
|
+
setNewContext: {
|
|
2455
|
+
value: setNewContext
|
|
2456
|
+
},
|
|
2457
|
+
setDisconnectedCallback: {
|
|
2458
|
+
value: setDisconnectedCallback
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2429
2462
|
}
|
|
2430
|
-
function
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
if (isBeingConstructed(vm)) {
|
|
2435
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2436
|
-
logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
2437
|
-
}
|
|
2438
|
-
return;
|
|
2439
|
-
}
|
|
2440
|
-
return vm.cmpProps[key];
|
|
2441
|
-
},
|
|
2442
|
-
set(newValue) {
|
|
2443
|
-
const vm = getAssociatedVM(this);
|
|
2444
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2445
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2446
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2447
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2448
|
-
}
|
|
2449
|
-
vm.cmpProps[key] = newValue;
|
|
2450
|
-
},
|
|
2451
|
-
enumerable: true,
|
|
2452
|
-
configurable: true,
|
|
2453
|
-
};
|
|
2463
|
+
function createFieldDataCallback(vm, name) {
|
|
2464
|
+
return value => {
|
|
2465
|
+
updateComponentValue(vm, name, value);
|
|
2466
|
+
};
|
|
2454
2467
|
}
|
|
2455
|
-
function
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2468
|
+
function createMethodDataCallback(vm, method) {
|
|
2469
|
+
return value => {
|
|
2470
|
+
// dispatching new value into the wired method
|
|
2471
|
+
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
2472
|
+
// job
|
|
2473
|
+
method.call(vm.component, value);
|
|
2474
|
+
}, noop);
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
2478
|
+
// creating the reactive observer for reactive params when needed
|
|
2479
|
+
const ro = createReactiveObserver();
|
|
2480
|
+
const computeConfigAndUpdate = () => {
|
|
2481
|
+
let config;
|
|
2482
|
+
ro.observe(() => config = configCallback(component));
|
|
2483
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2484
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
2485
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
2486
|
+
callbackWhenConfigIsReady(config);
|
|
2487
|
+
};
|
|
2488
|
+
return {
|
|
2489
|
+
computeConfigAndUpdate,
|
|
2490
|
+
ro
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
2494
|
+
const {
|
|
2495
|
+
adapter
|
|
2496
|
+
} = wireDef;
|
|
2497
|
+
const adapterContextToken = getAdapterToken(adapter);
|
|
2498
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
2499
|
+
return; // no provider found, nothing to be done
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
const {
|
|
2503
|
+
elm,
|
|
2504
|
+
context: {
|
|
2505
|
+
wiredConnecting,
|
|
2506
|
+
wiredDisconnecting
|
|
2507
|
+
},
|
|
2508
|
+
renderer: {
|
|
2509
|
+
dispatchEvent
|
|
2510
|
+
}
|
|
2511
|
+
} = vm;
|
|
2512
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
2513
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2514
|
+
// This event is responsible for connecting the host element with another
|
|
2515
|
+
// element in the composed path that is providing contextual data. The provider
|
|
2516
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
2517
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
2518
|
+
// guarantee that the linkage can be forged.
|
|
2519
|
+
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
2520
|
+
setNewContext(newContext) {
|
|
2521
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2522
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
2523
|
+
callbackWhenContextIsReady(newContext);
|
|
2524
|
+
},
|
|
2525
|
+
setDisconnectedCallback(disconnectCallback) {
|
|
2526
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
2527
|
+
// the the element hosting the wire is disconnected
|
|
2528
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
2529
|
+
}
|
|
2530
|
+
});
|
|
2531
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
function createConnector(vm, name, wireDef) {
|
|
2535
|
+
const {
|
|
2536
|
+
method,
|
|
2537
|
+
adapter,
|
|
2538
|
+
configCallback,
|
|
2539
|
+
dynamic
|
|
2540
|
+
} = wireDef;
|
|
2541
|
+
let debugInfo;
|
|
2542
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2543
|
+
const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
2544
|
+
debugInfo = create(null);
|
|
2545
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2546
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
2547
|
+
}
|
|
2548
|
+
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
2549
|
+
const dataCallback = value => {
|
|
2550
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2551
|
+
debugInfo.data = value;
|
|
2552
|
+
// Note: most of the time, the data provided is for the current config, but there may be
|
|
2553
|
+
// some conditions in which it does not, ex:
|
|
2554
|
+
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
2555
|
+
debugInfo.wasDataProvisionedForConfig = true;
|
|
2556
|
+
}
|
|
2557
|
+
fieldOrMethodCallback(value);
|
|
2558
|
+
};
|
|
2559
|
+
let context;
|
|
2560
|
+
let connector;
|
|
2561
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
2562
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
2563
|
+
value: vm.elm
|
|
2564
|
+
});
|
|
2565
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
2566
|
+
value: dynamic
|
|
2567
|
+
});
|
|
2568
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2569
|
+
// job
|
|
2570
|
+
connector = new adapter(dataCallback);
|
|
2571
|
+
}, noop);
|
|
2572
|
+
const updateConnectorConfig = config => {
|
|
2573
|
+
// every time the config is recomputed due to tracking,
|
|
2574
|
+
// this callback will be invoked with the new computed config
|
|
2575
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2576
|
+
// job
|
|
2577
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2578
|
+
debugInfo.config = config;
|
|
2579
|
+
debugInfo.context = context;
|
|
2580
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2581
|
+
}
|
|
2582
|
+
connector.update(config, context);
|
|
2583
|
+
}, noop);
|
|
2584
|
+
};
|
|
2585
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
2586
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
2587
|
+
const {
|
|
2588
|
+
computeConfigAndUpdate,
|
|
2589
|
+
ro
|
|
2590
|
+
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
2591
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
2592
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
2593
|
+
createContextWatcher(vm, wireDef, newContext => {
|
|
2594
|
+
// every time the context is pushed into this component,
|
|
2595
|
+
// this callback will be invoked with the new computed context
|
|
2596
|
+
if (context !== newContext) {
|
|
2597
|
+
context = newContext;
|
|
2598
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
2599
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
2600
|
+
// (ever), while context can have identity
|
|
2601
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
2602
|
+
computeConfigAndUpdate();
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
return {
|
|
2608
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
2609
|
+
connector,
|
|
2610
|
+
computeConfigAndUpdate,
|
|
2611
|
+
resetConfigWatcher: () => ro.reset()
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
const AdapterToTokenMap = new Map();
|
|
2615
|
+
function getAdapterToken(adapter) {
|
|
2616
|
+
return AdapterToTokenMap.get(adapter);
|
|
2617
|
+
}
|
|
2618
|
+
function setAdapterToken(adapter, token) {
|
|
2619
|
+
AdapterToTokenMap.set(adapter, token);
|
|
2620
|
+
}
|
|
2621
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2622
|
+
// support for callable adapters
|
|
2623
|
+
if (adapter.adapter) {
|
|
2624
|
+
adapter = adapter.adapter;
|
|
2625
|
+
}
|
|
2626
|
+
const method = descriptor.value;
|
|
2627
|
+
const def = {
|
|
2628
|
+
adapter,
|
|
2629
|
+
method,
|
|
2630
|
+
configCallback,
|
|
2631
|
+
dynamic
|
|
2632
|
+
};
|
|
2633
|
+
WireMetaMap.set(descriptor, def);
|
|
2634
|
+
}
|
|
2635
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2636
|
+
// support for callable adapters
|
|
2637
|
+
if (adapter.adapter) {
|
|
2638
|
+
adapter = adapter.adapter;
|
|
2639
|
+
}
|
|
2640
|
+
const def = {
|
|
2641
|
+
adapter,
|
|
2642
|
+
configCallback,
|
|
2643
|
+
dynamic
|
|
2644
|
+
};
|
|
2645
|
+
WireMetaMap.set(descriptor, def);
|
|
2646
|
+
}
|
|
2647
|
+
function installWireAdapters(vm) {
|
|
2648
|
+
const {
|
|
2649
|
+
context,
|
|
2650
|
+
def: {
|
|
2651
|
+
wire
|
|
2652
|
+
}
|
|
2653
|
+
} = vm;
|
|
2654
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2655
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
|
|
2656
|
+
}
|
|
2657
|
+
const wiredConnecting = context.wiredConnecting = [];
|
|
2658
|
+
const wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2659
|
+
for (const fieldNameOrMethod in wire) {
|
|
2660
|
+
const descriptor = wire[fieldNameOrMethod];
|
|
2661
|
+
const wireDef = WireMetaMap.get(descriptor);
|
|
2662
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2663
|
+
assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
|
|
2664
|
+
}
|
|
2665
|
+
if (!isUndefined$1(wireDef)) {
|
|
2666
|
+
const {
|
|
2667
|
+
connector,
|
|
2668
|
+
computeConfigAndUpdate,
|
|
2669
|
+
resetConfigWatcher
|
|
2670
|
+
} = createConnector(vm, fieldNameOrMethod, wireDef);
|
|
2671
|
+
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2672
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
2673
|
+
connector.connect();
|
|
2674
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2675
|
+
if (hasDynamicParams) {
|
|
2676
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
computeConfigAndUpdate();
|
|
2681
|
+
});
|
|
2682
|
+
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
2683
|
+
connector.disconnect();
|
|
2684
|
+
resetConfigWatcher();
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
function connectWireAdapters(vm) {
|
|
2690
|
+
const {
|
|
2691
|
+
wiredConnecting
|
|
2692
|
+
} = vm.context;
|
|
2693
|
+
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
2694
|
+
wiredConnecting[i]();
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
function disconnectWireAdapters(vm) {
|
|
2698
|
+
const {
|
|
2699
|
+
wiredDisconnecting
|
|
2700
|
+
} = vm.context;
|
|
2701
|
+
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
2702
|
+
// job
|
|
2703
|
+
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
2704
|
+
wiredDisconnecting[i]();
|
|
2705
|
+
}
|
|
2706
|
+
}, noop);
|
|
2488
2707
|
}
|
|
2489
2708
|
|
|
2490
2709
|
/*
|
|
@@ -2493,23 +2712,95 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2493
2712
|
* SPDX-License-Identifier: MIT
|
|
2494
2713
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2495
2714
|
*/
|
|
2496
|
-
function
|
|
2497
|
-
if (arguments.length === 1) {
|
|
2498
|
-
return getReactiveProxy(target);
|
|
2499
|
-
}
|
|
2715
|
+
function api$1() {
|
|
2500
2716
|
if (process.env.NODE_ENV !== 'production') {
|
|
2501
|
-
assert.fail(`@
|
|
2717
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2502
2718
|
}
|
|
2503
2719
|
throw new Error();
|
|
2504
2720
|
}
|
|
2505
|
-
function
|
|
2721
|
+
function createPublicPropertyDescriptor(key) {
|
|
2506
2722
|
return {
|
|
2507
2723
|
get() {
|
|
2508
2724
|
const vm = getAssociatedVM(this);
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2725
|
+
if (isBeingConstructed(vm)) {
|
|
2726
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2727
|
+
logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
2728
|
+
}
|
|
2729
|
+
return;
|
|
2730
|
+
}
|
|
2731
|
+
return vm.cmpProps[key];
|
|
2732
|
+
},
|
|
2733
|
+
set(newValue) {
|
|
2734
|
+
const vm = getAssociatedVM(this);
|
|
2735
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2736
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2737
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2738
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2739
|
+
}
|
|
2740
|
+
vm.cmpProps[key] = newValue;
|
|
2741
|
+
},
|
|
2742
|
+
enumerable: true,
|
|
2743
|
+
configurable: true,
|
|
2744
|
+
};
|
|
2745
|
+
}
|
|
2746
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2747
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2748
|
+
if (!isFunction$1(get)) {
|
|
2749
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2750
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2751
|
+
}
|
|
2752
|
+
throw new Error();
|
|
2753
|
+
}
|
|
2754
|
+
return {
|
|
2755
|
+
get() {
|
|
2756
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2757
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2758
|
+
getAssociatedVM(this);
|
|
2759
|
+
}
|
|
2760
|
+
return get.call(this);
|
|
2761
|
+
},
|
|
2762
|
+
set(newValue) {
|
|
2763
|
+
const vm = getAssociatedVM(this);
|
|
2764
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2765
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2766
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2767
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2768
|
+
}
|
|
2769
|
+
if (set) {
|
|
2770
|
+
set.call(this, newValue);
|
|
2771
|
+
}
|
|
2772
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
2773
|
+
assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
|
|
2774
|
+
}
|
|
2775
|
+
},
|
|
2776
|
+
enumerable,
|
|
2777
|
+
configurable,
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
/*
|
|
2782
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2783
|
+
* All rights reserved.
|
|
2784
|
+
* SPDX-License-Identifier: MIT
|
|
2785
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2786
|
+
*/
|
|
2787
|
+
function track(target) {
|
|
2788
|
+
if (arguments.length === 1) {
|
|
2789
|
+
return getReactiveProxy(target);
|
|
2790
|
+
}
|
|
2791
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2792
|
+
assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
|
|
2793
|
+
}
|
|
2794
|
+
throw new Error();
|
|
2795
|
+
}
|
|
2796
|
+
function internalTrackDecorator(key) {
|
|
2797
|
+
return {
|
|
2798
|
+
get() {
|
|
2799
|
+
const vm = getAssociatedVM(this);
|
|
2800
|
+
return vm.cmpFields[key];
|
|
2801
|
+
},
|
|
2802
|
+
set(newValue) {
|
|
2803
|
+
const vm = getAssociatedVM(this);
|
|
2513
2804
|
if (process.env.NODE_ENV !== 'production') {
|
|
2514
2805
|
const vmBeingRendered = getVMBeingRendered();
|
|
2515
2806
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
@@ -5795,465 +6086,206 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5795
6086
|
}, () => {
|
|
5796
6087
|
// post
|
|
5797
6088
|
logOperationEnd(2 /* OperationId.Patch */, vm);
|
|
5798
|
-
});
|
|
5799
|
-
}
|
|
5800
|
-
}
|
|
5801
|
-
if (vm.state === 1 /* VMState.connected */) ;
|
|
5802
|
-
}
|
|
5803
|
-
|
|
5804
|
-
function runConnectedCallback(vm) {
|
|
5805
|
-
const {
|
|
5806
|
-
state
|
|
5807
|
-
} = vm;
|
|
5808
|
-
if (state === 1 /* VMState.connected */) {
|
|
5809
|
-
return; // nothing to do since it was already connected
|
|
5810
|
-
}
|
|
5811
|
-
|
|
5812
|
-
vm.state = 1 /* VMState.connected */;
|
|
5813
|
-
// reporting connection
|
|
5814
|
-
const {
|
|
5815
|
-
connected
|
|
5816
|
-
} = Services;
|
|
5817
|
-
if (connected) {
|
|
5818
|
-
invokeServiceHook(vm, connected);
|
|
5819
|
-
}
|
|
5820
|
-
if (hasWireAdapters(vm)) {
|
|
5821
|
-
connectWireAdapters(vm);
|
|
5822
|
-
}
|
|
5823
|
-
const {
|
|
5824
|
-
connectedCallback
|
|
5825
|
-
} = vm.def;
|
|
5826
|
-
if (!isUndefined$1(connectedCallback)) {
|
|
5827
|
-
logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
|
|
5828
|
-
invokeComponentCallback(vm, connectedCallback);
|
|
5829
|
-
logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
|
|
5830
|
-
}
|
|
5831
|
-
}
|
|
5832
|
-
function hasWireAdapters(vm) {
|
|
5833
|
-
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
5834
|
-
}
|
|
5835
|
-
function runDisconnectedCallback(vm) {
|
|
5836
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5837
|
-
assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
|
|
5838
|
-
}
|
|
5839
|
-
if (isFalse(vm.isDirty)) {
|
|
5840
|
-
// this guarantees that if the component is reused/reinserted,
|
|
5841
|
-
// it will be re-rendered because we are disconnecting the reactivity
|
|
5842
|
-
// linking, so mutations are not automatically reflected on the state
|
|
5843
|
-
// of disconnected components.
|
|
5844
|
-
vm.isDirty = true;
|
|
5845
|
-
}
|
|
5846
|
-
vm.state = 2 /* VMState.disconnected */;
|
|
5847
|
-
// reporting disconnection
|
|
5848
|
-
const {
|
|
5849
|
-
disconnected
|
|
5850
|
-
} = Services;
|
|
5851
|
-
if (disconnected) {
|
|
5852
|
-
invokeServiceHook(vm, disconnected);
|
|
5853
|
-
}
|
|
5854
|
-
if (hasWireAdapters(vm)) {
|
|
5855
|
-
disconnectWireAdapters(vm);
|
|
5856
|
-
}
|
|
5857
|
-
const {
|
|
5858
|
-
disconnectedCallback
|
|
5859
|
-
} = vm.def;
|
|
5860
|
-
if (!isUndefined$1(disconnectedCallback)) {
|
|
5861
|
-
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5862
|
-
invokeComponentCallback(vm, disconnectedCallback);
|
|
5863
|
-
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5864
|
-
}
|
|
5865
|
-
}
|
|
5866
|
-
function runChildNodesDisconnectedCallback(vm) {
|
|
5867
|
-
const {
|
|
5868
|
-
velements: vCustomElementCollection
|
|
5869
|
-
} = vm;
|
|
5870
|
-
// Reporting disconnection for every child in inverse order since they are
|
|
5871
|
-
// inserted in reserved order.
|
|
5872
|
-
for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
|
|
5873
|
-
const {
|
|
5874
|
-
elm
|
|
5875
|
-
} = vCustomElementCollection[i];
|
|
5876
|
-
// There are two cases where the element could be undefined:
|
|
5877
|
-
// * when there is an error during the construction phase, and an error
|
|
5878
|
-
// boundary picks it, there is a possibility that the VCustomElement
|
|
5879
|
-
// is not properly initialized, and therefore is should be ignored.
|
|
5880
|
-
// * when slotted custom element is not used by the element where it is
|
|
5881
|
-
// slotted into it, as a result, the custom element was never
|
|
5882
|
-
// initialized.
|
|
5883
|
-
if (!isUndefined$1(elm)) {
|
|
5884
|
-
const childVM = getAssociatedVMIfPresent(elm);
|
|
5885
|
-
// The VM associated with the element might be associated undefined
|
|
5886
|
-
// in the case where the VM failed in the middle of its creation,
|
|
5887
|
-
// eg: constructor throwing before invoking super().
|
|
5888
|
-
if (!isUndefined$1(childVM)) {
|
|
5889
|
-
resetComponentStateWhenRemoved(childVM);
|
|
5890
|
-
}
|
|
5891
|
-
}
|
|
5892
|
-
}
|
|
5893
|
-
}
|
|
5894
|
-
function runLightChildNodesDisconnectedCallback(vm) {
|
|
5895
|
-
const {
|
|
5896
|
-
aChildren: adoptedChildren
|
|
5897
|
-
} = vm;
|
|
5898
|
-
recursivelyDisconnectChildren(adoptedChildren);
|
|
5899
|
-
}
|
|
5900
|
-
/**
|
|
5901
|
-
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
5902
|
-
* instead it can be partial, when a custom element vnode is found, we don't
|
|
5903
|
-
* need to continue into its children because by attempting to disconnect the
|
|
5904
|
-
* custom element itself will trigger the removal of anything slotted or anything
|
|
5905
|
-
* defined on its shadow.
|
|
5906
|
-
*/
|
|
5907
|
-
function recursivelyDisconnectChildren(vnodes) {
|
|
5908
|
-
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
5909
|
-
const vnode = vnodes[i];
|
|
5910
|
-
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
5911
|
-
switch (vnode.type) {
|
|
5912
|
-
case 2 /* VNodeType.Element */:
|
|
5913
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
5914
|
-
break;
|
|
5915
|
-
case 3 /* VNodeType.CustomElement */:
|
|
5916
|
-
{
|
|
5917
|
-
const vm = getAssociatedVM(vnode.elm);
|
|
5918
|
-
resetComponentStateWhenRemoved(vm);
|
|
5919
|
-
break;
|
|
5920
|
-
}
|
|
5921
|
-
}
|
|
5922
|
-
}
|
|
5923
|
-
}
|
|
5924
|
-
}
|
|
5925
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
5926
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
5927
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
5928
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
5929
|
-
function resetComponentRoot(vm) {
|
|
5930
|
-
const {
|
|
5931
|
-
children,
|
|
5932
|
-
renderRoot,
|
|
5933
|
-
renderer: {
|
|
5934
|
-
remove
|
|
5935
|
-
}
|
|
5936
|
-
} = vm;
|
|
5937
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
5938
|
-
const child = children[i];
|
|
5939
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5940
|
-
remove(child.elm, renderRoot);
|
|
5941
|
-
}
|
|
5942
|
-
}
|
|
5943
|
-
vm.children = EmptyArray;
|
|
5944
|
-
runChildNodesDisconnectedCallback(vm);
|
|
5945
|
-
vm.velements = EmptyArray;
|
|
5946
|
-
}
|
|
5947
|
-
function getErrorBoundaryVM(vm) {
|
|
5948
|
-
let currentVm = vm;
|
|
5949
|
-
while (!isNull(currentVm)) {
|
|
5950
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
5951
|
-
return currentVm;
|
|
5952
|
-
}
|
|
5953
|
-
currentVm = currentVm.owner;
|
|
5954
|
-
}
|
|
5955
|
-
}
|
|
5956
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
5957
|
-
let error;
|
|
5958
|
-
pre();
|
|
5959
|
-
try {
|
|
5960
|
-
job();
|
|
5961
|
-
} catch (e) {
|
|
5962
|
-
error = Object(e);
|
|
5963
|
-
} finally {
|
|
5964
|
-
post();
|
|
5965
|
-
if (!isUndefined$1(error)) {
|
|
5966
|
-
addErrorComponentStack(vm, error);
|
|
5967
|
-
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
5968
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
5969
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
5970
|
-
}
|
|
5971
|
-
|
|
5972
|
-
resetComponentRoot(vm); // remove offenders
|
|
5973
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
5974
|
-
// error boundaries must have an ErrorCallback
|
|
5975
|
-
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
5976
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
5977
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
5978
|
-
}
|
|
5979
|
-
}
|
|
5980
|
-
}
|
|
5981
|
-
|
|
5982
|
-
/*
|
|
5983
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
5984
|
-
* All rights reserved.
|
|
5985
|
-
* SPDX-License-Identifier: MIT
|
|
5986
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5987
|
-
*/
|
|
5988
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
5989
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
5990
|
-
const WIRE_DEBUG_ENTRY = '@wire';
|
|
5991
|
-
const WireMetaMap = new Map();
|
|
5992
|
-
class WireContextRegistrationEvent extends CustomEvent {
|
|
5993
|
-
constructor(adapterToken, {
|
|
5994
|
-
setNewContext,
|
|
5995
|
-
setDisconnectedCallback
|
|
5996
|
-
}) {
|
|
5997
|
-
super(adapterToken, {
|
|
5998
|
-
bubbles: true,
|
|
5999
|
-
composed: true
|
|
6000
|
-
});
|
|
6001
|
-
defineProperties(this, {
|
|
6002
|
-
setNewContext: {
|
|
6003
|
-
value: setNewContext
|
|
6004
|
-
},
|
|
6005
|
-
setDisconnectedCallback: {
|
|
6006
|
-
value: setDisconnectedCallback
|
|
6007
|
-
}
|
|
6008
|
-
});
|
|
6009
|
-
}
|
|
6010
|
-
}
|
|
6011
|
-
function createFieldDataCallback(vm, name) {
|
|
6012
|
-
return value => {
|
|
6013
|
-
updateComponentValue(vm, name, value);
|
|
6014
|
-
};
|
|
6015
|
-
}
|
|
6016
|
-
function createMethodDataCallback(vm, method) {
|
|
6017
|
-
return value => {
|
|
6018
|
-
// dispatching new value into the wired method
|
|
6019
|
-
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
6020
|
-
// job
|
|
6021
|
-
method.call(vm.component, value);
|
|
6022
|
-
}, noop);
|
|
6023
|
-
};
|
|
6024
|
-
}
|
|
6025
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6026
|
-
// creating the reactive observer for reactive params when needed
|
|
6027
|
-
const ro = createReactiveObserver();
|
|
6028
|
-
const computeConfigAndUpdate = () => {
|
|
6029
|
-
let config;
|
|
6030
|
-
ro.observe(() => config = configCallback(component));
|
|
6031
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6032
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
6033
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
6034
|
-
callbackWhenConfigIsReady(config);
|
|
6035
|
-
};
|
|
6036
|
-
return {
|
|
6037
|
-
computeConfigAndUpdate,
|
|
6038
|
-
ro
|
|
6039
|
-
};
|
|
6040
|
-
}
|
|
6041
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
6042
|
-
const {
|
|
6043
|
-
adapter
|
|
6044
|
-
} = wireDef;
|
|
6045
|
-
const adapterContextToken = getAdapterToken(adapter);
|
|
6046
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
6047
|
-
return; // no provider found, nothing to be done
|
|
6048
|
-
}
|
|
6049
|
-
|
|
6050
|
-
const {
|
|
6051
|
-
elm,
|
|
6052
|
-
context: {
|
|
6053
|
-
wiredConnecting,
|
|
6054
|
-
wiredDisconnecting
|
|
6055
|
-
},
|
|
6056
|
-
renderer: {
|
|
6057
|
-
dispatchEvent
|
|
6058
|
-
}
|
|
6059
|
-
} = vm;
|
|
6060
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
6061
|
-
ArrayPush$1.call(wiredConnecting, () => {
|
|
6062
|
-
// This event is responsible for connecting the host element with another
|
|
6063
|
-
// element in the composed path that is providing contextual data. The provider
|
|
6064
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
6065
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
6066
|
-
// guarantee that the linkage can be forged.
|
|
6067
|
-
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
6068
|
-
setNewContext(newContext) {
|
|
6069
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6070
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
6071
|
-
callbackWhenContextIsReady(newContext);
|
|
6072
|
-
},
|
|
6073
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
6074
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
6075
|
-
// the the element hosting the wire is disconnected
|
|
6076
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
6077
|
-
}
|
|
6078
|
-
});
|
|
6079
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
6080
|
-
});
|
|
6081
|
-
}
|
|
6082
|
-
function createConnector(vm, name, wireDef) {
|
|
6083
|
-
const {
|
|
6084
|
-
method,
|
|
6085
|
-
adapter,
|
|
6086
|
-
configCallback,
|
|
6087
|
-
dynamic
|
|
6088
|
-
} = wireDef;
|
|
6089
|
-
let debugInfo;
|
|
6090
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6091
|
-
const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
6092
|
-
debugInfo = create(null);
|
|
6093
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6094
|
-
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
6095
|
-
}
|
|
6096
|
-
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
6097
|
-
const dataCallback = value => {
|
|
6098
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6099
|
-
debugInfo.data = value;
|
|
6100
|
-
// Note: most of the time, the data provided is for the current config, but there may be
|
|
6101
|
-
// some conditions in which it does not, ex:
|
|
6102
|
-
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
6103
|
-
debugInfo.wasDataProvisionedForConfig = true;
|
|
6104
|
-
}
|
|
6105
|
-
fieldOrMethodCallback(value);
|
|
6106
|
-
};
|
|
6107
|
-
let context;
|
|
6108
|
-
let connector;
|
|
6109
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
6110
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
6111
|
-
value: vm.elm
|
|
6112
|
-
});
|
|
6113
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
6114
|
-
value: dynamic
|
|
6115
|
-
});
|
|
6116
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
6117
|
-
// job
|
|
6118
|
-
connector = new adapter(dataCallback);
|
|
6119
|
-
}, noop);
|
|
6120
|
-
const updateConnectorConfig = config => {
|
|
6121
|
-
// every time the config is recomputed due to tracking,
|
|
6122
|
-
// this callback will be invoked with the new computed config
|
|
6123
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
6124
|
-
// job
|
|
6125
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6126
|
-
debugInfo.config = config;
|
|
6127
|
-
debugInfo.context = context;
|
|
6128
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6129
|
-
}
|
|
6130
|
-
connector.update(config, context);
|
|
6131
|
-
}, noop);
|
|
6132
|
-
};
|
|
6133
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6134
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
6135
|
-
const {
|
|
6136
|
-
computeConfigAndUpdate,
|
|
6137
|
-
ro
|
|
6138
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
6139
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6140
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
6141
|
-
createContextWatcher(vm, wireDef, newContext => {
|
|
6142
|
-
// every time the context is pushed into this component,
|
|
6143
|
-
// this callback will be invoked with the new computed context
|
|
6144
|
-
if (context !== newContext) {
|
|
6145
|
-
context = newContext;
|
|
6146
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6147
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6148
|
-
// (ever), while context can have identity
|
|
6149
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
6150
|
-
computeConfigAndUpdate();
|
|
6151
|
-
}
|
|
6152
|
-
}
|
|
6153
|
-
});
|
|
6089
|
+
});
|
|
6090
|
+
}
|
|
6154
6091
|
}
|
|
6155
|
-
|
|
6156
|
-
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
6157
|
-
connector,
|
|
6158
|
-
computeConfigAndUpdate,
|
|
6159
|
-
resetConfigWatcher: () => ro.reset()
|
|
6160
|
-
};
|
|
6092
|
+
if (vm.state === 1 /* VMState.connected */) ;
|
|
6161
6093
|
}
|
|
6162
|
-
|
|
6163
|
-
function
|
|
6164
|
-
|
|
6094
|
+
|
|
6095
|
+
function runConnectedCallback(vm) {
|
|
6096
|
+
const {
|
|
6097
|
+
state
|
|
6098
|
+
} = vm;
|
|
6099
|
+
if (state === 1 /* VMState.connected */) {
|
|
6100
|
+
return; // nothing to do since it was already connected
|
|
6101
|
+
}
|
|
6102
|
+
|
|
6103
|
+
vm.state = 1 /* VMState.connected */;
|
|
6104
|
+
// reporting connection
|
|
6105
|
+
const {
|
|
6106
|
+
connected
|
|
6107
|
+
} = Services;
|
|
6108
|
+
if (connected) {
|
|
6109
|
+
invokeServiceHook(vm, connected);
|
|
6110
|
+
}
|
|
6111
|
+
if (hasWireAdapters(vm)) {
|
|
6112
|
+
connectWireAdapters(vm);
|
|
6113
|
+
}
|
|
6114
|
+
const {
|
|
6115
|
+
connectedCallback
|
|
6116
|
+
} = vm.def;
|
|
6117
|
+
if (!isUndefined$1(connectedCallback)) {
|
|
6118
|
+
logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
|
|
6119
|
+
invokeComponentCallback(vm, connectedCallback);
|
|
6120
|
+
logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
|
|
6121
|
+
}
|
|
6165
6122
|
}
|
|
6166
|
-
function
|
|
6167
|
-
|
|
6123
|
+
function hasWireAdapters(vm) {
|
|
6124
|
+
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
6168
6125
|
}
|
|
6169
|
-
function
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
adapter = adapter.adapter;
|
|
6126
|
+
function runDisconnectedCallback(vm) {
|
|
6127
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6128
|
+
assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
|
|
6173
6129
|
}
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
}
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6130
|
+
if (isFalse(vm.isDirty)) {
|
|
6131
|
+
// this guarantees that if the component is reused/reinserted,
|
|
6132
|
+
// it will be re-rendered because we are disconnecting the reactivity
|
|
6133
|
+
// linking, so mutations are not automatically reflected on the state
|
|
6134
|
+
// of disconnected components.
|
|
6135
|
+
vm.isDirty = true;
|
|
6136
|
+
}
|
|
6137
|
+
vm.state = 2 /* VMState.disconnected */;
|
|
6138
|
+
// reporting disconnection
|
|
6139
|
+
const {
|
|
6140
|
+
disconnected
|
|
6141
|
+
} = Services;
|
|
6142
|
+
if (disconnected) {
|
|
6143
|
+
invokeServiceHook(vm, disconnected);
|
|
6144
|
+
}
|
|
6145
|
+
if (hasWireAdapters(vm)) {
|
|
6146
|
+
disconnectWireAdapters(vm);
|
|
6147
|
+
}
|
|
6148
|
+
const {
|
|
6149
|
+
disconnectedCallback
|
|
6150
|
+
} = vm.def;
|
|
6151
|
+
if (!isUndefined$1(disconnectedCallback)) {
|
|
6152
|
+
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6153
|
+
invokeComponentCallback(vm, disconnectedCallback);
|
|
6154
|
+
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6187
6155
|
}
|
|
6188
|
-
const def = {
|
|
6189
|
-
adapter,
|
|
6190
|
-
configCallback,
|
|
6191
|
-
dynamic
|
|
6192
|
-
};
|
|
6193
|
-
WireMetaMap.set(descriptor, def);
|
|
6194
6156
|
}
|
|
6195
|
-
function
|
|
6157
|
+
function runChildNodesDisconnectedCallback(vm) {
|
|
6196
6158
|
const {
|
|
6197
|
-
|
|
6198
|
-
def: {
|
|
6199
|
-
wire
|
|
6200
|
-
}
|
|
6159
|
+
velements: vCustomElementCollection
|
|
6201
6160
|
} = vm;
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6161
|
+
// Reporting disconnection for every child in inverse order since they are
|
|
6162
|
+
// inserted in reserved order.
|
|
6163
|
+
for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
|
|
6164
|
+
const {
|
|
6165
|
+
elm
|
|
6166
|
+
} = vCustomElementCollection[i];
|
|
6167
|
+
// There are two cases where the element could be undefined:
|
|
6168
|
+
// * when there is an error during the construction phase, and an error
|
|
6169
|
+
// boundary picks it, there is a possibility that the VCustomElement
|
|
6170
|
+
// is not properly initialized, and therefore is should be ignored.
|
|
6171
|
+
// * when slotted custom element is not used by the element where it is
|
|
6172
|
+
// slotted into it, as a result, the custom element was never
|
|
6173
|
+
// initialized.
|
|
6174
|
+
if (!isUndefined$1(elm)) {
|
|
6175
|
+
const childVM = getAssociatedVMIfPresent(elm);
|
|
6176
|
+
// The VM associated with the element might be associated undefined
|
|
6177
|
+
// in the case where the VM failed in the middle of its creation,
|
|
6178
|
+
// eg: constructor throwing before invoking super().
|
|
6179
|
+
if (!isUndefined$1(childVM)) {
|
|
6180
|
+
resetComponentStateWhenRemoved(childVM);
|
|
6181
|
+
}
|
|
6212
6182
|
}
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
function runLightChildNodesDisconnectedCallback(vm) {
|
|
6186
|
+
const {
|
|
6187
|
+
aChildren: adoptedChildren
|
|
6188
|
+
} = vm;
|
|
6189
|
+
recursivelyDisconnectChildren(adoptedChildren);
|
|
6190
|
+
}
|
|
6191
|
+
/**
|
|
6192
|
+
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
6193
|
+
* instead it can be partial, when a custom element vnode is found, we don't
|
|
6194
|
+
* need to continue into its children because by attempting to disconnect the
|
|
6195
|
+
* custom element itself will trigger the removal of anything slotted or anything
|
|
6196
|
+
* defined on its shadow.
|
|
6197
|
+
*/
|
|
6198
|
+
function recursivelyDisconnectChildren(vnodes) {
|
|
6199
|
+
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
6200
|
+
const vnode = vnodes[i];
|
|
6201
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6202
|
+
switch (vnode.type) {
|
|
6203
|
+
case 2 /* VNodeType.Element */:
|
|
6204
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
6205
|
+
break;
|
|
6206
|
+
case 3 /* VNodeType.CustomElement */:
|
|
6207
|
+
{
|
|
6208
|
+
const vm = getAssociatedVM(vnode.elm);
|
|
6209
|
+
resetComponentStateWhenRemoved(vm);
|
|
6210
|
+
break;
|
|
6226
6211
|
}
|
|
6227
|
-
|
|
6228
|
-
computeConfigAndUpdate();
|
|
6229
|
-
});
|
|
6230
|
-
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
6231
|
-
connector.disconnect();
|
|
6232
|
-
resetConfigWatcher();
|
|
6233
|
-
});
|
|
6212
|
+
}
|
|
6234
6213
|
}
|
|
6235
6214
|
}
|
|
6236
6215
|
}
|
|
6237
|
-
|
|
6216
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6217
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6218
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6219
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
6220
|
+
function resetComponentRoot(vm) {
|
|
6238
6221
|
const {
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6222
|
+
children,
|
|
6223
|
+
renderRoot,
|
|
6224
|
+
renderer: {
|
|
6225
|
+
remove
|
|
6226
|
+
}
|
|
6227
|
+
} = vm;
|
|
6228
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
6229
|
+
const child = children[i];
|
|
6230
|
+
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6231
|
+
remove(child.elm, renderRoot);
|
|
6232
|
+
}
|
|
6243
6233
|
}
|
|
6234
|
+
vm.children = EmptyArray;
|
|
6235
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6236
|
+
vm.velements = EmptyArray;
|
|
6244
6237
|
}
|
|
6245
|
-
function
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
// job
|
|
6251
|
-
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
6252
|
-
wiredDisconnecting[i]();
|
|
6238
|
+
function getErrorBoundaryVM(vm) {
|
|
6239
|
+
let currentVm = vm;
|
|
6240
|
+
while (!isNull(currentVm)) {
|
|
6241
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6242
|
+
return currentVm;
|
|
6253
6243
|
}
|
|
6254
|
-
|
|
6244
|
+
currentVm = currentVm.owner;
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6248
|
+
let error;
|
|
6249
|
+
pre();
|
|
6250
|
+
try {
|
|
6251
|
+
job();
|
|
6252
|
+
} catch (e) {
|
|
6253
|
+
error = Object(e);
|
|
6254
|
+
} finally {
|
|
6255
|
+
post();
|
|
6256
|
+
if (!isUndefined$1(error)) {
|
|
6257
|
+
addErrorComponentStack(vm, error);
|
|
6258
|
+
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6259
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
6260
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
6261
|
+
}
|
|
6262
|
+
|
|
6263
|
+
resetComponentRoot(vm); // remove offenders
|
|
6264
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6265
|
+
// error boundaries must have an ErrorCallback
|
|
6266
|
+
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6267
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6268
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6269
|
+
}
|
|
6270
|
+
}
|
|
6255
6271
|
}
|
|
6256
6272
|
|
|
6273
|
+
/*
|
|
6274
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6275
|
+
* All rights reserved.
|
|
6276
|
+
* SPDX-License-Identifier: MIT
|
|
6277
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6278
|
+
*/
|
|
6279
|
+
//
|
|
6280
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
6281
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
6282
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
6283
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
6284
|
+
//
|
|
6285
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6286
|
+
_globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6287
|
+
_globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6288
|
+
|
|
6257
6289
|
/*
|
|
6258
6290
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6259
6291
|
* All rights reserved.
|
|
@@ -6498,7 +6530,7 @@ function freezeTemplate(tmpl) {
|
|
|
6498
6530
|
}
|
|
6499
6531
|
}
|
|
6500
6532
|
}
|
|
6501
|
-
/* version: 2.
|
|
6533
|
+
/* version: 2.35.0 */
|
|
6502
6534
|
|
|
6503
6535
|
/*
|
|
6504
6536
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6969,7 +7001,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6969
7001
|
*/
|
|
6970
7002
|
freeze(LightningElement);
|
|
6971
7003
|
seal(LightningElement.prototype);
|
|
6972
|
-
/* version: 2.
|
|
7004
|
+
/* version: 2.35.0 */
|
|
6973
7005
|
|
|
6974
7006
|
exports.LightningElement = LightningElement;
|
|
6975
7007
|
exports.api = api$1;
|