@markuplint/ml-spec 3.0.0-alpha.82 → 3.0.0-dev.176
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 +8 -3
- package/lib/constant/aria-version.d.ts +2 -0
- package/lib/constant/aria-version.js +5 -0
- 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 +12 -0
- package/lib/dom-traverse/get-computed-aria-props.js +108 -0
- package/lib/dom-traverse/get-computed-role.d.ts +6 -1
- package/lib/dom-traverse/get-computed-role.js +54 -35
- package/lib/dom-traverse/get-content-model.d.ts +29 -0
- package/lib/dom-traverse/get-content-model.js +30 -0
- package/lib/dom-traverse/get-explicit-role.js +9 -4
- package/lib/dom-traverse/get-implicit-role.d.ts +6 -2
- package/lib/dom-traverse/get-implicit-role.js +6 -2
- package/lib/dom-traverse/get-non-presentational-ancestor.d.ts +10 -4
- package/lib/dom-traverse/get-non-presentational-ancestor.js +10 -2
- package/lib/dom-traverse/get-permitted-roles.d.ts +7 -3
- package/lib/dom-traverse/get-permitted-roles.js +3 -1
- package/lib/dom-traverse/get-spec.d.ts +5 -2
- package/lib/dom-traverse/get-spec.js +4 -2
- package/lib/dom-traverse/has-required-owned-elements.d.ts +8 -2
- package/lib/dom-traverse/has-required-owned-elements.js +26 -8
- package/lib/dom-traverse/is-exposed.d.ts +11 -0
- package/lib/dom-traverse/is-exposed.js +217 -0
- package/lib/dom-traverse/matches-context-role.d.ts +7 -0
- package/lib/dom-traverse/matches-context-role.js +27 -0
- package/lib/dom-traverse/may-be-focusable.d.ts +2 -0
- package/lib/dom-traverse/may-be-focusable.js +24 -0
- package/lib/index.d.ts +11 -1
- package/lib/index.js +11 -1
- package/lib/specs/aria-specs.d.ts +7 -4
- package/lib/specs/content-model-category-to-tag-names.d.ts +5 -2
- package/lib/specs/content-model-category-to-tag-names.js +2 -2
- package/lib/specs/get-aria.d.ts +8 -1
- package/lib/specs/get-aria.js +11 -5
- package/lib/specs/get-attr-specs.d.ts +7 -3
- package/lib/specs/get-attr-specs.js +2 -14
- package/lib/specs/get-implicit-role.d.ts +7 -1
- package/lib/specs/get-permitted-roles.d.ts +9 -3
- package/lib/specs/get-permitted-roles.js +19 -15
- package/lib/specs/get-role-spec.d.ts +10 -3
- package/lib/specs/get-role-spec.js +2 -2
- package/lib/specs/get-selectors-by-content-model-category.d.ts +2 -2
- package/lib/specs/get-selectors-by-content-model-category.js +1 -1
- package/lib/specs/get-spec-by-tag-name.d.ts +6 -2
- package/lib/specs/get-spec-by-tag-name.js +3 -2
- package/lib/specs/is-nothing-content-model.d.ts +5 -0
- package/lib/specs/is-nothing-content-model.js +14 -0
- package/lib/specs/is-palpable-elements.d.ts +9 -0
- package/lib/specs/is-palpable-elements.js +49 -0
- package/lib/specs/is-void-element.d.ts +1 -0
- package/lib/specs/is-void-element.js +27 -0
- package/lib/specs/resolve-version.d.ts +5 -1
- package/lib/specs/resolve-version.js +1 -1
- package/lib/specs/schema-to-spec.d.ts +4 -4
- package/lib/specs/schema-to-spec.js +29 -18
- package/lib/types/aria.d.ts +150 -109
- package/lib/types/attributes.d.ts +1507 -73
- package/lib/types/index.d.ts +195 -166
- package/{src/types/permitted-structres.ts → lib/types/permitted-structures.d.ts} +24 -35
- package/lib/utils/get-ns.d.ts +2 -1
- package/lib/utils/get-ns.js +3 -0
- package/lib/utils/merge-array.d.ts +9 -4
- package/lib/utils/resolve-namespace.d.ts +7 -7
- package/lib/utils/resolve-namespace.js +19 -13
- package/lib/utils/validateAriaVersion.d.ts +2 -0
- package/lib/utils/validateAriaVersion.js +8 -0
- package/package.json +13 -8
- package/schema.json +6 -6
- package/{src/dom-traverse/accname-computation.spec.ts → test/dom-traverse/accname-computation.spec.js} +8 -8
- package/test/dom-traverse/get-computed-aria-props.spec.js +758 -0
- package/test/dom-traverse/get-computed-role.spec.js +294 -0
- package/test/dom-traverse/get-implicit-role.spec.js +40 -0
- package/{src/dom-traverse/has-required-owned-elements.spec.ts → test/dom-traverse/has-required-owned-elements.spec.js} +7 -9
- package/test/dom-traverse/is-exposed.spec.js +70 -0
- package/test/dom-traverse/matches-context-role.spec.js +60 -0
- package/{src/specs/get-attr-specs.spec.ts → test/specs/get-attr-specs.spec.js} +2 -8
- package/{src/specs/get-implicit-role.spec.ts → test/specs/get-implicit-role.spec.js} +9 -11
- package/{src/specs/get-permitted-roles.spec.ts → test/specs/get-permitted-roles.spec.js} +8 -10
- package/{src/specs/get-role-spec.spec.ts → test/specs/get-role-spec.spec.js} +4 -4
- package/{src/specs/get-spec-by-tag-name.spec.ts → test/specs/get-spec-by-tag-name.spec.js} +11 -11
- package/test/specs/resolve-version.spec.js +34 -0
- package/test/specs/schema-to-spec.spec.js +61 -0
- package/test/utils/resolve-namespace.spec.js +37 -0
- package/lib/dom-traverse/focusability-computation.d.ts +0 -1
- package/lib/dom-traverse/focusability-computation.js +0 -8
- package/lib/dom-traverse/get-aria.d.ts +0 -9
- package/lib/dom-traverse/get-aria.js +0 -54
- package/lib/specs/aria-spec.d.ts +0 -5
- package/lib/specs/aria-spec.js +0 -12
- package/lib/specs/get-spec.d.ts +0 -13
- package/lib/specs/get-spec.js +0 -85
- package/lib/specs/html-spec.d.ts +0 -6
- package/lib/specs/html-spec.js +0 -16
- package/lib/specs/resolve-namespace.d.ts +0 -9
- package/lib/specs/resolve-namespace.js +0 -26
- package/lib/types/permitted-structres.d.ts +0 -64
- package/lib/utils.d.ts +0 -8
- package/lib/utils.js +0 -50
- package/schemas/aria.schema.json +0 -258
- package/schemas/attributes.schema.json +0 -204
- package/schemas/content-models.schema.json +0 -215
- package/schemas/element.schema.json +0 -11
- package/schemas/global-attributes.schema.json +0 -761
- package/src/dom-traverse/accname-computation.ts +0 -5
- package/src/dom-traverse/get-attr-specs.ts +0 -8
- package/src/dom-traverse/get-computed-role.spec.ts +0 -134
- package/src/dom-traverse/get-computed-role.ts +0 -193
- package/src/dom-traverse/get-explicit-role.ts +0 -112
- package/src/dom-traverse/get-implicit-role.ts +0 -36
- package/src/dom-traverse/get-non-presentational-ancestor.ts +0 -20
- package/src/dom-traverse/get-permitted-roles.ts +0 -7
- package/src/dom-traverse/get-spec.ts +0 -7
- package/src/dom-traverse/has-required-owned-elements.ts +0 -72
- package/src/index.ts +0 -17
- package/src/specs/aria-specs.ts +0 -6
- package/src/specs/content-model-category-to-tag-names.ts +0 -15
- package/src/specs/get-aria.ts +0 -85
- package/src/specs/get-attr-specs.ts +0 -116
- package/src/specs/get-implicit-role.ts +0 -17
- package/src/specs/get-permitted-roles.ts +0 -87
- package/src/specs/get-role-spec.ts +0 -72
- package/src/specs/get-selectors-by-content-model-category.ts +0 -10
- package/src/specs/get-spec-by-tag-name.ts +0 -16
- package/src/specs/is-presentational.ts +0 -6
- package/src/specs/resolve-version.ts +0 -20
- package/src/specs/schema-to-spec.spec.ts +0 -39
- package/src/specs/schema-to-spec.ts +0 -103
- package/src/types/aria.ts +0 -147
- package/src/types/attributes.ts +0 -1418
- package/src/types/index.ts +0 -255
- package/src/utils/get-ns.ts +0 -13
- package/src/utils/merge-array.ts +0 -35
- package/src/utils/resolve-namespace.ts +0 -36
- package/tsconfig.test.json +0 -3
- package/tsconfig.tsbuildinfo +0 -1
- /package/lib/types/{permitted-structres.js → permitted-structures.js} +0 -0
package/lib/types/index.d.ts
CHANGED
|
@@ -1,194 +1,223 @@
|
|
|
1
1
|
import type { ARIA } from './aria';
|
|
2
2
|
import type { AttributeJSON, AttributeType, GlobalAttributes } from './attributes';
|
|
3
|
-
import type { ContentModel, Category } from './permitted-
|
|
3
|
+
import type { ContentModel, Category } from './permitted-structures';
|
|
4
|
+
import type { ariaVersions } from '../constant/aria-version';
|
|
4
5
|
import type { NamespaceURI } from '@markuplint/ml-ast';
|
|
6
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* markuplint Markup-language spec
|
|
7
9
|
*/
|
|
8
10
|
export interface MLMLSpec {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
readonly cites: Cites;
|
|
12
|
+
readonly def: SpecDefs;
|
|
13
|
+
readonly specs: readonly ElementSpec[];
|
|
12
14
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
export type ExtendedElementSpec = Partial<Omit<ElementSpec, 'name' | 'attributes'>> & {
|
|
16
|
+
readonly name: ElementSpec['name'];
|
|
17
|
+
readonly attributes?: Readonly<Record<string, Partial<Attribute>>>;
|
|
16
18
|
};
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
export type ExtendedSpec = {
|
|
20
|
+
readonly cites?: Cites;
|
|
21
|
+
readonly def?: Partial<SpecDefs>;
|
|
22
|
+
readonly specs?: readonly ExtendedElementSpec[];
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
23
25
|
* Reference URLs
|
|
24
26
|
*/
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
27
|
+
export type Cites = readonly string[];
|
|
28
|
+
export type SpecDefs = {
|
|
29
|
+
readonly '#globalAttrs': {
|
|
30
|
+
readonly [category: string]: Readonly<Record<string, Partial<Attribute>>>;
|
|
31
|
+
};
|
|
32
|
+
readonly '#aria': {
|
|
33
|
+
readonly '1.3': ARIASpec;
|
|
34
|
+
readonly '1.2': ARIASpec;
|
|
35
|
+
readonly '1.1': ARIASpec;
|
|
36
|
+
};
|
|
37
|
+
readonly '#contentModels': {
|
|
38
|
+
readonly [model in Category]?: readonly string[];
|
|
39
|
+
};
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
type ARIASpec = {
|
|
42
|
+
readonly roles: readonly ARIARoleInSchema[];
|
|
43
|
+
readonly graphicsRoles: readonly ARIARoleInSchema[];
|
|
44
|
+
readonly props: readonly ARIAProperty[];
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
46
47
|
* Element spec
|
|
47
48
|
*/
|
|
48
|
-
export
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
49
|
+
export type ElementSpec = {
|
|
50
|
+
/**
|
|
51
|
+
* Tag name
|
|
52
|
+
*/
|
|
53
|
+
readonly name: string;
|
|
54
|
+
/**
|
|
55
|
+
* Namespaces in XML
|
|
56
|
+
* @see https://www.w3.org/TR/xml-names/
|
|
57
|
+
*/
|
|
58
|
+
readonly namespace?: NamespaceURI;
|
|
59
|
+
/**
|
|
60
|
+
* Reference URL
|
|
61
|
+
*/
|
|
62
|
+
readonly cite: string;
|
|
63
|
+
/**
|
|
64
|
+
* Description
|
|
65
|
+
*/
|
|
66
|
+
readonly description?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Experimental technology
|
|
69
|
+
*/
|
|
70
|
+
readonly experimental?: true;
|
|
71
|
+
/**
|
|
72
|
+
* Obsolete or alternative elements
|
|
73
|
+
*/
|
|
74
|
+
readonly obsolete?:
|
|
75
|
+
| true
|
|
76
|
+
| {
|
|
77
|
+
readonly alt: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Deprecated
|
|
81
|
+
*/
|
|
82
|
+
readonly deprecated?: true;
|
|
83
|
+
/**
|
|
84
|
+
* Non-standard
|
|
85
|
+
*/
|
|
86
|
+
readonly nonStandard?: true;
|
|
87
|
+
/**
|
|
88
|
+
* Element categories
|
|
89
|
+
*/
|
|
90
|
+
readonly categories: readonly Category[];
|
|
91
|
+
/**
|
|
92
|
+
* Permitted contents and permitted parents
|
|
93
|
+
*/
|
|
94
|
+
readonly contentModel: ReadonlyDeep<ContentModel>;
|
|
95
|
+
/**
|
|
96
|
+
* Tag omission
|
|
97
|
+
*/
|
|
98
|
+
readonly omission: ElementSpecOmission;
|
|
99
|
+
/**
|
|
100
|
+
* Global Attributes
|
|
101
|
+
*/
|
|
102
|
+
readonly globalAttrs: ReadonlyDeep<GlobalAttributes>;
|
|
103
|
+
/**
|
|
104
|
+
* Attributes
|
|
105
|
+
*/
|
|
106
|
+
readonly attributes: Readonly<Record<string, Attribute>>;
|
|
107
|
+
/**
|
|
108
|
+
* WAI-ARIA role and properties
|
|
109
|
+
*/
|
|
110
|
+
readonly aria: ReadonlyDeep<ARIA>;
|
|
111
|
+
/**
|
|
112
|
+
* If true, it is possible to add any properties as attributes,
|
|
113
|
+
* for example, when using a template engine or a view language.
|
|
114
|
+
*
|
|
115
|
+
* @see https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots
|
|
116
|
+
*
|
|
117
|
+
* **It assumes to specify it on the parser plugin.**
|
|
118
|
+
*/
|
|
119
|
+
readonly possibleToAddProperties?: true;
|
|
117
120
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
type ElementSpecOmission = false | ElementSpecOmissionTags;
|
|
122
|
+
type ElementSpecOmissionTags = {
|
|
123
|
+
readonly startTag: boolean | ElementCondition;
|
|
124
|
+
readonly endTag: boolean | ElementCondition;
|
|
122
125
|
};
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
type ElementCondition = {
|
|
127
|
+
readonly __WIP__: 'WORK_IN_PROGRESS';
|
|
125
128
|
};
|
|
126
|
-
export
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
export type Attribute = {
|
|
130
|
+
readonly name: string;
|
|
131
|
+
readonly type: ReadonlyDeep<AttributeType> | readonly ReadonlyDeep<AttributeType>[];
|
|
132
|
+
readonly description?: string;
|
|
133
|
+
readonly caseSensitive?: true;
|
|
134
|
+
readonly experimental?: boolean;
|
|
135
|
+
readonly obsolete?: true;
|
|
136
|
+
readonly deprecated?: boolean;
|
|
137
|
+
readonly nonStandard?: true;
|
|
135
138
|
} & ExtendableAttributeSpec;
|
|
136
|
-
|
|
137
|
-
export
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
139
|
+
type ExtendableAttributeSpec = Omit<ReadonlyDeep<AttributeJSON>, 'type'>;
|
|
140
|
+
export type ARIARole = {
|
|
141
|
+
readonly name: string;
|
|
142
|
+
readonly isAbstract: boolean;
|
|
143
|
+
readonly requiredContextRole: readonly string[];
|
|
144
|
+
readonly requiredOwnedElements: readonly string[];
|
|
145
|
+
readonly accessibleNameRequired: boolean;
|
|
146
|
+
readonly accessibleNameFromAuthor: boolean;
|
|
147
|
+
readonly accessibleNameFromContent: boolean;
|
|
148
|
+
readonly accessibleNameProhibited: boolean;
|
|
149
|
+
readonly childrenPresentational: boolean;
|
|
150
|
+
readonly ownedProperties: readonly ARIARoleOwnedProperties[];
|
|
151
|
+
readonly prohibitedProperties: readonly string[];
|
|
149
152
|
};
|
|
150
|
-
export
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
export type ARIARoleInSchema = Partial<
|
|
154
|
+
ARIARole & {
|
|
155
|
+
readonly description: string;
|
|
156
|
+
readonly generalization: readonly string[];
|
|
157
|
+
}
|
|
158
|
+
> & {
|
|
159
|
+
readonly name: string;
|
|
155
160
|
};
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
export type ARIARoleOwnedProperties = {
|
|
162
|
+
readonly name: string;
|
|
163
|
+
readonly inherited?: true;
|
|
164
|
+
readonly required?: true;
|
|
165
|
+
readonly deprecated?: true;
|
|
161
166
|
};
|
|
162
|
-
export
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
export type ARIAProperty = {
|
|
168
|
+
readonly name: string;
|
|
169
|
+
readonly type: 'property' | 'state';
|
|
170
|
+
readonly deprecated?: true;
|
|
171
|
+
readonly isGlobal?: true;
|
|
172
|
+
readonly value: ARIAAttributeValue;
|
|
173
|
+
readonly conditionalValue?: readonly {
|
|
174
|
+
readonly role: readonly string[];
|
|
175
|
+
readonly value: ARIAAttributeValue;
|
|
176
|
+
}[];
|
|
177
|
+
readonly enum: readonly string[];
|
|
178
|
+
readonly defaultValue?: string;
|
|
179
|
+
readonly equivalentHtmlAttrs?: readonly EquivalentHtmlAttr[];
|
|
180
|
+
readonly valueDescriptions?: Readonly<Record<string, string>>;
|
|
176
181
|
};
|
|
177
|
-
export
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
export type ARIAAttributeValue =
|
|
183
|
+
| 'true/false'
|
|
184
|
+
| 'tristate'
|
|
185
|
+
| 'true/false/undefined'
|
|
186
|
+
| 'ID reference'
|
|
187
|
+
| 'ID reference list'
|
|
188
|
+
| 'integer'
|
|
189
|
+
| 'number'
|
|
190
|
+
| 'string'
|
|
191
|
+
| 'token'
|
|
192
|
+
| 'token list'
|
|
193
|
+
| 'URI';
|
|
194
|
+
export type ARIAVersion = (typeof ariaVersions)[number];
|
|
195
|
+
export type EquivalentHtmlAttr = {
|
|
196
|
+
readonly htmlAttrName: string;
|
|
197
|
+
readonly isNotStrictEquivalent?: true;
|
|
198
|
+
readonly value: string | null;
|
|
183
199
|
};
|
|
184
|
-
export
|
|
185
|
-
export
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
export type Matches = (selector: string) => boolean;
|
|
201
|
+
export type ComputedRole = {
|
|
202
|
+
readonly el: Element;
|
|
203
|
+
readonly role:
|
|
204
|
+
| (ARIARole & {
|
|
205
|
+
readonly superClassRoles: readonly ARIARoleInSchema[];
|
|
206
|
+
readonly isImplicit?: boolean;
|
|
207
|
+
})
|
|
208
|
+
| null;
|
|
209
|
+
readonly errorType?: RoleComputationError;
|
|
192
210
|
};
|
|
193
|
-
export
|
|
211
|
+
export type RoleComputationError =
|
|
212
|
+
| 'ABSTRACT'
|
|
213
|
+
| 'GLOBAL_PROP_MUST_NOT_BE_PRESENTATIONAL'
|
|
214
|
+
| 'IMPLICIT_ROLE_NAMESPACE_ERROR'
|
|
215
|
+
| 'INTERACTIVE_ELEMENT_MUST_NOT_BE_PRESENTATIONAL'
|
|
216
|
+
| 'INVALID_LANDMARK'
|
|
217
|
+
| 'INVALID_REQUIRED_CONTEXT_ROLE'
|
|
218
|
+
| 'NO_EXPLICIT'
|
|
219
|
+
| 'NO_OWNER'
|
|
220
|
+
| 'NO_PERMITTED'
|
|
221
|
+
| 'REQUIRED_OWNED_ELEMENT_MUST_NOT_BE_PRESENTATIONAL'
|
|
222
|
+
| 'ROLE_NO_EXISTS';
|
|
194
223
|
export {};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
1
|
/**
|
|
3
2
|
* This file was automatically generated by json-schema-to-typescript.
|
|
4
3
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
4
|
* and run json-schema-to-typescript to regenerate this file.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
export type PermittedContent =
|
|
6
|
+
export type PermittedContentPattern =
|
|
9
7
|
| PermittedContentRequire
|
|
10
8
|
| PermittedContentOptional
|
|
11
9
|
| PermittedContentOneOrMore
|
|
12
10
|
| PermittedContentZeroOrMore
|
|
13
11
|
| PermittedContentChoice
|
|
14
|
-
|
|
|
15
|
-
export type
|
|
12
|
+
| PermittedContentTransparent;
|
|
13
|
+
export type Model = ContentType | ContentType[];
|
|
16
14
|
export type ContentType = string | Category;
|
|
17
15
|
export type Category =
|
|
18
16
|
| '#text'
|
|
@@ -22,7 +20,6 @@ export type Category =
|
|
|
22
20
|
| '#heading'
|
|
23
21
|
| '#sectioning'
|
|
24
22
|
| '#metadata'
|
|
25
|
-
| '#transparent'
|
|
26
23
|
| '#embedded'
|
|
27
24
|
| '#palpable'
|
|
28
25
|
| '#script-supporting'
|
|
@@ -44,65 +41,57 @@ export type Category =
|
|
|
44
41
|
| '#SVGStructural'
|
|
45
42
|
| '#SVGStructurallyExternal'
|
|
46
43
|
| '#SVGTextContent'
|
|
47
|
-
| '#SVGTextContentChild'
|
|
48
|
-
| '#SVGOtherXMLNamespace';
|
|
49
|
-
export type PermittedContentSpec = PermittedContent[];
|
|
50
|
-
|
|
44
|
+
| '#SVGTextContentChild';
|
|
51
45
|
export interface ContentModelsSchema {
|
|
52
46
|
__contentModel?: ContentModel;
|
|
53
47
|
}
|
|
54
48
|
export interface ContentModel {
|
|
55
|
-
contents:
|
|
49
|
+
contents: PermittedContentPattern[] | boolean;
|
|
56
50
|
descendantOf?: string;
|
|
57
51
|
conditional?: {
|
|
58
52
|
condition: string;
|
|
59
|
-
contents:
|
|
53
|
+
contents: PermittedContentPattern[] | boolean;
|
|
60
54
|
}[];
|
|
61
55
|
}
|
|
62
56
|
export interface PermittedContentRequire {
|
|
63
|
-
require:
|
|
64
|
-
ignore?: Target;
|
|
65
|
-
notAllowedDescendants?: ContentType[];
|
|
57
|
+
require: Model | PermittedContentPattern[];
|
|
66
58
|
max?: number;
|
|
67
59
|
min?: number;
|
|
68
60
|
_TODO_?: string;
|
|
69
61
|
}
|
|
70
62
|
export interface PermittedContentOptional {
|
|
71
|
-
optional:
|
|
72
|
-
ignore?: Target;
|
|
73
|
-
notAllowedDescendants?: ContentType[];
|
|
63
|
+
optional: Model | PermittedContentPattern[];
|
|
74
64
|
max?: number;
|
|
75
65
|
_TODO_?: string;
|
|
76
66
|
}
|
|
77
67
|
export interface PermittedContentOneOrMore {
|
|
78
|
-
oneOrMore:
|
|
79
|
-
ignore?: Target;
|
|
80
|
-
notAllowedDescendants?: ContentType[];
|
|
68
|
+
oneOrMore: Model | PermittedContentPattern[];
|
|
81
69
|
max?: number;
|
|
82
70
|
_TODO_?: string;
|
|
83
71
|
}
|
|
84
72
|
export interface PermittedContentZeroOrMore {
|
|
85
|
-
zeroOrMore:
|
|
86
|
-
ignore?: Target;
|
|
87
|
-
notAllowedDescendants?: ContentType[];
|
|
73
|
+
zeroOrMore: Model | PermittedContentPattern[];
|
|
88
74
|
max?: number;
|
|
89
75
|
_TODO_?: string;
|
|
90
76
|
}
|
|
91
77
|
export interface PermittedContentChoice {
|
|
78
|
+
/**
|
|
79
|
+
* @minItems 2
|
|
80
|
+
* @maxItems 5
|
|
81
|
+
*/
|
|
92
82
|
choice:
|
|
93
|
-
| [
|
|
94
|
-
| [
|
|
95
|
-
| [
|
|
83
|
+
| [PermittedContentPattern[], PermittedContentPattern[]]
|
|
84
|
+
| [PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[]]
|
|
85
|
+
| [PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[]]
|
|
96
86
|
| [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
PermittedContentPattern[],
|
|
88
|
+
PermittedContentPattern[],
|
|
89
|
+
PermittedContentPattern[],
|
|
90
|
+
PermittedContentPattern[],
|
|
91
|
+
PermittedContentPattern[],
|
|
102
92
|
];
|
|
103
93
|
_TODO_?: string;
|
|
104
94
|
}
|
|
105
|
-
export interface
|
|
106
|
-
|
|
107
|
-
_TODO_?: string;
|
|
95
|
+
export interface PermittedContentTransparent {
|
|
96
|
+
transparent: string;
|
|
108
97
|
}
|
package/lib/utils/get-ns.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Namespace } from '@markuplint/ml-ast';
|
|
2
|
+
export declare function getNS(namespaceURI: string | null): Namespace;
|
package/lib/utils/get-ns.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
type NamedDefinition =
|
|
2
|
+
| string
|
|
3
|
+
| {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function mergeArray<T extends NamedDefinition>(
|
|
7
|
+
a: readonly T[],
|
|
8
|
+
b: readonly T[] | null | undefined,
|
|
9
|
+
): readonly T[];
|
|
5
10
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { NamespaceURI } from '@markuplint/ml-ast';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { NamespaceURI, Namespace } from '@markuplint/ml-ast';
|
|
2
|
+
type NamespacedElementName = {
|
|
3
|
+
localNameWithNS: string;
|
|
4
|
+
localName: string;
|
|
5
|
+
namespace: Namespace;
|
|
6
|
+
namespaceURI: NamespaceURI;
|
|
7
7
|
};
|
|
8
|
-
export declare function resolveNamespace(
|
|
8
|
+
export declare function resolveNamespace(name: string, namespaceURI?: string | null): NamespacedElementName;
|
|
9
9
|
export {};
|
|
@@ -3,24 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveNamespace = void 0;
|
|
4
4
|
const get_ns_1 = require("./get-ns");
|
|
5
5
|
const cache = new Map();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const namespaceURIMap = {
|
|
7
|
+
html: 'http://www.w3.org/1999/xhtml',
|
|
8
|
+
svg: 'http://www.w3.org/2000/svg',
|
|
9
|
+
mml: 'http://www.w3.org/1998/Math/MathML',
|
|
10
|
+
xlink: 'http://www.w3.org/1999/xlink',
|
|
11
|
+
};
|
|
12
|
+
function resolveNamespace(name, namespaceURI = 'http://www.w3.org/1999/xhtml') {
|
|
13
|
+
var _a;
|
|
14
|
+
const cached = cache.get(name + namespaceURI);
|
|
8
15
|
if (cached) {
|
|
9
16
|
return cached;
|
|
10
17
|
}
|
|
11
|
-
const
|
|
12
|
-
const
|
|
18
|
+
const [_explicitNS, _localName] = name.split(':');
|
|
19
|
+
const explicitNS = _localName ? _explicitNS : null;
|
|
20
|
+
const localName = (_a = _localName !== null && _localName !== void 0 ? _localName : _explicitNS) !== null && _a !== void 0 ? _a : '';
|
|
21
|
+
const namespace = ['html', 'svg', 'mml', 'xlink'].find(_ns => _ns === (explicitNS || (0, get_ns_1.getNS)(namespaceURI !== null && namespaceURI !== void 0 ? namespaceURI : null))) ||
|
|
22
|
+
'html';
|
|
13
23
|
const result = {
|
|
14
|
-
localNameWithNS: `${
|
|
15
|
-
localName
|
|
16
|
-
namespace
|
|
17
|
-
namespaceURI: [
|
|
18
|
-
'http://www.w3.org/1999/xhtml',
|
|
19
|
-
'http://www.w3.org/2000/svg',
|
|
20
|
-
'http://www.w3.org/1998/Math/MathML',
|
|
21
|
-
].find(ns => ns === namespaceURI) || 'http://www.w3.org/1999/xhtml',
|
|
24
|
+
localNameWithNS: `${namespace === 'html' ? '' : `${namespace}:`}${localName}`,
|
|
25
|
+
localName,
|
|
26
|
+
namespace,
|
|
27
|
+
namespaceURI: namespaceURIMap[namespace],
|
|
22
28
|
};
|
|
23
|
-
cache.set(
|
|
29
|
+
cache.set(name + namespaceURI, result);
|
|
24
30
|
return result;
|
|
25
31
|
}
|
|
26
32
|
exports.resolveNamespace = resolveNamespace;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAriaVersion = void 0;
|
|
4
|
+
const aria_version_1 = require("../constant/aria-version");
|
|
5
|
+
function validateAriaVersion(version) {
|
|
6
|
+
return aria_version_1.ariaVersions.includes(version);
|
|
7
|
+
}
|
|
8
|
+
exports.validateAriaVersion = validateAriaVersion;
|