abledom 0.3.0 → 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.
- package/dist/esm/index.js +201 -171
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +27 -18
- package/dist/index.d.ts +27 -18
- package/dist/index.js +201 -171
- package/dist/index.js.map +1 -1
- package/dist/ts3.9/index.d.ts +27 -18
- package/package.json +17 -13
package/dist/ts3.9/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare enum ValidationRuleType {
|
|
|
7
7
|
Warning = 2,
|
|
8
8
|
Info = 3
|
|
9
9
|
}
|
|
10
|
-
interface
|
|
10
|
+
interface ValidationIssue {
|
|
11
11
|
id: string;
|
|
12
12
|
message: string;
|
|
13
13
|
element?: HTMLElement;
|
|
@@ -17,19 +17,19 @@ interface ValidationNotification {
|
|
|
17
17
|
relStack?: string[];
|
|
18
18
|
}
|
|
19
19
|
interface ValidationResult {
|
|
20
|
-
|
|
20
|
+
issue?: ValidationIssue;
|
|
21
21
|
dependsOnIds?: Set<string>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface BlurIssue extends ValidationIssue {
|
|
24
24
|
position?: string[];
|
|
25
25
|
}
|
|
26
|
-
declare abstract class ValidationRule<N extends
|
|
26
|
+
declare abstract class ValidationRule<N extends ValidationIssue = ValidationIssue> {
|
|
27
27
|
abstract type: ValidationRuleType;
|
|
28
28
|
abstract name: string;
|
|
29
29
|
private _window?;
|
|
30
30
|
private _exceptions;
|
|
31
|
-
private
|
|
32
|
-
static init(instance: ValidationRule, window: Window,
|
|
31
|
+
private _onIssue;
|
|
32
|
+
static init(instance: ValidationRule, window: Window, onIssue: (rule: ValidationRule, issue: ValidationIssue) => void): void;
|
|
33
33
|
static dispose(instance: ValidationRule): void;
|
|
34
34
|
static checkExceptions(instance: ValidationRule, element: HTMLElement): boolean;
|
|
35
35
|
private dispose;
|
|
@@ -49,9 +49,9 @@ declare abstract class ValidationRule<N extends ValidationNotification = Validat
|
|
|
49
49
|
stop?(): void;
|
|
50
50
|
accept?(element: HTMLElement): boolean;
|
|
51
51
|
validate?(element: HTMLElement): ValidationResult | null;
|
|
52
|
-
notify(
|
|
53
|
-
focused?(event: FocusEvent):
|
|
54
|
-
blurred?(event: FocusEvent):
|
|
52
|
+
notify(issue: N): void;
|
|
53
|
+
focused?(event: FocusEvent): ValidationIssue | null;
|
|
54
|
+
blurred?(event: FocusEvent): BlurIssue | null;
|
|
55
55
|
}
|
|
56
56
|
/*!
|
|
57
57
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -60,9 +60,15 @@ declare abstract class ValidationRule<N extends ValidationNotification = Validat
|
|
|
60
60
|
interface AbleDOMProps {
|
|
61
61
|
log?: typeof console.error;
|
|
62
62
|
bugReport?: {
|
|
63
|
-
isVisible: (
|
|
64
|
-
onClick: (
|
|
65
|
-
getTitle?: (
|
|
63
|
+
isVisible: (issue: ValidationIssue) => boolean;
|
|
64
|
+
onClick: (issue: ValidationIssue) => void;
|
|
65
|
+
getTitle?: (issue: ValidationIssue) => string;
|
|
66
|
+
};
|
|
67
|
+
headless?: boolean;
|
|
68
|
+
callbacks?: {
|
|
69
|
+
onIssueAdded?(element: HTMLElement | null, rule: ValidationRule, issue: ValidationIssue): void;
|
|
70
|
+
onIssueUpdated?(element: HTMLElement | null, rule: ValidationRule, issue: ValidationIssue): void;
|
|
71
|
+
onIssueRemoved?(element: HTMLElement | null, rule: ValidationRule): void;
|
|
66
72
|
};
|
|
67
73
|
}
|
|
68
74
|
declare class AbleDOM {
|
|
@@ -70,7 +76,7 @@ declare class AbleDOM {
|
|
|
70
76
|
private _props;
|
|
71
77
|
private _observer;
|
|
72
78
|
private _clearValidationTimeout;
|
|
73
|
-
private
|
|
79
|
+
private _elementsWithIssues;
|
|
74
80
|
private _changedElementIds;
|
|
75
81
|
private _elementsDependingOnId;
|
|
76
82
|
private _dependantIdsByElement;
|
|
@@ -78,17 +84,20 @@ declare class AbleDOM {
|
|
|
78
84
|
private _rules;
|
|
79
85
|
private _startFunc;
|
|
80
86
|
private _isStarted;
|
|
81
|
-
private
|
|
87
|
+
private _issuesUI;
|
|
88
|
+
private _idlePromise;
|
|
89
|
+
private _idleResolve;
|
|
82
90
|
constructor(win: Window, props?: AbleDOMProps);
|
|
83
91
|
private _onElementId;
|
|
84
|
-
private
|
|
85
|
-
private
|
|
92
|
+
private _addIssue;
|
|
93
|
+
private _removeIssue;
|
|
86
94
|
private _validate;
|
|
87
95
|
private _processElementDependingOnIds;
|
|
88
96
|
private _remove;
|
|
89
97
|
private _onFocusIn;
|
|
90
98
|
private _onFocusOut;
|
|
91
99
|
private _notifyAsync;
|
|
100
|
+
idle(): Promise<void>;
|
|
92
101
|
log: typeof console.error;
|
|
93
102
|
addRule(rule: ValidationRule): void;
|
|
94
103
|
removeRule(rule: ValidationRule): void;
|
|
@@ -130,7 +139,7 @@ declare class ExistingIdRule extends ValidationRule {
|
|
|
130
139
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
131
140
|
* Licensed under the MIT License.
|
|
132
141
|
*/
|
|
133
|
-
declare class FocusLostRule extends ValidationRule<
|
|
142
|
+
declare class FocusLostRule extends ValidationRule<BlurIssue> {
|
|
134
143
|
type: ValidationRuleType;
|
|
135
144
|
name: string;
|
|
136
145
|
anchored: boolean;
|
|
@@ -194,4 +203,4 @@ declare function hasAccessibilityAttribute(attributes: HTMLElementAttributes): b
|
|
|
194
203
|
declare function matchesSelector(element: HTMLElement, selector: string): boolean;
|
|
195
204
|
declare function isDisplayNone(element: HTMLElement): boolean;
|
|
196
205
|
declare function isElementVisible(element: HTMLElement): boolean;
|
|
197
|
-
export { AbleDOM, AbleDOMProps, AtomicRule, BadFocusRule,
|
|
206
|
+
export { AbleDOM, AbleDOMProps, AtomicRule, BadFocusRule, BlurIssue, CustomNotifyRule, ExistingIdRule, FindElementRule, FocusLostRule, FocusableElementLabelRule, ValidationIssue, ValidationResult, ValidationRule, ValidationRuleType, hasAccessibilityAttribute, isAccessibilityAffectingElement, isDisplayNone, isElementVisible, matchesSelector };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abledom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"author": "Marat Abdullin <marata@microsoft.com>",
|
|
5
5
|
"description": "Continuous detection of typical web application accessibility problems.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
"clean": "rimraf dist",
|
|
26
26
|
"format": "prettier --check .",
|
|
27
27
|
"format:fix": "prettier --write .",
|
|
28
|
-
"lint": "eslint src/
|
|
28
|
+
"lint": "eslint src/ tests/ devtools/",
|
|
29
29
|
"lint:fix": "npm run lint -- --fix",
|
|
30
30
|
"type-check": "tsc -b tsconfig.json",
|
|
31
31
|
"prepublishOnly": "npm run lint && npm run format && npm run build",
|
|
32
|
-
"release": "release-it"
|
|
32
|
+
"release": "release-it",
|
|
33
|
+
"test": "start-server-and-test dev http://localhost:5173 'playwright test'"
|
|
33
34
|
},
|
|
34
35
|
"repository": {
|
|
35
36
|
"type": "git",
|
|
@@ -40,20 +41,23 @@
|
|
|
40
41
|
},
|
|
41
42
|
"homepage": "https://github.com/microsoft/abledom#readme",
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@typescript-eslint/
|
|
44
|
+
"@playwright/test": "^1.55.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.40.0",
|
|
45
47
|
"@xmldom/xmldom": "^0.9.8",
|
|
46
48
|
"downlevel-dts": "^0.11.0",
|
|
47
49
|
"esbuild-plugin-inline-import": "^1.1.0",
|
|
48
|
-
"eslint": "^9.
|
|
49
|
-
"eslint-config-prettier": "^10.1.
|
|
50
|
+
"eslint": "^9.34.0",
|
|
51
|
+
"eslint-config-prettier": "^10.1.8",
|
|
50
52
|
"eslint-plugin-header": "^3.1.1",
|
|
51
|
-
"eslint-plugin-import": "^2.
|
|
52
|
-
"
|
|
53
|
-
"
|
|
53
|
+
"eslint-plugin-import": "^2.32.0",
|
|
54
|
+
"playwright": "^1.55.0",
|
|
55
|
+
"prettier": "^3.6.2",
|
|
56
|
+
"release-it": "^19.0.4",
|
|
54
57
|
"rimraf": "^6.0.1",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
+
"start-server-and-test": "^2.0.13",
|
|
59
|
+
"tsup": "^8.5.0",
|
|
60
|
+
"typescript": "^5.9.2",
|
|
61
|
+
"vite": "^7.1.3"
|
|
58
62
|
}
|
|
59
63
|
}
|