@markuplint/ml-spec 1.7.0 → 2.0.0-dev.20211213.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/attributes.d.ts +97 -0
- package/lib/attributes.js +8 -0
- package/lib/get-attr-specs.d.ts +7 -0
- package/lib/get-attr-specs.js +78 -0
- package/lib/get-ns.d.ts +1 -0
- package/lib/get-ns.js +17 -0
- package/lib/get-spec-by-tag-name.d.ts +2 -2
- package/lib/get-spec-by-tag-name.js +7 -6
- package/lib/get-spec.d.ts +3 -3
- package/lib/get-spec.js +30 -4
- package/lib/index.d.ts +3 -0
- package/lib/index.js +7 -4
- package/lib/permitted-structres.d.ts +13 -1
- package/lib/types.d.ts +26 -19
- package/lib/utils.js +4 -1
- package/package.json +9 -5
- package/schemas/attributes.schema.json +202 -74
- package/schemas/global-attributes.schema.json +741 -0
- package/schemas/permitted-structures.schema.json +53 -9
- package/src/attributes.ts +1418 -0
- package/src/get-attr-specs.spec.ts +44 -0
- package/src/get-attr-specs.ts +97 -0
- package/src/get-ns.ts +13 -0
- package/src/get-spec-by-tag-name.ts +9 -9
- package/src/get-spec.spec.ts +12 -16
- package/src/get-spec.ts +29 -4
- package/src/index.ts +3 -0
- package/src/permitted-structres.ts +33 -1
- package/src/types.ts +30 -57
- package/tsconfig.test.json +1 -6
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-spec",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-dev.20211213.0",
|
|
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>",
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"dev": "tsc --build --watch",
|
|
17
17
|
"clean": "tsc --build --clean",
|
|
18
|
-
"schema": "
|
|
18
|
+
"schema:gen": "ts-node ./gen/gen.ts; prettier --write './schemas/*.json';",
|
|
19
|
+
"schema:structures": "json2ts ./schemas/permitted-structures.schema.json > ./src/permitted-structres.ts; prettier --write ./src/permitted-structres.ts; eslint --fix --config ../../../.eslintrc ./src/permitted-structres.ts",
|
|
20
|
+
"schema:attributes": "json2ts ./schemas/attributes.schema.json --cwd ./schemas > ./src/attributes.ts; prettier --write ./src/attributes.ts; eslint --fix --config ../../../.eslintrc ./src/attributes.ts",
|
|
21
|
+
"schema": "yarn schema:gen; yarn schema:structures; yarn schema:attributes; tsc;"
|
|
19
22
|
},
|
|
20
23
|
"dependencies": {
|
|
21
|
-
"tslib": "^2.3.
|
|
24
|
+
"tslib": "^2.3.1"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"
|
|
27
|
+
"@markuplint/types": "1.0.0-dev.20211213.0",
|
|
28
|
+
"json-schema-to-typescript": "^10.1.5"
|
|
25
29
|
},
|
|
26
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "8f4682ca3e0937082af8c39b999443afa4a1aef3"
|
|
27
31
|
}
|
|
@@ -1,94 +1,222 @@
|
|
|
1
1
|
{
|
|
2
2
|
"definitions": {
|
|
3
|
-
"
|
|
3
|
+
"AttributeName": { "type": "string", "pattern": "^(?:(xml|xlink):)?[a-z][a-zA-Z0-9-]*$" },
|
|
4
|
+
"AttributeCondition": {
|
|
4
5
|
"oneOf": [
|
|
5
6
|
{
|
|
6
7
|
"type": "object",
|
|
7
8
|
"additionalProperties": false,
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
}
|
|
9
|
+
"required": ["ancestor"],
|
|
10
|
+
"properties": { "ancestor": { "$ref": "#/definitions/Selectors" } }
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"type": "object",
|
|
14
14
|
"additionalProperties": false,
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"type": ["string", "array"],
|
|
18
|
-
"items": { "type": "string", "minItems": 2 }
|
|
19
|
-
}
|
|
20
|
-
}
|
|
15
|
+
"required": ["self"],
|
|
16
|
+
"properties": { "self": { "$ref": "#/definitions/Selectors" } }
|
|
21
17
|
}
|
|
22
18
|
]
|
|
19
|
+
},
|
|
20
|
+
"Selectors": {
|
|
21
|
+
"oneOf": [{ "type": "string" }, { "type": "array", "minItems": 2, "items": { "type": "string" } }]
|
|
22
|
+
},
|
|
23
|
+
"AttributeType": { "$ref": "../../types/types.schema.json#/definitions/type" },
|
|
24
|
+
"AttributeJSON": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["ref"],
|
|
28
|
+
"minProperties": 2,
|
|
29
|
+
"properties": {
|
|
30
|
+
"_TODO_": { "type": "string" },
|
|
31
|
+
"ref": { "type": "string", "format": "uri" },
|
|
32
|
+
"type": {
|
|
33
|
+
"oneOf": [
|
|
34
|
+
{ "$ref": "#/definitions/AttributeType" },
|
|
35
|
+
{
|
|
36
|
+
"type": "array",
|
|
37
|
+
"minItems": 1,
|
|
38
|
+
"uniqueItems": true,
|
|
39
|
+
"items": { "$ref": "#/definitions/AttributeType" }
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"defaultValue": { "type": "string" },
|
|
44
|
+
"deprecated": { "type": "boolean" },
|
|
45
|
+
"required": { "oneOf": [{ "type": "boolean" }, { "$ref": "#/definitions/AttributeCondition" }] },
|
|
46
|
+
"requiredEither": { "type": "array", "items": { "type": "string" } },
|
|
47
|
+
"noUse": { "type": "boolean" },
|
|
48
|
+
"condition": { "$ref": "#/definitions/AttributeCondition" },
|
|
49
|
+
"ineffective": { "$ref": "#/definitions/Selectors" },
|
|
50
|
+
"animatable": { "type": "boolean" }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"GlobalAttributes": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"propertyNames": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"enum": [
|
|
59
|
+
"#HTMLGlobalAttrs",
|
|
60
|
+
"#GlobalEventAttrs",
|
|
61
|
+
"#DocumentElementEventAttrs",
|
|
62
|
+
"#HTMLLinkAndFetchingAttrs",
|
|
63
|
+
"#HTMLEmbededAndMediaContentAttrs",
|
|
64
|
+
"#HTMLFormControlElementAttrs",
|
|
65
|
+
"#HTMLTableCellElementAttrs",
|
|
66
|
+
"#ARIAAttrs",
|
|
67
|
+
"#SVGAnimationAdditionAttrs",
|
|
68
|
+
"#SVGAnimationAttributeTargetAttrs",
|
|
69
|
+
"#SVGAnimationEventAttrs",
|
|
70
|
+
"#SVGAnimationTargetElementAttrs",
|
|
71
|
+
"#SVGAnimationTimingAttrs",
|
|
72
|
+
"#SVGAnimationValueAttrs",
|
|
73
|
+
"#SVGConditionalProcessingAttrs",
|
|
74
|
+
"#SVGCoreAttrs",
|
|
75
|
+
"#SVGFilterPrimitiveAttrs",
|
|
76
|
+
"#SVGPresentationAttrs",
|
|
77
|
+
"#SVGTransferFunctionAttrs",
|
|
78
|
+
"#XLinkAttrs"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"properties": {
|
|
82
|
+
"#HTMLGlobalAttrs": { "type": "boolean" },
|
|
83
|
+
"#GlobalEventAttrs": {
|
|
84
|
+
"oneOf": [
|
|
85
|
+
{ "type": "boolean" },
|
|
86
|
+
{
|
|
87
|
+
"type": "array",
|
|
88
|
+
"minItems": 0,
|
|
89
|
+
"uniqueItems": true,
|
|
90
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/GlobalEventAttrs" }
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"#DocumentElementEventAttrs": {
|
|
95
|
+
"oneOf": [
|
|
96
|
+
{ "type": "boolean" },
|
|
97
|
+
{
|
|
98
|
+
"type": "array",
|
|
99
|
+
"minItems": 0,
|
|
100
|
+
"uniqueItems": true,
|
|
101
|
+
"items": {
|
|
102
|
+
"$ref": "./global-attributes.schema.json#/definitions/DocumentElementEventAttrs"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"#HTMLLinkAndFetchingAttrs": {
|
|
108
|
+
"type": "array",
|
|
109
|
+
"minItems": 0,
|
|
110
|
+
"uniqueItems": true,
|
|
111
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLLinkAndFetchingAttrs" }
|
|
112
|
+
},
|
|
113
|
+
"#HTMLEmbededAndMediaContentAttrs": {
|
|
114
|
+
"type": "array",
|
|
115
|
+
"minItems": 0,
|
|
116
|
+
"uniqueItems": true,
|
|
117
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLEmbededAndMediaContentAttrs" }
|
|
118
|
+
},
|
|
119
|
+
"#HTMLFormControlElementAttrs": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"minItems": 0,
|
|
122
|
+
"uniqueItems": true,
|
|
123
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLFormControlElementAttrs" }
|
|
124
|
+
},
|
|
125
|
+
"#HTMLTableCellElementAttrs": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"minItems": 0,
|
|
128
|
+
"uniqueItems": true,
|
|
129
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLTableCellElementAttrs" }
|
|
130
|
+
},
|
|
131
|
+
"#ARIAAttrs": { "type": "boolean" },
|
|
132
|
+
"#SVGAnimationAdditionAttrs": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"minItems": 0,
|
|
135
|
+
"uniqueItems": true,
|
|
136
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationAdditionAttrs" }
|
|
137
|
+
},
|
|
138
|
+
"#SVGAnimationAttributeTargetAttrs": {
|
|
139
|
+
"type": "array",
|
|
140
|
+
"minItems": 0,
|
|
141
|
+
"uniqueItems": true,
|
|
142
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationAttributeTargetAttrs" }
|
|
143
|
+
},
|
|
144
|
+
"#SVGAnimationEventAttrs": {
|
|
145
|
+
"type": "array",
|
|
146
|
+
"minItems": 0,
|
|
147
|
+
"uniqueItems": true,
|
|
148
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationEventAttrs" }
|
|
149
|
+
},
|
|
150
|
+
"#SVGAnimationTargetElementAttrs": {
|
|
151
|
+
"type": "array",
|
|
152
|
+
"minItems": 0,
|
|
153
|
+
"uniqueItems": true,
|
|
154
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationTargetElementAttrs" }
|
|
155
|
+
},
|
|
156
|
+
"#SVGAnimationTimingAttrs": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"minItems": 0,
|
|
159
|
+
"uniqueItems": true,
|
|
160
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationTimingAttrs" }
|
|
161
|
+
},
|
|
162
|
+
"#SVGAnimationValueAttrs": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"minItems": 0,
|
|
165
|
+
"uniqueItems": true,
|
|
166
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationValueAttrs" }
|
|
167
|
+
},
|
|
168
|
+
"#SVGConditionalProcessingAttrs": {
|
|
169
|
+
"type": "array",
|
|
170
|
+
"minItems": 0,
|
|
171
|
+
"uniqueItems": true,
|
|
172
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGConditionalProcessingAttrs" }
|
|
173
|
+
},
|
|
174
|
+
"#SVGCoreAttrs": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"minItems": 0,
|
|
177
|
+
"uniqueItems": true,
|
|
178
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGCoreAttrs" }
|
|
179
|
+
},
|
|
180
|
+
"#SVGFilterPrimitiveAttrs": {
|
|
181
|
+
"type": "array",
|
|
182
|
+
"minItems": 0,
|
|
183
|
+
"uniqueItems": true,
|
|
184
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGFilterPrimitiveAttrs" }
|
|
185
|
+
},
|
|
186
|
+
"#SVGPresentationAttrs": {
|
|
187
|
+
"type": "array",
|
|
188
|
+
"minItems": 0,
|
|
189
|
+
"uniqueItems": true,
|
|
190
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGPresentationAttrs" }
|
|
191
|
+
},
|
|
192
|
+
"#SVGTransferFunctionAttrs": {
|
|
193
|
+
"type": "array",
|
|
194
|
+
"minItems": 0,
|
|
195
|
+
"uniqueItems": true,
|
|
196
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/SVGTransferFunctionAttrs" }
|
|
197
|
+
},
|
|
198
|
+
"#XLinkAttrs": {
|
|
199
|
+
"type": "array",
|
|
200
|
+
"minItems": 0,
|
|
201
|
+
"uniqueItems": true,
|
|
202
|
+
"items": { "$ref": "./global-attributes.schema.json#/definitions/XLinkAttrs" }
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"Attributes": {
|
|
207
|
+
"type": "object",
|
|
208
|
+
"additionalProperties": false,
|
|
209
|
+
"propertyNames": { "$ref": "#/definitions/AttributeName" },
|
|
210
|
+
"patternProperties": { ".*": { "$ref": "#/definitions/AttributeJSON" } }
|
|
23
211
|
}
|
|
24
212
|
},
|
|
25
213
|
"type": "object",
|
|
26
214
|
"additionalProperties": false,
|
|
27
|
-
"required": ["tag", "attributes"],
|
|
215
|
+
"required": ["tag", "ref", "attributes"],
|
|
28
216
|
"properties": {
|
|
29
217
|
"tag": { "type": "string" },
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"type": "object",
|
|
34
|
-
"additionalProperties": false,
|
|
35
|
-
"required": ["name", "type"],
|
|
36
|
-
"properties": {
|
|
37
|
-
"name": { "type": "string" },
|
|
38
|
-
"type": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"enum": [
|
|
41
|
-
"String",
|
|
42
|
-
"NonEmptyString",
|
|
43
|
-
"Boolean",
|
|
44
|
-
"Function", // JavaScript function body
|
|
45
|
-
"Date",
|
|
46
|
-
"Int", // Integer
|
|
47
|
-
"Uint", // Non-negative integer
|
|
48
|
-
"Float", // Floating-point number
|
|
49
|
-
"NonZeroUint", // Non-negative integer greater than zero
|
|
50
|
-
"AcceptList", // https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
|
|
51
|
-
"AutoComplete", // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens
|
|
52
|
-
"BCP47", // https://tools.ietf.org/html/bcp47
|
|
53
|
-
"Color", // https://drafts.csswg.org/css-color/#typedef-color
|
|
54
|
-
"ColSpan", // https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-colspan
|
|
55
|
-
"Coords", // https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-coords
|
|
56
|
-
"DateTime", // https://html.spec.whatwg.org/multipage/text-level-semantics.html#datetime-value
|
|
57
|
-
"Destination", // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-as
|
|
58
|
-
"DOMID",
|
|
59
|
-
"DOMIDList",
|
|
60
|
-
"ItemType", // https://html.spec.whatwg.org/multipage/microdata.html#attr-itemtype
|
|
61
|
-
"LinkSizes", // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes
|
|
62
|
-
"LinkType", // https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
|
63
|
-
"LinkTypeList", // https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
|
64
|
-
"MediaQuery", // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-media-query-list
|
|
65
|
-
"MediaQueryList", // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-media-query-list
|
|
66
|
-
"MIMEType", // https://mimesniff.spec.whatwg.org/#valid-mime-type
|
|
67
|
-
"ReferrerPolicy", // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#referrer-policy-attribute
|
|
68
|
-
"RowSpan", // https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-rowspan
|
|
69
|
-
"SourceSizeList", // https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
|
|
70
|
-
"SrcSet", // https://html.spec.whatwg.org/multipage/images.html#srcset-attribute
|
|
71
|
-
"TabIndex", // https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex
|
|
72
|
-
"Target", // https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-target
|
|
73
|
-
"URL", // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#valid-url-potentially-surrounded-by-spaces
|
|
74
|
-
"URLHash", // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-hash-name-reference
|
|
75
|
-
"URLList" // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#valid-url-potentially-surrounded-by-spaces
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
"deprecated": { "type": "boolean" },
|
|
79
|
-
"required": {
|
|
80
|
-
"oneOf": [{ "type": "boolean" }, { "$ref": "#/definitions/condition" }]
|
|
81
|
-
},
|
|
82
|
-
"requiredEither": { "type": "array", "items": { "type": "string" } },
|
|
83
|
-
"enum": { "type": "array", "items": { "type": "string" }, "minLength": 1 },
|
|
84
|
-
"noUse": {
|
|
85
|
-
"type": "boolean"
|
|
86
|
-
},
|
|
87
|
-
"condition": {
|
|
88
|
-
"$ref": "#/definitions/condition"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
218
|
+
"ref": { "type": "string", "format": "uri" },
|
|
219
|
+
"global": { "$ref": "#/definitions/GlobalAttributes" },
|
|
220
|
+
"attributes": { "$ref": "#/definitions/Attributes" }
|
|
93
221
|
}
|
|
94
222
|
}
|