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