@powerlines/plugin-alloy 0.25.30 → 0.25.31
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/dist/core/components/output.cjs +12 -7
- package/dist/core/components/output.mjs +12 -7
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +5 -8
- package/dist/core/components/single-line-comment.mjs +5 -8
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +8 -7
- package/dist/core/components/source-file.mjs +8 -7
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +5 -6
- package/dist/core/components/spacing.mjs +5 -6
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +12 -9
- package/dist/markdown/components/front-matter.mjs +12 -9
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +57 -41
- package/dist/markdown/components/markdown-file.mjs +57 -41
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +31 -20
- package/dist/markdown/components/markdown-table.mjs +31 -20
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +10 -4
- package/dist/render.mjs +10 -4
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.cjs +21 -9
- package/dist/typescript/components/builtin-file.mjs +21 -9
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +112 -79
- package/dist/typescript/components/class-declaration.mjs +112 -79
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +6 -1
- package/dist/typescript/components/dynamic-import-statement.mjs +6 -1
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +7 -3
- package/dist/typescript/components/entry-file.mjs +7 -3
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/infrastructure-file.cjs +7 -3
- package/dist/typescript/components/infrastructure-file.mjs +7 -3
- package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +83 -47
- package/dist/typescript/components/interface-declaration.mjs +83 -47
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +48 -36
- package/dist/typescript/components/object-declaration.mjs +48 -36
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +2 -2
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +112 -54
- package/dist/typescript/components/tsdoc-reflection.mjs +112 -54
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +211 -140
- package/dist/typescript/components/tsdoc.mjs +211 -140
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +17 -9
- package/dist/typescript/components/type-declaration.mjs +17 -9
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +33 -33
- package/dist/typescript/components/type-parameters.mjs +33 -33
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +90 -65
- package/dist/typescript/components/typescript-file.mjs +90 -65
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +5 -1
- package/dist/typescript/contexts/lexical-scope.mjs +5 -1
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +5 -2
- package/dist/typescript/contexts/member-scope.mjs +5 -2
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +58 -48
- package/dist/yaml/components/yaml-file.mjs +58 -48
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
2
|
import { Spacing } from "../../core/components/spacing.mjs";
|
|
3
3
|
import { For, List, Prose, Show, childrenArray, computed, splitProps } from "@alloy-js/core";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
4
5
|
import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
|
|
5
6
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
6
7
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -11,48 +12,59 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
11
12
|
*/
|
|
12
13
|
function TSDoc(props) {
|
|
13
14
|
const [{ children, heading }] = splitProps(props, ["children", "heading"]);
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
"/**",
|
|
17
|
+
/* @__PURE__ */ jsxs("align", {
|
|
18
|
+
string: " * ",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
21
|
+
/* @__PURE__ */ jsx(Show, {
|
|
22
|
+
when: !isUndefined(heading),
|
|
23
|
+
children: heading
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
26
|
+
when: !isUndefined(children) && childrenArray(() => children).filter(Boolean).length > 0,
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Show, {
|
|
28
|
+
when: !isUndefined(heading),
|
|
29
|
+
children: /* @__PURE__ */ jsx(Spacing, {})
|
|
30
|
+
}), /* @__PURE__ */ jsx(List, { children: childrenArray(() => children) })]
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
35
|
+
`*/`,
|
|
36
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
37
|
+
] });
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Create a TSDoc `@<props.tag>` tag.
|
|
33
41
|
*/
|
|
34
42
|
function TSDocTag(props) {
|
|
35
43
|
const [{ children, tag }] = splitProps(props, ["children", "tag"]);
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
`@${tag} `,
|
|
46
|
+
/* @__PURE__ */ jsx(Show, {
|
|
47
|
+
when: Boolean(children),
|
|
48
|
+
children: /* @__PURE__ */ jsx("align", {
|
|
49
|
+
width: 2,
|
|
50
|
+
children: /* @__PURE__ */ jsx(Prose, { children })
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx("sbr", {})
|
|
54
|
+
] });
|
|
45
55
|
}
|
|
46
56
|
/**
|
|
47
57
|
* A component that creates a TSDoc block with `@param` tags for each parameter.
|
|
48
58
|
*/
|
|
49
59
|
function TSDocParams(props) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
return /* @__PURE__ */ jsx(For, {
|
|
61
|
+
each: normalizeParametersForDoc(props.parameters),
|
|
62
|
+
children: (param) => /* @__PURE__ */ jsx(TSDocParam, {
|
|
63
|
+
name: param.name,
|
|
64
|
+
optional: param.optional,
|
|
65
|
+
children: param.doc
|
|
66
|
+
})
|
|
67
|
+
});
|
|
56
68
|
}
|
|
57
69
|
function normalizeParametersForDoc(parameters) {
|
|
58
70
|
if (parameters.some((p) => typeof p === "string")) return [];
|
|
@@ -63,66 +75,79 @@ function normalizeParametersForDoc(parameters) {
|
|
|
63
75
|
*/
|
|
64
76
|
function TSDocTitle(props) {
|
|
65
77
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
79
|
+
...rest,
|
|
80
|
+
tag: "title",
|
|
81
|
+
children
|
|
82
|
+
});
|
|
69
83
|
}
|
|
70
84
|
/**
|
|
71
85
|
* Create a TSDoc `@domain` tag.
|
|
72
86
|
*/
|
|
73
87
|
function TSDocDomain(props) {
|
|
74
88
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
90
|
+
...rest,
|
|
91
|
+
tag: "domain",
|
|
92
|
+
children
|
|
93
|
+
});
|
|
78
94
|
}
|
|
79
95
|
/**
|
|
80
96
|
* Create a TSDoc `@alias` tag.
|
|
81
97
|
*/
|
|
82
98
|
function TSDocAlias(props) {
|
|
83
99
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
101
|
+
...rest,
|
|
102
|
+
tag: "alias",
|
|
103
|
+
children
|
|
104
|
+
});
|
|
87
105
|
}
|
|
88
106
|
/**
|
|
89
107
|
* Create a TSDoc `@permission` tag.
|
|
90
108
|
*/
|
|
91
109
|
function TSDocPermission(props) {
|
|
92
110
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
112
|
+
...rest,
|
|
113
|
+
tag: "permission",
|
|
114
|
+
children
|
|
115
|
+
});
|
|
96
116
|
}
|
|
97
117
|
/**
|
|
98
118
|
* Create a TSDoc `@defaultValue` tag.
|
|
99
119
|
*/
|
|
100
120
|
function TSDocDefaultValue(props) {
|
|
101
121
|
const [{ type, defaultValue }] = splitProps(props, ["type", "defaultValue"]);
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</>;
|
|
122
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: ["@defaultValue ", /* @__PURE__ */ jsx(Show, {
|
|
123
|
+
when: !isUndefined(defaultValue),
|
|
124
|
+
children: /* @__PURE__ */ jsx("align", {
|
|
125
|
+
width: 2,
|
|
126
|
+
children: /* @__PURE__ */ jsx(Prose, { children: stringifyDefaultValue(type, defaultValue) })
|
|
127
|
+
})
|
|
128
|
+
})] });
|
|
110
129
|
}
|
|
111
130
|
/**
|
|
112
131
|
* Create a TSDoc `@remarks` tag.
|
|
113
132
|
*/
|
|
114
133
|
function TSDocRemarks(props) {
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
135
|
+
"@remarks ",
|
|
136
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
137
|
+
/* @__PURE__ */ jsx(List, {
|
|
138
|
+
hardline: true,
|
|
139
|
+
children: childrenArray(() => props.children)
|
|
140
|
+
})
|
|
141
|
+
] });
|
|
120
142
|
}
|
|
121
143
|
/**
|
|
122
144
|
* Create a TSDoc `@see` tag.
|
|
123
145
|
*/
|
|
124
146
|
function TSDocLink(props) {
|
|
125
|
-
return
|
|
147
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
148
|
+
...props,
|
|
149
|
+
tag: "see"
|
|
150
|
+
});
|
|
126
151
|
}
|
|
127
152
|
/**
|
|
128
153
|
* Create a TSDoc `@example` tag.
|
|
@@ -134,43 +159,47 @@ function TSDocExample(props) {
|
|
|
134
159
|
"language",
|
|
135
160
|
"children"
|
|
136
161
|
]);
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
163
|
+
"@example ",
|
|
164
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
165
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
166
|
+
when: fenced,
|
|
167
|
+
children: [
|
|
168
|
+
"```",
|
|
169
|
+
language || (tsx ? "tsx" : "ts"),
|
|
170
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
171
|
+
]
|
|
172
|
+
}),
|
|
173
|
+
children,
|
|
174
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
175
|
+
when: fenced,
|
|
176
|
+
children: [/* @__PURE__ */ jsx("hbr", {}), "```"]
|
|
177
|
+
})
|
|
178
|
+
] });
|
|
150
179
|
}
|
|
151
180
|
/**
|
|
152
181
|
* Create a TSDoc `@readonly` tag.
|
|
153
182
|
*/
|
|
154
183
|
function TSDocReadonly() {
|
|
155
|
-
return
|
|
184
|
+
return /* @__PURE__ */ jsx(TSDocTag, { tag: "readonly" });
|
|
156
185
|
}
|
|
157
186
|
/**
|
|
158
187
|
* Create a TSDoc `@internal` tag.
|
|
159
188
|
*/
|
|
160
189
|
function TSDocInternal() {
|
|
161
|
-
return
|
|
190
|
+
return /* @__PURE__ */ jsx(TSDocTag, { tag: "internal" });
|
|
162
191
|
}
|
|
163
192
|
/**
|
|
164
193
|
* Create a TSDoc `@ignore` tag.
|
|
165
194
|
*/
|
|
166
195
|
function TSDocIgnore() {
|
|
167
|
-
return
|
|
196
|
+
return /* @__PURE__ */ jsx(TSDocTag, { tag: "ignore" });
|
|
168
197
|
}
|
|
169
198
|
/**
|
|
170
199
|
* Create a TSDoc `@hidden` tag.
|
|
171
200
|
*/
|
|
172
201
|
function TSDocHidden() {
|
|
173
|
-
return
|
|
202
|
+
return /* @__PURE__ */ jsx(TSDocTag, { tag: "hidden" });
|
|
174
203
|
}
|
|
175
204
|
/**
|
|
176
205
|
* Generates a TypeScript interface property for the given reflection class.
|
|
@@ -188,77 +217,111 @@ function TSDocAttributesTags(props) {
|
|
|
188
217
|
]);
|
|
189
218
|
const title = computed(() => props.title?.trim() || "");
|
|
190
219
|
const domain = computed(() => props.domain?.trim() || "");
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
221
|
+
/* @__PURE__ */ jsx(Show, {
|
|
222
|
+
when: isSetString(title.value),
|
|
223
|
+
children: /* @__PURE__ */ jsx(TSDocTitle, { children: title.value })
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ jsx(Show, {
|
|
226
|
+
when: !isUndefined(alias) && alias.length > 0 && alias.some((a) => isSetString(a?.trim())),
|
|
227
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
228
|
+
each: alias?.filter((a) => isSetString(a?.trim())) ?? [],
|
|
229
|
+
children: (alias) => /* @__PURE__ */ jsx(TSDocAlias, { children: alias })
|
|
230
|
+
})
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ jsx(Show, {
|
|
233
|
+
when: isSetString(domain.value),
|
|
234
|
+
children: /* @__PURE__ */ jsx(TSDocDomain, { children: domain.value })
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ jsx(Show, {
|
|
237
|
+
when: !isUndefined(permission) && permission.length > 0 && permission.some((p) => isSetString(p?.trim())),
|
|
238
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
239
|
+
each: permission?.filter((p) => isSetString(p?.trim())) ?? [],
|
|
240
|
+
children: (permission) => /* @__PURE__ */ jsx(TSDocPermission, { children: permission })
|
|
241
|
+
})
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ jsx(Show, {
|
|
244
|
+
when: readonly === true,
|
|
245
|
+
children: /* @__PURE__ */ jsx(TSDocReadonly, {})
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ jsx(Show, {
|
|
248
|
+
when: internal === true,
|
|
249
|
+
children: /* @__PURE__ */ jsx(TSDocInternal, {})
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsx(Show, {
|
|
252
|
+
when: ignore === true,
|
|
253
|
+
children: /* @__PURE__ */ jsx(TSDocIgnore, {})
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ jsx(Show, {
|
|
256
|
+
when: hidden === true,
|
|
257
|
+
children: /* @__PURE__ */ jsx(TSDocHidden, {})
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx(Show, {
|
|
260
|
+
when: !isUndefined(type) && !isUndefined(defaultValue),
|
|
261
|
+
children: /* @__PURE__ */ jsx(TSDocDefaultValue, {
|
|
262
|
+
type,
|
|
263
|
+
defaultValue
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
] });
|
|
224
267
|
}
|
|
225
268
|
/**
|
|
226
269
|
* Create a TSDoc parameter set off with `@param`.
|
|
227
270
|
*/
|
|
228
271
|
function TSDocParam(props) {
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
272
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
273
|
+
"@param ",
|
|
274
|
+
/* @__PURE__ */ jsx(TSDocParamName, {
|
|
275
|
+
name: props.name,
|
|
276
|
+
optional: props.optional,
|
|
277
|
+
defaultValue: props.defaultValue
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx(TSDocParamDescription, { children: props.children })
|
|
280
|
+
] });
|
|
234
281
|
}
|
|
235
282
|
function TSDocParamName(props) {
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
283
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
284
|
+
/* @__PURE__ */ jsx(Show, {
|
|
285
|
+
when: props.optional,
|
|
286
|
+
children: "["
|
|
287
|
+
}),
|
|
288
|
+
props.name,
|
|
289
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
290
|
+
when: Boolean(props.defaultValue),
|
|
291
|
+
children: ["=", props.defaultValue]
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ jsx(Show, {
|
|
294
|
+
when: props.optional,
|
|
295
|
+
children: "]"
|
|
296
|
+
})
|
|
297
|
+
] });
|
|
242
298
|
}
|
|
243
299
|
function TSDocParamDescription(props) {
|
|
244
|
-
return
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
300
|
+
return /* @__PURE__ */ jsxs(Show, {
|
|
301
|
+
when: Boolean(props.children),
|
|
302
|
+
children: [" - ", /* @__PURE__ */ jsx("align", {
|
|
303
|
+
width: 2,
|
|
304
|
+
children: /* @__PURE__ */ jsx(Prose, { children: props.children })
|
|
305
|
+
})]
|
|
306
|
+
});
|
|
250
307
|
}
|
|
251
308
|
/**
|
|
252
309
|
* Create a TSDoc `@returns` tag.
|
|
253
310
|
*/
|
|
254
311
|
function TSDocReturns(props) {
|
|
255
|
-
return
|
|
312
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
313
|
+
...props,
|
|
314
|
+
tag: "returns"
|
|
315
|
+
});
|
|
256
316
|
}
|
|
257
317
|
/**
|
|
258
318
|
* Create a TSDoc `@throws` tag.
|
|
259
319
|
*/
|
|
260
320
|
function TSDocThrows(props) {
|
|
261
|
-
return
|
|
321
|
+
return /* @__PURE__ */ jsx(TSDocTag, {
|
|
322
|
+
...props,
|
|
323
|
+
tag: "throws"
|
|
324
|
+
});
|
|
262
325
|
}
|
|
263
326
|
/**
|
|
264
327
|
* Generates a TSDoc `@module` tag for the given module name.
|
|
@@ -270,20 +333,28 @@ function TSDocModule(props) {
|
|
|
270
333
|
"prefix"
|
|
271
334
|
]);
|
|
272
335
|
const context = usePowerlinesSafe();
|
|
273
|
-
return
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
336
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
337
|
+
"/**",
|
|
338
|
+
/* @__PURE__ */ jsxs("align", {
|
|
339
|
+
string: " * ",
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
342
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
343
|
+
when: Boolean(children),
|
|
344
|
+
children: [/* @__PURE__ */ jsx(List, {
|
|
345
|
+
hardline: true,
|
|
346
|
+
children: childrenArray(() => children)
|
|
347
|
+
}), /* @__PURE__ */ jsx(Spacing, {})]
|
|
348
|
+
}),
|
|
349
|
+
"@module ",
|
|
350
|
+
prefix || context?.config?.framework || "powerlines",
|
|
351
|
+
":",
|
|
352
|
+
name
|
|
353
|
+
]
|
|
354
|
+
}),
|
|
355
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
356
|
+
` */`
|
|
357
|
+
] });
|
|
287
358
|
}
|
|
288
359
|
|
|
289
360
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdoc.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n childrenArray,\n computed,\n For,\n List,\n Prose,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport { JSDocExampleProps, ParameterDescriptor } from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport {\n ReflectionKind,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport interface TSDocProps extends ComponentProps {\n heading?: Children;\n}\n\n/**\n * Generates a TypeScript interface for the given reflection class.\n */\nexport function TSDoc(props: TSDocProps) {\n const [{ children, heading }] = splitProps(props, [\"children\", \"heading\"]);\n\n return (\n <>\n /**\n <align string=\" * \">\n <hbr />\n <Show when={!isUndefined(heading)}>{heading}</Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={!isUndefined(heading)}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </align>\n <hbr />\n {`*/`}\n <hbr />\n </>\n );\n}\n\nexport interface TSDocTagProps extends ComponentProps {\n tag: string;\n}\n\n/**\n * Create a TSDoc `@<props.tag>` tag.\n */\nexport function TSDocTag(props: TSDocTagProps) {\n const [{ children, tag }] = splitProps(props, [\"children\", \"tag\"]);\n\n return (\n <>\n {`@${tag} `}\n <Show when={Boolean(children)}>\n <align width={2}>\n <Prose>{children}</Prose>\n </align>\n </Show>\n <sbr />\n </>\n );\n}\n\nexport interface TSDocParamsProps {\n parameters: ParameterDescriptor[] | string[];\n}\n\n/**\n * A component that creates a TSDoc block with `@param` tags for each parameter.\n */\nexport function TSDocParams(props: TSDocParamsProps) {\n const parameters = normalizeParametersForDoc(props.parameters);\n\n return (\n <For each={parameters}>\n {param => (\n <TSDocParam name={param.name} optional={param.optional}>\n {param.doc}\n </TSDocParam>\n )}\n </For>\n );\n}\n\nfunction normalizeParametersForDoc(\n parameters: ParameterDescriptor[] | string[]\n): ParameterDescriptor[] {\n if (parameters.some(p => typeof p === \"string\")) {\n return [];\n }\n\n return parameters as ParameterDescriptor[];\n}\n\n/**\n * Create a TSDoc `@title` tag.\n */\nexport function TSDocTitle(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"title\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@domain` tag.\n */\nexport function TSDocDomain(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"domain\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@alias` tag.\n */\nexport function TSDocAlias(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"alias\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@permission` tag.\n */\nexport function TSDocPermission(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"permission\">\n {children}\n </TSDocTag>\n );\n}\n\nexport interface TSDocDefaultValueProps extends ComponentProps {\n type: ReflectionKind | ReflectionProperty | ReflectionParameter;\n defaultValue: any;\n}\n\n/**\n * Create a TSDoc `@defaultValue` tag.\n */\nexport function TSDocDefaultValue(props: TSDocDefaultValueProps) {\n const [{ type, defaultValue }] = splitProps(props, [\"type\", \"defaultValue\"]);\n\n return (\n <>\n {\"@defaultValue \"}\n <Show when={!isUndefined(defaultValue)}>\n <align width={2}>\n <Prose>{stringifyDefaultValue(type, defaultValue)}</Prose>\n </align>\n </Show>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@remarks` tag.\n */\nexport function TSDocRemarks(props: ComponentProps) {\n return (\n <>\n {\"@remarks \"}\n <hbr />\n <List hardline={true}>{childrenArray(() => props.children)}</List>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@see` tag.\n */\nexport function TSDocLink(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"see\" />;\n}\n\nexport interface TSDocExampleProps extends JSDocExampleProps {\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n}\n\n/**\n * Create a TSDoc `@example` tag.\n */\nexport function TSDocExample(props: TSDocExampleProps) {\n const [{ tsx, fenced = true, language, children }] = splitProps(props, [\n \"tsx\",\n \"fenced\",\n \"language\",\n \"children\"\n ]);\n\n return (\n <>\n {\"@example \"}\n <hbr />\n <Show when={fenced}>\n ```{language || (tsx ? \"tsx\" : \"ts\")}\n <hbr />\n </Show>\n {children}\n <Show when={fenced}>\n <hbr />\n ```\n </Show>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@readonly` tag.\n */\nexport function TSDocReadonly() {\n return <TSDocTag tag=\"readonly\" />;\n}\n\n/**\n * Create a TSDoc `@internal` tag.\n */\nexport function TSDocInternal() {\n return <TSDocTag tag=\"internal\" />;\n}\n\n/**\n * Create a TSDoc `@ignore` tag.\n */\nexport function TSDocIgnore() {\n return <TSDocTag tag=\"ignore\" />;\n}\n\n/**\n * Create a TSDoc `@hidden` tag.\n */\nexport function TSDocHidden() {\n return <TSDocTag tag=\"hidden\" />;\n}\n\nexport interface TSDocAttributesTagsProps {\n type?: ReflectionKind | ReflectionProperty | ReflectionParameter;\n title?: string;\n alias?: string[];\n permission?: string[];\n domain?: string;\n readonly?: boolean;\n internal?: boolean;\n ignore?: boolean;\n hidden?: boolean;\n defaultValue?: any;\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function TSDocAttributesTags(props: TSDocAttributesTagsProps) {\n const [\n {\n type,\n alias,\n permission,\n readonly,\n internal,\n ignore,\n hidden,\n defaultValue\n }\n ] = splitProps(props, [\n \"type\",\n \"alias\",\n \"permission\",\n \"readonly\",\n \"internal\",\n \"ignore\",\n \"hidden\",\n \"defaultValue\"\n ]);\n\n const title = computed(() => props.title?.trim() || \"\");\n const domain = computed(() => props.domain?.trim() || \"\");\n\n return (\n <>\n <Show when={isSetString(title.value)}>\n <TSDocTitle>{title.value}</TSDocTitle>\n </Show>\n <Show\n when={\n !isUndefined(alias) &&\n alias.length > 0 &&\n alias.some(a => isSetString(a?.trim()))\n }>\n <For each={alias?.filter(a => isSetString(a?.trim())) ?? []}>\n {alias => <TSDocAlias>{alias}</TSDocAlias>}\n </For>\n </Show>\n <Show when={isSetString(domain.value)}>\n <TSDocDomain>{domain.value}</TSDocDomain>\n </Show>\n <Show\n when={\n !isUndefined(permission) &&\n permission.length > 0 &&\n permission.some(p => isSetString(p?.trim()))\n }>\n <For each={permission?.filter(p => isSetString(p?.trim())) ?? []}>\n {permission => <TSDocPermission>{permission}</TSDocPermission>}\n </For>\n </Show>\n <Show when={readonly === true}>\n <TSDocReadonly />\n </Show>\n <Show when={internal === true}>\n <TSDocInternal />\n </Show>\n <Show when={ignore === true}>\n <TSDocIgnore />\n </Show>\n <Show when={hidden === true}>\n <TSDocHidden />\n </Show>\n <Show when={!isUndefined(type) && !isUndefined(defaultValue)}>\n <TSDocDefaultValue\n type={\n type as ReflectionKind | ReflectionProperty | ReflectionParameter\n }\n defaultValue={defaultValue}\n />\n </Show>\n </>\n );\n}\n\nexport interface TSDocParamProps {\n name: Children;\n children?: Children;\n optional?: boolean;\n defaultValue?: Children;\n}\n\n/**\n * Create a TSDoc parameter set off with `@param`.\n */\nexport function TSDocParam(props: TSDocParamProps) {\n return (\n <>\n {\"@param \"}\n <TSDocParamName\n name={props.name}\n optional={props.optional}\n defaultValue={props.defaultValue}\n />\n <TSDocParamDescription children={props.children} />\n </>\n );\n}\n\ninterface TSDocParamNameProps {\n name: Children;\n optional?: boolean;\n defaultValue?: Children;\n}\n\nfunction TSDocParamName(props: TSDocParamNameProps) {\n return (\n <>\n <Show when={props.optional}>{\"[\"}</Show>\n {props.name}\n <Show when={Boolean(props.defaultValue)}>={props.defaultValue}</Show>\n <Show when={props.optional}>{\"]\"}</Show>\n </>\n );\n}\n\ninterface TSDocParamDescriptionProps {\n children?: Children;\n}\n\nfunction TSDocParamDescription(props: TSDocParamDescriptionProps) {\n return (\n <Show when={Boolean(props.children)}>\n {\" - \"}\n <align width={2}>\n <Prose>{props.children}</Prose>\n </align>\n </Show>\n );\n}\n\n/**\n * Create a TSDoc `@returns` tag.\n */\nexport function TSDocReturns(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"returns\" />;\n}\n\n/**\n * Create a TSDoc `@throws` tag.\n */\nexport function TSDocThrows(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"throws\" />;\n}\n\nexport interface TSDocModuleProps extends ComponentProps {\n /**\n * The prefix for the builtin module name\n *\n * @remarks\n * This value is populated from the Powerlines configuration output builtin prefix by default.\n *\n * @example\n * ```ts\n * /**\n * @module powerlines:my-module\n * \\/\n * ```\n */\n prefix?: string;\n\n /**\n * The name of the module\n *\n * @remarks\n * This will be used in the `@module` tag as well as the import path for the module, e.g. `storm:<name>`.\n *\n * @example\n * ```ts\n * import { MyModule } from \"powerlines:my-module\";\n * ```\n */\n name: Children;\n}\n\n/**\n * Generates a TSDoc `@module` tag for the given module name.\n */\nexport function TSDocModule(props: TSDocModuleProps) {\n const [{ children, name, prefix }] = splitProps(props, [\n \"children\",\n \"name\",\n \"prefix\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n /**\n <align string=\" * \">\n <hbr />\n <Show when={Boolean(children)}>\n <List hardline={true}>{childrenArray(() => children)}</List>\n <Spacing />\n </Show>\n {\"@module \"}\n {prefix || context?.config?.framework || \"powerlines\"}:{name}\n </align>\n <hbr />\n {` */`}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgDA,SAAgB,MAAM,OAAmB;CACvC,MAAM,CAAC,EAAE,UAAU,aAAa,WAAW,OAAO,CAAC,YAAY,UAAU,CAAC;AAE1E,QACE,EAAE;;MAEA,CAAC,MAAM,aAAa;QAClB,CAAC,MAAM;QACP,CAAC,KAAK,MAAM,CAAC,YAAY,QAAQ,GAAG,QAAQ,EAAE,KAAK;QACnD,CAAC,KACC,MACE,CAAC,YAAY,SAAS,IACtB,oBAAoB,SAAS,CAAC,OAAO,QAAQ,CAAC,SAAS,GACvD;UACF,CAAC,KAAK,MAAM,CAAC,YAAY,QAAQ,EAAE;YACjC,CAAC,UAAU;UACb,EAAE,KAAK;UACP,CAAC,MAAM,oBAAoB,SAAS,CAAC,EAAE,KAAK;QAC9C,EAAE,KAAK;MACT,EAAE,MAAM;MACR,CAAC,MAAM;OACN,KAAK;MACN,CAAC,MAAM;IACT;;;;;AAWJ,SAAgB,SAAS,OAAsB;CAC7C,MAAM,CAAC,EAAE,UAAU,SAAS,WAAW,OAAO,CAAC,YAAY,MAAM,CAAC;AAElE,QACE,EAAE;OACC,IAAI,IAAI,GAAG;MACZ,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;QAC7B,CAAC,MAAM,OAAO,GAAG;UACf,CAAC,OAAO,SAAS,EAAE,MAAM;QAC3B,EAAE,MAAM;MACV,EAAE,KAAK;MACP,CAAC,MAAM;IACT;;;;;AAWJ,SAAgB,YAAY,OAAyB;CACnD,MAAM,aAAa,0BAA0B,MAAM,WAAW;AAE9D,QACE,CAAC,IAA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K,MAAM,MAAM,WAAW,IAAI,EAAE,KAAK;OACvC,MAAM,KAAK;MACZ,CAAC,KAAK,MAAM,QAAQ,MAAM,aAAa,EAAE,EAAE,MAAM,aAAa,EAAE,KAAK;MACrE,CAAC,KAAK,MAAM,MAAM,WAAW,IAAI,EAAE,KAAK;IAC1C;;AAQJ,SAAS,sBAAsB,OAAmC;AAChE,QACE,CAAC,KAAK,MAAM,QAAQ,MAAM,SAAS,EAAE;OAClC,MAAM;MACP,CAAC,MAAM,OAAO,GAAG;QACf,CAAC,OAAO,MAAM,SAAS,EAAE,MAAM;MACjC,EAAE,MAAM;IACV,EAAE;;;;;AAON,SAAgB,aAAa,OAAuB;AAClD,QAAO,CAAC,aAAa,OAAO;;;;;AAM9B,SAAgB,YAAY,OAAuB;AACjD,QAAO,CAAC,aAAa,OAAO;;;;;AAoC9B,SAAgB,YAAY,OAAyB;CACnD,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,WAAW,OAAO;EACrD;EACA;EACA;EACD,CAAC;CAEF,MAAM,UAAU,mBAAmB;AAEnC,QACE,EAAE;;MAEA,CAAC,MAAM,aAAa;QAClB,CAAC,MAAM;QACP,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;UAC7B,CAAC,KAAK,UAAU,OAAO,oBAAoB,SAAS,CAAC,EAAE,KAAK;UAC5D,CAAC,UAAU;QACb,EAAE,KAAK;SACN,WAAW;SACX,UAAU,SAAS,QAAQ,aAAa,aAAa,EAAE,KAAK;MAC/D,EAAE,MAAM;MACR,CAAC,MAAM;OACN,MAAM;IACT"}
|
|
1
|
+
{"version":3,"file":"tsdoc.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n childrenArray,\n computed,\n For,\n List,\n Prose,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport { JSDocExampleProps, ParameterDescriptor } from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport {\n ReflectionKind,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport interface TSDocProps extends ComponentProps {\n heading?: Children;\n}\n\n/**\n * Generates a TypeScript interface for the given reflection class.\n */\nexport function TSDoc(props: TSDocProps) {\n const [{ children, heading }] = splitProps(props, [\"children\", \"heading\"]);\n\n return (\n <>\n /**\n <align string=\" * \">\n <hbr />\n <Show when={!isUndefined(heading)}>{heading}</Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={!isUndefined(heading)}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </align>\n <hbr />\n {`*/`}\n <hbr />\n </>\n );\n}\n\nexport interface TSDocTagProps extends ComponentProps {\n tag: string;\n}\n\n/**\n * Create a TSDoc `@<props.tag>` tag.\n */\nexport function TSDocTag(props: TSDocTagProps) {\n const [{ children, tag }] = splitProps(props, [\"children\", \"tag\"]);\n\n return (\n <>\n {`@${tag} `}\n <Show when={Boolean(children)}>\n <align width={2}>\n <Prose>{children}</Prose>\n </align>\n </Show>\n <sbr />\n </>\n );\n}\n\nexport interface TSDocParamsProps {\n parameters: ParameterDescriptor[] | string[];\n}\n\n/**\n * A component that creates a TSDoc block with `@param` tags for each parameter.\n */\nexport function TSDocParams(props: TSDocParamsProps) {\n const parameters = normalizeParametersForDoc(props.parameters);\n\n return (\n <For each={parameters}>\n {param => (\n <TSDocParam name={param.name} optional={param.optional}>\n {param.doc}\n </TSDocParam>\n )}\n </For>\n );\n}\n\nfunction normalizeParametersForDoc(\n parameters: ParameterDescriptor[] | string[]\n): ParameterDescriptor[] {\n if (parameters.some(p => typeof p === \"string\")) {\n return [];\n }\n\n return parameters as ParameterDescriptor[];\n}\n\n/**\n * Create a TSDoc `@title` tag.\n */\nexport function TSDocTitle(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"title\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@domain` tag.\n */\nexport function TSDocDomain(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"domain\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@alias` tag.\n */\nexport function TSDocAlias(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"alias\">\n {children}\n </TSDocTag>\n );\n}\n\n/**\n * Create a TSDoc `@permission` tag.\n */\nexport function TSDocPermission(props: ComponentProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <TSDocTag {...rest} tag=\"permission\">\n {children}\n </TSDocTag>\n );\n}\n\nexport interface TSDocDefaultValueProps extends ComponentProps {\n type: ReflectionKind | ReflectionProperty | ReflectionParameter;\n defaultValue: any;\n}\n\n/**\n * Create a TSDoc `@defaultValue` tag.\n */\nexport function TSDocDefaultValue(props: TSDocDefaultValueProps) {\n const [{ type, defaultValue }] = splitProps(props, [\"type\", \"defaultValue\"]);\n\n return (\n <>\n {\"@defaultValue \"}\n <Show when={!isUndefined(defaultValue)}>\n <align width={2}>\n <Prose>{stringifyDefaultValue(type, defaultValue)}</Prose>\n </align>\n </Show>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@remarks` tag.\n */\nexport function TSDocRemarks(props: ComponentProps) {\n return (\n <>\n {\"@remarks \"}\n <hbr />\n <List hardline={true}>{childrenArray(() => props.children)}</List>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@see` tag.\n */\nexport function TSDocLink(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"see\" />;\n}\n\nexport interface TSDocExampleProps extends JSDocExampleProps {\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n}\n\n/**\n * Create a TSDoc `@example` tag.\n */\nexport function TSDocExample(props: TSDocExampleProps) {\n const [{ tsx, fenced = true, language, children }] = splitProps(props, [\n \"tsx\",\n \"fenced\",\n \"language\",\n \"children\"\n ]);\n\n return (\n <>\n {\"@example \"}\n <hbr />\n <Show when={fenced}>\n ```{language || (tsx ? \"tsx\" : \"ts\")}\n <hbr />\n </Show>\n {children}\n <Show when={fenced}>\n <hbr />\n ```\n </Show>\n </>\n );\n}\n\n/**\n * Create a TSDoc `@readonly` tag.\n */\nexport function TSDocReadonly() {\n return <TSDocTag tag=\"readonly\" />;\n}\n\n/**\n * Create a TSDoc `@internal` tag.\n */\nexport function TSDocInternal() {\n return <TSDocTag tag=\"internal\" />;\n}\n\n/**\n * Create a TSDoc `@ignore` tag.\n */\nexport function TSDocIgnore() {\n return <TSDocTag tag=\"ignore\" />;\n}\n\n/**\n * Create a TSDoc `@hidden` tag.\n */\nexport function TSDocHidden() {\n return <TSDocTag tag=\"hidden\" />;\n}\n\nexport interface TSDocAttributesTagsProps {\n type?: ReflectionKind | ReflectionProperty | ReflectionParameter;\n title?: string;\n alias?: string[];\n permission?: string[];\n domain?: string;\n readonly?: boolean;\n internal?: boolean;\n ignore?: boolean;\n hidden?: boolean;\n defaultValue?: any;\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function TSDocAttributesTags(props: TSDocAttributesTagsProps) {\n const [\n {\n type,\n alias,\n permission,\n readonly,\n internal,\n ignore,\n hidden,\n defaultValue\n }\n ] = splitProps(props, [\n \"type\",\n \"alias\",\n \"permission\",\n \"readonly\",\n \"internal\",\n \"ignore\",\n \"hidden\",\n \"defaultValue\"\n ]);\n\n const title = computed(() => props.title?.trim() || \"\");\n const domain = computed(() => props.domain?.trim() || \"\");\n\n return (\n <>\n <Show when={isSetString(title.value)}>\n <TSDocTitle>{title.value}</TSDocTitle>\n </Show>\n <Show\n when={\n !isUndefined(alias) &&\n alias.length > 0 &&\n alias.some(a => isSetString(a?.trim()))\n }>\n <For each={alias?.filter(a => isSetString(a?.trim())) ?? []}>\n {alias => <TSDocAlias>{alias}</TSDocAlias>}\n </For>\n </Show>\n <Show when={isSetString(domain.value)}>\n <TSDocDomain>{domain.value}</TSDocDomain>\n </Show>\n <Show\n when={\n !isUndefined(permission) &&\n permission.length > 0 &&\n permission.some(p => isSetString(p?.trim()))\n }>\n <For each={permission?.filter(p => isSetString(p?.trim())) ?? []}>\n {permission => <TSDocPermission>{permission}</TSDocPermission>}\n </For>\n </Show>\n <Show when={readonly === true}>\n <TSDocReadonly />\n </Show>\n <Show when={internal === true}>\n <TSDocInternal />\n </Show>\n <Show when={ignore === true}>\n <TSDocIgnore />\n </Show>\n <Show when={hidden === true}>\n <TSDocHidden />\n </Show>\n <Show when={!isUndefined(type) && !isUndefined(defaultValue)}>\n <TSDocDefaultValue\n type={\n type as ReflectionKind | ReflectionProperty | ReflectionParameter\n }\n defaultValue={defaultValue}\n />\n </Show>\n </>\n );\n}\n\nexport interface TSDocParamProps {\n name: Children;\n children?: Children;\n optional?: boolean;\n defaultValue?: Children;\n}\n\n/**\n * Create a TSDoc parameter set off with `@param`.\n */\nexport function TSDocParam(props: TSDocParamProps) {\n return (\n <>\n {\"@param \"}\n <TSDocParamName\n name={props.name}\n optional={props.optional}\n defaultValue={props.defaultValue}\n />\n <TSDocParamDescription children={props.children} />\n </>\n );\n}\n\ninterface TSDocParamNameProps {\n name: Children;\n optional?: boolean;\n defaultValue?: Children;\n}\n\nfunction TSDocParamName(props: TSDocParamNameProps) {\n return (\n <>\n <Show when={props.optional}>{\"[\"}</Show>\n {props.name}\n <Show when={Boolean(props.defaultValue)}>={props.defaultValue}</Show>\n <Show when={props.optional}>{\"]\"}</Show>\n </>\n );\n}\n\ninterface TSDocParamDescriptionProps {\n children?: Children;\n}\n\nfunction TSDocParamDescription(props: TSDocParamDescriptionProps) {\n return (\n <Show when={Boolean(props.children)}>\n {\" - \"}\n <align width={2}>\n <Prose>{props.children}</Prose>\n </align>\n </Show>\n );\n}\n\n/**\n * Create a TSDoc `@returns` tag.\n */\nexport function TSDocReturns(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"returns\" />;\n}\n\n/**\n * Create a TSDoc `@throws` tag.\n */\nexport function TSDocThrows(props: ComponentProps) {\n return <TSDocTag {...props} tag=\"throws\" />;\n}\n\nexport interface TSDocModuleProps extends ComponentProps {\n /**\n * The prefix for the builtin module name\n *\n * @remarks\n * This value is populated from the Powerlines configuration output builtin prefix by default.\n *\n * @example\n * ```ts\n * /**\n * @module powerlines:my-module\n * \\/\n * ```\n */\n prefix?: string;\n\n /**\n * The name of the module\n *\n * @remarks\n * This will be used in the `@module` tag as well as the import path for the module, e.g. `storm:<name>`.\n *\n * @example\n * ```ts\n * import { MyModule } from \"powerlines:my-module\";\n * ```\n */\n name: Children;\n}\n\n/**\n * Generates a TSDoc `@module` tag for the given module name.\n */\nexport function TSDocModule(props: TSDocModuleProps) {\n const [{ children, name, prefix }] = splitProps(props, [\n \"children\",\n \"name\",\n \"prefix\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n /**\n <align string=\" * \">\n <hbr />\n <Show when={Boolean(children)}>\n <List hardline={true}>{childrenArray(() => children)}</List>\n <Spacing />\n </Show>\n {\"@module \"}\n {prefix || context?.config?.framework || \"powerlines\"}:{name}\n </align>\n <h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B,aAAa,OAAuB;AAClD,QAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,KAAI;EAAY;;;;;AAM9C,SAAgB,YAAY,OAAuB;AACjD,QAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,KAAI;EAAW;;;;;AAoC7C,SAAgB,YAAY,OAAyB;CACnD,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,WAAW,OAAO;EACrD;EACA;EACA;EACD,CAAC;CAEF,MAAM,UAAU,mBAAmB;AAEnC,QACE;EAAE;EAEA,qBAAC,SAAD;GAAO,QAAO;aAAd;IACE,oBAAC,OAAD,EAAO;IACP,qBAAC,MAAD;KAAM,MAAM,QAAQ,SAAS;eAA7B,CACE,oBAAC,MAAD;MAAM,UAAU;gBAAO,oBAAoB,SAAS;MAAQ,GAC5D,oBAAC,SAAD,EAAW,EACN;;IACN;IACA,UAAU,SAAS,QAAQ,aAAa;IAAa;IAAE;IAClD;;EACR,oBAAC,OAAD,EAAO;EACN;EACA"}
|
|
@@ -3,6 +3,7 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
4
4
|
const require_typescript_components_type_parameters = require('./type-parameters.cjs');
|
|
5
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
7
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
8
|
|
|
8
9
|
//#region src/typescript/components/type-declaration.tsx
|
|
@@ -11,15 +12,22 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
11
12
|
*/
|
|
12
13
|
const TypeDeclaration = (0, _alloy_js_typescript.ensureTypeRefContext)(function TypeDeclaration(props) {
|
|
13
14
|
const { children, doc, typeParameters, ...rest } = props;
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
16
|
+
when: Boolean(doc),
|
|
17
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_typescript_components_tsdoc.TSDoc, { heading: doc })
|
|
18
|
+
}), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_typescript.Declaration, {
|
|
19
|
+
...rest,
|
|
20
|
+
kind: "type",
|
|
21
|
+
nameKind: "type",
|
|
22
|
+
children: [
|
|
23
|
+
"type ",
|
|
24
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Name, {}),
|
|
25
|
+
typeParameters && /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_typescript_components_type_parameters.TypeParameters, { parameters: typeParameters }),
|
|
26
|
+
" = ",
|
|
27
|
+
children,
|
|
28
|
+
";"
|
|
29
|
+
]
|
|
30
|
+
})] });
|
|
23
31
|
});
|
|
24
32
|
|
|
25
33
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TSDoc } from "./tsdoc.mjs";
|
|
2
2
|
import { TypeParameters } from "./type-parameters.mjs";
|
|
3
3
|
import { Name, Show } from "@alloy-js/core";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
4
5
|
import { Declaration as Declaration$1, ensureTypeRefContext } from "@alloy-js/typescript";
|
|
5
6
|
|
|
6
7
|
//#region src/typescript/components/type-declaration.tsx
|
|
@@ -9,15 +10,22 @@ import { Declaration as Declaration$1, ensureTypeRefContext } from "@alloy-js/ty
|
|
|
9
10
|
*/
|
|
10
11
|
const TypeDeclaration = ensureTypeRefContext(function TypeDeclaration(props) {
|
|
11
12
|
const { children, doc, typeParameters, ...rest } = props;
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Show, {
|
|
14
|
+
when: Boolean(doc),
|
|
15
|
+
children: /* @__PURE__ */ jsx(TSDoc, { heading: doc })
|
|
16
|
+
}), /* @__PURE__ */ jsxs(Declaration$1, {
|
|
17
|
+
...rest,
|
|
18
|
+
kind: "type",
|
|
19
|
+
nameKind: "type",
|
|
20
|
+
children: [
|
|
21
|
+
"type ",
|
|
22
|
+
/* @__PURE__ */ jsx(Name, {}),
|
|
23
|
+
typeParameters && /* @__PURE__ */ jsx(TypeParameters, { parameters: typeParameters }),
|
|
24
|
+
" = ",
|
|
25
|
+
children,
|
|
26
|
+
";"
|
|
27
|
+
]
|
|
28
|
+
})] });
|
|
21
29
|
});
|
|
22
30
|
|
|
23
31
|
//#endregion
|