@gtkx/react 1.0.0-rc.1 → 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 (381) hide show
  1. package/dist/adw/config.d.ts +2 -0
  2. package/dist/adw/config.d.ts.map +1 -0
  3. package/dist/adw/config.js +2 -0
  4. package/dist/adw/config.js.map +1 -0
  5. package/dist/{libraries/adw → adw}/dialog.d.ts +2 -2
  6. package/dist/adw/dialog.d.ts.map +1 -0
  7. package/dist/adw/dialog.js +25 -0
  8. package/dist/adw/dialog.js.map +1 -0
  9. package/dist/adw/element-behaviors.d.ts +2 -0
  10. package/dist/adw/element-behaviors.d.ts.map +1 -0
  11. package/dist/adw/element-behaviors.js +299 -0
  12. package/dist/adw/element-behaviors.js.map +1 -0
  13. package/dist/adw/element-config.d.ts +9 -0
  14. package/dist/adw/element-config.d.ts.map +1 -0
  15. package/dist/adw/element-config.js +137 -0
  16. package/dist/adw/element-config.js.map +1 -0
  17. package/dist/adw/index.d.ts +4 -0
  18. package/dist/adw/index.d.ts.map +1 -0
  19. package/dist/adw/index.js +3 -0
  20. package/dist/adw/index.js.map +1 -0
  21. package/dist/adw/prop-types.d.ts +29 -0
  22. package/dist/adw/prop-types.d.ts.map +1 -0
  23. package/dist/adw/prop-types.js +2 -0
  24. package/dist/adw/prop-types.js.map +1 -0
  25. package/dist/bootstrap.d.ts +2 -0
  26. package/dist/bootstrap.d.ts.map +1 -0
  27. package/dist/bootstrap.js +5 -0
  28. package/dist/bootstrap.js.map +1 -0
  29. package/dist/components/application.d.ts +2 -2
  30. package/dist/components/application.d.ts.map +1 -1
  31. package/dist/components/application.js +31 -18
  32. package/dist/components/application.js.map +1 -1
  33. package/dist/components/element.d.ts +6 -0
  34. package/dist/components/element.d.ts.map +1 -0
  35. package/dist/components/element.js +29 -0
  36. package/dist/components/element.js.map +1 -0
  37. package/dist/components/window.d.ts +2 -2
  38. package/dist/components/window.d.ts.map +1 -1
  39. package/dist/components/window.js +10 -11
  40. package/dist/components/window.js.map +1 -1
  41. package/dist/config.d.ts +4 -0
  42. package/dist/config.d.ts.map +1 -0
  43. package/dist/config.js +3 -0
  44. package/dist/config.js.map +1 -0
  45. package/dist/element-behaviors.d.ts +2 -0
  46. package/dist/element-behaviors.d.ts.map +1 -0
  47. package/dist/element-behaviors.js +348 -0
  48. package/dist/element-behaviors.js.map +1 -0
  49. package/dist/element-config.d.ts +10 -0
  50. package/dist/element-config.d.ts.map +1 -0
  51. package/dist/element-config.js +146 -0
  52. package/dist/element-config.js.map +1 -0
  53. package/dist/hooks/use-application.d.ts +4 -3
  54. package/dist/hooks/use-application.d.ts.map +1 -1
  55. package/dist/hooks/use-application.js +5 -4
  56. package/dist/hooks/use-application.js.map +1 -1
  57. package/dist/hooks/use-bind-setting.d.ts +21 -4
  58. package/dist/hooks/use-bind-setting.d.ts.map +1 -1
  59. package/dist/hooks/use-bind-setting.js +27 -16
  60. package/dist/hooks/use-bind-setting.js.map +1 -1
  61. package/dist/hooks/use-merged-refs.d.ts +8 -0
  62. package/dist/hooks/use-merged-refs.d.ts.map +1 -0
  63. package/dist/hooks/use-merged-refs.js +48 -0
  64. package/dist/hooks/use-merged-refs.js.map +1 -0
  65. package/dist/hooks/use-object-value.d.ts +3 -2
  66. package/dist/hooks/use-object-value.d.ts.map +1 -1
  67. package/dist/hooks/use-object-value.js +18 -21
  68. package/dist/hooks/use-object-value.js.map +1 -1
  69. package/dist/hooks/use-parent-window.d.ts +3 -2
  70. package/dist/hooks/use-parent-window.d.ts.map +1 -1
  71. package/dist/hooks/use-parent-window.js +3 -2
  72. package/dist/hooks/use-parent-window.js.map +1 -1
  73. package/dist/hooks/use-property.d.ts +5 -5
  74. package/dist/hooks/use-property.d.ts.map +1 -1
  75. package/dist/hooks/use-property.js +4 -3
  76. package/dist/hooks/use-property.js.map +1 -1
  77. package/dist/hooks/use-setting.d.ts +5 -16
  78. package/dist/hooks/use-setting.d.ts.map +1 -1
  79. package/dist/hooks/use-setting.js +16 -11
  80. package/dist/hooks/use-setting.js.map +1 -1
  81. package/dist/hooks/use-signal.d.ts +10 -7
  82. package/dist/hooks/use-signal.d.ts.map +1 -1
  83. package/dist/hooks/use-signal.js +29 -18
  84. package/dist/hooks/use-signal.js.map +1 -1
  85. package/dist/index.d.ts +7 -8
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +2 -3
  88. package/dist/index.js.map +1 -1
  89. package/dist/internal.d.ts +6 -7
  90. package/dist/internal.d.ts.map +1 -1
  91. package/dist/internal.js +5 -7
  92. package/dist/internal.js.map +1 -1
  93. package/dist/prop-types.d.ts +110 -0
  94. package/dist/prop-types.d.ts.map +1 -0
  95. package/dist/prop-types.js +2 -0
  96. package/dist/prop-types.js.map +1 -0
  97. package/dist/reconciler/apply-props.d.ts +10 -7
  98. package/dist/reconciler/apply-props.d.ts.map +1 -1
  99. package/dist/reconciler/apply-props.js +182 -84
  100. package/dist/reconciler/apply-props.js.map +1 -1
  101. package/dist/reconciler/behaviors.d.ts +59 -0
  102. package/dist/reconciler/behaviors.d.ts.map +1 -0
  103. package/dist/reconciler/behaviors.js +172 -0
  104. package/dist/reconciler/behaviors.js.map +1 -0
  105. package/dist/reconciler/child-routing.d.ts +5 -0
  106. package/dist/reconciler/child-routing.d.ts.map +1 -0
  107. package/dist/reconciler/child-routing.js +156 -0
  108. package/dist/reconciler/child-routing.js.map +1 -0
  109. package/dist/reconciler/host-config.d.ts +8 -12
  110. package/dist/reconciler/host-config.d.ts.map +1 -1
  111. package/dist/reconciler/host-config.js +175 -270
  112. package/dist/reconciler/host-config.js.map +1 -1
  113. package/dist/reconciler/instance.d.ts +4 -5
  114. package/dist/reconciler/instance.d.ts.map +1 -1
  115. package/dist/reconciler/instance.js +44 -22
  116. package/dist/reconciler/instance.js.map +1 -1
  117. package/dist/reconciler/metadata.d.ts +17 -0
  118. package/dist/reconciler/metadata.d.ts.map +1 -0
  119. package/dist/reconciler/metadata.js +82 -0
  120. package/dist/reconciler/metadata.js.map +1 -0
  121. package/dist/reconciler/node.d.ts +76 -0
  122. package/dist/reconciler/node.d.ts.map +1 -0
  123. package/dist/reconciler/node.js +53 -0
  124. package/dist/reconciler/node.js.map +1 -0
  125. package/dist/reconciler/placement.d.ts +5 -0
  126. package/dist/reconciler/placement.d.ts.map +1 -0
  127. package/dist/reconciler/placement.js +175 -0
  128. package/dist/reconciler/placement.js.map +1 -0
  129. package/dist/reconciler/registry.d.ts +92 -0
  130. package/dist/reconciler/registry.d.ts.map +1 -0
  131. package/dist/reconciler/registry.js +64 -0
  132. package/dist/reconciler/registry.js.map +1 -0
  133. package/dist/reconciler/root-element.d.ts +9 -12
  134. package/dist/reconciler/root-element.d.ts.map +1 -1
  135. package/dist/reconciler/root-element.js +6 -6
  136. package/dist/reconciler/root-element.js.map +1 -1
  137. package/dist/reconciler/root.d.ts +56 -0
  138. package/dist/reconciler/root.d.ts.map +1 -0
  139. package/dist/reconciler/root.js +109 -0
  140. package/dist/reconciler/root.js.map +1 -0
  141. package/dist/reconciler/signals.d.ts +10 -0
  142. package/dist/reconciler/signals.d.ts.map +1 -0
  143. package/dist/reconciler/signals.js +70 -0
  144. package/dist/reconciler/signals.js.map +1 -0
  145. package/dist/reconciler/text.d.ts +19 -0
  146. package/dist/reconciler/text.d.ts.map +1 -0
  147. package/dist/reconciler/text.js +276 -0
  148. package/dist/reconciler/text.js.map +1 -0
  149. package/dist/utils/accessible-metadata.d.ts +11 -4
  150. package/dist/utils/accessible-metadata.d.ts.map +1 -1
  151. package/dist/utils/accessible-metadata.js +20 -17
  152. package/dist/utils/accessible-metadata.js.map +1 -1
  153. package/dist/{reconciler/accessible.d.ts → utils/accessible-props.d.ts} +7 -6
  154. package/dist/utils/accessible-props.d.ts.map +1 -0
  155. package/dist/utils/accessible-props.js +181 -0
  156. package/dist/utils/accessible-props.js.map +1 -0
  157. package/dist/utils/ref-prop.d.ts +15 -0
  158. package/dist/utils/ref-prop.d.ts.map +1 -0
  159. package/dist/utils/ref-prop.js +18 -0
  160. package/dist/utils/ref-prop.js.map +1 -0
  161. package/dist/utils/settings.d.ts +17 -0
  162. package/dist/utils/settings.d.ts.map +1 -0
  163. package/dist/utils/settings.js +37 -0
  164. package/dist/utils/settings.js.map +1 -0
  165. package/dist/utils/variant.d.ts +57 -0
  166. package/dist/utils/variant.d.ts.map +1 -0
  167. package/dist/utils/variant.js +197 -0
  168. package/dist/utils/variant.js.map +1 -0
  169. package/env.d.ts +9 -0
  170. package/package.json +36 -11
  171. package/src/adw/config.ts +1 -0
  172. package/src/adw/dialog.tsx +35 -0
  173. package/src/adw/element-behaviors.ts +379 -0
  174. package/src/adw/element-config.ts +140 -0
  175. package/src/adw/index.ts +4 -0
  176. package/src/adw/prop-types.ts +42 -0
  177. package/src/bootstrap.ts +5 -0
  178. package/src/components/application.tsx +42 -23
  179. package/src/components/element.tsx +47 -0
  180. package/src/components/window.tsx +12 -13
  181. package/src/config.ts +3 -0
  182. package/src/element-behaviors.ts +424 -0
  183. package/src/element-config.ts +148 -0
  184. package/src/env.d.ts +1 -0
  185. package/src/hooks/use-application.ts +6 -4
  186. package/src/hooks/use-bind-setting.ts +47 -31
  187. package/src/hooks/use-merged-refs.ts +64 -0
  188. package/src/hooks/use-object-value.ts +27 -23
  189. package/src/hooks/use-parent-window.ts +4 -2
  190. package/src/hooks/use-property.ts +11 -10
  191. package/src/hooks/use-setting.ts +20 -33
  192. package/src/hooks/use-signal.ts +37 -48
  193. package/src/index.ts +7 -8
  194. package/src/internal.ts +7 -18
  195. package/src/prop-types.ts +142 -0
  196. package/src/reconciler/apply-props.ts +233 -85
  197. package/src/reconciler/behaviors.ts +324 -0
  198. package/src/reconciler/child-routing.ts +202 -0
  199. package/src/reconciler/host-config.ts +239 -366
  200. package/src/reconciler/instance.ts +76 -24
  201. package/src/reconciler/metadata.ts +119 -0
  202. package/src/reconciler/node.ts +161 -0
  203. package/src/reconciler/placement.ts +255 -0
  204. package/src/reconciler/registry.ts +161 -0
  205. package/src/reconciler/root-element.ts +9 -11
  206. package/src/reconciler/root.ts +175 -0
  207. package/src/reconciler/signals.ts +113 -0
  208. package/src/reconciler/text.ts +407 -0
  209. package/src/utils/accessible-metadata.ts +23 -18
  210. package/src/utils/accessible-props.ts +279 -0
  211. package/src/utils/ref-prop.ts +30 -0
  212. package/src/utils/settings.ts +69 -0
  213. package/src/utils/variant.ts +368 -0
  214. package/dist/hooks/use-merge-refs.d.ts +0 -3
  215. package/dist/hooks/use-merge-refs.d.ts.map +0 -1
  216. package/dist/hooks/use-merge-refs.js +0 -48
  217. package/dist/hooks/use-merge-refs.js.map +0 -1
  218. package/dist/hooks/use-object-attachment.d.ts +0 -10
  219. package/dist/hooks/use-object-attachment.d.ts.map +0 -1
  220. package/dist/hooks/use-object-attachment.js +0 -24
  221. package/dist/hooks/use-object-attachment.js.map +0 -1
  222. package/dist/libraries/adw/dialog.d.ts.map +0 -1
  223. package/dist/libraries/adw/dialog.js +0 -25
  224. package/dist/libraries/adw/dialog.js.map +0 -1
  225. package/dist/libraries/adw/index.d.ts +0 -2
  226. package/dist/libraries/adw/index.d.ts.map +0 -1
  227. package/dist/libraries/adw/index.js +0 -2
  228. package/dist/libraries/adw/index.js.map +0 -1
  229. package/dist/reconciler/accessible.d.ts.map +0 -1
  230. package/dist/reconciler/accessible.js +0 -143
  231. package/dist/reconciler/accessible.js.map +0 -1
  232. package/dist/reconciler/commit-flush.d.ts +0 -3
  233. package/dist/reconciler/commit-flush.d.ts.map +0 -1
  234. package/dist/reconciler/commit-flush.js +0 -13
  235. package/dist/reconciler/commit-flush.js.map +0 -1
  236. package/dist/reconciler/container-attach.d.ts +0 -10
  237. package/dist/reconciler/container-attach.d.ts.map +0 -1
  238. package/dist/reconciler/container-attach.js +0 -216
  239. package/dist/reconciler/container-attach.js.map +0 -1
  240. package/dist/reconciler/content-rebuild.d.ts +0 -3
  241. package/dist/reconciler/content-rebuild.d.ts.map +0 -1
  242. package/dist/reconciler/content-rebuild.js +0 -15
  243. package/dist/reconciler/content-rebuild.js.map +0 -1
  244. package/dist/reconciler/dispatch.d.ts +0 -6
  245. package/dist/reconciler/dispatch.d.ts.map +0 -1
  246. package/dist/reconciler/dispatch.js +0 -61
  247. package/dist/reconciler/dispatch.js.map +0 -1
  248. package/dist/reconciler/element-prop-appliers.d.ts +0 -5
  249. package/dist/reconciler/element-prop-appliers.d.ts.map +0 -1
  250. package/dist/reconciler/element-prop-appliers.js +0 -104
  251. package/dist/reconciler/element-prop-appliers.js.map +0 -1
  252. package/dist/reconciler/element-props.d.ts +0 -25
  253. package/dist/reconciler/element-props.d.ts.map +0 -1
  254. package/dist/reconciler/element-props.js +0 -157
  255. package/dist/reconciler/element-props.js.map +0 -1
  256. package/dist/reconciler/label-text-rebuild.d.ts +0 -3
  257. package/dist/reconciler/label-text-rebuild.d.ts.map +0 -1
  258. package/dist/reconciler/label-text-rebuild.js +0 -22
  259. package/dist/reconciler/label-text-rebuild.js.map +0 -1
  260. package/dist/reconciler/portal.d.ts +0 -11
  261. package/dist/reconciler/portal.d.ts.map +0 -1
  262. package/dist/reconciler/portal.js +0 -20
  263. package/dist/reconciler/portal.js.map +0 -1
  264. package/dist/reconciler/reconciler-error-handler.d.ts +0 -7
  265. package/dist/reconciler/reconciler-error-handler.d.ts.map +0 -1
  266. package/dist/reconciler/reconciler-error-handler.js +0 -24
  267. package/dist/reconciler/reconciler-error-handler.js.map +0 -1
  268. package/dist/reconciler/reconciler-root.d.ts +0 -19
  269. package/dist/reconciler/reconciler-root.d.ts.map +0 -1
  270. package/dist/reconciler/reconciler-root.js +0 -24
  271. package/dist/reconciler/reconciler-root.js.map +0 -1
  272. package/dist/reconciler/reconciler.d.ts +0 -3
  273. package/dist/reconciler/reconciler.d.ts.map +0 -1
  274. package/dist/reconciler/reconciler.js +0 -12
  275. package/dist/reconciler/reconciler.js.map +0 -1
  276. package/dist/reconciler/render.d.ts +0 -23
  277. package/dist/reconciler/render.d.ts.map +0 -1
  278. package/dist/reconciler/render.js +0 -46
  279. package/dist/reconciler/render.js.map +0 -1
  280. package/dist/reconciler/signal-store.d.ts +0 -22
  281. package/dist/reconciler/signal-store.d.ts.map +0 -1
  282. package/dist/reconciler/signal-store.js +0 -84
  283. package/dist/reconciler/signal-store.js.map +0 -1
  284. package/dist/reconciler/state.d.ts +0 -36
  285. package/dist/reconciler/state.d.ts.map +0 -1
  286. package/dist/reconciler/state.js +0 -38
  287. package/dist/reconciler/state.js.map +0 -1
  288. package/dist/reconciler/text-buffer-controller.d.ts +0 -17
  289. package/dist/reconciler/text-buffer-controller.d.ts.map +0 -1
  290. package/dist/reconciler/text-buffer-controller.js +0 -102
  291. package/dist/reconciler/text-buffer-controller.js.map +0 -1
  292. package/dist/reconciler/text-buffer-rebuild.d.ts +0 -3
  293. package/dist/reconciler/text-buffer-rebuild.d.ts.map +0 -1
  294. package/dist/reconciler/text-buffer-rebuild.js +0 -7
  295. package/dist/reconciler/text-buffer-rebuild.js.map +0 -1
  296. package/dist/reconciler/text-node.d.ts +0 -7
  297. package/dist/reconciler/text-node.d.ts.map +0 -1
  298. package/dist/reconciler/text-node.js +0 -8
  299. package/dist/reconciler/text-node.js.map +0 -1
  300. package/dist/reconciler/types.d.ts +0 -5
  301. package/dist/reconciler/types.d.ts.map +0 -1
  302. package/dist/reconciler/types.js +0 -2
  303. package/dist/reconciler/types.js.map +0 -1
  304. package/dist/reconciler/visibility.d.ts +0 -6
  305. package/dist/reconciler/visibility.d.ts.map +0 -1
  306. package/dist/reconciler/visibility.js +0 -57
  307. package/dist/reconciler/visibility.js.map +0 -1
  308. package/dist/reconciler/wrapper-apply.d.ts +0 -6
  309. package/dist/reconciler/wrapper-apply.d.ts.map +0 -1
  310. package/dist/reconciler/wrapper-apply.js +0 -287
  311. package/dist/reconciler/wrapper-apply.js.map +0 -1
  312. package/dist/reconciler/wrapper-content.d.ts +0 -8
  313. package/dist/reconciler/wrapper-content.d.ts.map +0 -1
  314. package/dist/reconciler/wrapper-content.js +0 -19
  315. package/dist/reconciler/wrapper-content.js.map +0 -1
  316. package/dist/reconciler/wrapper-node.d.ts +0 -8
  317. package/dist/reconciler/wrapper-node.d.ts.map +0 -1
  318. package/dist/reconciler/wrapper-node.js +0 -4
  319. package/dist/reconciler/wrapper-node.js.map +0 -1
  320. package/dist/reconciler/wrapper-protocol.d.ts +0 -13
  321. package/dist/reconciler/wrapper-protocol.d.ts.map +0 -1
  322. package/dist/reconciler/wrapper-protocol.js +0 -20
  323. package/dist/reconciler/wrapper-protocol.js.map +0 -1
  324. package/dist/utils/create-element-component.d.ts +0 -4
  325. package/dist/utils/create-element-component.d.ts.map +0 -1
  326. package/dist/utils/create-element-component.js +0 -54
  327. package/dist/utils/create-element-component.js.map +0 -1
  328. package/dist/utils/gtype.d.ts +0 -16
  329. package/dist/utils/gtype.d.ts.map +0 -1
  330. package/dist/utils/gtype.js +0 -127
  331. package/dist/utils/gtype.js.map +0 -1
  332. package/dist/utils/notify-name.d.ts +0 -5
  333. package/dist/utils/notify-name.d.ts.map +0 -1
  334. package/dist/utils/notify-name.js +0 -6
  335. package/dist/utils/notify-name.js.map +0 -1
  336. package/dist/utils/object-prop.d.ts +0 -8
  337. package/dist/utils/object-prop.d.ts.map +0 -1
  338. package/dist/utils/object-prop.js +0 -9
  339. package/dist/utils/object-prop.js.map +0 -1
  340. package/dist/utils/settings-accessor.d.ts +0 -8
  341. package/dist/utils/settings-accessor.d.ts.map +0 -1
  342. package/dist/utils/settings-accessor.js +0 -69
  343. package/dist/utils/settings-accessor.js.map +0 -1
  344. package/dist/utils/wrapper-node-jsx.d.ts +0 -32
  345. package/dist/utils/wrapper-node-jsx.d.ts.map +0 -1
  346. package/dist/utils/wrapper-node-jsx.js +0 -2
  347. package/dist/utils/wrapper-node-jsx.js.map +0 -1
  348. package/src/hooks/use-merge-refs.ts +0 -53
  349. package/src/hooks/use-object-attachment.ts +0 -35
  350. package/src/libraries/adw/dialog.tsx +0 -34
  351. package/src/libraries/adw/index.ts +0 -1
  352. package/src/reconciler/accessible.ts +0 -232
  353. package/src/reconciler/commit-flush.ts +0 -13
  354. package/src/reconciler/container-attach.ts +0 -219
  355. package/src/reconciler/content-rebuild.ts +0 -19
  356. package/src/reconciler/dispatch.ts +0 -58
  357. package/src/reconciler/element-prop-appliers.ts +0 -110
  358. package/src/reconciler/element-props.ts +0 -192
  359. package/src/reconciler/label-text-rebuild.ts +0 -26
  360. package/src/reconciler/portal.ts +0 -28
  361. package/src/reconciler/reconciler-error-handler.ts +0 -29
  362. package/src/reconciler/reconciler-root.ts +0 -57
  363. package/src/reconciler/reconciler.ts +0 -13
  364. package/src/reconciler/render.ts +0 -61
  365. package/src/reconciler/signal-store.ts +0 -103
  366. package/src/reconciler/state.ts +0 -72
  367. package/src/reconciler/text-buffer-controller.ts +0 -107
  368. package/src/reconciler/text-buffer-rebuild.ts +0 -12
  369. package/src/reconciler/text-node.ts +0 -13
  370. package/src/reconciler/types.ts +0 -6
  371. package/src/reconciler/visibility.ts +0 -52
  372. package/src/reconciler/wrapper-apply.ts +0 -308
  373. package/src/reconciler/wrapper-content.ts +0 -24
  374. package/src/reconciler/wrapper-node.ts +0 -8
  375. package/src/reconciler/wrapper-protocol.ts +0 -32
  376. package/src/utils/create-element-component.ts +0 -77
  377. package/src/utils/gtype.ts +0 -166
  378. package/src/utils/notify-name.ts +0 -10
  379. package/src/utils/object-prop.ts +0 -13
  380. package/src/utils/settings-accessor.ts +0 -89
  381. package/src/utils/wrapper-node-jsx.ts +0 -34
@@ -1,127 +0,0 @@
1
- /// <reference types="@gtkx/config/env" />
2
- import { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS } from "virtual:gtkx-config";
3
- import * as GObject from "@gtkx/gi/gobject";
4
- import { getWrapperClass } from "@gtkx/runtime";
5
- import { NOTIFY_SIGNAL, propToNotifySignal } from "./notify-name.js";
6
- const NOTIFY_PREFIX = "onNotify";
7
- const resolveNotifySignal = (propName) => {
8
- if (propName === NOTIFY_PREFIX)
9
- return NOTIFY_SIGNAL;
10
- if (!propName.startsWith(NOTIFY_PREFIX))
11
- return null;
12
- const tail = propName.slice(NOTIFY_PREFIX.length);
13
- if (tail.charAt(0) !== tail.charAt(0).toUpperCase())
14
- return null;
15
- return propToNotifySignal(tail);
16
- };
17
- const typeNameChainCache = new Map();
18
- const interfaceNamesCache = new Map();
19
- const typeNameSetCache = new Map();
20
- const signalCache = new Map();
21
- const constructOnlyCache = new Map();
22
- const defaultPropCache = new Map();
23
- const constructablePropsCache = new Map();
24
- const memoizeGtype = (cache, gtype, compute) => {
25
- const cached = cache.get(gtype);
26
- if (cached !== undefined)
27
- return cached;
28
- const result = compute();
29
- cache.set(gtype, result);
30
- return result;
31
- };
32
- const collectTypeNameChain = (gtype) => memoizeGtype(typeNameChainCache, gtype, () => {
33
- const chain = [];
34
- let current = gtype;
35
- while (current !== 0n) {
36
- const name = GObject.typeName(current);
37
- if (!name)
38
- break;
39
- chain.push(name);
40
- current = GObject.typeParent(current);
41
- }
42
- return chain;
43
- });
44
- const collectInterfaceNames = (gtype) => memoizeGtype(interfaceNamesCache, gtype, () => {
45
- const names = [];
46
- for (const iface of GObject.typeInterfaces(gtype)) {
47
- const name = GObject.typeName(iface);
48
- if (name)
49
- names.push(name);
50
- }
51
- return names;
52
- });
53
- const typeNamesWithInterfacesCache = new Map();
54
- export const collectTypeNamesWithInterfaces = (gtype) => memoizeGtype(typeNamesWithInterfacesCache, gtype, () => [
55
- ...collectTypeNameChain(gtype),
56
- ...collectInterfaceNames(gtype),
57
- ]);
58
- const foldInheritedTable = (gtype, table, fold, seed) => {
59
- let accumulator = seed;
60
- for (const name of collectTypeNameChain(gtype)) {
61
- const row = table[name];
62
- if (row !== undefined)
63
- accumulator = fold(accumulator, row);
64
- }
65
- return accumulator;
66
- };
67
- export const foldInheritedTableWithInterfaces = (gtype, table, fold, seed) => {
68
- let accumulator = foldInheritedTable(gtype, table, fold, seed);
69
- for (const name of collectInterfaceNames(gtype)) {
70
- const row = table[name];
71
- if (row !== undefined)
72
- accumulator = fold(accumulator, row);
73
- }
74
- return accumulator;
75
- };
76
- export const typeChainIncludes = (gtype, name) => memoizeGtype(typeNameSetCache, gtype, () => new Set(collectTypeNameChain(gtype))).has(name);
77
- const memoize = (cache, instance, key, compute) => {
78
- const gtype = instance.__type__;
79
- const perGtype = memoizeGtype(cache, gtype, () => new Map());
80
- const cached = perGtype.get(key);
81
- if (cached !== undefined)
82
- return cached;
83
- const result = compute(collectTypeNameChain(gtype));
84
- perGtype.set(key, result);
85
- return result;
86
- };
87
- export const collectConstructableProps = (gtype) => memoizeGtype(constructablePropsCache, gtype, () => foldInheritedTable(gtype, CONSTRUCT_PROPS, (collected, props) => {
88
- for (const prop of props)
89
- collected.add(prop);
90
- return collected;
91
- }, new Set()));
92
- export const isConstructOnlyProp = (instance, key) => memoize(constructOnlyCache, instance, key, (typeNames) => {
93
- for (const name of typeNames) {
94
- if (CONSTRUCT_ONLY_PROPS[name]?.has(key))
95
- return true;
96
- }
97
- return false;
98
- });
99
- export const resolveSignal = (instance, propName) => {
100
- const notify = resolveNotifySignal(propName);
101
- if (notify)
102
- return notify;
103
- return memoize(signalCache, instance, propName, (typeNames) => {
104
- for (const name of typeNames) {
105
- const result = SIGNALS[name]?.[propName];
106
- if (result)
107
- return result;
108
- }
109
- return null;
110
- });
111
- };
112
- const NO_DEFAULT_PROP = { has: false, value: undefined };
113
- export const resolveDefaultProp = (instance, key) => memoize(defaultPropCache, instance, key, (typeNames) => {
114
- for (const name of typeNames) {
115
- const table = DEFAULT_PROPS[name];
116
- if (table && key in table)
117
- return { has: true, value: table[key] };
118
- }
119
- return NO_DEFAULT_PROP;
120
- });
121
- export const requireClassByName = (typeName) => {
122
- const gtype = GObject.typeFromName(typeName);
123
- if (gtype === GObject.TYPE_INVALID)
124
- throw new Error(`${typeName} is not registered. Import its @gtkx/jsx namespace module (e.g. \`import "@gtkx/jsx/adw"\`) before use.`);
125
- return getWrapperClass(gtype);
126
- };
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AAC,CAAC;AAEP,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAA4D,EAAE;IAC7G,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,KAAK,OAAO,CAAC,YAAY;QAC9B,MAAM,IAAI,KAAK,CACX,GAAG,QAAQ,yGAAyG,CACvH,CAAC;IACN,OAAO,eAAe,CAAC,KAAK,CAET,CAAC;AACxB,CAAC,CAAC","sourcesContent":["/// <reference types=\"@gtkx/config/env\" />\n\nimport { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS } from \"virtual:gtkx-config\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport { getWrapperClass, type TypedClass } from \"@gtkx/runtime\";\nimport { NOTIFY_SIGNAL, propToNotifySignal } from \"./notify-name.js\";\n\nconst NOTIFY_PREFIX = \"onNotify\";\n\nconst resolveNotifySignal = (propName: string): string | null => {\n if (propName === NOTIFY_PREFIX) return NOTIFY_SIGNAL;\n if (!propName.startsWith(NOTIFY_PREFIX)) return null;\n const tail = propName.slice(NOTIFY_PREFIX.length);\n if (tail.charAt(0) !== tail.charAt(0).toUpperCase()) return null;\n return propToNotifySignal(tail);\n};\n\nconst typeNameChainCache = new Map<bigint, string[]>();\nconst interfaceNamesCache = new Map<bigint, string[]>();\nconst typeNameSetCache = new Map<bigint, Set<string>>();\nconst signalCache = new Map<bigint, Map<string, string | null>>();\nconst constructOnlyCache = new Map<bigint, Map<string, boolean>>();\nconst defaultPropCache = new Map<bigint, Map<string, DefaultPropLookup>>();\nconst constructablePropsCache = new Map<bigint, Set<string>>();\n\nconst memoizeGtype = <T>(cache: Map<bigint, T>, gtype: bigint, compute: () => T): T => {\n const cached = cache.get(gtype);\n if (cached !== undefined) return cached;\n const result = compute();\n cache.set(gtype, result);\n return result;\n};\n\nconst collectTypeNameChain = (gtype: bigint): string[] =>\n memoizeGtype(typeNameChainCache, gtype, () => {\n const chain: string[] = [];\n let current = gtype;\n while (current !== 0n) {\n const name = GObject.typeName(current);\n if (!name) break;\n chain.push(name);\n current = GObject.typeParent(current);\n }\n return chain;\n });\n\nconst collectInterfaceNames = (gtype: bigint): string[] =>\n memoizeGtype(interfaceNamesCache, gtype, () => {\n const names: string[] = [];\n for (const iface of GObject.typeInterfaces(gtype)) {\n const name = GObject.typeName(iface);\n if (name) names.push(name);\n }\n return names;\n });\n\nconst typeNamesWithInterfacesCache = new Map<bigint, string[]>();\n\nexport const collectTypeNamesWithInterfaces = (gtype: bigint): string[] =>\n memoizeGtype(typeNamesWithInterfacesCache, gtype, () => [\n ...collectTypeNameChain(gtype),\n ...collectInterfaceNames(gtype),\n ]);\n\nconst foldInheritedTable = <R, T>(\n gtype: bigint,\n table: Record<string, R>,\n fold: (accumulator: T, row: R) => T,\n seed: T,\n): T => {\n let accumulator = seed;\n for (const name of collectTypeNameChain(gtype)) {\n const row = table[name];\n if (row !== undefined) accumulator = fold(accumulator, row);\n }\n return accumulator;\n};\n\nexport const foldInheritedTableWithInterfaces = <R, T>(\n gtype: bigint,\n table: Record<string, R>,\n fold: (accumulator: T, row: R) => T,\n seed: T,\n): T => {\n let accumulator = foldInheritedTable(gtype, table, fold, seed);\n for (const name of collectInterfaceNames(gtype)) {\n const row = table[name];\n if (row !== undefined) accumulator = fold(accumulator, row);\n }\n return accumulator;\n};\n\nexport const typeChainIncludes = (gtype: bigint, name: string): boolean =>\n memoizeGtype(typeNameSetCache, gtype, () => new Set(collectTypeNameChain(gtype))).has(name);\n\nconst memoize = <T>(\n cache: Map<bigint, Map<string, T>>,\n instance: TypedClass,\n key: string,\n compute: (typeNames: string[]) => T,\n): T => {\n const gtype = instance.__type__;\n const perGtype = memoizeGtype(cache, gtype, () => new Map<string, T>());\n const cached = perGtype.get(key);\n if (cached !== undefined) return cached;\n const result = compute(collectTypeNameChain(gtype));\n perGtype.set(key, result);\n return result;\n};\n\nexport const collectConstructableProps = (gtype: bigint): Set<string> =>\n memoizeGtype(constructablePropsCache, gtype, () =>\n foldInheritedTable(\n gtype,\n CONSTRUCT_PROPS,\n (collected: Set<string>, props) => {\n for (const prop of props) collected.add(prop);\n return collected;\n },\n new Set<string>(),\n ),\n );\n\nexport const isConstructOnlyProp = (instance: TypedClass, key: string): boolean =>\n memoize(constructOnlyCache, instance, key, (typeNames) => {\n for (const name of typeNames) {\n if (CONSTRUCT_ONLY_PROPS[name]?.has(key)) return true;\n }\n return false;\n });\n\nexport const resolveSignal = (instance: TypedClass, propName: string): string | null => {\n const notify = resolveNotifySignal(propName);\n if (notify) return notify;\n return memoize(signalCache, instance, propName, (typeNames) => {\n for (const name of typeNames) {\n const result = SIGNALS[name]?.[propName];\n if (result) return result;\n }\n return null;\n });\n};\n\ntype DefaultPropLookup = { has: boolean; value: unknown };\n\nconst NO_DEFAULT_PROP: DefaultPropLookup = { has: false, value: undefined };\n\nexport const resolveDefaultProp = (instance: TypedClass, key: string): DefaultPropLookup =>\n memoize(defaultPropCache, instance, key, (typeNames) => {\n for (const name of typeNames) {\n const table = DEFAULT_PROPS[name];\n if (table && key in table) return { has: true, value: table[key] };\n }\n return NO_DEFAULT_PROP;\n });\n\nexport const requireClassByName = (typeName: string): (new (props: Record<string, unknown>) => GObject.Object) => {\n const gtype = GObject.typeFromName(typeName);\n if (gtype === GObject.TYPE_INVALID)\n throw new Error(\n `${typeName} is not registered. Import its @gtkx/jsx namespace module (e.g. \\`import \"@gtkx/jsx/adw\"\\`) before use.`,\n );\n return getWrapperClass(gtype) as new (\n props: Record<string, unknown>,\n ) => GObject.Object;\n};\n"]}
@@ -1,5 +0,0 @@
1
- export declare const NOTIFY_SIGNAL = "notify";
2
- export declare const NOTIFY_DETAIL_PREFIX = "notify::";
3
- export declare const propToNotifySignal: (property: string) => `notify::${string}`;
4
- export declare const notifyDetailToProp: (detail: string) => string;
5
- //# sourceMappingURL=notify-name.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notify-name.d.ts","sourceRoot":"","sources":["../../src/utils/notify-name.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,eAAO,MAAM,kBAAkB,aAAc,MAAM,KAAG,WAAW,MAAM,EAClB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,WAAY,MAAM,KAAG,MAAgE,CAAC"}
@@ -1,6 +0,0 @@
1
- import { toCamelCase, toKebabCase } from "@gtkx/utils";
2
- export const NOTIFY_SIGNAL = "notify";
3
- export const NOTIFY_DETAIL_PREFIX = "notify::";
4
- export const propToNotifySignal = (property) => `${NOTIFY_DETAIL_PREFIX}${toKebabCase(property)}`;
5
- export const notifyDetailToProp = (detail) => toCamelCase(detail.slice(NOTIFY_DETAIL_PREFIX.length));
6
- //# sourceMappingURL=notify-name.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notify-name.js","sourceRoot":"","sources":["../../src/utils/notify-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAuB,EAAE,CACxE,GAAG,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { toCamelCase, toKebabCase } from \"@gtkx/utils\";\n\nexport const NOTIFY_SIGNAL = \"notify\";\n\nexport const NOTIFY_DETAIL_PREFIX = \"notify::\";\n\nexport const propToNotifySignal = (property: string): `notify::${string}` =>\n `${NOTIFY_DETAIL_PREFIX}${toKebabCase(property)}`;\n\nexport const notifyDetailToProp = (detail: string): string => toCamelCase(detail.slice(NOTIFY_DETAIL_PREFIX.length));\n"]}
@@ -1,8 +0,0 @@
1
- import * as GObject from "@gtkx/gi/gobject";
2
- import type { RefObject } from "react";
3
- /**
4
- * An object accepted by the GObject-aware hooks: a GObject, a ref to one, or a nullish value.
5
- */
6
- export type ObjectProp<T extends GObject.Object> = T | RefObject<T | null> | null | undefined;
7
- export declare const resolveObjectProp: <T extends GObject.Object>(prop: ObjectProp<T>) => T | null;
8
- //# sourceMappingURL=object-prop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object-prop.d.ts","sourceRoot":"","sources":["../../src/utils/object-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9F,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO,CAAC,MAAM,QAAQ,UAAU,CAAC,CAAC,CAAC,KAAG,CAAC,GAAG,IAIrF,CAAC"}
@@ -1,9 +0,0 @@
1
- import * as GObject from "@gtkx/gi/gobject";
2
- export const resolveObjectProp = (prop) => {
3
- if (!prop)
4
- return null;
5
- if (prop instanceof GObject.Object)
6
- return prop;
7
- return prop.current;
8
- };
9
- //# sourceMappingURL=object-prop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object-prop.js","sourceRoot":"","sources":["../../src/utils/object-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAQ5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA2B,IAAmB,EAAY,EAAE;IACzF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,IAAI,YAAY,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO,IAAI,CAAC,OAAO,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport type { RefObject } from \"react\";\n\n/**\n * An object accepted by the GObject-aware hooks: a GObject, a ref to one, or a nullish value.\n */\nexport type ObjectProp<T extends GObject.Object> = T | RefObject<T | null> | null | undefined;\n\nexport const resolveObjectProp = <T extends GObject.Object>(prop: ObjectProp<T>): T | null => {\n if (!prop) return null;\n if (prop instanceof GObject.Object) return prop;\n return prop.current;\n};\n"]}
@@ -1,8 +0,0 @@
1
- import type * as Gio from "@gtkx/gi/gio";
2
- type SettingAccessor = {
3
- read: (settings: Gio.Settings, key: string) => unknown;
4
- write: (settings: Gio.Settings, key: string, value: unknown) => void;
5
- };
6
- export declare const resolveAccessor: (kind: string | undefined, key: string, schemaId: string) => SettingAccessor;
7
- export {};
8
- //# sourceMappingURL=settings-accessor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-accessor.d.ts","sourceRoot":"","sources":["../../src/utils/settings-accessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AAGzC,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACvD,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxE,CAAC;AA6EF,eAAO,MAAM,eAAe,SAAU,MAAM,GAAG,SAAS,OAAO,MAAM,YAAY,MAAM,KAAG,eAKzF,CAAC"}
@@ -1,69 +0,0 @@
1
- import * as GLib from "@gtkx/gi/glib";
2
- const settingTypeError = (expected, value) => new TypeError(`Expected ${expected} for the settings value, got ${typeof value}`);
3
- const expect = (guard, label) => (value) => {
4
- if (!guard(value))
5
- throw settingTypeError(label, value);
6
- return value;
7
- };
8
- const expectBoolean = expect((value) => typeof value === "boolean", "a boolean");
9
- const expectNumber = expect((value) => typeof value === "number", "a number");
10
- const expectString = expect((value) => typeof value === "string", "a string");
11
- const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
12
- const expectStringArray = expect(isStringArray, "an array of strings");
13
- const expectVariant = expect((value) => value instanceof GLib.Variant, "a GLib.Variant");
14
- const expectBigInt = (value) => {
15
- if (typeof value === "bigint")
16
- return value;
17
- if (typeof value === "number")
18
- return BigInt(value);
19
- throw settingTypeError("a bigint", value);
20
- };
21
- const STRING_ACCESSOR = {
22
- read: (settings, key) => settings.getString(key),
23
- write: (settings, key, value) => settings.setString(key, expectString(value)),
24
- };
25
- const STRV_ACCESSOR = {
26
- read: (settings, key) => settings.getStrv(key),
27
- write: (settings, key, value) => settings.setStrv(key, expectStringArray(value)),
28
- };
29
- const ACCESSORS = {
30
- b: {
31
- read: (settings, key) => settings.getBoolean(key),
32
- write: (settings, key, value) => settings.setBoolean(key, expectBoolean(value)),
33
- },
34
- i: {
35
- read: (settings, key) => settings.getInt(key),
36
- write: (settings, key, value) => settings.setInt(key, expectNumber(value)),
37
- },
38
- u: {
39
- read: (settings, key) => settings.getUint(key),
40
- write: (settings, key, value) => settings.setUint(key, expectNumber(value)),
41
- },
42
- x: {
43
- read: (settings, key) => settings.getInt64(key),
44
- write: (settings, key, value) => settings.setInt64(key, expectBigInt(value)),
45
- },
46
- t: {
47
- read: (settings, key) => settings.getUint64(key),
48
- write: (settings, key, value) => settings.setUint64(key, expectBigInt(value)),
49
- },
50
- d: {
51
- read: (settings, key) => settings.getDouble(key),
52
- write: (settings, key, value) => settings.setDouble(key, expectNumber(value)),
53
- },
54
- s: STRING_ACCESSOR,
55
- as: STRV_ACCESSOR,
56
- enum: STRING_ACCESSOR,
57
- flags: STRV_ACCESSOR,
58
- };
59
- const VARIANT_ACCESSOR = {
60
- read: (settings, key) => settings.getValue(key),
61
- write: (settings, key, value) => settings.setValue(key, expectVariant(value)),
62
- };
63
- export const resolveAccessor = (kind, key, schemaId) => {
64
- if (kind === undefined) {
65
- throw new TypeError(`Key "${key}" is not declared by the GSettings schema "${schemaId}"`);
66
- }
67
- return ACCESSORS[kind] ?? VARIANT_ACCESSOR;
68
- };
69
- //# sourceMappingURL=settings-accessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-accessor.js","sourceRoot":"","sources":["../../src/utils/settings-accessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAOtC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAa,EAAE,CACrE,IAAI,SAAS,CAAC,YAAY,QAAQ,gCAAgC,OAAO,KAAK,EAAE,CAAC,CAAC;AAEtF,MAAM,MAAM,GACR,CAAI,KAAqC,EAAE,KAAa,EAAE,EAAE,CAC5D,CAAC,KAAc,EAAK,EAAE;IAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,MAAM,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEN,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,KAAK,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,SAAS,EAAE,WAAW,CAAC,CAAC;AAEnG,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,UAAU,CAAC,CAAC;AAE/F,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,UAAU,CAAC,CAAC;AAE/F,MAAM,aAAa,GAAG,CAAC,KAAc,EAAqB,E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AG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;KAChF;IACD,CAAC,EAAE;QACC,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;QAChD,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;KAChF;IACD,CAAC,EAAE,eAAe;IAClB,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,aAAa;CACvB,CAAC;AAEF,MAAM,gBAAgB,GAAoB;IACtC,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC/C,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAChF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAwB,EAAE,GAAW,EAAE,QAAgB,EAAmB,EAAE;IACxG,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,QAAQ,GAAG,8CAA8C,QAAQ,GAAG,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import type * as Gio from \"@gtkx/gi/gio\";\nimport * as GLib from \"@gtkx/gi/glib\";\n\ntype SettingAccessor = {\n read: (settings: Gio.Settings, key: string) => unknown;\n write: (settings: Gio.Settings, key: string, value: unknown) => void;\n};\n\nconst settingTypeError = (expected: string, value: unknown): TypeError =>\n new TypeError(`Expected ${expected} for the settings value, got ${typeof value}`);\n\nconst expect =\n <T>(guard: (value: unknown) => value is T, label: string) =>\n (value: unknown): T => {\n if (!guard(value)) throw settingTypeError(label, value);\n return value;\n };\n\nconst expectBoolean = expect((value): value is boolean => typeof value === \"boolean\", \"a boolean\");\n\nconst expectNumber = expect((value): value is number => typeof value === \"number\", \"a number\");\n\nconst expectString = expect((value): value is string => typeof value === \"string\", \"a string\");\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst expectStringArray = expect(isStringArray, \"an array of strings\");\n\nconst expectVariant = expect((value): value is GLib.Variant => value instanceof GLib.Variant, \"a GLib.Variant\");\n\nconst expectBigInt = (value: unknown): bigint => {\n if (typeof value === \"bigint\") return value;\n if (typeof value === \"number\") return BigInt(value);\n throw settingTypeError(\"a bigint\", value);\n};\n\nconst STRING_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getString(key),\n write: (settings, key, value) => settings.setString(key, expectString(value)),\n};\n\nconst STRV_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getStrv(key),\n write: (settings, key, value) => settings.setStrv(key, expectStringArray(value)),\n};\n\nconst ACCESSORS: Record<string, SettingAccessor> = {\n b: {\n read: (settings, key) => settings.getBoolean(key),\n write: (settings, key, value) => settings.setBoolean(key, expectBoolean(value)),\n },\n i: {\n read: (settings, key) => settings.getInt(key),\n write: (settings, key, value) => settings.setInt(key, expectNumber(value)),\n },\n u: {\n read: (settings, key) => settings.getUint(key),\n write: (settings, key, value) => settings.setUint(key, expectNumber(value)),\n },\n x: {\n read: (settings, key) => settings.getInt64(key),\n write: (settings, key, value) => settings.setInt64(key, expectBigInt(value)),\n },\n t: {\n read: (settings, key) => settings.getUint64(key),\n write: (settings, key, value) => settings.setUint64(key, expectBigInt(value)),\n },\n d: {\n read: (settings, key) => settings.getDouble(key),\n write: (settings, key, value) => settings.setDouble(key, expectNumber(value)),\n },\n s: STRING_ACCESSOR,\n as: STRV_ACCESSOR,\n enum: STRING_ACCESSOR,\n flags: STRV_ACCESSOR,\n};\n\nconst VARIANT_ACCESSOR: SettingAccessor = {\n read: (settings, key) => settings.getValue(key),\n write: (settings, key, value) => settings.setValue(key, expectVariant(value)),\n};\n\nexport const resolveAccessor = (kind: string | undefined, key: string, schemaId: string): SettingAccessor => {\n if (kind === undefined) {\n throw new TypeError(`Key \"${key}\" is not declared by the GSettings schema \"${schemaId}\"`);\n }\n return ACCESSORS[kind] ?? VARIANT_ACCESSOR;\n};\n"]}
@@ -1,32 +0,0 @@
1
- import type * as Gdk from "@gtkx/gi/gdk";
2
- import type { ReactNode } from "react";
3
- /**
4
- * Props for a text anchor that embeds child widgets at a position within a text view's buffer.
5
- */
6
- export type TextAnchorProps = {
7
- /** The character used to represent the embedded widget in the buffer's text. */
8
- replacementChar?: string;
9
- children?: ReactNode;
10
- };
11
- /**
12
- * Props for a node that embeds a `Gdk.Paintable` within a text view's buffer.
13
- */
14
- export type TextPaintableProps = {
15
- paintable: Gdk.Paintable;
16
- };
17
- type WrapperNodeElementProps = {
18
- kind: string;
19
- children?: ReactNode;
20
- [key: string]: unknown;
21
- };
22
- declare global {
23
- namespace React {
24
- namespace JSX {
25
- interface IntrinsicElements {
26
- __GTKX_WRAPPER_NODE__: WrapperNodeElementProps;
27
- }
28
- }
29
- }
30
- }
31
- export {};
32
- //# sourceMappingURL=wrapper-node-jsx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wrapper-node-jsx.d.ts","sourceRoot":"","sources":["../../src/utils/wrapper-node-jsx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,KAAK,CAAC;QACZ,UAAU,GAAG,CAAC;YACV,UAAU,iBAAiB;gBACvB,qBAAqB,EAAE,uBAAuB,CAAC;aAClD;SACJ;KACJ;CACJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=wrapper-node-jsx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wrapper-node-jsx.js","sourceRoot":"","sources":["../../src/utils/wrapper-node-jsx.ts"],"names":[],"mappings":"","sourcesContent":["import type * as Gdk from \"@gtkx/gi/gdk\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Props for a text anchor that embeds child widgets at a position within a text view's buffer.\n */\nexport type TextAnchorProps = {\n /** The character used to represent the embedded widget in the buffer's text. */\n replacementChar?: string;\n children?: ReactNode;\n};\n\n/**\n * Props for a node that embeds a `Gdk.Paintable` within a text view's buffer.\n */\nexport type TextPaintableProps = {\n paintable: Gdk.Paintable;\n};\n\ntype WrapperNodeElementProps = {\n kind: string;\n children?: ReactNode;\n [key: string]: unknown;\n};\n\ndeclare global {\n namespace React {\n namespace JSX {\n interface IntrinsicElements {\n __GTKX_WRAPPER_NODE__: WrapperNodeElementProps;\n }\n }\n }\n}\n"]}
@@ -1,53 +0,0 @@
1
- import { type Ref, type RefCallback, useCallback, useLayoutEffect, useRef } from "react";
2
-
3
- type MergedRefEntry<T> = {
4
- ref: Ref<T | null> | undefined;
5
- cleanup: (() => void) | undefined;
6
- };
7
-
8
- const attachRef = <T>(ref: Ref<T | null> | undefined, value: T): (() => void) | undefined => {
9
- if (typeof ref === "function") {
10
- const cleanup = ref(value);
11
- return typeof cleanup === "function" ? cleanup : () => ref(null);
12
- }
13
- if (ref) {
14
- ref.current = value;
15
- return () => {
16
- ref.current = null;
17
- };
18
- }
19
- return undefined;
20
- };
21
-
22
- export const useMergeRefs = <T>(...refs: Array<Ref<T | null> | undefined>): RefCallback<T> => {
23
- const latestRefs = useRef(refs);
24
- latestRefs.current = refs;
25
- const attachedRef = useRef<{ value: T; entries: MergedRefEntry<T>[] } | null>(null);
26
-
27
- useLayoutEffect(() => {
28
- const attached = attachedRef.current;
29
- if (attached === null) return;
30
- const next = latestRefs.current;
31
- for (let index = next.length; index < attached.entries.length; index += 1) {
32
- attached.entries[index]?.cleanup?.();
33
- }
34
- attached.entries = next.map((ref, index) => {
35
- const entry = attached.entries[index];
36
- if (entry !== undefined && entry.ref === ref) return entry;
37
- entry?.cleanup?.();
38
- return { ref, cleanup: attachRef(ref, attached.value) };
39
- });
40
- });
41
-
42
- return useCallback((value: T) => {
43
- const entries = latestRefs.current.map((ref) => ({ ref, cleanup: attachRef(ref, value) }));
44
- attachedRef.current = { value, entries };
45
- return () => {
46
- const attached = attachedRef.current;
47
- attachedRef.current = null;
48
- if (attached) {
49
- for (const entry of attached.entries) entry.cleanup?.();
50
- }
51
- };
52
- }, []);
53
- };
@@ -1,35 +0,0 @@
1
- import type * as GObject from "@gtkx/gi/gobject";
2
- import { useLayoutEffect, useRef } from "react";
3
- import { type ObjectProp, resolveObjectProp } from "../utils/object-prop.js";
4
-
5
- type ObjectAttachmentOps<T extends GObject.Object, A> = {
6
- attach(object: T): A;
7
- detach(attachment: A): void;
8
- isSame(attachment: A, object: T): boolean;
9
- };
10
-
11
- export const useObjectAttachment = <T extends GObject.Object, A>(
12
- object: ObjectProp<T>,
13
- ops: ObjectAttachmentOps<T, A>,
14
- ): void => {
15
- const attachmentRef = useRef<A | null>(null);
16
-
17
- const drop = (): void => {
18
- const attachment = attachmentRef.current;
19
- if (attachment !== null) {
20
- ops.detach(attachment);
21
- attachmentRef.current = null;
22
- }
23
- };
24
-
25
- useLayoutEffect(() => {
26
- const resolved = resolveObjectProp(object);
27
- const attachment = attachmentRef.current;
28
- if (attachment !== null && resolved !== null && ops.isSame(attachment, resolved)) return;
29
- drop();
30
- if (resolved === null) return;
31
- attachmentRef.current = ops.attach(resolved);
32
- });
33
-
34
- useLayoutEffect(() => () => drop(), []);
35
- };
@@ -1,34 +0,0 @@
1
- import type * as Adw from "@gtkx/gi/adw";
2
- import { type ElementType, type ReactNode, type Ref, useCallback, useLayoutEffect, useState } from "react";
3
- import { useMergeRefs } from "../../hooks/use-merge-refs.js";
4
- import { useParentWindow } from "../../hooks/use-parent-window.js";
5
- import { createPortal } from "../../reconciler/portal.js";
6
- import { rootElement } from "../../reconciler/root-element.js";
7
-
8
- type DialogComponentProps = {
9
- ref?: Ref<Adw.Dialog | null> | undefined;
10
- };
11
-
12
- export const createDialogComponent = (Component: ElementType): ((props: DialogComponentProps) => ReactNode) => {
13
- return ({ ref, ...rest }: DialogComponentProps): ReactNode => {
14
- const parent = useParentWindow();
15
- const [dialog, setDialog] = useState<Adw.Dialog | null>(null);
16
-
17
- const handleMount = useCallback((instance: Adw.Dialog) => {
18
- setDialog(instance);
19
-
20
- return () => {
21
- instance.forceClose();
22
- setDialog(null);
23
- };
24
- }, []);
25
-
26
- useLayoutEffect(() => {
27
- dialog?.present(parent);
28
- }, [dialog, parent]);
29
-
30
- const mergedRef = useMergeRefs<Adw.Dialog>(ref, handleMount);
31
-
32
- return createPortal(<Component ref={mergedRef} {...rest} />, rootElement);
33
- };
34
- };
@@ -1 +0,0 @@
1
- export { createDialogComponent } from "./dialog.js";