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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/dist/adw/config.d.ts +2 -0
  2. package/dist/adw/config.d.ts.map +1 -0
  3. package/dist/adw/config.js +2 -0
  4. package/dist/adw/config.js.map +1 -0
  5. package/dist/{libraries/adw → adw}/dialog.d.ts +2 -2
  6. package/dist/adw/dialog.d.ts.map +1 -0
  7. package/dist/adw/dialog.js +25 -0
  8. package/dist/adw/dialog.js.map +1 -0
  9. package/dist/adw/element-behaviors.d.ts +2 -0
  10. package/dist/adw/element-behaviors.d.ts.map +1 -0
  11. package/dist/adw/element-behaviors.js +269 -0
  12. package/dist/adw/element-behaviors.js.map +1 -0
  13. package/dist/adw/element-config.d.ts +11 -0
  14. package/dist/adw/element-config.d.ts.map +1 -0
  15. package/dist/adw/element-config.js +127 -0
  16. package/dist/adw/element-config.js.map +1 -0
  17. package/dist/adw/index.d.ts +4 -0
  18. package/dist/adw/index.d.ts.map +1 -0
  19. package/dist/adw/index.js +3 -0
  20. package/dist/adw/index.js.map +1 -0
  21. package/dist/adw/prop-types.d.ts +29 -0
  22. package/dist/adw/prop-types.d.ts.map +1 -0
  23. package/dist/adw/prop-types.js +2 -0
  24. package/dist/adw/prop-types.js.map +1 -0
  25. package/dist/bootstrap.d.ts +2 -0
  26. package/dist/bootstrap.d.ts.map +1 -0
  27. package/dist/bootstrap.js +5 -0
  28. package/dist/bootstrap.js.map +1 -0
  29. package/dist/components/application.d.ts +2 -2
  30. package/dist/components/application.d.ts.map +1 -1
  31. package/dist/components/application.js +31 -18
  32. package/dist/components/application.js.map +1 -1
  33. package/dist/components/element.d.ts +6 -0
  34. package/dist/components/element.d.ts.map +1 -0
  35. package/dist/components/element.js +29 -0
  36. package/dist/components/element.js.map +1 -0
  37. package/dist/components/window.d.ts +2 -2
  38. package/dist/components/window.d.ts.map +1 -1
  39. package/dist/components/window.js +22 -12
  40. package/dist/components/window.js.map +1 -1
  41. package/dist/config.d.ts +4 -0
  42. package/dist/config.d.ts.map +1 -0
  43. package/dist/config.js +3 -0
  44. package/dist/config.js.map +1 -0
  45. package/dist/element-behaviors.d.ts +2 -0
  46. package/dist/element-behaviors.d.ts.map +1 -0
  47. package/dist/element-behaviors.js +348 -0
  48. package/dist/element-behaviors.js.map +1 -0
  49. package/dist/element-config.d.ts +10 -0
  50. package/dist/element-config.d.ts.map +1 -0
  51. package/dist/element-config.js +149 -0
  52. package/dist/element-config.js.map +1 -0
  53. package/dist/hooks/use-application.d.ts +4 -3
  54. package/dist/hooks/use-application.d.ts.map +1 -1
  55. package/dist/hooks/use-application.js +5 -4
  56. package/dist/hooks/use-application.js.map +1 -1
  57. package/dist/hooks/use-bind-setting.d.ts +21 -4
  58. package/dist/hooks/use-bind-setting.d.ts.map +1 -1
  59. package/dist/hooks/use-bind-setting.js +27 -16
  60. package/dist/hooks/use-bind-setting.js.map +1 -1
  61. package/dist/hooks/use-merged-refs.d.ts +8 -0
  62. package/dist/hooks/use-merged-refs.d.ts.map +1 -0
  63. package/dist/hooks/use-merged-refs.js +48 -0
  64. package/dist/hooks/use-merged-refs.js.map +1 -0
  65. package/dist/hooks/use-object-value.d.ts +3 -2
  66. package/dist/hooks/use-object-value.d.ts.map +1 -1
  67. package/dist/hooks/use-object-value.js +18 -21
  68. package/dist/hooks/use-object-value.js.map +1 -1
  69. package/dist/hooks/use-parent-window.d.ts +3 -2
  70. package/dist/hooks/use-parent-window.d.ts.map +1 -1
  71. package/dist/hooks/use-parent-window.js +3 -2
  72. package/dist/hooks/use-parent-window.js.map +1 -1
  73. package/dist/hooks/use-property.d.ts +5 -5
  74. package/dist/hooks/use-property.d.ts.map +1 -1
  75. package/dist/hooks/use-property.js +4 -3
  76. package/dist/hooks/use-property.js.map +1 -1
  77. package/dist/hooks/use-setting.d.ts +5 -16
  78. package/dist/hooks/use-setting.d.ts.map +1 -1
  79. package/dist/hooks/use-setting.js +16 -11
  80. package/dist/hooks/use-setting.js.map +1 -1
  81. package/dist/hooks/use-signal.d.ts +14 -7
  82. package/dist/hooks/use-signal.d.ts.map +1 -1
  83. package/dist/hooks/use-signal.js +33 -18
  84. package/dist/hooks/use-signal.js.map +1 -1
  85. package/dist/index.d.ts +7 -8
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +2 -3
  88. package/dist/index.js.map +1 -1
  89. package/dist/internal.d.ts +7 -7
  90. package/dist/internal.d.ts.map +1 -1
  91. package/dist/internal.js +6 -7
  92. package/dist/internal.js.map +1 -1
  93. package/dist/prop-types.d.ts +110 -0
  94. package/dist/prop-types.d.ts.map +1 -0
  95. package/dist/prop-types.js +2 -0
  96. package/dist/prop-types.js.map +1 -0
  97. package/dist/reconciler/apply-props.d.ts +10 -7
  98. package/dist/reconciler/apply-props.d.ts.map +1 -1
  99. package/dist/reconciler/apply-props.js +186 -82
  100. package/dist/reconciler/apply-props.js.map +1 -1
  101. package/dist/reconciler/behaviors.d.ts +59 -0
  102. package/dist/reconciler/behaviors.d.ts.map +1 -0
  103. package/dist/reconciler/behaviors.js +177 -0
  104. package/dist/reconciler/behaviors.js.map +1 -0
  105. package/dist/reconciler/child-routing.d.ts +5 -0
  106. package/dist/reconciler/child-routing.d.ts.map +1 -0
  107. package/dist/reconciler/child-routing.js +156 -0
  108. package/dist/reconciler/child-routing.js.map +1 -0
  109. package/dist/reconciler/host-config.d.ts +8 -12
  110. package/dist/reconciler/host-config.d.ts.map +1 -1
  111. package/dist/reconciler/host-config.js +171 -270
  112. package/dist/reconciler/host-config.js.map +1 -1
  113. package/dist/reconciler/instance.d.ts +4 -5
  114. package/dist/reconciler/instance.d.ts.map +1 -1
  115. package/dist/reconciler/instance.js +44 -22
  116. package/dist/reconciler/instance.js.map +1 -1
  117. package/dist/reconciler/metadata.d.ts +17 -0
  118. package/dist/reconciler/metadata.d.ts.map +1 -0
  119. package/dist/reconciler/metadata.js +82 -0
  120. package/dist/reconciler/metadata.js.map +1 -0
  121. package/dist/reconciler/node.d.ts +76 -0
  122. package/dist/reconciler/node.d.ts.map +1 -0
  123. package/dist/reconciler/node.js +53 -0
  124. package/dist/reconciler/node.js.map +1 -0
  125. package/dist/reconciler/placement.d.ts +5 -0
  126. package/dist/reconciler/placement.d.ts.map +1 -0
  127. package/dist/reconciler/placement.js +191 -0
  128. package/dist/reconciler/placement.js.map +1 -0
  129. package/dist/reconciler/registry.d.ts +107 -0
  130. package/dist/reconciler/registry.d.ts.map +1 -0
  131. package/dist/reconciler/registry.js +74 -0
  132. package/dist/reconciler/registry.js.map +1 -0
  133. package/dist/reconciler/root-element.d.ts +9 -12
  134. package/dist/reconciler/root-element.d.ts.map +1 -1
  135. package/dist/reconciler/root-element.js +6 -6
  136. package/dist/reconciler/root-element.js.map +1 -1
  137. package/dist/reconciler/root.d.ts +56 -0
  138. package/dist/reconciler/root.d.ts.map +1 -0
  139. package/dist/reconciler/root.js +106 -0
  140. package/dist/reconciler/root.js.map +1 -0
  141. package/dist/reconciler/signals.d.ts +9 -0
  142. package/dist/reconciler/signals.d.ts.map +1 -0
  143. package/dist/reconciler/signals.js +58 -0
  144. package/dist/reconciler/signals.js.map +1 -0
  145. package/dist/reconciler/text.d.ts +19 -0
  146. package/dist/reconciler/text.d.ts.map +1 -0
  147. package/dist/reconciler/text.js +281 -0
  148. package/dist/reconciler/text.js.map +1 -0
  149. package/dist/utils/accessible-metadata.d.ts +11 -4
  150. package/dist/utils/accessible-metadata.d.ts.map +1 -1
  151. package/dist/utils/accessible-metadata.js +20 -17
  152. package/dist/utils/accessible-metadata.js.map +1 -1
  153. package/dist/{reconciler/accessible.d.ts → utils/accessible-props.d.ts} +7 -6
  154. package/dist/utils/accessible-props.d.ts.map +1 -0
  155. package/dist/utils/accessible-props.js +181 -0
  156. package/dist/utils/accessible-props.js.map +1 -0
  157. package/dist/utils/ref-prop.d.ts +15 -0
  158. package/dist/utils/ref-prop.d.ts.map +1 -0
  159. package/dist/utils/ref-prop.js +18 -0
  160. package/dist/utils/ref-prop.js.map +1 -0
  161. package/dist/utils/settings.d.ts +17 -0
  162. package/dist/utils/settings.d.ts.map +1 -0
  163. package/dist/utils/settings.js +37 -0
  164. package/dist/utils/settings.js.map +1 -0
  165. package/dist/utils/variant.d.ts +57 -0
  166. package/dist/utils/variant.d.ts.map +1 -0
  167. package/dist/utils/variant.js +197 -0
  168. package/dist/utils/variant.js.map +1 -0
  169. package/env.d.ts +9 -0
  170. package/package.json +36 -11
  171. package/src/adw/config.ts +1 -0
  172. package/src/adw/dialog.tsx +35 -0
  173. package/src/adw/element-behaviors.ts +349 -0
  174. package/src/adw/element-config.ts +131 -0
  175. package/src/adw/index.ts +4 -0
  176. package/src/adw/prop-types.ts +42 -0
  177. package/src/bootstrap.ts +5 -0
  178. package/src/components/application.tsx +42 -23
  179. package/src/components/element.tsx +47 -0
  180. package/src/components/window.tsx +26 -14
  181. package/src/config.ts +10 -0
  182. package/src/element-behaviors.ts +424 -0
  183. package/src/element-config.ts +151 -0
  184. package/src/env.d.ts +1 -0
  185. package/src/hooks/use-application.ts +6 -4
  186. package/src/hooks/use-bind-setting.ts +47 -31
  187. package/src/hooks/use-merged-refs.ts +64 -0
  188. package/src/hooks/use-object-value.ts +27 -23
  189. package/src/hooks/use-parent-window.ts +4 -2
  190. package/src/hooks/use-property.ts +11 -10
  191. package/src/hooks/use-setting.ts +20 -33
  192. package/src/hooks/use-signal.ts +41 -48
  193. package/src/index.ts +7 -8
  194. package/src/internal.ts +8 -18
  195. package/src/prop-types.ts +142 -0
  196. package/src/reconciler/apply-props.ts +239 -85
  197. package/src/reconciler/behaviors.ts +330 -0
  198. package/src/reconciler/child-routing.ts +202 -0
  199. package/src/reconciler/host-config.ts +235 -367
  200. package/src/reconciler/instance.ts +76 -24
  201. package/src/reconciler/metadata.ts +119 -0
  202. package/src/reconciler/node.ts +161 -0
  203. package/src/reconciler/placement.ts +275 -0
  204. package/src/reconciler/registry.ts +175 -0
  205. package/src/reconciler/root-element.ts +9 -11
  206. package/src/reconciler/root.ts +172 -0
  207. package/src/reconciler/signals.ts +92 -0
  208. package/src/reconciler/text.ts +414 -0
  209. package/src/utils/accessible-metadata.ts +23 -18
  210. package/src/utils/accessible-props.ts +279 -0
  211. package/src/utils/ref-prop.ts +30 -0
  212. package/src/utils/settings.ts +69 -0
  213. package/src/utils/variant.ts +368 -0
  214. package/dist/hooks/use-merge-refs.d.ts +0 -3
  215. package/dist/hooks/use-merge-refs.d.ts.map +0 -1
  216. package/dist/hooks/use-merge-refs.js +0 -48
  217. package/dist/hooks/use-merge-refs.js.map +0 -1
  218. package/dist/hooks/use-object-attachment.d.ts +0 -10
  219. package/dist/hooks/use-object-attachment.d.ts.map +0 -1
  220. package/dist/hooks/use-object-attachment.js +0 -24
  221. package/dist/hooks/use-object-attachment.js.map +0 -1
  222. package/dist/libraries/adw/dialog.d.ts.map +0 -1
  223. package/dist/libraries/adw/dialog.js +0 -25
  224. package/dist/libraries/adw/dialog.js.map +0 -1
  225. package/dist/libraries/adw/index.d.ts +0 -2
  226. package/dist/libraries/adw/index.d.ts.map +0 -1
  227. package/dist/libraries/adw/index.js +0 -2
  228. package/dist/libraries/adw/index.js.map +0 -1
  229. package/dist/reconciler/accessible.d.ts.map +0 -1
  230. package/dist/reconciler/accessible.js +0 -143
  231. package/dist/reconciler/accessible.js.map +0 -1
  232. package/dist/reconciler/commit-flush.d.ts +0 -3
  233. package/dist/reconciler/commit-flush.d.ts.map +0 -1
  234. package/dist/reconciler/commit-flush.js +0 -13
  235. package/dist/reconciler/commit-flush.js.map +0 -1
  236. package/dist/reconciler/container-attach.d.ts +0 -10
  237. package/dist/reconciler/container-attach.d.ts.map +0 -1
  238. package/dist/reconciler/container-attach.js +0 -216
  239. package/dist/reconciler/container-attach.js.map +0 -1
  240. package/dist/reconciler/content-rebuild.d.ts +0 -3
  241. package/dist/reconciler/content-rebuild.d.ts.map +0 -1
  242. package/dist/reconciler/content-rebuild.js +0 -15
  243. package/dist/reconciler/content-rebuild.js.map +0 -1
  244. package/dist/reconciler/dispatch.d.ts +0 -6
  245. package/dist/reconciler/dispatch.d.ts.map +0 -1
  246. package/dist/reconciler/dispatch.js +0 -61
  247. package/dist/reconciler/dispatch.js.map +0 -1
  248. package/dist/reconciler/element-prop-appliers.d.ts +0 -5
  249. package/dist/reconciler/element-prop-appliers.d.ts.map +0 -1
  250. package/dist/reconciler/element-prop-appliers.js +0 -104
  251. package/dist/reconciler/element-prop-appliers.js.map +0 -1
  252. package/dist/reconciler/element-props.d.ts +0 -25
  253. package/dist/reconciler/element-props.d.ts.map +0 -1
  254. package/dist/reconciler/element-props.js +0 -157
  255. package/dist/reconciler/element-props.js.map +0 -1
  256. package/dist/reconciler/label-text-rebuild.d.ts +0 -3
  257. package/dist/reconciler/label-text-rebuild.d.ts.map +0 -1
  258. package/dist/reconciler/label-text-rebuild.js +0 -22
  259. package/dist/reconciler/label-text-rebuild.js.map +0 -1
  260. package/dist/reconciler/portal.d.ts +0 -11
  261. package/dist/reconciler/portal.d.ts.map +0 -1
  262. package/dist/reconciler/portal.js +0 -20
  263. package/dist/reconciler/portal.js.map +0 -1
  264. package/dist/reconciler/reconciler-error-handler.d.ts +0 -7
  265. package/dist/reconciler/reconciler-error-handler.d.ts.map +0 -1
  266. package/dist/reconciler/reconciler-error-handler.js +0 -24
  267. package/dist/reconciler/reconciler-error-handler.js.map +0 -1
  268. package/dist/reconciler/reconciler-root.d.ts +0 -19
  269. package/dist/reconciler/reconciler-root.d.ts.map +0 -1
  270. package/dist/reconciler/reconciler-root.js +0 -24
  271. package/dist/reconciler/reconciler-root.js.map +0 -1
  272. package/dist/reconciler/reconciler.d.ts +0 -3
  273. package/dist/reconciler/reconciler.d.ts.map +0 -1
  274. package/dist/reconciler/reconciler.js +0 -12
  275. package/dist/reconciler/reconciler.js.map +0 -1
  276. package/dist/reconciler/render.d.ts +0 -23
  277. package/dist/reconciler/render.d.ts.map +0 -1
  278. package/dist/reconciler/render.js +0 -46
  279. package/dist/reconciler/render.js.map +0 -1
  280. package/dist/reconciler/signal-store.d.ts +0 -22
  281. package/dist/reconciler/signal-store.d.ts.map +0 -1
  282. package/dist/reconciler/signal-store.js +0 -84
  283. package/dist/reconciler/signal-store.js.map +0 -1
  284. package/dist/reconciler/state.d.ts +0 -36
  285. package/dist/reconciler/state.d.ts.map +0 -1
  286. package/dist/reconciler/state.js +0 -38
  287. package/dist/reconciler/state.js.map +0 -1
  288. package/dist/reconciler/text-buffer-controller.d.ts +0 -17
  289. package/dist/reconciler/text-buffer-controller.d.ts.map +0 -1
  290. package/dist/reconciler/text-buffer-controller.js +0 -102
  291. package/dist/reconciler/text-buffer-controller.js.map +0 -1
  292. package/dist/reconciler/text-buffer-rebuild.d.ts +0 -3
  293. package/dist/reconciler/text-buffer-rebuild.d.ts.map +0 -1
  294. package/dist/reconciler/text-buffer-rebuild.js +0 -7
  295. package/dist/reconciler/text-buffer-rebuild.js.map +0 -1
  296. package/dist/reconciler/text-node.d.ts +0 -7
  297. package/dist/reconciler/text-node.d.ts.map +0 -1
  298. package/dist/reconciler/text-node.js +0 -8
  299. package/dist/reconciler/text-node.js.map +0 -1
  300. package/dist/reconciler/types.d.ts +0 -5
  301. package/dist/reconciler/types.d.ts.map +0 -1
  302. package/dist/reconciler/types.js +0 -2
  303. package/dist/reconciler/types.js.map +0 -1
  304. package/dist/reconciler/visibility.d.ts +0 -6
  305. package/dist/reconciler/visibility.d.ts.map +0 -1
  306. package/dist/reconciler/visibility.js +0 -57
  307. package/dist/reconciler/visibility.js.map +0 -1
  308. package/dist/reconciler/wrapper-apply.d.ts +0 -6
  309. package/dist/reconciler/wrapper-apply.d.ts.map +0 -1
  310. package/dist/reconciler/wrapper-apply.js +0 -287
  311. package/dist/reconciler/wrapper-apply.js.map +0 -1
  312. package/dist/reconciler/wrapper-content.d.ts +0 -8
  313. package/dist/reconciler/wrapper-content.d.ts.map +0 -1
  314. package/dist/reconciler/wrapper-content.js +0 -19
  315. package/dist/reconciler/wrapper-content.js.map +0 -1
  316. package/dist/reconciler/wrapper-node.d.ts +0 -8
  317. package/dist/reconciler/wrapper-node.d.ts.map +0 -1
  318. package/dist/reconciler/wrapper-node.js +0 -4
  319. package/dist/reconciler/wrapper-node.js.map +0 -1
  320. package/dist/reconciler/wrapper-protocol.d.ts +0 -13
  321. package/dist/reconciler/wrapper-protocol.d.ts.map +0 -1
  322. package/dist/reconciler/wrapper-protocol.js +0 -20
  323. package/dist/reconciler/wrapper-protocol.js.map +0 -1
  324. package/dist/utils/create-element-component.d.ts +0 -4
  325. package/dist/utils/create-element-component.d.ts.map +0 -1
  326. package/dist/utils/create-element-component.js +0 -54
  327. package/dist/utils/create-element-component.js.map +0 -1
  328. package/dist/utils/gtype.d.ts +0 -16
  329. package/dist/utils/gtype.d.ts.map +0 -1
  330. package/dist/utils/gtype.js +0 -127
  331. package/dist/utils/gtype.js.map +0 -1
  332. package/dist/utils/notify-name.d.ts +0 -5
  333. package/dist/utils/notify-name.d.ts.map +0 -1
  334. package/dist/utils/notify-name.js +0 -6
  335. package/dist/utils/notify-name.js.map +0 -1
  336. package/dist/utils/object-prop.d.ts +0 -8
  337. package/dist/utils/object-prop.d.ts.map +0 -1
  338. package/dist/utils/object-prop.js +0 -9
  339. package/dist/utils/object-prop.js.map +0 -1
  340. package/dist/utils/settings-accessor.d.ts +0 -8
  341. package/dist/utils/settings-accessor.d.ts.map +0 -1
  342. package/dist/utils/settings-accessor.js +0 -69
  343. package/dist/utils/settings-accessor.js.map +0 -1
  344. package/dist/utils/wrapper-node-jsx.d.ts +0 -32
  345. package/dist/utils/wrapper-node-jsx.d.ts.map +0 -1
  346. package/dist/utils/wrapper-node-jsx.js +0 -2
  347. package/dist/utils/wrapper-node-jsx.js.map +0 -1
  348. package/src/hooks/use-merge-refs.ts +0 -53
  349. package/src/hooks/use-object-attachment.ts +0 -35
  350. package/src/libraries/adw/dialog.tsx +0 -34
  351. package/src/libraries/adw/index.ts +0 -1
  352. package/src/reconciler/accessible.ts +0 -232
  353. package/src/reconciler/commit-flush.ts +0 -13
  354. package/src/reconciler/container-attach.ts +0 -219
  355. package/src/reconciler/content-rebuild.ts +0 -19
  356. package/src/reconciler/dispatch.ts +0 -58
  357. package/src/reconciler/element-prop-appliers.ts +0 -110
  358. package/src/reconciler/element-props.ts +0 -192
  359. package/src/reconciler/label-text-rebuild.ts +0 -26
  360. package/src/reconciler/portal.ts +0 -28
  361. package/src/reconciler/reconciler-error-handler.ts +0 -29
  362. package/src/reconciler/reconciler-root.ts +0 -57
  363. package/src/reconciler/reconciler.ts +0 -13
  364. package/src/reconciler/render.ts +0 -61
  365. package/src/reconciler/signal-store.ts +0 -103
  366. package/src/reconciler/state.ts +0 -72
  367. package/src/reconciler/text-buffer-controller.ts +0 -107
  368. package/src/reconciler/text-buffer-rebuild.ts +0 -12
  369. package/src/reconciler/text-node.ts +0 -13
  370. package/src/reconciler/types.ts +0 -6
  371. package/src/reconciler/visibility.ts +0 -52
  372. package/src/reconciler/wrapper-apply.ts +0 -308
  373. package/src/reconciler/wrapper-content.ts +0 -24
  374. package/src/reconciler/wrapper-node.ts +0 -8
  375. package/src/reconciler/wrapper-protocol.ts +0 -32
  376. package/src/utils/create-element-component.ts +0 -77
  377. package/src/utils/gtype.ts +0 -166
  378. package/src/utils/notify-name.ts +0 -10
  379. package/src/utils/object-prop.ts +0 -13
  380. package/src/utils/settings-accessor.ts +0 -89
  381. package/src/utils/wrapper-node-jsx.ts +0 -34
@@ -0,0 +1,10 @@
1
+ import { type ElementConfig } from "./reconciler/registry.js";
2
+ declare const SINGLE_CHILD_TYPES: string[];
3
+ /**
4
+ * The static, runtime-free half of the built-in element configuration: which base props interface each
5
+ * generated element extends, which component wraps it, and whether its GObject is created lazily by its
6
+ * parent. Codegen imports this module, so it must never reach the GObject bindings.
7
+ */
8
+ declare const BUILTIN_ELEMENTS: Record<string, ElementConfig>;
9
+ export { SINGLE_CHILD_TYPES, BUILTIN_ELEMENTS };
10
+ //# sourceMappingURL=element-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../src/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,0BAA0B,CAAC;AAElF,QAAA,MAAM,kBAAkB,EAAE,MAAM,EAsB/B,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAqHnD,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,149 @@
1
+ import { forTypes, internal } from "./reconciler/registry.js";
2
+ const SINGLE_CHILD_TYPES = [
3
+ "GtkAspectFrame",
4
+ "GtkButton",
5
+ "GtkCheckButton",
6
+ "GtkComboBox",
7
+ "GtkDragIcon",
8
+ "GtkExpander",
9
+ "GtkFlowBoxChild",
10
+ "GtkFrame",
11
+ "GtkGraphicsOffload",
12
+ "GtkListBoxRow",
13
+ "GtkListHeader",
14
+ "GtkListItem",
15
+ "GtkMenuButton",
16
+ "GtkPopover",
17
+ "GtkPopoverBin",
18
+ "GtkRevealer",
19
+ "GtkScrolledWindow",
20
+ "GtkSearchBar",
21
+ "GtkTreeExpander",
22
+ "GtkViewport",
23
+ "GtkWindowHandle",
24
+ ];
25
+ /**
26
+ * The static, runtime-free half of the built-in element configuration: which base props interface each
27
+ * generated element extends, which component wraps it, and whether its GObject is created lazily by its
28
+ * parent. Codegen imports this module, so it must never reach the GObject bindings.
29
+ */
30
+ const BUILTIN_ELEMENTS = {
31
+ ...forTypes(SINGLE_CHILD_TYPES, {
32
+ props: internal("ChildrenProps"),
33
+ omitProps: ["child"],
34
+ }),
35
+ ...forTypes(["GtkHeaderBar", "GtkActionBar"], {
36
+ props: internal("GtkHeaderBarProps"),
37
+ }),
38
+ GtkWindow: {
39
+ props: internal("ChildrenProps"),
40
+ component: internal("createWindowComponent"),
41
+ omitProps: ["child"],
42
+ },
43
+ GtkLabel: {
44
+ props: internal("ChildrenProps"),
45
+ },
46
+ GtkTextBuffer: {
47
+ props: internal("ChildrenProps"),
48
+ },
49
+ GtkTextTag: {
50
+ props: internal("ChildrenProps"),
51
+ },
52
+ GtkTextChildAnchor: {
53
+ props: internal("GtkTextChildAnchorProps"),
54
+ },
55
+ GtkGridLayoutChild: {
56
+ lazy: true,
57
+ },
58
+ GtkFixedLayoutChild: {
59
+ lazy: true,
60
+ },
61
+ GtkOverlayLayoutChild: {
62
+ lazy: true,
63
+ },
64
+ GtkStackPage: {
65
+ lazy: true,
66
+ },
67
+ GtkNotebookPage: {
68
+ lazy: true,
69
+ },
70
+ GActionGroup: {
71
+ props: internal("GActionGroupProps"),
72
+ },
73
+ GtkWidget: {
74
+ props: internal("GtkWidgetProps"),
75
+ },
76
+ GtkBox: {
77
+ props: internal("ChildrenProps"),
78
+ },
79
+ GtkListBox: {
80
+ props: internal("ChildrenProps"),
81
+ },
82
+ GtkFlowBox: {
83
+ props: internal("ChildrenProps"),
84
+ },
85
+ GtkOverlay: {
86
+ props: internal("GtkOverlayProps"),
87
+ omitProps: ["child"],
88
+ },
89
+ GtkShortcutController: {
90
+ props: internal("GtkShortcutControllerProps"),
91
+ },
92
+ GtkTextView: {
93
+ props: internal("ChildrenProps"),
94
+ },
95
+ GActionMap: {
96
+ props: internal("GActionMapProps"),
97
+ },
98
+ GMenu: {
99
+ props: internal("GMenuProps"),
100
+ },
101
+ GtkColumnView: {
102
+ props: internal("ChildrenProps"),
103
+ },
104
+ GtkGrid: {
105
+ props: internal("ChildrenProps"),
106
+ },
107
+ GtkFixed: {
108
+ props: internal("ChildrenProps"),
109
+ },
110
+ GtkSizeGroup: {
111
+ props: internal("GtkSizeGroupProps"),
112
+ },
113
+ GtkConstraintLayout: {
114
+ props: internal("GtkConstraintLayoutProps"),
115
+ },
116
+ GtkStack: {
117
+ props: internal("ChildrenProps"),
118
+ },
119
+ GtkNotebook: {
120
+ props: internal("ChildrenProps"),
121
+ },
122
+ GtkApplication: {
123
+ props: internal("GtkApplicationProps"),
124
+ component: internal("createApplicationComponent"),
125
+ },
126
+ GtkAboutDialog: {
127
+ props: internal("GtkAboutDialogProps"),
128
+ },
129
+ GtkScale: {
130
+ props: internal("GtkScaleProps"),
131
+ },
132
+ GtkCalendar: {
133
+ props: internal("GtkCalendarProps"),
134
+ },
135
+ GtkLevelBar: {
136
+ props: internal("GtkLevelBarProps"),
137
+ },
138
+ GtkDropTarget: {
139
+ props: internal("GtkDropTargetProps"),
140
+ },
141
+ GtkDrawingArea: {
142
+ props: internal("GtkDrawingAreaProps"),
143
+ },
144
+ GtkDragSource: {
145
+ props: internal("GtkDragSourceProps"),
146
+ },
147
+ };
148
+ export { SINGLE_CHILD_TYPES, BUILTIN_ELEMENTS };
149
+ //# sourceMappingURL=element-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../src/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,kBAAkB,GAAa;IACjC,gBAAgB;IAChB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,gBAAgB,GAAkC;IACpD,GAAG,QAAQ,CAAC,kBAAkB,EAAE;QAC5B,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;QAChC,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB,CAAC;IACF,GAAG,QAAQ,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE;QAC1C,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC,CAAC;IACF,SAAS,EAAE;QACP,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;QAChC,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC;QAC5C,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC;KAC7C;IACD,kBAAkB,EAAE;QAChB,IAAI,EAAE,IAAI;KACb;IACD,mBAAmB,EAAE;QACjB,IAAI,EAAE,IAAI;KACb;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,IAAI;KACb;IACD,YAAY,EAAE;QACV,IAAI,EAAE,IAAI;KACb;IACD,eAAe,EAAE;QACb,IAAI,EAAE,IAAI;KACb;IACD,YAAY,EAAE;QACV,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC;IACD,SAAS,EAAE;QACP,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC;KACpC;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;QAClC,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB;IACD,qBAAqB,EAAE;QACnB,KAAK,EAAE,QAAQ,CAAC,4BAA4B,CAAC;KAChD;IACD,WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,UAAU,EAAE;QACR,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;KACrC;IACD,KAAK,EAAE;QACH,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC;KAChC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,OAAO,EAAE;QACL,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,YAAY,EAAE;QACV,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC;KACvC;IACD,mBAAmB,EAAE;QACjB,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC;KAC9C;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC;QACtC,SAAS,EAAE,QAAQ,CAAC,4BAA4B,CAAC;KACpD;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC;KACzC;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC;KACnC;IACD,WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACtC;IACD,WAAW,EAAE;QACT,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACtC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;KACxC;IACD,cAAc,EAAE;QACZ,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC;KACzC;IACD,aAAa,EAAE;QACX,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;KACxC;CACJ,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { type ElementConfig, forTypes, internal } from \"./reconciler/registry.js\";\n\nconst SINGLE_CHILD_TYPES: string[] = [\n \"GtkAspectFrame\",\n \"GtkButton\",\n \"GtkCheckButton\",\n \"GtkComboBox\",\n \"GtkDragIcon\",\n \"GtkExpander\",\n \"GtkFlowBoxChild\",\n \"GtkFrame\",\n \"GtkGraphicsOffload\",\n \"GtkListBoxRow\",\n \"GtkListHeader\",\n \"GtkListItem\",\n \"GtkMenuButton\",\n \"GtkPopover\",\n \"GtkPopoverBin\",\n \"GtkRevealer\",\n \"GtkScrolledWindow\",\n \"GtkSearchBar\",\n \"GtkTreeExpander\",\n \"GtkViewport\",\n \"GtkWindowHandle\",\n];\n\n/**\n * The static, runtime-free half of the built-in element configuration: which base props interface each\n * generated element extends, which component wraps it, and whether its GObject is created lazily by its\n * parent. Codegen imports this module, so it must never reach the GObject bindings.\n */\nconst BUILTIN_ELEMENTS: Record<string, ElementConfig> = {\n ...forTypes(SINGLE_CHILD_TYPES, {\n props: internal(\"ChildrenProps\"),\n omitProps: [\"child\"],\n }),\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n props: internal(\"GtkHeaderBarProps\"),\n }),\n GtkWindow: {\n props: internal(\"ChildrenProps\"),\n component: internal(\"createWindowComponent\"),\n omitProps: [\"child\"],\n },\n GtkLabel: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextBuffer: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextTag: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextChildAnchor: {\n props: internal(\"GtkTextChildAnchorProps\"),\n },\n GtkGridLayoutChild: {\n lazy: true,\n },\n GtkFixedLayoutChild: {\n lazy: true,\n },\n GtkOverlayLayoutChild: {\n lazy: true,\n },\n GtkStackPage: {\n lazy: true,\n },\n GtkNotebookPage: {\n lazy: true,\n },\n GActionGroup: {\n props: internal(\"GActionGroupProps\"),\n },\n GtkWidget: {\n props: internal(\"GtkWidgetProps\"),\n },\n GtkBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkListBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkFlowBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkOverlay: {\n props: internal(\"GtkOverlayProps\"),\n omitProps: [\"child\"],\n },\n GtkShortcutController: {\n props: internal(\"GtkShortcutControllerProps\"),\n },\n GtkTextView: {\n props: internal(\"ChildrenProps\"),\n },\n GActionMap: {\n props: internal(\"GActionMapProps\"),\n },\n GMenu: {\n props: internal(\"GMenuProps\"),\n },\n GtkColumnView: {\n props: internal(\"ChildrenProps\"),\n },\n GtkGrid: {\n props: internal(\"ChildrenProps\"),\n },\n GtkFixed: {\n props: internal(\"ChildrenProps\"),\n },\n GtkSizeGroup: {\n props: internal(\"GtkSizeGroupProps\"),\n },\n GtkConstraintLayout: {\n props: internal(\"GtkConstraintLayoutProps\"),\n },\n GtkStack: {\n props: internal(\"ChildrenProps\"),\n },\n GtkNotebook: {\n props: internal(\"ChildrenProps\"),\n },\n GtkApplication: {\n props: internal(\"GtkApplicationProps\"),\n component: internal(\"createApplicationComponent\"),\n },\n GtkAboutDialog: {\n props: internal(\"GtkAboutDialogProps\"),\n },\n GtkScale: {\n props: internal(\"GtkScaleProps\"),\n },\n GtkCalendar: {\n props: internal(\"GtkCalendarProps\"),\n },\n GtkLevelBar: {\n props: internal(\"GtkLevelBarProps\"),\n },\n GtkDropTarget: {\n props: internal(\"GtkDropTargetProps\"),\n },\n GtkDrawingArea: {\n props: internal(\"GtkDrawingAreaProps\"),\n },\n GtkDragSource: {\n props: internal(\"GtkDragSourceProps\"),\n },\n};\n\nexport { SINGLE_CHILD_TYPES, BUILTIN_ELEMENTS };\n"]}
@@ -1,8 +1,9 @@
1
1
  import type * as Gtk from "@gtkx/gi/gtk";
2
2
  import { type Context } from "react";
3
- export declare const ApplicationContext: Context<Gtk.Application | null>;
3
+ declare const ApplicationContext: Context<Gtk.Application | null>;
4
4
  /**
5
- * Returns the `Gtk.Application` provided by the nearest `Application` ancestor, throwing if used outside one.
5
+ * Returns the `Gtk.Application` provided by the nearest `GtkApplication` ancestor, throwing if used outside one.
6
6
  */
7
- export declare const useApplication: () => Gtk.Application;
7
+ declare const useApplication: () => Gtk.Application;
8
+ export { ApplicationContext, useApplication };
8
9
  //# sourceMappingURL=use-application.d.ts.map
@@ -1 +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"}
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,QAAA,MAAM,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAA+C,CAAC;AAExG;;GAEG;AACH,QAAA,MAAM,cAAc,QAAO,GAAG,CAAC,WAQ9B,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { createContext, use } from "react";
2
- export const ApplicationContext = createContext(null);
2
+ const ApplicationContext = createContext(null);
3
3
  /**
4
- * Returns the `Gtk.Application` provided by the nearest `Application` ancestor, throwing if used outside one.
4
+ * Returns the `Gtk.Application` provided by the nearest `GtkApplication` ancestor, throwing if used outside one.
5
5
  */
6
- export const useApplication = () => {
6
+ const useApplication = () => {
7
7
  const context = use(ApplicationContext);
8
8
  if (!context) {
9
- throw new Error("Expected ApplicationContext: useApplication must be called within Application");
9
+ throw new Error("useApplication must be called within GtkApplication");
10
10
  }
11
11
  return context;
12
12
  };
13
+ export { ApplicationContext, useApplication };
13
14
  //# sourceMappingURL=use-application.js.map
@@ -1 +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"]}
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,kBAAkB,GAAoC,aAAa,CAAyB,IAAI,CAAC,CAAC;AAExG;;GAEG;AACH,MAAM,cAAc,GAAG,GAAoB,EAAE;IACzC,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAExC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type Context, createContext, use } from \"react\";\n\nconst ApplicationContext: Context<Gtk.Application | null> = createContext<Gtk.Application | null>(null);\n\n/**\n * Returns the `Gtk.Application` provided by the nearest `GtkApplication` ancestor, throwing if used outside one.\n */\nconst useApplication = (): Gtk.Application => {\n const context = use(ApplicationContext);\n\n if (!context) {\n throw new Error(\"useApplication must be called within GtkApplication\");\n }\n\n return context;\n};\n\nexport { ApplicationContext, useApplication };\n"]}
@@ -1,6 +1,23 @@
1
- import * as Gio from "@gtkx/gi/gio";
2
1
  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;
2
+ import * as Gio from "@gtkx/gi/gio";
3
+ import type { SettingsSchema, SettingsSchemaKeys } from "../utils/settings.js";
4
+ import { type RefProp } from "../utils/ref-prop.js";
5
+ type UseBindSettingOptions<K extends SettingsSchemaKeys> = {
6
+ schema: SettingsSchema<K>;
7
+ key: keyof K & string;
8
+ object: RefProp<GObject.Object>;
9
+ property: string;
10
+ flags?: Gio.SettingsBindFlags;
11
+ };
12
+ /**
13
+ * Binds a GSettings key to a property of a GObject, keeping the two in sync for the object's lifetime.
14
+ *
15
+ * @param options.schema The schema reference identifying the settings backend.
16
+ * @param options.key The key within the schema to bind.
17
+ * @param options.object The GObject whose property is bound to the setting.
18
+ * @param options.property The name of the object property to bind.
19
+ * @param options.flags Flags controlling the binding's direction and behaviour.
20
+ */
21
+ declare function useBindSetting<K extends SettingsSchemaKeys>({ schema, key, object, property, flags, }: UseBindSettingOptions<K>): void;
22
+ export { useBindSetting };
6
23
  //# sourceMappingURL=use-bind-setting.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"use-bind-setting.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAGpE,KAAK,qBAAqB,CAAC,CAAC,SAAS,kBAAkB,IAAI;IACvD,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC;CACjC,CAAC;AAEF;;;;;;;;GAQG;AACH,iBAAS,cAAc,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAClD,MAAM,EACN,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAqC,GACxC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI,CAiBjC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,19 +1,30 @@
1
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
- });
2
+ import { kebabCase } from "@gtkx/utils";
3
+ import { useLayoutEffect } from "react";
4
+ import { resolveRefProp } from "../utils/ref-prop.js";
5
+ import { useSettings } from "./use-setting.js";
6
+ /**
7
+ * Binds a GSettings key to a property of a GObject, keeping the two in sync for the object's lifetime.
8
+ *
9
+ * @param options.schema The schema reference identifying the settings backend.
10
+ * @param options.key The key within the schema to bind.
11
+ * @param options.object The GObject whose property is bound to the setting.
12
+ * @param options.property The name of the object property to bind.
13
+ * @param options.flags Flags controlling the binding's direction and behaviour.
14
+ */
15
+ function useBindSetting({ schema, key, object, property, flags = Gio.SettingsBindFlags.DEFAULT, }) {
16
+ const settings = useSettings(schema);
17
+ const propertyName = kebabCase(property);
18
+ useLayoutEffect(() => {
19
+ const resolved = resolveRefProp(object);
20
+ if (!resolved) {
21
+ return;
22
+ }
23
+ settings.bind(key, resolved, propertyName, flags);
24
+ return () => {
25
+ Gio.Settings.unbind(resolved, propertyName);
26
+ };
27
+ }, [settings, key, object, propertyName, flags]);
18
28
  }
29
+ export { useBindSetting };
19
30
  //# sourceMappingURL=use-bind-setting.js.map
@@ -1 +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"]}
1
+ {"version":3,"file":"use-bind-setting.js","sourceRoot":"","sources":["../../src/hooks/use-bind-setting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAU/C;;;;;;;;GAQG;AACH,SAAS,cAAc,CAA+B,EAClD,MAAM,EACN,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAK,GAAG,GAAG,CAAC,iBAAiB,CAAC,OAAO,GACd;IACvB,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEzC,eAAe,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACR,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gio from \"@gtkx/gi/gio\";\nimport { kebabCase } from \"@gtkx/utils\";\nimport { useLayoutEffect } from \"react\";\nimport type { SettingsSchema, SettingsSchemaKeys } from \"../utils/settings.js\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\nimport { useSettings } from \"./use-setting.js\";\n\ntype UseBindSettingOptions<K extends SettingsSchemaKeys> = {\n schema: SettingsSchema<K>;\n key: keyof K & string;\n object: RefProp<GObject.Object>;\n property: string;\n flags?: Gio.SettingsBindFlags;\n};\n\n/**\n * Binds a GSettings key to a property of a GObject, keeping the two in sync for the object's lifetime.\n *\n * @param options.schema The schema reference identifying the settings backend.\n * @param options.key The key within the schema to bind.\n * @param options.object The GObject whose property is bound to the setting.\n * @param options.property The name of the object property to bind.\n * @param options.flags Flags controlling the binding's direction and behaviour.\n */\nfunction useBindSetting<K extends SettingsSchemaKeys>({\n schema,\n key,\n object,\n property,\n flags = Gio.SettingsBindFlags.DEFAULT,\n}: UseBindSettingOptions<K>): void {\n const settings = useSettings(schema);\n const propertyName = kebabCase(property);\n\n useLayoutEffect(() => {\n const resolved = resolveRefProp(object);\n\n if (!resolved) {\n return;\n }\n\n settings.bind(key, resolved, propertyName, flags);\n\n return () => {\n Gio.Settings.unbind(resolved, propertyName);\n };\n }, [settings, key, object, propertyName, flags]);\n}\n\nexport { useBindSetting };\n"]}
@@ -0,0 +1,8 @@
1
+ import { type Ref, type RefCallback } from "react";
2
+ type PossibleRef<T> = Ref<T> | undefined;
3
+ type RefCleanup<T> = ReturnType<RefCallback<T>>;
4
+ declare function assignRef<T>(ref: PossibleRef<T>, value: T): RefCleanup<T>;
5
+ declare function mergeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T>;
6
+ declare function useMergedRef<T>(first: PossibleRef<T>, second: PossibleRef<T>): RefCallback<T>;
7
+ export { assignRef, mergeRefs, useMergedRef };
8
+ //# sourceMappingURL=use-merged-refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-merged-refs.d.ts","sourceRoot":"","sources":["../../src/hooks/use-merged-refs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAW,MAAM,OAAO,CAAC;AAE5D,KAAK,WAAW,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AACzC,KAAK,UAAU,CAAC,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAGhD,iBAAS,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAQlE;AAsCD,iBAAS,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAI/D;AAED,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAEtF;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { isRecord } from "@gtkx/utils";
2
+ import { useMemo } from "react";
3
+ function assignRef(ref, value) {
4
+ if (typeof ref === "function") {
5
+ return ref(value);
6
+ }
7
+ if (isRecord(ref) && "current" in ref) {
8
+ ref.current = value;
9
+ }
10
+ }
11
+ function collectCleanup(cleanupMap, ref, node) {
12
+ const cleanup = assignRef(ref, node);
13
+ if (cleanup) {
14
+ cleanupMap.set(ref, cleanup);
15
+ }
16
+ }
17
+ function cleanupRef(cleanupMap, ref) {
18
+ const cleanup = cleanupMap.get(ref);
19
+ if (cleanup && typeof cleanup === "function") {
20
+ cleanup();
21
+ }
22
+ else {
23
+ assignRef(ref, null);
24
+ }
25
+ }
26
+ function applyRefs(cleanupMap, refs, node) {
27
+ for (const ref of refs) {
28
+ collectCleanup(cleanupMap, ref, node);
29
+ }
30
+ if (cleanupMap.size === 0) {
31
+ return;
32
+ }
33
+ return () => {
34
+ for (const ref of refs) {
35
+ cleanupRef(cleanupMap, ref);
36
+ }
37
+ cleanupMap.clear();
38
+ };
39
+ }
40
+ function mergeRefs(...refs) {
41
+ const cleanupMap = new Map();
42
+ return (node) => applyRefs(cleanupMap, refs, node);
43
+ }
44
+ function useMergedRef(first, second) {
45
+ return useMemo(() => mergeRefs(first, second), [first, second]);
46
+ }
47
+ export { assignRef, mergeRefs, useMergedRef };
48
+ //# sourceMappingURL=use-merged-refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-merged-refs.js","sourceRoot":"","sources":["../../src/hooks/use-merged-refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAA8B,OAAO,EAAE,MAAM,OAAO,CAAC;AAM5D,SAAS,SAAS,CAAI,GAAmB,EAAE,KAAQ;IAC/C,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QACpC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACxB,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAI,UAAyB,EAAE,GAAmB,EAAE,IAAc;IACrF,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAErC,IAAI,OAAO,EAAE,CAAC;QACV,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAI,UAAyB,EAAE,GAAmB;IACjE,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEpC,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,EAAE,CAAC;IACd,CAAC;SAAM,CAAC;QACJ,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAI,UAAyB,EAAE,IAAsB,EAAE,IAAc;IACnF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO;IACX,CAAC;IAED,OAAO,GAAG,EAAE;QACR,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,UAAU,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC,CAAC;AACN,CAAC;AAED,SAAS,SAAS,CAAI,GAAG,IAAsB;IAC3C,MAAM,UAAU,GAAkB,IAAI,GAAG,EAAE,CAAC;IAE5C,OAAO,CAAC,IAAc,EAAiB,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,YAAY,CAAI,KAAqB,EAAE,MAAsB;IAClE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { isRecord } from \"@gtkx/utils\";\nimport { type Ref, type RefCallback, useMemo } from \"react\";\n\ntype PossibleRef<T> = Ref<T> | undefined;\ntype RefCleanup<T> = ReturnType<RefCallback<T>>;\ntype CleanupMap<T> = Map<PossibleRef<T>, Exclude<RefCleanup<T>, void>>;\n\nfunction assignRef<T>(ref: PossibleRef<T>, value: T): RefCleanup<T> {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n\n if (isRecord(ref) && \"current\" in ref) {\n ref.current = value;\n }\n}\n\nfunction collectCleanup<T>(cleanupMap: CleanupMap<T>, ref: PossibleRef<T>, node: T | null): void {\n const cleanup = assignRef(ref, node);\n\n if (cleanup) {\n cleanupMap.set(ref, cleanup);\n }\n}\n\nfunction cleanupRef<T>(cleanupMap: CleanupMap<T>, ref: PossibleRef<T>): void {\n const cleanup = cleanupMap.get(ref);\n\n if (cleanup && typeof cleanup === \"function\") {\n cleanup();\n } else {\n assignRef(ref, null);\n }\n}\n\nfunction applyRefs<T>(cleanupMap: CleanupMap<T>, refs: PossibleRef<T>[], node: T | null): RefCleanup<T> {\n for (const ref of refs) {\n collectCleanup(cleanupMap, ref, node);\n }\n\n if (cleanupMap.size === 0) {\n return;\n }\n\n return () => {\n for (const ref of refs) {\n cleanupRef(cleanupMap, ref);\n }\n\n cleanupMap.clear();\n };\n}\n\nfunction mergeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T> {\n const cleanupMap: CleanupMap<T> = new Map();\n\n return (node: T | null): RefCleanup<T> => applyRefs(cleanupMap, refs, node);\n}\n\nfunction useMergedRef<T>(first: PossibleRef<T>, second: PossibleRef<T>): RefCallback<T> {\n return useMemo(() => mergeRefs(first, second), [first, second]);\n}\n\nexport { assignRef, mergeRefs, useMergedRef };\n"]}
@@ -1,4 +1,5 @@
1
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;
2
+ import { type RefProp } from "../utils/ref-prop.js";
3
+ declare function useObjectValue<T extends GObject.Object, V>(object: RefProp<T>, signal: string, read: (object: T | null) => V): V;
4
+ export { useObjectValue };
4
5
  //# sourceMappingURL=use-object-value.d.ts.map
@@ -1 +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"}
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,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAQpE,iBAAS,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,EAC/C,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,GAC9B,CAAC,CAoCH;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,32 +1,29 @@
1
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;
2
+ import { resolveRefProp } from "../utils/ref-prop.js";
3
+ function useObjectValue(object, signal, read) {
4
+ const resolved = resolveRefProp(object);
7
5
  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
6
  const subscribe = useCallback((onStoreChange) => {
21
- if (resolved === null)
22
- return () => { };
7
+ if (resolved === null) {
8
+ return () => undefined;
9
+ }
23
10
  const handler = () => {
24
- readNow();
11
+ cacheRef.current = null;
25
12
  onStoreChange();
26
13
  };
27
14
  resolved.on(signal, handler);
28
15
  return () => resolved.off(signal, handler);
29
- }, [resolved, signal, readNow]);
16
+ }, [resolved, signal]);
17
+ const getSnapshot = () => {
18
+ const cache = cacheRef.current;
19
+ if (cache !== null && cache.object === resolved && cache.signal === signal) {
20
+ return cache.value;
21
+ }
22
+ const value = read(resolved);
23
+ cacheRef.current = { object: resolved, signal, value };
24
+ return value;
25
+ };
30
26
  return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
31
27
  }
28
+ export { useObjectValue };
32
29
  //# sourceMappingURL=use-object-value.js.map
@@ -1 +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"]}
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,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQpE,SAAS,cAAc,CACnB,MAAkB,EAClB,MAAc,EACd,IAA6B;IAE7B,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,CAAgC,IAAI,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,WAAW,CACzB,CAAC,aAAyB,EAAgB,EAAE;QACxC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,GAAS,EAAE,CAAC,SAAS,CAAC;QACjC,CAAC;QAED,MAAM,OAAO,GAAkB,GAAG,EAAE;YAChC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YACxB,aAAa,EAAE,CAAC;QACpB,CAAC,CAAC;QAEF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,CAAC,CACrB,CAAC;IAEF,MAAM,WAAW,GAAG,GAAM,EAAE;QACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;QAE/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;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,QAAQ,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAEvD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACrE,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\n\ntype ObjectValueCache<T extends GObject.Object, V> = {\n object: T | null;\n signal: string;\n value: V;\n};\n\nfunction useObjectValue<T extends GObject.Object, V>(\n object: RefProp<T>,\n signal: string,\n read: (object: T | null) => V,\n): V {\n const resolved = resolveRefProp(object);\n const cacheRef = useRef<ObjectValueCache<T, V> | null>(null);\n\n const subscribe = useCallback(\n (onStoreChange: () => void): (() => void) => {\n if (resolved === null) {\n return (): void => undefined;\n }\n\n const handler: SignalHandler = () => {\n cacheRef.current = null;\n onStoreChange();\n };\n\n resolved.on(signal, handler);\n\n return () => resolved.off(signal, handler);\n },\n [resolved, signal],\n );\n\n const getSnapshot = (): V => {\n const cache = cacheRef.current;\n\n if (cache !== null && cache.object === resolved && cache.signal === signal) {\n return cache.value;\n }\n\n const value = read(resolved);\n cacheRef.current = { object: resolved, signal, value };\n\n return value;\n };\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\nexport { useObjectValue };\n"]}
@@ -1,8 +1,9 @@
1
1
  import type * as Gtk from "@gtkx/gi/gtk";
2
2
  import { type Context } from "react";
3
- export declare const ParentWindowContext: Context<Gtk.Window | null>;
3
+ declare const ParentWindowContext: Context<Gtk.Window | null>;
4
4
  /**
5
5
  * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.
6
6
  */
7
- export declare const useParentWindow: () => Gtk.Window | null;
7
+ declare const useParentWindow: () => Gtk.Window | null;
8
+ export { ParentWindowContext, useParentWindow };
8
9
  //# sourceMappingURL=use-parent-window.d.ts.map
@@ -1 +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"}
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,QAAA,MAAM,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAA0C,CAAC;AAE/F;;GAEG;AACH,QAAA,MAAM,eAAe,QAAO,GAAG,CAAC,MAAM,GAAG,IAAgC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { createContext, use } from "react";
2
- export const ParentWindowContext = createContext(null);
2
+ const ParentWindowContext = createContext(null);
3
3
  /**
4
4
  * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.
5
5
  */
6
- export const useParentWindow = () => use(ParentWindowContext);
6
+ const useParentWindow = () => use(ParentWindowContext);
7
+ export { ParentWindowContext, useParentWindow };
7
8
  //# sourceMappingURL=use-parent-window.js.map
@@ -1 +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"]}
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,mBAAmB,GAA+B,aAAa,CAAoB,IAAI,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,eAAe,GAAG,GAAsB,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { type Context, createContext, use } from \"react\";\n\nconst 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 */\nconst useParentWindow = (): Gtk.Window | null => use(ParentWindowContext);\n\nexport { ParentWindowContext, useParentWindow };\n"]}
@@ -1,7 +1,7 @@
1
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;
2
+ import type { RefProp } from "../utils/ref-prop.js";
3
+ type Properties<T extends GObject.Object> = NonNullable<T["__properties__"]>;
4
+ type PropertyName<T extends GObject.Object> = keyof Properties<T> & keyof T;
5
5
  /**
6
6
  * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
7
7
  *
@@ -9,6 +9,6 @@ export type PropertyNameOf<T extends GObject.Object> = keyof PropertiesOf<T> & k
9
9
  * @param propertyName The camelCase name of a readable property on the object.
10
10
  * @returns The current property value, or `undefined` when the object is not resolved.
11
11
  */
12
- export declare function useProperty<T extends GObject.Object, K extends PropertyNameOf<T>>(object: ObjectProp<T>, propertyName: K): T[K] | undefined;
13
- export {};
12
+ declare function useProperty<T extends GObject.Object, P extends PropertyName<T>>(object: RefProp<T>, propertyName: P & string): T[P] | undefined;
13
+ export { useProperty, type PropertyName };
14
14
  //# sourceMappingURL=use-property.d.ts.map
@@ -1 +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"}
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,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD,KAAK,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAC7E,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,MAAM,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;AAE5E;;;;;;GAMG;AACH,iBAAS,WAAW,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,YAAY,EAAE,CAAC,GAAG,MAAM,GACzB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAElB;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { propToNotifySignal } from "../utils/notify-name.js";
1
+ import { kebabCase } from "@gtkx/utils";
2
2
  import { useObjectValue } from "./use-object-value.js";
3
3
  /**
4
4
  * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
@@ -7,7 +7,8 @@ import { useObjectValue } from "./use-object-value.js";
7
7
  * @param propertyName The camelCase name of a readable property on the object.
8
8
  * @returns The current property value, or `undefined` when the object is not resolved.
9
9
  */
10
- export function useProperty(object, propertyName) {
11
- return useObjectValue(object, propToNotifySignal(propertyName), (obj) => (obj ? obj[propertyName] : undefined));
10
+ function useProperty(object, propertyName) {
11
+ return useObjectValue(object, `notify::${kebabCase(propertyName)}`, (obj) => obj?.[propertyName]);
12
12
  }
13
+ export { useProperty };
13
14
  //# sourceMappingURL=use-property.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACvB,MAAqB,EACrB,YAAe;IAEf,OAAO,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACpH,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport { propToNotifySignal } from \"../utils/notify-name.js\";\nimport type { ObjectProp } from \"../utils/object-prop.js\";\nimport { useObjectValue } from \"./use-object-value.js\";\n\ntype PropertiesOf<T extends GObject.Object> = NonNullable<T[\"__properties__\"]>;\n\nexport type PropertyNameOf<T extends GObject.Object> = keyof PropertiesOf<T> & keyof T & string;\n\n/**\n * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.\n *\n * @param object The GObject (or ref to one) whose property to observe.\n * @param propertyName The camelCase name of a readable property on the object.\n * @returns The current property value, or `undefined` when the object is not resolved.\n */\nexport function useProperty<T extends GObject.Object, K extends PropertyNameOf<T>>(\n object: ObjectProp<T>,\n propertyName: K,\n): T[K] | undefined {\n return useObjectValue(object, propToNotifySignal(propertyName), (obj) => (obj ? obj[propertyName] : undefined));\n}\n"]}
1
+ {"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD;;;;;;GAMG;AACH,SAAS,WAAW,CAChB,MAAkB,EAClB,YAAwB;IAExB,OAAO,cAAc,CAAC,MAAM,EAAE,WAAW,SAAS,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,OAAO,EAAE,WAAW,EAAqB,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport { kebabCase } from \"@gtkx/utils\";\nimport type { RefProp } from \"../utils/ref-prop.js\";\nimport { useObjectValue } from \"./use-object-value.js\";\n\ntype Properties<T extends GObject.Object> = NonNullable<T[\"__properties__\"]>;\ntype PropertyName<T extends GObject.Object> = keyof Properties<T> & keyof T;\n\n/**\n * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.\n *\n * @param object The GObject (or ref to one) whose property to observe.\n * @param propertyName The camelCase name of a readable property on the object.\n * @returns The current property value, or `undefined` when the object is not resolved.\n */\nfunction useProperty<T extends GObject.Object, P extends PropertyName<T>>(\n object: RefProp<T>,\n propertyName: P & string,\n): T[P] | undefined {\n return useObjectValue(object, `notify::${kebabCase(propertyName)}`, (obj) => obj?.[propertyName]);\n}\n\nexport { useProperty, type PropertyName };\n"]}