react-native-screen-transitions 2.0.4 → 2.1.0

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 (300) hide show
  1. package/README.md +100 -77
  2. package/lib/commonjs/components/{bounds-activator.js → bound-capture.js} +4 -4
  3. package/lib/commonjs/components/bound-capture.js.map +1 -0
  4. package/lib/commonjs/components/controllers/screen-lifecycle.js +18 -4
  5. package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
  6. package/lib/commonjs/components/create-transition-aware-component.js +14 -12
  7. package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
  8. package/lib/commonjs/components/integrations/masked-view.js +52 -0
  9. package/lib/commonjs/components/integrations/masked-view.js.map +1 -0
  10. package/lib/commonjs/components/root-transition-aware.js +6 -15
  11. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  12. package/lib/commonjs/configs/index.js +15 -5
  13. package/lib/commonjs/configs/index.js.map +1 -1
  14. package/lib/commonjs/configs/presets.js +378 -7
  15. package/lib/commonjs/configs/presets.js.map +1 -1
  16. package/lib/commonjs/configs/specs.js +1 -1
  17. package/lib/commonjs/hooks/animation/use-associated-style.js +7 -10
  18. package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
  19. package/lib/commonjs/hooks/animation/use-screen-animation.js +37 -37
  20. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  21. package/lib/commonjs/hooks/bounds/use-bound-registry.js +73 -0
  22. package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -0
  23. package/lib/commonjs/hooks/gestures/use-build-gestures.js +156 -152
  24. package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
  25. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js +28 -0
  26. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  27. package/lib/commonjs/hooks/gestures/use-scroll-registry.js +146 -0
  28. package/lib/commonjs/hooks/gestures/use-scroll-registry.js.map +1 -0
  29. package/lib/commonjs/index.js +3 -0
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +7 -4
  32. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  33. package/lib/commonjs/providers/gestures.js +16 -16
  34. package/lib/commonjs/providers/gestures.js.map +1 -1
  35. package/lib/commonjs/providers/transition-styles.js +44 -0
  36. package/lib/commonjs/providers/transition-styles.js.map +1 -0
  37. package/lib/commonjs/stores/bounds.js +142 -1
  38. package/lib/commonjs/stores/bounds.js.map +1 -1
  39. package/lib/commonjs/stores/utils/reset-stores-for-screen.js +4 -2
  40. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  41. package/lib/commonjs/types/gesture.js +11 -0
  42. package/lib/commonjs/types/gesture.js.map +1 -1
  43. package/lib/commonjs/utils/animation/derivations.js +39 -0
  44. package/lib/commonjs/utils/animation/derivations.js.map +1 -0
  45. package/lib/commonjs/utils/animation/run-transition.js +6 -2
  46. package/lib/commonjs/utils/animation/run-transition.js.map +1 -1
  47. package/lib/commonjs/utils/bounds/_utils/flatten-styles.js.map +1 -0
  48. package/lib/commonjs/utils/bounds/_utils/geometry.js +179 -0
  49. package/lib/commonjs/utils/bounds/_utils/geometry.js.map +1 -0
  50. package/lib/commonjs/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  51. package/lib/commonjs/utils/bounds/_utils/get-bounds.js.map +1 -0
  52. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js +19 -0
  53. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  54. package/lib/commonjs/utils/bounds/_utils/style-composers.js +201 -0
  55. package/lib/commonjs/utils/bounds/_utils/style-composers.js.map +1 -0
  56. package/lib/commonjs/utils/bounds/constants.js +14 -3
  57. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  58. package/lib/commonjs/utils/bounds/index.js +210 -17
  59. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  60. package/lib/commonjs/utils/gesture/apply-offset-rules.js +233 -0
  61. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -0
  62. package/lib/commonjs/utils/gesture/check-gesture-activation.js +231 -0
  63. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -0
  64. package/lib/commonjs/utils/gesture/determine-dismissal.js +98 -0
  65. package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -0
  66. package/lib/module/components/{bounds-activator.js → bound-capture.js} +2 -2
  67. package/lib/module/components/bound-capture.js.map +1 -0
  68. package/lib/module/components/controllers/screen-lifecycle.js +18 -4
  69. package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
  70. package/lib/module/components/create-transition-aware-component.js +14 -12
  71. package/lib/module/components/create-transition-aware-component.js.map +1 -1
  72. package/lib/module/components/integrations/masked-view.js +48 -0
  73. package/lib/module/components/integrations/masked-view.js.map +1 -0
  74. package/lib/module/components/root-transition-aware.js +7 -16
  75. package/lib/module/components/root-transition-aware.js.map +1 -1
  76. package/lib/module/configs/index.js +15 -2
  77. package/lib/module/configs/index.js.map +1 -1
  78. package/lib/module/configs/presets.js +374 -6
  79. package/lib/module/configs/presets.js.map +1 -1
  80. package/lib/module/configs/specs.js +1 -1
  81. package/lib/module/hooks/animation/use-associated-style.js +6 -10
  82. package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
  83. package/lib/module/hooks/animation/use-screen-animation.js +37 -37
  84. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  85. package/lib/module/hooks/bounds/use-bound-registry.js +68 -0
  86. package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -0
  87. package/lib/module/hooks/gestures/use-build-gestures.js +156 -153
  88. package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
  89. package/lib/module/hooks/gestures/use-parent-gesture-registry.js +23 -0
  90. package/lib/module/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  91. package/lib/module/hooks/gestures/use-scroll-registry.js +140 -0
  92. package/lib/module/hooks/gestures/use-scroll-registry.js.map +1 -0
  93. package/lib/module/index.js +2 -0
  94. package/lib/module/index.js.map +1 -1
  95. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +7 -4
  96. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  97. package/lib/module/providers/gestures.js +16 -16
  98. package/lib/module/providers/gestures.js.map +1 -1
  99. package/lib/module/providers/transition-styles.js +39 -0
  100. package/lib/module/providers/transition-styles.js.map +1 -0
  101. package/lib/module/stores/bounds.js +142 -1
  102. package/lib/module/stores/bounds.js.map +1 -1
  103. package/lib/module/stores/utils/reset-stores-for-screen.js +4 -2
  104. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  105. package/lib/module/types/gesture.js +7 -0
  106. package/lib/module/types/gesture.js.map +1 -1
  107. package/lib/module/utils/animation/derivations.js +34 -0
  108. package/lib/module/utils/animation/derivations.js.map +1 -0
  109. package/lib/module/utils/animation/run-transition.js +6 -2
  110. package/lib/module/utils/animation/run-transition.js.map +1 -1
  111. package/lib/module/utils/bounds/_utils/flatten-styles.js.map +1 -0
  112. package/lib/module/utils/bounds/_utils/geometry.js +174 -0
  113. package/lib/module/utils/bounds/_utils/geometry.js.map +1 -0
  114. package/lib/module/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  115. package/lib/module/utils/bounds/_utils/get-bounds.js.map +1 -0
  116. package/lib/module/utils/bounds/_utils/is-bounds-equal.js +14 -0
  117. package/lib/module/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  118. package/lib/module/utils/bounds/_utils/style-composers.js +194 -0
  119. package/lib/module/utils/bounds/_utils/style-composers.js.map +1 -0
  120. package/lib/module/utils/bounds/constants.js +14 -3
  121. package/lib/module/utils/bounds/constants.js.map +1 -1
  122. package/lib/module/utils/bounds/index.js +208 -15
  123. package/lib/module/utils/bounds/index.js.map +1 -1
  124. package/lib/module/utils/gesture/apply-offset-rules.js +228 -0
  125. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -0
  126. package/lib/module/utils/gesture/check-gesture-activation.js +226 -0
  127. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -0
  128. package/lib/module/utils/gesture/determine-dismissal.js +93 -0
  129. package/lib/module/utils/gesture/determine-dismissal.js.map +1 -0
  130. package/lib/typescript/components/bound-capture.d.ts +8 -0
  131. package/lib/typescript/components/bound-capture.d.ts.map +1 -0
  132. package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -1
  133. package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
  134. package/lib/typescript/components/integrations/masked-view.d.ts +6 -0
  135. package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -0
  136. package/lib/typescript/components/root-transition-aware.d.ts +3 -3
  137. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  138. package/lib/typescript/configs/index.d.ts +15 -2
  139. package/lib/typescript/configs/index.d.ts.map +1 -1
  140. package/lib/typescript/configs/presets.d.ts +3 -0
  141. package/lib/typescript/configs/presets.d.ts.map +1 -1
  142. package/lib/typescript/hooks/animation/use-associated-style.d.ts +6 -4
  143. package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
  144. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  145. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts → use-bound-registry.d.ts} +5 -4
  146. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts.map → use-bound-registry.d.ts.map} +1 -1
  147. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +6 -5
  148. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  149. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts +6 -0
  150. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts.map +1 -0
  151. package/lib/typescript/hooks/gestures/{use-scroll-progress.d.ts → use-scroll-registry.d.ts} +2 -2
  152. package/lib/typescript/hooks/gestures/use-scroll-registry.d.ts.map +1 -0
  153. package/lib/typescript/index.d.ts +25 -11
  154. package/lib/typescript/index.d.ts.map +1 -1
  155. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  156. package/lib/typescript/providers/gestures.d.ts +4 -2
  157. package/lib/typescript/providers/gestures.d.ts.map +1 -1
  158. package/lib/typescript/providers/transition-styles.d.ts +8 -0
  159. package/lib/typescript/providers/transition-styles.d.ts.map +1 -0
  160. package/lib/typescript/stores/bounds.d.ts +11 -0
  161. package/lib/typescript/stores/bounds.d.ts.map +1 -1
  162. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +3 -1
  163. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  164. package/lib/typescript/types/bounds.d.ts +5 -1
  165. package/lib/typescript/types/bounds.d.ts.map +1 -1
  166. package/lib/typescript/types/gesture.d.ts +14 -0
  167. package/lib/typescript/types/gesture.d.ts.map +1 -1
  168. package/lib/typescript/types/navigator.d.ts +5 -1
  169. package/lib/typescript/types/navigator.d.ts.map +1 -1
  170. package/lib/typescript/utils/animation/derivations.d.ts +19 -0
  171. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -0
  172. package/lib/typescript/utils/animation/run-transition.d.ts +2 -1
  173. package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -1
  174. package/lib/typescript/utils/bounds/_types/builder.d.ts +96 -14
  175. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  176. package/lib/typescript/utils/bounds/_types/geometry.d.ts +0 -1
  177. package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -1
  178. package/lib/typescript/utils/bounds/_utils/flatten-styles.d.ts.map +1 -0
  179. package/lib/typescript/utils/bounds/{geometry.d.ts → _utils/geometry.d.ts} +8 -5
  180. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -0
  181. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts +4 -0
  182. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts.map +1 -0
  183. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts +7 -0
  184. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts.map +1 -0
  185. package/lib/typescript/utils/bounds/{style-composers.d.ts → _utils/style-composers.d.ts} +7 -10
  186. package/lib/typescript/utils/bounds/_utils/style-composers.d.ts.map +1 -0
  187. package/lib/typescript/utils/bounds/constants.d.ts +5 -5
  188. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  189. package/lib/typescript/utils/bounds/index.d.ts +2 -4
  190. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  191. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +38 -0
  192. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -0
  193. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +38 -0
  194. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -0
  195. package/lib/typescript/utils/gesture/determine-dismissal.d.ts +25 -0
  196. package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -0
  197. package/package.json +2 -3
  198. package/src/__tests__/geometry.test.ts +15 -12
  199. package/src/components/{bounds-activator.tsx → bound-capture.tsx} +1 -1
  200. package/src/components/controllers/screen-lifecycle.tsx +13 -5
  201. package/src/components/create-transition-aware-component.tsx +17 -11
  202. package/src/components/integrations/masked-view.tsx +56 -0
  203. package/src/components/root-transition-aware.tsx +31 -39
  204. package/src/configs/index.ts +26 -2
  205. package/src/configs/presets.ts +401 -6
  206. package/src/configs/specs.ts +1 -1
  207. package/src/hooks/animation/use-associated-style.tsx +12 -11
  208. package/src/hooks/animation/use-screen-animation.tsx +48 -49
  209. package/src/hooks/bounds/{use-bound-measurer.tsx → use-bound-registry.tsx} +32 -20
  210. package/src/hooks/gestures/use-build-gestures.tsx +193 -228
  211. package/src/hooks/gestures/use-parent-gesture-registry.tsx +18 -0
  212. package/src/hooks/gestures/use-scroll-registry.tsx +145 -0
  213. package/src/index.ts +2 -0
  214. package/src/integrations/native-stack/views/NativeStackView.native.tsx +8 -5
  215. package/src/providers/gestures.tsx +19 -22
  216. package/src/providers/transition-styles.tsx +52 -0
  217. package/src/stores/bounds.ts +156 -0
  218. package/src/stores/utils/reset-stores-for-screen.ts +7 -2
  219. package/src/types/bounds.ts +8 -1
  220. package/src/types/gesture.ts +19 -0
  221. package/src/types/navigator.ts +5 -1
  222. package/src/utils/animation/derivations.ts +38 -0
  223. package/src/utils/animation/run-transition.ts +4 -1
  224. package/src/utils/bounds/_types/builder.ts +127 -11
  225. package/src/utils/bounds/_types/geometry.ts +0 -1
  226. package/src/utils/bounds/_utils/geometry.ts +166 -0
  227. package/src/utils/bounds/_utils/get-bounds.ts +54 -0
  228. package/src/utils/bounds/_utils/is-bounds-equal.ts +24 -0
  229. package/src/utils/bounds/_utils/style-composers.ts +216 -0
  230. package/src/utils/bounds/constants.ts +37 -22
  231. package/src/utils/bounds/index.ts +269 -19
  232. package/src/utils/gesture/apply-offset-rules.ts +314 -0
  233. package/src/utils/gesture/check-gesture-activation.ts +310 -0
  234. package/src/utils/gesture/determine-dismissal.ts +131 -0
  235. package/lib/commonjs/components/bounds-activator.js.map +0 -1
  236. package/lib/commonjs/hooks/bounds/use-bound-measurer.js +0 -52
  237. package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +0 -1
  238. package/lib/commonjs/hooks/gestures/use-scroll-progress.js +0 -57
  239. package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +0 -1
  240. package/lib/commonjs/utils/bounds/build-bound-styles.js +0 -145
  241. package/lib/commonjs/utils/bounds/build-bound-styles.js.map +0 -1
  242. package/lib/commonjs/utils/bounds/flatten-styles.js.map +0 -1
  243. package/lib/commonjs/utils/bounds/geometry.js +0 -94
  244. package/lib/commonjs/utils/bounds/geometry.js.map +0 -1
  245. package/lib/commonjs/utils/bounds/get-bounds.js.map +0 -1
  246. package/lib/commonjs/utils/bounds/style-composers.js +0 -199
  247. package/lib/commonjs/utils/bounds/style-composers.js.map +0 -1
  248. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +0 -81
  249. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  250. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +0 -21
  251. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +0 -1
  252. package/lib/commonjs/utils/index.js +0 -17
  253. package/lib/commonjs/utils/index.js.map +0 -1
  254. package/lib/module/components/bounds-activator.js.map +0 -1
  255. package/lib/module/hooks/bounds/use-bound-measurer.js +0 -47
  256. package/lib/module/hooks/bounds/use-bound-measurer.js.map +0 -1
  257. package/lib/module/hooks/gestures/use-scroll-progress.js +0 -52
  258. package/lib/module/hooks/gestures/use-scroll-progress.js.map +0 -1
  259. package/lib/module/utils/bounds/build-bound-styles.js +0 -141
  260. package/lib/module/utils/bounds/build-bound-styles.js.map +0 -1
  261. package/lib/module/utils/bounds/flatten-styles.js.map +0 -1
  262. package/lib/module/utils/bounds/geometry.js +0 -89
  263. package/lib/module/utils/bounds/geometry.js.map +0 -1
  264. package/lib/module/utils/bounds/get-bounds.js.map +0 -1
  265. package/lib/module/utils/bounds/style-composers.js +0 -191
  266. package/lib/module/utils/bounds/style-composers.js.map +0 -1
  267. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +0 -76
  268. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  269. package/lib/module/utils/gesture/normalize-gesture-translation.js +0 -16
  270. package/lib/module/utils/gesture/normalize-gesture-translation.js.map +0 -1
  271. package/lib/module/utils/index.js +0 -4
  272. package/lib/module/utils/index.js.map +0 -1
  273. package/lib/typescript/components/bounds-activator.d.ts +0 -8
  274. package/lib/typescript/components/bounds-activator.d.ts.map +0 -1
  275. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +0 -1
  276. package/lib/typescript/utils/bounds/build-bound-styles.d.ts +0 -4
  277. package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +0 -1
  278. package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +0 -1
  279. package/lib/typescript/utils/bounds/geometry.d.ts.map +0 -1
  280. package/lib/typescript/utils/bounds/get-bounds.d.ts +0 -4
  281. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +0 -1
  282. package/lib/typescript/utils/bounds/style-composers.d.ts.map +0 -1
  283. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +0 -17
  284. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +0 -1
  285. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +0 -6
  286. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +0 -1
  287. package/lib/typescript/utils/index.d.ts +0 -2
  288. package/lib/typescript/utils/index.d.ts.map +0 -1
  289. package/src/hooks/gestures/use-scroll-progress.tsx +0 -60
  290. package/src/utils/bounds/build-bound-styles.ts +0 -184
  291. package/src/utils/bounds/geometry.ts +0 -113
  292. package/src/utils/bounds/get-bounds.ts +0 -56
  293. package/src/utils/bounds/style-composers.ts +0 -172
  294. package/src/utils/gesture/apply-gesture-activation-criteria.ts +0 -109
  295. package/src/utils/gesture/normalize-gesture-translation.ts +0 -20
  296. package/src/utils/index.ts +0 -1
  297. /package/lib/commonjs/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
  298. /package/lib/module/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
  299. /package/lib/typescript/utils/bounds/{flatten-styles.d.ts → _utils/flatten-styles.d.ts} +0 -0
  300. /package/src/utils/bounds/{flatten-styles.ts → _utils/flatten-styles.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-bound-styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/build-bound-styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EACX,uBAAuB,EAEvB,MAAM,kBAAkB,CAAC;AAwH1B,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,uBAAuB,GAC7B,aAAa,CAqDf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"flatten-styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/flatten-styles.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAoBtE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EACvC,KAAK,EACL,GAAG,EACH,QAAQ,GACR,EAAE;IACF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CAClB,GAAG,gBAAgB,CAgBnB;AACD;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,EAC/C,KAAK,EACL,GAAG,EACH,QAAQ,EACR,UAAU,EACV,gBAAgB,GAChB,EAAE;IACF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;CAC3D,GAAG,wBAAwB,CA4D3B"}
@@ -1,4 +0,0 @@
1
- import type { BoundEntry } from '../../types/bounds';
2
- import type { GetBoundsParams } from './_types/get-bounds';
3
- export declare const getBounds: (props: GetBoundsParams) => BoundEntry;
4
- //# sourceMappingURL=get-bounds.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc3D,eAAO,MAAM,SAAS,GAAI,OAAO,eAAe,KAAG,UAuClD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"style-composers.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/style-composers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAuB5E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAuB5E;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CAuBZ;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CA2BZ;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAsB5E"}
@@ -1,17 +0,0 @@
1
- import type { PanGesture } from "react-native-gesture-handler";
2
- import type { ScreenTransitionConfig } from "../../types/navigator";
3
- interface GestureActivationOptions {
4
- gestureDirection: ScreenTransitionConfig["gestureDirection"] | Array<ScreenTransitionConfig["gestureDirection"]>;
5
- gestureResponseDistance: number;
6
- panGesture: PanGesture;
7
- }
8
- /**
9
- * rngh requires this type instead a number[]. We're returning a num[] which is still correct, this is just to remove the type error.
10
- */
11
- type OffsetErrorTypeBugFix = [start: number, end: number];
12
- export declare const applyGestureActivationCriteria: ({ gestureDirection, gestureResponseDistance, panGesture, }: GestureActivationOptions) => import("react-native-gesture-handler/lib/typescript/handlers/gestures/panGesture").PanGesture | {
13
- activeOffsetX: OffsetErrorTypeBugFix;
14
- activeOffsetY: OffsetErrorTypeBugFix;
15
- };
16
- export {};
17
- //# sourceMappingURL=apply-gesture-activation-criteria.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apply-gesture-activation-criteria.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/apply-gesture-activation-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,UAAU,wBAAwB;IACjC,gBAAgB,EACb,sBAAsB,CAAC,kBAAkB,CAAC,GAC1C,KAAK,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACrD,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;CACvB;AAED;;GAEG;AACH,KAAK,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,8BAA8B,GAAI,4DAI5C,wBAAwB;mBAUnB,qBAAqB;mBAIrB,qBAAqB;CA0E5B,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { GestureDirection } from "../../types/gesture";
2
- /**
3
- * Utility function to normalize gesture translation based on direction.
4
- */
5
- export declare const normalizeGestureTranslation: (translation: number, gestureDirection: GestureDirection) => number;
6
- //# sourceMappingURL=normalize-gesture-translation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize-gesture-translation.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/normalize-gesture-translation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACvC,aAAa,MAAM,EACnB,kBAAkB,gBAAgB,WAYlC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./animation/animate";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -1,60 +0,0 @@
1
- import { useCallback } from "react";
2
- import type { LayoutChangeEvent } from "react-native";
3
- import { useAnimatedScrollHandler } from "react-native-reanimated";
4
- import type { ReanimatedScrollEvent } from "react-native-reanimated/lib/typescript/hook/commonTypes";
5
- import { useGestureContext } from "../../providers/gestures";
6
-
7
- interface ScrollProgressHookProps {
8
- onScroll?: (event: ReanimatedScrollEvent) => void;
9
- onContentSizeChange?: (width: number, height: number) => void;
10
- onLayout?: (event: LayoutChangeEvent) => void;
11
- }
12
-
13
- export const useScrollProgress = (props: ScrollProgressHookProps) => {
14
- const { scrollProgress } = useGestureContext();
15
- const scrollHandler = useAnimatedScrollHandler({
16
- onScroll: (event) => {
17
- props.onScroll?.(event);
18
- scrollProgress.modify((v) => {
19
- "worklet";
20
- v.x = event.contentOffset.x;
21
- v.y = event.contentOffset.y;
22
- return v;
23
- });
24
- },
25
- });
26
-
27
- const onContentSizeChange = useCallback(
28
- (width: number, height: number) => {
29
- props.onContentSizeChange?.(width, height);
30
-
31
- scrollProgress.modify((v) => {
32
- "worklet";
33
- v.contentWidth = width;
34
- v.contentHeight = height;
35
- return v;
36
- });
37
- },
38
- [scrollProgress, props.onContentSizeChange],
39
- );
40
-
41
- const onLayout = useCallback(
42
- (event: LayoutChangeEvent) => {
43
- props.onLayout?.(event);
44
- const { width, height } = event.nativeEvent.layout;
45
- scrollProgress.modify((v) => {
46
- "worklet";
47
- v.layoutHeight = height;
48
- v.layoutWidth = width;
49
- return v;
50
- });
51
- },
52
- [scrollProgress, props.onLayout],
53
- );
54
-
55
- return {
56
- scrollHandler,
57
- onContentSizeChange,
58
- onLayout,
59
- };
60
- };
@@ -1,184 +0,0 @@
1
- import type { ScaledSize } from "react-native";
2
- import { interpolate, type MeasuredDimensions } from "react-native-reanimated";
3
- import type { ScreenTransitionState } from "../../types/animation";
4
- import type { BoundsBuilder } from "../../types/bounds";
5
- import type { ScreenPhase } from "../../types/core";
6
- import type {
7
- BoundsBuilderInitParams,
8
- BoundsBuilderOptions,
9
- } from "./_types/builder";
10
- import { DEFAULT_BUILDER_OPTIONS, FULLSCREEN_DIMENSIONS } from "./constants";
11
- import {
12
- computeContentTransformGeometry,
13
- computeRelativeGeometry,
14
- } from "./geometry";
15
- import {
16
- composeContentStyle,
17
- composeSizeAbsolute,
18
- composeSizeRelative,
19
- composeTransformAbsolute,
20
- composeTransformRelative,
21
- type ElementComposeParams,
22
- } from "./style-composers";
23
-
24
- function resolveBounds(props: {
25
- id: string;
26
- previous?: ScreenTransitionState;
27
- current?: ScreenTransitionState;
28
- next?: ScreenTransitionState;
29
- toRect?: Partial<MeasuredDimensions>;
30
- dimensions: ScaledSize;
31
- computeOptions: BoundsBuilderOptions;
32
- }) {
33
- "worklet";
34
- const entering = !props.next;
35
-
36
- const fullscreen = FULLSCREEN_DIMENSIONS(props.dimensions);
37
-
38
- const startPhase: ScreenPhase = entering ? "previous" : "current";
39
- const endPhase: ScreenPhase = entering ? "current" : "next";
40
-
41
- const resolve = (phase?: ScreenPhase) => {
42
- "worklet";
43
- if (phase === "previous") return props.previous?.bounds?.[props.id]?.bounds;
44
- if (phase === "current") return props.current?.bounds?.[props.id]?.bounds;
45
- if (phase === "next") return props.next?.bounds?.[props.id]?.bounds;
46
- return null;
47
- };
48
-
49
- const start = resolve(startPhase);
50
- let end = resolve(endPhase);
51
-
52
- if (props.computeOptions.toFullscreen) {
53
- end = fullscreen;
54
- }
55
-
56
- return {
57
- start,
58
- end,
59
- entering,
60
- };
61
- }
62
-
63
- const computeBoundStyles = (
64
- {
65
- id,
66
- previous,
67
- current,
68
- next,
69
- progress,
70
- dimensions,
71
- }: BoundsBuilderInitParams,
72
- computeOptions: BoundsBuilderOptions = {},
73
- ) => {
74
- "worklet";
75
- if (!id) return {};
76
-
77
- const { start, end, entering } = resolveBounds({
78
- id,
79
- previous,
80
- current,
81
- next,
82
- computeOptions: computeOptions,
83
- dimensions,
84
- });
85
-
86
- if (!start || !end) return {};
87
-
88
- const relativeGeometry = computeRelativeGeometry({ start, end, entering });
89
-
90
- const interp = (a: number, b: number) =>
91
- interpolate(progress, relativeGeometry.ranges, [a, b]);
92
-
93
- const common: ElementComposeParams = {
94
- start,
95
- end,
96
- interp,
97
- geometry: relativeGeometry,
98
- computeOptions,
99
- };
100
-
101
- const isSize = computeOptions.method === "size";
102
- const isAbs = !!computeOptions.absolute;
103
-
104
- if (computeOptions.method === "content") {
105
- const contentGeometry = computeContentTransformGeometry({
106
- start,
107
- end,
108
- entering,
109
- dimensions,
110
- contentScaleMode: computeOptions.contentScaleMode ?? "auto",
111
- });
112
-
113
- return composeContentStyle({
114
- ...common,
115
- geometry: contentGeometry,
116
- computeOptions,
117
- });
118
- }
119
-
120
- return isSize
121
- ? isAbs
122
- ? composeSizeAbsolute(common)
123
- : composeSizeRelative(common)
124
- : isAbs
125
- ? composeTransformAbsolute(common)
126
- : composeTransformRelative(common);
127
- };
128
-
129
- export function buildBoundStyles(
130
- params: BoundsBuilderInitParams,
131
- ): BoundsBuilder {
132
- "worklet";
133
-
134
- const cfg: { options: BoundsBuilderOptions } = {
135
- options: { ...DEFAULT_BUILDER_OPTIONS },
136
- };
137
-
138
- const builder = (): BoundsBuilder => ({
139
- gestures: (options) => {
140
- cfg.options.gestures = options;
141
- return builder();
142
- },
143
- toFullscreen: () => {
144
- cfg.options.toFullscreen = true;
145
- return builder();
146
- },
147
- absolute: () => {
148
- cfg.options.absolute = true;
149
- cfg.options.relative = false;
150
- return builder();
151
- },
152
- relative: () => {
153
- cfg.options.relative = true;
154
- cfg.options.absolute = false;
155
- return builder();
156
- },
157
- transform: () => {
158
- cfg.options.method = "transform";
159
- return builder();
160
- },
161
- size: () => {
162
- cfg.options.method = "size";
163
- return builder();
164
- },
165
- content: () => {
166
- cfg.options.method = "content";
167
- return builder();
168
- },
169
- contentFill: () => {
170
- cfg.options.contentScaleMode = "aspectFill";
171
- return builder();
172
- },
173
- contentFit: () => {
174
- cfg.options.contentScaleMode = "aspectFit";
175
- return builder();
176
- },
177
-
178
- build: () => {
179
- return computeBoundStyles(params, cfg.options);
180
- },
181
- });
182
-
183
- return builder();
184
- }
@@ -1,113 +0,0 @@
1
- import type { ScaledSize } from "react-native";
2
- import type { MeasuredDimensions } from "react-native-reanimated";
3
- import type { BoundsBuilderOptions } from "./_types/builder";
4
- import type {
5
- ContentTransformGeometry,
6
- RelativeGeometry,
7
- } from "./_types/geometry";
8
-
9
- /**
10
- * Relative geometry between start/end bounds.
11
- */
12
- export function computeRelativeGeometry({
13
- start,
14
- end,
15
- entering,
16
- }: {
17
- start: MeasuredDimensions;
18
- end: MeasuredDimensions;
19
- entering: boolean;
20
- }): RelativeGeometry {
21
- "worklet";
22
- const startCenterX = start.pageX + start.width / 2;
23
- const startCenterY = start.pageY + start.height / 2;
24
- const endCenterX = end.pageX + end.width / 2;
25
- const endCenterY = end.pageY + end.height / 2;
26
-
27
- const dx = startCenterX - endCenterX;
28
- const dy = startCenterY - endCenterY;
29
-
30
- const scaleX = start.width / end.width;
31
- const scaleY = start.height / end.height;
32
-
33
- const ranges: readonly [number, number] = entering ? [0, 1] : [1, 2];
34
-
35
- return { dx, dy, scaleX, scaleY, ranges, entering };
36
- }
37
- /**
38
- * Computes the transform to apply to the entire destination screen so that
39
- * its bound (end) matches the source bound (start) at progress start.
40
- */
41
- export function computeContentTransformGeometry({
42
- start,
43
- end,
44
- entering,
45
- dimensions,
46
- contentScaleMode,
47
- }: {
48
- start: MeasuredDimensions;
49
- end: MeasuredDimensions;
50
- entering: boolean;
51
- dimensions: ScaledSize;
52
- contentScaleMode: BoundsBuilderOptions["contentScaleMode"];
53
- }): ContentTransformGeometry {
54
- "worklet";
55
-
56
- const parent = {
57
- x: 0,
58
- y: 0,
59
- width: dimensions.width,
60
- height: dimensions.height,
61
- };
62
-
63
- const startCenterX = start.pageX + start.width / 2;
64
- const startCenterY = start.pageY + start.height / 2;
65
-
66
- const childCenterX = end.pageX + end.width / 2;
67
- const childCenterY = end.pageY + end.height / 2;
68
-
69
- const parentCenterX = parent.x + parent.width / 2;
70
- const parentCenterY = parent.y + parent.height / 2;
71
-
72
- const safe = (v: number) => (v === 0 ? 1e-6 : v);
73
-
74
- const sx = safe(start.width) / safe(end.width);
75
- const sy = safe(start.height) / safe(end.height);
76
-
77
- let s: number;
78
-
79
- if (contentScaleMode === "aspectFit") {
80
- s = Math.min(sx, sy);
81
- } else if (contentScaleMode === "aspectFill") {
82
- s = Math.max(sx, sy);
83
- } else {
84
- const startAspect = start.width / start.height;
85
- const endAspect = end.width / end.height;
86
- const aspectDifference = Math.abs(startAspect - endAspect);
87
-
88
- if (aspectDifference < 0.1) {
89
- s = Math.max(sx, sy);
90
- } else {
91
- s = Math.min(sx, sy);
92
- }
93
- }
94
-
95
- const offsetX = startCenterX - parentCenterX;
96
- const offsetY = startCenterY - parentCenterY;
97
-
98
- const centerOffsetX = (parentCenterX - childCenterX) * s;
99
- const centerOffsetY = (parentCenterY - childCenterY) * s;
100
-
101
- const tx = offsetX + centerOffsetX;
102
- const ty = offsetY + centerOffsetY;
103
-
104
- const ranges: readonly [number, number] = entering ? [0, 1] : [1, 2];
105
-
106
- return {
107
- tx,
108
- ty,
109
- s,
110
- ranges,
111
- entering,
112
- };
113
- }
@@ -1,56 +0,0 @@
1
- import type { BoundEntry } from '../../types/bounds';
2
-
3
- import type { GetBoundsParams } from './_types/get-bounds';
4
-
5
- const fallbackBounds = {
6
- bounds: {
7
- width: 0,
8
- height: 0,
9
- x: 0,
10
- y: 0,
11
- pageX: 0,
12
- pageY: 0,
13
- },
14
- styles: {},
15
- };
16
-
17
- export const getBounds = (props: GetBoundsParams): BoundEntry => {
18
- 'worklet';
19
- const boundId = props.id;
20
- const phase = props.phase;
21
-
22
- if (phase && boundId) {
23
- let phaseBounds = null;
24
-
25
- if (phase === 'current') {
26
- phaseBounds = props.current?.bounds[boundId];
27
- } else if (phase === 'next') {
28
- phaseBounds = props.next?.bounds[boundId];
29
- } else {
30
- phaseBounds = props.previous?.bounds[boundId];
31
- }
32
-
33
- if (!phaseBounds) {
34
- return fallbackBounds;
35
- }
36
-
37
- return {
38
- bounds: phaseBounds.bounds,
39
- styles: phaseBounds?.styles,
40
- };
41
- }
42
-
43
- if (!props.next && boundId) {
44
- const previousBounds = props.previous?.bounds[boundId];
45
-
46
- return previousBounds || fallbackBounds;
47
- }
48
-
49
- if (boundId) {
50
- const nextBounds = props.next?.bounds[boundId];
51
-
52
- return nextBounds || fallbackBounds;
53
- }
54
-
55
- return fallbackBounds;
56
- };
@@ -1,172 +0,0 @@
1
- import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
- import type { BoundsBuilderOptions } from "./_types/builder";
3
- import type {
4
- ContentTransformGeometry,
5
- RelativeGeometry,
6
- } from "./_types/geometry";
7
-
8
- /**
9
- * Common interpolation helper signature used by composers.
10
- * It maps from a -> b over the already-determined progress range.
11
- */
12
- export type Interp = (a: number, b: number) => number;
13
-
14
- /**
15
- * Element-level (relative) params shared by size/transform composers.
16
- * - start/end: absolute window bounds of the element in previous/next phases
17
- * - geometry: relative deltas and scales between start/end (dx, dy, scaleX, scaleY, ...)
18
- * - interp: function to interpolate between numbers using the correct progress range
19
- */
20
- export type ElementComposeParams = {
21
- start: MeasuredDimensions;
22
- end: MeasuredDimensions;
23
- geometry: RelativeGeometry;
24
- interp: Interp;
25
- computeOptions: BoundsBuilderOptions;
26
- };
27
-
28
- /**
29
- * Screen-level content transform params (for aligning destination bound to source).
30
- * - start/end: absolute window bounds for the shared id (source/destination)
31
- * - geometry: precomputed screen-level tx/ty/sx/sy plus ranges/entering
32
- * - interp: function to interpolate between numbers using the correct progress range
33
- */
34
- export type ContentComposeParams = {
35
- start: MeasuredDimensions;
36
- end: MeasuredDimensions;
37
- geometry: ContentTransformGeometry;
38
- interp: Interp;
39
- computeOptions: BoundsBuilderOptions;
40
- };
41
-
42
- export function composeSizeAbsolute(params: ElementComposeParams): StyleProps {
43
- "worklet";
44
- const { start, end, geometry, interp } = params;
45
-
46
- if (geometry.entering) {
47
- return {
48
- width: interp(start.width, end.width),
49
- height: interp(start.height, end.height),
50
- transform: [
51
- { translateX: interp(start.pageX, end.pageX) },
52
- { translateY: interp(start.pageY, end.pageY) },
53
- ],
54
- } satisfies StyleProps;
55
- }
56
-
57
- return {
58
- width: interp(end.width, start.width),
59
- height: interp(end.height, start.height),
60
- transform: [
61
- { translateX: interp(end.pageX, start.pageX) },
62
- { translateY: interp(end.pageY, start.pageY) },
63
- ],
64
- };
65
- }
66
-
67
- export function composeSizeRelative(params: ElementComposeParams): StyleProps {
68
- "worklet";
69
- const { start, end, geometry, interp } = params;
70
-
71
- if (geometry.entering) {
72
- return {
73
- transform: [
74
- { translateX: interp(geometry.dx, 0) },
75
- { translateY: interp(geometry.dy, 0) },
76
- ],
77
- width: interp(start.width, end.width),
78
- height: interp(start.height, end.height),
79
- };
80
- }
81
-
82
- return {
83
- transform: [
84
- { translateX: interp(0, -geometry.dx) },
85
- { translateY: interp(0, -geometry.dy) },
86
- ],
87
- width: interp(end.width, start.width),
88
- height: interp(end.height, start.height),
89
- };
90
- }
91
-
92
- export function composeTransformAbsolute(
93
- params: ElementComposeParams,
94
- ): StyleProps {
95
- "worklet";
96
- const { start, end, geometry, interp } = params;
97
-
98
- if (geometry.entering) {
99
- return {
100
- transform: [
101
- { translateX: interp(start.pageX, end.pageX) },
102
- { translateY: interp(start.pageY, end.pageY) },
103
- { scaleX: interp(geometry.scaleX, 1) },
104
- { scaleY: interp(geometry.scaleY, 1) },
105
- ],
106
- };
107
- }
108
-
109
- return {
110
- transform: [
111
- { translateX: interp(end.pageX, start.pageX) },
112
- { translateY: interp(end.pageY, start.pageY) },
113
- { scaleX: interp(1, 1 / geometry.scaleX) },
114
- { scaleY: interp(1, 1 / geometry.scaleY) },
115
- ],
116
- };
117
- }
118
-
119
- export function composeTransformRelative(
120
- params: ElementComposeParams,
121
- ): StyleProps {
122
- "worklet";
123
- const { geometry, computeOptions, interp } = params;
124
-
125
- if (geometry.entering) {
126
- return {
127
- transform: [
128
- { translateX: computeOptions.gestures?.x ?? 0 },
129
- { translateY: computeOptions.gestures?.y ?? 0 },
130
- { translateX: interp(geometry.dx, 0) },
131
- { translateY: interp(geometry.dy, 0) },
132
- { scaleX: interp(geometry.scaleX, 1) },
133
- { scaleY: interp(geometry.scaleY, 1) },
134
- ],
135
- };
136
- }
137
-
138
- return {
139
- transform: [
140
- { translateX: computeOptions.gestures?.x ?? 0 },
141
- { translateY: computeOptions.gestures?.y ?? 0 },
142
- { translateX: interp(0, -geometry.dx) },
143
- { translateY: interp(0, -geometry.dy) },
144
- { scaleX: interp(1, 1 / geometry.scaleX) },
145
- { scaleY: interp(1, 1 / geometry.scaleY) },
146
- ],
147
- };
148
- }
149
-
150
- export function composeContentStyle(params: ContentComposeParams): StyleProps {
151
- "worklet";
152
- const { geometry, interp } = params;
153
- const { s, tx, ty, entering } = geometry;
154
-
155
- if (entering) {
156
- return {
157
- transform: [
158
- { translateX: interp(tx, 0) },
159
- { translateY: interp(ty, 0) },
160
- { scale: interp(s, 1) },
161
- ],
162
- };
163
- }
164
-
165
- return {
166
- transform: [
167
- { translateX: interp(0, tx) },
168
- { translateY: interp(0, ty) },
169
- { scale: interp(1, s) },
170
- ],
171
- };
172
- }