@markuplint/ml-spec 3.0.0-alpha.82 → 3.0.0-dev.24
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/dom-traverse/get-computed-aria-props.d.ts +12 -0
- package/lib/dom-traverse/get-computed-aria-props.js +106 -0
- package/lib/dom-traverse/get-computed-role.js +13 -25
- package/lib/dom-traverse/get-content-model.d.ts +3 -0
- package/lib/dom-traverse/get-content-model.js +28 -0
- package/lib/dom-traverse/get-explicit-role.js +1 -1
- package/lib/dom-traverse/get-spec.d.ts +2 -2
- package/lib/dom-traverse/get-spec.js +2 -2
- package/lib/dom-traverse/has-required-owned-elements.js +12 -0
- package/lib/dom-traverse/is-exposed.d.ts +11 -0
- package/lib/dom-traverse/is-exposed.js +181 -0
- package/lib/dom-traverse/may-be-focusable.d.ts +2 -0
- package/lib/dom-traverse/may-be-focusable.js +22 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.js +8 -1
- package/lib/specs/content-model-category-to-tag-names.d.ts +2 -2
- package/lib/specs/content-model-category-to-tag-names.js +2 -2
- package/lib/specs/get-aria.js +3 -3
- package/lib/specs/get-attr-specs.d.ts +1 -1
- package/lib/specs/get-selectors-by-content-model-category.d.ts +1 -1
- package/lib/specs/get-spec-by-tag-name.d.ts +2 -2
- package/lib/specs/get-spec-by-tag-name.js +1 -1
- package/lib/specs/is-nothing-content-model.d.ts +5 -0
- package/lib/specs/is-nothing-content-model.js +12 -0
- package/lib/specs/is-palpable-elements.d.ts +5 -0
- package/lib/specs/is-palpable-elements.js +47 -0
- package/lib/specs/is-void-element.d.ts +1 -0
- package/lib/specs/is-void-element.js +25 -0
- package/lib/specs/schema-to-spec.d.ts +1 -1
- package/lib/specs/schema-to-spec.js +1 -1
- package/lib/types/aria.d.ts +10 -4
- package/lib/types/attributes.d.ts +94 -39
- package/lib/types/index.d.ts +27 -27
- package/lib/types/permitted-structres.d.ts +22 -28
- package/lib/types/permitted-structures.d.ts +54 -0
- package/lib/types/permitted-structures.js +8 -0
- package/lib/utils/get-ns.d.ts +2 -1
- package/lib/utils/get-ns.js +3 -0
- package/lib/utils/merge-array.d.ts +1 -1
- package/lib/utils/resolve-namespace.d.ts +4 -4
- package/lib/utils/resolve-namespace.js +18 -13
- package/package.json +7 -7
- package/schema.json +6 -6
- package/schemas/aria.schema.json +1 -1
- package/schemas/content-models.schema.json +33 -49
- package/src/dom-traverse/accname-computation.spec.ts +6 -6
- package/src/dom-traverse/get-computed-aria-props.spec.ts +368 -0
- package/src/dom-traverse/get-computed-aria-props.ts +130 -0
- package/src/dom-traverse/get-computed-role.spec.ts +1 -1
- package/src/dom-traverse/get-computed-role.ts +13 -25
- package/src/dom-traverse/get-content-model.ts +32 -0
- package/src/dom-traverse/get-explicit-role.ts +1 -1
- package/src/dom-traverse/get-spec.ts +3 -3
- package/src/dom-traverse/has-required-owned-elements.ts +13 -0
- package/src/dom-traverse/is-exposed.spec.ts +50 -0
- package/src/dom-traverse/is-exposed.ts +196 -0
- package/src/dom-traverse/may-be-focusable.ts +21 -0
- package/src/index.ts +8 -1
- package/src/specs/content-model-category-to-tag-names.ts +3 -3
- package/src/specs/get-aria.ts +3 -3
- package/src/specs/get-selectors-by-content-model-category.ts +1 -1
- package/src/specs/get-spec-by-tag-name.spec.ts +10 -10
- package/src/specs/get-spec-by-tag-name.ts +9 -5
- package/src/specs/is-nothing-content-model.ts +9 -0
- package/src/specs/is-palpable-elements.ts +55 -0
- package/src/specs/is-void-element.ts +22 -0
- package/src/specs/schema-to-spec.ts +1 -1
- package/src/types/aria.ts +7 -1
- package/src/types/attributes.ts +227 -121
- package/src/types/index.ts +8 -8
- package/src/types/permitted-structres.ts +24 -32
- package/src/types/permitted-structures.ts +96 -0
- package/src/utils/get-ns.ts +6 -1
- package/src/utils/resolve-namespace.spec.ts +37 -0
- package/src/utils/resolve-namespace.ts +22 -18
- package/tsconfig.tsbuildinfo +1 -1
- 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/utils.d.ts +0 -8
- package/lib/utils.js +0 -50
package/lib/types/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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
4
|
import type { NamespaceURI } from '@markuplint/ml-ast';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* markuplint Markup-language spec
|
|
7
7
|
*/
|
|
8
8
|
export interface MLMLSpec {
|
|
9
9
|
cites: Cites;
|
|
10
10
|
def: SpecDefs;
|
|
11
11
|
specs: ElementSpec[];
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type ExtendedElementSpec = Partial<Omit<ElementSpec, 'name' | 'attributes'>> & {
|
|
14
14
|
name: ElementSpec['name'];
|
|
15
15
|
attributes?: Record<string, Partial<Attribute>>;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type ExtendedSpec = {
|
|
18
18
|
cites?: Cites;
|
|
19
19
|
def?: Partial<SpecDefs>;
|
|
20
20
|
specs?: ExtendedElementSpec[];
|
|
@@ -22,8 +22,8 @@ export declare type ExtendedSpec = {
|
|
|
22
22
|
/**
|
|
23
23
|
* Reference URLs
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
26
|
-
export
|
|
25
|
+
export type Cites = string[];
|
|
26
|
+
export type SpecDefs = {
|
|
27
27
|
'#globalAttrs': Partial<{
|
|
28
28
|
'#extends': Record<string, Partial<Attribute>>;
|
|
29
29
|
'#HTMLGlobalAttrs': Record<string, Partial<Attribute>>;
|
|
@@ -37,7 +37,7 @@ export declare type SpecDefs = {
|
|
|
37
37
|
[model in Category]?: string[];
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
type ARIASpec = {
|
|
41
41
|
roles: ARIARoleInSchema[];
|
|
42
42
|
graphicsRoles: ARIARoleInSchema[];
|
|
43
43
|
props: ARIAProperty[];
|
|
@@ -45,7 +45,7 @@ declare type ARIASpec = {
|
|
|
45
45
|
/**
|
|
46
46
|
* Element spec
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type ElementSpec = {
|
|
49
49
|
/**
|
|
50
50
|
* Tag name
|
|
51
51
|
*/
|
|
@@ -82,7 +82,7 @@ export declare type ElementSpec = {
|
|
|
82
82
|
*/
|
|
83
83
|
nonStandard?: true;
|
|
84
84
|
/**
|
|
85
|
-
* Element
|
|
85
|
+
* Element categories
|
|
86
86
|
*/
|
|
87
87
|
categories: Category[];
|
|
88
88
|
/**
|
|
@@ -90,9 +90,9 @@ export declare type ElementSpec = {
|
|
|
90
90
|
*/
|
|
91
91
|
contentModel: ContentModel;
|
|
92
92
|
/**
|
|
93
|
-
* Tag
|
|
93
|
+
* Tag omission
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
omission: ElementSpecOmission;
|
|
96
96
|
/**
|
|
97
97
|
* Global Attributes
|
|
98
98
|
*/
|
|
@@ -102,7 +102,7 @@ export declare type ElementSpec = {
|
|
|
102
102
|
*/
|
|
103
103
|
attributes: Record<string, Attribute>;
|
|
104
104
|
/**
|
|
105
|
-
* WAI-ARIA role and
|
|
105
|
+
* WAI-ARIA role and properties
|
|
106
106
|
*/
|
|
107
107
|
aria: ARIA;
|
|
108
108
|
/**
|
|
@@ -115,15 +115,15 @@ export declare type ElementSpec = {
|
|
|
115
115
|
*/
|
|
116
116
|
possibleToAddProperties?: true;
|
|
117
117
|
};
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
type ElementSpecOmission = false | ElementSpecOmissionTags;
|
|
119
|
+
type ElementSpecOmissionTags = {
|
|
120
120
|
startTag: boolean | ElementCondition;
|
|
121
121
|
endTag: boolean | ElementCondition;
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
type ElementCondition = {
|
|
124
124
|
__WIP__: 'WORK_IN_PROGRESS';
|
|
125
125
|
};
|
|
126
|
-
export
|
|
126
|
+
export type Attribute = {
|
|
127
127
|
name: string;
|
|
128
128
|
type: AttributeType | AttributeType[];
|
|
129
129
|
description?: string;
|
|
@@ -133,8 +133,8 @@ export declare type Attribute = {
|
|
|
133
133
|
deprecated?: boolean;
|
|
134
134
|
nonStandard?: true;
|
|
135
135
|
} & ExtendableAttributeSpec;
|
|
136
|
-
|
|
137
|
-
export
|
|
136
|
+
type ExtendableAttributeSpec = Omit<AttributeJSON, 'type'>;
|
|
137
|
+
export type ARIARole = {
|
|
138
138
|
name: string;
|
|
139
139
|
isAbstract: boolean;
|
|
140
140
|
requiredContextRole: string[];
|
|
@@ -147,19 +147,19 @@ export declare type ARIARole = {
|
|
|
147
147
|
ownedProperties: ARIARoleOwnedProperties[];
|
|
148
148
|
prohibitedProperties: string[];
|
|
149
149
|
};
|
|
150
|
-
export
|
|
150
|
+
export type ARIARoleInSchema = Partial<ARIARole & {
|
|
151
151
|
description: string;
|
|
152
152
|
generalization: string[];
|
|
153
153
|
}> & {
|
|
154
154
|
name: string;
|
|
155
155
|
};
|
|
156
|
-
export
|
|
156
|
+
export type ARIARoleOwnedProperties = {
|
|
157
157
|
name: string;
|
|
158
158
|
inherited?: true;
|
|
159
159
|
required?: true;
|
|
160
160
|
deprecated?: true;
|
|
161
161
|
};
|
|
162
|
-
export
|
|
162
|
+
export type ARIAProperty = {
|
|
163
163
|
name: string;
|
|
164
164
|
type: 'property' | 'state';
|
|
165
165
|
deprecated?: true;
|
|
@@ -174,15 +174,15 @@ export declare type ARIAProperty = {
|
|
|
174
174
|
equivalentHtmlAttrs?: EquivalentHtmlAttr[];
|
|
175
175
|
valueDescriptions?: Record<string, string>;
|
|
176
176
|
};
|
|
177
|
-
export
|
|
178
|
-
export
|
|
179
|
-
export
|
|
177
|
+
export type ARIAAttributeValue = 'true/false' | 'tristate' | 'true/false/undefined' | 'ID reference' | 'ID reference list' | 'integer' | 'number' | 'string' | 'token' | 'token list' | 'URI';
|
|
178
|
+
export type ARIAVersion = '1.1' | '1.2';
|
|
179
|
+
export type EquivalentHtmlAttr = {
|
|
180
180
|
htmlAttrName: string;
|
|
181
181
|
isNotStrictEquivalent?: true;
|
|
182
182
|
value: string | null;
|
|
183
183
|
};
|
|
184
|
-
export
|
|
185
|
-
export
|
|
184
|
+
export type Matches = (selector: string) => boolean;
|
|
185
|
+
export type ComputedRole = {
|
|
186
186
|
el: Element;
|
|
187
187
|
role: (ARIARole & {
|
|
188
188
|
superClassRoles: ARIARoleInSchema[];
|
|
@@ -190,5 +190,5 @@ export declare type ComputedRole = {
|
|
|
190
190
|
}) | null;
|
|
191
191
|
errorType?: RoleComputationError;
|
|
192
192
|
};
|
|
193
|
-
export
|
|
193
|
+
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';
|
|
194
194
|
export {};
|
|
@@ -3,62 +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
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export declare type PermittedContentSpec = PermittedContent[];
|
|
6
|
+
export type PermittedContentPattern = PermittedContentRequire | PermittedContentOptional | PermittedContentOneOrMore | PermittedContentZeroOrMore | PermittedContentChoice | PermittedContentTransparent;
|
|
7
|
+
export type Model = ContentType | ContentType[];
|
|
8
|
+
export type ContentType = string | Category;
|
|
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';
|
|
11
10
|
export interface ContentModelsSchema {
|
|
12
11
|
__contentModel?: ContentModel;
|
|
13
12
|
}
|
|
14
13
|
export interface ContentModel {
|
|
15
|
-
contents:
|
|
14
|
+
contents: PermittedContentPattern[] | boolean;
|
|
16
15
|
descendantOf?: string;
|
|
17
16
|
conditional?: {
|
|
18
17
|
condition: string;
|
|
19
|
-
contents:
|
|
18
|
+
contents: PermittedContentPattern[] | boolean;
|
|
20
19
|
}[];
|
|
21
20
|
}
|
|
22
21
|
export interface PermittedContentRequire {
|
|
23
|
-
require:
|
|
24
|
-
ignore?: Target;
|
|
25
|
-
notAllowedDescendants?: ContentType[];
|
|
22
|
+
require: Model;
|
|
26
23
|
max?: number;
|
|
27
24
|
min?: number;
|
|
28
25
|
_TODO_?: string;
|
|
29
26
|
}
|
|
30
27
|
export interface PermittedContentOptional {
|
|
31
|
-
optional:
|
|
32
|
-
ignore?: Target;
|
|
33
|
-
notAllowedDescendants?: ContentType[];
|
|
28
|
+
optional: Model;
|
|
34
29
|
max?: number;
|
|
35
30
|
_TODO_?: string;
|
|
36
31
|
}
|
|
37
32
|
export interface PermittedContentOneOrMore {
|
|
38
|
-
oneOrMore:
|
|
39
|
-
ignore?: Target;
|
|
40
|
-
notAllowedDescendants?: ContentType[];
|
|
33
|
+
oneOrMore: Model | PermittedContentPattern[];
|
|
41
34
|
max?: number;
|
|
42
35
|
_TODO_?: string;
|
|
43
36
|
}
|
|
44
37
|
export interface PermittedContentZeroOrMore {
|
|
45
|
-
zeroOrMore:
|
|
46
|
-
ignore?: Target;
|
|
47
|
-
notAllowedDescendants?: ContentType[];
|
|
38
|
+
zeroOrMore: Model | PermittedContentPattern[];
|
|
48
39
|
max?: number;
|
|
49
40
|
_TODO_?: string;
|
|
50
41
|
}
|
|
51
42
|
export interface PermittedContentChoice {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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[]
|
|
58
53
|
];
|
|
59
54
|
_TODO_?: string;
|
|
60
55
|
}
|
|
61
|
-
export interface
|
|
62
|
-
|
|
63
|
-
_TODO_?: string;
|
|
56
|
+
export interface PermittedContentTransparent {
|
|
57
|
+
transparent: string;
|
|
64
58
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export type PermittedContentPattern = PermittedContentRequire | PermittedContentOptional | PermittedContentOneOrMore | PermittedContentZeroOrMore | PermittedContentChoice | PermittedContentTransparent;
|
|
7
|
+
export type Model = ContentType | ContentType[];
|
|
8
|
+
export type ContentType = string | Category;
|
|
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';
|
|
10
|
+
export interface ContentModelsSchema {
|
|
11
|
+
__contentModel?: ContentModel;
|
|
12
|
+
}
|
|
13
|
+
export interface ContentModel {
|
|
14
|
+
contents: PermittedContentPattern[] | boolean;
|
|
15
|
+
descendantOf?: string;
|
|
16
|
+
conditional?: {
|
|
17
|
+
condition: string;
|
|
18
|
+
contents: PermittedContentPattern[] | boolean;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
export interface PermittedContentRequire {
|
|
22
|
+
require: Model;
|
|
23
|
+
max?: number;
|
|
24
|
+
min?: number;
|
|
25
|
+
_TODO_?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PermittedContentOptional {
|
|
28
|
+
optional: Model;
|
|
29
|
+
max?: number;
|
|
30
|
+
_TODO_?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PermittedContentOneOrMore {
|
|
33
|
+
oneOrMore: Model | PermittedContentPattern[];
|
|
34
|
+
max?: number;
|
|
35
|
+
_TODO_?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface PermittedContentZeroOrMore {
|
|
38
|
+
zeroOrMore: Model | PermittedContentPattern[];
|
|
39
|
+
max?: number;
|
|
40
|
+
_TODO_?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface PermittedContentChoice {
|
|
43
|
+
choice: [PermittedContentPattern[], PermittedContentPattern[]] | [PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[]] | [PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[], PermittedContentPattern[]] | [
|
|
44
|
+
PermittedContentPattern[],
|
|
45
|
+
PermittedContentPattern[],
|
|
46
|
+
PermittedContentPattern[],
|
|
47
|
+
PermittedContentPattern[],
|
|
48
|
+
PermittedContentPattern[]
|
|
49
|
+
];
|
|
50
|
+
_TODO_?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface PermittedContentTransparent {
|
|
53
|
+
transparent: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
5
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
6
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
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,9 +1,9 @@
|
|
|
1
|
-
import type { NamespaceURI } from '@markuplint/ml-ast';
|
|
2
|
-
|
|
1
|
+
import type { NamespaceURI, Namespace } from '@markuplint/ml-ast';
|
|
2
|
+
type NamespacedElementName = {
|
|
3
3
|
localNameWithNS: string;
|
|
4
4
|
localName: string;
|
|
5
|
-
namespace:
|
|
5
|
+
namespace: Namespace;
|
|
6
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,29 @@ 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
|
+
const cached = cache.get(name + namespaceURI);
|
|
8
14
|
if (cached) {
|
|
9
15
|
return cached;
|
|
10
16
|
}
|
|
11
|
-
const
|
|
12
|
-
const
|
|
17
|
+
const [_explicitNS, _localName] = name.split(':');
|
|
18
|
+
const explicitNS = _localName ? _explicitNS : null;
|
|
19
|
+
const localName = _localName !== null && _localName !== void 0 ? _localName : _explicitNS;
|
|
20
|
+
const namespace = ['html', 'svg', 'mml', 'xlink'].find(_ns => _ns === (explicitNS || (0, get_ns_1.getNS)(namespaceURI || null))) ||
|
|
21
|
+
'html';
|
|
13
22
|
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',
|
|
23
|
+
localNameWithNS: `${namespace === 'html' ? '' : `${namespace}:`}${localName}`,
|
|
24
|
+
localName,
|
|
25
|
+
namespace,
|
|
26
|
+
namespaceURI: namespaceURIMap[namespace],
|
|
22
27
|
};
|
|
23
|
-
cache.set(
|
|
28
|
+
cache.set(name + namespaceURI, result);
|
|
24
29
|
return result;
|
|
25
30
|
}
|
|
26
31
|
exports.resolveNamespace = resolveNamespace;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-spec",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-dev.24+f55f5eff",
|
|
4
4
|
"description": "Types and schema that specs of the Markup languages for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"schema": "run-s schema:*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@markuplint/ml-ast": "
|
|
25
|
+
"@markuplint/ml-ast": "3.0.0-rc.0",
|
|
26
26
|
"dom-accessibility-api": "^0.5.14",
|
|
27
|
-
"tslib": "^2.
|
|
27
|
+
"tslib": "^2.4.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@markuplint/test-tools": "3.0.0-
|
|
31
|
-
"@markuplint/types": "
|
|
32
|
-
"json-schema-to-typescript": "^
|
|
30
|
+
"@markuplint/test-tools": "3.0.0-rc.0",
|
|
31
|
+
"@markuplint/types": "3.0.0-dev.24+f55f5eff",
|
|
32
|
+
"json-schema-to-typescript": "^11.0.2"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f55f5eff289296feba26f20b0c085e0528c80ac4"
|
|
35
35
|
}
|
package/schema.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"type": "string"
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"AttributeCategory": {
|
|
21
21
|
"enum": ["aria", "eventhandler", "form", "global", "particular", "xml"],
|
|
22
22
|
"type": "string"
|
|
23
23
|
},
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"items": {
|
|
86
86
|
"properties": {
|
|
87
87
|
"category": {
|
|
88
|
-
"$ref": "#/definitions/
|
|
88
|
+
"$ref": "#/definitions/AttributeCategory"
|
|
89
89
|
},
|
|
90
90
|
"deprecated": {
|
|
91
91
|
"enum": [true],
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
{
|
|
163
163
|
"properties": {
|
|
164
164
|
"category": {
|
|
165
|
-
"$ref": "#/definitions/
|
|
165
|
+
"$ref": "#/definitions/AttributeCategory"
|
|
166
166
|
},
|
|
167
167
|
"deprecated": {
|
|
168
168
|
"enum": [true],
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"type": "array"
|
|
212
212
|
},
|
|
213
213
|
"categories": {
|
|
214
|
-
"description": "Element
|
|
214
|
+
"description": "Element categories",
|
|
215
215
|
"items": {
|
|
216
216
|
"anyOf": [
|
|
217
217
|
{
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
],
|
|
295
295
|
"description": "Obsolete or alternative elements"
|
|
296
296
|
},
|
|
297
|
-
"
|
|
297
|
+
"omission": {
|
|
298
298
|
"anyOf": [
|
|
299
299
|
{
|
|
300
300
|
"properties": {
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
"type": "boolean"
|
|
339
339
|
}
|
|
340
340
|
],
|
|
341
|
-
"description": "Tag
|
|
341
|
+
"description": "Tag omission"
|
|
342
342
|
},
|
|
343
343
|
"permittedContent": {
|
|
344
344
|
"description": "Permitted content",
|
package/schemas/aria.schema.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"contents": {
|
|
9
9
|
"oneOf": [
|
|
10
10
|
{
|
|
11
|
-
"
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": { "$ref": "#/definitions/PermittedContentPattern" }
|
|
12
13
|
},
|
|
13
14
|
{ "type": "boolean" }
|
|
14
15
|
]
|
|
@@ -27,7 +28,8 @@
|
|
|
27
28
|
"contents": {
|
|
28
29
|
"oneOf": [
|
|
29
30
|
{
|
|
30
|
-
"
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": { "$ref": "#/definitions/PermittedContentPattern" }
|
|
31
33
|
},
|
|
32
34
|
{ "type": "boolean" }
|
|
33
35
|
]
|
|
@@ -57,7 +59,6 @@
|
|
|
57
59
|
"#heading",
|
|
58
60
|
"#sectioning",
|
|
59
61
|
"#metadata",
|
|
60
|
-
"#transparent",
|
|
61
62
|
"#embedded",
|
|
62
63
|
"#palpable",
|
|
63
64
|
"#script-supporting",
|
|
@@ -79,11 +80,10 @@
|
|
|
79
80
|
"#SVGStructural",
|
|
80
81
|
"#SVGStructurallyExternal",
|
|
81
82
|
"#SVGTextContent",
|
|
82
|
-
"#SVGTextContentChild"
|
|
83
|
-
"#SVGOtherXMLNamespace"
|
|
83
|
+
"#SVGTextContentChild"
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
|
-
"
|
|
86
|
+
"Model": {
|
|
87
87
|
"oneOf": [
|
|
88
88
|
{ "$ref": "#/definitions/ContentType" },
|
|
89
89
|
{
|
|
@@ -93,11 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
|
-
"
|
|
97
|
-
"type": "array",
|
|
98
|
-
"items": { "$ref": "#/definitions/PermittedContent" }
|
|
99
|
-
},
|
|
100
|
-
"PermittedContent": {
|
|
96
|
+
"PermittedContentPattern": {
|
|
101
97
|
"type": "object",
|
|
102
98
|
"oneOf": [
|
|
103
99
|
{ "$ref": "#/definitions/PermittedContentRequire" },
|
|
@@ -105,7 +101,7 @@
|
|
|
105
101
|
{ "$ref": "#/definitions/PermittedContentOneOrMore" },
|
|
106
102
|
{ "$ref": "#/definitions/PermittedContentZeroOrMore" },
|
|
107
103
|
{ "$ref": "#/definitions/PermittedContentChoice" },
|
|
108
|
-
{ "$ref": "#/definitions/
|
|
104
|
+
{ "$ref": "#/definitions/PermittedContentTransparent" }
|
|
109
105
|
]
|
|
110
106
|
},
|
|
111
107
|
"PermittedContentRequire": {
|
|
@@ -113,13 +109,7 @@
|
|
|
113
109
|
"additionalProperties": false,
|
|
114
110
|
"required": ["require"],
|
|
115
111
|
"properties": {
|
|
116
|
-
"require": { "$ref": "#/definitions/
|
|
117
|
-
"ignore": { "$ref": "#/definitions/Target" },
|
|
118
|
-
"notAllowedDescendants": {
|
|
119
|
-
"type": "array",
|
|
120
|
-
"items": { "$ref": "#/definitions/ContentType" },
|
|
121
|
-
"uniqueItems": true
|
|
122
|
-
},
|
|
112
|
+
"require": { "$ref": "#/definitions/Model" },
|
|
123
113
|
"max": { "type": "number" },
|
|
124
114
|
"min": { "type": "number" },
|
|
125
115
|
"_TODO_": { "type": "string" }
|
|
@@ -130,13 +120,7 @@
|
|
|
130
120
|
"additionalProperties": false,
|
|
131
121
|
"required": ["optional"],
|
|
132
122
|
"properties": {
|
|
133
|
-
"optional": { "$ref": "#/definitions/
|
|
134
|
-
"ignore": { "$ref": "#/definitions/Target" },
|
|
135
|
-
"notAllowedDescendants": {
|
|
136
|
-
"type": "array",
|
|
137
|
-
"items": { "$ref": "#/definitions/ContentType" },
|
|
138
|
-
"uniqueItems": true
|
|
139
|
-
},
|
|
123
|
+
"optional": { "$ref": "#/definitions/Model" },
|
|
140
124
|
"max": { "type": "number" },
|
|
141
125
|
"_TODO_": { "type": "string" }
|
|
142
126
|
}
|
|
@@ -147,13 +131,13 @@
|
|
|
147
131
|
"required": ["oneOrMore"],
|
|
148
132
|
"properties": {
|
|
149
133
|
"oneOrMore": {
|
|
150
|
-
"oneOf": [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
134
|
+
"oneOf": [
|
|
135
|
+
{ "$ref": "#/definitions/Model" },
|
|
136
|
+
{
|
|
137
|
+
"type": "array",
|
|
138
|
+
"items": { "$ref": "#/definitions/PermittedContentPattern" }
|
|
139
|
+
}
|
|
140
|
+
]
|
|
157
141
|
},
|
|
158
142
|
"max": { "type": "number" },
|
|
159
143
|
"_TODO_": { "type": "string" }
|
|
@@ -165,13 +149,13 @@
|
|
|
165
149
|
"required": ["zeroOrMore"],
|
|
166
150
|
"properties": {
|
|
167
151
|
"zeroOrMore": {
|
|
168
|
-
"oneOf": [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
152
|
+
"oneOf": [
|
|
153
|
+
{ "$ref": "#/definitions/Model" },
|
|
154
|
+
{
|
|
155
|
+
"type": "array",
|
|
156
|
+
"items": { "$ref": "#/definitions/PermittedContentPattern" }
|
|
157
|
+
}
|
|
158
|
+
]
|
|
175
159
|
},
|
|
176
160
|
"max": { "type": "number" },
|
|
177
161
|
"_TODO_": { "type": "string" }
|
|
@@ -184,24 +168,24 @@
|
|
|
184
168
|
"properties": {
|
|
185
169
|
"choice": {
|
|
186
170
|
"type": "array",
|
|
187
|
-
"items": {
|
|
171
|
+
"items": {
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": { "$ref": "#/definitions/PermittedContentPattern" }
|
|
174
|
+
},
|
|
188
175
|
"minItems": 2,
|
|
189
176
|
"maxItems": 5
|
|
190
177
|
},
|
|
191
178
|
"_TODO_": { "type": "string" }
|
|
192
179
|
}
|
|
193
180
|
},
|
|
194
|
-
"
|
|
181
|
+
"PermittedContentTransparent": {
|
|
195
182
|
"type": "object",
|
|
196
183
|
"additionalProperties": false,
|
|
197
|
-
"required": ["
|
|
184
|
+
"required": ["transparent"],
|
|
198
185
|
"properties": {
|
|
199
|
-
"
|
|
200
|
-
"type": "
|
|
201
|
-
|
|
202
|
-
"minItems": 2
|
|
203
|
-
},
|
|
204
|
-
"_TODO_": { "type": "string" }
|
|
186
|
+
"transparent": {
|
|
187
|
+
"type": "string"
|
|
188
|
+
}
|
|
205
189
|
}
|
|
206
190
|
}
|
|
207
191
|
},
|