-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
75 lines (71 loc) · 1.82 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import type specs from "@markuplint/html-spec";
export type Specs = {
elements: typeof specs["specs"];
aria: typeof specs["def"]["#aria"];
mlVersion: string;
};
export type Elements = typeof specs["specs"];
export type RoleList = typeof specs.def["#aria"]["1.2"]["roles"];
export type AriaList = typeof specs.def["#aria"]["1.2"]["props"];
export type Aria = AriaList[0];
export type Data = [
version: string,
tableOfElement: readonly TableOfElementData[],
tableOfRoleWithProp: readonly TableOfRoleWithProp[]
];
export type TableOfElementData = readonly [
TableOfElementPropHeader,
TableOfElementRoleHeader,
readonly TableOfElementRow[]
];
export type TableOfElementPropHeader = readonly [
...props: [name: string, global: 1 | 0][]
];
export type TableOfElementRoleHeader = readonly [
...props: [name: string, isAbstract: 1 | 0][]
];
export type TableOfElementRow = [
el: [
name: string | [name: string, attrSelector: string[]],
deprecated: 0 | 1
],
implicitRole: string | 0,
props: readonly Prop[],
roles: readonly Role[]
];
export type Prop = [
type:
| 0 // No use aria-* attribute
| 1 // No use global aria-* attribute
| 2 // Deprecated
| 3 // Implicit prop
| 4 // Has no role
| 5 // "not-recommended"
| 6 // "should-not"
| 7 // "must-not"
| 8 // 100 // Allowed only
| 9 // 101 // Allowed global aria-* attribute
| 10 // 102 // From implicit role
| 11 // 103 // From the role
| 12 // 104 // Required from the role
// for debug
| `__${string}`,
alt: string | 0
];
export type Role = [type: 0 | 1];
export type TableOfRoleWithProp = [
// Props
props: [name: string][],
// Roles
roles: [
// name
name: string,
// isAbstract
isAbstract: 0 | 1,
// Owned Props
ownedProps: [
// Status
status: 0 | 1
][]
][]
];