lwc 2.23.5 → 2.24.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 +216 -69
- package/dist/engine-dom/iife/es2017/engine-dom.js +216 -69
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +194 -67
- package/dist/engine-dom/iife/es5/engine-dom.js +494 -313
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +463 -299
- package/dist/engine-dom/umd/es2017/engine-dom.js +216 -69
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +194 -67
- package/dist/engine-dom/umd/es5/engine-dom.js +494 -313
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +463 -299
- package/dist/engine-server/commonjs/es2017/engine-server.js +124 -16
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +124 -16
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +195 -158
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +25 -11
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +25 -11
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +195 -158
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +25 -11
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +25 -11
- 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
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
// We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
|
|
152
152
|
// we can't use typeof since it will fail when transpiling.
|
|
153
153
|
const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
|
|
154
|
-
/** version: 2.
|
|
154
|
+
/** version: 2.24.0 */
|
|
155
155
|
|
|
156
156
|
/*
|
|
157
157
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
466
466
|
}
|
|
467
467
|
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
468
|
-
/** version: 2.
|
|
468
|
+
/** version: 2.24.0 */
|
|
469
469
|
|
|
470
470
|
/*
|
|
471
471
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -546,201 +546,238 @@
|
|
|
546
546
|
* SPDX-License-Identifier: MIT
|
|
547
547
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
548
548
|
*/
|
|
549
|
-
// when finding a slot in the DOM, we can fold it if it is contained
|
|
550
549
|
// inside another slot.
|
|
550
|
+
|
|
551
551
|
function foldSlotElement(slot) {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
552
|
+
let parent = parentElementGetter.call(slot);
|
|
553
|
+
|
|
554
|
+
while (!isNull(parent) && isSlotElement(parent)) {
|
|
555
|
+
slot = parent;
|
|
556
|
+
parent = parentElementGetter.call(slot);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return slot;
|
|
558
560
|
}
|
|
561
|
+
|
|
559
562
|
function isNodeSlotted(host, node) {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
return false;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
currentElement = parent;
|
|
563
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
564
|
+
assert.invariant(host instanceof HTMLElement, `isNodeSlotted() should be called with a host as the first argument instead of ${host}`);
|
|
565
|
+
assert.invariant(node instanceof _Node, `isNodeSlotted() should be called with a node as the second argument instead of ${node}`);
|
|
566
|
+
assert.invariant(compareDocumentPosition.call(node, host) & DOCUMENT_POSITION_CONTAINS, `isNodeSlotted() should never be called with a node that is not a child node of ${host}`);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const hostKey = getNodeKey(host); // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
|
|
570
|
+
// just in case the provided node is not an element
|
|
571
|
+
|
|
572
|
+
let currentElement = node instanceof Element ? node : parentElementGetter.call(node);
|
|
573
|
+
|
|
574
|
+
while (!isNull(currentElement) && currentElement !== host) {
|
|
575
|
+
const elmOwnerKey = getNodeNearestOwnerKey(currentElement);
|
|
576
|
+
const parent = parentElementGetter.call(currentElement);
|
|
577
|
+
|
|
578
|
+
if (elmOwnerKey === hostKey) {
|
|
579
|
+
// we have reached an element inside the host's template, and only if
|
|
580
|
+
// that element is an slot, then the node is considered slotted
|
|
581
|
+
return isSlotElement(currentElement);
|
|
582
|
+
} else if (parent === host) {
|
|
583
|
+
return false;
|
|
584
|
+
} else if (!isNull(parent) && getNodeNearestOwnerKey(parent) !== elmOwnerKey) {
|
|
585
|
+
// we are crossing a boundary of some sort since the elm and its parent
|
|
586
|
+
// have different owner key. for slotted elements, this is possible
|
|
587
|
+
// if the parent happens to be a slot.
|
|
588
|
+
if (isSlotElement(parent)) {
|
|
589
|
+
/**
|
|
590
|
+
* the slot parent might be allocated inside another slot, think of:
|
|
591
|
+
* <x-root> (<--- root element)
|
|
592
|
+
* <x-parent> (<--- own by x-root)
|
|
593
|
+
* <x-child> (<--- own by x-root)
|
|
594
|
+
* <slot> (<--- own by x-child)
|
|
595
|
+
* <slot> (<--- own by x-parent)
|
|
596
|
+
* <div> (<--- own by x-root)
|
|
597
|
+
*
|
|
598
|
+
* while checking if x-parent has the div slotted, we need to traverse
|
|
599
|
+
* up, but when finding the first slot, we skip that one in favor of the
|
|
600
|
+
* most outer slot parent before jumping into its corresponding host.
|
|
601
|
+
*/
|
|
602
|
+
currentElement = getNodeOwner(foldSlotElement(parent));
|
|
603
|
+
|
|
604
|
+
if (!isNull(currentElement)) {
|
|
605
|
+
if (currentElement === host) {
|
|
606
|
+
// the slot element is a top level element inside the shadow
|
|
607
|
+
// of a host that was allocated into host in question
|
|
608
|
+
return true;
|
|
609
|
+
} else if (getNodeNearestOwnerKey(currentElement) === hostKey) {
|
|
610
|
+
// the slot element is an element inside the shadow
|
|
611
|
+
// of a host that was allocated into host in question
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
618
614
|
}
|
|
615
|
+
} else {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
currentElement = parent;
|
|
619
620
|
}
|
|
620
|
-
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return false;
|
|
621
624
|
}
|
|
625
|
+
|
|
622
626
|
function getNodeOwner(node) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
627
|
+
if (!(node instanceof _Node)) {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const ownerKey = getNodeNearestOwnerKey(node);
|
|
632
|
+
|
|
633
|
+
if (isUndefined(ownerKey)) {
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
let nodeOwner = node; // At this point, node is a valid node with owner identity, now we need to find the owner node
|
|
638
|
+
// search for a custom element with a VM that owns the first element with owner identity attached to it
|
|
639
|
+
|
|
640
|
+
while (!isNull(nodeOwner) && getNodeKey(nodeOwner) !== ownerKey) {
|
|
641
|
+
nodeOwner = parentNodeGetter.call(nodeOwner);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
if (isNull(nodeOwner)) {
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return nodeOwner;
|
|
640
649
|
}
|
|
641
650
|
function isSyntheticSlotElement(node) {
|
|
642
|
-
|
|
651
|
+
return isSlotElement(node) && isNodeShadowed(node);
|
|
643
652
|
}
|
|
644
653
|
function isSlotElement(node) {
|
|
645
|
-
|
|
654
|
+
return node instanceof HTMLSlotElement;
|
|
646
655
|
}
|
|
647
656
|
function isNodeOwnedBy(owner, node) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
657
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
658
|
+
assert.invariant(owner instanceof HTMLElement, `isNodeOwnedBy() should be called with an element as the first argument instead of ${owner}`);
|
|
659
|
+
assert.invariant(node instanceof _Node, `isNodeOwnedBy() should be called with a node as the second argument instead of ${node}`);
|
|
660
|
+
assert.invariant(compareDocumentPosition.call(node, owner) & DOCUMENT_POSITION_CONTAINS, `isNodeOwnedBy() should never be called with a node that is not a child node of ${owner}`);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const ownerKey = getNodeNearestOwnerKey(node);
|
|
664
|
+
|
|
665
|
+
if (isUndefined(ownerKey)) {
|
|
666
|
+
if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
|
|
667
|
+
// in case of root level light DOM element slotting into a synthetic shadow
|
|
668
|
+
const host = parentNodeGetter.call(node);
|
|
669
|
+
|
|
670
|
+
if (!isNull(host) && isSyntheticSlotElement(host)) {
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
} // in case of manually inserted elements
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
return true;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return getNodeKey(owner) === ownerKey;
|
|
655
680
|
}
|
|
656
681
|
function shadowRootChildNodes(root) {
|
|
657
|
-
|
|
658
|
-
|
|
682
|
+
const elm = getHost(root);
|
|
683
|
+
return getAllMatches(elm, arrayFromCollection(childNodesGetter.call(elm)));
|
|
659
684
|
}
|
|
660
685
|
function getAllSlottedMatches(host, nodeList) {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
686
|
+
const filteredAndPatched = [];
|
|
687
|
+
|
|
688
|
+
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
689
|
+
const node = nodeList[i];
|
|
690
|
+
|
|
691
|
+
if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
|
|
692
|
+
ArrayPush.call(filteredAndPatched, node);
|
|
667
693
|
}
|
|
668
|
-
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
return filteredAndPatched;
|
|
669
697
|
}
|
|
670
698
|
function getFirstSlottedMatch(host, nodeList) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
699
|
+
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
700
|
+
const node = nodeList[i];
|
|
701
|
+
|
|
702
|
+
if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
|
|
703
|
+
return node;
|
|
676
704
|
}
|
|
677
|
-
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return null;
|
|
678
708
|
}
|
|
679
709
|
function getAllMatches(owner, nodeList) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
710
|
+
const filteredAndPatched = [];
|
|
711
|
+
|
|
712
|
+
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
713
|
+
const node = nodeList[i];
|
|
714
|
+
const isOwned = isNodeOwnedBy(owner, node);
|
|
715
|
+
|
|
716
|
+
if (isOwned) {
|
|
717
|
+
// Patch querySelector, querySelectorAll, etc
|
|
718
|
+
// if element is owned by VM
|
|
719
|
+
ArrayPush.call(filteredAndPatched, node);
|
|
689
720
|
}
|
|
690
|
-
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
return filteredAndPatched;
|
|
691
724
|
}
|
|
692
725
|
function getFirstMatch(owner, nodeList) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
726
|
+
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
727
|
+
if (isNodeOwnedBy(owner, nodeList[i])) {
|
|
728
|
+
return nodeList[i];
|
|
697
729
|
}
|
|
698
|
-
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
return null;
|
|
699
733
|
}
|
|
700
734
|
function shadowRootQuerySelector(root, selector) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
735
|
+
const elm = getHost(root);
|
|
736
|
+
const nodeList = arrayFromCollection(querySelectorAll$1.call(elm, selector));
|
|
737
|
+
return getFirstMatch(elm, nodeList);
|
|
704
738
|
}
|
|
705
739
|
function shadowRootQuerySelectorAll(root, selector) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
740
|
+
const elm = getHost(root);
|
|
741
|
+
const nodeList = querySelectorAll$1.call(elm, selector);
|
|
742
|
+
return getAllMatches(elm, arrayFromCollection(nodeList));
|
|
709
743
|
}
|
|
710
744
|
function getFilteredChildNodes(node) {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
745
|
+
if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
|
|
746
|
+
// regular element - fast path
|
|
747
|
+
const children = childNodesGetter.call(node);
|
|
748
|
+
return arrayFromCollection(children);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (isSyntheticShadowHost(node)) {
|
|
752
|
+
// we need to get only the nodes that were slotted
|
|
753
|
+
const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
|
|
754
|
+
const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
|
|
755
|
+
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
756
|
+
// @ts-ignore type-mismatch
|
|
757
|
+
|
|
758
|
+
return ArrayReduce.call(slots, (seed, slot) => {
|
|
759
|
+
if (resolver === getShadowRootResolver(slot)) {
|
|
760
|
+
ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
return seed;
|
|
764
|
+
}, []);
|
|
765
|
+
} else {
|
|
766
|
+
// slot element
|
|
767
|
+
const children = arrayFromCollection(childNodesGetter.call(node));
|
|
768
|
+
const resolver = getShadowRootResolver(node);
|
|
769
|
+
return ArrayFilter.call(children, child => resolver === getShadowRootResolver(child));
|
|
770
|
+
}
|
|
736
771
|
}
|
|
737
772
|
function getFilteredSlotAssignedNodes(slot) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
773
|
+
const owner = getNodeOwner(slot);
|
|
774
|
+
|
|
775
|
+
if (isNull(owner)) {
|
|
776
|
+
return [];
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const childNodes = arrayFromCollection(childNodesGetter.call(slot));
|
|
780
|
+
return ArrayFilter.call(childNodes, child => !isNodeShadowed(child) || !isNodeOwnedBy(owner, child));
|
|
744
781
|
}
|
|
745
782
|
|
|
746
783
|
/*
|
|
@@ -3965,11 +4002,11 @@
|
|
|
3965
4002
|
// element with shadowRoot attached
|
|
3966
4003
|
const owner = getNodeOwner(this);
|
|
3967
4004
|
|
|
3968
|
-
if (
|
|
3969
|
-
return null;
|
|
3970
|
-
} else if (getNodeKey(this)) {
|
|
4005
|
+
if (!isUndefined(getNodeKey(this))) {
|
|
3971
4006
|
// it is a custom element, and we should then filter by slotted elements
|
|
3972
4007
|
return getFirstSlottedMatch(this, nodeList);
|
|
4008
|
+
} else if (isNull(owner)) {
|
|
4009
|
+
return null;
|
|
3973
4010
|
} else {
|
|
3974
4011
|
// regular element, we should then filter by ownership
|
|
3975
4012
|
return getFirstMatch(owner, nodeList);
|
|
@@ -4016,11 +4053,11 @@
|
|
|
4016
4053
|
// element with shadowRoot attached
|
|
4017
4054
|
const owner = getNodeOwner(context);
|
|
4018
4055
|
|
|
4019
|
-
if (
|
|
4020
|
-
filtered = [];
|
|
4021
|
-
} else if (getNodeKey(context)) {
|
|
4056
|
+
if (!isUndefined(getNodeKey(context))) {
|
|
4022
4057
|
// it is a custom element, and we should then filter by slotted elements
|
|
4023
4058
|
filtered = getAllSlottedMatches(context, unfilteredNodes);
|
|
4059
|
+
} else if (isNull(owner)) {
|
|
4060
|
+
filtered = [];
|
|
4024
4061
|
} else {
|
|
4025
4062
|
// regular element, we should then filter by ownership
|
|
4026
4063
|
filtered = getAllMatches(owner, unfilteredNodes);
|
|
@@ -5136,6 +5173,6 @@
|
|
|
5136
5173
|
}));
|
|
5137
5174
|
});
|
|
5138
5175
|
}
|
|
5139
|
-
/** version: 2.
|
|
5176
|
+
/** version: 2.24.0 */
|
|
5140
5177
|
|
|
5141
5178
|
})();
|