@markuplint/ml-spec 3.4.0 → 3.5.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/lib/dom-traverse/accname-computation.js +3 -1
- package/lib/dom-traverse/get-attr-specs.d.ts +1 -1
- package/lib/dom-traverse/get-attr-specs.js +3 -1
- package/lib/dom-traverse/get-computed-aria-props.d.ts +6 -6
- package/lib/dom-traverse/get-computed-aria-props.js +3 -1
- package/lib/dom-traverse/get-computed-role.d.ts +1 -1
- package/lib/dom-traverse/get-computed-role.js +10 -4
- package/lib/dom-traverse/get-content-model.d.ts +3 -5
- package/lib/dom-traverse/get-content-model.js +3 -1
- package/lib/dom-traverse/get-explicit-role.js +6 -2
- package/lib/dom-traverse/get-implicit-role.d.ts +2 -6
- package/lib/dom-traverse/get-implicit-role.js +6 -2
- package/lib/dom-traverse/get-non-presentational-ancestor.d.ts +4 -10
- package/lib/dom-traverse/get-non-presentational-ancestor.js +3 -1
- package/lib/dom-traverse/get-permitted-roles.d.ts +3 -7
- package/lib/dom-traverse/get-permitted-roles.js +3 -1
- package/lib/dom-traverse/get-spec.d.ts +1 -4
- package/lib/dom-traverse/get-spec.js +3 -1
- package/lib/dom-traverse/has-required-owned-elements.d.ts +2 -7
- package/lib/dom-traverse/has-required-owned-elements.js +14 -8
- package/lib/dom-traverse/is-exposed.d.ts +1 -1
- package/lib/dom-traverse/is-exposed.js +18 -6
- package/lib/dom-traverse/may-be-focusable.d.ts +1 -1
- package/lib/dom-traverse/may-be-focusable.js +3 -1
- package/lib/specs/aria-specs.d.ts +4 -7
- package/lib/specs/content-model-category-to-tag-names.d.ts +1 -4
- package/lib/specs/get-aria.d.ts +2 -7
- package/lib/specs/get-aria.js +4 -1
- package/lib/specs/get-attr-specs.d.ts +2 -6
- package/lib/specs/get-implicit-role.d.ts +1 -7
- package/lib/specs/get-permitted-roles.d.ts +3 -9
- package/lib/specs/get-permitted-roles.js +15 -11
- package/lib/specs/get-role-spec.d.ts +3 -10
- package/lib/specs/get-selectors-by-content-model-category.d.ts +1 -4
- package/lib/specs/get-spec-by-tag-name.d.ts +1 -5
- package/lib/specs/is-nothing-content-model.js +3 -1
- package/lib/specs/is-palpable-elements.d.ts +4 -8
- package/lib/specs/is-palpable-elements.js +3 -1
- package/lib/specs/is-void-element.js +3 -1
- package/lib/specs/resolve-version.d.ts +2 -1
- package/lib/specs/schema-to-spec.d.ts +3 -3
- package/lib/specs/schema-to-spec.js +20 -14
- package/lib/types/aria.d.ts +115 -128
- package/lib/types/attributes.d.ts +110 -1490
- package/lib/types/index.d.ts +147 -176
- package/lib/types/permitted-structures.d.ts +35 -74
- package/lib/utils/merge-array.d.ts +4 -6
- package/lib/utils/resolve-namespace.d.ts +4 -4
- package/package.json +8 -6
|
@@ -31,7 +31,9 @@ const exposableElementsThatAreNoBelongingAModel = [
|
|
|
31
31
|
'thead',
|
|
32
32
|
'tr',
|
|
33
33
|
];
|
|
34
|
-
function isPalpableElement(
|
|
34
|
+
function isPalpableElement(
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
36
|
+
el, specs, options) {
|
|
35
37
|
var _a, _b;
|
|
36
38
|
const conditions = [((_a = specs.def['#contentModels']['#palpable']) === null || _a === void 0 ? void 0 : _a.join(',')) || ''];
|
|
37
39
|
if ((options === null || options === void 0 ? void 0 : options.extendsSvg) !== false /* default true */) {
|
|
@@ -19,7 +19,9 @@ const voidElements = [
|
|
|
19
19
|
'track',
|
|
20
20
|
'wbr',
|
|
21
21
|
];
|
|
22
|
-
function isVoidElement(
|
|
22
|
+
function isVoidElement(
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
24
|
+
el) {
|
|
23
25
|
return voidElements.includes(el.localName);
|
|
24
26
|
}
|
|
25
27
|
exports.isVoidElement = isVoidElement;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ARIAVersion } from '../types';
|
|
2
2
|
import type { ARIA } from '../types/aria';
|
|
3
|
-
|
|
3
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
4
|
+
export declare function resolveVersion(aria: ReadonlyDeep<ARIA>, version: ARIAVersion): Omit<ReadonlyDeep<ARIA>, ARIAVersion>;
|
|
@@ -7,7 +7,7 @@ import type { ElementSpec, ExtendedSpec, MLMLSpec } from '../types';
|
|
|
7
7
|
* @param schemas `MLDocument.schemas`
|
|
8
8
|
*/
|
|
9
9
|
export declare function schemaToSpec(schemas: readonly [MLMLSpec, ...ExtendedSpec[]]): {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
cites: import("../types").Cites;
|
|
11
|
+
def: import("../types").SpecDefs;
|
|
12
|
+
specs: readonly ElementSpec[];
|
|
13
13
|
};
|
|
@@ -10,7 +10,7 @@ const merge_array_1 = require("../utils/merge-array");
|
|
|
10
10
|
* @param schemas `MLDocument.schemas`
|
|
11
11
|
*/
|
|
12
12
|
function schemaToSpec(schemas) {
|
|
13
|
-
var _a, _b, _c;
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
14
|
const [main, ...extendedSpecs] = schemas;
|
|
15
15
|
const result = { ...main };
|
|
16
16
|
for (const extendedSpec of extendedSpecs) {
|
|
@@ -18,37 +18,43 @@ function schemaToSpec(schemas) {
|
|
|
18
18
|
result.cites = [...result.cites, ...extendedSpec.cites];
|
|
19
19
|
}
|
|
20
20
|
if (extendedSpec.def) {
|
|
21
|
+
const def = { ...result.def };
|
|
21
22
|
if ((_a = extendedSpec.def['#globalAttrs']) === null || _a === void 0 ? void 0 : _a['#extends']) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...((
|
|
23
|
+
const gAttrs = { ...def['#globalAttrs'] };
|
|
24
|
+
gAttrs['#HTMLGlobalAttrs'] = {
|
|
25
|
+
...((_c = (_b = def['#globalAttrs']) === null || _b === void 0 ? void 0 : _b['#HTMLGlobalAttrs']) !== null && _c !== void 0 ? _c : {}),
|
|
26
|
+
...((_e = (_d = extendedSpec.def['#globalAttrs']) === null || _d === void 0 ? void 0 : _d['#extends']) !== null && _e !== void 0 ? _e : {}),
|
|
25
27
|
};
|
|
28
|
+
def['#globalAttrs'] = gAttrs;
|
|
26
29
|
}
|
|
27
30
|
if (extendedSpec.def['#aria']) {
|
|
28
|
-
|
|
31
|
+
def['#aria'] = {
|
|
29
32
|
'1.1': {
|
|
30
|
-
roles: (0, merge_array_1.mergeArray)(
|
|
31
|
-
props: (0, merge_array_1.mergeArray)(
|
|
32
|
-
graphicsRoles: (0, merge_array_1.mergeArray)(
|
|
33
|
+
roles: (0, merge_array_1.mergeArray)(def['#aria']['1.1'].roles, extendedSpec.def['#aria']['1.1'].roles),
|
|
34
|
+
props: (0, merge_array_1.mergeArray)(def['#aria']['1.1'].props, extendedSpec.def['#aria']['1.1'].props),
|
|
35
|
+
graphicsRoles: (0, merge_array_1.mergeArray)(def['#aria']['1.1'].graphicsRoles, extendedSpec.def['#aria']['1.1'].graphicsRoles),
|
|
33
36
|
},
|
|
34
37
|
'1.2': {
|
|
35
|
-
roles: (0, merge_array_1.mergeArray)(
|
|
36
|
-
props: (0, merge_array_1.mergeArray)(
|
|
37
|
-
graphicsRoles: (0, merge_array_1.mergeArray)(
|
|
38
|
+
roles: (0, merge_array_1.mergeArray)(def['#aria']['1.2'].roles, extendedSpec.def['#aria']['1.2'].roles),
|
|
39
|
+
props: (0, merge_array_1.mergeArray)(def['#aria']['1.2'].props, extendedSpec.def['#aria']['1.2'].props),
|
|
40
|
+
graphicsRoles: (0, merge_array_1.mergeArray)(def['#aria']['1.2'].graphicsRoles, extendedSpec.def['#aria']['1.2'].graphicsRoles),
|
|
38
41
|
},
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
if (extendedSpec.def['#contentModels']) {
|
|
45
|
+
const models = { ...def['#contentModels'] };
|
|
42
46
|
const keys = new Set([
|
|
43
|
-
...Object.keys(
|
|
47
|
+
...Object.keys(def['#contentModels']),
|
|
44
48
|
...Object.keys(extendedSpec.def['#contentModels']),
|
|
45
49
|
]);
|
|
46
50
|
for (const modelName of keys) {
|
|
47
|
-
const mainModel =
|
|
51
|
+
const mainModel = def['#contentModels'][modelName];
|
|
48
52
|
const exModel = extendedSpec.def['#contentModels'][modelName];
|
|
49
|
-
|
|
53
|
+
models[modelName] = [...(mainModel !== null && mainModel !== void 0 ? mainModel : []), ...(exModel !== null && exModel !== void 0 ? exModel : [])];
|
|
50
54
|
}
|
|
55
|
+
def['#contentModels'] = models;
|
|
51
56
|
}
|
|
57
|
+
result.def = def;
|
|
52
58
|
}
|
|
53
59
|
if (extendedSpec.specs) {
|
|
54
60
|
const exSpecs = extendedSpec.specs.slice();
|
package/lib/types/aria.d.ts
CHANGED
|
@@ -10,141 +10,128 @@ export type ImplicitRole = false | string;
|
|
|
10
10
|
/**
|
|
11
11
|
* If `true`, this mean is "Any". If `false`, this mean is "No".
|
|
12
12
|
*/
|
|
13
|
-
export type PermittedRoles =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
name: string;
|
|
19
|
-
deprecated?: true;
|
|
20
|
-
[k: string]: unknown;
|
|
21
|
-
}
|
|
22
|
-
)[]
|
|
23
|
-
| {
|
|
24
|
-
'core-aam'?: true;
|
|
25
|
-
'graphics-aam'?: true;
|
|
26
|
-
};
|
|
13
|
+
export type PermittedRoles = boolean | (string | {
|
|
14
|
+
name: string;
|
|
15
|
+
deprecated?: true;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
})[] | PermittedARIAAAMInfo;
|
|
27
18
|
/**
|
|
28
19
|
* If set false:
|
|
29
20
|
* > No role or aria-* attributes
|
|
30
21
|
*/
|
|
31
|
-
export type PermittedARIAProperties =
|
|
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
|
-
value?: string;
|
|
75
|
-
alt?: {
|
|
76
|
-
method: 'remove-attr' | 'set-attr';
|
|
77
|
-
target: string;
|
|
78
|
-
};
|
|
79
|
-
}[],
|
|
80
|
-
];
|
|
81
|
-
};
|
|
22
|
+
export type PermittedARIAProperties = false | {
|
|
23
|
+
global?: true;
|
|
24
|
+
/**
|
|
25
|
+
* Set true if the spec says "and any aria-* attributes applicable to the allowed roles."
|
|
26
|
+
*/
|
|
27
|
+
role?: true | string | [string, ...string[]];
|
|
28
|
+
/**
|
|
29
|
+
* @minItems 1
|
|
30
|
+
*/
|
|
31
|
+
only?: [
|
|
32
|
+
(string | {
|
|
33
|
+
name: string;
|
|
34
|
+
value?: string;
|
|
35
|
+
}),
|
|
36
|
+
...(string | {
|
|
37
|
+
name: string;
|
|
38
|
+
value?: string;
|
|
39
|
+
})[]
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* @minItems 1
|
|
43
|
+
*/
|
|
44
|
+
without?: [
|
|
45
|
+
{
|
|
46
|
+
type: 'not-recommended' | 'should-not' | 'must-not';
|
|
47
|
+
name: string;
|
|
48
|
+
value?: string;
|
|
49
|
+
alt?: {
|
|
50
|
+
method: 'remove-attr' | 'set-attr';
|
|
51
|
+
target: string;
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
...{
|
|
55
|
+
type: 'not-recommended' | 'should-not' | 'must-not';
|
|
56
|
+
name: string;
|
|
57
|
+
value?: string;
|
|
58
|
+
alt?: {
|
|
59
|
+
method: 'remove-attr' | 'set-attr';
|
|
60
|
+
target: string;
|
|
61
|
+
};
|
|
62
|
+
}[]
|
|
63
|
+
];
|
|
64
|
+
};
|
|
82
65
|
export interface AriaSchema {
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
_?: ARIA;
|
|
67
|
+
[k: string]: unknown;
|
|
85
68
|
}
|
|
86
69
|
export interface ARIA {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
70
|
+
implicitRole: ImplicitRole;
|
|
71
|
+
permittedRoles: PermittedRoles;
|
|
72
|
+
namingProhibited?: true;
|
|
73
|
+
implicitProperties?: ImplicitProperties;
|
|
74
|
+
properties?: PermittedARIAProperties;
|
|
75
|
+
conditions?: {
|
|
76
|
+
/**
|
|
77
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
78
|
+
* via the `patternProperty` ".+".
|
|
79
|
+
*/
|
|
80
|
+
[k: string]: {
|
|
81
|
+
implicitRole?: ImplicitRole;
|
|
82
|
+
permittedRoles?: PermittedRoles;
|
|
83
|
+
namingProhibited?: true;
|
|
84
|
+
implicitProperties?: ImplicitProperties;
|
|
85
|
+
properties?: PermittedARIAProperties;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
'1.2'?: {
|
|
89
|
+
implicitRole?: ImplicitRole;
|
|
90
|
+
permittedRoles?: PermittedRoles;
|
|
91
|
+
namingProhibited?: true;
|
|
92
|
+
implicitProperties?: ImplicitProperties;
|
|
93
|
+
properties?: PermittedARIAProperties;
|
|
94
|
+
conditions?: {
|
|
95
|
+
/**
|
|
96
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
97
|
+
* via the `patternProperty` ".+".
|
|
98
|
+
*/
|
|
99
|
+
[k: string]: {
|
|
100
|
+
implicitRole?: ImplicitRole;
|
|
101
|
+
permittedRoles?: PermittedRoles;
|
|
102
|
+
namingProhibited?: true;
|
|
103
|
+
implicitProperties?: ImplicitProperties;
|
|
104
|
+
properties?: PermittedARIAProperties;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
'1.1'?: {
|
|
109
|
+
implicitRole?: ImplicitRole;
|
|
110
|
+
permittedRoles?: PermittedRoles;
|
|
111
|
+
implicitProperties?: ImplicitProperties;
|
|
112
|
+
properties?: PermittedARIAProperties;
|
|
113
|
+
conditions?: {
|
|
114
|
+
/**
|
|
115
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
116
|
+
* via the `patternProperty` ".+".
|
|
117
|
+
*/
|
|
118
|
+
[k: string]: {
|
|
119
|
+
implicitRole?: ImplicitRole;
|
|
120
|
+
permittedRoles?: PermittedRoles;
|
|
121
|
+
implicitProperties?: ImplicitProperties;
|
|
122
|
+
properties?: PermittedARIAProperties;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface PermittedARIAAAMInfo {
|
|
128
|
+
'core-aam'?: true;
|
|
129
|
+
'graphics-aam'?: true;
|
|
143
130
|
}
|
|
144
131
|
export interface ImplicitProperties {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
132
|
+
/**
|
|
133
|
+
* This interface was referenced by `ImplicitProperties`'s JSON-Schema definition
|
|
134
|
+
* via the `patternProperty` "^aria-.+".
|
|
135
|
+
*/
|
|
136
|
+
[k: string]: string;
|
|
150
137
|
}
|