@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,17 +1,19 @@
1
- import { pascalCase, sortStringsBy } from "@gtkx/utils";
1
+ import { pascalCase, sortStringsBy, upperFirst } from "@gtkx/utils";
2
+ import type { GirAnnotations } from "../gir/annotations.js";
2
3
  import type { GirClass } from "../gir/class.js";
3
- import type { GirEnum } from "../gir/enum.js";
4
+ import type { EnumMember, GirEnum } from "../gir/enum.js";
4
5
  import type { GirFunction } from "../gir/function.js";
5
6
  import type { Library } from "../gir/library.js";
6
- import type { GirProperty } from "../gir/property.js";
7
7
  import type { GirRecord } from "../gir/record.js";
8
8
  import type { ModuleContext } from "../writer/context.js";
9
+ import type { JsDocSpec } from "../writer/doc.js";
9
10
  import { reservedSignalMemberRename } from "../analysis/inheritance.js";
10
11
  import { renderTsType } from "../analysis/ts-type.js";
11
12
  import { ancestorChain } from "../gir/ancestry.js";
12
13
  import { callbackAsFunction, type GirCallback } from "../gir/callback.js";
13
14
  import { type GirAlias, type GirConstant, type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
14
15
  import { PRIMITIVE_TS_TYPE, primitiveCategory } from "../gir/primitives.js";
16
+ import { callableSpec } from "../store/gi/callable-doc.js";
15
17
  import {
16
18
  dedupeCallables,
17
19
  indexMethodsByName,
@@ -21,6 +23,7 @@ import {
21
23
  renderStaticSignature,
22
24
  } from "../store/gi/callables.js";
23
25
  import { constantLiteral } from "../store/gi/constant.js";
26
+ import { annotationSpec } from "../store/gi/doc-spec.js";
24
27
  import { enumMemberKey } from "../store/gi/enum.js";
25
28
  import {
26
29
  methodExportName,
@@ -31,22 +34,31 @@ import {
31
34
  import { resolveAccessor, type ResolvedAccessor } from "../store/gi/property-accessor.js";
32
35
  import { resolveRecordFieldEntry } from "../store/gi/record-field-accessor.js";
33
36
  import { computeRecordFieldSlots } from "../store/gi/record-layout.js";
37
+ import { vfuncEntries } from "../store/gi/vtable.js";
34
38
  import { implementedInterfaces, newlyImplementedInterfaces } from "../store/jsx/intrinsic-elements.js";
35
39
  import {
40
+ annotationNotes,
36
41
  classMethodEntries,
42
+ deprecationMeta,
37
43
  docMarkdown,
38
- docsDefaultValue,
39
44
  docsSignatureContext,
40
45
  firstSentence,
41
46
  implementsLine,
42
47
  joinSections,
43
- metaBlock,
48
+ type MetaDocEntry,
44
49
  methodsSectionBlocks,
45
50
  originSignatureBlocks,
51
+ type OriginSignatureEntry,
52
+ plainText,
53
+ propertyMetaLine,
46
54
  renderDocsSignalHandlerType,
47
55
  renderDocsType,
56
+ signalTags,
48
57
  signatureBlock,
49
58
  type SignatureEntry,
59
+ signatureEntryBlock,
60
+ sortedMetaBlocks,
61
+ tagNotes,
50
62
  } from "./render.js";
51
63
 
52
64
  /** What every indexed GIR symbol carries, whatever its kind. */
@@ -61,16 +73,57 @@ type GiSymbolBase = {
61
73
 
62
74
  /** A GIR symbol the reference indexes, discriminated by `kind` and carrying the GIR node its page renders from. */
63
75
  type GiSymbolEntry =
64
- | (GiSymbolBase & { kind: "class" | "interface"; klass: GirClass }) |
65
- (GiSymbolBase & { kind: "record"; record: GirRecord }) |
66
- (GiSymbolBase & { kind: "enum"; enumeration: GirEnum }) |
67
- (GiSymbolBase & { kind: "callback"; callback: GirCallback }) |
68
- (GiSymbolBase & { kind: "alias"; alias: GirAlias }) |
69
- (GiSymbolBase & { kind: "function"; fn: GirFunction }) |
70
- (GiSymbolBase & { kind: "constant"; constant: GirConstant });
76
+ | (GiSymbolBase & {
77
+ /** Renders the class page: hierarchy, constructors, static methods, properties, signals, and methods. */
78
+ kind: "class" | "interface";
79
+ /** Supplies the ancestry, members, and, on an interface, the vtable slots an implementer fills. */
80
+ klass: GirClass;
81
+ }) |
82
+ (GiSymbolBase & {
83
+ /** Renders the record page, labeled `union` when the record is one. */
84
+ kind: "record";
85
+ /** Supplies the constructors, static methods, fields, and instance methods. */
86
+ record: GirRecord;
87
+ }) |
88
+ (GiSymbolBase & {
89
+ /** Renders the page for an enumeration, a flags type, or an error domain, as a table of members. */
90
+ kind: "enum";
91
+ /** Supplies the members, their values, and the GError domain when the enum carries one. */
92
+ enumeration: GirEnum;
93
+ }) |
94
+ (GiSymbolBase & {
95
+ /** Renders the callback page as a single function type signature. */
96
+ kind: "callback";
97
+ /** Supplies the parameters and return type the signature is rendered from. */
98
+ callback: GirCallback;
99
+ }) |
100
+ (GiSymbolBase & {
101
+ /** Renders the alias page as the type the alias resolves to. */
102
+ kind: "alias";
103
+ /** Supplies the target type the page prints. */
104
+ alias: GirAlias;
105
+ }) |
106
+ (GiSymbolBase & {
107
+ /** Renders the page for a namespace-level function, promisified when a finish function matches it. */
108
+ kind: "function";
109
+ /** Supplies the parameters and return type the signature is rendered from. */
110
+ fn: GirFunction;
111
+ }) |
112
+ (GiSymbolBase & {
113
+ /** Renders the page for a namespace-level constant, showing its type and literal value. */
114
+ kind: "constant";
115
+ /** Supplies the type and the value the literal is emitted from. */
116
+ constant: GirConstant;
117
+ });
118
+
119
+ type ClassSymbol = GiSymbolBase & { klass: GirClass };
120
+ type ClassPageSymbol = ClassSymbol & { kind: "class" | "interface" };
71
121
 
122
+ /** What {@link renderSymbolPage} needs besides the entry itself. */
72
123
  type SymbolPageOptions = {
124
+ /** Parsed GIR the page resolves ancestry, interfaces, and referenced types against. */
73
125
  library: Library;
126
+ /** Looks up the JSX element a class is also available as, undefined when it has none. */
74
127
  elementNameFor: (namespaceName: string, className: string) => string | undefined;
75
128
  };
76
129
 
@@ -95,11 +148,10 @@ type PropertyAccessorSetup = {
95
148
  methodByName: Map<string, GirFunction>;
96
149
  };
97
150
 
98
- type MetaDocEntry = { name: string; meta: string; doc: string };
99
- type SignalDocEntry = { name: string; signature: string; doc: string; origin: string | undefined };
100
151
  type ResolvedRecordField = NonNullable<ReturnType<typeof resolveRecordFieldEntry>>;
101
152
 
102
153
  const qualifiedName = (entry: GiSymbolBase): string => `${entry.namespace.name}.${entry.name}`;
154
+ const pageTagNotes = (spec: JsDocSpec): string[] => tagNotes({ ...spec, deprecated: undefined, since: undefined });
103
155
 
104
156
  const frontmatter = (entry: GiSymbolBase, kindLabel: string): string => {
105
157
  const sentence = firstSentence(entry.doc);
@@ -114,18 +166,46 @@ const kindLine = (kindLabel: string, namespace: GirNamespace): string =>
114
166
  const importBlock = (entry: GiSymbolBase): string =>
115
167
  `\`\`\`ts\nimport * as ${entry.namespace.name} from "@gtkx/gi/${namespaceDirectory(entry.namespace)}";\n\`\`\``;
116
168
 
169
+ const entryAnnotations = (entry: GiSymbolEntry): GirAnnotations => {
170
+ switch (entry.kind) {
171
+ case "class":
172
+ case "interface": {
173
+ return entry.klass.annotations;
174
+ }
175
+ case "record": {
176
+ return entry.record.annotations;
177
+ }
178
+ case "enum": {
179
+ return entry.enumeration.annotations;
180
+ }
181
+ case "callback": {
182
+ return entry.callback.annotations;
183
+ }
184
+ case "alias": {
185
+ return entry.alias.annotations;
186
+ }
187
+ case "function": {
188
+ return entry.fn.annotations;
189
+ }
190
+ case "constant": {
191
+ return entry.constant.annotations;
192
+ }
193
+ }
194
+ };
195
+
117
196
  const pageHeader = (entry: GiSymbolEntry, kindLabel: string): string[] => [
118
197
  frontmatter(entry, kindLabel),
119
198
  `# ${qualifiedName(entry)}`,
120
199
  kindLine(kindLabel, entry.namespace),
121
200
  docMarkdown(entry.doc),
201
+ ...annotationNotes(entryAnnotations(entry)),
122
202
  importBlock(entry),
123
203
  ];
124
204
 
125
205
  const qualifiedClassName = (namespaceName: string, className: string): string =>
126
206
  `${namespaceName}.${pascalCase(className)}`;
127
207
 
128
- const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolPageOptions): string[] => {
208
+ const elementNote = (entry: ClassSymbol, options: SymbolPageOptions): string[] => {
129
209
  const glibName = options.elementNameFor(entry.namespace.name, entry.klass.name);
130
210
 
131
211
  if (glibName === undefined) {
@@ -139,7 +219,7 @@ const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolP
139
219
  ];
140
220
  };
141
221
 
142
- const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
222
+ const hierarchySection = (entry: ClassSymbol, library: Library): string[] => {
143
223
  const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).toReversed();
144
224
 
145
225
  const interfaces = implementedInterfaces(entry.klass, entry.namespace, library).map((iface) =>
@@ -166,7 +246,7 @@ const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Li
166
246
  return lines;
167
247
  };
168
248
 
169
- const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
249
+ const prerequisitesLine = (entry: ClassSymbol, library: Library): string[] => {
170
250
  const names = entry.klass.prerequisites.map((name) => {
171
251
  const resolved = library.resolveType(entry.namespace.name, name);
172
252
 
@@ -184,33 +264,86 @@ const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: L
184
264
  return [`Requires ${names.join(", ")}.`];
185
265
  };
186
266
 
267
+ const interfaceImplementingIntro = (entry: ClassSymbol): string => {
268
+ const qualified = qualifiedName(entry);
269
+
270
+ return (
271
+ `A class fills these vtable slots to adopt the interface: declare \`implements ${qualified}Impl\` ` +
272
+ `on it and pass \`${qualified}\` in the \`implements\` option of \`registerClass\`. Every slot is ` +
273
+ "optional, and one the class leaves out keeps whatever the interface installs by default. The " +
274
+ "methods, properties, and signals above come from GLib dispatch."
275
+ );
276
+ };
277
+
278
+ const classImplementingIntro = (entry: ClassSymbol): string => {
279
+ const qualified = qualifiedName(entry);
280
+
281
+ return (
282
+ "A subclass declared with `registerClass` overrides these virtual methods to change what " +
283
+ `\`${qualified}\` does: define the slot as a method on the subclass and call \`super.<slot>(...)\` ` +
284
+ "to chain up to the inherited implementation. A slot the subclass leaves out keeps that " +
285
+ "implementation unchanged."
286
+ );
287
+ };
288
+
289
+ const implementingIntro = (entry: ClassPageSymbol): string =>
290
+ entry.kind === "interface" ? interfaceImplementingIntro(entry) : classImplementingIntro(entry);
291
+
292
+ const implementingSection = (entry: ClassPageSymbol, library: Library): string[] => {
293
+ const context = docsSignatureContext(entry.namespace, library);
294
+ const entries = vfuncEntries(context, entry.namespace.name, entry.klass);
295
+
296
+ if (entries.length === 0) {
297
+ return [];
298
+ }
299
+
300
+ const blocks = sortStringsBy(entries, (item) => item.name).map((item) =>
301
+ signatureBlock(item.name, item.signature, [docMarkdown(item.doc)]));
302
+
303
+ return ["## Implementing", implementingIntro(entry), ...blocks];
304
+ };
305
+
306
+ const staticEntry = (options: StaticSectionOptions, callable: GirFunction): SignatureEntry | undefined => {
307
+ const signature = renderStaticSignature(options.context, callable, {
308
+ returnTypeOverride: options.returnTypeOverride,
309
+ siblings: options.siblings,
310
+ });
311
+
312
+ if (signature === undefined) {
313
+ return undefined;
314
+ }
315
+
316
+ const finishFn = matchStaticFinishFunction(options.context, callable, options.siblings);
317
+
318
+ return {
319
+ name: signature.name,
320
+ signature: signature.signature,
321
+ doc: docMarkdown(callable.doc),
322
+ tags: callableSpec(options.context, callable, { finishFn }),
323
+ };
324
+ };
325
+
187
326
  const staticSection = (options: StaticSectionOptions): string[] => {
188
- const rendered: { name: string; block: string }[] = [];
327
+ const entries: SignatureEntry[] = [];
189
328
 
190
329
  for (const callable of dedupeCallables(options.callables)) {
191
- const signature = renderStaticSignature(options.context, callable, {
192
- returnTypeOverride: options.returnTypeOverride,
193
- siblings: options.siblings,
194
- });
330
+ const entry = staticEntry(options, callable);
195
331
 
196
- if (signature === undefined) {
197
- continue;
332
+ if (entry !== undefined) {
333
+ entries.push(entry);
198
334
  }
199
-
200
- rendered.push({
201
- name: signature.name,
202
- block: signatureBlock(signature.name, signature.signature, [docMarkdown(callable.doc)]),
203
- });
204
335
  }
205
336
 
206
- if (rendered.length === 0) {
337
+ if (entries.length === 0) {
207
338
  return [];
208
339
  }
209
340
 
210
- return [options.title, options.intro, ...sortStringsBy(rendered, (item) => item.name).map((item) => item.block)];
341
+ const blocks = sortStringsBy(entries, (item) => item.name).map((item) => signatureEntryBlock(item));
342
+
343
+ return [options.title, options.intro, ...blocks];
211
344
  };
212
345
 
213
- const memberOwners = (entry: GiSymbolBase & { klass: GirClass }, library: Library): MemberOwner[] => [
346
+ const memberOwners = (entry: ClassSymbol, library: Library): MemberOwner[] => [
214
347
  { klass: entry.klass, namespace: entry.namespace, origin: undefined },
215
348
  ...newlyImplementedInterfaces(entry.klass, entry.namespace, library).map((iface) => ({
216
349
  klass: iface.klass,
@@ -264,33 +397,14 @@ const propertyAccessorSetup = (
264
397
  };
265
398
  };
266
399
 
267
- const propertyMeta = (property: GirProperty, accessor: ResolvedAccessor, origin: string | undefined): string => {
268
- const meta: string[] = [`\`${accessor.tsType}\``];
269
-
270
- if (property.defaultValue !== undefined) {
271
- meta.push(`default \`${docsDefaultValue(property.defaultValue)}\``);
272
- }
273
-
274
- if (property.constructOnly) {
275
- meta.push("construct-only");
276
- }
277
-
400
+ const getAccessNotes = (accessor: ResolvedAccessor): string[] => {
278
401
  if (!accessor.isWritable) {
279
- meta.push("read-only");
280
- } else if (!accessor.hasGetter) {
281
- meta.push("write-only");
282
- }
283
-
284
- if (origin !== undefined) {
285
- meta.push(`from \`${origin}\``);
402
+ return ["read-only"];
286
403
  }
287
404
 
288
- return meta.join(" · ");
405
+ return accessor.hasGetter ? [] : ["write-only"];
289
406
  };
290
407
 
291
- const sortedMetaBlocks = (entries: MetaDocEntry[]): string[] =>
292
- sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
293
-
294
408
  const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup, seen: Set<string>): MetaDocEntry[] => {
295
409
  const entries: MetaDocEntry[] = [];
296
410
 
@@ -310,18 +424,21 @@ const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup,
310
424
 
311
425
  entries.push({
312
426
  name: accessor.jsName,
313
- meta: propertyMeta(property, accessor, owner.origin),
427
+ meta: propertyMetaLine({
428
+ type: accessor.tsType,
429
+ property,
430
+ accessNotes: getAccessNotes(accessor),
431
+ origin: owner.origin,
432
+ }),
314
433
  doc: docMarkdown(property.doc),
434
+ tags: annotationSpec(property.annotations),
315
435
  });
316
436
  }
317
437
 
318
438
  return entries;
319
439
  };
320
440
 
321
- const propertiesSection = (
322
- entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
323
- library: Library,
324
- ): string[] => {
441
+ const propertiesSection = (entry: ClassPageSymbol, library: Library): string[] => {
325
442
  const seen: Set<string> = new Set();
326
443
  const entries: MetaDocEntry[] = [];
327
444
 
@@ -343,8 +460,8 @@ const propertiesSection = (
343
460
  return ["## Properties", intro, ...sortedMetaBlocks(entries)];
344
461
  };
345
462
 
346
- const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): SignalDocEntry[] => {
347
- const entries: SignalDocEntry[] = [];
463
+ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): OriginSignatureEntry[] => {
464
+ const entries: OriginSignatureEntry[] = [];
348
465
 
349
466
  for (const signal of owner.klass.signals) {
350
467
  if (seen.has(signal.name)) {
@@ -357,6 +474,7 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
357
474
  name: signal.name,
358
475
  signature: renderDocsSignalHandlerType(library, signal),
359
476
  doc: docMarkdown(signal.doc),
477
+ tags: signalTags(signal, false),
360
478
  origin: owner.origin,
361
479
  });
362
480
  }
@@ -364,9 +482,9 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
364
482
  return entries;
365
483
  };
366
484
 
367
- const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
485
+ const signalsSection = (entry: ClassSymbol, library: Library): string[] => {
368
486
  const seen: Set<string> = new Set();
369
- const entries: SignalDocEntry[] = [];
487
+ const entries: OriginSignatureEntry[] = [];
370
488
 
371
489
  for (const owner of memberOwners(entry, library)) {
372
490
  entries.push(...ownerSignalEntries(owner, library, seen));
@@ -383,16 +501,13 @@ const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Libr
383
501
  return ["## Signals", intro, ...originSignatureBlocks(entries)];
384
502
  };
385
503
 
386
- const classMethodsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] =>
504
+ const classMethodsSection = (entry: ClassSymbol, library: Library): string[] =>
387
505
  methodsSectionBlocks(
388
506
  classMethodEntries(library, entry.namespace, entry.klass),
389
507
  "Methods are called on instances. Methods inherited from ancestors are documented on their own pages.",
390
508
  );
391
509
 
392
- const classPage = (
393
- entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
394
- options: SymbolPageOptions,
395
- ): string => {
510
+ const classPage = (entry: ClassPageSymbol, options: SymbolPageOptions): string => {
396
511
  const { library } = options;
397
512
  const qualified = qualifiedName(entry);
398
513
  const docsContext = docsSignatureContext(entry.namespace, library);
@@ -422,6 +537,7 @@ const classPage = (
422
537
  ...propertiesSection(entry, library),
423
538
  ...signalsSection(entry, library),
424
539
  ...classMethodsSection(entry, library),
540
+ ...implementingSection(entry, library),
425
541
  ]);
426
542
  };
427
543
 
@@ -462,7 +578,12 @@ const recordInstanceEntries = (context: ModuleContext, record: GirRecord): Signa
462
578
  continue;
463
579
  }
464
580
 
465
- entries.push({ name: rendered.name, signature: rendered.signature, doc: docMarkdown(callable.doc) });
581
+ entries.push({
582
+ name: rendered.name,
583
+ signature: rendered.signature,
584
+ doc: docMarkdown(callable.doc),
585
+ tags: callableSpec(context, callable, {}),
586
+ });
466
587
  }
467
588
 
468
589
  return sortStringsBy(entries, (item) => item.name);
@@ -500,7 +621,11 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
500
621
  };
501
622
 
502
623
  const fieldMeta = (field: ResolvedRecordField): string =>
503
- [`\`${field.tsType}\``, ...(field.isWritable ? [] : ["read-only"])].join(" · ");
624
+ [
625
+ `\`${field.tsType}\``,
626
+ ...(field.isWritable ? [] : ["read-only"]),
627
+ ...deprecationMeta(field.annotations),
628
+ ].join(" · ");
504
629
 
505
630
  const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames: Set<string>): string[] => {
506
631
  const { slots } = computeRecordFieldSlots(context, record.fields, record.isUnion);
@@ -513,7 +638,12 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
513
638
  continue;
514
639
  }
515
640
 
516
- entries.push({ name: field.jsName, meta: fieldMeta(field), doc: docMarkdown(field.doc) });
641
+ entries.push({
642
+ name: field.jsName,
643
+ meta: fieldMeta(field),
644
+ doc: docMarkdown(field.doc),
645
+ tags: annotationSpec(field.annotations),
646
+ });
517
647
  }
518
648
 
519
649
  if (entries.length === 0) {
@@ -523,16 +653,23 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
523
653
  return ["## Fields", ...sortedMetaBlocks(entries)];
524
654
  };
525
655
 
656
+ const memberDescription = (member: EnumMember): string => {
657
+ const markers = deprecationMeta(member.annotations).map((note) => `**${upperFirst(note)}.**`);
658
+
659
+ return [...markers, plainText(member.doc)]
660
+ .filter((part) => part.length > 0)
661
+ .join(" ")
662
+ .replaceAll("|", String.raw`\|`);
663
+ };
664
+
526
665
  const enumPage = (entry: GiSymbolBase & { kind: "enum"; enumeration: GirEnum }): string => {
527
666
  const { enumeration } = entry;
528
667
  const kindLabel = enumeration.errorDomain === undefined ? enumeration.kind : "error domain";
529
668
  const qualified = qualifiedName(entry);
530
669
 
531
- const rows = enumeration.members.map((member) => {
532
- const description = firstSentence(member.doc).replaceAll("|", String.raw`\|`);
533
-
534
- return `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${description} |`;
535
- });
670
+ const rows = enumeration.members.map(
671
+ (member) => `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${memberDescription(member)} |`,
672
+ );
536
673
 
537
674
  const usage =
538
675
  enumeration.errorDomain === undefined
@@ -551,7 +688,12 @@ const callbackPage = (entry: GiSymbolBase & { kind: "callback"; callback: GirCal
551
688
  const parameters = renderMethodSignature(docsContext, fn);
552
689
  const signature = `type ${entry.name} = (${parameters}) => ${renderMethodReturnType(docsContext, fn)}`;
553
690
 
554
- return joinSections([...pageHeader(entry, "callback"), "## Signature", `\`\`\`ts\n${signature}\n\`\`\``]);
691
+ return joinSections([
692
+ ...pageHeader(entry, "callback"),
693
+ "## Signature",
694
+ `\`\`\`ts\n${signature}\n\`\`\``,
695
+ ...pageTagNotes(callableSpec(docsContext, fn, {})),
696
+ ]);
555
697
  };
556
698
 
557
699
  const aliasPage = (entry: GiSymbolBase & { kind: "alias"; alias: GirAlias }, library: Library): string => {
@@ -576,9 +718,12 @@ const functionSignature = (context: ModuleContext, name: string, fn: GirFunction
576
718
 
577
719
  const functionPage = (entry: GiSymbolBase & { kind: "function"; fn: GirFunction }, library: Library): string => {
578
720
  const docsContext = docsSignatureContext(entry.namespace, library);
579
- const signature = functionSignature(docsContext, entry.name, entry.fn, entry.namespace.functions);
721
+ const siblings = entry.namespace.functions;
722
+ const signature = functionSignature(docsContext, entry.name, entry.fn, siblings);
723
+ const finishFn = matchStaticFinishFunction(docsContext, entry.fn, siblings);
724
+ const spec = callableSpec(docsContext, entry.fn, { finishFn });
580
725
 
581
- return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``]);
726
+ return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``, ...pageTagNotes(spec)]);
582
727
  };
583
728
 
584
729
  const constantPage = (entry: GiSymbolBase & { kind: "constant"; constant: GirConstant }, library: Library): string => {
@@ -164,5 +164,4 @@ export {
164
164
  jsxStoreFreshness,
165
165
  type GiFingerprint,
166
166
  type JsxFingerprintInput,
167
- type JsxFingerprint,
168
167
  };
@@ -28,6 +28,20 @@ const resolveInterface = (
28
28
  return resolved?.kind === "interface" ? getAncestor(resolved) : undefined;
29
29
  };
30
30
 
31
+ const resolveInterfaces = (library: Library, defaultNamespace: string, names: string[]): ResolvedAncestor[] => {
32
+ const interfaces: ResolvedAncestor[] = [];
33
+
34
+ for (const name of names) {
35
+ const iface = resolveInterface(library, defaultNamespace, name);
36
+
37
+ if (iface !== undefined) {
38
+ interfaces.push(iface);
39
+ }
40
+ }
41
+
42
+ return interfaces;
43
+ };
44
+
31
45
  function* ancestorChain(library: Library, klass: GirClass, namespaceName: string): Generator<ResolvedAncestor> {
32
46
  const visited: Set<string> = new Set();
33
47
  let current: ResolvedAncestor | undefined = { klass, namespaceName };
@@ -50,4 +64,4 @@ function* ancestorChain(library: Library, klass: GirClass, namespaceName: string
50
64
  }
51
65
  }
52
66
 
53
- export { resolveInterface, ancestorChain, type ResolvedAncestor };
67
+ export { resolveInterfaces, ancestorChain, type ResolvedAncestor };
@@ -0,0 +1,37 @@
1
+ import { attr, getDoc, getDocDeprecated, isAttrTrue, nameAttr, type RawNode } from "./parse.js";
2
+
3
+ /** Release and deprecation annotations GIR carries on a documentable element. */
4
+ type GirAnnotations = {
5
+ /** Library release the symbol appeared in, from the `version` attribute. */
6
+ since: string | undefined;
7
+ /** Whether GIR marks the symbol deprecated. */
8
+ isDeprecated: boolean;
9
+ /** Release the symbol was deprecated in, from the `deprecated-version` attribute. */
10
+ deprecatedSince: string | undefined;
11
+ /** Prose from `<doc-deprecated>` naming what to use instead. */
12
+ deprecationDoc: string | undefined;
13
+ };
14
+
15
+ type DocumentedNode = {
16
+ name: string;
17
+ doc: string | undefined;
18
+ annotations: GirAnnotations;
19
+ };
20
+
21
+ const annotationsFromNode = (node: RawNode | undefined): GirAnnotations => ({
22
+ since: attr(node, "version"),
23
+ isDeprecated: isAttrTrue(node, "deprecated"),
24
+ deprecatedSince: attr(node, "deprecated-version"),
25
+ deprecationDoc: getDocDeprecated(node),
26
+ });
27
+
28
+ const documentedFromNode = (node: RawNode): DocumentedNode => ({
29
+ name: nameAttr(node),
30
+ doc: getDoc(node),
31
+ annotations: annotationsFromNode(node),
32
+ });
33
+
34
+ const hasAnnotations = (annotations: GirAnnotations): boolean =>
35
+ annotations.since !== undefined || annotations.isDeprecated || annotations.deprecatedSince !== undefined;
36
+
37
+ export { annotationsFromNode, documentedFromNode, hasAnnotations, type GirAnnotations };
@@ -3,6 +3,7 @@ import type { RawNode } from "./parse.js";
3
3
  import type { ParseContext } from "./type-id.js";
4
4
  import { type GirCallable, parseCallable } from "./parameter.js";
5
5
 
6
+ /** The signature of a function pointer type GIR declares, whether named or anonymous. */
6
7
  type GirCallback = GirCallable;
7
8
 
8
9
  const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback => parseCallable(node, context);
@@ -10,6 +11,7 @@ const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback =>
10
11
  const callbackAsFunction = (callback: GirCallback): GirFunction => ({
11
12
  name: callback.name,
12
13
  doc: callback.doc,
14
+ annotations: callback.annotations,
13
15
  cIdentifier: undefined,
14
16
  movedTo: undefined,
15
17
  throws: callback.throws,