lwc 2.5.2 → 2.5.6
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 +181 -101
- package/dist/engine-dom/iife/es2017/engine-dom.js +183 -101
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +163 -82
- package/dist/engine-dom/iife/es5/engine-dom.js +211 -108
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +189 -87
- package/dist/engine-dom/umd/es2017/engine-dom.js +184 -102
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +164 -83
- package/dist/engine-dom/umd/es5/engine-dom.js +212 -109
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +190 -88
- package/dist/engine-server/commonjs/es2017/engine-server.js +174 -99
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +173 -100
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +46 -40
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +47 -41
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +46 -40
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +47 -41
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +46 -40
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +48 -42
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +47 -41
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +48 -42
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +47 -41
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +3 -3
- package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +4 -4
- package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
- 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.5.
|
|
197
|
+
/** version: 2.5.6 */
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -533,7 +533,7 @@ if (!_globalThis.lwcRuntimeFlags) {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
536
|
-
/** version: 2.5.
|
|
536
|
+
/** version: 2.5.6 */
|
|
537
537
|
|
|
538
538
|
/*
|
|
539
539
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -593,7 +593,7 @@ function getEventListenerWrapper(fnOrObj) {
|
|
|
593
593
|
const currentTarget = eventCurrentTargetGetter.call(event);
|
|
594
594
|
|
|
595
595
|
if (process.env.NODE_ENV !== 'production') {
|
|
596
|
-
assert.invariant(isFalse(
|
|
596
|
+
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
|
|
597
597
|
}
|
|
598
598
|
|
|
599
599
|
const {
|
|
@@ -639,9 +639,9 @@ const GET_ROOT_NODE_CONFIG_FALSE = {
|
|
|
639
639
|
};
|
|
640
640
|
|
|
641
641
|
function getRootNodeHost(node, options) {
|
|
642
|
-
let rootNode = node.getRootNode(options);
|
|
642
|
+
let rootNode = node.getRootNode(options);
|
|
643
643
|
|
|
644
|
-
if (
|
|
644
|
+
if (isSyntheticShadowRoot(rootNode)) {
|
|
645
645
|
rootNode = getHost(rootNode);
|
|
646
646
|
}
|
|
647
647
|
|
|
@@ -1237,13 +1237,13 @@ function shadowRootQuerySelectorAll(root, selector) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
1239
|
function getFilteredChildNodes(node) {
|
|
1240
|
-
if (!
|
|
1240
|
+
if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
|
|
1241
1241
|
// regular element - fast path
|
|
1242
1242
|
const children = childNodesGetter.call(node);
|
|
1243
1243
|
return arrayFromCollection(children);
|
|
1244
1244
|
}
|
|
1245
1245
|
|
|
1246
|
-
if (
|
|
1246
|
+
if (isSyntheticShadowHost(node)) {
|
|
1247
1247
|
// we need to get only the nodes that were slotted
|
|
1248
1248
|
const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
|
|
1249
1249
|
const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
|
|
@@ -1685,7 +1685,7 @@ function getOuterHTML(node) {
|
|
|
1685
1685
|
|
|
1686
1686
|
|
|
1687
1687
|
function hasMountedChildren(node) {
|
|
1688
|
-
return isSyntheticSlotElement(node) ||
|
|
1688
|
+
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
|
1689
1689
|
}
|
|
1690
1690
|
|
|
1691
1691
|
function getShadowParent(node, value) {
|
|
@@ -1806,7 +1806,7 @@ function cloneNodePatched(deep) {
|
|
|
1806
1806
|
|
|
1807
1807
|
|
|
1808
1808
|
function childNodesGetterPatched() {
|
|
1809
|
-
if (
|
|
1809
|
+
if (isSyntheticShadowHost(this)) {
|
|
1810
1810
|
const owner = getNodeOwner(this);
|
|
1811
1811
|
const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
|
|
1812
1812
|
|
|
@@ -1919,7 +1919,7 @@ defineProperties(_Node.prototype, {
|
|
|
1919
1919
|
textContent: {
|
|
1920
1920
|
get() {
|
|
1921
1921
|
if (!runtimeFlags.ENABLE_NODE_PATCH) {
|
|
1922
|
-
if (isNodeShadowed(this) ||
|
|
1922
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1923
1923
|
return textContentGetterPatched.call(this);
|
|
1924
1924
|
}
|
|
1925
1925
|
|
|
@@ -2030,7 +2030,7 @@ defineProperties(_Node.prototype, {
|
|
|
2030
2030
|
return false;
|
|
2031
2031
|
}
|
|
2032
2032
|
|
|
2033
|
-
if (isNodeShadowed(this) ||
|
|
2033
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
2034
2034
|
return containsPatched.call(this, otherNode);
|
|
2035
2035
|
}
|
|
2036
2036
|
|
|
@@ -2052,7 +2052,7 @@ defineProperties(_Node.prototype, {
|
|
|
2052
2052
|
cloneNode: {
|
|
2053
2053
|
value(deep) {
|
|
2054
2054
|
if (!runtimeFlags.ENABLE_NODE_PATCH) {
|
|
2055
|
-
if (isNodeShadowed(this) ||
|
|
2055
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
2056
2056
|
return cloneNodePatched.call(this, deep);
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
@@ -2190,7 +2190,7 @@ const {
|
|
|
2190
2190
|
} = document;
|
|
2191
2191
|
|
|
2192
2192
|
function hasInternalSlot(root) {
|
|
2193
|
-
return
|
|
2193
|
+
return InternalSlot.has(root);
|
|
2194
2194
|
}
|
|
2195
2195
|
|
|
2196
2196
|
function getInternalSlot(root) {
|
|
@@ -2244,14 +2244,20 @@ function getShadowRoot(elm) {
|
|
|
2244
2244
|
// and we can avoid having to cast the type before calling this method in a few places.
|
|
2245
2245
|
|
|
2246
2246
|
|
|
2247
|
-
function
|
|
2248
|
-
|
|
2247
|
+
function isSyntheticShadowHost(node) {
|
|
2248
|
+
const shadowRootRecord = InternalSlot.get(node);
|
|
2249
|
+
return !isUndefined(shadowRootRecord) && node === shadowRootRecord.host;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
function isSyntheticShadowRoot(node) {
|
|
2253
|
+
const shadowRootRecord = InternalSlot.get(node);
|
|
2254
|
+
return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
|
|
2249
2255
|
}
|
|
2250
2256
|
|
|
2251
2257
|
let uid = 0;
|
|
2252
2258
|
|
|
2253
2259
|
function attachShadow(elm, options) {
|
|
2254
|
-
if (
|
|
2260
|
+
if (InternalSlot.has(elm)) {
|
|
2255
2261
|
throw new Error(`Failed to execute 'attachShadow' on 'Element': Shadow root cannot be created on a host which already hosts a shadow tree.`);
|
|
2256
2262
|
}
|
|
2257
2263
|
|
|
@@ -2884,7 +2890,7 @@ function pathComposer(startNode, composed) {
|
|
|
2884
2890
|
} else {
|
|
2885
2891
|
current = current.parentNode;
|
|
2886
2892
|
}
|
|
2887
|
-
} else if ((current
|
|
2893
|
+
} else if ((isSyntheticShadowRoot(current) || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
|
|
2888
2894
|
current = current.host;
|
|
2889
2895
|
} else if (current instanceof _Node) {
|
|
2890
2896
|
current = current.parentNode;
|
|
@@ -2946,7 +2952,7 @@ function retarget(refNode, path) {
|
|
|
2946
2952
|
lastRoot = root;
|
|
2947
2953
|
}
|
|
2948
2954
|
|
|
2949
|
-
if (!(root
|
|
2955
|
+
if (!isSyntheticShadowRoot(root) || !isUndefined(rootIdx) && rootIdx > -1) {
|
|
2950
2956
|
return ancestor;
|
|
2951
2957
|
}
|
|
2952
2958
|
}
|
|
@@ -3757,10 +3763,10 @@ function patchedObserve(target, options) {
|
|
|
3757
3763
|
if (ArrayIndexOf.call(targetObservers, this) === -1) {
|
|
3758
3764
|
ArrayPush.call(targetObservers, this);
|
|
3759
3765
|
} // else There is more bookkeeping to do here https://dom.spec.whatwg.org/#dom-mutationobserver-observe Step #7
|
|
3760
|
-
//
|
|
3766
|
+
// SyntheticShadowRoot instances are not actually a part of the DOM so observe the host instead.
|
|
3761
3767
|
|
|
3762
3768
|
|
|
3763
|
-
if (target
|
|
3769
|
+
if (isSyntheticShadowRoot(target)) {
|
|
3764
3770
|
target = target.host;
|
|
3765
3771
|
} // maintain a list of all nodes observed by this observer
|
|
3766
3772
|
|
|
@@ -3803,7 +3809,7 @@ defineProperty(window, 'MutationObserver', {
|
|
|
3803
3809
|
*/
|
|
3804
3810
|
|
|
3805
3811
|
function patchedAddEventListener$1(type, listener, optionsOrCapture) {
|
|
3806
|
-
if (
|
|
3812
|
+
if (isSyntheticShadowHost(this)) {
|
|
3807
3813
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
3808
3814
|
// @ts-ignore type-mismatch
|
|
3809
3815
|
return addCustomElementEventListener.apply(this, arguments);
|
|
@@ -3831,7 +3837,7 @@ function patchedAddEventListener$1(type, listener, optionsOrCapture) {
|
|
|
3831
3837
|
}
|
|
3832
3838
|
|
|
3833
3839
|
function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
|
|
3834
|
-
if (
|
|
3840
|
+
if (isSyntheticShadowHost(this)) {
|
|
3835
3841
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
3836
3842
|
// @ts-ignore type-mismatch
|
|
3837
3843
|
return removeCustomElementEventListener.apply(this, arguments);
|
|
@@ -3997,7 +4003,7 @@ function patchedTargetGetter() {
|
|
|
3997
4003
|
let actualCurrentTarget = originalCurrentTarget;
|
|
3998
4004
|
let actualPath = composedPath; // Address the possibility that `currentTarget` is a shadow root
|
|
3999
4005
|
|
|
4000
|
-
if (
|
|
4006
|
+
if (isSyntheticShadowHost(originalCurrentTarget)) {
|
|
4001
4007
|
const context = eventToContextMap.get(this);
|
|
4002
4008
|
|
|
4003
4009
|
if (context === 1
|
|
@@ -4008,7 +4014,7 @@ function patchedTargetGetter() {
|
|
|
4008
4014
|
} // Address the possibility that `target` is a shadow root
|
|
4009
4015
|
|
|
4010
4016
|
|
|
4011
|
-
if (
|
|
4017
|
+
if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
|
|
4012
4018
|
actualPath = pathComposer(getShadowRoot(originalTarget), this.composed);
|
|
4013
4019
|
}
|
|
4014
4020
|
|
|
@@ -4045,7 +4051,7 @@ function patchedComposedPathValue() {
|
|
|
4045
4051
|
|
|
4046
4052
|
let actualTarget = originalTarget;
|
|
4047
4053
|
|
|
4048
|
-
if (
|
|
4054
|
+
if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
|
|
4049
4055
|
actualTarget = getShadowRoot(originalTarget);
|
|
4050
4056
|
}
|
|
4051
4057
|
|
|
@@ -4316,7 +4322,7 @@ function getNonPatchedFilteredArrayOfNodes(context, unfilteredNodes) {
|
|
|
4316
4322
|
const ownerKey = getNodeOwnerKey(context); // a node inside a shadow.
|
|
4317
4323
|
|
|
4318
4324
|
if (!isUndefined(ownerKey)) {
|
|
4319
|
-
if (
|
|
4325
|
+
if (isSyntheticShadowHost(context)) {
|
|
4320
4326
|
// element with shadowRoot attached
|
|
4321
4327
|
const owner = getNodeOwner(context);
|
|
4322
4328
|
|
|
@@ -4377,7 +4383,7 @@ function attachShadowPatched(options) {
|
|
|
4377
4383
|
}
|
|
4378
4384
|
|
|
4379
4385
|
function shadowRootGetterPatched() {
|
|
4380
|
-
if (
|
|
4386
|
+
if (isSyntheticShadowHost(this)) {
|
|
4381
4387
|
const shadow = getShadowRoot(this);
|
|
4382
4388
|
|
|
4383
4389
|
if (shadow.mode === 'open') {
|
|
@@ -4415,7 +4421,7 @@ defineProperties(Element.prototype, {
|
|
|
4415
4421
|
innerHTML: {
|
|
4416
4422
|
get() {
|
|
4417
4423
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4418
|
-
if (isNodeShadowed(this) ||
|
|
4424
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4419
4425
|
return innerHTMLGetterPatched.call(this);
|
|
4420
4426
|
}
|
|
4421
4427
|
|
|
@@ -4440,7 +4446,7 @@ defineProperties(Element.prototype, {
|
|
|
4440
4446
|
outerHTML: {
|
|
4441
4447
|
get() {
|
|
4442
4448
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4443
|
-
if (isNodeShadowed(this) ||
|
|
4449
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4444
4450
|
return outerHTMLGetterPatched.call(this);
|
|
4445
4451
|
}
|
|
4446
4452
|
|
|
@@ -4545,7 +4551,7 @@ if (hasOwnProperty.call(HTMLElement.prototype, 'children')) {
|
|
|
4545
4551
|
function querySelectorPatched() {
|
|
4546
4552
|
const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
|
|
4547
4553
|
|
|
4548
|
-
if (
|
|
4554
|
+
if (isSyntheticShadowHost(this)) {
|
|
4549
4555
|
// element with shadowRoot attached
|
|
4550
4556
|
const owner = getNodeOwner(this);
|
|
4551
4557
|
|
|
@@ -4596,7 +4602,7 @@ function querySelectorPatched() {
|
|
|
4596
4602
|
function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
|
|
4597
4603
|
let filtered;
|
|
4598
4604
|
|
|
4599
|
-
if (
|
|
4605
|
+
if (isSyntheticShadowHost(context)) {
|
|
4600
4606
|
// element with shadowRoot attached
|
|
4601
4607
|
const owner = getNodeOwner(context);
|
|
4602
4608
|
|
|
@@ -4805,7 +4811,7 @@ function isVisible(element) {
|
|
|
4805
4811
|
|
|
4806
4812
|
|
|
4807
4813
|
function isTabbable(element) {
|
|
4808
|
-
if (
|
|
4814
|
+
if (isSyntheticShadowHost(element) && isDelegatingFocus(element)) {
|
|
4809
4815
|
return false;
|
|
4810
4816
|
}
|
|
4811
4817
|
|
|
@@ -5504,7 +5510,7 @@ function focusPatched() {
|
|
|
5504
5510
|
disableKeyboardFocusNavigationRoutines();
|
|
5505
5511
|
}
|
|
5506
5512
|
|
|
5507
|
-
if (
|
|
5513
|
+
if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
|
|
5508
5514
|
hostElementFocus.call(this);
|
|
5509
5515
|
return;
|
|
5510
5516
|
} // Typescript does not like it when you treat the `arguments` object as an array
|
|
@@ -5523,7 +5529,7 @@ function focusPatched() {
|
|
|
5523
5529
|
defineProperties(HTMLElement.prototype, {
|
|
5524
5530
|
tabIndex: {
|
|
5525
5531
|
get() {
|
|
5526
|
-
if (
|
|
5532
|
+
if (isSyntheticShadowHost(this)) {
|
|
5527
5533
|
return tabIndexGetterPatched.call(this);
|
|
5528
5534
|
}
|
|
5529
5535
|
|
|
@@ -5531,7 +5537,7 @@ defineProperties(HTMLElement.prototype, {
|
|
|
5531
5537
|
},
|
|
5532
5538
|
|
|
5533
5539
|
set(v) {
|
|
5534
|
-
if (
|
|
5540
|
+
if (isSyntheticShadowHost(this)) {
|
|
5535
5541
|
return tabIndexSetterPatched.call(this, v);
|
|
5536
5542
|
}
|
|
5537
5543
|
|
|
@@ -5543,7 +5549,7 @@ defineProperties(HTMLElement.prototype, {
|
|
|
5543
5549
|
},
|
|
5544
5550
|
blur: {
|
|
5545
5551
|
value() {
|
|
5546
|
-
if (
|
|
5552
|
+
if (isSyntheticShadowHost(this)) {
|
|
5547
5553
|
return blurPatched.call(this);
|
|
5548
5554
|
}
|
|
5549
5555
|
|
|
@@ -5575,7 +5581,7 @@ if (innerTextGetter !== null && innerTextSetter !== null) {
|
|
|
5575
5581
|
}
|
|
5576
5582
|
|
|
5577
5583
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
5578
|
-
if (isNodeShadowed(this) ||
|
|
5584
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
5579
5585
|
return getInnerText(this);
|
|
5580
5586
|
}
|
|
5581
5587
|
|
|
@@ -5611,7 +5617,7 @@ if (outerTextGetter !== null && outerTextSetter !== null) {
|
|
|
5611
5617
|
}
|
|
5612
5618
|
|
|
5613
5619
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
5614
|
-
if (isNodeShadowed(this) ||
|
|
5620
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
5615
5621
|
return getInnerText(this);
|
|
5616
5622
|
}
|
|
5617
5623
|
|
|
@@ -5716,7 +5722,7 @@ function adoptChildNode(node, fn, shadowToken) {
|
|
|
5716
5722
|
if (node instanceof Element) {
|
|
5717
5723
|
setShadowToken(node, shadowToken);
|
|
5718
5724
|
|
|
5719
|
-
if (
|
|
5725
|
+
if (isSyntheticShadowHost(node)) {
|
|
5720
5726
|
// Root LWC elements can't get content slotted into them, therefore we don't observe their children.
|
|
5721
5727
|
return;
|
|
5722
5728
|
}
|
|
@@ -5823,4 +5829,4 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
|
5823
5829
|
|
|
5824
5830
|
configurable: true
|
|
5825
5831
|
});
|
|
5826
|
-
/** version: 2.5.
|
|
5832
|
+
/** version: 2.5.6 */
|
|
@@ -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.5.
|
|
200
|
+
/** version: 2.5.6 */
|
|
201
201
|
|
|
202
202
|
/*
|
|
203
203
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -536,7 +536,7 @@
|
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
539
|
-
/** version: 2.5.
|
|
539
|
+
/** version: 2.5.6 */
|
|
540
540
|
|
|
541
541
|
/*
|
|
542
542
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
const currentTarget = eventCurrentTargetGetter.call(event);
|
|
597
597
|
|
|
598
598
|
if (process.env.NODE_ENV !== 'production') {
|
|
599
|
-
assert.invariant(isFalse(
|
|
599
|
+
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), 'This routine should not be used to wrap event listeners for host elements and shadow roots.');
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
const {
|
|
@@ -642,9 +642,9 @@
|
|
|
642
642
|
};
|
|
643
643
|
|
|
644
644
|
function getRootNodeHost(node, options) {
|
|
645
|
-
let rootNode = node.getRootNode(options);
|
|
645
|
+
let rootNode = node.getRootNode(options);
|
|
646
646
|
|
|
647
|
-
if (
|
|
647
|
+
if (isSyntheticShadowRoot(rootNode)) {
|
|
648
648
|
rootNode = getHost(rootNode);
|
|
649
649
|
}
|
|
650
650
|
|
|
@@ -1240,13 +1240,13 @@
|
|
|
1240
1240
|
}
|
|
1241
1241
|
|
|
1242
1242
|
function getFilteredChildNodes(node) {
|
|
1243
|
-
if (!
|
|
1243
|
+
if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
|
|
1244
1244
|
// regular element - fast path
|
|
1245
1245
|
const children = childNodesGetter.call(node);
|
|
1246
1246
|
return arrayFromCollection(children);
|
|
1247
1247
|
}
|
|
1248
1248
|
|
|
1249
|
-
if (
|
|
1249
|
+
if (isSyntheticShadowHost(node)) {
|
|
1250
1250
|
// we need to get only the nodes that were slotted
|
|
1251
1251
|
const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
|
|
1252
1252
|
const resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
|
|
@@ -1688,7 +1688,7 @@
|
|
|
1688
1688
|
|
|
1689
1689
|
|
|
1690
1690
|
function hasMountedChildren(node) {
|
|
1691
|
-
return isSyntheticSlotElement(node) ||
|
|
1691
|
+
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
|
1692
1692
|
}
|
|
1693
1693
|
|
|
1694
1694
|
function getShadowParent(node, value) {
|
|
@@ -1809,7 +1809,7 @@
|
|
|
1809
1809
|
|
|
1810
1810
|
|
|
1811
1811
|
function childNodesGetterPatched() {
|
|
1812
|
-
if (
|
|
1812
|
+
if (isSyntheticShadowHost(this)) {
|
|
1813
1813
|
const owner = getNodeOwner(this);
|
|
1814
1814
|
const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
|
|
1815
1815
|
|
|
@@ -1922,7 +1922,7 @@
|
|
|
1922
1922
|
textContent: {
|
|
1923
1923
|
get() {
|
|
1924
1924
|
if (!runtimeFlags.ENABLE_NODE_PATCH) {
|
|
1925
|
-
if (isNodeShadowed(this) ||
|
|
1925
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1926
1926
|
return textContentGetterPatched.call(this);
|
|
1927
1927
|
}
|
|
1928
1928
|
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
return false;
|
|
2034
2034
|
}
|
|
2035
2035
|
|
|
2036
|
-
if (isNodeShadowed(this) ||
|
|
2036
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
2037
2037
|
return containsPatched.call(this, otherNode);
|
|
2038
2038
|
}
|
|
2039
2039
|
|
|
@@ -2055,7 +2055,7 @@
|
|
|
2055
2055
|
cloneNode: {
|
|
2056
2056
|
value(deep) {
|
|
2057
2057
|
if (!runtimeFlags.ENABLE_NODE_PATCH) {
|
|
2058
|
-
if (isNodeShadowed(this) ||
|
|
2058
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
2059
2059
|
return cloneNodePatched.call(this, deep);
|
|
2060
2060
|
}
|
|
2061
2061
|
|
|
@@ -2193,7 +2193,7 @@
|
|
|
2193
2193
|
} = document;
|
|
2194
2194
|
|
|
2195
2195
|
function hasInternalSlot(root) {
|
|
2196
|
-
return
|
|
2196
|
+
return InternalSlot.has(root);
|
|
2197
2197
|
}
|
|
2198
2198
|
|
|
2199
2199
|
function getInternalSlot(root) {
|
|
@@ -2247,14 +2247,20 @@
|
|
|
2247
2247
|
// and we can avoid having to cast the type before calling this method in a few places.
|
|
2248
2248
|
|
|
2249
2249
|
|
|
2250
|
-
function
|
|
2251
|
-
|
|
2250
|
+
function isSyntheticShadowHost(node) {
|
|
2251
|
+
const shadowRootRecord = InternalSlot.get(node);
|
|
2252
|
+
return !isUndefined(shadowRootRecord) && node === shadowRootRecord.host;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
function isSyntheticShadowRoot(node) {
|
|
2256
|
+
const shadowRootRecord = InternalSlot.get(node);
|
|
2257
|
+
return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
|
|
2252
2258
|
}
|
|
2253
2259
|
|
|
2254
2260
|
let uid = 0;
|
|
2255
2261
|
|
|
2256
2262
|
function attachShadow(elm, options) {
|
|
2257
|
-
if (
|
|
2263
|
+
if (InternalSlot.has(elm)) {
|
|
2258
2264
|
throw new Error(`Failed to execute 'attachShadow' on 'Element': Shadow root cannot be created on a host which already hosts a shadow tree.`);
|
|
2259
2265
|
}
|
|
2260
2266
|
|
|
@@ -2887,7 +2893,7 @@
|
|
|
2887
2893
|
} else {
|
|
2888
2894
|
current = current.parentNode;
|
|
2889
2895
|
}
|
|
2890
|
-
} else if ((current
|
|
2896
|
+
} else if ((isSyntheticShadowRoot(current) || isInstanceOfNativeShadowRoot(current)) && (composed || current !== startRoot)) {
|
|
2891
2897
|
current = current.host;
|
|
2892
2898
|
} else if (current instanceof _Node) {
|
|
2893
2899
|
current = current.parentNode;
|
|
@@ -2949,7 +2955,7 @@
|
|
|
2949
2955
|
lastRoot = root;
|
|
2950
2956
|
}
|
|
2951
2957
|
|
|
2952
|
-
if (!(root
|
|
2958
|
+
if (!isSyntheticShadowRoot(root) || !isUndefined(rootIdx) && rootIdx > -1) {
|
|
2953
2959
|
return ancestor;
|
|
2954
2960
|
}
|
|
2955
2961
|
}
|
|
@@ -3760,10 +3766,10 @@
|
|
|
3760
3766
|
if (ArrayIndexOf.call(targetObservers, this) === -1) {
|
|
3761
3767
|
ArrayPush.call(targetObservers, this);
|
|
3762
3768
|
} // else There is more bookkeeping to do here https://dom.spec.whatwg.org/#dom-mutationobserver-observe Step #7
|
|
3763
|
-
//
|
|
3769
|
+
// SyntheticShadowRoot instances are not actually a part of the DOM so observe the host instead.
|
|
3764
3770
|
|
|
3765
3771
|
|
|
3766
|
-
if (target
|
|
3772
|
+
if (isSyntheticShadowRoot(target)) {
|
|
3767
3773
|
target = target.host;
|
|
3768
3774
|
} // maintain a list of all nodes observed by this observer
|
|
3769
3775
|
|
|
@@ -3806,7 +3812,7 @@
|
|
|
3806
3812
|
*/
|
|
3807
3813
|
|
|
3808
3814
|
function patchedAddEventListener$1(type, listener, optionsOrCapture) {
|
|
3809
|
-
if (
|
|
3815
|
+
if (isSyntheticShadowHost(this)) {
|
|
3810
3816
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
3811
3817
|
// @ts-ignore type-mismatch
|
|
3812
3818
|
return addCustomElementEventListener.apply(this, arguments);
|
|
@@ -3834,7 +3840,7 @@
|
|
|
3834
3840
|
}
|
|
3835
3841
|
|
|
3836
3842
|
function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
|
|
3837
|
-
if (
|
|
3843
|
+
if (isSyntheticShadowHost(this)) {
|
|
3838
3844
|
// Typescript does not like it when you treat the `arguments` object as an array
|
|
3839
3845
|
// @ts-ignore type-mismatch
|
|
3840
3846
|
return removeCustomElementEventListener.apply(this, arguments);
|
|
@@ -4000,7 +4006,7 @@
|
|
|
4000
4006
|
let actualCurrentTarget = originalCurrentTarget;
|
|
4001
4007
|
let actualPath = composedPath; // Address the possibility that `currentTarget` is a shadow root
|
|
4002
4008
|
|
|
4003
|
-
if (
|
|
4009
|
+
if (isSyntheticShadowHost(originalCurrentTarget)) {
|
|
4004
4010
|
const context = eventToContextMap.get(this);
|
|
4005
4011
|
|
|
4006
4012
|
if (context === 1
|
|
@@ -4011,7 +4017,7 @@
|
|
|
4011
4017
|
} // Address the possibility that `target` is a shadow root
|
|
4012
4018
|
|
|
4013
4019
|
|
|
4014
|
-
if (
|
|
4020
|
+
if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
|
|
4015
4021
|
actualPath = pathComposer(getShadowRoot(originalTarget), this.composed);
|
|
4016
4022
|
}
|
|
4017
4023
|
|
|
@@ -4048,7 +4054,7 @@
|
|
|
4048
4054
|
|
|
4049
4055
|
let actualTarget = originalTarget;
|
|
4050
4056
|
|
|
4051
|
-
if (
|
|
4057
|
+
if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
|
|
4052
4058
|
actualTarget = getShadowRoot(originalTarget);
|
|
4053
4059
|
}
|
|
4054
4060
|
|
|
@@ -4319,7 +4325,7 @@
|
|
|
4319
4325
|
const ownerKey = getNodeOwnerKey(context); // a node inside a shadow.
|
|
4320
4326
|
|
|
4321
4327
|
if (!isUndefined(ownerKey)) {
|
|
4322
|
-
if (
|
|
4328
|
+
if (isSyntheticShadowHost(context)) {
|
|
4323
4329
|
// element with shadowRoot attached
|
|
4324
4330
|
const owner = getNodeOwner(context);
|
|
4325
4331
|
|
|
@@ -4380,7 +4386,7 @@
|
|
|
4380
4386
|
}
|
|
4381
4387
|
|
|
4382
4388
|
function shadowRootGetterPatched() {
|
|
4383
|
-
if (
|
|
4389
|
+
if (isSyntheticShadowHost(this)) {
|
|
4384
4390
|
const shadow = getShadowRoot(this);
|
|
4385
4391
|
|
|
4386
4392
|
if (shadow.mode === 'open') {
|
|
@@ -4418,7 +4424,7 @@
|
|
|
4418
4424
|
innerHTML: {
|
|
4419
4425
|
get() {
|
|
4420
4426
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4421
|
-
if (isNodeShadowed(this) ||
|
|
4427
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4422
4428
|
return innerHTMLGetterPatched.call(this);
|
|
4423
4429
|
}
|
|
4424
4430
|
|
|
@@ -4443,7 +4449,7 @@
|
|
|
4443
4449
|
outerHTML: {
|
|
4444
4450
|
get() {
|
|
4445
4451
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4446
|
-
if (isNodeShadowed(this) ||
|
|
4452
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4447
4453
|
return outerHTMLGetterPatched.call(this);
|
|
4448
4454
|
}
|
|
4449
4455
|
|
|
@@ -4548,7 +4554,7 @@
|
|
|
4548
4554
|
function querySelectorPatched() {
|
|
4549
4555
|
const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
|
|
4550
4556
|
|
|
4551
|
-
if (
|
|
4557
|
+
if (isSyntheticShadowHost(this)) {
|
|
4552
4558
|
// element with shadowRoot attached
|
|
4553
4559
|
const owner = getNodeOwner(this);
|
|
4554
4560
|
|
|
@@ -4599,7 +4605,7 @@
|
|
|
4599
4605
|
function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
|
|
4600
4606
|
let filtered;
|
|
4601
4607
|
|
|
4602
|
-
if (
|
|
4608
|
+
if (isSyntheticShadowHost(context)) {
|
|
4603
4609
|
// element with shadowRoot attached
|
|
4604
4610
|
const owner = getNodeOwner(context);
|
|
4605
4611
|
|
|
@@ -4808,7 +4814,7 @@
|
|
|
4808
4814
|
|
|
4809
4815
|
|
|
4810
4816
|
function isTabbable(element) {
|
|
4811
|
-
if (
|
|
4817
|
+
if (isSyntheticShadowHost(element) && isDelegatingFocus(element)) {
|
|
4812
4818
|
return false;
|
|
4813
4819
|
}
|
|
4814
4820
|
|
|
@@ -5507,7 +5513,7 @@
|
|
|
5507
5513
|
disableKeyboardFocusNavigationRoutines();
|
|
5508
5514
|
}
|
|
5509
5515
|
|
|
5510
|
-
if (
|
|
5516
|
+
if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
|
|
5511
5517
|
hostElementFocus.call(this);
|
|
5512
5518
|
return;
|
|
5513
5519
|
} // Typescript does not like it when you treat the `arguments` object as an array
|
|
@@ -5526,7 +5532,7 @@
|
|
|
5526
5532
|
defineProperties(HTMLElement.prototype, {
|
|
5527
5533
|
tabIndex: {
|
|
5528
5534
|
get() {
|
|
5529
|
-
if (
|
|
5535
|
+
if (isSyntheticShadowHost(this)) {
|
|
5530
5536
|
return tabIndexGetterPatched.call(this);
|
|
5531
5537
|
}
|
|
5532
5538
|
|
|
@@ -5534,7 +5540,7 @@
|
|
|
5534
5540
|
},
|
|
5535
5541
|
|
|
5536
5542
|
set(v) {
|
|
5537
|
-
if (
|
|
5543
|
+
if (isSyntheticShadowHost(this)) {
|
|
5538
5544
|
return tabIndexSetterPatched.call(this, v);
|
|
5539
5545
|
}
|
|
5540
5546
|
|
|
@@ -5546,7 +5552,7 @@
|
|
|
5546
5552
|
},
|
|
5547
5553
|
blur: {
|
|
5548
5554
|
value() {
|
|
5549
|
-
if (
|
|
5555
|
+
if (isSyntheticShadowHost(this)) {
|
|
5550
5556
|
return blurPatched.call(this);
|
|
5551
5557
|
}
|
|
5552
5558
|
|
|
@@ -5578,7 +5584,7 @@
|
|
|
5578
5584
|
}
|
|
5579
5585
|
|
|
5580
5586
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
5581
|
-
if (isNodeShadowed(this) ||
|
|
5587
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
5582
5588
|
return getInnerText(this);
|
|
5583
5589
|
}
|
|
5584
5590
|
|
|
@@ -5614,7 +5620,7 @@
|
|
|
5614
5620
|
}
|
|
5615
5621
|
|
|
5616
5622
|
if (!runtimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
5617
|
-
if (isNodeShadowed(this) ||
|
|
5623
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
5618
5624
|
return getInnerText(this);
|
|
5619
5625
|
}
|
|
5620
5626
|
|
|
@@ -5719,7 +5725,7 @@
|
|
|
5719
5725
|
if (node instanceof Element) {
|
|
5720
5726
|
setShadowToken(node, shadowToken);
|
|
5721
5727
|
|
|
5722
|
-
if (
|
|
5728
|
+
if (isSyntheticShadowHost(node)) {
|
|
5723
5729
|
// Root LWC elements can't get content slotted into them, therefore we don't observe their children.
|
|
5724
5730
|
return;
|
|
5725
5731
|
}
|
|
@@ -5826,6 +5832,6 @@
|
|
|
5826
5832
|
|
|
5827
5833
|
configurable: true
|
|
5828
5834
|
});
|
|
5829
|
-
/** version: 2.5.
|
|
5835
|
+
/** version: 2.5.6 */
|
|
5830
5836
|
|
|
5831
|
-
}()
|
|
5837
|
+
})();
|