@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
@@ -0,0 +1,76 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ import type * as Gtk from "@gtkx/gi/gtk";
3
+ import type { SignalHandler } from "@gtkx/runtime";
4
+ import type { ElementBehavior, Props } from "./registry.js";
5
+ type ContentKind = "label" | "buffer" | "tag" | "anchor";
6
+ type HandlerRecord = {
7
+ signal: string;
8
+ handler: SignalHandler;
9
+ wrapped: SignalHandler;
10
+ blockable: boolean;
11
+ };
12
+ type Dispatch = (fn: () => unknown) => unknown;
13
+ type SignalTarget = {
14
+ object: GObject.Object;
15
+ handlers: Map<string, HandlerRecord>;
16
+ typeName: string;
17
+ dispatch: Dispatch;
18
+ };
19
+ type PlacedChild = {
20
+ node: PlaceableNode;
21
+ object: GObject.Object;
22
+ adopted: GObject.Object | null;
23
+ slot: string;
24
+ behavior: ElementBehavior | null;
25
+ attached: boolean;
26
+ };
27
+ type ElementNode = SignalTarget & {
28
+ kind: typeof ELEMENT_KIND;
29
+ props: Props;
30
+ placements: Map<string, PlacedChild[]>;
31
+ contexts: Map<ElementBehavior, unknown>;
32
+ parent: ParentNode | null;
33
+ content: ContentChild[];
34
+ contentKind: ContentKind | null;
35
+ bufferView: Gtk.TextView | null;
36
+ };
37
+ type PropNode = {
38
+ kind: typeof PROP_KIND;
39
+ slot: string;
40
+ children: PlaceableNode[];
41
+ parent: ElementNode | null;
42
+ };
43
+ type LazyNode = {
44
+ kind: typeof LAZY_KIND;
45
+ typeName: string;
46
+ props: Props;
47
+ children: PlaceableNode[];
48
+ parent: ElementNode | null;
49
+ adopted: GObject.Object | null;
50
+ handlers: Map<string, HandlerRecord>;
51
+ dispatch: Dispatch;
52
+ };
53
+ type TextNode = {
54
+ kind: typeof TEXT_KIND;
55
+ text: string;
56
+ parent: ParentNode | null;
57
+ };
58
+ type PlaceableNode = ElementNode | LazyNode;
59
+ type ParentNode = ElementNode | PropNode | LazyNode;
60
+ type ContentChild = TextNode | ElementNode;
61
+ type Instance = ElementNode | PropNode | LazyNode;
62
+ type AnyNode = Instance | TextNode;
63
+ declare const ELEMENT_KIND = "element";
64
+ declare const PROP_KIND = "prop";
65
+ declare const TEXT_KIND = "text";
66
+ declare const LAZY_KIND = "lazy";
67
+ declare const DEFAULT_SLOT = "children";
68
+ declare const createPropNode: (slot: string) => PropNode;
69
+ declare const createLazyNode: (typeName: string, props: Props, dispatch: Dispatch) => LazyNode;
70
+ declare const createElementNode: (typeName: string, object: GObject.Object, dispatch: Dispatch, contentKind: ContentKind | null) => ElementNode;
71
+ declare const createTextNode: (text: string) => TextNode;
72
+ declare const nodeObject: (node: PlaceableNode) => GObject.Object | null;
73
+ declare const lazyTarget: (node: LazyNode, adopted: GObject.Object) => SignalTarget;
74
+ declare const getOrCreateContext: (node: ElementNode, behavior: ElementBehavior) => unknown;
75
+ export { ELEMENT_KIND, PROP_KIND, TEXT_KIND, LAZY_KIND, DEFAULT_SLOT, createPropNode, createLazyNode, createElementNode, createTextNode, nodeObject, lazyTarget, getOrCreateContext, type ContentKind, type HandlerRecord, type Dispatch, type SignalTarget, type PlacedChild, type ElementNode, type PropNode, type LazyNode, type TextNode, type PlaceableNode, type ParentNode, type ContentChild, type Instance, type AnyNode, };
76
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/reconciler/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5D,KAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AACzD,KAAK,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAC5G,KAAK,QAAQ,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,KAAK,OAAO,CAAC;AAE/C,KAAK,YAAY,GAAG;IAChB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACtB,CAAC;AAEF,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,M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AU,EACV,UAAU,EACV,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,OAAO,GACf,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { getOrInsert } from "@gtkx/utils";
2
+ const ELEMENT_KIND = "element";
3
+ const PROP_KIND = "prop";
4
+ const TEXT_KIND = "text";
5
+ const LAZY_KIND = "lazy";
6
+ const DEFAULT_SLOT = "children";
7
+ const createPropNode = (slot) => ({
8
+ kind: PROP_KIND,
9
+ slot,
10
+ children: [],
11
+ parent: null,
12
+ });
13
+ const createLazyNode = (typeName, props, dispatch) => ({
14
+ kind: LAZY_KIND,
15
+ typeName,
16
+ props,
17
+ children: [],
18
+ parent: null,
19
+ adopted: null,
20
+ handlers: new Map(),
21
+ dispatch,
22
+ });
23
+ const createElementNode = (typeName, object, dispatch, contentKind) => ({
24
+ kind: ELEMENT_KIND,
25
+ typeName,
26
+ object,
27
+ props: {},
28
+ handlers: new Map(),
29
+ placements: new Map(),
30
+ contexts: new Map(),
31
+ parent: null,
32
+ content: [],
33
+ contentKind,
34
+ bufferView: null,
35
+ dispatch,
36
+ });
37
+ const createTextNode = (text) => ({ kind: TEXT_KIND, text, parent: null });
38
+ const nodeObject = (node) => {
39
+ if (node.kind === LAZY_KIND) {
40
+ const [child] = node.children;
41
+ return child === undefined ? null : nodeObject(child);
42
+ }
43
+ return node.object;
44
+ };
45
+ const lazyTarget = (node, adopted) => ({
46
+ object: adopted,
47
+ handlers: node.handlers,
48
+ typeName: node.typeName,
49
+ dispatch: node.dispatch,
50
+ });
51
+ const getOrCreateContext = (node, behavior) => getOrInsert(node.contexts, behavior, () => behavior.createContext?.(node.object));
52
+ export { ELEMENT_KIND, PROP_KIND, TEXT_KIND, LAZY_KIND, DEFAULT_SLOT, createPropNode, createLazyNode, createElementNode, createTextNode, nodeObject, lazyTarget, getOrCreateContext, };
53
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/reconciler/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgE1C,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,CAAC;IAChD,IAAI,EAAE,SAAS;IACf,IAAI;IACJ,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,IAAI;CACf,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,KAAY,EAAE,QAAkB,EAAY,EAAE,CAAC,CAAC;IACtF,IAAI,EAAE,SAAS;IACf,QAAQ;IACR,KAAK;IACL,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI,GAAG,EAAE;IACnB,QAAQ;CACX,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CACtB,QAAgB,EAChB,MAAsB,EACtB,QAAkB,EAClB,WAA+B,EACpB,EAAE,CAAC,CAAC;IACf,IAAI,EAAE,YAAY;IAClB,QAAQ;IACR,MAAM;IACN,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,IAAI,GAAG,EAAE;IACnB,UAAU,EAAE,IAAI,GAAG,EAAE;IACrB,QAAQ,EAAE,IAAI,GAAG,EAAE;IACnB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,EAAE;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} from \"@gtkx/runtime\";\nimport { getOrInsert } from \"@gtkx/utils\";\nimport type { ElementBehavior, Props } from \"./registry.js\";\n\ntype ContentKind = \"label\" | \"buffer\" | \"tag\" | \"anchor\";\ntype HandlerRecord = { signal: string; handler: SignalHandler; wrapped: SignalHandler; blockable: boolean };\ntype Dispatch = (fn: () => unknown) => unknown;\n\ntype SignalTarget = {\n object: GObject.Object;\n handlers: Map<string, HandlerRecord>;\n typeName: string;\n dispatch: Dispatch;\n};\n\ntype PlacedChild = {\n node: PlaceableNode;\n object: GObject.Object;\n adopted: GObject.Object | null;\n slot: string;\n behavior: ElementBehavior | null;\n attached: boolean;\n};\n\ntype ElementNode = SignalTarget & {\n kind: typeof ELEMENT_KIND;\n props: Props;\n placements: Map<string, PlacedChild[]>;\n contexts: Map<ElementBehavior, unknown>;\n parent: ParentNode | null;\n content: ContentChild[];\n contentKind: ContentKind | null;\n bufferView: Gtk.TextView | null;\n};\n\ntype PropNode = {\n kind: typeof PROP_KIND;\n slot: string;\n children: PlaceableNode[];\n parent: ElementNode | null;\n};\n\ntype LazyNode = {\n kind: typeof LAZY_KIND;\n typeName: string;\n props: Props;\n children: PlaceableNode[];\n parent: ElementNode | null;\n adopted: GObject.Object | null;\n handlers: Map<string, HandlerRecord>;\n dispatch: Dispatch;\n};\n\ntype TextNode = {\n kind: typeof TEXT_KIND;\n text: string;\n parent: ParentNode | null;\n};\n\ntype PlaceableNode = ElementNode | LazyNode;\ntype ParentNode = ElementNode | PropNode | LazyNode;\ntype ContentChild = TextNode | ElementNode;\ntype Instance = ElementNode | PropNode | LazyNode;\ntype AnyNode = Instance | TextNode;\n\nconst ELEMENT_KIND = \"element\";\nconst PROP_KIND = \"prop\";\nconst TEXT_KIND = \"text\";\nconst LAZY_KIND = \"lazy\";\nconst DEFAULT_SLOT = \"children\";\n\nconst createPropNode = (slot: string): PropNode => ({\n kind: PROP_KIND,\n slot,\n children: [],\n parent: null,\n});\n\nconst createLazyNode = (typeName: string, props: Props, dispatch: Dispatch): LazyNode => ({\n kind: LAZY_KIND,\n typeName,\n props,\n children: [],\n parent: null,\n adopted: null,\n handlers: new Map(),\n dispatch,\n});\n\nconst createElementNode = (\n typeName: string,\n object: GObject.Object,\n dispatch: Dispatch,\n contentKind: ContentKind | null,\n): ElementNode => ({\n kind: ELEMENT_KIND,\n typeName,\n object,\n props: {},\n handlers: new Map(),\n placements: new Map(),\n contexts: new Map(),\n parent: null,\n content: [],\n contentKind,\n bufferView: null,\n dispatch,\n});\n\nconst createTextNode = (text: string): TextNode => ({ kind: TEXT_KIND, text, parent: null });\n\nconst nodeObject = (node: PlaceableNode): GObject.Object | null => {\n if (node.kind === LAZY_KIND) {\n const [child] = node.children;\n\n return child === undefined ? null : nodeObject(child);\n }\n\n return node.object;\n};\n\nconst lazyTarget = (node: LazyNode, adopted: GObject.Object): SignalTarget => ({\n object: adopted,\n handlers: node.handlers,\n typeName: node.typeName,\n dispatch: node.dispatch,\n});\n\nconst getOrCreateContext = (node: ElementNode, behavior: ElementBehavior): unknown =>\n getOrInsert(node.contexts, behavior, () => behavior.createContext?.(node.object));\n\nexport {\n ELEMENT_KIND,\n PROP_KIND,\n TEXT_KIND,\n LAZY_KIND,\n DEFAULT_SLOT,\n createPropNode,\n createLazyNode,\n createElementNode,\n createTextNode,\n nodeObject,\n lazyTarget,\n getOrCreateContext,\n type ContentKind,\n type HandlerRecord,\n type Dispatch,\n type SignalTarget,\n type PlacedChild,\n type ElementNode,\n type PropNode,\n type LazyNode,\n type TextNode,\n type PlaceableNode,\n type ParentNode,\n type ContentChild,\n type Instance,\n type AnyNode,\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import { type ElementNode, type PlaceableNode } from "./node.js";
2
+ declare const placeChild: (parent: ElementNode, slot: string, node: PlaceableNode, before: PlaceableNode | null) => void;
3
+ declare const unplaceChild: (parent: ElementNode, slot: string, node: PlaceableNode) => void;
4
+ export { placeChild, unplaceChild };
5
+ //# sourceMappingURL=placement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../../src/reconciler/placement.ts"],"names":[],"mappings":"AAMA,OAAO,EAGH,KAAK,WAAW,EAKhB,KAAK,aAAa,EAErB,MAAM,WAAW,CAAC;AAwLnB,QAAA,MAAM,UAAU,GACZ,QAAQ,WAAW,EACnB,MAAM,MAAM,EACZ,MAAM,aAAa,EACnB,QAAQ,aAAa,GAAG,IAAI,KAC7B,IAyBF,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,QAAQ,WAAW,EAAE,MAAM,MAAM,EAAE,MAAM,aAAa,KAAG,IAoB9E,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,175 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { getOrInsert, indexBeforeOrEnd, remove } from "@gtkx/utils";
4
+ import { applyAdoptedProps, markFlush } from "./apply-props.js";
5
+ import { typeInfoFor } from "./metadata.js";
6
+ import { DEFAULT_SLOT, ELEMENT_KIND, getOrCreateContext, LAZY_KIND, lazyTarget, nodeObject, } from "./node.js";
7
+ import { markTextDirty } from "./text.js";
8
+ const createEntry = (slot, node) => {
9
+ const object = nodeObject(node);
10
+ if (object === null) {
11
+ return null;
12
+ }
13
+ return { node, object, adopted: null, slot, behavior: null, attached: false };
14
+ };
15
+ const siblingAt = (entries, index) => index > 0 ? (entries[index - 1]?.object ?? null) : null;
16
+ const placeInfo = (entry, index, sibling, context) => ({
17
+ slot: entry.slot,
18
+ index,
19
+ sibling,
20
+ adopted: entry.adopted,
21
+ props: entry.node.props,
22
+ context,
23
+ });
24
+ const adoptedFrom = (parent, entry, behavior, claim) => {
25
+ if (behavior.resolve !== undefined) {
26
+ entry.adopted = behavior.resolve(parent.object, entry.object);
27
+ return;
28
+ }
29
+ entry.adopted = claim instanceof GObject.Object ? claim : null;
30
+ };
31
+ const applyLazyProps = (entry) => {
32
+ if (entry.node.kind !== LAZY_KIND || entry.adopted === null) {
33
+ return;
34
+ }
35
+ applyAdoptedProps(lazyTarget(entry.node, entry.adopted), {}, entry.node.props);
36
+ entry.node.adopted = entry.adopted;
37
+ };
38
+ const wireBufferView = (node, parent) => {
39
+ if (!(node.kind === ELEMENT_KIND && node.contentKind === "buffer" && parent.object instanceof Gtk.TextView)) {
40
+ return;
41
+ }
42
+ node.bufferView = parent.object;
43
+ markTextDirty(node);
44
+ };
45
+ const setObjectSlot = (parent, entry) => {
46
+ Reflect.set(parent.object, entry.slot, entry.object);
47
+ wireBufferView(entry.node, parent);
48
+ entry.behavior = null;
49
+ entry.attached = true;
50
+ };
51
+ const didAttach = (ctx, behavior) => {
52
+ const attach = behavior.attach;
53
+ if (attach === undefined) {
54
+ return false;
55
+ }
56
+ const context = getOrCreateContext(ctx.parent, behavior);
57
+ const claim = attach(ctx.parent.object, ctx.entry.object, placeInfo(ctx.entry, ctx.index, ctx.sibling, context));
58
+ if (claim === undefined) {
59
+ return false;
60
+ }
61
+ ctx.entry.behavior = behavior;
62
+ adoptedFrom(ctx.parent, ctx.entry, behavior, claim);
63
+ ctx.entry.attached = true;
64
+ applyLazyProps(ctx.entry);
65
+ return true;
66
+ };
67
+ const attachEntry = (parent, entry, index, sibling) => {
68
+ const ctx = { parent, entry, index, sibling };
69
+ for (const behavior of typeInfoFor(parent.typeName).behaviors) {
70
+ if (didAttach(ctx, behavior)) {
71
+ return;
72
+ }
73
+ }
74
+ if (entry.slot !== DEFAULT_SLOT) {
75
+ setObjectSlot(parent, entry);
76
+ }
77
+ };
78
+ const detachInfo = (entry, context) => ({
79
+ slot: entry.slot,
80
+ adopted: entry.adopted,
81
+ props: entry.node.props,
82
+ context,
83
+ });
84
+ const detachEntry = (parent, entry) => {
85
+ if (!entry.attached) {
86
+ return;
87
+ }
88
+ entry.attached = false;
89
+ const behavior = entry.behavior;
90
+ if (behavior === null) {
91
+ if (entry.slot !== DEFAULT_SLOT) {
92
+ Reflect.set(parent.object, entry.slot, null);
93
+ }
94
+ return;
95
+ }
96
+ behavior.detach?.(parent.object, entry.object, detachInfo(entry, getOrCreateContext(parent, behavior)));
97
+ };
98
+ const rebuild = (parent, entries) => {
99
+ for (const entry of entries) {
100
+ detachEntry(parent, entry);
101
+ }
102
+ for (const [index, entry] of entries.entries()) {
103
+ entry.behavior = null;
104
+ attachEntry(parent, entry, index, siblingAt(entries, index));
105
+ }
106
+ };
107
+ const getPosition = (entries, before) => indexBeforeOrEnd(entries, before, (entry, target) => entry.node === target);
108
+ const placeNew = (parent, entry, entries, index) => {
109
+ attachEntry(parent, entry, index, siblingAt(entries, index));
110
+ if (!entry.attached) {
111
+ remove(entries, entry);
112
+ return;
113
+ }
114
+ const isInsertedBeforeEnd = index < entries.length - 1;
115
+ const isCannotReorderInPlace = entry.behavior !== null && entry.behavior.reorder === undefined;
116
+ if (isInsertedBeforeEnd && isCannotReorderInPlace) {
117
+ rebuild(parent, entries);
118
+ }
119
+ };
120
+ const moveEntry = (parent, entry, entries, index) => {
121
+ const behavior = entry.behavior;
122
+ const reorder = behavior?.reorder;
123
+ if (behavior === null || reorder === undefined) {
124
+ rebuild(parent, entries);
125
+ return;
126
+ }
127
+ const context = getOrCreateContext(parent, behavior);
128
+ const claim = reorder(parent.object, entry.object, placeInfo(entry, index, siblingAt(entries, index), context));
129
+ adoptedFrom(parent, entry, behavior, claim);
130
+ applyLazyProps(entry);
131
+ };
132
+ const resolveEntry = (entries, existing, slot, node) => {
133
+ if (existing >= 0) {
134
+ return entries[existing] ?? null;
135
+ }
136
+ return createEntry(slot, node);
137
+ };
138
+ const placeChild = (parent, slot, node, before) => {
139
+ const entries = getOrInsert(parent.placements, slot, () => []);
140
+ const existing = entries.findIndex((entry) => entry.node === node);
141
+ const entry = resolveEntry(entries, existing, slot, node);
142
+ if (entry === null) {
143
+ return;
144
+ }
145
+ const isMove = existing !== -1;
146
+ if (isMove) {
147
+ entries.splice(existing, 1);
148
+ }
149
+ const index = getPosition(entries, before);
150
+ entries.splice(index, 0, entry);
151
+ if (isMove) {
152
+ moveEntry(parent, entry, entries, index);
153
+ }
154
+ else {
155
+ placeNew(parent, entry, entries, index);
156
+ }
157
+ markFlush(parent);
158
+ };
159
+ const unplaceChild = (parent, slot, node) => {
160
+ const entries = parent.placements.get(slot);
161
+ if (entries === undefined) {
162
+ return;
163
+ }
164
+ const index = entries.findIndex((entry) => entry.node === node);
165
+ if (index === -1) {
166
+ return;
167
+ }
168
+ const [entry] = entries.splice(index, 1);
169
+ if (entry !== undefined) {
170
+ detachEntry(parent, entry);
171
+ }
172
+ markFlush(parent);
173
+ };
174
+ export { placeChild, unplaceChild };
175
+ //# sourceMappingURL=placement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/reconciler/placement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACH,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,GAGb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,IAAmB,EAAsB,EAAE;IAC1E,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,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AK,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACJ,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,MAAmB,EAAE,IAAY,EAAE,IAAmB,EAAQ,EAAE;IAClF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACX,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAEhE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { getOrInsert, indexBeforeOrEnd, remove } from \"@gtkx/utils\";\nimport type { DetachInfo, ElementBehavior, PlaceInfo } from \"./registry.js\";\nimport { applyAdoptedProps, markFlush } from \"./apply-props.js\";\nimport { typeInfoFor } from \"./metadata.js\";\nimport {\n DEFAULT_SLOT,\n ELEMENT_KIND,\n type ElementNode,\n getOrCreateContext,\n LAZY_KIND,\n lazyTarget,\n nodeObject,\n type PlaceableNode,\n type PlacedChild,\n} from \"./node.js\";\nimport { markTextDirty } from \"./text.js\";\n\ntype AttachContext = { parent: ElementNode; entry: PlacedChild; index: number; sibling: GObject.Object | null };\n\nconst createEntry = (slot: string, node: PlaceableNode): PlacedChild | null => {\n const object = nodeObject(node);\n\n if (object === null) {\n return null;\n }\n\n return { node, object, adopted: null, slot, behavior: null, attached: false };\n};\n\nconst siblingAt = (entries: PlacedChild[], index: number): GObject.Object | null =>\n index > 0 ? (entries[index - 1]?.object ?? null) : null;\n\nconst placeInfo = (entry: PlacedChild, index: number, sibling: GObject.Object | null, context: unknown): PlaceInfo => ({\n slot: entry.slot,\n index,\n sibling,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst adoptedFrom = (parent: ElementNode, entry: PlacedChild, behavior: ElementBehavior, claim: unknown): void => {\n if (behavior.resolve !== undefined) {\n entry.adopted = behavior.resolve(parent.object, entry.object);\n\n return;\n }\n\n entry.adopted = claim instanceof GObject.Object ? claim : null;\n};\n\nconst applyLazyProps = (entry: PlacedChild): void => {\n if (entry.node.kind !== LAZY_KIND || entry.adopted === null) {\n return;\n }\n\n applyAdoptedProps(lazyTarget(entry.node, entry.adopted), {}, entry.node.props);\n entry.node.adopted = entry.adopted;\n};\n\nconst wireBufferView = (node: PlaceableNode, parent: ElementNode): void => {\n if (!(node.kind === ELEMENT_KIND && node.contentKind === \"buffer\" && parent.object instanceof Gtk.TextView)) {\n return;\n }\n\n node.bufferView = parent.object;\n markTextDirty(node);\n};\n\nconst setObjectSlot = (parent: ElementNode, entry: PlacedChild): void => {\n Reflect.set(parent.object, entry.slot, entry.object);\n wireBufferView(entry.node, parent);\n entry.behavior = null;\n entry.attached = true;\n};\n\nconst didAttach = (ctx: AttachContext, behavior: ElementBehavior): boolean => {\n const attach = behavior.attach;\n\n if (attach === undefined) {\n return false;\n }\n\n const context = getOrCreateContext(ctx.parent, behavior);\n const claim = attach(ctx.parent.object, ctx.entry.object, placeInfo(ctx.entry, ctx.index, ctx.sibling, context));\n\n if (claim === undefined) {\n return false;\n }\n\n ctx.entry.behavior = behavior;\n adoptedFrom(ctx.parent, ctx.entry, behavior, claim);\n ctx.entry.attached = true;\n applyLazyProps(ctx.entry);\n\n return true;\n};\n\nconst attachEntry = (parent: ElementNode, entry: PlacedChild, index: number, sibling: GObject.Object | null): void => {\n const ctx: AttachContext = { parent, entry, index, sibling };\n\n for (const behavior of typeInfoFor(parent.typeName).behaviors) {\n if (didAttach(ctx, behavior)) {\n return;\n }\n }\n\n if (entry.slot !== DEFAULT_SLOT) {\n setObjectSlot(parent, entry);\n }\n};\n\nconst detachInfo = (entry: PlacedChild, context: unknown): DetachInfo => ({\n slot: entry.slot,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst detachEntry = (parent: ElementNode, entry: PlacedChild): void => {\n if (!entry.attached) {\n return;\n }\n\n entry.attached = false;\n const behavior = entry.behavior;\n\n if (behavior === null) {\n if (entry.slot !== DEFAULT_SLOT) {\n Reflect.set(parent.object, entry.slot, null);\n }\n\n return;\n }\n\n behavior.detach?.(parent.object, entry.object, detachInfo(entry, getOrCreateContext(parent, behavior)));\n};\n\nconst rebuild = (parent: ElementNode, entries: PlacedChild[]): void => {\n for (const entry of entries) {\n detachEntry(parent, entry);\n }\n\n for (const [index, entry] of entries.entries()) {\n entry.behavior = null;\n attachEntry(parent, entry, index, siblingAt(entries, index));\n }\n};\n\nconst getPosition = (entries: PlacedChild[], before: PlaceableNode | null): number =>\n indexBeforeOrEnd(entries, before, (entry, target) => entry.node === target);\n\nconst placeNew = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n attachEntry(parent, entry, index, siblingAt(entries, index));\n\n if (!entry.attached) {\n remove(entries, entry);\n\n return;\n }\n\n const isInsertedBeforeEnd = index < entries.length - 1;\n const isCannotReorderInPlace = entry.behavior !== null && entry.behavior.reorder === undefined;\n\n if (isInsertedBeforeEnd && isCannotReorderInPlace) {\n rebuild(parent, entries);\n }\n};\n\nconst moveEntry = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n const behavior = entry.behavior;\n const reorder = behavior?.reorder;\n\n if (behavior === null || reorder === undefined) {\n rebuild(parent, entries);\n\n return;\n }\n\n const context = getOrCreateContext(parent, behavior);\n const claim = reorder(parent.object, entry.object, placeInfo(entry, index, siblingAt(entries, index), context));\n adoptedFrom(parent, entry, behavior, claim);\n applyLazyProps(entry);\n};\n\nconst resolveEntry = (\n entries: PlacedChild[],\n existing: number,\n slot: string,\n node: PlaceableNode,\n): PlacedChild | null => {\n if (existing >= 0) {\n return entries[existing] ?? null;\n }\n\n return createEntry(slot, node);\n};\n\nconst placeChild = (\n parent: ElementNode,\n slot: string,\n node: PlaceableNode,\n before: PlaceableNode | null,\n): void => {\n const entries = getOrInsert(parent.placements, slot, () => []);\n const existing = entries.findIndex((entry) => entry.node === node);\n const entry = resolveEntry(entries, existing, slot, node);\n\n if (entry === null) {\n return;\n }\n\n const isMove = existing !== -1;\n\n if (isMove) {\n entries.splice(existing, 1);\n }\n\n const index = getPosition(entries, before);\n entries.splice(index, 0, entry);\n\n if (isMove) {\n moveEntry(parent, entry, entries, index);\n } else {\n placeNew(parent, entry, entries, index);\n }\n\n markFlush(parent);\n};\n\nconst unplaceChild = (parent: ElementNode, slot: string, node: PlaceableNode): void => {\n const entries = parent.placements.get(slot);\n\n if (entries === undefined) {\n return;\n }\n\n const index = entries.findIndex((entry) => entry.node === node);\n\n if (index === -1) {\n return;\n }\n\n const [entry] = entries.splice(index, 1);\n\n if (entry !== undefined) {\n detachEntry(parent, entry);\n }\n\n markFlush(parent);\n};\n\nexport { placeChild, unplaceChild };\n"]}
@@ -0,0 +1,92 @@
1
+ import type * as GObject from "@gtkx/gi/gobject";
2
+ /** The props of a host element or node, as React passes them through the reconciler. */
3
+ type Props = Record<string, unknown>;
4
+ /** Per-child values a slot hook receives while placing or moving one child. */
5
+ type PlaceInfo = {
6
+ slot: string;
7
+ index: number;
8
+ sibling: GObject.Object | null;
9
+ adopted: GObject.Object | null;
10
+ props: Props;
11
+ context: unknown;
12
+ };
13
+ /** Per-child values a slot hook receives while removing one child. */
14
+ type DetachInfo = {
15
+ slot: string;
16
+ adopted: GObject.Object | null;
17
+ props: Props;
18
+ context: unknown;
19
+ };
20
+ /**
21
+ * Customizes how one element type places children and applies props. Every hook receives the
22
+ * GObject instance and a private per-node `context` built once by `createContext`. A slot hook
23
+ * claims a child by returning a non-`undefined` value; that value, or `resolve`, is the object
24
+ * the container adopts for the child. `update` returns the prop names it consumed so those props
25
+ * are not also set as plain GObject properties. `create` builds the GObject for types whose
26
+ * constructor does more than set properties, and is consulted for its own type only, never
27
+ * inherited by subtypes.
28
+ */
29
+ type ElementBehavior<T extends GObject.Object = GObject.Object> = {
30
+ create?: (props: Props) => GObject.Object;
31
+ createContext?: (object: T) => unknown;
32
+ attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;
33
+ reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;
34
+ detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;
35
+ resolve?: (object: T, child: GObject.Object) => GObject.Object | null;
36
+ update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;
37
+ flush?: (object: T, context: unknown) => void;
38
+ mount?: (object: T, context: unknown) => void;
39
+ unmount?: (object: T, context: unknown) => void;
40
+ deferred?: string[];
41
+ };
42
+ /** A named export in a module, referenced as plain data (the module is never imported at runtime). */
43
+ type ModuleExport = {
44
+ module: string;
45
+ export: string;
46
+ };
47
+ /**
48
+ * Per-element configuration keyed by GLib type name: whether the element is lazy (its GObject is
49
+ * created by its parent container, as pages and layout children are), the custom behaviors bound to
50
+ * its type, an optional component that wraps the generated element, and the base props interface its
51
+ * generated props extend. `component` and `props` are inert at runtime; they are read only by codegen.
52
+ */
53
+ type ElementConfig<T extends GObject.Object = GObject.Object> = {
54
+ lazy?: boolean;
55
+ behaviors?: ElementBehavior<T>[];
56
+ component?: ModuleExport;
57
+ props?: ModuleExport;
58
+ };
59
+ /**
60
+ * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`
61
+ * is loaded.
62
+ */
63
+ declare const ELEMENTS: Record<string, ElementConfig>;
64
+ /** Props a behavior applies after construction; the constructor is never given them. */
65
+ declare const deferredProps: (behavior: ElementBehavior) => string[];
66
+ /**
67
+ * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's
68
+ * behaviors in the order the maps are given (an earlier map's behaviors come first) and taking the last
69
+ * lazy flag, component, and props seen. Use it to combine an app's element config with its behaviors.
70
+ */
71
+ declare const mergeElementConfigs: (...maps: Record<string, ElementConfig<never>>[]) => Record<string, ElementConfig>;
72
+ /**
73
+ * Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the
74
+ * registry. Behaviors are appended by default (the framework's built-ins register this way); pass
75
+ * `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the
76
+ * built-ins for the same slot, letting it override them regardless of registration order.
77
+ */
78
+ declare const registerElements: (map: Record<string, ElementConfig<never>>, options?: {
79
+ prepend?: boolean;
80
+ }) => void;
81
+ /**
82
+ * Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling
83
+ * editor autocompletion and type checking. Key each entry by GLib type name and annotate each hook's
84
+ * object parameter with the concrete GObject class the behavior applies to.
85
+ */
86
+ declare const defineElements: (elements: Record<string, ElementConfig<never>>) => Record<string, ElementConfig<never>>;
87
+ /** Spreads one config across many GLib type names. */
88
+ declare const forTypes: (types: string[], config: ElementConfig<never>) => Record<string, ElementConfig<never>>;
89
+ /** References a base props interface exported from `@gtkx/react/internal`. */
90
+ declare const internal: (name: string) => ModuleExport;
91
+ export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, forTypes, internal, type Props, type PlaceInfo, type DetachInfo, type ElementBehavior, type ModuleExport, type ElementConfig, };
92
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","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;;;GAIG;AACH,QAAA,MAAM,mBAAmB,GAAI,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAU1G,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,GAClB,KAAK,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EACzC,UAAS;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,KACpC,IAIF,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,cAAc,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAChG,CAAC;AAEb,sDAAsD;AACtD,QAAA,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,EAAE,QAAQ,aAAa,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAC1C,CAAC;AAE5D,8EAA8E;AAC9E,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,YAAkE,CAAC;AAEpG,OAAO,EACH,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACrB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`
3
+ * is loaded.
4
+ */
5
+ const ELEMENTS = {};
6
+ /** Props a behavior applies after construction; the constructor is never given them. */
7
+ const deferredProps = (behavior) => behavior.deferred ?? [];
8
+ const mergeBehaviors = (base, added, isPrepended) => {
9
+ const baseBehaviors = base.behaviors ?? [];
10
+ return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];
11
+ };
12
+ const mergeConfigEntry = (base, added, isPrepended = false) => {
13
+ const entry = { ...base };
14
+ if (added.behaviors !== undefined) {
15
+ entry.behaviors = mergeBehaviors(entry, added.behaviors, isPrepended);
16
+ }
17
+ if (added.lazy === true) {
18
+ entry.lazy = true;
19
+ }
20
+ if (added.component !== undefined) {
21
+ entry.component = added.component;
22
+ }
23
+ if (added.props !== undefined) {
24
+ entry.props = added.props;
25
+ }
26
+ return entry;
27
+ };
28
+ /**
29
+ * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's
30
+ * behaviors in the order the maps are given (an earlier map's behaviors come first) and taking the last
31
+ * lazy flag, component, and props seen. Use it to combine an app's element config with its behaviors.
32
+ */
33
+ const mergeElementConfigs = (...maps) => {
34
+ const merged = {};
35
+ for (const map of maps) {
36
+ for (const [type, config] of Object.entries(map)) {
37
+ merged[type] = mergeConfigEntry(merged[type] ?? {}, config);
38
+ }
39
+ }
40
+ return merged;
41
+ };
42
+ /**
43
+ * Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the
44
+ * registry. Behaviors are appended by default (the framework's built-ins register this way); pass
45
+ * `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the
46
+ * built-ins for the same slot, letting it override them regardless of registration order.
47
+ */
48
+ const registerElements = (map, options = {}) => {
49
+ for (const [type, config] of Object.entries(map)) {
50
+ ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.prepend === true);
51
+ }
52
+ };
53
+ /**
54
+ * Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling
55
+ * editor autocompletion and type checking. Key each entry by GLib type name and annotate each hook's
56
+ * object parameter with the concrete GObject class the behavior applies to.
57
+ */
58
+ const defineElements = (elements) => elements;
59
+ /** Spreads one config across many GLib type names. */
60
+ const forTypes = (types, config) => Object.fromEntries(types.map((type) => [type, config]));
61
+ /** References a base props interface exported from `@gtkx/react/internal`. */
62
+ const internal = (name) => ({ module: "@gtkx/react/internal", export: name });
63
+ export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, forTypes, internal, };
64
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AA8DA;;;GAGG;AACH,MAAM,QAAQ,GAAkC,EAAE,CAAC;AAEnD,wFAAwF;AACxF,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAY,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;AAEvF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAE,KAAwB,EAAE,WAAoB,EAAqB,EAAE;IAC9G,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAE3C,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAAE,KAA2B,EAAE,WAAW,GAAG,KAAK,EAAiB,EAAE;IAC9G,MAAM,KAAK,GAAkB,EAAE,GAAG,IAAI,EAAE,CAAC;IAEzC,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAChC,KAAK,CAAC,SAAS,GAAG,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,SAA8B,EAAE,WAAW,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAChC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACtC,CAAC;I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AE,MAAM,CAAC,CAAC,CAAC,CAAC;AAE5D,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpG,OAAO,EACH,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,GAOX,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\n\n/** The props of a host element or node, as React passes them through the reconciler. */\ntype Props = Record<string, unknown>;\n\n/** Per-child values a slot hook receives while placing or moving one child. */\ntype PlaceInfo = {\n slot: string;\n index: number;\n sibling: GObject.Object | null;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/** Per-child values a slot hook receives while removing one child. */\ntype DetachInfo = {\n slot: string;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/**\n * Customizes how one element type places children and applies props. Every hook receives the\n * GObject instance and a private per-node `context` built once by `createContext`. A slot hook\n * claims a child by returning a non-`undefined` value; that value, or `resolve`, is the object\n * the container adopts for the child. `update` returns the prop names it consumed so those props\n * are not also set as plain GObject properties. `create` builds the GObject for types whose\n * constructor does more than set properties, and is consulted for its own type only, never\n * inherited by subtypes.\n */\ntype ElementBehavior<T extends GObject.Object = GObject.Object> = {\n create?: (props: Props) => GObject.Object;\n createContext?: (object: T) => unknown;\n attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;\n resolve?: (object: T, child: GObject.Object) => GObject.Object | null;\n update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;\n flush?: (object: T, context: unknown) => void;\n mount?: (object: T, context: unknown) => void;\n unmount?: (object: T, context: unknown) => void;\n deferred?: string[];\n};\n\n/** A named export in a module, referenced as plain data (the module is never imported at runtime). */\ntype ModuleExport = { module: string; export: string };\n\n/**\n * Per-element configuration keyed by GLib type name: whether the element is lazy (its GObject is\n * created by its parent container, as pages and layout children are), the custom behaviors bound to\n * its type, an optional component that wraps the generated element, and the base props interface its\n * generated props extend. `component` and `props` are inert at runtime; they are read only by codegen.\n */\ntype ElementConfig<T extends GObject.Object = GObject.Object> = {\n lazy?: boolean;\n behaviors?: ElementBehavior<T>[];\n component?: ModuleExport;\n props?: ModuleExport;\n};\n\n/**\n * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`\n * is loaded.\n */\nconst ELEMENTS: Record<string, ElementConfig> = {};\n\n/** Props a behavior applies after construction; the constructor is never given them. */\nconst deferredProps = (behavior: ElementBehavior): string[] => behavior.deferred ?? [];\n\nconst mergeBehaviors = (base: ElementConfig, added: ElementBehavior[], isPrepended: boolean): ElementBehavior[] => {\n const baseBehaviors = base.behaviors ?? [];\n\n return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];\n};\n\nconst mergeConfigEntry = (base: ElementConfig, added: ElementConfig<never>, isPrepended = false): ElementConfig => {\n const entry: ElementConfig = { ...base };\n\n if (added.behaviors !== undefined) {\n entry.behaviors = mergeBehaviors(entry, added.behaviors as ElementBehavior[], isPrepended);\n }\n\n if (added.lazy === true) {\n entry.lazy = true;\n }\n\n if (added.component !== undefined) {\n entry.component = added.component;\n }\n\n if (added.props !== undefined) {\n entry.props = added.props;\n }\n\n return entry;\n};\n\n/**\n * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's\n * behaviors in the order the maps are given (an earlier map's behaviors come first) and taking the last\n * lazy flag, component, and props seen. Use it to combine an app's element config with its behaviors.\n */\nconst mergeElementConfigs = (...maps: Record<string, ElementConfig<never>>[]): Record<string, ElementConfig> => {\n const merged: Record<string, ElementConfig> = {};\n\n for (const map of maps) {\n for (const [type, config] of Object.entries(map)) {\n merged[type] = mergeConfigEntry(merged[type] ?? {}, config);\n }\n }\n\n return merged;\n};\n\n/**\n * Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the\n * registry. Behaviors are appended by default (the framework's built-ins register this way); pass\n * `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the\n * built-ins for the same slot, letting it override them regardless of registration order.\n */\nconst registerElements = (\n map: Record<string, ElementConfig<never>>,\n options: { prepend?: boolean } = {},\n): void => {\n for (const [type, config] of Object.entries(map)) {\n ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.prepend === true);\n }\n};\n\n/**\n * Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling\n * editor autocompletion and type checking. Key each entry by GLib type name and annotate each hook's\n * object parameter with the concrete GObject class the behavior applies to.\n */\nconst defineElements = (elements: Record<string, ElementConfig<never>>): Record<string, ElementConfig<never>> =>\n elements;\n\n/** Spreads one config across many GLib type names. */\nconst forTypes = (types: string[], config: ElementConfig<never>): Record<string, ElementConfig<never>> =>\n Object.fromEntries(types.map((type) => [type, config]));\n\n/** References a base props interface exported from `@gtkx/react/internal`. */\nconst internal = (name: string): ModuleExport => ({ module: \"@gtkx/react/internal\", export: name });\n\nexport {\n ELEMENTS,\n deferredProps,\n mergeElementConfigs,\n registerElements,\n defineElements,\n forTypes,\n internal,\n type Props,\n type PlaceInfo,\n type DetachInfo,\n type ElementBehavior,\n type ModuleExport,\n type ElementConfig,\n};\n"]}
@@ -0,0 +1,11 @@
1
+ /** The type of the shared {@link rootElement} marker used as a default top-level container. */
2
+ type RootElement = {
3
+ [ROOT_ELEMENT_BRAND]: true;
4
+ };
5
+ declare const ROOT_ELEMENT_BRAND: unique symbol;
6
+ /** A shared marker value used as the default top-level container for rendering and portals. */
7
+ declare const rootElement: RootElement;
8
+ /** Reports whether an arbitrary value is a {@link rootElement} marker. */
9
+ declare const isRootElement: (value: unknown) => value is RootElement;
10
+ export { rootElement, isRootElement, type RootElement };
11
+ //# sourceMappingURL=root-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-element.d.ts","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,KAAK,WAAW,GAAG;IAAE,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAElD,QAAA,MAAM,kBAAkB,EAAE,OAAO,MAAwC,CAAC;AAC1E,+FAA+F;AAC/F,QAAA,MAAM,WAAW,EAAE,WAA4C,CAAC;AAEhE,0EAA0E;AAC1E,QAAA,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAC0C,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ const ROOT_ELEMENT_BRAND = Symbol.for("gtkx:root-element");
2
+ /** A shared marker value used as the default top-level container for rendering and portals. */
3
+ const rootElement = { [ROOT_ELEMENT_BRAND]: true };
4
+ /** Reports whether an arbitrary value is a {@link rootElement} marker. */
5
+ const isRootElement = (value) => typeof value === "object" && value !== null && Object.hasOwn(value, ROOT_ELEMENT_BRAND);
6
+ export { rootElement, isRootElement };
7
+ //# sourceMappingURL=root-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-element.js","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB,GAAkB,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAC1E,+FAA+F;AAC/F,MAAM,WAAW,GAAgB,EAAE,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAoB,CAAC","sourcesContent":["/** The type of the shared {@link rootElement} marker used as a default top-level container. */\ntype RootElement = { [ROOT_ELEMENT_BRAND]: true };\n\nconst ROOT_ELEMENT_BRAND: unique symbol = Symbol.for(\"gtkx:root-element\");\n/** A shared marker value used as the default top-level container for rendering and portals. */\nconst rootElement: RootElement = { [ROOT_ELEMENT_BRAND]: true };\n\n/** Reports whether an arbitrary value is a {@link rootElement} marker. */\nconst isRootElement = (value: unknown): value is RootElement =>\n typeof value === \"object\" && value !== null && Object.hasOwn(value, ROOT_ELEMENT_BRAND);\n\nexport { rootElement, isRootElement, type RootElement };\n"]}