@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,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/hidden-caret-range-from-point.js"],
4
- "sourcesContent": ["import caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\tconst originalBorderRadius = container.style.borderRadius;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\t// When an element has border radius, the x/y coordinates can incorrectly fall\n\t// outside the element because of the radius. Temporarily reset the value\n\t// to ensure the coordinates are tested against a rectangle and not a pill-shaped\n\t// element. See https://github.com/WordPress/gutenberg/issues/72053 for more info.\n\tcontainer.style.borderRadius = '0';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\tcontainer.style.borderRadius = originalBorderRadius;\n\n\treturn range;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAgC;AAChC,gCAA6B;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AACzC,QAAM,uBAAuB,UAAU,MAAM;AAE7C,QAAM,EAAE,WAAW,SAAS,QAAI,0BAAAA,SAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAMzB,YAAU,MAAM,eAAe;AAE/B,QAAM,YAAQ,8BAAAC,SAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAC3B,YAAU,MAAM,eAAe;AAE/B,SAAO;AACR;",
3
+ "sources": ["../../src/dom/hidden-caret-range-from-point.ts"],
4
+ "sourcesContent": ["import caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param doc The document of the range.\n * @param x Horizontal position within the current viewport.\n * @param y Vertical position within the current viewport.\n * @param container Container in which the range is expected to be found.\n *\n * @return The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint(\n\tdoc: Document,\n\tx: number,\n\ty: number,\n\tcontainer: HTMLElement\n): Range | null {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\tconst originalBorderRadius = container.style.borderRadius;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\t// When an element has border radius, the x/y coordinates can incorrectly fall\n\t// outside the element because of the radius. Temporarily reset the value\n\t// to ensure the coordinates are tested against a rectangle and not a pill-shaped\n\t// element. See https://github.com/WordPress/gutenberg/issues/72053 for more info.\n\tcontainer.style.borderRadius = '0';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\tcontainer.style.borderRadius = originalBorderRadius;\n\n\treturn range;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAgC;AAChC,gCAA6B;AAcd,SAAR,0BACN,KACA,GACA,GACA,WACe;AACf,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AACzC,QAAM,uBAAuB,UAAU,MAAM;AAE7C,QAAM,EAAE,WAAW,SAAS,QAAI,0BAAAA,SAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAMzB,YAAU,MAAM,eAAe;AAE/B,QAAM,YAAQ,8BAAAC,SAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAC3B,YAAU,MAAM,eAAe;AAE/B,SAAO;AACR;",
6
6
  "names": ["getComputedStyle", "caretRangeFromPoint"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/index.js
30
+ // packages/dom/src/dom/index.ts
31
31
  var dom_exports = {};
32
32
  __export(dom_exports, {
33
33
  __unstableStripHTML: () => import_strip_html.default,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/index.js"],
3
+ "sources": ["../../src/dom/index.ts"],
4
4
  "sourcesContent": ["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-html';\nexport { default as isSelectionForward } from './is-selection-forward';\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA4C;AAC5C,yCAAoD;AACpD,gDAA2D;AAC3D,oCAAgD;AAChD,sCAAiD;AACjD,kCAA8C;AAC9C,+BAA2C;AAC3C,kCAA8C;AAC9C,6BAAyC;AACzC,gCAA4C;AAC5C,6BAAyC;AACzC,2BAAuC;AACvC,8BAA0C;AAC1C,4CAAsD;AACtD,0CAAoD;AACpD,qBAAmC;AACnC,oBAAkC;AAClC,0BAAuC;AACvC,oBAAkC;AAClC,yBAAsC;AACtC,kBAAgC;AAChC,wBAA+C;AAC/C,sBAAmC;AACnC,iCAA6C;AAC7C,oBAAiC;AACjC,uBAAoC;AACpC,kCAA8C;",
6
6
  "names": []
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/input-field-has-uncollapsed-selection.js
30
+ // packages/dom/src/dom/input-field-has-uncollapsed-selection.ts
31
31
  var input_field_has_uncollapsed_selection_exports = {};
32
32
  __export(input_field_has_uncollapsed_selection_exports, {
33
33
  default: () => inputFieldHasUncollapsedSelection
@@ -40,10 +40,7 @@ function inputFieldHasUncollapsedSelection(element) {
40
40
  return false;
41
41
  }
42
42
  try {
43
- const { selectionStart, selectionEnd } = (
44
- /** @type {HTMLInputElement | HTMLTextAreaElement} */
45
- element
46
- );
43
+ const { selectionStart, selectionEnd } = element;
47
44
  return (
48
45
  // `null` means the input type doesn't implement selection, thus we
49
46
  // cannot determine whether the selection is collapsed, so we
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/input-field-has-uncollapsed-selection.js"],
4
- "sourcesContent": ["import isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textarea element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwB;AACxB,mCAA+B;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,KAAE,6BAAAA,SAAoB,OAAQ,KAAK,KAAE,qBAAAC,SAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,QAAQ;AAGP,WAAO;AAAA,EACR;AACD;",
3
+ "sources": ["../../src/dom/input-field-has-uncollapsed-selection.ts"],
4
+ "sourcesContent": ["import isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param element The HTML element.\n *\n * @return Whether the input/textarea element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection(\n\telement: Element\n): boolean {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } = element as\n\t\t\tHTMLInputElement | HTMLTextAreaElement;\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwB;AACxB,mCAA+B;AAmBhB,SAAR,kCACN,SACU;AACV,MAAK,KAAE,6BAAAA,SAAoB,OAAQ,KAAK,KAAE,qBAAAC,SAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa,IAAI;AAEzC;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,QAAQ;AAGP,WAAO;AAAA,EACR;AACD;",
6
6
  "names": ["isHTMLInputElement", "isTextField"]
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/insert-after.js
20
+ // packages/dom/src/dom/insert-after.ts
21
21
  var insert_after_exports = {};
22
22
  __export(insert_after_exports, {
23
23
  default: () => insertAfter
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/insert-after.js"],
4
- "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAUjB,SAAR,YAA8B,SAAS,eAAgB;AAC7D,gDAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,cAAc,WAAY;AAC3E;",
3
+ "sources": ["../../src/dom/insert-after.ts"],
4
+ "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param newNode Node to be inserted.\n * @param referenceNode Node after which to perform the insertion.\n */\nexport default function insertAfter(\n\tnewNode: Node,\n\treferenceNode: Node\n): void {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AASjB,SAAR,YACN,SACA,eACO;AACP,gDAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,cAAc,WAAY;AAC3E;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-edge.js
30
+ // packages/dom/src/dom/is-edge.ts
31
31
  var is_edge_exports = {};
32
32
  __export(is_edge_exports, {
33
33
  default: () => isEdge
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-edge.js"],
4
- "sourcesContent": ["import isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\n\t// The test point can only be hit-tested when it is within the viewport\n\t// (`caretRangeFromPoint` returns nothing for a point outside it, upon\n\t// which `scrollIfNoRange` scrolls the container's edge into view to\n\t// measure, e.g. on every arrow press within a container taller than the\n\t// viewport). When the edge is outside the viewport and the selection is\n\t// within it, they are at least a viewport boundary apart along that\n\t// axis, so the selection cannot be at the edge. Check each axis\n\t// separately: the vertical check must not be short-circuited by a\n\t// horizontally overflowing container, and vice versa.\n\tconst isFarFromVerticalEdge =\n\t\t( y < 0 || y > defaultView.innerHeight ) &&\n\t\trangeRect.top >= 0 &&\n\t\trangeRect.bottom <= defaultView.innerHeight;\n\tconst isFarFromHorizontalEdge =\n\t\t( x < 0 || x > defaultView.innerWidth ) &&\n\t\trangeRect.left >= 0 &&\n\t\trangeRect.right <= defaultView.innerWidth;\n\n\tif (\n\t\tisFarFromVerticalEdge ||\n\t\t( ! onlyVertical && isFarFromHorizontalEdge )\n\t) {\n\t\treturn false;\n\t}\n\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAkB;AAClB,8BAA2B;AAC3B,sCAAkC;AAClC,kCAA+B;AAC/B,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,gCAAgC;AAajB,SAAR,OAAyB,WAAW,WAAW,eAAe,OAAQ;AAC5E,UACC,6BAAAA,SAAmB,SAAU,KAC7B,OAAO,UAAU,mBAAmB,UACnC;AACD,QAAK,UAAU,mBAAmB,UAAU,cAAe;AAC1D,aAAO;AAAA,IACR;AAEA,QAAK,WAAY;AAChB,aAAO,UAAU,mBAAmB;AAAA,IACrC;AAEA,WAAO,UAAU,MAAM,WAAW,UAAU;AAAA,EAC7C;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AAExB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAE3C,MAAK,CAAE,aAAa,CAAE,UAAU,YAAa;AAC5C,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,UAAU,WAAY,CAAE;AACtC,QAAM,iBAAiB,MAAM,WAAW;AACxC,QAAM,gBAAY,4BAAAC,SAAoB,SAAU;AAChD,QAAM,cAAc,UAAU;AAG9B,MAAK,CAAE,aAAc;AACpB,mBAAe,SAAU,CAAE,SAAU;AAAA,EACtC;AAEA,QAAM,yBAAqB,gCAAAC,SAAuB,cAAe;AACjE,QAAM,gBAAY,gCAAAA,SAAuB,KAAM;AAE/C,MAAK,CAAE,sBAAsB,CAAE,WAAY;AAC1C,WAAO;AAAA,EACR;AAKA,QAAM,kBAAc,wBAAAC,SAAgB,KAAM;AAC1C,MACC,CAAE,eACF,eACA,cAAc,mBAAmB,UACjC,cAAc,WACb;AACD,WAAO;AAAA,EACR;AAGA,QAAM,mBAAe,cAAAC,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAYtD,QAAM,IAAI,eAAe,cAAc,OAAO,IAAI,cAAc,QAAQ;AACxE,QAAM,IAAI,YAAY,cAAc,MAAM,IAAI,cAAc,SAAS;AAWrE,QAAM,yBACH,IAAI,KAAK,IAAI,YAAY,gBAC3B,UAAU,OAAO,KACjB,UAAU,UAAU,YAAY;AACjC,QAAM,2BACH,IAAI,KAAK,IAAI,YAAY,eAC3B,UAAU,QAAQ,KAClB,UAAU,SAAS,YAAY;AAEhC,MACC,yBACE,CAAE,gBAAgB,yBACnB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,gBAAY;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,UACxD,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAAA,EAC3D;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,eAAW,gCAAAH,SAAuB,SAAU;AAElD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,eAAe,YAAY,QAAQ;AACzC,QAAM,iBAAiB,eAAe,SAAS;AAC/C,QAAM,eAAe,SAAU,YAAa,IAAI,UAAW,YAAa;AACxE,QAAM,iBACL,SAAU,cAAe,IAAI,mBAAoB,cAAe;AAGjE,QAAM,kBAAkB,KAAK,IAAK,YAAa,KAAK;AACpD,QAAM,oBAAoB,KAAK,IAAK,cAAe,KAAK;AAExD,SAAO,eACJ,kBACA,mBAAmB;AACvB;",
3
+ "sources": ["../../src/dom/is-edge.ts"],
4
+ "sourcesContent": ["import isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param container Focusable element.\n * @param isReverse Set to true to check left, false to check right.\n * @param onlyVertical Set to true to check only vertical position.\n *\n * @return True if at the edge, false if not.\n */\nexport default function isEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\tonlyVertical: boolean = false\n): boolean {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\n\t// The test point can only be hit-tested when it is within the viewport\n\t// (`caretRangeFromPoint` returns nothing for a point outside it, upon\n\t// which `scrollIfNoRange` scrolls the container's edge into view to\n\t// measure, e.g. on every arrow press within a container taller than the\n\t// viewport). When the edge is outside the viewport and the selection is\n\t// within it, they are at least a viewport boundary apart along that\n\t// axis, so the selection cannot be at the edge. Check each axis\n\t// separately: the vertical check must not be short-circuited by a\n\t// horizontally overflowing container, and vice versa.\n\tconst isFarFromVerticalEdge =\n\t\t( y < 0 || y > defaultView.innerHeight ) &&\n\t\trangeRect.top >= 0 &&\n\t\trangeRect.bottom <= defaultView.innerHeight;\n\tconst isFarFromHorizontalEdge =\n\t\t( x < 0 || x > defaultView.innerWidth ) &&\n\t\trangeRect.left >= 0 &&\n\t\trangeRect.right <= defaultView.innerWidth;\n\n\tif (\n\t\tisFarFromVerticalEdge ||\n\t\t( ! onlyVertical && isFarFromHorizontalEdge )\n\t) {\n\t\treturn false;\n\t}\n\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAkB;AAClB,8BAA2B;AAC3B,sCAAkC;AAClC,kCAA+B;AAC/B,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,gCAAgC;AAajB,SAAR,OACN,WACA,WACA,eAAwB,OACd;AACV,UACC,6BAAAA,SAAmB,SAAU,KAC7B,OAAO,UAAU,mBAAmB,UACnC;AACD,QAAK,UAAU,mBAAmB,UAAU,cAAe;AAC1D,aAAO;AAAA,IACR;AAEA,QAAK,WAAY;AAChB,aAAO,UAAU,mBAAmB;AAAA,IACrC;AAEA,WAAO,UAAU,MAAM,WAAW,UAAU;AAAA,EAC7C;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AAExB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAE3C,MAAK,CAAE,aAAa,CAAE,UAAU,YAAa;AAC5C,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,UAAU,WAAY,CAAE;AACtC,QAAM,iBAAiB,MAAM,WAAW;AACxC,QAAM,gBAAY,4BAAAC,SAAoB,SAAU;AAChD,QAAM,cAAc,UAAU;AAG9B,MAAK,CAAE,aAAc;AACpB,mBAAe,SAAU,CAAE,SAAU;AAAA,EACtC;AAEA,QAAM,yBAAqB,gCAAAC,SAAuB,cAAe;AACjE,QAAM,gBAAY,gCAAAA,SAAuB,KAAM;AAE/C,MAAK,CAAE,sBAAsB,CAAE,WAAY;AAC1C,WAAO;AAAA,EACR;AAKA,QAAM,kBAAc,wBAAAC,SAAgB,KAAM;AAC1C,MACC,CAAE,eACF,eACA,cAAc,mBAAmB,UACjC,cAAc,WACb;AACD,WAAO;AAAA,EACR;AAGA,QAAM,mBAAe,cAAAC,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAYtD,QAAM,IAAI,eAAe,cAAc,OAAO,IAAI,cAAc,QAAQ;AACxE,QAAM,IAAI,YAAY,cAAc,MAAM,IAAI,cAAc,SAAS;AAWrE,QAAM,yBACH,IAAI,KAAK,IAAI,YAAY,gBAC3B,UAAU,OAAO,KACjB,UAAU,UAAU,YAAY;AACjC,QAAM,2BACH,IAAI,KAAK,IAAI,YAAY,eAC3B,UAAU,QAAQ,KAClB,UAAU,SAAS,YAAY;AAEhC,MACC,yBACE,CAAE,gBAAgB,yBACnB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,gBAAY;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,UACxD,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAAA,EAC3D;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,eAAW,gCAAAH,SAAuB,SAAU;AAElD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,eAAe,YAAY,QAAQ;AACzC,QAAM,iBAAiB,eAAe,SAAS;AAC/C,QAAM,eAAe,SAAU,YAAa,IAAI,UAAW,YAAa;AACxE,QAAM,iBACL,SAAU,cAAe,IAAI,mBAAoB,cAAe;AAGjE,QAAM,kBAAkB,KAAK,IAAK,YAAa,KAAK;AACpD,QAAM,oBAAoB,KAAK,IAAK,cAAe,KAAK;AAExD,SAAO,eACJ,kBACA,mBAAmB;AACvB;",
6
6
  "names": ["isInputOrTextArea", "isSelectionForward", "getRectangleFromRange", "getRangeHeight", "isRTL", "hiddenCaretRangeFromPoint"]
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/is-element.js
20
+ // packages/dom/src/dom/is-element.ts
21
21
  var is_element_exports = {};
22
22
  __export(is_element_exports, {
23
23
  default: () => isElement
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-element.js"],
4
- "sourcesContent": ["/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,UAA4B,MAAO;AACzC,SAAO,CAAC,CAAE,QAAQ,KAAK,aAAa,KAAK;AAC1C;",
3
+ "sources": ["../../src/dom/is-element.ts"],
4
+ "sourcesContent": ["/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement(\n\tnode: Node | null | undefined\n): node is Element {\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,UACN,MACkB;AAClB,SAAO,CAAC,CAAE,QAAQ,KAAK,aAAa,KAAK;AAC1C;",
6
6
  "names": []
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/is-empty.js
20
+ // packages/dom/src/dom/is-empty.ts
21
21
  var is_empty_exports = {};
22
22
  __export(is_empty_exports, {
23
23
  default: () => isEmpty
@@ -33,10 +33,7 @@ function isEmpty(element) {
33
33
  } else if (!element.hasChildNodes()) {
34
34
  return true;
35
35
  }
36
- return (
37
- /** @type {Element[]} */
38
- Array.from(element.childNodes).every(isEmpty)
39
- );
36
+ return Array.from(element.childNodes).every(isEmpty);
40
37
  default:
41
38
  return true;
42
39
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-empty.js"],
4
- "sourcesContent": ["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,QAA0B,SAAU;AAC1C,UAAS,QAAQ,UAAW;AAAA,IAC3B,KAAK,QAAQ;AAGZ,aAAO,yBAAyB,KAAM,QAAQ,aAAa,EAAG;AAAA,IAC/D,KAAK,QAAQ;AACZ,UAAK,QAAQ,cAAc,GAAI;AAC9B,eAAO;AAAA,MACR,WAAY,CAAE,QAAQ,cAAc,GAAI;AACvC,eAAO;AAAA,MACR;AAEA;AAAA;AAAA,QACC,MAAM,KAAM,QAAQ,UAAW,EAC9B,MAAO,OAAQ;AAAA;AAAA,IAClB;AACC,aAAO;AAAA,EACT;AACD;",
3
+ "sources": ["../../src/dom/is-empty.ts"],
4
+ "sourcesContent": ["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param element The element to check.\n *\n * @return Whether or not the element is empty.\n */\nexport default function isEmpty( element: Node ): boolean {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( ( element as Element ).hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn Array.from( element.childNodes ).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,QAA0B,SAAyB;AACzD,UAAS,QAAQ,UAAW;AAAA,IAC3B,KAAK,QAAQ;AAGZ,aAAO,yBAAyB,KAAM,QAAQ,aAAa,EAAG;AAAA,IAC/D,KAAK,QAAQ;AACZ,UAAO,QAAqB,cAAc,GAAI;AAC7C,eAAO;AAAA,MACR,WAAY,CAAE,QAAQ,cAAc,GAAI;AACvC,eAAO;AAAA,MACR;AAEA,aAAO,MAAM,KAAM,QAAQ,UAAW,EAAE,MAAO,OAAQ;AAAA,IACxD;AACC,aAAO;AAAA,EACT;AACD;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-entirely-selected.js
30
+ // packages/dom/src/dom/is-entirely-selected.ts
31
31
  var is_entirely_selected_exports = {};
32
32
  __export(is_entirely_selected_exports, {
33
33
  default: () => isEntirelySelected
@@ -62,10 +62,7 @@ function isEntirelySelected(element) {
62
62
  }
63
63
  const lastChild = element.lastChild;
64
64
  (0, import_assert_is_defined.assertIsDefined)(lastChild, "lastChild");
65
- const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? (
66
- /** @type {Text} */
67
- endContainer.data.length
68
- ) : endContainer.childNodes.length;
65
+ const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? endContainer.data.length : endContainer.childNodes.length;
69
66
  return isDeepChild(startContainer, element, "firstChild") && isDeepChild(endContainer, element, "lastChild") && startOffset === 0 && endOffset === endContainerContentLength;
70
67
  }
71
68
  function isDeepChild(query, container, propName) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-entirely-selected.js"],
4
- "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Zero width non-breaking space, used as padding in the editable DOM tree when\n * it is empty otherwise.\n */\nconst ZWNBSP = '\\ufeff';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\t// If the element is effectively empty (contains only the ZWNBSP\n\t// placeholder or nothing), consider it entirely selected since there's\n\t// nothing meaningful to select.\n\tconst text = element.textContent || '';\n\tif ( text === '' || text === ZWNBSP ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t\t// There may be empty text nodes between the first/last child, so ignore\n\t\t// them.\n\t\twhile (\n\t\t\tcandidate &&\n\t\t\tcandidate.nodeType === candidate.TEXT_NODE &&\n\t\t\tcandidate.nodeValue === ''\n\t\t) {\n\t\t\tcandidate =\n\t\t\t\tcandidate[\n\t\t\t\t\tpropName === 'lastChild' ? 'previousSibling' : 'nextSibling'\n\t\t\t\t];\n\t\t}\n\t} while ( candidate );\n\treturn false;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAChC,mCAA8B;AAM9B,IAAM,SAAS;AAUA,SAAR,mBAAqC,SAAU;AACrD,UAAK,6BAAAA,SAAmB,OAAQ,GAAI;AACnC,WACC,QAAQ,mBAAmB,KAC3B,QAAQ,MAAM,WAAW,QAAQ;AAAA,EAEnC;AAEA,MAAK,CAAE,QAAQ,mBAAoB;AAClC,WAAO;AAAA,EACR;AAKA,QAAM,OAAO,QAAQ,eAAe;AACpC,MAAK,SAAS,MAAM,SAAS,QAAS;AACrC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AAEjE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,gBAAgB,cAAc,aAAa,UAAU,IAAI;AAEjE,MACC,mBAAmB,WACnB,iBAAiB,WACjB,gBAAgB,KAChB,cAAc,QAAQ,WAAW,QAChC;AACD,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,QAAQ;AAC1B,gDAAiB,WAAW,WAAY;AACxC,QAAM,4BACL,aAAa,aAAa,aAAa;AAAA;AAAA,IACd,aAAe,KAAK;AAAA,MAC1C,aAAa,WAAW;AAE5B,SACC,YAAa,gBAAgB,SAAS,YAAa,KACnD,YAAa,cAAc,SAAS,WAAY,KAChD,gBAAgB,KAChB,cAAc;AAEhB;AAYA,SAAS,YAAa,OAAO,WAAW,UAAW;AAElD,MAAI,YAAY;AAChB,KAAG;AACF,QAAK,UAAU,WAAY;AAC1B,aAAO;AAAA,IACR;AACA,gBAAY,UAAW,QAAS;AAGhC,WACC,aACA,UAAU,aAAa,UAAU,aACjC,UAAU,cAAc,IACvB;AACD,kBACC,UACC,aAAa,cAAc,oBAAoB,aAChD;AAAA,IACF;AAAA,EACD,SAAU;AACV,SAAO;AACR;",
3
+ "sources": ["../../src/dom/is-entirely-selected.ts"],
4
+ "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Zero width non-breaking space, used as padding in the editable DOM tree when\n * it is empty otherwise.\n */\nconst ZWNBSP = '\\ufeff';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param element The element to check.\n *\n * @return True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element: HTMLElement ): boolean {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\t// If the element is effectively empty (contains only the ZWNBSP\n\t// placeholder or nothing), consider it entirely selected since there's\n\t// nothing meaningful to select.\n\tconst text = element.textContent || '';\n\tif ( text === '' || text === ZWNBSP ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? ( endContainer as Text ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param query The element to check.\n * @param container The container that we suspect \"query\" may be a first or last child of.\n * @param propName \"firstChild\" or \"lastChild\"\n *\n * @return True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild(\n\tquery: HTMLElement | Node,\n\tcontainer: HTMLElement,\n\tpropName: 'firstChild' | 'lastChild'\n): boolean {\n\tlet candidate: HTMLElement | ChildNode | null = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t\t// There may be empty text nodes between the first/last child, so ignore\n\t\t// them.\n\t\twhile (\n\t\t\tcandidate &&\n\t\t\tcandidate.nodeType === candidate.TEXT_NODE &&\n\t\t\tcandidate.nodeValue === ''\n\t\t) {\n\t\t\tcandidate =\n\t\t\t\tcandidate[\n\t\t\t\t\tpropName === 'lastChild' ? 'previousSibling' : 'nextSibling'\n\t\t\t\t];\n\t\t}\n\t} while ( candidate );\n\treturn false;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAChC,mCAA8B;AAM9B,IAAM,SAAS;AAUA,SAAR,mBAAqC,SAAgC;AAC3E,UAAK,6BAAAA,SAAmB,OAAQ,GAAI;AACnC,WACC,QAAQ,mBAAmB,KAC3B,QAAQ,MAAM,WAAW,QAAQ;AAAA,EAEnC;AAEA,MAAK,CAAE,QAAQ,mBAAoB;AAClC,WAAO;AAAA,EACR;AAKA,QAAM,OAAO,QAAQ,eAAe;AACpC,MAAK,SAAS,MAAM,SAAS,QAAS;AACrC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AAEjE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,gBAAgB,cAAc,aAAa,UAAU,IAAI;AAEjE,MACC,mBAAmB,WACnB,iBAAiB,WACjB,gBAAgB,KAChB,cAAc,QAAQ,WAAW,QAChC;AACD,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,QAAQ;AAC1B,gDAAiB,WAAW,WAAY;AACxC,QAAM,4BACL,aAAa,aAAa,aAAa,YAClC,aAAuB,KAAK,SAC9B,aAAa,WAAW;AAE5B,SACC,YAAa,gBAAgB,SAAS,YAAa,KACnD,YAAa,cAAc,SAAS,WAAY,KAChD,gBAAgB,KAChB,cAAc;AAEhB;AAYA,SAAS,YACR,OACA,WACA,UACU;AACV,MAAI,YAA4C;AAChD,KAAG;AACF,QAAK,UAAU,WAAY;AAC1B,aAAO;AAAA,IACR;AACA,gBAAY,UAAW,QAAS;AAGhC,WACC,aACA,UAAU,aAAa,UAAU,aACjC,UAAU,cAAc,IACvB;AACD,kBACC,UACC,aAAa,cAAc,oBAAoB,aAChD;AAAA,IACF;AAAA,EACD,SAAU;AACV,SAAO;AACR;",
6
6
  "names": ["isInputOrTextArea"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-form-element.js
30
+ // packages/dom/src/dom/is-form-element.ts
31
31
  var is_form_element_exports = {};
32
32
  __export(is_form_element_exports, {
33
33
  default: () => isFormElement
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-form-element.js"],
4
- "sourcesContent": ["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA8B;AAUf,SAAR,cAAgC,SAAU;AAChD,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,4BAAwB,6BAAAA,SAAmB,OAAQ;AACzD,SACC,yBAAyB,YAAY,YAAY,YAAY;AAE/D;",
3
+ "sources": ["../../src/dom/is-form-element.ts"],
4
+ "sourcesContent": ["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param element The element to check.\n *\n * @return True if form element and false otherwise.\n */\nexport default function isFormElement(\n\telement: Element | null | undefined\n): boolean {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA8B;AAUf,SAAR,cACN,SACU;AACV,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,4BAAwB,6BAAAA,SAAmB,OAAQ;AACzD,SACC,yBAAyB,YAAY,YAAY,YAAY;AAE/D;",
6
6
  "names": ["isInputOrTextArea"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-horizontal-edge.js
30
+ // packages/dom/src/dom/is-horizontal-edge.ts
31
31
  var is_horizontal_edge_exports = {};
32
32
  __export(is_horizontal_edge_exports, {
33
33
  default: () => isHorizontalEdge
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-horizontal-edge.js"],
4
- "sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AAUJ,SAAR,iBAAmC,WAAW,WAAY;AAChE,aAAO,eAAAA,SAAQ,WAAW,SAAU;AACrC;",
3
+ "sources": ["../../src/dom/is-horizontal-edge.ts"],
4
+ "sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AAUJ,SAAR,iBACN,WACA,WACU;AACV,aAAO,eAAAA,SAAQ,WAAW,SAAU;AACrC;",
6
6
  "names": ["isEdge"]
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/is-html-input-element.js
20
+ // packages/dom/src/dom/is-html-input-element.ts
21
21
  var is_html_input_element_exports = {};
22
22
  __export(is_html_input_element_exports, {
23
23
  default: () => isHTMLInputElement
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-html-input-element.js"],
4
- "sourcesContent": ["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\treturn node?.nodeName === 'INPUT';\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,mBAAqC,MAAO;AAClD,SAAO,MAAM,aAAa;AAC3B;",
3
+ "sources": ["../../src/dom/is-html-input-element.ts"],
4
+ "sourcesContent": ["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement(\n\tnode: Node | null | undefined\n): node is HTMLInputElement {\n\treturn node?.nodeName === 'INPUT';\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,mBACN,MAC2B;AAC3B,SAAO,MAAM,aAAa;AAC3B;",
6
6
  "names": []
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/is-input-or-text-area.js
20
+ // packages/dom/src/dom/is-input-or-text-area.ts
21
21
  var is_input_or_text_area_exports = {};
22
22
  __export(is_input_or_text_area_exports, {
23
23
  default: () => isInputOrTextArea
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-input-or-text-area.js"],
4
- "sourcesContent": ["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,kBAAoC,SAAU;AACpD,SAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D;",
3
+ "sources": ["../../src/dom/is-input-or-text-area.ts"],
4
+ "sourcesContent": ["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea(\n\telement: Element\n): element is HTMLInputElement | HTMLTextAreaElement {\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,kBACN,SACoD;AACpD,SAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-number-input.js
30
+ // packages/dom/src/dom/is-number-input.ts
31
31
  var is_number_input_exports = {};
32
32
  __export(is_number_input_exports, {
33
33
  default: () => isNumberInput
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-number-input.js"],
4
- "sourcesContent": ["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuB;AACvB,mCAA+B;AAShB,SAAR,cAAgC,MAAO;AAC7C,wBAAAA,SAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACF,aACC,6BAAAC,SAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B;",
3
+ "sources": ["../../src/dom/is-number-input.ts"],
4
+ "sourcesContent": ["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param node The HTML node.\n *\n * @return True if the node is number input.\n */\nexport default function isNumberInput( node: Node ): node is HTMLInputElement {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuB;AACvB,mCAA+B;AAShB,SAAR,cAAgC,MAAuC;AAC7E,wBAAAA,SAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACF,aACC,6BAAAC,SAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B;",
6
6
  "names": ["deprecated", "isHTMLInputElement"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-rtl.js
30
+ // packages/dom/src/dom/is-rtl.ts
31
31
  var is_rtl_exports = {};
32
32
  __export(is_rtl_exports, {
33
33
  default: () => isRTL
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-rtl.js"],
4
- "sourcesContent": ["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA6B;AASd,SAAR,MAAwB,SAAU;AACxC,aAAO,0BAAAA,SAAkB,OAAQ,EAAE,cAAc;AAClD;",
3
+ "sources": ["../../src/dom/is-rtl.ts"],
4
+ "sourcesContent": ["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param element The element to check.\n *\n * @return True if rtl, false if ltr.\n */\nexport default function isRTL( element: Element ): boolean {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA6B;AASd,SAAR,MAAwB,SAA4B;AAC1D,aAAO,0BAAAA,SAAkB,OAAQ,EAAE,cAAc;AAClD;",
6
6
  "names": ["getComputedStyle"]
7
7
  }
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/dom/src/dom/is-selection-forward.js
20
+ // packages/dom/src/dom/is-selection-forward.ts
21
21
  var is_selection_forward_exports = {};
22
22
  __export(is_selection_forward_exports, {
23
23
  default: () => isSelectionForward
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-selection-forward.js"],
4
- "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAYjB,SAAR,mBAAqC,WAAY;AACvD,QAAM,EAAE,YAAY,WAAW,cAAc,YAAY,IAAI;AAE7D,gDAAiB,YAAY,YAAa;AAC1C,gDAAiB,WAAW,WAAY;AACxC,QAAM,WAAW,WAAW,wBAAyB,SAAU;AAO/D,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAEA,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAKA,MAAK,aAAa,GAAI;AACrB,WAAO,gBAAgB;AAAA,EACxB;AAGA,SAAO;AACR;",
3
+ "sources": ["../../src/dom/is-selection-forward.ts"],
4
+ "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param selection Selection object to check.\n *\n * @return Whether the selection is forward.\n */\nexport default function isSelectionForward( selection: Selection ): boolean {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAYjB,SAAR,mBAAqC,WAAgC;AAC3E,QAAM,EAAE,YAAY,WAAW,cAAc,YAAY,IAAI;AAE7D,gDAAiB,YAAY,YAAa;AAC1C,gDAAiB,WAAW,WAAY;AACxC,QAAM,WAAW,WAAW,wBAAyB,SAAU;AAO/D,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAEA,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAKA,MAAK,aAAa,GAAI;AACrB,WAAO,gBAAgB;AAAA,EACxB;AAGA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-text-field.js
30
+ // packages/dom/src/dom/is-text-field.ts
31
31
  var is_text_field_exports = {};
32
32
  __export(is_text_field_exports, {
33
33
  default: () => isTextField
@@ -49,7 +49,6 @@ function isTextField(node) {
49
49
  "email",
50
50
  "time"
51
51
  ];
52
- return (0, import_is_html_input_element.default)(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" || /** @type {HTMLElement} */
53
- node.contentEditable === "true";
52
+ return (0, import_is_html_input_element.default)(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" || node.contentEditable === "true";
54
53
  }
55
54
  //# sourceMappingURL=is-text-field.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-text-field.js"],
4
- "sourcesContent": ["import isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA+B;AAWhB,SAAR,YAA8B,MAAO;AAC3C,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,aACG,6BAAAA,SAAoB,IAAK,KAC1B,KAAK,QACL,CAAE,cAAc,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa;AAAA,EACW,KAAO,oBAAoB;AAE1D;",
3
+ "sources": ["../../src/dom/is-text-field.ts"],
4
+ "sourcesContent": ["import isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param node The HTML element.\n * @return True if the element is an text field, false if not.\n */\nexport default function isTextField( node: Node ): node is HTMLElement {\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t( node as HTMLElement ).contentEditable === 'true'\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA+B;AAWhB,SAAR,YAA8B,MAAkC;AACtE,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,aACG,6BAAAA,SAAoB,IAAK,KAC1B,KAAK,QACL,CAAE,cAAc,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa,cAChB,KAAsB,oBAAoB;AAE9C;",
6
6
  "names": ["isHTMLInputElement"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/is-vertical-edge.js
30
+ // packages/dom/src/dom/is-vertical-edge.ts
31
31
  var is_vertical_edge_exports = {};
32
32
  __export(is_vertical_edge_exports, {
33
33
  default: () => isVerticalEdge
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/is-vertical-edge.js"],
4
- "sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AAUJ,SAAR,eAAiC,WAAW,WAAY;AAC9D,aAAO,eAAAA,SAAQ,WAAW,WAAW,IAAK;AAC3C;",
3
+ "sources": ["../../src/dom/is-vertical-edge.ts"],
4
+ "sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse, true );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AAUJ,SAAR,eACN,WACA,WACU;AACV,aAAO,eAAAA,SAAQ,WAAW,WAAW,IAAK;AAC3C;",
6
6
  "names": ["isEdge"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/place-caret-at-edge.js
30
+ // packages/dom/src/dom/place-caret-at-edge.ts
31
31
  var place_caret_at_edge_exports = {};
32
32
  __export(place_caret_at_edge_exports, {
33
33
  default: () => placeCaretAtEdge
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/dom/place-caret-at-edge.js"],
4
- "sourcesContent": ["import hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// Only place a caret if the container is itself an editable element.\n\t// It may also be content editable by inheriting it from an editing\n\t// host ancestor (e.g. an editable canvas wrapper), but placing a caret\n\t// for e.g. a focusable block element is then not intended.\n\tif ( container.contentEditable !== 'true' ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,oBAAkB;AAClB,gCAAgC;AAWhC,SAAS,SAAU,WAAW,WAAW,GAAI;AAC5C,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,mBAAe,cAAAA,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAKtD,MAAK,MAAM,QAAY;AACtB,QAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;AAAA,EAChE,WAAY,KAAK,cAAc,MAAO;AACrC,QAAI,cAAc,OAAO;AAAA,EAC1B,WAAY,KAAK,cAAc,OAAQ;AACtC,QAAI,cAAc,QAAQ;AAAA,EAC3B;AACA,QAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;AACxE,aAAO,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;AASe,SAAR,iBAAmC,WAAW,WAAW,GAAI;AACnE,MAAK,CAAE,WAAY;AAClB;AAAA,EACD;AAEA,YAAU,MAAM;AAEhB,UAAK,6BAAAC,SAAmB,SAAU,GAAI;AAErC,QAAK,OAAO,UAAU,mBAAmB,UAAW;AACnD;AAAA,IACD;AAEA,QAAK,WAAY;AAChB,gBAAU,iBAAiB,UAAU,MAAM;AAC3C,gBAAU,eAAe,UAAU,MAAM;AAAA,IAC1C,OAAO;AACN,gBAAU,iBAAiB;AAC3B,gBAAU,eAAe;AAAA,IAC1B;AAEA;AAAA,EACD;AAMA,MAAK,UAAU,oBAAoB,QAAS;AAC3C;AAAA,EACD;AAEA,QAAM,YAAQ;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACpD,SAAU,WAAW,WAAW,CAAE;AAAA,EACnC;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;",
3
+ "sources": ["../../src/dom/place-caret-at-edge.ts"],
4
+ "sourcesContent": ["import hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param container Focusable element.\n * @param isReverse True for end, false for start.\n * @param x X coordinate to vertically position.\n *\n * @return The range to place.\n */\nfunction getRange(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\tx: number | undefined\n): Range | null {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param container Focusable element.\n * @param isReverse True for end, false for start.\n * @param x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\tx: number | undefined\n) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// Only place a caret if the container is itself an editable element.\n\t// It may also be content editable by inheriting it from an editing\n\t// host ancestor (e.g. an editable canvas wrapper), but placing a caret\n\t// for e.g. a focusable block element is then not intended.\n\tif ( container.contentEditable !== 'true' ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,oBAAkB;AAClB,gCAAgC;AAWhC,SAAS,SACR,WACA,WACA,GACe;AACf,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,mBAAe,cAAAA,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAKtD,MAAK,MAAM,QAAY;AACtB,QAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;AAAA,EAChE,WAAY,KAAK,cAAc,MAAO;AACrC,QAAI,cAAc,OAAO;AAAA,EAC1B,WAAY,KAAK,cAAc,OAAQ;AACtC,QAAI,cAAc,QAAQ;AAAA,EAC3B;AACA,QAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;AACxE,aAAO,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;AASe,SAAR,iBACN,WACA,WACA,GACC;AACD,MAAK,CAAE,WAAY;AAClB;AAAA,EACD;AAEA,YAAU,MAAM;AAEhB,UAAK,6BAAAC,SAAmB,SAAU,GAAI;AAErC,QAAK,OAAO,UAAU,mBAAmB,UAAW;AACnD;AAAA,IACD;AAEA,QAAK,WAAY;AAChB,gBAAU,iBAAiB,UAAU,MAAM;AAC3C,gBAAU,eAAe,UAAU,MAAM;AAAA,IAC1C,OAAO;AACN,gBAAU,iBAAiB;AAC3B,gBAAU,eAAe;AAAA,IAC1B;AAEA;AAAA,EACD;AAMA,MAAK,UAAU,oBAAoB,QAAS;AAC3C;AAAA,EACD;AAEA,QAAM,YAAQ;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACpD,SAAU,WAAW,WAAW,CAAE;AAAA,EACnC;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;",
6
6
  "names": ["isRTL", "hiddenCaretRangeFromPoint", "isInputOrTextArea"]
7
7
  }
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/dom/src/dom/place-caret-at-horizontal-edge.js
30
+ // packages/dom/src/dom/place-caret-at-horizontal-edge.ts
31
31
  var place_caret_at_horizontal_edge_exports = {};
32
32
  __export(place_caret_at_horizontal_edge_exports, {
33
33
  default: () => placeCaretAtHorizontalEdge