lwc 2.33.0 → 2.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +1022 -649
- package/dist/engine-dom/iife/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/iife/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-dom/umd/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/umd/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-server/commonjs/es2017/engine-server.js +789 -638
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +789 -638
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +18 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +18 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -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.
|
|
@@ -529,6 +531,7 @@ const features = {
|
|
|
529
531
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
530
532
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
531
533
|
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
534
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null,
|
|
532
535
|
};
|
|
533
536
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
534
537
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -582,7 +585,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
582
585
|
setFeatureFlag(name, value);
|
|
583
586
|
}
|
|
584
587
|
}
|
|
585
|
-
/** version: 2.
|
|
588
|
+
/** version: 2.35.0 */
|
|
586
589
|
|
|
587
590
|
/**
|
|
588
591
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -646,7 +649,7 @@ function applyAriaReflection(prototype = Element.prototype) {
|
|
|
646
649
|
}
|
|
647
650
|
}
|
|
648
651
|
}
|
|
649
|
-
/** version: 2.
|
|
652
|
+
/** version: 2.35.0 */
|
|
650
653
|
|
|
651
654
|
/* proxy-compat-disable */
|
|
652
655
|
|
|
@@ -672,87 +675,6 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
|
672
675
|
}));
|
|
673
676
|
});
|
|
674
677
|
}
|
|
675
|
-
const SPACE_CHAR = 32;
|
|
676
|
-
const EmptyObject = seal(create(null));
|
|
677
|
-
const EmptyArray = seal([]);
|
|
678
|
-
function guid() {
|
|
679
|
-
function s4() {
|
|
680
|
-
return Math.floor((1 + Math.random()) * 0x10000)
|
|
681
|
-
.toString(16)
|
|
682
|
-
.substring(1);
|
|
683
|
-
}
|
|
684
|
-
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
685
|
-
}
|
|
686
|
-
function flattenStylesheets(stylesheets) {
|
|
687
|
-
const list = [];
|
|
688
|
-
for (const stylesheet of stylesheets) {
|
|
689
|
-
if (!Array.isArray(stylesheet)) {
|
|
690
|
-
list.push(stylesheet);
|
|
691
|
-
}
|
|
692
|
-
else {
|
|
693
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
return list;
|
|
697
|
-
}
|
|
698
|
-
// Set a ref (lwc:ref) on a VM, from a template API
|
|
699
|
-
function setRefVNode(vm, ref, vnode) {
|
|
700
|
-
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
701
|
-
throw new Error('refVNodes must be defined when setting a ref');
|
|
702
|
-
}
|
|
703
|
-
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
704
|
-
// If not, then something went wrong and we threw an error above.
|
|
705
|
-
const refVNodes = vm.refVNodes;
|
|
706
|
-
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
707
|
-
// in depth-first traversal order.
|
|
708
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
709
|
-
refVNodes[ref] = vnode;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
/*
|
|
714
|
-
* Copyright (c) 2019, salesforce.com, inc.
|
|
715
|
-
* All rights reserved.
|
|
716
|
-
* SPDX-License-Identifier: MIT
|
|
717
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
718
|
-
*/
|
|
719
|
-
const TargetToReactiveRecordMap = new WeakMap();
|
|
720
|
-
function valueMutated(target, key) {
|
|
721
|
-
const reactiveRecord = TargetToReactiveRecordMap.get(target);
|
|
722
|
-
if (!isUndefined$1(reactiveRecord)) {
|
|
723
|
-
const reactiveObservers = reactiveRecord[key];
|
|
724
|
-
if (!isUndefined$1(reactiveObservers)) {
|
|
725
|
-
for (let i = 0, len = reactiveObservers.length; i < len; i += 1) {
|
|
726
|
-
const ro = reactiveObservers[i];
|
|
727
|
-
ro.notify();
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
function valueObserved(target, key) {
|
|
733
|
-
// We should determine if an active Observing Record is present to track mutations.
|
|
734
|
-
{
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/*
|
|
740
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
741
|
-
* All rights reserved.
|
|
742
|
-
* SPDX-License-Identifier: MIT
|
|
743
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
744
|
-
*/
|
|
745
|
-
const DUMMY_REACTIVE_OBSERVER = {
|
|
746
|
-
observe(job) {
|
|
747
|
-
job();
|
|
748
|
-
},
|
|
749
|
-
reset() { },
|
|
750
|
-
link() { },
|
|
751
|
-
};
|
|
752
|
-
function createReactiveObserver(callback) {
|
|
753
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
754
|
-
return DUMMY_REACTIVE_OBSERVER;
|
|
755
|
-
}
|
|
756
678
|
|
|
757
679
|
/*
|
|
758
680
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -807,11 +729,26 @@ function addErrorComponentStack(vm, error) {
|
|
|
807
729
|
* SPDX-License-Identifier: MIT
|
|
808
730
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
809
731
|
*/
|
|
810
|
-
|
|
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) {
|
|
811
741
|
let msg = `[LWC ${method}]: ${message}`;
|
|
812
742
|
if (!isUndefined$1(vm)) {
|
|
813
743
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
814
744
|
}
|
|
745
|
+
if (once) {
|
|
746
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
alreadyLoggedMessages.add(msg);
|
|
750
|
+
}
|
|
751
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
815
752
|
if (process.env.NODE_ENV === 'test') {
|
|
816
753
|
/* eslint-disable-next-line no-console */
|
|
817
754
|
console[method](msg);
|
|
@@ -826,7 +763,88 @@ function log(method, message, vm) {
|
|
|
826
763
|
}
|
|
827
764
|
}
|
|
828
765
|
function logError(message, vm) {
|
|
829
|
-
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
|
+
}
|
|
830
848
|
}
|
|
831
849
|
|
|
832
850
|
/*
|
|
@@ -878,7 +896,10 @@ function offsetPropertyErrorMessage(name) {
|
|
|
878
896
|
// Global HTML Attributes & Properties
|
|
879
897
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
880
898
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
881
|
-
|
|
899
|
+
//
|
|
900
|
+
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
901
|
+
// for e.g. "dropzone" should suffice.
|
|
902
|
+
const globalHTMLProperties = {
|
|
882
903
|
accessKey: {
|
|
883
904
|
attribute: 'accesskey',
|
|
884
905
|
},
|
|
@@ -963,7 +984,7 @@ const globalHTMLProperties = assign(create(null), {
|
|
|
963
984
|
role: {
|
|
964
985
|
attribute: 'role',
|
|
965
986
|
},
|
|
966
|
-
}
|
|
987
|
+
};
|
|
967
988
|
let controlledElement = null;
|
|
968
989
|
let controlledAttributeName;
|
|
969
990
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -2416,70 +2437,273 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
2416
2437
|
* SPDX-License-Identifier: MIT
|
|
2417
2438
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2418
2439
|
*/
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
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
|
+
}
|
|
2424
2462
|
}
|
|
2425
|
-
function
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
if (isBeingConstructed(vm)) {
|
|
2430
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2431
|
-
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);
|
|
2432
|
-
}
|
|
2433
|
-
return;
|
|
2434
|
-
}
|
|
2435
|
-
return vm.cmpProps[key];
|
|
2436
|
-
},
|
|
2437
|
-
set(newValue) {
|
|
2438
|
-
const vm = getAssociatedVM(this);
|
|
2439
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2440
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2441
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2442
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2443
|
-
}
|
|
2444
|
-
vm.cmpProps[key] = newValue;
|
|
2445
|
-
},
|
|
2446
|
-
enumerable: true,
|
|
2447
|
-
configurable: true,
|
|
2448
|
-
};
|
|
2463
|
+
function createFieldDataCallback(vm, name) {
|
|
2464
|
+
return value => {
|
|
2465
|
+
updateComponentValue(vm, name, value);
|
|
2466
|
+
};
|
|
2449
2467
|
}
|
|
2450
|
-
function
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
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
|
-
|
|
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);
|
|
2483
2707
|
}
|
|
2484
2708
|
|
|
2485
2709
|
/*
|
|
@@ -2488,23 +2712,95 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2488
2712
|
* SPDX-License-Identifier: MIT
|
|
2489
2713
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2490
2714
|
*/
|
|
2491
|
-
function
|
|
2492
|
-
if (arguments.length === 1) {
|
|
2493
|
-
return getReactiveProxy(target);
|
|
2494
|
-
}
|
|
2715
|
+
function api$1() {
|
|
2495
2716
|
if (process.env.NODE_ENV !== 'production') {
|
|
2496
|
-
assert.fail(`@
|
|
2717
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2497
2718
|
}
|
|
2498
2719
|
throw new Error();
|
|
2499
2720
|
}
|
|
2500
|
-
function
|
|
2721
|
+
function createPublicPropertyDescriptor(key) {
|
|
2501
2722
|
return {
|
|
2502
2723
|
get() {
|
|
2503
2724
|
const vm = getAssociatedVM(this);
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
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);
|
|
2508
2804
|
if (process.env.NODE_ENV !== 'production') {
|
|
2509
2805
|
const vmBeingRendered = getVMBeingRendered();
|
|
2510
2806
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
@@ -3346,6 +3642,9 @@ function updateStylesheetToken(vm, template) {
|
|
|
3346
3642
|
stylesheets: newStylesheets,
|
|
3347
3643
|
stylesheetToken: newStylesheetToken
|
|
3348
3644
|
} = template;
|
|
3645
|
+
const {
|
|
3646
|
+
stylesheets: newVmStylesheets
|
|
3647
|
+
} = vm;
|
|
3349
3648
|
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3350
3649
|
const {
|
|
3351
3650
|
hasScopedStyles
|
|
@@ -3369,7 +3668,9 @@ function updateStylesheetToken(vm, template) {
|
|
|
3369
3668
|
}
|
|
3370
3669
|
// Apply the new template styling token to the host element, if the new template has any
|
|
3371
3670
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3372
|
-
|
|
3671
|
+
const hasNewStylesheets = hasStyles(newStylesheets);
|
|
3672
|
+
const hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
3673
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
3373
3674
|
newToken = newStylesheetToken;
|
|
3374
3675
|
}
|
|
3375
3676
|
// Set the new styling token on the host element
|
|
@@ -3441,10 +3742,17 @@ function getStylesheetsContent(vm, template) {
|
|
|
3441
3742
|
stylesheets,
|
|
3442
3743
|
stylesheetToken
|
|
3443
3744
|
} = template;
|
|
3745
|
+
const {
|
|
3746
|
+
stylesheets: vmStylesheets
|
|
3747
|
+
} = vm;
|
|
3444
3748
|
let content = [];
|
|
3445
|
-
if (
|
|
3749
|
+
if (hasStyles(stylesheets)) {
|
|
3446
3750
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3447
3751
|
}
|
|
3752
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
3753
|
+
if (hasStyles(vmStylesheets)) {
|
|
3754
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
3755
|
+
}
|
|
3448
3756
|
return content;
|
|
3449
3757
|
}
|
|
3450
3758
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -4050,6 +4358,28 @@ function patchCustomElement(n1, n2, parent, renderer) {
|
|
|
4050
4358
|
// in fallback mode, the allocation will always set children to
|
|
4051
4359
|
// empty and delegate the real allocation to the slot elements
|
|
4052
4360
|
allocateChildren(n2, vm);
|
|
4361
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
4362
|
+
//
|
|
4363
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
4364
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
4365
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
4366
|
+
//
|
|
4367
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
4368
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
4369
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
4370
|
+
// mark the new children dynamic.
|
|
4371
|
+
//
|
|
4372
|
+
// Example:
|
|
4373
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
4374
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
4375
|
+
const {
|
|
4376
|
+
shadowMode,
|
|
4377
|
+
renderMode
|
|
4378
|
+
} = vm;
|
|
4379
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
4380
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
4381
|
+
markAsDynamicChildren(n2.children);
|
|
4382
|
+
}
|
|
4053
4383
|
}
|
|
4054
4384
|
// in fallback mode, the children will be always empty, so, nothing
|
|
4055
4385
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -4242,7 +4572,6 @@ function allocateChildren(vnode, vm) {
|
|
|
4242
4572
|
//
|
|
4243
4573
|
// In case #2, we will always get a fresh VCustomElement.
|
|
4244
4574
|
const children = vnode.aChildren || vnode.children;
|
|
4245
|
-
vm.aChildren = children;
|
|
4246
4575
|
const {
|
|
4247
4576
|
renderMode,
|
|
4248
4577
|
shadowMode
|
|
@@ -4255,15 +4584,61 @@ function allocateChildren(vnode, vm) {
|
|
|
4255
4584
|
logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
|
|
4256
4585
|
}
|
|
4257
4586
|
}
|
|
4587
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
4588
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
4589
|
+
const allocatedChildren = flattenFragmentsInChildren(children);
|
|
4590
|
+
vnode.children = allocatedChildren;
|
|
4591
|
+
vm.aChildren = allocatedChildren;
|
|
4258
4592
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4259
4593
|
// slow path
|
|
4260
|
-
allocateInSlot(vm,
|
|
4594
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
4261
4595
|
// save the allocated children in case this vnode is reused.
|
|
4262
|
-
vnode.aChildren =
|
|
4596
|
+
vnode.aChildren = allocatedChildren;
|
|
4263
4597
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4264
4598
|
vnode.children = EmptyArray;
|
|
4265
4599
|
}
|
|
4266
4600
|
}
|
|
4601
|
+
/**
|
|
4602
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
4603
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
4604
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
4605
|
+
*
|
|
4606
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
4607
|
+
*
|
|
4608
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
4609
|
+
*/
|
|
4610
|
+
function flattenFragmentsInChildren(children) {
|
|
4611
|
+
const flattenedChildren = [];
|
|
4612
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
4613
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4614
|
+
const nodeStack = [];
|
|
4615
|
+
let fragmentFound = false;
|
|
4616
|
+
for (let i = children.length - 1; i > -1; i -= 1) {
|
|
4617
|
+
const child = children[i];
|
|
4618
|
+
ArrayPush$1.call(nodeStack, child);
|
|
4619
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4620
|
+
}
|
|
4621
|
+
if (!fragmentFound) {
|
|
4622
|
+
return children;
|
|
4623
|
+
}
|
|
4624
|
+
let currentNode;
|
|
4625
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
4626
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4627
|
+
const fChildren = currentNode.children;
|
|
4628
|
+
// Ignore the start and end text node delimiters
|
|
4629
|
+
for (let i = fChildren.length - 2; i > 0; i -= 1) {
|
|
4630
|
+
ArrayPush$1.call(nodeStack, fChildren[i]);
|
|
4631
|
+
}
|
|
4632
|
+
} else {
|
|
4633
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
4637
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
4638
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
4639
|
+
markAsDynamicChildren(flattenedChildren);
|
|
4640
|
+
return flattenedChildren;
|
|
4641
|
+
}
|
|
4267
4642
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4268
4643
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4269
4644
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -4288,22 +4663,20 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4288
4663
|
}
|
|
4289
4664
|
return vm;
|
|
4290
4665
|
}
|
|
4291
|
-
|
|
4292
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4293
|
-
*/
|
|
4294
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
4666
|
+
function allocateInSlot(vm, children, owner) {
|
|
4295
4667
|
var _a, _b;
|
|
4668
|
+
const {
|
|
4669
|
+
cmpSlots: {
|
|
4670
|
+
slotAssignments: oldSlotsMapping
|
|
4671
|
+
}
|
|
4672
|
+
} = vm;
|
|
4673
|
+
const cmpSlotsMapping = create(null);
|
|
4674
|
+
// Collect all slots into cmpSlotsMapping
|
|
4296
4675
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4297
4676
|
const vnode = children[i];
|
|
4298
4677
|
if (isNull(vnode)) {
|
|
4299
4678
|
continue;
|
|
4300
4679
|
}
|
|
4301
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
4302
|
-
if (isVFragment(vnode)) {
|
|
4303
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4304
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4305
|
-
continue;
|
|
4306
|
-
}
|
|
4307
4680
|
let slotName = '';
|
|
4308
4681
|
if (isVBaseElement(vnode)) {
|
|
4309
4682
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -4313,15 +4686,6 @@ function collectSlots(vm, children, cmpSlotsMapping) {
|
|
|
4313
4686
|
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4314
4687
|
ArrayPush$1.call(vnodes, vnode);
|
|
4315
4688
|
}
|
|
4316
|
-
}
|
|
4317
|
-
function allocateInSlot(vm, children, owner) {
|
|
4318
|
-
const {
|
|
4319
|
-
cmpSlots: {
|
|
4320
|
-
slotAssignments: oldSlotsMapping
|
|
4321
|
-
}
|
|
4322
|
-
} = vm;
|
|
4323
|
-
const cmpSlotsMapping = create(null);
|
|
4324
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
4325
4689
|
vm.cmpSlots = {
|
|
4326
4690
|
owner,
|
|
4327
4691
|
slotAssignments: cmpSlotsMapping
|
|
@@ -4352,14 +4716,14 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4352
4716
|
}
|
|
4353
4717
|
}
|
|
4354
4718
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4355
|
-
const
|
|
4356
|
-
// dynamic children means it was generated by an iteration
|
|
4357
|
-
//
|
|
4719
|
+
const DynamicChildren = new WeakMap();
|
|
4720
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
4721
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
4358
4722
|
function markAsDynamicChildren(children) {
|
|
4359
|
-
|
|
4723
|
+
DynamicChildren.set(children, 1);
|
|
4360
4724
|
}
|
|
4361
4725
|
function hasDynamicChildren(children) {
|
|
4362
|
-
return
|
|
4726
|
+
return DynamicChildren.has(children);
|
|
4363
4727
|
}
|
|
4364
4728
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4365
4729
|
const map = {};
|
|
@@ -5186,7 +5550,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5186
5550
|
// Create a brand new template cache for the swapped templated.
|
|
5187
5551
|
context.tplCache = create(null);
|
|
5188
5552
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5189
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
5553
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
5190
5554
|
// Update the scoping token on the host element.
|
|
5191
5555
|
updateStylesheetToken(vm, html);
|
|
5192
5556
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -5229,9 +5593,8 @@ function evaluateTemplate(vm, html) {
|
|
|
5229
5593
|
}
|
|
5230
5594
|
return vnodes;
|
|
5231
5595
|
}
|
|
5232
|
-
function
|
|
5233
|
-
|
|
5234
|
-
if (!isUndefined$1(stylesheets)) {
|
|
5596
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5597
|
+
if (hasStyles(stylesheets)) {
|
|
5235
5598
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5236
5599
|
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
5237
5600
|
return true;
|
|
@@ -5240,6 +5603,15 @@ function computeHasScopedStyles(template) {
|
|
|
5240
5603
|
}
|
|
5241
5604
|
return false;
|
|
5242
5605
|
}
|
|
5606
|
+
function computeHasScopedStyles(template, vm) {
|
|
5607
|
+
const { stylesheets } = template;
|
|
5608
|
+
const vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
5609
|
+
return (computeHasScopedStylesInStylesheets(stylesheets) ||
|
|
5610
|
+
computeHasScopedStylesInStylesheets(vmStylesheets));
|
|
5611
|
+
}
|
|
5612
|
+
function hasStyles(stylesheets) {
|
|
5613
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
5614
|
+
}
|
|
5243
5615
|
|
|
5244
5616
|
/*
|
|
5245
5617
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5549,6 +5921,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5549
5921
|
// Properties set right after VM creation.
|
|
5550
5922
|
tro: null,
|
|
5551
5923
|
shadowMode: null,
|
|
5924
|
+
stylesheets: null,
|
|
5552
5925
|
// Properties set by the LightningElement constructor.
|
|
5553
5926
|
component: null,
|
|
5554
5927
|
shadowRoot: null,
|
|
@@ -5561,6 +5934,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5561
5934
|
if (process.env.NODE_ENV !== 'production') {
|
|
5562
5935
|
vm.debugInfo = create(null);
|
|
5563
5936
|
}
|
|
5937
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
5564
5938
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5565
5939
|
vm.tro = getTemplateReactiveObserver();
|
|
5566
5940
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5579,6 +5953,42 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5579
5953
|
}
|
|
5580
5954
|
return vm;
|
|
5581
5955
|
}
|
|
5956
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
5957
|
+
let valid = true;
|
|
5958
|
+
const validate = arrayOrStylesheet => {
|
|
5959
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
5960
|
+
for (let i = 0; i < arrayOrStylesheet.length; i++) {
|
|
5961
|
+
validate(arrayOrStylesheet[i]);
|
|
5962
|
+
}
|
|
5963
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
5964
|
+
// function assumed to be a stylesheet factory
|
|
5965
|
+
valid = false;
|
|
5966
|
+
}
|
|
5967
|
+
};
|
|
5968
|
+
if (!isArray$1(stylesheets)) {
|
|
5969
|
+
valid = false;
|
|
5970
|
+
} else {
|
|
5971
|
+
validate(stylesheets);
|
|
5972
|
+
}
|
|
5973
|
+
return valid;
|
|
5974
|
+
}
|
|
5975
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
5976
|
+
function computeStylesheets(vm, ctor) {
|
|
5977
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
5978
|
+
const {
|
|
5979
|
+
stylesheets
|
|
5980
|
+
} = ctor;
|
|
5981
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5982
|
+
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
5983
|
+
if (valid) {
|
|
5984
|
+
return flattenStylesheets(stylesheets);
|
|
5985
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
5986
|
+
logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
|
|
5987
|
+
}
|
|
5988
|
+
}
|
|
5989
|
+
}
|
|
5990
|
+
return null;
|
|
5991
|
+
}
|
|
5582
5992
|
function computeShadowMode(vm, renderer) {
|
|
5583
5993
|
const {
|
|
5584
5994
|
def
|
|
@@ -5674,466 +6084,207 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5674
6084
|
// job
|
|
5675
6085
|
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5676
6086
|
}, () => {
|
|
5677
|
-
// post
|
|
5678
|
-
logOperationEnd(2 /* OperationId.Patch */, vm);
|
|
5679
|
-
});
|
|
5680
|
-
}
|
|
5681
|
-
}
|
|
5682
|
-
if (vm.state === 1 /* VMState.connected */) ;
|
|
5683
|
-
}
|
|
5684
|
-
|
|
5685
|
-
function runConnectedCallback(vm) {
|
|
5686
|
-
const {
|
|
5687
|
-
state
|
|
5688
|
-
} = vm;
|
|
5689
|
-
if (state === 1 /* VMState.connected */) {
|
|
5690
|
-
return; // nothing to do since it was already connected
|
|
5691
|
-
}
|
|
5692
|
-
|
|
5693
|
-
vm.state = 1 /* VMState.connected */;
|
|
5694
|
-
// reporting connection
|
|
5695
|
-
const {
|
|
5696
|
-
connected
|
|
5697
|
-
} = Services;
|
|
5698
|
-
if (connected) {
|
|
5699
|
-
invokeServiceHook(vm, connected);
|
|
5700
|
-
}
|
|
5701
|
-
if (hasWireAdapters(vm)) {
|
|
5702
|
-
connectWireAdapters(vm);
|
|
5703
|
-
}
|
|
5704
|
-
const {
|
|
5705
|
-
connectedCallback
|
|
5706
|
-
} = vm.def;
|
|
5707
|
-
if (!isUndefined$1(connectedCallback)) {
|
|
5708
|
-
logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
|
|
5709
|
-
invokeComponentCallback(vm, connectedCallback);
|
|
5710
|
-
logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
|
|
5711
|
-
}
|
|
5712
|
-
}
|
|
5713
|
-
function hasWireAdapters(vm) {
|
|
5714
|
-
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
5715
|
-
}
|
|
5716
|
-
function runDisconnectedCallback(vm) {
|
|
5717
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5718
|
-
assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
|
|
5719
|
-
}
|
|
5720
|
-
if (isFalse(vm.isDirty)) {
|
|
5721
|
-
// this guarantees that if the component is reused/reinserted,
|
|
5722
|
-
// it will be re-rendered because we are disconnecting the reactivity
|
|
5723
|
-
// linking, so mutations are not automatically reflected on the state
|
|
5724
|
-
// of disconnected components.
|
|
5725
|
-
vm.isDirty = true;
|
|
5726
|
-
}
|
|
5727
|
-
vm.state = 2 /* VMState.disconnected */;
|
|
5728
|
-
// reporting disconnection
|
|
5729
|
-
const {
|
|
5730
|
-
disconnected
|
|
5731
|
-
} = Services;
|
|
5732
|
-
if (disconnected) {
|
|
5733
|
-
invokeServiceHook(vm, disconnected);
|
|
5734
|
-
}
|
|
5735
|
-
if (hasWireAdapters(vm)) {
|
|
5736
|
-
disconnectWireAdapters(vm);
|
|
5737
|
-
}
|
|
5738
|
-
const {
|
|
5739
|
-
disconnectedCallback
|
|
5740
|
-
} = vm.def;
|
|
5741
|
-
if (!isUndefined$1(disconnectedCallback)) {
|
|
5742
|
-
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5743
|
-
invokeComponentCallback(vm, disconnectedCallback);
|
|
5744
|
-
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5745
|
-
}
|
|
5746
|
-
}
|
|
5747
|
-
function runChildNodesDisconnectedCallback(vm) {
|
|
5748
|
-
const {
|
|
5749
|
-
velements: vCustomElementCollection
|
|
5750
|
-
} = vm;
|
|
5751
|
-
// Reporting disconnection for every child in inverse order since they are
|
|
5752
|
-
// inserted in reserved order.
|
|
5753
|
-
for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
|
|
5754
|
-
const {
|
|
5755
|
-
elm
|
|
5756
|
-
} = vCustomElementCollection[i];
|
|
5757
|
-
// There are two cases where the element could be undefined:
|
|
5758
|
-
// * when there is an error during the construction phase, and an error
|
|
5759
|
-
// boundary picks it, there is a possibility that the VCustomElement
|
|
5760
|
-
// is not properly initialized, and therefore is should be ignored.
|
|
5761
|
-
// * when slotted custom element is not used by the element where it is
|
|
5762
|
-
// slotted into it, as a result, the custom element was never
|
|
5763
|
-
// initialized.
|
|
5764
|
-
if (!isUndefined$1(elm)) {
|
|
5765
|
-
const childVM = getAssociatedVMIfPresent(elm);
|
|
5766
|
-
// The VM associated with the element might be associated undefined
|
|
5767
|
-
// in the case where the VM failed in the middle of its creation,
|
|
5768
|
-
// eg: constructor throwing before invoking super().
|
|
5769
|
-
if (!isUndefined$1(childVM)) {
|
|
5770
|
-
resetComponentStateWhenRemoved(childVM);
|
|
5771
|
-
}
|
|
5772
|
-
}
|
|
5773
|
-
}
|
|
5774
|
-
}
|
|
5775
|
-
function runLightChildNodesDisconnectedCallback(vm) {
|
|
5776
|
-
const {
|
|
5777
|
-
aChildren: adoptedChildren
|
|
5778
|
-
} = vm;
|
|
5779
|
-
recursivelyDisconnectChildren(adoptedChildren);
|
|
5780
|
-
}
|
|
5781
|
-
/**
|
|
5782
|
-
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
5783
|
-
* instead it can be partial, when a custom element vnode is found, we don't
|
|
5784
|
-
* need to continue into its children because by attempting to disconnect the
|
|
5785
|
-
* custom element itself will trigger the removal of anything slotted or anything
|
|
5786
|
-
* defined on its shadow.
|
|
5787
|
-
*/
|
|
5788
|
-
function recursivelyDisconnectChildren(vnodes) {
|
|
5789
|
-
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
5790
|
-
const vnode = vnodes[i];
|
|
5791
|
-
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
5792
|
-
switch (vnode.type) {
|
|
5793
|
-
case 2 /* VNodeType.Element */:
|
|
5794
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
5795
|
-
break;
|
|
5796
|
-
case 3 /* VNodeType.CustomElement */:
|
|
5797
|
-
{
|
|
5798
|
-
const vm = getAssociatedVM(vnode.elm);
|
|
5799
|
-
resetComponentStateWhenRemoved(vm);
|
|
5800
|
-
break;
|
|
5801
|
-
}
|
|
5802
|
-
}
|
|
5803
|
-
}
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5806
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
5807
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
5808
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
5809
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
5810
|
-
function resetComponentRoot(vm) {
|
|
5811
|
-
const {
|
|
5812
|
-
children,
|
|
5813
|
-
renderRoot,
|
|
5814
|
-
renderer: {
|
|
5815
|
-
remove
|
|
5816
|
-
}
|
|
5817
|
-
} = vm;
|
|
5818
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
5819
|
-
const child = children[i];
|
|
5820
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5821
|
-
remove(child.elm, renderRoot);
|
|
5822
|
-
}
|
|
5823
|
-
}
|
|
5824
|
-
vm.children = EmptyArray;
|
|
5825
|
-
runChildNodesDisconnectedCallback(vm);
|
|
5826
|
-
vm.velements = EmptyArray;
|
|
5827
|
-
}
|
|
5828
|
-
function getErrorBoundaryVM(vm) {
|
|
5829
|
-
let currentVm = vm;
|
|
5830
|
-
while (!isNull(currentVm)) {
|
|
5831
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
5832
|
-
return currentVm;
|
|
5833
|
-
}
|
|
5834
|
-
currentVm = currentVm.owner;
|
|
5835
|
-
}
|
|
5836
|
-
}
|
|
5837
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
5838
|
-
let error;
|
|
5839
|
-
pre();
|
|
5840
|
-
try {
|
|
5841
|
-
job();
|
|
5842
|
-
} catch (e) {
|
|
5843
|
-
error = Object(e);
|
|
5844
|
-
} finally {
|
|
5845
|
-
post();
|
|
5846
|
-
if (!isUndefined$1(error)) {
|
|
5847
|
-
addErrorComponentStack(vm, error);
|
|
5848
|
-
const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
5849
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
5850
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
5851
|
-
}
|
|
5852
|
-
|
|
5853
|
-
resetComponentRoot(vm); // remove offenders
|
|
5854
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
5855
|
-
// error boundaries must have an ErrorCallback
|
|
5856
|
-
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
5857
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
5858
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
5859
|
-
}
|
|
5860
|
-
}
|
|
5861
|
-
}
|
|
5862
|
-
|
|
5863
|
-
/*
|
|
5864
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
5865
|
-
* All rights reserved.
|
|
5866
|
-
* SPDX-License-Identifier: MIT
|
|
5867
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5868
|
-
*/
|
|
5869
|
-
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
5870
|
-
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
5871
|
-
const WIRE_DEBUG_ENTRY = '@wire';
|
|
5872
|
-
const WireMetaMap = new Map();
|
|
5873
|
-
class WireContextRegistrationEvent extends CustomEvent {
|
|
5874
|
-
constructor(adapterToken, {
|
|
5875
|
-
setNewContext,
|
|
5876
|
-
setDisconnectedCallback
|
|
5877
|
-
}) {
|
|
5878
|
-
super(adapterToken, {
|
|
5879
|
-
bubbles: true,
|
|
5880
|
-
composed: true
|
|
5881
|
-
});
|
|
5882
|
-
defineProperties(this, {
|
|
5883
|
-
setNewContext: {
|
|
5884
|
-
value: setNewContext
|
|
5885
|
-
},
|
|
5886
|
-
setDisconnectedCallback: {
|
|
5887
|
-
value: setDisconnectedCallback
|
|
5888
|
-
}
|
|
5889
|
-
});
|
|
5890
|
-
}
|
|
5891
|
-
}
|
|
5892
|
-
function createFieldDataCallback(vm, name) {
|
|
5893
|
-
return value => {
|
|
5894
|
-
updateComponentValue(vm, name, value);
|
|
5895
|
-
};
|
|
5896
|
-
}
|
|
5897
|
-
function createMethodDataCallback(vm, method) {
|
|
5898
|
-
return value => {
|
|
5899
|
-
// dispatching new value into the wired method
|
|
5900
|
-
runWithBoundaryProtection(vm, vm.owner, noop, () => {
|
|
5901
|
-
// job
|
|
5902
|
-
method.call(vm.component, value);
|
|
5903
|
-
}, noop);
|
|
5904
|
-
};
|
|
5905
|
-
}
|
|
5906
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
5907
|
-
// creating the reactive observer for reactive params when needed
|
|
5908
|
-
const ro = createReactiveObserver();
|
|
5909
|
-
const computeConfigAndUpdate = () => {
|
|
5910
|
-
let config;
|
|
5911
|
-
ro.observe(() => config = configCallback(component));
|
|
5912
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
5913
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
5914
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
5915
|
-
callbackWhenConfigIsReady(config);
|
|
5916
|
-
};
|
|
5917
|
-
return {
|
|
5918
|
-
computeConfigAndUpdate,
|
|
5919
|
-
ro
|
|
5920
|
-
};
|
|
5921
|
-
}
|
|
5922
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
5923
|
-
const {
|
|
5924
|
-
adapter
|
|
5925
|
-
} = wireDef;
|
|
5926
|
-
const adapterContextToken = getAdapterToken(adapter);
|
|
5927
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
5928
|
-
return; // no provider found, nothing to be done
|
|
5929
|
-
}
|
|
5930
|
-
|
|
5931
|
-
const {
|
|
5932
|
-
elm,
|
|
5933
|
-
context: {
|
|
5934
|
-
wiredConnecting,
|
|
5935
|
-
wiredDisconnecting
|
|
5936
|
-
},
|
|
5937
|
-
renderer: {
|
|
5938
|
-
dispatchEvent
|
|
5939
|
-
}
|
|
5940
|
-
} = vm;
|
|
5941
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
5942
|
-
ArrayPush$1.call(wiredConnecting, () => {
|
|
5943
|
-
// This event is responsible for connecting the host element with another
|
|
5944
|
-
// element in the composed path that is providing contextual data. The provider
|
|
5945
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
5946
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
5947
|
-
// guarantee that the linkage can be forged.
|
|
5948
|
-
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
5949
|
-
setNewContext(newContext) {
|
|
5950
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
5951
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
5952
|
-
callbackWhenContextIsReady(newContext);
|
|
5953
|
-
},
|
|
5954
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
5955
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
5956
|
-
// the the element hosting the wire is disconnected
|
|
5957
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
5958
|
-
}
|
|
5959
|
-
});
|
|
5960
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
5961
|
-
});
|
|
5962
|
-
}
|
|
5963
|
-
function createConnector(vm, name, wireDef) {
|
|
5964
|
-
const {
|
|
5965
|
-
method,
|
|
5966
|
-
adapter,
|
|
5967
|
-
configCallback,
|
|
5968
|
-
dynamic
|
|
5969
|
-
} = wireDef;
|
|
5970
|
-
let debugInfo;
|
|
5971
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5972
|
-
const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
5973
|
-
debugInfo = create(null);
|
|
5974
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
5975
|
-
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
5976
|
-
}
|
|
5977
|
-
const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
5978
|
-
const dataCallback = value => {
|
|
5979
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5980
|
-
debugInfo.data = value;
|
|
5981
|
-
// Note: most of the time, the data provided is for the current config, but there may be
|
|
5982
|
-
// some conditions in which it does not, ex:
|
|
5983
|
-
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
5984
|
-
debugInfo.wasDataProvisionedForConfig = true;
|
|
5985
|
-
}
|
|
5986
|
-
fieldOrMethodCallback(value);
|
|
5987
|
-
};
|
|
5988
|
-
let context;
|
|
5989
|
-
let connector;
|
|
5990
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
5991
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
5992
|
-
value: vm.elm
|
|
5993
|
-
});
|
|
5994
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
5995
|
-
value: dynamic
|
|
5996
|
-
});
|
|
5997
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
5998
|
-
// job
|
|
5999
|
-
connector = new adapter(dataCallback);
|
|
6000
|
-
}, noop);
|
|
6001
|
-
const updateConnectorConfig = config => {
|
|
6002
|
-
// every time the config is recomputed due to tracking,
|
|
6003
|
-
// this callback will be invoked with the new computed config
|
|
6004
|
-
runWithBoundaryProtection(vm, vm, noop, () => {
|
|
6005
|
-
// job
|
|
6006
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6007
|
-
debugInfo.config = config;
|
|
6008
|
-
debugInfo.context = context;
|
|
6009
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6010
|
-
}
|
|
6011
|
-
connector.update(config, context);
|
|
6012
|
-
}, noop);
|
|
6013
|
-
};
|
|
6014
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6015
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
6016
|
-
const {
|
|
6017
|
-
computeConfigAndUpdate,
|
|
6018
|
-
ro
|
|
6019
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
6020
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6021
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
6022
|
-
createContextWatcher(vm, wireDef, newContext => {
|
|
6023
|
-
// every time the context is pushed into this component,
|
|
6024
|
-
// this callback will be invoked with the new computed context
|
|
6025
|
-
if (context !== newContext) {
|
|
6026
|
-
context = newContext;
|
|
6027
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6028
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6029
|
-
// (ever), while context can have identity
|
|
6030
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
6031
|
-
computeConfigAndUpdate();
|
|
6032
|
-
}
|
|
6033
|
-
}
|
|
6034
|
-
});
|
|
6087
|
+
// post
|
|
6088
|
+
logOperationEnd(2 /* OperationId.Patch */, vm);
|
|
6089
|
+
});
|
|
6090
|
+
}
|
|
6035
6091
|
}
|
|
6036
|
-
|
|
6037
|
-
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
6038
|
-
connector,
|
|
6039
|
-
computeConfigAndUpdate,
|
|
6040
|
-
resetConfigWatcher: () => ro.reset()
|
|
6041
|
-
};
|
|
6092
|
+
if (vm.state === 1 /* VMState.connected */) ;
|
|
6042
6093
|
}
|
|
6043
|
-
|
|
6044
|
-
function
|
|
6045
|
-
|
|
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
|
+
}
|
|
6046
6122
|
}
|
|
6047
|
-
function
|
|
6048
|
-
|
|
6123
|
+
function hasWireAdapters(vm) {
|
|
6124
|
+
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
6049
6125
|
}
|
|
6050
|
-
function
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
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.`);
|
|
6054
6129
|
}
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
}
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
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);
|
|
6068
6155
|
}
|
|
6069
|
-
const def = {
|
|
6070
|
-
adapter,
|
|
6071
|
-
configCallback,
|
|
6072
|
-
dynamic
|
|
6073
|
-
};
|
|
6074
|
-
WireMetaMap.set(descriptor, def);
|
|
6075
6156
|
}
|
|
6076
|
-
function
|
|
6157
|
+
function runChildNodesDisconnectedCallback(vm) {
|
|
6077
6158
|
const {
|
|
6078
|
-
|
|
6079
|
-
def: {
|
|
6080
|
-
wire
|
|
6081
|
-
}
|
|
6159
|
+
velements: vCustomElementCollection
|
|
6082
6160
|
} = vm;
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
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
|
+
}
|
|
6093
6182
|
}
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
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;
|
|
6107
6211
|
}
|
|
6108
|
-
|
|
6109
|
-
computeConfigAndUpdate();
|
|
6110
|
-
});
|
|
6111
|
-
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
6112
|
-
connector.disconnect();
|
|
6113
|
-
resetConfigWatcher();
|
|
6114
|
-
});
|
|
6212
|
+
}
|
|
6115
6213
|
}
|
|
6116
6214
|
}
|
|
6117
6215
|
}
|
|
6118
|
-
|
|
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) {
|
|
6119
6221
|
const {
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
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
|
+
}
|
|
6124
6233
|
}
|
|
6234
|
+
vm.children = EmptyArray;
|
|
6235
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6236
|
+
vm.velements = EmptyArray;
|
|
6125
6237
|
}
|
|
6126
|
-
function
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
// job
|
|
6132
|
-
for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {
|
|
6133
|
-
wiredDisconnecting[i]();
|
|
6238
|
+
function getErrorBoundaryVM(vm) {
|
|
6239
|
+
let currentVm = vm;
|
|
6240
|
+
while (!isNull(currentVm)) {
|
|
6241
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6242
|
+
return currentVm;
|
|
6134
6243
|
}
|
|
6135
|
-
|
|
6244
|
+
currentVm = currentVm.owner;
|
|
6245
|
+
}
|
|
6136
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
|
+
}
|
|
6271
|
+
}
|
|
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];
|
|
6137
6288
|
|
|
6138
6289
|
/*
|
|
6139
6290
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6379,7 +6530,7 @@ function freezeTemplate(tmpl) {
|
|
|
6379
6530
|
}
|
|
6380
6531
|
}
|
|
6381
6532
|
}
|
|
6382
|
-
/* version: 2.
|
|
6533
|
+
/* version: 2.35.0 */
|
|
6383
6534
|
|
|
6384
6535
|
/*
|
|
6385
6536
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6850,7 +7001,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6850
7001
|
*/
|
|
6851
7002
|
freeze(LightningElement);
|
|
6852
7003
|
seal(LightningElement.prototype);
|
|
6853
|
-
/* version: 2.
|
|
7004
|
+
/* version: 2.35.0 */
|
|
6854
7005
|
|
|
6855
7006
|
exports.LightningElement = LightningElement;
|
|
6856
7007
|
exports.api = api$1;
|