@powerlines/plugin-alloy 0.21.3 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/contexts/reflection.d.cts.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/helpers/index.mjs +2 -2
- package/dist/helpers/typescript.cjs +2 -2
- package/dist/helpers/typescript.d.cts +6 -6
- package/dist/helpers/typescript.d.cts.map +1 -1
- package/dist/helpers/typescript.d.mts +6 -6
- package/dist/helpers/typescript.d.mts.map +1 -1
- package/dist/helpers/typescript.mjs +2 -2
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/front-matter.d.cts.map +1 -1
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/markdown/contexts/markdown-table.d.cts.map +1 -1
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/class-declaration.cjs +112 -14
- package/dist/typescript/components/class-declaration.d.cts +55 -1
- package/dist/typescript/components/class-declaration.d.cts.map +1 -1
- package/dist/typescript/components/class-declaration.d.mts +55 -1
- package/dist/typescript/components/class-declaration.d.mts.map +1 -1
- package/dist/typescript/components/class-declaration.mjs +112 -16
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/index.cjs +14 -10
- package/dist/typescript/components/index.d.cts +5 -5
- package/dist/typescript/components/index.d.mts +5 -5
- package/dist/typescript/components/index.mjs +6 -6
- package/dist/typescript/components/interface-declaration.cjs +225 -0
- package/dist/typescript/components/interface-declaration.d.cts +82 -0
- package/dist/typescript/components/interface-declaration.d.cts.map +1 -0
- package/dist/typescript/components/interface-declaration.d.mts +82 -0
- package/dist/typescript/components/interface-declaration.d.mts.map +1 -0
- package/dist/typescript/components/interface-declaration.mjs +222 -0
- package/dist/typescript/components/interface-declaration.mjs.map +1 -0
- package/dist/typescript/components/{typescript-object.cjs → object-declaration.cjs} +6 -6
- package/dist/typescript/components/object-declaration.d.cts +30 -0
- package/dist/typescript/components/object-declaration.d.cts.map +1 -0
- package/dist/typescript/components/object-declaration.d.mts +30 -0
- package/dist/typescript/components/object-declaration.d.mts.map +1 -0
- package/dist/typescript/components/{typescript-object.mjs → object-declaration.mjs} +6 -6
- package/dist/typescript/components/object-declaration.mjs.map +1 -0
- package/dist/typescript/components/{typescript-property-name.cjs → property-name.cjs} +3 -3
- package/dist/typescript/components/{typescript-property-name.d.mts → property-name.d.cts} +7 -7
- package/dist/typescript/components/property-name.d.cts.map +1 -0
- package/dist/typescript/components/{typescript-property-name.d.cts → property-name.d.mts} +7 -7
- package/dist/typescript/components/property-name.d.mts.map +1 -0
- package/dist/typescript/components/{typescript-property-name.mjs → property-name.mjs} +4 -4
- package/dist/typescript/components/property-name.mjs.map +1 -0
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +8 -12
- package/dist/typescript/components/tsdoc.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc.mjs +8 -12
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
- package/dist/typescript/index.cjs +13 -9
- package/dist/typescript/index.d.cts +5 -5
- package/dist/typescript/index.d.mts +5 -5
- package/dist/typescript/index.mjs +6 -6
- package/package.json +48 -48
- package/dist/typescript/components/typescript-interface.cjs +0 -73
- package/dist/typescript/components/typescript-interface.d.cts +0 -26
- package/dist/typescript/components/typescript-interface.d.cts.map +0 -1
- package/dist/typescript/components/typescript-interface.d.mts +0 -26
- package/dist/typescript/components/typescript-interface.d.mts.map +0 -1
- package/dist/typescript/components/typescript-interface.mjs +0 -72
- package/dist/typescript/components/typescript-interface.mjs.map +0 -1
- package/dist/typescript/components/typescript-object.d.cts +0 -30
- package/dist/typescript/components/typescript-object.d.cts.map +0 -1
- package/dist/typescript/components/typescript-object.d.mts +0 -30
- package/dist/typescript/components/typescript-object.d.mts.map +0 -1
- package/dist/typescript/components/typescript-object.mjs.map +0 -1
- package/dist/typescript/components/typescript-property-name.d.cts.map +0 -1
- package/dist/typescript/components/typescript-property-name.d.mts.map +0 -1
- package/dist/typescript/components/typescript-property-name.mjs.map +0 -1
|
@@ -5,14 +5,17 @@ require('../contexts/index.cjs');
|
|
|
5
5
|
const require_typescript_contexts_member_scope = require('../contexts/member-scope.cjs');
|
|
6
6
|
const require_typescript_helpers_get_call_signature_props = require('../helpers/get-call-signature-props.cjs');
|
|
7
7
|
require('../helpers/index.cjs');
|
|
8
|
+
const require_typescript_components_property_name = require('./property-name.cjs');
|
|
8
9
|
const require_typescript_components_type_parameters = require('./type-parameters.cjs');
|
|
9
|
-
const require_typescript_components_typescript_property_name = require('./typescript-property-name.cjs');
|
|
10
10
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
11
11
|
let __alloy_js_core = require("@alloy-js/core");
|
|
12
12
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
13
13
|
|
|
14
14
|
//#region src/typescript/components/class-declaration.tsx
|
|
15
15
|
/**
|
|
16
|
+
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
16
19
|
* Create a TypeScript class declaration.
|
|
17
20
|
*
|
|
18
21
|
* @example
|
|
@@ -70,9 +73,9 @@ function ClassDeclaration(props) {
|
|
|
70
73
|
return Boolean(props.doc);
|
|
71
74
|
},
|
|
72
75
|
get children() {
|
|
73
|
-
return
|
|
76
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
74
77
|
return props.doc;
|
|
75
|
-
} })
|
|
78
|
+
} });
|
|
76
79
|
}
|
|
77
80
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.Declaration, {
|
|
78
81
|
symbol: sym,
|
|
@@ -106,6 +109,15 @@ function ClassDeclaration(props) {
|
|
|
106
109
|
})];
|
|
107
110
|
}
|
|
108
111
|
ClassDeclaration.TypeParameters = require_typescript_components_type_parameters.TypeParameters;
|
|
112
|
+
/**
|
|
113
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
117
|
+
*
|
|
118
|
+
* @param props - The properties of the class member, including its name, visibility, and other modifiers.
|
|
119
|
+
* @returns A JSX element representing the class member declaration, which can be used within a ClassDeclaration component.
|
|
120
|
+
*/
|
|
109
121
|
function ClassMember(props) {
|
|
110
122
|
let tsFlags = __alloy_js_typescript.TSSymbolFlags.None;
|
|
111
123
|
if (props.nullish) tsFlags |= __alloy_js_typescript.TSSymbolFlags.Nullish;
|
|
@@ -119,9 +131,9 @@ function ClassMember(props) {
|
|
|
119
131
|
return Boolean(props.doc);
|
|
120
132
|
},
|
|
121
133
|
get children() {
|
|
122
|
-
return
|
|
134
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
123
135
|
return props.doc;
|
|
124
|
-
} })
|
|
136
|
+
} });
|
|
125
137
|
}
|
|
126
138
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.MemberDeclaration, {
|
|
127
139
|
symbol: sym,
|
|
@@ -130,12 +142,22 @@ function ClassMember(props) {
|
|
|
130
142
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.public && "public "),
|
|
131
143
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.private && "private "),
|
|
132
144
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.protected && "protected "),
|
|
145
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => props.abstract && "abstract "),
|
|
133
146
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.static && "static "),
|
|
134
147
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.children)
|
|
135
148
|
];
|
|
136
149
|
}
|
|
137
150
|
})];
|
|
138
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
154
|
+
*/
|
|
155
|
+
/**
|
|
156
|
+
* Generates a TypeScript class field declaration for the given reflection class.
|
|
157
|
+
*
|
|
158
|
+
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
159
|
+
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
160
|
+
*/
|
|
139
161
|
function ClassField(props) {
|
|
140
162
|
const optionality = props.optional ? "?" : "";
|
|
141
163
|
const typeSection = props.type && [
|
|
@@ -150,13 +172,84 @@ function ClassField(props) {
|
|
|
150
172
|
nullish: props.nullish ?? props.optional,
|
|
151
173
|
get children() {
|
|
152
174
|
return [
|
|
153
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
175
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, { get ["private"]() {
|
|
176
|
+
return props.isPrivateMember;
|
|
177
|
+
} }),
|
|
154
178
|
typeSection,
|
|
155
179
|
initializerSection
|
|
156
180
|
];
|
|
157
181
|
}
|
|
158
182
|
}));
|
|
159
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
186
|
+
*/
|
|
187
|
+
/**
|
|
188
|
+
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
189
|
+
*
|
|
190
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
191
|
+
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
192
|
+
*/
|
|
193
|
+
function ClassPropertySet(props) {
|
|
194
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { get children() {
|
|
195
|
+
return [
|
|
196
|
+
" set ",
|
|
197
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {}),
|
|
198
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
199
|
+
return [
|
|
200
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.CallSignature, { get parameters() {
|
|
201
|
+
return [{
|
|
202
|
+
name: "value",
|
|
203
|
+
type: (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeRefContext, { get children() {
|
|
204
|
+
return props.type;
|
|
205
|
+
} })
|
|
206
|
+
}];
|
|
207
|
+
} }),
|
|
208
|
+
" ",
|
|
209
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Block, { get children() {
|
|
210
|
+
return props.children;
|
|
211
|
+
} })
|
|
212
|
+
];
|
|
213
|
+
} })
|
|
214
|
+
];
|
|
215
|
+
} }))];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
219
|
+
*
|
|
220
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
221
|
+
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
222
|
+
*/
|
|
223
|
+
function ClassPropertyGet(props) {
|
|
224
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { get children() {
|
|
225
|
+
return [
|
|
226
|
+
" get ",
|
|
227
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {}),
|
|
228
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
229
|
+
return [
|
|
230
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.CallSignature, { get returnType() {
|
|
231
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeRefContext, { get children() {
|
|
232
|
+
return props.type;
|
|
233
|
+
} });
|
|
234
|
+
} }),
|
|
235
|
+
" ",
|
|
236
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Block, { get children() {
|
|
237
|
+
return props.children;
|
|
238
|
+
} })
|
|
239
|
+
];
|
|
240
|
+
} })
|
|
241
|
+
];
|
|
242
|
+
} }));
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
246
|
+
*/
|
|
247
|
+
/**
|
|
248
|
+
* Generates a TypeScript class method declaration for the given reflection class.
|
|
249
|
+
*
|
|
250
|
+
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
251
|
+
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
252
|
+
*/
|
|
160
253
|
function ClassMethod(props) {
|
|
161
254
|
const callProps = require_typescript_helpers_get_call_signature_props.getCallSignatureProps(props);
|
|
162
255
|
const [_, rest] = (0, __alloy_js_core.splitProps)(props, ["doc"]);
|
|
@@ -165,18 +258,21 @@ function ClassMethod(props) {
|
|
|
165
258
|
return Boolean(props.doc);
|
|
166
259
|
},
|
|
167
260
|
get children() {
|
|
168
|
-
return
|
|
169
|
-
|
|
261
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, {
|
|
262
|
+
get heading() {
|
|
170
263
|
return props.doc;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
264
|
+
},
|
|
265
|
+
get children() {
|
|
266
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Array.isArray(rest.parameters))() && (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocParams, { get parameters() {
|
|
267
|
+
return rest.parameters;
|
|
268
|
+
} });
|
|
269
|
+
}
|
|
270
|
+
});
|
|
175
271
|
}
|
|
176
272
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, { get children() {
|
|
177
273
|
return [
|
|
178
274
|
(0, __alloy_js_core_jsx_runtime.memo)(() => props.async && "async "),
|
|
179
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
275
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {}),
|
|
180
276
|
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
181
277
|
return [
|
|
182
278
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.CallSignature, callProps),
|
|
@@ -194,4 +290,6 @@ function ClassMethod(props) {
|
|
|
194
290
|
exports.ClassDeclaration = ClassDeclaration;
|
|
195
291
|
exports.ClassField = ClassField;
|
|
196
292
|
exports.ClassMember = ClassMember;
|
|
197
|
-
exports.ClassMethod = ClassMethod;
|
|
293
|
+
exports.ClassMethod = ClassMethod;
|
|
294
|
+
exports.ClassPropertyGet = ClassPropertyGet;
|
|
295
|
+
exports.ClassPropertySet = ClassPropertySet;
|
|
@@ -3,6 +3,9 @@ import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
|
3
3
|
import { CallSignatureProps, CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/class-declaration.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
8
|
+
*/
|
|
6
9
|
interface ClassDeclarationProps extends CommonDeclarationProps {
|
|
7
10
|
/**
|
|
8
11
|
* An indication of whether this class is abstract
|
|
@@ -55,6 +58,9 @@ declare function ClassDeclaration(props: ClassDeclarationProps): Children;
|
|
|
55
58
|
declare namespace ClassDeclaration {
|
|
56
59
|
var TypeParameters: typeof TypeParameters;
|
|
57
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
63
|
+
*/
|
|
58
64
|
interface ClassMemberProps {
|
|
59
65
|
name: string | Namekey;
|
|
60
66
|
refkey?: Refkey;
|
|
@@ -63,26 +69,74 @@ interface ClassMemberProps {
|
|
|
63
69
|
protected?: boolean;
|
|
64
70
|
jsPrivate?: boolean;
|
|
65
71
|
static?: boolean;
|
|
72
|
+
abstract?: boolean;
|
|
66
73
|
children?: Children;
|
|
67
74
|
doc?: Children;
|
|
68
75
|
nullish?: boolean;
|
|
69
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
79
|
+
*
|
|
80
|
+
* @param props - The properties of the class member, including its name, visibility, and other modifiers.
|
|
81
|
+
* @returns A JSX element representing the class member declaration, which can be used within a ClassDeclaration component.
|
|
82
|
+
*/
|
|
70
83
|
declare function ClassMember(props: ClassMemberProps): Children;
|
|
84
|
+
/**
|
|
85
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
86
|
+
*/
|
|
71
87
|
interface ClassFieldProps extends ClassMemberProps {
|
|
72
88
|
type?: Children;
|
|
73
89
|
optional?: boolean;
|
|
74
90
|
children?: Children;
|
|
91
|
+
isPrivateMember?: boolean;
|
|
75
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Generates a TypeScript class field declaration for the given reflection class.
|
|
95
|
+
*
|
|
96
|
+
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
97
|
+
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
98
|
+
*/
|
|
76
99
|
declare function ClassField(props: ClassFieldProps): Children;
|
|
100
|
+
/**
|
|
101
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
102
|
+
*/
|
|
103
|
+
interface ClassPropertyProps extends ClassMemberProps {
|
|
104
|
+
type?: Children;
|
|
105
|
+
children?: Children;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
109
|
+
*
|
|
110
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
111
|
+
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
112
|
+
*/
|
|
113
|
+
declare function ClassPropertySet(props: ClassPropertyProps): Children;
|
|
114
|
+
/**
|
|
115
|
+
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
116
|
+
*
|
|
117
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
118
|
+
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
119
|
+
*/
|
|
120
|
+
declare function ClassPropertyGet(props: ClassPropertyProps): Children;
|
|
121
|
+
/**
|
|
122
|
+
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
123
|
+
*/
|
|
77
124
|
interface ClassMethodProps extends ClassMemberProps, CallSignatureProps {
|
|
78
125
|
async?: boolean;
|
|
79
126
|
children?: Children;
|
|
80
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Generates a TypeScript class method declaration for the given reflection class.
|
|
130
|
+
*
|
|
131
|
+
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
132
|
+
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
133
|
+
*/
|
|
81
134
|
declare function ClassMethod(props: ClassMethodProps): Children;
|
|
82
135
|
declare type __ΩClassDeclarationProps = any[];
|
|
83
136
|
declare type __ΩClassMemberProps = any[];
|
|
84
137
|
declare type __ΩClassFieldProps = any[];
|
|
138
|
+
declare type __ΩClassPropertyProps = any[];
|
|
85
139
|
declare type __ΩClassMethodProps = any[];
|
|
86
140
|
//#endregion
|
|
87
|
-
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps };
|
|
141
|
+
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps };
|
|
88
142
|
//# sourceMappingURL=class-declaration.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"class-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAoDiB,UAAA,qBAAA,SAA8B,sBAAR,CAAA;EAS3B;;;EATmC,QAAA,CAAA,EAAA,OAAA;EAAsB;AAoDrE;;EA4CiB,OAAA,CAAA,EAvFL,QAuFK;EACA;;;EAST,UAAA,CAAA,EA5FO,QA4FP,EAAA;EAAQ;AAUhB;AAgCA;EACS,cAAA,CAAA,EAlIU,uBAkIV,EAAA,GAAA,MAAA,EAAA;;;;AAYT;AAsBA;;;;;AAWA;AA4BA;AAkBA;;;;;AAWA;;;;;;;;;;;;;;;iBAvMgB,gBAAA,QAAwB,wBAAqB;kBAA7C,gBAAA;6BAAgB;;;;;UA4Cf,gBAAA;iBACA;WACN;;;;;;;aAOE;QACL;;;;;;;;;iBAUQ,WAAA,QAAmB,mBAAgB;;;;UAgClC,eAAA,SAAwB;SAChC;;aAEI;;;;;;;;;iBAUG,UAAA,QAAkB,kBAAe;;;;UAsBhC,kBAAA,SAA2B;SACnC;aACI;;;;;;;;iBASG,gBAAA,QAAwB,qBAAkB;;;;;;;iBA4B1C,gBAAA,QAAwB,qBAAkB;;;;UAkBzC,gBAAA,SAAyB,kBAAkB;;aAE/C;;;;;;;;iBASG,WAAA,QAAmB,mBAAgB"}
|
|
@@ -3,6 +3,9 @@ import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
|
3
3
|
import { CallSignatureProps, CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/class-declaration.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
8
|
+
*/
|
|
6
9
|
interface ClassDeclarationProps extends CommonDeclarationProps {
|
|
7
10
|
/**
|
|
8
11
|
* An indication of whether this class is abstract
|
|
@@ -55,6 +58,9 @@ declare function ClassDeclaration(props: ClassDeclarationProps): Children;
|
|
|
55
58
|
declare namespace ClassDeclaration {
|
|
56
59
|
var TypeParameters: typeof TypeParameters;
|
|
57
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
63
|
+
*/
|
|
58
64
|
interface ClassMemberProps {
|
|
59
65
|
name: string | Namekey;
|
|
60
66
|
refkey?: Refkey;
|
|
@@ -63,26 +69,74 @@ interface ClassMemberProps {
|
|
|
63
69
|
protected?: boolean;
|
|
64
70
|
jsPrivate?: boolean;
|
|
65
71
|
static?: boolean;
|
|
72
|
+
abstract?: boolean;
|
|
66
73
|
children?: Children;
|
|
67
74
|
doc?: Children;
|
|
68
75
|
nullish?: boolean;
|
|
69
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
79
|
+
*
|
|
80
|
+
* @param props - The properties of the class member, including its name, visibility, and other modifiers.
|
|
81
|
+
* @returns A JSX element representing the class member declaration, which can be used within a ClassDeclaration component.
|
|
82
|
+
*/
|
|
70
83
|
declare function ClassMember(props: ClassMemberProps): Children;
|
|
84
|
+
/**
|
|
85
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
86
|
+
*/
|
|
71
87
|
interface ClassFieldProps extends ClassMemberProps {
|
|
72
88
|
type?: Children;
|
|
73
89
|
optional?: boolean;
|
|
74
90
|
children?: Children;
|
|
91
|
+
isPrivateMember?: boolean;
|
|
75
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Generates a TypeScript class field declaration for the given reflection class.
|
|
95
|
+
*
|
|
96
|
+
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
97
|
+
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
98
|
+
*/
|
|
76
99
|
declare function ClassField(props: ClassFieldProps): Children;
|
|
100
|
+
/**
|
|
101
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
102
|
+
*/
|
|
103
|
+
interface ClassPropertyProps extends ClassMemberProps {
|
|
104
|
+
type?: Children;
|
|
105
|
+
children?: Children;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
109
|
+
*
|
|
110
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
111
|
+
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
112
|
+
*/
|
|
113
|
+
declare function ClassPropertySet(props: ClassPropertyProps): Children;
|
|
114
|
+
/**
|
|
115
|
+
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
116
|
+
*
|
|
117
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
118
|
+
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
119
|
+
*/
|
|
120
|
+
declare function ClassPropertyGet(props: ClassPropertyProps): Children;
|
|
121
|
+
/**
|
|
122
|
+
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
123
|
+
*/
|
|
77
124
|
interface ClassMethodProps extends ClassMemberProps, CallSignatureProps {
|
|
78
125
|
async?: boolean;
|
|
79
126
|
children?: Children;
|
|
80
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Generates a TypeScript class method declaration for the given reflection class.
|
|
130
|
+
*
|
|
131
|
+
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
132
|
+
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
133
|
+
*/
|
|
81
134
|
declare function ClassMethod(props: ClassMethodProps): Children;
|
|
82
135
|
declare type __ΩClassDeclarationProps = any[];
|
|
83
136
|
declare type __ΩClassMemberProps = any[];
|
|
84
137
|
declare type __ΩClassFieldProps = any[];
|
|
138
|
+
declare type __ΩClassPropertyProps = any[];
|
|
85
139
|
declare type __ΩClassMethodProps = any[];
|
|
86
140
|
//#endregion
|
|
87
|
-
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps };
|
|
141
|
+
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps };
|
|
88
142
|
//# sourceMappingURL=class-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"class-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAoDiB,UAAA,qBAAA,SAA8B,sBAAR,CAAA;EAS3B;;;EATmC,QAAA,CAAA,EAAA,OAAA;EAAsB;AAoDrE;;EA4CiB,OAAA,CAAA,EAvFL,QAuFK;EACA;;;EAST,UAAA,CAAA,EA5FO,QA4FP,EAAA;EAAQ;AAUhB;AAgCA;EACS,cAAA,CAAA,EAlIU,uBAkIV,EAAA,GAAA,MAAA,EAAA;;;;AAYT;AAsBA;;;;;AAWA;AA4BA;AAkBA;;;;;AAWA;;;;;;;;;;;;;;;iBAvMgB,gBAAA,QAAwB,wBAAqB;kBAA7C,gBAAA;6BAAgB;;;;;UA4Cf,gBAAA;iBACA;WACN;;;;;;;aAOE;QACL;;;;;;;;;iBAUQ,WAAA,QAAmB,mBAAgB;;;;UAgClC,eAAA,SAAwB;SAChC;;aAEI;;;;;;;;;iBAUG,UAAA,QAAkB,kBAAe;;;;UAsBhC,kBAAA,SAA2B;SACnC;aACI;;;;;;;;iBASG,gBAAA,QAAwB,qBAAkB;;;;;;;iBA4B1C,gBAAA,QAAwB,qBAAkB;;;;UAkBzC,gBAAA,SAAyB,kBAAkB;;aAE/C;;;;;;;;iBASG,WAAA,QAAmB,mBAAgB"}
|
|
@@ -4,14 +4,17 @@ import "../contexts/index.mjs";
|
|
|
4
4
|
import { MemberScope as MemberScope$1 } from "../contexts/member-scope.mjs";
|
|
5
5
|
import { getCallSignatureProps } from "../helpers/get-call-signature-props.mjs";
|
|
6
6
|
import "../helpers/index.mjs";
|
|
7
|
+
import { PropertyName } from "./property-name.mjs";
|
|
7
8
|
import { TypeParameters } from "./type-parameters.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Block, For, MemberDeclaration, Name, Prose, Show, code, splitProps } from "@alloy-js/core";
|
|
9
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
10
|
+
import { Block, For, MemberDeclaration, Name, Show, code, splitProps } from "@alloy-js/core";
|
|
11
11
|
import { CallSignature, Declaration as Declaration$1, TSSymbolFlags, TypeRefContext, createMemberSymbol, createTypeAndValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
12
12
|
|
|
13
13
|
//#region src/typescript/components/class-declaration.tsx
|
|
14
14
|
/**
|
|
15
|
+
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
15
18
|
* Create a TypeScript class declaration.
|
|
16
19
|
*
|
|
17
20
|
* @example
|
|
@@ -69,9 +72,9 @@ function ClassDeclaration(props) {
|
|
|
69
72
|
return Boolean(props.doc);
|
|
70
73
|
},
|
|
71
74
|
get children() {
|
|
72
|
-
return
|
|
75
|
+
return createComponent(TSDoc, { get heading() {
|
|
73
76
|
return props.doc;
|
|
74
|
-
} })
|
|
77
|
+
} });
|
|
75
78
|
}
|
|
76
79
|
}), createComponent(Declaration$1, {
|
|
77
80
|
symbol: sym,
|
|
@@ -105,6 +108,15 @@ function ClassDeclaration(props) {
|
|
|
105
108
|
})];
|
|
106
109
|
}
|
|
107
110
|
ClassDeclaration.TypeParameters = TypeParameters;
|
|
111
|
+
/**
|
|
112
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
113
|
+
*/
|
|
114
|
+
/**
|
|
115
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
116
|
+
*
|
|
117
|
+
* @param props - The properties of the class member, including its name, visibility, and other modifiers.
|
|
118
|
+
* @returns A JSX element representing the class member declaration, which can be used within a ClassDeclaration component.
|
|
119
|
+
*/
|
|
108
120
|
function ClassMember(props) {
|
|
109
121
|
let tsFlags = TSSymbolFlags.None;
|
|
110
122
|
if (props.nullish) tsFlags |= TSSymbolFlags.Nullish;
|
|
@@ -118,9 +130,9 @@ function ClassMember(props) {
|
|
|
118
130
|
return Boolean(props.doc);
|
|
119
131
|
},
|
|
120
132
|
get children() {
|
|
121
|
-
return
|
|
133
|
+
return createComponent(TSDoc, { get heading() {
|
|
122
134
|
return props.doc;
|
|
123
|
-
} })
|
|
135
|
+
} });
|
|
124
136
|
}
|
|
125
137
|
}), createComponent(MemberDeclaration, {
|
|
126
138
|
symbol: sym,
|
|
@@ -129,12 +141,22 @@ function ClassMember(props) {
|
|
|
129
141
|
memo(() => props.public && "public "),
|
|
130
142
|
memo(() => props.private && "private "),
|
|
131
143
|
memo(() => props.protected && "protected "),
|
|
144
|
+
memo(() => props.abstract && "abstract "),
|
|
132
145
|
memo(() => props.static && "static "),
|
|
133
146
|
memo(() => props.children)
|
|
134
147
|
];
|
|
135
148
|
}
|
|
136
149
|
})];
|
|
137
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* Generates a TypeScript class field declaration for the given reflection class.
|
|
156
|
+
*
|
|
157
|
+
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
158
|
+
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
159
|
+
*/
|
|
138
160
|
function ClassField(props) {
|
|
139
161
|
const optionality = props.optional ? "?" : "";
|
|
140
162
|
const typeSection = props.type && [
|
|
@@ -149,13 +171,84 @@ function ClassField(props) {
|
|
|
149
171
|
nullish: props.nullish ?? props.optional,
|
|
150
172
|
get children() {
|
|
151
173
|
return [
|
|
152
|
-
createComponent(
|
|
174
|
+
createComponent(PropertyName, { get ["private"]() {
|
|
175
|
+
return props.isPrivateMember;
|
|
176
|
+
} }),
|
|
153
177
|
typeSection,
|
|
154
178
|
initializerSection
|
|
155
179
|
];
|
|
156
180
|
}
|
|
157
181
|
}));
|
|
158
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
185
|
+
*/
|
|
186
|
+
/**
|
|
187
|
+
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
188
|
+
*
|
|
189
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
190
|
+
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
191
|
+
*/
|
|
192
|
+
function ClassPropertySet(props) {
|
|
193
|
+
return [createComponent(ClassMember, mergeProps(props, { get children() {
|
|
194
|
+
return [
|
|
195
|
+
" set ",
|
|
196
|
+
createComponent(PropertyName, {}),
|
|
197
|
+
createComponent(LexicalScope, { get children() {
|
|
198
|
+
return [
|
|
199
|
+
createComponent(CallSignature, { get parameters() {
|
|
200
|
+
return [{
|
|
201
|
+
name: "value",
|
|
202
|
+
type: createComponent(TypeRefContext, { get children() {
|
|
203
|
+
return props.type;
|
|
204
|
+
} })
|
|
205
|
+
}];
|
|
206
|
+
} }),
|
|
207
|
+
" ",
|
|
208
|
+
createComponent(Block, { get children() {
|
|
209
|
+
return props.children;
|
|
210
|
+
} })
|
|
211
|
+
];
|
|
212
|
+
} })
|
|
213
|
+
];
|
|
214
|
+
} }))];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
218
|
+
*
|
|
219
|
+
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
220
|
+
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
221
|
+
*/
|
|
222
|
+
function ClassPropertyGet(props) {
|
|
223
|
+
return createComponent(ClassMember, mergeProps(props, { get children() {
|
|
224
|
+
return [
|
|
225
|
+
" get ",
|
|
226
|
+
createComponent(PropertyName, {}),
|
|
227
|
+
createComponent(LexicalScope, { get children() {
|
|
228
|
+
return [
|
|
229
|
+
createComponent(CallSignature, { get returnType() {
|
|
230
|
+
return createComponent(TypeRefContext, { get children() {
|
|
231
|
+
return props.type;
|
|
232
|
+
} });
|
|
233
|
+
} }),
|
|
234
|
+
" ",
|
|
235
|
+
createComponent(Block, { get children() {
|
|
236
|
+
return props.children;
|
|
237
|
+
} })
|
|
238
|
+
];
|
|
239
|
+
} })
|
|
240
|
+
];
|
|
241
|
+
} }));
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
247
|
+
* Generates a TypeScript class method declaration for the given reflection class.
|
|
248
|
+
*
|
|
249
|
+
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
250
|
+
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
251
|
+
*/
|
|
159
252
|
function ClassMethod(props) {
|
|
160
253
|
const callProps = getCallSignatureProps(props);
|
|
161
254
|
const [_, rest] = splitProps(props, ["doc"]);
|
|
@@ -164,18 +257,21 @@ function ClassMethod(props) {
|
|
|
164
257
|
return Boolean(props.doc);
|
|
165
258
|
},
|
|
166
259
|
get children() {
|
|
167
|
-
return
|
|
168
|
-
|
|
260
|
+
return createComponent(TSDoc, {
|
|
261
|
+
get heading() {
|
|
169
262
|
return props.doc;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
263
|
+
},
|
|
264
|
+
get children() {
|
|
265
|
+
return memo(() => !!Array.isArray(rest.parameters))() && createComponent(TSDocParams, { get parameters() {
|
|
266
|
+
return rest.parameters;
|
|
267
|
+
} });
|
|
268
|
+
}
|
|
269
|
+
});
|
|
174
270
|
}
|
|
175
271
|
}), createComponent(ClassMember, mergeProps(rest, { get children() {
|
|
176
272
|
return [
|
|
177
273
|
memo(() => props.async && "async "),
|
|
178
|
-
createComponent(
|
|
274
|
+
createComponent(PropertyName, {}),
|
|
179
275
|
createComponent(LexicalScope, { get children() {
|
|
180
276
|
return [
|
|
181
277
|
createComponent(CallSignature, callProps),
|
|
@@ -190,5 +286,5 @@ function ClassMethod(props) {
|
|
|
190
286
|
}
|
|
191
287
|
|
|
192
288
|
//#endregion
|
|
193
|
-
export { ClassDeclaration, ClassField, ClassMember, ClassMethod };
|
|
289
|
+
export { ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet };
|
|
194
290
|
//# sourceMappingURL=class-declaration.mjs.map
|