@alloy-js/python 0.2.0-dev.3 → 0.2.0-dev.5

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 (213) hide show
  1. package/dist/src/builtins/python.d.ts +3 -0
  2. package/dist/src/builtins/python.d.ts.map +1 -1
  3. package/dist/src/builtins/python.js +6 -0
  4. package/dist/src/builtins/python.js.map +1 -1
  5. package/dist/src/components/Atom.d.ts +1 -0
  6. package/dist/src/components/Atom.d.ts.map +1 -1
  7. package/dist/src/components/Atom.js +3 -0
  8. package/dist/src/components/Atom.js.map +1 -1
  9. package/dist/src/components/CallSignature.d.ts +4 -15
  10. package/dist/src/components/CallSignature.d.ts.map +1 -1
  11. package/dist/src/components/CallSignature.js +13 -67
  12. package/dist/src/components/CallSignature.js.map +1 -1
  13. package/dist/src/components/ClassMethodDeclaration.d.ts +22 -0
  14. package/dist/src/components/ClassMethodDeclaration.d.ts.map +1 -0
  15. package/dist/src/components/ClassMethodDeclaration.js +32 -0
  16. package/dist/src/components/ClassMethodDeclaration.js.map +1 -0
  17. package/dist/src/components/ConstructorDeclaration.d.ts +21 -0
  18. package/dist/src/components/ConstructorDeclaration.d.ts.map +1 -0
  19. package/dist/src/components/ConstructorDeclaration.js +35 -0
  20. package/dist/src/components/ConstructorDeclaration.js.map +1 -0
  21. package/dist/src/components/DunderMethodDeclaration.d.ts +21 -0
  22. package/dist/src/components/DunderMethodDeclaration.d.ts.map +1 -0
  23. package/dist/src/components/DunderMethodDeclaration.js +29 -0
  24. package/dist/src/components/DunderMethodDeclaration.js.map +1 -0
  25. package/dist/src/components/EnumDeclaration.d.ts +11 -32
  26. package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
  27. package/dist/src/components/EnumDeclaration.js +10 -48
  28. package/dist/src/components/EnumDeclaration.js.map +1 -1
  29. package/dist/src/components/EnumMember.js +3 -3
  30. package/dist/src/components/EnumMember.js.map +1 -1
  31. package/dist/src/components/FunctionBase.d.ts +48 -0
  32. package/dist/src/components/FunctionBase.d.ts.map +1 -0
  33. package/dist/src/components/FunctionBase.js +91 -0
  34. package/dist/src/components/FunctionBase.js.map +1 -0
  35. package/dist/src/components/FunctionDeclaration.d.ts +11 -31
  36. package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
  37. package/dist/src/components/FunctionDeclaration.js +22 -79
  38. package/dist/src/components/FunctionDeclaration.js.map +1 -1
  39. package/dist/src/components/MethodBase.d.ts +29 -0
  40. package/dist/src/components/MethodBase.d.ts.map +1 -0
  41. package/dist/src/components/MethodBase.js +32 -0
  42. package/dist/src/components/MethodBase.js.map +1 -0
  43. package/dist/src/components/MethodDeclaration.d.ts +22 -0
  44. package/dist/src/components/MethodDeclaration.d.ts.map +1 -0
  45. package/dist/src/components/MethodDeclaration.js +34 -0
  46. package/dist/src/components/MethodDeclaration.js.map +1 -0
  47. package/dist/src/components/PropertyDeclaration.d.ts +71 -0
  48. package/dist/src/components/PropertyDeclaration.d.ts.map +1 -0
  49. package/dist/src/components/PropertyDeclaration.js +227 -0
  50. package/dist/src/components/PropertyDeclaration.js.map +1 -0
  51. package/dist/src/components/PyDoc.d.ts +107 -42
  52. package/dist/src/components/PyDoc.d.ts.map +1 -1
  53. package/dist/src/components/PyDoc.js +845 -181
  54. package/dist/src/components/PyDoc.js.map +1 -1
  55. package/dist/src/components/SourceFile.d.ts +24 -0
  56. package/dist/src/components/SourceFile.d.ts.map +1 -1
  57. package/dist/src/components/SourceFile.js +28 -1
  58. package/dist/src/components/SourceFile.js.map +1 -1
  59. package/dist/src/components/StaticMethodDeclaration.d.ts +22 -0
  60. package/dist/src/components/StaticMethodDeclaration.d.ts.map +1 -0
  61. package/dist/src/components/StaticMethodDeclaration.js +32 -0
  62. package/dist/src/components/StaticMethodDeclaration.js.map +1 -0
  63. package/dist/src/components/TypeArguments.d.ts +9 -0
  64. package/dist/src/components/TypeArguments.d.ts.map +1 -0
  65. package/dist/src/components/TypeArguments.js +18 -0
  66. package/dist/src/components/TypeArguments.js.map +1 -0
  67. package/dist/src/components/TypeReference.d.ts +14 -0
  68. package/dist/src/components/TypeReference.d.ts.map +1 -0
  69. package/dist/src/components/TypeReference.js +29 -0
  70. package/dist/src/components/TypeReference.js.map +1 -0
  71. package/dist/src/components/UnionTypeExpression.d.ts +1 -2
  72. package/dist/src/components/UnionTypeExpression.d.ts.map +1 -1
  73. package/dist/src/components/UnionTypeExpression.js +3 -11
  74. package/dist/src/components/UnionTypeExpression.js.map +1 -1
  75. package/dist/src/components/VariableDeclaration.d.ts.map +1 -1
  76. package/dist/src/components/VariableDeclaration.js +3 -3
  77. package/dist/src/components/VariableDeclaration.js.map +1 -1
  78. package/dist/src/components/index.d.ts +10 -0
  79. package/dist/src/components/index.d.ts.map +1 -1
  80. package/dist/src/components/index.js +9 -0
  81. package/dist/src/components/index.js.map +1 -1
  82. package/dist/src/parameter-descriptor.d.ts +1 -4
  83. package/dist/src/parameter-descriptor.d.ts.map +1 -1
  84. package/dist/src/parameter-descriptor.js +7 -1
  85. package/dist/src/parameter-descriptor.js.map +1 -1
  86. package/dist/src/symbol-creation.d.ts +4 -0
  87. package/dist/src/symbol-creation.d.ts.map +1 -1
  88. package/dist/src/symbol-creation.js +12 -0
  89. package/dist/src/symbol-creation.js.map +1 -1
  90. package/dist/src/symbols/factories.d.ts +15 -0
  91. package/dist/src/symbols/factories.d.ts.map +1 -0
  92. package/dist/src/symbols/factories.js +28 -0
  93. package/dist/src/symbols/factories.js.map +1 -0
  94. package/dist/src/symbols/index.d.ts +1 -0
  95. package/dist/src/symbols/index.d.ts.map +1 -1
  96. package/dist/src/symbols/index.js +1 -0
  97. package/dist/src/symbols/index.js.map +1 -1
  98. package/dist/src/symbols/reference.d.ts +1 -1
  99. package/dist/src/symbols/reference.d.ts.map +1 -1
  100. package/dist/src/symbols/reference.js +1 -1
  101. package/dist/src/symbols/reference.js.map +1 -1
  102. package/dist/src/utils.d.ts.map +1 -1
  103. package/dist/src/utils.js +1 -1
  104. package/dist/src/utils.js.map +1 -1
  105. package/dist/test/callsignatures.test.js +42 -64
  106. package/dist/test/callsignatures.test.js.map +1 -1
  107. package/dist/test/class-method-declaration.test.d.ts +2 -0
  108. package/dist/test/class-method-declaration.test.d.ts.map +1 -0
  109. package/dist/test/class-method-declaration.test.js +61 -0
  110. package/dist/test/class-method-declaration.test.js.map +1 -0
  111. package/dist/test/classdeclarations.test.js +6 -8
  112. package/dist/test/classdeclarations.test.js.map +1 -1
  113. package/dist/test/constructordeclaration.test.d.ts +2 -0
  114. package/dist/test/constructordeclaration.test.d.ts.map +1 -0
  115. package/dist/test/constructordeclaration.test.js +58 -0
  116. package/dist/test/constructordeclaration.test.js.map +1 -0
  117. package/dist/test/dundermethoddeclaration.test.d.ts +2 -0
  118. package/dist/test/dundermethoddeclaration.test.d.ts.map +1 -0
  119. package/dist/test/dundermethoddeclaration.test.js +65 -0
  120. package/dist/test/dundermethoddeclaration.test.js.map +1 -0
  121. package/dist/test/enums.test.js +14 -16
  122. package/dist/test/enums.test.js.map +1 -1
  123. package/dist/test/externals.test.js +2 -4
  124. package/dist/test/externals.test.js.map +1 -1
  125. package/dist/test/factories.test.d.ts +2 -0
  126. package/dist/test/factories.test.d.ts.map +1 -0
  127. package/dist/test/factories.test.js +78 -0
  128. package/dist/test/factories.test.js.map +1 -0
  129. package/dist/test/functiondeclaration.test.js +213 -59
  130. package/dist/test/functiondeclaration.test.js.map +1 -1
  131. package/dist/test/memberexpressions.test.js +1 -1
  132. package/dist/test/memberexpressions.test.js.map +1 -1
  133. package/dist/test/methoddeclaration.test.d.ts +2 -0
  134. package/dist/test/methoddeclaration.test.d.ts.map +1 -0
  135. package/dist/test/methoddeclaration.test.js +239 -0
  136. package/dist/test/methoddeclaration.test.js.map +1 -0
  137. package/dist/test/namepolicies.test.js +1 -2
  138. package/dist/test/namepolicies.test.js.map +1 -1
  139. package/dist/test/propertydeclaration.test.d.ts +2 -0
  140. package/dist/test/propertydeclaration.test.d.ts.map +1 -0
  141. package/dist/test/propertydeclaration.test.js +229 -0
  142. package/dist/test/propertydeclaration.test.js.map +1 -0
  143. package/dist/test/pydocs.test.js +926 -126
  144. package/dist/test/pydocs.test.js.map +1 -1
  145. package/dist/test/references.test.js +1 -5
  146. package/dist/test/references.test.js.map +1 -1
  147. package/dist/test/sourcefiles.test.js +90 -1
  148. package/dist/test/sourcefiles.test.js.map +1 -1
  149. package/dist/test/staticmethoddeclaration.test.d.ts +2 -0
  150. package/dist/test/staticmethoddeclaration.test.d.ts.map +1 -0
  151. package/dist/test/staticmethoddeclaration.test.js +61 -0
  152. package/dist/test/staticmethoddeclaration.test.js.map +1 -0
  153. package/dist/test/typereference.test.d.ts +2 -0
  154. package/dist/test/typereference.test.d.ts.map +1 -0
  155. package/dist/test/typereference.test.js +51 -0
  156. package/dist/test/typereference.test.js.map +1 -0
  157. package/dist/test/uniontypeexpression.test.js +152 -15
  158. package/dist/test/uniontypeexpression.test.js.map +1 -1
  159. package/dist/test/values.test.js +35 -0
  160. package/dist/test/values.test.js.map +1 -1
  161. package/dist/test/variables.test.js +28 -19
  162. package/dist/test/variables.test.js.map +1 -1
  163. package/dist/tsconfig.tsbuildinfo +1 -1
  164. package/package.json +2 -2
  165. package/src/builtins/python.ts +7 -0
  166. package/src/components/Atom.tsx +4 -0
  167. package/src/components/CallSignature.tsx +17 -69
  168. package/src/components/ClassMethodDeclaration.tsx +34 -0
  169. package/src/components/ConstructorDeclaration.tsx +37 -0
  170. package/src/components/DunderMethodDeclaration.tsx +30 -0
  171. package/src/components/EnumDeclaration.tsx +16 -44
  172. package/src/components/EnumMember.tsx +3 -3
  173. package/src/components/FunctionBase.tsx +88 -0
  174. package/src/components/FunctionDeclaration.tsx +18 -82
  175. package/src/components/MethodBase.tsx +53 -0
  176. package/src/components/MethodDeclaration.tsx +27 -0
  177. package/src/components/PropertyDeclaration.tsx +264 -0
  178. package/src/components/PyDoc.tsx +795 -195
  179. package/src/components/SourceFile.tsx +29 -0
  180. package/src/components/StaticMethodDeclaration.tsx +34 -0
  181. package/src/components/TypeArguments.tsx +24 -0
  182. package/src/components/TypeReference.tsx +33 -0
  183. package/src/components/UnionTypeExpression.tsx +4 -15
  184. package/src/components/VariableDeclaration.tsx +1 -3
  185. package/src/components/index.ts +10 -0
  186. package/src/parameter-descriptor.ts +6 -5
  187. package/src/symbol-creation.ts +17 -0
  188. package/src/symbols/factories.ts +39 -0
  189. package/src/symbols/index.ts +1 -0
  190. package/src/symbols/reference.tsx +3 -5
  191. package/src/utils.ts +0 -2
  192. package/temp/api.json +5323 -2288
  193. package/test/callsignatures.test.tsx +102 -74
  194. package/test/class-method-declaration.test.tsx +53 -0
  195. package/test/classdeclarations.test.tsx +7 -9
  196. package/test/constructordeclaration.test.tsx +48 -0
  197. package/test/dundermethoddeclaration.test.tsx +53 -0
  198. package/test/enums.test.tsx +14 -16
  199. package/test/externals.test.tsx +5 -7
  200. package/test/factories.test.tsx +72 -0
  201. package/test/functiondeclaration.test.tsx +196 -44
  202. package/test/memberexpressions.test.tsx +7 -2
  203. package/test/methoddeclaration.test.tsx +202 -0
  204. package/test/namepolicies.test.tsx +1 -2
  205. package/test/propertydeclaration.test.tsx +192 -0
  206. package/test/pydocs.test.tsx +1093 -129
  207. package/test/references.test.tsx +1 -1
  208. package/test/sourcefiles.test.tsx +100 -1
  209. package/test/staticmethoddeclaration.test.tsx +49 -0
  210. package/test/typereference.test.tsx +52 -0
  211. package/test/uniontypeexpression.test.tsx +169 -34
  212. package/test/values.test.tsx +34 -0
  213. package/test/variables.test.tsx +27 -16
@@ -1,4 +1,7 @@
1
1
  import { SymbolCreator } from "@alloy-js/core";
2
+ export declare const abcModule: import("../create-module.js").ModuleRefkeys<{
3
+ readonly ".": ["abstractmethod"];
4
+ }> & SymbolCreator;
2
5
  export declare const enumModule: import("../create-module.js").ModuleRefkeys<{
3
6
  readonly ".": ["auto", "Enum", "Flag", "IntEnum", "IntFlag", "StrEnum"];
4
7
  }> & SymbolCreator;
@@ -1 +1 @@
1
- {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/builtins/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,eAAO,MAAM,UAAU;;kBAKrB,CAAC;AAEH,eAAO,MAAM,cAAc;;;kBAMzB,CAAC"}
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/builtins/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,eAAO,MAAM,SAAS;;kBAKpB,CAAC;AAEH,eAAO,MAAM,UAAU;;kBAKrB,CAAC;AAEH,eAAO,MAAM,cAAc;;;kBAMzB,CAAC"}
@@ -2,6 +2,12 @@ import { createModule } from "../create-module.js";
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
4
 
5
+ export const abcModule = createModule({
6
+ name: "abc",
7
+ descriptor: {
8
+ ".": ["abstractmethod"]
9
+ }
10
+ });
5
11
  export const enumModule = createModule({
6
12
  name: "enum",
7
13
  descriptor: {
@@ -1 +1 @@
1
- {"version":3,"names":["createModule","enumModule","name","descriptor","requestsModule","models"],"sources":["../../../src/builtins/python.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAY,QAAQ,qBAAqB;;AAElD;;AAGA,OAAO,MAAMC,UAAU,GAAGD,YAAY,CAAC;EACrCE,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;EAC/D;AACF,CAAC,CAAC;AAEF,OAAO,MAAMC,cAAc,GAAGJ,YAAY,CAAC;EACzCE,IAAI,EAAE,UAAU;EAChBC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;IACjEE,MAAM,EAAE,CAAC,UAAU,EAAE,SAAS;EAChC;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createModule","abcModule","name","descriptor","enumModule","requestsModule","models"],"sources":["../../../src/builtins/python.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAY,QAAQ,qBAAqB;;AAElD;;AAGA,OAAO,MAAMC,SAAS,GAAGD,YAAY,CAAC;EACpCE,IAAI,EAAE,KAAK;EACXC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,gBAAgB;EACxB;AACF,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,GAAGJ,YAAY,CAAC;EACrCE,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;EAC/D;AACF,CAAC,CAAC;AAEF,OAAO,MAAME,cAAc,GAAGL,YAAY,CAAC;EACzCE,IAAI,EAAE,UAAU;EAChBC,UAAU,EAAE;IACV,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;IACjEG,MAAM,EAAE,CAAC,UAAU,EAAE,SAAS;EAChC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  export interface AtomProps {
2
2
  jsValue?: unknown;
3
+ asFloat?: boolean;
3
4
  }
4
5
  /**
5
6
  * A component that renders a JavaScript value as a Python atom (atomic value).
@@ -1 +1 @@
1
- {"version":3,"file":"Atom.d.ts","sourceRoot":"","sources":["../../../src/components/Atom.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAuD1C"}
1
+ {"version":3,"file":"Atom.d.ts","sourceRoot":"","sources":["../../../src/components/Atom.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CA0D1C"}
@@ -20,6 +20,9 @@ export function Atom(props) {
20
20
  if (typeof jsValue === "undefined") {
21
21
  return "None";
22
22
  } else if (typeof jsValue === "number") {
23
+ if (props.asFloat && Number.isInteger(jsValue)) {
24
+ return jsValue.toFixed(1);
25
+ }
23
26
  return String(jsValue);
24
27
  } else if (typeof jsValue === "boolean") {
25
28
  return jsValue ? "True" : "False";
@@ -1 +1 @@
1
- {"version":3,"names":["For","Indent","memo","Atom","props","jsValue","String","replace","Array","isArray","_$createIntrinsic","children","_$createComponent","softline","trailingBreak","each","comma","line","v","entries","Object","length","k"],"sources":["../../../src/components/Atom.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,QAAQ,gBAAgB;AAMlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAgB,EAAO;EAC1C,OAAOF,IAAI,CAAC,MAAM;IAChB,MAAMG,OAAO,GAAGD,KAAK,CAACC,OAAO;IAE7B,IAAI,OAAOA,OAAO,KAAK,WAAW,EAAE;MAClC,OAAO,MAAM;IACf,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,OAAOC,MAAM,CAACD,OAAO,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,SAAS,EAAE;MACvC,OAAOA,OAAO,GAAG,MAAM,GAAG,OAAO;IACnC,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,OAAO,IAAIA,OAAO,CAACE,OA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;MAGV;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["For","Indent","memo","Atom","props","jsValue","asFloat","Number","isInteger","toFixed","String","replace","Array","isArray","_$createIntrinsic","children","_$createComponent","softline","trailingBreak","each","comma","line","v","entries","Object","length","k"],"sources":["../../../src/components/Atom.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,QAAQ,gBAAgB;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAgB,EAAO;EAC1C,OAAOF,IAAI,CAAC,MAAM;IAChB,MAAMG,OAAO,GAAGD,KAAK,CAACC,OAAO;IAE7B,IAAI,OAAOA,OAAO,KAAK,WAAW,EAAE;MAClC,OAAO,MAAM;IACf,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,IAAID,KAAK,CAACE,OAAO,IAAIC,MAAM,CAACC,SAAS,CAACH,OAAO,CAAC,EAAE;QAC9C,OAAOA,OAAO,CAACI,OAAO,CAAC,CAAC,CAAC;MAC3B;MACA,OAAOC,MAAM,CAACL,OAAO,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,SAAS,EAAE;MACvC,OAAOA,OAAO,GAAG,MAAM,GAAG,OAAO;IACnC,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,OAAO,IAAIA,OAAO,CAACM,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG;IAC5C,CAAC,MAAM,IAAI,OAAON,OAAO,KAAK,UAAU,EAAE;MACxC;MACA,OAAOA,OAAO;IAChB,CAAC,MAAM,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MACtC,IAAIA,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,MAAM;MACf,CAAC,MAAM,IAAIO,KAAK,CAACC,OAAO,CAACR,OAAO,CAAC,EAAE;QACjC;QACA,OAAAS,iBAAA;UAAA,IAAAC,SAAA;YAAA,QAEK,GAAG,EAAAC,iBAAA,CACHf,MAAM;cAACgB,QAAQ;cAACC,aAAa;cAAA,IAAAH,SAAA;gBAAA,OAAAC,iBAAA,CAC3BhB,GAAG;kBAACmB,IAAI,EAAEd,OAAO;kBAAEe,KAAK;kBAACC,IAAI;kBAAAN,QAAA,EAC1BO,CAAC,IAAAN,iBAAA,CAAMb,IAAI;oBAACE,OAAO,EAAEiB;kBAAC;gBAAI;cAAA;YAAA,IAG/B,GAAG;UAAA;QAAA;MAGV,CAAC,MAAM;QACL,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAAClB,OAAO,CAAC;QACvC,IAAIkB,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;UACxB,OAAO,IAAI;QACb;QACA;QACA,OAAAX,iBAAA;UAAA,IAAAC,SAAA;YAAA,QAEK,GAAG,EAAAC,iBAAA,CACHf,MAAM;cAACgB,QAAQ;cAAA,IAAAF,SAAA;gBAAA,OAAAC,iBAAA,CACbhB,GAAG;kBAACmB,IAAI,EAAEI,OAAO;kBAAEH,KAAK;kBAACC,IAAI;kBAAAN,QAAA,EAC3BA,CAAC,CAACW,CAAC,EAAEJ,CAAC,CAAC,MAAAN,iBAAA,CAEHb,IAAI;oBAACE,OAAO,EAAEqB;kBAAC,UAAAV,iBAAA,CAAOb,IAAI;oBAACE,OAAO,EAAEiB;kBAAC;gBAEzC;cAAA;YAAA,IAGJ,GAAG;UAAA;QAAA;MAGV;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1,11 +1,9 @@
1
1
  import { Children } from "@alloy-js/core";
2
2
  import { ParameterDescriptor } from "../parameter-descriptor.js";
3
3
  export interface CallSignatureParametersProps {
4
- readonly parameters?: ParameterDescriptor[] | string[];
4
+ readonly parameters?: (ParameterDescriptor | string)[];
5
5
  readonly args?: boolean;
6
6
  readonly kwargs?: boolean;
7
- readonly instanceFunction?: boolean;
8
- readonly classFunction?: boolean;
9
7
  }
10
8
  /**
11
9
  * A call signature parameters declaration, which can be used to define the
@@ -23,11 +21,10 @@ export interface CallSignatureParametersProps {
23
21
  export declare function CallSignatureParameters(props: CallSignatureParametersProps): Children;
24
22
  export interface CallSignatureProps {
25
23
  /**
26
- * The parameters to the call signature. Can be an array of strings for parameters
27
- * which don't have a type or a default value. Otherwise, it's an array of
28
- * {@link ParameterDescriptor}s.
24
+ * The parameters to the call signature. Can be an array of strings (for parameters
25
+ * which don't have a type or a default value) or {@link ParameterDescriptor}s.
29
26
  */
30
- parameters?: ParameterDescriptor[] | string[];
27
+ parameters?: (ParameterDescriptor | string)[];
31
28
  /**
32
29
  * The type parameters of the call signature, e.g. for a generic function.
33
30
  * This is only supported in Python 3.12+.
@@ -41,14 +38,6 @@ export interface CallSignatureProps {
41
38
  * Indicates if there are keyword arguments (`**kwargs`) in the function
42
39
  */
43
40
  kwargs?: boolean;
44
- /**
45
- * Indicates that this is an instance function.
46
- */
47
- instanceFunction?: boolean;
48
- /**
49
- * Indicates that this is a class function.
50
- */
51
- classFunction?: boolean;
52
41
  /**
53
42
  * The return type of the function.
54
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"CallSignature.d.ts","sourceRoot":"","sources":["../../../src/components/CallSignature.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAAC;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE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E,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC;CACvB;AACD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,YAuBtD"}
@@ -1,8 +1,8 @@
1
1
  import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
2
- import { computed, createSymbolSlot, For, Show, useContext } from "@alloy-js/core";
2
+ import { computed, createSymbolSlot, For, Show } from "@alloy-js/core";
3
+ import { isParameterDescriptor } from "../parameter-descriptor.js";
3
4
  import { createPythonSymbol } from "../symbol-creation.js";
4
5
  import { Atom } from "./Atom.js";
5
- import { PythonSourceFileContext } from "./SourceFile.js";
6
6
  /**
7
7
  * A call signature parameters declaration, which can be used to define the
8
8
  * parameters of a function or other callables.
@@ -17,31 +17,9 @@ import { PythonSourceFileContext } from "./SourceFile.js";
17
17
  * ```
18
18
  */
19
19
  export function CallSignatureParameters(props) {
20
- // Validate that only one of instanceFunction or classFunction is true
21
- if (props.instanceFunction && props.classFunction) {
22
- throw new Error("Cannot be both an instance function and a class function");
23
- }
24
- const sfContext = useContext(PythonSourceFileContext);
25
- const module = sfContext?.module;
26
20
  const parameters = normalizeAndDeclareParameters(props.parameters ?? []);
27
21
  const parameterList = computed(() => {
28
22
  const params = [];
29
-
30
- // Add self/cls parameter if instance or class function
31
- if (props.instanceFunction) {
32
- params.push(parameter({
33
- symbol: createPythonSymbol("self", {
34
- module: module
35
- })
36
- }));
37
- } else if (props.classFunction) {
38
- params.push(parameter({
39
- symbol: createPythonSymbol("cls", {
40
- module: module
41
- })
42
- }));
43
- }
44
-
45
23
  // Add regular parameters
46
24
  parameters.forEach(param => {
47
25
  params.push(parameter(param));
@@ -82,28 +60,7 @@ function parameter(param) {
82
60
  }
83
61
  }), _$createComponent(Show, {
84
62
  get when() {
85
- return !!param.optional;
86
- },
87
- get children() {
88
- return [_$createComponent(Show, {
89
- get when() {
90
- return !param.type;
91
- },
92
- children: "="
93
- }), _$createComponent(Show, {
94
- get when() {
95
- return !!param.type;
96
- },
97
- children: " = "
98
- }), [_$memo(() => _$memo(() => !!param.default)() ? _$createComponent(Atom, {
99
- get jsValue() {
100
- return param.default;
101
- }
102
- }) : "None")]];
103
- }
104
- }), _$createComponent(Show, {
105
- get when() {
106
- return !param.optional && param.default !== undefined;
63
+ return param.default !== undefined;
107
64
  },
108
65
  get children() {
109
66
  return [_$createComponent(Show, {
@@ -127,19 +84,8 @@ function parameter(param) {
127
84
  });
128
85
  }
129
86
  function normalizeAndDeclareParameters(parameters) {
130
- if (parameters.length === 0) {
131
- return [];
132
- }
133
- if (typeof parameters[0] === "string") {
134
- return parameters.map(paramName => {
135
- const symbol = createPythonSymbol(paramName, {}, "parameter");
136
- return {
137
- refkeys: symbol.refkeys,
138
- symbol
139
- };
140
- });
141
- } else {
142
- return parameters.map(param => {
87
+ return parameters.map(param => {
88
+ if (isParameterDescriptor(param)) {
143
89
  const TypeSlot = createSymbolSlot();
144
90
  const symbol = createPythonSymbol(param.name, {
145
91
  refkeys: param.refkey,
@@ -150,8 +96,14 @@ function normalizeAndDeclareParameters(parameters) {
150
96
  symbol,
151
97
  TypeSlot
152
98
  };
153
- });
154
- }
99
+ } else {
100
+ const symbol = createPythonSymbol(param, {}, "parameter");
101
+ return {
102
+ refkeys: symbol.refkeys,
103
+ symbol
104
+ };
105
+ }
106
+ });
155
107
  }
156
108
  /**
157
109
  * A Python call signature, e.g. the part after the `def` keyword and the name in a
@@ -184,12 +136,6 @@ export function CallSignature(props) {
184
136
  },
185
137
  get kwargs() {
186
138
  return props.kwargs;
187
- },
188
- get instanceFunction() {
189
- return props.instanceFunction;
190
- },
191
- get classFunction() {
192
- return props.classFunction;
193
139
  }
194
140
  });
195
141
  const typeParams = props.typeParameters ? `[${props.typeParameters.join(", ")}]` : "";
@@ -1 +1 @@
1
- {"version":3,"names":["computed","createSymbolSlot","For","Show","useContext","createPythonSymbol","Atom","PythonSourceFileContext","CallSignatureParameters","props","instanceFunction","classFunction","Error","sfContext","module","parameters","normalizeAndDeclareParameters","parameterList","params","push","parameter","symbol","forEach","param","args","kwargs","_$createComponent","each","comma","space","children","TypeSlot","_$createIntrinsic","_$memo","name","when","type","optional","default","jsValue","undefined","length","map","paramName","refkeys","refkey","firstSymbol","CallSignature","sParams","typeParams","typeParameters","join","sReturnType","returnType"],"sources":["../../../src/components/CallSignature.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAEEA,QAAQ,EACRC,gBAAgB,EAChBC,GAAG,EACHC,IAAI,EAEJC,UAAU,QACL,gBAAgB;AAEvB,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,IAAI;AACb,SAASC,uBAAuB;AAUhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,KAAmC,EAAE;EAC3E;EACA,IAAIA,KAAK,CAACC,gBAAgB,IAAID,KAAK,CAACE,aAAa,EAAE;IACjD,MAAM,IAAIC,KAAK,CAAC,0DAA0D,CAAC;EAC7E;EAEA,MAAMC,SAAS,GAAGT,UAAU,CAACG,uBAAuB,CAAC;EACrD,MAAMO,MAAM,GAAGD,SAAS,EAAEC,MAAM;EAChC,MAAMC,UAAU,GAAGC,6BAA6B,CAACP,KAAK,CAACM,UAAU,IAAI,EAAE,CAAC;EAExE,MAAME,aAAa,GAAGjB,QAAQ,CAAC,MAAM;IACnC,MAAMkB,MAAM,GAAG,EAAE;;IAEjB;IACA,IAAIT,KAAK,CAACC,gBAAgB,EAAE;MAC1BQ,MAAM,CAACC,IAAI,CACTC,SAAS,CAAC;QACRC,MAAM,EAAEhB,kBAAkB,CAAC,MAAM,EAAE;UAAES,MAAM,EAAEA;QAAO,C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EACpE,MAAMC,WAAW,GACf3C,KAAK,CAAC4C,UAAU,IAEX,MAAM,EAAApB,MAAA,OACNxB,KAAK,CAAC4C,UAAU,KAEnBb,SAAS;EAEb,QAEKS,UAAU,OAAGD,OAAO,OAAGI,WAAW;AAGzC","ignoreList":[]}
1
+ {"version":3,"names":["computed","createSymbolSlot","For","Show","isParameterDescriptor","createPythonSymbol","Atom","CallSignatureParameters","props","parameters","normalizeAndDeclareParameters","parameterList","params","forEach","param","push","parameter","args","kwargs","_$createComponent","each","comma","space","children","TypeSlot","_$createIntrinsic","_$memo","symbol","name","when","type","default","undefined","jsValue","map","refkeys","refkey","firstSymbol","CallSignature","sParams","typeParams","typeParameters","join","sReturnType","returnType"],"sources":["../../../src/components/CallSignature.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAEEA,QAAQ,EACRC,gBAAgB,EAChBC,GAAG,EACHC,IAAI,QAEC,gBAAgB;AACvB,SACEC,qBAAqB,QAEhB,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,IAAI;AAQb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,KAAmC,EAAE;EAC3E,MAAMC,UAAU,GAAGC,6BAA6B,CAACF,KAAK,CAACC,UAAU,IAAI,EAAE,CAAC;EAExE,MAAME,aAAa,GAAGX,QAAQ,CAAC,MAAM;IACnC,MAAMY,MAAM,GAAG,EAAE;IACjB;IACAH,UAAU,CAACI,OAAO,CAAEC,KAAK,IAAK;MAC5BF,MAAM,CAACG,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC;;IAEF;IACA,IAAIN,KAAK,CAACS,IAAI,EAAE;MACdL,MAAM,CAACG,IAAI,CAAC,OAAO,CAAC;IACtB;;IAEA;IACA,IAAIP,KAAK,CAACU,MAAM,EAAE;MAChBN,MAAM,CAACG,IAAI,CAAC,UAAU,CAAC;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@
1
+ import type { CommonFunctionProps } from "./FunctionBase.js";
2
+ /**
3
+ * A Python class method declaration component.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <py.ClassMethodDeclaration name="create" parameters={[{ name: "value", type: "str" }]}>
8
+ * return cls(value)
9
+ * </py.ClassMethodDeclaration>
10
+ * ```
11
+ * Generates:
12
+ * ```python
13
+ * @classmethod
14
+ * def create(cls, value: str) -> None:
15
+ * return cls(value)
16
+ * ```
17
+ */
18
+ export interface ClassMethodDeclarationProps extends CommonFunctionProps {
19
+ abstract?: boolean;
20
+ }
21
+ export declare function ClassMethodDeclaration(props: ClassMethodDeclarationProps): import("@alloy-js/core/jsx-runtime").Children;
22
+ //# sourceMappingURL=ClassMethodDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassMethodDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/ClassMethodDeclaration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,iDASxE"}
@@ -0,0 +1,32 @@
1
+ import { createIntrinsic as _$createIntrinsic, mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { createMethodSymbol } from "../symbols/factories.js";
3
+ import { MethodDeclarationBase } from "./MethodBase.js";
4
+
5
+ /**
6
+ * A Python class method declaration component.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <py.ClassMethodDeclaration name="create" parameters={[{ name: "value", type: "str" }]}>
11
+ * return cls(value)
12
+ * </py.ClassMethodDeclaration>
13
+ * ```
14
+ * Generates:
15
+ * ```python
16
+ * @classmethod
17
+ * def create(cls, value: str) -> None:
18
+ * return cls(value)
19
+ * ```
20
+ */
21
+
22
+ export function ClassMethodDeclaration(props) {
23
+ const sym = createMethodSymbol(props.name, {
24
+ refkeys: props.refkey
25
+ });
26
+ return ["@classmethod", _$createIntrinsic("hbr", {}), _$createComponent(MethodDeclarationBase, _$mergeProps({
27
+ functionType: "class"
28
+ }, props, {
29
+ sym: sym
30
+ }))];
31
+ }
32
+ //# sourceMappingURL=ClassMethodDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createMethodSymbol","MethodDeclarationBase","ClassMethodDeclaration","props","sym","name","refkeys","refkey","_$createIntrinsic","_$createComponent","_$mergeProps","functionType"],"sources":["../../../src/components/ClassMethodDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,SAASC,qBAAqB,QAAQ,iBAAiB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,MAAMC,GAAG,GAAGJ,kBAAkB,CAACG,KAAK,CAACE,IAAI,EAAE;IAAEC,OAAO,EAAEH,KAAK,CAACI;EAAO,CAAC,CAAC;EACrE,QAEK,cAAc,EAAAC,iBAAA,aAAAC,iBAAA,CAEdR,qBAAqB,EAAAS,YAAA;IAACC,YAAY;EAAA,GAAaR,KAAK;IAAEC,GAAG,EAAEA;EAAG;AAGrE","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import type { CommonFunctionProps } from "./FunctionBase.js";
2
+ /**
3
+ * A Python constructor declaration for `__new__`.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <py.ConstructorDeclaration parameters={[{ name: "value", type: "int" }]}>
8
+ * pass
9
+ * </py.ConstructorDeclaration>
10
+ * ```
11
+ * Generates:
12
+ * ```python
13
+ * def __new__(cls, value: int):
14
+ * pass
15
+ * ```
16
+ */
17
+ export interface ConstructorDeclarationProps extends Omit<CommonFunctionProps, "name"> {
18
+ abstract?: boolean;
19
+ }
20
+ export declare function ConstructorDeclaration(props: ConstructorDeclarationProps): import("@alloy-js/core").Children;
21
+ //# sourceMappingURL=ConstructorDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstructorDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/ConstructorDeclaration.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,qCAWxE"}
@@ -0,0 +1,35 @@
1
+ import { mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { namekey } from "@alloy-js/core";
3
+ import { createMethodSymbol } from "../symbols/factories.js";
4
+ import { MethodDeclarationBase } from "./MethodBase.js";
5
+
6
+ /**
7
+ * A Python constructor declaration for `__new__`.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <py.ConstructorDeclaration parameters={[{ name: "value", type: "int" }]}>
12
+ * pass
13
+ * </py.ConstructorDeclaration>
14
+ * ```
15
+ * Generates:
16
+ * ```python
17
+ * def __new__(cls, value: int):
18
+ * pass
19
+ * ```
20
+ */
21
+
22
+ export function ConstructorDeclaration(props) {
23
+ const name = namekey("__new__", {
24
+ ignoreNamePolicy: true
25
+ });
26
+ const sym = createMethodSymbol(name, {
27
+ refkeys: props.refkey
28
+ });
29
+ return _$createComponent(MethodDeclarationBase, _$mergeProps(props, {
30
+ name: name,
31
+ functionType: "class",
32
+ sym: sym
33
+ }));
34
+ }
35
+ //# sourceMappingURL=ConstructorDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["namekey","createMethodSymbol","MethodDeclarationBase","ConstructorDeclaration","props","name","ignoreNamePolicy","sym","refkeys","refkey","_$createComponent","_$mergeProps","functionType"],"sources":["../../../src/components/ConstructorDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,OAAO,QAAQ,gBAAgB;AACxC,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,SAASC,qBAAqB,QAAQ,iBAAiB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,MAAMC,IAAI,GAAGL,OAAO,CAAC,SAAS,EAAE;IAAEM,gBAAgB,EAAE;EAAK,CAAC,CAAC;EAC3D,MAAMC,GAAG,GAAGN,kBAAkB,CAACI,IAAI,EAAE;IAAEG,OAAO,EAAEJ,KAAK,CAACK;EAAO,CAAC,CAAC;EAC/D,OAAAC,iBAAA,CACGR,qBAAqB,EAAAS,YAAA,CAChBP,KAAK;IACTC,IAAI,EAAEA,IAAI;IACVO,YAAY;IACZL,GAAG,EAAEA;EAAG;AAGd","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import type { CommonFunctionProps } from "./FunctionBase.js";
2
+ /**
3
+ * A Python dunder method declaration.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <py.DunderMethodDeclaration name="__repr__" returnType="str">
8
+ * return f"<MyType>"
9
+ * </py.DunderMethodDeclaration>
10
+ * ```
11
+ * Generates:
12
+ * ```python
13
+ * def __repr__(self) -> str:
14
+ * return f"<MyType>"
15
+ * ```
16
+ */
17
+ export interface DunderMethodDeclarationProps extends CommonFunctionProps {
18
+ abstract?: boolean;
19
+ }
20
+ export declare function DunderMethodDeclaration(props: DunderMethodDeclarationProps): import("@alloy-js/core").Children;
21
+ //# sourceMappingURL=DunderMethodDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DunderMethodDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/DunderMethodDeclaration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,qCAM1E"}
@@ -0,0 +1,29 @@
1
+ import { mergeProps as _$mergeProps, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { isNamekey, namekey } from "@alloy-js/core";
3
+ import { MethodDeclaration } from "./MethodDeclaration.js";
4
+
5
+ /**
6
+ * A Python dunder method declaration.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <py.DunderMethodDeclaration name="__repr__" returnType="str">
11
+ * return f"<MyType>"
12
+ * </py.DunderMethodDeclaration>
13
+ * ```
14
+ * Generates:
15
+ * ```python
16
+ * def __repr__(self) -> str:
17
+ * return f"<MyType>"
18
+ * ```
19
+ */
20
+
21
+ export function DunderMethodDeclaration(props) {
22
+ const finalName = isNamekey(props.name) ? props.name : namekey(props.name, {
23
+ ignoreNamePolicy: true
24
+ });
25
+ return _$createComponent(MethodDeclaration, _$mergeProps(props, {
26
+ name: finalName
27
+ }));
28
+ }
29
+ //# sourceMappingURL=DunderMethodDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isNamekey","namekey","MethodDeclaration","DunderMethodDeclaration","props","finalName","name","ignoreNamePolicy","_$createComponent","_$mergeProps"],"sources":["../../../src/components/DunderMethodDeclaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,gBAAgB;AAEnD,SAASC,iBAAiB,QAAQ,wBAAwB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASC,uBAAuBA,CAACC,KAAmC,EAAE;EAC3E,MAAMC,SAAS,GACbL,SAAS,CAACI,KAAK,CAACE,IAAI,CAAC,GACnBF,KAAK,CAACE,IAAI,GACVL,OAAO,CAACG,KAAK,CAACE,IAAI,EAAY;IAAEC,gBAAgB,EAAE;EAAK,CAAC,CAAC;EAC7D,OAAAC,iBAAA,CAAQN,iBAAiB,EAAAO,YAAA,CAAKL,KAAK;IAAEE,IAAI,EAAED;EAAS;AACtD","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Children } from "@alloy-js/core";
2
2
  import { BaseDeclarationProps } from "./Declaration.js";
3
3
  import { EnumMemberProps } from "./EnumMember.js";
4
- export interface EnumProps extends BaseDeclarationProps {
4
+ export interface EnumPropsBase extends BaseDeclarationProps {
5
5
  /**
6
6
  * The base type of the enum. One of: 'Enum', 'IntEnum', 'StrEnum', 'Flag', 'IntFlag'.
7
7
  * Defaults to 'Enum'.
@@ -11,40 +11,13 @@ export interface EnumProps extends BaseDeclarationProps {
11
11
  * Members of the enum as an array of objects.
12
12
  */
13
13
  members?: Array<EnumMemberProps>;
14
- /**
15
- * The enum style: 'classic' (default), 'auto', or 'functional'.
16
- */
17
- style?: "classic" | "auto" | "functional";
18
14
  /**
19
15
  * Optional docstring for the enum.
20
16
  */
21
17
  doc?: Children;
22
18
  }
23
- /**
24
- * A Python enum declaration, following https://docs.python.org/3.11/library/enum.html.
25
- *
26
- * @example
27
- * ```tsx
28
- * <EnumDeclaration name="Direction" style="functional">
29
- * members={[
30
- * { name: "NORTH" },
31
- * { name: "SOUTH" },
32
- * { name: "EAST" },
33
- * { name: "WEST" },
34
- * ]}
35
- * />
36
- * ```
37
- * This will generate:
38
- * ```python
39
- * from enum import Enum
40
- * class Direction(Enum):
41
- * NORTH = "NORTH"
42
- * SOUTH = "SOUTH"
43
- * EAST = "EAST"
44
- * WEST = "WEST"
45
- * ```
46
- */
47
- export declare function EnumDeclaration(props: EnumProps): Children;
19
+ export interface FunctionalEnumProps extends EnumPropsBase {
20
+ }
48
21
  /**
49
22
  * Create a Python enum using the functional syntax.
50
23
  *
@@ -86,7 +59,13 @@ export declare function EnumDeclaration(props: EnumProps): Children;
86
59
  * Status = Enum('Status', {'PENDING': 1, 'ACTIVE': 2, 'INACTIVE': 3})
87
60
  * ```
88
61
  */
89
- export declare function FunctionalEnumDeclaration(props: EnumProps): Children;
62
+ export declare function FunctionalEnumDeclaration(props: FunctionalEnumProps): Children;
63
+ export interface ClassEnumProps extends EnumPropsBase {
64
+ /**
65
+ * Indicates that the enum members should be auto-generated.
66
+ */
67
+ auto?: boolean;
68
+ }
90
69
  /**
91
70
  * Create a Python enum using the class-based syntax.
92
71
  *
@@ -156,5 +135,5 @@ export declare function FunctionalEnumDeclaration(props: EnumProps): Children;
156
135
  * BLUE = auto()
157
136
  * ```
158
137
  */
159
- export declare function ClassEnumDeclaration(props: EnumProps): Children;
138
+ export declare function ClassEnumDeclaration(props: ClassEnumProps): Children;
160
139
  //# sourceMappingURL=EnumDeclaration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnumDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/EnumDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK9D,MAAM,WAAW,SAAU,SAAQ,oBAAoB;IACrD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/D;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;IAC1C;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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,8 @@ import { Declaration as CoreDeclaration, For, Show } from "@alloy-js/core";
3
3
  import { enumModule } from "../builtins/python.js";
4
4
  import { createPythonSymbol } from "../symbol-creation.js";
5
5
  import { EnumMember } from "./EnumMember.js";
6
- import { SimpleCommentBlock } from "./index.js";
7
6
  import { MemberScope } from "./MemberScope.js";
8
7
  import { PythonBlock } from "./PythonBlock.js";
9
- /**
10
- * A Python enum declaration, following https://docs.python.org/3.11/library/enum.html.
11
- *
12
- * @example
13
- * ```tsx
14
- * <EnumDeclaration name="Direction" style="functional">
15
- * members={[
16
- * { name: "NORTH" },
17
- * { name: "SOUTH" },
18
- * { name: "EAST" },
19
- * { name: "WEST" },
20
- * ]}
21
- * />
22
- * ```
23
- * This will generate:
24
- * ```python
25
- * from enum import Enum
26
- * class Direction(Enum):
27
- * NORTH = "NORTH"
28
- * SOUTH = "SOUTH"
29
- * EAST = "EAST"
30
- * WEST = "WEST"
31
- * ```
32
- */
33
- export function EnumDeclaration(props) {
34
- // Handle enum styles
35
- if (props.style === "functional") {
36
- return _$createComponent(FunctionalEnumDeclaration, props);
37
- }
38
- return _$createComponent(ClassEnumDeclaration, props);
39
- }
40
-
41
8
  /**
42
9
  * Create a Python enum using the functional syntax.
43
10
  *
@@ -117,7 +84,6 @@ export function FunctionalEnumDeclaration(props) {
117
84
  }
118
85
  })];
119
86
  }
120
-
121
87
  /**
122
88
  * Create a Python enum using the class-based syntax.
123
89
  *
@@ -196,7 +162,7 @@ export function ClassEnumDeclaration(props) {
196
162
  ...m,
197
163
  auto: false
198
164
  } : m);
199
- if (props.style === "auto") {
165
+ if (props.auto) {
200
166
  memberList = memberList.map(m => m.value === undefined ? {
201
167
  name: m.name,
202
168
  auto: true
@@ -205,24 +171,20 @@ export function ClassEnumDeclaration(props) {
205
171
  return _$createComponent(CoreDeclaration, {
206
172
  symbol: sym,
207
173
  get children() {
208
- return [_$createComponent(Show, {
209
- get when() {
210
- return Boolean(props.doc);
211
- },
212
- get children() {
213
- return [_$createComponent(SimpleCommentBlock, {
214
- get children() {
215
- return props.doc;
216
- }
217
- }), _$createIntrinsic("hbr", {})];
218
- }
219
- }), "class ", _$memo(() => sym.name), "(", _$memo(() => enumModule["."][baseType]), ")", _$createComponent(MemberScope, {
174
+ return ["class ", _$memo(() => sym.name), "(", _$memo(() => enumModule["."][baseType]), ")", _$createComponent(MemberScope, {
220
175
  ownerSymbol: sym,
221
176
  get children() {
222
177
  return _$createComponent(PythonBlock, {
223
178
  opener: ":",
224
179
  get children() {
225
- return [_$createComponent(For, {
180
+ return [_$createComponent(Show, {
181
+ get when() {
182
+ return Boolean(props.doc);
183
+ },
184
+ get children() {
185
+ return [_$memo(() => props.doc), _$createIntrinsic("hbr", {})];
186
+ }
187
+ }), _$createComponent(For, {
226
188
  each: memberList,
227
189
  hardline: true,
228
190
  children: member => _$createComponent(EnumMember, {