@markuplint/ml-config 4.4.0 → 4.5.1
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/types.d.ts +108 -12
- package/package.json +4 -4
package/lib/types.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export type ParserConfig = {
|
|
|
34
34
|
export type SpecConfig = {
|
|
35
35
|
readonly [extensionPattern: string]: string;
|
|
36
36
|
};
|
|
37
|
+
export type PretenderFileData = {
|
|
38
|
+
readonly version: string;
|
|
39
|
+
readonly data: readonly Pretender[];
|
|
40
|
+
};
|
|
37
41
|
export type Pretender = {
|
|
38
42
|
/**
|
|
39
43
|
* Target node selectors
|
|
@@ -47,12 +51,81 @@ export type Pretender = {
|
|
|
47
51
|
* If it is an Object, It creates the element by that.
|
|
48
52
|
*/
|
|
49
53
|
readonly as: string | OriginalNode;
|
|
54
|
+
/**
|
|
55
|
+
* If it is a string, it is resolved as an element name.
|
|
56
|
+
* An element regards as having the same attributes
|
|
57
|
+
* as the pretended custom element because these are inherited.
|
|
58
|
+
* If it is an Object, It can specify in detail the element's attributes.
|
|
59
|
+
*
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
readonly filePath?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Dynamic scaning
|
|
65
|
+
*
|
|
66
|
+
* @experimental
|
|
67
|
+
*/
|
|
68
|
+
readonly scan?: readonly PretenderScanConfig[];
|
|
50
69
|
};
|
|
51
70
|
export type OriginalNode = {
|
|
52
71
|
/**
|
|
53
72
|
* Element name
|
|
54
73
|
*/
|
|
55
74
|
readonly element: string;
|
|
75
|
+
/**
|
|
76
|
+
* It should specify slots if the component can define a slot element or children.
|
|
77
|
+
*
|
|
78
|
+
* For example, the following:
|
|
79
|
+
*
|
|
80
|
+
* ```jsx
|
|
81
|
+
* const Component = ({children}) => (
|
|
82
|
+
* <div>
|
|
83
|
+
* <h2>lorem ipsum</h2>
|
|
84
|
+
* <p>{children}</p>
|
|
85
|
+
* </div>
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* In the above case, the `p` element has the `children`,
|
|
90
|
+
* so it specifies the element to this field.
|
|
91
|
+
*
|
|
92
|
+
* Or:
|
|
93
|
+
*
|
|
94
|
+
* ```html
|
|
95
|
+
* <template>
|
|
96
|
+
* <h2>lorem ipsum</h2>
|
|
97
|
+
* <p><span slot="my-text">{children}</span></p>
|
|
98
|
+
* </template>
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* It notes that what needs to be specified
|
|
102
|
+
* in this field is not the element with the slot attribute
|
|
103
|
+
* but the element that wraps it.
|
|
104
|
+
*
|
|
105
|
+
* This field accepts an array
|
|
106
|
+
* because a component and a custom element can have multiple slots.
|
|
107
|
+
*
|
|
108
|
+
* If `null`,
|
|
109
|
+
* it means the component **doesn't accept children or doesn't have slots**.
|
|
110
|
+
*
|
|
111
|
+
* ```jsx
|
|
112
|
+
* const Component = (props) => (
|
|
113
|
+
* <img {...props} />
|
|
114
|
+
* );
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* If true, it means the component accepts children or has slots,
|
|
118
|
+
* and **the wrapper element and the outermost element are the same**.
|
|
119
|
+
*
|
|
120
|
+
* ```jsx
|
|
121
|
+
* const Component = ({children}) => (
|
|
122
|
+
* <button>{children}</button>
|
|
123
|
+
* );
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @experimental
|
|
127
|
+
*/
|
|
128
|
+
readonly slots?: null | true | readonly Slot[];
|
|
56
129
|
/**
|
|
57
130
|
* Namespace
|
|
58
131
|
*
|
|
@@ -63,18 +136,7 @@ export type OriginalNode = {
|
|
|
63
136
|
/**
|
|
64
137
|
* Attributes
|
|
65
138
|
*/
|
|
66
|
-
readonly attrs?: readonly
|
|
67
|
-
/**
|
|
68
|
-
* Attribute name
|
|
69
|
-
*/
|
|
70
|
-
readonly name: string;
|
|
71
|
-
/**
|
|
72
|
-
* If it omits this property, the attribute is resolved as a boolean.
|
|
73
|
-
*/
|
|
74
|
-
readonly value?: string | {
|
|
75
|
-
readonly fromAttr: string;
|
|
76
|
-
};
|
|
77
|
-
}[];
|
|
139
|
+
readonly attrs?: readonly PretenderAttr[];
|
|
78
140
|
/**
|
|
79
141
|
* To have attributes the defined element has.
|
|
80
142
|
*/
|
|
@@ -84,6 +146,22 @@ export type OriginalNode = {
|
|
|
84
146
|
*/
|
|
85
147
|
readonly aria?: PretenderARIA;
|
|
86
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* @experimental
|
|
151
|
+
*/
|
|
152
|
+
export type Slot = Omit<OriginalNode, 'slot'>;
|
|
153
|
+
export type PretenderAttr = {
|
|
154
|
+
/**
|
|
155
|
+
* Attribute name
|
|
156
|
+
*/
|
|
157
|
+
readonly name: string;
|
|
158
|
+
/**
|
|
159
|
+
* If it omits this property, the attribute is resolved as a boolean.
|
|
160
|
+
*/
|
|
161
|
+
readonly value?: string | {
|
|
162
|
+
readonly fromAttr: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
87
165
|
/**
|
|
88
166
|
* Pretender Node ARIA properties
|
|
89
167
|
*/
|
|
@@ -98,6 +176,24 @@ export type PretenderARIA = {
|
|
|
98
176
|
readonly fromAttr: string;
|
|
99
177
|
};
|
|
100
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* @experimental
|
|
181
|
+
*/
|
|
182
|
+
export type PretenderScanConfig = {
|
|
183
|
+
/**
|
|
184
|
+
* Supporting for Glob format
|
|
185
|
+
*/
|
|
186
|
+
readonly files: string;
|
|
187
|
+
readonly type: string;
|
|
188
|
+
readonly options: PretenderScanOptions;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* @experimental
|
|
192
|
+
*/
|
|
193
|
+
export interface PretenderScanOptions {
|
|
194
|
+
readonly cwd?: string;
|
|
195
|
+
readonly ignoreComponentNames?: readonly string[];
|
|
196
|
+
}
|
|
101
197
|
export type Rule<T extends RuleConfigValue, O extends PlainData = undefined> = RuleConfig<T, O> | Readonly<T> | boolean;
|
|
102
198
|
/**
|
|
103
199
|
* @deprecated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "JSON Schema and TypeScript types of markuplint configure JSON",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@markuplint/ml-ast": "4.2.0",
|
|
28
|
-
"@markuplint/selector": "4.
|
|
28
|
+
"@markuplint/selector": "4.5.1",
|
|
29
29
|
"@markuplint/shared": "4.2.0",
|
|
30
30
|
"@types/mustache": "4.2.5",
|
|
31
31
|
"deepmerge": "4.3.1",
|
|
32
32
|
"is-plain-object": "5.0.0",
|
|
33
33
|
"mustache": "4.2.0",
|
|
34
|
-
"type-fest": "4.
|
|
34
|
+
"type-fest": "4.15.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "b029c86a6b3a9ea8189d2e5535e3023aaea753fd"
|
|
37
37
|
}
|