@ariakit/test 0.1.5 → 0.1.7

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 (66) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/cjs/__chunks/{OZ7WVH2H.cjs → 3SY2LMBF.cjs} +4 -1
  3. package/cjs/__chunks/{JQOPUXXK.cjs → 4PLCBYAV.cjs} +20 -16
  4. package/cjs/__chunks/{HNTSACY7.cjs → 5LBBCOE3.cjs} +5 -6
  5. package/cjs/__chunks/{MRZIZFYG.cjs → 7LXN4GA5.cjs} +2 -2
  6. package/cjs/__chunks/{XMPFC5C3.cjs → 7WNWDQ4X.cjs} +7 -4
  7. package/cjs/__chunks/{7JH5O7L2.cjs → APK7YACC.cjs} +2 -2
  8. package/cjs/__chunks/{DN7DXBEV.cjs → J27GPNPL.cjs} +18 -14
  9. package/cjs/__chunks/{5W6DSYPH.cjs → K4CITI33.cjs} +6 -2
  10. package/cjs/__chunks/LDC5CPCY.cjs +24 -0
  11. package/cjs/__chunks/{JH3LRGOI.cjs → QSY6VHP2.cjs} +24 -20
  12. package/cjs/__chunks/{FKRMBIQS.cjs → T7IGORAF.cjs} +19 -18
  13. package/cjs/__chunks/{4XKG4LDQ.cjs → WHLWNNUI.cjs} +6 -2
  14. package/cjs/act.cjs +1 -0
  15. package/cjs/blur.cjs +1 -0
  16. package/cjs/click.cjs +8 -7
  17. package/cjs/fire-event.cjs +1 -0
  18. package/cjs/focus.cjs +4 -3
  19. package/cjs/hover.cjs +3 -2
  20. package/cjs/index.cjs +13 -12
  21. package/cjs/mock-get-client-rects.cjs +2 -1
  22. package/cjs/mouse-down.cjs +5 -4
  23. package/cjs/mouse-up.cjs +3 -2
  24. package/cjs/press.cjs +6 -5
  25. package/cjs/render.cjs +3 -2
  26. package/cjs/screen.cjs +1 -0
  27. package/cjs/select.cjs +8 -7
  28. package/cjs/sleep.cjs +1 -0
  29. package/cjs/tap.cjs +9 -8
  30. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  31. package/cjs/type.cjs +5 -4
  32. package/cjs/wait-for.cjs +1 -0
  33. package/cjs/within.cjs +1 -0
  34. package/esm/__chunks/{EFRHS5TP.js → 2E5JZMOP.js} +13 -9
  35. package/esm/__chunks/{XT6MJTE4.js → 4AKNUH2A.js} +1 -1
  36. package/esm/__chunks/{HCJFVOUB.js → 5UPN6XV7.js} +5 -6
  37. package/esm/__chunks/{RVXNT5Y5.js → DRKLVF57.js} +6 -2
  38. package/esm/__chunks/{4RXBOOIA.js → JVZDQIPK.js} +1 -1
  39. package/esm/__chunks/{VZYZVUSK.js → KPOWUSLK.js} +4 -1
  40. package/esm/__chunks/{XJFAU7OI.js → N3NIS6J5.js} +5 -2
  41. package/esm/__chunks/{B4PLOQ7F.js → O77EMIKC.js} +5 -1
  42. package/esm/__chunks/{KIGH65E3.js → S4IIXAAC.js} +17 -16
  43. package/esm/__chunks/{PLZ4ME4B.js → X23QJEN5.js} +17 -13
  44. package/esm/__chunks/ZEPQ5W7N.js +24 -0
  45. package/esm/__chunks/{C5V6WFU6.js → ZUY7UFA4.js} +15 -11
  46. package/esm/act.js +1 -0
  47. package/esm/blur.js +1 -0
  48. package/esm/click.js +7 -6
  49. package/esm/fire-event.js +1 -0
  50. package/esm/focus.js +3 -2
  51. package/esm/hover.js +2 -1
  52. package/esm/index.js +12 -11
  53. package/esm/mock-get-client-rects.js +2 -1
  54. package/esm/mouse-down.js +4 -3
  55. package/esm/mouse-up.js +2 -1
  56. package/esm/press.js +5 -4
  57. package/esm/render.js +2 -1
  58. package/esm/screen.js +1 -0
  59. package/esm/select.js +7 -6
  60. package/esm/sleep.js +1 -0
  61. package/esm/tap.js +8 -7
  62. package/esm/tsconfig.build.tsbuildinfo +1 -1
  63. package/esm/type.js +4 -3
  64. package/esm/wait-for.js +1 -0
  65. package/esm/within.js +1 -0
  66. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ariakit/test
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies: `@ariakit/core@0.2.0`.
8
+
9
+ ## 0.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed build target. ([#2355](https://github.com/ariakit/ariakit/pull/2355))
14
+
15
+ - Fixed `mock-get-client-rects` module marking elements not connected to the DOM as visible. ([#2339](https://github.com/ariakit/ariakit/pull/2339))
16
+
17
+ - Updated dependencies: `@ariakit/core@0.1.5`.
18
+
3
19
  ## 0.1.5
4
20
 
5
21
  ### Patch Changes
@@ -2,13 +2,16 @@
2
2
 
3
3
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
4
4
 
5
+
6
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
7
+
5
8
  // src/mouse-up.ts
6
9
  function mouseUp(element, options) {
7
10
  const { disabled } = element;
8
11
  _67NJSPQEcjs.fireEvent.pointerUp(element, options);
9
12
  if (disabled)
10
13
  return;
11
- _67NJSPQEcjs.fireEvent.mouseUp(element, { detail: 1, ...options });
14
+ _67NJSPQEcjs.fireEvent.mouseUp(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options));
12
15
  }
13
16
 
14
17
 
@@ -1,15 +1,15 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _OZ7WVH2Hcjs = require('./OZ7WVH2H.cjs');
3
+ var _3SY2LMBFcjs = require('./3SY2LMBF.cjs');
4
4
 
5
5
 
6
- var _XMPFC5C3cjs = require('./XMPFC5C3.cjs');
6
+ var _7WNWDQ4Xcjs = require('./7WNWDQ4X.cjs');
7
7
 
8
8
 
9
- var _4XKG4LDQcjs = require('./4XKG4LDQ.cjs');
9
+ var _WHLWNNUIcjs = require('./WHLWNNUI.cjs');
10
10
 
11
11
 
12
- var _MRZIZFYGcjs = require('./MRZIZFYG.cjs');
12
+ var _7LXN4GA5cjs = require('./7LXN4GA5.cjs');
13
13
 
14
14
 
15
15
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
@@ -20,6 +20,9 @@ var _7RUXTAPPcjs = require('./7RUXTAPP.cjs');
20
20
 
21
21
  var _3WW644T7cjs = require('./3WW644T7.cjs');
22
22
 
23
+
24
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
25
+
23
26
  // src/click.ts
24
27
  var _dom = require('@ariakit/core/utils/dom');
25
28
  var _focus = require('@ariakit/core/utils/focus');
@@ -30,12 +33,13 @@ function getClosestLabel(element) {
30
33
  return null;
31
34
  }
32
35
  function getInputFromLabel(element) {
33
- const input = element.htmlFor ? _optionalChain([element, 'access', _ => _.ownerDocument, 'optionalAccess', _2 => _2.getElementById, 'call', _3 => _3(element.htmlFor)]) : element.querySelector("input,textarea,select");
36
+ var _a;
37
+ const input = element.htmlFor ? (_a = element.ownerDocument) == null ? void 0 : _a.getElementById(element.htmlFor) : element.querySelector("input,textarea,select");
34
38
  return input;
35
39
  }
36
40
  function clickLabel(element, options) {
37
41
  const input = getInputFromLabel(element);
38
- const isInputDisabled = Boolean(_optionalChain([input, 'optionalAccess', _4 => _4.disabled]));
42
+ const isInputDisabled = Boolean(input == null ? void 0 : input.disabled);
39
43
  if (input) {
40
44
  input.disabled = true;
41
45
  }
@@ -43,7 +47,7 @@ function clickLabel(element, options) {
43
47
  if (input) {
44
48
  input.disabled = isInputDisabled;
45
49
  if (defaultAllowed && _focus.isFocusable.call(void 0, input)) {
46
- _MRZIZFYGcjs.focus.call(void 0, input);
50
+ _7LXN4GA5cjs.focus.call(void 0, input);
47
51
  _67NJSPQEcjs.fireEvent.click(input);
48
52
  }
49
53
  }
@@ -71,7 +75,7 @@ function clickOption(element, eventOptions) {
71
75
  setSelected(option, true);
72
76
  });
73
77
  };
74
- if (_optionalChain([eventOptions, 'optionalAccess', _5 => _5.shiftKey])) {
78
+ if (eventOptions == null ? void 0 : eventOptions.shiftKey) {
75
79
  const elementIndex = options.indexOf(element);
76
80
  const referenceOption = select.lastOptionSelectedNotByShiftKey;
77
81
  const referenceOptionIndex = referenceOption ? options.indexOf(referenceOption) : -1;
@@ -80,7 +84,7 @@ function clickOption(element, eventOptions) {
80
84
  setSelected(element, true);
81
85
  } else {
82
86
  select.lastOptionSelectedNotByShiftKey = element;
83
- if (_optionalChain([eventOptions, 'optionalAccess', _6 => _6.ctrlKey])) {
87
+ if (eventOptions == null ? void 0 : eventOptions.ctrlKey) {
84
88
  setSelected(element, !element.selected);
85
89
  } else {
86
90
  resetOptions();
@@ -97,8 +101,8 @@ function clickOption(element, eventOptions) {
97
101
  async function click(element, options, tap = false) {
98
102
  if (!_dom.isVisible.call(void 0, element))
99
103
  return;
100
- await _4XKG4LDQcjs.hover.call(void 0, element, options);
101
- _XMPFC5C3cjs.mouseDown.call(void 0, element, options);
104
+ await _WHLWNNUIcjs.hover.call(void 0, element, options);
105
+ _7WNWDQ4Xcjs.mouseDown.call(void 0, element, options);
102
106
  await _3WW644T7cjs.queuedMicrotasks.call(void 0, );
103
107
  while (!_dom.isVisible.call(void 0, element)) {
104
108
  if (!element.parentElement)
@@ -108,17 +112,17 @@ async function click(element, options, tap = false) {
108
112
  if (!tap) {
109
113
  await _7RUXTAPPcjs.sleep.call(void 0, );
110
114
  }
111
- _OZ7WVH2Hcjs.mouseUp.call(void 0, element, options);
115
+ _3SY2LMBFcjs.mouseUp.call(void 0, element, options);
112
116
  const { disabled } = element;
113
117
  if (disabled)
114
118
  return;
115
119
  const label = getClosestLabel(element);
116
120
  if (label) {
117
- clickLabel(label, { detail: 1, ...options });
121
+ clickLabel(label, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options));
118
122
  } else if (element instanceof HTMLOptionElement) {
119
- clickOption(element, { detail: 1, ...options });
123
+ clickOption(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options));
120
124
  } else {
121
- _67NJSPQEcjs.fireEvent.click(element, { detail: 1, ...options });
125
+ _67NJSPQEcjs.fireEvent.click(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options));
122
126
  }
123
127
  await _7RUXTAPPcjs.sleep.call(void 0, );
124
128
  }
@@ -6,15 +6,14 @@ var _3WW644T7cjs = require('./3WW644T7.cjs');
6
6
  if (!_3WW644T7cjs.isBrowser && typeof window !== "undefined") {
7
7
  window.Element.prototype.getClientRects = function getClientRects() {
8
8
  const isHidden = (element) => {
9
- if (element.parentElement && isHidden(element.parentElement)) {
9
+ if (!element.isConnected)
10
10
  return true;
11
- }
12
- if (!(element instanceof HTMLElement)) {
11
+ if (element.parentElement && isHidden(element.parentElement))
12
+ return true;
13
+ if (!(element instanceof HTMLElement))
13
14
  return false;
14
- }
15
- if (element.hidden) {
15
+ if (element.hidden)
16
16
  return true;
17
- }
18
17
  const style = getComputedStyle(element);
19
18
  return style.display === "none" || style.visibility === "hidden";
20
19
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
4
4
 
@@ -14,7 +14,7 @@ function focus(element) {
14
14
  if (!_focus.isFocusable.call(void 0, element))
15
15
  return;
16
16
  const activeElement = _dom.getActiveElement.call(void 0, element);
17
- if (_optionalChain([activeElement, 'optionalAccess', _ => _.dirty])) {
17
+ if (activeElement == null ? void 0 : activeElement.dirty) {
18
18
  _67NJSPQEcjs.fireEvent.change(activeElement);
19
19
  activeElement.dirty = false;
20
20
  }
@@ -3,11 +3,14 @@
3
3
  var _6EKN2NLXcjs = require('./6EKN2NLX.cjs');
4
4
 
5
5
 
6
- var _MRZIZFYGcjs = require('./MRZIZFYG.cjs');
6
+ var _7LXN4GA5cjs = require('./7LXN4GA5.cjs');
7
7
 
8
8
 
9
9
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
10
10
 
11
+
12
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
13
+
11
14
  // src/mouse-down.ts
12
15
  var _dom = require('@ariakit/core/utils/dom');
13
16
  var _focus = require('@ariakit/core/utils/focus');
@@ -15,7 +18,7 @@ function mouseDown(element, options) {
15
18
  const { disabled } = element;
16
19
  let defaultAllowed = _67NJSPQEcjs.fireEvent.pointerDown(element, options);
17
20
  if (!disabled) {
18
- if (!_67NJSPQEcjs.fireEvent.mouseDown(element, { detail: 1, ...options })) {
21
+ if (!_67NJSPQEcjs.fireEvent.mouseDown(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options))) {
19
22
  defaultAllowed = false;
20
23
  }
21
24
  }
@@ -28,11 +31,11 @@ function mouseDown(element, options) {
28
31
  }
29
32
  }
30
33
  if (_focus.isFocusable.call(void 0, element) && getComputedStyle(element).pointerEvents !== "none") {
31
- _MRZIZFYGcjs.focus.call(void 0, element);
34
+ _7LXN4GA5cjs.focus.call(void 0, element);
32
35
  } else if (element.parentElement) {
33
36
  const closestFocusable = _focus.getClosestFocusable.call(void 0, element.parentElement);
34
37
  if (closestFocusable) {
35
- _MRZIZFYGcjs.focus.call(void 0, closestFocusable);
38
+ _7LXN4GA5cjs.focus.call(void 0, closestFocusable);
36
39
  } else {
37
40
  _6EKN2NLXcjs.blur.call(void 0, );
38
41
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _JQOPUXXKcjs = require('./JQOPUXXK.cjs');
3
+ var _4PLCBYAVcjs = require('./4PLCBYAV.cjs');
4
4
 
5
5
  // src/tap.ts
6
6
  async function tap(element, options) {
7
- await _JQOPUXXKcjs.click.call(void 0, element, options, true);
7
+ await _4PLCBYAVcjs.click.call(void 0, element, options, true);
8
8
  }
9
9
 
10
10
 
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _OZ7WVH2Hcjs = require('./OZ7WVH2H.cjs');
3
+ var _3SY2LMBFcjs = require('./3SY2LMBF.cjs');
4
4
 
5
5
 
6
- var _XMPFC5C3cjs = require('./XMPFC5C3.cjs');
6
+ var _7WNWDQ4Xcjs = require('./7WNWDQ4X.cjs');
7
7
 
8
8
 
9
- var _4XKG4LDQcjs = require('./4XKG4LDQ.cjs');
9
+ var _WHLWNNUIcjs = require('./WHLWNNUI.cjs');
10
10
 
11
11
 
12
12
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
@@ -14,11 +14,15 @@ var _67NJSPQEcjs = require('./67NJSPQE.cjs');
14
14
 
15
15
  var _7RUXTAPPcjs = require('./7RUXTAPP.cjs');
16
16
 
17
+
18
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
19
+
17
20
  // src/select.ts
18
21
  async function select(text, element = document.body, options) {
22
+ var _a, _b;
19
23
  const document2 = element.ownerDocument;
20
- await _4XKG4LDQcjs.hover.call(void 0, element, options);
21
- _XMPFC5C3cjs.mouseDown.call(void 0, element, options);
24
+ await _WHLWNNUIcjs.hover.call(void 0, element, options);
25
+ _7WNWDQ4Xcjs.mouseDown.call(void 0, element, options);
22
26
  element.dispatchEvent(
23
27
  new Event("selectstart", {
24
28
  bubbles: true,
@@ -26,7 +30,7 @@ async function select(text, element = document.body, options) {
26
30
  composed: false
27
31
  })
28
32
  );
29
- const startIndex = _nullishCoalesce(_optionalChain([element, 'access', _ => _.textContent, 'optionalAccess', _2 => _2.indexOf, 'call', _3 => _3(text)]), () => ( -1));
33
+ const startIndex = (_b = (_a = element.textContent) == null ? void 0 : _a.indexOf(text)) != null ? _b : -1;
30
34
  const selection = document2.getSelection();
31
35
  const range = document2.createRange();
32
36
  for (let i = 1; i <= text.length; i++) {
@@ -57,17 +61,17 @@ async function select(text, element = document.body, options) {
57
61
  }
58
62
  if (!startContainer || !endContainer)
59
63
  continue;
60
- await _4XKG4LDQcjs.hover.call(void 0, element, options);
64
+ await _WHLWNNUIcjs.hover.call(void 0, element, options);
61
65
  range.setStart(startContainer, startOffset);
62
66
  range.setEnd(endContainer, endOffset);
63
- _optionalChain([selection, 'optionalAccess', _4 => _4.removeAllRanges, 'call', _5 => _5()]);
64
- _optionalChain([selection, 'optionalAccess', _6 => _6.addRange, 'call', _7 => _7(range)]);
67
+ selection == null ? void 0 : selection.removeAllRanges();
68
+ selection == null ? void 0 : selection.addRange(range);
65
69
  }
66
70
  await _7RUXTAPPcjs.sleep.call(void 0, );
67
- _OZ7WVH2Hcjs.mouseUp.call(void 0, element, options);
68
- _67NJSPQEcjs.fireEvent.click(element, { detail: 1, ...options });
69
- _optionalChain([selection, 'optionalAccess', _8 => _8.removeAllRanges, 'call', _9 => _9()]);
70
- _optionalChain([selection, 'optionalAccess', _10 => _10.addRange, 'call', _11 => _11(range)]);
71
+ _3SY2LMBFcjs.mouseUp.call(void 0, element, options);
72
+ _67NJSPQEcjs.fireEvent.click(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { detail: 1 }, options));
73
+ selection == null ? void 0 : selection.removeAllRanges();
74
+ selection == null ? void 0 : selection.addRange(range);
71
75
  await _7RUXTAPPcjs.sleep.call(void 0, );
72
76
  }
73
77
 
@@ -1,8 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/render.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
4
+
5
+ // src/render.ts
2
6
  var _react = require('react');
3
7
  var _react3 = require('@testing-library/react');
4
8
  function customRender(ui, options) {
5
- return _react3.render.call(void 0, ui, { wrapper: _react.StrictMode, ...options });
9
+ return _react3.render.call(void 0, ui, _LDC5CPCYcjs.__spreadValues.call(void 0, { wrapper: _react.StrictMode }, options));
6
10
  }
7
11
 
8
12
 
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+
22
+
23
+
24
+ exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps;
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _FKRMBIQScjs = require('./FKRMBIQS.cjs');
3
+ var _T7IGORAFcjs = require('./T7IGORAF.cjs');
4
4
 
5
5
 
6
6
  var _6EKN2NLXcjs = require('./6EKN2NLX.cjs');
7
7
 
8
8
 
9
- var _MRZIZFYGcjs = require('./MRZIZFYG.cjs');
9
+ var _7LXN4GA5cjs = require('./7LXN4GA5.cjs');
10
10
 
11
11
 
12
12
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
@@ -17,6 +17,9 @@ var _7RUXTAPPcjs = require('./7RUXTAPP.cjs');
17
17
 
18
18
  var _3WW644T7cjs = require('./3WW644T7.cjs');
19
19
 
20
+
21
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
22
+
20
23
  // src/press.ts
21
24
  var _dom = require('@ariakit/core/utils/dom');
22
25
 
@@ -64,7 +67,7 @@ var keyDownMap = {
64
67
  Tab(_, { shiftKey }) {
65
68
  const nextElement = shiftKey ? _focus.getPreviousTabbable.call(void 0, ) : _focus.getNextTabbable.call(void 0, );
66
69
  if (nextElement) {
67
- _MRZIZFYGcjs.focus.call(void 0, nextElement);
70
+ _7LXN4GA5cjs.focus.call(void 0, nextElement);
68
71
  }
69
72
  },
70
73
  Enter(element, options) {
@@ -80,7 +83,7 @@ var keyDownMap = {
80
83
  ArrowLeft(element, { shiftKey }) {
81
84
  if (_dom.isTextField.call(void 0, element)) {
82
85
  const { value, selectionStart, selectionEnd, selectionDirection } = element;
83
- const [start, end] = [_nullishCoalesce(selectionStart, () => ( 0)), _nullishCoalesce(selectionEnd, () => ( 0))];
86
+ const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
84
87
  const collapsing = !shiftKey && start !== end;
85
88
  const nextStart = Math.max(0, collapsing ? start : start - 1);
86
89
  const nextEnd = Math.min(value.length, shiftKey ? end : nextStart);
@@ -94,7 +97,7 @@ var keyDownMap = {
94
97
  ArrowRight(element, { shiftKey }) {
95
98
  if (_dom.isTextField.call(void 0, element)) {
96
99
  const { value, selectionStart, selectionEnd, selectionDirection } = element;
97
- const [start, end] = [_nullishCoalesce(selectionStart, () => ( 0)), _nullishCoalesce(selectionEnd, () => ( 0))];
100
+ const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
98
101
  const collapsing = !shiftKey && start !== end;
99
102
  const nextEnd = Math.min(value.length, collapsing ? end : end + 1);
100
103
  const nextStart = Math.max(0, shiftKey ? start : nextEnd);
@@ -111,7 +114,7 @@ var keyDownMap = {
111
114
  return element.setSelectionRange(0, 0);
112
115
  } else {
113
116
  const { selectionStart, selectionEnd, selectionDirection } = element;
114
- const [start, end] = [_nullishCoalesce(selectionStart, () => ( 0)), _nullishCoalesce(selectionEnd, () => ( 0))];
117
+ const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
115
118
  if (selectionDirection === "forward") {
116
119
  element.setSelectionRange(start, start);
117
120
  } else {
@@ -129,7 +132,7 @@ var keyDownMap = {
129
132
  element.setSelectionRange(length, length);
130
133
  } else {
131
134
  const { selectionStart, selectionEnd, selectionDirection } = element;
132
- const [start, end] = [_nullishCoalesce(selectionStart, () => ( 0)), _nullishCoalesce(selectionEnd, () => ( 0))];
135
+ const [start, end] = [selectionStart != null ? selectionStart : 0, selectionEnd != null ? selectionEnd : 0];
133
136
  if (selectionDirection === "backward") {
134
137
  element.setSelectionRange(end, end);
135
138
  } else {
@@ -152,6 +155,7 @@ var keyUpMap = {
152
155
  }
153
156
  };
154
157
  async function press(key, element, options = {}) {
158
+ var _a, _b, _c, _d;
155
159
  if (element == null) {
156
160
  element = document.activeElement || document.body;
157
161
  }
@@ -161,43 +165,43 @@ async function press(key, element, options = {}) {
161
165
  return;
162
166
  if (_dom.isTextField.call(void 0, element)) {
163
167
  if (key.length === 1) {
164
- return _FKRMBIQScjs.type.call(void 0, key, element, options);
168
+ return _T7IGORAFcjs.type.call(void 0, key, element, options);
165
169
  } else if (key === "Delete") {
166
- return _FKRMBIQScjs.type.call(void 0, "\x7F", element, options);
170
+ return _T7IGORAFcjs.type.call(void 0, "\x7F", element, options);
167
171
  } else if (key === "Backspace") {
168
- return _FKRMBIQScjs.type.call(void 0, "\b", element, options);
172
+ return _T7IGORAFcjs.type.call(void 0, "\b", element, options);
169
173
  } else if (key === "Enter" && element.tagName === "TEXTAREA") {
170
- return _FKRMBIQScjs.type.call(void 0, "\n", element, options);
174
+ return _T7IGORAFcjs.type.call(void 0, "\n", element, options);
171
175
  }
172
176
  }
173
- if (_optionalChain([element, 'access', _2 => _2.ownerDocument, 'optionalAccess', _3 => _3.activeElement]) !== element) {
177
+ if (((_a = element.ownerDocument) == null ? void 0 : _a.activeElement) !== element) {
174
178
  if (element.tagName === "BODY") {
175
179
  _6EKN2NLXcjs.blur.call(void 0, );
176
180
  } else {
177
- _MRZIZFYGcjs.focus.call(void 0, element);
181
+ _7LXN4GA5cjs.focus.call(void 0, element);
178
182
  }
179
183
  }
180
184
  await _7RUXTAPPcjs.sleep.call(void 0, );
181
- let defaultAllowed = _67NJSPQEcjs.fireEvent.keyDown(element, { key, ...options });
185
+ let defaultAllowed = _67NJSPQEcjs.fireEvent.keyDown(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { key }, options));
182
186
  await _3WW644T7cjs.queuedMicrotasks.call(void 0, );
183
187
  if (defaultAllowed && key in keyDownMap && !options.metaKey) {
184
- _optionalChain([keyDownMap, 'access', _4 => _4[key], 'optionalCall', _5 => _5(element, options)]);
188
+ (_b = keyDownMap[key]) == null ? void 0 : _b.call(keyDownMap, element, options);
185
189
  }
186
190
  await _7RUXTAPPcjs.sleep.call(void 0, );
187
- if (_optionalChain([element, 'access', _6 => _6.ownerDocument, 'optionalAccess', _7 => _7.activeElement]) !== element) {
191
+ if (((_c = element.ownerDocument) == null ? void 0 : _c.activeElement) !== element) {
188
192
  element = element.ownerDocument.activeElement;
189
193
  }
190
- if (!_67NJSPQEcjs.fireEvent.keyUp(element, { key, ...options })) {
194
+ if (!_67NJSPQEcjs.fireEvent.keyUp(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { key }, options))) {
191
195
  defaultAllowed = false;
192
196
  }
193
197
  await _3WW644T7cjs.queuedMicrotasks.call(void 0, );
194
198
  if (defaultAllowed && key in keyUpMap && !options.metaKey) {
195
- _optionalChain([keyUpMap, 'access', _8 => _8[key], 'optionalCall', _9 => _9(element, options)]);
199
+ (_d = keyUpMap[key]) == null ? void 0 : _d.call(keyUpMap, element, options);
196
200
  }
197
201
  await _7RUXTAPPcjs.sleep.call(void 0, );
198
202
  }
199
203
  function createPress(key, defaultOptions = {}) {
200
- return (element, options = {}) => press(key, element, { ...defaultOptions, ...options });
204
+ return (element, options = {}) => press(key, element, _LDC5CPCYcjs.__spreadValues.call(void 0, _LDC5CPCYcjs.__spreadValues.call(void 0, {}, defaultOptions), options));
201
205
  }
202
206
  press.Escape = createPress("Escape");
203
207
  press.Backspace = createPress("Backspace");
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _MRZIZFYGcjs = require('./MRZIZFYG.cjs');
3
+ var _7LXN4GA5cjs = require('./7LXN4GA5.cjs');
4
4
 
5
5
 
6
6
  var _67NJSPQEcjs = require('./67NJSPQE.cjs');
@@ -11,6 +11,9 @@ var _7RUXTAPPcjs = require('./7RUXTAPP.cjs');
11
11
 
12
12
  var _3WW644T7cjs = require('./3WW644T7.cjs');
13
13
 
14
+
15
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
16
+
14
17
  // src/type.ts
15
18
  var _dom = require('@ariakit/core/utils/dom');
16
19
  var _focus = require('@ariakit/core/utils/focus');
@@ -36,24 +39,25 @@ function workAroundEmailInput(element) {
36
39
  };
37
40
  }
38
41
  async function type(text, element, options = {}) {
42
+ var _a, _b;
39
43
  if (element == null) {
40
44
  element = document.activeElement;
41
45
  }
42
46
  if (!element || !_focus.isFocusable.call(void 0, element))
43
47
  return;
44
- _MRZIZFYGcjs.focus.call(void 0, element);
48
+ _7LXN4GA5cjs.focus.call(void 0, element);
45
49
  element.dirty = true;
46
50
  const restoreEmailInput = workAroundEmailInput(element);
47
51
  for (const char of text) {
48
52
  const key = getKeyFromChar(char);
49
53
  let value = "";
50
54
  let inputType = options.isComposing ? "insertCompositionText" : "insertText";
51
- let defaultAllowed = _67NJSPQEcjs.fireEvent.keyDown(element, { key, ...options });
55
+ let defaultAllowed = _67NJSPQEcjs.fireEvent.keyDown(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { key }, options));
52
56
  await _3WW644T7cjs.queuedMicrotasks.call(void 0, );
53
57
  element = _dom.getActiveElement.call(void 0, element) || element;
54
58
  if (_dom.isTextField.call(void 0, element)) {
55
59
  const input = element;
56
- const [start, end] = [_nullishCoalesce(input.selectionStart, () => ( 0)), _nullishCoalesce(input.selectionEnd, () => ( 0))];
60
+ const [start, end] = [(_a = input.selectionStart) != null ? _a : 0, (_b = input.selectionEnd) != null ? _b : 0];
57
61
  const collapsed = start === end;
58
62
  let nextCaretPosition = start;
59
63
  if (char === "\x7F") {
@@ -76,30 +80,27 @@ async function type(text, element, options = {}) {
76
80
  }
77
81
  if (defaultAllowed && !input.readOnly) {
78
82
  if (inputType === "insertText") {
79
- defaultAllowed = _67NJSPQEcjs.fireEvent.keyPress(input, {
83
+ defaultAllowed = _67NJSPQEcjs.fireEvent.keyPress(input, _LDC5CPCYcjs.__spreadValues.call(void 0, {
80
84
  key,
81
- charCode: key.charCodeAt(0),
82
- ...options
83
- });
85
+ charCode: key.charCodeAt(0)
86
+ }, options));
84
87
  }
85
88
  if (inputType === "insertCompositionText") {
86
- defaultAllowed = _67NJSPQEcjs.fireEvent.compositionUpdate(input, {
89
+ defaultAllowed = _67NJSPQEcjs.fireEvent.compositionUpdate(input, _LDC5CPCYcjs.__spreadValues.call(void 0, {
87
90
  data: char,
88
- target: { value },
89
- ...options
90
- });
91
+ target: { value }
92
+ }, options));
91
93
  }
92
94
  if (defaultAllowed) {
93
- _67NJSPQEcjs.fireEvent.input(input, {
95
+ _67NJSPQEcjs.fireEvent.input(input, _LDC5CPCYcjs.__spreadValues.call(void 0, {
94
96
  data: char,
95
97
  target: {
96
98
  value,
97
99
  selectionStart: nextCaretPosition,
98
100
  selectionEnd: nextCaretPosition
99
101
  },
100
- inputType,
101
- ...options
102
- });
102
+ inputType
103
+ }, options));
103
104
  if (input.selectionStart !== nextCaretPosition) {
104
105
  input.setSelectionRange(nextCaretPosition, nextCaretPosition);
105
106
  }
@@ -107,7 +108,7 @@ async function type(text, element, options = {}) {
107
108
  }
108
109
  }
109
110
  await _7RUXTAPPcjs.sleep.call(void 0, );
110
- _67NJSPQEcjs.fireEvent.keyUp(element, { key, ...options });
111
+ _67NJSPQEcjs.fireEvent.keyUp(element, _LDC5CPCYcjs.__spreadValues.call(void 0, { key }, options));
111
112
  await _7RUXTAPPcjs.sleep.call(void 0, );
112
113
  }
113
114
  restoreEmailInput();
@@ -8,6 +8,10 @@ var _7RUXTAPPcjs = require('./7RUXTAPP.cjs');
8
8
 
9
9
  var _3WW644T7cjs = require('./3WW644T7.cjs');
10
10
 
11
+
12
+
13
+ var _LDC5CPCYcjs = require('./LDC5CPCY.cjs');
14
+
11
15
  // src/hover.ts
12
16
  function isPointerEventsEnabled(element) {
13
17
  return getComputedStyle(element).pointerEvents !== "none";
@@ -23,7 +27,7 @@ async function hover(element, options) {
23
27
  if (isPointerEventsEnabled(lastHovered)) {
24
28
  const isElementWithinLastHovered = lastHovered.contains(element);
25
29
  const relatedTarget = pointerEventsEnabled ? element : null;
26
- const leaveOptions = { ...options, relatedTarget };
30
+ const leaveOptions = _LDC5CPCYcjs.__spreadProps.call(void 0, _LDC5CPCYcjs.__spreadValues.call(void 0, {}, options), { relatedTarget });
27
31
  _67NJSPQEcjs.fireEvent.pointerOut(lastHovered, leaveOptions);
28
32
  if (!isElementWithinLastHovered) {
29
33
  _67NJSPQEcjs.fireEvent.pointerLeave(lastHovered, leaveOptions);
@@ -36,7 +40,7 @@ async function hover(element, options) {
36
40
  }
37
41
  await _7RUXTAPPcjs.sleep.call(void 0, );
38
42
  if (pointerEventsEnabled) {
39
- const enterOptions = lastHovered ? { relatedTarget: lastHovered, ...options } : options;
43
+ const enterOptions = lastHovered ? _LDC5CPCYcjs.__spreadValues.call(void 0, { relatedTarget: lastHovered }, options) : options;
40
44
  _67NJSPQEcjs.fireEvent.pointerOver(element, enterOptions);
41
45
  _67NJSPQEcjs.fireEvent.pointerEnter(element, enterOptions);
42
46
  if (!disabled) {
package/cjs/act.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  var _3WW644T7cjs = require('./__chunks/3WW644T7.cjs');
5
+ require('./__chunks/LDC5CPCY.cjs');
5
6
 
6
7
 
7
8
  exports.act = _3WW644T7cjs.act;
package/cjs/blur.cjs CHANGED
@@ -4,6 +4,7 @@ var _6EKN2NLXcjs = require('./__chunks/6EKN2NLX.cjs');
4
4
  require('./__chunks/67NJSPQE.cjs');
5
5
  require('./__chunks/AYRPODWR.cjs');
6
6
  require('./__chunks/3WW644T7.cjs');
7
+ require('./__chunks/LDC5CPCY.cjs');
7
8
 
8
9
 
9
10
  exports.blur = _6EKN2NLXcjs.blur;