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
@@ -2,73 +2,41 @@ import { interpolate } from "react-native-reanimated";
2
2
  import {
3
3
  EPSILON,
4
4
  NAVIGATION_MASK_ELEMENT_STYLE_ID,
5
- VISIBLE_STYLE,
6
5
  } from "../../../../constants";
7
- import type { TransitionInterpolatedStyle } from "../../../../types/animation.types";
8
6
  import { createBoundsAccessorCore } from "../../helpers/create-bounds-accessor-core";
9
- import { getSourceBorderRadius, toNumber } from "../helpers";
7
+ import { getSourceBorderRadius } from "../helpers";
8
+ import { resolveRevealContentBaseTransform } from "../reveal/math";
10
9
  import {
11
- combineScales,
12
- composeCompensatedTranslation,
13
- computeCenterScaleShift,
14
- resolveDirectionalDragScale,
15
- resolveOpacityRangeTuple,
16
- } from "../math";
17
- import {
18
- resolveDismissScaleHandoff,
19
- resolveRevealGestureHandoff,
20
- } from "../reveal/math";
21
- import {
22
- ZOOM_DISMISS_SCALE_ORBIT_DEPTH,
10
+ ZOOM_BACKDROP_MAX_OPACITY,
11
+ ZOOM_BACKGROUND_SCALE,
23
12
  ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
24
13
  ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
25
- ZOOM_MASK_OUTSET,
14
+ ZOOM_SCREEN_A_FADE_END,
26
15
  ZOOM_SHARED_OPTIONS,
27
16
  ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
28
17
  ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
29
18
  } from "./config";
19
+ import { resolveZoomDragState, resolveZoomTrackedGestureScale } from "./drag";
30
20
  import {
31
- getZoomContentTarget,
32
- interpolateOpacityRange,
33
- resolveBackgroundScale,
34
- resolveDragScaleTuple,
35
- resolveDragTranslationTuple,
36
- resolveZoomPanGestureDirection,
21
+ resolveZoomBackdropOpacity,
22
+ resolveZoomPinchFocalOffset,
23
+ resolveZoomTrackedSourceTransform,
37
24
  } from "./helpers";
38
- import { resolveDirectionalDragTranslation } from "./math";
25
+ import {
26
+ resolveZoomNavigationMaskStyle,
27
+ ZOOM_NAVIGATION_MASK_BORDER_RADIUS,
28
+ } from "./mask";
29
+ import {
30
+ getZoomContentAnchor,
31
+ getZoomContentTarget,
32
+ resolveZoomTrackingContentTarget,
33
+ } from "./targets";
39
34
  import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
40
35
 
41
- const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
42
-
43
- function resolveZoomGestureOptions({
44
- rawDrag,
45
- maxSensitivity,
46
- }: {
47
- rawDrag: number;
48
- maxSensitivity: number;
49
- }) {
50
- "worklet";
51
-
52
- const { gestureSensitivity, gestureReleaseVelocityScale } =
53
- resolveRevealGestureHandoff({
54
- rawDrag,
55
- maxSensitivity,
56
- });
57
-
58
- return {
59
- gestureSensitivity,
60
- gestureReleaseVelocityScale,
61
- };
62
- }
63
-
64
- /* -------------------------------------------------------------------------- */
65
- /* BUILD ZOOM STYLES */
66
- /* -------------------------------------------------------------------------- */
67
-
68
36
  export function buildZoomStyles({
69
37
  tag,
70
- zoomOptions,
71
38
  props,
39
+ zoomOptions,
72
40
  }: BuildZoomStylesParams): ZoomInterpolatedStyle {
73
41
  "worklet";
74
42
 
@@ -76,424 +44,276 @@ export function buildZoomStyles({
76
44
  return {};
77
45
  }
78
46
 
79
- /* ------------------------------ Shared Setup ------------------------------ */
80
-
81
47
  const target = zoomOptions?.target;
48
+ const keepFocusedVisible = zoomOptions?.keepFocusedVisible === true;
49
+ const expandedBorderRadius = Math.max(
50
+ 0,
51
+ zoomOptions?.borderRadius ?? ZOOM_NAVIGATION_MASK_BORDER_RADIUS,
52
+ );
53
+ const backgroundScale = zoomOptions?.backgroundScale ?? ZOOM_BACKGROUND_SCALE;
54
+ const backdropColor = zoomOptions?.backdropColor ?? "black";
55
+ const maxBackdropOpacity =
56
+ zoomOptions?.backdropOpacity ?? ZOOM_BACKDROP_MAX_OPACITY;
57
+
82
58
  const {
59
+ active,
60
+ current,
83
61
  focused,
62
+ transitionProgress,
84
63
  layouts: { screen: screenLayout },
85
64
  } = props;
86
- const transitionProgress =
87
- props.current.transitionProgress + (props.next?.transitionProgress ?? 0);
88
- const activeTransitionProgress = props.active.transitionProgress;
89
65
 
90
- const zoomAnchor = target === "bound" ? "center" : ZOOM_SHARED_OPTIONS.anchor;
66
+ const activeTransitionProgress = active.transitionProgress;
91
67
 
92
68
  const bounds = createBoundsAccessorCore({
93
69
  getProps: () => props,
94
70
  });
71
+
95
72
  const scopedBounds = bounds(tag);
96
73
  const link = scopedBounds.link();
74
+ const sourceBounds = link?.source?.bounds;
75
+
76
+ if (!link || !sourceBounds) {
77
+ if (target !== "bound") {
78
+ scopedBounds.values({
79
+ scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
80
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
81
+ method: "content",
82
+ target: target ?? "fullscreen",
83
+ progress: transitionProgress,
84
+ });
85
+ }
97
86
 
98
- if (!link) return {};
99
-
100
- const baseRawOptions = {
101
- scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
102
- } as const;
103
-
104
- const buildEffectiveTag = link.id;
105
- const sourceBorderRadius = getSourceBorderRadius(link);
106
- const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
107
- const focusedElementOpacity = {
108
- open: resolveOpacityRangeTuple({
109
- value: zoomOptions?.focusedElementOpacity?.open,
110
- fallback: ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
111
- }),
112
- close: resolveOpacityRangeTuple({
113
- value: zoomOptions?.focusedElementOpacity?.close,
114
- fallback: ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
115
- }),
116
- };
117
- const unfocusedElementOpacity = {
118
- open: resolveOpacityRangeTuple({
119
- value: zoomOptions?.unfocusedElementOpacity?.open,
120
- fallback: ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
121
- }),
122
- close: resolveOpacityRangeTuple({
123
- value: zoomOptions?.unfocusedElementOpacity?.close,
124
- fallback: ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
125
- }),
126
- };
127
- const sourceVisibilityStyle = {
128
- [buildEffectiveTag]: {
129
- style: VISIBLE_STYLE,
130
- },
131
- } satisfies TransitionInterpolatedStyle;
132
- const navigationMaskEnabled = props.current.options.navigationMaskEnabled;
133
- const maxSensitivity = zoomOptions?.maxSensitivity ?? 0.8;
134
- const velocityDepth =
135
- zoomOptions?.velocityDepth ?? ZOOM_DISMISS_SCALE_ORBIT_DEPTH;
136
-
137
- /* --------------------------- Gesture / Drag Values ------------------------- */
87
+ return {};
88
+ }
138
89
 
139
- const liveGesture = props.active.gesture;
140
- const gestureHandoff = liveGesture.handoff;
141
- const normX = gestureHandoff.normX;
142
- const normY = gestureHandoff.normY;
143
- const initialGesture = resolveZoomPanGestureDirection({
144
- active: gestureHandoff.active,
145
- direction: gestureHandoff.direction,
146
- normX,
147
- normY,
148
- rawNormX: gestureHandoff.raw.normX,
149
- rawNormY: gestureHandoff.raw.normY,
90
+ const zoomContentTarget = getZoomContentTarget({
91
+ explicitTarget: target,
92
+ screenLayout,
93
+ link,
150
94
  });
151
- const isHorizontalDismiss =
152
- initialGesture === "horizontal" || initialGesture === "horizontal-inverted";
153
- const isVerticalDismiss =
154
- initialGesture === "vertical" || initialGesture === "vertical-inverted";
155
- const rawDrag = isHorizontalDismiss
156
- ? Math.abs(gestureHandoff.raw.normX)
157
- : isVerticalDismiss
158
- ? Math.abs(gestureHandoff.raw.normY)
159
- : 0;
160
-
161
- const horizontalDragTranslation = resolveDragTranslationTuple(
162
- zoomOptions?.horizontalDragTranslation,
163
- );
164
- const verticalDragTranslation = resolveDragTranslationTuple(
165
- zoomOptions?.verticalDragTranslation,
166
- );
167
- const dragX = resolveDirectionalDragTranslation({
168
- translation: liveGesture.x,
169
- dimension: screenLayout.width,
170
- negativeMax: horizontalDragTranslation.negativeMax,
171
- positiveMax: horizontalDragTranslation.positiveMax,
172
- exponent: horizontalDragTranslation.exponent,
95
+ const zoomContentAnchor = getZoomContentAnchor({
96
+ explicitTarget: target,
97
+ screenLayout,
98
+ link,
99
+ });
100
+ const trackingContentTarget = resolveZoomTrackingContentTarget({
101
+ contentTarget: zoomContentTarget,
102
+ link,
103
+ screenLayout,
173
104
  });
174
- const dragY = resolveDirectionalDragTranslation({
175
- translation: liveGesture.y,
176
- dimension: screenLayout.height,
177
- negativeMax: verticalDragTranslation.negativeMax,
178
- positiveMax: verticalDragTranslation.positiveMax,
179
- exponent: verticalDragTranslation.exponent,
105
+
106
+ if (!trackingContentTarget) {
107
+ return {};
108
+ }
109
+
110
+ const drag = resolveZoomDragState({
111
+ gesture: active.gesture,
112
+ activeTransitionProgress,
113
+ screenLayout,
114
+ sourceBounds,
115
+ trackingContentTarget,
116
+ dragOptions: zoomOptions?.drag,
180
117
  });
181
- const horizontalDragScale = resolveDragScaleTuple(
182
- zoomOptions?.horizontalDragScale,
183
- );
184
- const verticalDragScale = resolveDragScaleTuple(
185
- zoomOptions?.verticalDragScale,
186
- );
187
- const backgroundScale = resolveBackgroundScale(zoomOptions?.backgroundScale);
188
118
 
189
- const dragXScale = isHorizontalDismiss
190
- ? resolveDirectionalDragScale({
191
- normalized: normX,
192
- dismissDirection:
193
- initialGesture === "horizontal-inverted" ? "negative" : "positive",
194
- shrinkMin: horizontalDragScale.shrinkMin,
195
- growMax: horizontalDragScale.growMax,
196
- exponent: horizontalDragScale.exponent,
197
- })
198
- : IDENTITY_DRAG_SCALE_OUTPUT[0];
199
- const dragYScale = isVerticalDismiss
200
- ? resolveDirectionalDragScale({
201
- normalized: normY,
202
- dismissDirection:
203
- initialGesture === "vertical-inverted" ? "negative" : "positive",
204
- shrinkMin: verticalDragScale.shrinkMin,
205
- growMax: verticalDragScale.growMax,
206
- exponent: verticalDragScale.exponent,
207
- })
208
- : IDENTITY_DRAG_SCALE_OUTPUT[1];
209
- const dragScale = combineScales(dragXScale, dragYScale);
210
- const handoffDragScale = props.active.gesture.dismissing
211
- ? resolveDismissScaleHandoff({
212
- progress: activeTransitionProgress,
213
- releaseScale: dragScale,
214
- targetScale: 1,
215
- velocity: gestureHandoff.velocity,
216
- velocityDepth,
217
- })
218
- : dragScale;
219
- const zoomGestureOptions = resolveZoomGestureOptions({
220
- rawDrag,
221
- maxSensitivity,
119
+ const trackedGestureScale = resolveZoomTrackedGestureScale({
120
+ drag,
121
+ activeTransitionProgress,
122
+ screenLayout,
123
+ sourceBounds,
124
+ trackingContentTarget,
222
125
  });
223
126
 
224
- /* ----------------------------- Focused Screen ----------------------------- */
127
+ const focalGesture = drag.isDismissing
128
+ ? active.gesture.handoff
129
+ : active.gesture;
130
+
131
+ const focalProgress = drag.isDismissing ? activeTransitionProgress : 1;
132
+ const pinchFocalOffset =
133
+ active.gesture.handoff.active === "pinch-in"
134
+ ? resolveZoomPinchFocalOffset({
135
+ gestureScale: drag.isDismissing
136
+ ? focalGesture.scale
137
+ : trackedGestureScale,
138
+ pinchOriginX: focalGesture.pinchOriginX,
139
+ pinchOriginY: focalGesture.pinchOriginY,
140
+ progress: focalProgress,
141
+ rotation: drag.isDismissing ? focalGesture.rotation : drag.rotation,
142
+ screenLayout,
143
+ })
144
+ : { x: 0, y: 0 };
225
145
 
226
146
  if (focused) {
227
- const focusedContentTarget = getZoomContentTarget({
228
- explicitTarget: target,
229
- screenLayout,
230
- anchor: ZOOM_SHARED_OPTIONS.anchor,
231
- link,
147
+ const sourceBorderRadius = getSourceBorderRadius(link);
148
+ const navigationMaskEnabled = current.options.navigationMaskEnabled;
149
+ const backdropOpacity = resolveZoomBackdropOpacity({
150
+ transitionProgress,
151
+ dismissalDrag: drag.dismissNorm,
152
+ fadeEnd: ZOOM_SCREEN_A_FADE_END,
153
+ maxOpacity: maxBackdropOpacity,
232
154
  });
233
155
 
234
156
  const contentRaw = scopedBounds.values({
235
- ...baseRawOptions,
236
- anchor: zoomAnchor,
157
+ scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
158
+ anchor: zoomContentAnchor,
237
159
  method: "content",
238
- target: focusedContentTarget,
160
+ target: zoomContentTarget,
239
161
  progress: transitionProgress,
240
162
  });
241
163
 
242
- const maskRaw = scopedBounds.values({
243
- ...baseRawOptions,
244
- anchor: ZOOM_SHARED_OPTIONS.anchor,
245
- method: "size",
246
- space: "absolute",
247
- target: "fullscreen",
248
- progress: transitionProgress,
249
- });
250
-
251
- const focusedFade = props.active?.closing
252
- ? interpolateOpacityRange({
253
- progress: transitionProgress,
254
- range: focusedElementOpacity.close,
255
- })
256
- : interpolateOpacityRange({
257
- progress: transitionProgress,
258
- range: focusedElementOpacity.open,
259
- });
164
+ const focusedOpacityRange = active.closing
165
+ ? ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE
166
+ : ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE;
260
167
 
261
- /**
262
- * This is also how swiftui handles their navigation zoom.
263
- * They remove clipping as soon as the screen stops animating
264
- */
265
- const shouldRemoveClipping = !props.active.animating;
266
- const focusedMaskBorderRadius = interpolate(
168
+ const focusedFade = interpolate(
267
169
  transitionProgress,
268
- [0, 1],
269
- [sourceBorderRadius, shouldRemoveClipping ? 0 : targetBorderRadius],
170
+ [focusedOpacityRange[0], focusedOpacityRange[1]],
171
+ [focusedOpacityRange[2], focusedOpacityRange[3]],
270
172
  "clamp",
271
173
  );
272
174
 
273
- const { top, right, bottom, left } = ZOOM_MASK_OUTSET;
274
- const maskWidth = Math.max(1, toNumber(maskRaw.width) + left + right);
275
- const maskHeight = Math.max(1, toNumber(maskRaw.height) + top + bottom);
175
+ const contentBaseTranslateX = contentRaw.translateX;
176
+ const contentBaseTranslateY = contentRaw.translateY;
177
+ const contentBaseScale = contentRaw.scale;
178
+
179
+ const contentTranslateX =
180
+ contentBaseTranslateX +
181
+ drag.dragX +
182
+ pinchFocalOffset.x * contentBaseScale;
183
+ const contentTranslateY =
184
+ contentBaseTranslateY +
185
+ drag.dragY +
186
+ pinchFocalOffset.y * contentBaseScale;
187
+ const contentScale = drag.isDismissing
188
+ ? drag.dismissContentScale
189
+ : contentBaseScale * drag.gestureScale;
276
190
 
277
- const contentBaseTranslateX = toNumber(contentRaw.translateX);
278
- const contentBaseTranslateY = toNumber(contentRaw.translateY);
279
- const contentBaseScale = toNumber(contentRaw.scale, 1);
280
- const safeContentBaseScale =
281
- Math.abs(contentBaseScale) > EPSILON ? contentBaseScale : 1;
282
- const contentTranslateX = contentBaseTranslateX + dragX;
283
- const contentTranslateY = contentBaseTranslateY + dragY;
284
- const contentScale = contentBaseScale * handoffDragScale;
285
-
286
- const maskBaseTranslateX = toNumber(maskRaw.translateX) - left;
287
- const maskBaseTranslateY = toNumber(maskRaw.translateY) - top;
288
- const maskCenterX = maskWidth / 2;
289
- const maskCenterY = maskHeight / 2;
290
- const contentCenterX = screenLayout.width / 2;
291
- const contentCenterY = screenLayout.height / 2;
292
- const compensatedMaskTranslateX =
293
- (maskBaseTranslateX -
294
- contentBaseTranslateX +
295
- (1 - contentBaseScale) * (maskCenterX - contentCenterX)) /
296
- safeContentBaseScale;
297
- const compensatedMaskTranslateY =
298
- (maskBaseTranslateY -
299
- contentBaseTranslateY +
300
- (1 - contentBaseScale) * (maskCenterY - contentCenterY)) /
301
- safeContentBaseScale;
302
- const compensatedMaskScale = 1 / safeContentBaseScale;
303
-
304
- const focusedContentStyle = {
305
- opacity: zoomOptions?.debug ? 0.5 : focusedFade,
306
- transform: [
307
- { translateX: contentTranslateX },
308
- { translateY: contentTranslateY },
309
- { scale: contentScale },
310
- ],
311
- ...(navigationMaskEnabled
312
- ? {}
313
- : {
314
- borderRadius: focusedMaskBorderRadius,
315
- overflow: "hidden" as const,
316
- }),
317
- };
318
-
319
- const focusedStyles: ZoomInterpolatedStyle = {
320
- content: {
321
- style: focusedContentStyle,
191
+ return {
192
+ options: {
193
+ gestureReleaseVelocityScale: 0.5,
322
194
  },
323
- ...sourceVisibilityStyle,
324
- };
325
-
326
- if (navigationMaskEnabled) {
327
- focusedStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] = {
195
+ backdrop: {
328
196
  style: {
329
- width: maskWidth,
330
- height: maskHeight,
331
- borderRadius: focusedMaskBorderRadius,
197
+ backgroundColor: backdropColor,
198
+ opacity: backdropOpacity,
199
+ },
200
+ },
201
+ content: {
202
+ style: {
203
+ ...(keepFocusedVisible ? {} : { opacity: focusedFade }),
332
204
  transform: [
333
- { translateX: compensatedMaskTranslateX },
334
- { translateY: compensatedMaskTranslateY },
335
- { scale: compensatedMaskScale },
205
+ { translateX: contentTranslateX },
206
+ { translateY: contentTranslateY },
207
+ { scale: contentScale },
208
+ { rotateZ: `${drag.rotation}rad` },
336
209
  ],
210
+ borderRadius: interpolate(
211
+ transitionProgress,
212
+ [0, 1],
213
+ [sourceBorderRadius, active.animating ? expandedBorderRadius : 0],
214
+ "clamp",
215
+ ),
216
+ overflow: "hidden" as const,
337
217
  },
338
- };
339
- }
340
-
341
- return {
342
- options: zoomGestureOptions,
343
- ...focusedStyles,
218
+ },
219
+ [NAVIGATION_MASK_ELEMENT_STYLE_ID]: navigationMaskEnabled
220
+ ? resolveZoomNavigationMaskStyle({
221
+ scopedBounds,
222
+ link,
223
+ sourceBounds,
224
+ screenLayout,
225
+ transitionProgress,
226
+ drag,
227
+ contentTransform: contentRaw,
228
+ sourceBorderRadius,
229
+ expandedBorderRadius,
230
+ active,
231
+ anchor: zoomContentAnchor,
232
+ })
233
+ : {},
344
234
  };
345
235
  }
346
236
 
347
- /* ---------------------------- Unfocused Screen ---------------------------- */
348
-
349
- const unfocusedFade = props.active?.closing
350
- ? interpolateOpacityRange({
351
- progress: transitionProgress,
352
- range: unfocusedElementOpacity.close,
353
- })
354
- : interpolateOpacityRange({
355
- progress: transitionProgress,
356
- range: unfocusedElementOpacity.open,
357
- });
237
+ const unfocusedOpacityRange = active.closing
238
+ ? ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE
239
+ : ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE;
240
+ const unfocusedFade = interpolate(
241
+ transitionProgress,
242
+ [unfocusedOpacityRange[0], unfocusedOpacityRange[1]],
243
+ [unfocusedOpacityRange[2], unfocusedOpacityRange[3]],
244
+ "clamp",
245
+ );
358
246
  const unfocusedScale = interpolate(
359
247
  transitionProgress,
360
248
  [1, 2],
361
249
  [1, backgroundScale],
362
250
  "clamp",
363
251
  );
364
- const didSourceComponentVisiblyHide =
365
- !props.active.closing && unfocusedFade <= EPSILON;
366
252
 
367
- const shouldHideUnfocusedElement =
368
- !props.active.closing && didSourceComponentVisiblyHide;
369
-
370
- const unfocusedElementTarget = getZoomContentTarget({
371
- explicitTarget: target,
372
- screenLayout,
373
- anchor: ZOOM_SHARED_OPTIONS.anchor,
374
- link,
375
- });
376
-
377
- const elementRaw = scopedBounds.values({
378
- ...baseRawOptions,
379
- anchor: zoomAnchor,
380
- method: "transform",
381
- space: "relative",
382
- target: unfocusedElementTarget,
383
- progress: transitionProgress,
384
- });
385
-
386
- const boundTargetCenterX =
387
- target === "bound" && link.destination?.bounds
388
- ? link.destination.bounds.pageX + link.destination.bounds.width / 2
389
- : undefined;
390
- const boundTargetCenterY =
391
- target === "bound" && link.destination?.bounds
392
- ? link.destination.bounds.pageY + link.destination.bounds.height / 2
393
- : undefined;
394
-
395
- const elementCenterX =
396
- boundTargetCenterX ??
397
- (typeof unfocusedElementTarget === "object"
398
- ? unfocusedElementTarget.pageX + unfocusedElementTarget.width / 2
399
- : screenLayout.width / 2);
400
- const elementCenterY =
401
- boundTargetCenterY ??
402
- (typeof unfocusedElementTarget === "object"
403
- ? unfocusedElementTarget.pageY + unfocusedElementTarget.height / 2
404
- : screenLayout.height / 2);
405
-
406
- const unfocusedContentScale = props.active.settled ? 1 : unfocusedScale;
407
- const shouldTrackGestureTranslation = !props.active.settled;
408
- const shouldTrackGestureScale = !props.active.settled;
409
- const elementGestureScale = shouldTrackGestureScale ? handoffDragScale : 1;
410
- const elementGestureX = shouldTrackGestureTranslation ? dragX : 0;
411
- const elementGestureY = shouldTrackGestureTranslation ? dragY : 0;
412
- const safeUnfocusedContentScale = Math.max(
413
- Math.abs(unfocusedContentScale),
414
- EPSILON,
415
- );
416
- // A naturally settled close can leave this as the last emitted style frame,
417
- // so drop temporary stacking here instead of waiting for a later reset pass.
418
- const shouldElevateUnfocusedElement =
419
- !props.active.closing || !props.active.settled;
253
+ const shouldHideSource = !active.closing && unfocusedFade <= EPSILON;
254
+ const unfocusedContentScale = active.settled ? 1 : unfocusedScale;
255
+ const unfocusedContent = {
256
+ style: {
257
+ transform: [{ scale: unfocusedContentScale }],
258
+ },
259
+ };
420
260
 
421
- const scaleShiftX = computeCenterScaleShift({
422
- center: elementCenterX,
423
- containerCenter: screenLayout.width / 2,
424
- scale: elementGestureScale,
425
- });
426
- const scaleShiftY = computeCenterScaleShift({
427
- center: elementCenterY,
428
- containerCenter: screenLayout.height / 2,
429
- scale: elementGestureScale,
430
- });
261
+ // To avoid measuring a component from a bad position,
262
+ // we'll want to hide + reset this component when the animation has reached a visual settling point
263
+ if (shouldHideSource || active.settled) {
264
+ return {
265
+ content: unfocusedContent,
266
+ [link.id]: {
267
+ style: {
268
+ transform: [
269
+ { translateX: 0 },
270
+ { translateY: 0 },
271
+ { scaleX: 1 },
272
+ { scaleY: 1 },
273
+ ],
274
+ opacity: shouldHideSource ? 0 : unfocusedFade,
275
+ },
276
+ },
277
+ };
278
+ }
431
279
 
432
- const compensatedGestureX = composeCompensatedTranslation({
433
- gesture: elementGestureX,
434
- parentScale: unfocusedContentScale,
435
- centerShift: scaleShiftX,
436
- epsilon: EPSILON,
437
- });
438
- const compensatedGestureY = composeCompensatedTranslation({
439
- gesture: elementGestureY,
280
+ const trackedContentBaseScale = resolveRevealContentBaseTransform({
281
+ progress: activeTransitionProgress,
282
+ sourceBounds,
283
+ destinationBounds: trackingContentTarget,
284
+ screenLayout,
285
+ }).scale;
286
+ const trackedDragX =
287
+ drag.dragX + pinchFocalOffset.x * trackedContentBaseScale;
288
+ const trackedDragY =
289
+ drag.dragY + pinchFocalOffset.y * trackedContentBaseScale;
290
+
291
+ const trackedSourceElement = resolveZoomTrackedSourceTransform({
292
+ progress: activeTransitionProgress,
293
+ sourceBounds,
294
+ destinationBounds: trackingContentTarget,
295
+ screenLayout,
296
+ dragX: trackedDragX,
297
+ dragY: trackedDragY,
298
+ gestureScale: trackedGestureScale,
440
299
  parentScale: unfocusedContentScale,
441
- centerShift: scaleShiftY,
442
- epsilon: EPSILON,
300
+ rotation: drag.rotation,
301
+ anchor: zoomContentAnchor,
443
302
  });
444
303
 
445
- const elementTranslateX =
446
- toNumber(elementRaw.translateX) + compensatedGestureX;
447
- const elementTranslateY =
448
- toNumber(elementRaw.translateY) + compensatedGestureY;
449
- const elementScaleX =
450
- (toNumber(elementRaw.scaleX, 1) * elementGestureScale) /
451
- safeUnfocusedContentScale;
452
- const elementScaleY =
453
- (toNumber(elementRaw.scaleY, 1) * elementGestureScale) /
454
- safeUnfocusedContentScale;
455
-
456
- const resolvedElementStyle = shouldHideUnfocusedElement
457
- ? {
458
- transform: [
459
- { translateX: 0 },
460
- { translateY: 0 },
461
- { scaleX: 1 },
462
- { scaleY: 1 },
463
- ],
464
- opacity: zoomOptions?.debug ? 1 : 0,
465
- zIndex: 0,
466
- elevation: 0,
467
- }
468
- : {
469
- transform: [
470
- {
471
- translateX: elementTranslateX,
472
- },
473
- {
474
- translateY: elementTranslateY,
475
- },
476
- {
477
- scaleX: elementScaleX,
478
- },
479
- {
480
- scaleY: elementScaleY,
481
- },
482
- ],
483
- opacity: zoomOptions?.debug ? 1 : unfocusedFade,
484
- zIndex: shouldElevateUnfocusedElement ? 9999 : 0,
485
- elevation: shouldElevateUnfocusedElement ? 9999 : 0,
486
- };
487
-
488
304
  return {
489
- options: zoomGestureOptions,
490
- content: {
305
+ content: unfocusedContent,
306
+ [link.id]: {
491
307
  style: {
492
- transform: [{ scale: unfocusedContentScale }],
308
+ transform: [
309
+ { translateX: trackedSourceElement.translateX },
310
+ { translateY: trackedSourceElement.translateY },
311
+ { rotateZ: `${drag.rotation}rad` },
312
+ { scaleX: trackedSourceElement.scaleX },
313
+ { scaleY: trackedSourceElement.scaleY },
314
+ ],
315
+ opacity: unfocusedFade,
493
316
  },
494
317
  },
495
- [buildEffectiveTag]: {
496
- style: resolvedElementStyle,
497
- },
498
318
  };
499
319
  }