@testing-library/user-event 14.4.2 → 14.5.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 (276) hide show
  1. package/dist/cjs/_interop/dtl.js +30 -0
  2. package/dist/cjs/_interop/dtlEventMap.js +30 -0
  3. package/dist/cjs/_interop/dtlHelpers.js +30 -0
  4. package/dist/cjs/clipboard/copy.js +6 -16
  5. package/dist/cjs/clipboard/cut.js +6 -16
  6. package/dist/cjs/clipboard/paste.js +6 -16
  7. package/dist/cjs/convenience/click.js +1 -4
  8. package/dist/cjs/convenience/hover.js +2 -12
  9. package/dist/cjs/convenience/tab.js +1 -1
  10. package/dist/cjs/document/UI.js +94 -0
  11. package/dist/cjs/document/copySelection.js +37 -0
  12. package/dist/cjs/document/getValueOrTextContent.js +27 -0
  13. package/dist/cjs/document/index.js +13 -68
  14. package/dist/cjs/document/interceptor.js +89 -4
  15. package/dist/cjs/document/prepareDocument.js +67 -0
  16. package/dist/cjs/document/trackValue.js +65 -0
  17. package/dist/cjs/event/behavior/click.js +8 -12
  18. package/dist/cjs/event/behavior/cut.js +5 -11
  19. package/dist/cjs/event/behavior/keydown.js +43 -47
  20. package/dist/cjs/event/behavior/keypress.js +12 -12
  21. package/dist/cjs/event/behavior/keyup.js +6 -8
  22. package/dist/cjs/event/behavior/paste.js +7 -13
  23. package/dist/cjs/event/createEvent.js +43 -50
  24. package/dist/cjs/event/dispatchEvent.js +21 -3
  25. package/dist/cjs/event/eventMap.js +2 -2
  26. package/dist/cjs/event/focus.js +44 -0
  27. package/dist/cjs/event/index.js +24 -17
  28. package/dist/cjs/{utils/edit → event}/input.js +52 -50
  29. package/dist/cjs/{utils/edit/walkRadio.js → event/radio.js} +13 -7
  30. package/dist/cjs/event/selection/getInputRange.js +20 -0
  31. package/dist/cjs/event/selection/getTargetTypeAndSelection.js +41 -0
  32. package/dist/cjs/event/selection/index.js +26 -0
  33. package/dist/cjs/event/selection/modifySelection.js +30 -0
  34. package/dist/cjs/event/selection/modifySelectionPerMouse.js +50 -0
  35. package/dist/cjs/event/selection/moveSelection.js +48 -0
  36. package/dist/cjs/{utils/focus → event/selection}/resolveCaretPosition.js +10 -18
  37. package/dist/cjs/event/selection/selectAll.js +48 -0
  38. package/dist/cjs/event/selection/setSelection.js +30 -0
  39. package/dist/cjs/event/selection/setSelectionPerMouse.js +91 -0
  40. package/dist/cjs/event/selection/setSelectionRange.js +40 -0
  41. package/dist/cjs/event/selection/updateSelectionOnFocus.js +46 -0
  42. package/dist/cjs/event/wrapEvent.js +3 -2
  43. package/dist/cjs/index.js +1 -0
  44. package/dist/cjs/keyboard/index.js +13 -23
  45. package/dist/cjs/keyboard/parseKeyDef.js +9 -17
  46. package/dist/cjs/options.js +0 -28
  47. package/dist/cjs/pointer/index.js +28 -38
  48. package/dist/cjs/pointer/keyMap.js +1 -1
  49. package/dist/cjs/pointer/parseKeyDef.js +2 -10
  50. package/dist/cjs/setup/api.js +19 -17
  51. package/dist/cjs/setup/directApi.js +6 -6
  52. package/dist/cjs/setup/index.js +0 -2
  53. package/dist/cjs/setup/setup.js +70 -42
  54. package/dist/cjs/setup/wrapAsync.js +3 -2
  55. package/dist/cjs/system/index.js +15 -2
  56. package/dist/cjs/system/keyboard.js +34 -21
  57. package/dist/cjs/system/pointer/buttons.js +14 -1
  58. package/dist/cjs/system/pointer/device.js +14 -1
  59. package/dist/cjs/system/pointer/index.js +60 -45
  60. package/dist/cjs/system/pointer/mouse.js +77 -56
  61. package/dist/cjs/system/pointer/pointer.js +56 -42
  62. package/dist/cjs/system/pointer/shared.js +10 -0
  63. package/dist/cjs/utility/clear.js +10 -11
  64. package/dist/cjs/utility/selectOptions.js +28 -29
  65. package/dist/cjs/utility/type.js +6 -15
  66. package/dist/cjs/utility/upload.js +9 -18
  67. package/dist/cjs/utils/dataTransfer/Clipboard.js +26 -24
  68. package/dist/cjs/utils/dataTransfer/DataTransfer.js +25 -9
  69. package/dist/cjs/utils/edit/isEditable.js +6 -10
  70. package/dist/cjs/utils/edit/maxLength.js +6 -17
  71. package/dist/cjs/utils/edit/setFiles.js +4 -4
  72. package/dist/cjs/utils/edit/{buildTimeValue.js → timeValue.js} +6 -0
  73. package/dist/cjs/utils/focus/cursor.js +2 -18
  74. package/dist/cjs/utils/focus/getActiveElement.js +4 -3
  75. package/dist/cjs/utils/focus/selection.js +1 -271
  76. package/dist/cjs/utils/focus/selector.js +1 -1
  77. package/dist/cjs/utils/index.js +7 -32
  78. package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
  79. package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
  80. package/dist/cjs/utils/misc/getWindow.js +3 -2
  81. package/dist/cjs/utils/misc/isDisabled.js +3 -3
  82. package/dist/cjs/utils/misc/isVisible.js +3 -2
  83. package/dist/cjs/utils/misc/level.js +4 -9
  84. package/dist/cjs/utils/misc/wait.js +1 -1
  85. package/dist/cjs/utils/pointer/cssPointerEvents.js +31 -40
  86. package/dist/esm/_interop/dtl.js +6 -0
  87. package/dist/esm/_interop/dtlEventMap.js +6 -0
  88. package/dist/esm/_interop/dtlHelpers.js +6 -0
  89. package/dist/esm/clipboard/copy.js +6 -16
  90. package/dist/esm/clipboard/cut.js +6 -16
  91. package/dist/esm/clipboard/paste.js +6 -16
  92. package/dist/esm/convenience/click.js +1 -4
  93. package/dist/esm/convenience/hover.js +2 -12
  94. package/dist/esm/convenience/tab.js +1 -1
  95. package/dist/esm/document/UI.js +79 -0
  96. package/dist/esm/document/copySelection.js +33 -0
  97. package/dist/esm/document/getValueOrTextContent.js +23 -0
  98. package/dist/esm/document/index.js +4 -66
  99. package/dist/esm/document/interceptor.js +87 -5
  100. package/dist/esm/document/prepareDocument.js +63 -0
  101. package/dist/esm/document/trackValue.js +59 -0
  102. package/dist/esm/event/behavior/click.js +8 -12
  103. package/dist/esm/event/behavior/cut.js +5 -11
  104. package/dist/esm/event/behavior/keydown.js +36 -40
  105. package/dist/esm/event/behavior/keypress.js +12 -12
  106. package/dist/esm/event/behavior/keyup.js +6 -8
  107. package/dist/esm/event/behavior/paste.js +7 -13
  108. package/dist/esm/event/createEvent.js +43 -50
  109. package/dist/esm/event/dispatchEvent.js +20 -4
  110. package/dist/esm/event/eventMap.js +2 -2
  111. package/dist/esm/event/focus.js +39 -0
  112. package/dist/esm/event/index.js +14 -19
  113. package/dist/esm/{utils/edit → event}/input.js +39 -37
  114. package/dist/esm/{utils/edit/walkRadio.js → event/radio.js} +13 -7
  115. package/dist/esm/event/selection/getInputRange.js +16 -0
  116. package/dist/esm/event/selection/getTargetTypeAndSelection.js +37 -0
  117. package/dist/esm/event/selection/index.js +9 -0
  118. package/dist/esm/event/selection/modifySelection.js +26 -0
  119. package/dist/esm/event/selection/modifySelectionPerMouse.js +46 -0
  120. package/dist/esm/event/selection/moveSelection.js +44 -0
  121. package/dist/esm/{utils/focus → event/selection}/resolveCaretPosition.js +9 -17
  122. package/dist/esm/event/selection/selectAll.js +43 -0
  123. package/dist/esm/event/selection/setSelection.js +26 -0
  124. package/dist/esm/event/selection/setSelectionPerMouse.js +87 -0
  125. package/dist/esm/event/selection/setSelectionRange.js +36 -0
  126. package/dist/esm/event/selection/updateSelectionOnFocus.js +42 -0
  127. package/dist/esm/event/wrapEvent.js +2 -1
  128. package/dist/esm/index.js +1 -1
  129. package/dist/esm/keyboard/index.js +13 -23
  130. package/dist/esm/keyboard/parseKeyDef.js +9 -17
  131. package/dist/esm/options.js +1 -26
  132. package/dist/esm/pointer/index.js +28 -38
  133. package/dist/esm/pointer/keyMap.js +1 -1
  134. package/dist/esm/pointer/parseKeyDef.js +2 -10
  135. package/dist/esm/setup/api.js +33 -12
  136. package/dist/esm/setup/directApi.js +6 -6
  137. package/dist/esm/setup/index.js +0 -1
  138. package/dist/esm/setup/setup.js +66 -39
  139. package/dist/esm/setup/wrapAsync.js +2 -1
  140. package/dist/esm/system/index.js +15 -2
  141. package/dist/esm/system/keyboard.js +34 -21
  142. package/dist/esm/system/pointer/buttons.js +14 -1
  143. package/dist/esm/system/pointer/device.js +14 -1
  144. package/dist/esm/system/pointer/index.js +61 -45
  145. package/dist/esm/system/pointer/mouse.js +74 -53
  146. package/dist/esm/system/pointer/pointer.js +55 -41
  147. package/dist/esm/system/pointer/shared.js +6 -0
  148. package/dist/esm/utility/clear.js +10 -11
  149. package/dist/esm/utility/selectOptions.js +24 -25
  150. package/dist/esm/utility/type.js +5 -14
  151. package/dist/esm/utility/upload.js +9 -18
  152. package/dist/esm/utils/dataTransfer/Clipboard.js +26 -24
  153. package/dist/esm/utils/dataTransfer/DataTransfer.js +25 -9
  154. package/dist/esm/utils/edit/isEditable.js +4 -8
  155. package/dist/esm/utils/edit/maxLength.js +5 -17
  156. package/dist/esm/utils/edit/setFiles.js +4 -4
  157. package/dist/esm/utils/edit/{buildTimeValue.js → timeValue.js} +6 -1
  158. package/dist/esm/utils/focus/cursor.js +2 -18
  159. package/dist/esm/utils/focus/getActiveElement.js +4 -3
  160. package/dist/esm/utils/focus/selection.js +3 -265
  161. package/dist/esm/utils/focus/selector.js +1 -1
  162. package/dist/esm/utils/index.js +4 -11
  163. package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
  164. package/dist/esm/utils/misc/getTreeDiff.js +3 -3
  165. package/dist/esm/utils/misc/getWindow.js +2 -1
  166. package/dist/esm/utils/misc/isDisabled.js +3 -3
  167. package/dist/esm/utils/misc/isVisible.js +3 -2
  168. package/dist/esm/utils/misc/level.js +4 -9
  169. package/dist/esm/utils/misc/wait.js +1 -1
  170. package/dist/esm/utils/pointer/cssPointerEvents.js +31 -40
  171. package/dist/types/_interop/dtl.d.ts +3 -0
  172. package/dist/types/_interop/dtlEventMap.d.ts +3 -0
  173. package/dist/types/_interop/dtlHelpers.d.ts +3 -0
  174. package/dist/types/clipboard/copy.d.ts +1 -1
  175. package/dist/types/clipboard/cut.d.ts +1 -1
  176. package/dist/types/clipboard/paste.d.ts +1 -1
  177. package/dist/types/convenience/click.d.ts +1 -1
  178. package/dist/types/convenience/hover.d.ts +1 -1
  179. package/dist/types/convenience/tab.d.ts +1 -1
  180. package/dist/types/document/UI.d.ts +42 -0
  181. package/dist/types/document/getValueOrTextContent.d.ts +1 -0
  182. package/dist/types/document/index.d.ts +5 -10
  183. package/dist/types/document/interceptor.d.ts +6 -3
  184. package/dist/types/document/prepareDocument.d.ts +8 -0
  185. package/dist/types/document/trackValue.d.ts +17 -0
  186. package/dist/types/event/behavior/registry.d.ts +2 -2
  187. package/dist/types/event/createEvent.d.ts +1 -1
  188. package/dist/types/event/dispatchEvent.d.ts +5 -2
  189. package/dist/types/event/eventMap.d.ts +8 -0
  190. package/dist/types/event/focus.d.ts +5 -0
  191. package/dist/types/event/index.d.ts +6 -4
  192. package/dist/types/event/input.d.ts +2 -0
  193. package/dist/types/event/radio.d.ts +4 -0
  194. package/dist/types/event/selection/getInputRange.d.ts +5 -0
  195. package/dist/types/event/selection/getTargetTypeAndSelection.d.ts +10 -0
  196. package/dist/types/event/selection/index.d.ts +15 -0
  197. package/dist/types/event/selection/modifySelection.d.ts +8 -0
  198. package/dist/types/event/selection/modifySelectionPerMouse.d.ts +7 -0
  199. package/dist/types/event/selection/moveSelection.d.ts +4 -0
  200. package/dist/types/event/selection/setSelection.d.ts +10 -0
  201. package/dist/types/event/selection/setSelectionPerMouse.d.ts +8 -0
  202. package/dist/types/event/selection/setSelectionRange.d.ts +6 -0
  203. package/dist/types/event/selection/updateSelectionOnFocus.d.ts +5 -0
  204. package/dist/types/event/types.d.ts +3 -3
  205. package/dist/types/index.d.ts +3 -1
  206. package/dist/types/keyboard/index.d.ts +2 -2
  207. package/dist/types/options.d.ts +2 -10
  208. package/dist/types/pointer/index.d.ts +7 -7
  209. package/dist/types/setup/api.d.ts +23 -5
  210. package/dist/types/setup/directApi.d.ts +5 -5
  211. package/dist/types/setup/index.d.ts +2 -15
  212. package/dist/types/setup/setup.d.ts +25 -7
  213. package/dist/types/system/keyboard.d.ts +4 -4
  214. package/dist/types/system/pointer/buttons.d.ts +2 -2
  215. package/dist/types/system/pointer/device.d.ts +1 -1
  216. package/dist/types/system/pointer/index.d.ts +7 -25
  217. package/dist/types/system/pointer/mouse.d.ts +6 -6
  218. package/dist/types/system/pointer/pointer.d.ts +8 -8
  219. package/dist/types/system/pointer/shared.d.ts +20 -0
  220. package/dist/types/utility/clear.d.ts +1 -1
  221. package/dist/types/utility/selectOptions.d.ts +1 -1
  222. package/dist/types/utility/type.d.ts +4 -4
  223. package/dist/types/utility/upload.d.ts +1 -1
  224. package/dist/types/utils/click/isClickableInput.d.ts +2 -2
  225. package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
  226. package/dist/types/utils/edit/isEditable.d.ts +6 -7
  227. package/dist/types/utils/edit/maxLength.d.ts +14 -1
  228. package/dist/types/utils/edit/{isValidDateOrTimeValue.d.ts → timeValue.d.ts} +1 -0
  229. package/dist/types/utils/focus/selection.d.ts +4 -69
  230. package/dist/types/utils/index.d.ts +2 -9
  231. package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
  232. package/dist/types/utils/misc/isElementType.d.ts +1 -1
  233. package/dist/types/utils/misc/level.d.ts +4 -13
  234. package/dist/types/utils/misc/wait.d.ts +2 -2
  235. package/dist/types/utils/pointer/cssPointerEvents.d.ts +4 -4
  236. package/package.json +24 -12
  237. package/dist/cjs/document/selection.js +0 -108
  238. package/dist/cjs/document/setRangeText.js +0 -21
  239. package/dist/cjs/document/value.js +0 -127
  240. package/dist/cjs/setup/config.js +0 -7
  241. package/dist/cjs/utils/edit/getValue.js +0 -35
  242. package/dist/cjs/utils/edit/isValidDateOrTimeValue.js +0 -11
  243. package/dist/cjs/utils/focus/blur.js +0 -16
  244. package/dist/cjs/utils/focus/copySelection.js +0 -46
  245. package/dist/cjs/utils/focus/focus.js +0 -29
  246. package/dist/cjs/utils/focus/selectAll.js +0 -56
  247. package/dist/cjs/utils/misc/eventWrapper.js +0 -15
  248. package/dist/esm/document/selection.js +0 -100
  249. package/dist/esm/document/setRangeText.js +0 -17
  250. package/dist/esm/document/value.js +0 -117
  251. package/dist/esm/setup/config.js +0 -3
  252. package/dist/esm/utils/edit/getValue.js +0 -31
  253. package/dist/esm/utils/edit/isValidDateOrTimeValue.js +0 -7
  254. package/dist/esm/utils/focus/blur.js +0 -12
  255. package/dist/esm/utils/focus/copySelection.js +0 -42
  256. package/dist/esm/utils/focus/focus.js +0 -25
  257. package/dist/esm/utils/focus/selectAll.js +0 -51
  258. package/dist/esm/utils/misc/eventWrapper.js +0 -11
  259. package/dist/types/document/selection.d.ts +0 -29
  260. package/dist/types/document/setRangeText.d.ts +0 -1
  261. package/dist/types/document/value.d.ts +0 -26
  262. package/dist/types/setup/config.d.ts +0 -6
  263. package/dist/types/utils/edit/buildTimeValue.d.ts +0 -1
  264. package/dist/types/utils/edit/getValue.d.ts +0 -1
  265. package/dist/types/utils/edit/input.d.ts +0 -2
  266. package/dist/types/utils/edit/walkRadio.d.ts +0 -4
  267. package/dist/types/utils/focus/blur.d.ts +0 -2
  268. package/dist/types/utils/focus/focus.d.ts +0 -5
  269. package/dist/types/utils/misc/eventWrapper.d.ts +0 -1
  270. /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
  271. /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
  272. /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
  273. /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
  274. /package/dist/types/{utils/focus → document}/copySelection.d.ts +0 -0
  275. /package/dist/types/{utils/focus → event/selection}/resolveCaretPosition.d.ts +0 -0
  276. /package/dist/types/{utils/focus → event/selection}/selectAll.d.ts +0 -0
@@ -0,0 +1,42 @@
1
+ import '../../utils/click/isClickableInput.js';
2
+ import '../../utils/dataTransfer/Clipboard.js';
3
+ import { getContentEditable } from '../../utils/edit/isContentEditable.js';
4
+ import '../../utils/edit/isEditable.js';
5
+ import '../../utils/edit/maxLength.js';
6
+ import '@testing-library/dom/dist/helpers.js';
7
+ import { hasOwnSelection } from '../../utils/focus/selection.js';
8
+ import '../../utils/keyDef/readNextDescriptor.js';
9
+ import '../../utils/misc/level.js';
10
+ import '../../options.js';
11
+
12
+ /**
13
+ * Reset the Document Selection when moving focus into an element
14
+ * with own selection implementation.
15
+ */ function updateSelectionOnFocus(element) {
16
+ var _selection;
17
+ const selection = element.ownerDocument.getSelection();
18
+ /* istanbul ignore if */ if (!((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.focusNode)) {
19
+ return;
20
+ }
21
+ // If the focus moves inside an element with own selection implementation,
22
+ // the document selection will be this element.
23
+ // But if the focused element is inside a contenteditable,
24
+ // 1) a collapsed selection will be retained.
25
+ // 2) other selections will be replaced by a cursor
26
+ // 2.a) at the start of the first child if it is a text node
27
+ // 2.b) at the start of the contenteditable.
28
+ if (hasOwnSelection(element)) {
29
+ const contenteditable = getContentEditable(selection.focusNode);
30
+ if (contenteditable) {
31
+ if (!selection.isCollapsed) {
32
+ var _contenteditable_firstChild;
33
+ const focusNode = ((_contenteditable_firstChild = contenteditable.firstChild) === null || _contenteditable_firstChild === void 0 ? void 0 : _contenteditable_firstChild.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
34
+ selection.setBaseAndExtent(focusNode, 0, focusNode, 0);
35
+ }
36
+ } else {
37
+ selection.setBaseAndExtent(element, 0, element, 0);
38
+ }
39
+ }
40
+ }
41
+
42
+ export { updateSelectionOnFocus };
@@ -1,5 +1,6 @@
1
- import { getConfig } from '@testing-library/dom';
1
+ import dtl from '../_interop/dtl.js';
2
2
 
3
+ const { getConfig } = dtl;
3
4
  function wrapEvent(cb, _element) {
4
5
  return getConfig().eventWrapper(cb);
5
6
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { userEvent as default } from './setup/index.js';
1
+ export { userEvent as default, userEvent } from './setup/index.js';
2
2
  export { PointerEventsCheckLevel } from './options.js';
@@ -1,53 +1,43 @@
1
- import '../setup/index.js';
2
1
  import '../utils/click/isClickableInput.js';
3
2
  import '../utils/dataTransfer/Clipboard.js';
4
- import '../event/eventMap.js';
5
- import '../event/behavior/click.js';
6
- import '../event/behavior/cut.js';
7
- import '../event/behavior/keydown.js';
8
- import '../event/behavior/keypress.js';
9
- import '../event/behavior/keyup.js';
10
- import '../event/behavior/paste.js';
11
- import '@testing-library/dom';
12
- import '../utils/edit/maxLength.js';
13
3
  import '../utils/edit/isEditable.js';
4
+ import '../utils/edit/maxLength.js';
14
5
  import '@testing-library/dom/dist/helpers.js';
15
6
  import '../utils/keyDef/readNextDescriptor.js';
16
7
  import '../utils/misc/level.js';
17
8
  import { wait } from '../utils/misc/wait.js';
18
9
  import '../options.js';
19
10
  import { parseKeyDef } from './parseKeyDef.js';
20
- import { Config } from '../setup/config.js';
21
11
 
22
12
  async function keyboard(text) {
23
- const actions = parseKeyDef(this[Config].keyboardMap, text);
13
+ const actions = parseKeyDef(this.config.keyboardMap, text);
24
14
  for(let i = 0; i < actions.length; i++){
25
- await wait(this[Config]);
26
- await keyboardAction(this[Config], actions[i]);
15
+ await wait(this.config);
16
+ await keyboardAction(this, actions[i]);
27
17
  }
28
18
  }
29
- async function keyboardAction(config, { keyDef , releasePrevious , releaseSelf , repeat }) {
30
- const { system } = config;
19
+ async function keyboardAction(instance, { keyDef, releasePrevious, releaseSelf, repeat }) {
20
+ const { system } = instance;
31
21
  // Release the key automatically if it was pressed before.
32
22
  if (system.keyboard.isKeyPressed(keyDef)) {
33
- await system.keyboard.keyup(config, keyDef);
23
+ await system.keyboard.keyup(instance, keyDef);
34
24
  }
35
25
  if (!releasePrevious) {
36
26
  for(let i = 1; i <= repeat; i++){
37
- await system.keyboard.keydown(config, keyDef);
27
+ await system.keyboard.keydown(instance, keyDef);
38
28
  if (i < repeat) {
39
- await wait(config);
29
+ await wait(instance.config);
40
30
  }
41
31
  }
42
32
  // Release the key only on the last iteration on `state.repeatKey`.
43
33
  if (releaseSelf) {
44
- await system.keyboard.keyup(config, keyDef);
34
+ await system.keyboard.keyup(instance, keyDef);
45
35
  }
46
36
  }
47
37
  }
48
- async function releaseAllKeys(config) {
49
- for (const k of config.system.keyboard.getPressedKeys()){
50
- await config.system.keyboard.keyup(config, k);
38
+ async function releaseAllKeys(instance) {
39
+ for (const k of instance.system.keyboard.getPressedKeys()){
40
+ await instance.system.keyboard.keyup(instance, k);
51
41
  }
52
42
  }
53
43
 
@@ -1,15 +1,7 @@
1
1
  import '../utils/click/isClickableInput.js';
2
2
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../event/eventMap.js';
4
- import '../event/behavior/click.js';
5
- import '../event/behavior/cut.js';
6
- import '../event/behavior/keydown.js';
7
- import '../event/behavior/keypress.js';
8
- import '../event/behavior/keyup.js';
9
- import '../event/behavior/paste.js';
10
- import '@testing-library/dom';
11
- import '../utils/edit/maxLength.js';
12
3
  import '../utils/edit/isEditable.js';
4
+ import '../utils/edit/maxLength.js';
13
5
  import '@testing-library/dom/dist/helpers.js';
14
6
  import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
15
7
  import '../utils/misc/level.js';
@@ -27,18 +19,18 @@ import '../options.js';
27
19
  */ function parseKeyDef(keyboardMap, text) {
28
20
  const defs = [];
29
21
  do {
30
- const { type , descriptor , consumedLength , releasePrevious , releaseSelf =true , repeat , } = readNextDescriptor(text, 'keyboard');
31
- var ref;
32
- const keyDef = (ref = keyboardMap.find((def)=>{
22
+ const { type, descriptor, consumedLength, releasePrevious, releaseSelf = true, repeat } = readNextDescriptor(text, 'keyboard');
23
+ var _keyboardMap_find;
24
+ const keyDef = (_keyboardMap_find = keyboardMap.find((def)=>{
33
25
  if (type === '[') {
34
- var ref;
35
- return ((ref = def.code) === null || ref === void 0 ? void 0 : ref.toLowerCase()) === descriptor.toLowerCase();
26
+ var _def_code;
27
+ return ((_def_code = def.code) === null || _def_code === void 0 ? void 0 : _def_code.toLowerCase()) === descriptor.toLowerCase();
36
28
  } else if (type === '{') {
37
- var ref1;
38
- return ((ref1 = def.key) === null || ref1 === void 0 ? void 0 : ref1.toLowerCase()) === descriptor.toLowerCase();
29
+ var _def_key;
30
+ return ((_def_key = def.key) === null || _def_key === void 0 ? void 0 : _def_key.toLowerCase()) === descriptor.toLowerCase();
39
31
  }
40
32
  return def.key === descriptor;
41
- })) !== null && ref !== void 0 ? ref : {
33
+ })) !== null && _keyboardMap_find !== void 0 ? _keyboardMap_find : {
42
34
  key: 'Unknown',
43
35
  code: 'Unknown',
44
36
  [type === '[' ? 'code' : 'key']: descriptor
@@ -1,6 +1,3 @@
1
- import { defaultKeyMap } from './keyboard/keyMap.js';
2
- import { defaultKeyMap as defaultKeyMap$1 } from './pointer/keyMap.js';
3
-
4
1
  var PointerEventsCheckLevel;
5
2
  (function(PointerEventsCheckLevel) {
6
3
  PointerEventsCheckLevel[PointerEventsCheckLevel[/**
@@ -11,27 +8,5 @@ var PointerEventsCheckLevel;
11
8
  PointerEventsCheckLevel[PointerEventsCheckLevel[/** Check each event target once */ "EachTarget"] = 1] = "EachTarget";
12
9
  PointerEventsCheckLevel[PointerEventsCheckLevel[/** No pointer events check */ "Never"] = 0] = "Never";
13
10
  })(PointerEventsCheckLevel || (PointerEventsCheckLevel = {}));
14
- /**
15
- * Default options applied when API is called per `userEvent.anyApi()`
16
- */ const defaultOptionsDirect = {
17
- applyAccept: true,
18
- autoModify: true,
19
- delay: 0,
20
- document: globalThis.document,
21
- keyboardMap: defaultKeyMap,
22
- pointerMap: defaultKeyMap$1,
23
- pointerEventsCheck: PointerEventsCheckLevel.EachApiCall,
24
- skipAutoClose: false,
25
- skipClick: false,
26
- skipHover: false,
27
- writeToClipboard: false,
28
- advanceTimers: ()=>Promise.resolve()
29
- };
30
- /**
31
- * Default options applied when API is called per `userEvent().anyApi()`
32
- */ const defaultOptionsSetup = {
33
- ...defaultOptionsDirect,
34
- writeToClipboard: true
35
- };
36
11
 
37
- export { PointerEventsCheckLevel, defaultOptionsDirect, defaultOptionsSetup };
12
+ export { PointerEventsCheckLevel };
@@ -1,26 +1,16 @@
1
- import '../setup/index.js';
2
1
  import '../utils/click/isClickableInput.js';
3
2
  import '../utils/dataTransfer/Clipboard.js';
4
- import '../event/eventMap.js';
5
- import '../event/behavior/click.js';
6
- import '../event/behavior/cut.js';
7
- import '../event/behavior/keydown.js';
8
- import '../event/behavior/keypress.js';
9
- import '../event/behavior/keyup.js';
10
- import '../event/behavior/paste.js';
11
- import '@testing-library/dom';
12
- import '../utils/edit/maxLength.js';
13
3
  import '../utils/edit/isEditable.js';
4
+ import '../utils/edit/maxLength.js';
14
5
  import '@testing-library/dom/dist/helpers.js';
15
6
  import '../utils/keyDef/readNextDescriptor.js';
16
7
  import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
17
8
  import { wait } from '../utils/misc/wait.js';
18
9
  import '../options.js';
19
10
  import { parseKeyDef } from './parseKeyDef.js';
20
- import { Config } from '../setup/config.js';
21
11
 
22
12
  async function pointer(input) {
23
- const { pointerMap } = this[Config];
13
+ const { pointerMap } = this.config;
24
14
  const actions = [];
25
15
  (Array.isArray(input) ? input : [
26
16
  input
@@ -37,52 +27,52 @@ async function pointer(input) {
37
27
  }
38
28
  });
39
29
  for(let i = 0; i < actions.length; i++){
40
- await wait(this[Config]);
41
- await pointerAction(this[Config], actions[i]);
30
+ await wait(this.config);
31
+ await pointerAction(this, actions[i]);
42
32
  }
43
- this[Config].system.pointer.resetClickCount();
33
+ this.system.pointer.resetClickCount();
44
34
  }
45
- async function pointerAction(config, action) {
46
- var ref, ref1;
47
- const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? config.system.pointer.getPointerName(action.keyDef) : 'mouse';
48
- const previousPosition = config.system.pointer.getPreviousPosition(pointerName);
49
- var _target, _coords, _node, _offset;
35
+ async function pointerAction(instance, action) {
36
+ var _previousPosition, _previousPosition_caret, _previousPosition1, _previousPosition_caret1, _previousPosition2;
37
+ const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';
38
+ const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
39
+ var _action_target, _action_coords, _action_node, _action_offset;
50
40
  const position = {
51
- target: (_target = action.target) !== null && _target !== void 0 ? _target : getPrevTarget(config, previousPosition),
52
- coords: (_coords = action.coords) !== null && _coords !== void 0 ? _coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
41
+ target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
42
+ coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : (_previousPosition = previousPosition) === null || _previousPosition === void 0 ? void 0 : _previousPosition.coords,
53
43
  caret: {
54
- node: (_node = action.node) !== null && _node !== void 0 ? _node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref = previousPosition.caret) === null || ref === void 0 ? void 0 : ref.node,
55
- offset: (_offset = action.offset) !== null && _offset !== void 0 ? _offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref1 = previousPosition.caret) === null || ref1 === void 0 ? void 0 : ref1.offset
44
+ node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : (_previousPosition1 = previousPosition) === null || _previousPosition1 === void 0 ? void 0 : (_previousPosition_caret = _previousPosition1.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
45
+ offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : (_previousPosition2 = previousPosition) === null || _previousPosition2 === void 0 ? void 0 : (_previousPosition_caret1 = _previousPosition2.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
56
46
  }
57
47
  };
58
48
  if ('keyDef' in action) {
59
- if (config.system.pointer.isKeyPressed(action.keyDef)) {
60
- setLevelRef(config, ApiLevel.Trigger);
61
- await config.system.pointer.release(config, action.keyDef, position);
49
+ if (instance.system.pointer.isKeyPressed(action.keyDef)) {
50
+ setLevelRef(instance, ApiLevel.Trigger);
51
+ await instance.system.pointer.release(instance, action.keyDef, position);
62
52
  }
63
53
  if (!action.releasePrevious) {
64
- setLevelRef(config, ApiLevel.Trigger);
65
- await config.system.pointer.press(config, action.keyDef, position);
54
+ setLevelRef(instance, ApiLevel.Trigger);
55
+ await instance.system.pointer.press(instance, action.keyDef, position);
66
56
  if (action.releaseSelf) {
67
- setLevelRef(config, ApiLevel.Trigger);
68
- await config.system.pointer.release(config, action.keyDef, position);
57
+ setLevelRef(instance, ApiLevel.Trigger);
58
+ await instance.system.pointer.release(instance, action.keyDef, position);
69
59
  }
70
60
  }
71
61
  } else {
72
- setLevelRef(config, ApiLevel.Trigger);
73
- await config.system.pointer.move(config, pointerName, position);
62
+ setLevelRef(instance, ApiLevel.Trigger);
63
+ await instance.system.pointer.move(instance, pointerName, position);
74
64
  }
75
65
  }
76
66
  function hasCaretPosition(action) {
77
- var _target, ref;
78
- return !!((ref = (_target = action.target) !== null && _target !== void 0 ? _target : action.node) !== null && ref !== void 0 ? ref : action.offset !== undefined);
67
+ var _action_target, _ref;
68
+ return !!((_ref = (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : action.node) !== null && _ref !== void 0 ? _ref : action.offset !== undefined);
79
69
  }
80
- function getPrevTarget(config, position) {
70
+ function getPrevTarget(instance, position) {
81
71
  if (!position) {
82
72
  throw new Error('This pointer has no previous position. Provide a target property!');
83
73
  }
84
- var _target;
85
- return (_target = position.target) !== null && _target !== void 0 ? _target : config.document.body;
74
+ var _position_target;
75
+ return (_position_target = position.target) !== null && _position_target !== void 0 ? _position_target : instance.config.document.body;
86
76
  }
87
77
 
88
78
  export { pointer };
@@ -25,7 +25,7 @@ const defaultKeyMap = [
25
25
  {
26
26
  name: 'TouchC',
27
27
  pointerType: 'touch'
28
- },
28
+ }
29
29
  ];
30
30
 
31
31
  export { defaultKeyMap };
@@ -1,15 +1,7 @@
1
1
  import '../utils/click/isClickableInput.js';
2
2
  import '../utils/dataTransfer/Clipboard.js';
3
- import '../event/eventMap.js';
4
- import '../event/behavior/click.js';
5
- import '../event/behavior/cut.js';
6
- import '../event/behavior/keydown.js';
7
- import '../event/behavior/keypress.js';
8
- import '../event/behavior/keyup.js';
9
- import '../event/behavior/paste.js';
10
- import '@testing-library/dom';
11
- import '../utils/edit/maxLength.js';
12
3
  import '../utils/edit/isEditable.js';
4
+ import '../utils/edit/maxLength.js';
13
5
  import '@testing-library/dom/dist/helpers.js';
14
6
  import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
15
7
  import '../utils/misc/level.js';
@@ -18,7 +10,7 @@ import '../options.js';
18
10
  function parseKeyDef(pointerMap, keys) {
19
11
  const defs = [];
20
12
  do {
21
- const { descriptor , consumedLength , releasePrevious , releaseSelf =true , } = readNextDescriptor(keys, 'pointer');
13
+ const { descriptor, consumedLength, releasePrevious, releaseSelf = true } = readNextDescriptor(keys, 'pointer');
22
14
  const keyDef = pointerMap.find((p)=>p.name === descriptor);
23
15
  if (keyDef) {
24
16
  defs.push({
@@ -1,12 +1,33 @@
1
- export { click, dblClick, tripleClick } from '../convenience/click.js';
2
- export { hover, unhover } from '../convenience/hover.js';
3
- export { tab } from '../convenience/tab.js';
4
- export { keyboard } from '../keyboard/index.js';
5
- export { copy } from '../clipboard/copy.js';
6
- export { cut } from '../clipboard/cut.js';
7
- export { paste } from '../clipboard/paste.js';
8
- export { pointer } from '../pointer/index.js';
9
- export { clear } from '../utility/clear.js';
10
- export { deselectOptions, selectOptions } from '../utility/selectOptions.js';
11
- export { type } from '../utility/type.js';
12
- export { upload } from '../utility/upload.js';
1
+ import { click, dblClick, tripleClick } from '../convenience/click.js';
2
+ import { hover, unhover } from '../convenience/hover.js';
3
+ import { tab } from '../convenience/tab.js';
4
+ import { keyboard } from '../keyboard/index.js';
5
+ import { copy } from '../clipboard/copy.js';
6
+ import { cut } from '../clipboard/cut.js';
7
+ import { paste } from '../clipboard/paste.js';
8
+ import { pointer } from '../pointer/index.js';
9
+ import { clear } from '../utility/clear.js';
10
+ import { deselectOptions, selectOptions } from '../utility/selectOptions.js';
11
+ import { type } from '../utility/type.js';
12
+ import { upload } from '../utility/upload.js';
13
+
14
+ const userEventApi = {
15
+ click,
16
+ dblClick,
17
+ tripleClick,
18
+ hover,
19
+ unhover,
20
+ tab,
21
+ keyboard,
22
+ copy,
23
+ cut,
24
+ paste,
25
+ pointer,
26
+ clear,
27
+ deselectOptions,
28
+ selectOptions,
29
+ type,
30
+ upload
31
+ };
32
+
33
+ export { userEventApi };
@@ -22,12 +22,12 @@ function hover(element, options = {}) {
22
22
  return setupDirect(options).api.hover(element);
23
23
  }
24
24
  async function keyboard(text, options = {}) {
25
- const { config , api } = setupDirect(options);
26
- return api.keyboard(text).then(()=>config.system);
25
+ const { api, system } = setupDirect(options);
26
+ return api.keyboard(text).then(()=>system);
27
27
  }
28
28
  async function pointer(input, options = {}) {
29
- const { config , api } = setupDirect(options);
30
- return api.pointer(input).then(()=>config.system);
29
+ const { api, system } = setupDirect(options);
30
+ return api.pointer(input).then(()=>system);
31
31
  }
32
32
  function paste(clipboardData, options) {
33
33
  return setupDirect(options).api.paste(clipboardData);
@@ -42,8 +42,8 @@ function type(element, text, options = {}) {
42
42
  return setupDirect(options, element).api.type(element, text, options);
43
43
  }
44
44
  function unhover(element, options = {}) {
45
- const { config , api } = setupDirect(options);
46
- config.system.pointer.setMousePosition({
45
+ const { api, system } = setupDirect(options);
46
+ system.pointer.setMousePosition({
47
47
  target: element
48
48
  });
49
49
  return api.unhover(element);
@@ -1,5 +1,4 @@
1
1
  import { setupMain } from './setup.js';
2
- export { Config } from './config.js';
3
2
  import * as directApi from './directApi.js';
4
3
 
5
4
  const userEvent = {
@@ -1,29 +1,50 @@
1
- import { prepareDocument } from '../document/index.js';
2
- import { bindDispatchUIEvent } from '../event/index.js';
3
- import { defaultOptionsSetup, defaultOptionsDirect } from '../options.js';
1
+ import { prepareDocument } from '../document/prepareDocument.js';
2
+ import { dispatchEvent, dispatchUIEvent } from '../event/dispatchEvent.js';
4
3
  import '../utils/click/isClickableInput.js';
5
4
  import { attachClipboardStubToView } from '../utils/dataTransfer/Clipboard.js';
6
- import '../utils/edit/maxLength.js';
7
5
  import '../utils/edit/isEditable.js';
8
- import '@testing-library/dom';
6
+ import '../utils/edit/maxLength.js';
9
7
  import '@testing-library/dom/dist/helpers.js';
10
8
  import '../utils/keyDef/readNextDescriptor.js';
11
9
  import { getDocumentFromNode } from '../utils/misc/getDocumentFromNode.js';
12
10
  import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
13
11
  import { wait } from '../utils/misc/wait.js';
12
+ import { PointerEventsCheckLevel } from '../options.js';
13
+ import '@testing-library/dom';
14
+ import { defaultKeyMap } from '../keyboard/keyMap.js';
15
+ import { defaultKeyMap as defaultKeyMap$1 } from '../pointer/keyMap.js';
14
16
  import { System } from '../system/index.js';
15
- import { Config } from './config.js';
16
- import * as api from './api.js';
17
+ import { userEventApi } from './api.js';
17
18
  import { wrapAsync } from './wrapAsync.js';
18
19
 
20
+ /**
21
+ * Default options applied when API is called per `userEvent.anyApi()`
22
+ */ const defaultOptionsDirect = {
23
+ applyAccept: true,
24
+ autoModify: true,
25
+ delay: 0,
26
+ document: globalThis.document,
27
+ keyboardMap: defaultKeyMap,
28
+ pointerMap: defaultKeyMap$1,
29
+ pointerEventsCheck: PointerEventsCheckLevel.EachApiCall,
30
+ skipAutoClose: false,
31
+ skipClick: false,
32
+ skipHover: false,
33
+ writeToClipboard: false,
34
+ advanceTimers: ()=>Promise.resolve()
35
+ };
36
+ /**
37
+ * Default options applied when API is called per `userEvent().anyApi()`
38
+ */ const defaultOptionsSetup = {
39
+ ...defaultOptionsDirect,
40
+ writeToClipboard: true
41
+ };
19
42
  function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
20
43
  const document = getDocument(options, node, defaults);
21
- var _system;
22
44
  return {
23
45
  ...defaults,
24
46
  ...options,
25
- document,
26
- system: (_system = options.system) !== null && _system !== void 0 ? _system : new System()
47
+ document
27
48
  };
28
49
  }
29
50
  /**
@@ -32,37 +53,36 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
32
53
  */ function setupMain(options = {}) {
33
54
  const config = createConfig(options);
34
55
  prepareDocument(config.document);
35
- var _defaultView;
36
- const view = (_defaultView = config.document.defaultView) !== null && _defaultView !== void 0 ? _defaultView : /* istanbul ignore next */ globalThis.window;
56
+ var _config_document_defaultView;
57
+ const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== void 0 ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
37
58
  attachClipboardStubToView(view);
38
- return doSetup(config);
59
+ return createInstance(config).api;
39
60
  }
40
61
  /**
41
62
  * Setup in direct call per `userEvent.anyApi()`
42
- */ function setupDirect({ keyboardState , pointerState , ...options } = {}, node) {
43
- const config = createConfig({
44
- ...options,
45
- system: pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState
46
- }, defaultOptionsDirect, node);
63
+ */ function setupDirect({ keyboardState, pointerState, ...options } = {}, node) {
64
+ const config = createConfig(options, defaultOptionsDirect, node);
47
65
  prepareDocument(config.document);
66
+ var _ref;
67
+ const system = (_ref = pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState) !== null && _ref !== void 0 ? _ref : new System();
48
68
  return {
49
- config,
50
- api: doSetup(config)
69
+ api: createInstance(config, system).api,
70
+ system
51
71
  };
52
72
  }
53
73
  /**
54
74
  * Create a set of callbacks with different default settings but the same state.
55
75
  */ function setupSub(options) {
56
- return doSetup({
57
- ...this[Config],
76
+ return createInstance({
77
+ ...this.config,
58
78
  ...options
59
- });
79
+ }, this.system).api;
60
80
  }
61
81
  function wrapAndBindImpl(instance, impl) {
62
82
  function method(...args) {
63
- setLevelRef(instance[Config], ApiLevel.Call);
83
+ setLevelRef(instance, ApiLevel.Call);
64
84
  return wrapAsync(()=>impl.apply(instance, args).then(async (ret)=>{
65
- await wait(instance[Config]);
85
+ await wait(instance.config);
66
86
  return ret;
67
87
  }));
68
88
  }
@@ -71,23 +91,30 @@ function wrapAndBindImpl(instance, impl) {
71
91
  });
72
92
  return method;
73
93
  }
74
- function doSetup(config) {
75
- const instance = {
76
- [Config]: config,
77
- dispatchUIEvent: bindDispatchUIEvent(config),
78
- ...api
79
- };
94
+ function createInstance(config, system = new System()) {
95
+ const instance = {};
96
+ Object.assign(instance, {
97
+ config,
98
+ dispatchEvent: dispatchEvent.bind(instance),
99
+ dispatchUIEvent: dispatchUIEvent.bind(instance),
100
+ system,
101
+ levelRefs: {},
102
+ ...userEventApi
103
+ });
80
104
  return {
81
- ...Object.fromEntries(Object.entries(api).map(([name, api])=>[
82
- name,
83
- wrapAndBindImpl(instance, api),
84
- ])),
85
- setup: setupSub.bind(instance)
105
+ instance,
106
+ api: {
107
+ ...Object.fromEntries(Object.entries(userEventApi).map(([name, api])=>[
108
+ name,
109
+ wrapAndBindImpl(instance, api)
110
+ ])),
111
+ setup: setupSub.bind(instance)
112
+ }
86
113
  };
87
114
  }
88
115
  function getDocument(options, node, defaults) {
89
- var _document, ref;
90
- return (ref = (_document = options.document) !== null && _document !== void 0 ? _document : node && getDocumentFromNode(node)) !== null && ref !== void 0 ? ref : defaults.document;
116
+ var _options_document, _ref;
117
+ return (_ref = (_options_document = options.document) !== null && _options_document !== void 0 ? _options_document : node && getDocumentFromNode(node)) !== null && _ref !== void 0 ? _ref : defaults.document;
91
118
  }
92
119
 
93
- export { createConfig, setupDirect, setupMain, setupSub };
120
+ export { createConfig, createInstance, setupDirect, setupMain, setupSub };
@@ -1,5 +1,6 @@
1
- import { getConfig } from '@testing-library/dom';
1
+ import dtl from '../_interop/dtl.js';
2
2
 
3
+ const { getConfig } = dtl;
3
4
  /**
4
5
  * Wrap an internal Promise
5
6
  */ function wrapAsync(implementation) {
@@ -1,6 +1,19 @@
1
1
  import { KeyboardHost } from './keyboard.js';
2
2
  import { PointerHost } from './pointer/index.js';
3
3
 
4
+ function _define_property(obj, key, value) {
5
+ if (key in obj) {
6
+ Object.defineProperty(obj, key, {
7
+ value: value,
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true
11
+ });
12
+ } else {
13
+ obj[key] = value;
14
+ }
15
+ return obj;
16
+ }
4
17
  /**
5
18
  * @internal Do not create/alter this by yourself as this type might be subject to changes.
6
19
  */ class System {
@@ -21,8 +34,8 @@ import { PointerHost } from './pointer/index.js';
21
34
  };
22
35
  }
23
36
  constructor(){
24
- this.keyboard = new KeyboardHost(this);
25
- this.pointer = new PointerHost(this);
37
+ _define_property(this, "keyboard", new KeyboardHost(this));
38
+ _define_property(this, "pointer", new PointerHost(this));
26
39
  }
27
40
  }
28
41