@powerlines/plugin-alloy 0.25.33 → 0.25.35
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/README.md +1 -1
- package/dist/core/components/output.cjs +17 -10
- package/dist/core/components/output.mjs +17 -10
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +6 -4
- package/dist/core/components/single-line-comment.mjs +6 -4
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +10 -6
- package/dist/core/components/source-file.mjs +10 -6
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -4
- package/dist/core/components/spacing.mjs +6 -4
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/index.cjs +13 -18
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -17
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -7
- package/dist/markdown/components/front-matter.mjs +9 -7
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +76 -44
- package/dist/markdown/components/markdown-file.mjs +76 -44
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +49 -28
- package/dist/markdown/components/markdown-table.mjs +49 -28
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +3 -3
- package/dist/render.mjs +4 -4
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.cjs +29 -19
- package/dist/typescript/components/builtin-file.mjs +30 -20
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +165 -100
- package/dist/typescript/components/class-declaration.mjs +165 -100
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +9 -6
- package/dist/typescript/components/entry-file.mjs +10 -7
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/infrastructure-file.cjs +9 -6
- package/dist/typescript/components/infrastructure-file.mjs +10 -7
- package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +121 -70
- package/dist/typescript/components/interface-declaration.mjs +121 -70
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +76 -44
- package/dist/typescript/components/object-declaration.mjs +76 -44
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +225 -104
- package/dist/typescript/components/tsdoc-reflection.mjs +225 -104
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +255 -160
- package/dist/typescript/components/tsdoc.mjs +255 -160
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +20 -15
- package/dist/typescript/components/type-declaration.mjs +20 -15
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +55 -29
- package/dist/typescript/components/type-parameters.mjs +55 -29
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +145 -80
- package/dist/typescript/components/typescript-file.mjs +145 -80
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +92 -47
- package/dist/yaml/components/yaml-file.mjs +92 -47
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +16 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
2
|
import { Spacing } from "../../core/components/spacing.mjs";
|
|
3
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
4
|
import { For, List, Prose, Show, childrenArray, computed, splitProps } from "@alloy-js/core";
|
|
4
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
|
|
6
6
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
7
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -12,57 +12,83 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
12
12
|
*/
|
|
13
13
|
function TSDoc(props) {
|
|
14
14
|
const [{ children, heading }] = splitProps(props, ["children", "heading"]);
|
|
15
|
-
return
|
|
15
|
+
return [
|
|
16
16
|
"/**",
|
|
17
|
-
|
|
17
|
+
createIntrinsic("align", {
|
|
18
18
|
string: " * ",
|
|
19
|
-
children
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
get children() {
|
|
20
|
+
return [
|
|
21
|
+
createIntrinsic("hbr", {}),
|
|
22
|
+
createComponent(Show, {
|
|
23
|
+
get when() {
|
|
24
|
+
return !isUndefined(heading);
|
|
25
|
+
},
|
|
26
|
+
children: heading
|
|
27
|
+
}),
|
|
28
|
+
createComponent(Show, {
|
|
29
|
+
get when() {
|
|
30
|
+
return memo(() => !!!isUndefined(children))() && childrenArray(() => children).filter(Boolean).length > 0;
|
|
31
|
+
},
|
|
32
|
+
get children() {
|
|
33
|
+
return [createComponent(Show, {
|
|
34
|
+
get when() {
|
|
35
|
+
return !isUndefined(heading);
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return createComponent(Spacing, {});
|
|
39
|
+
}
|
|
40
|
+
}), createComponent(List, { get children() {
|
|
41
|
+
return childrenArray(() => children);
|
|
42
|
+
} })];
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
];
|
|
46
|
+
}
|
|
33
47
|
}),
|
|
34
|
-
|
|
48
|
+
createIntrinsic("hbr", {}),
|
|
35
49
|
`*/`,
|
|
36
|
-
|
|
37
|
-
]
|
|
50
|
+
createIntrinsic("hbr", {})
|
|
51
|
+
];
|
|
38
52
|
}
|
|
39
53
|
/**
|
|
40
54
|
* Create a TSDoc `@<props.tag>` tag.
|
|
41
55
|
*/
|
|
42
56
|
function TSDocTag(props) {
|
|
43
57
|
const [{ children, tag }] = splitProps(props, ["children", "tag"]);
|
|
44
|
-
return
|
|
58
|
+
return [
|
|
45
59
|
`@${tag} `,
|
|
46
|
-
|
|
47
|
-
when
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
createComponent(Show, {
|
|
61
|
+
get when() {
|
|
62
|
+
return Boolean(children);
|
|
63
|
+
},
|
|
64
|
+
get children() {
|
|
65
|
+
return createIntrinsic("align", {
|
|
66
|
+
width: 2,
|
|
67
|
+
get children() {
|
|
68
|
+
return createComponent(Prose, { children });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
52
72
|
}),
|
|
53
|
-
|
|
54
|
-
]
|
|
73
|
+
createIntrinsic("sbr", {})
|
|
74
|
+
];
|
|
55
75
|
}
|
|
56
76
|
/**
|
|
57
77
|
* A component that creates a TSDoc block with `@param` tags for each parameter.
|
|
58
78
|
*/
|
|
59
79
|
function TSDocParams(props) {
|
|
60
|
-
return
|
|
80
|
+
return createComponent(For, {
|
|
61
81
|
each: normalizeParametersForDoc(props.parameters),
|
|
62
|
-
children: (param) =>
|
|
63
|
-
name
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
children: (param) => createComponent(TSDocParam, {
|
|
83
|
+
get name() {
|
|
84
|
+
return param.name;
|
|
85
|
+
},
|
|
86
|
+
get optional() {
|
|
87
|
+
return param.optional;
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return param.doc;
|
|
91
|
+
}
|
|
66
92
|
})
|
|
67
93
|
});
|
|
68
94
|
}
|
|
@@ -75,79 +101,82 @@ function normalizeParametersForDoc(parameters) {
|
|
|
75
101
|
*/
|
|
76
102
|
function TSDocTitle(props) {
|
|
77
103
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
78
|
-
return
|
|
79
|
-
...rest,
|
|
104
|
+
return createComponent(TSDocTag, mergeProps(rest, {
|
|
80
105
|
tag: "title",
|
|
81
106
|
children
|
|
82
|
-
});
|
|
107
|
+
}));
|
|
83
108
|
}
|
|
84
109
|
/**
|
|
85
110
|
* Create a TSDoc `@domain` tag.
|
|
86
111
|
*/
|
|
87
112
|
function TSDocDomain(props) {
|
|
88
113
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
89
|
-
return
|
|
90
|
-
...rest,
|
|
114
|
+
return createComponent(TSDocTag, mergeProps(rest, {
|
|
91
115
|
tag: "domain",
|
|
92
116
|
children
|
|
93
|
-
});
|
|
117
|
+
}));
|
|
94
118
|
}
|
|
95
119
|
/**
|
|
96
120
|
* Create a TSDoc `@alias` tag.
|
|
97
121
|
*/
|
|
98
122
|
function TSDocAlias(props) {
|
|
99
123
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
100
|
-
return
|
|
101
|
-
...rest,
|
|
124
|
+
return createComponent(TSDocTag, mergeProps(rest, {
|
|
102
125
|
tag: "alias",
|
|
103
126
|
children
|
|
104
|
-
});
|
|
127
|
+
}));
|
|
105
128
|
}
|
|
106
129
|
/**
|
|
107
130
|
* Create a TSDoc `@permission` tag.
|
|
108
131
|
*/
|
|
109
132
|
function TSDocPermission(props) {
|
|
110
133
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
111
|
-
return
|
|
112
|
-
...rest,
|
|
134
|
+
return createComponent(TSDocTag, mergeProps(rest, {
|
|
113
135
|
tag: "permission",
|
|
114
136
|
children
|
|
115
|
-
});
|
|
137
|
+
}));
|
|
116
138
|
}
|
|
117
139
|
/**
|
|
118
140
|
* Create a TSDoc `@defaultValue` tag.
|
|
119
141
|
*/
|
|
120
142
|
function TSDocDefaultValue(props) {
|
|
121
143
|
const [{ type, defaultValue }] = splitProps(props, ["type", "defaultValue"]);
|
|
122
|
-
return
|
|
123
|
-
when
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
144
|
+
return ["@defaultValue ", createComponent(Show, {
|
|
145
|
+
get when() {
|
|
146
|
+
return !isUndefined(defaultValue);
|
|
147
|
+
},
|
|
148
|
+
get children() {
|
|
149
|
+
return createIntrinsic("align", {
|
|
150
|
+
width: 2,
|
|
151
|
+
get children() {
|
|
152
|
+
return createComponent(Prose, { get children() {
|
|
153
|
+
return stringifyDefaultValue(type, defaultValue);
|
|
154
|
+
} });
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
})];
|
|
129
159
|
}
|
|
130
160
|
/**
|
|
131
161
|
* Create a TSDoc `@remarks` tag.
|
|
132
162
|
*/
|
|
133
163
|
function TSDocRemarks(props) {
|
|
134
|
-
return
|
|
164
|
+
return [
|
|
135
165
|
"@remarks ",
|
|
136
|
-
|
|
137
|
-
|
|
166
|
+
createIntrinsic("hbr", {}),
|
|
167
|
+
createComponent(List, {
|
|
138
168
|
hardline: true,
|
|
139
|
-
children
|
|
169
|
+
get children() {
|
|
170
|
+
return childrenArray(() => props.children);
|
|
171
|
+
}
|
|
140
172
|
})
|
|
141
|
-
]
|
|
173
|
+
];
|
|
142
174
|
}
|
|
143
175
|
/**
|
|
144
176
|
* Create a TSDoc `@see` tag.
|
|
145
177
|
*/
|
|
146
178
|
function TSDocLink(props) {
|
|
147
|
-
return
|
|
148
|
-
...props,
|
|
149
|
-
tag: "see"
|
|
150
|
-
});
|
|
179
|
+
return createComponent(TSDocTag, mergeProps(props, { tag: "see" }));
|
|
151
180
|
}
|
|
152
181
|
/**
|
|
153
182
|
* Create a TSDoc `@example` tag.
|
|
@@ -159,47 +188,51 @@ function TSDocExample(props) {
|
|
|
159
188
|
"language",
|
|
160
189
|
"children"
|
|
161
190
|
]);
|
|
162
|
-
return
|
|
191
|
+
return [
|
|
163
192
|
"@example ",
|
|
164
|
-
|
|
165
|
-
|
|
193
|
+
createIntrinsic("hbr", {}),
|
|
194
|
+
createComponent(Show, {
|
|
166
195
|
when: fenced,
|
|
167
|
-
children
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
196
|
+
get children() {
|
|
197
|
+
return [
|
|
198
|
+
"```",
|
|
199
|
+
language || (tsx ? "tsx" : "ts"),
|
|
200
|
+
createIntrinsic("hbr", {})
|
|
201
|
+
];
|
|
202
|
+
}
|
|
172
203
|
}),
|
|
173
204
|
children,
|
|
174
|
-
|
|
205
|
+
createComponent(Show, {
|
|
175
206
|
when: fenced,
|
|
176
|
-
children
|
|
207
|
+
get children() {
|
|
208
|
+
return [createIntrinsic("hbr", {}), "```"];
|
|
209
|
+
}
|
|
177
210
|
})
|
|
178
|
-
]
|
|
211
|
+
];
|
|
179
212
|
}
|
|
180
213
|
/**
|
|
181
214
|
* Create a TSDoc `@readonly` tag.
|
|
182
215
|
*/
|
|
183
216
|
function TSDocReadonly() {
|
|
184
|
-
return
|
|
217
|
+
return createComponent(TSDocTag, { tag: "readonly" });
|
|
185
218
|
}
|
|
186
219
|
/**
|
|
187
220
|
* Create a TSDoc `@internal` tag.
|
|
188
221
|
*/
|
|
189
222
|
function TSDocInternal() {
|
|
190
|
-
return
|
|
223
|
+
return createComponent(TSDocTag, { tag: "internal" });
|
|
191
224
|
}
|
|
192
225
|
/**
|
|
193
226
|
* Create a TSDoc `@ignore` tag.
|
|
194
227
|
*/
|
|
195
228
|
function TSDocIgnore() {
|
|
196
|
-
return
|
|
229
|
+
return createComponent(TSDocTag, { tag: "ignore" });
|
|
197
230
|
}
|
|
198
231
|
/**
|
|
199
232
|
* Create a TSDoc `@hidden` tag.
|
|
200
233
|
*/
|
|
201
234
|
function TSDocHidden() {
|
|
202
|
-
return
|
|
235
|
+
return createComponent(TSDocTag, { tag: "hidden" });
|
|
203
236
|
}
|
|
204
237
|
/**
|
|
205
238
|
* Generates a TypeScript interface property for the given reflection class.
|
|
@@ -217,111 +250,165 @@ function TSDocAttributesTags(props) {
|
|
|
217
250
|
]);
|
|
218
251
|
const title = computed(() => props.title?.trim() || "");
|
|
219
252
|
const domain = computed(() => props.domain?.trim() || "");
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
when
|
|
223
|
-
|
|
253
|
+
return [
|
|
254
|
+
createComponent(Show, {
|
|
255
|
+
get when() {
|
|
256
|
+
return isSetString(title.value);
|
|
257
|
+
},
|
|
258
|
+
get children() {
|
|
259
|
+
return createComponent(TSDocTitle, { get children() {
|
|
260
|
+
return title.value;
|
|
261
|
+
} });
|
|
262
|
+
}
|
|
224
263
|
}),
|
|
225
|
-
|
|
226
|
-
when
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
264
|
+
createComponent(Show, {
|
|
265
|
+
get when() {
|
|
266
|
+
return memo(() => !!(!isUndefined(alias) && alias.length > 0))() && alias.some((a) => isSetString(a?.trim()));
|
|
267
|
+
},
|
|
268
|
+
get children() {
|
|
269
|
+
return createComponent(For, {
|
|
270
|
+
get each() {
|
|
271
|
+
return alias?.filter((a) => isSetString(a?.trim())) ?? [];
|
|
272
|
+
},
|
|
273
|
+
children: (alias) => createComponent(TSDocAlias, { children: alias })
|
|
274
|
+
});
|
|
275
|
+
}
|
|
231
276
|
}),
|
|
232
|
-
|
|
233
|
-
when
|
|
234
|
-
|
|
277
|
+
createComponent(Show, {
|
|
278
|
+
get when() {
|
|
279
|
+
return isSetString(domain.value);
|
|
280
|
+
},
|
|
281
|
+
get children() {
|
|
282
|
+
return createComponent(TSDocDomain, { get children() {
|
|
283
|
+
return domain.value;
|
|
284
|
+
} });
|
|
285
|
+
}
|
|
235
286
|
}),
|
|
236
|
-
|
|
237
|
-
when
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
287
|
+
createComponent(Show, {
|
|
288
|
+
get when() {
|
|
289
|
+
return memo(() => !!(!isUndefined(permission) && permission.length > 0))() && permission.some((p) => isSetString(p?.trim()));
|
|
290
|
+
},
|
|
291
|
+
get children() {
|
|
292
|
+
return createComponent(For, {
|
|
293
|
+
get each() {
|
|
294
|
+
return permission?.filter((p) => isSetString(p?.trim())) ?? [];
|
|
295
|
+
},
|
|
296
|
+
children: (permission) => createComponent(TSDocPermission, { children: permission })
|
|
297
|
+
});
|
|
298
|
+
}
|
|
242
299
|
}),
|
|
243
|
-
|
|
300
|
+
createComponent(Show, {
|
|
244
301
|
when: readonly === true,
|
|
245
|
-
children
|
|
302
|
+
get children() {
|
|
303
|
+
return createComponent(TSDocReadonly, {});
|
|
304
|
+
}
|
|
246
305
|
}),
|
|
247
|
-
|
|
306
|
+
createComponent(Show, {
|
|
248
307
|
when: internal === true,
|
|
249
|
-
children
|
|
308
|
+
get children() {
|
|
309
|
+
return createComponent(TSDocInternal, {});
|
|
310
|
+
}
|
|
250
311
|
}),
|
|
251
|
-
|
|
312
|
+
createComponent(Show, {
|
|
252
313
|
when: ignore === true,
|
|
253
|
-
children
|
|
314
|
+
get children() {
|
|
315
|
+
return createComponent(TSDocIgnore, {});
|
|
316
|
+
}
|
|
254
317
|
}),
|
|
255
|
-
|
|
318
|
+
createComponent(Show, {
|
|
256
319
|
when: hidden === true,
|
|
257
|
-
children
|
|
320
|
+
get children() {
|
|
321
|
+
return createComponent(TSDocHidden, {});
|
|
322
|
+
}
|
|
258
323
|
}),
|
|
259
|
-
|
|
260
|
-
when
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
324
|
+
createComponent(Show, {
|
|
325
|
+
get when() {
|
|
326
|
+
return memo(() => !!!isUndefined(type))() && !isUndefined(defaultValue);
|
|
327
|
+
},
|
|
328
|
+
get children() {
|
|
329
|
+
return createComponent(TSDocDefaultValue, {
|
|
330
|
+
type,
|
|
331
|
+
defaultValue
|
|
332
|
+
});
|
|
333
|
+
}
|
|
265
334
|
})
|
|
266
|
-
]
|
|
335
|
+
];
|
|
267
336
|
}
|
|
268
337
|
/**
|
|
269
338
|
* Create a TSDoc parameter set off with `@param`.
|
|
270
339
|
*/
|
|
271
340
|
function TSDocParam(props) {
|
|
272
|
-
return
|
|
341
|
+
return [
|
|
273
342
|
"@param ",
|
|
274
|
-
|
|
275
|
-
name
|
|
276
|
-
|
|
277
|
-
|
|
343
|
+
createComponent(TSDocParamName, {
|
|
344
|
+
get name() {
|
|
345
|
+
return props.name;
|
|
346
|
+
},
|
|
347
|
+
get optional() {
|
|
348
|
+
return props.optional;
|
|
349
|
+
},
|
|
350
|
+
get defaultValue() {
|
|
351
|
+
return props.defaultValue;
|
|
352
|
+
}
|
|
278
353
|
}),
|
|
279
|
-
|
|
280
|
-
|
|
354
|
+
createComponent(TSDocParamDescription, { get children() {
|
|
355
|
+
return props.children;
|
|
356
|
+
} })
|
|
357
|
+
];
|
|
281
358
|
}
|
|
282
359
|
function TSDocParamName(props) {
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
when
|
|
360
|
+
return [
|
|
361
|
+
createComponent(Show, {
|
|
362
|
+
get when() {
|
|
363
|
+
return props.optional;
|
|
364
|
+
},
|
|
286
365
|
children: "["
|
|
287
366
|
}),
|
|
288
|
-
props.name,
|
|
289
|
-
|
|
290
|
-
when
|
|
291
|
-
|
|
367
|
+
memo(() => props.name),
|
|
368
|
+
createComponent(Show, {
|
|
369
|
+
get when() {
|
|
370
|
+
return Boolean(props.defaultValue);
|
|
371
|
+
},
|
|
372
|
+
get children() {
|
|
373
|
+
return ["=", memo(() => props.defaultValue)];
|
|
374
|
+
}
|
|
292
375
|
}),
|
|
293
|
-
|
|
294
|
-
when
|
|
376
|
+
createComponent(Show, {
|
|
377
|
+
get when() {
|
|
378
|
+
return props.optional;
|
|
379
|
+
},
|
|
295
380
|
children: "]"
|
|
296
381
|
})
|
|
297
|
-
]
|
|
382
|
+
];
|
|
298
383
|
}
|
|
299
384
|
function TSDocParamDescription(props) {
|
|
300
|
-
return
|
|
301
|
-
when
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
385
|
+
return createComponent(Show, {
|
|
386
|
+
get when() {
|
|
387
|
+
return Boolean(props.children);
|
|
388
|
+
},
|
|
389
|
+
get children() {
|
|
390
|
+
return [" - ", createIntrinsic("align", {
|
|
391
|
+
width: 2,
|
|
392
|
+
get children() {
|
|
393
|
+
return createComponent(Prose, { get children() {
|
|
394
|
+
return props.children;
|
|
395
|
+
} });
|
|
396
|
+
}
|
|
397
|
+
})];
|
|
398
|
+
}
|
|
306
399
|
});
|
|
307
400
|
}
|
|
308
401
|
/**
|
|
309
402
|
* Create a TSDoc `@returns` tag.
|
|
310
403
|
*/
|
|
311
404
|
function TSDocReturns(props) {
|
|
312
|
-
return
|
|
313
|
-
...props,
|
|
314
|
-
tag: "returns"
|
|
315
|
-
});
|
|
405
|
+
return createComponent(TSDocTag, mergeProps(props, { tag: "returns" }));
|
|
316
406
|
}
|
|
317
407
|
/**
|
|
318
408
|
* Create a TSDoc `@throws` tag.
|
|
319
409
|
*/
|
|
320
410
|
function TSDocThrows(props) {
|
|
321
|
-
return
|
|
322
|
-
...props,
|
|
323
|
-
tag: "throws"
|
|
324
|
-
});
|
|
411
|
+
return createComponent(TSDocTag, mergeProps(props, { tag: "throws" }));
|
|
325
412
|
}
|
|
326
413
|
/**
|
|
327
414
|
* Generates a TSDoc `@module` tag for the given module name.
|
|
@@ -333,28 +420,36 @@ function TSDocModule(props) {
|
|
|
333
420
|
"prefix"
|
|
334
421
|
]);
|
|
335
422
|
const context = usePowerlinesSafe();
|
|
336
|
-
return
|
|
423
|
+
return [
|
|
337
424
|
"/**",
|
|
338
|
-
|
|
425
|
+
createIntrinsic("align", {
|
|
339
426
|
string: " * ",
|
|
340
|
-
children
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
427
|
+
get children() {
|
|
428
|
+
return [
|
|
429
|
+
createIntrinsic("hbr", {}),
|
|
430
|
+
createComponent(Show, {
|
|
431
|
+
get when() {
|
|
432
|
+
return Boolean(children);
|
|
433
|
+
},
|
|
434
|
+
get children() {
|
|
435
|
+
return [createComponent(List, {
|
|
436
|
+
hardline: true,
|
|
437
|
+
get children() {
|
|
438
|
+
return childrenArray(() => children);
|
|
439
|
+
}
|
|
440
|
+
}), createComponent(Spacing, {})];
|
|
441
|
+
}
|
|
442
|
+
}),
|
|
443
|
+
"@module ",
|
|
444
|
+
memo(() => prefix || context?.config?.framework || "powerlines"),
|
|
445
|
+
":",
|
|
446
|
+
name
|
|
447
|
+
];
|
|
448
|
+
}
|
|
354
449
|
}),
|
|
355
|
-
|
|
450
|
+
createIntrinsic("hbr", {}),
|
|
356
451
|
` */`
|
|
357
|
-
]
|
|
452
|
+
];
|
|
358
453
|
}
|
|
359
454
|
|
|
360
455
|
//#endregion
|