@gtkx/codegen 1.0.0-rc.1 → 1.0.0-rc.3

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 (531) hide show
  1. package/dist/analysis/descriptor-render.d.ts +20 -11
  2. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  3. package/dist/analysis/descriptor-render.js +296 -152
  4. package/dist/analysis/descriptor-render.js.map +1 -1
  5. package/dist/analysis/descriptor.d.ts +37 -34
  6. package/dist/analysis/descriptor.d.ts.map +1 -1
  7. package/dist/analysis/descriptor.js +34 -30
  8. package/dist/analysis/descriptor.js.map +1 -1
  9. package/dist/analysis/inheritance.d.ts +16 -16
  10. package/dist/analysis/inheritance.d.ts.map +1 -1
  11. package/dist/analysis/inheritance.js +139 -84
  12. package/dist/analysis/inheritance.js.map +1 -1
  13. package/dist/analysis/param-structure.d.ts +14 -13
  14. package/dist/analysis/param-structure.d.ts.map +1 -1
  15. package/dist/analysis/param-structure.js +104 -53
  16. package/dist/analysis/param-structure.js.map +1 -1
  17. package/dist/analysis/ts-type.d.ts +6 -5
  18. package/dist/analysis/ts-type.d.ts.map +1 -1
  19. package/dist/analysis/ts-type.js +71 -29
  20. package/dist/analysis/ts-type.js.map +1 -1
  21. package/dist/compile.d.ts +5 -5
  22. package/dist/compile.d.ts.map +1 -1
  23. package/dist/compile.js +70 -63
  24. package/dist/compile.js.map +1 -1
  25. package/dist/docs/api-reference.d.ts +12 -11
  26. package/dist/docs/api-reference.d.ts.map +1 -1
  27. package/dist/docs/api-reference.js +192 -123
  28. package/dist/docs/api-reference.js.map +1 -1
  29. package/dist/docs/element-page.d.ts +6 -9
  30. package/dist/docs/element-page.d.ts.map +1 -1
  31. package/dist/docs/element-page.js +69 -133
  32. package/dist/docs/element-page.js.map +1 -1
  33. package/dist/docs/pipeline.d.ts +10 -7
  34. package/dist/docs/pipeline.d.ts.map +1 -1
  35. package/dist/docs/pipeline.js +81 -53
  36. package/dist/docs/pipeline.js.map +1 -1
  37. package/dist/docs/render.d.ts +21 -19
  38. package/dist/docs/render.d.ts.map +1 -1
  39. package/dist/docs/render.js +80 -71
  40. package/dist/docs/render.js.map +1 -1
  41. package/dist/docs/symbol-page.d.ts +6 -6
  42. package/dist/docs/symbol-page.d.ts.map +1 -1
  43. package/dist/docs/symbol-page.js +126 -84
  44. package/dist/docs/symbol-page.js.map +1 -1
  45. package/dist/fingerprint.d.ts +29 -5
  46. package/dist/fingerprint.d.ts.map +1 -1
  47. package/dist/fingerprint.js +69 -13
  48. package/dist/fingerprint.js.map +1 -1
  49. package/dist/gi.d.ts +18 -0
  50. package/dist/gi.d.ts.map +1 -0
  51. package/dist/gi.js +23 -0
  52. package/dist/gi.js.map +1 -0
  53. package/dist/gir/ancestry.d.ts +4 -3
  54. package/dist/gir/ancestry.d.ts.map +1 -1
  55. package/dist/gir/ancestry.js +12 -15
  56. package/dist/gir/ancestry.js.map +1 -1
  57. package/dist/gir/callback.d.ts +6 -11
  58. package/dist/gir/callback.d.ts.map +1 -1
  59. package/dist/gir/callback.js +6 -7
  60. package/dist/gir/callback.js.map +1 -1
  61. package/dist/gir/class.d.ts +7 -5
  62. package/dist/gir/class.d.ts.map +1 -1
  63. package/dist/gir/class.js +14 -12
  64. package/dist/gir/class.js.map +1 -1
  65. package/dist/gir/enum.d.ts +3 -3
  66. package/dist/gir/enum.d.ts.map +1 -1
  67. package/dist/gir/enum.js +7 -6
  68. package/dist/gir/enum.js.map +1 -1
  69. package/dist/gir/field.d.ts +8 -3
  70. package/dist/gir/field.d.ts.map +1 -1
  71. package/dist/gir/field.js +30 -7
  72. package/dist/gir/field.js.map +1 -1
  73. package/dist/gir/function.d.ts +6 -3
  74. package/dist/gir/function.d.ts.map +1 -1
  75. package/dist/gir/function.js +23 -7
  76. package/dist/gir/function.js.map +1 -1
  77. package/dist/gir/gir-path.d.ts +2 -1
  78. package/dist/gir/gir-path.d.ts.map +1 -1
  79. package/dist/gir/gir-path.js +26 -10
  80. package/dist/gir/gir-path.js.map +1 -1
  81. package/dist/gir/libraries.d.ts +5 -3
  82. package/dist/gir/libraries.d.ts.map +1 -1
  83. package/dist/gir/libraries.js +41 -28
  84. package/dist/gir/libraries.js.map +1 -1
  85. package/dist/gir/library.d.ts +17 -11
  86. package/dist/gir/library.d.ts.map +1 -1
  87. package/dist/gir/library.js +116 -92
  88. package/dist/gir/library.js.map +1 -1
  89. package/dist/gir/namespace.d.ts +10 -10
  90. package/dist/gir/namespace.d.ts.map +1 -1
  91. package/dist/gir/namespace.js +21 -20
  92. package/dist/gir/namespace.js.map +1 -1
  93. package/dist/gir/nullable-overrides.d.ts +3 -0
  94. package/dist/gir/nullable-overrides.d.ts.map +1 -0
  95. package/dist/gir/nullable-overrides.js +5 -0
  96. package/dist/gir/nullable-overrides.js.map +1 -0
  97. package/dist/gir/parameter.d.ts +14 -12
  98. package/dist/gir/parameter.d.ts.map +1 -1
  99. package/dist/gir/parameter.js +27 -18
  100. package/dist/gir/parameter.js.map +1 -1
  101. package/dist/gir/parse.d.ts +12 -13
  102. package/dist/gir/parse.d.ts.map +1 -1
  103. package/dist/gir/parse.js +50 -40
  104. package/dist/gir/parse.js.map +1 -1
  105. package/dist/gir/primitives.d.ts +5 -4
  106. package/dist/gir/primitives.d.ts.map +1 -1
  107. package/dist/gir/primitives.js +4 -3
  108. package/dist/gir/primitives.js.map +1 -1
  109. package/dist/gir/property.d.ts +5 -4
  110. package/dist/gir/property.d.ts.map +1 -1
  111. package/dist/gir/property.js +10 -9
  112. package/dist/gir/property.js.map +1 -1
  113. package/dist/gir/record.d.ts +5 -4
  114. package/dist/gir/record.d.ts.map +1 -1
  115. package/dist/gir/record.js +13 -12
  116. package/dist/gir/record.js.map +1 -1
  117. package/dist/gir/size.d.ts +6 -5
  118. package/dist/gir/size.d.ts.map +1 -1
  119. package/dist/gir/size.js +49 -47
  120. package/dist/gir/size.js.map +1 -1
  121. package/dist/gir/type-id.d.ts +17 -15
  122. package/dist/gir/type-id.d.ts.map +1 -1
  123. package/dist/gir/type-id.js +5 -1
  124. package/dist/gir/type-id.js.map +1 -1
  125. package/dist/gir/type-ref.d.ts +3 -2
  126. package/dist/gir/type-ref.d.ts.map +1 -1
  127. package/dist/gir/type-ref.js +36 -25
  128. package/dist/gir/type-ref.js.map +1 -1
  129. package/dist/gir/type.d.ts +3 -2
  130. package/dist/gir/type.d.ts.map +1 -1
  131. package/dist/gir/type.js.map +1 -1
  132. package/dist/index.d.ts +3 -0
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +2 -0
  135. package/dist/index.js.map +1 -1
  136. package/dist/jsx.d.ts +28 -0
  137. package/dist/jsx.d.ts.map +1 -0
  138. package/dist/jsx.js +44 -0
  139. package/dist/jsx.js.map +1 -0
  140. package/dist/khronos/args.d.ts +7 -7
  141. package/dist/khronos/args.d.ts.map +1 -1
  142. package/dist/khronos/args.js +88 -67
  143. package/dist/khronos/args.js.map +1 -1
  144. package/dist/khronos/jsdoc.d.ts +4 -4
  145. package/dist/khronos/jsdoc.d.ts.map +1 -1
  146. package/dist/khronos/jsdoc.js +29 -16
  147. package/dist/khronos/jsdoc.js.map +1 -1
  148. package/dist/khronos/model.d.ts +8 -7
  149. package/dist/khronos/model.d.ts.map +1 -1
  150. package/dist/khronos/model.js +94 -59
  151. package/dist/khronos/model.js.map +1 -1
  152. package/dist/khronos/modules.d.ts +4 -3
  153. package/dist/khronos/modules.d.ts.map +1 -1
  154. package/dist/khronos/modules.js +40 -25
  155. package/dist/khronos/modules.js.map +1 -1
  156. package/dist/khronos/param-pair.d.ts +11 -0
  157. package/dist/khronos/param-pair.d.ts.map +1 -0
  158. package/dist/khronos/param-pair.js +6 -0
  159. package/dist/khronos/param-pair.js.map +1 -0
  160. package/dist/khronos/parse.d.ts +7 -8
  161. package/dist/khronos/parse.d.ts.map +1 -1
  162. package/dist/khronos/parse.js +17 -16
  163. package/dist/khronos/parse.js.map +1 -1
  164. package/dist/khronos/pipeline.d.ts +4 -4
  165. package/dist/khronos/pipeline.d.ts.map +1 -1
  166. package/dist/khronos/pipeline.js +97 -56
  167. package/dist/khronos/pipeline.js.map +1 -1
  168. package/dist/khronos/plan.d.ts +11 -10
  169. package/dist/khronos/plan.d.ts.map +1 -1
  170. package/dist/khronos/plan.js +109 -45
  171. package/dist/khronos/plan.js.map +1 -1
  172. package/dist/khronos/render.d.ts +5 -4
  173. package/dist/khronos/render.d.ts.map +1 -1
  174. package/dist/khronos/render.js +106 -59
  175. package/dist/khronos/render.js.map +1 -1
  176. package/dist/khronos/select.d.ts +4 -4
  177. package/dist/khronos/select.d.ts.map +1 -1
  178. package/dist/khronos/select.js +30 -19
  179. package/dist/khronos/select.js.map +1 -1
  180. package/dist/react/element-config.d.ts +20 -0
  181. package/dist/react/element-config.d.ts.map +1 -0
  182. package/dist/react/element-config.js +64 -0
  183. package/dist/react/element-config.js.map +1 -0
  184. package/dist/runner.d.ts +19 -10
  185. package/dist/runner.d.ts.map +1 -1
  186. package/dist/runner.js +48 -43
  187. package/dist/runner.js.map +1 -1
  188. package/dist/store/compile-store.d.ts +5 -3
  189. package/dist/store/compile-store.d.ts.map +1 -1
  190. package/dist/store/compile-store.js +24 -22
  191. package/dist/store/compile-store.js.map +1 -1
  192. package/dist/store/gi/async.d.ts +2 -1
  193. package/dist/store/gi/async.d.ts.map +1 -1
  194. package/dist/store/gi/async.js +28 -24
  195. package/dist/store/gi/async.js.map +1 -1
  196. package/dist/store/gi/callables.d.ts +26 -20
  197. package/dist/store/gi/callables.d.ts.map +1 -1
  198. package/dist/store/gi/callables.js +157 -100
  199. package/dist/store/gi/callables.js.map +1 -1
  200. package/dist/store/gi/callback.d.ts +3 -2
  201. package/dist/store/gi/callback.d.ts.map +1 -1
  202. package/dist/store/gi/callback.js +6 -3
  203. package/dist/store/gi/callback.js.map +1 -1
  204. package/dist/store/gi/class.d.ts +2 -1
  205. package/dist/store/gi/class.d.ts.map +1 -1
  206. package/dist/store/gi/class.js +86 -47
  207. package/dist/store/gi/class.js.map +1 -1
  208. package/dist/store/gi/companion.d.ts +2 -1
  209. package/dist/store/gi/companion.d.ts.map +1 -1
  210. package/dist/store/gi/companion.js +8 -5
  211. package/dist/store/gi/companion.js.map +1 -1
  212. package/dist/store/gi/constant.d.ts +3 -2
  213. package/dist/store/gi/constant.d.ts.map +1 -1
  214. package/dist/store/gi/constant.js +25 -8
  215. package/dist/store/gi/constant.js.map +1 -1
  216. package/dist/store/gi/constructor-props.d.ts +3 -2
  217. package/dist/store/gi/constructor-props.d.ts.map +1 -1
  218. package/dist/store/gi/constructor-props.js +17 -10
  219. package/dist/store/gi/constructor-props.js.map +1 -1
  220. package/dist/store/gi/enum.d.ts +3 -2
  221. package/dist/store/gi/enum.d.ts.map +1 -1
  222. package/dist/store/gi/enum.js +14 -11
  223. package/dist/store/gi/enum.js.map +1 -1
  224. package/dist/store/gi/function.d.ts +5 -4
  225. package/dist/store/gi/function.d.ts.map +1 -1
  226. package/dist/store/gi/function.js +48 -23
  227. package/dist/store/gi/function.js.map +1 -1
  228. package/dist/store/gi/gtype-binding.d.ts +4 -4
  229. package/dist/store/gi/gtype-binding.d.ts.map +1 -1
  230. package/dist/store/gi/gtype-binding.js +15 -11
  231. package/dist/store/gi/gtype-binding.js.map +1 -1
  232. package/dist/store/gi/interface.d.ts +2 -1
  233. package/dist/store/gi/interface.d.ts.map +1 -1
  234. package/dist/store/gi/interface.js +36 -18
  235. package/dist/store/gi/interface.js.map +1 -1
  236. package/dist/store/gi/item-comparators.d.ts +3 -2
  237. package/dist/store/gi/item-comparators.d.ts.map +1 -1
  238. package/dist/store/gi/item-comparators.js +33 -21
  239. package/dist/store/gi/item-comparators.js.map +1 -1
  240. package/dist/store/gi/method.d.ts +13 -13
  241. package/dist/store/gi/method.d.ts.map +1 -1
  242. package/dist/store/gi/method.js +188 -130
  243. package/dist/store/gi/method.js.map +1 -1
  244. package/dist/store/gi/param-marshal.d.ts +7 -6
  245. package/dist/store/gi/param-marshal.d.ts.map +1 -1
  246. package/dist/store/gi/param-marshal.js +26 -13
  247. package/dist/store/gi/param-marshal.js.map +1 -1
  248. package/dist/store/gi/pipeline.d.ts +2 -1
  249. package/dist/store/gi/pipeline.d.ts.map +1 -1
  250. package/dist/store/gi/pipeline.js +38 -23
  251. package/dist/store/gi/pipeline.js.map +1 -1
  252. package/dist/store/gi/properties.d.ts +2 -1
  253. package/dist/store/gi/properties.d.ts.map +1 -1
  254. package/dist/store/gi/properties.js +6 -4
  255. package/dist/store/gi/properties.js.map +1 -1
  256. package/dist/store/gi/property-accessor.d.ts +11 -10
  257. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  258. package/dist/store/gi/property-accessor.js +86 -60
  259. package/dist/store/gi/property-accessor.js.map +1 -1
  260. package/dist/store/gi/record-constructor.d.ts +3 -2
  261. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  262. package/dist/store/gi/record-constructor.js +40 -28
  263. package/dist/store/gi/record-constructor.js.map +1 -1
  264. package/dist/store/gi/record-field-accessor.d.ts +9 -8
  265. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  266. package/dist/store/gi/record-field-accessor.js +187 -99
  267. package/dist/store/gi/record-field-accessor.js.map +1 -1
  268. package/dist/store/gi/record-layout.d.ts +6 -5
  269. package/dist/store/gi/record-layout.d.ts.map +1 -1
  270. package/dist/store/gi/record-layout.js +75 -39
  271. package/dist/store/gi/record-layout.js.map +1 -1
  272. package/dist/store/gi/record.d.ts +2 -1
  273. package/dist/store/gi/record.d.ts.map +1 -1
  274. package/dist/store/gi/record.js +15 -16
  275. package/dist/store/gi/record.js.map +1 -1
  276. package/dist/store/gi/registration.d.ts +3 -3
  277. package/dist/store/gi/registration.d.ts.map +1 -1
  278. package/dist/store/gi/registration.js +3 -2
  279. package/dist/store/gi/registration.js.map +1 -1
  280. package/dist/store/gi/return-wrap.d.ts +2 -2
  281. package/dist/store/gi/return-wrap.d.ts.map +1 -1
  282. package/dist/store/gi/return-wrap.js +43 -22
  283. package/dist/store/gi/return-wrap.js.map +1 -1
  284. package/dist/store/gi/runtime-override.d.ts +2 -1
  285. package/dist/store/gi/runtime-override.d.ts.map +1 -1
  286. package/dist/store/gi/runtime-override.js +6 -3
  287. package/dist/store/gi/runtime-override.js.map +1 -1
  288. package/dist/store/gi/signal.d.ts +3 -2
  289. package/dist/store/gi/signal.d.ts.map +1 -1
  290. package/dist/store/gi/signal.js +113 -66
  291. package/dist/store/gi/signal.js.map +1 -1
  292. package/dist/store/gi/value-marshalable.d.ts +15 -0
  293. package/dist/store/gi/value-marshalable.d.ts.map +1 -0
  294. package/dist/store/gi/value-marshalable.js +66 -0
  295. package/dist/store/gi/value-marshalable.js.map +1 -0
  296. package/dist/store/gi/vtable.d.ts +2 -1
  297. package/dist/store/gi/vtable.d.ts.map +1 -1
  298. package/dist/store/gi/vtable.js +60 -30
  299. package/dist/store/gi/vtable.js.map +1 -1
  300. package/dist/store/gi-store.d.ts +5 -4
  301. package/dist/store/gi-store.d.ts.map +1 -1
  302. package/dist/store/gi-store.js +4 -2
  303. package/dist/store/gi-store.js.map +1 -1
  304. package/dist/store/jsx/element-components.d.ts +23 -0
  305. package/dist/store/jsx/element-components.d.ts.map +1 -0
  306. package/dist/store/jsx/element-components.js +86 -0
  307. package/dist/store/jsx/element-components.js.map +1 -0
  308. package/dist/store/jsx/element-prop-imports.d.ts +17 -0
  309. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
  310. package/dist/store/jsx/element-prop-imports.js +15 -0
  311. package/dist/store/jsx/element-prop-imports.js.map +1 -0
  312. package/dist/store/jsx/element-prop-types.d.ts +10 -0
  313. package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
  314. package/dist/store/jsx/element-prop-types.js +41 -0
  315. package/dist/store/jsx/element-prop-types.js.map +1 -0
  316. package/dist/store/jsx/gir-index.d.ts +16 -0
  317. package/dist/store/jsx/gir-index.d.ts.map +1 -0
  318. package/dist/store/jsx/gir-index.js +33 -0
  319. package/dist/store/jsx/gir-index.js.map +1 -0
  320. package/dist/store/jsx/intrinsic-elements.d.ts +26 -0
  321. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
  322. package/dist/store/jsx/intrinsic-elements.js +127 -0
  323. package/dist/store/jsx/intrinsic-elements.js.map +1 -0
  324. package/dist/store/{react → jsx}/jsx.d.ts +2 -4
  325. package/dist/store/jsx/jsx.d.ts.map +1 -0
  326. package/dist/store/{react → jsx}/jsx.js +110 -71
  327. package/dist/store/jsx/jsx.js.map +1 -0
  328. package/dist/store/jsx/metadata.d.ts +4 -0
  329. package/dist/store/jsx/metadata.d.ts.map +1 -0
  330. package/dist/store/{react → jsx}/metadata.js +148 -69
  331. package/dist/store/jsx/metadata.js.map +1 -0
  332. package/dist/store/jsx/omitted-props.d.ts +10 -0
  333. package/dist/store/jsx/omitted-props.d.ts.map +1 -0
  334. package/dist/store/jsx/omitted-props.js +22 -0
  335. package/dist/store/jsx/omitted-props.js.map +1 -0
  336. package/dist/store/jsx/pipeline.d.ts +23 -0
  337. package/dist/store/jsx/pipeline.d.ts.map +1 -0
  338. package/dist/store/{react → jsx}/pipeline.js +38 -15
  339. package/dist/store/jsx/pipeline.js.map +1 -0
  340. package/dist/store/{react → jsx}/props.d.ts +9 -12
  341. package/dist/store/jsx/props.d.ts.map +1 -0
  342. package/dist/store/jsx/props.js +153 -0
  343. package/dist/store/jsx/props.js.map +1 -0
  344. package/dist/store/jsx-store.d.ts +5 -3
  345. package/dist/store/jsx-store.d.ts.map +1 -1
  346. package/dist/store/jsx-store.js +4 -1
  347. package/dist/store/jsx-store.js.map +1 -1
  348. package/dist/store/store-fs.d.ts +14 -12
  349. package/dist/store/store-fs.d.ts.map +1 -1
  350. package/dist/store/store-fs.js +9 -7
  351. package/dist/store/store-fs.js.map +1 -1
  352. package/dist/writer/context.d.ts +2 -1
  353. package/dist/writer/context.d.ts.map +1 -1
  354. package/dist/writer/context.js +12 -6
  355. package/dist/writer/context.js.map +1 -1
  356. package/dist/writer/doc.d.ts +2 -1
  357. package/dist/writer/doc.d.ts.map +1 -1
  358. package/dist/writer/doc.js +13 -7
  359. package/dist/writer/doc.js.map +1 -1
  360. package/dist/writer/emit.d.ts +8 -7
  361. package/dist/writer/emit.d.ts.map +1 -1
  362. package/dist/writer/emit.js +13 -10
  363. package/dist/writer/emit.js.map +1 -1
  364. package/dist/writer/gtk-doc.d.ts +2 -1
  365. package/dist/writer/gtk-doc.d.ts.map +1 -1
  366. package/dist/writer/gtk-doc.js +29 -18
  367. package/dist/writer/gtk-doc.js.map +1 -1
  368. package/dist/writer/imports.d.ts +4 -2
  369. package/dist/writer/imports.d.ts.map +1 -1
  370. package/dist/writer/imports.js +35 -24
  371. package/dist/writer/imports.js.map +1 -1
  372. package/dist/writer/module.d.ts +3 -2
  373. package/dist/writer/module.d.ts.map +1 -1
  374. package/dist/writer/module.js +16 -9
  375. package/dist/writer/module.js.map +1 -1
  376. package/dist/xml.d.ts +4 -0
  377. package/dist/xml.d.ts.map +1 -0
  378. package/dist/xml.js +10 -0
  379. package/dist/xml.js.map +1 -0
  380. package/overrides/cairo/context.ts.ejs +7 -7
  381. package/overrides/cairo/matrix.ts.ejs +2 -2
  382. package/overrides/cairo/recording-surface.ts.ejs +2 -2
  383. package/overrides/cairo/region.ts.ejs +1 -1
  384. package/overrides/cairo/scaled-font.ts.ejs +3 -3
  385. package/package.json +14 -9
  386. package/src/analysis/descriptor-render.ts +516 -168
  387. package/src/analysis/descriptor.ts +162 -125
  388. package/src/analysis/inheritance.ts +286 -98
  389. package/src/analysis/param-structure.ts +188 -57
  390. package/src/analysis/ts-type.ts +113 -34
  391. package/src/compile.ts +103 -76
  392. package/src/docs/api-reference.ts +337 -146
  393. package/src/docs/element-page.ts +137 -150
  394. package/src/docs/pipeline.ts +135 -73
  395. package/src/docs/render.ts +151 -87
  396. package/src/docs/symbol-page.ts +268 -123
  397. package/src/fingerprint.ts +138 -26
  398. package/src/gi.ts +35 -0
  399. package/src/gir/ancestry.ts +26 -14
  400. package/src/gir/callback.ts +10 -15
  401. package/src/gir/class.ts +20 -16
  402. package/src/gir/enum.ts +9 -7
  403. package/src/gir/field.ts +37 -8
  404. package/src/gir/function.ts +33 -9
  405. package/src/gir/gir-path.ts +36 -12
  406. package/src/gir/libraries.ts +59 -33
  407. package/src/gir/library.ts +200 -97
  408. package/src/gir/namespace.ts +42 -26
  409. package/src/gir/nullable-overrides.ts +5 -0
  410. package/src/gir/parameter.ts +80 -42
  411. package/src/gir/parse.ts +102 -47
  412. package/src/gir/primitives.ts +25 -23
  413. package/src/gir/property.ts +13 -11
  414. package/src/gir/record.ts +16 -14
  415. package/src/gir/size.ts +91 -58
  416. package/src/gir/type-id.ts +33 -18
  417. package/src/gir/type-ref.ts +62 -26
  418. package/src/gir/type.ts +10 -8
  419. package/src/index.ts +8 -0
  420. package/src/jsx.ts +75 -0
  421. package/src/khronos/args.ts +158 -89
  422. package/src/khronos/jsdoc.ts +67 -29
  423. package/src/khronos/model.ts +154 -53
  424. package/src/khronos/modules.ts +67 -27
  425. package/src/khronos/param-pair.ts +14 -0
  426. package/src/khronos/parse.ts +37 -17
  427. package/src/khronos/pipeline.ts +193 -90
  428. package/src/khronos/plan.ts +235 -86
  429. package/src/khronos/render.ts +208 -71
  430. package/src/khronos/select.ts +48 -18
  431. package/src/react/element-config.ts +97 -0
  432. package/src/runner.ts +100 -57
  433. package/src/store/compile-store.ts +32 -26
  434. package/src/store/gi/async.ts +48 -21
  435. package/src/store/gi/callables.ts +339 -136
  436. package/src/store/gi/callback.ts +13 -4
  437. package/src/store/gi/class.ts +186 -64
  438. package/src/store/gi/companion.ts +15 -6
  439. package/src/store/gi/constant.ts +42 -8
  440. package/src/store/gi/constructor-props.ts +42 -16
  441. package/src/store/gi/enum.ts +28 -13
  442. package/src/store/gi/function.ts +88 -24
  443. package/src/store/gi/gtype-binding.ts +31 -18
  444. package/src/store/gi/interface.ts +101 -36
  445. package/src/store/gi/item-comparators.ts +74 -26
  446. package/src/store/gi/method.ts +377 -159
  447. package/src/store/gi/param-marshal.ts +38 -15
  448. package/src/store/gi/pipeline.ts +72 -22
  449. package/src/store/gi/properties.ts +16 -5
  450. package/src/store/gi/property-accessor.ts +192 -84
  451. package/src/store/gi/record-constructor.ts +70 -33
  452. package/src/store/gi/record-field-accessor.ts +415 -167
  453. package/src/store/gi/record-layout.ts +130 -43
  454. package/src/store/gi/record.ts +29 -15
  455. package/src/store/gi/registration.ts +15 -9
  456. package/src/store/gi/return-wrap.ts +71 -23
  457. package/src/store/gi/runtime-override.ts +13 -3
  458. package/src/store/gi/signal.ts +244 -104
  459. package/src/store/gi/value-marshalable.ts +96 -0
  460. package/src/store/gi/vtable.ts +117 -41
  461. package/src/store/gi-store.ts +26 -13
  462. package/src/store/jsx/element-components.ts +152 -0
  463. package/src/store/jsx/element-prop-imports.ts +24 -0
  464. package/src/store/jsx/element-prop-types.ts +59 -0
  465. package/src/store/jsx/gir-index.ts +62 -0
  466. package/src/store/jsx/intrinsic-elements.ts +253 -0
  467. package/src/store/{react → jsx}/jsx.ts +213 -99
  468. package/src/store/jsx/metadata.ts +385 -0
  469. package/src/store/jsx/omitted-props.ts +32 -0
  470. package/src/store/jsx/pipeline.ts +148 -0
  471. package/src/store/jsx/props.ts +262 -0
  472. package/src/store/jsx-store.ts +15 -3
  473. package/src/store/store-fs.ts +36 -20
  474. package/src/writer/context.ts +25 -6
  475. package/src/writer/doc.ts +19 -5
  476. package/src/writer/emit.ts +20 -11
  477. package/src/writer/gtk-doc.ts +48 -21
  478. package/src/writer/imports.ts +63 -28
  479. package/src/writer/module.ts +35 -11
  480. package/src/xml.ts +12 -0
  481. package/dist/store/gi/class-struct-record.d.ts +0 -9
  482. package/dist/store/gi/class-struct-record.d.ts.map +0 -1
  483. package/dist/store/gi/class-struct-record.js +0 -34
  484. package/dist/store/gi/class-struct-record.js.map +0 -1
  485. package/dist/store/react/built-ins.d.ts +0 -9
  486. package/dist/store/react/built-ins.d.ts.map +0 -1
  487. package/dist/store/react/built-ins.js +0 -226
  488. package/dist/store/react/built-ins.js.map +0 -1
  489. package/dist/store/react/element-components.d.ts +0 -15
  490. package/dist/store/react/element-components.d.ts.map +0 -1
  491. package/dist/store/react/element-components.js +0 -92
  492. package/dist/store/react/element-components.js.map +0 -1
  493. package/dist/store/react/element-prop-types.d.ts +0 -19
  494. package/dist/store/react/element-prop-types.d.ts.map +0 -1
  495. package/dist/store/react/element-prop-types.js +0 -244
  496. package/dist/store/react/element-prop-types.js.map +0 -1
  497. package/dist/store/react/element-props.d.ts +0 -4
  498. package/dist/store/react/element-props.d.ts.map +0 -1
  499. package/dist/store/react/element-props.js +0 -178
  500. package/dist/store/react/element-props.js.map +0 -1
  501. package/dist/store/react/gir-index.d.ts +0 -25
  502. package/dist/store/react/gir-index.d.ts.map +0 -1
  503. package/dist/store/react/gir-index.js +0 -55
  504. package/dist/store/react/gir-index.js.map +0 -1
  505. package/dist/store/react/intrinsic-elements.d.ts +0 -26
  506. package/dist/store/react/intrinsic-elements.d.ts.map +0 -1
  507. package/dist/store/react/intrinsic-elements.js +0 -107
  508. package/dist/store/react/intrinsic-elements.js.map +0 -1
  509. package/dist/store/react/jsx.d.ts.map +0 -1
  510. package/dist/store/react/jsx.js.map +0 -1
  511. package/dist/store/react/metadata.d.ts +0 -4
  512. package/dist/store/react/metadata.d.ts.map +0 -1
  513. package/dist/store/react/metadata.js.map +0 -1
  514. package/dist/store/react/pipeline.d.ts +0 -14
  515. package/dist/store/react/pipeline.d.ts.map +0 -1
  516. package/dist/store/react/pipeline.js.map +0 -1
  517. package/dist/store/react/props.d.ts.map +0 -1
  518. package/dist/store/react/props.js +0 -133
  519. package/dist/store/react/props.js.map +0 -1
  520. package/overrides/gtk/constants.ts.ejs +0 -3
  521. package/overrides/gtk/index.ts.ejs +0 -2
  522. package/src/store/gi/class-struct-record.ts +0 -40
  523. package/src/store/react/built-ins.ts +0 -260
  524. package/src/store/react/element-components.ts +0 -138
  525. package/src/store/react/element-prop-types.ts +0 -280
  526. package/src/store/react/element-props.ts +0 -204
  527. package/src/store/react/gir-index.ts +0 -85
  528. package/src/store/react/intrinsic-elements.ts +0 -161
  529. package/src/store/react/metadata.ts +0 -197
  530. package/src/store/react/pipeline.ts +0 -90
  531. package/src/store/react/props.ts +0 -197
@@ -1,19 +1,21 @@
1
- import { sortStringsBy, toPascalCase } from "@gtkx/utils";
2
- import { reservedSignalMemberRename } from "../analysis/inheritance.js";
3
- import { renderTsType } from "../analysis/ts-type.js";
4
- import { ancestorChain } from "../gir/ancestry.js";
5
- import { callbackAsFunction, type GirCallback } from "../gir/callback.js";
1
+ import { pascalCase, sortStringsBy } from "@gtkx/utils";
6
2
  import type { GirClass } from "../gir/class.js";
7
3
  import type { GirEnum } from "../gir/enum.js";
8
4
  import type { GirFunction } from "../gir/function.js";
9
5
  import type { Library } from "../gir/library.js";
10
- import { type GirAlias, type GirConstant, type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
11
- import { PRIMITIVE_TS_TYPE, primitiveCategory } from "../gir/primitives.js";
12
6
  import type { GirProperty } from "../gir/property.js";
13
7
  import type { GirRecord } from "../gir/record.js";
8
+ import type { ModuleContext } from "../writer/context.js";
9
+ import { reservedSignalMemberRename } from "../analysis/inheritance.js";
10
+ import { renderTsType } from "../analysis/ts-type.js";
11
+ import { ancestorChain } from "../gir/ancestry.js";
12
+ import { callbackAsFunction, type GirCallback } from "../gir/callback.js";
13
+ import { type GirAlias, type GirConstant, type GirNamespace, namespaceDirectory } from "../gir/namespace.js";
14
+ import { PRIMITIVE_TS_TYPE, primitiveCategory } from "../gir/primitives.js";
14
15
  import {
15
16
  dedupeCallables,
16
17
  indexMethodsByName,
18
+ instanceScope,
17
19
  matchStaticFinishFunction,
18
20
  renderInstanceMethodSignature,
19
21
  renderStaticSignature,
@@ -26,25 +28,25 @@ import {
26
28
  renderMethodSignature,
27
29
  renderPromisifiedSignature,
28
30
  } from "../store/gi/method.js";
29
- import { type ResolvedAccessor, resolveAccessor } from "../store/gi/property-accessor.js";
31
+ import { resolveAccessor, type ResolvedAccessor } from "../store/gi/property-accessor.js";
30
32
  import { resolveRecordFieldEntry } from "../store/gi/record-field-accessor.js";
31
33
  import { computeRecordFieldSlots } from "../store/gi/record-layout.js";
32
- import { implementedInterfaces, newlyImplementedInterfaces } from "../store/react/intrinsic-elements.js";
33
- import type { ModuleContext } from "../writer/context.js";
34
+ import { implementedInterfaces, newlyImplementedInterfaces } from "../store/jsx/intrinsic-elements.js";
34
35
  import {
35
36
  classMethodEntries,
36
37
  docMarkdown,
37
38
  docsDefaultValue,
38
39
  docsSignatureContext,
39
40
  firstSentence,
41
+ implementsLine,
40
42
  joinSections,
41
43
  metaBlock,
42
44
  methodsSectionBlocks,
43
45
  originSignatureBlocks,
44
46
  renderDocsSignalHandlerType,
45
47
  renderDocsType,
46
- type SignatureEntry,
47
48
  signatureBlock,
49
+ type SignatureEntry,
48
50
  } from "./render.js";
49
51
 
50
52
  type GiSymbolBase = {
@@ -53,25 +55,51 @@ type GiSymbolBase = {
53
55
  doc: string | undefined;
54
56
  };
55
57
 
56
- export type GiSymbolEntry =
57
- | (GiSymbolBase & { kind: "class" | "interface"; klass: GirClass })
58
- | (GiSymbolBase & { kind: "record"; record: GirRecord })
59
- | (GiSymbolBase & { kind: "enum"; enumeration: GirEnum })
60
- | (GiSymbolBase & { kind: "callback"; callback: GirCallback })
61
- | (GiSymbolBase & { kind: "alias"; alias: GirAlias })
62
- | (GiSymbolBase & { kind: "function"; fn: GirFunction })
63
- | (GiSymbolBase & { kind: "constant"; constant: GirConstant });
58
+ 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 });
64
66
 
65
- export type SymbolPageOptions = {
67
+ type SymbolPageOptions = {
66
68
  library: Library;
67
69
  elementNameFor: (namespaceName: string, className: string) => string | undefined;
68
70
  };
69
71
 
72
+ type StaticSectionOptions = {
73
+ title: string;
74
+ intro: string;
75
+ context: ModuleContext;
76
+ callables: GirFunction[];
77
+ siblings: GirFunction[];
78
+ returnTypeOverride?: string;
79
+ };
80
+
81
+ type MemberOwner = {
82
+ klass: GirClass;
83
+ namespace: GirNamespace;
84
+ origin: string | undefined;
85
+ };
86
+
87
+ type PropertyAccessorSetup = {
88
+ context: ModuleContext;
89
+ claimedNames: Set<string>;
90
+ methodByName: Map<string, GirFunction>;
91
+ };
92
+
93
+ type MetaDocEntry = { name: string; meta: string; doc: string };
94
+ type SignalDocEntry = { name: string; signature: string; doc: string; origin: string | undefined };
95
+ type ResolvedRecordField = NonNullable<ReturnType<typeof resolveRecordFieldEntry>>;
96
+
70
97
  const qualifiedName = (entry: GiSymbolBase): string => `${entry.namespace.name}.${entry.name}`;
71
98
 
72
99
  const frontmatter = (entry: GiSymbolBase, kindLabel: string): string => {
73
100
  const sentence = firstSentence(entry.doc);
74
101
  const description = sentence.length > 0 ? sentence : `API reference for the ${qualifiedName(entry)} ${kindLabel}.`;
102
+
75
103
  return `---\ndescription: ${JSON.stringify(description)}\n---`;
76
104
  };
77
105
 
@@ -90,78 +118,91 @@ const pageHeader = (entry: GiSymbolEntry, kindLabel: string): string[] => [
90
118
  ];
91
119
 
92
120
  const qualifiedClassName = (namespaceName: string, className: string): string =>
93
- `${namespaceName}.${toPascalCase(className)}`;
121
+ `${namespaceName}.${pascalCase(className)}`;
94
122
 
95
123
  const elementNote = (entry: GiSymbolBase & { klass: GirClass }, options: SymbolPageOptions): string[] => {
96
124
  const glibName = options.elementNameFor(entry.namespace.name, entry.klass.name);
97
- if (glibName === undefined) return [];
125
+
126
+ if (glibName === undefined) {
127
+ return [];
128
+ }
129
+
98
130
  return [
99
- `Also available as the \`${glibName}\` JSX element from \`@gtkx/jsx/${namespaceDirectory(entry.namespace)}\`; the \`${glibName}\` element page documents the JSX props.`,
131
+ `Also available as the \`${glibName}\` JSX element from ` +
132
+ `\`@gtkx/jsx/${namespaceDirectory(entry.namespace)}\`; the \`${glibName}\` element page ` +
133
+ "documents the JSX props.",
100
134
  ];
101
135
  };
102
136
 
103
137
  const hierarchySection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
104
- const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).reverse();
138
+ const ancestors = [...ancestorChain(library, entry.klass, entry.namespace.name)].slice(1).toReversed();
139
+
105
140
  const interfaces = implementedInterfaces(entry.klass, entry.namespace, library).map((iface) =>
106
141
  qualifiedClassName(iface.namespace.name, iface.klass.name),
107
142
  );
108
- if (ancestors.length === 0 && interfaces.length === 0) return [];
143
+
144
+ if (ancestors.length === 0 && interfaces.length === 0) {
145
+ return [];
146
+ }
147
+
109
148
  const lines = ["## Hierarchy"];
149
+
110
150
  if (ancestors.length > 0) {
111
151
  const parts = ancestors.map(
112
152
  (ancestor) => `\`${qualifiedClassName(ancestor.namespaceName, ancestor.klass.name)}\``,
113
153
  );
154
+
114
155
  parts.push(`**${qualifiedName(entry)}**`);
115
156
  lines.push(parts.join(" → "));
116
157
  }
117
- if (interfaces.length > 0) {
118
- lines.push(`Implements ${interfaces.map((name) => `\`${name}\``).join(", ")}.`);
119
- }
158
+
159
+ lines.push(...implementsLine(interfaces));
160
+
120
161
  return lines;
121
162
  };
122
163
 
123
164
  const prerequisitesLine = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
124
165
  const names = entry.klass.prerequisites.map((name) => {
125
166
  const resolved = library.resolveType(entry.namespace.name, name);
167
+
126
168
  if (resolved === undefined || (resolved.kind !== "class" && resolved.kind !== "interface")) {
127
169
  return `\`${name}\``;
128
170
  }
171
+
129
172
  return `\`${qualifiedClassName(resolved.namespace.name, resolved.value.name)}\``;
130
173
  });
131
- if (names.length === 0) return [];
132
- return [`Requires ${names.join(", ")}.`];
133
- };
134
174
 
135
- type StaticSectionOptions = {
136
- title: string;
137
- intro: string;
138
- context: ModuleContext;
139
- callables: GirFunction[];
140
- siblings: GirFunction[];
141
- returnTypeOverride?: string;
175
+ if (names.length === 0) {
176
+ return [];
177
+ }
178
+
179
+ return [`Requires ${names.join(", ")}.`];
142
180
  };
143
181
 
144
182
  const staticSection = (options: StaticSectionOptions): string[] => {
145
183
  const rendered: { name: string; block: string }[] = [];
184
+
146
185
  for (const callable of dedupeCallables(options.callables)) {
147
186
  const signature = renderStaticSignature(options.context, callable, {
148
187
  returnTypeOverride: options.returnTypeOverride,
149
188
  siblings: options.siblings,
150
189
  });
151
- if (signature === undefined) continue;
190
+
191
+ if (signature === undefined) {
192
+ continue;
193
+ }
194
+
152
195
  rendered.push({
153
196
  name: signature.name,
154
197
  block: signatureBlock(signature.name, signature.signature, [docMarkdown(callable.doc)]),
155
198
  });
156
199
  }
157
- if (rendered.length === 0) return [];
158
- return [options.title, options.intro, ...sortStringsBy(rendered, (item) => item.name).map((item) => item.block)];
159
- };
160
200
 
161
- type MemberOwner = {
162
- klass: GirClass;
163
- namespace: GirNamespace;
164
- origin: string | undefined;
201
+ if (rendered.length === 0) {
202
+ return [];
203
+ }
204
+
205
+ return [options.title, options.intro, ...sortStringsBy(rendered, (item) => item.name).map((item) => item.block)];
165
206
  };
166
207
 
167
208
  const memberOwners = (entry: GiSymbolBase & { klass: GirClass }, library: Library): MemberOwner[] => [
@@ -175,35 +216,42 @@ const memberOwners = (entry: GiSymbolBase & { klass: GirClass }, library: Librar
175
216
 
176
217
  const interfaceMethodNames = (library: Library, owner: MemberOwner): string[] => {
177
218
  const context = docsSignatureContext(owner.namespace, library);
178
- const className = toPascalCase(owner.klass.name);
219
+ const className = pascalCase(owner.klass.name);
179
220
  const methods = dedupeCallables(owner.klass.methods);
180
- const methodByName = indexMethodsByName(methods);
221
+
222
+ const scope = instanceScope(className, {
223
+ constructors: dedupeCallables(owner.klass.constructors),
224
+ functions: dedupeCallables(owner.klass.functions),
225
+ methods,
226
+ });
227
+
181
228
  const names: string[] = [];
229
+
182
230
  for (const callable of methods) {
183
231
  const rename = reservedSignalMemberRename(className, callable);
184
- const rendered = renderInstanceMethodSignature(context, { ...callable, doc: undefined }, methodByName, rename);
185
- if (rendered === undefined) continue;
232
+ const rendered = renderInstanceMethodSignature(context, { ...callable, doc: undefined }, scope, rename);
233
+
234
+ if (rendered === undefined) {
235
+ continue;
236
+ }
237
+
186
238
  names.push(rename ?? methodExportName(callable));
187
239
  }
188
- return names;
189
- };
190
240
 
191
- type PropertyAccessorSetup = {
192
- context: ModuleContext;
193
- claimedNames: Set<string>;
194
- methodByName: Map<string, GirFunction>;
241
+ return names;
195
242
  };
196
243
 
197
244
  const propertyAccessorSetup = (
198
245
  owner: MemberOwner,
199
246
  library: Library,
200
- useClassRenames: boolean,
247
+ isUseClassRenames: boolean,
201
248
  ): PropertyAccessorSetup => {
202
249
  const claimedNames = new Set(
203
- useClassRenames
250
+ isUseClassRenames
204
251
  ? classMethodEntries(library, owner.namespace, owner.klass).map((item) => item.name)
205
252
  : interfaceMethodNames(library, owner),
206
253
  );
254
+
207
255
  return {
208
256
  context: docsSignatureContext(owner.namespace, library),
209
257
  claimedNames,
@@ -213,61 +261,120 @@ const propertyAccessorSetup = (
213
261
 
214
262
  const propertyMeta = (property: GirProperty, accessor: ResolvedAccessor, origin: string | undefined): string => {
215
263
  const meta: string[] = [`\`${accessor.tsType}\``];
216
- if (property.defaultValue !== undefined) meta.push(`default \`${docsDefaultValue(property.defaultValue)}\``);
217
- if (property.constructOnly) meta.push("construct-only");
218
- if (!accessor.writable) meta.push("read-only");
219
- else if (!accessor.hasGetter) meta.push("write-only");
220
- if (origin !== undefined) meta.push(`from \`${origin}\``);
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}\``);
281
+ }
282
+
221
283
  return meta.join(" · ");
222
284
  };
223
285
 
286
+ const sortedMetaBlocks = (entries: MetaDocEntry[]): string[] =>
287
+ sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
288
+
289
+ const ownerPropertyEntries = (owner: MemberOwner, setup: PropertyAccessorSetup, seen: Set<string>): MetaDocEntry[] => {
290
+ const entries: MetaDocEntry[] = [];
291
+
292
+ for (const property of owner.klass.properties) {
293
+ const accessor = resolveAccessor({
294
+ context: setup.context,
295
+ property,
296
+ claimedNames: setup.claimedNames,
297
+ methodByName: setup.methodByName,
298
+ });
299
+
300
+ if (accessor === undefined || seen.has(accessor.jsName)) {
301
+ continue;
302
+ }
303
+
304
+ seen.add(accessor.jsName);
305
+
306
+ entries.push({
307
+ name: accessor.jsName,
308
+ meta: propertyMeta(property, accessor, owner.origin),
309
+ doc: docMarkdown(property.doc),
310
+ });
311
+ }
312
+
313
+ return entries;
314
+ };
315
+
224
316
  const propertiesSection = (
225
317
  entry: GiSymbolBase & { kind: "class" | "interface"; klass: GirClass },
226
318
  library: Library,
227
319
  ): string[] => {
228
- const seen = new Set<string>();
229
- const entries: { name: string; meta: string; doc: string }[] = [];
320
+ const seen: Set<string> = new Set();
321
+ const entries: MetaDocEntry[] = [];
322
+
230
323
  for (const [index, owner] of memberOwners(entry, library).entries()) {
231
- const setup = propertyAccessorSetup(owner, library, index === 0 && entry.kind === "class");
232
- for (const property of owner.klass.properties) {
233
- const accessor = resolveAccessor({
234
- context: setup.context,
235
- property,
236
- claimedNames: setup.claimedNames,
237
- methodByName: setup.methodByName,
238
- });
239
- if (accessor === undefined || seen.has(accessor.jsName)) continue;
240
- seen.add(accessor.jsName);
241
- entries.push({
242
- name: accessor.jsName,
243
- meta: propertyMeta(property, accessor, owner.origin),
244
- doc: docMarkdown(property.doc),
245
- });
324
+ const isUseClassRenames = index === 0 && entry.kind === "class";
325
+ const setup = propertyAccessorSetup(owner, library, isUseClassRenames);
326
+ entries.push(...ownerPropertyEntries(owner, setup, seen));
327
+ }
328
+
329
+ if (entries.length === 0) {
330
+ return [];
331
+ }
332
+
333
+ const intro =
334
+ "Properties are read and written as instance fields; changes can be observed with " +
335
+ "`connect(\"notify::<property-name>\", handler)`. Properties inherited from ancestors are " +
336
+ "documented on their own pages.";
337
+
338
+ return ["## Properties", intro, ...sortedMetaBlocks(entries)];
339
+ };
340
+
341
+ const ownerSignalEntries = (owner: MemberOwner, library: Library, seen: Set<string>): SignalDocEntry[] => {
342
+ const entries: SignalDocEntry[] = [];
343
+
344
+ for (const signal of owner.klass.signals) {
345
+ if (seen.has(signal.name)) {
346
+ continue;
246
347
  }
348
+
349
+ seen.add(signal.name);
350
+
351
+ entries.push({
352
+ name: signal.name,
353
+ signature: renderDocsSignalHandlerType(library, signal),
354
+ doc: docMarkdown(signal.doc),
355
+ origin: owner.origin,
356
+ });
247
357
  }
248
- if (entries.length === 0) return [];
249
- const intro = `Properties are read and written as instance fields; changes can be observed with \`connect("notify::<property-name>", handler)\`. Properties inherited from ancestors are documented on their own pages.`;
250
- const blocks = sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
251
- return ["## Properties", intro, ...blocks];
358
+
359
+ return entries;
252
360
  };
253
361
 
254
362
  const signalsSection = (entry: GiSymbolBase & { klass: GirClass }, library: Library): string[] => {
255
- const seen = new Set<string>();
256
- const entries: { name: string; signature: string; doc: string; origin: string | undefined }[] = [];
363
+ const seen: Set<string> = new Set();
364
+ const entries: SignalDocEntry[] = [];
365
+
257
366
  for (const owner of memberOwners(entry, library)) {
258
- for (const signal of owner.klass.signals) {
259
- if (seen.has(signal.name)) continue;
260
- seen.add(signal.name);
261
- entries.push({
262
- name: signal.name,
263
- signature: renderDocsSignalHandlerType(library, signal),
264
- doc: docMarkdown(signal.doc),
265
- origin: owner.origin,
266
- });
267
- }
367
+ entries.push(...ownerSignalEntries(owner, library, seen));
368
+ }
369
+
370
+ if (entries.length === 0) {
371
+ return [];
268
372
  }
269
- if (entries.length === 0) return [];
270
- const intro = `Connect with \`instance.connect("<signal>", handler)\` or \`instance.on("<signal>", handler)\`. Signals inherited from ancestors are documented on their own pages.`;
373
+
374
+ const intro =
375
+ "Connect with `instance.connect(\"<signal>\", handler)` or `instance.on(\"<signal>\", handler)`. " +
376
+ "Signals inherited from ancestors are documented on their own pages.";
377
+
271
378
  return ["## Signals", intro, ...originSignatureBlocks(entries)];
272
379
  };
273
380
 
@@ -287,6 +394,7 @@ const classPage = (
287
394
  const constructorsIntro = `Constructors are called on the class: \`${qualified}.new(...)\`.`;
288
395
  const staticIntro = `Static methods are called on the class: \`${qualified}.<method>(...)\`.`;
289
396
  const staticSiblings = [...entry.klass.constructors, ...entry.klass.functions];
397
+
290
398
  return joinSections([
291
399
  ...pageHeader(entry, entry.kind),
292
400
  ...elementNote(entry, options),
@@ -312,33 +420,46 @@ const classPage = (
312
420
  ]);
313
421
  };
314
422
 
315
- export const renderSymbolPage = (entry: GiSymbolEntry, options: SymbolPageOptions): string => {
423
+ const renderSymbolPage = (entry: GiSymbolEntry, options: SymbolPageOptions): string => {
316
424
  switch (entry.kind) {
317
425
  case "class":
318
- case "interface":
426
+ case "interface": {
319
427
  return classPage(entry, options);
320
- case "record":
428
+ }
429
+ case "record": {
321
430
  return recordPage(entry, options.library);
322
- case "enum":
431
+ }
432
+ case "enum": {
323
433
  return enumPage(entry);
324
- case "callback":
434
+ }
435
+ case "callback": {
325
436
  return callbackPage(entry, options.library);
326
- case "alias":
437
+ }
438
+ case "alias": {
327
439
  return aliasPage(entry, options.library);
328
- case "function":
440
+ }
441
+ case "function": {
329
442
  return functionPage(entry, options.library);
330
- case "constant":
443
+ }
444
+ case "constant": {
331
445
  return constantPage(entry, options.library);
446
+ }
332
447
  }
333
448
  };
334
449
 
335
450
  const recordInstanceEntries = (context: ModuleContext, record: GirRecord): SignatureEntry[] => {
336
451
  const entries: SignatureEntry[] = [];
452
+
337
453
  for (const callable of dedupeCallables(record.methods)) {
338
454
  const rendered = renderStaticSignature(context, callable);
339
- if (rendered === undefined) continue;
455
+
456
+ if (rendered === undefined) {
457
+ continue;
458
+ }
459
+
340
460
  entries.push({ name: rendered.name, signature: rendered.signature, doc: docMarkdown(callable.doc) });
341
461
  }
462
+
342
463
  return sortStringsBy(entries, (item) => item.name);
343
464
  };
344
465
 
@@ -350,6 +471,7 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
350
471
  const methodEntries = recordInstanceEntries(docsContext, entry.record);
351
472
  const claimedNames = new Set(methodEntries.map((item) => item.name));
352
473
  const staticSiblings = [...entry.record.constructors, ...entry.record.functions];
474
+
353
475
  return joinSections([
354
476
  ...pageHeader(entry, entry.record.isUnion ? "union" : "record"),
355
477
  ...staticSection({
@@ -372,43 +494,58 @@ const recordPage = (entry: GiSymbolBase & { kind: "record"; record: GirRecord },
372
494
  ]);
373
495
  };
374
496
 
497
+ const fieldMeta = (field: ResolvedRecordField): string =>
498
+ [`\`${field.tsType}\``, ...(field.writable ? [] : ["read-only"])].join(" · ");
499
+
375
500
  const fieldsSection = (record: GirRecord, context: ModuleContext, claimedNames: Set<string>): string[] => {
376
501
  const { slots } = computeRecordFieldSlots(context, record.fields, record.isUnion);
377
- const entries: { name: string; meta: string; doc: string }[] = [];
502
+ const entries: MetaDocEntry[] = [];
503
+
378
504
  for (const slot of slots) {
379
505
  const field = resolveRecordFieldEntry(context, slot, claimedNames);
380
- if (field === undefined) continue;
381
- entries.push({
382
- name: field.jsName,
383
- meta: [`\`${field.tsType}\``, ...(field.writable ? [] : ["read-only"])].join(" · "),
384
- doc: docMarkdown(field.doc),
385
- });
506
+
507
+ if (field === undefined) {
508
+ continue;
509
+ }
510
+
511
+ entries.push({ name: field.jsName, meta: fieldMeta(field), doc: docMarkdown(field.doc) });
386
512
  }
387
- if (entries.length === 0) return [];
388
- const blocks = sortStringsBy(entries, (item) => item.name).map((item) => metaBlock(item.name, item.meta, item.doc));
389
- return ["## Fields", ...blocks];
513
+
514
+ if (entries.length === 0) {
515
+ return [];
516
+ }
517
+
518
+ return ["## Fields", ...sortedMetaBlocks(entries)];
390
519
  };
391
520
 
392
521
  const enumPage = (entry: GiSymbolBase & { kind: "enum"; enumeration: GirEnum }): string => {
393
522
  const { enumeration } = entry;
394
- const kindLabel = enumeration.errorDomain !== undefined ? "error domain" : enumeration.kind;
523
+ const kindLabel = enumeration.errorDomain === undefined ? enumeration.kind : "error domain";
395
524
  const qualified = qualifiedName(entry);
525
+
396
526
  const rows = enumeration.members.map((member) => {
397
- const description = firstSentence(member.doc).replaceAll("|", "\\|");
527
+ const description = firstSentence(member.doc).replaceAll("|", String.raw`\|`);
528
+
398
529
  return `| \`${enumMemberKey(member.name)}\` | \`${member.value}\` | ${description} |`;
399
530
  });
531
+
400
532
  const usage =
401
- enumeration.errorDomain !== undefined
402
- ? `Members are error codes for the \`${enumeration.errorDomain}\` GError domain, accessed as \`${qualified}.<member>\`.`
403
- : `Members are accessed as \`${qualified}.<member>\`.`;
533
+ enumeration.errorDomain === undefined
534
+ ? `Members are accessed as \`${qualified}.<member>\`.`
535
+ : `Members are error codes for the \`${enumeration.errorDomain}\` GError domain, ` +
536
+ `accessed as \`${qualified}.<member>\`.`;
537
+
404
538
  const table = ["| Member | Value | Description |", "| --- | --- | --- |", ...rows].join("\n");
539
+
405
540
  return joinSections([...pageHeader(entry, kindLabel), "## Members", usage, table]);
406
541
  };
407
542
 
408
543
  const callbackPage = (entry: GiSymbolBase & { kind: "callback"; callback: GirCallback }, library: Library): string => {
409
544
  const docsContext = docsSignatureContext(entry.namespace, library);
410
545
  const fn = callbackAsFunction(entry.callback);
411
- const signature = `type ${entry.name} = (${renderMethodSignature(docsContext, fn)}) => ${renderMethodReturnType(docsContext, fn)}`;
546
+ const parameters = renderMethodSignature(docsContext, fn);
547
+ const signature = `type ${entry.name} = (${parameters}) => ${renderMethodReturnType(docsContext, fn)}`;
548
+
412
549
  return joinSections([...pageHeader(entry, "callback"), "## Signature", `\`\`\`ts\n${signature}\n\`\`\``]);
413
550
  };
414
551
 
@@ -416,29 +553,37 @@ const aliasPage = (entry: GiSymbolBase & { kind: "alias"; alias: GirAlias }, lib
416
553
  const docsContext = docsSignatureContext(entry.namespace, library);
417
554
  const category = entry.alias.cType === undefined ? undefined : primitiveCategory(entry.alias.cType);
418
555
  const target = category === "gtype" ? PRIMITIVE_TS_TYPE.gtype : renderTsType(docsContext, entry.alias.target);
556
+
419
557
  return joinSections([...pageHeader(entry, "alias"), `\`\`\`ts\ntype ${entry.name} = ${target}\n\`\`\``]);
420
558
  };
421
559
 
422
560
  const functionSignature = (context: ModuleContext, name: string, fn: GirFunction, siblings: GirFunction[]): string => {
423
561
  const finishFn = matchStaticFinishFunction(context, fn, siblings);
562
+
424
563
  if (finishFn !== undefined) {
425
564
  const { signature, returnType } = renderPromisifiedSignature(context, fn, finishFn);
565
+
426
566
  return `function ${name}(${signature}): ${returnType}`;
427
567
  }
568
+
428
569
  return `function ${name}(${renderMethodSignature(context, fn)}): ${renderMethodReturnType(context, fn)}`;
429
570
  };
430
571
 
431
572
  const functionPage = (entry: GiSymbolBase & { kind: "function"; fn: GirFunction }, library: Library): string => {
432
573
  const docsContext = docsSignatureContext(entry.namespace, library);
433
574
  const signature = functionSignature(docsContext, entry.name, entry.fn, entry.namespace.functions);
575
+
434
576
  return joinSections([...pageHeader(entry, "function"), `\`\`\`ts\n${signature}\n\`\`\``]);
435
577
  };
436
578
 
437
579
  const constantPage = (entry: GiSymbolBase & { kind: "constant"; constant: GirConstant }, library: Library): string => {
438
580
  const docsContext = docsSignatureContext(entry.namespace, library);
439
581
  const type = renderDocsType(library, entry.constant.type, false);
582
+
440
583
  return joinSections([
441
584
  ...pageHeader(entry, "constant"),
442
585
  `\`\`\`ts\nconst ${entry.name}: ${type} = ${constantLiteral(docsContext, entry.constant)}\n\`\`\``,
443
586
  ]);
444
587
  };
588
+
589
+ export { renderSymbolPage, type GiSymbolEntry, type SymbolPageOptions };