@markuplint/ml-spec 3.0.0-dev.25 → 3.0.0-dev.38

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.
Files changed (58) hide show
  1. package/lib/dom-traverse/is-exposed.js +8 -0
  2. package/package.json +4 -4
  3. package/schemas/aria.schema.json +0 -258
  4. package/schemas/attributes.schema.json +0 -204
  5. package/schemas/content-models.schema.json +0 -199
  6. package/schemas/element.schema.json +0 -11
  7. package/schemas/global-attributes.schema.json +0 -761
  8. package/src/dom-traverse/accname-computation.spec.ts +0 -69
  9. package/src/dom-traverse/accname-computation.ts +0 -5
  10. package/src/dom-traverse/get-attr-specs.ts +0 -8
  11. package/src/dom-traverse/get-computed-aria-props.spec.ts +0 -368
  12. package/src/dom-traverse/get-computed-aria-props.ts +0 -130
  13. package/src/dom-traverse/get-computed-role.spec.ts +0 -134
  14. package/src/dom-traverse/get-computed-role.ts +0 -181
  15. package/src/dom-traverse/get-content-model.ts +0 -32
  16. package/src/dom-traverse/get-explicit-role.ts +0 -112
  17. package/src/dom-traverse/get-implicit-role.ts +0 -36
  18. package/src/dom-traverse/get-non-presentational-ancestor.ts +0 -20
  19. package/src/dom-traverse/get-permitted-roles.ts +0 -7
  20. package/src/dom-traverse/get-spec.ts +0 -7
  21. package/src/dom-traverse/has-required-owned-elements.spec.ts +0 -36
  22. package/src/dom-traverse/has-required-owned-elements.ts +0 -85
  23. package/src/dom-traverse/is-exposed.spec.ts +0 -50
  24. package/src/dom-traverse/is-exposed.ts +0 -196
  25. package/src/dom-traverse/may-be-focusable.ts +0 -21
  26. package/src/index.ts +0 -24
  27. package/src/specs/aria-specs.ts +0 -6
  28. package/src/specs/content-model-category-to-tag-names.ts +0 -15
  29. package/src/specs/get-aria.ts +0 -85
  30. package/src/specs/get-attr-specs.spec.ts +0 -47
  31. package/src/specs/get-attr-specs.ts +0 -116
  32. package/src/specs/get-implicit-role.spec.ts +0 -81
  33. package/src/specs/get-implicit-role.ts +0 -17
  34. package/src/specs/get-permitted-roles.spec.ts +0 -420
  35. package/src/specs/get-permitted-roles.ts +0 -87
  36. package/src/specs/get-role-spec.spec.ts +0 -67
  37. package/src/specs/get-role-spec.ts +0 -72
  38. package/src/specs/get-selectors-by-content-model-category.ts +0 -10
  39. package/src/specs/get-spec-by-tag-name.spec.ts +0 -68
  40. package/src/specs/get-spec-by-tag-name.ts +0 -20
  41. package/src/specs/is-nothing-content-model.ts +0 -9
  42. package/src/specs/is-palpable-elements.ts +0 -55
  43. package/src/specs/is-presentational.ts +0 -6
  44. package/src/specs/is-void-element.ts +0 -22
  45. package/src/specs/resolve-version.ts +0 -20
  46. package/src/specs/schema-to-spec.spec.ts +0 -39
  47. package/src/specs/schema-to-spec.ts +0 -103
  48. package/src/types/aria.ts +0 -153
  49. package/src/types/attributes.ts +0 -1524
  50. package/src/types/index.ts +0 -255
  51. package/src/types/permitted-structres.ts +0 -100
  52. package/src/types/permitted-structures.ts +0 -96
  53. package/src/utils/get-ns.ts +0 -18
  54. package/src/utils/merge-array.ts +0 -35
  55. package/src/utils/resolve-namespace.spec.ts +0 -37
  56. package/src/utils/resolve-namespace.ts +0 -40
  57. package/tsconfig.test.json +0 -3
  58. package/tsconfig.tsbuildinfo +0 -1
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isExposed = void 0;
4
4
  const aria_specs_1 = require("../specs/aria-specs");
5
+ const get_spec_by_tag_name_1 = require("../specs/get-spec-by-tag-name");
5
6
  const is_palpable_elements_1 = require("../specs/is-palpable-elements");
6
7
  const is_presentational_1 = require("../specs/is-presentational");
8
+ const resolve_namespace_1 = require("../utils/resolve-namespace");
7
9
  const get_computed_role_1 = require("./get-computed-role");
8
10
  /**
9
11
  * Detect including/excluding from the Accessibility Tree
@@ -19,6 +21,12 @@ function isExposed(el, specs, version) {
19
21
  if (isExcluding(el, specs, version)) {
20
22
  return false;
21
23
  }
24
+ // Return true if the element is unknown, deprecated, or obsolete.
25
+ const { localName, namespace } = (0, resolve_namespace_1.resolveNamespace)(el.localName, el.namespaceURI);
26
+ const spec = (0, get_spec_by_tag_name_1.getSpecByTagName)(specs.specs, localName, namespace);
27
+ if (!spec || spec.deprecated || spec.obsolete) {
28
+ return true;
29
+ }
22
30
  // According to HTML and SVG Specs with **the author's interpretation**
23
31
  {
24
32
  if (!(0, is_palpable_elements_1.isPalpableElement)(el, specs, { extendsSvg: true, extendsExposableElements: true })) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-spec",
3
- "version": "3.0.0-dev.25+a27e39aa",
3
+ "version": "3.0.0-dev.38+b959e06f",
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": "3.0.0-rc.0",
25
+ "@markuplint/ml-ast": "3.0.0-dev.38+b959e06f",
26
26
  "dom-accessibility-api": "^0.5.14",
27
27
  "tslib": "^2.4.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@markuplint/test-tools": "3.0.0-rc.0",
31
- "@markuplint/types": "3.0.0-dev.25+a27e39aa",
31
+ "@markuplint/types": "3.0.0-dev.38+b959e06f",
32
32
  "json-schema-to-typescript": "^11.0.2"
33
33
  },
34
- "gitHead": "a27e39aa4362bce572d1893df2f1571705b62df1"
34
+ "gitHead": "b959e06f4838b3e6798c990427e22422efe8e699"
35
35
  }
@@ -1,258 +0,0 @@
1
- {
2
- "definitions": {
3
- "PermittedRoles": {
4
- "description": "If `true`, this mean is \"Any\". If `false`, this mean is \"No\".",
5
- "oneOf": [
6
- {
7
- "type": "boolean"
8
- },
9
- {
10
- "type": "array",
11
- "items": {
12
- "oneOf": [
13
- {
14
- "type": "string"
15
- },
16
- {
17
- "type": "object",
18
- "required": ["name"],
19
- "minProperties": 2,
20
- "properties": {
21
- "name": { "type": "string" },
22
- "deprecated": { "type": "boolean", "enum": [true] }
23
- }
24
- }
25
- ]
26
- }
27
- },
28
- {
29
- "type": "object",
30
- "minProperties": 1,
31
- "additionalProperties": false,
32
- "properties": {
33
- "core-aam": {
34
- "type": "boolean",
35
- "enum": [true]
36
- },
37
- "graphics-aam": {
38
- "type": "boolean",
39
- "enum": [true]
40
- }
41
- }
42
- }
43
- ]
44
- },
45
- "PermittedARIAProperties": {
46
- "description": "If set false:\n> No role or aria-* attributes",
47
- "oneOf": [
48
- {
49
- "type": "boolean",
50
- "enum": [false]
51
- },
52
- {
53
- "type": "object",
54
- "minProperties": 1,
55
- "additionalProperties": false,
56
- "properties": {
57
- "global": {
58
- "type": "boolean",
59
- "enum": [true]
60
- },
61
- "role": {
62
- "description": "Set true if the spec says \"and any aria-* attributes applicable to the allowed roles.\"",
63
- "oneOf": [
64
- {
65
- "type": "boolean",
66
- "enum": [true]
67
- },
68
- {
69
- "type": "string"
70
- },
71
- {
72
- "type": "array",
73
- "minItems": 1,
74
- "items": { "type": "string" }
75
- }
76
- ]
77
- },
78
- "only": {
79
- "type": "array",
80
- "minItems": 1,
81
- "items": {
82
- "oneOf": [
83
- {
84
- "type": "string",
85
- "pattern": "^aria-.+"
86
- },
87
- {
88
- "type": "object",
89
- "required": ["name"],
90
- "additionalProperties": false,
91
- "properties": {
92
- "name": {
93
- "type": "string",
94
- "pattern": "^aria-.+"
95
- },
96
- "value": {
97
- "type": "string"
98
- }
99
- }
100
- }
101
- ]
102
- }
103
- },
104
- "without": {
105
- "type": "array",
106
- "minItems": 1,
107
- "items": {
108
- "type": "object",
109
- "required": ["type", "name"],
110
- "additionalProperties": false,
111
- "properties": {
112
- "type": {
113
- "type": "string",
114
- "enum": ["not-recommended", "should-not", "must-not"]
115
- },
116
- "name": {
117
- "type": "string",
118
- "pattern": "^aria-.+"
119
- },
120
- "value": {
121
- "type": "string"
122
- },
123
- "alt": {
124
- "type": "object",
125
- "required": ["method", "target"],
126
- "additionalProperties": false,
127
- "properties": {
128
- "method": {
129
- "type": "string",
130
- "enum": ["remove-attr", "set-attr"]
131
- },
132
- "target": {
133
- "type": "string"
134
- }
135
- }
136
- }
137
- }
138
- }
139
- }
140
- }
141
- }
142
- ]
143
- },
144
- "ImplicitRole": {
145
- "description": "If `false`, this mean is \"No corresponding role\".",
146
- "oneOf": [
147
- {
148
- "type": "boolean",
149
- "enum": [false]
150
- },
151
- {
152
- "type": "string"
153
- }
154
- ]
155
- },
156
- "ImplicitProperties": {
157
- "type": "object",
158
- "minProperties": 1,
159
- "patternProperties": {
160
- "^aria-.+": {
161
- "type": "string"
162
- }
163
- }
164
- },
165
- "ARIA": {
166
- "type": "object",
167
- "additionalProperties": false,
168
- "required": ["implicitRole", "permittedRoles"],
169
- "properties": {
170
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
171
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
172
- "namingProhibited": { "type": "boolean", "enum": [true] },
173
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
174
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" },
175
- "conditions": {
176
- "type": "object",
177
- "minProperties": 1,
178
- "patternProperties": {
179
- ".+": {
180
- "type": "object",
181
- "minProperties": 1,
182
- "additionalProperties": false,
183
- "properties": {
184
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
185
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
186
- "namingProhibited": { "type": "boolean", "enum": [true] },
187
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
188
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" }
189
- }
190
- }
191
- }
192
- },
193
- "1.2": {
194
- "type": "object",
195
- "additionalProperties": false,
196
- "minProperties": 1,
197
- "properties": {
198
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
199
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
200
- "namingProhibited": { "type": "boolean", "enum": [true] },
201
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
202
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" },
203
- "conditions": {
204
- "type": "object",
205
- "minProperties": 1,
206
- "patternProperties": {
207
- ".+": {
208
- "type": "object",
209
- "minProperties": 1,
210
- "additionalProperties": false,
211
- "properties": {
212
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
213
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
214
- "namingProhibited": { "type": "boolean", "enum": [true] },
215
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
216
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" }
217
- }
218
- }
219
- }
220
- }
221
- }
222
- },
223
- "1.1": {
224
- "type": "object",
225
- "additionalProperties": false,
226
- "minProperties": 1,
227
- "properties": {
228
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
229
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
230
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
231
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" },
232
- "conditions": {
233
- "type": "object",
234
- "minProperties": 1,
235
- "patternProperties": {
236
- ".+": {
237
- "type": "object",
238
- "minProperties": 1,
239
- "additionalProperties": false,
240
- "properties": {
241
- "implicitRole": { "$ref": "#/definitions/ImplicitRole" },
242
- "permittedRoles": { "$ref": "#/definitions/PermittedRoles" },
243
- "implicitProperties": { "$ref": "#/definitions/ImplicitProperties" },
244
- "properties": { "$ref": "#/definitions/PermittedARIAProperties" }
245
- }
246
- }
247
- }
248
- }
249
- }
250
- }
251
- }
252
- }
253
- },
254
- "type": "object",
255
- "properties": {
256
- "_": { "$ref": "#/definitions/ARIA" }
257
- }
258
- }
@@ -1,204 +0,0 @@
1
- {
2
- "definitions": {
3
- "AttributeName": { "type": "string", "pattern": "^(?:(xml|xlink):)?[a-z][a-zA-Z0-9-]*$" },
4
- "AttributeCondition": { "$ref": "#/definitions/Selectors" },
5
- "Selectors": {
6
- "oneOf": [{ "type": "string" }, { "type": "array", "minItems": 2, "items": { "type": "string" } }]
7
- },
8
- "AttributeType": { "$ref": "../../types/types.schema.json#/definitions/type" },
9
- "AttributeJSON": {
10
- "type": "object",
11
- "additionalProperties": false,
12
- "minProperties": 1,
13
- "properties": {
14
- "type": {
15
- "oneOf": [
16
- { "$ref": "#/definitions/AttributeType" },
17
- {
18
- "type": "array",
19
- "minItems": 1,
20
- "uniqueItems": true,
21
- "items": { "$ref": "#/definitions/AttributeType" }
22
- }
23
- ]
24
- },
25
- "defaultValue": { "type": "string" },
26
- "deprecated": { "type": "boolean" },
27
- "required": { "oneOf": [{ "type": "boolean" }, { "$ref": "#/definitions/AttributeCondition" }] },
28
- "requiredEither": { "type": "array", "items": { "type": "string" } },
29
- "noUse": { "type": "boolean" },
30
- "condition": { "$ref": "#/definitions/AttributeCondition" },
31
- "ineffective": { "$ref": "#/definitions/Selectors" },
32
- "animatable": { "type": "boolean" },
33
- "experimental": { "type": "boolean" }
34
- }
35
- },
36
- "GlobalAttributes": {
37
- "type": "object",
38
- "additionalProperties": false,
39
- "propertyNames": {
40
- "type": "string",
41
- "enum": [
42
- "#HTMLGlobalAttrs",
43
- "#GlobalEventAttrs",
44
- "#DocumentElementEventAttrs",
45
- "#HTMLLinkAndFetchingAttrs",
46
- "#HTMLEmbededAndMediaContentAttrs",
47
- "#HTMLFormControlElementAttrs",
48
- "#HTMLTableCellElementAttrs",
49
- "#ARIAAttrs",
50
- "#SVGAnimationAdditionAttrs",
51
- "#SVGAnimationAttributeTargetAttrs",
52
- "#SVGAnimationEventAttrs",
53
- "#SVGAnimationTargetElementAttrs",
54
- "#SVGAnimationTimingAttrs",
55
- "#SVGAnimationValueAttrs",
56
- "#SVGConditionalProcessingAttrs",
57
- "#SVGCoreAttrs",
58
- "#SVGFilterPrimitiveAttrs",
59
- "#SVGPresentationAttrs",
60
- "#SVGTransferFunctionAttrs",
61
- "#XLinkAttrs"
62
- ]
63
- },
64
- "properties": {
65
- "#HTMLGlobalAttrs": { "type": "boolean" },
66
- "#GlobalEventAttrs": {
67
- "oneOf": [
68
- { "type": "boolean" },
69
- {
70
- "type": "array",
71
- "minItems": 0,
72
- "uniqueItems": true,
73
- "items": { "$ref": "./global-attributes.schema.json#/definitions/GlobalEventAttrs" }
74
- }
75
- ]
76
- },
77
- "#DocumentElementEventAttrs": {
78
- "oneOf": [
79
- { "type": "boolean" },
80
- {
81
- "type": "array",
82
- "minItems": 0,
83
- "uniqueItems": true,
84
- "items": {
85
- "$ref": "./global-attributes.schema.json#/definitions/DocumentElementEventAttrs"
86
- }
87
- }
88
- ]
89
- },
90
- "#HTMLLinkAndFetchingAttrs": {
91
- "type": "array",
92
- "minItems": 0,
93
- "uniqueItems": true,
94
- "items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLLinkAndFetchingAttrs" }
95
- },
96
- "#HTMLEmbededAndMediaContentAttrs": {
97
- "type": "array",
98
- "minItems": 0,
99
- "uniqueItems": true,
100
- "items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLEmbededAndMediaContentAttrs" }
101
- },
102
- "#HTMLFormControlElementAttrs": {
103
- "type": "array",
104
- "minItems": 0,
105
- "uniqueItems": true,
106
- "items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLFormControlElementAttrs" }
107
- },
108
- "#HTMLTableCellElementAttrs": {
109
- "type": "array",
110
- "minItems": 0,
111
- "uniqueItems": true,
112
- "items": { "$ref": "./global-attributes.schema.json#/definitions/HTMLTableCellElementAttrs" }
113
- },
114
- "#ARIAAttrs": { "type": "boolean" },
115
- "#SVGAnimationAdditionAttrs": {
116
- "type": "array",
117
- "minItems": 0,
118
- "uniqueItems": true,
119
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationAdditionAttrs" }
120
- },
121
- "#SVGAnimationAttributeTargetAttrs": {
122
- "type": "array",
123
- "minItems": 0,
124
- "uniqueItems": true,
125
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationAttributeTargetAttrs" }
126
- },
127
- "#SVGAnimationEventAttrs": {
128
- "type": "array",
129
- "minItems": 0,
130
- "uniqueItems": true,
131
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationEventAttrs" }
132
- },
133
- "#SVGAnimationTargetElementAttrs": {
134
- "type": "array",
135
- "minItems": 0,
136
- "uniqueItems": true,
137
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationTargetElementAttrs" }
138
- },
139
- "#SVGAnimationTimingAttrs": {
140
- "type": "array",
141
- "minItems": 0,
142
- "uniqueItems": true,
143
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationTimingAttrs" }
144
- },
145
- "#SVGAnimationValueAttrs": {
146
- "type": "array",
147
- "minItems": 0,
148
- "uniqueItems": true,
149
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGAnimationValueAttrs" }
150
- },
151
- "#SVGConditionalProcessingAttrs": {
152
- "type": "array",
153
- "minItems": 0,
154
- "uniqueItems": true,
155
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGConditionalProcessingAttrs" }
156
- },
157
- "#SVGCoreAttrs": {
158
- "type": "array",
159
- "minItems": 0,
160
- "uniqueItems": true,
161
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGCoreAttrs" }
162
- },
163
- "#SVGFilterPrimitiveAttrs": {
164
- "type": "array",
165
- "minItems": 0,
166
- "uniqueItems": true,
167
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGFilterPrimitiveAttrs" }
168
- },
169
- "#SVGPresentationAttrs": {
170
- "type": "array",
171
- "minItems": 0,
172
- "uniqueItems": true,
173
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGPresentationAttrs" }
174
- },
175
- "#SVGTransferFunctionAttrs": {
176
- "type": "array",
177
- "minItems": 0,
178
- "uniqueItems": true,
179
- "items": { "$ref": "./global-attributes.schema.json#/definitions/SVGTransferFunctionAttrs" }
180
- },
181
- "#XLinkAttrs": {
182
- "type": "array",
183
- "minItems": 0,
184
- "uniqueItems": true,
185
- "items": { "$ref": "./global-attributes.schema.json#/definitions/XLinkAttrs" }
186
- }
187
- }
188
- },
189
- "Attributes": {
190
- "type": "object",
191
- "additionalProperties": false,
192
- "propertyNames": { "$ref": "#/definitions/AttributeName" },
193
- "patternProperties": { ".*": { "$ref": "#/definitions/AttributeJSON" } }
194
- }
195
- },
196
- "type": "object",
197
- "additionalProperties": false,
198
- "required": ["tag", "attributes"],
199
- "properties": {
200
- "tag": { "type": "string" },
201
- "global": { "$ref": "#/definitions/GlobalAttributes" },
202
- "attributes": { "$ref": "#/definitions/Attributes" }
203
- }
204
- }