react-native-screen-transitions 1.2.0 → 2.0.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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +211 -156
  3. package/lib/commonjs/__tests__ /geometry.test.js +178 -0
  4. package/lib/commonjs/__tests__ /geometry.test.js.map +1 -0
  5. package/lib/commonjs/components/bounds-activator.js +33 -0
  6. package/lib/commonjs/components/bounds-activator.js.map +1 -0
  7. package/lib/commonjs/components/controllers/screen-lifecycle.js +66 -0
  8. package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -0
  9. package/lib/commonjs/components/create-transition-aware-component.js +96 -0
  10. package/lib/commonjs/components/create-transition-aware-component.js.map +1 -0
  11. package/lib/commonjs/components/root-transition-aware.js +56 -0
  12. package/lib/commonjs/components/root-transition-aware.js.map +1 -0
  13. package/lib/commonjs/configs/index.js +12 -0
  14. package/lib/commonjs/configs/index.js.map +1 -0
  15. package/lib/commonjs/configs/presets.js +206 -0
  16. package/lib/commonjs/configs/presets.js.map +1 -0
  17. package/lib/commonjs/configs/specs.js +14 -0
  18. package/lib/commonjs/configs/specs.js.map +1 -0
  19. package/lib/commonjs/hooks/animation/use-associated-style.js +36 -0
  20. package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -0
  21. package/lib/commonjs/hooks/animation/use-screen-animation.js +120 -0
  22. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -0
  23. package/lib/commonjs/hooks/bounds/use-bound-measurer.js +52 -0
  24. package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +1 -0
  25. package/lib/commonjs/hooks/gestures/use-build-gestures.js +239 -0
  26. package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -0
  27. package/lib/commonjs/hooks/gestures/use-scroll-progress.js +57 -0
  28. package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +1 -0
  29. package/lib/commonjs/hooks/use-stable-callback.js +17 -0
  30. package/lib/commonjs/hooks/use-stable-callback.js.map +1 -0
  31. package/lib/commonjs/index.js +37 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js +68 -0
  34. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
  35. package/lib/commonjs/integrations/native-stack/utils/debounce.js +16 -0
  36. package/lib/commonjs/integrations/native-stack/utils/debounce.js.map +1 -0
  37. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js +17 -0
  38. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
  39. package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js +18 -0
  40. package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
  41. package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js +22 -0
  42. package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
  43. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js +25 -0
  44. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
  45. package/lib/commonjs/integrations/native-stack/views/FontProcessor.js +10 -0
  46. package/lib/commonjs/integrations/native-stack/views/FontProcessor.js.map +1 -0
  47. package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js +18 -0
  48. package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
  49. package/lib/commonjs/integrations/native-stack/views/FooterComponent.js +17 -0
  50. package/lib/commonjs/integrations/native-stack/views/FooterComponent.js.map +1 -0
  51. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js +138 -0
  52. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -0
  53. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +497 -0
  54. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
  55. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js +203 -0
  56. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
  57. package/lib/commonjs/package.json +1 -0
  58. package/lib/commonjs/providers/gestures.js +64 -0
  59. package/lib/commonjs/providers/gestures.js.map +1 -0
  60. package/lib/commonjs/providers/keys.js +35 -0
  61. package/lib/commonjs/providers/keys.js.map +1 -0
  62. package/lib/commonjs/stores/animations.js +39 -0
  63. package/lib/commonjs/stores/animations.js.map +1 -0
  64. package/lib/commonjs/stores/bounds.js +64 -0
  65. package/lib/commonjs/stores/bounds.js.map +1 -0
  66. package/lib/commonjs/stores/gestures.js +38 -0
  67. package/lib/commonjs/stores/gestures.js.map +1 -0
  68. package/lib/commonjs/stores/navigator-dismiss-state.js +23 -0
  69. package/lib/commonjs/stores/navigator-dismiss-state.js.map +1 -0
  70. package/lib/commonjs/stores/utils/reset-stores-for-screen.js +20 -0
  71. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -0
  72. package/lib/commonjs/types/animation.js +6 -0
  73. package/lib/commonjs/types/animation.js.map +1 -0
  74. package/lib/commonjs/types/bounds.js +6 -0
  75. package/lib/commonjs/types/bounds.js.map +1 -0
  76. package/lib/commonjs/types/core.js +6 -0
  77. package/lib/commonjs/types/core.js.map +1 -0
  78. package/lib/commonjs/types/gesture.js +2 -0
  79. package/lib/commonjs/types/gesture.js.map +1 -0
  80. package/lib/commonjs/types/navigator.js +6 -0
  81. package/lib/commonjs/types/navigator.js.map +1 -0
  82. package/lib/commonjs/types/utils.js +2 -0
  83. package/lib/commonjs/types/utils.js.map +1 -0
  84. package/lib/commonjs/utils/animation/animate.js +18 -0
  85. package/lib/commonjs/utils/animation/animate.js.map +1 -0
  86. package/lib/commonjs/utils/animation/run-transition.js +48 -0
  87. package/lib/commonjs/utils/animation/run-transition.js.map +1 -0
  88. package/lib/commonjs/utils/bounds/_types/builder.js +6 -0
  89. package/lib/commonjs/utils/bounds/_types/builder.js.map +1 -0
  90. package/lib/commonjs/utils/bounds/_types/geometry.js +2 -0
  91. package/lib/commonjs/utils/bounds/_types/geometry.js.map +1 -0
  92. package/lib/commonjs/utils/bounds/_types/get-bounds.js +6 -0
  93. package/lib/commonjs/utils/bounds/_types/get-bounds.js.map +1 -0
  94. package/lib/commonjs/utils/bounds/build-bound-styles.js +145 -0
  95. package/lib/commonjs/utils/bounds/build-bound-styles.js.map +1 -0
  96. package/lib/commonjs/utils/bounds/constants.js +31 -0
  97. package/lib/commonjs/utils/bounds/constants.js.map +1 -0
  98. package/lib/commonjs/utils/bounds/flatten-styles.js +27 -0
  99. package/lib/commonjs/utils/bounds/flatten-styles.js.map +1 -0
  100. package/lib/commonjs/utils/bounds/geometry.js +94 -0
  101. package/lib/commonjs/utils/bounds/geometry.js.map +1 -0
  102. package/lib/commonjs/utils/bounds/get-bounds.js +51 -0
  103. package/lib/commonjs/utils/bounds/get-bounds.js.map +1 -0
  104. package/lib/commonjs/utils/bounds/index.js +38 -0
  105. package/lib/commonjs/utils/bounds/index.js.map +1 -0
  106. package/lib/commonjs/utils/bounds/style-composers.js +199 -0
  107. package/lib/commonjs/utils/bounds/style-composers.js.map +1 -0
  108. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +81 -0
  109. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
  110. package/lib/commonjs/utils/gesture/map-gesture-to-progress.js +17 -0
  111. package/lib/commonjs/utils/gesture/map-gesture-to-progress.js.map +1 -0
  112. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +21 -0
  113. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +1 -0
  114. package/lib/commonjs/utils/index.js +17 -0
  115. package/lib/commonjs/utils/index.js.map +1 -0
  116. package/lib/module/__tests__ /geometry.test.js +178 -0
  117. package/lib/module/__tests__ /geometry.test.js.map +1 -0
  118. package/lib/module/components/bounds-activator.js +28 -0
  119. package/lib/module/components/bounds-activator.js.map +1 -0
  120. package/lib/module/components/controllers/screen-lifecycle.js +60 -0
  121. package/lib/module/components/controllers/screen-lifecycle.js.map +1 -0
  122. package/lib/module/components/create-transition-aware-component.js +91 -0
  123. package/lib/module/components/create-transition-aware-component.js.map +1 -0
  124. package/lib/module/components/root-transition-aware.js +51 -0
  125. package/lib/module/components/root-transition-aware.js.map +1 -0
  126. package/lib/module/configs/index.js +5 -0
  127. package/lib/module/configs/index.js.map +1 -0
  128. package/lib/module/configs/presets.js +197 -0
  129. package/lib/module/configs/presets.js.map +1 -0
  130. package/lib/module/configs/specs.js +10 -0
  131. package/lib/module/configs/specs.js.map +1 -0
  132. package/lib/module/hooks/animation/use-associated-style.js +32 -0
  133. package/lib/module/hooks/animation/use-associated-style.js.map +1 -0
  134. package/lib/module/hooks/animation/use-screen-animation.js +115 -0
  135. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -0
  136. package/lib/module/hooks/bounds/use-bound-measurer.js +47 -0
  137. package/lib/module/hooks/bounds/use-bound-measurer.js.map +1 -0
  138. package/lib/module/hooks/gestures/use-build-gestures.js +234 -0
  139. package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -0
  140. package/lib/module/hooks/gestures/use-scroll-progress.js +52 -0
  141. package/lib/module/hooks/gestures/use-scroll-progress.js.map +1 -0
  142. package/lib/module/hooks/use-stable-callback.js +13 -0
  143. package/lib/module/hooks/use-stable-callback.js.map +1 -0
  144. package/lib/module/index.js +21 -0
  145. package/lib/module/index.js.map +1 -0
  146. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js +63 -0
  147. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
  148. package/lib/module/integrations/native-stack/utils/debounce.js +12 -0
  149. package/lib/module/integrations/native-stack/utils/debounce.js.map +1 -0
  150. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js +12 -0
  151. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
  152. package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js +12 -0
  153. package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
  154. package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js +17 -0
  155. package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
  156. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js +20 -0
  157. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
  158. package/lib/module/integrations/native-stack/views/FontProcessor.js +6 -0
  159. package/lib/module/integrations/native-stack/views/FontProcessor.js.map +1 -0
  160. package/lib/module/integrations/native-stack/views/FontProcessor.native.js +12 -0
  161. package/lib/module/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
  162. package/lib/module/integrations/native-stack/views/FooterComponent.js +13 -0
  163. package/lib/module/integrations/native-stack/views/FooterComponent.js.map +1 -0
  164. package/lib/module/integrations/native-stack/views/NativeStackView.js +133 -0
  165. package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -0
  166. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +492 -0
  167. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
  168. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js +199 -0
  169. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
  170. package/lib/module/providers/gestures.js +58 -0
  171. package/lib/module/providers/gestures.js.map +1 -0
  172. package/lib/module/providers/keys.js +29 -0
  173. package/lib/module/providers/keys.js.map +1 -0
  174. package/lib/module/stores/animations.js +33 -0
  175. package/lib/module/stores/animations.js.map +1 -0
  176. package/lib/module/stores/bounds.js +60 -0
  177. package/lib/module/stores/bounds.js.map +1 -0
  178. package/lib/module/stores/gestures.js +34 -0
  179. package/lib/module/stores/gestures.js.map +1 -0
  180. package/lib/module/stores/navigator-dismiss-state.js +19 -0
  181. package/lib/module/stores/navigator-dismiss-state.js.map +1 -0
  182. package/lib/module/stores/utils/reset-stores-for-screen.js +16 -0
  183. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -0
  184. package/lib/module/types/animation.js +4 -0
  185. package/lib/module/types/animation.js.map +1 -0
  186. package/lib/module/types/bounds.js +4 -0
  187. package/lib/module/types/bounds.js.map +1 -0
  188. package/lib/module/types/core.js +4 -0
  189. package/lib/module/types/core.js.map +1 -0
  190. package/lib/module/types/gesture.js +2 -0
  191. package/lib/module/types/gesture.js.map +1 -0
  192. package/lib/module/types/navigator.js +4 -0
  193. package/lib/module/types/navigator.js.map +1 -0
  194. package/lib/module/types/utils.js +2 -0
  195. package/lib/module/types/utils.js.map +1 -0
  196. package/lib/module/utils/animation/animate.js +13 -0
  197. package/lib/module/utils/animation/animate.js.map +1 -0
  198. package/lib/module/utils/animation/run-transition.js +43 -0
  199. package/lib/module/utils/animation/run-transition.js.map +1 -0
  200. package/lib/module/utils/bounds/_types/builder.js +4 -0
  201. package/lib/module/utils/bounds/_types/builder.js.map +1 -0
  202. package/lib/module/utils/bounds/_types/geometry.js +2 -0
  203. package/lib/module/utils/bounds/_types/geometry.js.map +1 -0
  204. package/lib/module/utils/bounds/_types/get-bounds.js +4 -0
  205. package/lib/module/utils/bounds/_types/get-bounds.js.map +1 -0
  206. package/lib/module/utils/bounds/build-bound-styles.js +141 -0
  207. package/lib/module/utils/bounds/build-bound-styles.js.map +1 -0
  208. package/lib/module/utils/bounds/constants.js +26 -0
  209. package/lib/module/utils/bounds/constants.js.map +1 -0
  210. package/lib/module/utils/bounds/flatten-styles.js +23 -0
  211. package/lib/module/utils/bounds/flatten-styles.js.map +1 -0
  212. package/lib/module/utils/bounds/geometry.js +89 -0
  213. package/lib/module/utils/bounds/geometry.js.map +1 -0
  214. package/lib/module/utils/bounds/get-bounds.js +46 -0
  215. package/lib/module/utils/bounds/get-bounds.js.map +1 -0
  216. package/lib/module/utils/bounds/index.js +33 -0
  217. package/lib/module/utils/bounds/index.js.map +1 -0
  218. package/lib/module/utils/bounds/style-composers.js +191 -0
  219. package/lib/module/utils/bounds/style-composers.js.map +1 -0
  220. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +76 -0
  221. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
  222. package/lib/module/utils/gesture/map-gesture-to-progress.js +12 -0
  223. package/lib/module/utils/gesture/map-gesture-to-progress.js.map +1 -0
  224. package/lib/module/utils/gesture/normalize-gesture-translation.js +16 -0
  225. package/lib/module/utils/gesture/normalize-gesture-translation.js.map +1 -0
  226. package/lib/module/utils/index.js +4 -0
  227. package/lib/module/utils/index.js.map +1 -0
  228. package/lib/typescript/components/bounds-activator.d.ts +8 -0
  229. package/lib/typescript/components/bounds-activator.d.ts.map +1 -0
  230. package/lib/typescript/components/controllers/screen-lifecycle.d.ts +6 -0
  231. package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -0
  232. package/lib/typescript/components/create-transition-aware-component.d.ts +9 -0
  233. package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -0
  234. package/lib/typescript/components/root-transition-aware.d.ts +6 -0
  235. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -0
  236. package/lib/typescript/configs/index.d.ts +3 -0
  237. package/lib/typescript/configs/index.d.ts.map +1 -0
  238. package/lib/typescript/configs/presets.d.ts +9 -0
  239. package/lib/typescript/configs/presets.d.ts.map +1 -0
  240. package/lib/typescript/configs/specs.d.ts +3 -0
  241. package/lib/typescript/configs/specs.d.ts.map +1 -0
  242. package/lib/typescript/hooks/animation/use-associated-style.d.ts +11 -0
  243. package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -0
  244. package/lib/typescript/hooks/animation/use-screen-animation.d.ts +7 -0
  245. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -0
  246. package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts +18 -0
  247. package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts.map +1 -0
  248. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +11 -0
  249. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -0
  250. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts +14 -0
  251. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +1 -0
  252. package/lib/typescript/hooks/use-stable-callback.d.ts +2 -0
  253. package/lib/typescript/hooks/use-stable-callback.d.ts.map +1 -0
  254. package/lib/typescript/index.d.ts +1275 -0
  255. package/lib/typescript/index.d.ts.map +1 -0
  256. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +16 -0
  257. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -0
  258. package/lib/typescript/integrations/native-stack/utils/debounce.d.ts +2 -0
  259. package/lib/typescript/integrations/native-stack/utils/debounce.d.ts.map +1 -0
  260. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +4 -0
  261. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -0
  262. package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts +5 -0
  263. package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  264. package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts +6 -0
  265. package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts.map +1 -0
  266. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +3 -0
  267. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
  268. package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts +2 -0
  269. package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts.map +1 -0
  270. package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts +2 -0
  271. package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts.map +1 -0
  272. package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts +7 -0
  273. package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts.map +1 -0
  274. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +11 -0
  275. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -0
  276. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +11 -0
  277. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -0
  278. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +44 -0
  279. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -0
  280. package/lib/typescript/providers/gestures.d.ts +22 -0
  281. package/lib/typescript/providers/gestures.d.ts.map +1 -0
  282. package/lib/typescript/providers/keys.d.ts +16 -0
  283. package/lib/typescript/providers/keys.d.ts.map +1 -0
  284. package/lib/typescript/stores/animations.d.ts +17 -0
  285. package/lib/typescript/stores/animations.d.ts.map +1 -0
  286. package/lib/typescript/stores/bounds.d.ts +21 -0
  287. package/lib/typescript/stores/bounds.d.ts.map +1 -0
  288. package/lib/typescript/stores/gestures.d.ts +21 -0
  289. package/lib/typescript/stores/gestures.d.ts.map +1 -0
  290. package/lib/typescript/stores/navigator-dismiss-state.d.ts +7 -0
  291. package/lib/typescript/stores/navigator-dismiss-state.d.ts.map +1 -0
  292. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +6 -0
  293. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -0
  294. package/lib/typescript/types/animation.d.ts +65 -0
  295. package/lib/typescript/types/animation.d.ts.map +1 -0
  296. package/lib/typescript/types/bounds.d.ts +73 -0
  297. package/lib/typescript/types/bounds.d.ts.map +1 -0
  298. package/lib/typescript/types/core.d.ts +47 -0
  299. package/lib/typescript/types/core.d.ts.map +1 -0
  300. package/lib/typescript/types/gesture.d.ts +28 -0
  301. package/lib/typescript/types/gesture.d.ts.map +1 -0
  302. package/lib/typescript/types/navigator.d.ts +683 -0
  303. package/lib/typescript/types/navigator.d.ts.map +1 -0
  304. package/lib/typescript/types/utils.d.ts +5 -0
  305. package/lib/typescript/types/utils.d.ts.map +1 -0
  306. package/lib/typescript/utils/animation/animate.d.ts +4 -0
  307. package/lib/typescript/utils/animation/animate.d.ts.map +1 -0
  308. package/lib/typescript/utils/animation/run-transition.d.ts +11 -0
  309. package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -0
  310. package/lib/typescript/utils/bounds/_types/builder.d.ts +36 -0
  311. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -0
  312. package/lib/typescript/utils/bounds/_types/geometry.d.ts +16 -0
  313. package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -0
  314. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +10 -0
  315. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -0
  316. package/lib/typescript/utils/bounds/build-bound-styles.d.ts +4 -0
  317. package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +1 -0
  318. package/lib/typescript/utils/bounds/constants.d.ts +7 -0
  319. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -0
  320. package/lib/typescript/utils/bounds/flatten-styles.d.ts +2 -0
  321. package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +1 -0
  322. package/lib/typescript/utils/bounds/geometry.d.ts +24 -0
  323. package/lib/typescript/utils/bounds/geometry.d.ts.map +1 -0
  324. package/lib/typescript/utils/bounds/get-bounds.d.ts +4 -0
  325. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +1 -0
  326. package/lib/typescript/utils/bounds/index.d.ts +15 -0
  327. package/lib/typescript/utils/bounds/index.d.ts.map +1 -0
  328. package/lib/typescript/utils/bounds/style-composers.d.ts +40 -0
  329. package/lib/typescript/utils/bounds/style-composers.d.ts.map +1 -0
  330. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +17 -0
  331. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +1 -0
  332. package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts +5 -0
  333. package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts.map +1 -0
  334. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +6 -0
  335. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +1 -0
  336. package/lib/typescript/utils/index.d.ts +2 -0
  337. package/lib/typescript/utils/index.d.ts.map +1 -0
  338. package/package.json +67 -54
  339. package/dist/index.d.mts +0 -1513
  340. package/dist/index.d.ts +0 -1513
  341. package/dist/index.js +0 -1283
  342. package/dist/index.js.map +0 -1
  343. package/dist/index.mjs +0 -1279
  344. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ import { runOnJS } from "react-native-reanimated";
4
+ import { animate } from "./animate";
5
+ export const runTransition = ({
6
+ target,
7
+ spec,
8
+ onFinish,
9
+ animations
10
+ }) => {
11
+ "worklet";
12
+
13
+ const value = target === "open" ? 1 : 0;
14
+ const config = target === "open" ? spec?.open : spec?.close;
15
+ const {
16
+ progress,
17
+ animating,
18
+ closing
19
+ } = animations;
20
+ if (target === "close") {
21
+ closing.value = 1;
22
+ }
23
+ if (!config) {
24
+ animating.value = 0;
25
+ progress.value = value;
26
+ if (onFinish) {
27
+ runOnJS(onFinish)(true);
28
+ }
29
+ return;
30
+ }
31
+ animating.value = 1;
32
+ progress.value = animate(value, config, finished => {
33
+ "worklet";
34
+
35
+ if (finished) {
36
+ animating.value = 0;
37
+ if (onFinish) {
38
+ runOnJS(onFinish)(finished);
39
+ }
40
+ }
41
+ });
42
+ };
43
+ //# sourceMappingURL=run-transition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["runOnJS","animate","runTransition","target","spec","onFinish","animations","value","config","open","close","progress","animating","closing","finished"],"sourceRoot":"../../../../src","sources":["utils/animation/run-transition.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,yBAAyB;AAGjD,SAASC,OAAO,QAAQ,WAAW;AASnC,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC7BC,MAAM;EACNC,IAAI;EACJC,QAAQ;EACRC;AACmB,CAAC,KAAK;EACzB,SAAS;;EACT,MAAMC,KAAK,GAAGJ,MAAM,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC;EACvC,MAAMK,MAAM,GAAGL,MAAM,KAAK,MAAM,GAAGC,IAAI,EAAEK,IAAI,GAAGL,IAAI,EAAEM,KAAK;EAE3D,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAGP,UAAU;EAEnD,IAAIH,MAAM,KAAK,OAAO,EAAE;IACvBU,OAAO,CAACN,KAAK,GAAG,CAAC;EAClB;EAEA,IAAI,CAACC,MAAM,EAAE;IACZI,SAAS,CAACL,KAAK,GAAG,CAAC;IACnBI,QAAQ,CAACJ,KAAK,GAAGA,KAAK;IAEtB,IAAIF,QAAQ,EAAE;MACbL,OAAO,CAACK,QAAQ,CAAC,CAAC,IAAI,CAAC;IACxB;IACA;EACD;EAEAO,SAAS,CAACL,KAAK,GAAG,CAAC;EACnBI,QAAQ,CAACJ,KAAK,GAAGN,OAAO,CAACM,KAAK,EAAEC,MAAM,EAAGM,QAAQ,IAAK;IACrD,SAAS;;IACT,IAAIA,QAAQ,EAAE;MACbF,SAAS,CAACL,KAAK,GAAG,CAAC;MACnB,IAAIF,QAAQ,EAAE;QACbL,OAAO,CAACK,QAAQ,CAAC,CAACS,QAAQ,CAAC;MAC5B;IACD;EACD,CAAC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/bounds/_types/builder.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/bounds/_types/geometry.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=get-bounds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/bounds/_types/get-bounds.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ import { interpolate } from "react-native-reanimated";
4
+ import { DEFAULT_BUILDER_OPTIONS, FULLSCREEN_DIMENSIONS } from "./constants";
5
+ import { computeContentTransformGeometry, computeRelativeGeometry } from "./geometry";
6
+ import { composeContentStyle, composeSizeAbsolute, composeSizeRelative, composeTransformAbsolute, composeTransformRelative } from "./style-composers";
7
+ function resolveBounds(props) {
8
+ "worklet";
9
+
10
+ const entering = !props.next;
11
+ const fullscreen = FULLSCREEN_DIMENSIONS(props.dimensions);
12
+ const startPhase = entering ? "previous" : "current";
13
+ const endPhase = entering ? "current" : "next";
14
+ const resolve = phase => {
15
+ "worklet";
16
+
17
+ if (phase === "previous") return props.previous?.bounds?.[props.id]?.bounds;
18
+ if (phase === "current") return props.current?.bounds?.[props.id]?.bounds;
19
+ if (phase === "next") return props.next?.bounds?.[props.id]?.bounds;
20
+ return null;
21
+ };
22
+ const start = resolve(startPhase);
23
+ let end = resolve(endPhase);
24
+ if (props.computeOptions.toFullscreen) {
25
+ end = fullscreen;
26
+ }
27
+ return {
28
+ start,
29
+ end,
30
+ entering
31
+ };
32
+ }
33
+ const computeBoundStyles = ({
34
+ id,
35
+ previous,
36
+ current,
37
+ next,
38
+ progress,
39
+ dimensions
40
+ }, computeOptions = {}) => {
41
+ "worklet";
42
+
43
+ if (!id) return {};
44
+ const {
45
+ start,
46
+ end,
47
+ entering
48
+ } = resolveBounds({
49
+ id,
50
+ previous,
51
+ current,
52
+ next,
53
+ computeOptions: computeOptions,
54
+ dimensions
55
+ });
56
+ if (!start || !end) return {};
57
+ const relativeGeometry = computeRelativeGeometry({
58
+ start,
59
+ end,
60
+ entering
61
+ });
62
+ const interp = (a, b) => interpolate(progress, relativeGeometry.ranges, [a, b]);
63
+ const common = {
64
+ start,
65
+ end,
66
+ interp,
67
+ geometry: relativeGeometry,
68
+ computeOptions
69
+ };
70
+ const isSize = computeOptions.method === "size";
71
+ const isAbs = !!computeOptions.absolute;
72
+ if (computeOptions.method === "content") {
73
+ const contentGeometry = computeContentTransformGeometry({
74
+ start,
75
+ end,
76
+ entering,
77
+ dimensions,
78
+ contentScaleMode: computeOptions.contentScaleMode ?? "auto"
79
+ });
80
+ return composeContentStyle({
81
+ ...common,
82
+ geometry: contentGeometry,
83
+ computeOptions
84
+ });
85
+ }
86
+ return isSize ? isAbs ? composeSizeAbsolute(common) : composeSizeRelative(common) : isAbs ? composeTransformAbsolute(common) : composeTransformRelative(common);
87
+ };
88
+ export function buildBoundStyles(params) {
89
+ "worklet";
90
+
91
+ const cfg = {
92
+ options: {
93
+ ...DEFAULT_BUILDER_OPTIONS
94
+ }
95
+ };
96
+ const builder = () => ({
97
+ gestures: options => {
98
+ cfg.options.gestures = options;
99
+ return builder();
100
+ },
101
+ toFullscreen: () => {
102
+ cfg.options.toFullscreen = true;
103
+ return builder();
104
+ },
105
+ absolute: () => {
106
+ cfg.options.absolute = true;
107
+ cfg.options.relative = false;
108
+ return builder();
109
+ },
110
+ relative: () => {
111
+ cfg.options.relative = true;
112
+ cfg.options.absolute = false;
113
+ return builder();
114
+ },
115
+ transform: () => {
116
+ cfg.options.method = "transform";
117
+ return builder();
118
+ },
119
+ size: () => {
120
+ cfg.options.method = "size";
121
+ return builder();
122
+ },
123
+ content: () => {
124
+ cfg.options.method = "content";
125
+ return builder();
126
+ },
127
+ contentFill: () => {
128
+ cfg.options.contentScaleMode = "aspectFill";
129
+ return builder();
130
+ },
131
+ contentFit: () => {
132
+ cfg.options.contentScaleMode = "aspectFit";
133
+ return builder();
134
+ },
135
+ build: () => {
136
+ return computeBoundStyles(params, cfg.options);
137
+ }
138
+ });
139
+ return builder();
140
+ }
141
+ //# sourceMappingURL=build-bound-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["interpolate","DEFAULT_BUILDER_OPTIONS","FULLSCREEN_DIMENSIONS","computeContentTransformGeometry","computeRelativeGeometry","composeContentStyle","composeSizeAbsolute","composeSizeRelative","composeTransformAbsolute","composeTransformRelative","resolveBounds","props","entering","next","fullscreen","dimensions","startPhase","endPhase","resolve","phase","previous","bounds","id","current","start","end","computeOptions","toFullscreen","computeBoundStyles","progress","relativeGeometry","interp","a","b","ranges","common","geometry","isSize","method","isAbs","absolute","contentGeometry","contentScaleMode","buildBoundStyles","params","cfg","options","builder","gestures","relative","transform","size","content","contentFill","contentFit","build"],"sourceRoot":"../../../../src","sources":["utils/bounds/build-bound-styles.ts"],"mappings":";;AACA,SAASA,WAAW,QAAiC,yBAAyB;AAQ9E,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,aAAa;AAC5E,SACCC,+BAA+B,EAC/BC,uBAAuB,QACjB,YAAY;AACnB,SACCC,mBAAmB,EACnBC,mBAAmB,EACnBC,mBAAmB,EACnBC,wBAAwB,EACxBC,wBAAwB,QAElB,mBAAmB;AAE1B,SAASC,aAAaA,CAACC,KAQtB,EAAE;EACF,SAAS;;EACT,MAAMC,QAAQ,GAAG,CAACD,KAAK,CAACE,IAAI;EAE5B,MAAMC,UAAU,GAAGZ,qBAAqB,CAACS,KAAK,CAACI,UAAU,CAAC;EAE1D,MAAMC,UAAuB,GAAGJ,QAAQ,GAAG,UAAU,GAAG,SAAS;EACjE,MAAMK,QAAqB,GAAGL,QAAQ,GAAG,SAAS,GAAG,MAAM;EAE3D,MAAMM,OAAO,GAAIC,KAAmB,IAAK;IACxC,SAAS;;IACT,IAAIA,KAAK,KAAK,UAAU,EAAE,OAAOR,KAAK,CAACS,QAAQ,EAAEC,MAAM,GAAGV,KAAK,CAACW,EAAE,CAAC,EAAED,MAAM;IAC3E,IAAIF,KAAK,KAAK,SAAS,EAAE,OAAOR,KAAK,CAACY,OAAO,EAAEF,MAAM,GAAGV,KAAK,CAACW,EAAE,CAAC,EAAED,MAAM;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CAAC;IACjB,CAAC;IACDE,QAAQ,EAAEA,CAAA,KAAM;MACfJ,GAAG,CAACC,OAAO,CAACG,QAAQ,GAAG,IAAI;MAC3BJ,GAAG,CAACC,OAAO,CAACN,QAAQ,GAAG,KAAK;MAC5B,OAAOO,OAAO,CAAC,CAAC;IACjB,CAAC;IACDG,SAAS,EAAEA,CAAA,KAAM;MAChBL,GAAG,CAACC,OAAO,CAACR,MAAM,GAAG,WAAW;MAChC,OAAOS,OAAO,CAAC,CAAC;IACjB,CAAC;IACDI,IAAI,EAAEA,CAAA,KAAM;MACXN,GAAG,CAACC,OAAO,CAACR,MAAM,GAAG,MAAM;MAC3B,OAAOS,OAAO,CAAC,CAAC;IACjB,CAAC;IACDK,OAAO,EAAEA,CAAA,KAAM;MACdP,GAAG,CAACC,OAAO,CAACR,MAAM,GAAG,SAAS;MAC9B,OAAOS,OAAO,CAAC,CAAC;IACjB,CAAC;IACDM,WAAW,EAAEA,CAAA,KAAM;MAClBR,GAAG,CAACC,OAAO,CAACJ,gBAAgB,GAAG,YAAY;MAC3C,OAAOK,OAAO,CAAC,CAAC;IACjB,CAAC;IACDO,UAAU,EAAEA,CAAA,KAAM;MACjBT,GAAG,CAACC,OAAO,CAACJ,gBAAgB,GAAG,WAAW;MAC1C,OAAOK,OAAO,CAAC,CAAC;IACjB,CAAC;IAEDQ,KAAK,EAAEA,CAAA,KAAM;MACZ,OAAO3B,kBAAkB,CAACgB,MAAM,EAAEC,GAAG,CAACC,OAAO,CAAC;IAC/C;EACD,CAAC,CAAC;EAEF,OAAOC,OAAO,CAAC,CAAC;AACjB","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ export const FULLSCREEN_DIMENSIONS = dimensions => {
4
+ "worklet";
5
+
6
+ return {
7
+ x: 0,
8
+ y: 0,
9
+ pageX: 0,
10
+ pageY: 0,
11
+ width: dimensions.width,
12
+ height: dimensions.height
13
+ };
14
+ };
15
+ export const DEFAULT_BUILDER_OPTIONS = Object.freeze({
16
+ gestures: {
17
+ x: 0,
18
+ y: 0
19
+ },
20
+ toFullscreen: false,
21
+ absolute: false,
22
+ relative: true,
23
+ method: "transform",
24
+ contentScaleMode: "auto"
25
+ });
26
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FULLSCREEN_DIMENSIONS","dimensions","x","y","pageX","pageY","width","height","DEFAULT_BUILDER_OPTIONS","Object","freeze","gestures","toFullscreen","absolute","relative","method","contentScaleMode"],"sourceRoot":"../../../../src","sources":["utils/bounds/constants.ts"],"mappings":";;AAKA,OAAO,MAAMA,qBAAqB,GACjCC,UAAsB,IACE;EACxB,SAAS;;EACT,OAAO;IACNC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAEL,UAAU,CAACK,KAAK;IACvBC,MAAM,EAAEN,UAAU,CAACM;EACpB,CAAC;AACF,CAAC;AAED,OAAO,MAAMC,uBAAuD,GACnEC,MAAM,CAACC,MAAM,CAAC;EACbC,QAAQ,EAAE;IAAET,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC;EACxBS,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAE,WAAW;EACnBC,gBAAgB,EAAE;AACnB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ export function flattenStyle(style) {
4
+ "worklet";
5
+
6
+ if (style === null || typeof style !== "object") {
7
+ return style;
8
+ }
9
+ if (!Array.isArray(style)) {
10
+ return style;
11
+ }
12
+ const result = {};
13
+ for (let i = 0, styleLength = style.length; i < styleLength; ++i) {
14
+ const computedStyle = flattenStyle(style[i]);
15
+ if (computedStyle) {
16
+ for (const key in computedStyle) {
17
+ result[key] = computedStyle[key];
18
+ }
19
+ }
20
+ }
21
+ return result;
22
+ }
23
+ //# sourceMappingURL=flatten-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["flattenStyle","style","Array","isArray","result","i","styleLength","length","computedStyle","key"],"sourceRoot":"../../../../src","sources":["utils/bounds/flatten-styles.ts"],"mappings":";;AAAA,OAAO,SAASA,YAAYA,CAAaC,KAAiB,EAAc;EACvE,SAAS;;EACT,IAAIA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAChD,OAAOA,KAAK;EACb;EAEA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IAC1B,OAAOA,KAAK;EACb;EAEA,MAAMG,MAAqC,GAAG,CAAC,CAAC;EAChD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,WAAW,GAAGL,KAAK,CAACM,MAAM,EAAEF,CAAC,GAAGC,WAAW,EAAE,EAAED,CAAC,EAAE;IACjE,MAAMG,aAAa,GAAGR,YAAY,CAACC,KAAK,CAACI,CAAC,CAAC,CAAC;IAC5C,IAAIG,aAAa,EAAE;MAClB,KAAK,MAAMC,GAAG,IAAID,aAAa,EAAE;QAChCJ,MAAM,CAACK,GAAG,CAAC,GAAGD,aAAa,CAACC,GAAG,CAAC;MACjC;IACD;EACD;EACA,OAAOL,MAAM;AACd","ignoreList":[]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Relative geometry between start/end bounds.
5
+ */
6
+ export function computeRelativeGeometry({
7
+ start,
8
+ end,
9
+ entering
10
+ }) {
11
+ "worklet";
12
+
13
+ const startCenterX = start.pageX + start.width / 2;
14
+ const startCenterY = start.pageY + start.height / 2;
15
+ const endCenterX = end.pageX + end.width / 2;
16
+ const endCenterY = end.pageY + end.height / 2;
17
+ const dx = startCenterX - endCenterX;
18
+ const dy = startCenterY - endCenterY;
19
+ const scaleX = start.width / end.width;
20
+ const scaleY = start.height / end.height;
21
+ const ranges = entering ? [0, 1] : [1, 2];
22
+ return {
23
+ dx,
24
+ dy,
25
+ scaleX,
26
+ scaleY,
27
+ ranges,
28
+ entering
29
+ };
30
+ }
31
+ /**
32
+ * Computes the transform to apply to the entire destination screen so that
33
+ * its bound (end) matches the source bound (start) at progress start.
34
+ */
35
+ export function computeContentTransformGeometry({
36
+ start,
37
+ end,
38
+ entering,
39
+ dimensions,
40
+ contentScaleMode
41
+ }) {
42
+ "worklet";
43
+
44
+ const parent = {
45
+ x: 0,
46
+ y: 0,
47
+ width: dimensions.width,
48
+ height: dimensions.height
49
+ };
50
+ const startCenterX = start.pageX + start.width / 2;
51
+ const startCenterY = start.pageY + start.height / 2;
52
+ const childCenterX = end.pageX + end.width / 2;
53
+ const childCenterY = end.pageY + end.height / 2;
54
+ const parentCenterX = parent.x + parent.width / 2;
55
+ const parentCenterY = parent.y + parent.height / 2;
56
+ const safe = v => v === 0 ? 1e-6 : v;
57
+ const sx = safe(start.width) / safe(end.width);
58
+ const sy = safe(start.height) / safe(end.height);
59
+ let s;
60
+ if (contentScaleMode === "aspectFit") {
61
+ s = Math.min(sx, sy);
62
+ } else if (contentScaleMode === "aspectFill") {
63
+ s = Math.max(sx, sy);
64
+ } else {
65
+ const startAspect = start.width / start.height;
66
+ const endAspect = end.width / end.height;
67
+ const aspectDifference = Math.abs(startAspect - endAspect);
68
+ if (aspectDifference < 0.1) {
69
+ s = Math.max(sx, sy);
70
+ } else {
71
+ s = Math.min(sx, sy);
72
+ }
73
+ }
74
+ const offsetX = startCenterX - parentCenterX;
75
+ const offsetY = startCenterY - parentCenterY;
76
+ const centerOffsetX = (parentCenterX - childCenterX) * s;
77
+ const centerOffsetY = (parentCenterY - childCenterY) * s;
78
+ const tx = offsetX + centerOffsetX;
79
+ const ty = offsetY + centerOffsetY;
80
+ const ranges = entering ? [0, 1] : [1, 2];
81
+ return {
82
+ tx,
83
+ ty,
84
+ s,
85
+ ranges,
86
+ entering
87
+ };
88
+ }
89
+ //# sourceMappingURL=geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["computeRelativeGeometry","start","end","entering","startCenterX","pageX","width","startCenterY","pageY","height","endCenterX","endCenterY","dx","dy","scaleX","scaleY","ranges","computeContentTransformGeometry","dimensions","contentScaleMode","parent","x","y","childCenterX","childCenterY","parentCenterX","parentCenterY","safe","v","sx","sy","s","Math","min","max","startAspect","endAspect","aspectDifference","abs","offsetX","offsetY","centerOffsetX","centerOffsetY","tx","ty"],"sourceRoot":"../../../../src","sources":["utils/bounds/geometry.ts"],"mappings":";;AAQA;AACA;AACA;AACA,OAAO,SAASA,uBAAuBA,CAAC;EACvCC,KAAK;EACLC,GAAG;EACHC;AAKD,CAAC,EAAoB;EACpB,SAAS;;EACT,MAAMC,YAAY,GAAGH,KAAK,CAACI,KAAK,GAAGJ,KAAK,CAACK,KAAK,GAAG,CAAC;EAClD,MAAMC,YAAY,GAAGN,KAAK,CAACO,KAAK,GAAGP,KAAK,CAACQ,MAAM,GAAG,CAAC;EACnD,MAAMC,UAAU,GAAGR,GAAG,CAACG,KAAK,GAAGH,GAAG,CAACI,KAAK,GAAG,CAAC;EAC5C,MAAMK,UAAU,GAAGT,GAAG,CAACM,KAAK,GAAGN,GAAG,CAACO,MAAM,GAAG,CAAC;EAE7C,MAAMG,EAAE,GAAGR,YAAY,GAAGM,UAAU;EACpC,MAAMG,EAAE,GAAGN,YAAY,GAAGI,UAAU;EAEpC,MAAMG,MAAM,GAAGb,KAAK,CAACK,KAAK,GAAGJ,GAAG,CAACI,KAAK;EACtC,MAAMS,MAAM,GAAGd,KAAK,CAACQ,MAAM,GAAGP,GAAG,CAACO,MAAM;EAExC,MAAMO,MAAiC,GAAGb,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;EAEpE,OAAO;IAAES,EAAE;IAAEC,EAAE;IAAEC,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEb;EAAS,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASc,+B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styles: {}
13
+ };
14
+ export const getBounds = props => {
15
+ "worklet";
16
+
17
+ const boundId = props.id;
18
+ const phase = props.phase;
19
+ if (phase && boundId) {
20
+ let phaseBounds = null;
21
+ if (phase === "current") {
22
+ phaseBounds = props.current?.bounds[boundId];
23
+ } else if (phase === "next") {
24
+ phaseBounds = props.next?.bounds[boundId];
25
+ } else {
26
+ phaseBounds = props.previous?.bounds[boundId];
27
+ }
28
+ if (!phaseBounds) {
29
+ return fallbackBounds;
30
+ }
31
+ return {
32
+ bounds: phaseBounds.bounds,
33
+ styles: phaseBounds?.styles
34
+ };
35
+ }
36
+ if (!props.next && boundId) {
37
+ const previousBounds = props.previous?.bounds[boundId];
38
+ return previousBounds || fallbackBounds;
39
+ }
40
+ if (boundId) {
41
+ const nextBounds = props.next?.bounds[boundId];
42
+ return nextBounds || fallbackBounds;
43
+ }
44
+ return fallbackBounds;
45
+ };
46
+ //# sourceMappingURL=get-bounds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fallbackBounds","bounds","width","height","x","y","pageX","pageY","styles","getBounds","props","boundId","id","phase","phaseBounds","current","next","previous","previousBounds","nextBounds"],"sourceRoot":"../../../../src","sources":["utils/bounds/get-bounds.ts"],"mappings":";;AAIA,MAAMA,cAAc,GAAG;EACtBC,MAAM,EAAE;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE;EACR,CAAC;EACDC,MAAM,EAAE,CAAC;AACV,CAAC;AAED,OAAO,MAAMC,SAAS,GAAIC,KAAsB,IAAiB;EAChE,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK;EAEzB,IAAIA,KAAK,IAAIF,OAAO,EAAE;IACrB,IAAIG,WAAW,GAAG,IAAI;IAEtB,IAAID,KAAK,KAAK,SAAS,EAAE;MACxBC,WAAW,GAAGJ,KAAK,CAACK,OAAO,EAAEd,MAAM,CAACU,OAAO,CAAC;IAC7C,CAAC,MAAM,IAAIE,KAAK,KAAK,MAAM,EAAE;MAC5BC,WAAW,GAAGJ,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAC1C,CAAC,MAAM;MACNG,WAAW,GAAGJ,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAC9C;IAEA,IAAI,CAACG,WAAW,EAAE;MACjB,OAAOd,cAAc;IACtB;IAEA,OAAO;MACNC,MAAM,EAAEa,WAAW,CAACb,MAAM;MAC1BO,MAAM,EAAEM,WAAW,EAAEN;IACtB,CAAC;EACF;EAEA,IAAI,CAACE,KAAK,CAACM,IAAI,IAAIL,OAAO,EAAE;IAC3B,MAAMO,cAAc,GAAGR,KAAK,CAACO,QAAQ,EAAEhB,MAAM,CAACU,OAAO,CAAC;IAEtD,OAAOO,cAAc,IAAIlB,cAAc;EACxC;EAEA,IAAIW,OAAO,EAAE;IACZ,MAAMQ,UAAU,GAAGT,KAAK,CAACM,IAAI,EAAEf,MAAM,CAACU,OAAO,CAAC;IAE9C,OAAOQ,UAAU,IAAInB,cAAc;EACpC;EAEA,OAAOA,cAAc;AACtB,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import { buildBoundStyles } from "./build-bound-styles";
4
+ import { getBounds } from "./get-bounds";
5
+ export const buildBoundsAccessor = ({
6
+ activeBoundId,
7
+ current,
8
+ previous,
9
+ next,
10
+ progress,
11
+ dimensions
12
+ }) => {
13
+ "worklet";
14
+
15
+ const bounds = id => buildBoundStyles({
16
+ id: id ?? activeBoundId,
17
+ previous,
18
+ current,
19
+ next,
20
+ progress,
21
+ dimensions
22
+ });
23
+ return Object.assign(bounds, {
24
+ get: (id, phase) => getBounds({
25
+ id: id ?? activeBoundId,
26
+ phase,
27
+ current,
28
+ previous,
29
+ next
30
+ })
31
+ });
32
+ };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["buildBoundStyles","getBounds","buildBoundsAccessor","activeBoundId","current","previous","next","progress","dimensions","bounds","id","Object","assign","get","phase"],"sourceRoot":"../../../../src","sources":["utils/bounds/index.ts"],"mappings":";;AAGA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,SAAS,QAAQ,cAAc;AAWxC,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EACnCC,aAAa;EACbC,OAAO;EACPC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC;AAC0B,CAAC,KAAK;EAChC,SAAS;;EAET,MAAMC,MAAM,GAAIC,EAAW,IAC1BV,gBAAgB,CAAC;IAChBU,EAAE,EAAEA,EAAE,IAAIP,aAAa;IACvBE,QAAQ;IACRD,OAAO;IACPE,IAAI;IACJC,QAAQ;IACRC;EACD,CAAC,CAAC;EAEH,OAAOG,MAAM,CAACC,MAAM,CAACH,MAAM,EAAE;IAC5BI,GAAG,EAAEA,CAACH,EAAW,EAAEI,KAAmB,KACrCb,SAAS,CAAC;MACTS,EAAE,EAAEA,EAAE,IAAIP,aAAa;MACvBW,KAAK;MACLV,OAAO;MACPC,QAAQ;MACRC;IACD,CAAC;EACH,CAAC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Common interpolation helper signature used by composers.
5
+ * It maps from a -> b over the already-determined progress range.
6
+ */
7
+
8
+ /**
9
+ * Element-level (relative) params shared by size/transform composers.
10
+ * - start/end: absolute window bounds of the element in previous/next phases
11
+ * - geometry: relative deltas and scales between start/end (dx, dy, scaleX, scaleY, ...)
12
+ * - interp: function to interpolate between numbers using the correct progress range
13
+ */
14
+
15
+ /**
16
+ * Screen-level content transform params (for aligning destination bound to source).
17
+ * - start/end: absolute window bounds for the shared id (source/destination)
18
+ * - geometry: precomputed screen-level tx/ty/sx/sy plus ranges/entering
19
+ * - interp: function to interpolate between numbers using the correct progress range
20
+ */
21
+
22
+ export function composeSizeAbsolute(params) {
23
+ "worklet";
24
+
25
+ const {
26
+ start,
27
+ end,
28
+ geometry,
29
+ interp
30
+ } = params;
31
+ if (geometry.entering) {
32
+ return {
33
+ width: interp(start.width, end.width),
34
+ height: interp(start.height, end.height),
35
+ transform: [{
36
+ translateX: interp(start.pageX, end.pageX)
37
+ }, {
38
+ translateY: interp(start.pageY, end.pageY)
39
+ }]
40
+ };
41
+ }
42
+ return {
43
+ width: interp(end.width, start.width),
44
+ height: interp(end.height, start.height),
45
+ transform: [{
46
+ translateX: interp(end.pageX, start.pageX)
47
+ }, {
48
+ translateY: interp(end.pageY, start.pageY)
49
+ }]
50
+ };
51
+ }
52
+ export function composeSizeRelative(params) {
53
+ "worklet";
54
+
55
+ const {
56
+ start,
57
+ end,
58
+ geometry,
59
+ interp
60
+ } = params;
61
+ if (geometry.entering) {
62
+ return {
63
+ transform: [{
64
+ translateX: interp(geometry.dx, 0)
65
+ }, {
66
+ translateY: interp(geometry.dy, 0)
67
+ }],
68
+ width: interp(start.width, end.width),
69
+ height: interp(start.height, end.height)
70
+ };
71
+ }
72
+ return {
73
+ transform: [{
74
+ translateX: interp(0, -geometry.dx)
75
+ }, {
76
+ translateY: interp(0, -geometry.dy)
77
+ }],
78
+ width: interp(end.width, start.width),
79
+ height: interp(end.height, start.height)
80
+ };
81
+ }
82
+ export function composeTransformAbsolute(params) {
83
+ "worklet";
84
+
85
+ const {
86
+ start,
87
+ end,
88
+ geometry,
89
+ interp
90
+ } = params;
91
+ if (geometry.entering) {
92
+ return {
93
+ transform: [{
94
+ translateX: interp(start.pageX, end.pageX)
95
+ }, {
96
+ translateY: interp(start.pageY, end.pageY)
97
+ }, {
98
+ scaleX: interp(geometry.scaleX, 1)
99
+ }, {
100
+ scaleY: interp(geometry.scaleY, 1)
101
+ }]
102
+ };
103
+ }
104
+ return {
105
+ transform: [{
106
+ translateX: interp(end.pageX, start.pageX)
107
+ }, {
108
+ translateY: interp(end.pageY, start.pageY)
109
+ }, {
110
+ scaleX: interp(1, 1 / geometry.scaleX)
111
+ }, {
112
+ scaleY: interp(1, 1 / geometry.scaleY)
113
+ }]
114
+ };
115
+ }
116
+ export function composeTransformRelative(params) {
117
+ "worklet";
118
+
119
+ const {
120
+ geometry,
121
+ computeOptions,
122
+ interp
123
+ } = params;
124
+ if (geometry.entering) {
125
+ return {
126
+ transform: [{
127
+ translateX: computeOptions.gestures?.x ?? 0
128
+ }, {
129
+ translateY: computeOptions.gestures?.y ?? 0
130
+ }, {
131
+ translateX: interp(geometry.dx, 0)
132
+ }, {
133
+ translateY: interp(geometry.dy, 0)
134
+ }, {
135
+ scaleX: interp(geometry.scaleX, 1)
136
+ }, {
137
+ scaleY: interp(geometry.scaleY, 1)
138
+ }]
139
+ };
140
+ }
141
+ return {
142
+ transform: [{
143
+ translateX: computeOptions.gestures?.x ?? 0
144
+ }, {
145
+ translateY: computeOptions.gestures?.y ?? 0
146
+ }, {
147
+ translateX: interp(0, -geometry.dx)
148
+ }, {
149
+ translateY: interp(0, -geometry.dy)
150
+ }, {
151
+ scaleX: interp(1, 1 / geometry.scaleX)
152
+ }, {
153
+ scaleY: interp(1, 1 / geometry.scaleY)
154
+ }]
155
+ };
156
+ }
157
+ export function composeContentStyle(params) {
158
+ "worklet";
159
+
160
+ const {
161
+ geometry,
162
+ interp
163
+ } = params;
164
+ const {
165
+ s,
166
+ tx,
167
+ ty,
168
+ entering
169
+ } = geometry;
170
+ if (entering) {
171
+ return {
172
+ transform: [{
173
+ translateX: interp(tx, 0)
174
+ }, {
175
+ translateY: interp(ty, 0)
176
+ }, {
177
+ scale: interp(s, 1)
178
+ }]
179
+ };
180
+ }
181
+ return {
182
+ transform: [{
183
+ translateX: interp(0, tx)
184
+ }, {
185
+ translateY: interp(0, ty)
186
+ }, {
187
+ scale: interp(1, s)
188
+ }]
189
+ };
190
+ }
191
+ //# sourceMappingURL=style-composers.js.map