|
1 | 1 | import { PluginFunction } from 'vue';
|
2 | 2 |
|
3 |
| -interface RunOptions { |
4 |
| - clearConsole: boolean; |
5 |
| - element: Document | HTMLElement; |
| 3 | +export interface RunOptions { |
| 4 | + clearConsole: boolean; |
| 5 | + element: Document | HTMLElement; |
6 | 6 | }
|
7 | 7 |
|
8 |
| -export interface VueAxe |
9 |
| -{ |
10 |
| - run({ clearConsole, element }: RunOptions): void; |
| 8 | +export interface AxeConfig { |
| 9 | + /** |
| 10 | + * mixed(optional) Used to set the branding of the helpUrls |
| 11 | + */ |
| 12 | + branding?: { |
| 13 | + /** |
| 14 | + * string(optional) sets the brand string - default "axe" |
| 15 | + */ |
| 16 | + brand?: string, |
| 17 | + /** |
| 18 | + * string(optional) sets the application string - default "axeAPI" |
| 19 | + */ |
| 20 | + application?: string |
| 21 | + }, |
| 22 | + /** |
| 23 | + * Used to set the output format that the axe.run function will pass to the callback function |
| 24 | + */ |
| 25 | + reporter?: string, |
| 26 | + /** |
| 27 | + * Used to add checks to the list of checks used by rules, or to override the properties of existing checks |
| 28 | + */ |
| 29 | + checks?: any, |
| 30 | + /** |
| 31 | + * Used to add rules to the existing set of rules, or to override the properties of existing rules |
| 32 | + */ |
| 33 | + rules?: any, |
| 34 | + /** |
| 35 | + * A locale object to apply (at runtime) to all rules and checks, in the same shape as /locales/*.json. |
| 36 | + */ |
| 37 | + locale?: any, |
| 38 | + /** |
| 39 | + * Set the compatible version of a custom rule with the current axe version. Compatible versions are all patch and minor updates that are the same as, or newer than those of the `axeVersion` property |
| 40 | + */ |
| 41 | + axeVersion?: string |
| 42 | +} |
| 43 | + |
| 44 | +export interface AxeRunOptions { |
| 45 | + /** |
| 46 | + * Limit which rules are executed, based on names or tags |
| 47 | + */ |
| 48 | + runOnly?: any, |
| 49 | + /** |
| 50 | + * Allow customizing a rule's properties (including { enable: false }) |
| 51 | + */ |
| 52 | + rules?: any, |
| 53 | + /** |
| 54 | + * Which reporter to use |
| 55 | + */ |
| 56 | + reporter?: string, |
| 57 | + /** |
| 58 | + * Limit which result types are processed and aggregated |
| 59 | + */ |
| 60 | + resultTypes?: any, |
| 61 | + /** |
| 62 | + * Return xpath selectors for elements |
| 63 | + */ |
| 64 | + xpath?: boolean, |
| 65 | + /** |
| 66 | + * Use absolute paths when creating element selectors |
| 67 | + */ |
| 68 | + absolutePaths?: boolean, |
| 69 | + /** |
| 70 | + * Tell axe to run inside iframes |
| 71 | + */ |
| 72 | + iframes?: boolean, |
| 73 | + /** |
| 74 | + * Return element references in addition to the target |
| 75 | + */ |
| 76 | + elementRef?: boolean, |
| 77 | + /** |
| 78 | + * Scrolls elements back to before axe started |
| 79 | + */ |
| 80 | + restoreScroll?: boolean, |
| 81 | + /** |
| 82 | + * How long (in milliseconds) axe waits for a response from embedded frames before timing out |
| 83 | + */ |
| 84 | + frameWaitTime?: number, |
| 85 | + /** |
| 86 | + * Any additional assets (eg: cssom) to preload before running rules |
| 87 | + */ |
| 88 | + preload?: boolean, |
| 89 | + /** |
| 90 | + * Log rule performance metrics to the console |
| 91 | + */ |
| 92 | + performanceTimer?: boolean, |
| 93 | +} |
| 94 | + |
| 95 | +export interface VueAxeStyle { |
| 96 | + head?: string, |
| 97 | + boldCourier?: string, |
| 98 | + moderate?: string, |
| 99 | + critical?: string, |
| 100 | + serious?: string, |
| 101 | + minor?: string, |
| 102 | + title?: string, |
| 103 | + url?: string |
| 104 | +} |
| 105 | + |
| 106 | +export interface VueAxeOptions { |
| 107 | + /** |
| 108 | + * Disables automatic verification. Only checks with $axe.run |
| 109 | + */ |
| 110 | + auto?: boolean, |
| 111 | + /** |
| 112 | + * Clears the console each time vue-axe runs |
| 113 | + */ |
| 114 | + clearConsoleOnUpdate?: boolean, |
| 115 | + /** |
| 116 | + * Provide your Axe-core configuration |
| 117 | + */ |
| 118 | + config?: AxeConfig, |
| 119 | + /** |
| 120 | + * Provide your Axe-core runtime options |
| 121 | + */ |
| 122 | + runOptions?: AxeRunOptions, |
| 123 | + /** |
| 124 | + * Used to delay the first check. - `Millisecond` |
| 125 | + */ |
| 126 | + delay?: number |
| 127 | + /** |
| 128 | + * |
| 129 | + */ |
| 130 | + style?: VueAxeStyle, |
| 131 | + /** |
| 132 | + * Register Axe plugins |
| 133 | + */ |
| 134 | + plugins?: any[], |
| 135 | + /** |
| 136 | + * Handle the results. (This may be needed for automated tests) |
| 137 | + */ |
| 138 | + customResultHandler?: (error: any, results: any), |
| 139 | +} |
| 140 | + |
| 141 | +export interface VueAxe { |
| 142 | + run({ clearConsole, element }: RunOptions): void; |
11 | 143 |
|
12 |
| - plugins: Record<string, any>; |
| 144 | + plugins: Record<string, any>; |
13 | 145 |
|
14 |
| - clearConsole(forceClear: boolean): void; |
15 |
| - |
16 |
| - debounce(): void; |
| 146 | + clearConsole(forceClear: boolean): void; |
| 147 | + |
| 148 | + debounce(): void; |
17 | 149 | }
|
18 | 150 |
|
19 |
| -declare module 'vue/types/vue' |
20 |
| -{ |
21 |
| - interface Vue |
22 |
| - { |
23 |
| - $axe: VueAxe; |
24 |
| - } |
| 151 | +declare module 'vue/types/vue' { |
| 152 | + interface Vue { |
| 153 | + $axe: VueAxe; |
| 154 | + } |
25 | 155 | }
|
26 | 156 |
|
27 |
| -export declare class VueAxe |
28 |
| -{ |
29 |
| - static install: PluginFunction<never>; |
| 157 | +declare class VueAxePlugin { |
| 158 | + static install: PluginFunction<VueAxeOptions>; |
30 | 159 | }
|
31 | 160 |
|
32 |
| -export default VueAxe; |
| 161 | +export default VueAxePlugin; |
0 commit comments