@lwc/synthetic-shadow 2.6.0 → 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.
@@ -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.5.10 */
197
+ /** version: 2.7.1 */
198
198
 
199
199
  /*
200
200
  * Copyright (c) 2018, salesforce.com, inc.
@@ -301,6 +301,7 @@ const {
301
301
  getElementsByClassName: getElementsByClassName$1
302
302
  } = HTMLElement.prototype;
303
303
  const shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : () => null;
304
+ const assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : () => null;
304
305
 
305
306
  /*
306
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1523,7 +1524,7 @@ if (!_globalThis.lwcRuntimeFlags) {
1523
1524
  }
1524
1525
 
1525
1526
  const runtimeFlags = _globalThis.lwcRuntimeFlags;
1526
- /** version: 2.5.10 */
1527
+ /** version: 2.7.1 */
1527
1528
 
1528
1529
  /*
1529
1530
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1616,7 +1617,9 @@ function parentElementGetterPatched() {
1616
1617
  }
1617
1618
 
1618
1619
  function compareDocumentPositionPatched(otherNode) {
1619
- if (this.getRootNode() === otherNode) {
1620
+ if (this === otherNode) {
1621
+ return 0;
1622
+ } else if (this.getRootNode() === otherNode) {
1620
1623
  // "this" is in a shadow tree where the shadow root is the "otherNode".
1621
1624
  return 10; // Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING
1622
1625
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
@@ -2143,6 +2146,12 @@ const SyntheticShadowRootDescriptors = {
2143
2146
  return `[object ShadowRoot]`;
2144
2147
  }
2145
2148
 
2149
+ },
2150
+ synthetic: {
2151
+ writable: false,
2152
+ enumerable: false,
2153
+ configurable: false,
2154
+ value: true
2146
2155
  }
2147
2156
  };
2148
2157
  const ShadowRootDescriptors = {
@@ -3971,6 +3980,14 @@ retargetRelatedTarget(FocusEvent);
3971
3980
  */
3972
3981
  retargetRelatedTarget(MouseEvent);
3973
3982
 
3983
+ /*
3984
+ * Copyright (c) 2021, salesforce.com, inc.
3985
+ * All rights reserved.
3986
+ * SPDX-License-Identifier: MIT
3987
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3988
+ */
3989
+ const assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : () => null;
3990
+
3974
3991
  /*
3975
3992
  * Copyright (c) 2018, salesforce.com, inc.
3976
3993
  * All rights reserved.
@@ -4024,10 +4041,22 @@ function getFilteredSlotFlattenNodes(slot) {
4024
4041
  }
4025
4042
 
4026
4043
  function assignedSlotGetterPatched() {
4027
- const parentNode = parentNodeGetter.call(this);
4044
+ const parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
4045
+
4046
+ if (parentNode instanceof Element) {
4047
+ const sr = shadowRootGetter.call(parentNode);
4048
+
4049
+ if (isInstanceOfNativeShadowRoot(sr)) {
4050
+ if (this instanceof Text) {
4051
+ return assignedSlotGetter.call(this);
4052
+ }
4053
+
4054
+ return assignedSlotGetter$1.call(this);
4055
+ }
4056
+ }
4028
4057
  /**
4029
4058
  * The node is assigned to a slot if:
4030
- * - it has a parent and it parent its parent is a slot element
4059
+ * - it has a parent and its parent is a slot element
4031
4060
  * - and if the slot owner key is different than the node owner key.
4032
4061
  *
4033
4062
  * When the slot and the slotted node are 2 different shadow trees, the owner keys will be
@@ -4036,6 +4065,7 @@ function assignedSlotGetterPatched() {
4036
4065
  * different than the node owner key (always `undefined`).
4037
4066
  */
4038
4067
 
4068
+
4039
4069
  if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
4040
4070
  return parentNode;
4041
4071
  }
@@ -5650,4 +5680,4 @@ defineProperty(Element.prototype, '$domManual$', {
5650
5680
 
5651
5681
  configurable: true
5652
5682
  });
5653
- /** version: 2.5.10 */
5683
+ /** version: 2.7.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/synthetic-shadow",
3
- "version": "2.6.0",
3
+ "version": "2.7.1",
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.6.0",
40
- "@lwc/shared": "2.6.0"
39
+ "@lwc/features": "2.7.1",
40
+ "@lwc/shared": "2.7.1"
41
41
  },
42
- "gitHead": "94040389ab8fc717b8753e503f659489480a327d"
42
+ "gitHead": "1b2e246e03c6bfbc80bea3def43b7d0281a1de21"
43
43
  }