@selenium/atoms 4.51.0 → 4.53.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.
- package/README.md +56 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/typescript/accessibility-snapshot-wire.d.ts +4 -0
- package/dist/typescript/accessibility-snapshot-wire.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot-wire.js +18 -0
- package/dist/typescript/accessibility-snapshot-wire.js.map +1 -0
- package/dist/typescript/accessibility-snapshot.d.ts +3 -0
- package/dist/typescript/accessibility-snapshot.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot.js +18 -0
- package/dist/typescript/accessibility-snapshot.js.map +1 -0
- package/dist/typescript/active-element.d.ts +2 -0
- package/dist/typescript/active-element.d.ts.map +1 -0
- package/dist/typescript/active-element.js +19 -0
- package/dist/typescript/active-element.js.map +1 -0
- package/dist/typescript/clear-local-storage.d.ts +3 -0
- package/dist/typescript/clear-local-storage.d.ts.map +1 -0
- package/dist/typescript/clear-local-storage.js +25 -0
- package/dist/typescript/clear-local-storage.js.map +1 -0
- package/dist/typescript/clear-session-storage.d.ts +3 -0
- package/dist/typescript/clear-session-storage.d.ts.map +1 -0
- package/dist/typescript/clear-session-storage.js +25 -0
- package/dist/typescript/clear-session-storage.js.map +1 -0
- package/dist/typescript/clear.d.ts +3 -0
- package/dist/typescript/clear.d.ts.map +1 -0
- package/dist/typescript/clear.js +67 -0
- package/dist/typescript/clear.js.map +1 -0
- package/dist/typescript/click.d.ts +4 -0
- package/dist/typescript/click.d.ts.map +1 -0
- package/dist/typescript/click.js +52 -0
- package/dist/typescript/click.js.map +1 -0
- package/dist/typescript/core/accessibility/accname.d.ts +6 -0
- package/dist/typescript/core/accessibility/accname.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/accname.js +537 -0
- package/dist/typescript/core/accessibility/accname.js.map +1 -0
- package/dist/typescript/core/accessibility/context.d.ts +43 -0
- package/dist/typescript/core/accessibility/context.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/context.js +49 -0
- package/dist/typescript/core/accessibility/context.js.map +1 -0
- package/dist/typescript/core/accessibility/hidden.d.ts +39 -0
- package/dist/typescript/core/accessibility/hidden.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/hidden.js +216 -0
- package/dist/typescript/core/accessibility/hidden.js.map +1 -0
- package/dist/typescript/core/accessibility/roles.d.ts +28 -0
- package/dist/typescript/core/accessibility/roles.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/roles.js +381 -0
- package/dist/typescript/core/accessibility/roles.js.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts +13 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.js +55 -0
- package/dist/typescript/core/accessibility/snapshot.js.map +1 -0
- package/dist/typescript/core/accessibility/states.d.ts +18 -0
- package/dist/typescript/core/accessibility/states.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/states.js +215 -0
- package/dist/typescript/core/accessibility/states.js.map +1 -0
- package/dist/typescript/core/accessibility/tree.d.ts +10 -0
- package/dist/typescript/core/accessibility/tree.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/tree.js +261 -0
- package/dist/typescript/core/accessibility/tree.js.map +1 -0
- package/dist/typescript/core/accessibility/types.d.ts +30 -0
- package/dist/typescript/core/accessibility/types.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/types.js +18 -0
- package/dist/typescript/core/accessibility/types.js.map +1 -0
- package/dist/typescript/core/accessibility/value.d.ts +4 -0
- package/dist/typescript/core/accessibility/value.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/value.js +83 -0
- package/dist/typescript/core/accessibility/value.js.map +1 -0
- package/dist/typescript/core/accessibility/wire.d.ts +57 -0
- package/dist/typescript/core/accessibility/wire.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/wire.js +72 -0
- package/dist/typescript/core/accessibility/wire.js.map +1 -0
- package/dist/typescript/core/attribute.d.ts +3 -0
- package/dist/typescript/core/attribute.d.ts.map +1 -0
- package/dist/typescript/core/attribute.js +60 -0
- package/dist/typescript/core/attribute.js.map +1 -0
- package/dist/typescript/core/color.d.ts +2 -0
- package/dist/typescript/core/color.d.ts.map +1 -0
- package/dist/typescript/core/color.js +248 -0
- package/dist/typescript/core/color.js.map +1 -0
- package/dist/typescript/core/editable.d.ts +5 -0
- package/dist/typescript/core/editable.d.ts.map +1 -0
- package/dist/typescript/core/editable.js +55 -0
- package/dist/typescript/core/editable.js.map +1 -0
- package/dist/typescript/core/element.d.ts +6 -0
- package/dist/typescript/core/element.d.ts.map +1 -0
- package/dist/typescript/core/element.js +97 -0
- package/dist/typescript/core/element.js.map +1 -0
- package/dist/typescript/core/enabled.d.ts +2 -0
- package/dist/typescript/core/enabled.d.ts.map +1 -0
- package/dist/typescript/core/enabled.js +69 -0
- package/dist/typescript/core/enabled.js.map +1 -0
- package/dist/typescript/core/error.d.ts +13 -0
- package/dist/typescript/core/error.d.ts.map +1 -0
- package/dist/typescript/core/error.js +40 -0
- package/dist/typescript/core/error.js.map +1 -0
- package/dist/typescript/core/events.d.ts +91 -0
- package/dist/typescript/core/events.d.ts.map +1 -0
- package/dist/typescript/core/events.js +131 -0
- package/dist/typescript/core/events.js.map +1 -0
- package/dist/typescript/core/focus.d.ts +4 -0
- package/dist/typescript/core/focus.d.ts.map +1 -0
- package/dist/typescript/core/focus.js +88 -0
- package/dist/typescript/core/focus.js.map +1 -0
- package/dist/typescript/core/focusable.d.ts +2 -0
- package/dist/typescript/core/focusable.d.ts.map +1 -0
- package/dist/typescript/core/focusable.js +36 -0
- package/dist/typescript/core/focusable.js.map +1 -0
- package/dist/typescript/core/form.d.ts +2 -0
- package/dist/typescript/core/form.d.ts.map +1 -0
- package/dist/typescript/core/form.js +76 -0
- package/dist/typescript/core/form.js.map +1 -0
- package/dist/typescript/core/frame.d.ts +8 -0
- package/dist/typescript/core/frame.d.ts.map +1 -0
- package/dist/typescript/core/frame.js +95 -0
- package/dist/typescript/core/frame.js.map +1 -0
- package/dist/typescript/core/geometry.d.ts +28 -0
- package/dist/typescript/core/geometry.d.ts.map +1 -0
- package/dist/typescript/core/geometry.js +134 -0
- package/dist/typescript/core/geometry.js.map +1 -0
- package/dist/typescript/core/inject.d.ts +21 -0
- package/dist/typescript/core/inject.d.ts.map +1 -0
- package/dist/typescript/core/inject.js +282 -0
- package/dist/typescript/core/inject.js.map +1 -0
- package/dist/typescript/core/interactable.d.ts +2 -0
- package/dist/typescript/core/interactable.d.ts.map +1 -0
- package/dist/typescript/core/interactable.js +27 -0
- package/dist/typescript/core/interactable.js.map +1 -0
- package/dist/typescript/core/keyboard.d.ts +15 -0
- package/dist/typescript/core/keyboard.d.ts.map +1 -0
- package/dist/typescript/core/keyboard.js +356 -0
- package/dist/typescript/core/keyboard.js.map +1 -0
- package/dist/typescript/core/keys.d.ts +65 -0
- package/dist/typescript/core/keys.d.ts.map +1 -0
- package/dist/typescript/core/keys.js +125 -0
- package/dist/typescript/core/keys.js.map +1 -0
- package/dist/typescript/core/locators.d.ts +6 -0
- package/dist/typescript/core/locators.d.ts.map +1 -0
- package/dist/typescript/core/locators.js +610 -0
- package/dist/typescript/core/locators.js.map +1 -0
- package/dist/typescript/core/mouse.d.ts +17 -0
- package/dist/typescript/core/mouse.d.ts.map +1 -0
- package/dist/typescript/core/mouse.js +186 -0
- package/dist/typescript/core/mouse.js.map +1 -0
- package/dist/typescript/core/overflow.d.ts +5 -0
- package/dist/typescript/core/overflow.d.ts.map +1 -0
- package/dist/typescript/core/overflow.js +133 -0
- package/dist/typescript/core/overflow.js.map +1 -0
- package/dist/typescript/core/scroll.d.ts +3 -0
- package/dist/typescript/core/scroll.d.ts.map +1 -0
- package/dist/typescript/core/scroll.js +77 -0
- package/dist/typescript/core/scroll.js.map +1 -0
- package/dist/typescript/core/shown.d.ts +3 -0
- package/dist/typescript/core/shown.d.ts.map +1 -0
- package/dist/typescript/core/shown.js +190 -0
- package/dist/typescript/core/shown.js.map +1 -0
- package/dist/typescript/core/storage.d.ts +14 -0
- package/dist/typescript/core/storage.d.ts.map +1 -0
- package/dist/typescript/core/storage.js +98 -0
- package/dist/typescript/core/storage.js.map +1 -0
- package/dist/typescript/core/style.d.ts +2 -0
- package/dist/typescript/core/style.d.ts.map +1 -0
- package/dist/typescript/core/style.js +32 -0
- package/dist/typescript/core/style.js.map +1 -0
- package/dist/typescript/core/useragent.d.ts +3 -0
- package/dist/typescript/core/useragent.d.ts.map +1 -0
- package/dist/typescript/core/useragent.js +31 -0
- package/dist/typescript/core/useragent.js.map +1 -0
- package/dist/typescript/default-content.d.ts +2 -0
- package/dist/typescript/default-content.d.ts.map +1 -0
- package/dist/typescript/default-content.js +20 -0
- package/dist/typescript/default-content.js.map +1 -0
- package/dist/typescript/execute-async-script.d.ts +2 -0
- package/dist/typescript/execute-async-script.d.ts.map +1 -0
- package/dist/typescript/execute-async-script.js +20 -0
- package/dist/typescript/execute-async-script.js.map +1 -0
- package/dist/typescript/execute-script.d.ts +2 -0
- package/dist/typescript/execute-script.d.ts.map +1 -0
- package/dist/typescript/execute-script.js +20 -0
- package/dist/typescript/execute-script.js.map +1 -0
- package/dist/typescript/find-element-fragment.d.ts +8 -0
- package/dist/typescript/find-element-fragment.d.ts.map +1 -0
- package/dist/typescript/find-element-fragment.js +39 -0
- package/dist/typescript/find-element-fragment.js.map +1 -0
- package/dist/typescript/find-element.d.ts +2 -0
- package/dist/typescript/find-element.d.ts.map +1 -0
- package/dist/typescript/find-element.js +18 -0
- package/dist/typescript/find-element.js.map +1 -0
- package/dist/typescript/find-elements.d.ts +1 -2
- package/dist/typescript/find-elements.d.ts.map +1 -1
- package/dist/typescript/find-elements.js +1 -289
- package/dist/typescript/find-elements.js.map +1 -1
- package/dist/typescript/frame-by-id-or-name.d.ts +2 -0
- package/dist/typescript/frame-by-id-or-name.d.ts.map +1 -0
- package/dist/typescript/frame-by-id-or-name.js +22 -0
- package/dist/typescript/frame-by-id-or-name.js.map +1 -0
- package/dist/typescript/frame-by-index.d.ts +2 -0
- package/dist/typescript/frame-by-index.d.ts.map +1 -0
- package/dist/typescript/frame-by-index.js +19 -0
- package/dist/typescript/frame-by-index.js.map +1 -0
- package/dist/typescript/get-attribute-value.d.ts +2 -0
- package/dist/typescript/get-attribute-value.d.ts.map +1 -0
- package/dist/typescript/get-attribute-value.js +22 -0
- package/dist/typescript/get-attribute-value.js.map +1 -0
- package/dist/typescript/get-effective-style.d.ts +3 -0
- package/dist/typescript/get-effective-style.d.ts.map +1 -0
- package/dist/typescript/get-effective-style.js +84 -0
- package/dist/typescript/get-effective-style.js.map +1 -0
- package/dist/typescript/get-element-from-cache.d.ts +2 -0
- package/dist/typescript/get-element-from-cache.d.ts.map +1 -0
- package/dist/typescript/get-element-from-cache.js +20 -0
- package/dist/typescript/get-element-from-cache.js.map +1 -0
- package/dist/typescript/get-frame-window.d.ts +2 -0
- package/dist/typescript/get-frame-window.d.ts.map +1 -0
- package/dist/typescript/get-frame-window.js +22 -0
- package/dist/typescript/get-frame-window.js.map +1 -0
- package/dist/typescript/get-local-storage-item.d.ts +3 -0
- package/dist/typescript/get-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-item.js +25 -0
- package/dist/typescript/get-local-storage-item.js.map +1 -0
- package/dist/typescript/get-local-storage-key.d.ts +3 -0
- package/dist/typescript/get-local-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-key.js +26 -0
- package/dist/typescript/get-local-storage-key.js.map +1 -0
- package/dist/typescript/get-local-storage-keys.d.ts +3 -0
- package/dist/typescript/get-local-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-keys.js +25 -0
- package/dist/typescript/get-local-storage-keys.js.map +1 -0
- package/dist/typescript/get-local-storage-size.d.ts +3 -0
- package/dist/typescript/get-local-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-size.js +25 -0
- package/dist/typescript/get-local-storage-size.js.map +1 -0
- package/dist/typescript/get-location.d.ts +9 -0
- package/dist/typescript/get-location.d.ts.map +1 -0
- package/dist/typescript/get-location.js +49 -0
- package/dist/typescript/get-location.js.map +1 -0
- package/dist/typescript/get-session-storage-item.d.ts +3 -0
- package/dist/typescript/get-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-item.js +25 -0
- package/dist/typescript/get-session-storage-item.js.map +1 -0
- package/dist/typescript/get-session-storage-key.d.ts +3 -0
- package/dist/typescript/get-session-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-key.js +26 -0
- package/dist/typescript/get-session-storage-key.js.map +1 -0
- package/dist/typescript/get-session-storage-keys.d.ts +3 -0
- package/dist/typescript/get-session-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-keys.js +25 -0
- package/dist/typescript/get-session-storage-keys.js.map +1 -0
- package/dist/typescript/get-session-storage-size.d.ts +3 -0
- package/dist/typescript/get-session-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-size.js +25 -0
- package/dist/typescript/get-session-storage-size.js.map +1 -0
- package/dist/typescript/get-size.d.ts +7 -0
- package/dist/typescript/get-size.d.ts.map +1 -0
- package/dist/typescript/get-size.js +36 -0
- package/dist/typescript/get-size.js.map +1 -0
- package/dist/typescript/get-text.d.ts +3 -0
- package/dist/typescript/get-text.d.ts.map +1 -0
- package/dist/typescript/get-text.js +294 -0
- package/dist/typescript/get-text.js.map +1 -0
- package/dist/typescript/get-top-left-coordinates.d.ts +4 -0
- package/dist/typescript/get-top-left-coordinates.d.ts.map +1 -0
- package/dist/typescript/get-top-left-coordinates.js +36 -0
- package/dist/typescript/get-top-left-coordinates.js.map +1 -0
- package/dist/typescript/is-displayed.d.ts +1 -2
- package/dist/typescript/is-displayed.d.ts.map +1 -1
- package/dist/typescript/is-displayed.js +3 -396
- package/dist/typescript/is-displayed.js.map +1 -1
- package/dist/typescript/is-editable.d.ts +2 -0
- package/dist/typescript/is-editable.d.ts.map +1 -0
- package/dist/typescript/is-editable.js +18 -0
- package/dist/typescript/is-editable.js.map +1 -0
- package/dist/typescript/is-enabled.d.ts +2 -0
- package/dist/typescript/is-enabled.d.ts.map +1 -0
- package/dist/typescript/is-enabled.js +18 -0
- package/dist/typescript/is-enabled.js.map +1 -0
- package/dist/typescript/is-focusable.d.ts +2 -0
- package/dist/typescript/is-focusable.d.ts.map +1 -0
- package/dist/typescript/is-focusable.js +20 -0
- package/dist/typescript/is-focusable.js.map +1 -0
- package/dist/typescript/is-interactable.d.ts +2 -0
- package/dist/typescript/is-interactable.d.ts.map +1 -0
- package/dist/typescript/is-interactable.js +19 -0
- package/dist/typescript/is-interactable.js.map +1 -0
- package/dist/typescript/is-selected.d.ts +3 -0
- package/dist/typescript/is-selected.d.ts.map +1 -0
- package/dist/typescript/is-selected.js +29 -0
- package/dist/typescript/is-selected.js.map +1 -0
- package/dist/typescript/remove-local-storage-item.d.ts +3 -0
- package/dist/typescript/remove-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-local-storage-item.js +25 -0
- package/dist/typescript/remove-local-storage-item.js.map +1 -0
- package/dist/typescript/remove-session-storage-item.d.ts +3 -0
- package/dist/typescript/remove-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-session-storage-item.js +25 -0
- package/dist/typescript/remove-session-storage-item.js.map +1 -0
- package/dist/typescript/set-local-storage-item.d.ts +3 -0
- package/dist/typescript/set-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-local-storage-item.js +26 -0
- package/dist/typescript/set-local-storage-item.js.map +1 -0
- package/dist/typescript/set-session-storage-item.d.ts +3 -0
- package/dist/typescript/set-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-session-storage-item.js +26 -0
- package/dist/typescript/set-session-storage-item.js.map +1 -0
- package/dist/typescript/submit.d.ts +3 -0
- package/dist/typescript/submit.d.ts.map +1 -0
- package/dist/typescript/submit.js +50 -0
- package/dist/typescript/submit.js.map +1 -0
- package/dist/typescript/type.d.ts +3 -0
- package/dist/typescript/type.d.ts.map +1 -0
- package/dist/typescript/type.js +201 -0
- package/dist/typescript/type.js.map +1 -0
- package/index.ts +44 -0
- package/package.json +306 -5
- package/typescript/accessibility-snapshot-wire.ts +20 -0
- package/typescript/accessibility-snapshot.ts +21 -0
- package/typescript/active-element.ts +19 -0
- package/typescript/clear-local-storage.ts +27 -0
- package/typescript/clear-session-storage.ts +27 -0
- package/typescript/clear.ts +73 -0
- package/typescript/click.ts +55 -0
- package/typescript/core/accessibility/accname.ts +587 -0
- package/typescript/core/accessibility/context.ts +116 -0
- package/typescript/core/accessibility/hidden.ts +242 -0
- package/typescript/core/accessibility/roles.ts +410 -0
- package/typescript/core/accessibility/snapshot.ts +61 -0
- package/typescript/core/accessibility/states.ts +233 -0
- package/typescript/core/accessibility/tree.ts +306 -0
- package/typescript/core/accessibility/types.ts +52 -0
- package/typescript/core/accessibility/value.ts +89 -0
- package/typescript/core/accessibility/wire.ts +123 -0
- package/typescript/core/attribute.ts +68 -0
- package/typescript/core/color.ts +257 -0
- package/typescript/core/editable.ts +63 -0
- package/typescript/core/element.ts +110 -0
- package/typescript/core/enabled.ts +76 -0
- package/typescript/core/error.ts +41 -0
- package/typescript/core/events.ts +268 -0
- package/typescript/core/focus.ts +92 -0
- package/typescript/core/focusable.ts +38 -0
- package/typescript/core/form.ts +81 -0
- package/typescript/core/frame.ts +105 -0
- package/typescript/core/geometry.ts +183 -0
- package/typescript/core/inject.ts +336 -0
- package/typescript/core/interactable.ts +30 -0
- package/typescript/core/keyboard.ts +369 -0
- package/typescript/core/keys.ts +204 -0
- package/typescript/core/locators.ts +704 -0
- package/typescript/core/mouse.ts +211 -0
- package/typescript/core/overflow.ts +172 -0
- package/typescript/core/scroll.ts +92 -0
- package/typescript/core/shown.ts +233 -0
- package/typescript/core/storage.ts +111 -0
- package/typescript/core/style.ts +32 -0
- package/typescript/core/useragent.ts +33 -0
- package/typescript/default-content.ts +20 -0
- package/typescript/execute-async-script.ts +20 -0
- package/typescript/execute-script.ts +20 -0
- package/typescript/find-element-fragment.ts +45 -0
- package/typescript/find-element.ts +18 -0
- package/typescript/find-elements.ts +1 -326
- package/typescript/frame-by-id-or-name.ts +22 -0
- package/typescript/frame-by-index.ts +19 -0
- package/typescript/get-attribute-value.ts +22 -0
- package/typescript/get-effective-style.ts +93 -0
- package/typescript/get-element-from-cache.ts +20 -0
- package/typescript/get-frame-window.ts +22 -0
- package/typescript/get-local-storage-item.ts +27 -0
- package/typescript/get-local-storage-key.ts +28 -0
- package/typescript/get-local-storage-keys.ts +27 -0
- package/typescript/get-local-storage-size.ts +27 -0
- package/typescript/get-location.ts +63 -0
- package/typescript/get-session-storage-item.ts +27 -0
- package/typescript/get-session-storage-key.ts +28 -0
- package/typescript/get-session-storage-keys.ts +27 -0
- package/typescript/get-session-storage-size.ts +27 -0
- package/typescript/get-size.ts +43 -0
- package/typescript/get-text.ts +353 -0
- package/typescript/get-top-left-coordinates.ts +38 -0
- package/typescript/is-displayed.ts +3 -498
- package/typescript/is-editable.ts +18 -0
- package/typescript/is-enabled.ts +18 -0
- package/typescript/is-focusable.ts +20 -0
- package/typescript/is-interactable.ts +19 -0
- package/typescript/is-selected.ts +31 -0
- package/typescript/remove-local-storage-item.ts +27 -0
- package/typescript/remove-session-storage-item.ts +27 -0
- package/typescript/set-local-storage-item.ts +28 -0
- package/typescript/set-session-storage-item.ts +28 -0
- package/typescript/submit.ts +53 -0
- package/typescript/type.ts +210 -0
|
@@ -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 { getAttribute, getProperty } from './attribute.js';
|
|
18
|
+
import { isEditable } from './editable.js';
|
|
19
|
+
import { isElement } from './element.js';
|
|
20
|
+
// http://www.w3.org/TR/html401/interact/scripts.html#adef-onfocus
|
|
21
|
+
const FOCUSABLE_FORM_FIELDS = ['A', 'AREA', 'BUTTON', 'INPUT', 'LABEL', 'SELECT', 'TEXTAREA'];
|
|
22
|
+
// An element can take focus if it is a form field, carries a non-negative
|
|
23
|
+
// tabindex, or is editable.
|
|
24
|
+
export function isFocusable(element) {
|
|
25
|
+
if (FOCUSABLE_FORM_FIELDS.some((tagName) => isElement(element, tagName))) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
// The attribute has to be present for tabindex to count — the tabIndex
|
|
29
|
+
// property reports a default for several tags that were never marked up
|
|
30
|
+
// with one.
|
|
31
|
+
if (getAttribute(element, 'tabindex') != null && Number(getProperty(element, 'tabIndex')) >= 0) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return isEditable(element);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=focusable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusable.js","sourceRoot":"","sources":["../../../typescript/core/focusable.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,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,kEAAkE;AAClE,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;AAE7F,0EAA0E;AAC1E,4BAA4B;AAC5B,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,IAAI,CAAA;IACb,CAAC;IACD,uEAAuE;IACvE,wEAAwE;IACxE,YAAY;IACZ,IAAI,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/F,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../typescript/core/form.ts"],"names":[],"mappings":"AAuDA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAyB9D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { EventType, fire } from './events.js';
|
|
18
|
+
// <input> types that count against implicit submission (HTML, "implicit
|
|
19
|
+
// submission"): with more than one in the form and no submit button, Enter
|
|
20
|
+
// does not submit.
|
|
21
|
+
const BLOCKS_IMPLICIT_SUBMISSION = [
|
|
22
|
+
'text',
|
|
23
|
+
'search',
|
|
24
|
+
'url',
|
|
25
|
+
'tel',
|
|
26
|
+
'email',
|
|
27
|
+
'password',
|
|
28
|
+
'date',
|
|
29
|
+
'month',
|
|
30
|
+
'week',
|
|
31
|
+
'time',
|
|
32
|
+
'datetime-local',
|
|
33
|
+
'number',
|
|
34
|
+
];
|
|
35
|
+
function isSubmitButton(element) {
|
|
36
|
+
const type = element.type;
|
|
37
|
+
if (element.tagName === 'BUTTON') {
|
|
38
|
+
return type === 'submit';
|
|
39
|
+
}
|
|
40
|
+
return element.tagName === 'INPUT' && (type === 'submit' || type === 'image');
|
|
41
|
+
}
|
|
42
|
+
// Enter in a form field, as HTML defines it: click the form's default button
|
|
43
|
+
// (its first submit button), which submits through the button's own
|
|
44
|
+
// activation behaviour; with no button, submit only if the field is the one
|
|
45
|
+
// field that would block it.
|
|
46
|
+
//
|
|
47
|
+
// This replaces bot.Keyboard.maybeSubmitForm_, which looked only at <input>s
|
|
48
|
+
// (so a <button type=submit> never counted), counted hidden and checkbox
|
|
49
|
+
// inputs as fields, and submitted with form.submit() -- skipping both the
|
|
50
|
+
// click on the default button and constraint validation, which real Enter
|
|
51
|
+
// runs.
|
|
52
|
+
export function implicitlySubmit(field) {
|
|
53
|
+
const form = field.form;
|
|
54
|
+
if (!form) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Read through the prototype because a control named "elements" or
|
|
58
|
+
// "requestSubmit" shadows the form's own property.
|
|
59
|
+
const win = (form.ownerDocument.defaultView || window);
|
|
60
|
+
const formPrototype = win.HTMLFormElement.prototype;
|
|
61
|
+
const controls = Object.getOwnPropertyDescriptor(formPrototype, 'elements').get.call(form);
|
|
62
|
+
const elements = Array.from(controls);
|
|
63
|
+
const defaultButton = elements.find(isSubmitButton);
|
|
64
|
+
if (defaultButton) {
|
|
65
|
+
if (!defaultButton.disabled) {
|
|
66
|
+
// A keyboard-initiated click: no position and a click count of 0.
|
|
67
|
+
fire(defaultButton, EventType.CLICK, { clientX: 0, clientY: 0, detail: 0 });
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const blocking = elements.filter((element) => element.tagName === 'INPUT' && BLOCKS_IMPLICIT_SUBMISSION.includes(element.type));
|
|
72
|
+
if (blocking.length <= 1) {
|
|
73
|
+
formPrototype.requestSubmit.call(form);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../typescript/core/form.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,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAE7C,wEA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AAC,CAAA;IACnD,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC5B,kEAAkE;YAClE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;QAC7E,CAAC;QACD,OAAM;IACR,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAC9B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,IAAI,0BAA0B,CAAC,QAAQ,CAAE,OAA4B,CAAC,IAAI,CAAC,CACpH,CAAA;IACD,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACzB,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function isFrame(element: Element): boolean;
|
|
2
|
+
export declare function getFrameContentWindow(frame: HTMLIFrameElement | HTMLFrameElement): Window | null;
|
|
3
|
+
export declare function defaultContent(optWindow?: Window): Window | null;
|
|
4
|
+
export declare function activeElement(optWindow?: Window): Element;
|
|
5
|
+
export declare function getFrameWindow(element: Element): Window | null;
|
|
6
|
+
export declare function findFrameByNameOrId(nameOrId: string | number, optRoot?: Window): Window | null;
|
|
7
|
+
export declare function findFrameByIndex(index: number, optRoot?: Window): Window | null;
|
|
8
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../../typescript/core/frame.ts"],"names":[],"mappings":"AA4BA,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEjD;AAKD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAMhG;AAED,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhE;AAKD,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAK9D;AAaD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2B9F;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE/E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { isElement } from './element.js';
|
|
18
|
+
import { NO_SUCH_FRAME, botError } from './error.js';
|
|
19
|
+
import { findElements } from './locators.js';
|
|
20
|
+
// The window the atom is running in. Closure routed every one of these through
|
|
21
|
+
// bot.getWindow() because the inject layer retargets command execution at a
|
|
22
|
+
// frame; an atom called directly is already in the frame it is asking about.
|
|
23
|
+
function windowOr(optWindow) {
|
|
24
|
+
return optWindow || window;
|
|
25
|
+
}
|
|
26
|
+
export function isFrame(element) {
|
|
27
|
+
return isElement(element, 'FRAME') || isElement(element, 'IFRAME');
|
|
28
|
+
}
|
|
29
|
+
// goog.dom.getFrameContentWindow. Returning null rather than propagating is
|
|
30
|
+
// the contract -- a frame that is detached, or whose document cannot be
|
|
31
|
+
// reached, is reported as "no window" rather than as a failure.
|
|
32
|
+
export function getFrameContentWindow(frame) {
|
|
33
|
+
try {
|
|
34
|
+
return frame.contentWindow || (frame.contentDocument ? frame.contentDocument.defaultView : null);
|
|
35
|
+
}
|
|
36
|
+
catch (_unreachable) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function defaultContent(optWindow) {
|
|
41
|
+
return windowOr(optWindow).top;
|
|
42
|
+
}
|
|
43
|
+
// Falls back to the body so that a document with nothing focused still answers
|
|
44
|
+
// with an element. bot.dom.getActiveElement is the other spelling of this and
|
|
45
|
+
// returns null instead; the frame one is what the active_element atom means.
|
|
46
|
+
export function activeElement(optWindow) {
|
|
47
|
+
const doc = windowOr(optWindow).document;
|
|
48
|
+
return doc.activeElement || doc.body;
|
|
49
|
+
}
|
|
50
|
+
export function getFrameWindow(element) {
|
|
51
|
+
if (isFrame(element)) {
|
|
52
|
+
return getFrameContentWindow(element);
|
|
53
|
+
}
|
|
54
|
+
throw botError(NO_SUCH_FRAME, "The given element isn't a frame or an iframe.");
|
|
55
|
+
}
|
|
56
|
+
// Name wins over id, despite the atom being called frame_by_id_or_name.
|
|
57
|
+
//
|
|
58
|
+
// Both lookups are deliberately shallow: frames[] holds only this window's own
|
|
59
|
+
// children and the id search runs over this window's document, so a nested or
|
|
60
|
+
// parent frame is not found from here. The Closure tests pin that -- searching
|
|
61
|
+
// the top window for a frame nested two levels down returns null.
|
|
62
|
+
//
|
|
63
|
+
// Inherited hazard: reading `name` off a cross-origin frame throws a
|
|
64
|
+
// SecurityError, because Window.name is not on the cross-origin allowlist.
|
|
65
|
+
// The Closure original has the same hole; it is not fixed here because that
|
|
66
|
+
// would be a behaviour change rather than a port. (frame.js:106)
|
|
67
|
+
export function findFrameByNameOrId(nameOrId, optRoot) {
|
|
68
|
+
const domWindow = windowOr(optRoot);
|
|
69
|
+
const numFrames = domWindow.frames.length;
|
|
70
|
+
for (let i = 0; i < numFrames; i++) {
|
|
71
|
+
const frame = domWindow.frames[i];
|
|
72
|
+
// frameElement is the <frame>/<iframe> in the parent document, and null
|
|
73
|
+
// across an origin boundary, where the window itself carries the name.
|
|
74
|
+
const frameElement = frame.frameElement || frame;
|
|
75
|
+
if (frameElement.name == nameOrId) {
|
|
76
|
+
// Safari 4 handed back an HTMLFrameElement here instead of a Window, so
|
|
77
|
+
// the original re-resolved it. Every supported browser gives a Window.
|
|
78
|
+
return frame;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// bot.locators.id compared with ==, so a numeric id matched; the id locator
|
|
82
|
+
// here compares strings exactly.
|
|
83
|
+
const elements = findElements({ id: String(nameOrId) }, domWindow.document);
|
|
84
|
+
for (let i = 0; i < elements.length; i++) {
|
|
85
|
+
const frameElement = elements[i];
|
|
86
|
+
if (frameElement && isFrame(frameElement)) {
|
|
87
|
+
return getFrameContentWindow(frameElement);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
export function findFrameByIndex(index, optRoot) {
|
|
93
|
+
return windowOr(optRoot).frames[index] || null;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../../typescript/core/frame.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EA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,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YAC1C,OAAO,qBAAqB,CAAC,YAAoD,CAAC,CAAA;QACpF,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAgB;IAC9D,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAA;AAChD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface Rect {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface Coordinate {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ImageMapResult {
|
|
14
|
+
image: Element | null;
|
|
15
|
+
rect: Rect;
|
|
16
|
+
}
|
|
17
|
+
export type Region = {
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
} | Coordinate;
|
|
23
|
+
export type RectReader = (elem: Element) => Rect;
|
|
24
|
+
export declare function createRect(left: number, top: number, width: number, height: number): Rect;
|
|
25
|
+
export declare function maybeFindImageMap(elem: Element, getRect?: RectReader): ImageMapResult | null;
|
|
26
|
+
export declare function getClientRect(elem: Element, getRect?: RectReader): Rect;
|
|
27
|
+
export declare function getClientRegion(elem: Element, optRegion?: Region, getRect?: RectReader): Rect;
|
|
28
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../typescript/core/geometry.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;CACZ;AAKD,MAAM,MAAM,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC;AAK/F,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CASzF;AA6CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,UAA0B,GAAG,cAAc,GAAG,IAAI,CA0B3G;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CA4BvE;AAMD,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,UAA0B,GAAG,IAAI,CAgB5G"}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { isElement } from './element.js';
|
|
18
|
+
export function createRect(left, top, width, height) {
|
|
19
|
+
return {
|
|
20
|
+
left: left,
|
|
21
|
+
top: top,
|
|
22
|
+
right: left + width,
|
|
23
|
+
bottom: top + height,
|
|
24
|
+
width: width,
|
|
25
|
+
height: height,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function clamp(value, min, max) {
|
|
29
|
+
return Math.min(Math.max(value, min), max);
|
|
30
|
+
}
|
|
31
|
+
function getAreaRelativeRect(area) {
|
|
32
|
+
var shape = area.shape.toLowerCase();
|
|
33
|
+
var coords = area.coords.split(',').map(function (value) {
|
|
34
|
+
return Number(value.trim());
|
|
35
|
+
});
|
|
36
|
+
if (shape === 'rect' && coords.length === 4) {
|
|
37
|
+
return createRect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]);
|
|
38
|
+
}
|
|
39
|
+
if (shape === 'circle' && coords.length === 3) {
|
|
40
|
+
return createRect(coords[0] - coords[2], coords[1] - coords[2], coords[2] * 2, coords[2] * 2);
|
|
41
|
+
}
|
|
42
|
+
if (shape === 'poly' && coords.length > 2) {
|
|
43
|
+
var minX = coords[0];
|
|
44
|
+
var minY = coords[1];
|
|
45
|
+
var maxX = minX;
|
|
46
|
+
var maxY = minY;
|
|
47
|
+
for (var index = 2; index + 1 < coords.length; index += 2) {
|
|
48
|
+
minX = Math.min(minX, coords[index]);
|
|
49
|
+
maxX = Math.max(maxX, coords[index]);
|
|
50
|
+
minY = Math.min(minY, coords[index + 1]);
|
|
51
|
+
maxY = Math.max(maxY, coords[index + 1]);
|
|
52
|
+
}
|
|
53
|
+
return createRect(minX, minY, maxX - minX, maxY - minY);
|
|
54
|
+
}
|
|
55
|
+
return createRect(0, 0, 0, 0);
|
|
56
|
+
}
|
|
57
|
+
function findImageUsingMap(mapName, doc) {
|
|
58
|
+
// Use querySelector instead of a full-DOM scan; escape the map name so
|
|
59
|
+
// special characters in the CSS attribute value string are handled safely.
|
|
60
|
+
return doc.querySelector('[usemap="#' + mapName.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"]');
|
|
61
|
+
}
|
|
62
|
+
export function maybeFindImageMap(elem, getRect = getClientRect) {
|
|
63
|
+
var isMap = isElement(elem, 'MAP');
|
|
64
|
+
if (!isMap && !isElement(elem, 'AREA')) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
var map = isMap ? elem : isElement(elem.parentNode, 'MAP') ? elem.parentNode : null;
|
|
68
|
+
var image = null;
|
|
69
|
+
var rect = createRect(0, 0, 0, 0);
|
|
70
|
+
if (isElement(map, 'MAP') && map.name) {
|
|
71
|
+
image = findImageUsingMap(map.name, map.ownerDocument);
|
|
72
|
+
if (image) {
|
|
73
|
+
rect = getRect(image);
|
|
74
|
+
if (!isMap && isElement(elem, 'AREA') && elem.shape.toLowerCase() !== 'default') {
|
|
75
|
+
var relativeRect = getAreaRelativeRect(elem);
|
|
76
|
+
var relativeX = Math.min(Math.max(relativeRect.left, 0), rect.width);
|
|
77
|
+
var relativeY = Math.min(Math.max(relativeRect.top, 0), rect.height);
|
|
78
|
+
var width = Math.min(relativeRect.width, rect.width - relativeX);
|
|
79
|
+
var height = Math.min(relativeRect.height, rect.height - relativeY);
|
|
80
|
+
rect = createRect(relativeX + rect.left, relativeY + rect.top, width, height);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return { image: image, rect: rect };
|
|
85
|
+
}
|
|
86
|
+
// getRect is threaded through to the image-map lookup so a memoising caller
|
|
87
|
+
// keeps its cache for the <img> an <area> resolves to, not just the <area>.
|
|
88
|
+
export function getClientRect(elem, getRect) {
|
|
89
|
+
var imageMap = maybeFindImageMap(elem, getRect || getClientRect);
|
|
90
|
+
if (imageMap) {
|
|
91
|
+
return imageMap.rect;
|
|
92
|
+
}
|
|
93
|
+
var elemTagName = typeof elem.tagName === 'string' ? elem.tagName : '';
|
|
94
|
+
if (elemTagName.toUpperCase() === 'HTML') {
|
|
95
|
+
var doc = elem.ownerDocument;
|
|
96
|
+
// In quirks mode (no DOCTYPE), viewport dimensions come from document.body;
|
|
97
|
+
// documentElement.clientWidth/Height is unreliable and can be 0.
|
|
98
|
+
var sizeElem = doc.compatMode === 'CSS1Compat' ? doc.documentElement : (doc.body || doc.documentElement);
|
|
99
|
+
return createRect(0, 0, sizeElem.clientWidth, sizeElem.clientHeight);
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
var nativeRect = elem.getBoundingClientRect();
|
|
103
|
+
return {
|
|
104
|
+
left: nativeRect.left,
|
|
105
|
+
top: nativeRect.top,
|
|
106
|
+
right: nativeRect.right,
|
|
107
|
+
bottom: nativeRect.bottom,
|
|
108
|
+
width: nativeRect.right - nativeRect.left,
|
|
109
|
+
height: nativeRect.bottom - nativeRect.top,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (_error) {
|
|
113
|
+
return createRect(0, 0, 0, 0);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// The element's rect, optionally narrowed to a sub-region clamped inside it.
|
|
117
|
+
// Each edge is clamped against the edge computed before it, so a region wider
|
|
118
|
+
// than the element collapses to the element rather than spilling past it --
|
|
119
|
+
// preserve that ordering, it is load-bearing.
|
|
120
|
+
export function getClientRegion(elem, optRegion, getRect = getClientRect) {
|
|
121
|
+
var rect = getRect(elem);
|
|
122
|
+
if (!optRegion) {
|
|
123
|
+
return rect;
|
|
124
|
+
}
|
|
125
|
+
var region = 'left' in optRegion
|
|
126
|
+
? optRegion
|
|
127
|
+
: { left: optRegion.x, top: optRegion.y, width: 1, height: 1 };
|
|
128
|
+
var left = clamp(rect.left + region.left, rect.left, rect.right);
|
|
129
|
+
var top = clamp(rect.top + region.top, rect.top, rect.bottom);
|
|
130
|
+
var right = clamp(left + region.width, left, rect.right);
|
|
131
|
+
var bottom = clamp(top + region.height, top, rect.bottom);
|
|
132
|
+
return createRect(left, top, right - left, bottom - top);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../typescript/core/geometry.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,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AA+BxC,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;IACjF,OAAO;QACL,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,IAAI,GAAG,KAAK;QACnB,MAAM,EAAE,GAAG,GAAG,MAAM;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,MAAM;KACf,CAAA;AACH,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;AAC5C,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAqB;IAChD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IAEzD,OAAO,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const ELEMENT_KEY = "ELEMENT";
|
|
2
|
+
export declare const WINDOW_KEY = "WINDOW";
|
|
3
|
+
export declare const SUCCESS = "success";
|
|
4
|
+
export interface Response {
|
|
5
|
+
status: string;
|
|
6
|
+
value: unknown;
|
|
7
|
+
}
|
|
8
|
+
type Cacheable = Element | Document | Window;
|
|
9
|
+
export declare function addElement(el: Cacheable): string;
|
|
10
|
+
export declare function getElement(key: string, optDoc?: Document): Element | Window;
|
|
11
|
+
export declare function wrapValue(value: unknown): unknown;
|
|
12
|
+
export declare function unwrapValue(value: unknown, optDoc?: Document): unknown;
|
|
13
|
+
export declare function wrapResponse(value: unknown): Response;
|
|
14
|
+
export declare function wrapError(err: unknown): Response;
|
|
15
|
+
export declare function executeScript(fn: Function | string, args: unknown[], optStringify?: boolean, optWindow?: Window): string | Response;
|
|
16
|
+
export declare function executeAsyncScript(fn: Function | string, args: unknown[], timeout: number, onDone: (result: string | Response) => void, optStringify?: boolean, optWindow?: Window): void;
|
|
17
|
+
export declare function getWindow(optWindow?: {
|
|
18
|
+
[WINDOW_KEY]: string;
|
|
19
|
+
}): Window;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../../typescript/core/inject.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,WAAW,YAAY,CAAA;AACpC,eAAO,MAAM,UAAU,WAAW,CAAA;AAClC,eAAO,MAAM,OAAO,YAAY,CAAA;AAUhC,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;CACf;AAED,KAAK,SAAS,GAAG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