|
1 |
| -//!! generated by clutz. |
2 |
| -// Generated from a11y/aria/aria.js |
3 |
| -declare namespace ಠ_ಠ.clutz.goog.a11y.aria { |
4 |
| - /** |
5 |
| - * Asserts that the element has a role set if it's not an HTML element whose |
6 |
| - * semantics is well supported by most screen readers. |
7 |
| - * Only to be used internally by the ARIA library in goog.a11y.aria.*. |
8 |
| - * @param element The element to assert an ARIA role set. |
9 |
| - * @param allowedRoles The child roles of the roles. |
10 |
| - */ |
11 |
| - function assertRoleIsSetInternalUtil (element : GlobalElement , allowedRoles : ArrayLike < string > ) : void ; |
12 |
| - /** |
13 |
| - * Returns the activedescendant element for the input element by |
14 |
| - * using the activedescendant ARIA property of the given element. |
15 |
| - * @param element DOM node to get activedescendant element for. |
16 |
| - */ |
17 |
| - function getActiveDescendant (element : GlobalElement ) : GlobalElement | null ; |
18 |
| - /** |
19 |
| - * Gets the label of the given element. |
20 |
| - * @param element DOM node to get label from. |
21 |
| - */ |
22 |
| - function getLabel (element : GlobalElement ) : string ; |
23 |
| - /** |
24 |
| - * Gets role of an element. |
25 |
| - * @param element DOM element to get role of. |
26 |
| - */ |
27 |
| - function getRole (element : GlobalElement ) : ಠ_ಠ.clutz.goog.a11y.aria.Role | null ; |
28 |
| - /** |
29 |
| - * Gets value of specified state or property. |
30 |
| - * @param element DOM node to get state from. |
31 |
| - * @param stateName State name. |
32 |
| - */ |
33 |
| - function getState (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : string ; |
34 |
| - /** |
35 |
| - * Gets the boolean value of an ARIA state/property. |
36 |
| - * @param element The element to get the ARIA state for. |
37 |
| - * @param stateName the ARIA state name. |
38 |
| - */ |
39 |
| - function getStateBoolean (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : boolean | null ; |
40 |
| - /** |
41 |
| - * Gets the number value of an ARIA state/property. |
42 |
| - * @param element The element to get the ARIA state for. |
43 |
| - * @param stateName the ARIA state name. |
44 |
| - */ |
45 |
| - function getStateNumber (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : number | null ; |
46 |
| - /** |
47 |
| - * Gets the string value of an ARIA state/property. |
48 |
| - * @param element The element to get the ARIA state for. |
49 |
| - * @param stateName the ARIA state name. |
50 |
| - */ |
51 |
| - function getStateString (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : string | null ; |
52 |
| - /** |
53 |
| - * Gets array of strings value of the specified state or |
54 |
| - * property for the element. |
55 |
| - * Only to be used internally by the ARIA library in goog.a11y.aria.*. |
56 |
| - * @param element DOM node to get state from. |
57 |
| - * @param stateName State name. |
58 |
| - */ |
59 |
| - function getStringArrayStateInternalUtil (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State ) : ArrayLike < string > ; |
60 |
| - /** |
61 |
| - * Returns true if element has an ARIA state/property, false otherwise. |
62 |
| - * @param element The element to get the ARIA state for. |
63 |
| - * @param stateName the ARIA state name. |
64 |
| - */ |
65 |
| - function hasState (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : boolean ; |
66 |
| - /** |
67 |
| - * Returns whether the element has a container ARIA role. |
68 |
| - * Container roles are ARIA roles that use the aria-activedescendant property |
69 |
| - * to manage their active descendants or children. See |
70 |
| - * {@link http://www.w3.org/TR/wai-aria/states_and_properties |
71 |
| - * #aria-activedescendant} for more information. |
72 |
| - */ |
73 |
| - function isContainerRole (element : GlobalElement ) : boolean ; |
74 |
| - /** |
75 |
| - * Removes role of an element. |
76 |
| - * @param element DOM element to remove the role from. |
77 |
| - */ |
78 |
| - function removeRole (element : GlobalElement ) : void ; |
79 |
| - /** |
80 |
| - * Remove the state or property for the element. |
81 |
| - * @param element DOM node where we set state. |
82 |
| - * @param stateName State name. |
83 |
| - */ |
84 |
| - function removeState (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State ) : void ; |
85 |
| - /** |
86 |
| - * Sets the activedescendant ARIA property value for an element. |
87 |
| - * If the activeElement is not null, it should have an id set. |
88 |
| - * @param element DOM node to set activedescendant ARIA property to. |
89 |
| - * @param activeElement DOM node being set as activedescendant. |
90 |
| - */ |
91 |
| - function setActiveDescendant (element : GlobalElement , activeElement : GlobalElement | null ) : void ; |
92 |
| - /** |
93 |
| - * Sets the label of the given element. |
94 |
| - * @param element DOM node to set label to. |
95 |
| - * @param label The label to set. |
96 |
| - */ |
97 |
| - function setLabel (element : GlobalElement , label : string ) : void ; |
98 |
| - /** |
99 |
| - * Sets the role of an element. If the roleName is |
100 |
| - * empty string or null, the role for the element is removed. |
101 |
| - * We encourage clients to call the goog.a11y.aria.removeRole |
102 |
| - * method instead of setting null and empty string values. |
103 |
| - * Special handling for this case is added to ensure |
104 |
| - * backword compatibility with existing code. |
105 |
| - * @param element DOM node to set role of. |
106 |
| - * @param roleName role name(s). |
107 |
| - */ |
108 |
| - function setRole (element : GlobalElement , roleName : ಠ_ಠ.clutz.goog.a11y.aria.Role | string ) : void ; |
109 |
| - /** |
110 |
| - * Sets the state or property of an element. |
111 |
| - * @param element DOM node where we set state. |
112 |
| - * @param stateName State attribute being set. Automatically adds prefix 'aria-' to the state name if the attribute is not an extra attribute. |
113 |
| - * @param value Value for the state attribute. |
114 |
| - */ |
115 |
| - function setState (element : GlobalElement , stateName : ಠ_ಠ.clutz.goog.a11y.aria.State | string , value : string | boolean | number | string [] ) : void ; |
116 |
| - /** |
117 |
| - * Toggles the ARIA attribute of an element. |
118 |
| - * Meant for attributes with a true/false value, but works with any attribute. |
119 |
| - * If the attribute does not have a true/false value, the following rules apply: |
120 |
| - * A not empty attribute will be removed. |
121 |
| - * An empty attribute will be set to true. |
122 |
| - * @param el DOM node for which to set attribute. |
123 |
| - * @param attr ARIA attribute being set. Automatically adds prefix 'aria-' to the attribute name if the attribute is not an extra attribute. |
124 |
| - */ |
125 |
| - function toggleState (el : GlobalElement , attr : ಠ_ಠ.clutz.goog.a11y.aria.State | string ) : void ; |
126 |
| -} |
127 |
| -declare module 'goog:goog.a11y.aria' { |
128 |
| - import aria = ಠ_ಠ.clutz.goog.a11y.aria; |
129 |
| - export = aria; |
130 |
| -} |
| 1 | +import { Role } from './roles.js'; |
| 2 | +import { State } from './attributes.js'; |
| 3 | +/** |
| 4 | + * Sets the role of an element. If the roleName is |
| 5 | + * empty string or null, the role for the element is removed. |
| 6 | + * We encourage clients to call the removeRole |
| 7 | + * method instead of setting null and empty string values. |
| 8 | + * Special handling for this case is added to ensure |
| 9 | + * backword compatibility with existing code. |
| 10 | + * @param element DOM node to set role of. |
| 11 | + * @param roleName role name(s). |
| 12 | + */ |
| 13 | +export declare function setRole(element: Element, roleName: Role | string): void; |
| 14 | +/** |
| 15 | + * Gets role of an element. |
| 16 | + * @param element DOM element to get role of. |
| 17 | + * @return ARIA Role name. |
| 18 | + */ |
| 19 | +export declare function getRole(element: Element): Role | null; |
| 20 | +/** |
| 21 | + * Removes role of an element. |
| 22 | + * @param element DOM element to remove the role from. |
| 23 | + */ |
| 24 | +export declare function removeRole(element: Element): void; |
| 25 | +/** |
| 26 | + * Sets the state or property of an element. |
| 27 | + * @param element DOM node where we set state. |
| 28 | + * @param stateName State attribute being set. Automatically adds prefix 'aria-' to the state name if the attribute is not an extra attribute. |
| 29 | + * @param value Value for the state attribute. |
| 30 | + */ |
| 31 | +export declare function setState(element: Element, stateName: State | string, value: string | boolean | number | string[]): void; |
| 32 | +/** |
| 33 | + * Toggles the ARIA attribute of an element. |
| 34 | + * Meant for attributes with a true/false value, but works with any attribute. |
| 35 | + * If the attribute does not have a true/false value, the following rules apply: |
| 36 | + * A not empty attribute will be removed. |
| 37 | + * An empty attribute will be set to true. |
| 38 | + * @param el DOM node for which to set attribute. |
| 39 | + * @param attr ARIA attribute being set. Automatically adds prefix 'aria-' to the attribute name if the attribute is not an extra attribute. |
| 40 | + */ |
| 41 | +export declare function toggleState(el: Element, attr: State | string): void; |
| 42 | +/** |
| 43 | + * Remove the state or property for the element. |
| 44 | + * @param element DOM node where we set state. |
| 45 | + * @param stateName State name. |
| 46 | + */ |
| 47 | +export declare function removeState(element: Element, stateName: State): void; |
| 48 | +/** |
| 49 | + * Gets value of specified state or property. |
| 50 | + * @param element DOM node to get state from. |
| 51 | + * @param stateName State name. |
| 52 | + * @return Value of the state attribute. |
| 53 | + */ |
| 54 | +export declare function getState(element: Element, stateName: State | string): string; |
| 55 | +/** |
| 56 | + * Returns the activedescendant element for the input element by |
| 57 | + * using the activedescendant ARIA property of the given element. |
| 58 | + * @param element DOM node to get activedescendant element for. |
| 59 | + * @return DOM node of the activedescendant, if found. |
| 60 | + */ |
| 61 | +export declare function getActiveDescendant(element: Element): Element | null; |
| 62 | +/** |
| 63 | + * Sets the activedescendant ARIA property value for an element. |
| 64 | + * If the activeElement is not null, it should have an id set. |
| 65 | + * @param element DOM node to set activedescendant ARIA property to. |
| 66 | + * @param activeElement DOM node being set as activedescendant. |
| 67 | + */ |
| 68 | +export declare function setActiveDescendant(element: Element, activeElement: Element | null): void; |
| 69 | +/** |
| 70 | + * Gets the label of the given element. |
| 71 | + * @param element DOM node to get label from. |
| 72 | + * @return label The label. |
| 73 | + */ |
| 74 | +export declare function getLabel(element: Element): string; |
| 75 | +/** |
| 76 | + * Sets the label of the given element. |
| 77 | + * @param element DOM node to set label to. |
| 78 | + * @param label The label to set. |
| 79 | + */ |
| 80 | +export declare function setLabel(element: Element, label: string): void; |
| 81 | +/** |
| 82 | + * Asserts that the element has a role set if it's not an HTML element whose |
| 83 | + * semantics is well supported by most screen readers. |
| 84 | + * Only to be used internally by the ARIA library in *. |
| 85 | + * @param element The element to assert an ARIA role set. |
| 86 | + * @param allowedRoles The child roles of the roles. |
| 87 | + */ |
| 88 | +export declare function assertRoleIsSetInternalUtil(element: Element, allowedRoles: ArrayLike<string>): void; |
| 89 | +/** |
| 90 | + * Gets the boolean value of an ARIA state/property. |
| 91 | + * @param element The element to get the ARIA state for. |
| 92 | + * @param stateName the ARIA state name. |
| 93 | + * @return Boolean value for the ARIA state value or null if the state value is not 'true', not 'false', or not set. |
| 94 | + */ |
| 95 | +export declare function getStateBoolean(element: Element, stateName: State | string): boolean | null; |
| 96 | +/** |
| 97 | + * Gets the number value of an ARIA state/property. |
| 98 | + * @param element The element to get the ARIA state for. |
| 99 | + * @param stateName the ARIA state name. |
| 100 | + * @return Number value for the ARIA state value or null if the state value is not a number or not set. |
| 101 | + */ |
| 102 | +export declare function getStateNumber(element: Element, stateName: State | string): number | null; |
| 103 | +/** |
| 104 | + * Gets the string value of an ARIA state/property. |
| 105 | + * @param element The element to get the ARIA state for. |
| 106 | + * @param stateName the ARIA state name. |
| 107 | + * @return String value for the ARIA state value or null if the state value is empty string or not set. |
| 108 | + */ |
| 109 | +export declare function getStateString(element: Element, stateName: State | string): string | null; |
| 110 | +/** |
| 111 | + * Gets array of strings value of the specified state or |
| 112 | + * property for the element. |
| 113 | + * Only to be used internally by the ARIA library in *. |
| 114 | + * @param element DOM node to get state from. |
| 115 | + * @param stateName State name. |
| 116 | + * @return string Array value of the state attribute. |
| 117 | + */ |
| 118 | +export declare function getStringArrayStateInternalUtil(element: Element, stateName: State): ArrayLike<string>; |
| 119 | +/** |
| 120 | + * Returns true if element has an ARIA state/property, false otherwise. |
| 121 | + * @param element The element to get the ARIA state for. |
| 122 | + * @param stateName the ARIA state name. |
| 123 | + */ |
| 124 | +export declare function hasState(element: Element, stateName: State | string): boolean; |
| 125 | +/** |
| 126 | + * Returns whether the element has a container ARIA role. |
| 127 | + * Container roles are ARIA roles that use the aria-activedescendant property |
| 128 | + * to manage their active descendants or children. See |
| 129 | + * {@link http://www.w3.org/TR/wai-aria/states_and_properties |
| 130 | + * #aria-activedescendant} for more information. |
| 131 | + */ |
| 132 | +export declare function isContainerRole(element: Element): boolean; |
0 commit comments