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
@@ -7,4 +7,11 @@ export type HostNode = {
7
7
  widgetRef: RefObject<Gtk.Box | null>;
8
8
  };
9
9
  export declare const HostNodeContext: React.Context<HostNode | null>;
10
+ export type SlotLocation = {
11
+ /** The widget this content was handed to, e.g. "AdwBottomSheet". */
12
+ widget: string;
13
+ /** The slot property, e.g. "sheet" — or null for an ordinary child. */
14
+ slot: string | null;
15
+ };
16
+ export declare const SlotContext: React.Context<SlotLocation | null>;
10
17
  export declare const useHostNode: () => HostNode;
@@ -1,9 +1,34 @@
1
1
  import { createContext, useContext } from "react";
2
2
  export const HostNodeContext = createContext(null);
3
+ export const SlotContext = createContext(null);
4
+ const slotError = ({ widget, slot }) => {
5
+ // The two shapes differ only in how you write the wrapper, so the message
6
+ // shows the caller their own syntax rather than a generic one.
7
+ const where = slot
8
+ ? `${widget}'s \`${slot}\` slot`
9
+ : `${widget}, as its child`;
10
+ const wrap = (root) => slot
11
+ ? ` ${slot}={<${root}>…</${root}>}`
12
+ : ` <${widget}>…</${widget}> → <${widget}><${root}>…</${root}></${widget}>`;
13
+ return (`react-native-gtkx: React Native content was put in ${where} without a layout root.\n` +
14
+ `A GTK widget hands out a rectangle, and React Native needs a root to lay out inside it. Wrap the content:\n` +
15
+ `${wrap("SlotContent")} — fill the area (a page body, a pane, a content area)\n` +
16
+ `${wrap("IntrinsicContent")} — size the area to the content (a bar, a header slot, a row)\n` +
17
+ // The subpath is named without quoting it as a specifier: the metro-preset
18
+ // test scans src for bare imports with a regex, and an import-shaped
19
+ // sentence in a string literal reads to it exactly like a real one.
20
+ `Both are exported by react-native-gtkx/common. GTK widgets need neither — they are what a widget takes natively.`);
21
+ };
3
22
  export const useHostNode = () => {
4
23
  const host = useContext(HostNodeContext);
24
+ // One extra context read per layout child. Deliberate: it is what turns the
25
+ // single most confusing failure on this platform — content silently laid
26
+ // out against the wrong rectangle — into a sentence naming where it landed.
27
+ const slot = useContext(SlotContext);
5
28
  if (host === null) {
6
- throw new Error("react-native-gtkx components must be rendered inside AppRegistry.runApplication() or a <Root>");
29
+ throw new Error(slot
30
+ ? slotError(slot)
31
+ : "react-native-gtkx components must be rendered inside AppRegistry.runApplication() or a <Root>");
7
32
  }
8
33
  return host;
9
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"host-node.js","sourceRoot":"","sources":["../../src/components/host-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AAajE,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAA;AAEnE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAa,EAAE;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACxC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,+FAA+F,CAChG,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { createContext, useContext, type RefObject } from \"react\"\nimport type { LayoutEngine, LayoutNode } from \"../layout/index\"\nimport type { Gtk } from \"../gtkx/bridge/index\"\n\n// One per mounted container (Root or View): children register their layout\n// nodes here and commit rects into the store read by the parent's\n// RnGtkxLayout allocate().\nexport type HostNode = {\n engine: LayoutEngine\n node: LayoutNode\n widgetRef: RefObject<Gtk.Box | null>\n}\n\nexport const HostNodeContext = createContext<HostNode | null>(null)\n\nexport const useHostNode = (): HostNode => {\n const host = useContext(HostNodeContext)\n if (host === null) {\n throw new Error(\n \"react-native-gtkx components must be rendered inside AppRegistry.runApplication() or a <Root>\",\n )\n }\n return host\n}\n"]}
1
+ {"version":3,"file":"host-node.js","sourceRoot":"","sources":["../../src/components/host-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AAajE,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAA;AAenE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAsB,IAAI,CAAC,CAAA;AAEnE,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAgB,EAAU,EAAE;IAC3D,0EAA0E;IAC1E,+DAA+D;IAC/D,MAAM,KAAK,GAAG,IAAI;QAChB,CAAC,CAAC,GAAG,MAAM,QAAQ,IAAI,SAAS;QAChC,CAAC,CAAC,GAAG,MAAM,gBAAgB,CAAA;IAC7B,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE,CACpC,IAAI;QACF,CAAC,CAAC,KAAK,IAAI,MAAM,IAAI,OAAO,IAAI,IAAI;QACpC,CAAC,CAAC,MAAM,MAAM,OAAO,MAAM,QAAQ,MAAM,KAAK,IAAI,OAAO,IAAI,MAAM,MAAM,GAAG,CAAA;IAChF,OAAO,CACL,sDAAsD,KAAK,2BAA2B;QACtF,6GAA6G;QAC7G,GAAG,IAAI,CAAC,aAAa,CAAC,0DAA0D;QAChF,GAAG,IAAI,CAAC,kBAAkB,CAAC,iEAAiE;QAC5F,2EAA2E;QAC3E,qEAAqE;QACrE,oEAAoE;QACpE,kHAAkH,CACnH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,GAAa,EAAE;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACxC,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACpC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,IAAI;YACF,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;YACjB,CAAC,CAAC,+FAA+F,CACpG,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { createContext, useContext, type RefObject } from \"react\"\nimport type { LayoutEngine, LayoutNode } from \"../layout/index\"\nimport type { Gtk } from \"../gtkx/bridge/index\"\n\n// One per mounted container (Root or View): children register their layout\n// nodes here and commit rects into the store read by the parent's\n// RnGtkxLayout allocate().\nexport type HostNode = {\n engine: LayoutEngine\n node: LayoutNode\n widgetRef: RefObject<Gtk.Box | null>\n}\n\nexport const HostNodeContext = createContext<HostNode | null>(null)\n\n// Which widget content area the current subtree was handed to, when it was\n// handed to one. Set by wrapReactNative for every element-valued prop it\n// forwards AND for the widget's children (see ../common/widget), and read\n// ONLY to build the error below — the boundary clears the layout root, so\n// React Native content that lands inside a widget without bringing its own\n// root has to be told where it is, and what to wrap it in.\nexport type SlotLocation = {\n /** The widget this content was handed to, e.g. \"AdwBottomSheet\". */\n widget: string\n /** The slot property, e.g. \"sheet\" — or null for an ordinary child. */\n slot: string | null\n}\n\nexport const SlotContext = createContext<SlotLocation | null>(null)\n\nconst slotError = ({ widget, slot }: SlotLocation): string => {\n // The two shapes differ only in how you write the wrapper, so the message\n // shows the caller their own syntax rather than a generic one.\n const where = slot\n ? `${widget}'s \\`${slot}\\` slot`\n : `${widget}, as its child`\n const wrap = (root: string): string =>\n slot\n ? ` ${slot}={<${root}>…</${root}>}`\n : ` <${widget}>…</${widget}> → <${widget}><${root}>…</${root}></${widget}>`\n return (\n `react-native-gtkx: React Native content was put in ${where} without a layout root.\\n` +\n `A GTK widget hands out a rectangle, and React Native needs a root to lay out inside it. Wrap the content:\\n` +\n `${wrap(\"SlotContent\")} — fill the area (a page body, a pane, a content area)\\n` +\n `${wrap(\"IntrinsicContent\")} — size the area to the content (a bar, a header slot, a row)\\n` +\n // The subpath is named without quoting it as a specifier: the metro-preset\n // test scans src for bare imports with a regex, and an import-shaped\n // sentence in a string literal reads to it exactly like a real one.\n `Both are exported by react-native-gtkx/common. GTK widgets need neither — they are what a widget takes natively.`\n )\n}\n\nexport const useHostNode = (): HostNode => {\n const host = useContext(HostNodeContext)\n // One extra context read per layout child. Deliberate: it is what turns the\n // single most confusing failure on this platform — content silently laid\n // out against the wrong rectangle — into a sentence naming where it landed.\n const slot = useContext(SlotContext)\n if (host === null) {\n throw new Error(\n slot\n ? slotError(slot)\n : \"react-native-gtkx components must be rendered inside AppRegistry.runApplication() or a <Root>\",\n )\n }\n return host\n}\n"]}
@@ -1,8 +1,12 @@
1
+ import { type Ref } from "react";
1
2
  import type { StyleProp } from "../contracts";
3
+ import { type MeasureHandle } from "./measure";
2
4
  import { type LayoutEvent } from "./use-layout-child";
3
5
  export type ImageSource = {
4
6
  uri: string;
5
7
  } | string;
8
+ /** RN's imperative geometry methods, on an `Image` ref. */
9
+ export type ImageHandle = MeasureHandle;
6
10
  export type ImageProps = {
7
11
  source: ImageSource;
8
12
  style?: StyleProp;
@@ -15,5 +19,6 @@ export type ImageProps = {
15
19
  };
16
20
  }) => void;
17
21
  testID?: string;
22
+ ref?: Ref<ImageHandle>;
18
23
  };
19
- export declare const Image: ({ source, style, resizeMode, onLayout, onLoad, onError, testID, }: ImageProps) => React.JSX.Element;
24
+ export declare const Image: ({ source, style, resizeMode, onLayout, onLoad, onError, testID, ref, }: ImageProps) => React.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { existsSync } from "node:fs";
3
- import { useEffect, useRef } from "react";
4
- import { Gdk, Gtk, GtkPicture } from "../gtkx/bridge/index";
3
+ import { useEffect, useImperativeHandle, useLayoutEffect, useRef, } from "react";
4
+ import { Gdk, Gtk, GtkPicture, setPaintOnlyLeaf } from "../gtkx/bridge/index";
5
5
  import { isRemoteUri, loadRemoteImage } from "./image-loader";
6
+ import { createMeasureHandle } from "./measure";
6
7
  import { useLayoutChild } from "./use-layout-child";
7
8
  const CONTENT_FIT = {
8
9
  cover: Gtk.ContentFit.COVER,
@@ -20,9 +21,19 @@ const toPath = (source) => {
20
21
  // formats — e.g. ICO favicons), so onError is honest instead of showing
21
22
  // an empty picture. Sizing comes from the style (width/height or flex) —
22
23
  // like RN, which also cannot infer remote image sizes synchronously.
23
- export const Image = ({ source, style, resizeMode = "cover", onLayout, onLoad, onError, testID, }) => {
24
+ export const Image = ({ source, style, resizeMode = "cover", onLayout, onLoad, onError, testID, ref, }) => {
24
25
  const widgetRef = useRef(null);
25
- useLayoutChild(widgetRef, { style, onLayout });
26
+ const { node } = useLayoutChild(widgetRef, { style, onLayout });
27
+ useImperativeHandle(ref, () => createMeasureHandle(widgetRef, node), [node]);
28
+ // Paint-only for picking, exactly as `Text`'s label is: `Image` has no press
29
+ // prop, so a targetable GtkPicture only ever shadowed its own container —
30
+ // see the zIndex block in gtkx/bridge/view-box.ts.
31
+ useLayoutEffect(() => {
32
+ const picture = widgetRef.current;
33
+ if (picture) {
34
+ setPaintOnlyLeaf(picture);
35
+ }
36
+ }, []);
26
37
  const path = toPath(source);
27
38
  useEffect(() => {
28
39
  const widget = widgetRef.current;
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/components/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAA;AAcrE,MAAM,WAA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V,OAAO,CACL,KAAC,UAAU,IACT,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,GACnC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { existsSync } from \"node:fs\"\nimport { useEffect, useRef } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { Gdk, Gtk, GtkPicture } from \"../gtkx/bridge/index\"\nimport { isRemoteUri, loadRemoteImage } from \"./image-loader\"\nimport { useLayoutChild, type LayoutEvent } from \"./use-layout-child\"\n\nexport type ImageSource = { uri: string } | string\n\nexport type ImageProps = {\n source: ImageSource\n style?: StyleProp\n resizeMode?: \"cover\" | \"contain\" | \"stretch\" | \"center\"\n onLayout?: (event: LayoutEvent) => void\n onLoad?: () => void\n onError?: (error: { nativeEvent: { error: string } }) => void\n testID?: string\n}\n\nconst CONTENT_FIT = {\n cover: Gtk.ContentFit.COVER,\n contain: Gtk.ContentFit.CONTAIN,\n stretch: Gtk.ContentFit.FILL,\n center: Gtk.ContentFit.SCALE_DOWN,\n} as const\n\nconst toPath = (source: ImageSource): string => {\n const uri = typeof source === \"string\" ? source : source.uri\n return uri.startsWith(\"file://\") ? uri.slice(\"file://\".length) : uri\n}\n\n// Local files load synchronously; http(s) URIs download through the\n// on-disk cache (image-loader.ts) and set the picture when ready. The\n// texture is decoded explicitly (Gdk.Texture throws on unsupported\n// formats — e.g. ICO favicons), so onError is honest instead of showing\n// an empty picture. Sizing comes from the style (width/height or flex) —\n// like RN, which also cannot infer remote image sizes synchronously.\nexport const Image = ({\n source,\n style,\n resizeMode = \"cover\",\n onLayout,\n onLoad,\n onError,\n testID,\n}: ImageProps) => {\n const widgetRef = useRef<Gtk.Picture | null>(null)\n useLayoutChild(widgetRef, { style, onLayout })\n\n const path = toPath(source)\n\n useEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const show = (file: string): void => {\n const target = widgetRef.current\n if (!target) {\n return\n }\n try {\n // Decode explicitly: setFilename fails silently on formats the\n // texture loader does not support, newFromFilename throws.\n target.setPaintable(Gdk.Texture.newFromFilename(file))\n onLoad?.()\n } catch (error) {\n onError?.({ nativeEvent: { error: String(error) } })\n }\n }\n if (isRemoteUri(path)) {\n let cancelled = false\n loadRemoteImage(path).then(\n (file) => {\n // Unmount (or a source change) during the download must not touch\n // the widget or fire stale callbacks.\n if (!cancelled) {\n show(file)\n }\n },\n (error: unknown) => {\n if (!cancelled) {\n onError?.({ nativeEvent: { error: String(error) } })\n }\n },\n )\n return () => {\n cancelled = true\n }\n }\n if (!existsSync(path)) {\n onError?.({ nativeEvent: { error: `Image not found: ${path}` } })\n return\n }\n show(path)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [path])\n\n return (\n <GtkPicture\n ref={widgetRef}\n name={testID}\n contentFit={CONTENT_FIT[resizeMode]}\n />\n )\n}\n"]}
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/components/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,MAAM,GAEP,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,WAAW,CAAA;AACnE,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAA;AAoBrE,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK;IAC3B,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;IAC/B,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;IAC5B,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,UAAU;C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EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAoB,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;YACjE,OAAM;QACR,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,CAAA;QACV,uDAAuD;IACzD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,CACL,KAAC,UAAU,IACT,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,GACnC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { existsSync } from \"node:fs\"\nimport {\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n type Ref,\n} from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { Gdk, Gtk, GtkPicture, setPaintOnlyLeaf } from \"../gtkx/bridge/index\"\nimport { isRemoteUri, loadRemoteImage } from \"./image-loader\"\nimport { createMeasureHandle, type MeasureHandle } from \"./measure\"\nimport { useLayoutChild, type LayoutEvent } from \"./use-layout-child\"\n\nexport type ImageSource = { uri: string } | string\n\n/** RN's imperative geometry methods, on an `Image` ref. */\nexport type ImageHandle = MeasureHandle\n\nexport type ImageProps = {\n source: ImageSource\n style?: StyleProp\n resizeMode?: \"cover\" | \"contain\" | \"stretch\" | \"center\"\n onLayout?: (event: LayoutEvent) => void\n onLoad?: () => void\n onError?: (error: { nativeEvent: { error: string } }) => void\n testID?: string\n // The same handle every other host component exposes — RN parity, and the\n // seam `Animated.Image` reads its widget back through.\n ref?: Ref<ImageHandle>\n}\n\nconst CONTENT_FIT = {\n cover: Gtk.ContentFit.COVER,\n contain: Gtk.ContentFit.CONTAIN,\n stretch: Gtk.ContentFit.FILL,\n center: Gtk.ContentFit.SCALE_DOWN,\n} as const\n\nconst toPath = (source: ImageSource): string => {\n const uri = typeof source === \"string\" ? source : source.uri\n return uri.startsWith(\"file://\") ? uri.slice(\"file://\".length) : uri\n}\n\n// Local files load synchronously; http(s) URIs download through the\n// on-disk cache (image-loader.ts) and set the picture when ready. The\n// texture is decoded explicitly (Gdk.Texture throws on unsupported\n// formats — e.g. ICO favicons), so onError is honest instead of showing\n// an empty picture. Sizing comes from the style (width/height or flex) —\n// like RN, which also cannot infer remote image sizes synchronously.\nexport const Image = ({\n source,\n style,\n resizeMode = \"cover\",\n onLayout,\n onLoad,\n onError,\n testID,\n ref,\n}: ImageProps) => {\n const widgetRef = useRef<Gtk.Picture | null>(null)\n const { node } = useLayoutChild(widgetRef, { style, onLayout })\n\n useImperativeHandle(ref, () => createMeasureHandle(widgetRef, node), [node])\n\n // Paint-only for picking, exactly as `Text`'s label is: `Image` has no press\n // prop, so a targetable GtkPicture only ever shadowed its own container —\n // see the zIndex block in gtkx/bridge/view-box.ts.\n useLayoutEffect(() => {\n const picture = widgetRef.current\n if (picture) {\n setPaintOnlyLeaf(picture)\n }\n }, [])\n\n const path = toPath(source)\n\n useEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const show = (file: string): void => {\n const target = widgetRef.current\n if (!target) {\n return\n }\n try {\n // Decode explicitly: setFilename fails silently on formats the\n // texture loader does not support, newFromFilename throws.\n target.setPaintable(Gdk.Texture.newFromFilename(file))\n onLoad?.()\n } catch (error) {\n onError?.({ nativeEvent: { error: String(error) } })\n }\n }\n if (isRemoteUri(path)) {\n let cancelled = false\n loadRemoteImage(path).then(\n (file) => {\n // Unmount (or a source change) during the download must not touch\n // the widget or fire stale callbacks.\n if (!cancelled) {\n show(file)\n }\n },\n (error: unknown) => {\n if (!cancelled) {\n onError?.({ nativeEvent: { error: String(error) } })\n }\n },\n )\n return () => {\n cancelled = true\n }\n }\n if (!existsSync(path)) {\n onError?.({ nativeEvent: { error: `Image not found: ${path}` } })\n return\n }\n show(path)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [path])\n\n return (\n <GtkPicture\n ref={widgetRef}\n name={testID}\n contentFit={CONTENT_FIT[resizeMode]}\n />\n )\n}\n"]}
@@ -1,14 +1,20 @@
1
1
  export { ActivityIndicator, type ActivityIndicatorProps, } from "./activity-indicator";
2
- export { Animated, Easing, type AnimatedViewProps, type AnimatedViewStyle, } from "./animated";
2
+ export { Animated, createAnimatedComponent, Easing, type AnimatedComponent, type AnimatedComponentExtraProps, type AnimatedPropsProp, type AnimatedStyleProp, type AnimatedViewProps, type AnimatedViewStyle, } from "./animated";
3
3
  export { AppRegistry, type RunApplicationParams } from "./app-registry";
4
+ export { findNodeHandle } from "./find-node-handle";
4
5
  export { FlatList, SectionList, type FlatListProps, type ListRenderItemInfo, type SectionListData, type SectionListProps, type ViewabilityConfig, type ViewToken, } from "./flat-list";
5
- export { Image, type ImageProps, type ImageSource } from "./image";
6
+ export { Image, type ImageHandle, type ImageProps, type ImageSource, } from "./image";
6
7
  export { Modal, type ModalProps } from "./modal";
7
- export { Pressable, TouchableOpacity, type PressableProps, type PressableStateCallbackType, type PressEvent, type TouchableOpacityProps, } from "./pressable";
8
+ export { Pressable, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, type NativeTouch, type PressableProps, type PressableStateCallbackType, type PressEvent, type TouchableHighlightProps, type TouchableOpacityProps, type TouchableWithoutFeedbackProps, } from "./pressable";
8
9
  export { IntrinsicRoot, NestedRoot, Root, type IntrinsicRootProps, type NestedRootProps, type RootProps, } from "./root";
9
10
  export { ScrollView, type ScrollEvent, type ScrollViewHandle, type ScrollViewProps, } from "./scroll-view";
10
11
  export { Switch, type SwitchProps } from "./switch";
11
- export { Text, type TextProps } from "./text";
12
+ export { Text, type TextHandle, type TextProps } from "./text";
12
13
  export { TextInput, type TextInputProps } from "./text-input";
13
- export { SafeAreaView, StatusBar, View, type ViewProps } from "./view";
14
+ export { SafeAreaView, StatusBar, View, type ViewHandle, type ViewProps, } from "./view";
15
+ export type { MeasureHandle, MeasureInWindowOnSuccessCallback, MeasureLayoutOnSuccessCallback, MeasureOnSuccessCallback, NodeHandle, } from "./measure";
16
+ export { VirtualizedList, type ItemLayout, type VirtualizedListHandle, type VirtualizedListProps, } from "./virtualized-list";
14
17
  export { type LayoutEvent } from "./use-layout-child";
18
+ export { default as PanResponder } from "../vendor/react-native/pan-responder";
19
+ export type { PanResponderCallbacks, PanResponderGestureState, PanResponderInstance, } from "../vendor/react-native/pan-responder";
20
+ export type { GestureResponderEvent, ResponderProps, TouchHistory, TouchRecord, } from "../responder/types";
@@ -1,14 +1,17 @@
1
1
  export { ActivityIndicator, } from "./activity-indicator";
2
- export { Animated, Easing, } from "./animated";
2
+ export { Animated, createAnimatedComponent, Easing, } from "./animated";
3
3
  export { AppRegistry } from "./app-registry";
4
+ export { findNodeHandle } from "./find-node-handle";
4
5
  export { FlatList, SectionList, } from "./flat-list";
5
- export { Image } from "./image";
6
+ export { Image, } from "./image";
6
7
  export { Modal } from "./modal";
7
- export { Pressable, TouchableOpacity, } from "./pressable";
8
+ export { Pressable, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, } from "./pressable";
8
9
  export { IntrinsicRoot, NestedRoot, Root, } from "./root";
9
10
  export { ScrollView, } from "./scroll-view";
10
11
  export { Switch } from "./switch";
11
12
  export { Text } from "./text";
12
13
  export { TextInput } from "./text-input";
13
- export { SafeAreaView, StatusBar, View } from "./view";
14
+ export { SafeAreaView, StatusBar, View, } from "./view";
15
+ export { VirtualizedList, } from "./virtualized-list";
16
+ export { default as PanResponder } from "../vendor/react-native/pan-responder";
14
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,QAAQ,EACR,MAAM,GAGP,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAA6B,MAAM,gBAAgB,CAAA;AACvE,OAAO,EACL,QAAQ,EACR,WAAW,GAOZ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAqC,MAAM,SAAS,CAAA;AAClE,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAA;AAChD,OAAO,EACL,SAAS,EACT,gBAAgB,GAKjB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,aAAa,EACb,UAAU,EACV,IAAI,GAIL,MAAM,QAAQ,CAAA;AACf,OAAO,EACL,UAAU,GAIX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA","sourcesContent":["export {\n ActivityIndicator,\n type ActivityIndicatorProps,\n} from \"./activity-indicator\"\nexport {\n Animated,\n Easing,\n type AnimatedViewProps,\n type AnimatedViewStyle,\n} from \"./animated\"\nexport { AppRegistry, type RunApplicationParams } from \"./app-registry\"\nexport {\n FlatList,\n SectionList,\n type FlatListProps,\n type ListRenderItemInfo,\n type SectionListData,\n type SectionListProps,\n type ViewabilityConfig,\n type ViewToken,\n} from \"./flat-list\"\nexport { Image, type ImageProps, type ImageSource } from \"./image\"\nexport { Modal, type ModalProps } from \"./modal\"\nexport {\n Pressable,\n TouchableOpacity,\n type PressableProps,\n type PressableStateCallbackType,\n type PressEvent,\n type TouchableOpacityProps,\n} from \"./pressable\"\nexport {\n IntrinsicRoot,\n NestedRoot,\n Root,\n type IntrinsicRootProps,\n type NestedRootProps,\n type RootProps,\n} from \"./root\"\nexport {\n ScrollView,\n type ScrollEvent,\n type ScrollViewHandle,\n type ScrollViewProps,\n} from \"./scroll-view\"\nexport { Switch, type SwitchProps } from \"./switch\"\nexport { Text, type TextProps } from \"./text\"\nexport { TextInput, type TextInputProps } from \"./text-input\"\nexport { SafeAreaView, StatusBar, View, type ViewProps } from \"./view\"\nexport { type LayoutEvent } from \"./use-layout-child\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,QAAQ,EACR,uBAAuB,EACvB,MAAM,GAOP,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAA6B,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EACL,QAAQ,EACR,WAAW,GAOZ,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,GAIN,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAA;AAChD,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,GAQzB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,aAAa,EACb,UAAU,EACV,IAAI,GAIL,MAAM,QAAQ,CAAA;AACf,OAAO,EACL,UAAU,GAIX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,IAAI,EAAmC,MAAM,QAAQ,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAA;AAC7D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,IAAI,GAGL,MAAM,QAAQ,CAAA;AAQf,OAAO,EACL,eAAe,GAIhB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sCAAsC,CAAA","sourcesContent":["export {\n ActivityIndicator,\n type ActivityIndicatorProps,\n} from \"./activity-indicator\"\nexport {\n Animated,\n createAnimatedComponent,\n Easing,\n type AnimatedComponent,\n type AnimatedComponentExtraProps,\n type AnimatedPropsProp,\n type AnimatedStyleProp,\n type AnimatedViewProps,\n type AnimatedViewStyle,\n} from \"./animated\"\nexport { AppRegistry, type RunApplicationParams } from \"./app-registry\"\nexport { findNodeHandle } from \"./find-node-handle\"\nexport {\n FlatList,\n SectionList,\n type FlatListProps,\n type ListRenderItemInfo,\n type SectionListData,\n type SectionListProps,\n type ViewabilityConfig,\n type ViewToken,\n} from \"./flat-list\"\nexport {\n Image,\n type ImageHandle,\n type ImageProps,\n type ImageSource,\n} from \"./image\"\nexport { Modal, type ModalProps } from \"./modal\"\nexport {\n Pressable,\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n type NativeTouch,\n type PressableProps,\n type PressableStateCallbackType,\n type PressEvent,\n type TouchableHighlightProps,\n type TouchableOpacityProps,\n type TouchableWithoutFeedbackProps,\n} from \"./pressable\"\nexport {\n IntrinsicRoot,\n NestedRoot,\n Root,\n type IntrinsicRootProps,\n type NestedRootProps,\n type RootProps,\n} from \"./root\"\nexport {\n ScrollView,\n type ScrollEvent,\n type ScrollViewHandle,\n type ScrollViewProps,\n} from \"./scroll-view\"\nexport { Switch, type SwitchProps } from \"./switch\"\nexport { Text, type TextHandle, type TextProps } from \"./text\"\nexport { TextInput, type TextInputProps } from \"./text-input\"\nexport {\n SafeAreaView,\n StatusBar,\n View,\n type ViewHandle,\n type ViewProps,\n} from \"./view\"\nexport type {\n MeasureHandle,\n MeasureInWindowOnSuccessCallback,\n MeasureLayoutOnSuccessCallback,\n MeasureOnSuccessCallback,\n NodeHandle,\n} from \"./measure\"\nexport {\n VirtualizedList,\n type ItemLayout,\n type VirtualizedListHandle,\n type VirtualizedListProps,\n} from \"./virtualized-list\"\nexport { type LayoutEvent } from \"./use-layout-child\"\nexport { default as PanResponder } from \"../vendor/react-native/pan-responder\"\nexport type {\n PanResponderCallbacks,\n PanResponderGestureState,\n PanResponderInstance,\n} from \"../vendor/react-native/pan-responder\"\nexport type {\n GestureResponderEvent,\n ResponderProps,\n TouchHistory,\n TouchRecord,\n} from \"../responder/types\"\n"]}
@@ -0,0 +1,63 @@
1
+ import type { RefObject } from "react";
2
+ import type { LayoutNodeApi } from "../contracts";
3
+ import { type Gtk } from "../gtkx/bridge/index";
4
+ export type MeasureOnSuccessCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
5
+ export type MeasureInWindowOnSuccessCallback = (x: number, y: number, width: number, height: number) => void;
6
+ export type MeasureLayoutOnSuccessCallback = (left: number, top: number, width: number, height: number) => void;
7
+ /**
8
+ * RN's opaque reference to a mounted host view — what `findNodeHandle`
9
+ * returns and what `measureLayout` accepts as its first argument. A number,
10
+ * as it is on every RN platform: the value crosses no boundary here, but the
11
+ * libraries that ask for one compare it, store it in a map and hand it back,
12
+ * and an object would only be a different type wearing the same name.
13
+ */
14
+ export type NodeHandle = number;
15
+ /** The measurement half of a component ref, matching RN's method set. */
16
+ export type MeasureHandle = {
17
+ measure(callback: MeasureOnSuccessCallback): void;
18
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
19
+ measureLayout(relativeTo: MeasureHandle | NodeHandle, onSuccess: MeasureLayoutOnSuccessCallback, onFail?: () => void): void;
20
+ };
21
+ /**
22
+ * @internal Registers `handle` as standing for `widgetRef`'s widget.
23
+ *
24
+ * `createMeasureHandle` does this for the handles it builds; components that
25
+ * COMPOSE one into a larger handle (ScrollView adds `scrollTo`/`scrollToEnd`)
26
+ * create a new object, which is a new identity and therefore needs its own
27
+ * entry — otherwise `measureLayout(scrollViewRef, …)` silently fails.
28
+ */
29
+ export declare const registerHandleWidget: (handle: object, widgetRef: RefObject<Gtk.Widget | null>) => void;
30
+ /**
31
+ * @internal The `Gtk.Widget` behind a component handle, or null when the
32
+ * value is not a handle at all (a component that forwards no ref, or one
33
+ * whose ref is something else entirely).
34
+ *
35
+ * Deliberately not exported from the package: a portable API does not hand
36
+ * out widgets. This is how `createAnimatedComponent` reaches the widget it
37
+ * has to write opacity and transforms to.
38
+ */
39
+ export declare const widgetForHandle: (handle: unknown) => Gtk.Widget | null;
40
+ /**
41
+ * @internal Registers `handle` as standing for whatever widget `other`
42
+ * stands for.
43
+ *
44
+ * For a COMPOSITE that renders a host component and wants to be reachable as
45
+ * that host: a windowed list owns no widget of its own, but the ScrollView it
46
+ * renders is the thing another view measures against and the thing
47
+ * `findNodeHandle` should answer with. RN resolves a `FlatList`'s node handle
48
+ * through to its inner scroll view for the same reason.
49
+ *
50
+ * It deliberately does NOT give the composite `measure()`/`measureInWindow()`
51
+ * — see the note on `VirtualizedListHandle`. Being measurable AGAINST is a
52
+ * weaker claim than reporting your own geometry.
53
+ */
54
+ export declare const registerHandleAlias: (handle: object, other: () => unknown) => void;
55
+ /**
56
+ * @internal The tag standing for the widget behind `handle`, minted on first
57
+ * ask. Null when the value is not a component handle, or when its widget is
58
+ * not mounted — RN returns null in both cases too.
59
+ */
60
+ export declare const nodeHandleFor: (handle: unknown) => NodeHandle | null;
61
+ /** @internal The widget a tag was minted for, or null once it is gone. */
62
+ export declare const widgetForNodeHandle: (tag: NodeHandle) => Gtk.Widget | null;
63
+ export declare const createMeasureHandle: (widgetRef: RefObject<Gtk.Widget | null>, node: LayoutNodeApi) => MeasureHandle;
@@ -0,0 +1,150 @@
1
+ import { computePointIn, computePointInWindow, } from "../gtkx/bridge/index";
2
+ // measureLayout needs the OTHER view's widget, and the public handle type
3
+ // deliberately does not carry one — a portable API should not hand out a
4
+ // Gtk.Widget. The lookup lives here instead, keyed by the handle identity.
5
+ //
6
+ // It is also the seam every animated component reaches through: driving
7
+ // `opacity` and `transform` imperatively needs the widget behind a ref, and
8
+ // this map already holds exactly that association for every component that
9
+ // exposes a handle. Widening it beats adding a second, parallel registry.
10
+ const widgetOf = new WeakMap();
11
+ /**
12
+ * @internal Registers `handle` as standing for `widgetRef`'s widget.
13
+ *
14
+ * `createMeasureHandle` does this for the handles it builds; components that
15
+ * COMPOSE one into a larger handle (ScrollView adds `scrollTo`/`scrollToEnd`)
16
+ * create a new object, which is a new identity and therefore needs its own
17
+ * entry — otherwise `measureLayout(scrollViewRef, …)` silently fails.
18
+ */
19
+ export const registerHandleWidget = (handle, widgetRef) => {
20
+ widgetOf.set(handle, () => widgetRef.current);
21
+ };
22
+ /**
23
+ * @internal The `Gtk.Widget` behind a component handle, or null when the
24
+ * value is not a handle at all (a component that forwards no ref, or one
25
+ * whose ref is something else entirely).
26
+ *
27
+ * Deliberately not exported from the package: a portable API does not hand
28
+ * out widgets. This is how `createAnimatedComponent` reaches the widget it
29
+ * has to write opacity and transforms to.
30
+ */
31
+ export const widgetForHandle = (handle) => {
32
+ if (handle === null || typeof handle !== "object") {
33
+ return null;
34
+ }
35
+ return widgetOf.get(handle)?.() ?? null;
36
+ };
37
+ // --- node handles --------------------------------------------------------
38
+ //
39
+ // RN's `findNodeHandle` hands out an integer that stands for a mounted host
40
+ // VIEW. On a bridge platform the integer is the native view tag and the
41
+ // number is the only thing that can cross; here nothing has to cross, so the
42
+ // number is minted on demand and means exactly one thing — "the widget it
43
+ // was minted for".
44
+ //
45
+ // Keyed by the WIDGET rather than by the handle object, which is what makes
46
+ // it behave like RN's: two refs onto the same view report the same tag, and
47
+ // the tag survives a re-render that rebuilt the handle object. It is also why
48
+ // this is not a second registry — `widgetOf` above is still the only thing
49
+ // that knows what a handle stands for, and a tag is minted from its answer.
50
+ //
51
+ // A widget that is gone leaves a tag that resolves to null, which is what a
52
+ // stale RN tag does too.
53
+ const tagOfWidget = new WeakMap();
54
+ const widgetOfTag = new Map();
55
+ let nextTag = 1;
56
+ /**
57
+ * @internal Registers `handle` as standing for whatever widget `other`
58
+ * stands for.
59
+ *
60
+ * For a COMPOSITE that renders a host component and wants to be reachable as
61
+ * that host: a windowed list owns no widget of its own, but the ScrollView it
62
+ * renders is the thing another view measures against and the thing
63
+ * `findNodeHandle` should answer with. RN resolves a `FlatList`'s node handle
64
+ * through to its inner scroll view for the same reason.
65
+ *
66
+ * It deliberately does NOT give the composite `measure()`/`measureInWindow()`
67
+ * — see the note on `VirtualizedListHandle`. Being measurable AGAINST is a
68
+ * weaker claim than reporting your own geometry.
69
+ */
70
+ export const registerHandleAlias = (handle, other) => {
71
+ widgetOf.set(handle, () => widgetForHandle(other()));
72
+ };
73
+ /**
74
+ * @internal The tag standing for the widget behind `handle`, minted on first
75
+ * ask. Null when the value is not a component handle, or when its widget is
76
+ * not mounted — RN returns null in both cases too.
77
+ */
78
+ export const nodeHandleFor = (handle) => {
79
+ const widget = widgetForHandle(handle);
80
+ if (widget === null) {
81
+ return null;
82
+ }
83
+ const existing = tagOfWidget.get(widget);
84
+ if (existing !== undefined) {
85
+ return existing;
86
+ }
87
+ const tag = nextTag;
88
+ nextTag += 1;
89
+ tagOfWidget.set(widget, tag);
90
+ widgetOfTag.set(tag, new WeakRef(widget));
91
+ return tag;
92
+ };
93
+ /** @internal The widget a tag was minted for, or null once it is gone. */
94
+ export const widgetForNodeHandle = (tag) => {
95
+ const widget = widgetOfTag.get(tag)?.deref() ?? null;
96
+ if (widget === null) {
97
+ widgetOfTag.delete(tag);
98
+ }
99
+ return widget;
100
+ };
101
+ /** The widget behind either spelling of "that other view" that RN accepts. */
102
+ const widgetForTarget = (target) => typeof target === "number"
103
+ ? widgetForNodeHandle(target)
104
+ : widgetForHandle(target);
105
+ export const createMeasureHandle = (widgetRef, node) => {
106
+ const handle = {
107
+ measure(callback) {
108
+ const widget = widgetRef.current;
109
+ const rect = node.getRect();
110
+ if (!widget || !rect) {
111
+ return;
112
+ }
113
+ const page = computePointInWindow(widget, 0, 0);
114
+ if (!page) {
115
+ return;
116
+ }
117
+ callback(rect.x, rect.y, rect.width, rect.height, page.x, page.y);
118
+ },
119
+ measureInWindow(callback) {
120
+ const widget = widgetRef.current;
121
+ const rect = node.getRect();
122
+ if (!widget || !rect) {
123
+ return;
124
+ }
125
+ const page = computePointInWindow(widget, 0, 0);
126
+ if (!page) {
127
+ return;
128
+ }
129
+ callback(page.x, page.y, rect.width, rect.height);
130
+ },
131
+ measureLayout(relativeTo, onSuccess, onFail) {
132
+ const widget = widgetRef.current;
133
+ const other = widgetForTarget(relativeTo);
134
+ const rect = node.getRect();
135
+ if (!widget || !other || !rect) {
136
+ onFail?.();
137
+ return;
138
+ }
139
+ const origin = computePointIn(widget, other, 0, 0);
140
+ if (!origin) {
141
+ onFail?.();
142
+ return;
143
+ }
144
+ onSuccess(origin.x, origin.y, rect.width, rect.height);
145
+ },
146
+ };
147
+ registerHandleWidget(handle, widgetRef);
148
+ return handle;
149
+ };
150
+ //# sourceMappingURL=measure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../src/components/measure.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,cAAc,EACd,oBAAoB,GAErB,MAAM,sBAAsB,CAAA;AA6C7B,0EAA0E;AAC1E,yEAAyE;AACzE,2EAA2E;AAC3E,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAmC,CAAA;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAc,EACd,SAAuC,EACjC,EAAE;IACR,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAe,EAAqB,EAAE;IACpE,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,IAAI,CAAA;AACzC,CAAC,CAAA;AAED,4EAA4E;AAC5E,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,mBAAmB;AACnB,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,EAAE;A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AAC;YACD,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,CAAC;QAED,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM;YACzC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAA;YAChC,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;YACzC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;YAC3B,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;gBAC/B,MAAM,EAAE,EAAE,CAAA;gBACV,OAAM;YACR,CAAC;YACD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YAClD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,EAAE,EAAE,CAAA;gBACV,OAAM;YACR,CAAC;YACD,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACxD,CAAC;KACF,CAAA;IAED,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["// RN's imperative geometry API (measure / measureInWindow / measureLayout),\n// shared by every component that exposes a ref.\n//\n// The size and the parent-relative position come from the Yoga rect the\n// component's layout node already holds — that is the layout truth, and it\n// is what RN reports (a rotated view still measures its own box, not its\n// axis-aligned bounding box). Only the translation into another coordinate\n// space goes through GTK, where compute_point walks the transform chain and\n// therefore already accounts for scroll offsets.\n//\n// RN's contract on failure is to not call back rather than to invent a\n// number: a view whose layout has not been committed yet (before the first\n// onLayout) or that is not in a window has nothing true to report.\nimport type { RefObject } from \"react\"\nimport type { LayoutNodeApi } from \"../contracts\"\nimport {\n computePointIn,\n computePointInWindow,\n type Gtk,\n} from \"../gtkx/bridge/index\"\n\nexport type MeasureOnSuccessCallback = (\n x: number,\n y: number,\n width: number,\n height: number,\n pageX: number,\n pageY: number,\n) => void\n\nexport type MeasureInWindowOnSuccessCallback = (\n x: number,\n y: number,\n width: number,\n height: number,\n) => void\n\nexport type MeasureLayoutOnSuccessCallback = (\n left: number,\n top: number,\n width: number,\n height: number,\n) => void\n\n/**\n * RN's opaque reference to a mounted host view — what `findNodeHandle`\n * returns and what `measureLayout` accepts as its first argument. A number,\n * as it is on every RN platform: the value crosses no boundary here, but the\n * libraries that ask for one compare it, store it in a map and hand it back,\n * and an object would only be a different type wearing the same name.\n */\nexport type NodeHandle = number\n\n/** The measurement half of a component ref, matching RN's method set. */\nexport type MeasureHandle = {\n measure(callback: MeasureOnSuccessCallback): void\n measureInWindow(callback: MeasureInWindowOnSuccessCallback): void\n measureLayout(\n relativeTo: MeasureHandle | NodeHandle,\n onSuccess: MeasureLayoutOnSuccessCallback,\n onFail?: () => void,\n ): void\n}\n\n// measureLayout needs the OTHER view's widget, and the public handle type\n// deliberately does not carry one — a portable API should not hand out a\n// Gtk.Widget. The lookup lives here instead, keyed by the handle identity.\n//\n// It is also the seam every animated component reaches through: driving\n// `opacity` and `transform` imperatively needs the widget behind a ref, and\n// this map already holds exactly that association for every component that\n// exposes a handle. Widening it beats adding a second, parallel registry.\nconst widgetOf = new WeakMap<object, () => Gtk.Widget | null>()\n\n/**\n * @internal Registers `handle` as standing for `widgetRef`'s widget.\n *\n * `createMeasureHandle` does this for the handles it builds; components that\n * COMPOSE one into a larger handle (ScrollView adds `scrollTo`/`scrollToEnd`)\n * create a new object, which is a new identity and therefore needs its own\n * entry — otherwise `measureLayout(scrollViewRef, …)` silently fails.\n */\nexport const registerHandleWidget = (\n handle: object,\n widgetRef: RefObject<Gtk.Widget | null>,\n): void => {\n widgetOf.set(handle, () => widgetRef.current)\n}\n\n/**\n * @internal The `Gtk.Widget` behind a component handle, or null when the\n * value is not a handle at all (a component that forwards no ref, or one\n * whose ref is something else entirely).\n *\n * Deliberately not exported from the package: a portable API does not hand\n * out widgets. This is how `createAnimatedComponent` reaches the widget it\n * has to write opacity and transforms to.\n */\nexport const widgetForHandle = (handle: unknown): Gtk.Widget | null => {\n if (handle === null || typeof handle !== \"object\") {\n return null\n }\n return widgetOf.get(handle)?.() ?? null\n}\n\n// --- node handles --------------------------------------------------------\n//\n// RN's `findNodeHandle` hands out an integer that stands for a mounted host\n// VIEW. On a bridge platform the integer is the native view tag and the\n// number is the only thing that can cross; here nothing has to cross, so the\n// number is minted on demand and means exactly one thing — \"the widget it\n// was minted for\".\n//\n// Keyed by the WIDGET rather than by the handle object, which is what makes\n// it behave like RN's: two refs onto the same view report the same tag, and\n// the tag survives a re-render that rebuilt the handle object. It is also why\n// this is not a second registry — `widgetOf` above is still the only thing\n// that knows what a handle stands for, and a tag is minted from its answer.\n//\n// A widget that is gone leaves a tag that resolves to null, which is what a\n// stale RN tag does too.\nconst tagOfWidget = new WeakMap<Gtk.Widget, NodeHandle>()\nconst widgetOfTag = new Map<NodeHandle, WeakRef<Gtk.Widget>>()\nlet nextTag = 1\n\n/**\n * @internal Registers `handle` as standing for whatever widget `other`\n * stands for.\n *\n * For a COMPOSITE that renders a host component and wants to be reachable as\n * that host: a windowed list owns no widget of its own, but the ScrollView it\n * renders is the thing another view measures against and the thing\n * `findNodeHandle` should answer with. RN resolves a `FlatList`'s node handle\n * through to its inner scroll view for the same reason.\n *\n * It deliberately does NOT give the composite `measure()`/`measureInWindow()`\n * — see the note on `VirtualizedListHandle`. Being measurable AGAINST is a\n * weaker claim than reporting your own geometry.\n */\nexport const registerHandleAlias = (\n handle: object,\n other: () => unknown,\n): void => {\n widgetOf.set(handle, () => widgetForHandle(other()))\n}\n\n/**\n * @internal The tag standing for the widget behind `handle`, minted on first\n * ask. Null when the value is not a component handle, or when its widget is\n * not mounted — RN returns null in both cases too.\n */\nexport const nodeHandleFor = (handle: unknown): NodeHandle | null => {\n const widget = widgetForHandle(handle)\n if (widget === null) {\n return null\n }\n const existing = tagOfWidget.get(widget)\n if (existing !== undefined) {\n return existing\n }\n const tag = nextTag\n nextTag += 1\n tagOfWidget.set(widget, tag)\n widgetOfTag.set(tag, new WeakRef(widget))\n return tag\n}\n\n/** @internal The widget a tag was minted for, or null once it is gone. */\nexport const widgetForNodeHandle = (tag: NodeHandle): Gtk.Widget | null => {\n const widget = widgetOfTag.get(tag)?.deref() ?? null\n if (widget === null) {\n widgetOfTag.delete(tag)\n }\n return widget\n}\n\n/** The widget behind either spelling of \"that other view\" that RN accepts. */\nconst widgetForTarget = (\n target: MeasureHandle | NodeHandle,\n): Gtk.Widget | null =>\n typeof target === \"number\"\n ? widgetForNodeHandle(target)\n : widgetForHandle(target)\n\nexport const createMeasureHandle = (\n widgetRef: RefObject<Gtk.Widget | null>,\n node: LayoutNodeApi,\n): MeasureHandle => {\n const handle: MeasureHandle = {\n measure(callback) {\n const widget = widgetRef.current\n const rect = node.getRect()\n if (!widget || !rect) {\n return\n }\n const page = computePointInWindow(widget, 0, 0)\n if (!page) {\n return\n }\n callback(rect.x, rect.y, rect.width, rect.height, page.x, page.y)\n },\n\n measureInWindow(callback) {\n const widget = widgetRef.current\n const rect = node.getRect()\n if (!widget || !rect) {\n return\n }\n const page = computePointInWindow(widget, 0, 0)\n if (!page) {\n return\n }\n callback(page.x, page.y, rect.width, rect.height)\n },\n\n measureLayout(relativeTo, onSuccess, onFail) {\n const widget = widgetRef.current\n const other = widgetForTarget(relativeTo)\n const rect = node.getRect()\n if (!widget || !other || !rect) {\n onFail?.()\n return\n }\n const origin = computePointIn(widget, other, 0, 0)\n if (!origin) {\n onFail?.()\n return\n }\n onSuccess(origin.x, origin.y, rect.width, rect.height)\n },\n }\n\n registerHandleWidget(handle, widgetRef)\n return handle\n}\n"]}
@@ -9,4 +9,4 @@ export type ModalProps = {
9
9
  height?: number;
10
10
  children?: ReactNode;
11
11
  };
12
- export declare const Modal: ({ visible, onRequestClose, title, width, height, children, }: ModalProps) => ReactNode;
12
+ export declare const Modal: ({ visible, onRequestClose, title, width, height, children, }: ModalProps) => React.ReactPortal | null;
@@ -0,0 +1,28 @@
1
+ import type { Gtk } from "../gtkx/bridge/index";
2
+ /** One touch point, in RN's shape. */
3
+ export type NativeTouch = {
4
+ identifier: number;
5
+ target: number | null;
6
+ locationX: number;
7
+ locationY: number;
8
+ pageX: number;
9
+ pageY: number;
10
+ timestamp: number;
11
+ force: number;
12
+ };
13
+ export type PressEvent = {
14
+ nativeEvent: NativeTouch & {
15
+ touches: readonly NativeTouch[];
16
+ changedTouches: readonly NativeTouch[];
17
+ };
18
+ };
19
+ export declare const touchTimestamp: () => number;
20
+ /** A stable numeric id for a widget, standing in for RN's node handle. */
21
+ export declare const targetIdOf: (widget: object | null) => number | null;
22
+ /**
23
+ * Builds a touch from coordinates in the target widget's own space — which
24
+ * is what every GTK gesture reports.
25
+ */
26
+ export declare const createTouch: (widget: Gtk.Widget | null, locationX: number, locationY: number, identifier?: number) => NativeTouch;
27
+ /** Wraps a single touch as a complete RN press event. */
28
+ export declare const createPressEvent: (touch: NativeTouch) => PressEvent;
@@ -0,0 +1,46 @@
1
+ import { computePointInWindow } from "../gtkx/bridge/index";
2
+ // performance.now() is monotonic and sub-millisecond — see the note above.
3
+ export const touchTimestamp = () => performance.now();
4
+ let nextTargetId = 1;
5
+ const targetIds = new WeakMap();
6
+ /** A stable numeric id for a widget, standing in for RN's node handle. */
7
+ export const targetIdOf = (widget) => {
8
+ if (!widget) {
9
+ return null;
10
+ }
11
+ const existing = targetIds.get(widget);
12
+ if (existing !== undefined) {
13
+ return existing;
14
+ }
15
+ const id = nextTargetId;
16
+ nextTargetId += 1;
17
+ targetIds.set(widget, id);
18
+ return id;
19
+ };
20
+ /**
21
+ * Builds a touch from coordinates in the target widget's own space — which
22
+ * is what every GTK gesture reports.
23
+ */
24
+ export const createTouch = (widget, locationX, locationY, identifier = 0) => {
25
+ const page = widget
26
+ ? computePointInWindow(widget, locationX, locationY)
27
+ : null;
28
+ return {
29
+ identifier,
30
+ target: targetIdOf(widget),
31
+ locationX,
32
+ locationY,
33
+ // A widget outside a window has no page space; falling back to the
34
+ // local point keeps the fields numeric without pretending to a
35
+ // translation that does not exist.
36
+ pageX: page?.x ?? locationX,
37
+ pageY: page?.y ?? locationY,
38
+ timestamp: touchTimestamp(),
39
+ force: 0,
40
+ };
41
+ };
42
+ /** Wraps a single touch as a complete RN press event. */
43
+ export const createPressEvent = (touch) => ({
44
+ nativeEvent: { ...touch, touches: [touch], changedTouches: [touch] },
45
+ });
46
+ //# sourceMappingURL=press-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"press-event.js","sourceRoot":"","sources":["../../src/components/press-event.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AA+B3D,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,GAAW,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;AAE7D,IAAI,YAAY,GAAG,CAAC,CAAA;AACpB,MAAM,SAAS,GAAG,IAAI,OAAO,EAAkB,CAAA;AAE/C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAqB,EAAiB,EAAE;IACjE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,MAAM,EAAE,GAAG,YAAY,CAAA;IACvB,YAAY,IAAI,CAAC,CAAA;IACjB,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACzB,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAyB,EACzB,SAAiB,EACjB,SAAiB,EACjB,UAAU,GAAG,CAAC,EACD,EAAE;IACf,MAAM,IAAI,GAAG,MAAM;QACjB,CAAC,CAAC,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;QACpD,CAAC,CAAC,IAAI,CAAA;IACR,OAAO;QACL,UAAU;QACV,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;QAC1B,SAAS;QACT,SAAS;QACT,mEAAmE;QACnE,+DAA+D;QAC/D,mCAAmC;QACnC,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,SAAS;QAC3B,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,SAAS;QAC3B,SAAS,EAAE,cAAc,EAAE;QAC3B,KAAK,EAAE,CAAC;KACT,CAAA;AACH,CAAC,CAAA;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAkB,EAAc,EAAE,CAAC,CAAC;IACnE,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE;CACrE,CAAC,CAAA","sourcesContent":["// RN's touch payload. One shape, shared by Pressable today and by the touch\n// and responder props when they land — in RN a single native touch stream\n// feeds both, and splitting it here would guarantee the two drift.\n//\n// Two details that look cosmetic and are not:\n//\n// - `timestamp` must be monotonic and finer than a millisecond tick.\n// PanResponder and TouchHistoryMath compute velocity by differencing it,\n// so a coarse clock makes consecutive frames compare equal and silently\n// reports ZERO movement. That is the standing diagnosis for\n// react-native-windows' New-Architecture PanResponder bug (#14119, open\n// since 2024-11): Date.now() granularity, not a logic error.\n// - `pageX/pageY` and `locationX/locationY` are different spaces (window vs\n// target-relative) and code in the wild reads both. Reporting one twice\n// is the kind of bug that only shows up once something is nested.\nimport type { Gtk } from \"../gtkx/bridge/index\"\nimport { computePointInWindow } from \"../gtkx/bridge/index\"\n\n/** One touch point, in RN's shape. */\nexport type NativeTouch = {\n // A desktop pointer is a single fabricated touch: RN's own event plugin\n // has always had a mouse path, and react-native-web documents converting\n // mouse events into one emulated touch. Real multitouch will hand out the\n // GdkEventSequence's own identity here.\n identifier: number\n // Stable per-widget id; RN's is a React node handle, which we have no\n // equivalent of. Null before the widget exists.\n target: number | null\n // Relative to the target view.\n locationX: number\n locationY: number\n // Relative to the window (\"page\" in RN's vocabulary).\n pageX: number\n pageY: number\n timestamp: number\n // No pressure-sensitive input plumbed yet; RN reports 0 for devices\n // without it, which is exactly what a mouse is.\n force: number\n}\n\nexport type PressEvent = {\n nativeEvent: NativeTouch & {\n touches: readonly NativeTouch[]\n changedTouches: readonly NativeTouch[]\n }\n}\n\n// performance.now() is monotonic and sub-millisecond — see the note above.\nexport const touchTimestamp = (): number => performance.now()\n\nlet nextTargetId = 1\nconst targetIds = new WeakMap<object, number>()\n\n/** A stable numeric id for a widget, standing in for RN's node handle. */\nexport const targetIdOf = (widget: object | null): number | null => {\n if (!widget) {\n return null\n }\n const existing = targetIds.get(widget)\n if (existing !== undefined) {\n return existing\n }\n const id = nextTargetId\n nextTargetId += 1\n targetIds.set(widget, id)\n return id\n}\n\n/**\n * Builds a touch from coordinates in the target widget's own space — which\n * is what every GTK gesture reports.\n */\nexport const createTouch = (\n widget: Gtk.Widget | null,\n locationX: number,\n locationY: number,\n identifier = 0,\n): NativeTouch => {\n const page = widget\n ? computePointInWindow(widget, locationX, locationY)\n : null\n return {\n identifier,\n target: targetIdOf(widget),\n locationX,\n locationY,\n // A widget outside a window has no page space; falling back to the\n // local point keeps the fields numeric without pretending to a\n // translation that does not exist.\n pageX: page?.x ?? locationX,\n pageY: page?.y ?? locationY,\n timestamp: touchTimestamp(),\n force: 0,\n }\n}\n\n/** Wraps a single touch as a complete RN press event. */\nexport const createPressEvent = (touch: NativeTouch): PressEvent => ({\n nativeEvent: { ...touch, touches: [touch], changedTouches: [touch] },\n})\n"]}