@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,83 @@
|
|
|
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
|
+
// Values of embedded controls, as accname step 2E reads them when a control
|
|
18
|
+
// sits inside something whose name is being computed. The states slice
|
|
19
|
+
// reuses this for the `value` field.
|
|
20
|
+
const TEXT_ROLES = new Set(['textbox', 'searchbox']);
|
|
21
|
+
const SELECTION_ROLES = new Set(['combobox', 'listbox']);
|
|
22
|
+
const RANGE_ROLES = new Set(['meter', 'progressbar', 'scrollbar', 'slider', 'spinbutton']);
|
|
23
|
+
export function isEmbeddedControl(role) {
|
|
24
|
+
return TEXT_ROLES.has(role) || SELECTION_ROLES.has(role) || RANGE_ROLES.has(role);
|
|
25
|
+
}
|
|
26
|
+
function selectedOptionsText(select) {
|
|
27
|
+
const texts = [];
|
|
28
|
+
for (let i = 0; i < select.options.length; i++) {
|
|
29
|
+
const option = select.options[i];
|
|
30
|
+
if (option.selected) {
|
|
31
|
+
texts.push(option.label || option.text);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return texts.join(' ');
|
|
35
|
+
}
|
|
36
|
+
// What the user sees: innerText follows CSS (display: none, visibility) where
|
|
37
|
+
// textContent would include hidden descendants.
|
|
38
|
+
function renderedText(element) {
|
|
39
|
+
const text = element.innerText;
|
|
40
|
+
return typeof text === 'string' ? text : element.textContent || '';
|
|
41
|
+
}
|
|
42
|
+
// A listbox built from ARIA: its selected options, in document order.
|
|
43
|
+
function selectedAriaOptions(listbox) {
|
|
44
|
+
const selected = listbox.querySelectorAll('[aria-selected="true"]');
|
|
45
|
+
const texts = [];
|
|
46
|
+
for (let i = 0; i < selected.length; i++) {
|
|
47
|
+
texts.push(renderedText(selected[i]));
|
|
48
|
+
}
|
|
49
|
+
return texts.join(' ');
|
|
50
|
+
}
|
|
51
|
+
/** The current value of an embedded control, or null when the role has none. */
|
|
52
|
+
export function embeddedValue(element, role) {
|
|
53
|
+
if (RANGE_ROLES.has(role)) {
|
|
54
|
+
const text = element.getAttribute('aria-valuetext');
|
|
55
|
+
if (text !== null && text.trim() !== '') {
|
|
56
|
+
return text.trim();
|
|
57
|
+
}
|
|
58
|
+
const now = element.getAttribute('aria-valuenow');
|
|
59
|
+
if (now !== null) {
|
|
60
|
+
return now.trim();
|
|
61
|
+
}
|
|
62
|
+
return 'value' in element ? String(element.value) : null;
|
|
63
|
+
}
|
|
64
|
+
if (TEXT_ROLES.has(role) || SELECTION_ROLES.has(role)) {
|
|
65
|
+
if (element.localName === 'select') {
|
|
66
|
+
return selectedOptionsText(element);
|
|
67
|
+
}
|
|
68
|
+
if ('value' in element && typeof element.value === 'string') {
|
|
69
|
+
const value = element.value;
|
|
70
|
+
// A password is masked one bullet per character, as Chromium's
|
|
71
|
+
// accessibility tree exposes it: snapshots end up in logs and reports.
|
|
72
|
+
return element.localName === 'input' && element.type === 'password'
|
|
73
|
+
? '\u2022'.repeat(value.length)
|
|
74
|
+
: value;
|
|
75
|
+
}
|
|
76
|
+
if (role === 'listbox') {
|
|
77
|
+
return selectedAriaOptions(element);
|
|
78
|
+
}
|
|
79
|
+
return renderedText(element);
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/value.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,8DA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CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,mBAAmB,CAAC,OAA4B,CAAC,CAAA;QAC1D,CAAC;QACD,IAAI,OAAO,IAAI,OAAO,IAAI,OAAQ,OAA4B,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAClF,MAAM,KAAK,GAAI,OAA4B,CAAC,KAAK,CAAA;YACjD,+DAA+D;YAC/D,uEAAuE;YACvE,OAAO,OAAO,CAAC,SAAS,KAAK,OAAO,IAAK,OAA4B,CAAC,IAAI,KAAK,UAAU;gBACvF,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC/B,CAAC,CAAC,KAAK,CAAA;QACX,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QACD,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;IAC9B,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AccessibilityNode, SnapshotOptions, StateValue } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A node as the language bindings receive it: the same fields as
|
|
4
|
+
* `AccessibilityNode`, with every reference replaced by an index into the
|
|
5
|
+
* arrays that travel beside the JSON text.
|
|
6
|
+
*/
|
|
7
|
+
export interface WireNode {
|
|
8
|
+
role: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
states: Record<string, StateValue>;
|
|
14
|
+
/** Index into `WireSnapshot.elements`; absent for text leaves. */
|
|
15
|
+
element?: number;
|
|
16
|
+
/** Index into `WireSnapshot.windows`, on a frame node whose frame has a content window. */
|
|
17
|
+
frame?: number;
|
|
18
|
+
children: WireNode[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The shape the bindings fetch over WebDriver BiDi. The tree travels as one
|
|
22
|
+
* JSON string, so a binding parses it with its own JSON library instead of
|
|
23
|
+
* decoding a nested remote value; the elements and frame windows travel as
|
|
24
|
+
* plain arrays, which BiDi serializes as node references and browsing context
|
|
25
|
+
* ids in one pass.
|
|
26
|
+
*/
|
|
27
|
+
export interface WireSnapshot {
|
|
28
|
+
json: string;
|
|
29
|
+
/** Every element the tree references, in order of first mention. */
|
|
30
|
+
elements: Element[];
|
|
31
|
+
/** The content window of every frame node, in order of first mention. */
|
|
32
|
+
windows: Window[];
|
|
33
|
+
}
|
|
34
|
+
/** The root is an element of this document that is no longer attached to it. */
|
|
35
|
+
export interface WireError {
|
|
36
|
+
error: 'detached';
|
|
37
|
+
}
|
|
38
|
+
interface Encoded {
|
|
39
|
+
node: WireNode;
|
|
40
|
+
elements: Element[];
|
|
41
|
+
windows: Window[];
|
|
42
|
+
}
|
|
43
|
+
/** Replaces the references in a tree with indices; pure, so it is unit tested without a DOM. */
|
|
44
|
+
export declare function encodeWire(tree: AccessibilityNode): Encoded;
|
|
45
|
+
/**
|
|
46
|
+
* The snapshot of this document (no `root`), or of the subtree under `root`,
|
|
47
|
+
* in the wire shape. Answers `null` for a root this document does not own,
|
|
48
|
+
* so a binding tries each document until one answers: Firefox hands a shared
|
|
49
|
+
* id of another document's node to the called function as `null`, and may
|
|
50
|
+
* resolve one to the node itself in any document of the browsing context
|
|
51
|
+
* group, which the ownership check catches. Answers `{ error: 'detached' }`
|
|
52
|
+
* for a root no longer in its document, so a binding never has to read an
|
|
53
|
+
* exception's text.
|
|
54
|
+
*/
|
|
55
|
+
declare function accessibilitySnapshotWire(root?: Element | null, options?: SnapshotOptions): WireSnapshot | WireError | null;
|
|
56
|
+
export default accessibilitySnapshotWire;
|
|
57
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/wire.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEhF;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAClC,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,QAAQ,EAAE,CAAA;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,yEAAyE;IACzE,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,UAAU,OAAO;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAwB3D;AAED;;;;;;;;;GASG;AACH,iBAAS,yBAAyB,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,SAAS,GAAG,IAAI,CAiBpH;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 accessibilitySnapshot from './snapshot.js';
|
|
19
|
+
/** Replaces the references in a tree with indices; pure, so it is unit tested without a DOM. */
|
|
20
|
+
export function encodeWire(tree) {
|
|
21
|
+
const elements = [];
|
|
22
|
+
const windows = [];
|
|
23
|
+
function encode(node) {
|
|
24
|
+
const out = { role: node.role, name: node.name, description: node.description, states: node.states, children: [] };
|
|
25
|
+
if (node.value !== undefined) {
|
|
26
|
+
out.value = node.value;
|
|
27
|
+
}
|
|
28
|
+
if (node.url !== undefined) {
|
|
29
|
+
out.url = node.url;
|
|
30
|
+
}
|
|
31
|
+
if (node.element) {
|
|
32
|
+
out.element = elements.push(node.element) - 1;
|
|
33
|
+
const window = node.role === 'iframe' ? node.element.contentWindow : null;
|
|
34
|
+
if (window) {
|
|
35
|
+
out.frame = windows.push(window) - 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
out.children = node.children.map(encode);
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
return { node: encode(tree), elements, windows };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The snapshot of this document (no `root`), or of the subtree under `root`,
|
|
45
|
+
* in the wire shape. Answers `null` for a root this document does not own,
|
|
46
|
+
* so a binding tries each document until one answers: Firefox hands a shared
|
|
47
|
+
* id of another document's node to the called function as `null`, and may
|
|
48
|
+
* resolve one to the node itself in any document of the browsing context
|
|
49
|
+
* group, which the ownership check catches. Answers `{ error: 'detached' }`
|
|
50
|
+
* for a root no longer in its document, so a binding never has to read an
|
|
51
|
+
* exception's text.
|
|
52
|
+
*/
|
|
53
|
+
function accessibilitySnapshotWire(root, options) {
|
|
54
|
+
if (root === null) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (root !== undefined) {
|
|
58
|
+
if (!isElement(root)) {
|
|
59
|
+
throw new Error('accessibilitySnapshotWire: root must be an Element');
|
|
60
|
+
}
|
|
61
|
+
if (root.ownerDocument !== document) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (!root.isConnected) {
|
|
65
|
+
return { error: 'detached' };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const { node, elements, windows } = encodeWire(accessibilitySnapshot(root, options));
|
|
69
|
+
return { json: JSON.stringify(node), elements, windows };
|
|
70
|
+
}
|
|
71
|
+
export default accessibilitySnapshotWire;
|
|
72
|
+
//# sourceMappingURL=wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/wire.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,eAAe,CAAA;AACzC,OAAO,qBAAqB,MAAM,eAAe,CAAA;AAgDjD,gGAAgG;AAChG,MAAM,UAAU,UAAU,CAAC,IAAuB;IAChD,MAA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,EAAE,OAAyB;IACjF,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YACpC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;QAC9B,CAAC;IACH,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IACpF,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AAC1D,CAAC;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute.d.ts","sourceRoot":"","sources":["../../../typescript/core/attribute.ts"],"names":[],"mappings":"AAoDA,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWnF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAE3E"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
// Raw attribute and property access, ported from bot.dom.core (domcore.js).
|
|
18
|
+
//
|
|
19
|
+
// This is *not* the WebDriver getAttribute algorithm — that one consults
|
|
20
|
+
// properties, boolean-attribute tables and aliases, and lives in
|
|
21
|
+
// get-attribute.ts. This returns what the author actually wrote in the markup.
|
|
22
|
+
//
|
|
23
|
+
// The IE-only branches in the Closure original (IE_DOC_PRE8's <input value>,
|
|
24
|
+
// IE_DOC_PRE9's boolean attributes, the <option value> text fallback) are
|
|
25
|
+
// dropped, matching every other TypeScript atom in this directory.
|
|
26
|
+
// Splits on semicolons that are not inside quotes or parens, so a value like
|
|
27
|
+
// `background: url(a;b)` or `content: ";"` survives intact. If the attribute
|
|
28
|
+
// ends in a semicolon the split yields a trailing empty entry, which the
|
|
29
|
+
// caller skips.
|
|
30
|
+
const SPLIT_STYLE_ATTRIBUTE_ON_SEMICOLONS = new RegExp('[;]+' +
|
|
31
|
+
'(?=(?:(?:[^"]*"){2})*[^"]*$)' +
|
|
32
|
+
"(?=(?:(?:[^']*'){2})*[^']*$)" +
|
|
33
|
+
'(?=(?:[^()]*\\([^()]*\\))*[^()]*$)');
|
|
34
|
+
// Lower-cases property names and guarantees a trailing semicolon, so the same
|
|
35
|
+
// style attribute reads identically no matter how the browser serialised it.
|
|
36
|
+
function standardizeStyleAttribute(value) {
|
|
37
|
+
const declarations = [];
|
|
38
|
+
for (const pair of value.split(SPLIT_STYLE_ATTRIBUTE_ON_SEMICOLONS)) {
|
|
39
|
+
const separator = pair.indexOf(':');
|
|
40
|
+
if (separator > 0) {
|
|
41
|
+
declarations.push(pair.slice(0, separator).toLowerCase(), ':', pair.slice(separator + 1), ';');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const css = declarations.join('');
|
|
45
|
+
return css.charAt(css.length - 1) === ';' ? css : css + ';';
|
|
46
|
+
}
|
|
47
|
+
export function getAttribute(element, attributeName) {
|
|
48
|
+
const name = attributeName.toLowerCase();
|
|
49
|
+
if (name === 'style') {
|
|
50
|
+
return standardizeStyleAttribute(element.style.cssText);
|
|
51
|
+
}
|
|
52
|
+
// `specified` distinguishes an attribute the author wrote from one the
|
|
53
|
+
// browser defaulted in.
|
|
54
|
+
const attr = element.getAttributeNode(name);
|
|
55
|
+
return attr && attr.specified ? attr.value : null;
|
|
56
|
+
}
|
|
57
|
+
export function getProperty(element, propertyName) {
|
|
58
|
+
return element[propertyName];
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=attribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../typescript/core/attribute.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,4EAA4E;AAC5E,EAAE;AACF,yEAAyE;AACzE,iEAAiE;AACjE,+EAA+E;AAC/E,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,mEAAmE;AAEnE,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,gBAAgB;AAChB,MAAM,mCAAmC,GAAG,IAAI,MAAM,CACpD,MAAM;IACJ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AAM,UAAU,WAAW,CAAC,OAAgB,EAAE,YAAoB;IAChE,OAAQ,OAA8C,CAAC,YAAY,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../typescript/core/color.ts"],"names":[],"mappings":"AAwPA,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAQpF"}
|
|
@@ -0,0 +1,248 @@
|
|
|
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
|
+
// Ported from bot.color (javascript/atoms/color.js), which normalises every
|
|
18
|
+
// colour-valued CSS property to "rgba(r, g, b, a)". Bindings and user tests
|
|
19
|
+
// have asserted against that exact spelling for years -- getComputedStyle on
|
|
20
|
+
// its own returns "rgb(...)" when alpha is 1 -- so the normalisation is part
|
|
21
|
+
// of the contract, not a tidy-up.
|
|
22
|
+
// The CSS2 extended colour keywords, from goog.color.names. getComputedStyle
|
|
23
|
+
// resolves keywords to rgb() itself, so this table is only reached through the
|
|
24
|
+
// cascaded-style fallback, where a keyword can still surface.
|
|
25
|
+
const COLOR_NAMES = {
|
|
26
|
+
aliceblue: '#f0f8ff',
|
|
27
|
+
antiquewhite: '#faebd7',
|
|
28
|
+
aqua: '#00ffff',
|
|
29
|
+
aquamarine: '#7fffd4',
|
|
30
|
+
azure: '#f0ffff',
|
|
31
|
+
beige: '#f5f5dc',
|
|
32
|
+
bisque: '#ffe4c4',
|
|
33
|
+
black: '#000000',
|
|
34
|
+
blanchedalmond: '#ffebcd',
|
|
35
|
+
blue: '#0000ff',
|
|
36
|
+
blueviolet: '#8a2be2',
|
|
37
|
+
brown: '#a52a2a',
|
|
38
|
+
burlywood: '#deb887',
|
|
39
|
+
cadetblue: '#5f9ea0',
|
|
40
|
+
chartreuse: '#7fff00',
|
|
41
|
+
chocolate: '#d2691e',
|
|
42
|
+
coral: '#ff7f50',
|
|
43
|
+
cornflowerblue: '#6495ed',
|
|
44
|
+
cornsilk: '#fff8dc',
|
|
45
|
+
crimson: '#dc143c',
|
|
46
|
+
cyan: '#00ffff',
|
|
47
|
+
darkblue: '#00008b',
|
|
48
|
+
darkcyan: '#008b8b',
|
|
49
|
+
darkgoldenrod: '#b8860b',
|
|
50
|
+
darkgray: '#a9a9a9',
|
|
51
|
+
darkgreen: '#006400',
|
|
52
|
+
darkgrey: '#a9a9a9',
|
|
53
|
+
darkkhaki: '#bdb76b',
|
|
54
|
+
darkmagenta: '#8b008b',
|
|
55
|
+
darkolivegreen: '#556b2f',
|
|
56
|
+
darkorange: '#ff8c00',
|
|
57
|
+
darkorchid: '#9932cc',
|
|
58
|
+
darkred: '#8b0000',
|
|
59
|
+
darksalmon: '#e9967a',
|
|
60
|
+
darkseagreen: '#8fbc8f',
|
|
61
|
+
darkslateblue: '#483d8b',
|
|
62
|
+
darkslategray: '#2f4f4f',
|
|
63
|
+
darkslategrey: '#2f4f4f',
|
|
64
|
+
darkturquoise: '#00ced1',
|
|
65
|
+
darkviolet: '#9400d3',
|
|
66
|
+
deeppink: '#ff1493',
|
|
67
|
+
deepskyblue: '#00bfff',
|
|
68
|
+
dimgray: '#696969',
|
|
69
|
+
dimgrey: '#696969',
|
|
70
|
+
dodgerblue: '#1e90ff',
|
|
71
|
+
firebrick: '#b22222',
|
|
72
|
+
floralwhite: '#fffaf0',
|
|
73
|
+
forestgreen: '#228b22',
|
|
74
|
+
fuchsia: '#ff00ff',
|
|
75
|
+
gainsboro: '#dcdcdc',
|
|
76
|
+
ghostwhite: '#f8f8ff',
|
|
77
|
+
gold: '#ffd700',
|
|
78
|
+
goldenrod: '#daa520',
|
|
79
|
+
gray: '#808080',
|
|
80
|
+
green: '#008000',
|
|
81
|
+
greenyellow: '#adff2f',
|
|
82
|
+
grey: '#808080',
|
|
83
|
+
honeydew: '#f0fff0',
|
|
84
|
+
hotpink: '#ff69b4',
|
|
85
|
+
indianred: '#cd5c5c',
|
|
86
|
+
indigo: '#4b0082',
|
|
87
|
+
ivory: '#fffff0',
|
|
88
|
+
khaki: '#f0e68c',
|
|
89
|
+
lavender: '#e6e6fa',
|
|
90
|
+
lavenderblush: '#fff0f5',
|
|
91
|
+
lawngreen: '#7cfc00',
|
|
92
|
+
lemonchiffon: '#fffacd',
|
|
93
|
+
lightblue: '#add8e6',
|
|
94
|
+
lightcoral: '#f08080',
|
|
95
|
+
lightcyan: '#e0ffff',
|
|
96
|
+
lightgoldenrodyellow: '#fafad2',
|
|
97
|
+
lightgray: '#d3d3d3',
|
|
98
|
+
lightgreen: '#90ee90',
|
|
99
|
+
lightgrey: '#d3d3d3',
|
|
100
|
+
lightpink: '#ffb6c1',
|
|
101
|
+
lightsalmon: '#ffa07a',
|
|
102
|
+
lightseagreen: '#20b2aa',
|
|
103
|
+
lightskyblue: '#87cefa',
|
|
104
|
+
lightslategray: '#778899',
|
|
105
|
+
lightslategrey: '#778899',
|
|
106
|
+
lightsteelblue: '#b0c4de',
|
|
107
|
+
lightyellow: '#ffffe0',
|
|
108
|
+
lime: '#00ff00',
|
|
109
|
+
limegreen: '#32cd32',
|
|
110
|
+
linen: '#faf0e6',
|
|
111
|
+
magenta: '#ff00ff',
|
|
112
|
+
maroon: '#800000',
|
|
113
|
+
mediumaquamarine: '#66cdaa',
|
|
114
|
+
mediumblue: '#0000cd',
|
|
115
|
+
mediumorchid: '#ba55d3',
|
|
116
|
+
mediumpurple: '#9370db',
|
|
117
|
+
mediumseagreen: '#3cb371',
|
|
118
|
+
mediumslateblue: '#7b68ee',
|
|
119
|
+
mediumspringgreen: '#00fa9a',
|
|
120
|
+
mediumturquoise: '#48d1cc',
|
|
121
|
+
mediumvioletred: '#c71585',
|
|
122
|
+
midnightblue: '#191970',
|
|
123
|
+
mintcream: '#f5fffa',
|
|
124
|
+
mistyrose: '#ffe4e1',
|
|
125
|
+
moccasin: '#ffe4b5',
|
|
126
|
+
navajowhite: '#ffdead',
|
|
127
|
+
navy: '#000080',
|
|
128
|
+
oldlace: '#fdf5e6',
|
|
129
|
+
olive: '#808000',
|
|
130
|
+
olivedrab: '#6b8e23',
|
|
131
|
+
orange: '#ffa500',
|
|
132
|
+
orangered: '#ff4500',
|
|
133
|
+
orchid: '#da70d6',
|
|
134
|
+
palegoldenrod: '#eee8aa',
|
|
135
|
+
palegreen: '#98fb98',
|
|
136
|
+
paleturquoise: '#afeeee',
|
|
137
|
+
palevioletred: '#db7093',
|
|
138
|
+
papayawhip: '#ffefd5',
|
|
139
|
+
peachpuff: '#ffdab9',
|
|
140
|
+
peru: '#cd853f',
|
|
141
|
+
pink: '#ffc0cb',
|
|
142
|
+
plum: '#dda0dd',
|
|
143
|
+
powderblue: '#b0e0e6',
|
|
144
|
+
purple: '#800080',
|
|
145
|
+
red: '#ff0000',
|
|
146
|
+
rosybrown: '#bc8f8f',
|
|
147
|
+
royalblue: '#4169e1',
|
|
148
|
+
saddlebrown: '#8b4513',
|
|
149
|
+
salmon: '#fa8072',
|
|
150
|
+
sandybrown: '#f4a460',
|
|
151
|
+
seagreen: '#2e8b57',
|
|
152
|
+
seashell: '#fff5ee',
|
|
153
|
+
sienna: '#a0522d',
|
|
154
|
+
silver: '#c0c0c0',
|
|
155
|
+
skyblue: '#87ceeb',
|
|
156
|
+
slateblue: '#6a5acd',
|
|
157
|
+
slategray: '#708090',
|
|
158
|
+
slategrey: '#708090',
|
|
159
|
+
snow: '#fffafa',
|
|
160
|
+
springgreen: '#00ff7f',
|
|
161
|
+
steelblue: '#4682b4',
|
|
162
|
+
tan: '#d2b48c',
|
|
163
|
+
teal: '#008080',
|
|
164
|
+
thistle: '#d8bfd8',
|
|
165
|
+
tomato: '#ff6347',
|
|
166
|
+
turquoise: '#40e0d0',
|
|
167
|
+
violet: '#ee82ee',
|
|
168
|
+
wheat: '#f5deb3',
|
|
169
|
+
white: '#ffffff',
|
|
170
|
+
whitesmoke: '#f5f5f5',
|
|
171
|
+
yellow: '#ffff00',
|
|
172
|
+
yellowgreen: '#9acd32',
|
|
173
|
+
};
|
|
174
|
+
// Only these properties are standardised. A colour-looking value on any other
|
|
175
|
+
// property is returned untouched.
|
|
176
|
+
const COLOR_PROPERTIES = [
|
|
177
|
+
'backgroundColor',
|
|
178
|
+
'borderTopColor',
|
|
179
|
+
'borderRightColor',
|
|
180
|
+
'borderBottomColor',
|
|
181
|
+
'borderLeftColor',
|
|
182
|
+
'color',
|
|
183
|
+
'outlineColor',
|
|
184
|
+
];
|
|
185
|
+
// Components are captured separately rather than with a repeater, and each is
|
|
186
|
+
// pinned to either 0 or a non-zero leading digit, so octal literals cannot slip
|
|
187
|
+
// through.
|
|
188
|
+
const RGBA_COLOR_RE = /^(?:rgba)?\((\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3}),\s?(0|1|0\.\d*)\)$/i;
|
|
189
|
+
const RGB_COLOR_RE = /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
|
|
190
|
+
const HEX_TRIPLET_RE = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/;
|
|
191
|
+
const VALID_HEX_COLOR_RE = /^#(?:[0-9a-f]{3}){1,2}$/i;
|
|
192
|
+
function maybeParseRgbaColor(value) {
|
|
193
|
+
const match = value.match(RGBA_COLOR_RE);
|
|
194
|
+
if (!match) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const r = Number(match[1]);
|
|
198
|
+
const g = Number(match[2]);
|
|
199
|
+
const b = Number(match[3]);
|
|
200
|
+
const a = Number(match[4]);
|
|
201
|
+
if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255 && a >= 0 && a <= 1) {
|
|
202
|
+
return [r, g, b, a];
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
function maybeParseRgbColor(value) {
|
|
207
|
+
const match = value.match(RGB_COLOR_RE);
|
|
208
|
+
if (!match) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
const r = Number(match[1]);
|
|
212
|
+
const g = Number(match[2]);
|
|
213
|
+
const b = Number(match[3]);
|
|
214
|
+
if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
|
|
215
|
+
return [r, g, b, 1];
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function maybeConvertHexOrColorName(value) {
|
|
220
|
+
const lowered = value.toLowerCase();
|
|
221
|
+
let hex = COLOR_NAMES[lowered];
|
|
222
|
+
if (!hex) {
|
|
223
|
+
hex = lowered.charAt(0) === '#' ? lowered : '#' + lowered;
|
|
224
|
+
if (hex.length === 4) {
|
|
225
|
+
// #RGB -> #RRGGBB
|
|
226
|
+
hex = hex.replace(HEX_TRIPLET_RE, '#$1$1$2$2$3$3');
|
|
227
|
+
}
|
|
228
|
+
if (!VALID_HEX_COLOR_RE.test(hex)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return [
|
|
233
|
+
parseInt(hex.substr(1, 2), 16),
|
|
234
|
+
parseInt(hex.substr(3, 2), 16),
|
|
235
|
+
parseInt(hex.substr(5, 2), 16),
|
|
236
|
+
1,
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
export function standardizeColor(propertyName, propertyValue) {
|
|
240
|
+
if (COLOR_PROPERTIES.indexOf(propertyName) < 0) {
|
|
241
|
+
return propertyValue;
|
|
242
|
+
}
|
|
243
|
+
const rgba = maybeParseRgbaColor(propertyValue) ||
|
|
244
|
+
maybeParseRgbColor(propertyValue) ||
|
|
245
|
+
maybeConvertHexOrColorName(propertyValue);
|
|
246
|
+
return rgba ? 'rgba(' + rgba.join(', ') + ')' : propertyValue;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../typescript/core/color.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,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,kCAAkC;AAElC,6EAA6E;AAC7E,+EAA+E;AAC/E,8DAA8D;AAC9D,MAAM,WAAW,GAA2B;IAC1C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS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AAC,aAAa,CAAC,CAAA;IAC3C,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,aAAa,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isContentEditable(element: Element): boolean;
|
|
2
|
+
export declare function isTextual(element: Element): boolean;
|
|
3
|
+
export declare function isFileInput(element: Element): boolean;
|
|
4
|
+
export declare function isEditable(element: Element): boolean;
|
|
5
|
+
//# sourceMappingURL=editable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../typescript/core/editable.ts"],"names":[],"mappings":"AAkCA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAM3D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CASnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAErD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAKpD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { getProperty } from './attribute.js';
|
|
18
|
+
import { isElement } from './element.js';
|
|
19
|
+
// <input> types that present a free-text field.
|
|
20
|
+
const TEXTUAL_INPUT_TYPES = ['text', 'search', 'tel', 'url', 'email', 'password', 'number'];
|
|
21
|
+
// Typeable <input> types that are not free text — each is a distinct control,
|
|
22
|
+
// but the user can still put a value into it.
|
|
23
|
+
const NON_TEXTUAL_EDITABLE_INPUT_TYPES = ['range', 'date', 'month', 'week', 'time', 'datetime-local', 'color'];
|
|
24
|
+
function inputType(element) {
|
|
25
|
+
if (!isElement(element, 'INPUT')) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return element.type.toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
export function isContentEditable(element) {
|
|
31
|
+
// Non-HTML elements (SVG, MathML) have no contentEditable at all.
|
|
32
|
+
if (element.contentEditable === undefined) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return !!element.isContentEditable;
|
|
36
|
+
}
|
|
37
|
+
export function isTextual(element) {
|
|
38
|
+
if (isElement(element, 'TEXTAREA')) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
const type = inputType(element);
|
|
42
|
+
if (type !== null) {
|
|
43
|
+
return TEXTUAL_INPUT_TYPES.indexOf(type) >= 0;
|
|
44
|
+
}
|
|
45
|
+
return isContentEditable(element);
|
|
46
|
+
}
|
|
47
|
+
export function isFileInput(element) {
|
|
48
|
+
return inputType(element) === 'file';
|
|
49
|
+
}
|
|
50
|
+
export function isEditable(element) {
|
|
51
|
+
const type = inputType(element);
|
|
52
|
+
const typeable = isTextual(element) || isFileInput(element) || (type !== null && NON_TEXTUAL_EDITABLE_INPUT_TYPES.indexOf(type) >= 0);
|
|
53
|
+
return typeable && !getProperty(element, 'readOnly');
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=editable.js.map
|
|
@@ -0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