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
@@ -98,7 +98,7 @@ const searchDocsTool = () => defineTool({
98
98
  name: "rn_gtkx_search_docs",
99
99
  title: "Search react-native-gtkx docs",
100
100
  description: "Free-text search over the docs (getting-started, the platform layer, " +
101
- "gtkx rc.2 workarounds/quirks, navigation). The fallback tool: use it " +
101
+ "gtkx rc.3 workarounds/quirks, navigation). The fallback tool: use it " +
102
102
  "for symptoms and known-issue questions that rn_gtkx_describe_component " +
103
103
  "cannot answer by name (workarounds are keyed by mechanism, not by " +
104
104
  "component).",
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wEAAwE;AACxE,oEAAoE;AACpE,wEAAwE;AACxE,0EAA0E;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GAE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GAAc,EAAE;IACtC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5D,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,EAAE,CAAC;QAChC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;IAChC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA","sourcesContent":["// The MCP server itself: three tools over stdio, backed entirely by the\n// generated data in ./data/generated.ts — no @gtkx/* import anywhere in\n// this module or its dependents, so this runs on any OS without GTK\n// installed (an agent reading a react-native-gtkx project on a Mac, for\n// instance). See docs/getting-started.md for how a consumer registers it.\nimport { createRequire } from \"node:module\"\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { z } from \"zod\"\nimport { listSurface, SURFACE_AREAS } from \"./list.js\"\nimport { formatEntity, resolveComponent } from \"./resolve.js\"\nimport { searchDocs } from \"./search.js\"\nimport {\n defineTool,\n registerTool,\n textContent,\n textError,\n type Tool,\n} from \"./tool.js\"\n\nconst require = createRequire(import.meta.url)\n// Package root is two levels up from dist/mcp/server.js (dist/mcp -> dist\n// -> package root). package.json ships in every npm tarball regardless of\n// the \"files\" allowlist, so this needs no extra packaging step.\nconst { version } = require(\"../../package.json\") as { version: string }\n\nconst SERVER_NAME = \"react-native-gtkx-mcp\"\nconst DEFAULT_SEARCH_LIMIT = 10\nconst MAX_SEARCH_LIMIT = 20\n\nconst listSurfaceShape = {\n area: z\n .enum(SURFACE_AREAS)\n .optional()\n .describe(\n \"Area to list. Omit for an overview with counts across all areas: \" +\n SURFACE_AREAS.join(\", \") +\n \".\",\n ),\n}\n\nconst describeComponentShape = {\n name: z\n .string()\n .describe(\n \"A component/API/widget name: a portable react-native export (e.g. \" +\n '\"FlatList\"), a react-native-gtkx/gtk or /adw widget with or ' +\n 'without its Gtk/Adw prefix (e.g. \"Popover\" resolves to ' +\n '\"GtkPopover\"), or a react-native-gtkx/common export (e.g. ' +\n '\"NavigationStack\"). Case-insensitive.',\n ),\n}\n\nconst searchDocsShape = {\n query: z\n .string()\n .describe(\n \"Free-text query — a symptom, a GTK term, an option name. Use this \" +\n \"when rn_gtkx_describe_component does not have a name to look up, \" +\n 'e.g. \"known issues\", \"chrome content\", \"windowSize\".',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(MAX_SEARCH_LIMIT)\n .optional()\n .describe(\n `Maximum number of results (default ${DEFAULT_SEARCH_LIMIT}, max ${MAX_SEARCH_LIMIT}).`,\n ),\n}\n\nconst listSurfaceTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_list_surface\",\n title: \"List the react-native-gtkx surface\",\n description:\n \"Browse the react-native-gtkx surface without knowing an exact name first: \" +\n \"portable react-native components/APIs, the react-native-gtkx/gtk and \" +\n \"/adw widget lists (wrapped vs. raw), and react-native-gtkx/common. \" +\n \"Without `area`, returns counts and where to look next.\",\n inputSchema: listSurfaceShape,\n handler: ({ area }) => textContent(listSurface(area)),\n })\n\nconst describeComponentTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_describe_component\",\n title: \"Describe a react-native-gtkx component\",\n description:\n \"Look up one component/widget/API by name: does it exist, which \" +\n \"subpath it is exported from, what GTK widget backs it (for \" +\n \"portable components), what differs from React Native, and whether \" +\n \"a gtk/adw widget is wrapped (takes `style`/`onLayout`) or raw. The \" +\n \"single most useful tool here — start with this before \" +\n \"rn_gtkx_search_docs.\",\n inputSchema: describeComponentShape,\n handler: ({ name }) => {\n const result = resolveComponent(name)\n if (result.status === \"resolved\") {\n const body = {\n matchedBy: result.matchedBy,\n ...formatEntity(result.entity),\n }\n return textContent(JSON.stringify(body, null, 2))\n }\n if (result.status === \"ambiguous\") {\n const lines = result.candidates\n .map((c) => `- ${c.name} (${c.subpath}, ${c.kind})`)\n .join(\"\\n\")\n return textError(\n `\"${result.query}\" matches ${result.candidates.length} names — call again with one of:\\n${lines}`,\n )\n }\n const lines = result.suggestions\n .map((c) => `- ${c.name} (${c.subpath}, ${c.kind})`)\n .join(\"\\n\")\n return textError(\n `No component named \"${result.query}\".` +\n (lines.length > 0\n ? ` Closest known names:\\n${lines}`\n : \" rn_gtkx_list_surface has the full index.\"),\n )\n },\n })\n\nconst searchDocsTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_search_docs\",\n title: \"Search react-native-gtkx docs\",\n description:\n \"Free-text search over the docs (getting-started, the platform layer, \" +\n \"gtkx rc.2 workarounds/quirks, navigation). The fallback tool: use it \" +\n \"for symptoms and known-issue questions that rn_gtkx_describe_component \" +\n \"cannot answer by name (workarounds are keyed by mechanism, not by \" +\n \"component).\",\n inputSchema: searchDocsShape,\n handler: ({ query, limit }) => {\n const results = searchDocs(query, limit ?? DEFAULT_SEARCH_LIMIT)\n if (results.length === 0) {\n return textContent(\n `No matches for \"${query}\". Try rn_gtkx_list_surface or rn_gtkx_describe_component instead.`,\n )\n }\n const body = results\n .map((r) => `## ${r.doc} — ${r.heading}\\n\\n${r.text}`)\n .join(\"\\n\\n---\\n\\n\")\n return textContent(body)\n },\n })\n\nconst buildTools = (): Tool[] => [\n listSurfaceTool(),\n describeComponentTool(),\n searchDocsTool(),\n]\n\nconst createMcpServer = (): McpServer => {\n const server = new McpServer({ name: SERVER_NAME, version })\n for (const tool of buildTools()) {\n registerTool(server, tool)\n }\n return server\n}\n\nconst main = async (): Promise<void> => {\n const server = createMcpServer()\n const transport = new StdioServerTransport()\n await server.connect(transport)\n}\n\nexport { buildTools, createMcpServer, main, SERVER_NAME }\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wEAAwE;AACxE,oEAAoE;AACpE,wEAAwE;AACxE,0EAA0E;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GAEV,MAAM,WAAW,CAAA;AAElB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,0EAA0E;AAC1E,0EAA0E;AAC1E,gEAAgE;AAChE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAA;AAExE,MAAM,WAAW,GAAG,uBAAuB,CAAA;AAC3C,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAC/B,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAE3B,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,aAAa,CAAC;SACnB,QAAQ,EAAE;SACV,QAAQ,CACP,mEAAmE;QACjE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;QACxB,GAAG,CACN;CACJ,CAAA;AAED,MAAM,sBAAsB,GAAG;IAC7B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR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AAE,EAAE,EAAE;QAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,IAAI,oBAAoB,CAAC,CAAA;QAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,WAAW,CAChB,mBAAmB,KAAK,oEAAoE,CAC7F,CAAA;QACH,CAAC;QACD,MAAM,IAAI,GAAG,OAAO;aACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;aACrD,IAAI,CAAC,aAAa,CAAC,CAAA;QACtB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;CACF,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC;IAC/B,eAAe,EAAE;IACjB,qBAAqB,EAAE;IACvB,cAAc,EAAE;CACjB,CAAA;AAED,MAAM,eAAe,GAAG,GAAc,EAAE;IACtC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5D,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,EAAE,CAAC;QAChC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;IAChC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA","sourcesContent":["// The MCP server itself: three tools over stdio, backed entirely by the\n// generated data in ./data/generated.ts — no @gtkx/* import anywhere in\n// this module or its dependents, so this runs on any OS without GTK\n// installed (an agent reading a react-native-gtkx project on a Mac, for\n// instance). See docs/getting-started.md for how a consumer registers it.\nimport { createRequire } from \"node:module\"\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { z } from \"zod\"\nimport { listSurface, SURFACE_AREAS } from \"./list.js\"\nimport { formatEntity, resolveComponent } from \"./resolve.js\"\nimport { searchDocs } from \"./search.js\"\nimport {\n defineTool,\n registerTool,\n textContent,\n textError,\n type Tool,\n} from \"./tool.js\"\n\nconst require = createRequire(import.meta.url)\n// Package root is two levels up from dist/mcp/server.js (dist/mcp -> dist\n// -> package root). package.json ships in every npm tarball regardless of\n// the \"files\" allowlist, so this needs no extra packaging step.\nconst { version } = require(\"../../package.json\") as { version: string }\n\nconst SERVER_NAME = \"react-native-gtkx-mcp\"\nconst DEFAULT_SEARCH_LIMIT = 10\nconst MAX_SEARCH_LIMIT = 20\n\nconst listSurfaceShape = {\n area: z\n .enum(SURFACE_AREAS)\n .optional()\n .describe(\n \"Area to list. Omit for an overview with counts across all areas: \" +\n SURFACE_AREAS.join(\", \") +\n \".\",\n ),\n}\n\nconst describeComponentShape = {\n name: z\n .string()\n .describe(\n \"A component/API/widget name: a portable react-native export (e.g. \" +\n '\"FlatList\"), a react-native-gtkx/gtk or /adw widget with or ' +\n 'without its Gtk/Adw prefix (e.g. \"Popover\" resolves to ' +\n '\"GtkPopover\"), or a react-native-gtkx/common export (e.g. ' +\n '\"NavigationStack\"). Case-insensitive.',\n ),\n}\n\nconst searchDocsShape = {\n query: z\n .string()\n .describe(\n \"Free-text query — a symptom, a GTK term, an option name. Use this \" +\n \"when rn_gtkx_describe_component does not have a name to look up, \" +\n 'e.g. \"known issues\", \"chrome content\", \"windowSize\".',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(MAX_SEARCH_LIMIT)\n .optional()\n .describe(\n `Maximum number of results (default ${DEFAULT_SEARCH_LIMIT}, max ${MAX_SEARCH_LIMIT}).`,\n ),\n}\n\nconst listSurfaceTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_list_surface\",\n title: \"List the react-native-gtkx surface\",\n description:\n \"Browse the react-native-gtkx surface without knowing an exact name first: \" +\n \"portable react-native components/APIs, the react-native-gtkx/gtk and \" +\n \"/adw widget lists (wrapped vs. raw), and react-native-gtkx/common. \" +\n \"Without `area`, returns counts and where to look next.\",\n inputSchema: listSurfaceShape,\n handler: ({ area }) => textContent(listSurface(area)),\n })\n\nconst describeComponentTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_describe_component\",\n title: \"Describe a react-native-gtkx component\",\n description:\n \"Look up one component/widget/API by name: does it exist, which \" +\n \"subpath it is exported from, what GTK widget backs it (for \" +\n \"portable components), what differs from React Native, and whether \" +\n \"a gtk/adw widget is wrapped (takes `style`/`onLayout`) or raw. The \" +\n \"single most useful tool here — start with this before \" +\n \"rn_gtkx_search_docs.\",\n inputSchema: describeComponentShape,\n handler: ({ name }) => {\n const result = resolveComponent(name)\n if (result.status === \"resolved\") {\n const body = {\n matchedBy: result.matchedBy,\n ...formatEntity(result.entity),\n }\n return textContent(JSON.stringify(body, null, 2))\n }\n if (result.status === \"ambiguous\") {\n const lines = result.candidates\n .map((c) => `- ${c.name} (${c.subpath}, ${c.kind})`)\n .join(\"\\n\")\n return textError(\n `\"${result.query}\" matches ${result.candidates.length} names — call again with one of:\\n${lines}`,\n )\n }\n const lines = result.suggestions\n .map((c) => `- ${c.name} (${c.subpath}, ${c.kind})`)\n .join(\"\\n\")\n return textError(\n `No component named \"${result.query}\".` +\n (lines.length > 0\n ? ` Closest known names:\\n${lines}`\n : \" rn_gtkx_list_surface has the full index.\"),\n )\n },\n })\n\nconst searchDocsTool = (): Tool =>\n defineTool({\n name: \"rn_gtkx_search_docs\",\n title: \"Search react-native-gtkx docs\",\n description:\n \"Free-text search over the docs (getting-started, the platform layer, \" +\n \"gtkx rc.3 workarounds/quirks, navigation). The fallback tool: use it \" +\n \"for symptoms and known-issue questions that rn_gtkx_describe_component \" +\n \"cannot answer by name (workarounds are keyed by mechanism, not by \" +\n \"component).\",\n inputSchema: searchDocsShape,\n handler: ({ query, limit }) => {\n const results = searchDocs(query, limit ?? DEFAULT_SEARCH_LIMIT)\n if (results.length === 0) {\n return textContent(\n `No matches for \"${query}\". Try rn_gtkx_list_surface or rn_gtkx_describe_component instead.`,\n )\n }\n const body = results\n .map((r) => `## ${r.doc} — ${r.heading}\\n\\n${r.text}`)\n .join(\"\\n\\n---\\n\\n\")\n return textContent(body)\n },\n })\n\nconst buildTools = (): Tool[] => [\n listSurfaceTool(),\n describeComponentTool(),\n searchDocsTool(),\n]\n\nconst createMcpServer = (): McpServer => {\n const server = new McpServer({ name: SERVER_NAME, version })\n for (const tool of buildTools()) {\n registerTool(server, tool)\n }\n return server\n}\n\nconst main = async (): Promise<void> => {\n const server = createMcpServer()\n const transport = new StdioServerTransport()\n await server.connect(transport)\n}\n\nexport { buildTools, createMcpServer, main, SERVER_NAME }\n"]}
@@ -1,3 +1,6 @@
1
+ import { type AliasOverrides } from "../aliases/index.js";
2
+ export { CONFIGURABLE_ALIASES, DEFAULT_ALIASES, PLATFORM_ALIAS, } from "../aliases/index.js";
3
+ export type { AliasOverride, AliasOverrides, AliasPattern, AliasTable, CompiledAlias, } from "../aliases/index.js";
1
4
  /** Modules the run-linux host provides to the bundle at runtime. */
2
5
  export declare const HOST_MODULE_EXTERNALS: string[];
3
6
  export declare const LINUX_PLATFORM = "linux";
@@ -24,6 +27,13 @@ export type LinuxPlatformOptions = {
24
27
  externals?: readonly string[];
25
28
  /** Proxy directory override (default: node_modules/.react-native-gtkx). */
26
29
  proxyDir?: string;
30
+ /**
31
+ * Deltas over the preset's package aliases, keyed by package name — a
32
+ * string target, a `{ pattern, replace }` rule, or `false` to drop one of
33
+ * ours so the real package loads. See ../aliases/index.ts and docs/api.md.
34
+ * Invalid entries throw here, while the config is being read.
35
+ */
36
+ aliases?: AliasOverrides;
27
37
  };
28
38
  export type LinuxPlatformConfig<T extends MetroLikeConfig> = T & {
29
39
  resolver: {
@@ -8,7 +8,9 @@
8
8
  // Platform.OS come along with it).
9
9
  // 2. Redirects `react-native` (and subpaths) to `react-native-gtkx` — the
10
10
  // out-of-tree npmPackageName declaration alone does not alias imports
11
- // for `bundle`, the resolver has to.
11
+ // for `bundle`, the resolver has to — plus five package substitutions
12
+ // for libraries whose real implementation cannot run here. The rules
13
+ // are data, shared with the vite preset: see ../aliases/index.ts.
12
14
  // 3. EXTERNALIZES host-side singletons. Unlike react-native-windows, whose
13
15
  // native side lives outside the JS bundle by construction, our "native"
14
16
  // is Node modules with NAPI bindings (@gtkx/*) plus yoga-layout's WASM —
@@ -24,6 +26,11 @@
24
26
  import { mkdirSync, writeFileSync } from "node:fs";
25
27
  import { builtinModules, isBuiltin } from "node:module";
26
28
  import { join } from "node:path";
29
+ // Explicit .js: bare Node loads metro.config.ts and does not guess extensions.
30
+ import { applyAliases, compileAliases, } from "../aliases/index.js";
31
+ // Re-exported so an app configuring `aliases` never has to reach past the
32
+ // preset subpath it already imports.
33
+ export { CONFIGURABLE_ALIASES, DEFAULT_ALIASES, PLATFORM_ALIAS, } from "../aliases/index.js";
27
34
  /** Modules the run-linux host provides to the bundle at runtime. */
28
35
  export const HOST_MODULE_EXTERNALS = [
29
36
  "@gtkx/css",
@@ -80,6 +87,9 @@ export const withLinuxPlatform = (config, options = {}) => {
80
87
  const proxyDir = options.proxyDir ??
81
88
  join(config.projectRoot ?? process.cwd(), "node_modules", ".react-native-gtkx", "metro-externals");
82
89
  generateProxies(proxyDir, externals);
90
+ // Throws on an unknown key, an overlapping pattern or an attempt to remove
91
+ // the platform alias — at config load, naming what is valid.
92
+ const aliases = compileAliases(options.aliases);
83
93
  const previousResolve = config.resolver?.resolveRequest ?? null;
84
94
  const fallback = (context, moduleName, platform) => previousResolve
85
95
  ? previousResolve(context, moduleName, platform)
@@ -94,17 +104,16 @@ export const withLinuxPlatform = (config, options = {}) => {
94
104
  filePath: join(proxyDir, sanitize(moduleName)),
95
105
  };
96
106
  }
97
- if (moduleName === "react-native" ||
98
- moduleName.startsWith("react-native/")) {
99
- return fallback(context, moduleName.replace(/^react-native/, "react-native-gtkx"), platform);
100
- }
101
- // Same alias, same guard shape, for the SVG compat subpath (see
102
- // src/svg-compat/index.ts and the vite preset's rewriteReactNativeImport
103
- // kept in sync deliberately rather than sharing code, Metro and vite
104
- // resolvers have never shared an implementation in this package).
105
- if (moduleName === "react-native-svg" ||
106
- moduleName.startsWith("react-native-svg/")) {
107
- return fallback(context, moduleName.replace(/^react-native-svg/, "react-native-gtkx/svg"), platform);
107
+ // The five package substitutions plus the platform alias, from the table
108
+ // both presets share (../aliases/index.ts). Each rule is anchored to its
109
+ // package name and matches the exact name or a slash-prefixed subpath,
110
+ // with the tail transplanted onto the target — the guard, not just the
111
+ // order, is what keeps `react-native-reanimated-dnd` out of the
112
+ // `react-native-reanimated` rule and the real, unrelated
113
+ // `react-native-worklets-core` out of the `react-native-worklets` one.
114
+ const aliased = applyAliases(aliases, moduleName);
115
+ if (aliased !== null) {
116
+ return fallback(context, aliased, platform);
108
117
  }
109
118
  return fallback(context, moduleName, platform);
110
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metro/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,sCAAsC;AACtC,0EAA0E;AAC1E,yEAAyE;AACzE,wCAAwC;AACxC,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,+CAA+C;AAC/C,oEAAoE;AACpE,oEAAoE;AACpE,2EAA2E;AAC3E,wDAAwD;AACxD,OAAO,EAAE,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,CAAC,EAAE;SACxC;KACwB,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["// Metro preset for the linux out-of-tree platform: wrap the app's Metro\n// config with `withLinuxPlatform` and the standard RN toolchain bundles for\n// `--platform linux`.\n//\n// What it does on top of RN defaults (validated by spike/rn-platform):\n//\n// 1. Adds \"linux\" to resolver.platforms (`.linux.tsx` extensions and\n// Platform.OS come along with it).\n// 2. Redirects `react-native` (and subpaths) to `react-native-gtkx` — the\n// out-of-tree npmPackageName declaration alone does not alias imports\n// for `bundle`, the resolver has to.\n// 3. EXTERNALIZES host-side singletons. Unlike react-native-windows, whose\n// native side lives outside the JS bundle by construction, our \"native\"\n// is Node modules with NAPI bindings (@gtkx/*) plus yoga-layout's WASM —\n// Metro cannot bundle those. react (and its jsx runtimes) must also stay\n// host-side: the reconciler inside @gtkx/react and the app have to share\n// one React instance. Every external resolves to a generated proxy that\n// reads the real module from global.__hostModules — the run-linux host\n// injects them before executing the bundle.\n// 4. Proxies Node builtins through the host's require: apps on this\n// platform may use the whole Node API, it is a platform feature.\n// 5. Drops InitializeCore (RN's mobile environment polyfills): the runtime\n// environment IS Node, the host provides everything.\nimport { mkdirSync, writeFileSync } from \"node:fs\"\nimport { builtinModules, isBuiltin } from \"node:module\"\nimport { join } from \"node:path\"\n\n/** Modules the run-linux host provides to the bundle at runtime. */\nexport const HOST_MODULE_EXTERNALS = [\n \"@gtkx/css\",\n \"@gtkx/gi/adw\",\n \"@gtkx/gi/gdk\",\n \"@gtkx/gi/gio\",\n \"@gtkx/gi/glib\",\n \"@gtkx/gi/gobject\",\n \"@gtkx/gi/graphene\",\n \"@gtkx/gi/gsk\",\n \"@gtkx/gi/gtk\",\n \"@gtkx/gi/pango\",\n \"@gtkx/jsx/adw\",\n \"@gtkx/jsx/gio\",\n \"@gtkx/jsx/gtk\",\n \"@gtkx/react\",\n \"@gtkx/react/internal\",\n \"@gtkx/runtime\",\n \"react\",\n \"react/jsx-runtime\",\n \"react/jsx-dev-runtime\",\n \"yoga-layout\",\n]\n\nexport const LINUX_PLATFORM = \"linux\"\n\n// Structural slices of Metro's config/resolution types: Metro is the app's\n// dependency, not ours — depending on its types here would pin versions.\nexport type MetroResolutionContext = {\n resolveRequest: MetroResolver\n}\nexport type MetroResolution = { type: string; filePath?: string }\nexport type MetroResolver = (\n context: MetroResolutionContext,\n moduleName: string,\n platform: string | null,\n) => MetroResolution\n\nexport type MetroLikeConfig = {\n projectRoot?: string\n resolver?: {\n platforms?: readonly string[]\n resolveRequest?: MetroResolver | null\n }\n serializer?: {\n getModulesRunBeforeMainModule?: (entryFilePath: string) => string[]\n }\n}\n\nexport type LinuxPlatformOptions = {\n /** Extra host-provided modules to keep out of the bundle. */\n externals?: readonly string[]\n /** Proxy directory override (default: node_modules/.react-native-gtkx). */\n proxyDir?: string\n}\n\nconst sanitize = (name: string): string => name.replace(/[@/:]/g, \"_\") + \".js\"\n\nconst hostModuleProxy = (name: string): string =>\n // The run-linux host guarantees __hostModules before executing the bundle.\n `module.exports = global.__hostModules[${JSON.stringify(name)}]\\n`\n\nconst builtinProxy = (name: string): string =>\n `module.exports = global.__hostRequire(${JSON.stringify(name)})\\n`\n\n// Every proxy is generated eagerly when the config loads: Metro crawls the\n// file map before transforming, and files that appear mid-build lose the\n// race (\"Failed to get the SHA-1\"). The builtin list is finite, so the\n// whole proxy set can exist up front.\nconst generateProxies = (dir: string, externals: Set<string>): void => {\n mkdirSync(dir, { recursive: true })\n for (const name of externals) {\n writeFileSync(join(dir, sanitize(name)), hostModuleProxy(name))\n }\n for (const bare of builtinModules) {\n writeFileSync(join(dir, sanitize(bare)), builtinProxy(bare))\n writeFileSync(\n join(dir, sanitize(`node:${bare}`)),\n builtinProxy(`node:${bare}`),\n )\n }\n}\n\nexport type LinuxPlatformConfig<T extends MetroLikeConfig> = T & {\n resolver: {\n platforms: string[]\n resolveRequest: MetroResolver\n }\n serializer: {\n getModulesRunBeforeMainModule: (entryFilePath: string) => string[]\n }\n}\n\n/**\n * Wraps a Metro config (RN's getDefaultConfig output) with everything the\n * linux platform needs. Composes with an existing custom resolveRequest —\n * non-linux platforms fall through to it untouched.\n */\nexport const withLinuxPlatform = <T extends MetroLikeConfig>(\n config: T,\n options: LinuxPlatformOptions = {},\n): LinuxPlatformConfig<T> => {\n const externals = new Set([\n ...HOST_MODULE_EXTERNALS,\n ...(options.externals ?? []),\n ])\n const proxyDir =\n options.proxyDir ??\n join(\n config.projectRoot ?? process.cwd(),\n \"node_modules\",\n \".react-native-gtkx\",\n \"metro-externals\",\n )\n generateProxies(proxyDir, externals)\n const previousResolve = config.resolver?.resolveRequest ?? null\n\n const fallback: MetroResolver = (context, moduleName, platform) =>\n previousResolve\n ? previousResolve(context, moduleName, platform)\n : context.resolveRequest(context, moduleName, platform)\n\n const resolveRequest: MetroResolver = (context, moduleName, platform) => {\n if (platform !== LINUX_PLATFORM) {\n return fallback(context, moduleName, platform)\n }\n if (externals.has(moduleName) || isBuiltin(moduleName)) {\n return {\n type: \"sourceFile\",\n filePath: join(proxyDir, sanitize(moduleName)),\n }\n }\n if (\n moduleName === \"react-native\" ||\n moduleName.startsWith(\"react-native/\")\n ) {\n return fallback(\n context,\n moduleName.replace(/^react-native/, \"react-native-gtkx\"),\n platform,\n )\n }\n // Same alias, same guard shape, for the SVG compat subpath (see\n // src/svg-compat/index.ts and the vite preset's rewriteReactNativeImport\n // — kept in sync deliberately rather than sharing code, Metro and vite\n // resolvers have never shared an implementation in this package).\n if (\n moduleName === \"react-native-svg\" ||\n moduleName.startsWith(\"react-native-svg/\")\n ) {\n return fallback(\n context,\n moduleName.replace(/^react-native-svg/, \"react-native-gtkx/svg\"),\n platform,\n )\n }\n return fallback(context, moduleName, platform)\n }\n\n // The cast: T may carry narrower resolver/serializer types than the ones\n // rebuilt here — the runtime shape is a strict superset of both.\n return {\n ...config,\n resolver: {\n ...config.resolver,\n platforms: [\n ...new Set([...(config.resolver?.platforms ?? []), LINUX_PLATFORM]),\n ],\n resolveRequest,\n },\n serializer: {\n ...config.serializer,\n // RN prepends InitializeCore (Hermes Promise, nativeLoggingHook\n // console...). Our runtime environment IS Node — nothing to\n // initialize inside the bundle.\n getModulesRunBeforeMainModule: () => [],\n },\n } as LinuxPlatformConfig<T>\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metro/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,sCAAsC;AACtC,0EAA0E;AAC1E,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,qEAAqE;AACrE,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,+CAA+C;AAC/C,oEAAoE;AACpE,oEAAoE;AACpE,2EAA2E;AAC3E,wDAAwD;AACxD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,+EAA+E;AAC/E,OAAO,EACL,YAAY,EACZ,cAAc,GAEf,MAAM,qBAAqB,CAAA;AAE5B,0EAA0E;AAC1E,qCAAqC;AACrC,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAA;AAS5B,oEAAoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW;IACX,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,eAAe;IACf,aAAa;IACb,sBAAsB;IACtB,eAAe;IACf,OAAO;IACP,mBAAmB;IACnB,uBAAuB;IACvB,aAAa;CAC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ACvE,gEAAgE;QAChE,yDAAyD;QACzD,uEAAuE;QACvE,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACjD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC7C,CAAC;QACD,OAAO,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC,CAAA;IAED,yEAAyE;IACzE,iEAAiE;IACjE,OAAO;QACL,GAAG,MAAM;QACT,QAAQ,EAAE;YACR,GAAG,MAAM,CAAC,QAAQ;YAClB,SAAS,EAAE;gBACT,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;aACpE;YACD,cAAc;SACf;QACD,UAAU,EAAE;YACV,GAAG,MAAM,CAAC,UAAU;YACpB,gEAAgE;YAChE,4DAA4D;YAC5D,gCAAgC;YAChC,6BAA6B,EAAE,GAAG,EAAE,CAAC,EAAE;SACxC;KACwB,CAAA;AAC7B,CAAC,CAAA","sourcesContent":["// Metro preset for the linux out-of-tree platform: wrap the app's Metro\n// config with `withLinuxPlatform` and the standard RN toolchain bundles for\n// `--platform linux`.\n//\n// What it does on top of RN defaults (validated by spike/rn-platform):\n//\n// 1. Adds \"linux\" to resolver.platforms (`.linux.tsx` extensions and\n// Platform.OS come along with it).\n// 2. Redirects `react-native` (and subpaths) to `react-native-gtkx` — the\n// out-of-tree npmPackageName declaration alone does not alias imports\n// for `bundle`, the resolver has to — plus five package substitutions\n// for libraries whose real implementation cannot run here. The rules\n// are data, shared with the vite preset: see ../aliases/index.ts.\n// 3. EXTERNALIZES host-side singletons. Unlike react-native-windows, whose\n// native side lives outside the JS bundle by construction, our \"native\"\n// is Node modules with NAPI bindings (@gtkx/*) plus yoga-layout's WASM —\n// Metro cannot bundle those. react (and its jsx runtimes) must also stay\n// host-side: the reconciler inside @gtkx/react and the app have to share\n// one React instance. Every external resolves to a generated proxy that\n// reads the real module from global.__hostModules — the run-linux host\n// injects them before executing the bundle.\n// 4. Proxies Node builtins through the host's require: apps on this\n// platform may use the whole Node API, it is a platform feature.\n// 5. Drops InitializeCore (RN's mobile environment polyfills): the runtime\n// environment IS Node, the host provides everything.\nimport { mkdirSync, writeFileSync } from \"node:fs\"\nimport { builtinModules, isBuiltin } from \"node:module\"\nimport { join } from \"node:path\"\n// Explicit .js: bare Node loads metro.config.ts and does not guess extensions.\nimport {\n applyAliases,\n compileAliases,\n type AliasOverrides,\n} from \"../aliases/index.js\"\n\n// Re-exported so an app configuring `aliases` never has to reach past the\n// preset subpath it already imports.\nexport {\n CONFIGURABLE_ALIASES,\n DEFAULT_ALIASES,\n PLATFORM_ALIAS,\n} from \"../aliases/index.js\"\nexport type {\n AliasOverride,\n AliasOverrides,\n AliasPattern,\n AliasTable,\n CompiledAlias,\n} from \"../aliases/index.js\"\n\n/** Modules the run-linux host provides to the bundle at runtime. */\nexport const HOST_MODULE_EXTERNALS = [\n \"@gtkx/css\",\n \"@gtkx/gi/adw\",\n \"@gtkx/gi/gdk\",\n \"@gtkx/gi/gio\",\n \"@gtkx/gi/glib\",\n \"@gtkx/gi/gobject\",\n \"@gtkx/gi/graphene\",\n \"@gtkx/gi/gsk\",\n \"@gtkx/gi/gtk\",\n \"@gtkx/gi/pango\",\n \"@gtkx/jsx/adw\",\n \"@gtkx/jsx/gio\",\n \"@gtkx/jsx/gtk\",\n \"@gtkx/react\",\n \"@gtkx/react/internal\",\n \"@gtkx/runtime\",\n \"react\",\n \"react/jsx-runtime\",\n \"react/jsx-dev-runtime\",\n \"yoga-layout\",\n]\n\nexport const LINUX_PLATFORM = \"linux\"\n\n// Structural slices of Metro's config/resolution types: Metro is the app's\n// dependency, not ours — depending on its types here would pin versions.\nexport type MetroResolutionContext = {\n resolveRequest: MetroResolver\n}\nexport type MetroResolution = { type: string; filePath?: string }\nexport type MetroResolver = (\n context: MetroResolutionContext,\n moduleName: string,\n platform: string | null,\n) => MetroResolution\n\nexport type MetroLikeConfig = {\n projectRoot?: string\n resolver?: {\n platforms?: readonly string[]\n resolveRequest?: MetroResolver | null\n }\n serializer?: {\n getModulesRunBeforeMainModule?: (entryFilePath: string) => string[]\n }\n}\n\nexport type LinuxPlatformOptions = {\n /** Extra host-provided modules to keep out of the bundle. */\n externals?: readonly string[]\n /** Proxy directory override (default: node_modules/.react-native-gtkx). */\n proxyDir?: string\n /**\n * Deltas over the preset's package aliases, keyed by package name — a\n * string target, a `{ pattern, replace }` rule, or `false` to drop one of\n * ours so the real package loads. See ../aliases/index.ts and docs/api.md.\n * Invalid entries throw here, while the config is being read.\n */\n aliases?: AliasOverrides\n}\n\nconst sanitize = (name: string): string => name.replace(/[@/:]/g, \"_\") + \".js\"\n\nconst hostModuleProxy = (name: string): string =>\n // The run-linux host guarantees __hostModules before executing the bundle.\n `module.exports = global.__hostModules[${JSON.stringify(name)}]\\n`\n\nconst builtinProxy = (name: string): string =>\n `module.exports = global.__hostRequire(${JSON.stringify(name)})\\n`\n\n// Every proxy is generated eagerly when the config loads: Metro crawls the\n// file map before transforming, and files that appear mid-build lose the\n// race (\"Failed to get the SHA-1\"). The builtin list is finite, so the\n// whole proxy set can exist up front.\nconst generateProxies = (dir: string, externals: Set<string>): void => {\n mkdirSync(dir, { recursive: true })\n for (const name of externals) {\n writeFileSync(join(dir, sanitize(name)), hostModuleProxy(name))\n }\n for (const bare of builtinModules) {\n writeFileSync(join(dir, sanitize(bare)), builtinProxy(bare))\n writeFileSync(\n join(dir, sanitize(`node:${bare}`)),\n builtinProxy(`node:${bare}`),\n )\n }\n}\n\nexport type LinuxPlatformConfig<T extends MetroLikeConfig> = T & {\n resolver: {\n platforms: string[]\n resolveRequest: MetroResolver\n }\n serializer: {\n getModulesRunBeforeMainModule: (entryFilePath: string) => string[]\n }\n}\n\n/**\n * Wraps a Metro config (RN's getDefaultConfig output) with everything the\n * linux platform needs. Composes with an existing custom resolveRequest —\n * non-linux platforms fall through to it untouched.\n */\nexport const withLinuxPlatform = <T extends MetroLikeConfig>(\n config: T,\n options: LinuxPlatformOptions = {},\n): LinuxPlatformConfig<T> => {\n const externals = new Set([\n ...HOST_MODULE_EXTERNALS,\n ...(options.externals ?? []),\n ])\n const proxyDir =\n options.proxyDir ??\n join(\n config.projectRoot ?? process.cwd(),\n \"node_modules\",\n \".react-native-gtkx\",\n \"metro-externals\",\n )\n generateProxies(proxyDir, externals)\n // Throws on an unknown key, an overlapping pattern or an attempt to remove\n // the platform alias — at config load, naming what is valid.\n const aliases = compileAliases(options.aliases)\n const previousResolve = config.resolver?.resolveRequest ?? null\n\n const fallback: MetroResolver = (context, moduleName, platform) =>\n previousResolve\n ? previousResolve(context, moduleName, platform)\n : context.resolveRequest(context, moduleName, platform)\n\n const resolveRequest: MetroResolver = (context, moduleName, platform) => {\n if (platform !== LINUX_PLATFORM) {\n return fallback(context, moduleName, platform)\n }\n if (externals.has(moduleName) || isBuiltin(moduleName)) {\n return {\n type: \"sourceFile\",\n filePath: join(proxyDir, sanitize(moduleName)),\n }\n }\n // The five package substitutions plus the platform alias, from the table\n // both presets share (../aliases/index.ts). Each rule is anchored to its\n // package name and matches the exact name or a slash-prefixed subpath,\n // with the tail transplanted onto the target — the guard, not just the\n // order, is what keeps `react-native-reanimated-dnd` out of the\n // `react-native-reanimated` rule and the real, unrelated\n // `react-native-worklets-core` out of the `react-native-worklets` one.\n const aliased = applyAliases(aliases, moduleName)\n if (aliased !== null) {\n return fallback(context, aliased, platform)\n }\n return fallback(context, moduleName, platform)\n }\n\n // The cast: T may carry narrower resolver/serializer types than the ones\n // rebuilt here — the runtime shape is a strict superset of both.\n return {\n ...config,\n resolver: {\n ...config.resolver,\n platforms: [\n ...new Set([...(config.resolver?.platforms ?? []), LINUX_PLATFORM]),\n ],\n resolveRequest,\n },\n serializer: {\n ...config.serializer,\n // RN prepends InitializeCore (Hermes Promise, nativeLoggingHook\n // console...). Our runtime environment IS Node — nothing to\n // initialize inside the bundle.\n getModulesRunBeforeMainModule: () => [],\n },\n } as LinuxPlatformConfig<T>\n}\n"]}
@@ -68,6 +68,22 @@ export type SidebarNavigationOptions = {
68
68
  * specifically (replaces it entirely when set, same as the stack
69
69
  * navigator's per-screen option override). */
70
70
  headerButtons?: HeaderButton[];
71
+ /** Section this row belongs to. Consecutive screens sharing a `group`
72
+ * get one Adwaita section header above the first of them.
73
+ *
74
+ * The header is attached with `GtkListBox.set_header_func`, which is
75
+ * what GNOME's own sidebars use: a header is a DECORATION owned by the
76
+ * row below it, not a row of its own. That distinction is the whole
77
+ * reason to do it this way — a header faked as a non-selectable
78
+ * `GtkListBoxRow` still sits in the list's focus chain, so Tab and the
79
+ * arrow keys stop on it and assistive technology announces a row that
80
+ * cannot be activated. A real header is skipped by both, for free.
81
+ *
82
+ * Grouping follows ROW ORDER, so screens in one group are declared
83
+ * together; a group name reappearing after a gap starts a second
84
+ * header rather than reordering anything. Leave it unset on every
85
+ * screen (the default) and the list is flat, exactly as before. */
86
+ group?: string;
71
87
  };
72
88
  export type HeaderButton = {
73
89
  id: string;
@@ -124,6 +140,36 @@ type SidebarNavigatorProps = {
124
140
  screenOptions?: SidebarNavigationOptions;
125
141
  /** Title of the sidebar pane's AdwHeaderBar. */
126
142
  sidebarTitle?: string;
143
+ /**
144
+ * Content packed at the START of the SIDEBAR pane's AdwHeaderBar — the
145
+ * "new item" action a GNOME sidebar puts next to its title, a search
146
+ * toggle, anything the pane's chrome needs.
147
+ *
148
+ * The content header's `headerLeft`/`headerRight`/`headerTitle` are
149
+ * screen OPTIONS because that header changes with the focused screen.
150
+ * The sidebar's does not: one pane, shared by every screen, so its
151
+ * chrome belongs to the navigator — the same level `sidebarTitle` and
152
+ * `sidebarContent` already sit at. Hence the `sidebar` prefix on
153
+ * otherwise identical names.
154
+ *
155
+ * Mounted through the same `HeaderSlotContent` root the content header
156
+ * uses, so a slot of React Native content lays out as a horizontal,
157
+ * content-hugging cluster flush with natively packed buttons.
158
+ */
159
+ sidebarHeaderLeft?: () => ReactNode;
160
+ /** Content packed at the END of the sidebar AdwHeaderBar — a primary
161
+ * menu, say. Same contract as {@link sidebarHeaderLeft}. */
162
+ sidebarHeaderRight?: () => ReactNode;
163
+ /**
164
+ * Replaces the sidebar AdwHeaderBar's title WIDGET — a search entry, a
165
+ * switcher, anything the plain `sidebarTitle` string cannot express.
166
+ *
167
+ * `sidebarTitle` sets the pane's `AdwNavigationPage` title, which the
168
+ * HeaderBar renders by default; this overrides what is drawn there,
169
+ * exactly as a screen's `headerTitle` overrides its page `title`. Left
170
+ * unset, `sidebarTitle` shows as before.
171
+ */
172
+ sidebarHeaderTitle?: () => ReactNode;
127
173
  /** Buttons packed at the end of the content AdwHeaderBar. */
128
174
  headerButtons?: HeaderButton[];
129
175
  /**
@@ -180,7 +226,7 @@ type SidebarNavigatorProps = {
180
226
  sidebarContent?: (props: SidebarContentProps) => ReactNode;
181
227
  children: ReactNode;
182
228
  };
183
- declare const SidebarNavigator: ({ initialRouteName, screenOptions, sidebarTitle, headerButtons, collapseWidth, minWidth, minHeight, sidebarContent, children, }: SidebarNavigatorProps) => React.JSX.Element;
229
+ declare const SidebarNavigator: ({ initialRouteName, screenOptions, sidebarTitle, sidebarHeaderLeft, sidebarHeaderRight, sidebarHeaderTitle, headerButtons, collapseWidth, minWidth, minHeight, sidebarContent, children, }: SidebarNavigatorProps) => React.JSX.Element;
184
230
  export type SidebarNavigationHelpers<ParamList extends ParamListBase = ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = NavigationProp<ParamList, RouteName, TabNavigationState<ParamList>, SidebarNavigationOptions, SidebarNavigationEventMap>;
185
231
  export type SidebarScreenProps<ParamList extends ParamListBase = ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = {
186
232
  route: RouteProp<ParamList, RouteName>;
@@ -56,6 +56,7 @@ const SIDEBAR_OPTION_KEYS = new Set([
56
56
  "headerButtons",
57
57
  "contentLayout",
58
58
  "sidebarRow",
59
+ "group",
59
60
  ]);
60
61
  // A one-off CSS class for a colored dot prefix — the same mechanism
61
62
  // tasks-app's own sidebar used (react-native-gtkx/gtk's `css` tag, kept
@@ -72,7 +73,7 @@ const listDot = (color) => css `
72
73
  // minimum at all" (Adwaita's own, which clips) is never the behavior.
73
74
  const DEFAULT_MIN_WIDTH = 360;
74
75
  const DEFAULT_MIN_HEIGHT = 294;
75
- const SidebarNavigator = ({ initialRouteName, screenOptions, sidebarTitle = "Sidebar", headerButtons, collapseWidth, minWidth = DEFAULT_MIN_WIDTH, minHeight = DEFAULT_MIN_HEIGHT, sidebarContent, children, }) => {
76
+ const SidebarNavigator = ({ initialRouteName, screenOptions, sidebarTitle = "Sidebar", sidebarHeaderLeft, sidebarHeaderRight, sidebarHeaderTitle, headerButtons, collapseWidth, minWidth = DEFAULT_MIN_WIDTH, minHeight = DEFAULT_MIN_HEIGHT, sidebarContent, children, }) => {
76
77
  const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder(TabRouter, {
77
78
  initialRouteName,
78
79
  screenOptions,
@@ -166,6 +167,69 @@ const SidebarNavigator = ({ initialRouteName, screenOptions, sidebarTitle = "Sid
166
167
  const activeDescriptor = descriptors[active.key];
167
168
  const optionsOf = (routeKey) => descriptors[routeKey]?.options ?? {};
168
169
  const titleOf = (routeKey, fallback) => optionsOf(routeKey).title ?? fallback;
170
+ // Group headers, through GtkListBox's own `set_header_func` — the
171
+ // mechanism GNOME's sidebars use, and the reason this is not a row: a
172
+ // header attached to a row is a decoration, outside the list's selection
173
+ // model and outside its focus chain, so arrow keys and Tab walk straight
174
+ // past it and assistive technology never announces an unactivatable row.
175
+ //
176
+ // The effect re-runs only when the group LIST changes (joined below with a
177
+ // separator that cannot occur in a group name), not on every render: the
178
+ // callback closes over `groups`, so a stale one would label rows with the
179
+ // previous grouping.
180
+ const groups = state.routes.map((route) => optionsOf(route.key).group);
181
+ const groupsKey = groups.map((group) => group ?? "").join("");
182
+ useEffect(() => {
183
+ const list = listRef.current;
184
+ if (!list) {
185
+ return;
186
+ }
187
+ if (groups.every((group) => group === undefined)) {
188
+ // Ungrouped is the default and must stay byte-identical to what this
189
+ // navigator did before groups existed — including after a navigator
190
+ // that HAD groups re-rendered without them.
191
+ list.setHeaderFunc(null);
192
+ list.invalidateHeaders();
193
+ return;
194
+ }
195
+ list.setHeaderFunc((row, before) => {
196
+ const group = groups[row.getIndex()];
197
+ // `before` is null for the first row, which is where a header is most
198
+ // wanted; a row whose predecessor carries the same group gets none.
199
+ if (group === undefined ||
200
+ (before !== null && groups[before.getIndex()] === group)) {
201
+ row.setHeader(null);
202
+ return;
203
+ }
204
+ // The structure Adwaita's own stylesheet styles, rather than margins
205
+ // picked by eye. From libadwaita's compiled CSS:
206
+ //
207
+ // .navigation-sidebar > .header > .heading { margin: 12px }
208
+ // .navigation-sidebar > .header.first > .heading { margin-top: 0 }
209
+ // .navigation-sidebar > row { min-height: 36px; padding: 0 8px;
210
+ // margin: 0 6px 2px }
211
+ //
212
+ // so a `.header` box holding a `.heading` label lands its text 12px
213
+ // from the list edge against a row label's 6 + 8 = 14px, and gets
214
+ // 12px of air above and below — which is the alignment and the rhythm
215
+ // GNOME ships, arrived at by matching the selectors rather than the
216
+ // pixels. `.first` is libadwaita's own class for the header that needs
217
+ // no top margin; its CSS carries the comment "No top margin on the
218
+ // first header".
219
+ const header = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0);
220
+ header.addCssClass("header");
221
+ if (before === null) {
222
+ header.addCssClass("first");
223
+ }
224
+ const label = Gtk.Label.new(group);
225
+ label.setXalign(0);
226
+ label.addCssClass("heading");
227
+ header.append(label);
228
+ row.setHeader(header);
229
+ });
230
+ list.invalidateHeaders();
231
+ // eslint-disable-next-line react-hooks/exhaustive-deps
232
+ }, [groupsKey]);
169
233
  // The content HeaderBar's own shape — the thing tasks-app's README named
170
234
  // as a structural-sounding complaint ("one content header shared by the
171
235
  // whole navigator") and the PRD allowed finding a real gap. It is not
@@ -225,7 +289,17 @@ const SidebarNavigator = ({ initialRouteName, screenOptions, sidebarTitle = "Sid
225
289
  // Adwaita's own defaults for a sidebar of rows. Set explicitly
226
290
  // because they are what keeps the sidebar's width off the window's
227
291
  // minimum now that the scrolled window no longer propagates it.
228
- minSidebarWidth: 180, maxSidebarWidth: 280, onNotifyShowContent: handleShowContentChanged, sidebar: _jsx(AdwNavigationPage, { title: sidebarTitle, tag: "sidebar", children: _jsx(AdwToolbarView, { topBar: _jsx(AdwHeaderBar, {}), children: sidebarContent ? (
292
+ minSidebarWidth: 180, maxSidebarWidth: 280, onNotifyShowContent: handleShowContentChanged, sidebar: _jsx(AdwNavigationPage, { title: sidebarTitle, tag: "sidebar", children: _jsx(AdwToolbarView, { topBar:
293
+ // The sidebar pane's own chrome, mounted exactly the way the
294
+ // content HeaderBar below mounts its slots. It used to be a
295
+ // bare `<AdwHeaderBar />` with nothing an app could reach:
296
+ // `examples/tasks-nav` wanted its "New List" button here
297
+ // (where GNOME — and the gtkx tutorial this app family is
298
+ // modelled on — puts a sidebar's add action) and had to move
299
+ // it onto the CONTENT header instead, next to that header's
300
+ // own "New Task" +, leaving the user with two identical plus
301
+ // buttons and no way to tell them apart.
302
+ _jsx(AdwHeaderBar, { titleWidget: sidebarHeaderTitle ? (_jsx(HeaderSlotContent, { children: sidebarHeaderTitle() })) : undefined, start: sidebarHeaderLeft ? (_jsx(HeaderSlotContent, { children: sidebarHeaderLeft() })) : undefined, end: sidebarHeaderRight ? (_jsx(HeaderSlotContent, { children: sidebarHeaderRight() })) : undefined }), children: sidebarContent ? (
229
303
  // The whole pane is the app's, mounted the way a page body
230
304
  // is: a layout root that FILLS the pane, so React Native
231
305
  // content — the common case — behaves as it does anywhere
@@ -286,7 +360,7 @@ const SidebarNavigator = ({ initialRouteName, screenOptions, sidebarTitle = "Sid
286
360
  // examples/gallery passes only titles and had been
287
361
  // paying it since.
288
362
  if (!options.icon && !options.color && !options.count) {
289
- return (_jsx(GtkListBoxRow, { activatable: true, children: _jsx(GtkLabel, { label: titleOf(route.key, route.name), xalign: 0, marginTop: 8, marginBottom: 8, marginStart: 6, marginEnd: 6 }) }, route.key));
363
+ return (_jsx(GtkListBoxRow, { activatable: true, children: _jsx(GtkLabel, { label: titleOf(route.key, route.name), xalign: 0, marginTop: 8, marginBottom: 8 }) }, route.key));
290
364
  }
291
365
  return (_jsx(AdwActionRow, { title: titleOf(route.key, route.name),
292
366
  // AdwActionRow defaults GtkListBoxRow:activatable