@markuplint/ml-spec 2.0.0-rc.6 → 2.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.
@@ -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,71 +3,113 @@
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 = PermittedContentRequire | PermittedContentOptional | PermittedContentOneOrMore | PermittedContentZeroOrMore | PermittedContentChoice | PermittedContentInterleave;
6
+ export declare type PermittedContent =
7
+ | PermittedContentRequire
8
+ | PermittedContentOptional
9
+ | PermittedContentOneOrMore
10
+ | PermittedContentZeroOrMore
11
+ | PermittedContentChoice
12
+ | PermittedContentInterleave;
7
13
  export declare type Target = Node | Node[];
8
14
  export declare type Node = string | '#text' | ContentModel;
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';
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';
10
46
  export declare type PermittedContentSpec = PermittedContent[];
11
47
  export interface PermittedStructuresSchema {
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;
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;
30
68
  }
31
69
  export interface PermittedContentRequire {
32
- require: Target;
33
- ignore?: Target;
34
- notAllowedDescendants?: Node[];
35
- max?: number;
36
- min?: number;
37
- _TODO_?: string;
70
+ require: Target;
71
+ ignore?: Target;
72
+ notAllowedDescendants?: Node[];
73
+ max?: number;
74
+ min?: number;
75
+ _TODO_?: string;
38
76
  }
39
77
  export interface PermittedContentOptional {
40
- optional: Target;
41
- ignore?: Target;
42
- notAllowedDescendants?: Node[];
43
- max?: number;
44
- _TODO_?: string;
78
+ optional: Target;
79
+ ignore?: Target;
80
+ notAllowedDescendants?: Node[];
81
+ max?: number;
82
+ _TODO_?: string;
45
83
  }
46
84
  export interface PermittedContentOneOrMore {
47
- oneOrMore: Target | PermittedContentSpec;
48
- ignore?: Target;
49
- notAllowedDescendants?: Node[];
50
- max?: number;
51
- _TODO_?: string;
85
+ oneOrMore: Target | PermittedContentSpec;
86
+ ignore?: Target;
87
+ notAllowedDescendants?: Node[];
88
+ max?: number;
89
+ _TODO_?: string;
52
90
  }
53
91
  export interface PermittedContentZeroOrMore {
54
- zeroOrMore: Target | PermittedContentSpec;
55
- ignore?: Target;
56
- notAllowedDescendants?: Node[];
57
- max?: number;
58
- _TODO_?: string;
92
+ zeroOrMore: Target | PermittedContentSpec;
93
+ ignore?: Target;
94
+ notAllowedDescendants?: Node[];
95
+ max?: number;
96
+ _TODO_?: string;
59
97
  }
60
98
  export interface PermittedContentChoice {
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;
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;
69
111
  }
70
112
  export interface PermittedContentInterleave {
71
- interleave: [PermittedContentSpec, PermittedContentSpec, ...PermittedContentSpec[]];
72
- _TODO_?: string;
113
+ interleave: [PermittedContentSpec, PermittedContentSpec, ...PermittedContentSpec[]];
114
+ _TODO_?: string;
73
115
  }
package/lib/types.d.ts CHANGED
@@ -5,125 +5,127 @@ 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?: 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;
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;
127
129
  };
128
130
  /**
129
131
  * If `false`, this mean is "No corresponding role".
@@ -136,74 +138,85 @@ declare type ImplicitRole = string | false;
136
138
  export declare type PermittedRoles = string[] | boolean;
137
139
  declare type ElementSpecOmittion = false | ElementSpecOmittionTags;
138
140
  declare type ElementSpecOmittionTags = {
139
- startTag: boolean | ElementCondition;
140
- endTag: boolean | ElementCondition;
141
+ startTag: boolean | ElementCondition;
142
+ endTag: boolean | ElementCondition;
141
143
  };
142
144
  declare type ElementCondition = {
143
- __WIP__: 'WORK_IN_PROGRESS';
145
+ __WIP__: 'WORK_IN_PROGRESS';
144
146
  };
145
147
  export declare type Attribute = {
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;
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;
154
156
  } & ExtendableAttributeSpec;
155
157
  declare type ExtendableAttributeSpec = Omit<AttributeJSON, 'ref' | '_TODO_' | 'type'>;
156
158
  export declare type ARIRRoleAttribute = {
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;
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;
167
169
  };
168
170
  export declare type ARIARoleOwnedPropOrState = {
169
- name: string;
170
- inherited?: true;
171
- required?: true;
172
- deprecated?: true;
173
- prohibited?: true;
174
- defaultValue?: boolean | string | number;
171
+ name: string;
172
+ inherited?: true;
173
+ required?: true;
174
+ deprecated?: true;
175
+ prohibited?: true;
176
+ defaultValue?: boolean | string | number;
175
177
  };
176
178
  export declare type ARIAAttribute = {
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>;
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>;
190
192
  };
191
- export declare type ARIAAttributeValue = 'true/false' | 'tristate' | 'true/false/undefined' | 'ID reference' | 'ID reference list' | 'integer' | 'number' | 'string' | 'token' | 'token list' | 'URI';
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';
192
205
  export declare type EquivalentHtmlAttr = {
193
- htmlAttrName: string;
194
- isNotStrictEquivalent?: true;
195
- value: string | null;
206
+ htmlAttrName: string;
207
+ isNotStrictEquivalent?: true;
208
+ value: string | null;
196
209
  };
197
210
  export interface SpecOM {
198
- [tagName: string]: MLDOMElementSpec;
211
+ [tagName: string]: MLDOMElementSpec;
199
212
  }
200
213
  export interface MLDOMElementSpec {
201
- experimental: boolean;
202
- obsolete: boolean | string;
203
- deprecated: boolean;
204
- nonStandard: boolean;
205
- categories: ContentModel[];
206
- permittedStructures: PermittedStructuresSchema;
207
- attributes: Attribute[];
214
+ experimental: boolean;
215
+ obsolete: boolean | string;
216
+ deprecated: boolean;
217
+ nonStandard: boolean;
218
+ categories: ContentModel[];
219
+ permittedStructures: PermittedStructuresSchema;
220
+ attributes: Attribute[];
208
221
  }
209
222
  export {};
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- declare type NamedDefinition = string | {
2
- name: string;
3
- };
1
+ declare type NamedDefinition =
2
+ | string
3
+ | {
4
+ name: string;
5
+ };
4
6
  export declare function mergeArray<T extends NamedDefinition>(a: T[], b: T[] | null | undefined): T[];
5
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-spec",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.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>",
@@ -24,8 +24,8 @@
24
24
  "tslib": "^2.3.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@markuplint/types": "2.0.0-rc.6",
27
+ "@markuplint/types": "2.0.0",
28
28
  "json-schema-to-typescript": "^10.1.5"
29
29
  },
30
- "gitHead": "7c93367a86f935f6b94780b1fa14f3293f900b87"
30
+ "gitHead": "de81fc514acdf472f87184e3499e9364258f9b66"
31
31
  }