@markuplint/ml-spec 2.0.0 → 2.0.2

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.
@@ -1,7 +1,7 @@
1
1
  import type { MLMLSpec, Attribute } from './types';
2
2
  export declare function getAttrSpecs(nameWithNS: string, schema: MLMLSpec): Attribute[] | null;
3
3
  declare type HasName = {
4
- name: string;
4
+ name: string;
5
5
  };
6
6
  export declare function nameCompare(a: HasName | string, b: HasName | string): 1 | -1 | 0;
7
7
  export {};
package/lib/get-ns.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function getNS(namespaceURI: string): 'svg' | 'mml' | 'html';
1
+ export declare function getNS(namespaceURI: string): "svg" | "mml" | "html";
package/lib/get-spec.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { ElementSpec, ExtendedSpec, MLMLSpec } from './types';
7
7
  * @param schemas `MLDocument.schemas`
8
8
  */
9
9
  export declare function getSpec(schemas: readonly [MLMLSpec, ...ExtendedSpec[]]): {
10
- cites: import('./types').Cites;
11
- def: import('./types').SpecDefs;
12
- specs: ElementSpec[];
10
+ cites: import("./types").Cites;
11
+ def: import("./types").SpecDefs;
12
+ specs: ElementSpec[];
13
13
  };
@@ -3,113 +3,71 @@
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 declare type PermittedContent =
7
- | PermittedContentRequire
8
- | PermittedContentOptional
9
- | PermittedContentOneOrMore
10
- | PermittedContentZeroOrMore
11
- | PermittedContentChoice
12
- | PermittedContentInterleave;
6
+ export declare type PermittedContent = PermittedContentRequire | PermittedContentOptional | PermittedContentOneOrMore | PermittedContentZeroOrMore | PermittedContentChoice | PermittedContentInterleave;
13
7
  export declare type Target = Node | Node[];
14
8
  export declare type Node = string | '#text' | ContentModel;
15
- export declare type ContentModel =
16
- | '#phrasing'
17
- | '#flow'
18
- | '#interactive'
19
- | '#heading'
20
- | '#sectioning'
21
- | '#metadata'
22
- | '#transparent'
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'
45
- | '#SVGOtherXMLNamespace';
9
+ export declare type ContentModel = '#phrasing' | '#flow' | '#interactive' | '#heading' | '#sectioning' | '#metadata' | '#transparent' | '#embedded' | '#palpable' | '#script-supporting' | '#SVGAnimation' | '#SVGBasicShapes' | '#SVGContainer' | '#SVGDescriptive' | '#SVGFilterPrimitive' | '#SVGFont' | '#SVGGradient' | '#SVGGraphics' | '#SVGGraphicsReferencing' | '#SVGLightSource' | '#SVGNeverRendered' | '#SVGNone' | '#SVGPaintServer' | '#SVGRenderable' | '#SVGShape' | '#SVGStructural' | '#SVGStructurallyExternal' | '#SVGTextContent' | '#SVGTextContentChild' | '#SVGOtherXMLNamespace';
46
10
  export declare type PermittedContentSpec = PermittedContent[];
47
11
  export interface PermittedStructuresSchema {
48
- summary?: string;
49
- tag: string;
50
- conditional?: {
51
- condition:
52
- | {
53
- hasAttr: string;
54
- }
55
- | {
56
- parent: string;
57
- /**
58
- * Not support yet
59
- */
60
- hasNotAttr?: string;
61
- _TODO_?: string;
62
- _parent?: string;
63
- };
64
- contents: PermittedContentSpec | boolean;
65
- }[];
66
- contents: PermittedContentSpec | boolean;
67
- ancestor?: Node;
12
+ summary?: string;
13
+ tag: string;
14
+ conditional?: {
15
+ condition: {
16
+ hasAttr: string;
17
+ } | {
18
+ parent: string;
19
+ /**
20
+ * Not support yet
21
+ */
22
+ hasNotAttr?: string;
23
+ _TODO_?: string;
24
+ _parent?: string;
25
+ };
26
+ contents: PermittedContentSpec | boolean;
27
+ }[];
28
+ contents: PermittedContentSpec | boolean;
29
+ ancestor?: Node;
68
30
  }
69
31
  export interface PermittedContentRequire {
70
- require: Target;
71
- ignore?: Target;
72
- notAllowedDescendants?: Node[];
73
- max?: number;
74
- min?: number;
75
- _TODO_?: string;
32
+ require: Target;
33
+ ignore?: Target;
34
+ notAllowedDescendants?: Node[];
35
+ max?: number;
36
+ min?: number;
37
+ _TODO_?: string;
76
38
  }
77
39
  export interface PermittedContentOptional {
78
- optional: Target;
79
- ignore?: Target;
80
- notAllowedDescendants?: Node[];
81
- max?: number;
82
- _TODO_?: string;
40
+ optional: Target;
41
+ ignore?: Target;
42
+ notAllowedDescendants?: Node[];
43
+ max?: number;
44
+ _TODO_?: string;
83
45
  }
84
46
  export interface PermittedContentOneOrMore {
85
- oneOrMore: Target | PermittedContentSpec;
86
- ignore?: Target;
87
- notAllowedDescendants?: Node[];
88
- max?: number;
89
- _TODO_?: string;
47
+ oneOrMore: Target | PermittedContentSpec;
48
+ ignore?: Target;
49
+ notAllowedDescendants?: Node[];
50
+ max?: number;
51
+ _TODO_?: string;
90
52
  }
91
53
  export interface PermittedContentZeroOrMore {
92
- zeroOrMore: Target | PermittedContentSpec;
93
- ignore?: Target;
94
- notAllowedDescendants?: Node[];
95
- max?: number;
96
- _TODO_?: string;
54
+ zeroOrMore: Target | PermittedContentSpec;
55
+ ignore?: Target;
56
+ notAllowedDescendants?: Node[];
57
+ max?: number;
58
+ _TODO_?: string;
97
59
  }
98
60
  export interface PermittedContentChoice {
99
- choice:
100
- | [PermittedContentSpec, PermittedContentSpec]
101
- | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec]
102
- | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec, PermittedContentSpec]
103
- | [
104
- PermittedContentSpec,
105
- PermittedContentSpec,
106
- PermittedContentSpec,
107
- PermittedContentSpec,
108
- PermittedContentSpec,
109
- ];
110
- _TODO_?: string;
61
+ choice: [PermittedContentSpec, PermittedContentSpec] | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec] | [PermittedContentSpec, PermittedContentSpec, PermittedContentSpec, PermittedContentSpec] | [
62
+ PermittedContentSpec,
63
+ PermittedContentSpec,
64
+ PermittedContentSpec,
65
+ PermittedContentSpec,
66
+ PermittedContentSpec
67
+ ];
68
+ _TODO_?: string;
111
69
  }
112
70
  export interface PermittedContentInterleave {
113
- interleave: [PermittedContentSpec, PermittedContentSpec, ...PermittedContentSpec[]];
114
- _TODO_?: string;
71
+ interleave: [PermittedContentSpec, PermittedContentSpec, ...PermittedContentSpec[]];
72
+ _TODO_?: string;
115
73
  }
package/lib/types.d.ts CHANGED
@@ -5,127 +5,125 @@ import type { ContentModel, PermittedStructuresSchema } from './permitted-struct
5
5
  * markuplit Markup-language spec
6
6
  */
7
7
  export interface MLMLSpec {
8
- cites: Cites;
9
- def: SpecDefs;
10
- specs: ElementSpec[];
8
+ cites: Cites;
9
+ def: SpecDefs;
10
+ specs: ElementSpec[];
11
11
  }
12
12
  export declare type ExtendedElementSpec = Partial<Omit<ElementSpec, 'name' | 'attributes'>> & {
13
- name: ElementSpec['name'];
14
- attributes?: Record<string, Partial<Attribute>>;
13
+ name: ElementSpec['name'];
14
+ attributes?: Record<string, Partial<Attribute>>;
15
15
  };
16
16
  export declare type ExtendedSpec = {
17
- cites?: Cites;
18
- def?: Partial<SpecDefs>;
19
- specs?: ExtendedElementSpec[];
17
+ cites?: Cites;
18
+ def?: Partial<SpecDefs>;
19
+ specs?: ExtendedElementSpec[];
20
20
  };
21
21
  /**
22
22
  * Reference URLs
23
23
  */
24
24
  export declare type Cites = string[];
25
25
  export declare type SpecDefs = {
26
- '#globalAttrs': Partial<{
27
- '#extends': Record<string, Partial<Attribute>>;
28
- '#HTMLGlobalAttrs': Record<string, Partial<Attribute>>;
29
- [OtherGlobalAttrs: string]: Record<string, Partial<Attribute>>;
30
- }>;
31
- '#ariaAttrs': ARIAAttribute[];
32
- '#roles': ARIRRoleAttribute[];
33
- '#contentModels': {
34
- [model in ContentModel]?: string[];
35
- };
26
+ '#globalAttrs': Partial<{
27
+ '#extends': Record<string, Partial<Attribute>>;
28
+ '#HTMLGlobalAttrs': Record<string, Partial<Attribute>>;
29
+ [OtherGlobalAttrs: string]: Record<string, Partial<Attribute>>;
30
+ }>;
31
+ '#ariaAttrs': ARIAAttribute[];
32
+ '#roles': ARIRRoleAttribute[];
33
+ '#contentModels': {
34
+ [model in ContentModel]?: string[];
35
+ };
36
36
  };
37
37
  /**
38
38
  * Element spec
39
39
  */
40
40
  export declare type ElementSpec = {
41
- /**
42
- * Tag name
43
- */
44
- name: string;
45
- /**
46
- * Namespaces in XML
47
- * @see https://www.w3.org/TR/xml-names/
48
- */
49
- namespace?: 'http://www.w3.org/1999/xhtml' | 'http://www.w3.org/2000/svg' | 'http://www.w3.org/1998/Math/MathML';
50
- /**
51
- * Reference URL
52
- */
53
- cite: string;
54
- /**
55
- * Description
56
- */
57
- description?: string;
58
- /**
59
- * Experimental technology
60
- */
61
- experimental?: true;
62
- /**
63
- * Obsolete or alternative elements
64
- */
65
- obsolete?:
66
- | true
67
- | {
68
- alt: string;
69
- };
70
- /**
71
- * Deprecated
72
- */
73
- deprecated?: true;
74
- /**
75
- * Non-standard
76
- */
77
- nonStandard?: true;
78
- /**
79
- * Element cateogries
80
- */
81
- categories: ContentModel[];
82
- /**
83
- * Permitted contents and permitted parents
84
- */
85
- permittedStructures: PermittedStructuresSchema;
86
- /**
87
- * Permitted ARIA roles
88
- */
89
- permittedRoles: {
90
- summary: string;
91
- roles: PermittedRoles;
92
- conditions?: {
93
- condition: string;
94
- roles: PermittedRoles;
95
- }[];
96
- };
97
- /**
98
- * Implicit ARIA role
99
- */
100
- implicitRole: {
101
- summary: string;
102
- role: ImplicitRole;
103
- conditions?: {
104
- condition: string;
105
- role: ImplicitRole;
106
- }[];
107
- };
108
- /**
109
- * Tag omittion
110
- */
111
- omittion: ElementSpecOmittion;
112
- /**
113
- * Global Attributes
114
- */
115
- globalAttrs: GlobalAttributes;
116
- /**
117
- * Attributes
118
- */
119
- attributes: Record<string, Attribute>;
120
- /**
121
- * If true, it is possible to add any properties as attributes,
122
- * for example, when using a template engine or a view language.
123
- *
124
- * @see https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots
125
- *
126
- * **It assumes to specify it on the parser plugin.**
127
- */
128
- possibleToAddProperties?: true;
41
+ /**
42
+ * Tag name
43
+ */
44
+ name: string;
45
+ /**
46
+ * Namespaces in XML
47
+ * @see https://www.w3.org/TR/xml-names/
48
+ */
49
+ namespace?: 'http://www.w3.org/1999/xhtml' | 'http://www.w3.org/2000/svg' | 'http://www.w3.org/1998/Math/MathML';
50
+ /**
51
+ * Reference URL
52
+ */
53
+ cite: string;
54
+ /**
55
+ * Description
56
+ */
57
+ description?: string;
58
+ /**
59
+ * Experimental technology
60
+ */
61
+ experimental?: true;
62
+ /**
63
+ * Obsolete or alternative elements
64
+ */
65
+ obsolete?: true | {
66
+ alt: string;
67
+ };
68
+ /**
69
+ * Deprecated
70
+ */
71
+ deprecated?: true;
72
+ /**
73
+ * Non-standard
74
+ */
75
+ nonStandard?: true;
76
+ /**
77
+ * Element cateogries
78
+ */
79
+ categories: ContentModel[];
80
+ /**
81
+ * Permitted contents and permitted parents
82
+ */
83
+ permittedStructures: PermittedStructuresSchema;
84
+ /**
85
+ * Permitted ARIA roles
86
+ */
87
+ permittedRoles: {
88
+ summary: string;
89
+ roles: PermittedRoles;
90
+ conditions?: {
91
+ condition: string;
92
+ roles: PermittedRoles;
93
+ }[];
94
+ };
95
+ /**
96
+ * Implicit ARIA role
97
+ */
98
+ implicitRole: {
99
+ summary: string;
100
+ role: ImplicitRole;
101
+ conditions?: {
102
+ condition: string;
103
+ role: ImplicitRole;
104
+ }[];
105
+ };
106
+ /**
107
+ * Tag omittion
108
+ */
109
+ omittion: ElementSpecOmittion;
110
+ /**
111
+ * Global Attributes
112
+ */
113
+ globalAttrs: GlobalAttributes;
114
+ /**
115
+ * Attributes
116
+ */
117
+ attributes: Record<string, Attribute>;
118
+ /**
119
+ * If true, it is possible to add any properties as attributes,
120
+ * for example, when using a template engine or a view language.
121
+ *
122
+ * @see https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots
123
+ *
124
+ * **It assumes to specify it on the parser plugin.**
125
+ */
126
+ possibleToAddProperties?: true;
129
127
  };
130
128
  /**
131
129
  * If `false`, this mean is "No corresponding role".
@@ -138,85 +136,74 @@ declare type ImplicitRole = string | false;
138
136
  export declare type PermittedRoles = string[] | boolean;
139
137
  declare type ElementSpecOmittion = false | ElementSpecOmittionTags;
140
138
  declare type ElementSpecOmittionTags = {
141
- startTag: boolean | ElementCondition;
142
- endTag: boolean | ElementCondition;
139
+ startTag: boolean | ElementCondition;
140
+ endTag: boolean | ElementCondition;
143
141
  };
144
142
  declare type ElementCondition = {
145
- __WIP__: 'WORK_IN_PROGRESS';
143
+ __WIP__: 'WORK_IN_PROGRESS';
146
144
  };
147
145
  export declare type Attribute = {
148
- name: string;
149
- type: AttributeType | AttributeType[];
150
- description?: string;
151
- caseSensitive?: true;
152
- experimental?: true;
153
- obsolete?: true;
154
- deprecated?: boolean;
155
- nonStandard?: true;
146
+ name: string;
147
+ type: AttributeType | AttributeType[];
148
+ description?: string;
149
+ caseSensitive?: true;
150
+ experimental?: true;
151
+ obsolete?: true;
152
+ deprecated?: boolean;
153
+ nonStandard?: true;
156
154
  } & ExtendableAttributeSpec;
157
155
  declare type ExtendableAttributeSpec = Omit<AttributeJSON, 'ref' | '_TODO_' | 'type'>;
158
156
  export declare type ARIRRoleAttribute = {
159
- name: string;
160
- description: string;
161
- isAbstract?: true;
162
- generalization: string[];
163
- requiredContextRole?: string[];
164
- accessibleNameRequired: boolean;
165
- accessibleNameFromContent: boolean;
166
- accessibleNameProhibited: boolean;
167
- ownedAttribute: ARIARoleOwnedPropOrState[];
168
- childrenPresentational?: boolean;
157
+ name: string;
158
+ description: string;
159
+ isAbstract?: true;
160
+ generalization: string[];
161
+ requiredContextRole?: string[];
162
+ accessibleNameRequired: boolean;
163
+ accessibleNameFromContent: boolean;
164
+ accessibleNameProhibited: boolean;
165
+ ownedAttribute: ARIARoleOwnedPropOrState[];
166
+ childrenPresentational?: boolean;
169
167
  };
170
168
  export declare type ARIARoleOwnedPropOrState = {
171
- name: string;
172
- inherited?: true;
173
- required?: true;
174
- deprecated?: true;
175
- prohibited?: true;
176
- defaultValue?: boolean | string | number;
169
+ name: string;
170
+ inherited?: true;
171
+ required?: true;
172
+ deprecated?: true;
173
+ prohibited?: true;
174
+ defaultValue?: boolean | string | number;
177
175
  };
178
176
  export declare type ARIAAttribute = {
179
- name: string;
180
- type: 'property' | 'state';
181
- deprecated?: true;
182
- isGlobal?: true;
183
- value: ARIAAttributeValue;
184
- conditionalValue?: {
185
- role: string[];
186
- value: ARIAAttributeValue;
187
- }[];
188
- enum: string[];
189
- defaultValue?: string;
190
- equivalentHtmlAttrs?: EquivalentHtmlAttr[];
191
- valueDescriptions?: Record<string, string>;
177
+ name: string;
178
+ type: 'property' | 'state';
179
+ deprecated?: true;
180
+ isGlobal?: true;
181
+ value: ARIAAttributeValue;
182
+ conditionalValue?: {
183
+ role: string[];
184
+ value: ARIAAttributeValue;
185
+ }[];
186
+ enum: string[];
187
+ defaultValue?: string;
188
+ equivalentHtmlAttrs?: EquivalentHtmlAttr[];
189
+ valueDescriptions?: Record<string, string>;
192
190
  };
193
- export declare type ARIAAttributeValue =
194
- | 'true/false'
195
- | 'tristate'
196
- | 'true/false/undefined'
197
- | 'ID reference'
198
- | 'ID reference list'
199
- | 'integer'
200
- | 'number'
201
- | 'string'
202
- | 'token'
203
- | 'token list'
204
- | 'URI';
191
+ export declare type ARIAAttributeValue = 'true/false' | 'tristate' | 'true/false/undefined' | 'ID reference' | 'ID reference list' | 'integer' | 'number' | 'string' | 'token' | 'token list' | 'URI';
205
192
  export declare type EquivalentHtmlAttr = {
206
- htmlAttrName: string;
207
- isNotStrictEquivalent?: true;
208
- value: string | null;
193
+ htmlAttrName: string;
194
+ isNotStrictEquivalent?: true;
195
+ value: string | null;
209
196
  };
210
197
  export interface SpecOM {
211
- [tagName: string]: MLDOMElementSpec;
198
+ [tagName: string]: MLDOMElementSpec;
212
199
  }
213
200
  export interface MLDOMElementSpec {
214
- experimental: boolean;
215
- obsolete: boolean | string;
216
- deprecated: boolean;
217
- nonStandard: boolean;
218
- categories: ContentModel[];
219
- permittedStructures: PermittedStructuresSchema;
220
- attributes: Attribute[];
201
+ experimental: boolean;
202
+ obsolete: boolean | string;
203
+ deprecated: boolean;
204
+ nonStandard: boolean;
205
+ categories: ContentModel[];
206
+ permittedStructures: PermittedStructuresSchema;
207
+ attributes: Attribute[];
221
208
  }
222
209
  export {};
package/lib/utils.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- declare type NamedDefinition =
2
- | string
3
- | {
4
- name: string;
5
- };
1
+ declare 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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-spec",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
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>",
@@ -24,8 +24,8 @@
24
24
  "tslib": "^2.3.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@markuplint/types": "2.0.0",
27
+ "@markuplint/types": "2.0.1-dev.20220307.0",
28
28
  "json-schema-to-typescript": "^10.1.5"
29
29
  },
30
- "gitHead": "de81fc514acdf472f87184e3499e9364258f9b66"
30
+ "gitHead": "76939e9a8278829f1871a117f8c0cbc9777db7c2"
31
31
  }
@@ -36,6 +36,7 @@
36
36
  "draggable",
37
37
  "enterkeyhint",
38
38
  "hidden",
39
+ "inert",
39
40
  "inputmode",
40
41
  "is",
41
42
  "itemid",
@@ -64,6 +65,7 @@
64
65
  "onabort",
65
66
  "onauxclick",
66
67
  "onbeforeinput",
68
+ "onbeforematch",
67
69
  "onblur",
68
70
  "oncancel",
69
71
  "oncanplay",
@@ -366,6 +368,7 @@
366
368
  "draggable",
367
369
  "enterkeyhint",
368
370
  "hidden",
371
+ "inert",
369
372
  "inputmode",
370
373
  "is",
371
374
  "itemid",
@@ -397,6 +400,7 @@
397
400
  "onabort",
398
401
  "onauxclick",
399
402
  "onbeforeinput",
403
+ "onbeforematch",
400
404
  "onblur",
401
405
  "oncancel",
402
406
  "oncanplay",
package/src/attributes.ts CHANGED
@@ -1141,6 +1141,7 @@ export interface GlobalAttributes {
1141
1141
  | 'onabort'
1142
1142
  | 'onauxclick'
1143
1143
  | 'onbeforeinput'
1144
+ | 'onbeforematch'
1144
1145
  | 'onblur'
1145
1146
  | 'oncancel'
1146
1147
  | 'oncanplay'