@alloy-js/csharp 0.18.0-dev.15 → 0.18.0-dev.16

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.
@@ -1,4 +1,3 @@
1
- export * from "./class/property.js";
2
1
  export * from "./ClassDeclaration.jsx";
3
2
  export * from "./ClassMethod.jsx";
4
3
  export * from "./Declaration.js";
@@ -12,6 +11,8 @@ export * from "./Name.js";
12
11
  export * from "./Namespace.js";
13
12
  export * from "./Parameters.js";
14
13
  export * from "./ProjectDirectory.js";
14
+ export * from "./property/property.jsx";
15
+ export * from "./record/declaration.js";
15
16
  export * from "./Reference.js";
16
17
  export * from "./SourceFile.js";
17
18
  export * from "./UsingDirective.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,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,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,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,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,4 +1,3 @@
1
- export * from "./class/property.js";
2
1
  export * from "./ClassDeclaration.js";
3
2
  export * from "./ClassMethod.js";
4
3
  export * from "./Declaration.js";
@@ -12,6 +11,8 @@ export * from "./Name.js";
12
11
  export * from "./Namespace.js";
13
12
  export * from "./Parameters.js";
14
13
  export * from "./ProjectDirectory.js";
14
+ export * from "./property/property.js";
15
+ export * from "./record/declaration.js";
15
16
  export * from "./Reference.js";
16
17
  export * from "./SourceFile.js";
17
18
  export * from "./UsingDirective.js";
@@ -1,7 +1,7 @@
1
1
  import { Children, Refkey } from "@alloy-js/core";
2
2
  import { AccessModifiers } from "../../modifiers.js";
3
- /** Method modifiers. Can only be one. */
4
- export interface ClassPropertyModifiers {
3
+ /** Property modifiers. */
4
+ export interface PropertyModifiers {
5
5
  readonly new?: boolean;
6
6
  readonly static?: boolean;
7
7
  readonly virtual?: boolean;
@@ -11,8 +11,8 @@ export interface ClassPropertyModifiers {
11
11
  readonly extern?: boolean;
12
12
  readonly readonly?: boolean;
13
13
  }
14
- /** Properties for {@link ClassProperty} component */
15
- export interface ClassPropertyProps extends AccessModifiers, ClassPropertyModifiers {
14
+ /** Properties for {@link Property} component */
15
+ export interface PropertyProps extends AccessModifiers, PropertyModifiers {
16
16
  name: string;
17
17
  refkey?: Refkey;
18
18
  /** Property type */
@@ -53,5 +53,5 @@ export interface ClassPropertyProps extends AccessModifiers, ClassPropertyModifi
53
53
  * public int My { get; set; };
54
54
  * ```
55
55
  */
56
- export declare function ClassProperty(props: ClassPropertyProps): Children;
56
+ export declare function Property(props: PropertyProps): Children;
57
57
  //# sourceMappingURL=property.d.ts.map
@@ -0,0 +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;AAM5B,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;CAC7B;AAaD,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;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,YAmD5C"}
@@ -6,11 +6,11 @@ import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
7
7
  import { DocWhen } from "../doc/comment.js";
8
8
 
9
- /** Method modifiers. Can only be one. */
9
+ /** Property modifiers. */
10
10
 
11
11
  const getModifiers = makeModifiers(["new", "static", "virtual", "sealed", "override", "abstract", "extern", "readonly"]);
12
12
 
13
- /** Properties for {@link ClassProperty} component */
13
+ /** Properties for {@link Property} component */
14
14
 
15
15
  /**
16
16
  * Render a C# class property.
@@ -21,7 +21,7 @@ const getModifiers = makeModifiers(["new", "static", "virtual", "sealed", "overr
21
21
  * public int My { get; set; };
22
22
  * ```
23
23
  */
24
- export function ClassProperty(props) {
24
+ export function Property(props) {
25
25
  const name = useCSharpNamePolicy().getName(props.name, "class-property");
26
26
  const scope = useCSharpScope();
27
27
  if (scope.kind !== "member" || scope.name !== "class-decl" && scope.name !== "record-decl") {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property.test.d.ts","sourceRoot":"","sources":["../../../../src/components/property/property.test.tsx"],"names":[],"mappings":""}
@@ -2,7 +2,7 @@ import { memo as _$memo, createComponent as _$createComponent, mergeProps as _$m
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { TestNamespace } from "../../../test/utils.js";
4
4
  import { ClassDeclaration } from "../ClassDeclaration.js";
5
- import { ClassProperty } from "./property.js";
5
+ import { Property } from "./property.js";
6
6
  const Wrapper = props => _$createComponent(TestNamespace, {
7
7
  get children() {
8
8
  return _$createComponent(ClassDeclaration, {
@@ -19,7 +19,7 @@ describe("modifiers", () => {
19
19
  it.each(["public", "private", "protected", "internal"])("%s", accessModifier => {
20
20
  expect(_$createComponent(Wrapper, {
21
21
  get children() {
22
- return _$createComponent(ClassProperty, _$mergeProps({
22
+ return _$createComponent(Property, _$mergeProps({
23
23
  [accessModifier]: true
24
24
  }, {
25
25
  name: "TestProp",
@@ -39,7 +39,7 @@ describe("modifiers", () => {
39
39
  it.each(["new", "static", "virtual", "sealed", "override", "abstract", "extern", "readonly"])("%s", methodModifier => {
40
40
  expect(_$createComponent(Wrapper, {
41
41
  get children() {
42
- return _$createComponent(ClassProperty, _$mergeProps({
42
+ return _$createComponent(Property, _$mergeProps({
43
43
  [methodModifier]: true
44
44
  }, {
45
45
  name: "TestProp",
@@ -58,7 +58,7 @@ describe("modifiers", () => {
58
58
  it("combine modifiers", () => {
59
59
  expect(_$createComponent(Wrapper, {
60
60
  get children() {
61
- return _$createComponent(ClassProperty, {
61
+ return _$createComponent(Property, {
62
62
  "public": true,
63
63
  "new": true,
64
64
  name: "TestProp",
@@ -77,7 +77,7 @@ describe("modifiers", () => {
77
77
  it("applies PascalCase naming policy", () => {
78
78
  expect(_$createComponent(Wrapper, {
79
79
  get children() {
80
- return _$createComponent(ClassProperty, {
80
+ return _$createComponent(Property, {
81
81
  name: "test_prop",
82
82
  type: "string",
83
83
  get: true
@@ -93,7 +93,7 @@ it("applies PascalCase naming policy", () => {
93
93
  it("has getter only", () => {
94
94
  expect(_$createComponent(Wrapper, {
95
95
  get children() {
96
- return _$createComponent(ClassProperty, {
96
+ return _$createComponent(Property, {
97
97
  name: "TestProp",
98
98
  type: "string",
99
99
  get: true
@@ -109,7 +109,7 @@ it("has getter only", () => {
109
109
  it("has setter only", () => {
110
110
  expect(_$createComponent(Wrapper, {
111
111
  get children() {
112
- return _$createComponent(ClassProperty, {
112
+ return _$createComponent(Property, {
113
113
  name: "TestProp",
114
114
  type: "string",
115
115
  set: true
@@ -125,7 +125,7 @@ it("has setter only", () => {
125
125
  it("has getter and setter", () => {
126
126
  expect(_$createComponent(Wrapper, {
127
127
  get children() {
128
- return _$createComponent(ClassProperty, {
128
+ return _$createComponent(Property, {
129
129
  name: "TestProp",
130
130
  type: "string",
131
131
  get: true,
@@ -142,7 +142,7 @@ it("has getter and setter", () => {
142
142
  it("has getter and init", () => {
143
143
  expect(_$createComponent(Wrapper, {
144
144
  get children() {
145
- return _$createComponent(ClassProperty, {
145
+ return _$createComponent(Property, {
146
146
  name: "TestProp",
147
147
  type: "string",
148
148
  get: true,
@@ -162,7 +162,7 @@ it("specify doc comment", () => {
162
162
  return _$createComponent(ClassDeclaration, {
163
163
  name: "Test",
164
164
  get children() {
165
- return _$createComponent(ClassProperty, {
165
+ return _$createComponent(Property, {
166
166
  name: "Method",
167
167
  type: "string",
168
168
  get: true,
@@ -183,7 +183,7 @@ it("specify doc comment", () => {
183
183
  it("specify nullable property", () => {
184
184
  expect(_$createComponent(Wrapper, {
185
185
  get children() {
186
- return _$createComponent(ClassProperty, {
186
+ return _$createComponent(Property, {
187
187
  name: "TestProp",
188
188
  type: "string",
189
189
  nullable: true,
@@ -201,7 +201,7 @@ it("specify nullable property", () => {
201
201
  it("specify initializer", () => {
202
202
  expect(_$createComponent(Wrapper, {
203
203
  get children() {
204
- return _$createComponent(ClassProperty, {
204
+ return _$createComponent(Property, {
205
205
  name: "TestProp",
206
206
  type: "string",
207
207
  get: true,
@@ -1,7 +1,7 @@
1
1
  import { createComponent as _$createComponent, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { TestNamespace } from "../../../test/utils.js";
4
- import { ClassProperty } from "../class/property.js";
4
+ import { Property } from "../property/property.js";
5
5
  import { RecordDeclaration } from "./declaration.js";
6
6
  it("declares class with no members", () => {
7
7
  expect(_$createComponent(TestNamespace, {
@@ -75,7 +75,7 @@ it("specify class property inside", () => {
75
75
  name: "TestRecord",
76
76
  doc: "This is a test",
77
77
  get children() {
78
- return _$createComponent(ClassProperty, {
78
+ return _$createComponent(Property, {
79
79
  name: "Prop",
80
80
  get: true,
81
81
  set: true,