@selenium/atoms 4.51.0 → 4.52.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 (331) hide show
  1. package/dist/index.d.ts +40 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +40 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/typescript/active-element.d.ts +2 -0
  6. package/dist/typescript/active-element.d.ts.map +1 -0
  7. package/dist/typescript/active-element.js +19 -0
  8. package/dist/typescript/active-element.js.map +1 -0
  9. package/dist/typescript/clear-local-storage.d.ts +3 -0
  10. package/dist/typescript/clear-local-storage.d.ts.map +1 -0
  11. package/dist/typescript/clear-local-storage.js +25 -0
  12. package/dist/typescript/clear-local-storage.js.map +1 -0
  13. package/dist/typescript/clear-session-storage.d.ts +3 -0
  14. package/dist/typescript/clear-session-storage.d.ts.map +1 -0
  15. package/dist/typescript/clear-session-storage.js +25 -0
  16. package/dist/typescript/clear-session-storage.js.map +1 -0
  17. package/dist/typescript/clear.d.ts +3 -0
  18. package/dist/typescript/clear.d.ts.map +1 -0
  19. package/dist/typescript/clear.js +67 -0
  20. package/dist/typescript/clear.js.map +1 -0
  21. package/dist/typescript/click.d.ts +4 -0
  22. package/dist/typescript/click.d.ts.map +1 -0
  23. package/dist/typescript/click.js +52 -0
  24. package/dist/typescript/click.js.map +1 -0
  25. package/dist/typescript/core/attribute.d.ts +3 -0
  26. package/dist/typescript/core/attribute.d.ts.map +1 -0
  27. package/dist/typescript/core/attribute.js +60 -0
  28. package/dist/typescript/core/attribute.js.map +1 -0
  29. package/dist/typescript/core/color.d.ts +2 -0
  30. package/dist/typescript/core/color.d.ts.map +1 -0
  31. package/dist/typescript/core/color.js +248 -0
  32. package/dist/typescript/core/color.js.map +1 -0
  33. package/dist/typescript/core/editable.d.ts +5 -0
  34. package/dist/typescript/core/editable.d.ts.map +1 -0
  35. package/dist/typescript/core/editable.js +55 -0
  36. package/dist/typescript/core/editable.js.map +1 -0
  37. package/dist/typescript/core/element.d.ts +6 -0
  38. package/dist/typescript/core/element.d.ts.map +1 -0
  39. package/dist/typescript/core/element.js +97 -0
  40. package/dist/typescript/core/element.js.map +1 -0
  41. package/dist/typescript/core/enabled.d.ts +2 -0
  42. package/dist/typescript/core/enabled.d.ts.map +1 -0
  43. package/dist/typescript/core/enabled.js +69 -0
  44. package/dist/typescript/core/enabled.js.map +1 -0
  45. package/dist/typescript/core/error.d.ts +13 -0
  46. package/dist/typescript/core/error.d.ts.map +1 -0
  47. package/dist/typescript/core/error.js +40 -0
  48. package/dist/typescript/core/error.js.map +1 -0
  49. package/dist/typescript/core/events.d.ts +91 -0
  50. package/dist/typescript/core/events.d.ts.map +1 -0
  51. package/dist/typescript/core/events.js +131 -0
  52. package/dist/typescript/core/events.js.map +1 -0
  53. package/dist/typescript/core/focus.d.ts +4 -0
  54. package/dist/typescript/core/focus.d.ts.map +1 -0
  55. package/dist/typescript/core/focus.js +88 -0
  56. package/dist/typescript/core/focus.js.map +1 -0
  57. package/dist/typescript/core/focusable.d.ts +2 -0
  58. package/dist/typescript/core/focusable.d.ts.map +1 -0
  59. package/dist/typescript/core/focusable.js +36 -0
  60. package/dist/typescript/core/focusable.js.map +1 -0
  61. package/dist/typescript/core/form.d.ts +2 -0
  62. package/dist/typescript/core/form.d.ts.map +1 -0
  63. package/dist/typescript/core/form.js +76 -0
  64. package/dist/typescript/core/form.js.map +1 -0
  65. package/dist/typescript/core/frame.d.ts +8 -0
  66. package/dist/typescript/core/frame.d.ts.map +1 -0
  67. package/dist/typescript/core/frame.js +95 -0
  68. package/dist/typescript/core/frame.js.map +1 -0
  69. package/dist/typescript/core/geometry.d.ts +28 -0
  70. package/dist/typescript/core/geometry.d.ts.map +1 -0
  71. package/dist/typescript/core/geometry.js +134 -0
  72. package/dist/typescript/core/geometry.js.map +1 -0
  73. package/dist/typescript/core/inject.d.ts +21 -0
  74. package/dist/typescript/core/inject.d.ts.map +1 -0
  75. package/dist/typescript/core/inject.js +282 -0
  76. package/dist/typescript/core/inject.js.map +1 -0
  77. package/dist/typescript/core/interactable.d.ts +2 -0
  78. package/dist/typescript/core/interactable.d.ts.map +1 -0
  79. package/dist/typescript/core/interactable.js +27 -0
  80. package/dist/typescript/core/interactable.js.map +1 -0
  81. package/dist/typescript/core/keyboard.d.ts +15 -0
  82. package/dist/typescript/core/keyboard.d.ts.map +1 -0
  83. package/dist/typescript/core/keyboard.js +356 -0
  84. package/dist/typescript/core/keyboard.js.map +1 -0
  85. package/dist/typescript/core/keys.d.ts +65 -0
  86. package/dist/typescript/core/keys.d.ts.map +1 -0
  87. package/dist/typescript/core/keys.js +125 -0
  88. package/dist/typescript/core/keys.js.map +1 -0
  89. package/dist/typescript/core/locators.d.ts +6 -0
  90. package/dist/typescript/core/locators.d.ts.map +1 -0
  91. package/dist/typescript/core/locators.js +610 -0
  92. package/dist/typescript/core/locators.js.map +1 -0
  93. package/dist/typescript/core/mouse.d.ts +17 -0
  94. package/dist/typescript/core/mouse.d.ts.map +1 -0
  95. package/dist/typescript/core/mouse.js +186 -0
  96. package/dist/typescript/core/mouse.js.map +1 -0
  97. package/dist/typescript/core/overflow.d.ts +5 -0
  98. package/dist/typescript/core/overflow.d.ts.map +1 -0
  99. package/dist/typescript/core/overflow.js +133 -0
  100. package/dist/typescript/core/overflow.js.map +1 -0
  101. package/dist/typescript/core/scroll.d.ts +3 -0
  102. package/dist/typescript/core/scroll.d.ts.map +1 -0
  103. package/dist/typescript/core/scroll.js +77 -0
  104. package/dist/typescript/core/scroll.js.map +1 -0
  105. package/dist/typescript/core/shown.d.ts +3 -0
  106. package/dist/typescript/core/shown.d.ts.map +1 -0
  107. package/dist/typescript/core/shown.js +190 -0
  108. package/dist/typescript/core/shown.js.map +1 -0
  109. package/dist/typescript/core/storage.d.ts +14 -0
  110. package/dist/typescript/core/storage.d.ts.map +1 -0
  111. package/dist/typescript/core/storage.js +98 -0
  112. package/dist/typescript/core/storage.js.map +1 -0
  113. package/dist/typescript/core/style.d.ts +2 -0
  114. package/dist/typescript/core/style.d.ts.map +1 -0
  115. package/dist/typescript/core/style.js +32 -0
  116. package/dist/typescript/core/style.js.map +1 -0
  117. package/dist/typescript/core/useragent.d.ts +3 -0
  118. package/dist/typescript/core/useragent.d.ts.map +1 -0
  119. package/dist/typescript/core/useragent.js +31 -0
  120. package/dist/typescript/core/useragent.js.map +1 -0
  121. package/dist/typescript/default-content.d.ts +2 -0
  122. package/dist/typescript/default-content.d.ts.map +1 -0
  123. package/dist/typescript/default-content.js +20 -0
  124. package/dist/typescript/default-content.js.map +1 -0
  125. package/dist/typescript/execute-async-script.d.ts +2 -0
  126. package/dist/typescript/execute-async-script.d.ts.map +1 -0
  127. package/dist/typescript/execute-async-script.js +20 -0
  128. package/dist/typescript/execute-async-script.js.map +1 -0
  129. package/dist/typescript/execute-script.d.ts +2 -0
  130. package/dist/typescript/execute-script.d.ts.map +1 -0
  131. package/dist/typescript/execute-script.js +20 -0
  132. package/dist/typescript/execute-script.js.map +1 -0
  133. package/dist/typescript/find-element-fragment.d.ts +8 -0
  134. package/dist/typescript/find-element-fragment.d.ts.map +1 -0
  135. package/dist/typescript/find-element-fragment.js +39 -0
  136. package/dist/typescript/find-element-fragment.js.map +1 -0
  137. package/dist/typescript/find-element.d.ts +2 -0
  138. package/dist/typescript/find-element.d.ts.map +1 -0
  139. package/dist/typescript/find-element.js +18 -0
  140. package/dist/typescript/find-element.js.map +1 -0
  141. package/dist/typescript/find-elements.d.ts +1 -2
  142. package/dist/typescript/find-elements.d.ts.map +1 -1
  143. package/dist/typescript/find-elements.js +1 -289
  144. package/dist/typescript/find-elements.js.map +1 -1
  145. package/dist/typescript/frame-by-id-or-name.d.ts +2 -0
  146. package/dist/typescript/frame-by-id-or-name.d.ts.map +1 -0
  147. package/dist/typescript/frame-by-id-or-name.js +22 -0
  148. package/dist/typescript/frame-by-id-or-name.js.map +1 -0
  149. package/dist/typescript/frame-by-index.d.ts +2 -0
  150. package/dist/typescript/frame-by-index.d.ts.map +1 -0
  151. package/dist/typescript/frame-by-index.js +19 -0
  152. package/dist/typescript/frame-by-index.js.map +1 -0
  153. package/dist/typescript/get-attribute-value.d.ts +2 -0
  154. package/dist/typescript/get-attribute-value.d.ts.map +1 -0
  155. package/dist/typescript/get-attribute-value.js +22 -0
  156. package/dist/typescript/get-attribute-value.js.map +1 -0
  157. package/dist/typescript/get-effective-style.d.ts +3 -0
  158. package/dist/typescript/get-effective-style.d.ts.map +1 -0
  159. package/dist/typescript/get-effective-style.js +84 -0
  160. package/dist/typescript/get-effective-style.js.map +1 -0
  161. package/dist/typescript/get-element-from-cache.d.ts +2 -0
  162. package/dist/typescript/get-element-from-cache.d.ts.map +1 -0
  163. package/dist/typescript/get-element-from-cache.js +20 -0
  164. package/dist/typescript/get-element-from-cache.js.map +1 -0
  165. package/dist/typescript/get-frame-window.d.ts +2 -0
  166. package/dist/typescript/get-frame-window.d.ts.map +1 -0
  167. package/dist/typescript/get-frame-window.js +22 -0
  168. package/dist/typescript/get-frame-window.js.map +1 -0
  169. package/dist/typescript/get-local-storage-item.d.ts +3 -0
  170. package/dist/typescript/get-local-storage-item.d.ts.map +1 -0
  171. package/dist/typescript/get-local-storage-item.js +25 -0
  172. package/dist/typescript/get-local-storage-item.js.map +1 -0
  173. package/dist/typescript/get-local-storage-key.d.ts +3 -0
  174. package/dist/typescript/get-local-storage-key.d.ts.map +1 -0
  175. package/dist/typescript/get-local-storage-key.js +26 -0
  176. package/dist/typescript/get-local-storage-key.js.map +1 -0
  177. package/dist/typescript/get-local-storage-keys.d.ts +3 -0
  178. package/dist/typescript/get-local-storage-keys.d.ts.map +1 -0
  179. package/dist/typescript/get-local-storage-keys.js +25 -0
  180. package/dist/typescript/get-local-storage-keys.js.map +1 -0
  181. package/dist/typescript/get-local-storage-size.d.ts +3 -0
  182. package/dist/typescript/get-local-storage-size.d.ts.map +1 -0
  183. package/dist/typescript/get-local-storage-size.js +25 -0
  184. package/dist/typescript/get-local-storage-size.js.map +1 -0
  185. package/dist/typescript/get-location.d.ts +9 -0
  186. package/dist/typescript/get-location.d.ts.map +1 -0
  187. package/dist/typescript/get-location.js +49 -0
  188. package/dist/typescript/get-location.js.map +1 -0
  189. package/dist/typescript/get-session-storage-item.d.ts +3 -0
  190. package/dist/typescript/get-session-storage-item.d.ts.map +1 -0
  191. package/dist/typescript/get-session-storage-item.js +25 -0
  192. package/dist/typescript/get-session-storage-item.js.map +1 -0
  193. package/dist/typescript/get-session-storage-key.d.ts +3 -0
  194. package/dist/typescript/get-session-storage-key.d.ts.map +1 -0
  195. package/dist/typescript/get-session-storage-key.js +26 -0
  196. package/dist/typescript/get-session-storage-key.js.map +1 -0
  197. package/dist/typescript/get-session-storage-keys.d.ts +3 -0
  198. package/dist/typescript/get-session-storage-keys.d.ts.map +1 -0
  199. package/dist/typescript/get-session-storage-keys.js +25 -0
  200. package/dist/typescript/get-session-storage-keys.js.map +1 -0
  201. package/dist/typescript/get-session-storage-size.d.ts +3 -0
  202. package/dist/typescript/get-session-storage-size.d.ts.map +1 -0
  203. package/dist/typescript/get-session-storage-size.js +25 -0
  204. package/dist/typescript/get-session-storage-size.js.map +1 -0
  205. package/dist/typescript/get-size.d.ts +7 -0
  206. package/dist/typescript/get-size.d.ts.map +1 -0
  207. package/dist/typescript/get-size.js +36 -0
  208. package/dist/typescript/get-size.js.map +1 -0
  209. package/dist/typescript/get-text.d.ts +3 -0
  210. package/dist/typescript/get-text.d.ts.map +1 -0
  211. package/dist/typescript/get-text.js +294 -0
  212. package/dist/typescript/get-text.js.map +1 -0
  213. package/dist/typescript/get-top-left-coordinates.d.ts +4 -0
  214. package/dist/typescript/get-top-left-coordinates.d.ts.map +1 -0
  215. package/dist/typescript/get-top-left-coordinates.js +36 -0
  216. package/dist/typescript/get-top-left-coordinates.js.map +1 -0
  217. package/dist/typescript/is-displayed.d.ts +1 -2
  218. package/dist/typescript/is-displayed.d.ts.map +1 -1
  219. package/dist/typescript/is-displayed.js +3 -396
  220. package/dist/typescript/is-displayed.js.map +1 -1
  221. package/dist/typescript/is-editable.d.ts +2 -0
  222. package/dist/typescript/is-editable.d.ts.map +1 -0
  223. package/dist/typescript/is-editable.js +18 -0
  224. package/dist/typescript/is-editable.js.map +1 -0
  225. package/dist/typescript/is-enabled.d.ts +2 -0
  226. package/dist/typescript/is-enabled.d.ts.map +1 -0
  227. package/dist/typescript/is-enabled.js +18 -0
  228. package/dist/typescript/is-enabled.js.map +1 -0
  229. package/dist/typescript/is-focusable.d.ts +2 -0
  230. package/dist/typescript/is-focusable.d.ts.map +1 -0
  231. package/dist/typescript/is-focusable.js +20 -0
  232. package/dist/typescript/is-focusable.js.map +1 -0
  233. package/dist/typescript/is-interactable.d.ts +2 -0
  234. package/dist/typescript/is-interactable.d.ts.map +1 -0
  235. package/dist/typescript/is-interactable.js +19 -0
  236. package/dist/typescript/is-interactable.js.map +1 -0
  237. package/dist/typescript/is-selected.d.ts +3 -0
  238. package/dist/typescript/is-selected.d.ts.map +1 -0
  239. package/dist/typescript/is-selected.js +29 -0
  240. package/dist/typescript/is-selected.js.map +1 -0
  241. package/dist/typescript/remove-local-storage-item.d.ts +3 -0
  242. package/dist/typescript/remove-local-storage-item.d.ts.map +1 -0
  243. package/dist/typescript/remove-local-storage-item.js +25 -0
  244. package/dist/typescript/remove-local-storage-item.js.map +1 -0
  245. package/dist/typescript/remove-session-storage-item.d.ts +3 -0
  246. package/dist/typescript/remove-session-storage-item.d.ts.map +1 -0
  247. package/dist/typescript/remove-session-storage-item.js +25 -0
  248. package/dist/typescript/remove-session-storage-item.js.map +1 -0
  249. package/dist/typescript/set-local-storage-item.d.ts +3 -0
  250. package/dist/typescript/set-local-storage-item.d.ts.map +1 -0
  251. package/dist/typescript/set-local-storage-item.js +26 -0
  252. package/dist/typescript/set-local-storage-item.js.map +1 -0
  253. package/dist/typescript/set-session-storage-item.d.ts +3 -0
  254. package/dist/typescript/set-session-storage-item.d.ts.map +1 -0
  255. package/dist/typescript/set-session-storage-item.js +26 -0
  256. package/dist/typescript/set-session-storage-item.js.map +1 -0
  257. package/dist/typescript/submit.d.ts +3 -0
  258. package/dist/typescript/submit.d.ts.map +1 -0
  259. package/dist/typescript/submit.js +50 -0
  260. package/dist/typescript/submit.js.map +1 -0
  261. package/dist/typescript/type.d.ts +3 -0
  262. package/dist/typescript/type.d.ts.map +1 -0
  263. package/dist/typescript/type.js +201 -0
  264. package/dist/typescript/type.js.map +1 -0
  265. package/index.ts +40 -0
  266. package/package.json +292 -5
  267. package/typescript/active-element.ts +19 -0
  268. package/typescript/clear-local-storage.ts +27 -0
  269. package/typescript/clear-session-storage.ts +27 -0
  270. package/typescript/clear.ts +73 -0
  271. package/typescript/click.ts +55 -0
  272. package/typescript/core/attribute.ts +68 -0
  273. package/typescript/core/color.ts +257 -0
  274. package/typescript/core/editable.ts +63 -0
  275. package/typescript/core/element.ts +110 -0
  276. package/typescript/core/enabled.ts +76 -0
  277. package/typescript/core/error.ts +41 -0
  278. package/typescript/core/events.ts +268 -0
  279. package/typescript/core/focus.ts +92 -0
  280. package/typescript/core/focusable.ts +38 -0
  281. package/typescript/core/form.ts +81 -0
  282. package/typescript/core/frame.ts +105 -0
  283. package/typescript/core/geometry.ts +183 -0
  284. package/typescript/core/inject.ts +336 -0
  285. package/typescript/core/interactable.ts +30 -0
  286. package/typescript/core/keyboard.ts +369 -0
  287. package/typescript/core/keys.ts +204 -0
  288. package/typescript/core/locators.ts +704 -0
  289. package/typescript/core/mouse.ts +211 -0
  290. package/typescript/core/overflow.ts +172 -0
  291. package/typescript/core/scroll.ts +92 -0
  292. package/typescript/core/shown.ts +233 -0
  293. package/typescript/core/storage.ts +111 -0
  294. package/typescript/core/style.ts +32 -0
  295. package/typescript/core/useragent.ts +33 -0
  296. package/typescript/default-content.ts +20 -0
  297. package/typescript/execute-async-script.ts +20 -0
  298. package/typescript/execute-script.ts +20 -0
  299. package/typescript/find-element-fragment.ts +45 -0
  300. package/typescript/find-element.ts +18 -0
  301. package/typescript/find-elements.ts +1 -326
  302. package/typescript/frame-by-id-or-name.ts +22 -0
  303. package/typescript/frame-by-index.ts +19 -0
  304. package/typescript/get-attribute-value.ts +22 -0
  305. package/typescript/get-effective-style.ts +93 -0
  306. package/typescript/get-element-from-cache.ts +20 -0
  307. package/typescript/get-frame-window.ts +22 -0
  308. package/typescript/get-local-storage-item.ts +27 -0
  309. package/typescript/get-local-storage-key.ts +28 -0
  310. package/typescript/get-local-storage-keys.ts +27 -0
  311. package/typescript/get-local-storage-size.ts +27 -0
  312. package/typescript/get-location.ts +63 -0
  313. package/typescript/get-session-storage-item.ts +27 -0
  314. package/typescript/get-session-storage-key.ts +28 -0
  315. package/typescript/get-session-storage-keys.ts +27 -0
  316. package/typescript/get-session-storage-size.ts +27 -0
  317. package/typescript/get-size.ts +43 -0
  318. package/typescript/get-text.ts +353 -0
  319. package/typescript/get-top-left-coordinates.ts +38 -0
  320. package/typescript/is-displayed.ts +3 -498
  321. package/typescript/is-editable.ts +18 -0
  322. package/typescript/is-enabled.ts +18 -0
  323. package/typescript/is-focusable.ts +20 -0
  324. package/typescript/is-interactable.ts +19 -0
  325. package/typescript/is-selected.ts +31 -0
  326. package/typescript/remove-local-storage-item.ts +27 -0
  327. package/typescript/remove-session-storage-item.ts +27 -0
  328. package/typescript/set-local-storage-item.ts +28 -0
  329. package/typescript/set-session-storage-item.ts +28 -0
  330. package/typescript/submit.ts +53 -0
  331. package/typescript/type.ts +210 -0
@@ -0,0 +1,294 @@
1
+ // Licensed to the Software Freedom Conservancy (SFC) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The SFC licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+ import isShown from './core/shown.js';
18
+ import { isElement } from './core/element.js';
19
+ import { getEffectiveStyle } from './core/style.js';
20
+ // Display values that do not force a newline before and after the element.
21
+ // "none" is in this list because display:none elements are skipped entirely
22
+ // and should not contribute a line break to the running line.
23
+ // "table-cell" and the column-group values are inline for line-break purposes
24
+ // even though they lay out in a grid. (dom.js line 1149)
25
+ const INLINE_DISPLAY_BOXES = [
26
+ 'inline',
27
+ 'inline-block',
28
+ 'inline-table',
29
+ 'none',
30
+ 'table-cell',
31
+ 'table-column',
32
+ 'table-column-group',
33
+ ];
34
+ // Two patterns for text-transform:capitalize, applied in order: the first
35
+ // titlecases the first letter of each word; the second titlecases a letter
36
+ // that opens a "_"- or "*"-delimited run. Unicode property escapes require the
37
+ // ES2015 "u" flag; the catch block supplies Latin-only fallback patterns for
38
+ // any engine that does not support them. (dom.js lines 1178-1193)
39
+ //
40
+ // NOTE: All patterns here use the RegExp constructor rather than literals.
41
+ // The fallback patterns use \uXXXX in string form so they survive any source
42
+ // file encoding that might convert the escape to a literal character (which
43
+ // would then be treated as a line terminator by the TypeScript parser).
44
+ const CAPITALIZE_PATTERNS = (function () {
45
+ var letter = '\\p{L}\\u24B6-\\u24E9';
46
+ var wordCharacter = '\'_\\p{M}\\p{N}' + letter;
47
+ try {
48
+ return [
49
+ new RegExp('(^|[^' + wordCharacter + '])([' + letter + '])', 'gu'),
50
+ new RegExp('(^|[^' + wordCharacter + '])([_*])([' + letter + '])', 'gu'),
51
+ ];
52
+ }
53
+ catch (_ignored) {
54
+ // Latin-only fallback for engines without Unicode property escape support.
55
+ var latinLetters = 'A-Za-z\\u00C0-\\u02AF\\u1E00-\\u1EFF\\u24B6-\\u24E9';
56
+ var wordChars = '\'_0-9' + latinLetters + '\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF';
57
+ var lowerLetters = 'A-Za-z\\u00C0-\\u02AF\\u1E00-\\u1EFF\\u24D0-\\u24E9';
58
+ return [
59
+ new RegExp('(^|[^' + wordChars + '])([' + latinLetters + '])', 'g'),
60
+ new RegExp('(^|[^' + wordChars + '])([_*])([' + lowerLetters + '])', 'g'),
61
+ ];
62
+ }
63
+ })();
64
+ // U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) are treated as
65
+ // breaking spaces by the spec and as line terminators by ES2017 and earlier,
66
+ // so they cannot appear literally inside a regex literal in TypeScript source.
67
+ // Use the RegExp constructor instead. (dom.js lines 1226-1230)
68
+ const BREAKING_SPACE_RE = new RegExp('[ \\f\\t\\v\\u2028\\u2029]+', 'g');
69
+ const PRE_SPACE_RE = new RegExp('[ \\f\\t\\v\\u2028\\u2029]', 'g');
70
+ // Trims all whitespace except NBSP (\xa0) from both ends of a string.
71
+ // (dom.js line 999: bot.dom.trimExcludingNonBreakingSpaceCharacters_)
72
+ function trimExcludingNbsp(str) {
73
+ return str.replace(/^[^\S\xa0]+|[^\S\xa0]+$/g, '');
74
+ }
75
+ // goog.string.isEmptyOrWhitespace treats \xa0 as whitespace for this check.
76
+ // (referenced at dom.js lines 1079, 1115)
77
+ function isEmptyOrWhitespace(str) {
78
+ return /^[\s\xa0]*$/.test(str);
79
+ }
80
+ // Joins the accumulated lines with '\n', trims each line and the overall
81
+ // result (excluding NBSP), then converts all remaining NBSP to regular spaces.
82
+ // (dom.js line 1010: bot.dom.concatenateCleanedLines_)
83
+ function concatenateCleanedLines(lines) {
84
+ const trimmedLines = lines.map(trimExcludingNbsp);
85
+ const joined = trimmedLines.join('\n');
86
+ const trimmed = trimExcludingNbsp(joined);
87
+ return trimmed.replace(/\xa0/g, ' ');
88
+ }
89
+ // Appends the visible contribution of a text node to the running lines array,
90
+ // applying white-space collapsing rules and text-transform.
91
+ // (dom.js line 1203: bot.dom.appendVisibleTextLinesFromTextNode_)
92
+ function appendTextFromTextNode(textNode, lines, whitespace, textTransform) {
93
+ // Strip zero-width non-printing characters before regularising spaces, so
94
+ // the zero-width space, which is technically also a space, is not
95
+ // promoted to a regular space. (dom.js 1213)
96
+ // Stripped: U+200B (zero-width space), U+200E (LTR mark), U+200F (RTL mark).
97
+ var text = (textNode.nodeValue || '').replace(/[\u200b\u200e\u200f]/g, '');
98
+ // goog.string.canonicalizeNewlines: normalise \r\n and bare \r to \n.
99
+ // (dom.js 1218)
100
+ text = text.replace(/(\r\n|\r|\n)/g, '\n');
101
+ // white-space: normal and nowrap collapse newlines into spaces.
102
+ if (whitespace === 'normal' || whitespace === 'nowrap') {
103
+ text = text.replace(/\n/g, ' ');
104
+ }
105
+ // white-space: pre and pre-wrap protect internal spacing by converting
106
+ // breaking spaces to NBSP so they survive the later collapsing pass.
107
+ // All other white-space values collapse runs of breaking space to one space.
108
+ // PRE_SPACE_RE and BREAKING_SPACE_RE cover space, \f, \t, \v, U+2028, U+2029
109
+ // (dom.js 1226-1230; constructed as RegExp to avoid literal line terminators)
110
+ if (whitespace === 'pre' || whitespace === 'pre-wrap') {
111
+ text = text.replace(PRE_SPACE_RE, '\xa0');
112
+ }
113
+ else {
114
+ text = text.replace(BREAKING_SPACE_RE, ' ');
115
+ }
116
+ // text-transform. The capitalize path applies both patterns in sequence:
117
+ // pattern 0 handles word-initial letters, pattern 1 handles letters
118
+ // immediately after a '_' or '*' that opens a run. (dom.js 1232-1247)
119
+ if (textTransform === 'capitalize') {
120
+ text = text.replace(CAPITALIZE_PATTERNS[0], function () {
121
+ return arguments[1] + arguments[2].toUpperCase();
122
+ });
123
+ text = text.replace(CAPITALIZE_PATTERNS[1], function () {
124
+ return arguments[1] + arguments[2] + arguments[3].toUpperCase();
125
+ });
126
+ }
127
+ else if (textTransform === 'uppercase') {
128
+ text = text.toUpperCase();
129
+ }
130
+ else if (textTransform === 'lowercase') {
131
+ text = text.toLowerCase();
132
+ }
133
+ // Merge into the last accumulated line. If the current line already ends
134
+ // with a space and the new text starts with one, drop the duplicate.
135
+ // (dom.js 1249-1254)
136
+ var currLine = lines.pop() || '';
137
+ if (currLine.endsWith(' ') && text.startsWith(' ')) {
138
+ text = text.substring(1);
139
+ }
140
+ lines.push(currLine + text);
141
+ }
142
+ // Core element traversal shared by both the flat-DOM and composed-DOM paths.
143
+ // isShownFn and childNodeFn are injected so each path plugs in its own
144
+ // visibility check and child dispatch. (dom.js lines 1049-1119)
145
+ function appendTextFromElementCommon(elem, lines, isShownFn, childNodeFn) {
146
+ function currLine() {
147
+ var _a;
148
+ return (_a = lines[lines.length - 1]) !== null && _a !== void 0 ? _a : '';
149
+ }
150
+ // Guarded through a Node-typed alias: isElement returns `node is Element`,
151
+ // so testing elem directly would narrow it to never for the whole of the
152
+ // early-return's else path. isElement rather than a nodeName comparison
153
+ // because it uppercases for XML documents and reads tagName through its
154
+ // descriptor, which a clobbering `name="tagName"` cannot shadow.
155
+ const node = elem;
156
+ if (isElement(node, 'BR')) {
157
+ lines.push('');
158
+ return;
159
+ }
160
+ const isTD = isElement(elem, 'TD');
161
+ const display = getEffectiveStyle(elem, 'display');
162
+ // <td> sometimes reports a block display value; treat it as inline so it
163
+ // behaves like a table cell for newline purposes. (dom.js 1063)
164
+ const isBlock = !isTD && !INLINE_DISPLAY_BOXES.includes(display || '');
165
+ // Insert a newline before a block element when the current line is non-empty,
166
+ // unless the previous sibling uses display:run-in (which flows into this
167
+ // element). A floated element is never run into. (dom.js 1070-1081)
168
+ // Dropped: styleFloat (IE-only). getPropertyValue('float') is the CSS name.
169
+ const previousElementSibling = elem.previousElementSibling;
170
+ const prevDisplay = previousElementSibling
171
+ ? getEffectiveStyle(previousElementSibling, 'display')
172
+ : '';
173
+ const thisFloat = getEffectiveStyle(elem, 'float');
174
+ const runIntoThis = prevDisplay === 'run-in' && thisFloat === 'none';
175
+ if (isBlock && !runIntoThis && !isEmptyOrWhitespace(currLine())) {
176
+ lines.push('');
177
+ }
178
+ // A non-shown element still traverses its children so that a child with an
179
+ // explicit visibility:visible can contribute its text even when the parent
180
+ // has visibility:hidden. Text nodes that are direct children of a non-shown
181
+ // element are silenced via shown=false. (dom.js 1084-1088)
182
+ const shown = isShownFn(elem);
183
+ var whitespace = null;
184
+ var textTransform = null;
185
+ if (shown) {
186
+ whitespace = getEffectiveStyle(elem, 'white-space');
187
+ textTransform = getEffectiveStyle(elem, 'text-transform');
188
+ }
189
+ for (var i = 0; i < elem.childNodes.length; i++) {
190
+ childNodeFn(elem.childNodes[i], lines, shown, whitespace, textTransform);
191
+ }
192
+ const line = currLine();
193
+ // Table cells are separated by a space, not a tab. (dom.js 1107-1110)
194
+ if ((isTD || display === 'table-cell') && line && !line.endsWith(' ')) {
195
+ lines[lines.length - 1] += ' ';
196
+ }
197
+ // Insert a newline after a block element when there is content on the
198
+ // current line, unless this element itself uses display:run-in.
199
+ // (dom.js 1114-1117)
200
+ if (isBlock && display !== 'run-in' && !isEmptyOrWhitespace(line)) {
201
+ lines.push('');
202
+ }
203
+ }
204
+ // Flat-DOM traversal: no Shadow DOM awareness.
205
+ // (dom.js lines 1127-1140: bot.dom.appendVisibleTextLinesFromElement_)
206
+ function appendTextFromElement(elem, lines) {
207
+ appendTextFromElementCommon(elem, lines, isShown, function (node, lines, shown, whitespace, textTransform) {
208
+ if (node.nodeType === Node.TEXT_NODE && shown) {
209
+ appendTextFromTextNode(node, lines, whitespace, textTransform);
210
+ }
211
+ else if (isElement(node)) {
212
+ appendTextFromElement(node, lines);
213
+ }
214
+ });
215
+ }
216
+ // Whether a node has been distributed (slotted) into a Shadow DOM element to
217
+ // be rendered elsewhere. When true the node must not be appended from its
218
+ // original position — the slot will append it. (dom.js lines 1437-1448)
219
+ // Dropped: getDestinationInsertionPoints (Shadow DOM v0, removed from browsers).
220
+ function isNodeDistributedIntoShadowDom(node) {
221
+ if (node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE) {
222
+ var slottable = node;
223
+ return slottable.assignedSlot != null;
224
+ }
225
+ return false;
226
+ }
227
+ // Composed-DOM node dispatch (Shadow DOM v1).
228
+ // (dom.js lines 1363-1428: bot.dom.appendVisibleTextLinesFromNodeInComposedDom_)
229
+ // Dropped: <CONTENT> element (Shadow DOM v0 only).
230
+ // Dropped: <SHADOW> element and olderShadowRoot (Shadow DOM v0 only).
231
+ function appendTextFromNodeInComposedDom(node, lines, shown, whitespace, textTransform) {
232
+ if (node.nodeType === Node.TEXT_NODE && shown) {
233
+ appendTextFromTextNode(node, lines, whitespace, textTransform);
234
+ }
235
+ else if (isElement(node)) {
236
+ const castElem = node;
237
+ if (isElement(node, 'SLOT')) {
238
+ // <slot> distributes its assigned nodes. Walk up to see whether we're
239
+ // inside a ShadowRoot; if not, fall through to treat it as an unknown
240
+ // element. (dom.js 1373-1399 adapted for v1)
241
+ var parentNode = node;
242
+ while (parentNode.parentNode) {
243
+ parentNode = parentNode.parentNode;
244
+ }
245
+ if (typeof ShadowRoot === 'function' && parentNode instanceof ShadowRoot) {
246
+ const slot = node;
247
+ const assigned = slot.assignedNodes();
248
+ const childrenToTraverse = assigned.length > 0 ? assigned : slot.childNodes;
249
+ for (var i = 0; i < childrenToTraverse.length; i++) {
250
+ appendTextFromNodeInComposedDom(childrenToTraverse[i], lines, shown, whitespace, textTransform);
251
+ }
252
+ }
253
+ else {
254
+ appendTextFromElementInComposedDom(castElem, lines);
255
+ }
256
+ }
257
+ else {
258
+ appendTextFromElementInComposedDom(castElem, lines);
259
+ }
260
+ }
261
+ }
262
+ // Composed-DOM element traversal (Shadow DOM v1). Expands shadow roots before
263
+ // processing the element's own children so that slotted content is encountered
264
+ // in display order. (dom.js lines 1457-1481)
265
+ function appendTextFromElementInComposedDom(elem, lines) {
266
+ if (elem.shadowRoot) {
267
+ const whitespace = getEffectiveStyle(elem, 'white-space');
268
+ const textTransform = getEffectiveStyle(elem, 'text-transform');
269
+ elem.shadowRoot.childNodes.forEach(node => appendTextFromNodeInComposedDom(node, lines, true, whitespace, textTransform));
270
+ }
271
+ appendTextFromElementCommon(elem, lines, isShown, function (node, lines, shown, whitespace, textTransform) {
272
+ // Skip nodes that have been slotted elsewhere; they will be appended
273
+ // from their slot position in the composed tree. (dom.js 1472-1479)
274
+ if (!isNodeDistributedIntoShadowDom(node)) {
275
+ appendTextFromNodeInComposedDom(node, lines, shown, whitespace, textTransform);
276
+ }
277
+ });
278
+ }
279
+ // Returns the visible text of an element, matching bot.dom.getVisibleText and
280
+ // webdriver.atoms.element.getText. Uses the composed-DOM path on browsers that
281
+ // support ShadowRoot (every browser we support), falling back to the flat-DOM
282
+ // path otherwise. (dom.js lines 1026-1035)
283
+ function getText(element) {
284
+ const lines = [];
285
+ if (typeof ShadowRoot === 'function') {
286
+ appendTextFromElementInComposedDom(element, lines);
287
+ }
288
+ else {
289
+ appendTextFromElement(element, lines);
290
+ }
291
+ return concatenateCleanedLines(lines);
292
+ }
293
+ export default getText;
294
+ //# sourceMappingURL=get-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-text.js","sourceRoot":"","sources":["../../typescript/get-text.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;AAErB,OAAO,OAAO,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,2EAA2E;AAC3E,4EAA4E;AAC5E,8DAA8D;AAC9D,8EAA8E;AAC9E,yDAAyD;AACzD,MAAM,oBAAoB,GAA0B;IAClD,QAAQ;IACR,cAAc;IACd,cAAc;IACd,MAAM;IACN,YAAY;IACZ,cAAc;IACd,oBAAoB;CACrB,CAAA;AAED,0EAA0E;AA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C,+BAA+B,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAA;IAClF,CAAC;IAED,2BAA2B,CACzB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,UAAU,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa;QACrD,qEAAqE;QACrE,oEAAoE;QACpE,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,+BAA+B,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;QAChF,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,2CAA2C;AAC3C,SAAS,OAAO,CAAC,OAAgB;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;QACrC,kCAAkC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACpD,CAAC;SAAM,CAAC;QACN,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Coordinate, Region } from './core/geometry.js';
2
+ declare function getTopLeftCoordinates(element: Element, optRegion?: Region): Coordinate;
3
+ export default getTopLeftCoordinates;
4
+ //# sourceMappingURL=get-top-left-coordinates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-top-left-coordinates.d.ts","sourceRoot":"","sources":["../../typescript/get-top-left-coordinates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAA;AAcxE,iBAAS,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAI/E;AAED,eAAe,qBAAqB,CAAA"}
@@ -0,0 +1,36 @@
1
+ // Licensed to the Software Freedom Conservancy (SFC) under one
2
+ // or more contributor license agreements. See the NOTICE file
3
+ // distributed with this work for additional information
4
+ // regarding copyright ownership. The SFC licenses this file
5
+ // to you under the Apache License, Version 2.0 (the
6
+ // "License"); you may not use this file except in compliance
7
+ // with the License. You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing,
12
+ // software distributed under the License is distributed on an
13
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ // KIND, either express or implied. See the License for the
15
+ // specific language governing permissions and limitations
16
+ // under the License.
17
+ import { getClientRegion } from './core/geometry.js';
18
+ import { scrollIntoView } from './core/scroll.js';
19
+ // Scrolls the element into the viewport and returns its position in client
20
+ // space.
21
+ //
22
+ // This is webdriver.atoms.element.getLocationInView, and it is the one atom
23
+ // outside the inject layer that mutates page state: it scrolls, and the scroll
24
+ // position is still changed when it returns. Callers that only want to read a
25
+ // position want get_location, which is page-space and moves nothing.
26
+ //
27
+ // optRegion narrows the target to a sub-region of the element, which is how
28
+ // callers scroll a specific point -- a click target, say -- into view rather
29
+ // than the element as a whole.
30
+ function getTopLeftCoordinates(element, optRegion) {
31
+ scrollIntoView(element, optRegion);
32
+ const region = getClientRegion(element, optRegion);
33
+ return { x: region.left, y: region.top };
34
+ }
35
+ export default getTopLeftCoordinates;
36
+ //# sourceMappingURL=get-top-left-coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-top-left-coordinates.js","sourceRoot":"","sources":["../../typescript/get-top-left-coordinates.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;AAErB,OAAO,EAAsB,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,2EAA2E;AAC3E,SAAS;AACT,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,qEAAqE;AACrE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,+BAA+B;AAC/B,SAAS,qBAAqB,CAAC,OAAgB,EAAE,SAAkB;IACjE,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAClC,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAClD,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,CAAA;AAC1C,CAAC;AAED,eAAe,qBAAqB,CAAA"}
@@ -1,3 +1,2 @@
1
- declare function isShownElement(elem: Element, optIgnoreOpacity?: boolean): boolean;
2
- export default isShownElement;
1
+ export { default } from './core/shown.js';
3
2
  //# sourceMappingURL=is-displayed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-displayed.d.ts","sourceRoot":"","sources":["../../typescript/is-displayed.ts"],"names":[],"mappings":"AA2CA,iBAAS,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,OAAO,CAqd1E;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"is-displayed.d.ts","sourceRoot":"","sources":["../../typescript/is-displayed.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA"}