@wordpress/dom 4.56.0 → 5.0.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 (327) hide show
  1. package/README.md +22 -22
  2. package/build/data-transfer.cjs +1 -1
  3. package/build/data-transfer.cjs.map +3 -3
  4. package/build/dom/caret-range-from-point.cjs +1 -1
  5. package/build/dom/caret-range-from-point.cjs.map +3 -3
  6. package/build/dom/clean-node-list.cjs +1 -1
  7. package/build/dom/clean-node-list.cjs.map +3 -3
  8. package/build/dom/compute-caret-rect.cjs +1 -1
  9. package/build/dom/compute-caret-rect.cjs.map +3 -3
  10. package/build/dom/document-has-selection.cjs +1 -1
  11. package/build/dom/document-has-selection.cjs.map +3 -3
  12. package/build/dom/document-has-text-selection.cjs +1 -1
  13. package/build/dom/document-has-text-selection.cjs.map +3 -3
  14. package/build/dom/document-has-uncollapsed-selection.cjs +1 -1
  15. package/build/dom/document-has-uncollapsed-selection.cjs.map +3 -3
  16. package/build/dom/get-computed-style.cjs +1 -1
  17. package/build/dom/get-computed-style.cjs.map +3 -3
  18. package/build/dom/get-offset-parent.cjs +7 -15
  19. package/build/dom/get-offset-parent.cjs.map +4 -4
  20. package/build/dom/get-range-height.cjs +1 -1
  21. package/build/dom/get-range-height.cjs.map +3 -3
  22. package/build/dom/get-rectangle-from-range.cjs +3 -8
  23. package/build/dom/get-rectangle-from-range.cjs.map +3 -3
  24. package/build/dom/get-scroll-container.cjs +2 -6
  25. package/build/dom/get-scroll-container.cjs.map +3 -3
  26. package/build/dom/hidden-caret-range-from-point.cjs +1 -1
  27. package/build/dom/hidden-caret-range-from-point.cjs.map +3 -3
  28. package/build/dom/index.cjs +1 -1
  29. package/build/dom/index.cjs.map +1 -1
  30. package/build/dom/input-field-has-uncollapsed-selection.cjs +2 -5
  31. package/build/dom/input-field-has-uncollapsed-selection.cjs.map +3 -3
  32. package/build/dom/insert-after.cjs +1 -1
  33. package/build/dom/insert-after.cjs.map +3 -3
  34. package/build/dom/is-edge.cjs +1 -1
  35. package/build/dom/is-edge.cjs.map +3 -3
  36. package/build/dom/is-element.cjs +1 -1
  37. package/build/dom/is-element.cjs.map +3 -3
  38. package/build/dom/is-empty.cjs +2 -5
  39. package/build/dom/is-empty.cjs.map +3 -3
  40. package/build/dom/is-entirely-selected.cjs +2 -5
  41. package/build/dom/is-entirely-selected.cjs.map +3 -3
  42. package/build/dom/is-form-element.cjs +1 -1
  43. package/build/dom/is-form-element.cjs.map +3 -3
  44. package/build/dom/is-horizontal-edge.cjs +1 -1
  45. package/build/dom/is-horizontal-edge.cjs.map +3 -3
  46. package/build/dom/is-html-input-element.cjs +1 -1
  47. package/build/dom/is-html-input-element.cjs.map +3 -3
  48. package/build/dom/is-input-or-text-area.cjs +1 -1
  49. package/build/dom/is-input-or-text-area.cjs.map +3 -3
  50. package/build/dom/is-number-input.cjs +1 -1
  51. package/build/dom/is-number-input.cjs.map +3 -3
  52. package/build/dom/is-rtl.cjs +1 -1
  53. package/build/dom/is-rtl.cjs.map +3 -3
  54. package/build/dom/is-selection-forward.cjs +1 -1
  55. package/build/dom/is-selection-forward.cjs.map +3 -3
  56. package/build/dom/is-text-field.cjs +2 -3
  57. package/build/dom/is-text-field.cjs.map +3 -3
  58. package/build/dom/is-vertical-edge.cjs +1 -1
  59. package/build/dom/is-vertical-edge.cjs.map +3 -3
  60. package/build/dom/place-caret-at-edge.cjs +1 -1
  61. package/build/dom/place-caret-at-edge.cjs.map +3 -3
  62. package/build/dom/place-caret-at-horizontal-edge.cjs +1 -1
  63. package/build/dom/place-caret-at-horizontal-edge.cjs.map +3 -3
  64. package/build/dom/place-caret-at-vertical-edge.cjs +1 -1
  65. package/build/dom/place-caret-at-vertical-edge.cjs.map +3 -3
  66. package/build/dom/remove-invalid-html.cjs +1 -1
  67. package/build/dom/remove-invalid-html.cjs.map +3 -3
  68. package/build/dom/remove.cjs +1 -1
  69. package/build/dom/remove.cjs.map +3 -3
  70. package/build/dom/replace-tag.cjs +1 -1
  71. package/build/dom/replace-tag.cjs.map +3 -3
  72. package/build/dom/replace.cjs +1 -1
  73. package/build/dom/replace.cjs.map +3 -3
  74. package/build/dom/safe-html.cjs +1 -1
  75. package/build/dom/safe-html.cjs.map +3 -3
  76. package/build/dom/scroll-if-no-range.cjs +1 -1
  77. package/build/dom/scroll-if-no-range.cjs.map +3 -3
  78. package/build/dom/strip-html.cjs +1 -1
  79. package/build/dom/strip-html.cjs.map +3 -3
  80. package/build/dom/types.cjs +19 -0
  81. package/build/dom/types.cjs.map +7 -0
  82. package/build/dom/unwrap.cjs +1 -1
  83. package/build/dom/unwrap.cjs.map +3 -3
  84. package/build/dom/wrap.cjs +1 -1
  85. package/build/dom/wrap.cjs.map +3 -3
  86. package/build/focusable.cjs +5 -6
  87. package/build/focusable.cjs.map +3 -3
  88. package/build/index.cjs +1 -1
  89. package/build/index.cjs.map +2 -2
  90. package/build/phrasing-content.cjs +1 -1
  91. package/build/phrasing-content.cjs.map +3 -3
  92. package/build/tabbable.cjs +1 -1
  93. package/build/tabbable.cjs.map +3 -3
  94. package/build/types.cjs +19 -0
  95. package/build/types.cjs.map +7 -0
  96. package/build-module/data-transfer.mjs +1 -1
  97. package/build-module/data-transfer.mjs.map +3 -3
  98. package/build-module/dom/caret-range-from-point.mjs +1 -1
  99. package/build-module/dom/caret-range-from-point.mjs.map +3 -3
  100. package/build-module/dom/clean-node-list.mjs +1 -1
  101. package/build-module/dom/clean-node-list.mjs.map +3 -3
  102. package/build-module/dom/compute-caret-rect.mjs +1 -1
  103. package/build-module/dom/compute-caret-rect.mjs.map +3 -3
  104. package/build-module/dom/document-has-selection.mjs +1 -1
  105. package/build-module/dom/document-has-selection.mjs.map +3 -3
  106. package/build-module/dom/document-has-text-selection.mjs +1 -1
  107. package/build-module/dom/document-has-text-selection.mjs.map +3 -3
  108. package/build-module/dom/document-has-uncollapsed-selection.mjs +1 -1
  109. package/build-module/dom/document-has-uncollapsed-selection.mjs.map +3 -3
  110. package/build-module/dom/get-computed-style.mjs +1 -1
  111. package/build-module/dom/get-computed-style.mjs.map +3 -3
  112. package/build-module/dom/get-offset-parent.mjs +7 -15
  113. package/build-module/dom/get-offset-parent.mjs.map +3 -3
  114. package/build-module/dom/get-range-height.mjs +1 -1
  115. package/build-module/dom/get-range-height.mjs.map +3 -3
  116. package/build-module/dom/get-rectangle-from-range.mjs +3 -8
  117. package/build-module/dom/get-rectangle-from-range.mjs.map +3 -3
  118. package/build-module/dom/get-scroll-container.mjs +2 -6
  119. package/build-module/dom/get-scroll-container.mjs.map +3 -3
  120. package/build-module/dom/hidden-caret-range-from-point.mjs +1 -1
  121. package/build-module/dom/hidden-caret-range-from-point.mjs.map +3 -3
  122. package/build-module/dom/index.mjs +1 -1
  123. package/build-module/dom/index.mjs.map +1 -1
  124. package/build-module/dom/input-field-has-uncollapsed-selection.mjs +2 -5
  125. package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +3 -3
  126. package/build-module/dom/insert-after.mjs +1 -1
  127. package/build-module/dom/insert-after.mjs.map +3 -3
  128. package/build-module/dom/is-edge.mjs +1 -1
  129. package/build-module/dom/is-edge.mjs.map +3 -3
  130. package/build-module/dom/is-element.mjs +1 -1
  131. package/build-module/dom/is-element.mjs.map +3 -3
  132. package/build-module/dom/is-empty.mjs +2 -5
  133. package/build-module/dom/is-empty.mjs.map +3 -3
  134. package/build-module/dom/is-entirely-selected.mjs +2 -5
  135. package/build-module/dom/is-entirely-selected.mjs.map +3 -3
  136. package/build-module/dom/is-form-element.mjs +1 -1
  137. package/build-module/dom/is-form-element.mjs.map +3 -3
  138. package/build-module/dom/is-horizontal-edge.mjs +1 -1
  139. package/build-module/dom/is-horizontal-edge.mjs.map +3 -3
  140. package/build-module/dom/is-html-input-element.mjs +1 -1
  141. package/build-module/dom/is-html-input-element.mjs.map +3 -3
  142. package/build-module/dom/is-input-or-text-area.mjs +1 -1
  143. package/build-module/dom/is-input-or-text-area.mjs.map +3 -3
  144. package/build-module/dom/is-number-input.mjs +1 -1
  145. package/build-module/dom/is-number-input.mjs.map +3 -3
  146. package/build-module/dom/is-rtl.mjs +1 -1
  147. package/build-module/dom/is-rtl.mjs.map +3 -3
  148. package/build-module/dom/is-selection-forward.mjs +1 -1
  149. package/build-module/dom/is-selection-forward.mjs.map +3 -3
  150. package/build-module/dom/is-text-field.mjs +2 -3
  151. package/build-module/dom/is-text-field.mjs.map +3 -3
  152. package/build-module/dom/is-vertical-edge.mjs +1 -1
  153. package/build-module/dom/is-vertical-edge.mjs.map +3 -3
  154. package/build-module/dom/place-caret-at-edge.mjs +1 -1
  155. package/build-module/dom/place-caret-at-edge.mjs.map +3 -3
  156. package/build-module/dom/place-caret-at-horizontal-edge.mjs +1 -1
  157. package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +3 -3
  158. package/build-module/dom/place-caret-at-vertical-edge.mjs +1 -1
  159. package/build-module/dom/place-caret-at-vertical-edge.mjs.map +3 -3
  160. package/build-module/dom/remove-invalid-html.mjs +1 -1
  161. package/build-module/dom/remove-invalid-html.mjs.map +3 -3
  162. package/build-module/dom/remove.mjs +1 -1
  163. package/build-module/dom/remove.mjs.map +3 -3
  164. package/build-module/dom/replace-tag.mjs +1 -1
  165. package/build-module/dom/replace-tag.mjs.map +3 -3
  166. package/build-module/dom/replace.mjs +1 -1
  167. package/build-module/dom/replace.mjs.map +3 -3
  168. package/build-module/dom/safe-html.mjs +1 -1
  169. package/build-module/dom/safe-html.mjs.map +3 -3
  170. package/build-module/dom/scroll-if-no-range.mjs +1 -1
  171. package/build-module/dom/scroll-if-no-range.mjs.map +3 -3
  172. package/build-module/dom/strip-html.mjs +1 -1
  173. package/build-module/dom/strip-html.mjs.map +3 -3
  174. package/build-module/dom/types.mjs +1 -0
  175. package/build-module/dom/types.mjs.map +7 -0
  176. package/build-module/dom/unwrap.mjs +1 -1
  177. package/build-module/dom/unwrap.mjs.map +3 -3
  178. package/build-module/dom/wrap.mjs +1 -1
  179. package/build-module/dom/wrap.mjs.map +3 -3
  180. package/build-module/focusable.mjs +5 -6
  181. package/build-module/focusable.mjs.map +3 -3
  182. package/build-module/index.mjs +1 -1
  183. package/build-module/index.mjs.map +2 -2
  184. package/build-module/phrasing-content.mjs +1 -1
  185. package/build-module/phrasing-content.mjs.map +3 -3
  186. package/build-module/tabbable.mjs +1 -1
  187. package/build-module/tabbable.mjs.map +3 -3
  188. package/build-module/types.mjs +1 -0
  189. package/build-module/types.mjs.map +7 -0
  190. package/build-types/data-transfer.d.ts +2 -2
  191. package/build-types/data-transfer.d.ts.map +1 -1
  192. package/build-types/dom/caret-range-from-point.d.ts +4 -4
  193. package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
  194. package/build-types/dom/clean-node-list.d.ts +5 -45
  195. package/build-types/dom/clean-node-list.d.ts.map +1 -1
  196. package/build-types/dom/compute-caret-rect.d.ts +2 -2
  197. package/build-types/dom/compute-caret-rect.d.ts.map +1 -1
  198. package/build-types/dom/document-has-selection.d.ts +2 -2
  199. package/build-types/dom/document-has-selection.d.ts.map +1 -1
  200. package/build-types/dom/document-has-text-selection.d.ts +2 -2
  201. package/build-types/dom/document-has-text-selection.d.ts.map +1 -1
  202. package/build-types/dom/document-has-uncollapsed-selection.d.ts +2 -2
  203. package/build-types/dom/document-has-uncollapsed-selection.d.ts.map +1 -1
  204. package/build-types/dom/get-computed-style.d.ts +3 -3
  205. package/build-types/dom/get-computed-style.d.ts.map +1 -1
  206. package/build-types/dom/get-offset-parent.d.ts +2 -2
  207. package/build-types/dom/get-offset-parent.d.ts.map +1 -1
  208. package/build-types/dom/get-range-height.d.ts +2 -2
  209. package/build-types/dom/get-range-height.d.ts.map +1 -1
  210. package/build-types/dom/get-rectangle-from-range.d.ts +2 -2
  211. package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
  212. package/build-types/dom/get-scroll-container.d.ts +5 -5
  213. package/build-types/dom/get-scroll-container.d.ts.map +1 -1
  214. package/build-types/dom/hidden-caret-range-from-point.d.ts +5 -5
  215. package/build-types/dom/hidden-caret-range-from-point.d.ts.map +1 -1
  216. package/build-types/dom/index.d.ts.map +1 -1
  217. package/build-types/dom/input-field-has-uncollapsed-selection.d.ts +2 -2
  218. package/build-types/dom/input-field-has-uncollapsed-selection.d.ts.map +1 -1
  219. package/build-types/dom/insert-after.d.ts +2 -3
  220. package/build-types/dom/insert-after.d.ts.map +1 -1
  221. package/build-types/dom/is-edge.d.ts +4 -4
  222. package/build-types/dom/is-edge.d.ts.map +1 -1
  223. package/build-types/dom/is-element.d.ts.map +1 -1
  224. package/build-types/dom/is-empty.d.ts +3 -3
  225. package/build-types/dom/is-empty.d.ts.map +1 -1
  226. package/build-types/dom/is-entirely-selected.d.ts +2 -2
  227. package/build-types/dom/is-entirely-selected.d.ts.map +1 -1
  228. package/build-types/dom/is-form-element.d.ts +3 -3
  229. package/build-types/dom/is-form-element.d.ts.map +1 -1
  230. package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
  231. package/build-types/dom/is-html-input-element.d.ts +1 -1
  232. package/build-types/dom/is-html-input-element.d.ts.map +1 -1
  233. package/build-types/dom/is-input-or-text-area.d.ts.map +1 -1
  234. package/build-types/dom/is-number-input.d.ts +2 -2
  235. package/build-types/dom/is-number-input.d.ts.map +1 -1
  236. package/build-types/dom/is-rtl.d.ts +2 -2
  237. package/build-types/dom/is-rtl.d.ts.map +1 -1
  238. package/build-types/dom/is-selection-forward.d.ts +2 -2
  239. package/build-types/dom/is-selection-forward.d.ts.map +1 -1
  240. package/build-types/dom/is-text-field.d.ts +2 -2
  241. package/build-types/dom/is-text-field.d.ts.map +1 -1
  242. package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
  243. package/build-types/dom/place-caret-at-edge.d.ts +3 -3
  244. package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
  245. package/build-types/dom/place-caret-at-horizontal-edge.d.ts.map +1 -1
  246. package/build-types/dom/place-caret-at-vertical-edge.d.ts.map +1 -1
  247. package/build-types/dom/remove-invalid-html.d.ts +5 -4
  248. package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
  249. package/build-types/dom/remove.d.ts +1 -2
  250. package/build-types/dom/remove.d.ts.map +1 -1
  251. package/build-types/dom/replace-tag.d.ts +3 -3
  252. package/build-types/dom/replace-tag.d.ts.map +1 -1
  253. package/build-types/dom/replace.d.ts +2 -3
  254. package/build-types/dom/replace.d.ts.map +1 -1
  255. package/build-types/dom/safe-html.d.ts +2 -2
  256. package/build-types/dom/safe-html.d.ts.map +1 -1
  257. package/build-types/dom/scroll-if-no-range.d.ts +5 -5
  258. package/build-types/dom/scroll-if-no-range.d.ts.map +1 -1
  259. package/build-types/dom/strip-html.d.ts +2 -2
  260. package/build-types/dom/strip-html.d.ts.map +1 -1
  261. package/build-types/dom/types.d.ts +32 -0
  262. package/build-types/dom/types.d.ts.map +1 -0
  263. package/build-types/dom/unwrap.d.ts +1 -3
  264. package/build-types/dom/unwrap.d.ts.map +1 -1
  265. package/build-types/dom/wrap.d.ts +2 -2
  266. package/build-types/dom/wrap.d.ts.map +1 -1
  267. package/build-types/focusable.d.ts +11 -30
  268. package/build-types/focusable.d.ts.map +1 -1
  269. package/build-types/index.d.ts +17 -0
  270. package/build-types/index.d.ts.map +1 -1
  271. package/build-types/phrasing-content.d.ts +9 -24
  272. package/build-types/phrasing-content.d.ts.map +1 -1
  273. package/build-types/tabbable.d.ts +10 -15
  274. package/build-types/tabbable.d.ts.map +1 -1
  275. package/build-types/types.d.ts +29 -0
  276. package/build-types/types.d.ts.map +1 -0
  277. package/package.json +6 -7
  278. package/src/{data-transfer.js → data-transfer.ts} +3 -3
  279. package/src/dom/{caret-range-from-point.js → caret-range-from-point.ts} +9 -5
  280. package/src/dom/{clean-node-list.js → clean-node-list.ts} +16 -24
  281. package/src/dom/{compute-caret-rect.js → compute-caret-rect.ts} +3 -3
  282. package/src/dom/{document-has-selection.js → document-has-selection.ts} +3 -3
  283. package/src/dom/{document-has-text-selection.js → document-has-text-selection.ts} +3 -3
  284. package/src/dom/{document-has-uncollapsed-selection.js → document-has-uncollapsed-selection.ts} +5 -3
  285. package/src/dom/{get-computed-style.js → get-computed-style.ts} +5 -3
  286. package/src/dom/{get-offset-parent.js → get-offset-parent.ts} +9 -14
  287. package/src/dom/{get-range-height.js → get-range-height.ts} +3 -3
  288. package/src/dom/{get-rectangle-from-range.js → get-rectangle-from-range.ts} +6 -12
  289. package/src/dom/{get-scroll-container.js → get-scroll-container.ts} +9 -9
  290. package/src/dom/{hidden-caret-range-from-point.js → hidden-caret-range-from-point.ts} +11 -6
  291. package/src/dom/{input-field-has-uncollapsed-selection.js → input-field-has-uncollapsed-selection.ts} +7 -5
  292. package/src/dom/{insert-after.js → insert-after.ts} +6 -4
  293. package/src/dom/{is-edge.js → is-edge.ts} +9 -5
  294. package/src/dom/{is-element.js → is-element.ts} +3 -1
  295. package/src/dom/{is-empty.js → is-empty.ts} +5 -7
  296. package/src/dom/{is-entirely-selected.js → is-entirely-selected.ts} +14 -11
  297. package/src/dom/{is-form-element.js → is-form-element.ts} +5 -3
  298. package/src/dom/{is-horizontal-edge.js → is-horizontal-edge.ts} +4 -1
  299. package/src/dom/{is-html-input-element.js → is-html-input-element.ts} +3 -1
  300. package/src/dom/{is-input-or-text-area.js → is-input-or-text-area.ts} +3 -1
  301. package/src/dom/{is-number-input.js → is-number-input.ts} +3 -3
  302. package/src/dom/{is-rtl.js → is-rtl.ts} +3 -3
  303. package/src/dom/{is-selection-forward.js → is-selection-forward.ts} +3 -3
  304. package/src/dom/{is-text-field.js → is-text-field.ts} +4 -4
  305. package/src/dom/{is-vertical-edge.js → is-vertical-edge.ts} +4 -1
  306. package/src/dom/{place-caret-at-edge.js → place-caret-at-edge.ts} +17 -9
  307. package/src/dom/{place-caret-at-horizontal-edge.js → place-caret-at-horizontal-edge.ts} +4 -1
  308. package/src/dom/{place-caret-at-vertical-edge.js → place-caret-at-vertical-edge.ts} +5 -1
  309. package/src/dom/{remove-invalid-html.js → remove-invalid-html.ts} +9 -4
  310. package/src/dom/{remove.js → remove.ts} +2 -3
  311. package/src/dom/{replace-tag.js → replace-tag.ts} +4 -4
  312. package/src/dom/{replace.js → replace.ts} +6 -4
  313. package/src/dom/{safe-html.js → safe-html.ts} +3 -3
  314. package/src/dom/{scroll-if-no-range.js → scroll-if-no-range.ts} +9 -5
  315. package/src/dom/{strip-html.js → strip-html.ts} +3 -3
  316. package/src/dom/types.ts +28 -0
  317. package/src/dom/{unwrap.js → unwrap.ts} +2 -4
  318. package/src/dom/{wrap.js → wrap.ts} +3 -3
  319. package/src/{focusable.js → focusable.ts} +34 -32
  320. package/src/index.ts +33 -0
  321. package/src/{phrasing-content.js → phrasing-content.ts} +15 -30
  322. package/src/{tabbable.js → tabbable.ts} +48 -39
  323. package/src/test/dom.jsdom.test.js +21 -0
  324. package/src/types.ts +32 -0
  325. package/CHANGELOG.md +0 -315
  326. package/src/index.js +0 -12
  327. /package/src/dom/{index.js → index.ts} +0 -0
@@ -1,4 +1,4 @@
1
- // packages/dom/src/focusable.js
1
+ // packages/dom/src/focusable.ts
2
2
  function buildSelector(sequential) {
3
3
  return [
4
4
  sequential ? '[tabindex]:not([tabindex^="-"])' : "[tabindex]",
@@ -41,14 +41,13 @@ function isValidFocusableArea(element) {
41
41
  return !!img && !img.closest("[inert]") && isVisible(img);
42
42
  }
43
43
  function find(context, { sequential = false } = {}) {
44
- const elements = context.querySelectorAll(buildSelector(sequential));
44
+ const elements = context.querySelectorAll(
45
+ buildSelector(sequential)
46
+ );
45
47
  return Array.from(elements).filter((element) => {
46
48
  const { nodeName } = element;
47
49
  if ("AREA" === nodeName) {
48
- return isValidFocusableArea(
49
- /** @type {HTMLAreaElement} */
50
- element
51
- );
50
+ return isValidFocusableArea(element);
52
51
  }
53
52
  if (element.closest("[inert]")) {
54
53
  return false;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/focusable.js"],
4
- "sourcesContent": ["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'summary',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element has a layout box and is not hidden by\n * CSS visibility or content visibility.\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\tif ( typeof element.checkVisibility === 'function' ) {\n\t\tif ( ! element.checkVisibility( { visibilityProperty: true } ) ) {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\tconst visibility =\n\t\t\telement.ownerDocument.defaultView?.getComputedStyle(\n\t\t\t\telement\n\t\t\t).visibility;\n\t\tif ( visibility === 'hidden' || visibility === 'collapse' ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && ! img.closest( '[inert]' ) && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} options\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {HTMLElement[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/** @type {NodeListOf<HTMLElement>} */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\t// The mapped image determines whether this region is visible or inert.\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\t// Elements inside an inert subtree are not focusable.\n\t\tif ( element.closest( '[inert]' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn isVisible( element );\n\t} );\n}\n"],
5
- "mappings": ";AA8BA,SAAS,cAAe,YAAa;AACpC,SAAO;AAAA,IACN,aAAa,oCAAoC;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAM,GAAI;AACb;AAUA,SAAS,UAAW,SAAU;AAC7B,MAAK,OAAO,QAAQ,oBAAoB,YAAa;AACpD,QAAK,CAAE,QAAQ,gBAAiB,EAAE,oBAAoB,KAAK,CAAE,GAAI;AAChE,aAAO;AAAA,IACR;AAAA,EACD,OAAO;AACN,UAAM,aACL,QAAQ,cAAc,aAAa;AAAA,MAClC;AAAA,IACD,EAAE;AACH,QAAK,eAAe,YAAY,eAAe,YAAa;AAC3D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SACC,QAAQ,cAAc,KACtB,QAAQ,eAAe,KACvB,QAAQ,eAAe,EAAE,SAAS;AAEpC;AAWA,SAAS,qBAAsB,SAAU;AAExC,QAAM,MAAM,QAAQ,QAAS,WAAY;AACzC,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,QAAM,MAAM,QAAQ,cAAc;AAAA,IACjC,kBAAkB,IAAI,OAAO;AAAA,EAC9B;AACA,SAAO,CAAC,CAAE,OAAO,CAAE,IAAI,QAAS,SAAU,KAAK,UAAW,GAAI;AAC/D;AAgBO,SAAS,KAAM,SAAS,EAAE,aAAa,MAAM,IAAI,CAAC,GAAI;AAE5D,QAAM,WAAW,QAAQ,iBAAkB,cAAe,UAAW,CAAE;AAEvE,SAAO,MAAM,KAAM,QAAS,EAAE,OAAQ,CAAE,YAAa;AACpD,UAAM,EAAE,SAAS,IAAI;AACrB,QAAK,WAAW,UAAW;AAE1B,aAAO;AAAA;AAAA,QAC2B;AAAA,MAClC;AAAA,IACD;AAGA,QAAK,QAAQ,QAAS,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAEA,WAAO,UAAW,OAAQ;AAAA,EAC3B,CAAE;AACH;",
3
+ "sources": ["../src/focusable.ts"],
4
+ "sourcesContent": ["import type { FindFocusableOptions } from './types';\n\n/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return CSS selector.\n */\nfunction buildSelector( sequential: boolean ): string {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'summary',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element has a layout box and is not hidden by\n * CSS visibility or content visibility.\n *\n * @param element DOM element to test.\n *\n * @return Whether element is visible.\n */\nfunction isVisible( element: HTMLElement ): boolean {\n\tif ( typeof element.checkVisibility === 'function' ) {\n\t\tif ( ! element.checkVisibility( { visibilityProperty: true } ) ) {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\tconst visibility =\n\t\t\telement.ownerDocument.defaultView?.getComputedStyle(\n\t\t\t\telement\n\t\t\t).visibility;\n\t\tif ( visibility === 'hidden' || visibility === 'collapse' ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param element DOM area element to test.\n *\n * @return Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element: HTMLAreaElement ): boolean {\n\tconst map: HTMLMapElement | null = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\tconst img: HTMLImageElement | null = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && ! img.closest( '[inert]' ) && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param context Element in which to search.\n * @param options\n * @param [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return Focusable elements.\n */\nexport function find(\n\tcontext: Element,\n\t{ sequential = false }: FindFocusableOptions = {}\n): HTMLElement[] {\n\tconst elements: NodeListOf< HTMLElement > = context.querySelectorAll(\n\t\tbuildSelector( sequential )\n\t);\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\t// The mapped image determines whether this region is visible or inert.\n\t\t\treturn isValidFocusableArea( element as HTMLAreaElement );\n\t\t}\n\n\t\t// Elements inside an inert subtree are not focusable.\n\t\tif ( element.closest( '[inert]' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn isVisible( element );\n\t} );\n}\n"],
5
+ "mappings": ";AAgCA,SAAS,cAAe,YAA8B;AACrD,SAAO;AAAA,IACN,aAAa,oCAAoC;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAM,GAAI;AACb;AAUA,SAAS,UAAW,SAAgC;AACnD,MAAK,OAAO,QAAQ,oBAAoB,YAAa;AACpD,QAAK,CAAE,QAAQ,gBAAiB,EAAE,oBAAoB,KAAK,CAAE,GAAI;AAChE,aAAO;AAAA,IACR;AAAA,EACD,OAAO;AACN,UAAM,aACL,QAAQ,cAAc,aAAa;AAAA,MAClC;AAAA,IACD,EAAE;AACH,QAAK,eAAe,YAAY,eAAe,YAAa;AAC3D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SACC,QAAQ,cAAc,KACtB,QAAQ,eAAe,KACvB,QAAQ,eAAe,EAAE,SAAS;AAEpC;AAWA,SAAS,qBAAsB,SAAoC;AAClE,QAAM,MAA6B,QAAQ,QAAS,WAAY;AAChE,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,MAA+B,QAAQ,cAAc;AAAA,IAC1D,kBAAkB,IAAI,OAAO;AAAA,EAC9B;AACA,SAAO,CAAC,CAAE,OAAO,CAAE,IAAI,QAAS,SAAU,KAAK,UAAW,GAAI;AAC/D;AAgBO,SAAS,KACf,SACA,EAAE,aAAa,MAAM,IAA0B,CAAC,GAChC;AAChB,QAAM,WAAsC,QAAQ;AAAA,IACnD,cAAe,UAAW;AAAA,EAC3B;AAEA,SAAO,MAAM,KAAM,QAAS,EAAE,OAAQ,CAAE,YAAa;AACpD,UAAM,EAAE,SAAS,IAAI;AACrB,QAAK,WAAW,UAAW;AAE1B,aAAO,qBAAsB,OAA2B;AAAA,IACzD;AAGA,QAAK,QAAQ,QAAS,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAEA,WAAO,UAAW,OAAQ;AAAA,EAC3B,CAAE;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/dom/src/index.js
1
+ // packages/dom/src/index.ts
2
2
  import * as focusable from "./focusable.mjs";
3
3
  import * as tabbable from "./tabbable.mjs";
4
4
  export * from "./dom/index.mjs";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.js"],
4
- "sourcesContent": ["import * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"],
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n\n/**\n * Schema of the content allowed inside an element, keyed by tag name.\n */\nexport type { ContentSchema } from './types';\n\n/**\n * The attributes and children allowed for an element in a `ContentSchema`.\n */\nexport type { SemanticElementDefinition } from './types';\n\n/**\n * Schema that `cleanNodeList` and `removeInvalidHTML` clean HTML against,\n * keyed by tag name.\n */\nexport type { Schema } from './dom/types';\n\n/**\n * The rules for a single tag in a `Schema`.\n */\nexport type { SchemaItem } from './dom/types';\n"],
5
5
  "mappings": ";AAAA,YAAY,eAAe;AAC3B,YAAY,cAAc;AAQ1B,cAAc;AACd,cAAc;AACd,cAAc;AAJP,IAAM,QAAQ,EAAE,WAAW,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/dom/src/phrasing-content.js
1
+ // packages/dom/src/phrasing-content.ts
2
2
  var textContentSchema = {
3
3
  strong: {},
4
4
  em: {},
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/phrasing-content.js"],
4
- "sourcesContent": ["/**\n * All phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\n\n/**\n * @typedef {Record<string,SemanticElementDefinition>} ContentSchema\n */\n\n/**\n * @typedef SemanticElementDefinition\n * @property {string[]} [attributes] Content attributes\n * @property {ContentSchema|'*'} [children] Content attributes\n */\n\n/**\n * All text-level semantic elements.\n *\n * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html\n *\n * @type {ContentSchema}\n */\nconst textContentSchema = {\n\tstrong: {},\n\tem: {},\n\ts: {},\n\tdel: {},\n\tins: {},\n\ta: { attributes: [ 'href', 'target', 'rel', 'id' ] },\n\tcode: {},\n\tabbr: { attributes: [ 'title' ] },\n\tsub: {},\n\tsup: {},\n\tbr: {},\n\tsmall: {},\n\t// To do: fix blockquote.\n\t// cite: {},\n\tq: { attributes: [ 'cite' ] },\n\tdfn: { attributes: [ 'title' ] },\n\tdata: { attributes: [ 'value' ] },\n\ttime: { attributes: [ 'datetime' ] },\n\tvar: {},\n\tsamp: {},\n\tkbd: {},\n\ti: {},\n\tb: {},\n\tu: {},\n\tmark: {},\n\truby: {},\n\trt: {},\n\trp: {},\n\tbdi: { attributes: [ 'dir' ] },\n\tbdo: { attributes: [ 'dir' ] },\n\twbr: {},\n\t'#text': {},\n};\n\n/**\n * Embedded content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0\n *\n * @type {ContentSchema}\n */\nconst embeddedContentSchema = {\n\taudio: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'preload',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t],\n\t},\n\tcanvas: { attributes: [ 'width', 'height' ] },\n\tembed: { attributes: [ 'src', 'type', 'width', 'height' ] },\n\timg: {\n\t\tattributes: [\n\t\t\t'alt',\n\t\t\t'src',\n\t\t\t'srcset',\n\t\t\t'usemap',\n\t\t\t'ismap',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tobject: {\n\t\tattributes: [\n\t\t\t'data',\n\t\t\t'type',\n\t\t\t'name',\n\t\t\t'usemap',\n\t\t\t'form',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tvideo: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'poster',\n\t\t\t'preload',\n\t\t\t'playsinline',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t\t'controls',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tmath: {\n\t\tattributes: [ 'display', 'xmlns' ],\n\t\tchildren: '*',\n\t},\n};\n\nconst excludedElements = [ '#text', 'br', 'wbr' ];\n\n// Wire up children for each text-level wrapper.\n// - Recursion is needed (e.g. strong > em > strong; not strong > strong).\n// - <img> is allowed too: text-level wrappers accept phrasing content, and\n// <a>'s transparent model permits non-interactive embedded content.\nObject.keys( textContentSchema )\n\t.filter( ( element ) => ! excludedElements.includes( element ) )\n\t.forEach( ( tag ) => {\n\t\tconst { [ tag ]: removedTag, ...restSchema } = textContentSchema;\n\t\ttextContentSchema[ tag ].children = {\n\t\t\t...restSchema,\n\t\t\timg: embeddedContentSchema.img,\n\t\t};\n\t} );\n\n/**\n * Phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\nconst phrasingContentSchema = {\n\t...textContentSchema,\n\t...embeddedContentSchema,\n};\n\n/**\n * Get schema of possible paths for phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {string} [context] Set to \"paste\" to exclude invisible elements and\n * sensitive data.\n *\n * @return {Partial<ContentSchema>} Schema.\n */\nexport function getPhrasingContentSchema( context ) {\n\tif ( context !== 'paste' ) {\n\t\treturn phrasingContentSchema;\n\t}\n\n\t/**\n\t * @type {Partial<ContentSchema>}\n\t */\n\tconst {\n\t\tu, // Used to mark misspelling. Shouldn't be pasted.\n\t\tabbr, // Invisible.\n\t\tdata, // Invisible.\n\t\ttime, // Invisible.\n\t\twbr, // Invisible.\n\t\tbdi, // Invisible.\n\t\tbdo, // Invisible.\n\t\t...remainingContentSchema\n\t} = {\n\t\t...phrasingContentSchema,\n\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t// visible to the user when pasted, so strip the attributes.\n\t\tins: { children: phrasingContentSchema.ins.children },\n\t\tdel: { children: phrasingContentSchema.del.children },\n\t};\n\n\treturn remainingContentSchema;\n}\n\n/**\n * Find out whether or not the given node is phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {Node} node The node to test.\n *\n * @return {boolean} True if phrasing content, false if not.\n */\nexport function isPhrasingContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn getPhrasingContentSchema().hasOwnProperty( tag ) || tag === 'span';\n}\n\n/**\n * @param {Node} node\n * @return {boolean} Node is text content\n */\nexport function isTextContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn textContentSchema.hasOwnProperty( tag ) || tag === 'span';\n}\n"],
5
- "mappings": "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",
3
+ "sources": ["../src/phrasing-content.ts"],
4
+ "sourcesContent": ["import type { ContentSchema } from './types';\n\n/**\n * All phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\n\n/**\n * All text-level semantic elements.\n *\n * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html\n */\nconst textContentSchema: ContentSchema = {\n\tstrong: {},\n\tem: {},\n\ts: {},\n\tdel: {},\n\tins: {},\n\ta: { attributes: [ 'href', 'target', 'rel', 'id' ] },\n\tcode: {},\n\tabbr: { attributes: [ 'title' ] },\n\tsub: {},\n\tsup: {},\n\tbr: {},\n\tsmall: {},\n\t// To do: fix blockquote.\n\t// cite: {},\n\tq: { attributes: [ 'cite' ] },\n\tdfn: { attributes: [ 'title' ] },\n\tdata: { attributes: [ 'value' ] },\n\ttime: { attributes: [ 'datetime' ] },\n\tvar: {},\n\tsamp: {},\n\tkbd: {},\n\ti: {},\n\tb: {},\n\tu: {},\n\tmark: {},\n\truby: {},\n\trt: {},\n\trp: {},\n\tbdi: { attributes: [ 'dir' ] },\n\tbdo: { attributes: [ 'dir' ] },\n\twbr: {},\n\t'#text': {},\n};\n\n/**\n * Embedded content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0\n */\nconst embeddedContentSchema: ContentSchema = {\n\taudio: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'preload',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t],\n\t},\n\tcanvas: { attributes: [ 'width', 'height' ] },\n\tembed: { attributes: [ 'src', 'type', 'width', 'height' ] },\n\timg: {\n\t\tattributes: [\n\t\t\t'alt',\n\t\t\t'src',\n\t\t\t'srcset',\n\t\t\t'usemap',\n\t\t\t'ismap',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tobject: {\n\t\tattributes: [\n\t\t\t'data',\n\t\t\t'type',\n\t\t\t'name',\n\t\t\t'usemap',\n\t\t\t'form',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tvideo: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'poster',\n\t\t\t'preload',\n\t\t\t'playsinline',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t\t'controls',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tmath: {\n\t\tattributes: [ 'display', 'xmlns' ],\n\t\tchildren: '*',\n\t},\n};\n\nconst excludedElements = [ '#text', 'br', 'wbr' ];\n\n// Wire up children for each text-level wrapper.\n// - Recursion is needed (e.g. strong > em > strong; not strong > strong).\n// - <img> is allowed too: text-level wrappers accept phrasing content, and\n// <a>'s transparent model permits non-interactive embedded content.\nObject.keys( textContentSchema )\n\t.filter( ( element ) => ! excludedElements.includes( element ) )\n\t.forEach( ( tag ) => {\n\t\tconst { [ tag ]: removedTag, ...restSchema } = textContentSchema;\n\t\ttextContentSchema[ tag ].children = {\n\t\t\t...restSchema,\n\t\t\timg: embeddedContentSchema.img,\n\t\t};\n\t} );\n\n/**\n * Phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\nconst phrasingContentSchema = {\n\t...textContentSchema,\n\t...embeddedContentSchema,\n};\n\n/**\n * Get schema of possible paths for phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param [context] Set to \"paste\" to exclude invisible elements and\n * sensitive data.\n *\n * @return Schema.\n */\nexport function getPhrasingContentSchema( context?: string ): ContentSchema {\n\tif ( context !== 'paste' ) {\n\t\treturn phrasingContentSchema;\n\t}\n\n\tconst {\n\t\tu, // Used to mark misspelling. Shouldn't be pasted.\n\t\tabbr, // Invisible.\n\t\tdata, // Invisible.\n\t\ttime, // Invisible.\n\t\twbr, // Invisible.\n\t\tbdi, // Invisible.\n\t\tbdo, // Invisible.\n\t\t...remainingContentSchema\n\t}: ContentSchema = {\n\t\t...phrasingContentSchema,\n\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t// visible to the user when pasted, so strip the attributes.\n\t\tins: { children: phrasingContentSchema.ins.children },\n\t\tdel: { children: phrasingContentSchema.del.children },\n\t};\n\n\treturn remainingContentSchema;\n}\n\n/**\n * Find out whether or not the given node is phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param node The node to test.\n *\n * @return True if phrasing content, false if not.\n */\nexport function isPhrasingContent( node: Node ): boolean {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn getPhrasingContentSchema().hasOwnProperty( tag ) || tag === 'span';\n}\n\n/**\n * @param node\n * @return Node is text content\n */\nexport function isTextContent( node: Node ): boolean {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn textContentSchema.hasOwnProperty( tag ) || tag === 'span';\n}\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/dom/src/tabbable.js
1
+ // packages/dom/src/tabbable.ts
2
2
  import { find as findFocusable } from "./focusable.mjs";
3
3
  function getTabIndex(element) {
4
4
  const tabIndex = element.getAttribute("tabindex");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/tabbable.js"],
4
- "sourcesContent": ["import { find as findFocusable } from './focusable';\n\n/**\n * Returns the tab index of the given element. In contrast with the tabIndex\n * property, this normalizes the default (0) to avoid browser inconsistencies,\n * operating under the assumption that this function is only ever called with a\n * focusable node.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261\n *\n * @param {Element} element Element from which to retrieve.\n *\n * @return {number} Tab index of element (default 0).\n */\nfunction getTabIndex( element ) {\n\tconst tabIndex = element.getAttribute( 'tabindex' );\n\treturn tabIndex === null ? 0 : parseInt( tabIndex, 10 );\n}\n\n/**\n * Returns true if the specified element is tabbable, or false otherwise.\n *\n * @param {Element} element Element to test.\n *\n * @return {boolean} Whether element is tabbable.\n */\nexport function isTabbableIndex( element ) {\n\treturn getTabIndex( element ) !== -1;\n}\n\n/** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */\n\n/**\n * Returns a stateful reducer function which constructs a filtered array of\n * tabbable elements, where at most one radio input is selected for a given\n * name, giving priority to checked input, falling back to the first\n * encountered.\n *\n * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer.\n */\nfunction createStatefulCollapseRadioGroup() {\n\t/** @type {Record<string, MaybeHTMLInputElement>} */\n\tconst CHOSEN_RADIO_BY_NAME = {};\n\n\treturn function collapseRadioGroup(\n\t\t/** @type {MaybeHTMLInputElement[]} */ result,\n\t\t/** @type {MaybeHTMLInputElement} */ element\n\t) {\n\t\tconst { nodeName, type, checked, name } = element;\n\n\t\t// For all non-radio tabbables, construct to array by concatenating.\n\t\tif ( nodeName !== 'INPUT' || type !== 'radio' || ! name ) {\n\t\t\treturn result.concat( element );\n\t\t}\n\n\t\tconst hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty( name );\n\n\t\t// Omit by skipping concatenation if the radio element is not chosen.\n\t\tconst isChosen = checked || ! hasChosen;\n\t\tif ( ! isChosen ) {\n\t\t\treturn result;\n\t\t}\n\n\t\t// At this point, if there had been a chosen element, the current\n\t\t// element is checked and should take priority. Retroactively remove\n\t\t// the element which had previously been considered the chosen one.\n\t\tif ( hasChosen ) {\n\t\t\tconst hadChosenElement = CHOSEN_RADIO_BY_NAME[ name ];\n\t\t\tresult = result.filter( ( e ) => e !== hadChosenElement );\n\t\t}\n\n\t\tCHOSEN_RADIO_BY_NAME[ name ] = element;\n\n\t\treturn result.concat( element );\n\t};\n}\n\n/**\n * An array map callback, returning an object with the element value and its\n * array index location as properties. This is used to emulate a proper stable\n * sort where equal tabIndex should be left in order of their occurrence in the\n * document.\n *\n * @param {HTMLElement} element Element.\n * @param {number} index Array index of element.\n *\n * @return {{ element: HTMLElement, index: number }} Mapped object with element, index.\n */\nfunction mapElementToObjectTabbable( element, index ) {\n\treturn { element, index };\n}\n\n/**\n * An array map callback, returning an element of the given mapped object's\n * element value.\n *\n * @param {{ element: HTMLElement }} object Mapped object with element.\n *\n * @return {HTMLElement} Mapped object element.\n */\nfunction mapObjectTabbableToElement( object ) {\n\treturn object.element;\n}\n\n/**\n * A sort comparator function used in comparing two objects of mapped elements.\n *\n * @see mapElementToObjectTabbable\n *\n * @param {{ element: HTMLElement, index: number }} a First object to compare.\n * @param {{ element: HTMLElement, index: number }} b Second object to compare.\n *\n * @return {number} Comparator result.\n */\nfunction compareObjectTabbables( a, b ) {\n\tconst aTabIndex = getTabIndex( a.element );\n\tconst bTabIndex = getTabIndex( b.element );\n\n\tif ( aTabIndex === bTabIndex ) {\n\t\treturn a.index - b.index;\n\t}\n\n\treturn aTabIndex - bTabIndex;\n}\n\n/**\n * Given focusable elements, filters out tabbable element.\n *\n * @param {HTMLElement[]} focusables Focusable elements to filter.\n *\n * @return {HTMLElement[]} Tabbable elements.\n */\nfunction filterTabbable( focusables ) {\n\treturn focusables\n\t\t.filter( isTabbableIndex )\n\t\t.map( mapElementToObjectTabbable )\n\t\t.sort( compareObjectTabbables )\n\t\t.map( mapObjectTabbableToElement )\n\t\t.reduce( createStatefulCollapseRadioGroup(), [] );\n}\n\n/**\n * @param {Element} context\n * @return {HTMLElement[]} Tabbable elements within the context.\n */\nexport function find( context ) {\n\treturn filterTabbable( findFocusable( context ) );\n}\n\n/**\n * Given a focusable element, find the preceding tabbable element.\n *\n * @param {Element} element The focusable element before which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Preceding tabbable element.\n */\nexport function findPrevious( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) )\n\t\t.reverse()\n\t\t.find(\n\t\t\t( focusable ) =>\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\t\telement.DOCUMENT_POSITION_PRECEDING\n\t\t);\n}\n\n/**\n * Given a focusable element, find the next tabbable element.\n *\n * @param {Element} element The focusable element after which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Next tabbable element.\n */\nexport function findNext( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) ).find(\n\t\t( focusable ) =>\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\telement.DOCUMENT_POSITION_FOLLOWING\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,QAAQ,qBAAqB;AActC,SAAS,YAAa,SAAU;AAC/B,QAAM,WAAW,QAAQ,aAAc,UAAW;AAClD,SAAO,aAAa,OAAO,IAAI,SAAU,UAAU,EAAG;AACvD;AASO,SAAS,gBAAiB,SAAU;AAC1C,SAAO,YAAa,OAAQ,MAAM;AACnC;AAYA,SAAS,mCAAmC;AAE3C,QAAM,uBAAuB,CAAC;AAE9B,SAAO,SAAS,mBACwB,QACF,SACpC;AACD,UAAM,EAAE,UAAU,MAAM,SAAS,KAAK,IAAI;AAG1C,QAAK,aAAa,WAAW,SAAS,WAAW,CAAE,MAAO;AACzD,aAAO,OAAO,OAAQ,OAAQ;AAAA,IAC/B;AAEA,UAAM,YAAY,qBAAqB,eAAgB,IAAK;AAG5D,UAAM,WAAW,WAAW,CAAE;AAC9B,QAAK,CAAE,UAAW;AACjB,aAAO;AAAA,IACR;AAKA,QAAK,WAAY;AAChB,YAAM,mBAAmB,qBAAsB,IAAK;AACpD,eAAS,OAAO,OAAQ,CAAE,MAAO,MAAM,gBAAiB;AAAA,IACzD;AAEA,yBAAsB,IAAK,IAAI;AAE/B,WAAO,OAAO,OAAQ,OAAQ;AAAA,EAC/B;AACD;AAaA,SAAS,2BAA4B,SAAS,OAAQ;AACrD,SAAO,EAAE,SAAS,MAAM;AACzB;AAUA,SAAS,2BAA4B,QAAS;AAC7C,SAAO,OAAO;AACf;AAYA,SAAS,uBAAwB,GAAG,GAAI;AACvC,QAAM,YAAY,YAAa,EAAE,OAAQ;AACzC,QAAM,YAAY,YAAa,EAAE,OAAQ;AAEzC,MAAK,cAAc,WAAY;AAC9B,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,SAAO,YAAY;AACpB;AASA,SAAS,eAAgB,YAAa;AACrC,SAAO,WACL,OAAQ,eAAgB,EACxB,IAAK,0BAA2B,EAChC,KAAM,sBAAuB,EAC7B,IAAK,0BAA2B,EAChC,OAAQ,iCAAiC,GAAG,CAAC,CAAE;AAClD;AAMO,SAAS,KAAM,SAAU;AAC/B,SAAO,eAAgB,cAAe,OAAQ,CAAE;AACjD;AAUO,SAAS,aAAc,SAAU;AACvC,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EACjE,QAAQ,EACR;AAAA,IACA,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACF;AAUO,SAAS,SAAU,SAAU;AACnC,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EAAE;AAAA,IACpE,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACD;",
3
+ "sources": ["../src/tabbable.ts"],
4
+ "sourcesContent": ["import type { MaybeHTMLInputElement, ObjectTabbable } from './types';\nimport { find as findFocusable } from './focusable';\n\n/**\n * Returns the tab index of the given element. In contrast with the tabIndex\n * property, this normalizes the default (0) to avoid browser inconsistencies,\n * operating under the assumption that this function is only ever called with a\n * focusable node.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261\n *\n * @param element Element from which to retrieve.\n *\n * @return Tab index of element (default 0).\n */\nfunction getTabIndex( element: Element ): number {\n\tconst tabIndex = element.getAttribute( 'tabindex' );\n\treturn tabIndex === null ? 0 : parseInt( tabIndex, 10 );\n}\n\n/**\n * Returns true if the specified element is tabbable, or false otherwise.\n *\n * @param element Element to test.\n *\n * @return Whether element is tabbable.\n */\nexport function isTabbableIndex( element: Element ): boolean {\n\treturn getTabIndex( element ) !== -1;\n}\n\n/**\n * Returns a stateful reducer function which constructs a filtered array of\n * tabbable elements, where at most one radio input is selected for a given\n * name, giving priority to checked input, falling back to the first\n * encountered.\n *\n * @return Radio group collapse reducer.\n */\nfunction createStatefulCollapseRadioGroup(): (\n\tacc: MaybeHTMLInputElement[],\n\tel: MaybeHTMLInputElement\n) => MaybeHTMLInputElement[] {\n\tconst CHOSEN_RADIO_BY_NAME: Record< string, MaybeHTMLInputElement > = {};\n\n\treturn function collapseRadioGroup(\n\t\tresult: MaybeHTMLInputElement[],\n\t\telement: MaybeHTMLInputElement\n\t) {\n\t\tconst { nodeName, type, checked, name } = element;\n\n\t\t// For all non-radio tabbables, construct to array by concatenating.\n\t\tif ( nodeName !== 'INPUT' || type !== 'radio' || ! name ) {\n\t\t\treturn result.concat( element );\n\t\t}\n\n\t\tconst hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty( name );\n\n\t\t// Omit by skipping concatenation if the radio element is not chosen.\n\t\tconst isChosen = checked || ! hasChosen;\n\t\tif ( ! isChosen ) {\n\t\t\treturn result;\n\t\t}\n\n\t\t// At this point, if there had been a chosen element, the current\n\t\t// element is checked and should take priority. Retroactively remove\n\t\t// the element which had previously been considered the chosen one.\n\t\tif ( hasChosen ) {\n\t\t\tconst hadChosenElement = CHOSEN_RADIO_BY_NAME[ name ];\n\t\t\tresult = result.filter( ( e ) => e !== hadChosenElement );\n\t\t}\n\n\t\tCHOSEN_RADIO_BY_NAME[ name ] = element;\n\n\t\treturn result.concat( element );\n\t};\n}\n\n/**\n * An array map callback, returning an object with the element value and its\n * array index location as properties. This is used to emulate a proper stable\n * sort where equal tabIndex should be left in order of their occurrence in the\n * document.\n *\n * @param element Element.\n * @param index Array index of element.\n *\n * @return Mapped object with element, index.\n */\nfunction mapElementToObjectTabbable(\n\telement: HTMLElement,\n\tindex: number\n): ObjectTabbable {\n\treturn { element, index };\n}\n\n/**\n * An array map callback, returning an element of the given mapped object's\n * element value.\n *\n * @param object Mapped object with element.\n *\n * @return Mapped object element.\n */\nfunction mapObjectTabbableToElement(\n\tobject: Pick< ObjectTabbable, 'element' >\n): HTMLElement {\n\treturn object.element;\n}\n\n/**\n * A sort comparator function used in comparing two objects of mapped elements.\n *\n * @see mapElementToObjectTabbable\n *\n * @param a First object to compare.\n * @param b Second object to compare.\n *\n * @return Comparator result.\n */\nfunction compareObjectTabbables(\n\ta: ObjectTabbable,\n\tb: ObjectTabbable\n): number {\n\tconst aTabIndex = getTabIndex( a.element );\n\tconst bTabIndex = getTabIndex( b.element );\n\n\tif ( aTabIndex === bTabIndex ) {\n\t\treturn a.index - b.index;\n\t}\n\n\treturn aTabIndex - bTabIndex;\n}\n\n/**\n * Given focusable elements, filters out tabbable element.\n *\n * @param focusables Focusable elements to filter.\n *\n * @return Tabbable elements.\n */\nfunction filterTabbable( focusables: HTMLElement[] ): HTMLElement[] {\n\treturn focusables\n\t\t.filter( isTabbableIndex )\n\t\t.map( mapElementToObjectTabbable )\n\t\t.sort( compareObjectTabbables )\n\t\t.map( mapObjectTabbableToElement )\n\t\t.reduce( createStatefulCollapseRadioGroup(), [] );\n}\n\n/**\n * @param context\n * @return Tabbable elements within the context.\n */\nexport function find( context: Element ): HTMLElement[] {\n\treturn filterTabbable( findFocusable( context ) );\n}\n\n/**\n * Given a focusable element, find the preceding tabbable element.\n *\n * @param element The focusable element before which to look. Defaults\n * to the active element.\n *\n * @return Preceding tabbable element.\n */\nexport function findPrevious( element: Element ): HTMLElement | undefined {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) )\n\t\t.reverse()\n\t\t.find(\n\t\t\t( focusable ) =>\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\t\telement.DOCUMENT_POSITION_PRECEDING\n\t\t);\n}\n\n/**\n * Given a focusable element, find the next tabbable element.\n *\n * @param element The focusable element after which to look. Defaults\n * to the active element.\n *\n * @return Next tabbable element.\n */\nexport function findNext( element: Element ): HTMLElement | undefined {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) ).find(\n\t\t( focusable ) =>\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\telement.DOCUMENT_POSITION_FOLLOWING\n\t);\n}\n"],
5
+ "mappings": ";AACA,SAAS,QAAQ,qBAAqB;AActC,SAAS,YAAa,SAA2B;AAChD,QAAM,WAAW,QAAQ,aAAc,UAAW;AAClD,SAAO,aAAa,OAAO,IAAI,SAAU,UAAU,EAAG;AACvD;AASO,SAAS,gBAAiB,SAA4B;AAC5D,SAAO,YAAa,OAAQ,MAAM;AACnC;AAUA,SAAS,mCAGoB;AAC5B,QAAM,uBAAgE,CAAC;AAEvE,SAAO,SAAS,mBACf,QACA,SACC;AACD,UAAM,EAAE,UAAU,MAAM,SAAS,KAAK,IAAI;AAG1C,QAAK,aAAa,WAAW,SAAS,WAAW,CAAE,MAAO;AACzD,aAAO,OAAO,OAAQ,OAAQ;AAAA,IAC/B;AAEA,UAAM,YAAY,qBAAqB,eAAgB,IAAK;AAG5D,UAAM,WAAW,WAAW,CAAE;AAC9B,QAAK,CAAE,UAAW;AACjB,aAAO;AAAA,IACR;AAKA,QAAK,WAAY;AAChB,YAAM,mBAAmB,qBAAsB,IAAK;AACpD,eAAS,OAAO,OAAQ,CAAE,MAAO,MAAM,gBAAiB;AAAA,IACzD;AAEA,yBAAsB,IAAK,IAAI;AAE/B,WAAO,OAAO,OAAQ,OAAQ;AAAA,EAC/B;AACD;AAaA,SAAS,2BACR,SACA,OACiB;AACjB,SAAO,EAAE,SAAS,MAAM;AACzB;AAUA,SAAS,2BACR,QACc;AACd,SAAO,OAAO;AACf;AAYA,SAAS,uBACR,GACA,GACS;AACT,QAAM,YAAY,YAAa,EAAE,OAAQ;AACzC,QAAM,YAAY,YAAa,EAAE,OAAQ;AAEzC,MAAK,cAAc,WAAY;AAC9B,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,SAAO,YAAY;AACpB;AASA,SAAS,eAAgB,YAA2C;AACnE,SAAO,WACL,OAAQ,eAAgB,EACxB,IAAK,0BAA2B,EAChC,KAAM,sBAAuB,EAC7B,IAAK,0BAA2B,EAChC,OAAQ,iCAAiC,GAAG,CAAC,CAAE;AAClD;AAMO,SAAS,KAAM,SAAkC;AACvD,SAAO,eAAgB,cAAe,OAAQ,CAAE;AACjD;AAUO,SAAS,aAAc,SAA4C;AACzE,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EACjE,QAAQ,EACR;AAAA,IACA,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACF;AAUO,SAAS,SAAU,SAA4C;AACrE,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EAAE;AAAA,IACpE,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACD;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Gets all files from a DataTransfer object.
3
3
  *
4
- * @param {DataTransfer} dataTransfer DataTransfer object to inspect.
4
+ * @param dataTransfer DataTransfer object to inspect.
5
5
  *
6
- * @return {File[]} An array containing all files.
6
+ * @return An array containing all files.
7
7
  */
8
8
  export declare function getFilesFromDataTransfer(dataTransfer: DataTransfer): File[];
9
9
  //# sourceMappingURL=data-transfer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-transfer.d.ts","sourceRoot":"","sources":["../src/data-transfer.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAE,YAAY,EAJ3C,YAI2C,GAF1C,IAAI,EAAE,CAsBjB"}
1
+ {"version":3,"file":"data-transfer.d.ts","sourceRoot":"","sources":["../src/data-transfer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAE,YAAY,EAAE,YAAY,GAAI,IAAI,EAAE,CAoB7E"}
@@ -6,11 +6,11 @@
6
6
  *
7
7
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretPositionFromPoint
8
8
  *
9
- * @param {Document} doc The document of the range.
10
- * @param {number} x Horizontal position within the current viewport.
11
- * @param {number} y Vertical position within the current viewport.
9
+ * @param doc The document of the range.
10
+ * @param x Horizontal position within the current viewport.
11
+ * @param y Vertical position within the current viewport.
12
12
  *
13
- * @return {Range | null} The best range for the given point.
13
+ * @return The best range for the given point.
14
14
  */
15
15
  export default function caretRangeFromPoint(doc: Document, x: number, y: number): Range | null;
16
16
  //# sourceMappingURL=caret-range-from-point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/caret-range-from-point.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,GAAG,EANrC,QAMqC,EAAE,CAAC,EALxC,MAKwC,EAAE,CAAC,EAJ3C,MAI2C,GAF1C,KAAK,GAAG,IAAI,CAyBvB"}
1
+ {"version":3,"file":"caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/caret-range-from-point.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAC1C,GAAG,EAAE,QAAQ,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACP,KAAK,GAAG,IAAI,CAuBd"}
@@ -1,52 +1,12 @@
1
- export type SchemaItem = {
2
- /**
3
- * Attributes.
4
- */
5
- attributes?: string[];
6
- /**
7
- * Classnames or RegExp to test against. Use '*' to keep all classes.
8
- */
9
- classes?: (string | RegExp)[];
10
- /**
11
- * Child schemas.
12
- */
13
- children?: '*' | {
14
- [tag: string]: SchemaItem;
15
- };
16
- /**
17
- * Selectors to test required children against. Leave empty or undefined if there are no requirements.
18
- */
19
- require?: string[];
20
- /**
21
- * Whether to allow nodes without children.
22
- */
23
- allowEmpty: boolean;
24
- /**
25
- * Function to test whether a node is a match. If left undefined any node will be assumed to match.
26
- */
27
- isMatch?: (node: Node) => boolean;
28
- };
29
- export type Schema = {
30
- [tag: string]: SchemaItem;
31
- };
32
- /**
33
- * @typedef SchemaItem
34
- * @property {string[]} [attributes] Attributes.
35
- * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against. Use '*' to keep all classes.
36
- * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.
37
- * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.
38
- * @property {boolean} allowEmpty Whether to allow nodes without children.
39
- * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.
40
- */
41
- /** @typedef {{ [tag: string]: SchemaItem }} Schema */
1
+ import type { Schema } from './types';
42
2
  /**
43
3
  * Given a schema, unwraps or removes nodes, attributes and classes on a node
44
4
  * list.
45
5
  *
46
- * @param {NodeList} nodeList The nodeList to filter.
47
- * @param {Document} doc The document of the nodeList.
48
- * @param {Schema} schema An array of functions that can mutate with the provided node.
49
- * @param {boolean} inline Whether to clean for inline mode.
6
+ * @param nodeList The nodeList to filter.
7
+ * @param doc The document of the nodeList.
8
+ * @param schema Schema for the HTML.
9
+ * @param inline Whether to clean for inline mode.
50
10
  */
51
11
  export default function cleanNodeList(nodeList: NodeList, doc: Document, schema: Schema, inline: boolean): void;
52
12
  //# sourceMappingURL=clean-node-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.js"],"names":[],"mappings":"AAUG,YAAS,UAAU,GACnB;;;;IAAiD,UAAU,AAA3D,CACA,EADW,MAAM,EAAE,CACnB;;;;IAAiD,OAAO,AAAxD,CACA,EADW,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAC9B;;;;IAAiD,QAAQ,AAAzD,CACA,EADW,GAAG,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAC9C;;;;IAAiD,OAAO,AAAxD,CACA,EADW,MAAM,EAAE,CACnB;;;;IAAgD,UAAU,EAA/C,OAAO,CAClB;;;;IAAiD,OAAO,AAAxD,CACF,EADa,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CACpC;CAAA,CAAA;AAEG,YAAyC,MAAM,GAArC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAQ;AAVnD;;;;;;;;GAQG;AAEH,sDAAsD;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,QAAQ,EALpC,QAKoC,EAAE,GAAG,EAJzC,QAIyC,EAAE,MAAM,EAHjD,MAGiD,EAAE,MAAM,EAFzD,OAEyD,QAkKnE"}
1
+ {"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACpC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,QAiKf"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Get the rectangle for the selection in a container.
3
3
  *
4
- * @param {Window} win The window of the selection.
4
+ * @param win The window of the selection.
5
5
  *
6
- * @return {DOMRect | null} The rectangle.
6
+ * @return The rectangle.
7
7
  */
8
8
  export default function computeCaretRect(win: Window): DOMRect | null;
9
9
  //# sourceMappingURL=compute-caret-rect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute-caret-rect.d.ts","sourceRoot":"","sources":["../../src/dom/compute-caret-rect.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,GAAG,EAJlC,MAIkC,GAFjC,OAAO,GAAG,IAAI,CAYzB"}
1
+ {"version":3,"file":"compute-caret-rect.d.ts","sourceRoot":"","sources":["../../src/dom/compute-caret-rect.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,GAAG,IAAI,CAUtE"}
@@ -2,9 +2,9 @@
2
2
  * Check whether the current document has a selection. This includes focus in
3
3
  * input fields, textareas, and general rich-text selection.
4
4
  *
5
- * @param {Document} doc The document to check.
5
+ * @param doc The document to check.
6
6
  *
7
- * @return {boolean} True if there is selection, false if not.
7
+ * @return True if there is selection, false if not.
8
8
  */
9
9
  export default function documentHasSelection(doc: Document): boolean;
10
10
  //# sourceMappingURL=document-has-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-has-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-selection.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,GAAG,EAJtC,QAIsC,GAFrC,OAAO,CASlB"}
1
+ {"version":3,"file":"document-has-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-selection.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,GAAG,EAAE,QAAQ,GAAI,OAAO,CAOrE"}
@@ -5,9 +5,9 @@
5
5
  *
6
6
  * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
7
7
  *
8
- * @param {Document} doc The document to check.
8
+ * @param doc The document to check.
9
9
  *
10
- * @return {boolean} True if there is selection, false if not.
10
+ * @return True if there is selection, false if not.
11
11
  */
12
12
  export default function documentHasTextSelection(doc: Document): boolean;
13
13
  //# sourceMappingURL=document-has-text-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-has-text-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-text-selection.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,GAAG,EAJ1C,QAI0C,GAFzC,OAAO,CAQlB"}
1
+ {"version":3,"file":"document-has-text-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-text-selection.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,GAAG,EAAE,QAAQ,GAAI,OAAO,CAMzE"}
@@ -3,9 +3,9 @@
3
3
  * This includes ranges of text across elements and any selection inside
4
4
  * textual `<input>` and `<textarea>` elements.
5
5
  *
6
- * @param {Document} doc The document to check.
6
+ * @param doc The document to check.
7
7
  *
8
- * @return {boolean} Whether there is any recognizable text selection in the document.
8
+ * @return Whether there is any recognizable text selection in the document.
9
9
  */
10
10
  export default function documentHasUncollapsedSelection(doc: Document): boolean;
11
11
  //# sourceMappingURL=document-has-uncollapsed-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-uncollapsed-selection.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAE,GAAG,EAJjD,QAIiD,GAFhD,OAAO,CAQlB"}
1
+ {"version":3,"file":"document-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-uncollapsed-selection.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,+BAA+B,CACtD,GAAG,EAAE,QAAQ,GACX,OAAO,CAMT"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @param {Element} element
3
- * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.
2
+ * @param element
3
+ * @return The computed style for the element.
4
4
  */
5
- export default function getComputedStyle(element: Element): ReturnType<Window['getComputedStyle']>;
5
+ export default function getComputedStyle(element: Element): CSSStyleDeclaration;
6
6
  //# sourceMappingURL=get-computed-style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-computed-style.d.ts","sourceRoot":"","sources":["../../src/dom/get-computed-style.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,OAAO,EAHtC,OAGsC,GAFrC,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAQjD"}
1
+ {"version":3,"file":"get-computed-style.d.ts","sourceRoot":"","sources":["../../src/dom/get-computed-style.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,OAAO,EAAE,OAAO,GACd,mBAAmB,CAMrB"}
@@ -5,9 +5,9 @@
5
5
  *
6
6
  * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent
7
7
  *
8
- * @param {Node} node Node from which to find offset parent.
8
+ * @param node Node from which to find offset parent.
9
9
  *
10
- * @return {Node | null} Offset parent.
10
+ * @return Offset parent.
11
11
  */
12
12
  export default function getOffsetParent(node: Node): Node | null;
13
13
  //# sourceMappingURL=get-offset-parent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-offset-parent.d.ts","sourceRoot":"","sources":["../../src/dom/get-offset-parent.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,IAAI,EAJlC,IAIkC,GAFjC,IAAI,GAAG,IAAI,CA4BtB"}
1
+ {"version":3,"file":"get-offset-parent.d.ts","sourceRoot":"","sources":["../../src/dom/get-offset-parent.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,IAAI,EAAE,IAAI,GAAI,IAAI,GAAG,IAAI,CAoBjE"}
@@ -2,8 +2,8 @@
2
2
  * Gets the height of the range without ignoring zero width rectangles, which
3
3
  * some browsers ignore when creating a union.
4
4
  *
5
- * @param {Range} range The range to check.
6
- * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.
5
+ * @param range The range to check.
6
+ * @return Height of the range or undefined if the range has no client rectangles.
7
7
  */
8
8
  export default function getRangeHeight(range: Range): number | undefined;
9
9
  //# sourceMappingURL=get-range-height.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-range-height.d.ts","sourceRoot":"","sources":["../../src/dom/get-range-height.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,KAAK,EAHlC,KAGkC,GAFjC,MAAM,GAAG,SAAS,CAa7B"}
1
+ {"version":3,"file":"get-range-height.d.ts","sourceRoot":"","sources":["../../src/dom/get-range-height.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,KAAK,EAAE,KAAK,GAAI,MAAM,GAAG,SAAS,CAWzE"}
@@ -3,9 +3,9 @@
3
3
  * can be found. Use instead of `Range.getBoundingClientRect()`, which is often
4
4
  * broken, especially for collapsed ranges.
5
5
  *
6
- * @param {Range} range The range.
6
+ * @param range The range.
7
7
  *
8
- * @return {DOMRect?} The rectangle.
8
+ * @return The rectangle.
9
9
  */
10
10
  export default function getRectangleFromRange(range: Range): DOMRect | null;
11
11
  //# sourceMappingURL=get-rectangle-from-range.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAE,KAAK,EAJzC,KAIyC,GAFxC,OAAO,OAAC,CAmKnB"}
1
+ {"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAE,KAAK,EAAE,KAAK,GAAI,OAAO,GAAG,IAAI,CA2J5E"}
@@ -2,10 +2,10 @@
2
2
  * Given a DOM node, finds the closest scrollable container node or the node
3
3
  * itself, if scrollable.
4
4
  *
5
- * @param {Element | null} node Node from which to start.
6
- * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').
7
- * Defaults to 'vertical'.
8
- * @return {Element | undefined} Scrollable container node, if found.
5
+ * @param node Node from which to start.
6
+ * @param direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').
7
+ * Defaults to 'vertical'.
8
+ * @return Scrollable container node, if found.
9
9
  */
10
- export default function getScrollContainer(node: Element | null, direction?: string | null): Element | undefined;
10
+ export default function getScrollContainer(node: Element | null, direction?: 'vertical' | 'horizontal' | 'all'): Element | undefined;
11
11
  //# sourceMappingURL=get-scroll-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-scroll-container.d.ts","sourceRoot":"","sources":["../../src/dom/get-scroll-container.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,IAAI,EALrC,OAAO,GAAG,IAK2B,EAAE,SAAS,GAJ/C,MAAM,OAIsD,GAF5D,OAAO,GAAG,SAAS,CAwC9B"}
1
+ {"version":3,"file":"get-scroll-container.d.ts","sourceRoot":"","sources":["../../src/dom/get-scroll-container.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACzC,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,SAAS,GAAE,UAAU,GAAG,YAAY,GAAG,KAAkB,GACvD,OAAO,GAAG,SAAS,CAmCrB"}
@@ -3,12 +3,12 @@
3
3
  * Gives the container a temporary high z-index (above any UI).
4
4
  * This is preferred over getting the UI nodes and set styles there.
5
5
  *
6
- * @param {Document} doc The document of the range.
7
- * @param {number} x Horizontal position within the current viewport.
8
- * @param {number} y Vertical position within the current viewport.
9
- * @param {HTMLElement} container Container in which the range is expected to be found.
6
+ * @param doc The document of the range.
7
+ * @param x Horizontal position within the current viewport.
8
+ * @param y Vertical position within the current viewport.
9
+ * @param container Container in which the range is expected to be found.
10
10
  *
11
- * @return {?Range} The best range for the given point.
11
+ * @return The best range for the given point.
12
12
  */
13
13
  export default function hiddenCaretRangeFromPoint(doc: Document, x: number, y: number, container: HTMLElement): Range | null;
14
14
  //# sourceMappingURL=hidden-caret-range-from-point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAE,GAAG,EAP3C,QAO2C,EAAE,CAAC,EAN9C,MAM8C,EAAE,CAAC,EALjD,MAKiD,EAAE,SAAS,EAJ5D,WAI4D,GAF1D,KAAK,OAAA,CA6BjB"}
1
+ {"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAChD,GAAG,EAAE,QAAQ,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,SAAS,EAAE,WAAW,GACpB,KAAK,GAAG,IAAI,CA2Bd"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dom/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -11,9 +11,9 @@
11
11
  *
12
12
  * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply
13
13
  *
14
- * @param {Element} element The HTML element.
14
+ * @param element The HTML element.
15
15
  *
16
- * @return {boolean} Whether the input/textarea element has some "selection".
16
+ * @return Whether the input/textarea element has some "selection".
17
17
  */
18
18
  export default function inputFieldHasUncollapsedSelection(element: Element): boolean;
19
19
  //# sourceMappingURL=input-field-has-uncollapsed-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CAAE,OAAO,EAJvD,OAIuD,GAFtD,OAAO,CA0BlB"}
1
+ {"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACxD,OAAO,EAAE,OAAO,GACd,OAAO,CAwBT"}
@@ -2,9 +2,8 @@
2
2
  * Given two DOM nodes, inserts the former in the DOM as the next sibling of
3
3
  * the latter.
4
4
  *
5
- * @param {Node} newNode Node to be inserted.
6
- * @param {Node} referenceNode Node after which to perform the insertion.
7
- * @return {void}
5
+ * @param newNode Node to be inserted.
6
+ * @param referenceNode Node after which to perform the insertion.
8
7
  */
9
8
  export default function insertAfter(newNode: Node, referenceNode: Node): void;
10
9
  //# sourceMappingURL=insert-after.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insert-after.d.ts","sourceRoot":"","sources":["../../src/dom/insert-after.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,OAAO,EAJjC,IAIiC,EAAE,aAAa,EAHhD,IAGgD,GAF/C,IAAI,CAKf"}
1
+ {"version":3,"file":"insert-after.d.ts","sourceRoot":"","sources":["../../src/dom/insert-after.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAClC,OAAO,EAAE,IAAI,EACb,aAAa,EAAE,IAAI,GACjB,IAAI,CAGN"}
@@ -3,11 +3,11 @@
3
3
  * horizontal position by default. Set `onlyVertical` to true to check only
4
4
  * vertically.
5
5
  *
6
- * @param {HTMLElement} container Focusable element.
7
- * @param {boolean} isReverse Set to true to check left, false to check right.
8
- * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
6
+ * @param container Focusable element.
7
+ * @param isReverse Set to true to check left, false to check right.
8
+ * @param onlyVertical Set to true to check only vertical position.
9
9
  *
10
- * @return {boolean} True if at the edge, false if not.
10
+ * @return True if at the edge, false if not.
11
11
  */
12
12
  export default function isEdge(container: HTMLElement, isReverse: boolean, onlyVertical?: boolean): boolean;
13
13
  //# sourceMappingURL=is-edge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,SAAS,EAN9B,WAM8B,EAAE,SAAS,EALzC,OAKyC,EAAE,YAAY,AAJ/D,CAEA,EAFQ,OAI+D,GAF9D,OAAO,CAmIlB"}
1
+ {"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC7B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,OAAO,EAClB,YAAY,GAAE,OAAe,GAC3B,OAAO,CAiIT"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-element.d.ts","sourceRoot":"","sources":["../../src/dom/is-element.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAH5B,IAAI,GAAG,IAAI,GAAG,SAGc,GAF3B,IAAI,IAAI,OAAO,CAI1B"}
1
+ {"version":3,"file":"is-element.d.ts","sourceRoot":"","sources":["../../src/dom/is-element.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAChC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAC3B,IAAI,IAAI,OAAO,CAEjB"}