@gtkx/react 0.21.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/README.md +137 -34
  2. package/dist/components/application.d.ts +10 -0
  3. package/dist/components/application.d.ts.map +1 -0
  4. package/dist/components/application.js +26 -0
  5. package/dist/components/application.js.map +1 -0
  6. package/dist/components/window.d.ts +8 -0
  7. package/dist/components/window.d.ts.map +1 -0
  8. package/dist/components/window.js +23 -0
  9. package/dist/components/window.js.map +1 -0
  10. package/dist/hooks/use-application.d.ts +8 -0
  11. package/dist/hooks/use-application.d.ts.map +1 -0
  12. package/dist/hooks/use-application.js +13 -0
  13. package/dist/hooks/use-application.js.map +1 -0
  14. package/dist/hooks/use-bind-setting.d.ts +6 -0
  15. package/dist/hooks/use-bind-setting.d.ts.map +1 -0
  16. package/dist/hooks/use-bind-setting.js +19 -0
  17. package/dist/hooks/use-bind-setting.js.map +1 -0
  18. package/dist/hooks/use-merge-refs.d.ts +3 -0
  19. package/dist/hooks/use-merge-refs.d.ts.map +1 -0
  20. package/dist/hooks/use-merge-refs.js +48 -0
  21. package/dist/hooks/use-merge-refs.js.map +1 -0
  22. package/dist/hooks/use-object-attachment.d.ts +10 -0
  23. package/dist/hooks/use-object-attachment.d.ts.map +1 -0
  24. package/dist/hooks/use-object-attachment.js +24 -0
  25. package/dist/hooks/use-object-attachment.js.map +1 -0
  26. package/dist/hooks/use-object-value.d.ts +4 -0
  27. package/dist/hooks/use-object-value.d.ts.map +1 -0
  28. package/dist/hooks/use-object-value.js +32 -0
  29. package/dist/hooks/use-object-value.js.map +1 -0
  30. package/dist/hooks/use-parent-window.d.ts +8 -0
  31. package/dist/hooks/use-parent-window.d.ts.map +1 -0
  32. package/dist/hooks/use-parent-window.js +7 -0
  33. package/dist/hooks/use-parent-window.js.map +1 -0
  34. package/dist/hooks/use-property.d.ts +14 -0
  35. package/dist/hooks/use-property.d.ts.map +1 -0
  36. package/dist/hooks/use-property.js +13 -0
  37. package/dist/hooks/use-property.js.map +1 -0
  38. package/dist/hooks/use-setting.d.ts +25 -0
  39. package/dist/hooks/use-setting.d.ts.map +1 -0
  40. package/dist/hooks/use-setting.js +15 -0
  41. package/dist/hooks/use-setting.js.map +1 -0
  42. package/dist/hooks/use-signal.d.ts +21 -0
  43. package/dist/hooks/use-signal.d.ts.map +1 -0
  44. package/dist/hooks/use-signal.js +20 -0
  45. package/dist/hooks/use-signal.js.map +1 -0
  46. package/dist/index.d.ts +14 -7
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +10 -7
  49. package/dist/index.js.map +1 -1
  50. package/dist/internal.d.ts +14 -0
  51. package/dist/internal.d.ts.map +1 -0
  52. package/dist/internal.js +14 -0
  53. package/dist/internal.js.map +1 -0
  54. package/dist/libraries/adw/dialog.d.ts +8 -0
  55. package/dist/libraries/adw/dialog.d.ts.map +1 -0
  56. package/dist/libraries/adw/dialog.js +25 -0
  57. package/dist/libraries/adw/dialog.js.map +1 -0
  58. package/dist/libraries/adw/index.d.ts +2 -0
  59. package/dist/libraries/adw/index.d.ts.map +1 -0
  60. package/dist/libraries/adw/index.js +2 -0
  61. package/dist/libraries/adw/index.js.map +1 -0
  62. package/dist/reconciler/accessible.d.ts +59 -0
  63. package/dist/reconciler/accessible.d.ts.map +1 -0
  64. package/dist/reconciler/accessible.js +143 -0
  65. package/dist/reconciler/accessible.js.map +1 -0
  66. package/dist/reconciler/apply-props.d.ts +8 -0
  67. package/dist/reconciler/apply-props.d.ts.map +1 -0
  68. package/dist/reconciler/apply-props.js +92 -0
  69. package/dist/reconciler/apply-props.js.map +1 -0
  70. package/dist/reconciler/commit-flush.d.ts +3 -0
  71. package/dist/reconciler/commit-flush.d.ts.map +1 -0
  72. package/dist/reconciler/commit-flush.js +13 -0
  73. package/dist/reconciler/commit-flush.js.map +1 -0
  74. package/dist/reconciler/container-attach.d.ts +10 -0
  75. package/dist/reconciler/container-attach.d.ts.map +1 -0
  76. package/dist/reconciler/container-attach.js +216 -0
  77. package/dist/reconciler/container-attach.js.map +1 -0
  78. package/dist/reconciler/content-rebuild.d.ts +3 -0
  79. package/dist/reconciler/content-rebuild.d.ts.map +1 -0
  80. package/dist/reconciler/content-rebuild.js +15 -0
  81. package/dist/reconciler/content-rebuild.js.map +1 -0
  82. package/dist/reconciler/dispatch.d.ts +6 -0
  83. package/dist/reconciler/dispatch.d.ts.map +1 -0
  84. package/dist/reconciler/dispatch.js +61 -0
  85. package/dist/reconciler/dispatch.js.map +1 -0
  86. package/dist/reconciler/element-prop-appliers.d.ts +5 -0
  87. package/dist/reconciler/element-prop-appliers.d.ts.map +1 -0
  88. package/dist/reconciler/element-prop-appliers.js +104 -0
  89. package/dist/reconciler/element-prop-appliers.js.map +1 -0
  90. package/dist/reconciler/element-props.d.ts +25 -0
  91. package/dist/reconciler/element-props.d.ts.map +1 -0
  92. package/dist/reconciler/element-props.js +157 -0
  93. package/dist/reconciler/element-props.js.map +1 -0
  94. package/dist/reconciler/host-config.d.ts +13 -0
  95. package/dist/reconciler/host-config.d.ts.map +1 -0
  96. package/dist/reconciler/host-config.js +309 -0
  97. package/dist/reconciler/host-config.js.map +1 -0
  98. package/dist/reconciler/instance.d.ts +6 -0
  99. package/dist/reconciler/instance.d.ts.map +1 -0
  100. package/dist/reconciler/instance.js +27 -0
  101. package/dist/reconciler/instance.js.map +1 -0
  102. package/dist/reconciler/label-text-rebuild.d.ts +3 -0
  103. package/dist/reconciler/label-text-rebuild.d.ts.map +1 -0
  104. package/dist/reconciler/label-text-rebuild.js +22 -0
  105. package/dist/reconciler/label-text-rebuild.js.map +1 -0
  106. package/dist/reconciler/portal.d.ts +11 -0
  107. package/dist/reconciler/portal.d.ts.map +1 -0
  108. package/dist/reconciler/portal.js +20 -0
  109. package/dist/reconciler/portal.js.map +1 -0
  110. package/dist/reconciler/reconciler-error-handler.d.ts +7 -0
  111. package/dist/reconciler/reconciler-error-handler.d.ts.map +1 -0
  112. package/dist/reconciler/reconciler-error-handler.js +24 -0
  113. package/dist/reconciler/reconciler-error-handler.js.map +1 -0
  114. package/dist/reconciler/reconciler-root.d.ts +19 -0
  115. package/dist/reconciler/reconciler-root.d.ts.map +1 -0
  116. package/dist/reconciler/reconciler-root.js +24 -0
  117. package/dist/reconciler/reconciler-root.js.map +1 -0
  118. package/dist/reconciler/reconciler.d.ts +3 -0
  119. package/dist/reconciler/reconciler.d.ts.map +1 -0
  120. package/dist/reconciler/reconciler.js +12 -0
  121. package/dist/reconciler/reconciler.js.map +1 -0
  122. package/dist/reconciler/render.d.ts +23 -0
  123. package/dist/reconciler/render.d.ts.map +1 -0
  124. package/dist/reconciler/render.js +46 -0
  125. package/dist/reconciler/render.js.map +1 -0
  126. package/dist/reconciler/root-element.d.ts +14 -0
  127. package/dist/reconciler/root-element.d.ts.map +1 -0
  128. package/dist/reconciler/root-element.js +7 -0
  129. package/dist/reconciler/root-element.js.map +1 -0
  130. package/dist/reconciler/signal-store.d.ts +22 -0
  131. package/dist/reconciler/signal-store.d.ts.map +1 -0
  132. package/dist/reconciler/signal-store.js +84 -0
  133. package/dist/reconciler/signal-store.js.map +1 -0
  134. package/dist/reconciler/state.d.ts +36 -0
  135. package/dist/reconciler/state.d.ts.map +1 -0
  136. package/dist/reconciler/state.js +38 -0
  137. package/dist/reconciler/state.js.map +1 -0
  138. package/dist/reconciler/text-buffer-controller.d.ts +17 -0
  139. package/dist/reconciler/text-buffer-controller.d.ts.map +1 -0
  140. package/dist/reconciler/text-buffer-controller.js +102 -0
  141. package/dist/reconciler/text-buffer-controller.js.map +1 -0
  142. package/dist/reconciler/text-buffer-rebuild.d.ts +3 -0
  143. package/dist/reconciler/text-buffer-rebuild.d.ts.map +1 -0
  144. package/dist/reconciler/text-buffer-rebuild.js +7 -0
  145. package/dist/reconciler/text-buffer-rebuild.js.map +1 -0
  146. package/dist/reconciler/text-node.d.ts +7 -0
  147. package/dist/reconciler/text-node.d.ts.map +1 -0
  148. package/dist/reconciler/text-node.js +8 -0
  149. package/dist/reconciler/text-node.js.map +1 -0
  150. package/dist/reconciler/types.d.ts +5 -0
  151. package/dist/reconciler/types.d.ts.map +1 -0
  152. package/dist/reconciler/types.js.map +1 -0
  153. package/dist/reconciler/visibility.d.ts +6 -0
  154. package/dist/reconciler/visibility.d.ts.map +1 -0
  155. package/dist/reconciler/visibility.js +57 -0
  156. package/dist/reconciler/visibility.js.map +1 -0
  157. package/dist/reconciler/wrapper-apply.d.ts +6 -0
  158. package/dist/reconciler/wrapper-apply.d.ts.map +1 -0
  159. package/dist/reconciler/wrapper-apply.js +287 -0
  160. package/dist/reconciler/wrapper-apply.js.map +1 -0
  161. package/dist/reconciler/wrapper-content.d.ts +8 -0
  162. package/dist/reconciler/wrapper-content.d.ts.map +1 -0
  163. package/dist/reconciler/wrapper-content.js +19 -0
  164. package/dist/reconciler/wrapper-content.js.map +1 -0
  165. package/dist/reconciler/wrapper-node.d.ts +8 -0
  166. package/dist/reconciler/wrapper-node.d.ts.map +1 -0
  167. package/dist/reconciler/wrapper-node.js +4 -0
  168. package/dist/reconciler/wrapper-node.js.map +1 -0
  169. package/dist/reconciler/wrapper-protocol.d.ts +13 -0
  170. package/dist/reconciler/wrapper-protocol.d.ts.map +1 -0
  171. package/dist/reconciler/wrapper-protocol.js +20 -0
  172. package/dist/reconciler/wrapper-protocol.js.map +1 -0
  173. package/dist/utils/accessible-metadata.d.ts +5 -0
  174. package/dist/utils/accessible-metadata.d.ts.map +1 -0
  175. package/dist/utils/accessible-metadata.js +22 -0
  176. package/dist/utils/accessible-metadata.js.map +1 -0
  177. package/dist/utils/create-element-component.d.ts +4 -0
  178. package/dist/utils/create-element-component.d.ts.map +1 -0
  179. package/dist/utils/create-element-component.js +54 -0
  180. package/dist/utils/create-element-component.js.map +1 -0
  181. package/dist/utils/gtype.d.ts +16 -0
  182. package/dist/utils/gtype.d.ts.map +1 -0
  183. package/dist/utils/gtype.js +127 -0
  184. package/dist/utils/gtype.js.map +1 -0
  185. package/dist/utils/notify-name.d.ts +5 -0
  186. package/dist/utils/notify-name.d.ts.map +1 -0
  187. package/dist/utils/notify-name.js +6 -0
  188. package/dist/utils/notify-name.js.map +1 -0
  189. package/dist/utils/object-prop.d.ts +8 -0
  190. package/dist/utils/object-prop.d.ts.map +1 -0
  191. package/dist/utils/object-prop.js +9 -0
  192. package/dist/utils/object-prop.js.map +1 -0
  193. package/dist/utils/settings-accessor.d.ts +8 -0
  194. package/dist/utils/settings-accessor.d.ts.map +1 -0
  195. package/dist/utils/settings-accessor.js +69 -0
  196. package/dist/utils/settings-accessor.js.map +1 -0
  197. package/dist/utils/wrapper-node-jsx.d.ts +32 -0
  198. package/dist/utils/wrapper-node-jsx.d.ts.map +1 -0
  199. package/dist/utils/wrapper-node-jsx.js +2 -0
  200. package/dist/utils/wrapper-node-jsx.js.map +1 -0
  201. package/package.json +22 -8
  202. package/src/components/application.tsx +43 -0
  203. package/src/components/window.tsx +36 -0
  204. package/src/hooks/use-application.ts +17 -0
  205. package/src/hooks/use-bind-setting.ts +35 -0
  206. package/src/hooks/use-merge-refs.ts +53 -0
  207. package/src/hooks/use-object-attachment.ts +35 -0
  208. package/src/hooks/use-object-value.ts +50 -0
  209. package/src/hooks/use-parent-window.ts +9 -0
  210. package/src/hooks/use-property.ts +22 -0
  211. package/src/hooks/use-setting.ts +47 -0
  212. package/src/hooks/use-signal.ts +71 -0
  213. package/src/index.ts +15 -14
  214. package/src/internal.ts +24 -0
  215. package/src/libraries/adw/dialog.tsx +34 -0
  216. package/src/libraries/adw/index.ts +1 -0
  217. package/src/reconciler/accessible.ts +232 -0
  218. package/src/reconciler/apply-props.ts +117 -0
  219. package/src/reconciler/commit-flush.ts +13 -0
  220. package/src/reconciler/container-attach.ts +219 -0
  221. package/src/reconciler/content-rebuild.ts +19 -0
  222. package/src/reconciler/dispatch.ts +58 -0
  223. package/src/reconciler/element-prop-appliers.ts +110 -0
  224. package/src/reconciler/element-props.ts +192 -0
  225. package/src/reconciler/host-config.ts +405 -0
  226. package/src/reconciler/instance.ts +30 -0
  227. package/src/reconciler/label-text-rebuild.ts +26 -0
  228. package/src/reconciler/portal.ts +28 -0
  229. package/src/reconciler/reconciler-error-handler.ts +29 -0
  230. package/src/reconciler/reconciler-root.ts +57 -0
  231. package/src/reconciler/reconciler.ts +13 -0
  232. package/src/reconciler/render.ts +61 -0
  233. package/src/reconciler/root-element.ts +14 -0
  234. package/src/reconciler/signal-store.ts +103 -0
  235. package/src/reconciler/state.ts +72 -0
  236. package/src/reconciler/text-buffer-controller.ts +107 -0
  237. package/src/reconciler/text-buffer-rebuild.ts +12 -0
  238. package/src/reconciler/text-node.ts +13 -0
  239. package/src/reconciler/types.ts +6 -0
  240. package/src/reconciler/visibility.ts +52 -0
  241. package/src/reconciler/wrapper-apply.ts +308 -0
  242. package/src/reconciler/wrapper-content.ts +24 -0
  243. package/src/reconciler/wrapper-node.ts +8 -0
  244. package/src/reconciler/wrapper-protocol.ts +32 -0
  245. package/src/utils/accessible-metadata.ts +26 -0
  246. package/src/utils/create-element-component.ts +77 -0
  247. package/src/utils/gtype.ts +166 -0
  248. package/src/utils/notify-name.ts +10 -0
  249. package/src/utils/object-prop.ts +13 -0
  250. package/src/utils/settings-accessor.ts +89 -0
  251. package/src/utils/wrapper-node-jsx.ts +34 -0
  252. package/dist/components/compound.d.ts +0 -40
  253. package/dist/components/compound.d.ts.map +0 -1
  254. package/dist/components/compound.js +0 -46
  255. package/dist/components/compound.js.map +0 -1
  256. package/dist/components/list.d.ts +0 -75
  257. package/dist/components/list.d.ts.map +0 -1
  258. package/dist/components/list.js +0 -81
  259. package/dist/components/list.js.map +0 -1
  260. package/dist/components/slot-widget.d.ts +0 -15
  261. package/dist/components/slot-widget.d.ts.map +0 -1
  262. package/dist/components/slot-widget.js +0 -37
  263. package/dist/components/slot-widget.js.map +0 -1
  264. package/dist/errors.d.ts +0 -15
  265. package/dist/errors.d.ts.map +0 -1
  266. package/dist/errors.js +0 -44
  267. package/dist/errors.js.map +0 -1
  268. package/dist/factory.d.ts +0 -5
  269. package/dist/factory.d.ts.map +0 -1
  270. package/dist/factory.js +0 -37
  271. package/dist/factory.js.map +0 -1
  272. package/dist/generated/compounds.d.ts +0 -2672
  273. package/dist/generated/compounds.d.ts.map +0 -1
  274. package/dist/generated/compounds.js +0 -2624
  275. package/dist/generated/compounds.js.map +0 -1
  276. package/dist/generated/internal.d.ts +0 -16
  277. package/dist/generated/internal.d.ts.map +0 -1
  278. package/dist/generated/internal.js +0 -3638
  279. package/dist/generated/internal.js.map +0 -1
  280. package/dist/generated/jsx.d.ts +0 -17074
  281. package/dist/generated/jsx.d.ts.map +0 -1
  282. package/dist/generated/jsx.js +0 -6715
  283. package/dist/generated/jsx.js.map +0 -1
  284. package/dist/generated/registry.d.ts +0 -5
  285. package/dist/generated/registry.d.ts.map +0 -1
  286. package/dist/generated/registry.js +0 -13
  287. package/dist/generated/registry.js.map +0 -1
  288. package/dist/host-config.d.ts +0 -24
  289. package/dist/host-config.d.ts.map +0 -1
  290. package/dist/host-config.js +0 -172
  291. package/dist/host-config.js.map +0 -1
  292. package/dist/jsx.d.ts +0 -974
  293. package/dist/jsx.d.ts.map +0 -1
  294. package/dist/jsx.js +0 -8
  295. package/dist/jsx.js.map +0 -1
  296. package/dist/metadata.d.ts +0 -5
  297. package/dist/metadata.d.ts.map +0 -1
  298. package/dist/metadata.js +0 -33
  299. package/dist/metadata.js.map +0 -1
  300. package/dist/node.d.ts +0 -25
  301. package/dist/node.d.ts.map +0 -1
  302. package/dist/node.js +0 -85
  303. package/dist/node.js.map +0 -1
  304. package/dist/nodes/adjustable.d.ts +0 -11
  305. package/dist/nodes/adjustable.d.ts.map +0 -1
  306. package/dist/nodes/adjustable.js +0 -46
  307. package/dist/nodes/adjustable.js.map +0 -1
  308. package/dist/nodes/alert-dialog-response.d.ts +0 -15
  309. package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
  310. package/dist/nodes/alert-dialog-response.js +0 -61
  311. package/dist/nodes/alert-dialog-response.js.map +0 -1
  312. package/dist/nodes/alert-dialog.d.ts +0 -14
  313. package/dist/nodes/alert-dialog.d.ts.map +0 -1
  314. package/dist/nodes/alert-dialog.js +0 -41
  315. package/dist/nodes/alert-dialog.js.map +0 -1
  316. package/dist/nodes/animation.d.ts +0 -39
  317. package/dist/nodes/animation.d.ts.map +0 -1
  318. package/dist/nodes/animation.js +0 -326
  319. package/dist/nodes/animation.js.map +0 -1
  320. package/dist/nodes/application.d.ts +0 -12
  321. package/dist/nodes/application.d.ts.map +0 -1
  322. package/dist/nodes/application.js +0 -51
  323. package/dist/nodes/application.js.map +0 -1
  324. package/dist/nodes/calendar.d.ts +0 -18
  325. package/dist/nodes/calendar.d.ts.map +0 -1
  326. package/dist/nodes/calendar.js +0 -28
  327. package/dist/nodes/calendar.js.map +0 -1
  328. package/dist/nodes/color-dialog-button.d.ts +0 -15
  329. package/dist/nodes/color-dialog-button.d.ts.map +0 -1
  330. package/dist/nodes/color-dialog-button.js +0 -43
  331. package/dist/nodes/color-dialog-button.js.map +0 -1
  332. package/dist/nodes/column-view-column.d.ts +0 -36
  333. package/dist/nodes/column-view-column.d.ts.map +0 -1
  334. package/dist/nodes/column-view-column.js +0 -168
  335. package/dist/nodes/column-view-column.js.map +0 -1
  336. package/dist/nodes/container-slot.d.ts +0 -18
  337. package/dist/nodes/container-slot.d.ts.map +0 -1
  338. package/dist/nodes/container-slot.js +0 -81
  339. package/dist/nodes/container-slot.js.map +0 -1
  340. package/dist/nodes/dialog.d.ts +0 -10
  341. package/dist/nodes/dialog.d.ts.map +0 -1
  342. package/dist/nodes/dialog.js +0 -20
  343. package/dist/nodes/dialog.js.map +0 -1
  344. package/dist/nodes/drawing-area.d.ts +0 -19
  345. package/dist/nodes/drawing-area.d.ts.map +0 -1
  346. package/dist/nodes/drawing-area.js +0 -40
  347. package/dist/nodes/drawing-area.js.map +0 -1
  348. package/dist/nodes/event-controller.d.ts +0 -15
  349. package/dist/nodes/event-controller.d.ts.map +0 -1
  350. package/dist/nodes/event-controller.js +0 -73
  351. package/dist/nodes/event-controller.js.map +0 -1
  352. package/dist/nodes/fixed-child.d.ts +0 -19
  353. package/dist/nodes/fixed-child.d.ts.map +0 -1
  354. package/dist/nodes/fixed-child.js +0 -99
  355. package/dist/nodes/fixed-child.js.map +0 -1
  356. package/dist/nodes/font-dialog-button.d.ts +0 -15
  357. package/dist/nodes/font-dialog-button.d.ts.map +0 -1
  358. package/dist/nodes/font-dialog-button.js +0 -76
  359. package/dist/nodes/font-dialog-button.js.map +0 -1
  360. package/dist/nodes/grid-child.d.ts +0 -19
  361. package/dist/nodes/grid-child.d.ts.map +0 -1
  362. package/dist/nodes/grid-child.js +0 -94
  363. package/dist/nodes/grid-child.js.map +0 -1
  364. package/dist/nodes/internal/accessible.d.ts +0 -5
  365. package/dist/nodes/internal/accessible.d.ts.map +0 -1
  366. package/dist/nodes/internal/accessible.js +0 -119
  367. package/dist/nodes/internal/accessible.js.map +0 -1
  368. package/dist/nodes/internal/bound-item.d.ts +0 -4
  369. package/dist/nodes/internal/bound-item.d.ts.map +0 -1
  370. package/dist/nodes/internal/bound-item.js +0 -2
  371. package/dist/nodes/internal/bound-item.js.map +0 -1
  372. package/dist/nodes/internal/construct.d.ts +0 -3
  373. package/dist/nodes/internal/construct.d.ts.map +0 -1
  374. package/dist/nodes/internal/construct.js +0 -44
  375. package/dist/nodes/internal/construct.js.map +0 -1
  376. package/dist/nodes/internal/predicates.d.ts +0 -51
  377. package/dist/nodes/internal/predicates.d.ts.map +0 -1
  378. package/dist/nodes/internal/predicates.js +0 -36
  379. package/dist/nodes/internal/predicates.js.map +0 -1
  380. package/dist/nodes/internal/props.d.ts +0 -6
  381. package/dist/nodes/internal/props.d.ts.map +0 -1
  382. package/dist/nodes/internal/props.js +0 -43
  383. package/dist/nodes/internal/props.js.map +0 -1
  384. package/dist/nodes/internal/signal-store.d.ts +0 -22
  385. package/dist/nodes/internal/signal-store.d.ts.map +0 -1
  386. package/dist/nodes/internal/signal-store.js +0 -98
  387. package/dist/nodes/internal/signal-store.js.map +0 -1
  388. package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
  389. package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
  390. package/dist/nodes/internal/text-buffer-controller.js +0 -327
  391. package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
  392. package/dist/nodes/internal/widget.d.ts +0 -8
  393. package/dist/nodes/internal/widget.d.ts.map +0 -1
  394. package/dist/nodes/internal/widget.js +0 -68
  395. package/dist/nodes/internal/widget.js.map +0 -1
  396. package/dist/nodes/level-bar.d.ts +0 -12
  397. package/dist/nodes/level-bar.d.ts.map +0 -1
  398. package/dist/nodes/level-bar.js +0 -24
  399. package/dist/nodes/level-bar.js.map +0 -1
  400. package/dist/nodes/list-item-node.d.ts +0 -12
  401. package/dist/nodes/list-item-node.d.ts.map +0 -1
  402. package/dist/nodes/list-item-node.js +0 -45
  403. package/dist/nodes/list-item-node.js.map +0 -1
  404. package/dist/nodes/list.d.ts +0 -100
  405. package/dist/nodes/list.d.ts.map +0 -1
  406. package/dist/nodes/list.js +0 -950
  407. package/dist/nodes/list.js.map +0 -1
  408. package/dist/nodes/menu.d.ts +0 -7
  409. package/dist/nodes/menu.d.ts.map +0 -1
  410. package/dist/nodes/menu.js +0 -20
  411. package/dist/nodes/menu.js.map +0 -1
  412. package/dist/nodes/models/menu.d.ts +0 -47
  413. package/dist/nodes/models/menu.d.ts.map +0 -1
  414. package/dist/nodes/models/menu.js +0 -240
  415. package/dist/nodes/models/menu.js.map +0 -1
  416. package/dist/nodes/navigation-page.d.ts +0 -19
  417. package/dist/nodes/navigation-page.d.ts.map +0 -1
  418. package/dist/nodes/navigation-page.js +0 -129
  419. package/dist/nodes/navigation-page.js.map +0 -1
  420. package/dist/nodes/navigation-view.d.ts +0 -19
  421. package/dist/nodes/navigation-view.d.ts.map +0 -1
  422. package/dist/nodes/navigation-view.js +0 -51
  423. package/dist/nodes/navigation-view.js.map +0 -1
  424. package/dist/nodes/notebook-page-tab.d.ts +0 -15
  425. package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
  426. package/dist/nodes/notebook-page-tab.js +0 -40
  427. package/dist/nodes/notebook-page-tab.js.map +0 -1
  428. package/dist/nodes/notebook-page.d.ts +0 -29
  429. package/dist/nodes/notebook-page.d.ts.map +0 -1
  430. package/dist/nodes/notebook-page.js +0 -151
  431. package/dist/nodes/notebook-page.js.map +0 -1
  432. package/dist/nodes/notebook.d.ts +0 -16
  433. package/dist/nodes/notebook.d.ts.map +0 -1
  434. package/dist/nodes/notebook.js +0 -31
  435. package/dist/nodes/notebook.js.map +0 -1
  436. package/dist/nodes/overlay-child.d.ts +0 -20
  437. package/dist/nodes/overlay-child.d.ts.map +0 -1
  438. package/dist/nodes/overlay-child.js +0 -109
  439. package/dist/nodes/overlay-child.js.map +0 -1
  440. package/dist/nodes/popover-menu.d.ts +0 -19
  441. package/dist/nodes/popover-menu.d.ts.map +0 -1
  442. package/dist/nodes/popover-menu.js +0 -54
  443. package/dist/nodes/popover-menu.js.map +0 -1
  444. package/dist/nodes/scale.d.ts +0 -10
  445. package/dist/nodes/scale.d.ts.map +0 -1
  446. package/dist/nodes/scale.js +0 -19
  447. package/dist/nodes/scale.js.map +0 -1
  448. package/dist/nodes/scrolled-window.d.ts +0 -11
  449. package/dist/nodes/scrolled-window.d.ts.map +0 -1
  450. package/dist/nodes/scrolled-window.js +0 -18
  451. package/dist/nodes/scrolled-window.js.map +0 -1
  452. package/dist/nodes/search-bar.d.ts +0 -11
  453. package/dist/nodes/search-bar.d.ts.map +0 -1
  454. package/dist/nodes/search-bar.js +0 -16
  455. package/dist/nodes/search-bar.js.map +0 -1
  456. package/dist/nodes/shortcut.d.ts +0 -19
  457. package/dist/nodes/shortcut.d.ts.map +0 -1
  458. package/dist/nodes/shortcut.js +0 -72
  459. package/dist/nodes/shortcut.js.map +0 -1
  460. package/dist/nodes/slot.d.ts +0 -21
  461. package/dist/nodes/slot.d.ts.map +0 -1
  462. package/dist/nodes/slot.js +0 -102
  463. package/dist/nodes/slot.js.map +0 -1
  464. package/dist/nodes/source-view.d.ts +0 -18
  465. package/dist/nodes/source-view.d.ts.map +0 -1
  466. package/dist/nodes/source-view.js +0 -94
  467. package/dist/nodes/source-view.js.map +0 -1
  468. package/dist/nodes/spin-row.d.ts +0 -14
  469. package/dist/nodes/spin-row.d.ts.map +0 -1
  470. package/dist/nodes/spin-row.js +0 -46
  471. package/dist/nodes/spin-row.js.map +0 -1
  472. package/dist/nodes/stack-page.d.ts +0 -22
  473. package/dist/nodes/stack-page.d.ts.map +0 -1
  474. package/dist/nodes/stack-page.js +0 -140
  475. package/dist/nodes/stack-page.js.map +0 -1
  476. package/dist/nodes/stack.d.ts +0 -13
  477. package/dist/nodes/stack.d.ts.map +0 -1
  478. package/dist/nodes/stack.js +0 -21
  479. package/dist/nodes/stack.js.map +0 -1
  480. package/dist/nodes/switch-row.d.ts +0 -11
  481. package/dist/nodes/switch-row.d.ts.map +0 -1
  482. package/dist/nodes/switch-row.js +0 -15
  483. package/dist/nodes/switch-row.js.map +0 -1
  484. package/dist/nodes/text-anchor.d.ts +0 -23
  485. package/dist/nodes/text-anchor.d.ts.map +0 -1
  486. package/dist/nodes/text-anchor.js +0 -74
  487. package/dist/nodes/text-anchor.js.map +0 -1
  488. package/dist/nodes/text-content.d.ts +0 -12
  489. package/dist/nodes/text-content.d.ts.map +0 -1
  490. package/dist/nodes/text-content.js +0 -2
  491. package/dist/nodes/text-content.js.map +0 -1
  492. package/dist/nodes/text-paintable.d.ts +0 -19
  493. package/dist/nodes/text-paintable.d.ts.map +0 -1
  494. package/dist/nodes/text-paintable.js +0 -42
  495. package/dist/nodes/text-paintable.js.map +0 -1
  496. package/dist/nodes/text-segment.d.ts +0 -18
  497. package/dist/nodes/text-segment.d.ts.map +0 -1
  498. package/dist/nodes/text-segment.js +0 -38
  499. package/dist/nodes/text-segment.js.map +0 -1
  500. package/dist/nodes/text-tag.d.ts +0 -38
  501. package/dist/nodes/text-tag.d.ts.map +0 -1
  502. package/dist/nodes/text-tag.js +0 -247
  503. package/dist/nodes/text-tag.js.map +0 -1
  504. package/dist/nodes/text-view.d.ts +0 -29
  505. package/dist/nodes/text-view.d.ts.map +0 -1
  506. package/dist/nodes/text-view.js +0 -80
  507. package/dist/nodes/text-view.js.map +0 -1
  508. package/dist/nodes/toggle-group.d.ts +0 -17
  509. package/dist/nodes/toggle-group.d.ts.map +0 -1
  510. package/dist/nodes/toggle-group.js +0 -65
  511. package/dist/nodes/toggle-group.js.map +0 -1
  512. package/dist/nodes/toggle.d.ts +0 -16
  513. package/dist/nodes/toggle.d.ts.map +0 -1
  514. package/dist/nodes/toggle.js +0 -61
  515. package/dist/nodes/toggle.js.map +0 -1
  516. package/dist/nodes/virtual.d.ts +0 -7
  517. package/dist/nodes/virtual.d.ts.map +0 -1
  518. package/dist/nodes/virtual.js +0 -9
  519. package/dist/nodes/virtual.js.map +0 -1
  520. package/dist/nodes/web-view.d.ts +0 -11
  521. package/dist/nodes/web-view.d.ts.map +0 -1
  522. package/dist/nodes/web-view.js +0 -16
  523. package/dist/nodes/web-view.js.map +0 -1
  524. package/dist/nodes/widget.d.ts +0 -26
  525. package/dist/nodes/widget.d.ts.map +0 -1
  526. package/dist/nodes/widget.js +0 -308
  527. package/dist/nodes/widget.js.map +0 -1
  528. package/dist/nodes/window.d.ts +0 -31
  529. package/dist/nodes/window.d.ts.map +0 -1
  530. package/dist/nodes/window.js +0 -122
  531. package/dist/nodes/window.js.map +0 -1
  532. package/dist/portal.d.ts +0 -29
  533. package/dist/portal.d.ts.map +0 -1
  534. package/dist/portal.js +0 -35
  535. package/dist/portal.js.map +0 -1
  536. package/dist/reconciler.d.ts +0 -34
  537. package/dist/reconciler.d.ts.map +0 -1
  538. package/dist/reconciler.js +0 -48
  539. package/dist/reconciler.js.map +0 -1
  540. package/dist/registry.d.ts +0 -18
  541. package/dist/registry.d.ts.map +0 -1
  542. package/dist/registry.js +0 -98
  543. package/dist/registry.js.map +0 -1
  544. package/dist/render.d.ts +0 -117
  545. package/dist/render.d.ts.map +0 -1
  546. package/dist/render.js +0 -159
  547. package/dist/render.js.map +0 -1
  548. package/dist/types.d.ts +0 -6
  549. package/dist/types.d.ts.map +0 -1
  550. package/dist/types.js.map +0 -1
  551. package/dist/use-property.d.ts +0 -29
  552. package/dist/use-property.d.ts.map +0 -1
  553. package/dist/use-property.js +0 -44
  554. package/dist/use-property.js.map +0 -1
  555. package/dist/use-setting.d.ts +0 -36
  556. package/dist/use-setting.d.ts.map +0 -1
  557. package/dist/use-setting.js +0 -68
  558. package/dist/use-setting.js.map +0 -1
  559. package/src/components/compound.tsx +0 -57
  560. package/src/components/list.tsx +0 -140
  561. package/src/components/slot-widget.tsx +0 -46
  562. package/src/errors.ts +0 -53
  563. package/src/factory.ts +0 -62
  564. package/src/generated/compounds.ts +0 -2741
  565. package/src/generated/internal.ts +0 -3642
  566. package/src/generated/jsx.ts +0 -17383
  567. package/src/generated/registry.ts +0 -17
  568. package/src/host-config.ts +0 -219
  569. package/src/jsx.ts +0 -1033
  570. package/src/metadata.ts +0 -43
  571. package/src/node.ts +0 -107
  572. package/src/nodes/adjustable.ts +0 -68
  573. package/src/nodes/alert-dialog-response.ts +0 -78
  574. package/src/nodes/alert-dialog.ts +0 -55
  575. package/src/nodes/animation.ts +0 -409
  576. package/src/nodes/application.ts +0 -61
  577. package/src/nodes/calendar.ts +0 -42
  578. package/src/nodes/color-dialog-button.ts +0 -69
  579. package/src/nodes/column-view-column.ts +0 -189
  580. package/src/nodes/container-slot.ts +0 -100
  581. package/src/nodes/dialog.ts +0 -25
  582. package/src/nodes/drawing-area.ts +0 -53
  583. package/src/nodes/event-controller.ts +0 -96
  584. package/src/nodes/fixed-child.ts +0 -122
  585. package/src/nodes/font-dialog-button.ts +0 -107
  586. package/src/nodes/grid-child.ts +0 -116
  587. package/src/nodes/internal/accessible.ts +0 -155
  588. package/src/nodes/internal/bound-item.ts +0 -4
  589. package/src/nodes/internal/construct.ts +0 -60
  590. package/src/nodes/internal/predicates.ts +0 -80
  591. package/src/nodes/internal/props.ts +0 -51
  592. package/src/nodes/internal/signal-store.ts +0 -141
  593. package/src/nodes/internal/text-buffer-controller.ts +0 -417
  594. package/src/nodes/internal/widget.ts +0 -74
  595. package/src/nodes/level-bar.ts +0 -36
  596. package/src/nodes/list-item-node.ts +0 -53
  597. package/src/nodes/list.ts +0 -1082
  598. package/src/nodes/menu.ts +0 -27
  599. package/src/nodes/models/menu.ts +0 -314
  600. package/src/nodes/navigation-page.ts +0 -154
  601. package/src/nodes/navigation-view.ts +0 -66
  602. package/src/nodes/notebook-page-tab.ts +0 -55
  603. package/src/nodes/notebook-page.ts +0 -189
  604. package/src/nodes/notebook.ts +0 -42
  605. package/src/nodes/overlay-child.ts +0 -130
  606. package/src/nodes/popover-menu.ts +0 -67
  607. package/src/nodes/scale.ts +0 -28
  608. package/src/nodes/scrolled-window.ts +0 -23
  609. package/src/nodes/search-bar.ts +0 -27
  610. package/src/nodes/shortcut.ts +0 -86
  611. package/src/nodes/slot.ts +0 -138
  612. package/src/nodes/source-view.ts +0 -130
  613. package/src/nodes/spin-row.ts +0 -72
  614. package/src/nodes/stack-page.ts +0 -170
  615. package/src/nodes/stack.ts +0 -35
  616. package/src/nodes/switch-row.ts +0 -26
  617. package/src/nodes/text-anchor.ts +0 -88
  618. package/src/nodes/text-content.ts +0 -14
  619. package/src/nodes/text-paintable.ts +0 -51
  620. package/src/nodes/text-segment.ts +0 -55
  621. package/src/nodes/text-tag.ts +0 -298
  622. package/src/nodes/text-view.ts +0 -100
  623. package/src/nodes/toggle-group.ts +0 -81
  624. package/src/nodes/toggle.ts +0 -72
  625. package/src/nodes/virtual.ts +0 -16
  626. package/src/nodes/web-view.ts +0 -22
  627. package/src/nodes/widget.ts +0 -369
  628. package/src/nodes/window.ts +0 -172
  629. package/src/portal.ts +0 -37
  630. package/src/reconciler.ts +0 -52
  631. package/src/registry.ts +0 -119
  632. package/src/render.tsx +0 -192
  633. package/src/types.ts +0 -13
  634. package/src/use-property.ts +0 -58
  635. package/src/use-setting.ts +0 -96
  636. /package/dist/{types.js → reconciler/types.js} +0 -0
@@ -0,0 +1,92 @@
1
+ import { isConstructOnlyProp, resolveDefaultProp, resolveSignal } from "../utils/gtype.js";
2
+ import { NOTIFY_DETAIL_PREFIX, notifyDetailToProp } from "../utils/notify-name.js";
3
+ import { stateOf } from "./state.js";
4
+ const notifyValueHandler = (container, signalName, handler) => {
5
+ const prop = notifyDetailToProp(signalName);
6
+ return () => handler(Reflect.get(container, prop), container);
7
+ };
8
+ const isPlainObject = (value) => {
9
+ if (typeof value !== "object" || value === null)
10
+ return false;
11
+ const proto = Object.getPrototypeOf(value);
12
+ return proto === Object.prototype || proto === null;
13
+ };
14
+ const elementsEqual = (a, b) => {
15
+ if (a === b)
16
+ return true;
17
+ if (!isPlainObject(a) || !isPlainObject(b))
18
+ return false;
19
+ const keys = Object.keys(a);
20
+ return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && a[key] === b[key]);
21
+ };
22
+ const propsEqual = (a, b) => {
23
+ if (a === b)
24
+ return true;
25
+ if (Array.isArray(a) && Array.isArray(b)) {
26
+ return a.length === b.length && a.every((item, index) => elementsEqual(item, b[index]));
27
+ }
28
+ return false;
29
+ };
30
+ const collectGenericChanges = (container, oldProps, newProps, exclude) => {
31
+ const constructionApplied = oldProps === null;
32
+ const pendingSignals = [];
33
+ const pendingProperties = [];
34
+ const collect = (name) => {
35
+ if (name === "children" || exclude?.(name))
36
+ return;
37
+ if (isConstructOnlyProp(container, name))
38
+ return;
39
+ const oldValue = oldProps?.[name];
40
+ const newValue = newProps[name];
41
+ if (propsEqual(oldValue, newValue))
42
+ return;
43
+ const signalName = resolveSignal(container, name);
44
+ if (signalName) {
45
+ pendingSignals.push({ signalName, newValue });
46
+ return;
47
+ }
48
+ if (constructionApplied)
49
+ return;
50
+ if (newValue !== undefined) {
51
+ pendingProperties.push({ name, newValue });
52
+ return;
53
+ }
54
+ const fallback = resolveDefaultProp(container, name);
55
+ if (fallback.has)
56
+ pendingProperties.push({ name, newValue: fallback.value });
57
+ };
58
+ if (oldProps) {
59
+ for (const name in oldProps)
60
+ collect(name);
61
+ for (const name in newProps) {
62
+ if (!(name in oldProps))
63
+ collect(name);
64
+ }
65
+ }
66
+ else {
67
+ for (const name in newProps)
68
+ collect(name);
69
+ }
70
+ return { pendingSignals, pendingProperties };
71
+ };
72
+ export function applyProps(container, oldProps, newProps, options) {
73
+ const { signalStore } = stateOf(container);
74
+ const { pendingSignals, pendingProperties } = collectGenericChanges(container, oldProps, newProps, options?.exclude);
75
+ for (const { signalName, newValue } of pendingSignals) {
76
+ const nextHandler = typeof newValue === "function" ? newValue : undefined;
77
+ const handler = nextHandler && signalName.startsWith(NOTIFY_DETAIL_PREFIX)
78
+ ? notifyValueHandler(container, signalName, nextHandler)
79
+ : nextHandler;
80
+ signalStore.set({
81
+ instance: container,
82
+ signal: signalName,
83
+ handler,
84
+ });
85
+ }
86
+ for (const { name, newValue } of pendingProperties) {
87
+ if (typeof newValue === "string" && Reflect.get(container, name) === newValue)
88
+ continue;
89
+ Reflect.set(container, name, newValue);
90
+ }
91
+ }
92
+ //# sourceMappingURL=apply-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-props.js","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,MAAM,kBAAkB,GAAG,CAAC,SAAyB,EAAE,UAAkB,EAAE,OAAsB,EAAiB,EAAE;IAChH,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,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,CAAC,GAAG,CAAC;YACZ,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,UAAU;YAClB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,iBAAiB,EAAE,CAAC;QACjD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,QAAQ;YAAE,SAAS;QACxF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;AACL,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport { isConstructOnlyProp, resolveDefaultProp, resolveSignal } from \"../utils/gtype.js\";\nimport { NOTIFY_DETAIL_PREFIX, notifyDetailToProp } from \"../utils/notify-name.js\";\nimport { stateOf } from \"./state.js\";\nimport type { Props } from \"./types.js\";\n\nconst notifyValueHandler = (container: GObject.Object, signalName: string, handler: SignalHandler): SignalHandler => {\n const prop = notifyDetailToProp(signalName);\n return () => handler(Reflect.get(container, prop), container);\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\nconst elementsEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (!isPlainObject(a) || !isPlainObject(b)) return false;\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && a[key] === b[key]);\n};\n\nconst propsEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => elementsEqual(item, b[index]));\n }\n return false;\n};\n\ntype ApplyPropsOptions = {\n exclude?: (name: string) => boolean;\n};\n\ntype PendingSignal = { signalName: string; newValue: unknown };\n\ntype PendingProperty = { name: string; newValue: unknown };\n\nconst collectGenericChanges = (\n container: GObject.Object,\n oldProps: Props | null,\n newProps: Props,\n exclude: ((name: string) => boolean) | undefined,\n): { pendingSignals: PendingSignal[]; pendingProperties: PendingProperty[] } => {\n const constructionApplied = oldProps === null;\n const pendingSignals: PendingSignal[] = [];\n const pendingProperties: PendingProperty[] = [];\n\n const collect = (name: string): void => {\n if (name === \"children\" || exclude?.(name)) return;\n if (isConstructOnlyProp(container, name)) return;\n\n const oldValue = oldProps?.[name];\n const newValue = newProps[name];\n if (propsEqual(oldValue, newValue)) return;\n\n const signalName = resolveSignal(container, name);\n if (signalName) {\n pendingSignals.push({ signalName, newValue });\n return;\n }\n if (constructionApplied) return;\n if (newValue !== undefined) {\n pendingProperties.push({ name, newValue });\n return;\n }\n const fallback = resolveDefaultProp(container, name);\n if (fallback.has) pendingProperties.push({ name, newValue: fallback.value });\n };\n\n if (oldProps) {\n for (const name in oldProps) collect(name);\n for (const name in newProps) {\n if (!(name in oldProps)) collect(name);\n }\n } else {\n for (const name in newProps) collect(name);\n }\n\n return { pendingSignals, pendingProperties };\n};\n\nexport function applyProps(\n container: GObject.Object,\n oldProps: Props | null,\n newProps: Props,\n options?: ApplyPropsOptions,\n): void {\n const { signalStore } = stateOf(container);\n const { pendingSignals, pendingProperties } = collectGenericChanges(\n container,\n oldProps,\n newProps,\n options?.exclude,\n );\n\n for (const { signalName, newValue } of pendingSignals) {\n const nextHandler = typeof newValue === \"function\" ? (newValue as SignalHandler) : undefined;\n const handler =\n nextHandler && signalName.startsWith(NOTIFY_DETAIL_PREFIX)\n ? notifyValueHandler(container, signalName, nextHandler)\n : nextHandler;\n signalStore.set({\n instance: container,\n signal: signalName,\n handler,\n });\n }\n\n for (const { name, newValue } of pendingProperties) {\n if (typeof newValue === \"string\" && Reflect.get(container, name) === newValue) continue;\n Reflect.set(container, name, newValue);\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const scheduleFlush: (fn: () => void) => void;
2
+ export declare const runCommitFlush: () => void;
3
+ //# sourceMappingURL=commit-flush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-flush.d.ts","sourceRoot":"","sources":["../../src/reconciler/commit-flush.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,OAAQ,MAAM,IAAI,KAAG,IAE9C,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,IAMjC,CAAC"}
@@ -0,0 +1,13 @@
1
+ const pending = new Set();
2
+ export const scheduleFlush = (fn) => {
3
+ pending.add(fn);
4
+ };
5
+ export const runCommitFlush = () => {
6
+ while (pending.size > 0) {
7
+ const batch = [...pending];
8
+ pending.clear();
9
+ for (const fn of batch)
10
+ fn();
11
+ }
12
+ };
13
+ //# sourceMappingURL=commit-flush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-flush.js","sourceRoot":"","sources":["../../src/reconciler/commit-flush.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAc,EAAQ,EAAE;IAClD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAS,EAAE;IACrC,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QAC3B,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,MAAM,EAAE,IAAI,KAAK;YAAE,EAAE,EAAE,CAAC;IACjC,CAAC;AACL,CAAC,CAAC","sourcesContent":["const pending = new Set<() => void>();\n\nexport const scheduleFlush = (fn: () => void): void => {\n pending.add(fn);\n};\n\nexport const runCommitFlush = (): void => {\n while (pending.size > 0) {\n const batch = [...pending];\n pending.clear();\n for (const fn of batch) fn();\n }\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { type ElementMapping } from "./state.js";
4
+ export declare function attachChild(child: Gtk.Widget, container: GObject.Object): void;
5
+ export declare function detachChild(child: Gtk.Widget, container: GObject.Object): void;
6
+ export declare function unparentWidget(widget: Gtk.Widget): void;
7
+ export declare function getFocusWidget(widget: Gtk.Widget): Gtk.Widget | null;
8
+ export declare function isDescendantOf(widget: Gtk.Widget, ancestor: Gtk.Widget): boolean;
9
+ export declare const containerMapping: ElementMapping;
10
+ //# sourceMappingURL=container-attach.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-attach.d.ts","sourceRoot":"","sources":["../../src/reconciler/container-attach.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,YAAY,CAAC;AAQ7E,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAO9E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAa9E;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAIvD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,IAAI,CAGpE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAOhF;AAwJD,eAAO,MAAM,gBAAgB,EAAE,cAW9B,CAAC"}
@@ -0,0 +1,216 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { typeChainIncludes } from "../utils/gtype.js";
4
+ import { callUsesRef, nullSetterCurrentHolder, resolveContainerProp, runCall } from "./element-props.js";
5
+ import { registeredStateOf, stateOf } from "./state.js";
6
+ import { childWidget } from "./wrapper-content.js";
7
+ const containerPropFor = (container, child) => resolveContainerProp(container.__type__, child.__type__, undefined);
8
+ const scopeFor = (child) => ({ child, props: registeredStateOf(child)?.props ?? {} });
9
+ export function attachChild(child, container) {
10
+ const cp = containerPropFor(container, child);
11
+ if (cp?.append !== undefined) {
12
+ runCall(container, cp.append, [child], scopeFor(child));
13
+ return;
14
+ }
15
+ if (container instanceof Gtk.Widget)
16
+ child.setParent(container);
17
+ }
18
+ export function detachChild(child, container) {
19
+ const cp = containerPropFor(container, child);
20
+ if (cp?.remove !== undefined) {
21
+ const holder = nullSetterCurrentHolder(container, cp.remove);
22
+ if (holder !== undefined) {
23
+ if (holder === child)
24
+ runCall(container, cp.remove, [child], scopeFor(child));
25
+ return;
26
+ }
27
+ if (container instanceof Gtk.Widget && !isDescendantOf(child, container))
28
+ return;
29
+ runCall(container, cp.remove, [child], scopeFor(child));
30
+ return;
31
+ }
32
+ if (container instanceof Gtk.Widget && isDescendantOf(child, container))
33
+ child.unparent();
34
+ }
35
+ export function unparentWidget(widget) {
36
+ const currentParent = widget.getParent();
37
+ if (currentParent === null)
38
+ return;
39
+ detachChild(widget, currentParent);
40
+ }
41
+ export function getFocusWidget(widget) {
42
+ const root = widget.getRoot();
43
+ return root?.getFocus() ?? null;
44
+ }
45
+ export function isDescendantOf(widget, ancestor) {
46
+ let current = widget;
47
+ while (current) {
48
+ if (current === ancestor)
49
+ return true;
50
+ current = current.getParent();
51
+ }
52
+ return false;
53
+ }
54
+ const isAutowrapChild = (cp, widget) => cp?.autowrap !== undefined && !typeChainIncludes(widget.__type__, cp.autowrap);
55
+ const detachAutowrapped = (widget) => {
56
+ const wrapper = widget.getParent();
57
+ if (wrapper === null)
58
+ return;
59
+ detachChild(widget, wrapper);
60
+ const wrapperParent = wrapper.getParent();
61
+ if (wrapperParent !== null)
62
+ detachChild(wrapper, wrapperParent);
63
+ };
64
+ function* childWidgetsOf(container) {
65
+ let child = container.getFirstChild();
66
+ while (child) {
67
+ yield child;
68
+ child = child.getNextSibling();
69
+ }
70
+ }
71
+ const unwrapChildWidget = (child) => {
72
+ if ("getChild" in child && typeof child.getChild === "function") {
73
+ const inner = child.getChild();
74
+ return inner instanceof Gtk.Widget ? inner : null;
75
+ }
76
+ return child;
77
+ };
78
+ const findWrappedPosition = (container, anchor, wrapper) => {
79
+ const anchorIsWrapper = typeChainIncludes(anchor.__type__, wrapper);
80
+ let position = 0;
81
+ for (const current of childWidgetsOf(container)) {
82
+ const compare = anchorIsWrapper ? current : unwrapChildWidget(current);
83
+ if (compare && compare === anchor)
84
+ return position;
85
+ position++;
86
+ }
87
+ return null;
88
+ };
89
+ const findInsertPosition = (container, anchor) => {
90
+ let position = 0;
91
+ for (const current of childWidgetsOf(container)) {
92
+ if (current === anchor)
93
+ return position;
94
+ position++;
95
+ }
96
+ return position;
97
+ };
98
+ const reorderPosition = (container, anchor, moving) => {
99
+ let position = 0;
100
+ for (const current of childWidgetsOf(container)) {
101
+ if (current === moving)
102
+ continue;
103
+ if (current === anchor)
104
+ return position;
105
+ position++;
106
+ }
107
+ return position;
108
+ };
109
+ const findPrevSibling = (container, anchor) => {
110
+ for (const child of childWidgetsOf(container)) {
111
+ if (child === anchor)
112
+ return child.getPrevSibling() ?? undefined;
113
+ }
114
+ return undefined;
115
+ };
116
+ const insertAtIndex = (container, widget, anchor, cp) => {
117
+ if (cp.autowrap !== undefined) {
118
+ if (widget.getParent() !== null) {
119
+ if (isAutowrapChild(cp, widget))
120
+ detachAutowrapped(widget);
121
+ else
122
+ unparentWidget(widget);
123
+ }
124
+ const position = findWrappedPosition(container, anchor, cp.autowrap);
125
+ if (position === null)
126
+ attachChild(widget, container);
127
+ else
128
+ runCall(container, cp.insert, [widget, position], { child: widget, index: position });
129
+ return;
130
+ }
131
+ if (widget.getParent() === container && cp.reorder !== undefined) {
132
+ const position = reorderPosition(container, anchor, widget);
133
+ runCall(container, cp.reorder, [widget, position], { child: widget, index: position });
134
+ return;
135
+ }
136
+ unparentWidget(widget);
137
+ const position = findInsertPosition(container, anchor);
138
+ runCall(container, cp.insert, [widget, position], { child: widget, index: position });
139
+ };
140
+ const insertBySibling = (container, widget, anchor, cp) => {
141
+ const previous = findPrevSibling(container, anchor);
142
+ const scope = { child: widget, sibling: previous ?? null };
143
+ if (widget.getParent() === container && cp.reorder !== undefined) {
144
+ runCall(container, cp.reorder, [widget, previous], scope);
145
+ return;
146
+ }
147
+ unparentWidget(widget);
148
+ if (cp.insert !== undefined)
149
+ runCall(container, cp.insert, [widget, previous], scope);
150
+ else
151
+ attachChild(widget, container);
152
+ };
153
+ const reinsertAll = (container) => {
154
+ const widgets = [];
155
+ for (const child of stateOf(container).children) {
156
+ const widget = childWidget(child);
157
+ if (widget)
158
+ widgets.push(widget);
159
+ }
160
+ for (const widget of widgets)
161
+ detachChild(widget, container);
162
+ for (const widget of widgets)
163
+ attachChild(widget, container);
164
+ };
165
+ const insertWidgetBefore = (container, widget, anchor) => {
166
+ const cp = containerPropFor(container, widget);
167
+ if (cp?.insert !== undefined && callUsesRef(cp.insert, "index") && container instanceof Gtk.Widget) {
168
+ insertAtIndex(container, widget, anchor, { ...cp, insert: cp.insert });
169
+ return;
170
+ }
171
+ if (container instanceof Gtk.Widget &&
172
+ (cp?.reorder !== undefined || (cp?.insert !== undefined && callUsesRef(cp.insert, "sibling")))) {
173
+ insertBySibling(container, widget, anchor, cp);
174
+ return;
175
+ }
176
+ reinsertAll(container);
177
+ };
178
+ const appendWidget = (container, widget, fresh) => {
179
+ if (!fresh && widget.getParent() !== null) {
180
+ const cp = containerPropFor(container, widget);
181
+ if (isAutowrapChild(cp, widget))
182
+ detachAutowrapped(widget);
183
+ else
184
+ unparentWidget(widget);
185
+ }
186
+ attachChild(widget, container);
187
+ };
188
+ const removeWidget = (container, widget) => {
189
+ const cp = containerPropFor(container, widget);
190
+ if (!isAutowrapChild(cp, widget)) {
191
+ detachChild(widget, container);
192
+ return;
193
+ }
194
+ const wrapper = widget.getParent();
195
+ if (wrapper !== null && wrapper !== container) {
196
+ detachChild(widget, wrapper);
197
+ detachChild(wrapper, container);
198
+ }
199
+ };
200
+ export const containerMapping = (child, parent) => {
201
+ const widget = childWidget(child);
202
+ if (widget === null || !(parent instanceof GObject.Object))
203
+ return null;
204
+ if (!(parent instanceof Gtk.Widget) && containerPropFor(parent, widget) === null)
205
+ return null;
206
+ return {
207
+ attach: (anchor, fresh) => {
208
+ if (anchor instanceof Gtk.Widget)
209
+ insertWidgetBefore(parent, widget, anchor);
210
+ else
211
+ appendWidget(parent, widget, fresh === true);
212
+ },
213
+ detach: () => removeWidget(parent, widget),
214
+ };
215
+ };
216
+ //# sourceMappingURL=container-attach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-attach.js","sourceRoot":"","sources":["../../src/reconciler/container-attach.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAuB,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,gBAAgB,GAAG,CAAC,SAAyB,EAAE,KAAiB,EAAwB,EAAE,CAC5F,oBAAoB,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAExE,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAA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O,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACnC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC5C,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxE,IAAI,CAAC,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9F,OAAO;QACH,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACtB,IAAI,MAAM,YAAY,GAAG,CAAC,MAAM;gBAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;;gBACxE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;KAC7C,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { ContainerProp } from \"@gtkx/config\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { typeChainIncludes } from \"../utils/gtype.js\";\nimport { callUsesRef, nullSetterCurrentHolder, resolveContainerProp, runCall } from \"./element-props.js\";\nimport { type ElementMapping, registeredStateOf, stateOf } from \"./state.js\";\nimport { childWidget } from \"./wrapper-content.js\";\n\nconst containerPropFor = (container: GObject.Object, child: Gtk.Widget): ContainerProp | null =>\n resolveContainerProp(container.__type__, child.__type__, undefined);\n\nconst scopeFor = (child: Gtk.Widget) => ({ child, props: registeredStateOf(child)?.props ?? {} });\n\nexport function attachChild(child: Gtk.Widget, container: GObject.Object): void {\n const cp = containerPropFor(container, child);\n if (cp?.append !== undefined) {\n runCall(container, cp.append, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget) child.setParent(container);\n}\n\nexport function detachChild(child: Gtk.Widget, container: GObject.Object): void {\n const cp = containerPropFor(container, child);\n if (cp?.remove !== undefined) {\n const holder = nullSetterCurrentHolder(container, cp.remove);\n if (holder !== undefined) {\n if (holder === child) runCall(container, cp.remove, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget && !isDescendantOf(child, container)) return;\n runCall(container, cp.remove, [child], scopeFor(child));\n return;\n }\n if (container instanceof Gtk.Widget && isDescendantOf(child, container)) child.unparent();\n}\n\nexport function unparentWidget(widget: Gtk.Widget): void {\n const currentParent = widget.getParent();\n if (currentParent === null) return;\n detachChild(widget, currentParent);\n}\n\nexport function getFocusWidget(widget: Gtk.Widget): Gtk.Widget | null {\n const root = widget.getRoot();\n return root?.getFocus() ?? null;\n}\n\nexport function isDescendantOf(widget: Gtk.Widget, ancestor: Gtk.Widget): boolean {\n let current: Gtk.Widget | null = widget;\n while (current) {\n if (current === ancestor) return true;\n current = current.getParent();\n }\n return false;\n}\n\nconst isAutowrapChild = (cp: ContainerProp | null, widget: Gtk.Widget): boolean =>\n cp?.autowrap !== undefined && !typeChainIncludes(widget.__type__, cp.autowrap);\n\nconst detachAutowrapped = (widget: Gtk.Widget): void => {\n const wrapper = widget.getParent();\n if (wrapper === null) return;\n detachChild(widget, wrapper);\n const wrapperParent = wrapper.getParent();\n if (wrapperParent !== null) detachChild(wrapper, wrapperParent);\n};\n\nfunction* childWidgetsOf(container: Gtk.Widget): IterableIterator<Gtk.Widget> {\n let child = container.getFirstChild();\n while (child) {\n yield child;\n child = child.getNextSibling();\n }\n}\n\nconst unwrapChildWidget = (child: Gtk.Widget): Gtk.Widget | null => {\n if (\"getChild\" in child && typeof child.getChild === \"function\") {\n const inner: unknown = child.getChild();\n return inner instanceof Gtk.Widget ? inner : null;\n }\n return child;\n};\n\nconst findWrappedPosition = (container: Gtk.Widget, anchor: Gtk.Widget, wrapper: string): number | null => {\n const anchorIsWrapper = typeChainIncludes(anchor.__type__, wrapper);\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n const compare = anchorIsWrapper ? current : unwrapChildWidget(current);\n if (compare && compare === anchor) return position;\n position++;\n }\n return null;\n};\n\nconst findInsertPosition = (container: Gtk.Widget, anchor: Gtk.Widget): number => {\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n if (current === anchor) return position;\n position++;\n }\n return position;\n};\n\nconst reorderPosition = (container: Gtk.Widget, anchor: Gtk.Widget, moving: Gtk.Widget): number => {\n let position = 0;\n for (const current of childWidgetsOf(container)) {\n if (current === moving) continue;\n if (current === anchor) return position;\n position++;\n }\n return position;\n};\n\nconst findPrevSibling = (container: Gtk.Widget, anchor: Gtk.Widget): Gtk.Widget | undefined => {\n for (const child of childWidgetsOf(container)) {\n if (child === anchor) return child.getPrevSibling() ?? undefined;\n }\n return undefined;\n};\n\nconst insertAtIndex = (\n container: Gtk.Widget,\n widget: Gtk.Widget,\n anchor: Gtk.Widget,\n cp: ContainerProp & { insert: NonNullable<ContainerProp[\"insert\"]> },\n): void => {\n if (cp.autowrap !== undefined) {\n if (widget.getParent() !== null) {\n if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);\n else unparentWidget(widget);\n }\n const position = findWrappedPosition(container, anchor, cp.autowrap);\n if (position === null) attachChild(widget, container);\n else runCall(container, cp.insert, [widget, position], { child: widget, index: position });\n return;\n }\n if (widget.getParent() === container && cp.reorder !== undefined) {\n const position = reorderPosition(container, anchor, widget);\n runCall(container, cp.reorder, [widget, position], { child: widget, index: position });\n return;\n }\n unparentWidget(widget);\n const position = findInsertPosition(container, anchor);\n runCall(container, cp.insert, [widget, position], { child: widget, index: position });\n};\n\nconst insertBySibling = (container: Gtk.Widget, widget: Gtk.Widget, anchor: Gtk.Widget, cp: ContainerProp): void => {\n const previous = findPrevSibling(container, anchor);\n const scope = { child: widget, sibling: previous ?? null };\n if (widget.getParent() === container && cp.reorder !== undefined) {\n runCall(container, cp.reorder, [widget, previous], scope);\n return;\n }\n unparentWidget(widget);\n if (cp.insert !== undefined) runCall(container, cp.insert, [widget, previous], scope);\n else attachChild(widget, container);\n};\n\nconst reinsertAll = (container: GObject.Object): void => {\n const widgets: Gtk.Widget[] = [];\n for (const child of stateOf(container).children) {\n const widget = childWidget(child);\n if (widget) widgets.push(widget);\n }\n for (const widget of widgets) detachChild(widget, container);\n for (const widget of widgets) attachChild(widget, container);\n};\n\nconst insertWidgetBefore = (container: GObject.Object, widget: Gtk.Widget, anchor: Gtk.Widget): void => {\n const cp = containerPropFor(container, widget);\n if (cp?.insert !== undefined && callUsesRef(cp.insert, \"index\") && container instanceof Gtk.Widget) {\n insertAtIndex(container, widget, anchor, { ...cp, insert: cp.insert });\n return;\n }\n if (\n container instanceof Gtk.Widget &&\n (cp?.reorder !== undefined || (cp?.insert !== undefined && callUsesRef(cp.insert, \"sibling\")))\n ) {\n insertBySibling(container, widget, anchor, cp);\n return;\n }\n reinsertAll(container);\n};\n\nconst appendWidget = (container: GObject.Object, widget: Gtk.Widget, fresh: boolean): void => {\n if (!fresh && widget.getParent() !== null) {\n const cp = containerPropFor(container, widget);\n if (isAutowrapChild(cp, widget)) detachAutowrapped(widget);\n else unparentWidget(widget);\n }\n attachChild(widget, container);\n};\n\nconst removeWidget = (container: GObject.Object, widget: Gtk.Widget): void => {\n const cp = containerPropFor(container, widget);\n if (!isAutowrapChild(cp, widget)) {\n detachChild(widget, container);\n return;\n }\n const wrapper = widget.getParent();\n if (wrapper !== null && wrapper !== container) {\n detachChild(widget, wrapper);\n detachChild(wrapper, container);\n }\n};\n\nexport const containerMapping: ElementMapping = (child, parent) => {\n const widget = childWidget(child);\n if (widget === null || !(parent instanceof GObject.Object)) return null;\n if (!(parent instanceof Gtk.Widget) && containerPropFor(parent, widget) === null) return null;\n return {\n attach: (anchor, fresh) => {\n if (anchor instanceof Gtk.Widget) insertWidgetBefore(parent, widget, anchor);\n else appendWidget(parent, widget, fresh === true);\n },\n detach: () => removeWidget(parent, widget),\n };\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { type Node } from "./state.js";
2
+ export declare const scheduleContentRebuild: <T extends Node>(node: Node, isContentOwner: (candidate: Node) => candidate is T, createRebuild: (owner: T) => () => void) => void;
3
+ //# sourceMappingURL=content-rebuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-rebuild.d.ts","sourceRoot":"","sources":["../../src/reconciler/content-rebuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAIxD,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,IAAI,QAC3C,IAAI,kBACM,CAAC,SAAS,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,iBACpC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,IAAI,KACxC,IASF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { scheduleFlush } from "./commit-flush.js";
2
+ import { closestInstance } from "./state.js";
3
+ const rebuildsByContentOwner = new WeakMap();
4
+ export const scheduleContentRebuild = (node, isContentOwner, createRebuild) => {
5
+ const owner = closestInstance(node, isContentOwner);
6
+ if (!owner)
7
+ return;
8
+ let rebuild = rebuildsByContentOwner.get(owner);
9
+ if (!rebuild) {
10
+ rebuild = createRebuild(owner);
11
+ rebuildsByContentOwner.set(owner, rebuild);
12
+ }
13
+ scheduleFlush(rebuild);
14
+ };
15
+ //# sourceMappingURL=content-rebuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-rebuild.js","sourceRoot":"","sources":["../../src/reconciler/content-rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AAExD,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAoB,CAAC;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,IAAU,EACV,cAAmD,EACnD,aAAuC,EACnC,EAAE;IACN,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,OAAO,GAAG,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/B,sBAAsB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,aAAa,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import { scheduleFlush } from \"./commit-flush.js\";\nimport { closestInstance, type Node } from \"./state.js\";\n\nconst rebuildsByContentOwner = new WeakMap<Node, () => void>();\n\nexport const scheduleContentRebuild = <T extends Node>(\n node: Node,\n isContentOwner: (candidate: Node) => candidate is T,\n createRebuild: (owner: T) => () => void,\n): void => {\n const owner = closestInstance(node, isContentOwner);\n if (!owner) return;\n let rebuild = rebuildsByContentOwner.get(owner);\n if (!rebuild) {\n rebuild = createRebuild(owner);\n rebuildsByContentOwner.set(owner, rebuild);\n }\n scheduleFlush(rebuild);\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { type Node } from "./state.js";
2
+ export declare const detachFromParent: (child: Node, parent: Node) => void;
3
+ export declare const resyncWrapperNode: (node: Node) => void;
4
+ export declare const attachNode: (parent: Node, child: Node, before: Node | null, fresh: boolean) => void;
5
+ export declare const detachNode: (parent: Node, child: Node) => void;
6
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/reconciler/dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,KAAK,IAAI,EAAW,MAAM,YAAY,CAAC;AAwB1F,eAAO,MAAM,gBAAgB,UAAW,IAAI,UAAU,IAAI,KAAG,IAE5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAAU,IAAI,KAAG,IAG9C,CAAC;AAUF,eAAO,MAAM,UAAU,WAAY,IAAI,SAAS,IAAI,UAAU,IAAI,GAAG,IAAI,SAAS,OAAO,KAAG,IAS3F,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,IAAI,SAAS,IAAI,KAAG,IAGtD,CAAC"}
@@ -0,0 +1,61 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import { containerMapping } from "./container-attach.js";
3
+ import { stateOf } from "./state.js";
4
+ import { containerChildMapping, containerPropMapping, lazyElementMapping, objectPropMapping } from "./wrapper-apply.js";
5
+ import { isWrapperNode } from "./wrapper-node.js";
6
+ const ELEMENT_MAP = [
7
+ objectPropMapping,
8
+ containerPropMapping,
9
+ lazyElementMapping,
10
+ containerChildMapping,
11
+ containerMapping,
12
+ ];
13
+ const resolveHandler = (child, parent) => {
14
+ for (const mapping of ELEMENT_MAP) {
15
+ const handler = mapping(child, parent);
16
+ if (handler !== null)
17
+ return handler;
18
+ }
19
+ return null;
20
+ };
21
+ const attachToParent = (child, parent, anchor, fresh) => {
22
+ resolveHandler(child, parent)?.attach(anchor, fresh);
23
+ };
24
+ export const detachFromParent = (child, parent) => {
25
+ resolveHandler(child, parent)?.detach();
26
+ };
27
+ export const resyncWrapperNode = (node) => {
28
+ const parent = stateOf(node).parent;
29
+ if (isWrapperNode(node) && parent)
30
+ attachToParent(node, parent);
31
+ };
32
+ const anchorWrapper = (before) => {
33
+ if (before instanceof GObject.Object)
34
+ return before;
35
+ for (const grandchild of stateOf(before).children) {
36
+ if (grandchild instanceof GObject.Object)
37
+ return grandchild;
38
+ }
39
+ return null;
40
+ };
41
+ export const attachNode = (parent, child, before, fresh) => {
42
+ if (before === null) {
43
+ if (isWrapperNode(child) || !isWrapperNode(parent))
44
+ attachToParent(child, parent, null, fresh);
45
+ }
46
+ else if (isWrapperNode(child)) {
47
+ attachToParent(child, parent);
48
+ }
49
+ else if (!isWrapperNode(parent)) {
50
+ attachToParent(child, parent, anchorWrapper(before));
51
+ }
52
+ if (isWrapperNode(parent))
53
+ resyncWrapperNode(parent);
54
+ };
55
+ export const detachNode = (parent, child) => {
56
+ if (isWrapperNode(child) || !isWrapperNode(parent))
57
+ detachFromParent(child, parent);
58
+ if (isWrapperNode(parent))
59
+ resyncWrapperNode(parent);
60
+ };
61
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/reconciler/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAuD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,GAAqB;IAClC,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,gBAAgB;CACnB,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAW,EAAE,MAAY,EAAyB,EAAE;IACxE,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,OAAO,CAAC;IACzC,CAAC;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AAC,CAAC;IACnG,CAAC;SAAM,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC;QAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAY,EAAE,KAAW,EAAQ,EAAE;IAC1D,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;QAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpF,IAAI,aAAa,CAAC,MAAM,CAAC;QAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport { containerMapping } from \"./container-attach.js\";\nimport { type ElementHandler, type ElementMapping, type Node, stateOf } from \"./state.js\";\nimport { containerChildMapping, containerPropMapping, lazyElementMapping, objectPropMapping } from \"./wrapper-apply.js\";\nimport { isWrapperNode } from \"./wrapper-node.js\";\n\nconst ELEMENT_MAP: ElementMapping[] = [\n objectPropMapping,\n containerPropMapping,\n lazyElementMapping,\n containerChildMapping,\n containerMapping,\n];\n\nconst resolveHandler = (child: Node, parent: Node): ElementHandler | null => {\n for (const mapping of ELEMENT_MAP) {\n const handler = mapping(child, parent);\n if (handler !== null) return handler;\n }\n return null;\n};\n\nconst attachToParent = (child: Node, parent: Node, anchor?: GObject.Object | null, fresh?: boolean): void => {\n resolveHandler(child, parent)?.attach(anchor, fresh);\n};\n\nexport const detachFromParent = (child: Node, parent: Node): void => {\n resolveHandler(child, parent)?.detach();\n};\n\nexport const resyncWrapperNode = (node: Node): void => {\n const parent = stateOf(node).parent;\n if (isWrapperNode(node) && parent) attachToParent(node, parent);\n};\n\nconst anchorWrapper = (before: Node): GObject.Object | null => {\n if (before instanceof GObject.Object) return before;\n for (const grandchild of stateOf(before).children) {\n if (grandchild instanceof GObject.Object) return grandchild;\n }\n return null;\n};\n\nexport const attachNode = (parent: Node, child: Node, before: Node | null, fresh: boolean): void => {\n if (before === null) {\n if (isWrapperNode(child) || !isWrapperNode(parent)) attachToParent(child, parent, null, fresh);\n } else if (isWrapperNode(child)) {\n attachToParent(child, parent);\n } else if (!isWrapperNode(parent)) {\n attachToParent(child, parent, anchorWrapper(before));\n }\n if (isWrapperNode(parent)) resyncWrapperNode(parent);\n};\n\nexport const detachNode = (parent: Node, child: Node): void => {\n if (isWrapperNode(child) || !isWrapperNode(parent)) detachFromParent(child, parent);\n if (isWrapperNode(parent)) resyncWrapperNode(parent);\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { TypedClass } from "@gtkx/runtime";
2
+ import type { Props } from "./types.js";
3
+ export declare const applyElementProps: (instance: TypedClass & object, oldProps: Props | null, newProps: Props) => void;
4
+ export declare const reapplyLazyProps: (instance: TypedClass & object, props: Props) => void;
5
+ //# sourceMappingURL=element-prop-appliers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-prop-appliers.d.ts","sourceRoot":"","sources":["../../src/reconciler/element-prop-appliers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA+FxC,eAAO,MAAM,iBAAiB,aAAc,UAAU,GAAG,MAAM,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,KAAG,IAI1G,CAAC;AAEF,eAAO,MAAM,gBAAgB,aAAc,UAAU,GAAG,MAAM,SAAS,KAAK,KAAG,IAI9E,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { callMethod, isShallowEqual } from "@gtkx/utils";
2
+ import { appliedPropsFor, runCall } from "./element-props.js";
3
+ const asArray = (value) => (Array.isArray(value) ? value : []);
4
+ const isRecord = (value) => typeof value === "object" && value !== null;
5
+ const itemsEqual = (a, b) => {
6
+ if (a === b)
7
+ return true;
8
+ return isRecord(a) && isRecord(b) && isShallowEqual(a, b);
9
+ };
10
+ const listValuesEqual = (oldValue, newValue) => {
11
+ if (oldValue === newValue)
12
+ return true;
13
+ const a = asArray(oldValue);
14
+ const b = asArray(newValue);
15
+ return a.length === b.length && a.every((item, index) => itemsEqual(item, b[index]));
16
+ };
17
+ const runAdd = (instance, add, item) => {
18
+ if (Array.isArray(add)) {
19
+ for (const call of add)
20
+ runCall(instance, call, [item], { item });
21
+ return;
22
+ }
23
+ runCall(instance, add, [item], { item });
24
+ };
25
+ const snapshotItems = (items) => items.map((item) => (isRecord(item) ? { ...item } : item));
26
+ const appliedLists = new WeakMap();
27
+ const rememberAppliedList = (instance, prop, items) => {
28
+ const byProp = appliedLists.get(instance) ?? new Map();
29
+ byProp.set(prop, snapshotItems(items));
30
+ appliedLists.set(instance, byProp);
31
+ };
32
+ const applyList = (instance, prop, newValue) => {
33
+ const applied = appliedLists.get(instance)?.get(prop.prop);
34
+ const newItems = asArray(newValue);
35
+ if (applied !== undefined && listValuesEqual(applied, newItems))
36
+ return;
37
+ if (prop.clear !== undefined) {
38
+ runCall(instance, prop.clear, [], {});
39
+ }
40
+ else if (prop.remove !== undefined) {
41
+ for (const item of asArray(applied))
42
+ runCall(instance, prop.remove, [item], { item });
43
+ }
44
+ else if (asArray(applied).length !== 0) {
45
+ return;
46
+ }
47
+ for (const item of newItems)
48
+ runAdd(instance, prop.add, item);
49
+ rememberAppliedList(instance, prop.prop, newItems);
50
+ };
51
+ const applyValue = (instance, prop, oldValue, newValue) => {
52
+ if (oldValue === newValue)
53
+ return;
54
+ runCall(instance, prop.call, [newValue], { item: newValue });
55
+ if (prop.after !== undefined)
56
+ callMethod(instance, prop.after, []);
57
+ };
58
+ const applyControlledText = (instance, prop, oldValue, newValue) => {
59
+ if (oldValue === newValue || typeof newValue !== "string")
60
+ return;
61
+ if (oldValue !== undefined && Reflect.get(instance, prop.prop) !== oldValue)
62
+ return;
63
+ Reflect.set(instance, prop.prop, newValue);
64
+ };
65
+ const applyLazy = (instance, prop, props) => {
66
+ const value = props[prop.prop];
67
+ if (value == null || value === "")
68
+ return;
69
+ if (Reflect.get(instance, prop.prop) === value)
70
+ return;
71
+ if (prop.lookup !== undefined && !callMethod(instance, prop.lookup, [value]))
72
+ return;
73
+ Reflect.set(instance, prop.prop, value);
74
+ };
75
+ const applyProp = (instance, prop, oldProps, newProps) => {
76
+ const oldValue = oldProps?.[prop.prop];
77
+ const newValue = newProps[prop.prop];
78
+ switch (prop.kind) {
79
+ case "value":
80
+ applyValue(instance, prop, oldValue, newValue);
81
+ return;
82
+ case "controlled-text":
83
+ applyControlledText(instance, prop, oldValue, newValue);
84
+ return;
85
+ case "lazy":
86
+ applyLazy(instance, prop, newProps);
87
+ return;
88
+ case "list":
89
+ applyList(instance, prop, newValue);
90
+ return;
91
+ }
92
+ };
93
+ export const applyElementProps = (instance, oldProps, newProps) => {
94
+ for (const prop of appliedPropsFor(instance.__type__).values()) {
95
+ applyProp(instance, prop, oldProps, newProps);
96
+ }
97
+ };
98
+ export const reapplyLazyProps = (instance, props) => {
99
+ for (const prop of appliedPropsFor(instance.__type__).values()) {
100
+ if (prop.kind === "lazy")
101
+ applyLazy(instance, prop, props);
102
+ }
103
+ };
104
+ //# sourceMappingURL=element-prop-appliers.js.map