@powerlines/plugin-alloy 0.26.237 → 0.26.238
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/index.cjs +1 -9
- package/dist/core/components/index.d.cts +1 -5
- package/dist/core/components/index.d.mts +1 -5
- package/dist/core/components/index.mjs +1 -5
- package/dist/core/components/infrastructure-file.cjs +6 -3
- package/dist/core/components/infrastructure-file.d.cts +1 -1
- package/dist/core/components/infrastructure-file.d.cts.map +1 -1
- package/dist/core/components/infrastructure-file.d.mts +1 -1
- package/dist/core/components/infrastructure-file.mjs +5 -2
- package/dist/core/contexts/index.cjs +1 -11
- package/dist/core/contexts/index.d.cts +1 -3
- package/dist/core/contexts/index.d.mts +1 -3
- package/dist/core/contexts/index.mjs +1 -3
- package/dist/core/index.cjs +2 -23
- package/dist/core/index.d.cts +2 -10
- package/dist/core/index.d.mts +2 -10
- package/dist/core/index.mjs +2 -10
- package/dist/helpers/capnp.cjs +2 -2
- package/dist/helpers/capnp.mjs +2 -2
- package/dist/index.cjs +10 -2
- package/dist/index.d.cts +10 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -4
- package/dist/index.mjs +10 -2
- package/dist/render.cjs +67 -48
- package/dist/render.d.cts +33 -2
- package/dist/render.d.cts.map +1 -1
- package/dist/render.d.mts +33 -2
- package/dist/render.mjs +68 -49
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.mts +2 -3
- package/dist/types/plugin.d.cts +7 -4
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +7 -4
- package/dist/typescript/components/builtin-file.cjs +6 -6
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.cts.map +1 -1
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/builtin-file.mjs +2 -2
- package/dist/typescript/components/entry-file.cjs +2 -2
- package/dist/typescript/components/entry-file.d.cts +1 -1
- package/dist/typescript/components/entry-file.d.cts.map +1 -1
- package/dist/typescript/components/entry-file.d.mts +1 -1
- package/dist/typescript/components/entry-file.mjs +1 -1
- package/dist/typescript/components/index.cjs +1 -56
- package/dist/typescript/components/index.d.cts +1 -12
- package/dist/typescript/components/index.d.mts +1 -12
- package/dist/typescript/components/index.mjs +1 -12
- package/dist/typescript/index.cjs +1 -64
- package/dist/typescript/index.d.cts +1 -17
- package/dist/typescript/index.d.mts +1 -17
- package/dist/typescript/index.mjs +1 -17
- package/package.json +18 -639
- package/dist/core/components/output.cjs +0 -40
- package/dist/core/components/output.d.cts +0 -22
- package/dist/core/components/output.d.cts.map +0 -1
- package/dist/core/components/output.d.mts +0 -22
- package/dist/core/components/output.d.mts.map +0 -1
- package/dist/core/components/output.mjs +0 -40
- package/dist/core/components/output.mjs.map +0 -1
- package/dist/core/components/single-line-comment.cjs +0 -22
- package/dist/core/components/single-line-comment.d.cts +0 -19
- package/dist/core/components/single-line-comment.d.cts.map +0 -1
- package/dist/core/components/single-line-comment.d.mts +0 -19
- package/dist/core/components/single-line-comment.d.mts.map +0 -1
- package/dist/core/components/single-line-comment.mjs +0 -22
- package/dist/core/components/single-line-comment.mjs.map +0 -1
- package/dist/core/components/source-file.cjs +0 -64
- package/dist/core/components/source-file.d.cts +0 -30
- package/dist/core/components/source-file.d.cts.map +0 -1
- package/dist/core/components/source-file.d.mts +0 -30
- package/dist/core/components/source-file.d.mts.map +0 -1
- package/dist/core/components/source-file.mjs +0 -62
- package/dist/core/components/source-file.mjs.map +0 -1
- package/dist/core/components/spacing.cjs +0 -19
- package/dist/core/components/spacing.d.cts +0 -19
- package/dist/core/components/spacing.d.cts.map +0 -1
- package/dist/core/components/spacing.d.mts +0 -19
- package/dist/core/components/spacing.d.mts.map +0 -1
- package/dist/core/components/spacing.mjs +0 -19
- package/dist/core/components/spacing.mjs.map +0 -1
- package/dist/core/contexts/meta.cjs +0 -40
- package/dist/core/contexts/meta.d.cts +0 -46
- package/dist/core/contexts/meta.d.cts.map +0 -1
- package/dist/core/contexts/meta.d.mts +0 -46
- package/dist/core/contexts/meta.d.mts.map +0 -1
- package/dist/core/contexts/meta.mjs +0 -37
- package/dist/core/contexts/meta.mjs.map +0 -1
- package/dist/core/contexts/schema.cjs +0 -38
- package/dist/core/contexts/schema.d.cts +0 -26
- package/dist/core/contexts/schema.d.cts.map +0 -1
- package/dist/core/contexts/schema.d.mts +0 -26
- package/dist/core/contexts/schema.d.mts.map +0 -1
- package/dist/core/contexts/schema.mjs +0 -35
- package/dist/core/contexts/schema.mjs.map +0 -1
- package/dist/core/helpers/code.cjs +0 -33
- package/dist/core/helpers/code.d.cts +0 -28
- package/dist/core/helpers/code.d.cts.map +0 -1
- package/dist/core/helpers/code.d.mts +0 -28
- package/dist/core/helpers/code.d.mts.map +0 -1
- package/dist/core/helpers/code.mjs +0 -33
- package/dist/core/helpers/code.mjs.map +0 -1
- package/dist/core/helpers/index.cjs +0 -4
- package/dist/core/helpers/index.d.cts +0 -2
- package/dist/core/helpers/index.d.mts +0 -2
- package/dist/core/helpers/index.mjs +0 -3
- package/dist/hcl/components/block-declaration.cjs +0 -33
- package/dist/hcl/components/block-declaration.d.cts +0 -19
- package/dist/hcl/components/block-declaration.d.cts.map +0 -1
- package/dist/hcl/components/block-declaration.d.mts +0 -19
- package/dist/hcl/components/block-declaration.d.mts.map +0 -1
- package/dist/hcl/components/block-declaration.mjs +0 -33
- package/dist/hcl/components/block-declaration.mjs.map +0 -1
- package/dist/hcl/components/hcl-file.cjs +0 -82
- package/dist/hcl/components/hcl-file.d.cts +0 -25
- package/dist/hcl/components/hcl-file.d.cts.map +0 -1
- package/dist/hcl/components/hcl-file.d.mts +0 -25
- package/dist/hcl/components/hcl-file.d.mts.map +0 -1
- package/dist/hcl/components/hcl-file.mjs +0 -81
- package/dist/hcl/components/hcl-file.mjs.map +0 -1
- package/dist/hcl/components/index.cjs +0 -11
- package/dist/hcl/components/index.d.cts +0 -5
- package/dist/hcl/components/index.d.mts +0 -5
- package/dist/hcl/components/index.mjs +0 -6
- package/dist/hcl/components/packer-file.cjs +0 -28
- package/dist/hcl/components/packer-file.d.cts +0 -16
- package/dist/hcl/components/packer-file.d.cts.map +0 -1
- package/dist/hcl/components/packer-file.d.mts +0 -16
- package/dist/hcl/components/packer-file.d.mts.map +0 -1
- package/dist/hcl/components/packer-file.mjs +0 -28
- package/dist/hcl/components/packer-file.mjs.map +0 -1
- package/dist/hcl/components/terraform-file.cjs +0 -29
- package/dist/hcl/components/terraform-file.d.cts +0 -17
- package/dist/hcl/components/terraform-file.d.cts.map +0 -1
- package/dist/hcl/components/terraform-file.d.mts +0 -17
- package/dist/hcl/components/terraform-file.d.mts.map +0 -1
- package/dist/hcl/components/terraform-file.mjs +0 -29
- package/dist/hcl/components/terraform-file.mjs.map +0 -1
- package/dist/hcl/index.cjs +0 -12
- package/dist/hcl/index.d.cts +0 -6
- package/dist/hcl/index.d.mts +0 -6
- package/dist/hcl/index.mjs +0 -7
- package/dist/markdown/components/alert.cjs +0 -74
- package/dist/markdown/components/alert.d.cts +0 -52
- package/dist/markdown/components/alert.d.cts.map +0 -1
- package/dist/markdown/components/alert.d.mts +0 -52
- package/dist/markdown/components/alert.d.mts.map +0 -1
- package/dist/markdown/components/alert.mjs +0 -69
- package/dist/markdown/components/alert.mjs.map +0 -1
- package/dist/markdown/components/front-matter.cjs +0 -30
- package/dist/markdown/components/front-matter.d.cts +0 -13
- package/dist/markdown/components/front-matter.d.cts.map +0 -1
- package/dist/markdown/components/front-matter.d.mts +0 -13
- package/dist/markdown/components/front-matter.d.mts.map +0 -1
- package/dist/markdown/components/front-matter.mjs +0 -30
- package/dist/markdown/components/front-matter.mjs.map +0 -1
- package/dist/markdown/components/heading.cjs +0 -23
- package/dist/markdown/components/heading.d.cts +0 -17
- package/dist/markdown/components/heading.d.cts.map +0 -1
- package/dist/markdown/components/heading.d.mts +0 -17
- package/dist/markdown/components/heading.d.mts.map +0 -1
- package/dist/markdown/components/heading.mjs +0 -23
- package/dist/markdown/components/heading.mjs.map +0 -1
- package/dist/markdown/components/index.cjs +0 -20
- package/dist/markdown/components/index.d.cts +0 -6
- package/dist/markdown/components/index.d.mts +0 -6
- package/dist/markdown/components/index.mjs +0 -7
- package/dist/markdown/components/markdown-file.cjs +0 -146
- package/dist/markdown/components/markdown-file.d.cts +0 -25
- package/dist/markdown/components/markdown-file.d.cts.map +0 -1
- package/dist/markdown/components/markdown-file.d.mts +0 -25
- package/dist/markdown/components/markdown-file.d.mts.map +0 -1
- package/dist/markdown/components/markdown-file.mjs +0 -145
- package/dist/markdown/components/markdown-file.mjs.map +0 -1
- package/dist/markdown/components/markdown-table.cjs +0 -106
- package/dist/markdown/components/markdown-table.d.cts +0 -37
- package/dist/markdown/components/markdown-table.d.cts.map +0 -1
- package/dist/markdown/components/markdown-table.d.mts +0 -37
- package/dist/markdown/components/markdown-table.d.mts.map +0 -1
- package/dist/markdown/components/markdown-table.mjs +0 -104
- package/dist/markdown/components/markdown-table.mjs.map +0 -1
- package/dist/markdown/contexts/index.cjs +0 -7
- package/dist/markdown/contexts/index.d.cts +0 -2
- package/dist/markdown/contexts/index.d.mts +0 -2
- package/dist/markdown/contexts/index.mjs +0 -3
- package/dist/markdown/contexts/markdown-table.cjs +0 -37
- package/dist/markdown/contexts/markdown-table.d.cts +0 -35
- package/dist/markdown/contexts/markdown-table.d.cts.map +0 -1
- package/dist/markdown/contexts/markdown-table.d.mts +0 -35
- package/dist/markdown/contexts/markdown-table.d.mts.map +0 -1
- package/dist/markdown/contexts/markdown-table.mjs +0 -34
- package/dist/markdown/contexts/markdown-table.mjs.map +0 -1
- package/dist/markdown/index.cjs +0 -27
- package/dist/markdown/index.d.cts +0 -9
- package/dist/markdown/index.d.mts +0 -9
- package/dist/markdown/index.mjs +0 -10
- package/dist/types/components.cjs +0 -9
- package/dist/types/components.d.cts +0 -137
- package/dist/types/components.d.cts.map +0 -1
- package/dist/types/components.d.mts +0 -137
- package/dist/types/components.d.mts.map +0 -1
- package/dist/types/components.mjs +0 -10
- package/dist/types/components.mjs.map +0 -1
- package/dist/typescript/components/class-declaration.cjs +0 -305
- package/dist/typescript/components/class-declaration.d.cts +0 -139
- package/dist/typescript/components/class-declaration.d.cts.map +0 -1
- package/dist/typescript/components/class-declaration.d.mts +0 -139
- package/dist/typescript/components/class-declaration.d.mts.map +0 -1
- package/dist/typescript/components/class-declaration.mjs +0 -300
- package/dist/typescript/components/class-declaration.mjs.map +0 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +0 -25
- package/dist/typescript/components/dynamic-import-statement.d.cts +0 -30
- package/dist/typescript/components/dynamic-import-statement.d.cts.map +0 -1
- package/dist/typescript/components/dynamic-import-statement.d.mts +0 -30
- package/dist/typescript/components/dynamic-import-statement.d.mts.map +0 -1
- package/dist/typescript/components/dynamic-import-statement.mjs +0 -25
- package/dist/typescript/components/dynamic-import-statement.mjs.map +0 -1
- package/dist/typescript/components/interface-declaration.cjs +0 -257
- package/dist/typescript/components/interface-declaration.d.cts +0 -78
- package/dist/typescript/components/interface-declaration.d.cts.map +0 -1
- package/dist/typescript/components/interface-declaration.d.mts +0 -78
- package/dist/typescript/components/interface-declaration.d.mts.map +0 -1
- package/dist/typescript/components/interface-declaration.mjs +0 -254
- package/dist/typescript/components/interface-declaration.mjs.map +0 -1
- package/dist/typescript/components/object-declaration.cjs +0 -131
- package/dist/typescript/components/object-declaration.d.cts +0 -24
- package/dist/typescript/components/object-declaration.d.cts.map +0 -1
- package/dist/typescript/components/object-declaration.d.mts +0 -24
- package/dist/typescript/components/object-declaration.d.mts.map +0 -1
- package/dist/typescript/components/object-declaration.mjs +0 -130
- package/dist/typescript/components/object-declaration.mjs.map +0 -1
- package/dist/typescript/components/property-name.cjs +0 -31
- package/dist/typescript/components/property-name.d.cts +0 -21
- package/dist/typescript/components/property-name.d.cts.map +0 -1
- package/dist/typescript/components/property-name.d.mts +0 -21
- package/dist/typescript/components/property-name.d.mts.map +0 -1
- package/dist/typescript/components/property-name.mjs +0 -31
- package/dist/typescript/components/property-name.mjs.map +0 -1
- package/dist/typescript/components/record-expression.cjs +0 -12
- package/dist/typescript/components/record-expression.d.cts +0 -9
- package/dist/typescript/components/record-expression.d.cts.map +0 -1
- package/dist/typescript/components/record-expression.d.mts +0 -9
- package/dist/typescript/components/record-expression.d.mts.map +0 -1
- package/dist/typescript/components/record-expression.mjs +0 -12
- package/dist/typescript/components/record-expression.mjs.map +0 -1
- package/dist/typescript/components/tsdoc-schema.cjs +0 -166
- package/dist/typescript/components/tsdoc-schema.d.cts +0 -21
- package/dist/typescript/components/tsdoc-schema.d.cts.map +0 -1
- package/dist/typescript/components/tsdoc-schema.d.mts +0 -21
- package/dist/typescript/components/tsdoc-schema.d.mts.map +0 -1
- package/dist/typescript/components/tsdoc-schema.mjs +0 -165
- package/dist/typescript/components/tsdoc-schema.mjs.map +0 -1
- package/dist/typescript/components/tsdoc.cjs +0 -486
- package/dist/typescript/components/tsdoc.d.cts +0 -163
- package/dist/typescript/components/tsdoc.d.cts.map +0 -1
- package/dist/typescript/components/tsdoc.d.mts +0 -163
- package/dist/typescript/components/tsdoc.d.mts.map +0 -1
- package/dist/typescript/components/tsdoc.mjs +0 -465
- package/dist/typescript/components/tsdoc.mjs.map +0 -1
- package/dist/typescript/components/type-declaration.cjs +0 -38
- package/dist/typescript/components/type-declaration.d.cts +0 -15
- package/dist/typescript/components/type-declaration.d.cts.map +0 -1
- package/dist/typescript/components/type-declaration.d.mts +0 -15
- package/dist/typescript/components/type-declaration.d.mts.map +0 -1
- package/dist/typescript/components/type-declaration.mjs +0 -38
- package/dist/typescript/components/type-declaration.mjs.map +0 -1
- package/dist/typescript/components/type-parameters.cjs +0 -82
- package/dist/typescript/components/type-parameters.d.cts +0 -22
- package/dist/typescript/components/type-parameters.d.cts.map +0 -1
- package/dist/typescript/components/type-parameters.d.mts +0 -22
- package/dist/typescript/components/type-parameters.d.mts.map +0 -1
- package/dist/typescript/components/type-parameters.mjs +0 -82
- package/dist/typescript/components/type-parameters.mjs.map +0 -1
- package/dist/typescript/components/typescript-file.cjs +0 -231
- package/dist/typescript/components/typescript-file.d.cts +0 -46
- package/dist/typescript/components/typescript-file.d.cts.map +0 -1
- package/dist/typescript/components/typescript-file.d.mts +0 -46
- package/dist/typescript/components/typescript-file.d.mts.map +0 -1
- package/dist/typescript/components/typescript-file.mjs +0 -229
- package/dist/typescript/components/typescript-file.mjs.map +0 -1
- package/dist/typescript/contexts/index.cjs +0 -4
- package/dist/typescript/contexts/index.d.cts +0 -2
- package/dist/typescript/contexts/index.d.mts +0 -2
- package/dist/typescript/contexts/index.mjs +0 -3
- package/dist/typescript/contexts/lexical-scope.cjs +0 -25
- package/dist/typescript/contexts/lexical-scope.d.cts +0 -12
- package/dist/typescript/contexts/lexical-scope.d.cts.map +0 -1
- package/dist/typescript/contexts/lexical-scope.d.mts +0 -12
- package/dist/typescript/contexts/lexical-scope.d.mts.map +0 -1
- package/dist/typescript/contexts/lexical-scope.mjs +0 -25
- package/dist/typescript/contexts/lexical-scope.mjs.map +0 -1
- package/dist/typescript/contexts/member-scope.cjs +0 -23
- package/dist/typescript/contexts/member-scope.d.cts +0 -18
- package/dist/typescript/contexts/member-scope.d.cts.map +0 -1
- package/dist/typescript/contexts/member-scope.d.mts +0 -18
- package/dist/typescript/contexts/member-scope.d.mts.map +0 -1
- package/dist/typescript/contexts/member-scope.mjs +0 -23
- package/dist/typescript/contexts/member-scope.mjs.map +0 -1
- package/dist/typescript/helpers/get-call-signature-props.cjs +0 -25
- package/dist/typescript/helpers/get-call-signature-props.d.cts +0 -13
- package/dist/typescript/helpers/get-call-signature-props.d.cts.map +0 -1
- package/dist/typescript/helpers/get-call-signature-props.d.mts +0 -13
- package/dist/typescript/helpers/get-call-signature-props.d.mts.map +0 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs +0 -25
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +0 -1
- package/dist/typescript/helpers/index.cjs +0 -6
- package/dist/typescript/helpers/index.d.cts +0 -3
- package/dist/typescript/helpers/index.d.mts +0 -3
- package/dist/typescript/helpers/index.mjs +0 -4
- package/dist/typescript/helpers/utilities.cjs +0 -15
- package/dist/typescript/helpers/utilities.d.cts +0 -11
- package/dist/typescript/helpers/utilities.d.cts.map +0 -1
- package/dist/typescript/helpers/utilities.d.mts +0 -11
- package/dist/typescript/helpers/utilities.d.mts.map +0 -1
- package/dist/typescript/helpers/utilities.mjs +0 -14
- package/dist/typescript/helpers/utilities.mjs.map +0 -1
- package/dist/yaml/components/index.cjs +0 -5
- package/dist/yaml/components/index.d.cts +0 -2
- package/dist/yaml/components/index.d.mts +0 -2
- package/dist/yaml/components/index.mjs +0 -3
- package/dist/yaml/components/yaml-file.cjs +0 -148
- package/dist/yaml/components/yaml-file.d.cts +0 -31
- package/dist/yaml/components/yaml-file.d.cts.map +0 -1
- package/dist/yaml/components/yaml-file.d.mts +0 -31
- package/dist/yaml/components/yaml-file.d.mts.map +0 -1
- package/dist/yaml/components/yaml-file.mjs +0 -147
- package/dist/yaml/components/yaml-file.mjs.map +0 -1
- package/dist/yaml/index.cjs +0 -6
- package/dist/yaml/index.d.cts +0 -3
- package/dist/yaml/index.d.mts +0 -3
- package/dist/yaml/index.mjs +0 -4
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { TypeParameters } from "./type-parameters.cjs";
|
|
2
|
-
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
3
|
-
import { CallSignatureProps, CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
|
-
//#region src/typescript/components/class-declaration.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
7
|
-
*/
|
|
8
|
-
interface ClassDeclarationProps extends CommonDeclarationProps {
|
|
9
|
-
/**
|
|
10
|
-
* An indication of whether this class is abstract
|
|
11
|
-
*/
|
|
12
|
-
abstract?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* An optional class that this class extends. This will be rendered as an `extends` clause in the class declaration
|
|
15
|
-
*/
|
|
16
|
-
extends?: Children;
|
|
17
|
-
/**
|
|
18
|
-
* Optional interfaces that this class implements. This will be rendered as an `implements` clause in the class declaration
|
|
19
|
-
*/
|
|
20
|
-
implements?: Children[];
|
|
21
|
-
/**
|
|
22
|
-
* The generic type parameters of the class.
|
|
23
|
-
*/
|
|
24
|
-
typeParameters?: TypeParameterDescriptor[] | string[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a TypeScript class declaration.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* const myPetRefkey = refkey();
|
|
32
|
-
* const Animal = refkey();
|
|
33
|
-
* const staticMember = refkey();
|
|
34
|
-
* const instanceMember = refkey();
|
|
35
|
-
*
|
|
36
|
-
* <ClassDeclaration name="Animal" refkey={Animal}>
|
|
37
|
-
* <ClassMember public static name="something" type="string" refkey={staticMember}>
|
|
38
|
-
* "hello"
|
|
39
|
-
* </ClassMember>
|
|
40
|
-
* <ClassMember public name="kind" type="string" />
|
|
41
|
-
* <ClassMember public name="name" type="string" refkey={instanceMember} />
|
|
42
|
-
* <ClassConstructor parameters="name: string">
|
|
43
|
-
* this.name = name;
|
|
44
|
-
* </ClassConstructor>
|
|
45
|
-
* </ClassDeclaration>
|
|
46
|
-
*
|
|
47
|
-
* <VarDeclaration const name="myPet" refkey={myPetRefkey}>
|
|
48
|
-
* new {Animal}();
|
|
49
|
-
* </VarDeclaration>
|
|
50
|
-
*
|
|
51
|
-
* {staticMember}; // Animal.something
|
|
52
|
-
* <MemberReference path={[myPetRefkey, instanceMember]} /> // myPet.name
|
|
53
|
-
* {memberRefkey(myPetRefkey, instanceMember)}
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare function ClassDeclaration(props: ClassDeclarationProps): Children;
|
|
57
|
-
declare namespace ClassDeclaration {
|
|
58
|
-
var TypeParameters: typeof TypeParameters;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Generates a TypeScript class member declaration for the given reflection class.
|
|
62
|
-
*/
|
|
63
|
-
interface ClassMemberProps {
|
|
64
|
-
name: string | Namekey;
|
|
65
|
-
refkey?: Refkey;
|
|
66
|
-
public?: boolean;
|
|
67
|
-
private?: boolean;
|
|
68
|
-
protected?: boolean;
|
|
69
|
-
jsPrivate?: boolean;
|
|
70
|
-
static?: boolean;
|
|
71
|
-
abstract?: boolean;
|
|
72
|
-
children?: Children;
|
|
73
|
-
doc?: Children;
|
|
74
|
-
nullish?: boolean;
|
|
75
|
-
override?: boolean;
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
87
|
-
interface ClassFieldProps extends ClassMemberProps {
|
|
88
|
-
name: string;
|
|
89
|
-
type?: Children;
|
|
90
|
-
optional?: boolean;
|
|
91
|
-
children?: Children;
|
|
92
|
-
isPrivateMember?: boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Generates a TypeScript class field declaration for the given reflection class.
|
|
96
|
-
*
|
|
97
|
-
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
98
|
-
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
99
|
-
*/
|
|
100
|
-
declare function ClassField(props: ClassFieldProps): Children;
|
|
101
|
-
/**
|
|
102
|
-
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
103
|
-
*/
|
|
104
|
-
interface ClassPropertyProps extends ClassMemberProps {
|
|
105
|
-
name: string;
|
|
106
|
-
type?: Children;
|
|
107
|
-
children?: Children;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
111
|
-
*
|
|
112
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
113
|
-
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
114
|
-
*/
|
|
115
|
-
declare function ClassPropertySet(props: ClassPropertyProps): Children;
|
|
116
|
-
/**
|
|
117
|
-
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
118
|
-
*
|
|
119
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
120
|
-
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
121
|
-
*/
|
|
122
|
-
declare function ClassPropertyGet(props: ClassPropertyProps): Children;
|
|
123
|
-
/**
|
|
124
|
-
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
125
|
-
*/
|
|
126
|
-
interface ClassMethodProps extends ClassMemberProps, CallSignatureProps {
|
|
127
|
-
async?: boolean;
|
|
128
|
-
children?: Children;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Generates a TypeScript class method declaration for the given reflection class.
|
|
132
|
-
*
|
|
133
|
-
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
134
|
-
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
135
|
-
*/
|
|
136
|
-
declare function ClassMethod(props: ClassMethodProps): Children;
|
|
137
|
-
//#endregion
|
|
138
|
-
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet };
|
|
139
|
-
//# sourceMappingURL=class-declaration.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"mappings":";;;;;;;UAoDiB,8BAA8B;;;;EAI7C;;;;EAKA,UAAU;;;;EAKV,aAAa;;;;EAKb,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCH,iBAAiB,OAAO,wBAAqB;kBAA7C;6BAAA;;;;;UA4CC;EACf,eAAe;EACf,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,MAAM;EACN;EACA;;;;;;;;iBASc,YAAY,OAAO,mBAAgB;;;;UAiClC,wBAAwB;EACvC;EACA,OAAO;EACP;EACA,WAAW;EACX;;;;;;;;iBASc,WAAW,OAAO,kBAAe;;;;UAyBhC,2BAA2B;EAC1C;EACA,OAAO;EACP,WAAW;;;;;;;;iBASG,iBAAiB,OAAO,qBAAkB;;;;;;;iBA4B1C,iBAAiB,OAAO,qBAAkB;;;;UAkBzC,yBAAyB,kBAAkB;EAC1D;EACA,WAAW;;;;;;;;iBASG,YAAY,OAAO,mBAAgB"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { TypeParameters } from "./type-parameters.mjs";
|
|
2
|
-
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
3
|
-
import { CallSignatureProps, CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
4
|
-
//#region src/typescript/components/class-declaration.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
7
|
-
*/
|
|
8
|
-
interface ClassDeclarationProps extends CommonDeclarationProps {
|
|
9
|
-
/**
|
|
10
|
-
* An indication of whether this class is abstract
|
|
11
|
-
*/
|
|
12
|
-
abstract?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* An optional class that this class extends. This will be rendered as an `extends` clause in the class declaration
|
|
15
|
-
*/
|
|
16
|
-
extends?: Children;
|
|
17
|
-
/**
|
|
18
|
-
* Optional interfaces that this class implements. This will be rendered as an `implements` clause in the class declaration
|
|
19
|
-
*/
|
|
20
|
-
implements?: Children[];
|
|
21
|
-
/**
|
|
22
|
-
* The generic type parameters of the class.
|
|
23
|
-
*/
|
|
24
|
-
typeParameters?: TypeParameterDescriptor[] | string[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a TypeScript class declaration.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* const myPetRefkey = refkey();
|
|
32
|
-
* const Animal = refkey();
|
|
33
|
-
* const staticMember = refkey();
|
|
34
|
-
* const instanceMember = refkey();
|
|
35
|
-
*
|
|
36
|
-
* <ClassDeclaration name="Animal" refkey={Animal}>
|
|
37
|
-
* <ClassMember public static name="something" type="string" refkey={staticMember}>
|
|
38
|
-
* "hello"
|
|
39
|
-
* </ClassMember>
|
|
40
|
-
* <ClassMember public name="kind" type="string" />
|
|
41
|
-
* <ClassMember public name="name" type="string" refkey={instanceMember} />
|
|
42
|
-
* <ClassConstructor parameters="name: string">
|
|
43
|
-
* this.name = name;
|
|
44
|
-
* </ClassConstructor>
|
|
45
|
-
* </ClassDeclaration>
|
|
46
|
-
*
|
|
47
|
-
* <VarDeclaration const name="myPet" refkey={myPetRefkey}>
|
|
48
|
-
* new {Animal}();
|
|
49
|
-
* </VarDeclaration>
|
|
50
|
-
*
|
|
51
|
-
* {staticMember}; // Animal.something
|
|
52
|
-
* <MemberReference path={[myPetRefkey, instanceMember]} /> // myPet.name
|
|
53
|
-
* {memberRefkey(myPetRefkey, instanceMember)}
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare function ClassDeclaration(props: ClassDeclarationProps): Children;
|
|
57
|
-
declare namespace ClassDeclaration {
|
|
58
|
-
var TypeParameters: typeof TypeParameters;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Generates a TypeScript class member declaration for the given reflection class.
|
|
62
|
-
*/
|
|
63
|
-
interface ClassMemberProps {
|
|
64
|
-
name: string | Namekey;
|
|
65
|
-
refkey?: Refkey;
|
|
66
|
-
public?: boolean;
|
|
67
|
-
private?: boolean;
|
|
68
|
-
protected?: boolean;
|
|
69
|
-
jsPrivate?: boolean;
|
|
70
|
-
static?: boolean;
|
|
71
|
-
abstract?: boolean;
|
|
72
|
-
children?: Children;
|
|
73
|
-
doc?: Children;
|
|
74
|
-
nullish?: boolean;
|
|
75
|
-
override?: boolean;
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
87
|
-
interface ClassFieldProps extends ClassMemberProps {
|
|
88
|
-
name: string;
|
|
89
|
-
type?: Children;
|
|
90
|
-
optional?: boolean;
|
|
91
|
-
children?: Children;
|
|
92
|
-
isPrivateMember?: boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Generates a TypeScript class field declaration for the given reflection class.
|
|
96
|
-
*
|
|
97
|
-
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
98
|
-
* @returns A JSX element representing the class field declaration, which can be used within a ClassDeclaration component.
|
|
99
|
-
*/
|
|
100
|
-
declare function ClassField(props: ClassFieldProps): Children;
|
|
101
|
-
/**
|
|
102
|
-
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
103
|
-
*/
|
|
104
|
-
interface ClassPropertyProps extends ClassMemberProps {
|
|
105
|
-
name: string;
|
|
106
|
-
type?: Children;
|
|
107
|
-
children?: Children;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
111
|
-
*
|
|
112
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
113
|
-
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
114
|
-
*/
|
|
115
|
-
declare function ClassPropertySet(props: ClassPropertyProps): Children;
|
|
116
|
-
/**
|
|
117
|
-
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
118
|
-
*
|
|
119
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
120
|
-
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
121
|
-
*/
|
|
122
|
-
declare function ClassPropertyGet(props: ClassPropertyProps): Children;
|
|
123
|
-
/**
|
|
124
|
-
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
125
|
-
*/
|
|
126
|
-
interface ClassMethodProps extends ClassMemberProps, CallSignatureProps {
|
|
127
|
-
async?: boolean;
|
|
128
|
-
children?: Children;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Generates a TypeScript class method declaration for the given reflection class.
|
|
132
|
-
*
|
|
133
|
-
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
134
|
-
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
135
|
-
*/
|
|
136
|
-
declare function ClassMethod(props: ClassMethodProps): Children;
|
|
137
|
-
//#endregion
|
|
138
|
-
export { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet };
|
|
139
|
-
//# sourceMappingURL=class-declaration.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/class-declaration.tsx"],"mappings":""}
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { TSDoc, TSDocParams } from "./tsdoc.mjs";
|
|
2
|
-
import { LexicalScope } from "../contexts/lexical-scope.mjs";
|
|
3
|
-
import "../contexts/index.mjs";
|
|
4
|
-
import { MemberScope as MemberScope$1 } from "../contexts/member-scope.mjs";
|
|
5
|
-
import { getCallSignatureProps } from "../helpers/get-call-signature-props.mjs";
|
|
6
|
-
import "../helpers/index.mjs";
|
|
7
|
-
import { PropertyName } from "./property-name.mjs";
|
|
8
|
-
import { TypeParameters } from "./type-parameters.mjs";
|
|
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
|
-
import { CallSignature, Declaration as Declaration$1, TSSymbolFlags, TypeRefContext, createMemberSymbol, createTypeAndValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
12
|
-
|
|
13
|
-
//#region src/typescript/components/class-declaration.tsx
|
|
14
|
-
/**
|
|
15
|
-
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Create a TypeScript class declaration.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* const myPetRefkey = refkey();
|
|
23
|
-
* const Animal = refkey();
|
|
24
|
-
* const staticMember = refkey();
|
|
25
|
-
* const instanceMember = refkey();
|
|
26
|
-
*
|
|
27
|
-
* <ClassDeclaration name="Animal" refkey={Animal}>
|
|
28
|
-
* <ClassMember public static name="something" type="string" refkey={staticMember}>
|
|
29
|
-
* "hello"
|
|
30
|
-
* </ClassMember>
|
|
31
|
-
* <ClassMember public name="kind" type="string" />
|
|
32
|
-
* <ClassMember public name="name" type="string" refkey={instanceMember} />
|
|
33
|
-
* <ClassConstructor parameters="name: string">
|
|
34
|
-
* this.name = name;
|
|
35
|
-
* </ClassConstructor>
|
|
36
|
-
* </ClassDeclaration>
|
|
37
|
-
*
|
|
38
|
-
* <VarDeclaration const name="myPet" refkey={myPetRefkey}>
|
|
39
|
-
* new {Animal}();
|
|
40
|
-
* </VarDeclaration>
|
|
41
|
-
*
|
|
42
|
-
* {staticMember}; // Animal.something
|
|
43
|
-
* <MemberReference path={[myPetRefkey, instanceMember]} /> // myPet.name
|
|
44
|
-
* {memberRefkey(myPetRefkey, instanceMember)}
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
function ClassDeclaration(props) {
|
|
48
|
-
const extendsPart = props.extends && [" extends ", memo(() => props.extends)];
|
|
49
|
-
const implementsPart = props.implements && props.implements.length > 0 && [
|
|
50
|
-
" ",
|
|
51
|
-
"implements",
|
|
52
|
-
" ",
|
|
53
|
-
createComponent(For, {
|
|
54
|
-
get each() {
|
|
55
|
-
return props.implements;
|
|
56
|
-
},
|
|
57
|
-
comma: true,
|
|
58
|
-
space: true,
|
|
59
|
-
children: (implement) => implement
|
|
60
|
-
})
|
|
61
|
-
];
|
|
62
|
-
const sym = createTypeAndValueSymbol(props.name, {
|
|
63
|
-
refkeys: props.refkey,
|
|
64
|
-
export: props.export,
|
|
65
|
-
default: props.default,
|
|
66
|
-
metadata: props.metadata,
|
|
67
|
-
hasInstanceMembers: true,
|
|
68
|
-
namePolicy: useTSNamePolicy().for("class")
|
|
69
|
-
});
|
|
70
|
-
return [createComponent(Show, {
|
|
71
|
-
get when() {
|
|
72
|
-
return Boolean(props.doc);
|
|
73
|
-
},
|
|
74
|
-
get children() {
|
|
75
|
-
return createComponent(TSDoc, { get heading() {
|
|
76
|
-
return props.doc;
|
|
77
|
-
} });
|
|
78
|
-
}
|
|
79
|
-
}), createComponent(Declaration$1, {
|
|
80
|
-
symbol: sym,
|
|
81
|
-
get ["export"]() {
|
|
82
|
-
return props.export;
|
|
83
|
-
},
|
|
84
|
-
get ["default"]() {
|
|
85
|
-
return props.default;
|
|
86
|
-
},
|
|
87
|
-
get children() {
|
|
88
|
-
return createComponent(MemberScope$1, {
|
|
89
|
-
ownerSymbol: sym,
|
|
90
|
-
get children() {
|
|
91
|
-
return [
|
|
92
|
-
memo(() => props.abstract && code`abstract `),
|
|
93
|
-
" class ",
|
|
94
|
-
createComponent(Name, {}),
|
|
95
|
-
memo(() => memo(() => !!props.typeParameters)() && createComponent(TypeParameters, { get parameters() {
|
|
96
|
-
return props.typeParameters;
|
|
97
|
-
} })),
|
|
98
|
-
extendsPart,
|
|
99
|
-
implementsPart,
|
|
100
|
-
" ",
|
|
101
|
-
createComponent(Block, { get children() {
|
|
102
|
-
return props.children;
|
|
103
|
-
} })
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
})];
|
|
109
|
-
}
|
|
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
|
-
*/
|
|
120
|
-
function ClassMember(props) {
|
|
121
|
-
let tsFlags = TSSymbolFlags.None;
|
|
122
|
-
if (props.nullish) tsFlags |= TSSymbolFlags.Nullish;
|
|
123
|
-
const sym = createMemberSymbol(props.name, props, {
|
|
124
|
-
refkeys: props.refkey,
|
|
125
|
-
tsFlags,
|
|
126
|
-
namePolicy: useTSNamePolicy().for("class-member-data")
|
|
127
|
-
});
|
|
128
|
-
return [createComponent(Show, {
|
|
129
|
-
get when() {
|
|
130
|
-
return Boolean(props.doc);
|
|
131
|
-
},
|
|
132
|
-
get children() {
|
|
133
|
-
return createComponent(TSDoc, { get heading() {
|
|
134
|
-
return props.doc;
|
|
135
|
-
} });
|
|
136
|
-
}
|
|
137
|
-
}), createComponent(MemberDeclaration, {
|
|
138
|
-
symbol: sym,
|
|
139
|
-
get children() {
|
|
140
|
-
return [
|
|
141
|
-
memo(() => props.public && "public "),
|
|
142
|
-
memo(() => props.private && "private "),
|
|
143
|
-
memo(() => props.protected && "protected "),
|
|
144
|
-
memo(() => props.abstract && "abstract "),
|
|
145
|
-
memo(() => props.override && "override "),
|
|
146
|
-
memo(() => props.static && "static "),
|
|
147
|
-
memo(() => props.children)
|
|
148
|
-
];
|
|
149
|
-
}
|
|
150
|
-
})];
|
|
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
|
-
*/
|
|
161
|
-
function ClassField(props) {
|
|
162
|
-
const optionality = props.optional ? "?" : "";
|
|
163
|
-
const typeSection = props.type && [
|
|
164
|
-
optionality,
|
|
165
|
-
": ",
|
|
166
|
-
createComponent(TypeRefContext, { get children() {
|
|
167
|
-
return props.type;
|
|
168
|
-
} })
|
|
169
|
-
];
|
|
170
|
-
const initializerSection = props.children && [" = ", memo(() => props.children)];
|
|
171
|
-
return createComponent(ClassMember, mergeProps(props, {
|
|
172
|
-
nullish: props.nullish ?? props.optional,
|
|
173
|
-
get children() {
|
|
174
|
-
return [
|
|
175
|
-
createComponent(PropertyName, {
|
|
176
|
-
get ["private"]() {
|
|
177
|
-
return props.isPrivateMember;
|
|
178
|
-
},
|
|
179
|
-
get name() {
|
|
180
|
-
return props.isPrivateMember ? props.name : void 0;
|
|
181
|
-
}
|
|
182
|
-
}),
|
|
183
|
-
typeSection,
|
|
184
|
-
initializerSection
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
191
|
-
*/
|
|
192
|
-
/**
|
|
193
|
-
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
194
|
-
*
|
|
195
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
196
|
-
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
197
|
-
*/
|
|
198
|
-
function ClassPropertySet(props) {
|
|
199
|
-
return [createComponent(ClassMember, mergeProps(props, { get children() {
|
|
200
|
-
return [
|
|
201
|
-
"set ",
|
|
202
|
-
createComponent(PropertyName, { get name() {
|
|
203
|
-
return props.name;
|
|
204
|
-
} }),
|
|
205
|
-
createComponent(LexicalScope, { get children() {
|
|
206
|
-
return [
|
|
207
|
-
createComponent(CallSignature, { get parameters() {
|
|
208
|
-
return [{
|
|
209
|
-
name: "value",
|
|
210
|
-
type: createComponent(TypeRefContext, { get children() {
|
|
211
|
-
return props.type;
|
|
212
|
-
} })
|
|
213
|
-
}];
|
|
214
|
-
} }),
|
|
215
|
-
" ",
|
|
216
|
-
createComponent(Block, { get children() {
|
|
217
|
-
return props.children;
|
|
218
|
-
} })
|
|
219
|
-
];
|
|
220
|
-
} })
|
|
221
|
-
];
|
|
222
|
-
} }))];
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
226
|
-
*
|
|
227
|
-
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
228
|
-
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
229
|
-
*/
|
|
230
|
-
function ClassPropertyGet(props) {
|
|
231
|
-
return createComponent(ClassMember, mergeProps(props, { get children() {
|
|
232
|
-
return [
|
|
233
|
-
"get ",
|
|
234
|
-
createComponent(PropertyName, { get name() {
|
|
235
|
-
return props.name;
|
|
236
|
-
} }),
|
|
237
|
-
createComponent(LexicalScope, { get children() {
|
|
238
|
-
return [
|
|
239
|
-
createComponent(CallSignature, { get returnType() {
|
|
240
|
-
return createComponent(TypeRefContext, { get children() {
|
|
241
|
-
return props.type;
|
|
242
|
-
} });
|
|
243
|
-
} }),
|
|
244
|
-
" ",
|
|
245
|
-
createComponent(Block, { get children() {
|
|
246
|
-
return props.children;
|
|
247
|
-
} })
|
|
248
|
-
];
|
|
249
|
-
} })
|
|
250
|
-
];
|
|
251
|
-
} }));
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
255
|
-
*/
|
|
256
|
-
/**
|
|
257
|
-
* Generates a TypeScript class method declaration for the given reflection class.
|
|
258
|
-
*
|
|
259
|
-
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
260
|
-
* @returns A JSX element representing the class method declaration, which can be used within a ClassDeclaration component.
|
|
261
|
-
*/
|
|
262
|
-
function ClassMethod(props) {
|
|
263
|
-
const callProps = getCallSignatureProps(props);
|
|
264
|
-
const [_, rest] = splitProps(props, ["doc"]);
|
|
265
|
-
return [createComponent(Show, {
|
|
266
|
-
get when() {
|
|
267
|
-
return Boolean(props.doc);
|
|
268
|
-
},
|
|
269
|
-
get children() {
|
|
270
|
-
return createComponent(TSDoc, {
|
|
271
|
-
get heading() {
|
|
272
|
-
return props.doc;
|
|
273
|
-
},
|
|
274
|
-
get children() {
|
|
275
|
-
return memo(() => !!Array.isArray(rest.parameters))() && createComponent(TSDocParams, { get parameters() {
|
|
276
|
-
return rest.parameters;
|
|
277
|
-
} });
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}), createComponent(ClassMember, mergeProps(rest, { get children() {
|
|
282
|
-
return [
|
|
283
|
-
memo(() => props.async && "async "),
|
|
284
|
-
createComponent(PropertyName, {}),
|
|
285
|
-
createComponent(LexicalScope, { get children() {
|
|
286
|
-
return [
|
|
287
|
-
createComponent(CallSignature, callProps),
|
|
288
|
-
" ",
|
|
289
|
-
createComponent(Block, { get children() {
|
|
290
|
-
return props.children;
|
|
291
|
-
} })
|
|
292
|
-
];
|
|
293
|
-
} })
|
|
294
|
-
];
|
|
295
|
-
} }))];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
//#endregion
|
|
299
|
-
export { ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet };
|
|
300
|
-
//# sourceMappingURL=class-declaration.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class-declaration.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/dynamic-import-statement.tsx
|
|
7
|
-
/**
|
|
8
|
-
* Generates a dynamic import statement for a given module path and export name.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <DynamicImportStatement importPath="./my-module" exportName="myExport" const={true} name="myVar" />
|
|
13
|
-
* // const myVar = await import("./my-module").then(m => m.myExport);
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @param props - The properties for the dynamic import statement.
|
|
17
|
-
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
18
|
-
*/
|
|
19
|
-
function DynamicImportStatement(props) {
|
|
20
|
-
const { importPath, exportName = "default", const: isConst = true, ...rest } = props;
|
|
21
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, (0, _alloy_js_core_jsx_runtime.mergeProps)({ "const": isConst }, rest, { initializer: _alloy_js_core.code`await import("${importPath}").then(m => m.${exportName});` }));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.DynamicImportStatement = DynamicImportStatement;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
2
|
-
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
3
|
-
interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initializer"> {
|
|
4
|
-
/**
|
|
5
|
-
* The path of the module to import.
|
|
6
|
-
*/
|
|
7
|
-
importPath: string;
|
|
8
|
-
/**
|
|
9
|
-
* The name of the export to import from the module.
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue "default"
|
|
12
|
-
*/
|
|
13
|
-
exportName?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generates a dynamic import statement for a given module path and export name.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <DynamicImportStatement importPath="./my-module" exportName="myExport" const={true} name="myVar" />
|
|
21
|
-
* // const myVar = await import("./my-module").then(m => m.myExport);
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param props - The properties for the dynamic import statement.
|
|
25
|
-
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
26
|
-
*/
|
|
27
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps): import("@alloy-js/core").Children;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { DynamicImportStatement, DynamicImportStatementProps };
|
|
30
|
-
//# sourceMappingURL=dynamic-import-statement.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-import-statement.d.cts","names":[],"sources":["../../../src/typescript/components/dynamic-import-statement.tsx"],"mappings":";;UAqBiB,oCAAoC,KACnD;;;;EAMA;;;;;;EAOA;;;;;;;;;;;;;;iBAec,uBAAuB,OAAO,uDAA2B"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
2
|
-
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
3
|
-
interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initializer"> {
|
|
4
|
-
/**
|
|
5
|
-
* The path of the module to import.
|
|
6
|
-
*/
|
|
7
|
-
importPath: string;
|
|
8
|
-
/**
|
|
9
|
-
* The name of the export to import from the module.
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue "default"
|
|
12
|
-
*/
|
|
13
|
-
exportName?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generates a dynamic import statement for a given module path and export name.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <DynamicImportStatement importPath="./my-module" exportName="myExport" const={true} name="myVar" />
|
|
21
|
-
* // const myVar = await import("./my-module").then(m => m.myExport);
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param props - The properties for the dynamic import statement.
|
|
25
|
-
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
26
|
-
*/
|
|
27
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps): import("@alloy-js/core").Children;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { DynamicImportStatement, DynamicImportStatementProps };
|
|
30
|
-
//# sourceMappingURL=dynamic-import-statement.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-import-statement.d.mts","names":[],"sources":["../../../src/typescript/components/dynamic-import-statement.tsx"],"mappings":""}
|