@gtkx/codegen 1.0.0-rc.3 → 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 (486) hide show
  1. package/README.md +8 -9
  2. package/dist/analysis/descriptor-render.d.ts +9 -4
  3. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  4. package/dist/analysis/descriptor-render.js +51 -61
  5. package/dist/analysis/descriptor-render.js.map +1 -1
  6. package/dist/analysis/descriptor.d.ts +7 -7
  7. package/dist/analysis/descriptor.d.ts.map +1 -1
  8. package/dist/analysis/descriptor.js +7 -7
  9. package/dist/analysis/descriptor.js.map +1 -1
  10. package/dist/analysis/inheritance.d.ts +1 -2
  11. package/dist/analysis/inheritance.d.ts.map +1 -1
  12. package/dist/analysis/inheritance.js +25 -22
  13. package/dist/analysis/inheritance.js.map +1 -1
  14. package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
  15. package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
  16. package/dist/analysis/nul-terminated-bytes.js +18 -0
  17. package/dist/analysis/nul-terminated-bytes.js.map +1 -0
  18. package/dist/analysis/param-capability.d.ts +5 -0
  19. package/dist/analysis/param-capability.d.ts.map +1 -0
  20. package/dist/analysis/param-capability.js +130 -0
  21. package/dist/analysis/param-capability.js.map +1 -0
  22. package/dist/analysis/param-structure.d.ts +13 -6
  23. package/dist/analysis/param-structure.d.ts.map +1 -1
  24. package/dist/analysis/param-structure.js +44 -20
  25. package/dist/analysis/param-structure.js.map +1 -1
  26. package/dist/analysis/ts-type.d.ts +1 -1
  27. package/dist/analysis/ts-type.d.ts.map +1 -1
  28. package/dist/analysis/ts-type.js +3 -5
  29. package/dist/analysis/ts-type.js.map +1 -1
  30. package/dist/analysis/type-shape.d.ts +8 -0
  31. package/dist/analysis/type-shape.d.ts.map +1 -0
  32. package/dist/analysis/type-shape.js +12 -0
  33. package/dist/analysis/type-shape.js.map +1 -0
  34. package/dist/compile.d.ts +1 -1
  35. package/dist/compile.d.ts.map +1 -1
  36. package/dist/compile.js +2 -1
  37. package/dist/compile.js.map +1 -1
  38. package/dist/docs/api-reference.d.ts +79 -3
  39. package/dist/docs/api-reference.d.ts.map +1 -1
  40. package/dist/docs/api-reference.js +68 -13
  41. package/dist/docs/api-reference.js.map +1 -1
  42. package/dist/docs/element-page.d.ts +4 -4
  43. package/dist/docs/element-page.d.ts.map +1 -1
  44. package/dist/docs/element-page.js +32 -20
  45. package/dist/docs/element-page.js.map +1 -1
  46. package/dist/docs/handwritten-props.d.ts +9 -0
  47. package/dist/docs/handwritten-props.d.ts.map +1 -0
  48. package/dist/docs/handwritten-props.js +149 -0
  49. package/dist/docs/handwritten-props.js.map +1 -0
  50. package/dist/docs/pipeline.d.ts +4 -4
  51. package/dist/docs/pipeline.d.ts.map +1 -1
  52. package/dist/docs/pipeline.js +6 -6
  53. package/dist/docs/pipeline.js.map +1 -1
  54. package/dist/docs/render.d.ts +25 -5
  55. package/dist/docs/render.d.ts.map +1 -1
  56. package/dist/docs/render.js +90 -28
  57. package/dist/docs/render.js.map +1 -1
  58. package/dist/docs/symbol-page.d.ts +22 -0
  59. package/dist/docs/symbol-page.d.ts.map +1 -1
  60. package/dist/docs/symbol-page.js +129 -44
  61. package/dist/docs/symbol-page.js.map +1 -1
  62. package/dist/fingerprint.d.ts +3 -6
  63. package/dist/fingerprint.d.ts.map +1 -1
  64. package/dist/fingerprint.js +6 -8
  65. package/dist/fingerprint.js.map +1 -1
  66. package/dist/gi.d.ts +3 -11
  67. package/dist/gi.d.ts.map +1 -1
  68. package/dist/gi.js +0 -7
  69. package/dist/gi.js.map +1 -1
  70. package/dist/gir/ancestry.d.ts +2 -2
  71. package/dist/gir/ancestry.d.ts.map +1 -1
  72. package/dist/gir/ancestry.js +11 -1
  73. package/dist/gir/ancestry.js.map +1 -1
  74. package/dist/gir/annotations.d.ts +22 -0
  75. package/dist/gir/annotations.d.ts.map +1 -0
  76. package/dist/gir/annotations.js +15 -0
  77. package/dist/gir/annotations.js.map +1 -0
  78. package/dist/gir/callback.d.ts +1 -0
  79. package/dist/gir/callback.d.ts.map +1 -1
  80. package/dist/gir/callback.js +1 -0
  81. package/dist/gir/callback.js.map +1 -1
  82. package/dist/gir/class.d.ts +32 -1
  83. package/dist/gir/class.d.ts.map +1 -1
  84. package/dist/gir/class.js +8 -3
  85. package/dist/gir/class.js.map +1 -1
  86. package/dist/gir/enum.d.ts +21 -1
  87. package/dist/gir/enum.d.ts.map +1 -1
  88. package/dist/gir/enum.js +9 -9
  89. package/dist/gir/enum.js.map +1 -1
  90. package/dist/gir/field.d.ts +19 -4
  91. package/dist/gir/field.d.ts.map +1 -1
  92. package/dist/gir/field.js +7 -11
  93. package/dist/gir/field.js.map +1 -1
  94. package/dist/gir/function.d.ts +15 -0
  95. package/dist/gir/function.d.ts.map +1 -1
  96. package/dist/gir/function.js.map +1 -1
  97. package/dist/gir/gir-path.d.ts +7 -0
  98. package/dist/gir/gir-path.d.ts.map +1 -1
  99. package/dist/gir/gir-path.js +7 -0
  100. package/dist/gir/gir-path.js.map +1 -1
  101. package/dist/gir/libraries.d.ts +13 -2
  102. package/dist/gir/libraries.d.ts.map +1 -1
  103. package/dist/gir/libraries.js +11 -0
  104. package/dist/gir/libraries.js.map +1 -1
  105. package/dist/gir/library.d.ts +36 -0
  106. package/dist/gir/library.d.ts.map +1 -1
  107. package/dist/gir/library.js +34 -0
  108. package/dist/gir/library.js.map +1 -1
  109. package/dist/gir/namespace.d.ts +38 -0
  110. package/dist/gir/namespace.d.ts.map +1 -1
  111. package/dist/gir/namespace.js +4 -5
  112. package/dist/gir/namespace.js.map +1 -1
  113. package/dist/gir/parameter.d.ts +39 -0
  114. package/dist/gir/parameter.d.ts.map +1 -1
  115. package/dist/gir/parameter.js +7 -7
  116. package/dist/gir/parameter.js.map +1 -1
  117. package/dist/gir/parse.d.ts +3 -1
  118. package/dist/gir/parse.d.ts.map +1 -1
  119. package/dist/gir/parse.js +6 -3
  120. package/dist/gir/parse.js.map +1 -1
  121. package/dist/gir/primitives.d.ts +1 -0
  122. package/dist/gir/primitives.d.ts.map +1 -1
  123. package/dist/gir/primitives.js.map +1 -1
  124. package/dist/gir/property.d.ts +16 -0
  125. package/dist/gir/property.d.ts.map +1 -1
  126. package/dist/gir/property.js +3 -3
  127. package/dist/gir/property.js.map +1 -1
  128. package/dist/gir/record.d.ts +22 -0
  129. package/dist/gir/record.d.ts.map +1 -1
  130. package/dist/gir/record.js +3 -2
  131. package/dist/gir/record.js.map +1 -1
  132. package/dist/gir/size.d.ts +5 -4
  133. package/dist/gir/size.d.ts.map +1 -1
  134. package/dist/gir/size.js +0 -3
  135. package/dist/gir/size.js.map +1 -1
  136. package/dist/gir/type-id.d.ts +36 -1
  137. package/dist/gir/type-id.d.ts.map +1 -1
  138. package/dist/gir/type-id.js +2 -3
  139. package/dist/gir/type-id.js.map +1 -1
  140. package/dist/gir/type-ref.d.ts.map +1 -1
  141. package/dist/gir/type-ref.js +2 -1
  142. package/dist/gir/type-ref.js.map +1 -1
  143. package/dist/gir/type.d.ts +20 -0
  144. package/dist/gir/type.d.ts.map +1 -1
  145. package/dist/gir/type.js.map +1 -1
  146. package/dist/index.d.ts +18 -6
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +12 -3
  149. package/dist/index.js.map +1 -1
  150. package/dist/internal.d.ts +3 -0
  151. package/dist/internal.d.ts.map +1 -0
  152. package/dist/internal.js +3 -0
  153. package/dist/internal.js.map +1 -0
  154. package/dist/jsx.d.ts +7 -12
  155. package/dist/jsx.d.ts.map +1 -1
  156. package/dist/jsx.js +18 -19
  157. package/dist/jsx.js.map +1 -1
  158. package/dist/khronos/args.d.ts +7 -6
  159. package/dist/khronos/args.d.ts.map +1 -1
  160. package/dist/khronos/args.js +29 -7
  161. package/dist/khronos/args.js.map +1 -1
  162. package/dist/khronos/doc-context.d.ts +29 -0
  163. package/dist/khronos/doc-context.d.ts.map +1 -0
  164. package/dist/khronos/doc-context.js +29 -0
  165. package/dist/khronos/doc-context.js.map +1 -0
  166. package/dist/khronos/extensions.d.ts +13 -0
  167. package/dist/khronos/extensions.d.ts.map +1 -0
  168. package/dist/khronos/extensions.js +49 -0
  169. package/dist/khronos/extensions.js.map +1 -0
  170. package/dist/khronos/jsdoc.d.ts +17 -11
  171. package/dist/khronos/jsdoc.d.ts.map +1 -1
  172. package/dist/khronos/jsdoc.js +104 -46
  173. package/dist/khronos/jsdoc.js.map +1 -1
  174. package/dist/khronos/model.d.ts +42 -3
  175. package/dist/khronos/model.d.ts.map +1 -1
  176. package/dist/khronos/model.js +218 -63
  177. package/dist/khronos/model.js.map +1 -1
  178. package/dist/khronos/modules.d.ts +9 -6
  179. package/dist/khronos/modules.d.ts.map +1 -1
  180. package/dist/khronos/modules.js +96 -26
  181. package/dist/khronos/modules.js.map +1 -1
  182. package/dist/khronos/notes.d.ts +19 -0
  183. package/dist/khronos/notes.d.ts.map +1 -0
  184. package/dist/khronos/notes.js +35 -0
  185. package/dist/khronos/notes.js.map +1 -0
  186. package/dist/khronos/param-pair.d.ts +1 -1
  187. package/dist/khronos/param-pair.d.ts.map +1 -1
  188. package/dist/khronos/param-pair.js.map +1 -1
  189. package/dist/khronos/pipeline.d.ts +3 -1
  190. package/dist/khronos/pipeline.d.ts.map +1 -1
  191. package/dist/khronos/pipeline.js +59 -28
  192. package/dist/khronos/pipeline.js.map +1 -1
  193. package/dist/khronos/plan.d.ts +5 -5
  194. package/dist/khronos/plan.d.ts.map +1 -1
  195. package/dist/khronos/plan.js +8 -8
  196. package/dist/khronos/plan.js.map +1 -1
  197. package/dist/khronos/render.d.ts +8 -6
  198. package/dist/khronos/render.d.ts.map +1 -1
  199. package/dist/khronos/render.js +35 -26
  200. package/dist/khronos/render.js.map +1 -1
  201. package/dist/khronos/select.d.ts +21 -4
  202. package/dist/khronos/select.d.ts.map +1 -1
  203. package/dist/khronos/select.js +47 -34
  204. package/dist/khronos/select.js.map +1 -1
  205. package/dist/react/element-config.d.ts +16 -10
  206. package/dist/react/element-config.d.ts.map +1 -1
  207. package/dist/react/element-config.js +22 -15
  208. package/dist/react/element-config.js.map +1 -1
  209. package/dist/runner.d.ts +33 -21
  210. package/dist/runner.d.ts.map +1 -1
  211. package/dist/runner.js +19 -20
  212. package/dist/runner.js.map +1 -1
  213. package/dist/store/compile-store.d.ts +2 -3
  214. package/dist/store/compile-store.d.ts.map +1 -1
  215. package/dist/store/compile-store.js +2 -2
  216. package/dist/store/compile-store.js.map +1 -1
  217. package/dist/store/gi/callable-doc.d.ts +11 -0
  218. package/dist/store/gi/callable-doc.d.ts.map +1 -0
  219. package/dist/store/gi/callable-doc.js +62 -0
  220. package/dist/store/gi/callable-doc.js.map +1 -0
  221. package/dist/store/gi/callables.d.ts +3 -1
  222. package/dist/store/gi/callables.d.ts.map +1 -1
  223. package/dist/store/gi/callables.js +16 -16
  224. package/dist/store/gi/callables.js.map +1 -1
  225. package/dist/store/gi/callback.d.ts.map +1 -1
  226. package/dist/store/gi/callback.js +2 -2
  227. package/dist/store/gi/callback.js.map +1 -1
  228. package/dist/store/gi/class.d.ts.map +1 -1
  229. package/dist/store/gi/class.js +5 -3
  230. package/dist/store/gi/class.js.map +1 -1
  231. package/dist/store/gi/closure-invocation.d.ts +4 -0
  232. package/dist/store/gi/closure-invocation.d.ts.map +1 -0
  233. package/dist/store/gi/closure-invocation.js +22 -0
  234. package/dist/store/gi/closure-invocation.js.map +1 -0
  235. package/dist/store/gi/constant.d.ts.map +1 -1
  236. package/dist/store/gi/constant.js +3 -4
  237. package/dist/store/gi/constant.js.map +1 -1
  238. package/dist/store/gi/constructor-props.d.ts.map +1 -1
  239. package/dist/store/gi/constructor-props.js +18 -20
  240. package/dist/store/gi/constructor-props.js.map +1 -1
  241. package/dist/store/gi/doc-spec.d.ts +14 -0
  242. package/dist/store/gi/doc-spec.d.ts.map +1 -0
  243. package/dist/store/gi/doc-spec.js +23 -0
  244. package/dist/store/gi/doc-spec.js.map +1 -0
  245. package/dist/store/gi/enum.d.ts.map +1 -1
  246. package/dist/store/gi/enum.js +29 -16
  247. package/dist/store/gi/enum.js.map +1 -1
  248. package/dist/store/gi/function.d.ts.map +1 -1
  249. package/dist/store/gi/function.js +28 -17
  250. package/dist/store/gi/function.js.map +1 -1
  251. package/dist/store/gi/interface.d.ts.map +1 -1
  252. package/dist/store/gi/interface.js +130 -16
  253. package/dist/store/gi/interface.js.map +1 -1
  254. package/dist/store/gi/item-comparators.d.ts.map +1 -1
  255. package/dist/store/gi/item-comparators.js +3 -5
  256. package/dist/store/gi/item-comparators.js.map +1 -1
  257. package/dist/store/gi/method.d.ts +9 -1
  258. package/dist/store/gi/method.d.ts.map +1 -1
  259. package/dist/store/gi/method.js +92 -47
  260. package/dist/store/gi/method.js.map +1 -1
  261. package/dist/store/gi/param-marshal.d.ts +4 -1
  262. package/dist/store/gi/param-marshal.d.ts.map +1 -1
  263. package/dist/store/gi/param-marshal.js +5 -1
  264. package/dist/store/gi/param-marshal.js.map +1 -1
  265. package/dist/store/gi/pipeline.d.ts.map +1 -1
  266. package/dist/store/gi/pipeline.js +3 -2
  267. package/dist/store/gi/pipeline.js.map +1 -1
  268. package/dist/store/gi/properties.d.ts.map +1 -1
  269. package/dist/store/gi/properties.js +2 -2
  270. package/dist/store/gi/properties.js.map +1 -1
  271. package/dist/store/gi/property-accessor.d.ts +4 -2
  272. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  273. package/dist/store/gi/property-accessor.js +10 -11
  274. package/dist/store/gi/property-accessor.js.map +1 -1
  275. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  276. package/dist/store/gi/record-constructor.js +3 -1
  277. package/dist/store/gi/record-constructor.js.map +1 -1
  278. package/dist/store/gi/record-field-accessor.d.ts +4 -2
  279. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  280. package/dist/store/gi/record-field-accessor.js +6 -11
  281. package/dist/store/gi/record-field-accessor.js.map +1 -1
  282. package/dist/store/gi/record-layout.d.ts.map +1 -1
  283. package/dist/store/gi/record-layout.js +1 -5
  284. package/dist/store/gi/record-layout.js.map +1 -1
  285. package/dist/store/gi/record.d.ts.map +1 -1
  286. package/dist/store/gi/record.js +3 -2
  287. package/dist/store/gi/record.js.map +1 -1
  288. package/dist/store/gi/registration.d.ts +1 -1
  289. package/dist/store/gi/registration.js +2 -2
  290. package/dist/store/gi/registration.js.map +1 -1
  291. package/dist/store/gi/return-wrap.d.ts +1 -1
  292. package/dist/store/gi/return-wrap.d.ts.map +1 -1
  293. package/dist/store/gi/return-wrap.js +4 -4
  294. package/dist/store/gi/return-wrap.js.map +1 -1
  295. package/dist/store/gi/runtime-override.d.ts +2 -1
  296. package/dist/store/gi/runtime-override.d.ts.map +1 -1
  297. package/dist/store/gi/runtime-override.js +8 -5
  298. package/dist/store/gi/runtime-override.js.map +1 -1
  299. package/dist/store/gi/signal.d.ts.map +1 -1
  300. package/dist/store/gi/signal.js +27 -31
  301. package/dist/store/gi/signal.js.map +1 -1
  302. package/dist/store/gi/value-marshalable.d.ts +1 -10
  303. package/dist/store/gi/value-marshalable.d.ts.map +1 -1
  304. package/dist/store/gi/value-marshalable.js +1 -10
  305. package/dist/store/gi/value-marshalable.js.map +1 -1
  306. package/dist/store/gi/vtable.d.ts +16 -1
  307. package/dist/store/gi/vtable.d.ts.map +1 -1
  308. package/dist/store/gi/vtable.js +214 -51
  309. package/dist/store/gi/vtable.js.map +1 -1
  310. package/dist/store/gi-store.d.ts +2 -3
  311. package/dist/store/gi-store.d.ts.map +1 -1
  312. package/dist/store/gi-store.js.map +1 -1
  313. package/dist/store/jsx/element-components.d.ts +1 -3
  314. package/dist/store/jsx/element-components.d.ts.map +1 -1
  315. package/dist/store/jsx/element-components.js +6 -8
  316. package/dist/store/jsx/element-components.js.map +1 -1
  317. package/dist/store/jsx/element-prop-imports.d.ts +1 -4
  318. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
  319. package/dist/store/jsx/element-prop-imports.js +0 -2
  320. package/dist/store/jsx/element-prop-imports.js.map +1 -1
  321. package/dist/store/jsx/element-prop-types.d.ts +3 -1
  322. package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
  323. package/dist/store/jsx/element-prop-types.js +7 -2
  324. package/dist/store/jsx/element-prop-types.js.map +1 -1
  325. package/dist/store/jsx/generated-elements.d.ts +29 -0
  326. package/dist/store/jsx/generated-elements.d.ts.map +1 -0
  327. package/dist/store/jsx/generated-elements.js +30 -0
  328. package/dist/store/jsx/generated-elements.js.map +1 -0
  329. package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
  330. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
  331. package/dist/store/jsx/intrinsic-elements.js.map +1 -1
  332. package/dist/store/jsx/jsx.d.ts.map +1 -1
  333. package/dist/store/jsx/jsx.js +13 -12
  334. package/dist/store/jsx/jsx.js.map +1 -1
  335. package/dist/store/jsx/metadata.js +9 -9
  336. package/dist/store/jsx/metadata.js.map +1 -1
  337. package/dist/store/jsx/omitted-props.d.ts +2 -4
  338. package/dist/store/jsx/omitted-props.d.ts.map +1 -1
  339. package/dist/store/jsx/omitted-props.js +2 -4
  340. package/dist/store/jsx/omitted-props.js.map +1 -1
  341. package/dist/store/jsx/pipeline.d.ts +4 -2
  342. package/dist/store/jsx/pipeline.d.ts.map +1 -1
  343. package/dist/store/jsx/pipeline.js +3 -2
  344. package/dist/store/jsx/pipeline.js.map +1 -1
  345. package/dist/store/jsx/props.d.ts +1 -7
  346. package/dist/store/jsx/props.d.ts.map +1 -1
  347. package/dist/store/jsx/props.js +16 -8
  348. package/dist/store/jsx/props.js.map +1 -1
  349. package/dist/store/jsx-store.d.ts +2 -3
  350. package/dist/store/jsx-store.d.ts.map +1 -1
  351. package/dist/store/jsx-store.js +3 -3
  352. package/dist/store/jsx-store.js.map +1 -1
  353. package/dist/store/resolve-store.d.ts +28 -0
  354. package/dist/store/resolve-store.d.ts.map +1 -0
  355. package/dist/store/resolve-store.js +65 -0
  356. package/dist/store/resolve-store.js.map +1 -0
  357. package/dist/store/store-fs.d.ts +5 -1
  358. package/dist/store/store-fs.d.ts.map +1 -1
  359. package/dist/store/store-fs.js +6 -4
  360. package/dist/store/store-fs.js.map +1 -1
  361. package/dist/writer/context.d.ts +2 -1
  362. package/dist/writer/context.d.ts.map +1 -1
  363. package/dist/writer/context.js +3 -0
  364. package/dist/writer/context.js.map +1 -1
  365. package/dist/writer/doc-tags.d.ts +21 -0
  366. package/dist/writer/doc-tags.d.ts.map +1 -0
  367. package/dist/writer/doc-tags.js +38 -0
  368. package/dist/writer/doc-tags.js.map +1 -0
  369. package/dist/writer/doc.d.ts +3 -1
  370. package/dist/writer/doc.d.ts.map +1 -1
  371. package/dist/writer/doc.js +19 -6
  372. package/dist/writer/doc.js.map +1 -1
  373. package/dist/writer/gtk-doc.d.ts +1 -1
  374. package/dist/writer/gtk-doc.d.ts.map +1 -1
  375. package/dist/writer/gtk-doc.js +64 -15
  376. package/dist/writer/gtk-doc.js.map +1 -1
  377. package/dist/writer/module.d.ts +8 -2
  378. package/dist/writer/module.d.ts.map +1 -1
  379. package/dist/writer/module.js +13 -1
  380. package/dist/writer/module.js.map +1 -1
  381. package/overrides/gdk/rgba.ts.ejs +26 -0
  382. package/overrides/gobject/object.ts.ejs +56 -11
  383. package/overrides/gobject/value.ts.ejs +7 -0
  384. package/overrides/graphene/structs.ts.ejs +55 -0
  385. package/package.json +7 -11
  386. package/src/analysis/descriptor-render.ts +67 -73
  387. package/src/analysis/descriptor.ts +13 -16
  388. package/src/analysis/inheritance.ts +35 -34
  389. package/src/analysis/nul-terminated-bytes.ts +31 -0
  390. package/src/analysis/param-capability.ts +172 -0
  391. package/src/analysis/param-structure.ts +90 -32
  392. package/src/analysis/ts-type.ts +4 -6
  393. package/src/analysis/type-shape.ts +24 -0
  394. package/src/compile.ts +3 -2
  395. package/src/docs/api-reference.ts +162 -28
  396. package/src/docs/element-page.ts +53 -47
  397. package/src/docs/handwritten-props.ts +230 -0
  398. package/src/docs/pipeline.ts +10 -10
  399. package/src/docs/render.ts +153 -39
  400. package/src/docs/symbol-page.ts +230 -80
  401. package/src/fingerprint.ts +8 -14
  402. package/src/gi.ts +4 -11
  403. package/src/gir/ancestry.ts +15 -1
  404. package/src/gir/annotations.ts +37 -0
  405. package/src/gir/callback.ts +2 -0
  406. package/src/gir/class.ts +42 -4
  407. package/src/gir/enum.ts +30 -10
  408. package/src/gir/field.ts +24 -13
  409. package/src/gir/function.ts +15 -0
  410. package/src/gir/gir-path.ts +7 -0
  411. package/src/gir/libraries.ts +23 -2
  412. package/src/gir/library.ts +51 -2
  413. package/src/gir/namespace.ts +41 -5
  414. package/src/gir/parameter.ts +47 -7
  415. package/src/gir/parse.ts +8 -2
  416. package/src/gir/primitives.ts +1 -0
  417. package/src/gir/property.ts +18 -3
  418. package/src/gir/record.ts +24 -2
  419. package/src/gir/size.ts +8 -6
  420. package/src/gir/type-id.ts +51 -7
  421. package/src/gir/type-ref.ts +2 -1
  422. package/src/gir/type.ts +50 -6
  423. package/src/index.ts +18 -16
  424. package/src/internal.ts +2 -0
  425. package/src/jsx.ts +26 -26
  426. package/src/khronos/args.ts +37 -14
  427. package/src/khronos/doc-context.ts +62 -0
  428. package/src/khronos/extensions.ts +85 -0
  429. package/src/khronos/jsdoc.ts +152 -56
  430. package/src/khronos/model.ts +314 -69
  431. package/src/khronos/modules.ts +134 -40
  432. package/src/khronos/notes.ts +74 -0
  433. package/src/khronos/param-pair.ts +1 -1
  434. package/src/khronos/pipeline.ts +95 -42
  435. package/src/khronos/plan.ts +12 -13
  436. package/src/khronos/render.ts +62 -50
  437. package/src/khronos/select.ts +91 -50
  438. package/src/react/element-config.ts +21 -18
  439. package/src/runner.ts +51 -40
  440. package/src/store/compile-store.ts +4 -5
  441. package/src/store/gi/callable-doc.ts +102 -0
  442. package/src/store/gi/callables.ts +23 -17
  443. package/src/store/gi/callback.ts +3 -2
  444. package/src/store/gi/class.ts +6 -3
  445. package/src/store/gi/closure-invocation.ts +26 -0
  446. package/src/store/gi/constant.ts +3 -6
  447. package/src/store/gi/constructor-props.ts +19 -23
  448. package/src/store/gi/doc-spec.ts +38 -0
  449. package/src/store/gi/enum.ts +55 -20
  450. package/src/store/gi/function.ts +44 -26
  451. package/src/store/gi/interface.ts +214 -26
  452. package/src/store/gi/item-comparators.ts +3 -5
  453. package/src/store/gi/method.ts +126 -68
  454. package/src/store/gi/param-marshal.ts +15 -1
  455. package/src/store/gi/pipeline.ts +7 -2
  456. package/src/store/gi/properties.ts +3 -2
  457. package/src/store/gi/property-accessor.ts +14 -11
  458. package/src/store/gi/record-constructor.ts +6 -1
  459. package/src/store/gi/record-field-accessor.ts +9 -13
  460. package/src/store/gi/record-layout.ts +1 -5
  461. package/src/store/gi/record.ts +8 -2
  462. package/src/store/gi/registration.ts +3 -3
  463. package/src/store/gi/return-wrap.ts +5 -5
  464. package/src/store/gi/runtime-override.ts +13 -6
  465. package/src/store/gi/signal.ts +36 -37
  466. package/src/store/gi/value-marshalable.ts +1 -10
  467. package/src/store/gi/vtable.ts +361 -60
  468. package/src/store/gi-store.ts +2 -4
  469. package/src/store/jsx/element-components.ts +8 -11
  470. package/src/store/jsx/element-prop-imports.ts +6 -5
  471. package/src/store/jsx/element-prop-types.ts +10 -2
  472. package/src/store/jsx/generated-elements.ts +60 -0
  473. package/src/store/jsx/intrinsic-elements.ts +4 -0
  474. package/src/store/jsx/jsx.ts +15 -13
  475. package/src/store/jsx/metadata.ts +10 -10
  476. package/src/store/jsx/omitted-props.ts +2 -4
  477. package/src/store/jsx/pipeline.ts +6 -4
  478. package/src/store/jsx/props.ts +22 -9
  479. package/src/store/jsx-store.ts +5 -7
  480. package/src/store/resolve-store.ts +100 -0
  481. package/src/store/store-fs.ts +12 -5
  482. package/src/writer/context.ts +5 -1
  483. package/src/writer/doc-tags.ts +70 -0
  484. package/src/writer/doc.ts +29 -6
  485. package/src/writer/gtk-doc.ts +82 -15
  486. package/src/writer/module.ts +25 -2
@@ -1,4 +1,5 @@
1
1
  import type { ParseContext, TypeId } from "./type-id.js";
2
+ import { documentedFromNode, type GirAnnotations } from "./annotations.js";
2
3
  import {
3
4
  attr,
4
5
  getChild,
@@ -12,37 +13,75 @@ import {
12
13
  } from "./parse.js";
13
14
  import { typeRefFromNode } from "./type-ref.js";
14
15
 
16
+ /** Which way a parameter's value travels: into the call, back out of it, or both. */
15
17
  type ParameterDirection = "in" | "out" | "inout";
18
+ /** How much of a value the receiver takes ownership of: none, the whole value, or only its container. */
16
19
  type ParameterTransfer = "none" | "full" | "container";
20
+ /**
21
+ * How long a callback parameter stays valid: for the duration of the call, until its destroy notify runs,
22
+ * until the asynchronous operation invokes it, or forever.
23
+ */
17
24
  type CallbackScope = "call" | "notified" | "async" | "forever";
18
25
 
26
+ /** A parameter of a {@link GirCallable}, with the annotations that decide how it is marshalled. */
19
27
  type GirParameter = {
28
+ /** The name GIR gives the parameter. */
20
29
  name: string;
30
+ /** What the parameter holds, absent when the GIR node declares no type. */
21
31
  type: TypeId | undefined;
32
+ /** The C spelling of the parameter's type, taken from its `type` or `array` child. */
33
+ cType: string | undefined;
34
+ /** Documentation prose from GIR, emitted as the parameter's `@param` text. */
35
+ doc: string | undefined;
36
+ /** Decides whether the parameter is an argument, part of the returned tuple, or both. */
22
37
  direction: ParameterDirection;
38
+ /** Ownership the marshalling descriptor is generated with, deciding whether the receiver frees the value. */
23
39
  transferOwnership: ParameterTransfer;
40
+ /** Whether the value may be null. */
24
41
  nullable: boolean;
42
+ /** Whether the caller may leave the parameter out entirely. */
25
43
  optional: boolean;
44
+ /** Whether the caller supplies the storage an out parameter writes into. */
26
45
  callerAllocates: boolean;
46
+ /** How long a callback parameter stays valid, absent when GIR carries no scope annotation. */
27
47
  scope: CallbackScope | undefined;
48
+ /** Position of the parameter carrying the callback's user data. */
28
49
  closureIndex: number | undefined;
50
+ /** Position of the parameter carrying the callback's destroy notify. */
29
51
  destroyIndex: number | undefined;
52
+ /** Whether the parameter is the `...` varargs marker. */
30
53
  isVarargs: boolean;
31
54
  };
32
55
 
56
+ /** What a {@link GirCallable} hands back, with the annotations that decide how it is marshalled. */
33
57
  type GirReturnValue = {
58
+ /** What the callable returns, absent when the GIR node declares no type. */
34
59
  type: TypeId | undefined;
60
+ /** Documentation prose from GIR, emitted as the callable's `@returns` text. */
61
+ doc: string | undefined;
62
+ /** How much ownership the caller takes of the returned value. */
35
63
  transferOwnership: ParameterTransfer;
64
+ /** Whether the returned value may be null. */
36
65
  nullable: boolean;
66
+ /** Whether GIR marks the value as skipped, keeping it out of the generated signature. */
37
67
  skip: boolean;
38
68
  };
39
69
 
70
+ /** Anything GIR describes with parameters and a return value: functions, methods, signals, and callbacks. */
40
71
  type GirCallable = {
72
+ /** The name GIR gives the callable. */
41
73
  name: string;
74
+ /** The callable's documentation text, absent when GIR carries none. */
42
75
  doc: string | undefined;
76
+ /** Release and deprecation annotations GIR carries on the callable. */
77
+ annotations: GirAnnotations;
78
+ /** The parameters the callable takes, in declaration order. */
43
79
  parameters: GirParameter[];
80
+ /** What the callable hands back. */
44
81
  returnValue: GirReturnValue;
82
+ /** Whether the callable reports failure through a trailing `GError`. */
45
83
  throws: boolean;
84
+ /** Whether GIR exposes the callable to bindings. */
46
85
  introspectable: boolean;
47
86
  };
48
87
 
@@ -53,10 +92,6 @@ const SCOPES: Set<CallbackScope> = new Set(["call", "notified", "async", "foreve
53
92
  const transferOwnership = (node: RawNode): ParameterTransfer =>
54
93
  parseEnumAttr(attr(node, "transfer-ownership"), TRANSFERS, "none", "transfer-ownership");
55
94
 
56
- // `allow-none` is the legacy spelling of two different attributes: on an in-parameter it means the
57
- // value may be NULL (`nullable`), but on an out-parameter it means the caller may pass a NULL
58
- // location (`optional`). Folding it into `nullable` for an out-parameter would claim the returned
59
- // value can be null for the 494 out-parameters across the installed GIRs that only say `allow-none`.
60
95
  const isInDirection = (node: RawNode): boolean =>
61
96
  parseEnumAttr(attr(node, "direction"), DIRECTIONS, "in", "direction") === "in";
62
97
 
@@ -66,9 +101,14 @@ const hasNullableAttr = (node: RawNode): boolean =>
66
101
  const hasOptionalAttr = (node: RawNode): boolean =>
67
102
  isAttrTrue(node, "optional") || (!isInDirection(node) && isAttrTrue(node, "allow-none"));
68
103
 
104
+ const parameterCType = (node: RawNode): string | undefined =>
105
+ attr(getChild(node, "type"), "c:type") ?? attr(getChild(node, "array"), "c:type");
106
+
69
107
  const parameterFromNode = (node: RawNode, context: ParseContext): GirParameter => ({
70
108
  name: nameAttr(node),
71
109
  type: typeRefFromNode(node, context),
110
+ cType: parameterCType(node),
111
+ doc: getDoc(node),
72
112
  direction: parseEnumAttr(attr(node, "direction"), DIRECTIONS, "in", "direction"),
73
113
  transferOwnership: transferOwnership(node),
74
114
  nullable: hasNullableAttr(node),
@@ -90,11 +130,12 @@ const isInoutParameter = (parameter: GirParameter): boolean => parameter.directi
90
130
 
91
131
  const returnValueFromNode = (node: RawNode | undefined, context: ParseContext): GirReturnValue => {
92
132
  if (node === undefined) {
93
- return { type: undefined, transferOwnership: "none", nullable: false, skip: false };
133
+ return { type: undefined, doc: undefined, transferOwnership: "none", nullable: false, skip: false };
94
134
  }
95
135
 
96
136
  return {
97
137
  type: typeRefFromNode(node, context),
138
+ doc: getDoc(node),
98
139
  transferOwnership: transferOwnership(node),
99
140
  nullable: hasNullableAttr(node),
100
141
  skip: isAttrTrue(node, "skip"),
@@ -106,8 +147,7 @@ const parseCallable = (node: RawNode, context: ParseContext): GirCallable => {
106
147
  const parameterNodes = getChildren(parametersNode, "parameter");
107
148
 
108
149
  return {
109
- name: nameAttr(node),
110
- doc: getDoc(node),
150
+ ...documentedFromNode(node),
111
151
  parameters: parameterNodes.map((parameter) => parameterFromNode(parameter, context)),
112
152
  returnValue: returnValueFromNode(getChild(node, "return-value"), context),
113
153
  throws: isAttrTrue(node, "throws"),
package/src/gir/parse.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { createXmlParser } from "../xml.js";
3
3
 
4
+ /** An element of the parsed GIR XML: attributes under `@_`-prefixed keys, children under their tag names. */
4
5
  type RawNode = Record<string, unknown>;
5
6
 
6
7
  const MULTI_TAGS: Set<string> = new Set([
@@ -16,6 +17,7 @@ const MULTI_TAGS: Set<string> = new Set([
16
17
  "alias",
17
18
  "union",
18
19
  "method",
20
+ "virtual-method",
19
21
  "constructor",
20
22
  "property",
21
23
  "field",
@@ -141,12 +143,12 @@ const docTextFromObject = (value: object): string | undefined => {
141
143
  return typeof text === "string" ? normalizeDoc(text) : undefined;
142
144
  };
143
145
 
144
- const getDoc = (node: RawNode | undefined): string | undefined => {
146
+ const docElementText = (node: RawNode | undefined, tag: string): string | undefined => {
145
147
  if (node === undefined) {
146
148
  return undefined;
147
149
  }
148
150
 
149
- const value = firstDocValue(node.doc);
151
+ const value = firstDocValue(node[tag]);
150
152
 
151
153
  if (typeof value === "string") {
152
154
  return normalizeDoc(value);
@@ -159,6 +161,9 @@ const getDoc = (node: RawNode | undefined): string | undefined => {
159
161
  return docTextFromObject(value);
160
162
  };
161
163
 
164
+ const getDoc = (node: RawNode | undefined): string | undefined => docElementText(node, "doc");
165
+ const getDocDeprecated = (node: RawNode | undefined): string | undefined => docElementText(node, "doc-deprecated");
166
+
162
167
  export {
163
168
  GIR_CONSTRUCTOR_TAG,
164
169
  parseGirFile,
@@ -170,5 +175,6 @@ export {
170
175
  getChildren,
171
176
  getChild,
172
177
  getDoc,
178
+ getDocDeprecated,
173
179
  type RawNode,
174
180
  };
@@ -1,3 +1,4 @@
1
+ /** A fundamental C type GIR can name, collapsed to the marshalling category GTKX treats it as. */
1
2
  type PrimitiveCategory =
2
3
  | "void" |
3
4
  "boolean" |
@@ -1,20 +1,36 @@
1
1
  import type { ParseContext, TypeId } from "./type-id.js";
2
+ import { documentedFromNode, type GirAnnotations } from "./annotations.js";
2
3
  import { type ParameterTransfer, transferOwnership } from "./parameter.js";
3
- import { attr, getDoc, isAttrTrue, nameAttr, type RawNode } from "./parse.js";
4
+ import { attr, isAttrTrue, type RawNode } from "./parse.js";
4
5
  import { typeRefFromNode } from "./type-ref.js";
5
6
 
7
+ /** A GObject property declared on a class or interface, with the annotations its accessors are generated from. */
6
8
  type GirProperty = {
9
+ /** Canonical property name, dashed the way GObject registers it. */
7
10
  name: string;
11
+ /** Documentation prose from GIR, emitted as the accessor's JSDoc. */
8
12
  doc: string | undefined;
13
+ /** Release and deprecation annotations GIR carries on the property. */
14
+ annotations: GirAnnotations;
15
+ /** The property's value type, absent when GIR declares none. */
9
16
  type: TypeId | undefined;
17
+ /** Whether GObject exposes the value for reading, which admits a generated getter. */
10
18
  readable: boolean;
19
+ /** Whether GObject accepts a value for the property, which admits a generated setter. */
11
20
  writable: boolean;
21
+ /** Whether GObject sets the property during construction, using its default when none is supplied. */
12
22
  construct: boolean;
23
+ /** Whether the property can only be set at construction. */
13
24
  constructOnly: boolean;
25
+ /** Whether GIR exposes the property to bindings. */
14
26
  introspectable: boolean;
27
+ /** How ownership of the value transfers, which decides the descriptor the accessors marshal through. */
15
28
  transferOwnership: ParameterTransfer;
29
+ /** Method GIR names as reading the property, which the generated getter delegates to. */
16
30
  getter: string | undefined;
31
+ /** Method GIR names as writing the property, which the generated setter delegates to. */
17
32
  setter: string | undefined;
33
+ /** The property's default, as GIR spells it. */
18
34
  defaultValue: string | undefined;
19
35
  };
20
36
 
@@ -22,8 +38,7 @@ const isConstructableProperty = (property: GirProperty): boolean =>
22
38
  property.writable || property.construct || property.constructOnly;
23
39
 
24
40
  const propertyFromNode = (node: RawNode, context: ParseContext): GirProperty => ({
25
- name: nameAttr(node),
26
- doc: getDoc(node),
41
+ ...documentedFromNode(node),
27
42
  type: typeRefFromNode(node, context),
28
43
  readable: isAttrTrue(node, "readable", true),
29
44
  writable: isAttrTrue(node, "writable"),
package/src/gir/record.ts CHANGED
@@ -1,26 +1,48 @@
1
1
  import type { ParseContext } from "./type-id.js";
2
+ import { documentedFromNode, type GirAnnotations } from "./annotations.js";
2
3
  import { collectFields, type GirField } from "./field.js";
3
4
  import { functionFromNode, type GirFunction } from "./function.js";
4
- import { attr, getChildren, getDoc, GIR_CONSTRUCTOR_TAG, isAttrTrue, type RawNode } from "./parse.js";
5
+ import { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue, type RawNode } from "./parse.js";
5
6
 
7
+ /** A C struct or union declared by a GIR namespace: a plain record, a boxed type, or a GObject vtable. */
6
8
  type GirRecord = {
9
+ /** Whether the record is the class or interface struct holding another type's virtual methods. */
7
10
  isVtable: boolean;
11
+ /** Name within the declaring namespace, such as `"TextIter"`. */
8
12
  name: string;
13
+ /** Raw gtk-doc text from the GIR, undefined when the record is undocumented. */
9
14
  doc: string | undefined;
15
+ /** Release and deprecation annotations GIR carries on the record. */
16
+ annotations: GirAnnotations;
17
+ /** C struct name, such as `"GtkTextIter"`. */
10
18
  cType: string | undefined;
19
+ /** GLib type name the record is registered under, present when it is a boxed type. */
11
20
  glibTypeName: string | undefined;
21
+ /** Name of the function registering the record's GType, such as `"gtk_text_iter_get_type"`. */
12
22
  glibGetType: string | undefined;
23
+ /** Name of the function taking a reference, for reference-counted records. */
13
24
  glibRefFunc: string | undefined;
25
+ /** Name of the function dropping a reference, for reference-counted records. */
14
26
  glibUnrefFunc: string | undefined;
27
+ /** Name of the function duplicating an instance, used when the record has no ref function. */
15
28
  copyFunc: string | undefined;
29
+ /** Name of the function releasing an instance, used when the record has no unref function. */
16
30
  freeFunc: string | undefined;
31
+ /** Whether the struct is only ever handled behind a pointer, so its layout stays hidden. */
17
32
  disguised: boolean;
33
+ /** Whether the struct's fields are private, so instances cannot be allocated or read directly. */
18
34
  opaque: boolean;
35
+ /** Whether the record is exposed to language bindings. */
19
36
  introspectable: boolean;
37
+ /** Struct members: the named fields first, then the anonymous inline unions, then the inline records. */
20
38
  fields: GirField[];
39
+ /** Functions taking an instance of the record as their first argument. */
21
40
  methods: GirFunction[];
41
+ /** Functions returning a new instance of the record. */
22
42
  constructors: GirFunction[];
43
+ /** Functions scoped to the record but taking no instance. */
23
44
  functions: GirFunction[];
45
+ /** Whether the record is a union, so its fields overlap instead of following one another. */
24
46
  isUnion: boolean;
25
47
  };
26
48
 
@@ -31,8 +53,8 @@ const recordFromNode = (
31
53
  context: ParseContext,
32
54
  ): GirRecord => ({
33
55
  isVtable,
56
+ ...documentedFromNode(node),
34
57
  name: attr(node, "name") ?? attr(node, "glib:name") ?? "",
35
- doc: getDoc(node),
36
58
  cType: attr(node, "c:type"),
37
59
  glibTypeName: attr(node, "glib:type-name"),
38
60
  glibGetType: attr(node, "glib:get-type"),
package/src/gir/size.ts CHANGED
@@ -11,6 +11,11 @@ type FieldSlot = {
11
11
  bitWidth: number | undefined;
12
12
  };
13
13
 
14
+ type FieldSlots = {
15
+ slots: FieldSlot[];
16
+ size: number;
17
+ };
18
+
14
19
  type FieldLayoutInput = {
15
20
  layout: FieldLayout;
16
21
  bits: number | undefined;
@@ -39,7 +44,7 @@ const roundUp = (value: number, multiple: number): number => {
39
44
  return remainder === 0 ? value : value + (multiple - remainder);
40
45
  };
41
46
 
42
- const computeUnionSlots = (fields: FieldLayoutInput[]): { slots: FieldSlot[]; size: number } => {
47
+ const computeUnionSlots = (fields: FieldLayoutInput[]): FieldSlots => {
43
48
  let maxSize = 0;
44
49
  let maxAlign = 1;
45
50
 
@@ -59,9 +64,6 @@ const pushPlainField = (state: StructLayoutState, slots: FieldSlot[], field: Fie
59
64
  state.bitCursor = (byteOffset + field.layout.size) * 8;
60
65
  };
61
66
 
62
- // SysV AMD64 places a bit-field at the current bit offset whenever it still fits inside a storage
63
- // unit of its declared type aligned to that type's alignment, so the unit the cursor already sits in
64
- // may have room even though the cursor is not on a unit boundary.
65
67
  const pushBitfield = (input: {
66
68
  state: StructLayoutState;
67
69
  slots: FieldSlot[];
@@ -98,7 +100,7 @@ const processStructField = (state: StructLayoutState, slots: FieldSlot[], field:
98
100
  pushBitfield({ state, slots, field, align, bits: field.bits });
99
101
  };
100
102
 
101
- const computeStructSlots = (fields: FieldLayoutInput[]): { slots: FieldSlot[]; size: number } => {
103
+ const computeStructSlots = (fields: FieldLayoutInput[]): FieldSlots => {
102
104
  const slots: FieldSlot[] = [];
103
105
  const state: StructLayoutState = { bitCursor: 0, maxAlign: 1 };
104
106
 
@@ -109,7 +111,7 @@ const computeStructSlots = (fields: FieldLayoutInput[]): { slots: FieldSlot[]; s
109
111
  return { slots, size: roundUp(roundUp(state.bitCursor, 8) / 8, state.maxAlign) };
110
112
  };
111
113
 
112
- const computeFieldSlots = (fields: FieldLayoutInput[], isUnion = false): { slots: FieldSlot[]; size: number } =>
114
+ const computeFieldSlots = (fields: FieldLayoutInput[], isUnion = false): FieldSlots =>
113
115
  isUnion ? computeUnionSlots(fields) : computeStructSlots(fields);
114
116
 
115
117
  export { layoutOfPrimitive, computeFieldSlots, type FieldLayout, type FieldSlot, type FieldLayoutInput };
@@ -1,43 +1,89 @@
1
1
  import type { RawNode } from "./parse.js";
2
2
  import type { PrimitiveCategory } from "./primitives.js";
3
3
 
4
- type TypeId = { nsId: number; id: number };
4
+ /** A reference to a parsed type: the type table holding it, and its slot in that table. */
5
+ type TypeId = {
6
+ /** Id of the table holding the type: a namespace's, or the internal one primitives and varargs intern into. */
7
+ nsId: number;
8
+ /** Slot the type occupies in that table. */
9
+ id: number;
10
+ };
11
+
12
+ /** Which GLib container a {@link ListType} is. */
5
13
  type ListFlavor = (typeof LIST_FLAVOR_BY_NAME)[keyof typeof LIST_FLAVOR_BY_NAME];
6
- type PrimitiveType = { kind: "primitive"; category: PrimitiveCategory };
7
- type VarargsType = { kind: "varargs" };
8
14
 
15
+ /** A type that marshals directly as a value, such as `gint` or `utf8`. */
16
+ type PrimitiveType = {
17
+ /** Discriminates {@link StructuralType}. */
18
+ kind: "primitive";
19
+ /** The scalar the type marshals as. */
20
+ category: PrimitiveCategory;
21
+ };
22
+
23
+ /** The trailing `...` argument list of a variadic C function. */
24
+ type VarargsType = {
25
+ /** Discriminates {@link StructuralType}. */
26
+ kind: "varargs";
27
+ };
28
+
29
+ /** A C array, along with whatever the GIR says about how its length is determined. */
9
30
  type CArrayType = {
31
+ /** Discriminates {@link StructuralType}. */
10
32
  kind: "carray";
33
+ /** Type of the array's elements, paired with `elementCType` to build the element descriptor. */
11
34
  element: TypeId;
35
+ /** C declaration of an element, which tells an inline struct apart from a pointer to one. */
12
36
  elementCType: string | undefined;
37
+ /** C declaration of the array itself. */
38
+ arrayCType: string | undefined;
39
+ /** Index of the parameter, or of the sibling record field, carrying the length. */
13
40
  lengthParameterIndex: number | undefined;
41
+ /** Element count when the array has a fixed size. */
14
42
  fixedSize: number | undefined;
15
- zeroTerminated: boolean;
43
+ /** Whether the array ends at a null element. */
44
+ isZeroTerminated: boolean;
16
45
  };
17
46
 
47
+ /** A GLib list or array container over a single element type. */
18
48
  type ListType = {
49
+ /** Discriminates {@link StructuralType}. */
19
50
  kind: "list";
51
+ /** Which container the type is. */
20
52
  flavor: ListFlavor;
53
+ /** Type the container's elements marshal as, which the list descriptor wraps. */
21
54
  element: TypeId;
22
55
  };
23
56
 
57
+ /** A `GLib.HashTable`. */
24
58
  type HashTableType = {
59
+ /** Discriminates {@link StructuralType}. */
25
60
  kind: "hashtable";
61
+ /** Type the keys marshal as, rendered as the key half of a `Record` or `Map`. */
26
62
  key: TypeId;
63
+ /** Type the values marshal as, rendered as the value half of a `Record` or `Map`. */
27
64
  value: TypeId;
28
65
  };
29
66
 
67
+ /** A type the GIR describes by its structure rather than by a name it declares. */
30
68
  type StructuralType = PrimitiveType | VarargsType | CArrayType | ListType | HashTableType;
31
69
 
70
+ /** The hooks the GIR parsers use to reference and register types while walking one namespace. */
32
71
  type ParseContext = {
72
+ /** Id of the namespace being parsed. */
33
73
  nsId: number;
74
+ /** Resolves a GIR type name, optionally namespace-qualified, reserving a slot when it is not parsed yet. */
34
75
  findType(name: string): TypeId;
76
+ /** Interns a primitive type and returns its id. */
35
77
  addPrimitive(category: PrimitiveCategory): TypeId;
78
+ /** Interns the varargs type and returns its id. */
36
79
  addVarargs(): TypeId;
80
+ /** Registers an unnamed container type in the namespace and returns its id. */
37
81
  addContainer(type: CArrayType | ListType | HashTableType): TypeId;
82
+ /** Parses an inline `<callback>` node, registers it as an unnamed type, and returns its id. */
38
83
  addAnonymousCallback(node: RawNode): TypeId;
39
84
  };
40
85
 
86
+ /** GIR type names of the GLib containers, mapped to the {@link ListFlavor} each one parses to. */
41
87
  const LIST_FLAVOR_BY_NAME = {
42
88
  "GLib.List": "glist",
43
89
  "GLib.SList": "gslist",
@@ -46,10 +92,8 @@ const LIST_FLAVOR_BY_NAME = {
46
92
  "GLib.ByteArray": "gbytearray",
47
93
  } as const;
48
94
 
49
- // An array with no length parameter, no fixed size and an explicit `zero-terminated="0"` carries no
50
- // way to recover its length, so it is a bare pointer rather than something that can be walked.
51
95
  const hasUnknownArrayLength = (ref: CArrayType): boolean =>
52
- !ref.zeroTerminated && ref.lengthParameterIndex === undefined && ref.fixedSize === undefined;
96
+ !ref.isZeroTerminated && ref.lengthParameterIndex === undefined && ref.fixedSize === undefined;
53
97
 
54
98
  export {
55
99
  hasUnknownArrayLength,
@@ -88,9 +88,10 @@ const arrayTypeRefFromNode = (arrayNode: RawNode, context: ParseContext): TypeId
88
88
  kind: "carray",
89
89
  element,
90
90
  elementCType: elementNode === undefined ? undefined : attr(elementNode, "c:type"),
91
+ arrayCType: attr(arrayNode, "c:type"),
91
92
  lengthParameterIndex: intAttr(arrayNode, "length"),
92
93
  fixedSize: intAttr(arrayNode, "fixed-size"),
93
- zeroTerminated: isAttrTrue(arrayNode, "zero-terminated", true),
94
+ isZeroTerminated: isAttrTrue(arrayNode, "zero-terminated", true),
94
95
  };
95
96
 
96
97
  return context.addContainer(carray);
package/src/gir/type.ts CHANGED
@@ -5,14 +5,58 @@ import type { GirAlias, GirNamespace } from "./namespace.js";
5
5
  import type { GirRecord } from "./record.js";
6
6
  import type { StructuralType } from "./type-id.js";
7
7
 
8
+ /** A named entity a GIR namespace declares, discriminated by `kind` and carrying the parsed node. */
8
9
  type EntityType =
9
- | { kind: "class"; namespace: GirNamespace; value: GirClass } |
10
- { kind: "interface"; namespace: GirNamespace; value: GirClass } |
11
- { kind: "record"; namespace: GirNamespace; value: GirRecord } |
12
- { kind: "enum"; namespace: GirNamespace; value: GirEnum } |
13
- { kind: "callback"; namespace: GirNamespace; value: GirCallback } |
14
- { kind: "alias"; namespace: GirNamespace; value: GirAlias };
10
+ | {
11
+ /** Discriminates {@link EntityType}. */
12
+ kind: "class";
13
+ /** Namespace declaring the class. */
14
+ namespace: GirNamespace;
15
+ /** Parsed class, carrying its GType metadata and the members it declares. */
16
+ value: GirClass;
17
+ } |
18
+ {
19
+ /** Discriminates {@link EntityType}. */
20
+ kind: "interface";
21
+ /** Namespace declaring the interface. */
22
+ namespace: GirNamespace;
23
+ /** Parsed interface, modeled the same way as a class. */
24
+ value: GirClass;
25
+ } |
26
+ {
27
+ /** Discriminates {@link EntityType}. */
28
+ kind: "record";
29
+ /** Namespace declaring the record. */
30
+ namespace: GirNamespace;
31
+ /** Parsed record, either a struct or a union. */
32
+ value: GirRecord;
33
+ } |
34
+ {
35
+ /** Discriminates {@link EntityType}. */
36
+ kind: "enum";
37
+ /** Namespace declaring the enumeration. */
38
+ namespace: GirNamespace;
39
+ /** Parsed enumeration or bitfield. */
40
+ value: GirEnum;
41
+ } |
42
+ {
43
+ /** Discriminates {@link EntityType}. */
44
+ kind: "callback";
45
+ /** Namespace declaring the callback. */
46
+ namespace: GirNamespace;
47
+ /** Parsed callback signature. */
48
+ value: GirCallback;
49
+ } |
50
+ {
51
+ /** Discriminates {@link EntityType}. */
52
+ kind: "alias";
53
+ /** Namespace declaring the alias. */
54
+ namespace: GirNamespace;
55
+ /** Parsed alias, holding the type it stands for. */
56
+ value: GirAlias;
57
+ };
15
58
 
59
+ /** What a GIR type reference resolves to: a structural type, or an entity a namespace declares. */
16
60
  type GirType = StructuralType | EntityType;
17
61
 
18
62
  export { type EntityType, type GirType };
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** @public */
1
2
  export {
2
3
  API_SYMBOL_KINDS,
3
4
  type ApiLookupResult,
@@ -7,23 +8,24 @@ export {
7
8
  type ApiSearchOptions,
8
9
  type ApiSymbol,
9
10
  type ApiSymbolKind,
11
+ type ApiSymbolQuery,
10
12
  loadApiReference,
11
13
  } from "./docs/api-reference.js";
12
- export {
13
- type DocsElementLink,
14
- type DocsNamespace,
15
- type DocsOptions,
16
- type DocsResult,
17
- writeDocs,
18
- } from "./docs/pipeline.js";
14
+ /** @public */
19
15
  export { resolveGirPath } from "./gir/gir-path.js";
20
- export { discoverGirNamespaces, resolveLibraries } from "./gir/libraries.js";
21
- export {
22
- type BuiltinElement,
23
- type BuiltinElements,
24
- type ModuleExport,
25
- readBuiltinElements,
26
- } from "./react/element-config.js";
27
- export { runCodegen } from "./runner.js";
16
+ /** @public */
17
+ export { discoverGirNamespaces, type LibrarySelection, resolveLibraries } from "./gir/libraries.js";
18
+ /** @public */
19
+ export { type BuiltinElements, type ModuleExport, readBuiltinElements } from "./react/element-config.js";
20
+ /** @public */
21
+ export { type CodegenRunnerOptions, type CodegenRunnerResult, runCodegen } from "./runner.js";
22
+ /** @public */
28
23
  export type { ElementProps } from "./store/jsx/element-prop-imports.js";
29
- export { mergeOmitProps, type OmittedProps } from "./store/jsx/omitted-props.js";
24
+ /** @public */
25
+ export { type GeneratedElement, readGeneratedElements } from "./store/jsx/generated-elements.js";
26
+ /** @public */
27
+ export { mergeOmittedProps, type OmittedProps } from "./store/jsx/omitted-props.js";
28
+ /** @public */
29
+ export { type ResolvedStore, resolveStore } from "./store/resolve-store.js";
30
+ /** @public */
31
+ export type { StoreOptions } from "./store/store-fs.js";
@@ -0,0 +1,2 @@
1
+ export { writeDocs } from "./docs/pipeline.js";
2
+ export { runGlCodegen } from "./runner.js";