@gtkx/react 0.20.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 (596) hide show
  1. package/README.md +122 -55
  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 -5
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +10 -5
  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 -12
  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/list.d.ts +0 -35
  253. package/dist/components/list.d.ts.map +0 -1
  254. package/dist/components/list.js +0 -40
  255. package/dist/components/list.js.map +0 -1
  256. package/dist/errors.d.ts +0 -9
  257. package/dist/errors.d.ts.map +0 -1
  258. package/dist/errors.js +0 -42
  259. package/dist/errors.js.map +0 -1
  260. package/dist/factory.d.ts +0 -5
  261. package/dist/factory.d.ts.map +0 -1
  262. package/dist/factory.js +0 -37
  263. package/dist/factory.js.map +0 -1
  264. package/dist/generated/internal.d.ts +0 -16
  265. package/dist/generated/internal.d.ts.map +0 -1
  266. package/dist/generated/internal.js +0 -5635
  267. package/dist/generated/internal.js.map +0 -1
  268. package/dist/generated/jsx.d.ts +0 -19624
  269. package/dist/generated/jsx.d.ts.map +0 -1
  270. package/dist/generated/jsx.js +0 -9274
  271. package/dist/generated/jsx.js.map +0 -1
  272. package/dist/generated/registry.d.ts +0 -4
  273. package/dist/generated/registry.d.ts.map +0 -1
  274. package/dist/generated/registry.js +0 -14
  275. package/dist/generated/registry.js.map +0 -1
  276. package/dist/host-config.d.ts +0 -24
  277. package/dist/host-config.d.ts.map +0 -1
  278. package/dist/host-config.js +0 -172
  279. package/dist/host-config.js.map +0 -1
  280. package/dist/jsx.d.ts +0 -1272
  281. package/dist/jsx.d.ts.map +0 -1
  282. package/dist/jsx.js +0 -331
  283. package/dist/jsx.js.map +0 -1
  284. package/dist/metadata.d.ts +0 -5
  285. package/dist/metadata.d.ts.map +0 -1
  286. package/dist/metadata.js +0 -33
  287. package/dist/metadata.js.map +0 -1
  288. package/dist/node.d.ts +0 -25
  289. package/dist/node.d.ts.map +0 -1
  290. package/dist/node.js +0 -85
  291. package/dist/node.js.map +0 -1
  292. package/dist/nodes/adjustable.d.ts +0 -11
  293. package/dist/nodes/adjustable.d.ts.map +0 -1
  294. package/dist/nodes/adjustable.js +0 -46
  295. package/dist/nodes/adjustable.js.map +0 -1
  296. package/dist/nodes/alert-dialog-response.d.ts +0 -15
  297. package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
  298. package/dist/nodes/alert-dialog-response.js +0 -61
  299. package/dist/nodes/alert-dialog-response.js.map +0 -1
  300. package/dist/nodes/animation.d.ts +0 -38
  301. package/dist/nodes/animation.d.ts.map +0 -1
  302. package/dist/nodes/animation.js +0 -310
  303. package/dist/nodes/animation.js.map +0 -1
  304. package/dist/nodes/application.d.ts +0 -12
  305. package/dist/nodes/application.d.ts.map +0 -1
  306. package/dist/nodes/application.js +0 -51
  307. package/dist/nodes/application.js.map +0 -1
  308. package/dist/nodes/calendar.d.ts +0 -18
  309. package/dist/nodes/calendar.d.ts.map +0 -1
  310. package/dist/nodes/calendar.js +0 -28
  311. package/dist/nodes/calendar.js.map +0 -1
  312. package/dist/nodes/color-dialog-button.d.ts +0 -15
  313. package/dist/nodes/color-dialog-button.d.ts.map +0 -1
  314. package/dist/nodes/color-dialog-button.js +0 -43
  315. package/dist/nodes/color-dialog-button.js.map +0 -1
  316. package/dist/nodes/column-view-column.d.ts +0 -36
  317. package/dist/nodes/column-view-column.d.ts.map +0 -1
  318. package/dist/nodes/column-view-column.js +0 -168
  319. package/dist/nodes/column-view-column.js.map +0 -1
  320. package/dist/nodes/container-slot.d.ts +0 -16
  321. package/dist/nodes/container-slot.d.ts.map +0 -1
  322. package/dist/nodes/container-slot.js +0 -69
  323. package/dist/nodes/container-slot.js.map +0 -1
  324. package/dist/nodes/dialog.d.ts +0 -10
  325. package/dist/nodes/dialog.d.ts.map +0 -1
  326. package/dist/nodes/dialog.js +0 -20
  327. package/dist/nodes/dialog.js.map +0 -1
  328. package/dist/nodes/drawing-area.d.ts +0 -17
  329. package/dist/nodes/drawing-area.d.ts.map +0 -1
  330. package/dist/nodes/drawing-area.js +0 -42
  331. package/dist/nodes/drawing-area.js.map +0 -1
  332. package/dist/nodes/event-controller.d.ts +0 -15
  333. package/dist/nodes/event-controller.d.ts.map +0 -1
  334. package/dist/nodes/event-controller.js +0 -77
  335. package/dist/nodes/event-controller.js.map +0 -1
  336. package/dist/nodes/fixed-child.d.ts +0 -18
  337. package/dist/nodes/fixed-child.d.ts.map +0 -1
  338. package/dist/nodes/fixed-child.js +0 -86
  339. package/dist/nodes/fixed-child.js.map +0 -1
  340. package/dist/nodes/font-dialog-button.d.ts +0 -15
  341. package/dist/nodes/font-dialog-button.d.ts.map +0 -1
  342. package/dist/nodes/font-dialog-button.js +0 -76
  343. package/dist/nodes/font-dialog-button.js.map +0 -1
  344. package/dist/nodes/grid-child.d.ts +0 -18
  345. package/dist/nodes/grid-child.d.ts.map +0 -1
  346. package/dist/nodes/grid-child.js +0 -81
  347. package/dist/nodes/grid-child.js.map +0 -1
  348. package/dist/nodes/internal/accessible.d.ts +0 -5
  349. package/dist/nodes/internal/accessible.d.ts.map +0 -1
  350. package/dist/nodes/internal/accessible.js +0 -119
  351. package/dist/nodes/internal/accessible.js.map +0 -1
  352. package/dist/nodes/internal/bound-item.d.ts +0 -4
  353. package/dist/nodes/internal/bound-item.d.ts.map +0 -1
  354. package/dist/nodes/internal/bound-item.js +0 -2
  355. package/dist/nodes/internal/bound-item.js.map +0 -1
  356. package/dist/nodes/internal/construct.d.ts +0 -3
  357. package/dist/nodes/internal/construct.d.ts.map +0 -1
  358. package/dist/nodes/internal/construct.js +0 -44
  359. package/dist/nodes/internal/construct.js.map +0 -1
  360. package/dist/nodes/internal/predicates.d.ts +0 -51
  361. package/dist/nodes/internal/predicates.d.ts.map +0 -1
  362. package/dist/nodes/internal/predicates.js +0 -36
  363. package/dist/nodes/internal/predicates.js.map +0 -1
  364. package/dist/nodes/internal/props.d.ts +0 -6
  365. package/dist/nodes/internal/props.d.ts.map +0 -1
  366. package/dist/nodes/internal/props.js +0 -43
  367. package/dist/nodes/internal/props.js.map +0 -1
  368. package/dist/nodes/internal/signal-store.d.ts +0 -22
  369. package/dist/nodes/internal/signal-store.d.ts.map +0 -1
  370. package/dist/nodes/internal/signal-store.js +0 -98
  371. package/dist/nodes/internal/signal-store.js.map +0 -1
  372. package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
  373. package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
  374. package/dist/nodes/internal/text-buffer-controller.js +0 -327
  375. package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
  376. package/dist/nodes/internal/widget.d.ts +0 -8
  377. package/dist/nodes/internal/widget.d.ts.map +0 -1
  378. package/dist/nodes/internal/widget.js +0 -72
  379. package/dist/nodes/internal/widget.js.map +0 -1
  380. package/dist/nodes/level-bar.d.ts +0 -12
  381. package/dist/nodes/level-bar.d.ts.map +0 -1
  382. package/dist/nodes/level-bar.js +0 -24
  383. package/dist/nodes/level-bar.js.map +0 -1
  384. package/dist/nodes/list-item-node.d.ts +0 -12
  385. package/dist/nodes/list-item-node.d.ts.map +0 -1
  386. package/dist/nodes/list-item-node.js +0 -23
  387. package/dist/nodes/list-item-node.js.map +0 -1
  388. package/dist/nodes/list.d.ts +0 -100
  389. package/dist/nodes/list.d.ts.map +0 -1
  390. package/dist/nodes/list.js +0 -950
  391. package/dist/nodes/list.js.map +0 -1
  392. package/dist/nodes/menu.d.ts +0 -7
  393. package/dist/nodes/menu.d.ts.map +0 -1
  394. package/dist/nodes/menu.js +0 -20
  395. package/dist/nodes/menu.js.map +0 -1
  396. package/dist/nodes/models/menu.d.ts +0 -47
  397. package/dist/nodes/models/menu.d.ts.map +0 -1
  398. package/dist/nodes/models/menu.js +0 -240
  399. package/dist/nodes/models/menu.js.map +0 -1
  400. package/dist/nodes/navigation-page.d.ts +0 -19
  401. package/dist/nodes/navigation-page.d.ts.map +0 -1
  402. package/dist/nodes/navigation-page.js +0 -129
  403. package/dist/nodes/navigation-page.js.map +0 -1
  404. package/dist/nodes/navigation-view.d.ts +0 -19
  405. package/dist/nodes/navigation-view.d.ts.map +0 -1
  406. package/dist/nodes/navigation-view.js +0 -51
  407. package/dist/nodes/navigation-view.js.map +0 -1
  408. package/dist/nodes/notebook-page-tab.d.ts +0 -15
  409. package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
  410. package/dist/nodes/notebook-page-tab.js +0 -40
  411. package/dist/nodes/notebook-page-tab.js.map +0 -1
  412. package/dist/nodes/notebook-page.d.ts +0 -29
  413. package/dist/nodes/notebook-page.d.ts.map +0 -1
  414. package/dist/nodes/notebook-page.js +0 -151
  415. package/dist/nodes/notebook-page.js.map +0 -1
  416. package/dist/nodes/notebook.d.ts +0 -16
  417. package/dist/nodes/notebook.d.ts.map +0 -1
  418. package/dist/nodes/notebook.js +0 -31
  419. package/dist/nodes/notebook.js.map +0 -1
  420. package/dist/nodes/overlay-child.d.ts +0 -18
  421. package/dist/nodes/overlay-child.d.ts.map +0 -1
  422. package/dist/nodes/overlay-child.js +0 -88
  423. package/dist/nodes/overlay-child.js.map +0 -1
  424. package/dist/nodes/popover-menu.d.ts +0 -19
  425. package/dist/nodes/popover-menu.d.ts.map +0 -1
  426. package/dist/nodes/popover-menu.js +0 -54
  427. package/dist/nodes/popover-menu.js.map +0 -1
  428. package/dist/nodes/scale.d.ts +0 -10
  429. package/dist/nodes/scale.d.ts.map +0 -1
  430. package/dist/nodes/scale.js +0 -19
  431. package/dist/nodes/scale.js.map +0 -1
  432. package/dist/nodes/scrolled-window.d.ts +0 -11
  433. package/dist/nodes/scrolled-window.d.ts.map +0 -1
  434. package/dist/nodes/scrolled-window.js +0 -18
  435. package/dist/nodes/scrolled-window.js.map +0 -1
  436. package/dist/nodes/search-bar.d.ts +0 -11
  437. package/dist/nodes/search-bar.d.ts.map +0 -1
  438. package/dist/nodes/search-bar.js +0 -16
  439. package/dist/nodes/search-bar.js.map +0 -1
  440. package/dist/nodes/shortcut.d.ts +0 -19
  441. package/dist/nodes/shortcut.d.ts.map +0 -1
  442. package/dist/nodes/shortcut.js +0 -72
  443. package/dist/nodes/shortcut.js.map +0 -1
  444. package/dist/nodes/slot.d.ts +0 -21
  445. package/dist/nodes/slot.d.ts.map +0 -1
  446. package/dist/nodes/slot.js +0 -102
  447. package/dist/nodes/slot.js.map +0 -1
  448. package/dist/nodes/source-view.d.ts +0 -18
  449. package/dist/nodes/source-view.d.ts.map +0 -1
  450. package/dist/nodes/source-view.js +0 -94
  451. package/dist/nodes/source-view.js.map +0 -1
  452. package/dist/nodes/stack-page.d.ts +0 -22
  453. package/dist/nodes/stack-page.d.ts.map +0 -1
  454. package/dist/nodes/stack-page.js +0 -140
  455. package/dist/nodes/stack-page.js.map +0 -1
  456. package/dist/nodes/stack.d.ts +0 -13
  457. package/dist/nodes/stack.d.ts.map +0 -1
  458. package/dist/nodes/stack.js +0 -21
  459. package/dist/nodes/stack.js.map +0 -1
  460. package/dist/nodes/text-anchor.d.ts +0 -23
  461. package/dist/nodes/text-anchor.d.ts.map +0 -1
  462. package/dist/nodes/text-anchor.js +0 -64
  463. package/dist/nodes/text-anchor.js.map +0 -1
  464. package/dist/nodes/text-content.d.ts +0 -12
  465. package/dist/nodes/text-content.d.ts.map +0 -1
  466. package/dist/nodes/text-content.js +0 -2
  467. package/dist/nodes/text-content.js.map +0 -1
  468. package/dist/nodes/text-paintable.d.ts +0 -19
  469. package/dist/nodes/text-paintable.d.ts.map +0 -1
  470. package/dist/nodes/text-paintable.js +0 -42
  471. package/dist/nodes/text-paintable.js.map +0 -1
  472. package/dist/nodes/text-segment.d.ts +0 -18
  473. package/dist/nodes/text-segment.d.ts.map +0 -1
  474. package/dist/nodes/text-segment.js +0 -38
  475. package/dist/nodes/text-segment.js.map +0 -1
  476. package/dist/nodes/text-tag.d.ts +0 -38
  477. package/dist/nodes/text-tag.d.ts.map +0 -1
  478. package/dist/nodes/text-tag.js +0 -241
  479. package/dist/nodes/text-tag.js.map +0 -1
  480. package/dist/nodes/text-view.d.ts +0 -29
  481. package/dist/nodes/text-view.d.ts.map +0 -1
  482. package/dist/nodes/text-view.js +0 -80
  483. package/dist/nodes/text-view.js.map +0 -1
  484. package/dist/nodes/toggle-group.d.ts +0 -11
  485. package/dist/nodes/toggle-group.d.ts.map +0 -1
  486. package/dist/nodes/toggle-group.js +0 -16
  487. package/dist/nodes/toggle-group.js.map +0 -1
  488. package/dist/nodes/toggle.d.ts +0 -16
  489. package/dist/nodes/toggle.d.ts.map +0 -1
  490. package/dist/nodes/toggle.js +0 -61
  491. package/dist/nodes/toggle.js.map +0 -1
  492. package/dist/nodes/virtual.d.ts +0 -7
  493. package/dist/nodes/virtual.d.ts.map +0 -1
  494. package/dist/nodes/virtual.js +0 -9
  495. package/dist/nodes/virtual.js.map +0 -1
  496. package/dist/nodes/web-view.d.ts +0 -11
  497. package/dist/nodes/web-view.d.ts.map +0 -1
  498. package/dist/nodes/web-view.js +0 -16
  499. package/dist/nodes/web-view.js.map +0 -1
  500. package/dist/nodes/widget.d.ts +0 -26
  501. package/dist/nodes/widget.d.ts.map +0 -1
  502. package/dist/nodes/widget.js +0 -315
  503. package/dist/nodes/widget.js.map +0 -1
  504. package/dist/nodes/window.d.ts +0 -31
  505. package/dist/nodes/window.d.ts.map +0 -1
  506. package/dist/nodes/window.js +0 -122
  507. package/dist/nodes/window.js.map +0 -1
  508. package/dist/portal.d.ts +0 -29
  509. package/dist/portal.d.ts.map +0 -1
  510. package/dist/portal.js +0 -35
  511. package/dist/portal.js.map +0 -1
  512. package/dist/reconciler.d.ts +0 -34
  513. package/dist/reconciler.d.ts.map +0 -1
  514. package/dist/reconciler.js +0 -48
  515. package/dist/reconciler.js.map +0 -1
  516. package/dist/registry.d.ts +0 -18
  517. package/dist/registry.d.ts.map +0 -1
  518. package/dist/registry.js +0 -96
  519. package/dist/registry.js.map +0 -1
  520. package/dist/render.d.ts +0 -117
  521. package/dist/render.d.ts.map +0 -1
  522. package/dist/render.js +0 -159
  523. package/dist/render.js.map +0 -1
  524. package/dist/types.d.ts +0 -5
  525. package/dist/types.d.ts.map +0 -1
  526. package/dist/types.js.map +0 -1
  527. package/src/components/list.tsx +0 -83
  528. package/src/errors.ts +0 -52
  529. package/src/factory.ts +0 -62
  530. package/src/generated/internal.ts +0 -5644
  531. package/src/generated/jsx.ts +0 -19900
  532. package/src/generated/registry.ts +0 -16
  533. package/src/host-config.ts +0 -219
  534. package/src/jsx.ts +0 -1355
  535. package/src/metadata.ts +0 -43
  536. package/src/node.ts +0 -107
  537. package/src/nodes/adjustable.ts +0 -68
  538. package/src/nodes/alert-dialog-response.ts +0 -78
  539. package/src/nodes/animation.ts +0 -402
  540. package/src/nodes/application.ts +0 -61
  541. package/src/nodes/calendar.ts +0 -42
  542. package/src/nodes/color-dialog-button.ts +0 -69
  543. package/src/nodes/column-view-column.ts +0 -189
  544. package/src/nodes/container-slot.ts +0 -87
  545. package/src/nodes/dialog.ts +0 -25
  546. package/src/nodes/drawing-area.ts +0 -62
  547. package/src/nodes/event-controller.ts +0 -100
  548. package/src/nodes/fixed-child.ts +0 -109
  549. package/src/nodes/font-dialog-button.ts +0 -107
  550. package/src/nodes/grid-child.ts +0 -103
  551. package/src/nodes/internal/accessible.ts +0 -155
  552. package/src/nodes/internal/bound-item.ts +0 -4
  553. package/src/nodes/internal/construct.ts +0 -60
  554. package/src/nodes/internal/predicates.ts +0 -80
  555. package/src/nodes/internal/props.ts +0 -51
  556. package/src/nodes/internal/signal-store.ts +0 -141
  557. package/src/nodes/internal/text-buffer-controller.ts +0 -417
  558. package/src/nodes/internal/widget.ts +0 -80
  559. package/src/nodes/level-bar.ts +0 -36
  560. package/src/nodes/list-item-node.ts +0 -29
  561. package/src/nodes/list.ts +0 -1082
  562. package/src/nodes/menu.ts +0 -27
  563. package/src/nodes/models/menu.ts +0 -314
  564. package/src/nodes/navigation-page.ts +0 -154
  565. package/src/nodes/navigation-view.ts +0 -66
  566. package/src/nodes/notebook-page-tab.ts +0 -55
  567. package/src/nodes/notebook-page.ts +0 -189
  568. package/src/nodes/notebook.ts +0 -42
  569. package/src/nodes/overlay-child.ts +0 -109
  570. package/src/nodes/popover-menu.ts +0 -67
  571. package/src/nodes/scale.ts +0 -28
  572. package/src/nodes/scrolled-window.ts +0 -23
  573. package/src/nodes/search-bar.ts +0 -27
  574. package/src/nodes/shortcut.ts +0 -86
  575. package/src/nodes/slot.ts +0 -138
  576. package/src/nodes/source-view.ts +0 -130
  577. package/src/nodes/stack-page.ts +0 -170
  578. package/src/nodes/stack.ts +0 -35
  579. package/src/nodes/text-anchor.ts +0 -79
  580. package/src/nodes/text-content.ts +0 -14
  581. package/src/nodes/text-paintable.ts +0 -51
  582. package/src/nodes/text-segment.ts +0 -55
  583. package/src/nodes/text-tag.ts +0 -293
  584. package/src/nodes/text-view.ts +0 -100
  585. package/src/nodes/toggle-group.ts +0 -27
  586. package/src/nodes/toggle.ts +0 -72
  587. package/src/nodes/virtual.ts +0 -16
  588. package/src/nodes/web-view.ts +0 -22
  589. package/src/nodes/widget.ts +0 -376
  590. package/src/nodes/window.ts +0 -172
  591. package/src/portal.ts +0 -37
  592. package/src/reconciler.ts +0 -52
  593. package/src/registry.ts +0 -117
  594. package/src/render.tsx +0 -192
  595. package/src/types.ts +0 -12
  596. /package/dist/{types.js → reconciler/types.js} +0 -0
@@ -0,0 +1,232 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { deleteAccessibleMetadata, setAccessibleMetadata } from "../utils/accessible-metadata.js";
4
+ import type { Props } from "./types.js";
5
+
6
+ /**
7
+ * Accessibility props available on every widget. Each member maps to a GTK4 accessible attribute
8
+ * (a `Gtk.AccessibleProperty`, `Gtk.AccessibleState`, or `Gtk.AccessibleRelation`) and is applied
9
+ * to the widget's accessible interface; setting a member to `undefined` resets that attribute to its default.
10
+ */
11
+ export interface AccessibleProps {
12
+ accessibleAutocomplete?: Gtk.AccessibleAutocomplete | null | undefined;
13
+ accessibleDescription?: string | null | undefined;
14
+ accessibleHasPopup?: boolean | null | undefined;
15
+ accessibleKeyShortcuts?: string | null | undefined;
16
+ accessibleLabel?: string | null | undefined;
17
+ accessibleLevel?: number | null | undefined;
18
+ accessibleModal?: boolean | null | undefined;
19
+ accessibleMultiLine?: boolean | null | undefined;
20
+ accessibleMultiSelectable?: boolean | null | undefined;
21
+ accessibleOrientation?: Gtk.Orientation | null | undefined;
22
+ accessiblePlaceholder?: string | null | undefined;
23
+ accessibleReadOnly?: boolean | null | undefined;
24
+ accessibleRequired?: boolean | null | undefined;
25
+ accessibleRoleDescription?: string | null | undefined;
26
+ accessibleSort?: Gtk.AccessibleSort | null | undefined;
27
+ accessibleValueMax?: number | null | undefined;
28
+ accessibleValueMin?: number | null | undefined;
29
+ accessibleValueNow?: number | null | undefined;
30
+ accessibleValueText?: string | null | undefined;
31
+ accessibleHelpText?: string | null | undefined;
32
+ accessibleBusy?: boolean | null | undefined;
33
+ accessibleChecked?: Gtk.AccessibleTristate | null | undefined;
34
+ accessibleDisabled?: boolean | null | undefined;
35
+ accessibleExpanded?: boolean | null | undefined;
36
+ accessibleHidden?: boolean | null | undefined;
37
+ accessibleInvalid?: Gtk.AccessibleInvalidState | null | undefined;
38
+ accessiblePressed?: Gtk.AccessibleTristate | null | undefined;
39
+ accessibleSelected?: boolean | null | undefined;
40
+ accessibleVisited?: boolean | null | undefined;
41
+ accessibleActiveDescendant?: Gtk.Widget | null | undefined;
42
+ accessibleColCount?: number | null | undefined;
43
+ accessibleColIndex?: number | null | undefined;
44
+ accessibleColIndexText?: string | null | undefined;
45
+ accessibleColSpan?: number | null | undefined;
46
+ accessibleControls?: Gtk.Widget[] | null | undefined;
47
+ accessibleDescribedBy?: Gtk.Widget[] | null | undefined;
48
+ accessibleDetails?: Gtk.Widget[] | null | undefined;
49
+ accessibleErrorMessage?: Gtk.Widget[] | null | undefined;
50
+ accessibleFlowTo?: Gtk.Widget[] | null | undefined;
51
+ accessibleLabelledBy?: Gtk.Widget[] | null | undefined;
52
+ accessibleOwns?: Gtk.Widget[] | null | undefined;
53
+ accessiblePosInSet?: number | null | undefined;
54
+ accessibleRowCount?: number | null | undefined;
55
+ accessibleRowIndex?: number | null | undefined;
56
+ accessibleRowIndexText?: string | null | undefined;
57
+ accessibleRowSpan?: number | null | undefined;
58
+ accessibleSetSize?: number | null | undefined;
59
+ }
60
+
61
+ type CreateValue = (jsValue: unknown) => GObject.Value;
62
+
63
+ type AccessiblePropertyDescriptor = {
64
+ kind: "property";
65
+ enumValue: Gtk.AccessibleProperty;
66
+ createValue: CreateValue;
67
+ };
68
+
69
+ type AccessibleStateDescriptor = {
70
+ kind: "state";
71
+ enumValue: Gtk.AccessibleState;
72
+ createValue: CreateValue;
73
+ };
74
+
75
+ type AccessibleRelationDescriptor = {
76
+ kind: "relation";
77
+ enumValue: Gtk.AccessibleRelation;
78
+ createValue: CreateValue;
79
+ };
80
+
81
+ type AccessibleDescriptor = AccessiblePropertyDescriptor | AccessibleStateDescriptor | AccessibleRelationDescriptor;
82
+
83
+ const fromString: CreateValue = (val) => GObject.buildValue(GObject.TYPE_STRING, (v) => v.setString(val as string));
84
+ const fromBoolean: CreateValue = (val) => GObject.buildValue(GObject.TYPE_BOOLEAN, (v) => v.setBoolean(val as boolean));
85
+ const fromInt: CreateValue = (val) => GObject.buildValue(GObject.TYPE_INT, (v) => v.setInt(val as number));
86
+ const fromDouble: CreateValue = (val) => GObject.buildValue(GObject.TYPE_DOUBLE, (v) => v.setDouble(val as number));
87
+ const fromObject: CreateValue = (val) =>
88
+ GObject.buildValue(GObject.TYPE_OBJECT, (v) => v.setObject(val as GObject.Object));
89
+
90
+ const fromRefList: CreateValue = (val) => {
91
+ const widgets = val as Gtk.Accessible[];
92
+ const list = Gtk.AccessibleList.newFromList(widgets);
93
+ return GObject.buildValue(Gtk.AccessibleList.prototype.__type__, (v) => v.setBoxed(list));
94
+ };
95
+
96
+ const property = (enumValue: Gtk.AccessibleProperty, createValue: CreateValue): AccessiblePropertyDescriptor => ({
97
+ kind: "property",
98
+ enumValue,
99
+ createValue,
100
+ });
101
+
102
+ const state = (enumValue: Gtk.AccessibleState, createValue: CreateValue): AccessibleStateDescriptor => ({
103
+ kind: "state",
104
+ enumValue,
105
+ createValue,
106
+ });
107
+
108
+ const relation = (enumValue: Gtk.AccessibleRelation, createValue: CreateValue): AccessibleRelationDescriptor => ({
109
+ kind: "relation",
110
+ enumValue,
111
+ createValue,
112
+ });
113
+
114
+ const ACCESSIBLE_PROP_MAP: Record<keyof AccessibleProps, AccessibleDescriptor> = {
115
+ accessibleAutocomplete: property(Gtk.AccessibleProperty.AUTOCOMPLETE, fromInt),
116
+ accessibleDescription: property(Gtk.AccessibleProperty.DESCRIPTION, fromString),
117
+ accessibleHasPopup: property(Gtk.AccessibleProperty.HAS_POPUP, fromBoolean),
118
+ accessibleKeyShortcuts: property(Gtk.AccessibleProperty.KEY_SHORTCUTS, fromString),
119
+ accessibleLabel: property(Gtk.AccessibleProperty.LABEL, fromString),
120
+ accessibleLevel: property(Gtk.AccessibleProperty.LEVEL, fromInt),
121
+ accessibleModal: property(Gtk.AccessibleProperty.MODAL, fromBoolean),
122
+ accessibleMultiLine: property(Gtk.AccessibleProperty.MULTI_LINE, fromBoolean),
123
+ accessibleMultiSelectable: property(Gtk.AccessibleProperty.MULTI_SELECTABLE, fromBoolean),
124
+ accessibleOrientation: property(Gtk.AccessibleProperty.ORIENTATION, fromInt),
125
+ accessiblePlaceholder: property(Gtk.AccessibleProperty.PLACEHOLDER, fromString),
126
+ accessibleReadOnly: property(Gtk.AccessibleProperty.READ_ONLY, fromBoolean),
127
+ accessibleRequired: property(Gtk.AccessibleProperty.REQUIRED, fromBoolean),
128
+ accessibleRoleDescription: property(Gtk.AccessibleProperty.ROLE_DESCRIPTION, fromString),
129
+ accessibleSort: property(Gtk.AccessibleProperty.SORT, fromInt),
130
+ accessibleValueMax: property(Gtk.AccessibleProperty.VALUE_MAX, fromDouble),
131
+ accessibleValueMin: property(Gtk.AccessibleProperty.VALUE_MIN, fromDouble),
132
+ accessibleValueNow: property(Gtk.AccessibleProperty.VALUE_NOW, fromDouble),
133
+ accessibleValueText: property(Gtk.AccessibleProperty.VALUE_TEXT, fromString),
134
+ accessibleHelpText: property(Gtk.AccessibleProperty.HELP_TEXT, fromString),
135
+ accessibleBusy: state(Gtk.AccessibleState.BUSY, fromBoolean),
136
+ accessibleChecked: state(Gtk.AccessibleState.CHECKED, fromInt),
137
+ accessibleDisabled: state(Gtk.AccessibleState.DISABLED, fromBoolean),
138
+ accessibleExpanded: state(Gtk.AccessibleState.EXPANDED, fromInt),
139
+ accessibleHidden: state(Gtk.AccessibleState.HIDDEN, fromBoolean),
140
+ accessibleInvalid: state(Gtk.AccessibleState.INVALID, fromInt),
141
+ accessiblePressed: state(Gtk.AccessibleState.PRESSED, fromInt),
142
+ accessibleSelected: state(Gtk.AccessibleState.SELECTED, fromInt),
143
+ accessibleVisited: state(Gtk.AccessibleState.VISITED, fromInt),
144
+ accessibleActiveDescendant: relation(Gtk.AccessibleRelation.ACTIVE_DESCENDANT, fromObject),
145
+ accessibleColCount: relation(Gtk.AccessibleRelation.COL_COUNT, fromInt),
146
+ accessibleColIndex: relation(Gtk.AccessibleRelation.COL_INDEX, fromInt),
147
+ accessibleColIndexText: relation(Gtk.AccessibleRelation.COL_INDEX_TEXT, fromString),
148
+ accessibleColSpan: relation(Gtk.AccessibleRelation.COL_SPAN, fromInt),
149
+ accessibleControls: relation(Gtk.AccessibleRelation.CONTROLS, fromRefList),
150
+ accessibleDescribedBy: relation(Gtk.AccessibleRelation.DESCRIBED_BY, fromRefList),
151
+ accessibleDetails: relation(Gtk.AccessibleRelation.DETAILS, fromRefList),
152
+ accessibleErrorMessage: relation(Gtk.AccessibleRelation.ERROR_MESSAGE, fromRefList),
153
+ accessibleFlowTo: relation(Gtk.AccessibleRelation.FLOW_TO, fromRefList),
154
+ accessibleLabelledBy: relation(Gtk.AccessibleRelation.LABELLED_BY, fromRefList),
155
+ accessibleOwns: relation(Gtk.AccessibleRelation.OWNS, fromRefList),
156
+ accessiblePosInSet: relation(Gtk.AccessibleRelation.POS_IN_SET, fromInt),
157
+ accessibleRowCount: relation(Gtk.AccessibleRelation.ROW_COUNT, fromInt),
158
+ accessibleRowIndex: relation(Gtk.AccessibleRelation.ROW_INDEX, fromInt),
159
+ accessibleRowIndexText: relation(Gtk.AccessibleRelation.ROW_INDEX_TEXT, fromString),
160
+ accessibleRowSpan: relation(Gtk.AccessibleRelation.ROW_SPAN, fromInt),
161
+ accessibleSetSize: relation(Gtk.AccessibleRelation.SET_SIZE, fromInt),
162
+ };
163
+
164
+ const lookupDescriptor = (name: string): AccessibleDescriptor | undefined =>
165
+ Object.hasOwn(ACCESSIBLE_PROP_MAP, name) ? ACCESSIBLE_PROP_MAP[name as keyof AccessibleProps] : undefined;
166
+
167
+ export const isAccessibleProp = (name: string): boolean => Object.hasOwn(ACCESSIBLE_PROP_MAP, name);
168
+
169
+ function applyDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor, newValue: unknown): void {
170
+ const gvalue = descriptor.createValue(newValue);
171
+
172
+ switch (descriptor.kind) {
173
+ case "property":
174
+ widget.updateProperty([descriptor.enumValue], [gvalue]);
175
+ break;
176
+ case "state":
177
+ widget.updateState([descriptor.enumValue], [gvalue]);
178
+ break;
179
+ case "relation":
180
+ widget.updateRelation([descriptor.enumValue], [gvalue]);
181
+ break;
182
+ }
183
+ }
184
+
185
+ function resetDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor): void {
186
+ switch (descriptor.kind) {
187
+ case "property":
188
+ widget.resetProperty(descriptor.enumValue);
189
+ break;
190
+ case "state":
191
+ widget.resetState(descriptor.enumValue);
192
+ break;
193
+ case "relation":
194
+ widget.resetRelation(descriptor.enumValue);
195
+ break;
196
+ }
197
+ }
198
+
199
+ const applyChangedAccessibleProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {
200
+ for (const name in newProps) {
201
+ const descriptor = lookupDescriptor(name);
202
+ if (!descriptor) continue;
203
+
204
+ const newValue = newProps[name];
205
+ if (oldProps?.[name] === newValue) continue;
206
+
207
+ if (newValue === undefined) {
208
+ resetDescriptor(widget, descriptor);
209
+ deleteAccessibleMetadata(widget, name);
210
+ } else {
211
+ applyDescriptor(widget, descriptor, newValue);
212
+ setAccessibleMetadata(widget, name, newValue);
213
+ }
214
+ }
215
+ };
216
+
217
+ const resetRemovedAccessibleProps = (widget: Gtk.Accessible, oldProps: Props, newProps: Props): void => {
218
+ for (const name in oldProps) {
219
+ if (Object.hasOwn(newProps, name)) continue;
220
+ const descriptor = lookupDescriptor(name);
221
+ if (!descriptor) continue;
222
+ if (oldProps[name] !== undefined) {
223
+ resetDescriptor(widget, descriptor);
224
+ deleteAccessibleMetadata(widget, name);
225
+ }
226
+ }
227
+ };
228
+
229
+ export const applyAccessibleProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {
230
+ applyChangedAccessibleProps(widget, oldProps, newProps);
231
+ if (oldProps) resetRemovedAccessibleProps(widget, oldProps, newProps);
232
+ };
@@ -0,0 +1,117 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ import type { SignalHandler } from "@gtkx/runtime";
3
+ import { isConstructOnlyProp, resolveDefaultProp, resolveSignal } from "../utils/gtype.js";
4
+ import { NOTIFY_DETAIL_PREFIX, notifyDetailToProp } from "../utils/notify-name.js";
5
+ import { stateOf } from "./state.js";
6
+ import type { Props } from "./types.js";
7
+
8
+ const notifyValueHandler = (container: GObject.Object, signalName: string, handler: SignalHandler): SignalHandler => {
9
+ const prop = notifyDetailToProp(signalName);
10
+ return () => handler(Reflect.get(container, prop), container);
11
+ };
12
+
13
+ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
14
+ if (typeof value !== "object" || value === null) return false;
15
+ const proto = Object.getPrototypeOf(value);
16
+ return proto === Object.prototype || proto === null;
17
+ };
18
+
19
+ const elementsEqual = (a: unknown, b: unknown): boolean => {
20
+ if (a === b) return true;
21
+ if (!isPlainObject(a) || !isPlainObject(b)) return false;
22
+ const keys = Object.keys(a);
23
+ return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && a[key] === b[key]);
24
+ };
25
+
26
+ const propsEqual = (a: unknown, b: unknown): boolean => {
27
+ if (a === b) return true;
28
+ if (Array.isArray(a) && Array.isArray(b)) {
29
+ return a.length === b.length && a.every((item, index) => elementsEqual(item, b[index]));
30
+ }
31
+ return false;
32
+ };
33
+
34
+ type ApplyPropsOptions = {
35
+ exclude?: (name: string) => boolean;
36
+ };
37
+
38
+ type PendingSignal = { signalName: string; newValue: unknown };
39
+
40
+ type PendingProperty = { name: string; newValue: unknown };
41
+
42
+ const collectGenericChanges = (
43
+ container: GObject.Object,
44
+ oldProps: Props | null,
45
+ newProps: Props,
46
+ exclude: ((name: string) => boolean) | undefined,
47
+ ): { pendingSignals: PendingSignal[]; pendingProperties: PendingProperty[] } => {
48
+ const constructionApplied = oldProps === null;
49
+ const pendingSignals: PendingSignal[] = [];
50
+ const pendingProperties: PendingProperty[] = [];
51
+
52
+ const collect = (name: string): void => {
53
+ if (name === "children" || exclude?.(name)) return;
54
+ if (isConstructOnlyProp(container, name)) return;
55
+
56
+ const oldValue = oldProps?.[name];
57
+ const newValue = newProps[name];
58
+ if (propsEqual(oldValue, newValue)) return;
59
+
60
+ const signalName = resolveSignal(container, name);
61
+ if (signalName) {
62
+ pendingSignals.push({ signalName, newValue });
63
+ return;
64
+ }
65
+ if (constructionApplied) return;
66
+ if (newValue !== undefined) {
67
+ pendingProperties.push({ name, newValue });
68
+ return;
69
+ }
70
+ const fallback = resolveDefaultProp(container, name);
71
+ if (fallback.has) pendingProperties.push({ name, newValue: fallback.value });
72
+ };
73
+
74
+ if (oldProps) {
75
+ for (const name in oldProps) collect(name);
76
+ for (const name in newProps) {
77
+ if (!(name in oldProps)) collect(name);
78
+ }
79
+ } else {
80
+ for (const name in newProps) collect(name);
81
+ }
82
+
83
+ return { pendingSignals, pendingProperties };
84
+ };
85
+
86
+ export function applyProps(
87
+ container: GObject.Object,
88
+ oldProps: Props | null,
89
+ newProps: Props,
90
+ options?: ApplyPropsOptions,
91
+ ): void {
92
+ const { signalStore } = stateOf(container);
93
+ const { pendingSignals, pendingProperties } = collectGenericChanges(
94
+ container,
95
+ oldProps,
96
+ newProps,
97
+ options?.exclude,
98
+ );
99
+
100
+ for (const { signalName, newValue } of pendingSignals) {
101
+ const nextHandler = typeof newValue === "function" ? (newValue as SignalHandler) : undefined;
102
+ const handler =
103
+ nextHandler && signalName.startsWith(NOTIFY_DETAIL_PREFIX)
104
+ ? notifyValueHandler(container, signalName, nextHandler)
105
+ : nextHandler;
106
+ signalStore.set({
107
+ instance: container,
108
+ signal: signalName,
109
+ handler,
110
+ });
111
+ }
112
+
113
+ for (const { name, newValue } of pendingProperties) {
114
+ if (typeof newValue === "string" && Reflect.get(container, name) === newValue) continue;
115
+ Reflect.set(container, name, newValue);
116
+ }
117
+ }
@@ -0,0 +1,13 @@
1
+ const pending = new Set<() => void>();
2
+
3
+ export const scheduleFlush = (fn: () => void): void => {
4
+ pending.add(fn);
5
+ };
6
+
7
+ export const runCommitFlush = (): void => {
8
+ while (pending.size > 0) {
9
+ const batch = [...pending];
10
+ pending.clear();
11
+ for (const fn of batch) fn();
12
+ }
13
+ };
@@ -0,0 +1,219 @@
1
+ import type { ContainerProp } from "@gtkx/config";
2
+ import * as GObject from "@gtkx/gi/gobject";
3
+ import * as Gtk from "@gtkx/gi/gtk";
4
+ import { typeChainIncludes } from "../utils/gtype.js";
5
+ import { callUsesRef, nullSetterCurrentHolder, resolveContainerProp, runCall } from "./element-props.js";
6
+ import { type ElementMapping, registeredStateOf, stateOf } from "./state.js";
7
+ import { childWidget } from "./wrapper-content.js";
8
+
9
+ const containerPropFor = (container: GObject.Object, child: Gtk.Widget): ContainerProp | null =>
10
+ resolveContainerProp(container.__type__, child.__type__, undefined);
11
+
12
+ const scopeFor = (child: Gtk.Widget) => ({ child, props: registeredStateOf(child)?.props ?? {} });
13
+
14
+ export function attachChild(child: Gtk.Widget, container: GObject.Object): void {
15
+ const cp = containerPropFor(container, child);
16
+ if (cp?.append !== undefined) {
17
+ runCall(container, cp.append, [child], scopeFor(child));
18
+ return;
19
+ }
20
+ if (container instanceof Gtk.Widget) child.setParent(container);
21
+ }
22
+
23
+ export function detachChild(child: Gtk.Widget, container: GObject.Object): void {
24
+ const cp = containerPropFor(container, child);
25
+ if (cp?.remove !== undefined) {
26
+ const holder = nullSetterCurrentHolder(container, cp.remove);
27
+ if (holder !== undefined) {
28
+ if (holder === child) runCall(container, cp.remove, [child], scopeFor(child));
29
+ return;
30
+ }
31
+ if (container instanceof Gtk.Widget && !isDescendantOf(child, container)) return;
32
+ runCall(container, cp.remove, [child], scopeFor(child));
33
+ return;
34
+ }
35
+ if (container instanceof Gtk.Widget && isDescendantOf(child, container)) child.unparent();
36
+ }
37
+
38
+ export function unparentWidget(widget: Gtk.Widget): void {
39
+ const currentParent = widget.getParent();
40
+ if (currentParent === null) return;
41
+ detachChild(widget, currentParent);
42
+ }
43
+
44
+ export function getFocusWidget(widget: Gtk.Widget): Gtk.Widget | null {
45
+ const root = widget.getRoot();
46
+ return root?.getFocus() ?? null;
47
+ }
48
+
49
+ export function isDescendantOf(widget: Gtk.Widget, ancestor: Gtk.Widget): boolean {
50
+ let current: Gtk.Widget | null = widget;
51
+ while (current) {
52
+ if (current === ancestor) return true;
53
+ current = current.getParent();
54
+ }
55
+ return false;
56
+ }
57
+
58
+ const isAutowrapChild = (cp: ContainerProp | null, widget: Gtk.Widget): boolean =>
59
+ cp?.autowrap !== undefined && !typeChainIncludes(widget.__type__, cp.autowrap);
60
+
61
+ const detachAutowrapped = (widget: Gtk.Widget): void => {
62
+ const wrapper = widget.getParent();
63
+ if (wrapper === null) return;
64
+ detachChild(widget, wrapper);
65
+ const wrapperParent = wrapper.getParent();
66
+ if (wrapperParent !== null) detachChild(wrapper, wrapperParent);
67
+ };
68
+
69
+ function* childWidgetsOf(container: Gtk.Widget): IterableIterator<Gtk.Widget> {
70
+ let child = container.getFirstChild();
71
+ while (child) {
72
+ yield child;
73
+ child = child.getNextSibling();
74
+ }
75
+ }
76
+
77
+ const unwrapChildWidget = (child: Gtk.Widget): Gtk.Widget | null => {
78
+ if ("getChild" in child && typeof child.getChild === "function") {
79
+ const inner: unknown = child.getChild();
80
+ return inner instanceof Gtk.Widget ? inner : null;
81
+ }
82
+ return child;
83
+ };
84
+
85
+ const findWrappedPosition = (container: Gtk.Widget, anchor: Gtk.Widget, wrapper: string): number | null => {
86
+ const anchorIsWrapper = typeChainIncludes(anchor.__type__, wrapper);
87
+ let position = 0;
88
+ for (const current of childWidgetsOf(container)) {
89
+ const compare = anchorIsWrapper ? current : unwrapChildWidget(current);
90
+ if (compare && compare === anchor) return position;
91
+ position++;
92
+ }
93
+ return null;
94
+ };
95
+
96
+ const findInsertPosition = (container: Gtk.Widget, anchor: Gtk.Widget): number => {
97
+ let position = 0;
98
+ for (const current of childWidgetsOf(container)) {
99
+ if (current === anchor) return position;
100
+ position++;
101
+ }
102
+ return position;
103
+ };
104
+
105
+ const reorderPosition = (container: Gtk.Widget, anchor: Gtk.Widget, moving: Gtk.Widget): number => {
106
+ let position = 0;
107
+ for (const current of childWidgetsOf(container)) {
108
+ if (current === moving) continue;
109
+ if (current === anchor) return position;
110
+ position++;
111
+ }
112
+ return position;
113
+ };
114
+
115
+ const findPrevSibling = (container: Gtk.Widget, anchor: Gtk.Widget): Gtk.Widget | undefined => {
116
+ for (const child of childWidgetsOf(container)) {
117
+ if (child === anchor) return child.getPrevSibling() ?? undefined;
118
+ }
119
+ return undefined;
120
+ };
121
+
122
+ const insertAtIndex = (
123
+ container: Gtk.Widget,
124
+ widget: Gtk.Widget,
125
+ anchor: Gtk.Widget,
126
+ cp: ContainerProp & { insert: NonNullable<ContainerProp["insert"]> },
127
+ ): void => {
128
+ if (cp.autowrap !== undefined) {
129
+ if (widget.getParent() !== null) {
130
+ if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);
131
+ else unparentWidget(widget);
132
+ }
133
+ const position = findWrappedPosition(container, anchor, cp.autowrap);
134
+ if (position === null) attachChild(widget, container);
135
+ else runCall(container, cp.insert, [widget, position], { child: widget, index: position });
136
+ return;
137
+ }
138
+ if (widget.getParent() === container && cp.reorder !== undefined) {
139
+ const position = reorderPosition(container, anchor, widget);
140
+ runCall(container, cp.reorder, [widget, position], { child: widget, index: position });
141
+ return;
142
+ }
143
+ unparentWidget(widget);
144
+ const position = findInsertPosition(container, anchor);
145
+ runCall(container, cp.insert, [widget, position], { child: widget, index: position });
146
+ };
147
+
148
+ const insertBySibling = (container: Gtk.Widget, widget: Gtk.Widget, anchor: Gtk.Widget, cp: ContainerProp): void => {
149
+ const previous = findPrevSibling(container, anchor);
150
+ const scope = { child: widget, sibling: previous ?? null };
151
+ if (widget.getParent() === container && cp.reorder !== undefined) {
152
+ runCall(container, cp.reorder, [widget, previous], scope);
153
+ return;
154
+ }
155
+ unparentWidget(widget);
156
+ if (cp.insert !== undefined) runCall(container, cp.insert, [widget, previous], scope);
157
+ else attachChild(widget, container);
158
+ };
159
+
160
+ const reinsertAll = (container: GObject.Object): void => {
161
+ const widgets: Gtk.Widget[] = [];
162
+ for (const child of stateOf(container).children) {
163
+ const widget = childWidget(child);
164
+ if (widget) widgets.push(widget);
165
+ }
166
+ for (const widget of widgets) detachChild(widget, container);
167
+ for (const widget of widgets) attachChild(widget, container);
168
+ };
169
+
170
+ const insertWidgetBefore = (container: GObject.Object, widget: Gtk.Widget, anchor: Gtk.Widget): void => {
171
+ const cp = containerPropFor(container, widget);
172
+ if (cp?.insert !== undefined && callUsesRef(cp.insert, "index") && container instanceof Gtk.Widget) {
173
+ insertAtIndex(container, widget, anchor, { ...cp, insert: cp.insert });
174
+ return;
175
+ }
176
+ if (
177
+ container instanceof Gtk.Widget &&
178
+ (cp?.reorder !== undefined || (cp?.insert !== undefined && callUsesRef(cp.insert, "sibling")))
179
+ ) {
180
+ insertBySibling(container, widget, anchor, cp);
181
+ return;
182
+ }
183
+ reinsertAll(container);
184
+ };
185
+
186
+ const appendWidget = (container: GObject.Object, widget: Gtk.Widget, fresh: boolean): void => {
187
+ if (!fresh && widget.getParent() !== null) {
188
+ const cp = containerPropFor(container, widget);
189
+ if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);
190
+ else unparentWidget(widget);
191
+ }
192
+ attachChild(widget, container);
193
+ };
194
+
195
+ const removeWidget = (container: GObject.Object, widget: Gtk.Widget): void => {
196
+ const cp = containerPropFor(container, widget);
197
+ if (!isAutowrapChild(cp, widget)) {
198
+ detachChild(widget, container);
199
+ return;
200
+ }
201
+ const wrapper = widget.getParent();
202
+ if (wrapper !== null && wrapper !== container) {
203
+ detachChild(widget, wrapper);
204
+ detachChild(wrapper, container);
205
+ }
206
+ };
207
+
208
+ export const containerMapping: ElementMapping = (child, parent) => {
209
+ const widget = childWidget(child);
210
+ if (widget === null || !(parent instanceof GObject.Object)) return null;
211
+ if (!(parent instanceof Gtk.Widget) && containerPropFor(parent, widget) === null) return null;
212
+ return {
213
+ attach: (anchor, fresh) => {
214
+ if (anchor instanceof Gtk.Widget) insertWidgetBefore(parent, widget, anchor);
215
+ else appendWidget(parent, widget, fresh === true);
216
+ },
217
+ detach: () => removeWidget(parent, widget),
218
+ };
219
+ };
@@ -0,0 +1,19 @@
1
+ import { scheduleFlush } from "./commit-flush.js";
2
+ import { closestInstance, type Node } from "./state.js";
3
+
4
+ const rebuildsByContentOwner = new WeakMap<Node, () => void>();
5
+
6
+ export const scheduleContentRebuild = <T extends Node>(
7
+ node: Node,
8
+ isContentOwner: (candidate: Node) => candidate is T,
9
+ createRebuild: (owner: T) => () => void,
10
+ ): void => {
11
+ const owner = closestInstance(node, isContentOwner);
12
+ if (!owner) return;
13
+ let rebuild = rebuildsByContentOwner.get(owner);
14
+ if (!rebuild) {
15
+ rebuild = createRebuild(owner);
16
+ rebuildsByContentOwner.set(owner, rebuild);
17
+ }
18
+ scheduleFlush(rebuild);
19
+ };
@@ -0,0 +1,58 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import { containerMapping } from "./container-attach.js";
3
+ import { type ElementHandler, type ElementMapping, type Node, stateOf } from "./state.js";
4
+ import { containerChildMapping, containerPropMapping, lazyElementMapping, objectPropMapping } from "./wrapper-apply.js";
5
+ import { isWrapperNode } from "./wrapper-node.js";
6
+
7
+ const ELEMENT_MAP: ElementMapping[] = [
8
+ objectPropMapping,
9
+ containerPropMapping,
10
+ lazyElementMapping,
11
+ containerChildMapping,
12
+ containerMapping,
13
+ ];
14
+
15
+ const resolveHandler = (child: Node, parent: Node): ElementHandler | null => {
16
+ for (const mapping of ELEMENT_MAP) {
17
+ const handler = mapping(child, parent);
18
+ if (handler !== null) return handler;
19
+ }
20
+ return null;
21
+ };
22
+
23
+ const attachToParent = (child: Node, parent: Node, anchor?: GObject.Object | null, fresh?: boolean): void => {
24
+ resolveHandler(child, parent)?.attach(anchor, fresh);
25
+ };
26
+
27
+ export const detachFromParent = (child: Node, parent: Node): void => {
28
+ resolveHandler(child, parent)?.detach();
29
+ };
30
+
31
+ export const resyncWrapperNode = (node: Node): void => {
32
+ const parent = stateOf(node).parent;
33
+ if (isWrapperNode(node) && parent) attachToParent(node, parent);
34
+ };
35
+
36
+ const anchorWrapper = (before: Node): GObject.Object | null => {
37
+ if (before instanceof GObject.Object) return before;
38
+ for (const grandchild of stateOf(before).children) {
39
+ if (grandchild instanceof GObject.Object) return grandchild;
40
+ }
41
+ return null;
42
+ };
43
+
44
+ export const attachNode = (parent: Node, child: Node, before: Node | null, fresh: boolean): void => {
45
+ if (before === null) {
46
+ if (isWrapperNode(child) || !isWrapperNode(parent)) attachToParent(child, parent, null, fresh);
47
+ } else if (isWrapperNode(child)) {
48
+ attachToParent(child, parent);
49
+ } else if (!isWrapperNode(parent)) {
50
+ attachToParent(child, parent, anchorWrapper(before));
51
+ }
52
+ if (isWrapperNode(parent)) resyncWrapperNode(parent);
53
+ };
54
+
55
+ export const detachNode = (parent: Node, child: Node): void => {
56
+ if (isWrapperNode(child) || !isWrapperNode(parent)) detachFromParent(child, parent);
57
+ if (isWrapperNode(parent)) resyncWrapperNode(parent);
58
+ };