@alloy-js/csharp 0.19.0-dev.1 → 0.19.0-dev.4

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.
Files changed (53) hide show
  1. package/dist/src/components/ClassDeclaration.d.ts +0 -8
  2. package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
  3. package/dist/src/components/ClassDeclaration.js +0 -43
  4. package/dist/src/components/constructor/constructor.d.ts +17 -0
  5. package/dist/src/components/constructor/constructor.d.ts.map +1 -0
  6. package/dist/src/components/constructor/constructor.js +47 -0
  7. package/dist/src/components/constructor/constructor.test.d.ts +2 -0
  8. package/dist/src/components/constructor/constructor.test.d.ts.map +1 -0
  9. package/dist/src/components/constructor/constructor.test.js +54 -0
  10. package/dist/src/components/index.d.ts +3 -1
  11. package/dist/src/components/index.d.ts.map +1 -1
  12. package/dist/src/components/index.js +3 -1
  13. package/dist/src/components/{ClassMethod.d.ts → method/method.d.ts} +22 -8
  14. package/dist/src/components/method/method.d.ts.map +1 -0
  15. package/dist/src/components/{ClassMethod.js → method/method.js} +13 -13
  16. package/dist/src/components/method/method.test.d.ts +2 -0
  17. package/dist/src/components/method/method.test.d.ts.map +1 -0
  18. package/dist/{test/class-method.test.js → src/components/method/method.test.js} +33 -10
  19. package/dist/src/components/property/property.d.ts.map +1 -1
  20. package/dist/src/components/property/property.js +1 -1
  21. package/dist/src/components/stc/index.d.ts +3 -2
  22. package/dist/src/components/stc/index.d.ts.map +1 -1
  23. package/dist/src/components/stc/index.js +4 -3
  24. package/dist/src/components/struct/declaration.d.ts +68 -0
  25. package/dist/src/components/struct/declaration.d.ts.map +1 -0
  26. package/dist/src/components/struct/declaration.js +78 -0
  27. package/dist/src/components/struct/declaration.test.d.ts +2 -0
  28. package/dist/src/components/struct/declaration.test.d.ts.map +1 -0
  29. package/dist/src/components/struct/declaration.test.js +211 -0
  30. package/dist/src/name-policy.d.ts +1 -1
  31. package/dist/src/name-policy.d.ts.map +1 -1
  32. package/dist/src/name-policy.js +1 -0
  33. package/dist/test/class-declaration.test.js +6 -5
  34. package/dist/test/using.test.js +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +2 -2
  37. package/src/components/ClassDeclaration.tsx +0 -44
  38. package/src/components/constructor/constructor.test.tsx +41 -0
  39. package/src/components/constructor/constructor.tsx +67 -0
  40. package/src/components/index.ts +3 -1
  41. package/{test/class-method.test.tsx → src/components/method/method.test.tsx} +28 -15
  42. package/src/components/{ClassMethod.tsx → method/method.tsx} +44 -19
  43. package/src/components/property/property.tsx +3 -1
  44. package/src/components/stc/index.ts +3 -2
  45. package/src/components/struct/declaration.test.tsx +169 -0
  46. package/src/components/struct/declaration.tsx +129 -0
  47. package/src/name-policy.ts +2 -0
  48. package/temp/api.json +3544 -3163
  49. package/test/class-declaration.test.tsx +8 -7
  50. package/test/using.test.tsx +1 -1
  51. package/dist/src/components/ClassMethod.d.ts.map +0 -1
  52. package/dist/test/class-method.test.d.ts +0 -2
  53. package/dist/test/class-method.test.d.ts.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import * as core from "@alloy-js/core";
2
2
  import { AccessModifiers } from "../modifiers.js";
3
3
  import { AttributesProp } from "./attributes/attributes.jsx";
4
- import { ParameterProps } from "./parameters/parameters.jsx";
5
4
  import { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
6
5
  export interface ClassModifiers {
7
6
  readonly abstract?: boolean;
@@ -74,13 +73,6 @@ export interface ClassDeclarationProps extends Omit<core.DeclarationProps, "name
74
73
  * ```
75
74
  */
76
75
  export declare function ClassDeclaration(props: ClassDeclarationProps): core.Children;
77
- export interface ClassConstructorProps extends AccessModifiers {
78
- parameters?: Array<ParameterProps>;
79
- refkey?: core.Refkey;
80
- symbol?: core.OutputSymbol;
81
- children?: core.Children;
82
- }
83
- export declare function ClassConstructor(props: ClassConstructorProps): core.Children;
84
76
  export interface ClassMemberProps extends AccessModifiers {
85
77
  name: string;
86
78
  type: core.Children;
@@ -1 +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AAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAEjD,yCAAyC;IACzC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IAEzB,uCAAuC;IACvC,cAAc,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAEjC;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,iBA6C5D;AAGD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CACrB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBA0BlD"}
@@ -8,7 +8,6 @@ import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
8
8
  import { AttributeList } from "./attributes/attributes.js";
9
9
  import { DocWhen } from "./doc/comment.js";
10
10
  import { Name } from "./Name.js";
11
- import { Parameters } from "./parameters/parameters.js";
12
11
  import { TypeParameterConstraints } from "./type-parameters/type-parameter-constraints.js";
13
12
  import { TypeParameters } from "./type-parameters/type-parameters.js";
14
13
  const getClassModifiers = makeModifiers(["abstract", "partial", "sealed", "static"]);
@@ -91,48 +90,6 @@ export function ClassDeclaration(props) {
91
90
  }
92
91
  });
93
92
  }
94
- // a C# class constructor
95
- export function ClassConstructor(props) {
96
- const scope = useCSharpScope();
97
- if (scope.kind !== "member" || scope.name !== "class-decl") {
98
- throw new Error("can't define a class constructor outside of a class-decl scope");
99
- }
100
-
101
- // fetch the class name from the scope
102
- const name = useCSharpNamePolicy().getName(scope.owner.name, "class-method");
103
- const ctorSymbol = new CSharpOutputSymbol(name, {
104
- scope,
105
- refkeys: props.refkey ?? core.refkey(name)
106
- });
107
-
108
- // scope for ctor declaration
109
- const ctorDeclScope = new CSharpMemberScope("constructor-decl", {
110
- owner: ctorSymbol
111
- });
112
- const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
113
-
114
- // note that scope wraps the ctor decl so that the params get the correct scope
115
- return _$createComponent(core.Declaration, {
116
- symbol: ctorSymbol,
117
- get children() {
118
- return _$createComponent(core.Scope, {
119
- value: ctorDeclScope,
120
- get children() {
121
- return [modifiers, _$createComponent(Name, {}), _$createComponent(Parameters, {
122
- get parameters() {
123
- return props.parameters;
124
- }
125
- }), _$createComponent(core.Block, {
126
- newline: true,
127
- get children() {
128
- return props.children;
129
- }
130
- })];
131
- }
132
- });
133
- }
134
- });
135
- }
136
93
 
137
94
  // properties for creating a class member
138
95
 
@@ -0,0 +1,17 @@
1
+ import { Refkey } from "@alloy-js/core";
2
+ import { Children } from "@alloy-js/core/jsx-runtime";
3
+ import { AccessModifiers } from "../../modifiers.js";
4
+ import { ParameterProps } from "../parameters/parameters.jsx";
5
+ /**
6
+ * Properties for {@link Constructor} component.
7
+ */
8
+ export interface ConstructorProps extends AccessModifiers {
9
+ /** Constructor parameters */
10
+ parameters?: ParameterProps[];
11
+ /** Refkey */
12
+ refkey?: Refkey;
13
+ /** Constructor body */
14
+ children?: Children;
15
+ }
16
+ export declare function Constructor(props: ConstructorProps): Children;
17
+ //# sourceMappingURL=constructor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constructor.d.ts","sourceRoot":"","sources":["../../../../src/components/constructor/constructor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAGP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACL,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,6BAA6B;IAC7B,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B,aAAa;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAiClD"}
@@ -0,0 +1,47 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { Block, Declaration, Name, refkey, Scope } from "@alloy-js/core";
3
+ import { computeModifiersPrefix, getAccessModifier } from "../../modifiers.js";
4
+ import { useCSharpNamePolicy } from "../../name-policy.js";
5
+ import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
+ import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
7
+ import { Parameters } from "../parameters/parameters.js";
8
+
9
+ /**
10
+ * Properties for {@link Constructor} component.
11
+ */
12
+
13
+ export function Constructor(props) {
14
+ const scope = useCSharpScope();
15
+ if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "struct-decl") {
16
+ throw new Error("can't define a class method outside of a class or struct scope");
17
+ }
18
+ const name = useCSharpNamePolicy().getName(scope.owner.name, "class-method");
19
+ const ctorSymbol = new CSharpOutputSymbol(name, {
20
+ scope,
21
+ refkeys: props.refkey ?? refkey(name)
22
+ });
23
+ const ctorDeclScope = new CSharpMemberScope("constructor-decl", {
24
+ owner: ctorSymbol
25
+ });
26
+ const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
27
+ return _$createComponent(Declaration, {
28
+ symbol: ctorSymbol,
29
+ get children() {
30
+ return _$createComponent(Scope, {
31
+ value: ctorDeclScope,
32
+ get children() {
33
+ return [modifiers, _$createComponent(Name, {}), _$createComponent(Parameters, {
34
+ get parameters() {
35
+ return props.parameters;
36
+ }
37
+ }), _$createComponent(Block, {
38
+ newline: true,
39
+ get children() {
40
+ return props.children;
41
+ }
42
+ })];
43
+ }
44
+ });
45
+ }
46
+ });
47
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=constructor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constructor.test.d.ts","sourceRoot":"","sources":["../../../../src/components/constructor/constructor.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import { createIntrinsic as _$createIntrinsic, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { refkey } from "@alloy-js/core";
3
+ import { expect, it } from "vitest";
4
+ import { TestNamespace } from "../../../test/utils.js";
5
+ import { ClassDeclaration } from "../ClassDeclaration.js";
6
+ import { SourceFile } from "../SourceFile.js";
7
+ import { Constructor } from "./constructor.js";
8
+ it("reference constructor parameters in body", () => {
9
+ const paramNameRefkey = refkey();
10
+ const paramSizeRefkey = refkey();
11
+ const ctorParams = [{
12
+ name: "name",
13
+ type: "string",
14
+ refkey: paramNameRefkey
15
+ }, {
16
+ name: "size",
17
+ type: "int",
18
+ refkey: paramSizeRefkey
19
+ }];
20
+ expect(_$createComponent(TestNamespace, {
21
+ get children() {
22
+ return _$createComponent(SourceFile, {
23
+ path: "Test.cs",
24
+ get children() {
25
+ return _$createComponent(ClassDeclaration, {
26
+ "public": true,
27
+ name: "TestClass",
28
+ get children() {
29
+ return _$createComponent(Constructor, {
30
+ "public": true,
31
+ parameters: ctorParams,
32
+ get children() {
33
+ return [paramNameRefkey, ";", _$createIntrinsic("hbr", {}), paramSizeRefkey, ";"];
34
+ }
35
+ });
36
+ }
37
+ });
38
+ }
39
+ });
40
+ }
41
+ })).toRenderTo(`
42
+ namespace TestCode
43
+ {
44
+ public class TestClass
45
+ {
46
+ public TestClass(string name, int size)
47
+ {
48
+ name;
49
+ size;
50
+ }
51
+ }
52
+ }
53
+ `);
54
+ });
@@ -1,6 +1,6 @@
1
1
  export * from "./attributes/attributes.jsx";
2
2
  export * from "./ClassDeclaration.jsx";
3
- export * from "./ClassMethod.jsx";
3
+ export * from "./constructor/constructor.jsx";
4
4
  export * from "./Declaration.js";
5
5
  export * from "./doc/comment.jsx";
6
6
  export * from "./doc/from-markdown.jsx";
@@ -8,6 +8,7 @@ export * from "./EnumDeclaration.jsx";
8
8
  export * from "./interface/declaration.js";
9
9
  export * from "./interface/method.js";
10
10
  export * from "./interface/property.js";
11
+ export * from "./method/method.jsx";
11
12
  export * from "./Name.js";
12
13
  export * from "./Namespace.js";
13
14
  export * from "./parameters/parameters.jsx";
@@ -16,6 +17,7 @@ export * from "./property/property.jsx";
16
17
  export * from "./record/declaration.js";
17
18
  export * from "./Reference.js";
18
19
  export * from "./SourceFile.js";
20
+ export * from "./struct/declaration.jsx";
19
21
  export type { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
20
22
  export * from "./UsingDirective.js";
21
23
  export * from "./var/declaration.jsx";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export * from "./attributes/attributes.js";
2
2
  export * from "./ClassDeclaration.js";
3
- export * from "./ClassMethod.js";
3
+ export * from "./constructor/constructor.js";
4
4
  export * from "./Declaration.js";
5
5
  export * from "./doc/comment.js";
6
6
  export * from "./doc/from-markdown.js";
@@ -8,6 +8,7 @@ export * from "./EnumDeclaration.js";
8
8
  export * from "./interface/declaration.js";
9
9
  export * from "./interface/method.js";
10
10
  export * from "./interface/property.js";
11
+ export * from "./method/method.js";
11
12
  export * from "./Name.js";
12
13
  export * from "./Namespace.js";
13
14
  export * from "./parameters/parameters.js";
@@ -16,6 +17,7 @@ export * from "./property/property.js";
16
17
  export * from "./record/declaration.js";
17
18
  export * from "./Reference.js";
18
19
  export * from "./SourceFile.js";
20
+ export * from "./struct/declaration.js";
19
21
  export * from "./UsingDirective.js";
20
22
  export * from "./var/declaration.js";
21
23
  export {};
@@ -1,16 +1,16 @@
1
1
  import { Children, Refkey } from "@alloy-js/core";
2
- import { AccessModifiers } from "../modifiers.js";
3
- import { AttributesProp } from "./attributes/attributes.jsx";
4
- import { ParameterProps } from "./parameters/parameters.jsx";
5
- import { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
2
+ import { AccessModifiers } from "../../modifiers.js";
3
+ import { AttributesProp } from "../attributes/attributes.jsx";
4
+ import { ParameterProps } from "../parameters/parameters.jsx";
5
+ import { TypeParameterProps } from "../type-parameters/type-parameter.jsx";
6
6
  /** Method modifiers. Can only be one. */
7
- export interface ClassMethodModifiers {
7
+ export interface MethodModifiers {
8
8
  readonly abstract?: boolean;
9
9
  readonly sealed?: boolean;
10
10
  readonly static?: boolean;
11
11
  readonly virtual?: boolean;
12
12
  }
13
- export interface ClassMethodProps extends AccessModifiers, ClassMethodModifiers {
13
+ export interface MethodProps extends AccessModifiers, MethodModifiers {
14
14
  name: string;
15
15
  refkey?: Refkey;
16
16
  children?: Children;
@@ -52,6 +52,20 @@ export interface ClassMethodProps extends AccessModifiers, ClassMethodModifiers
52
52
  * ```
53
53
  */
54
54
  attributes?: AttributesProp;
55
+ /**
56
+ * Use expression syntax for the method.
57
+ * @example
58
+ * ```tsx
59
+ * <ClassMethod name="MyMethod" lambda>
60
+ * this.MyProperty.Value;
61
+ * </ClassMethod>
62
+ * ```
63
+ * This will produce:
64
+ * ```csharp
65
+ * public void MyMethod() => this.MyProperty.Value;
66
+ * ```
67
+ */
68
+ expression?: boolean;
55
69
  }
56
- export declare function ClassMethod(props: ClassMethodProps): Children;
57
- //# sourceMappingURL=ClassMethod.d.ts.map
70
+ export declare function Method(props: MethodProps): Children;
71
+ //# sourceMappingURL=method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/components/method/method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAG3E,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAUD,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,eAAe;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAGD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,YAuDxC"}
@@ -1,14 +1,14 @@
1
1
  import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
2
  import { Block, MemberDeclaration, refkey, Scope } from "@alloy-js/core";
3
- import { computeModifiersPrefix, getAccessModifier, getAsyncModifier, makeModifiers } from "../modifiers.js";
4
- import { useCSharpNamePolicy } from "../name-policy.js";
5
- import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
6
- import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
7
- import { AttributeList } from "./attributes/attributes.js";
8
- import { DocWhen } from "./doc/comment.js";
9
- import { Parameters } from "./parameters/parameters.js";
10
- import { TypeParameterConstraints } from "./type-parameters/type-parameter-constraints.js";
11
- import { TypeParameters } from "./type-parameters/type-parameters.js";
3
+ import { computeModifiersPrefix, getAccessModifier, getAsyncModifier, makeModifiers } from "../../modifiers.js";
4
+ import { useCSharpNamePolicy } from "../../name-policy.js";
5
+ import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
+ import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
7
+ import { AttributeList } from "../attributes/attributes.js";
8
+ import { DocWhen } from "../doc/comment.js";
9
+ import { Parameters } from "../parameters/parameters.js";
10
+ import { TypeParameterConstraints } from "../type-parameters/type-parameter-constraints.js";
11
+ import { TypeParameters } from "../type-parameters/type-parameters.js";
12
12
 
13
13
  /** Method modifiers. Can only be one. */
14
14
 
@@ -17,11 +17,11 @@ const getMethodModifier = makeModifiers(["abstract", "sealed", "static", "virtua
17
17
  // properties for creating a method
18
18
 
19
19
  // a C# class method
20
- export function ClassMethod(props) {
20
+ export function Method(props) {
21
21
  const name = useCSharpNamePolicy().getName(props.name, "class-method");
22
22
  const scope = useCSharpScope();
23
- if (scope.kind !== "member" || scope.name !== "class-decl") {
24
- throw new Error("can't define a class method outside of a class scope");
23
+ if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "struct-decl") {
24
+ throw new Error("can't define a class method outside of a class or struct scope");
25
25
  }
26
26
  const methodSymbol = new CSharpOutputSymbol(name, {
27
27
  scope,
@@ -62,7 +62,7 @@ export function ClassMethod(props) {
62
62
  get parameters() {
63
63
  return props.typeParameters;
64
64
  }
65
- })), _$memo(() => _$memo(() => !!props.abstract)() ? ";" : _$createComponent(Block, {
65
+ })), _$memo(() => _$memo(() => !!props.abstract)() ? ";" : _$memo(() => !!props.expression)() ? [" => ", _$memo(() => props.children)] : _$createComponent(Block, {
66
66
  newline: true,
67
67
  get children() {
68
68
  return props.children;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=method.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.test.d.ts","sourceRoot":"","sources":["../../../../src/components/method/method.test.tsx"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { memo as _$memo, createComponent as _$createComponent, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
2
2
  import { describe, expect, it } from "vitest";
3
- import { ClassDeclaration, ClassMethod } from "../src/index.js";
4
- import { TestNamespace } from "./utils.js";
3
+ import { TestNamespace } from "../../../test/utils.js";
4
+ import { ClassDeclaration, Method } from "../../index.js";
5
5
  const Wrapper = props => _$createComponent(TestNamespace, {
6
6
  get children() {
7
7
  return _$createComponent(ClassDeclaration, {
@@ -18,7 +18,7 @@ describe("modifiers", () => {
18
18
  it.each(["public", "private", "protected", "internal"])("%s", accessModifier => {
19
19
  expect(_$createComponent(Wrapper, {
20
20
  get children() {
21
- return _$createComponent(ClassMethod, _$mergeProps({
21
+ return _$createComponent(Method, _$mergeProps({
22
22
  [accessModifier]: true
23
23
  }, {
24
24
  name: "MethodOne"
@@ -36,7 +36,7 @@ describe("modifiers", () => {
36
36
  it.each(["static", "virtual", "sealed"])("%s", methodModifier => {
37
37
  expect(_$createComponent(Wrapper, {
38
38
  get children() {
39
- return _$createComponent(ClassMethod, _$mergeProps({
39
+ return _$createComponent(Method, _$mergeProps({
40
40
  [methodModifier]: true
41
41
  }, {
42
42
  name: "MethodOne"
@@ -52,7 +52,7 @@ describe("modifiers", () => {
52
52
  it("abstract exclude body", () => {
53
53
  expect(_$createComponent(Wrapper, {
54
54
  get children() {
55
- return _$createComponent(ClassMethod, {
55
+ return _$createComponent(Method, {
56
56
  abstract: true,
57
57
  name: "MethodOne"
58
58
  });
@@ -68,7 +68,7 @@ describe("modifiers", () => {
68
68
  it("mark method async", () => {
69
69
  expect(_$createComponent(Wrapper, {
70
70
  get children() {
71
- return _$createComponent(ClassMethod, {
71
+ return _$createComponent(Method, {
72
72
  async: true,
73
73
  name: "MethodOne"
74
74
  });
@@ -83,7 +83,7 @@ describe("modifiers", () => {
83
83
  it("combine modifiers", () => {
84
84
  expect(_$createComponent(Wrapper, {
85
85
  get children() {
86
- return _$createComponent(ClassMethod, {
86
+ return _$createComponent(Method, {
87
87
  async: true,
88
88
  returns: "Task",
89
89
  "public": true,
@@ -102,7 +102,7 @@ describe("modifiers", () => {
102
102
  it("applies PascalCase naming policy", () => {
103
103
  expect(_$createComponent(Wrapper, {
104
104
  get children() {
105
- return _$createComponent(ClassMethod, {
105
+ return _$createComponent(Method, {
106
106
  name: "method_one"
107
107
  });
108
108
  }
@@ -123,7 +123,7 @@ it("defines params and return type", () => {
123
123
  }];
124
124
  const res = _$createComponent(Wrapper, {
125
125
  get children() {
126
- return _$createComponent(ClassMethod, {
126
+ return _$createComponent(Method, {
127
127
  "public": true,
128
128
  name: "MethodOne",
129
129
  parameters: params,
@@ -144,7 +144,7 @@ it("specify doc comment", () => {
144
144
  return _$createComponent(ClassDeclaration, {
145
145
  name: "Test",
146
146
  get children() {
147
- return _$createComponent(ClassMethod, {
147
+ return _$createComponent(Method, {
148
148
  name: "Method",
149
149
  doc: "This is a test"
150
150
  });
@@ -158,4 +158,27 @@ it("specify doc comment", () => {
158
158
  void Method() {}
159
159
  }
160
160
  `);
161
+ });
162
+ it("use expression body form", () => {
163
+ expect(_$createComponent(TestNamespace, {
164
+ get children() {
165
+ return _$createComponent(ClassDeclaration, {
166
+ name: "Test",
167
+ get children() {
168
+ return _$createComponent(Method, {
169
+ name: "Method",
170
+ doc: "This is a test",
171
+ expression: true,
172
+ children: "this.MyProperty.Value;"
173
+ });
174
+ }
175
+ });
176
+ }
177
+ })).toRenderTo(`
178
+ class Test
179
+ {
180
+ /// This is a test
181
+ void Method() => this.MyProperty.Value;
182
+ }
183
+ `);
161
184
  });
@@ -1 +1 @@
1
- {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/property/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAKR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG7E,0BAA0B;AAC1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAcD,gDAAgD;AAChD,MAAM,WAAW,aAAc,SAAQ,eAAe,EAAE,iBAAiB;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB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,OAAO,CAAC;CAC7B;AAcD,gDAAgD;AAChD,MAAM,WAAW,aAAc,SAAQ,eAAe,EAAE,iBAAiB;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IAEf,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC;IAEvB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,YAsD5C"}
@@ -25,7 +25,7 @@ const getModifiers = makeModifiers(["new", "static", "virtual", "sealed", "overr
25
25
  export function Property(props) {
26
26
  const name = useCSharpNamePolicy().getName(props.name, "class-property");
27
27
  const scope = useCSharpScope();
28
- if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "record-decl") {
28
+ if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "record-decl" && scope.name !== "struct-decl") {
29
29
  throw new Error("can't define an interface method outside of an interface scope");
30
30
  }
31
31
  const propertySymbol = new CSharpOutputSymbol(name, {
@@ -1,13 +1,14 @@
1
1
  import * as core from "@alloy-js/core";
2
2
  import * as base from "../index.js";
3
3
  export declare const ClassDeclaration: core.StcSignature<base.ClassDeclarationProps>;
4
- export declare const ClassConstructor: core.StcSignature<base.ClassConstructorProps>;
4
+ export declare const Constructor: core.StcSignature<base.ConstructorProps>;
5
5
  export declare const ClassMember: core.StcSignature<base.ClassMemberProps>;
6
- export declare const ClassMethod: core.StcSignature<base.ClassMethodProps>;
6
+ export declare const ClassMethod: core.StcSignature<base.MethodProps>;
7
7
  export declare const EnumDeclaration: core.StcSignature<base.EnumDeclarationProps>;
8
8
  export declare const EnumMember: core.StcSignature<base.EnumMemberProps>;
9
9
  export declare const Parameter: core.StcSignature<base.ParameterProps>;
10
10
  export declare const Parameters: core.StcSignature<base.ParametersProps>;
11
11
  export declare const ProjectDirectory: core.StcSignature<base.ProjectDirectoryProps>;
12
12
  export declare const UsingDirective: core.StcSignature<base.UsingDirectiveProps>;
13
+ export declare const StructDeclaration: core.StcSignature<base.StructDeclarationProps>;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,gBAAgB,+CAAkC,CAAC;AAChE,eAAO,MAAM,gBAAgB,+CAAkC,CAAC;AAChE,eAAO,MAAM,WAAW,0CAA6B,CAAC;AACtD,eAAO,MAAM,WAAW,0CAA6B,CAAC;AACtD,eAAO,MAAM,eAAe,8CAAiC,CAAC;AAC9D,eAAO,MAAM,UAAU,yCAA4B,CAAC;AACpD,eAAO,MAAM,SAAS,wCAA2B,CAAC;AAClD,eAAO,MAAM,UAAU,yCAA4B,CAAC;AACpD,eAAO,MAAM,gBAAgB,+CAAkC,CAAC;AAChE,eAAO,MAAM,cAAc,6CAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,gBAAgB,+CAAkC,CAAC;AAChE,eAAO,MAAM,WAAW,0CAA6B,CAAC;AACtD,eAAO,MAAM,WAAW,0CAA6B,CAAC;AACtD,eAAO,MAAM,WAAW,qCAAwB,CAAC;AACjD,eAAO,MAAM,eAAe,8CAAiC,CAAC;AAC9D,eAAO,MAAM,UAAU,yCAA4B,CAAC;AACpD,eAAO,MAAM,SAAS,wCAA2B,CAAC;AAClD,eAAO,MAAM,UAAU,yCAA4B,CAAC;AACpD,eAAO,MAAM,gBAAgB,+CAAkC,CAAC;AAChE,eAAO,MAAM,cAAc,6CAAgC,CAAC;AAC5D,eAAO,MAAM,iBAAiB,gDAAmC,CAAC"}
@@ -1,12 +1,13 @@
1
1
  import * as core from "@alloy-js/core";
2
2
  import * as base from "../index.js";
3
3
  export const ClassDeclaration = core.stc(base.ClassDeclaration);
4
- export const ClassConstructor = core.stc(base.ClassConstructor);
4
+ export const Constructor = core.stc(base.Constructor);
5
5
  export const ClassMember = core.stc(base.ClassMember);
6
- export const ClassMethod = core.stc(base.ClassMethod);
6
+ export const ClassMethod = core.stc(base.Method);
7
7
  export const EnumDeclaration = core.stc(base.EnumDeclaration);
8
8
  export const EnumMember = core.stc(base.EnumMember);
9
9
  export const Parameter = core.stc(base.Parameter);
10
10
  export const Parameters = core.stc(base.Parameters);
11
11
  export const ProjectDirectory = core.stc(base.ProjectDirectory);
12
- export const UsingDirective = core.stc(base.UsingDirective);
12
+ export const UsingDirective = core.stc(base.UsingDirective);
13
+ export const StructDeclaration = core.stc(base.StructDeclaration);
@@ -0,0 +1,68 @@
1
+ import * as core from "@alloy-js/core";
2
+ import { AccessModifiers } from "../../modifiers.js";
3
+ import { AttributesProp } from "../attributes/attributes.jsx";
4
+ import { TypeParameterProps } from "../type-parameters/type-parameter.jsx";
5
+ export interface StructModifiers {
6
+ readonly new?: boolean;
7
+ readonly readonly?: boolean;
8
+ readonly ref?: boolean;
9
+ readonly partial?: boolean;
10
+ }
11
+ export interface StructDeclarationProps extends Omit<core.DeclarationProps, "nameKind">, AccessModifiers, StructModifiers {
12
+ name: string;
13
+ /** Doc comment */
14
+ doc?: core.Children;
15
+ refkey?: core.Refkey;
16
+ /**
17
+ * Type parameters for the struct
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <StructDeclaration name="IList" typeParameters={["T"]} />
22
+ * ```
23
+ * This will produce:
24
+ * ```csharp
25
+ * public struct IList<T>
26
+ * ```
27
+ */
28
+ typeParameters?: (TypeParameterProps | string)[];
29
+ /**
30
+ * Define attributes to attach
31
+ * @example
32
+ * ```tsx
33
+ * <StructDeclaration name="MyStruct" attributes={[
34
+ * <Attribute name="Test" />
35
+ * <Attribute name="Test2" args={["arg1", "arg2"]} />
36
+ * ]} />
37
+ * ```
38
+ * This will produce:
39
+ * ```csharp
40
+ * [Test]
41
+ * [Test2("arg1", "arg2")]
42
+ * public struct MyStruct
43
+ * ```
44
+ */
45
+ attributes?: AttributesProp;
46
+ }
47
+ /**
48
+ * CSharp struct declaration.
49
+ * @example
50
+ * ```tsx
51
+ * <StructDeclaration public name="IMyStruct">
52
+ * <StructMember public name="MyProperty" type="int" />
53
+ * <StructMethod public name="MyMethod" returnType="void">
54
+ * <Parameter name="value" type="int" />
55
+ * </StructMethod>
56
+ * </StructDeclaration>
57
+ * ```
58
+ * This will produce:
59
+ * ```csharp
60
+ * public struct MyIface
61
+ * {
62
+ * public int MyProperty { get; set; }
63
+ * public void MyMethod(int value);
64
+ * }
65
+ * ```
66
+ */
67
+ export declare function StructDeclaration(props: StructDeclarationProps): core.Children;
68
+ //# sourceMappingURL=declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/struct/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAG3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAUD,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBAiC9D"}