@testing-library/user-event 14.0.0-beta.3 → 14.0.0-beta.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.
- package/dist/index.d.ts +1110 -3
- package/dist/index.js +2826 -8
- package/dist/package.json +1 -0
- package/package.json +6 -30
- package/dist/clipboard/copy.d.ts +0 -2
- package/dist/clipboard/copy.js +0 -36
- package/dist/clipboard/cut.d.ts +0 -2
- package/dist/clipboard/cut.js +0 -42
- package/dist/clipboard/index.d.ts +0 -3
- package/dist/clipboard/index.js +0 -44
- package/dist/clipboard/paste.d.ts +0 -2
- package/dist/clipboard/paste.js +0 -47
- package/dist/convenience/click.d.ts +0 -4
- package/dist/convenience/click.js +0 -52
- package/dist/convenience/hover.d.ts +0 -3
- package/dist/convenience/hover.js +0 -31
- package/dist/convenience/index.d.ts +0 -3
- package/dist/convenience/index.js +0 -44
- package/dist/convenience/tab.d.ts +0 -4
- package/dist/convenience/tab.js +0 -12
- package/dist/document/index.d.ts +0 -10
- package/dist/document/index.js +0 -100
- package/dist/document/interceptor.d.ts +0 -15
- package/dist/document/interceptor.js +0 -37
- package/dist/document/selection.d.ts +0 -27
- package/dist/document/selection.js +0 -90
- package/dist/document/value.d.ts +0 -18
- package/dist/document/value.js +0 -77
- package/dist/keyboard/getEventProps.d.ts +0 -15
- package/dist/keyboard/getEventProps.js +0 -27
- package/dist/keyboard/index.d.ts +0 -7
- package/dist/keyboard/index.js +0 -42
- package/dist/keyboard/keyMap.d.ts +0 -5
- package/dist/keyboard/keyMap.js +0 -119
- package/dist/keyboard/keyboardAction.d.ts +0 -10
- package/dist/keyboard/keyboardAction.js +0 -156
- package/dist/keyboard/parseKeyDef.d.ts +0 -17
- package/dist/keyboard/parseKeyDef.js +0 -61
- package/dist/keyboard/plugins/arrow.d.ts +0 -6
- package/dist/keyboard/plugins/arrow.js +0 -28
- package/dist/keyboard/plugins/character.d.ts +0 -5
- package/dist/keyboard/plugins/character.js +0 -173
- package/dist/keyboard/plugins/combination.d.ts +0 -5
- package/dist/keyboard/plugins/combination.js +0 -19
- package/dist/keyboard/plugins/control.d.ts +0 -6
- package/dist/keyboard/plugins/control.js +0 -52
- package/dist/keyboard/plugins/functional.d.ts +0 -11
- package/dist/keyboard/plugins/functional.js +0 -158
- package/dist/keyboard/plugins/index.d.ts +0 -7
- package/dist/keyboard/plugins/index.js +0 -33
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.d.ts +0 -3
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.js +0 -20
- package/dist/keyboard/shared/index.d.ts +0 -1
- package/dist/keyboard/shared/index.js +0 -18
- package/dist/keyboard/types.d.ts +0 -64
- package/dist/keyboard/types.js +0 -19
- package/dist/options.d.ts +0 -102
- package/dist/options.js +0 -36
- package/dist/pointer/index.d.ts +0 -10
- package/dist/pointer/index.js +0 -56
- package/dist/pointer/keyMap.d.ts +0 -2
- package/dist/pointer/keyMap.js +0 -29
- package/dist/pointer/parseKeyDef.d.ts +0 -6
- package/dist/pointer/parseKeyDef.js +0 -34
- package/dist/pointer/pointerAction.d.ts +0 -7
- package/dist/pointer/pointerAction.js +0 -46
- package/dist/pointer/pointerMove.d.ts +0 -6
- package/dist/pointer/pointerMove.js +0 -136
- package/dist/pointer/pointerPress.d.ts +0 -8
- package/dist/pointer/pointerPress.js +0 -327
- package/dist/pointer/resolveSelectionTarget.d.ts +0 -5
- package/dist/pointer/resolveSelectionTarget.js +0 -75
- package/dist/pointer/types.d.ts +0 -61
- package/dist/pointer/types.js +0 -1
- package/dist/setup/api.d.ts +0 -5
- package/dist/setup/api.js +0 -111
- package/dist/setup/config.d.ts +0 -10
- package/dist/setup/config.js +0 -8
- package/dist/setup/directApi.d.ts +0 -20
- package/dist/setup/directApi.js +0 -95
- package/dist/setup/index.d.ts +0 -30
- package/dist/setup/index.js +0 -27
- package/dist/setup/setup.d.ts +0 -74
- package/dist/setup/setup.js +0 -98
- package/dist/setup/wrapAsync.d.ts +0 -4
- package/dist/setup/wrapAsync.js +0 -15
- package/dist/utility/clear.d.ts +0 -2
- package/dist/utility/clear.js +0 -30
- package/dist/utility/index.d.ts +0 -4
- package/dist/utility/index.js +0 -57
- package/dist/utility/selectOptions.d.ts +0 -3
- package/dist/utility/selectOptions.js +0 -132
- package/dist/utility/type.d.ts +0 -9
- package/dist/utility/type.js +0 -37
- package/dist/utility/upload.d.ts +0 -5
- package/dist/utility/upload.js +0 -64
- package/dist/utils/click/isClickableInput.d.ts +0 -1
- package/dist/utils/click/isClickableInput.js +0 -14
- package/dist/utils/dataTransfer/Blob.d.ts +0 -1
- package/dist/utils/dataTransfer/Blob.js +0 -21
- package/dist/utils/dataTransfer/Clipboard.d.ts +0 -9
- package/dist/utils/dataTransfer/Clipboard.js +0 -188
- package/dist/utils/dataTransfer/DataTransfer.d.ts +0 -2
- package/dist/utils/dataTransfer/DataTransfer.js +0 -158
- package/dist/utils/dataTransfer/FileList.d.ts +0 -1
- package/dist/utils/dataTransfer/FileList.js +0 -23
- package/dist/utils/edit/buildTimeValue.d.ts +0 -1
- package/dist/utils/edit/buildTimeValue.js +0 -44
- package/dist/utils/edit/calculateNewValue.d.ts +0 -14
- package/dist/utils/edit/calculateNewValue.js +0 -46
- package/dist/utils/edit/editInputElement.d.ts +0 -16
- package/dist/utils/edit/editInputElement.js +0 -53
- package/dist/utils/edit/getValue.d.ts +0 -1
- package/dist/utils/edit/getValue.js +0 -23
- package/dist/utils/edit/isContentEditable.d.ts +0 -7
- package/dist/utils/edit/isContentEditable.js +0 -25
- package/dist/utils/edit/isEditable.d.ts +0 -25
- package/dist/utils/edit/isEditable.js +0 -42
- package/dist/utils/edit/isValidDateValue.d.ts +0 -3
- package/dist/utils/edit/isValidDateValue.js +0 -12
- package/dist/utils/edit/isValidInputTimeValue.d.ts +0 -3
- package/dist/utils/edit/isValidInputTimeValue.js +0 -12
- package/dist/utils/edit/maxLength.d.ts +0 -1
- package/dist/utils/edit/maxLength.js +0 -50
- package/dist/utils/edit/prepareInput.d.ts +0 -7
- package/dist/utils/edit/prepareInput.js +0 -77
- package/dist/utils/edit/setFiles.d.ts +0 -12
- package/dist/utils/edit/setFiles.js +0 -72
- package/dist/utils/focus/blur.d.ts +0 -2
- package/dist/utils/focus/blur.js +0 -19
- package/dist/utils/focus/copySelection.d.ts +0 -1
- package/dist/utils/focus/copySelection.js +0 -36
- package/dist/utils/focus/focus.d.ts +0 -2
- package/dist/utils/focus/focus.js +0 -22
- package/dist/utils/focus/getActiveElement.d.ts +0 -1
- package/dist/utils/focus/getActiveElement.js +0 -26
- package/dist/utils/focus/getTabDestination.d.ts +0 -1
- package/dist/utils/focus/getTabDestination.js +0 -84
- package/dist/utils/focus/isFocusable.d.ts +0 -1
- package/dist/utils/focus/isFocusable.js +0 -12
- package/dist/utils/focus/selectAll.d.ts +0 -5
- package/dist/utils/focus/selectAll.js +0 -51
- package/dist/utils/focus/selection.d.ts +0 -42
- package/dist/utils/focus/selection.js +0 -190
- package/dist/utils/focus/selector.d.ts +0 -1
- package/dist/utils/focus/selector.js +0 -8
- package/dist/utils/index.d.ts +0 -38
- package/dist/utils/index.js +0 -499
- package/dist/utils/keyDef/readNextDescriptor.d.ts +0 -19
- package/dist/utils/keyDef/readNextDescriptor.js +0 -102
- package/dist/utils/misc/eventWrapper.d.ts +0 -1
- package/dist/utils/misc/eventWrapper.js +0 -16
- package/dist/utils/misc/findClosest.d.ts +0 -1
- package/dist/utils/misc/findClosest.js +0 -20
- package/dist/utils/misc/getDocumentFromNode.d.ts +0 -1
- package/dist/utils/misc/getDocumentFromNode.js +0 -14
- package/dist/utils/misc/hasFormSubmit.d.ts +0 -1
- package/dist/utils/misc/hasFormSubmit.js +0 -10
- package/dist/utils/misc/hasPointerEvents.d.ts +0 -15
- package/dist/utils/misc/hasPointerEvents.js +0 -24
- package/dist/utils/misc/isDescendantOrSelf.d.ts +0 -1
- package/dist/utils/misc/isDescendantOrSelf.js +0 -20
- package/dist/utils/misc/isDisabled.d.ts +0 -1
- package/dist/utils/misc/isDisabled.js +0 -12
- package/dist/utils/misc/isElementType.d.ts +0 -5
- package/dist/utils/misc/isElementType.js +0 -24
- package/dist/utils/misc/isVisible.d.ts +0 -1
- package/dist/utils/misc/isVisible.js +0 -31
- package/dist/utils/misc/wait.d.ts +0 -1
- package/dist/utils/misc/wait.js +0 -10
- package/dist/utils/pointer/firePointerEvents.d.ts +0 -25
- package/dist/utils/pointer/firePointerEvents.js +0 -110
- package/dist/utils/pointer/mouseButtons.d.ts +0 -12
- package/dist/utils/pointer/mouseButtons.js +0 -45
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isAllSelected = isAllSelected;
|
|
7
|
-
exports.selectAll = selectAll;
|
|
8
|
-
|
|
9
|
-
var _document = require("../../document");
|
|
10
|
-
|
|
11
|
-
var _isContentEditable = require("../edit/isContentEditable");
|
|
12
|
-
|
|
13
|
-
var _isEditable = require("../edit/isEditable");
|
|
14
|
-
|
|
15
|
-
var _isElementType = require("../misc/isElementType");
|
|
16
|
-
|
|
17
|
-
var _selection = require("./selection");
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Expand a selection like the browser does when pressing Ctrl+A.
|
|
21
|
-
*/
|
|
22
|
-
function selectAll(target) {
|
|
23
|
-
var _getContentEditable;
|
|
24
|
-
|
|
25
|
-
if ((0, _isElementType.isElementType)(target, 'textarea') || (0, _isElementType.isElementType)(target, 'input') && target.type in _isEditable.editableInputTypes) {
|
|
26
|
-
return (0, _selection.setSelection)({
|
|
27
|
-
focusNode: target,
|
|
28
|
-
anchorOffset: 0,
|
|
29
|
-
focusOffset: (0, _document.getUIValue)(target).length
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const focusNode = (_getContentEditable = (0, _isContentEditable.getContentEditable)(target)) != null ? _getContentEditable : target.ownerDocument.body;
|
|
34
|
-
(0, _selection.setSelection)({
|
|
35
|
-
focusNode,
|
|
36
|
-
anchorOffset: 0,
|
|
37
|
-
focusOffset: focusNode.childNodes.length
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function isAllSelected(target) {
|
|
42
|
-
var _getContentEditable2;
|
|
43
|
-
|
|
44
|
-
if ((0, _isElementType.isElementType)(target, 'textarea') || (0, _isElementType.isElementType)(target, 'input') && target.type in _isEditable.editableInputTypes) {
|
|
45
|
-
return (0, _document.getUISelection)(target).startOffset === 0 && (0, _document.getUISelection)(target).endOffset === (0, _document.getUIValue)(target).length;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const focusNode = (_getContentEditable2 = (0, _isContentEditable.getContentEditable)(target)) != null ? _getContentEditable2 : target.ownerDocument.body;
|
|
49
|
-
const selection = target.ownerDocument.getSelection();
|
|
50
|
-
return (selection == null ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
51
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { UISelectionRange } from '../../document';
|
|
2
|
-
import { editableInputTypes } from '../edit/isEditable';
|
|
3
|
-
/**
|
|
4
|
-
* Backward-compatible selection.
|
|
5
|
-
*
|
|
6
|
-
* Handles input elements and contenteditable if it only contains a single text node.
|
|
7
|
-
*/
|
|
8
|
-
export declare function setSelectionRange(element: Element, anchorOffset: number, focusOffset: number): void;
|
|
9
|
-
/**
|
|
10
|
-
* Determine if the element has its own selection implementation
|
|
11
|
-
* and does not interact with the Document Selection API.
|
|
12
|
-
*/
|
|
13
|
-
export declare function hasOwnSelection(node: Node): node is HTMLTextAreaElement | (HTMLInputElement & {
|
|
14
|
-
type: editableInputTypes;
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* Reset the Document Selection when moving focus into an element
|
|
18
|
-
* with own selection implementation.
|
|
19
|
-
*/
|
|
20
|
-
export declare function updateSelectionOnFocus(element: Element): void;
|
|
21
|
-
/**
|
|
22
|
-
* Get the range that would be overwritten by input.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getInputRange(focusNode: Node): UISelectionRange | Range | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
27
|
-
*/
|
|
28
|
-
export declare function modifySelection({ focusNode, focusOffset, }: {
|
|
29
|
-
focusNode: Node;
|
|
30
|
-
/** DOM Offset */
|
|
31
|
-
focusOffset: number;
|
|
32
|
-
}): void;
|
|
33
|
-
/**
|
|
34
|
-
* Set the selection
|
|
35
|
-
*/
|
|
36
|
-
export declare function setSelection({ focusNode, focusOffset, anchorNode, anchorOffset, }: {
|
|
37
|
-
anchorNode?: Node;
|
|
38
|
-
/** DOM offset */
|
|
39
|
-
anchorOffset?: number;
|
|
40
|
-
focusNode: Node;
|
|
41
|
-
focusOffset: number;
|
|
42
|
-
}): void;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getInputRange = getInputRange;
|
|
7
|
-
exports.hasOwnSelection = hasOwnSelection;
|
|
8
|
-
exports.modifySelection = modifySelection;
|
|
9
|
-
exports.setSelection = setSelection;
|
|
10
|
-
exports.setSelectionRange = setSelectionRange;
|
|
11
|
-
exports.updateSelectionOnFocus = updateSelectionOnFocus;
|
|
12
|
-
|
|
13
|
-
var _isElementType = require("../misc/isElementType");
|
|
14
|
-
|
|
15
|
-
var _document = require("../../document");
|
|
16
|
-
|
|
17
|
-
var _isEditable = require("../edit/isEditable");
|
|
18
|
-
|
|
19
|
-
var _isContentEditable = require("../edit/isContentEditable");
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Backward-compatible selection.
|
|
23
|
-
*
|
|
24
|
-
* Handles input elements and contenteditable if it only contains a single text node.
|
|
25
|
-
*/
|
|
26
|
-
function setSelectionRange(element, anchorOffset, focusOffset) {
|
|
27
|
-
var _element$firstChild;
|
|
28
|
-
|
|
29
|
-
if (hasOwnSelection(element)) {
|
|
30
|
-
return setSelection({
|
|
31
|
-
focusNode: element,
|
|
32
|
-
anchorOffset,
|
|
33
|
-
focusOffset
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/* istanbul ignore else */
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if ((0, _isContentEditable.isContentEditable)(element) && ((_element$firstChild = element.firstChild) == null ? void 0 : _element$firstChild.nodeType) === 3) {
|
|
40
|
-
return setSelection({
|
|
41
|
-
focusNode: element.firstChild,
|
|
42
|
-
anchorOffset,
|
|
43
|
-
focusOffset
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/* istanbul ignore next */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
throw new Error('Not implemented. The result of this interaction is unreliable.');
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Determine if the element has its own selection implementation
|
|
53
|
-
* and does not interact with the Document Selection API.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function hasOwnSelection(node) {
|
|
58
|
-
return isElement(node) && ((0, _isElementType.isElementType)(node, 'textarea') || (0, _isElementType.isElementType)(node, 'input') && node.type in _isEditable.editableInputTypes);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function isElement(node) {
|
|
62
|
-
return node.nodeType === 1;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Determine which selection logic and selection ranges to consider.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function getTargetTypeAndSelection(node) {
|
|
70
|
-
const element = getElement(node);
|
|
71
|
-
|
|
72
|
-
if (element && hasOwnSelection(element)) {
|
|
73
|
-
return {
|
|
74
|
-
type: 'input',
|
|
75
|
-
selection: (0, _document.getUISelection)(element)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const selection = element == null ? void 0 : element.ownerDocument.getSelection(); // It is possible to extend a single-range selection into a contenteditable.
|
|
80
|
-
// This results in the range acting like a range outside of contenteditable.
|
|
81
|
-
|
|
82
|
-
const isCE = (0, _isContentEditable.getContentEditable)(node) && (selection == null ? void 0 : selection.anchorNode) && (0, _isContentEditable.getContentEditable)(selection.anchorNode);
|
|
83
|
-
return {
|
|
84
|
-
type: isCE ? 'contenteditable' : 'default',
|
|
85
|
-
selection
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function getElement(node) {
|
|
90
|
-
return node.nodeType === 1 ? node : node.parentElement;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Reset the Document Selection when moving focus into an element
|
|
94
|
-
* with own selection implementation.
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function updateSelectionOnFocus(element) {
|
|
99
|
-
const selection = element.ownerDocument.getSelection();
|
|
100
|
-
/* istanbul ignore if */
|
|
101
|
-
|
|
102
|
-
if (!(selection != null && selection.focusNode)) {
|
|
103
|
-
return;
|
|
104
|
-
} // If the focus moves inside an element with own selection implementation,
|
|
105
|
-
// the document selection will be this element.
|
|
106
|
-
// But if the focused element is inside a contenteditable,
|
|
107
|
-
// 1) a collapsed selection will be retained.
|
|
108
|
-
// 2) other selections will be replaced by a cursor
|
|
109
|
-
// 2.a) at the start of the first child if it is a text node
|
|
110
|
-
// 2.b) at the start of the contenteditable.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (hasOwnSelection(element)) {
|
|
114
|
-
const contenteditable = (0, _isContentEditable.getContentEditable)(selection.focusNode);
|
|
115
|
-
|
|
116
|
-
if (contenteditable) {
|
|
117
|
-
if (!selection.isCollapsed) {
|
|
118
|
-
var _contenteditable$firs;
|
|
119
|
-
|
|
120
|
-
const focusNode = ((_contenteditable$firs = contenteditable.firstChild) == null ? void 0 : _contenteditable$firs.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
|
|
121
|
-
selection.setBaseAndExtent(focusNode, 0, focusNode, 0);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
selection.setBaseAndExtent(element, 0, element, 0);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Get the range that would be overwritten by input.
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
function getInputRange(focusNode) {
|
|
134
|
-
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
135
|
-
|
|
136
|
-
if (typeAndSelection.type === 'input') {
|
|
137
|
-
return typeAndSelection.selection;
|
|
138
|
-
} else if (typeAndSelection.type === 'contenteditable') {
|
|
139
|
-
var _typeAndSelection$sel;
|
|
140
|
-
|
|
141
|
-
// Multi-range on contenteditable edits the first selection instead of the last
|
|
142
|
-
return (_typeAndSelection$sel = typeAndSelection.selection) == null ? void 0 : _typeAndSelection$sel.getRangeAt(0);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
function modifySelection({
|
|
151
|
-
focusNode,
|
|
152
|
-
focusOffset
|
|
153
|
-
}) {
|
|
154
|
-
var _focusNode$ownerDocum, _focusNode$ownerDocum2;
|
|
155
|
-
|
|
156
|
-
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
157
|
-
|
|
158
|
-
if (typeAndSelection.type === 'input') {
|
|
159
|
-
return (0, _document.setUISelection)(focusNode, {
|
|
160
|
-
anchorOffset: typeAndSelection.selection.anchorOffset,
|
|
161
|
-
focusOffset
|
|
162
|
-
}, 'modify');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
(_focusNode$ownerDocum = focusNode.ownerDocument) == null ? void 0 : (_focusNode$ownerDocum2 = _focusNode$ownerDocum.getSelection()) == null ? void 0 : _focusNode$ownerDocum2.extend(focusNode, focusOffset);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Set the selection
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
function setSelection({
|
|
173
|
-
focusNode,
|
|
174
|
-
focusOffset,
|
|
175
|
-
anchorNode = focusNode,
|
|
176
|
-
anchorOffset = focusOffset
|
|
177
|
-
}) {
|
|
178
|
-
var _anchorNode$ownerDocu, _anchorNode$ownerDocu2;
|
|
179
|
-
|
|
180
|
-
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
181
|
-
|
|
182
|
-
if (typeAndSelection.type === 'input') {
|
|
183
|
-
return (0, _document.setUISelection)(focusNode, {
|
|
184
|
-
anchorOffset,
|
|
185
|
-
focusOffset
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
(_anchorNode$ownerDocu = anchorNode.ownerDocument) == null ? void 0 : (_anchorNode$ownerDocu2 = _anchorNode$ownerDocu.getSelection()) == null ? void 0 : _anchorNode$ownerDocu2.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
190
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FOCUSABLE_SELECTOR: string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FOCUSABLE_SELECTOR = void 0;
|
|
7
|
-
const FOCUSABLE_SELECTOR = ['input:not([type=hidden]):not([disabled])', 'button:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', '[contenteditable=""]', '[contenteditable="true"]', 'a[href]', '[tabindex]:not([disabled])'].join(', ');
|
|
8
|
-
exports.FOCUSABLE_SELECTOR = FOCUSABLE_SELECTOR;
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export * from './click/isClickableInput';
|
|
2
|
-
export * from './dataTransfer/Blob';
|
|
3
|
-
export * from './dataTransfer/DataTransfer';
|
|
4
|
-
export * from './dataTransfer/FileList';
|
|
5
|
-
export * from './dataTransfer/Clipboard';
|
|
6
|
-
export * from './edit/buildTimeValue';
|
|
7
|
-
export * from './edit/calculateNewValue';
|
|
8
|
-
export * from './edit/editInputElement';
|
|
9
|
-
export * from './edit/getValue';
|
|
10
|
-
export * from './edit/isContentEditable';
|
|
11
|
-
export * from './edit/isEditable';
|
|
12
|
-
export * from './edit/isValidDateValue';
|
|
13
|
-
export * from './edit/isValidInputTimeValue';
|
|
14
|
-
export * from './edit/maxLength';
|
|
15
|
-
export * from './edit/prepareInput';
|
|
16
|
-
export * from './edit/setFiles';
|
|
17
|
-
export * from './focus/blur';
|
|
18
|
-
export * from './focus/copySelection';
|
|
19
|
-
export * from './focus/focus';
|
|
20
|
-
export * from './focus/getActiveElement';
|
|
21
|
-
export * from './focus/getTabDestination';
|
|
22
|
-
export * from './focus/isFocusable';
|
|
23
|
-
export * from './focus/selectAll';
|
|
24
|
-
export * from './focus/selection';
|
|
25
|
-
export * from './focus/selector';
|
|
26
|
-
export * from './keyDef/readNextDescriptor';
|
|
27
|
-
export * from './misc/eventWrapper';
|
|
28
|
-
export * from './misc/findClosest';
|
|
29
|
-
export * from './misc/getDocumentFromNode';
|
|
30
|
-
export * from './misc/isDescendantOrSelf';
|
|
31
|
-
export * from './misc/isElementType';
|
|
32
|
-
export * from './misc/isVisible';
|
|
33
|
-
export * from './misc/isDisabled';
|
|
34
|
-
export * from './misc/wait';
|
|
35
|
-
export * from './misc/hasPointerEvents';
|
|
36
|
-
export * from './misc/hasFormSubmit';
|
|
37
|
-
export * from './pointer/firePointerEvents';
|
|
38
|
-
export * from './pointer/mouseButtons';
|