react-native-screen-transitions 3.9.0-beta.0 → 3.9.0-beta.2

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 (350) hide show
  1. package/lib/commonjs/shared/adapters/with-screen-transitions/index.js +20 -4
  2. package/lib/commonjs/shared/adapters/with-screen-transitions/index.js.map +1 -1
  3. package/lib/commonjs/shared/animation/transition-blocking.js +71 -0
  4. package/lib/commonjs/shared/animation/transition-blocking.js.map +1 -0
  5. package/lib/commonjs/shared/components/boundary/components/boundary-target.js +30 -30
  6. package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
  7. package/lib/commonjs/shared/components/boundary/create-boundary-component.js +30 -95
  8. package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -1
  9. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +68 -51
  10. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +1 -0
  12. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  13. package/lib/commonjs/shared/components/boundary/hooks/use-measurer.js +14 -2
  14. package/lib/commonjs/shared/components/boundary/hooks/use-measurer.js.map +1 -1
  15. package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js +32 -0
  16. package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js.map +1 -0
  17. package/lib/commonjs/shared/components/boundary/index.js +1 -1
  18. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +40 -0
  19. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -0
  20. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js +14 -0
  21. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js.map +1 -0
  22. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +194 -0
  23. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -0
  24. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js +44 -0
  25. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -0
  26. package/lib/commonjs/shared/components/boundary/portal/components/{host.js → boundary-portal/components/host.js} +17 -16
  27. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -0
  28. package/lib/commonjs/shared/components/boundary/portal/components/{portal-boundary-host.js → boundary-portal/components/portal-boundary-host.js} +11 -11
  29. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -0
  30. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +52 -0
  31. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -0
  32. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +1 -0
  33. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.js +14 -0
  34. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.js.map +1 -0
  35. package/lib/commonjs/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/offset-style.js +1 -1
  36. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -0
  37. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +184 -0
  38. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -0
  39. package/lib/commonjs/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-host-measurement.js +23 -5
  40. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -0
  41. package/lib/commonjs/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-placeholder-styles.js +3 -6
  42. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.js.map +1 -0
  43. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js +33 -0
  44. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -0
  45. package/lib/commonjs/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-bounds.store.js +1 -1
  46. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +1 -0
  47. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -0
  48. package/lib/commonjs/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/portal-boundary-host.store.js +7 -12
  49. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -0
  50. package/lib/commonjs/shared/components/boundary/portal/index.js +1 -8
  51. package/lib/commonjs/shared/components/boundary/portal/index.js.map +1 -1
  52. package/lib/commonjs/shared/components/boundary/portal/teleport.js +2 -2
  53. package/lib/commonjs/shared/components/boundary/portal/utils/naming.js +1 -15
  54. package/lib/commonjs/shared/components/boundary/portal/utils/naming.js.map +1 -1
  55. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js +19 -56
  56. package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js.map +1 -1
  57. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +77 -23
  58. package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  59. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js +41 -12
  60. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js.map +1 -1
  61. package/lib/commonjs/shared/components/boundary/utils/measured-bounds.js +36 -1
  62. package/lib/commonjs/shared/components/boundary/utils/measured-bounds.js.map +1 -1
  63. package/lib/commonjs/shared/components/screen-container/layers/content.js +1 -1
  64. package/lib/commonjs/shared/configs/presets.js +2 -2
  65. package/lib/commonjs/shared/configs/presets.js.map +1 -1
  66. package/lib/commonjs/shared/index.js +13 -0
  67. package/lib/commonjs/shared/index.js.map +1 -1
  68. package/lib/commonjs/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js +6 -1
  69. package/lib/commonjs/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js.map +1 -1
  70. package/lib/commonjs/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js +50 -0
  71. package/lib/commonjs/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js.map +1 -0
  72. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +7 -1
  73. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  74. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +2 -1
  75. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  76. package/lib/commonjs/shared/providers/screen/styles/slot.provider.js +5 -3
  77. package/lib/commonjs/shared/providers/screen/styles/slot.provider.js.map +1 -1
  78. package/lib/commonjs/shared/providers/screen/styles/stores/slot-references.store.js +1 -1
  79. package/lib/commonjs/shared/providers/screen/styles/stores/slot-references.store.js.map +1 -1
  80. package/lib/commonjs/shared/stores/system.store.js +10 -2
  81. package/lib/commonjs/shared/stores/system.store.js.map +1 -1
  82. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js +15 -9
  83. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  84. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +2 -2
  85. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  86. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +3 -3
  87. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  88. package/lib/module/shared/adapters/with-screen-transitions/index.js +19 -5
  89. package/lib/module/shared/adapters/with-screen-transitions/index.js.map +1 -1
  90. package/lib/module/shared/animation/transition-blocking.js +66 -0
  91. package/lib/module/shared/animation/transition-blocking.js.map +1 -0
  92. package/lib/module/shared/components/boundary/components/boundary-target.js +32 -32
  93. package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
  94. package/lib/module/shared/components/boundary/create-boundary-component.js +32 -97
  95. package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -1
  96. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +72 -55
  97. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  98. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +1 -0
  99. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  100. package/lib/module/shared/components/boundary/hooks/use-measurer.js +15 -3
  101. package/lib/module/shared/components/boundary/hooks/use-measurer.js.map +1 -1
  102. package/lib/module/shared/components/boundary/hooks/use-register-target.js +27 -0
  103. package/lib/module/shared/components/boundary/hooks/use-register-target.js.map +1 -0
  104. package/lib/module/shared/components/boundary/index.js +1 -1
  105. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +35 -0
  106. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -0
  107. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js +9 -0
  108. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js.map +1 -0
  109. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +189 -0
  110. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -0
  111. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js +33 -0
  112. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -0
  113. package/lib/module/shared/components/boundary/portal/components/{host.js → boundary-portal/components/host.js} +17 -16
  114. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -0
  115. package/lib/module/shared/components/boundary/portal/components/{portal-boundary-host.js → boundary-portal/components/portal-boundary-host.js} +11 -11
  116. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -0
  117. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +47 -0
  118. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -0
  119. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +1 -0
  120. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.js +9 -0
  121. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.js.map +1 -0
  122. package/lib/module/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/offset-style.js +1 -1
  123. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -0
  124. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +179 -0
  125. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -0
  126. package/lib/module/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-host-measurement.js +23 -5
  127. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -0
  128. package/lib/module/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-placeholder-styles.js +3 -6
  129. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.js.map +1 -0
  130. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js +29 -0
  131. package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -0
  132. package/lib/module/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-bounds.store.js +1 -1
  133. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +1 -0
  134. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -0
  135. package/lib/module/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/portal-boundary-host.store.js +5 -10
  136. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -0
  137. package/lib/module/shared/components/boundary/portal/index.js +1 -2
  138. package/lib/module/shared/components/boundary/portal/index.js.map +1 -1
  139. package/lib/module/shared/components/boundary/portal/teleport.js +2 -2
  140. package/lib/module/shared/components/boundary/portal/utils/naming.js +0 -12
  141. package/lib/module/shared/components/boundary/portal/utils/naming.js.map +1 -1
  142. package/lib/module/shared/components/boundary/portal/utils/ownership.js +16 -52
  143. package/lib/module/shared/components/boundary/portal/utils/ownership.js.map +1 -1
  144. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +74 -20
  145. package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
  146. package/lib/module/shared/components/boundary/utils/destination-signals.js +39 -10
  147. package/lib/module/shared/components/boundary/utils/destination-signals.js.map +1 -1
  148. package/lib/module/shared/components/boundary/utils/measured-bounds.js +34 -0
  149. package/lib/module/shared/components/boundary/utils/measured-bounds.js.map +1 -1
  150. package/lib/module/shared/components/screen-container/layers/content.js +1 -1
  151. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  152. package/lib/module/shared/configs/presets.js +2 -2
  153. package/lib/module/shared/configs/presets.js.map +1 -1
  154. package/lib/module/shared/index.js +1 -0
  155. package/lib/module/shared/index.js.map +1 -1
  156. package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js +6 -1
  157. package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js.map +1 -1
  158. package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js +45 -0
  159. package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js.map +1 -0
  160. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +7 -1
  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 +2 -1
  163. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  164. package/lib/module/shared/providers/screen/styles/slot.provider.js +5 -3
  165. package/lib/module/shared/providers/screen/styles/slot.provider.js.map +1 -1
  166. package/lib/module/shared/providers/screen/styles/stores/slot-references.store.js +1 -1
  167. package/lib/module/shared/providers/screen/styles/stores/slot-references.store.js.map +1 -1
  168. package/lib/module/shared/stores/system.store.js +10 -2
  169. package/lib/module/shared/stores/system.store.js.map +1 -1
  170. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js +15 -9
  171. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  172. package/lib/module/shared/utils/bounds/navigation/reveal/build.js +2 -2
  173. package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  174. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +3 -3
  175. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  176. package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts +4 -1
  177. package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts.map +1 -1
  178. package/lib/typescript/shared/animation/transition-blocking.d.ts +33 -0
  179. package/lib/typescript/shared/animation/transition-blocking.d.ts.map +1 -0
  180. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
  181. package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -1
  182. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts +2 -1
  183. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
  184. package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
  185. package/lib/typescript/shared/components/boundary/hooks/use-measurer.d.ts.map +1 -1
  186. package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts +10 -0
  187. package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts.map +1 -0
  188. package/lib/typescript/shared/components/boundary/index.d.ts +2 -2
  189. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/components/host.d.ts +10 -0
  190. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/components/host.d.ts.map +1 -0
  191. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.d.ts +2 -0
  192. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.d.ts.map +1 -0
  193. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts +12 -0
  194. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -0
  195. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts +11 -0
  196. package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +1 -0
  197. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -0
  198. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -0
  199. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts +14 -0
  200. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts.map +1 -0
  201. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts +3 -0
  202. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts.map +1 -0
  203. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.d.ts +2 -0
  204. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.d.ts.map +1 -0
  205. package/lib/typescript/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/offset-style.d.ts +1 -1
  206. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +1 -0
  207. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +12 -0
  208. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -0
  209. package/lib/typescript/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-host-measurement.d.ts +5 -1
  210. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -0
  211. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.d.ts +12 -0
  212. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.d.ts.map +1 -0
  213. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts +13 -0
  214. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -0
  215. package/lib/typescript/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-bounds.store.d.ts +1 -1
  216. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.d.ts.map +1 -0
  217. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts.map +1 -0
  218. package/lib/typescript/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/portal-boundary-host.store.d.ts +3 -3
  219. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -0
  220. package/lib/typescript/shared/components/boundary/portal/index.d.ts +1 -2
  221. package/lib/typescript/shared/components/boundary/portal/index.d.ts.map +1 -1
  222. package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts +0 -2
  223. package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts.map +1 -1
  224. package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts +9 -10
  225. package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts.map +1 -1
  226. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +21 -21
  227. package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
  228. package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts +9 -2
  229. package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts.map +1 -1
  230. package/lib/typescript/shared/components/boundary/utils/measured-bounds.d.ts +8 -0
  231. package/lib/typescript/shared/components/boundary/utils/measured-bounds.d.ts.map +1 -1
  232. package/lib/typescript/shared/index.d.ts +1 -0
  233. package/lib/typescript/shared/index.d.ts.map +1 -1
  234. package/lib/typescript/shared/providers/screen/animation/helpers/read-screen-animation-revisions.d.ts +4 -1
  235. package/lib/typescript/shared/providers/screen/animation/helpers/read-screen-animation-revisions.d.ts.map +1 -1
  236. package/lib/typescript/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.d.ts +4 -0
  237. package/lib/typescript/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.d.ts.map +1 -0
  238. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  239. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +1 -0
  240. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
  241. package/lib/typescript/shared/providers/screen/styles/slot.provider.d.ts +1 -0
  242. package/lib/typescript/shared/providers/screen/styles/slot.provider.d.ts.map +1 -1
  243. package/lib/typescript/shared/providers/screen/styles/stores/slot-references.store.d.ts.map +1 -1
  244. package/lib/typescript/shared/stores/system.store.d.ts.map +1 -1
  245. package/lib/typescript/shared/types/animation.types.d.ts +3 -3
  246. package/lib/typescript/shared/types/bounds.types.d.ts +7 -2
  247. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  248. package/lib/typescript/shared/utils/bounds/helpers/create-bounds-accessor-core.d.ts.map +1 -1
  249. package/lib/typescript/shared/utils/bounds/types/options.d.ts +6 -2
  250. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  251. package/package.json +1 -1
  252. package/src/shared/adapters/with-screen-transitions/index.tsx +30 -9
  253. package/src/shared/animation/transition-blocking.ts +79 -0
  254. package/src/shared/components/boundary/components/boundary-target.tsx +43 -50
  255. package/src/shared/components/boundary/create-boundary-component.tsx +35 -150
  256. package/src/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +103 -81
  257. package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +1 -0
  258. package/src/shared/components/boundary/hooks/use-measurer.ts +12 -4
  259. package/src/shared/components/boundary/hooks/use-register-target.ts +43 -0
  260. package/src/shared/components/boundary/index.tsx +2 -2
  261. package/src/shared/components/boundary/portal/components/boundary-content-portal/components/host.tsx +48 -0
  262. package/src/shared/components/boundary/portal/components/boundary-content-portal/helpers/host-name.ts +9 -0
  263. package/src/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +274 -0
  264. package/src/shared/components/boundary/portal/components/boundary-content-portal/index.tsx +59 -0
  265. package/src/shared/components/boundary/portal/components/{host.tsx → boundary-portal/components/host.tsx} +14 -15
  266. package/src/shared/components/boundary/portal/components/{portal-boundary-host.tsx → boundary-portal/components/portal-boundary-host.tsx} +12 -12
  267. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.tsx +80 -0
  268. package/src/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/has-local-slot.ts +1 -1
  269. package/src/shared/components/boundary/portal/components/boundary-portal/helpers/host-name.ts +10 -0
  270. package/src/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/offset-style.ts +2 -2
  271. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +250 -0
  272. package/src/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-host-measurement.ts +38 -8
  273. package/src/shared/components/boundary/portal/{hooks → components/boundary-portal/hooks}/use-placeholder-styles.ts +4 -15
  274. package/src/shared/components/boundary/portal/components/boundary-portal/index.tsx +38 -0
  275. package/src/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-bounds.store.ts +2 -2
  276. package/src/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/portal-boundary-host.store.ts +10 -15
  277. package/src/shared/components/boundary/portal/index.ts +1 -2
  278. package/src/shared/components/boundary/portal/teleport.ts +2 -2
  279. package/src/shared/components/boundary/portal/utils/naming.ts +0 -19
  280. package/src/shared/components/boundary/portal/utils/ownership.ts +32 -88
  281. package/src/shared/components/boundary/providers/boundary-root.provider.tsx +198 -78
  282. package/src/shared/components/boundary/utils/destination-signals.ts +38 -14
  283. package/src/shared/components/boundary/utils/measured-bounds.ts +48 -0
  284. package/src/shared/components/screen-container/layers/content.tsx +1 -1
  285. package/src/shared/configs/presets.ts +2 -2
  286. package/src/shared/index.ts +4 -0
  287. package/src/shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts +14 -0
  288. package/src/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.ts +75 -0
  289. package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +11 -0
  290. package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +1 -0
  291. package/src/shared/providers/screen/styles/slot.provider.tsx +4 -2
  292. package/src/shared/providers/screen/styles/stores/slot-references.store.ts +2 -1
  293. package/src/shared/stores/system.store.ts +10 -4
  294. package/src/shared/types/animation.types.ts +3 -3
  295. package/src/shared/types/bounds.types.ts +9 -2
  296. package/src/shared/utils/bounds/helpers/create-bounds-accessor-core.ts +18 -11
  297. package/src/shared/utils/bounds/navigation/reveal/build.ts +2 -2
  298. package/src/shared/utils/bounds/navigation/zoom/build.ts +3 -3
  299. package/src/shared/utils/bounds/types/options.ts +9 -2
  300. package/lib/commonjs/shared/components/boundary/portal/components/boundary-local-portal-host.js +0 -58
  301. package/lib/commonjs/shared/components/boundary/portal/components/boundary-local-portal-host.js.map +0 -1
  302. package/lib/commonjs/shared/components/boundary/portal/components/host.js.map +0 -1
  303. package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js.map +0 -1
  304. package/lib/commonjs/shared/components/boundary/portal/components/portal.js +0 -272
  305. package/lib/commonjs/shared/components/boundary/portal/components/portal.js.map +0 -1
  306. package/lib/commonjs/shared/components/boundary/portal/hooks/use-host-measurement.js.map +0 -1
  307. package/lib/commonjs/shared/components/boundary/portal/hooks/use-placeholder-styles.js.map +0 -1
  308. package/lib/commonjs/shared/components/boundary/portal/stores/host-bounds.store.js.map +0 -1
  309. package/lib/commonjs/shared/components/boundary/portal/stores/host-registry.store.js.map +0 -1
  310. package/lib/commonjs/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +0 -1
  311. package/lib/commonjs/shared/components/boundary/portal/utils/has-local-slot.js.map +0 -1
  312. package/lib/commonjs/shared/components/boundary/portal/utils/offset-style.js.map +0 -1
  313. package/lib/module/shared/components/boundary/portal/components/boundary-local-portal-host.js +0 -53
  314. package/lib/module/shared/components/boundary/portal/components/boundary-local-portal-host.js.map +0 -1
  315. package/lib/module/shared/components/boundary/portal/components/host.js.map +0 -1
  316. package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js.map +0 -1
  317. package/lib/module/shared/components/boundary/portal/components/portal.js +0 -267
  318. package/lib/module/shared/components/boundary/portal/components/portal.js.map +0 -1
  319. package/lib/module/shared/components/boundary/portal/hooks/use-host-measurement.js.map +0 -1
  320. package/lib/module/shared/components/boundary/portal/hooks/use-placeholder-styles.js.map +0 -1
  321. package/lib/module/shared/components/boundary/portal/stores/host-bounds.store.js.map +0 -1
  322. package/lib/module/shared/components/boundary/portal/stores/host-registry.store.js.map +0 -1
  323. package/lib/module/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +0 -1
  324. package/lib/module/shared/components/boundary/portal/utils/has-local-slot.js.map +0 -1
  325. package/lib/module/shared/components/boundary/portal/utils/offset-style.js.map +0 -1
  326. package/lib/typescript/shared/components/boundary/portal/components/boundary-local-portal-host.d.ts +0 -8
  327. package/lib/typescript/shared/components/boundary/portal/components/boundary-local-portal-host.d.ts.map +0 -1
  328. package/lib/typescript/shared/components/boundary/portal/components/host.d.ts.map +0 -1
  329. package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts.map +0 -1
  330. package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts +0 -20
  331. package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts.map +0 -1
  332. package/lib/typescript/shared/components/boundary/portal/hooks/use-host-measurement.d.ts.map +0 -1
  333. package/lib/typescript/shared/components/boundary/portal/hooks/use-placeholder-styles.d.ts +0 -17
  334. package/lib/typescript/shared/components/boundary/portal/hooks/use-placeholder-styles.d.ts.map +0 -1
  335. package/lib/typescript/shared/components/boundary/portal/stores/host-bounds.store.d.ts.map +0 -1
  336. package/lib/typescript/shared/components/boundary/portal/stores/host-registry.store.d.ts.map +0 -1
  337. package/lib/typescript/shared/components/boundary/portal/stores/portal-boundary-host.store.d.ts.map +0 -1
  338. package/lib/typescript/shared/components/boundary/portal/utils/has-local-slot.d.ts +0 -3
  339. package/lib/typescript/shared/components/boundary/portal/utils/has-local-slot.d.ts.map +0 -1
  340. package/lib/typescript/shared/components/boundary/portal/utils/offset-style.d.ts.map +0 -1
  341. package/src/shared/components/boundary/portal/components/boundary-local-portal-host.tsx +0 -66
  342. package/src/shared/components/boundary/portal/components/portal.tsx +0 -412
  343. /package/lib/commonjs/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/has-local-slot.js +0 -0
  344. /package/lib/commonjs/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-registry.store.js +0 -0
  345. /package/lib/module/shared/components/boundary/portal/{utils → components/boundary-portal/helpers}/has-local-slot.js +0 -0
  346. /package/lib/module/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-registry.store.js +0 -0
  347. /package/lib/typescript/shared/components/boundary/portal/components/{host.d.ts → boundary-portal/components/host.d.ts} +0 -0
  348. /package/lib/typescript/shared/components/boundary/portal/components/{portal-boundary-host.d.ts → boundary-portal/components/portal-boundary-host.d.ts} +0 -0
  349. /package/lib/typescript/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-registry.store.d.ts +0 -0
  350. /package/src/shared/components/boundary/portal/{stores → components/boundary-portal/stores}/host-registry.store.ts +0 -0
@@ -1,412 +0,0 @@
1
- import {
2
- type ComponentProps,
3
- type ComponentType,
4
- memo,
5
- type ReactNode,
6
- useCallback,
7
- useLayoutEffect,
8
- useState,
9
- } from "react";
10
- import type { View } from "react-native";
11
- import Animated, {
12
- type AnimatedRef,
13
- runOnJS,
14
- runOnUI,
15
- useAnimatedProps,
16
- useAnimatedReaction,
17
- useSharedValue,
18
- } from "react-native-reanimated";
19
- import { EPSILON } from "../../../../constants";
20
- import { useDescriptorsStore } from "../../../../providers/screen/descriptors";
21
- import { useScreenSlots } from "../../../../providers/screen/styles";
22
- import { useRegisteredScreenSlots } from "../../../../providers/screen/styles/stores/slot-references.store";
23
- import { AnimationStore } from "../../../../stores/animation.store";
24
- import { pairs } from "../../../../stores/bounds/internals/state";
25
- import { logger } from "../../../../utils/logger";
26
- import { usePlaceholderStyles } from "../hooks/use-placeholder-styles";
27
- import { useActiveHostKey } from "../stores/host-registry.store";
28
- import {
29
- dropStalePortalBoundaryHosts,
30
- mountPortalBoundaryHost,
31
- unmountPortalBoundaryHost,
32
- } from "../stores/portal-boundary-host.store";
33
- import { isTeleportAvailable, NativePortal } from "../teleport";
34
- import {
35
- createBoundaryLocalPortalHostName,
36
- createPortalBoundaryHostName,
37
- PORTAL_HOST_NAME_RESET_VALUE,
38
- } from "../utils/naming";
39
- import {
40
- canSwitchBoundaryLocalHandoffImmediately,
41
- type PortalOwnershipSignal,
42
- resolveBoundaryPortalOwnership,
43
- } from "../utils/ownership";
44
- import { shallowEqual } from "../utils/shallow-equal";
45
- import { shouldAttachBoundaryPortal } from "../utils/teleport-control";
46
- import { resolveNextVisiblePortalHostName } from "../utils/visible-host";
47
-
48
- type NullableHostNamePortalProps = Omit<
49
- ComponentProps<NonNullable<typeof NativePortal>>,
50
- "hostName"
51
- > & {
52
- hostName?: string | null;
53
- };
54
-
55
- const AnimatedNativePortal = NativePortal
56
- ? Animated.createAnimatedComponent(
57
- NativePortal as ComponentType<NullableHostNamePortalProps>,
58
- )
59
- : null;
60
-
61
- interface PortalProps {
62
- id?: string;
63
- children: ReactNode;
64
- handoff?: boolean;
65
- escapeClipping?: boolean;
66
- /**
67
- * Ref to the layout-preserving placeholder wrapper. Boundaries measure
68
- * this instead of teleported content — the placeholder keeps the source
69
- * slot at home while the content may physically live in another screen's
70
- * host.
71
- */
72
- placeholderRef?: AnimatedRef<View>;
73
- placeholderChildren?: ReactNode;
74
- }
75
-
76
- export const Portal = memo(function Portal({
77
- id,
78
- children,
79
- handoff = false,
80
- escapeClipping = false,
81
- placeholderRef,
82
- placeholderChildren,
83
- }: PortalProps) {
84
- // Teleporting requires the optional `react-native-teleport` peer and a stable
85
- // `id` to name the boundary host. Missing either degrades to inline rendering
86
- // (the `return children` path below).
87
- const isPortalEnabled =
88
- (handoff || escapeClipping) && isTeleportAvailable && id !== undefined;
89
-
90
- if (__DEV__ && (handoff || escapeClipping) && id === undefined) {
91
- logger.warnOnce(
92
- "portal:missing-id",
93
- "A handoff or escapeClipping boundary was rendered without an id; rendering inline.",
94
- );
95
- }
96
- const boundaryId = id ?? "";
97
- const ownScreenSlots = useScreenSlots();
98
- const sourcePairKey = useDescriptorsStore((s) => s.derivations.sourcePairKey);
99
- const currentScreenKey = useDescriptorsStore(
100
- (s) => s.derivations.currentScreenKey,
101
- );
102
-
103
- const [ownership, setOwnership] = useState<Extract<
104
- PortalOwnershipSignal,
105
- { status: "complete" }
106
- > | null>(null);
107
-
108
- const styleOwnerScreenKey = ownership?.ownerScreenKey ?? currentScreenKey;
109
- const ownerScreenSlots = useRegisteredScreenSlots(styleOwnerScreenKey);
110
- const activeScreenSlots = ownerScreenSlots ?? ownScreenSlots;
111
- const {
112
- localStylesMaps: activeLocalStylesMaps,
113
- nextInterpolatorReady: activeNextInterpolatorReady,
114
- slotsMap: activeSlotsMap,
115
- } = activeScreenSlots;
116
- const requestedPortalHostName = useSharedValue<string | null>(null);
117
- const visiblePortalHostName = useSharedValue<string | null>(null);
118
- const canSwitchPortalHostImmediately = useSharedValue(0);
119
-
120
- const targetScreenKey = ownership ? ownership.hostScreenKey : null;
121
- const settledHostScreenKey = ownership?.hostScreenKey ?? null;
122
- const settledHostProgress = AnimationStore.getValue(
123
- settledHostScreenKey ?? currentScreenKey,
124
- "progressSettled",
125
- );
126
- const settledHostAnimating = AnimationStore.getValue(
127
- settledHostScreenKey ?? currentScreenKey,
128
- "progressAnimating",
129
- );
130
- const settledHostClosing = AnimationStore.getValue(
131
- settledHostScreenKey ?? currentScreenKey,
132
- "closing",
133
- );
134
- const settledHostVisualProgress = AnimationStore.getValue(
135
- settledHostScreenKey ?? currentScreenKey,
136
- "visualProgress",
137
- );
138
-
139
- const activeHostKey = useActiveHostKey(
140
- escapeClipping ? targetScreenKey : null,
141
- );
142
- const boundaryLocalHostName =
143
- handoff && !escapeClipping && targetScreenKey
144
- ? createBoundaryLocalPortalHostName(targetScreenKey, boundaryId)
145
- : null;
146
-
147
- const updatePortalOwnership = useCallback(
148
- (
149
- hostScreenKey: string | null,
150
- ownerPairKey?: string,
151
- ownerScreenKey?: string,
152
- ) => {
153
- if (hostScreenKey && ownerPairKey && ownerScreenKey) {
154
- setOwnership((current) => {
155
- if (
156
- current?.hostScreenKey === hostScreenKey &&
157
- current.ownerPairKey === ownerPairKey &&
158
- current.ownerScreenKey === ownerScreenKey
159
- ) {
160
- return current;
161
- }
162
-
163
- return {
164
- hostScreenKey,
165
- ownerPairKey,
166
- ownerScreenKey,
167
- status: "complete",
168
- };
169
- });
170
- return;
171
- }
172
-
173
- setOwnership((current) => (current ? null : current));
174
- },
175
- [],
176
- );
177
-
178
- useLayoutEffect(() => {
179
- if (!isPortalEnabled || !ownership || !targetScreenKey) {
180
- requestedPortalHostName.set(null);
181
- visiblePortalHostName.set(null);
182
- unmountPortalBoundaryHost(boundaryId);
183
- return;
184
- }
185
-
186
- if (boundaryLocalHostName) {
187
- requestedPortalHostName.set(boundaryLocalHostName);
188
- unmountPortalBoundaryHost(boundaryId);
189
- return;
190
- }
191
-
192
- if (!escapeClipping || !activeHostKey) {
193
- requestedPortalHostName.set(null);
194
- visiblePortalHostName.set(null);
195
- unmountPortalBoundaryHost(boundaryId);
196
- return;
197
- }
198
-
199
- const portalHostName = createPortalBoundaryHostName(
200
- activeHostKey,
201
- boundaryId,
202
- ownership.ownerPairKey,
203
- );
204
-
205
- mountPortalBoundaryHost({
206
- boundaryId,
207
- escapeClipping,
208
- hostKey: activeHostKey,
209
- localStylesMaps: activeLocalStylesMaps,
210
- pairKey: ownership.ownerPairKey,
211
- portalHostName,
212
- screenKey: targetScreenKey,
213
- slotsMap: activeSlotsMap,
214
- });
215
-
216
- // Request the new receiver immediately, but keep the currently visible
217
- // receiver until the new interpolator is ready. This avoids a no-host gap
218
- // during A -> B(closing) -> C(opening) spam retargets.
219
- requestedPortalHostName.set(portalHostName);
220
- }, [
221
- activeHostKey,
222
- boundaryId,
223
- escapeClipping,
224
- isPortalEnabled,
225
- activeLocalStylesMaps,
226
- activeSlotsMap,
227
- ownership,
228
- boundaryLocalHostName,
229
- requestedPortalHostName,
230
- targetScreenKey,
231
- visiblePortalHostName,
232
- ]);
233
-
234
- useLayoutEffect(() => {
235
- return () => {
236
- requestedPortalHostName.set(null);
237
- visiblePortalHostName.set(null);
238
- unmountPortalBoundaryHost(boundaryId);
239
- };
240
- }, [boundaryId, requestedPortalHostName, visiblePortalHostName]);
241
-
242
- useAnimatedReaction(
243
- () => {
244
- "worklet";
245
- if (!isPortalEnabled || !sourcePairKey) {
246
- return {
247
- hostScreenKey: null,
248
- ownerPairKey: sourcePairKey,
249
- ownerScreenKey: null,
250
- status: "clear",
251
- };
252
- }
253
-
254
- return resolveBoundaryPortalOwnership({
255
- boundaryId,
256
- currentScreenKey,
257
- escapeClipping,
258
- handoff,
259
- isSettledHostClosingComplete:
260
- !!settledHostClosing.get() &&
261
- settledHostVisualProgress.get() <= EPSILON,
262
- isSettledHostReady:
263
- settledHostProgress.get() === 1 && settledHostAnimating.get() === 0,
264
- pairsState: pairs.get(),
265
- settledHostScreenKey,
266
- sourcePairKey,
267
- });
268
- },
269
- (signal, previousSignal) => {
270
- "worklet";
271
- if (shallowEqual(previousSignal, signal)) {
272
- return;
273
- }
274
-
275
- if (!handoff || escapeClipping) {
276
- canSwitchPortalHostImmediately.set(0);
277
- } else if (signal.status === "pending") {
278
- canSwitchPortalHostImmediately.set(0);
279
- return;
280
- } else {
281
- const hostScreenKey =
282
- signal.status === "complete" ? signal.hostScreenKey : null;
283
- let previousOwnerPairKey: string | undefined;
284
-
285
- if (previousSignal?.status === "complete") {
286
- previousOwnerPairKey = previousSignal.ownerPairKey ?? undefined;
287
- }
288
- const canSwitchImmediately = canSwitchBoundaryLocalHandoffImmediately({
289
- hostScreenKey,
290
- ownerPairKey:
291
- signal.status === "complete" ? signal.ownerPairKey : undefined,
292
- previousOwnerPairKey,
293
- });
294
-
295
- canSwitchPortalHostImmediately.set(canSwitchImmediately ? 1 : 0);
296
-
297
- if (canSwitchImmediately && hostScreenKey) {
298
- const hostName = createBoundaryLocalPortalHostName(
299
- hostScreenKey,
300
- boundaryId,
301
- );
302
- requestedPortalHostName.set(hostName);
303
- visiblePortalHostName.set(hostName);
304
- }
305
- }
306
-
307
- runOnJS(updatePortalOwnership)(
308
- signal.hostScreenKey,
309
- signal.ownerPairKey,
310
- signal.ownerScreenKey ?? undefined,
311
- );
312
- },
313
- );
314
-
315
- useAnimatedReaction(
316
- () => {
317
- "worklet";
318
- const slot = activeSlotsMap.get()[boundaryId];
319
- const teleport = slot?.props?.teleport;
320
- const shouldTeleport = shouldAttachBoundaryPortal({
321
- enabled: isPortalEnabled,
322
- teleport,
323
- });
324
- const requestedName = requestedPortalHostName.get();
325
- const visibleName = visiblePortalHostName.get();
326
- const isInterpolatorReady = activeNextInterpolatorReady.get();
327
- const nextVisibleName = resolveNextVisiblePortalHostName({
328
- canSwitchImmediately: canSwitchPortalHostImmediately.get() === 1,
329
- isInterpolatorReady: isInterpolatorReady === 1,
330
- requestedName,
331
- shouldTeleport,
332
- visibleName,
333
- });
334
-
335
- return {
336
- isInterpolatorReady,
337
- nextVisibleName,
338
- requestedName,
339
- shouldTeleport,
340
- teleport,
341
- visibleName,
342
- };
343
- },
344
- (state, previousState) => {
345
- "worklet";
346
- if (shallowEqual(previousState, state)) {
347
- return;
348
- }
349
-
350
- if (state.nextVisibleName !== state.visibleName) {
351
- visiblePortalHostName.set(state.nextVisibleName);
352
- return;
353
- }
354
-
355
- // Visible receiver has caught up to the request: GC the superseded hosts.
356
- if (state.visibleName && state.visibleName === state.requestedName) {
357
- runOnJS(dropStalePortalBoundaryHosts)({
358
- boundaryId,
359
- keepPortalHostName: state.visibleName,
360
- });
361
- }
362
- },
363
- );
364
-
365
- const teleportProps = useAnimatedProps(() => {
366
- "worklet";
367
-
368
- const slot = activeSlotsMap.get()[boundaryId];
369
- const { teleport, ...slotProps } = slot?.props ?? {};
370
- const shouldTeleport = shouldAttachBoundaryPortal({
371
- enabled: isPortalEnabled,
372
- teleport,
373
- });
374
- const visibleName = visiblePortalHostName.get();
375
-
376
- return {
377
- // Preserve portal slot props from the interpolator while keeping
378
- // hostName owned by the attachment gate below. Handoff
379
- // waits until the receiving interpolator owns styles for the same host;
380
- // after that, it stays attached until teleport is disabled or retargeted.
381
- ...slotProps,
382
- hostName:
383
- shouldTeleport && visibleName
384
- ? visibleName
385
- : PORTAL_HOST_NAME_RESET_VALUE,
386
- };
387
- });
388
-
389
- const { handleOnLayout, placeholderStyle } = usePlaceholderStyles({
390
- visiblePortalHostName,
391
- });
392
-
393
- if (isPortalEnabled && AnimatedNativePortal) {
394
- return (
395
- <Animated.View
396
- ref={placeholderRef}
397
- onLayout={({ nativeEvent: { layout } }) =>
398
- runOnUI(handleOnLayout)(layout)
399
- }
400
- style={placeholderStyle}
401
- collapsable={false}
402
- >
403
- {placeholderChildren}
404
- <AnimatedNativePortal animatedProps={teleportProps} name={boundaryId}>
405
- {children}
406
- </AnimatedNativePortal>
407
- </Animated.View>
408
- );
409
- }
410
-
411
- return children;
412
- });