@testing-library/user-event 13.5.0 → 14.0.0-alpha.4

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 (100) hide show
  1. package/README.md +3 -0
  2. package/dist/clear.d.ts +2 -2
  3. package/dist/clear.js +1 -3
  4. package/dist/click.d.ts +3 -3
  5. package/dist/click.js +13 -144
  6. package/dist/document/index.d.ts +9 -0
  7. package/dist/document/index.js +100 -0
  8. package/dist/document/interceptor.d.ts +15 -0
  9. package/dist/document/interceptor.js +37 -0
  10. package/dist/document/selection.d.ts +17 -0
  11. package/dist/document/selection.js +64 -0
  12. package/dist/document/value.d.ts +18 -0
  13. package/dist/document/value.js +77 -0
  14. package/dist/hover.d.ts +3 -3
  15. package/dist/hover.js +15 -57
  16. package/dist/index.d.ts +4 -21
  17. package/dist/index.js +4 -29
  18. package/dist/keyboard/getNextKeyDef.js +3 -92
  19. package/dist/keyboard/index.d.ts +1 -0
  20. package/dist/keyboard/index.js +4 -0
  21. package/dist/keyboard/keyMap.js +4 -0
  22. package/dist/keyboard/plugins/character.js +8 -18
  23. package/dist/keyboard/plugins/control.js +3 -6
  24. package/dist/keyboard/plugins/functional.js +20 -6
  25. package/dist/keyboard/plugins/index.js +2 -4
  26. package/dist/keyboard/shared/index.d.ts +0 -2
  27. package/dist/keyboard/shared/index.js +0 -26
  28. package/dist/keyboard/types.d.ts +3 -0
  29. package/dist/paste.d.ts +3 -2
  30. package/dist/pointer/index.d.ts +18 -0
  31. package/dist/pointer/index.js +90 -0
  32. package/dist/pointer/keyMap.d.ts +2 -0
  33. package/dist/pointer/keyMap.js +29 -0
  34. package/dist/pointer/parseKeyDef.d.ts +6 -0
  35. package/dist/pointer/parseKeyDef.js +36 -0
  36. package/dist/pointer/pointerAction.d.ts +6 -0
  37. package/dist/pointer/pointerAction.js +52 -0
  38. package/dist/pointer/pointerMove.d.ts +5 -0
  39. package/dist/pointer/pointerMove.js +125 -0
  40. package/dist/pointer/pointerPress.d.ts +7 -0
  41. package/dist/pointer/pointerPress.js +328 -0
  42. package/dist/pointer/resolveSelectionTarget.d.ts +5 -0
  43. package/dist/pointer/resolveSelectionTarget.js +74 -0
  44. package/dist/pointer/types.d.ts +72 -0
  45. package/dist/pointer/types.js +1 -0
  46. package/dist/selectOptions.d.ts +4 -0
  47. package/dist/{select-options.js → selectOptions.js} +18 -20
  48. package/dist/setup.d.ts +89 -0
  49. package/dist/setup.js +206 -0
  50. package/dist/tab.d.ts +3 -3
  51. package/dist/tab.js +18 -97
  52. package/dist/type.d.ts +14 -0
  53. package/dist/type.js +74 -0
  54. package/dist/upload.d.ts +4 -3
  55. package/dist/upload.js +3 -9
  56. package/dist/{keyboard/shared → utils/edit}/fireInputEvent.d.ts +0 -9
  57. package/dist/utils/edit/fireInputEvent.js +59 -0
  58. package/dist/utils/edit/getValue.d.ts +1 -1
  59. package/dist/utils/edit/getValue.js +3 -1
  60. package/dist/utils/edit/selectionRange.d.ts +0 -11
  61. package/dist/utils/edit/selectionRange.js +9 -49
  62. package/dist/{blur.d.ts → utils/focus/blur.d.ts} +0 -0
  63. package/dist/utils/focus/blur.js +19 -0
  64. package/dist/{focus.d.ts → utils/focus/focus.d.ts} +0 -0
  65. package/dist/utils/focus/focus.js +19 -0
  66. package/dist/utils/focus/getTabDestination.d.ts +1 -0
  67. package/dist/utils/focus/getTabDestination.js +72 -0
  68. package/dist/utils/focus/isFocusable.js +1 -3
  69. package/dist/utils/index.d.ts +10 -3
  70. package/dist/utils/index.js +120 -29
  71. package/dist/utils/keyDef/readNextDescriptor.d.ts +19 -0
  72. package/dist/utils/keyDef/readNextDescriptor.js +102 -0
  73. package/dist/utils/misc/findClosest.d.ts +1 -0
  74. package/dist/utils/misc/findClosest.js +20 -0
  75. package/dist/utils/misc/isDescendantOrSelf.d.ts +1 -0
  76. package/dist/utils/misc/isDescendantOrSelf.js +20 -0
  77. package/dist/utils/pointer/fakeEvent.d.ts +20 -0
  78. package/dist/utils/pointer/fakeEvent.js +91 -0
  79. package/dist/utils/pointer/firePointerEvents.d.ts +14 -0
  80. package/dist/utils/pointer/firePointerEvents.js +55 -0
  81. package/dist/utils/pointer/mouseButtons.d.ts +12 -0
  82. package/dist/utils/pointer/mouseButtons.js +45 -0
  83. package/package.json +4 -3
  84. package/dist/blur.js +0 -15
  85. package/dist/dom-helpers.d.ts +0 -3
  86. package/dist/focus.js +0 -15
  87. package/dist/keyboard/shared/carryValue.d.ts +0 -2
  88. package/dist/keyboard/shared/carryValue.js +0 -13
  89. package/dist/keyboard/shared/fireInputEvent.js +0 -110
  90. package/dist/select-options.d.ts +0 -4
  91. package/dist/type/index.d.ts +0 -7
  92. package/dist/type/index.js +0 -33
  93. package/dist/type/typeImplementation.d.ts +0 -10
  94. package/dist/type/typeImplementation.js +0 -64
  95. package/dist/utils/click/getMouseEventOptions.d.ts +0 -31
  96. package/dist/utils/click/getMouseEventOptions.js +0 -61
  97. package/dist/utils/edit/hasUnreliableEmptyValue.d.ts +0 -10
  98. package/dist/utils/edit/hasUnreliableEmptyValue.js +0 -21
  99. package/dist/utils/misc/isLabelWithInternallyDisabledControl.d.ts +0 -1
  100. package/dist/utils/misc/isLabelWithInternallyDisabledControl.js +0 -22
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fireInputEvent = fireInputEvent;
7
+
8
+ var _dom = require("@testing-library/dom");
9
+
10
+ var _isElementType = require("../misc/isElementType");
11
+
12
+ var _document = require("../../document");
13
+
14
+ var _isContentEditable = require("./isContentEditable");
15
+
16
+ var _selectionRange = require("./selectionRange");
17
+
18
+ function fireInputEvent(element, {
19
+ newValue,
20
+ newSelectionStart,
21
+ eventOverrides
22
+ }) {
23
+ const oldValue = element.value; // apply the changes before firing the input event, so that input handlers can access the altered dom and selection
24
+
25
+ if ((0, _isContentEditable.isContentEditable)(element)) {
26
+ element.textContent = newValue;
27
+ } else {
28
+ // The pre-commit hooks keeps changing this
29
+ // See https://github.com/kentcdodds/kcd-scripts/issues/218
30
+
31
+ /* istanbul ignore else */
32
+ // eslint-disable-next-line no-lonely-if
33
+ if ((0, _isElementType.isElementType)(element, ['input', 'textarea'])) {
34
+ (0, _document.setUIValue)(element, newValue);
35
+ } else {
36
+ // TODO: properly type guard
37
+ throw new Error('Invalid Element');
38
+ }
39
+ }
40
+
41
+ (0, _selectionRange.setSelectionRange)(element, newSelectionStart, newSelectionStart); // When the input event happens in the browser, React executes all event handlers
42
+ // and if they change state of a controlled value, nothing happens.
43
+ // But when we trigger the event handlers in test environment,
44
+ // the changes are rolled back by React before the state update is applied.
45
+ // Then the updated state is applied which results in a resetted cursor.
46
+ // There is probably a better way to work around if we figure out
47
+ // why the batched update is executed differently in our test environment.
48
+
49
+ (0, _document.startTrackValue)(element);
50
+
51
+ _dom.fireEvent.input(element, { ...eventOverrides
52
+ });
53
+
54
+ const tracked = (0, _document.endTrackValue)(element);
55
+
56
+ if ((tracked == null ? void 0 : tracked.length) === 2 && tracked[0] === oldValue && tracked[1] === newValue) {
57
+ (0, _selectionRange.setSelectionRange)(element, newSelectionStart, newSelectionStart);
58
+ }
59
+ }
@@ -1 +1 @@
1
- export declare function getValue(element: Element | null): string | null;
1
+ export declare function getValue<T extends Element | null>(element: T): T extends HTMLInputElement | HTMLTextAreaElement ? string : string | null;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getValue = getValue;
7
7
 
8
+ var _document = require("../../document");
9
+
8
10
  var _isContentEditable = require("./isContentEditable");
9
11
 
10
12
  function getValue(element) {
@@ -17,5 +19,5 @@ function getValue(element) {
17
19
  return element.textContent;
18
20
  }
19
21
 
20
- return element.value;
22
+ return (0, _document.getUIValue)(element);
21
23
  }
@@ -1,16 +1,5 @@
1
- declare enum selectionSupportType {
2
- 'text' = "text",
3
- 'search' = "search",
4
- 'url' = "url",
5
- 'tel' = "tel",
6
- 'password' = "password"
7
- }
8
- export declare function hasSelectionSupport(element: Element): element is HTMLTextAreaElement | (HTMLInputElement & {
9
- type: selectionSupportType;
10
- });
11
1
  export declare function getSelectionRange(element: Element): {
12
2
  selectionStart: number | null;
13
3
  selectionEnd: number | null;
14
4
  };
15
5
  export declare function setSelectionRange(element: Element, newSelectionStart: number, newSelectionEnd: number): void;
16
- export {};
@@ -4,43 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSelectionRange = getSelectionRange;
7
- exports.hasSelectionSupport = hasSelectionSupport;
8
7
  exports.setSelectionRange = setSelectionRange;
9
8
 
10
9
  var _isElementType = require("../misc/isElementType");
11
10
 
12
- // https://github.com/jsdom/jsdom/blob/c2fb8ff94917a4d45e2398543f5dd2a8fed0bdab/lib/jsdom/living/nodes/HTMLInputElement-impl.js#L45
13
- var selectionSupportType;
14
-
15
- (function (selectionSupportType) {
16
- selectionSupportType["text"] = "text";
17
- selectionSupportType["search"] = "search";
18
- selectionSupportType["url"] = "url";
19
- selectionSupportType["tel"] = "tel";
20
- selectionSupportType["password"] = "password";
21
- })(selectionSupportType || (selectionSupportType = {}));
22
-
23
- const InputSelection = Symbol('inputSelection');
24
-
25
- function hasSelectionSupport(element) {
26
- return (0, _isElementType.isElementType)(element, 'textarea') || (0, _isElementType.isElementType)(element, 'input') && Boolean(selectionSupportType[element.type]);
27
- }
11
+ var _document = require("../../document");
28
12
 
29
13
  function getSelectionRange(element) {
30
- if (hasSelectionSupport(element)) {
31
- return {
32
- selectionStart: element.selectionStart,
33
- selectionEnd: element.selectionEnd
34
- };
35
- }
36
-
37
- if ((0, _isElementType.isElementType)(element, 'input')) {
38
- var _InputSelection;
39
-
40
- return (_InputSelection = element[InputSelection]) != null ? _InputSelection : {
41
- selectionStart: null,
42
- selectionEnd: null
43
- };
14
+ if ((0, _isElementType.isElementType)(element, ['input', 'textarea'])) {
15
+ return (0, _document.getUISelection)(element);
44
16
  }
45
17
 
46
18
  const selection = element.ownerDocument.getSelection(); // there should be no editing if the focusNode is outside of element
@@ -61,32 +33,20 @@ function getSelectionRange(element) {
61
33
  }
62
34
 
63
35
  function setSelectionRange(element, newSelectionStart, newSelectionEnd) {
36
+ if ((0, _isElementType.isElementType)(element, ['input', 'textarea'])) {
37
+ return (0, _document.setUISelection)(element, newSelectionStart, newSelectionEnd);
38
+ }
39
+
64
40
  const {
65
41
  selectionStart,
66
42
  selectionEnd
67
- } = getSelectionRange(element);
43
+ } = getSelectionRange(element); // Prevent unnecessary select events
44
+ // istanbul ignore next
68
45
 
69
46
  if (selectionStart === newSelectionStart && selectionEnd === newSelectionEnd) {
70
47
  return;
71
48
  }
72
49
 
73
- if (hasSelectionSupport(element)) {
74
- element.setSelectionRange(newSelectionStart, newSelectionEnd);
75
- }
76
-
77
- if ((0, _isElementType.isElementType)(element, 'input')) {
78
- ;
79
- element[InputSelection] = {
80
- selectionStart: newSelectionStart,
81
- selectionEnd: newSelectionEnd
82
- };
83
- } // Moving the selection inside <input> or <textarea> does not alter the document Selection.
84
-
85
-
86
- if ((0, _isElementType.isElementType)(element, 'input') || (0, _isElementType.isElementType)(element, 'textarea')) {
87
- return;
88
- }
89
-
90
50
  const range = element.ownerDocument.createRange();
91
51
  range.selectNodeContents(element); // istanbul ignore else
92
52
 
File without changes
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.blur = blur;
7
+
8
+ var _eventWrapper = require("../misc/eventWrapper");
9
+
10
+ var _getActiveElement = require("./getActiveElement");
11
+
12
+ var _isFocusable = require("./isFocusable");
13
+
14
+ function blur(element) {
15
+ if (!(0, _isFocusable.isFocusable)(element)) return;
16
+ const wasActive = (0, _getActiveElement.getActiveElement)(element.ownerDocument) === element;
17
+ if (!wasActive) return;
18
+ (0, _eventWrapper.eventWrapper)(() => element.blur());
19
+ }
File without changes
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.focus = focus;
7
+
8
+ var _eventWrapper = require("../misc/eventWrapper");
9
+
10
+ var _getActiveElement = require("./getActiveElement");
11
+
12
+ var _isFocusable = require("./isFocusable");
13
+
14
+ function focus(element) {
15
+ if (!(0, _isFocusable.isFocusable)(element)) return;
16
+ const isAlreadyActive = (0, _getActiveElement.getActiveElement)(element.ownerDocument) === element;
17
+ if (isAlreadyActive) return;
18
+ (0, _eventWrapper.eventWrapper)(() => element.focus());
19
+ }
@@ -0,0 +1 @@
1
+ export declare function getTabDestination(activeElement: Element, shift: boolean, focusTrap: Document | Element): Element;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTabDestination = getTabDestination;
7
+
8
+ var _isDisabled = require("../misc/isDisabled");
9
+
10
+ var _isDocument = require("../misc/isDocument");
11
+
12
+ var _isElementType = require("../misc/isElementType");
13
+
14
+ var _isVisible = require("../misc/isVisible");
15
+
16
+ var _selector = require("./selector");
17
+
18
+ function getTabDestination(activeElement, shift, focusTrap) {
19
+ const focusableElements = focusTrap.querySelectorAll(_selector.FOCUSABLE_SELECTOR);
20
+ const enabledElements = Array.from(focusableElements).filter(el => el === activeElement || el.getAttribute('tabindex') !== '-1' && !(0, _isDisabled.isDisabled)(el) && // Hidden elements are not tabable
21
+ (0, _isVisible.isVisible)(el));
22
+
23
+ if (activeElement.getAttribute('tabindex') !== '-1') {
24
+ // tabindex has no effect if the active element has tabindex="-1"
25
+ enabledElements.sort((a, b) => Number(a.getAttribute('tabindex')) - Number(b.getAttribute('tabindex')));
26
+ }
27
+
28
+ const checkedRadio = {};
29
+ let prunedElements = (0, _isDocument.isDocument)(focusTrap) ? [focusTrap.body] : [];
30
+ const activeRadioGroup = (0, _isElementType.isElementType)(activeElement, 'input', {
31
+ type: 'radio'
32
+ }) ? activeElement.name : undefined;
33
+ enabledElements.forEach(currentElement => {
34
+ const el = currentElement; // For radio groups keep only the active radio
35
+ // If there is no active radio, keep only the checked radio
36
+ // If there is no checked radio, treat like everything else
37
+
38
+ if ((0, _isElementType.isElementType)(el, 'input', {
39
+ type: 'radio'
40
+ }) && el.name) {
41
+ // If the active element is part of the group, add only that
42
+ if (el === activeElement) {
43
+ prunedElements.push(el);
44
+ return;
45
+ } else if (el.name === activeRadioGroup) {
46
+ return;
47
+ } // If we stumble upon a checked radio, remove the others
48
+
49
+
50
+ if (el.checked) {
51
+ prunedElements = prunedElements.filter(e => !(0, _isElementType.isElementType)(e, 'input', {
52
+ type: 'radio',
53
+ name: el.name
54
+ }));
55
+ prunedElements.push(el);
56
+ checkedRadio[el.name] = el;
57
+ return;
58
+ } // If we already found the checked one, skip
59
+
60
+
61
+ if (typeof checkedRadio[el.name] !== 'undefined') {
62
+ return;
63
+ }
64
+ }
65
+
66
+ prunedElements.push(el);
67
+ });
68
+ const currentIndex = prunedElements.findIndex(el => el === activeElement);
69
+ const nextIndex = shift ? currentIndex - 1 : currentIndex + 1;
70
+ const defaultIndex = shift ? prunedElements.length - 1 : 0;
71
+ return prunedElements[nextIndex] || prunedElements[defaultIndex];
72
+ }
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isFocusable = isFocusable;
7
7
 
8
- var _isLabelWithInternallyDisabledControl = require("../misc/isLabelWithInternallyDisabledControl");
9
-
10
8
  var _selector = require("./selector");
11
9
 
12
10
  function isFocusable(element) {
13
- return !(0, _isLabelWithInternallyDisabledControl.isLabelWithInternallyDisabledControl)(element) && element.matches(_selector.FOCUSABLE_SELECTOR);
11
+ return element.matches(_selector.FOCUSABLE_SELECTOR);
14
12
  }
@@ -1,25 +1,32 @@
1
- export * from './click/getMouseEventOptions';
2
1
  export * from './click/isClickableInput';
3
2
  export * from './edit/buildTimeValue';
4
3
  export * from './edit/calculateNewValue';
5
4
  export * from './edit/cursorPosition';
5
+ export * from './edit/fireInputEvent';
6
6
  export * from './edit/getValue';
7
- export * from './edit/hasUnreliableEmptyValue';
8
7
  export * from './edit/isContentEditable';
9
8
  export * from './edit/isEditable';
10
9
  export * from './edit/isValidDateValue';
11
10
  export * from './edit/isValidInputTimeValue';
12
11
  export * from './edit/maxLength';
13
12
  export * from './edit/selectionRange';
13
+ export * from './focus/blur';
14
+ export * from './focus/focus';
14
15
  export * from './focus/getActiveElement';
16
+ export * from './focus/getTabDestination';
15
17
  export * from './focus/isFocusable';
16
18
  export * from './focus/selector';
19
+ export * from './keyDef/readNextDescriptor';
17
20
  export * from './misc/eventWrapper';
21
+ export * from './misc/findClosest';
22
+ export * from './misc/isDescendantOrSelf';
18
23
  export * from './misc/isElementType';
19
- export * from './misc/isLabelWithInternallyDisabledControl';
20
24
  export * from './misc/isVisible';
21
25
  export * from './misc/isDisabled';
22
26
  export * from './misc/isDocument';
23
27
  export * from './misc/wait';
24
28
  export * from './misc/hasPointerEvents';
25
29
  export * from './misc/hasFormSubmit';
30
+ export * from './pointer/fakeEvent';
31
+ export * from './pointer/firePointerEvents';
32
+ export * from './pointer/mouseButtons';
@@ -4,19 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var _getMouseEventOptions = require("./click/getMouseEventOptions");
8
-
9
- Object.keys(_getMouseEventOptions).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _getMouseEventOptions[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _getMouseEventOptions[key];
16
- }
17
- });
18
- });
19
-
20
7
  var _isClickableInput = require("./click/isClickableInput");
21
8
 
22
9
  Object.keys(_isClickableInput).forEach(function (key) {
@@ -69,28 +56,28 @@ Object.keys(_cursorPosition).forEach(function (key) {
69
56
  });
70
57
  });
71
58
 
72
- var _getValue = require("./edit/getValue");
59
+ var _fireInputEvent = require("./edit/fireInputEvent");
73
60
 
74
- Object.keys(_getValue).forEach(function (key) {
61
+ Object.keys(_fireInputEvent).forEach(function (key) {
75
62
  if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _getValue[key]) return;
63
+ if (key in exports && exports[key] === _fireInputEvent[key]) return;
77
64
  Object.defineProperty(exports, key, {
78
65
  enumerable: true,
79
66
  get: function () {
80
- return _getValue[key];
67
+ return _fireInputEvent[key];
81
68
  }
82
69
  });
83
70
  });
84
71
 
85
- var _hasUnreliableEmptyValue = require("./edit/hasUnreliableEmptyValue");
72
+ var _getValue = require("./edit/getValue");
86
73
 
87
- Object.keys(_hasUnreliableEmptyValue).forEach(function (key) {
74
+ Object.keys(_getValue).forEach(function (key) {
88
75
  if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _hasUnreliableEmptyValue[key]) return;
76
+ if (key in exports && exports[key] === _getValue[key]) return;
90
77
  Object.defineProperty(exports, key, {
91
78
  enumerable: true,
92
79
  get: function () {
93
- return _hasUnreliableEmptyValue[key];
80
+ return _getValue[key];
94
81
  }
95
82
  });
96
83
  });
@@ -173,6 +160,32 @@ Object.keys(_selectionRange).forEach(function (key) {
173
160
  });
174
161
  });
175
162
 
163
+ var _blur = require("./focus/blur");
164
+
165
+ Object.keys(_blur).forEach(function (key) {
166
+ if (key === "default" || key === "__esModule") return;
167
+ if (key in exports && exports[key] === _blur[key]) return;
168
+ Object.defineProperty(exports, key, {
169
+ enumerable: true,
170
+ get: function () {
171
+ return _blur[key];
172
+ }
173
+ });
174
+ });
175
+
176
+ var _focus = require("./focus/focus");
177
+
178
+ Object.keys(_focus).forEach(function (key) {
179
+ if (key === "default" || key === "__esModule") return;
180
+ if (key in exports && exports[key] === _focus[key]) return;
181
+ Object.defineProperty(exports, key, {
182
+ enumerable: true,
183
+ get: function () {
184
+ return _focus[key];
185
+ }
186
+ });
187
+ });
188
+
176
189
  var _getActiveElement = require("./focus/getActiveElement");
177
190
 
178
191
  Object.keys(_getActiveElement).forEach(function (key) {
@@ -186,6 +199,19 @@ Object.keys(_getActiveElement).forEach(function (key) {
186
199
  });
187
200
  });
188
201
 
202
+ var _getTabDestination = require("./focus/getTabDestination");
203
+
204
+ Object.keys(_getTabDestination).forEach(function (key) {
205
+ if (key === "default" || key === "__esModule") return;
206
+ if (key in exports && exports[key] === _getTabDestination[key]) return;
207
+ Object.defineProperty(exports, key, {
208
+ enumerable: true,
209
+ get: function () {
210
+ return _getTabDestination[key];
211
+ }
212
+ });
213
+ });
214
+
189
215
  var _isFocusable = require("./focus/isFocusable");
190
216
 
191
217
  Object.keys(_isFocusable).forEach(function (key) {
@@ -212,6 +238,19 @@ Object.keys(_selector).forEach(function (key) {
212
238
  });
213
239
  });
214
240
 
241
+ var _readNextDescriptor = require("./keyDef/readNextDescriptor");
242
+
243
+ Object.keys(_readNextDescriptor).forEach(function (key) {
244
+ if (key === "default" || key === "__esModule") return;
245
+ if (key in exports && exports[key] === _readNextDescriptor[key]) return;
246
+ Object.defineProperty(exports, key, {
247
+ enumerable: true,
248
+ get: function () {
249
+ return _readNextDescriptor[key];
250
+ }
251
+ });
252
+ });
253
+
215
254
  var _eventWrapper = require("./misc/eventWrapper");
216
255
 
217
256
  Object.keys(_eventWrapper).forEach(function (key) {
@@ -225,28 +264,41 @@ Object.keys(_eventWrapper).forEach(function (key) {
225
264
  });
226
265
  });
227
266
 
228
- var _isElementType = require("./misc/isElementType");
267
+ var _findClosest = require("./misc/findClosest");
229
268
 
230
- Object.keys(_isElementType).forEach(function (key) {
269
+ Object.keys(_findClosest).forEach(function (key) {
231
270
  if (key === "default" || key === "__esModule") return;
232
- if (key in exports && exports[key] === _isElementType[key]) return;
271
+ if (key in exports && exports[key] === _findClosest[key]) return;
233
272
  Object.defineProperty(exports, key, {
234
273
  enumerable: true,
235
274
  get: function () {
236
- return _isElementType[key];
275
+ return _findClosest[key];
276
+ }
277
+ });
278
+ });
279
+
280
+ var _isDescendantOrSelf = require("./misc/isDescendantOrSelf");
281
+
282
+ Object.keys(_isDescendantOrSelf).forEach(function (key) {
283
+ if (key === "default" || key === "__esModule") return;
284
+ if (key in exports && exports[key] === _isDescendantOrSelf[key]) return;
285
+ Object.defineProperty(exports, key, {
286
+ enumerable: true,
287
+ get: function () {
288
+ return _isDescendantOrSelf[key];
237
289
  }
238
290
  });
239
291
  });
240
292
 
241
- var _isLabelWithInternallyDisabledControl = require("./misc/isLabelWithInternallyDisabledControl");
293
+ var _isElementType = require("./misc/isElementType");
242
294
 
243
- Object.keys(_isLabelWithInternallyDisabledControl).forEach(function (key) {
295
+ Object.keys(_isElementType).forEach(function (key) {
244
296
  if (key === "default" || key === "__esModule") return;
245
- if (key in exports && exports[key] === _isLabelWithInternallyDisabledControl[key]) return;
297
+ if (key in exports && exports[key] === _isElementType[key]) return;
246
298
  Object.defineProperty(exports, key, {
247
299
  enumerable: true,
248
300
  get: function () {
249
- return _isLabelWithInternallyDisabledControl[key];
301
+ return _isElementType[key];
250
302
  }
251
303
  });
252
304
  });
@@ -327,4 +379,43 @@ Object.keys(_hasFormSubmit).forEach(function (key) {
327
379
  return _hasFormSubmit[key];
328
380
  }
329
381
  });
382
+ });
383
+
384
+ var _fakeEvent = require("./pointer/fakeEvent");
385
+
386
+ Object.keys(_fakeEvent).forEach(function (key) {
387
+ if (key === "default" || key === "__esModule") return;
388
+ if (key in exports && exports[key] === _fakeEvent[key]) return;
389
+ Object.defineProperty(exports, key, {
390
+ enumerable: true,
391
+ get: function () {
392
+ return _fakeEvent[key];
393
+ }
394
+ });
395
+ });
396
+
397
+ var _firePointerEvents = require("./pointer/firePointerEvents");
398
+
399
+ Object.keys(_firePointerEvents).forEach(function (key) {
400
+ if (key === "default" || key === "__esModule") return;
401
+ if (key in exports && exports[key] === _firePointerEvents[key]) return;
402
+ Object.defineProperty(exports, key, {
403
+ enumerable: true,
404
+ get: function () {
405
+ return _firePointerEvents[key];
406
+ }
407
+ });
408
+ });
409
+
410
+ var _mouseButtons = require("./pointer/mouseButtons");
411
+
412
+ Object.keys(_mouseButtons).forEach(function (key) {
413
+ if (key === "default" || key === "__esModule") return;
414
+ if (key in exports && exports[key] === _mouseButtons[key]) return;
415
+ Object.defineProperty(exports, key, {
416
+ enumerable: true,
417
+ get: function () {
418
+ return _mouseButtons[key];
419
+ }
420
+ });
330
421
  });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Read the next key definition from user input
3
+ *
4
+ * Describe key per `{descriptor}` or `[descriptor]`.
5
+ * Everything else will be interpreted as a single character as descriptor - e.g. `a`.
6
+ * Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
7
+ * A previously pressed key can be released per `{/descriptor}`.
8
+ * Keeping the key pressed can be written as `{descriptor>}`.
9
+ * When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
10
+ * You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
11
+ */
12
+ export declare function readNextDescriptor(text: string): {
13
+ consumedLength: number;
14
+ descriptor: string;
15
+ releasePrevious: boolean;
16
+ repeat: number;
17
+ releaseSelf: boolean | undefined;
18
+ type: string;
19
+ };