matsuri-hooks 4.2.24 → 4.2.26

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-Z32RQX5Z.js";
3
+ } from "./chunk-VE65KYR3.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-2TUXWMP5.js";
@@ -81,9 +81,7 @@ function _define_property(obj, key, value) {
81
81
  configurable: true,
82
82
  writable: true
83
83
  });
84
- } else {
85
- obj[key] = value;
86
- }
84
+ } else obj[key] = value;
87
85
  return obj;
88
86
  }
89
87
  var DataTransferItemStub = class {
@@ -215,9 +213,7 @@ function _define_property2(obj, key, value) {
215
213
  configurable: true,
216
214
  writable: true
217
215
  });
218
- } else {
219
- obj[key] = value;
220
- }
216
+ } else obj[key] = value;
221
217
  return obj;
222
218
  }
223
219
  function createClipboardItem(window, ...blobs) {
@@ -357,10 +353,18 @@ async function writeDataTransferToClipboard(document, clipboardData) {
357
353
  }
358
354
  var g = globalThis;
359
355
  if (typeof g.afterEach === "function") {
360
- g.afterEach(() => resetClipboardStubOnView(globalThis.window));
356
+ g.afterEach(() => {
357
+ if (typeof globalThis.window !== "undefined") {
358
+ resetClipboardStubOnView(globalThis.window);
359
+ }
360
+ });
361
361
  }
362
362
  if (typeof g.afterAll === "function") {
363
- g.afterAll(() => detachClipboardStubFromView(globalThis.window));
363
+ g.afterAll(() => {
364
+ if (typeof globalThis.window !== "undefined") {
365
+ detachClipboardStubFromView(globalThis.window);
366
+ }
367
+ });
364
368
  }
365
369
 
366
370
  // node_modules/@testing-library/user-event/dist/esm/utils/focus/selector.js
@@ -372,7 +376,8 @@ var FOCUSABLE_SELECTOR = [
372
376
  '[contenteditable=""]',
373
377
  '[contenteditable="true"]',
374
378
  "a[href]",
375
- "[tabindex]:not([disabled])"
379
+ "[tabindex]:not([disabled])",
380
+ "details > summary"
376
381
  ].join(", ");
377
382
 
378
383
  // node_modules/@testing-library/user-event/dist/esm/utils/focus/isFocusable.js
@@ -417,16 +422,18 @@ function isDisabled(element) {
417
422
  function getActiveElement(document) {
418
423
  const activeElement = document.activeElement;
419
424
  if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) {
420
- return getActiveElement(activeElement.shadowRoot);
421
- } else {
422
- if (isDisabled(activeElement)) {
423
- return document.ownerDocument ? (
424
- /* istanbul ignore next */
425
- document.ownerDocument.body
426
- ) : document.body;
425
+ const activeElementInShadowTree = getActiveElement(activeElement.shadowRoot);
426
+ if (activeElementInShadowTree) {
427
+ return activeElementInShadowTree;
427
428
  }
428
- return activeElement;
429
429
  }
430
+ if (isDisabled(activeElement)) {
431
+ return document.ownerDocument ? (
432
+ /* istanbul ignore next */
433
+ document.ownerDocument.body
434
+ ) : document.body;
435
+ }
436
+ return activeElement;
430
437
  }
431
438
  function getActiveElementOrBody(document) {
432
439
  var _getActiveElement;
@@ -637,7 +644,7 @@ function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset:
637
644
  }
638
645
  }
639
646
  function getUISelection(element) {
640
- var _element_selectionStart, _element_selectionEnd, _element_UISelection;
647
+ var _element_UISelection, _element_selectionStart, _element_selectionEnd;
641
648
  const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
642
649
  anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
643
650
  focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
@@ -978,7 +985,8 @@ function editInputElement(instance, element, inputRange, data, inputType) {
978
985
  if (supportsMaxLength(element)) {
979
986
  const maxLength = getMaxLength(element);
980
987
  if (maxLength !== void 0 && data.length > 0) {
981
- const spaceUntilMaxLength = maxLength - element.value.length;
988
+ const selectionLength = inputRange.endOffset - inputRange.startOffset;
989
+ const spaceUntilMaxLength = maxLength - element.value.length + selectionLength;
982
990
  if (spaceUntilMaxLength > 0) {
983
991
  dataToInsert = data.substring(0, spaceUntilMaxLength);
984
992
  } else {
@@ -1176,6 +1184,7 @@ function moveSelection(node, direction) {
1176
1184
 
1177
1185
  // node_modules/@testing-library/user-event/dist/esm/event/selection/selectAll.js
1178
1186
  function selectAll(target) {
1187
+ var _getContentEditable;
1179
1188
  if (hasOwnSelection(target)) {
1180
1189
  return setSelection({
1181
1190
  focusNode: target,
@@ -1183,7 +1192,6 @@ function selectAll(target) {
1183
1192
  focusOffset: getUIValue(target).length
1184
1193
  });
1185
1194
  }
1186
- var _getContentEditable;
1187
1195
  const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
1188
1196
  setSelection({
1189
1197
  focusNode,
@@ -1192,10 +1200,10 @@ function selectAll(target) {
1192
1200
  });
1193
1201
  }
1194
1202
  function isAllSelected(target) {
1203
+ var _getContentEditable;
1195
1204
  if (hasOwnSelection(target)) {
1196
1205
  return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;
1197
1206
  }
1198
- var _getContentEditable;
1199
1207
  const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
1200
1208
  const selection = target.ownerDocument.getSelection();
1201
1209
  return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
@@ -1243,9 +1251,9 @@ function walkRadio(instance, el, direction) {
1243
1251
 
1244
1252
  // node_modules/@testing-library/user-event/dist/esm/event/behavior/keydown.js
1245
1253
  behavior.keydown = (event, target, instance) => {
1254
+ var _ref;
1246
1255
  var _keydownBehavior_event_key;
1247
- var _keydownBehavior_event_key1;
1248
- return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
1256
+ return (_ref = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _ref !== void 0 ? _ref : combinationBehavior(event, target, instance);
1249
1257
  };
1250
1258
  var keydownBehavior = {
1251
1259
  ArrowDown: (event, target, instance) => {
@@ -1298,9 +1306,9 @@ var keydownBehavior = {
1298
1306
  "textarea"
1299
1307
  ]) || isContentEditable(target)) {
1300
1308
  return () => {
1309
+ var _ref;
1301
1310
  var _getValueOrTextContent;
1302
- var _getValueOrTextContent_length;
1303
- const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== void 0 ? _getValueOrTextContent_length : (
1311
+ const newPos = (_ref = (_getValueOrTextContent = getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _ref !== void 0 ? _ref : (
1304
1312
  /* istanbul ignore next */
1305
1313
  0
1306
1314
  );
@@ -1339,7 +1347,12 @@ var keydownBehavior = {
1339
1347
  },
1340
1348
  Tab: (event, target, instance) => {
1341
1349
  return () => {
1342
- const dest = getTabDestination(target, instance.system.keyboard.modifiers.Shift);
1350
+ const dest = getTabDestination(
1351
+ // get target here because target would be stale, it's the element that keydown happened on, but
1352
+ // focus may have been moved to another element so that browser tab behaviour picks up from there
1353
+ getActiveElementOrBody(instance.config.document),
1354
+ instance.system.keyboard.modifiers.Shift
1355
+ );
1343
1356
  focusElement(dest);
1344
1357
  if (hasOwnSelection(dest)) {
1345
1358
  setUISelection(dest, {
@@ -1742,49 +1755,35 @@ function createEvent(type3, target, init) {
1742
1755
  return event;
1743
1756
  }
1744
1757
  function getEventConstructors(window) {
1745
- var _window_Event;
1758
+ var _window_Event, _window_AnimationEvent, _window_ClipboardEvent, _window_PopStateEvent, _window_ProgressEvent, _window_TransitionEvent, _window_UIEvent, _window_CompositionEvent, _window_FocusEvent, _window_InputEvent, _window_KeyboardEvent, _window_MouseEvent, _window_DragEvent, _window_PointerEvent, _window_TouchEvent;
1746
1759
  const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
1747
1760
  };
1748
- var _window_AnimationEvent;
1749
1761
  const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
1750
1762
  };
1751
- var _window_ClipboardEvent;
1752
1763
  const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
1753
1764
  };
1754
- var _window_PopStateEvent;
1755
1765
  const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
1756
1766
  };
1757
- var _window_ProgressEvent;
1758
1767
  const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
1759
1768
  };
1760
- var _window_TransitionEvent;
1761
1769
  const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
1762
1770
  };
1763
- var _window_UIEvent;
1764
1771
  const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
1765
1772
  };
1766
- var _window_CompositionEvent;
1767
1773
  const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
1768
1774
  };
1769
- var _window_FocusEvent;
1770
1775
  const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
1771
1776
  };
1772
- var _window_InputEvent;
1773
1777
  const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
1774
1778
  };
1775
- var _window_KeyboardEvent;
1776
1779
  const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
1777
1780
  };
1778
- var _window_MouseEvent;
1779
1781
  const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
1780
1782
  };
1781
- var _window_DragEvent;
1782
1783
  const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
1783
1784
  };
1784
- var _window_PointerEvent;
1785
1785
  const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
1786
1786
  };
1787
- var _window_TouchEvent;
1788
1787
  const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
1789
1788
  };
1790
1789
  return {
@@ -1889,17 +1888,17 @@ function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY =
1889
1888
  pageY: sanitizeNumber(pageY)
1890
1889
  });
1891
1890
  }
1892
- function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
1891
+ function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary, buttons }) {
1893
1892
  assignProps(event, {
1894
1893
  pointerId: sanitizeNumber(pointerId),
1895
1894
  width: sanitizeNumber(width !== null && width !== void 0 ? width : 1),
1896
1895
  height: sanitizeNumber(height !== null && height !== void 0 ? height : 1),
1897
- pressure: sanitizeNumber(pressure),
1896
+ pressure: sanitizeNumber(pressure !== null && pressure !== void 0 ? pressure : buttons ? 0.5 : 0),
1898
1897
  tangentialPressure: sanitizeNumber(tangentialPressure),
1899
1898
  tiltX: sanitizeNumber(tiltX),
1900
1899
  tiltY: sanitizeNumber(tiltY),
1901
1900
  twist: sanitizeNumber(twist),
1902
- pointerType: String(pointerType),
1901
+ pointerType: String(pointerType !== null && pointerType !== void 0 ? pointerType : ""),
1903
1902
  isPrimary: Boolean(isPrimary)
1904
1903
  });
1905
1904
  }
@@ -1954,11 +1953,13 @@ function patchFocus(HTMLElement) {
1954
1953
  Object.defineProperties(HTMLElement.prototype, {
1955
1954
  focus: {
1956
1955
  configurable: true,
1957
- get: () => patchedFocus
1956
+ value: patchedFocus,
1957
+ writable: true
1958
1958
  },
1959
1959
  blur: {
1960
1960
  configurable: true,
1961
- get: () => patchedBlur
1961
+ value: patchedBlur,
1962
+ writable: true
1962
1963
  },
1963
1964
  [patched]: {
1964
1965
  configurable: true,
@@ -2213,9 +2214,7 @@ function _define_property3(obj, key, value) {
2213
2214
  configurable: true,
2214
2215
  writable: true
2215
2216
  });
2216
- } else {
2217
- obj[key] = value;
2218
- }
2217
+ } else obj[key] = value;
2219
2218
  return obj;
2220
2219
  }
2221
2220
  var DOM_KEY_LOCATION = /* @__PURE__ */ (function(DOM_KEY_LOCATION2) {
@@ -2255,7 +2254,7 @@ var KeyboardHost = class {
2255
2254
  return this.pressed.values().map((p) => p.keyDef);
2256
2255
  }
2257
2256
  /** Press a key */
2258
- async keydown(instance, keyDef) {
2257
+ async keydown(instance, keyDef, repeat = false) {
2259
2258
  const key = String(keyDef.key);
2260
2259
  const code = String(keyDef.code);
2261
2260
  const target = getActiveElementOrBody(instance.config.document);
@@ -2266,7 +2265,8 @@ var KeyboardHost = class {
2266
2265
  }
2267
2266
  const unprevented = instance.dispatchUIEvent(target, "keydown", {
2268
2267
  key,
2269
- code
2268
+ code,
2269
+ repeat
2270
2270
  });
2271
2271
  if (isModifierLock(key) && !this.modifiers[key]) {
2272
2272
  this.modifiers[key] = true;
@@ -2331,8 +2331,7 @@ var KeyboardHost = class {
2331
2331
  });
2332
2332
  _define_property3(this, "pressed", new class {
2333
2333
  add(code, keyDef) {
2334
- var _this_registry, _code;
2335
- var _;
2334
+ var _this_registry, _code, _;
2336
2335
  (_ = (_this_registry = this.registry)[_code = code]) !== null && _ !== void 0 ? _ : _this_registry[_code] = {
2337
2336
  keyDef,
2338
2337
  unpreventedDefault: false
@@ -2580,9 +2579,7 @@ function _define_property4(obj, key, value) {
2580
2579
  configurable: true,
2581
2580
  writable: true
2582
2581
  });
2583
- } else {
2584
- obj[key] = value;
2585
- }
2582
+ } else obj[key] = value;
2586
2583
  return obj;
2587
2584
  }
2588
2585
  var Buttons = class {
@@ -2655,9 +2652,7 @@ function _define_property5(obj, key, value) {
2655
2652
  configurable: true,
2656
2653
  writable: true
2657
2654
  });
2658
- } else {
2659
- obj[key] = value;
2660
- }
2655
+ } else obj[key] = value;
2661
2656
  return obj;
2662
2657
  }
2663
2658
  var Device = class {
@@ -2754,14 +2749,10 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
2754
2749
  }
2755
2750
  const targetHasOwnSelection = hasOwnSelection(target);
2756
2751
  const text = String(targetHasOwnSelection ? getUIValue(target) : target.textContent);
2757
- const [start, end] = node ? (
2758
- // which elements might be considered in the same line of text.
2759
- // TODO: support expanding initial range on multiple clicks if node is given
2760
- [
2761
- offset,
2762
- offset
2763
- ]
2764
- ) : getTextRange(text, offset, clickCount);
2752
+ const [start, end] = node ? [
2753
+ offset,
2754
+ offset
2755
+ ] : getTextRange(text, offset, clickCount);
2765
2756
  if (targetHasOwnSelection) {
2766
2757
  setUISelection(target, {
2767
2758
  anchorOffset: start !== null && start !== void 0 ? start : text.length,
@@ -2787,7 +2778,7 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
2787
2778
  try {
2788
2779
  range.setStart(startNode, startOffset);
2789
2780
  range.setEnd(endNode, endOffset);
2790
- } catch (e) {
2781
+ } catch {
2791
2782
  throw new Error("The given offset is out of bounds.");
2792
2783
  }
2793
2784
  const selection = document.getSelection();
@@ -2861,9 +2852,7 @@ function _define_property6(obj, key, value) {
2861
2852
  configurable: true,
2862
2853
  writable: true
2863
2854
  });
2864
- } else {
2865
- obj[key] = value;
2866
- }
2855
+ } else obj[key] = value;
2867
2856
  return obj;
2868
2857
  }
2869
2858
  var Mouse = class {
@@ -3004,11 +2993,10 @@ var Mouse = class {
3004
2993
  return current;
3005
2994
  }
3006
2995
  getOnDown(button) {
3007
- var _this_count_button;
2996
+ var _this_count_button, _this_count_button1;
3008
2997
  this.down = {
3009
2998
  [button]: (_this_count_button = this.count[button]) !== null && _this_count_button !== void 0 ? _this_count_button : 0
3010
2999
  };
3011
- var _this_count_button1;
3012
3000
  this.count = {
3013
3001
  [button]: (_this_count_button1 = this.count[button]) !== null && _this_count_button1 !== void 0 ? _this_count_button1 : 0
3014
3002
  };
@@ -3130,9 +3118,7 @@ function _define_property7(obj, key, value) {
3130
3118
  configurable: true,
3131
3119
  writable: true
3132
3120
  });
3133
- } else {
3134
- obj[key] = value;
3135
- }
3121
+ } else obj[key] = value;
3136
3122
  return obj;
3137
3123
  }
3138
3124
  var Pointer = class {
@@ -3246,9 +3232,7 @@ function _define_property8(obj, key, value) {
3246
3232
  configurable: true,
3247
3233
  writable: true
3248
3234
  });
3249
- } else {
3250
- obj[key] = value;
3251
- }
3235
+ } else obj[key] = value;
3252
3236
  return obj;
3253
3237
  }
3254
3238
  var PointerHost = class {
@@ -3337,8 +3321,7 @@ var PointerHost = class {
3337
3321
  _define_property8(this, "buttons", void 0);
3338
3322
  _define_property8(this, "devices", new class {
3339
3323
  get(k) {
3340
- var _this_registry, _k;
3341
- var _;
3324
+ var _this_registry, _k, _;
3342
3325
  return (_ = (_this_registry = this.registry)[_k = k]) !== null && _ !== void 0 ? _ : _this_registry[_k] = new Device();
3343
3326
  }
3344
3327
  constructor() {
@@ -3392,9 +3375,7 @@ function _define_property9(obj, key, value) {
3392
3375
  configurable: true,
3393
3376
  writable: true
3394
3377
  });
3395
- } else {
3396
- obj[key] = value;
3397
- }
3378
+ } else obj[key] = value;
3398
3379
  return obj;
3399
3380
  }
3400
3381
  var System = class {
@@ -3470,11 +3451,10 @@ async function tab({ shift } = {}) {
3470
3451
  }
3471
3452
 
3472
3453
  // node_modules/@testing-library/user-event/dist/esm/utils/keyDef/readNextDescriptor.js
3473
- var bracketDict = /* @__PURE__ */ (function(bracketDict2) {
3474
- bracketDict2["{"] = "}";
3475
- bracketDict2["["] = "]";
3476
- return bracketDict2;
3477
- })(bracketDict || {});
3454
+ var bracketDict = {
3455
+ "{": "}",
3456
+ "[": "]"
3457
+ };
3478
3458
  function readNextDescriptor(text, context) {
3479
3459
  let pos = 0;
3480
3460
  const startBracket = text[pos] in bracketDict ? text[pos] : "";
@@ -3499,6 +3479,7 @@ function readPrintableChar(text, pos, context) {
3499
3479
  };
3500
3480
  }
3501
3481
  function readTag(text, pos, startBracket, context) {
3482
+ var _ref;
3502
3483
  var _text_slice_match, _text_slice_match1;
3503
3484
  const releasePreviousModifier = text[pos] === "/" ? "/" : "";
3504
3485
  pos += releasePreviousModifier.length;
@@ -3507,8 +3488,7 @@ function readTag(text, pos, startBracket, context) {
3507
3488
  const descriptor = escapedDescriptor ? text[pos] : (_text_slice_match = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) === null || _text_slice_match === void 0 ? void 0 : _text_slice_match[0];
3508
3489
  assertDescriptor(descriptor, text, pos, context);
3509
3490
  pos += descriptor.length;
3510
- var _text_slice_match_;
3511
- const repeatModifier = (_text_slice_match_ = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === void 0 ? void 0 : _text_slice_match1[0]) !== null && _text_slice_match_ !== void 0 ? _text_slice_match_ : "";
3491
+ const repeatModifier = (_ref = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === void 0 ? void 0 : _text_slice_match1[0]) !== null && _ref !== void 0 ? _ref : "";
3512
3492
  pos += repeatModifier.length;
3513
3493
  const releaseSelfModifier = text[pos] === "/" || !repeatModifier && text[pos] === ">" ? text[pos] : "";
3514
3494
  pos += releaseSelfModifier.length;
@@ -3553,8 +3533,8 @@ function getErrorMessage(expected, found, text, context) {
3553
3533
  function parseKeyDef(keyboardMap, text) {
3554
3534
  const defs = [];
3555
3535
  do {
3556
- const { type: type3, descriptor, consumedLength, releasePrevious, releaseSelf = true, repeat } = readNextDescriptor(text, "keyboard");
3557
3536
  var _keyboardMap_find;
3537
+ const { type: type3, descriptor, consumedLength, releasePrevious, releaseSelf = true, repeat } = readNextDescriptor(text, "keyboard");
3558
3538
  const keyDef = (_keyboardMap_find = keyboardMap.find((def) => {
3559
3539
  if (type3 === "[") {
3560
3540
  var _def_code;
@@ -3595,7 +3575,7 @@ async function keyboardAction(instance, { keyDef, releasePrevious, releaseSelf,
3595
3575
  }
3596
3576
  if (!releasePrevious) {
3597
3577
  for (let i = 1; i <= repeat; i++) {
3598
- await system.keyboard.keydown(instance, keyDef);
3578
+ await system.keyboard.keydown(instance, keyDef, i > 1);
3599
3579
  if (i < repeat) {
3600
3580
  await wait(instance.config);
3601
3581
  }
@@ -3634,8 +3614,8 @@ function readSelectedValueFromInput(target) {
3634
3614
 
3635
3615
  // node_modules/@testing-library/user-event/dist/esm/clipboard/copy.js
3636
3616
  async function copy() {
3637
- const doc = this.config.document;
3638
3617
  var _doc_activeElement;
3618
+ const doc = this.config.document;
3639
3619
  const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : (
3640
3620
  /* istanbul ignore next */
3641
3621
  doc.body
@@ -3654,8 +3634,8 @@ async function copy() {
3654
3634
 
3655
3635
  // node_modules/@testing-library/user-event/dist/esm/clipboard/cut.js
3656
3636
  async function cut() {
3657
- const doc = this.config.document;
3658
3637
  var _doc_activeElement;
3638
+ const doc = this.config.document;
3659
3639
  const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : (
3660
3640
  /* istanbul ignore next */
3661
3641
  doc.body
@@ -3674,13 +3654,12 @@ async function cut() {
3674
3654
 
3675
3655
  // node_modules/@testing-library/user-event/dist/esm/clipboard/paste.js
3676
3656
  async function paste(clipboardData) {
3657
+ var _doc_activeElement, _ref;
3677
3658
  const doc = this.config.document;
3678
- var _doc_activeElement;
3679
3659
  const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : (
3680
3660
  /* istanbul ignore next */
3681
3661
  doc.body
3682
3662
  );
3683
- var _ref;
3684
3663
  const dataTransfer = (_ref = typeof clipboardData === "string" ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await readDataTransferFromClipboard(doc).catch(() => {
3685
3664
  throw new Error("`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.");
3686
3665
  });
@@ -3737,10 +3716,10 @@ async function pointer(input2) {
3737
3716
  this.system.pointer.resetClickCount();
3738
3717
  }
3739
3718
  async function pointerAction(instance, action) {
3719
+ var _action_target, _action_coords, _action_node, _action_offset;
3740
3720
  var _previousPosition_caret, _previousPosition_caret1;
3741
3721
  const pointerName = "pointerName" in action && action.pointerName ? action.pointerName : "keyDef" in action ? instance.system.pointer.getPointerName(action.keyDef) : "mouse";
3742
3722
  const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
3743
- var _action_target, _action_coords, _action_node, _action_offset;
3744
3723
  const position = {
3745
3724
  target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
3746
3725
  coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
@@ -3768,14 +3747,14 @@ async function pointerAction(instance, action) {
3768
3747
  }
3769
3748
  }
3770
3749
  function hasCaretPosition(action) {
3771
- var _action_target, _ref;
3750
+ var _ref, _action_target;
3772
3751
  return !!((_ref = (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : action.node) !== null && _ref !== void 0 ? _ref : action.offset !== void 0);
3773
3752
  }
3774
3753
  function getPrevTarget(instance, position) {
3754
+ var _position_target;
3775
3755
  if (!position) {
3776
3756
  throw new Error("This pointer has no previous position. Provide a target property!");
3777
3757
  }
3778
- var _position_target;
3779
3758
  return (_position_target = position.target) !== null && _position_target !== void 0 ? _position_target : instance.config.document.body;
3780
3759
  }
3781
3760
 
@@ -4059,10 +4038,10 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
4059
4038
  };
4060
4039
  }
4061
4040
  function setupMain(options = {}) {
4041
+ var _config_document_defaultView;
4062
4042
  const config = createConfig(options);
4063
4043
  prepareDocument(config.document);
4064
4044
  patchFocus(getWindow(config.document).HTMLElement);
4065
- var _config_document_defaultView;
4066
4045
  const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== void 0 ? _config_document_defaultView : (
4067
4046
  /* istanbul ignore next */
4068
4047
  globalThis.window
@@ -4071,10 +4050,10 @@ function setupMain(options = {}) {
4071
4050
  return createInstance(config).api;
4072
4051
  }
4073
4052
  function setupDirect({ keyboardState, pointerState, ...options } = {}, node) {
4053
+ var _ref;
4074
4054
  const config = createConfig(options, defaultOptionsDirect, node);
4075
4055
  prepareDocument(config.document);
4076
4056
  patchFocus(getWindow(config.document).HTMLElement);
4077
- var _ref;
4078
4057
  const system = (_ref = pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState) !== null && _ref !== void 0 ? _ref : new System();
4079
4058
  return {
4080
4059
  api: createInstance(config, system).api,
@@ -4122,7 +4101,7 @@ function createInstance(config, system = new System()) {
4122
4101
  };
4123
4102
  }
4124
4103
  function getDocument(options, node, defaults) {
4125
- var _options_document, _ref;
4104
+ var _ref, _options_document;
4126
4105
  return (_ref = (_options_document = options.document) !== null && _options_document !== void 0 ? _options_document : node && getDocumentFromNode(node)) !== null && _ref !== void 0 ? _ref : defaults.document;
4127
4106
  }
4128
4107
 
@@ -4210,4 +4189,4 @@ var userEvent = {
4210
4189
  export {
4211
4190
  userEvent
4212
4191
  };
4213
- //# sourceMappingURL=chunk-IMG3UCQ3.js.map
4192
+ //# sourceMappingURL=chunk-7DND5YAV.js.map