@testing-library/user-event 14.4.3 → 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 (183) 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 +2 -2
  5. package/dist/cjs/clipboard/cut.js +2 -2
  6. package/dist/cjs/clipboard/paste.js +4 -4
  7. package/dist/cjs/convenience/tab.js +1 -1
  8. package/dist/cjs/document/UI.js +5 -5
  9. package/dist/cjs/document/interceptor.js +6 -4
  10. package/dist/cjs/document/trackValue.js +4 -4
  11. package/dist/cjs/event/behavior/keydown.js +6 -6
  12. package/dist/cjs/event/behavior/keypress.js +4 -3
  13. package/dist/cjs/event/behavior/keyup.js +2 -2
  14. package/dist/cjs/event/behavior/paste.js +2 -2
  15. package/dist/cjs/event/createEvent.js +41 -41
  16. package/dist/cjs/event/dispatchEvent.js +2 -2
  17. package/dist/cjs/event/eventMap.js +2 -2
  18. package/dist/cjs/event/focus.js +2 -2
  19. package/dist/cjs/event/input.js +4 -4
  20. package/dist/cjs/event/selection/getInputRange.js +2 -2
  21. package/dist/cjs/event/selection/getTargetTypeAndSelection.js +3 -2
  22. package/dist/cjs/event/selection/modifySelection.js +3 -3
  23. package/dist/cjs/event/selection/modifySelectionPerMouse.js +4 -3
  24. package/dist/cjs/event/selection/moveSelection.js +6 -5
  25. package/dist/cjs/event/selection/resolveCaretPosition.js +1 -1
  26. package/dist/cjs/event/selection/selectAll.js +6 -5
  27. package/dist/cjs/event/selection/setSelection.js +3 -3
  28. package/dist/cjs/event/selection/setSelectionPerMouse.js +8 -7
  29. package/dist/cjs/event/selection/setSelectionRange.js +2 -2
  30. package/dist/cjs/event/selection/updateSelectionOnFocus.js +4 -3
  31. package/dist/cjs/event/wrapEvent.js +3 -2
  32. package/dist/cjs/index.js +1 -0
  33. package/dist/cjs/keyboard/index.js +2 -2
  34. package/dist/cjs/keyboard/parseKeyDef.js +8 -8
  35. package/dist/cjs/pointer/index.js +11 -11
  36. package/dist/cjs/pointer/keyMap.js +1 -1
  37. package/dist/cjs/pointer/parseKeyDef.js +1 -1
  38. package/dist/cjs/setup/api.js +19 -17
  39. package/dist/cjs/setup/directApi.js +3 -3
  40. package/dist/cjs/setup/setup.js +10 -10
  41. package/dist/cjs/setup/wrapAsync.js +3 -2
  42. package/dist/cjs/system/index.js +15 -2
  43. package/dist/cjs/system/keyboard.js +27 -12
  44. package/dist/cjs/system/pointer/buttons.js +14 -1
  45. package/dist/cjs/system/pointer/device.js +14 -1
  46. package/dist/cjs/system/pointer/index.js +46 -26
  47. package/dist/cjs/system/pointer/mouse.js +33 -19
  48. package/dist/cjs/system/pointer/pointer.js +24 -8
  49. package/dist/cjs/system/pointer/shared.js +2 -2
  50. package/dist/cjs/utility/selectOptions.js +12 -11
  51. package/dist/cjs/utility/type.js +1 -1
  52. package/dist/cjs/utility/upload.js +6 -5
  53. package/dist/cjs/utils/dataTransfer/Clipboard.js +25 -9
  54. package/dist/cjs/utils/dataTransfer/DataTransfer.js +25 -9
  55. package/dist/cjs/utils/edit/maxLength.js +2 -2
  56. package/dist/cjs/utils/edit/setFiles.js +4 -4
  57. package/dist/cjs/utils/focus/cursor.js +2 -2
  58. package/dist/cjs/utils/focus/getActiveElement.js +4 -3
  59. package/dist/cjs/utils/focus/selector.js +1 -1
  60. package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
  61. package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
  62. package/dist/cjs/utils/misc/getWindow.js +3 -2
  63. package/dist/cjs/utils/misc/isDisabled.js +3 -3
  64. package/dist/cjs/utils/misc/isVisible.js +3 -2
  65. package/dist/cjs/utils/misc/wait.js +1 -1
  66. package/dist/cjs/utils/pointer/cssPointerEvents.js +23 -19
  67. package/dist/esm/_interop/dtl.js +6 -0
  68. package/dist/esm/_interop/dtlEventMap.js +6 -0
  69. package/dist/esm/_interop/dtlHelpers.js +6 -0
  70. package/dist/esm/clipboard/copy.js +2 -2
  71. package/dist/esm/clipboard/cut.js +2 -2
  72. package/dist/esm/clipboard/paste.js +4 -4
  73. package/dist/esm/convenience/tab.js +1 -1
  74. package/dist/esm/document/UI.js +5 -5
  75. package/dist/esm/document/interceptor.js +6 -4
  76. package/dist/esm/document/trackValue.js +4 -4
  77. package/dist/esm/event/behavior/keydown.js +6 -6
  78. package/dist/esm/event/behavior/keypress.js +4 -3
  79. package/dist/esm/event/behavior/keyup.js +2 -2
  80. package/dist/esm/event/behavior/paste.js +2 -2
  81. package/dist/esm/event/createEvent.js +41 -41
  82. package/dist/esm/event/dispatchEvent.js +2 -2
  83. package/dist/esm/event/eventMap.js +2 -2
  84. package/dist/esm/event/focus.js +2 -2
  85. package/dist/esm/event/input.js +4 -4
  86. package/dist/esm/event/selection/getInputRange.js +2 -2
  87. package/dist/esm/event/selection/getTargetTypeAndSelection.js +3 -2
  88. package/dist/esm/event/selection/modifySelection.js +3 -3
  89. package/dist/esm/event/selection/modifySelectionPerMouse.js +4 -3
  90. package/dist/esm/event/selection/moveSelection.js +6 -5
  91. package/dist/esm/event/selection/resolveCaretPosition.js +1 -1
  92. package/dist/esm/event/selection/selectAll.js +6 -5
  93. package/dist/esm/event/selection/setSelection.js +3 -3
  94. package/dist/esm/event/selection/setSelectionPerMouse.js +8 -7
  95. package/dist/esm/event/selection/setSelectionRange.js +2 -2
  96. package/dist/esm/event/selection/updateSelectionOnFocus.js +4 -3
  97. package/dist/esm/event/wrapEvent.js +2 -1
  98. package/dist/esm/index.js +1 -1
  99. package/dist/esm/keyboard/index.js +2 -2
  100. package/dist/esm/keyboard/parseKeyDef.js +8 -8
  101. package/dist/esm/pointer/index.js +11 -11
  102. package/dist/esm/pointer/keyMap.js +1 -1
  103. package/dist/esm/pointer/parseKeyDef.js +1 -1
  104. package/dist/esm/setup/api.js +33 -12
  105. package/dist/esm/setup/directApi.js +3 -3
  106. package/dist/esm/setup/setup.js +11 -11
  107. package/dist/esm/setup/wrapAsync.js +2 -1
  108. package/dist/esm/system/index.js +15 -2
  109. package/dist/esm/system/keyboard.js +27 -12
  110. package/dist/esm/system/pointer/buttons.js +14 -1
  111. package/dist/esm/system/pointer/device.js +14 -1
  112. package/dist/esm/system/pointer/index.js +46 -26
  113. package/dist/esm/system/pointer/mouse.js +33 -19
  114. package/dist/esm/system/pointer/pointer.js +24 -8
  115. package/dist/esm/system/pointer/shared.js +2 -2
  116. package/dist/esm/utility/selectOptions.js +8 -7
  117. package/dist/esm/utility/type.js +1 -1
  118. package/dist/esm/utility/upload.js +6 -5
  119. package/dist/esm/utils/dataTransfer/Clipboard.js +25 -9
  120. package/dist/esm/utils/dataTransfer/DataTransfer.js +25 -9
  121. package/dist/esm/utils/edit/maxLength.js +2 -2
  122. package/dist/esm/utils/edit/setFiles.js +4 -4
  123. package/dist/esm/utils/focus/cursor.js +2 -2
  124. package/dist/esm/utils/focus/getActiveElement.js +4 -3
  125. package/dist/esm/utils/focus/selector.js +1 -1
  126. package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
  127. package/dist/esm/utils/misc/getTreeDiff.js +3 -3
  128. package/dist/esm/utils/misc/getWindow.js +2 -1
  129. package/dist/esm/utils/misc/isDisabled.js +3 -3
  130. package/dist/esm/utils/misc/isVisible.js +3 -2
  131. package/dist/esm/utils/misc/wait.js +1 -1
  132. package/dist/esm/utils/pointer/cssPointerEvents.js +23 -19
  133. package/dist/types/_interop/dtl.d.ts +3 -0
  134. package/dist/types/_interop/dtlEventMap.d.ts +3 -0
  135. package/dist/types/_interop/dtlHelpers.d.ts +3 -0
  136. package/dist/types/clipboard/copy.d.ts +1 -1
  137. package/dist/types/clipboard/cut.d.ts +1 -1
  138. package/dist/types/clipboard/paste.d.ts +1 -1
  139. package/dist/types/convenience/click.d.ts +1 -1
  140. package/dist/types/convenience/hover.d.ts +1 -1
  141. package/dist/types/convenience/tab.d.ts +1 -1
  142. package/dist/types/document/UI.d.ts +3 -3
  143. package/dist/types/document/interceptor.d.ts +3 -3
  144. package/dist/types/event/behavior/registry.d.ts +1 -1
  145. package/dist/types/event/createEvent.d.ts +1 -1
  146. package/dist/types/event/dispatchEvent.d.ts +1 -1
  147. package/dist/types/event/eventMap.d.ts +8 -0
  148. package/dist/types/event/input.d.ts +1 -1
  149. package/dist/types/event/radio.d.ts +1 -1
  150. package/dist/types/event/selection/index.d.ts +2 -2
  151. package/dist/types/event/selection/modifySelectionPerMouse.d.ts +1 -1
  152. package/dist/types/event/selection/setSelectionPerMouse.d.ts +1 -1
  153. package/dist/types/event/types.d.ts +3 -3
  154. package/dist/types/index.d.ts +3 -1
  155. package/dist/types/keyboard/index.d.ts +1 -1
  156. package/dist/types/options.d.ts +2 -2
  157. package/dist/types/pointer/index.d.ts +7 -7
  158. package/dist/types/setup/api.d.ts +23 -5
  159. package/dist/types/setup/directApi.d.ts +5 -5
  160. package/dist/types/setup/setup.d.ts +5 -5
  161. package/dist/types/system/keyboard.d.ts +2 -2
  162. package/dist/types/system/pointer/buttons.d.ts +2 -2
  163. package/dist/types/system/pointer/device.d.ts +1 -1
  164. package/dist/types/system/pointer/mouse.d.ts +2 -2
  165. package/dist/types/system/pointer/pointer.d.ts +2 -2
  166. package/dist/types/utility/clear.d.ts +1 -1
  167. package/dist/types/utility/selectOptions.d.ts +1 -1
  168. package/dist/types/utility/type.d.ts +2 -2
  169. package/dist/types/utility/upload.d.ts +1 -1
  170. package/dist/types/utils/click/isClickableInput.d.ts +1 -1
  171. package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
  172. package/dist/types/utils/edit/isEditable.d.ts +2 -2
  173. package/dist/types/utils/edit/maxLength.d.ts +1 -1
  174. package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
  175. package/dist/types/utils/misc/isElementType.d.ts +1 -1
  176. package/dist/types/utils/misc/level.d.ts +2 -2
  177. package/dist/types/utils/misc/wait.d.ts +1 -1
  178. package/dist/types/utils/pointer/cssPointerEvents.d.ts +1 -1
  179. package/package.json +22 -11
  180. /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
  181. /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
  182. /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
  183. /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var def = require('@testing-library/dom');
4
+
5
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
26
+ var def__namespace = /*#__PURE__*/_interopNamespace(def);
27
+
28
+ var dtl = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
29
+
30
+ module.exports = dtl;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var def = require('@testing-library/dom/dist/event-map.js');
4
+
5
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
26
+ var def__namespace = /*#__PURE__*/_interopNamespace(def);
27
+
28
+ var dtlEvents = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
29
+
30
+ module.exports = dtlEvents;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var def = require('@testing-library/dom/dist/helpers.js');
4
+
5
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
26
+ var def__namespace = /*#__PURE__*/_interopNamespace(def);
27
+
28
+ var dtlHelpers = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
29
+
30
+ module.exports = dtlHelpers;
@@ -14,8 +14,8 @@ var copySelection = require('../document/copySelection.js');
14
14
 
15
15
  async function copy() {
16
16
  const doc = this.config.document;
17
- var _activeElement;
18
- const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body;
17
+ var _doc_activeElement;
18
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
19
19
  const clipboardData = copySelection.copySelection(target);
20
20
  if (clipboardData.items.length === 0) {
21
21
  return;
@@ -14,8 +14,8 @@ var copySelection = require('../document/copySelection.js');
14
14
 
15
15
  async function cut() {
16
16
  const doc = this.config.document;
17
- var _activeElement;
18
- const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body;
17
+ var _doc_activeElement;
18
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
19
19
  const clipboardData = copySelection.copySelection(target);
20
20
  if (clipboardData.items.length === 0) {
21
21
  return;
@@ -14,10 +14,10 @@ require('../options.js');
14
14
 
15
15
  async function paste(clipboardData) {
16
16
  const doc = this.config.document;
17
- var _activeElement;
18
- const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body;
19
- var ref;
20
- const dataTransfer = (ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && ref !== void 0 ? ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
17
+ var _doc_activeElement;
18
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
19
+ var _ref;
20
+ const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
21
21
  throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
22
22
  });
23
23
  this.dispatchUIEvent(target, 'paste', {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- async function tab({ shift } = {}) {
5
+ async function tab({ shift } = {}) {
6
6
  return this.keyboard(shift === true ? '{Shift>}{Tab}{/Shift}' : shift === false ? '[/ShiftLeft][/ShiftRight]{Tab}' : '{Tab}');
7
7
  }
8
8
 
@@ -36,7 +36,7 @@ function getInitialValue(element) {
36
36
  function setUISelectionRaw(element, selection) {
37
37
  element[UISelection] = selection;
38
38
  }
39
- function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
39
+ function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
40
40
  const valueLength = getUIValue(element).length;
41
41
  const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
42
42
  const anchorOffset = mode === 'replace' || element[UISelection] === undefined ? sanitizeOffset(anchorOffsetParam) : element[UISelection].anchorOffset;
@@ -62,10 +62,10 @@ function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset:
62
62
  }
63
63
  }
64
64
  function getUISelection(element) {
65
- var _selectionStart, _selectionEnd, _UISelection;
66
- const sel = (_UISelection = element[UISelection]) !== null && _UISelection !== void 0 ? _UISelection : {
67
- anchorOffset: (_selectionStart = element.selectionStart) !== null && _selectionStart !== void 0 ? _selectionStart : 0,
68
- focusOffset: (_selectionEnd = element.selectionEnd) !== null && _selectionEnd !== void 0 ? _selectionEnd : 0
65
+ var _element_selectionStart, _element_selectionEnd, _element_UISelection;
66
+ const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
67
+ anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
68
+ focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
69
69
  };
70
70
  return {
71
71
  ...sel,
@@ -16,21 +16,23 @@ var UI = require('./UI.js');
16
16
 
17
17
  const Interceptor = Symbol('Interceptor for programmatical calls');
18
18
  function prepareInterceptor(element, propName, interceptorImpl) {
19
+ var _prototypeDescriptor, _prototypeDescriptor1;
19
20
  const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
20
21
  const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
21
- const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value';
22
- /* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
22
+ const target = ((_prototypeDescriptor = prototypeDescriptor) === null || _prototypeDescriptor === void 0 ? void 0 : _prototypeDescriptor.set) ? 'set' : 'value';
23
+ /* istanbul ignore if */ if (typeof ((_prototypeDescriptor1 = prototypeDescriptor) === null || _prototypeDescriptor1 === void 0 ? void 0 : _prototypeDescriptor1[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
23
24
  throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
24
25
  }
25
26
  function intercept(...args) {
26
- const { applyNative =false , realArgs , then , } = interceptorImpl.call(this, ...args);
27
+ var _then;
28
+ const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
27
29
  const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
28
30
  if (target === 'set') {
29
31
  realFunc.call(this, realArgs);
30
32
  } else {
31
33
  realFunc.call(this, ...realArgs);
32
34
  }
33
- then === null || then === void 0 ? void 0 : then();
35
+ (_then = then) === null || _then === void 0 ? void 0 : _then();
34
36
  }
35
37
  intercept[Interceptor] = Interceptor;
36
38
  Object.defineProperty(element, propName, {
@@ -33,8 +33,8 @@ function startTrackValue(element) {
33
33
  };
34
34
  }
35
35
  function trackOrSetValue(element, v) {
36
- var ref, ref1;
37
- (ref = element[TrackChanges]) === null || ref === void 0 ? void 0 : (ref1 = ref.tracked) === null || ref1 === void 0 ? void 0 : ref1.push(v);
36
+ var _element_TrackChanges_tracked, _element_TrackChanges;
37
+ (_element_TrackChanges = element[TrackChanges]) === null || _element_TrackChanges === void 0 ? void 0 : (_element_TrackChanges_tracked = _element_TrackChanges.tracked) === null || _element_TrackChanges_tracked === void 0 ? void 0 : _element_TrackChanges_tracked.push(v);
38
38
  if (!element[TrackChanges]) {
39
39
  UI.setUIValueClean(element);
40
40
  UI.setUISelection(element, {
@@ -43,10 +43,10 @@ function trackOrSetValue(element, v) {
43
43
  }
44
44
  }
45
45
  function commitValueAfterInput(element, cursorOffset) {
46
- var ref;
46
+ var _changes_tracked, _changes;
47
47
  const changes = element[TrackChanges];
48
48
  element[TrackChanges] = undefined;
49
- if (!(changes === null || changes === void 0 ? void 0 : (ref = changes.tracked) === null || ref === void 0 ? void 0 : ref.length)) {
49
+ if (!((_changes = changes) === null || _changes === void 0 ? void 0 : (_changes_tracked = _changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
50
50
  return;
51
51
  }
52
52
  const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
@@ -23,9 +23,9 @@ var radio = require('../radio.js');
23
23
  var registry = require('./registry.js');
24
24
 
25
25
  registry.behavior.keydown = (event, target, instance)=>{
26
- var ref;
27
- var ref1;
28
- return (ref1 = (ref = keydownBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keydownBehavior, event, target, instance)) !== null && ref1 !== void 0 ? ref1 : combinationBehavior(event, target, instance);
26
+ var _keydownBehavior_event_key, _keydownBehavior;
27
+ var _keydownBehavior_event_key1;
28
+ return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = (_keydownBehavior = 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);
29
29
  };
30
30
  const keydownBehavior = {
31
31
  ArrowDown: (event, target, instance)=>{
@@ -78,9 +78,9 @@ const keydownBehavior = {
78
78
  'textarea'
79
79
  ]) || isContentEditable.isContentEditable(target)) {
80
80
  return ()=>{
81
- var ref;
82
- var ref1;
83
- const newPos = (ref1 = (ref = getValueOrTextContent.getValueOrTextContent(target)) === null || ref === void 0 ? void 0 : ref.length) !== null && ref1 !== void 0 ? ref1 : /* istanbul ignore next */ 0;
81
+ var _getValueOrTextContent;
82
+ var _getValueOrTextContent_length;
83
+ const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent.getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== void 0 ? _getValueOrTextContent_length : /* istanbul ignore next */ 0;
84
84
  setSelectionRange.setSelectionRange(target, newPos, newPos);
85
85
  };
86
86
  }
@@ -20,8 +20,9 @@ registry.behavior.keypress = (event, target, instance)=>{
20
20
  instance.dispatchUIEvent(target, 'click');
21
21
  };
22
22
  } else if (isElementType.isElementType(target, 'input')) {
23
+ var _form;
23
24
  const form = target.form;
24
- const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
25
+ const submit = (_form = form) === null || _form === void 0 ? void 0 : _form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
25
26
  if (submit) {
26
27
  return ()=>instance.dispatchUIEvent(submit, 'click');
27
28
  } else if (form && SubmitSingleInputOnEnter.includes(target.type) && form.querySelectorAll('input').length === 1) {
@@ -43,7 +44,7 @@ const ClickInputOnEnter = [
43
44
  'file',
44
45
  'image',
45
46
  'reset',
46
- 'submit',
47
+ 'submit'
47
48
  ];
48
49
  const SubmitSingleInputOnEnter = [
49
50
  'email',
@@ -53,5 +54,5 @@ const SubmitSingleInputOnEnter = [
53
54
  'tel',
54
55
  'text',
55
56
  'url',
56
- 'week',
57
+ 'week'
57
58
  ];
@@ -11,8 +11,8 @@ require('../../options.js');
11
11
  var registry = require('./registry.js');
12
12
 
13
13
  registry.behavior.keyup = (event, target, instance)=>{
14
- var ref;
15
- return (ref = keyupBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keyupBehavior, event, target, instance);
14
+ var _keyupBehavior_event_key, _keyupBehavior;
15
+ return (_keyupBehavior_event_key = (_keyupBehavior = keyupBehavior)[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(_keyupBehavior, event, target, instance);
16
16
  };
17
17
  const keyupBehavior = {
18
18
  ' ': (event, target, instance)=>{
@@ -14,8 +14,8 @@ var registry = require('./registry.js');
14
14
  registry.behavior.paste = (event, target, instance)=>{
15
15
  if (isEditable.isEditable(target)) {
16
16
  return ()=>{
17
- var ref;
18
- const insertData = (ref = event.clipboardData) === null || ref === void 0 ? void 0 : ref.getData('text');
17
+ var _event_clipboardData;
18
+ const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.getData('text');
19
19
  if (insertData) {
20
20
  input.input(instance, target, insertData, 'insertFromPaste');
21
21
  }
@@ -29,7 +29,7 @@ const eventInitializer = {
29
29
  initUIEvent,
30
30
  initUIEventModififiers,
31
31
  initMouseEvent,
32
- initPointerEvent,
32
+ initPointerEvent
33
33
  ],
34
34
  KeyboardEvent: [
35
35
  initUIEvent,
@@ -38,58 +38,58 @@ const eventInitializer = {
38
38
  ]
39
39
  };
40
40
  function createEvent(type, target, init) {
41
- var ref;
41
+ var _eventInitializer_EventType;
42
42
  const window = getWindow.getWindow(target);
43
- const { EventType , defaultInit } = eventMap.eventMap[eventMap.eventMapKeys[type]];
43
+ const { EventType, defaultInit } = eventMap.eventMap[eventMap.eventMapKeys[type]];
44
44
  const event = new (getEventConstructors(window))[EventType](type, defaultInit);
45
- (ref = eventInitializer[EventType]) === null || ref === void 0 ? void 0 : ref.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
45
+ (_eventInitializer_EventType = eventInitializer[EventType]) === null || _eventInitializer_EventType === void 0 ? void 0 : _eventInitializer_EventType.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
46
46
  return event;
47
47
  }
48
48
  /* istanbul ignore next */ function getEventConstructors(window) {
49
- var _Event;
50
- /* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_Event = window.Event) !== null && _Event !== void 0 ? _Event : class Event {
49
+ var _window_Event;
50
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
51
51
  };
52
- var _AnimationEvent;
53
- const AnimationEvent = (_AnimationEvent = window.AnimationEvent) !== null && _AnimationEvent !== void 0 ? _AnimationEvent : class AnimationEvent extends Event {
52
+ var _window_AnimationEvent;
53
+ const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
54
54
  };
55
- var _ClipboardEvent;
56
- const ClipboardEvent = (_ClipboardEvent = window.ClipboardEvent) !== null && _ClipboardEvent !== void 0 ? _ClipboardEvent : class ClipboardEvent extends Event {
55
+ var _window_ClipboardEvent;
56
+ const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
57
57
  };
58
- var _PopStateEvent;
59
- const PopStateEvent = (_PopStateEvent = window.PopStateEvent) !== null && _PopStateEvent !== void 0 ? _PopStateEvent : class PopStateEvent extends Event {
58
+ var _window_PopStateEvent;
59
+ const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
60
60
  };
61
- var _ProgressEvent;
62
- const ProgressEvent = (_ProgressEvent = window.ProgressEvent) !== null && _ProgressEvent !== void 0 ? _ProgressEvent : class ProgressEvent extends Event {
61
+ var _window_ProgressEvent;
62
+ const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
63
63
  };
64
- var _TransitionEvent;
65
- const TransitionEvent = (_TransitionEvent = window.TransitionEvent) !== null && _TransitionEvent !== void 0 ? _TransitionEvent : class TransitionEvent extends Event {
64
+ var _window_TransitionEvent;
65
+ const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
66
66
  };
67
- var _UIEvent;
68
- const UIEvent = (_UIEvent = window.UIEvent) !== null && _UIEvent !== void 0 ? _UIEvent : class UIEvent extends Event {
67
+ var _window_UIEvent;
68
+ const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
69
69
  };
70
- var _CompositionEvent;
71
- const CompositionEvent = (_CompositionEvent = window.CompositionEvent) !== null && _CompositionEvent !== void 0 ? _CompositionEvent : class CompositionEvent extends UIEvent {
70
+ var _window_CompositionEvent;
71
+ const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
72
72
  };
73
- var _FocusEvent;
74
- const FocusEvent = (_FocusEvent = window.FocusEvent) !== null && _FocusEvent !== void 0 ? _FocusEvent : class FocusEvent extends UIEvent {
73
+ var _window_FocusEvent;
74
+ const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
75
75
  };
76
- var _InputEvent;
77
- const InputEvent = (_InputEvent = window.InputEvent) !== null && _InputEvent !== void 0 ? _InputEvent : class InputEvent extends UIEvent {
76
+ var _window_InputEvent;
77
+ const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
78
78
  };
79
- var _KeyboardEvent;
80
- const KeyboardEvent = (_KeyboardEvent = window.KeyboardEvent) !== null && _KeyboardEvent !== void 0 ? _KeyboardEvent : class KeyboardEvent extends UIEvent {
79
+ var _window_KeyboardEvent;
80
+ const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
81
81
  };
82
- var _MouseEvent;
83
- const MouseEvent = (_MouseEvent = window.MouseEvent) !== null && _MouseEvent !== void 0 ? _MouseEvent : class MouseEvent extends UIEvent {
82
+ var _window_MouseEvent;
83
+ const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
84
84
  };
85
- var _DragEvent;
86
- const DragEvent = (_DragEvent = window.DragEvent) !== null && _DragEvent !== void 0 ? _DragEvent : class DragEvent extends MouseEvent {
85
+ var _window_DragEvent;
86
+ const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
87
87
  };
88
- var _PointerEvent;
89
- const PointerEvent = (_PointerEvent = window.PointerEvent) !== null && _PointerEvent !== void 0 ? _PointerEvent : class PointerEvent extends MouseEvent {
88
+ var _window_PointerEvent;
89
+ const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
90
90
  };
91
- var _TouchEvent;
92
- const TouchEvent = (_TouchEvent = window.TouchEvent) !== null && _TouchEvent !== void 0 ? _TouchEvent : class TouchEvent extends UIEvent {
91
+ var _window_TouchEvent;
92
+ const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
93
93
  };
94
94
  /* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
95
95
  Event,
@@ -119,25 +119,25 @@ function assignProps(obj, props) {
119
119
  function sanitizeNumber(n) {
120
120
  return Number(n !== null && n !== void 0 ? n : 0);
121
121
  }
122
- function initClipboardEvent(event, { clipboardData }) {
122
+ function initClipboardEvent(event, { clipboardData }) {
123
123
  assignProps(event, {
124
124
  clipboardData
125
125
  });
126
126
  }
127
- function initInputEvent(event, { data , inputType , isComposing }) {
127
+ function initInputEvent(event, { data, inputType, isComposing }) {
128
128
  assignProps(event, {
129
129
  data,
130
130
  isComposing: Boolean(isComposing),
131
131
  inputType: String(inputType)
132
132
  });
133
133
  }
134
- function initUIEvent(event, { view , detail }) {
134
+ function initUIEvent(event, { view, detail }) {
135
135
  assignProps(event, {
136
136
  view,
137
137
  detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
138
138
  });
139
139
  }
140
- function initUIEventModififiers(event, { altKey , ctrlKey , metaKey , shiftKey , modifierAltGraph , modifierCapsLock , modifierFn , modifierFnLock , modifierNumLock , modifierScrollLock , modifierSymbol , modifierSymbolLock }) {
140
+ function initUIEventModififiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
141
141
  assignProps(event, {
142
142
  altKey: Boolean(altKey),
143
143
  ctrlKey: Boolean(ctrlKey),
@@ -161,7 +161,7 @@ function initUIEventModififiers(event, { altKey , ctrlKey , metaKey , shiftKey ,
161
161
  }
162
162
  });
163
163
  }
164
- function initKeyboardEvent(event, { key , code , location , repeat , isComposing , charCode }) {
164
+ function initKeyboardEvent(event, { key, code, location, repeat, isComposing, charCode }) {
165
165
  assignProps(event, {
166
166
  key: String(key),
167
167
  code: String(code),
@@ -171,7 +171,7 @@ function initKeyboardEvent(event, { key , code , location , repeat , isComposing
171
171
  charCode
172
172
  });
173
173
  }
174
- function initMouseEvent(event, { x , y , screenX , screenY , clientX =x , clientY =y , button , buttons , relatedTarget }) {
174
+ function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget }) {
175
175
  assignProps(event, {
176
176
  screenX: sanitizeNumber(screenX),
177
177
  screenY: sanitizeNumber(screenY),
@@ -184,7 +184,7 @@ function initMouseEvent(event, { x , y , screenX , screenY , clientX =x , client
184
184
  relatedTarget
185
185
  });
186
186
  }
187
- function initPointerEvent(event, { pointerId , width , height , pressure , tangentialPressure , tiltX , tiltY , twist , pointerType , isPrimary }) {
187
+ function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
188
188
  assignProps(event, {
189
189
  pointerId: sanitizeNumber(pointerId),
190
190
  width: sanitizeNumber(width),
@@ -24,9 +24,9 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
24
24
  return dispatchEvent.call(this, target, event, preventDefault);
25
25
  }
26
26
  function dispatchEvent(target, event, preventDefault = false) {
27
- var ref;
27
+ var _behavior_type, _behavior;
28
28
  const type = event.type;
29
- const behaviorImplementation = preventDefault ? ()=>{} : (ref = registry.behavior[type]) === null || ref === void 0 ? void 0 : ref(event, target, this);
29
+ const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = (_behavior = registry.behavior)[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(_behavior, event, target, this);
30
30
  if (behaviorImplementation) {
31
31
  event.preventDefault();
32
32
  let defaultPrevented = false;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var eventMap_js = require('@testing-library/dom/dist/event-map.js');
5
+ var dtlEventMap = require('../_interop/dtlEventMap.js');
6
6
 
7
7
  const eventMap = {
8
- ...eventMap_js.eventMap,
8
+ ...dtlEventMap.eventMap,
9
9
  click: {
10
10
  EventType: 'PointerEvent',
11
11
  defaultInit: {
@@ -27,8 +27,8 @@ var wrapEvent = require('./wrapEvent.js');
27
27
  wrapEvent.wrapEvent(()=>target.focus());
28
28
  } else {
29
29
  wrapEvent.wrapEvent(()=>{
30
- var ref;
31
- return (ref = activeElement) === null || ref === void 0 ? void 0 : ref.blur();
30
+ var _activeElement;
31
+ return (_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.blur();
32
32
  });
33
33
  }
34
34
  updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
@@ -98,7 +98,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
98
98
  }
99
99
  }
100
100
  }
101
- const { newValue , newOffset , oldValue } = calculateNewValue(dataToInsert, element, inputRange, inputType);
101
+ const { newValue, newOffset, oldValue } = calculateNewValue(dataToInsert, element, inputRange, inputType);
102
102
  if (newValue === oldValue && newOffset === inputRange.startOffset && newOffset === inputRange.endOffset) {
103
103
  return;
104
104
  }
@@ -126,7 +126,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
126
126
  });
127
127
  }
128
128
  }
129
- function calculateNewValue(inputData, node, { startOffset , endOffset }, inputType) {
129
+ function calculateNewValue(inputData, node, { startOffset, endOffset }, inputType) {
130
130
  const value = UI.getUIValue(node);
131
131
  const prologEnd = Math.max(0, startOffset === endOffset && inputType === 'deleteContentBackward' ? startOffset - 1 : startOffset);
132
132
  const prolog = value.substring(0, prologEnd);
@@ -154,12 +154,12 @@ function commitInput(instance, element, newOffset, inputInit) {
154
154
  trackValue.commitValueAfterInput(element, newOffset);
155
155
  }
156
156
  function isValidNumberInput(value) {
157
- var ref, ref1;
157
+ var _value_match, _value_match1;
158
158
  // the browser allows some invalid input but not others
159
159
  // it allows up to two '-' at any place before any 'e' or one directly following 'e'
160
160
  // it allows one '.' at any place before e
161
161
  const valueParts = value.split('e', 2);
162
- return !(/[^\d.\-e]/.test(value) || Number((ref = value.match(/-/g)) === null || ref === void 0 ? void 0 : ref.length) > 2 || Number((ref1 = value.match(/\./g)) === null || ref1 === void 0 ? void 0 : ref1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
162
+ return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match === void 0 ? void 0 : _value_match.length) > 2 || Number((_value_match1 = value.match(/\./g)) === null || _value_match1 === void 0 ? void 0 : _value_match1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
163
163
  }
164
164
 
165
165
  exports.input = input;
@@ -11,9 +11,9 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
11
11
  if (typeAndSelection.type === 'input') {
12
12
  return typeAndSelection.selection;
13
13
  } else if (typeAndSelection.type === 'contenteditable') {
14
- var ref;
14
+ var _typeAndSelection_selection;
15
15
  // Multi-range on contenteditable edits the first selection instead of the last
16
- return (ref = typeAndSelection.selection) === null || ref === void 0 ? void 0 : ref.getRangeAt(0);
16
+ return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === void 0 ? void 0 : _typeAndSelection_selection.getRangeAt(0);
17
17
  }
18
18
  }
19
19
 
@@ -17,6 +17,7 @@ require('../../options.js');
17
17
  /**
18
18
  * Determine which selection logic and selection ranges to consider.
19
19
  */ function getTargetTypeAndSelection(node) {
20
+ var _element, _selection;
20
21
  const element = getElement(node);
21
22
  if (element && selection.hasOwnSelection(element)) {
22
23
  return {
@@ -24,10 +25,10 @@ require('../../options.js');
24
25
  selection: UI.getUISelection(element)
25
26
  };
26
27
  }
27
- const selection$1 = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
28
+ const selection$1 = (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.getSelection();
28
29
  // It is possible to extend a single-range selection into a contenteditable.
29
30
  // This results in the range acting like a range outside of contenteditable.
30
- const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
31
+ const isCE = isContentEditable.getContentEditable(node) && ((_selection = selection$1) === null || _selection === void 0 ? void 0 : _selection.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
31
32
  return {
32
33
  type: isCE ? 'contenteditable' : 'default',
33
34
  selection: selection$1
@@ -15,8 +15,8 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
15
15
 
16
16
  /**
17
17
  * Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
18
- */ function modifySelection({ focusNode , focusOffset }) {
19
- var ref, ref1;
18
+ */ function modifySelection({ focusNode, focusOffset }) {
19
+ var _focusNode_ownerDocument_getSelection, _focusNode_ownerDocument;
20
20
  const typeAndSelection = getTargetTypeAndSelection.getTargetTypeAndSelection(focusNode);
21
21
  if (typeAndSelection.type === 'input') {
22
22
  return UI.setUISelection(focusNode, {
@@ -24,7 +24,7 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
24
24
  focusOffset
25
25
  }, 'modify');
26
26
  }
27
- (ref1 = (ref = focusNode.ownerDocument) === null || ref === void 0 ? void 0 : ref.getSelection()) === null || ref1 === void 0 ? void 0 : ref1.extend(focusNode, focusOffset);
27
+ (_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument === void 0 ? void 0 : (_focusNode_ownerDocument_getSelection = _focusNode_ownerDocument.getSelection()) === null || _focusNode_ownerDocument_getSelection === void 0 ? void 0 : _focusNode_ownerDocument_getSelection.extend(focusNode, focusOffset);
28
28
  }
29
29
 
30
30
  exports.modifySelection = modifySelection;
@@ -13,7 +13,7 @@ require('../../utils/misc/level.js');
13
13
  require('../../options.js');
14
14
  var resolveCaretPosition = require('./resolveCaretPosition.js');
15
15
 
16
- function modifySelectionPerMouseMove(selectionRange, { document , target , node , offset }) {
16
+ function modifySelectionPerMouseMove(selectionRange, { document, target, node, offset }) {
17
17
  const selectionFocus = resolveCaretPosition.resolveCaretPosition({
18
18
  target,
19
19
  node,
@@ -33,6 +33,7 @@ function modifySelectionPerMouseMove(selectionRange, { document , target , node
33
33
  });
34
34
  }
35
35
  } else {
36
+ var _selection, _selection1;
36
37
  const range = selectionRange.cloneRange();
37
38
  const cmp = range.comparePoint(selectionFocus.node, selectionFocus.offset);
38
39
  if (cmp < 0) {
@@ -41,8 +42,8 @@ function modifySelectionPerMouseMove(selectionRange, { document , target , node
41
42
  range.setEnd(selectionFocus.node, selectionFocus.offset);
42
43
  }
43
44
  const selection = document.getSelection();
44
- selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
45
- selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
45
+ (_selection = selection) === null || _selection === void 0 ? void 0 : _selection.removeAllRanges();
46
+ (_selection1 = selection) === null || _selection1 === void 0 ? void 0 : _selection1.addRange(range.cloneRange());
46
47
  }
47
48
  }
48
49