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