@a11y-hud/angular 0.1.2 → 0.4.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.
@@ -12,11 +12,12 @@ class A11yHudService {
12
12
  instance = null;
13
13
  el = null;
14
14
  init(options = {}) {
15
- const { theme, autoScan, debounce } = options;
15
+ const { theme, autoScan, debounce, runOnly } = options;
16
16
  this.instance = mount({
17
17
  ...(theme !== undefined && { theme }),
18
18
  ...(autoScan !== undefined && { autoScan }),
19
19
  ...(debounce !== undefined && { debounce }),
20
+ ...(runOnly !== undefined && { runOnly }),
20
21
  });
21
22
  this.el = document.querySelector("a11y-hud");
22
23
  if (this.el) {
@@ -56,6 +57,35 @@ class A11yHudService {
56
57
  setTheme(theme) {
57
58
  this.instance?.setTheme(theme);
58
59
  }
60
+ setRunOnly(tags) {
61
+ this.instance?.setRunOnly(tags);
62
+ }
63
+ exportResults() {
64
+ return this.instance?.exportResults() ?? null;
65
+ }
66
+ get ignores() {
67
+ const inst = this.instance;
68
+ return {
69
+ add(ruleId, selector) {
70
+ inst?.ignores.add(ruleId, selector);
71
+ },
72
+ remove(ruleId, selector) {
73
+ inst?.ignores.remove(ruleId, selector);
74
+ },
75
+ clear() {
76
+ inst?.ignores.clear();
77
+ },
78
+ list() {
79
+ return inst?.ignores.list() ?? [];
80
+ },
81
+ exportJson() {
82
+ return inst?.ignores.exportJson() ?? "[]";
83
+ },
84
+ importJson(json) {
85
+ inst?.ignores.importJson(json);
86
+ },
87
+ };
88
+ }
59
89
  get initialized() {
60
90
  return this.instance !== null;
61
91
  }
@@ -76,6 +106,7 @@ class A11yHudComponent {
76
106
  scope = null;
77
107
  autoScan;
78
108
  debounce;
109
+ runOnly;
79
110
  service = inject(A11yHudService);
80
111
  constructor() {
81
112
  // Render-settled rescan: mirrors React's useEffect(fn) (no deps). Fires after
@@ -94,6 +125,7 @@ class A11yHudComponent {
94
125
  scope: this.scope,
95
126
  ...(this.autoScan !== undefined && { autoScan: this.autoScan }),
96
127
  ...(this.debounce !== undefined && { debounce: this.debounce }),
128
+ ...(this.runOnly !== undefined && { runOnly: this.runOnly }),
97
129
  });
98
130
  void this.service.runScan();
99
131
  }
@@ -113,6 +145,9 @@ class A11yHudComponent {
113
145
  if ("debounce" in changes) {
114
146
  this.service.syncDebounce(this.debounce);
115
147
  }
148
+ if ("runOnly" in changes) {
149
+ this.service.setRunOnly(this.runOnly ?? []);
150
+ }
116
151
  }
117
152
  runScan() {
118
153
  return this.service.runScan();
@@ -120,8 +155,17 @@ class A11yHudComponent {
120
155
  setTheme(theme) {
121
156
  this.service.setTheme(theme);
122
157
  }
158
+ setRunOnly(tags) {
159
+ this.service.setRunOnly(tags);
160
+ }
161
+ exportResults() {
162
+ return this.service.exportResults();
163
+ }
164
+ get ignores() {
165
+ return this.service.ignores;
166
+ }
123
167
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: A11yHudComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
124
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: A11yHudComponent, isStandalone: true, selector: "a11y-hud-angular", inputs: { theme: "theme", scope: "scope", autoScan: "autoScan", debounce: "debounce" }, providers: [A11yHudService], usesOnChanges: true, ngImport: i0, template: "", isInline: true });
168
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: A11yHudComponent, isStandalone: true, selector: "a11y-hud-angular", inputs: { theme: "theme", scope: "scope", autoScan: "autoScan", debounce: "debounce", runOnly: "runOnly" }, providers: [A11yHudService], usesOnChanges: true, ngImport: i0, template: "", isInline: true });
125
169
  }
126
170
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: A11yHudComponent, decorators: [{
127
171
  type: Component,
@@ -139,6 +183,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
139
183
  type: Input
140
184
  }], debounce: [{
141
185
  type: Input
186
+ }], runOnly: [{
187
+ type: Input
142
188
  }] } });
143
189
 
144
190
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"a11y-hud-angular.mjs","sources":["../../src/service.ts","../../src/component.ts","../../src/a11y-hud-angular.ts"],"sourcesContent":["import { type ElementRef, Injectable, inject, NgZone, type OnDestroy } from \"@angular/core\";\nimport type { A11yHudElement, A11yHudInstance, AxeResults, Theme } from \"a11y-hud\";\nimport { mount } from \"a11y-hud\";\nimport type { ScopeInput, UseA11yHudOptions } from \"./types.js\";\n\nfunction resolveScope(scope: ScopeInput): Element | undefined {\n if (scope == null) return undefined;\n return scope instanceof Element ? scope : (scope as ElementRef<Element>).nativeElement;\n}\n\n@Injectable()\nexport class A11yHudService implements OnDestroy {\n private readonly ngZone = inject(NgZone);\n private instance: A11yHudInstance | null = null;\n private el: A11yHudElement | null = null;\n\n init(options: UseA11yHudOptions = {}): void {\n const { theme, autoScan, debounce } = options;\n this.instance = mount({\n ...(theme !== undefined && { theme }),\n ...(autoScan !== undefined && { autoScan }),\n ...(debounce !== undefined && { debounce }),\n });\n this.el = document.querySelector<A11yHudElement>(\"a11y-hud\");\n if (this.el) {\n this.el.scopeElement = resolveScope(options.scope);\n }\n }\n\n syncScope(scope: ScopeInput): void {\n const el = this.el;\n if (!el) return;\n el.scopeElement = resolveScope(scope);\n }\n\n syncTheme(theme: Theme | undefined): void {\n if (theme !== undefined) this.instance?.setTheme(theme);\n }\n\n syncAutoScan(autoScan: boolean | undefined): void {\n const el = this.el;\n if (!el || autoScan === undefined) return;\n if (autoScan === false) {\n el.removeAttribute(\"auto-scan\");\n } else {\n el.setAttribute(\"auto-scan\", \"\");\n }\n }\n\n syncDebounce(debounce: number | undefined): void {\n const el = this.el;\n if (!el || debounce === undefined) return;\n el.setAttribute(\"debounce\", String(debounce));\n }\n\n runScan(): Promise<AxeResults> {\n return this.ngZone.runOutsideAngular(\n () => this.instance?.runScan() ?? Promise.resolve(null as unknown as AxeResults)\n );\n }\n\n setTheme(theme: Theme): void {\n this.instance?.setTheme(theme);\n }\n\n get initialized(): boolean {\n return this.instance !== null;\n }\n\n ngOnDestroy(): void {\n this.instance?.unmount();\n this.instance = null;\n this.el = null;\n }\n}\n","import {\n type AfterViewInit,\n afterEveryRender,\n Component,\n Input,\n inject,\n type OnChanges,\n type SimpleChanges,\n} from \"@angular/core\";\nimport type { AxeResults, Theme } from \"a11y-hud\";\nimport { A11yHudService } from \"./service.js\";\nimport type { ScopeInput } from \"./types.js\";\n\n@Component({\n standalone: true,\n selector: \"a11y-hud-angular\",\n template: \"\",\n providers: [A11yHudService],\n})\nexport class A11yHudComponent implements AfterViewInit, OnChanges {\n @Input() theme?: Theme;\n @Input() scope: ScopeInput = null;\n @Input() autoScan?: boolean;\n @Input() debounce?: number;\n\n private readonly service = inject(A11yHudService);\n\n constructor() {\n // Render-settled rescan: mirrors React's useEffect(fn) (no deps). Fires after\n // every Angular render commit — catches route changes and any re-render that\n // does not alter @Input() values, which ngOnChanges would otherwise miss.\n afterEveryRender(() => {\n if (!this.service.initialized) return;\n this.service.syncScope(this.scope);\n void this.service.runScan();\n });\n }\n\n ngAfterViewInit(): void {\n this.service.init({\n ...(this.theme !== undefined && { theme: this.theme }),\n scope: this.scope,\n ...(this.autoScan !== undefined && { autoScan: this.autoScan }),\n ...(this.debounce !== undefined && { debounce: this.debounce }),\n });\n void this.service.runScan();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.service.initialized) return;\n\n if (\"scope\" in changes) {\n this.service.syncScope(this.scope);\n void this.service.runScan();\n }\n if (\"theme\" in changes) {\n this.service.syncTheme(this.theme);\n }\n if (\"autoScan\" in changes) {\n this.service.syncAutoScan(this.autoScan);\n }\n if (\"debounce\" in changes) {\n this.service.syncDebounce(this.debounce);\n }\n }\n\n runScan(): Promise<AxeResults> {\n return this.service.runScan();\n }\n\n setTheme(theme: Theme): void {\n this.service.setTheme(theme);\n }\n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;;sBACA;;;ACvBH;;AAEG;;;;"}
1
+ {"version":3,"file":"a11y-hud-angular.mjs","sources":["../../src/service.ts","../../src/component.ts","../../src/a11y-hud-angular.ts"],"sourcesContent":["import { type ElementRef, Injectable, inject, NgZone, type OnDestroy } from \"@angular/core\";\nimport type { A11yHudElement, A11yHudInstance, AxeResults, Theme } from \"a11y-hud\";\nimport { mount } from \"a11y-hud\";\nimport type { ScopeInput, UseA11yHudOptions } from \"./types.js\";\n\nfunction resolveScope(scope: ScopeInput): Element | undefined {\n if (scope == null) return undefined;\n return scope instanceof Element ? scope : (scope as ElementRef<Element>).nativeElement;\n}\n\n@Injectable()\nexport class A11yHudService implements OnDestroy {\n private readonly ngZone = inject(NgZone);\n private instance: A11yHudInstance | null = null;\n private el: A11yHudElement | null = null;\n\n init(options: UseA11yHudOptions = {}): void {\n const { theme, autoScan, debounce, runOnly } = options;\n this.instance = mount({\n ...(theme !== undefined && { theme }),\n ...(autoScan !== undefined && { autoScan }),\n ...(debounce !== undefined && { debounce }),\n ...(runOnly !== undefined && { runOnly }),\n });\n this.el = document.querySelector<A11yHudElement>(\"a11y-hud\");\n if (this.el) {\n this.el.scopeElement = resolveScope(options.scope);\n }\n }\n\n syncScope(scope: ScopeInput): void {\n const el = this.el;\n if (!el) return;\n el.scopeElement = resolveScope(scope);\n }\n\n syncTheme(theme: Theme | undefined): void {\n if (theme !== undefined) this.instance?.setTheme(theme);\n }\n\n syncAutoScan(autoScan: boolean | undefined): void {\n const el = this.el;\n if (!el || autoScan === undefined) return;\n if (autoScan === false) {\n el.removeAttribute(\"auto-scan\");\n } else {\n el.setAttribute(\"auto-scan\", \"\");\n }\n }\n\n syncDebounce(debounce: number | undefined): void {\n const el = this.el;\n if (!el || debounce === undefined) return;\n el.setAttribute(\"debounce\", String(debounce));\n }\n\n runScan(): Promise<AxeResults> {\n return this.ngZone.runOutsideAngular(\n () => this.instance?.runScan() ?? Promise.resolve(null as unknown as AxeResults)\n );\n }\n\n setTheme(theme: Theme): void {\n this.instance?.setTheme(theme);\n }\n\n setRunOnly(tags: string[]): void {\n this.instance?.setRunOnly(tags);\n }\n\n exportResults(): string | null {\n return this.instance?.exportResults() ?? null;\n }\n\n get ignores() {\n const inst = this.instance;\n return {\n add(ruleId: string, selector?: string): void {\n inst?.ignores.add(ruleId, selector);\n },\n remove(ruleId: string, selector?: string): void {\n inst?.ignores.remove(ruleId, selector);\n },\n clear(): void {\n inst?.ignores.clear();\n },\n list() {\n return inst?.ignores.list() ?? [];\n },\n exportJson(): string {\n return inst?.ignores.exportJson() ?? \"[]\";\n },\n importJson(json: string): void {\n inst?.ignores.importJson(json);\n },\n };\n }\n\n get initialized(): boolean {\n return this.instance !== null;\n }\n\n ngOnDestroy(): void {\n this.instance?.unmount();\n this.instance = null;\n this.el = null;\n }\n}\n","import {\n type AfterViewInit,\n afterEveryRender,\n Component,\n Input,\n inject,\n type OnChanges,\n type SimpleChanges,\n} from \"@angular/core\";\nimport type { AxeResults, Theme } from \"a11y-hud\";\nimport { A11yHudService } from \"./service.js\";\nimport type { ScopeInput } from \"./types.js\";\n\n@Component({\n standalone: true,\n selector: \"a11y-hud-angular\",\n template: \"\",\n providers: [A11yHudService],\n})\nexport class A11yHudComponent implements AfterViewInit, OnChanges {\n @Input() theme?: Theme;\n @Input() scope: ScopeInput = null;\n @Input() autoScan?: boolean;\n @Input() debounce?: number;\n @Input() runOnly?: string[];\n\n private readonly service = inject(A11yHudService);\n\n constructor() {\n // Render-settled rescan: mirrors React's useEffect(fn) (no deps). Fires after\n // every Angular render commit — catches route changes and any re-render that\n // does not alter @Input() values, which ngOnChanges would otherwise miss.\n afterEveryRender(() => {\n if (!this.service.initialized) return;\n this.service.syncScope(this.scope);\n void this.service.runScan();\n });\n }\n\n ngAfterViewInit(): void {\n this.service.init({\n ...(this.theme !== undefined && { theme: this.theme }),\n scope: this.scope,\n ...(this.autoScan !== undefined && { autoScan: this.autoScan }),\n ...(this.debounce !== undefined && { debounce: this.debounce }),\n ...(this.runOnly !== undefined && { runOnly: this.runOnly }),\n });\n void this.service.runScan();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.service.initialized) return;\n\n if (\"scope\" in changes) {\n this.service.syncScope(this.scope);\n void this.service.runScan();\n }\n if (\"theme\" in changes) {\n this.service.syncTheme(this.theme);\n }\n if (\"autoScan\" in changes) {\n this.service.syncAutoScan(this.autoScan);\n }\n if (\"debounce\" in changes) {\n this.service.syncDebounce(this.debounce);\n }\n if (\"runOnly\" in changes) {\n this.service.setRunOnly(this.runOnly ?? []);\n }\n }\n\n runScan(): Promise<AxeResults> {\n return this.service.runScan();\n }\n\n setTheme(theme: Theme): void {\n this.service.setTheme(theme);\n }\n\n setRunOnly(tags: string[]): void {\n this.service.setRunOnly(tags);\n }\n\n exportResults(): string | null {\n return this.service.exportResults();\n }\n\n get ignores() {\n return this.service.ignores;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAKA,SAAS,YAAY,CAAC,KAAiB,EAAA;IACrC,IAAI,KAAK,IAAI,IAAI;AAAE,QAAA,OAAO,SAAS;AACnC,IAAA,OAAO,KAAK,YAAY,OAAO,GAAG,KAAK,GAAI,KAA6B,CAAC,aAAa;AACxF;MAGa,cAAc,CAAA;AACR,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,QAAQ,GAA2B,IAAI;IACvC,EAAE,GAA0B,IAAI;IAExC,IAAI,CAAC,UAA6B,EAAE,EAAA;QAClC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO;AACtD,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACpB,IAAI,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;YACrC,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC3C,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE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ACT,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;IAC7B;wGAtEW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,KAAA,EAAA,OAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,UAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAFhB,CAAC,cAAc,CAAC,+CADjB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;4FAGD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,EAAE;oBACZ,SAAS,EAAE,CAAC,cAAc,CAAC;AAC5B,iBAAA;;sBAEE;;sBACA;;sBACA;;sBACA;;sBACA;;;ACxBH;;AAEG;;;;"}
@@ -1,6 +1,7 @@
1
+ import * as a11y_hud from 'a11y-hud';
2
+ import { Theme, AxeResults, IgnoreEntry } from 'a11y-hud';
1
3
  import * as i0 from '@angular/core';
2
4
  import { ElementRef, AfterViewInit, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
3
- import { Theme, AxeResults } from 'a11y-hud';
4
5
 
5
6
  type ScopeInput = ElementRef<Element> | Element | null | undefined;
6
7
  interface UseA11yHudOptions {
@@ -8,11 +9,22 @@ interface UseA11yHudOptions {
8
9
  scope?: ScopeInput;
9
10
  autoScan?: boolean;
10
11
  debounce?: number;
12
+ runOnly?: string[];
11
13
  }
12
14
  type A11yHudProps = UseA11yHudOptions;
13
15
  interface UseA11yHudReturn {
14
16
  runScan(): Promise<AxeResults>;
15
17
  setTheme(theme: Theme): void;
18
+ setRunOnly(tags: string[]): void;
19
+ exportResults(): string | null;
20
+ ignores: {
21
+ add(ruleId: string, selector?: string): void;
22
+ remove(ruleId: string, selector?: string): void;
23
+ clear(): void;
24
+ list(): IgnoreEntry[];
25
+ exportJson(): string;
26
+ importJson(json: string): void;
27
+ };
16
28
  }
17
29
 
18
30
  declare class A11yHudComponent implements AfterViewInit, OnChanges {
@@ -20,14 +32,25 @@ declare class A11yHudComponent implements AfterViewInit, OnChanges {
20
32
  scope: ScopeInput;
21
33
  autoScan?: boolean;
22
34
  debounce?: number;
35
+ runOnly?: string[];
23
36
  private readonly service;
24
37
  constructor();
25
38
  ngAfterViewInit(): void;
26
39
  ngOnChanges(changes: SimpleChanges): void;
27
40
  runScan(): Promise<AxeResults>;
28
41
  setTheme(theme: Theme): void;
42
+ setRunOnly(tags: string[]): void;
43
+ exportResults(): string | null;
44
+ get ignores(): {
45
+ add(ruleId: string, selector?: string): void;
46
+ remove(ruleId: string, selector?: string): void;
47
+ clear(): void;
48
+ list(): a11y_hud.IgnoreEntry[];
49
+ exportJson(): string;
50
+ importJson(json: string): void;
51
+ };
29
52
  static ɵfac: i0.ɵɵFactoryDeclaration<A11yHudComponent, never>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<A11yHudComponent, "a11y-hud-angular", never, { "theme": { "alias": "theme"; "required": false; }; "scope": { "alias": "scope"; "required": false; }; "autoScan": { "alias": "autoScan"; "required": false; }; "debounce": { "alias": "debounce"; "required": false; }; }, {}, never, never, true, never>;
53
+ static ɵcmp: i0.ɵɵComponentDeclaration<A11yHudComponent, "a11y-hud-angular", never, { "theme": { "alias": "theme"; "required": false; }; "scope": { "alias": "scope"; "required": false; }; "autoScan": { "alias": "autoScan"; "required": false; }; "debounce": { "alias": "debounce"; "required": false; }; "runOnly": { "alias": "runOnly"; "required": false; }; }, {}, never, never, true, never>;
31
54
  }
32
55
 
33
56
  declare class A11yHudService implements OnDestroy {
@@ -41,6 +64,16 @@ declare class A11yHudService implements OnDestroy {
41
64
  syncDebounce(debounce: number | undefined): void;
42
65
  runScan(): Promise<AxeResults>;
43
66
  setTheme(theme: Theme): void;
67
+ setRunOnly(tags: string[]): void;
68
+ exportResults(): string | null;
69
+ get ignores(): {
70
+ add(ruleId: string, selector?: string): void;
71
+ remove(ruleId: string, selector?: string): void;
72
+ clear(): void;
73
+ list(): a11y_hud.IgnoreEntry[];
74
+ exportJson(): string;
75
+ importJson(json: string): void;
76
+ };
44
77
  get initialized(): boolean;
45
78
  ngOnDestroy(): void;
46
79
  static ɵfac: i0.ɵɵFactoryDeclaration<A11yHudService, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a11y-hud/angular",
3
- "version": "0.1.2",
3
+ "version": "0.4.0",
4
4
  "description": "Angular adapter for a11y-hud — run axe-core accessibility audits in your Angular app with no DevTools required.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "tslib": "^2.3.0",
22
- "a11y-hud": "0.1.4"
22
+ "a11y-hud": "0.4.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@angular/core": ">=20.0.0 <23.0.0"
@@ -34,9 +34,9 @@
34
34
  "@vitest/coverage-v8": "^4.1.5",
35
35
  "jsdom": "^29.1.1",
36
36
  "ng-packagr": "^21.0.0",
37
- "typescript": "~5.9.0",
37
+ "typescript": "~6.0.3",
38
38
  "vitest": "^4.1.5",
39
- "zone.js": "^0.15.0"
39
+ "zone.js": "^0.16.1"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=22"