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,57 @@
1
+ // `useAnimatedRef` and `measure`.
2
+ //
3
+ // Upstream's `measure()` is synchronous but may only be called INSIDE a
4
+ // worklet, because only the UI thread holds the current shadow tree. Here it
5
+ // is synchronous for a simpler reason — there is one thread, and the
6
+ // platform's own `measure()` already invokes its callback before returning.
7
+ // So it works from anywhere, which is strictly more permissive than upstream
8
+ // and needs no worklet.
9
+ //
10
+ // It still returns null before the first committed layout. That is not a
11
+ // shortcut: it is RN's contract, which the platform implements faithfully —
12
+ // a view whose rect has not been committed, or that is not in a window, has
13
+ // nothing true to report, and RN answers by not calling back rather than by
14
+ // inventing a number.
15
+ import { useState } from "react";
16
+ // useState, not a lazily-filled useRef: the ref is READ during render (it is
17
+ // the hook's return value), and reading a ref during render is exactly what
18
+ // react-hooks/refs exists to stop. Upstream's own `useSharedValue` reaches
19
+ // for useState for the same reason.
20
+ export const useAnimatedRef = () => {
21
+ const [animatedRef] = useState(() => {
22
+ const handle = ((instance) => {
23
+ if (instance === undefined) {
24
+ return handle.current;
25
+ }
26
+ // Cleared on unmount (React passes null), unlike upstream, which keeps
27
+ // the last instance forever. Measuring a widget that has been freed is
28
+ // not a measurement worth having.
29
+ handle.current = instance;
30
+ return undefined;
31
+ });
32
+ handle.current = null;
33
+ return handle;
34
+ });
35
+ return animatedRef;
36
+ };
37
+ /**
38
+ * Reads a view's geometry: its own size, its position in its parent and its
39
+ * position in the window. Returns null when the view is not mounted or its
40
+ * layout has not been committed yet.
41
+ */
42
+ export const measure = (animatedRef) => {
43
+ if (!animatedRef) {
44
+ return null;
45
+ }
46
+ const instance = typeof animatedRef === "function" ? animatedRef() : animatedRef.current;
47
+ const handle = instance;
48
+ if (!handle || typeof handle.measure !== "function") {
49
+ return null;
50
+ }
51
+ let measured = null;
52
+ handle.measure((x, y, width, height, pageX, pageY) => {
53
+ measured = { x, y, width, height, pageX, pageY };
54
+ });
55
+ return measured;
56
+ };
57
+ //# sourceMappingURL=animated-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animated-ref.js","sourceRoot":"","sources":["../../src/reanimated-compat/animated-ref.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,wBAAwB;AACxB,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,sBAAsB;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AA2BhC,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,oCAAoC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAsC,EAAE;IACpE,MAAM,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAiB,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,CAAC,CAAC,QAAmB,EAAE,EAAE;YACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,OAAO,MAAM,CAAC,OAAO,CAAA;YACvB,CAAC;YACD,uEAAuE;YACvE,uEAAuE;YACvE,kCAAkC;YAClC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAA;YACzB,OAAO,SAAS,CAAA;QAClB,CAAC,CAAmB,CAAA;QACpB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;QACrB,OAAO,MAAM,CAAA;IACf,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAID;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,WAAsE,EAC3C,EAAE;IAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,QAAQ,GACZ,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAA;IACzE,MAAM,MAAM,GAAG,QAA6B,CAAA;IAC5C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,QAAQ,GAA8B,IAAI,CAAA;IAC9C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACnD,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IAClD,CAAC,CAAC,CAAA;IACF,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["// `useAnimatedRef` and `measure`.\n//\n// Upstream's `measure()` is synchronous but may only be called INSIDE a\n// worklet, because only the UI thread holds the current shadow tree. Here it\n// is synchronous for a simpler reason — there is one thread, and the\n// platform's own `measure()` already invokes its callback before returning.\n// So it works from anywhere, which is strictly more permissive than upstream\n// and needs no worklet.\n//\n// It still returns null before the first committed layout. That is not a\n// shortcut: it is RN's contract, which the platform implements faithfully —\n// a view whose rect has not been committed, or that is not in a window, has\n// nothing true to report, and RN answers by not calling back rather than by\n// inventing a number.\nimport { useState } from \"react\"\nimport type { MeasureHandle } from \"../components/measure\"\n\n/**\n * A ref that is also callable, as upstream's is: React sets it through the\n * call, and `measure()` reads it back through a call with no argument.\n *\n * The no-argument read is this platform's own shape rather than upstream's.\n * Upstream's callback ref RETURNS the instance, which React 19 reads as a\n * callback-ref cleanup value and complains about; discriminating on the\n * argument keeps both callers working and keeps React quiet.\n */\nexport type AnimatedRef<T> = {\n (): T | null\n (instance: T | null): void\n current: T | null\n}\n\nexport type MeasuredDimensions = {\n x: number\n y: number\n width: number\n height: number\n pageX: number\n pageY: number\n}\n\n// useState, not a lazily-filled useRef: the ref is READ during render (it is\n// the hook's return value), and reading a ref during render is exactly what\n// react-hooks/refs exists to stop. Upstream's own `useSharedValue` reaches\n// for useState for the same reason.\nexport const useAnimatedRef = <T = MeasureHandle>(): AnimatedRef<T> => {\n const [animatedRef] = useState<AnimatedRef<T>>(() => {\n const handle = ((instance?: T | null) => {\n if (instance === undefined) {\n return handle.current\n }\n // Cleared on unmount (React passes null), unlike upstream, which keeps\n // the last instance forever. Measuring a widget that has been freed is\n // not a measurement worth having.\n handle.current = instance\n return undefined\n }) as AnimatedRef<T>\n handle.current = null\n return handle\n })\n return animatedRef\n}\n\ntype Measurable = Partial<MeasureHandle>\n\n/**\n * Reads a view's geometry: its own size, its position in its parent and its\n * position in the window. Returns null when the view is not mounted or its\n * layout has not been committed yet.\n */\nexport const measure = <T>(\n animatedRef: AnimatedRef<T> | { current: T | null } | null | undefined,\n): MeasuredDimensions | null => {\n if (!animatedRef) {\n return null\n }\n const instance =\n typeof animatedRef === \"function\" ? animatedRef() : animatedRef.current\n const handle = instance as Measurable | null\n if (!handle || typeof handle.measure !== \"function\") {\n return null\n }\n let measured: MeasuredDimensions | null = null\n handle.measure((x, y, width, height, pageX, pageY) => {\n measured = { x, y, width, height, pageX, pageY }\n })\n return measured\n}\n"]}
@@ -0,0 +1,177 @@
1
+ import { type AnimatedApi, type AnimatedValue, type CompositeAnimation, type FrameScheduler } from "../animated/index";
2
+ import { resolveDecayConfig, type WithDecayConfig } from "./decay";
3
+ import { type EasingFunction } from "./easing";
4
+ /** Called when an animation settles or is cancelled, as upstream. */
5
+ export type AnimationCallback = (finished?: boolean, current?: number) => void;
6
+ export type WithTimingConfig = {
7
+ duration?: number;
8
+ easing?: EasingFunction | {
9
+ factory: () => EasingFunction;
10
+ };
11
+ };
12
+ /**
13
+ * Upstream's config is a mutually exclusive union: either the physical
14
+ * parameterisation (`stiffness`/`damping`) or the perceptual one
15
+ * (`duration`/`dampingRatio`). Both are accepted here and normalised into the
16
+ * physical one, which is what the platform's spring solver takes.
17
+ */
18
+ export type WithSpringConfig = {
19
+ mass?: number;
20
+ stiffness?: number;
21
+ damping?: number;
22
+ duration?: number;
23
+ dampingRatio?: number;
24
+ clamp?: {
25
+ min?: number;
26
+ max?: number;
27
+ };
28
+ velocity?: number;
29
+ overshootClamping?: boolean;
30
+ energyThreshold?: number;
31
+ };
32
+ type TimingSpec = {
33
+ kind: "timing";
34
+ toValue: number;
35
+ config: WithTimingConfig;
36
+ callback?: AnimationCallback;
37
+ };
38
+ type SpringSpec = {
39
+ kind: "spring";
40
+ toValue: number;
41
+ config: WithSpringConfig;
42
+ callback?: AnimationCallback;
43
+ };
44
+ type DelaySpec = {
45
+ kind: "delay";
46
+ delayMs: number;
47
+ animation: AnimationSpec;
48
+ };
49
+ type SequenceSpec = {
50
+ kind: "sequence";
51
+ animations: AnimationSpec[];
52
+ };
53
+ type RepeatSpec = {
54
+ kind: "repeat";
55
+ animation: AnimationSpec;
56
+ numberOfReps: number;
57
+ reverse: boolean;
58
+ callback?: AnimationCallback;
59
+ };
60
+ type DecaySpec = {
61
+ kind: "decay";
62
+ config: ReturnType<typeof resolveDecayConfig>;
63
+ callback?: AnimationCallback;
64
+ };
65
+ type ClampSpec = {
66
+ kind: "clamp";
67
+ min?: number;
68
+ max?: number;
69
+ animation: AnimationSpec;
70
+ };
71
+ export type AnimationSpec = TimingSpec | SpringSpec | DelaySpec | SequenceSpec | RepeatSpec | DecaySpec | ClampSpec;
72
+ export declare const isAnimationSpec: (value: unknown) => value is AnimationSpec;
73
+ /**
74
+ * Runs an updater in "seed the value" mode, where every animation collapses
75
+ * to the value it would have finished at.
76
+ */
77
+ export declare const initialUpdaterRun: <T>(updater: () => T) => T;
78
+ /**
79
+ * Lets you animate a value over a duration with an easing curve. Assign the
80
+ * result to a shared value to start it.
81
+ */
82
+ export declare const withTiming: (toValue: number, config?: WithTimingConfig, callback?: AnimationCallback) => number;
83
+ /** Lets you animate a value with spring physics. */
84
+ export declare const withSpring: (toValue: number, config?: WithSpringConfig, callback?: AnimationCallback) => number;
85
+ /** Delays another animation by `delayMs`. */
86
+ export declare const withDelay: (delayMs: number, animation: number) => number;
87
+ /** Runs animations one after another on the same shared value. */
88
+ export declare const withSequence: (...animations: number[]) => number;
89
+ /**
90
+ * Repeats an animation. `numberOfReps <= 0` repeats forever; `reverse` plays
91
+ * every other repetition backwards.
92
+ */
93
+ export declare const withRepeat: (animation: number, numberOfReps?: number, reverse?: boolean, callback?: AnimationCallback) => number;
94
+ /**
95
+ * Coasts to a stop from an initial velocity — the release half of a fling.
96
+ * Unlike every other animation here it has no target: where it lands is the
97
+ * result of the velocity and the friction, which is exactly what makes it the
98
+ * one an inertial gesture needs.
99
+ *
100
+ * ```tsx
101
+ * onPanResponderRelease: (_, g) => {
102
+ * x.value = withDecay({ velocity: g.vx * 1000, clamp: [0, width] })
103
+ * }
104
+ * ```
105
+ *
106
+ * `velocity` is in units per SECOND, as upstream — `PanResponder`'s
107
+ * `gestureState.vx` is per millisecond, so it wants the ×1000 above.
108
+ */
109
+ export declare const withDecay: (config?: WithDecayConfig, callback?: AnimationCallback) => number;
110
+ /**
111
+ * Confines another animation to a range: the inner animation runs its own
112
+ * un-truncated course and what reaches the value is clipped to `[min, max]`.
113
+ * That distinction is upstream's and it is observable — a spring clamped at
114
+ * 100 that would have overshot to 120 sits at 100 and then comes back down,
115
+ * rather than settling at 100 the moment it first arrives.
116
+ */
117
+ export declare const withClamp: (config: {
118
+ min?: number;
119
+ max?: number;
120
+ }, animation: number) => number;
121
+ export type { WithDecayConfig } from "./decay";
122
+ type PlatformSpringConfig = {
123
+ toValue: number;
124
+ mass: number;
125
+ stiffness: number;
126
+ damping: number;
127
+ initialVelocity: number;
128
+ overshootClamping: boolean;
129
+ restDisplacementThreshold: number;
130
+ restSpeedThreshold: number;
131
+ };
132
+ /**
133
+ * Turns a Reanimated spring config into the platform solver's config.
134
+ *
135
+ * The rest condition is the one place the two genuinely differ. Upstream
136
+ * stops when the oscillator's remaining energy falls to `energyThreshold` of
137
+ * its initial energy — a RELATIVE criterion; the platform's solver stops on
138
+ * absolute displacement and speed thresholds. Rather than accept RN's
139
+ * absolute defaults (which would end a 400px spring at a different point than
140
+ * a 4px one), the thresholds are derived per animation from the same energy
141
+ * budget, so the stopping point tracks upstream's to well under a pixel.
142
+ */
143
+ export declare const toPlatformSpringConfig: (config: WithSpringConfig, toValue: number, from: number) => PlatformSpringConfig;
144
+ /**
145
+ * The last value an animation aims at, used by `withRepeat`'s reverse and by
146
+ * `updater-animations.ts` to seed a key that is animating for the first time.
147
+ */
148
+ export declare const targetOf: (spec: AnimationSpec) => number | null;
149
+ /**
150
+ * What makes two descriptors the SAME animation, for a caller that gets a
151
+ * freshly built one on every evaluation and must decide whether to restart.
152
+ *
153
+ * The target and the shape, not object identity and not the whole config: a
154
+ * mapper re-runs whenever anything it read changed, so `withSpring(open.value
155
+ * ? 320 : 0)` produces a new object many times a second while asking for the
156
+ * same animation every time. Config fields that change WHERE the animation
157
+ * ends are in (a `duration`, a decay's `velocity`); ones that only change how
158
+ * it gets there are not, because re-aiming a running animation at the value it
159
+ * is already aimed at is a no-op that costs a restart.
160
+ */
161
+ export declare const animationSignature: (spec: AnimationSpec) => string;
162
+ /**
163
+ * What a descriptor needs to become a running animation: the platform's
164
+ * Animated api for the animations it already has, and the frame scheduler
165
+ * behind it for the one it does not (`withDecay` — see decay.ts). Both come
166
+ * from the same place, so there is still exactly one clock under this layer.
167
+ */
168
+ export type AnimationEngine = {
169
+ api: AnimatedApi;
170
+ scheduler: FrameScheduler;
171
+ };
172
+ /**
173
+ * Turns a descriptor into a running animation on `driver`. Every leaf is one
174
+ * of the platform's own animations, so the whole tree runs off the single
175
+ * injected frame scheduler.
176
+ */
177
+ export declare const buildAnimation: (engine: AnimationEngine, driver: AnimatedValue, spec: AnimationSpec) => CompositeAnimation;