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