react-native-screen-transitions 3.9.0-beta.2 → 3.9.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 (262) hide show
  1. package/lib/commonjs/shared/components/boundary/components/boundary-target.js +19 -14
  2. package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
  3. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +14 -7
  4. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  5. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -0
  6. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
  7. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +32 -2
  8. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  9. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js +4 -3
  10. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
  11. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js +3 -2
  12. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  13. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -3
  14. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  15. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +2 -3
  16. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -1
  17. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +1 -0
  18. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  19. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js +1 -3
  20. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  21. package/lib/commonjs/shared/components/boundary/portal/teleport.js +2 -1
  22. package/lib/commonjs/shared/components/boundary/portal/teleport.js.map +1 -1
  23. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js +4 -1
  24. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js.map +1 -1
  25. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +16 -3
  26. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  27. package/lib/commonjs/shared/configs/index.js +2 -1
  28. package/lib/commonjs/shared/configs/index.js.map +1 -1
  29. package/lib/commonjs/shared/configs/specs.js +23 -1
  30. package/lib/commonjs/shared/configs/specs.js.map +1 -1
  31. package/lib/commonjs/shared/constants.js +4 -0
  32. package/lib/commonjs/shared/constants.js.map +1 -1
  33. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +4 -0
  34. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  35. package/lib/commonjs/shared/providers/screen/gestures/pan/activation/use-pan-activation.js +10 -10
  36. package/lib/commonjs/shared/providers/screen/gestures/pan/activation/use-pan-activation.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js +10 -2
  38. package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/gestures/pan/use-build-pan-gesture.js +1 -1
  40. package/lib/commonjs/shared/providers/screen/gestures/pan/use-build-pan-gesture.js.map +1 -1
  41. package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +25 -3
  42. package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
  43. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -6
  44. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  45. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -2
  46. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
  47. package/lib/commonjs/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js +6 -1
  48. package/lib/commonjs/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js.map +1 -1
  49. package/lib/commonjs/shared/providers/screen/gestures/shared/snapshot.js +2 -0
  50. package/lib/commonjs/shared/providers/screen/gestures/shared/snapshot.js.map +1 -1
  51. package/lib/commonjs/shared/providers/screen/gestures/shared/values.js +2 -0
  52. package/lib/commonjs/shared/providers/screen/gestures/shared/values.js.map +1 -1
  53. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +11 -0
  54. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  55. package/lib/commonjs/shared/stores/gesture.store.js +8 -0
  56. package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
  57. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +24 -7
  58. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  59. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +5 -2
  60. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  61. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +184 -314
  62. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  63. package/lib/commonjs/shared/utils/bounds/navigation/zoom/config.js +13 -18
  64. package/lib/commonjs/shared/utils/bounds/navigation/zoom/config.js.map +1 -1
  65. package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js +196 -0
  66. package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js.map +1 -0
  67. package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js +97 -108
  68. package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
  69. package/lib/commonjs/shared/utils/bounds/navigation/zoom/mask.js +73 -0
  70. package/lib/commonjs/shared/utils/bounds/navigation/zoom/mask.js.map +1 -0
  71. package/lib/commonjs/shared/utils/bounds/navigation/zoom/targets.js +90 -0
  72. package/lib/commonjs/shared/utils/bounds/navigation/zoom/targets.js.map +1 -0
  73. package/lib/module/shared/components/boundary/components/boundary-target.js +20 -15
  74. package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
  75. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +14 -7
  76. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  77. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +2 -1
  78. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
  79. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +32 -2
  80. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  81. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js +5 -4
  82. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
  83. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js +3 -2
  84. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  85. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +5 -4
  86. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  87. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +3 -4
  88. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -1
  89. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +1 -0
  90. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  91. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js +1 -3
  92. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  93. package/lib/module/shared/components/boundary/portal/teleport.js +1 -0
  94. package/lib/module/shared/components/boundary/portal/teleport.js.map +1 -1
  95. package/lib/module/shared/components/boundary/portal/utils/ownership.js +4 -1
  96. package/lib/module/shared/components/boundary/portal/utils/ownership.js.map +1 -1
  97. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +17 -4
  98. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  99. package/lib/module/shared/configs/index.js +3 -2
  100. package/lib/module/shared/configs/index.js.map +1 -1
  101. package/lib/module/shared/configs/specs.js +22 -0
  102. package/lib/module/shared/configs/specs.js.map +1 -1
  103. package/lib/module/shared/constants.js +4 -0
  104. package/lib/module/shared/constants.js.map +1 -1
  105. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +4 -0
  106. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  107. package/lib/module/shared/providers/screen/gestures/pan/activation/use-pan-activation.js +10 -10
  108. package/lib/module/shared/providers/screen/gestures/pan/activation/use-pan-activation.js.map +1 -1
  109. package/lib/module/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js +10 -2
  110. package/lib/module/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
  111. package/lib/module/shared/providers/screen/gestures/pan/use-build-pan-gesture.js +1 -1
  112. package/lib/module/shared/providers/screen/gestures/pan/use-build-pan-gesture.js.map +1 -1
  113. package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +23 -2
  114. package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
  115. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -6
  116. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  117. package/lib/module/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -2
  118. package/lib/module/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
  119. package/lib/module/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js +6 -1
  120. package/lib/module/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js.map +1 -1
  121. package/lib/module/shared/providers/screen/gestures/shared/snapshot.js +2 -0
  122. package/lib/module/shared/providers/screen/gestures/shared/snapshot.js.map +1 -1
  123. package/lib/module/shared/providers/screen/gestures/shared/values.js +2 -0
  124. package/lib/module/shared/providers/screen/gestures/shared/values.js.map +1 -1
  125. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +11 -0
  126. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  127. package/lib/module/shared/stores/gesture.store.js +8 -0
  128. package/lib/module/shared/stores/gesture.store.js.map +1 -1
  129. package/lib/module/shared/types/bounds.types.js +26 -0
  130. package/lib/module/shared/types/bounds.types.js.map +1 -1
  131. package/lib/module/shared/utils/animation/animate-to-progress.js +24 -7
  132. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  133. package/lib/module/shared/utils/bounds/navigation/reveal/math.js +5 -2
  134. package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  135. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +188 -318
  136. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  137. package/lib/module/shared/utils/bounds/navigation/zoom/config.js +12 -17
  138. package/lib/module/shared/utils/bounds/navigation/zoom/config.js.map +1 -1
  139. package/lib/module/shared/utils/bounds/navigation/zoom/drag.js +184 -0
  140. package/lib/module/shared/utils/bounds/navigation/zoom/drag.js.map +1 -0
  141. package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js +94 -102
  142. package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
  143. package/lib/module/shared/utils/bounds/navigation/zoom/mask.js +68 -0
  144. package/lib/module/shared/utils/bounds/navigation/zoom/mask.js.map +1 -0
  145. package/lib/module/shared/utils/bounds/navigation/zoom/targets.js +84 -0
  146. package/lib/module/shared/utils/bounds/navigation/zoom/targets.js.map +1 -0
  147. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts +3 -1
  148. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
  149. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
  150. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/components/host.d.ts.map +1 -1
  151. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
  152. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts +1 -3
  153. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +1 -1
  154. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
  155. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
  156. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts +2 -3
  157. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts.map +1 -1
  158. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  159. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts +2 -3
  160. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
  161. package/lib/typescript/shared/components/boundary/portal/teleport.d.ts +1 -0
  162. package/lib/typescript/shared/components/boundary/portal/teleport.d.ts.map +1 -1
  163. package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts.map +1 -1
  164. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +1 -0
  165. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
  166. package/lib/typescript/shared/configs/index.d.ts +16 -0
  167. package/lib/typescript/shared/configs/index.d.ts.map +1 -1
  168. package/lib/typescript/shared/configs/specs.d.ts +19 -0
  169. package/lib/typescript/shared/configs/specs.d.ts.map +1 -1
  170. package/lib/typescript/shared/constants.d.ts.map +1 -1
  171. package/lib/typescript/shared/index.d.ts +17 -1
  172. package/lib/typescript/shared/index.d.ts.map +1 -1
  173. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
  174. package/lib/typescript/shared/providers/screen/gestures/pan/activation/use-pan-activation.d.ts +2 -0
  175. package/lib/typescript/shared/providers/screen/gestures/pan/activation/use-pan-activation.d.ts.map +1 -1
  176. package/lib/typescript/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts +2 -1
  177. package/lib/typescript/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts.map +1 -1
  178. package/lib/typescript/shared/providers/screen/gestures/pan/use-build-pan-gesture.d.ts.map +1 -1
  179. package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts +2 -0
  180. package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts.map +1 -1
  181. package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts +1 -1
  182. package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
  183. package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.d.ts.map +1 -1
  184. package/lib/typescript/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.d.ts.map +1 -1
  185. package/lib/typescript/shared/providers/screen/gestures/shared/snapshot.d.ts.map +1 -1
  186. package/lib/typescript/shared/providers/screen/gestures/shared/values.d.ts.map +1 -1
  187. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +4 -0
  188. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
  189. package/lib/typescript/shared/stores/gesture.store.d.ts +4 -0
  190. package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
  191. package/lib/typescript/shared/types/bounds.types.d.ts +115 -88
  192. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  193. package/lib/typescript/shared/types/gesture.types.d.ts +10 -0
  194. package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -1
  195. package/lib/typescript/shared/types/index.d.ts +1 -1
  196. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  197. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  198. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts +3 -1
  199. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
  200. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts +1 -1
  201. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
  202. package/lib/typescript/shared/utils/bounds/navigation/zoom/config.d.ts +7 -17
  203. package/lib/typescript/shared/utils/bounds/navigation/zoom/config.d.ts.map +1 -1
  204. package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts +55 -0
  205. package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts.map +1 -0
  206. package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts +33 -34
  207. package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts.map +1 -1
  208. package/lib/typescript/shared/utils/bounds/navigation/zoom/mask.d.ts +27 -0
  209. package/lib/typescript/shared/utils/bounds/navigation/zoom/mask.d.ts.map +1 -0
  210. package/lib/typescript/shared/utils/bounds/navigation/zoom/targets.d.ts +22 -0
  211. package/lib/typescript/shared/utils/bounds/navigation/zoom/targets.d.ts.map +1 -0
  212. package/lib/typescript/shared/utils/bounds/navigation/zoom/types.d.ts +1 -1
  213. package/lib/typescript/shared/utils/bounds/navigation/zoom/types.d.ts.map +1 -1
  214. package/package.json +2 -2
  215. package/src/shared/components/boundary/components/boundary-target.tsx +37 -26
  216. package/src/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +16 -13
  217. package/src/shared/components/boundary/portal/components/boundary-content-portal/components/host.tsx +6 -2
  218. package/src/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +46 -3
  219. package/src/shared/components/boundary/portal/components/boundary-content-portal/index.tsx +8 -5
  220. package/src/shared/components/boundary/portal/components/boundary-portal/components/host.tsx +3 -2
  221. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +5 -4
  222. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.tsx +4 -5
  223. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +5 -1
  224. package/src/shared/components/boundary/portal/components/boundary-portal/index.tsx +1 -4
  225. package/src/shared/components/boundary/portal/teleport.ts +1 -0
  226. package/src/shared/components/boundary/portal/utils/ownership.ts +5 -1
  227. package/src/shared/components/boundary/providers/boundary-root.provider.tsx +23 -3
  228. package/src/shared/configs/index.ts +2 -1
  229. package/src/shared/configs/specs.ts +23 -0
  230. package/src/shared/constants.ts +4 -0
  231. package/src/shared/index.ts +2 -0
  232. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +8 -0
  233. package/src/shared/providers/screen/gestures/pan/activation/use-pan-activation.ts +16 -7
  234. package/src/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.ts +18 -1
  235. package/src/shared/providers/screen/gestures/pan/use-build-pan-gesture.ts +1 -0
  236. package/src/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.ts +40 -2
  237. package/src/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +7 -11
  238. package/src/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.ts +12 -15
  239. package/src/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.ts +6 -1
  240. package/src/shared/providers/screen/gestures/shared/snapshot.ts +2 -0
  241. package/src/shared/providers/screen/gestures/shared/values.ts +2 -0
  242. package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +14 -1
  243. package/src/shared/stores/gesture.store.ts +12 -0
  244. package/src/shared/types/bounds.types.ts +119 -90
  245. package/src/shared/types/gesture.types.ts +10 -0
  246. package/src/shared/types/index.ts +2 -0
  247. package/src/shared/utils/animation/animate-to-progress.ts +23 -7
  248. package/src/shared/utils/bounds/navigation/reveal/math.ts +6 -1
  249. package/src/shared/utils/bounds/navigation/zoom/build.ts +231 -411
  250. package/src/shared/utils/bounds/navigation/zoom/config.ts +16 -18
  251. package/src/shared/utils/bounds/navigation/zoom/drag.ts +327 -0
  252. package/src/shared/utils/bounds/navigation/zoom/helpers.ts +127 -184
  253. package/src/shared/utils/bounds/navigation/zoom/mask.ts +133 -0
  254. package/src/shared/utils/bounds/navigation/zoom/targets.ts +132 -0
  255. package/src/shared/utils/bounds/navigation/zoom/types.ts +1 -1
  256. package/lib/commonjs/shared/utils/bounds/navigation/zoom/math.js +0 -25
  257. package/lib/commonjs/shared/utils/bounds/navigation/zoom/math.js.map +0 -1
  258. package/lib/module/shared/utils/bounds/navigation/zoom/math.js +0 -20
  259. package/lib/module/shared/utils/bounds/navigation/zoom/math.js.map +0 -1
  260. package/lib/typescript/shared/utils/bounds/navigation/zoom/math.d.ts +0 -8
  261. package/lib/typescript/shared/utils/bounds/navigation/zoom/math.d.ts.map +0 -1
  262. package/src/shared/utils/bounds/navigation/zoom/math.ts +0 -25
@@ -3,24 +3,22 @@ export const ZOOM_SHARED_OPTIONS = Object.freeze({
3
3
  scaleMode: "uniform" as const,
4
4
  });
5
5
 
6
- export const ZOOM_DRAG_DIRECTIONAL_SCALE_MIN = 0.25;
7
- export const ZOOM_DRAG_DIRECTIONAL_SCALE_MAX = 1.06;
8
- export const ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT = 2;
9
- export const ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX = 1;
10
- export const ZOOM_DRAG_TRANSLATION_POSITIVE_MAX = 1;
11
- export const ZOOM_DRAG_TRANSLATION_EXPONENT = 1;
12
- export const ZOOM_DISMISS_SCALE_ORBIT_DEPTH = 0.5;
6
+ export const ZOOM_DISMISS_VELOCITY_DEPTH = 1.0;
13
7
  export const ZOOM_BACKGROUND_SCALE = 0.9375;
14
- export const ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [0, 0.5, 0, 1] as const;
15
- export const ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [0.6, 1, 0, 1] as const;
16
- export const ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [1, 2, 1, 0] as const;
8
+ // Keep the previous screen visible beneath the zoom instead of reaching black.
9
+ export const ZOOM_BACKDROP_MAX_OPACITY = 0.45;
10
+ // Geometry-aligned native frames reach their darkest point around here.
11
+ export const ZOOM_SCREEN_A_FADE_END = 0.54;
12
+ // Native starts revealing the destination immediately while the source begins
13
+ // handing ownership over in the first tenth of the opening travel.
14
+ export const ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [0, 0.28, 0, 1] as const;
15
+ export const ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [
16
+ 1.08, 1.32, 1, 0,
17
+ ] as const;
18
+ // On close, red is prepared behind opaque blue before blue fades away.
19
+ export const ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [
20
+ 0.13, 0.7, 0, 1,
21
+ ] as const;
17
22
  export const ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [
18
- 1.9, 2, 1, 0,
23
+ 1.7, 2, 1, 0,
19
24
  ] as const;
20
-
21
- export const ZOOM_MASK_OUTSET = Object.freeze({
22
- top: 0,
23
- right: 0,
24
- bottom: 0,
25
- left: 0,
26
- });
@@ -0,0 +1,327 @@
1
+ import type { MeasuredDimensions } from "react-native-reanimated";
2
+ import { EPSILON } from "../../../../constants";
3
+ import type {
4
+ BoundsInterpolationProps,
5
+ BoundsNavigationZoomDragOptions,
6
+ } from "../../../../types/bounds.types";
7
+ import type { Layout } from "../../../../types/screen.types";
8
+ import { resolveRevealContentBaseTransform } from "../reveal/math";
9
+ import { ZOOM_DISMISS_VELOCITY_DEPTH } from "./config";
10
+
11
+ const ZOOM_DRAG_SCALE_EXPONENT = 2;
12
+ const ZOOM_DRAG_SCALE_FLOOR = 0.5;
13
+ const ZOOM_COUNTER_DRAG_SCALE_INTENSITY = 0.4;
14
+ const ZOOM_PRIMARY_DRAG_TRANSLATION_SCALE = 0.8;
15
+ const ZOOM_PRIMARY_DRAG_RESISTANCE = 2;
16
+ const ZOOM_HORIZONTAL_DRAG_DISTANCE_SCALE = 1.5;
17
+ const ZOOM_CROSS_AXIS_DRAG_TRANSLATION_SCALE = 0.35;
18
+ const ZOOM_CROSS_AXIS_DRAG_RESISTANCE = 0.05;
19
+ const ZOOM_PINCH_SCALE_RESPONSE = 1;
20
+ const ZOOM_PINCH_VELOCITY_DEPTH_MULTIPLIER = 2;
21
+
22
+ type ZoomGesture = BoundsInterpolationProps["active"]["gesture"];
23
+
24
+ export type ZoomDragState = {
25
+ collapsesMask: boolean;
26
+ dismissContentScale: number;
27
+ dismissNorm: number;
28
+ dismissProgress: number;
29
+ dragX: number;
30
+ dragY: number;
31
+ gestureScale: number;
32
+ isDismissing: boolean;
33
+ isVerticalInverted: boolean;
34
+ rotation: number;
35
+ };
36
+
37
+ export function resolveZoomDismissContentScale({
38
+ transitionRemaining,
39
+ releaseScale,
40
+ targetScale,
41
+ velocity,
42
+ velocityDepth,
43
+ }: {
44
+ transitionRemaining: number;
45
+ releaseScale: number;
46
+ targetScale: number;
47
+ velocity: number;
48
+ velocityDepth: number;
49
+ }) {
50
+ "worklet";
51
+
52
+ const closeProgress = 1 - transitionRemaining;
53
+ const depth = velocityDepth * velocity;
54
+
55
+ const scaleDelta = targetScale - releaseScale;
56
+ const controlScale1 = releaseScale + scaleDelta / 3;
57
+ const linearControlScale2 = releaseScale + (2 * scaleDelta) / 3;
58
+ const controlScale2 = Math.max(EPSILON, linearControlScale2 * (1 - depth));
59
+ const remaining = 1 - closeProgress;
60
+
61
+ return (
62
+ remaining * remaining * remaining * releaseScale +
63
+ 3 * remaining * remaining * closeProgress * controlScale1 +
64
+ 3 * remaining * closeProgress * closeProgress * controlScale2 +
65
+ closeProgress * closeProgress * closeProgress * targetScale
66
+ );
67
+ }
68
+
69
+ export function resolveZoomPrimaryDragTranslation({
70
+ translation,
71
+ dimension,
72
+ }: {
73
+ translation: number;
74
+ dimension: number;
75
+ }) {
76
+ "worklet";
77
+
78
+ const direction = translation < 0 ? -1 : 1;
79
+ const translationDistance = Math.abs(translation);
80
+ const baseDistance = Math.max(1, dimension);
81
+ const normalizedTranslation = translationDistance / baseDistance;
82
+ const effectiveResistance = ZOOM_PRIMARY_DRAG_RESISTANCE * 0.85;
83
+ const resistedTranslation =
84
+ (baseDistance *
85
+ (1 - Math.exp(-effectiveResistance * normalizedTranslation))) /
86
+ effectiveResistance;
87
+
88
+ return (
89
+ direction *
90
+ Math.min(
91
+ baseDistance,
92
+ resistedTranslation * ZOOM_PRIMARY_DRAG_TRANSLATION_SCALE,
93
+ )
94
+ );
95
+ }
96
+
97
+ export function resolveZoomHorizontalDragTranslation({
98
+ translation,
99
+ dimension,
100
+ }: {
101
+ translation: number;
102
+ dimension: number;
103
+ }) {
104
+ "worklet";
105
+
106
+ return (
107
+ resolveZoomPrimaryDragTranslation({ translation, dimension }) *
108
+ ZOOM_HORIZONTAL_DRAG_DISTANCE_SCALE
109
+ );
110
+ }
111
+
112
+ export function resolveZoomCrossAxisDragTranslation({
113
+ translation,
114
+ dimension,
115
+ }: {
116
+ translation: number;
117
+ dimension: number;
118
+ }) {
119
+ "worklet";
120
+
121
+ const direction = translation < 0 ? -1 : 1;
122
+ const translationDistance = Math.abs(translation);
123
+ const baseDistance = Math.max(1, dimension);
124
+ const normalizedTranslation = translationDistance / baseDistance;
125
+ const resistedTranslation =
126
+ (baseDistance *
127
+ (1 -
128
+ Math.exp(-ZOOM_CROSS_AXIS_DRAG_RESISTANCE * normalizedTranslation))) /
129
+ ZOOM_CROSS_AXIS_DRAG_RESISTANCE;
130
+
131
+ return (
132
+ direction *
133
+ Math.min(
134
+ baseDistance,
135
+ resistedTranslation * ZOOM_CROSS_AXIS_DRAG_TRANSLATION_SCALE,
136
+ )
137
+ );
138
+ }
139
+
140
+ export function resolveZoomDragScale(normalized: number) {
141
+ "worklet";
142
+
143
+ const scaleInput =
144
+ normalized < 0
145
+ ? normalized * ZOOM_COUNTER_DRAG_SCALE_INTENSITY
146
+ : normalized;
147
+ const progress = Math.min(1, scaleInput);
148
+ const rawMinimumScale =
149
+ ZOOM_DRAG_SCALE_FLOOR ** (1 / ZOOM_DRAG_SCALE_EXPONENT);
150
+ const rawScale = 1 + (rawMinimumScale - 1) * progress;
151
+
152
+ return rawScale ** ZOOM_DRAG_SCALE_EXPONENT;
153
+ }
154
+
155
+ export function resolveZoomPinchScale(scale: number) {
156
+ "worklet";
157
+ return 1 + (scale - 1) * ZOOM_PINCH_SCALE_RESPONSE;
158
+ }
159
+
160
+ export function resolveZoomDismissalNorm(
161
+ normalized: number,
162
+ isInverted: boolean,
163
+ ) {
164
+ "worklet";
165
+ return isInverted ? -normalized : normalized;
166
+ }
167
+
168
+ export function resolveZoomDragState({
169
+ gesture,
170
+ activeTransitionProgress,
171
+ screenLayout,
172
+ sourceBounds,
173
+ trackingContentTarget,
174
+ dragOptions,
175
+ }: {
176
+ gesture: ZoomGesture;
177
+ activeTransitionProgress: number;
178
+ screenLayout: Layout;
179
+ sourceBounds: MeasuredDimensions;
180
+ trackingContentTarget: MeasuredDimensions;
181
+ dragOptions?: BoundsNavigationZoomDragOptions;
182
+ }): ZoomDragState {
183
+ "worklet";
184
+
185
+ const gestureHandoff = gesture.handoff;
186
+ const isDismissing = gesture.dismissing === 1;
187
+ const activeGesture = gestureHandoff.active;
188
+ const isHorizontalInverted = activeGesture === "horizontal-inverted";
189
+ const isHorizontal = activeGesture === "horizontal" || isHorizontalInverted;
190
+ const isVerticalInverted = activeGesture === "vertical-inverted";
191
+ const isVertical = activeGesture === "vertical" || isVerticalInverted;
192
+ const isPinchIn = activeGesture === "pinch-in";
193
+ const isInverted = isHorizontalInverted || isVerticalInverted;
194
+ const translationResponse = Math.max(
195
+ 0,
196
+ isHorizontal
197
+ ? (dragOptions?.translation?.horizontal ?? 1)
198
+ : isVertical
199
+ ? (dragOptions?.translation?.vertical ?? 1)
200
+ : 1,
201
+ );
202
+ const scaleResponse = Math.max(
203
+ 0,
204
+ isHorizontal
205
+ ? (dragOptions?.scale?.horizontal ?? 1)
206
+ : isVertical
207
+ ? (dragOptions?.scale?.vertical ?? 1)
208
+ : 1,
209
+ );
210
+ const handoffPrimaryNorm = isPinchIn
211
+ ? -gestureHandoff.normScale
212
+ : isHorizontal
213
+ ? gestureHandoff.normX
214
+ : gestureHandoff.normY;
215
+ const livePrimaryNorm = isPinchIn
216
+ ? -gesture.normScale
217
+ : isHorizontal
218
+ ? gesture.normX
219
+ : gesture.normY;
220
+ const dismissNorm = Math.max(
221
+ 0,
222
+ resolveZoomDismissalNorm(handoffPrimaryNorm, isInverted),
223
+ );
224
+ const nativeDragX = isPinchIn
225
+ ? gesture.x
226
+ : isHorizontal
227
+ ? resolveZoomHorizontalDragTranslation({
228
+ translation: gesture.x,
229
+ dimension: screenLayout.width,
230
+ })
231
+ : isVertical
232
+ ? resolveZoomCrossAxisDragTranslation({
233
+ translation: gesture.x,
234
+ dimension: screenLayout.width,
235
+ })
236
+ : 0;
237
+ const nativeDragY = isPinchIn
238
+ ? gesture.y
239
+ : isHorizontal
240
+ ? resolveZoomCrossAxisDragTranslation({
241
+ translation: gesture.y,
242
+ dimension: screenLayout.height,
243
+ })
244
+ : resolveZoomPrimaryDragTranslation({
245
+ translation: gesture.y,
246
+ dimension: screenLayout.height,
247
+ });
248
+ const dragX = nativeDragX * translationResponse;
249
+ const dragY = nativeDragY * translationResponse;
250
+ const scaleNorm = resolveZoomDismissalNorm(
251
+ isDismissing ? handoffPrimaryNorm : livePrimaryNorm,
252
+ isInverted,
253
+ );
254
+ const nativeGestureScale = isPinchIn
255
+ ? resolveZoomPinchScale(isDismissing ? gestureHandoff.scale : gesture.scale)
256
+ : resolveZoomDragScale(scaleNorm);
257
+ const gestureScale = isPinchIn
258
+ ? nativeGestureScale
259
+ : Math.max(EPSILON, 1 + (nativeGestureScale - 1) * scaleResponse);
260
+ const rotation = isPinchIn
261
+ ? isDismissing
262
+ ? gestureHandoff.rotation * activeTransitionProgress
263
+ : gesture.rotation
264
+ : 0;
265
+
266
+ let dismissContentScale = gestureScale;
267
+
268
+ if (isDismissing) {
269
+ const targetContentScale = resolveRevealContentBaseTransform({
270
+ progress: 0,
271
+ sourceBounds,
272
+ destinationBounds: trackingContentTarget,
273
+ screenLayout,
274
+ }).scale;
275
+ dismissContentScale = resolveZoomDismissContentScale({
276
+ transitionRemaining: activeTransitionProgress,
277
+ releaseScale: gestureScale,
278
+ targetScale: targetContentScale,
279
+ velocity: gestureHandoff.velocity,
280
+ velocityDepth:
281
+ ZOOM_DISMISS_VELOCITY_DEPTH *
282
+ (isPinchIn ? ZOOM_PINCH_VELOCITY_DEPTH_MULTIPLIER : 1),
283
+ });
284
+ }
285
+
286
+ return {
287
+ collapsesMask: isVertical,
288
+ dismissContentScale,
289
+ dismissNorm,
290
+ dismissProgress: isDismissing ? 1 - activeTransitionProgress : 0,
291
+ dragX,
292
+ dragY,
293
+ gestureScale,
294
+ isDismissing,
295
+ isVerticalInverted,
296
+ rotation,
297
+ };
298
+ }
299
+
300
+ export function resolveZoomTrackedGestureScale({
301
+ drag,
302
+ activeTransitionProgress,
303
+ screenLayout,
304
+ sourceBounds,
305
+ trackingContentTarget,
306
+ }: {
307
+ drag: ZoomDragState;
308
+ activeTransitionProgress: number;
309
+ screenLayout: Layout;
310
+ sourceBounds: MeasuredDimensions;
311
+ trackingContentTarget: MeasuredDimensions;
312
+ }) {
313
+ "worklet";
314
+
315
+ if (!drag.isDismissing) {
316
+ return drag.gestureScale;
317
+ }
318
+
319
+ const trackedContentBaseScale = resolveRevealContentBaseTransform({
320
+ progress: activeTransitionProgress,
321
+ sourceBounds,
322
+ destinationBounds: trackingContentTarget,
323
+ screenLayout,
324
+ }).scale;
325
+
326
+ return drag.dismissContentScale / trackedContentBaseScale;
327
+ }
@@ -1,212 +1,155 @@
1
- import { interpolate } from "react-native-reanimated";
1
+ import type { MeasuredDimensions } from "react-native-reanimated";
2
2
  import { EPSILON } from "../../../../constants";
3
- import type { BoundsLink } from "../../../../types/bounds.types";
4
- import type {
5
- ActiveGesture,
6
- ResolvedPanGestureDirection,
7
- } from "../../../../types/gesture.types";
8
3
  import type { Layout } from "../../../../types/screen.types";
9
- import type { BoundsOptions } from "../../types/options";
4
+ import type { BoundsAnchor } from "../../types/options";
10
5
  import {
11
- ZOOM_BACKGROUND_SCALE,
12
- ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
13
- ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
14
- ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
15
- ZOOM_DRAG_TRANSLATION_EXPONENT,
16
- ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX,
17
- ZOOM_DRAG_TRANSLATION_POSITIVE_MAX,
18
- } from "./config";
19
-
20
- export function getZoomContentTarget({
21
- explicitTarget,
22
- screenLayout,
23
- anchor,
24
- link,
6
+ resolveRevealContentBaseTransform,
7
+ resolveTrackedSourceElementTransform,
8
+ } from "../reveal/math";
9
+
10
+ export function resolveZoomBackdropOpacity({
11
+ transitionProgress,
12
+ dismissalDrag,
13
+ fadeEnd,
14
+ maxOpacity,
25
15
  }: {
26
- explicitTarget: BoundsOptions["target"] | undefined;
27
- screenLayout: Layout;
28
- anchor: BoundsOptions["anchor"] | undefined;
29
- link: BoundsLink;
16
+ transitionProgress: number;
17
+ dismissalDrag: number;
18
+ fadeEnd: number;
19
+ maxOpacity: number;
30
20
  }) {
31
21
  "worklet";
32
22
 
33
- if (explicitTarget) return explicitTarget;
34
-
35
- const sourceBounds = link.source?.bounds;
36
- const screenWidth = screenLayout.width;
37
-
38
- if (!sourceBounds || sourceBounds.width <= 0 || screenWidth <= 0) {
39
- return "fullscreen" as const;
40
- }
41
-
42
- const height = (sourceBounds.height / sourceBounds.width) * screenWidth;
43
- const verticalAnchor =
44
- anchor === "bottomLeading" ||
45
- anchor === "bottom" ||
46
- anchor === "bottomTrailing"
47
- ? "bottom"
48
- : anchor === "center" || anchor === "leading" || anchor === "trailing"
49
- ? "center"
50
- : "top";
51
- const y =
52
- verticalAnchor === "top"
53
- ? 0
54
- : verticalAnchor === "bottom"
55
- ? screenLayout.height - height
56
- : (screenLayout.height - height) / 2;
23
+ const clampedProgress = Math.min(1, Math.max(0, transitionProgress));
24
+ const clampedDrag = Math.min(1, Math.max(0, dismissalDrag));
25
+ const safeFadeEnd = Math.max(EPSILON, fadeEnd);
26
+ const transitionOpacity = Math.min(1, clampedProgress / safeFadeEnd);
27
+ const clampedMaxOpacity = Math.min(1, Math.max(0, maxOpacity));
57
28
 
58
- return {
59
- x: 0,
60
- y,
61
- pageX: 0,
62
- pageY: y,
63
- width: screenWidth,
64
- height,
65
- };
29
+ return clampedMaxOpacity * transitionOpacity * (1 - clampedDrag);
66
30
  }
67
31
 
68
- export function resolveDragScaleTuple(
69
- value:
70
- | readonly [shrinkMin: number, growMax: number, exponent?: number]
71
- | undefined,
72
- ) {
32
+ export function resolveZoomPinchFocalOffset({
33
+ gestureScale,
34
+ pinchOriginX,
35
+ pinchOriginY,
36
+ progress,
37
+ rotation,
38
+ screenLayout,
39
+ }: {
40
+ gestureScale: number;
41
+ pinchOriginX: number;
42
+ pinchOriginY: number;
43
+ progress: number;
44
+ rotation: number;
45
+ screenLayout: Layout;
46
+ }) {
73
47
  "worklet";
74
48
 
75
- return {
76
- shrinkMin: value?.[0] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
77
- growMax: value?.[1] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
78
- exponent: value?.[2] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
79
- };
80
- }
49
+ if (Math.abs(gestureScale - 1) <= EPSILON && Math.abs(rotation) <= EPSILON) {
50
+ return { x: 0, y: 0 };
51
+ }
81
52
 
82
- export function resolveDragTranslationTuple(
83
- value:
84
- | readonly [negativeMax: number, positiveMax: number, exponent?: number]
85
- | undefined,
86
- ) {
87
- "worklet";
53
+ const offsetX = pinchOriginX - screenLayout.width / 2;
54
+ const offsetY = pinchOriginY - screenLayout.height / 2;
55
+ const cosine = Math.cos(rotation);
56
+ const sine = Math.sin(rotation);
57
+ const transformedOffsetX = gestureScale * (offsetX * cosine - offsetY * sine);
58
+ const transformedOffsetY = gestureScale * (offsetX * sine + offsetY * cosine);
59
+ const clampedProgress = Math.min(1, Math.max(0, progress));
88
60
 
89
61
  return {
90
- negativeMax: value?.[0] ?? ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX,
91
- positiveMax: value?.[1] ?? ZOOM_DRAG_TRANSLATION_POSITIVE_MAX,
92
- exponent: value?.[2] ?? ZOOM_DRAG_TRANSLATION_EXPONENT,
62
+ x: (offsetX - transformedOffsetX) * clampedProgress,
63
+ y: (offsetY - transformedOffsetY) * clampedProgress,
93
64
  };
94
65
  }
95
66
 
96
- export function resolveBackgroundScale(value: number | undefined) {
97
- "worklet";
98
-
99
- return value ?? ZOOM_BACKGROUND_SCALE;
100
- }
101
-
102
- const isResolvedPanDirection = (
103
- direction: ActiveGesture | null | undefined,
104
- ): direction is ResolvedPanGestureDirection => {
105
- "worklet";
106
- return (
107
- direction === "horizontal" ||
108
- direction === "horizontal-inverted" ||
109
- direction === "vertical" ||
110
- direction === "vertical-inverted"
111
- );
112
- };
113
-
114
- const resolveMotionDirection = ({
115
- normX,
116
- normY,
117
- rawNormX,
118
- rawNormY,
67
+ export function resolveZoomTrackedSourceTransform({
68
+ progress,
69
+ sourceBounds,
70
+ destinationBounds,
71
+ screenLayout,
72
+ dragX,
73
+ dragY,
74
+ gestureScale,
75
+ parentScale,
76
+ rotation = 0,
77
+ anchor,
119
78
  }: {
120
- normX: number;
121
- normY: number;
122
- rawNormX: number;
123
- rawNormY: number;
124
- }): ResolvedPanGestureDirection | null => {
79
+ progress: number;
80
+ sourceBounds: MeasuredDimensions;
81
+ destinationBounds: MeasuredDimensions;
82
+ screenLayout: Layout;
83
+ dragX: number;
84
+ dragY: number;
85
+ gestureScale: number;
86
+ parentScale: number;
87
+ rotation?: number;
88
+ anchor?: BoundsAnchor;
89
+ }) {
125
90
  "worklet";
126
- const motionX = Math.max(Math.abs(normX), Math.abs(rawNormX));
127
- const motionY = Math.max(Math.abs(normY), Math.abs(rawNormY));
128
-
129
- if (motionX <= EPSILON && motionY <= EPSILON) {
130
- return null;
131
- }
132
-
133
- if (motionY > motionX + EPSILON) {
134
- return normY < 0 || rawNormY < 0 ? "vertical-inverted" : "vertical";
135
- }
136
91
 
137
- if (motionX > motionY + EPSILON) {
138
- return normX < 0 || rawNormX < 0 ? "horizontal-inverted" : "horizontal";
139
- }
140
-
141
- return null;
142
- };
143
-
144
- export function resolveZoomPanGestureDirection({
145
- active,
146
- direction,
147
- normX,
148
- normY,
149
- rawNormX,
150
- rawNormY,
151
- }: {
152
- active: ActiveGesture | null | undefined;
153
- direction: ActiveGesture | null | undefined;
154
- normX: number;
155
- normY: number;
156
- rawNormX: number;
157
- rawNormY: number;
158
- }): ResolvedPanGestureDirection | null {
159
- "worklet";
160
- const storedDirection = active ?? direction;
161
- const motionDirection = resolveMotionDirection({
162
- normX,
163
- normY,
164
- rawNormX,
165
- rawNormY,
92
+ const contentBaseTransform = resolveRevealContentBaseTransform({
93
+ progress,
94
+ sourceBounds,
95
+ destinationBounds,
96
+ screenLayout,
97
+ anchor,
166
98
  });
99
+ const collapsedContentScale = resolveRevealContentBaseTransform({
100
+ progress: 0,
101
+ sourceBounds,
102
+ destinationBounds,
103
+ screenLayout,
104
+ anchor,
105
+ }).scale;
106
+ const contentScale = contentBaseTransform.scale * gestureScale;
107
+ const safeCollapsedContentScale = Math.max(
108
+ Math.abs(collapsedContentScale),
109
+ EPSILON,
110
+ );
111
+ const safeParentScale = Math.max(Math.abs(parentScale), EPSILON);
112
+ const uniformSourceScale =
113
+ contentScale / (safeCollapsedContentScale * safeParentScale);
114
+ const trackedTransform = {
115
+ ...resolveTrackedSourceElementTransform({
116
+ sourceBounds,
117
+ destinationBounds,
118
+ contentTranslateX: contentBaseTransform.translateX + dragX,
119
+ contentTranslateY: contentBaseTransform.translateY + dragY,
120
+ contentScale,
121
+ parentScale,
122
+ screenWidth: screenLayout.width,
123
+ screenHeight: screenLayout.height,
124
+ }),
125
+ scaleX: uniformSourceScale,
126
+ scaleY: uniformSourceScale,
127
+ };
167
128
 
168
- if (!isResolvedPanDirection(storedDirection)) {
169
- return motionDirection;
170
- }
171
-
172
- if (!motionDirection) {
173
- return storedDirection;
174
- }
175
-
176
- const storedIsHorizontal =
177
- storedDirection === "horizontal" ||
178
- storedDirection === "horizontal-inverted";
179
- const storedMotion = storedIsHorizontal
180
- ? Math.max(Math.abs(normX), Math.abs(rawNormX))
181
- : Math.max(Math.abs(normY), Math.abs(rawNormY));
182
- const oppositeMotion = storedIsHorizontal
183
- ? Math.max(Math.abs(normY), Math.abs(rawNormY))
184
- : Math.max(Math.abs(normX), Math.abs(rawNormX));
185
-
186
- if (oppositeMotion > storedMotion + EPSILON) {
187
- return motionDirection;
129
+ if (Math.abs(rotation) <= EPSILON) {
130
+ return trackedTransform;
188
131
  }
189
132
 
190
- return storedDirection;
191
- }
133
+ const screenCenterX = screenLayout.width / 2;
134
+ const screenCenterY = screenLayout.height / 2;
135
+ const destinationCenterX =
136
+ destinationBounds.pageX + destinationBounds.width / 2;
137
+ const destinationCenterY =
138
+ destinationBounds.pageY + destinationBounds.height / 2;
139
+ const scaledOffsetX = (destinationCenterX - screenCenterX) * contentScale;
140
+ const scaledOffsetY = (destinationCenterY - screenCenterY) * contentScale;
141
+ const cosine = Math.cos(rotation);
142
+ const sine = Math.sin(rotation);
143
+ const rotatedOffsetX = scaledOffsetX * cosine - scaledOffsetY * sine;
144
+ const rotatedOffsetY = scaledOffsetX * sine + scaledOffsetY * cosine;
192
145
 
193
- export function interpolateOpacityRange(params: {
194
- progress: number;
195
- range: {
196
- inputStart: number;
197
- inputEnd: number;
198
- outputStart: number;
199
- outputEnd: number;
146
+ return {
147
+ ...trackedTransform,
148
+ translateX:
149
+ trackedTransform.translateX +
150
+ (rotatedOffsetX - scaledOffsetX) / safeParentScale,
151
+ translateY:
152
+ trackedTransform.translateY +
153
+ (rotatedOffsetY - scaledOffsetY) / safeParentScale,
200
154
  };
201
- }) {
202
- "worklet";
203
-
204
- const { progress, range } = params;
205
-
206
- return interpolate(
207
- progress,
208
- [range.inputStart, range.inputEnd],
209
- [range.outputStart, range.outputEnd],
210
- "clamp",
211
- );
212
155
  }