@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,8 +1,8 @@
|
|
|
1
1
|
import { useReflectionClass, useReflectionMethod, useReflectionProperty } from "../../core/contexts/reflection.mjs";
|
|
2
2
|
import { Spacing } from "../../core/components/spacing.mjs";
|
|
3
3
|
import { TSDoc, TSDocAttributesTags, TSDocParam, TSDocReturns } from "./tsdoc.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
5
|
import { For, List, Show, childrenArray, code, computed, splitProps } from "@alloy-js/core";
|
|
5
|
-
import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
6
6
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
7
7
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
8
8
|
import { ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
@@ -32,41 +32,77 @@ function TSDocReflectionClass(props) {
|
|
|
32
32
|
const hidden = computed(() => reflection.isHidden());
|
|
33
33
|
if (!computedHeading.value || isSetString(computedHeading.value) && computedHeading.value.trim() === "") return null;
|
|
34
34
|
const hasAttributes = computed(() => isSetString(title.value) || !isUndefined(alias.value) && alias.value.length > 0 || !isUndefined(permission.value) && permission.value.length > 0 || isSetString(domain.value) || !isUndefined(readonly.value) || !isUndefined(internal.value) || !isUndefined(ignore.value) || !isUndefined(hidden.value));
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
return createComponent(TSDoc, mergeProps(rest, {
|
|
36
|
+
get heading() {
|
|
37
|
+
return memo(() => !!isSetString(computedHeading.value))() ? computedHeading.value.trim() : computedHeading.value;
|
|
38
|
+
},
|
|
39
|
+
get children() {
|
|
40
|
+
return [createComponent(Show, {
|
|
41
|
+
get when() {
|
|
42
|
+
return hasAttributes.value;
|
|
43
|
+
},
|
|
44
|
+
get children() {
|
|
45
|
+
return createComponent(TSDocAttributesTags, {
|
|
46
|
+
get title() {
|
|
47
|
+
return title.value;
|
|
48
|
+
},
|
|
49
|
+
get alias() {
|
|
50
|
+
return alias.value;
|
|
51
|
+
},
|
|
52
|
+
get domain() {
|
|
53
|
+
return domain.value;
|
|
54
|
+
},
|
|
55
|
+
get permission() {
|
|
56
|
+
return permission.value;
|
|
57
|
+
},
|
|
58
|
+
get readonly() {
|
|
59
|
+
return readonly.value;
|
|
60
|
+
},
|
|
61
|
+
get internal() {
|
|
62
|
+
return internal.value;
|
|
63
|
+
},
|
|
64
|
+
get ignore() {
|
|
65
|
+
return ignore.value;
|
|
66
|
+
},
|
|
67
|
+
get hidden() {
|
|
68
|
+
return hidden.value;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}), createComponent(Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return memo(() => !!!isUndefined(children))() && childrenArray(() => children).filter(Boolean).length > 0;
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return [createComponent(Show, {
|
|
78
|
+
get when() {
|
|
79
|
+
return hasAttributes.value;
|
|
80
|
+
},
|
|
81
|
+
get children() {
|
|
82
|
+
return createComponent(Spacing, {});
|
|
83
|
+
}
|
|
84
|
+
}), createComponent(List, { get children() {
|
|
85
|
+
return childrenArray(() => children);
|
|
86
|
+
} })];
|
|
87
|
+
}
|
|
88
|
+
})];
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
58
91
|
}
|
|
59
92
|
/**
|
|
60
93
|
* Uses the `useReflectionClass` hook to retrieve the reflection class from the context, and then renders a `TSDocReflectionClass` component with the retrieved reflection class. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection class without having to manually retrieve the reflection class from the context.
|
|
61
94
|
*/
|
|
62
95
|
function TSDocContextClass(props) {
|
|
63
96
|
const reflectionClass = useReflectionClass();
|
|
64
|
-
return
|
|
65
|
-
when
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
97
|
+
return createComponent(Show, {
|
|
98
|
+
get when() {
|
|
99
|
+
return isSetObject(reflectionClass.reflection);
|
|
100
|
+
},
|
|
101
|
+
get children() {
|
|
102
|
+
return createComponent(TSDocReflectionClass, mergeProps(props, { get reflection() {
|
|
103
|
+
return reflectionClass.reflection;
|
|
104
|
+
} }));
|
|
105
|
+
}
|
|
70
106
|
});
|
|
71
107
|
}
|
|
72
108
|
/**
|
|
@@ -76,43 +112,76 @@ function TSDocReflectionProperty(props) {
|
|
|
76
112
|
const [{ children, reflection }, rest] = splitProps(props, ["children", "reflection"]);
|
|
77
113
|
if (!isSetObject(reflection)) return null;
|
|
78
114
|
const hasAttributes = computed(() => isSetString(reflection.getTitle()) || !isUndefined(reflection.getAlias()) && reflection.getAlias().length > 0 || !isUndefined(reflection.getPermission()) && reflection.getPermission().length > 0 || isSetString(reflection.getDomain()) || !isUndefined(reflection.isReadonly()) || !isUndefined(reflection.isInternal()) || !isUndefined(reflection.isIgnored()) || !isUndefined(reflection.isHidden()) || reflection.hasDefault() && !isUndefined(reflection.getDefaultValue()));
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
when
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
115
|
+
return createComponent(TSDoc, mergeProps({ get heading() {
|
|
116
|
+
return reflection.getDescription();
|
|
117
|
+
} }, rest, { get children() {
|
|
118
|
+
return [createComponent(Show, {
|
|
119
|
+
get when() {
|
|
120
|
+
return hasAttributes.value;
|
|
121
|
+
},
|
|
122
|
+
get children() {
|
|
123
|
+
return createComponent(TSDocAttributesTags, {
|
|
124
|
+
type: reflection,
|
|
125
|
+
get title() {
|
|
126
|
+
return reflection.getTitle();
|
|
127
|
+
},
|
|
128
|
+
get alias() {
|
|
129
|
+
return reflection.getAlias();
|
|
130
|
+
},
|
|
131
|
+
get domain() {
|
|
132
|
+
return reflection.getDomain();
|
|
133
|
+
},
|
|
134
|
+
get permission() {
|
|
135
|
+
return reflection.getPermission();
|
|
136
|
+
},
|
|
137
|
+
get readonly() {
|
|
138
|
+
return reflection.isReadonly();
|
|
139
|
+
},
|
|
140
|
+
get internal() {
|
|
141
|
+
return reflection.isInternal();
|
|
142
|
+
},
|
|
143
|
+
get ignore() {
|
|
144
|
+
return reflection.isIgnored();
|
|
145
|
+
},
|
|
146
|
+
get hidden() {
|
|
147
|
+
return reflection.isHidden();
|
|
148
|
+
},
|
|
149
|
+
get defaultValue() {
|
|
150
|
+
return reflection.getDefaultValue();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}), createComponent(Show, {
|
|
155
|
+
get when() {
|
|
156
|
+
return memo(() => !!!isUndefined(children))() && childrenArray(() => children).filter(Boolean).length > 0;
|
|
157
|
+
},
|
|
158
|
+
get children() {
|
|
159
|
+
return [createComponent(Show, {
|
|
160
|
+
get when() {
|
|
161
|
+
return hasAttributes.value;
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return createComponent(Spacing, {});
|
|
165
|
+
}
|
|
166
|
+
}), createComponent(List, { get children() {
|
|
167
|
+
return childrenArray(() => children);
|
|
168
|
+
} })];
|
|
169
|
+
}
|
|
170
|
+
})];
|
|
171
|
+
} }));
|
|
104
172
|
}
|
|
105
173
|
/**
|
|
106
174
|
* Uses the `useReflectionProperty` hook to retrieve the reflection property from the context, and then renders a `TSDocReflectionProperty` component with the retrieved reflection property. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection property without having to manually retrieve the reflection property from the context.
|
|
107
175
|
*/
|
|
108
176
|
function TSDocContextProperty(props) {
|
|
109
177
|
const reflection = useReflectionProperty();
|
|
110
|
-
return
|
|
111
|
-
when
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
178
|
+
return createComponent(Show, {
|
|
179
|
+
get when() {
|
|
180
|
+
return isSetObject(reflection);
|
|
181
|
+
},
|
|
182
|
+
get children() {
|
|
183
|
+
return createComponent(TSDocReflectionProperty, mergeProps(props, { reflection }));
|
|
184
|
+
}
|
|
116
185
|
});
|
|
117
186
|
}
|
|
118
187
|
/**
|
|
@@ -121,60 +190,112 @@ function TSDocContextProperty(props) {
|
|
|
121
190
|
function TSDocReflectionMethod(props) {
|
|
122
191
|
const [{ children, reflection }, rest] = splitProps(props, ["children", "reflection"]);
|
|
123
192
|
if (!isSetObject(reflection)) return null;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
193
|
+
const heading = computed(() => reflection.getDescription() || (isString(reflection.getName()) ? code`${String(reflection.getName())} method definition` : void 0));
|
|
194
|
+
return createComponent(TSDoc, mergeProps({ get heading() {
|
|
195
|
+
return heading.value;
|
|
196
|
+
} }, rest, { get children() {
|
|
197
|
+
return [
|
|
198
|
+
createComponent(TSDocAttributesTags, {
|
|
199
|
+
get title() {
|
|
200
|
+
return reflection.getTitle();
|
|
201
|
+
},
|
|
202
|
+
get alias() {
|
|
203
|
+
return reflection.getAlias();
|
|
204
|
+
},
|
|
205
|
+
get domain() {
|
|
206
|
+
return reflection.getDomain();
|
|
207
|
+
},
|
|
208
|
+
get permission() {
|
|
209
|
+
return reflection.getPermission();
|
|
210
|
+
},
|
|
211
|
+
get readonly() {
|
|
212
|
+
return reflection.isReadonly();
|
|
213
|
+
},
|
|
214
|
+
get internal() {
|
|
215
|
+
return reflection.isInternal();
|
|
216
|
+
},
|
|
217
|
+
get ignore() {
|
|
218
|
+
return reflection.isIgnored();
|
|
219
|
+
},
|
|
220
|
+
get hidden() {
|
|
221
|
+
return reflection.isHidden();
|
|
222
|
+
}
|
|
137
223
|
}),
|
|
138
|
-
|
|
139
|
-
when
|
|
140
|
-
|
|
224
|
+
createComponent(Show, {
|
|
225
|
+
get when() {
|
|
226
|
+
return memo(() => !!Boolean(children))() && childrenArray(() => children).length > 0;
|
|
227
|
+
},
|
|
228
|
+
get children() {
|
|
229
|
+
return createComponent(List, { get children() {
|
|
230
|
+
return childrenArray(() => children);
|
|
231
|
+
} });
|
|
232
|
+
}
|
|
141
233
|
}),
|
|
142
|
-
|
|
143
|
-
when
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
234
|
+
createComponent(Show, {
|
|
235
|
+
get when() {
|
|
236
|
+
return reflection.getParameters().length > 0;
|
|
237
|
+
},
|
|
238
|
+
get children() {
|
|
239
|
+
return [createComponent(Spacing, {}), createComponent(For, {
|
|
240
|
+
get each() {
|
|
241
|
+
return reflection.getParameters();
|
|
242
|
+
},
|
|
243
|
+
hardline: true,
|
|
244
|
+
get ender() {
|
|
245
|
+
return createIntrinsic("hbr", {});
|
|
246
|
+
},
|
|
247
|
+
children: (param) => createComponent(TSDocParam, {
|
|
248
|
+
get name() {
|
|
249
|
+
return param.getName();
|
|
250
|
+
},
|
|
251
|
+
get optional() {
|
|
252
|
+
return param.isOptional();
|
|
253
|
+
},
|
|
254
|
+
get defaultValue() {
|
|
255
|
+
return memo(() => !!param.hasDefault())() ? param.getDefaultValue() : void 0;
|
|
256
|
+
},
|
|
257
|
+
get children() {
|
|
258
|
+
return createComponent(Show, {
|
|
259
|
+
get when() {
|
|
260
|
+
return Boolean(param.parameter.description);
|
|
261
|
+
},
|
|
262
|
+
get fallback() {
|
|
263
|
+
return code`A parameter to provide a ${param.getName()} value to the function.`;
|
|
264
|
+
},
|
|
265
|
+
get children() {
|
|
266
|
+
return param.parameter.description;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
156
270
|
})
|
|
157
|
-
})
|
|
158
|
-
}
|
|
271
|
+
})];
|
|
272
|
+
}
|
|
159
273
|
}),
|
|
160
|
-
|
|
161
|
-
when
|
|
162
|
-
|
|
274
|
+
createComponent(Show, {
|
|
275
|
+
get when() {
|
|
276
|
+
return reflection.getReturnType().kind !== ReflectionKind.void;
|
|
277
|
+
},
|
|
278
|
+
get children() {
|
|
279
|
+
return [createComponent(Spacing, {}), createComponent(TSDocReturns, { get children() {
|
|
280
|
+
return code`The return value of the function, which is of type ${stringifyType(reflection.getReturnType())}.`;
|
|
281
|
+
} })];
|
|
282
|
+
}
|
|
163
283
|
})
|
|
164
|
-
]
|
|
165
|
-
});
|
|
284
|
+
];
|
|
285
|
+
} }));
|
|
166
286
|
}
|
|
167
287
|
/**
|
|
168
288
|
* Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.
|
|
169
289
|
*/
|
|
170
290
|
function TSDocContextMethod(props) {
|
|
171
291
|
const reflection = useReflectionMethod();
|
|
172
|
-
return
|
|
173
|
-
when
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
292
|
+
return createComponent(Show, {
|
|
293
|
+
get when() {
|
|
294
|
+
return isSetObject(reflection);
|
|
295
|
+
},
|
|
296
|
+
get children() {
|
|
297
|
+
return createComponent(TSDocReflectionMethod, mergeProps(props, { reflection }));
|
|
298
|
+
}
|
|
178
299
|
});
|
|
179
300
|
}
|
|
180
301
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdoc-reflection.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc-reflection.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 childrenArray,\n code,\n computed,\n For,\n List,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionMethod,\n ReflectionProperty,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport {\n useReflectionClass,\n useReflectionMethod,\n useReflectionProperty\n} from \"../../core/contexts/reflection\";\nimport {\n TSDoc,\n TSDocAttributesTags,\n TSDocParam,\n TSDocProps,\n TSDocReturns\n} from \"./tsdoc\";\n\nexport interface TSDocReflectionClassProps<\n T extends Record<string, any> = Record<string, any>\n> extends TSDocProps {\n reflection: ReflectionClass<T>;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.\n */\nexport function TSDocReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocReflectionClassProps<T>) {\n const [{ children, heading, reflection }, rest] = splitProps(props, [\n \"heading\",\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const title = computed(\n () => reflection.getTitle() || titleCase(reflection.getName())\n );\n const computedHeading = computed(\n () => heading || reflection.getDescription() || title.value\n );\n\n const alias = computed(() => reflection.getAlias());\n const domain = computed(() => reflection.getDomain());\n const permission = computed(() => reflection.getPermission());\n const readonly = computed(() => reflection.isReadonly());\n const internal = computed(() => reflection.isInternal());\n const ignore = computed(() => reflection.isIgnored());\n const hidden = computed(() => reflection.isHidden());\n\n if (\n !computedHeading.value ||\n (isSetString(computedHeading.value) && computedHeading.value.trim() === \"\")\n ) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(title.value) ||\n (!isUndefined(alias.value) && alias.value.length > 0) ||\n (!isUndefined(permission.value) && permission.value.length > 0) ||\n isSetString(domain.value) ||\n !isUndefined(readonly.value) ||\n !isUndefined(internal.value) ||\n !isUndefined(ignore.value) ||\n !isUndefined(hidden.value)\n );\n\n return (\n <TSDoc\n {...rest}\n heading={\n isSetString(computedHeading.value)\n ? computedHeading.value.trim()\n : computedHeading.value\n }>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n title={title.value}\n alias={alias.value}\n domain={domain.value}\n permission={permission.value}\n readonly={readonly.value}\n internal={internal.value}\n ignore={ignore.value}\n hidden={hidden.value}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionClass` hook to retrieve the reflection class from the context, and then renders a `TSDocReflectionClass` component with the retrieved reflection class. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection class without having to manually retrieve the reflection class from the context.\n */\nexport function TSDocContextClass<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocProps) {\n const reflectionClass = useReflectionClass<T>();\n\n return (\n <Show when={isSetObject(reflectionClass.reflection)}>\n <TSDocReflectionClass\n {...props}\n reflection={reflectionClass.reflection}\n />\n </Show>\n );\n}\n\nexport interface TSDocReflectionPropertyProps extends TSDocProps {\n reflection: ReflectionProperty;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.\n */\nexport function TSDocReflectionProperty(props: TSDocReflectionPropertyProps) {\n const [{ children, reflection }, rest] = splitProps(props, [\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(reflection.getTitle()) ||\n (!isUndefined(reflection.getAlias()) &&\n reflection.getAlias().length > 0) ||\n (!isUndefined(reflection.getPermission()) &&\n reflection.getPermission().length > 0) ||\n isSetString(reflection.getDomain()) ||\n !isUndefined(reflection.isReadonly()) ||\n !isUndefined(reflection.isInternal()) ||\n !isUndefined(reflection.isIgnored()) ||\n !isUndefined(reflection.isHidden()) ||\n (reflection.hasDefault() && !isUndefined(reflection.getDefaultValue()))\n );\n\n return (\n <TSDoc heading={reflection.getDescription()} {...rest}>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={reflection}\n title={reflection.getTitle()}\n alias={reflection.getAlias()}\n domain={reflection.getDomain()}\n permission={reflection.getPermission()}\n readonly={reflection.isReadonly()}\n internal={reflection.isInternal()}\n ignore={reflection.isIgnored()}\n hidden={reflection.isHidden()}\n defaultValue={reflection.getDefaultValue()}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionProperty` hook to retrieve the reflection property from the context, and then renders a `TSDocReflectionProperty` component with the retrieved reflection property. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection property without having to manually retrieve the reflection property from the context.\n */\nexport function TSDocContextProperty(props: TSDocProps) {\n const reflection = useReflectionProperty();\n\n return (\n <Show when={isSetObject(reflection)}>\n <TSDocReflectionProperty {...props} reflection={reflection} />\n </Show>\n );\n}\n\nexport interface TSDocReflectionMethodProps extends TSDocProps {\n reflection: ReflectionMethod;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection method. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. Additionally, this component will render information about the parameters and return type of the method, if available.\n */\nexport function TSDocReflectionMethod(props: TSDocReflectionMethodProps) {\n const [{ children, reflection }, rest] = splitProps(props, [\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const heading = computed(\n () =>\n reflection.getDescription() ||\n (isString(reflection.getName())\n ? code`${String(reflection.getName())} method definition`\n : undefined)\n );\n\n return (\n <TSDoc heading={heading.value} {...rest}>\n <TSDocAttributesTags\n title={reflection.getTitle()}\n alias={reflection.getAlias()}\n domain={reflection.getDomain()}\n permission={reflection.getPermission()}\n readonly={reflection.isReadonly()}\n internal={reflection.isInternal()}\n ignore={reflection.isIgnored()}\n hidden={reflection.isHidden()}\n />\n <Show\n when={Boolean(children) && childrenArray(() => children).length > 0}>\n <List>{childrenArray(() => children)}</List>\n </Show>\n <Show when={reflection.getParameters().length > 0}>\n <Spacing />\n <For each={reflection.getParameters()} hardline ender={<hbr />}>\n {param => (\n <TSDocParam\n name={param.getName()}\n optional={param.isOptional()}\n defaultValue={\n param.hasDefault() ? param.getDefaultValue() : undefined\n }>\n <Show\n when={Boolean(param.parameter.description)}\n fallback={code`A parameter to provide a ${param.getName()} value to the function.`}>\n {param.parameter.description}\n </Show>\n </TSDocParam>\n )}\n </For>\n </Show>\n <Show when={reflection.getReturnType().kind !== ReflectionKind.void}>\n <Spacing />\n <TSDocReturns>\n {code`The return value of the function, which is of type ${stringifyType(\n reflection.getReturnType()\n )}.`}\n </TSDocReturns>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.\n */\nexport function TSDocContextMethod(props: TSDocProps) {\n const reflection = useReflectionMethod();\n\n return (\n <Show when={isSetObject(reflection)}>\n <TSDocReflectionMethod {...props} reflection={reflection} />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8DA,SAAgB,qBAEd,OAAqC;CACrC,MAAM,CAAC,EAAE,UAAU,SAAS,cAAc,QAAQ,WAAW,OAAO;EAClE;EACA;EACA;EACD,CAAC;AAEF,KAAI,CAAC,YAAY,WAAW,CAC1B,QAAO;CAGT,MAAM,QAAQ,eACN,WAAW,UAAU,IAAI,UAAU,WAAW,SAAS,CAAC,CAC/D;CACD,MAAM,kBAAkB,eAChB,WAAW,WAAW,gBAAgB,IAAI,MAAM,MACvD;CAED,MAAM,QAAQ,eAAe,WAAW,UAAU,CAAC;CACnD,MAAM,SAAS,eAAe,WAAW,WAAW,CAAC;CACrD,MAAM,aAAa,eAAe,WAAW,eAAe,CAAC;CAC7D,MAAM,WAAW,eAAe,WAAW,YAAY,CAAC;CACxD,MAAM,WAAW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;MACI;KAEX,EACD;;GACP,qBAAC,MAAD;IAAM,MAAM,WAAW,eAAe,CAAC,SAAS,eAAe;cAA/D,CACE,oBAAC,SAAD,EAAW,GACX,oBAAC,cAAD,YACG,IAAI,sDAAsD,cACzD,WAAW,eAAe,CAC3B,CAAC,IACW,EACV;;GACD;;;;;;AAOZ,SAAgB,mBAAmB,OAAmB;CACpD,MAAM,aAAa,qBAAqB;AAExC,QACE,oBAAC,MAAD;EAAM,MAAM,YAAY,WAAW;YACjC,oBAAC,uBAAD;GAAuB,GAAI;GAAmB;GAAc;EACvD"}
|
|
1
|
+
{"version":3,"file":"tsdoc-reflection.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc-reflection.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 childrenArray,\n code,\n computed,\n For,\n List,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionMethod,\n ReflectionProperty,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport {\n useReflectionClass,\n useReflectionMethod,\n useReflectionProperty\n} from \"../../core/contexts/reflection\";\nimport {\n TSDoc,\n TSDocAttributesTags,\n TSDocParam,\n TSDocProps,\n TSDocReturns\n} from \"./tsdoc\";\n\nexport interface TSDocReflectionClassProps<\n T extends Record<string, any> = Record<string, any>\n> extends TSDocProps {\n reflection: ReflectionClass<T>;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.\n */\nexport function TSDocReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocReflectionClassProps<T>) {\n const [{ children, heading, reflection }, rest] = splitProps(props, [\n \"heading\",\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const title = computed(\n () => reflection.getTitle() || titleCase(reflection.getName())\n );\n const computedHeading = computed(\n () => heading || reflection.getDescription() || title.value\n );\n\n const alias = computed(() => reflection.getAlias());\n const domain = computed(() => reflection.getDomain());\n const permission = computed(() => reflection.getPermission());\n const readonly = computed(() => reflection.isReadonly());\n const internal = computed(() => reflection.isInternal());\n const ignore = computed(() => reflection.isIgnored());\n const hidden = computed(() => reflection.isHidden());\n\n if (\n !computedHeading.value ||\n (isSetString(computedHeading.value) && computedHeading.value.trim() === \"\")\n ) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(title.value) ||\n (!isUndefined(alias.value) && alias.value.length > 0) ||\n (!isUndefined(permission.value) && permission.value.length > 0) ||\n isSetString(domain.value) ||\n !isUndefined(readonly.value) ||\n !isUndefined(internal.value) ||\n !isUndefined(ignore.value) ||\n !isUndefined(hidden.value)\n );\n\n return (\n <TSDoc\n {...rest}\n heading={\n isSetString(computedHeading.value)\n ? computedHeading.value.trim()\n : computedHeading.value\n }>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n title={title.value}\n alias={alias.value}\n domain={domain.value}\n permission={permission.value}\n readonly={readonly.value}\n internal={internal.value}\n ignore={ignore.value}\n hidden={hidden.value}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionClass` hook to retrieve the reflection class from the context, and then renders a `TSDocReflectionClass` component with the retrieved reflection class. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection class without having to manually retrieve the reflection class from the context.\n */\nexport function TSDocContextClass<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocProps) {\n const reflectionClass = useReflectionClass<T>();\n\n return (\n <Show when={isSetObject(reflectionClass.reflection)}>\n <TSDocReflectionClass\n {...props}\n reflection={reflectionClass.reflection}\n />\n </Show>\n );\n}\n\nexport interface TSDocReflectionPropertyProps extends TSDocProps {\n reflection: ReflectionProperty;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.\n */\nexport function TSDocReflectionProperty(props: TSDocReflectionPropertyProps) {\n const [{ children, reflection }, rest] = splitProps(props, [\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(reflection.getTitle()) ||\n (!isUndefined(reflection.getAlias()) &&\n reflection.getAlias().length > 0) ||\n (!isUndefined(reflection.getPermission()) &&\n reflection.getPermission().length > 0) ||\n isSetString(reflection.getDomain()) ||\n !isUndefined(reflection.isReadonly()) ||\n !isUndefined(reflection.isInternal()) ||\n !isUndefined(reflection.isIgnored()) ||\n !isUndefined(reflection.isHidden()) ||\n (reflection.hasDefault() && !isUndefined(reflection.getDefaultValue()))\n );\n\n return (\n <TSDoc heading={reflection.getDescription()} {...rest}>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={reflection}\n title={reflection.getTitle()}\n alias={reflection.getAlias()}\n domain={reflection.getDomain()}\n permission={reflection.getPermission()}\n readonly={reflection.isReadonly()}\n internal={reflection.isInternal()}\n ignore={reflection.isIgnored()}\n hidden={reflection.isHidden()}\n defaultValue={reflection.getDefaultValue()}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionProperty` hook to retrieve the reflection property from the context, and then renders a `TSDocReflectionProperty` component with the retrieved reflection property. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection property without having to manually retrieve the reflection property from the context.\n */\nexport function TSDocContextProperty(props: TSDocProps) {\n const reflection = useReflectionProperty();\n\n return (\n <Show when={isSetObject(reflection)}>\n <TSDocReflectionProperty {...props} reflection={reflection} />\n </Show>\n );\n}\n\nexport interface TSDocReflectionMethodProps extends TSDocProps {\n reflection: ReflectionMethod;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection method. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. Additionally, this component will render information about the parameters and return type of the method, if available.\n */\nexport function TSDocReflectionMethod(props: TSDocReflectionMethodProps) {\n const [{ children, reflection }, rest] = splitProps(props, [\n \"children\",\n \"reflection\"\n ]);\n\n if (!isSetObject(reflection)) {\n return null;\n }\n\n const heading = computed(\n () =>\n reflection.getDescription() ||\n (isString(reflection.getName())\n ? code`${String(reflection.getName())} method definition`\n : undefined)\n );\n\n return (\n <TSDoc heading={heading.value} {...rest}>\n <TSDocAttributesTags\n title={reflection.getTitle()}\n alias={reflection.getAlias()}\n domain={reflection.getDomain()}\n permission={reflection.getPermission()}\n readonly={reflection.isReadonly()}\n internal={reflection.isInternal()}\n ignore={reflection.isIgnored()}\n hidden={reflection.isHidden()}\n />\n <Show\n when={Boolean(children) && childrenArray(() => children).length > 0}>\n <List>{childrenArray(() => children)}</List>\n </Show>\n <Show when={reflection.getParameters().length > 0}>\n <Spacing />\n <For each={reflection.getParameters()} hardline ender={<hbr />}>\n {param => (\n <TSDocParam\n name={param.getName()}\n optional={param.isOptional()}\n defaultValue={\n param.hasDefault() ? param.getDefaultValue() : undefined\n }>\n <Show\n when={Boolean(param.parameter.description)}\n fallback={code`A parameter to provide a ${param.getName()} value to the function.`}>\n {param.parameter.description}\n </Show>\n </TSDocParam>\n )}\n </For>\n </Show>\n <Show when={reflection.getReturnType().kind !== ReflectionKind.void}>\n <Spacing />\n <TSDocReturns>\n {code`The return value of the function, which is of type ${stringifyType(\n reflection.getReturnType()\n )}.`}\n </TSDocReturns>\n </Show>\n </TSDoc>\n );\n}\n\n/**\n * Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.\n */\nexport function TSDocContextMethod(props: TSDocProps) {\n const reflection = useReflectionMethod();\n\n return (\n <Show when={isSetObject(reflection)}>\n <TSDocReflectionMethod {...props} reflection={reflection} />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,SAAS,qBAAsD,OAAA;CAC/D,MAAQ,CAAC,EACT,UACA,SACA,cACE,QAAA,WAAkB,OAAA;EAAA;EAAA;EAAA;EAAA,CAAA;AAClB,KAAA,CAAA,YAAA,WAAmB,CACnB,QAAA;CAEF,MAAO,QAAA,eAAA,WAAA,UAAA,IAAA,UAAA,WAAA,SAAA,CAAA,CAAA;CACL,MAAK,kBAAA,eAAA,WAAA,WAAA,gBAAA,IAAA,MAAA,MAAA;CACL,MAAA,QAAA,eAAmB,WAAA,UAAA,CAA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