@alloy-js/csharp 0.18.0-dev.6 → 0.18.0-dev.8

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 (64) hide show
  1. package/dist/src/components/ClassDeclaration.d.ts +2 -0
  2. package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
  3. package/dist/src/components/ClassDeclaration.js +6 -1
  4. package/dist/src/components/ClassMethod.d.ts +11 -2
  5. package/dist/src/components/ClassMethod.d.ts.map +1 -1
  6. package/dist/src/components/ClassMethod.js +11 -2
  7. package/dist/src/components/doc/comment.d.ts +69 -0
  8. package/dist/src/components/doc/comment.d.ts.map +1 -0
  9. package/dist/src/components/doc/comment.js +71 -0
  10. package/dist/src/components/doc/comment.test.d.ts +2 -0
  11. package/dist/src/components/doc/comment.test.d.ts.map +1 -0
  12. package/dist/src/components/doc/comment.test.js +338 -0
  13. package/dist/src/components/index.d.ts +3 -1
  14. package/dist/src/components/index.d.ts.map +1 -1
  15. package/dist/src/components/index.js +3 -1
  16. package/dist/src/components/interface/declaration.d.ts +34 -0
  17. package/dist/src/components/interface/declaration.d.ts.map +1 -0
  18. package/dist/src/components/interface/declaration.js +90 -0
  19. package/dist/src/components/interface/declaration.test.d.ts +2 -0
  20. package/dist/src/components/interface/declaration.test.d.ts.map +1 -0
  21. package/dist/src/components/interface/declaration.test.js +69 -0
  22. package/dist/src/components/interface/method.d.ts +18 -0
  23. package/dist/src/components/interface/method.d.ts.map +1 -0
  24. package/dist/src/components/interface/method.js +59 -0
  25. package/dist/src/components/interface/method.test.d.ts +2 -0
  26. package/dist/src/components/interface/method.test.d.ts.map +1 -0
  27. package/dist/src/components/interface/method.test.js +131 -0
  28. package/dist/src/components/interface/property.d.ts +21 -0
  29. package/dist/src/components/interface/property.d.ts.map +1 -0
  30. package/dist/src/components/interface/property.js +59 -0
  31. package/dist/src/components/interface/property.test.d.ts +2 -0
  32. package/dist/src/components/interface/property.test.d.ts.map +1 -0
  33. package/dist/src/components/interface/property.test.js +165 -0
  34. package/dist/src/modifiers.d.ts +0 -8
  35. package/dist/src/modifiers.d.ts.map +1 -1
  36. package/dist/src/modifiers.js +0 -4
  37. package/dist/src/name-policy.d.ts +1 -1
  38. package/dist/src/name-policy.d.ts.map +1 -1
  39. package/dist/src/name-policy.js +1 -0
  40. package/dist/test/class-method.test.js +21 -0
  41. package/dist/test/class.test.js +13 -0
  42. package/dist/test/vitest.setup.d.ts +2 -0
  43. package/dist/test/vitest.setup.d.ts.map +1 -0
  44. package/dist/test/vitest.setup.js +1 -0
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +2 -2
  47. package/src/components/ClassDeclaration.tsx +4 -0
  48. package/src/components/ClassMethod.tsx +24 -3
  49. package/src/components/doc/comment.test.tsx +336 -0
  50. package/src/components/doc/comment.tsx +122 -0
  51. package/src/components/index.ts +3 -1
  52. package/src/components/interface/declaration.test.tsx +56 -0
  53. package/src/components/interface/declaration.tsx +109 -0
  54. package/src/components/interface/method.test.tsx +120 -0
  55. package/src/components/interface/method.tsx +82 -0
  56. package/src/components/interface/property.test.tsx +144 -0
  57. package/src/components/interface/property.tsx +90 -0
  58. package/src/modifiers.ts +0 -15
  59. package/src/name-policy.ts +2 -0
  60. package/temp/api.json +699 -81
  61. package/test/class-method.test.tsx +16 -0
  62. package/test/class.test.tsx +11 -0
  63. package/test/vitest.setup.ts +1 -0
  64. package/vitest.config.ts +3 -0
@@ -9,6 +9,8 @@ export interface ClassModifiers {
9
9
  }
10
10
  export interface ClassDeclarationProps extends Omit<core.DeclarationProps, "nameKind">, AccessModifiers, ClassModifiers {
11
11
  name: string;
12
+ /** Doc comment */
13
+ doc?: core.Children;
12
14
  refkey?: core.Refkey;
13
15
  typeParameters?: Record<string, core.Refkey>;
14
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClassDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/ClassDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK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kC5D;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;CACtB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAyBlD"}
@@ -6,6 +6,7 @@ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
7
7
  import { Name } from "./Name.js";
8
8
  import { Parameters } from "./Parameters.js";
9
+ import { DocWhen } from "./doc/comment.js";
9
10
  const getClassModifiers = makeModifiers(["abstract", "partial", "sealed", "static"]);
10
11
 
11
12
  // properties for creating a class
@@ -74,7 +75,11 @@ export function ClassDeclaration(props) {
74
75
  return _$createComponent(core.Declaration, {
75
76
  symbol: thisClassSymbol,
76
77
  get children() {
77
- return [modifiers, "class ", _$createComponent(Name, {}), typeParams, _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && _$createComponent(core.Block, {
78
+ return [_$createComponent(DocWhen, {
79
+ get doc() {
80
+ return props.doc;
81
+ }
82
+ }), modifiers, "class ", _$createComponent(Name, {}), typeParams, _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && _$createComponent(core.Block, {
78
83
  newline: true,
79
84
  get children() {
80
85
  return _$createComponent(core.Scope, {
@@ -1,7 +1,14 @@
1
1
  import { Children, Refkey } from "@alloy-js/core";
2
- import { AccessModifiers, MethodModifiers } from "../modifiers.js";
2
+ import { AccessModifiers } from "../modifiers.js";
3
3
  import { ParameterProps } from "./Parameters.jsx";
4
- export interface ClassMethodProps extends AccessModifiers, MethodModifiers {
4
+ /** Method modifiers. Can only be one. */
5
+ export interface ClassMethodModifiers {
6
+ readonly abstract?: boolean;
7
+ readonly sealed?: boolean;
8
+ readonly static?: boolean;
9
+ readonly virtual?: boolean;
10
+ }
11
+ export interface ClassMethodProps extends AccessModifiers, ClassMethodModifiers {
5
12
  name: string;
6
13
  refkey?: Refkey;
7
14
  children?: Children;
@@ -11,6 +18,8 @@ export interface ClassMethodProps extends AccessModifiers, MethodModifiers {
11
18
  * If true, the method will be declared as an async method.
12
19
  */
13
20
  async?: boolean;
21
+ /** Doc comment */
22
+ doc?: Children;
14
23
  }
15
24
  export declare function ClassMethod(props: ClassMethodProps): Children;
16
25
  //# sourceMappingURL=ClassMethod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassMethod.d.ts","sourceRoot":"","sources":["../../../src/components/ClassMethod.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAKf,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAc,MAAM,kBAAkB,CAAC;AAG9D,MAAM,WAAW,gBAAiB,SAAQ,eAAe,EAAE,eAAe;IACxE,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;CACjB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAoClD"}
1
+ {"version":3,"file":"ClassMethod.d.ts","sourceRoot":"","sources":["../../../src/components/ClassMethod.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAc,MAAM,kBAAkB,CAAC;AAG9D,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,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,gBACf,SAAQ,eAAe,EACrB,oBAAoB;IACtB,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;CAChB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAqClD"}
@@ -1,10 +1,15 @@
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, getMethodModifier } from "../modifiers.js";
3
+ import { computeModifiersPrefix, getAccessModifier, getAsyncModifier, makeModifiers } from "../modifiers.js";
4
4
  import { useCSharpNamePolicy } from "../name-policy.js";
5
5
  import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
7
7
  import { Parameters } from "./Parameters.js";
8
+ import { DocWhen } from "./doc/comment.js";
9
+
10
+ /** Method modifiers. Can only be one. */
11
+
12
+ const getMethodModifier = makeModifiers(["abstract", "sealed", "static", "virtual"]);
8
13
 
9
14
  // properties for creating a method
10
15
 
@@ -38,7 +43,11 @@ export function ClassMethod(props) {
38
43
  return _$createComponent(Scope, {
39
44
  value: methodScope,
40
45
  get children() {
41
- return [modifiers, returns, " ", name, "(", params, ")", _$memo(() => _$memo(() => !!props.abstract)() ? ";" : _$createComponent(Block, {
46
+ return [_$createComponent(DocWhen, {
47
+ get doc() {
48
+ return props.doc;
49
+ }
50
+ }), modifiers, returns, " ", name, "(", params, ")", _$memo(() => _$memo(() => !!props.abstract)() ? ";" : _$createComponent(Block, {
42
51
  newline: true,
43
52
  get children() {
44
53
  return props.children;
@@ -0,0 +1,69 @@
1
+ import { Children } from "@alloy-js/core";
2
+ export interface DocCommentProps {
3
+ children: Children;
4
+ }
5
+ export declare function DocComment(props: DocCommentProps): Children;
6
+ export interface DocWhenProps {
7
+ doc: Children | undefined;
8
+ }
9
+ /** Conditionally render the given doc in a <DocComment /> component and tail with a line */
10
+ export declare function DocWhen(props: DocWhenProps): Children;
11
+ export interface DocCommentTagProps {
12
+ children: Children;
13
+ }
14
+ export declare function makeDocCommentTag(name: string): (props: DocCommentProps) => Children;
15
+ export declare function makeInlineDocCommentTag(name: string): (props: DocCommentProps) => string;
16
+ export declare const DocSummary: (props: DocCommentProps) => Children;
17
+ export declare const DocCode: (props: DocCommentProps) => Children;
18
+ export declare const DocC: (props: DocCommentProps) => Children;
19
+ export declare const DocExample: (props: DocCommentProps) => Children;
20
+ export declare const DocException: (props: DocCommentProps) => Children;
21
+ export interface DocIncludeProps {
22
+ /** is the file name of an external XML file. The file name is interpreted relative to the file that contains the include tag. */
23
+ file: string;
24
+ /** is an XPath expression that selects some of the XML in the external XML file. */
25
+ path?: string;
26
+ }
27
+ export declare const DocInclude: (props: DocIncludeProps) => string;
28
+ export interface DocParamProps {
29
+ name: string;
30
+ children: Children;
31
+ }
32
+ export declare const DocParam: (props: DocParamProps) => Children;
33
+ export interface DocTypeParamProps {
34
+ name: string;
35
+ children: Children;
36
+ }
37
+ export declare const DocTypeParam: (props: DocTypeParamProps) => Children;
38
+ export declare const DocReturns: (props: DocCommentProps) => Children;
39
+ export declare const DocRemarks: (props: DocCommentProps) => Children;
40
+ export declare const DocValue: (props: DocCommentProps) => Children;
41
+ export declare const DocPermission: (props: DocCommentProps) => Children;
42
+ export declare const DocResponse: (props: DocCommentProps) => Children;
43
+ export declare const DocCompletionList: (props: DocCommentProps) => Children;
44
+ export declare const DocList: (props: DocCommentProps) => Children;
45
+ export declare const DocItem: (props: DocCommentProps) => Children;
46
+ export declare const DocTerm: (props: DocCommentProps) => Children;
47
+ export declare const DocDescription: (props: DocCommentProps) => Children;
48
+ export declare const DocPara: (props: DocCommentProps) => Children;
49
+ export interface DocSeeProps {
50
+ cref: string;
51
+ langword?: string;
52
+ children?: Children;
53
+ }
54
+ export declare const DocSee: (props: DocSeeProps) => string;
55
+ export interface DocSeeAlsoProps {
56
+ cref: string;
57
+ langword?: string;
58
+ children?: Children;
59
+ }
60
+ export declare const DocSeeAlso: (props: DocSeeAlsoProps) => string;
61
+ export interface DocParamRefProps {
62
+ name: string;
63
+ }
64
+ export declare const DocParamRef: (props: DocParamRefProps) => string;
65
+ export interface DocTypeParamRefProps {
66
+ name: string;
67
+ }
68
+ export declare const DocTypeParamRef: (props: DocTypeParamRefProps) => string;
69
+ //# sourceMappingURL=comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../../src/components/doc/comment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAShD;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC3B;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,YAO1C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAAC,IAAI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DmB,eAAe,aAsDN,CAAC;AACjD,eAAO,MAAM,OAAO,UAvDmB,eAAe,aAuDN,CAAC;AACjD,eAAO,MAAM,cAAc,UAxDY,eAAe,aAwDQ,CAAC;AAC/D,eAAO,MAAM,OAAO,UAzDmB,eAAe,aAyDN,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AACD,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,WACkG,CAAC;AAE5I,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AACD,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,WACkG,CAAC;AAEpJ,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AACD,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,WACd,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AACD,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,WAClB,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { code, List, Prose, Show } from "@alloy-js/core";
3
+ export function DocComment(props) {
4
+ return ["/// ", _$createIntrinsic("align", {
5
+ string: "/// ",
6
+ get children() {
7
+ return _$createComponent(List, {
8
+ get children() {
9
+ return props.children;
10
+ }
11
+ });
12
+ }
13
+ })];
14
+ }
15
+ /** Conditionally render the given doc in a <DocComment /> component and tail with a line */
16
+ export function DocWhen(props) {
17
+ return _$createComponent(Show, {
18
+ get when() {
19
+ return Boolean(props.doc);
20
+ },
21
+ get children() {
22
+ return [_$createComponent(DocComment, {
23
+ get children() {
24
+ return props.doc;
25
+ }
26
+ }), _$createIntrinsic("hbr", {})];
27
+ }
28
+ });
29
+ }
30
+ export function makeDocCommentTag(name) {
31
+ return function DocCommentTag(props) {
32
+ return _$createComponent(Prose, {
33
+ get children() {
34
+ return code`
35
+ <${name}>
36
+ ${props.children}
37
+ </${name}>`;
38
+ }
39
+ });
40
+ };
41
+ }
42
+ export function makeInlineDocCommentTag(name) {
43
+ return function DocCommentTag(props) {
44
+ return `<${name}>${props.children}</${name}>`;
45
+ };
46
+ }
47
+ export const DocSummary = makeDocCommentTag("summary");
48
+ export const DocCode = makeDocCommentTag("code");
49
+ export const DocC = makeDocCommentTag("c");
50
+ export const DocExample = makeDocCommentTag("example");
51
+ export const DocException = makeDocCommentTag("exception");
52
+ export const DocInclude = props => {
53
+ return `<include file="${props.file}" path="${props.path}" />`;
54
+ };
55
+ export const DocParam = props => code`<param name="${props.name}">${props.children}</param>`;
56
+ export const DocTypeParam = props => code`<typeparam name="${props.name}">${props.children}</typeparam>`;
57
+ export const DocReturns = makeDocCommentTag("returns");
58
+ export const DocRemarks = makeDocCommentTag("remarks");
59
+ export const DocValue = makeDocCommentTag("value");
60
+ export const DocPermission = makeDocCommentTag("permission");
61
+ export const DocResponse = makeDocCommentTag("response");
62
+ export const DocCompletionList = makeDocCommentTag("completionlist");
63
+ export const DocList = makeDocCommentTag("list");
64
+ export const DocItem = makeDocCommentTag("item");
65
+ export const DocTerm = makeDocCommentTag("term");
66
+ export const DocDescription = makeDocCommentTag("description");
67
+ export const DocPara = makeDocCommentTag("para");
68
+ export const DocSee = props => `<see cref="${props.cref}"${props.langword ? ` langword="${props.langword}"` : ""}${props.children ? `>${props.children}</see>` : " />"}`;
69
+ export const DocSeeAlso = props => `<seealso cref="${props.cref}"${props.langword ? ` langword="${props.langword}"` : ""}${props.children ? `>${props.children}</seealso>` : " />"}`;
70
+ export const DocParamRef = props => `<paramref name="${props.name}" />`;
71
+ export const DocTypeParamRef = props => `<typeparamref name="${props.name}" />`;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=comment.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.test.d.ts","sourceRoot":"","sources":["../../../../src/components/doc/comment.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,338 @@
1
+ import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { expect, it } from "vitest";
3
+ import { DocC, DocCode, DocComment, DocCompletionList, DocDescription, DocExample, DocException, DocInclude, DocItem, DocList, DocPara, DocParam, DocParamRef, DocPermission, DocRemarks, DocResponse, DocReturns, DocSee, DocSeeAlso, DocSummary, DocTerm, DocTypeParam, DocTypeParamRef, DocValue } from "./comment.js";
4
+ it("define summary", () => {
5
+ expect(_$createComponent(DocComment, {
6
+ get children() {
7
+ return _$createComponent(DocSummary, {
8
+ children: "This is a sample doc comment"
9
+ });
10
+ }
11
+ })).toRenderTo(`
12
+ /// <summary>
13
+ /// This is a sample doc comment
14
+ /// </summary>
15
+ `);
16
+ });
17
+ it("define code", () => {
18
+ expect(_$createComponent(DocComment, {
19
+ get children() {
20
+ return _$createComponent(DocCode, {
21
+ children: "code sample"
22
+ });
23
+ }
24
+ })).toRenderTo(`
25
+ /// <code>
26
+ /// code sample
27
+ /// </code>
28
+ `);
29
+ });
30
+ it("define c", () => {
31
+ expect(_$createComponent(DocComment, {
32
+ get children() {
33
+ return _$createComponent(DocC, {
34
+ children: "inline code"
35
+ });
36
+ }
37
+ })).toRenderTo(`
38
+ /// <c>
39
+ /// inline code
40
+ /// </c>
41
+ `);
42
+ });
43
+ it("define example", () => {
44
+ expect(_$createComponent(DocComment, {
45
+ get children() {
46
+ return _$createComponent(DocExample, {
47
+ children: "example usage"
48
+ });
49
+ }
50
+ })).toRenderTo(`
51
+ /// <example>
52
+ /// example usage
53
+ /// </example>
54
+ `);
55
+ });
56
+ it("define exception", () => {
57
+ expect(_$createComponent(DocComment, {
58
+ get children() {
59
+ return _$createComponent(DocException, {
60
+ children: "exception info"
61
+ });
62
+ }
63
+ })).toRenderTo(`
64
+ /// <exception>
65
+ /// exception info
66
+ /// </exception>
67
+ `);
68
+ });
69
+ it("define include", () => {
70
+ expect(_$createComponent(DocComment, {
71
+ get children() {
72
+ return [_$memo(() => DocInclude({
73
+ file: "external.xml",
74
+ path: "/doc/summary"
75
+ }))];
76
+ }
77
+ })).toRenderTo(`
78
+ /// <include file="external.xml" path="/doc/summary" />
79
+ `);
80
+ });
81
+ it("define param", () => {
82
+ expect(_$createComponent(DocComment, {
83
+ get children() {
84
+ return _$createComponent(DocParam, {
85
+ name: "x",
86
+ children: "parameter x"
87
+ });
88
+ }
89
+ })).toRenderTo(`
90
+ /// <param name="x">parameter x</param>
91
+ `);
92
+ });
93
+ it("define typeparam", () => {
94
+ expect(_$createComponent(DocComment, {
95
+ get children() {
96
+ return _$createComponent(DocTypeParam, {
97
+ name: "T",
98
+ children: "type parameter T"
99
+ });
100
+ }
101
+ })).toRenderTo(`
102
+ /// <typeparam name="T">type parameter T</typeparam>
103
+ `);
104
+ });
105
+ it("define returns", () => {
106
+ expect(_$createComponent(DocComment, {
107
+ get children() {
108
+ return _$createComponent(DocReturns, {
109
+ children: "return value"
110
+ });
111
+ }
112
+ })).toRenderTo(`
113
+ /// <returns>
114
+ /// return value
115
+ /// </returns>
116
+ `);
117
+ });
118
+ it("define remarks", () => {
119
+ expect(_$createComponent(DocComment, {
120
+ get children() {
121
+ return _$createComponent(DocRemarks, {
122
+ children: "remarks here"
123
+ });
124
+ }
125
+ })).toRenderTo(`
126
+ /// <remarks>
127
+ /// remarks here
128
+ /// </remarks>
129
+ `);
130
+ });
131
+ it("define value", () => {
132
+ expect(_$createComponent(DocComment, {
133
+ get children() {
134
+ return _$createComponent(DocValue, {
135
+ children: "property value"
136
+ });
137
+ }
138
+ })).toRenderTo(`
139
+ /// <value>
140
+ /// property value
141
+ /// </value>
142
+ `);
143
+ });
144
+ it("define permission", () => {
145
+ expect(_$createComponent(DocComment, {
146
+ get children() {
147
+ return _$createComponent(DocPermission, {
148
+ children: "permission info"
149
+ });
150
+ }
151
+ })).toRenderTo(`
152
+ /// <permission>
153
+ /// permission info
154
+ /// </permission>
155
+ `);
156
+ });
157
+ it("define response", () => {
158
+ expect(_$createComponent(DocComment, {
159
+ get children() {
160
+ return _$createComponent(DocResponse, {
161
+ children: "response info"
162
+ });
163
+ }
164
+ })).toRenderTo(`
165
+ /// <response>
166
+ /// response info
167
+ /// </response>
168
+ `);
169
+ });
170
+ it("define completionlist", () => {
171
+ expect(_$createComponent(DocComment, {
172
+ get children() {
173
+ return _$createComponent(DocCompletionList, {
174
+ children: "completion list"
175
+ });
176
+ }
177
+ })).toRenderTo(`
178
+ /// <completionlist>
179
+ /// completion list
180
+ /// </completionlist>
181
+ `);
182
+ });
183
+ it("define list", () => {
184
+ expect(_$createComponent(DocComment, {
185
+ get children() {
186
+ return _$createComponent(DocList, {
187
+ children: "list content"
188
+ });
189
+ }
190
+ })).toRenderTo(`
191
+ /// <list>
192
+ /// list content
193
+ /// </list>
194
+ `);
195
+ });
196
+ it("define item", () => {
197
+ expect(_$createComponent(DocComment, {
198
+ get children() {
199
+ return _$createComponent(DocItem, {
200
+ children: "item content"
201
+ });
202
+ }
203
+ })).toRenderTo(`
204
+ /// <item>
205
+ /// item content
206
+ /// </item>
207
+ `);
208
+ });
209
+ it("define term", () => {
210
+ expect(_$createComponent(DocComment, {
211
+ get children() {
212
+ return _$createComponent(DocTerm, {
213
+ children: "term content"
214
+ });
215
+ }
216
+ })).toRenderTo(`
217
+ /// <term>
218
+ /// term content
219
+ /// </term>
220
+ `);
221
+ });
222
+ it("define description", () => {
223
+ expect(_$createComponent(DocComment, {
224
+ get children() {
225
+ return _$createComponent(DocDescription, {
226
+ children: "description content"
227
+ });
228
+ }
229
+ })).toRenderTo(`
230
+ /// <description>
231
+ /// description content
232
+ /// </description>
233
+ `);
234
+ });
235
+ it("define para", () => {
236
+ expect(_$createComponent(DocComment, {
237
+ get children() {
238
+ return _$createComponent(DocPara, {
239
+ children: "paragraph content"
240
+ });
241
+ }
242
+ })).toRenderTo(`
243
+ /// <para>
244
+ /// paragraph content
245
+ /// </para>
246
+ `);
247
+ });
248
+ it("define see", () => {
249
+ expect(_$createComponent(DocComment, {
250
+ get children() {
251
+ return [_$memo(() => DocSee({
252
+ cref: "T:MyType"
253
+ }))];
254
+ }
255
+ })).toRenderTo(`
256
+ /// <see cref="T:MyType" />
257
+ `);
258
+ });
259
+ it("define seealso", () => {
260
+ expect(_$createComponent(DocComment, {
261
+ get children() {
262
+ return [_$memo(() => DocSeeAlso({
263
+ cref: "T:OtherType"
264
+ }))];
265
+ }
266
+ })).toRenderTo(`
267
+ /// <seealso cref="T:OtherType" />
268
+ `);
269
+ });
270
+ it("define paramref", () => {
271
+ expect(_$createComponent(DocComment, {
272
+ get children() {
273
+ return [_$memo(() => DocParamRef({
274
+ name: "x"
275
+ }))];
276
+ }
277
+ })).toRenderTo(`
278
+ /// <paramref name="x" />
279
+ `);
280
+ });
281
+ it("define typeparamref", () => {
282
+ expect(_$createComponent(DocComment, {
283
+ get children() {
284
+ return [_$memo(() => DocTypeParamRef({
285
+ name: "T"
286
+ }))];
287
+ }
288
+ })).toRenderTo(`
289
+ /// <typeparamref name="T" />
290
+ `);
291
+ });
292
+ it("wrap long summary", () => {
293
+ expect(_$createComponent(DocComment, {
294
+ get children() {
295
+ return _$createComponent(DocSummary, {
296
+ children: "This is a very long sample doc comment that exceeds the typical line length limit and should be wrapped appropriately in the generated documentation."
297
+ });
298
+ }
299
+ })).toRenderTo(`
300
+ /// <summary>
301
+ /// This is a very long sample doc comment that exceeds the typical line length limit
302
+ /// and should be wrapped appropriately in the generated documentation.
303
+ /// </summary>
304
+ `);
305
+ });
306
+ it("combine multiple tags", () => {
307
+ expect(_$createComponent(DocComment, {
308
+ get children() {
309
+ return [_$createComponent(DocSummary, {
310
+ children: "This operator determines whether two Points have the same location."
311
+ }), _$createComponent(DocParam, {
312
+ name: "p1",
313
+ children: "The first Point to be compared."
314
+ }), _$createComponent(DocParam, {
315
+ name: "p2",
316
+ children: "The second Point to be compared."
317
+ }), _$createComponent(DocReturns, {
318
+ children: "True if the Points do not have the same location and the exact same type; otherwise, false."
319
+ }), _$createComponent(DocSeeAlso, {
320
+ cref: "Equals"
321
+ }), _$createComponent(DocSeeAlso, {
322
+ cref: "operator=="
323
+ })];
324
+ }
325
+ })).toRenderTo(`
326
+ /// <summary>
327
+ /// This operator determines whether two Points have the same location.
328
+ /// </summary>
329
+ /// <param name="p1">The first Point to be compared.</param>
330
+ /// <param name="p2">The second Point to be compared.</param>
331
+ /// <returns>
332
+ /// True if the Points do not have the same location and the exact same type; otherwise,
333
+ /// false.
334
+ /// </returns>
335
+ /// <seealso cref="Equals" />
336
+ /// <seealso cref="operator==" />
337
+ `);
338
+ });
@@ -1,7 +1,9 @@
1
1
  export * from "./ClassDeclaration.jsx";
2
- export { ClassMethod, type ClassMethodProps } from "./ClassMethod.jsx";
2
+ export * from "./ClassMethod.jsx";
3
3
  export * from "./Declaration.js";
4
4
  export * from "./EnumDeclaration.jsx";
5
+ export * from "./interface/declaration.js";
6
+ export * from "./interface/method.js";
5
7
  export * from "./Name.js";
6
8
  export * from "./Namespace.js";
7
9
  export * from "./Parameters.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  export * from "./ClassDeclaration.js";
2
- export { ClassMethod } from "./ClassMethod.js";
2
+ export * from "./ClassMethod.js";
3
3
  export * from "./Declaration.js";
4
4
  export * from "./EnumDeclaration.js";
5
+ export * from "./interface/declaration.js";
6
+ export * from "./interface/method.js";
5
7
  export * from "./Name.js";
6
8
  export * from "./Namespace.js";
7
9
  export * from "./Parameters.js";
@@ -0,0 +1,34 @@
1
+ import * as core from "@alloy-js/core";
2
+ import { AccessModifiers } from "../../modifiers.js";
3
+ export interface InterfaceModifiers {
4
+ readonly partial?: boolean;
5
+ }
6
+ export interface InterfaceDeclarationProps extends Omit<core.DeclarationProps, "nameKind">, AccessModifiers, InterfaceModifiers {
7
+ name: string;
8
+ /** Doc comment */
9
+ doc?: core.Children;
10
+ refkey?: core.Refkey;
11
+ typeParameters?: Record<string, core.Refkey>;
12
+ }
13
+ /**
14
+ * CSharp interface declaration.
15
+ * @example
16
+ * ```tsx
17
+ * <InterfaceDeclaration public name="IMyInterface">
18
+ * <InterfaceMember public name="MyProperty" type="int" />
19
+ * <InterfaceMethod public name="MyMethod" returnType="void">
20
+ * <Parameter name="value" type="int" />
21
+ * </InterfaceMethod>
22
+ * </InterfaceDeclaration>
23
+ * ```
24
+ * This will produce:
25
+ * ```csharp
26
+ * public interface MyIface
27
+ * {
28
+ * public int MyProperty { get; set; }
29
+ * public void MyMethod(int value);
30
+ * }
31
+ * ```
32
+ */
33
+ export declare function InterfaceDeclaration(props: InterfaceDeclarationProps): core.Children;
34
+ //# sourceMappingURL=declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAKD,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,kBAAkB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,iBAwDpE"}