react-native-screen-transitions 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/lib/commonjs/shared/animation/snap-to.js +2 -0
  2. package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
  3. package/lib/commonjs/shared/components/boundary/components/boundary-target.js +19 -20
  4. package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
  5. package/lib/commonjs/shared/components/boundary/create-boundary-component.js +16 -2
  6. package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -1
  7. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +5 -0
  8. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  9. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +1 -3
  10. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/boundary/index.js +4 -3
  12. package/lib/commonjs/shared/components/boundary/index.js.map +1 -1
  13. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +47 -187
  14. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  15. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js +21 -13
  16. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
  17. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js +1 -12
  18. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  19. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +40 -33
  20. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  21. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +3 -4
  22. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
  23. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +46 -130
  24. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  25. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js +45 -9
  26. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  27. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -1
  28. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +2 -29
  29. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  30. package/lib/commonjs/shared/components/boundary/portal/utils/handoff-target.js +33 -0
  31. package/lib/commonjs/shared/components/boundary/portal/utils/handoff-target.js.map +1 -0
  32. package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js +19 -15
  33. package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -1
  34. package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js +1 -10
  35. package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
  36. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +18 -36
  37. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  38. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +7 -0
  39. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -1
  40. package/lib/commonjs/shared/components/boundary/utils/resolve-boundary-target.js +29 -0
  41. package/lib/commonjs/shared/components/boundary/utils/resolve-boundary-target.js.map +1 -0
  42. package/lib/commonjs/shared/components/masked-view.js +9 -1
  43. package/lib/commonjs/shared/components/masked-view.js.map +1 -1
  44. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +3 -1
  45. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  46. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +9 -1
  47. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  48. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js +2 -0
  49. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
  50. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js +4 -1
  51. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
  52. package/lib/commonjs/shared/providers/screen/gestures/gestures.provider.js +2 -8
  53. package/lib/commonjs/shared/providers/screen/gestures/gestures.provider.js.map +1 -1
  54. package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js +1 -0
  55. package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
  56. package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +37 -3
  57. package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
  58. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +1 -0
  59. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  60. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-release.js +3 -2
  61. package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
  62. package/lib/commonjs/shared/providers/screen/gestures/types.js.map +1 -1
  63. package/lib/commonjs/shared/providers/screen/styles/helpers/transition-visual-state.js +42 -0
  64. package/lib/commonjs/shared/providers/screen/styles/helpers/transition-visual-state.js.map +1 -0
  65. package/lib/commonjs/shared/providers/screen/styles/helpers/visibility-gate.js +11 -5
  66. package/lib/commonjs/shared/providers/screen/styles/helpers/visibility-gate.js.map +1 -1
  67. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +23 -10
  68. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  69. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +10 -8
  70. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  71. package/lib/commonjs/shared/stores/bounds/internals/links.js +4 -4
  72. package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
  73. package/lib/commonjs/shared/stores/scroll.store.js +20 -2
  74. package/lib/commonjs/shared/stores/scroll.store.js.map +1 -1
  75. package/lib/commonjs/shared/stores/system.store.js +2 -0
  76. package/lib/commonjs/shared/stores/system.store.js.map +1 -1
  77. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +23 -1
  78. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  79. package/lib/commonjs/shared/utils/animation/animate.js +14 -2
  80. package/lib/commonjs/shared/utils/animation/animate.js.map +1 -1
  81. package/lib/commonjs/shared/utils/animation/spring/spring.js +22 -2
  82. package/lib/commonjs/shared/utils/animation/spring/spring.js.map +1 -1
  83. package/lib/commonjs/shared/utils/animation/spring/springUtils.js +96 -0
  84. package/lib/commonjs/shared/utils/animation/spring/springUtils.js.map +1 -1
  85. package/lib/commonjs/shared/utils/animation/state.js +4 -0
  86. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +17 -5
  87. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  88. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +44 -20
  89. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  90. package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js +2 -31
  91. package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js.map +1 -1
  92. package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js +3 -17
  93. package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
  94. package/lib/module/shared/animation/snap-to.js +2 -0
  95. package/lib/module/shared/animation/snap-to.js.map +1 -1
  96. package/lib/module/shared/components/boundary/components/boundary-target.js +19 -20
  97. package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
  98. package/lib/module/shared/components/boundary/create-boundary-component.js +17 -3
  99. package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -1
  100. package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +5 -0
  101. package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  102. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +1 -3
  103. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  104. package/lib/module/shared/components/boundary/index.js +3 -2
  105. package/lib/module/shared/components/boundary/index.js.map +1 -1
  106. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +49 -189
  107. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  108. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js +21 -13
  109. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
  110. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js +2 -13
  111. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  112. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +43 -36
  113. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  114. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +3 -4
  115. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
  116. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +50 -134
  117. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  118. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js +44 -9
  119. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  120. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -1
  121. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -27
  122. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  123. package/lib/module/shared/components/boundary/portal/utils/handoff-target.js +28 -0
  124. package/lib/module/shared/components/boundary/portal/utils/handoff-target.js.map +1 -0
  125. package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js +19 -15
  126. package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -1
  127. package/lib/module/shared/components/boundary/portal/utils/teleport-control.js +0 -8
  128. package/lib/module/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
  129. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +19 -37
  130. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  131. package/lib/module/shared/components/boundary/utils/refresh-signals.js +7 -0
  132. package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -1
  133. package/lib/module/shared/components/boundary/utils/resolve-boundary-target.js +24 -0
  134. package/lib/module/shared/components/boundary/utils/resolve-boundary-target.js.map +1 -0
  135. package/lib/module/shared/components/masked-view.js +10 -2
  136. package/lib/module/shared/components/masked-view.js.map +1 -1
  137. package/lib/module/shared/components/screen-container/layers/backdrop.js +3 -1
  138. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  139. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +10 -2
  140. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  141. package/lib/module/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js +2 -0
  142. package/lib/module/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
  143. package/lib/module/shared/providers/helpers/measured-bounds-writes.js +4 -1
  144. package/lib/module/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
  145. package/lib/module/shared/providers/screen/gestures/gestures.provider.js +2 -8
  146. package/lib/module/shared/providers/screen/gestures/gestures.provider.js.map +1 -1
  147. package/lib/module/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js +1 -0
  148. package/lib/module/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
  149. package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +35 -2
  150. package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
  151. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +1 -0
  152. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  153. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-release.js +3 -2
  154. package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
  155. package/lib/module/shared/providers/screen/gestures/types.js.map +1 -1
  156. package/lib/module/shared/providers/screen/styles/helpers/transition-visual-state.js +35 -0
  157. package/lib/module/shared/providers/screen/styles/helpers/transition-visual-state.js.map +1 -0
  158. package/lib/module/shared/providers/screen/styles/helpers/visibility-gate.js +11 -5
  159. package/lib/module/shared/providers/screen/styles/helpers/visibility-gate.js.map +1 -1
  160. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +23 -10
  161. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  162. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +10 -8
  163. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  164. package/lib/module/shared/stores/bounds/internals/links.js +4 -4
  165. package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
  166. package/lib/module/shared/stores/scroll.store.js +17 -0
  167. package/lib/module/shared/stores/scroll.store.js.map +1 -1
  168. package/lib/module/shared/stores/system.store.js +2 -0
  169. package/lib/module/shared/stores/system.store.js.map +1 -1
  170. package/lib/module/shared/utils/animation/animate-to-progress.js +21 -0
  171. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  172. package/lib/module/shared/utils/animation/animate.js +14 -2
  173. package/lib/module/shared/utils/animation/animate.js.map +1 -1
  174. package/lib/module/shared/utils/animation/spring/spring.js +23 -3
  175. package/lib/module/shared/utils/animation/spring/spring.js.map +1 -1
  176. package/lib/module/shared/utils/animation/spring/springUtils.js +95 -0
  177. package/lib/module/shared/utils/animation/spring/springUtils.js.map +1 -1
  178. package/lib/module/shared/utils/animation/state.js +2 -0
  179. package/lib/module/shared/utils/bounds/navigation/reveal/math.js +16 -5
  180. package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  181. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +46 -22
  182. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  183. package/lib/module/shared/utils/bounds/navigation/zoom/drag.js +2 -30
  184. package/lib/module/shared/utils/bounds/navigation/zoom/drag.js.map +1 -1
  185. package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js +4 -18
  186. package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
  187. package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
  188. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts +2 -1
  189. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
  190. package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -1
  191. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
  192. package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts +3 -4
  193. package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
  194. package/lib/typescript/shared/components/boundary/index.d.ts +6 -9
  195. package/lib/typescript/shared/components/boundary/index.d.ts.map +1 -1
  196. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts +1 -3
  197. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
  198. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +1 -1
  199. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
  200. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
  201. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts +1 -10
  202. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +1 -1
  203. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +1 -3
  204. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  205. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts +2 -2
  206. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
  207. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts +0 -1
  208. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts.map +1 -1
  209. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +1 -10
  210. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
  211. package/lib/typescript/shared/components/boundary/portal/utils/handoff-target.d.ts +12 -0
  212. package/lib/typescript/shared/components/boundary/portal/utils/handoff-target.d.ts.map +1 -0
  213. package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts +2 -3
  214. package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts.map +1 -1
  215. package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts +0 -4
  216. package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts.map +1 -1
  217. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +8 -12
  218. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
  219. package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts +1 -0
  220. package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -1
  221. package/lib/typescript/shared/components/boundary/utils/resolve-boundary-target.d.ts +12 -0
  222. package/lib/typescript/shared/components/boundary/utils/resolve-boundary-target.d.ts.map +1 -0
  223. package/lib/typescript/shared/components/masked-view.d.ts.map +1 -1
  224. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  225. package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
  226. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts.map +1 -1
  227. package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts.map +1 -1
  228. package/lib/typescript/shared/providers/screen/gestures/gestures.provider.d.ts.map +1 -1
  229. package/lib/typescript/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts.map +1 -1
  230. package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts +2 -1
  231. package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts.map +1 -1
  232. package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
  233. package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-release.d.ts.map +1 -1
  234. package/lib/typescript/shared/providers/screen/gestures/types.d.ts +1 -9
  235. package/lib/typescript/shared/providers/screen/gestures/types.d.ts.map +1 -1
  236. package/lib/typescript/shared/providers/screen/styles/helpers/transition-visual-state.d.ts +18 -0
  237. package/lib/typescript/shared/providers/screen/styles/helpers/transition-visual-state.d.ts.map +1 -0
  238. package/lib/typescript/shared/providers/screen/styles/helpers/visibility-gate.d.ts +2 -2
  239. package/lib/typescript/shared/providers/screen/styles/helpers/visibility-gate.d.ts.map +1 -1
  240. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  241. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
  242. package/lib/typescript/shared/stores/bounds/internals/links.d.ts +1 -1
  243. package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
  244. package/lib/typescript/shared/stores/scroll.store.d.ts +7 -0
  245. package/lib/typescript/shared/stores/scroll.store.d.ts.map +1 -1
  246. package/lib/typescript/shared/stores/system.store.d.ts +5 -0
  247. package/lib/typescript/shared/stores/system.store.d.ts.map +1 -1
  248. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +6 -1
  249. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  250. package/lib/typescript/shared/utils/animation/animate.d.ts +2 -2
  251. package/lib/typescript/shared/utils/animation/animate.d.ts.map +1 -1
  252. package/lib/typescript/shared/utils/animation/spring/spring.d.ts +2 -2
  253. package/lib/typescript/shared/utils/animation/spring/spring.d.ts.map +1 -1
  254. package/lib/typescript/shared/utils/animation/spring/springUtils.d.ts +3 -0
  255. package/lib/typescript/shared/utils/animation/spring/springUtils.d.ts.map +1 -1
  256. package/lib/typescript/shared/utils/animation/state.d.ts +6 -0
  257. package/lib/typescript/shared/utils/animation/state.d.ts.map +1 -1
  258. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts +9 -0
  259. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
  260. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
  261. package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts +2 -11
  262. package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts.map +1 -1
  263. package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts +7 -4
  264. package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts.map +1 -1
  265. package/package.json +1 -1
  266. package/src/shared/animation/snap-to.ts +5 -0
  267. package/src/shared/components/boundary/components/boundary-target.tsx +37 -23
  268. package/src/shared/components/boundary/create-boundary-component.tsx +29 -3
  269. package/src/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +11 -0
  270. package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +3 -9
  271. package/src/shared/components/boundary/index.tsx +4 -8
  272. package/src/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +73 -275
  273. package/src/shared/components/boundary/portal/components/boundary-content-portal/index.tsx +31 -12
  274. package/src/shared/components/boundary/portal/components/boundary-portal/components/host.tsx +2 -12
  275. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +64 -62
  276. package/src/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.ts +2 -9
  277. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +73 -186
  278. package/src/shared/components/boundary/portal/components/boundary-portal/index.tsx +72 -12
  279. package/src/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.ts +0 -1
  280. package/src/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +2 -39
  281. package/src/shared/components/boundary/portal/utils/handoff-target.ts +48 -0
  282. package/src/shared/components/boundary/portal/utils/resolve-portal.ts +26 -18
  283. package/src/shared/components/boundary/portal/utils/teleport-control.ts +0 -12
  284. package/src/shared/components/boundary/providers/boundary-root.provider.tsx +28 -80
  285. package/src/shared/components/boundary/utils/refresh-signals.ts +8 -0
  286. package/src/shared/components/boundary/utils/resolve-boundary-target.tsx +39 -0
  287. package/src/shared/components/masked-view.tsx +20 -4
  288. package/src/shared/components/screen-container/layers/backdrop.tsx +3 -1
  289. package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +14 -4
  290. package/src/shared/components/screen-lifecycle/hooks/use-transition-start-controller.ts +2 -0
  291. package/src/shared/providers/helpers/measured-bounds-writes.ts +1 -0
  292. package/src/shared/providers/screen/gestures/gestures.provider.tsx +2 -10
  293. package/src/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.ts +1 -0
  294. package/src/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.ts +74 -3
  295. package/src/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +1 -0
  296. package/src/shared/providers/screen/gestures/pinch/behavior/pinch-release.ts +2 -4
  297. package/src/shared/providers/screen/gestures/types.ts +0 -14
  298. package/src/shared/providers/screen/styles/helpers/transition-visual-state.ts +44 -0
  299. package/src/shared/providers/screen/styles/helpers/visibility-gate.ts +17 -7
  300. package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +30 -15
  301. package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +14 -13
  302. package/src/shared/stores/bounds/internals/links.ts +13 -2
  303. package/src/shared/stores/scroll.store.ts +23 -0
  304. package/src/shared/stores/system.store.ts +8 -0
  305. package/src/shared/utils/animation/animate-to-progress.ts +59 -28
  306. package/src/shared/utils/animation/animate.ts +18 -2
  307. package/src/shared/utils/animation/spring/spring.ts +36 -1
  308. package/src/shared/utils/animation/spring/springUtils.ts +130 -0
  309. package/src/shared/utils/animation/state.ts +8 -0
  310. package/src/shared/utils/bounds/navigation/reveal/math.ts +21 -5
  311. package/src/shared/utils/bounds/navigation/zoom/build.ts +77 -23
  312. package/src/shared/utils/bounds/navigation/zoom/drag.ts +3 -42
  313. package/src/shared/utils/bounds/navigation/zoom/helpers.ts +9 -23
  314. package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js +0 -32
  315. package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js.map +0 -1
  316. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +0 -51
  317. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +0 -1
  318. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js +0 -220
  319. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js.map +0 -1
  320. package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js +0 -29
  321. package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js.map +0 -1
  322. package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js +0 -25
  323. package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js.map +0 -1
  324. package/lib/commonjs/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js +0 -64
  325. package/lib/commonjs/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js.map +0 -1
  326. package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js +0 -21
  327. package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js.map +0 -1
  328. package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js +0 -29
  329. package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js.map +0 -1
  330. package/lib/commonjs/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js +0 -38
  331. package/lib/commonjs/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js.map +0 -1
  332. package/lib/commonjs/shared/providers/screen/styles/helpers/opening-phase.js +0 -32
  333. package/lib/commonjs/shared/providers/screen/styles/helpers/opening-phase.js.map +0 -1
  334. package/lib/module/shared/components/boundary/hooks/use-register-target.js +0 -27
  335. package/lib/module/shared/components/boundary/hooks/use-register-target.js.map +0 -1
  336. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +0 -46
  337. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +0 -1
  338. package/lib/module/shared/components/boundary/portal/utils/ownership.js +0 -213
  339. package/lib/module/shared/components/boundary/portal/utils/ownership.js.map +0 -1
  340. package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js +0 -24
  341. package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js.map +0 -1
  342. package/lib/module/shared/components/boundary/portal/utils/visible-host.js +0 -20
  343. package/lib/module/shared/components/boundary/portal/utils/visible-host.js.map +0 -1
  344. package/lib/module/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js +0 -59
  345. package/lib/module/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js.map +0 -1
  346. package/lib/module/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js +0 -15
  347. package/lib/module/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js.map +0 -1
  348. package/lib/module/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js +0 -24
  349. package/lib/module/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js.map +0 -1
  350. package/lib/module/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js +0 -33
  351. package/lib/module/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js.map +0 -1
  352. package/lib/module/shared/providers/screen/styles/helpers/opening-phase.js +0 -26
  353. package/lib/module/shared/providers/screen/styles/helpers/opening-phase.js.map +0 -1
  354. package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts +0 -10
  355. package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts.map +0 -1
  356. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts +0 -13
  357. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts.map +0 -1
  358. package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts +0 -34
  359. package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts.map +0 -1
  360. package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts +0 -8
  361. package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts.map +0 -1
  362. package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts +0 -8
  363. package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts.map +0 -1
  364. package/lib/typescript/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.d.ts +0 -15
  365. package/lib/typescript/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.d.ts.map +0 -1
  366. package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.d.ts +0 -4
  367. package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.d.ts.map +0 -1
  368. package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.d.ts +0 -5
  369. package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.d.ts.map +0 -1
  370. package/lib/typescript/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.d.ts +0 -9
  371. package/lib/typescript/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.d.ts.map +0 -1
  372. package/lib/typescript/shared/providers/screen/styles/helpers/opening-phase.d.ts +0 -16
  373. package/lib/typescript/shared/providers/screen/styles/helpers/opening-phase.d.ts.map +0 -1
  374. package/src/shared/components/boundary/hooks/use-register-target.ts +0 -43
  375. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.tsx +0 -79
  376. package/src/shared/components/boundary/portal/utils/ownership.ts +0 -319
  377. package/src/shared/components/boundary/portal/utils/shallow-equal.ts +0 -25
  378. package/src/shared/components/boundary/portal/utils/visible-host.ts +0 -24
  379. package/src/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.ts +0 -88
  380. package/src/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.ts +0 -19
  381. package/src/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.ts +0 -47
  382. package/src/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.ts +0 -50
  383. package/src/shared/providers/screen/styles/helpers/opening-phase.ts +0 -25
@@ -19,19 +19,12 @@ type ResolvePortalOffsetStyleParams = {
19
19
  bounds: ScrollMeasuredDimensions;
20
20
  hostKey: string;
21
21
  placement: PortalOffsetPlacement;
22
- /**
23
- * Live correction applied on top of the stored source placement. Used by
24
- * cross-screen hosts to keep the landing rect tracking the source screen's
25
- * scroll while the source is interactive mid-flight.
26
- */
27
- landingShift?: { x: number; y: number };
28
22
  };
29
23
 
30
24
  export const resolvePortalOffsetStyle = ({
31
25
  bounds,
32
26
  hostKey,
33
27
  placement,
34
- landingShift,
35
28
  }: ResolvePortalOffsetStyleParams): StyleProps => {
36
29
  "worklet";
37
30
  const hostBounds = getPortalHostBounds(hostKey);
@@ -69,8 +62,8 @@ export const resolvePortalOffsetStyle = ({
69
62
 
70
63
  return {
71
64
  transform: [
72
- { translateY: bounds.pageY - adjustedHostPageY + (landingShift?.y ?? 0) },
73
- { translateX: bounds.pageX - adjustedHostPageX + (landingShift?.x ?? 0) },
65
+ { translateY: bounds.pageY - adjustedHostPageY },
66
+ { translateX: bounds.pageX - adjustedHostPageX },
74
67
  ],
75
68
  };
76
69
  };
@@ -1,228 +1,98 @@
1
- import { useCallback, useLayoutEffect, useRef, useState } from "react";
1
+ import { useLayoutEffect } from "react";
2
2
  import {
3
- runOnJS,
3
+ type SharedValue,
4
4
  useAnimatedProps,
5
- useAnimatedReaction,
6
5
  useSharedValue,
7
6
  } from "react-native-reanimated";
8
7
  import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
9
8
  import { useScreenSlots } from "../../../../../../providers/screen/styles";
9
+ import { hasCloseTransitionFinished } from "../../../../../../providers/screen/styles/helpers/transition-visual-state";
10
+ import { AnimationStore } from "../../../../../../stores/animation.store";
11
+ import { getLinkKeyFromTag } from "../../../../../../stores/bounds/helpers/link-pairs.helpers";
10
12
  import { pairs } from "../../../../../../stores/bounds/internals/state";
13
+ import { SystemStore } from "../../../../../../stores/system.store";
11
14
  import { PORTAL_HOST_NAME_RESET_VALUE } from "../../../utils/naming";
12
- import {
13
- type PortalOwnershipSignal,
14
- resolveBoundaryPortalOwnership,
15
- } from "../../../utils/ownership";
16
- import { shallowEqual } from "../../../utils/shallow-equal";
17
- import { shouldAttachBoundaryPortal } from "../../../utils/teleport-control";
18
- import { resolveNextVisiblePortalHostName } from "../../../utils/visible-host";
15
+ import { isTeleportEnabled } from "../../../utils/teleport-control";
19
16
  import { createBoundaryPortalHostName } from "../helpers/host-name";
20
17
  import { useActiveHostKey } from "../stores/host-registry.store";
21
18
  import {
22
- dropStalePortalBoundaryHosts,
23
19
  mountPortalBoundaryHost,
24
20
  unmountPortalBoundaryHostByName,
25
21
  } from "../stores/portal-boundary-host.store";
26
22
 
27
23
  interface UseBoundaryPortalAttachmentParams {
28
24
  boundaryId: string;
29
- enabled: boolean;
30
25
  }
31
26
 
27
+ type AttachedDestination = {
28
+ animationProgress: SharedValue<number>;
29
+ closing: SharedValue<number>;
30
+ };
31
+
32
32
  export const useBoundaryPortalAttachment = ({
33
33
  boundaryId,
34
- enabled,
35
34
  }: UseBoundaryPortalAttachmentParams) => {
36
35
  const sourcePairKey = useDescriptorsStore((s) => s.derivations.sourcePairKey);
37
36
  const currentScreenKey = useDescriptorsStore(
38
37
  (s) => s.derivations.currentScreenKey,
39
38
  );
40
- const { localStylesMaps, nextInterpolatorReady, slotsMap } = useScreenSlots();
41
- const [ownership, setOwnership] = useState<Extract<
42
- PortalOwnershipSignal,
43
- { status: "complete" }
44
- > | null>(null);
45
- const requestedPortalHostName = useSharedValue<string | null>(null);
46
- const visiblePortalHostName = useSharedValue<string | null>(null);
47
- const mountedPortalBoundaryHostNamesRef = useRef(new Set<string>());
48
- const escapeHostKey = useActiveHostKey(enabled ? currentScreenKey : null);
49
-
50
- const updatePortalOwnership = useCallback(
51
- (
52
- hostScreenKey: string | null,
53
- ownerPairKey?: string,
54
- ownerScreenKey?: string,
55
- ) => {
56
- if (hostScreenKey && ownerPairKey && ownerScreenKey) {
57
- setOwnership((current) => {
58
- if (
59
- current?.hostScreenKey === hostScreenKey &&
60
- current.ownerPairKey === ownerPairKey &&
61
- current.ownerScreenKey === ownerScreenKey
62
- ) {
63
- return current;
64
- }
65
-
66
- return {
67
- hostScreenKey,
68
- ownerPairKey,
69
- ownerScreenKey,
70
- status: "complete",
71
- };
72
- });
73
- return;
74
- }
75
-
76
- setOwnership((current) => (current ? null : current));
77
- },
78
- [],
39
+ const nextScreenKey = useDescriptorsStore((s) => s.derivations.nextScreenKey);
40
+ const destinationScreenKey = nextScreenKey ?? currentScreenKey;
41
+ const destinationAnimationProgress = SystemStore.getValue(
42
+ destinationScreenKey,
43
+ "animationProgress",
79
44
  );
80
-
81
- const unmountOwnedPortalBoundaryHosts = useCallback(() => {
82
- for (const portalHostName of mountedPortalBoundaryHostNamesRef.current) {
83
- unmountPortalBoundaryHostByName(portalHostName);
84
- }
85
-
86
- mountedPortalBoundaryHostNamesRef.current.clear();
87
- }, []);
45
+ const destinationClosing = AnimationStore.getValue(
46
+ destinationScreenKey,
47
+ "closing",
48
+ );
49
+ const { localStylesMaps, slotsMap } = useScreenSlots();
50
+ const portalHostName = useSharedValue<string | null>(null);
51
+ const portalHostReady = useSharedValue(false);
52
+ const attachedDestination = useSharedValue<AttachedDestination | null>(null);
53
+ const escapeHostKey = useActiveHostKey(currentScreenKey);
88
54
 
89
55
  useLayoutEffect(() => {
90
- if (!enabled || !ownership || !escapeHostKey) {
91
- requestedPortalHostName.set(null);
92
- visiblePortalHostName.set(null);
93
- unmountOwnedPortalBoundaryHosts();
56
+ if (!sourcePairKey || !escapeHostKey) {
57
+ portalHostName.set(null);
58
+ portalHostReady.set(false);
94
59
  return;
95
60
  }
96
61
 
97
- const portalHostName = createBoundaryPortalHostName(
62
+ const nextPortalHostName = createBoundaryPortalHostName(
98
63
  escapeHostKey,
99
64
  boundaryId,
100
- ownership.ownerPairKey,
65
+ sourcePairKey,
101
66
  );
102
67
 
103
68
  mountPortalBoundaryHost({
104
69
  boundaryId,
105
- escapeClipping: true,
106
70
  hostKey: escapeHostKey,
107
71
  localStylesMaps,
108
- pairKey: ownership.ownerPairKey,
109
- portalHostName,
72
+ pairKey: sourcePairKey,
73
+ portalHostName: nextPortalHostName,
74
+ portalHostReady,
110
75
  screenKey: currentScreenKey,
111
76
  slotsMap,
112
77
  });
113
- mountedPortalBoundaryHostNamesRef.current.add(portalHostName);
78
+ portalHostName.set(nextPortalHostName);
114
79
 
115
- // Request the new receiver immediately, but keep the currently visible
116
- // receiver until the new interpolator is ready. This avoids a no-host gap
117
- // during rapid close/open retargets.
118
- requestedPortalHostName.set(portalHostName);
80
+ return () => {
81
+ portalHostName.set(null);
82
+ portalHostReady.set(false);
83
+ unmountPortalBoundaryHostByName(nextPortalHostName);
84
+ };
119
85
  }, [
120
86
  boundaryId,
121
87
  currentScreenKey,
122
- enabled,
123
88
  escapeHostKey,
124
89
  localStylesMaps,
125
- ownership,
126
- requestedPortalHostName,
90
+ portalHostName,
91
+ portalHostReady,
92
+ sourcePairKey,
127
93
  slotsMap,
128
- unmountOwnedPortalBoundaryHosts,
129
- visiblePortalHostName,
130
- ]);
131
-
132
- useLayoutEffect(() => {
133
- return () => {
134
- requestedPortalHostName.set(null);
135
- visiblePortalHostName.set(null);
136
- unmountOwnedPortalBoundaryHosts();
137
- };
138
- }, [
139
- requestedPortalHostName,
140
- unmountOwnedPortalBoundaryHosts,
141
- visiblePortalHostName,
142
94
  ]);
143
95
 
144
- useAnimatedReaction(
145
- () => {
146
- "worklet";
147
- if (!enabled || !sourcePairKey) {
148
- return {
149
- hostScreenKey: null,
150
- ownerPairKey: sourcePairKey,
151
- ownerScreenKey: null,
152
- status: "clear",
153
- };
154
- }
155
-
156
- return resolveBoundaryPortalOwnership({
157
- boundaryId,
158
- currentScreenKey,
159
- handoff: false,
160
- pairsState: pairs.get(),
161
- sourcePairKey,
162
- });
163
- },
164
- (signal, previousSignal) => {
165
- "worklet";
166
- if (shallowEqual(previousSignal, signal)) {
167
- return;
168
- }
169
-
170
- runOnJS(updatePortalOwnership)(
171
- signal.hostScreenKey,
172
- signal.ownerPairKey,
173
- signal.ownerScreenKey ?? undefined,
174
- );
175
- },
176
- );
177
-
178
- useAnimatedReaction(
179
- () => {
180
- "worklet";
181
- const slot = slotsMap.get()[boundaryId];
182
- const teleport = slot?.props?.teleport;
183
- const shouldTeleport = shouldAttachBoundaryPortal({
184
- enabled,
185
- teleport,
186
- });
187
- const requestedName = requestedPortalHostName.get();
188
- const visibleName = visiblePortalHostName.get();
189
- const isInterpolatorReady = nextInterpolatorReady.get();
190
- const nextVisibleName = resolveNextVisiblePortalHostName({
191
- isInterpolatorReady: isInterpolatorReady === 1,
192
- requestedName,
193
- shouldTeleport,
194
- visibleName,
195
- });
196
-
197
- return {
198
- isInterpolatorReady,
199
- nextVisibleName,
200
- requestedName,
201
- shouldTeleport,
202
- teleport,
203
- visibleName,
204
- };
205
- },
206
- (state, previousState) => {
207
- "worklet";
208
- if (shallowEqual(previousState, state)) {
209
- return;
210
- }
211
-
212
- if (state.nextVisibleName !== state.visibleName) {
213
- visiblePortalHostName.set(state.nextVisibleName);
214
- return;
215
- }
216
-
217
- if (state.visibleName && state.visibleName === state.requestedName) {
218
- runOnJS(dropStalePortalBoundaryHosts)({
219
- boundaryId,
220
- keepPortalHostName: state.visibleName,
221
- });
222
- }
223
- },
224
- );
225
-
226
96
  const teleportProps = useAnimatedProps(() => {
227
97
  "worklet";
228
98
 
@@ -232,23 +102,40 @@ export const useBoundaryPortalAttachment = ({
232
102
  teleport,
233
103
  ...slotProps
234
104
  } = slot?.props ?? {};
235
- const shouldTeleport = shouldAttachBoundaryPortal({
236
- enabled,
237
- teleport,
238
- });
239
- const visibleName = visiblePortalHostName.get();
105
+ const shouldTeleport = isTeleportEnabled(teleport);
106
+ const hostName = portalHostName.get();
107
+ const pair = sourcePairKey ? pairs.get()[sourcePairKey] : undefined;
108
+ const linkKey = getLinkKeyFromTag(boundaryId);
109
+ const link = pair?.links[linkKey];
110
+ const hasActiveLink =
111
+ link?.source !== null &&
112
+ link !== undefined &&
113
+ (!link.group || pair?.groups[link.group]?.activeId === linkKey);
114
+ const hasAttachableHost =
115
+ shouldTeleport && hasActiveLink && portalHostReady.get() && hostName;
116
+
117
+ if (hasAttachableHost) {
118
+ attachedDestination.set({
119
+ animationProgress: destinationAnimationProgress,
120
+ closing: destinationClosing,
121
+ });
122
+ }
123
+
124
+ const attached = attachedDestination.get();
125
+ const hasAttachedCloseFinished =
126
+ attached !== null &&
127
+ hasCloseTransitionFinished({
128
+ animationProgress: attached.animationProgress.get(),
129
+ closing: attached.closing.get(),
130
+ });
131
+ const canAttach = hasAttachableHost && !hasAttachedCloseFinished;
132
+ const targetHostName = canAttach ? hostName : PORTAL_HOST_NAME_RESET_VALUE;
240
133
 
241
134
  return {
242
135
  ...slotProps,
243
- hostName:
244
- shouldTeleport && visibleName
245
- ? visibleName
246
- : PORTAL_HOST_NAME_RESET_VALUE,
136
+ hostName: targetHostName,
247
137
  };
248
138
  });
249
139
 
250
- return {
251
- teleportProps,
252
- visiblePortalHostName,
253
- };
140
+ return { teleportProps };
254
141
  };
@@ -1,8 +1,35 @@
1
- import { memo, type ReactNode } from "react";
1
+ import {
2
+ type ComponentProps,
3
+ type ComponentType,
4
+ memo,
5
+ type ReactNode,
6
+ } from "react";
2
7
  import type { View } from "react-native";
3
- import type { AnimatedRef } from "react-native-reanimated";
4
- import { BoundaryPortalSlot } from "./components/portal-slot";
8
+ import Animated, { type AnimatedRef, runOnUI } from "react-native-reanimated";
9
+ import { logger } from "../../../../../utils/logger";
10
+ import {
11
+ isTeleportAvailable,
12
+ PORTAL_POINTER_EVENTS,
13
+ NativePortal as TeleportPortal,
14
+ } from "../../teleport";
5
15
  import { useBoundaryPortalAttachment } from "./hooks/use-boundary-portal-attachment";
16
+ import { usePlaceholderStyles } from "./hooks/use-placeholder-styles";
17
+
18
+ type NullableHostNamePortalProps = Omit<
19
+ ComponentProps<NonNullable<typeof TeleportPortal>>,
20
+ "hostName"
21
+ > & {
22
+ hostName?: string | null;
23
+ };
24
+
25
+ const AnimatedNativePortal = TeleportPortal
26
+ ? Animated.createAnimatedComponent(
27
+ TeleportPortal as ComponentType<NullableHostNamePortalProps>,
28
+ )
29
+ : null;
30
+ const EnabledNativePortal = AnimatedNativePortal as NonNullable<
31
+ typeof AnimatedNativePortal
32
+ >;
6
33
 
7
34
  type BoundaryPortalProps = {
8
35
  boundaryId: string;
@@ -17,19 +44,52 @@ export const BoundaryPortal = memo(function BoundaryPortal({
17
44
  enabled,
18
45
  placeholderRef,
19
46
  }: BoundaryPortalProps) {
20
- const { teleportProps } = useBoundaryPortalAttachment({
21
- boundaryId,
22
- enabled,
23
- });
47
+ if (!enabled || !isTeleportAvailable || !AnimatedNativePortal) {
48
+ return children;
49
+ }
24
50
 
25
51
  return (
26
- <BoundaryPortalSlot
27
- id={boundaryId}
28
- enabled={enabled}
29
- animatedProps={teleportProps}
52
+ <EnabledBoundaryPortal
53
+ boundaryId={boundaryId}
30
54
  placeholderRef={placeholderRef}
31
55
  >
32
56
  {children}
33
- </BoundaryPortalSlot>
57
+ </EnabledBoundaryPortal>
58
+ );
59
+ });
60
+
61
+ const EnabledBoundaryPortal = memo(function EnabledBoundaryPortal({
62
+ boundaryId,
63
+ children,
64
+ placeholderRef,
65
+ }: Omit<BoundaryPortalProps, "enabled">) {
66
+ if (__DEV__ && !boundaryId) {
67
+ logger.warnOnce(
68
+ "portal:missing-id",
69
+ "A boundary portal was rendered without an id; rendering inline.",
70
+ );
71
+ }
72
+
73
+ const { teleportProps } = useBoundaryPortalAttachment({ boundaryId });
74
+ const { handleOnLayout, placeholderStyle } = usePlaceholderStyles();
75
+
76
+ return (
77
+ <Animated.View
78
+ ref={placeholderRef}
79
+ onLayout={({ nativeEvent: { layout } }) =>
80
+ runOnUI(handleOnLayout)(layout)
81
+ }
82
+ style={placeholderStyle}
83
+ pointerEvents={PORTAL_POINTER_EVENTS}
84
+ collapsable={false}
85
+ >
86
+ <EnabledNativePortal
87
+ animatedProps={teleportProps}
88
+ name={boundaryId}
89
+ pointerEvents={PORTAL_POINTER_EVENTS}
90
+ >
91
+ {children}
92
+ </EnabledNativePortal>
93
+ </Animated.View>
34
94
  );
35
95
  });
@@ -4,7 +4,6 @@ export type HostRegistration = {
4
4
  hostKey: string;
5
5
  screenKey: string;
6
6
  fallback: boolean;
7
- capturesScroll: boolean;
8
7
  };
9
8
 
10
9
  type HostRegistrySnapshot = Record<string, string>;
@@ -5,11 +5,11 @@ import type { NormalizedTransitionInterpolatedStyle } from "../../../../../../ty
5
5
 
6
6
  export type ActivePortalBoundaryHost = {
7
7
  boundaryId: string;
8
- escapeClipping: boolean;
9
8
  hostKey: string;
10
9
  localStylesMaps: SharedValue<LocalStyleLayers>;
11
10
  pairKey: string;
12
11
  portalHostName: string;
12
+ portalHostReady: SharedValue<boolean>;
13
13
  screenKey: string;
14
14
  slotsMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
15
15
  };
@@ -55,11 +55,11 @@ const isSameHost = (
55
55
  ) => {
56
56
  return (
57
57
  a.boundaryId === b.boundaryId &&
58
- a.escapeClipping === b.escapeClipping &&
59
58
  a.hostKey === b.hostKey &&
60
59
  a.localStylesMaps === b.localStylesMaps &&
61
60
  a.pairKey === b.pairKey &&
62
61
  a.portalHostName === b.portalHostName &&
62
+ a.portalHostReady === b.portalHostReady &&
63
63
  a.screenKey === b.screenKey &&
64
64
  a.slotsMap === b.slotsMap
65
65
  );
@@ -85,43 +85,6 @@ export const unmountPortalBoundaryHostByName = (
85
85
  emit();
86
86
  };
87
87
 
88
- /**
89
- * Post-handoff GC: drop every receiver for this boundary except the one now
90
- * visible (`keepPortalHostName`). Called once the new host is confirmed on
91
- * screen so the superseded receivers stop rendering.
92
- */
93
- export const dropStalePortalBoundaryHosts = ({
94
- boundaryId,
95
- keepPortalHostName,
96
- }: {
97
- boundaryId: string;
98
- keepPortalHostName: string;
99
- }) => {
100
- if (!activeBoundaryHosts.has(keepPortalHostName)) {
101
- return;
102
- }
103
-
104
- let didDelete = false;
105
-
106
- for (const [hostEntryKey, host] of activeBoundaryHosts) {
107
- if (
108
- host.boundaryId !== boundaryId ||
109
- host.portalHostName === keepPortalHostName
110
- ) {
111
- continue;
112
- }
113
-
114
- activeBoundaryHosts.delete(hostEntryKey);
115
- didDelete = true;
116
- }
117
-
118
- if (!didDelete) {
119
- return;
120
- }
121
-
122
- emit();
123
- };
124
-
125
88
  const subscribe = (listener: () => void) => {
126
89
  listeners.add(listener);
127
90
 
@@ -0,0 +1,48 @@
1
+ import { getLinkKeyFromTag } from "../../../../stores/bounds/helpers/link-pairs.helpers";
2
+ import type {
3
+ LinkPairsState,
4
+ ScreenKey,
5
+ ScreenPairKey,
6
+ } from "../../../../stores/bounds/types";
7
+
8
+ type ResolveEnteringHandoffTargetParams = {
9
+ animationProgress: number;
10
+ boundaryId: string;
11
+ currentScreenKey: ScreenKey;
12
+ pairsState: LinkPairsState;
13
+ sourcePairKey?: ScreenPairKey;
14
+ };
15
+
16
+ /** Resolve only the immediate A -> B entering handoff. */
17
+ export const resolveEnteringHandoffTarget = ({
18
+ animationProgress,
19
+ boundaryId,
20
+ currentScreenKey,
21
+ pairsState,
22
+ sourcePairKey,
23
+ }: ResolveEnteringHandoffTargetParams): ScreenKey | null => {
24
+ "worklet";
25
+
26
+ if (!sourcePairKey || animationProgress <= 0) {
27
+ return null;
28
+ }
29
+
30
+ const pair = pairsState[sourcePairKey];
31
+ const linkKey = getLinkKeyFromTag(boundaryId);
32
+ const link = pair?.links[linkKey];
33
+
34
+ if (
35
+ link?.status !== "complete" ||
36
+ link.source.screenKey !== currentScreenKey ||
37
+ !link.source.handoff ||
38
+ !link.destination.handoff
39
+ ) {
40
+ return null;
41
+ }
42
+
43
+ if (link.group && pair.groups[link.group]?.activeId !== linkKey) {
44
+ return null;
45
+ }
46
+
47
+ return link.destination.screenKey;
48
+ };
@@ -1,17 +1,33 @@
1
1
  import { logger } from "../../../../utils/logger";
2
2
  import { isTeleportAvailable } from "../teleport";
3
3
 
4
- export type BoundaryPortalRuntime = {
4
+ export type BoundaryPortalRuntime = Readonly<{
5
5
  handoff: boolean;
6
6
  escapeClipping: boolean;
7
- enabled: boolean;
8
- };
7
+ }>;
9
8
 
10
9
  type ResolveBoundaryPortalParams = {
11
10
  handoff?: boolean;
12
11
  escapeClipping?: boolean;
13
12
  };
14
13
 
14
+ const DISABLED_RUNTIME: BoundaryPortalRuntime = {
15
+ handoff: false,
16
+ escapeClipping: false,
17
+ };
18
+ const HANDOFF_RUNTIME: BoundaryPortalRuntime = {
19
+ handoff: true,
20
+ escapeClipping: false,
21
+ };
22
+ const ESCAPE_CLIPPING_RUNTIME: BoundaryPortalRuntime = {
23
+ handoff: false,
24
+ escapeClipping: true,
25
+ };
26
+ const HANDOFF_ESCAPE_CLIPPING_RUNTIME: BoundaryPortalRuntime = {
27
+ handoff: true,
28
+ escapeClipping: true,
29
+ };
30
+
15
31
  export const resolveBoundaryPortal = ({
16
32
  handoff,
17
33
  escapeClipping,
@@ -22,11 +38,7 @@ export const resolveBoundaryPortal = ({
22
38
  const enabled = resolvedHandoff || resolvedEscapeClipping;
23
39
 
24
40
  if (!enabled) {
25
- return {
26
- handoff: false,
27
- escapeClipping: false,
28
- enabled: false,
29
- };
41
+ return DISABLED_RUNTIME;
30
42
  }
31
43
 
32
44
  if (!isTeleportAvailable) {
@@ -35,16 +47,12 @@ export const resolveBoundaryPortal = ({
35
47
  "react-native-teleport is not installed; handoff and escapeClipping boundaries will render inline.",
36
48
  );
37
49
 
38
- return {
39
- handoff: false,
40
- escapeClipping: false,
41
- enabled: false,
42
- };
50
+ return DISABLED_RUNTIME;
43
51
  }
44
52
 
45
- return {
46
- handoff: resolvedHandoff,
47
- escapeClipping: resolvedEscapeClipping,
48
- enabled,
49
- };
53
+ return resolvedHandoff
54
+ ? resolvedEscapeClipping
55
+ ? HANDOFF_ESCAPE_CLIPPING_RUNTIME
56
+ : HANDOFF_RUNTIME
57
+ : ESCAPE_CLIPPING_RUNTIME;
50
58
  };
@@ -11,15 +11,3 @@ export const isTeleportEnabled = (
11
11
 
12
12
  return teleport?.enabled !== false;
13
13
  };
14
-
15
- export const shouldAttachBoundaryPortal = ({
16
- enabled,
17
- teleport,
18
- }: {
19
- enabled: boolean;
20
- teleport?: BoundaryTeleportControl;
21
- }) => {
22
- "worklet";
23
-
24
- return enabled && isTeleportEnabled(teleport);
25
- };