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,28 @@
1
+ // react-native-gtkx/worklets — the `react-native-worklets` name, on a
2
+ // platform with one thread.
3
+ //
4
+ // Reanimated 4 moved the worklet surface into its own package, and libraries
5
+ // import it under that name rather than through Reanimated. That is not a
6
+ // detail: `react-native-reanimated-dnd` 2.0.0 pulls `scheduleOnRN` and
7
+ // `scheduleOnUI` out of it at module scope in five of its hooks
8
+ // (useDraggable, useDroppable, useSortable, useHorizontalSortable,
9
+ // useGridSortable) with no `try { require } catch` anywhere, so an unaliased
10
+ // package name fails at IMPORT rather than at use. Aliasing
11
+ // `react-native-reanimated` alone left that wall standing one package over.
12
+ //
13
+ // The surface itself already existed — this module adds the NAME. Both
14
+ // presets alias the package onto it (src/vite/index.ts, src/metro/index.ts),
15
+ // and the thread functions are the very same instance the Reanimated surface
16
+ // exports, so `scheduleOnUI` reached through either package name queues into
17
+ // one batch. Upstream has the same property for the same reason: Reanimated
18
+ // re-exports them from here.
19
+ //
20
+ // What is implemented and what refuses is decided by upstream's own
21
+ // non-native build rather than by us — see surface.ts, which is also where
22
+ // everything that needs no clock lives so unit tests can reach it without
23
+ // GTK. docs/api.md records the boundary.
24
+ import { createWorkletsSurface } from "./surface";
25
+ const { runOnUI, scheduleOnUI, runOnJS, scheduleOnRN, runOnUIAsync } = createWorkletsSurface();
26
+ export { runOnJS, runOnUI, runOnUIAsync, scheduleOnRN, scheduleOnUI };
27
+ export { callMicrotasks, createSerializable, createShareable, createSynchronizable, createWorkletRuntime, executeOnUIRuntimeSync, getDynamicFeatureFlag, getRuntimeKind, getStaticFeatureFlag, getUIRuntimeHolder, getUISchedulerHolder, isBundleModeEnabled, isRNRuntime, isSerializableRef, isShareable, isShareableRef, isSynchronizable, isUIRuntime, isWorkerRuntime, isWorkletFunction, isWorkletRuntime, makeShareable, makeShareableCloneOnUIRecursive, makeShareableCloneRecursive, registerCustomSerializable, runOnRuntime, runOnRuntimeAsync, runOnRuntimeAsyncWithId, runOnRuntimeSync, runOnRuntimeSyncWithId, RuntimeKind, runOnUISync, scheduleOnRuntime, scheduleOnRuntimeWithId, serializableMappingCache, setDynamicFeatureFlag, shareableMappingCache, toggleSlowAnimationsOnUIRuntime, UIRuntimeId, WorkletsModule, } from "./surface";
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/worklets-compat/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4BAA4B;AAC5B,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,gEAAgE;AAChE,mEAAmE;AACnE,6EAA6E;AAC7E,4DAA4D;AAC5D,4EAA4E;AAC5E,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,6BAA6B;AAC7B,EAAE;AACF,oEAAoE;AACpE,2EAA2E;AAC3E,0EAA0E;AAC1E,yCAAyC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,GAClE,qBAAqB,EAAE,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AAErE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,+BAA+B,EAC/B,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAA","sourcesContent":["// react-native-gtkx/worklets — the `react-native-worklets` name, on a\n// platform with one thread.\n//\n// Reanimated 4 moved the worklet surface into its own package, and libraries\n// import it under that name rather than through Reanimated. That is not a\n// detail: `react-native-reanimated-dnd` 2.0.0 pulls `scheduleOnRN` and\n// `scheduleOnUI` out of it at module scope in five of its hooks\n// (useDraggable, useDroppable, useSortable, useHorizontalSortable,\n// useGridSortable) with no `try { require } catch` anywhere, so an unaliased\n// package name fails at IMPORT rather than at use. Aliasing\n// `react-native-reanimated` alone left that wall standing one package over.\n//\n// The surface itself already existed — this module adds the NAME. Both\n// presets alias the package onto it (src/vite/index.ts, src/metro/index.ts),\n// and the thread functions are the very same instance the Reanimated surface\n// exports, so `scheduleOnUI` reached through either package name queues into\n// one batch. Upstream has the same property for the same reason: Reanimated\n// re-exports them from here.\n//\n// What is implemented and what refuses is decided by upstream's own\n// non-native build rather than by us — see surface.ts, which is also where\n// everything that needs no clock lives so unit tests can reach it without\n// GTK. docs/api.md records the boundary.\nimport { createWorkletsSurface } from \"./surface\"\n\nconst { runOnUI, scheduleOnUI, runOnJS, scheduleOnRN, runOnUIAsync } =\n createWorkletsSurface()\n\nexport { runOnJS, runOnUI, runOnUIAsync, scheduleOnRN, scheduleOnUI }\n\nexport {\n callMicrotasks,\n createSerializable,\n createShareable,\n createSynchronizable,\n createWorkletRuntime,\n executeOnUIRuntimeSync,\n getDynamicFeatureFlag,\n getRuntimeKind,\n getStaticFeatureFlag,\n getUIRuntimeHolder,\n getUISchedulerHolder,\n isBundleModeEnabled,\n isRNRuntime,\n isSerializableRef,\n isShareable,\n isShareableRef,\n isSynchronizable,\n isUIRuntime,\n isWorkerRuntime,\n isWorkletFunction,\n isWorkletRuntime,\n makeShareable,\n makeShareableCloneOnUIRecursive,\n makeShareableCloneRecursive,\n registerCustomSerializable,\n runOnRuntime,\n runOnRuntimeAsync,\n runOnRuntimeAsyncWithId,\n runOnRuntimeSync,\n runOnRuntimeSyncWithId,\n RuntimeKind,\n runOnUISync,\n scheduleOnRuntime,\n scheduleOnRuntimeWithId,\n serializableMappingCache,\n setDynamicFeatureFlag,\n shareableMappingCache,\n toggleSlowAnimationsOnUIRuntime,\n UIRuntimeId,\n WorkletsModule,\n} from \"./surface\"\n\nexport type {\n SerializableRef,\n ShareableRef,\n WorkletFunction,\n WorkletRuntime,\n} from \"./surface\"\n"]}
@@ -0,0 +1,110 @@
1
+ /** A function the Babel plugin processed. Never produced on this platform. */
2
+ export type WorkletFunction<Args extends unknown[] = unknown[], ReturnValue = unknown> = ((...args: Args) => ReturnValue) & {
3
+ __workletHash?: number;
4
+ };
5
+ /** Upstream's handle for a runtime that cannot exist here — see the refusals. */
6
+ export type WorkletRuntime = {
7
+ __workletRuntime: true;
8
+ };
9
+ /** Upstream's serializer handle. Identity here: nothing leaves this runtime. */
10
+ export type SerializableRef<T = unknown> = T;
11
+ /** @deprecated Upstream's former name for {@link SerializableRef}. */
12
+ export type ShareableRef<T = unknown> = SerializableRef<T>;
13
+ /**
14
+ * The thread surface. `runOnUI`/`runOnJS`/`scheduleOnUI`/`scheduleOnRN` come
15
+ * from the same `createThreads` the Reanimated surface uses — index.ts hands
16
+ * both modules the SAME instance, so a job queued through either name lands
17
+ * in the same batch, as it does upstream where one package re-exports the
18
+ * other.
19
+ */
20
+ export declare const createWorkletsSurface: () => {
21
+ runOnUIAsync: <A extends unknown[], R>(worklet: (...args: A) => R, ...args: A) => Promise<R>;
22
+ runOnUI: <A extends unknown[]>(worklet: (...args: A) => unknown) => (...args: A) => void;
23
+ scheduleOnUI: <A extends unknown[]>(worklet: (...args: A) => unknown, ...args: A) => void;
24
+ runOnJS: <A extends unknown[]>(fn: (...args: A) => unknown) => (...args: A) => void;
25
+ scheduleOnRN: <A extends unknown[]>(fn: (...args: A) => unknown, ...args: A) => void;
26
+ };
27
+ export { isWorkletFunction } from "../reanimated-compat/threads";
28
+ /**
29
+ * Upstream's runtime taxonomy. There is one runtime here and it is the React
30
+ * Native one — GTK's main loop IS the JS thread — which is exactly what
31
+ * upstream's non-native path reports too: its initializer sets
32
+ * `__RUNTIME_KIND` to `ReactNative` and never changes it.
33
+ */
34
+ export declare enum RuntimeKind {
35
+ ReactNative = 1,
36
+ UI = 2,
37
+ Worker = 3
38
+ }
39
+ export declare const getRuntimeKind: () => RuntimeKind;
40
+ export declare const isRNRuntime: () => boolean;
41
+ export declare const isUIRuntime: () => boolean;
42
+ export declare const isWorkerRuntime: () => boolean;
43
+ export declare const isWorkletRuntime: () => boolean;
44
+ /** Mirrored as data, as upstream's non-native `runtimes.ts` does. */
45
+ export declare const UIRuntimeId: number;
46
+ /**
47
+ * The serializer, which on a single-runtime path is a file of identity
48
+ * functions — a value never leaves the runtime it was made in, so there is
49
+ * nothing to clone and nothing to register.
50
+ */
51
+ export declare const createSerializable: <T>(value: T) => SerializableRef<T>;
52
+ export declare const isSerializableRef: (value: unknown) => boolean;
53
+ export declare const registerCustomSerializable: (registration: unknown) => void;
54
+ export declare const makeShareable: <T>(value: T) => T;
55
+ export declare const makeShareableCloneRecursive: <T>(value: T) => SerializableRef<T>;
56
+ export declare const makeShareableCloneOnUIRecursive: <T>(value: T) => SerializableRef<T>;
57
+ /** @deprecated Upstream's former name for {@link isSerializableRef}. */
58
+ export declare const isShareableRef: (value: unknown) => boolean;
59
+ /** The mapping cache upstream keeps for the serializer, which has nothing to map. */
60
+ export declare const serializableMappingCache: {
61
+ set(serializable: object, ref?: unknown): void;
62
+ get(key: object): unknown;
63
+ };
64
+ /** @deprecated Upstream's former name for {@link serializableMappingCache}. */
65
+ export declare const shareableMappingCache: {
66
+ set(serializable: object, ref?: unknown): void;
67
+ get(key: object): unknown;
68
+ };
69
+ /** Deprecated and a documented no-op upstream, kept callable for source parity. */
70
+ export declare const callMicrotasks: () => void;
71
+ /** Structural checks, portable exactly as upstream writes them. */
72
+ export declare const isShareable: (value: unknown) => boolean;
73
+ export declare const isSynchronizable: (value: unknown) => boolean;
74
+ /**
75
+ * Bundle mode is a Babel/Metro transform of upstream's own plugin, which this
76
+ * platform never runs — so the honest answer is upstream's non-native one.
77
+ */
78
+ export declare const isBundleModeEnabled: () => boolean;
79
+ /** A debug toggle for the UI runtime's clock, which is this platform's only clock. */
80
+ export declare const toggleSlowAnimationsOnUIRuntime: () => boolean;
81
+ /**
82
+ * Feature flags gate upstream's own native experiments. None of them exist
83
+ * here, so every flag reads false and setting one changes nothing — again
84
+ * upstream's non-native answer rather than an invention.
85
+ */
86
+ export declare const getStaticFeatureFlag: (name: string) => boolean;
87
+ export declare const getDynamicFeatureFlag: (name: string) => boolean;
88
+ export declare const setDynamicFeatureFlag: (name: string, value: boolean) => void;
89
+ export declare const createWorkletRuntime: any;
90
+ export declare const runOnRuntime: any;
91
+ export declare const runOnRuntimeAsync: any;
92
+ export declare const runOnRuntimeAsyncWithId: any;
93
+ export declare const runOnRuntimeSync: any;
94
+ export declare const runOnRuntimeSyncWithId: any;
95
+ export declare const scheduleOnRuntime: any;
96
+ export declare const scheduleOnRuntimeWithId: any;
97
+ export declare const getUIRuntimeHolder: any;
98
+ export declare const getUISchedulerHolder: any;
99
+ export declare const runOnUISync: any;
100
+ export declare const executeOnUIRuntimeSync: any;
101
+ export declare const createShareable: any;
102
+ export declare const createSynchronizable: any;
103
+ /**
104
+ * The TurboModule behind the whole package. Upstream's non-native build
105
+ * exports it as `null`, which fails as "cannot read properties of null" and
106
+ * names nothing; this refuses by name instead. The one deliberate deviation
107
+ * from the mirror rule above, and it can only ever turn a worse error into a
108
+ * better one — nothing that works against `null` works against a refusal.
109
+ */
110
+ export declare const WorkletsModule: any;
@@ -0,0 +1,153 @@
1
+ // The pure half of the `react-native-worklets` mirror: the whole surface, and
2
+ // the factory behind the thread functions.
3
+ //
4
+ // Split from index.ts because index.ts is the module both presets alias the
5
+ // PACKAGE NAME onto, and a unit test wants the surface without the name. Every
6
+ // export here is reachable from a machine with no GTK on it.
7
+ //
8
+ // THE RULE THIS FILE FOLLOWS, and it is the whole design: mirror upstream's
9
+ // own NON-NATIVE implementation — the `.ts` files next to its `.native.ts`
10
+ // ones, which are what react-native-windows and the web run. Where that file
11
+ // computes something, this one computes the same thing; where it throws, this
12
+ // one refuses by name. That is not a shortcut, it is the only boundary with a
13
+ // source of truth: a worklet runtime is structural, and upstream agrees.
14
+ // Measured against react-native-worklets 0.11.3.
15
+ //
16
+ // The one place that rule is deliberately NOT followed is HOW LATE a UI hop
17
+ // lands: upstream's non-native build waits for a `requestAnimationFrame` and
18
+ // this one does not. See reanimated-compat/threads.ts — the web's rAF stands
19
+ // in for a UI runtime it has not got, React Native's real one does not wait
20
+ // for a frame, and waiting here broke a measurement round trip.
21
+ import { createThreads } from "../reanimated-compat/threads";
22
+ import { createUnsupportedFactory } from "../unsupported-export";
23
+ /**
24
+ * The thread surface. `runOnUI`/`runOnJS`/`scheduleOnUI`/`scheduleOnRN` come
25
+ * from the same `createThreads` the Reanimated surface uses — index.ts hands
26
+ * both modules the SAME instance, so a job queued through either name lands
27
+ * in the same batch, as it does upstream where one package re-exports the
28
+ * other.
29
+ */
30
+ export const createWorkletsSurface = () => {
31
+ const threads = createThreads();
32
+ /**
33
+ * Upstream's `runOnUIAsync` resolves with the worklet's return value when
34
+ * the UI hop runs it — the one thread API that hands anything back, because
35
+ * a promise crosses the deferral the others impose.
36
+ */
37
+ const runOnUIAsync = (worklet, ...args) => new Promise((resolve) => {
38
+ threads.scheduleOnUI(() => {
39
+ resolve(worklet(...args));
40
+ });
41
+ });
42
+ return { ...threads, runOnUIAsync };
43
+ };
44
+ // --- the pure surface ----------------------------------------------------
45
+ export { isWorkletFunction } from "../reanimated-compat/threads";
46
+ /**
47
+ * Upstream's runtime taxonomy. There is one runtime here and it is the React
48
+ * Native one — GTK's main loop IS the JS thread — which is exactly what
49
+ * upstream's non-native path reports too: its initializer sets
50
+ * `__RUNTIME_KIND` to `ReactNative` and never changes it.
51
+ */
52
+ export var RuntimeKind;
53
+ (function (RuntimeKind) {
54
+ RuntimeKind[RuntimeKind["ReactNative"] = 1] = "ReactNative";
55
+ RuntimeKind[RuntimeKind["UI"] = 2] = "UI";
56
+ RuntimeKind[RuntimeKind["Worker"] = 3] = "Worker";
57
+ })(RuntimeKind || (RuntimeKind = {}));
58
+ export const getRuntimeKind = () => RuntimeKind.ReactNative;
59
+ export const isRNRuntime = () => true;
60
+ export const isUIRuntime = () => false;
61
+ export const isWorkerRuntime = () => false;
62
+ export const isWorkletRuntime = () => false;
63
+ /** Mirrored as data, as upstream's non-native `runtimes.ts` does. */
64
+ export const UIRuntimeId = RuntimeKind.UI;
65
+ /**
66
+ * The serializer, which on a single-runtime path is a file of identity
67
+ * functions — a value never leaves the runtime it was made in, so there is
68
+ * nothing to clone and nothing to register.
69
+ */
70
+ // The ones that ignore their argument are typed as a signature and
71
+ // implemented without parameters: the CALL shape is what matters to a
72
+ // consumer, and a named-but-unused parameter is only there to be linted.
73
+ export const createSerializable = (value) => value;
74
+ export const isSerializableRef = () => true;
75
+ export const registerCustomSerializable = () => { };
76
+ export const makeShareable = (value) => value;
77
+ export const makeShareableCloneRecursive = (value) => value;
78
+ export const makeShareableCloneOnUIRecursive = (value) => value;
79
+ /** @deprecated Upstream's former name for {@link isSerializableRef}. */
80
+ export const isShareableRef = isSerializableRef;
81
+ /** The mapping cache upstream keeps for the serializer, which has nothing to map. */
82
+ export const serializableMappingCache = {
83
+ set: () => { },
84
+ get: () => null,
85
+ };
86
+ /** @deprecated Upstream's former name for {@link serializableMappingCache}. */
87
+ export const shareableMappingCache = serializableMappingCache;
88
+ /** Deprecated and a documented no-op upstream, kept callable for source parity. */
89
+ export const callMicrotasks = () => { };
90
+ /** Structural checks, portable exactly as upstream writes them. */
91
+ export const isShareable = (value) => typeof value === "object" &&
92
+ value !== null &&
93
+ !!value.__shareableRef;
94
+ export const isSynchronizable = (value) => typeof value === "object" &&
95
+ value !== null &&
96
+ !!value.__synchronizableRef;
97
+ /**
98
+ * Bundle mode is a Babel/Metro transform of upstream's own plugin, which this
99
+ * platform never runs — so the honest answer is upstream's non-native one.
100
+ */
101
+ export const isBundleModeEnabled = () => false;
102
+ /** A debug toggle for the UI runtime's clock, which is this platform's only clock. */
103
+ export const toggleSlowAnimationsOnUIRuntime = () => false;
104
+ /**
105
+ * Feature flags gate upstream's own native experiments. None of them exist
106
+ * here, so every flag reads false and setting one changes nothing — again
107
+ * upstream's non-native answer rather than an invention.
108
+ */
109
+ export const getStaticFeatureFlag = () => false;
110
+ export const getDynamicFeatureFlag = () => false;
111
+ export const setDynamicFeatureFlag = () => { };
112
+ // --- the refusals --------------------------------------------------------
113
+ //
114
+ // Exactly the exports whose non-native implementation upstream ships as a
115
+ // `throw`. Enumerated by hand rather than produced by a Proxy over the module,
116
+ // because ESM named imports resolve statically: a symbol missing from the
117
+ // module fails at BUILD time with "no export named X", and only the names
118
+ // here can produce the descriptive runtime message.
119
+ const unsupported = createUnsupportedFactory("react-native-worklets", "Implemented here: runOnUI/scheduleOnUI/runOnJS/scheduleOnRN/runOnUIAsync, isWorkletFunction, " +
120
+ "the serializer (identity — nothing leaves this runtime) and the runtime-kind checks. " +
121
+ "What is not is a SECOND runtime: this platform has one thread, GTK's main loop, " +
122
+ "and upstream's own non-native build throws for these too. See docs/api.md.");
123
+ /* eslint-disable @typescript-eslint/no-explicit-any */
124
+ // --- a second runtime, which is structural by definition ---
125
+ export const createWorkletRuntime = unsupported("createWorkletRuntime");
126
+ export const runOnRuntime = unsupported("runOnRuntime");
127
+ export const runOnRuntimeAsync = unsupported("runOnRuntimeAsync");
128
+ export const runOnRuntimeAsyncWithId = unsupported("runOnRuntimeAsyncWithId");
129
+ export const runOnRuntimeSync = unsupported("runOnRuntimeSync");
130
+ export const runOnRuntimeSyncWithId = unsupported("runOnRuntimeSyncWithId");
131
+ export const scheduleOnRuntime = unsupported("scheduleOnRuntime");
132
+ export const scheduleOnRuntimeWithId = unsupported("scheduleOnRuntimeWithId");
133
+ export const getUIRuntimeHolder = unsupported("getUIRuntimeHolder");
134
+ export const getUISchedulerHolder = unsupported("getUISchedulerHolder");
135
+ // --- synchronous hops across a boundary that is not there ---
136
+ // Both are the "run it over there and give me the answer now" pair, and both
137
+ // throw upstream on every single-runtime build. Deferring instead would be
138
+ // worse than refusing: the caller wants the RETURN VALUE, and a deferred call
139
+ // has none.
140
+ export const runOnUISync = unsupported("runOnUISync");
141
+ export const executeOnUIRuntimeSync = unsupported("executeOnUIRuntimeSync");
142
+ // --- memory shared between runtimes ---
143
+ export const createShareable = unsupported("createShareable");
144
+ export const createSynchronizable = unsupported("createSynchronizable");
145
+ /**
146
+ * The TurboModule behind the whole package. Upstream's non-native build
147
+ * exports it as `null`, which fails as "cannot read properties of null" and
148
+ * names nothing; this refuses by name instead. The one deliberate deviation
149
+ * from the mirror rule above, and it can only ever turn a worse error into a
150
+ * better one — nothing that works against `null` works against a refusal.
151
+ */
152
+ export const WorkletsModule = unsupported("WorkletsModule");
153
+ //# sourceMappingURL=surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/worklets-compat/surface.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,iDAAiD;AACjD,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,gEAAgE;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAiBhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAA;IAE/B;;;;OAIG;IACH,MAAM,YAAY,GAAG,CACnB,OAA0B,EAC1B,GAAG,IAAO,EACE,EAAE,CACd,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE;QACzB,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE;YAC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AAQ,WAAW,CAAC,iBAAiB,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAQ,WAAW,CAAC,sBAAsB,CAAC,CAAA;AAE5E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAQ,WAAW,CAAC,gBAAgB,CAAC,CAAA","sourcesContent":["// The pure half of the `react-native-worklets` mirror: the whole surface, and\n// the factory behind the thread functions.\n//\n// Split from index.ts because index.ts is the module both presets alias the\n// PACKAGE NAME onto, and a unit test wants the surface without the name. Every\n// export here is reachable from a machine with no GTK on it.\n//\n// THE RULE THIS FILE FOLLOWS, and it is the whole design: mirror upstream's\n// own NON-NATIVE implementation — the `.ts` files next to its `.native.ts`\n// ones, which are what react-native-windows and the web run. Where that file\n// computes something, this one computes the same thing; where it throws, this\n// one refuses by name. That is not a shortcut, it is the only boundary with a\n// source of truth: a worklet runtime is structural, and upstream agrees.\n// Measured against react-native-worklets 0.11.3.\n//\n// The one place that rule is deliberately NOT followed is HOW LATE a UI hop\n// lands: upstream's non-native build waits for a `requestAnimationFrame` and\n// this one does not. See reanimated-compat/threads.ts — the web's rAF stands\n// in for a UI runtime it has not got, React Native's real one does not wait\n// for a frame, and waiting here broke a measurement round trip.\nimport { createThreads } from \"../reanimated-compat/threads\"\nimport { createUnsupportedFactory } from \"../unsupported-export\"\n\n/** A function the Babel plugin processed. Never produced on this platform. */\nexport type WorkletFunction<\n Args extends unknown[] = unknown[],\n ReturnValue = unknown,\n> = ((...args: Args) => ReturnValue) & { __workletHash?: number }\n\n/** Upstream's handle for a runtime that cannot exist here — see the refusals. */\nexport type WorkletRuntime = { __workletRuntime: true }\n\n/** Upstream's serializer handle. Identity here: nothing leaves this runtime. */\nexport type SerializableRef<T = unknown> = T\n\n/** @deprecated Upstream's former name for {@link SerializableRef}. */\nexport type ShareableRef<T = unknown> = SerializableRef<T>\n\n/**\n * The thread surface. `runOnUI`/`runOnJS`/`scheduleOnUI`/`scheduleOnRN` come\n * from the same `createThreads` the Reanimated surface uses — index.ts hands\n * both modules the SAME instance, so a job queued through either name lands\n * in the same batch, as it does upstream where one package re-exports the\n * other.\n */\nexport const createWorkletsSurface = () => {\n const threads = createThreads()\n\n /**\n * Upstream's `runOnUIAsync` resolves with the worklet's return value when\n * the UI hop runs it — the one thread API that hands anything back, because\n * a promise crosses the deferral the others impose.\n */\n const runOnUIAsync = <A extends unknown[], R>(\n worklet: (...args: A) => R,\n ...args: A\n ): Promise<R> =>\n new Promise<R>((resolve) => {\n threads.scheduleOnUI(() => {\n resolve(worklet(...args))\n })\n })\n\n return { ...threads, runOnUIAsync }\n}\n\n// --- the pure surface ----------------------------------------------------\n\nexport { isWorkletFunction } from \"../reanimated-compat/threads\"\n\n/**\n * Upstream's runtime taxonomy. There is one runtime here and it is the React\n * Native one — GTK's main loop IS the JS thread — which is exactly what\n * upstream's non-native path reports too: its initializer sets\n * `__RUNTIME_KIND` to `ReactNative` and never changes it.\n */\nexport enum RuntimeKind {\n ReactNative = 1,\n UI = 2,\n Worker = 3,\n}\n\nexport const getRuntimeKind = (): RuntimeKind => RuntimeKind.ReactNative\nexport const isRNRuntime = (): boolean => true\nexport const isUIRuntime = (): boolean => false\nexport const isWorkerRuntime = (): boolean => false\nexport const isWorkletRuntime = (): boolean => false\n\n/** Mirrored as data, as upstream's non-native `runtimes.ts` does. */\nexport const UIRuntimeId: number = RuntimeKind.UI\n\n/**\n * The serializer, which on a single-runtime path is a file of identity\n * functions — a value never leaves the runtime it was made in, so there is\n * nothing to clone and nothing to register.\n */\n// The ones that ignore their argument are typed as a signature and\n// implemented without parameters: the CALL shape is what matters to a\n// consumer, and a named-but-unused parameter is only there to be linted.\nexport const createSerializable = <T>(value: T): SerializableRef<T> => value\nexport const isSerializableRef: (value: unknown) => boolean = () => true\nexport const registerCustomSerializable: (\n registration: unknown,\n) => void = () => {}\nexport const makeShareable = <T>(value: T): T => value\nexport const makeShareableCloneRecursive = <T>(value: T): SerializableRef<T> =>\n value\nexport const makeShareableCloneOnUIRecursive = <T>(\n value: T,\n): SerializableRef<T> => value\n/** @deprecated Upstream's former name for {@link isSerializableRef}. */\nexport const isShareableRef = isSerializableRef\n\n/** The mapping cache upstream keeps for the serializer, which has nothing to map. */\nexport const serializableMappingCache: {\n set(serializable: object, ref?: unknown): void\n get(key: object): unknown\n} = {\n set: () => {},\n get: () => null,\n}\n/** @deprecated Upstream's former name for {@link serializableMappingCache}. */\nexport const shareableMappingCache = serializableMappingCache\n\n/** Deprecated and a documented no-op upstream, kept callable for source parity. */\nexport const callMicrotasks = (): void => {}\n\n/** Structural checks, portable exactly as upstream writes them. */\nexport const isShareable = (value: unknown): boolean =>\n typeof value === \"object\" &&\n value !== null &&\n !!(value as Record<string, unknown>).__shareableRef\n\nexport const isSynchronizable = (value: unknown): boolean =>\n typeof value === \"object\" &&\n value !== null &&\n !!(value as Record<string, unknown>).__synchronizableRef\n\n/**\n * Bundle mode is a Babel/Metro transform of upstream's own plugin, which this\n * platform never runs — so the honest answer is upstream's non-native one.\n */\nexport const isBundleModeEnabled = (): boolean => false\n\n/** A debug toggle for the UI runtime's clock, which is this platform's only clock. */\nexport const toggleSlowAnimationsOnUIRuntime = (): boolean => false\n\n/**\n * Feature flags gate upstream's own native experiments. None of them exist\n * here, so every flag reads false and setting one changes nothing — again\n * upstream's non-native answer rather than an invention.\n */\nexport const getStaticFeatureFlag: (name: string) => boolean = () => false\nexport const getDynamicFeatureFlag: (name: string) => boolean = () => false\nexport const setDynamicFeatureFlag: (\n name: string,\n value: boolean,\n) => void = () => {}\n\n// --- the refusals --------------------------------------------------------\n//\n// Exactly the exports whose non-native implementation upstream ships as a\n// `throw`. Enumerated by hand rather than produced by a Proxy over the module,\n// because ESM named imports resolve statically: a symbol missing from the\n// module fails at BUILD time with \"no export named X\", and only the names\n// here can produce the descriptive runtime message.\n\nconst unsupported = createUnsupportedFactory(\n \"react-native-worklets\",\n \"Implemented here: runOnUI/scheduleOnUI/runOnJS/scheduleOnRN/runOnUIAsync, isWorkletFunction, \" +\n \"the serializer (identity — nothing leaves this runtime) and the runtime-kind checks. \" +\n \"What is not is a SECOND runtime: this platform has one thread, GTK's main loop, \" +\n \"and upstream's own non-native build throws for these too. See docs/api.md.\",\n)\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n// --- a second runtime, which is structural by definition ---\nexport const createWorkletRuntime: any = unsupported(\"createWorkletRuntime\")\nexport const runOnRuntime: any = unsupported(\"runOnRuntime\")\nexport const runOnRuntimeAsync: any = unsupported(\"runOnRuntimeAsync\")\nexport const runOnRuntimeAsyncWithId: any = unsupported(\n \"runOnRuntimeAsyncWithId\",\n)\nexport const runOnRuntimeSync: any = unsupported(\"runOnRuntimeSync\")\nexport const runOnRuntimeSyncWithId: any = unsupported(\"runOnRuntimeSyncWithId\")\nexport const scheduleOnRuntime: any = unsupported(\"scheduleOnRuntime\")\nexport const scheduleOnRuntimeWithId: any = unsupported(\n \"scheduleOnRuntimeWithId\",\n)\nexport const getUIRuntimeHolder: any = unsupported(\"getUIRuntimeHolder\")\nexport const getUISchedulerHolder: any = unsupported(\"getUISchedulerHolder\")\n\n// --- synchronous hops across a boundary that is not there ---\n// Both are the \"run it over there and give me the answer now\" pair, and both\n// throw upstream on every single-runtime build. Deferring instead would be\n// worse than refusing: the caller wants the RETURN VALUE, and a deferred call\n// has none.\nexport const runOnUISync: any = unsupported(\"runOnUISync\")\nexport const executeOnUIRuntimeSync: any = unsupported(\"executeOnUIRuntimeSync\")\n\n// --- memory shared between runtimes ---\nexport const createShareable: any = unsupported(\"createShareable\")\nexport const createSynchronizable: any = unsupported(\"createSynchronizable\")\n\n/**\n * The TurboModule behind the whole package. Upstream's non-native build\n * exports it as `null`, which fails as \"cannot read properties of null\" and\n * names nothing; this refuses by name instead. The one deliberate deviation\n * from the mirror rule above, and it can only ever turn a worse error into a\n * better one — nothing that works against `null` works against a refusal.\n */\nexport const WorkletsModule: any = unsupported(\"WorkletsModule\")\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gtkx",
3
- "version": "0.2.0-alpha.2",
3
+ "version": "0.3.0-alpha.1",
4
4
  "description": "React Native components and APIs for Linux desktop, rendered as native GTK4 widgets via gtkx",
5
5
  "license": "MIT",
6
6
  "author": "Anton Petrov <anton@itsmepetrov.com>",
@@ -63,6 +63,22 @@
63
63
  "types": "./dist/common/index.d.ts",
64
64
  "default": "./dist/common/index.js"
65
65
  },
66
+ "./dnd": {
67
+ "types": "./dist/dnd/index.d.ts",
68
+ "default": "./dist/dnd/index.js"
69
+ },
70
+ "./gesture-handler": {
71
+ "types": "./dist/gesture-handler-compat/index.d.ts",
72
+ "default": "./dist/gesture-handler-compat/index.js"
73
+ },
74
+ "./reanimated": {
75
+ "types": "./dist/reanimated-compat/index.d.ts",
76
+ "default": "./dist/reanimated-compat/index.js"
77
+ },
78
+ "./worklets": {
79
+ "types": "./dist/worklets-compat/index.d.ts",
80
+ "default": "./dist/worklets-compat/index.js"
81
+ },
66
82
  "./mcp": {
67
83
  "types": "./dist/mcp/index.d.ts",
68
84
  "default": "./dist/mcp/index.js"
@@ -110,14 +126,14 @@
110
126
  }
111
127
  },
112
128
  "dependencies": {
113
- "@gtkx/cli": "1.0.0-rc.3",
114
- "@gtkx/codegen": "1.0.0-rc.3",
115
- "@gtkx/config": "1.0.0-rc.3",
116
- "@gtkx/css": "1.0.0-rc.3",
117
- "@gtkx/react": "1.0.0-rc.3",
118
- "@gtkx/runtime": "1.0.0-rc.3",
119
- "@gtkx/testing": "1.0.0-rc.3",
120
- "@gtkx/vitest": "1.0.0-rc.3",
129
+ "@gtkx/cli": "1.0.0-rc.4",
130
+ "@gtkx/codegen": "1.0.0-rc.4",
131
+ "@gtkx/config": "1.0.0-rc.4",
132
+ "@gtkx/css": "1.0.0-rc.4",
133
+ "@gtkx/react": "1.0.0-rc.4",
134
+ "@gtkx/runtime": "1.0.0-rc.4",
135
+ "@gtkx/testing": "1.0.0-rc.4",
136
+ "@gtkx/vitest": "1.0.0-rc.4",
121
137
  "@modelcontextprotocol/sdk": "^1.30.0",
122
138
  "rolldown": "^1.1.5",
123
139
  "yoga-layout": "^3.2.1",
package/types.d.ts CHANGED
@@ -48,8 +48,17 @@ declare module "react-native" {
48
48
  // OPTIONAL on purpose: an app sharing one component with ios/android
49
49
  // gets `undefined` there, and the type should say so — write
50
50
  // `hovered && styles.hovered`, which is correct on every platform.
51
+ //
52
+ // `focused` is here for the same reason and was missing: this platform
53
+ // reports it (GTK owns keyboard focus, and an activatable row draws
54
+ // Adwaita's focus ring from it — see docs/api.md), the stock type does
55
+ // not carry it, and an app that renders a focus ring in shared code had
56
+ // no way to name it. Found by moving `examples/tasks-nav`'s boxed list
57
+ // out of the platform package and into the app, where it stopped being
58
+ // typed by this package and started being typed by the stock types.
51
59
  interface PressableStateCallbackType {
52
60
  hovered?: boolean
61
+ focused?: boolean
53
62
  }
54
63
  }
55
64
 
@@ -1,82 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { StyleProp } from "../contracts";
3
- /**
4
- * Where a row sits in its list, which is what decides its corner radii and
5
- * whether it draws a separator under itself.
6
- *
7
- * RN has no `:first-child`, so this is explicit. From a `FlatList` it is
8
- * `rowPosition(index, data.length)`; from a static list it is the same
9
- * expression over the array.
10
- */
11
- export type ListRowPosition = "first" | "middle" | "last" | "only";
12
- /** The usual derivation, so no call site has to get the one-row case wrong. */
13
- export declare const rowPosition: (index: number, count: number) => ListRowPosition;
14
- export type ListProps = {
15
- children?: ReactNode;
16
- style?: StyleProp;
17
- testID?: string;
18
- };
19
- /**
20
- * The `.boxed-list` frame: a rounded, shadowed card. Put `ListRow`s in it
21
- * directly, or a `FlatList` whose `renderItem` returns them.
22
- *
23
- * ```tsx
24
- * <List>
25
- * {tasks.map((task, index) => (
26
- * <ListRow
27
- * key={task.id}
28
- * title={task.title}
29
- * position={rowPosition(index, tasks.length)}
30
- * onPress={() => open(task)}
31
- * />
32
- * ))}
33
- * </List>
34
- * ```
35
- */
36
- export declare const List: ({ children, style, testID }: ListProps) => ReactNode;
37
- export type ListRowProps = {
38
- /** Primary line. A string renders with the row's own typography; a node is
39
- * rendered as given, for a title that needs its own styling. */
40
- title?: ReactNode;
41
- /** Second, dimmed line. Omitted rows are single-line, as `AdwActionRow`'s
42
- * are. */
43
- subtitle?: ReactNode;
44
- /** Leading content — a checkbox, an icon, a colour swatch. */
45
- prefix?: ReactNode;
46
- /** Trailing content — buttons, a value, a chevron. */
47
- suffix?: ReactNode;
48
- /** Makes the row activatable: it gains the hover and press tints and calls
49
- * this. Without it the row is inert, like a non-`activatable`
50
- * `AdwActionRow`. */
51
- onPress?: () => void;
52
- /** Position in the list, for the corner radii and the separator. Defaults
53
- * to `"middle"`, which is right for a row that is neither. */
54
- position?: ListRowPosition;
55
- /** Draw the hairline under this row. Default true for every position except
56
- * the last — set it false when the list supplies its own separators (a
57
- * `FlatList`'s `ItemSeparatorComponent`, say). */
58
- separator?: boolean;
59
- style?: StyleProp;
60
- testID?: string;
61
- };
62
- /**
63
- * One row of a {@link List} — `AdwActionRow`'s layout and states, built from
64
- * `Pressable`, `View` and `Text`.
65
- *
66
- * Hover and press come from `Pressable`'s state callback, so they cost what
67
- * they cost anywhere else in this platform: the hover path swaps a CSS class
68
- * on the widget without a React render (see components/pressable.tsx).
69
- *
70
- * **Not yet:** keyboard navigation between rows and a focus ring.
71
- * `GtkListBox` implements those as widget behaviour and RN has no focus model
72
- * for `View` to hang them on — `Pressable`'s state is `{pressed, hovered}`
73
- * with no `focused`. The ring itself is now drawable (`outlineWidth` and
74
- * friends), so what is missing is the state, not the paint.
75
- */
76
- export declare const ListRow: ({ title, subtitle, prefix, suffix, onPress, position, separator, style, testID, }: ListRowProps) => ReactNode;
77
- /**
78
- * The hairline between two rows, for lists that draw their own separators —
79
- * a `FlatList`'s `ItemSeparatorComponent` is exactly this, and using it means
80
- * the rows themselves stay position-agnostic apart from their corners.
81
- */
82
- export declare const ListSeparator: () => ReactNode;