react-native-screen-transitions 3.4.0-alpha.7 → 3.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  2. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +22 -60
  4. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +56 -41
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +111 -2
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +69 -0
  16. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  17. package/lib/commonjs/shared/components/create-boundary-component/index.js +10 -5
  18. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  19. package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -32
  20. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  21. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  22. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  23. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +7 -5
  24. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  25. package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
  26. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  27. package/lib/commonjs/shared/constants.js +17 -3
  28. package/lib/commonjs/shared/constants.js.map +1 -1
  29. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
  30. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  31. package/lib/commonjs/shared/index.js +6 -0
  32. package/lib/commonjs/shared/index.js.map +1 -1
  33. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
  34. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  35. package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
  36. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  38. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  40. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  41. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +1 -11
  42. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  43. package/lib/commonjs/shared/stores/animation.store.js +9 -3
  44. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  45. package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
  46. package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
  47. package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
  48. package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
  49. package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -7
  50. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  51. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -51
  52. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  53. package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
  54. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  55. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
  56. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  57. package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
  58. package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
  59. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  60. package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
  61. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  62. package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  63. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  64. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
  65. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  66. package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  67. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  68. package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +14 -20
  69. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  70. package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  71. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  72. package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  73. package/lib/commonjs/shared/utils/bounds/index.js +16 -44
  74. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  75. package/lib/commonjs/shared/utils/bounds/zoom/build.js +234 -50
  76. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  77. package/lib/commonjs/shared/utils/bounds/zoom/config.js +10 -1
  78. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  79. package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
  80. package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
  81. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  82. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  83. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +23 -61
  84. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  85. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  86. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  87. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +54 -39
  88. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  89. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  90. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  91. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  92. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  93. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +114 -4
  94. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  95. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +64 -0
  96. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  97. package/lib/module/shared/components/create-boundary-component/index.js +10 -5
  98. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  99. package/lib/module/shared/components/create-transition-aware-component.js +10 -34
  100. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  101. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  102. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  103. package/lib/module/shared/components/screen-container/layers/backdrop.js +7 -5
  104. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  105. package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
  106. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  107. package/lib/module/shared/constants.js +16 -2
  108. package/lib/module/shared/constants.js.map +1 -1
  109. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
  110. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  111. package/lib/module/shared/index.js +1 -1
  112. package/lib/module/shared/index.js.map +1 -1
  113. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
  114. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  115. package/lib/module/shared/providers/register-bounds.provider.js +9 -1
  116. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  117. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  118. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  119. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  120. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  121. package/lib/module/shared/providers/screen/styles/styles.provider.js +1 -11
  122. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  123. package/lib/module/shared/stores/animation.store.js +9 -3
  124. package/lib/module/shared/stores/animation.store.js.map +1 -1
  125. package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
  126. package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
  127. package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
  128. package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
  129. package/lib/module/shared/stores/bounds/internals/registry.js +19 -8
  130. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  131. package/lib/module/shared/stores/bounds/internals/resolver.js +8 -52
  132. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  133. package/lib/module/shared/stores/bounds/internals/state.js +0 -78
  134. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  135. package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
  136. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  137. package/lib/module/shared/utils/bounds/constants.js.map +1 -0
  138. package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
  139. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  140. package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
  141. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  142. package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  143. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  144. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
  145. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  146. package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  147. package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  148. package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +12 -18
  149. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  150. package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  151. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  152. package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  153. package/lib/module/shared/utils/bounds/index.js +14 -42
  154. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  155. package/lib/module/shared/utils/bounds/zoom/build.js +238 -54
  156. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  157. package/lib/module/shared/utils/bounds/zoom/config.js +9 -0
  158. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  159. package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
  160. package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
  161. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
  162. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  163. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  164. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +17 -11
  165. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  166. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
  167. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
  168. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +1 -2
  169. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  170. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +20 -1
  171. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  172. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts +12 -0
  173. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
  174. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +10 -4
  175. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  176. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
  177. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  178. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  179. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  180. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  181. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  182. package/lib/typescript/shared/constants.d.ts +33 -1
  183. package/lib/typescript/shared/constants.d.ts.map +1 -1
  184. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
  185. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
  186. package/lib/typescript/shared/index.d.ts +3 -3
  187. package/lib/typescript/shared/index.d.ts.map +1 -1
  188. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  189. package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
  190. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  191. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
  192. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
  193. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
  194. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  195. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
  196. package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
  197. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  198. package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
  199. package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
  200. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  201. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  202. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
  203. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  204. package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
  205. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  206. package/lib/typescript/shared/types/animation.types.d.ts +11 -0
  207. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  208. package/lib/typescript/shared/types/bounds.types.d.ts +106 -1
  209. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  210. package/lib/typescript/shared/types/index.d.ts +1 -1
  211. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  212. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
  213. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  214. package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
  215. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
  216. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
  217. package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
  218. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
  219. package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
  220. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
  221. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
  222. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
  223. package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
  224. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
  225. package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
  226. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
  227. package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
  228. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
  229. package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
  230. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  231. package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
  232. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  233. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  234. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +9 -0
  235. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  236. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
  237. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
  238. package/package.json +1 -1
  239. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +6 -4
  240. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +28 -60
  241. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
  242. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +72 -53
  243. package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
  244. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +5 -34
  245. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +180 -6
  246. package/src/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.ts +110 -0
  247. package/src/shared/components/create-boundary-component/index.tsx +10 -5
  248. package/src/shared/components/create-boundary-component/types.ts +1 -2
  249. package/src/shared/components/create-transition-aware-component.tsx +10 -47
  250. package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
  251. package/src/shared/components/screen-container/layers/backdrop.tsx +6 -9
  252. package/src/shared/components/screen-lifecycle/index.tsx +1 -4
  253. package/src/shared/constants.ts +11 -1
  254. package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
  255. package/src/shared/index.ts +3 -0
  256. package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
  257. package/src/shared/providers/register-bounds.provider.tsx +8 -1
  258. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
  259. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
  260. package/src/shared/providers/screen/styles/styles.provider.tsx +1 -12
  261. package/src/shared/stores/animation.store.ts +11 -2
  262. package/src/shared/stores/bounds/internals/clear.ts +47 -220
  263. package/src/shared/stores/bounds/internals/presence.ts +1 -4
  264. package/src/shared/stores/bounds/internals/registry.ts +25 -14
  265. package/src/shared/stores/bounds/internals/resolver.ts +7 -84
  266. package/src/shared/stores/bounds/internals/state.ts +0 -98
  267. package/src/shared/stores/bounds/types.ts +0 -2
  268. package/src/shared/types/animation.types.ts +13 -0
  269. package/src/shared/types/bounds.types.ts +108 -1
  270. package/src/shared/types/index.ts +2 -0
  271. package/src/shared/utils/animation/animate-to-progress.ts +11 -1
  272. package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
  273. package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
  274. package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
  275. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
  276. package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
  277. package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +10 -20
  278. package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
  279. package/src/shared/utils/bounds/index.ts +13 -53
  280. package/src/shared/utils/bounds/types/options.ts +3 -2
  281. package/src/shared/utils/bounds/zoom/build.ts +316 -95
  282. package/src/shared/utils/bounds/zoom/config.ts +11 -0
  283. package/src/shared/utils/bounds/zoom/math.ts +57 -0
  284. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
  285. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  286. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
  287. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  288. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
  289. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  290. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
  291. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  292. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -58
  293. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  294. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
  295. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  296. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
  297. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  298. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  299. package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
  300. package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  301. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
  302. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  303. package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  304. package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  305. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  306. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  307. package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
  308. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
  309. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  310. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
  311. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  312. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
  313. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  314. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
  315. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  316. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -53
  317. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  318. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
  319. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  320. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
  321. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  322. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  323. package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
  324. package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  325. package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
  326. package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  327. package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  328. package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  329. package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  330. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  331. package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
  332. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
  333. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
  334. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
  335. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
  336. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
  337. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
  338. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
  339. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
  340. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -11
  341. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
  342. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
  343. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
  344. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
  345. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
  346. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
  347. package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
  348. package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
  349. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
  350. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
  351. package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
  352. package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
  353. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
  354. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
  355. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
  356. package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
  357. package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
  358. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
  359. package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
  360. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
  361. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -87
  362. package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
  363. package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
  364. package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
  365. /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  366. /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  367. /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  368. /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  369. /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
  370. /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
  371. /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
  372. /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
@@ -1,7 +1,6 @@
1
- import { interpolate } from "react-native-reanimated";
1
+ import { interpolate, makeMutable } from "react-native-reanimated";
2
2
  import {
3
3
  EPSILON,
4
- HIDDEN_STYLE,
5
4
  NAVIGATION_MASK_CONTAINER_STYLE_ID,
6
5
  NAVIGATION_MASK_ELEMENT_STYLE_ID,
7
6
  VISIBLE_STYLE,
@@ -12,27 +11,38 @@ import {
12
11
  } from "../../../stores/bounds";
13
12
  import type { TransitionInterpolatedStyle } from "../../../types/animation.types";
14
13
  import type { Layout } from "../../../types/screen.types";
15
- import { computeBoundStyles } from "../helpers/compute-bounds-styles";
14
+ import { prepareBoundStyles } from "../helpers/prepare-bound-styles";
16
15
  import type { BoundsOptions } from "../types/options";
17
16
  import {
18
17
  getZoomAnchor,
19
18
  toNumber,
19
+ ZOOM_BACKGROUND_SCALE,
20
+ ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
20
21
  ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
21
22
  ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
22
23
  ZOOM_DRAG_RESISTANCE,
24
+ ZOOM_DRAG_TRANSLATION_EXPONENT,
25
+ ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX,
26
+ ZOOM_DRAG_TRANSLATION_POSITIVE_MAX,
27
+ ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
28
+ ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
23
29
  ZOOM_MASK_OUTSET,
24
30
  ZOOM_SHARED_OPTIONS,
31
+ ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
32
+ ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
25
33
  } from "./config";
26
34
  import {
27
35
  combineScales,
28
36
  composeCompensatedTranslation,
29
37
  computeCenterScaleShift,
30
- normalizedToTranslation,
31
38
  resolveDirectionalDragScale,
39
+ resolveDirectionalDragTranslation,
40
+ resolveOpacityRangeTuple,
32
41
  } from "./math";
33
42
  import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
34
43
 
35
44
  const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
45
+ const presentedZoomTagByRoute = makeMutable<Record<string, string>>({});
36
46
 
37
47
  /* -------------------------------------------------------------------------- */
38
48
  /* LOCAL HELPERS */
@@ -94,6 +104,119 @@ function getZoomContentTarget({
94
104
  };
95
105
  }
96
106
 
107
+ function resolveDragScaleTuple(
108
+ value:
109
+ | readonly [shrinkMin: number, growMax: number, exponent?: number]
110
+ | undefined,
111
+ ) {
112
+ "worklet";
113
+
114
+ return {
115
+ shrinkMin: value?.[0] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
116
+ growMax: value?.[1] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
117
+ exponent: value?.[2] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
118
+ };
119
+ }
120
+
121
+ function resolveDragTranslationTuple(
122
+ value:
123
+ | readonly [negativeMax: number, positiveMax: number, exponent?: number]
124
+ | undefined,
125
+ ) {
126
+ "worklet";
127
+
128
+ return {
129
+ negativeMax: value?.[0] ?? ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX,
130
+ positiveMax: value?.[1] ?? ZOOM_DRAG_TRANSLATION_POSITIVE_MAX,
131
+ exponent: value?.[2] ?? ZOOM_DRAG_TRANSLATION_EXPONENT,
132
+ };
133
+ }
134
+
135
+ function resolveBackgroundScale(value: number | undefined) {
136
+ "worklet";
137
+
138
+ return value ?? ZOOM_BACKGROUND_SCALE;
139
+ }
140
+
141
+ function interpolateOpacityRange(params: {
142
+ progress: number;
143
+ range: {
144
+ inputStart: number;
145
+ inputEnd: number;
146
+ outputStart: number;
147
+ outputEnd: number;
148
+ };
149
+ }) {
150
+ "worklet";
151
+
152
+ const { progress, range } = params;
153
+
154
+ return interpolate(
155
+ progress,
156
+ [range.inputStart, range.inputEnd],
157
+ [range.outputStart, range.outputEnd],
158
+ "clamp",
159
+ );
160
+ }
161
+
162
+ function resolveEffectiveZoomTag(params: {
163
+ resolvedTag: string;
164
+ activeRouteKey?: string;
165
+ entering: boolean;
166
+ animating: boolean;
167
+ activeProgress: number;
168
+ livePairReady: boolean;
169
+ }) {
170
+ "worklet";
171
+
172
+ const {
173
+ resolvedTag,
174
+ activeRouteKey,
175
+ entering,
176
+ animating,
177
+ activeProgress,
178
+ livePairReady,
179
+ } = params;
180
+
181
+ // Only grouped ids need retarget stabilization. Plain ids should keep their
182
+ // normal behavior with no route-level caching.
183
+ if (!activeRouteKey || !resolvedTag.includes(":")) {
184
+ return resolvedTag;
185
+ }
186
+
187
+ const cachedTag = presentedZoomTagByRoute.value[activeRouteKey];
188
+ const isFreshOpenFrame = entering && activeProgress <= 0.05;
189
+ const shouldFreezeDuringEnter = entering && animating && !isFreshOpenFrame;
190
+
191
+ if (!cachedTag || isFreshOpenFrame) {
192
+ presentedZoomTagByRoute.modify((state) => ({
193
+ ...state,
194
+ [activeRouteKey]: resolvedTag,
195
+ }));
196
+ return resolvedTag;
197
+ }
198
+
199
+ if (shouldFreezeDuringEnter) {
200
+ return cachedTag;
201
+ }
202
+
203
+ // After the enter animation, grouped retargeting can still briefly point at a
204
+ // new active id before that tag has usable bounds. Keep presenting the last
205
+ // good tag until the next one is transition-ready.
206
+ if (cachedTag !== resolvedTag && !livePairReady) {
207
+ return cachedTag;
208
+ }
209
+
210
+ if (cachedTag !== resolvedTag) {
211
+ presentedZoomTagByRoute.modify((state) => ({
212
+ ...state,
213
+ [activeRouteKey]: resolvedTag,
214
+ }));
215
+ }
216
+
217
+ return resolvedTag;
218
+ }
219
+
97
220
  /* -------------------------------------------------------------------------- */
98
221
  /* BUILD ZOOM STYLES */
99
222
  /* -------------------------------------------------------------------------- */
@@ -110,56 +233,129 @@ export function buildZoomStyles({
110
233
  /* ------------------------------ Shared Setup ------------------------------ */
111
234
 
112
235
  const explicitTarget = zoomOptions?.target;
113
- const debug = zoomOptions?.DEBUG === true;
114
236
  const focused = props.focused;
115
237
  const progress = props.progress;
116
238
  const screenLayout = props.layouts.screen;
117
239
  const isEnteringTransition = !props.next;
240
+ const activeRouteKey = props.active.route.key;
118
241
  const currentRouteKey = props.current?.route.key;
119
242
  const previousRouteKey = props.previous?.route.key;
120
243
  const nextRouteKey = props.next?.route.key;
121
244
  const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
122
-
123
- const zoomComputeParams = {
124
- id: resolvedTag,
125
- previous: props.previous,
126
- current: props.current,
127
- next: props.next,
128
- progress,
129
- dimensions: screenLayout,
130
- } as const;
245
+ const liveResolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
246
+ currentScreenKey: currentRouteKey,
247
+ previousScreenKey: previousRouteKey,
248
+ nextScreenKey: nextRouteKey,
249
+ entering: isEnteringTransition,
250
+ });
251
+ const effectiveTag = resolveEffectiveZoomTag({
252
+ resolvedTag,
253
+ activeRouteKey,
254
+ entering: !!props.active.entering,
255
+ animating: !!props.active.animating,
256
+ activeProgress: props.active.progress,
257
+ livePairReady: !!liveResolvedPair.sourceBounds,
258
+ });
131
259
 
132
260
  const baseRawOptions = {
133
- id: resolvedTag,
261
+ id: effectiveTag,
134
262
  raw: true,
135
263
  scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
136
264
  } as const;
137
265
 
138
- const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
139
- currentScreenKey: currentRouteKey,
140
- previousScreenKey: previousRouteKey,
141
- nextScreenKey: nextRouteKey,
142
- entering: isEnteringTransition,
143
- });
266
+ const resolvedPair =
267
+ effectiveTag === resolvedTag
268
+ ? liveResolvedPair
269
+ : BoundStore.resolveTransitionPair(effectiveTag, {
270
+ currentScreenKey: currentRouteKey,
271
+ previousScreenKey: previousRouteKey,
272
+ nextScreenKey: nextRouteKey,
273
+ entering: isEnteringTransition,
274
+ });
144
275
 
145
276
  const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
146
277
  const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
278
+ const focusedElementOpacity = {
279
+ open: resolveOpacityRangeTuple({
280
+ value: zoomOptions?.focusedElementOpacity?.open,
281
+ fallback: ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
282
+ }),
283
+ close: resolveOpacityRangeTuple({
284
+ value: zoomOptions?.focusedElementOpacity?.close,
285
+ fallback: ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
286
+ }),
287
+ };
288
+ const unfocusedElementOpacity = {
289
+ open: resolveOpacityRangeTuple({
290
+ value: zoomOptions?.unfocusedElementOpacity?.open,
291
+ fallback: ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE,
292
+ }),
293
+ close: resolveOpacityRangeTuple({
294
+ value: zoomOptions?.unfocusedElementOpacity?.close,
295
+ fallback: ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE,
296
+ }),
297
+ };
147
298
  const sourceVisibilityStyle = {
148
- [resolvedTag]: VISIBLE_STYLE,
299
+ [effectiveTag]: VISIBLE_STYLE,
149
300
  } satisfies TransitionInterpolatedStyle;
150
301
  const focusedContentSlot = props.navigationMaskEnabled
151
302
  ? NAVIGATION_MASK_CONTAINER_STYLE_ID
152
303
  : "content";
153
304
 
305
+ /**
306
+ * Local bounds compute helper for navigation zoom.
307
+ *
308
+ * If you're building a custom transition, prefer the public `bounds()` helper.
309
+ * We keep a local version here so zoom can share the same low-level compute path
310
+ * without re-entering the decorated public accessor.
311
+ */
312
+ const bounds = <T extends BoundsOptions>(options: T) => {
313
+ "worklet";
314
+
315
+ return prepareBoundStyles({
316
+ props,
317
+ options,
318
+ resolvedPair,
319
+ syncGroupActiveId: false,
320
+ });
321
+ };
322
+
154
323
  /* --------------------------- Missing Source Guard -------------------------- */
155
324
 
156
- // To avoid initial flickering, we'll want to hide if there are no source bounds
157
- // But to also avoid scenarios where activeId changes in dst and theres a failed measurement,
158
- // we should only hide if entering and there is no source bounds.
159
- if (!resolvedPair.sourceBounds && props.active.entering) {
160
- return {
161
- [focusedContentSlot]: HIDDEN_STYLE,
325
+ // Only the focused entering route should be hidden when source bounds are
326
+ // missing. During rapid chained pushes, source measurement can briefly race
327
+ // the focused destination. In that case, degrading to a fullscreen destination
328
+ // is safer than blanking the entire screen until another gesture/animation
329
+ // re-runs the pipeline.
330
+ if (focused && !resolvedPair.sourceBounds && props.active.entering) {
331
+ const fallbackStyles: ZoomInterpolatedStyle = {
332
+ [focusedContentSlot]: {
333
+ style: {
334
+ opacity: zoomOptions?.debug ? 0.5 : 1,
335
+ transform: [{ translateX: 0 }, { translateY: 0 }, { scale: 1 }],
336
+ borderRadius: 0,
337
+ overflow: "hidden",
338
+ },
339
+ },
162
340
  };
341
+
342
+ if (props.navigationMaskEnabled) {
343
+ const { top, right, bottom, left } = ZOOM_MASK_OUTSET;
344
+ fallbackStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] = {
345
+ style: {
346
+ width: Math.max(1, screenLayout.width + left + right),
347
+ height: Math.max(1, screenLayout.height + top + bottom),
348
+ borderRadius: 0,
349
+ transform: [
350
+ { translateX: -left },
351
+ { translateY: -top },
352
+ { scale: 1 },
353
+ ],
354
+ },
355
+ };
356
+ }
357
+
358
+ return fallbackStyles;
163
359
  }
164
360
 
165
361
  /* --------------------------- Gesture / Drag Values ------------------------- */
@@ -173,25 +369,44 @@ export function buildZoomStyles({
173
369
  const isVerticalDismiss =
174
370
  initialDirection === "vertical" || initialDirection === "vertical-inverted";
175
371
 
176
- const dragX = normalizedToTranslation({
372
+ const horizontalDragTranslation = resolveDragTranslationTuple(
373
+ zoomOptions?.horizontalDragTranslation,
374
+ );
375
+ const verticalDragTranslation = resolveDragTranslationTuple(
376
+ zoomOptions?.verticalDragTranslation,
377
+ );
378
+ const dragX = resolveDirectionalDragTranslation({
177
379
  normalized: normX,
178
380
  dimension: screenLayout.width,
179
381
  resistance: ZOOM_DRAG_RESISTANCE,
382
+ negativeMax: horizontalDragTranslation.negativeMax,
383
+ positiveMax: horizontalDragTranslation.positiveMax,
384
+ exponent: horizontalDragTranslation.exponent,
180
385
  });
181
- const dragY = normalizedToTranslation({
386
+ const dragY = resolveDirectionalDragTranslation({
182
387
  normalized: normY,
183
388
  dimension: screenLayout.height,
184
389
  resistance: ZOOM_DRAG_RESISTANCE,
390
+ negativeMax: verticalDragTranslation.negativeMax,
391
+ positiveMax: verticalDragTranslation.positiveMax,
392
+ exponent: verticalDragTranslation.exponent,
185
393
  });
394
+ const horizontalDragScale = resolveDragScaleTuple(
395
+ zoomOptions?.horizontalDragScale,
396
+ );
397
+ const verticalDragScale = resolveDragScaleTuple(
398
+ zoomOptions?.verticalDragScale,
399
+ );
400
+ const backgroundScale = resolveBackgroundScale(zoomOptions?.backgroundScale);
186
401
 
187
402
  const dragXScale = isHorizontalDismiss
188
403
  ? resolveDirectionalDragScale({
189
404
  normalized: normX,
190
405
  dismissDirection:
191
406
  initialDirection === "horizontal-inverted" ? "negative" : "positive",
192
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
193
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
194
- exponent: 2,
407
+ shrinkMin: horizontalDragScale.shrinkMin,
408
+ growMax: horizontalDragScale.growMax,
409
+ exponent: horizontalDragScale.exponent,
195
410
  })
196
411
  : IDENTITY_DRAG_SCALE_OUTPUT[0];
197
412
  const dragYScale = isVerticalDismiss
@@ -199,9 +414,9 @@ export function buildZoomStyles({
199
414
  normalized: normY,
200
415
  dismissDirection:
201
416
  initialDirection === "vertical-inverted" ? "negative" : "positive",
202
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
203
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
204
- exponent: 2,
417
+ shrinkMin: verticalDragScale.shrinkMin,
418
+ growMax: verticalDragScale.growMax,
419
+ exponent: verticalDragScale.exponent,
205
420
  })
206
421
  : IDENTITY_DRAG_SCALE_OUTPUT[1];
207
422
  const dragScale = combineScales(dragXScale, dragYScale);
@@ -216,32 +431,30 @@ export function buildZoomStyles({
216
431
  resolvedPair,
217
432
  });
218
433
 
219
- const contentRaw = computeBoundStyles(
220
- zoomComputeParams,
221
- {
222
- ...baseRawOptions,
223
- anchor: resolvedZoomAnchor,
224
- method: "content",
225
- target: focusedContentTarget,
226
- },
227
- resolvedPair,
228
- ) as Record<string, unknown>;
229
-
230
- const maskRaw = computeBoundStyles(
231
- zoomComputeParams,
232
- {
233
- ...baseRawOptions,
234
- anchor: ZOOM_SHARED_OPTIONS.anchor,
235
- method: "size",
236
- space: "absolute",
237
- target: "fullscreen",
238
- },
239
- resolvedPair,
240
- ) as Record<string, unknown>;
434
+ const contentRaw = bounds({
435
+ ...baseRawOptions,
436
+ anchor: resolvedZoomAnchor,
437
+ method: "content",
438
+ target: focusedContentTarget,
439
+ } as const);
440
+
441
+ const maskRaw = bounds({
442
+ ...baseRawOptions,
443
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
444
+ method: "size",
445
+ space: "absolute",
446
+ target: "fullscreen",
447
+ } as const);
241
448
 
242
449
  const focusedFade = props.active?.closing
243
- ? interpolate(progress, [0.6, 1], [0, debug ? 0.5 : 1], "clamp")
244
- : interpolate(progress, [0, 0.5], [0, debug ? 0.5 : 1], "clamp");
450
+ ? interpolateOpacityRange({
451
+ progress,
452
+ range: focusedElementOpacity.close,
453
+ })
454
+ : interpolateOpacityRange({
455
+ progress,
456
+ range: focusedElementOpacity.open,
457
+ });
245
458
 
246
459
  /**
247
460
  * This is also how swiftui handles their navigation zoom.
@@ -265,7 +478,7 @@ export function buildZoomStyles({
265
478
  const maskTranslateY = toNumber(maskRaw.translateY) + dragY - top;
266
479
 
267
480
  const focusedContentStyle = {
268
- opacity: focusedFade,
481
+ opacity: zoomOptions?.debug ? 0.5 : focusedFade,
269
482
  transform: [
270
483
  { translateX: contentTranslateX },
271
484
  { translateY: contentTranslateY },
@@ -303,35 +516,43 @@ export function buildZoomStyles({
303
516
  /* ---------------------------- Unfocused Screen ---------------------------- */
304
517
 
305
518
  const unfocusedFade = props.active?.closing
306
- ? interpolate(progress, [1.6, 2], [1, debug ? 1 : 0], "clamp")
307
- : interpolate(progress, [1, 1.5], [1, debug ? 1 : 0], "clamp");
308
- const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
519
+ ? interpolateOpacityRange({
520
+ progress,
521
+ range: unfocusedElementOpacity.close,
522
+ })
523
+ : interpolateOpacityRange({
524
+ progress,
525
+ range: unfocusedElementOpacity.open,
526
+ });
527
+ const unfocusedScale = interpolate(
528
+ progress,
529
+ [1, 2],
530
+ [1, backgroundScale],
531
+ "clamp",
532
+ );
309
533
  const isUnfocusedIdle = props.active.settled === 1;
310
- const shouldHideUnfocusedIdle = isUnfocusedIdle && !debug;
311
- const shouldFreezeUnfocusedElement =
312
- props.active.logicallySettled && !props.active.closing;
313
-
314
- const unfocusedElementTarget =
315
- explicitTarget !== undefined || resolvedPair.destinationBounds
316
- ? getZoomContentTarget({
317
- explicitTarget,
318
- screenLayout,
319
- anchor: ZOOM_SHARED_OPTIONS.anchor,
320
- resolvedPair,
321
- })
322
- : ("fullscreen" as const);
323
-
324
- const elementRaw = computeBoundStyles(
325
- zoomComputeParams,
326
- {
327
- ...baseRawOptions,
328
- anchor: resolvedZoomAnchor,
329
- method: "transform",
330
- space: "relative",
331
- target: unfocusedElementTarget,
332
- },
534
+ const shouldHideUnfocusedIdle = isUnfocusedIdle;
535
+ const didSourceComponentVisiblyHide =
536
+ !props.active.closing && unfocusedFade <= EPSILON;
537
+
538
+ const shouldResetUnfocusedElement =
539
+ !props.active.closing &&
540
+ (!!props.active.logicallySettled || didSourceComponentVisiblyHide);
541
+
542
+ const unfocusedElementTarget = getZoomContentTarget({
543
+ explicitTarget,
544
+ screenLayout,
545
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
333
546
  resolvedPair,
334
- ) as Record<string, unknown>;
547
+ });
548
+
549
+ const elementRaw = bounds({
550
+ ...baseRawOptions,
551
+ anchor: resolvedZoomAnchor,
552
+ method: "transform",
553
+ space: "relative",
554
+ target: unfocusedElementTarget,
555
+ } as const);
335
556
 
336
557
  const boundTargetCenterX =
337
558
  explicitTarget === "bound" && resolvedPair.destinationBounds
@@ -394,26 +615,26 @@ export function buildZoomStyles({
394
615
  { scaleX: 1 },
395
616
  { scaleY: 1 },
396
617
  ],
397
- opacity: 0,
618
+ opacity: zoomOptions?.debug ? 1 : 0,
398
619
  zIndex: 0,
399
620
  elevation: 0,
400
621
  }
401
622
  : {
402
623
  transform: [
403
624
  {
404
- translateX: shouldFreezeUnfocusedElement ? 0 : elementTranslateX,
625
+ translateX: shouldResetUnfocusedElement ? 0 : elementTranslateX,
405
626
  },
406
627
  {
407
- translateY: shouldFreezeUnfocusedElement ? 0 : elementTranslateY,
628
+ translateY: shouldResetUnfocusedElement ? 0 : elementTranslateY,
408
629
  },
409
630
  {
410
- scaleX: shouldFreezeUnfocusedElement ? 1 : elementScaleX,
631
+ scaleX: shouldResetUnfocusedElement ? 1 : elementScaleX,
411
632
  },
412
633
  {
413
- scaleY: shouldFreezeUnfocusedElement ? 1 : elementScaleY,
634
+ scaleY: shouldResetUnfocusedElement ? 1 : elementScaleY,
414
635
  },
415
636
  ],
416
- opacity: debug ? 0.5 : unfocusedFade,
637
+ opacity: zoomOptions?.debug ? 1 : unfocusedFade,
417
638
  zIndex: 9999,
418
639
  elevation: 9999,
419
640
  };
@@ -424,7 +645,7 @@ export function buildZoomStyles({
424
645
  transform: [{ scale: unfocusedScale }],
425
646
  },
426
647
  },
427
- [resolvedTag]: {
648
+ [effectiveTag]: {
428
649
  style: resolvedElementStyle,
429
650
  },
430
651
  };
@@ -8,6 +8,17 @@ export const ZOOM_SHARED_OPTIONS = Object.freeze({
8
8
  export const ZOOM_DRAG_RESISTANCE = 0.4;
9
9
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MIN = 0.25;
10
10
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MAX = 1.06;
11
+ export const ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT = 2;
12
+ export const ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX = 1;
13
+ export const ZOOM_DRAG_TRANSLATION_POSITIVE_MAX = 1;
14
+ export const ZOOM_DRAG_TRANSLATION_EXPONENT = 1;
15
+ export const ZOOM_BACKGROUND_SCALE = 0.9375;
16
+ export const ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [0, 0.5, 0, 1] as const;
17
+ export const ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [0.6, 1, 0, 1] as const;
18
+ export const ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [1, 2, 1, 0] as const;
19
+ export const ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [
20
+ 1.9, 2, 1, 0,
21
+ ] as const;
11
22
 
12
23
  export const ZOOM_MASK_OUTSET = Object.freeze({
13
24
  top: 0,
@@ -191,3 +191,60 @@ export const resolveDirectionalDragScale = ({
191
191
  const oppositeDrag = Math.min(1, Math.abs(dismissalRelative));
192
192
  return interpolate(oppositeDrag, [0, 1], [1, growMax], "clamp");
193
193
  };
194
+
195
+ export const resolveDirectionalDragTranslation = ({
196
+ normalized,
197
+ dimension,
198
+ resistance,
199
+ negativeMax,
200
+ positiveMax,
201
+ exponent = 1,
202
+ }: {
203
+ normalized: number;
204
+ dimension: number;
205
+ resistance: number;
206
+ negativeMax: number;
207
+ positiveMax: number;
208
+ exponent?: number;
209
+ }) => {
210
+ "worklet";
211
+
212
+ const clampedMagnitude = Math.min(1, Math.abs(normalized));
213
+ const curvedMagnitude = clampedMagnitude ** Math.max(1, exponent);
214
+ const baseDistance = Math.max(0, dimension) * resistance;
215
+
216
+ if (normalized < 0) {
217
+ return -baseDistance * negativeMax * curvedMagnitude;
218
+ }
219
+
220
+ return baseDistance * positiveMax * curvedMagnitude;
221
+ };
222
+
223
+ export const resolveOpacityRangeTuple = ({
224
+ value,
225
+ fallback,
226
+ }: {
227
+ value:
228
+ | readonly [
229
+ inputStart: number,
230
+ inputEnd: number,
231
+ outputStart?: number,
232
+ outputEnd?: number,
233
+ ]
234
+ | undefined;
235
+ fallback: readonly [
236
+ inputStart: number,
237
+ inputEnd: number,
238
+ outputStart?: number,
239
+ outputEnd?: number,
240
+ ];
241
+ }) => {
242
+ "worklet";
243
+
244
+ return {
245
+ inputStart: value?.[0] ?? fallback[0],
246
+ inputEnd: value?.[1] ?? fallback[1],
247
+ outputStart: value?.[2] ?? fallback[2] ?? 0,
248
+ outputEnd: value?.[3] ?? fallback[3] ?? 1,
249
+ };
250
+ };
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useDeferredMeasurementTrigger = void 0;
7
- var _react = require("react");
8
- var _reactNativeReanimated = require("react-native-reanimated");
9
- const useDeferredMeasurementTrigger = params => {
10
- const {
11
- enabled,
12
- isAnimating,
13
- canFlush,
14
- onFlush
15
- } = params;
16
- const hasPendingMeasurement = (0, _reactNativeReanimated.useSharedValue)(false);
17
- const clearPendingMeasurement = (0, _react.useCallback)(() => {
18
- "worklet";
19
-
20
- hasPendingMeasurement.value = false;
21
- }, [hasPendingMeasurement]);
22
- const queueOrFlushMeasurement = (0, _react.useCallback)(() => {
23
- "worklet";
24
-
25
- if (!enabled) return;
26
- if (isAnimating.value) {
27
- hasPendingMeasurement.value = true;
28
- return;
29
- }
30
- hasPendingMeasurement.value = false;
31
- onFlush();
32
- }, [enabled, isAnimating, hasPendingMeasurement, onFlush]);
33
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
34
- "worklet";
35
-
36
- if (!enabled) return false;
37
- if (!hasPendingMeasurement.value) return false;
38
- if (isAnimating.value) return false;
39
- return canFlush ? canFlush() : true;
40
- }, (shouldFlush, previousShouldFlush) => {
41
- "worklet";
42
-
43
- if (!enabled) return;
44
- if (!shouldFlush || shouldFlush === previousShouldFlush) return;
45
- hasPendingMeasurement.value = false;
46
- onFlush();
47
- }, [enabled, isAnimating, hasPendingMeasurement, canFlush, onFlush]);
48
- return {
49
- clearPendingMeasurement,
50
- queueOrFlushMeasurement
51
- };
52
- };
53
- exports.useDeferredMeasurementTrigger = useDeferredMeasurementTrigger;
54
- //# sourceMappingURL=use-deferred-measurement-trigger.js.map