lwc 2.5.10 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +100 -96
- package/dist/engine-dom/iife/es2017/engine-dom.js +100 -96
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +99 -91
- package/dist/engine-dom/iife/es5/engine-dom.js +112 -108
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +111 -103
- package/dist/engine-dom/umd/es2017/engine-dom.js +100 -96
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +99 -91
- package/dist/engine-dom/umd/es5/engine-dom.js +112 -108
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +111 -103
- package/dist/engine-server/commonjs/es2017/engine-server.js +111 -104
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +111 -104
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +56 -133
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +56 -133
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +56 -133
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +67 -130
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +67 -130
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +56 -133
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +56 -133
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +67 -130
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +67 -130
- 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 +11 -11
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +11 -11
- 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 +11 -11
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +11 -11
- package/package.json +8 -8
|
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
|
194
194
|
// we can't use typeof since it will fail when transpiling.
|
|
195
195
|
|
|
196
196
|
const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
|
|
197
|
-
/** version: 2.
|
|
197
|
+
/** version: 2.7.1 */
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -302,6 +302,7 @@ const {
|
|
|
302
302
|
getElementsByClassName: getElementsByClassName$1
|
|
303
303
|
} = HTMLElement.prototype;
|
|
304
304
|
const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
|
|
305
|
+
const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
|
|
305
306
|
/*
|
|
306
307
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
307
308
|
* All rights reserved.
|
|
@@ -521,20 +522,6 @@ function arrayFromCollection(collection) {
|
|
|
521
522
|
|
|
522
523
|
return cloned;
|
|
523
524
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Copyright (C) 2018 salesforce.com, inc.
|
|
526
|
-
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
if (!_globalThis.lwcRuntimeFlags) {
|
|
530
|
-
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
531
|
-
value: create(null)
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
536
|
-
/** version: 2.5.10 */
|
|
537
|
-
|
|
538
525
|
/*
|
|
539
526
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
540
527
|
* All rights reserved.
|
|
@@ -542,6 +529,7 @@ const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
|
542
529
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
543
530
|
*/
|
|
544
531
|
|
|
532
|
+
|
|
545
533
|
const eventTargetPrototype = typeof EventTarget !== 'undefined' ? EventTarget.prototype : _Node.prototype;
|
|
546
534
|
const {
|
|
547
535
|
addEventListener,
|
|
@@ -596,19 +584,9 @@ function getEventListenerWrapper(fnOrObj) {
|
|
|
596
584
|
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
|
|
597
585
|
}
|
|
598
586
|
|
|
599
|
-
const
|
|
600
|
-
composed
|
|
601
|
-
} = event;
|
|
602
|
-
let shouldInvoke;
|
|
603
|
-
|
|
604
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
605
|
-
shouldInvoke = !(eventToShadowRootMap.has(event) && isFalse(composed));
|
|
606
|
-
} else {
|
|
607
|
-
const actualTarget = getActualTarget(event);
|
|
608
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
609
|
-
}
|
|
587
|
+
const actualTarget = getActualTarget(event);
|
|
610
588
|
|
|
611
|
-
if (!
|
|
589
|
+
if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
612
590
|
return;
|
|
613
591
|
}
|
|
614
592
|
|
|
@@ -629,25 +607,6 @@ function getEventListenerWrapper(fnOrObj) {
|
|
|
629
607
|
|
|
630
608
|
|
|
631
609
|
const eventToContextMap = new WeakMap();
|
|
632
|
-
|
|
633
|
-
function isChildNode(root, node) {
|
|
634
|
-
return !!(compareDocumentPosition.call(root, node) & DOCUMENT_POSITION_CONTAINED_BY);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
const GET_ROOT_NODE_CONFIG_FALSE = {
|
|
638
|
-
composed: false
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
function getRootNodeHost(node, options) {
|
|
642
|
-
let rootNode = node.getRootNode(options);
|
|
643
|
-
|
|
644
|
-
if (isSyntheticShadowRoot(rootNode)) {
|
|
645
|
-
rootNode = getHost(rootNode);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
return rootNode;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
610
|
const customElementToWrappedListeners = new WeakMap();
|
|
652
611
|
|
|
653
612
|
function getEventMap(elm) {
|
|
@@ -692,16 +651,9 @@ function getWrappedShadowRootListener(listener) {
|
|
|
692
651
|
currentTarget = getShadowRoot(currentTarget);
|
|
693
652
|
}
|
|
694
653
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
698
|
-
shouldInvoke = shouldInvokeShadowRootListener(event);
|
|
699
|
-
} else {
|
|
700
|
-
const actualTarget = getActualTarget(event);
|
|
701
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
702
|
-
}
|
|
654
|
+
const actualTarget = getActualTarget(event);
|
|
703
655
|
|
|
704
|
-
if (
|
|
656
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
705
657
|
listener.call(currentTarget, event);
|
|
706
658
|
}
|
|
707
659
|
};
|
|
@@ -728,16 +680,9 @@ function getWrappedCustomElementListener(listener) {
|
|
|
728
680
|
customElementWrappedListener = function (event) {
|
|
729
681
|
// currentTarget is always defined inside an event listener
|
|
730
682
|
const currentTarget = eventCurrentTargetGetter.call(event);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
734
|
-
shouldInvoke = shouldInvokeCustomElementListener(event);
|
|
735
|
-
} else {
|
|
736
|
-
const actualTarget = getActualTarget(event);
|
|
737
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
738
|
-
}
|
|
683
|
+
const actualTarget = getActualTarget(event);
|
|
739
684
|
|
|
740
|
-
if (
|
|
685
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
741
686
|
listener.call(currentTarget, event);
|
|
742
687
|
}
|
|
743
688
|
};
|
|
@@ -858,70 +803,6 @@ function detachDOMListener(elm, type, wrappedListener) {
|
|
|
858
803
|
}
|
|
859
804
|
}
|
|
860
805
|
|
|
861
|
-
function shouldInvokeCustomElementListener(event) {
|
|
862
|
-
const {
|
|
863
|
-
composed
|
|
864
|
-
} = event;
|
|
865
|
-
|
|
866
|
-
if (isTrue(composed)) {
|
|
867
|
-
// Listeners on host elements should always be invoked for {composed: true} events.
|
|
868
|
-
return true;
|
|
869
|
-
} // If this {composed: false} event was dispatched on any root.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
if (eventToShadowRootMap.has(event)) {
|
|
873
|
-
return false;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
const target = eventTargetGetter.call(event);
|
|
877
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If this {composed: false} event was dispatched on the current target host.
|
|
878
|
-
|
|
879
|
-
if (target === currentTarget) {
|
|
880
|
-
return true;
|
|
881
|
-
} // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
|
882
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
|
883
|
-
// host was assigned to a slot in the composed subtree of the current target host.
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
|
887
|
-
const currentTargetHost = currentTarget;
|
|
888
|
-
return isChildNode(targetHost, currentTargetHost);
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
function shouldInvokeShadowRootListener(event) {
|
|
892
|
-
const {
|
|
893
|
-
composed
|
|
894
|
-
} = event;
|
|
895
|
-
const target = eventTargetGetter.call(event);
|
|
896
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If the event was dispatched on the host or its root.
|
|
897
|
-
|
|
898
|
-
if (target === currentTarget) {
|
|
899
|
-
// Invoke the listener if the event was dispatched directly on the root.
|
|
900
|
-
return eventToShadowRootMap.get(event) === getShadowRoot(target);
|
|
901
|
-
} // At this point the event is {bubbles: true} and was dispatched from a shadow-including descendant node.
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
if (isTrue(composed)) {
|
|
905
|
-
// Invoke the listener if the event is {composed: true}.
|
|
906
|
-
return true;
|
|
907
|
-
} // At this point the event must be {bubbles: true, composed: false}.
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
if (isTrue(eventToShadowRootMap.has(event))) {
|
|
911
|
-
// Don't invoke the listener because the event was dispatched on a descendant root.
|
|
912
|
-
return false;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
|
916
|
-
const currentTargetHost = currentTarget;
|
|
917
|
-
const isCurrentTargetSlotted = isChildNode(targetHost, currentTargetHost); // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
|
918
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
|
919
|
-
// host was assigned to a slot in the composed subtree of the current target host, or the
|
|
920
|
-
// descendant node is in the shadow tree of the current root.
|
|
921
|
-
|
|
922
|
-
return isCurrentTargetSlotted || targetHost === currentTargetHost;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
806
|
function addCustomElementEventListener(type, listener, _options) {
|
|
926
807
|
if (process.env.NODE_ENV !== 'production') {
|
|
927
808
|
if (!isFunction(listener)) {
|
|
@@ -1669,6 +1550,20 @@ function getOuterHTML(node) {
|
|
|
1669
1550
|
}
|
|
1670
1551
|
}
|
|
1671
1552
|
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
1555
|
+
*/
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
if (!_globalThis.lwcRuntimeFlags) {
|
|
1559
|
+
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
1560
|
+
value: create(null)
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
1565
|
+
/** version: 2.7.1 */
|
|
1566
|
+
|
|
1672
1567
|
/*
|
|
1673
1568
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1674
1569
|
* All rights reserved.
|
|
@@ -1683,7 +1578,6 @@ function getOuterHTML(node) {
|
|
|
1683
1578
|
* because we don't want to patch the children getters for those elements.
|
|
1684
1579
|
*/
|
|
1685
1580
|
|
|
1686
|
-
|
|
1687
1581
|
function hasMountedChildren(node) {
|
|
1688
1582
|
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
|
1689
1583
|
}
|
|
@@ -1762,7 +1656,9 @@ function parentElementGetterPatched() {
|
|
|
1762
1656
|
}
|
|
1763
1657
|
|
|
1764
1658
|
function compareDocumentPositionPatched(otherNode) {
|
|
1765
|
-
if (this
|
|
1659
|
+
if (this === otherNode) {
|
|
1660
|
+
return 0;
|
|
1661
|
+
} else if (this.getRootNode() === otherNode) {
|
|
1766
1662
|
// "this" is in a shadow tree where the shadow root is the "otherNode".
|
|
1767
1663
|
return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
|
|
1768
1664
|
} else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
|
|
@@ -2302,6 +2198,12 @@ const SyntheticShadowRootDescriptors = {
|
|
|
2302
2198
|
return `[object ShadowRoot]`;
|
|
2303
2199
|
}
|
|
2304
2200
|
|
|
2201
|
+
},
|
|
2202
|
+
synthetic: {
|
|
2203
|
+
writable: false,
|
|
2204
|
+
enumerable: false,
|
|
2205
|
+
configurable: false,
|
|
2206
|
+
value: true
|
|
2305
2207
|
}
|
|
2306
2208
|
};
|
|
2307
2209
|
const ShadowRootDescriptors = {
|
|
@@ -4140,6 +4042,14 @@ retargetRelatedTarget(FocusEvent);
|
|
|
4140
4042
|
*/
|
|
4141
4043
|
|
|
4142
4044
|
retargetRelatedTarget(MouseEvent);
|
|
4045
|
+
/*
|
|
4046
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
|
4047
|
+
* All rights reserved.
|
|
4048
|
+
* SPDX-License-Identifier: MIT
|
|
4049
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4050
|
+
*/
|
|
4051
|
+
|
|
4052
|
+
const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
|
|
4143
4053
|
/*
|
|
4144
4054
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4145
4055
|
* All rights reserved.
|
|
@@ -4193,10 +4103,22 @@ function getFilteredSlotFlattenNodes(slot) {
|
|
|
4193
4103
|
}
|
|
4194
4104
|
|
|
4195
4105
|
function assignedSlotGetterPatched() {
|
|
4196
|
-
const parentNode = parentNodeGetter.call(this);
|
|
4106
|
+
const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
|
|
4107
|
+
|
|
4108
|
+
if (parentNode instanceof Element) {
|
|
4109
|
+
const sr = shadowRootGetter.call(parentNode);
|
|
4110
|
+
|
|
4111
|
+
if (isInstanceOfNativeShadowRoot(sr)) {
|
|
4112
|
+
if (this instanceof Text) {
|
|
4113
|
+
return assignedSlotGetter.call(this);
|
|
4114
|
+
}
|
|
4115
|
+
|
|
4116
|
+
return assignedSlotGetter$1.call(this);
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4197
4119
|
/**
|
|
4198
4120
|
* The node is assigned to a slot if:
|
|
4199
|
-
* - it has a parent and
|
|
4121
|
+
* - it has a parent and its parent is a slot element
|
|
4200
4122
|
* - and if the slot owner key is different than the node owner key.
|
|
4201
4123
|
*
|
|
4202
4124
|
* When the slot and the slotted node are 2 different shadow trees, the owner keys will be
|
|
@@ -4205,6 +4127,7 @@ function assignedSlotGetterPatched() {
|
|
|
4205
4127
|
* different than the node owner key (always `undefined`).
|
|
4206
4128
|
*/
|
|
4207
4129
|
|
|
4130
|
+
|
|
4208
4131
|
if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
|
|
4209
4132
|
return parentNode;
|
|
4210
4133
|
}
|
|
@@ -5829,4 +5752,4 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
|
5829
5752
|
|
|
5830
5753
|
configurable: true
|
|
5831
5754
|
});
|
|
5832
|
-
/** version: 2.
|
|
5755
|
+
/** version: 2.7.1 */
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
// we can't use typeof since it will fail when transpiling.
|
|
198
198
|
|
|
199
199
|
const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
|
|
200
|
-
/** version: 2.
|
|
200
|
+
/** version: 2.7.1 */
|
|
201
201
|
|
|
202
202
|
/*
|
|
203
203
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -305,6 +305,7 @@
|
|
|
305
305
|
getElementsByClassName: getElementsByClassName$1
|
|
306
306
|
} = HTMLElement.prototype;
|
|
307
307
|
const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
|
|
308
|
+
const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
|
|
308
309
|
/*
|
|
309
310
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
310
311
|
* All rights reserved.
|
|
@@ -524,20 +525,6 @@
|
|
|
524
525
|
|
|
525
526
|
return cloned;
|
|
526
527
|
}
|
|
527
|
-
/**
|
|
528
|
-
* Copyright (C) 2018 salesforce.com, inc.
|
|
529
|
-
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (!_globalThis.lwcRuntimeFlags) {
|
|
533
|
-
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
534
|
-
value: create(null)
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
539
|
-
/** version: 2.5.10 */
|
|
540
|
-
|
|
541
528
|
/*
|
|
542
529
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
543
530
|
* All rights reserved.
|
|
@@ -545,6 +532,7 @@
|
|
|
545
532
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
546
533
|
*/
|
|
547
534
|
|
|
535
|
+
|
|
548
536
|
const eventTargetPrototype = typeof EventTarget !== 'undefined' ? EventTarget.prototype : _Node.prototype;
|
|
549
537
|
const {
|
|
550
538
|
addEventListener,
|
|
@@ -599,19 +587,9 @@
|
|
|
599
587
|
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
|
|
600
588
|
}
|
|
601
589
|
|
|
602
|
-
const
|
|
603
|
-
composed
|
|
604
|
-
} = event;
|
|
605
|
-
let shouldInvoke;
|
|
606
|
-
|
|
607
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
608
|
-
shouldInvoke = !(eventToShadowRootMap.has(event) && isFalse(composed));
|
|
609
|
-
} else {
|
|
610
|
-
const actualTarget = getActualTarget(event);
|
|
611
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
612
|
-
}
|
|
590
|
+
const actualTarget = getActualTarget(event);
|
|
613
591
|
|
|
614
|
-
if (!
|
|
592
|
+
if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
615
593
|
return;
|
|
616
594
|
}
|
|
617
595
|
|
|
@@ -632,25 +610,6 @@
|
|
|
632
610
|
|
|
633
611
|
|
|
634
612
|
const eventToContextMap = new WeakMap();
|
|
635
|
-
|
|
636
|
-
function isChildNode(root, node) {
|
|
637
|
-
return !!(compareDocumentPosition.call(root, node) & DOCUMENT_POSITION_CONTAINED_BY);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
const GET_ROOT_NODE_CONFIG_FALSE = {
|
|
641
|
-
composed: false
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
function getRootNodeHost(node, options) {
|
|
645
|
-
let rootNode = node.getRootNode(options);
|
|
646
|
-
|
|
647
|
-
if (isSyntheticShadowRoot(rootNode)) {
|
|
648
|
-
rootNode = getHost(rootNode);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
return rootNode;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
613
|
const customElementToWrappedListeners = new WeakMap();
|
|
655
614
|
|
|
656
615
|
function getEventMap(elm) {
|
|
@@ -695,16 +654,9 @@
|
|
|
695
654
|
currentTarget = getShadowRoot(currentTarget);
|
|
696
655
|
}
|
|
697
656
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
701
|
-
shouldInvoke = shouldInvokeShadowRootListener(event);
|
|
702
|
-
} else {
|
|
703
|
-
const actualTarget = getActualTarget(event);
|
|
704
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
705
|
-
}
|
|
657
|
+
const actualTarget = getActualTarget(event);
|
|
706
658
|
|
|
707
|
-
if (
|
|
659
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
708
660
|
listener.call(currentTarget, event);
|
|
709
661
|
}
|
|
710
662
|
};
|
|
@@ -731,16 +683,9 @@
|
|
|
731
683
|
customElementWrappedListener = function (event) {
|
|
732
684
|
// currentTarget is always defined inside an event listener
|
|
733
685
|
const currentTarget = eventCurrentTargetGetter.call(event);
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
|
737
|
-
shouldInvoke = shouldInvokeCustomElementListener(event);
|
|
738
|
-
} else {
|
|
739
|
-
const actualTarget = getActualTarget(event);
|
|
740
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
|
741
|
-
}
|
|
686
|
+
const actualTarget = getActualTarget(event);
|
|
742
687
|
|
|
743
|
-
if (
|
|
688
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
744
689
|
listener.call(currentTarget, event);
|
|
745
690
|
}
|
|
746
691
|
};
|
|
@@ -861,70 +806,6 @@
|
|
|
861
806
|
}
|
|
862
807
|
}
|
|
863
808
|
|
|
864
|
-
function shouldInvokeCustomElementListener(event) {
|
|
865
|
-
const {
|
|
866
|
-
composed
|
|
867
|
-
} = event;
|
|
868
|
-
|
|
869
|
-
if (isTrue(composed)) {
|
|
870
|
-
// Listeners on host elements should always be invoked for {composed: true} events.
|
|
871
|
-
return true;
|
|
872
|
-
} // If this {composed: false} event was dispatched on any root.
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
if (eventToShadowRootMap.has(event)) {
|
|
876
|
-
return false;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
const target = eventTargetGetter.call(event);
|
|
880
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If this {composed: false} event was dispatched on the current target host.
|
|
881
|
-
|
|
882
|
-
if (target === currentTarget) {
|
|
883
|
-
return true;
|
|
884
|
-
} // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
|
885
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
|
886
|
-
// host was assigned to a slot in the composed subtree of the current target host.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
|
890
|
-
const currentTargetHost = currentTarget;
|
|
891
|
-
return isChildNode(targetHost, currentTargetHost);
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
function shouldInvokeShadowRootListener(event) {
|
|
895
|
-
const {
|
|
896
|
-
composed
|
|
897
|
-
} = event;
|
|
898
|
-
const target = eventTargetGetter.call(event);
|
|
899
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If the event was dispatched on the host or its root.
|
|
900
|
-
|
|
901
|
-
if (target === currentTarget) {
|
|
902
|
-
// Invoke the listener if the event was dispatched directly on the root.
|
|
903
|
-
return eventToShadowRootMap.get(event) === getShadowRoot(target);
|
|
904
|
-
} // At this point the event is {bubbles: true} and was dispatched from a shadow-including descendant node.
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
if (isTrue(composed)) {
|
|
908
|
-
// Invoke the listener if the event is {composed: true}.
|
|
909
|
-
return true;
|
|
910
|
-
} // At this point the event must be {bubbles: true, composed: false}.
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
if (isTrue(eventToShadowRootMap.has(event))) {
|
|
914
|
-
// Don't invoke the listener because the event was dispatched on a descendant root.
|
|
915
|
-
return false;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
|
919
|
-
const currentTargetHost = currentTarget;
|
|
920
|
-
const isCurrentTargetSlotted = isChildNode(targetHost, currentTargetHost); // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
|
921
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
|
922
|
-
// host was assigned to a slot in the composed subtree of the current target host, or the
|
|
923
|
-
// descendant node is in the shadow tree of the current root.
|
|
924
|
-
|
|
925
|
-
return isCurrentTargetSlotted || targetHost === currentTargetHost;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
809
|
function addCustomElementEventListener(type, listener, _options) {
|
|
929
810
|
if (process.env.NODE_ENV !== 'production') {
|
|
930
811
|
if (!isFunction(listener)) {
|
|
@@ -1672,6 +1553,20 @@
|
|
|
1672
1553
|
}
|
|
1673
1554
|
}
|
|
1674
1555
|
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
1558
|
+
*/
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
if (!_globalThis.lwcRuntimeFlags) {
|
|
1562
|
+
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
1563
|
+
value: create(null)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
1568
|
+
/** version: 2.7.1 */
|
|
1569
|
+
|
|
1675
1570
|
/*
|
|
1676
1571
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1677
1572
|
* All rights reserved.
|
|
@@ -1686,7 +1581,6 @@
|
|
|
1686
1581
|
* because we don't want to patch the children getters for those elements.
|
|
1687
1582
|
*/
|
|
1688
1583
|
|
|
1689
|
-
|
|
1690
1584
|
function hasMountedChildren(node) {
|
|
1691
1585
|
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
|
1692
1586
|
}
|
|
@@ -1765,7 +1659,9 @@
|
|
|
1765
1659
|
}
|
|
1766
1660
|
|
|
1767
1661
|
function compareDocumentPositionPatched(otherNode) {
|
|
1768
|
-
if (this
|
|
1662
|
+
if (this === otherNode) {
|
|
1663
|
+
return 0;
|
|
1664
|
+
} else if (this.getRootNode() === otherNode) {
|
|
1769
1665
|
// "this" is in a shadow tree where the shadow root is the "otherNode".
|
|
1770
1666
|
return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
|
|
1771
1667
|
} else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
|
|
@@ -2305,6 +2201,12 @@
|
|
|
2305
2201
|
return `[object ShadowRoot]`;
|
|
2306
2202
|
}
|
|
2307
2203
|
|
|
2204
|
+
},
|
|
2205
|
+
synthetic: {
|
|
2206
|
+
writable: false,
|
|
2207
|
+
enumerable: false,
|
|
2208
|
+
configurable: false,
|
|
2209
|
+
value: true
|
|
2308
2210
|
}
|
|
2309
2211
|
};
|
|
2310
2212
|
const ShadowRootDescriptors = {
|
|
@@ -4143,6 +4045,14 @@
|
|
|
4143
4045
|
*/
|
|
4144
4046
|
|
|
4145
4047
|
retargetRelatedTarget(MouseEvent);
|
|
4048
|
+
/*
|
|
4049
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
|
4050
|
+
* All rights reserved.
|
|
4051
|
+
* SPDX-License-Identifier: MIT
|
|
4052
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4053
|
+
*/
|
|
4054
|
+
|
|
4055
|
+
const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
|
|
4146
4056
|
/*
|
|
4147
4057
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4148
4058
|
* All rights reserved.
|
|
@@ -4196,10 +4106,22 @@
|
|
|
4196
4106
|
}
|
|
4197
4107
|
|
|
4198
4108
|
function assignedSlotGetterPatched() {
|
|
4199
|
-
const parentNode = parentNodeGetter.call(this);
|
|
4109
|
+
const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
|
|
4110
|
+
|
|
4111
|
+
if (parentNode instanceof Element) {
|
|
4112
|
+
const sr = shadowRootGetter.call(parentNode);
|
|
4113
|
+
|
|
4114
|
+
if (isInstanceOfNativeShadowRoot(sr)) {
|
|
4115
|
+
if (this instanceof Text) {
|
|
4116
|
+
return assignedSlotGetter.call(this);
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
return assignedSlotGetter$1.call(this);
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4200
4122
|
/**
|
|
4201
4123
|
* The node is assigned to a slot if:
|
|
4202
|
-
* - it has a parent and
|
|
4124
|
+
* - it has a parent and its parent is a slot element
|
|
4203
4125
|
* - and if the slot owner key is different than the node owner key.
|
|
4204
4126
|
*
|
|
4205
4127
|
* When the slot and the slotted node are 2 different shadow trees, the owner keys will be
|
|
@@ -4208,6 +4130,7 @@
|
|
|
4208
4130
|
* different than the node owner key (always `undefined`).
|
|
4209
4131
|
*/
|
|
4210
4132
|
|
|
4133
|
+
|
|
4211
4134
|
if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
|
|
4212
4135
|
return parentNode;
|
|
4213
4136
|
}
|
|
@@ -5832,6 +5755,6 @@
|
|
|
5832
5755
|
|
|
5833
5756
|
configurable: true
|
|
5834
5757
|
});
|
|
5835
|
-
/** version: 2.
|
|
5758
|
+
/** version: 2.7.1 */
|
|
5836
5759
|
|
|
5837
5760
|
})();
|