react-native-gtkx 0.2.0-alpha.2 → 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 (340) hide show
  1. package/README.md +5 -2
  2. package/dist/aliases/index.d.ts +84 -0
  3. package/dist/aliases/index.js +208 -0
  4. package/dist/aliases/index.js.map +1 -0
  5. package/dist/animated/index.d.ts +2 -0
  6. package/dist/animated/index.js +5 -0
  7. package/dist/animated/index.js.map +1 -1
  8. package/dist/animated/types.d.ts +1 -0
  9. package/dist/animated/types.js.map +1 -1
  10. package/dist/animated/value-animation.js +17 -4
  11. package/dist/animated/value-animation.js.map +1 -1
  12. package/dist/apis/host.gtkx.js +9 -12
  13. package/dist/apis/host.gtkx.js.map +1 -1
  14. package/dist/apis/index.d.ts +4 -2
  15. package/dist/apis/index.js +2 -0
  16. package/dist/apis/index.js.map +1 -1
  17. package/dist/apis/keyboard.d.ts +60 -0
  18. package/dist/apis/keyboard.js +63 -0
  19. package/dist/apis/keyboard.js.map +1 -0
  20. package/dist/apis/log-box.d.ts +15 -0
  21. package/dist/apis/log-box.js +46 -0
  22. package/dist/apis/log-box.js.map +1 -0
  23. package/dist/apis/platform.d.ts +18 -1
  24. package/dist/apis/platform.js.map +1 -1
  25. package/dist/common/index.d.ts +0 -1
  26. package/dist/common/index.js +24 -1
  27. package/dist/common/index.js.map +1 -1
  28. package/dist/components/animated.d.ts +70 -6
  29. package/dist/components/animated.js +559 -46
  30. package/dist/components/animated.js.map +1 -1
  31. package/dist/components/driven-size.d.ts +27 -0
  32. package/dist/components/driven-size.js +85 -0
  33. package/dist/components/driven-size.js.map +1 -0
  34. package/dist/components/find-node-handle.d.ts +11 -0
  35. package/dist/components/find-node-handle.js +53 -0
  36. package/dist/components/find-node-handle.js.map +1 -0
  37. package/dist/components/flat-list.d.ts +3 -2
  38. package/dist/components/flat-list.js.map +1 -1
  39. package/dist/components/frame-scheduler.d.ts +16 -0
  40. package/dist/components/frame-scheduler.js +37 -0
  41. package/dist/components/frame-scheduler.js.map +1 -0
  42. package/dist/components/image.d.ts +6 -1
  43. package/dist/components/image.js +15 -4
  44. package/dist/components/image.js.map +1 -1
  45. package/dist/components/index.d.ts +7 -5
  46. package/dist/components/index.js +5 -3
  47. package/dist/components/index.js.map +1 -1
  48. package/dist/components/measure.d.ts +51 -1
  49. package/dist/components/measure.js +101 -2
  50. package/dist/components/measure.js.map +1 -1
  51. package/dist/components/pressable.d.ts +61 -1
  52. package/dist/components/pressable.js +151 -4
  53. package/dist/components/pressable.js.map +1 -1
  54. package/dist/components/rect-store.d.ts +58 -0
  55. package/dist/components/rect-store.js +124 -3
  56. package/dist/components/rect-store.js.map +1 -1
  57. package/dist/components/root.js +6 -1
  58. package/dist/components/root.js.map +1 -1
  59. package/dist/components/scroll-phase.d.ts +35 -0
  60. package/dist/components/scroll-phase.js +26 -0
  61. package/dist/components/scroll-phase.js.map +1 -0
  62. package/dist/components/scroll-view.d.ts +39 -3
  63. package/dist/components/scroll-view.js +378 -43
  64. package/dist/components/scroll-view.js.map +1 -1
  65. package/dist/components/text-input.js +9 -25
  66. package/dist/components/text-input.js.map +1 -1
  67. package/dist/components/text.d.ts +6 -2
  68. package/dist/components/text.js +43 -8
  69. package/dist/components/text.js.map +1 -1
  70. package/dist/components/use-focus.d.ts +27 -0
  71. package/dist/components/use-focus.js +116 -0
  72. package/dist/components/use-focus.js.map +1 -0
  73. package/dist/components/use-layout-child.d.ts +13 -1
  74. package/dist/components/use-layout-child.js +188 -5
  75. package/dist/components/use-layout-child.js.map +1 -1
  76. package/dist/components/view.d.ts +5 -2
  77. package/dist/components/view.js +18 -13
  78. package/dist/components/view.js.map +1 -1
  79. package/dist/components/virtualized-list.d.ts +45 -5
  80. package/dist/components/virtualized-list.js +90 -24
  81. package/dist/components/virtualized-list.js.map +1 -1
  82. package/dist/components/wheel-scroll-session.d.ts +7 -0
  83. package/dist/components/wheel-scroll-session.js +53 -0
  84. package/dist/components/wheel-scroll-session.js.map +1 -0
  85. package/dist/components/widget-retention.d.ts +35 -0
  86. package/dist/components/widget-retention.js +169 -0
  87. package/dist/components/widget-retention.js.map +1 -0
  88. package/dist/contracts.d.ts +4 -0
  89. package/dist/contracts.js.map +1 -1
  90. package/dist/dnd/context.d.ts +69 -0
  91. package/dist/dnd/context.js +149 -0
  92. package/dist/dnd/context.js.map +1 -0
  93. package/dist/dnd/draggable.d.ts +59 -0
  94. package/dist/dnd/draggable.js +149 -0
  95. package/dist/dnd/draggable.js.map +1 -0
  96. package/dist/dnd/droppable.d.ts +24 -0
  97. package/dist/dnd/droppable.js +74 -0
  98. package/dist/dnd/droppable.js.map +1 -0
  99. package/dist/dnd/gtk-controllers.d.ts +39 -0
  100. package/dist/dnd/gtk-controllers.js +110 -0
  101. package/dist/dnd/gtk-controllers.js.map +1 -0
  102. package/dist/dnd/index.d.ts +6 -0
  103. package/dist/dnd/index.js +31 -0
  104. package/dist/dnd/index.js.map +1 -0
  105. package/dist/dnd/order.d.ts +7 -0
  106. package/dist/dnd/order.js +20 -0
  107. package/dist/dnd/order.js.map +1 -0
  108. package/dist/dnd/payload.d.ts +14 -0
  109. package/dist/dnd/payload.js +41 -0
  110. package/dist/dnd/payload.js.map +1 -0
  111. package/dist/dnd/sortable.d.ts +49 -0
  112. package/dist/dnd/sortable.js +307 -0
  113. package/dist/dnd/sortable.js.map +1 -0
  114. package/dist/dnd/types.d.ts +290 -0
  115. package/dist/dnd/types.js +25 -0
  116. package/dist/dnd/types.js.map +1 -0
  117. package/dist/gesture-handler-compat/builder.d.ts +251 -0
  118. package/dist/gesture-handler-compat/builder.js +513 -0
  119. package/dist/gesture-handler-compat/builder.js.map +1 -0
  120. package/dist/gesture-handler-compat/composition.d.ts +23 -0
  121. package/dist/gesture-handler-compat/composition.js +111 -0
  122. package/dist/gesture-handler-compat/composition.js.map +1 -0
  123. package/dist/gesture-handler-compat/deciders.d.ts +3 -0
  124. package/dist/gesture-handler-compat/deciders.js +47 -0
  125. package/dist/gesture-handler-compat/deciders.js.map +1 -0
  126. package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
  127. package/dist/gesture-handler-compat/detector-runtime.js +374 -0
  128. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
  129. package/dist/gesture-handler-compat/detector.d.ts +22 -0
  130. package/dist/gesture-handler-compat/detector.js +104 -0
  131. package/dist/gesture-handler-compat/detector.js.map +1 -0
  132. package/dist/gesture-handler-compat/fling.d.ts +24 -0
  133. package/dist/gesture-handler-compat/fling.js +123 -0
  134. package/dist/gesture-handler-compat/fling.js.map +1 -0
  135. package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
  136. package/dist/gesture-handler-compat/force-touch.js +40 -0
  137. package/dist/gesture-handler-compat/force-touch.js.map +1 -0
  138. package/dist/gesture-handler-compat/hooks.d.ts +157 -0
  139. package/dist/gesture-handler-compat/hooks.js +268 -0
  140. package/dist/gesture-handler-compat/hooks.js.map +1 -0
  141. package/dist/gesture-handler-compat/hover.d.ts +2 -0
  142. package/dist/gesture-handler-compat/hover.js +22 -0
  143. package/dist/gesture-handler-compat/hover.js.map +1 -0
  144. package/dist/gesture-handler-compat/index.d.ts +98 -0
  145. package/dist/gesture-handler-compat/index.js +255 -0
  146. package/dist/gesture-handler-compat/index.js.map +1 -0
  147. package/dist/gesture-handler-compat/long-press.d.ts +6 -0
  148. package/dist/gesture-handler-compat/long-press.js +21 -0
  149. package/dist/gesture-handler-compat/long-press.js.map +1 -0
  150. package/dist/gesture-handler-compat/manual.d.ts +2 -0
  151. package/dist/gesture-handler-compat/manual.js +18 -0
  152. package/dist/gesture-handler-compat/manual.js.map +1 -0
  153. package/dist/gesture-handler-compat/native.d.ts +7 -0
  154. package/dist/gesture-handler-compat/native.js +34 -0
  155. package/dist/gesture-handler-compat/native.js.map +1 -0
  156. package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
  157. package/dist/gesture-handler-compat/orchestrator.js +284 -0
  158. package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
  159. package/dist/gesture-handler-compat/pan.d.ts +23 -0
  160. package/dist/gesture-handler-compat/pan.js +116 -0
  161. package/dist/gesture-handler-compat/pan.js.map +1 -0
  162. package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
  163. package/dist/gesture-handler-compat/recognizer.js +1056 -0
  164. package/dist/gesture-handler-compat/recognizer.js.map +1 -0
  165. package/dist/gesture-handler-compat/relations.d.ts +43 -0
  166. package/dist/gesture-handler-compat/relations.js +128 -0
  167. package/dist/gesture-handler-compat/relations.js.map +1 -0
  168. package/dist/gesture-handler-compat/tap.d.ts +6 -0
  169. package/dist/gesture-handler-compat/tap.js +29 -0
  170. package/dist/gesture-handler-compat/tap.js.map +1 -0
  171. package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
  172. package/dist/gesture-handler-compat/touchpad.js +64 -0
  173. package/dist/gesture-handler-compat/touchpad.js.map +1 -0
  174. package/dist/gesture-handler-compat/types.d.ts +441 -0
  175. package/dist/gesture-handler-compat/types.js +167 -0
  176. package/dist/gesture-handler-compat/types.js.map +1 -0
  177. package/dist/gtk/controllers.d.ts +39 -0
  178. package/dist/gtk/controllers.js +92 -0
  179. package/dist/gtk/controllers.js.map +1 -0
  180. package/dist/gtk/index.d.ts +2 -1
  181. package/dist/gtk/index.js +7 -1
  182. package/dist/gtk/index.js.map +1 -1
  183. package/dist/gtkx/bridge/geometry.js +6 -4
  184. package/dist/gtkx/bridge/geometry.js.map +1 -1
  185. package/dist/gtkx/bridge/index.d.ts +5 -3
  186. package/dist/gtkx/bridge/index.js +6 -3
  187. package/dist/gtkx/bridge/index.js.map +1 -1
  188. package/dist/gtkx/bridge/slot-portal.js.map +1 -1
  189. package/dist/gtkx/bridge/use-signal.js +1 -1
  190. package/dist/gtkx/bridge/use-signal.js.map +1 -1
  191. package/dist/gtkx/bridge/view-box.d.ts +56 -0
  192. package/dist/gtkx/bridge/view-box.js +394 -9
  193. package/dist/gtkx/bridge/view-box.js.map +1 -1
  194. package/dist/gtkx/bridge/widget-css.d.ts +17 -0
  195. package/dist/gtkx/bridge/widget-css.js +72 -0
  196. package/dist/gtkx/bridge/widget-css.js.map +1 -0
  197. package/dist/index.d.ts +3 -3
  198. package/dist/index.js +2 -2
  199. package/dist/index.js.map +1 -1
  200. package/dist/layout/driven-size.d.ts +12 -0
  201. package/dist/layout/driven-size.js +70 -0
  202. package/dist/layout/driven-size.js.map +1 -0
  203. package/dist/layout/engine.d.ts +17 -1
  204. package/dist/layout/engine.js +3 -20
  205. package/dist/layout/engine.js.map +1 -1
  206. package/dist/layout/node.d.ts +13 -0
  207. package/dist/layout/node.js +14 -0
  208. package/dist/layout/node.js.map +1 -1
  209. package/dist/layout/yoga.d.ts +3 -2
  210. package/dist/layout/yoga.js +5 -2
  211. package/dist/layout/yoga.js.map +1 -1
  212. package/dist/mcp/data/generated.d.ts +257 -60
  213. package/dist/mcp/data/generated.js +306 -62
  214. package/dist/mcp/data/generated.js.map +1 -1
  215. package/dist/metro/index.d.ts +10 -0
  216. package/dist/metro/index.js +21 -12
  217. package/dist/metro/index.js.map +1 -1
  218. package/dist/navigation/sidebar.d.ts +16 -0
  219. package/dist/navigation/sidebar.js +65 -1
  220. package/dist/navigation/sidebar.js.map +1 -1
  221. package/dist/reanimated-compat/animated-ref.d.ts +32 -0
  222. package/dist/reanimated-compat/animated-ref.js +57 -0
  223. package/dist/reanimated-compat/animated-ref.js.map +1 -0
  224. package/dist/reanimated-compat/animation.d.ts +177 -0
  225. package/dist/reanimated-compat/animation.js +540 -0
  226. package/dist/reanimated-compat/animation.js.map +1 -0
  227. package/dist/reanimated-compat/color.d.ts +28 -0
  228. package/dist/reanimated-compat/color.js +249 -0
  229. package/dist/reanimated-compat/color.js.map +1 -0
  230. package/dist/reanimated-compat/decay.d.ts +39 -0
  231. package/dist/reanimated-compat/decay.js +96 -0
  232. package/dist/reanimated-compat/decay.js.map +1 -0
  233. package/dist/reanimated-compat/easing.d.ts +30 -0
  234. package/dist/reanimated-compat/easing.js +76 -0
  235. package/dist/reanimated-compat/easing.js.map +1 -0
  236. package/dist/reanimated-compat/hooks.d.ts +14 -0
  237. package/dist/reanimated-compat/hooks.js +217 -0
  238. package/dist/reanimated-compat/hooks.js.map +1 -0
  239. package/dist/reanimated-compat/index.d.ts +258 -0
  240. package/dist/reanimated-compat/index.js +464 -0
  241. package/dist/reanimated-compat/index.js.map +1 -0
  242. package/dist/reanimated-compat/interpolation.d.ts +18 -0
  243. package/dist/reanimated-compat/interpolation.js +122 -0
  244. package/dist/reanimated-compat/interpolation.js.map +1 -0
  245. package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
  246. package/dist/reanimated-compat/layout-animation-config.js +78 -0
  247. package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
  248. package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
  249. package/dist/reanimated-compat/layout-animation-presets.js +498 -0
  250. package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
  251. package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
  252. package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
  253. package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
  254. package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
  255. package/dist/reanimated-compat/layout-animation-view.js +266 -0
  256. package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
  257. package/dist/reanimated-compat/layout-animation.d.ts +171 -0
  258. package/dist/reanimated-compat/layout-animation.js +469 -0
  259. package/dist/reanimated-compat/layout-animation.js.map +1 -0
  260. package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
  261. package/dist/reanimated-compat/layout-transitions.js +350 -0
  262. package/dist/reanimated-compat/layout-transitions.js.map +1 -0
  263. package/dist/reanimated-compat/mutable.d.ts +29 -0
  264. package/dist/reanimated-compat/mutable.js +139 -0
  265. package/dist/reanimated-compat/mutable.js.map +1 -0
  266. package/dist/reanimated-compat/props.d.ts +18 -0
  267. package/dist/reanimated-compat/props.js +111 -0
  268. package/dist/reanimated-compat/props.js.map +1 -0
  269. package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
  270. package/dist/reanimated-compat/scroll-handler.js +274 -0
  271. package/dist/reanimated-compat/scroll-handler.js.map +1 -0
  272. package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
  273. package/dist/reanimated-compat/scroll-offset.js +104 -0
  274. package/dist/reanimated-compat/scroll-offset.js.map +1 -0
  275. package/dist/reanimated-compat/style.d.ts +90 -0
  276. package/dist/reanimated-compat/style.js +452 -0
  277. package/dist/reanimated-compat/style.js.map +1 -0
  278. package/dist/reanimated-compat/test-timers.d.ts +28 -0
  279. package/dist/reanimated-compat/test-timers.js +136 -0
  280. package/dist/reanimated-compat/test-timers.js.map +1 -0
  281. package/dist/reanimated-compat/threads.d.ts +13 -0
  282. package/dist/reanimated-compat/threads.js +41 -0
  283. package/dist/reanimated-compat/threads.js.map +1 -0
  284. package/dist/reanimated-compat/tracking.d.ts +41 -0
  285. package/dist/reanimated-compat/tracking.js +106 -0
  286. package/dist/reanimated-compat/tracking.js.map +1 -0
  287. package/dist/reanimated-compat/updater-animations.d.ts +36 -0
  288. package/dist/reanimated-compat/updater-animations.js +273 -0
  289. package/dist/reanimated-compat/updater-animations.js.map +1 -0
  290. package/dist/responder/system.d.ts +80 -7
  291. package/dist/responder/system.js +143 -23
  292. package/dist/responder/system.js.map +1 -1
  293. package/dist/responder/use-responder.d.ts +11 -0
  294. package/dist/responder/use-responder.js +225 -6
  295. package/dist/responder/use-responder.js.map +1 -1
  296. package/dist/runner/host-dev.js +1 -1
  297. package/dist/runner/host-dev.js.map +1 -1
  298. package/dist/runner/host.js +1 -1
  299. package/dist/runner/host.js.map +1 -1
  300. package/dist/runner/index.js +3 -3
  301. package/dist/runner/index.js.map +1 -1
  302. package/dist/sea/gtkx-config-module.js +1 -1
  303. package/dist/sea/gtkx-config-module.js.map +1 -1
  304. package/dist/style/absolute-insets.d.ts +26 -0
  305. package/dist/style/absolute-insets.js +113 -0
  306. package/dist/style/absolute-insets.js.map +1 -0
  307. package/dist/style/animated-size.d.ts +25 -0
  308. package/dist/style/animated-size.js +225 -0
  309. package/dist/style/animated-size.js.map +1 -0
  310. package/dist/style/colors.d.ts +17 -0
  311. package/dist/style/colors.js +25 -6
  312. package/dist/style/colors.js.map +1 -1
  313. package/dist/style/imperative-css.d.ts +21 -0
  314. package/dist/style/imperative-css.js +63 -0
  315. package/dist/style/imperative-css.js.map +1 -0
  316. package/dist/style/index.d.ts +2 -1
  317. package/dist/style/index.js +2 -1
  318. package/dist/style/index.js.map +1 -1
  319. package/dist/style/split-style.js +5 -0
  320. package/dist/style/split-style.js.map +1 -1
  321. package/dist/testing/index.js.map +1 -1
  322. package/dist/unsupported-export.d.ts +8 -0
  323. package/dist/unsupported-export.js +66 -0
  324. package/dist/unsupported-export.js.map +1 -0
  325. package/dist/vite/index.d.ts +21 -8
  326. package/dist/vite/index.js +127 -82
  327. package/dist/vite/index.js.map +1 -1
  328. package/dist/vitest/index.d.ts +2 -2
  329. package/dist/vitest/index.js.map +1 -1
  330. package/dist/worklets-compat/index.d.ts +4 -0
  331. package/dist/worklets-compat/index.js +28 -0
  332. package/dist/worklets-compat/index.js.map +1 -0
  333. package/dist/worklets-compat/surface.d.ts +110 -0
  334. package/dist/worklets-compat/surface.js +153 -0
  335. package/dist/worklets-compat/surface.js.map +1 -0
  336. package/package.json +25 -9
  337. package/types.d.ts +9 -0
  338. package/dist/common/list.d.ts +0 -82
  339. package/dist/common/list.js +0 -166
  340. package/dist/common/list.js.map +0 -1
@@ -0,0 +1,39 @@
1
+ import { type ReactNode } from "react";
2
+ export type ControllersProps = {
3
+ /** `Gtk.EventController` elements — `GtkDragSource`, `GtkDropTarget`,
4
+ * `GtkShortcutController`, and anything else gtkx exposes as one. */
5
+ children?: ReactNode;
6
+ };
7
+ /**
8
+ * Attaches its children as event controllers on the widget of the enclosing
9
+ * React Native component.
10
+ *
11
+ * ```tsx
12
+ * // Controllers and GtkDragSource are both exported by this subpath.
13
+ * // (Not written as a real import line: the metro-preset test scans src for
14
+ * // bare imports with a regex, and an import-shaped sentence in a doc
15
+ * // comment reads to it exactly like a real one — see components/host-node.)
16
+ *
17
+ * <Pressable onPress={open}>
18
+ * <Controllers>
19
+ * <GtkDragSource actions={Gdk.DragAction.MOVE} onPrepare={…} />
20
+ * </Controllers>
21
+ * <Text>{task.title}</Text>
22
+ * </Pressable>
23
+ * ```
24
+ *
25
+ * It renders nothing where it sits: like `WindowControllers`, it is a
26
+ * portal in React's own sense, so the children keep the context, state and
27
+ * effects they would have at that position while the attachment lands on
28
+ * the widget. They are removed when this component unmounts.
29
+ *
30
+ * Works inside `View`, `Pressable`, `ScrollView`, `Animated.View` and
31
+ * `Root` — every component that owns a widget and hands it down. Inside a
32
+ * GTK widget's own slot there is no enclosing React Native component, and
33
+ * nothing is attached: pass `controllers={…}` to the widget itself there,
34
+ * which is the prop this exists to substitute for.
35
+ *
36
+ * **Linux-only, and the import says so.** Guard it with `Platform.OS` or
37
+ * split the file if the same screen also builds for iOS or Android.
38
+ */
39
+ export declare const Controllers: ({ children }: ControllersProps) => ReactNode;
@@ -0,0 +1,92 @@
1
+ // Attaching a GTK event controller to a component written in React Native.
2
+ //
3
+ // WHY this is a component in THIS subpath rather than a `controllers` prop
4
+ // on `View`. A `View`'s ref is a `ViewHandle` — measure/measureInWindow/
5
+ // measureLayout — and that is right: React Native's contract says nothing
6
+ // about widgets, and an app that reaches through the ref to a `Gtk.Widget`
7
+ // has pinned every internal of this platform as public API. But GTK carries
8
+ // real behaviour that no style and no RN prop expresses — drag-and-drop
9
+ // above all — and before this component there was simply no way to reach it
10
+ // from a row written in React Native (see
11
+ // docs/research/react-native-first-showcase.md, and `examples/tasks-nav`'s
12
+ // rows, which could not be rewritten because of it).
13
+ //
14
+ // A `controllers` prop on `View`/`Pressable` would have been three lines.
15
+ // It was rejected because it puts a GTK concept on the two components an
16
+ // app shares with iOS and Android, imported from the PORTABLE entry point:
17
+ // the file would still compile everywhere, the prop would be ignored off
18
+ // Linux, and the feature would vanish with no diagnostic. The import is the
19
+ // signal on this platform — `react-native-gtkx/gtk` is the line an app
20
+ // knows it is crossing — and a prop on `View` throws that signal away. An
21
+ // ELEMENT, by contrast, is something an RN developer already knows how to
22
+ // put behind a `Platform.OS` check or a `.linux.tsx` split, and its absence
23
+ // is visible in the tree.
24
+ //
25
+ // The shape is not new here: `WindowActions`/`WindowControllers` next door
26
+ // already mean "declare in the app tree, attach to the window". This means
27
+ // "declare in the app tree, attach to the enclosing view" — same portal,
28
+ // same mount/unmount lifecycle, one level down. Nothing was added to
29
+ // `View`, `Pressable`, `ScrollView` or `Animated.View` to make it work on
30
+ // all four: each already publishes its widget through HostNodeContext.
31
+ import { useContext, useEffect, useState } from "react";
32
+ import { HostNodeContext } from "../components/host-node";
33
+ import { createSlotPortal } from "../gtkx/bridge/index";
34
+ /**
35
+ * Attaches its children as event controllers on the widget of the enclosing
36
+ * React Native component.
37
+ *
38
+ * ```tsx
39
+ * // Controllers and GtkDragSource are both exported by this subpath.
40
+ * // (Not written as a real import line: the metro-preset test scans src for
41
+ * // bare imports with a regex, and an import-shaped sentence in a doc
42
+ * // comment reads to it exactly like a real one — see components/host-node.)
43
+ *
44
+ * <Pressable onPress={open}>
45
+ * <Controllers>
46
+ * <GtkDragSource actions={Gdk.DragAction.MOVE} onPrepare={…} />
47
+ * </Controllers>
48
+ * <Text>{task.title}</Text>
49
+ * </Pressable>
50
+ * ```
51
+ *
52
+ * It renders nothing where it sits: like `WindowControllers`, it is a
53
+ * portal in React's own sense, so the children keep the context, state and
54
+ * effects they would have at that position while the attachment lands on
55
+ * the widget. They are removed when this component unmounts.
56
+ *
57
+ * Works inside `View`, `Pressable`, `ScrollView`, `Animated.View` and
58
+ * `Root` — every component that owns a widget and hands it down. Inside a
59
+ * GTK widget's own slot there is no enclosing React Native component, and
60
+ * nothing is attached: pass `controllers={…}` to the widget itself there,
61
+ * which is the prop this exists to substitute for.
62
+ *
63
+ * **Linux-only, and the import says so.** Guard it with `Platform.OS` or
64
+ * split the file if the same screen also builds for iOS or Android.
65
+ */
66
+ export const Controllers = ({ children }) => {
67
+ const host = useContext(HostNodeContext);
68
+ // Captured in a PASSIVE effect, not a layout effect, and that is forced:
69
+ // React attaches host refs bottom-up, so the enclosing `<ViewBox
70
+ // ref={…}>`'s ref is still null while this child's layout effects run on
71
+ // the first mount. Passive effects run after the whole commit, by which
72
+ // time it is set. The cost is that controllers attach one commit late —
73
+ // unobservable for an event controller (no pointer reaches a widget in
74
+ // its first frame), and the same delay `WindowActions` already documents
75
+ // for the window.
76
+ //
77
+ // react-hooks/set-state-in-effect is disabled rather than worked around:
78
+ // the rule guards against effects that derive state from PROPS, which
79
+ // should be computed during render instead. This derives it from an
80
+ // imperative handle that does not exist until after the commit — the one
81
+ // case an effect is the only place it can come from. It runs once and
82
+ // settles (the setter bails on an unchanged value), so there is no
83
+ // cascade for the rule to be protecting against.
84
+ const [widget, setWidget] = useState(null);
85
+ // eslint-disable-next-line react-hooks/set-state-in-effect
86
+ useEffect(() => setWidget(host?.widgetRef.current ?? null), [host]);
87
+ if (widget === null) {
88
+ return null;
89
+ }
90
+ return createSlotPortal(children, widget, "controllers");
91
+ };
92
+ //# sourceMappingURL=controllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers.js","sourceRoot":"","sources":["../../src/gtk/controllers.tsx"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,0CAA0C;AAC1C,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,0BAA0B;AAC1B,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,uEAAuE;AACvE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAY,MAAM,sBAAsB,CAAA;AAQjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAoB,EAAa,EAAE;IACvE,MAAM,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACxC,yEAAyE;IACzE,iEAAiE;IACjE,yEAAyE;IACzE,wEAAwE;IACxE,wEAAwE;IACxE,uEAAuE;IACvE,yEAAyE;IACzE,kBAAkB;IAClB,EAAE;IACF,yEAAyE;IACzE,sEAAsE;IACtE,oEAAoE;IACpE,yEAAyE;IACzE,sEAAsE;IACtE,mEAAmE;IACnE,iDAAiD;IACjD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAA;IAC7D,2DAA2D;IAC3D,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEnE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;AAC1D,CAAC,CAAA","sourcesContent":["// Attaching a GTK event controller to a component written in React Native.\n//\n// WHY this is a component in THIS subpath rather than a `controllers` prop\n// on `View`. A `View`'s ref is a `ViewHandle` — measure/measureInWindow/\n// measureLayout — and that is right: React Native's contract says nothing\n// about widgets, and an app that reaches through the ref to a `Gtk.Widget`\n// has pinned every internal of this platform as public API. But GTK carries\n// real behaviour that no style and no RN prop expresses — drag-and-drop\n// above all — and before this component there was simply no way to reach it\n// from a row written in React Native (see\n// docs/research/react-native-first-showcase.md, and `examples/tasks-nav`'s\n// rows, which could not be rewritten because of it).\n//\n// A `controllers` prop on `View`/`Pressable` would have been three lines.\n// It was rejected because it puts a GTK concept on the two components an\n// app shares with iOS and Android, imported from the PORTABLE entry point:\n// the file would still compile everywhere, the prop would be ignored off\n// Linux, and the feature would vanish with no diagnostic. The import is the\n// signal on this platform — `react-native-gtkx/gtk` is the line an app\n// knows it is crossing — and a prop on `View` throws that signal away. An\n// ELEMENT, by contrast, is something an RN developer already knows how to\n// put behind a `Platform.OS` check or a `.linux.tsx` split, and its absence\n// is visible in the tree.\n//\n// The shape is not new here: `WindowActions`/`WindowControllers` next door\n// already mean \"declare in the app tree, attach to the window\". This means\n// \"declare in the app tree, attach to the enclosing view\" — same portal,\n// same mount/unmount lifecycle, one level down. Nothing was added to\n// `View`, `Pressable`, `ScrollView` or `Animated.View` to make it work on\n// all four: each already publishes its widget through HostNodeContext.\nimport { useContext, useEffect, useState, type ReactNode } from \"react\"\nimport { HostNodeContext } from \"../components/host-node\"\nimport { createSlotPortal, type Gtk } from \"../gtkx/bridge/index\"\n\nexport type ControllersProps = {\n /** `Gtk.EventController` elements — `GtkDragSource`, `GtkDropTarget`,\n * `GtkShortcutController`, and anything else gtkx exposes as one. */\n children?: ReactNode\n}\n\n/**\n * Attaches its children as event controllers on the widget of the enclosing\n * React Native component.\n *\n * ```tsx\n * // Controllers and GtkDragSource are both exported by this subpath.\n * // (Not written as a real import line: the metro-preset test scans src for\n * // bare imports with a regex, and an import-shaped sentence in a doc\n * // comment reads to it exactly like a real one — see components/host-node.)\n *\n * <Pressable onPress={open}>\n * <Controllers>\n * <GtkDragSource actions={Gdk.DragAction.MOVE} onPrepare={…} />\n * </Controllers>\n * <Text>{task.title}</Text>\n * </Pressable>\n * ```\n *\n * It renders nothing where it sits: like `WindowControllers`, it is a\n * portal in React's own sense, so the children keep the context, state and\n * effects they would have at that position while the attachment lands on\n * the widget. They are removed when this component unmounts.\n *\n * Works inside `View`, `Pressable`, `ScrollView`, `Animated.View` and\n * `Root` — every component that owns a widget and hands it down. Inside a\n * GTK widget's own slot there is no enclosing React Native component, and\n * nothing is attached: pass `controllers={…}` to the widget itself there,\n * which is the prop this exists to substitute for.\n *\n * **Linux-only, and the import says so.** Guard it with `Platform.OS` or\n * split the file if the same screen also builds for iOS or Android.\n */\nexport const Controllers = ({ children }: ControllersProps): ReactNode => {\n const host = useContext(HostNodeContext)\n // Captured in a PASSIVE effect, not a layout effect, and that is forced:\n // React attaches host refs bottom-up, so the enclosing `<ViewBox\n // ref={…}>`'s ref is still null while this child's layout effects run on\n // the first mount. Passive effects run after the whole commit, by which\n // time it is set. The cost is that controllers attach one commit late —\n // unobservable for an event controller (no pointer reaches a widget in\n // its first frame), and the same delay `WindowActions` already documents\n // for the window.\n //\n // react-hooks/set-state-in-effect is disabled rather than worked around:\n // the rule guards against effects that derive state from PROPS, which\n // should be computed during render instead. This derives it from an\n // imperative handle that does not exist until after the commit — the one\n // case an effect is the only place it can come from. It runs once and\n // settles (the setter bails on an unchanged value), so there is no\n // cascade for the rule to be protecting against.\n const [widget, setWidget] = useState<Gtk.Widget | null>(null)\n // eslint-disable-next-line react-hooks/set-state-in-effect\n useEffect(() => setWidget(host?.widgetRef.current ?? null), [host])\n\n if (widget === null) {\n return null\n }\n return createSlotPortal(children, widget, \"controllers\")\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  export * from "./widgets.generated";
2
2
  export { Gdk, Gio, GLib, GObject, Gtk, Pango } from "../gtkx/bridge/index";
3
- export { GMenu, GtkAdjustment, GtkDragSource, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "../gtkx/bridge/index";
3
+ export { GMenu, GtkAdjustment, GtkDragSource, GtkDropControllerMotion, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "../gtkx/bridge/index";
4
4
  export { ApplicationActions, GSimpleAction, WindowActions, WindowControllers, type ApplicationActionsProps, type GSimpleActionProps, type WindowActionsProps, type WindowControllersProps, } from "./window-actions";
5
+ export { Controllers, type ControllersProps } from "./controllers";
5
6
  export { useBindSetting, useSetting, type SettingsSchema, type SettingsSchemaKeys, type SettingValue, } from "../gtkx/bridge/index";
6
7
  export { css, cx, injectGlobal } from "../gtkx/bridge/index";
7
8
  export { quit, useApplication, useParentWindow } from "../gtkx/bridge/index";
package/dist/gtk/index.js CHANGED
@@ -14,7 +14,7 @@ export { Gdk, Gio, GLib, GObject, Gtk, Pango } from "../gtkx/bridge/index";
14
14
  // adjustment (the model objects `GtkTextView`/`GtkSpinRow`-style widgets
15
15
  // bind to), keyboard shortcuts, and the two drag-and-drop controllers. See
16
16
  // docs/platform-layer.md "Unwrapped by necessity".
17
- export { GMenu, GtkAdjustment, GtkDragSource, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "../gtkx/bridge/index";
17
+ export { GMenu, GtkAdjustment, GtkDragSource, GtkDropControllerMotion, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "../gtkx/bridge/index";
18
18
  // Window and application actions declared inside the app tree instead of
19
19
  // around it (the AppRegistry options they replace cannot see app context —
20
20
  // see window-actions.tsx). GSimpleAction comes from here rather than
@@ -22,6 +22,12 @@ export { GMenu, GtkAdjustment, GtkDragSource, GtkDropTarget, GtkShortcut, GtkSho
22
22
  // duplicate action names; on every other path it is gtkx's element,
23
23
  // unchanged.
24
24
  export { ApplicationActions, GSimpleAction, WindowActions, WindowControllers, } from "./window-actions";
25
+ // The same idea one level down: event controllers attached to the widget of
26
+ // the enclosing React Native component, so a row written in View/Pressable
27
+ // can still carry GTK drag-and-drop. The door onto GTK behaviour that no RN
28
+ // prop expresses — deliberately an element in THIS subpath rather than a
29
+ // prop on `View`, see controllers.tsx.
30
+ export { Controllers } from "./controllers";
25
31
  // GSettings: reads and writes backed by a compiled `.gschema.xml` schema.
26
32
  // `useSetting`/`useBindSetting` come straight from @gtkx/react; loading a
27
33
  // `.gschema.xml` file into the `SettingsSchema` object they expect is a
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gtk/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8DAA8D;AAC9D,yCAAyC;AACzC,0EAA0E;AAC1E,cAAc,qBAAqB,CAAA;AAEnC,4EAA4E;AAC5E,8EAA8E;AAC9E,mCAAmC;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE1E,oEAAoE;AACpE,0EAA0E;AAC1E,oEAAoE;AACpE,mEAAmE;AACnE,yEAAyE;AACzE,2EAA2E;AAC3E,mDAAmD;AACnD,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,yEAAyE;AACzE,2EAA2E;AAC3E,qEAAqE;AACrE,yEAAyE;AACzE,oEAAoE;AACpE,aAAa;AACb,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,iBAAiB,GAKlB,MAAM,kBAAkB,CAAA;AAEzB,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,mDAAmD;AACnD,OAAO,EACL,cAAc,EACd,UAAU,GAIX,MAAM,sBAAsB,CAAA;AAE7B,oEAAoE;AACpE,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,yEAAyE;AACzE,6DAA6D;AAC7D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,6DAA6D;AAC7D,yEAAyE;AACzE,mEAAmE;AACnE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA","sourcesContent":["// The full GTK widget surface lives in a generated file: every Gtk.Widget\n// subclass gtkx binds, wrapped so React Native drives it. See\n// scripts/generate-widget-surface.ts and\n// scripts/widget-surface/classification.json for how the list is derived.\nexport * from \"./widgets.generated\"\n\n// The GTK namespaces themselves, exported as values because they carry both\n// the enums you need at runtime — `hscrollbarPolicy={Gtk.PolicyType.NEVER}` —\n// and the types you need for refs.\nexport { Gdk, Gio, GLib, GObject, Gtk, Pango } from \"../gtkx/bridge/index\"\n\n// Auxiliary JSX elements that are not Gtk.Widget subclasses, so the\n// generated widget surface above never sees them — real building blocks a\n// non-trivial app still needs: actions and menus (Gio, used through\n// `Gtk.Application`/`Gtk.ApplicationWindow`), a text buffer and an\n// adjustment (the model objects `GtkTextView`/`GtkSpinRow`-style widgets\n// bind to), keyboard shortcuts, and the two drag-and-drop controllers. See\n// docs/platform-layer.md \"Unwrapped by necessity\".\nexport {\n GMenu,\n GtkAdjustment,\n GtkDragSource,\n GtkDropTarget,\n GtkShortcut,\n GtkShortcutController,\n GtkTextBuffer,\n} from \"../gtkx/bridge/index\"\n\n// Window and application actions declared inside the app tree instead of\n// around it (the AppRegistry options they replace cannot see app context —\n// see window-actions.tsx). GSimpleAction comes from here rather than\n// straight from the bridge because inside these components it arbitrates\n// duplicate action names; on every other path it is gtkx's element,\n// unchanged.\nexport {\n ApplicationActions,\n GSimpleAction,\n WindowActions,\n WindowControllers,\n type ApplicationActionsProps,\n type GSimpleActionProps,\n type WindowActionsProps,\n type WindowControllersProps,\n} from \"./window-actions\"\n\n// GSettings: reads and writes backed by a compiled `.gschema.xml` schema.\n// `useSetting`/`useBindSetting` come straight from @gtkx/react; loading a\n// `.gschema.xml` file into the `SettingsSchema` object they expect is a\n// build-time concern (see docs/platform-layer.md).\nexport {\n useBindSetting,\n useSetting,\n type SettingsSchema,\n type SettingsSchemaKeys,\n type SettingValue,\n} from \"../gtkx/bridge/index\"\n\n// @gtkx/css — a real GTK CSS class from a tagged template, the same\n// mechanism the style prop's visual half uses under the hood. Re-exported\n// here rather than left to a direct @gtkx/css dependency for the same\n// reason the namespaces above are: one subpath for the whole gtkx toolkit\n// surface, not just Gtk.Widget subclasses. `GObject` above is exported\n// mainly for `GObject.Value` — constructing a boxed value is required by\n// APIs like `Adw.Breakpoint.addSetter`, which reject a bare JS primitive\n// (see docs/platform-layer.md, \"Two ways to react to size\").\nexport { css, cx, injectGlobal } from \"../gtkx/bridge/index\"\n\n// The window and application AppRegistry itself sits on: useParentWindow\n// reaches the Gtk.Window ancestor (for anything not modeled by a prop —\n// e.g. binding a GSettings key to its own defaultWidth/defaultHeight),\n// useApplication reaches the Adw.Application (e.g. to send a\n// Gio.Notification), quit tears the whole app down programmatically (the\n// same function AppRegistry wires to a window's own close button).\nexport { quit, useApplication, useParentWindow } from \"../gtkx/bridge/index\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gtk/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8DAA8D;AAC9D,yCAAyC;AACzC,0EAA0E;AAC1E,cAAc,qBAAqB,CAAA;AAEnC,4EAA4E;AAC5E,8EAA8E;AAC9E,mCAAmC;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE1E,oEAAoE;AACpE,0EAA0E;AAC1E,oEAAoE;AACpE,mEAAmE;AACnE,yEAAyE;AACzE,2EAA2E;AAC3E,mDAAmD;AACnD,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,yEAAyE;AACzE,2EAA2E;AAC3E,qEAAqE;AACrE,yEAAyE;AACzE,oEAAoE;AACpE,aAAa;AACb,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,iBAAiB,GAKlB,MAAM,kBAAkB,CAAA;AAEzB,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,uCAAuC;AACvC,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAA;AAElE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,mDAAmD;AACnD,OAAO,EACL,cAAc,EACd,UAAU,GAIX,MAAM,sBAAsB,CAAA;AAE7B,oEAAoE;AACpE,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,yEAAyE;AACzE,6DAA6D;AAC7D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,6DAA6D;AAC7D,yEAAyE;AACzE,mEAAmE;AACnE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA","sourcesContent":["// The full GTK widget surface lives in a generated file: every Gtk.Widget\n// subclass gtkx binds, wrapped so React Native drives it. See\n// scripts/generate-widget-surface.ts and\n// scripts/widget-surface/classification.json for how the list is derived.\nexport * from \"./widgets.generated\"\n\n// The GTK namespaces themselves, exported as values because they carry both\n// the enums you need at runtime — `hscrollbarPolicy={Gtk.PolicyType.NEVER}` —\n// and the types you need for refs.\nexport { Gdk, Gio, GLib, GObject, Gtk, Pango } from \"../gtkx/bridge/index\"\n\n// Auxiliary JSX elements that are not Gtk.Widget subclasses, so the\n// generated widget surface above never sees them — real building blocks a\n// non-trivial app still needs: actions and menus (Gio, used through\n// `Gtk.Application`/`Gtk.ApplicationWindow`), a text buffer and an\n// adjustment (the model objects `GtkTextView`/`GtkSpinRow`-style widgets\n// bind to), keyboard shortcuts, and the two drag-and-drop controllers. See\n// docs/platform-layer.md \"Unwrapped by necessity\".\nexport {\n GMenu,\n GtkAdjustment,\n GtkDragSource,\n GtkDropControllerMotion,\n GtkDropTarget,\n GtkShortcut,\n GtkShortcutController,\n GtkTextBuffer,\n} from \"../gtkx/bridge/index\"\n\n// Window and application actions declared inside the app tree instead of\n// around it (the AppRegistry options they replace cannot see app context —\n// see window-actions.tsx). GSimpleAction comes from here rather than\n// straight from the bridge because inside these components it arbitrates\n// duplicate action names; on every other path it is gtkx's element,\n// unchanged.\nexport {\n ApplicationActions,\n GSimpleAction,\n WindowActions,\n WindowControllers,\n type ApplicationActionsProps,\n type GSimpleActionProps,\n type WindowActionsProps,\n type WindowControllersProps,\n} from \"./window-actions\"\n\n// The same idea one level down: event controllers attached to the widget of\n// the enclosing React Native component, so a row written in View/Pressable\n// can still carry GTK drag-and-drop. The door onto GTK behaviour that no RN\n// prop expresses — deliberately an element in THIS subpath rather than a\n// prop on `View`, see controllers.tsx.\nexport { Controllers, type ControllersProps } from \"./controllers\"\n\n// GSettings: reads and writes backed by a compiled `.gschema.xml` schema.\n// `useSetting`/`useBindSetting` come straight from @gtkx/react; loading a\n// `.gschema.xml` file into the `SettingsSchema` object they expect is a\n// build-time concern (see docs/platform-layer.md).\nexport {\n useBindSetting,\n useSetting,\n type SettingsSchema,\n type SettingsSchemaKeys,\n type SettingValue,\n} from \"../gtkx/bridge/index\"\n\n// @gtkx/css — a real GTK CSS class from a tagged template, the same\n// mechanism the style prop's visual half uses under the hood. Re-exported\n// here rather than left to a direct @gtkx/css dependency for the same\n// reason the namespaces above are: one subpath for the whole gtkx toolkit\n// surface, not just Gtk.Widget subclasses. `GObject` above is exported\n// mainly for `GObject.Value` — constructing a boxed value is required by\n// APIs like `Adw.Breakpoint.addSetter`, which reject a bare JS primitive\n// (see docs/platform-layer.md, \"Two ways to react to size\").\nexport { css, cx, injectGlobal } from \"../gtkx/bridge/index\"\n\n// The window and application AppRegistry itself sits on: useParentWindow\n// reaches the Gtk.Window ancestor (for anything not modeled by a prop —\n// e.g. binding a GSettings key to its own defaultWidth/defaultHeight),\n// useApplication reaches the Adw.Application (e.g. to send a\n// Gio.Notification), quit tears the whole app down programmatically (the\n// same function AppRegistry wires to a window's own close button).\nexport { quit, useApplication, useParentWindow } from \"../gtkx/bridge/index\"\n"]}
@@ -14,10 +14,12 @@
14
14
  // unrealized widget, a singular transform) — every helper here returns null
15
15
  // rather than a plausible-looking zero.
16
16
  import * as Graphene from "@gtkx/gi/graphene";
17
- // Graphene.Point's constructor takes plain scalars, so it does not hit the
18
- // nested-boxed-struct crash that Graphene.Rect's does (RC2-WORKAROUND
19
- // graphene-rect-nested-boxed-props, docs/gtkx-rc2-notes.md) but alloc+init
20
- // is the shape already proven in svg-node.ts, so use it here too.
17
+ // Graphene.Point's constructor takes plain scalars, so it never hit the
18
+ // nested-boxed-struct crash Graphene.Rect's did (the retired
19
+ // graphene-rect-nested-boxed-props workaround, fixed upstream in rc.3 by our
20
+ // gtkx-org/gtkx#473 see "Fixed in rc.3" in docs/gtkx-rc4-notes.md).
21
+ // alloc+init stays because it is the cheaper of the two here, not because
22
+ // the constructor is unsafe.
21
23
  const point = (x, y) => Graphene.Point.alloc().init(x, y);
22
24
  /**
23
25
  * Translates a point from `widget`'s coordinates into `target`'s.
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/geometry.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AACpE,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,wCAAwC;AACxC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAK7C,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,kEAAkE;AAClE,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAkB,EAAE,CACrD,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAkB,EAClB,MAAkB,EAClB,CAAS,EACT,CAAS,EACK,EAAE;IAChB,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACjE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAkB,EAClB,CAAS,EACT,CAAS,EACK,EAAE;IAChB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC,CAAA","sourcesContent":["// Widget geometry in foreign coordinate spaces — what RN's measure()/\n// measureInWindow()/measureLayout() and an event's pageX/pageY need.\n//\n// GTK4 folds a widget's allocated position into its transform relative to\n// its parent, so there is no globally meaningful x/y to read off a widget:\n// the position only exists as an answer to \"in whose coordinates?\".\n// gtk_widget_compute_point() walks that transform chain, which is also why\n// it comes out right inside a scrolled viewport — GtkViewport allocates its\n// child at -adjustment.value, so the scroll offset IS the child's transform.\n//\n// gtk_widget_translate_coordinates() and gtk_widget_get_allocation() do the\n// same job and are deprecated since GTK 4.12; compute_point/compute_bounds\n// are the replacements. Both can legitimately fail (no common ancestor, an\n// unrealized widget, a singular transform) — every helper here returns null\n// rather than a plausible-looking zero.\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport type * as Gtk from \"@gtkx/gi/gtk\"\n\nexport type Point = { x: number; y: number }\n\n// Graphene.Point's constructor takes plain scalars, so it does not hit the\n// nested-boxed-struct crash that Graphene.Rect's does (RC2-WORKAROUND\n// graphene-rect-nested-boxed-props, docs/gtkx-rc2-notes.md) — but alloc+init\n// is the shape already proven in svg-node.ts, so use it here too.\nconst point = (x: number, y: number): Graphene.Point =>\n Graphene.Point.alloc().init(x, y)\n\n/**\n * Translates a point from `widget`'s coordinates into `target`'s.\n * Returns null when the two are not in the same widget hierarchy.\n */\nexport const computePointIn = (\n widget: Gtk.Widget,\n target: Gtk.Widget,\n x: number,\n y: number,\n): Point | null => {\n const [ok, translated] = widget.computePoint(target, point(x, y))\n return ok ? { x: translated.x, y: translated.y } : null\n}\n\n/**\n * Translates a point from `widget`'s coordinates into its toplevel's — RN's\n * \"page\" space. Returns null for a widget that is not in a window yet.\n */\nexport const computePointInWindow = (\n widget: Gtk.Widget,\n x: number,\n y: number,\n): Point | null => {\n const root = widget.getRoot()\n return root ? computePointIn(widget, root, x, y) : null\n}\n"]}
1
+ {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/geometry.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AACpE,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,wCAAwC;AACxC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAK7C,wEAAwE;AACxE,6DAA6D;AAC7D,6EAA6E;AAC7E,sEAAsE;AACtE,0EAA0E;AAC1E,6BAA6B;AAC7B,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAkB,EAAE,CACrD,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAkB,EAClB,MAAkB,EAClB,CAAS,EACT,CAAS,EACK,EAAE;IAChB,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACjE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAkB,EAClB,CAAS,EACT,CAAS,EACK,EAAE;IAChB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC,CAAA","sourcesContent":["// Widget geometry in foreign coordinate spaces — what RN's measure()/\n// measureInWindow()/measureLayout() and an event's pageX/pageY need.\n//\n// GTK4 folds a widget's allocated position into its transform relative to\n// its parent, so there is no globally meaningful x/y to read off a widget:\n// the position only exists as an answer to \"in whose coordinates?\".\n// gtk_widget_compute_point() walks that transform chain, which is also why\n// it comes out right inside a scrolled viewport — GtkViewport allocates its\n// child at -adjustment.value, so the scroll offset IS the child's transform.\n//\n// gtk_widget_translate_coordinates() and gtk_widget_get_allocation() do the\n// same job and are deprecated since GTK 4.12; compute_point/compute_bounds\n// are the replacements. Both can legitimately fail (no common ancestor, an\n// unrealized widget, a singular transform) — every helper here returns null\n// rather than a plausible-looking zero.\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport type * as Gtk from \"@gtkx/gi/gtk\"\n\nexport type Point = { x: number; y: number }\n\n// Graphene.Point's constructor takes plain scalars, so it never hit the\n// nested-boxed-struct crash Graphene.Rect's did (the retired\n// graphene-rect-nested-boxed-props workaround, fixed upstream in rc.3 by our\n// gtkx-org/gtkx#473 — see \"Fixed in rc.3\" in docs/gtkx-rc4-notes.md).\n// alloc+init stays because it is the cheaper of the two here, not because\n// the constructor is unsafe.\nconst point = (x: number, y: number): Graphene.Point =>\n Graphene.Point.alloc().init(x, y)\n\n/**\n * Translates a point from `widget`'s coordinates into `target`'s.\n * Returns null when the two are not in the same widget hierarchy.\n */\nexport const computePointIn = (\n widget: Gtk.Widget,\n target: Gtk.Widget,\n x: number,\n y: number,\n): Point | null => {\n const [ok, translated] = widget.computePoint(target, point(x, y))\n return ok ? { x: translated.x, y: translated.y } : null\n}\n\n/**\n * Translates a point from `widget`'s coordinates into its toplevel's — RN's\n * \"page\" space. Returns null for a widget that is not in a window yet.\n */\nexport const computePointInWindow = (\n widget: Gtk.Widget,\n x: number,\n y: number,\n): Point | null => {\n const root = widget.getRoot()\n return root ? computePointIn(widget, root, x, y) : null\n}\n"]}
@@ -11,15 +11,17 @@ export { Adw, Gdk, Gio, GLib, GObject, Graphene, Gsk, Gtk, Pango };
11
11
  export { GtkApplication, GtkGestureClick } from "@gtkx/jsx/gtk";
12
12
  export { GMenu, GSimpleAction } from "@gtkx/jsx/gio";
13
13
  export { AdwBreakpoint, AdwShortcutsItem, AdwShortcutsSection, AdwToggle, } from "@gtkx/jsx/adw";
14
- export { GtkAdjustment, GtkDragSource, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "@gtkx/jsx/gtk";
14
+ export { GtkAdjustment, GtkDragSource, GtkDropControllerMotion, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "@gtkx/jsx/gtk";
15
15
  export * from "./widgets.generated";
16
- export { createPortal, createRoot, quit, rootElement, useApplication, useBindSetting, useParentWindow, useProperty, useSetting, type Root, type RootElement, type SettingsSchema, type SettingsSchemaKeys, type SettingValue, } from "@gtkx/react";
16
+ export { createPortal, createRoot, quit, rootElement, useApplication, useBindSetting, useParentWindow, useProperty, useSetting, type Root, type RootElement, } from "@gtkx/react";
17
+ export type { SettingsSchema, SettingsSchemaKeys, SettingValue, } from "@gtkx/react/internal";
17
18
  export { useSignal } from "./use-signal";
18
19
  export { css, cx, injectGlobal } from "@gtkx/css";
20
+ export { createWidgetCss, type WidgetCss } from "./widget-css";
19
21
  export { createTextProbe, measureWidget, toNumber } from "./measure";
20
22
  export { computePointIn, computePointInWindow, type Point } from "./geometry";
21
23
  export { createSlotPortal } from "./slot-portal";
22
- export { getViewBoxComponent, setBoxPassthrough } from "./view-box";
24
+ export { cacheChildOrder, getViewBoxComponent, invalidateZOrder, setBoxOnly, setBoxPassthrough, setHitSlop, setPaintOnlyLeaf, setPointerTarget, setZIndex, type HitSlop, } from "./view-box";
23
25
  export { getSvgNodeComponent, getSvgNodeDescriptor, queueSvgRedraw, resolveSvgColor, resolveSvgPaint, setSvgNodeDescriptor, type SvgDefsDescriptor, type SvgGradientUnits, type SvgGroupDescriptor, type SvgLinearGradientDescriptor, type SvgNodeDescriptor, type SvgPaintSpec, type SvgRadialGradientDescriptor, type SvgShapeDescriptor, type SvgStopDescriptor, type SvgSvgDescriptor, } from "./svg-node";
24
26
  export { allocateChild, attachRnLayout, detachRnLayout, queueAllocate, queueResize, type RnLayoutHooks, type RnLayoutOrientation, } from "./layout-manager";
25
27
  export { colorScheme, styleManager } from "./theme";
@@ -1,7 +1,7 @@
1
1
  // The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).
2
2
  // gtkx is an RC dependency: when its API moves, this bridge absorbs the change.
3
3
  //
4
- // Caveats baked into this surface (catalogued in docs/gtkx-rc3-notes.md):
4
+ // Caveats baked into this surface (catalogued in docs/gtkx-rc4-notes.md):
5
5
  // - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary
6
6
  // import-then-export (not `export * as`): the latter is the one syntax the
7
7
  // stock @react-native/babel-preset cannot transform — this form keeps
@@ -44,7 +44,7 @@ export { GtkApplication, GtkGestureClick } from "@gtkx/jsx/gtk";
44
44
  // docs/platform-layer.md, "Two ways to react to size").
45
45
  export { GMenu, GSimpleAction } from "@gtkx/jsx/gio";
46
46
  export { AdwBreakpoint, AdwShortcutsItem, AdwShortcutsSection, AdwToggle, } from "@gtkx/jsx/adw";
47
- export { GtkAdjustment, GtkDragSource, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "@gtkx/jsx/gtk";
47
+ export { GtkAdjustment, GtkDragSource, GtkDropControllerMotion, GtkDropTarget, GtkShortcut, GtkShortcutController, GtkTextBuffer, } from "@gtkx/jsx/gtk";
48
48
  // The full widget surface — every GTK/Adwaita class gtkx binds that derives
49
49
  // Gtk.Widget, raw. src/gtk/widgets.generated and src/adw/widgets.generated
50
50
  // wrap most of them with wrapReactNative; this file is where @gtkx/jsx is
@@ -57,13 +57,16 @@ export { createPortal, createRoot, quit, rootElement, useApplication, useBindSet
57
57
  // there (rc.3 delivers a stale handler).
58
58
  export { useSignal } from "./use-signal";
59
59
  export { css, cx, injectGlobal } from "@gtkx/css";
60
+ // The imperative counterpart of `css`: a private provider on one widget,
61
+ // for values that change per frame and must not enter the shared stylesheet.
62
+ export { createWidgetCss } from "./widget-css";
60
63
  export { createTextProbe, measureWidget, toNumber } from "./measure";
61
64
  export { computePointIn, computePointInWindow } from "./geometry";
62
65
  // A portal into a NAMED slot of a remote object (the window's action map,
63
66
  // its controllers) rather than into its default child slot — see the file
64
67
  // for why gtkx's own createPortal is not enough on its own.
65
68
  export { createSlotPortal } from "./slot-portal";
66
- export { getViewBoxComponent, setBoxPassthrough } from "./view-box";
69
+ export { cacheChildOrder, getViewBoxComponent, invalidateZOrder, setBoxOnly, setBoxPassthrough, setHitSlop, setPaintOnlyLeaf, setPointerTarget, setZIndex, } from "./view-box";
67
70
  export { getSvgNodeComponent, getSvgNodeDescriptor, queueSvgRedraw, resolveSvgColor, resolveSvgPaint, setSvgNodeDescriptor, } from "./svg-node";
68
71
  export { allocateChild, attachRnLayout, detachRnLayout, queueAllocate, queueResize, } from "./layout-manager";
69
72
  export { colorScheme, styleManager } from "./theme";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,oFAAoF;AAEpF,2EAA2E;AAC3E,sEAAsE;AACtE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAElE,uEAAuE;AACvE,2EAA2E;AAC3E,2EAA2E;AAC3E,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/D,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,qEAAqE;AACrE,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,iCAAiC;AACjC,EAAE;AACF,sDAAsD;AACtD,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,+DAA+D;AAC/D,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,GACV,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,6BAA6B;AAC7B,cAAc,qBAAqB,CAAA;AAEnC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,GAMX,MAAM,aAAa,CAAA;AAEpB,+EAA+E;AAC/E,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAc,MAAM,YAAY,CAAA;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,eAAe,EACf,oBAAoB,GAWrB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).\n// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.\n//\n// Caveats baked into this surface (catalogued in docs/gtkx-rc3-notes.md):\n// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary\n\n// import-then-export (not `export * as`): the latter is the one syntax the\n// stock @react-native/babel-preset cannot transform — this form keeps\n// consumer apps on their unmodified RN Babel config.\nimport * as Adw from \"@gtkx/gi/adw\"\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Gio from \"@gtkx/gi/gio\"\nimport * as GLib from \"@gtkx/gi/glib\"\nimport * as GObject from \"@gtkx/gi/gobject\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport * as Pango from \"@gtkx/gi/pango\"\n\nexport { Adw, Gdk, Gio, GLib, GObject, Graphene, Gsk, Gtk, Pango }\n\n// GtkApplication and GtkGestureClick are not Gtk.Widget subclasses (an\n// application object and an event controller, respectively), so the widget\n// surface generator never sees them — kept here by hand, same as before it\n// existed.\nexport { GtkApplication, GtkGestureClick } from \"@gtkx/jsx/gtk\"\n\n// Auxiliary gtkx JSX elements that are not Gtk.Widget/Adw.Widget subclasses\n// either, same reason as the pair above — scripts/generate-widget-surface.ts\n// only classifies widgets, so these fall into its \"notAWidget\" bucket\n// (see scripts/widget-surface/classification.json) and are otherwise\n// unreachable through react-native-gtkx/gtk or /adw. Every one of these is a\n// real, necessary building block for a real app: actions and menus (Gio),\n// a responsive breakpoint (Adw), a text buffer and an adjustment (the model\n// objects GtkTextView/GtkSpinRow etc. bind to), keyboard shortcuts, and the\n// two drag-and-drop controllers.\n//\n// Adw.Breakpoint specifically: independently verified\n// (`Adw.Breakpoint.prototype instanceof Gtk.Widget === false`, prototype\n// chain bottoms out at plain GObject.Object) — it draws nothing and has no\n// size, it is a declaration (a condition plus a set of property setters)\n// attached to a Window/ApplicationWindow/Dialog/BreakpointBin. Running it\n// through wrapReactNative would give it a Yoga node for a widget that\n// occupies no space: a layout bug, not a convenience. Adw.BreakpointBin (a\n// real widget, the container that scopes breakpoints to a subtree) is\n// wrapped normally in ./widgets.generated instead, and is what\n// createSidebarNavigator's own collapse pairs AdwBreakpoint with (see\n// docs/platform-layer.md, \"Two ways to react to size\").\nexport { GMenu, GSimpleAction } from \"@gtkx/jsx/gio\"\nexport {\n AdwBreakpoint,\n AdwShortcutsItem,\n AdwShortcutsSection,\n AdwToggle,\n} from \"@gtkx/jsx/adw\"\nexport {\n GtkAdjustment,\n GtkDragSource,\n GtkDropTarget,\n GtkShortcut,\n GtkShortcutController,\n GtkTextBuffer,\n} from \"@gtkx/jsx/gtk\"\n\n// The full widget surface — every GTK/Adwaita class gtkx binds that derives\n// Gtk.Widget, raw. src/gtk/widgets.generated and src/adw/widgets.generated\n// wrap most of them with wrapReactNative; this file is where @gtkx/jsx is\n// still allowed to be imported directly (see the eslint carve-out for\n// src/gtkx/bridge/**), so they pull the raw widgets from here rather than\n// from @gtkx/jsx themselves.\nexport * from \"./widgets.generated\"\n\nexport {\n createPortal,\n createRoot,\n quit,\n rootElement,\n useApplication,\n useBindSetting,\n useParentWindow,\n useProperty,\n useSetting,\n type Root,\n type RootElement,\n type SettingsSchema,\n type SettingsSchemaKeys,\n type SettingValue,\n} from \"@gtkx/react\"\n\n// useSignal comes from ./use-signal, not @gtkx/react — see the workaround note\n// there (rc.3 delivers a stale handler).\nexport { useSignal } from \"./use-signal\"\n\nexport { css, cx, injectGlobal } from \"@gtkx/css\"\n\nexport { createTextProbe, measureWidget, toNumber } from \"./measure\"\nexport { computePointIn, computePointInWindow, type Point } from \"./geometry\"\n// A portal into a NAMED slot of a remote object (the window's action map,\n// its controllers) rather than into its default child slot — see the file\n// for why gtkx's own createPortal is not enough on its own.\nexport { createSlotPortal } from \"./slot-portal\"\nexport { getViewBoxComponent, setBoxPassthrough } from \"./view-box\"\nexport {\n getSvgNodeComponent,\n getSvgNodeDescriptor,\n queueSvgRedraw,\n resolveSvgColor,\n resolveSvgPaint,\n setSvgNodeDescriptor,\n type SvgDefsDescriptor,\n type SvgGradientUnits,\n type SvgGroupDescriptor,\n type SvgLinearGradientDescriptor,\n type SvgNodeDescriptor,\n type SvgPaintSpec,\n type SvgRadialGradientDescriptor,\n type SvgShapeDescriptor,\n type SvgStopDescriptor,\n type SvgSvgDescriptor,\n} from \"./svg-node\"\nexport {\n allocateChild,\n attachRnLayout,\n detachRnLayout,\n queueAllocate,\n queueResize,\n type RnLayoutHooks,\n type RnLayoutOrientation,\n} from \"./layout-manager\"\nexport { colorScheme, styleManager } from \"./theme\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,oFAAoF;AAEpF,2EAA2E;AAC3E,sEAAsE;AACtE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAElE,uEAAuE;AACvE,2EAA2E;AAC3E,2EAA2E;AAC3E,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/D,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,qEAAqE;AACrE,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,iCAAiC;AACjC,EAAE;AACF,sDAAsD;AACtD,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,+DAA+D;AAC/D,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,GACV,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,6BAA6B;AAC7B,cAAc,qBAAqB,CAAA;AAEnC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,GAGX,MAAM,aAAa,CAAA;AAcpB,+EAA+E;AAC/E,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,yEAAyE;AACzE,6EAA6E;AAC7E,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAc,MAAM,YAAY,CAAA;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,GAEV,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,eAAe,EACf,oBAAoB,GAWrB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).\n// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.\n//\n// Caveats baked into this surface (catalogued in docs/gtkx-rc4-notes.md):\n// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary\n\n// import-then-export (not `export * as`): the latter is the one syntax the\n// stock @react-native/babel-preset cannot transform — this form keeps\n// consumer apps on their unmodified RN Babel config.\nimport * as Adw from \"@gtkx/gi/adw\"\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Gio from \"@gtkx/gi/gio\"\nimport * as GLib from \"@gtkx/gi/glib\"\nimport * as GObject from \"@gtkx/gi/gobject\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport * as Pango from \"@gtkx/gi/pango\"\n\nexport { Adw, Gdk, Gio, GLib, GObject, Graphene, Gsk, Gtk, Pango }\n\n// GtkApplication and GtkGestureClick are not Gtk.Widget subclasses (an\n// application object and an event controller, respectively), so the widget\n// surface generator never sees them — kept here by hand, same as before it\n// existed.\nexport { GtkApplication, GtkGestureClick } from \"@gtkx/jsx/gtk\"\n\n// Auxiliary gtkx JSX elements that are not Gtk.Widget/Adw.Widget subclasses\n// either, same reason as the pair above — scripts/generate-widget-surface.ts\n// only classifies widgets, so these fall into its \"notAWidget\" bucket\n// (see scripts/widget-surface/classification.json) and are otherwise\n// unreachable through react-native-gtkx/gtk or /adw. Every one of these is a\n// real, necessary building block for a real app: actions and menus (Gio),\n// a responsive breakpoint (Adw), a text buffer and an adjustment (the model\n// objects GtkTextView/GtkSpinRow etc. bind to), keyboard shortcuts, and the\n// two drag-and-drop controllers.\n//\n// Adw.Breakpoint specifically: independently verified\n// (`Adw.Breakpoint.prototype instanceof Gtk.Widget === false`, prototype\n// chain bottoms out at plain GObject.Object) — it draws nothing and has no\n// size, it is a declaration (a condition plus a set of property setters)\n// attached to a Window/ApplicationWindow/Dialog/BreakpointBin. Running it\n// through wrapReactNative would give it a Yoga node for a widget that\n// occupies no space: a layout bug, not a convenience. Adw.BreakpointBin (a\n// real widget, the container that scopes breakpoints to a subtree) is\n// wrapped normally in ./widgets.generated instead, and is what\n// createSidebarNavigator's own collapse pairs AdwBreakpoint with (see\n// docs/platform-layer.md, \"Two ways to react to size\").\nexport { GMenu, GSimpleAction } from \"@gtkx/jsx/gio\"\nexport {\n AdwBreakpoint,\n AdwShortcutsItem,\n AdwShortcutsSection,\n AdwToggle,\n} from \"@gtkx/jsx/adw\"\nexport {\n GtkAdjustment,\n GtkDragSource,\n GtkDropControllerMotion,\n GtkDropTarget,\n GtkShortcut,\n GtkShortcutController,\n GtkTextBuffer,\n} from \"@gtkx/jsx/gtk\"\n\n// The full widget surface — every GTK/Adwaita class gtkx binds that derives\n// Gtk.Widget, raw. src/gtk/widgets.generated and src/adw/widgets.generated\n// wrap most of them with wrapReactNative; this file is where @gtkx/jsx is\n// still allowed to be imported directly (see the eslint carve-out for\n// src/gtkx/bridge/**), so they pull the raw widgets from here rather than\n// from @gtkx/jsx themselves.\nexport * from \"./widgets.generated\"\n\nexport {\n createPortal,\n createRoot,\n quit,\n rootElement,\n useApplication,\n useBindSetting,\n useParentWindow,\n useProperty,\n useSetting,\n type Root,\n type RootElement,\n} from \"@gtkx/react\"\n\n// rc.4 moved the settings-schema types off the public entry point into\n// /internal, with no replacement on `@gtkx/react` — `useSetting`/\n// `useBindSetting` are still public and still typed by them, so a consumer\n// that wants to name the type of a setting has no supported import for it.\n// We re-export them from here, which is the whole point of the bridge; the\n// ask to put them back is filed in docs/upstream-gtkx.md.\nexport type {\n SettingsSchema,\n SettingsSchemaKeys,\n SettingValue,\n} from \"@gtkx/react/internal\"\n\n// useSignal comes from ./use-signal, not @gtkx/react — see the workaround note\n// there (rc.3 delivers a stale handler).\nexport { useSignal } from \"./use-signal\"\n\nexport { css, cx, injectGlobal } from \"@gtkx/css\"\n\n// The imperative counterpart of `css`: a private provider on one widget,\n// for values that change per frame and must not enter the shared stylesheet.\nexport { createWidgetCss, type WidgetCss } from \"./widget-css\"\n\nexport { createTextProbe, measureWidget, toNumber } from \"./measure\"\nexport { computePointIn, computePointInWindow, type Point } from \"./geometry\"\n// A portal into a NAMED slot of a remote object (the window's action map,\n// its controllers) rather than into its default child slot — see the file\n// for why gtkx's own createPortal is not enough on its own.\nexport { createSlotPortal } from \"./slot-portal\"\nexport {\n cacheChildOrder,\n getViewBoxComponent,\n invalidateZOrder,\n setBoxOnly,\n setBoxPassthrough,\n setHitSlop,\n setPaintOnlyLeaf,\n setPointerTarget,\n setZIndex,\n type HitSlop,\n} from \"./view-box\"\nexport {\n getSvgNodeComponent,\n getSvgNodeDescriptor,\n queueSvgRedraw,\n resolveSvgColor,\n resolveSvgPaint,\n setSvgNodeDescriptor,\n type SvgDefsDescriptor,\n type SvgGradientUnits,\n type SvgGroupDescriptor,\n type SvgLinearGradientDescriptor,\n type SvgNodeDescriptor,\n type SvgPaintSpec,\n type SvgRadialGradientDescriptor,\n type SvgShapeDescriptor,\n type SvgStopDescriptor,\n type SvgSvgDescriptor,\n} from \"./svg-node\"\nexport {\n allocateChild,\n attachRnLayout,\n detachRnLayout,\n queueAllocate,\n queueResize,\n type RnLayoutHooks,\n type RnLayoutOrientation,\n} from \"./layout-manager\"\nexport { colorScheme, styleManager } from \"./theme\"\n"]}
@@ -1 +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// RC3-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-rc3-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"]}
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"]}
@@ -1,4 +1,4 @@
1
- // RC3-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc3-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
4
  // of its own. rc.3 routes it through React's useEffectEvent instead, and
@@ -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":["// RC3-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc3-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
+ {"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 {};