react-native-gtkx 0.2.0-alpha.1 → 0.3.0-alpha.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 (400) hide show
  1. package/README.md +14 -2
  2. package/dist/adw/widgets.generated.d.ts +4 -4
  3. package/dist/adw/widgets.generated.js +51 -51
  4. package/dist/adw/widgets.generated.js.map +1 -1
  5. package/dist/aliases/index.d.ts +84 -0
  6. package/dist/aliases/index.js +208 -0
  7. package/dist/aliases/index.js.map +1 -0
  8. package/dist/animated/create-animated.d.ts +2 -0
  9. package/dist/animated/create-animated.js +2 -0
  10. package/dist/animated/create-animated.js.map +1 -1
  11. package/dist/animated/index.d.ts +4 -0
  12. package/dist/animated/index.js +6 -0
  13. package/dist/animated/index.js.map +1 -1
  14. package/dist/animated/types.d.ts +1 -0
  15. package/dist/animated/types.js.map +1 -1
  16. package/dist/animated/value-animation.js +17 -4
  17. package/dist/animated/value-animation.js.map +1 -1
  18. package/dist/animated/value-xy.d.ts +41 -0
  19. package/dist/animated/value-xy.js +90 -0
  20. package/dist/animated/value-xy.js.map +1 -0
  21. package/dist/animated/value.d.ts +9 -0
  22. package/dist/animated/value.js +30 -2
  23. package/dist/animated/value.js.map +1 -1
  24. package/dist/apis/host.gtkx.js +9 -12
  25. package/dist/apis/host.gtkx.js.map +1 -1
  26. package/dist/apis/index.d.ts +4 -2
  27. package/dist/apis/index.js +2 -0
  28. package/dist/apis/index.js.map +1 -1
  29. package/dist/apis/keyboard.d.ts +60 -0
  30. package/dist/apis/keyboard.js +63 -0
  31. package/dist/apis/keyboard.js.map +1 -0
  32. package/dist/apis/log-box.d.ts +15 -0
  33. package/dist/apis/log-box.js +46 -0
  34. package/dist/apis/log-box.js.map +1 -0
  35. package/dist/apis/platform.d.ts +18 -1
  36. package/dist/apis/platform.js.map +1 -1
  37. package/dist/common/icon.d.ts +23 -0
  38. package/dist/common/icon.js +14 -0
  39. package/dist/common/icon.js.map +1 -0
  40. package/dist/common/index.d.ts +1 -0
  41. package/dist/common/index.js +25 -0
  42. package/dist/common/index.js.map +1 -1
  43. package/dist/common/widget.d.ts +1 -22
  44. package/dist/common/widget.js +75 -8
  45. package/dist/common/widget.js.map +1 -1
  46. package/dist/components/animated.d.ts +73 -7
  47. package/dist/components/animated.js +560 -45
  48. package/dist/components/animated.js.map +1 -1
  49. package/dist/components/app-registry.d.ts +26 -0
  50. package/dist/components/app-registry.js.map +1 -1
  51. package/dist/components/driven-size.d.ts +27 -0
  52. package/dist/components/driven-size.js +85 -0
  53. package/dist/components/driven-size.js.map +1 -0
  54. package/dist/components/find-node-handle.d.ts +11 -0
  55. package/dist/components/find-node-handle.js +53 -0
  56. package/dist/components/find-node-handle.js.map +1 -0
  57. package/dist/components/flat-list.d.ts +3 -2
  58. package/dist/components/flat-list.js.map +1 -1
  59. package/dist/components/frame-scheduler.d.ts +16 -0
  60. package/dist/components/frame-scheduler.js +37 -0
  61. package/dist/components/frame-scheduler.js.map +1 -0
  62. package/dist/components/host-node.d.ts +7 -0
  63. package/dist/components/host-node.js +26 -1
  64. package/dist/components/host-node.js.map +1 -1
  65. package/dist/components/image.d.ts +6 -1
  66. package/dist/components/image.js +15 -4
  67. package/dist/components/image.js.map +1 -1
  68. package/dist/components/index.d.ts +11 -5
  69. package/dist/components/index.js +7 -4
  70. package/dist/components/index.js.map +1 -1
  71. package/dist/components/measure.d.ts +63 -0
  72. package/dist/components/measure.js +150 -0
  73. package/dist/components/measure.js.map +1 -0
  74. package/dist/components/modal.d.ts +1 -1
  75. package/dist/components/press-event.d.ts +28 -0
  76. package/dist/components/press-event.js +46 -0
  77. package/dist/components/press-event.js.map +1 -0
  78. package/dist/components/pressable.d.ts +63 -7
  79. package/dist/components/pressable.js +165 -12
  80. package/dist/components/pressable.js.map +1 -1
  81. package/dist/components/rect-store.d.ts +58 -0
  82. package/dist/components/rect-store.js +124 -3
  83. package/dist/components/rect-store.js.map +1 -1
  84. package/dist/components/root.js +6 -1
  85. package/dist/components/root.js.map +1 -1
  86. package/dist/components/scroll-phase.d.ts +35 -0
  87. package/dist/components/scroll-phase.js +26 -0
  88. package/dist/components/scroll-phase.js.map +1 -0
  89. package/dist/components/scroll-view.d.ts +43 -3
  90. package/dist/components/scroll-view.js +386 -45
  91. package/dist/components/scroll-view.js.map +1 -1
  92. package/dist/components/text-input.js +9 -25
  93. package/dist/components/text-input.js.map +1 -1
  94. package/dist/components/text.d.ts +6 -2
  95. package/dist/components/text.js +68 -9
  96. package/dist/components/text.js.map +1 -1
  97. package/dist/components/use-focus.d.ts +27 -0
  98. package/dist/components/use-focus.js +116 -0
  99. package/dist/components/use-focus.js.map +1 -0
  100. package/dist/components/use-layout-child.d.ts +13 -1
  101. package/dist/components/use-layout-child.js +205 -19
  102. package/dist/components/use-layout-child.js.map +1 -1
  103. package/dist/components/view.d.ts +12 -4
  104. package/dist/components/view.js +25 -14
  105. package/dist/components/view.js.map +1 -1
  106. package/dist/components/virtualized-list.d.ts +45 -5
  107. package/dist/components/virtualized-list.js +90 -24
  108. package/dist/components/virtualized-list.js.map +1 -1
  109. package/dist/components/wheel-scroll-session.d.ts +7 -0
  110. package/dist/components/wheel-scroll-session.js +53 -0
  111. package/dist/components/wheel-scroll-session.js.map +1 -0
  112. package/dist/components/widget-retention.d.ts +35 -0
  113. package/dist/components/widget-retention.js +169 -0
  114. package/dist/components/widget-retention.js.map +1 -0
  115. package/dist/contracts.d.ts +23 -3
  116. package/dist/contracts.js.map +1 -1
  117. package/dist/dnd/context.d.ts +69 -0
  118. package/dist/dnd/context.js +149 -0
  119. package/dist/dnd/context.js.map +1 -0
  120. package/dist/dnd/draggable.d.ts +59 -0
  121. package/dist/dnd/draggable.js +149 -0
  122. package/dist/dnd/draggable.js.map +1 -0
  123. package/dist/dnd/droppable.d.ts +24 -0
  124. package/dist/dnd/droppable.js +74 -0
  125. package/dist/dnd/droppable.js.map +1 -0
  126. package/dist/dnd/gtk-controllers.d.ts +39 -0
  127. package/dist/dnd/gtk-controllers.js +110 -0
  128. package/dist/dnd/gtk-controllers.js.map +1 -0
  129. package/dist/dnd/index.d.ts +6 -0
  130. package/dist/dnd/index.js +31 -0
  131. package/dist/dnd/index.js.map +1 -0
  132. package/dist/dnd/order.d.ts +7 -0
  133. package/dist/dnd/order.js +20 -0
  134. package/dist/dnd/order.js.map +1 -0
  135. package/dist/dnd/payload.d.ts +14 -0
  136. package/dist/dnd/payload.js +41 -0
  137. package/dist/dnd/payload.js.map +1 -0
  138. package/dist/dnd/sortable.d.ts +49 -0
  139. package/dist/dnd/sortable.js +307 -0
  140. package/dist/dnd/sortable.js.map +1 -0
  141. package/dist/dnd/types.d.ts +290 -0
  142. package/dist/dnd/types.js +25 -0
  143. package/dist/dnd/types.js.map +1 -0
  144. package/dist/gesture-handler-compat/builder.d.ts +251 -0
  145. package/dist/gesture-handler-compat/builder.js +513 -0
  146. package/dist/gesture-handler-compat/builder.js.map +1 -0
  147. package/dist/gesture-handler-compat/composition.d.ts +23 -0
  148. package/dist/gesture-handler-compat/composition.js +111 -0
  149. package/dist/gesture-handler-compat/composition.js.map +1 -0
  150. package/dist/gesture-handler-compat/deciders.d.ts +3 -0
  151. package/dist/gesture-handler-compat/deciders.js +47 -0
  152. package/dist/gesture-handler-compat/deciders.js.map +1 -0
  153. package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
  154. package/dist/gesture-handler-compat/detector-runtime.js +374 -0
  155. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
  156. package/dist/gesture-handler-compat/detector.d.ts +22 -0
  157. package/dist/gesture-handler-compat/detector.js +104 -0
  158. package/dist/gesture-handler-compat/detector.js.map +1 -0
  159. package/dist/gesture-handler-compat/fling.d.ts +24 -0
  160. package/dist/gesture-handler-compat/fling.js +123 -0
  161. package/dist/gesture-handler-compat/fling.js.map +1 -0
  162. package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
  163. package/dist/gesture-handler-compat/force-touch.js +40 -0
  164. package/dist/gesture-handler-compat/force-touch.js.map +1 -0
  165. package/dist/gesture-handler-compat/hooks.d.ts +157 -0
  166. package/dist/gesture-handler-compat/hooks.js +268 -0
  167. package/dist/gesture-handler-compat/hooks.js.map +1 -0
  168. package/dist/gesture-handler-compat/hover.d.ts +2 -0
  169. package/dist/gesture-handler-compat/hover.js +22 -0
  170. package/dist/gesture-handler-compat/hover.js.map +1 -0
  171. package/dist/gesture-handler-compat/index.d.ts +98 -0
  172. package/dist/gesture-handler-compat/index.js +255 -0
  173. package/dist/gesture-handler-compat/index.js.map +1 -0
  174. package/dist/gesture-handler-compat/long-press.d.ts +6 -0
  175. package/dist/gesture-handler-compat/long-press.js +21 -0
  176. package/dist/gesture-handler-compat/long-press.js.map +1 -0
  177. package/dist/gesture-handler-compat/manual.d.ts +2 -0
  178. package/dist/gesture-handler-compat/manual.js +18 -0
  179. package/dist/gesture-handler-compat/manual.js.map +1 -0
  180. package/dist/gesture-handler-compat/native.d.ts +7 -0
  181. package/dist/gesture-handler-compat/native.js +34 -0
  182. package/dist/gesture-handler-compat/native.js.map +1 -0
  183. package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
  184. package/dist/gesture-handler-compat/orchestrator.js +284 -0
  185. package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
  186. package/dist/gesture-handler-compat/pan.d.ts +23 -0
  187. package/dist/gesture-handler-compat/pan.js +116 -0
  188. package/dist/gesture-handler-compat/pan.js.map +1 -0
  189. package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
  190. package/dist/gesture-handler-compat/recognizer.js +1056 -0
  191. package/dist/gesture-handler-compat/recognizer.js.map +1 -0
  192. package/dist/gesture-handler-compat/relations.d.ts +43 -0
  193. package/dist/gesture-handler-compat/relations.js +128 -0
  194. package/dist/gesture-handler-compat/relations.js.map +1 -0
  195. package/dist/gesture-handler-compat/tap.d.ts +6 -0
  196. package/dist/gesture-handler-compat/tap.js +29 -0
  197. package/dist/gesture-handler-compat/tap.js.map +1 -0
  198. package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
  199. package/dist/gesture-handler-compat/touchpad.js +64 -0
  200. package/dist/gesture-handler-compat/touchpad.js.map +1 -0
  201. package/dist/gesture-handler-compat/types.d.ts +441 -0
  202. package/dist/gesture-handler-compat/types.js +167 -0
  203. package/dist/gesture-handler-compat/types.js.map +1 -0
  204. package/dist/gtk/controllers.d.ts +39 -0
  205. package/dist/gtk/controllers.js +92 -0
  206. package/dist/gtk/controllers.js.map +1 -0
  207. package/dist/gtk/index.d.ts +3 -1
  208. package/dist/gtk/index.js +14 -1
  209. package/dist/gtk/index.js.map +1 -1
  210. package/dist/gtk/widgets.generated.d.ts +14 -14
  211. package/dist/gtk/widgets.generated.js +101 -102
  212. package/dist/gtk/widgets.generated.js.map +1 -1
  213. package/dist/gtk/window-actions.d.ts +77 -0
  214. package/dist/gtk/window-actions.js +193 -0
  215. package/dist/gtk/window-actions.js.map +1 -0
  216. package/dist/gtkx/bridge/geometry.d.ts +15 -0
  217. package/dist/gtkx/bridge/geometry.js +40 -0
  218. package/dist/gtkx/bridge/geometry.js.map +1 -0
  219. package/dist/gtkx/bridge/index.d.ts +7 -3
  220. package/dist/gtkx/bridge/index.js +12 -4
  221. package/dist/gtkx/bridge/index.js.map +1 -1
  222. package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
  223. package/dist/gtkx/bridge/slot-portal.js +17 -0
  224. package/dist/gtkx/bridge/slot-portal.js.map +1 -0
  225. package/dist/gtkx/bridge/svg-node.js +10 -54
  226. package/dist/gtkx/bridge/svg-node.js.map +1 -1
  227. package/dist/gtkx/bridge/use-signal.js +2 -2
  228. package/dist/gtkx/bridge/use-signal.js.map +1 -1
  229. package/dist/gtkx/bridge/view-box.d.ts +56 -0
  230. package/dist/gtkx/bridge/view-box.js +394 -9
  231. package/dist/gtkx/bridge/view-box.js.map +1 -1
  232. package/dist/gtkx/bridge/widget-css.d.ts +17 -0
  233. package/dist/gtkx/bridge/widget-css.js +72 -0
  234. package/dist/gtkx/bridge/widget-css.js.map +1 -0
  235. package/dist/index.d.ts +3 -3
  236. package/dist/index.js +2 -2
  237. package/dist/index.js.map +1 -1
  238. package/dist/layout/driven-size.d.ts +12 -0
  239. package/dist/layout/driven-size.js +70 -0
  240. package/dist/layout/driven-size.js.map +1 -0
  241. package/dist/layout/engine.d.ts +17 -1
  242. package/dist/layout/engine.js +3 -20
  243. package/dist/layout/engine.js.map +1 -1
  244. package/dist/layout/node.d.ts +13 -0
  245. package/dist/layout/node.js +14 -0
  246. package/dist/layout/node.js.map +1 -1
  247. package/dist/layout/yoga.d.ts +3 -2
  248. package/dist/layout/yoga.js +5 -2
  249. package/dist/layout/yoga.js.map +1 -1
  250. package/dist/mcp/data/generated.d.ts +310 -91
  251. package/dist/mcp/data/generated.js +365 -90
  252. package/dist/mcp/data/generated.js.map +1 -1
  253. package/dist/mcp/server.js +1 -1
  254. package/dist/mcp/server.js.map +1 -1
  255. package/dist/metro/index.d.ts +10 -0
  256. package/dist/metro/index.js +21 -12
  257. package/dist/metro/index.js.map +1 -1
  258. package/dist/navigation/sidebar.d.ts +47 -1
  259. package/dist/navigation/sidebar.js +77 -3
  260. package/dist/navigation/sidebar.js.map +1 -1
  261. package/dist/reanimated-compat/animated-ref.d.ts +32 -0
  262. package/dist/reanimated-compat/animated-ref.js +57 -0
  263. package/dist/reanimated-compat/animated-ref.js.map +1 -0
  264. package/dist/reanimated-compat/animation.d.ts +177 -0
  265. package/dist/reanimated-compat/animation.js +540 -0
  266. package/dist/reanimated-compat/animation.js.map +1 -0
  267. package/dist/reanimated-compat/color.d.ts +28 -0
  268. package/dist/reanimated-compat/color.js +249 -0
  269. package/dist/reanimated-compat/color.js.map +1 -0
  270. package/dist/reanimated-compat/decay.d.ts +39 -0
  271. package/dist/reanimated-compat/decay.js +96 -0
  272. package/dist/reanimated-compat/decay.js.map +1 -0
  273. package/dist/reanimated-compat/easing.d.ts +30 -0
  274. package/dist/reanimated-compat/easing.js +76 -0
  275. package/dist/reanimated-compat/easing.js.map +1 -0
  276. package/dist/reanimated-compat/hooks.d.ts +14 -0
  277. package/dist/reanimated-compat/hooks.js +217 -0
  278. package/dist/reanimated-compat/hooks.js.map +1 -0
  279. package/dist/reanimated-compat/index.d.ts +258 -0
  280. package/dist/reanimated-compat/index.js +464 -0
  281. package/dist/reanimated-compat/index.js.map +1 -0
  282. package/dist/reanimated-compat/interpolation.d.ts +18 -0
  283. package/dist/reanimated-compat/interpolation.js +122 -0
  284. package/dist/reanimated-compat/interpolation.js.map +1 -0
  285. package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
  286. package/dist/reanimated-compat/layout-animation-config.js +78 -0
  287. package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
  288. package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
  289. package/dist/reanimated-compat/layout-animation-presets.js +498 -0
  290. package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
  291. package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
  292. package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
  293. package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
  294. package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
  295. package/dist/reanimated-compat/layout-animation-view.js +266 -0
  296. package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
  297. package/dist/reanimated-compat/layout-animation.d.ts +171 -0
  298. package/dist/reanimated-compat/layout-animation.js +469 -0
  299. package/dist/reanimated-compat/layout-animation.js.map +1 -0
  300. package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
  301. package/dist/reanimated-compat/layout-transitions.js +350 -0
  302. package/dist/reanimated-compat/layout-transitions.js.map +1 -0
  303. package/dist/reanimated-compat/mutable.d.ts +29 -0
  304. package/dist/reanimated-compat/mutable.js +139 -0
  305. package/dist/reanimated-compat/mutable.js.map +1 -0
  306. package/dist/reanimated-compat/props.d.ts +18 -0
  307. package/dist/reanimated-compat/props.js +111 -0
  308. package/dist/reanimated-compat/props.js.map +1 -0
  309. package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
  310. package/dist/reanimated-compat/scroll-handler.js +274 -0
  311. package/dist/reanimated-compat/scroll-handler.js.map +1 -0
  312. package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
  313. package/dist/reanimated-compat/scroll-offset.js +104 -0
  314. package/dist/reanimated-compat/scroll-offset.js.map +1 -0
  315. package/dist/reanimated-compat/style.d.ts +90 -0
  316. package/dist/reanimated-compat/style.js +452 -0
  317. package/dist/reanimated-compat/style.js.map +1 -0
  318. package/dist/reanimated-compat/test-timers.d.ts +28 -0
  319. package/dist/reanimated-compat/test-timers.js +136 -0
  320. package/dist/reanimated-compat/test-timers.js.map +1 -0
  321. package/dist/reanimated-compat/threads.d.ts +13 -0
  322. package/dist/reanimated-compat/threads.js +41 -0
  323. package/dist/reanimated-compat/threads.js.map +1 -0
  324. package/dist/reanimated-compat/tracking.d.ts +41 -0
  325. package/dist/reanimated-compat/tracking.js +106 -0
  326. package/dist/reanimated-compat/tracking.js.map +1 -0
  327. package/dist/reanimated-compat/updater-animations.d.ts +36 -0
  328. package/dist/reanimated-compat/updater-animations.js +273 -0
  329. package/dist/reanimated-compat/updater-animations.js.map +1 -0
  330. package/dist/responder/system.d.ts +100 -0
  331. package/dist/responder/system.js +304 -0
  332. package/dist/responder/system.js.map +1 -0
  333. package/dist/responder/touch-history.d.ts +10 -0
  334. package/dist/responder/touch-history.js +78 -0
  335. package/dist/responder/touch-history.js.map +1 -0
  336. package/dist/responder/types.d.ts +63 -0
  337. package/dist/responder/types.js +29 -0
  338. package/dist/responder/types.js.map +1 -0
  339. package/dist/responder/use-responder.d.ts +23 -0
  340. package/dist/responder/use-responder.js +317 -0
  341. package/dist/responder/use-responder.js.map +1 -0
  342. package/dist/runner/host-dev.js +4 -2
  343. package/dist/runner/host-dev.js.map +1 -1
  344. package/dist/runner/host.js +6 -2
  345. package/dist/runner/host.js.map +1 -1
  346. package/dist/runner/index.js +3 -3
  347. package/dist/runner/index.js.map +1 -1
  348. package/dist/sea/gtkx-config-module.js +2 -2
  349. package/dist/sea/gtkx-config-module.js.map +1 -1
  350. package/dist/style/absolute-insets.d.ts +26 -0
  351. package/dist/style/absolute-insets.js +113 -0
  352. package/dist/style/absolute-insets.js.map +1 -0
  353. package/dist/style/animated-size.d.ts +25 -0
  354. package/dist/style/animated-size.js +225 -0
  355. package/dist/style/animated-size.js.map +1 -0
  356. package/dist/style/box-shadow.d.ts +7 -0
  357. package/dist/style/box-shadow.js +197 -0
  358. package/dist/style/box-shadow.js.map +1 -0
  359. package/dist/style/colors.d.ts +17 -0
  360. package/dist/style/colors.js +25 -6
  361. package/dist/style/colors.js.map +1 -1
  362. package/dist/style/imperative-css.d.ts +21 -0
  363. package/dist/style/imperative-css.js +63 -0
  364. package/dist/style/imperative-css.js.map +1 -0
  365. package/dist/style/index.d.ts +4 -1
  366. package/dist/style/index.js +4 -1
  367. package/dist/style/index.js.map +1 -1
  368. package/dist/style/split-style.d.ts +5 -2
  369. package/dist/style/split-style.js +36 -3
  370. package/dist/style/split-style.js.map +1 -1
  371. package/dist/style/text-decoration.d.ts +15 -0
  372. package/dist/style/text-decoration.js +26 -0
  373. package/dist/style/text-decoration.js.map +1 -0
  374. package/dist/style/visual-css.js +37 -1
  375. package/dist/style/visual-css.js.map +1 -1
  376. package/dist/svg/gradient-geometry.js +2 -5
  377. package/dist/svg/gradient-geometry.js.map +1 -1
  378. package/dist/testing/index.js.map +1 -1
  379. package/dist/unsupported-export.d.ts +8 -0
  380. package/dist/unsupported-export.js +66 -0
  381. package/dist/unsupported-export.js.map +1 -0
  382. package/dist/vendor/react-native/pan-responder.d.ts +102 -0
  383. package/dist/vendor/react-native/pan-responder.js +196 -0
  384. package/dist/vendor/react-native/pan-responder.js.map +1 -0
  385. package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
  386. package/dist/vendor/react-native/touch-history-math.js +102 -0
  387. package/dist/vendor/react-native/touch-history-math.js.map +1 -0
  388. package/dist/vite/index.d.ts +21 -8
  389. package/dist/vite/index.js +127 -82
  390. package/dist/vite/index.js.map +1 -1
  391. package/dist/vitest/index.d.ts +2 -2
  392. package/dist/vitest/index.js.map +1 -1
  393. package/dist/worklets-compat/index.d.ts +4 -0
  394. package/dist/worklets-compat/index.js +28 -0
  395. package/dist/worklets-compat/index.js.map +1 -0
  396. package/dist/worklets-compat/surface.d.ts +110 -0
  397. package/dist/worklets-compat/surface.js +153 -0
  398. package/dist/worklets-compat/surface.js.map +1 -0
  399. package/package.json +25 -9
  400. package/types.d.ts +9 -0
@@ -0,0 +1,17 @@
1
+ import { createPortal } from "@gtkx/react";
2
+ import { createElement } from "react";
3
+ // Typed as a component rather than an intrinsic tag: "gtkx:prop" is not in
4
+ // the generated JSX.IntrinsicElements map (it is not a GObject type), so
5
+ // createElement would reject the bare string.
6
+ const PROP_ELEMENT = "gtkx:prop";
7
+ /**
8
+ * A React portal that renders `children` into `target`'s named `slot`
9
+ * instead of into the tree position where it is written — the declarative
10
+ * equivalent of passing `<Target slot={children} />`, for a target the
11
+ * declaring component does not render.
12
+ *
13
+ * The children stay part of the React tree where the portal element sits,
14
+ * so context, state and effects behave exactly as they would in place.
15
+ */
16
+ export const createSlotPortal = (children, target, slot, key) => createPortal(createElement(PROP_ELEMENT, { propName: slot }, children), target, key);
17
+ //# sourceMappingURL=slot-portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-portal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/slot-portal.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,aAAa,EAA0C,MAAM,OAAO,CAAA;AAE7E,2EAA2E;AAC3E,yEAAyE;AACzE,8CAA8C;AAC9C,MAAM,YAAY,GAAG,WAGnB,CAAA;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAmB,EACnB,MAAsB,EACtB,IAAY,EACZ,GAAY,EACD,EAAE,CACb,YAAY,CACV,aAAa,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,EACzD,MAAM,EACN,GAAG,CACJ,CAAA","sourcesContent":["// Rendering children into a NAMED SLOT of an object that is not their parent.\n//\n// gtkx's own `createPortal(children, container)` targets the container's\n// DEFAULT slot — \"children\", the one a widget takes another widget through.\n// Everything else an object can be given declaratively is a named slot\n// reached in JSX by an element-valued PROP: a window's `Gio.ActionMap`\n// (`actions`), the event controllers on a widget (`controllers`), an\n// `AdwApplicationWindow`'s `breakpoints`. Those slots are what the\n// reconciler routes an element-valued prop into — it wraps the prop's value\n// in an internal element that carries the slot name, and that element is\n// what actually places children into the named slot.\n//\n// So a portal whose single child is that internal element lands its children\n// in a named slot of a remote object, which is what `WindowActions` and\n// `WindowControllers` need: declare in the app tree, attach to the window.\n//\n// RC4-WORKAROUND(prop-portal): the internal element's name is spelled out\n// here because @gtkx/react exports it from neither its public entry point\n// nor its `/internal` subpath — only from a deep module path, which this\n// package does not reach into. The bridge is the one module allowed to know\n// a gtkx internal, so the knowledge is confined to this file: if the name\n// ever changes, exactly one line moves. See docs/gtkx-rc4-notes.md.\nimport type * as GObject from \"@gtkx/gi/gobject\"\nimport { createPortal } from \"@gtkx/react\"\nimport { createElement, type FunctionComponent, type ReactNode } from \"react\"\n\n// Typed as a component rather than an intrinsic tag: \"gtkx:prop\" is not in\n// the generated JSX.IntrinsicElements map (it is not a GObject type), so\n// createElement would reject the bare string.\nconst PROP_ELEMENT = \"gtkx:prop\" as unknown as FunctionComponent<{\n propName: string\n children?: ReactNode\n}>\n\n/**\n * A React portal that renders `children` into `target`'s named `slot`\n * instead of into the tree position where it is written — the declarative\n * equivalent of passing `<Target slot={children} />`, for a target the\n * declaring component does not render.\n *\n * The children stay part of the React tree where the portal element sits,\n * so context, state and effects behave exactly as they would in place.\n */\nexport const createSlotPortal = (\n children: ReactNode,\n target: GObject.Object,\n slot: string,\n key?: string,\n): ReactNode =>\n createPortal(\n createElement(PROP_ELEMENT, { propName: slot }, children),\n target,\n key,\n )\n"]}
@@ -70,48 +70,14 @@ const scaledAlpha = (rgba, factor) => factor >= 1
70
70
  alpha: rgba.alpha * factor,
71
71
  });
72
72
  const clamp01 = (value) => Math.max(0, Math.min(1, value));
73
- // RC2-WORKAROUND(gsk-colorstop-boxed-write) — row in docs/gtkx-rc2-notes.md.
74
- // Writing a Gdk.RGBA into a Gsk.ColorStop's `color` field crashes in the
75
- // native addon (@gtkx/native)
76
- // with "Expected an Object for Boxed field write type, got Object" —
77
- // verified through THREE independent paths, all hitting the same native
78
- // code: the generated constructor (uses the wrong of two RGBA descriptors,
79
- // _desc1 instead of the inline _desc2 — a real codegen bug), the property
80
- // setter (uses the documented-correct _desc2 descriptor and STILL fails,
81
- // which rules out a simple descriptor mix-up as the whole story), and a
82
- // bypass that skips ColorStop construction and hands appendLinearGradient a
83
- // plain {offset, color} object array instead (fails differently, with "No
84
- // native handle associated with Object" — the array marshaling genuinely
85
- // requires a native-backed instance per element, so there is no JS-level
86
- // escape hatch). This is a native-addon bug, not something fixable from
87
- // application code.
88
- //
89
- // Rather than crash every app that uses a gradient, or drop the gradient
90
- // components from the API while their descriptor-building is fully correct
91
- // and tested, a stop that fails to construct is treated exactly like a
92
- // missing gradient reference (see the url(#missing) test): the shape using
93
- // it simply paints no fill/stroke for that paint, instead of throwing.
94
- const makeColorStop = (offset, color) => {
95
- try {
96
- const stop = new Gsk.ColorStop();
97
- stop.offset = offset;
98
- stop.color = color;
99
- return stop;
100
- }
101
- catch {
102
- return null;
103
- }
104
- };
73
+ const makeColorStop = (offset, color) => new Gsk.ColorStop({ offset, color });
105
74
  const collectStops = (gradientWidget) => {
106
75
  const stops = [];
107
76
  let child = gradientWidget.getFirstChild();
108
77
  while (child) {
109
78
  const descriptor = nodeDescriptors.get(child);
110
79
  if (descriptor?.kind === "stop") {
111
- const stop = makeColorStop(descriptor.offset, descriptor.color);
112
- if (stop) {
113
- stops.push(stop);
114
- }
80
+ stops.push(makeColorStop(descriptor.offset, descriptor.color));
115
81
  }
116
82
  child = child.getNextSibling();
117
83
  }
@@ -150,16 +116,11 @@ const appendGradient = (snapshot, path, entry, opacity) => {
150
116
  if (entry.stops.length === 0) {
151
117
  return;
152
118
  }
153
- const rescaled = opacity >= 1
154
- ? entry.stops
155
- : entry.stops
156
- .map((stop) => makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)))
157
- .filter((stop) => stop !== null);
158
119
  // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a
159
- // scaled alpha (see makeColorStop's WORKAROUND note); if that rebuild
160
- // itself fails, fall back to the already-working full-opacity stops
161
- // rather than losing the gradient entirely over an opacity nuance.
162
- const stops = rescaled.length > 0 ? rescaled : entry.stops;
120
+ // scaled alpha.
121
+ const stops = opacity >= 1
122
+ ? entry.stops
123
+ : entry.stops.map((stop) => makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)));
163
124
  const [hasBounds, tightBounds] = path.getBounds();
164
125
  const bounds = hasBounds ? tightBounds : Graphene.Rect.zero();
165
126
  const box = asBoundingBox(bounds);
@@ -321,17 +282,12 @@ const ensureRegistered = () => {
321
282
  }
322
283
  const transform = resolveViewBoxTransform(descriptor.viewBox, width, height, descriptor.preserveAspectRatio);
323
284
  const gradients = collectGradients(this);
324
- // RC2-WORKAROUND(graphene-rect-nested-boxed-props) — row in
325
- // docs/gtkx-rc2-notes.md. `new Graphene.Rect({ origin: new
326
- // Graphene.Point(...), size: new Graphene.Size(...) })` hits the same
327
- // native "Expected an Object for Boxed field write type, got Object"
328
- // as Gsk.ColorStop's `color` field (see makeColorStop below) — Rect
329
- // has a working escape hatch, `.alloc().init(x, y, w, h)`, that
330
- // ColorStop does not.
331
- //
332
285
  // SVG clips to the viewport by default (no overflow:visible opt-out
333
286
  // in this API — deliberate cut, see epic.md).
334
- snapshot.pushClip(Graphene.Rect.alloc().init(0, 0, width, height));
287
+ snapshot.pushClip(new Graphene.Rect({
288
+ origin: new Graphene.Point({ x: 0, y: 0 }),
289
+ size: new Graphene.Size({ width, height }),
290
+ }));
335
291
  snapshot.save();
336
292
  snapshot.translate(new Graphene.Point({
337
293
  x: transform.translateX,
@@ -1 +1 @@
1
- {"version":3,"file":"svg-node.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/svg-node.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,gEAAgE;AAChE,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,sBAAsB;AACtB,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,4BAA4B;AAC5B,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAA;AA4E3B,MAAM,eAAe,GAAG,IAAI,OAAO,EAAiC,CAAA;AAEpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAkB,EAClB,UAA6B,EACvB,EAAE;IACR,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAkB,EACa,EAAE,CAAC,eAAe,CAAC,GAAG,CAA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AC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;YAClD,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;YACvC,QAAQ,CAAC,OAAO,EAAE,CAAA;YAClB,QAAQ,CAAC,GAAG,EAAE,CAAA;QAChB,CAAC;KACF;IACD,oEAAoE;IACpE,+BAA+B;IAC/B,aAAa,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAA;IAC3D,kBAAkB,GAAG,aAAa,CAAA;IAClC,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAID,IAAI,SAAS,GAA4B,IAAI,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,gBAAgB,EAAE,CAAA;IAClB,SAAS,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAA;IACnD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;;qCAEqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAsB,EAAQ,EAAE;IAC7D,UAAU,CAAC,SAAS,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["// RnGtkxSvgNode — one GObject class (registerClass, same mechanism as\n// RnGtkxLayout/RnGtkxViewBox) reused for the <Svg> root AND every descendant\n// (<G>, <Path>, <Rect>, ..., <Defs>, <LinearGradient>, <Stop>). Descendants\n// are ordinary GTK children (the reconciler's generic set_parent/insert_after\n// attachment — the same one View relies on) that GTK never snapshots on its\n// own, because nothing ever calls snapshotChild() on them: only the mounted\n// <Svg> instance's snapshot() vfunc actually runs, and it walks\n// getFirstChild()/getNextSibling() itself, reading each node's role from a\n// WeakMap (native wrappers get re-created by the runtime, so per-instance\n// state cannot live on `this` — same reasoning as hooksByManager in\n// layout-manager.ts).\n//\n// `Gtk.Widget.snapshot()` is a real, working vfunc in gtkx's codegen\n// (node_modules/@gtkx/gi/gtk/gtk.js, registerWrapperClass(Widget, ...) lists\n// it with byteOffset 320) even though it is missing from the shipped\n// `gtk.d.ts` — the type generator drops it, the codegen that actually wires\n// vfuncs does not. Verified by reading the generated registry before writing\n// any of this; see epic.md.\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport { createElementComponent } from \"@gtkx/react/internal\"\nimport { registerClass } from \"@gtkx/runtime\"\nimport { parseColor } from \"../../style/colors\"\nimport {\n resolveGradientPoint,\n resolveGradientRadius,\n type BoundingBox,\n} from \"../../svg/gradient-geometry\"\nimport type { SvgTransformOp } from \"../../svg/transform\"\nimport {\n resolveViewBoxTransform,\n type PreserveAspectRatio,\n type ViewBox,\n} from \"../../svg/view-box\"\n\n// --- descriptors --------------------------------------------------------\n\nexport type SvgPaintSpec =\n { kind: \"color\"; rgba: Gdk.RGBA } | { kind: \"ref\"; id: string }\n\nexport type SvgGradientUnits = \"objectBoundingBox\" | \"userSpaceOnUse\"\n\nexport type SvgSvgDescriptor = {\n kind: \"svg\"\n viewBox: ViewBox | null\n preserveAspectRatio: PreserveAspectRatio\n}\n\nexport type SvgGroupDescriptor = {\n kind: \"g\"\n transformOps: SvgTransformOp[]\n opacity: number\n}\n\nexport type SvgShapeDescriptor = {\n kind: \"shape\"\n path: Gsk.Path | null\n fill: SvgPaintSpec | null\n fillOpacity: number\n fillRule: Gsk.FillRule\n stroke: SvgPaintSpec | null\n strokeOpacity: number\n strokeWidth: number\n strokeLinecap: Gsk.LineCap\n strokeLinejoin: Gsk.LineJoin\n strokeMiterlimit: number\n strokeDasharray: number[] | null\n strokeDashoffset: number\n opacity: number\n}\n\nexport type SvgDefsDescriptor = { kind: \"defs\" }\n\nexport type SvgLinearGradientDescriptor = {\n kind: \"gradient\"\n type: \"linear\"\n id: string\n units: SvgGradientUnits\n x1: number\n y1: number\n x2: number\n y2: number\n}\n\nexport type SvgRadialGradientDescriptor = {\n kind: \"gradient\"\n type: \"radial\"\n id: string\n units: SvgGradientUnits\n cx: number\n cy: number\n r: number\n}\n\nexport type SvgStopDescriptor = {\n kind: \"stop\"\n offset: number\n color: Gdk.RGBA\n}\n\nexport type SvgNodeDescriptor =\n | SvgSvgDescriptor\n | SvgGroupDescriptor\n | SvgShapeDescriptor\n | SvgDefsDescriptor\n | SvgLinearGradientDescriptor\n | SvgRadialGradientDescriptor\n | SvgStopDescriptor\n\nconst nodeDescriptors = new WeakMap<Gtk.Widget, SvgNodeDescriptor>()\n\nexport const setSvgNodeDescriptor = (\n widget: Gtk.Widget,\n descriptor: SvgNodeDescriptor,\n): void => {\n nodeDescriptors.set(widget, descriptor)\n}\n\nexport const getSvgNodeDescriptor = (\n widget: Gtk.Widget,\n): SvgNodeDescriptor | undefined => nodeDescriptors.get(widget)\n\n// --- paint resolution ----------------------------------------------------\n\n// `parseColor` also passes CSS variables (`var(--x)`) and legacy GTK named\n// colors (`@name`) through unchanged, for the CSS-cascade styling path\n// elsewhere in this codebase. Raw Gsk paint nodes have no cascade to resolve\n// those against — deliberate cut (epic.md): SVG fill/stroke only accepts\n// static CSS colors (hex/rgb/hsl/named/transparent), not PlatformColor.\nexport const resolveSvgColor = (spec: string | undefined): Gdk.RGBA | null => {\n if (!spec) {\n return null\n }\n const normalized = parseColor(spec)\n if (\n !normalized ||\n normalized.startsWith(\"var(\") ||\n normalized.startsWith(\"@\")\n ) {\n return null\n }\n const rgba = new Gdk.RGBA()\n return rgba.parse(normalized) ? rgba : null\n}\n\nconst URL_REF_PATTERN = /^url\\(#(.+)\\)$/\n\nexport const resolveSvgPaint = (\n spec: string | undefined,\n): SvgPaintSpec | null => {\n if (!spec || spec === \"none\") {\n return null\n }\n const match = URL_REF_PATTERN.exec(spec.trim())\n if (match) {\n return { kind: \"ref\", id: match[1]! }\n }\n const rgba = resolveSvgColor(spec)\n return rgba ? { kind: \"color\", rgba } : null\n}\n\nconst scaledAlpha = (rgba: Gdk.RGBA, factor: number): Gdk.RGBA =>\n factor >= 1\n ? rgba\n : new Gdk.RGBA({\n red: rgba.red,\n green: rgba.green,\n blue: rgba.blue,\n alpha: rgba.alpha * factor,\n })\n\nconst clamp01 = (value: number): number => Math.max(0, Math.min(1, value))\n\n// --- gradients -------------------------------------------------------------\n\ntype GradientEntry = {\n descriptor: SvgLinearGradientDescriptor | SvgRadialGradientDescriptor\n stops: Gsk.ColorStop[]\n}\n\n// RC2-WORKAROUND(gsk-colorstop-boxed-write) — row in docs/gtkx-rc2-notes.md.\n// Writing a Gdk.RGBA into a Gsk.ColorStop's `color` field crashes in the\n// native addon (@gtkx/native)\n// with \"Expected an Object for Boxed field write type, got Object\" —\n// verified through THREE independent paths, all hitting the same native\n// code: the generated constructor (uses the wrong of two RGBA descriptors,\n// _desc1 instead of the inline _desc2 — a real codegen bug), the property\n// setter (uses the documented-correct _desc2 descriptor and STILL fails,\n// which rules out a simple descriptor mix-up as the whole story), and a\n// bypass that skips ColorStop construction and hands appendLinearGradient a\n// plain {offset, color} object array instead (fails differently, with \"No\n// native handle associated with Object\" — the array marshaling genuinely\n// requires a native-backed instance per element, so there is no JS-level\n// escape hatch). This is a native-addon bug, not something fixable from\n// application code.\n//\n// Rather than crash every app that uses a gradient, or drop the gradient\n// components from the API while their descriptor-building is fully correct\n// and tested, a stop that fails to construct is treated exactly like a\n// missing gradient reference (see the url(#missing) test): the shape using\n// it simply paints no fill/stroke for that paint, instead of throwing.\nconst makeColorStop = (\n offset: number,\n color: Gdk.RGBA,\n): Gsk.ColorStop | null => {\n try {\n const stop = new Gsk.ColorStop()\n stop.offset = offset\n stop.color = color\n return stop\n } catch {\n return null\n }\n}\n\nconst collectStops = (gradientWidget: Gtk.Widget): Gsk.ColorStop[] => {\n const stops: Gsk.ColorStop[] = []\n let child = gradientWidget.getFirstChild()\n while (child) {\n const descriptor = nodeDescriptors.get(child)\n if (descriptor?.kind === \"stop\") {\n const stop = makeColorStop(descriptor.offset, descriptor.color)\n if (stop) {\n stops.push(stop)\n }\n }\n child = child.getNextSibling()\n }\n return stops\n}\n\n// Only DIRECT <Defs> children of <Svg> are scanned (a deliberate simplicity\n// cut — every real react-native-svg example keeps Defs at the top).\nconst collectGradients = (root: Gtk.Widget): Map<string, GradientEntry> => {\n const gradients = new Map<string, GradientEntry>()\n let child = root.getFirstChild()\n while (child) {\n if (nodeDescriptors.get(child)?.kind === \"defs\") {\n let gradientNode = child.getFirstChild()\n while (gradientNode) {\n const descriptor = nodeDescriptors.get(gradientNode)\n if (descriptor?.kind === \"gradient\") {\n gradients.set(descriptor.id, {\n descriptor,\n stops: collectStops(gradientNode),\n })\n }\n gradientNode = gradientNode.getNextSibling()\n }\n }\n child = child.getNextSibling()\n }\n return gradients\n}\n\nconst asBoundingBox = (rect: Graphene.Rect): BoundingBox => ({\n x: rect.origin.x,\n y: rect.origin.y,\n width: rect.size.width,\n height: rect.size.height,\n})\n\nconst appendGradient = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n entry: GradientEntry,\n opacity: number,\n): void => {\n if (entry.stops.length === 0) {\n return\n }\n const rescaled =\n opacity >= 1\n ? entry.stops\n : entry.stops\n .map((stop) =>\n makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)),\n )\n .filter((stop): stop is Gsk.ColorStop => stop !== null)\n // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a\n // scaled alpha (see makeColorStop's WORKAROUND note); if that rebuild\n // itself fails, fall back to the already-working full-opacity stops\n // rather than losing the gradient entirely over an opacity nuance.\n const stops = rescaled.length > 0 ? rescaled : entry.stops\n const [hasBounds, tightBounds] = path.getBounds()\n const bounds = hasBounds ? tightBounds : Graphene.Rect.zero()\n const box = asBoundingBox(bounds)\n const { descriptor } = entry\n\n if (descriptor.type === \"linear\") {\n const start = resolveGradientPoint(\n box,\n descriptor.x1,\n descriptor.y1,\n descriptor.units,\n )\n const end = resolveGradientPoint(\n box,\n descriptor.x2,\n descriptor.y2,\n descriptor.units,\n )\n snapshot.appendLinearGradient(\n bounds,\n new Graphene.Point(start),\n new Graphene.Point(end),\n stops,\n )\n return\n }\n\n const center = resolveGradientPoint(\n box,\n descriptor.cx,\n descriptor.cy,\n descriptor.units,\n )\n const { hradius, vradius } = resolveGradientRadius(\n box,\n descriptor.r,\n descriptor.units,\n )\n snapshot.appendRadialGradient(\n bounds,\n new Graphene.Point(center),\n hradius,\n vradius,\n 0,\n 1,\n stops,\n )\n}\n\n// --- drawing ---------------------------------------------------------------\n\nconst applyTransformOps = (\n snapshot: Gtk.Snapshot,\n ops: SvgTransformOp[],\n): void => {\n for (const op of ops) {\n switch (op.type) {\n case \"translate\":\n snapshot.translate(new Graphene.Point({ x: op.x, y: op.y }))\n break\n case \"scale\":\n snapshot.scale(op.x, op.y)\n break\n case \"rotate\":\n snapshot.rotate(op.angleDeg)\n break\n case \"matrix\":\n snapshot.transform(\n Gsk.Transform.new().matrix2d(op.a, op.b, op.c, op.d, op.e, op.f),\n )\n break\n }\n }\n}\n\nconst paintFill = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n paint: SvgPaintSpec,\n opacity: number,\n fillRule: Gsk.FillRule,\n gradients: Map<string, GradientEntry>,\n): void => {\n if (paint.kind === \"color\") {\n snapshot.appendFill(path, fillRule, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n // url(#missing-id): SVG renders nothing for that paint, not an error.\n return\n }\n snapshot.pushFill(path, fillRule)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst paintStroke = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n shape: SvgShapeDescriptor,\n paint: SvgPaintSpec,\n opacity: number,\n gradients: Map<string, GradientEntry>,\n): void => {\n const stroke = Gsk.Stroke.new(shape.strokeWidth)\n stroke.setLineCap(shape.strokeLinecap)\n stroke.setLineJoin(shape.strokeLinejoin)\n stroke.setMiterLimit(shape.strokeMiterlimit)\n if (shape.strokeDasharray && shape.strokeDasharray.length > 0) {\n stroke.setDash(shape.strokeDasharray)\n stroke.setDashOffset(shape.strokeDashoffset)\n }\n if (paint.kind === \"color\") {\n snapshot.appendStroke(path, stroke, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n return\n }\n snapshot.pushStroke(path, stroke)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst drawShape = (\n snapshot: Gtk.Snapshot,\n shape: SvgShapeDescriptor,\n gradients: Map<string, GradientEntry>,\n): void => {\n const path = shape.path\n if (!path || path.isEmpty()) {\n return\n }\n const groupOpacity = clamp01(shape.opacity)\n const needsGroup = groupOpacity < 1\n if (needsGroup) {\n snapshot.pushOpacity(groupOpacity)\n }\n if (shape.fill) {\n paintFill(\n snapshot,\n path,\n shape.fill,\n clamp01(shape.fillOpacity),\n shape.fillRule,\n gradients,\n )\n }\n if (shape.stroke && shape.strokeWidth > 0) {\n paintStroke(\n snapshot,\n path,\n shape,\n shape.stroke,\n clamp01(shape.strokeOpacity),\n gradients,\n )\n }\n if (needsGroup) {\n snapshot.pop()\n }\n}\n\nconst drawChildren = (\n snapshot: Gtk.Snapshot,\n parent: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n let child = parent.getFirstChild()\n while (child) {\n drawNode(snapshot, child, gradients)\n child = child.getNextSibling()\n }\n}\n\nconst drawNode = (\n snapshot: Gtk.Snapshot,\n widget: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n const descriptor = nodeDescriptors.get(widget)\n if (!descriptor) {\n return\n }\n switch (descriptor.kind) {\n case \"shape\":\n drawShape(snapshot, descriptor, gradients)\n return\n case \"g\": {\n const opacity = clamp01(descriptor.opacity)\n const needsOpacity = opacity < 1\n snapshot.save()\n applyTransformOps(snapshot, descriptor.transformOps)\n if (needsOpacity) {\n snapshot.pushOpacity(opacity)\n }\n drawChildren(snapshot, widget, gradients)\n if (needsOpacity) {\n snapshot.pop()\n }\n snapshot.restore()\n return\n }\n // defs/gradient/stop are resources, not paint; a nested <Svg> is not a\n // supported composition (undocumented, no-op rather than a crash).\n case \"defs\":\n case \"gradient\":\n case \"stop\":\n case \"svg\":\n return\n }\n}\n\n// --- widget registration ---------------------------------------------------\n\nlet RnGtkxSvgNodeClass: (new () => Gtk.Widget) | null = null\n\nconst ensureRegistered = (): new () => Gtk.Widget => {\n if (RnGtkxSvgNodeClass) {\n return RnGtkxSvgNodeClass\n }\n\n // Box, not a bare Widget: the reconciler only auto-attaches JSX children\n // (generic set_parent/insert_after) for widget types that carry a\n // registered \"children\" behavior, resolved by walking the GType ancestry\n // chain (@gtkx/react's typeInfoFor/buildTypeInfo). Plain GtkWidget has no\n // such behavior — only concrete container types like Box do — which is\n // also why RnGtkxViewBox (view-box.ts) is a Box subclass, not a bare\n // Widget one. GtkBox's own default BoxLayout then measures/allocates\n // these children, but harmlessly: they report a natural size of 0x0 (no\n // style, no content) and their own snapshot() no-ops for anything that\n // is not the mounted <Svg> root (see below), so nothing is ever\n // double-painted through GTK's normal child-snapshot path.\n class RnGtkxSvgNode extends Gtk.Box {\n // Only ever invoked by GTK on the mounted <Svg> root (nothing calls\n // snapshotChild() on the inert descendant instances). Defensive no-op\n // otherwise, so a stray direct call never throws.\n snapshot(snapshot: Gtk.Snapshot): void {\n const descriptor = nodeDescriptors.get(this)\n if (!descriptor || descriptor.kind !== \"svg\") {\n return\n }\n const width = this.getWidth()\n const height = this.getHeight()\n if (width <= 0 || height <= 0) {\n return\n }\n const transform = resolveViewBoxTransform(\n descriptor.viewBox,\n width,\n height,\n descriptor.preserveAspectRatio,\n )\n const gradients = collectGradients(this)\n // RC2-WORKAROUND(graphene-rect-nested-boxed-props) — row in\n // docs/gtkx-rc2-notes.md. `new Graphene.Rect({ origin: new\n // Graphene.Point(...), size: new Graphene.Size(...) })` hits the same\n // native \"Expected an Object for Boxed field write type, got Object\"\n // as Gsk.ColorStop's `color` field (see makeColorStop below) — Rect\n // has a working escape hatch, `.alloc().init(x, y, w, h)`, that\n // ColorStop does not.\n //\n // SVG clips to the viewport by default (no overflow:visible opt-out\n // in this API — deliberate cut, see epic.md).\n snapshot.pushClip(Graphene.Rect.alloc().init(0, 0, width, height))\n snapshot.save()\n snapshot.translate(\n new Graphene.Point({\n x: transform.translateX,\n y: transform.translateY,\n }),\n )\n snapshot.scale(transform.scaleX, transform.scaleY)\n drawChildren(snapshot, this, gradients)\n snapshot.restore()\n snapshot.pop()\n }\n }\n // Explicit typeName: bundlers minify class names (same reasoning as\n // RnGtkxLayout/RnGtkxViewBox).\n registerClass(RnGtkxSvgNode, { typeName: \"RnGtkxSvgNode\" })\n RnGtkxSvgNodeClass = RnGtkxSvgNode\n return RnGtkxSvgNode\n}\n\ntype SvgNodeComponent = ReturnType<typeof createElementComponent>\n\nlet component: SvgNodeComponent | null = null\n\nexport const getSvgNodeComponent = (): SvgNodeComponent => {\n if (component) {\n return component\n }\n ensureRegistered()\n component = createElementComponent(\"RnGtkxSvgNode\")\n return component\n}\n\n/** Imperative invalidation channel for SVG: paint-only changes (including\n * Animated-driven ones) call this instead of queueAllocate/queueResize —\n * nothing here ever touches Yoga. */\nexport const queueSvgRedraw = (rootWidget: Gtk.Widget): void => {\n rootWidget.queueDraw()\n}\n"]}
1
+ {"version":3,"file":"svg-node.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/svg-node.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,gEAAgE;AAChE,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,sBAAsB;AACtB,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,4BAA4B;AAC5B,OAAO,KAAK,GAAG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MAAM,CAAC,CAAA;YAClD,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;YACvC,QAAQ,CAAC,OAAO,EAAE,CAAA;YAClB,QAAQ,CAAC,GAAG,EAAE,CAAA;QAChB,CAAC;KACF;IACD,oEAAoE;IACpE,+BAA+B;IAC/B,aAAa,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAA;IAC3D,kBAAkB,GAAG,aAAa,CAAA;IAClC,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAID,IAAI,SAAS,GAA4B,IAAI,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,gBAAgB,EAAE,CAAA;IAClB,SAAS,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAA;IACnD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;;qCAEqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAsB,EAAQ,EAAE;IAC7D,UAAU,CAAC,SAAS,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["// RnGtkxSvgNode — one GObject class (registerClass, same mechanism as\n// RnGtkxLayout/RnGtkxViewBox) reused for the <Svg> root AND every descendant\n// (<G>, <Path>, <Rect>, ..., <Defs>, <LinearGradient>, <Stop>). Descendants\n// are ordinary GTK children (the reconciler's generic set_parent/insert_after\n// attachment — the same one View relies on) that GTK never snapshots on its\n// own, because nothing ever calls snapshotChild() on them: only the mounted\n// <Svg> instance's snapshot() vfunc actually runs, and it walks\n// getFirstChild()/getNextSibling() itself, reading each node's role from a\n// WeakMap (native wrappers get re-created by the runtime, so per-instance\n// state cannot live on `this` — same reasoning as hooksByManager in\n// layout-manager.ts).\n//\n// `Gtk.Widget.snapshot()` is a real, working vfunc in gtkx's codegen\n// (node_modules/@gtkx/gi/gtk/gtk.js, registerWrapperClass(Widget, ...) lists\n// it with byteOffset 320) even though it is missing from the shipped\n// `gtk.d.ts` — the type generator drops it, the codegen that actually wires\n// vfuncs does not. Verified by reading the generated registry before writing\n// any of this; see epic.md.\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport { createElementComponent } from \"@gtkx/react/internal\"\nimport { registerClass } from \"@gtkx/runtime\"\nimport { parseColor } from \"../../style/colors\"\nimport {\n resolveGradientPoint,\n resolveGradientRadius,\n type BoundingBox,\n} from \"../../svg/gradient-geometry\"\nimport type { SvgTransformOp } from \"../../svg/transform\"\nimport {\n resolveViewBoxTransform,\n type PreserveAspectRatio,\n type ViewBox,\n} from \"../../svg/view-box\"\n\n// --- descriptors --------------------------------------------------------\n\nexport type SvgPaintSpec =\n { kind: \"color\"; rgba: Gdk.RGBA } | { kind: \"ref\"; id: string }\n\nexport type SvgGradientUnits = \"objectBoundingBox\" | \"userSpaceOnUse\"\n\nexport type SvgSvgDescriptor = {\n kind: \"svg\"\n viewBox: ViewBox | null\n preserveAspectRatio: PreserveAspectRatio\n}\n\nexport type SvgGroupDescriptor = {\n kind: \"g\"\n transformOps: SvgTransformOp[]\n opacity: number\n}\n\nexport type SvgShapeDescriptor = {\n kind: \"shape\"\n path: Gsk.Path | null\n fill: SvgPaintSpec | null\n fillOpacity: number\n fillRule: Gsk.FillRule\n stroke: SvgPaintSpec | null\n strokeOpacity: number\n strokeWidth: number\n strokeLinecap: Gsk.LineCap\n strokeLinejoin: Gsk.LineJoin\n strokeMiterlimit: number\n strokeDasharray: number[] | null\n strokeDashoffset: number\n opacity: number\n}\n\nexport type SvgDefsDescriptor = { kind: \"defs\" }\n\nexport type SvgLinearGradientDescriptor = {\n kind: \"gradient\"\n type: \"linear\"\n id: string\n units: SvgGradientUnits\n x1: number\n y1: number\n x2: number\n y2: number\n}\n\nexport type SvgRadialGradientDescriptor = {\n kind: \"gradient\"\n type: \"radial\"\n id: string\n units: SvgGradientUnits\n cx: number\n cy: number\n r: number\n}\n\nexport type SvgStopDescriptor = {\n kind: \"stop\"\n offset: number\n color: Gdk.RGBA\n}\n\nexport type SvgNodeDescriptor =\n | SvgSvgDescriptor\n | SvgGroupDescriptor\n | SvgShapeDescriptor\n | SvgDefsDescriptor\n | SvgLinearGradientDescriptor\n | SvgRadialGradientDescriptor\n | SvgStopDescriptor\n\nconst nodeDescriptors = new WeakMap<Gtk.Widget, SvgNodeDescriptor>()\n\nexport const setSvgNodeDescriptor = (\n widget: Gtk.Widget,\n descriptor: SvgNodeDescriptor,\n): void => {\n nodeDescriptors.set(widget, descriptor)\n}\n\nexport const getSvgNodeDescriptor = (\n widget: Gtk.Widget,\n): SvgNodeDescriptor | undefined => nodeDescriptors.get(widget)\n\n// --- paint resolution ----------------------------------------------------\n\n// `parseColor` also passes CSS variables (`var(--x)`) and legacy GTK named\n// colors (`@name`) through unchanged, for the CSS-cascade styling path\n// elsewhere in this codebase. Raw Gsk paint nodes have no cascade to resolve\n// those against — deliberate cut (epic.md): SVG fill/stroke only accepts\n// static CSS colors (hex/rgb/hsl/named/transparent), not PlatformColor.\nexport const resolveSvgColor = (spec: string | undefined): Gdk.RGBA | null => {\n if (!spec) {\n return null\n }\n const normalized = parseColor(spec)\n if (\n !normalized ||\n normalized.startsWith(\"var(\") ||\n normalized.startsWith(\"@\")\n ) {\n return null\n }\n const rgba = new Gdk.RGBA()\n return rgba.parse(normalized) ? rgba : null\n}\n\nconst URL_REF_PATTERN = /^url\\(#(.+)\\)$/\n\nexport const resolveSvgPaint = (\n spec: string | undefined,\n): SvgPaintSpec | null => {\n if (!spec || spec === \"none\") {\n return null\n }\n const match = URL_REF_PATTERN.exec(spec.trim())\n if (match) {\n return { kind: \"ref\", id: match[1]! }\n }\n const rgba = resolveSvgColor(spec)\n return rgba ? { kind: \"color\", rgba } : null\n}\n\nconst scaledAlpha = (rgba: Gdk.RGBA, factor: number): Gdk.RGBA =>\n factor >= 1\n ? rgba\n : new Gdk.RGBA({\n red: rgba.red,\n green: rgba.green,\n blue: rgba.blue,\n alpha: rgba.alpha * factor,\n })\n\nconst clamp01 = (value: number): number => Math.max(0, Math.min(1, value))\n\n// --- gradients -------------------------------------------------------------\n\ntype GradientEntry = {\n descriptor: SvgLinearGradientDescriptor | SvgRadialGradientDescriptor\n stops: Gsk.ColorStop[]\n}\n\nconst makeColorStop = (offset: number, color: Gdk.RGBA): Gsk.ColorStop =>\n new Gsk.ColorStop({ offset, color })\n\nconst collectStops = (gradientWidget: Gtk.Widget): Gsk.ColorStop[] => {\n const stops: Gsk.ColorStop[] = []\n let child = gradientWidget.getFirstChild()\n while (child) {\n const descriptor = nodeDescriptors.get(child)\n if (descriptor?.kind === \"stop\") {\n stops.push(makeColorStop(descriptor.offset, descriptor.color))\n }\n child = child.getNextSibling()\n }\n return stops\n}\n\n// Only DIRECT <Defs> children of <Svg> are scanned (a deliberate simplicity\n// cut — every real react-native-svg example keeps Defs at the top).\nconst collectGradients = (root: Gtk.Widget): Map<string, GradientEntry> => {\n const gradients = new Map<string, GradientEntry>()\n let child = root.getFirstChild()\n while (child) {\n if (nodeDescriptors.get(child)?.kind === \"defs\") {\n let gradientNode = child.getFirstChild()\n while (gradientNode) {\n const descriptor = nodeDescriptors.get(gradientNode)\n if (descriptor?.kind === \"gradient\") {\n gradients.set(descriptor.id, {\n descriptor,\n stops: collectStops(gradientNode),\n })\n }\n gradientNode = gradientNode.getNextSibling()\n }\n }\n child = child.getNextSibling()\n }\n return gradients\n}\n\nconst asBoundingBox = (rect: Graphene.Rect): BoundingBox => ({\n x: rect.origin.x,\n y: rect.origin.y,\n width: rect.size.width,\n height: rect.size.height,\n})\n\nconst appendGradient = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n entry: GradientEntry,\n opacity: number,\n): void => {\n if (entry.stops.length === 0) {\n return\n }\n // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a\n // scaled alpha.\n const stops =\n opacity >= 1\n ? entry.stops\n : entry.stops.map((stop) =>\n makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)),\n )\n const [hasBounds, tightBounds] = path.getBounds()\n const bounds = hasBounds ? tightBounds : Graphene.Rect.zero()\n const box = asBoundingBox(bounds)\n const { descriptor } = entry\n\n if (descriptor.type === \"linear\") {\n const start = resolveGradientPoint(\n box,\n descriptor.x1,\n descriptor.y1,\n descriptor.units,\n )\n const end = resolveGradientPoint(\n box,\n descriptor.x2,\n descriptor.y2,\n descriptor.units,\n )\n snapshot.appendLinearGradient(\n bounds,\n new Graphene.Point(start),\n new Graphene.Point(end),\n stops,\n )\n return\n }\n\n const center = resolveGradientPoint(\n box,\n descriptor.cx,\n descriptor.cy,\n descriptor.units,\n )\n const { hradius, vradius } = resolveGradientRadius(\n box,\n descriptor.r,\n descriptor.units,\n )\n snapshot.appendRadialGradient(\n bounds,\n new Graphene.Point(center),\n hradius,\n vradius,\n 0,\n 1,\n stops,\n )\n}\n\n// --- drawing ---------------------------------------------------------------\n\nconst applyTransformOps = (\n snapshot: Gtk.Snapshot,\n ops: SvgTransformOp[],\n): void => {\n for (const op of ops) {\n switch (op.type) {\n case \"translate\":\n snapshot.translate(new Graphene.Point({ x: op.x, y: op.y }))\n break\n case \"scale\":\n snapshot.scale(op.x, op.y)\n break\n case \"rotate\":\n snapshot.rotate(op.angleDeg)\n break\n case \"matrix\":\n snapshot.transform(\n Gsk.Transform.new().matrix2d(op.a, op.b, op.c, op.d, op.e, op.f),\n )\n break\n }\n }\n}\n\nconst paintFill = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n paint: SvgPaintSpec,\n opacity: number,\n fillRule: Gsk.FillRule,\n gradients: Map<string, GradientEntry>,\n): void => {\n if (paint.kind === \"color\") {\n snapshot.appendFill(path, fillRule, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n // url(#missing-id): SVG renders nothing for that paint, not an error.\n return\n }\n snapshot.pushFill(path, fillRule)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst paintStroke = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n shape: SvgShapeDescriptor,\n paint: SvgPaintSpec,\n opacity: number,\n gradients: Map<string, GradientEntry>,\n): void => {\n const stroke = Gsk.Stroke.new(shape.strokeWidth)\n stroke.setLineCap(shape.strokeLinecap)\n stroke.setLineJoin(shape.strokeLinejoin)\n stroke.setMiterLimit(shape.strokeMiterlimit)\n if (shape.strokeDasharray && shape.strokeDasharray.length > 0) {\n stroke.setDash(shape.strokeDasharray)\n stroke.setDashOffset(shape.strokeDashoffset)\n }\n if (paint.kind === \"color\") {\n snapshot.appendStroke(path, stroke, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n return\n }\n snapshot.pushStroke(path, stroke)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst drawShape = (\n snapshot: Gtk.Snapshot,\n shape: SvgShapeDescriptor,\n gradients: Map<string, GradientEntry>,\n): void => {\n const path = shape.path\n if (!path || path.isEmpty()) {\n return\n }\n const groupOpacity = clamp01(shape.opacity)\n const needsGroup = groupOpacity < 1\n if (needsGroup) {\n snapshot.pushOpacity(groupOpacity)\n }\n if (shape.fill) {\n paintFill(\n snapshot,\n path,\n shape.fill,\n clamp01(shape.fillOpacity),\n shape.fillRule,\n gradients,\n )\n }\n if (shape.stroke && shape.strokeWidth > 0) {\n paintStroke(\n snapshot,\n path,\n shape,\n shape.stroke,\n clamp01(shape.strokeOpacity),\n gradients,\n )\n }\n if (needsGroup) {\n snapshot.pop()\n }\n}\n\nconst drawChildren = (\n snapshot: Gtk.Snapshot,\n parent: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n let child = parent.getFirstChild()\n while (child) {\n drawNode(snapshot, child, gradients)\n child = child.getNextSibling()\n }\n}\n\nconst drawNode = (\n snapshot: Gtk.Snapshot,\n widget: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n const descriptor = nodeDescriptors.get(widget)\n if (!descriptor) {\n return\n }\n switch (descriptor.kind) {\n case \"shape\":\n drawShape(snapshot, descriptor, gradients)\n return\n case \"g\": {\n const opacity = clamp01(descriptor.opacity)\n const needsOpacity = opacity < 1\n snapshot.save()\n applyTransformOps(snapshot, descriptor.transformOps)\n if (needsOpacity) {\n snapshot.pushOpacity(opacity)\n }\n drawChildren(snapshot, widget, gradients)\n if (needsOpacity) {\n snapshot.pop()\n }\n snapshot.restore()\n return\n }\n // defs/gradient/stop are resources, not paint; a nested <Svg> is not a\n // supported composition (undocumented, no-op rather than a crash).\n case \"defs\":\n case \"gradient\":\n case \"stop\":\n case \"svg\":\n return\n }\n}\n\n// --- widget registration ---------------------------------------------------\n\nlet RnGtkxSvgNodeClass: (new () => Gtk.Widget) | null = null\n\nconst ensureRegistered = (): new () => Gtk.Widget => {\n if (RnGtkxSvgNodeClass) {\n return RnGtkxSvgNodeClass\n }\n\n // Box, not a bare Widget: the reconciler only auto-attaches JSX children\n // (generic set_parent/insert_after) for widget types that carry a\n // registered \"children\" behavior, resolved by walking the GType ancestry\n // chain (@gtkx/react's typeInfoFor/buildTypeInfo). Plain GtkWidget has no\n // such behavior — only concrete container types like Box do — which is\n // also why RnGtkxViewBox (view-box.ts) is a Box subclass, not a bare\n // Widget one. GtkBox's own default BoxLayout then measures/allocates\n // these children, but harmlessly: they report a natural size of 0x0 (no\n // style, no content) and their own snapshot() no-ops for anything that\n // is not the mounted <Svg> root (see below), so nothing is ever\n // double-painted through GTK's normal child-snapshot path.\n class RnGtkxSvgNode extends Gtk.Box {\n // Only ever invoked by GTK on the mounted <Svg> root (nothing calls\n // snapshotChild() on the inert descendant instances). Defensive no-op\n // otherwise, so a stray direct call never throws.\n snapshot(snapshot: Gtk.Snapshot): void {\n const descriptor = nodeDescriptors.get(this)\n if (!descriptor || descriptor.kind !== \"svg\") {\n return\n }\n const width = this.getWidth()\n const height = this.getHeight()\n if (width <= 0 || height <= 0) {\n return\n }\n const transform = resolveViewBoxTransform(\n descriptor.viewBox,\n width,\n height,\n descriptor.preserveAspectRatio,\n )\n const gradients = collectGradients(this)\n // SVG clips to the viewport by default (no overflow:visible opt-out\n // in this API — deliberate cut, see epic.md).\n snapshot.pushClip(\n new Graphene.Rect({\n origin: new Graphene.Point({ x: 0, y: 0 }),\n size: new Graphene.Size({ width, height }),\n }),\n )\n snapshot.save()\n snapshot.translate(\n new Graphene.Point({\n x: transform.translateX,\n y: transform.translateY,\n }),\n )\n snapshot.scale(transform.scaleX, transform.scaleY)\n drawChildren(snapshot, this, gradients)\n snapshot.restore()\n snapshot.pop()\n }\n }\n // Explicit typeName: bundlers minify class names (same reasoning as\n // RnGtkxLayout/RnGtkxViewBox).\n registerClass(RnGtkxSvgNode, { typeName: \"RnGtkxSvgNode\" })\n RnGtkxSvgNodeClass = RnGtkxSvgNode\n return RnGtkxSvgNode\n}\n\ntype SvgNodeComponent = ReturnType<typeof createElementComponent>\n\nlet component: SvgNodeComponent | null = null\n\nexport const getSvgNodeComponent = (): SvgNodeComponent => {\n if (component) {\n return component\n }\n ensureRegistered()\n component = createElementComponent(\"RnGtkxSvgNode\")\n return component\n}\n\n/** Imperative invalidation channel for SVG: paint-only changes (including\n * Animated-driven ones) call this instead of queueAllocate/queueResize —\n * nothing here ever touches Yoga. */\nexport const queueSvgRedraw = (rootWidget: Gtk.Widget): void => {\n rootWidget.queueDraw()\n}\n"]}
@@ -1,7 +1,7 @@
1
- // RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md
1
+ // RC4-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc4-notes.md
2
2
  // @gtkx/react's useSignal documents that "each emission runs the handler from
3
3
  // the latest render", and rc.1 delivered that by pinning the handler in a ref
4
- // of its own. rc.2 routes it through React's useEffectEvent instead, and
4
+ // of its own. rc.3 routes it through React's useEffectEvent instead, and
5
5
  // react-reconciler@0.33.0 only refreshes useEffectEvent in
6
6
  // commitBeforeMutationEffects for `case 0` (FunctionComponent) — `case 11`
7
7
  // (ForwardRef) and `case 15` (SimpleMemoComponent) fall through unrefreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/use-signal.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,2DAA2D;AAC3D,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,mEAAmE;AACnE,+DAA+D;AAC/D,4EAA4E;AAC5E,8EAA8E;AAC9E,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,yEAAyE;AACzE,uDAAuD;AACvD,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAI/D,MAAM,CAAC,MAAM,SAAS,GAAyB,CAC7C,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,EAAE;IACF,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,MAAM,GAAG,MAAM,CAAa,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAClD,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,OAAgC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EACpC,EAAE,CACH,CAAA;IACD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAmC,EAAE,OAAO,CAAC,CAAA;AAC7E,CAAC,CAAA","sourcesContent":["// RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md\n// @gtkx/react's useSignal documents that \"each emission runs the handler from\n// the latest render\", and rc.1 delivered that by pinning the handler in a ref\n// of its own. rc.2 routes it through React's useEffectEvent instead, and\n// react-reconciler@0.33.0 only refreshes useEffectEvent in\n// commitBeforeMutationEffects for `case 0` (FunctionComponent) — `case 11`\n// (ForwardRef) and `case 15` (SimpleMemoComponent) fall through unrefreshed.\n// Any useEffectEvent inside a memo or forwardRef component is pinned to its\n// mount closure permanently; this has nothing to do with useSignal\n// specifically (confirmed upstream: gtkx-org/gtkx#467) — plain\n// useEffectEvent called from an Effect fails identically. It reproduced for\n// us because our ScrollView is a forwardRef (components/scroll-view.tsx) with\n// the useSignal calls inside it; tree depth was a coincidence, not the\n// trigger. The consequence is not subtle — the mount-time scroll handler\n// windows a VirtualizedList against the data it saw at mount, so a list\n// whose rows arrive from a fetch renders EMPTY as soon as it is scrolled.\n//\n// Restore the documented contract at the bridge: keep the latest handler in a\n// ref of our own and hand gtkx a stable wrapper (stable so the connection is\n// never re-established, which is what its useEffectEvent was for). The ref is\n// refreshed in an INSERTION effect — the earliest commit phase, ahead of every\n// layout effect, so a signal emitted from one (the list's own scroll\n// corrections) already sees the handler from the render being committed.\n// React fixed the refresh on the 19.3 line (moved into\n// commitMutationEffectsOnFiber, covering `case 0/11/14/15` ahead of child\n// traversal), but there is no stable 0.34.x gtkx release yet and the React\n// canaries pin an exact prerelease peer, so this wrapper stays until a\n// stable React 19.3 ships — not \"when useSignal is fixed\" (see gtkx#467).\nimport { useSignal as useGtkxSignal } from \"@gtkx/react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\n\ntype AnyHandler = (...args: unknown[]) => unknown\n\nexport const useSignal: typeof useGtkxSignal = (\n object,\n signal,\n handler,\n options,\n) => {\n // The handler type is generic in the signal name; the wrapper only forwards\n // arguments, so it crosses that boundary as an untyped callable.\n const latest = useRef<AnyHandler>(() => undefined)\n useInsertionEffect(() => {\n latest.current = handler as unknown as AnyHandler\n })\n const stable = useCallback<AnyHandler>(\n (...args) => latest.current(...args),\n [],\n )\n useGtkxSignal(object, signal, stable as unknown as typeof handler, options)\n}\n"]}
1
+ {"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/use-signal.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,2DAA2D;AAC3D,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,mEAAmE;AACnE,+DAA+D;AAC/D,4EAA4E;AAC5E,8EAA8E;AAC9E,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,yEAAyE;AACzE,uDAAuD;AACvD,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAI/D,MAAM,CAAC,MAAM,SAAS,GAAyB,CAC7C,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,EAAE;IACF,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,MAAM,GAAG,MAAM,CAAa,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAClD,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,OAAgC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EACpC,EAAE,CACH,CAAA;IACD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAmC,EAAE,OAAO,CAAC,CAAA;AAC7E,CAAC,CAAA","sourcesContent":["// RC4-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc4-notes.md\n// @gtkx/react's useSignal documents that \"each emission runs the handler from\n// the latest render\", and rc.1 delivered that by pinning the handler in a ref\n// of its own. rc.3 routes it through React's useEffectEvent instead, and\n// react-reconciler@0.33.0 only refreshes useEffectEvent in\n// commitBeforeMutationEffects for `case 0` (FunctionComponent) — `case 11`\n// (ForwardRef) and `case 15` (SimpleMemoComponent) fall through unrefreshed.\n// Any useEffectEvent inside a memo or forwardRef component is pinned to its\n// mount closure permanently; this has nothing to do with useSignal\n// specifically (confirmed upstream: gtkx-org/gtkx#467) — plain\n// useEffectEvent called from an Effect fails identically. It reproduced for\n// us because our ScrollView is a forwardRef (components/scroll-view.tsx) with\n// the useSignal calls inside it; tree depth was a coincidence, not the\n// trigger. The consequence is not subtle — the mount-time scroll handler\n// windows a VirtualizedList against the data it saw at mount, so a list\n// whose rows arrive from a fetch renders EMPTY as soon as it is scrolled.\n//\n// Restore the documented contract at the bridge: keep the latest handler in a\n// ref of our own and hand gtkx a stable wrapper (stable so the connection is\n// never re-established, which is what its useEffectEvent was for). The ref is\n// refreshed in an INSERTION effect — the earliest commit phase, ahead of every\n// layout effect, so a signal emitted from one (the list's own scroll\n// corrections) already sees the handler from the render being committed.\n// React fixed the refresh on the 19.3 line (moved into\n// commitMutationEffectsOnFiber, covering `case 0/11/14/15` ahead of child\n// traversal), but there is no stable 0.34.x gtkx release yet and the React\n// canaries pin an exact prerelease peer, so this wrapper stays until a\n// stable React 19.3 ships — not \"when useSignal is fixed\" (see gtkx#467).\nimport { useSignal as useGtkxSignal } from \"@gtkx/react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\n\ntype AnyHandler = (...args: unknown[]) => unknown\n\nexport const useSignal: typeof useGtkxSignal = (\n object,\n signal,\n handler,\n options,\n) => {\n // The handler type is generic in the signal name; the wrapper only forwards\n // arguments, so it crosses that boundary as an untyped callable.\n const latest = useRef<AnyHandler>(() => undefined)\n useInsertionEffect(() => {\n latest.current = handler as unknown as AnyHandler\n })\n const stable = useCallback<AnyHandler>(\n (...args) => latest.current(...args),\n [],\n )\n useGtkxSignal(object, signal, stable as unknown as typeof handler, options)\n}\n"]}
@@ -1,7 +1,63 @@
1
1
  import * as Gtk from "@gtkx/gi/gtk";
2
2
  import { createElementComponent } from "@gtkx/react/internal";
3
+ export type HitSlop = {
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ };
3
9
  /** box-none toggle: picking consults this live, no invalidation needed. */
4
10
  export declare const setBoxPassthrough: (widget: Gtk.Widget, enabled: boolean) => void;
11
+ /**
12
+ * Grows the rect this widget's contains() accepts. Only RnGtkxViewBox
13
+ * consults it — RN's hitSlop is a picking change and nothing in JS can
14
+ * substitute for one, because a press outside the widget is never delivered
15
+ * to it in the first place.
16
+ */
17
+ export declare const setHitSlop: (widget: Gtk.Widget, slop: HitSlop | null) => void;
18
+ /**
19
+ * What this widget's own `pointerEvents` wants its can-target to be. A
20
+ * box-only ancestor still overrides it, and stops overriding it the moment
21
+ * the ancestor's mode changes — without either of them having to know about
22
+ * the other.
23
+ */
24
+ export declare const setPointerTarget: (widget: Gtk.Widget, targetable: boolean) => void;
25
+ /**
26
+ * Masks or unmasks a widget's direct children — RN's
27
+ * pointerEvents="box-only". Re-applied every commit rather than only on
28
+ * change, because the child set moves with the renders.
29
+ */
30
+ export declare const setBoxOnly: (widget: Gtk.Widget, enabled: boolean) => void;
31
+ /**
32
+ * Publishes the child list the container's allocate pass just walked.
33
+ *
34
+ * Cheap on the hot path by construction: the array is one the caller built
35
+ * anyway, and the paint order is only invalidated when the children actually
36
+ * differ — an allocate for a pure move (which is most of them, one per
37
+ * animated frame) leaves the cached sort alone.
38
+ */
39
+ export declare const cacheChildOrder: (container: Gtk.Widget, children: Gtk.Widget[]) => void;
40
+ /**
41
+ * Marks a widget as painting-only for picking purposes — see above. Called
42
+ * once per widget by the components that own one (`Text`, `Image`).
43
+ */
44
+ export declare const setPaintOnlyLeaf: (widget: Gtk.Widget) => void;
45
+ /**
46
+ * Drops a container's cached paint order and asks for a redraw.
47
+ *
48
+ * Called from the zIndex writer and from the container's per-commit effect
49
+ * (components/use-layout-child.ts), which is what covers a child mounting,
50
+ * unmounting or being MOVED by React — the three ways the order can change
51
+ * without any zIndex being written.
52
+ */
53
+ export declare const invalidateZOrder: (container: Gtk.Widget) => void;
54
+ /**
55
+ * RN's `zIndex` for one child. `0` (the default, and `undefined`) clears it.
56
+ *
57
+ * RN applies `zIndex` unconditionally — unlike CSS, which ignores `z-index`
58
+ * on a `position: static` box. Nothing here looks at `position` either.
59
+ */
60
+ export declare const setZIndex: (widget: Gtk.Widget, value: number) => void;
5
61
  type ViewBoxComponent = ReturnType<typeof createElementComponent>;
6
62
  export declare const getViewBoxComponent: () => ViewBoxComponent;
7
63
  export {};