@ariakit/test 0.4.7 → 0.4.8
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/CHANGELOG.md +4 -0
- package/cjs/query.d.cts +2 -2
- package/cjs/query.d.ts +2 -2
- package/esm/query.d.ts +2 -2
- package/package.json +1 -1
- package/cjs/__chunks/3L4XZQN6.cjs +0 -118
- package/cjs/__chunks/5USXAKSO.cjs +0 -32
- package/cjs/__chunks/72WSX5BL.cjs +0 -201
- package/cjs/__chunks/7LFSIKVW.cjs +0 -134
- package/cjs/__chunks/AA4DRZPS.cjs +0 -19
- package/cjs/__chunks/ANKVPRYL.cjs +0 -27
- package/cjs/__chunks/C6KLLVD3.cjs +0 -90
- package/cjs/__chunks/CAAOBH77.cjs +0 -89
- package/cjs/__chunks/E4OOGVMW.cjs +0 -24
- package/cjs/__chunks/IDMD7IDF.cjs +0 -1
- package/cjs/__chunks/IWR6DHL3.cjs +0 -13
- package/cjs/__chunks/ML4UXKC3.cjs +0 -56
- package/cjs/__chunks/OYUSBKO4.cjs +0 -235
- package/cjs/__chunks/Q3ZREZK3.cjs +0 -67
- package/cjs/__chunks/RHX5DDWS.cjs +0 -83
- package/cjs/__chunks/SMHVZDHR.cjs +0 -33
- package/cjs/__chunks/W5TVXVBK.cjs +0 -133
- package/cjs/__chunks/Y4FGMHAT.cjs +0 -12
- package/cjs/blur.cjs +0 -9
- package/cjs/click.cjs +0 -15
- package/cjs/dispatch.cjs +0 -8
- package/cjs/focus.cjs +0 -9
- package/cjs/hover.cjs +0 -10
- package/cjs/index.cjs +0 -64
- package/cjs/mouse-down.cjs +0 -11
- package/cjs/mouse-up.cjs +0 -9
- package/cjs/playwright.cjs +0 -19
- package/cjs/press.cjs +0 -13
- package/cjs/query.cjs +0 -10
- package/cjs/react.cjs +0 -103
- package/cjs/select.cjs +0 -15
- package/cjs/sleep.cjs +0 -8
- package/cjs/tap.cjs +0 -16
- package/cjs/type.cjs +0 -11
- package/cjs/wait-for.cjs +0 -8
- package/esm/__chunks/3TAKJKL3.js +0 -135
- package/esm/__chunks/4SG6SLGL.js +0 -34
- package/esm/__chunks/BQA4OBCC.js +0 -13
- package/esm/__chunks/CNNB7B4V.js +0 -236
- package/esm/__chunks/CWTUOQ5Z.js +0 -91
- package/esm/__chunks/DZ24E43J.js +0 -20
- package/esm/__chunks/G32GEXRJ.js +0 -134
- package/esm/__chunks/HFG3HB6M.js +0 -85
- package/esm/__chunks/LK25WCYN.js +0 -202
- package/esm/__chunks/NR24PD4G.js +0 -28
- package/esm/__chunks/PVRUCEXU.js +0 -68
- package/esm/__chunks/RHBNMDK4.js +0 -1
- package/esm/__chunks/SB7WYA2U.js +0 -14
- package/esm/__chunks/SM5ASDQ3.js +0 -25
- package/esm/__chunks/SOWA2DKF.js +0 -33
- package/esm/__chunks/UG25M3QN.js +0 -91
- package/esm/__chunks/YVVGFTRB.js +0 -119
- package/esm/__chunks/Z7WVAAXJ.js +0 -57
- package/esm/blur.js +0 -10
- package/esm/click.js +0 -16
- package/esm/dispatch.js +0 -9
- package/esm/focus.js +0 -10
- package/esm/hover.js +0 -11
- package/esm/index.js +0 -65
- package/esm/mouse-down.js +0 -12
- package/esm/mouse-up.js +0 -10
- package/esm/playwright.js +0 -20
- package/esm/press.js +0 -14
- package/esm/query.js +0 -11
- package/esm/react.js +0 -104
- package/esm/select.js +0 -16
- package/esm/sleep.js +0 -9
- package/esm/tap.js +0 -17
- package/esm/type.js +0 -12
- package/esm/wait-for.js +0 -9
package/CHANGELOG.md
CHANGED
package/cjs/query.d.cts
CHANGED
|
@@ -25,7 +25,7 @@ export declare const query: {
|
|
|
25
25
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
within: (element?: HTMLElement | null) => any;
|
|
28
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
29
29
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
30
30
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
31
31
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
|
@@ -2020,7 +2020,7 @@ export declare const q: {
|
|
|
2020
2020
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
2021
2021
|
};
|
|
2022
2022
|
};
|
|
2023
|
-
within: (element?: HTMLElement | null) => any;
|
|
2023
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
2024
2024
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
2025
2025
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
2026
2026
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
package/cjs/query.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare const query: {
|
|
|
25
25
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
within: (element?: HTMLElement | null) => any;
|
|
28
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
29
29
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
30
30
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
31
31
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
|
@@ -2020,7 +2020,7 @@ export declare const q: {
|
|
|
2020
2020
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
2021
2021
|
};
|
|
2022
2022
|
};
|
|
2023
|
-
within: (element?: HTMLElement | null) => any;
|
|
2023
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
2024
2024
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
2025
2025
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
2026
2026
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
package/esm/query.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare const query: {
|
|
|
25
25
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
within: (element?: HTMLElement | null) => any;
|
|
28
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
29
29
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
30
30
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
31
31
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
|
@@ -2020,7 +2020,7 @@ export declare const q: {
|
|
|
2020
2020
|
all: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => ReturnType<baseQueries.AllByText<T>>) & ((id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]);
|
|
2021
2021
|
};
|
|
2022
2022
|
};
|
|
2023
|
-
within: (element?: HTMLElement | null) => any;
|
|
2023
|
+
within: (element?: HTMLElement | null) => /*elided*/ any;
|
|
2024
2024
|
alert: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null) & {
|
|
2025
2025
|
includesHidden: (name?: string | RegExp, options?: ByRoleOptions) => HTMLElement | null;
|
|
2026
2026
|
all: ((name?: string | RegExp, options?: ByRoleOptions) => HTMLElement[]) & {
|
package/package.json
CHANGED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _SMHVZDHRcjs = require('./SMHVZDHR.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _72WSX5BLcjs = require('./72WSX5BL.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _AA4DRZPScjs = require('./AA4DRZPS.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _E4OOGVMWcjs = require('./E4OOGVMW.cjs');
|
|
16
|
-
|
|
17
|
-
// src/type.ts
|
|
18
|
-
var _dom = require('@ariakit/core/utils/dom');
|
|
19
|
-
var _focus = require('@ariakit/core/utils/focus');
|
|
20
|
-
function getKeyFromChar(key) {
|
|
21
|
-
if (key === "\x7F") return "Delete";
|
|
22
|
-
if (key === "\b") return "Backspace";
|
|
23
|
-
if (key === "\n") return "Enter";
|
|
24
|
-
if (key === " ") return "Tab";
|
|
25
|
-
return key;
|
|
26
|
-
}
|
|
27
|
-
function workAroundEmailInput(element) {
|
|
28
|
-
const input = element;
|
|
29
|
-
if (input.tagName !== "INPUT" || input.type !== "email") return () => {
|
|
30
|
-
};
|
|
31
|
-
input.type = "text";
|
|
32
|
-
return () => {
|
|
33
|
-
input.type = "email";
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function type(text, element, options = {}) {
|
|
37
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
if (element == null) {
|
|
40
|
-
element = document.activeElement;
|
|
41
|
-
}
|
|
42
|
-
if (!element) return;
|
|
43
|
-
if (!_focus.isFocusable.call(void 0, element)) return;
|
|
44
|
-
await _SMHVZDHRcjs.focus.call(void 0, element);
|
|
45
|
-
element.dirty = true;
|
|
46
|
-
const restoreEmailInput = workAroundEmailInput(element);
|
|
47
|
-
for (const char of text) {
|
|
48
|
-
const key = getKeyFromChar(char);
|
|
49
|
-
let value = "";
|
|
50
|
-
let inputType = options.isComposing ? "insertCompositionText" : "insertText";
|
|
51
|
-
let defaultAllowed = await _72WSX5BLcjs.dispatch.keyDown(element, _E4OOGVMWcjs.__spreadValues.call(void 0, { key }, options));
|
|
52
|
-
element = _dom.getActiveElement.call(void 0, element) || element;
|
|
53
|
-
if (_dom.isTextField.call(void 0, element)) {
|
|
54
|
-
const input = element;
|
|
55
|
-
const [start, end] = [
|
|
56
|
-
(_a = input.selectionStart) != null ? _a : 0,
|
|
57
|
-
(_b = input.selectionEnd) != null ? _b : 0
|
|
58
|
-
];
|
|
59
|
-
const collapsed = start === end;
|
|
60
|
-
let nextCaretPosition = start;
|
|
61
|
-
if (char === "\x7F") {
|
|
62
|
-
const firstPart = input.value.slice(0, start);
|
|
63
|
-
const secondPart = input.value.slice(collapsed ? end + 1 : end);
|
|
64
|
-
value = `${firstPart}${secondPart}`;
|
|
65
|
-
inputType = "deleteContentForward";
|
|
66
|
-
} else if (char === "\b") {
|
|
67
|
-
nextCaretPosition = collapsed ? Math.max(start - 1, 0) : start;
|
|
68
|
-
const firstPart = input.value.slice(0, nextCaretPosition);
|
|
69
|
-
const lastPart = input.value.slice(end, input.value.length);
|
|
70
|
-
value = `${firstPart}${lastPart}`;
|
|
71
|
-
inputType = "deleteContentBackward";
|
|
72
|
-
} else {
|
|
73
|
-
const firstPartEnd = options.isComposing ? start - 1 : start;
|
|
74
|
-
const firstPart = input.value.slice(0, firstPartEnd);
|
|
75
|
-
const lastPart = input.value.slice(end, input.value.length);
|
|
76
|
-
nextCaretPosition = start + 1;
|
|
77
|
-
value = `${firstPart}${char}${lastPart}`;
|
|
78
|
-
}
|
|
79
|
-
if (defaultAllowed && !input.readOnly) {
|
|
80
|
-
if (inputType === "insertText") {
|
|
81
|
-
defaultAllowed = await _72WSX5BLcjs.dispatch.keyPress(input, _E4OOGVMWcjs.__spreadValues.call(void 0, {
|
|
82
|
-
key,
|
|
83
|
-
charCode: key.charCodeAt(0)
|
|
84
|
-
}, options));
|
|
85
|
-
}
|
|
86
|
-
if (inputType === "insertCompositionText") {
|
|
87
|
-
defaultAllowed = await _72WSX5BLcjs.dispatch.compositionUpdate(input, _E4OOGVMWcjs.__spreadValues.call(void 0, {
|
|
88
|
-
data: char,
|
|
89
|
-
target: { value }
|
|
90
|
-
}, options));
|
|
91
|
-
}
|
|
92
|
-
if (defaultAllowed) {
|
|
93
|
-
await _72WSX5BLcjs.dispatch.input(input, _E4OOGVMWcjs.__spreadValues.call(void 0, {
|
|
94
|
-
data: char,
|
|
95
|
-
target: {
|
|
96
|
-
value,
|
|
97
|
-
selectionStart: nextCaretPosition,
|
|
98
|
-
selectionEnd: nextCaretPosition
|
|
99
|
-
},
|
|
100
|
-
inputType
|
|
101
|
-
}, options));
|
|
102
|
-
if (input.selectionStart !== nextCaretPosition) {
|
|
103
|
-
input.setSelectionRange(nextCaretPosition, nextCaretPosition);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
await _AA4DRZPScjs.sleep.call(void 0, );
|
|
109
|
-
await _72WSX5BLcjs.dispatch.keyUp(element, _E4OOGVMWcjs.__spreadValues.call(void 0, { key }, options));
|
|
110
|
-
await _AA4DRZPScjs.sleep.call(void 0, );
|
|
111
|
-
}
|
|
112
|
-
restoreEmailInput();
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
exports.type = type;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _72WSX5BLcjs = require('./72WSX5BL.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
8
|
-
|
|
9
|
-
// src/blur.ts
|
|
10
|
-
var _dom = require('@ariakit/core/utils/dom');
|
|
11
|
-
function blur(element) {
|
|
12
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
13
|
-
if (element == null) {
|
|
14
|
-
element = document.activeElement;
|
|
15
|
-
}
|
|
16
|
-
if (!element) return;
|
|
17
|
-
if (element.tagName === "BODY") return;
|
|
18
|
-
if (_dom.getActiveElement.call(void 0, element) !== element) return;
|
|
19
|
-
if (element.dirty) {
|
|
20
|
-
await _72WSX5BLcjs.dispatch.change(element);
|
|
21
|
-
element.dirty = false;
|
|
22
|
-
}
|
|
23
|
-
if (element instanceof HTMLElement || element instanceof SVGElement) {
|
|
24
|
-
element.blur();
|
|
25
|
-
await _RHX5DDWScjs.flushMicrotasks.call(void 0, );
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
exports.blur = blur;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
5
|
-
|
|
6
|
-
// src/dispatch.ts
|
|
7
|
-
var _misc = require('@ariakit/core/utils/misc');
|
|
8
|
-
var _dom = require('@testing-library/dom');
|
|
9
|
-
function assignProps(obj, props) {
|
|
10
|
-
for (const [key, value] of Object.entries(props)) {
|
|
11
|
-
Object.defineProperty(obj, key, { get: () => value != null ? value : null });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function sanitizeNumber(n) {
|
|
15
|
-
return Number(n != null ? n : 0);
|
|
16
|
-
}
|
|
17
|
-
function initClipboardEvent(event, { clipboardData }) {
|
|
18
|
-
assignProps(event, {
|
|
19
|
-
clipboardData
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function initInputEvent(event, { data, inputType, isComposing }) {
|
|
23
|
-
assignProps(event, {
|
|
24
|
-
data,
|
|
25
|
-
isComposing: !!isComposing,
|
|
26
|
-
inputType: String(inputType)
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function initUIEvent(event, { view, detail }) {
|
|
30
|
-
assignProps(event, {
|
|
31
|
-
view,
|
|
32
|
-
detail: sanitizeNumber(detail != null ? detail : 0)
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function initUIEventModififiers(event, {
|
|
36
|
-
altKey,
|
|
37
|
-
ctrlKey,
|
|
38
|
-
metaKey,
|
|
39
|
-
shiftKey,
|
|
40
|
-
modifierAltGraph,
|
|
41
|
-
modifierCapsLock,
|
|
42
|
-
modifierFn,
|
|
43
|
-
modifierFnLock,
|
|
44
|
-
modifierNumLock,
|
|
45
|
-
modifierScrollLock,
|
|
46
|
-
modifierSymbol,
|
|
47
|
-
modifierSymbolLock
|
|
48
|
-
}) {
|
|
49
|
-
assignProps(event, {
|
|
50
|
-
altKey: !!altKey,
|
|
51
|
-
ctrlKey: !!ctrlKey,
|
|
52
|
-
metaKey: !!metaKey,
|
|
53
|
-
shiftKey: !!shiftKey,
|
|
54
|
-
getModifierState(k) {
|
|
55
|
-
return Boolean(
|
|
56
|
-
{
|
|
57
|
-
Alt: altKey,
|
|
58
|
-
AltGraph: modifierAltGraph,
|
|
59
|
-
CapsLock: modifierCapsLock,
|
|
60
|
-
Control: ctrlKey,
|
|
61
|
-
Fn: modifierFn,
|
|
62
|
-
FnLock: modifierFnLock,
|
|
63
|
-
Meta: metaKey,
|
|
64
|
-
NumLock: modifierNumLock,
|
|
65
|
-
ScrollLock: modifierScrollLock,
|
|
66
|
-
Shift: shiftKey,
|
|
67
|
-
Symbol: modifierSymbol,
|
|
68
|
-
SymbolLock: modifierSymbolLock
|
|
69
|
-
}[k]
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function initKeyboardEvent(event, { key, code, location, repeat, isComposing }) {
|
|
75
|
-
assignProps(event, {
|
|
76
|
-
key: String(key),
|
|
77
|
-
code: String(code),
|
|
78
|
-
location: sanitizeNumber(location),
|
|
79
|
-
repeat: !!repeat,
|
|
80
|
-
isComposing: !!isComposing
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function initMouseEvent(event, {
|
|
84
|
-
x,
|
|
85
|
-
y,
|
|
86
|
-
screenX,
|
|
87
|
-
screenY,
|
|
88
|
-
clientX = x,
|
|
89
|
-
clientY = y,
|
|
90
|
-
button,
|
|
91
|
-
buttons,
|
|
92
|
-
relatedTarget
|
|
93
|
-
}) {
|
|
94
|
-
assignProps(event, {
|
|
95
|
-
screenX: sanitizeNumber(screenX),
|
|
96
|
-
screenY: sanitizeNumber(screenY),
|
|
97
|
-
clientX: sanitizeNumber(clientX),
|
|
98
|
-
x: sanitizeNumber(clientX),
|
|
99
|
-
clientY: sanitizeNumber(clientY),
|
|
100
|
-
y: sanitizeNumber(clientY),
|
|
101
|
-
button: sanitizeNumber(button),
|
|
102
|
-
buttons: sanitizeNumber(buttons),
|
|
103
|
-
relatedTarget
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function initPointerEvent(event, {
|
|
107
|
-
pointerId,
|
|
108
|
-
width,
|
|
109
|
-
height,
|
|
110
|
-
pressure,
|
|
111
|
-
tangentialPressure,
|
|
112
|
-
tiltX,
|
|
113
|
-
tiltY,
|
|
114
|
-
twist,
|
|
115
|
-
isPrimary,
|
|
116
|
-
pointerType = "mouse"
|
|
117
|
-
}) {
|
|
118
|
-
assignProps(event, {
|
|
119
|
-
pointerId: sanitizeNumber(pointerId),
|
|
120
|
-
width: sanitizeNumber(width),
|
|
121
|
-
height: sanitizeNumber(height),
|
|
122
|
-
pressure: sanitizeNumber(pressure),
|
|
123
|
-
tangentialPressure: sanitizeNumber(tangentialPressure),
|
|
124
|
-
tiltX: sanitizeNumber(tiltX),
|
|
125
|
-
tiltY: sanitizeNumber(tiltY),
|
|
126
|
-
twist: sanitizeNumber(twist),
|
|
127
|
-
isPrimary: !!isPrimary,
|
|
128
|
-
pointerType: String(pointerType)
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function initEvent(event, options = {}) {
|
|
132
|
-
if (event instanceof ClipboardEvent) {
|
|
133
|
-
initClipboardEvent(event, options);
|
|
134
|
-
}
|
|
135
|
-
if (event instanceof InputEvent) {
|
|
136
|
-
initInputEvent(event, options);
|
|
137
|
-
}
|
|
138
|
-
if (event instanceof UIEvent) {
|
|
139
|
-
initUIEvent(event, options);
|
|
140
|
-
}
|
|
141
|
-
if (event instanceof KeyboardEvent) {
|
|
142
|
-
initKeyboardEvent(event, options);
|
|
143
|
-
initUIEventModififiers(event, options);
|
|
144
|
-
}
|
|
145
|
-
if (event instanceof MouseEvent) {
|
|
146
|
-
initMouseEvent(event, options);
|
|
147
|
-
initUIEventModififiers(event, options);
|
|
148
|
-
}
|
|
149
|
-
if (event instanceof PointerEvent) {
|
|
150
|
-
initPointerEvent(event, options);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
var pointerEvents = [
|
|
154
|
-
"mousemove",
|
|
155
|
-
"mouseover",
|
|
156
|
-
"mouseenter",
|
|
157
|
-
"mouseout",
|
|
158
|
-
"mouseleave",
|
|
159
|
-
"mousedown",
|
|
160
|
-
"mouseup",
|
|
161
|
-
"pointermove",
|
|
162
|
-
"pointerover",
|
|
163
|
-
"pointerenter",
|
|
164
|
-
"pointerout",
|
|
165
|
-
"pointerleave",
|
|
166
|
-
"pointerdown",
|
|
167
|
-
"pointerup",
|
|
168
|
-
"click"
|
|
169
|
-
];
|
|
170
|
-
function baseDispatch(element, event) {
|
|
171
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
172
|
-
_misc.invariant.call(void 0, element, `Unable to dispatch ${event.type} on null element`);
|
|
173
|
-
const eventName = event.type.toLowerCase();
|
|
174
|
-
if (pointerEvents.includes(eventName) && "classList" in element) {
|
|
175
|
-
const { pointerEvents: pointerEvents2 } = getComputedStyle(element);
|
|
176
|
-
if (pointerEvents2 === "none") {
|
|
177
|
-
if (element.parentElement) {
|
|
178
|
-
return baseDispatch(element.parentElement, event);
|
|
179
|
-
}
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const defaultAllowed = _dom.fireEvent.call(void 0, element, event);
|
|
184
|
-
await _RHX5DDWScjs.flushMicrotasks.call(void 0, );
|
|
185
|
-
return defaultAllowed;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
var events = _misc.getKeys.call(void 0, _dom.fireEvent).reduce((events2, eventName) => {
|
|
189
|
-
events2[eventName] = (element, options) => {
|
|
190
|
-
_misc.invariant.call(void 0, element, `Unable to dispatch ${eventName} on null element`);
|
|
191
|
-
const event = _dom.createEvent[eventName](element, options);
|
|
192
|
-
initEvent(event, options);
|
|
193
|
-
return baseDispatch(element, event);
|
|
194
|
-
};
|
|
195
|
-
return events2;
|
|
196
|
-
}, {});
|
|
197
|
-
var dispatch = Object.assign(baseDispatch, events);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
exports.dispatch = dispatch;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _ANKVPRYLcjs = require('./ANKVPRYL.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _ML4UXKC3cjs = require('./ML4UXKC3.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _Q3ZREZK3cjs = require('./Q3ZREZK3.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _SMHVZDHRcjs = require('./SMHVZDHR.cjs');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _72WSX5BLcjs = require('./72WSX5BL.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _AA4DRZPScjs = require('./AA4DRZPS.cjs');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _E4OOGVMWcjs = require('./E4OOGVMW.cjs');
|
|
25
|
-
|
|
26
|
-
// src/click.ts
|
|
27
|
-
var _dom = require('@ariakit/core/utils/dom');
|
|
28
|
-
var _focus = require('@ariakit/core/utils/focus');
|
|
29
|
-
var _misc = require('@ariakit/core/utils/misc');
|
|
30
|
-
function getClosestLabel(element) {
|
|
31
|
-
if (!_focus.isFocusable.call(void 0, element)) {
|
|
32
|
-
return element.closest("label");
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
function getInputFromLabel(element) {
|
|
37
|
-
var _a;
|
|
38
|
-
const input = element.htmlFor ? (_a = element.ownerDocument) == null ? void 0 : _a.getElementById(element.htmlFor) : element.querySelector("input,textarea,select");
|
|
39
|
-
return input;
|
|
40
|
-
}
|
|
41
|
-
async function clickLabel(element, options) {
|
|
42
|
-
const input = getInputFromLabel(element);
|
|
43
|
-
const isInputDisabled = Boolean(input == null ? void 0 : input.disabled);
|
|
44
|
-
if (input) {
|
|
45
|
-
input.disabled = true;
|
|
46
|
-
}
|
|
47
|
-
const defaultAllowed = await _72WSX5BLcjs.dispatch.click(element, options);
|
|
48
|
-
if (input) {
|
|
49
|
-
input.disabled = isInputDisabled;
|
|
50
|
-
if (defaultAllowed && _focus.isFocusable.call(void 0, input)) {
|
|
51
|
-
await _SMHVZDHRcjs.focus.call(void 0, input);
|
|
52
|
-
await _72WSX5BLcjs.dispatch.click(input);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function setSelected(element, selected) {
|
|
57
|
-
element.setAttribute("selected", selected ? "selected" : "");
|
|
58
|
-
element.selected = selected;
|
|
59
|
-
}
|
|
60
|
-
async function clickOption(element, eventOptions) {
|
|
61
|
-
const select = element.closest("select");
|
|
62
|
-
if (!select) {
|
|
63
|
-
await _72WSX5BLcjs.dispatch.click(element, eventOptions);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (select.multiple) {
|
|
67
|
-
const options = Array.from(select.options);
|
|
68
|
-
const resetOptions = () => {
|
|
69
|
-
for (const option of options) {
|
|
70
|
-
setSelected(option, false);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const selectRange = (a, b) => {
|
|
74
|
-
const from = Math.min(a, b);
|
|
75
|
-
const to = Math.max(a, b) + 1;
|
|
76
|
-
const selectedOptions = options.slice(from, to);
|
|
77
|
-
for (const option of selectedOptions) {
|
|
78
|
-
setSelected(option, true);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
if (eventOptions == null ? void 0 : eventOptions.shiftKey) {
|
|
82
|
-
const elementIndex = options.indexOf(element);
|
|
83
|
-
const referenceOption = select.lastOptionSelectedNotByShiftKey;
|
|
84
|
-
const referenceOptionIndex = referenceOption ? options.indexOf(referenceOption) : -1;
|
|
85
|
-
resetOptions();
|
|
86
|
-
selectRange(elementIndex, referenceOptionIndex);
|
|
87
|
-
setSelected(element, true);
|
|
88
|
-
} else {
|
|
89
|
-
select.lastOptionSelectedNotByShiftKey = element;
|
|
90
|
-
if (eventOptions == null ? void 0 : eventOptions.ctrlKey) {
|
|
91
|
-
setSelected(element, !element.selected);
|
|
92
|
-
} else {
|
|
93
|
-
resetOptions();
|
|
94
|
-
setSelected(element, true);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
setSelected(element, true);
|
|
99
|
-
}
|
|
100
|
-
await _72WSX5BLcjs.dispatch.input(select);
|
|
101
|
-
await _72WSX5BLcjs.dispatch.change(select);
|
|
102
|
-
await _72WSX5BLcjs.dispatch.click(element, eventOptions);
|
|
103
|
-
}
|
|
104
|
-
function click(element, options, tap = false) {
|
|
105
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
106
|
-
_misc.invariant.call(void 0, element, "Unable to click on null element");
|
|
107
|
-
if (!_dom.isVisible.call(void 0, element)) return;
|
|
108
|
-
await _Q3ZREZK3cjs.hover.call(void 0, element, options);
|
|
109
|
-
await _ML4UXKC3cjs.mouseDown.call(void 0, element, options);
|
|
110
|
-
while (!_dom.isVisible.call(void 0, element)) {
|
|
111
|
-
if (!element.parentElement) return;
|
|
112
|
-
element = element.parentElement;
|
|
113
|
-
}
|
|
114
|
-
if (!tap) {
|
|
115
|
-
await _AA4DRZPScjs.sleep.call(void 0, );
|
|
116
|
-
}
|
|
117
|
-
await _ANKVPRYLcjs.mouseUp.call(void 0, element, options);
|
|
118
|
-
const { disabled } = element;
|
|
119
|
-
if (disabled) return;
|
|
120
|
-
const label = getClosestLabel(element);
|
|
121
|
-
if (label) {
|
|
122
|
-
await clickLabel(label, _E4OOGVMWcjs.__spreadValues.call(void 0, { detail: 1 }, options));
|
|
123
|
-
} else if (element instanceof HTMLOptionElement) {
|
|
124
|
-
await clickOption(element, _E4OOGVMWcjs.__spreadValues.call(void 0, { detail: 1 }, options));
|
|
125
|
-
} else {
|
|
126
|
-
await _72WSX5BLcjs.dispatch.click(element, _E4OOGVMWcjs.__spreadValues.call(void 0, { detail: 1 }, options));
|
|
127
|
-
}
|
|
128
|
-
await _AA4DRZPScjs.sleep.call(void 0, );
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
exports.click = click;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
6
|
-
|
|
7
|
-
// src/sleep.ts
|
|
8
|
-
var defaultMs = _RHX5DDWScjs.isBrowser ? 150 : 10;
|
|
9
|
-
function sleep(ms = defaultMs) {
|
|
10
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
11
|
-
await _RHX5DDWScjs.nextFrame.call(void 0, );
|
|
12
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
13
|
-
await _RHX5DDWScjs.nextFrame.call(void 0, );
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
exports.sleep = sleep;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _72WSX5BLcjs = require('./72WSX5BL.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _RHX5DDWScjs = require('./RHX5DDWS.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _E4OOGVMWcjs = require('./E4OOGVMW.cjs');
|
|
10
|
-
|
|
11
|
-
// src/mouse-up.ts
|
|
12
|
-
var _dom = require('@ariakit/core/utils/dom');
|
|
13
|
-
var _misc = require('@ariakit/core/utils/misc');
|
|
14
|
-
function mouseUp(element, options) {
|
|
15
|
-
return _RHX5DDWScjs.wrapAsync.call(void 0, async () => {
|
|
16
|
-
_misc.invariant.call(void 0, element, "Unable to mouseUp on null element");
|
|
17
|
-
if (!_dom.isVisible.call(void 0, element)) return;
|
|
18
|
-
const { disabled } = element;
|
|
19
|
-
await _72WSX5BLcjs.dispatch.pointerUp(element, options);
|
|
20
|
-
if (disabled) return;
|
|
21
|
-
await _72WSX5BLcjs.dispatch.mouseUp(element, _E4OOGVMWcjs.__spreadValues.call(void 0, { detail: 1 }, options));
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exports.mouseUp = mouseUp;
|