@gtkx/react 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 (636) hide show
  1. package/README.md +137 -34
  2. package/dist/components/application.d.ts +10 -0
  3. package/dist/components/application.d.ts.map +1 -0
  4. package/dist/components/application.js +26 -0
  5. package/dist/components/application.js.map +1 -0
  6. package/dist/components/window.d.ts +8 -0
  7. package/dist/components/window.d.ts.map +1 -0
  8. package/dist/components/window.js +23 -0
  9. package/dist/components/window.js.map +1 -0
  10. package/dist/hooks/use-application.d.ts +8 -0
  11. package/dist/hooks/use-application.d.ts.map +1 -0
  12. package/dist/hooks/use-application.js +13 -0
  13. package/dist/hooks/use-application.js.map +1 -0
  14. package/dist/hooks/use-bind-setting.d.ts +6 -0
  15. package/dist/hooks/use-bind-setting.d.ts.map +1 -0
  16. package/dist/hooks/use-bind-setting.js +19 -0
  17. package/dist/hooks/use-bind-setting.js.map +1 -0
  18. package/dist/hooks/use-merge-refs.d.ts +3 -0
  19. package/dist/hooks/use-merge-refs.d.ts.map +1 -0
  20. package/dist/hooks/use-merge-refs.js +48 -0
  21. package/dist/hooks/use-merge-refs.js.map +1 -0
  22. package/dist/hooks/use-object-attachment.d.ts +10 -0
  23. package/dist/hooks/use-object-attachment.d.ts.map +1 -0
  24. package/dist/hooks/use-object-attachment.js +24 -0
  25. package/dist/hooks/use-object-attachment.js.map +1 -0
  26. package/dist/hooks/use-object-value.d.ts +4 -0
  27. package/dist/hooks/use-object-value.d.ts.map +1 -0
  28. package/dist/hooks/use-object-value.js +32 -0
  29. package/dist/hooks/use-object-value.js.map +1 -0
  30. package/dist/hooks/use-parent-window.d.ts +8 -0
  31. package/dist/hooks/use-parent-window.d.ts.map +1 -0
  32. package/dist/hooks/use-parent-window.js +7 -0
  33. package/dist/hooks/use-parent-window.js.map +1 -0
  34. package/dist/hooks/use-property.d.ts +14 -0
  35. package/dist/hooks/use-property.d.ts.map +1 -0
  36. package/dist/hooks/use-property.js +13 -0
  37. package/dist/hooks/use-property.js.map +1 -0
  38. package/dist/hooks/use-setting.d.ts +25 -0
  39. package/dist/hooks/use-setting.d.ts.map +1 -0
  40. package/dist/hooks/use-setting.js +15 -0
  41. package/dist/hooks/use-setting.js.map +1 -0
  42. package/dist/hooks/use-signal.d.ts +21 -0
  43. package/dist/hooks/use-signal.d.ts.map +1 -0
  44. package/dist/hooks/use-signal.js +20 -0
  45. package/dist/hooks/use-signal.js.map +1 -0
  46. package/dist/index.d.ts +14 -7
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +10 -7
  49. package/dist/index.js.map +1 -1
  50. package/dist/internal.d.ts +14 -0
  51. package/dist/internal.d.ts.map +1 -0
  52. package/dist/internal.js +14 -0
  53. package/dist/internal.js.map +1 -0
  54. package/dist/libraries/adw/dialog.d.ts +8 -0
  55. package/dist/libraries/adw/dialog.d.ts.map +1 -0
  56. package/dist/libraries/adw/dialog.js +25 -0
  57. package/dist/libraries/adw/dialog.js.map +1 -0
  58. package/dist/libraries/adw/index.d.ts +2 -0
  59. package/dist/libraries/adw/index.d.ts.map +1 -0
  60. package/dist/libraries/adw/index.js +2 -0
  61. package/dist/libraries/adw/index.js.map +1 -0
  62. package/dist/reconciler/accessible.d.ts +59 -0
  63. package/dist/reconciler/accessible.d.ts.map +1 -0
  64. package/dist/reconciler/accessible.js +143 -0
  65. package/dist/reconciler/accessible.js.map +1 -0
  66. package/dist/reconciler/apply-props.d.ts +8 -0
  67. package/dist/reconciler/apply-props.d.ts.map +1 -0
  68. package/dist/reconciler/apply-props.js +92 -0
  69. package/dist/reconciler/apply-props.js.map +1 -0
  70. package/dist/reconciler/commit-flush.d.ts +3 -0
  71. package/dist/reconciler/commit-flush.d.ts.map +1 -0
  72. package/dist/reconciler/commit-flush.js +13 -0
  73. package/dist/reconciler/commit-flush.js.map +1 -0
  74. package/dist/reconciler/container-attach.d.ts +10 -0
  75. package/dist/reconciler/container-attach.d.ts.map +1 -0
  76. package/dist/reconciler/container-attach.js +216 -0
  77. package/dist/reconciler/container-attach.js.map +1 -0
  78. package/dist/reconciler/content-rebuild.d.ts +3 -0
  79. package/dist/reconciler/content-rebuild.d.ts.map +1 -0
  80. package/dist/reconciler/content-rebuild.js +15 -0
  81. package/dist/reconciler/content-rebuild.js.map +1 -0
  82. package/dist/reconciler/dispatch.d.ts +6 -0
  83. package/dist/reconciler/dispatch.d.ts.map +1 -0
  84. package/dist/reconciler/dispatch.js +61 -0
  85. package/dist/reconciler/dispatch.js.map +1 -0
  86. package/dist/reconciler/element-prop-appliers.d.ts +5 -0
  87. package/dist/reconciler/element-prop-appliers.d.ts.map +1 -0
  88. package/dist/reconciler/element-prop-appliers.js +104 -0
  89. package/dist/reconciler/element-prop-appliers.js.map +1 -0
  90. package/dist/reconciler/element-props.d.ts +25 -0
  91. package/dist/reconciler/element-props.d.ts.map +1 -0
  92. package/dist/reconciler/element-props.js +157 -0
  93. package/dist/reconciler/element-props.js.map +1 -0
  94. package/dist/reconciler/host-config.d.ts +13 -0
  95. package/dist/reconciler/host-config.d.ts.map +1 -0
  96. package/dist/reconciler/host-config.js +309 -0
  97. package/dist/reconciler/host-config.js.map +1 -0
  98. package/dist/reconciler/instance.d.ts +6 -0
  99. package/dist/reconciler/instance.d.ts.map +1 -0
  100. package/dist/reconciler/instance.js +27 -0
  101. package/dist/reconciler/instance.js.map +1 -0
  102. package/dist/reconciler/label-text-rebuild.d.ts +3 -0
  103. package/dist/reconciler/label-text-rebuild.d.ts.map +1 -0
  104. package/dist/reconciler/label-text-rebuild.js +22 -0
  105. package/dist/reconciler/label-text-rebuild.js.map +1 -0
  106. package/dist/reconciler/portal.d.ts +11 -0
  107. package/dist/reconciler/portal.d.ts.map +1 -0
  108. package/dist/reconciler/portal.js +20 -0
  109. package/dist/reconciler/portal.js.map +1 -0
  110. package/dist/reconciler/reconciler-error-handler.d.ts +7 -0
  111. package/dist/reconciler/reconciler-error-handler.d.ts.map +1 -0
  112. package/dist/reconciler/reconciler-error-handler.js +24 -0
  113. package/dist/reconciler/reconciler-error-handler.js.map +1 -0
  114. package/dist/reconciler/reconciler-root.d.ts +19 -0
  115. package/dist/reconciler/reconciler-root.d.ts.map +1 -0
  116. package/dist/reconciler/reconciler-root.js +24 -0
  117. package/dist/reconciler/reconciler-root.js.map +1 -0
  118. package/dist/reconciler/reconciler.d.ts +3 -0
  119. package/dist/reconciler/reconciler.d.ts.map +1 -0
  120. package/dist/reconciler/reconciler.js +12 -0
  121. package/dist/reconciler/reconciler.js.map +1 -0
  122. package/dist/reconciler/render.d.ts +23 -0
  123. package/dist/reconciler/render.d.ts.map +1 -0
  124. package/dist/reconciler/render.js +46 -0
  125. package/dist/reconciler/render.js.map +1 -0
  126. package/dist/reconciler/root-element.d.ts +14 -0
  127. package/dist/reconciler/root-element.d.ts.map +1 -0
  128. package/dist/reconciler/root-element.js +7 -0
  129. package/dist/reconciler/root-element.js.map +1 -0
  130. package/dist/reconciler/signal-store.d.ts +22 -0
  131. package/dist/reconciler/signal-store.d.ts.map +1 -0
  132. package/dist/reconciler/signal-store.js +84 -0
  133. package/dist/reconciler/signal-store.js.map +1 -0
  134. package/dist/reconciler/state.d.ts +36 -0
  135. package/dist/reconciler/state.d.ts.map +1 -0
  136. package/dist/reconciler/state.js +38 -0
  137. package/dist/reconciler/state.js.map +1 -0
  138. package/dist/reconciler/text-buffer-controller.d.ts +17 -0
  139. package/dist/reconciler/text-buffer-controller.d.ts.map +1 -0
  140. package/dist/reconciler/text-buffer-controller.js +102 -0
  141. package/dist/reconciler/text-buffer-controller.js.map +1 -0
  142. package/dist/reconciler/text-buffer-rebuild.d.ts +3 -0
  143. package/dist/reconciler/text-buffer-rebuild.d.ts.map +1 -0
  144. package/dist/reconciler/text-buffer-rebuild.js +7 -0
  145. package/dist/reconciler/text-buffer-rebuild.js.map +1 -0
  146. package/dist/reconciler/text-node.d.ts +7 -0
  147. package/dist/reconciler/text-node.d.ts.map +1 -0
  148. package/dist/reconciler/text-node.js +8 -0
  149. package/dist/reconciler/text-node.js.map +1 -0
  150. package/dist/reconciler/types.d.ts +5 -0
  151. package/dist/reconciler/types.d.ts.map +1 -0
  152. package/dist/reconciler/types.js.map +1 -0
  153. package/dist/reconciler/visibility.d.ts +6 -0
  154. package/dist/reconciler/visibility.d.ts.map +1 -0
  155. package/dist/reconciler/visibility.js +57 -0
  156. package/dist/reconciler/visibility.js.map +1 -0
  157. package/dist/reconciler/wrapper-apply.d.ts +6 -0
  158. package/dist/reconciler/wrapper-apply.d.ts.map +1 -0
  159. package/dist/reconciler/wrapper-apply.js +287 -0
  160. package/dist/reconciler/wrapper-apply.js.map +1 -0
  161. package/dist/reconciler/wrapper-content.d.ts +8 -0
  162. package/dist/reconciler/wrapper-content.d.ts.map +1 -0
  163. package/dist/reconciler/wrapper-content.js +19 -0
  164. package/dist/reconciler/wrapper-content.js.map +1 -0
  165. package/dist/reconciler/wrapper-node.d.ts +8 -0
  166. package/dist/reconciler/wrapper-node.d.ts.map +1 -0
  167. package/dist/reconciler/wrapper-node.js +4 -0
  168. package/dist/reconciler/wrapper-node.js.map +1 -0
  169. package/dist/reconciler/wrapper-protocol.d.ts +13 -0
  170. package/dist/reconciler/wrapper-protocol.d.ts.map +1 -0
  171. package/dist/reconciler/wrapper-protocol.js +20 -0
  172. package/dist/reconciler/wrapper-protocol.js.map +1 -0
  173. package/dist/utils/accessible-metadata.d.ts +5 -0
  174. package/dist/utils/accessible-metadata.d.ts.map +1 -0
  175. package/dist/utils/accessible-metadata.js +22 -0
  176. package/dist/utils/accessible-metadata.js.map +1 -0
  177. package/dist/utils/create-element-component.d.ts +4 -0
  178. package/dist/utils/create-element-component.d.ts.map +1 -0
  179. package/dist/utils/create-element-component.js +54 -0
  180. package/dist/utils/create-element-component.js.map +1 -0
  181. package/dist/utils/gtype.d.ts +16 -0
  182. package/dist/utils/gtype.d.ts.map +1 -0
  183. package/dist/utils/gtype.js +127 -0
  184. package/dist/utils/gtype.js.map +1 -0
  185. package/dist/utils/notify-name.d.ts +5 -0
  186. package/dist/utils/notify-name.d.ts.map +1 -0
  187. package/dist/utils/notify-name.js +6 -0
  188. package/dist/utils/notify-name.js.map +1 -0
  189. package/dist/utils/object-prop.d.ts +8 -0
  190. package/dist/utils/object-prop.d.ts.map +1 -0
  191. package/dist/utils/object-prop.js +9 -0
  192. package/dist/utils/object-prop.js.map +1 -0
  193. package/dist/utils/settings-accessor.d.ts +8 -0
  194. package/dist/utils/settings-accessor.d.ts.map +1 -0
  195. package/dist/utils/settings-accessor.js +69 -0
  196. package/dist/utils/settings-accessor.js.map +1 -0
  197. package/dist/utils/wrapper-node-jsx.d.ts +32 -0
  198. package/dist/utils/wrapper-node-jsx.d.ts.map +1 -0
  199. package/dist/utils/wrapper-node-jsx.js +2 -0
  200. package/dist/utils/wrapper-node-jsx.js.map +1 -0
  201. package/package.json +22 -8
  202. package/src/components/application.tsx +43 -0
  203. package/src/components/window.tsx +36 -0
  204. package/src/hooks/use-application.ts +17 -0
  205. package/src/hooks/use-bind-setting.ts +35 -0
  206. package/src/hooks/use-merge-refs.ts +53 -0
  207. package/src/hooks/use-object-attachment.ts +35 -0
  208. package/src/hooks/use-object-value.ts +50 -0
  209. package/src/hooks/use-parent-window.ts +9 -0
  210. package/src/hooks/use-property.ts +22 -0
  211. package/src/hooks/use-setting.ts +47 -0
  212. package/src/hooks/use-signal.ts +71 -0
  213. package/src/index.ts +15 -14
  214. package/src/internal.ts +24 -0
  215. package/src/libraries/adw/dialog.tsx +34 -0
  216. package/src/libraries/adw/index.ts +1 -0
  217. package/src/reconciler/accessible.ts +232 -0
  218. package/src/reconciler/apply-props.ts +117 -0
  219. package/src/reconciler/commit-flush.ts +13 -0
  220. package/src/reconciler/container-attach.ts +219 -0
  221. package/src/reconciler/content-rebuild.ts +19 -0
  222. package/src/reconciler/dispatch.ts +58 -0
  223. package/src/reconciler/element-prop-appliers.ts +110 -0
  224. package/src/reconciler/element-props.ts +192 -0
  225. package/src/reconciler/host-config.ts +405 -0
  226. package/src/reconciler/instance.ts +30 -0
  227. package/src/reconciler/label-text-rebuild.ts +26 -0
  228. package/src/reconciler/portal.ts +28 -0
  229. package/src/reconciler/reconciler-error-handler.ts +29 -0
  230. package/src/reconciler/reconciler-root.ts +57 -0
  231. package/src/reconciler/reconciler.ts +13 -0
  232. package/src/reconciler/render.ts +61 -0
  233. package/src/reconciler/root-element.ts +14 -0
  234. package/src/reconciler/signal-store.ts +103 -0
  235. package/src/reconciler/state.ts +72 -0
  236. package/src/reconciler/text-buffer-controller.ts +107 -0
  237. package/src/reconciler/text-buffer-rebuild.ts +12 -0
  238. package/src/reconciler/text-node.ts +13 -0
  239. package/src/reconciler/types.ts +6 -0
  240. package/src/reconciler/visibility.ts +52 -0
  241. package/src/reconciler/wrapper-apply.ts +308 -0
  242. package/src/reconciler/wrapper-content.ts +24 -0
  243. package/src/reconciler/wrapper-node.ts +8 -0
  244. package/src/reconciler/wrapper-protocol.ts +32 -0
  245. package/src/utils/accessible-metadata.ts +26 -0
  246. package/src/utils/create-element-component.ts +77 -0
  247. package/src/utils/gtype.ts +166 -0
  248. package/src/utils/notify-name.ts +10 -0
  249. package/src/utils/object-prop.ts +13 -0
  250. package/src/utils/settings-accessor.ts +89 -0
  251. package/src/utils/wrapper-node-jsx.ts +34 -0
  252. package/dist/components/compound.d.ts +0 -40
  253. package/dist/components/compound.d.ts.map +0 -1
  254. package/dist/components/compound.js +0 -46
  255. package/dist/components/compound.js.map +0 -1
  256. package/dist/components/list.d.ts +0 -75
  257. package/dist/components/list.d.ts.map +0 -1
  258. package/dist/components/list.js +0 -81
  259. package/dist/components/list.js.map +0 -1
  260. package/dist/components/slot-widget.d.ts +0 -15
  261. package/dist/components/slot-widget.d.ts.map +0 -1
  262. package/dist/components/slot-widget.js +0 -37
  263. package/dist/components/slot-widget.js.map +0 -1
  264. package/dist/errors.d.ts +0 -15
  265. package/dist/errors.d.ts.map +0 -1
  266. package/dist/errors.js +0 -44
  267. package/dist/errors.js.map +0 -1
  268. package/dist/factory.d.ts +0 -5
  269. package/dist/factory.d.ts.map +0 -1
  270. package/dist/factory.js +0 -37
  271. package/dist/factory.js.map +0 -1
  272. package/dist/generated/compounds.d.ts +0 -2672
  273. package/dist/generated/compounds.d.ts.map +0 -1
  274. package/dist/generated/compounds.js +0 -2624
  275. package/dist/generated/compounds.js.map +0 -1
  276. package/dist/generated/internal.d.ts +0 -16
  277. package/dist/generated/internal.d.ts.map +0 -1
  278. package/dist/generated/internal.js +0 -3638
  279. package/dist/generated/internal.js.map +0 -1
  280. package/dist/generated/jsx.d.ts +0 -17074
  281. package/dist/generated/jsx.d.ts.map +0 -1
  282. package/dist/generated/jsx.js +0 -6715
  283. package/dist/generated/jsx.js.map +0 -1
  284. package/dist/generated/registry.d.ts +0 -5
  285. package/dist/generated/registry.d.ts.map +0 -1
  286. package/dist/generated/registry.js +0 -13
  287. package/dist/generated/registry.js.map +0 -1
  288. package/dist/host-config.d.ts +0 -24
  289. package/dist/host-config.d.ts.map +0 -1
  290. package/dist/host-config.js +0 -172
  291. package/dist/host-config.js.map +0 -1
  292. package/dist/jsx.d.ts +0 -974
  293. package/dist/jsx.d.ts.map +0 -1
  294. package/dist/jsx.js +0 -8
  295. package/dist/jsx.js.map +0 -1
  296. package/dist/metadata.d.ts +0 -5
  297. package/dist/metadata.d.ts.map +0 -1
  298. package/dist/metadata.js +0 -33
  299. package/dist/metadata.js.map +0 -1
  300. package/dist/node.d.ts +0 -25
  301. package/dist/node.d.ts.map +0 -1
  302. package/dist/node.js +0 -85
  303. package/dist/node.js.map +0 -1
  304. package/dist/nodes/adjustable.d.ts +0 -11
  305. package/dist/nodes/adjustable.d.ts.map +0 -1
  306. package/dist/nodes/adjustable.js +0 -46
  307. package/dist/nodes/adjustable.js.map +0 -1
  308. package/dist/nodes/alert-dialog-response.d.ts +0 -15
  309. package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
  310. package/dist/nodes/alert-dialog-response.js +0 -61
  311. package/dist/nodes/alert-dialog-response.js.map +0 -1
  312. package/dist/nodes/alert-dialog.d.ts +0 -14
  313. package/dist/nodes/alert-dialog.d.ts.map +0 -1
  314. package/dist/nodes/alert-dialog.js +0 -41
  315. package/dist/nodes/alert-dialog.js.map +0 -1
  316. package/dist/nodes/animation.d.ts +0 -39
  317. package/dist/nodes/animation.d.ts.map +0 -1
  318. package/dist/nodes/animation.js +0 -326
  319. package/dist/nodes/animation.js.map +0 -1
  320. package/dist/nodes/application.d.ts +0 -12
  321. package/dist/nodes/application.d.ts.map +0 -1
  322. package/dist/nodes/application.js +0 -51
  323. package/dist/nodes/application.js.map +0 -1
  324. package/dist/nodes/calendar.d.ts +0 -18
  325. package/dist/nodes/calendar.d.ts.map +0 -1
  326. package/dist/nodes/calendar.js +0 -28
  327. package/dist/nodes/calendar.js.map +0 -1
  328. package/dist/nodes/color-dialog-button.d.ts +0 -15
  329. package/dist/nodes/color-dialog-button.d.ts.map +0 -1
  330. package/dist/nodes/color-dialog-button.js +0 -43
  331. package/dist/nodes/color-dialog-button.js.map +0 -1
  332. package/dist/nodes/column-view-column.d.ts +0 -36
  333. package/dist/nodes/column-view-column.d.ts.map +0 -1
  334. package/dist/nodes/column-view-column.js +0 -168
  335. package/dist/nodes/column-view-column.js.map +0 -1
  336. package/dist/nodes/container-slot.d.ts +0 -18
  337. package/dist/nodes/container-slot.d.ts.map +0 -1
  338. package/dist/nodes/container-slot.js +0 -81
  339. package/dist/nodes/container-slot.js.map +0 -1
  340. package/dist/nodes/dialog.d.ts +0 -10
  341. package/dist/nodes/dialog.d.ts.map +0 -1
  342. package/dist/nodes/dialog.js +0 -20
  343. package/dist/nodes/dialog.js.map +0 -1
  344. package/dist/nodes/drawing-area.d.ts +0 -19
  345. package/dist/nodes/drawing-area.d.ts.map +0 -1
  346. package/dist/nodes/drawing-area.js +0 -40
  347. package/dist/nodes/drawing-area.js.map +0 -1
  348. package/dist/nodes/event-controller.d.ts +0 -15
  349. package/dist/nodes/event-controller.d.ts.map +0 -1
  350. package/dist/nodes/event-controller.js +0 -73
  351. package/dist/nodes/event-controller.js.map +0 -1
  352. package/dist/nodes/fixed-child.d.ts +0 -19
  353. package/dist/nodes/fixed-child.d.ts.map +0 -1
  354. package/dist/nodes/fixed-child.js +0 -99
  355. package/dist/nodes/fixed-child.js.map +0 -1
  356. package/dist/nodes/font-dialog-button.d.ts +0 -15
  357. package/dist/nodes/font-dialog-button.d.ts.map +0 -1
  358. package/dist/nodes/font-dialog-button.js +0 -76
  359. package/dist/nodes/font-dialog-button.js.map +0 -1
  360. package/dist/nodes/grid-child.d.ts +0 -19
  361. package/dist/nodes/grid-child.d.ts.map +0 -1
  362. package/dist/nodes/grid-child.js +0 -94
  363. package/dist/nodes/grid-child.js.map +0 -1
  364. package/dist/nodes/internal/accessible.d.ts +0 -5
  365. package/dist/nodes/internal/accessible.d.ts.map +0 -1
  366. package/dist/nodes/internal/accessible.js +0 -119
  367. package/dist/nodes/internal/accessible.js.map +0 -1
  368. package/dist/nodes/internal/bound-item.d.ts +0 -4
  369. package/dist/nodes/internal/bound-item.d.ts.map +0 -1
  370. package/dist/nodes/internal/bound-item.js +0 -2
  371. package/dist/nodes/internal/bound-item.js.map +0 -1
  372. package/dist/nodes/internal/construct.d.ts +0 -3
  373. package/dist/nodes/internal/construct.d.ts.map +0 -1
  374. package/dist/nodes/internal/construct.js +0 -44
  375. package/dist/nodes/internal/construct.js.map +0 -1
  376. package/dist/nodes/internal/predicates.d.ts +0 -51
  377. package/dist/nodes/internal/predicates.d.ts.map +0 -1
  378. package/dist/nodes/internal/predicates.js +0 -36
  379. package/dist/nodes/internal/predicates.js.map +0 -1
  380. package/dist/nodes/internal/props.d.ts +0 -6
  381. package/dist/nodes/internal/props.d.ts.map +0 -1
  382. package/dist/nodes/internal/props.js +0 -43
  383. package/dist/nodes/internal/props.js.map +0 -1
  384. package/dist/nodes/internal/signal-store.d.ts +0 -22
  385. package/dist/nodes/internal/signal-store.d.ts.map +0 -1
  386. package/dist/nodes/internal/signal-store.js +0 -98
  387. package/dist/nodes/internal/signal-store.js.map +0 -1
  388. package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
  389. package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
  390. package/dist/nodes/internal/text-buffer-controller.js +0 -327
  391. package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
  392. package/dist/nodes/internal/widget.d.ts +0 -8
  393. package/dist/nodes/internal/widget.d.ts.map +0 -1
  394. package/dist/nodes/internal/widget.js +0 -68
  395. package/dist/nodes/internal/widget.js.map +0 -1
  396. package/dist/nodes/level-bar.d.ts +0 -12
  397. package/dist/nodes/level-bar.d.ts.map +0 -1
  398. package/dist/nodes/level-bar.js +0 -24
  399. package/dist/nodes/level-bar.js.map +0 -1
  400. package/dist/nodes/list-item-node.d.ts +0 -12
  401. package/dist/nodes/list-item-node.d.ts.map +0 -1
  402. package/dist/nodes/list-item-node.js +0 -45
  403. package/dist/nodes/list-item-node.js.map +0 -1
  404. package/dist/nodes/list.d.ts +0 -100
  405. package/dist/nodes/list.d.ts.map +0 -1
  406. package/dist/nodes/list.js +0 -950
  407. package/dist/nodes/list.js.map +0 -1
  408. package/dist/nodes/menu.d.ts +0 -7
  409. package/dist/nodes/menu.d.ts.map +0 -1
  410. package/dist/nodes/menu.js +0 -20
  411. package/dist/nodes/menu.js.map +0 -1
  412. package/dist/nodes/models/menu.d.ts +0 -47
  413. package/dist/nodes/models/menu.d.ts.map +0 -1
  414. package/dist/nodes/models/menu.js +0 -240
  415. package/dist/nodes/models/menu.js.map +0 -1
  416. package/dist/nodes/navigation-page.d.ts +0 -19
  417. package/dist/nodes/navigation-page.d.ts.map +0 -1
  418. package/dist/nodes/navigation-page.js +0 -129
  419. package/dist/nodes/navigation-page.js.map +0 -1
  420. package/dist/nodes/navigation-view.d.ts +0 -19
  421. package/dist/nodes/navigation-view.d.ts.map +0 -1
  422. package/dist/nodes/navigation-view.js +0 -51
  423. package/dist/nodes/navigation-view.js.map +0 -1
  424. package/dist/nodes/notebook-page-tab.d.ts +0 -15
  425. package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
  426. package/dist/nodes/notebook-page-tab.js +0 -40
  427. package/dist/nodes/notebook-page-tab.js.map +0 -1
  428. package/dist/nodes/notebook-page.d.ts +0 -29
  429. package/dist/nodes/notebook-page.d.ts.map +0 -1
  430. package/dist/nodes/notebook-page.js +0 -151
  431. package/dist/nodes/notebook-page.js.map +0 -1
  432. package/dist/nodes/notebook.d.ts +0 -16
  433. package/dist/nodes/notebook.d.ts.map +0 -1
  434. package/dist/nodes/notebook.js +0 -31
  435. package/dist/nodes/notebook.js.map +0 -1
  436. package/dist/nodes/overlay-child.d.ts +0 -20
  437. package/dist/nodes/overlay-child.d.ts.map +0 -1
  438. package/dist/nodes/overlay-child.js +0 -109
  439. package/dist/nodes/overlay-child.js.map +0 -1
  440. package/dist/nodes/popover-menu.d.ts +0 -19
  441. package/dist/nodes/popover-menu.d.ts.map +0 -1
  442. package/dist/nodes/popover-menu.js +0 -54
  443. package/dist/nodes/popover-menu.js.map +0 -1
  444. package/dist/nodes/scale.d.ts +0 -10
  445. package/dist/nodes/scale.d.ts.map +0 -1
  446. package/dist/nodes/scale.js +0 -19
  447. package/dist/nodes/scale.js.map +0 -1
  448. package/dist/nodes/scrolled-window.d.ts +0 -11
  449. package/dist/nodes/scrolled-window.d.ts.map +0 -1
  450. package/dist/nodes/scrolled-window.js +0 -18
  451. package/dist/nodes/scrolled-window.js.map +0 -1
  452. package/dist/nodes/search-bar.d.ts +0 -11
  453. package/dist/nodes/search-bar.d.ts.map +0 -1
  454. package/dist/nodes/search-bar.js +0 -16
  455. package/dist/nodes/search-bar.js.map +0 -1
  456. package/dist/nodes/shortcut.d.ts +0 -19
  457. package/dist/nodes/shortcut.d.ts.map +0 -1
  458. package/dist/nodes/shortcut.js +0 -72
  459. package/dist/nodes/shortcut.js.map +0 -1
  460. package/dist/nodes/slot.d.ts +0 -21
  461. package/dist/nodes/slot.d.ts.map +0 -1
  462. package/dist/nodes/slot.js +0 -102
  463. package/dist/nodes/slot.js.map +0 -1
  464. package/dist/nodes/source-view.d.ts +0 -18
  465. package/dist/nodes/source-view.d.ts.map +0 -1
  466. package/dist/nodes/source-view.js +0 -94
  467. package/dist/nodes/source-view.js.map +0 -1
  468. package/dist/nodes/spin-row.d.ts +0 -14
  469. package/dist/nodes/spin-row.d.ts.map +0 -1
  470. package/dist/nodes/spin-row.js +0 -46
  471. package/dist/nodes/spin-row.js.map +0 -1
  472. package/dist/nodes/stack-page.d.ts +0 -22
  473. package/dist/nodes/stack-page.d.ts.map +0 -1
  474. package/dist/nodes/stack-page.js +0 -140
  475. package/dist/nodes/stack-page.js.map +0 -1
  476. package/dist/nodes/stack.d.ts +0 -13
  477. package/dist/nodes/stack.d.ts.map +0 -1
  478. package/dist/nodes/stack.js +0 -21
  479. package/dist/nodes/stack.js.map +0 -1
  480. package/dist/nodes/switch-row.d.ts +0 -11
  481. package/dist/nodes/switch-row.d.ts.map +0 -1
  482. package/dist/nodes/switch-row.js +0 -15
  483. package/dist/nodes/switch-row.js.map +0 -1
  484. package/dist/nodes/text-anchor.d.ts +0 -23
  485. package/dist/nodes/text-anchor.d.ts.map +0 -1
  486. package/dist/nodes/text-anchor.js +0 -74
  487. package/dist/nodes/text-anchor.js.map +0 -1
  488. package/dist/nodes/text-content.d.ts +0 -12
  489. package/dist/nodes/text-content.d.ts.map +0 -1
  490. package/dist/nodes/text-content.js +0 -2
  491. package/dist/nodes/text-content.js.map +0 -1
  492. package/dist/nodes/text-paintable.d.ts +0 -19
  493. package/dist/nodes/text-paintable.d.ts.map +0 -1
  494. package/dist/nodes/text-paintable.js +0 -42
  495. package/dist/nodes/text-paintable.js.map +0 -1
  496. package/dist/nodes/text-segment.d.ts +0 -18
  497. package/dist/nodes/text-segment.d.ts.map +0 -1
  498. package/dist/nodes/text-segment.js +0 -38
  499. package/dist/nodes/text-segment.js.map +0 -1
  500. package/dist/nodes/text-tag.d.ts +0 -38
  501. package/dist/nodes/text-tag.d.ts.map +0 -1
  502. package/dist/nodes/text-tag.js +0 -247
  503. package/dist/nodes/text-tag.js.map +0 -1
  504. package/dist/nodes/text-view.d.ts +0 -29
  505. package/dist/nodes/text-view.d.ts.map +0 -1
  506. package/dist/nodes/text-view.js +0 -80
  507. package/dist/nodes/text-view.js.map +0 -1
  508. package/dist/nodes/toggle-group.d.ts +0 -17
  509. package/dist/nodes/toggle-group.d.ts.map +0 -1
  510. package/dist/nodes/toggle-group.js +0 -65
  511. package/dist/nodes/toggle-group.js.map +0 -1
  512. package/dist/nodes/toggle.d.ts +0 -16
  513. package/dist/nodes/toggle.d.ts.map +0 -1
  514. package/dist/nodes/toggle.js +0 -61
  515. package/dist/nodes/toggle.js.map +0 -1
  516. package/dist/nodes/virtual.d.ts +0 -7
  517. package/dist/nodes/virtual.d.ts.map +0 -1
  518. package/dist/nodes/virtual.js +0 -9
  519. package/dist/nodes/virtual.js.map +0 -1
  520. package/dist/nodes/web-view.d.ts +0 -11
  521. package/dist/nodes/web-view.d.ts.map +0 -1
  522. package/dist/nodes/web-view.js +0 -16
  523. package/dist/nodes/web-view.js.map +0 -1
  524. package/dist/nodes/widget.d.ts +0 -26
  525. package/dist/nodes/widget.d.ts.map +0 -1
  526. package/dist/nodes/widget.js +0 -308
  527. package/dist/nodes/widget.js.map +0 -1
  528. package/dist/nodes/window.d.ts +0 -31
  529. package/dist/nodes/window.d.ts.map +0 -1
  530. package/dist/nodes/window.js +0 -122
  531. package/dist/nodes/window.js.map +0 -1
  532. package/dist/portal.d.ts +0 -29
  533. package/dist/portal.d.ts.map +0 -1
  534. package/dist/portal.js +0 -35
  535. package/dist/portal.js.map +0 -1
  536. package/dist/reconciler.d.ts +0 -34
  537. package/dist/reconciler.d.ts.map +0 -1
  538. package/dist/reconciler.js +0 -48
  539. package/dist/reconciler.js.map +0 -1
  540. package/dist/registry.d.ts +0 -18
  541. package/dist/registry.d.ts.map +0 -1
  542. package/dist/registry.js +0 -98
  543. package/dist/registry.js.map +0 -1
  544. package/dist/render.d.ts +0 -117
  545. package/dist/render.d.ts.map +0 -1
  546. package/dist/render.js +0 -159
  547. package/dist/render.js.map +0 -1
  548. package/dist/types.d.ts +0 -6
  549. package/dist/types.d.ts.map +0 -1
  550. package/dist/types.js.map +0 -1
  551. package/dist/use-property.d.ts +0 -29
  552. package/dist/use-property.d.ts.map +0 -1
  553. package/dist/use-property.js +0 -44
  554. package/dist/use-property.js.map +0 -1
  555. package/dist/use-setting.d.ts +0 -36
  556. package/dist/use-setting.d.ts.map +0 -1
  557. package/dist/use-setting.js +0 -68
  558. package/dist/use-setting.js.map +0 -1
  559. package/src/components/compound.tsx +0 -57
  560. package/src/components/list.tsx +0 -140
  561. package/src/components/slot-widget.tsx +0 -46
  562. package/src/errors.ts +0 -53
  563. package/src/factory.ts +0 -62
  564. package/src/generated/compounds.ts +0 -2741
  565. package/src/generated/internal.ts +0 -3642
  566. package/src/generated/jsx.ts +0 -17383
  567. package/src/generated/registry.ts +0 -17
  568. package/src/host-config.ts +0 -219
  569. package/src/jsx.ts +0 -1033
  570. package/src/metadata.ts +0 -43
  571. package/src/node.ts +0 -107
  572. package/src/nodes/adjustable.ts +0 -68
  573. package/src/nodes/alert-dialog-response.ts +0 -78
  574. package/src/nodes/alert-dialog.ts +0 -55
  575. package/src/nodes/animation.ts +0 -409
  576. package/src/nodes/application.ts +0 -61
  577. package/src/nodes/calendar.ts +0 -42
  578. package/src/nodes/color-dialog-button.ts +0 -69
  579. package/src/nodes/column-view-column.ts +0 -189
  580. package/src/nodes/container-slot.ts +0 -100
  581. package/src/nodes/dialog.ts +0 -25
  582. package/src/nodes/drawing-area.ts +0 -53
  583. package/src/nodes/event-controller.ts +0 -96
  584. package/src/nodes/fixed-child.ts +0 -122
  585. package/src/nodes/font-dialog-button.ts +0 -107
  586. package/src/nodes/grid-child.ts +0 -116
  587. package/src/nodes/internal/accessible.ts +0 -155
  588. package/src/nodes/internal/bound-item.ts +0 -4
  589. package/src/nodes/internal/construct.ts +0 -60
  590. package/src/nodes/internal/predicates.ts +0 -80
  591. package/src/nodes/internal/props.ts +0 -51
  592. package/src/nodes/internal/signal-store.ts +0 -141
  593. package/src/nodes/internal/text-buffer-controller.ts +0 -417
  594. package/src/nodes/internal/widget.ts +0 -74
  595. package/src/nodes/level-bar.ts +0 -36
  596. package/src/nodes/list-item-node.ts +0 -53
  597. package/src/nodes/list.ts +0 -1082
  598. package/src/nodes/menu.ts +0 -27
  599. package/src/nodes/models/menu.ts +0 -314
  600. package/src/nodes/navigation-page.ts +0 -154
  601. package/src/nodes/navigation-view.ts +0 -66
  602. package/src/nodes/notebook-page-tab.ts +0 -55
  603. package/src/nodes/notebook-page.ts +0 -189
  604. package/src/nodes/notebook.ts +0 -42
  605. package/src/nodes/overlay-child.ts +0 -130
  606. package/src/nodes/popover-menu.ts +0 -67
  607. package/src/nodes/scale.ts +0 -28
  608. package/src/nodes/scrolled-window.ts +0 -23
  609. package/src/nodes/search-bar.ts +0 -27
  610. package/src/nodes/shortcut.ts +0 -86
  611. package/src/nodes/slot.ts +0 -138
  612. package/src/nodes/source-view.ts +0 -130
  613. package/src/nodes/spin-row.ts +0 -72
  614. package/src/nodes/stack-page.ts +0 -170
  615. package/src/nodes/stack.ts +0 -35
  616. package/src/nodes/switch-row.ts +0 -26
  617. package/src/nodes/text-anchor.ts +0 -88
  618. package/src/nodes/text-content.ts +0 -14
  619. package/src/nodes/text-paintable.ts +0 -51
  620. package/src/nodes/text-segment.ts +0 -55
  621. package/src/nodes/text-tag.ts +0 -298
  622. package/src/nodes/text-view.ts +0 -100
  623. package/src/nodes/toggle-group.ts +0 -81
  624. package/src/nodes/toggle.ts +0 -72
  625. package/src/nodes/virtual.ts +0 -16
  626. package/src/nodes/web-view.ts +0 -22
  627. package/src/nodes/widget.ts +0 -369
  628. package/src/nodes/window.ts +0 -172
  629. package/src/portal.ts +0 -37
  630. package/src/reconciler.ts +0 -52
  631. package/src/registry.ts +0 -119
  632. package/src/render.tsx +0 -192
  633. package/src/types.ts +0 -13
  634. package/src/use-property.ts +0 -58
  635. package/src/use-setting.ts +0 -96
  636. /package/dist/{types.js → reconciler/types.js} +0 -0
package/README.md CHANGED
@@ -1,70 +1,173 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/eugeniodepalo/gtkx/main/logo.svg" alt="GTKX" width="100" height="100">
2
+ <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/logo.svg" alt="GTKX" width="100" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">GTKX</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>Linux application development for the modern age powered by GTK4 and React</strong>
8
+ The React framework for Linux.<br />
9
+ Build GTK4 and Adwaita apps in TypeScript, with React components and hooks driving GNOME's own widgets. What you ship is a GNOME app.
9
10
  </p>
10
11
 
11
12
  <p align="center">
12
- <a href="https://www.npmjs.com/package/@gtkx/react"><img src="https://img.shields.io/npm/v/@gtkx/react.svg" alt="npm version"></a>
13
- <a href="https://github.com/gtkx-org/gtkx/actions"><img src="https://img.shields.io/github/actions/workflow/status/eugeniodepalo/gtkx/ci.yml" alt="CI"></a>
14
- <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License"></a>
15
- <a href="https://github.com/gtkx-org/gtkx/discussions"><img src="https://img.shields.io/badge/discussions-GitHub-blue" alt="GitHub Discussions"></a>
13
+ <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
14
+ <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
15
+ <img src="https://img.shields.io/badge/node-%E2%89%A524-339933?logo=node.js&logoColor=white" alt="Node >= 24" />
16
+ <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
17
+ <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
18
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://gtkx.dev">Homepage</a> &middot;
23
+ <a href="https://gtkx.dev/guide/why-gtkx">Documentation</a> &middot;
24
+ <a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> &middot;
25
+ <a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
16
26
  </p>
17
27
 
18
28
  ---
19
29
 
30
+ GTKX generates fully typed bindings for the entire GTK4 and Adwaita surface directly from GObject-Introspection. On top of those bindings you get the React programming model: components and hooks driving GObject instances, with Fast Refresh while you develop.
31
+
20
32
  <p align="center">
21
- <img src="https://raw.githubusercontent.com/eugeniodepalo/gtkx/main/demo.gif" alt="GTKX Demo" width="100%">
33
+ <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
22
34
  </p>
23
35
 
24
- ---
36
+ <p align="center">
37
+ <em>The Tasks app you build in the <a href="https://gtkx.dev/tutorial/">tutorial</a>.</em>
38
+ </p>
39
+
40
+ ## Demo
41
+
42
+ The intrinsic elements in this snippet render GTK4 widgets, and ordinary React hooks and events drive them:
43
+
44
+ ```tsx
45
+ import * as Gtk from "@gtkx/gi/gtk";
46
+ import { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
47
+ import { createRoot, quit } from "@gtkx/react";
48
+ import { useState } from "react";
49
+
50
+ const Counter = () => {
51
+ const [count, setCount] = useState(0);
52
+
53
+ return (
54
+ <GtkApplicationWindow
55
+ title="Hello GTKX"
56
+ defaultWidth={400}
57
+ defaultHeight={300}
58
+ onCloseRequest={quit}
59
+ >
60
+ <GtkBox
61
+ orientation={Gtk.Orientation.VERTICAL}
62
+ spacing={20}
63
+ marginTop={40}
64
+ marginBottom={40}
65
+ marginStart={40}
66
+ marginEnd={40}
67
+ valign={Gtk.Align.CENTER}
68
+ halign={Gtk.Align.CENTER}
69
+ >
70
+ <GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
71
+ <GtkLabel cssClasses={["title-2"]}>{`Count: ${count}`}</GtkLabel>
72
+ <GtkButton
73
+ label="Increment"
74
+ onClicked={() => setCount((c) => c + 1)}
75
+ cssClasses={["suggested-action", "pill"]}
76
+ />
77
+ </GtkBox>
78
+ </GtkApplicationWindow>
79
+ );
80
+ };
81
+
82
+ const App = () => (
83
+ <GtkApplication>
84
+ <Counter />
85
+ </GtkApplication>
86
+ );
87
+
88
+ createRoot().render(<App />);
89
+ ```
90
+
91
+ This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world) example, with `app.tsx` and `index.tsx` combined into a single snippet. `@gtkx/gi` and `@gtkx/jsx` are per-project bindings generated by the CLI, not packages you install from npm.
92
+
93
+ ## Why GTKX
94
+
95
+ ### A declarative layer for the GNOME stack
96
+
97
+ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing re-renders that interface when your application state changes, and nothing hot-reloads it as you work. GTKX adds that missing layer, and the tooling around it, on top of the stack you already know:
98
+
99
+ - a React reconciler that exposes every GObject as a JSX element,
100
+ - a CLI for scaffolding, development, and production builds,
101
+ - a dev server with Fast Refresh that patches your running UI in place,
102
+ - CSS-in-JS styling and high-level list, grid, and dialog components,
103
+ - a Testing Library-style API for querying and driving your widgets in tests,
104
+ - and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
105
+
106
+ ### The full GNOME API surface
107
+
108
+ React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX exposes it: GTK4, Adwaita, and any other GObject-Introspection library on your system. Linux-only by design.
109
+
110
+ ### Why Node.js, and why generated bindings
111
+
112
+ GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [why-gtkx guide](https://gtkx.dev/guide/why-gtkx) covers the comparison in full.
25
113
 
26
- GTKX is a modern framework for building native Linux applications using React and GTK. It provides the full range of GTK4, GLib, and Node.js APIs, allowing you to create rich, performant desktop applications with the tools and libraries you already know.
114
+ GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
27
115
 
28
- ## Features
116
+ At runtime, the native Rust core calls straight into the system GTK4, Adwaita, and GLib libraries through libffi, without loading libgirepository at all.
29
117
 
30
- - **React 19** — Hooks, concurrent features, and the component model you know
31
- - **Fully native Node.js environment** - Runs on vanilla Node.js, with the help of a Neon native module
32
- - **TypeScript first** — Full type safety with auto-generated bindings
33
- - **Rich GLib support** — Provides bindings for most modern GLib/GObject libraries, including Adwaita
34
- - **HMR** — Fast refresh during development powered by Vite
35
- - **CSS-in-JS styling** — Easy styling with GTK CSS powered by Emotion
36
- - **Testing library** — Testing Library-inspired API for testing components and E2E
118
+ ## Quick start
37
119
 
38
- ## Quick Start
120
+ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requirements).
39
121
 
40
- ```bash
41
- npx @gtkx/cli create my-app
122
+ Scaffold a new app with the `create-gtkx` initializer:
123
+
124
+ ```sh
125
+ npm create gtkx@rc
126
+ ```
127
+
128
+ The same command works with other package managers: `pnpm create gtkx@rc` or `yarn create gtkx@rc`.
129
+
130
+ Then run your new app:
131
+
132
+ ```sh
42
133
  cd my-app
43
134
  npm run dev
44
135
  ```
45
136
 
46
- ## Examples
137
+ To go further, follow the [tutorial](https://gtkx.dev/tutorial/).
47
138
 
48
- Explore complete applications in the [`examples/`](./examples) directory:
139
+ ## Documentation
49
140
 
50
- - **[hello-world](./examples/hello-world)** Minimal application showing a counter
51
- - **[gtk-demo](./examples/gtk-demo)** — Full replica of the official GTK demo app
52
- - **[tutorial](./examples/tutorial)** — Notes app from the tutorial with GSettings and Adwaita
53
- - **[browser](./examples/browser)** — Simple browser using WebKitWebView
141
+ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tutorial that builds a complete GNOME app, from scaffolding to packaging and shipping, plus guides and a full API reference.
54
142
 
55
- ## Documentation
143
+ **[Read the docs &rarr;](https://gtkx.dev/guide/why-gtkx)**
56
144
 
57
- Visit [https://gtkx.dev](https://gtkx.dev) for the full documentation.
145
+ ## Requirements
58
146
 
59
- ## Contributing
147
+ GTKX is Linux-only. You need:
60
148
 
61
- Contributions are welcome! Please see the [contributing guidelines](./CONTRIBUTING.md).
149
+ - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
150
+ - Node.js 24 or later
62
151
 
63
- ## Community
152
+ The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
153
+
154
+ ## Examples
155
+
156
+ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
157
+
158
+ - [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
159
+ - [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
160
+ - [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
161
+ - [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
162
+
163
+ ## Status
164
+
165
+ GTKX 1.0 is at the release candidate stage.
166
+
167
+ ## Contributing
64
168
 
65
- - [GitHub Discussions](https://github.com/gtkx-org/gtkx/discussions) Questions, ideas, and general discussion
66
- - [Issue Tracker](https://github.com/gtkx-org/gtkx/issues) — Bug reports and feature requests
169
+ Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 24 or later, pnpm, and a Rust toolchain.
67
170
 
68
171
  ## License
69
172
 
70
- [MPL-2.0](./LICENSE)
173
+ GTKX is licensed under [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -0,0 +1,10 @@
1
+ import type * as Gtk from "@gtkx/gi/gtk";
2
+ import { type ElementType, type ReactNode, type Ref } from "react";
3
+ type ApplicationComponentProps = {
4
+ applicationId?: string | null | undefined;
5
+ children?: ReactNode | undefined;
6
+ ref?: Ref<Gtk.Application | null> | undefined;
7
+ };
8
+ export declare const createApplicationComponent: (Component: ElementType) => ((props: ApplicationComponentProps) => ReactNode);
9
+ export {};
10
+ //# sourceMappingURL=application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAyB,MAAM,OAAO,CAAC;AAM1F,KAAK,yBAAyB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,0BAA0B,cACxB,WAAW,KACvB,CAAC,CAAC,KAAK,EAAE,yBAAyB,KAAK,SAAS,CAyBlD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { applicationId as defaultApplicationId } from "virtual:gtkx-config";
3
+ import { quitApplication, runApplication } from "@gtkx/runtime";
4
+ import { useCallback, useState } from "react";
5
+ import { ApplicationContext } from "../hooks/use-application.js";
6
+ import { useMergeRefs } from "../hooks/use-merge-refs.js";
7
+ const POST_ACTIVATE_PROPS = new Set(["menubar"]);
8
+ export const createApplicationComponent = (Component) => {
9
+ return ({ applicationId = defaultApplicationId, children, ref, ...rest }) => {
10
+ const [app, setApp] = useState(null);
11
+ const handleMount = useCallback((instance) => {
12
+ runApplication(instance);
13
+ setApp(instance);
14
+ return () => {
15
+ quitApplication(instance);
16
+ setApp(null);
17
+ };
18
+ }, []);
19
+ const mergedRef = useMergeRefs(ref, handleMount);
20
+ const appliedProps = app
21
+ ? rest
22
+ : Object.fromEntries(Object.entries(rest).filter(([key]) => !POST_ACTIVATE_PROPS.has(key)));
23
+ return (_jsx(Component, { ref: mergedRef, applicationId: applicationId, ...appliedProps, children: app ? _jsx(ApplicationContext.Provider, { value: app, children: children }) : null }));
24
+ };
25
+ };
26
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/components/application.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAA8C,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAQjD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,SAAsB,EAC2B,EAAE;IACnD,OAAO,CAAC,EAAE,aAAa,GAAG,oBAAoB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,EAA6B,EAAa,EAAE;QAC9G,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAyB,IAAI,CAAC,CAAC;QAE7D,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,QAAyB,EAAE,EAAE;YAC1D,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzB,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEjB,OAAO,GAAG,EAAE;gBACR,eAAe,CAAC,QAAQ,CAAC,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC,CAAC;QACN,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,SAAS,GAAG,YAAY,CAAkB,GAAG,EAAE,WAAW,CAAC,CAAC;QAClE,MAAM,YAAY,GAAG,GAAG;YACpB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEhG,OAAO,CACH,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,KAAM,YAAY,YACpE,GAAG,CAAC,CAAC,CAAC,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,YAAG,QAAQ,GAA+B,CAAC,CAAC,CAAC,IAAI,GACvF,CACf,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { applicationId as defaultApplicationId } from \"virtual:gtkx-config\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport { quitApplication, runApplication } from \"@gtkx/runtime\";\nimport { type ElementType, type ReactNode, type Ref, useCallback, useState } from \"react\";\nimport { ApplicationContext } from \"../hooks/use-application.js\";\nimport { useMergeRefs } from \"../hooks/use-merge-refs.js\";\n\nconst POST_ACTIVATE_PROPS = new Set([\"menubar\"]);\n\ntype ApplicationComponentProps = {\n applicationId?: string | null | undefined;\n children?: ReactNode | undefined;\n ref?: Ref<Gtk.Application | null> | undefined;\n};\n\nexport const createApplicationComponent = (\n Component: ElementType,\n): ((props: ApplicationComponentProps) => ReactNode) => {\n return ({ applicationId = defaultApplicationId, children, ref, ...rest }: ApplicationComponentProps): ReactNode => {\n const [app, setApp] = useState<Gtk.Application | null>(null);\n\n const handleMount = useCallback((instance: Gtk.Application) => {\n runApplication(instance);\n setApp(instance);\n\n return () => {\n quitApplication(instance);\n setApp(null);\n };\n }, []);\n\n const mergedRef = useMergeRefs<Gtk.Application>(ref, handleMount);\n const appliedProps = app\n ? rest\n : Object.fromEntries(Object.entries(rest).filter(([key]) => !POST_ACTIVATE_PROPS.has(key)));\n\n return (\n <Component ref={mergedRef} applicationId={applicationId} {...appliedProps}>\n {app ? <ApplicationContext.Provider value={app}>{children}</ApplicationContext.Provider> : null}\n </Component>\n );\n };\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import type * as Gtk from "@gtkx/gi/gtk";
2
+ import { type ElementType, type ReactNode, type Ref } from "react";
3
+ type WindowComponentProps = {
4
+ ref?: Ref<Gtk.Window | null> | undefined;
5
+ };
6
+ export declare const createWindowComponent: (Component: ElementType) => ((props: WindowComponentProps) => ReactNode);
7
+ export {};
8
+ //# sourceMappingURL=window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAA0C,MAAM,OAAO,CAAC;AAI3G,KAAK,oBAAoB,GAAG;IACxB,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,cAAe,WAAW,KAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CA0BzG,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useLayoutEffect, useState } from "react";
3
+ import { useMergeRefs } from "../hooks/use-merge-refs.js";
4
+ import { ParentWindowContext } from "../hooks/use-parent-window.js";
5
+ export const createWindowComponent = (Component) => {
6
+ return ({ ref, ...rest }) => {
7
+ const [window, setWindow] = useState(null);
8
+ const handleMount = useCallback((window) => {
9
+ setWindow(window);
10
+ return () => {
11
+ window.setDefaultWidget(null);
12
+ window.destroy();
13
+ setWindow(null);
14
+ };
15
+ }, []);
16
+ useLayoutEffect(() => {
17
+ window?.present();
18
+ }, [window]);
19
+ const mergedRef = useMergeRefs(ref, handleMount);
20
+ return (_jsx(ParentWindowContext.Provider, { value: window, children: _jsx(Component, { ref: mergedRef, ...rest }) }));
21
+ };
22
+ };
23
+ //# sourceMappingURL=window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/components/window.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8C,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAMpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAsB,EAAgD,EAAE;IAC1G,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAwB,EAAa,EAAE;QACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;QAE9D,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,MAAkB,EAAE,EAAE;YACnD,SAAS,CAAC,MAAM,CAAC,CAAC;YAElB,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBAC9B,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,SAAS,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC,CAAC;QACN,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,eAAe,CAAC,GAAG,EAAE;YACjB,MAAM,EAAE,OAAO,EAAE,CAAC;QACtB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAEb,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAEjD,OAAO,CACH,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YACvC,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,KAAM,IAAI,GAAI,GACZ,CAClC,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type ElementType, type ReactNode, type Ref, useCallback, useLayoutEffect, useState } from \"react\";\nimport { useMergeRefs } from \"../hooks/use-merge-refs.js\";\nimport { ParentWindowContext } from \"../hooks/use-parent-window.js\";\n\ntype WindowComponentProps = {\n ref?: Ref<Gtk.Window | null> | undefined;\n};\n\nexport const createWindowComponent = (Component: ElementType): ((props: WindowComponentProps) => ReactNode) => {\n return ({ ref, ...rest }: WindowComponentProps): ReactNode => {\n const [window, setWindow] = useState<Gtk.Window | null>(null);\n\n const handleMount = useCallback((window: Gtk.Window) => {\n setWindow(window);\n\n return () => {\n window.setDefaultWidget(null);\n window.destroy();\n setWindow(null);\n };\n }, []);\n\n useLayoutEffect(() => {\n window?.present();\n }, [window]);\n\n const mergedRef = useMergeRefs(ref, handleMount);\n\n return (\n <ParentWindowContext.Provider value={window}>\n <Component ref={mergedRef} {...rest} />\n </ParentWindowContext.Provider>\n );\n };\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import type * as Gtk from "@gtkx/gi/gtk";
2
+ import { type Context } from "react";
3
+ export declare const ApplicationContext: Context<Gtk.Application | null>;
4
+ /**
5
+ * Returns the `Gtk.Application` provided by the nearest `Application` ancestor, throwing if used outside one.
6
+ */
7
+ export declare const useApplication: () => Gtk.Application;
8
+ //# sourceMappingURL=use-application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-application.d.ts","sourceRoot":"","sources":["../../src/hooks/use-application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,EAAsB,MAAM,OAAO,CAAC;AAEzD,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAA+C,CAAC;AAE/G;;GAEG;AACH,eAAO,MAAM,cAAc,QAAO,GAAG,CAAC,WAQrC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { createContext, use } from "react";
2
+ export const ApplicationContext = createContext(null);
3
+ /**
4
+ * Returns the `Gtk.Application` provided by the nearest `Application` ancestor, throwing if used outside one.
5
+ */
6
+ export const useApplication = () => {
7
+ const context = use(ApplicationContext);
8
+ if (!context) {
9
+ throw new Error("Expected ApplicationContext: useApplication must be called within Application");
10
+ }
11
+ return context;
12
+ };
13
+ //# sourceMappingURL=use-application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-application.js","sourceRoot":"","sources":["../../src/hooks/use-application.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,CAAC,MAAM,kBAAkB,GAAoC,aAAa,CAAyB,IAAI,CAAC,CAAC;AAE/G;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAoB,EAAE;IAChD,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAExC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type Context, createContext, use } from \"react\";\n\nexport const ApplicationContext: Context<Gtk.Application | null> = createContext<Gtk.Application | null>(null);\n\n/**\n * Returns the `Gtk.Application` provided by the nearest `Application` ancestor, throwing if used outside one.\n */\nexport const useApplication = (): Gtk.Application => {\n const context = use(ApplicationContext);\n\n if (!context) {\n throw new Error(\"Expected ApplicationContext: useApplication must be called within Application\");\n }\n\n return context;\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import * as Gio from "@gtkx/gi/gio";
2
+ import type * as GObject from "@gtkx/gi/gobject";
3
+ import type { ObjectProp } from "../utils/object-prop.js";
4
+ import { type SchemaRef } from "./use-setting.js";
5
+ export declare function useBindSetting<K extends object, P extends keyof K & string>(schema: SchemaRef<K>, key: P, object: ObjectProp<GObject.Object>, property: string, flags?: Gio.SettingsBindFlags): void;
6
+ //# sourceMappingURL=use-bind-setting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bind-setting.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,kBAAkB,CAAC;AAEvE,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EACvE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAC9B,IAAI,CAAC"}
@@ -0,0 +1,19 @@
1
+ import * as Gio from "@gtkx/gi/gio";
2
+ import { toKebabCase } from "@gtkx/utils";
3
+ import { useObjectAttachment } from "./use-object-attachment.js";
4
+ import { useSettingsInstance } from "./use-setting.js";
5
+ export function useBindSetting(schema, key, object, property, flags = Gio.SettingsBindFlags.DEFAULT) {
6
+ const settings = useSettingsInstance(schema);
7
+ const propertyName = toKebabCase(property);
8
+ useObjectAttachment(object, {
9
+ attach: (obj) => {
10
+ settings.bind(key, obj, propertyName, flags);
11
+ return obj;
12
+ },
13
+ detach: (obj) => {
14
+ Gio.Settings.unbind(obj, propertyName);
15
+ },
16
+ isSame: (attachment, current) => attachment === current,
17
+ });
18
+ }
19
+ //# sourceMappingURL=use-bind-setting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bind-setting.js","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AASvE,MAAM,UAAU,cAAc,CAC1B,MAAiB,EACjB,GAAW,EACX,MAAkC,EAClC,QAAgB,EAChB,KAAK,GAA0B,GAAG,CAAC,iBAAiB,CAAC,OAAO;IAE5D,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAE3C,mBAAmB,CAAiC,MAAM,EAAE;QACxD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACZ,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;YAC7C,OAAO,GAAG,CAAC;QACf,CAAC;QACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACZ,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,KAAK,OAAO;KAC1D,CAAC,CAAC;AACP,CAAC","sourcesContent":["import * as Gio from \"@gtkx/gi/gio\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport { toKebabCase } from \"@gtkx/utils\";\nimport type { ObjectProp } from \"../utils/object-prop.js\";\nimport { useObjectAttachment } from \"./use-object-attachment.js\";\nimport { type SchemaRef, useSettingsInstance } from \"./use-setting.js\";\n\nexport function useBindSetting<K extends object, P extends keyof K & string>(\n schema: SchemaRef<K>,\n key: P,\n object: ObjectProp<GObject.Object>,\n property: string,\n flags?: Gio.SettingsBindFlags,\n): void;\nexport function useBindSetting(\n schema: SchemaRef,\n key: string,\n object: ObjectProp<GObject.Object>,\n property: string,\n flags: Gio.SettingsBindFlags = Gio.SettingsBindFlags.DEFAULT,\n): void {\n const settings = useSettingsInstance(schema);\n const propertyName = toKebabCase(property);\n\n useObjectAttachment<GObject.Object, GObject.Object>(object, {\n attach: (obj) => {\n settings.bind(key, obj, propertyName, flags);\n return obj;\n },\n detach: (obj) => {\n Gio.Settings.unbind(obj, propertyName);\n },\n isSame: (attachment, current) => attachment === current,\n });\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { type Ref, type RefCallback } from "react";
2
+ export declare const useMergeRefs: <T>(...refs: Array<Ref<T | null> | undefined>) => RefCallback<T>;
3
+ //# sourceMappingURL=use-merge-refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-merge-refs.d.ts","sourceRoot":"","sources":["../../src/hooks/use-merge-refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAwC,MAAM,OAAO,CAAC;AAqBzF,eAAO,MAAM,YAAY,GAAI,CAAC,WAAW,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,KAAG,WAAW,CAAC,CAAC,CA+BxF,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { useCallback, useLayoutEffect, useRef } from "react";
2
+ const attachRef = (ref, value) => {
3
+ if (typeof ref === "function") {
4
+ const cleanup = ref(value);
5
+ return typeof cleanup === "function" ? cleanup : () => ref(null);
6
+ }
7
+ if (ref) {
8
+ ref.current = value;
9
+ return () => {
10
+ ref.current = null;
11
+ };
12
+ }
13
+ return undefined;
14
+ };
15
+ export const useMergeRefs = (...refs) => {
16
+ const latestRefs = useRef(refs);
17
+ latestRefs.current = refs;
18
+ const attachedRef = useRef(null);
19
+ useLayoutEffect(() => {
20
+ const attached = attachedRef.current;
21
+ if (attached === null)
22
+ return;
23
+ const next = latestRefs.current;
24
+ for (let index = next.length; index < attached.entries.length; index += 1) {
25
+ attached.entries[index]?.cleanup?.();
26
+ }
27
+ attached.entries = next.map((ref, index) => {
28
+ const entry = attached.entries[index];
29
+ if (entry !== undefined && entry.ref === ref)
30
+ return entry;
31
+ entry?.cleanup?.();
32
+ return { ref, cleanup: attachRef(ref, attached.value) };
33
+ });
34
+ });
35
+ return useCallback((value) => {
36
+ const entries = latestRefs.current.map((ref) => ({ ref, cleanup: attachRef(ref, value) }));
37
+ attachedRef.current = { value, entries };
38
+ return () => {
39
+ const attached = attachedRef.current;
40
+ attachedRef.current = null;
41
+ if (attached) {
42
+ for (const entry of attached.entries)
43
+ entry.cleanup?.();
44
+ }
45
+ };
46
+ }, []);
47
+ };
48
+ //# sourceMappingURL=use-merge-refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-merge-refs.js","sourceRoot":"","sources":["../../src/hooks/use-merge-refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAOzF,MAAM,SAAS,GAAG,CAAI,GAA8B,EAAE,KAAQ,EAA4B,EAAE;IACxF,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,GAAG,EAAE,CAAC;QACN,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACpB,OAAO,GAAG,EAAE;YACR,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC;IACN,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,GAAG,IAAsC,EAAkB,EAAE;IACzF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;IAC1B,MAAM,WAAW,GAAG,MAAM,CAAoD,IAAI,CAAC,CAAC;IAEpF,eAAe,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;QACrC,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO;QAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;QAChC,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACxE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;QACzC,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG;gBAAE,OAAO,KAAK,CAAC;YAC3D,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,CAAC,KAAQ,EAAE,EAAE;QAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3F,WAAW,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACzC,OAAO,GAAG,EAAE;YACR,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;YACrC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,IAAI,QAAQ,EAAE,CAAC;gBACX,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO;oBAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5D,CAAC;QACL,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC,CAAC","sourcesContent":["import { type Ref, type RefCallback, useCallback, useLayoutEffect, useRef } from \"react\";\n\ntype MergedRefEntry<T> = {\n ref: Ref<T | null> | undefined;\n cleanup: (() => void) | undefined;\n};\n\nconst attachRef = <T>(ref: Ref<T | null> | undefined, value: T): (() => void) | undefined => {\n if (typeof ref === \"function\") {\n const cleanup = ref(value);\n return typeof cleanup === \"function\" ? cleanup : () => ref(null);\n }\n if (ref) {\n ref.current = value;\n return () => {\n ref.current = null;\n };\n }\n return undefined;\n};\n\nexport const useMergeRefs = <T>(...refs: Array<Ref<T | null> | undefined>): RefCallback<T> => {\n const latestRefs = useRef(refs);\n latestRefs.current = refs;\n const attachedRef = useRef<{ value: T; entries: MergedRefEntry<T>[] } | null>(null);\n\n useLayoutEffect(() => {\n const attached = attachedRef.current;\n if (attached === null) return;\n const next = latestRefs.current;\n for (let index = next.length; index < attached.entries.length; index += 1) {\n attached.entries[index]?.cleanup?.();\n }\n attached.entries = next.map((ref, index) => {\n const entry = attached.entries[index];\n if (entry !== undefined && entry.ref === ref) return entry;\n entry?.cleanup?.();\n return { ref, cleanup: attachRef(ref, attached.value) };\n });\n });\n\n return useCallback((value: T) => {\n const entries = latestRefs.current.map((ref) => ({ ref, cleanup: attachRef(ref, value) }));\n attachedRef.current = { value, entries };\n return () => {\n const attached = attachedRef.current;\n attachedRef.current = null;\n if (attached) {\n for (const entry of attached.entries) entry.cleanup?.();\n }\n };\n }, []);\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ import { type ObjectProp } from "../utils/object-prop.js";
3
+ type ObjectAttachmentOps<T extends GObject.Object, A> = {
4
+ attach(object: T): A;
5
+ detach(attachment: A): void;
6
+ isSame(attachment: A, object: T): boolean;
7
+ };
8
+ export declare const useObjectAttachment: <T extends GObject.Object, A>(object: ObjectProp<T>, ops: ObjectAttachmentOps<T, A>) => void;
9
+ export {};
10
+ //# sourceMappingURL=use-object-attachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-object-attachment.d.ts","sourceRoot":"","sources":["../../src/hooks/use-object-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,yBAAyB,CAAC;AAE7E,KAAK,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI;IACpD,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,UACnD,UAAU,CAAC,CAAC,CAAC,OAChB,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,KAC/B,IAqBF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { useLayoutEffect, useRef } from "react";
2
+ import { resolveObjectProp } from "../utils/object-prop.js";
3
+ export const useObjectAttachment = (object, ops) => {
4
+ const attachmentRef = useRef(null);
5
+ const drop = () => {
6
+ const attachment = attachmentRef.current;
7
+ if (attachment !== null) {
8
+ ops.detach(attachment);
9
+ attachmentRef.current = null;
10
+ }
11
+ };
12
+ useLayoutEffect(() => {
13
+ const resolved = resolveObjectProp(object);
14
+ const attachment = attachmentRef.current;
15
+ if (attachment !== null && resolved !== null && ops.isSame(attachment, resolved))
16
+ return;
17
+ drop();
18
+ if (resolved === null)
19
+ return;
20
+ attachmentRef.current = ops.attach(resolved);
21
+ });
22
+ useLayoutEffect(() => () => drop(), []);
23
+ };
24
+ //# sourceMappingURL=use-object-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-object-attachment.js","sourceRoot":"","sources":["../../src/hooks/use-object-attachment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAmB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,MAAqB,EACrB,GAA8B,EAC1B,EAAE;IACN,MAAM,aAAa,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IAE7C,MAAM,IAAI,GAAG,GAAS,EAAE;QACpB,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC;QACzC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACvB,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QACjC,CAAC;IACL,CAAC,CAAC;IAEF,eAAe,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC;QACzC,IAAI,UAAU,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC;YAAE,OAAO;QACzF,IAAI,EAAE,CAAC;QACP,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO;QAC9B,aAAa,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport { useLayoutEffect, useRef } from \"react\";\nimport { type ObjectProp, resolveObjectProp } from \"../utils/object-prop.js\";\n\ntype ObjectAttachmentOps<T extends GObject.Object, A> = {\n attach(object: T): A;\n detach(attachment: A): void;\n isSame(attachment: A, object: T): boolean;\n};\n\nexport const useObjectAttachment = <T extends GObject.Object, A>(\n object: ObjectProp<T>,\n ops: ObjectAttachmentOps<T, A>,\n): void => {\n const attachmentRef = useRef<A | null>(null);\n\n const drop = (): void => {\n const attachment = attachmentRef.current;\n if (attachment !== null) {\n ops.detach(attachment);\n attachmentRef.current = null;\n }\n };\n\n useLayoutEffect(() => {\n const resolved = resolveObjectProp(object);\n const attachment = attachmentRef.current;\n if (attachment !== null && resolved !== null && ops.isSame(attachment, resolved)) return;\n drop();\n if (resolved === null) return;\n attachmentRef.current = ops.attach(resolved);\n });\n\n useLayoutEffect(() => () => drop(), []);\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ import { type ObjectProp } from "../utils/object-prop.js";
3
+ export declare function useObjectValue<T extends GObject.Object, V>(object: ObjectProp<T>, signal: string, read: (object: T | null) => V): V;
4
+ //# sourceMappingURL=use-object-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-object-value.d.ts","sourceRoot":"","sources":["../../src/hooks/use-object-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,yBAAyB,CAAC;AAQ7E,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,EACtD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAC9B,CAAC,CAkCH"}
@@ -0,0 +1,32 @@
1
+ import { useCallback, useRef, useSyncExternalStore } from "react";
2
+ import { resolveObjectProp } from "../utils/object-prop.js";
3
+ export function useObjectValue(object, signal, read) {
4
+ const resolved = resolveObjectProp(object);
5
+ const readRef = useRef(read);
6
+ readRef.current = read;
7
+ const cacheRef = useRef(null);
8
+ const readNow = useCallback(() => {
9
+ const cache = { object: resolved, signal, value: readRef.current(resolved) };
10
+ cacheRef.current = cache;
11
+ return cache;
12
+ }, [resolved, signal]);
13
+ const getSnapshot = useCallback(() => {
14
+ const cache = cacheRef.current;
15
+ if (cache !== null && cache.object === resolved && cache.signal === signal) {
16
+ return cache.value;
17
+ }
18
+ return readNow().value;
19
+ }, [resolved, signal, readNow]);
20
+ const subscribe = useCallback((onStoreChange) => {
21
+ if (resolved === null)
22
+ return () => { };
23
+ const handler = () => {
24
+ readNow();
25
+ onStoreChange();
26
+ };
27
+ resolved.on(signal, handler);
28
+ return () => resolved.off(signal, handler);
29
+ }, [resolved, signal, readNow]);
30
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
31
+ }
32
+ //# sourceMappingURL=use-object-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-object-value.js","sourceRoot":"","sources":["../../src/hooks/use-object-value.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAmB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ7E,MAAM,UAAU,cAAc,CAC1B,MAAqB,EACrB,MAAc,EACd,IAA6B;IAE7B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,MAAM,QAAQ,GAAG,MAAM,CAAgC,IAAI,CAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,WAAW,CAAC,GAA2B,EAAE;QACrD,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7E,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QACzB,OAAO,KAAK,CAAC;IACjB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAM,EAAE;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC/B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACzE,OAAO,KAAK,CAAC,KAAK,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,EAAE,CAAC,KAAK,CAAC;IAC3B,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEhC,MAAM,SAAS,GAAG,WAAW,CACzB,CAAC,aAAyB,EAAgB,EAAE;QACxC,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QACvC,MAAM,OAAO,GAAkB,GAAG,EAAE;YAChC,OAAO,EAAE,CAAC;YACV,aAAa,EAAE,CAAC;QACpB,CAAC,CAAC;QACF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAC9B,CAAC;IAEF,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\nimport { type ObjectProp, resolveObjectProp } from \"../utils/object-prop.js\";\n\ntype ObjectValueCache<T extends GObject.Object, V> = {\n object: T | null;\n signal: string;\n value: V;\n};\n\nexport function useObjectValue<T extends GObject.Object, V>(\n object: ObjectProp<T>,\n signal: string,\n read: (object: T | null) => V,\n): V {\n const resolved = resolveObjectProp(object);\n const readRef = useRef(read);\n readRef.current = read;\n const cacheRef = useRef<ObjectValueCache<T, V> | null>(null);\n\n const readNow = useCallback((): ObjectValueCache<T, V> => {\n const cache = { object: resolved, signal, value: readRef.current(resolved) };\n cacheRef.current = cache;\n return cache;\n }, [resolved, signal]);\n\n const getSnapshot = useCallback((): V => {\n const cache = cacheRef.current;\n if (cache !== null && cache.object === resolved && cache.signal === signal) {\n return cache.value;\n }\n return readNow().value;\n }, [resolved, signal, readNow]);\n\n const subscribe = useCallback(\n (onStoreChange: () => void): (() => void) => {\n if (resolved === null) return () => {};\n const handler: SignalHandler = () => {\n readNow();\n onStoreChange();\n };\n resolved.on(signal, handler);\n return () => resolved.off(signal, handler);\n },\n [resolved, signal, readNow],\n );\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type * as Gtk from "@gtkx/gi/gtk";
2
+ import { type Context } from "react";
3
+ export declare const ParentWindowContext: Context<Gtk.Window | null>;
4
+ /**
5
+ * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.
6
+ */
7
+ export declare const useParentWindow: () => Gtk.Window | null;
8
+ //# sourceMappingURL=use-parent-window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-parent-window.d.ts","sourceRoot":"","sources":["../../src/hooks/use-parent-window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,EAAsB,MAAM,OAAO,CAAC;AAEzD,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAA0C,CAAC;AAEtG;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,GAAG,CAAC,MAAM,GAAG,IAAgC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createContext, use } from "react";
2
+ export const ParentWindowContext = createContext(null);
3
+ /**
4
+ * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.
5
+ */
6
+ export const useParentWindow = () => use(ParentWindowContext);
7
+ //# sourceMappingURL=use-parent-window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-parent-window.js","sourceRoot":"","sources":["../../src/hooks/use-parent-window.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAA+B,aAAa,CAAoB,IAAI,CAAC,CAAC;AAEtG;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAsB,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type Context, createContext, use } from \"react\";\n\nexport const ParentWindowContext: Context<Gtk.Window | null> = createContext<Gtk.Window | null>(null);\n\n/**\n * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.\n */\nexport const useParentWindow = (): Gtk.Window | null => use(ParentWindowContext);\n"]}
@@ -0,0 +1,14 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ import type { ObjectProp } from "../utils/object-prop.js";
3
+ type PropertiesOf<T extends GObject.Object> = NonNullable<T["__properties__"]>;
4
+ export type PropertyNameOf<T extends GObject.Object> = keyof PropertiesOf<T> & keyof T & string;
5
+ /**
6
+ * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
7
+ *
8
+ * @param object The GObject (or ref to one) whose property to observe.
9
+ * @param propertyName The camelCase name of a readable property on the object.
10
+ * @returns The current property value, or `undefined` when the object is not resolved.
11
+ */
12
+ export declare function useProperty<T extends GObject.Object, K extends PropertyNameOf<T>>(object: ObjectProp<T>, propertyName: K): T[K] | undefined;
13
+ export {};
14
+ //# sourceMappingURL=use-property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-property.d.ts","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAEhG;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAC7E,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EACrB,YAAY,EAAE,CAAC,GAChB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAElB"}
@@ -0,0 +1,13 @@
1
+ import { propToNotifySignal } from "../utils/notify-name.js";
2
+ import { useObjectValue } from "./use-object-value.js";
3
+ /**
4
+ * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
5
+ *
6
+ * @param object The GObject (or ref to one) whose property to observe.
7
+ * @param propertyName The camelCase name of a readable property on the object.
8
+ * @returns The current property value, or `undefined` when the object is not resolved.
9
+ */
10
+ export function useProperty(object, propertyName) {
11
+ return useObjectValue(object, propToNotifySignal(propertyName), (obj) => (obj ? obj[propertyName] : undefined));
12
+ }
13
+ //# sourceMappingURL=use-property.js.map