@testing-library/user-event 14.4.3 → 14.5.1
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/cjs/_interop/dtl.js +27 -0
- package/dist/cjs/_interop/dtlEventMap.js +27 -0
- package/dist/cjs/_interop/dtlHelpers.js +27 -0
- package/dist/cjs/clipboard/copy.js +2 -2
- package/dist/cjs/clipboard/cut.js +2 -2
- package/dist/cjs/clipboard/paste.js +4 -4
- package/dist/cjs/convenience/tab.js +1 -1
- package/dist/cjs/document/UI.js +5 -5
- package/dist/cjs/document/interceptor.js +1 -1
- package/dist/cjs/document/trackValue.js +4 -4
- package/dist/cjs/event/behavior/keydown.js +6 -6
- package/dist/cjs/event/behavior/keypress.js +2 -2
- package/dist/cjs/event/behavior/keyup.js +2 -2
- package/dist/cjs/event/behavior/paste.js +2 -2
- package/dist/cjs/event/createEvent.js +41 -41
- package/dist/cjs/event/dispatchEvent.js +2 -2
- package/dist/cjs/event/eventMap.js +22 -2
- package/dist/cjs/event/focus.js +1 -4
- package/dist/cjs/event/input.js +4 -4
- package/dist/cjs/event/selection/getInputRange.js +2 -2
- package/dist/cjs/event/selection/modifySelection.js +3 -3
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +1 -1
- package/dist/cjs/event/selection/moveSelection.js +5 -5
- package/dist/cjs/event/selection/resolveCaretPosition.js +1 -1
- package/dist/cjs/event/selection/selectAll.js +4 -4
- package/dist/cjs/event/selection/setSelection.js +3 -3
- package/dist/cjs/event/selection/setSelectionPerMouse.js +5 -5
- package/dist/cjs/event/selection/setSelectionRange.js +2 -2
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/cjs/event/wrapEvent.js +23 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/keyboard/index.js +2 -2
- package/dist/cjs/keyboard/parseKeyDef.js +8 -8
- package/dist/cjs/pointer/index.js +11 -11
- package/dist/cjs/pointer/keyMap.js +1 -1
- package/dist/cjs/pointer/parseKeyDef.js +1 -1
- package/dist/cjs/setup/api.js +19 -17
- package/dist/cjs/setup/directApi.js +3 -3
- package/dist/cjs/setup/setup.js +10 -10
- package/dist/cjs/setup/wrapAsync.js +23 -2
- package/dist/cjs/system/index.js +15 -2
- package/dist/cjs/system/keyboard.js +27 -12
- package/dist/cjs/system/pointer/buttons.js +14 -1
- package/dist/cjs/system/pointer/device.js +14 -1
- package/dist/cjs/system/pointer/index.js +34 -17
- package/dist/cjs/system/pointer/mouse.js +33 -19
- package/dist/cjs/system/pointer/pointer.js +24 -8
- package/dist/cjs/system/pointer/shared.js +2 -2
- package/dist/cjs/utility/selectOptions.js +32 -11
- package/dist/cjs/utility/type.js +1 -1
- package/dist/cjs/utility/upload.js +4 -4
- package/dist/cjs/utils/dataTransfer/Clipboard.js +22 -8
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +23 -8
- package/dist/cjs/utils/edit/maxLength.js +2 -2
- package/dist/cjs/utils/edit/setFiles.js +4 -4
- package/dist/cjs/utils/focus/cursor.js +2 -2
- package/dist/cjs/utils/focus/getActiveElement.js +2 -2
- package/dist/cjs/utils/focus/selector.js +1 -1
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
- package/dist/cjs/utils/misc/getWindow.js +23 -2
- package/dist/cjs/utils/misc/isDisabled.js +3 -3
- package/dist/cjs/utils/misc/isVisible.js +1 -1
- package/dist/cjs/utils/misc/wait.js +1 -1
- package/dist/cjs/utils/pointer/cssPointerEvents.js +13 -13
- package/dist/esm/_interop/dtl.js +2 -0
- package/dist/esm/_interop/dtlEventMap.js +2 -0
- package/dist/esm/_interop/dtlHelpers.js +2 -0
- package/dist/esm/clipboard/copy.js +2 -2
- package/dist/esm/clipboard/cut.js +2 -2
- package/dist/esm/clipboard/paste.js +4 -4
- package/dist/esm/convenience/tab.js +1 -1
- package/dist/esm/document/UI.js +5 -5
- package/dist/esm/document/interceptor.js +1 -1
- package/dist/esm/document/trackValue.js +4 -4
- package/dist/esm/event/behavior/keydown.js +6 -6
- package/dist/esm/event/behavior/keypress.js +2 -2
- package/dist/esm/event/behavior/keyup.js +2 -2
- package/dist/esm/event/behavior/paste.js +2 -2
- package/dist/esm/event/createEvent.js +41 -41
- package/dist/esm/event/dispatchEvent.js +2 -2
- package/dist/esm/event/eventMap.js +2 -2
- package/dist/esm/event/focus.js +1 -4
- package/dist/esm/event/input.js +4 -4
- package/dist/esm/event/selection/getInputRange.js +2 -2
- package/dist/esm/event/selection/modifySelection.js +3 -3
- package/dist/esm/event/selection/modifySelectionPerMouse.js +1 -1
- package/dist/esm/event/selection/moveSelection.js +5 -5
- package/dist/esm/event/selection/resolveCaretPosition.js +1 -1
- package/dist/esm/event/selection/selectAll.js +4 -4
- package/dist/esm/event/selection/setSelection.js +3 -3
- package/dist/esm/event/selection/setSelectionPerMouse.js +5 -5
- package/dist/esm/event/selection/setSelectionRange.js +2 -2
- package/dist/esm/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/esm/event/wrapEvent.js +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/keyboard/index.js +2 -2
- package/dist/esm/keyboard/parseKeyDef.js +8 -8
- package/dist/esm/pointer/index.js +11 -11
- package/dist/esm/pointer/keyMap.js +1 -1
- package/dist/esm/pointer/parseKeyDef.js +1 -1
- package/dist/esm/setup/api.js +33 -12
- package/dist/esm/setup/directApi.js +3 -3
- package/dist/esm/setup/setup.js +11 -11
- package/dist/esm/setup/wrapAsync.js +2 -1
- package/dist/esm/system/index.js +15 -2
- package/dist/esm/system/keyboard.js +27 -12
- package/dist/esm/system/pointer/buttons.js +14 -1
- package/dist/esm/system/pointer/device.js +14 -1
- package/dist/esm/system/pointer/index.js +34 -17
- package/dist/esm/system/pointer/mouse.js +33 -19
- package/dist/esm/system/pointer/pointer.js +24 -8
- package/dist/esm/system/pointer/shared.js +2 -2
- package/dist/esm/utility/selectOptions.js +8 -7
- package/dist/esm/utility/type.js +1 -1
- package/dist/esm/utility/upload.js +4 -4
- package/dist/esm/utils/dataTransfer/Clipboard.js +22 -8
- package/dist/esm/utils/dataTransfer/DataTransfer.js +23 -8
- package/dist/esm/utils/edit/maxLength.js +2 -2
- package/dist/esm/utils/edit/setFiles.js +4 -4
- package/dist/esm/utils/focus/cursor.js +2 -2
- package/dist/esm/utils/focus/getActiveElement.js +2 -2
- package/dist/esm/utils/focus/selector.js +1 -1
- package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/esm/utils/misc/getTreeDiff.js +3 -3
- package/dist/esm/utils/misc/getWindow.js +2 -1
- package/dist/esm/utils/misc/isDisabled.js +3 -3
- package/dist/esm/utils/misc/isVisible.js +1 -1
- package/dist/esm/utils/misc/wait.js +1 -1
- package/dist/esm/utils/pointer/cssPointerEvents.js +13 -13
- package/dist/types/_interop/dtl.d.ts +2 -0
- package/dist/types/_interop/dtlEventMap.d.ts +2 -0
- package/dist/types/_interop/dtlHelpers.d.ts +2 -0
- package/dist/types/clipboard/copy.d.ts +1 -1
- package/dist/types/clipboard/cut.d.ts +1 -1
- package/dist/types/clipboard/paste.d.ts +1 -1
- package/dist/types/convenience/click.d.ts +1 -1
- package/dist/types/convenience/hover.d.ts +1 -1
- package/dist/types/convenience/tab.d.ts +1 -1
- package/dist/types/document/UI.d.ts +3 -3
- package/dist/types/document/interceptor.d.ts +3 -3
- package/dist/types/event/behavior/registry.d.ts +1 -1
- package/dist/types/event/createEvent.d.ts +1 -1
- package/dist/types/event/dispatchEvent.d.ts +1 -1
- package/dist/types/event/eventMap.d.ts +8 -0
- package/dist/types/event/input.d.ts +1 -1
- package/dist/types/event/radio.d.ts +1 -1
- package/dist/types/event/selection/index.d.ts +2 -2
- package/dist/types/event/selection/modifySelectionPerMouse.d.ts +1 -1
- package/dist/types/event/selection/setSelectionPerMouse.d.ts +1 -1
- package/dist/types/event/types.d.ts +3 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/keyboard/index.d.ts +1 -1
- package/dist/types/options.d.ts +2 -2
- package/dist/types/pointer/index.d.ts +7 -7
- package/dist/types/setup/api.d.ts +23 -5
- package/dist/types/setup/directApi.d.ts +5 -5
- package/dist/types/setup/setup.d.ts +5 -5
- package/dist/types/system/keyboard.d.ts +2 -2
- package/dist/types/system/pointer/buttons.d.ts +2 -2
- package/dist/types/system/pointer/device.d.ts +1 -1
- package/dist/types/system/pointer/mouse.d.ts +2 -2
- package/dist/types/system/pointer/pointer.d.ts +2 -2
- package/dist/types/utility/clear.d.ts +1 -1
- package/dist/types/utility/selectOptions.d.ts +1 -1
- package/dist/types/utility/type.d.ts +2 -2
- package/dist/types/utility/upload.d.ts +1 -1
- package/dist/types/utils/click/isClickableInput.d.ts +1 -1
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
- package/dist/types/utils/edit/isEditable.d.ts +2 -2
- package/dist/types/utils/edit/maxLength.d.ts +1 -1
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
- package/dist/types/utils/misc/isElementType.d.ts +1 -1
- package/dist/types/utils/misc/level.d.ts +2 -2
- package/dist/types/utils/misc/wait.d.ts +1 -1
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +1 -1
- package/package.json +22 -11
- /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
- /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
|
@@ -8,8 +8,8 @@ function getTreeDiff(a, b) {
|
|
|
8
8
|
treeA.push(el);
|
|
9
9
|
}
|
|
10
10
|
const treeB = [];
|
|
11
|
-
for(let
|
|
12
|
-
treeB.push(
|
|
11
|
+
for(let el = b; el; el = el.parentElement){
|
|
12
|
+
treeB.push(el);
|
|
13
13
|
}
|
|
14
14
|
let i = 0;
|
|
15
15
|
for(;; i++){
|
|
@@ -20,7 +20,7 @@ function getTreeDiff(a, b) {
|
|
|
20
20
|
return [
|
|
21
21
|
treeA.slice(0, treeA.length - i),
|
|
22
22
|
treeB.slice(0, treeB.length - i),
|
|
23
|
-
treeB.slice(treeB.length - i)
|
|
23
|
+
treeB.slice(treeB.length - i)
|
|
24
24
|
];
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -2,10 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom/dist/helpers.js');
|
|
6
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 named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
26
|
+
|
|
27
|
+
const { getWindowFromNode } = named__namespace;
|
|
7
28
|
function getWindow(node) {
|
|
8
|
-
return
|
|
29
|
+
return getWindowFromNode(node);
|
|
9
30
|
}
|
|
10
31
|
|
|
11
32
|
exports.getWindow = getWindow;
|
|
@@ -13,14 +13,14 @@ function isDisabled(element) {
|
|
|
13
13
|
'select',
|
|
14
14
|
'textarea',
|
|
15
15
|
'optgroup',
|
|
16
|
-
'option'
|
|
16
|
+
'option'
|
|
17
17
|
])) {
|
|
18
18
|
if (el.hasAttribute('disabled')) {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
} else if (isElementType.isElementType(el, 'fieldset')) {
|
|
22
|
-
var
|
|
23
|
-
if (el.hasAttribute('disabled') && !((
|
|
22
|
+
var _el_querySelector;
|
|
23
|
+
if (el.hasAttribute('disabled') && !((_el_querySelector = el.querySelector(':scope > legend')) === null || _el_querySelector === void 0 ? void 0 : _el_querySelector.contains(element))) {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
} else if (el.tagName.includes('-')) {
|
|
@@ -7,7 +7,7 @@ var getWindow = require('./getWindow.js');
|
|
|
7
7
|
function isVisible(element) {
|
|
8
8
|
const window = getWindow.getWindow(element);
|
|
9
9
|
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
|
|
10
|
-
const { display
|
|
10
|
+
const { display, visibility } = window.getComputedStyle(el);
|
|
11
11
|
if (display === 'none') {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
@@ -8,8 +8,8 @@ var isElementType = require('../misc/isElementType.js');
|
|
|
8
8
|
var level = require('../misc/level.js');
|
|
9
9
|
|
|
10
10
|
function hasPointerEvents(instance, element) {
|
|
11
|
-
var
|
|
12
|
-
return ((
|
|
11
|
+
var _checkPointerEvents;
|
|
12
|
+
return ((_checkPointerEvents = checkPointerEvents(instance, element)) === null || _checkPointerEvents === void 0 ? void 0 : _checkPointerEvents.pointerEvents) !== 'none';
|
|
13
13
|
}
|
|
14
14
|
function closestPointerEventsDeclaration(element) {
|
|
15
15
|
const window = getWindow.getWindow(element);
|
|
@@ -49,7 +49,7 @@ function assertPointerEvents(instance, element) {
|
|
|
49
49
|
throw new Error([
|
|
50
50
|
`Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`,
|
|
51
51
|
'',
|
|
52
|
-
printTree(declaration.tree)
|
|
52
|
+
printTree(declaration.tree)
|
|
53
53
|
].join('\n'));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -61,17 +61,17 @@ function printTree(tree) {
|
|
|
61
61
|
el.hasAttribute('data-testid') && `(testId=${el.getAttribute('data-testid')})`,
|
|
62
62
|
getLabelDescr(el),
|
|
63
63
|
tree.length > 1 && i === 0 && ' <-- This element declared `pointer-events: none`',
|
|
64
|
-
tree.length > 1 && i === tree.length - 1 && ' <-- Asserted pointer events here'
|
|
64
|
+
tree.length > 1 && i === tree.length - 1 && ' <-- Asserted pointer events here'
|
|
65
65
|
].filter(Boolean).join('')).join('\n');
|
|
66
66
|
}
|
|
67
67
|
function getLabelDescr(element) {
|
|
68
|
-
var
|
|
68
|
+
var _element_labels;
|
|
69
69
|
let label;
|
|
70
70
|
if (element.hasAttribute('aria-label')) {
|
|
71
71
|
label = element.getAttribute('aria-label');
|
|
72
72
|
} else if (element.hasAttribute('aria-labelledby')) {
|
|
73
|
-
var
|
|
74
|
-
label = (
|
|
73
|
+
var _element_ownerDocument_getElementById_textContent, _element_ownerDocument_getElementById;
|
|
74
|
+
label = (_element_ownerDocument_getElementById = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))) === null || _element_ownerDocument_getElementById === void 0 ? void 0 : (_element_ownerDocument_getElementById_textContent = _element_ownerDocument_getElementById.textContent) === null || _element_ownerDocument_getElementById_textContent === void 0 ? void 0 : _element_ownerDocument_getElementById_textContent.trim();
|
|
75
75
|
} else if (isElementType.isElementType(element, [
|
|
76
76
|
'button',
|
|
77
77
|
'input',
|
|
@@ -79,15 +79,15 @@ function getLabelDescr(element) {
|
|
|
79
79
|
'output',
|
|
80
80
|
'progress',
|
|
81
81
|
'select',
|
|
82
|
-
'textarea'
|
|
83
|
-
]) && ((
|
|
82
|
+
'textarea'
|
|
83
|
+
]) && ((_element_labels = element.labels) === null || _element_labels === void 0 ? void 0 : _element_labels.length)) {
|
|
84
84
|
label = Array.from(element.labels).map((el)=>{
|
|
85
|
-
var
|
|
86
|
-
return (
|
|
85
|
+
var _el_textContent;
|
|
86
|
+
return (_el_textContent = el.textContent) === null || _el_textContent === void 0 ? void 0 : _el_textContent.trim();
|
|
87
87
|
}).join('|');
|
|
88
88
|
} else if (isElementType.isElementType(element, 'button')) {
|
|
89
|
-
var
|
|
90
|
-
label = (
|
|
89
|
+
var _element_textContent;
|
|
90
|
+
label = (_element_textContent = element.textContent) === null || _element_textContent === void 0 ? void 0 : _element_textContent.trim();
|
|
91
91
|
}
|
|
92
92
|
label = label === null || label === void 0 ? void 0 : label.replace(/\n/g, ' ');
|
|
93
93
|
if (Number(label === null || label === void 0 ? void 0 : label.length) > 30) {
|
|
@@ -10,8 +10,8 @@ import { copySelection } from '../document/copySelection.js';
|
|
|
10
10
|
|
|
11
11
|
async function copy() {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
15
|
const clipboardData = copySelection(target);
|
|
16
16
|
if (clipboardData.items.length === 0) {
|
|
17
17
|
return;
|
|
@@ -10,8 +10,8 @@ import { copySelection } from '../document/copySelection.js';
|
|
|
10
10
|
|
|
11
11
|
async function cut() {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
15
|
const clipboardData = copySelection(target);
|
|
16
16
|
if (clipboardData.items.length === 0) {
|
|
17
17
|
return;
|
|
@@ -10,10 +10,10 @@ import '../options.js';
|
|
|
10
10
|
|
|
11
11
|
async function paste(clipboardData) {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
15
|
-
var
|
|
16
|
-
const dataTransfer = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
|
+
var _ref;
|
|
16
|
+
const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await readDataTransferFromClipboard(doc).catch(()=>{
|
|
17
17
|
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
18
18
|
});
|
|
19
19
|
this.dispatchUIEvent(target, 'paste', {
|
package/dist/esm/document/UI.js
CHANGED
|
@@ -32,7 +32,7 @@ function getInitialValue(element) {
|
|
|
32
32
|
function setUISelectionRaw(element, selection) {
|
|
33
33
|
element[UISelection] = selection;
|
|
34
34
|
}
|
|
35
|
-
function setUISelection(element, { focusOffset: focusOffsetParam
|
|
35
|
+
function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
|
|
36
36
|
const valueLength = getUIValue(element).length;
|
|
37
37
|
const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
|
|
38
38
|
const anchorOffset = mode === 'replace' || element[UISelection] === undefined ? sanitizeOffset(anchorOffsetParam) : element[UISelection].anchorOffset;
|
|
@@ -58,10 +58,10 @@ function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset:
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function getUISelection(element) {
|
|
61
|
-
var
|
|
62
|
-
const sel = (
|
|
63
|
-
anchorOffset: (
|
|
64
|
-
focusOffset: (
|
|
61
|
+
var _element_selectionStart, _element_selectionEnd, _element_UISelection;
|
|
62
|
+
const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
|
|
63
|
+
anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
|
|
64
|
+
focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
|
|
65
65
|
};
|
|
66
66
|
return {
|
|
67
67
|
...sel,
|
|
@@ -19,7 +19,7 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
19
19
|
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
|
|
20
20
|
}
|
|
21
21
|
function intercept(...args) {
|
|
22
|
-
const { applyNative =false
|
|
22
|
+
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
|
|
23
23
|
const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
|
|
24
24
|
if (target === 'set') {
|
|
25
25
|
realFunc.call(this, realArgs);
|
|
@@ -29,8 +29,8 @@ function startTrackValue(element) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
function trackOrSetValue(element, v) {
|
|
32
|
-
var
|
|
33
|
-
(
|
|
32
|
+
var _element_TrackChanges_tracked, _element_TrackChanges;
|
|
33
|
+
(_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);
|
|
34
34
|
if (!element[TrackChanges]) {
|
|
35
35
|
setUIValueClean(element);
|
|
36
36
|
setUISelection(element, {
|
|
@@ -39,10 +39,10 @@ function trackOrSetValue(element, v) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function commitValueAfterInput(element, cursorOffset) {
|
|
42
|
-
var
|
|
42
|
+
var _changes_tracked;
|
|
43
43
|
const changes = element[TrackChanges];
|
|
44
44
|
element[TrackChanges] = undefined;
|
|
45
|
-
if (!(changes === null || changes === void 0 ? void 0 : (
|
|
45
|
+
if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
@@ -21,9 +21,9 @@ import { walkRadio } from '../radio.js';
|
|
|
21
21
|
import { behavior } from './registry.js';
|
|
22
22
|
|
|
23
23
|
behavior.keydown = (event, target, instance)=>{
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
return (
|
|
24
|
+
var _keydownBehavior_event_key;
|
|
25
|
+
var _keydownBehavior_event_key1;
|
|
26
|
+
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = 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);
|
|
27
27
|
};
|
|
28
28
|
const keydownBehavior = {
|
|
29
29
|
ArrowDown: (event, target, instance)=>{
|
|
@@ -76,9 +76,9 @@ const keydownBehavior = {
|
|
|
76
76
|
'textarea'
|
|
77
77
|
]) || isContentEditable(target)) {
|
|
78
78
|
return ()=>{
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
const newPos = (
|
|
79
|
+
var _getValueOrTextContent;
|
|
80
|
+
var _getValueOrTextContent_length;
|
|
81
|
+
const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== void 0 ? _getValueOrTextContent_length : /* istanbul ignore next */ 0;
|
|
82
82
|
setSelectionRange(target, newPos, newPos);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
@@ -41,7 +41,7 @@ const ClickInputOnEnter = [
|
|
|
41
41
|
'file',
|
|
42
42
|
'image',
|
|
43
43
|
'reset',
|
|
44
|
-
'submit'
|
|
44
|
+
'submit'
|
|
45
45
|
];
|
|
46
46
|
const SubmitSingleInputOnEnter = [
|
|
47
47
|
'email',
|
|
@@ -51,5 +51,5 @@ const SubmitSingleInputOnEnter = [
|
|
|
51
51
|
'tel',
|
|
52
52
|
'text',
|
|
53
53
|
'url',
|
|
54
|
-
'week'
|
|
54
|
+
'week'
|
|
55
55
|
];
|
|
@@ -9,8 +9,8 @@ import '../../options.js';
|
|
|
9
9
|
import { behavior } from './registry.js';
|
|
10
10
|
|
|
11
11
|
behavior.keyup = (event, target, instance)=>{
|
|
12
|
-
var
|
|
13
|
-
return (
|
|
12
|
+
var _keyupBehavior_event_key;
|
|
13
|
+
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
|
|
14
14
|
};
|
|
15
15
|
const keyupBehavior = {
|
|
16
16
|
' ': (event, target, instance)=>{
|
|
@@ -12,8 +12,8 @@ import { behavior } from './registry.js';
|
|
|
12
12
|
behavior.paste = (event, target, instance)=>{
|
|
13
13
|
if (isEditable(target)) {
|
|
14
14
|
return ()=>{
|
|
15
|
-
var
|
|
16
|
-
const insertData = (
|
|
15
|
+
var _event_clipboardData;
|
|
16
|
+
const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.getData('text');
|
|
17
17
|
if (insertData) {
|
|
18
18
|
input(instance, target, insertData, 'insertFromPaste');
|
|
19
19
|
}
|
|
@@ -25,7 +25,7 @@ const eventInitializer = {
|
|
|
25
25
|
initUIEvent,
|
|
26
26
|
initUIEventModififiers,
|
|
27
27
|
initMouseEvent,
|
|
28
|
-
initPointerEvent
|
|
28
|
+
initPointerEvent
|
|
29
29
|
],
|
|
30
30
|
KeyboardEvent: [
|
|
31
31
|
initUIEvent,
|
|
@@ -34,58 +34,58 @@ const eventInitializer = {
|
|
|
34
34
|
]
|
|
35
35
|
};
|
|
36
36
|
function createEvent(type, target, init) {
|
|
37
|
-
var
|
|
37
|
+
var _eventInitializer_EventType;
|
|
38
38
|
const window = getWindow(target);
|
|
39
|
-
const { EventType
|
|
39
|
+
const { EventType, defaultInit } = eventMap[eventMapKeys[type]];
|
|
40
40
|
const event = new (getEventConstructors(window))[EventType](type, defaultInit);
|
|
41
|
-
(
|
|
41
|
+
(_eventInitializer_EventType = eventInitializer[EventType]) === null || _eventInitializer_EventType === void 0 ? void 0 : _eventInitializer_EventType.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
|
|
42
42
|
return event;
|
|
43
43
|
}
|
|
44
44
|
/* istanbul ignore next */ function getEventConstructors(window) {
|
|
45
|
-
var
|
|
46
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (
|
|
45
|
+
var _window_Event;
|
|
46
|
+
/* 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 {
|
|
47
47
|
};
|
|
48
|
-
var
|
|
49
|
-
const AnimationEvent = (
|
|
48
|
+
var _window_AnimationEvent;
|
|
49
|
+
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
50
50
|
};
|
|
51
|
-
var
|
|
52
|
-
const ClipboardEvent = (
|
|
51
|
+
var _window_ClipboardEvent;
|
|
52
|
+
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
53
53
|
};
|
|
54
|
-
var
|
|
55
|
-
const PopStateEvent = (
|
|
54
|
+
var _window_PopStateEvent;
|
|
55
|
+
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
56
56
|
};
|
|
57
|
-
var
|
|
58
|
-
const ProgressEvent = (
|
|
57
|
+
var _window_ProgressEvent;
|
|
58
|
+
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
59
59
|
};
|
|
60
|
-
var
|
|
61
|
-
const TransitionEvent = (
|
|
60
|
+
var _window_TransitionEvent;
|
|
61
|
+
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
62
62
|
};
|
|
63
|
-
var
|
|
64
|
-
const UIEvent = (
|
|
63
|
+
var _window_UIEvent;
|
|
64
|
+
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
|
|
65
65
|
};
|
|
66
|
-
var
|
|
67
|
-
const CompositionEvent = (
|
|
66
|
+
var _window_CompositionEvent;
|
|
67
|
+
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
68
68
|
};
|
|
69
|
-
var
|
|
70
|
-
const FocusEvent = (
|
|
69
|
+
var _window_FocusEvent;
|
|
70
|
+
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
71
71
|
};
|
|
72
|
-
var
|
|
73
|
-
const InputEvent = (
|
|
72
|
+
var _window_InputEvent;
|
|
73
|
+
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
74
74
|
};
|
|
75
|
-
var
|
|
76
|
-
const KeyboardEvent = (
|
|
75
|
+
var _window_KeyboardEvent;
|
|
76
|
+
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
77
77
|
};
|
|
78
|
-
var
|
|
79
|
-
const MouseEvent = (
|
|
78
|
+
var _window_MouseEvent;
|
|
79
|
+
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
80
80
|
};
|
|
81
|
-
var
|
|
82
|
-
const DragEvent = (
|
|
81
|
+
var _window_DragEvent;
|
|
82
|
+
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
83
83
|
};
|
|
84
|
-
var
|
|
85
|
-
const PointerEvent = (
|
|
84
|
+
var _window_PointerEvent;
|
|
85
|
+
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
86
86
|
};
|
|
87
|
-
var
|
|
88
|
-
const TouchEvent = (
|
|
87
|
+
var _window_TouchEvent;
|
|
88
|
+
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
89
89
|
};
|
|
90
90
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
|
|
91
91
|
Event,
|
|
@@ -115,25 +115,25 @@ function assignProps(obj, props) {
|
|
|
115
115
|
function sanitizeNumber(n) {
|
|
116
116
|
return Number(n !== null && n !== void 0 ? n : 0);
|
|
117
117
|
}
|
|
118
|
-
function initClipboardEvent(event, { clipboardData
|
|
118
|
+
function initClipboardEvent(event, { clipboardData }) {
|
|
119
119
|
assignProps(event, {
|
|
120
120
|
clipboardData
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
function initInputEvent(event, { data
|
|
123
|
+
function initInputEvent(event, { data, inputType, isComposing }) {
|
|
124
124
|
assignProps(event, {
|
|
125
125
|
data,
|
|
126
126
|
isComposing: Boolean(isComposing),
|
|
127
127
|
inputType: String(inputType)
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function initUIEvent(event, { view
|
|
130
|
+
function initUIEvent(event, { view, detail }) {
|
|
131
131
|
assignProps(event, {
|
|
132
132
|
view,
|
|
133
133
|
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
function initUIEventModififiers(event, { altKey
|
|
136
|
+
function initUIEventModififiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
|
|
137
137
|
assignProps(event, {
|
|
138
138
|
altKey: Boolean(altKey),
|
|
139
139
|
ctrlKey: Boolean(ctrlKey),
|
|
@@ -157,7 +157,7 @@ function initUIEventModififiers(event, { altKey , ctrlKey , metaKey , shiftKey ,
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
function initKeyboardEvent(event, { key
|
|
160
|
+
function initKeyboardEvent(event, { key, code, location, repeat, isComposing, charCode }) {
|
|
161
161
|
assignProps(event, {
|
|
162
162
|
key: String(key),
|
|
163
163
|
code: String(code),
|
|
@@ -167,7 +167,7 @@ function initKeyboardEvent(event, { key , code , location , repeat , isComposing
|
|
|
167
167
|
charCode
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
function initMouseEvent(event, { x
|
|
170
|
+
function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget }) {
|
|
171
171
|
assignProps(event, {
|
|
172
172
|
screenX: sanitizeNumber(screenX),
|
|
173
173
|
screenY: sanitizeNumber(screenY),
|
|
@@ -180,7 +180,7 @@ function initMouseEvent(event, { x , y , screenX , screenY , clientX =x , client
|
|
|
180
180
|
relatedTarget
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
function initPointerEvent(event, { pointerId
|
|
183
|
+
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
|
|
184
184
|
assignProps(event, {
|
|
185
185
|
pointerId: sanitizeNumber(pointerId),
|
|
186
186
|
width: sanitizeNumber(width),
|
|
@@ -20,9 +20,9 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
|
|
|
20
20
|
return dispatchEvent.call(this, target, event, preventDefault);
|
|
21
21
|
}
|
|
22
22
|
function dispatchEvent(target, event, preventDefault = false) {
|
|
23
|
-
var
|
|
23
|
+
var _behavior_type;
|
|
24
24
|
const type = event.type;
|
|
25
|
-
const behaviorImplementation = preventDefault ? ()=>{} : (
|
|
25
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(behavior, event, target, this);
|
|
26
26
|
if (behaviorImplementation) {
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
let defaultPrevented = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as named from '@testing-library/dom/dist/event-map.js';
|
|
2
2
|
|
|
3
3
|
const eventMap = {
|
|
4
|
-
...eventMap
|
|
4
|
+
...named.eventMap,
|
|
5
5
|
click: {
|
|
6
6
|
EventType: 'PointerEvent',
|
|
7
7
|
defaultInit: {
|
package/dist/esm/event/focus.js
CHANGED
|
@@ -22,10 +22,7 @@ import { wrapEvent } from './wrapEvent.js';
|
|
|
22
22
|
} else if (target) {
|
|
23
23
|
wrapEvent(()=>target.focus());
|
|
24
24
|
} else {
|
|
25
|
-
wrapEvent(()=>
|
|
26
|
-
var ref;
|
|
27
|
-
return (ref = activeElement) === null || ref === void 0 ? void 0 : ref.blur();
|
|
28
|
-
});
|
|
25
|
+
wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
|
|
29
26
|
}
|
|
30
27
|
updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
|
|
31
28
|
}
|
package/dist/esm/event/input.js
CHANGED
|
@@ -94,7 +94,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
const { newValue
|
|
97
|
+
const { newValue, newOffset, oldValue } = calculateNewValue(dataToInsert, element, inputRange, inputType);
|
|
98
98
|
if (newValue === oldValue && newOffset === inputRange.startOffset && newOffset === inputRange.endOffset) {
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
@@ -122,7 +122,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function calculateNewValue(inputData, node, { startOffset
|
|
125
|
+
function calculateNewValue(inputData, node, { startOffset, endOffset }, inputType) {
|
|
126
126
|
const value = getUIValue(node);
|
|
127
127
|
const prologEnd = Math.max(0, startOffset === endOffset && inputType === 'deleteContentBackward' ? startOffset - 1 : startOffset);
|
|
128
128
|
const prolog = value.substring(0, prologEnd);
|
|
@@ -150,12 +150,12 @@ function commitInput(instance, element, newOffset, inputInit) {
|
|
|
150
150
|
commitValueAfterInput(element, newOffset);
|
|
151
151
|
}
|
|
152
152
|
function isValidNumberInput(value) {
|
|
153
|
-
var
|
|
153
|
+
var _value_match, _value_match1;
|
|
154
154
|
// the browser allows some invalid input but not others
|
|
155
155
|
// it allows up to two '-' at any place before any 'e' or one directly following 'e'
|
|
156
156
|
// it allows one '.' at any place before e
|
|
157
157
|
const valueParts = value.split('e', 2);
|
|
158
|
-
return !(/[^\d.\-e]/.test(value) || Number((
|
|
158
|
+
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]));
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
export { input };
|
|
@@ -7,9 +7,9 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
7
7
|
if (typeAndSelection.type === 'input') {
|
|
8
8
|
return typeAndSelection.selection;
|
|
9
9
|
} else if (typeAndSelection.type === 'contenteditable') {
|
|
10
|
-
var
|
|
10
|
+
var _typeAndSelection_selection;
|
|
11
11
|
// Multi-range on contenteditable edits the first selection instead of the last
|
|
12
|
-
return (
|
|
12
|
+
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === void 0 ? void 0 : _typeAndSelection_selection.getRangeAt(0);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -11,8 +11,8 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
14
|
-
*/ function modifySelection({ focusNode
|
|
15
|
-
var
|
|
14
|
+
*/ function modifySelection({ focusNode, focusOffset }) {
|
|
15
|
+
var _focusNode_ownerDocument_getSelection, _focusNode_ownerDocument;
|
|
16
16
|
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
17
17
|
if (typeAndSelection.type === 'input') {
|
|
18
18
|
return setUISelection(focusNode, {
|
|
@@ -20,7 +20,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
20
20
|
focusOffset
|
|
21
21
|
}, 'modify');
|
|
22
22
|
}
|
|
23
|
-
(
|
|
23
|
+
(_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);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { modifySelection };
|
|
@@ -9,7 +9,7 @@ import '../../utils/misc/level.js';
|
|
|
9
9
|
import '../../options.js';
|
|
10
10
|
import { resolveCaretPosition } from './resolveCaretPosition.js';
|
|
11
11
|
|
|
12
|
-
function modifySelectionPerMouseMove(selectionRange, { document
|
|
12
|
+
function modifySelectionPerMouseMove(selectionRange, { document, target, node, offset }) {
|
|
13
13
|
const selectionFocus = resolveCaretPosition({
|
|
14
14
|
target,
|
|
15
15
|
node,
|