@gtkx/codegen 0.21.0 → 1.0.0-rc.1

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 (732) hide show
  1. package/README.md +173 -0
  2. package/dist/analysis/descriptor-render.d.ts +18 -0
  3. package/dist/analysis/descriptor-render.d.ts.map +1 -0
  4. package/dist/analysis/descriptor-render.js +297 -0
  5. package/dist/analysis/descriptor-render.js.map +1 -0
  6. package/dist/analysis/descriptor.d.ts +59 -0
  7. package/dist/analysis/descriptor.d.ts.map +1 -0
  8. package/dist/analysis/descriptor.js +123 -0
  9. package/dist/analysis/descriptor.js.map +1 -0
  10. package/dist/analysis/inheritance.d.ts +38 -0
  11. package/dist/analysis/inheritance.d.ts.map +1 -0
  12. package/dist/analysis/inheritance.js +193 -0
  13. package/dist/analysis/inheritance.js.map +1 -0
  14. package/dist/analysis/param-structure.d.ts +26 -0
  15. package/dist/analysis/param-structure.d.ts.map +1 -0
  16. package/dist/analysis/param-structure.js +107 -0
  17. package/dist/analysis/param-structure.js.map +1 -0
  18. package/dist/analysis/ts-type.d.ts +19 -0
  19. package/dist/analysis/ts-type.d.ts.map +1 -0
  20. package/dist/analysis/ts-type.js +65 -0
  21. package/dist/analysis/ts-type.js.map +1 -0
  22. package/dist/compile.d.ts +18 -0
  23. package/dist/compile.d.ts.map +1 -0
  24. package/dist/compile.js +123 -0
  25. package/dist/compile.js.map +1 -0
  26. package/dist/docs/api-reference.d.ts +66 -0
  27. package/dist/docs/api-reference.d.ts.map +1 -0
  28. package/dist/docs/api-reference.js +299 -0
  29. package/dist/docs/api-reference.js.map +1 -0
  30. package/dist/docs/element-page.d.ts +15 -0
  31. package/dist/docs/element-page.d.ts.map +1 -0
  32. package/dist/docs/element-page.js +221 -0
  33. package/dist/docs/element-page.js.map +1 -0
  34. package/dist/docs/pipeline.d.ts +25 -0
  35. package/dist/docs/pipeline.d.ts.map +1 -0
  36. package/dist/docs/pipeline.js +130 -0
  37. package/dist/docs/pipeline.js.map +1 -0
  38. package/dist/docs/render.d.ts +32 -0
  39. package/dist/docs/render.d.ts.map +1 -0
  40. package/dist/docs/render.js +134 -0
  41. package/dist/docs/render.js.map +1 -0
  42. package/dist/docs/symbol-page.d.ts +41 -0
  43. package/dist/docs/symbol-page.d.ts.map +1 -0
  44. package/dist/docs/symbol-page.js +338 -0
  45. package/dist/docs/symbol-page.js.map +1 -0
  46. package/dist/fingerprint.d.ts +6 -26
  47. package/dist/fingerprint.d.ts.map +1 -1
  48. package/dist/fingerprint.js +30 -18
  49. package/dist/fingerprint.js.map +1 -1
  50. package/dist/gir/ancestry.d.ts +9 -0
  51. package/dist/gir/ancestry.d.ts.map +1 -0
  52. package/dist/gir/ancestry.js +29 -0
  53. package/dist/gir/ancestry.js.map +1 -0
  54. package/dist/gir/callback.d.ts +9 -10
  55. package/dist/gir/callback.d.ts.map +1 -1
  56. package/dist/gir/callback.js +17 -16
  57. package/dist/gir/callback.js.map +1 -1
  58. package/dist/gir/class.d.ts +22 -43
  59. package/dist/gir/class.d.ts.map +1 -1
  60. package/dist/gir/class.js +11 -23
  61. package/dist/gir/class.js.map +1 -1
  62. package/dist/gir/enum.d.ts +13 -31
  63. package/dist/gir/enum.d.ts.map +1 -1
  64. package/dist/gir/enum.js +7 -14
  65. package/dist/gir/enum.js.map +1 -1
  66. package/dist/gir/field.d.ts +10 -23
  67. package/dist/gir/field.d.ts.map +1 -1
  68. package/dist/gir/field.js +12 -18
  69. package/dist/gir/field.js.map +1 -1
  70. package/dist/gir/function.d.ts +11 -42
  71. package/dist/gir/function.d.ts.map +1 -1
  72. package/dist/gir/function.js +7 -20
  73. package/dist/gir/function.js.map +1 -1
  74. package/dist/gir/gir-path.d.ts +2 -0
  75. package/dist/gir/gir-path.d.ts.map +1 -0
  76. package/dist/gir/gir-path.js +41 -0
  77. package/dist/gir/gir-path.js.map +1 -0
  78. package/dist/gir/libraries.d.ts +4 -0
  79. package/dist/gir/libraries.d.ts.map +1 -0
  80. package/dist/gir/libraries.js +62 -0
  81. package/dist/gir/libraries.js.map +1 -0
  82. package/dist/gir/library.d.ts +37 -0
  83. package/dist/gir/library.d.ts.map +1 -0
  84. package/dist/gir/library.js +218 -0
  85. package/dist/gir/library.js.map +1 -0
  86. package/dist/gir/namespace.d.ts +36 -50
  87. package/dist/gir/namespace.d.ts.map +1 -1
  88. package/dist/gir/namespace.js +46 -36
  89. package/dist/gir/namespace.js.map +1 -1
  90. package/dist/gir/parameter.d.ts +25 -69
  91. package/dist/gir/parameter.d.ts.map +1 -1
  92. package/dist/gir/parameter.js +36 -57
  93. package/dist/gir/parameter.js.map +1 -1
  94. package/dist/gir/parse.d.ts +6 -70
  95. package/dist/gir/parse.d.ts.map +1 -1
  96. package/dist/gir/parse.js +32 -80
  97. package/dist/gir/parse.js.map +1 -1
  98. package/dist/gir/primitives.d.ts +3 -34
  99. package/dist/gir/primitives.d.ts.map +1 -1
  100. package/dist/gir/primitives.js +19 -35
  101. package/dist/gir/primitives.js.map +1 -1
  102. package/dist/gir/property.d.ts +16 -25
  103. package/dist/gir/property.d.ts.map +1 -1
  104. package/dist/gir/property.js +12 -9
  105. package/dist/gir/property.js.map +1 -1
  106. package/dist/gir/record.d.ts +27 -0
  107. package/dist/gir/record.d.ts.map +1 -0
  108. package/dist/gir/record.js +25 -0
  109. package/dist/gir/record.js.map +1 -0
  110. package/dist/gir/size.d.ts +10 -57
  111. package/dist/gir/size.d.ts.map +1 -1
  112. package/dist/gir/size.js +0 -25
  113. package/dist/gir/size.js.map +1 -1
  114. package/dist/gir/type-id.d.ts +49 -0
  115. package/dist/gir/type-id.d.ts.map +1 -0
  116. package/dist/gir/type-id.js +8 -0
  117. package/dist/gir/type-id.js.map +1 -0
  118. package/dist/gir/type-ref.d.ts +3 -77
  119. package/dist/gir/type-ref.d.ts.map +1 -1
  120. package/dist/gir/type-ref.js +35 -65
  121. package/dist/gir/type-ref.js.map +1 -1
  122. package/dist/gir/type.d.ts +33 -0
  123. package/dist/gir/type.d.ts.map +1 -0
  124. package/dist/gir/type.js +2 -0
  125. package/dist/gir/type.js.map +1 -0
  126. package/dist/index.d.ts +5 -11
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +5 -11
  129. package/dist/index.js.map +1 -1
  130. package/dist/khronos/args.d.ts +30 -0
  131. package/dist/khronos/args.d.ts.map +1 -0
  132. package/dist/khronos/args.js +150 -0
  133. package/dist/khronos/args.js.map +1 -0
  134. package/dist/khronos/jsdoc.d.ts +21 -0
  135. package/dist/khronos/jsdoc.d.ts.map +1 -0
  136. package/dist/khronos/jsdoc.js +59 -0
  137. package/dist/khronos/jsdoc.js.map +1 -0
  138. package/dist/khronos/model.d.ts +37 -0
  139. package/dist/khronos/model.d.ts.map +1 -0
  140. package/dist/khronos/model.js +132 -0
  141. package/dist/khronos/model.js.map +1 -0
  142. package/dist/khronos/modules.d.ts +11 -0
  143. package/dist/khronos/modules.d.ts.map +1 -0
  144. package/dist/khronos/modules.js +58 -0
  145. package/dist/khronos/modules.js.map +1 -0
  146. package/dist/khronos/parse.d.ts +9 -0
  147. package/dist/khronos/parse.d.ts.map +1 -0
  148. package/dist/khronos/parse.js +61 -0
  149. package/dist/khronos/parse.js.map +1 -0
  150. package/dist/khronos/pipeline.d.ts +24 -0
  151. package/dist/khronos/pipeline.d.ts.map +1 -0
  152. package/dist/khronos/pipeline.js +182 -0
  153. package/dist/khronos/pipeline.js.map +1 -0
  154. package/dist/khronos/plan.d.ts +80 -0
  155. package/dist/khronos/plan.d.ts.map +1 -0
  156. package/dist/khronos/plan.js +136 -0
  157. package/dist/khronos/plan.js.map +1 -0
  158. package/dist/khronos/render.d.ts +16 -0
  159. package/dist/khronos/render.d.ts.map +1 -0
  160. package/dist/khronos/render.js +158 -0
  161. package/dist/khronos/render.js.map +1 -0
  162. package/dist/khronos/select.d.ts +15 -0
  163. package/dist/khronos/select.d.ts.map +1 -0
  164. package/dist/khronos/select.js +45 -0
  165. package/dist/khronos/select.js.map +1 -0
  166. package/dist/runner.d.ts +29 -47
  167. package/dist/runner.d.ts.map +1 -1
  168. package/dist/runner.js +78 -53
  169. package/dist/runner.js.map +1 -1
  170. package/dist/store/compile-store.d.ts +9 -0
  171. package/dist/store/compile-store.d.ts.map +1 -0
  172. package/dist/store/compile-store.js +38 -0
  173. package/dist/store/compile-store.js.map +1 -0
  174. package/dist/store/gi/async.d.ts +4 -0
  175. package/dist/store/gi/async.d.ts.map +1 -0
  176. package/dist/store/gi/async.js +41 -0
  177. package/dist/store/gi/async.js.map +1 -0
  178. package/dist/store/gi/callables.d.ts +36 -0
  179. package/dist/store/gi/callables.d.ts.map +1 -0
  180. package/dist/store/gi/callables.js +202 -0
  181. package/dist/store/gi/callables.js.map +1 -0
  182. package/dist/store/gi/callback.d.ts +4 -0
  183. package/dist/store/gi/callback.d.ts.map +1 -0
  184. package/dist/store/gi/callback.js +14 -0
  185. package/dist/store/gi/callback.js.map +1 -0
  186. package/dist/store/gi/class-struct-record.d.ts +9 -0
  187. package/dist/store/gi/class-struct-record.d.ts.map +1 -0
  188. package/dist/store/gi/class-struct-record.js +34 -0
  189. package/dist/store/gi/class-struct-record.js.map +1 -0
  190. package/dist/store/gi/class.d.ts +4 -0
  191. package/dist/store/gi/class.d.ts.map +1 -0
  192. package/dist/store/gi/class.js +169 -0
  193. package/dist/store/gi/class.js.map +1 -0
  194. package/dist/store/gi/companion.d.ts +4 -0
  195. package/dist/store/gi/companion.d.ts.map +1 -0
  196. package/dist/store/gi/companion.js +13 -0
  197. package/dist/store/gi/companion.js.map +1 -0
  198. package/dist/store/gi/constant.d.ts +5 -0
  199. package/dist/store/gi/constant.d.ts.map +1 -0
  200. package/dist/store/gi/constant.js +18 -0
  201. package/dist/store/gi/constant.js.map +1 -0
  202. package/dist/store/gi/constructor-props.d.ts +5 -0
  203. package/dist/store/gi/constructor-props.d.ts.map +1 -0
  204. package/dist/store/gi/constructor-props.js +64 -0
  205. package/dist/store/gi/constructor-props.js.map +1 -0
  206. package/dist/store/gi/enum.d.ts +5 -0
  207. package/dist/store/gi/enum.d.ts.map +1 -0
  208. package/dist/store/gi/enum.js +38 -0
  209. package/dist/store/gi/enum.js.map +1 -0
  210. package/dist/store/gi/function.d.ts +8 -0
  211. package/dist/store/gi/function.d.ts.map +1 -0
  212. package/dist/store/gi/function.js +87 -0
  213. package/dist/store/gi/function.js.map +1 -0
  214. package/dist/store/gi/gtype-binding.d.ts +10 -0
  215. package/dist/store/gi/gtype-binding.d.ts.map +1 -0
  216. package/dist/store/gi/gtype-binding.js +20 -0
  217. package/dist/store/gi/gtype-binding.js.map +1 -0
  218. package/dist/store/gi/interface.d.ts +4 -0
  219. package/dist/store/gi/interface.d.ts.map +1 -0
  220. package/dist/store/gi/interface.js +99 -0
  221. package/dist/store/gi/interface.js.map +1 -0
  222. package/dist/store/gi/item-comparators.d.ts +6 -0
  223. package/dist/store/gi/item-comparators.d.ts.map +1 -0
  224. package/dist/store/gi/item-comparators.js +76 -0
  225. package/dist/store/gi/item-comparators.js.map +1 -0
  226. package/dist/store/gi/method.d.ts +24 -0
  227. package/dist/store/gi/method.d.ts.map +1 -0
  228. package/dist/store/gi/method.js +279 -0
  229. package/dist/store/gi/method.js.map +1 -0
  230. package/dist/store/gi/param-marshal.d.ts +9 -0
  231. package/dist/store/gi/param-marshal.d.ts.map +1 -0
  232. package/dist/store/gi/param-marshal.js +37 -0
  233. package/dist/store/gi/param-marshal.js.map +1 -0
  234. package/dist/store/gi/pipeline.d.ts +4 -0
  235. package/dist/store/gi/pipeline.d.ts.map +1 -0
  236. package/dist/store/gi/pipeline.js +80 -0
  237. package/dist/store/gi/pipeline.js.map +1 -0
  238. package/dist/store/gi/properties.d.ts +5 -0
  239. package/dist/store/gi/properties.d.ts.map +1 -0
  240. package/dist/store/gi/properties.js +30 -0
  241. package/dist/store/gi/properties.js.map +1 -0
  242. package/dist/store/gi/property-accessor.d.ts +26 -0
  243. package/dist/store/gi/property-accessor.d.ts.map +1 -0
  244. package/dist/store/gi/property-accessor.js +132 -0
  245. package/dist/store/gi/property-accessor.js.map +1 -0
  246. package/dist/store/gi/record-constructor.d.ts +5 -0
  247. package/dist/store/gi/record-constructor.d.ts.map +1 -0
  248. package/dist/store/gi/record-constructor.js +65 -0
  249. package/dist/store/gi/record-constructor.js.map +1 -0
  250. package/dist/store/gi/record-field-accessor.d.ts +25 -0
  251. package/dist/store/gi/record-field-accessor.d.ts.map +1 -0
  252. package/dist/store/gi/record-field-accessor.js +288 -0
  253. package/dist/store/gi/record-field-accessor.js.map +1 -0
  254. package/dist/store/gi/record-layout.d.ts +14 -0
  255. package/dist/store/gi/record-layout.d.ts.map +1 -0
  256. package/dist/store/gi/record-layout.js +96 -0
  257. package/dist/store/gi/record-layout.js.map +1 -0
  258. package/dist/store/gi/record.d.ts +4 -0
  259. package/dist/store/gi/record.d.ts.map +1 -0
  260. package/dist/store/gi/record.js +59 -0
  261. package/dist/store/gi/record.js.map +1 -0
  262. package/dist/store/gi/registration.d.ts +16 -0
  263. package/dist/store/gi/registration.d.ts.map +1 -0
  264. package/dist/store/gi/registration.js +20 -0
  265. package/dist/store/gi/registration.js.map +1 -0
  266. package/dist/store/gi/return-wrap.d.ts +10 -0
  267. package/dist/store/gi/return-wrap.d.ts.map +1 -0
  268. package/dist/store/gi/return-wrap.js +46 -0
  269. package/dist/store/gi/return-wrap.js.map +1 -0
  270. package/dist/store/gi/runtime-override.d.ts +3 -0
  271. package/dist/store/gi/runtime-override.d.ts.map +1 -0
  272. package/dist/{writers → store/gi}/runtime-override.js +0 -15
  273. package/dist/store/gi/runtime-override.js.map +1 -0
  274. package/dist/store/gi/signal.d.ts +5 -0
  275. package/dist/store/gi/signal.d.ts.map +1 -0
  276. package/dist/store/gi/signal.js +233 -0
  277. package/dist/store/gi/signal.js.map +1 -0
  278. package/dist/store/gi/vtable.d.ts +4 -0
  279. package/dist/store/gi/vtable.d.ts.map +1 -0
  280. package/dist/store/gi/vtable.js +78 -0
  281. package/dist/store/gi/vtable.js.map +1 -0
  282. package/dist/store/gi-store.d.ts +9 -0
  283. package/dist/store/gi-store.d.ts.map +1 -0
  284. package/dist/store/gi-store.js +57 -0
  285. package/dist/store/gi-store.js.map +1 -0
  286. package/dist/store/jsx-store.d.ts +5 -0
  287. package/dist/store/jsx-store.d.ts.map +1 -0
  288. package/dist/store/jsx-store.js +23 -0
  289. package/dist/store/jsx-store.js.map +1 -0
  290. package/dist/store/react/built-ins.d.ts +9 -0
  291. package/dist/store/react/built-ins.d.ts.map +1 -0
  292. package/dist/store/react/built-ins.js +226 -0
  293. package/dist/store/react/built-ins.js.map +1 -0
  294. package/dist/store/react/element-components.d.ts +15 -0
  295. package/dist/store/react/element-components.d.ts.map +1 -0
  296. package/dist/store/react/element-components.js +92 -0
  297. package/dist/store/react/element-components.js.map +1 -0
  298. package/dist/store/react/element-prop-types.d.ts +19 -0
  299. package/dist/store/react/element-prop-types.d.ts.map +1 -0
  300. package/dist/store/react/element-prop-types.js +244 -0
  301. package/dist/store/react/element-prop-types.js.map +1 -0
  302. package/dist/store/react/element-props.d.ts +4 -0
  303. package/dist/store/react/element-props.d.ts.map +1 -0
  304. package/dist/store/react/element-props.js +178 -0
  305. package/dist/store/react/element-props.js.map +1 -0
  306. package/dist/store/react/gir-index.d.ts +25 -0
  307. package/dist/store/react/gir-index.d.ts.map +1 -0
  308. package/dist/store/react/gir-index.js +55 -0
  309. package/dist/store/react/gir-index.js.map +1 -0
  310. package/dist/store/react/intrinsic-elements.d.ts +26 -0
  311. package/dist/store/react/intrinsic-elements.d.ts.map +1 -0
  312. package/dist/store/react/intrinsic-elements.js +107 -0
  313. package/dist/store/react/intrinsic-elements.js.map +1 -0
  314. package/dist/store/react/jsx.d.ts +18 -0
  315. package/dist/store/react/jsx.d.ts.map +1 -0
  316. package/dist/store/react/jsx.js +203 -0
  317. package/dist/store/react/jsx.js.map +1 -0
  318. package/dist/store/react/metadata.d.ts +4 -0
  319. package/dist/store/react/metadata.d.ts.map +1 -0
  320. package/dist/store/react/metadata.js +174 -0
  321. package/dist/store/react/metadata.js.map +1 -0
  322. package/dist/store/react/pipeline.d.ts +14 -0
  323. package/dist/store/react/pipeline.d.ts.map +1 -0
  324. package/dist/store/react/pipeline.js +60 -0
  325. package/dist/store/react/pipeline.js.map +1 -0
  326. package/dist/store/react/props.d.ts +36 -0
  327. package/dist/store/react/props.d.ts.map +1 -0
  328. package/dist/store/react/props.js +133 -0
  329. package/dist/store/react/props.js.map +1 -0
  330. package/dist/store/store-fs.d.ts +41 -0
  331. package/dist/store/store-fs.d.ts.map +1 -0
  332. package/dist/store/store-fs.js +71 -0
  333. package/dist/store/store-fs.js.map +1 -0
  334. package/dist/writer/context.d.ts +16 -0
  335. package/dist/writer/context.d.ts.map +1 -0
  336. package/dist/writer/context.js +44 -0
  337. package/dist/writer/context.js.map +1 -0
  338. package/dist/writer/doc.d.ts +2 -0
  339. package/dist/writer/doc.d.ts.map +1 -0
  340. package/dist/writer/doc.js +12 -0
  341. package/dist/writer/doc.js.map +1 -0
  342. package/dist/writer/emit.d.ts +8 -0
  343. package/dist/writer/emit.d.ts.map +1 -0
  344. package/dist/writer/emit.js +21 -0
  345. package/dist/writer/emit.js.map +1 -0
  346. package/dist/writer/gtk-doc.d.ts +2 -0
  347. package/dist/writer/gtk-doc.d.ts.map +1 -0
  348. package/dist/writer/gtk-doc.js +67 -0
  349. package/dist/writer/gtk-doc.js.map +1 -0
  350. package/dist/writer/imports.d.ts +10 -0
  351. package/dist/writer/imports.d.ts.map +1 -0
  352. package/dist/writer/imports.js +50 -0
  353. package/dist/writer/imports.js.map +1 -0
  354. package/dist/writer/module.d.ts +15 -0
  355. package/dist/writer/module.d.ts.map +1 -0
  356. package/dist/writer/module.js +46 -0
  357. package/dist/writer/module.js.map +1 -0
  358. package/overrides/cairo/context.ts.ejs +1269 -0
  359. package/overrides/cairo/font-face.ts.ejs +151 -0
  360. package/overrides/cairo/font-options.ts.ejs +199 -0
  361. package/overrides/cairo/image-surface.ts.ejs +132 -0
  362. package/overrides/cairo/index.ts.ejs +22 -0
  363. package/overrides/cairo/matrix.ts.ejs +171 -0
  364. package/overrides/cairo/pattern.ts.ejs +476 -0
  365. package/overrides/cairo/recording-surface.ts.ejs +102 -0
  366. package/overrides/cairo/region.ts.ejs +237 -0
  367. package/overrides/cairo/scaled-font.ts.ejs +330 -0
  368. package/overrides/cairo/surface.ts.ejs +296 -0
  369. package/overrides/gdk/index.ts.ejs +2 -0
  370. package/overrides/gdk/rgba.ts.ejs +11 -0
  371. package/overrides/gobject/index.ts.ejs +29 -0
  372. package/overrides/gobject/object.ts.ejs +51 -0
  373. package/overrides/gobject/value.ts.ejs +17 -0
  374. package/overrides/graphene/index.ts.ejs +2 -0
  375. package/overrides/graphene/structs.ts.ejs +37 -0
  376. package/overrides/gtk/constants.ts.ejs +3 -0
  377. package/overrides/gtk/index.ts.ejs +2 -0
  378. package/package.json +15 -15
  379. package/src/analysis/descriptor-render.ts +407 -0
  380. package/src/analysis/descriptor.ts +263 -0
  381. package/src/analysis/inheritance.ts +242 -0
  382. package/src/analysis/param-structure.ts +127 -0
  383. package/src/analysis/ts-type.ts +88 -0
  384. package/src/compile.ts +152 -0
  385. package/src/docs/api-reference.ts +361 -0
  386. package/src/docs/element-page.ts +290 -0
  387. package/src/docs/pipeline.ts +182 -0
  388. package/src/docs/render.ts +191 -0
  389. package/src/docs/symbol-page.ts +444 -0
  390. package/src/fingerprint.ts +40 -29
  391. package/src/gir/ancestry.ts +41 -0
  392. package/src/gir/callback.ts +25 -22
  393. package/src/gir/class.ts +31 -57
  394. package/src/gir/enum.ts +20 -38
  395. package/src/gir/field.ts +21 -36
  396. package/src/gir/function.ts +17 -56
  397. package/src/gir/gir-path.ts +49 -0
  398. package/src/gir/libraries.ts +77 -0
  399. package/src/gir/library.ts +248 -0
  400. package/src/gir/namespace.ts +85 -80
  401. package/src/gir/parameter.ts +64 -93
  402. package/src/gir/parse.ts +43 -95
  403. package/src/gir/primitives.ts +23 -45
  404. package/src/gir/property.ts +27 -29
  405. package/src/gir/record.ts +53 -0
  406. package/src/gir/size.ts +9 -56
  407. package/src/gir/type-id.ts +49 -0
  408. package/src/gir/type-ref.ts +35 -140
  409. package/src/gir/type.ts +16 -0
  410. package/src/index.ts +20 -15
  411. package/src/khronos/args.ts +202 -0
  412. package/src/khronos/jsdoc.ts +76 -0
  413. package/src/khronos/model.ts +166 -0
  414. package/src/khronos/modules.ts +75 -0
  415. package/src/khronos/parse.ts +66 -0
  416. package/src/khronos/pipeline.ts +234 -0
  417. package/src/khronos/plan.ts +191 -0
  418. package/src/khronos/registry/LICENSE +202 -0
  419. package/src/khronos/registry/gl.xml +47748 -0
  420. package/src/khronos/render.ts +193 -0
  421. package/src/khronos/select.ts +67 -0
  422. package/src/runner.ts +112 -75
  423. package/src/store/compile-store.ts +49 -0
  424. package/src/store/gi/async.ts +42 -0
  425. package/src/store/gi/callables.ts +309 -0
  426. package/src/store/gi/callback.ts +15 -0
  427. package/src/store/gi/class-struct-record.ts +40 -0
  428. package/src/store/gi/class.ts +212 -0
  429. package/src/store/gi/companion.ts +13 -0
  430. package/src/store/gi/constant.ts +24 -0
  431. package/src/store/gi/constructor-props.ts +82 -0
  432. package/src/store/gi/enum.ts +49 -0
  433. package/src/store/gi/function.ts +107 -0
  434. package/src/store/gi/gtype-binding.ts +33 -0
  435. package/src/store/gi/interface.ts +157 -0
  436. package/src/store/gi/item-comparators.ts +90 -0
  437. package/src/store/gi/method.ts +417 -0
  438. package/src/store/gi/param-marshal.ts +48 -0
  439. package/src/store/gi/pipeline.ts +85 -0
  440. package/src/store/gi/properties.ts +39 -0
  441. package/src/store/gi/property-accessor.ts +194 -0
  442. package/src/store/gi/record-constructor.ts +87 -0
  443. package/src/store/gi/record-field-accessor.ts +394 -0
  444. package/src/store/gi/record-layout.ts +134 -0
  445. package/src/store/gi/record.ts +66 -0
  446. package/src/store/gi/registration.ts +38 -0
  447. package/src/store/gi/return-wrap.ts +52 -0
  448. package/src/store/gi/runtime-override.ts +36 -0
  449. package/src/store/gi/signal.ts +310 -0
  450. package/src/store/gi/vtable.ts +99 -0
  451. package/src/store/gi-store.ts +79 -0
  452. package/src/store/jsx-store.ts +27 -0
  453. package/src/store/react/built-ins.ts +260 -0
  454. package/src/store/react/element-components.ts +138 -0
  455. package/src/store/react/element-prop-types.ts +280 -0
  456. package/src/store/react/element-props.ts +204 -0
  457. package/src/store/react/gir-index.ts +85 -0
  458. package/src/store/react/intrinsic-elements.ts +161 -0
  459. package/src/store/react/jsx.ts +294 -0
  460. package/src/store/react/metadata.ts +197 -0
  461. package/src/store/react/pipeline.ts +90 -0
  462. package/src/store/react/props.ts +197 -0
  463. package/src/store/store-fs.ts +112 -0
  464. package/src/writer/context.ts +48 -0
  465. package/src/writer/doc.ts +11 -0
  466. package/src/writer/emit.ts +26 -0
  467. package/src/writer/gtk-doc.ts +74 -0
  468. package/src/writer/imports.ts +59 -0
  469. package/src/writer/module.ts +45 -0
  470. package/LICENSE +0 -373
  471. package/dist/dsl/context.d.ts +0 -104
  472. package/dist/dsl/context.d.ts.map +0 -1
  473. package/dist/dsl/context.js +0 -140
  474. package/dist/dsl/context.js.map +0 -1
  475. package/dist/dsl/emit.d.ts +0 -28
  476. package/dist/dsl/emit.d.ts.map +0 -1
  477. package/dist/dsl/emit.js +0 -41
  478. package/dist/dsl/emit.js.map +0 -1
  479. package/dist/dsl/identifier.d.ts +0 -28
  480. package/dist/dsl/identifier.d.ts.map +0 -1
  481. package/dist/dsl/identifier.js +0 -45
  482. package/dist/dsl/identifier.js.map +0 -1
  483. package/dist/dsl/imports.d.ts +0 -58
  484. package/dist/dsl/imports.d.ts.map +0 -1
  485. package/dist/dsl/imports.js +0 -107
  486. package/dist/dsl/imports.js.map +0 -1
  487. package/dist/dsl/module.d.ts +0 -53
  488. package/dist/dsl/module.d.ts.map +0 -1
  489. package/dist/dsl/module.js +0 -76
  490. package/dist/dsl/module.js.map +0 -1
  491. package/dist/ffi/pipeline.d.ts +0 -19
  492. package/dist/ffi/pipeline.d.ts.map +0 -1
  493. package/dist/ffi/pipeline.js +0 -107
  494. package/dist/ffi/pipeline.js.map +0 -1
  495. package/dist/gi-store.d.ts +0 -34
  496. package/dist/gi-store.d.ts.map +0 -1
  497. package/dist/gi-store.js +0 -154
  498. package/dist/gi-store.js.map +0 -1
  499. package/dist/gir/boxed.d.ts +0 -66
  500. package/dist/gir/boxed.d.ts.map +0 -1
  501. package/dist/gir/boxed.js +0 -49
  502. package/dist/gir/boxed.js.map +0 -1
  503. package/dist/gir/qualified-name.d.ts +0 -37
  504. package/dist/gir/qualified-name.d.ts.map +0 -1
  505. package/dist/gir/qualified-name.js +0 -39
  506. package/dist/gir/qualified-name.js.map +0 -1
  507. package/dist/gir/qualify.d.ts +0 -32
  508. package/dist/gir/qualify.d.ts.map +0 -1
  509. package/dist/gir/qualify.js +0 -60
  510. package/dist/gir/qualify.js.map +0 -1
  511. package/dist/gir/repository.d.ts +0 -82
  512. package/dist/gir/repository.d.ts.map +0 -1
  513. package/dist/gir/repository.js +0 -122
  514. package/dist/gir/repository.js.map +0 -1
  515. package/dist/gir/signal.d.ts +0 -22
  516. package/dist/gir/signal.d.ts.map +0 -1
  517. package/dist/gir/signal.js +0 -20
  518. package/dist/gir/signal.js.map +0 -1
  519. package/dist/jsx-store.d.ts +0 -22
  520. package/dist/jsx-store.d.ts.map +0 -1
  521. package/dist/jsx-store.js +0 -40
  522. package/dist/jsx-store.js.map +0 -1
  523. package/dist/react/compounds-meta.d.ts +0 -18
  524. package/dist/react/compounds-meta.d.ts.map +0 -1
  525. package/dist/react/compounds-meta.js +0 -93
  526. package/dist/react/compounds-meta.js.map +0 -1
  527. package/dist/react/compounds.d.ts +0 -27
  528. package/dist/react/compounds.d.ts.map +0 -1
  529. package/dist/react/compounds.js +0 -164
  530. package/dist/react/compounds.js.map +0 -1
  531. package/dist/react/internal.d.ts +0 -14
  532. package/dist/react/internal.d.ts.map +0 -1
  533. package/dist/react/internal.js +0 -79
  534. package/dist/react/internal.js.map +0 -1
  535. package/dist/react/jsx.d.ts +0 -22
  536. package/dist/react/jsx.d.ts.map +0 -1
  537. package/dist/react/jsx.js +0 -134
  538. package/dist/react/jsx.js.map +0 -1
  539. package/dist/react/pipeline.d.ts +0 -13
  540. package/dist/react/pipeline.d.ts.map +0 -1
  541. package/dist/react/pipeline.js +0 -25
  542. package/dist/react/pipeline.js.map +0 -1
  543. package/dist/react/props.d.ts +0 -38
  544. package/dist/react/props.d.ts.map +0 -1
  545. package/dist/react/props.js +0 -231
  546. package/dist/react/props.js.map +0 -1
  547. package/dist/react/slot-props.d.ts +0 -10
  548. package/dist/react/slot-props.d.ts.map +0 -1
  549. package/dist/react/slot-props.js +0 -56
  550. package/dist/react/slot-props.js.map +0 -1
  551. package/dist/react/widgets.d.ts +0 -83
  552. package/dist/react/widgets.d.ts.map +0 -1
  553. package/dist/react/widgets.js +0 -152
  554. package/dist/react/widgets.js.map +0 -1
  555. package/dist/store-fs.d.ts +0 -109
  556. package/dist/store-fs.d.ts.map +0 -1
  557. package/dist/store-fs.js +0 -98
  558. package/dist/store-fs.js.map +0 -1
  559. package/dist/transpile.d.ts +0 -32
  560. package/dist/transpile.d.ts.map +0 -1
  561. package/dist/transpile.js +0 -63
  562. package/dist/transpile.js.map +0 -1
  563. package/dist/typecheck-store.d.ts +0 -41
  564. package/dist/typecheck-store.d.ts.map +0 -1
  565. package/dist/typecheck-store.js +0 -102
  566. package/dist/typecheck-store.js.map +0 -1
  567. package/dist/writers/alias.d.ts +0 -13
  568. package/dist/writers/alias.d.ts.map +0 -1
  569. package/dist/writers/alias.js +0 -17
  570. package/dist/writers/alias.js.map +0 -1
  571. package/dist/writers/async.d.ts +0 -22
  572. package/dist/writers/async.d.ts.map +0 -1
  573. package/dist/writers/async.js +0 -48
  574. package/dist/writers/async.js.map +0 -1
  575. package/dist/writers/boxed-constructor.d.ts +0 -26
  576. package/dist/writers/boxed-constructor.d.ts.map +0 -1
  577. package/dist/writers/boxed-constructor.js +0 -85
  578. package/dist/writers/boxed-constructor.js.map +0 -1
  579. package/dist/writers/boxed-field-accessor.d.ts +0 -18
  580. package/dist/writers/boxed-field-accessor.d.ts.map +0 -1
  581. package/dist/writers/boxed-field-accessor.js +0 -260
  582. package/dist/writers/boxed-field-accessor.js.map +0 -1
  583. package/dist/writers/boxed-layout.d.ts +0 -27
  584. package/dist/writers/boxed-layout.d.ts.map +0 -1
  585. package/dist/writers/boxed-layout.js +0 -128
  586. package/dist/writers/boxed-layout.js.map +0 -1
  587. package/dist/writers/boxed.d.ts +0 -20
  588. package/dist/writers/boxed.d.ts.map +0 -1
  589. package/dist/writers/boxed.js +0 -71
  590. package/dist/writers/boxed.js.map +0 -1
  591. package/dist/writers/callables.d.ts +0 -124
  592. package/dist/writers/callables.d.ts.map +0 -1
  593. package/dist/writers/callables.js +0 -283
  594. package/dist/writers/callables.js.map +0 -1
  595. package/dist/writers/callback.d.ts +0 -16
  596. package/dist/writers/callback.d.ts.map +0 -1
  597. package/dist/writers/callback.js +0 -38
  598. package/dist/writers/callback.js.map +0 -1
  599. package/dist/writers/class-struct-record.d.ts +0 -31
  600. package/dist/writers/class-struct-record.d.ts.map +0 -1
  601. package/dist/writers/class-struct-record.js +0 -67
  602. package/dist/writers/class-struct-record.js.map +0 -1
  603. package/dist/writers/class-struct.d.ts +0 -22
  604. package/dist/writers/class-struct.d.ts.map +0 -1
  605. package/dist/writers/class-struct.js +0 -85
  606. package/dist/writers/class-struct.js.map +0 -1
  607. package/dist/writers/class.d.ts +0 -16
  608. package/dist/writers/class.d.ts.map +0 -1
  609. package/dist/writers/class.js +0 -307
  610. package/dist/writers/class.js.map +0 -1
  611. package/dist/writers/constant.d.ts +0 -15
  612. package/dist/writers/constant.d.ts.map +0 -1
  613. package/dist/writers/constant.js +0 -23
  614. package/dist/writers/constant.js.map +0 -1
  615. package/dist/writers/constants.d.ts +0 -15
  616. package/dist/writers/constants.d.ts.map +0 -1
  617. package/dist/writers/constants.js +0 -23
  618. package/dist/writers/constants.js.map +0 -1
  619. package/dist/writers/constructor-props.d.ts +0 -32
  620. package/dist/writers/constructor-props.d.ts.map +0 -1
  621. package/dist/writers/constructor-props.js +0 -110
  622. package/dist/writers/constructor-props.js.map +0 -1
  623. package/dist/writers/enum.d.ts +0 -21
  624. package/dist/writers/enum.d.ts.map +0 -1
  625. package/dist/writers/enum.js +0 -48
  626. package/dist/writers/enum.js.map +0 -1
  627. package/dist/writers/function.d.ts +0 -40
  628. package/dist/writers/function.d.ts.map +0 -1
  629. package/dist/writers/function.js +0 -127
  630. package/dist/writers/function.js.map +0 -1
  631. package/dist/writers/gtype-binding.d.ts +0 -19
  632. package/dist/writers/gtype-binding.d.ts.map +0 -1
  633. package/dist/writers/gtype-binding.js +0 -40
  634. package/dist/writers/gtype-binding.js.map +0 -1
  635. package/dist/writers/inheritance.d.ts +0 -48
  636. package/dist/writers/inheritance.d.ts.map +0 -1
  637. package/dist/writers/inheritance.js +0 -90
  638. package/dist/writers/inheritance.js.map +0 -1
  639. package/dist/writers/interface.d.ts +0 -16
  640. package/dist/writers/interface.d.ts.map +0 -1
  641. package/dist/writers/interface.js +0 -155
  642. package/dist/writers/interface.js.map +0 -1
  643. package/dist/writers/method.d.ts +0 -150
  644. package/dist/writers/method.d.ts.map +0 -1
  645. package/dist/writers/method.js +0 -510
  646. package/dist/writers/method.js.map +0 -1
  647. package/dist/writers/param-classify.d.ts +0 -93
  648. package/dist/writers/param-classify.d.ts.map +0 -1
  649. package/dist/writers/param-classify.js +0 -163
  650. package/dist/writers/param-classify.js.map +0 -1
  651. package/dist/writers/property-accessor.d.ts +0 -19
  652. package/dist/writers/property-accessor.d.ts.map +0 -1
  653. package/dist/writers/property-accessor.js +0 -117
  654. package/dist/writers/property-accessor.js.map +0 -1
  655. package/dist/writers/registration.d.ts +0 -27
  656. package/dist/writers/registration.d.ts.map +0 -1
  657. package/dist/writers/registration.js +0 -30
  658. package/dist/writers/registration.js.map +0 -1
  659. package/dist/writers/return-wrap.d.ts +0 -39
  660. package/dist/writers/return-wrap.d.ts.map +0 -1
  661. package/dist/writers/return-wrap.js +0 -152
  662. package/dist/writers/return-wrap.js.map +0 -1
  663. package/dist/writers/runtime-override.d.ts +0 -18
  664. package/dist/writers/runtime-override.d.ts.map +0 -1
  665. package/dist/writers/runtime-override.js.map +0 -1
  666. package/dist/writers/signal.d.ts +0 -21
  667. package/dist/writers/signal.d.ts.map +0 -1
  668. package/dist/writers/signal.js +0 -260
  669. package/dist/writers/signal.js.map +0 -1
  670. package/dist/writers/ts-type.d.ts +0 -50
  671. package/dist/writers/ts-type.d.ts.map +0 -1
  672. package/dist/writers/ts-type.js +0 -75
  673. package/dist/writers/ts-type.js.map +0 -1
  674. package/dist/writers/types-ts.d.ts +0 -27
  675. package/dist/writers/types-ts.d.ts.map +0 -1
  676. package/dist/writers/types-ts.js +0 -97
  677. package/dist/writers/types-ts.js.map +0 -1
  678. package/dist/writers/value.d.ts +0 -89
  679. package/dist/writers/value.d.ts.map +0 -1
  680. package/dist/writers/value.js +0 -402
  681. package/dist/writers/value.js.map +0 -1
  682. package/src/dsl/context.ts +0 -146
  683. package/src/dsl/emit.ts +0 -42
  684. package/src/dsl/identifier.ts +0 -52
  685. package/src/dsl/imports.ts +0 -109
  686. package/src/dsl/module.ts +0 -75
  687. package/src/ffi/pipeline.ts +0 -113
  688. package/src/gi-store.ts +0 -199
  689. package/src/gir/boxed.ts +0 -94
  690. package/src/gir/qualified-name.ts +0 -55
  691. package/src/gir/qualify.ts +0 -64
  692. package/src/gir/repository.ts +0 -149
  693. package/src/gir/signal.ts +0 -36
  694. package/src/jsx-store.ts +0 -53
  695. package/src/react/compounds-meta.ts +0 -99
  696. package/src/react/compounds.ts +0 -204
  697. package/src/react/internal.ts +0 -91
  698. package/src/react/jsx.ts +0 -155
  699. package/src/react/pipeline.ts +0 -29
  700. package/src/react/props.ts +0 -307
  701. package/src/react/slot-props.ts +0 -57
  702. package/src/react/widgets.ts +0 -185
  703. package/src/store-fs.ts +0 -157
  704. package/src/transpile.ts +0 -80
  705. package/src/typecheck-store.ts +0 -136
  706. package/src/writers/alias.ts +0 -19
  707. package/src/writers/async.ts +0 -44
  708. package/src/writers/boxed-constructor.ts +0 -105
  709. package/src/writers/boxed-field-accessor.ts +0 -306
  710. package/src/writers/boxed-layout.ts +0 -166
  711. package/src/writers/boxed.ts +0 -77
  712. package/src/writers/callables.ts +0 -339
  713. package/src/writers/callback.ts +0 -40
  714. package/src/writers/class-struct-record.ts +0 -75
  715. package/src/writers/class-struct.ts +0 -96
  716. package/src/writers/class.ts +0 -384
  717. package/src/writers/constant.ts +0 -29
  718. package/src/writers/constructor-props.ts +0 -130
  719. package/src/writers/enum.ts +0 -53
  720. package/src/writers/function.ts +0 -136
  721. package/src/writers/gtype-binding.ts +0 -48
  722. package/src/writers/inheritance.ts +0 -104
  723. package/src/writers/interface.ts +0 -168
  724. package/src/writers/method.ts +0 -678
  725. package/src/writers/param-classify.ts +0 -178
  726. package/src/writers/property-accessor.ts +0 -139
  727. package/src/writers/registration.ts +0 -42
  728. package/src/writers/return-wrap.ts +0 -180
  729. package/src/writers/runtime-override.ts +0 -59
  730. package/src/writers/signal.ts +0 -318
  731. package/src/writers/ts-type.ts +0 -115
  732. package/src/writers/value.ts +0 -485
@@ -1,91 +0,0 @@
1
- import { quote, toCamelCase, toIdentifier } from "@gtkx/utils";
2
- import type { GirClass } from "../gir/class.js";
3
- import type { GirRepository } from "../gir/repository.js";
4
- import { implementedInterfaces, isReactNodeClass, iterateClassesWithGlibName, signalHandlerName } from "./widgets.js";
5
-
6
- /**
7
- * Generates `internal.ts` source — the `SIGNALS` and `CONSTRUCT_ONLY_PROPS`
8
- * tables consumed by the React metadata resolver.
9
- *
10
- * Walks every widget across every loaded namespace and emits one entry
11
- * per GLib type name. Signals are mapped from kebab-case to `onCamelCase`;
12
- * construct-only properties are surfaced as a `Set` for the runtime to
13
- * consult on mount.
14
- *
15
- * @param repository - The loaded GIR repository
16
- */
17
- export const generateInternal = (repository: GirRepository): string => {
18
- const widgets = collectWidgets(repository);
19
- const signalsEntries = widgets.map(
20
- ({ glibName, signals }) => ` "${glibName}": ${renderSignalsObject(signals)},`,
21
- );
22
- const constructOnlyEntries = widgets
23
- .filter(({ constructOnly }) => constructOnly.length > 0)
24
- .map(({ glibName, constructOnly }) => ` "${glibName}": new Set([${constructOnly.map(quote).join(",")}]),`);
25
-
26
- const namespaces = [...new Set(widgets.map((widget) => widget.namespace))].sort((a, b) => a.localeCompare(b));
27
- const preamble = namespaces.map((name) => `import "@gtkx/gi/${name.toLowerCase()}";`).join("\n");
28
-
29
- return `${[
30
- preamble,
31
- `export const SIGNALS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n${signalsEntries.join("\n")}\n};`,
32
- `export const CONSTRUCT_ONLY_PROPS: Readonly<Record<string, ReadonlySet<string>>> = {\n${constructOnlyEntries.join("\n")}\n};`,
33
- ].join("\n\n")}\n`;
34
- };
35
-
36
- type WidgetEntry = {
37
- readonly glibName: string;
38
- readonly namespace: string;
39
- readonly signals: ReadonlyArray<readonly [string, string]>;
40
- readonly constructOnly: readonly string[];
41
- };
42
-
43
- const collectWidgets = (repository: GirRepository): readonly WidgetEntry[] => {
44
- const entries: WidgetEntry[] = [];
45
- for (const { glibName, klass, namespace } of iterateClassesWithGlibName(repository)) {
46
- if (!isReactNodeClass(klass, namespace, repository)) continue;
47
- const sources = [klass, ...implementedInterfaces(klass, namespace, repository).map((entry) => entry.klass)];
48
- entries.push({
49
- glibName,
50
- namespace: namespace.name,
51
- signals: collectSignals(sources),
52
- constructOnly: collectConstructOnly(sources),
53
- });
54
- }
55
- return entries.sort((a, b) => a.glibName.localeCompare(b.glibName));
56
- };
57
-
58
- const collectSignals = (sources: readonly GirClass[]): ReadonlyArray<readonly [string, string]> => {
59
- const seen = new Set<string>();
60
- const signals: Array<readonly [string, string]> = [];
61
- for (const source of sources) {
62
- for (const signal of source.signals) {
63
- const handlerName = signalHandlerName(signal.name);
64
- if (seen.has(handlerName)) continue;
65
- seen.add(handlerName);
66
- signals.push([handlerName, signal.name] as const);
67
- }
68
- }
69
- return signals;
70
- };
71
-
72
- const collectConstructOnly = (sources: readonly GirClass[]): readonly string[] => {
73
- const seen = new Set<string>();
74
- const names: string[] = [];
75
- for (const source of sources) {
76
- for (const property of source.properties) {
77
- if (!property.constructOnly) continue;
78
- const jsName = toIdentifier(toCamelCase(property.name));
79
- if (seen.has(jsName)) continue;
80
- seen.add(jsName);
81
- names.push(jsName);
82
- }
83
- }
84
- return names;
85
- };
86
-
87
- const renderSignalsObject = (entries: ReadonlyArray<readonly [string, string]>): string => {
88
- if (entries.length === 0) return "{}";
89
- const lines = entries.map(([key, value]) => ` ${quote(key)}: ${quote(value)}`);
90
- return `{\n${lines.join(",\n")}\n }`;
91
- };
package/src/react/jsx.ts DELETED
@@ -1,155 +0,0 @@
1
- import { quote } from "@gtkx/utils";
2
- import type { GirClass } from "../gir/class.js";
3
- import { splitQualifiedName } from "../gir/qualified-name.js";
4
- import type { GirRepository } from "../gir/repository.js";
5
- import { containerSlotsFor } from "./compounds-meta.js";
6
- import { buildWidgetPropsEntries } from "./props.js";
7
- import { isReactNodeClass, iterateClassesWithGlibName, type WidgetCandidate } from "./widgets.js";
8
-
9
- /**
10
- * Generates `jsx.ts` source — one `export const Name = "Name"` per JSX
11
- * intrinsic element (every GtkWidget descendant plus event controllers
12
- * and layout managers) that is NOT exported as a slot-widget compound,
13
- * plus an `export type NameProps` permissive prop bag per intrinsic and
14
- * a `WidgetSlotNames` index of every widget's allowed slot names.
15
- *
16
- * Compounds.ts owns its widgets' runtime exports. To prevent ambiguous
17
- * re-exports when consumers wildcard both `compounds.js` and `jsx.js`,
18
- * widgets covered by `excludeNames` are skipped here and the consumer
19
- * sees a single function-typed export from compounds instead of the
20
- * string-literal constant. Prop types are still emitted for every
21
- * widget — they live in the type namespace and never clash with
22
- * compounds.
23
- *
24
- * @param repository - The loaded GIR repository
25
- * @param excludeNames - Widgets already exported by `compounds.ts`
26
- * @param slotPropMap - Per-widget slot prop name overrides
27
- */
28
- export const generateJsx = (
29
- repository: GirRepository,
30
- excludeNames: ReadonlySet<string> = new Set(),
31
- slotPropMap: Readonly<Record<string, readonly string[]>> = {},
32
- ): string => {
33
- const widgets = collectWidgets(repository);
34
- const intrinsicWidgets = widgets.filter((entry) => !excludeNames.has(entry.glibName));
35
- const constLines = intrinsicWidgets.map(
36
- (entry) => `export const ${entry.glibName} = ${quote(entry.glibName)} as const;`,
37
- );
38
-
39
- const widgetByGlibName = new Map(widgets.map((entry) => [entry.glibName, entry]));
40
- const isWidgetAncestor = (candidate: GirClass): boolean => {
41
- const candidateGlib = candidate.glibTypeName ?? candidate.cType;
42
- return candidateGlib !== undefined && widgetByGlibName.has(candidateGlib);
43
- };
44
- const namespaceImports = new Map<string, string>();
45
- const propBlocks: string[] = ["export interface WidgetProps {\n name?: string;\n}"];
46
- for (const entry of widgets) {
47
- const block = renderPropBlock(repository, entry, {
48
- slotPropMap,
49
- isWidgetAncestor,
50
- widgetByGlibName,
51
- namespaceImports,
52
- });
53
- propBlocks.push(block);
54
- }
55
-
56
- const importLines = renderImportLines(namespaceImports);
57
- const slotEntries = widgets.map((entry) => ` readonly ${quote(entry.glibName)}: string`);
58
- const slotNamesLine = `export type WidgetSlotNames = {\n${slotEntries.join(";\n")};\n};`;
59
- const intrinsicEntries = widgets.map((entry) => ` ${entry.glibName}: ${entry.glibName}Props;`);
60
- const jsxAugmentation = [
61
- "declare global {",
62
- " namespace React.JSX {",
63
- " interface IntrinsicElements {",
64
- ...intrinsicEntries,
65
- " }",
66
- " }",
67
- "}",
68
- ].join("\n");
69
- const body = [
70
- importLines.join("\n"),
71
- "",
72
- constLines.join("\n"),
73
- "",
74
- propBlocks.join("\n\n"),
75
- "",
76
- slotNamesLine,
77
- "",
78
- jsxAugmentation,
79
- ].join("\n");
80
- return `${body}\n`;
81
- };
82
-
83
- type RenderPropBlockContext = {
84
- readonly slotPropMap: Readonly<Record<string, readonly string[]>>;
85
- readonly isWidgetAncestor: (candidate: GirClass) => boolean;
86
- readonly widgetByGlibName: ReadonlyMap<string, WidgetCandidate>;
87
- readonly namespaceImports: Map<string, string>;
88
- };
89
-
90
- const renderPropBlock = (
91
- repository: GirRepository,
92
- entry: WidgetCandidate,
93
- context: RenderPropBlockContext,
94
- ): string => {
95
- const slotPropNames = new Set(context.slotPropMap[entry.glibName] ?? []);
96
- const { propLines, imports } = buildWidgetPropsEntries({
97
- repository,
98
- klass: entry.klass,
99
- slotPropNames,
100
- isWidgetAncestor: context.isWidgetAncestor,
101
- });
102
- for (const [namespace, alias] of imports) context.namespaceImports.set(namespace, alias);
103
- context.namespaceImports.set(entry.namespace.name, entry.namespace.name);
104
- const widgetTypeRef = `${entry.namespace.name}.${entry.klass.name} | null`;
105
- const ownerLines = [
106
- " children?: ReactNode;",
107
- ` ref?: Ref<${widgetTypeRef}>;`,
108
- ...propLines.map((line) => ` ${line}`),
109
- ...containerSlotsFor(entry.glibName).map((method) => ` ${method}?: ReactNode | null;`),
110
- ];
111
- const parentExtends = resolveParentPropsExtension(repository, entry, context.widgetByGlibName);
112
- return `export interface ${entry.glibName}Props extends ${parentExtends} {\n${ownerLines.join("\n")}\n}`;
113
- };
114
-
115
- const renderImportLines = (namespaceImports: ReadonlyMap<string, string>): readonly string[] => {
116
- const lines = ['import type { ReactNode, Ref } from "react";'];
117
- for (const [namespaceName, alias] of namespaceImports) {
118
- if (namespaceName === "") continue;
119
- const directory = namespaceName.toLowerCase();
120
- lines.push(`import type * as ${alias} from "${ffiImportPath(directory)}";`);
121
- }
122
- return lines;
123
- };
124
-
125
- const collectWidgets = (repository: GirRepository): readonly WidgetCandidate[] => {
126
- const entries: WidgetCandidate[] = [];
127
- const seen = new Set<string>();
128
- for (const candidate of iterateClassesWithGlibName(repository)) {
129
- const { glibName, klass, namespace } = candidate;
130
- if (!isReactNodeClass(klass, namespace, repository)) continue;
131
- if (seen.has(glibName)) continue;
132
- seen.add(glibName);
133
- entries.push(candidate);
134
- }
135
- return entries.sort((a, b) => a.glibName.localeCompare(b.glibName));
136
- };
137
-
138
- const ffiImportPath = (directory: string): string => `@gtkx/gi/${directory}`;
139
-
140
- const resolveParentPropsExtension = (
141
- repository: GirRepository,
142
- entry: WidgetCandidate,
143
- widgetByGlibName: ReadonlyMap<string, WidgetCandidate>,
144
- ): string => {
145
- const parent = entry.klass.parent;
146
- if (parent === undefined) return "WidgetProps";
147
- const { namespaceName, typeName } = splitQualifiedName(parent, entry.namespace.name);
148
- const resolved = repository.resolveNamed(namespaceName, typeName);
149
- if (resolved === undefined) return "WidgetProps";
150
- if (resolved.kind !== "class" && resolved.kind !== "interface") return "WidgetProps";
151
- const parentGlib = resolved.value.glibTypeName ?? resolved.value.cType;
152
- if (parentGlib === undefined) return "WidgetProps";
153
- if (!widgetByGlibName.has(parentGlib)) return "WidgetProps";
154
- return `${parentGlib}Props`;
155
- };
@@ -1,29 +0,0 @@
1
- import type { GirRepository } from "../gir/repository.js";
2
- import { generateCompounds } from "./compounds.js";
3
- import { generateInternal } from "./internal.js";
4
- import { generateJsx } from "./jsx.js";
5
- import { mergeSlotProps } from "./slot-props.js";
6
-
7
- /**
8
- * Produces the three React generated files (`jsx.ts`, `internal.ts`,
9
- * `compounds.tsx`) plus a summary widget count for the runner result.
10
- *
11
- * @param repository - The loaded GIR repository
12
- * @param userSlotProps - Slot-prop overrides from `gtkx.config.ts`
13
- */
14
- export const generateReactFiles = (
15
- repository: GirRepository,
16
- userSlotProps: Readonly<Record<string, readonly string[]>> | undefined,
17
- ): { readonly files: Map<string, string>; readonly widgetCount: number } => {
18
- const slotPropMap = mergeSlotProps(userSlotProps);
19
- const compounds = generateCompounds(repository, userSlotProps);
20
- const jsx = generateJsx(repository, compounds.exportedNames, slotPropMap);
21
- const internal = generateInternal(repository);
22
- const files = new Map<string, string>([
23
- ["jsx.ts", jsx],
24
- ["internal.ts", internal],
25
- ["compounds.tsx", compounds.source],
26
- ]);
27
- const widgetCount = jsx.split("\n").filter((line) => line.startsWith("export const ")).length;
28
- return { files, widgetCount };
29
- };
@@ -1,307 +0,0 @@
1
- import { toCamelCase, toIdentifier, toPascalCase } from "@gtkx/utils";
2
- import type { GirClass } from "../gir/class.js";
3
- import type { GirNamespace } from "../gir/namespace.js";
4
- import { type GirParameter, isInoutParameter, isOutParameter } from "../gir/parameter.js";
5
- import type { GirProperty } from "../gir/property.js";
6
- import { resolveQualifiedClass, splitQualifiedName } from "../gir/qualified-name.js";
7
- import { qualifyTypeRef } from "../gir/qualify.js";
8
- import type { GirRepository } from "../gir/repository.js";
9
- import type { GirSignal } from "../gir/signal.js";
10
- import type { GirTypeRef, NamedTypeRef } from "../gir/type-ref.js";
11
- import { renderBaseTypeFor, type TsTypeTarget } from "../writers/ts-type.js";
12
- import { isScalarRef } from "../writers/value.js";
13
- import { signalHandlerName } from "./widgets.js";
14
-
15
- /**
16
- * Rendered prop entries for a single widget's Props interface, together
17
- * with imports the writer must request to keep type references valid.
18
- */
19
- export type WidgetPropsEntries = {
20
- /** Rendered prop lines, indented one level inside the interface body. */
21
- readonly propLines: readonly string[];
22
- /** Cross-namespace imports the writer must add to the surrounding module. */
23
- readonly imports: ReadonlyMap<string, string>;
24
- };
25
-
26
- /**
27
- * Options for {@link buildWidgetPropsEntries}.
28
- */
29
- export type WidgetPropsOptions = {
30
- /** The full GIR repository. */
31
- readonly repository: GirRepository;
32
- /** The widget class whose props bag is being built. */
33
- readonly klass: GirClass;
34
- /** Property names that should be widened to `ReactNode` slot children. */
35
- readonly slotPropNames?: ReadonlySet<string>;
36
- /** Returns `true` when `candidate` already has its own widget Props interface. */
37
- readonly isWidgetAncestor?: (candidate: GirClass) => boolean;
38
- };
39
-
40
- type SignalRenderOptions = {
41
- readonly repository: GirRepository;
42
- readonly signal: GirSignal;
43
- readonly imports: Map<string, string>;
44
- readonly selfType: string;
45
- readonly owningNamespace: string;
46
- };
47
-
48
- type ParentRef = { readonly klass: GirClass; readonly namespaceName: string };
49
-
50
- /**
51
- * Builds a typed prop bag for one widget intrinsic.
52
- *
53
- * Combines the widget's own properties + signal handlers with those declared
54
- * by its directly-implemented interfaces and by every non-widget ancestor up
55
- * to the first widget parent (whose props are inherited via `extends`).
56
- * Property types are written as TypeScript surface types resolved against the
57
- * loaded GIR repository.
58
- *
59
- * @param options - {@link WidgetPropsOptions}
60
- */
61
- export const buildWidgetPropsEntries = (options: WidgetPropsOptions): WidgetPropsEntries => {
62
- const { repository, klass, slotPropNames = new Set<string>(), isWidgetAncestor = () => false } = options;
63
- const imports = new Map<string, string>();
64
- const propEntries: string[] = [];
65
- const seen = new Set<string>();
66
-
67
- const ownerName = klass.glibTypeName ?? klass.cType ?? klass.name;
68
- const selfNamespace = currentNamespaceKey(repository, klass);
69
- const selfTypeName = resolveSelfTypeName(klass, selfNamespace, imports);
70
-
71
- const acceptProperty = (property: GirProperty, owningNamespace: string): void => {
72
- const jsName = toIdentifier(toCamelCase(property.name));
73
- if (seen.has(jsName)) return;
74
- seen.add(jsName);
75
- if (isPropOverridden(ownerName, jsName)) return;
76
- if (slotPropNames.has(jsName)) {
77
- propEntries.push(`${jsName}?: ReactNode | null;`);
78
- return;
79
- }
80
- const qualified = qualifyTypeRef(property.type, owningNamespace);
81
- const tsType = renderReactPropType(repository, qualified, true, imports);
82
- propEntries.push(`${jsName}?: ${tsType} | null;`);
83
- };
84
-
85
- const acceptSignal = (signal: GirSignal, owningNamespace: string): void => {
86
- const handlerName = signalHandlerName(signal.name);
87
- if (seen.has(handlerName)) return;
88
- seen.add(handlerName);
89
- if (isSignalOverridden(ownerName, handlerName)) return;
90
- const signature = renderSignalHandler({
91
- repository,
92
- signal,
93
- imports,
94
- selfType: selfTypeName,
95
- owningNamespace,
96
- });
97
- propEntries.push(`${handlerName}?: ${signature};`);
98
- };
99
-
100
- visitClassAndAncestors({ repository, klass, selfNamespace, isWidgetAncestor }, acceptProperty, acceptSignal);
101
-
102
- return { propLines: propEntries, imports };
103
- };
104
-
105
- const resolveSelfTypeName = (klass: GirClass, selfNamespace: string, imports: Map<string, string>): string => {
106
- if (selfNamespace === "?") return toPascalCase(klass.name);
107
- imports.set(selfNamespace, selfNamespace);
108
- return `${selfNamespace}.${toPascalCase(klass.name)}`;
109
- };
110
-
111
- type WalkContext = {
112
- readonly repository: GirRepository;
113
- readonly klass: GirClass;
114
- readonly selfNamespace: string;
115
- readonly isWidgetAncestor: (candidate: GirClass) => boolean;
116
- };
117
-
118
- const visitClassAndAncestors = (
119
- walk: WalkContext,
120
- acceptProperty: (property: GirProperty, owningNamespace: string) => void,
121
- acceptSignal: (signal: GirSignal, owningNamespace: string) => void,
122
- ): void => {
123
- const visit = (current: GirClass, owningNamespace: string): void => {
124
- for (const property of current.properties) acceptProperty(property, owningNamespace);
125
- for (const signal of current.signals) acceptSignal(signal, owningNamespace);
126
- for (const implementsName of current.implements) {
127
- const resolved = resolveInterface(walk.repository, current, implementsName);
128
- if (resolved === undefined) continue;
129
- for (const property of resolved.value.properties) acceptProperty(property, resolved.namespace.name);
130
- for (const signal of resolved.value.signals) acceptSignal(signal, resolved.namespace.name);
131
- }
132
- };
133
-
134
- visit(walk.klass, walk.selfNamespace);
135
- const visited = new Set<string>([`${walk.selfNamespace}.${walk.klass.name}`]);
136
- let parentRef = resolveParent(walk.repository, walk.klass, walk.selfNamespace);
137
- while (parentRef !== undefined && !walk.isWidgetAncestor(parentRef.klass)) {
138
- const key = `${parentRef.namespaceName}.${parentRef.klass.name}`;
139
- if (visited.has(key)) break;
140
- visited.add(key);
141
- visit(parentRef.klass, parentRef.namespaceName);
142
- parentRef = resolveParent(walk.repository, parentRef.klass, parentRef.namespaceName);
143
- }
144
- };
145
-
146
- const resolveParent = (repository: GirRepository, klass: GirClass, defaultNamespace: string): ParentRef | undefined => {
147
- if (klass.parent === undefined) return undefined;
148
- return resolveQualifiedClass(repository, klass.parent, defaultNamespace);
149
- };
150
-
151
- const currentNamespaceKey = (repository: GirRepository, klass: GirClass): string => {
152
- for (const namespace of repository.namespaces.values()) {
153
- if (namespace.classes.includes(klass) || namespace.interfaces.includes(klass)) {
154
- return namespace.name;
155
- }
156
- }
157
- return "?";
158
- };
159
-
160
- const resolveInterface = (
161
- repository: GirRepository,
162
- declaringClass: GirClass,
163
- implementsName: string,
164
- ): { readonly namespace: GirNamespace; readonly value: GirClass } | undefined => {
165
- const { namespaceName, typeName } = splitQualifiedName(
166
- implementsName,
167
- currentNamespaceKey(repository, declaringClass),
168
- );
169
- const resolved = repository.resolveNamed(namespaceName, typeName);
170
- if (resolved === undefined) return undefined;
171
- if (resolved.kind !== "interface") return undefined;
172
- return { namespace: resolved.namespace, value: resolved.value };
173
- };
174
-
175
- /**
176
- * Per-widget prop names that the React package re-types in a hand-written
177
- * `declare module` augmentation. Skipping them in the generated bag
178
- * prevents TS2717 "subsequent property declarations must have the same
179
- * type" when the augmentation widens the GIR property to a declarative
180
- * React shape (e.g. an array of child-props instead of a raw GObject
181
- * model).
182
- *
183
- * Entries are matched against the widget's GLib type name (e.g.
184
- * `"AdwToggleGroup"`); values are the JS prop names to skip.
185
- */
186
- const PROP_OVERRIDES_BY_WIDGET: Readonly<Record<string, ReadonlySet<string>>> = {
187
- AdwToggleGroup: new Set(["toggles"]),
188
- AdwAlertDialog: new Set(["responses"]),
189
- GtkColumnView: new Set(["columns"]),
190
- GtkScale: new Set(["marks"]),
191
- };
192
-
193
- const isPropOverridden = (ownerName: string, propName: string): boolean => {
194
- const overrides = PROP_OVERRIDES_BY_WIDGET[ownerName];
195
- return overrides?.has(propName) ?? false;
196
- };
197
-
198
- /**
199
- * Per-widget signal-handler names whose generated emission is skipped so
200
- * a hand-written `declare module` augmentation can supply a refined
201
- * signature without triggering TS2717.
202
- */
203
- const SIGNAL_OVERRIDES_BY_WIDGET: Readonly<Record<string, ReadonlySet<string>>> = {
204
- GtkRange: new Set(["onValueChanged"]),
205
- GtkScale: new Set(["onValueChanged"]),
206
- GtkScaleButton: new Set(["onValueChanged"]),
207
- GtkSpinButton: new Set(["onValueChanged"]),
208
- AdwSpinRow: new Set(["onValueChanged"]),
209
- AdwSwitchRow: new Set(["onActivated"]),
210
- };
211
-
212
- const isSignalOverridden = (ownerName: string, handlerName: string): boolean => {
213
- const overrides = SIGNAL_OVERRIDES_BY_WIDGET[ownerName];
214
- return overrides?.has(handlerName) ?? false;
215
- };
216
-
217
- const renderSignalHandler = (options: SignalRenderOptions): string => {
218
- const { repository, signal, imports, selfType, owningNamespace } = options;
219
- const visible = signal.parameters.filter((parameter) => !parameter.isVarargs);
220
- const params = visible
221
- .filter((parameter) => !isOutParameter(parameter))
222
- .map((parameter, index) => {
223
- const name = parameter.name.length === 0 ? `arg${index + 1}` : toIdentifier(toCamelCase(parameter.name));
224
- const qualified = qualifyTypeRef(parameter.type, owningNamespace);
225
- const baseType = renderReactPropType(repository, qualified, false, imports);
226
- return `${name}: ${baseType}`;
227
- });
228
- params.push(`self: ${selfType}`);
229
- return `(${params.join(", ")}) => ${renderSignalReturnType(options, visible)}`;
230
- };
231
-
232
- /**
233
- * Computes a signal handler's return type.
234
- *
235
- * Pure out-parameters (`direction="out"`, not caller-allocated) are surfaced
236
- * through the return value as a tuple `[primary, ...outs]`, mirroring the
237
- * convention {@link renderMethodReturnType} produces for methods: a value return
238
- * with no outs stays scalar (with `| void` so handlers may opt out); a void
239
- * return with a single out unwraps to that out's type; otherwise the primary
240
- * (when present) leads a tuple of the out types.
241
- *
242
- * @param options - The signal render options
243
- * @param visible - The signal's non-varargs parameters
244
- */
245
- const renderSignalReturnType = (options: SignalRenderOptions, visible: readonly GirParameter[]): string => {
246
- const { repository, signal, imports, owningNamespace } = options;
247
- const qualifiedReturn = qualifyTypeRef(signal.returnValue.type, owningNamespace);
248
- const baseReturn = renderReactPropType(repository, qualifiedReturn, signal.returnValue.nullable, imports);
249
- const outTypes = visible
250
- .filter(
251
- (parameter) =>
252
- isOutParameter(parameter) ||
253
- (isInoutParameter(parameter) && isScalarRef(repository, owningNamespace, parameter.type)),
254
- )
255
- .map((parameter) =>
256
- renderReactPropType(repository, qualifyTypeRef(parameter.type, owningNamespace), false, imports),
257
- );
258
- if (outTypes.length === 0) {
259
- return baseReturn === "void" ? "void" : `${baseReturn} | void`;
260
- }
261
- if (baseReturn !== "void") {
262
- return `[${baseReturn}, ${outTypes.join(", ")}]`;
263
- }
264
- const [single, ...rest] = outTypes;
265
- if (rest.length === 0 && single !== undefined) return single;
266
- return `[${outTypes.join(", ")}]`;
267
- };
268
-
269
- const reactTarget = (repository: GirRepository, imports: Map<string, string>): TsTypeTarget => ({
270
- containerStyle: "record",
271
- callbackType: "(...args: unknown[]) => unknown",
272
- byteArrayAsNumber: false,
273
- renderNamed: (ref) => namedTsType(repository, ref, imports),
274
- });
275
-
276
- const renderReactPropType = (
277
- repository: GirRepository,
278
- ref: GirTypeRef | undefined,
279
- isNullable: boolean,
280
- imports: Map<string, string>,
281
- ): string => {
282
- const base = renderBaseTypeFor(reactTarget(repository, imports), ref);
283
- return isNullable ? `${base} | null` : base;
284
- };
285
-
286
- const namedTsType = (repository: GirRepository, ref: NamedTypeRef, imports: Map<string, string>): string => {
287
- const namespaceName = ref.namespaceName;
288
- if (namespaceName === undefined) {
289
- return ref.typeName;
290
- }
291
- const resolved = repository.resolveNamed(namespaceName, ref.typeName);
292
- if (resolved === undefined) {
293
- imports.set(namespaceName, namespaceName);
294
- return `${namespaceName}.${ref.typeName}`;
295
- }
296
- if (resolved.kind === "callback") return "(...args: unknown[]) => unknown";
297
- if (resolved.kind === "alias") {
298
- if (resolved.target === undefined) return "number";
299
- return namedTsType(
300
- repository,
301
- { kind: "named", namespaceName: resolved.namespace.name, typeName: resolved.target, cType: undefined },
302
- imports,
303
- );
304
- }
305
- imports.set(namespaceName, namespaceName);
306
- return `${namespaceName}.${ref.typeName}`;
307
- };
@@ -1,57 +0,0 @@
1
- /**
2
- * Built-in widget-typed properties that should be exposed as JSX child
3
- * slots (typed as `ReactNode`) rather than as raw widget refs.
4
- *
5
- * The keys are JSX element names (i.e. GLib type names such as
6
- * `"AdwWindow"`, `"GtkHeaderBar"`); the values are the camelCase property
7
- * names that should be promoted. User-supplied `slotProps` from
8
- * `gtkx.config.ts` merge into this map.
9
- */
10
- const BUILT_IN_SLOT_PROPS: Readonly<Record<string, readonly string[]>> = Object.freeze({
11
- GtkWindow: ["titlebar"],
12
- AdwWindow: ["content"],
13
- AdwApplicationWindow: ["content"],
14
- AdwAlertDialog: ["extraChild"],
15
- AdwBottomSheet: ["bottomBar", "content", "sheet"],
16
- GtkCenterBox: ["centerWidget", "endWidget", "startWidget"],
17
- GtkExpander: ["labelWidget"],
18
- AdwFlap: ["content", "flap", "separator"],
19
- GtkFrame: ["labelWidget"],
20
- GtkHeaderBar: ["titleWidget"],
21
- AdwHeaderBar: ["titleWidget"],
22
- GtkMenuButton: ["popover"],
23
- AdwMessageDialog: ["extraChild"],
24
- AdwNavigationSplitView: ["content", "sidebar"],
25
- AdwOverlaySplitView: ["content", "sidebar"],
26
- GtkPaned: ["endChild", "startChild"],
27
- AdwPreferencesGroup: ["headerSuffix"],
28
- AdwPreferencesPage: ["banner"],
29
- AdwSplitButton: ["popover"],
30
- AdwTabBar: ["endActionWidget", "startActionWidget"],
31
- AdwToolbarView: ["content"],
32
- });
33
-
34
- /**
35
- * Merges built-in slot props with the user-supplied `slotProps` map.
36
- *
37
- * Per JSX element name, the resulting list is the union of both sources
38
- * with duplicates removed and a stable alphabetical sort.
39
- *
40
- * @param userSlotProps - The user-provided `slotProps` map, or `undefined`
41
- */
42
- export const mergeSlotProps = (
43
- userSlotProps: Readonly<Record<string, readonly string[]>> | undefined,
44
- ): Readonly<Record<string, readonly string[]>> => {
45
- const result: Record<string, string[]> = {};
46
- for (const [key, values] of Object.entries(BUILT_IN_SLOT_PROPS)) {
47
- result[key] = [...values];
48
- }
49
- if (userSlotProps !== undefined) {
50
- for (const [key, values] of Object.entries(userSlotProps)) {
51
- const merged = new Set<string>(result[key] ?? []);
52
- for (const value of values) merged.add(value);
53
- result[key] = [...merged].sort((a, b) => a.localeCompare(b));
54
- }
55
- }
56
- return result;
57
- };