@selenium/atoms 4.51.0 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- 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/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 +40 -0
- package/package.json +292 -5
- 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/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,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;IACrB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,SAA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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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable.js","sourceRoot":"","sources":["../../../typescript/core/editable.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+C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O,iBAAiB,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,MAAM,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,MAAM,QAAQ,GACZ,SAAS,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,gCAAgC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACtH,OAAO,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function isElement(node: unknown, tagName?: string): node is Element;
|
|
2
|
+
export declare function getParentElement(node: Node): Element | null;
|
|
3
|
+
export declare function isSelectable(element: Element): boolean;
|
|
4
|
+
export declare function isSelectedState(element: Element): boolean;
|
|
5
|
+
export declare function getParentNodeInComposedDom(node: Node): Node | null;
|
|
6
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../typescript/core/element.ts"],"names":[],"mappings":"AA8CA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,IAAI,OAAO,CAiB1E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAW3D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAStD;AAMD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAIzD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAUlE"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
// Element primitives shared by the atoms. The bodies here were lifted verbatim
|
|
18
|
+
// from is-displayed.ts so the move stays reviewable as a move.
|
|
19
|
+
//
|
|
20
|
+
// Note what is deliberately *not* here: the style, client-rect and displayed
|
|
21
|
+
// helpers from the same file close over caches that is-displayed.ts builds
|
|
22
|
+
// fresh on every call, precisely so a long-running page cannot read stale
|
|
23
|
+
// layout back. Hoisting those to module scope would turn a per-call memo into
|
|
24
|
+
// a process-lifetime one and silently reintroduce that bug, so they stay where
|
|
25
|
+
// their caches live.
|
|
26
|
+
import { getProperty } from './attribute.js';
|
|
27
|
+
// Guards against form children that shadow tagName (e.g. <form><input name="tagName">).
|
|
28
|
+
// Element.prototype's descriptor never changes, so it is read once -- but on
|
|
29
|
+
// first use, not at module load: Node consumers load the atoms where there is
|
|
30
|
+
// no Element at all (see load-in-node.mjs).
|
|
31
|
+
let tagNameDescriptor = null;
|
|
32
|
+
function getTagNameDescriptor() {
|
|
33
|
+
if (tagNameDescriptor === null) {
|
|
34
|
+
tagNameDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'tagName');
|
|
35
|
+
}
|
|
36
|
+
return tagNameDescriptor;
|
|
37
|
+
}
|
|
38
|
+
function toUpperCaseTag(tagName) {
|
|
39
|
+
return tagName ? tagName.toUpperCase() : undefined;
|
|
40
|
+
}
|
|
41
|
+
export function isElement(node, tagName) {
|
|
42
|
+
// Use nodeType instead of instanceof to handle cross-realm Elements
|
|
43
|
+
// (e.g., from iframes), where instanceof checks against a different Element.
|
|
44
|
+
if (!node || node.nodeType !== 1 /* ELEMENT_NODE */) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
var asElement = node;
|
|
48
|
+
var descriptor = getTagNameDescriptor();
|
|
49
|
+
var rawTagName = descriptor && typeof descriptor.get === 'function'
|
|
50
|
+
? descriptor.get.call(asElement)
|
|
51
|
+
: asElement.tagName;
|
|
52
|
+
var upperTagName = typeof rawTagName === 'string' ? rawTagName.toUpperCase() : '';
|
|
53
|
+
var normalizedTagName = toUpperCaseTag(tagName);
|
|
54
|
+
if (upperTagName === 'FORM') {
|
|
55
|
+
return !normalizedTagName || normalizedTagName === 'FORM';
|
|
56
|
+
}
|
|
57
|
+
return !!upperTagName && (!normalizedTagName || upperTagName === normalizedTagName);
|
|
58
|
+
}
|
|
59
|
+
export function getParentElement(node) {
|
|
60
|
+
var current = node.parentNode;
|
|
61
|
+
while (current &&
|
|
62
|
+
current.nodeType !== Node.ELEMENT_NODE &&
|
|
63
|
+
current.nodeType !== Node.DOCUMENT_NODE &&
|
|
64
|
+
current.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
|
|
65
|
+
current = current.parentNode;
|
|
66
|
+
}
|
|
67
|
+
return current && current.nodeType === 1 /* ELEMENT_NODE */ ? current : null;
|
|
68
|
+
}
|
|
69
|
+
export function isSelectable(element) {
|
|
70
|
+
if (isElement(element, 'OPTION')) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (isElement(element, 'INPUT')) {
|
|
74
|
+
const type = element.type.toLowerCase();
|
|
75
|
+
return type === 'checkbox' || type === 'radio';
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
// Reads the selected/checked state. Callers are responsible for checking
|
|
80
|
+
// isSelectable first — the Closure bot.dom.core.isSelected threw for anything
|
|
81
|
+
// else, but the atom Appium consumes returns false instead, so the decision
|
|
82
|
+
// belongs to the caller rather than here.
|
|
83
|
+
export function isSelectedState(element) {
|
|
84
|
+
const type = element.type && element.type.toLowerCase();
|
|
85
|
+
const propertyName = type === 'checkbox' || type === 'radio' ? 'checked' : 'selected';
|
|
86
|
+
return !!getProperty(element, propertyName);
|
|
87
|
+
}
|
|
88
|
+
export function getParentNodeInComposedDom(node) {
|
|
89
|
+
var parent = node.parentNode;
|
|
90
|
+
var slottable = node;
|
|
91
|
+
var parentWithShadow = parent;
|
|
92
|
+
if (parentWithShadow && parentWithShadow.shadowRoot && slottable.assignedSlot !== undefined) {
|
|
93
|
+
return slottable.assignedSlot ? slottable.assignedSlot.parentNode : null;
|
|
94
|
+
}
|
|
95
|
+
return parent;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../typescript/core/element.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,+EAA+E;AAC/E,+DAA+D;AAC/D,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,qBAAqB;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,gBA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AC,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,IAAU;IACnD,IAAI,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,IAAI,SAAS,GAAG,IAAwD,CAAC;IACzE,IAAI,gBAAgB,GAAG,MAA4D,CAAC;IAEpF,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enabled.d.ts","sourceRoot":"","sources":["../../../typescript/core/enabled.ts"],"names":[],"mappings":"AAwDA,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAmBnD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
// Elements that support the "disabled" attribute, per HTML 4.01 17.12.1.
|
|
20
|
+
// Anything else is unconditionally enabled.
|
|
21
|
+
const DISABLED_ATTRIBUTE_SUPPORTED = ['BUTTON', 'INPUT', 'OPTGROUP', 'OPTION', 'SELECT', 'TEXTAREA'];
|
|
22
|
+
function getPreviousElementSibling(node) {
|
|
23
|
+
let sibling = node.previousSibling;
|
|
24
|
+
while (sibling && sibling.nodeType !== 1 /* ELEMENT_NODE */) {
|
|
25
|
+
sibling = sibling.previousSibling;
|
|
26
|
+
}
|
|
27
|
+
return sibling;
|
|
28
|
+
}
|
|
29
|
+
// A <fieldset disabled> disables its descendants, except those inside its
|
|
30
|
+
// *first* <legend>. Later legends are not exempt.
|
|
31
|
+
function isInsideDisabledFieldset(element) {
|
|
32
|
+
let node = element;
|
|
33
|
+
while (node) {
|
|
34
|
+
const parent = node.parentNode;
|
|
35
|
+
if (parent && isElement(parent, 'FIELDSET') && getProperty(parent, 'disabled')) {
|
|
36
|
+
if (!isElement(node, 'LEGEND')) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
// Being a legend only exempts us if no legend precedes us.
|
|
40
|
+
let sibling = getPreviousElementSibling(node);
|
|
41
|
+
while (sibling) {
|
|
42
|
+
if (isElement(sibling, 'LEGEND')) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
sibling = getPreviousElementSibling(sibling);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
node = parent;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
export function isEnabled(element) {
|
|
53
|
+
const isSupported = DISABLED_ATTRIBUTE_SUPPORTED.some((tagName) => isElement(element, tagName));
|
|
54
|
+
if (!isSupported) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (getProperty(element, 'disabled')) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// An OPTION or OPTGROUP can inherit its state from an ancestor SELECT or
|
|
61
|
+
// OPTGROUP. isElement() rejects a null parent, so a detached node simply
|
|
62
|
+
// reports enabled rather than recursing into nothing.
|
|
63
|
+
const parent = element.parentNode;
|
|
64
|
+
if ((parent && parent.nodeType === 1 && isElement(element, 'OPTGROUP')) || isElement(element, 'OPTION')) {
|
|
65
|
+
return isEnabled(parent);
|
|
66
|
+
}
|
|
67
|
+
return !isInsideDisabledFieldset(element);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=enabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enabled.js","sourceRoot":"","sources":["../../../typescript/core/enabled.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,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,yEAAyE;AACzE,4CAA4C;AAC5C,MAAM,4BAA4B,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;AAEpG,SAAS,yBAAyB,CAAC,IAAU;IAC3C,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAA;IAClC,OAAO,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAC5D,OAAO,GAAG,OAAO,CAAC,eAAe,CAAA;IACnC,CAAC;IACD,OAAO,OAAyB,CAAA;AAClC,CAAC;AAED,0EAA0E;AAC1E,kDAAkD;AAClD,SAAS,w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,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACxG,OAAO,SAAS,CAAC,MAAiB,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const INVALID_SELECTOR = "invalid selector";
|
|
2
|
+
export declare const INVALID_ARGUMENT = "invalid argument";
|
|
3
|
+
export declare const NO_SUCH_ELEMENT = "no such element";
|
|
4
|
+
export declare const NO_SUCH_FRAME = "no such frame";
|
|
5
|
+
export declare const NO_SUCH_WINDOW = "no such window";
|
|
6
|
+
export declare const STALE_ELEMENT_REFERENCE = "stale element reference";
|
|
7
|
+
export declare const JAVASCRIPT_ERROR = "javascript error";
|
|
8
|
+
export declare const SCRIPT_TIMEOUT = "script timeout";
|
|
9
|
+
export declare const ELEMENT_NOT_INTERACTABLE = "element not interactable";
|
|
10
|
+
export declare const INVALID_ELEMENT_STATE = "invalid element state";
|
|
11
|
+
export declare const UNKNOWN_ERROR = "unknown error";
|
|
12
|
+
export declare function botError(code: string, message: string): Error;
|
|
13
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../typescript/core/error.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,eAAe,oBAAoB,CAAA;AAChD,eAAO,MAAM,aAAa,kBAAkB,CAAA;AAC5C,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAC9C,eAAO,MAAM,uBAAuB,4BAA4B,CAAA;AAChE,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAG9C,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAClE,eAAO,MAAM,qBAAqB,0BAA0B,CAAA;AAG5D,eAAO,MAAM,aAAa,kBAAkB,CAAA;AAE5C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAI7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
// WebDriver error codes carried by atoms back across the wire. The injecting
|
|
18
|
+
// binding reads `code` off the thrown error to pick the right exception type,
|
|
19
|
+
// so these strings are part of the protocol surface, not free text.
|
|
20
|
+
export const INVALID_SELECTOR = 'invalid selector';
|
|
21
|
+
export const INVALID_ARGUMENT = 'invalid argument';
|
|
22
|
+
export const NO_SUCH_ELEMENT = 'no such element';
|
|
23
|
+
export const NO_SUCH_FRAME = 'no such frame';
|
|
24
|
+
export const NO_SUCH_WINDOW = 'no such window';
|
|
25
|
+
export const STALE_ELEMENT_REFERENCE = 'stale element reference';
|
|
26
|
+
export const JAVASCRIPT_ERROR = 'javascript error';
|
|
27
|
+
export const SCRIPT_TIMEOUT = 'script timeout';
|
|
28
|
+
// W3C's code for both of Closure's ELEMENT_NOT_VISIBLE (click on a hidden
|
|
29
|
+
// element) and its INVALID_ELEMENT_STATE for typing into one.
|
|
30
|
+
export const ELEMENT_NOT_INTERACTABLE = 'element not interactable';
|
|
31
|
+
export const INVALID_ELEMENT_STATE = 'invalid element state';
|
|
32
|
+
// bot.Error.State.UNKNOWN_ERROR, which bot.ErrorCode.UNKNOWN_ERROR (13) mapped
|
|
33
|
+
// onto. The storage atoms raise it when web storage is unavailable.
|
|
34
|
+
export const UNKNOWN_ERROR = 'unknown error';
|
|
35
|
+
export function botError(code, message) {
|
|
36
|
+
const err = new Error(message);
|
|
37
|
+
err['code'] = code;
|
|
38
|
+
return err;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../typescript/core/error.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,6EAA6E;AAC7E,8EAA8E;AAC9E,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAA;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAC9C,0EAA0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