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