@testing-library/user-event 14.5.2 → 14.6.0

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.
Files changed (136) hide show
  1. package/dist/cjs/clipboard/copy.js +1 -7
  2. package/dist/cjs/clipboard/cut.js +1 -7
  3. package/dist/cjs/clipboard/paste.js +2 -8
  4. package/dist/cjs/convenience/hover.js +0 -5
  5. package/dist/cjs/document/UI.js +3 -3
  6. package/dist/cjs/document/copySelection.js +0 -6
  7. package/dist/cjs/document/getValueOrTextContent.js +0 -6
  8. package/dist/cjs/document/interceptor.js +5 -11
  9. package/dist/cjs/document/patchFocus.js +104 -0
  10. package/dist/cjs/document/prepareDocument.js +1 -7
  11. package/dist/cjs/document/trackValue.js +2 -8
  12. package/dist/cjs/event/behavior/click.js +1 -7
  13. package/dist/cjs/event/behavior/cut.js +0 -5
  14. package/dist/cjs/event/behavior/keydown.js +3 -8
  15. package/dist/cjs/event/behavior/keypress.js +2 -7
  16. package/dist/cjs/event/behavior/keyup.js +1 -6
  17. package/dist/cjs/event/behavior/paste.js +1 -6
  18. package/dist/cjs/event/createEvent.js +34 -27
  19. package/dist/cjs/event/dispatchEvent.js +1 -1
  20. package/dist/cjs/event/eventMap.js +32 -0
  21. package/dist/cjs/event/focus.js +5 -9
  22. package/dist/cjs/event/index.js +0 -6
  23. package/dist/cjs/event/input.js +2 -7
  24. package/dist/cjs/event/radio.js +0 -6
  25. package/dist/cjs/event/selection/getInputRange.js +1 -1
  26. package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -8
  27. package/dist/cjs/event/selection/modifySelection.js +1 -7
  28. package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -8
  29. package/dist/cjs/event/selection/moveSelection.js +1 -7
  30. package/dist/cjs/event/selection/resolveCaretPosition.js +4 -10
  31. package/dist/cjs/event/selection/selectAll.js +3 -9
  32. package/dist/cjs/event/selection/setSelection.js +1 -7
  33. package/dist/cjs/event/selection/setSelectionPerMouse.js +7 -13
  34. package/dist/cjs/event/selection/setSelectionRange.js +1 -7
  35. package/dist/cjs/event/selection/updateSelectionOnFocus.js +6 -8
  36. package/dist/cjs/index.js +1 -4
  37. package/dist/cjs/keyboard/index.js +0 -6
  38. package/dist/cjs/keyboard/parseKeyDef.js +3 -8
  39. package/dist/cjs/options.js +5 -3
  40. package/dist/cjs/pointer/index.js +6 -11
  41. package/dist/cjs/pointer/parseKeyDef.js +0 -5
  42. package/dist/cjs/setup/setup.js +7 -7
  43. package/dist/cjs/system/keyboard.js +47 -25
  44. package/dist/cjs/system/pointer/index.js +18 -20
  45. package/dist/cjs/system/pointer/mouse.js +8 -14
  46. package/dist/cjs/system/pointer/pointer.js +4 -9
  47. package/dist/cjs/system/pointer/shared.js +2 -2
  48. package/dist/cjs/utility/clear.js +0 -5
  49. package/dist/cjs/utility/selectOptions.js +1 -6
  50. package/dist/cjs/utility/type.js +1 -7
  51. package/dist/cjs/utility/upload.js +4 -10
  52. package/dist/cjs/utils/click/isClickableInput.js +3 -3
  53. package/dist/cjs/utils/dataTransfer/Clipboard.js +5 -6
  54. package/dist/cjs/utils/dataTransfer/DataTransfer.js +6 -10
  55. package/dist/cjs/utils/edit/isEditable.js +3 -3
  56. package/dist/cjs/utils/edit/maxLength.js +4 -4
  57. package/dist/cjs/utils/edit/setFiles.js +2 -2
  58. package/dist/cjs/utils/focus/cursor.js +1 -1
  59. package/dist/cjs/utils/focus/getActiveElement.js +2 -2
  60. package/dist/cjs/utils/index.js +1 -4
  61. package/dist/cjs/utils/keyDef/readNextDescriptor.js +6 -6
  62. package/dist/cjs/utils/misc/getWindow.js +1 -1
  63. package/dist/cjs/utils/misc/isDisabled.js +1 -1
  64. package/dist/cjs/utils/misc/isVisible.js +1 -1
  65. package/dist/cjs/utils/misc/level.js +4 -3
  66. package/dist/cjs/utils/pointer/cssPointerEvents.js +11 -11
  67. package/dist/esm/clipboard/copy.js +1 -7
  68. package/dist/esm/clipboard/cut.js +1 -7
  69. package/dist/esm/clipboard/paste.js +2 -8
  70. package/dist/esm/convenience/hover.js +0 -5
  71. package/dist/esm/document/UI.js +3 -3
  72. package/dist/esm/document/copySelection.js +0 -6
  73. package/dist/esm/document/getValueOrTextContent.js +0 -6
  74. package/dist/esm/document/interceptor.js +5 -11
  75. package/dist/esm/document/patchFocus.js +101 -0
  76. package/dist/esm/document/prepareDocument.js +1 -7
  77. package/dist/esm/document/trackValue.js +2 -8
  78. package/dist/esm/event/behavior/click.js +1 -7
  79. package/dist/esm/event/behavior/cut.js +0 -5
  80. package/dist/esm/event/behavior/keydown.js +3 -8
  81. package/dist/esm/event/behavior/keypress.js +2 -7
  82. package/dist/esm/event/behavior/keyup.js +1 -6
  83. package/dist/esm/event/behavior/paste.js +1 -6
  84. package/dist/esm/event/createEvent.js +34 -27
  85. package/dist/esm/event/dispatchEvent.js +1 -1
  86. package/dist/esm/event/eventMap.js +32 -0
  87. package/dist/esm/event/focus.js +5 -9
  88. package/dist/esm/event/index.js +0 -6
  89. package/dist/esm/event/input.js +2 -7
  90. package/dist/esm/event/radio.js +0 -6
  91. package/dist/esm/event/selection/getInputRange.js +1 -1
  92. package/dist/esm/event/selection/getTargetTypeAndSelection.js +2 -8
  93. package/dist/esm/event/selection/modifySelection.js +1 -7
  94. package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -8
  95. package/dist/esm/event/selection/moveSelection.js +1 -7
  96. package/dist/esm/event/selection/resolveCaretPosition.js +4 -10
  97. package/dist/esm/event/selection/selectAll.js +3 -9
  98. package/dist/esm/event/selection/setSelection.js +1 -7
  99. package/dist/esm/event/selection/setSelectionPerMouse.js +7 -13
  100. package/dist/esm/event/selection/setSelectionRange.js +1 -7
  101. package/dist/esm/event/selection/updateSelectionOnFocus.js +6 -8
  102. package/dist/esm/keyboard/index.js +0 -6
  103. package/dist/esm/keyboard/parseKeyDef.js +3 -8
  104. package/dist/esm/options.js +3 -3
  105. package/dist/esm/pointer/index.js +6 -11
  106. package/dist/esm/pointer/parseKeyDef.js +0 -5
  107. package/dist/esm/setup/setup.js +7 -7
  108. package/dist/esm/system/keyboard.js +46 -25
  109. package/dist/esm/system/pointer/index.js +18 -20
  110. package/dist/esm/system/pointer/mouse.js +8 -14
  111. package/dist/esm/system/pointer/pointer.js +4 -9
  112. package/dist/esm/system/pointer/shared.js +2 -2
  113. package/dist/esm/utility/clear.js +0 -5
  114. package/dist/esm/utility/selectOptions.js +1 -6
  115. package/dist/esm/utility/type.js +1 -7
  116. package/dist/esm/utility/upload.js +4 -10
  117. package/dist/esm/utils/click/isClickableInput.js +3 -3
  118. package/dist/esm/utils/dataTransfer/Clipboard.js +5 -6
  119. package/dist/esm/utils/dataTransfer/DataTransfer.js +6 -10
  120. package/dist/esm/utils/edit/isEditable.js +3 -3
  121. package/dist/esm/utils/edit/maxLength.js +4 -4
  122. package/dist/esm/utils/edit/setFiles.js +2 -2
  123. package/dist/esm/utils/focus/cursor.js +1 -1
  124. package/dist/esm/utils/focus/getActiveElement.js +2 -2
  125. package/dist/esm/utils/keyDef/readNextDescriptor.js +6 -6
  126. package/dist/esm/utils/misc/getWindow.js +1 -1
  127. package/dist/esm/utils/misc/isDisabled.js +1 -1
  128. package/dist/esm/utils/misc/isVisible.js +1 -1
  129. package/dist/esm/utils/misc/level.js +3 -3
  130. package/dist/esm/utils/pointer/cssPointerEvents.js +11 -11
  131. package/dist/types/document/patchFocus.d.ts +9 -0
  132. package/dist/types/event/eventMap.d.ts +32 -0
  133. package/dist/types/event/types.d.ts +1 -1
  134. package/dist/types/system/keyboard.d.ts +1 -4
  135. package/dist/types/utils/dataTransfer/DataTransfer.d.ts +1 -1
  136. package/package.json +3 -3
@@ -1,19 +1,17 @@
1
- import '../../utils/click/isClickableInput.js';
2
1
  import '../../utils/dataTransfer/Clipboard.js';
3
2
  import { getContentEditable } from '../../utils/edit/isContentEditable.js';
4
- import '../../utils/edit/isEditable.js';
5
- import '../../utils/edit/maxLength.js';
6
3
  import { hasOwnSelection } from '../../utils/focus/selection.js';
7
- import '../../utils/keyDef/readNextDescriptor.js';
8
- import '../../utils/misc/level.js';
9
- import '../../options.js';
10
4
 
5
+ // The browser implementation seems to have changed.
6
+ // When focus is inside <input type="text"/>,
7
+ // Chrome updates Selection to be collapsed at the position of the input element.
8
+ // TODO: update implementation to match that of current browsers
11
9
  /**
12
10
  * Reset the Document Selection when moving focus into an element
13
11
  * with own selection implementation.
14
12
  */ function updateSelectionOnFocus(element) {
15
13
  const selection = element.ownerDocument.getSelection();
16
- /* istanbul ignore if */ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
14
+ /* istanbul ignore if */ if (!(selection === null || selection === undefined ? undefined : selection.focusNode)) {
17
15
  return;
18
16
  }
19
17
  // If the focus moves inside an element with own selection implementation,
@@ -28,7 +26,7 @@ import '../../options.js';
28
26
  if (contenteditable) {
29
27
  if (!selection.isCollapsed) {
30
28
  var _contenteditable_firstChild;
31
- const focusNode = ((_contenteditable_firstChild = contenteditable.firstChild) === null || _contenteditable_firstChild === void 0 ? void 0 : _contenteditable_firstChild.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
29
+ const focusNode = ((_contenteditable_firstChild = contenteditable.firstChild) === null || _contenteditable_firstChild === undefined ? undefined : _contenteditable_firstChild.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
32
30
  selection.setBaseAndExtent(focusNode, 0, focusNode, 0);
33
31
  }
34
32
  } else {
@@ -1,11 +1,5 @@
1
- import '../utils/click/isClickableInput.js';
2
1
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../utils/edit/isEditable.js';
4
- import '../utils/edit/maxLength.js';
5
- import '../utils/keyDef/readNextDescriptor.js';
6
- import '../utils/misc/level.js';
7
2
  import { wait } from '../utils/misc/wait.js';
8
- import '../options.js';
9
3
  import { parseKeyDef } from './parseKeyDef.js';
10
4
 
11
5
  async function keyboard(text) {
@@ -1,10 +1,5 @@
1
- import '../utils/click/isClickableInput.js';
2
1
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../utils/edit/isEditable.js';
4
- import '../utils/edit/maxLength.js';
5
2
  import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
6
- import '../utils/misc/level.js';
7
- import '../options.js';
8
3
 
9
4
  /**
10
5
  * Parse key defintions per `keyboardMap`
@@ -23,13 +18,13 @@ import '../options.js';
23
18
  const keyDef = (_keyboardMap_find = keyboardMap.find((def)=>{
24
19
  if (type === '[') {
25
20
  var _def_code;
26
- return ((_def_code = def.code) === null || _def_code === void 0 ? void 0 : _def_code.toLowerCase()) === descriptor.toLowerCase();
21
+ return ((_def_code = def.code) === null || _def_code === undefined ? undefined : _def_code.toLowerCase()) === descriptor.toLowerCase();
27
22
  } else if (type === '{') {
28
23
  var _def_key;
29
- return ((_def_key = def.key) === null || _def_key === void 0 ? void 0 : _def_key.toLowerCase()) === descriptor.toLowerCase();
24
+ return ((_def_key = def.key) === null || _def_key === undefined ? undefined : _def_key.toLowerCase()) === descriptor.toLowerCase();
30
25
  }
31
26
  return def.key === descriptor;
32
- })) !== null && _keyboardMap_find !== void 0 ? _keyboardMap_find : {
27
+ })) !== null && _keyboardMap_find !== undefined ? _keyboardMap_find : {
33
28
  key: 'Unknown',
34
29
  code: 'Unknown',
35
30
  [type === '[' ? 'code' : 'key']: descriptor
@@ -1,5 +1,4 @@
1
- var PointerEventsCheckLevel;
2
- (function(PointerEventsCheckLevel) {
1
+ var PointerEventsCheckLevel = /*#__PURE__*/ function(PointerEventsCheckLevel) {
3
2
  /**
4
3
  * Check pointer events on every user interaction that triggers a bunch of events.
5
4
  * E.g. once for releasing a mouse button even though this triggers `pointerup`, `mouseup`, `click`, etc...
@@ -7,6 +6,7 @@ var PointerEventsCheckLevel;
7
6
  /** Check each target once per call to pointer (related) API */ PointerEventsCheckLevel[PointerEventsCheckLevel["EachApiCall"] = 2] = "EachApiCall";
8
7
  /** Check each event target once */ PointerEventsCheckLevel[PointerEventsCheckLevel["EachTarget"] = 1] = "EachTarget";
9
8
  /** No pointer events check */ PointerEventsCheckLevel[PointerEventsCheckLevel["Never"] = 0] = "Never";
10
- })(PointerEventsCheckLevel || (PointerEventsCheckLevel = {}));
9
+ return PointerEventsCheckLevel;
10
+ }({});
11
11
 
12
12
  export { PointerEventsCheckLevel };
@@ -1,11 +1,6 @@
1
- import '../utils/click/isClickableInput.js';
2
1
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../utils/edit/isEditable.js';
4
- import '../utils/edit/maxLength.js';
5
- import '../utils/keyDef/readNextDescriptor.js';
6
2
  import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
7
3
  import { wait } from '../utils/misc/wait.js';
8
- import '../options.js';
9
4
  import { parseKeyDef } from './parseKeyDef.js';
10
5
 
11
6
  async function pointer(input) {
@@ -37,11 +32,11 @@ async function pointerAction(instance, action) {
37
32
  const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
38
33
  var _action_target, _action_coords, _action_node, _action_offset;
39
34
  const position = {
40
- target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
41
- coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
35
+ target: (_action_target = action.target) !== null && _action_target !== undefined ? _action_target : getPrevTarget(instance, previousPosition),
36
+ coords: (_action_coords = action.coords) !== null && _action_coords !== undefined ? _action_coords : previousPosition === null || previousPosition === undefined ? undefined : previousPosition.coords,
42
37
  caret: {
43
- node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
44
- offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
38
+ node: (_action_node = action.node) !== null && _action_node !== undefined ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === undefined ? undefined : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === undefined ? undefined : _previousPosition_caret.node,
39
+ offset: (_action_offset = action.offset) !== null && _action_offset !== undefined ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === undefined ? undefined : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === undefined ? undefined : _previousPosition_caret1.offset
45
40
  }
46
41
  };
47
42
  if ('keyDef' in action) {
@@ -64,14 +59,14 @@ async function pointerAction(instance, action) {
64
59
  }
65
60
  function hasCaretPosition(action) {
66
61
  var _action_target, _ref;
67
- return !!((_ref = (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : action.node) !== null && _ref !== void 0 ? _ref : action.offset !== undefined);
62
+ return !!((_ref = (_action_target = action.target) !== null && _action_target !== undefined ? _action_target : action.node) !== null && _ref !== undefined ? _ref : action.offset !== undefined);
68
63
  }
69
64
  function getPrevTarget(instance, position) {
70
65
  if (!position) {
71
66
  throw new Error('This pointer has no previous position. Provide a target property!');
72
67
  }
73
68
  var _position_target;
74
- return (_position_target = position.target) !== null && _position_target !== void 0 ? _position_target : instance.config.document.body;
69
+ return (_position_target = position.target) !== null && _position_target !== undefined ? _position_target : instance.config.document.body;
75
70
  }
76
71
 
77
72
  export { pointer };
@@ -1,10 +1,5 @@
1
- import '../utils/click/isClickableInput.js';
2
1
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../utils/edit/isEditable.js';
4
- import '../utils/edit/maxLength.js';
5
2
  import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
6
- import '../utils/misc/level.js';
7
- import '../options.js';
8
3
 
9
4
  function parseKeyDef(pointerMap, keys) {
10
5
  const defs = [];
@@ -1,10 +1,8 @@
1
+ import { patchFocus } from '../document/patchFocus.js';
1
2
  import { prepareDocument } from '../document/prepareDocument.js';
2
3
  import { dispatchEvent, dispatchUIEvent } from '../event/dispatchEvent.js';
3
- import '../utils/click/isClickableInput.js';
4
4
  import { attachClipboardStubToView } from '../utils/dataTransfer/Clipboard.js';
5
- import '../utils/edit/isEditable.js';
6
- import '../utils/edit/maxLength.js';
7
- import '../utils/keyDef/readNextDescriptor.js';
5
+ import { getWindow } from '../utils/misc/getWindow.js';
8
6
  import { getDocumentFromNode } from '../utils/misc/getDocumentFromNode.js';
9
7
  import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
10
8
  import { wait } from '../utils/misc/wait.js';
@@ -52,8 +50,9 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
52
50
  */ function setupMain(options = {}) {
53
51
  const config = createConfig(options);
54
52
  prepareDocument(config.document);
53
+ patchFocus(getWindow(config.document).HTMLElement);
55
54
  var _config_document_defaultView;
56
- const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== void 0 ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
55
+ const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== undefined ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
57
56
  attachClipboardStubToView(view);
58
57
  return createInstance(config).api;
59
58
  }
@@ -62,8 +61,9 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
62
61
  */ function setupDirect({ keyboardState, pointerState, ...options } = {}, node) {
63
62
  const config = createConfig(options, defaultOptionsDirect, node);
64
63
  prepareDocument(config.document);
64
+ patchFocus(getWindow(config.document).HTMLElement);
65
65
  var _ref;
66
- const system = (_ref = pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState) !== null && _ref !== void 0 ? _ref : new System();
66
+ const system = (_ref = pointerState !== null && pointerState !== undefined ? pointerState : keyboardState) !== null && _ref !== undefined ? _ref : new System();
67
67
  return {
68
68
  api: createInstance(config, system).api,
69
69
  system
@@ -113,7 +113,7 @@ function createInstance(config, system = new System()) {
113
113
  }
114
114
  function getDocument(options, node, defaults) {
115
115
  var _options_document, _ref;
116
- return (_ref = (_options_document = options.document) !== null && _options_document !== void 0 ? _options_document : node && getDocumentFromNode(node)) !== null && _ref !== void 0 ? _ref : defaults.document;
116
+ return (_ref = (_options_document = options.document) !== null && _options_document !== undefined ? _options_document : node && getDocumentFromNode(node)) !== null && _ref !== undefined ? _ref : defaults.document;
117
117
  }
118
118
 
119
119
  export { createConfig, createInstance, setupDirect, setupMain, setupSub };
@@ -1,11 +1,5 @@
1
- import '../utils/click/isClickableInput.js';
2
1
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../utils/edit/isEditable.js';
4
- import '../utils/edit/maxLength.js';
5
2
  import { getActiveElementOrBody } from '../utils/focus/getActiveElement.js';
6
- import '../utils/keyDef/readNextDescriptor.js';
7
- import '../utils/misc/level.js';
8
- import '../options.js';
9
3
 
10
4
  function _define_property(obj, key, value) {
11
5
  if (key in obj) {
@@ -20,13 +14,13 @@ function _define_property(obj, key, value) {
20
14
  }
21
15
  return obj;
22
16
  }
23
- var DOM_KEY_LOCATION;
24
- (function(DOM_KEY_LOCATION) {
17
+ var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
25
18
  DOM_KEY_LOCATION[DOM_KEY_LOCATION["STANDARD"] = 0] = "STANDARD";
26
19
  DOM_KEY_LOCATION[DOM_KEY_LOCATION["LEFT"] = 1] = "LEFT";
27
20
  DOM_KEY_LOCATION[DOM_KEY_LOCATION["RIGHT"] = 2] = "RIGHT";
28
21
  DOM_KEY_LOCATION[DOM_KEY_LOCATION["NUMPAD"] = 3] = "NUMPAD";
29
- })(DOM_KEY_LOCATION || (DOM_KEY_LOCATION = {}));
22
+ return DOM_KEY_LOCATION;
23
+ }({});
30
24
  const modifierKeys = [
31
25
  'Alt',
32
26
  'AltGraph',
@@ -51,23 +45,17 @@ function isModifierLock(key) {
51
45
  }
52
46
  class KeyboardHost {
53
47
  isKeyPressed(keyDef) {
54
- return !!this.pressed[String(keyDef.code)];
48
+ return this.pressed.has(String(keyDef.code));
55
49
  }
56
50
  getPressedKeys() {
57
- return Object.values(this.pressed).map((p)=>p.keyDef);
51
+ return this.pressed.values().map((p)=>p.keyDef);
58
52
  }
59
53
  /** Press a key */ async keydown(instance, keyDef) {
60
- var // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
61
- _this_pressed, _code, _this_pressed_code;
62
54
  const key = String(keyDef.key);
63
55
  const code = String(keyDef.code);
64
56
  const target = getActiveElementOrBody(instance.config.document);
65
57
  this.setKeydownTarget(target);
66
- var _;
67
- (_ = (_this_pressed = this.pressed)[_code = code]) !== null && _ !== void 0 ? _ : _this_pressed[_code] = {
68
- keyDef,
69
- unpreventedDefault: false
70
- };
58
+ this.pressed.add(code, keyDef);
71
59
  if (isModifierKey(key)) {
72
60
  this.modifiers[key] = true;
73
61
  }
@@ -79,7 +67,9 @@ class KeyboardHost {
79
67
  this.modifiers[key] = true;
80
68
  this.modifierLockStart[key] = true;
81
69
  }
82
- (_this_pressed_code = this.pressed[code]).unpreventedDefault || (_this_pressed_code.unpreventedDefault = unprevented);
70
+ if (unprevented) {
71
+ this.pressed.setUnprevented(code);
72
+ }
83
73
  if (unprevented && this.hasKeyPress(key)) {
84
74
  instance.dispatchUIEvent(getActiveElementOrBody(instance.config.document), 'keypress', {
85
75
  key,
@@ -91,10 +81,9 @@ class KeyboardHost {
91
81
  /** Release a key */ async keyup(instance, keyDef) {
92
82
  const key = String(keyDef.key);
93
83
  const code = String(keyDef.code);
94
- const unprevented = this.pressed[code].unpreventedDefault;
95
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
96
- delete this.pressed[code];
97
- if (isModifierKey(key) && !Object.values(this.pressed).find((p)=>p.keyDef.key === key)) {
84
+ const unprevented = this.pressed.isUnprevented(code);
85
+ this.pressed.delete(code);
86
+ if (isModifierKey(key) && !this.pressed.values().find((p)=>p.keyDef.key === key)) {
98
87
  this.modifiers[key] = false;
99
88
  }
100
89
  instance.dispatchUIEvent(getActiveElementOrBody(instance.config.document), 'keyup', {
@@ -119,7 +108,7 @@ class KeyboardHost {
119
108
  return (key.length === 1 || key === 'Enter') && !this.modifiers.Control && !this.modifiers.Alt;
120
109
  }
121
110
  constructor(system){
122
- _define_property(this, "system", void 0);
111
+ _define_property(this, "system", undefined);
123
112
  _define_property(this, "modifiers", {
124
113
  Alt: false,
125
114
  AltGraph: false,
@@ -134,7 +123,39 @@ class KeyboardHost {
134
123
  Symbol: false,
135
124
  SymbolLock: false
136
125
  });
137
- _define_property(this, "pressed", {});
126
+ _define_property(this, "pressed", new class {
127
+ add(code, keyDef) {
128
+ var _this_registry, _code;
129
+ var _;
130
+ (_ = (_this_registry = this.registry)[_code = code]) !== null && _ !== undefined ? _ : _this_registry[_code] = {
131
+ keyDef,
132
+ unpreventedDefault: false
133
+ };
134
+ }
135
+ has(code) {
136
+ return !!this.registry[code];
137
+ }
138
+ setUnprevented(code) {
139
+ const o = this.registry[code];
140
+ if (o) {
141
+ o.unpreventedDefault = true;
142
+ }
143
+ }
144
+ isUnprevented(code) {
145
+ var _this_registry_code;
146
+ return !!((_this_registry_code = this.registry[code]) === null || _this_registry_code === undefined ? undefined : _this_registry_code.unpreventedDefault);
147
+ }
148
+ delete(code) {
149
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
150
+ delete this.registry[code];
151
+ }
152
+ values() {
153
+ return Object.values(this.registry);
154
+ }
155
+ constructor(){
156
+ _define_property(this, "registry", {});
157
+ }
158
+ }());
138
159
  _define_property(this, "carryChar", '');
139
160
  _define_property(this, "lastKeydownTarget", undefined);
140
161
  _define_property(this, "modifierLockStart", {});
@@ -43,12 +43,12 @@ class PointerHost {
43
43
  // the order in which they interweave/follow on a user interaction depends on the implementation.
44
44
  const pointermove = pointer.move(instance, position);
45
45
  const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(instance, position);
46
- pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave();
47
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
48
- pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter();
49
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
50
- pointermove === null || pointermove === void 0 ? void 0 : pointermove.move();
51
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
46
+ pointermove === null || pointermove === undefined ? undefined : pointermove.leave();
47
+ mousemove === null || mousemove === undefined ? undefined : mousemove.leave();
48
+ pointermove === null || pointermove === undefined ? undefined : pointermove.enter();
49
+ mousemove === null || mousemove === undefined ? undefined : mousemove.enter();
50
+ pointermove === null || pointermove === undefined ? undefined : pointermove.move();
51
+ mousemove === null || mousemove === undefined ? undefined : mousemove.move();
52
52
  }
53
53
  async release(instance, keyDef, position) {
54
54
  const device = this.devices.get(keyDef.pointerType);
@@ -69,16 +69,16 @@ class PointerHost {
69
69
  if (!pointer.isPrevented) {
70
70
  if (pointer.pointerType === 'touch' && !pointer.isMultitouch) {
71
71
  const mousemove = this.mouse.move(instance, pointer.position);
72
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
73
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
74
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
72
+ mousemove === null || mousemove === undefined ? undefined : mousemove.leave();
73
+ mousemove === null || mousemove === undefined ? undefined : mousemove.enter();
74
+ mousemove === null || mousemove === undefined ? undefined : mousemove.move();
75
75
  this.mouse.down(instance, keyDef, pointer);
76
76
  }
77
77
  if (!pointer.isMultitouch) {
78
78
  const mousemove = this.mouse.move(instance, pointer.position);
79
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
80
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
81
- mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
79
+ mousemove === null || mousemove === undefined ? undefined : mousemove.leave();
80
+ mousemove === null || mousemove === undefined ? undefined : mousemove.enter();
81
+ mousemove === null || mousemove === undefined ? undefined : mousemove.move();
82
82
  this.mouse.up(instance, keyDef, pointer);
83
83
  }
84
84
  }
@@ -94,23 +94,21 @@ class PointerHost {
94
94
  }
95
95
  getMouseTarget(instance) {
96
96
  var _this_mouse_position_target;
97
- return (_this_mouse_position_target = this.mouse.position.target) !== null && _this_mouse_position_target !== void 0 ? _this_mouse_position_target : instance.config.document.body;
97
+ return (_this_mouse_position_target = this.mouse.position.target) !== null && _this_mouse_position_target !== undefined ? _this_mouse_position_target : instance.config.document.body;
98
98
  }
99
99
  setMousePosition(position) {
100
100
  this.mouse.position = position;
101
101
  this.pointers.get('mouse').position = position;
102
102
  }
103
103
  constructor(system){
104
- _define_property(this, "system", void 0);
105
- _define_property(this, "mouse", void 0);
106
- _define_property(this, "buttons", void 0);
104
+ _define_property(this, "system", undefined);
105
+ _define_property(this, "mouse", undefined);
106
+ _define_property(this, "buttons", undefined);
107
107
  _define_property(this, "devices", new class {
108
108
  get(k) {
109
- var // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
110
- _this_registry, _k;
109
+ var _this_registry, _k;
111
110
  var _;
112
- (_ = (_this_registry = this.registry)[_k = k]) !== null && _ !== void 0 ? _ : _this_registry[_k] = new Device();
113
- return this.registry[k];
111
+ return (_ = (_this_registry = this.registry)[_k = k]) !== null && _ !== undefined ? _ : _this_registry[_k] = new Device();
114
112
  }
115
113
  constructor(){
116
114
  _define_property(this, "registry", {});
@@ -5,15 +5,9 @@ import '../../event/behavior/keypress.js';
5
5
  import '../../event/behavior/keyup.js';
6
6
  import '../../event/behavior/paste.js';
7
7
  import '@testing-library/dom';
8
- import '../../utils/click/isClickableInput.js';
9
8
  import '../../utils/dataTransfer/Clipboard.js';
10
- import '../../utils/edit/isEditable.js';
11
- import '../../utils/edit/maxLength.js';
12
9
  import { isDisabled } from '../../utils/misc/isDisabled.js';
13
- import '../../utils/keyDef/readNextDescriptor.js';
14
10
  import { getTreeDiff } from '../../utils/misc/getTreeDiff.js';
15
- import '../../utils/misc/level.js';
16
- import '../../options.js';
17
11
  import { focusElement } from '../../event/focus.js';
18
12
  import { setSelectionPerMouseDown } from '../../event/selection/setSelectionPerMouse.js';
19
13
  import { modifySelectionPerMouseMove } from '../../event/selection/modifySelectionPerMouse.js';
@@ -131,7 +125,7 @@ function _define_property(obj, key, value) {
131
125
  }
132
126
  getTarget(instance) {
133
127
  var _this_position_target;
134
- return (_this_position_target = this.position.target) !== null && _this_position_target !== void 0 ? _this_position_target : instance.config.document.body;
128
+ return (_this_position_target = this.position.target) !== null && _this_position_target !== undefined ? _this_position_target : instance.config.document.body;
135
129
  }
136
130
  startSelecting(instance, clickCount) {
137
131
  var _this_position_caret, _this_position_caret1;
@@ -139,8 +133,8 @@ function _define_property(obj, key, value) {
139
133
  this.selecting = setSelectionPerMouseDown({
140
134
  document: instance.config.document,
141
135
  target: this.getTarget(instance),
142
- node: (_this_position_caret = this.position.caret) === null || _this_position_caret === void 0 ? void 0 : _this_position_caret.node,
143
- offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === void 0 ? void 0 : _this_position_caret1.offset,
136
+ node: (_this_position_caret = this.position.caret) === null || _this_position_caret === undefined ? undefined : _this_position_caret.node,
137
+ offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === undefined ? undefined : _this_position_caret1.offset,
144
138
  clickCount
145
139
  });
146
140
  }
@@ -152,8 +146,8 @@ function _define_property(obj, key, value) {
152
146
  modifySelectionPerMouseMove(this.selecting, {
153
147
  document: instance.config.document,
154
148
  target: this.getTarget(instance),
155
- node: (_this_position_caret = this.position.caret) === null || _this_position_caret === void 0 ? void 0 : _this_position_caret.node,
156
- offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === void 0 ? void 0 : _this_position_caret1.offset
149
+ node: (_this_position_caret = this.position.caret) === null || _this_position_caret === undefined ? undefined : _this_position_caret.node,
150
+ offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === undefined ? undefined : _this_position_caret1.offset
157
151
  });
158
152
  }
159
153
  endSelecting() {
@@ -162,7 +156,7 @@ function _define_property(obj, key, value) {
162
156
  constructor(){
163
157
  _define_property(this, "position", {});
164
158
  _define_property(this, "buttons", new Buttons());
165
- _define_property(this, "selecting", void 0);
159
+ _define_property(this, "selecting", undefined);
166
160
  _define_property(this, "buttonDownTarget", {});
167
161
  // According to spec the `detail` on click events should be the number
168
162
  // of *consecutive* clicks with a specific button.
@@ -185,11 +179,11 @@ function _define_property(obj, key, value) {
185
179
  getOnDown(button) {
186
180
  var _this_count_button;
187
181
  this.down = {
188
- [button]: (_this_count_button = this.count[button]) !== null && _this_count_button !== void 0 ? _this_count_button : 0
182
+ [button]: (_this_count_button = this.count[button]) !== null && _this_count_button !== undefined ? _this_count_button : 0
189
183
  };
190
184
  var _this_count_button1;
191
185
  this.count = {
192
- [button]: (_this_count_button1 = this.count[button]) !== null && _this_count_button1 !== void 0 ? _this_count_button1 : 0
186
+ [button]: (_this_count_button1 = this.count[button]) !== null && _this_count_button1 !== undefined ? _this_count_button1 : 0
193
187
  };
194
188
  return Number(this.count[button]) + 1;
195
189
  }
@@ -1,10 +1,5 @@
1
- import '../../utils/click/isClickableInput.js';
2
1
  import '../../utils/dataTransfer/Clipboard.js';
3
- import '../../utils/edit/isEditable.js';
4
- import '../../utils/edit/maxLength.js';
5
- import '../../utils/keyDef/readNextDescriptor.js';
6
2
  import { getTreeDiff } from '../../utils/misc/getTreeDiff.js';
7
- import '../../utils/misc/level.js';
8
3
  import { assertPointerEvents, hasPointerEvents } from '../../utils/pointer/cssPointerEvents.js';
9
4
  import { isDifferentPointerPosition } from './shared.js';
10
5
 
@@ -95,7 +90,7 @@ class Pointer {
95
90
  }
96
91
  getTarget(instance) {
97
92
  var _this_position_target;
98
- return (_this_position_target = this.position.target) !== null && _this_position_target !== void 0 ? _this_position_target : instance.config.document.body;
93
+ return (_this_position_target = this.position.target) !== null && _this_position_target !== undefined ? _this_position_target : instance.config.document.body;
99
94
  }
100
95
  getEventInit() {
101
96
  return {
@@ -106,9 +101,9 @@ class Pointer {
106
101
  };
107
102
  }
108
103
  constructor({ pointerId, pointerType, isPrimary }){
109
- _define_property(this, "pointerId", void 0);
110
- _define_property(this, "pointerType", void 0);
111
- _define_property(this, "isPrimary", void 0);
104
+ _define_property(this, "pointerId", undefined);
105
+ _define_property(this, "pointerType", undefined);
106
+ _define_property(this, "isPrimary", undefined);
112
107
  _define_property(this, "isMultitouch", false);
113
108
  _define_property(this, "isCancelled", false);
114
109
  _define_property(this, "isDown", false);
@@ -1,6 +1,6 @@
1
1
  function isDifferentPointerPosition(positionA, positionB) {
2
- var _positionA_coords, _positionB_coords, _positionA_coords1, _positionB_coords1, _positionA_caret, _positionB_caret, _positionA_caret1, _positionB_caret1;
3
- return positionA.target !== positionB.target || ((_positionA_coords = positionA.coords) === null || _positionA_coords === void 0 ? void 0 : _positionA_coords.x) !== ((_positionB_coords = positionB.coords) === null || _positionB_coords === void 0 ? void 0 : _positionB_coords.y) || ((_positionA_coords1 = positionA.coords) === null || _positionA_coords1 === void 0 ? void 0 : _positionA_coords1.y) !== ((_positionB_coords1 = positionB.coords) === null || _positionB_coords1 === void 0 ? void 0 : _positionB_coords1.y) || ((_positionA_caret = positionA.caret) === null || _positionA_caret === void 0 ? void 0 : _positionA_caret.node) !== ((_positionB_caret = positionB.caret) === null || _positionB_caret === void 0 ? void 0 : _positionB_caret.node) || ((_positionA_caret1 = positionA.caret) === null || _positionA_caret1 === void 0 ? void 0 : _positionA_caret1.offset) !== ((_positionB_caret1 = positionB.caret) === null || _positionB_caret1 === void 0 ? void 0 : _positionB_caret1.offset);
2
+ var _positionA_coords, _positionB_coords, _positionA_coords1, _positionB_coords1, _positionA_coords2, _positionB_coords2, _positionA_coords3, _positionB_coords3, _positionA_coords4, _positionB_coords4, _positionA_coords5, _positionB_coords5, _positionA_coords6, _positionB_coords6, _positionA_coords7, _positionB_coords7, _positionA_coords8, _positionB_coords8, _positionA_coords9, _positionB_coords9, _positionA_caret, _positionB_caret, _positionA_caret1, _positionB_caret1;
3
+ return positionA.target !== positionB.target || ((_positionA_coords = positionA.coords) === null || _positionA_coords === undefined ? undefined : _positionA_coords.x) !== ((_positionB_coords = positionB.coords) === null || _positionB_coords === undefined ? undefined : _positionB_coords.x) || ((_positionA_coords1 = positionA.coords) === null || _positionA_coords1 === undefined ? undefined : _positionA_coords1.y) !== ((_positionB_coords1 = positionB.coords) === null || _positionB_coords1 === undefined ? undefined : _positionB_coords1.y) || ((_positionA_coords2 = positionA.coords) === null || _positionA_coords2 === undefined ? undefined : _positionA_coords2.clientX) !== ((_positionB_coords2 = positionB.coords) === null || _positionB_coords2 === undefined ? undefined : _positionB_coords2.clientX) || ((_positionA_coords3 = positionA.coords) === null || _positionA_coords3 === undefined ? undefined : _positionA_coords3.clientY) !== ((_positionB_coords3 = positionB.coords) === null || _positionB_coords3 === undefined ? undefined : _positionB_coords3.clientY) || ((_positionA_coords4 = positionA.coords) === null || _positionA_coords4 === undefined ? undefined : _positionA_coords4.offsetX) !== ((_positionB_coords4 = positionB.coords) === null || _positionB_coords4 === undefined ? undefined : _positionB_coords4.offsetX) || ((_positionA_coords5 = positionA.coords) === null || _positionA_coords5 === undefined ? undefined : _positionA_coords5.offsetY) !== ((_positionB_coords5 = positionB.coords) === null || _positionB_coords5 === undefined ? undefined : _positionB_coords5.offsetY) || ((_positionA_coords6 = positionA.coords) === null || _positionA_coords6 === undefined ? undefined : _positionA_coords6.pageX) !== ((_positionB_coords6 = positionB.coords) === null || _positionB_coords6 === undefined ? undefined : _positionB_coords6.pageX) || ((_positionA_coords7 = positionA.coords) === null || _positionA_coords7 === undefined ? undefined : _positionA_coords7.pageY) !== ((_positionB_coords7 = positionB.coords) === null || _positionB_coords7 === undefined ? undefined : _positionB_coords7.pageY) || ((_positionA_coords8 = positionA.coords) === null || _positionA_coords8 === undefined ? undefined : _positionA_coords8.screenX) !== ((_positionB_coords8 = positionB.coords) === null || _positionB_coords8 === undefined ? undefined : _positionB_coords8.screenX) || ((_positionA_coords9 = positionA.coords) === null || _positionA_coords9 === undefined ? undefined : _positionA_coords9.screenY) !== ((_positionB_coords9 = positionB.coords) === null || _positionB_coords9 === undefined ? undefined : _positionB_coords9.screenY) || ((_positionA_caret = positionA.caret) === null || _positionA_caret === undefined ? undefined : _positionA_caret.node) !== ((_positionB_caret = positionB.caret) === null || _positionB_caret === undefined ? undefined : _positionB_caret.node) || ((_positionA_caret1 = positionA.caret) === null || _positionA_caret1 === undefined ? undefined : _positionA_caret1.offset) !== ((_positionB_caret1 = positionB.caret) === null || _positionB_caret1 === undefined ? undefined : _positionB_caret1.offset);
4
4
  }
5
5
 
6
6
  export { isDifferentPointerPosition };
@@ -5,14 +5,9 @@ import '../event/behavior/keypress.js';
5
5
  import '../event/behavior/keyup.js';
6
6
  import '../event/behavior/paste.js';
7
7
  import '@testing-library/dom';
8
- import '../utils/click/isClickableInput.js';
9
8
  import '../utils/dataTransfer/Clipboard.js';
10
9
  import { isEditable } from '../utils/edit/isEditable.js';
11
- import '../utils/edit/maxLength.js';
12
10
  import { isDisabled } from '../utils/misc/isDisabled.js';
13
- import '../utils/keyDef/readNextDescriptor.js';
14
- import '../utils/misc/level.js';
15
- import '../options.js';
16
11
  import { focusElement } from '../event/focus.js';
17
12
  import { input } from '../event/input.js';
18
13
  import { selectAll, isAllSelected } from '../event/selection/selectAll.js';
@@ -1,12 +1,7 @@
1
1
  import { getConfig } from '@testing-library/dom';
2
- import '../utils/click/isClickableInput.js';
3
- import '../utils/dataTransfer/Clipboard.js';
4
- import '../utils/edit/isEditable.js';
5
- import '../utils/edit/maxLength.js';
6
2
  import { isElementType } from '../utils/misc/isElementType.js';
3
+ import '../utils/dataTransfer/Clipboard.js';
7
4
  import { isDisabled } from '../utils/misc/isDisabled.js';
8
- import '../utils/keyDef/readNextDescriptor.js';
9
- import '../utils/misc/level.js';
10
5
  import { wait } from '../utils/misc/wait.js';
11
6
  import { hasPointerEvents } from '../utils/pointer/cssPointerEvents.js';
12
7
  import '../event/behavior/click.js';
@@ -1,11 +1,5 @@
1
1
  import { releaseAllKeys } from '../keyboard/index.js';
2
- import '../utils/click/isClickableInput.js';
3
2
  import '../utils/dataTransfer/Clipboard.js';
4
- import '../utils/edit/isEditable.js';
5
- import '../utils/edit/maxLength.js';
6
- import '../utils/keyDef/readNextDescriptor.js';
7
- import '../utils/misc/level.js';
8
- import '../options.js';
9
3
  import { setSelectionRange } from '../event/selection/setSelectionRange.js';
10
4
 
11
5
  async function type(element, text, { skipClick = this.config.skipClick, skipAutoClose = this.config.skipAutoClose, initialSelectionStart, initialSelectionEnd } = {}) {
@@ -16,7 +10,7 @@ async function type(element, text, { skipClick = this.config.skipClick, skipAuto
16
10
  await this.click(element);
17
11
  }
18
12
  if (initialSelectionStart !== undefined) {
19
- setSelectionRange(element, initialSelectionStart, initialSelectionEnd !== null && initialSelectionEnd !== void 0 ? initialSelectionEnd : initialSelectionStart);
13
+ setSelectionRange(element, initialSelectionStart, initialSelectionEnd !== null && initialSelectionEnd !== undefined ? initialSelectionEnd : initialSelectionStart);
20
14
  }
21
15
  await this.keyboard(text);
22
16
  if (!skipAutoClose) {
@@ -1,22 +1,16 @@
1
- import '../utils/click/isClickableInput.js';
1
+ import { isElementType } from '../utils/misc/isElementType.js';
2
2
  import { createFileList } from '../utils/dataTransfer/FileList.js';
3
3
  import '../utils/dataTransfer/Clipboard.js';
4
- import '../utils/edit/isEditable.js';
5
- import '../utils/edit/maxLength.js';
6
4
  import { setFiles } from '../utils/edit/setFiles.js';
7
- import { isElementType } from '../utils/misc/isElementType.js';
8
5
  import { isDisabled } from '../utils/misc/isDisabled.js';
9
6
  import { getWindow } from '../utils/misc/getWindow.js';
10
- import '../utils/keyDef/readNextDescriptor.js';
11
- import '../utils/misc/level.js';
12
- import '../options.js';
13
7
 
14
8
  async function upload(element, fileOrFiles) {
15
9
  const input = isElementType(element, 'label') ? element.control : element;
16
10
  if (!input || !isElementType(input, 'input', {
17
11
  type: 'file'
18
12
  })) {
19
- throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`);
13
+ throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === undefined ? undefined : input.tagName} element does not accept file uploads`);
20
14
  }
21
15
  if (isDisabled(element)) return;
22
16
  const files = (Array.isArray(fileOrFiles) ? fileOrFiles : [
@@ -25,9 +19,9 @@ async function upload(element, fileOrFiles) {
25
19
  const fileDialog = ()=>{
26
20
  var _input_files;
27
21
  // do not fire an input event if the file selection does not change
28
- if (files.length === ((_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files.length) && files.every((f, i)=>{
22
+ if (files.length === ((_input_files = input.files) === null || _input_files === undefined ? undefined : _input_files.length) && files.every((f, i)=>{
29
23
  var _input_files;
30
- return f === ((_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files.item(i));
24
+ return f === ((_input_files = input.files) === null || _input_files === undefined ? undefined : _input_files.item(i));
31
25
  })) {
32
26
  return;
33
27
  }
@@ -1,7 +1,6 @@
1
1
  import { isElementType } from '../misc/isElementType.js';
2
2
 
3
- var clickableInputTypes;
4
- (function(clickableInputTypes) {
3
+ var clickableInputTypes = /*#__PURE__*/ function(clickableInputTypes) {
5
4
  clickableInputTypes["button"] = "button";
6
5
  clickableInputTypes["color"] = "color";
7
6
  clickableInputTypes["file"] = "file";
@@ -10,7 +9,8 @@ var clickableInputTypes;
10
9
  clickableInputTypes["submit"] = "submit";
11
10
  clickableInputTypes["checkbox"] = "checkbox";
12
11
  clickableInputTypes["radio"] = "radio";
13
- })(clickableInputTypes || (clickableInputTypes = {}));
12
+ return clickableInputTypes;
13
+ }(clickableInputTypes || {});
14
14
  function isClickableInput(element) {
15
15
  return isElementType(element, 'button') || isElementType(element, 'input') && element.type in clickableInputTypes;
16
16
  }