axe-core 4.10.3 → 4.11.0-canary.1680105

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/README.md CHANGED
@@ -138,21 +138,21 @@ axe.configure({
138
138
  Axe-core supports the following locales. Do note that since locales are contributed by our community, they are not guaranteed to include all translations needed in a release.
139
139
 
140
140
  - Basque
141
+ - Chinese (Simplified)
142
+ - Chinese (Traditional)
141
143
  - Danish
142
144
  - Dutch
143
145
  - French
144
146
  - German
147
+ - Greek
145
148
  - Hebrew
149
+ - Italian
146
150
  - Japanese
147
151
  - Korean
148
152
  - Norwegian (Bokmål)
149
153
  - Polish
150
154
  - Portuguese (Brazilian)
151
155
  - Spanish
152
- - Greek
153
- - Italian
154
- - Simplified Chinese
155
- - Traditional Chinese
156
156
 
157
157
  ## Updates & Security
158
158
 
package/axe.d.ts CHANGED
@@ -155,7 +155,7 @@ declare namespace axe {
155
155
  toolOptions: RunOptions;
156
156
  passes: Result[];
157
157
  violations: Result[];
158
- incomplete: Result[];
158
+ incomplete: IncompleteResult[];
159
159
  inapplicable: Result[];
160
160
  }
161
161
  interface Result {
@@ -167,6 +167,9 @@ declare namespace axe {
167
167
  tags: TagValue[];
168
168
  nodes: NodeResult[];
169
169
  }
170
+ interface IncompleteResult extends Result {
171
+ error?: Omit<RuleError, 'errorNode'>;
172
+ }
170
173
  interface NodeResult {
171
174
  html: string;
172
175
  impact?: ImpactValue;
@@ -204,6 +207,21 @@ declare namespace axe {
204
207
  fail: string | { [key: string]: string };
205
208
  incomplete?: string | { [key: string]: string };
206
209
  }
210
+ interface RuleError {
211
+ name: string;
212
+ message: string;
213
+ stack: string;
214
+ ruleId?: string;
215
+ method?: string;
216
+ cause?: SerialError;
217
+ errorNode?: SerialDqElement;
218
+ }
219
+ interface SerialError {
220
+ message: string;
221
+ stack: string;
222
+ name: string;
223
+ cause?: SerialError;
224
+ }
207
225
  interface CheckLocale {
208
226
  [key: string]: CheckMessages;
209
227
  }
@@ -342,6 +360,9 @@ declare namespace axe {
342
360
  interface DqElement extends SerialDqElement {
343
361
  element: Element;
344
362
  toJSON(): SerialDqElement;
363
+ }
364
+ interface DqElementConstructor {
365
+ new (elm: Element, options?: { absolutePaths?: boolean }): DqElement;
345
366
  mergeSpecs(
346
367
  childSpec: SerialDqElement,
347
368
  parentSpec: SerialDqElement
@@ -365,23 +386,27 @@ declare namespace axe {
365
386
  frameContext: FrameContextObject;
366
387
  }
367
388
 
368
- interface RawCheckResult extends Omit<CheckResult, 'relatedNodes'> {
389
+ interface RawCheckResult extends Omit<
390
+ CheckResult,
391
+ 'relatedNodes' | 'impact'
392
+ > {
369
393
  relatedNodes?: Array<SerialDqElement | DqElement>;
394
+ impact?: ImpactValue;
370
395
  }
371
396
 
372
- interface RawNodeResult<T extends 'passed' | 'failed' | 'incomplete'> {
397
+ interface RawNodeResult<T extends 'passed' | 'failed' | 'cantTell'> {
373
398
  node: SerialDqElement | DqElement;
374
399
  any: RawCheckResult[];
375
400
  all: RawCheckResult[];
376
401
  none: RawCheckResult[];
377
- impact: ImpactValue | null;
402
+ impact: ImpactValue | undefined;
378
403
  result: T;
379
404
  }
380
405
 
381
406
  interface RawResult extends Omit<Result, 'nodes'> {
382
407
  inapplicable: Array<never>;
383
408
  passes: RawNodeResult<'passed'>[];
384
- incomplete: RawNodeResult<'incomplete'>[];
409
+ incomplete: RawNodeResult<'cantTell'>[];
385
410
  violations: RawNodeResult<'failed'>[];
386
411
  pageLevel: boolean;
387
412
  result: 'failed' | 'passed' | 'incomplete' | 'inapplicable';
@@ -405,6 +430,42 @@ declare namespace axe {
405
430
  boundingClientRect: DOMRect;
406
431
  }
407
432
 
433
+ type GridCell = VirtualNode[];
434
+
435
+ interface Grid {
436
+ container: VirtualNode | null;
437
+ cells: unknown; // opaque implementation detail
438
+ boundaries?: DOMRect;
439
+ toGridIndex(num: number): number;
440
+ getCellFromPoint(point: { x: number; y: number }): GridCell;
441
+ loopGridPosition(
442
+ gridPosition: DOMRect,
443
+ callback: (gridCell: GridCell, pos: { row: number; col: number }) => void
444
+ ): void;
445
+ getGridPositionOfRect(
446
+ rect: { top: number; right: number; bottom: number; left: number },
447
+ margin?: number
448
+ ): DOMRect;
449
+ }
450
+
451
+ interface CustomNodeSerializer<T = SerialDqElement> {
452
+ toSpec: (dqElm: DqElement) => T;
453
+ mergeSpecs: (nodeSpec: T, parentFrameSpec: T) => T;
454
+ }
455
+
456
+ interface NodeSerializer {
457
+ update: <T>(serializer: CustomNodeSerializer<T>) => void;
458
+ toSpec: (node: Element | VirtualNode) => SerialDqElement;
459
+ dqElmToSpec: (
460
+ dqElm: DqElement | SerialDqElement,
461
+ options?: RunOptions
462
+ ) => SerialDqElement;
463
+ mergeSpecs: (
464
+ nodeSpec: SerialDqElement,
465
+ parentFrameSpec: SerialDqElement
466
+ ) => SerialDqElement;
467
+ }
468
+
408
469
  interface Utils {
409
470
  getFrameContexts: (
410
471
  context?: ElementContext,
@@ -422,16 +483,20 @@ declare namespace axe {
422
483
  isLabelledShadowDomSelector: (
423
484
  selector: unknown
424
485
  ) => selector is LabelledShadowDomSelector;
425
-
426
- DqElement: new (
427
- elm: Element,
428
- options?: { absolutePaths?: boolean }
429
- ) => DqElement;
486
+ RuleError: new (options: {
487
+ error: Error;
488
+ ruleId?: string;
489
+ method?: string;
490
+ errorNode?: SerialDqElement;
491
+ }) => RuleError;
492
+ serializeError: (error: Error) => SerialError;
493
+ DqElement: DqElementConstructor;
430
494
  uuid: (
431
495
  options?: { random?: Uint8Array | Array<number> },
432
496
  buf?: Uint8Array | Array<number>,
433
497
  offset?: number
434
498
  ) => string | Uint8Array | Array<number>;
499
+ nodeSerializer: NodeSerializer;
435
500
  }
436
501
 
437
502
  interface Aria {
@@ -441,6 +506,7 @@ declare namespace axe {
441
506
  interface Dom {
442
507
  isFocusable: (node: Element | VirtualNode) => boolean;
443
508
  isNativelyFocusable: (node: Element | VirtualNode) => boolean;
509
+ getNodeGrid: (node: Node | VirtualNode) => Grid;
444
510
  }
445
511
 
446
512
  type AccessibleTextOptions = {