@lwc/synthetic-shadow 6.2.1 → 6.3.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.
package/dist/index.cjs.js CHANGED
@@ -210,7 +210,7 @@ const KEY__LEGACY_SHADOW_TOKEN_PRIVATE = '$$LegacyShadowTokenKey$$';
210
210
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
211
211
  const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
212
212
  const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
213
- /** version: 6.2.1 */
213
+ /** version: 6.3.1 */
214
214
 
215
215
  /**
216
216
  * Copyright (c) 2024 Salesforce, Inc.
@@ -218,7 +218,7 @@ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
218
218
  if (!globalThis.lwcRuntimeFlags) {
219
219
  Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
220
220
  }
221
- /** version: 6.2.1 */
221
+ /** version: 6.3.1 */
222
222
 
223
223
  /*
224
224
  * Copyright (c) 2018, salesforce.com, inc.
@@ -699,7 +699,7 @@ function getFilteredChildNodes(node) {
699
699
  const resolver = getShadowRootResolver(getShadowRoot(node));
700
700
  // Typescript is inferring the wrong function type for this particular
701
701
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
702
- // @ts-ignore type-mismatch
702
+ // @ts-expect-error type-mismatch
703
703
  return ArrayReduce.call(slots, (seed, slot) => {
704
704
  if (resolver === getShadowRootResolver(slot)) {
705
705
  ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
@@ -2018,7 +2018,7 @@ const NodePatchDescriptors = {
2018
2018
  value(evt) {
2019
2019
  eventToShadowRootMap.set(evt, this);
2020
2020
  // Typescript does not like it when you treat the `arguments` object as an array
2021
- // @ts-ignore type-mismatch
2021
+ // @ts-expect-error type-mismatch
2022
2022
  return dispatchEvent.apply(getHost(this), arguments);
2023
2023
  },
2024
2024
  },
@@ -2867,9 +2867,14 @@ defineProperty(window, 'MutationObserver', {
2867
2867
  function patchedAddEventListener(type, listener, optionsOrCapture) {
2868
2868
  if (isSyntheticShadowHost(this)) {
2869
2869
  // Typescript does not like it when you treat the `arguments` object as an array
2870
- // @ts-ignore type-mismatch
2870
+ // @ts-expect-error type-mismatch
2871
2871
  return addCustomElementEventListener.apply(this, arguments);
2872
2872
  }
2873
+ if (this instanceof _Node && isInstanceOfNativeShadowRoot(this.getRootNode())) {
2874
+ // Typescript does not like it when you treat the `arguments` object as an array
2875
+ // @ts-expect-error type-mismatch
2876
+ return addEventListener.apply(this, arguments);
2877
+ }
2873
2878
  if (arguments.length < 2) {
2874
2879
  // Slow path, unlikely to be called frequently. We expect modern browsers to throw:
2875
2880
  // https://googlechrome.github.io/samples/event-listeners-mandatory-arguments/
@@ -2878,7 +2883,7 @@ function patchedAddEventListener(type, listener, optionsOrCapture) {
2878
2883
  args[1] = getEventListenerWrapper(args[1]);
2879
2884
  }
2880
2885
  // Ignore types because we're passing through to native method
2881
- // @ts-ignore type-mismatch
2886
+ // @ts-expect-error type-mismatch
2882
2887
  return addEventListener.apply(this, args);
2883
2888
  }
2884
2889
  // Fast path. This function is optimized to avoid ArraySlice because addEventListener is called
@@ -2890,7 +2895,7 @@ function patchedAddEventListener(type, listener, optionsOrCapture) {
2890
2895
  function patchedRemoveEventListener(_type, _listener, _optionsOrCapture) {
2891
2896
  if (isSyntheticShadowHost(this)) {
2892
2897
  // Typescript does not like it when you treat the `arguments` object as an array
2893
- // @ts-ignore type-mismatch
2898
+ // @ts-expect-error type-mismatch
2894
2899
  return removeCustomElementEventListener.apply(this, arguments);
2895
2900
  }
2896
2901
  const args = ArraySlice.call(arguments);
@@ -2898,11 +2903,11 @@ function patchedRemoveEventListener(_type, _listener, _optionsOrCapture) {
2898
2903
  args[1] = getEventListenerWrapper(args[1]);
2899
2904
  }
2900
2905
  // Ignore types because we're passing through to native method
2901
- // @ts-ignore type-mismatch
2906
+ // @ts-expect-error type-mismatch
2902
2907
  removeEventListener.apply(this, args);
2903
2908
  // Account for listeners that were added before this polyfill was applied
2904
2909
  // Typescript does not like it when you treat the `arguments` object as an array
2905
- // @ts-ignore type-mismatch
2910
+ // @ts-expect-error type-mismatch
2906
2911
  removeEventListener.apply(this, arguments);
2907
2912
  }
2908
2913
  defineProperties(eventTargetPrototype, {
@@ -3126,7 +3131,7 @@ function getFilteredSlotFlattenNodes(slot) {
3126
3131
  const childNodes = arrayFromCollection(childNodesGetter.call(slot));
3127
3132
  // Typescript is inferring the wrong function type for this particular
3128
3133
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
3129
- // @ts-ignore type-mismatch
3134
+ // @ts-expect-error type-mismatch
3130
3135
  return ArrayReduce.call(childNodes, (seed, child) => {
3131
3136
  if (child instanceof Element && isSlotElement(child)) {
3132
3137
  ArrayPush.apply(seed, getFilteredSlotFlattenNodes(child));
@@ -3680,7 +3685,7 @@ function hostElementFocus() {
3680
3685
  // observable differences for component authors between synthetic and native.
3681
3686
  const focusable = querySelector.call(this, FocusableSelector);
3682
3687
  if (!isNull(focusable)) {
3683
- // @ts-ignore type-mismatch
3688
+ // @ts-expect-error type-mismatch
3684
3689
  focusable.focus.apply(focusable, arguments);
3685
3690
  }
3686
3691
  return;
@@ -3696,7 +3701,7 @@ function hostElementFocus() {
3696
3701
  let didFocus = false;
3697
3702
  while (!didFocus && focusables.length !== 0) {
3698
3703
  const focusable = focusables.shift();
3699
- // @ts-ignore type-mismatch
3704
+ // @ts-expect-error type-mismatch
3700
3705
  focusable.focus.apply(focusable, arguments);
3701
3706
  // Get the root node of the current focusable in case it was slotted.
3702
3707
  const currentRootNode = focusable.getRootNode();
@@ -4059,7 +4064,7 @@ function focusPatched() {
4059
4064
  return;
4060
4065
  }
4061
4066
  // Typescript does not like it when you treat the `arguments` object as an array
4062
- // @ts-ignore type-mismatch
4067
+ // @ts-expect-error type-mismatch
4063
4068
  focus.apply(this, arguments);
4064
4069
  // Restore state by enabling if originally enabled
4065
4070
  if (originallyEnabled) {
@@ -4099,7 +4104,7 @@ defineProperties(HTMLElement.prototype, {
4099
4104
  focus: {
4100
4105
  value() {
4101
4106
  // Typescript does not like it when you treat the `arguments` object as an array
4102
- // @ts-ignore type-mismatch
4107
+ // @ts-expect-error type-mismatch
4103
4108
  focusPatched.apply(this, arguments);
4104
4109
  },
4105
4110
  enumerable: true,
@@ -4351,6 +4356,6 @@ defineProperty(Element.prototype, '$domManual$', {
4351
4356
  },
4352
4357
  configurable: true,
4353
4358
  });
4354
- /** version: 6.2.1 */
4359
+ /** version: 6.3.1 */
4355
4360
  }
4356
4361
  //# sourceMappingURL=index.cjs.js.map