@gtkx/codegen 1.0.0-rc.4 → 1.0.0

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 (410) hide show
  1. package/README.md +5 -5
  2. package/dist/analysis/descriptor-render.d.ts +8 -1
  3. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  4. package/dist/analysis/descriptor-render.js +37 -24
  5. package/dist/analysis/descriptor-render.js.map +1 -1
  6. package/dist/analysis/descriptor.d.ts +1 -1
  7. package/dist/analysis/descriptor.d.ts.map +1 -1
  8. package/dist/analysis/descriptor.js.map +1 -1
  9. package/dist/analysis/inheritance.d.ts +1 -2
  10. package/dist/analysis/inheritance.d.ts.map +1 -1
  11. package/dist/analysis/inheritance.js +25 -22
  12. package/dist/analysis/inheritance.js.map +1 -1
  13. package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
  14. package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
  15. package/dist/analysis/nul-terminated-bytes.js +18 -0
  16. package/dist/analysis/nul-terminated-bytes.js.map +1 -0
  17. package/dist/analysis/param-capability.d.ts +5 -0
  18. package/dist/analysis/param-capability.d.ts.map +1 -0
  19. package/dist/analysis/param-capability.js +130 -0
  20. package/dist/analysis/param-capability.js.map +1 -0
  21. package/dist/analysis/param-structure.d.ts +11 -4
  22. package/dist/analysis/param-structure.d.ts.map +1 -1
  23. package/dist/analysis/param-structure.js +40 -14
  24. package/dist/analysis/param-structure.js.map +1 -1
  25. package/dist/analysis/type-shape.d.ts +8 -0
  26. package/dist/analysis/type-shape.d.ts.map +1 -0
  27. package/dist/analysis/type-shape.js +12 -0
  28. package/dist/analysis/type-shape.js.map +1 -0
  29. package/dist/compile.d.ts +1 -1
  30. package/dist/compile.d.ts.map +1 -1
  31. package/dist/compile.js.map +1 -1
  32. package/dist/docs/api-reference.d.ts +2 -2
  33. package/dist/docs/api-reference.d.ts.map +1 -1
  34. package/dist/docs/api-reference.js +7 -14
  35. package/dist/docs/api-reference.js.map +1 -1
  36. package/dist/docs/element-page.d.ts +4 -4
  37. package/dist/docs/element-page.d.ts.map +1 -1
  38. package/dist/docs/element-page.js +32 -20
  39. package/dist/docs/element-page.js.map +1 -1
  40. package/dist/docs/handwritten-props.d.ts +9 -0
  41. package/dist/docs/handwritten-props.d.ts.map +1 -0
  42. package/dist/docs/handwritten-props.js +149 -0
  43. package/dist/docs/handwritten-props.js.map +1 -0
  44. package/dist/docs/pipeline.js +2 -2
  45. package/dist/docs/pipeline.js.map +1 -1
  46. package/dist/docs/render.d.ts +25 -5
  47. package/dist/docs/render.d.ts.map +1 -1
  48. package/dist/docs/render.js +84 -22
  49. package/dist/docs/render.js.map +1 -1
  50. package/dist/docs/symbol-page.d.ts +17 -0
  51. package/dist/docs/symbol-page.d.ts.map +1 -1
  52. package/dist/docs/symbol-page.js +128 -43
  53. package/dist/docs/symbol-page.js.map +1 -1
  54. package/dist/fingerprint.d.ts +1 -1
  55. package/dist/fingerprint.d.ts.map +1 -1
  56. package/dist/fingerprint.js.map +1 -1
  57. package/dist/gir/ancestry.d.ts +2 -2
  58. package/dist/gir/ancestry.d.ts.map +1 -1
  59. package/dist/gir/ancestry.js +11 -1
  60. package/dist/gir/ancestry.js.map +1 -1
  61. package/dist/gir/annotations.d.ts +22 -0
  62. package/dist/gir/annotations.d.ts.map +1 -0
  63. package/dist/gir/annotations.js +15 -0
  64. package/dist/gir/annotations.js.map +1 -0
  65. package/dist/gir/callback.d.ts +1 -0
  66. package/dist/gir/callback.d.ts.map +1 -1
  67. package/dist/gir/callback.js +1 -0
  68. package/dist/gir/callback.js.map +1 -1
  69. package/dist/gir/class.d.ts +32 -1
  70. package/dist/gir/class.d.ts.map +1 -1
  71. package/dist/gir/class.js +8 -3
  72. package/dist/gir/class.js.map +1 -1
  73. package/dist/gir/enum.d.ts +21 -1
  74. package/dist/gir/enum.d.ts.map +1 -1
  75. package/dist/gir/enum.js +9 -9
  76. package/dist/gir/enum.js.map +1 -1
  77. package/dist/gir/field.d.ts +19 -3
  78. package/dist/gir/field.d.ts.map +1 -1
  79. package/dist/gir/field.js +7 -8
  80. package/dist/gir/field.js.map +1 -1
  81. package/dist/gir/function.d.ts +15 -0
  82. package/dist/gir/function.d.ts.map +1 -1
  83. package/dist/gir/function.js.map +1 -1
  84. package/dist/gir/libraries.d.ts +1 -3
  85. package/dist/gir/libraries.d.ts.map +1 -1
  86. package/dist/gir/libraries.js +0 -1
  87. package/dist/gir/libraries.js.map +1 -1
  88. package/dist/gir/library.d.ts +36 -0
  89. package/dist/gir/library.d.ts.map +1 -1
  90. package/dist/gir/library.js +34 -0
  91. package/dist/gir/library.js.map +1 -1
  92. package/dist/gir/namespace.d.ts +38 -0
  93. package/dist/gir/namespace.d.ts.map +1 -1
  94. package/dist/gir/namespace.js +4 -5
  95. package/dist/gir/namespace.js.map +1 -1
  96. package/dist/gir/parameter.d.ts +39 -0
  97. package/dist/gir/parameter.d.ts.map +1 -1
  98. package/dist/gir/parameter.js +7 -3
  99. package/dist/gir/parameter.js.map +1 -1
  100. package/dist/gir/parse.d.ts +3 -1
  101. package/dist/gir/parse.d.ts.map +1 -1
  102. package/dist/gir/parse.js +6 -3
  103. package/dist/gir/parse.js.map +1 -1
  104. package/dist/gir/primitives.d.ts +1 -0
  105. package/dist/gir/primitives.d.ts.map +1 -1
  106. package/dist/gir/primitives.js.map +1 -1
  107. package/dist/gir/property.d.ts +16 -0
  108. package/dist/gir/property.d.ts.map +1 -1
  109. package/dist/gir/property.js +3 -3
  110. package/dist/gir/property.js.map +1 -1
  111. package/dist/gir/record.d.ts +22 -0
  112. package/dist/gir/record.d.ts.map +1 -1
  113. package/dist/gir/record.js +3 -2
  114. package/dist/gir/record.js.map +1 -1
  115. package/dist/gir/size.d.ts +5 -4
  116. package/dist/gir/size.d.ts.map +1 -1
  117. package/dist/gir/size.js.map +1 -1
  118. package/dist/gir/type-id.d.ts +35 -0
  119. package/dist/gir/type-id.d.ts.map +1 -1
  120. package/dist/gir/type-id.js +1 -0
  121. package/dist/gir/type-id.js.map +1 -1
  122. package/dist/gir/type-ref.d.ts.map +1 -1
  123. package/dist/gir/type-ref.js +1 -0
  124. package/dist/gir/type-ref.js.map +1 -1
  125. package/dist/gir/type.d.ts +20 -0
  126. package/dist/gir/type.d.ts.map +1 -1
  127. package/dist/gir/type.js.map +1 -1
  128. package/dist/khronos/args.d.ts +7 -6
  129. package/dist/khronos/args.d.ts.map +1 -1
  130. package/dist/khronos/args.js +28 -6
  131. package/dist/khronos/args.js.map +1 -1
  132. package/dist/khronos/doc-context.d.ts +29 -0
  133. package/dist/khronos/doc-context.d.ts.map +1 -0
  134. package/dist/khronos/doc-context.js +29 -0
  135. package/dist/khronos/doc-context.js.map +1 -0
  136. package/dist/khronos/extensions.d.ts +13 -0
  137. package/dist/khronos/extensions.d.ts.map +1 -0
  138. package/dist/khronos/extensions.js +49 -0
  139. package/dist/khronos/extensions.js.map +1 -0
  140. package/dist/khronos/jsdoc.d.ts +17 -11
  141. package/dist/khronos/jsdoc.d.ts.map +1 -1
  142. package/dist/khronos/jsdoc.js +104 -46
  143. package/dist/khronos/jsdoc.js.map +1 -1
  144. package/dist/khronos/model.d.ts +42 -3
  145. package/dist/khronos/model.d.ts.map +1 -1
  146. package/dist/khronos/model.js +218 -63
  147. package/dist/khronos/model.js.map +1 -1
  148. package/dist/khronos/modules.d.ts +9 -6
  149. package/dist/khronos/modules.d.ts.map +1 -1
  150. package/dist/khronos/modules.js +96 -26
  151. package/dist/khronos/modules.js.map +1 -1
  152. package/dist/khronos/notes.d.ts +19 -0
  153. package/dist/khronos/notes.d.ts.map +1 -0
  154. package/dist/khronos/notes.js +35 -0
  155. package/dist/khronos/notes.js.map +1 -0
  156. package/dist/khronos/param-pair.d.ts +1 -1
  157. package/dist/khronos/param-pair.d.ts.map +1 -1
  158. package/dist/khronos/param-pair.js.map +1 -1
  159. package/dist/khronos/pipeline.d.ts +3 -1
  160. package/dist/khronos/pipeline.d.ts.map +1 -1
  161. package/dist/khronos/pipeline.js +58 -27
  162. package/dist/khronos/pipeline.js.map +1 -1
  163. package/dist/khronos/plan.d.ts +3 -3
  164. package/dist/khronos/plan.d.ts.map +1 -1
  165. package/dist/khronos/plan.js +2 -2
  166. package/dist/khronos/plan.js.map +1 -1
  167. package/dist/khronos/render.d.ts +8 -6
  168. package/dist/khronos/render.d.ts.map +1 -1
  169. package/dist/khronos/render.js +35 -26
  170. package/dist/khronos/render.js.map +1 -1
  171. package/dist/khronos/select.d.ts +21 -4
  172. package/dist/khronos/select.d.ts.map +1 -1
  173. package/dist/khronos/select.js +47 -34
  174. package/dist/khronos/select.js.map +1 -1
  175. package/dist/react/element-config.d.ts +2 -2
  176. package/dist/react/element-config.d.ts.map +1 -1
  177. package/dist/react/element-config.js.map +1 -1
  178. package/dist/runner.d.ts +1 -7
  179. package/dist/runner.d.ts.map +1 -1
  180. package/dist/runner.js.map +1 -1
  181. package/dist/store/compile-store.d.ts +1 -1
  182. package/dist/store/compile-store.d.ts.map +1 -1
  183. package/dist/store/compile-store.js.map +1 -1
  184. package/dist/store/gi/callable-doc.d.ts +11 -0
  185. package/dist/store/gi/callable-doc.d.ts.map +1 -0
  186. package/dist/store/gi/callable-doc.js +62 -0
  187. package/dist/store/gi/callable-doc.js.map +1 -0
  188. package/dist/store/gi/callables.d.ts +3 -1
  189. package/dist/store/gi/callables.d.ts.map +1 -1
  190. package/dist/store/gi/callables.js +12 -12
  191. package/dist/store/gi/callables.js.map +1 -1
  192. package/dist/store/gi/callback.d.ts.map +1 -1
  193. package/dist/store/gi/callback.js +2 -2
  194. package/dist/store/gi/callback.js.map +1 -1
  195. package/dist/store/gi/class.d.ts.map +1 -1
  196. package/dist/store/gi/class.js +5 -3
  197. package/dist/store/gi/class.js.map +1 -1
  198. package/dist/store/gi/closure-invocation.d.ts +4 -0
  199. package/dist/store/gi/closure-invocation.d.ts.map +1 -0
  200. package/dist/store/gi/closure-invocation.js +22 -0
  201. package/dist/store/gi/closure-invocation.js.map +1 -0
  202. package/dist/store/gi/constant.d.ts.map +1 -1
  203. package/dist/store/gi/constant.js +3 -2
  204. package/dist/store/gi/constant.js.map +1 -1
  205. package/dist/store/gi/constructor-props.d.ts.map +1 -1
  206. package/dist/store/gi/constructor-props.js +18 -20
  207. package/dist/store/gi/constructor-props.js.map +1 -1
  208. package/dist/store/gi/doc-spec.d.ts +14 -0
  209. package/dist/store/gi/doc-spec.d.ts.map +1 -0
  210. package/dist/store/gi/doc-spec.js +23 -0
  211. package/dist/store/gi/doc-spec.js.map +1 -0
  212. package/dist/store/gi/enum.d.ts.map +1 -1
  213. package/dist/store/gi/enum.js +29 -16
  214. package/dist/store/gi/enum.js.map +1 -1
  215. package/dist/store/gi/function.d.ts.map +1 -1
  216. package/dist/store/gi/function.js +27 -12
  217. package/dist/store/gi/function.js.map +1 -1
  218. package/dist/store/gi/interface.d.ts.map +1 -1
  219. package/dist/store/gi/interface.js +130 -16
  220. package/dist/store/gi/interface.js.map +1 -1
  221. package/dist/store/gi/item-comparators.d.ts.map +1 -1
  222. package/dist/store/gi/item-comparators.js +3 -5
  223. package/dist/store/gi/item-comparators.js.map +1 -1
  224. package/dist/store/gi/method.d.ts +9 -1
  225. package/dist/store/gi/method.d.ts.map +1 -1
  226. package/dist/store/gi/method.js +69 -26
  227. package/dist/store/gi/method.js.map +1 -1
  228. package/dist/store/gi/param-marshal.d.ts +4 -1
  229. package/dist/store/gi/param-marshal.d.ts.map +1 -1
  230. package/dist/store/gi/param-marshal.js +5 -1
  231. package/dist/store/gi/param-marshal.js.map +1 -1
  232. package/dist/store/gi/pipeline.d.ts.map +1 -1
  233. package/dist/store/gi/pipeline.js +3 -2
  234. package/dist/store/gi/pipeline.js.map +1 -1
  235. package/dist/store/gi/properties.d.ts.map +1 -1
  236. package/dist/store/gi/properties.js +2 -2
  237. package/dist/store/gi/properties.js.map +1 -1
  238. package/dist/store/gi/property-accessor.d.ts +3 -1
  239. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  240. package/dist/store/gi/property-accessor.js +6 -5
  241. package/dist/store/gi/property-accessor.js.map +1 -1
  242. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  243. package/dist/store/gi/record-constructor.js +3 -1
  244. package/dist/store/gi/record-constructor.js.map +1 -1
  245. package/dist/store/gi/record-field-accessor.d.ts +3 -1
  246. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  247. package/dist/store/gi/record-field-accessor.js +3 -2
  248. package/dist/store/gi/record-field-accessor.js.map +1 -1
  249. package/dist/store/gi/record-layout.js +1 -1
  250. package/dist/store/gi/record-layout.js.map +1 -1
  251. package/dist/store/gi/record.d.ts.map +1 -1
  252. package/dist/store/gi/record.js +3 -2
  253. package/dist/store/gi/record.js.map +1 -1
  254. package/dist/store/gi/registration.d.ts +1 -1
  255. package/dist/store/gi/registration.js +2 -2
  256. package/dist/store/gi/registration.js.map +1 -1
  257. package/dist/store/gi/runtime-override.d.ts +2 -1
  258. package/dist/store/gi/runtime-override.d.ts.map +1 -1
  259. package/dist/store/gi/runtime-override.js +8 -5
  260. package/dist/store/gi/runtime-override.js.map +1 -1
  261. package/dist/store/gi/signal.d.ts.map +1 -1
  262. package/dist/store/gi/signal.js +14 -15
  263. package/dist/store/gi/signal.js.map +1 -1
  264. package/dist/store/gi/value-marshalable.d.ts +1 -2
  265. package/dist/store/gi/value-marshalable.d.ts.map +1 -1
  266. package/dist/store/gi/value-marshalable.js +1 -1
  267. package/dist/store/gi/value-marshalable.js.map +1 -1
  268. package/dist/store/gi/vtable.d.ts +16 -1
  269. package/dist/store/gi/vtable.d.ts.map +1 -1
  270. package/dist/store/gi/vtable.js +214 -51
  271. package/dist/store/gi/vtable.js.map +1 -1
  272. package/dist/store/jsx/element-components.d.ts +1 -1
  273. package/dist/store/jsx/element-components.d.ts.map +1 -1
  274. package/dist/store/jsx/element-components.js +6 -4
  275. package/dist/store/jsx/element-components.js.map +1 -1
  276. package/dist/store/jsx/element-prop-imports.d.ts +1 -3
  277. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
  278. package/dist/store/jsx/element-prop-imports.js.map +1 -1
  279. package/dist/store/jsx/element-prop-types.d.ts +3 -0
  280. package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
  281. package/dist/store/jsx/element-prop-types.js +7 -1
  282. package/dist/store/jsx/element-prop-types.js.map +1 -1
  283. package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
  284. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
  285. package/dist/store/jsx/intrinsic-elements.js.map +1 -1
  286. package/dist/store/jsx/jsx.d.ts.map +1 -1
  287. package/dist/store/jsx/jsx.js +7 -6
  288. package/dist/store/jsx/jsx.js.map +1 -1
  289. package/dist/store/jsx/metadata.js +2 -2
  290. package/dist/store/jsx/metadata.js.map +1 -1
  291. package/dist/store/jsx/pipeline.d.ts +1 -1
  292. package/dist/store/jsx/pipeline.d.ts.map +1 -1
  293. package/dist/store/jsx/pipeline.js.map +1 -1
  294. package/dist/store/jsx/props.d.ts +1 -7
  295. package/dist/store/jsx/props.d.ts.map +1 -1
  296. package/dist/store/jsx/props.js +14 -6
  297. package/dist/store/jsx/props.js.map +1 -1
  298. package/dist/writer/context.d.ts +2 -1
  299. package/dist/writer/context.d.ts.map +1 -1
  300. package/dist/writer/context.js +3 -0
  301. package/dist/writer/context.js.map +1 -1
  302. package/dist/writer/doc-tags.d.ts +21 -0
  303. package/dist/writer/doc-tags.d.ts.map +1 -0
  304. package/dist/writer/doc-tags.js +38 -0
  305. package/dist/writer/doc-tags.js.map +1 -0
  306. package/dist/writer/doc.d.ts +3 -1
  307. package/dist/writer/doc.d.ts.map +1 -1
  308. package/dist/writer/doc.js +19 -6
  309. package/dist/writer/doc.js.map +1 -1
  310. package/dist/writer/gtk-doc.d.ts +1 -1
  311. package/dist/writer/gtk-doc.d.ts.map +1 -1
  312. package/dist/writer/gtk-doc.js +64 -15
  313. package/dist/writer/gtk-doc.js.map +1 -1
  314. package/dist/writer/module.d.ts +8 -2
  315. package/dist/writer/module.d.ts.map +1 -1
  316. package/dist/writer/module.js +13 -1
  317. package/dist/writer/module.js.map +1 -1
  318. package/overrides/gdk/rgba.ts.ejs +26 -0
  319. package/overrides/gobject/object.ts.ejs +48 -3
  320. package/overrides/gobject/value.ts.ejs +7 -0
  321. package/overrides/graphene/structs.ts.ejs +55 -0
  322. package/package.json +4 -4
  323. package/src/analysis/descriptor-render.ts +47 -28
  324. package/src/analysis/descriptor.ts +0 -3
  325. package/src/analysis/inheritance.ts +35 -34
  326. package/src/analysis/nul-terminated-bytes.ts +31 -0
  327. package/src/analysis/param-capability.ts +172 -0
  328. package/src/analysis/param-structure.ts +83 -23
  329. package/src/analysis/type-shape.ts +24 -0
  330. package/src/compile.ts +1 -1
  331. package/src/docs/api-reference.ts +36 -25
  332. package/src/docs/element-page.ts +53 -47
  333. package/src/docs/handwritten-props.ts +230 -0
  334. package/src/docs/pipeline.ts +2 -2
  335. package/src/docs/render.ts +146 -32
  336. package/src/docs/symbol-page.ts +224 -79
  337. package/src/fingerprint.ts +0 -1
  338. package/src/gir/ancestry.ts +15 -1
  339. package/src/gir/annotations.ts +37 -0
  340. package/src/gir/callback.ts +2 -0
  341. package/src/gir/class.ts +42 -4
  342. package/src/gir/enum.ts +30 -10
  343. package/src/gir/field.ts +24 -9
  344. package/src/gir/function.ts +15 -0
  345. package/src/gir/libraries.ts +11 -3
  346. package/src/gir/library.ts +51 -2
  347. package/src/gir/namespace.ts +41 -5
  348. package/src/gir/parameter.ts +47 -3
  349. package/src/gir/parse.ts +8 -2
  350. package/src/gir/primitives.ts +1 -0
  351. package/src/gir/property.ts +18 -3
  352. package/src/gir/record.ts +24 -2
  353. package/src/gir/size.ts +8 -3
  354. package/src/gir/type-id.ts +49 -3
  355. package/src/gir/type-ref.ts +1 -0
  356. package/src/gir/type.ts +50 -6
  357. package/src/khronos/args.ts +36 -13
  358. package/src/khronos/doc-context.ts +62 -0
  359. package/src/khronos/extensions.ts +85 -0
  360. package/src/khronos/jsdoc.ts +152 -56
  361. package/src/khronos/model.ts +314 -69
  362. package/src/khronos/modules.ts +134 -40
  363. package/src/khronos/notes.ts +74 -0
  364. package/src/khronos/param-pair.ts +1 -1
  365. package/src/khronos/pipeline.ts +94 -41
  366. package/src/khronos/plan.ts +4 -5
  367. package/src/khronos/render.ts +62 -50
  368. package/src/khronos/select.ts +91 -50
  369. package/src/react/element-config.ts +2 -2
  370. package/src/runner.ts +1 -8
  371. package/src/store/compile-store.ts +1 -1
  372. package/src/store/gi/callable-doc.ts +102 -0
  373. package/src/store/gi/callables.ts +18 -12
  374. package/src/store/gi/callback.ts +3 -2
  375. package/src/store/gi/class.ts +6 -3
  376. package/src/store/gi/closure-invocation.ts +26 -0
  377. package/src/store/gi/constant.ts +3 -4
  378. package/src/store/gi/constructor-props.ts +19 -23
  379. package/src/store/gi/doc-spec.ts +38 -0
  380. package/src/store/gi/enum.ts +55 -20
  381. package/src/store/gi/function.ts +43 -21
  382. package/src/store/gi/interface.ts +214 -26
  383. package/src/store/gi/item-comparators.ts +3 -5
  384. package/src/store/gi/method.ts +98 -42
  385. package/src/store/gi/param-marshal.ts +15 -1
  386. package/src/store/gi/pipeline.ts +7 -2
  387. package/src/store/gi/properties.ts +3 -2
  388. package/src/store/gi/property-accessor.ts +9 -4
  389. package/src/store/gi/record-constructor.ts +6 -1
  390. package/src/store/gi/record-field-accessor.ts +5 -3
  391. package/src/store/gi/record-layout.ts +1 -1
  392. package/src/store/gi/record.ts +8 -2
  393. package/src/store/gi/registration.ts +3 -3
  394. package/src/store/gi/runtime-override.ts +13 -6
  395. package/src/store/gi/signal.ts +19 -20
  396. package/src/store/gi/value-marshalable.ts +1 -1
  397. package/src/store/gi/vtable.ts +361 -60
  398. package/src/store/jsx/element-components.ts +8 -5
  399. package/src/store/jsx/element-prop-imports.ts +1 -3
  400. package/src/store/jsx/element-prop-types.ts +10 -1
  401. package/src/store/jsx/intrinsic-elements.ts +4 -0
  402. package/src/store/jsx/jsx.ts +8 -6
  403. package/src/store/jsx/metadata.ts +2 -2
  404. package/src/store/jsx/pipeline.ts +1 -1
  405. package/src/store/jsx/props.ts +20 -7
  406. package/src/writer/context.ts +5 -1
  407. package/src/writer/doc-tags.ts +70 -0
  408. package/src/writer/doc.ts +29 -6
  409. package/src/writer/gtk-doc.ts +82 -15
  410. package/src/writer/module.ts +25 -2
@@ -1,46 +1,112 @@
1
- import { pascalCase, sourceStringLiteral, toCamelIdentifier } from "@gtkx/utils";
1
+ import { pascalCase, sourceStringLiteral } from "@gtkx/utils";
2
2
  import type { GirCallback } from "../../gir/callback.js";
3
- import type { GirClass } from "../../gir/class.js";
3
+ import type { GirClass, GirVirtualMethod } from "../../gir/class.js";
4
4
  import type { GirField } from "../../gir/field.js";
5
5
  import type { GirParameter } from "../../gir/parameter.js";
6
+ import type { GirRecord } from "../../gir/record.js";
7
+ import type { TypeId } from "../../gir/type-id.js";
6
8
  import type { ModuleContext } from "../../writer/context.js";
9
+ import type { JsDocSpec } from "../../writer/doc.js";
7
10
  import {
8
11
  isInlineCallbackRef,
9
12
  isScalarRef,
10
13
  renderDescriptor,
11
14
  renderParamDescriptor,
12
15
  } from "../../analysis/descriptor-render.js";
13
- import { renderBraced } from "../../writer/emit.js";
16
+ import {
17
+ foldedLengthParameters,
18
+ handlerParameters,
19
+ parameterIdentifier,
20
+ renamesWithInstance,
21
+ renderHandlerParameters,
22
+ renderHandlerResultType,
23
+ } from "../../analysis/param-structure.js";
24
+ import { renderTsType } from "../../analysis/ts-type.js";
25
+ import { ancestorChain, type ResolvedAncestor, resolveInterfaces } from "../../gir/ancestry.js";
26
+ import { renderJsDoc } from "../../writer/doc.js";
27
+ import { renderBlock, renderBraced } from "../../writer/emit.js";
28
+ import { handlerSpec, THROWS_TEXT } from "./doc-spec.js";
14
29
  import { computeRecordFieldSlots } from "./record-layout.js";
15
30
 
16
31
  type VtableKind = "class" | "interface";
32
+ type VfuncMemberMode = "implementation" | "requirement" | "signature";
17
33
 
18
- type RenderVtableSlotDescriptorOptions = {
34
+ type VtableSlot = {
19
35
  key: string;
20
- structName: string;
21
- kind: VtableKind;
22
36
  field: GirField;
23
37
  callback: GirCallback;
38
+ vfunc: GirVirtualMethod | undefined;
24
39
  byteOffset: number;
25
- vtableSize: number;
26
40
  };
27
41
 
28
- const renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {
29
- if (klass.glibTypeStruct === undefined) {
30
- return undefined;
31
- }
42
+ type VfuncMemberOptions = {
43
+ context: ModuleContext;
44
+ ownerRef: string;
45
+ slot: VtableSlot;
46
+ mode: VfuncMemberMode;
47
+ isProtected: boolean;
48
+ };
49
+
50
+ type VfuncMembersOptions = {
51
+ context: ModuleContext;
52
+ klass: GirClass;
53
+ mode: VfuncMemberMode;
54
+ };
32
55
 
33
- const structName = pascalCase(klass.glibTypeStruct);
34
- const kind: VtableKind = klass.isInterface ? "interface" : "class";
35
- const entries = vtableEntries(context, structName, kind, klass.glibTypeStruct);
56
+ type VfuncSignature = {
57
+ header: string;
58
+ returnType: string;
59
+ };
36
60
 
37
- if (entries.length === 0) {
38
- return undefined;
39
- }
61
+ type VfuncEntry = {
62
+ name: string;
63
+ signature: string;
64
+ doc: string | undefined;
65
+ };
40
66
 
41
- return renderBraced(entries.join("\n"));
67
+ type Vtable = {
68
+ structName: string;
69
+ kind: VtableKind;
70
+ vtableSize: number;
71
+ slots: VtableSlot[];
42
72
  };
43
73
 
74
+ const PADDING_FIELD_NAME = /^(?:reserved|padding)\d*$/i;
75
+
76
+ const UNCALLABLE_SLOT_KEYS: Set<string> = new Set([
77
+ "vfuncDispose",
78
+ "vfuncFinalize",
79
+ "vfuncGetProperty",
80
+ "vfuncSetProperty",
81
+ ]);
82
+
83
+ const PROTECTED_SLOT_NOTE = "It is `protected`, so only a subclass chaining up reaches it.";
84
+ const PUBLIC_SLOT_NOTE = "Calling it from anywhere else re-enters the slot on a live instance.";
85
+
86
+ const vfuncMemberName = (fieldName: string): string => `vfunc${pascalCase(fieldName)}`;
87
+
88
+ const vfuncOverrideNote = (slot: VtableSlot, isProtected: boolean): string =>
89
+ [
90
+ `Invokes the \`${slot.field.name}\` vtable slot. Override it on a class passed to \`registerClass\``,
91
+ `and chain up with \`super.${slot.key}()\`.`,
92
+ isProtected ? PROTECTED_SLOT_NOTE : PUBLIC_SLOT_NOTE,
93
+ ].join("\n");
94
+
95
+ const vfuncRequirementNote = (slot: VtableSlot, ownerRef: string): string =>
96
+ [
97
+ `Fills the \`${slot.field.name}\` vtable slot. Declare it on a class passed to \`registerClass\``,
98
+ `with \`${ownerRef}\` in \`implements\`, which installs it in the interface vtable. Leaving it out`,
99
+ "keeps whatever the interface installs by default, the way it does for a C implementer.",
100
+ ].join("\n");
101
+
102
+ const vfuncMemberNote = (options: VfuncMemberOptions): string =>
103
+ options.mode === "requirement"
104
+ ? vfuncRequirementNote(options.slot, options.ownerRef)
105
+ : vfuncOverrideNote(options.slot, options.isProtected);
106
+
107
+ const isPaddingField = (field: GirField): boolean =>
108
+ field.name.startsWith("_") || PADDING_FIELD_NAME.test(field.name);
109
+
44
110
  const vtableCallbackType = (context: ModuleContext, field: GirField): GirCallback | undefined => {
45
111
  if (field.type === undefined) {
46
112
  return undefined;
@@ -60,15 +126,19 @@ const vtableSlotEntry = (
60
126
  field: GirField,
61
127
  claimedNames: Set<string>,
62
128
  ): { key: string; callback: GirCallback } | undefined => {
129
+ if (field.name === "constructor" || isPaddingField(field)) {
130
+ return undefined;
131
+ }
132
+
63
133
  const callback = vtableCallbackType(context, field);
64
134
 
65
135
  if (callback === undefined) {
66
136
  return undefined;
67
137
  }
68
138
 
69
- const key = toCamelIdentifier(field.name);
139
+ const key = vfuncMemberName(field.name);
70
140
 
71
- if (key === "constructor" || claimedNames.has(key)) {
141
+ if (claimedNames.has(key)) {
72
142
  return undefined;
73
143
  }
74
144
 
@@ -79,53 +149,271 @@ const vtableSlotEntry = (
79
149
  return { key, callback };
80
150
  };
81
151
 
82
- const vtableEntries = (context: ModuleContext, structName: string, kind: VtableKind, typeStruct: string): string[] => {
83
- const resolved = context.library.resolveType(context.namespace.name, typeStruct);
84
-
85
- if (resolved?.kind !== "record") {
86
- return [];
87
- }
88
-
89
- const { slots, size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);
90
- const entries: string[] = [];
152
+ const collectVtableSlots = (
153
+ context: ModuleContext,
154
+ fields: GirField[],
155
+ isUnion: boolean,
156
+ ): { slots: VtableSlot[]; vtableSize: number } => {
157
+ const { slots, size } = computeRecordFieldSlots(context, fields, isUnion);
158
+ const entries: VtableSlot[] = [];
91
159
  const claimedNames: Set<string> = new Set();
92
160
 
93
161
  for (const { field, slot } of slots) {
94
162
  const entry = vtableSlotEntry(context, field, claimedNames);
95
163
 
96
- if (entry === undefined) {
97
- continue;
164
+ if (entry !== undefined) {
165
+ claimedNames.add(entry.key);
166
+ entries.push({ ...entry, field, vfunc: undefined, byteOffset: slot.byteOffset });
98
167
  }
168
+ }
169
+
170
+ return { slots: entries, vtableSize: size };
171
+ };
99
172
 
100
- claimedNames.add(entry.key);
173
+ const resolveVtableRecord = (
174
+ context: ModuleContext,
175
+ namespaceName: string,
176
+ klass: GirClass,
177
+ ): { typeStruct: string; record: GirRecord } | undefined => {
178
+ const typeStruct = klass.glibTypeStruct;
179
+ const resolved = typeStruct === undefined ? undefined : context.library.resolveType(namespaceName, typeStruct);
101
180
 
102
- entries.push(
103
- renderVtableSlotDescriptor(context, {
104
- key: entry.key,
105
- structName,
106
- kind,
107
- field,
108
- callback: entry.callback,
109
- byteOffset: slot.byteOffset,
110
- vtableSize: size,
111
- }),
112
- );
181
+ if (typeStruct === undefined || resolved?.kind !== "record" || resolved.value.fields.length === 0) {
182
+ return undefined;
113
183
  }
114
184
 
115
- return entries;
185
+ return { typeStruct, record: resolved.value };
116
186
  };
117
187
 
118
- const isUnsupportedOutParam = (context: ModuleContext, param: GirParameter): boolean =>
119
- (param.direction === "out" || param.direction === "inout") &&
120
- !param.callerAllocates &&
121
- !isScalarRef(context.library, param.type);
188
+ const attachVirtualMethods = (slots: VtableSlot[], klass: GirClass): VtableSlot[] => {
189
+ const byKey: Map<string, GirVirtualMethod> = new Map(
190
+ klass.vfuncs.map((vfunc) => [vfuncMemberName(vfunc.name), vfunc]),
191
+ );
122
192
 
123
- const isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {
124
- if (param.isVarargs) {
125
- return false;
193
+ return slots.map((slot) => ({ ...slot, vfunc: byKey.get(slot.key) }));
194
+ };
195
+
196
+ const collectVtable = (context: ModuleContext, namespaceName: string, klass: GirClass): Vtable | undefined => {
197
+ const resolved = resolveVtableRecord(context, namespaceName, klass);
198
+
199
+ if (resolved === undefined) {
200
+ return undefined;
201
+ }
202
+
203
+ const { slots, vtableSize } = collectVtableSlots(context, resolved.record.fields, resolved.record.isUnion);
204
+
205
+ if (slots.length === 0) {
206
+ return undefined;
207
+ }
208
+
209
+ return {
210
+ structName: pascalCase(resolved.typeStruct),
211
+ kind: klass.isInterface ? "interface" : "class",
212
+ vtableSize,
213
+ slots: attachVirtualMethods(slots, klass),
214
+ };
215
+ };
216
+
217
+ const vfuncMemberNames = (context: ModuleContext, namespaceName: string, klass: GirClass): string[] =>
218
+ collectVtable(context, namespaceName, klass)?.slots.map((slot) => slot.key) ?? [];
219
+
220
+ const renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {
221
+ const vtable = collectVtable(context, context.namespace.name, klass);
222
+
223
+ if (vtable === undefined) {
224
+ return undefined;
225
+ }
226
+
227
+ const entries = vtable.slots.map((slot) => renderVtableSlotDescriptor(context, vtable, slot));
228
+
229
+ return renderBraced(entries.join("\n"));
230
+ };
231
+
232
+ const slotIdentity = (slot: VtableSlot): string => `${slot.key}:${String(slot.byteOffset)}`;
233
+
234
+ const inheritedSlotIdentities = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> => {
235
+ const identities: Set<string> = new Set();
236
+ const [, ...ancestors] = [...ancestorChain(context.library, klass, namespaceName)];
237
+
238
+ for (const ancestor of ancestors) {
239
+ const vtable = collectVtable(context, ancestor.namespaceName, ancestor.klass);
240
+ const slots = vtable?.slots ?? [];
241
+
242
+ for (const slot of slots) {
243
+ identities.add(slotIdentity(slot));
244
+ }
245
+ }
246
+
247
+ return identities;
248
+ };
249
+
250
+ const addInterfaceSlotKeys = (
251
+ context: ModuleContext,
252
+ iface: ResolvedAncestor,
253
+ keys: Set<string>,
254
+ seen: Set<string>,
255
+ ): void => {
256
+ const identity = `${iface.namespaceName}.${iface.klass.name}`;
257
+
258
+ if (seen.has(identity)) {
259
+ return;
260
+ }
261
+
262
+ seen.add(identity);
263
+
264
+ for (const key of vfuncMemberNames(context, iface.namespaceName, iface.klass)) {
265
+ keys.add(key);
266
+ }
267
+
268
+ for (const ref of resolveInterfaces(context.library, iface.namespaceName, iface.klass.prerequisites)) {
269
+ addInterfaceSlotKeys(context, ref, keys, seen);
270
+ }
271
+ };
272
+
273
+ const implementedSlotKeys = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> => {
274
+ const keys: Set<string> = new Set();
275
+ const seen: Set<string> = new Set();
276
+
277
+ for (const ancestor of ancestorChain(context.library, klass, namespaceName)) {
278
+ for (const ref of resolveInterfaces(context.library, ancestor.namespaceName, ancestor.klass.implements)) {
279
+ addInterfaceSlotKeys(context, ref, keys, seen);
280
+ }
281
+ }
282
+
283
+ return keys;
284
+ };
285
+
286
+ const protectedSlotKeys = (options: VfuncMembersOptions, slots: VtableSlot[]): Set<string> => {
287
+ const { context, klass } = options;
288
+
289
+ if (klass.isInterface) {
290
+ return new Set();
291
+ }
292
+
293
+ const shared = implementedSlotKeys(context, context.namespace.name, klass);
294
+
295
+ return new Set(slots.map((slot) => slot.key).filter((key) => !shared.has(key)));
296
+ };
297
+
298
+ const callableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): VtableSlot[] => {
299
+ const vtable = collectVtable(context, namespaceName, klass);
300
+
301
+ if (vtable === undefined) {
302
+ return [];
303
+ }
304
+
305
+ const inherited = inheritedSlotIdentities(context, namespaceName, klass);
306
+
307
+ return vtable.slots.filter((slot) => isCallableSlot(context, slot) && !inherited.has(slotIdentity(slot)));
308
+ };
309
+
310
+ const hasCallableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): boolean =>
311
+ callableVfuncSlots(context, namespaceName, klass).length > 0;
312
+
313
+ const slotDoc = (slot: VtableSlot): string | undefined => slot.vfunc?.doc ?? slot.field.doc ?? slot.callback.doc;
314
+
315
+ const slotDocParameters = (slot: VtableSlot): GirParameter[] => {
316
+ const [, ...parameters] = slot.callback.parameters;
317
+ const vfuncParameters = slot.vfunc?.parameters ?? [];
318
+
319
+ return parameters.map((parameter, index) => ({ ...parameter, doc: vfuncParameters[index]?.doc ?? parameter.doc }));
320
+ };
321
+
322
+ const slotDocSpec = (slot: VtableSlot): JsDocSpec => {
323
+ const parameters = slotDocParameters(slot);
324
+ const source = slot.vfunc ?? slot.callback;
325
+
326
+ return {
327
+ ...handlerSpec(source, parameters, renamesWithInstance(parameters, slot.callback.parameters[0])),
328
+ returns: slot.vfunc?.returnValue.doc ?? slot.callback.returnValue.doc,
329
+ throws: slot.callback.throws ? THROWS_TEXT : undefined,
330
+ };
331
+ };
332
+
333
+ const vfuncEntries = (context: ModuleContext, namespaceName: string, klass: GirClass): VfuncEntry[] =>
334
+ callableVfuncSlots(context, namespaceName, klass).map((slot) => ({
335
+ name: slot.key,
336
+ signature: vfuncSlotSignature(context, slot).header,
337
+ doc: slotDoc(slot),
338
+ }));
339
+
340
+ const renderVfuncMembers = (options: VfuncMembersOptions): string[] => {
341
+ const { context, klass, mode } = options;
342
+ const ownerRef = pascalCase(klass.name);
343
+ const slots = callableVfuncSlots(context, context.namespace.name, klass);
344
+
345
+ if (slots.length === 0) {
346
+ return [];
347
+ }
348
+
349
+ if (mode === "implementation") {
350
+ context.addRuntimeImport("callVfunc");
351
+ }
352
+
353
+ const protectedKeys = protectedSlotKeys(options, slots);
354
+
355
+ return slots.map((slot) =>
356
+ renderVfuncMember({ context, ownerRef, slot, mode, isProtected: protectedKeys.has(slot.key) }));
357
+ };
358
+
359
+ const hasUnannotatedPointerParam = (context: ModuleContext, slot: VtableSlot): boolean => {
360
+ const [, ...parameters] = slot.callback.parameters;
361
+
362
+ return parameters.some(
363
+ (parameter) =>
364
+ parameter.direction === "in" &&
365
+ parameter.cType?.endsWith("*") === true &&
366
+ isScalarRef(context.library, parameter.type),
367
+ );
368
+ };
369
+
370
+ const isCallableSlot = (context: ModuleContext, slot: VtableSlot): boolean =>
371
+ !UNCALLABLE_SLOT_KEYS.has(slot.key) && !hasUnannotatedPointerParam(context, slot);
372
+
373
+ const vfuncSlotSignature = (context: ModuleContext, slot: VtableSlot, isOptional = false): VfuncSignature => {
374
+ const [, ...parameters] = slot.callback.parameters;
375
+
376
+ const renderType = (ref: TypeId | undefined, isNullable: boolean): string =>
377
+ renderTsType(context, ref, isNullable);
378
+
379
+ const signature = renderHandlerParameters(parameters, renderType).join(", ");
380
+ const folded = foldedLengthParameters(context.library, slot.callback);
381
+
382
+ const returnType = renderHandlerResultType({
383
+ library: context.library,
384
+ signal: { ...slot.callback, parameters },
385
+ renderType,
386
+ shouldIncludeCallerAllocated: true,
387
+ isOptOut: false,
388
+ shouldExcludeOut: (parameter) => folded.has(parameter),
389
+ });
390
+
391
+ return { header: `${slot.key}${isOptional ? "?" : ""}(${signature}): ${returnType}`, returnType };
392
+ };
393
+
394
+ const renderVfuncMember = (options: VfuncMemberOptions): string => {
395
+ const { context, ownerRef, slot, mode, isProtected } = options;
396
+ const { header, returnType } = vfuncSlotSignature(context, slot, mode === "requirement");
397
+ const declaration = `${isProtected ? "protected " : ""}${header}`;
398
+ const doc = renderJsDoc(slotDoc(slot), vfuncMemberNote(options), slotDocSpec(slot));
399
+
400
+ if (mode !== "implementation") {
401
+ return `${doc}${declaration};`;
126
402
  }
127
403
 
128
- if (isUnsupportedOutParam(context, param)) {
404
+ const [, ...parameters] = slot.callback.parameters;
405
+
406
+ const inputs = handlerParameters(parameters).map((parameter, index) =>
407
+ parameterIdentifier(parameter, index));
408
+
409
+ const call = `callVfunc(${ownerRef}, ${sourceStringLiteral(slot.key)}, this, [${inputs.join(", ")}])`;
410
+ const body = returnType === "void" ? `${call};` : `return ${call} as ${returnType};`;
411
+
412
+ return `${doc}${renderBlock(declaration, body)}`;
413
+ };
414
+
415
+ const isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {
416
+ if (param.isVarargs) {
129
417
  return false;
130
418
  }
131
419
 
@@ -146,8 +434,8 @@ const isVtableSlotEligible = (context: ModuleContext, callback: GirCallback): bo
146
434
  return !isInlineCallbackRef(context.library, callback.returnValue.type);
147
435
  };
148
436
 
149
- const renderVtableSlotDescriptor = (context: ModuleContext, options: RenderVtableSlotDescriptorOptions): string => {
150
- const { key, structName, kind, field, callback, byteOffset, vtableSize } = options;
437
+ const renderVtableSlotDescriptor = (context: ModuleContext, vtable: Vtable, slot: VtableSlot): string => {
438
+ const { key, field, callback, byteOffset } = slot;
151
439
 
152
440
  const argDescriptors = callback.parameters
153
441
  .map((param) => renderParamDescriptor(context, param, param.type))
@@ -160,16 +448,29 @@ const renderVtableSlotDescriptor = (context: ModuleContext, options: RenderVtabl
160
448
  );
161
449
 
162
450
  const lines = [
163
- `kind: ${sourceStringLiteral(kind)} as const,`,
164
- `className: ${sourceStringLiteral(structName)},`,
451
+ `className: ${sourceStringLiteral(vtable.structName)},`,
165
452
  `vfuncName: ${sourceStringLiteral(field.name)},`,
166
453
  `byteOffset: ${String(byteOffset)},`,
167
- `vtableSize: ${String(vtableSize)},`,
168
- `argDescriptors: [${argDescriptors}],`,
169
- `returnDescriptor: ${returnDescriptor},`,
170
454
  ];
171
455
 
456
+ if (vtable.kind === "interface") {
457
+ lines.push(`vtableSize: ${String(vtable.vtableSize)},`);
458
+ }
459
+
460
+ lines.push(`argDescriptors: [${argDescriptors}],`, `returnDescriptor: ${returnDescriptor},`);
461
+
462
+ if (callback.throws) {
463
+ lines.push("canThrow: true,");
464
+ }
465
+
172
466
  return `${key}: ${renderBraced(lines.join("\n"))},`;
173
467
  };
174
468
 
175
- export { renderVfuncMetadata };
469
+ export {
470
+ hasCallableVfuncSlots,
471
+ renderVfuncMembers,
472
+ renderVfuncMetadata,
473
+ vfuncEntries,
474
+ vfuncMemberNames,
475
+ type VfuncMemberMode,
476
+ };
@@ -3,7 +3,7 @@ import type { Library } from "../../gir/library.js";
3
3
  import type { GirNamespace } from "../../gir/namespace.js";
4
4
  import type { ImportsBuilder } from "../../writer/imports.js";
5
5
  import type { LazyElementSpec } from "./element-prop-types.js";
6
- import { renderJsDoc } from "../../writer/doc.js";
6
+ import { getDoc } from "../gi/doc-spec.js";
7
7
  import { ancestorGlibNames, type GlibNamedClass } from "./intrinsic-elements.js";
8
8
 
9
9
  type ElementComponent = { module: string; export: string };
@@ -91,10 +91,11 @@ const collectLazyElementExports = (collector: ExportCollector, lazyElements: Laz
91
91
  };
92
92
 
93
93
  const renderLazyElementExport = (spec: LazyElementSpec): string => {
94
+ const doc = getDoc(spec);
94
95
  const factory = `createElementComponent(${sourceStringLiteral(spec.element)})`;
95
- const component = `export const ${spec.element}: (props: ${spec.typeName}) => ReactNode = ${factory};`;
96
+ const component = `${doc}export const ${spec.element}: (props: ${spec.typeName}) => ReactNode = ${factory};`;
96
97
 
97
- return `${spec.typeSource}\n\n${component}`;
98
+ return `${doc}${spec.typeSource}\n\n${component}`;
98
99
  };
99
100
 
100
101
  const renderCandidateExport = (
@@ -113,7 +114,9 @@ const renderCandidateExport = (
113
114
  imports.addNamed(component.module, component.export, false);
114
115
  }
115
116
 
116
- return `${renderJsDoc(klass.doc)}${renderElementComponentExport(glibName, component)}`;
117
+ const doc = getDoc(klass);
118
+
119
+ return `${doc}${renderElementComponentExport(glibName, component)}`;
117
120
  };
118
121
 
119
122
  const resolveElementComponent = (
@@ -143,4 +146,4 @@ const renderElementComponentExport = (glibName: string, component: ElementCompon
143
146
  return `export const ${glibName}: ${annotation} = ${component.export}(${factoryCall});`;
144
147
  };
145
148
 
146
- export { generateElementComponentsSection, type ElementComponent, type ElementComponentOverrides };
149
+ export { generateElementComponentsSection, type ElementComponentOverrides };
@@ -2,9 +2,7 @@ type ElementPropTypeRef = { type: string; module: string; export: string };
2
2
 
3
3
  /** Base props interface each element extends, keyed by GLib type name (the module exports it). */
4
4
  type ElementProps = Record<string, {
5
- /** Specifier the props interface is imported from. */
6
5
  module: string;
7
- /** Identifier the module exports it under. */
8
6
  export: string;
9
7
  }>;
10
8
 
@@ -24,4 +22,4 @@ const elementPropTypeFor = (glibName: string): ElementPropTypeRef | undefined =>
24
22
  return ref === undefined ? undefined : { type: glibName, module: ref.module, export: ref.export };
25
23
  };
26
24
 
27
- export { setElementProps, elementPropTypeFor, type ElementPropTypeRef, type ElementProps };
25
+ export { setElementProps, elementPropTypeFor, type ElementProps };
@@ -1,4 +1,5 @@
1
1
  import { toCamelIdentifier } from "@gtkx/utils";
2
+ import type { GirAnnotations } from "../../gir/annotations.js";
2
3
  import type { GirClass } from "../../gir/class.js";
3
4
  import { getChain, type GirIndex, type GirTypeEntry } from "./gir-index.js";
4
5
  import { getGlibName } from "./intrinsic-elements.js";
@@ -7,6 +8,8 @@ type LazyElementSpec = {
7
8
  element: string;
8
9
  typeName: string;
9
10
  typeSource: string;
11
+ doc: string | undefined;
12
+ annotations: GirAnnotations;
10
13
  };
11
14
 
12
15
  const appendConstructOnlyNames = (klass: GirClass, names: string[]): void => {
@@ -34,7 +37,13 @@ const createLazyElementSpec = (context: GirIndex, element: string, entry: GirTyp
34
37
  const omitUnion = omitted.map((name) => JSON.stringify(name)).join(" | ");
35
38
  const base = omitted.length === 0 ? `${baseName}Props` : `Omit<${baseName}Props, ${omitUnion}>`;
36
39
 
37
- return { element, typeName, typeSource: `export type ${typeName} = ${base} & { children?: ReactNode };` };
40
+ return {
41
+ element,
42
+ typeName,
43
+ typeSource: `export type ${typeName} = ${base} & { children?: ReactNode };`,
44
+ doc: entry.klass.doc,
45
+ annotations: entry.klass.annotations,
46
+ };
38
47
  };
39
48
 
40
49
  const lazyElementSpecs = (context: GirIndex, lazyElements: string[]): Map<string, LazyElementSpec[]> => {
@@ -4,9 +4,13 @@ import type { Library } from "../../gir/library.js";
4
4
  import type { GirNamespace } from "../../gir/namespace.js";
5
5
  import { ancestorChain } from "../../gir/ancestry.js";
6
6
 
7
+ /** A GIR class paired with the GLib type name it is bound under. */
7
8
  type GlibNamedClass = {
9
+ /** GLib type name, such as `"GtkButton"`, falling back to the C type when the GIR declares none. */
8
10
  glibName: string;
11
+ /** Parsed class the name belongs to. */
9
12
  klass: GirClass;
13
+ /** Namespace declaring the class. */
10
14
  namespace: GirNamespace;
11
15
  };
12
16
 
@@ -3,8 +3,8 @@ import type { GirClass } from "../../gir/class.js";
3
3
  import type { Library } from "../../gir/library.js";
4
4
  import type { GirNamespace } from "../../gir/namespace.js";
5
5
  import type { ImportsBuilder } from "../../writer/imports.js";
6
- import { renderJsDoc } from "../../writer/doc.js";
7
6
  import { renderBlock } from "../../writer/emit.js";
7
+ import { getDoc } from "../gi/doc-spec.js";
8
8
  import { elementPropTypeFor } from "./element-prop-imports.js";
9
9
  import {
10
10
  collectInterfacePropsClasses,
@@ -97,7 +97,9 @@ const generateJsxSection = (
97
97
  const intrinsicElementConsts = namespaceElements.filter((entry) => !excludeNames.has(entry.glibName));
98
98
 
99
99
  const constLines = intrinsicElementConsts.map(
100
- (entry) => `export const ${entry.glibName} = ${sourceStringLiteral(entry.glibName)} as const;`,
100
+ (entry) =>
101
+ `${getDoc(entry.klass)}export const ${entry.glibName} = ` +
102
+ `${sourceStringLiteral(entry.glibName)} as const;`,
101
103
  );
102
104
 
103
105
  const isIntrinsicElementAncestor = (candidate: GirClass): boolean => {
@@ -135,7 +137,7 @@ const generateJsxSection = (
135
137
  }
136
138
 
137
139
  const source = [
138
- constLines.join("\n"),
140
+ constLines.join("\n\n"),
139
141
  "",
140
142
  propBlocks.join("\n\n"),
141
143
  "",
@@ -285,7 +287,7 @@ const renderInterfacePropsBlock = (
285
287
  addGiNamespace(imports, iface.namespace.name, giNamespaceAlias(iface.namespace.name));
286
288
  const selfDefault = `${giNamespaceAlias(iface.namespace.name)}.${iface.klass.name}`;
287
289
  const signature = `export interface ${glib}Props<Self = ${selfDefault}>${extendsClause}`;
288
- const block = `${renderJsDoc(iface.klass.doc)}${renderBlock(signature, ownerLines.join("\n"))}`;
290
+ const block = `${getDoc(iface.klass)}${renderBlock(signature, ownerLines.join("\n"))}`;
289
291
 
290
292
  return { block, objectPropNames };
291
293
  };
@@ -293,7 +295,7 @@ const renderInterfacePropsBlock = (
293
295
  const renderJsxAugmentation = (namespaceElements: GlibNamedClass[]): string => {
294
296
  const elementLines = namespaceElements
295
297
  .filter((entry) => !entry.klass.isAbstract)
296
- .map((entry) => `${entry.glibName}: ${entry.glibName}Props;`)
298
+ .map((entry) => `${getDoc(entry.klass)}${entry.glibName}: ${entry.glibName}Props;`)
297
299
  .join("\n");
298
300
 
299
301
  const intrinsicInterface = renderBlock("interface IntrinsicElements", elementLines);
@@ -324,7 +326,7 @@ const renderPropBlock = (
324
326
  const extendsClause = extendsList.length === 0 ? "" : ` extends ${extendsList.join(", ")}`;
325
327
  const selfDefault = `${giNamespaceAlias(entry.namespace.name)}.${entry.klass.name}`;
326
328
 
327
- const block = `${renderJsDoc(entry.klass.doc)}${renderBlock(
329
+ const block = `${getDoc(entry.klass)}${renderBlock(
328
330
  `export interface ${entry.glibName}Props<Self = ${selfDefault}>${extendsClause}`,
329
331
  ownerLines.join("\n"),
330
332
  )}`;
@@ -362,9 +362,9 @@ const primitiveDefaultLiteral = (category: PrimitiveCategory, raw: string): stri
362
362
  };
363
363
 
364
364
  const bigintDefaultLiteral = (raw: string): string | undefined => {
365
- const trimmed = raw.trim();
365
+ const integer = integerDefaultLiteral(raw);
366
366
 
367
- return INTEGER_PATTERN.test(trimmed) ? `${trimmed}n` : undefined;
367
+ return integer === undefined ? undefined : `${integer}n`;
368
368
  };
369
369
 
370
370
  const enumDefaultLiteral = (enumType: GirEnum, raw: string): string | undefined => {
@@ -147,4 +147,4 @@ const generateJsxNamespace = (
147
147
  return { source: `${body.join("\n")}\n`, count };
148
148
  };
149
149
 
150
- export { generateJsxFiles, type JsxNamespaceFile, type JsxGenerationOptions };
150
+ export { generateJsxFiles, type JsxNamespaceFile };