@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,112 @@
1
+ import { EventTarget } from "../events/EventTarget.js";
2
+ import type { Document } from "./Document.js";
3
+ import type { Element } from "./Element.js";
4
+ import { NodeImpl } from "./NodeImpl.js";
5
+ import { NodeList } from "../collections/NodeList.js";
6
+ import type { GetRootNodeOptions } from "../webidl.js";
7
+ import type { Event } from "../events/Event.js";
8
+ import { $childNodes, $impl } from "../keys.js";
9
+ export declare abstract class Node extends EventTarget {
10
+ static readonly ELEMENT_NODE = 1;
11
+ static readonly ATTRIBUTE_NODE = 2;
12
+ static readonly TEXT_NODE = 3;
13
+ static readonly CDATA_SECTION_NODE = 4;
14
+ static readonly ENTITY_REFERENCE_NODE = 5;
15
+ static readonly ENTITY_NODE = 6;
16
+ static readonly PROCESSING_INSTRUCTION_NODE = 7;
17
+ static readonly COMMENT_NODE = 8;
18
+ static readonly DOCUMENT_NODE = 9;
19
+ static readonly DOCUMENT_TYPE_NODE = 10;
20
+ static readonly DOCUMENT_FRAGMENT_NODE = 11;
21
+ static readonly NOTATION_NODE = 12;
22
+ static readonly DOCUMENT_POSITION_DISCONNECTED = 1;
23
+ static readonly DOCUMENT_POSITION_PRECEDING = 2;
24
+ static readonly DOCUMENT_POSITION_FOLLOWING = 4;
25
+ static readonly DOCUMENT_POSITION_CONTAINS = 8;
26
+ static readonly DOCUMENT_POSITION_CONTAINED_BY = 16;
27
+ static readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
28
+ readonly ELEMENT_NODE: number;
29
+ readonly ATTRIBUTE_NODE: number;
30
+ readonly TEXT_NODE: number;
31
+ readonly CDATA_SECTION_NODE: number;
32
+ readonly ENTITY_REFERENCE_NODE: number;
33
+ readonly ENTITY_NODE: number;
34
+ readonly PROCESSING_INSTRUCTION_NODE: number;
35
+ readonly COMMENT_NODE: number;
36
+ readonly DOCUMENT_NODE: number;
37
+ readonly DOCUMENT_TYPE_NODE: number;
38
+ readonly DOCUMENT_FRAGMENT_NODE: number;
39
+ readonly NOTATION_NODE: number;
40
+ readonly DOCUMENT_POSITION_DISCONNECTED: number;
41
+ readonly DOCUMENT_POSITION_PRECEDING: number;
42
+ readonly DOCUMENT_POSITION_FOLLOWING: number;
43
+ readonly DOCUMENT_POSITION_CONTAINS: number;
44
+ readonly DOCUMENT_POSITION_CONTAINED_BY: number;
45
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
46
+ [$impl]: NodeImpl;
47
+ /** The live childNodes list, added on first access (see Element's lazily added fields). */
48
+ [$childNodes]?: NodeList | null;
49
+ /** @internal Wrappers are created by the document/parser, never directly by users. */
50
+ constructor(type: number, doc: Document | null);
51
+ get nodeType(): number;
52
+ /**
53
+ * https://dom.spec.whatwg.org/#dom-node-nodename
54
+ *
55
+ * One accessor on Node.prototype for every node type, as WebIDL puts it
56
+ * (https://webidl.spec.whatwg.org/#es-attributes): libraries such as DOMPurify capture
57
+ * `Object.getOwnPropertyDescriptor(Node.prototype, "nodeName").get` and call it on any node.
58
+ */
59
+ get nodeName(): string;
60
+ get baseURI(): string;
61
+ get isConnected(): boolean;
62
+ get ownerDocument(): Document | null;
63
+ /** https://dom.spec.whatwg.org/#dom-node-getrootnode */
64
+ getRootNode(options?: GetRootNodeOptions): Node;
65
+ get parentNode(): Node | null;
66
+ get parentElement(): Element | null;
67
+ hasChildNodes(): boolean;
68
+ get childNodes(): NodeList;
69
+ get firstChild(): Node | null;
70
+ get lastChild(): Node | null;
71
+ get previousSibling(): Node | null;
72
+ get nextSibling(): Node | null;
73
+ /** https://dom.spec.whatwg.org/#dom-node-nodevalue */
74
+ get nodeValue(): string | null;
75
+ /** https://dom.spec.whatwg.org/#dom-node-nodevalue (setter: null is treated as "") */
76
+ set nodeValue(value: string | null);
77
+ /** https://dom.spec.whatwg.org/#dom-node-textcontent (get text content) */
78
+ get textContent(): string | null;
79
+ /** https://dom.spec.whatwg.org/#dom-node-textcontent (set text content; null is treated as "") */
80
+ set textContent(value: string | null);
81
+ /** https://dom.spec.whatwg.org/#dom-node-normalize */
82
+ normalize(): void;
83
+ cloneNode(deep?: boolean): Node;
84
+ isEqualNode(other: Node | null): boolean;
85
+ isSameNode(other: Node | null): boolean;
86
+ /** https://dom.spec.whatwg.org/#dom-node-comparedocumentposition */
87
+ compareDocumentPosition(other: Node): number;
88
+ /** https://dom.spec.whatwg.org/#dom-node-contains */
89
+ contains(other: Node | null): boolean;
90
+ /** https://dom.spec.whatwg.org/#dom-node-lookupprefix */
91
+ lookupPrefix(namespace: string | null): string | null;
92
+ /** https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri */
93
+ lookupNamespaceURI(prefix: string | null): string | null;
94
+ /** https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace */
95
+ isDefaultNamespace(namespace: string | null): boolean;
96
+ insertBefore<T extends Node>(node: T, child: Node | null): T;
97
+ appendChild<T extends Node>(node: T): T;
98
+ replaceChild<T extends Node>(node: Node, child: T): T;
99
+ removeChild<T extends Node>(child: T): T;
100
+ /** https://dom.spec.whatwg.org/#get-the-parent */
101
+ _getTheParent(event: Event): import("../events/EventTarget.js").EventTarget | null;
102
+ /** @internal Used by textContent/innerHTML setters. */
103
+ _replaceAll(node: Node | null): void;
104
+ }
105
+ /** Concatenation of the data of all Text descendants, in tree order (https://dom.spec.whatwg.org/#concept-descendant-text-content). */
106
+ export declare function descendantTextContent(root: NodeImpl): string;
107
+ /** An Attr's value: its record's value while attached, else its own (https://dom.spec.whatwg.org/#concept-attribute-value). */
108
+ export declare function attrValue(attr: Node): string;
109
+ /** https://dom.spec.whatwg.org/#set-an-existing-attribute-value */
110
+ export declare function setAttrValue(attr: Node, value: string): void;
111
+ /** https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name (Element.tagName / nodeName) */
112
+ export declare function htmlUppercasedQualifiedName(impl: NodeImpl): string;
@@ -0,0 +1,90 @@
1
+ import type { Attr } from "./Attr.js";
2
+ import type { Document } from "./Document.js";
3
+ import type { Node } from "./Node.js";
4
+ /** The rarely present parts of an attribute: a namespace/prefix, or a materialized `Attr` node. */
5
+ export declare class AttrRare {
6
+ /** Qualified name (`prefix:localName` or `localName`). */
7
+ name: string;
8
+ ns: string | null;
9
+ prefix: string | null;
10
+ attr: Attr | null;
11
+ constructor(name: string, ns: string | null, prefix: string | null);
12
+ }
13
+ /**
14
+ * One attribute of an element. Stored in `NodeImpl.attrs` in attribute-list order
15
+ * (https://dom.spec.whatwg.org/#concept-element-attribute). The public `Attr` node is
16
+ * created lazily (`attributes`, `getAttributeNode`) and cached in `attr`.
17
+ *
18
+ * Memory: almost every attribute an app sets has no namespace, no prefix and no `Attr` node,
19
+ * so the record holds only `localName`, `value` and a `rare` slot (48 B instead of 72 B
20
+ * with six fields); `name`/`ns`/`prefix`/`attr` read through it. One class, so the
21
+ * accessors stay monomorphic and inline.
22
+ */
23
+ export declare class AttrRecord {
24
+ localName: string;
25
+ value: string;
26
+ rare: AttrRare | null;
27
+ constructor(localName: string, value: string, ns: string | null, prefix: string | null);
28
+ /** Qualified name (`prefix:localName` or `localName`). */
29
+ get name(): string;
30
+ get ns(): string | null;
31
+ get prefix(): string | null;
32
+ get attr(): Attr | null;
33
+ set attr(attr: Attr | null);
34
+ }
35
+ /**
36
+ * The internal, monomorphic record behind every DOM node.
37
+ *
38
+ * Why this exists: public wrappers (`HTMLDivElement`, `HTMLInputElement`, `Text`, ...) each
39
+ * have their own prototype, so V8 gives them different hidden classes. Tree walks that read
40
+ * fields off the wrappers go megamorphic once a document mixes more than ~4 element classes,
41
+ * which measured ~3x slower than walking a single class. Every node therefore owns exactly
42
+ * one `NodeImpl` (one hidden class for all node types), and every hot internal algorithm —
43
+ * tree mutation, selector matching, role/name computation, text content, serialization,
44
+ * Testing Library queries — walks `NodeImpl`s, touching the wrapper only to return it.
45
+ *
46
+ * Rules:
47
+ * - Never add fields outside the constructor, never delete fields, never store a value of a
48
+ * different kind in a field (keep the shape and field representations stable).
49
+ * - Per-type data that is not hot belongs on the wrapper (e.g. input value/checkedness on
50
+ * `HTMLInputElement`), not here.
51
+ * - New hot fields need a note in docs/ARCHITECTURE.md.
52
+ */
53
+ export declare class NodeImpl {
54
+ /** The public wrapper object. */
55
+ node: Node;
56
+ /** https://dom.spec.whatwg.org/#dom-node-nodetype */
57
+ type: number;
58
+ /** Node document. For a Document node, the document itself. */
59
+ doc: Document;
60
+ parent: NodeImpl | null;
61
+ first: NodeImpl | null;
62
+ last: NodeImpl | null;
63
+ prev: NodeImpl | null;
64
+ next: NodeImpl | null;
65
+ childCount: number;
66
+ /** Bit set of `F_*` flags from constants.ts. */
67
+ flags: number;
68
+ /** `tagId(localName)` for HTML-namespace elements, else 0. */
69
+ tag: number;
70
+ /** Element local name (lowercase for HTML) / doctype name / PI target / attr local name; "" otherwise. */
71
+ name: string;
72
+ /** Element namespace. */
73
+ ns: string | null;
74
+ /** Element namespace prefix. */
75
+ prefix: string | null;
76
+ /** Element attribute list, null until the first attribute is set. */
77
+ attrs: AttrRecord[] | null;
78
+ /** CharacterData data / attr value; "" for other nodes. */
79
+ data: string;
80
+ /** Element id attribute value ("" when absent) — mirrored for the id index and `#id` selectors. */
81
+ id: string;
82
+ /** Lazily split class attribute tokens (null = not computed / invalidated). */
83
+ classes: string[] | null;
84
+ /**
85
+ * Per-node cache slot for subsystems (aria role/name caches, computed style). Always an
86
+ * object of class `NodeCache` or null so the field stays monomorphic. See nodes/cache.ts.
87
+ */
88
+ cache: object | null;
89
+ constructor(node: Node, type: number, doc: Document);
90
+ }
@@ -0,0 +1,43 @@
1
+ import type { Document } from "./Document.js";
2
+ import type { Element } from "./Element.js";
3
+ import { DocumentFragment } from "./DocumentFragment.js";
4
+ import { type GetHTMLOptions } from "../serializer/index.js";
5
+ import { $availableToElementInternals, $clonable, $declarative, $delegatesFocus, $mode, $serializable, $slotAssignment } from "../keys.js";
6
+ export type ShadowRootMode = "open" | "closed";
7
+ export type SlotAssignmentMode = "manual" | "named";
8
+ export declare function setShadowHostCustomStateCheck(fn: (host: Element) => boolean): void;
9
+ export declare class ShadowRoot extends DocumentFragment {
10
+ /** https://dom.spec.whatwg.org/#shadowroot-mode */
11
+ [$mode]: ShadowRootMode;
12
+ [$delegatesFocus]: boolean;
13
+ [$slotAssignment]: SlotAssignmentMode;
14
+ [$clonable]: boolean;
15
+ [$serializable]: boolean;
16
+ /** https://dom.spec.whatwg.org/#shadowroot-declarative */
17
+ [$declarative]: boolean;
18
+ /** https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals */
19
+ [$availableToElementInternals]: boolean;
20
+ /** @internal Use Element.attachShadow. */
21
+ constructor(doc: Document, host: Element, mode: ShadowRootMode, delegatesFocus: boolean, slotAssignment: SlotAssignmentMode, clonable: boolean, serializable: boolean);
22
+ get mode(): ShadowRootMode;
23
+ get host(): Element;
24
+ get delegatesFocus(): boolean;
25
+ get slotAssignment(): SlotAssignmentMode;
26
+ get clonable(): boolean;
27
+ get serializable(): boolean;
28
+ /** https://html.spec.whatwg.org/#dom-shadowroot-innerhtml */
29
+ get innerHTML(): string;
30
+ set innerHTML(value: string);
31
+ /** https://html.spec.whatwg.org/#dom-shadowroot-gethtml (serializableShadowRoots / shadowRoots options not supported) */
32
+ getHTML(options?: GetHTMLOptions): string;
33
+ /** https://html.spec.whatwg.org/#dom-shadowroot-sethtmlunsafe */
34
+ setHTMLUnsafe(html: string): void;
35
+ /**
36
+ * https://html.spec.whatwg.org/#dom-documentorshadowroot-activeelement — the document's
37
+ * focused element retargeted against this shadow root, if it is in this shadow tree.
38
+ */
39
+ get activeElement(): Element | null;
40
+ /** CSSOM View hit testing: no layout. */
41
+ elementFromPoint(_x: number, _y: number): Element | null;
42
+ elementsFromPoint(_x: number, _y: number): Element[];
43
+ }
@@ -0,0 +1,8 @@
1
+ import { Attr } from "./Attr.js";
2
+ import { AttrRecord, type NodeImpl } from "./NodeImpl.js";
3
+ /** The Attr wrapper for `record` on element `el`, created on first use. */
4
+ export declare function attrNode(el: NodeImpl, record: AttrRecord): Attr;
5
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-set — returns the replaced Attr or null. */
6
+ export declare function setAttributeNode(el: NodeImpl, attr: Attr): Attr | null;
7
+ /** https://dom.spec.whatwg.org/#dom-element-removeattributenode */
8
+ export declare function removeAttributeNode(el: NodeImpl, attr: Attr): Attr;
@@ -0,0 +1,46 @@
1
+ import { AttrRecord, type NodeImpl } from "./NodeImpl.js";
2
+ /** ASCII-lowercase without allocating when the input is already lowercase (the common case). */
3
+ export declare function asciiLowercase(s: string): string;
4
+ /**
5
+ * https://dom.spec.whatwg.org/#valid-attribute-local-name — at least one code point and no
6
+ * ASCII whitespace, U+0000, "/", "=" or ">".
7
+ */
8
+ export declare function isValidAttributeLocalName(name: string): boolean;
9
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name (name already normalized). */
10
+ export declare function findAttributeByName(el: NodeImpl, qualifiedName: string): AttrRecord | null;
11
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace */
12
+ export declare function findAttributeByNamespace(el: NodeImpl, ns: string | null, localName: string): AttrRecord | null;
13
+ /** getAttribute(qualifiedName). Lowercases for HTML elements in HTML documents. */
14
+ export declare function getAttribute(el: NodeImpl, qualifiedName: string): string | null;
15
+ /**
16
+ * Hot-path read for internal callers that pass an already-lowercase, no-namespace name
17
+ * literal (e.g. "role", "aria-label", "type"). Skips normalization.
18
+ */
19
+ export declare function attr(el: NodeImpl, lowerName: string): string | null;
20
+ export declare function hasAttr(el: NodeImpl, lowerName: string): boolean;
21
+ /** setAttribute(qualifiedName, value) — https://dom.spec.whatwg.org/#dom-element-setattribute */
22
+ export declare function setAttribute(el: NodeImpl, qualifiedName: string, value: string): void;
23
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-change */
24
+ export declare function changeAttribute(el: NodeImpl, a: AttrRecord, value: string): void;
25
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-append */
26
+ export declare function appendAttribute(el: NodeImpl, a: AttrRecord): void;
27
+ /** https://dom.spec.whatwg.org/#concept-element-attributes-remove */
28
+ export declare function removeAttributeRecord(el: NodeImpl, a: AttrRecord): void;
29
+ /** removeAttribute(qualifiedName) */
30
+ export declare function removeAttribute(el: NodeImpl, qualifiedName: string): AttrRecord | null;
31
+ /**
32
+ * https://dom.spec.whatwg.org/#handle-attribute-changes plus this implementation's core
33
+ * attribute bookkeeping (id index, class token cache, style flag, document version).
34
+ */
35
+ export declare function handleAttributeChanges(el: NodeImpl, a: AttrRecord, oldValue: string | null, newValue: string | null): void;
36
+ /**
37
+ * Parser/clone fast path: append an attribute to a DETACHED element without mutation
38
+ * records, hooks or version bumps, but with core bookkeeping (id mirror, style flag).
39
+ * The caller guarantees no attribute with this name exists yet.
40
+ */
41
+ export declare function appendAttributeDetached(el: NodeImpl, localName: string, value: string, ns: string | null, prefix: string | null): void;
42
+ /** Class attribute split on ASCII whitespace, cached until the class attribute changes. */
43
+ export declare function classTokens(el: NodeImpl): string[];
44
+ /** https://infra.spec.whatwg.org/#split-on-ascii-whitespace (ordered set semantics NOT applied). */
45
+ export declare function splitOnAsciiWhitespace(s: string): string[];
46
+ export declare function isAsciiWhitespace(c: number): boolean;
@@ -0,0 +1,38 @@
1
+ import type { NodeImpl } from "./NodeImpl.js";
2
+ /**
3
+ * Lazily created per-node cache hung on `NodeImpl.cache`. One class with every field
4
+ * declared up front keeps the slot monomorphic. Subsystems add their fields HERE (in the
5
+ * constructor, with a comment naming the owner) instead of attaching ad-hoc properties.
6
+ *
7
+ * Validity: each subsystem stamps its entries with the document version it computed them
8
+ * at (`Document._version`, bumped by every tree/attribute/character-data mutation) and/or
9
+ * the style version (`Document._styleVersion`, bumped by stylesheet changes), and treats a
10
+ * mismatched stamp as a miss. Never hold strong references to other nodes' wrappers here
11
+ * beyond what the DOM tree already holds.
12
+ */
13
+ export declare class NodeCache {
14
+ /** `Document._version` at which `role` was computed. */
15
+ roleVersion: number;
16
+ /** Computed (explicit-or-implicit) role, "" for none. */
17
+ role: string;
18
+ /** `Document._version` at which `name` was computed. */
19
+ nameVersion: number;
20
+ /** Accessible name. */
21
+ name: string;
22
+ /** `Document._version` at which `style` was computed. */
23
+ styleVersion: number;
24
+ /** `Document._styleVersion` at which `style` was computed. */
25
+ styleSheetVersion: number;
26
+ /** Opaque computed-style record owned by src/css. */
27
+ style: object | null;
28
+ /** `Document._styleVersion` at which `name` was computed (paired with `nameVersion`). */
29
+ ariaNameStyleVersion: number;
30
+ /** `Document._version` at which `ariaHiddenBits` was computed. */
31
+ ariaHiddenVersion: number;
32
+ /** `Document._styleVersion` at which `ariaHiddenBits` was computed. */
33
+ ariaHiddenStyleVersion: number;
34
+ /** Accessibility-tree exclusion bits owned by packages/aria/src/hidden.ts. */
35
+ ariaHiddenBits: number;
36
+ constructor();
37
+ }
38
+ export declare function nodeCache(impl: NodeImpl): NodeCache;
@@ -0,0 +1,5 @@
1
+ import type { NodeImpl } from "./NodeImpl.js";
2
+ /** https://dom.spec.whatwg.org/#concept-cd-replace */
3
+ export declare function replaceData(node: NodeImpl, offset: number, count: number, data: string): void;
4
+ /** https://dom.spec.whatwg.org/#concept-text-split */
5
+ export declare function splitText(node: NodeImpl, offset: number): NodeImpl;
@@ -0,0 +1,5 @@
1
+ import { type NodeImpl } from "./NodeImpl.js";
2
+ import type { Document } from "./Document.js";
3
+ /** Clone `node` into `doc`. Deep clones build the copy detached and never fire hooks. */
4
+ export declare function cloneNode(node: NodeImpl, doc: Document, deep: boolean): NodeImpl;
5
+ export declare function isEqualNode(a: NodeImpl, b: NodeImpl): boolean;
@@ -0,0 +1,52 @@
1
+ export declare const ELEMENT_NODE = 1;
2
+ export declare const ATTRIBUTE_NODE = 2;
3
+ export declare const TEXT_NODE = 3;
4
+ export declare const CDATA_SECTION_NODE = 4;
5
+ export declare const ENTITY_REFERENCE_NODE = 5;
6
+ export declare const ENTITY_NODE = 6;
7
+ export declare const PROCESSING_INSTRUCTION_NODE = 7;
8
+ export declare const COMMENT_NODE = 8;
9
+ export declare const DOCUMENT_NODE = 9;
10
+ export declare const DOCUMENT_TYPE_NODE = 10;
11
+ export declare const DOCUMENT_FRAGMENT_NODE = 11;
12
+ export declare const NOTATION_NODE = 12;
13
+ export declare const DOCUMENT_POSITION_DISCONNECTED = 1;
14
+ export declare const DOCUMENT_POSITION_PRECEDING = 2;
15
+ export declare const DOCUMENT_POSITION_FOLLOWING = 4;
16
+ export declare const DOCUMENT_POSITION_CONTAINS = 8;
17
+ export declare const DOCUMENT_POSITION_CONTAINED_BY = 16;
18
+ export declare const DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
19
+ export declare const HTML_NS = "http://www.w3.org/1999/xhtml";
20
+ export declare const SVG_NS = "http://www.w3.org/2000/svg";
21
+ export declare const MATHML_NS = "http://www.w3.org/1998/Math/MathML";
22
+ export declare const XLINK_NS = "http://www.w3.org/1999/xlink";
23
+ export declare const XML_NS = "http://www.w3.org/XML/1998/namespace";
24
+ export declare const XMLNS_NS = "http://www.w3.org/2000/xmlns/";
25
+ /** Node is connected (its shadow-including root is a document). Maintained by insert/remove. */
26
+ export declare const F_CONNECTED: number;
27
+ /** Element is in the HTML namespace and its node document is an HTML document: qualified names match ASCII case-insensitively. */
28
+ export declare const F_HTML: number;
29
+ /** Wrapper overrides `_connectedSteps` / `_disconnectedSteps`; only these elements get the virtual call during subtree walks. */
30
+ export declare const F_CONNECT_HOOK: number;
31
+ /** Wrapper overrides `_attributeChangedSteps`; only these elements get the virtual call on attribute changes. */
32
+ export declare const F_ATTR_HOOK: number;
33
+ /** Wrapper overrides `_childrenChangedSteps` (e.g. <style>, <option>, <title>, <textarea> default value). */
34
+ export declare const F_CHILDREN_HOOK: number;
35
+ /** Node is a shadow root. */
36
+ export declare const F_SHADOW_ROOT: number;
37
+ /** Element has a non-empty `style` attribute (cheap visibility/computed-style fast path). */
38
+ export declare const F_HAS_STYLE_ATTR: number;
39
+ /** Element is a custom element candidate (valid custom element name). */
40
+ export declare const F_CUSTOM: number;
41
+ /** The node's live `childNodes` NodeList has been materialized; tree.ts keeps it in sync (collections/NodeList.ts). */
42
+ export declare const F_CHILD_LIST: number;
43
+ /** Element has a shadow root (`Element._shadowRoot !== null`); lets hot walks skip the wrapper load. */
44
+ export declare const F_HAS_SHADOW: number;
45
+ /** Custom element state is "custom" (https://dom.spec.whatwg.org/#concept-element-custom-element-state); owned by src/html/custom-elements.ts. */
46
+ export declare const F_CE_CUSTOM: number;
47
+ /** Node has a registered observer list (observers/queue.ts); lets record queueing skip unobserved ancestors. */
48
+ export declare const F_MO_REGISTERED: number;
49
+ /** Wrapper overrides `_adoptingSteps(oldDocument)` (https://dom.spec.whatwg.org/#concept-node-adopt-ext), e.g. <template>, custom elements. */
50
+ export declare const F_ADOPT_HOOK: number;
51
+ /** Element is a form-associated custom element (its definition has `static formAssociated = true`); set by html/custom-elements.ts, read by html/forms. */
52
+ export declare const F_FACE: number;
@@ -0,0 +1,42 @@
1
+ import type { Document } from "./Document.js";
2
+ import type { Element } from "./Element.js";
3
+ import type { NodeImpl } from "./NodeImpl.js";
4
+ export type ElementConstructor = new (doc: Document, localName: string, ns: string | null, prefix: string | null) => Element;
5
+ export declare function setElementClassLookup(fn: (localName: string, ns: string | null) => ElementConstructor): void;
6
+ /** Create an element wrapper of the right interface for (namespace, localName) and return its impl. */
7
+ export declare function createElementImpl(doc: Document, localName: string, ns: string | null, prefix: string | null): NodeImpl;
8
+ /** True while custom element reactions are queued. Written only via `setCEReactionsPending`. */
9
+ export declare let ceReactionsPending: boolean;
10
+ export declare function setCEReactionsPending(pending: boolean): void;
11
+ export declare function setCEReactionsFlush(fn: () => void): void;
12
+ export declare function flushCEReactions(): void;
13
+ type SyncCreate = (doc: Document, localName: string, ns: string | null, prefix: string | null, is: string | null) => NodeImpl | null;
14
+ export declare function setCustomElementCreate(fn: SyncCreate): void;
15
+ /**
16
+ * https://dom.spec.whatwg.org/#concept-create-element with the synchronous custom elements
17
+ * flag set (createElement / createElementNS): a defined custom element is constructed now.
18
+ */
19
+ export declare function createElementImplSync(doc: Document, localName: string, ns: string | null, prefix: string | null, is: string | null): NodeImpl;
20
+ /**
21
+ * True once custom elements are in use in this process (a definition exists, or an element got
22
+ * an "is" value). Cloning and the HTML parser check it before calling the hooks below, so they
23
+ * cost one live-binding read when custom elements are unused.
24
+ */
25
+ export declare let ceActive: boolean;
26
+ export declare function setCEActive(): void;
27
+ type CloneCreate = (doc: Document, source: NodeImpl) => NodeImpl;
28
+ type ParserCreated = (impl: NodeImpl) => void;
29
+ export declare function setCustomElementCloneHooks(clone: CloneCreate, parser: ParserCreated): void;
30
+ /**
31
+ * https://dom.spec.whatwg.org/#concept-node-clone step 2.1: create an element with the source's
32
+ * "is" value and the synchronous custom elements flag unset (a defined custom element gets an
33
+ * upgrade reaction). Only call when `ceActive`.
34
+ */
35
+ export declare function createCloneElementImpl(doc: Document, source: NodeImpl): NodeImpl;
36
+ /**
37
+ * https://html.spec.whatwg.org/#create-an-element-for-the-token for an HTML element the parser
38
+ * created (attributes already appended): the "is" value and upgrade reaction. Only call when
39
+ * `ceActive`.
40
+ */
41
+ export declare function ceParserCreated(impl: NodeImpl): void;
42
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { Document } from "./Document.js";
2
+ import type { NodeImpl } from "./NodeImpl.js";
3
+ /** The `key`-owned cache of `doc`, created with `create()` when absent (or dropped since). */
4
+ export declare function derivedCache<T>(doc: Document, key: object, create: () => T): T;
5
+ /** The `key`-owned cache of `doc`, or undefined when absent. */
6
+ export declare function peekDerivedCache<T>(doc: Document, key: object): T | undefined;
7
+ /**
8
+ * A version-stamped node snapshot owned by a long-lived object (a live collection's members, a
9
+ * form's listed controls). Registered with `holdSnapshot` when filled; nodes/tree.ts remove()
10
+ * calls `_dropSnapshot()` on every holder registered since the previous removal.
11
+ *
12
+ * Only snapshots rooted in a connected node are registered. A detached root's snapshot can only
13
+ * hold nodes of its own tree and lives exactly as long as its owner; registering it would let the
14
+ * document keep the whole detached tree alive until its next removal (a removed React container
15
+ * whose `children` were read, every clone a test inspects).
16
+ */
17
+ export interface SnapshotHolder {
18
+ _dropSnapshot(): void;
19
+ }
20
+ /**
21
+ * Register `holder`, whose snapshot was computed from the tree of `root`, to have its snapshot
22
+ * dropped at the next removal from a tree of `doc`; a no-op when `root` is not connected.
23
+ */
24
+ export declare function holdSnapshot(doc: Document, holder: SnapshotHolder, root: NodeImpl): void;
25
+ /** nodes/tree.ts: a node was removed from a tree of `doc` (doc[$derived] is non-null). */
26
+ export declare function dropDerivedCaches(doc: Document): void;
@@ -0,0 +1,2 @@
1
+ import type { NodeImpl } from "./NodeImpl.js";
2
+ export declare function inspectNode(impl: NodeImpl, _depth?: number, _options?: unknown, _inspect?: unknown): string;
@@ -0,0 +1,41 @@
1
+ import type { Document } from "./Document.js";
2
+ import type { Element } from "./Element.js";
3
+ import type { Node } from "./Node.js";
4
+ import type { NodeImpl } from "./NodeImpl.js";
5
+ import { HTMLCollection } from "../collections/HTMLCollection.js";
6
+ import type { NodeList } from "../collections/NodeList.js";
7
+ export interface ParentNode {
8
+ readonly children: HTMLCollection;
9
+ readonly firstElementChild: Element | null;
10
+ readonly lastElementChild: Element | null;
11
+ readonly childElementCount: number;
12
+ prepend(...nodes: (Node | string)[]): void;
13
+ append(...nodes: (Node | string)[]): void;
14
+ replaceChildren(...nodes: (Node | string)[]): void;
15
+ moveBefore(node: Node, child: Node | null): void;
16
+ querySelector<E extends Element = Element>(selectors: string): E | null;
17
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeList & Iterable<E>;
18
+ }
19
+ export interface ChildNode {
20
+ before(...nodes: (Node | string)[]): void;
21
+ after(...nodes: (Node | string)[]): void;
22
+ replaceWith(...nodes: (Node | string)[]): void;
23
+ remove(): void;
24
+ }
25
+ export interface NonDocumentTypeChildNode {
26
+ readonly previousElementSibling: Element | null;
27
+ readonly nextElementSibling: Element | null;
28
+ }
29
+ export interface NonElementParentNode {
30
+ getElementById(elementId: string): Element | null;
31
+ }
32
+ type Ctor = {
33
+ prototype: object;
34
+ };
35
+ /** https://dom.spec.whatwg.org/#converting-nodes-into-a-node */
36
+ export declare function convertNodesIntoNode(nodes: (Node | string)[], doc: Document): NodeImpl;
37
+ export declare function installParentNode(target: Ctor): void;
38
+ export declare function installChildNode(target: Ctor): void;
39
+ export declare function installNonDocumentTypeChildNode(target: Ctor): void;
40
+ export declare function installNonElementParentNode(target: Ctor): void;
41
+ export {};
@@ -0,0 +1,15 @@
1
+ /** https://dom.spec.whatwg.org/#valid-element-local-name (fast path for ASCII). */
2
+ export declare function isValidElementLocalName(name: string): boolean;
3
+ /** https://dom.spec.whatwg.org/#valid-namespace-prefix */
4
+ export declare function isValidNamespacePrefix(name: string): boolean;
5
+ /** https://dom.spec.whatwg.org/#valid-doctype-name */
6
+ export declare function isValidDoctypeName(name: string): boolean;
7
+ /** https://www.w3.org/TR/xml/#NT-Name (ProcessingInstruction targets). */
8
+ export declare function isXMLName(name: string): boolean;
9
+ export interface Extracted {
10
+ namespace: string | null;
11
+ prefix: string | null;
12
+ localName: string;
13
+ }
14
+ /** https://dom.spec.whatwg.org/#validate-and-extract */
15
+ export declare function validateAndExtract(namespace: string | null, qualifiedName: string, context: "element" | "attribute"): Extracted;
@@ -0,0 +1,38 @@
1
+ import type { NodeImpl } from "./NodeImpl.js";
2
+ /** Number of shadow roots attached in this process; gates all slot bookkeeping. */
3
+ export declare let slotAssignmentActive: number;
4
+ export declare function _shadowRootAttached(): void;
5
+ export declare function isSlot(n: NodeImpl): boolean;
6
+ /** https://dom.spec.whatwg.org/#find-a-slot */
7
+ export declare function findSlot(slottable: NodeImpl, open: boolean): NodeImpl | null;
8
+ /** https://dom.spec.whatwg.org/#find-slotables */
9
+ export declare function findSlottables(slot: NodeImpl): NodeImpl[];
10
+ /** https://dom.spec.whatwg.org/#find-flattened-slotables */
11
+ export declare function findFlattenedSlottables(slot: NodeImpl): NodeImpl[];
12
+ /** https://dom.spec.whatwg.org/#assign-slotables */
13
+ export declare function assignSlottables(slot: NodeImpl): void;
14
+ /** https://dom.spec.whatwg.org/#assign-slotables-for-a-tree */
15
+ export declare function assignSlottablesForTree(root: NodeImpl): void;
16
+ /** https://dom.spec.whatwg.org/#assign-a-slot */
17
+ export declare function assignASlot(slottable: NodeImpl): void;
18
+ /** https://dom.spec.whatwg.org/#concept-node-insert steps 7.4-7.6, for `node` or each of `nodes`. */
19
+ export declare function slotsAfterInsert(parent: NodeImpl, node: NodeImpl | null, nodes: NodeImpl[] | null): void;
20
+ /** https://dom.spec.whatwg.org/#concept-node-remove steps 11-13 (after unlinking). */
21
+ export declare function slotsAfterRemove(node: NodeImpl, parent: NodeImpl): void;
22
+ /**
23
+ * Attribute change steps for `slot` (on slottables) and `name` (on slots).
24
+ * https://dom.spec.whatwg.org/#slot-name (attribute change steps)
25
+ * https://dom.spec.whatwg.org/#slotable-name (attribute change steps)
26
+ */
27
+ export declare function slotsAttributeChanged(el: NodeImpl, localName: string, oldValue: string | null, value: string | null): void;
28
+ /** Assigned slot of a slottable (internal; no open-ness check). */
29
+ export declare function assignedSlot(n: NodeImpl): NodeImpl | null;
30
+ /** https://html.spec.whatwg.org/#dom-slot-assignednodes */
31
+ export declare function assignedNodes(slot: NodeImpl, flatten: boolean): NodeImpl[];
32
+ /** https://html.spec.whatwg.org/#dom-slot-assignedelements */
33
+ export declare function assignedElements(slot: NodeImpl, flatten: boolean): NodeImpl[];
34
+ /** https://html.spec.whatwg.org/#dom-slot-assign */
35
+ export declare function assignManually(slot: NodeImpl, nodes: NodeImpl[]): void;
36
+ /** For `getTheParent`: a slottable's assigned slot (when its parent is a shadow host). */
37
+ export declare function assignedSlotForEventPath(n: NodeImpl): NodeImpl | null;
38
+ export declare function isShadowRootImpl(n: NodeImpl): boolean;
@@ -0,0 +1,8 @@
1
+ declare const NAMES: readonly ["", "a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "search", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "svg", "math", "frame", "frameset", "noframes", "marquee", "font", "center", "dir", "applet", "basefont", "bgsound", "big", "blink", "keygen", "listing", "menuitem", "nobr", "noembed", "param", "plaintext", "rb", "rtc", "strike", "tt", "xmp", "image", "selectedcontent"];
2
+ export type TagName = (typeof NAMES)[number];
3
+ /** Tag id for an HTML-namespace local name (already lowercased), or 0. */
4
+ export declare function tagId(localName: string): number;
5
+ export declare function tagName(id: number): string;
6
+ /** `T.button === tagId("button")`, for readable switches: `case T.button:`. */
7
+ export declare const T: { readonly [K in Exclude<TagName, "">]: number; };
8
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { NodeImpl } from "./NodeImpl.js";
2
+ /** Next node in tree order within `root`'s subtree, or null. */
3
+ export declare function nextInTree(n: NodeImpl, root: NodeImpl): NodeImpl | null;
4
+ /** Next node in tree order within `root`'s subtree that is not a descendant of `n`, or null. */
5
+ export declare function nextSkippingChildren(n: NodeImpl, root: NodeImpl): NodeImpl | null;
6
+ /** Previous node in tree order within `root`'s subtree (root itself included), or null. */
7
+ export declare function previousInTree(n: NodeImpl, root: NodeImpl): NodeImpl | null;
8
+ /** Next element in tree order within `root`'s subtree, or null. */
9
+ export declare function nextElementInTree(n: NodeImpl, root: NodeImpl): NodeImpl | null;
10
+ export declare function firstElementChild(n: NodeImpl): NodeImpl | null;
11
+ export declare function lastElementChild(n: NodeImpl): NodeImpl | null;
12
+ export declare function nextElementSibling(n: NodeImpl): NodeImpl | null;
13
+ export declare function previousElementSibling(n: NodeImpl): NodeImpl | null;
14
+ /** Root of the tree containing `n` (not shadow-including). https://dom.spec.whatwg.org/#concept-tree-root */
15
+ export declare function treeRoot(n: NodeImpl): NodeImpl;
16
+ /** Whether `a` is an inclusive ancestor of `b`. */
17
+ export declare function isInclusiveAncestor(a: NodeImpl, b: NodeImpl): boolean;
18
+ /** Index of `n` among its siblings. https://dom.spec.whatwg.org/#concept-tree-index */
19
+ export declare function indexOf(n: NodeImpl): number;
20
+ /** Child at `index`, walking from whichever end is closer. */
21
+ export declare function childAt(parent: NodeImpl, index: number): NodeImpl | null;