@lwc/synthetic-shadow 2.5.10 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/synthetic-shadow.js +27 -128
- package/package.json +4 -4
package/dist/synthetic-shadow.js
CHANGED
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
194
194
|
|
195
195
|
|
196
196
|
const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
|
197
|
-
/** version: 2.
|
197
|
+
/** version: 2.7.0 */
|
198
198
|
|
199
199
|
/*
|
200
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -515,19 +515,6 @@ function arrayFromCollection(collection) {
|
|
515
515
|
return cloned;
|
516
516
|
}
|
517
517
|
|
518
|
-
/**
|
519
|
-
* Copyright (C) 2018 salesforce.com, inc.
|
520
|
-
*/
|
521
|
-
|
522
|
-
if (!_globalThis.lwcRuntimeFlags) {
|
523
|
-
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
524
|
-
value: create(null)
|
525
|
-
});
|
526
|
-
}
|
527
|
-
|
528
|
-
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
529
|
-
/** version: 2.5.10 */
|
530
|
-
|
531
518
|
/*
|
532
519
|
* Copyright (c) 2018, salesforce.com, inc.
|
533
520
|
* All rights reserved.
|
@@ -587,19 +574,9 @@ function getEventListenerWrapper(fnOrObj) {
|
|
587
574
|
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
|
588
575
|
}
|
589
576
|
|
590
|
-
const
|
591
|
-
composed
|
592
|
-
} = event;
|
593
|
-
let shouldInvoke;
|
577
|
+
const actualTarget = getActualTarget(event);
|
594
578
|
|
595
|
-
if (
|
596
|
-
shouldInvoke = !(eventToShadowRootMap.has(event) && isFalse(composed));
|
597
|
-
} else {
|
598
|
-
const actualTarget = getActualTarget(event);
|
599
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
600
|
-
}
|
601
|
-
|
602
|
-
if (!shouldInvoke) {
|
579
|
+
if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
|
603
580
|
return;
|
604
581
|
}
|
605
582
|
|
@@ -619,25 +596,6 @@ function getEventListenerWrapper(fnOrObj) {
|
|
619
596
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
620
597
|
*/
|
621
598
|
const eventToContextMap = new WeakMap();
|
622
|
-
|
623
|
-
function isChildNode(root, node) {
|
624
|
-
return !!(compareDocumentPosition.call(root, node) & DOCUMENT_POSITION_CONTAINED_BY);
|
625
|
-
}
|
626
|
-
|
627
|
-
const GET_ROOT_NODE_CONFIG_FALSE = {
|
628
|
-
composed: false
|
629
|
-
};
|
630
|
-
|
631
|
-
function getRootNodeHost(node, options) {
|
632
|
-
let rootNode = node.getRootNode(options);
|
633
|
-
|
634
|
-
if (isSyntheticShadowRoot(rootNode)) {
|
635
|
-
rootNode = getHost(rootNode);
|
636
|
-
}
|
637
|
-
|
638
|
-
return rootNode;
|
639
|
-
}
|
640
|
-
|
641
599
|
const customElementToWrappedListeners = new WeakMap();
|
642
600
|
|
643
601
|
function getEventMap(elm) {
|
@@ -681,16 +639,9 @@ function getWrappedShadowRootListener(listener) {
|
|
681
639
|
currentTarget = getShadowRoot(currentTarget);
|
682
640
|
}
|
683
641
|
|
684
|
-
|
685
|
-
|
686
|
-
if (runtimeFlags.ENABLE_NON_COMPOSED_EVENTS_LEAKAGE) {
|
687
|
-
shouldInvoke = shouldInvokeShadowRootListener(event);
|
688
|
-
} else {
|
689
|
-
const actualTarget = getActualTarget(event);
|
690
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
691
|
-
}
|
642
|
+
const actualTarget = getActualTarget(event);
|
692
643
|
|
693
|
-
if (
|
644
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
694
645
|
listener.call(currentTarget, event);
|
695
646
|
}
|
696
647
|
};
|
@@ -717,16 +668,9 @@ function getWrappedCustomElementListener(listener) {
|
|
717
668
|
customElementWrappedListener = function (event) {
|
718
669
|
// currentTarget is always defined inside an event listener
|
719
670
|
const currentTarget = eventCurrentTargetGetter.call(event);
|
720
|
-
|
671
|
+
const actualTarget = getActualTarget(event);
|
721
672
|
|
722
|
-
if (
|
723
|
-
shouldInvoke = shouldInvokeCustomElementListener(event);
|
724
|
-
} else {
|
725
|
-
const actualTarget = getActualTarget(event);
|
726
|
-
shouldInvoke = shouldInvokeListener(event, actualTarget, currentTarget);
|
727
|
-
}
|
728
|
-
|
729
|
-
if (shouldInvoke) {
|
673
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
730
674
|
listener.call(currentTarget, event);
|
731
675
|
}
|
732
676
|
};
|
@@ -847,70 +791,6 @@ function detachDOMListener(elm, type, wrappedListener) {
|
|
847
791
|
}
|
848
792
|
}
|
849
793
|
|
850
|
-
function shouldInvokeCustomElementListener(event) {
|
851
|
-
const {
|
852
|
-
composed
|
853
|
-
} = event;
|
854
|
-
|
855
|
-
if (isTrue(composed)) {
|
856
|
-
// Listeners on host elements should always be invoked for {composed: true} events.
|
857
|
-
return true;
|
858
|
-
} // If this {composed: false} event was dispatched on any root.
|
859
|
-
|
860
|
-
|
861
|
-
if (eventToShadowRootMap.has(event)) {
|
862
|
-
return false;
|
863
|
-
}
|
864
|
-
|
865
|
-
const target = eventTargetGetter.call(event);
|
866
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If this {composed: false} event was dispatched on the current target host.
|
867
|
-
|
868
|
-
if (target === currentTarget) {
|
869
|
-
return true;
|
870
|
-
} // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
871
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
872
|
-
// host was assigned to a slot in the composed subtree of the current target host.
|
873
|
-
|
874
|
-
|
875
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
876
|
-
const currentTargetHost = currentTarget;
|
877
|
-
return isChildNode(targetHost, currentTargetHost);
|
878
|
-
}
|
879
|
-
|
880
|
-
function shouldInvokeShadowRootListener(event) {
|
881
|
-
const {
|
882
|
-
composed
|
883
|
-
} = event;
|
884
|
-
const target = eventTargetGetter.call(event);
|
885
|
-
const currentTarget = eventCurrentTargetGetter.call(event); // If the event was dispatched on the host or its root.
|
886
|
-
|
887
|
-
if (target === currentTarget) {
|
888
|
-
// Invoke the listener if the event was dispatched directly on the root.
|
889
|
-
return eventToShadowRootMap.get(event) === getShadowRoot(target);
|
890
|
-
} // At this point the event is {bubbles: true} and was dispatched from a shadow-including descendant node.
|
891
|
-
|
892
|
-
|
893
|
-
if (isTrue(composed)) {
|
894
|
-
// Invoke the listener if the event is {composed: true}.
|
895
|
-
return true;
|
896
|
-
} // At this point the event must be {bubbles: true, composed: false}.
|
897
|
-
|
898
|
-
|
899
|
-
if (isTrue(eventToShadowRootMap.has(event))) {
|
900
|
-
// Don't invoke the listener because the event was dispatched on a descendant root.
|
901
|
-
return false;
|
902
|
-
}
|
903
|
-
|
904
|
-
const targetHost = getRootNodeHost(target, GET_ROOT_NODE_CONFIG_FALSE);
|
905
|
-
const currentTargetHost = currentTarget;
|
906
|
-
const isCurrentTargetSlotted = isChildNode(targetHost, currentTargetHost); // At this point the event must be {bubbles: true, composed: false} and was dispatched from a
|
907
|
-
// shadow-excluding descendant node. In this case, we only invoke the listener if the target
|
908
|
-
// host was assigned to a slot in the composed subtree of the current target host, or the
|
909
|
-
// descendant node is in the shadow tree of the current root.
|
910
|
-
|
911
|
-
return isCurrentTargetSlotted || targetHost === currentTargetHost;
|
912
|
-
}
|
913
|
-
|
914
794
|
function addCustomElementEventListener(type, listener, _options) {
|
915
795
|
if (process.env.NODE_ENV !== 'production') {
|
916
796
|
if (!isFunction(listener)) {
|
@@ -1632,6 +1512,19 @@ function getOuterHTML(node) {
|
|
1632
1512
|
}
|
1633
1513
|
}
|
1634
1514
|
|
1515
|
+
/**
|
1516
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
1517
|
+
*/
|
1518
|
+
|
1519
|
+
if (!_globalThis.lwcRuntimeFlags) {
|
1520
|
+
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
1521
|
+
value: create(null)
|
1522
|
+
});
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
1526
|
+
/** version: 2.7.0 */
|
1527
|
+
|
1635
1528
|
/*
|
1636
1529
|
* Copyright (c) 2018, salesforce.com, inc.
|
1637
1530
|
* All rights reserved.
|
@@ -2250,6 +2143,12 @@ const SyntheticShadowRootDescriptors = {
|
|
2250
2143
|
return `[object ShadowRoot]`;
|
2251
2144
|
}
|
2252
2145
|
|
2146
|
+
},
|
2147
|
+
synthetic: {
|
2148
|
+
writable: false,
|
2149
|
+
enumerable: false,
|
2150
|
+
configurable: false,
|
2151
|
+
value: true
|
2253
2152
|
}
|
2254
2153
|
};
|
2255
2154
|
const ShadowRootDescriptors = {
|
@@ -5757,4 +5656,4 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
5757
5656
|
|
5758
5657
|
configurable: true
|
5759
5658
|
});
|
5760
|
-
/** version: 2.
|
5659
|
+
/** version: 2.7.0 */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lwc/synthetic-shadow",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.7.0",
|
4
4
|
"description": "Synthetic Shadow Root for LWC",
|
5
5
|
"homepage": "https://lwc.dev/",
|
6
6
|
"repository": {
|
@@ -36,8 +36,8 @@
|
|
36
36
|
"access": "public"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@lwc/features": "2.
|
40
|
-
"@lwc/shared": "2.
|
39
|
+
"@lwc/features": "2.7.0",
|
40
|
+
"@lwc/shared": "2.7.0"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "656663a9f95f90bd648c6fc2200201afc0156393"
|
43
43
|
}
|