@wordpress/dom 4.57.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/README.md +23 -23
  2. package/build/data-transfer.cjs +20 -38
  3. package/build/data-transfer.cjs.map +1 -7
  4. package/build/dom/caret-range-from-point.cjs +31 -38
  5. package/build/dom/caret-range-from-point.cjs.map +1 -7
  6. package/build/dom/clean-node-list.cjs +88 -133
  7. package/build/dom/clean-node-list.cjs.map +1 -7
  8. package/build/dom/compute-caret-rect.cjs +36 -36
  9. package/build/dom/compute-caret-rect.cjs.map +1 -7
  10. package/build/dom/document-has-selection.cjs +36 -31
  11. package/build/dom/document-has-selection.cjs.map +1 -7
  12. package/build/dom/document-has-text-selection.cjs +24 -30
  13. package/build/dom/document-has-text-selection.cjs.map +1 -7
  14. package/build/dom/document-has-uncollapsed-selection.cjs +35 -30
  15. package/build/dom/document-has-uncollapsed-selection.cjs.map +1 -7
  16. package/build/dom/get-computed-style.cjs +14 -30
  17. package/build/dom/get-computed-style.cjs.map +1 -7
  18. package/build/dom/get-offset-parent.cjs +41 -48
  19. package/build/dom/get-offset-parent.cjs.map +1 -7
  20. package/build/dom/get-range-height.cjs +18 -31
  21. package/build/dom/get-range-height.cjs.map +1 -7
  22. package/build/dom/get-rectangle-from-range.cjs +82 -133
  23. package/build/dom/get-rectangle-from-range.cjs.map +1 -7
  24. package/build/dom/get-scroll-container.cjs +47 -55
  25. package/build/dom/get-scroll-container.cjs.map +1 -7
  26. package/build/dom/hidden-caret-range-from-point.cjs +49 -43
  27. package/build/dom/hidden-caret-range-from-point.cjs.map +1 -7
  28. package/build/dom/index.cjs +233 -110
  29. package/build/dom/input-field-has-uncollapsed-selection.cjs +49 -47
  30. package/build/dom/input-field-has-uncollapsed-selection.cjs.map +1 -7
  31. package/build/dom/insert-after.cjs +17 -27
  32. package/build/dom/insert-after.cjs.map +1 -7
  33. package/build/dom/is-edge.cjs +83 -98
  34. package/build/dom/is-edge.cjs.map +1 -7
  35. package/build/dom/is-element.cjs +12 -25
  36. package/build/dom/is-element.cjs.map +1 -7
  37. package/build/dom/is-empty.cjs +23 -40
  38. package/build/dom/is-empty.cjs.map +1 -7
  39. package/build/dom/is-entirely-selected.cjs +71 -71
  40. package/build/dom/is-entirely-selected.cjs.map +1 -7
  41. package/build/dom/is-form-element.cjs +34 -34
  42. package/build/dom/is-form-element.cjs.map +1 -7
  43. package/build/dom/is-horizontal-edge.cjs +32 -29
  44. package/build/dom/is-horizontal-edge.cjs.map +1 -7
  45. package/build/dom/is-html-input-element.cjs +12 -25
  46. package/build/dom/is-html-input-element.cjs.map +1 -7
  47. package/build/dom/is-input-or-text-area.cjs +12 -25
  48. package/build/dom/is-input-or-text-area.cjs.map +1 -7
  49. package/build/dom/is-number-input.cjs +37 -34
  50. package/build/dom/is-number-input.cjs.map +1 -7
  51. package/build/dom/is-rtl.cjs +31 -29
  52. package/build/dom/is-rtl.cjs.map +1 -7
  53. package/build/dom/is-selection-forward.cjs +26 -39
  54. package/build/dom/is-selection-forward.cjs.map +1 -7
  55. package/build/dom/is-text-field.cjs +46 -44
  56. package/build/dom/is-text-field.cjs.map +1 -7
  57. package/build/dom/is-vertical-edge.cjs +32 -29
  58. package/build/dom/is-vertical-edge.cjs.map +1 -7
  59. package/build/dom/place-caret-at-edge.cjs +76 -79
  60. package/build/dom/place-caret-at-edge.cjs.map +1 -7
  61. package/build/dom/place-caret-at-horizontal-edge.cjs +30 -29
  62. package/build/dom/place-caret-at-horizontal-edge.cjs.map +1 -7
  63. package/build/dom/place-caret-at-vertical-edge.cjs +31 -29
  64. package/build/dom/place-caret-at-vertical-edge.cjs.map +1 -7
  65. package/build/dom/remove-invalid-html.cjs +36 -32
  66. package/build/dom/remove-invalid-html.cjs.map +1 -7
  67. package/build/dom/remove.cjs +15 -27
  68. package/build/dom/remove.cjs.map +1 -7
  69. package/build/dom/replace-tag.cjs +21 -32
  70. package/build/dom/replace-tag.cjs.map +1 -7
  71. package/build/dom/replace.cjs +35 -33
  72. package/build/dom/replace.cjs.map +1 -7
  73. package/build/dom/safe-html.cjs +46 -47
  74. package/build/dom/safe-html.cjs.map +1 -7
  75. package/build/dom/scroll-if-no-range.cjs +24 -37
  76. package/build/dom/scroll-if-no-range.cjs.map +1 -7
  77. package/build/dom/strip-html.cjs +34 -32
  78. package/build/dom/strip-html.cjs.map +1 -7
  79. package/build/dom/types.cjs +5 -0
  80. package/build/dom/unwrap.cjs +17 -31
  81. package/build/dom/unwrap.cjs.map +1 -7
  82. package/build/dom/wrap.cjs +17 -28
  83. package/build/dom/wrap.cjs.map +1 -7
  84. package/build/focusable.cjs +99 -77
  85. package/build/focusable.cjs.map +1 -7
  86. package/build/index.cjs +58 -39
  87. package/build/index.cjs.map +1 -7
  88. package/build/phrasing-content.cjs +163 -159
  89. package/build/phrasing-content.cjs.map +1 -7
  90. package/build/tabbable.cjs +123 -78
  91. package/build/tabbable.cjs.map +1 -7
  92. package/build/types.cjs +5 -0
  93. package/build/utils/assert-is-defined.cjs +8 -33
  94. package/build/utils/assert-is-defined.cjs.map +1 -7
  95. package/build-module/data-transfer.mjs +17 -15
  96. package/build-module/data-transfer.mjs.map +1 -7
  97. package/build-module/dom/caret-range-from-point.mjs +28 -19
  98. package/build-module/dom/caret-range-from-point.mjs.map +1 -7
  99. package/build-module/dom/clean-node-list.mjs +60 -105
  100. package/build-module/dom/clean-node-list.mjs.map +1 -7
  101. package/build-module/dom/compute-caret-rect.mjs +16 -12
  102. package/build-module/dom/compute-caret-rect.mjs.map +1 -7
  103. package/build-module/dom/document-has-selection.mjs +13 -6
  104. package/build-module/dom/document-has-selection.mjs.map +1 -7
  105. package/build-module/dom/document-has-text-selection.mjs +20 -10
  106. package/build-module/dom/document-has-text-selection.mjs.map +1 -7
  107. package/build-module/dom/document-has-uncollapsed-selection.mjs +14 -6
  108. package/build-module/dom/document-has-uncollapsed-selection.mjs.map +1 -7
  109. package/build-module/dom/get-computed-style.mjs +10 -10
  110. package/build-module/dom/get-computed-style.mjs.map +1 -7
  111. package/build-module/dom/get-offset-parent.mjs +21 -25
  112. package/build-module/dom/get-offset-parent.mjs.map +1 -7
  113. package/build-module/dom/get-range-height.mjs +15 -12
  114. package/build-module/dom/get-range-height.mjs.map +1 -7
  115. package/build-module/dom/get-rectangle-from-range.mjs +78 -113
  116. package/build-module/dom/get-rectangle-from-range.mjs.map +1 -7
  117. package/build-module/dom/get-scroll-container.mjs +28 -32
  118. package/build-module/dom/get-scroll-container.mjs.map +1 -7
  119. package/build-module/dom/hidden-caret-range-from-point.mjs +28 -19
  120. package/build-module/dom/hidden-caret-range-from-point.mjs.map +1 -7
  121. package/build-module/dom/index.mjs +28 -58
  122. package/build-module/dom/input-field-has-uncollapsed-selection.mjs +28 -23
  123. package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +1 -7
  124. package/build-module/dom/insert-after.mjs +13 -7
  125. package/build-module/dom/insert-after.mjs.map +1 -7
  126. package/build-module/dom/is-edge.mjs +53 -69
  127. package/build-module/dom/is-edge.mjs.map +1 -7
  128. package/build-module/dom/is-element.mjs +9 -6
  129. package/build-module/dom/is-element.mjs.map +1 -7
  130. package/build-module/dom/is-empty.mjs +20 -21
  131. package/build-module/dom/is-empty.mjs.map +1 -7
  132. package/build-module/dom/is-entirely-selected.mjs +51 -47
  133. package/build-module/dom/is-entirely-selected.mjs.map +1 -7
  134. package/build-module/dom/is-form-element.mjs +15 -11
  135. package/build-module/dom/is-form-element.mjs.map +1 -7
  136. package/build-module/dom/is-horizontal-edge.mjs +13 -6
  137. package/build-module/dom/is-horizontal-edge.mjs.map +1 -7
  138. package/build-module/dom/is-html-input-element.mjs +9 -6
  139. package/build-module/dom/is-html-input-element.mjs.map +1 -7
  140. package/build-module/dom/is-input-or-text-area.mjs +9 -6
  141. package/build-module/dom/is-input-or-text-area.mjs.map +1 -7
  142. package/build-module/dom/is-number-input.mjs +16 -10
  143. package/build-module/dom/is-number-input.mjs.map +1 -7
  144. package/build-module/dom/is-rtl.mjs +12 -6
  145. package/build-module/dom/is-rtl.mjs.map +1 -7
  146. package/build-module/dom/is-selection-forward.mjs +22 -19
  147. package/build-module/dom/is-selection-forward.mjs.map +1 -7
  148. package/build-module/dom/is-text-field.mjs +27 -21
  149. package/build-module/dom/is-text-field.mjs.map +1 -7
  150. package/build-module/dom/is-vertical-edge.mjs +13 -6
  151. package/build-module/dom/is-vertical-edge.mjs.map +1 -7
  152. package/build-module/dom/place-caret-at-edge.mjs +51 -52
  153. package/build-module/dom/place-caret-at-edge.mjs.map +1 -7
  154. package/build-module/dom/place-caret-at-horizontal-edge.mjs +11 -6
  155. package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +1 -7
  156. package/build-module/dom/place-caret-at-vertical-edge.mjs +12 -6
  157. package/build-module/dom/place-caret-at-vertical-edge.mjs.map +1 -7
  158. package/build-module/dom/remove-invalid-html.mjs +17 -9
  159. package/build-module/dom/remove-invalid-html.mjs.map +1 -7
  160. package/build-module/dom/remove.mjs +11 -7
  161. package/build-module/dom/remove.mjs.map +1 -7
  162. package/build-module/dom/replace-tag.mjs +17 -12
  163. package/build-module/dom/replace-tag.mjs.map +1 -7
  164. package/build-module/dom/replace.mjs +13 -8
  165. package/build-module/dom/replace.mjs.map +1 -7
  166. package/build-module/dom/safe-html.mjs +27 -24
  167. package/build-module/dom/safe-html.mjs.map +1 -7
  168. package/build-module/dom/scroll-if-no-range.mjs +21 -14
  169. package/build-module/dom/scroll-if-no-range.mjs.map +1 -7
  170. package/build-module/dom/strip-html.mjs +15 -9
  171. package/build-module/dom/strip-html.mjs.map +1 -7
  172. package/build-module/dom/types.mjs +0 -0
  173. package/build-module/dom/unwrap.mjs +13 -11
  174. package/build-module/dom/unwrap.mjs.map +1 -7
  175. package/build-module/dom/wrap.mjs +13 -8
  176. package/build-module/dom/wrap.mjs.map +1 -7
  177. package/build-module/focusable.mjs +96 -54
  178. package/build-module/focusable.mjs.map +1 -7
  179. package/build-module/index.mjs +11 -5
  180. package/build-module/index.mjs.map +1 -7
  181. package/build-module/phrasing-content.mjs +158 -134
  182. package/build-module/phrasing-content.mjs.map +1 -7
  183. package/build-module/tabbable.mjs +117 -52
  184. package/build-module/tabbable.mjs.map +1 -7
  185. package/build-module/types.mjs +0 -0
  186. package/build-module/utils/assert-is-defined.mjs +4 -9
  187. package/build-module/utils/assert-is-defined.mjs.map +1 -7
  188. package/build-types/data-transfer.d.ts +2 -2
  189. package/build-types/data-transfer.d.ts.map +1 -1
  190. package/build-types/dom/caret-range-from-point.d.ts +4 -4
  191. package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
  192. package/build-types/dom/clean-node-list.d.ts +6 -46
  193. package/build-types/dom/clean-node-list.d.ts.map +1 -1
  194. package/build-types/dom/compute-caret-rect.d.ts +2 -2
  195. package/build-types/dom/compute-caret-rect.d.ts.map +1 -1
  196. package/build-types/dom/document-has-selection.d.ts +2 -2
  197. package/build-types/dom/document-has-selection.d.ts.map +1 -1
  198. package/build-types/dom/document-has-text-selection.d.ts +2 -2
  199. package/build-types/dom/document-has-text-selection.d.ts.map +1 -1
  200. package/build-types/dom/document-has-uncollapsed-selection.d.ts +2 -2
  201. package/build-types/dom/document-has-uncollapsed-selection.d.ts.map +1 -1
  202. package/build-types/dom/get-computed-style.d.ts +3 -3
  203. package/build-types/dom/get-computed-style.d.ts.map +1 -1
  204. package/build-types/dom/get-offset-parent.d.ts +2 -2
  205. package/build-types/dom/get-offset-parent.d.ts.map +1 -1
  206. package/build-types/dom/get-range-height.d.ts +2 -2
  207. package/build-types/dom/get-range-height.d.ts.map +1 -1
  208. package/build-types/dom/get-rectangle-from-range.d.ts +2 -2
  209. package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
  210. package/build-types/dom/get-scroll-container.d.ts +5 -5
  211. package/build-types/dom/get-scroll-container.d.ts.map +1 -1
  212. package/build-types/dom/hidden-caret-range-from-point.d.ts +5 -5
  213. package/build-types/dom/hidden-caret-range-from-point.d.ts.map +1 -1
  214. package/build-types/dom/index.d.ts.map +1 -1
  215. package/build-types/dom/input-field-has-uncollapsed-selection.d.ts +2 -2
  216. package/build-types/dom/input-field-has-uncollapsed-selection.d.ts.map +1 -1
  217. package/build-types/dom/insert-after.d.ts +2 -3
  218. package/build-types/dom/insert-after.d.ts.map +1 -1
  219. package/build-types/dom/is-edge.d.ts +4 -4
  220. package/build-types/dom/is-edge.d.ts.map +1 -1
  221. package/build-types/dom/is-element.d.ts.map +1 -1
  222. package/build-types/dom/is-empty.d.ts +3 -3
  223. package/build-types/dom/is-empty.d.ts.map +1 -1
  224. package/build-types/dom/is-entirely-selected.d.ts +2 -2
  225. package/build-types/dom/is-entirely-selected.d.ts.map +1 -1
  226. package/build-types/dom/is-form-element.d.ts +3 -3
  227. package/build-types/dom/is-form-element.d.ts.map +1 -1
  228. package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
  229. package/build-types/dom/is-html-input-element.d.ts +1 -1
  230. package/build-types/dom/is-html-input-element.d.ts.map +1 -1
  231. package/build-types/dom/is-input-or-text-area.d.ts.map +1 -1
  232. package/build-types/dom/is-number-input.d.ts +2 -2
  233. package/build-types/dom/is-number-input.d.ts.map +1 -1
  234. package/build-types/dom/is-rtl.d.ts +2 -2
  235. package/build-types/dom/is-rtl.d.ts.map +1 -1
  236. package/build-types/dom/is-selection-forward.d.ts +2 -2
  237. package/build-types/dom/is-selection-forward.d.ts.map +1 -1
  238. package/build-types/dom/is-text-field.d.ts +2 -2
  239. package/build-types/dom/is-text-field.d.ts.map +1 -1
  240. package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
  241. package/build-types/dom/place-caret-at-edge.d.ts +3 -3
  242. package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
  243. package/build-types/dom/place-caret-at-horizontal-edge.d.ts.map +1 -1
  244. package/build-types/dom/place-caret-at-vertical-edge.d.ts.map +1 -1
  245. package/build-types/dom/remove-invalid-html.d.ts +5 -4
  246. package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
  247. package/build-types/dom/remove.d.ts +1 -2
  248. package/build-types/dom/remove.d.ts.map +1 -1
  249. package/build-types/dom/replace-tag.d.ts +3 -3
  250. package/build-types/dom/replace-tag.d.ts.map +1 -1
  251. package/build-types/dom/replace.d.ts +2 -3
  252. package/build-types/dom/replace.d.ts.map +1 -1
  253. package/build-types/dom/safe-html.d.ts +2 -2
  254. package/build-types/dom/safe-html.d.ts.map +1 -1
  255. package/build-types/dom/scroll-if-no-range.d.ts +5 -5
  256. package/build-types/dom/scroll-if-no-range.d.ts.map +1 -1
  257. package/build-types/dom/strip-html.d.ts +2 -2
  258. package/build-types/dom/strip-html.d.ts.map +1 -1
  259. package/build-types/dom/types.d.ts +32 -0
  260. package/build-types/dom/types.d.ts.map +1 -0
  261. package/build-types/dom/unwrap.d.ts +1 -3
  262. package/build-types/dom/unwrap.d.ts.map +1 -1
  263. package/build-types/dom/wrap.d.ts +2 -2
  264. package/build-types/dom/wrap.d.ts.map +1 -1
  265. package/build-types/focusable.d.ts +11 -30
  266. package/build-types/focusable.d.ts.map +1 -1
  267. package/build-types/index.d.ts +17 -0
  268. package/build-types/index.d.ts.map +1 -1
  269. package/build-types/phrasing-content.d.ts +9 -24
  270. package/build-types/phrasing-content.d.ts.map +1 -1
  271. package/build-types/tabbable.d.ts +10 -15
  272. package/build-types/tabbable.d.ts.map +1 -1
  273. package/build-types/types.d.ts +29 -0
  274. package/build-types/types.d.ts.map +1 -0
  275. package/package.json +6 -7
  276. package/src/{data-transfer.js → data-transfer.ts} +3 -3
  277. package/src/dom/{caret-range-from-point.js → caret-range-from-point.ts} +9 -5
  278. package/src/dom/{clean-node-list.js → clean-node-list.ts} +16 -24
  279. package/src/dom/{compute-caret-rect.js → compute-caret-rect.ts} +3 -3
  280. package/src/dom/{document-has-selection.js → document-has-selection.ts} +3 -3
  281. package/src/dom/{document-has-text-selection.js → document-has-text-selection.ts} +3 -3
  282. package/src/dom/{document-has-uncollapsed-selection.js → document-has-uncollapsed-selection.ts} +5 -3
  283. package/src/dom/{get-computed-style.js → get-computed-style.ts} +5 -3
  284. package/src/dom/{get-offset-parent.js → get-offset-parent.ts} +9 -14
  285. package/src/dom/{get-range-height.js → get-range-height.ts} +3 -3
  286. package/src/dom/{get-rectangle-from-range.js → get-rectangle-from-range.ts} +6 -12
  287. package/src/dom/{get-scroll-container.js → get-scroll-container.ts} +9 -9
  288. package/src/dom/{hidden-caret-range-from-point.js → hidden-caret-range-from-point.ts} +11 -6
  289. package/src/dom/{input-field-has-uncollapsed-selection.js → input-field-has-uncollapsed-selection.ts} +7 -5
  290. package/src/dom/{insert-after.js → insert-after.ts} +6 -4
  291. package/src/dom/{is-edge.js → is-edge.ts} +44 -48
  292. package/src/dom/{is-element.js → is-element.ts} +3 -1
  293. package/src/dom/{is-empty.js → is-empty.ts} +5 -7
  294. package/src/dom/{is-entirely-selected.js → is-entirely-selected.ts} +14 -11
  295. package/src/dom/{is-form-element.js → is-form-element.ts} +5 -3
  296. package/src/dom/{is-horizontal-edge.js → is-horizontal-edge.ts} +4 -1
  297. package/src/dom/{is-html-input-element.js → is-html-input-element.ts} +3 -1
  298. package/src/dom/{is-input-or-text-area.js → is-input-or-text-area.ts} +3 -1
  299. package/src/dom/{is-number-input.js → is-number-input.ts} +3 -3
  300. package/src/dom/{is-rtl.js → is-rtl.ts} +3 -3
  301. package/src/dom/{is-selection-forward.js → is-selection-forward.ts} +3 -3
  302. package/src/dom/{is-text-field.js → is-text-field.ts} +4 -4
  303. package/src/dom/{is-vertical-edge.js → is-vertical-edge.ts} +4 -1
  304. package/src/dom/{place-caret-at-edge.js → place-caret-at-edge.ts} +17 -9
  305. package/src/dom/{place-caret-at-horizontal-edge.js → place-caret-at-horizontal-edge.ts} +4 -1
  306. package/src/dom/{place-caret-at-vertical-edge.js → place-caret-at-vertical-edge.ts} +5 -1
  307. package/src/dom/{remove-invalid-html.js → remove-invalid-html.ts} +9 -4
  308. package/src/dom/{remove.js → remove.ts} +2 -3
  309. package/src/dom/{replace-tag.js → replace-tag.ts} +4 -4
  310. package/src/dom/{replace.js → replace.ts} +6 -4
  311. package/src/dom/{safe-html.js → safe-html.ts} +3 -3
  312. package/src/dom/{scroll-if-no-range.js → scroll-if-no-range.ts} +9 -5
  313. package/src/dom/{strip-html.js → strip-html.ts} +3 -3
  314. package/src/dom/test/{get-rectangle-from-range.browser.test.js → get-rectangle-from-range.browser.test.ts} +25 -25
  315. package/src/dom/types.ts +28 -0
  316. package/src/dom/{unwrap.js → unwrap.ts} +2 -4
  317. package/src/dom/{wrap.js → wrap.ts} +3 -3
  318. package/src/{focusable.js → focusable.ts} +34 -32
  319. package/src/index.ts +33 -0
  320. package/src/{phrasing-content.js → phrasing-content.ts} +15 -30
  321. package/src/{tabbable.js → tabbable.ts} +48 -39
  322. package/src/test/{dom.jsdom.test.js → dom.jsdom.test.ts} +30 -6
  323. package/src/test/{focusable.browser.test.js → focusable.browser.test.ts} +14 -13
  324. package/src/test/{tabbable.browser.test.js → tabbable.browser.test.ts} +3 -2
  325. package/src/types.ts +32 -0
  326. package/CHANGELOG.md +0 -317
  327. package/build/dom/index.cjs.map +0 -7
  328. package/build-module/dom/index.mjs.map +0 -7
  329. package/src/index.js +0 -12
  330. /package/src/dom/{index.js → index.ts} +0 -0
  331. /package/src/dom/test/{safe-html.jsdom.test.js → safe-html.jsdom.test.ts} +0 -0
  332. /package/src/dom/test/{strip-html.jsdom.test.js → strip-html.jsdom.test.ts} +0 -0
  333. /package/src/test/{focusable-area.jsdom.test.js → focusable-area.jsdom.test.ts} +0 -0
  334. /package/src/test/{utils.js → utils.ts} +0 -0
@@ -1,55 +1,57 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/dom/src/dom/is-text-field.js
31
- var is_text_field_exports = {};
32
- __export(is_text_field_exports, {
33
- default: () => isTextField
34
- });
35
- module.exports = __toCommonJS(is_text_field_exports);
36
- var import_is_html_input_element = __toESM(require("./is-html-input-element.cjs"));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __is_html_input_element_ts = require("./is-html-input-element.cjs");
28
+ __is_html_input_element_ts = __toESM(__is_html_input_element_ts);
29
+ // packages/dom/src/dom/is-text-field.ts
30
+ /**
31
+ * Check whether the given element is a text field, where text field is defined
32
+ * by the ability to select within the input, or that it is contenteditable.
33
+ *
34
+ * See: https://html.spec.whatwg.org/#textFieldSelection
35
+ *
36
+ * @param node The HTML element.
37
+ * @return True if the element is an text field, false if not.
38
+ */
37
39
  function isTextField(node) {
38
- const nonTextInputs = [
39
- "button",
40
- "checkbox",
41
- "hidden",
42
- "file",
43
- "radio",
44
- "image",
45
- "range",
46
- "reset",
47
- "submit",
48
- "number",
49
- "email",
50
- "time"
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";
40
+ return (0, __is_html_input_element_ts.default)(node) && node.type && ![
41
+ "button",
42
+ "checkbox",
43
+ "hidden",
44
+ "file",
45
+ "radio",
46
+ "image",
47
+ "range",
48
+ "reset",
49
+ "submit",
50
+ "number",
51
+ "email",
52
+ "time"
53
+ ].includes(node.type) || node.nodeName === "TEXTAREA" || node.contentEditable === "true";
54
54
  }
55
- //# sourceMappingURL=is-text-field.cjs.map
55
+ exports.default = isTextField;
56
+
57
+ //# sourceMappingURL=is-text-field.cjs.map
@@ -1,7 +1 @@
1
- {
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;",
6
- "names": ["isHTMLInputElement"]
7
- }
1
+ {"version":3,"file":"is-text-field.cjs","names":["isHTMLInputElement"],"sources":["../../src/dom/is-text-field.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAwB,YAAa,MAAkC;CAetE,QAAA,GACGA,2BAAAA,QAAAA,CAAoB,IAAK,KAC1B,KAAK,QACL,CAAE;EAhBH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAKe,CAAC,CAAC,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa,cAChB,KAAsB,oBAAoB;AAE9C"}
@@ -1,40 +1,43 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/dom/src/dom/is-vertical-edge.js
31
- var is_vertical_edge_exports = {};
32
- __export(is_vertical_edge_exports, {
33
- default: () => isVerticalEdge
34
- });
35
- module.exports = __toCommonJS(is_vertical_edge_exports);
36
- var import_is_edge = __toESM(require("./is-edge.cjs"));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __is_edge_ts = require("./is-edge.cjs");
28
+ __is_edge_ts = __toESM(__is_edge_ts);
29
+ // packages/dom/src/dom/is-vertical-edge.ts
30
+ /**
31
+ * Check whether the selection is vertically at the edge of the container.
32
+ *
33
+ * @param {HTMLElement} container Focusable element.
34
+ * @param {boolean} isReverse Set to true to check top, false for bottom.
35
+ *
36
+ * @return {boolean} True if at the vertical edge, false if not.
37
+ */
37
38
  function isVerticalEdge(container, isReverse) {
38
- return (0, import_is_edge.default)(container, isReverse, true);
39
+ return (0, __is_edge_ts.default)(container, isReverse, true);
39
40
  }
40
- //# sourceMappingURL=is-vertical-edge.cjs.map
41
+ exports.default = isVerticalEdge;
42
+
43
+ //# sourceMappingURL=is-vertical-edge.cjs.map
@@ -1,7 +1 @@
1
- {
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;",
6
- "names": ["isEdge"]
7
- }
1
+ {"version":3,"file":"is-vertical-edge.cjs","names":["isEdge"],"sources":["../../src/dom/is-vertical-edge.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAwB,eACvB,WACA,WACU;CACV,QAAA,GAAOA,aAAAA,QAAAA,CAAQ,WAAW,WAAW,IAAK;AAC3C"}
@@ -1,92 +1,89 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/dom/src/dom/place-caret-at-edge.js
31
- var place_caret_at_edge_exports = {};
32
- __export(place_caret_at_edge_exports, {
33
- default: () => placeCaretAtEdge
34
- });
35
- module.exports = __toCommonJS(place_caret_at_edge_exports);
36
- var import_hidden_caret_range_from_point = __toESM(require("./hidden-caret-range-from-point.cjs"));
37
- var import_assert_is_defined = require("../utils/assert-is-defined.cjs");
38
- var import_is_input_or_text_area = __toESM(require("./is-input-or-text-area.cjs"));
39
- var import_is_rtl = __toESM(require("./is-rtl.cjs"));
40
- var import_scroll_if_no_range = require("./scroll-if-no-range.cjs");
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __hidden_caret_range_from_point_ts = require("./hidden-caret-range-from-point.cjs");
28
+ __hidden_caret_range_from_point_ts = __toESM(__hidden_caret_range_from_point_ts);
29
+ let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
30
+ let __is_input_or_text_area_ts = require("./is-input-or-text-area.cjs");
31
+ __is_input_or_text_area_ts = __toESM(__is_input_or_text_area_ts);
32
+ let __is_rtl_ts = require("./is-rtl.cjs");
33
+ __is_rtl_ts = __toESM(__is_rtl_ts);
34
+ let __scroll_if_no_range_ts = require("./scroll-if-no-range.cjs");
35
+ // packages/dom/src/dom/place-caret-at-edge.ts
36
+ /**
37
+ * Gets the range to place.
38
+ *
39
+ * @param container Focusable element.
40
+ * @param isReverse True for end, false for start.
41
+ * @param x X coordinate to vertically position.
42
+ *
43
+ * @return The range to place.
44
+ */
41
45
  function getRange(container, isReverse, x) {
42
- const { ownerDocument } = container;
43
- const isReverseDir = (0, import_is_rtl.default)(container) ? !isReverse : isReverse;
44
- const containerRect = container.getBoundingClientRect();
45
- if (x === void 0) {
46
- x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
47
- } else if (x <= containerRect.left) {
48
- x = containerRect.left + 1;
49
- } else if (x >= containerRect.right) {
50
- x = containerRect.right - 1;
51
- }
52
- const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;
53
- return (0, import_hidden_caret_range_from_point.default)(ownerDocument, x, y, container);
46
+ const { ownerDocument } = container;
47
+ const isReverseDir = (0, __is_rtl_ts.default)(container) ? !isReverse : isReverse;
48
+ const containerRect = container.getBoundingClientRect();
49
+ if (x === void 0) x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
50
+ else if (x <= containerRect.left) x = containerRect.left + 1;
51
+ else if (x >= containerRect.right) x = containerRect.right - 1;
52
+ const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;
53
+ return (0, __hidden_caret_range_from_point_ts.default)(ownerDocument, x, y, container);
54
54
  }
55
+ /**
56
+ * Places the caret at start or end of a given element.
57
+ *
58
+ * @param container Focusable element.
59
+ * @param isReverse True for end, false for start.
60
+ * @param x X coordinate to vertically position.
61
+ */
55
62
  function placeCaretAtEdge(container, isReverse, x) {
56
- if (!container) {
57
- return;
58
- }
59
- container.focus();
60
- if ((0, import_is_input_or_text_area.default)(container)) {
61
- if (typeof container.selectionStart !== "number") {
62
- return;
63
- }
64
- if (isReverse) {
65
- container.selectionStart = container.value.length;
66
- container.selectionEnd = container.value.length;
67
- } else {
68
- container.selectionStart = 0;
69
- container.selectionEnd = 0;
70
- }
71
- return;
72
- }
73
- if (container.contentEditable !== "true") {
74
- return;
75
- }
76
- const range = (0, import_scroll_if_no_range.scrollIfNoRange)(
77
- container,
78
- isReverse,
79
- () => getRange(container, isReverse, x)
80
- );
81
- if (!range) {
82
- return;
83
- }
84
- const { ownerDocument } = container;
85
- const { defaultView } = ownerDocument;
86
- (0, import_assert_is_defined.assertIsDefined)(defaultView, "defaultView");
87
- const selection = defaultView.getSelection();
88
- (0, import_assert_is_defined.assertIsDefined)(selection, "selection");
89
- selection.removeAllRanges();
90
- selection.addRange(range);
63
+ if (!container) return;
64
+ container.focus();
65
+ if ((0, __is_input_or_text_area_ts.default)(container)) {
66
+ if (typeof container.selectionStart !== "number") return;
67
+ if (isReverse) {
68
+ container.selectionStart = container.value.length;
69
+ container.selectionEnd = container.value.length;
70
+ } else {
71
+ container.selectionStart = 0;
72
+ container.selectionEnd = 0;
73
+ }
74
+ return;
75
+ }
76
+ if (container.contentEditable !== "true") return;
77
+ const range = (0, __scroll_if_no_range_ts.scrollIfNoRange)(container, isReverse, () => getRange(container, isReverse, x));
78
+ if (!range) return;
79
+ const { ownerDocument } = container;
80
+ const { defaultView } = ownerDocument;
81
+ (0, ___utils_assert_is_defined_ts.assertIsDefined)(defaultView, "defaultView");
82
+ const selection = defaultView.getSelection();
83
+ (0, ___utils_assert_is_defined_ts.assertIsDefined)(selection, "selection");
84
+ selection.removeAllRanges();
85
+ selection.addRange(range);
91
86
  }
92
- //# sourceMappingURL=place-caret-at-edge.cjs.map
87
+ exports.default = placeCaretAtEdge;
88
+
89
+ //# sourceMappingURL=place-caret-at-edge.cjs.map
@@ -1,7 +1 @@
1
- {
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;",
6
- "names": ["isRTL", "hiddenCaretRangeFromPoint", "isInputOrTextArea"]
7
- }
1
+ {"version":3,"file":"place-caret-at-edge.cjs","names":["isRTL","hiddenCaretRangeFromPoint","isInputOrTextArea","scrollIfNoRange"],"sources":["../../src/dom/place-caret-at-edge.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAS,SACR,WACA,WACA,GACe;CACf,MAAM,EAAE,kBAAkB;CAE1B,MAAM,gBAAA,GAAeA,YAAAA,QAAAA,CAAO,SAAU,IAAI,CAAE,YAAY;CACxD,MAAM,gBAAgB,UAAU,sBAAsB;CAKtD,IAAK,MAAM,KAAA,GACV,IAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;MACzD,IAAK,KAAK,cAAc,MAC9B,IAAI,cAAc,OAAO;MACnB,IAAK,KAAK,cAAc,OAC9B,IAAI,cAAc,QAAQ;CAE3B,MAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;CACxE,QAAA,GAAOC,mCAAAA,QAAAA,CAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;;;;;;;;AASA,SAAwB,iBACvB,WACA,WACA,GACC;CACD,IAAK,CAAE,WACN;CAGD,UAAU,MAAM;CAEhB,KAAA,GAAKC,2BAAAA,QAAAA,CAAmB,SAAU,GAAI;EAErC,IAAK,OAAO,UAAU,mBAAmB,UACxC;EAGD,IAAK,WAAY;GAChB,UAAU,iBAAiB,UAAU,MAAM;GAC3C,UAAU,eAAe,UAAU,MAAM;EAC1C,OAAO;GACN,UAAU,iBAAiB;GAC3B,UAAU,eAAe;EAC1B;EAEA;CACD;CAMA,IAAK,UAAU,oBAAoB,QAClC;CAGD,MAAM,SAAA,GAAQC,wBAAAA,gBAAAA,CAAiB,WAAW,iBACzC,SAAU,WAAW,WAAW,CAAE,CACnC;CAEA,IAAK,CAAE,OACN;CAGD,MAAM,EAAE,kBAAkB;CAC1B,MAAM,EAAE,gBAAgB;CACxB,CAAA,GAAA,8BAAA,gBAAA,CAAiB,aAAa,aAAc;CAC5C,MAAM,YAAY,YAAY,aAAa;CAC3C,CAAA,GAAA,8BAAA,gBAAA,CAAiB,WAAW,WAAY;CACxC,UAAU,gBAAgB;CAC1B,UAAU,SAAU,KAAM;AAC3B"}
@@ -1,40 +1,41 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/dom/src/dom/place-caret-at-horizontal-edge.js
31
- var place_caret_at_horizontal_edge_exports = {};
32
- __export(place_caret_at_horizontal_edge_exports, {
33
- default: () => placeCaretAtHorizontalEdge
34
- });
35
- module.exports = __toCommonJS(place_caret_at_horizontal_edge_exports);
36
- var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge.cjs"));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __place_caret_at_edge_ts = require("./place-caret-at-edge.cjs");
28
+ __place_caret_at_edge_ts = __toESM(__place_caret_at_edge_ts);
29
+ // packages/dom/src/dom/place-caret-at-horizontal-edge.ts
30
+ /**
31
+ * Places the caret at start or end of a given element.
32
+ *
33
+ * @param {HTMLElement} container Focusable element.
34
+ * @param {boolean} isReverse True for end, false for start.
35
+ */
37
36
  function placeCaretAtHorizontalEdge(container, isReverse) {
38
- return (0, import_place_caret_at_edge.default)(container, isReverse, void 0);
37
+ return (0, __place_caret_at_edge_ts.default)(container, isReverse, void 0);
39
38
  }
40
- //# sourceMappingURL=place-caret-at-horizontal-edge.cjs.map
39
+ exports.default = placeCaretAtHorizontalEdge;
40
+
41
+ //# sourceMappingURL=place-caret-at-horizontal-edge.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/place-caret-at-horizontal-edge.js"],
4
- "sourcesContent": ["import placeCaretAtEdge from './place-caret-at-edge';\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 */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA6B;AAQd,SAAR,2BAA6C,WAAW,WAAY;AAC1E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAU;AAC1D;",
6
- "names": ["placeCaretAtEdge"]
7
- }
1
+ {"version":3,"file":"place-caret-at-horizontal-edge.cjs","names":["placeCaretAtEdge"],"sources":["../../src/dom/place-caret-at-horizontal-edge.ts"],"sourcesContent":["import placeCaretAtEdge from './place-caret-at-edge';\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 */\nexport default function placeCaretAtHorizontalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAwB,2BACvB,WACA,WACC;CACD,QAAA,GAAOA,yBAAAA,QAAAA,CAAkB,WAAW,WAAW,KAAA,CAAU;AAC1D"}
@@ -1,40 +1,42 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/dom/src/dom/place-caret-at-vertical-edge.js
31
- var place_caret_at_vertical_edge_exports = {};
32
- __export(place_caret_at_vertical_edge_exports, {
33
- default: () => placeCaretAtVerticalEdge
34
- });
35
- module.exports = __toCommonJS(place_caret_at_vertical_edge_exports);
36
- var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge.cjs"));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __place_caret_at_edge_ts = require("./place-caret-at-edge.cjs");
28
+ __place_caret_at_edge_ts = __toESM(__place_caret_at_edge_ts);
29
+ // packages/dom/src/dom/place-caret-at-vertical-edge.ts
30
+ /**
31
+ * Places the caret at the top or bottom of a given element.
32
+ *
33
+ * @param {HTMLElement} container Focusable element.
34
+ * @param {boolean} isReverse True for bottom, false for top.
35
+ * @param {DOMRect} [rect] The rectangle to position the caret with.
36
+ */
37
37
  function placeCaretAtVerticalEdge(container, isReverse, rect) {
38
- return (0, import_place_caret_at_edge.default)(container, isReverse, rect?.left);
38
+ return (0, __place_caret_at_edge_ts.default)(container, isReverse, rect?.left);
39
39
  }
40
- //# sourceMappingURL=place-caret-at-vertical-edge.cjs.map
40
+ exports.default = placeCaretAtVerticalEdge;
41
+
42
+ //# sourceMappingURL=place-caret-at-vertical-edge.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/place-caret-at-vertical-edge.js"],
4
- "sourcesContent": ["import placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA6B;AASd,SAAR,yBAA2C,WAAW,WAAW,MAAO;AAC9E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
6
- "names": ["placeCaretAtEdge"]
7
- }
1
+ {"version":3,"file":"place-caret-at-vertical-edge.cjs","names":["placeCaretAtEdge"],"sources":["../../src/dom/place-caret-at-vertical-edge.ts"],"sourcesContent":["import placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\trect?: DOMRect\n) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAwB,yBACvB,WACA,WACA,MACC;CACD,QAAA,GAAOA,yBAAAA,QAAAA,CAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D"}