react-native-screen-transitions 3.8.0-beta.1 → 3.9.0-alpha.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 (485) hide show
  1. package/lib/commonjs/blank-stack/components/stack-view.js +2 -1
  2. package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
  3. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/components/boundary-target.js +21 -8
  4. package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -0
  5. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/create-boundary-component.js +10 -24
  6. package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -0
  7. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-presence.js.map +1 -0
  8. package/lib/commonjs/shared/components/boundary/hooks/use-initial-destination-measurement.js +115 -0
  9. package/lib/commonjs/shared/components/boundary/hooks/use-initial-destination-measurement.js.map +1 -0
  10. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/hooks/use-initial-source-measurement.js +4 -5
  11. package/lib/commonjs/shared/components/boundary/hooks/use-initial-source-measurement.js.map +1 -0
  12. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/hooks/use-measurer.js +26 -22
  13. package/lib/commonjs/shared/components/boundary/hooks/use-measurer.js.map +1 -0
  14. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/hooks/use-refresh-boundary.js +10 -7
  15. package/lib/commonjs/shared/components/boundary/hooks/use-refresh-boundary.js.map +1 -0
  16. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/index.js +8 -1
  17. package/lib/commonjs/shared/components/boundary/index.js.map +1 -0
  18. package/lib/commonjs/shared/components/boundary/portal/components/host.js +99 -0
  19. package/lib/commonjs/shared/components/boundary/portal/components/host.js.map +1 -0
  20. package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js +68 -0
  21. package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -0
  22. package/lib/commonjs/shared/components/boundary/portal/components/portal-provider.js +17 -0
  23. package/lib/commonjs/shared/components/boundary/portal/components/portal-provider.js.map +1 -0
  24. package/lib/commonjs/shared/components/boundary/portal/components/portal.js +195 -0
  25. package/lib/commonjs/shared/components/boundary/portal/components/portal.js.map +1 -0
  26. package/lib/commonjs/shared/components/boundary/portal/hooks/use-host-measurement.js +74 -0
  27. package/lib/commonjs/shared/components/boundary/portal/hooks/use-host-measurement.js.map +1 -0
  28. package/lib/commonjs/shared/components/boundary/portal/index.js +27 -0
  29. package/lib/commonjs/shared/components/boundary/portal/index.js.map +1 -0
  30. package/lib/commonjs/shared/components/boundary/portal/stores/host-bounds.store.js +47 -0
  31. package/lib/commonjs/shared/components/boundary/portal/stores/host-bounds.store.js.map +1 -0
  32. package/lib/commonjs/shared/components/boundary/portal/stores/host-registry.store.js +137 -0
  33. package/lib/commonjs/shared/components/boundary/portal/stores/host-registry.store.js.map +1 -0
  34. package/lib/commonjs/shared/components/boundary/portal/stores/portal-boundary-host.store.js +60 -0
  35. package/lib/commonjs/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -0
  36. package/lib/commonjs/shared/components/boundary/portal/utils/attachment.js +40 -0
  37. package/lib/commonjs/shared/components/boundary/portal/utils/attachment.js.map +1 -0
  38. package/lib/commonjs/shared/components/boundary/portal/utils/naming.js +15 -0
  39. package/lib/commonjs/shared/components/boundary/portal/utils/naming.js.map +1 -0
  40. package/lib/commonjs/shared/components/boundary/portal/utils/offset-style.js +71 -0
  41. package/lib/commonjs/shared/components/boundary/portal/utils/offset-style.js.map +1 -0
  42. package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js +16 -0
  43. package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js.map +1 -0
  44. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/providers/boundary-owner.provider.js +26 -25
  45. package/lib/commonjs/shared/components/boundary/providers/boundary-owner.provider.js.map +1 -0
  46. package/lib/commonjs/shared/components/boundary/types.js.map +1 -0
  47. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js +25 -0
  48. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js.map +1 -0
  49. package/lib/commonjs/shared/components/{create-boundary-component → boundary}/utils/measured-bounds.js +19 -9
  50. package/lib/commonjs/shared/components/boundary/utils/measured-bounds.js.map +1 -0
  51. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +105 -0
  52. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -0
  53. package/lib/commonjs/shared/components/boundary/utils/source-signals.js +48 -0
  54. package/lib/commonjs/shared/components/boundary/utils/source-signals.js.map +1 -0
  55. package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -3
  56. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  57. package/lib/commonjs/shared/components/{integrations/masked-view.js → masked-view.js} +2 -2
  58. package/lib/commonjs/shared/components/masked-view.js.map +1 -0
  59. package/lib/commonjs/shared/components/screen-container/layers/content.js +9 -5
  60. package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
  61. package/lib/commonjs/shared/configs/presets.js +6 -6
  62. package/lib/commonjs/shared/configs/presets.js.map +1 -1
  63. package/lib/commonjs/shared/index.js +4 -4
  64. package/lib/commonjs/shared/index.js.map +1 -1
  65. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js +4 -2
  66. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
  67. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js +7 -3
  68. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  69. package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +8 -1
  70. package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  71. package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +21 -6
  72. package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  73. package/lib/commonjs/shared/providers/screen/origin.provider.js +41 -0
  74. package/lib/commonjs/shared/providers/screen/origin.provider.js.map +1 -0
  75. package/lib/commonjs/shared/providers/screen/styles/constants.js +2 -0
  76. package/lib/commonjs/shared/providers/screen/styles/constants.js.map +1 -1
  77. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.js +58 -0
  78. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.js.map +1 -0
  79. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +7 -0
  80. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
  81. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +2 -1
  82. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  83. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +7 -5
  84. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  85. package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js +1 -10
  86. package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -1
  87. package/lib/commonjs/shared/stores/bounds/index.js.map +1 -1
  88. package/lib/commonjs/shared/stores/bounds/internals/entries.js.map +1 -1
  89. package/lib/commonjs/shared/stores/bounds/internals/links.js +36 -19
  90. package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
  91. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +6 -4
  92. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  93. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  94. package/lib/commonjs/shared/stores/scroll.store.js +54 -1
  95. package/lib/commonjs/shared/stores/scroll.store.js.map +1 -1
  96. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js +38 -4
  97. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -1
  98. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js +40 -87
  99. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  100. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js +6 -67
  101. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  102. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +8 -12
  103. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  104. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js +235 -68
  105. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -1
  106. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js +74 -4
  107. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
  108. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +5 -9
  109. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  110. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +5 -10
  111. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  112. package/lib/module/blank-stack/components/stack-view.js +3 -2
  113. package/lib/module/blank-stack/components/stack-view.js.map +1 -1
  114. package/lib/module/shared/components/{create-boundary-component → boundary}/components/boundary-target.js +21 -8
  115. package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -0
  116. package/lib/module/shared/components/{create-boundary-component → boundary}/create-boundary-component.js +11 -25
  117. package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -0
  118. package/lib/module/shared/components/boundary/hooks/use-boundary-presence.js.map +1 -0
  119. package/lib/module/shared/components/boundary/hooks/use-initial-destination-measurement.js +110 -0
  120. package/lib/module/shared/components/boundary/hooks/use-initial-destination-measurement.js.map +1 -0
  121. package/lib/module/shared/components/{create-boundary-component → boundary}/hooks/use-initial-source-measurement.js +4 -5
  122. package/lib/module/shared/components/boundary/hooks/use-initial-source-measurement.js.map +1 -0
  123. package/lib/module/shared/components/{create-boundary-component → boundary}/hooks/use-measurer.js +27 -23
  124. package/lib/module/shared/components/boundary/hooks/use-measurer.js.map +1 -0
  125. package/lib/module/shared/components/{create-boundary-component → boundary}/hooks/use-refresh-boundary.js +10 -7
  126. package/lib/module/shared/components/boundary/hooks/use-refresh-boundary.js.map +1 -0
  127. package/lib/module/shared/components/{create-boundary-component → boundary}/index.js +8 -1
  128. package/lib/module/shared/components/boundary/index.js.map +1 -0
  129. package/lib/module/shared/components/boundary/portal/components/host.js +94 -0
  130. package/lib/module/shared/components/boundary/portal/components/host.js.map +1 -0
  131. package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js +63 -0
  132. package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -0
  133. package/lib/module/shared/components/boundary/portal/components/portal-provider.js +13 -0
  134. package/lib/module/shared/components/boundary/portal/components/portal-provider.js.map +1 -0
  135. package/lib/module/shared/components/boundary/portal/components/portal.js +190 -0
  136. package/lib/module/shared/components/boundary/portal/components/portal.js.map +1 -0
  137. package/lib/module/shared/components/boundary/portal/hooks/use-host-measurement.js +69 -0
  138. package/lib/module/shared/components/boundary/portal/hooks/use-host-measurement.js.map +1 -0
  139. package/lib/module/shared/components/boundary/portal/index.js +6 -0
  140. package/lib/module/shared/components/boundary/portal/index.js.map +1 -0
  141. package/lib/module/shared/components/boundary/portal/stores/host-bounds.store.js +40 -0
  142. package/lib/module/shared/components/boundary/portal/stores/host-bounds.store.js.map +1 -0
  143. package/lib/module/shared/components/boundary/portal/stores/host-registry.store.js +126 -0
  144. package/lib/module/shared/components/boundary/portal/stores/host-registry.store.js.map +1 -0
  145. package/lib/module/shared/components/boundary/portal/stores/portal-boundary-host.store.js +53 -0
  146. package/lib/module/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -0
  147. package/lib/module/shared/components/boundary/portal/utils/attachment.js +35 -0
  148. package/lib/module/shared/components/boundary/portal/utils/attachment.js.map +1 -0
  149. package/lib/module/shared/components/boundary/portal/utils/naming.js +10 -0
  150. package/lib/module/shared/components/boundary/portal/utils/naming.js.map +1 -0
  151. package/lib/module/shared/components/boundary/portal/utils/offset-style.js +66 -0
  152. package/lib/module/shared/components/boundary/portal/utils/offset-style.js.map +1 -0
  153. package/lib/module/shared/components/boundary/portal/utils/teleport-control.js +11 -0
  154. package/lib/module/shared/components/boundary/portal/utils/teleport-control.js.map +1 -0
  155. package/lib/module/shared/components/boundary/providers/boundary-owner.provider.js +60 -0
  156. package/lib/module/shared/components/boundary/providers/boundary-owner.provider.js.map +1 -0
  157. package/lib/module/shared/components/boundary/types.js.map +1 -0
  158. package/lib/module/shared/components/boundary/utils/destination-signals.js +20 -0
  159. package/lib/module/shared/components/boundary/utils/destination-signals.js.map +1 -0
  160. package/lib/module/shared/components/{create-boundary-component → boundary}/utils/measured-bounds.js +16 -7
  161. package/lib/module/shared/components/boundary/utils/measured-bounds.js.map +1 -0
  162. package/lib/module/shared/components/boundary/utils/refresh-signals.js +100 -0
  163. package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -0
  164. package/lib/module/shared/components/boundary/utils/source-signals.js +43 -0
  165. package/lib/module/shared/components/boundary/utils/source-signals.js.map +1 -0
  166. package/lib/module/shared/components/create-transition-aware-component.js +8 -3
  167. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  168. package/lib/module/shared/components/{integrations/masked-view.js → masked-view.js} +2 -2
  169. package/lib/module/shared/components/masked-view.js.map +1 -0
  170. package/lib/module/shared/components/screen-container/layers/content.js +10 -6
  171. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  172. package/lib/module/shared/configs/presets.js +6 -6
  173. package/lib/module/shared/configs/presets.js.map +1 -1
  174. package/lib/module/shared/index.js +2 -2
  175. package/lib/module/shared/index.js.map +1 -1
  176. package/lib/module/shared/providers/helpers/measured-bounds-writes.js +4 -2
  177. package/lib/module/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
  178. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js +8 -4
  179. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  180. package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +8 -1
  181. package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  182. package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +20 -6
  183. package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  184. package/lib/module/shared/providers/screen/origin.provider.js +33 -0
  185. package/lib/module/shared/providers/screen/origin.provider.js.map +1 -0
  186. package/lib/module/shared/providers/screen/styles/constants.js +2 -0
  187. package/lib/module/shared/providers/screen/styles/constants.js.map +1 -1
  188. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.js +53 -0
  189. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.js.map +1 -0
  190. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +1 -0
  191. package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
  192. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +2 -1
  193. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  194. package/lib/module/shared/providers/screen/styles/styles.provider.js +7 -5
  195. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  196. package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js +1 -8
  197. package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -1
  198. package/lib/module/shared/stores/bounds/index.js.map +1 -1
  199. package/lib/module/shared/stores/bounds/internals/entries.js.map +1 -1
  200. package/lib/module/shared/stores/bounds/internals/links.js +36 -19
  201. package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
  202. package/lib/module/shared/stores/bounds/internals/resolver.js +6 -4
  203. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  204. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  205. package/lib/module/shared/stores/scroll.store.js +50 -0
  206. package/lib/module/shared/stores/scroll.store.js.map +1 -1
  207. package/lib/module/shared/types/animation.types.js.map +1 -1
  208. package/lib/module/shared/types/bounds.types.js.map +1 -1
  209. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js +36 -3
  210. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -1
  211. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js +42 -89
  212. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  213. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js +6 -67
  214. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  215. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +8 -13
  216. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  217. package/lib/module/shared/utils/bounds/helpers/styles/composers.js +236 -69
  218. package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -1
  219. package/lib/module/shared/utils/bounds/helpers/styles/compute.js +74 -4
  220. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
  221. package/lib/module/shared/utils/bounds/navigation/reveal/build.js +5 -9
  222. package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  223. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +5 -10
  224. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  225. package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
  226. package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -0
  227. package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -0
  228. package/lib/typescript/shared/components/boundary/hooks/use-boundary-presence.d.ts.map +1 -0
  229. package/lib/typescript/shared/components/{create-boundary-component → boundary}/hooks/use-initial-destination-measurement.d.ts +1 -4
  230. package/lib/typescript/shared/components/boundary/hooks/use-initial-destination-measurement.d.ts.map +1 -0
  231. package/lib/typescript/shared/components/{create-boundary-component → boundary}/hooks/use-initial-source-measurement.d.ts +0 -2
  232. package/lib/typescript/shared/components/boundary/hooks/use-initial-source-measurement.d.ts.map +1 -0
  233. package/lib/typescript/shared/components/{create-boundary-component → boundary}/hooks/use-measurer.d.ts +4 -2
  234. package/lib/typescript/shared/components/boundary/hooks/use-measurer.d.ts.map +1 -0
  235. package/lib/typescript/shared/components/boundary/hooks/use-refresh-boundary.d.ts +10 -0
  236. package/lib/typescript/shared/components/boundary/hooks/use-refresh-boundary.d.ts.map +1 -0
  237. package/lib/typescript/shared/components/{create-boundary-component → boundary}/index.d.ts +8 -2
  238. package/lib/typescript/shared/components/boundary/index.d.ts.map +1 -0
  239. package/lib/typescript/shared/components/boundary/portal/components/host.d.ts +7 -0
  240. package/lib/typescript/shared/components/boundary/portal/components/host.d.ts.map +1 -0
  241. package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts +9 -0
  242. package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts.map +1 -0
  243. package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts +4 -0
  244. package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts.map +1 -0
  245. package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts +19 -0
  246. package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts.map +1 -0
  247. package/lib/typescript/shared/components/boundary/portal/hooks/use-host-measurement.d.ts +13 -0
  248. package/lib/typescript/shared/components/boundary/portal/hooks/use-host-measurement.d.ts.map +1 -0
  249. package/lib/typescript/shared/components/boundary/portal/index.d.ts +4 -0
  250. package/lib/typescript/shared/components/boundary/portal/index.d.ts.map +1 -0
  251. package/lib/typescript/shared/components/boundary/portal/stores/host-bounds.store.d.ts +9 -0
  252. package/lib/typescript/shared/components/boundary/portal/stores/host-bounds.store.d.ts.map +1 -0
  253. package/lib/typescript/shared/components/boundary/portal/stores/host-registry.store.d.ts +19 -0
  254. package/lib/typescript/shared/components/boundary/portal/stores/host-registry.store.d.ts.map +1 -0
  255. package/lib/typescript/shared/components/boundary/portal/stores/portal-boundary-host.store.d.ts +11 -0
  256. package/lib/typescript/shared/components/boundary/portal/stores/portal-boundary-host.store.d.ts.map +1 -0
  257. package/lib/typescript/shared/components/boundary/portal/utils/attachment.d.ts +21 -0
  258. package/lib/typescript/shared/components/boundary/portal/utils/attachment.d.ts.map +1 -0
  259. package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts +3 -0
  260. package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts.map +1 -0
  261. package/lib/typescript/shared/components/boundary/portal/utils/offset-style.d.ts +37 -0
  262. package/lib/typescript/shared/components/boundary/portal/utils/offset-style.d.ts.map +1 -0
  263. package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts +3 -0
  264. package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts.map +1 -0
  265. package/lib/typescript/shared/components/{create-boundary-component → boundary}/providers/boundary-owner.provider.d.ts +14 -6
  266. package/lib/typescript/shared/components/boundary/providers/boundary-owner.provider.d.ts.map +1 -0
  267. package/lib/typescript/shared/components/boundary/types.d.ts +78 -0
  268. package/lib/typescript/shared/components/boundary/types.d.ts.map +1 -0
  269. package/lib/typescript/shared/components/{create-boundary-component → boundary}/utils/destination-signals.d.ts +2 -3
  270. package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts.map +1 -0
  271. package/lib/typescript/shared/components/boundary/utils/measured-bounds.d.ts +12 -0
  272. package/lib/typescript/shared/components/boundary/utils/measured-bounds.d.ts.map +1 -0
  273. package/lib/typescript/shared/components/{create-boundary-component → boundary}/utils/refresh-signals.d.ts +4 -3
  274. package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -0
  275. package/lib/typescript/shared/components/{create-boundary-component → boundary}/utils/source-signals.d.ts +1 -2
  276. package/lib/typescript/shared/components/boundary/utils/source-signals.d.ts.map +1 -0
  277. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  278. package/lib/typescript/shared/components/masked-view.d.ts.map +1 -0
  279. package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
  280. package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
  281. package/lib/typescript/shared/index.d.ts +19 -17
  282. package/lib/typescript/shared/index.d.ts.map +1 -1
  283. package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts +3 -1
  284. package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts.map +1 -1
  285. package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
  286. package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts +6 -1
  287. package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts.map +1 -1
  288. package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts +9 -3
  289. package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts.map +1 -1
  290. package/lib/typescript/shared/providers/screen/origin.provider.d.ts +11 -0
  291. package/lib/typescript/shared/providers/screen/origin.provider.d.ts.map +1 -0
  292. package/lib/typescript/shared/providers/screen/styles/constants.d.ts.map +1 -1
  293. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.d.ts +3 -0
  294. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.d.ts.map +1 -0
  295. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts +1 -0
  296. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
  297. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +1 -0
  298. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
  299. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts +1 -0
  300. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
  301. package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts +1 -3
  302. package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts.map +1 -1
  303. package/lib/typescript/shared/stores/bounds/index.d.ts +1 -1
  304. package/lib/typescript/shared/stores/bounds/index.d.ts.map +1 -1
  305. package/lib/typescript/shared/stores/bounds/internals/entries.d.ts +2 -2
  306. package/lib/typescript/shared/stores/bounds/internals/entries.d.ts.map +1 -1
  307. package/lib/typescript/shared/stores/bounds/internals/links.d.ts +2 -2
  308. package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
  309. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  310. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +4 -2
  311. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  312. package/lib/typescript/shared/stores/bounds/types.d.ts +47 -12
  313. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  314. package/lib/typescript/shared/stores/scroll.store.d.ts +12 -1
  315. package/lib/typescript/shared/stores/scroll.store.d.ts.map +1 -1
  316. package/lib/typescript/shared/types/animation.types.d.ts +13 -2
  317. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  318. package/lib/typescript/shared/types/bounds.types.d.ts +10 -40
  319. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  320. package/lib/typescript/shared/types/index.d.ts +2 -2
  321. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  322. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +2 -1
  323. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -1
  324. package/lib/typescript/shared/utils/bounds/helpers/create-bounds-accessor-core.d.ts +7 -11
  325. package/lib/typescript/shared/utils/bounds/helpers/create-bounds-accessor-core.d.ts.map +1 -1
  326. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts +0 -3
  327. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
  328. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +7 -3
  329. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -1
  330. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts +3 -0
  331. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -1
  332. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts +1 -1
  333. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -1
  334. package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
  335. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
  336. package/lib/typescript/shared/utils/bounds/types/options.d.ts +93 -6
  337. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  338. package/package.json +3 -2
  339. package/src/blank-stack/components/stack-view.tsx +4 -3
  340. package/src/shared/components/{create-boundary-component → boundary}/components/boundary-target.tsx +28 -11
  341. package/src/shared/components/{create-boundary-component → boundary}/create-boundary-component.tsx +20 -31
  342. package/src/shared/components/boundary/hooks/use-initial-destination-measurement.ts +156 -0
  343. package/src/shared/components/{create-boundary-component → boundary}/hooks/use-initial-source-measurement.ts +5 -14
  344. package/src/shared/components/{create-boundary-component → boundary}/hooks/use-measurer.ts +42 -46
  345. package/src/shared/components/{create-boundary-component → boundary}/hooks/use-refresh-boundary.ts +16 -11
  346. package/src/shared/components/{create-boundary-component → boundary}/index.tsx +12 -0
  347. package/src/shared/components/boundary/portal/components/host.tsx +114 -0
  348. package/src/shared/components/boundary/portal/components/portal-boundary-host.tsx +90 -0
  349. package/src/shared/components/boundary/portal/components/portal-provider.tsx +10 -0
  350. package/src/shared/components/boundary/portal/components/portal.tsx +278 -0
  351. package/src/shared/components/boundary/portal/hooks/use-host-measurement.ts +102 -0
  352. package/src/shared/components/boundary/portal/index.ts +3 -0
  353. package/src/shared/components/boundary/portal/stores/host-bounds.store.ts +45 -0
  354. package/src/shared/components/boundary/portal/stores/host-registry.store.ts +182 -0
  355. package/src/shared/components/boundary/portal/stores/portal-boundary-host.store.ts +91 -0
  356. package/src/shared/components/boundary/portal/utils/attachment.ts +48 -0
  357. package/src/shared/components/boundary/portal/utils/naming.ts +10 -0
  358. package/src/shared/components/boundary/portal/utils/offset-style.ts +171 -0
  359. package/src/shared/components/boundary/portal/utils/teleport-control.ts +13 -0
  360. package/src/shared/components/{create-boundary-component → boundary}/providers/boundary-owner.provider.tsx +41 -33
  361. package/src/shared/components/boundary/types.ts +92 -0
  362. package/src/shared/components/boundary/utils/destination-signals.ts +31 -0
  363. package/src/shared/components/{create-boundary-component → boundary}/utils/measured-bounds.ts +34 -11
  364. package/src/shared/components/boundary/utils/refresh-signals.ts +175 -0
  365. package/src/shared/components/boundary/utils/source-signals.ts +63 -0
  366. package/src/shared/components/create-transition-aware-component.tsx +8 -3
  367. package/src/shared/components/{integrations/masked-view.tsx → masked-view.tsx} +2 -2
  368. package/src/shared/components/screen-container/layers/content.tsx +12 -7
  369. package/src/shared/configs/presets.ts +2 -6
  370. package/src/shared/index.ts +13 -5
  371. package/src/shared/providers/helpers/measured-bounds-writes.ts +11 -1
  372. package/src/shared/providers/screen/descriptors/descriptors.provider.tsx +7 -3
  373. package/src/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.ts +16 -0
  374. package/src/shared/providers/screen/descriptors/helpers/get-ancestor-keys.ts +31 -6
  375. package/src/shared/providers/screen/origin.provider.tsx +38 -0
  376. package/src/shared/providers/screen/styles/constants.ts +2 -0
  377. package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/are-resettable-states-equal.ts +74 -0
  378. package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +1 -0
  379. package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +1 -0
  380. package/src/shared/providers/screen/styles/styles.provider.tsx +5 -3
  381. package/src/shared/stores/bounds/helpers/link-pairs.helpers.ts +1 -10
  382. package/src/shared/stores/bounds/index.ts +2 -4
  383. package/src/shared/stores/bounds/internals/entries.ts +4 -4
  384. package/src/shared/stores/bounds/internals/links.ts +52 -18
  385. package/src/shared/stores/bounds/internals/resolver.ts +5 -3
  386. package/src/shared/stores/bounds/internals/state.ts +5 -2
  387. package/src/shared/stores/bounds/types.ts +59 -15
  388. package/src/shared/stores/scroll.store.ts +68 -0
  389. package/src/shared/types/animation.types.ts +17 -2
  390. package/src/shared/types/bounds.types.ts +22 -60
  391. package/src/shared/types/index.ts +5 -0
  392. package/src/shared/utils/bounds/helpers/create-bound-tag.ts +46 -4
  393. package/src/shared/utils/bounds/helpers/create-bounds-accessor-core.ts +65 -116
  394. package/src/shared/utils/bounds/helpers/create-link-accessor.ts +10 -80
  395. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +10 -13
  396. package/src/shared/utils/bounds/helpers/styles/composers.ts +269 -46
  397. package/src/shared/utils/bounds/helpers/styles/compute.ts +134 -2
  398. package/src/shared/utils/bounds/navigation/reveal/build.ts +5 -7
  399. package/src/shared/utils/bounds/navigation/zoom/build.ts +5 -8
  400. package/src/shared/utils/bounds/types/options.ts +105 -6
  401. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +0 -1
  402. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +0 -1
  403. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +0 -1
  404. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js +0 -99
  405. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js.map +0 -1
  406. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js.map +0 -1
  407. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js.map +0 -1
  408. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +0 -1
  409. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +0 -1
  410. package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +0 -1
  411. package/lib/commonjs/shared/components/create-boundary-component/types.js.map +0 -1
  412. package/lib/commonjs/shared/components/create-boundary-component/utils/destination-signals.js +0 -75
  413. package/lib/commonjs/shared/components/create-boundary-component/utils/destination-signals.js.map +0 -1
  414. package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js.map +0 -1
  415. package/lib/commonjs/shared/components/create-boundary-component/utils/refresh-signals.js +0 -103
  416. package/lib/commonjs/shared/components/create-boundary-component/utils/refresh-signals.js.map +0 -1
  417. package/lib/commonjs/shared/components/create-boundary-component/utils/source-signals.js +0 -52
  418. package/lib/commonjs/shared/components/create-boundary-component/utils/source-signals.js.map +0 -1
  419. package/lib/commonjs/shared/components/integrations/masked-view.js.map +0 -1
  420. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js +0 -68
  421. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +0 -1
  422. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js +0 -30
  423. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +0 -1
  424. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +0 -1
  425. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +0 -1
  426. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +0 -1
  427. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js +0 -94
  428. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js.map +0 -1
  429. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js.map +0 -1
  430. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js.map +0 -1
  431. package/lib/module/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +0 -1
  432. package/lib/module/shared/components/create-boundary-component/index.js.map +0 -1
  433. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js +0 -60
  434. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +0 -1
  435. package/lib/module/shared/components/create-boundary-component/types.js.map +0 -1
  436. package/lib/module/shared/components/create-boundary-component/utils/destination-signals.js +0 -70
  437. package/lib/module/shared/components/create-boundary-component/utils/destination-signals.js.map +0 -1
  438. package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js.map +0 -1
  439. package/lib/module/shared/components/create-boundary-component/utils/refresh-signals.js +0 -98
  440. package/lib/module/shared/components/create-boundary-component/utils/refresh-signals.js.map +0 -1
  441. package/lib/module/shared/components/create-boundary-component/utils/source-signals.js +0 -47
  442. package/lib/module/shared/components/create-boundary-component/utils/source-signals.js.map +0 -1
  443. package/lib/module/shared/components/integrations/masked-view.js.map +0 -1
  444. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js +0 -63
  445. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +0 -1
  446. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js +0 -26
  447. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +0 -1
  448. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +0 -1
  449. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +0 -1
  450. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-presence.d.ts.map +0 -1
  451. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.d.ts.map +0 -1
  452. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-source-measurement.d.ts.map +0 -1
  453. package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts.map +0 -1
  454. package/lib/typescript/shared/components/create-boundary-component/hooks/use-refresh-boundary.d.ts +0 -14
  455. package/lib/typescript/shared/components/create-boundary-component/hooks/use-refresh-boundary.d.ts.map +0 -1
  456. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +0 -1
  457. package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts.map +0 -1
  458. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +0 -37
  459. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +0 -1
  460. package/lib/typescript/shared/components/create-boundary-component/utils/destination-signals.d.ts.map +0 -1
  461. package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts +0 -8
  462. package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts.map +0 -1
  463. package/lib/typescript/shared/components/create-boundary-component/utils/refresh-signals.d.ts.map +0 -1
  464. package/lib/typescript/shared/components/create-boundary-component/utils/source-signals.d.ts.map +0 -1
  465. package/lib/typescript/shared/components/integrations/masked-view.d.ts.map +0 -1
  466. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts +0 -14
  467. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +0 -1
  468. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts +0 -17
  469. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +0 -1
  470. package/src/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.ts +0 -130
  471. package/src/shared/components/create-boundary-component/types.ts +0 -48
  472. package/src/shared/components/create-boundary-component/utils/destination-signals.ts +0 -129
  473. package/src/shared/components/create-boundary-component/utils/refresh-signals.ts +0 -164
  474. package/src/shared/components/create-boundary-component/utils/source-signals.ts +0 -72
  475. package/src/shared/utils/bounds/helpers/create-interpolators.ts +0 -117
  476. package/src/shared/utils/bounds/helpers/styles/interpolate-link-style.ts +0 -43
  477. /package/lib/commonjs/shared/components/{create-boundary-component → boundary}/hooks/use-boundary-presence.js +0 -0
  478. /package/lib/commonjs/shared/components/{create-boundary-component → boundary}/types.js +0 -0
  479. /package/lib/module/shared/components/{create-boundary-component → boundary}/hooks/use-boundary-presence.js +0 -0
  480. /package/lib/module/shared/components/{create-boundary-component → boundary}/types.js +0 -0
  481. /package/lib/typescript/shared/components/{create-boundary-component → boundary}/components/boundary-target.d.ts +0 -0
  482. /package/lib/typescript/shared/components/{create-boundary-component → boundary}/create-boundary-component.d.ts +0 -0
  483. /package/lib/typescript/shared/components/{create-boundary-component → boundary}/hooks/use-boundary-presence.d.ts +0 -0
  484. /package/lib/typescript/shared/components/{integrations/masked-view.d.ts → masked-view.d.ts} +0 -0
  485. /package/src/shared/components/{create-boundary-component → boundary}/hooks/use-boundary-presence.ts +0 -0
@@ -0,0 +1,278 @@
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
+ useAnimatedProps,
15
+ useAnimatedReaction,
16
+ useAnimatedStyle,
17
+ useSharedValue,
18
+ } from "react-native-reanimated";
19
+ import { Portal as NativePortal } from "react-native-teleport";
20
+ import { useDescriptorsStore } from "../../../../providers/screen/descriptors";
21
+ import { useScreenStyles } from "../../../../providers/screen/styles";
22
+ import { AnimationStore } from "../../../../stores/animation.store";
23
+ import { getLinkKeyFromTag } from "../../../../stores/bounds/helpers/link-pairs.helpers";
24
+ import { getLink } from "../../../../stores/bounds/internals/links";
25
+ import { pairs } from "../../../../stores/bounds/internals/state";
26
+ import { createTransitionAwareComponent } from "../../../create-transition-aware-component";
27
+ import type { BoundaryPortal, BoundaryPortalAttachTarget } from "../../types";
28
+ import {
29
+ getHostCapturesScroll,
30
+ useActiveHostKey,
31
+ } from "../stores/host-registry.store";
32
+ import {
33
+ mountPortalBoundaryHost,
34
+ unmountPortalBoundaryHost,
35
+ } from "../stores/portal-boundary-host.store";
36
+ import {
37
+ type PortalAttachment,
38
+ resolvePortalAttachmentTargets,
39
+ } from "../utils/attachment";
40
+ import {
41
+ createPortalBoundaryHostName,
42
+ PORTAL_HOST_NAME_RESET_VALUE,
43
+ } from "../utils/naming";
44
+ import { isTeleportEnabled } from "../utils/teleport-control";
45
+
46
+ type NullableHostNamePortalProps = Omit<
47
+ ComponentProps<typeof NativePortal>,
48
+ "hostName"
49
+ > & {
50
+ hostName?: string | null;
51
+ };
52
+
53
+ const TransitionAwareTeleport = createTransitionAwareComponent(
54
+ NativePortal as ComponentType<NullableHostNamePortalProps>,
55
+ );
56
+
57
+ interface PortalProps {
58
+ id?: string;
59
+ children: ReactNode;
60
+ mode?: BoundaryPortal;
61
+ /**
62
+ * Ref to the layout-preserving placeholder wrapper. Boundaries measure
63
+ * this instead of teleported content — the placeholder keeps the source
64
+ * slot at home while the content may physically live in another screen's
65
+ * host.
66
+ */
67
+ placeholderRef?: AnimatedRef<View>;
68
+ }
69
+
70
+ export const Portal = memo(function Portal({
71
+ id = "my-id",
72
+ children,
73
+ mode = false,
74
+ placeholderRef,
75
+ }: PortalProps) {
76
+ const isPortalEnabled = !!mode;
77
+ const portalAttachTarget: BoundaryPortalAttachTarget =
78
+ !mode || mode === true
79
+ ? "current-screen"
80
+ : (mode.attachTo ?? "current-screen");
81
+ const { stylesMap } = useScreenStyles();
82
+ const sourcePairKey = useDescriptorsStore((s) => s.derivations.sourcePairKey);
83
+ const currentScreenKey = useDescriptorsStore(
84
+ (s) => s.derivations.currentScreenKey,
85
+ );
86
+
87
+ const nextScreenKey = useDescriptorsStore((s) => s.derivations.nextScreenKey);
88
+
89
+ const [attachment, setAttachment] = useState<PortalAttachment | null>(
90
+ PORTAL_HOST_NAME_RESET_VALUE,
91
+ );
92
+ const attachedHostName = useSharedValue<string | null>(
93
+ PORTAL_HOST_NAME_RESET_VALUE,
94
+ );
95
+ const placeholderWidth = useSharedValue(0);
96
+ const placeholderHeight = useSharedValue(0);
97
+
98
+ const { progressScreenKey, targetScreenKey } = resolvePortalAttachmentTargets(
99
+ {
100
+ attachment,
101
+ currentScreenKey,
102
+ nextScreenKey,
103
+ portalAttachTarget,
104
+ sourcePairKey,
105
+ },
106
+ );
107
+ const activeHostKey = useActiveHostKey(targetScreenKey);
108
+ const activeHostCapturesScroll = activeHostKey
109
+ ? getHostCapturesScroll(activeHostKey)
110
+ : false;
111
+ const progress = AnimationStore.getValue(
112
+ progressScreenKey ?? "",
113
+ "transitionProgress",
114
+ );
115
+ const closing = AnimationStore.getValue(progressScreenKey ?? "", "closing");
116
+
117
+ const updatePortalAttachment = useCallback(
118
+ (matchedScreenKey: string | null, pairKey?: string) => {
119
+ if (matchedScreenKey && pairKey) {
120
+ setAttachment((current) => {
121
+ if (
122
+ current?.matchedScreenKey === matchedScreenKey &&
123
+ current.pairKey === pairKey
124
+ ) {
125
+ return current;
126
+ }
127
+
128
+ return {
129
+ matchedScreenKey,
130
+ pairKey,
131
+ };
132
+ });
133
+ return;
134
+ }
135
+
136
+ setAttachment((current) => (current ? null : current));
137
+ },
138
+ [],
139
+ );
140
+
141
+ useLayoutEffect(() => {
142
+ if (!isPortalEnabled || !attachment || !activeHostKey || !targetScreenKey) {
143
+ attachedHostName.set(PORTAL_HOST_NAME_RESET_VALUE);
144
+ return;
145
+ }
146
+
147
+ mountPortalBoundaryHost({
148
+ boundaryId: id,
149
+ capturesScroll: activeHostCapturesScroll,
150
+ hostKey: activeHostKey,
151
+ pairKey: attachment.pairKey,
152
+ screenKey: targetScreenKey,
153
+ });
154
+
155
+ // The native registry parks portals whose host has not registered yet and
156
+ // re-parents the moment it does, so the host name can be handed over
157
+ // immediately — ordering belongs to the registry, not to frame counting.
158
+ // hostName rides animated props, so the handover needs no React commit.
159
+ attachedHostName.set(createPortalBoundaryHostName(activeHostKey, id));
160
+ }, [
161
+ activeHostKey,
162
+ activeHostCapturesScroll,
163
+ attachedHostName,
164
+ attachment,
165
+ id,
166
+ isPortalEnabled,
167
+ targetScreenKey,
168
+ ]);
169
+
170
+ useLayoutEffect(() => {
171
+ return () => {
172
+ attachedHostName.set(PORTAL_HOST_NAME_RESET_VALUE);
173
+ unmountPortalBoundaryHost(id);
174
+ };
175
+ }, [attachedHostName, id]);
176
+
177
+ useAnimatedReaction(
178
+ () => {
179
+ "worklet";
180
+ if (!isPortalEnabled || !sourcePairKey) {
181
+ return null;
182
+ }
183
+
184
+ pairs.get();
185
+ // Strict per-member lookup: getResolvedLink's group fallback borrows
186
+ // the initial member's link for style resolution, which would make
187
+ // every inactive group member's portal see a "complete" link and
188
+ // attach. A portal may only teleport on its OWN member's link.
189
+ const link = getLink(sourcePairKey, id);
190
+
191
+ if (link?.status !== "complete") {
192
+ return null;
193
+ }
194
+
195
+ // Grouped portals teleport only while their member is the group's
196
+ // active id — retargeting detaches the previous member (its content
197
+ // returns home) and attaches the new one. Exactly one grouped member
198
+ // is teleported at a time.
199
+ if (link.group) {
200
+ const activeId =
201
+ pairs.get()[sourcePairKey]?.groups?.[link.group]?.activeId;
202
+
203
+ if (activeId && activeId !== getLinkKeyFromTag(id)) {
204
+ return null;
205
+ }
206
+ }
207
+
208
+ return link.destination.screenKey;
209
+ },
210
+ (matchedScreenKey, previousMatchedScreenKey) => {
211
+ "worklet";
212
+ if (matchedScreenKey === previousMatchedScreenKey) {
213
+ return;
214
+ }
215
+
216
+ runOnJS(updatePortalAttachment)(matchedScreenKey, sourcePairKey);
217
+ },
218
+ );
219
+
220
+ const teleportProps = useAnimatedProps(() => {
221
+ "worklet";
222
+
223
+ // Opening waits for the destination transition to start so content is not
224
+ // re-parented before the host is visually ready. Closing stays attached
225
+ // through progress 0 so the final frame can land in the matched host.
226
+ const attachThreshold = closing.get() === 1 ? 0 : 0.001;
227
+ const { teleport, ...slotProps } = stylesMap.get()[id]?.props ?? {};
228
+ const shouldTeleport = isTeleportEnabled(teleport);
229
+
230
+ return {
231
+ // Preserve portal slot props from the interpolator while keeping
232
+ // hostName owned by the attachment gate below.
233
+ ...slotProps,
234
+ hostName:
235
+ shouldTeleport && progress.get() >= attachThreshold
236
+ ? attachedHostName.get()
237
+ : PORTAL_HOST_NAME_RESET_VALUE,
238
+ };
239
+ });
240
+
241
+ // Pin the placeholder to its measured size while content lives in the host,
242
+ // in the same UI frame the host name flips — no commit in between. Until the
243
+ // first layout lands (dims 0) sizing stays natural so an instant attach
244
+ // cannot collapse the slot.
245
+ const placeholderStyle = useAnimatedStyle(() => {
246
+ "worklet";
247
+ const hostName = attachedHostName.get();
248
+ const isAttached = hostName !== null;
249
+ const width = placeholderWidth.get();
250
+ const height = placeholderHeight.get();
251
+
252
+ if (!isAttached || width === 0) {
253
+ return { width: "auto", height: "auto" } as const;
254
+ }
255
+
256
+ return { width, height };
257
+ });
258
+
259
+ if (isPortalEnabled) {
260
+ return (
261
+ <Animated.View
262
+ ref={placeholderRef}
263
+ onLayout={(event) => {
264
+ placeholderWidth.set(event.nativeEvent.layout.width);
265
+ placeholderHeight.set(event.nativeEvent.layout.height);
266
+ }}
267
+ style={placeholderStyle}
268
+ collapsable={false}
269
+ >
270
+ <TransitionAwareTeleport animatedProps={teleportProps} name={id}>
271
+ <Animated.View style={placeholderStyle}>{children}</Animated.View>
272
+ </TransitionAwareTeleport>
273
+ </Animated.View>
274
+ );
275
+ }
276
+
277
+ return children;
278
+ });
@@ -0,0 +1,102 @@
1
+ import { useLayoutEffect, useState } from "react";
2
+ import type { View } from "react-native";
3
+ import {
4
+ measure,
5
+ runOnJS,
6
+ runOnUI,
7
+ useAnimatedReaction,
8
+ useAnimatedRef,
9
+ useSharedValue,
10
+ } from "react-native-reanimated";
11
+ import { useOriginContext } from "../../../../providers/screen/origin.provider";
12
+ import { ScrollStore } from "../../../../stores/scroll.store";
13
+ import {
14
+ adjustedMeasuredBoundsForOverscrollDeltas,
15
+ normalizeMeasuredBoundsToOrigin,
16
+ } from "../../utils/measured-bounds";
17
+ import {
18
+ clearPortalHostBounds,
19
+ setPortalHostBounds,
20
+ } from "../stores/host-bounds.store";
21
+
22
+ type UseHostMeasurementParams = {
23
+ capturesScroll: boolean;
24
+ enabled: boolean;
25
+ hostKey: string;
26
+ screenKey: string;
27
+ };
28
+
29
+ export const useHostMeasurement = ({
30
+ capturesScroll,
31
+ enabled,
32
+ hostKey,
33
+ screenKey,
34
+ }: UseHostMeasurementParams) => {
35
+ const hostRef = useAnimatedRef<View>();
36
+ const scrollMetadata = ScrollStore.getValue(screenKey, "metadata");
37
+ const [canRenderHosts, setCanRenderHosts] = useState<boolean>(false);
38
+ const { originRef } = useOriginContext();
39
+ const hasMeasuredHost = useSharedValue(false);
40
+
41
+ useAnimatedReaction(
42
+ () => {
43
+ "worklet";
44
+ if (!enabled) {
45
+ return null;
46
+ }
47
+
48
+ return hasMeasuredHost.get();
49
+ },
50
+ (hasAlreadyMeasured) => {
51
+ "worklet";
52
+ if (!enabled || hasAlreadyMeasured) {
53
+ return;
54
+ }
55
+
56
+ const measured = measure(hostRef);
57
+ const measuredOrigin = measure(originRef);
58
+
59
+ if (!measured || !measuredOrigin) {
60
+ return;
61
+ }
62
+
63
+ hasMeasuredHost.set(true);
64
+
65
+ // A measurement taken mid rubber-band would bake the transient
66
+ // overscroll displacement into the host frame. Store the at-rest
67
+ // position instead; clamped scroll deltas share that basis.
68
+ const currentScroll = scrollMetadata.get();
69
+ const overscrollNormalized = capturesScroll
70
+ ? adjustedMeasuredBoundsForOverscrollDeltas(measured, currentScroll)
71
+ : measured;
72
+
73
+ const normalizedMeasured = normalizeMeasuredBoundsToOrigin(
74
+ overscrollNormalized,
75
+ measuredOrigin,
76
+ );
77
+
78
+ setPortalHostBounds(hostKey, {
79
+ x: normalizedMeasured.x,
80
+ y: normalizedMeasured.y,
81
+ width: normalizedMeasured.width,
82
+ height: normalizedMeasured.height,
83
+ pageX: normalizedMeasured.pageX,
84
+ pageY: normalizedMeasured.pageY,
85
+ scroll: capturesScroll ? currentScroll : null,
86
+ });
87
+
88
+ runOnJS(setCanRenderHosts)(true);
89
+ },
90
+ );
91
+
92
+ useLayoutEffect(() => {
93
+ return () => {
94
+ runOnUI(clearPortalHostBounds)(hostKey);
95
+ };
96
+ }, [hostKey]);
97
+
98
+ return {
99
+ canRenderHosts,
100
+ hostRef,
101
+ };
102
+ };
@@ -0,0 +1,3 @@
1
+ export { Host } from "./components/host";
2
+ export { Portal } from "./components/portal";
3
+ export { PortalProvider } from "./components/portal-provider";
@@ -0,0 +1,45 @@
1
+ import { type MeasuredDimensions, makeMutable } from "react-native-reanimated";
2
+ import { cloneScrollMetadataState } from "../../../../stores/scroll.store";
3
+ import type { ScrollMetadataState } from "../../../../types/gesture.types";
4
+
5
+ export type PortalHostBounds = MeasuredDimensions & {
6
+ scroll?: ScrollMetadataState | null;
7
+ };
8
+
9
+ type PortalHostBoundsState = Record<string, PortalHostBounds | null>;
10
+
11
+ const portalHostBounds = makeMutable<PortalHostBoundsState>({});
12
+
13
+ export const getPortalHostBounds = (hostKey: string) => {
14
+ "worklet";
15
+ return portalHostBounds.get()[hostKey] ?? null;
16
+ };
17
+
18
+ export const setPortalHostBounds = (
19
+ hostKey: string,
20
+ bounds: PortalHostBounds,
21
+ ) => {
22
+ "worklet";
23
+ const nextBounds: PortalHostBounds = {
24
+ ...bounds,
25
+ scroll: cloneScrollMetadataState(bounds.scroll),
26
+ };
27
+
28
+ portalHostBounds.set((state) => {
29
+ "worklet";
30
+ return {
31
+ ...state,
32
+ [hostKey]: nextBounds,
33
+ };
34
+ });
35
+ };
36
+
37
+ export const clearPortalHostBounds = (hostKey: string) => {
38
+ "worklet";
39
+ portalHostBounds.set((state) => {
40
+ "worklet";
41
+ const nextState: PortalHostBoundsState = { ...state };
42
+ delete nextState[hostKey];
43
+ return nextState;
44
+ });
45
+ };
@@ -0,0 +1,182 @@
1
+ import { useSyncExternalStore } from "react";
2
+ import { makeMutable } from "react-native-reanimated";
3
+ import type { SourceHostRef } from "../../../../stores/bounds/types";
4
+
5
+ export type HostRegistration = {
6
+ hostKey: string;
7
+ screenKey: string;
8
+ fallback: boolean;
9
+ capturesScroll: boolean;
10
+ };
11
+
12
+ type HostRegistrySnapshot = Record<string, string>;
13
+
14
+ const EMPTY_SNAPSHOT: HostRegistrySnapshot = {};
15
+
16
+ const listeners = new Set<() => void>();
17
+ const hostStacks = new Map<string, HostRegistration[]>();
18
+
19
+ let snapshot: HostRegistrySnapshot = EMPTY_SNAPSHOT;
20
+
21
+ /**
22
+ * UI-readable mirror of each screen's active host, kept only for hosts that
23
+ * capture scroll. Measurement worklets read it to record which scroll-scoped
24
+ * host a source boundary originated from — at measure time, without any React
25
+ * subscription on the boundary itself.
26
+ */
27
+ const activeScrollHosts = makeMutable<Record<string, SourceHostRef>>({});
28
+
29
+ const getActiveHostFromStack = (
30
+ screenKey: string,
31
+ stack: HostRegistration[] | undefined,
32
+ ) => {
33
+ if (!stack || stack.length === 0) {
34
+ return screenKey;
35
+ }
36
+
37
+ for (let index = stack.length - 1; index >= 0; index--) {
38
+ const host = stack[index];
39
+ if (!host.fallback) {
40
+ return host.hostKey;
41
+ }
42
+ }
43
+
44
+ return stack[0]?.hostKey ?? screenKey;
45
+ };
46
+
47
+ const buildSnapshot = (): HostRegistrySnapshot => {
48
+ const nextSnapshot: HostRegistrySnapshot = {};
49
+
50
+ for (const [screenKey, stack] of hostStacks) {
51
+ nextSnapshot[screenKey] = getActiveHostFromStack(screenKey, stack);
52
+ }
53
+
54
+ return nextSnapshot;
55
+ };
56
+
57
+ const buildScrollHostSnapshot = (): Record<string, SourceHostRef> => {
58
+ const nextSnapshot: Record<string, SourceHostRef> = {};
59
+
60
+ for (const [screenKey, stack] of hostStacks) {
61
+ const activeHostKey = getActiveHostFromStack(screenKey, stack);
62
+ const activeHost = stack.find((host) => host.hostKey === activeHostKey);
63
+
64
+ if (activeHost?.capturesScroll) {
65
+ nextSnapshot[screenKey] = {
66
+ hostKey: activeHost.hostKey,
67
+ capturesScroll: true,
68
+ };
69
+ }
70
+ }
71
+
72
+ return nextSnapshot;
73
+ };
74
+
75
+ const emit = () => {
76
+ snapshot = buildSnapshot();
77
+ activeScrollHosts.set(buildScrollHostSnapshot());
78
+
79
+ for (const listener of listeners) {
80
+ listener();
81
+ }
82
+ };
83
+
84
+ const subscribe = (listener: () => void) => {
85
+ listeners.add(listener);
86
+
87
+ return () => {
88
+ listeners.delete(listener);
89
+ };
90
+ };
91
+
92
+ export const registerHost = (registration: HostRegistration) => {
93
+ const stack = hostStacks.get(registration.screenKey) ?? [];
94
+ const previousActiveHostKey = getActiveHostFromStack(
95
+ registration.screenKey,
96
+ stack,
97
+ );
98
+ const nextStack = stack.filter(
99
+ (host) => host.hostKey !== registration.hostKey,
100
+ );
101
+
102
+ if (registration.fallback) {
103
+ nextStack.unshift(registration);
104
+ } else {
105
+ nextStack.push(registration);
106
+ }
107
+
108
+ hostStacks.set(registration.screenKey, nextStack);
109
+
110
+ if (
111
+ previousActiveHostKey ===
112
+ getActiveHostFromStack(registration.screenKey, nextStack)
113
+ ) {
114
+ return;
115
+ }
116
+
117
+ emit();
118
+ };
119
+
120
+ export const unregisterHost = (screenKey: string, hostKey: string) => {
121
+ const stack = hostStacks.get(screenKey);
122
+ if (!stack) {
123
+ return;
124
+ }
125
+
126
+ const previousActiveHostKey = getActiveHostFromStack(screenKey, stack);
127
+ const nextStack = stack.filter((host) => host.hostKey !== hostKey);
128
+
129
+ if (nextStack.length === 0) {
130
+ hostStacks.delete(screenKey);
131
+ } else {
132
+ hostStacks.set(screenKey, nextStack);
133
+ }
134
+
135
+ if (previousActiveHostKey === getActiveHostFromStack(screenKey, nextStack)) {
136
+ return;
137
+ }
138
+
139
+ emit();
140
+ };
141
+
142
+ export const getActiveHostKey = (screenKey: string) => {
143
+ return snapshot[screenKey] ?? screenKey;
144
+ };
145
+
146
+ /**
147
+ * The screen's active host, if it captures scroll. Worklet-safe: measurement
148
+ * code calls this on the UI thread while writing source bounds.
149
+ */
150
+ export const getActiveScrollHost = (
151
+ screenKey: string,
152
+ ): SourceHostRef | null => {
153
+ "worklet";
154
+ return activeScrollHosts.get()[screenKey] ?? null;
155
+ };
156
+
157
+ export const getHostCapturesScroll = (hostKey: string) => {
158
+ for (const stack of hostStacks.values()) {
159
+ const host = stack.find((registration) => registration.hostKey === hostKey);
160
+
161
+ if (host) {
162
+ return host.capturesScroll;
163
+ }
164
+ }
165
+
166
+ return false;
167
+ };
168
+
169
+ export const useActiveHostKey = (screenKey?: string | null) => {
170
+ return useSyncExternalStore(
171
+ subscribe,
172
+ () => (screenKey ? getActiveHostKey(screenKey) : undefined),
173
+ () => undefined,
174
+ );
175
+ };
176
+
177
+ export const resetHostRegistry = () => {
178
+ hostStacks.clear();
179
+ snapshot = EMPTY_SNAPSHOT;
180
+ activeScrollHosts.set({});
181
+ emit();
182
+ };
@@ -0,0 +1,91 @@
1
+ import { useSyncExternalStore } from "react";
2
+
3
+ export type ActivePortalBoundaryHost = {
4
+ boundaryId: string;
5
+ capturesScroll: boolean;
6
+ hostKey: string;
7
+ pairKey: string;
8
+ screenKey: string;
9
+ };
10
+
11
+ type PortalSnapshot = {
12
+ hostsByScope: Record<string, ActivePortalBoundaryHost[]>;
13
+ };
14
+
15
+ const EMPTY_HOSTS: ActivePortalBoundaryHost[] = [];
16
+
17
+ const listeners = new Set<() => void>();
18
+ const activeBoundaryHosts = new Map<string, ActivePortalBoundaryHost>();
19
+
20
+ let snapshot: PortalSnapshot = {
21
+ hostsByScope: {},
22
+ };
23
+
24
+ const buildSnapshot = (): PortalSnapshot => {
25
+ const hostsByScope: Record<string, ActivePortalBoundaryHost[]> = {};
26
+
27
+ for (const host of activeBoundaryHosts.values()) {
28
+ const hosts = hostsByScope[host.hostKey] ?? [];
29
+ hosts.push(host);
30
+ hostsByScope[host.hostKey] = hosts;
31
+ }
32
+
33
+ return {
34
+ hostsByScope,
35
+ };
36
+ };
37
+
38
+ const emit = () => {
39
+ snapshot = buildSnapshot();
40
+
41
+ for (const listener of listeners) {
42
+ listener();
43
+ }
44
+ };
45
+
46
+ const isSameHost = (
47
+ a: ActivePortalBoundaryHost,
48
+ b: ActivePortalBoundaryHost,
49
+ ) => {
50
+ return (
51
+ a.boundaryId === b.boundaryId &&
52
+ a.capturesScroll === b.capturesScroll &&
53
+ a.hostKey === b.hostKey &&
54
+ a.pairKey === b.pairKey &&
55
+ a.screenKey === b.screenKey
56
+ );
57
+ };
58
+
59
+ export const mountPortalBoundaryHost = (host: ActivePortalBoundaryHost) => {
60
+ const previous = activeBoundaryHosts.get(host.boundaryId);
61
+ if (previous && isSameHost(previous, host)) {
62
+ return;
63
+ }
64
+
65
+ activeBoundaryHosts.set(host.boundaryId, host);
66
+ emit();
67
+ };
68
+
69
+ export const unmountPortalBoundaryHost = (boundaryId: string) => {
70
+ if (!activeBoundaryHosts.delete(boundaryId)) {
71
+ return;
72
+ }
73
+
74
+ emit();
75
+ };
76
+
77
+ const subscribe = (listener: () => void) => {
78
+ listeners.add(listener);
79
+
80
+ return () => {
81
+ listeners.delete(listener);
82
+ };
83
+ };
84
+
85
+ export const useActivePortalBoundaryHosts = (hostKey: string) => {
86
+ return useSyncExternalStore(
87
+ subscribe,
88
+ () => snapshot.hostsByScope[hostKey] ?? EMPTY_HOSTS,
89
+ () => EMPTY_HOSTS,
90
+ );
91
+ };