@lwc/synthetic-shadow 6.2.1 → 6.3.0

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