axe-core 4.7.2 → 4.8.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/axe.d.ts CHANGED
@@ -164,9 +164,9 @@ declare namespace axe {
164
164
  interface NodeResult {
165
165
  html: string;
166
166
  impact?: ImpactValue;
167
- target: string[];
167
+ target: UnlabelledFrameSelector;
168
168
  xpath?: string[];
169
- ancestry?: string[];
169
+ ancestry?: UnlabelledFrameSelector;
170
170
  any: CheckResult[];
171
171
  all: CheckResult[];
172
172
  none: CheckResult[];
@@ -181,8 +181,11 @@ declare namespace axe {
181
181
  relatedNodes?: RelatedNode[];
182
182
  }
183
183
  interface RelatedNode {
184
- target: string[];
185
184
  html: string;
185
+ target: UnlabelledFrameSelector;
186
+ xpath?: string[];
187
+ ancestry?: UnlabelledFrameSelector;
188
+ element?: HTMLElement;
186
189
  }
187
190
  interface RuleLocale {
188
191
  [key: string]: {
@@ -193,7 +196,7 @@ declare namespace axe {
193
196
  interface CheckMessages {
194
197
  pass: string | { [key: string]: string };
195
198
  fail: string | { [key: string]: string };
196
- incomplete: string | { [key: string]: string };
199
+ incomplete?: string | { [key: string]: string };
197
200
  }
198
201
  interface CheckLocale {
199
202
  [key: string]: CheckMessages;
@@ -257,10 +260,31 @@ declare namespace axe {
257
260
  brand?: string;
258
261
  application?: string;
259
262
  }
263
+ interface CheckHelper {
264
+ async: () => (result: boolean | undefined | Error) => void;
265
+ data: (data: unknown) => void;
266
+ relatedNodes: (nodes: Element[]) => void;
267
+ }
268
+ interface AfterResult {
269
+ id: string;
270
+ data?: unknown;
271
+ relatedNodes: SerialDqElement[];
272
+ result: boolean | undefined;
273
+ node: SerialDqElement;
274
+ }
260
275
  interface Check {
261
276
  id: string;
262
- evaluate?: Function | string;
263
- after?: Function | string;
277
+ evaluate?:
278
+ | string
279
+ | ((
280
+ this: CheckHelper,
281
+ node: Element,
282
+ options: unknown,
283
+ virtualNode: VirtualNode
284
+ ) => boolean | undefined | void);
285
+ after?:
286
+ | string
287
+ | ((results: AfterResult[], options: unknown) => AfterResult[]);
264
288
  options?: any;
265
289
  matches?: string;
266
290
  enabled?: boolean;
@@ -280,9 +304,10 @@ declare namespace axe {
280
304
  all?: string[];
281
305
  none?: string[];
282
306
  tags?: string[];
283
- matches?: string;
307
+ matches?: string | ((node: Element, virtualNode: VirtualNode) => boolean);
284
308
  reviewOnFail?: boolean;
285
- metadata?: Omit<RuleMetadata, 'ruleId'>;
309
+ actIds?: string[];
310
+ metadata?: Omit<RuleMetadata, 'ruleId' | 'tags' | 'actIds'>;
286
311
  }
287
312
  interface AxePlugin {
288
313
  id: string;
@@ -346,7 +371,8 @@ declare namespace axe {
346
371
  type AxeReporter<T = unknown> = (
347
372
  rawResults: RawResult[],
348
373
  option: RunOptions,
349
- callback: (report: T) => void
374
+ resolve: (report: T) => void,
375
+ reject: (error: Error) => void
350
376
  ) => void;
351
377
 
352
378
  interface VirtualNode {
@@ -367,6 +393,42 @@ declare namespace axe {
367
393
  shadowSelect: (selector: CrossTreeSelector) => Element | null;
368
394
  shadowSelectAll: (selector: CrossTreeSelector) => Element[];
369
395
  getStandards(): Required<Standards>;
396
+ DqElement: new (
397
+ elm: Element,
398
+ options?: { absolutePaths?: boolean }
399
+ ) => SerialDqElement;
400
+ uuid: (
401
+ options?: { random?: Uint8Array | Array<number> },
402
+ buf?: Uint8Array | Array<number>,
403
+ offset?: number
404
+ ) => string | Uint8Array | Array<number>;
405
+ }
406
+
407
+ interface Aria {
408
+ getRoleType: (role: string | Element | VirtualNode | null) => string | null;
409
+ }
410
+
411
+ interface Dom {
412
+ isFocusable: (node: Element | VirtualNode) => boolean;
413
+ isNativelyFocusable: (node: Element | VirtualNode) => boolean;
414
+ }
415
+
416
+ type AccessibleTextOptions = {
417
+ inControlContext?: boolean;
418
+ inLabelledByContext?: boolean;
419
+ };
420
+
421
+ interface Text {
422
+ accessibleText: (
423
+ element: Element,
424
+ options?: AccessibleTextOptions
425
+ ) => string;
426
+ }
427
+
428
+ interface Commons {
429
+ aria: Aria;
430
+ dom: Dom;
431
+ text: Text;
370
432
  }
371
433
 
372
434
  interface EnvironmentData {
@@ -380,6 +442,7 @@ declare namespace axe {
380
442
  let version: string;
381
443
  let plugins: any;
382
444
  let utils: Utils;
445
+ let commons: Commons;
383
446
 
384
447
  /**
385
448
  * Source string to use as an injected script in Selenium