@gtkx/react 0.21.0 → 1.0.0-rc.2

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 (599) hide show
  1. package/README.md +137 -34
  2. package/dist/adw/config.d.ts +2 -0
  3. package/dist/adw/config.d.ts.map +1 -0
  4. package/dist/adw/config.js +2 -0
  5. package/dist/adw/config.js.map +1 -0
  6. package/dist/adw/dialog.d.ts +8 -0
  7. package/dist/adw/dialog.d.ts.map +1 -0
  8. package/dist/adw/dialog.js +25 -0
  9. package/dist/adw/dialog.js.map +1 -0
  10. package/dist/adw/element-behaviors.d.ts +2 -0
  11. package/dist/adw/element-behaviors.d.ts.map +1 -0
  12. package/dist/adw/element-behaviors.js +299 -0
  13. package/dist/adw/element-behaviors.js.map +1 -0
  14. package/dist/adw/element-config.d.ts +9 -0
  15. package/dist/adw/element-config.d.ts.map +1 -0
  16. package/dist/adw/element-config.js +137 -0
  17. package/dist/adw/element-config.js.map +1 -0
  18. package/dist/adw/index.d.ts +4 -0
  19. package/dist/adw/index.d.ts.map +1 -0
  20. package/dist/adw/index.js +3 -0
  21. package/dist/adw/index.js.map +1 -0
  22. package/dist/adw/prop-types.d.ts +29 -0
  23. package/dist/adw/prop-types.d.ts.map +1 -0
  24. package/dist/adw/prop-types.js +2 -0
  25. package/dist/adw/prop-types.js.map +1 -0
  26. package/dist/bootstrap.d.ts +2 -0
  27. package/dist/bootstrap.d.ts.map +1 -0
  28. package/dist/bootstrap.js +5 -0
  29. package/dist/bootstrap.js.map +1 -0
  30. package/dist/components/application.d.ts +10 -0
  31. package/dist/components/application.d.ts.map +1 -0
  32. package/dist/components/application.js +39 -0
  33. package/dist/components/application.js.map +1 -0
  34. package/dist/components/element.d.ts +6 -0
  35. package/dist/components/element.d.ts.map +1 -0
  36. package/dist/components/element.js +29 -0
  37. package/dist/components/element.js.map +1 -0
  38. package/dist/components/window.d.ts +8 -0
  39. package/dist/components/window.d.ts.map +1 -0
  40. package/dist/components/window.js +22 -0
  41. package/dist/components/window.js.map +1 -0
  42. package/dist/config.d.ts +4 -0
  43. package/dist/config.d.ts.map +1 -0
  44. package/dist/config.js +3 -0
  45. package/dist/config.js.map +1 -0
  46. package/dist/element-behaviors.d.ts +2 -0
  47. package/dist/element-behaviors.d.ts.map +1 -0
  48. package/dist/element-behaviors.js +348 -0
  49. package/dist/element-behaviors.js.map +1 -0
  50. package/dist/element-config.d.ts +10 -0
  51. package/dist/element-config.d.ts.map +1 -0
  52. package/dist/element-config.js +146 -0
  53. package/dist/element-config.js.map +1 -0
  54. package/dist/hooks/use-application.d.ts +9 -0
  55. package/dist/hooks/use-application.d.ts.map +1 -0
  56. package/dist/hooks/use-application.js +14 -0
  57. package/dist/hooks/use-application.js.map +1 -0
  58. package/dist/hooks/use-bind-setting.d.ts +23 -0
  59. package/dist/hooks/use-bind-setting.d.ts.map +1 -0
  60. package/dist/hooks/use-bind-setting.js +30 -0
  61. package/dist/hooks/use-bind-setting.js.map +1 -0
  62. package/dist/hooks/use-merged-refs.d.ts +8 -0
  63. package/dist/hooks/use-merged-refs.d.ts.map +1 -0
  64. package/dist/hooks/use-merged-refs.js +48 -0
  65. package/dist/hooks/use-merged-refs.js.map +1 -0
  66. package/dist/hooks/use-object-value.d.ts +5 -0
  67. package/dist/hooks/use-object-value.d.ts.map +1 -0
  68. package/dist/hooks/use-object-value.js +29 -0
  69. package/dist/hooks/use-object-value.js.map +1 -0
  70. package/dist/hooks/use-parent-window.d.ts +9 -0
  71. package/dist/hooks/use-parent-window.d.ts.map +1 -0
  72. package/dist/hooks/use-parent-window.js +8 -0
  73. package/dist/hooks/use-parent-window.js.map +1 -0
  74. package/dist/hooks/use-property.d.ts +14 -0
  75. package/dist/hooks/use-property.d.ts.map +1 -0
  76. package/dist/hooks/use-property.js +14 -0
  77. package/dist/hooks/use-property.js.map +1 -0
  78. package/dist/hooks/use-setting.d.ts +14 -0
  79. package/dist/hooks/use-setting.d.ts.map +1 -0
  80. package/dist/hooks/use-setting.js +20 -0
  81. package/dist/hooks/use-setting.js.map +1 -0
  82. package/dist/hooks/use-signal.d.ts +24 -0
  83. package/dist/hooks/use-signal.d.ts.map +1 -0
  84. package/dist/hooks/use-signal.js +31 -0
  85. package/dist/hooks/use-signal.js.map +1 -0
  86. package/dist/index.d.ts +13 -7
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +9 -7
  89. package/dist/index.js.map +1 -1
  90. package/dist/internal.d.ts +13 -0
  91. package/dist/internal.d.ts.map +1 -0
  92. package/dist/internal.js +12 -0
  93. package/dist/internal.js.map +1 -0
  94. package/dist/prop-types.d.ts +110 -0
  95. package/dist/prop-types.d.ts.map +1 -0
  96. package/dist/prop-types.js +2 -0
  97. package/dist/prop-types.js.map +1 -0
  98. package/dist/reconciler/apply-props.d.ts +11 -0
  99. package/dist/reconciler/apply-props.d.ts.map +1 -0
  100. package/dist/reconciler/apply-props.js +190 -0
  101. package/dist/reconciler/apply-props.js.map +1 -0
  102. package/dist/reconciler/behaviors.d.ts +59 -0
  103. package/dist/reconciler/behaviors.d.ts.map +1 -0
  104. package/dist/reconciler/behaviors.js +172 -0
  105. package/dist/reconciler/behaviors.js.map +1 -0
  106. package/dist/reconciler/child-routing.d.ts +5 -0
  107. package/dist/reconciler/child-routing.d.ts.map +1 -0
  108. package/dist/reconciler/child-routing.js +156 -0
  109. package/dist/reconciler/child-routing.js.map +1 -0
  110. package/dist/reconciler/host-config.d.ts +9 -0
  111. package/dist/reconciler/host-config.d.ts.map +1 -0
  112. package/dist/reconciler/host-config.js +214 -0
  113. package/dist/reconciler/host-config.js.map +1 -0
  114. package/dist/reconciler/instance.d.ts +5 -0
  115. package/dist/reconciler/instance.d.ts.map +1 -0
  116. package/dist/reconciler/instance.js +49 -0
  117. package/dist/reconciler/instance.js.map +1 -0
  118. package/dist/reconciler/metadata.d.ts +17 -0
  119. package/dist/reconciler/metadata.d.ts.map +1 -0
  120. package/dist/reconciler/metadata.js +82 -0
  121. package/dist/reconciler/metadata.js.map +1 -0
  122. package/dist/reconciler/node.d.ts +76 -0
  123. package/dist/reconciler/node.d.ts.map +1 -0
  124. package/dist/reconciler/node.js +53 -0
  125. package/dist/reconciler/node.js.map +1 -0
  126. package/dist/reconciler/placement.d.ts +5 -0
  127. package/dist/reconciler/placement.d.ts.map +1 -0
  128. package/dist/reconciler/placement.js +175 -0
  129. package/dist/reconciler/placement.js.map +1 -0
  130. package/dist/reconciler/registry.d.ts +92 -0
  131. package/dist/reconciler/registry.d.ts.map +1 -0
  132. package/dist/reconciler/registry.js +64 -0
  133. package/dist/reconciler/registry.js.map +1 -0
  134. package/dist/reconciler/root-element.d.ts +11 -0
  135. package/dist/reconciler/root-element.d.ts.map +1 -0
  136. package/dist/reconciler/root-element.js +7 -0
  137. package/dist/reconciler/root-element.js.map +1 -0
  138. package/dist/reconciler/root.d.ts +56 -0
  139. package/dist/reconciler/root.d.ts.map +1 -0
  140. package/dist/reconciler/root.js +109 -0
  141. package/dist/reconciler/root.js.map +1 -0
  142. package/dist/reconciler/signals.d.ts +10 -0
  143. package/dist/reconciler/signals.d.ts.map +1 -0
  144. package/dist/reconciler/signals.js +70 -0
  145. package/dist/reconciler/signals.js.map +1 -0
  146. package/dist/reconciler/text.d.ts +19 -0
  147. package/dist/reconciler/text.d.ts.map +1 -0
  148. package/dist/reconciler/text.js +276 -0
  149. package/dist/reconciler/text.js.map +1 -0
  150. package/dist/utils/accessible-metadata.d.ts +12 -0
  151. package/dist/utils/accessible-metadata.d.ts.map +1 -0
  152. package/dist/utils/accessible-metadata.js +25 -0
  153. package/dist/utils/accessible-metadata.js.map +1 -0
  154. package/dist/utils/accessible-props.d.ts +60 -0
  155. package/dist/utils/accessible-props.d.ts.map +1 -0
  156. package/dist/utils/accessible-props.js +181 -0
  157. package/dist/utils/accessible-props.js.map +1 -0
  158. package/dist/utils/ref-prop.d.ts +15 -0
  159. package/dist/utils/ref-prop.d.ts.map +1 -0
  160. package/dist/utils/ref-prop.js +18 -0
  161. package/dist/utils/ref-prop.js.map +1 -0
  162. package/dist/utils/settings.d.ts +17 -0
  163. package/dist/utils/settings.d.ts.map +1 -0
  164. package/dist/utils/settings.js +37 -0
  165. package/dist/utils/settings.js.map +1 -0
  166. package/dist/utils/variant.d.ts +57 -0
  167. package/dist/utils/variant.d.ts.map +1 -0
  168. package/dist/utils/variant.js +197 -0
  169. package/dist/utils/variant.js.map +1 -0
  170. package/env.d.ts +9 -0
  171. package/package.json +49 -10
  172. package/src/adw/config.ts +1 -0
  173. package/src/adw/dialog.tsx +35 -0
  174. package/src/adw/element-behaviors.ts +379 -0
  175. package/src/adw/element-config.ts +140 -0
  176. package/src/adw/index.ts +4 -0
  177. package/src/adw/prop-types.ts +42 -0
  178. package/src/bootstrap.ts +5 -0
  179. package/src/components/application.tsx +62 -0
  180. package/src/components/element.tsx +47 -0
  181. package/src/components/window.tsx +35 -0
  182. package/src/config.ts +3 -0
  183. package/src/element-behaviors.ts +424 -0
  184. package/src/element-config.ts +148 -0
  185. package/src/env.d.ts +1 -0
  186. package/src/hooks/use-application.ts +19 -0
  187. package/src/hooks/use-bind-setting.ts +51 -0
  188. package/src/hooks/use-merged-refs.ts +64 -0
  189. package/src/hooks/use-object-value.ts +54 -0
  190. package/src/hooks/use-parent-window.ts +11 -0
  191. package/src/hooks/use-property.ts +23 -0
  192. package/src/hooks/use-setting.ts +34 -0
  193. package/src/hooks/use-signal.ts +60 -0
  194. package/src/index.ts +14 -14
  195. package/src/internal.ts +13 -0
  196. package/src/prop-types.ts +142 -0
  197. package/src/reconciler/apply-props.ts +265 -0
  198. package/src/reconciler/behaviors.ts +324 -0
  199. package/src/reconciler/child-routing.ts +202 -0
  200. package/src/reconciler/host-config.ts +278 -0
  201. package/src/reconciler/instance.ts +82 -0
  202. package/src/reconciler/metadata.ts +119 -0
  203. package/src/reconciler/node.ts +161 -0
  204. package/src/reconciler/placement.ts +255 -0
  205. package/src/reconciler/registry.ts +161 -0
  206. package/src/reconciler/root-element.ts +12 -0
  207. package/src/reconciler/root.ts +175 -0
  208. package/src/reconciler/signals.ts +113 -0
  209. package/src/reconciler/text.ts +407 -0
  210. package/src/utils/accessible-metadata.ts +31 -0
  211. package/src/utils/accessible-props.ts +279 -0
  212. package/src/utils/ref-prop.ts +30 -0
  213. package/src/utils/settings.ts +69 -0
  214. package/src/utils/variant.ts +368 -0
  215. package/dist/components/compound.d.ts +0 -40
  216. package/dist/components/compound.d.ts.map +0 -1
  217. package/dist/components/compound.js +0 -46
  218. package/dist/components/compound.js.map +0 -1
  219. package/dist/components/list.d.ts +0 -75
  220. package/dist/components/list.d.ts.map +0 -1
  221. package/dist/components/list.js +0 -81
  222. package/dist/components/list.js.map +0 -1
  223. package/dist/components/slot-widget.d.ts +0 -15
  224. package/dist/components/slot-widget.d.ts.map +0 -1
  225. package/dist/components/slot-widget.js +0 -37
  226. package/dist/components/slot-widget.js.map +0 -1
  227. package/dist/errors.d.ts +0 -15
  228. package/dist/errors.d.ts.map +0 -1
  229. package/dist/errors.js +0 -44
  230. package/dist/errors.js.map +0 -1
  231. package/dist/factory.d.ts +0 -5
  232. package/dist/factory.d.ts.map +0 -1
  233. package/dist/factory.js +0 -37
  234. package/dist/factory.js.map +0 -1
  235. package/dist/generated/compounds.d.ts +0 -2672
  236. package/dist/generated/compounds.d.ts.map +0 -1
  237. package/dist/generated/compounds.js +0 -2624
  238. package/dist/generated/compounds.js.map +0 -1
  239. package/dist/generated/internal.d.ts +0 -16
  240. package/dist/generated/internal.d.ts.map +0 -1
  241. package/dist/generated/internal.js +0 -3638
  242. package/dist/generated/internal.js.map +0 -1
  243. package/dist/generated/jsx.d.ts +0 -17074
  244. package/dist/generated/jsx.d.ts.map +0 -1
  245. package/dist/generated/jsx.js +0 -6715
  246. package/dist/generated/jsx.js.map +0 -1
  247. package/dist/generated/registry.d.ts +0 -5
  248. package/dist/generated/registry.d.ts.map +0 -1
  249. package/dist/generated/registry.js +0 -13
  250. package/dist/generated/registry.js.map +0 -1
  251. package/dist/host-config.d.ts +0 -24
  252. package/dist/host-config.d.ts.map +0 -1
  253. package/dist/host-config.js +0 -172
  254. package/dist/host-config.js.map +0 -1
  255. package/dist/jsx.d.ts +0 -974
  256. package/dist/jsx.d.ts.map +0 -1
  257. package/dist/jsx.js +0 -8
  258. package/dist/jsx.js.map +0 -1
  259. package/dist/metadata.d.ts +0 -5
  260. package/dist/metadata.d.ts.map +0 -1
  261. package/dist/metadata.js +0 -33
  262. package/dist/metadata.js.map +0 -1
  263. package/dist/node.d.ts +0 -25
  264. package/dist/node.d.ts.map +0 -1
  265. package/dist/node.js +0 -85
  266. package/dist/node.js.map +0 -1
  267. package/dist/nodes/adjustable.d.ts +0 -11
  268. package/dist/nodes/adjustable.d.ts.map +0 -1
  269. package/dist/nodes/adjustable.js +0 -46
  270. package/dist/nodes/adjustable.js.map +0 -1
  271. package/dist/nodes/alert-dialog-response.d.ts +0 -15
  272. package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
  273. package/dist/nodes/alert-dialog-response.js +0 -61
  274. package/dist/nodes/alert-dialog-response.js.map +0 -1
  275. package/dist/nodes/alert-dialog.d.ts +0 -14
  276. package/dist/nodes/alert-dialog.d.ts.map +0 -1
  277. package/dist/nodes/alert-dialog.js +0 -41
  278. package/dist/nodes/alert-dialog.js.map +0 -1
  279. package/dist/nodes/animation.d.ts +0 -39
  280. package/dist/nodes/animation.d.ts.map +0 -1
  281. package/dist/nodes/animation.js +0 -326
  282. package/dist/nodes/animation.js.map +0 -1
  283. package/dist/nodes/application.d.ts +0 -12
  284. package/dist/nodes/application.d.ts.map +0 -1
  285. package/dist/nodes/application.js +0 -51
  286. package/dist/nodes/application.js.map +0 -1
  287. package/dist/nodes/calendar.d.ts +0 -18
  288. package/dist/nodes/calendar.d.ts.map +0 -1
  289. package/dist/nodes/calendar.js +0 -28
  290. package/dist/nodes/calendar.js.map +0 -1
  291. package/dist/nodes/color-dialog-button.d.ts +0 -15
  292. package/dist/nodes/color-dialog-button.d.ts.map +0 -1
  293. package/dist/nodes/color-dialog-button.js +0 -43
  294. package/dist/nodes/color-dialog-button.js.map +0 -1
  295. package/dist/nodes/column-view-column.d.ts +0 -36
  296. package/dist/nodes/column-view-column.d.ts.map +0 -1
  297. package/dist/nodes/column-view-column.js +0 -168
  298. package/dist/nodes/column-view-column.js.map +0 -1
  299. package/dist/nodes/container-slot.d.ts +0 -18
  300. package/dist/nodes/container-slot.d.ts.map +0 -1
  301. package/dist/nodes/container-slot.js +0 -81
  302. package/dist/nodes/container-slot.js.map +0 -1
  303. package/dist/nodes/dialog.d.ts +0 -10
  304. package/dist/nodes/dialog.d.ts.map +0 -1
  305. package/dist/nodes/dialog.js +0 -20
  306. package/dist/nodes/dialog.js.map +0 -1
  307. package/dist/nodes/drawing-area.d.ts +0 -19
  308. package/dist/nodes/drawing-area.d.ts.map +0 -1
  309. package/dist/nodes/drawing-area.js +0 -40
  310. package/dist/nodes/drawing-area.js.map +0 -1
  311. package/dist/nodes/event-controller.d.ts +0 -15
  312. package/dist/nodes/event-controller.d.ts.map +0 -1
  313. package/dist/nodes/event-controller.js +0 -73
  314. package/dist/nodes/event-controller.js.map +0 -1
  315. package/dist/nodes/fixed-child.d.ts +0 -19
  316. package/dist/nodes/fixed-child.d.ts.map +0 -1
  317. package/dist/nodes/fixed-child.js +0 -99
  318. package/dist/nodes/fixed-child.js.map +0 -1
  319. package/dist/nodes/font-dialog-button.d.ts +0 -15
  320. package/dist/nodes/font-dialog-button.d.ts.map +0 -1
  321. package/dist/nodes/font-dialog-button.js +0 -76
  322. package/dist/nodes/font-dialog-button.js.map +0 -1
  323. package/dist/nodes/grid-child.d.ts +0 -19
  324. package/dist/nodes/grid-child.d.ts.map +0 -1
  325. package/dist/nodes/grid-child.js +0 -94
  326. package/dist/nodes/grid-child.js.map +0 -1
  327. package/dist/nodes/internal/accessible.d.ts +0 -5
  328. package/dist/nodes/internal/accessible.d.ts.map +0 -1
  329. package/dist/nodes/internal/accessible.js +0 -119
  330. package/dist/nodes/internal/accessible.js.map +0 -1
  331. package/dist/nodes/internal/bound-item.d.ts +0 -4
  332. package/dist/nodes/internal/bound-item.d.ts.map +0 -1
  333. package/dist/nodes/internal/bound-item.js +0 -2
  334. package/dist/nodes/internal/bound-item.js.map +0 -1
  335. package/dist/nodes/internal/construct.d.ts +0 -3
  336. package/dist/nodes/internal/construct.d.ts.map +0 -1
  337. package/dist/nodes/internal/construct.js +0 -44
  338. package/dist/nodes/internal/construct.js.map +0 -1
  339. package/dist/nodes/internal/predicates.d.ts +0 -51
  340. package/dist/nodes/internal/predicates.d.ts.map +0 -1
  341. package/dist/nodes/internal/predicates.js +0 -36
  342. package/dist/nodes/internal/predicates.js.map +0 -1
  343. package/dist/nodes/internal/props.d.ts +0 -6
  344. package/dist/nodes/internal/props.d.ts.map +0 -1
  345. package/dist/nodes/internal/props.js +0 -43
  346. package/dist/nodes/internal/props.js.map +0 -1
  347. package/dist/nodes/internal/signal-store.d.ts +0 -22
  348. package/dist/nodes/internal/signal-store.d.ts.map +0 -1
  349. package/dist/nodes/internal/signal-store.js +0 -98
  350. package/dist/nodes/internal/signal-store.js.map +0 -1
  351. package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
  352. package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
  353. package/dist/nodes/internal/text-buffer-controller.js +0 -327
  354. package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
  355. package/dist/nodes/internal/widget.d.ts +0 -8
  356. package/dist/nodes/internal/widget.d.ts.map +0 -1
  357. package/dist/nodes/internal/widget.js +0 -68
  358. package/dist/nodes/internal/widget.js.map +0 -1
  359. package/dist/nodes/level-bar.d.ts +0 -12
  360. package/dist/nodes/level-bar.d.ts.map +0 -1
  361. package/dist/nodes/level-bar.js +0 -24
  362. package/dist/nodes/level-bar.js.map +0 -1
  363. package/dist/nodes/list-item-node.d.ts +0 -12
  364. package/dist/nodes/list-item-node.d.ts.map +0 -1
  365. package/dist/nodes/list-item-node.js +0 -45
  366. package/dist/nodes/list-item-node.js.map +0 -1
  367. package/dist/nodes/list.d.ts +0 -100
  368. package/dist/nodes/list.d.ts.map +0 -1
  369. package/dist/nodes/list.js +0 -950
  370. package/dist/nodes/list.js.map +0 -1
  371. package/dist/nodes/menu.d.ts +0 -7
  372. package/dist/nodes/menu.d.ts.map +0 -1
  373. package/dist/nodes/menu.js +0 -20
  374. package/dist/nodes/menu.js.map +0 -1
  375. package/dist/nodes/models/menu.d.ts +0 -47
  376. package/dist/nodes/models/menu.d.ts.map +0 -1
  377. package/dist/nodes/models/menu.js +0 -240
  378. package/dist/nodes/models/menu.js.map +0 -1
  379. package/dist/nodes/navigation-page.d.ts +0 -19
  380. package/dist/nodes/navigation-page.d.ts.map +0 -1
  381. package/dist/nodes/navigation-page.js +0 -129
  382. package/dist/nodes/navigation-page.js.map +0 -1
  383. package/dist/nodes/navigation-view.d.ts +0 -19
  384. package/dist/nodes/navigation-view.d.ts.map +0 -1
  385. package/dist/nodes/navigation-view.js +0 -51
  386. package/dist/nodes/navigation-view.js.map +0 -1
  387. package/dist/nodes/notebook-page-tab.d.ts +0 -15
  388. package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
  389. package/dist/nodes/notebook-page-tab.js +0 -40
  390. package/dist/nodes/notebook-page-tab.js.map +0 -1
  391. package/dist/nodes/notebook-page.d.ts +0 -29
  392. package/dist/nodes/notebook-page.d.ts.map +0 -1
  393. package/dist/nodes/notebook-page.js +0 -151
  394. package/dist/nodes/notebook-page.js.map +0 -1
  395. package/dist/nodes/notebook.d.ts +0 -16
  396. package/dist/nodes/notebook.d.ts.map +0 -1
  397. package/dist/nodes/notebook.js +0 -31
  398. package/dist/nodes/notebook.js.map +0 -1
  399. package/dist/nodes/overlay-child.d.ts +0 -20
  400. package/dist/nodes/overlay-child.d.ts.map +0 -1
  401. package/dist/nodes/overlay-child.js +0 -109
  402. package/dist/nodes/overlay-child.js.map +0 -1
  403. package/dist/nodes/popover-menu.d.ts +0 -19
  404. package/dist/nodes/popover-menu.d.ts.map +0 -1
  405. package/dist/nodes/popover-menu.js +0 -54
  406. package/dist/nodes/popover-menu.js.map +0 -1
  407. package/dist/nodes/scale.d.ts +0 -10
  408. package/dist/nodes/scale.d.ts.map +0 -1
  409. package/dist/nodes/scale.js +0 -19
  410. package/dist/nodes/scale.js.map +0 -1
  411. package/dist/nodes/scrolled-window.d.ts +0 -11
  412. package/dist/nodes/scrolled-window.d.ts.map +0 -1
  413. package/dist/nodes/scrolled-window.js +0 -18
  414. package/dist/nodes/scrolled-window.js.map +0 -1
  415. package/dist/nodes/search-bar.d.ts +0 -11
  416. package/dist/nodes/search-bar.d.ts.map +0 -1
  417. package/dist/nodes/search-bar.js +0 -16
  418. package/dist/nodes/search-bar.js.map +0 -1
  419. package/dist/nodes/shortcut.d.ts +0 -19
  420. package/dist/nodes/shortcut.d.ts.map +0 -1
  421. package/dist/nodes/shortcut.js +0 -72
  422. package/dist/nodes/shortcut.js.map +0 -1
  423. package/dist/nodes/slot.d.ts +0 -21
  424. package/dist/nodes/slot.d.ts.map +0 -1
  425. package/dist/nodes/slot.js +0 -102
  426. package/dist/nodes/slot.js.map +0 -1
  427. package/dist/nodes/source-view.d.ts +0 -18
  428. package/dist/nodes/source-view.d.ts.map +0 -1
  429. package/dist/nodes/source-view.js +0 -94
  430. package/dist/nodes/source-view.js.map +0 -1
  431. package/dist/nodes/spin-row.d.ts +0 -14
  432. package/dist/nodes/spin-row.d.ts.map +0 -1
  433. package/dist/nodes/spin-row.js +0 -46
  434. package/dist/nodes/spin-row.js.map +0 -1
  435. package/dist/nodes/stack-page.d.ts +0 -22
  436. package/dist/nodes/stack-page.d.ts.map +0 -1
  437. package/dist/nodes/stack-page.js +0 -140
  438. package/dist/nodes/stack-page.js.map +0 -1
  439. package/dist/nodes/stack.d.ts +0 -13
  440. package/dist/nodes/stack.d.ts.map +0 -1
  441. package/dist/nodes/stack.js +0 -21
  442. package/dist/nodes/stack.js.map +0 -1
  443. package/dist/nodes/switch-row.d.ts +0 -11
  444. package/dist/nodes/switch-row.d.ts.map +0 -1
  445. package/dist/nodes/switch-row.js +0 -15
  446. package/dist/nodes/switch-row.js.map +0 -1
  447. package/dist/nodes/text-anchor.d.ts +0 -23
  448. package/dist/nodes/text-anchor.d.ts.map +0 -1
  449. package/dist/nodes/text-anchor.js +0 -74
  450. package/dist/nodes/text-anchor.js.map +0 -1
  451. package/dist/nodes/text-content.d.ts +0 -12
  452. package/dist/nodes/text-content.d.ts.map +0 -1
  453. package/dist/nodes/text-content.js +0 -2
  454. package/dist/nodes/text-content.js.map +0 -1
  455. package/dist/nodes/text-paintable.d.ts +0 -19
  456. package/dist/nodes/text-paintable.d.ts.map +0 -1
  457. package/dist/nodes/text-paintable.js +0 -42
  458. package/dist/nodes/text-paintable.js.map +0 -1
  459. package/dist/nodes/text-segment.d.ts +0 -18
  460. package/dist/nodes/text-segment.d.ts.map +0 -1
  461. package/dist/nodes/text-segment.js +0 -38
  462. package/dist/nodes/text-segment.js.map +0 -1
  463. package/dist/nodes/text-tag.d.ts +0 -38
  464. package/dist/nodes/text-tag.d.ts.map +0 -1
  465. package/dist/nodes/text-tag.js +0 -247
  466. package/dist/nodes/text-tag.js.map +0 -1
  467. package/dist/nodes/text-view.d.ts +0 -29
  468. package/dist/nodes/text-view.d.ts.map +0 -1
  469. package/dist/nodes/text-view.js +0 -80
  470. package/dist/nodes/text-view.js.map +0 -1
  471. package/dist/nodes/toggle-group.d.ts +0 -17
  472. package/dist/nodes/toggle-group.d.ts.map +0 -1
  473. package/dist/nodes/toggle-group.js +0 -65
  474. package/dist/nodes/toggle-group.js.map +0 -1
  475. package/dist/nodes/toggle.d.ts +0 -16
  476. package/dist/nodes/toggle.d.ts.map +0 -1
  477. package/dist/nodes/toggle.js +0 -61
  478. package/dist/nodes/toggle.js.map +0 -1
  479. package/dist/nodes/virtual.d.ts +0 -7
  480. package/dist/nodes/virtual.d.ts.map +0 -1
  481. package/dist/nodes/virtual.js +0 -9
  482. package/dist/nodes/virtual.js.map +0 -1
  483. package/dist/nodes/web-view.d.ts +0 -11
  484. package/dist/nodes/web-view.d.ts.map +0 -1
  485. package/dist/nodes/web-view.js +0 -16
  486. package/dist/nodes/web-view.js.map +0 -1
  487. package/dist/nodes/widget.d.ts +0 -26
  488. package/dist/nodes/widget.d.ts.map +0 -1
  489. package/dist/nodes/widget.js +0 -308
  490. package/dist/nodes/widget.js.map +0 -1
  491. package/dist/nodes/window.d.ts +0 -31
  492. package/dist/nodes/window.d.ts.map +0 -1
  493. package/dist/nodes/window.js +0 -122
  494. package/dist/nodes/window.js.map +0 -1
  495. package/dist/portal.d.ts +0 -29
  496. package/dist/portal.d.ts.map +0 -1
  497. package/dist/portal.js +0 -35
  498. package/dist/portal.js.map +0 -1
  499. package/dist/reconciler.d.ts +0 -34
  500. package/dist/reconciler.d.ts.map +0 -1
  501. package/dist/reconciler.js +0 -48
  502. package/dist/reconciler.js.map +0 -1
  503. package/dist/registry.d.ts +0 -18
  504. package/dist/registry.d.ts.map +0 -1
  505. package/dist/registry.js +0 -98
  506. package/dist/registry.js.map +0 -1
  507. package/dist/render.d.ts +0 -117
  508. package/dist/render.d.ts.map +0 -1
  509. package/dist/render.js +0 -159
  510. package/dist/render.js.map +0 -1
  511. package/dist/types.d.ts +0 -6
  512. package/dist/types.d.ts.map +0 -1
  513. package/dist/types.js +0 -2
  514. package/dist/types.js.map +0 -1
  515. package/dist/use-property.d.ts +0 -29
  516. package/dist/use-property.d.ts.map +0 -1
  517. package/dist/use-property.js +0 -44
  518. package/dist/use-property.js.map +0 -1
  519. package/dist/use-setting.d.ts +0 -36
  520. package/dist/use-setting.d.ts.map +0 -1
  521. package/dist/use-setting.js +0 -68
  522. package/dist/use-setting.js.map +0 -1
  523. package/src/components/compound.tsx +0 -57
  524. package/src/components/list.tsx +0 -140
  525. package/src/components/slot-widget.tsx +0 -46
  526. package/src/errors.ts +0 -53
  527. package/src/factory.ts +0 -62
  528. package/src/generated/compounds.ts +0 -2741
  529. package/src/generated/internal.ts +0 -3642
  530. package/src/generated/jsx.ts +0 -17383
  531. package/src/generated/registry.ts +0 -17
  532. package/src/host-config.ts +0 -219
  533. package/src/jsx.ts +0 -1033
  534. package/src/metadata.ts +0 -43
  535. package/src/node.ts +0 -107
  536. package/src/nodes/adjustable.ts +0 -68
  537. package/src/nodes/alert-dialog-response.ts +0 -78
  538. package/src/nodes/alert-dialog.ts +0 -55
  539. package/src/nodes/animation.ts +0 -409
  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 -100
  545. package/src/nodes/dialog.ts +0 -25
  546. package/src/nodes/drawing-area.ts +0 -53
  547. package/src/nodes/event-controller.ts +0 -96
  548. package/src/nodes/fixed-child.ts +0 -122
  549. package/src/nodes/font-dialog-button.ts +0 -107
  550. package/src/nodes/grid-child.ts +0 -116
  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 -74
  559. package/src/nodes/level-bar.ts +0 -36
  560. package/src/nodes/list-item-node.ts +0 -53
  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 -130
  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/spin-row.ts +0 -72
  578. package/src/nodes/stack-page.ts +0 -170
  579. package/src/nodes/stack.ts +0 -35
  580. package/src/nodes/switch-row.ts +0 -26
  581. package/src/nodes/text-anchor.ts +0 -88
  582. package/src/nodes/text-content.ts +0 -14
  583. package/src/nodes/text-paintable.ts +0 -51
  584. package/src/nodes/text-segment.ts +0 -55
  585. package/src/nodes/text-tag.ts +0 -298
  586. package/src/nodes/text-view.ts +0 -100
  587. package/src/nodes/toggle-group.ts +0 -81
  588. package/src/nodes/toggle.ts +0 -72
  589. package/src/nodes/virtual.ts +0 -16
  590. package/src/nodes/web-view.ts +0 -22
  591. package/src/nodes/widget.ts +0 -369
  592. package/src/nodes/window.ts +0 -172
  593. package/src/portal.ts +0 -37
  594. package/src/reconciler.ts +0 -52
  595. package/src/registry.ts +0 -119
  596. package/src/render.tsx +0 -192
  597. package/src/types.ts +0 -13
  598. package/src/use-property.ts +0 -58
  599. package/src/use-setting.ts +0 -96
@@ -1,369 +0,0 @@
1
- import { getNativeObject, type NativeObject } from "@gtkx/ffi";
2
- import type * as GObject from "@gtkx/ffi/gobject";
3
- import {
4
- ObjectClass,
5
- ParamSpecString,
6
- Type,
7
- TypeInstance,
8
- typeClassRef,
9
- typeFromName,
10
- typeFundamental,
11
- typeNameFromInstance,
12
- } from "@gtkx/ffi/gobject";
13
- import * as Gtk from "@gtkx/ffi/gtk";
14
- import { isConstructOnlyProp, resolvePropMeta, resolveSignal } from "../metadata.js";
15
- import { Node } from "../node.js";
16
- import type { Container, Props } from "../types.js";
17
- import { applyAccessibleProps, isAccessibleProp } from "./internal/accessible.js";
18
- import { createContainerWithProperties } from "./internal/construct.js";
19
- import {
20
- type InsertableWidget,
21
- isAddable,
22
- isAppendable,
23
- isEditable,
24
- isInsertable,
25
- isRemovable,
26
- isReorderable,
27
- isSingleChild,
28
- type ReorderableWidget,
29
- } from "./internal/predicates.js";
30
- import { filterProps } from "./internal/props.js";
31
- import type { SignalHandler } from "./internal/signal-store.js";
32
- import { attachChild, detachChild } from "./internal/widget.js";
33
-
34
- const EXCLUDED_PROPS = ["children"];
35
-
36
- function findProperty(obj: NativeObject, key: string): GObject.ParamSpec | null {
37
- const propertyName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
38
- const typeInstance = getNativeObject(obj.handle, TypeInstance);
39
- const typeName = typeNameFromInstance(typeInstance);
40
- const gtype = typeFromName(typeName);
41
- const typeClass = typeClassRef(gtype);
42
- const objectClass = getNativeObject(typeClass.handle, ObjectClass);
43
- return objectClass.findProperty(propertyName) ?? null;
44
- }
45
-
46
- export class WidgetNode<
47
- T extends Gtk.Widget = Gtk.Widget,
48
- P extends Props = Props,
49
- // biome-ignore lint/suspicious/noExplicitAny: Self-referential type bounds require any
50
- TChild extends Node = any,
51
- TParent extends Node = Node,
52
- > extends Node<T, P, TParent, TChild> {
53
- public static override createContainer(
54
- props: Props,
55
- containerClass: typeof Gtk.Widget,
56
- _rootContainer?: Container,
57
- ): Container | null {
58
- return createContainerWithProperties(containerClass, props);
59
- }
60
-
61
- public override isValidChild(_child: Node): boolean {
62
- return true;
63
- }
64
-
65
- protected shouldAttachToParent(): boolean {
66
- return true;
67
- }
68
-
69
- public override appendChild(child: TChild): void {
70
- super.appendChild(child);
71
-
72
- if (child instanceof WidgetNode && child.shouldAttachToParent()) {
73
- this.appendWidgetChild(child);
74
- }
75
- }
76
-
77
- public override removeChild(child: TChild): void {
78
- if (child instanceof WidgetNode && child.shouldAttachToParent()) {
79
- if (this.isChildAutowrapped(child)) {
80
- const wrapper = child.container.getParent();
81
- if (wrapper && isSingleChild(wrapper)) {
82
- wrapper.setChild(null);
83
- if (isRemovable(this.container)) {
84
- this.container.remove(wrapper);
85
- }
86
- }
87
- } else {
88
- detachChild(child.container, this.container);
89
- }
90
- }
91
-
92
- super.removeChild(child);
93
- }
94
-
95
- public override insertBefore(child: TChild, before: TChild): void {
96
- super.insertBefore(child, before);
97
-
98
- if (!(child instanceof WidgetNode) || !child.shouldAttachToParent()) return;
99
-
100
- if (!(before instanceof WidgetNode)) {
101
- this.appendWidgetChild(child);
102
- return;
103
- }
104
-
105
- if (this.container instanceof Gtk.ListBox || this.container instanceof Gtk.FlowBox) {
106
- this.insertBeforeAutowrapping(child, before);
107
- } else if (isReorderable(this.container)) {
108
- this.insertBeforeReorderable(this.container, child, before);
109
- } else if (isInsertable(this.container)) {
110
- this.insertBeforeInsertable(this.container, child, before);
111
- } else {
112
- this.reinsertAllChildren();
113
- }
114
- }
115
-
116
- public override commitUpdate(oldProps: P | null, newProps: P): void {
117
- super.commitUpdate(oldProps, newProps);
118
-
119
- if (!this.container) {
120
- throw new Error(`Container is undefined for '${this.typeName}'`);
121
- }
122
-
123
- applyAccessibleProps(this.container, oldProps, newProps);
124
-
125
- const propNames = new Set([
126
- ...Object.keys(filterProps(oldProps ?? {}, EXCLUDED_PROPS)),
127
- ...Object.keys(filterProps(newProps ?? {}, EXCLUDED_PROPS)),
128
- ]);
129
-
130
- const pendingSignals: Array<{ name: string; newValue: unknown }> = [];
131
- const pendingProperties: Array<{ name: string; oldValue: unknown; newValue: unknown }> = [];
132
-
133
- for (const name of propNames) {
134
- if (isAccessibleProp(name)) continue;
135
- if (isConstructOnlyProp(this.container, name)) continue;
136
-
137
- const oldValue = oldProps?.[name];
138
- const newValue = newProps[name];
139
-
140
- if (oldValue === newValue) continue;
141
-
142
- const signalName = resolveSignal(this.container, name);
143
-
144
- if (signalName) {
145
- pendingSignals.push({ name, newValue });
146
- } else if (newValue !== undefined) {
147
- pendingProperties.push({ name, oldValue, newValue });
148
- } else if (oldValue !== undefined) {
149
- const defaultValue = this.getPropertyDefaultValue(name);
150
- if (defaultValue !== undefined) {
151
- pendingProperties.push({ name, oldValue, newValue: defaultValue });
152
- }
153
- }
154
- }
155
-
156
- for (const { name, newValue } of pendingSignals) {
157
- const signalName = resolveSignal(this.container, name);
158
- if (!signalName) continue;
159
- const handler = typeof newValue === "function" ? (newValue as SignalHandler) : undefined;
160
- this.signalStore.set(this, this.container, signalName, handler);
161
- }
162
-
163
- for (const { name, oldValue, newValue } of pendingProperties) {
164
- if (name === "text" && oldValue !== undefined && isEditable(this.container)) {
165
- if (oldValue !== this.container.getText()) {
166
- continue;
167
- }
168
- }
169
-
170
- this.setProperty(name, newValue);
171
- }
172
- }
173
-
174
- private appendWidgetChild(child: WidgetNode): void {
175
- if (isAppendable(this.container) || isAddable(this.container)) {
176
- if (this.isChildAutowrapped(child)) {
177
- this.detachAutowrappedChild(child);
178
- } else {
179
- detachChildFromParent(child);
180
- }
181
- }
182
- attachChild(child.container, this.container);
183
- }
184
-
185
- private isChildAutowrapped(child: WidgetNode): boolean {
186
- return (
187
- (this.container instanceof Gtk.ListBox || this.container instanceof Gtk.FlowBox) &&
188
- !(child.container instanceof Gtk.ListBoxRow || child.container instanceof Gtk.FlowBoxChild)
189
- );
190
- }
191
-
192
- private detachAutowrappedChild(child: WidgetNode): void {
193
- const wrapper = child.container.getParent();
194
- if (wrapper && isSingleChild(wrapper)) {
195
- wrapper.setChild(null);
196
- const wrapperParent = wrapper.getParent();
197
- if (wrapperParent && isRemovable(wrapperParent)) {
198
- wrapperParent.remove(wrapper);
199
- }
200
- }
201
- }
202
-
203
- private insertBeforeAutowrapping(child: WidgetNode, before: WidgetNode): void {
204
- const currentParent = child.container.getParent();
205
-
206
- if (currentParent !== null) {
207
- if (child.container instanceof Gtk.ListBoxRow || child.container instanceof Gtk.FlowBoxChild) {
208
- if (isRemovable(currentParent)) {
209
- currentParent.remove(child.container);
210
- }
211
- } else {
212
- this.detachAutowrappedChild(child);
213
- }
214
- } else if (!(child.container instanceof Gtk.ListBoxRow || child.container instanceof Gtk.FlowBoxChild)) {
215
- this.detachAutowrappedChild(child);
216
- }
217
-
218
- const container: Gtk.Widget = this.container;
219
- if (!(container instanceof Gtk.ListBox) && !(container instanceof Gtk.FlowBox)) return;
220
-
221
- const position = this.findAutowrappedPosition(before);
222
-
223
- if (position !== null) {
224
- container.insert(child.container, position);
225
- } else {
226
- container.append(child.container);
227
- }
228
- }
229
-
230
- private findAutowrappedPosition(before: WidgetNode): number | null {
231
- let position = 0;
232
- let currentChild = this.container.getFirstChild();
233
- const beforeIsRow = before.container instanceof Gtk.ListBoxRow || before.container instanceof Gtk.FlowBoxChild;
234
-
235
- while (currentChild) {
236
- const widgetToCompare = beforeIsRow ? currentChild : this.unwrapGtkChild(currentChild);
237
-
238
- if (widgetToCompare && widgetToCompare === before.container) {
239
- return position;
240
- }
241
-
242
- position++;
243
- currentChild = currentChild.getNextSibling();
244
- }
245
-
246
- return null;
247
- }
248
-
249
- private unwrapGtkChild(child: Gtk.Widget): Gtk.Widget | null {
250
- if ("getChild" in child && typeof child.getChild === "function") {
251
- return child.getChild() as Gtk.Widget | null;
252
- }
253
- return child;
254
- }
255
-
256
- private reinsertAllChildren(): void {
257
- const widgetChildren: WidgetNode[] = [];
258
- for (const child of this.children) {
259
- if (child instanceof WidgetNode && child.shouldAttachToParent()) {
260
- widgetChildren.push(child);
261
- }
262
- }
263
-
264
- for (const child of widgetChildren) {
265
- detachChild(child.container, this.container);
266
- }
267
-
268
- for (const child of widgetChildren) {
269
- attachChild(child.container, this.container);
270
- }
271
- }
272
-
273
- private getPropertyDefaultValue(key: string): unknown {
274
- if (!resolvePropMeta(this.container, key)) return undefined;
275
-
276
- const pspec = findProperty(this.container, key);
277
- if (!pspec) return undefined;
278
-
279
- const value = pspec.getDefaultValue();
280
- const gtype = value.getType();
281
- const fundamental = typeFundamental(gtype);
282
-
283
- if (fundamental === Type.BOOLEAN) return value.getBoolean();
284
- if (fundamental === Type.INT) return value.getInt();
285
- if (fundamental === Type.UINT) return value.getUint();
286
- if (fundamental === Type.LONG) return value.getLong();
287
- if (fundamental === Type.ULONG) return value.getUlong();
288
- if (fundamental === Type.INT64) return value.getInt64();
289
- if (fundamental === Type.UINT64) return value.getUint64();
290
- if (fundamental === Type.FLOAT) return value.getFloat();
291
- if (fundamental === Type.DOUBLE) return value.getDouble();
292
- if (fundamental === Type.STRING) return value.getString();
293
- if (fundamental === Type.ENUM) return value.getEnum();
294
- if (fundamental === Type.FLAGS) return value.getFlags();
295
-
296
- return undefined;
297
- }
298
-
299
- private setProperty(key: string, value: unknown): void {
300
- const propName = resolvePropMeta(this.container, key);
301
- if (!propName) return;
302
-
303
- const target = this.container as Record<string, unknown>;
304
-
305
- if (findProperty(this.container, key) instanceof ParamSpecString) {
306
- if (target[propName] === value) return;
307
- }
308
-
309
- target[propName] = value;
310
- }
311
-
312
- private insertBeforeReorderable(container: ReorderableWidget, child: WidgetNode, before: WidgetNode): void {
313
- const previousSibling = this.findPreviousSibling(before);
314
- const currentParent = child.container.getParent();
315
- const isChildOfThisContainer = currentParent && currentParent === container;
316
-
317
- if (isChildOfThisContainer) {
318
- container.reorderChildAfter(child.container, previousSibling);
319
- } else {
320
- detachChildFromParent(child);
321
- container.insertChildAfter(child.container, previousSibling);
322
- }
323
- }
324
-
325
- private insertBeforeInsertable(container: InsertableWidget, child: WidgetNode, before: WidgetNode): void {
326
- detachChildFromParent(child);
327
- const position = this.findInsertPosition(before);
328
- container.insert(child.container, position);
329
- }
330
-
331
- private findPreviousSibling(before: WidgetNode): Gtk.Widget | undefined {
332
- let beforeChild = this.container.getFirstChild();
333
-
334
- while (beforeChild) {
335
- if (beforeChild === before.container) {
336
- return beforeChild.getPrevSibling() ?? undefined;
337
- }
338
- beforeChild = beforeChild.getNextSibling();
339
- }
340
-
341
- throw new Error(`Cannot find 'before' sibling in '${this.typeName}'`);
342
- }
343
-
344
- private findInsertPosition(before: WidgetNode): number {
345
- let position = 0;
346
- let currentChild = this.container.getFirstChild();
347
-
348
- while (currentChild) {
349
- if (currentChild === before.container) {
350
- return position;
351
- }
352
- position++;
353
- currentChild = currentChild.getNextSibling();
354
- }
355
-
356
- throw new Error(`Cannot find 'before' child position in '${this.typeName}'`);
357
- }
358
- }
359
-
360
- function detachChildFromParent(child: WidgetNode): void {
361
- const currentParent = child.container.getParent();
362
- if (currentParent !== null) {
363
- if (isRemovable(currentParent)) {
364
- currentParent.remove(child.container);
365
- } else {
366
- child.container.unparent();
367
- }
368
- }
369
- }
@@ -1,172 +0,0 @@
1
- import * as Adw from "@gtkx/ffi/adw";
2
- import * as Gtk from "@gtkx/ffi/gtk";
3
- import type { GtkAboutDialogProps, GtkWindowProps } from "../jsx.js";
4
- import type { Node } from "../node.js";
5
- import type { Container, Props } from "../types.js";
6
- import { AnimationNode } from "./animation.js";
7
- import { ContainerSlotNode } from "./container-slot.js";
8
- import type { DialogNode } from "./dialog.js";
9
- import { EventControllerNode } from "./event-controller.js";
10
- import { filterProps, hasChanged } from "./internal/props.js";
11
- import { MenuNode } from "./menu.js";
12
- import { MenuModel } from "./models/menu.js";
13
- import { NavigationPageNode } from "./navigation-page.js";
14
- import { SlotNode } from "./slot.js";
15
- import { WidgetNode } from "./widget.js";
16
-
17
- // biome-ignore lint/suspicious/noExplicitAny: Required for matching GTK class constructors with varying signatures
18
- const isOrExtendsClass = (target: object, cls: abstract new (...args: any[]) => any): boolean =>
19
- target === cls || Object.prototype.isPrototypeOf.call(cls, target);
20
-
21
- const OWN_PROPS = ["onClose"] as const;
22
-
23
- type WindowProps = Pick<GtkWindowProps, "onClose"> & Pick<GtkAboutDialogProps, "creditSections">;
24
-
25
- type WindowChild =
26
- | WindowNode
27
- | DialogNode
28
- | MenuNode
29
- | SlotNode
30
- | ContainerSlotNode
31
- | AnimationNode
32
- | NavigationPageNode
33
- | EventControllerNode
34
- | WidgetNode;
35
-
36
- export class WindowNode extends WidgetNode<Gtk.Window, WindowProps, WindowChild> {
37
- private menu: MenuModel;
38
-
39
- public static override createContainer(
40
- props: Props,
41
- containerClass: typeof Gtk.Window,
42
- rootContainer: Container | undefined,
43
- ): Gtk.Window {
44
- const WindowClass = containerClass;
45
-
46
- if (
47
- isOrExtendsClass(WindowClass, Gtk.ApplicationWindow) ||
48
- isOrExtendsClass(WindowClass, Adw.ApplicationWindow)
49
- ) {
50
- if (!(rootContainer instanceof Gtk.Application)) {
51
- throw new Error("Expected ApplicationWindow to be created within Application");
52
- }
53
-
54
- if (isOrExtendsClass(WindowClass, Adw.ApplicationWindow)) {
55
- return new Adw.ApplicationWindow(rootContainer);
56
- }
57
-
58
- return new Gtk.ApplicationWindow(rootContainer);
59
- }
60
-
61
- return WidgetNode.createContainer(props, containerClass) as Gtk.Window;
62
- }
63
-
64
- constructor(typeName: string, props: WindowProps, container: Gtk.Window, rootContainer: Container) {
65
- super(typeName, props, container, rootContainer);
66
- const application = rootContainer instanceof Gtk.Application ? rootContainer : undefined;
67
- const actionMap = container instanceof Gtk.ApplicationWindow ? container : undefined;
68
- this.menu = new MenuModel("root", {}, rootContainer, actionMap, application);
69
-
70
- if (container instanceof Gtk.AboutDialog && props.creditSections) {
71
- for (const section of props.creditSections) {
72
- container.addCreditSection(section.name, section.people);
73
- }
74
- }
75
- }
76
-
77
- protected override shouldAttachToParent(): boolean {
78
- return false;
79
- }
80
-
81
- public override isValidChild(child: Node): boolean {
82
- return (
83
- child instanceof WidgetNode ||
84
- child instanceof MenuNode ||
85
- child instanceof SlotNode ||
86
- child instanceof AnimationNode ||
87
- child instanceof NavigationPageNode ||
88
- child instanceof EventControllerNode ||
89
- child instanceof ContainerSlotNode
90
- );
91
- }
92
-
93
- public override appendChild(child: WindowChild): void {
94
- if (child instanceof WindowNode) {
95
- child.container.setTransientFor(this.container);
96
- super.appendChild(child);
97
- return;
98
- }
99
-
100
- if (child instanceof MenuNode) {
101
- this.menu.appendChild(child);
102
- return;
103
- }
104
-
105
- super.appendChild(child);
106
- }
107
-
108
- public override removeChild(child: WindowChild): void {
109
- if (child instanceof WindowNode) {
110
- child.container.setVisible(false);
111
- child.container.setTransientFor(null);
112
- super.removeChild(child);
113
- return;
114
- }
115
-
116
- if (child instanceof MenuNode) {
117
- this.menu.removeChild(child);
118
- return;
119
- }
120
-
121
- super.removeChild(child);
122
- }
123
-
124
- public override insertBefore(child: WindowChild, before: WindowChild): void {
125
- if (child instanceof MenuNode) {
126
- if (before instanceof MenuNode) {
127
- this.menu.insertBefore(child, before);
128
- } else {
129
- this.menu.appendChild(child);
130
- }
131
- return;
132
- }
133
-
134
- if (child instanceof WindowNode) {
135
- child.container.setTransientFor(this.container);
136
- }
137
-
138
- super.insertBefore(child, before);
139
- }
140
-
141
- public override finalizeInitialChildren(props: WindowProps): boolean {
142
- this.commitUpdate(null, props);
143
- return true;
144
- }
145
-
146
- public override commitUpdate(oldProps: WindowProps | null, newProps: WindowProps): void {
147
- super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
148
- this.applyOwnProps(oldProps, newProps);
149
- }
150
-
151
- public override commitMount(): void {
152
- this.container.present();
153
- }
154
-
155
- public override detachDeletedInstance(): void {
156
- super.detachDeletedInstance();
157
- this.container.destroy();
158
- }
159
-
160
- private applyOwnProps(oldProps: WindowProps | null, newProps: WindowProps): void {
161
- if (hasChanged(oldProps, newProps, "onClose")) {
162
- const userHandler = newProps.onClose;
163
- const wrappedHandler = userHandler
164
- ? () => {
165
- userHandler();
166
- return true;
167
- }
168
- : undefined;
169
- this.signalStore.set(this, this.container, "close-request", wrappedHandler);
170
- }
171
- }
172
- }
package/src/portal.ts DELETED
@@ -1,37 +0,0 @@
1
- import type { ReactNode, ReactPortal } from "react";
2
- import type { Container } from "./types.js";
3
-
4
- /**
5
- * Creates a React portal for rendering children into a different part of the widget tree.
6
- *
7
- * Portals are useful for rendering dialogs, tooltips, or other floating content
8
- * that should visually appear outside its parent component's boundaries.
9
- *
10
- * @param children - The React elements to render in the portal
11
- * @param container - The target container widget to render into
12
- * @param key - Optional key for the portal element
13
- * @returns A ReactPortal element
14
- *
15
- * @example
16
- * ```tsx
17
- * import { createPortal } from "@gtkx/react";
18
- *
19
- * const Modal = ({ container, children }) => {
20
- * return createPortal(
21
- * <GtkWindow modal>
22
- * {children}
23
- * </GtkWindow>,
24
- * container
25
- * );
26
- * };
27
- * ```
28
- */
29
- export const createPortal = (children: ReactNode, container: Container, key?: string | null): ReactPortal => {
30
- return {
31
- $$typeof: Symbol.for("react.portal"),
32
- key: key ?? null,
33
- children,
34
- containerInfo: container,
35
- implementation: null,
36
- } as unknown as ReactPortal;
37
- };
package/src/reconciler.ts DELETED
@@ -1,52 +0,0 @@
1
- import ReactReconciler from "react-reconciler";
2
- import packageJson from "../package.json" with { type: "json" };
3
- import { createHostConfig, type ReconcilerInstance } from "./host-config.js";
4
-
5
- /**
6
- * Manages the React reconciler instance for GTKX.
7
- *
8
- * This class wraps the React Reconciler and handles initialization
9
- * including DevTools integration for development environments.
10
- *
11
- * @internal
12
- */
13
- class Reconciler {
14
- private instance: ReconcilerInstance;
15
-
16
- constructor() {
17
- this.instance = ReactReconciler(createHostConfig());
18
- this.injectDevTools();
19
- }
20
-
21
- /**
22
- * Returns the underlying React Reconciler instance.
23
- *
24
- * @returns The React Reconciler instance for direct reconciler operations
25
- */
26
- getInstance(): ReconcilerInstance {
27
- return this.instance;
28
- }
29
-
30
- private injectDevTools(): void {
31
- if (process.env.NODE_ENV === "production") return;
32
-
33
- this.instance.injectIntoDevTools({
34
- bundleType: 1,
35
- version: packageJson.version,
36
- rendererPackageName: "@gtkx/react",
37
- });
38
- }
39
- }
40
-
41
- /**
42
- * The GTKX React reconciler instance.
43
- *
44
- * Provides low-level access to the React reconciler for advanced use cases.
45
- * Most applications should use {@link render} instead.
46
- *
47
- * @example
48
- * ```tsx
49
- * const instance = reconciler.getInstance();
50
- * ```
51
- */
52
- export const reconciler = new Reconciler();