@ctrl/dom 0.0.0-stage → 0.1.0

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 (380) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +338 -0
  3. package/README.md +362 -2
  4. package/dist/aria/_chunks/roles-list-CYZF-l9K.js +1503 -0
  5. package/dist/aria/_chunks/roles-list-D4WCyRO_.cjs +1754 -0
  6. package/dist/aria/index.cjs +232 -0
  7. package/dist/aria/index.js +198 -0
  8. package/dist/aria/internal.cjs +69 -0
  9. package/dist/aria/internal.js +30 -0
  10. package/dist/aria/types/accname.d.ts +40 -0
  11. package/dist/aria/types/data/aria-query.d.ts +61 -0
  12. package/dist/aria/types/data/aria-query.generated.d.ts +2 -0
  13. package/dist/aria/types/forms.d.ts +25 -0
  14. package/dist/aria/types/hidden.d.ts +38 -0
  15. package/dist/aria/types/index.d.ts +46 -0
  16. package/dist/aria/types/internal.d.ts +15 -0
  17. package/dist/aria/types/role.d.ts +27 -0
  18. package/dist/aria/types/roles-list.d.ts +18 -0
  19. package/dist/aria/types/states.d.ts +29 -0
  20. package/dist/aria/types/style.d.ts +18 -0
  21. package/dist/aria/types/tree.d.ts +20 -0
  22. package/dist/bridge/index.cjs +3 -0
  23. package/dist/bridge/index.js +4 -0
  24. package/dist/bridge/internal.cjs +3 -0
  25. package/dist/bridge/internal.js +4 -0
  26. package/dist/cli/_chunks/report-DdncYfuJ.js +93 -0
  27. package/dist/cli/ctrl-dom.js +199 -0
  28. package/dist/cli/jest-reporter.js +55 -0
  29. package/dist/cli/vitest-reporter.js +81 -0
  30. package/dist/dom/_chunks/src-DWP2w3IQ.js +47516 -0
  31. package/dist/dom/index.js +3 -0
  32. package/dist/dom/internal.js +434 -0
  33. package/dist/dom/types/collections/DOMStringMap.d.ts +8 -0
  34. package/dist/dom/types/collections/DOMTokenList.d.ts +33 -0
  35. package/dist/dom/types/collections/HTMLCollection.d.ts +62 -0
  36. package/dist/dom/types/collections/NamedNodeMap.d.ts +22 -0
  37. package/dist/dom/types/collections/NodeList.d.ts +43 -0
  38. package/dist/dom/types/collections/indexed.d.ts +8 -0
  39. package/dist/dom/types/collections/iterator.d.ts +8 -0
  40. package/dist/dom/types/css/CSS.d.ts +21 -0
  41. package/dist/dom/types/css/CSSStyleDeclaration.d.ts +57 -0
  42. package/dist/dom/types/css/cascade.d.ts +159 -0
  43. package/dist/dom/types/css/colors.d.ts +28 -0
  44. package/dist/dom/types/css/computed.d.ts +22 -0
  45. package/dist/dom/types/css/cssom.d.ts +363 -0
  46. package/dist/dom/types/css/data/properties.d.ts +1 -0
  47. package/dist/dom/types/css/declarations.d.ts +40 -0
  48. package/dist/dom/types/css/index.d.ts +5 -0
  49. package/dist/dom/types/css/inline-count.d.ts +2 -0
  50. package/dist/dom/types/css/internal.d.ts +11 -0
  51. package/dist/dom/types/css/layout-mode.d.ts +4 -0
  52. package/dist/dom/types/css/layout.d.ts +63 -0
  53. package/dist/dom/types/css/media.d.ts +55 -0
  54. package/dist/dom/types/css/parser.d.ts +93 -0
  55. package/dist/dom/types/css/properties.d.ts +28 -0
  56. package/dist/dom/types/css/resize-observer.d.ts +19 -0
  57. package/dist/dom/types/css/selector-info.d.ts +13 -0
  58. package/dist/dom/types/css/shorthands.d.ts +33 -0
  59. package/dist/dom/types/css/stylesheets.d.ts +93 -0
  60. package/dist/dom/types/css/supports.d.ts +4 -0
  61. package/dist/dom/types/css/tokenizer.d.ts +91 -0
  62. package/dist/dom/types/css/values.d.ts +91 -0
  63. package/dist/dom/types/css/view.d.ts +44 -0
  64. package/dist/dom/types/events/DataTransfer.d.ts +62 -0
  65. package/dist/dom/types/events/Event.d.ts +115 -0
  66. package/dist/dom/types/events/EventTarget.d.ts +22 -0
  67. package/dist/dom/types/events/UIEvents.d.ts +308 -0
  68. package/dist/dom/types/events/activation.d.ts +7 -0
  69. package/dist/dom/types/events/convert.d.ts +16 -0
  70. package/dist/dom/types/events/createEvent.d.ts +3 -0
  71. package/dist/dom/types/events/dispatch.d.ts +39 -0
  72. package/dist/dom/types/events/events.d.ts +200 -0
  73. package/dist/dom/types/events/fire.d.ts +21 -0
  74. package/dist/dom/types/events/handlers.d.ts +14 -0
  75. package/dist/dom/types/events/listeners.d.ts +32 -0
  76. package/dist/dom/types/events/report.d.ts +10 -0
  77. package/dist/dom/types/html/HTMLElement.d.ts +126 -0
  78. package/dist/dom/types/html/MathMLElement.d.ts +6 -0
  79. package/dist/dom/types/html/SVGElement.d.ts +145 -0
  80. package/dist/dom/types/html/anchor.d.ts +16 -0
  81. package/dist/dom/types/html/aria-reflection.d.ts +14 -0
  82. package/dist/dom/types/html/collection.d.ts +5 -0
  83. package/dist/dom/types/html/custom-elements.d.ts +129 -0
  84. package/dist/dom/types/html/elements.d.ts +202 -0
  85. package/dist/dom/types/html/events.d.ts +22 -0
  86. package/dist/dom/types/html/focus.d.ts +63 -0
  87. package/dist/dom/types/html/forms/FileList.d.ts +1 -0
  88. package/dist/dom/types/html/forms/FormData.d.ts +7 -0
  89. package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +36 -0
  90. package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +29 -0
  91. package/dist/dom/types/html/forms/HTMLFormElement.d.ts +61 -0
  92. package/dist/dom/types/html/forms/HTMLInputElement.d.ts +204 -0
  93. package/dist/dom/types/html/forms/HTMLLabelElement.d.ts +15 -0
  94. package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +61 -0
  95. package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +74 -0
  96. package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +96 -0
  97. package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +82 -0
  98. package/dist/dom/types/html/forms/autofill.d.ts +10 -0
  99. package/dist/dom/types/html/forms/collections.d.ts +112 -0
  100. package/dist/dom/types/html/forms/common.d.ts +36 -0
  101. package/dist/dom/types/html/forms/face.d.ts +59 -0
  102. package/dist/dom/types/html/forms/form-associated.d.ts +46 -0
  103. package/dist/dom/types/html/forms/form-submission.d.ts +55 -0
  104. package/dist/dom/types/html/forms/index.d.ts +17 -0
  105. package/dist/dom/types/html/forms/input-type.d.ts +50 -0
  106. package/dist/dom/types/html/forms/microsyntaxes.d.ts +52 -0
  107. package/dist/dom/types/html/forms/state.d.ts +54 -0
  108. package/dist/dom/types/html/forms/ui.d.ts +35 -0
  109. package/dist/dom/types/html/forms/user-validity.d.ts +19 -0
  110. package/dist/dom/types/html/forms/validation.d.ts +76 -0
  111. package/dist/dom/types/html/index.d.ts +13 -0
  112. package/dist/dom/types/html/innerText.d.ts +9 -0
  113. package/dist/dom/types/html/interactive.d.ts +43 -0
  114. package/dist/dom/types/html/invokers.d.ts +39 -0
  115. package/dist/dom/types/html/media.d.ts +86 -0
  116. package/dist/dom/types/html/reflect.d.ts +67 -0
  117. package/dist/dom/types/html/registry.d.ts +9 -0
  118. package/dist/dom/types/html/resources.d.ts +55 -0
  119. package/dist/dom/types/html/shared.d.ts +22 -0
  120. package/dist/dom/types/html/slot.d.ts +15 -0
  121. package/dist/dom/types/html/template.d.ts +18 -0
  122. package/dist/dom/types/html/top-layer.d.ts +73 -0
  123. package/dist/dom/types/index.d.ts +50 -0
  124. package/dist/dom/types/internal.d.ts +61 -0
  125. package/dist/dom/types/keys.d.ts +209 -0
  126. package/dist/dom/types/nodes/Attr.d.ts +25 -0
  127. package/dist/dom/types/nodes/CharacterData.d.ts +35 -0
  128. package/dist/dom/types/nodes/Document.d.ts +169 -0
  129. package/dist/dom/types/nodes/DocumentFragment.d.ts +12 -0
  130. package/dist/dom/types/nodes/DocumentType.d.ts +17 -0
  131. package/dist/dom/types/nodes/Element.d.ts +142 -0
  132. package/dist/dom/types/nodes/Node.d.ts +112 -0
  133. package/dist/dom/types/nodes/NodeImpl.d.ts +90 -0
  134. package/dist/dom/types/nodes/ShadowRoot.d.ts +43 -0
  135. package/dist/dom/types/nodes/attr-nodes.d.ts +8 -0
  136. package/dist/dom/types/nodes/attributes.d.ts +46 -0
  137. package/dist/dom/types/nodes/cache.d.ts +38 -0
  138. package/dist/dom/types/nodes/character-data.d.ts +5 -0
  139. package/dist/dom/types/nodes/clone.d.ts +5 -0
  140. package/dist/dom/types/nodes/constants.d.ts +52 -0
  141. package/dist/dom/types/nodes/create.d.ts +42 -0
  142. package/dist/dom/types/nodes/derived.d.ts +26 -0
  143. package/dist/dom/types/nodes/inspect.d.ts +2 -0
  144. package/dist/dom/types/nodes/mixins.d.ts +41 -0
  145. package/dist/dom/types/nodes/names.d.ts +15 -0
  146. package/dist/dom/types/nodes/slots.d.ts +38 -0
  147. package/dist/dom/types/nodes/tags.d.ts +8 -0
  148. package/dist/dom/types/nodes/traverse.d.ts +21 -0
  149. package/dist/dom/types/nodes/tree.d.ts +47 -0
  150. package/dist/dom/types/observers/MutationObserver.d.ts +33 -0
  151. package/dist/dom/types/observers/MutationRecord.d.ts +17 -0
  152. package/dist/dom/types/observers/queue.d.ts +45 -0
  153. package/dist/dom/types/parser/entities-data.d.ts +3 -0
  154. package/dist/dom/types/parser/entities.d.ts +11 -0
  155. package/dist/dom/types/parser/index.d.ts +34 -0
  156. package/dist/dom/types/parser/tags.d.ts +182 -0
  157. package/dist/dom/types/parser/tokenizer.d.ts +109 -0
  158. package/dist/dom/types/parser/treebuilder.d.ts +271 -0
  159. package/dist/dom/types/parser/xml.d.ts +14 -0
  160. package/dist/dom/types/selectors/compile.d.ts +154 -0
  161. package/dist/dom/types/selectors/filter.d.ts +21 -0
  162. package/dist/dom/types/selectors/html-predicates.d.ts +1 -0
  163. package/dist/dom/types/selectors/index.d.ts +16 -0
  164. package/dist/dom/types/selectors/internal.d.ts +87 -0
  165. package/dist/dom/types/selectors/parser.d.ts +310 -0
  166. package/dist/dom/types/selectors/serialize.d.ts +20 -0
  167. package/dist/dom/types/selectors/state.d.ts +43 -0
  168. package/dist/dom/types/serializer/index.d.ts +29 -0
  169. package/dist/dom/types/trace.d.ts +51 -0
  170. package/dist/dom/types/traversal/Range.d.ts +113 -0
  171. package/dist/dom/types/traversal/Selection.d.ts +45 -0
  172. package/dist/dom/types/traversal/TreeWalker.d.ts +77 -0
  173. package/dist/dom/types/traversal/live.d.ts +46 -0
  174. package/dist/dom/types/webidl-runtime.d.ts +18 -0
  175. package/dist/dom/types/webidl.d.ts +34 -0
  176. package/dist/dom/types/window/DOMStringList.d.ts +14 -0
  177. package/dist/dom/types/window/FileList.d.ts +11 -0
  178. package/dist/dom/types/window/FileReader.d.ts +27 -0
  179. package/dist/dom/types/window/History.d.ts +43 -0
  180. package/dist/dom/types/window/Location.d.ts +46 -0
  181. package/dist/dom/types/window/Navigator.d.ts +79 -0
  182. package/dist/dom/types/window/Screen.d.ts +27 -0
  183. package/dist/dom/types/window/Storage.d.ts +28 -0
  184. package/dist/dom/types/window/Window.d.ts +329 -0
  185. package/dist/dom/types/window/abort.d.ts +4 -0
  186. package/dist/dom/types/window/browsing-context.d.ts +12 -0
  187. package/dist/dom/types/window/clock.d.ts +153 -0
  188. package/dist/dom/types/window/compat.d.ts +34 -0
  189. package/dist/dom/types/window/cookies.d.ts +21 -0
  190. package/dist/dom/types/window/current.d.ts +7 -0
  191. package/dist/dom/types/window/document.d.ts +19 -0
  192. package/dist/dom/types/window/events.d.ts +11 -0
  193. package/dist/dom/types/window/fallbacks.d.ts +20 -0
  194. package/dist/dom/types/window/geometry.d.ts +133 -0
  195. package/dist/dom/types/window/globals.d.ts +7 -0
  196. package/dist/dom/types/window/hooks.d.ts +22 -0
  197. package/dist/dom/types/window/host-originals.d.ts +9 -0
  198. package/dist/dom/types/window/interfaces.d.ts +13 -0
  199. package/dist/dom/types/window/isolation.d.ts +20 -0
  200. package/dist/dom/types/window/media.d.ts +33 -0
  201. package/dist/dom/types/window/not-implemented.d.ts +23 -0
  202. package/dist/dom/types/window/observers.d.ts +42 -0
  203. package/dist/dom/types/window/origin.d.ts +3 -0
  204. package/dist/dom/types/window/timers.d.ts +28 -0
  205. package/dist/dom/types/window/xhr.d.ts +108 -0
  206. package/dist/jest-dom/_chunks/matchers-CDnnXUfG.js +2211 -0
  207. package/dist/jest-dom/_chunks/matchers-D988Ducb.cjs +2516 -0
  208. package/dist/jest-dom/index.cjs +5 -0
  209. package/dist/jest-dom/index.js +6 -0
  210. package/dist/jest-dom/jest-globals.cjs +6 -0
  211. package/dist/jest-dom/jest-globals.js +7 -0
  212. package/dist/jest-dom/matchers.cjs +53 -0
  213. package/dist/jest-dom/matchers.js +3 -0
  214. package/dist/jest-dom/types/bun.d.ts +13 -0
  215. package/dist/jest-dom/types/index.d.ts +3 -0
  216. package/dist/jest-dom/types/jest-globals.d.ts +13 -0
  217. package/dist/jest-dom/types/jest.d.ts +15 -0
  218. package/dist/jest-dom/types/matchers-standalone.d.ts +32 -0
  219. package/dist/jest-dom/types/matchers.d.ts +1079 -0
  220. package/dist/jest-dom/types/package.json +1 -0
  221. package/dist/jest-dom/types/vitest.d.ts +16 -0
  222. package/dist/jest-dom/vitest.cjs +6 -0
  223. package/dist/jest-dom/vitest.js +7 -0
  224. package/dist/react/_chunks/pure-DZ97z2oT.cjs +498 -0
  225. package/dist/react/_chunks/pure-PtE2hivW.js +420 -0
  226. package/dist/react/dont-cleanup-after-each.cjs +3 -0
  227. package/dist/react/dont-cleanup-after-each.js +4 -0
  228. package/dist/react/index.cjs +47 -0
  229. package/dist/react/index.js +35 -0
  230. package/dist/react/pure.cjs +17 -0
  231. package/dist/react/pure.js +5 -0
  232. package/dist/react/types/act-compat.d.ts +6 -0
  233. package/dist/react/types/config.d.ts +9 -0
  234. package/dist/react/types/dont-cleanup-after-each.d.ts +1 -0
  235. package/dist/react/types/dtl.d.ts +1 -0
  236. package/dist/react/types/fire-event.d.ts +3 -0
  237. package/dist/react/types/index.d.ts +1 -0
  238. package/dist/react/types/pure.d.ts +136 -0
  239. package/dist/register/index.js +11 -0
  240. package/dist/register/pure.js +147 -0
  241. package/dist/register/types/index.d.ts +1 -0
  242. package/dist/register/types/pure.d.ts +36 -0
  243. package/dist/testing-library/_chunks/aria-snapshot-diff-D7PzpXew.cjs +1170 -0
  244. package/dist/testing-library/_chunks/aria-snapshot-diff-Q8Wj33K0.js +985 -0
  245. package/dist/testing-library/agent.cjs +721 -0
  246. package/dist/testing-library/agent.js +713 -0
  247. package/dist/testing-library/index.cjs +2469 -0
  248. package/dist/testing-library/index.js +2390 -0
  249. package/dist/testing-library/types/agent.d.ts +56 -0
  250. package/dist/testing-library/types/aria-role.d.ts +99 -0
  251. package/dist/testing-library/types/aria-snapshot.d.ts +43 -0
  252. package/dist/testing-library/types/config.d.ts +27 -0
  253. package/dist/testing-library/types/events.d.ts +118 -0
  254. package/dist/testing-library/types/get-node-text.d.ts +1 -0
  255. package/dist/testing-library/types/get-queries-for-element.d.ts +182 -0
  256. package/dist/testing-library/types/index.d.ts +24 -0
  257. package/dist/testing-library/types/matches.d.ts +46 -0
  258. package/dist/testing-library/types/pretty-dom.d.ts +37 -0
  259. package/dist/testing-library/types/queries.d.ts +315 -0
  260. package/dist/testing-library/types/query-helpers.d.ts +112 -0
  261. package/dist/testing-library/types/role-helpers.d.ts +19 -0
  262. package/dist/testing-library/types/screen.d.ts +30 -0
  263. package/dist/testing-library/types/suggestions.d.ts +46 -0
  264. package/dist/testing-library/types/wait-for-element-to-be-removed.d.ts +6 -0
  265. package/dist/testing-library/types/wait-for.d.ts +12 -0
  266. package/dist/user-event/index.cjs +3910 -0
  267. package/dist/user-event/index.js +3885 -0
  268. package/dist/user-event/types/clipboard/copy.d.ts +2 -0
  269. package/dist/user-event/types/clipboard/cut.d.ts +2 -0
  270. package/dist/user-event/types/clipboard/index.d.ts +3 -0
  271. package/dist/user-event/types/clipboard/paste.d.ts +3 -0
  272. package/dist/user-event/types/convenience/click.d.ts +5 -0
  273. package/dist/user-event/types/convenience/hover.d.ts +4 -0
  274. package/dist/user-event/types/convenience/index.d.ts +3 -0
  275. package/dist/user-event/types/convenience/tab.d.ts +4 -0
  276. package/dist/user-event/types/ctrl-dom.d.ts +50 -0
  277. package/dist/user-event/types/document/UI.d.ts +35 -0
  278. package/dist/user-event/types/document/copySelection.d.ts +2 -0
  279. package/dist/user-event/types/document/getValueOrTextContent.d.ts +2 -0
  280. package/dist/user-event/types/document/index.d.ts +5 -0
  281. package/dist/user-event/types/document/interceptor.d.ts +20 -0
  282. package/dist/user-event/types/document/patchFocus.d.ts +7 -0
  283. package/dist/user-event/types/document/prepareDocument.d.ts +2 -0
  284. package/dist/user-event/types/document/trackValue.d.ts +13 -0
  285. package/dist/user-event/types/dom-types.d.ts +56 -0
  286. package/dist/user-event/types/event/behavior/click.d.ts +1 -0
  287. package/dist/user-event/types/event/behavior/cut.d.ts +1 -0
  288. package/dist/user-event/types/event/behavior/index.d.ts +8 -0
  289. package/dist/user-event/types/event/behavior/keydown.d.ts +1 -0
  290. package/dist/user-event/types/event/behavior/keypress.d.ts +1 -0
  291. package/dist/user-event/types/event/behavior/keyup.d.ts +1 -0
  292. package/dist/user-event/types/event/behavior/paste.d.ts +1 -0
  293. package/dist/user-event/types/event/behavior/registry.d.ts +9 -0
  294. package/dist/user-event/types/event/createEvent.d.ts +8 -0
  295. package/dist/user-event/types/event/dispatchEvent.d.ts +6 -0
  296. package/dist/user-event/types/event/eventMap.d.ts +265 -0
  297. package/dist/user-event/types/event/focus.d.ts +6 -0
  298. package/dist/user-event/types/event/index.d.ts +7 -0
  299. package/dist/user-event/types/event/input.d.ts +3 -0
  300. package/dist/user-event/types/event/radio.d.ts +5 -0
  301. package/dist/user-event/types/event/selection/getInputRange.d.ts +6 -0
  302. package/dist/user-event/types/event/selection/getTargetTypeAndSelection.d.ts +11 -0
  303. package/dist/user-event/types/event/selection/index.d.ts +15 -0
  304. package/dist/user-event/types/event/selection/modifySelection.d.ts +9 -0
  305. package/dist/user-event/types/event/selection/modifySelectionPerMouse.d.ts +8 -0
  306. package/dist/user-event/types/event/selection/moveSelection.d.ts +5 -0
  307. package/dist/user-event/types/event/selection/resolveCaretPosition.d.ts +9 -0
  308. package/dist/user-event/types/event/selection/selectAll.d.ts +6 -0
  309. package/dist/user-event/types/event/selection/setSelection.d.ts +11 -0
  310. package/dist/user-event/types/event/selection/setSelectionPerMouse.d.ts +9 -0
  311. package/dist/user-event/types/event/selection/setSelectionRange.d.ts +7 -0
  312. package/dist/user-event/types/event/selection/updateSelectionOnFocus.d.ts +6 -0
  313. package/dist/user-event/types/event/types.d.ts +21 -0
  314. package/dist/user-event/types/event/wrapEvent.d.ts +2 -0
  315. package/dist/user-event/types/index.d.ts +6 -0
  316. package/dist/user-event/types/keyboard/index.d.ts +3 -0
  317. package/dist/user-event/types/keyboard/keyMap.d.ts +5 -0
  318. package/dist/user-event/types/keyboard/parseKeyDef.d.ts +17 -0
  319. package/dist/user-event/types/options.d.ts +121 -0
  320. package/dist/user-event/types/pointer/index.d.ts +29 -0
  321. package/dist/user-event/types/pointer/keyMap.d.ts +2 -0
  322. package/dist/user-event/types/pointer/parseKeyDef.d.ts +6 -0
  323. package/dist/user-event/types/setup/api.d.ts +23 -0
  324. package/dist/user-event/types/setup/directApi.d.ts +25 -0
  325. package/dist/user-event/types/setup/dtl.d.ts +20 -0
  326. package/dist/user-event/types/setup/index.d.ts +22 -0
  327. package/dist/user-event/types/setup/setup.d.ts +45 -0
  328. package/dist/user-event/types/setup/wrapAsync.d.ts +4 -0
  329. package/dist/user-event/types/system/index.d.ts +13 -0
  330. package/dist/user-event/types/system/keyLocation.d.ts +11 -0
  331. package/dist/user-event/types/system/keyboard.d.ts +46 -0
  332. package/dist/user-event/types/system/pointer/buttons.d.ts +25 -0
  333. package/dist/user-event/types/system/pointer/device.d.ts +8 -0
  334. package/dist/user-event/types/system/pointer/index.d.ts +21 -0
  335. package/dist/user-event/types/system/pointer/mouse.d.ts +31 -0
  336. package/dist/user-event/types/system/pointer/pointer.d.ts +32 -0
  337. package/dist/user-event/types/system/pointer/shared.d.ts +21 -0
  338. package/dist/user-event/types/utility/clear.d.ts +3 -0
  339. package/dist/user-event/types/utility/index.d.ts +4 -0
  340. package/dist/user-event/types/utility/selectOptions.d.ts +4 -0
  341. package/dist/user-event/types/utility/type.d.ts +10 -0
  342. package/dist/user-event/types/utility/upload.d.ts +6 -0
  343. package/dist/user-event/types/utils/click/isClickableInput.d.ts +17 -0
  344. package/dist/user-event/types/utils/dataTransfer/Blob.d.ts +4 -0
  345. package/dist/user-event/types/utils/dataTransfer/Clipboard.d.ts +12 -0
  346. package/dist/user-event/types/utils/dataTransfer/DataTransfer.d.ts +3 -0
  347. package/dist/user-event/types/utils/dataTransfer/FileList.d.ts +2 -0
  348. package/dist/user-event/types/utils/edit/isContentEditable.d.ts +8 -0
  349. package/dist/user-event/types/utils/edit/isEditable.d.ts +26 -0
  350. package/dist/user-event/types/utils/edit/maxLength.d.ts +16 -0
  351. package/dist/user-event/types/utils/edit/setFiles.d.ts +11 -0
  352. package/dist/user-event/types/utils/edit/timeValue.d.ts +5 -0
  353. package/dist/user-event/types/utils/focus/cursor.d.ts +5 -0
  354. package/dist/user-event/types/utils/focus/getActiveElement.d.ts +3 -0
  355. package/dist/user-event/types/utils/focus/getTabDestination.d.ts +2 -0
  356. package/dist/user-event/types/utils/focus/isFocusable.d.ts +2 -0
  357. package/dist/user-event/types/utils/focus/selection.d.ts +9 -0
  358. package/dist/user-event/types/utils/focus/selector.d.ts +1 -0
  359. package/dist/user-event/types/utils/index.d.ts +29 -0
  360. package/dist/user-event/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
  361. package/dist/user-event/types/utils/misc/cloneEvent.d.ts +2 -0
  362. package/dist/user-event/types/utils/misc/findClosest.d.ts +2 -0
  363. package/dist/user-event/types/utils/misc/getDocumentFromNode.d.ts +2 -0
  364. package/dist/user-event/types/utils/misc/getTreeDiff.d.ts +2 -0
  365. package/dist/user-event/types/utils/misc/getWindow.d.ts +2 -0
  366. package/dist/user-event/types/utils/misc/isDescendantOrSelf.d.ts +2 -0
  367. package/dist/user-event/types/utils/misc/isDisabled.d.ts +2 -0
  368. package/dist/user-event/types/utils/misc/isElementType.d.ts +6 -0
  369. package/dist/user-event/types/utils/misc/isVisible.d.ts +2 -0
  370. package/dist/user-event/types/utils/misc/level.d.ts +9 -0
  371. package/dist/user-event/types/utils/misc/wait.d.ts +6 -0
  372. package/dist/user-event/types/utils/pointer/cssPointerEvents.d.ts +4 -0
  373. package/dist/vitest-environment/failure-snapshot.js +42 -0
  374. package/dist/vitest-environment/index.js +185 -0
  375. package/dist/vitest-environment/plugin.js +90 -0
  376. package/dist/vitest-environment/types/failure-snapshot.d.ts +1 -0
  377. package/dist/vitest-environment/types/index.d.ts +29 -0
  378. package/dist/vitest-environment/types/plugin.d.ts +33 -0
  379. package/jest-preset.cjs +17 -0
  380. package/package.json +177 -3
@@ -0,0 +1,329 @@
1
+ import { EventTarget } from "../events/EventTarget.js";
2
+ import { Event } from "../events/Event.js";
3
+ import { Document } from "../nodes/Document.js";
4
+ import type { Element } from "../nodes/Element.js";
5
+ import { CSSStyleDeclaration } from "../css/CSSStyleDeclaration.js";
6
+ import { type InterfaceMap } from "./interfaces.js";
7
+ import { Location } from "./Location.js";
8
+ import { History } from "./History.js";
9
+ import { Navigator } from "./Navigator.js";
10
+ import { Screen, VisualViewport } from "./Screen.js";
11
+ import { type StorageShed, type Storage } from "./Storage.js";
12
+ import { MediaQueryList } from "./media.js";
13
+ import { CookieJar } from "./cookies.js";
14
+ import "./document.js";
15
+ import { type TimerList } from "./timers.js";
16
+ import { type CompatProfile } from "./compat.js";
17
+ import { type LayoutMode } from "../css/layout-mode.js";
18
+ import { $childWindows, $closed, $cookieJar, $customElements, $devicePixelRatio, $frameCallbacks, $frameElement, $frameId, $frameTask, $frameTime, $globalObject, $history, $host, $idleCallbacks, $idleId, $innerHeight, $innerWidth, $localStorage, $location, $mediaQueryLists, $navigator, $options, $parentWindow, $runningFrame, $screen, $scrollX, $scrollY, $sessionStorage, $shed, $tasks, $timers, $url, $visualViewport } from "../keys.js";
19
+ export interface WindowOptions {
20
+ /** Document URL. Default "http://localhost/". */
21
+ url?: string;
22
+ /** Initial document markup. Default: an empty html/head/body document. */
23
+ html?: string;
24
+ /** Viewport size (innerWidth/innerHeight). Default 1024×768. */
25
+ width?: number;
26
+ height?: number;
27
+ /** Screen size. Defaults to the viewport size. */
28
+ screenWidth?: number;
29
+ screenHeight?: number;
30
+ devicePixelRatio?: number;
31
+ /** navigator.userAgent */
32
+ userAgent?: string;
33
+ /** navigator.platform. Default "" (jsdom), whatever the host OS (docs/deviations.md). */
34
+ platform?: string;
35
+ /** navigator.languages (first one is navigator.language). Default ["en-US", "en"]. */
36
+ languages?: readonly string[];
37
+ /** document.referrer */
38
+ referrer?: string;
39
+ /** Overrides for media features in the fallback matchMedia evaluator, e.g. { "prefers-color-scheme": "dark" }. */
40
+ mediaFeatures?: Record<string, string | number>;
41
+ /**
42
+ * How getComputedStyle serializes colors: "specified" (default) keeps the author's text like
43
+ * jsdom does; "rgb" resolves to rgb()/rgba() as browsers do (docs/deviations.md). Process-wide
44
+ * (one current window): every createWindow applies its value.
45
+ */
46
+ cssComputedColors?: "specified" | "rgb";
47
+ /**
48
+ * Which APIs beyond jsdom's the window exposes once installed as the global (installGlobals):
49
+ * "jsdom-26" (jest-environment-jsdom 30), "jsdom-30" (default) or "modern" (everything). See
50
+ * window/compat.ts and docs/deviations.md.
51
+ */
52
+ compat?: CompatProfile;
53
+ /**
54
+ * Expose `window.visualViewport`. Defaults to the `compat` profile (only "modern"): without
55
+ * layout its numbers mislead positioning libraries (Floating UI), which fall back to the
56
+ * document element when it is absent (docs/deviations.md).
57
+ */
58
+ visualViewport?: boolean;
59
+ /** Share localStorage (and `storage` events) with another window, like two same-origin tabs. */
60
+ shareStorageWith?: Window;
61
+ /**
62
+ * `validationMessage` text for built-in constraint failures: "jsdom" (default) returns
63
+ * jsdom's generic "Constraints not satisfied"; "browser" returns Chromium-like per-constraint
64
+ * messages (docs/deviations.md). Custom validity messages are never affected.
65
+ */
66
+ validationMessages?: "jsdom" | "browser";
67
+ /**
68
+ * Geometry model: "none" (default, every profile) returns zeros from getBoundingClientRect,
69
+ * offset*, client* and scroll* like jsdom; "lite" computes a deliberately simple box model
70
+ * (block stacking, simple flex, absolute/fixed positioning, overflow scrolling) on the first
71
+ * geometry read after a DOM/style change, and ResizeObserver delivers observations. An
72
+ * approximation for virtualizers and positioning libraries, not a browser: docs/layout.md.
73
+ */
74
+ layout?: LayoutMode;
75
+ }
76
+ /** @internal Resolved, per-window constant options. */
77
+ export interface ResolvedWindowOptions {
78
+ userAgent: string;
79
+ platform: string;
80
+ languages: readonly string[];
81
+ referrer: string;
82
+ screenWidth: number;
83
+ screenHeight: number;
84
+ mediaFeatures: Record<string, string | number> | undefined;
85
+ /** html/forms/validation.ts reads this. */
86
+ validationMessages: "jsdom" | "browser";
87
+ /** window/globals.ts reads this at installation. */
88
+ compat: CompatProfile;
89
+ /** css/layout.ts reads this (docs/layout.md). */
90
+ layout: LayoutMode;
91
+ }
92
+ /** @internal A nested browsing context (an <iframe>'s), see window/browsing-context.ts. */
93
+ export interface NestedBrowsingContext {
94
+ parent: Window;
95
+ frameElement: Element;
96
+ /** srcdoc markup, or null for the initial about:blank document. */
97
+ srcdoc: string | null;
98
+ }
99
+ /** A host timer tracked so that closing the window cancels it. */
100
+ interface PendingTask {
101
+ handle: unknown;
102
+ clear: (handle: never) => void;
103
+ /** The host setTimeout it was scheduled with (a fake clock's, possibly since uninstalled). */
104
+ scheduledWith: unknown;
105
+ }
106
+ interface IdleDeadline {
107
+ readonly didTimeout: boolean;
108
+ timeRemaining(): number;
109
+ }
110
+ type FrameRequestCallback = (time: number) => void;
111
+ /**
112
+ * @internal Host global → the window installed on it (globals.ts installGlobals). Under the test
113
+ * environments the global code sees as `window` is the host global, not a Window instance.
114
+ */
115
+ export declare const installedWindows: WeakMap<object, Window>;
116
+ export declare class Window extends EventTarget {
117
+ document: Document;
118
+ name: string;
119
+ status: string;
120
+ opener: Window | null;
121
+ /** @internal */
122
+ [$options]: ResolvedWindowOptions;
123
+ /** @internal The document's URL (https://dom.spec.whatwg.org/#concept-document-url) as a parsed URL. */
124
+ [$url]: URL;
125
+ [$location]: Location | null;
126
+ [$history]: History | null;
127
+ [$navigator]: Navigator | null;
128
+ [$screen]: Screen | null;
129
+ [$visualViewport]: VisualViewport | null;
130
+ /** Present only for windows created with `visualViewport: true` (an own accessor). */
131
+ readonly visualViewport?: VisualViewport;
132
+ [$localStorage]: Storage | null;
133
+ [$sessionStorage]: Storage | null;
134
+ [$shed]: StorageShed | null;
135
+ [$customElements]: unknown;
136
+ [$cookieJar]: CookieJar | null;
137
+ /** MediaQueryLists with change listeners (https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes). */
138
+ [$mediaQueryLists]: Set<MediaQueryList>;
139
+ [$tasks]: Set<PendingTask> | null;
140
+ /** Host timers created through setTimeout/setInterval of this window or its installed global (window/timers.ts). */
141
+ [$timers]: TimerList | null;
142
+ /** https://html.spec.whatwg.org/#list-of-animation-frame-callbacks */
143
+ [$frameCallbacks]: Map<number, FrameRequestCallback> | null;
144
+ [$runningFrame]: Map<number, FrameRequestCallback> | null;
145
+ [$frameTask]: PendingTask | null;
146
+ /** performance.now() of the last frame (-1 before the first). */
147
+ [$frameTime]: number;
148
+ [$frameId]: number;
149
+ [$idleCallbacks]: Map<number, PendingTask> | null;
150
+ [$idleId]: number;
151
+ [$innerWidth]: number;
152
+ [$innerHeight]: number;
153
+ [$devicePixelRatio]: number;
154
+ [$scrollX]: number;
155
+ [$scrollY]: number;
156
+ [$closed]: boolean;
157
+ /**
158
+ * @internal The global whose timers/performance the window uses: the Node global by default,
159
+ * the global it is installed on otherwise (a Jest vm context), so fake timers installed on
160
+ * that global control animation frames and window tasks.
161
+ */
162
+ [$host]: typeof globalThis;
163
+ /** @internal Parent window of a nested browsing context (iframe), else null. */
164
+ [$parentWindow]: Window | null;
165
+ /** @internal The <iframe> hosting this window, else null. */
166
+ [$frameElement]: Element | null;
167
+ /** @internal The host global this window is installed on (installGlobals), else null: what WindowProxy references to it return. */
168
+ [$globalObject]: Window | null;
169
+ /** @internal Nested windows of connected iframes in this window's document (created lazily). */
170
+ [$childWindows]: Set<Window> | null;
171
+ constructor(options?: WindowOptions, nested?: NestedBrowsingContext);
172
+ get window(): Window;
173
+ get self(): Window;
174
+ get frames(): Window;
175
+ /** https://html.spec.whatwg.org/#dom-parent — a top-level traversable is its own parent. */
176
+ get parent(): Window;
177
+ get top(): Window;
178
+ get length(): number;
179
+ get frameElement(): Element | null;
180
+ get closed(): boolean;
181
+ /** https://html.spec.whatwg.org/#dom-origin */
182
+ get origin(): string;
183
+ /** https://html.spec.whatwg.org/#dom-issecurecontext (https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy) */
184
+ get isSecureContext(): boolean;
185
+ get crossOriginIsolated(): boolean;
186
+ /** https://dom.spec.whatwg.org/#dom-window-event */
187
+ get event(): Event | undefined;
188
+ /** https://html.spec.whatwg.org/#dom-location */
189
+ get location(): Location;
190
+ set location(value: string);
191
+ /** https://html.spec.whatwg.org/#dom-history */
192
+ get history(): History;
193
+ /** https://html.spec.whatwg.org/#dom-navigator */
194
+ get navigator(): Navigator;
195
+ get clientInformation(): Navigator;
196
+ /** https://drafts.csswg.org/cssom-view/#dom-window-screen */
197
+ get screen(): Screen;
198
+ /** https://html.spec.whatwg.org/#dom-localstorage */
199
+ get localStorage(): Storage;
200
+ /** https://html.spec.whatwg.org/#dom-sessionstorage */
201
+ get sessionStorage(): Storage;
202
+ /** https://html.spec.whatwg.org/#dom-window-customelements (html-elements registers the factory). */
203
+ get customElements(): unknown;
204
+ /** @internal */
205
+ get _storageShed(): StorageShed;
206
+ /** @internal */
207
+ get _cookieStore(): CookieJar;
208
+ get innerWidth(): number;
209
+ set innerWidth(value: number);
210
+ get innerHeight(): number;
211
+ set innerHeight(value: number);
212
+ get outerWidth(): number;
213
+ get outerHeight(): number;
214
+ get devicePixelRatio(): number;
215
+ set devicePixelRatio(value: number);
216
+ get screenX(): number;
217
+ get screenY(): number;
218
+ get screenLeft(): number;
219
+ get screenTop(): number;
220
+ get scrollX(): number;
221
+ set scrollX(value: number);
222
+ get scrollY(): number;
223
+ set scrollY(value: number);
224
+ get pageXOffset(): number;
225
+ set pageXOffset(value: number);
226
+ get pageYOffset(): number;
227
+ set pageYOffset(value: number);
228
+ /** https://drafts.csswg.org/cssom-view/#dom-window-scroll — no layout: just records the position. */
229
+ scroll(x?: number | {
230
+ left?: number;
231
+ top?: number;
232
+ behavior?: string;
233
+ }, y?: number): void;
234
+ scrollTo(x?: number | {
235
+ left?: number;
236
+ top?: number;
237
+ behavior?: string;
238
+ }, y?: number): void;
239
+ /** https://drafts.csswg.org/cssom-view/#dom-window-scrollby */
240
+ scrollBy(x?: number | {
241
+ left?: number;
242
+ top?: number;
243
+ behavior?: string;
244
+ }, y?: number): void;
245
+ /**
246
+ * Test convenience (browsers ignore resizeTo for non-popup windows, see docs/deviations.md):
247
+ * set the viewport size, report media query changes and fire `resize`.
248
+ */
249
+ resizeTo(width: number, height: number): void;
250
+ resizeBy(x: number, y: number): void;
251
+ moveTo(_x: number, _y: number): void;
252
+ moveBy(_x: number, _y: number): void;
253
+ /** https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle */
254
+ getComputedStyle(element: Element, pseudoElement?: string | null): CSSStyleDeclaration;
255
+ /** https://drafts.csswg.org/cssom-view/#dom-window-matchmedia */
256
+ matchMedia(query: string): MediaQueryList;
257
+ /** https://w3c.github.io/selection-api/#dom-window-getselection */
258
+ getSelection(): unknown;
259
+ /** https://html.spec.whatwg.org/#dom-animationframeprovider-requestanimationframe */
260
+ requestAnimationFrame(callback: FrameRequestCallback): number;
261
+ /** https://html.spec.whatwg.org/#animationframeprovider-cancelanimationframe */
262
+ cancelAnimationFrame(handle: number): void;
263
+ /** https://w3c.github.io/requestidlecallback/#the-requestidlecallback-method */
264
+ requestIdleCallback(callback: (deadline: IdleDeadline) => void, options?: {
265
+ timeout?: number;
266
+ }): number;
267
+ cancelIdleCallback(handle: number): void;
268
+ /** https://html.spec.whatwg.org/#dom-settimeout */
269
+ setTimeout(handler: unknown, timeout?: number, ...args: unknown[]): unknown;
270
+ /** https://html.spec.whatwg.org/#dom-setinterval */
271
+ setInterval(handler: unknown, timeout?: number, ...args: unknown[]): unknown;
272
+ /** @internal The global whose timer functions this window uses right now. */
273
+ _timerHost(): Record<string, unknown>;
274
+ /**
275
+ * @internal Queue `callback` on the host's setTimeout (the current global one, so fake
276
+ * timers apply). Tracked so close() cancels it. Returns null once the window is closed.
277
+ */
278
+ _task(callback: () => void, delay: number): PendingTask | null;
279
+ /**
280
+ * @internal Run `abort` when the window closes (in-flight XMLHttpRequests): returns the entry
281
+ * to pass to _releaseCloseable once the work is done, or null if the window is already closed.
282
+ */
283
+ _closeable(abort: () => void): PendingTask | null;
284
+ /** @internal Forget a _closeable entry without running it. */
285
+ _releaseCloseable(task: PendingTask): void;
286
+ _hostSetTimeout(): unknown;
287
+ _cancelTask(task: PendingTask): void;
288
+ /** https://html.spec.whatwg.org/#dom-window-postmessage */
289
+ postMessage(message: unknown, targetOrigin?: string | {
290
+ targetOrigin?: string;
291
+ transfer?: unknown[];
292
+ }, transfer?: unknown[]): void;
293
+ /**
294
+ * https://html.spec.whatwg.org/#dom-reporterror — fires a cancelable `error` ErrorEvent at the
295
+ * window; when nobody handles it the events area's uncaught-exception handler runs (test
296
+ * environments make that fail the test).
297
+ */
298
+ reportError(error: unknown): void;
299
+ alert(_message?: unknown): void;
300
+ confirm(_message?: unknown): boolean;
301
+ prompt(_message?: unknown, _default?: unknown): string | null;
302
+ print(): void;
303
+ /** https://html.spec.whatwg.org/#dom-open — nothing is opened. */
304
+ open(_url?: string, _target?: string, _features?: string): Window | null;
305
+ stop(): void;
306
+ focus(): void;
307
+ blur(): void;
308
+ captureEvents(): void;
309
+ releaseEvents(): void;
310
+ /**
311
+ * Close the window: cancels its pending timers, animation frames, idle callbacks and tasks and marks
312
+ * it closed (like jsdom's/happy-dom's `window.close()`; docs/deviations.md). Test
313
+ * environments call this on teardown.
314
+ */
315
+ close(): void;
316
+ /** @internal Location navigations (see History._navigate). */
317
+ _navigate(url: URL, replace: boolean): void;
318
+ /** @internal Set the document's URL. */
319
+ _setURL(url: URL): void;
320
+ /** https://dom.spec.whatwg.org/#get-the-parent — a Window is the end of the propagation path. */
321
+ _getTheParent(_event: Event): EventTarget | null;
322
+ get [Symbol.toStringTag](): string;
323
+ }
324
+ export declare function setRenderingUpdateHook(fn: ((doc: unknown) => void) | null): void;
325
+ export declare const HOST_DELEGATES: readonly ["clearTimeout", "clearInterval", "queueMicrotask", "structuredClone", "atob", "btoa", "crypto", "performance", "console", "URL", "URLSearchParams", "URLPattern", "AbortController", "Blob", "File", "TextEncoder", "TextDecoder", "TextEncoderStream", "TextDecoderStream", "ReadableStream", "ReadableStreamDefaultReader", "ReadableByteStreamController", "WritableStream", "WritableStreamDefaultWriter", "TransformStream", "ByteLengthQueuingStrategy", "CountQueuingStrategy", "CompressionStream", "DecompressionStream", "Headers", "FormData", "BroadcastChannel", "MessageChannel", "MessagePort", "WebSocket", "DOMException", "QuotaExceededError", "Crypto", "CryptoKey", "SubtleCrypto", "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", "PerformanceObserver", "PerformanceObserverEntryList", "PerformanceResourceTiming", "WebAssembly", "Intl"];
326
+ /** The interface objects every window exposes (name → class). */
327
+ export declare function windowInterfaces(): InterfaceMap;
328
+ export declare function createWindow(options?: WindowOptions): Window;
329
+ export {};
@@ -0,0 +1,4 @@
1
+ type HostAbortSignalConstructor = typeof globalThis.AbortSignal;
2
+ /** https://dom.spec.whatwg.org/#interface-AbortSignal — not constructible. */
3
+ export declare const AbortSignal: HostAbortSignalConstructor;
4
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Element } from "../nodes/Element.js";
2
+ import type { Window } from "./Window.js";
3
+ type NestedWindowFactory = (frameElement: Element, parent: Window, src: string | null, srcdoc: string | null) => Window;
4
+ /** @internal Window.ts registers how nested windows are created. */
5
+ export declare function setNestedWindowFactory(f: NestedWindowFactory): void;
6
+ /** The iframe's nested window (https://html.spec.whatwg.org/#dom-iframe-contentwindow), or null. */
7
+ export declare function frameContentWindow(frame: Element): Window | null;
8
+ /** https://html.spec.whatwg.org/#the-iframe-element:html-element-insertion-steps */
9
+ export declare function frameConnected(frame: Element): void;
10
+ /** https://html.spec.whatwg.org/#the-iframe-element:html-element-removing-steps */
11
+ export declare function frameDisconnected(frame: Element): void;
12
+ export {};
@@ -0,0 +1,153 @@
1
+ type Callback = (...args: unknown[]) => unknown;
2
+ /** One pending timer. */
3
+ declare class TimerRecord {
4
+ id: number;
5
+ due: number;
6
+ seq: number;
7
+ delay: number;
8
+ repeat: boolean;
9
+ callback: Callback;
10
+ args: unknown[];
11
+ ref: boolean;
12
+ /** Index in the heap, -1 when not scheduled (fired one-shot, cleared, real-time track). */
13
+ index: number;
14
+ handle: VirtualTimeout | null;
15
+ /** Real host timer while on the real-time track (unref'd while skipping), else null. */
16
+ real: ReturnType<typeof setTimeout> | null;
17
+ /** realNow() at which `real` fires. */
18
+ realDue: number;
19
+ constructor(id: number, due: number, seq: number, delay: number, repeat: boolean, callback: Callback, args: unknown[]);
20
+ }
21
+ /** The handle setTimeout/setInterval return: Node's Timeout API surface. */
22
+ export declare class VirtualTimeout {
23
+ #private;
24
+ constructor(clock: VirtualClock, record: TimerRecord);
25
+ ref(): this;
26
+ unref(): this;
27
+ hasRef(): boolean;
28
+ /** Restart the timer with its original delay from now. */
29
+ refresh(): this;
30
+ close(): this;
31
+ [Symbol.toPrimitive](): number;
32
+ [Symbol.dispose](): void;
33
+ }
34
+ export interface VirtualClockOptions {
35
+ /** Jump to the next timer whenever the event loop is idle (default false: real time only). */
36
+ skip?: boolean;
37
+ }
38
+ /**
39
+ * Timers on a min-heap, a monotonic `now()` (real time + skipped time), and the idle driver that
40
+ * skips. One clock per window/test file; dispose() drops every pending timer.
41
+ */
42
+ export declare class VirtualClock {
43
+ /** ms added to real time by skipping. */
44
+ skipped: number;
45
+ /** Date.now() - performance.now() when the clock was created (epoch of now() = 0). */
46
+ epochOffset: number;
47
+ skip: boolean;
48
+ heap: TimerRecord[];
49
+ byId: Map<number, TimerRecord>;
50
+ nextId: number;
51
+ seq: number;
52
+ refCount: number;
53
+ hostTimer: ReturnType<typeof setTimeout> | null;
54
+ hostDue: number;
55
+ continuation: boolean;
56
+ driverScheduled: boolean;
57
+ idleTurns: number;
58
+ disposed: boolean;
59
+ baseline: Map<string, number> | null;
60
+ constructor(options?: VirtualClockOptions);
61
+ /** Monotonic ms (performance.now() origin) including skipped time. */
62
+ now(): number;
63
+ /** Epoch ms including skipped time (Date.now()). */
64
+ epochNow(): number;
65
+ /**
66
+ * https://html.spec.whatwg.org/#timer-initialisation-steps, with the delay jsdom's timers end up
67
+ * with: converted as a WebIDL `long` (https://webidl.spec.whatwg.org/#es-long: truncated,
68
+ * wrapped to 32 bits, NaN to 0), negative to 0, then Node's 1 ms minimum (jsdom schedules on
69
+ * Node's setTimeout). The minimum matters while skipping: every setTimeout(0) hop (user-event's
70
+ * wait between actions, React's scheduler) advances time by 1 ms as it does on Node, so a 16 ms
71
+ * animation frame runs after as many hops as it would in real time.
72
+ */
73
+ schedule(callback: Callback, delay: unknown, args: unknown[], repeat: boolean): VirtualTimeout;
74
+ /** clearTimeout/clearInterval: a VirtualTimeout or its numeric id. Returns false for foreign handles. */
75
+ clear(handle: unknown): boolean;
76
+ /**
77
+ * Let `ms` of idle time pass at once, as the idle driver would, unless a timer falls due in it
78
+ * (the caller then waits for real, so that timer runs first). Returns whether the time passed.
79
+ */
80
+ skipIdle(ms: number): boolean;
81
+ /** Pending (scheduled) timers. */
82
+ get size(): number;
83
+ _setRef(record: TimerRecord, ref: boolean): void;
84
+ /** Move `record` off the heap onto its own unref'd real host timer firing in `delay` ms. */
85
+ toRealTrack(record: TimerRecord, delay: number): void;
86
+ toVirtualTrack(record: TimerRecord): void;
87
+ fireReal(record: TimerRecord): void;
88
+ _refresh(record: TimerRecord): void;
89
+ dispose(): void;
90
+ /** Keep one real host timer armed for the earliest due timer (ref'd while any timer is). */
91
+ armHost(): void;
92
+ updateHostRef(): void;
93
+ onHostTimer: () => void;
94
+ /**
95
+ * Run the earliest timer if it is due, then continue with the next due one on the following
96
+ * macrotask (setImmediate: microtasks drain in between, as between Node timers).
97
+ */
98
+ fireNext(): void;
99
+ kickDriver(): void;
100
+ /**
101
+ * Runs on the check phase. Skips to the earliest timer once the loop has been idle for two
102
+ * consecutive turns (pending promise reactions and the immediates they schedule settle first).
103
+ */
104
+ driverTurn: () => void;
105
+ /** null when idle; "immediate" when immediates are pending; "io" when I/O beyond the baseline is. */
106
+ busy(): "immediate" | "io" | null;
107
+ push(record: TimerRecord): void;
108
+ pop(): TimerRecord;
109
+ remove(record: TimerRecord): void;
110
+ up(i: number): void;
111
+ down(i: number): void;
112
+ }
113
+ /** performance.now() of the active clock (event.timeStamp, https://dom.spec.whatwg.org/#dom-event-timestamp). */
114
+ export declare function clockNow(): number;
115
+ /**
116
+ * https://html.spec.whatwg.org/#queue-a-task for a task the user agent queues itself
117
+ * (selectionchange), never through the global timer functions: like jsdom's internal task queue,
118
+ * fake timers and setTimeout spies do not see it. A 0 ms timer on Node's own timers, in order with
119
+ * the page's timers (Node runs timers of the same duration first in, first out); with a clock that
120
+ * skips idle time active, a 0 ms timer on that clock instead, so it keeps its place among the
121
+ * page's timers there and skipping goes on.
122
+ */
123
+ export declare function queueUserAgentTask(task: () => void): void;
124
+ /** Whether a clock that skips idle time is active (the test file's timers run on it). */
125
+ export declare function clockSkipping(): boolean;
126
+ /** The active skipping clock's skipIdle(ms); true without one (there is no clock to move). */
127
+ export declare function skipIdleTime(ms: number): boolean;
128
+ /** Milliseconds the active clock has skipped (0 without one): what a traced span reads at start and end. */
129
+ export declare function clockSkipped(): number;
130
+ /** The active clock's skipped time and pending timers (for test observability), or null without one. */
131
+ export declare function clockStats(): {
132
+ skippedMs: number;
133
+ pendingTimers: number;
134
+ } | null;
135
+ type Global = Record<PropertyKey, unknown>;
136
+ /** A Date constructor reading `clock` (new Date(), Date(), Date.now()); everything else is the native one's. */
137
+ export declare function virtualDate(clock: VirtualClock, NativeDate: DateConstructor): DateConstructor;
138
+ /** A `performance` whose now() reads `clock`; the rest delegates to the native object. */
139
+ export declare function virtualPerformance(clock: VirtualClock, native: Performance): Performance;
140
+ export interface InstalledClock {
141
+ clock: VirtualClock;
142
+ /** Restore the global's previous timer functions, Date and performance, and dispose the clock. */
143
+ uninstall(): void;
144
+ }
145
+ /**
146
+ * Put `clock`'s timers on `global` (setTimeout, setInterval, clearTimeout, clearInterval), plus a
147
+ * virtual `Date` and `performance` when the clock skips. The functions are plain writable data
148
+ * properties without a `clock`/`_isMockFunction` property, so Testing Library and user-event
149
+ * keep treating them as real timers, and fake timers can install over and restore them.
150
+ * Clearing a handle the clock does not own falls through to the host's clear.
151
+ */
152
+ export declare function installClock(clock: VirtualClock, global: Global): InstalledClock;
153
+ export {};
@@ -0,0 +1,34 @@
1
+ export type CompatProfile = "jsdom-26" | "jsdom-30" | "modern";
2
+ export declare const COMPAT_PROFILES: readonly CompatProfile[];
3
+ export declare const DEFAULT_COMPAT: CompatProfile;
4
+ export interface CompatEntry {
5
+ /** Window globals: interface objects and window members. */
6
+ readonly globals?: readonly string[];
7
+ /** Interface members, "Interface.member" (own property of `Interface.prototype`) or "Interface.static.member". */
8
+ readonly members?: readonly string[];
9
+ /** The profiles that expose the entry. */
10
+ readonly profiles: readonly CompatProfile[];
11
+ readonly reason: string;
12
+ }
13
+ export declare const COMPAT: readonly CompatEntry[];
14
+ /** `value` as a profile, or a TypeError naming the valid ones. */
15
+ export declare function resolveCompat(value: unknown): CompatProfile;
16
+ /** Window globals the profile leaves out of an installation. */
17
+ export declare function hiddenGlobals(profile: CompatProfile): ReadonlySet<string>;
18
+ /** Whether the profile exposes `name` (a global or "Interface.member" listed in COMPAT); unlisted names are exposed everywhere. */
19
+ export declare function compatExposes(profile: CompatProfile, name: string): boolean;
20
+ /**
21
+ * Take `name` off `owner` (an interface prototype) at module load and keep it for profiles that
22
+ * expose it. Owners call it right after their class definition, before any instance exists.
23
+ */
24
+ export declare function deferCompatMember(owner: object, iface: string, name: string): void;
25
+ /** @internal For the surface test: members held back at load. */
26
+ export declare function deferredCompatMembers(): ReadonlyMap<string, {
27
+ owner: object;
28
+ descriptor: PropertyDescriptor;
29
+ }>;
30
+ /**
31
+ * Add or remove gated interface members on their shared prototypes for `profile`; returns the
32
+ * function that undoes it. `interfaces` maps interface names to interface objects.
33
+ */
34
+ export declare function installCompatMembers(profile: CompatProfile, interfaces: Record<string, unknown>): () => void;
@@ -0,0 +1,21 @@
1
+ import { $cookies } from "../keys.js";
2
+ interface Cookie {
3
+ name: string;
4
+ value: string;
5
+ /** Canonicalized host (host-only cookies) or Domain attribute value. */
6
+ domain: string;
7
+ hostOnly: boolean;
8
+ path: string;
9
+ /** ms since epoch, Infinity for session cookies */
10
+ expires: number;
11
+ secure: boolean;
12
+ }
13
+ export declare class CookieJar {
14
+ [$cookies]: Cookie[];
15
+ constructor();
16
+ /** https://httpwg.org/specs/rfc6265.html#sane-set-cookie-syntax — the `document.cookie` setter. */
17
+ set(cookieString: string, url: URL, now?: number): void;
18
+ /** https://httpwg.org/specs/rfc6265.html#cookie — the `document.cookie` getter. */
19
+ get(url: URL, now?: number): string;
20
+ }
21
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Document } from "../nodes/Document.js";
2
+ import type { Window } from "./Window.js";
3
+ export declare function setCurrentWindow(window: Window | null): void;
4
+ export declare function currentWindow(): Window;
5
+ export declare function currentDocument(): Document;
6
+ /** The current window, or null when none is active (no throw). */
7
+ export declare function currentWindowOrNull(): Window | null;
@@ -0,0 +1,19 @@
1
+ import type { Location } from "./Location.js";
2
+ declare module "../nodes/Document.js" {
3
+ interface Document {
4
+ cookie: string;
5
+ readonly referrer: string;
6
+ readonly currentScript: null;
7
+ readonly readyState: DocumentReadyState;
8
+ readonly visibilityState: DocumentVisibilityState;
9
+ readonly hidden: boolean;
10
+ get location(): Location | null;
11
+ set location(value: string);
12
+ readonly lastModified: string;
13
+ domain: string;
14
+ designMode: string;
15
+ }
16
+ }
17
+ type DocumentReadyState = "loading" | "interactive" | "complete";
18
+ type DocumentVisibilityState = "visible" | "hidden";
19
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Event } from "../events/Event.js";
2
+ import type { EventInit } from "../webidl.js";
3
+ export interface MediaQueryListEventInit extends EventInit {
4
+ media?: string;
5
+ matches?: boolean;
6
+ }
7
+ export declare class MediaQueryListEvent extends Event {
8
+ readonly media: string;
9
+ readonly matches: boolean;
10
+ constructor(type: string, init?: MediaQueryListEventInit);
11
+ }
@@ -0,0 +1,20 @@
1
+ import { Document } from "../nodes/Document.js";
2
+ import type { Node } from "../nodes/Node.js";
3
+ /** https://html.spec.whatwg.org/#dom-domparser-parsefromstring */
4
+ export declare class DOMParser {
5
+ parseFromString(string: string, type: string): Document;
6
+ }
7
+ /** https://w3c.github.io/DOM-Parsing/#the-xmlserializer-interface */
8
+ export declare class XMLSerializer {
9
+ serializeToString(root: Node): string;
10
+ }
11
+ /** https://html.spec.whatwg.org/#dom-parsehtmlunsafe — installed as the static Document.parseHTMLUnsafe. */
12
+ export declare function documentParseHTMLUnsafe(html: string): Document;
13
+ /** https://drafts.csswg.org/cssom/#serialize-an-identifier */
14
+ declare function escape(value: string): string;
15
+ /** https://drafts.csswg.org/cssom/#namespacedef-css — TODO(css): replace with the css area's CSS namespace. */
16
+ export declare const CSS: {
17
+ escape: typeof escape;
18
+ supports(_conditionOrProperty: string, _value?: string): boolean;
19
+ };
20
+ export {};