@selenium/atoms 4.52.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.
Files changed (67) hide show
  1. package/README.md +56 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/typescript/accessibility-snapshot-wire.d.ts +4 -0
  7. package/dist/typescript/accessibility-snapshot-wire.d.ts.map +1 -0
  8. package/dist/typescript/accessibility-snapshot-wire.js +18 -0
  9. package/dist/typescript/accessibility-snapshot-wire.js.map +1 -0
  10. package/dist/typescript/accessibility-snapshot.d.ts +3 -0
  11. package/dist/typescript/accessibility-snapshot.d.ts.map +1 -0
  12. package/dist/typescript/accessibility-snapshot.js +18 -0
  13. package/dist/typescript/accessibility-snapshot.js.map +1 -0
  14. package/dist/typescript/core/accessibility/accname.d.ts +6 -0
  15. package/dist/typescript/core/accessibility/accname.d.ts.map +1 -0
  16. package/dist/typescript/core/accessibility/accname.js +537 -0
  17. package/dist/typescript/core/accessibility/accname.js.map +1 -0
  18. package/dist/typescript/core/accessibility/context.d.ts +43 -0
  19. package/dist/typescript/core/accessibility/context.d.ts.map +1 -0
  20. package/dist/typescript/core/accessibility/context.js +49 -0
  21. package/dist/typescript/core/accessibility/context.js.map +1 -0
  22. package/dist/typescript/core/accessibility/hidden.d.ts +39 -0
  23. package/dist/typescript/core/accessibility/hidden.d.ts.map +1 -0
  24. package/dist/typescript/core/accessibility/hidden.js +216 -0
  25. package/dist/typescript/core/accessibility/hidden.js.map +1 -0
  26. package/dist/typescript/core/accessibility/roles.d.ts +28 -0
  27. package/dist/typescript/core/accessibility/roles.d.ts.map +1 -0
  28. package/dist/typescript/core/accessibility/roles.js +381 -0
  29. package/dist/typescript/core/accessibility/roles.js.map +1 -0
  30. package/dist/typescript/core/accessibility/snapshot.d.ts +13 -0
  31. package/dist/typescript/core/accessibility/snapshot.d.ts.map +1 -0
  32. package/dist/typescript/core/accessibility/snapshot.js +55 -0
  33. package/dist/typescript/core/accessibility/snapshot.js.map +1 -0
  34. package/dist/typescript/core/accessibility/states.d.ts +18 -0
  35. package/dist/typescript/core/accessibility/states.d.ts.map +1 -0
  36. package/dist/typescript/core/accessibility/states.js +215 -0
  37. package/dist/typescript/core/accessibility/states.js.map +1 -0
  38. package/dist/typescript/core/accessibility/tree.d.ts +10 -0
  39. package/dist/typescript/core/accessibility/tree.d.ts.map +1 -0
  40. package/dist/typescript/core/accessibility/tree.js +261 -0
  41. package/dist/typescript/core/accessibility/tree.js.map +1 -0
  42. package/dist/typescript/core/accessibility/types.d.ts +30 -0
  43. package/dist/typescript/core/accessibility/types.d.ts.map +1 -0
  44. package/dist/typescript/core/accessibility/types.js +18 -0
  45. package/dist/typescript/core/accessibility/types.js.map +1 -0
  46. package/dist/typescript/core/accessibility/value.d.ts +4 -0
  47. package/dist/typescript/core/accessibility/value.d.ts.map +1 -0
  48. package/dist/typescript/core/accessibility/value.js +83 -0
  49. package/dist/typescript/core/accessibility/value.js.map +1 -0
  50. package/dist/typescript/core/accessibility/wire.d.ts +57 -0
  51. package/dist/typescript/core/accessibility/wire.d.ts.map +1 -0
  52. package/dist/typescript/core/accessibility/wire.js +72 -0
  53. package/dist/typescript/core/accessibility/wire.js.map +1 -0
  54. package/index.ts +4 -0
  55. package/package.json +15 -1
  56. package/typescript/accessibility-snapshot-wire.ts +20 -0
  57. package/typescript/accessibility-snapshot.ts +21 -0
  58. package/typescript/core/accessibility/accname.ts +587 -0
  59. package/typescript/core/accessibility/context.ts +116 -0
  60. package/typescript/core/accessibility/hidden.ts +242 -0
  61. package/typescript/core/accessibility/roles.ts +410 -0
  62. package/typescript/core/accessibility/snapshot.ts +61 -0
  63. package/typescript/core/accessibility/states.ts +233 -0
  64. package/typescript/core/accessibility/tree.ts +306 -0
  65. package/typescript/core/accessibility/types.ts +52 -0
  66. package/typescript/core/accessibility/value.ts +89 -0
  67. package/typescript/core/accessibility/wire.ts +123 -0
@@ -0,0 +1,49 @@
1
+ import { computeRole } from './roles.js';
2
+ export function createContext(options) {
3
+ return {
4
+ interestingOnly: options === undefined || options === null || options.interestingOnly !== false,
5
+ roles: new Map(),
6
+ hidden: new Map(),
7
+ imageMaps: new Map(),
8
+ styles: new Map(),
9
+ names: new Map(),
10
+ descriptions: new Map(),
11
+ descendantTexts: new Map(),
12
+ contentTexts: new Map(),
13
+ referenceTexts: new Map(),
14
+ generated: new Map(),
15
+ generatedScopes: new Map(),
16
+ placed: new Set(),
17
+ owned: new Map(),
18
+ claimed: new Set(),
19
+ };
20
+ }
21
+ export function roleOf(element, context) {
22
+ let role = context.roles.get(element);
23
+ if (role === undefined) {
24
+ // The role of a cell depends on its table's, which every cell would
25
+ // otherwise recompute; the lookup goes through this cache.
26
+ role = computeRole(element, (owner) => roleOf(owner, context));
27
+ context.roles.set(element, role);
28
+ }
29
+ return role;
30
+ }
31
+ /**
32
+ * The computed style of an element, or of one of its pseudo-elements when
33
+ * `pseudo` is "::before" or "::after". Null when the element has no view.
34
+ */
35
+ export function styleOf(element, context, pseudo = '') {
36
+ let perPseudo = context.styles.get(element);
37
+ if (!perPseudo) {
38
+ perPseudo = new Map();
39
+ context.styles.set(element, perPseudo);
40
+ }
41
+ let style = perPseudo.get(pseudo);
42
+ if (style === undefined) {
43
+ const view = element.ownerDocument.defaultView;
44
+ style = view ? view.getComputedStyle(element, pseudo || null) : null;
45
+ perPseudo.set(pseudo, style);
46
+ }
47
+ return style;
48
+ }
49
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/context.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAkDxC,MAAM,UAAU,aAAa,CAAC,OAAyB;IACrD,OAAO;QACL,eAAe,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAA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AAG,EAAE,CAAA;QACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACxC,CAAC;IACD,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAA;QAC9C,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACpE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC9B,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { SnapshotContext } from './context.js';
2
+ /**
3
+ * What an element does to its own visibility, with no regard to ancestors:
4
+ * rendered it has a box
5
+ * self its own box is invisible but a descendant may set itself visible
6
+ * again (visibility is inherited, not a subtree switch)
7
+ * contents its own box is rendered but nothing below it is
8
+ * (content-visibility: hidden, which hidden="until-found" uses)
9
+ * subtree neither it nor anything below it is rendered
10
+ */
11
+ export type HiddenState = 'rendered' | 'self' | 'contents' | 'subtree';
12
+ export declare function isClosedDetails(element: Element): boolean;
13
+ /**
14
+ * The nodes rendered as this element's children, in render order: the shadow
15
+ * root's children for a host, the assigned nodes (or the fallback while none
16
+ * are assigned) for a slot, otherwise the DOM children. Nested slots are
17
+ * flattened away, so a slot element never appears in the result.
18
+ *
19
+ * A closed shadow root cannot be seen, so its host's light children are
20
+ * returned as if they rendered; see flatTreeParent.
21
+ */
22
+ export declare function flatTreeChildren(element: Element): ArrayLike<Node>;
23
+ /**
24
+ * Children of a closed details element are not rendered, apart from its first
25
+ * summary. The browser does this through a UA shadow tree that is closed to
26
+ * script, so it has to be known here rather than read from the DOM.
27
+ */
28
+ export declare function isCollapsedDetailsContent(child: Element, parent: Element): boolean;
29
+ /**
30
+ * See HiddenState. Ancestors are not consulted; isHidden does that. Cached
31
+ * per element in the context: the walk, name-from-content and reference
32
+ * resolution all ask about the same elements.
33
+ */
34
+ export declare function hiddenState(element: Element, context: SnapshotContext): HiddenState;
35
+ /** Whether an ancestor in the flat tree hides this element, whatever the element does itself. */
36
+ export declare function isHiddenByAncestor(element: Element, context: SnapshotContext): boolean;
37
+ /** Whether the element is hidden in the accname sense. */
38
+ export declare function isHidden(element: Element, context: SnapshotContext): boolean;
39
+ //# sourceMappingURL=hidden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/hidden.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,eAAe,EAAW,MAAM,cAAc,CAAA;AAKvD;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;AAuCtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEzD;AA4CD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAQlE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAUlF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,WAAW,CAOnF;AAsCD,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAgBtF;AAED,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAS5E"}
@@ -0,0 +1,216 @@
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
+ // "Hidden" in the accname sense (https://w3c.github.io/accname/#dfn-hidden):
18
+ // an element that is not rendered, or that has aria-hidden=true on itself or
19
+ // an ancestor. This is deliberately not bot.dom.isShown. WebDriver's
20
+ // displayedness also prunes zero-size, transparent and off-screen content,
21
+ // which assistive technology does reach; the "visually hidden" CSS pattern
22
+ // that screen-reader-only text relies on is built on exactly that difference.
23
+ //
24
+ // Ancestry follows the flat tree (slots and shadow hosts), because that is
25
+ // what gets rendered, not the light DOM.
26
+ import { styleOf } from './context.js';
27
+ const DOCUMENT_NODE = 9;
28
+ const DOCUMENT_FRAGMENT_NODE = 11;
29
+ // The flat-tree parent of a node, or one of two terminals.
30
+ const NOT_RENDERED = Symbol('not rendered');
31
+ function isAriaHidden(element) {
32
+ const value = element.getAttribute('aria-hidden');
33
+ return value !== null && value.trim().toLowerCase() === 'true';
34
+ }
35
+ // The UA stylesheet gives every area display: none; what renders it is the
36
+ // image whose usemap points at its map. So an area is as hidden as that image.
37
+ // The document-wide image lookup is done once per map name and snapshot, since
38
+ // every area of a map shares the answer.
39
+ function areaState(area, context) {
40
+ const map = area.closest('map');
41
+ const name = map ? map.getAttribute('name') : null;
42
+ if (!name) {
43
+ return 'subtree';
44
+ }
45
+ const known = context.imageMaps.get(name);
46
+ if (known !== undefined) {
47
+ return known;
48
+ }
49
+ let state = 'subtree';
50
+ const images = area.ownerDocument.querySelectorAll('img[usemap]');
51
+ for (let i = 0; i < images.length; i++) {
52
+ const image = images[i];
53
+ const usemap = (image.getAttribute('usemap') || '').replace(/^#/, '');
54
+ if (usemap === name && hiddenState(image, context) === 'rendered' && !isHiddenByAncestor(image, context)) {
55
+ state = 'rendered';
56
+ break;
57
+ }
58
+ }
59
+ context.imageMaps.set(name, state);
60
+ return state;
61
+ }
62
+ export function isClosedDetails(element) {
63
+ return element.localName === 'details' && !element.hasAttribute('open');
64
+ }
65
+ /**
66
+ * The parent that renders this node: its slot when it is assigned to one, the
67
+ * host when it sits directly in a shadow root, otherwise its DOM parent. Null
68
+ * at the document; NOT_RENDERED for nodes the flat tree leaves out (a child of
69
+ * a shadow host that no slot took, fallback content of a slot that has
70
+ * assigned nodes, anything detached or inside an inert fragment).
71
+ *
72
+ * A closed shadow root cannot be seen from outside: `shadowRoot` and
73
+ * `assignedSlot` are both null for its host's children, so those read as
74
+ * ordinary children of the host and are treated as rendered.
75
+ */
76
+ // An HTML slot element; an element merely named slot in another namespace
77
+ // has no assigned nodes to ask for.
78
+ function isSlot(element) {
79
+ return element.localName === 'slot' && 'assignedNodes' in element;
80
+ }
81
+ function flatTreeParent(node) {
82
+ const parent = node.parentNode;
83
+ if (!parent) {
84
+ return NOT_RENDERED;
85
+ }
86
+ if (node.assignedSlot) {
87
+ return node.assignedSlot;
88
+ }
89
+ if (parent.nodeType === DOCUMENT_FRAGMENT_NODE) {
90
+ const host = parent.host;
91
+ return host ? host : NOT_RENDERED;
92
+ }
93
+ if (parent.nodeType === DOCUMENT_NODE) {
94
+ return null;
95
+ }
96
+ const parentElement = parent;
97
+ if (parentElement.shadowRoot) {
98
+ return NOT_RENDERED;
99
+ }
100
+ if (isSlot(parentElement) && parentElement.assignedNodes().length > 0) {
101
+ return NOT_RENDERED;
102
+ }
103
+ return parentElement;
104
+ }
105
+ /**
106
+ * The nodes rendered as this element's children, in render order: the shadow
107
+ * root's children for a host, the assigned nodes (or the fallback while none
108
+ * are assigned) for a slot, otherwise the DOM children. Nested slots are
109
+ * flattened away, so a slot element never appears in the result.
110
+ *
111
+ * A closed shadow root cannot be seen, so its host's light children are
112
+ * returned as if they rendered; see flatTreeParent.
113
+ */
114
+ export function flatTreeChildren(element) {
115
+ if (isSlot(element)) {
116
+ return element.assignedNodes({ flatten: true });
117
+ }
118
+ if (element.shadowRoot) {
119
+ return element.shadowRoot.childNodes;
120
+ }
121
+ return element.childNodes;
122
+ }
123
+ /**
124
+ * Children of a closed details element are not rendered, apart from its first
125
+ * summary. The browser does this through a UA shadow tree that is closed to
126
+ * script, so it has to be known here rather than read from the DOM.
127
+ */
128
+ export function isCollapsedDetailsContent(child, parent) {
129
+ if (!isClosedDetails(parent)) {
130
+ return false;
131
+ }
132
+ for (let sibling = parent.firstElementChild; sibling; sibling = sibling.nextElementSibling) {
133
+ if (sibling.localName === 'summary') {
134
+ return sibling !== child;
135
+ }
136
+ }
137
+ return true;
138
+ }
139
+ /**
140
+ * See HiddenState. Ancestors are not consulted; isHidden does that. Cached
141
+ * per element in the context: the walk, name-from-content and reference
142
+ * resolution all ask about the same elements.
143
+ */
144
+ export function hiddenState(element, context) {
145
+ let state = context.hidden.get(element);
146
+ if (state === undefined) {
147
+ state = computeHiddenState(element, context);
148
+ context.hidden.set(element, state);
149
+ }
150
+ return state;
151
+ }
152
+ function computeHiddenState(element, context) {
153
+ // Inert content is still painted, but browsers leave it out of the
154
+ // accessibility tree along with everything it contains.
155
+ if (isAriaHidden(element) || element.hasAttribute('inert')) {
156
+ return 'subtree';
157
+ }
158
+ // With scripting enabled a noscript element renders nothing, but Chromium
159
+ // decides that in layout rather than in its UA stylesheet, so its computed
160
+ // display still reads inline. This atom only ever runs as script.
161
+ if (element.localName === 'noscript') {
162
+ return 'subtree';
163
+ }
164
+ if (element.localName === 'area') {
165
+ return areaState(element, context);
166
+ }
167
+ const style = styleOf(element, context);
168
+ // No view (an inert template fragment) and a detached element (empty
169
+ // computed values) are both unrendered.
170
+ if (!style || style.display === '' || style.display === 'none') {
171
+ return 'subtree';
172
+ }
173
+ const visibility = style.visibility;
174
+ const invisible = visibility === 'hidden' || visibility === 'collapse';
175
+ const contentsSkipped = style.getPropertyValue('content-visibility') === 'hidden';
176
+ if (invisible && contentsSkipped) {
177
+ return 'subtree';
178
+ }
179
+ if (contentsSkipped) {
180
+ return 'contents';
181
+ }
182
+ if (invisible) {
183
+ return 'self';
184
+ }
185
+ return 'rendered';
186
+ }
187
+ /** Whether an ancestor in the flat tree hides this element, whatever the element does itself. */
188
+ export function isHiddenByAncestor(element, context) {
189
+ let child = element;
190
+ for (;;) {
191
+ const parent = flatTreeParent(child);
192
+ if (parent === NOT_RENDERED) {
193
+ return true;
194
+ }
195
+ if (parent === null) {
196
+ return false;
197
+ }
198
+ const state = hiddenState(parent, context);
199
+ if (isCollapsedDetailsContent(child, parent) || state === 'subtree' || state === 'contents') {
200
+ return true;
201
+ }
202
+ child = parent;
203
+ }
204
+ }
205
+ /** Whether the element is hidden in the accname sense. */
206
+ export function isHidden(element, context) {
207
+ const own = hiddenState(element, context);
208
+ if (own === 'self' || own === 'subtree') {
209
+ return true;
210
+ }
211
+ // Visibility is inherited, so the element's own computed value above already
212
+ // accounts for ancestors that set it; only subtree-wide hiding is checked
213
+ // on the way up.
214
+ return isHiddenByAncestor(element, context);
215
+ }
216
+ //# sourceMappingURL=hidden.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden.js","sourceRoot":"","sources":["../../../../typescript/core/accessibility/hidden.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,6EAA6E;AAC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QACjC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,OAAwB;IAC3E,IAAI,KAAK,GAAG,OAAO,CAAA;IACnB,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACpC,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1C,IAAI,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;YAC5F,OAAO,IAAI,CAAA;QACb,CAAC;QACD,KAAK,GAAG,MAAM,CAAA;IAChB,CAAC;AACH,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,OAAwB;IACjE,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACzC,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,6EAA6E;IAC7E,0EAA0E;IAC1E,iBAAiB;IACjB,OAAO,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare function isPresentational(role: string): boolean;
2
+ /**
3
+ * How the role of another element is found when one element's role depends
4
+ * on it (a cell on its table, an li on its list). The snapshot context
5
+ * passes its cached lookup so the owner is computed once for all of them.
6
+ */
7
+ export type RoleLookup = (element: Element) => string;
8
+ /**
9
+ * The first token of the role attribute that names a role authors may use,
10
+ * or null when there is none. Tokens match ASCII case-insensitively, which is
11
+ * what engines do.
12
+ */
13
+ export declare function explicitRole(element: Element): string | null;
14
+ export declare function canTakeFocus(element: Element): boolean;
15
+ /**
16
+ * The html-aam implicit role of an element, with no regard to its role
17
+ * attribute. `lookup` finds the role of an element this one depends on.
18
+ */
19
+ export declare function implicitRole(element: Element, lookup?: RoleLookup): string;
20
+ /**
21
+ * The role the snapshot reports for an element: the explicit role when it
22
+ * names a usable role and is not a presentational role on an element that
23
+ * cannot be presentational (WAI-ARIA 1.2 §9.1), otherwise the implicit one.
24
+ * `lookup` finds the role of an element this one depends on; without one,
25
+ * it is computed afresh.
26
+ */
27
+ export declare function computeRole(element: Element, lookup?: RoleLookup): string;
28
+ //# sourceMappingURL=roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../../typescript/core/accessibility/roles.ts"],"names":[],"mappings":"AAkEA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;AAErD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAW5D;AAUD,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiBtD;AA2HD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,UAAwB,GAAG,MAAM,CAyIvF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,UAAwB,GAAG,MAAM,CAgBtF"}