react-native-screen-transitions 3.4.0-alpha.3 → 3.4.0-alpha.5

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 (328) hide show
  1. package/lib/commonjs/component-stack/components/component-screen.js +1 -1
  2. package/lib/commonjs/component-stack/components/component-screen.js.map +1 -1
  3. package/lib/commonjs/shared/animation/snap-to.js +6 -3
  4. package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +47 -4
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/index.js +6 -6
  12. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  13. package/lib/commonjs/shared/components/native-screen.js +3 -3
  14. package/lib/commonjs/shared/components/native-screen.js.map +1 -1
  15. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +1 -1
  16. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
  17. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +18 -14
  18. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  19. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +8 -5
  20. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  21. package/lib/commonjs/shared/components/screen-container/layers/content.js +12 -28
  22. package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
  23. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +17 -4
  24. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  25. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
  26. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
  27. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
  28. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
  29. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
  30. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
  31. package/lib/commonjs/shared/components/screen-lifecycle/index.js +5 -3
  32. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  33. package/lib/commonjs/shared/configs/presets.js +3 -4
  34. package/lib/commonjs/shared/configs/presets.js.map +1 -1
  35. package/lib/commonjs/shared/constants.js +16 -2
  36. package/lib/commonjs/shared/constants.js.map +1 -1
  37. package/lib/commonjs/shared/hooks/animation/use-associated-style.js +2 -2
  38. package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
  39. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +12 -9
  40. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  41. package/lib/commonjs/shared/providers/gestures/helpers/gesture-physics.js +3 -2
  42. package/lib/commonjs/shared/providers/gestures/helpers/gesture-physics.js.map +1 -1
  43. package/lib/commonjs/shared/providers/gestures/helpers/gesture-reset.js +7 -5
  44. package/lib/commonjs/shared/providers/gestures/helpers/gesture-reset.js.map +1 -1
  45. package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
  46. package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
  47. package/lib/commonjs/shared/providers/gestures/helpers/gesture-targets.js +9 -6
  48. package/lib/commonjs/shared/providers/gestures/helpers/gesture-targets.js.map +1 -1
  49. package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
  50. package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
  51. package/lib/commonjs/shared/providers/gestures/use-build-gestures.js +1 -1
  52. package/lib/commonjs/shared/providers/gestures/use-build-gestures.js.map +1 -1
  53. package/lib/commonjs/shared/providers/register-bounds.provider.js +5 -5
  54. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  55. package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js +17 -0
  56. package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
  57. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +72 -0
  58. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
  59. package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +22 -108
  60. package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  61. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +42 -0
  62. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
  63. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +17 -3
  64. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
  65. package/lib/commonjs/shared/providers/screen/styles.provider.js +4 -1
  66. package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
  67. package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -1
  68. package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
  69. package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js +1 -1
  70. package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
  71. package/lib/commonjs/shared/stores/animation.store.js +12 -40
  72. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  73. package/lib/commonjs/shared/stores/gesture.store.js +13 -33
  74. package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
  75. package/lib/commonjs/shared/stores/system.store.js +31 -0
  76. package/lib/commonjs/shared/stores/system.store.js.map +1 -0
  77. package/lib/commonjs/shared/types/bounds.types.js +1 -3
  78. package/lib/commonjs/shared/types/bounds.types.js.map +1 -1
  79. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +2 -2
  80. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  81. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  82. package/lib/commonjs/shared/utils/bounds/index.js +23 -50
  83. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  84. package/lib/commonjs/shared/utils/bounds/zoom/build.js +108 -362
  85. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  86. package/lib/commonjs/shared/utils/bounds/zoom/config.js +15 -101
  87. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  88. package/lib/commonjs/shared/utils/bounds/zoom/math.js +154 -0
  89. package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -0
  90. package/lib/commonjs/shared/utils/bounds/zoom/types.js +1 -3
  91. package/lib/commonjs/shared/utils/bounds/zoom/types.js.map +1 -1
  92. package/lib/commonjs/shared/utils/create-store.js +54 -0
  93. package/lib/commonjs/shared/utils/create-store.js.map +1 -0
  94. package/lib/module/component-stack/components/component-screen.js +1 -1
  95. package/lib/module/component-stack/components/component-screen.js.map +1 -1
  96. package/lib/module/shared/animation/snap-to.js +6 -3
  97. package/lib/module/shared/animation/snap-to.js.map +1 -1
  98. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
  99. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  100. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +48 -5
  101. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
  102. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
  103. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
  104. package/lib/module/shared/components/create-boundary-component/index.js +6 -6
  105. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  106. package/lib/module/shared/components/native-screen.js +3 -3
  107. package/lib/module/shared/components/native-screen.js.map +1 -1
  108. package/lib/module/shared/components/screen-container/deferred-visibility-host.js +2 -2
  109. package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
  110. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +18 -14
  111. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  112. package/lib/module/shared/components/screen-container/layers/backdrop.js +8 -5
  113. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  114. package/lib/module/shared/components/screen-container/layers/content.js +13 -29
  115. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  116. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +19 -6
  117. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  118. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
  119. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
  120. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
  121. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
  122. package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
  123. package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
  124. package/lib/module/shared/components/screen-lifecycle/index.js +5 -3
  125. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  126. package/lib/module/shared/configs/presets.js +3 -4
  127. package/lib/module/shared/configs/presets.js.map +1 -1
  128. package/lib/module/shared/constants.js +16 -2
  129. package/lib/module/shared/constants.js.map +1 -1
  130. package/lib/module/shared/hooks/animation/use-associated-style.js +2 -2
  131. package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
  132. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +12 -9
  133. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  134. package/lib/module/shared/providers/gestures/helpers/gesture-physics.js +3 -2
  135. package/lib/module/shared/providers/gestures/helpers/gesture-physics.js.map +1 -1
  136. package/lib/module/shared/providers/gestures/helpers/gesture-reset.js +7 -5
  137. package/lib/module/shared/providers/gestures/helpers/gesture-reset.js.map +1 -1
  138. package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
  139. package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
  140. package/lib/module/shared/providers/gestures/helpers/gesture-targets.js +9 -6
  141. package/lib/module/shared/providers/gestures/helpers/gesture-targets.js.map +1 -1
  142. package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
  143. package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
  144. package/lib/module/shared/providers/gestures/use-build-gestures.js +1 -1
  145. package/lib/module/shared/providers/gestures/use-build-gestures.js.map +1 -1
  146. package/lib/module/shared/providers/register-bounds.provider.js +5 -5
  147. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  148. package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js +12 -0
  149. package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
  150. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +67 -0
  151. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
  152. package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +22 -108
  153. package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  154. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +37 -0
  155. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
  156. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +15 -2
  157. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
  158. package/lib/module/shared/providers/screen/styles.provider.js +5 -2
  159. package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
  160. package/lib/module/shared/providers/stack/direct.provider.js +1 -1
  161. package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
  162. package/lib/module/shared/providers/stack/helpers/use-processed-routes.js +1 -1
  163. package/lib/module/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
  164. package/lib/module/shared/stores/animation.store.js +12 -40
  165. package/lib/module/shared/stores/animation.store.js.map +1 -1
  166. package/lib/module/shared/stores/gesture.store.js +13 -33
  167. package/lib/module/shared/stores/gesture.store.js.map +1 -1
  168. package/lib/module/shared/stores/system.store.js +27 -0
  169. package/lib/module/shared/stores/system.store.js.map +1 -0
  170. package/lib/module/shared/types/bounds.types.js +9 -1
  171. package/lib/module/shared/types/bounds.types.js.map +1 -1
  172. package/lib/module/shared/utils/animation/animate-to-progress.js +2 -2
  173. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  174. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  175. package/lib/module/shared/utils/bounds/index.js +23 -50
  176. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  177. package/lib/module/shared/utils/bounds/zoom/build.js +101 -355
  178. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  179. package/lib/module/shared/utils/bounds/zoom/config.js +12 -98
  180. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  181. package/lib/module/shared/utils/bounds/zoom/math.js +136 -0
  182. package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -0
  183. package/lib/module/shared/utils/bounds/zoom/types.js +1 -1
  184. package/lib/module/shared/utils/bounds/zoom/types.js.map +1 -1
  185. package/lib/module/shared/utils/create-store.js +50 -0
  186. package/lib/module/shared/utils/create-store.js.map +1 -0
  187. package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
  188. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +1 -2
  189. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +1 -1
  190. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +1 -1
  191. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  192. package/lib/typescript/shared/components/native-screen.d.ts.map +1 -1
  193. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  194. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  195. package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
  196. package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
  197. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.d.ts.map +1 -1
  198. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts +2 -1
  199. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts.map +1 -1
  200. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts +2 -1
  201. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts.map +1 -1
  202. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  203. package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
  204. package/lib/typescript/shared/constants.d.ts.map +1 -1
  205. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
  206. package/lib/typescript/shared/index.d.ts +3 -3
  207. package/lib/typescript/shared/index.d.ts.map +1 -1
  208. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  209. package/lib/typescript/shared/providers/gestures/helpers/gesture-physics.d.ts.map +1 -1
  210. package/lib/typescript/shared/providers/gestures/helpers/gesture-reset.d.ts.map +1 -1
  211. package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts +2 -2
  212. package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts.map +1 -1
  213. package/lib/typescript/shared/providers/gestures/helpers/gesture-targets.d.ts.map +1 -1
  214. package/lib/typescript/shared/providers/gestures/use-build-gestures.d.ts.map +1 -1
  215. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  216. package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts +8 -0
  217. package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts.map +1 -0
  218. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +22 -0
  219. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -0
  220. package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts +4 -2
  221. package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
  222. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +21 -0
  223. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -0
  224. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +6 -2
  225. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +1 -1
  226. package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -1
  227. package/lib/typescript/shared/stores/animation.store.d.ts +10 -17
  228. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  229. package/lib/typescript/shared/stores/gesture.store.d.ts +24 -14
  230. package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
  231. package/lib/typescript/shared/stores/system.store.d.ts +27 -0
  232. package/lib/typescript/shared/stores/system.store.d.ts.map +1 -0
  233. package/lib/typescript/shared/types/animation.types.d.ts +38 -9
  234. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  235. package/lib/typescript/shared/types/bounds.types.d.ts +14 -42
  236. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  237. package/lib/typescript/shared/types/index.d.ts +2 -2
  238. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  239. package/lib/typescript/shared/types/screen.types.d.ts +11 -0
  240. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  241. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +3 -1
  242. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  243. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
  244. package/lib/typescript/shared/utils/bounds/index.d.ts +2 -3
  245. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  246. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +2 -3
  247. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  248. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +15 -41
  249. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  250. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +44 -0
  251. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -0
  252. package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +8 -13
  253. package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -1
  254. package/lib/typescript/shared/utils/create-store.d.ts +14 -0
  255. package/lib/typescript/shared/utils/create-store.d.ts.map +1 -0
  256. package/package.json +1 -1
  257. package/src/component-stack/components/component-screen.tsx +1 -1
  258. package/src/shared/animation/snap-to.ts +10 -4
  259. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +1 -1
  260. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +82 -10
  261. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +2 -5
  262. package/src/shared/components/create-boundary-component/index.tsx +6 -12
  263. package/src/shared/components/native-screen.tsx +3 -9
  264. package/src/shared/components/screen-container/deferred-visibility-host.tsx +2 -2
  265. package/src/shared/components/screen-container/hooks/use-content-layout.ts +42 -43
  266. package/src/shared/components/screen-container/layers/backdrop.tsx +12 -6
  267. package/src/shared/components/screen-container/layers/content.tsx +17 -49
  268. package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +26 -5
  269. package/src/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.ts +4 -2
  270. package/src/shared/components/screen-lifecycle/hooks/use-close-transition/index.ts +8 -0
  271. package/src/shared/components/screen-lifecycle/hooks/use-open-transition.ts +21 -10
  272. package/src/shared/components/screen-lifecycle/index.tsx +8 -2
  273. package/src/shared/configs/presets.ts +8 -7
  274. package/src/shared/constants.ts +14 -0
  275. package/src/shared/hooks/animation/use-associated-style.ts +2 -8
  276. package/src/shared/index.ts +2 -0
  277. package/src/shared/providers/gestures/handlers/use-handlers.ts +13 -10
  278. package/src/shared/providers/gestures/helpers/gesture-physics.ts +4 -2
  279. package/src/shared/providers/gestures/helpers/gesture-reset.ts +9 -5
  280. package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +12 -10
  281. package/src/shared/providers/gestures/helpers/gesture-targets.ts +14 -6
  282. package/src/shared/providers/gestures/helpers/register-direction-claims.ts +1 -1
  283. package/src/shared/providers/gestures/use-build-gestures.ts +1 -3
  284. package/src/shared/providers/register-bounds.provider.tsx +5 -11
  285. package/src/shared/providers/screen/animation/helpers/has-transitions-enabled.ts +14 -0
  286. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +108 -0
  287. package/src/shared/providers/screen/animation/helpers/pipeline.ts +37 -199
  288. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +77 -0
  289. package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +24 -4
  290. package/src/shared/providers/screen/styles.provider.tsx +5 -1
  291. package/src/shared/providers/stack/direct.provider.tsx +1 -1
  292. package/src/shared/providers/stack/helpers/use-processed-routes.ts +1 -1
  293. package/src/shared/stores/animation.store.ts +11 -61
  294. package/src/shared/stores/gesture.store.ts +25 -45
  295. package/src/shared/stores/system.store.ts +44 -0
  296. package/src/shared/types/animation.types.ts +41 -9
  297. package/src/shared/types/bounds.types.ts +25 -25
  298. package/src/shared/types/index.ts +2 -0
  299. package/src/shared/types/screen.types.ts +12 -0
  300. package/src/shared/utils/animation/animate-to-progress.ts +4 -2
  301. package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +0 -1
  302. package/src/shared/utils/bounds/index.ts +26 -75
  303. package/src/shared/utils/bounds/zoom/build.ts +179 -502
  304. package/src/shared/utils/bounds/zoom/config.ts +14 -164
  305. package/src/shared/utils/bounds/zoom/math.ts +193 -0
  306. package/src/shared/utils/bounds/zoom/types.ts +15 -17
  307. package/src/shared/utils/create-store.ts +62 -0
  308. package/lib/commonjs/shared/utils/bounds/types/frame-props.js +0 -6
  309. package/lib/commonjs/shared/utils/bounds/types/frame-props.js.map +0 -1
  310. package/lib/commonjs/shared/utils/bounds/zoom/accessor.js +0 -54
  311. package/lib/commonjs/shared/utils/bounds/zoom/accessor.js.map +0 -1
  312. package/lib/commonjs/shared/utils/bounds/zoom/index.js +0 -20
  313. package/lib/commonjs/shared/utils/bounds/zoom/index.js.map +0 -1
  314. package/lib/module/shared/utils/bounds/types/frame-props.js +0 -4
  315. package/lib/module/shared/utils/bounds/types/frame-props.js.map +0 -1
  316. package/lib/module/shared/utils/bounds/zoom/accessor.js +0 -49
  317. package/lib/module/shared/utils/bounds/zoom/accessor.js.map +0 -1
  318. package/lib/module/shared/utils/bounds/zoom/index.js +0 -5
  319. package/lib/module/shared/utils/bounds/zoom/index.js.map +0 -1
  320. package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts +0 -5
  321. package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts.map +0 -1
  322. package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +0 -17
  323. package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +0 -1
  324. package/lib/typescript/shared/utils/bounds/zoom/index.d.ts +0 -3
  325. package/lib/typescript/shared/utils/bounds/zoom/index.d.ts.map +0 -1
  326. package/src/shared/utils/bounds/types/frame-props.ts +0 -5
  327. package/src/shared/utils/bounds/zoom/accessor.ts +0 -69
  328. package/src/shared/utils/bounds/zoom/index.ts +0 -2
@@ -1,4 +1,4 @@
1
- import { interpolate, type StyleProps } from "react-native-reanimated";
1
+ import { interpolate } from "react-native-reanimated";
2
2
  import {
3
3
  EPSILON,
4
4
  HIDDEN_STYLE,
@@ -10,246 +10,56 @@ import {
10
10
  BoundStore,
11
11
  type ResolvedTransitionPair,
12
12
  } from "../../../stores/bounds";
13
- import type {
14
- ScreenStyleInterpolator,
15
- TransitionInterpolatedStyle,
16
- } from "../../../types/animation.types";
17
- import type { BoundsNavigationZoomOptions } from "../../../types/bounds.types";
13
+ import type { TransitionInterpolatedStyle } from "../../../types/animation.types";
18
14
  import type { Layout } from "../../../types/screen.types";
15
+ import { computeBoundStyles } from "../helpers/compute-bounds-styles";
19
16
  import type { BoundsOptions } from "../types/options";
20
17
  import {
21
- type ResolvedZoomOptions,
22
- resolveZoomConfig,
18
+ getZoomAnchor,
23
19
  toNumber,
20
+ ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
21
+ ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
22
+ ZOOM_DRAG_RESISTANCE,
23
+ ZOOM_MASK_OUTSET,
24
+ ZOOM_SHARED_OPTIONS,
24
25
  } from "./config";
25
- import type { BuildZoomStylesParams } from "./types";
26
-
27
- type CombinedScaleMode = "multiply" | "average" | "max" | "min";
26
+ import {
27
+ combineScales,
28
+ composeCompensatedTranslation,
29
+ computeCenterScaleShift,
30
+ normalizedToTranslation,
31
+ resolveDirectionalDragScale,
32
+ } from "./math";
33
+ import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
28
34
 
29
35
  const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
30
- type ZoomMask = NonNullable<BoundsNavigationZoomOptions["mask"]>;
31
- type ZoomRadiusValue = Exclude<ZoomMask["borderRadius"], undefined>;
32
-
33
- const clamp = (value: number, min: number, max: number): number => {
34
- "worklet";
35
- const lower = min < max ? min : max;
36
- const upper = max > min ? max : min;
37
-
38
- if (value < lower) return lower;
39
- if (value > upper) return upper;
40
-
41
- return value;
42
- };
43
-
44
- const clamp01 = (value: number): number => {
45
- "worklet";
46
- return clamp(value, 0, 1);
47
- };
48
-
49
- const lerp = (from: number, to: number, t: number): number => {
50
- "worklet";
51
- return from + (to - from) * t;
52
- };
53
-
54
- const safeDivide = (
55
- numerator: number,
56
- denominator: number,
57
- fallback = 0,
58
- ): number => {
59
- "worklet";
60
- if (denominator === 0) return fallback;
61
- return numerator / denominator;
62
- };
63
-
64
- const inverseLerp = (value: number, inMin: number, inMax: number): number => {
65
- "worklet";
66
- return safeDivide(value - inMin, inMax - inMin, 0);
67
- };
68
-
69
- const mapRangeClamped = (
70
- value: number,
71
- inMin: number,
72
- inMax: number,
73
- outMin: number,
74
- outMax: number,
75
- ): number => {
76
- "worklet";
77
- const t = clamp01(inverseLerp(value, inMin, inMax));
78
- return lerp(outMin, outMax, t);
79
- };
80
-
81
- const applyPowerCurve = (value: number, exponent: number): number => {
82
- "worklet";
83
- const safeExponent = exponent > 0 ? exponent : 1;
84
- const magnitude = Math.abs(value) ** safeExponent;
85
- return value < 0 ? -magnitude : magnitude;
86
- };
87
-
88
- const normalizedToTranslation = ({
89
- normalized,
90
- dimension,
91
- resistance,
92
- }: {
93
- normalized: number;
94
- dimension: number;
95
- resistance: number;
96
- }): number => {
97
- "worklet";
98
- const distance = Math.max(0, dimension) * resistance;
99
- return mapRangeClamped(normalized, -1, 1, -distance, distance);
100
- };
101
-
102
- const normalizedToScale = ({
103
- normalized,
104
- outputRange,
105
- exponent = 1,
106
- positiveOnly = true,
107
- }: {
108
- normalized: number;
109
- outputRange: readonly [number, number];
110
- exponent?: number;
111
- positiveOnly?: boolean;
112
- }): number => {
113
- "worklet";
114
- const [outputStart, outputEnd] = outputRange;
115
- const raw = positiveOnly
116
- ? mapRangeClamped(normalized, 0, 1, outputStart, outputEnd)
117
- : mapRangeClamped(normalized, -1, 1, outputStart, outputEnd);
118
-
119
- return applyPowerCurve(raw, exponent);
120
- };
121
36
 
122
- const combineScales = (
123
- scaleX: number,
124
- scaleY: number,
125
- mode: CombinedScaleMode = "multiply",
37
+ const getSourceBorderRadius = (
38
+ resolvedPair: ResolvedTransitionPair,
126
39
  ): number => {
127
40
  "worklet";
128
41
 
129
- switch (mode) {
130
- case "average":
131
- return (scaleX + scaleY) / 2;
132
- case "max":
133
- return Math.max(scaleX, scaleY);
134
- case "min":
135
- return Math.min(scaleX, scaleY);
136
- default:
137
- return scaleX * scaleY;
138
- }
139
- };
140
-
141
- const computeCenterScaleShift = ({
142
- center,
143
- containerCenter,
144
- scale,
145
- }: {
146
- center: number;
147
- containerCenter: number;
148
- scale: number;
149
- }): number => {
150
- "worklet";
151
- return (center - containerCenter) * (scale - 1);
152
- };
153
-
154
- const compensateTranslationForParentScale = ({
155
- translation,
156
- parentScale,
157
- epsilon,
158
- }: {
159
- translation: number;
160
- parentScale: number;
161
- epsilon: number;
162
- }): number => {
163
- "worklet";
164
- const safeParentScale = Math.max(parentScale, epsilon);
165
- return safeDivide(translation, safeParentScale, translation);
166
- };
167
-
168
- const composeCompensatedTranslation = ({
169
- gesture,
170
- parentScale,
171
- centerShift = 0,
172
- epsilon,
173
- }: {
174
- gesture: number;
175
- parentScale: number;
176
- centerShift?: number;
177
- epsilon: number;
178
- }): number => {
179
- "worklet";
180
- return (
181
- compensateTranslationForParentScale({
182
- translation: gesture,
183
- parentScale,
184
- epsilon,
185
- }) + centerShift
186
- );
187
- };
188
-
189
- const resolveDirectionalDragScale = ({
190
- normalized,
191
- dismissDirection,
192
- shrinkMin,
193
- growMax,
194
- exponent,
195
- }: {
196
- normalized: number;
197
- dismissDirection: "positive" | "negative";
198
- shrinkMin: number;
199
- growMax: number;
200
- exponent: number;
201
- }) => {
202
- "worklet";
203
-
204
- const dismissalRelative =
205
- dismissDirection === "negative" ? -normalized : normalized;
206
-
207
- if (dismissalRelative >= 0) {
208
- return normalizedToScale({
209
- normalized: dismissalRelative,
210
- outputRange: [1, shrinkMin],
211
- exponent,
212
- });
213
- }
214
-
215
- const oppositeDrag = Math.min(1, Math.abs(dismissalRelative));
216
- return interpolate(oppositeDrag, [0, 1], [1, growMax], "clamp");
42
+ return typeof resolvedPair.sourceStyles?.borderRadius === "number"
43
+ ? resolvedPair.sourceStyles.borderRadius
44
+ : 0;
217
45
  };
218
46
 
219
47
  const getZoomContentTarget = ({
220
48
  explicitTarget,
221
- resolvedTag,
222
- currentRouteKey,
223
- previousRouteKey,
224
- nextRouteKey,
225
- entering,
226
49
  screenLayout,
227
50
  anchor,
228
51
  resolvedPair,
229
52
  }: {
230
53
  explicitTarget: BoundsOptions["target"] | undefined;
231
- resolvedTag: string;
232
- currentRouteKey?: string;
233
- previousRouteKey?: string;
234
- nextRouteKey?: string;
235
- entering: boolean;
236
54
  screenLayout: Layout;
237
55
  anchor: BoundsOptions["anchor"] | undefined;
238
- resolvedPair?: ResolvedTransitionPair;
56
+ resolvedPair: ResolvedTransitionPair;
239
57
  }) => {
240
58
  "worklet";
241
- if (explicitTarget !== undefined) return explicitTarget;
242
59
 
243
- const pair =
244
- resolvedPair ??
245
- BoundStore.resolveTransitionPair(resolvedTag, {
246
- currentScreenKey: currentRouteKey,
247
- previousScreenKey: previousRouteKey,
248
- nextScreenKey: nextRouteKey,
249
- entering,
250
- });
60
+ if (explicitTarget) return explicitTarget;
251
61
 
252
- const sourceBounds = pair.sourceBounds;
62
+ const sourceBounds = resolvedPair.sourceBounds;
253
63
  const screenWidth = screenLayout.width;
254
64
 
255
65
  if (!sourceBounds || sourceBounds.width <= 0 || screenWidth <= 0) {
@@ -257,45 +67,14 @@ const getZoomContentTarget = ({
257
67
  }
258
68
 
259
69
  const height = (sourceBounds.height / sourceBounds.width) * screenWidth;
260
- let horizontalAnchor: "leading" | "center" | "trailing";
261
- switch (anchor) {
262
- case "topLeading":
263
- case "leading":
264
- case "bottomLeading":
265
- horizontalAnchor = "leading";
266
- break;
267
- case "topTrailing":
268
- case "trailing":
269
- case "bottomTrailing":
270
- horizontalAnchor = "trailing";
271
- break;
272
- default:
273
- horizontalAnchor = "center";
274
- break;
275
- }
276
-
277
- let verticalAnchor: "top" | "center" | "bottom";
278
- switch (anchor) {
279
- case "topLeading":
280
- case "top":
281
- case "topTrailing":
282
- verticalAnchor = "top";
283
- break;
284
- case "bottomLeading":
285
- case "bottom":
286
- case "bottomTrailing":
287
- verticalAnchor = "bottom";
288
- break;
289
- default:
290
- verticalAnchor = "center";
291
- break;
292
- }
293
- const x =
294
- horizontalAnchor === "leading"
295
- ? 0
296
- : horizontalAnchor === "trailing"
297
- ? screenLayout.width - screenWidth
298
- : (screenLayout.width - screenWidth) / 2;
70
+ const verticalAnchor =
71
+ anchor === "bottomLeading" ||
72
+ anchor === "bottom" ||
73
+ anchor === "bottomTrailing"
74
+ ? "bottom"
75
+ : anchor === "center" || anchor === "leading" || anchor === "trailing"
76
+ ? "center"
77
+ : "top";
299
78
  const y =
300
79
  verticalAnchor === "top"
301
80
  ? 0
@@ -304,158 +83,27 @@ const getZoomContentTarget = ({
304
83
  : (screenLayout.height - height) / 2;
305
84
 
306
85
  return {
307
- x,
86
+ x: 0,
308
87
  y,
309
- pageX: x,
88
+ pageX: 0,
310
89
  pageY: y,
311
90
  width: screenWidth,
312
91
  height,
313
92
  };
314
93
  };
315
94
 
316
- const getStyleRadius = (
317
- styles: StyleProps | null,
318
- property:
319
- | "borderRadius"
320
- | "borderTopLeftRadius"
321
- | "borderTopRightRadius"
322
- | "borderBottomLeftRadius"
323
- | "borderBottomRightRadius",
324
- ): number | undefined => {
325
- "worklet";
326
- if (!styles || typeof styles !== "object") return undefined;
327
-
328
- const styleRecord = styles as Record<string, unknown>;
329
- const direct = styleRecord[property];
330
- if (typeof direct === "number") return direct;
331
-
332
- if (property !== "borderRadius") {
333
- const fallback = styleRecord.borderRadius;
334
- if (typeof fallback === "number") return fallback;
335
- }
336
-
337
- return undefined;
338
- };
339
-
340
- const resolveRadiusRange = ({
341
- value,
342
- progress,
343
- sourceRadius,
344
- destinationRadius,
345
- fallback,
346
- }: {
347
- value: ZoomRadiusValue | undefined;
348
- progress: number;
349
- sourceRadius?: number;
350
- destinationRadius?: number;
351
- fallback: number;
352
- }): number => {
353
- "worklet";
354
-
355
- if (typeof value === "number") return value;
356
-
357
- if (value === "auto") {
358
- const from = sourceRadius ?? fallback;
359
- const to = destinationRadius ?? fallback;
360
- return interpolate(progress, [0, 1], [from, to], "clamp");
361
- }
362
-
363
- if (value && typeof value === "object") {
364
- const from = typeof value.from === "number" ? value.from : fallback;
365
- const to = typeof value.to === "number" ? value.to : fallback;
366
- return interpolate(progress, [0, 1], [from, to], "clamp");
367
- }
368
-
369
- const from = sourceRadius ?? fallback;
370
- const to = destinationRadius ?? fallback;
371
- return interpolate(progress, [0, 1], [from, to], "clamp");
372
- };
373
-
374
- const resolveMaskRadii = ({
375
- progress,
376
- zoomOptions,
377
- resolvedPair,
378
- }: {
379
- progress: number;
380
- zoomOptions: ResolvedZoomOptions;
381
- resolvedPair: ResolvedTransitionPair;
382
- }) => {
383
- "worklet";
384
- const sourceStyles = resolvedPair.sourceStyles;
385
- const destinationStyles = resolvedPair.destinationStyles;
386
-
387
- const defaultRadius = resolveRadiusRange({
388
- value: zoomOptions.mask.borderRadius,
389
- progress,
390
- sourceRadius: getStyleRadius(sourceStyles, "borderRadius"),
391
- destinationRadius: getStyleRadius(destinationStyles, "borderRadius"),
392
- fallback: 12,
393
- });
394
-
395
- const topLeftValue =
396
- zoomOptions.mask.borderTopLeftRadius ?? zoomOptions.mask.borderRadius;
397
- const topRightValue =
398
- zoomOptions.mask.borderTopRightRadius ?? zoomOptions.mask.borderRadius;
399
- const bottomLeftValue =
400
- zoomOptions.mask.borderBottomLeftRadius ?? zoomOptions.mask.borderRadius;
401
- const bottomRightValue =
402
- zoomOptions.mask.borderBottomRightRadius ?? zoomOptions.mask.borderRadius;
403
-
404
- return {
405
- borderRadius: defaultRadius,
406
- borderTopLeftRadius: resolveRadiusRange({
407
- value: topLeftValue,
408
- progress,
409
- sourceRadius: getStyleRadius(sourceStyles, "borderTopLeftRadius"),
410
- destinationRadius: getStyleRadius(
411
- destinationStyles,
412
- "borderTopLeftRadius",
413
- ),
414
- fallback: defaultRadius,
415
- }),
416
- borderTopRightRadius: resolveRadiusRange({
417
- value: topRightValue,
418
- progress,
419
- sourceRadius: getStyleRadius(sourceStyles, "borderTopRightRadius"),
420
- destinationRadius: getStyleRadius(
421
- destinationStyles,
422
- "borderTopRightRadius",
423
- ),
424
- fallback: defaultRadius,
425
- }),
426
- borderBottomLeftRadius: resolveRadiusRange({
427
- value: bottomLeftValue,
428
- progress,
429
- sourceRadius: getStyleRadius(sourceStyles, "borderBottomLeftRadius"),
430
- destinationRadius: getStyleRadius(
431
- destinationStyles,
432
- "borderBottomLeftRadius",
433
- ),
434
- fallback: defaultRadius,
435
- }),
436
- borderBottomRightRadius: resolveRadiusRange({
437
- value: bottomRightValue,
438
- progress,
439
- sourceRadius: getStyleRadius(sourceStyles, "borderBottomRightRadius"),
440
- destinationRadius: getStyleRadius(
441
- destinationStyles,
442
- "borderBottomRightRadius",
443
- ),
444
- fallback: defaultRadius,
445
- }),
446
- };
447
- };
448
-
449
95
  export const buildZoomStyles = ({
450
- id,
451
- group,
96
+ resolvedTag,
452
97
  zoomOptions,
453
98
  props,
454
- resolveTag,
455
- computeRaw,
456
- }: BuildZoomStylesParams): ReturnType<ScreenStyleInterpolator> => {
99
+ }: BuildZoomStylesParams): ZoomInterpolatedStyle => {
457
100
  "worklet";
458
101
 
102
+ if (!resolvedTag) return {};
103
+
104
+ const explicitTarget = zoomOptions?.target;
105
+ const debug = zoomOptions?.DEBUG === true;
106
+
459
107
  const focused = props.focused;
460
108
  const progress = props.progress;
461
109
  const currentRouteKey = props.current?.route.key;
@@ -463,43 +111,44 @@ export const buildZoomStyles = ({
463
111
  const nextRouteKey = props.next?.route.key;
464
112
  const entering = !props.next;
465
113
  const screenLayout = props.layouts.screen;
466
- const transitionContext = {
114
+ const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
115
+ const zoomComputeParams = {
116
+ id: resolvedTag,
117
+ previous: props.previous,
118
+ current: props.current,
119
+ next: props.next,
120
+ progress,
121
+ dimensions: screenLayout,
122
+ } as const;
123
+ const baseRawOptions = {
124
+ id: resolvedTag,
125
+ raw: true,
126
+ scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
127
+ } as const;
128
+
129
+ const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
467
130
  currentScreenKey: currentRouteKey,
468
131
  previousScreenKey: previousRouteKey,
469
132
  nextScreenKey: nextRouteKey,
470
133
  entering,
471
- };
472
-
473
- const resolvedConfig = resolveZoomConfig({
474
- id,
475
- group,
476
- zoomOptions,
477
- currentRouteKey,
478
- resolveTag,
479
- defaultAnchor: "top",
480
134
  });
481
135
 
482
- if (!resolvedConfig) return null;
483
-
484
- const {
485
- resolvedTag,
486
- sharedOptions,
487
- explicitTarget,
488
- zoomOptions: resolvedZoomOptions,
489
- } = resolvedConfig;
490
-
491
- const resolvedPair = BoundStore.resolveTransitionPair(
492
- resolvedTag,
493
- transitionContext,
494
- );
136
+ const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
137
+ const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
495
138
 
496
139
  const focusedVisibilityStyles = {
497
140
  [resolvedTag]: VISIBLE_STYLE,
498
141
  } satisfies TransitionInterpolatedStyle;
499
-
500
- if (!resolvedPair.sourceBounds) {
142
+ const focusedContainerStyleId = props.navigationMaskEnabled
143
+ ? NAVIGATION_MASK_CONTAINER_STYLE_ID
144
+ : "content";
145
+
146
+ // To avoid initial flickering, we'll want to hide if there are no source bounds
147
+ // But to also avoid scenarios where activeId changes in dst and theres a failed measurement,
148
+ // we should only hide if entering and there is no source bounds.
149
+ if (!resolvedPair.sourceBounds && props.active.entering) {
501
150
  return {
502
- [NAVIGATION_MASK_CONTAINER_STYLE_ID]: HIDDEN_STYLE,
151
+ [focusedContainerStyleId]: HIDDEN_STYLE,
503
152
  };
504
153
  }
505
154
 
@@ -509,12 +158,12 @@ export const buildZoomStyles = ({
509
158
  const dragX = normalizedToTranslation({
510
159
  normalized: normX,
511
160
  dimension: screenLayout.width,
512
- resistance: resolvedZoomOptions.motion.dragResistance,
161
+ resistance: ZOOM_DRAG_RESISTANCE,
513
162
  });
514
163
  const dragY = normalizedToTranslation({
515
164
  normalized: normY,
516
165
  dimension: screenLayout.height,
517
- resistance: resolvedZoomOptions.motion.dragResistance,
166
+ resistance: ZOOM_DRAG_RESISTANCE,
518
167
  });
519
168
  const dragXScale =
520
169
  initialDirection === "horizontal" ||
@@ -525,8 +174,8 @@ export const buildZoomStyles = ({
525
174
  initialDirection === "horizontal-inverted"
526
175
  ? "negative"
527
176
  : "positive",
528
- shrinkMin: resolvedZoomOptions.motion.dragDirectionalScaleMin,
529
- growMax: resolvedZoomOptions.motion.dragDirectionalScaleMax,
177
+ shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
178
+ growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
530
179
  exponent: 2,
531
180
  })
532
181
  : IDENTITY_DRAG_SCALE_OUTPUT[0];
@@ -536,8 +185,8 @@ export const buildZoomStyles = ({
536
185
  normalized: normY,
537
186
  dismissDirection:
538
187
  initialDirection === "vertical-inverted" ? "negative" : "positive",
539
- shrinkMin: resolvedZoomOptions.motion.dragDirectionalScaleMin,
540
- growMax: resolvedZoomOptions.motion.dragDirectionalScaleMax,
188
+ shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
189
+ growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
541
190
  exponent: 2,
542
191
  })
543
192
  : IDENTITY_DRAG_SCALE_OUTPUT[1];
@@ -546,33 +195,51 @@ export const buildZoomStyles = ({
546
195
  if (focused) {
547
196
  const contentTarget = getZoomContentTarget({
548
197
  explicitTarget,
549
- resolvedTag,
550
- currentRouteKey,
551
- previousRouteKey,
552
- nextRouteKey,
553
- entering,
554
198
  screenLayout,
555
- anchor: sharedOptions.anchor,
199
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
556
200
  resolvedPair,
557
201
  });
558
202
 
559
- const contentRaw = computeRaw({
560
- ...sharedOptions,
561
- method: "content",
562
- target: contentTarget,
563
- });
564
-
565
- const maskRaw = computeRaw({
566
- ...sharedOptions,
567
- method: "size",
568
- space: "absolute",
569
- target: "fullscreen",
570
- });
203
+ const contentRaw = computeBoundStyles(
204
+ zoomComputeParams,
205
+ {
206
+ ...baseRawOptions,
207
+ anchor: resolvedZoomAnchor,
208
+ method: "content",
209
+ target: contentTarget,
210
+ },
211
+ resolvedPair,
212
+ ) as Record<string, unknown>;
213
+
214
+ const maskRaw = computeBoundStyles(
215
+ zoomComputeParams,
216
+ {
217
+ ...baseRawOptions,
218
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
219
+ method: "size",
220
+ space: "absolute",
221
+ target: "fullscreen",
222
+ },
223
+ resolvedPair,
224
+ ) as Record<string, unknown>;
571
225
 
572
226
  const focusedFade = props.active?.closing
573
- ? interpolate(progress, [0.6, 1], [0, 1], "clamp")
574
- : interpolate(progress, [0, 0.5], [0, 1], "clamp");
575
- const { top, right, bottom, left } = resolvedZoomOptions.mask.outset;
227
+ ? interpolate(progress, [0.6, 1], [0, debug ? 0.5 : 1], "clamp")
228
+ : interpolate(progress, [0, 0.5], [0, debug ? 0.5 : 1], "clamp");
229
+
230
+ /**
231
+ * This is also how swiftui handles their navigation zoom.
232
+ * They remove clipping as soon as the screen stops animating
233
+ */
234
+ const shouldRemoveClipping = !props.active.animating;
235
+ const focusedMaskBorderRadius = interpolate(
236
+ progress,
237
+ [0, 1],
238
+ [sourceBorderRadius, shouldRemoveClipping ? 0 : targetBorderRadius],
239
+ "clamp",
240
+ );
241
+
242
+ const { top, right, bottom, left } = ZOOM_MASK_OUTSET;
576
243
  const maskWidth = Math.max(1, toNumber(maskRaw.width) + left + right);
577
244
  const maskHeight = Math.max(1, toNumber(maskRaw.height) + top + bottom);
578
245
  const contentTranslateX = toNumber(contentRaw.translateX) + dragX;
@@ -580,11 +247,6 @@ export const buildZoomStyles = ({
580
247
  const contentScale = toNumber(contentRaw.scale, 1) * dragScale;
581
248
  const maskTranslateX = toNumber(maskRaw.translateX) + dragX - left;
582
249
  const maskTranslateY = toNumber(maskRaw.translateY) + dragY - top;
583
- const maskRadii = resolveMaskRadii({
584
- progress,
585
- zoomOptions: resolvedZoomOptions,
586
- resolvedPair,
587
- });
588
250
  const focusedContentStyle = {
589
251
  opacity: focusedFade,
590
252
  transform: [
@@ -592,83 +254,99 @@ export const buildZoomStyles = ({
592
254
  { translateY: contentTranslateY },
593
255
  { scale: contentScale },
594
256
  ],
257
+ borderRadius: focusedMaskBorderRadius,
258
+ overflow: "hidden" as const,
595
259
  };
596
260
 
597
- return {
598
- [NAVIGATION_MASK_CONTAINER_STYLE_ID]: {
261
+ const focusedStyles: ZoomInterpolatedStyle = {
262
+ [focusedContainerStyleId]: {
599
263
  style: focusedContentStyle,
600
264
  },
601
- [NAVIGATION_MASK_ELEMENT_STYLE_ID]: {
265
+ ...focusedVisibilityStyles,
266
+ };
267
+
268
+ if (props.navigationMaskEnabled) {
269
+ focusedStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] = {
602
270
  style: {
603
271
  width: maskWidth,
604
272
  height: maskHeight,
273
+ borderRadius: focusedMaskBorderRadius,
605
274
  transform: [
606
275
  { translateX: maskTranslateX },
607
276
  { translateY: maskTranslateY },
608
277
  { scale: dragScale },
609
278
  ],
610
- borderRadius: maskRadii.borderRadius,
611
- borderTopLeftRadius: maskRadii.borderTopLeftRadius,
612
- borderTopRightRadius: maskRadii.borderTopRightRadius,
613
- borderBottomLeftRadius: maskRadii.borderBottomLeftRadius,
614
- borderBottomRightRadius: maskRadii.borderBottomRightRadius,
615
- ...(resolvedZoomOptions.mask.borderCurve
616
- ? { borderCurve: resolvedZoomOptions.mask.borderCurve }
617
- : {}),
618
279
  },
619
- },
620
- ...focusedVisibilityStyles,
621
- };
280
+ };
281
+ }
282
+
283
+ return focusedStyles;
622
284
  }
623
285
 
624
286
  const unfocusedFade = props.active?.closing
625
- ? interpolate(progress, [1.6, 2], [1, 0], "clamp")
626
- : interpolate(progress, [1, 1.5], [1, 0], "clamp");
287
+ ? interpolate(progress, [1.6, 2], [1, debug ? 1 : 0], "clamp")
288
+ : interpolate(progress, [1, 1.5], [1, debug ? 1 : 0], "clamp");
289
+
627
290
  const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
628
291
  const isUnfocusedIdle = props.active.settled === 1;
629
-
292
+ const shouldHideUnfocusedIdle = isUnfocusedIdle && !debug;
630
293
  const elementTarget =
631
- sharedOptions.scaleMode === "match"
632
- ? ("fullscreen" as const)
633
- : getZoomContentTarget({
294
+ explicitTarget !== undefined || resolvedPair.destinationBounds
295
+ ? getZoomContentTarget({
634
296
  explicitTarget,
635
- resolvedTag,
636
- currentRouteKey,
637
- previousRouteKey,
638
- nextRouteKey,
639
- entering,
640
297
  screenLayout,
641
- anchor: sharedOptions.anchor,
298
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
642
299
  resolvedPair,
643
- });
644
-
645
- const elementRaw = computeRaw({
646
- ...sharedOptions,
647
- method: "transform",
648
- space: "relative",
649
- target: elementTarget,
650
- });
651
-
652
- // Keep compensation tied to the element target's center. In `scaleMode: "match"`
653
- // this target is fullscreen, so the center offset should resolve to zero.
300
+ })
301
+ : ("fullscreen" as const);
302
+
303
+ const elementRaw = computeBoundStyles(
304
+ zoomComputeParams,
305
+ {
306
+ ...baseRawOptions,
307
+ anchor: resolvedZoomAnchor,
308
+ method: "transform",
309
+ space: "relative",
310
+ target: elementTarget,
311
+ },
312
+ resolvedPair,
313
+ ) as Record<string, unknown>;
314
+ const boundTargetCenterX =
315
+ explicitTarget === "bound" && resolvedPair.destinationBounds
316
+ ? resolvedPair.destinationBounds.pageX +
317
+ resolvedPair.destinationBounds.width / 2
318
+ : undefined;
319
+ const boundTargetCenterY =
320
+ explicitTarget === "bound" && resolvedPair.destinationBounds
321
+ ? resolvedPair.destinationBounds.pageY +
322
+ resolvedPair.destinationBounds.height / 2
323
+ : undefined;
324
+ const elementCenterX =
325
+ boundTargetCenterX ??
326
+ (typeof elementTarget === "object"
327
+ ? elementTarget.pageX + elementTarget.width / 2
328
+ : screenLayout.width / 2);
654
329
  const elementCenterY =
655
- typeof elementTarget === "object"
330
+ boundTargetCenterY ??
331
+ (typeof elementTarget === "object"
656
332
  ? elementTarget.pageY + elementTarget.height / 2
657
- : screenLayout.height / 2;
658
-
333
+ : screenLayout.height / 2);
334
+ const scaleShiftX = computeCenterScaleShift({
335
+ center: elementCenterX,
336
+ containerCenter: screenLayout.width / 2,
337
+ scale: dragScale,
338
+ });
659
339
  const scaleShiftY = computeCenterScaleShift({
660
340
  center: elementCenterY,
661
341
  containerCenter: screenLayout.height / 2,
662
342
  scale: dragScale,
663
343
  });
664
-
665
344
  const compensatedGestureX = composeCompensatedTranslation({
666
345
  gesture: dragX,
667
346
  parentScale: unfocusedScale,
347
+ centerShift: scaleShiftX,
668
348
  epsilon: EPSILON,
669
349
  });
670
- // dragY is measured in screen space and must be unscaled by the parent
671
- // content shrink, while scaleShiftY is already in the parent's local space.
672
350
  const compensatedGestureY = composeCompensatedTranslation({
673
351
  gesture: dragY,
674
352
  parentScale: unfocusedScale,
@@ -681,8 +359,7 @@ export const buildZoomStyles = ({
681
359
  toNumber(elementRaw.translateY) + compensatedGestureY;
682
360
  const elementScaleX = toNumber(elementRaw.scaleX, 1) * dragScale;
683
361
  const elementScaleY = toNumber(elementRaw.scaleY, 1) * dragScale;
684
-
685
- const resolvedElementStyle = isUnfocusedIdle
362
+ const resolvedElementStyle = shouldHideUnfocusedIdle
686
363
  ? {
687
364
  transform: [
688
365
  { translateX: 0 },
@@ -696,12 +373,12 @@ export const buildZoomStyles = ({
696
373
  }
697
374
  : {
698
375
  transform: [
699
- { translateX: elementTranslateX },
700
- { translateY: elementTranslateY },
701
- { scaleX: elementScaleX },
702
- { scaleY: elementScaleY },
376
+ { translateX: props.active.settled ? 0 : elementTranslateX },
377
+ { translateY: props.active.settled ? 0 : elementTranslateY },
378
+ { scaleX: props.active.settled ? 1 : elementScaleX },
379
+ { scaleY: props.active.settled ? 1 : elementScaleY },
703
380
  ],
704
- opacity: unfocusedFade,
381
+ opacity: debug ? 1 : unfocusedFade,
705
382
  zIndex: 9999,
706
383
  elevation: 9999,
707
384
  };