@gtkx/react 0.20.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (596) hide show
  1. package/README.md +122 -55
  2. package/dist/components/application.d.ts +10 -0
  3. package/dist/components/application.d.ts.map +1 -0
  4. package/dist/components/application.js +26 -0
  5. package/dist/components/application.js.map +1 -0
  6. package/dist/components/window.d.ts +8 -0
  7. package/dist/components/window.d.ts.map +1 -0
  8. package/dist/components/window.js +23 -0
  9. package/dist/components/window.js.map +1 -0
  10. package/dist/hooks/use-application.d.ts +8 -0
  11. package/dist/hooks/use-application.d.ts.map +1 -0
  12. package/dist/hooks/use-application.js +13 -0
  13. package/dist/hooks/use-application.js.map +1 -0
  14. package/dist/hooks/use-bind-setting.d.ts +6 -0
  15. package/dist/hooks/use-bind-setting.d.ts.map +1 -0
  16. package/dist/hooks/use-bind-setting.js +19 -0
  17. package/dist/hooks/use-bind-setting.js.map +1 -0
  18. package/dist/hooks/use-merge-refs.d.ts +3 -0
  19. package/dist/hooks/use-merge-refs.d.ts.map +1 -0
  20. package/dist/hooks/use-merge-refs.js +48 -0
  21. package/dist/hooks/use-merge-refs.js.map +1 -0
  22. package/dist/hooks/use-object-attachment.d.ts +10 -0
  23. package/dist/hooks/use-object-attachment.d.ts.map +1 -0
  24. package/dist/hooks/use-object-attachment.js +24 -0
  25. package/dist/hooks/use-object-attachment.js.map +1 -0
  26. package/dist/hooks/use-object-value.d.ts +4 -0
  27. package/dist/hooks/use-object-value.d.ts.map +1 -0
  28. package/dist/hooks/use-object-value.js +32 -0
  29. package/dist/hooks/use-object-value.js.map +1 -0
  30. package/dist/hooks/use-parent-window.d.ts +8 -0
  31. package/dist/hooks/use-parent-window.d.ts.map +1 -0
  32. package/dist/hooks/use-parent-window.js +7 -0
  33. package/dist/hooks/use-parent-window.js.map +1 -0
  34. package/dist/hooks/use-property.d.ts +14 -0
  35. package/dist/hooks/use-property.d.ts.map +1 -0
  36. package/dist/hooks/use-property.js +13 -0
  37. package/dist/hooks/use-property.js.map +1 -0
  38. package/dist/hooks/use-setting.d.ts +25 -0
  39. package/dist/hooks/use-setting.d.ts.map +1 -0
  40. package/dist/hooks/use-setting.js +15 -0
  41. package/dist/hooks/use-setting.js.map +1 -0
  42. package/dist/hooks/use-signal.d.ts +21 -0
  43. package/dist/hooks/use-signal.d.ts.map +1 -0
  44. package/dist/hooks/use-signal.js +20 -0
  45. package/dist/hooks/use-signal.js.map +1 -0
  46. package/dist/index.d.ts +14 -5
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +10 -5
  49. package/dist/index.js.map +1 -1
  50. package/dist/internal.d.ts +14 -0
  51. package/dist/internal.d.ts.map +1 -0
  52. package/dist/internal.js +14 -0
  53. package/dist/internal.js.map +1 -0
  54. package/dist/libraries/adw/dialog.d.ts +8 -0
  55. package/dist/libraries/adw/dialog.d.ts.map +1 -0
  56. package/dist/libraries/adw/dialog.js +25 -0
  57. package/dist/libraries/adw/dialog.js.map +1 -0
  58. package/dist/libraries/adw/index.d.ts +2 -0
  59. package/dist/libraries/adw/index.d.ts.map +1 -0
  60. package/dist/libraries/adw/index.js +2 -0
  61. package/dist/libraries/adw/index.js.map +1 -0
  62. package/dist/reconciler/accessible.d.ts +59 -0
  63. package/dist/reconciler/accessible.d.ts.map +1 -0
  64. package/dist/reconciler/accessible.js +143 -0
  65. package/dist/reconciler/accessible.js.map +1 -0
  66. package/dist/reconciler/apply-props.d.ts +8 -0
  67. package/dist/reconciler/apply-props.d.ts.map +1 -0
  68. package/dist/reconciler/apply-props.js +92 -0
  69. package/dist/reconciler/apply-props.js.map +1 -0
  70. package/dist/reconciler/commit-flush.d.ts +3 -0
  71. package/dist/reconciler/commit-flush.d.ts.map +1 -0
  72. package/dist/reconciler/commit-flush.js +13 -0
  73. package/dist/reconciler/commit-flush.js.map +1 -0
  74. package/dist/reconciler/container-attach.d.ts +10 -0
  75. package/dist/reconciler/container-attach.d.ts.map +1 -0
  76. package/dist/reconciler/container-attach.js +216 -0
  77. package/dist/reconciler/container-attach.js.map +1 -0
  78. package/dist/reconciler/content-rebuild.d.ts +3 -0
  79. package/dist/reconciler/content-rebuild.d.ts.map +1 -0
  80. package/dist/reconciler/content-rebuild.js +15 -0
  81. package/dist/reconciler/content-rebuild.js.map +1 -0
  82. package/dist/reconciler/dispatch.d.ts +6 -0
  83. package/dist/reconciler/dispatch.d.ts.map +1 -0
  84. package/dist/reconciler/dispatch.js +61 -0
  85. package/dist/reconciler/dispatch.js.map +1 -0
  86. package/dist/reconciler/element-prop-appliers.d.ts +5 -0
  87. package/dist/reconciler/element-prop-appliers.d.ts.map +1 -0
  88. package/dist/reconciler/element-prop-appliers.js +104 -0
  89. package/dist/reconciler/element-prop-appliers.js.map +1 -0
  90. package/dist/reconciler/element-props.d.ts +25 -0
  91. package/dist/reconciler/element-props.d.ts.map +1 -0
  92. package/dist/reconciler/element-props.js +157 -0
  93. package/dist/reconciler/element-props.js.map +1 -0
  94. package/dist/reconciler/host-config.d.ts +13 -0
  95. package/dist/reconciler/host-config.d.ts.map +1 -0
  96. package/dist/reconciler/host-config.js +309 -0
  97. package/dist/reconciler/host-config.js.map +1 -0
  98. package/dist/reconciler/instance.d.ts +6 -0
  99. package/dist/reconciler/instance.d.ts.map +1 -0
  100. package/dist/reconciler/instance.js +27 -0
  101. package/dist/reconciler/instance.js.map +1 -0
  102. package/dist/reconciler/label-text-rebuild.d.ts +3 -0
  103. package/dist/reconciler/label-text-rebuild.d.ts.map +1 -0
  104. package/dist/reconciler/label-text-rebuild.js +22 -0
  105. package/dist/reconciler/label-text-rebuild.js.map +1 -0
  106. package/dist/reconciler/portal.d.ts +11 -0
  107. package/dist/reconciler/portal.d.ts.map +1 -0
  108. package/dist/reconciler/portal.js +20 -0
  109. package/dist/reconciler/portal.js.map +1 -0
  110. package/dist/reconciler/reconciler-error-handler.d.ts +7 -0
  111. package/dist/reconciler/reconciler-error-handler.d.ts.map +1 -0
  112. package/dist/reconciler/reconciler-error-handler.js +24 -0
  113. package/dist/reconciler/reconciler-error-handler.js.map +1 -0
  114. package/dist/reconciler/reconciler-root.d.ts +19 -0
  115. package/dist/reconciler/reconciler-root.d.ts.map +1 -0
  116. package/dist/reconciler/reconciler-root.js +24 -0
  117. package/dist/reconciler/reconciler-root.js.map +1 -0
  118. package/dist/reconciler/reconciler.d.ts +3 -0
  119. package/dist/reconciler/reconciler.d.ts.map +1 -0
  120. package/dist/reconciler/reconciler.js +12 -0
  121. package/dist/reconciler/reconciler.js.map +1 -0
  122. package/dist/reconciler/render.d.ts +23 -0
  123. package/dist/reconciler/render.d.ts.map +1 -0
  124. package/dist/reconciler/render.js +46 -0
  125. package/dist/reconciler/render.js.map +1 -0
  126. package/dist/reconciler/root-element.d.ts +14 -0
  127. package/dist/reconciler/root-element.d.ts.map +1 -0
  128. package/dist/reconciler/root-element.js +7 -0
  129. package/dist/reconciler/root-element.js.map +1 -0
  130. package/dist/reconciler/signal-store.d.ts +22 -0
  131. package/dist/reconciler/signal-store.d.ts.map +1 -0
  132. package/dist/reconciler/signal-store.js +84 -0
  133. package/dist/reconciler/signal-store.js.map +1 -0
  134. package/dist/reconciler/state.d.ts +36 -0
  135. package/dist/reconciler/state.d.ts.map +1 -0
  136. package/dist/reconciler/state.js +38 -0
  137. package/dist/reconciler/state.js.map +1 -0
  138. package/dist/reconciler/text-buffer-controller.d.ts +17 -0
  139. package/dist/reconciler/text-buffer-controller.d.ts.map +1 -0
  140. package/dist/reconciler/text-buffer-controller.js +102 -0
  141. package/dist/reconciler/text-buffer-controller.js.map +1 -0
  142. package/dist/reconciler/text-buffer-rebuild.d.ts +3 -0
  143. package/dist/reconciler/text-buffer-rebuild.d.ts.map +1 -0
  144. package/dist/reconciler/text-buffer-rebuild.js +7 -0
  145. package/dist/reconciler/text-buffer-rebuild.js.map +1 -0
  146. package/dist/reconciler/text-node.d.ts +7 -0
  147. package/dist/reconciler/text-node.d.ts.map +1 -0
  148. package/dist/reconciler/text-node.js +8 -0
  149. package/dist/reconciler/text-node.js.map +1 -0
  150. package/dist/reconciler/types.d.ts +5 -0
  151. package/dist/reconciler/types.d.ts.map +1 -0
  152. package/dist/reconciler/types.js.map +1 -0
  153. package/dist/reconciler/visibility.d.ts +6 -0
  154. package/dist/reconciler/visibility.d.ts.map +1 -0
  155. package/dist/reconciler/visibility.js +57 -0
  156. package/dist/reconciler/visibility.js.map +1 -0
  157. package/dist/reconciler/wrapper-apply.d.ts +6 -0
  158. package/dist/reconciler/wrapper-apply.d.ts.map +1 -0
  159. package/dist/reconciler/wrapper-apply.js +287 -0
  160. package/dist/reconciler/wrapper-apply.js.map +1 -0
  161. package/dist/reconciler/wrapper-content.d.ts +8 -0
  162. package/dist/reconciler/wrapper-content.d.ts.map +1 -0
  163. package/dist/reconciler/wrapper-content.js +19 -0
  164. package/dist/reconciler/wrapper-content.js.map +1 -0
  165. package/dist/reconciler/wrapper-node.d.ts +8 -0
  166. package/dist/reconciler/wrapper-node.d.ts.map +1 -0
  167. package/dist/reconciler/wrapper-node.js +4 -0
  168. package/dist/reconciler/wrapper-node.js.map +1 -0
  169. package/dist/reconciler/wrapper-protocol.d.ts +13 -0
  170. package/dist/reconciler/wrapper-protocol.d.ts.map +1 -0
  171. package/dist/reconciler/wrapper-protocol.js +20 -0
  172. package/dist/reconciler/wrapper-protocol.js.map +1 -0
  173. package/dist/utils/accessible-metadata.d.ts +5 -0
  174. package/dist/utils/accessible-metadata.d.ts.map +1 -0
  175. package/dist/utils/accessible-metadata.js +22 -0
  176. package/dist/utils/accessible-metadata.js.map +1 -0
  177. package/dist/utils/create-element-component.d.ts +4 -0
  178. package/dist/utils/create-element-component.d.ts.map +1 -0
  179. package/dist/utils/create-element-component.js +54 -0
  180. package/dist/utils/create-element-component.js.map +1 -0
  181. package/dist/utils/gtype.d.ts +16 -0
  182. package/dist/utils/gtype.d.ts.map +1 -0
  183. package/dist/utils/gtype.js +127 -0
  184. package/dist/utils/gtype.js.map +1 -0
  185. package/dist/utils/notify-name.d.ts +5 -0
  186. package/dist/utils/notify-name.d.ts.map +1 -0
  187. package/dist/utils/notify-name.js +6 -0
  188. package/dist/utils/notify-name.js.map +1 -0
  189. package/dist/utils/object-prop.d.ts +8 -0
  190. package/dist/utils/object-prop.d.ts.map +1 -0
  191. package/dist/utils/object-prop.js +9 -0
  192. package/dist/utils/object-prop.js.map +1 -0
  193. package/dist/utils/settings-accessor.d.ts +8 -0
  194. package/dist/utils/settings-accessor.d.ts.map +1 -0
  195. package/dist/utils/settings-accessor.js +69 -0
  196. package/dist/utils/settings-accessor.js.map +1 -0
  197. package/dist/utils/wrapper-node-jsx.d.ts +32 -0
  198. package/dist/utils/wrapper-node-jsx.d.ts.map +1 -0
  199. package/dist/utils/wrapper-node-jsx.js +2 -0
  200. package/dist/utils/wrapper-node-jsx.js.map +1 -0
  201. package/package.json +22 -8
  202. package/src/components/application.tsx +43 -0
  203. package/src/components/window.tsx +36 -0
  204. package/src/hooks/use-application.ts +17 -0
  205. package/src/hooks/use-bind-setting.ts +35 -0
  206. package/src/hooks/use-merge-refs.ts +53 -0
  207. package/src/hooks/use-object-attachment.ts +35 -0
  208. package/src/hooks/use-object-value.ts +50 -0
  209. package/src/hooks/use-parent-window.ts +9 -0
  210. package/src/hooks/use-property.ts +22 -0
  211. package/src/hooks/use-setting.ts +47 -0
  212. package/src/hooks/use-signal.ts +71 -0
  213. package/src/index.ts +15 -12
  214. package/src/internal.ts +24 -0
  215. package/src/libraries/adw/dialog.tsx +34 -0
  216. package/src/libraries/adw/index.ts +1 -0
  217. package/src/reconciler/accessible.ts +232 -0
  218. package/src/reconciler/apply-props.ts +117 -0
  219. package/src/reconciler/commit-flush.ts +13 -0
  220. package/src/reconciler/container-attach.ts +219 -0
  221. package/src/reconciler/content-rebuild.ts +19 -0
  222. package/src/reconciler/dispatch.ts +58 -0
  223. package/src/reconciler/element-prop-appliers.ts +110 -0
  224. package/src/reconciler/element-props.ts +192 -0
  225. package/src/reconciler/host-config.ts +405 -0
  226. package/src/reconciler/instance.ts +30 -0
  227. package/src/reconciler/label-text-rebuild.ts +26 -0
  228. package/src/reconciler/portal.ts +28 -0
  229. package/src/reconciler/reconciler-error-handler.ts +29 -0
  230. package/src/reconciler/reconciler-root.ts +57 -0
  231. package/src/reconciler/reconciler.ts +13 -0
  232. package/src/reconciler/render.ts +61 -0
  233. package/src/reconciler/root-element.ts +14 -0
  234. package/src/reconciler/signal-store.ts +103 -0
  235. package/src/reconciler/state.ts +72 -0
  236. package/src/reconciler/text-buffer-controller.ts +107 -0
  237. package/src/reconciler/text-buffer-rebuild.ts +12 -0
  238. package/src/reconciler/text-node.ts +13 -0
  239. package/src/reconciler/types.ts +6 -0
  240. package/src/reconciler/visibility.ts +52 -0
  241. package/src/reconciler/wrapper-apply.ts +308 -0
  242. package/src/reconciler/wrapper-content.ts +24 -0
  243. package/src/reconciler/wrapper-node.ts +8 -0
  244. package/src/reconciler/wrapper-protocol.ts +32 -0
  245. package/src/utils/accessible-metadata.ts +26 -0
  246. package/src/utils/create-element-component.ts +77 -0
  247. package/src/utils/gtype.ts +166 -0
  248. package/src/utils/notify-name.ts +10 -0
  249. package/src/utils/object-prop.ts +13 -0
  250. package/src/utils/settings-accessor.ts +89 -0
  251. package/src/utils/wrapper-node-jsx.ts +34 -0
  252. package/dist/components/list.d.ts +0 -35
  253. package/dist/components/list.d.ts.map +0 -1
  254. package/dist/components/list.js +0 -40
  255. package/dist/components/list.js.map +0 -1
  256. package/dist/errors.d.ts +0 -9
  257. package/dist/errors.d.ts.map +0 -1
  258. package/dist/errors.js +0 -42
  259. package/dist/errors.js.map +0 -1
  260. package/dist/factory.d.ts +0 -5
  261. package/dist/factory.d.ts.map +0 -1
  262. package/dist/factory.js +0 -37
  263. package/dist/factory.js.map +0 -1
  264. package/dist/generated/internal.d.ts +0 -16
  265. package/dist/generated/internal.d.ts.map +0 -1
  266. package/dist/generated/internal.js +0 -5635
  267. package/dist/generated/internal.js.map +0 -1
  268. package/dist/generated/jsx.d.ts +0 -19624
  269. package/dist/generated/jsx.d.ts.map +0 -1
  270. package/dist/generated/jsx.js +0 -9274
  271. package/dist/generated/jsx.js.map +0 -1
  272. package/dist/generated/registry.d.ts +0 -4
  273. package/dist/generated/registry.d.ts.map +0 -1
  274. package/dist/generated/registry.js +0 -14
  275. package/dist/generated/registry.js.map +0 -1
  276. package/dist/host-config.d.ts +0 -24
  277. package/dist/host-config.d.ts.map +0 -1
  278. package/dist/host-config.js +0 -172
  279. package/dist/host-config.js.map +0 -1
  280. package/dist/jsx.d.ts +0 -1272
  281. package/dist/jsx.d.ts.map +0 -1
  282. package/dist/jsx.js +0 -331
  283. package/dist/jsx.js.map +0 -1
  284. package/dist/metadata.d.ts +0 -5
  285. package/dist/metadata.d.ts.map +0 -1
  286. package/dist/metadata.js +0 -33
  287. package/dist/metadata.js.map +0 -1
  288. package/dist/node.d.ts +0 -25
  289. package/dist/node.d.ts.map +0 -1
  290. package/dist/node.js +0 -85
  291. package/dist/node.js.map +0 -1
  292. package/dist/nodes/adjustable.d.ts +0 -11
  293. package/dist/nodes/adjustable.d.ts.map +0 -1
  294. package/dist/nodes/adjustable.js +0 -46
  295. package/dist/nodes/adjustable.js.map +0 -1
  296. package/dist/nodes/alert-dialog-response.d.ts +0 -15
  297. package/dist/nodes/alert-dialog-response.d.ts.map +0 -1
  298. package/dist/nodes/alert-dialog-response.js +0 -61
  299. package/dist/nodes/alert-dialog-response.js.map +0 -1
  300. package/dist/nodes/animation.d.ts +0 -38
  301. package/dist/nodes/animation.d.ts.map +0 -1
  302. package/dist/nodes/animation.js +0 -310
  303. package/dist/nodes/animation.js.map +0 -1
  304. package/dist/nodes/application.d.ts +0 -12
  305. package/dist/nodes/application.d.ts.map +0 -1
  306. package/dist/nodes/application.js +0 -51
  307. package/dist/nodes/application.js.map +0 -1
  308. package/dist/nodes/calendar.d.ts +0 -18
  309. package/dist/nodes/calendar.d.ts.map +0 -1
  310. package/dist/nodes/calendar.js +0 -28
  311. package/dist/nodes/calendar.js.map +0 -1
  312. package/dist/nodes/color-dialog-button.d.ts +0 -15
  313. package/dist/nodes/color-dialog-button.d.ts.map +0 -1
  314. package/dist/nodes/color-dialog-button.js +0 -43
  315. package/dist/nodes/color-dialog-button.js.map +0 -1
  316. package/dist/nodes/column-view-column.d.ts +0 -36
  317. package/dist/nodes/column-view-column.d.ts.map +0 -1
  318. package/dist/nodes/column-view-column.js +0 -168
  319. package/dist/nodes/column-view-column.js.map +0 -1
  320. package/dist/nodes/container-slot.d.ts +0 -16
  321. package/dist/nodes/container-slot.d.ts.map +0 -1
  322. package/dist/nodes/container-slot.js +0 -69
  323. package/dist/nodes/container-slot.js.map +0 -1
  324. package/dist/nodes/dialog.d.ts +0 -10
  325. package/dist/nodes/dialog.d.ts.map +0 -1
  326. package/dist/nodes/dialog.js +0 -20
  327. package/dist/nodes/dialog.js.map +0 -1
  328. package/dist/nodes/drawing-area.d.ts +0 -17
  329. package/dist/nodes/drawing-area.d.ts.map +0 -1
  330. package/dist/nodes/drawing-area.js +0 -42
  331. package/dist/nodes/drawing-area.js.map +0 -1
  332. package/dist/nodes/event-controller.d.ts +0 -15
  333. package/dist/nodes/event-controller.d.ts.map +0 -1
  334. package/dist/nodes/event-controller.js +0 -77
  335. package/dist/nodes/event-controller.js.map +0 -1
  336. package/dist/nodes/fixed-child.d.ts +0 -18
  337. package/dist/nodes/fixed-child.d.ts.map +0 -1
  338. package/dist/nodes/fixed-child.js +0 -86
  339. package/dist/nodes/fixed-child.js.map +0 -1
  340. package/dist/nodes/font-dialog-button.d.ts +0 -15
  341. package/dist/nodes/font-dialog-button.d.ts.map +0 -1
  342. package/dist/nodes/font-dialog-button.js +0 -76
  343. package/dist/nodes/font-dialog-button.js.map +0 -1
  344. package/dist/nodes/grid-child.d.ts +0 -18
  345. package/dist/nodes/grid-child.d.ts.map +0 -1
  346. package/dist/nodes/grid-child.js +0 -81
  347. package/dist/nodes/grid-child.js.map +0 -1
  348. package/dist/nodes/internal/accessible.d.ts +0 -5
  349. package/dist/nodes/internal/accessible.d.ts.map +0 -1
  350. package/dist/nodes/internal/accessible.js +0 -119
  351. package/dist/nodes/internal/accessible.js.map +0 -1
  352. package/dist/nodes/internal/bound-item.d.ts +0 -4
  353. package/dist/nodes/internal/bound-item.d.ts.map +0 -1
  354. package/dist/nodes/internal/bound-item.js +0 -2
  355. package/dist/nodes/internal/bound-item.js.map +0 -1
  356. package/dist/nodes/internal/construct.d.ts +0 -3
  357. package/dist/nodes/internal/construct.d.ts.map +0 -1
  358. package/dist/nodes/internal/construct.js +0 -44
  359. package/dist/nodes/internal/construct.js.map +0 -1
  360. package/dist/nodes/internal/predicates.d.ts +0 -51
  361. package/dist/nodes/internal/predicates.d.ts.map +0 -1
  362. package/dist/nodes/internal/predicates.js +0 -36
  363. package/dist/nodes/internal/predicates.js.map +0 -1
  364. package/dist/nodes/internal/props.d.ts +0 -6
  365. package/dist/nodes/internal/props.d.ts.map +0 -1
  366. package/dist/nodes/internal/props.js +0 -43
  367. package/dist/nodes/internal/props.js.map +0 -1
  368. package/dist/nodes/internal/signal-store.d.ts +0 -22
  369. package/dist/nodes/internal/signal-store.d.ts.map +0 -1
  370. package/dist/nodes/internal/signal-store.js +0 -98
  371. package/dist/nodes/internal/signal-store.js.map +0 -1
  372. package/dist/nodes/internal/text-buffer-controller.d.ts +0 -40
  373. package/dist/nodes/internal/text-buffer-controller.d.ts.map +0 -1
  374. package/dist/nodes/internal/text-buffer-controller.js +0 -327
  375. package/dist/nodes/internal/text-buffer-controller.js.map +0 -1
  376. package/dist/nodes/internal/widget.d.ts +0 -8
  377. package/dist/nodes/internal/widget.d.ts.map +0 -1
  378. package/dist/nodes/internal/widget.js +0 -72
  379. package/dist/nodes/internal/widget.js.map +0 -1
  380. package/dist/nodes/level-bar.d.ts +0 -12
  381. package/dist/nodes/level-bar.d.ts.map +0 -1
  382. package/dist/nodes/level-bar.js +0 -24
  383. package/dist/nodes/level-bar.js.map +0 -1
  384. package/dist/nodes/list-item-node.d.ts +0 -12
  385. package/dist/nodes/list-item-node.d.ts.map +0 -1
  386. package/dist/nodes/list-item-node.js +0 -23
  387. package/dist/nodes/list-item-node.js.map +0 -1
  388. package/dist/nodes/list.d.ts +0 -100
  389. package/dist/nodes/list.d.ts.map +0 -1
  390. package/dist/nodes/list.js +0 -950
  391. package/dist/nodes/list.js.map +0 -1
  392. package/dist/nodes/menu.d.ts +0 -7
  393. package/dist/nodes/menu.d.ts.map +0 -1
  394. package/dist/nodes/menu.js +0 -20
  395. package/dist/nodes/menu.js.map +0 -1
  396. package/dist/nodes/models/menu.d.ts +0 -47
  397. package/dist/nodes/models/menu.d.ts.map +0 -1
  398. package/dist/nodes/models/menu.js +0 -240
  399. package/dist/nodes/models/menu.js.map +0 -1
  400. package/dist/nodes/navigation-page.d.ts +0 -19
  401. package/dist/nodes/navigation-page.d.ts.map +0 -1
  402. package/dist/nodes/navigation-page.js +0 -129
  403. package/dist/nodes/navigation-page.js.map +0 -1
  404. package/dist/nodes/navigation-view.d.ts +0 -19
  405. package/dist/nodes/navigation-view.d.ts.map +0 -1
  406. package/dist/nodes/navigation-view.js +0 -51
  407. package/dist/nodes/navigation-view.js.map +0 -1
  408. package/dist/nodes/notebook-page-tab.d.ts +0 -15
  409. package/dist/nodes/notebook-page-tab.d.ts.map +0 -1
  410. package/dist/nodes/notebook-page-tab.js +0 -40
  411. package/dist/nodes/notebook-page-tab.js.map +0 -1
  412. package/dist/nodes/notebook-page.d.ts +0 -29
  413. package/dist/nodes/notebook-page.d.ts.map +0 -1
  414. package/dist/nodes/notebook-page.js +0 -151
  415. package/dist/nodes/notebook-page.js.map +0 -1
  416. package/dist/nodes/notebook.d.ts +0 -16
  417. package/dist/nodes/notebook.d.ts.map +0 -1
  418. package/dist/nodes/notebook.js +0 -31
  419. package/dist/nodes/notebook.js.map +0 -1
  420. package/dist/nodes/overlay-child.d.ts +0 -18
  421. package/dist/nodes/overlay-child.d.ts.map +0 -1
  422. package/dist/nodes/overlay-child.js +0 -88
  423. package/dist/nodes/overlay-child.js.map +0 -1
  424. package/dist/nodes/popover-menu.d.ts +0 -19
  425. package/dist/nodes/popover-menu.d.ts.map +0 -1
  426. package/dist/nodes/popover-menu.js +0 -54
  427. package/dist/nodes/popover-menu.js.map +0 -1
  428. package/dist/nodes/scale.d.ts +0 -10
  429. package/dist/nodes/scale.d.ts.map +0 -1
  430. package/dist/nodes/scale.js +0 -19
  431. package/dist/nodes/scale.js.map +0 -1
  432. package/dist/nodes/scrolled-window.d.ts +0 -11
  433. package/dist/nodes/scrolled-window.d.ts.map +0 -1
  434. package/dist/nodes/scrolled-window.js +0 -18
  435. package/dist/nodes/scrolled-window.js.map +0 -1
  436. package/dist/nodes/search-bar.d.ts +0 -11
  437. package/dist/nodes/search-bar.d.ts.map +0 -1
  438. package/dist/nodes/search-bar.js +0 -16
  439. package/dist/nodes/search-bar.js.map +0 -1
  440. package/dist/nodes/shortcut.d.ts +0 -19
  441. package/dist/nodes/shortcut.d.ts.map +0 -1
  442. package/dist/nodes/shortcut.js +0 -72
  443. package/dist/nodes/shortcut.js.map +0 -1
  444. package/dist/nodes/slot.d.ts +0 -21
  445. package/dist/nodes/slot.d.ts.map +0 -1
  446. package/dist/nodes/slot.js +0 -102
  447. package/dist/nodes/slot.js.map +0 -1
  448. package/dist/nodes/source-view.d.ts +0 -18
  449. package/dist/nodes/source-view.d.ts.map +0 -1
  450. package/dist/nodes/source-view.js +0 -94
  451. package/dist/nodes/source-view.js.map +0 -1
  452. package/dist/nodes/stack-page.d.ts +0 -22
  453. package/dist/nodes/stack-page.d.ts.map +0 -1
  454. package/dist/nodes/stack-page.js +0 -140
  455. package/dist/nodes/stack-page.js.map +0 -1
  456. package/dist/nodes/stack.d.ts +0 -13
  457. package/dist/nodes/stack.d.ts.map +0 -1
  458. package/dist/nodes/stack.js +0 -21
  459. package/dist/nodes/stack.js.map +0 -1
  460. package/dist/nodes/text-anchor.d.ts +0 -23
  461. package/dist/nodes/text-anchor.d.ts.map +0 -1
  462. package/dist/nodes/text-anchor.js +0 -64
  463. package/dist/nodes/text-anchor.js.map +0 -1
  464. package/dist/nodes/text-content.d.ts +0 -12
  465. package/dist/nodes/text-content.d.ts.map +0 -1
  466. package/dist/nodes/text-content.js +0 -2
  467. package/dist/nodes/text-content.js.map +0 -1
  468. package/dist/nodes/text-paintable.d.ts +0 -19
  469. package/dist/nodes/text-paintable.d.ts.map +0 -1
  470. package/dist/nodes/text-paintable.js +0 -42
  471. package/dist/nodes/text-paintable.js.map +0 -1
  472. package/dist/nodes/text-segment.d.ts +0 -18
  473. package/dist/nodes/text-segment.d.ts.map +0 -1
  474. package/dist/nodes/text-segment.js +0 -38
  475. package/dist/nodes/text-segment.js.map +0 -1
  476. package/dist/nodes/text-tag.d.ts +0 -38
  477. package/dist/nodes/text-tag.d.ts.map +0 -1
  478. package/dist/nodes/text-tag.js +0 -241
  479. package/dist/nodes/text-tag.js.map +0 -1
  480. package/dist/nodes/text-view.d.ts +0 -29
  481. package/dist/nodes/text-view.d.ts.map +0 -1
  482. package/dist/nodes/text-view.js +0 -80
  483. package/dist/nodes/text-view.js.map +0 -1
  484. package/dist/nodes/toggle-group.d.ts +0 -11
  485. package/dist/nodes/toggle-group.d.ts.map +0 -1
  486. package/dist/nodes/toggle-group.js +0 -16
  487. package/dist/nodes/toggle-group.js.map +0 -1
  488. package/dist/nodes/toggle.d.ts +0 -16
  489. package/dist/nodes/toggle.d.ts.map +0 -1
  490. package/dist/nodes/toggle.js +0 -61
  491. package/dist/nodes/toggle.js.map +0 -1
  492. package/dist/nodes/virtual.d.ts +0 -7
  493. package/dist/nodes/virtual.d.ts.map +0 -1
  494. package/dist/nodes/virtual.js +0 -9
  495. package/dist/nodes/virtual.js.map +0 -1
  496. package/dist/nodes/web-view.d.ts +0 -11
  497. package/dist/nodes/web-view.d.ts.map +0 -1
  498. package/dist/nodes/web-view.js +0 -16
  499. package/dist/nodes/web-view.js.map +0 -1
  500. package/dist/nodes/widget.d.ts +0 -26
  501. package/dist/nodes/widget.d.ts.map +0 -1
  502. package/dist/nodes/widget.js +0 -315
  503. package/dist/nodes/widget.js.map +0 -1
  504. package/dist/nodes/window.d.ts +0 -31
  505. package/dist/nodes/window.d.ts.map +0 -1
  506. package/dist/nodes/window.js +0 -122
  507. package/dist/nodes/window.js.map +0 -1
  508. package/dist/portal.d.ts +0 -29
  509. package/dist/portal.d.ts.map +0 -1
  510. package/dist/portal.js +0 -35
  511. package/dist/portal.js.map +0 -1
  512. package/dist/reconciler.d.ts +0 -34
  513. package/dist/reconciler.d.ts.map +0 -1
  514. package/dist/reconciler.js +0 -48
  515. package/dist/reconciler.js.map +0 -1
  516. package/dist/registry.d.ts +0 -18
  517. package/dist/registry.d.ts.map +0 -1
  518. package/dist/registry.js +0 -96
  519. package/dist/registry.js.map +0 -1
  520. package/dist/render.d.ts +0 -117
  521. package/dist/render.d.ts.map +0 -1
  522. package/dist/render.js +0 -159
  523. package/dist/render.js.map +0 -1
  524. package/dist/types.d.ts +0 -5
  525. package/dist/types.d.ts.map +0 -1
  526. package/dist/types.js.map +0 -1
  527. package/src/components/list.tsx +0 -83
  528. package/src/errors.ts +0 -52
  529. package/src/factory.ts +0 -62
  530. package/src/generated/internal.ts +0 -5644
  531. package/src/generated/jsx.ts +0 -19900
  532. package/src/generated/registry.ts +0 -16
  533. package/src/host-config.ts +0 -219
  534. package/src/jsx.ts +0 -1355
  535. package/src/metadata.ts +0 -43
  536. package/src/node.ts +0 -107
  537. package/src/nodes/adjustable.ts +0 -68
  538. package/src/nodes/alert-dialog-response.ts +0 -78
  539. package/src/nodes/animation.ts +0 -402
  540. package/src/nodes/application.ts +0 -61
  541. package/src/nodes/calendar.ts +0 -42
  542. package/src/nodes/color-dialog-button.ts +0 -69
  543. package/src/nodes/column-view-column.ts +0 -189
  544. package/src/nodes/container-slot.ts +0 -87
  545. package/src/nodes/dialog.ts +0 -25
  546. package/src/nodes/drawing-area.ts +0 -62
  547. package/src/nodes/event-controller.ts +0 -100
  548. package/src/nodes/fixed-child.ts +0 -109
  549. package/src/nodes/font-dialog-button.ts +0 -107
  550. package/src/nodes/grid-child.ts +0 -103
  551. package/src/nodes/internal/accessible.ts +0 -155
  552. package/src/nodes/internal/bound-item.ts +0 -4
  553. package/src/nodes/internal/construct.ts +0 -60
  554. package/src/nodes/internal/predicates.ts +0 -80
  555. package/src/nodes/internal/props.ts +0 -51
  556. package/src/nodes/internal/signal-store.ts +0 -141
  557. package/src/nodes/internal/text-buffer-controller.ts +0 -417
  558. package/src/nodes/internal/widget.ts +0 -80
  559. package/src/nodes/level-bar.ts +0 -36
  560. package/src/nodes/list-item-node.ts +0 -29
  561. package/src/nodes/list.ts +0 -1082
  562. package/src/nodes/menu.ts +0 -27
  563. package/src/nodes/models/menu.ts +0 -314
  564. package/src/nodes/navigation-page.ts +0 -154
  565. package/src/nodes/navigation-view.ts +0 -66
  566. package/src/nodes/notebook-page-tab.ts +0 -55
  567. package/src/nodes/notebook-page.ts +0 -189
  568. package/src/nodes/notebook.ts +0 -42
  569. package/src/nodes/overlay-child.ts +0 -109
  570. package/src/nodes/popover-menu.ts +0 -67
  571. package/src/nodes/scale.ts +0 -28
  572. package/src/nodes/scrolled-window.ts +0 -23
  573. package/src/nodes/search-bar.ts +0 -27
  574. package/src/nodes/shortcut.ts +0 -86
  575. package/src/nodes/slot.ts +0 -138
  576. package/src/nodes/source-view.ts +0 -130
  577. package/src/nodes/stack-page.ts +0 -170
  578. package/src/nodes/stack.ts +0 -35
  579. package/src/nodes/text-anchor.ts +0 -79
  580. package/src/nodes/text-content.ts +0 -14
  581. package/src/nodes/text-paintable.ts +0 -51
  582. package/src/nodes/text-segment.ts +0 -55
  583. package/src/nodes/text-tag.ts +0 -293
  584. package/src/nodes/text-view.ts +0 -100
  585. package/src/nodes/toggle-group.ts +0 -27
  586. package/src/nodes/toggle.ts +0 -72
  587. package/src/nodes/virtual.ts +0 -16
  588. package/src/nodes/web-view.ts +0 -22
  589. package/src/nodes/widget.ts +0 -376
  590. package/src/nodes/window.ts +0 -172
  591. package/src/portal.ts +0 -37
  592. package/src/reconciler.ts +0 -52
  593. package/src/registry.ts +0 -117
  594. package/src/render.tsx +0 -192
  595. package/src/types.ts +0 -12
  596. /package/dist/{types.js → reconciler/types.js} +0 -0
@@ -0,0 +1,24 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { type Node, stateOf } from "./state.js";
4
+ import { isWrapperNode } from "./wrapper-node.js";
5
+
6
+ export const childWidget = (instance: Node): Gtk.Widget | null => (instance instanceof Gtk.Widget ? instance : null);
7
+
8
+ const trackedChild = (node: Node): Node | null => {
9
+ const { children } = stateOf(node);
10
+ return children.find((child) => !isWrapperNode(child)) ?? children[0] ?? null;
11
+ };
12
+
13
+ export const trackedWidget = (node: Node): Gtk.Widget | null => {
14
+ const child = trackedChild(node);
15
+ return child instanceof Gtk.Widget ? child : null;
16
+ };
17
+
18
+ export const trackedInstance = (node: Node): GObject.Object | undefined => {
19
+ const child = trackedChild(node);
20
+ return child instanceof GObject.Object ? child : undefined;
21
+ };
22
+
23
+ export const wrapperChildInstances = (node: Node): GObject.Object[] =>
24
+ stateOf(node).children.filter((child): child is GObject.Object => child instanceof GObject.Object);
@@ -0,0 +1,8 @@
1
+ const WRAPPER_NODE: unique symbol = Symbol.for("gtkx.wrapperNode");
2
+
3
+ export type WrapperNode = { [WRAPPER_NODE]: true };
4
+
5
+ export const createWrapperNode = (): WrapperNode => ({ [WRAPPER_NODE]: true });
6
+
7
+ export const isWrapperNode = (value: unknown): value is WrapperNode =>
8
+ typeof value === "object" && value !== null && WRAPPER_NODE in value;
@@ -0,0 +1,32 @@
1
+ export const WRAPPER_NODE_ELEMENT = "__GTKX_WRAPPER_NODE__";
2
+
3
+ const WRAPPER_KINDS = [
4
+ "lazy-element",
5
+ "object-prop",
6
+ "container-prop",
7
+ "text-anchor",
8
+ "text-paintable",
9
+ "buffer-text",
10
+ "label-text",
11
+ ] as const;
12
+
13
+ export type WrapperKind = (typeof WRAPPER_KINDS)[number];
14
+
15
+ const WRAPPER_KIND_SET: Set<string> = new Set(WRAPPER_KINDS);
16
+
17
+ export const isWrapperKind = (value: unknown): value is WrapperKind =>
18
+ typeof value === "string" && WRAPPER_KIND_SET.has(value);
19
+
20
+ export const LAZY_ELEMENT_KIND: WrapperKind = "lazy-element";
21
+
22
+ export const OBJECT_PROP_KIND: WrapperKind = "object-prop";
23
+
24
+ export const CONTAINER_PROP_KIND: WrapperKind = "container-prop";
25
+
26
+ export const TEXT_ANCHOR_KIND: WrapperKind = "text-anchor";
27
+
28
+ export const TEXT_PAINTABLE_KIND: WrapperKind = "text-paintable";
29
+
30
+ export const BUFFER_TEXT_KIND: WrapperKind = "buffer-text";
31
+
32
+ export const LABEL_TEXT_KIND: WrapperKind = "label-text";
@@ -0,0 +1,26 @@
1
+ import type * as Gtk from "@gtkx/gi/gtk";
2
+
3
+ type AccessibleMetadata = Map<string, unknown>;
4
+
5
+ const accessibleMetadata = new WeakMap<Gtk.Accessible, AccessibleMetadata>();
6
+
7
+ export const setAccessibleMetadata = (accessible: Gtk.Accessible, propName: string, value: unknown): void => {
8
+ let entry = accessibleMetadata.get(accessible);
9
+ if (!entry) {
10
+ entry = new Map();
11
+ accessibleMetadata.set(accessible, entry);
12
+ }
13
+ entry.set(propName, value);
14
+ };
15
+
16
+ export const deleteAccessibleMetadata = (accessible: Gtk.Accessible, propName: string): void => {
17
+ const entry = accessibleMetadata.get(accessible);
18
+ if (entry) entry.delete(propName);
19
+ };
20
+
21
+ export const getAccessibleMetadata = <T = unknown>(accessible: Gtk.Accessible, propName: string): T | null => {
22
+ const entry = accessibleMetadata.get(accessible);
23
+ if (!entry) return null;
24
+ const value = entry.get(propName);
25
+ return (value as T) ?? null;
26
+ };
@@ -0,0 +1,77 @@
1
+ import { createElement, isValidElement, type ReactNode } from "react";
2
+ import { containerPropNamesFor } from "../reconciler/element-props.js";
3
+ import {
4
+ CONTAINER_PROP_KIND,
5
+ LAZY_ELEMENT_KIND,
6
+ OBJECT_PROP_KIND,
7
+ WRAPPER_NODE_ELEMENT,
8
+ } from "../reconciler/wrapper-protocol.js";
9
+
10
+ const needsSplit = (props: object, containerPropNames: Set<string>): boolean => {
11
+ for (const [name, value] of Object.entries(props)) {
12
+ if (name === "children") continue;
13
+ if (containerPropNames.has(name)) return true;
14
+ if (isValidElement(value)) return true;
15
+ }
16
+ return false;
17
+ };
18
+
19
+ type SplitProps = {
20
+ rest: Record<string, unknown>;
21
+ wrappers: ReactNode[];
22
+ children: ReactNode;
23
+ };
24
+
25
+ const splitProps = (props: object, containerPropNames: Set<string>): SplitProps => {
26
+ const rest: Record<string, unknown> = {};
27
+ const wrappers: ReactNode[] = [];
28
+ let children: ReactNode = null;
29
+ for (const [name, value] of Object.entries(props)) {
30
+ if (name === "children") {
31
+ children = value as ReactNode;
32
+ continue;
33
+ }
34
+ if (containerPropNames.has(name)) {
35
+ if (value != null) {
36
+ wrappers.push(
37
+ createElement(
38
+ WRAPPER_NODE_ELEMENT,
39
+ { kind: CONTAINER_PROP_KIND, propName: name, key: `container-prop:${name}` },
40
+ value as ReactNode,
41
+ ),
42
+ );
43
+ }
44
+ continue;
45
+ }
46
+ if (isValidElement(value)) {
47
+ wrappers.push(
48
+ createElement(
49
+ WRAPPER_NODE_ELEMENT,
50
+ { kind: OBJECT_PROP_KIND, propName: name, key: `object-prop:${name}` },
51
+ value as ReactNode,
52
+ ),
53
+ );
54
+ continue;
55
+ }
56
+ rest[name] = value;
57
+ }
58
+ return { rest, wrappers, children };
59
+ };
60
+
61
+ export const createElementComponent = <P extends object>(elementName: string): ((props: P) => ReactNode) => {
62
+ const containerPropNames = containerPropNamesFor(elementName);
63
+ return (props: P): ReactNode => {
64
+ if (!needsSplit(props, containerPropNames)) return createElement(elementName, props);
65
+ const { rest, wrappers, children } = splitProps(props, containerPropNames);
66
+ return createElement(elementName, rest, children, ...wrappers);
67
+ };
68
+ };
69
+
70
+ const NO_CONTAINER_PROPS: Set<string> = new Set();
71
+
72
+ export const createLazyElementComponent = <P extends object>(): ((props: P) => ReactNode) => {
73
+ return (props: P): ReactNode => {
74
+ const { rest, wrappers, children } = splitProps(props, NO_CONTAINER_PROPS);
75
+ return createElement(WRAPPER_NODE_ELEMENT, { kind: LAZY_ELEMENT_KIND, ...rest }, children, ...wrappers);
76
+ };
77
+ };
@@ -0,0 +1,166 @@
1
+ /// <reference types="@gtkx/config/env" />
2
+
3
+ import { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS } from "virtual:gtkx-config";
4
+ import * as GObject from "@gtkx/gi/gobject";
5
+ import { getWrapperClass, type TypedClass } from "@gtkx/runtime";
6
+ import { NOTIFY_SIGNAL, propToNotifySignal } from "./notify-name.js";
7
+
8
+ const NOTIFY_PREFIX = "onNotify";
9
+
10
+ const resolveNotifySignal = (propName: string): string | null => {
11
+ if (propName === NOTIFY_PREFIX) return NOTIFY_SIGNAL;
12
+ if (!propName.startsWith(NOTIFY_PREFIX)) return null;
13
+ const tail = propName.slice(NOTIFY_PREFIX.length);
14
+ if (tail.charAt(0) !== tail.charAt(0).toUpperCase()) return null;
15
+ return propToNotifySignal(tail);
16
+ };
17
+
18
+ const typeNameChainCache = new Map<bigint, string[]>();
19
+ const interfaceNamesCache = new Map<bigint, string[]>();
20
+ const typeNameSetCache = new Map<bigint, Set<string>>();
21
+ const signalCache = new Map<bigint, Map<string, string | null>>();
22
+ const constructOnlyCache = new Map<bigint, Map<string, boolean>>();
23
+ const defaultPropCache = new Map<bigint, Map<string, DefaultPropLookup>>();
24
+ const constructablePropsCache = new Map<bigint, Set<string>>();
25
+
26
+ const memoizeGtype = <T>(cache: Map<bigint, T>, gtype: bigint, compute: () => T): T => {
27
+ const cached = cache.get(gtype);
28
+ if (cached !== undefined) return cached;
29
+ const result = compute();
30
+ cache.set(gtype, result);
31
+ return result;
32
+ };
33
+
34
+ const collectTypeNameChain = (gtype: bigint): string[] =>
35
+ memoizeGtype(typeNameChainCache, gtype, () => {
36
+ const chain: string[] = [];
37
+ let current = gtype;
38
+ while (current !== 0n) {
39
+ const name = GObject.typeName(current);
40
+ if (!name) break;
41
+ chain.push(name);
42
+ current = GObject.typeParent(current);
43
+ }
44
+ return chain;
45
+ });
46
+
47
+ const collectInterfaceNames = (gtype: bigint): string[] =>
48
+ memoizeGtype(interfaceNamesCache, gtype, () => {
49
+ const names: string[] = [];
50
+ for (const iface of GObject.typeInterfaces(gtype)) {
51
+ const name = GObject.typeName(iface);
52
+ if (name) names.push(name);
53
+ }
54
+ return names;
55
+ });
56
+
57
+ const typeNamesWithInterfacesCache = new Map<bigint, string[]>();
58
+
59
+ export const collectTypeNamesWithInterfaces = (gtype: bigint): string[] =>
60
+ memoizeGtype(typeNamesWithInterfacesCache, gtype, () => [
61
+ ...collectTypeNameChain(gtype),
62
+ ...collectInterfaceNames(gtype),
63
+ ]);
64
+
65
+ const foldInheritedTable = <R, T>(
66
+ gtype: bigint,
67
+ table: Record<string, R>,
68
+ fold: (accumulator: T, row: R) => T,
69
+ seed: T,
70
+ ): T => {
71
+ let accumulator = seed;
72
+ for (const name of collectTypeNameChain(gtype)) {
73
+ const row = table[name];
74
+ if (row !== undefined) accumulator = fold(accumulator, row);
75
+ }
76
+ return accumulator;
77
+ };
78
+
79
+ export const foldInheritedTableWithInterfaces = <R, T>(
80
+ gtype: bigint,
81
+ table: Record<string, R>,
82
+ fold: (accumulator: T, row: R) => T,
83
+ seed: T,
84
+ ): T => {
85
+ let accumulator = foldInheritedTable(gtype, table, fold, seed);
86
+ for (const name of collectInterfaceNames(gtype)) {
87
+ const row = table[name];
88
+ if (row !== undefined) accumulator = fold(accumulator, row);
89
+ }
90
+ return accumulator;
91
+ };
92
+
93
+ export const typeChainIncludes = (gtype: bigint, name: string): boolean =>
94
+ memoizeGtype(typeNameSetCache, gtype, () => new Set(collectTypeNameChain(gtype))).has(name);
95
+
96
+ const memoize = <T>(
97
+ cache: Map<bigint, Map<string, T>>,
98
+ instance: TypedClass,
99
+ key: string,
100
+ compute: (typeNames: string[]) => T,
101
+ ): T => {
102
+ const gtype = instance.__type__;
103
+ const perGtype = memoizeGtype(cache, gtype, () => new Map<string, T>());
104
+ const cached = perGtype.get(key);
105
+ if (cached !== undefined) return cached;
106
+ const result = compute(collectTypeNameChain(gtype));
107
+ perGtype.set(key, result);
108
+ return result;
109
+ };
110
+
111
+ export const collectConstructableProps = (gtype: bigint): Set<string> =>
112
+ memoizeGtype(constructablePropsCache, gtype, () =>
113
+ foldInheritedTable(
114
+ gtype,
115
+ CONSTRUCT_PROPS,
116
+ (collected: Set<string>, props) => {
117
+ for (const prop of props) collected.add(prop);
118
+ return collected;
119
+ },
120
+ new Set<string>(),
121
+ ),
122
+ );
123
+
124
+ export const isConstructOnlyProp = (instance: TypedClass, key: string): boolean =>
125
+ memoize(constructOnlyCache, instance, key, (typeNames) => {
126
+ for (const name of typeNames) {
127
+ if (CONSTRUCT_ONLY_PROPS[name]?.has(key)) return true;
128
+ }
129
+ return false;
130
+ });
131
+
132
+ export const resolveSignal = (instance: TypedClass, propName: string): string | null => {
133
+ const notify = resolveNotifySignal(propName);
134
+ if (notify) return notify;
135
+ return memoize(signalCache, instance, propName, (typeNames) => {
136
+ for (const name of typeNames) {
137
+ const result = SIGNALS[name]?.[propName];
138
+ if (result) return result;
139
+ }
140
+ return null;
141
+ });
142
+ };
143
+
144
+ type DefaultPropLookup = { has: boolean; value: unknown };
145
+
146
+ const NO_DEFAULT_PROP: DefaultPropLookup = { has: false, value: undefined };
147
+
148
+ export const resolveDefaultProp = (instance: TypedClass, key: string): DefaultPropLookup =>
149
+ memoize(defaultPropCache, instance, key, (typeNames) => {
150
+ for (const name of typeNames) {
151
+ const table = DEFAULT_PROPS[name];
152
+ if (table && key in table) return { has: true, value: table[key] };
153
+ }
154
+ return NO_DEFAULT_PROP;
155
+ });
156
+
157
+ export const requireClassByName = (typeName: string): (new (props: Record<string, unknown>) => GObject.Object) => {
158
+ const gtype = GObject.typeFromName(typeName);
159
+ if (gtype === GObject.TYPE_INVALID)
160
+ throw new Error(
161
+ `${typeName} is not registered. Import its @gtkx/jsx namespace module (e.g. \`import "@gtkx/jsx/adw"\`) before use.`,
162
+ );
163
+ return getWrapperClass(gtype) as new (
164
+ props: Record<string, unknown>,
165
+ ) => GObject.Object;
166
+ };
@@ -0,0 +1,10 @@
1
+ import { toCamelCase, toKebabCase } from "@gtkx/utils";
2
+
3
+ export const NOTIFY_SIGNAL = "notify";
4
+
5
+ export const NOTIFY_DETAIL_PREFIX = "notify::";
6
+
7
+ export const propToNotifySignal = (property: string): `notify::${string}` =>
8
+ `${NOTIFY_DETAIL_PREFIX}${toKebabCase(property)}`;
9
+
10
+ export const notifyDetailToProp = (detail: string): string => toCamelCase(detail.slice(NOTIFY_DETAIL_PREFIX.length));
@@ -0,0 +1,13 @@
1
+ import * as GObject from "@gtkx/gi/gobject";
2
+ import type { RefObject } from "react";
3
+
4
+ /**
5
+ * An object accepted by the GObject-aware hooks: a GObject, a ref to one, or a nullish value.
6
+ */
7
+ export type ObjectProp<T extends GObject.Object> = T | RefObject<T | null> | null | undefined;
8
+
9
+ export const resolveObjectProp = <T extends GObject.Object>(prop: ObjectProp<T>): T | null => {
10
+ if (!prop) return null;
11
+ if (prop instanceof GObject.Object) return prop;
12
+ return prop.current;
13
+ };
@@ -0,0 +1,89 @@
1
+ import type * as Gio from "@gtkx/gi/gio";
2
+ import * as GLib from "@gtkx/gi/glib";
3
+
4
+ type SettingAccessor = {
5
+ read: (settings: Gio.Settings, key: string) => unknown;
6
+ write: (settings: Gio.Settings, key: string, value: unknown) => void;
7
+ };
8
+
9
+ const settingTypeError = (expected: string, value: unknown): TypeError =>
10
+ new TypeError(`Expected ${expected} for the settings value, got ${typeof value}`);
11
+
12
+ const expect =
13
+ <T>(guard: (value: unknown) => value is T, label: string) =>
14
+ (value: unknown): T => {
15
+ if (!guard(value)) throw settingTypeError(label, value);
16
+ return value;
17
+ };
18
+
19
+ const expectBoolean = expect((value): value is boolean => typeof value === "boolean", "a boolean");
20
+
21
+ const expectNumber = expect((value): value is number => typeof value === "number", "a number");
22
+
23
+ const expectString = expect((value): value is string => typeof value === "string", "a string");
24
+
25
+ const isStringArray = (value: unknown): value is string[] =>
26
+ Array.isArray(value) && value.every((entry) => typeof entry === "string");
27
+
28
+ const expectStringArray = expect(isStringArray, "an array of strings");
29
+
30
+ const expectVariant = expect((value): value is GLib.Variant => value instanceof GLib.Variant, "a GLib.Variant");
31
+
32
+ const expectBigInt = (value: unknown): bigint => {
33
+ if (typeof value === "bigint") return value;
34
+ if (typeof value === "number") return BigInt(value);
35
+ throw settingTypeError("a bigint", value);
36
+ };
37
+
38
+ const STRING_ACCESSOR: SettingAccessor = {
39
+ read: (settings, key) => settings.getString(key),
40
+ write: (settings, key, value) => settings.setString(key, expectString(value)),
41
+ };
42
+
43
+ const STRV_ACCESSOR: SettingAccessor = {
44
+ read: (settings, key) => settings.getStrv(key),
45
+ write: (settings, key, value) => settings.setStrv(key, expectStringArray(value)),
46
+ };
47
+
48
+ const ACCESSORS: Record<string, SettingAccessor> = {
49
+ b: {
50
+ read: (settings, key) => settings.getBoolean(key),
51
+ write: (settings, key, value) => settings.setBoolean(key, expectBoolean(value)),
52
+ },
53
+ i: {
54
+ read: (settings, key) => settings.getInt(key),
55
+ write: (settings, key, value) => settings.setInt(key, expectNumber(value)),
56
+ },
57
+ u: {
58
+ read: (settings, key) => settings.getUint(key),
59
+ write: (settings, key, value) => settings.setUint(key, expectNumber(value)),
60
+ },
61
+ x: {
62
+ read: (settings, key) => settings.getInt64(key),
63
+ write: (settings, key, value) => settings.setInt64(key, expectBigInt(value)),
64
+ },
65
+ t: {
66
+ read: (settings, key) => settings.getUint64(key),
67
+ write: (settings, key, value) => settings.setUint64(key, expectBigInt(value)),
68
+ },
69
+ d: {
70
+ read: (settings, key) => settings.getDouble(key),
71
+ write: (settings, key, value) => settings.setDouble(key, expectNumber(value)),
72
+ },
73
+ s: STRING_ACCESSOR,
74
+ as: STRV_ACCESSOR,
75
+ enum: STRING_ACCESSOR,
76
+ flags: STRV_ACCESSOR,
77
+ };
78
+
79
+ const VARIANT_ACCESSOR: SettingAccessor = {
80
+ read: (settings, key) => settings.getValue(key),
81
+ write: (settings, key, value) => settings.setValue(key, expectVariant(value)),
82
+ };
83
+
84
+ export const resolveAccessor = (kind: string | undefined, key: string, schemaId: string): SettingAccessor => {
85
+ if (kind === undefined) {
86
+ throw new TypeError(`Key "${key}" is not declared by the GSettings schema "${schemaId}"`);
87
+ }
88
+ return ACCESSORS[kind] ?? VARIANT_ACCESSOR;
89
+ };
@@ -0,0 +1,34 @@
1
+ import type * as Gdk from "@gtkx/gi/gdk";
2
+ import type { ReactNode } from "react";
3
+
4
+ /**
5
+ * Props for a text anchor that embeds child widgets at a position within a text view's buffer.
6
+ */
7
+ export type TextAnchorProps = {
8
+ /** The character used to represent the embedded widget in the buffer's text. */
9
+ replacementChar?: string;
10
+ children?: ReactNode;
11
+ };
12
+
13
+ /**
14
+ * Props for a node that embeds a `Gdk.Paintable` within a text view's buffer.
15
+ */
16
+ export type TextPaintableProps = {
17
+ paintable: Gdk.Paintable;
18
+ };
19
+
20
+ type WrapperNodeElementProps = {
21
+ kind: string;
22
+ children?: ReactNode;
23
+ [key: string]: unknown;
24
+ };
25
+
26
+ declare global {
27
+ namespace React {
28
+ namespace JSX {
29
+ interface IntrinsicElements {
30
+ __GTKX_WRAPPER_NODE__: WrapperNodeElementProps;
31
+ }
32
+ }
33
+ }
34
+ }
@@ -1,35 +0,0 @@
1
- import type * as Adw from "@gtkx/ffi/adw";
2
- import type * as Gtk from "@gtkx/ffi/gtk";
3
- import { type ReactNode, type Ref } from "react";
4
- import type { AdwComboRowProps, GtkColumnViewProps, GtkDropDownProps, GtkGridViewProps, GtkListViewProps } from "../generated/jsx.js";
5
- import type { DropDownProps, GridViewProps, ListItem, ListViewProps } from "../jsx.js";
6
- type GenericListViewProps<T, S> = Omit<GtkListViewProps, keyof ListViewProps> & ListViewProps<T, S>;
7
- type GenericGridViewProps<T> = Omit<GtkGridViewProps, keyof GridViewProps> & GridViewProps<T>;
8
- type GenericDropDownProps<T, S> = Omit<GtkDropDownProps, keyof DropDownProps> & DropDownProps<T, S>;
9
- type GenericComboRowProps<T, S> = Omit<AdwComboRowProps, keyof DropDownProps> & DropDownProps<T, S>;
10
- type GenericColumnViewProps<T, S> = Omit<GtkColumnViewProps, "items" | "renderHeader"> & {
11
- items?: ListItem<T, S>[];
12
- renderHeader?: ((item: S) => ReactNode) | null;
13
- };
14
- export declare function GtkListView<T = unknown, S = unknown>(props: GenericListViewProps<T, S> & {
15
- children?: ReactNode;
16
- ref?: Ref<Gtk.ListView>;
17
- }): ReactNode;
18
- export declare function GtkGridView<T = unknown>(props: GenericGridViewProps<T> & {
19
- children?: ReactNode;
20
- ref?: Ref<Gtk.GridView>;
21
- }): ReactNode;
22
- export declare function GtkColumnView<T = unknown, S = unknown>(props: GenericColumnViewProps<T, S> & {
23
- children?: ReactNode;
24
- ref?: Ref<Gtk.ColumnView>;
25
- }): ReactNode;
26
- export declare function GtkDropDown<T = unknown, S = unknown>(props: GenericDropDownProps<T, S> & {
27
- children?: ReactNode;
28
- ref?: Ref<Gtk.DropDown>;
29
- }): ReactNode;
30
- export declare function AdwComboRow<T = unknown, S = unknown>(props: GenericComboRowProps<T, S> & {
31
- children?: ReactNode;
32
- ref?: Ref<Adw.ComboRow>;
33
- }): ReactNode;
34
- export {};
35
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,GAAG,EAAsB,MAAM,OAAO,CAAC;AAC9F,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAIvF,KAAK,oBAAoB,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACpG,KAAK,oBAAoB,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAC9F,KAAK,oBAAoB,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACpG,KAAK,oBAAoB,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACpG,KAAK,sBAAsB,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,cAAc,CAAC,GAAG;IACrF,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC,GAAG,IAAI,CAAC;CAClD,CAAC;AAiCF,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAChD,KAAK,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAE,GACtF,SAAS,CAEX;AAED,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EACnC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAE,GACnF,SAAS,CAEX;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAClD,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;CAAE,GAC1F,SAAS,CAEX;AAED,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAChD,KAAK,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAE,GACtF,SAAS,CAEX;AAED,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAChD,KAAK,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAE,GACtF,SAAS,CAEX"}
@@ -1,40 +0,0 @@
1
- import { createElement, Fragment, useReducer, useRef } from "react";
2
- import { createPortal } from "../portal.js";
3
- function useListHandle() {
4
- const [, rerender] = useReducer((x) => x + 1, 0);
5
- const boundItemsRef = useRef([]);
6
- const headerBoundItemsRef = useRef([]);
7
- return { rerender, boundItemsRef, headerBoundItemsRef };
8
- }
9
- function renderListElement(intrinsicName, handle, props) {
10
- const { rerender, boundItemsRef, headerBoundItemsRef } = handle;
11
- const portals = [];
12
- for (const [content, container, key] of boundItemsRef.current) {
13
- portals.push(createPortal(content, container, key));
14
- }
15
- for (const [content, container, key] of headerBoundItemsRef.current) {
16
- portals.push(createPortal(content, container, key));
17
- }
18
- return createElement(Fragment, null, createElement(intrinsicName, {
19
- ...props,
20
- __boundItemsRef: boundItemsRef,
21
- __rerender: rerender,
22
- __headerBoundItemsRef: headerBoundItemsRef,
23
- }), ...portals);
24
- }
25
- export function GtkListView(props) {
26
- return renderListElement("GtkListView", useListHandle(), props);
27
- }
28
- export function GtkGridView(props) {
29
- return renderListElement("GtkGridView", useListHandle(), props);
30
- }
31
- export function GtkColumnView(props) {
32
- return renderListElement("GtkColumnView", useListHandle(), props);
33
- }
34
- export function GtkDropDown(props) {
35
- return renderListElement("GtkDropDown", useListHandle(), props);
36
- }
37
- export function AdwComboRow(props) {
38
- return renderListElement("AdwComboRow", useListHandle(), props);
39
- }
40
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAA4B,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAU9F,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAW5C,SAAS,aAAa;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,MAAM,CAAc,EAAE,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,MAAM,CAAc,EAAE,CAAC,CAAC;IACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC;AAC5D,CAAC;AAED,SAAS,iBAAiB,CAAC,aAAqB,EAAE,MAAwC,EAAE,KAAa;IACrG,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAEhE,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,aAAa,CAChB,QAAQ,EACR,IAAI,EACJ,aAAa,CAAC,aAAa,EAAE;QACzB,GAAI,KAAiC;QACrC,eAAe,EAAE,aAAa;QAC9B,UAAU,EAAE,QAAQ;QACpB,qBAAqB,EAAE,mBAAmB;KAC7C,CAAC,EACF,GAAG,OAAO,CACb,CAAC;AACN,CAAC;AAED,MAAM,UAAU,WAAW,CACvB,KAAqF;IAErF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,WAAW,CACvB,KAAkF;IAElF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,aAAa,CACzB,KAAyF;IAEzF,OAAO,iBAAiB,CAAC,eAAe,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,WAAW,CACvB,KAAqF;IAErF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,WAAW,CACvB,KAAqF;IAErF,OAAO,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC"}
package/dist/errors.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare class GtkxError extends Error {
2
- widgetType?: string | undefined;
3
- componentStack?: string | undefined;
4
- constructor(message: string, widgetType?: string | undefined, componentStack?: string | undefined);
5
- toString(): string;
6
- }
7
- export declare function formatRenderError(error: unknown, widgetType?: string): GtkxError;
8
- export declare function formatBoundaryError(error: unknown): GtkxError;
9
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAGrB,UAAU,CAAC,EAAE,MAAM;IACnB,cAAc,CAAC,EAAE,MAAM;gBAF9B,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,cAAc,CAAC,EAAE,MAAM,YAAA;IAUzB,QAAQ,IAAI,MAAM;CAa9B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAahF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAO7D"}
package/dist/errors.js DELETED
@@ -1,42 +0,0 @@
1
- export class GtkxError extends Error {
2
- widgetType;
3
- componentStack;
4
- constructor(message, widgetType, componentStack) {
5
- super(message);
6
- this.widgetType = widgetType;
7
- this.componentStack = componentStack;
8
- this.name = "GtkxError";
9
- if (Error.captureStackTrace) {
10
- Error.captureStackTrace(this, GtkxError);
11
- }
12
- }
13
- toString() {
14
- const parts = [`GtkxError: ${this.message}`];
15
- if (this.widgetType) {
16
- parts.push(`Widget Type: ${this.widgetType}`);
17
- }
18
- if (this.componentStack) {
19
- parts.push(`Component Stack:\n${this.componentStack}`);
20
- }
21
- return parts.join("\n");
22
- }
23
- }
24
- export function formatRenderError(error, widgetType) {
25
- if (error instanceof GtkxError) {
26
- return error;
27
- }
28
- if (error instanceof Error) {
29
- console.error("[formatRenderError] Original error stack:", error.stack);
30
- }
31
- const message = error instanceof Error ? error.message : String(error);
32
- const formattedMessage = widgetType ? `Failed to render ${widgetType}: ${message}` : `Render error: ${message}`;
33
- return new GtkxError(formattedMessage, widgetType);
34
- }
35
- export function formatBoundaryError(error) {
36
- if (error instanceof GtkxError) {
37
- return error;
38
- }
39
- const message = error instanceof Error ? error.message : String(error);
40
- return new GtkxError(`Error caught by boundary: ${message}`);
41
- }
42
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGrB;IACA;IAHX,YACI,OAAe,EACR,UAAmB,EACnB,cAAuB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,mBAAc,GAAd,cAAc,CAAS;QAG9B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QAExB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAEQ,QAAQ;QACb,MAAM,KAAK,GAAG,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,qBAAqB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACJ;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,UAAmB;IACjE,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,oBAAoB,UAAU,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,iBAAiB,OAAO,EAAE,CAAC;IAEhH,OAAO,IAAI,SAAS,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAC9C,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,IAAI,SAAS,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC"}
package/dist/factory.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { Node } from "./node.js";
2
- import type { Container, ContainerClass, Props } from "./types.js";
3
- export declare const resolveContainerClass: (type: string) => ContainerClass | null;
4
- export declare const createNode: (typeName: string, props: Props, existingContainer: Container | undefined, rootContainer: Container) => Node;
5
- //# sourceMappingURL=factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnE,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,cAAc,GAAG,IAQrE,CAAC;AAqBF,eAAO,MAAM,UAAU,GACnB,UAAU,MAAM,EAChB,OAAO,KAAK,EACZ,mBAAmB,SAAS,GAAG,SAAS,EACxC,eAAe,SAAS,KACzB,IASF,CAAC"}