@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,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,41 +34,96 @@ 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
 
64
+ /** What every indexed GIR symbol carries, whatever its kind. */
52
65
  type GiSymbolBase = {
66
+ /** GIR namespace declaring the symbol. */
53
67
  namespace: GirNamespace;
68
+ /** Name the bindings export it under: camelCase for functions, PascalCase for classes, the GIR name otherwise. */
54
69
  name: string;
70
+ /** Raw gtk-doc text from the GIR, undefined when the symbol is undocumented. */
55
71
  doc: string | undefined;
56
72
  };
57
73
 
74
+ /** A GIR symbol the reference indexes, discriminated by `kind` and carrying the GIR node its page renders from. */
58
75
  type GiSymbolEntry =
59
- | (GiSymbolBase & { kind: "class" | "interface"; klass: GirClass }) |
60
- (GiSymbolBase & { kind: "record"; record: GirRecord }) |
61
- (GiSymbolBase & { kind: "enum"; enumeration: GirEnum }) |
62
- (GiSymbolBase & { kind: "callback"; callback: GirCallback }) |
63
- (GiSymbolBase & { kind: "alias"; alias: GirAlias }) |
64
- (GiSymbolBase & { kind: "function"; fn: GirFunction }) |
65
- (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" };
66
121
 
122
+ /** What {@link renderSymbolPage} needs besides the entry itself. */
67
123
  type SymbolPageOptions = {
124
+ /** Parsed GIR the page resolves ancestry, interfaces, and referenced types against. */
68
125
  library: Library;
126
+ /** Looks up the JSX element a class is also available as, undefined when it has none. */
69
127
  elementNameFor: (namespaceName: string, className: string) => string | undefined;
70
128
  };
71
129
 
@@ -90,11 +148,10 @@ type PropertyAccessorSetup = {
90
148
  methodByName: Map<string, GirFunction>;
91
149
  };
92
150
 
93
- type MetaDocEntry = { name: string; meta: string; doc: string };
94
- type SignalDocEntry = { name: string; signature: string; doc: string; origin: string | undefined };
95
151
  type ResolvedRecordField = NonNullable<ReturnType<typeof resolveRecordFieldEntry>>;
96
152
 
97
153
  const qualifiedName = (entry: GiSymbolBase): string => `${entry.namespace.name}.${entry.name}`;
154
+ const pageTagNotes = (spec: JsDocSpec): string[] => tagNotes({ ...spec, deprecated: undefined, since: undefined });
98
155
 
99
156
  const frontmatter = (entry: GiSymbolBase, kindLabel: string): string => {
100
157
  const sentence = firstSentence(entry.doc);
@@ -109,18 +166,46 @@ const kindLine = (kindLabel: string, namespace: GirNamespace): string =>
109
166
  const importBlock = (entry: GiSymbolBase): string =>
110
167
  `\`\`\`ts\nimport * as ${entry.namespace.name} from "@gtkx/gi/${namespaceDirectory(entry.namespace)}";\n\`\`\``;
111
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
+
112
196
  const pageHeader = (entry: GiSymbolEntry, kindLabel: string): string[] => [
113
197
  frontmatter(entry, kindLabel),
114
198
  `# ${qualifiedName(entry)}`,
115
199
  kindLine(kindLabel, entry.namespace),
116
200
  docMarkdown(entry.doc),
201
+ ...annotationNotes(entryAnnotations(entry)),
117
202
  importBlock(entry),
118
203
  ];
119
204
 
120
205
  const qualifiedClassName = (namespaceName: string, className: string): string =>
121
206
  `${namespaceName}.${pascalCase(className)}`;
122
207
 
123
- const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolPageOptions): string[] => {
208
+ const elementNote = (entry: ClassSymbol, options: SymbolPageOptions): string[] => {
124
209
  const glibName = options.elementNameFor(entry.namespace.name, entry.klass.name);
125
210
 
126
211
  if (glibName === undefined) {
@@ -134,7 +219,7 @@ const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolP
134
219
  ];
135
220
  };
136
221
 
137
- const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
222
+ const hierarchySection = (entry: ClassSymbol, library: Library): string[] => {
138
223
  const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).toReversed();
139
224
 
140
225
  const interfaces = implementedInterfaces(entry.klass, entry.namespace, library).map((iface) =>
@@ -161,7 +246,7 @@ const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Li
161
246
  return lines;
162
247
  };
163
248
 
164
- const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
249
+ const prerequisitesLine = (entry: ClassSymbol, library: Library): string[] => {
165
250
  const names = entry.klass.prerequisites.map((name) => {
166
251
  const resolved = library.resolveType(entry.namespace.name, name);
167
252
 
@@ -179,33 +264,86 @@ const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: L
179
264
  return [`Requires ${names.join(", ")}.`];
180
265
  };
181
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
+
182
326
  const staticSection = (options: StaticSectionOptions): string[] => {
183
- const rendered: { name: string; block: string }[] = [];
327
+ const entries: SignatureEntry[] = [];
184
328
 
185
329
  for (const callable of dedupeCallables(options.callables)) {
186
- const signature = renderStaticSignature(options.context, callable, {
187
- returnTypeOverride: options.returnTypeOverride,
188
- siblings: options.siblings,
189
- });
330
+ const entry = staticEntry(options, callable);
190
331
 
191
- if (signature === undefined) {
192
- continue;
332
+ if (entry !== undefined) {
333
+ entries.push(entry);
193
334
  }
194
-
195
- rendered.push({
196
- name: signature.name,
197
- block: signatureBlock(signature.name, signature.signature, [docMarkdown(callable.doc)]),
198
- });
199
335
  }
200
336
 
201
- if (rendered.length === 0) {
337
+ if (entries.length === 0) {
202
338
  return [];
203
339
  }
204
340
 
205
- 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];
206
344
  };
207
345
 
208
- const memberOwners = (entry: GiSymbolBase & { klass: GirClass }, library: Library): MemberOwner[] => [
346
+ const memberOwners = (entry: ClassSymbol, library: Library): MemberOwner[] => [
209
347
  { klass: entry.klass, namespace: entry.namespace, origin: undefined },
210
348
  ...newlyImplementedInterfaces(entry.klass, entry.namespace, library).map((iface) => ({
211
349
  klass: iface.klass,
@@ -259,33 +397,14 @@ const propertyAccessorSetup = (
259
397
  };
260
398
  };
261
399
 
262
- const propertyMeta = (property: GirProperty, accessor: ResolvedAccessor, origin: string | undefined): string => {
263
- const meta: string[] = [`\`${accessor.tsType}\``];
264
-
265
- if (property.defaultValue !== undefined) {
266
- meta.push(`default \`${docsDefaultValue(property.defaultValue)}\``);
267
- }
268
-
269
- if (property.constructOnly) {
270
- meta.push("construct-only");
271
- }
272
-
273
- if (!accessor.writable) {
274
- meta.push("read-only");
275
- } else if (!accessor.hasGetter) {
276
- meta.push("write-only");
277
- }
278
-
279
- if (origin !== undefined) {
280
- meta.push(`from \`${origin}\``);
400
+ const getAccessNotes = (accessor: ResolvedAccessor): string[] => {
401
+ if (!accessor.isWritable) {
402
+ return ["read-only"];
281
403
  }
282
404
 
283
- return meta.join(" · ");
405
+ return accessor.hasGetter ? [] : ["write-only"];
284
406
  };
285
407
 
286
- const sortedMetaBlocks = (entries: MetaDocEntry[]): string[] =>
287
- sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
288
-
289
408
  const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup, seen: Set<string>): MetaDocEntry[] => {
290
409
  const entries: MetaDocEntry[] = [];
291
410
 
@@ -305,18 +424,21 @@ const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup,
305
424
 
306
425
  entries.push({
307
426
  name: accessor.jsName,
308
- meta: propertyMeta(property, accessor, owner.origin),
427
+ meta: propertyMetaLine({
428
+ type: accessor.tsType,
429
+ property,
430
+ accessNotes: getAccessNotes(accessor),
431
+ origin: owner.origin,
432
+ }),
309
433
  doc: docMarkdown(property.doc),
434
+ tags: annotationSpec(property.annotations),
310
435
  });
311
436
  }
312
437
 
313
438
  return entries;
314
439
  };
315
440
 
316
- const propertiesSection = (
317
- entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
318
- library: Library,
319
- ): string[] => {
441
+ const propertiesSection = (entry: ClassPageSymbol, library: Library): string[] => {
320
442
  const seen: Set<string> = new Set();
321
443
  const entries: MetaDocEntry[] = [];
322
444
 
@@ -338,8 +460,8 @@ const propertiesSection = (
338
460
  return ["## Properties", intro, ...sortedMetaBlocks(entries)];
339
461
  };
340
462
 
341
- const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): SignalDocEntry[] => {
342
- const entries: SignalDocEntry[] = [];
463
+ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): OriginSignatureEntry[] => {
464
+ const entries: OriginSignatureEntry[] = [];
343
465
 
344
466
  for (const signal of owner.klass.signals) {
345
467
  if (seen.has(signal.name)) {
@@ -352,6 +474,7 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
352
474
  name: signal.name,
353
475
  signature: renderDocsSignalHandlerType(library, signal),
354
476
  doc: docMarkdown(signal.doc),
477
+ tags: signalTags(signal, false),
355
478
  origin: owner.origin,
356
479
  });
357
480
  }
@@ -359,9 +482,9 @@ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<stri
359
482
  return entries;
360
483
  };
361
484
 
362
- const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
485
+ const signalsSection = (entry: ClassSymbol, library: Library): string[] => {
363
486
  const seen: Set<string> = new Set();
364
- const entries: SignalDocEntry[] = [];
487
+ const entries: OriginSignatureEntry[] = [];
365
488
 
366
489
  for (const owner of memberOwners(entry, library)) {
367
490
  entries.push(...ownerSignalEntries(owner, library, seen));
@@ -378,16 +501,13 @@ const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Libr
378
501
  return ["## Signals", intro, ...originSignatureBlocks(entries)];
379
502
  };
380
503
 
381
- const classMethodsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] =>
504
+ const classMethodsSection = (entry: ClassSymbol, library: Library): string[] =>
382
505
  methodsSectionBlocks(
383
506
  classMethodEntries(library, entry.namespace, entry.klass),
384
507
  "Methods are called on instances. Methods inherited from ancestors are documented on their own pages.",
385
508
  );
386
509
 
387
- const classPage = (
388
- entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
389
- options: SymbolPageOptions,
390
- ): string => {
510
+ const classPage = (entry: ClassPageSymbol, options: SymbolPageOptions): string => {
391
511
  const { library } = options;
392
512
  const qualified = qualifiedName(entry);
393
513
  const docsContext = docsSignatureContext(entry.namespace, library);
@@ -417,6 +537,7 @@ const classPage = (
417
537
  ...propertiesSection(entry, library),
418
538
  ...signalsSection(entry, library),
419
539
  ...classMethodsSection(entry, library),
540
+ ...implementingSection(entry, library),
420
541
  ]);
421
542
  };
422
543
 
@@ -457,7 +578,12 @@ const recordInstanceEntries = (context: ModuleContext, record: GirRecord): Signa
457
578
  continue;
458
579
  }
459
580
 
460
- 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
+ });
461
587
  }
462
588
 
463
589
  return sortStringsBy(entries, (item) => item.name);
@@ -495,7 +621,11 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
495
621
  };
496
622
 
497
623
  const fieldMeta = (field: ResolvedRecordField): string =>
498
- [`\`${field.tsType}\``, ...(field.writable ? [] : ["read-only"])].join(" · ");
624
+ [
625
+ `\`${field.tsType}\``,
626
+ ...(field.isWritable ? [] : ["read-only"]),
627
+ ...deprecationMeta(field.annotations),
628
+ ].join(" · ");
499
629
 
500
630
  const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames: Set<string>): string[] => {
501
631
  const { slots } = computeRecordFieldSlots(context, record.fields, record.isUnion);
@@ -508,7 +638,12 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
508
638
  continue;
509
639
  }
510
640
 
511
- 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
+ });
512
647
  }
513
648
 
514
649
  if (entries.length === 0) {
@@ -518,16 +653,23 @@ const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames:
518
653
  return ["## Fields", ...sortedMetaBlocks(entries)];
519
654
  };
520
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
+
521
665
  const enumPage = (entry: GiSymbolBase & { kind: "enum"; enumeration: GirEnum }): string => {
522
666
  const { enumeration } = entry;
523
667
  const kindLabel = enumeration.errorDomain === undefined ? enumeration.kind : "error domain";
524
668
  const qualified = qualifiedName(entry);
525
669
 
526
- const rows = enumeration.members.map((member) => {
527
- const description = firstSentence(member.doc).replaceAll("|", String.raw`\|`);
528
-
529
- return `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${description} |`;
530
- });
670
+ const rows = enumeration.members.map(
671
+ (member) => `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${memberDescription(member)} |`,
672
+ );
531
673
 
532
674
  const usage =
533
675
  enumeration.errorDomain === undefined
@@ -546,7 +688,12 @@ const callbackPage = (entry: GiSymbolBase & { kind: "callback"; callback: GirCal
546
688
  const parameters = renderMethodSignature(docsContext, fn);
547
689
  const signature = `type ${entry.name} = (${parameters}) => ${renderMethodReturnType(docsContext, fn)}`;
548
690
 
549
- 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
+ ]);
550
697
  };
551
698
 
552
699
  const aliasPage = (entry: GiSymbolBase & { kind: "alias"; alias: GirAlias }, library: Library): string => {
@@ -571,9 +718,12 @@ const functionSignature = (context: ModuleContext, name: string, fn: GirFunction
571
718
 
572
719
  const functionPage = (entry: GiSymbolBase & { kind: "function"; fn: GirFunction }, library: Library): string => {
573
720
  const docsContext = docsSignatureContext(entry.namespace, library);
574
- 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 });
575
725
 
576
- return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``]);
726
+ return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``, ...pageTagNotes(spec)]);
577
727
  };
578
728
 
579
729
  const constantPage = (entry: GiSymbolBase & { kind: "constant"; constant: GirConstant }, library: Library): string => {
@@ -5,7 +5,6 @@ import { createRequire } from "node:module";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
8
- /** The freshness sentinel of the `@gtkx/gi` store, derived purely from the GIR inputs. */
9
8
  type GiFingerprint = {
10
9
  value: string;
11
10
  girFiles: string[];
@@ -15,16 +14,14 @@ type GiFingerprint = {
15
14
 
16
15
  type ModuleExport = { module: string; export: string };
17
16
 
18
- /** The `@gtkx/react` element config that shapes the generated `@gtkx/jsx` store. */
19
17
  type JsxFingerprintInput = {
20
18
  reactVersion: string;
21
19
  components: Record<string, ModuleExport>;
22
20
  lazyElements: string[];
23
21
  props: Record<string, ModuleExport>;
24
- omitProps: Record<string, string[]>;
22
+ omittedProps: Record<string, string[]>;
25
23
  };
26
24
 
27
- /** The freshness sentinel of the `@gtkx/jsx` store, derived from the React element config. */
28
25
  type JsxFingerprint = {
29
26
  value: string;
30
27
  intrinsicElementCount: number;
@@ -37,8 +34,6 @@ const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "o
37
34
 
38
35
  const sortAlpha = (values: string[]): string => sortStrings(values).join(",");
39
36
 
40
- // The overrides are copied verbatim into the store, so editing one changes the output even though no
41
- // GIR file moved. Without them in the hash a stale override survives every non-forced run.
42
37
  const overrideFiles = (): string[] => {
43
38
  if (!existsSync(OVERRIDES_ROOT)) {
44
39
  return [];
@@ -116,7 +111,7 @@ const hasMatchingRecordedInputs = (sentinel: GiFingerprint, libraries: string[],
116
111
  const serializeModuleExports = (map: Record<string, ModuleExport>): [string, string, string][] =>
117
112
  sortStrings(Object.keys(map)).map((type) => [type, map[type]?.module ?? "", map[type]?.export ?? ""]);
118
113
 
119
- const serializeOmitProps = (map: Record<string, string[]>): [string, string][] =>
114
+ const serializeOmittedProps = (map: Record<string, string[]>): [string, string][] =>
120
115
  sortStrings(Object.keys(map)).map((type) => [type, sortAlpha(map[type] ?? [])]);
121
116
 
122
117
  const hashJsx = (input: JsxFingerprintInput): string =>
@@ -128,7 +123,7 @@ const hashJsx = (input: JsxFingerprintInput): string =>
128
123
  serializeModuleExports(input.components),
129
124
  sortStrings(input.lazyElements),
130
125
  serializeModuleExports(input.props),
131
- serializeOmitProps(input.omitProps),
126
+ serializeOmittedProps(input.omittedProps),
132
127
  ]),
133
128
  )
134
129
  .digest("hex");
@@ -141,11 +136,11 @@ const computeJsxFingerprint = (input: JsxFingerprintInput, intrinsicElementCount
141
136
  const jsxStoreFreshness = (
142
137
  jsxStoreDir: string,
143
138
  input: JsxFingerprintInput,
144
- ): { fresh: boolean; intrinsicElementCount: number } => {
139
+ ): { isFresh: boolean; intrinsicElementCount: number } => {
145
140
  const sentinelPath = join(jsxStoreDir, FINGERPRINT_FILENAME);
146
141
 
147
142
  if (!existsSync(sentinelPath)) {
148
- return { fresh: false, intrinsicElementCount: 0 };
143
+ return { isFresh: false, intrinsicElementCount: 0 };
149
144
  }
150
145
 
151
146
  let sentinel: JsxFingerprint;
@@ -153,12 +148,12 @@ const jsxStoreFreshness = (
153
148
  try {
154
149
  sentinel = JSON.parse(readFileSync(sentinelPath, "utf8")) as JsxFingerprint;
155
150
  } catch {
156
- return { fresh: false, intrinsicElementCount: 0 };
151
+ return { isFresh: false, intrinsicElementCount: 0 };
157
152
  }
158
153
 
159
154
  return sentinel.value === hashJsx(input)
160
- ? { fresh: true, intrinsicElementCount: sentinel.intrinsicElementCount }
161
- : { fresh: false, intrinsicElementCount: 0 };
155
+ ? { isFresh: true, intrinsicElementCount: sentinel.intrinsicElementCount }
156
+ : { isFresh: false, intrinsicElementCount: 0 };
162
157
  };
163
158
 
164
159
  export {
@@ -169,5 +164,4 @@ export {
169
164
  jsxStoreFreshness,
170
165
  type GiFingerprint,
171
166
  type JsxFingerprintInput,
172
- type JsxFingerprint,
173
167
  };
package/src/gi.ts CHANGED
@@ -1,21 +1,16 @@
1
1
  import type { Library } from "./gir/library.js";
2
+ import type { StoreOptions } from "./store/store-fs.js";
2
3
  import { computeGiFingerprint } from "./fingerprint.js";
3
4
  import { namespaceDirectory } from "./gir/namespace.js";
4
- import { type GiNamespaceInput, type GiStoreOptions, writeGiStore } from "./store/gi-store.js";
5
+ import { type GiNamespaceInput, writeGiStore } from "./store/gi-store.js";
5
6
  import { generateNamespaceModule } from "./store/gi/pipeline.js";
6
7
 
7
8
  type GiCodegenOptions = {
8
- gi: GiStoreOptions;
9
+ gi: StoreOptions;
9
10
  libraries: string[];
10
11
  girPath: string[];
11
12
  };
12
13
 
13
- /**
14
- * Generates the `@gtkx/gi` store from the loaded GIR library and links it into the project. This is the
15
- * react-free half of codegen: it can run before `@gtkx/gi` (or `@gtkx/react`) exists, since it produces them.
16
- *
17
- * @returns The number of namespaces written.
18
- */
19
14
  const runGiCodegen = (library: Library, options: GiCodegenOptions): number => {
20
15
  const { gi, libraries, girPath } = options;
21
16
 
@@ -30,6 +25,4 @@ const runGiCodegen = (library: Library, options: GiCodegenOptions): number => {
30
25
  return library.namespaces.size;
31
26
  };
32
27
 
33
- export { isGiStoreFresh } from "./fingerprint.js";
34
- export type { GiStoreOptions } from "./store/gi-store.js";
35
- export { runGiCodegen, type GiCodegenOptions };
28
+ export { runGiCodegen };
@@ -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 };