react-native-screen-transitions 3.6.0-alpha.1 → 3.6.0-alpha.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 (433) hide show
  1. package/lib/commonjs/component-stack/components/component-screen.js +1 -7
  2. package/lib/commonjs/component-stack/components/component-screen.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +27 -34
  4. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-presence.js +4 -4
  6. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js +17 -19
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js +27 -7
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js +23 -51
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-refresh-boundary.js +33 -40
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/index.js +3 -1
  16. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  17. package/lib/commonjs/shared/components/create-boundary-component/utils/destination-signals.js +75 -0
  18. package/lib/commonjs/shared/components/create-boundary-component/utils/destination-signals.js.map +1 -0
  19. package/lib/commonjs/shared/components/create-boundary-component/{hooks/helpers/scroll-measurement.js → utils/measured-bounds.js} +15 -2
  20. package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -0
  21. package/lib/commonjs/shared/components/create-boundary-component/utils/refresh-signals.js +103 -0
  22. package/lib/commonjs/shared/components/create-boundary-component/utils/refresh-signals.js.map +1 -0
  23. package/lib/commonjs/shared/components/create-boundary-component/utils/source-signals.js +52 -0
  24. package/lib/commonjs/shared/components/create-boundary-component/utils/source-signals.js.map +1 -0
  25. package/lib/commonjs/shared/components/native-screen.js +2 -13
  26. package/lib/commonjs/shared/components/native-screen.js.map +1 -1
  27. package/lib/commonjs/shared/constants.js +2 -7
  28. package/lib/commonjs/shared/constants.js.map +1 -1
  29. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js +35 -0
  30. package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js.map +1 -0
  31. package/lib/commonjs/shared/providers/register-bounds.provider.js +48 -55
  32. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  33. package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.js +1 -10
  34. package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.js.map +1 -1
  35. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +1 -6
  36. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  38. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-activation.js +2 -2
  39. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-activation.js.map +1 -1
  40. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js +9 -2
  41. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
  42. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-release.js +19 -0
  43. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-release.js.map +1 -1
  44. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-reset.js +2 -0
  45. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-reset.js.map +1 -1
  46. package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js +2 -2
  47. package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
  48. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-activation.js +2 -2
  49. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-activation.js.map +1 -1
  50. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +1 -0
  51. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
  52. package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +2 -2
  53. package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
  54. package/lib/commonjs/shared/providers/screen/gestures/shared/physics.js +18 -2
  55. package/lib/commonjs/shared/providers/screen/gestures/shared/physics.js.map +1 -1
  56. package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js +1 -5
  57. package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js.map +1 -1
  58. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +1 -4
  59. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  60. package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js +125 -0
  61. package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -0
  62. package/lib/commonjs/shared/stores/bounds/index.js +6 -12
  63. package/lib/commonjs/shared/stores/bounds/index.js.map +1 -1
  64. package/lib/commonjs/shared/stores/bounds/internals/clear.js +13 -21
  65. package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
  66. package/lib/commonjs/shared/stores/bounds/internals/entries.js +49 -9
  67. package/lib/commonjs/shared/stores/bounds/internals/entries.js.map +1 -1
  68. package/lib/commonjs/shared/stores/bounds/internals/links.js +143 -82
  69. package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
  70. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +17 -43
  71. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  72. package/lib/commonjs/shared/stores/bounds/internals/state.js +26 -3
  73. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  74. package/lib/commonjs/shared/stores/gesture.store.js +2 -0
  75. package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
  76. package/lib/commonjs/shared/types/gesture.types.js +2 -2
  77. package/lib/commonjs/shared/types/gesture.types.js.map +1 -1
  78. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js +2 -1
  79. package/lib/commonjs/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  80. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js +6 -5
  81. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  82. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +21 -8
  83. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  84. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bounds-pair-key.js +23 -0
  85. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bounds-pair-key.js.map +1 -0
  86. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +91 -199
  87. package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  88. package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js +15 -2
  89. package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
  90. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +155 -14
  91. package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  92. package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js +20 -19
  93. package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
  94. package/lib/module/component-stack/components/component-screen.js +2 -8
  95. package/lib/module/component-stack/components/component-screen.js.map +1 -1
  96. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +27 -34
  97. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  98. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-presence.js +4 -4
  99. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +1 -1
  100. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js +18 -20
  101. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.js.map +1 -1
  102. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js +28 -8
  103. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-source-measurement.js.map +1 -1
  104. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js +22 -50
  105. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  106. package/lib/module/shared/components/create-boundary-component/hooks/use-refresh-boundary.js +33 -40
  107. package/lib/module/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +1 -1
  108. package/lib/module/shared/components/create-boundary-component/index.js +3 -1
  109. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  110. package/lib/module/shared/components/create-boundary-component/utils/destination-signals.js +70 -0
  111. package/lib/module/shared/components/create-boundary-component/utils/destination-signals.js.map +1 -0
  112. package/lib/module/shared/components/create-boundary-component/{hooks/helpers/scroll-measurement.js → utils/measured-bounds.js} +13 -1
  113. package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -0
  114. package/lib/module/shared/components/create-boundary-component/utils/refresh-signals.js +98 -0
  115. package/lib/module/shared/components/create-boundary-component/utils/refresh-signals.js.map +1 -0
  116. package/lib/module/shared/components/create-boundary-component/utils/source-signals.js +47 -0
  117. package/lib/module/shared/components/create-boundary-component/utils/source-signals.js.map +1 -0
  118. package/lib/module/shared/components/native-screen.js +3 -14
  119. package/lib/module/shared/components/native-screen.js.map +1 -1
  120. package/lib/module/shared/constants.js +1 -6
  121. package/lib/module/shared/constants.js.map +1 -1
  122. package/lib/module/shared/providers/helpers/measured-bounds-writes.js +30 -0
  123. package/lib/module/shared/providers/helpers/measured-bounds-writes.js.map +1 -0
  124. package/lib/module/shared/providers/register-bounds.provider.js +48 -55
  125. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  126. package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.js +1 -10
  127. package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.js.map +1 -1
  128. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +1 -1
  129. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
  130. package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
  131. package/lib/module/shared/providers/screen/gestures/pan/pan-activation.js +2 -2
  132. package/lib/module/shared/providers/screen/gestures/pan/pan-activation.js.map +1 -1
  133. package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js +10 -3
  134. package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
  135. package/lib/module/shared/providers/screen/gestures/pan/pan-release.js +20 -1
  136. package/lib/module/shared/providers/screen/gestures/pan/pan-release.js.map +1 -1
  137. package/lib/module/shared/providers/screen/gestures/pan/pan-reset.js +2 -0
  138. package/lib/module/shared/providers/screen/gestures/pan/pan-reset.js.map +1 -1
  139. package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js +3 -3
  140. package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
  141. package/lib/module/shared/providers/screen/gestures/pinch/pinch-activation.js +3 -3
  142. package/lib/module/shared/providers/screen/gestures/pinch/pinch-activation.js.map +1 -1
  143. package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +1 -0
  144. package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
  145. package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +3 -3
  146. package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
  147. package/lib/module/shared/providers/screen/gestures/shared/physics.js +15 -0
  148. package/lib/module/shared/providers/screen/gestures/shared/physics.js.map +1 -1
  149. package/lib/module/shared/providers/screen/gestures/shared/policy.js +3 -3
  150. package/lib/module/shared/providers/screen/gestures/shared/policy.js.map +1 -1
  151. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +1 -4
  152. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  153. package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js +105 -0
  154. package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -0
  155. package/lib/module/shared/stores/bounds/index.js +7 -13
  156. package/lib/module/shared/stores/bounds/index.js.map +1 -1
  157. package/lib/module/shared/stores/bounds/internals/clear.js +14 -22
  158. package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
  159. package/lib/module/shared/stores/bounds/internals/entries.js +49 -9
  160. package/lib/module/shared/stores/bounds/internals/entries.js.map +1 -1
  161. package/lib/module/shared/stores/bounds/internals/links.js +139 -80
  162. package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
  163. package/lib/module/shared/stores/bounds/internals/resolver.js +17 -43
  164. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  165. package/lib/module/shared/stores/bounds/internals/state.js +25 -2
  166. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  167. package/lib/module/shared/stores/gesture.store.js +2 -0
  168. package/lib/module/shared/stores/gesture.store.js.map +1 -1
  169. package/lib/module/shared/types/animation.types.js +0 -4
  170. package/lib/module/shared/types/animation.types.js.map +1 -1
  171. package/lib/module/shared/types/gesture.types.js +0 -1
  172. package/lib/module/shared/types/gesture.types.js.map +1 -1
  173. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js +2 -1
  174. package/lib/module/shared/utils/bounds/helpers/create-bounds-accessor-core.js.map +1 -1
  175. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js +6 -5
  176. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  177. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +21 -8
  178. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  179. package/lib/module/shared/utils/bounds/helpers/resolve-bounds-pair-key.js +18 -0
  180. package/lib/module/shared/utils/bounds/helpers/resolve-bounds-pair-key.js.map +1 -0
  181. package/lib/module/shared/utils/bounds/navigation/reveal/build.js +90 -198
  182. package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
  183. package/lib/module/shared/utils/bounds/navigation/reveal/config.js +14 -1
  184. package/lib/module/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
  185. package/lib/module/shared/utils/bounds/navigation/reveal/math.js +144 -12
  186. package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
  187. package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js +20 -19
  188. package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
  189. package/lib/typescript/component-stack/components/component-screen.d.ts.map +1 -1
  190. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts +1 -0
  191. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  192. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-presence.d.ts +1 -1
  193. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-presence.d.ts.map +1 -1
  194. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.d.ts +5 -4
  195. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.d.ts.map +1 -1
  196. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-source-measurement.d.ts +6 -2
  197. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-source-measurement.d.ts.map +1 -1
  198. package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts +5 -4
  199. package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts.map +1 -1
  200. package/lib/typescript/shared/components/create-boundary-component/hooks/use-refresh-boundary.d.ts +7 -7
  201. package/lib/typescript/shared/components/create-boundary-component/hooks/use-refresh-boundary.d.ts.map +1 -1
  202. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  203. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +11 -7
  204. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  205. package/lib/typescript/shared/components/create-boundary-component/utils/destination-signals.d.ts +10 -0
  206. package/lib/typescript/shared/components/create-boundary-component/utils/destination-signals.d.ts.map +1 -0
  207. package/lib/typescript/shared/components/create-boundary-component/{hooks/helpers/scroll-measurement.d.ts → utils/measured-bounds.d.ts} +3 -2
  208. package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts.map +1 -0
  209. package/lib/typescript/shared/components/create-boundary-component/utils/refresh-signals.d.ts +22 -0
  210. package/lib/typescript/shared/components/create-boundary-component/utils/refresh-signals.d.ts.map +1 -0
  211. package/lib/typescript/shared/components/create-boundary-component/utils/source-signals.d.ts +16 -0
  212. package/lib/typescript/shared/components/create-boundary-component/utils/source-signals.d.ts.map +1 -0
  213. package/lib/typescript/shared/components/native-screen.d.ts.map +1 -1
  214. package/lib/typescript/shared/constants.d.ts +0 -5
  215. package/lib/typescript/shared/constants.d.ts.map +1 -1
  216. package/lib/typescript/shared/index.d.ts +1 -1
  217. package/lib/typescript/shared/index.d.ts.map +1 -1
  218. package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts +21 -0
  219. package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts.map +1 -0
  220. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  221. package/lib/typescript/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.d.ts.map +1 -1
  222. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts +0 -1
  223. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
  224. package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts +1 -1
  225. package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
  226. package/lib/typescript/shared/providers/screen/gestures/pan/pan-activation.d.ts.map +1 -1
  227. package/lib/typescript/shared/providers/screen/gestures/pan/pan-lifecycle.d.ts.map +1 -1
  228. package/lib/typescript/shared/providers/screen/gestures/pan/pan-release.d.ts.map +1 -1
  229. package/lib/typescript/shared/providers/screen/gestures/pan/pan-reset.d.ts +2 -1
  230. package/lib/typescript/shared/providers/screen/gestures/pan/pan-reset.d.ts.map +1 -1
  231. package/lib/typescript/shared/providers/screen/gestures/pan/use-pan-behavior.d.ts.map +1 -1
  232. package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-activation.d.ts.map +1 -1
  233. package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-lifecycle.d.ts.map +1 -1
  234. package/lib/typescript/shared/providers/screen/gestures/pinch/use-pinch-behavior.d.ts.map +1 -1
  235. package/lib/typescript/shared/providers/screen/gestures/shared/physics.d.ts +7 -0
  236. package/lib/typescript/shared/providers/screen/gestures/shared/physics.d.ts.map +1 -1
  237. package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts +0 -10
  238. package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts.map +1 -1
  239. package/lib/typescript/shared/providers/screen/gestures/types.d.ts +2 -0
  240. package/lib/typescript/shared/providers/screen/gestures/types.d.ts.map +1 -1
  241. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  242. package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts +18 -0
  243. package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts.map +1 -0
  244. package/lib/typescript/shared/stores/bounds/index.d.ts +6 -12
  245. package/lib/typescript/shared/stores/bounds/index.d.ts.map +1 -1
  246. package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
  247. package/lib/typescript/shared/stores/bounds/internals/entries.d.ts.map +1 -1
  248. package/lib/typescript/shared/stores/bounds/internals/links.d.ts +13 -10
  249. package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
  250. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  251. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +26 -5
  252. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  253. package/lib/typescript/shared/stores/bounds/types.d.ts +14 -7
  254. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  255. package/lib/typescript/shared/stores/gesture.store.d.ts +1 -0
  256. package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
  257. package/lib/typescript/shared/types/animation.types.d.ts +0 -18
  258. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  259. package/lib/typescript/shared/types/gesture.types.d.ts +8 -1
  260. package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -1
  261. package/lib/typescript/shared/types/index.d.ts +1 -1
  262. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  263. package/lib/typescript/shared/utils/bounds/helpers/create-bounds-accessor-core.d.ts.map +1 -1
  264. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
  265. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +1 -1
  266. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -1
  267. package/lib/typescript/shared/utils/bounds/helpers/resolve-bounds-pair-key.d.ts +4 -0
  268. package/lib/typescript/shared/utils/bounds/helpers/resolve-bounds-pair-key.d.ts.map +1 -0
  269. package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
  270. package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts +14 -1
  271. package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts.map +1 -1
  272. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts +48 -7
  273. package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
  274. package/lib/typescript/shared/utils/bounds/types/options.d.ts +2 -3
  275. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  276. package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts +3 -2
  277. package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts.map +1 -1
  278. package/package.json +1 -1
  279. package/src/component-stack/components/component-screen.tsx +3 -11
  280. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +30 -27
  281. package/src/shared/components/create-boundary-component/hooks/use-boundary-presence.ts +5 -5
  282. package/src/shared/components/create-boundary-component/hooks/use-initial-destination-measurement.ts +25 -24
  283. package/src/shared/components/create-boundary-component/hooks/use-initial-source-measurement.ts +41 -11
  284. package/src/shared/components/create-boundary-component/hooks/use-measurer.ts +49 -64
  285. package/src/shared/components/create-boundary-component/hooks/use-refresh-boundary.ts +44 -83
  286. package/src/shared/components/create-boundary-component/index.tsx +3 -1
  287. package/src/shared/components/create-boundary-component/types.ts +13 -11
  288. package/src/shared/components/create-boundary-component/utils/destination-signals.ts +129 -0
  289. package/src/shared/components/create-boundary-component/{hooks/helpers/scroll-measurement.ts → utils/measured-bounds.ts} +25 -1
  290. package/src/shared/components/create-boundary-component/utils/refresh-signals.ts +164 -0
  291. package/src/shared/components/create-boundary-component/utils/source-signals.ts +72 -0
  292. package/src/shared/components/native-screen.tsx +3 -12
  293. package/src/shared/constants.ts +1 -6
  294. package/src/shared/index.ts +0 -3
  295. package/src/shared/providers/helpers/measured-bounds-writes.ts +67 -0
  296. package/src/shared/providers/register-bounds.provider.tsx +68 -91
  297. package/src/shared/providers/screen/animation/helpers/accessors/use-build-transition-accessor.ts +0 -14
  298. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +1 -2
  299. package/src/shared/providers/screen/animation/helpers/pipeline.ts +1 -4
  300. package/src/shared/providers/screen/gestures/pan/pan-activation.ts +4 -1
  301. package/src/shared/providers/screen/gestures/pan/pan-lifecycle.ts +18 -2
  302. package/src/shared/providers/screen/gestures/pan/pan-release.ts +33 -0
  303. package/src/shared/providers/screen/gestures/pan/pan-reset.ts +3 -0
  304. package/src/shared/providers/screen/gestures/pan/use-pan-behavior.ts +9 -6
  305. package/src/shared/providers/screen/gestures/pinch/pinch-activation.ts +5 -2
  306. package/src/shared/providers/screen/gestures/pinch/pinch-lifecycle.ts +1 -0
  307. package/src/shared/providers/screen/gestures/pinch/use-pinch-behavior.ts +9 -6
  308. package/src/shared/providers/screen/gestures/shared/physics.ts +25 -0
  309. package/src/shared/providers/screen/gestures/shared/policy.ts +3 -5
  310. package/src/shared/providers/screen/gestures/types.ts +2 -0
  311. package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +0 -3
  312. package/src/shared/stores/bounds/helpers/link-pairs.helpers.ts +161 -0
  313. package/src/shared/stores/bounds/index.ts +10 -20
  314. package/src/shared/stores/bounds/internals/clear.ts +17 -41
  315. package/src/shared/stores/bounds/internals/entries.ts +56 -13
  316. package/src/shared/stores/bounds/internals/links.ts +222 -113
  317. package/src/shared/stores/bounds/internals/resolver.ts +23 -87
  318. package/src/shared/stores/bounds/internals/state.ts +27 -5
  319. package/src/shared/stores/bounds/types.ts +17 -7
  320. package/src/shared/stores/gesture.store.ts +3 -0
  321. package/src/shared/types/animation.types.ts +0 -23
  322. package/src/shared/types/gesture.types.ts +8 -2
  323. package/src/shared/types/index.ts +0 -4
  324. package/src/shared/utils/bounds/helpers/create-bounds-accessor-core.ts +1 -0
  325. package/src/shared/utils/bounds/helpers/create-link-accessor.ts +6 -6
  326. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +20 -11
  327. package/src/shared/utils/bounds/helpers/resolve-bounds-pair-key.ts +22 -0
  328. package/src/shared/utils/bounds/navigation/reveal/build.ts +153 -297
  329. package/src/shared/utils/bounds/navigation/reveal/config.ts +20 -1
  330. package/src/shared/utils/bounds/navigation/reveal/math.ts +234 -18
  331. package/src/shared/utils/bounds/types/options.ts +2 -3
  332. package/src/shared/utils/navigation/resolve-scene-neighbors.ts +36 -23
  333. package/lib/commonjs/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.js +0 -43
  334. package/lib/commonjs/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.js.map +0 -1
  335. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +0 -17
  336. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +0 -1
  337. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.js +0 -28
  338. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.js.map +0 -1
  339. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +0 -75
  340. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +0 -1
  341. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement.js +0 -20
  342. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement.js.map +0 -1
  343. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/scroll-measurement.js.map +0 -1
  344. package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js +0 -16
  345. package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +0 -1
  346. package/lib/commonjs/shared/providers/layout-anchor.provider.js +0 -86
  347. package/lib/commonjs/shared/providers/layout-anchor.provider.js.map +0 -1
  348. package/lib/commonjs/shared/stores/bounds/helpers/entries.helpers.js +0 -49
  349. package/lib/commonjs/shared/stores/bounds/helpers/entries.helpers.js.map +0 -1
  350. package/lib/commonjs/shared/stores/bounds/helpers/find-latest.js +0 -25
  351. package/lib/commonjs/shared/stores/bounds/helpers/find-latest.js.map +0 -1
  352. package/lib/commonjs/shared/stores/bounds/helpers/groups.helpers.js +0 -30
  353. package/lib/commonjs/shared/stores/bounds/helpers/groups.helpers.js.map +0 -1
  354. package/lib/commonjs/shared/stores/bounds/helpers/link.helpers.js +0 -79
  355. package/lib/commonjs/shared/stores/bounds/helpers/link.helpers.js.map +0 -1
  356. package/lib/commonjs/shared/stores/bounds/helpers/matching.js +0 -13
  357. package/lib/commonjs/shared/stores/bounds/helpers/matching.js.map +0 -1
  358. package/lib/commonjs/shared/stores/bounds/helpers/tag-state.helpers.js +0 -30
  359. package/lib/commonjs/shared/stores/bounds/helpers/tag-state.helpers.js.map +0 -1
  360. package/lib/commonjs/shared/stores/bounds/internals/groups.js +0 -102
  361. package/lib/commonjs/shared/stores/bounds/internals/groups.js.map +0 -1
  362. package/lib/module/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.js +0 -38
  363. package/lib/module/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.js.map +0 -1
  364. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +0 -12
  365. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +0 -1
  366. package/lib/module/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.js +0 -23
  367. package/lib/module/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.js.map +0 -1
  368. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +0 -68
  369. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +0 -1
  370. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement.js +0 -15
  371. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement.js.map +0 -1
  372. package/lib/module/shared/components/create-boundary-component/hooks/helpers/scroll-measurement.js.map +0 -1
  373. package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js +0 -12
  374. package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +0 -1
  375. package/lib/module/shared/providers/layout-anchor.provider.js +0 -80
  376. package/lib/module/shared/providers/layout-anchor.provider.js.map +0 -1
  377. package/lib/module/shared/stores/bounds/helpers/entries.helpers.js +0 -42
  378. package/lib/module/shared/stores/bounds/helpers/entries.helpers.js.map +0 -1
  379. package/lib/module/shared/stores/bounds/helpers/find-latest.js +0 -19
  380. package/lib/module/shared/stores/bounds/helpers/find-latest.js.map +0 -1
  381. package/lib/module/shared/stores/bounds/helpers/groups.helpers.js +0 -23
  382. package/lib/module/shared/stores/bounds/helpers/groups.helpers.js.map +0 -1
  383. package/lib/module/shared/stores/bounds/helpers/link.helpers.js +0 -69
  384. package/lib/module/shared/stores/bounds/helpers/link.helpers.js.map +0 -1
  385. package/lib/module/shared/stores/bounds/helpers/matching.js +0 -9
  386. package/lib/module/shared/stores/bounds/helpers/matching.js.map +0 -1
  387. package/lib/module/shared/stores/bounds/helpers/tag-state.helpers.js +0 -24
  388. package/lib/module/shared/stores/bounds/helpers/tag-state.helpers.js.map +0 -1
  389. package/lib/module/shared/stores/bounds/internals/groups.js +0 -95
  390. package/lib/module/shared/stores/bounds/internals/groups.js.map +0 -1
  391. package/lib/typescript/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.d.ts +0 -15
  392. package/lib/typescript/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.d.ts.map +0 -1
  393. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts +0 -2
  394. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +0 -1
  395. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.d.ts +0 -22
  396. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.d.ts.map +0 -1
  397. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +0 -29
  398. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +0 -1
  399. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement.d.ts +0 -3
  400. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement.d.ts.map +0 -1
  401. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/scroll-measurement.d.ts.map +0 -1
  402. package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts +0 -8
  403. package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts.map +0 -1
  404. package/lib/typescript/shared/providers/layout-anchor.provider.d.ts +0 -39
  405. package/lib/typescript/shared/providers/layout-anchor.provider.d.ts.map +0 -1
  406. package/lib/typescript/shared/stores/bounds/helpers/entries.helpers.d.ts +0 -5
  407. package/lib/typescript/shared/stores/bounds/helpers/entries.helpers.d.ts.map +0 -1
  408. package/lib/typescript/shared/stores/bounds/helpers/find-latest.d.ts +0 -3
  409. package/lib/typescript/shared/stores/bounds/helpers/find-latest.d.ts.map +0 -1
  410. package/lib/typescript/shared/stores/bounds/helpers/groups.helpers.d.ts +0 -10
  411. package/lib/typescript/shared/stores/bounds/helpers/groups.helpers.d.ts.map +0 -1
  412. package/lib/typescript/shared/stores/bounds/helpers/link.helpers.d.ts +0 -14
  413. package/lib/typescript/shared/stores/bounds/helpers/link.helpers.d.ts.map +0 -1
  414. package/lib/typescript/shared/stores/bounds/helpers/matching.d.ts +0 -3
  415. package/lib/typescript/shared/stores/bounds/helpers/matching.d.ts.map +0 -1
  416. package/lib/typescript/shared/stores/bounds/helpers/tag-state.helpers.d.ts +0 -5
  417. package/lib/typescript/shared/stores/bounds/helpers/tag-state.helpers.d.ts.map +0 -1
  418. package/lib/typescript/shared/stores/bounds/internals/groups.d.ts +0 -16
  419. package/lib/typescript/shared/stores/bounds/internals/groups.d.ts.map +0 -1
  420. package/src/shared/components/create-boundary-component/helpers/apply-measured-bounds-writes.ts +0 -83
  421. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +0 -20
  422. package/src/shared/components/create-boundary-component/hooks/helpers/boundary-link-context.ts +0 -48
  423. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +0 -101
  424. package/src/shared/components/create-boundary-component/hooks/helpers/measurement.ts +0 -25
  425. package/src/shared/components/create-boundary-component/utils/build-boundary-match-key.ts +0 -14
  426. package/src/shared/providers/layout-anchor.provider.tsx +0 -112
  427. package/src/shared/stores/bounds/helpers/entries.helpers.ts +0 -55
  428. package/src/shared/stores/bounds/helpers/find-latest.ts +0 -22
  429. package/src/shared/stores/bounds/helpers/groups.helpers.ts +0 -27
  430. package/src/shared/stores/bounds/helpers/link.helpers.ts +0 -131
  431. package/src/shared/stores/bounds/helpers/matching.ts +0 -11
  432. package/src/shared/stores/bounds/helpers/tag-state.helpers.ts +0 -24
  433. package/src/shared/stores/bounds/internals/groups.ts +0 -116
@@ -1,23 +1,64 @@
1
- import {
2
- applyEntryPatch,
3
- ensureScreenEntry,
4
- findMatchingScreenEntry,
5
- } from "../helpers/entries.helpers";
6
- import { ensureTagState, pruneTagState } from "../helpers/tag-state.helpers";
1
+ import { hasAnyKeys } from "../helpers/keys";
7
2
  import type { EntryPatch, ScreenEntry, ScreenKey, TagID } from "../types";
8
- import { type RegistryState, registry } from "./state";
3
+ import { type BoundaryEntriesState, boundaryRegistry } from "./state";
4
+
5
+ const ensureBoundaryState = (state: BoundaryEntriesState, tag: TagID) => {
6
+ "worklet";
7
+ if (!state[tag]) {
8
+ state[tag] = {
9
+ screens: {},
10
+ };
11
+ }
12
+ return state[tag];
13
+ };
14
+
15
+ const ensureScreenEntry = (
16
+ state: BoundaryEntriesState,
17
+ tag: TagID,
18
+ screenKey: ScreenKey,
19
+ ): ScreenEntry => {
20
+ "worklet";
21
+ const tagState = ensureBoundaryState(state, tag);
22
+ if (!tagState.screens[screenKey]) {
23
+ tagState.screens[screenKey] = {
24
+ bounds: null,
25
+ styles: {},
26
+ };
27
+ }
28
+ return tagState.screens[screenKey];
29
+ };
30
+
31
+ const applyEntryPatch = (entry: ScreenEntry, patch: EntryPatch) => {
32
+ "worklet";
33
+ if (patch.bounds !== undefined) {
34
+ entry.bounds = patch.bounds;
35
+ }
36
+
37
+ if (patch.styles !== undefined) {
38
+ entry.styles = patch.styles ?? {};
39
+ }
40
+
41
+ if (patch.boundaryConfig === undefined) {
42
+ return;
43
+ }
44
+
45
+ if (patch.boundaryConfig === null) {
46
+ delete entry.boundaryConfig;
47
+ } else {
48
+ entry.boundaryConfig = patch.boundaryConfig;
49
+ }
50
+ };
9
51
 
10
52
  function getEntry(tag: TagID, key: ScreenKey): ScreenEntry | null {
11
53
  "worklet";
12
- return findMatchingScreenEntry(registry.get()[tag], key);
54
+ return boundaryRegistry.get()[tag]?.screens[key] ?? null;
13
55
  }
14
56
 
15
57
  function setEntry(tag: TagID, screenKey: ScreenKey, patch: EntryPatch) {
16
58
  "worklet";
17
- registry.modify(<T extends RegistryState>(state: T): T => {
59
+ boundaryRegistry.modify(<T extends BoundaryEntriesState>(state: T): T => {
18
60
  "worklet";
19
- const tagState = ensureTagState(state, tag);
20
- const entry = ensureScreenEntry(tagState, screenKey);
61
+ const entry = ensureScreenEntry(state, tag, screenKey);
21
62
  applyEntryPatch(entry, patch);
22
63
  return state;
23
64
  });
@@ -25,7 +66,7 @@ function setEntry(tag: TagID, screenKey: ScreenKey, patch: EntryPatch) {
25
66
 
26
67
  function removeEntry(tag: TagID, screenKey: ScreenKey) {
27
68
  "worklet";
28
- registry.modify(<T extends RegistryState>(state: T): T => {
69
+ boundaryRegistry.modify(<T extends BoundaryEntriesState>(state: T): T => {
29
70
  "worklet";
30
71
  const tagState = state[tag];
31
72
  if (!tagState?.screens[screenKey]) {
@@ -33,7 +74,9 @@ function removeEntry(tag: TagID, screenKey: ScreenKey) {
33
74
  }
34
75
 
35
76
  delete tagState.screens[screenKey];
36
- pruneTagState(state, tag);
77
+ if (!hasAnyKeys(tagState.screens)) {
78
+ delete state[tag];
79
+ }
37
80
 
38
81
  return state;
39
82
  });
@@ -1,72 +1,169 @@
1
1
  import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
2
  import {
3
- findLatestPendingSourceLinkIndex,
4
- findLinkIndexForDestinationWrite,
5
- hasLinkSide,
6
- isCompletedLinkForScreenKey,
7
- isSameScreenFamily,
8
- selectSourceUpdateTargetIndex,
9
- } from "../helpers/link.helpers";
10
- import { ensureTagState } from "../helpers/tag-state.helpers";
11
- import type { ScreenKey, TagID, TagLink } from "../types";
12
- import { type RegistryState, registry } from "./state";
13
-
14
- type LinkSourceWriteMode = "capture" | "refresh";
15
- type LinkDestinationWriteMode = "attach" | "refresh";
3
+ createGroupTag,
4
+ createPendingPairKey,
5
+ ensurePairGroups,
6
+ ensurePairLinks,
7
+ getGroupKeyFromTag,
8
+ getLinkKeyFromTag,
9
+ getActiveGroupId as getPairActiveGroupId,
10
+ getDestination as getPairDestination,
11
+ getLink as getPairLink,
12
+ getSource as getPairSource,
13
+ getSourceScreenKeyFromPairKey,
14
+ removePairLink,
15
+ } from "../helpers/link-pairs.helpers";
16
+ import type {
17
+ GroupKey,
18
+ LinkKey,
19
+ LinkPairsState,
20
+ ScreenKey,
21
+ ScreenPairKey,
22
+ TagID,
23
+ TagLink,
24
+ } from "../types";
25
+ import { pairs } from "./state";
26
+
27
+ const toLinkKey = (tag: TagID): LinkKey => {
28
+ "worklet";
29
+ return getLinkKeyFromTag(tag);
30
+ };
31
+
32
+ const createLinkSide = (
33
+ screenKey: ScreenKey,
34
+ bounds: MeasuredDimensions,
35
+ styles: StyleProps,
36
+ ) => {
37
+ "worklet";
38
+ return {
39
+ screenKey,
40
+ bounds,
41
+ styles,
42
+ };
43
+ };
44
+
45
+ const writePairLink = (
46
+ state: LinkPairsState,
47
+ pairKey: ScreenPairKey,
48
+ linkKey: LinkKey,
49
+ link: TagLink,
50
+ ) => {
51
+ "worklet";
52
+ ensurePairLinks(state, pairKey)[linkKey] = link;
53
+ };
54
+
55
+ const writeGroup = (
56
+ state: LinkPairsState,
57
+ pairKey: ScreenPairKey,
58
+ group: GroupKey,
59
+ activeId: LinkKey,
60
+ initialId?: LinkKey,
61
+ ) => {
62
+ "worklet";
63
+ const previousInitialId = state[pairKey]?.groups?.[group]?.initialId;
64
+
65
+ ensurePairGroups(state, pairKey)[group] = {
66
+ activeId,
67
+ initialId: previousInitialId ?? initialId ?? activeId,
68
+ };
69
+ };
70
+
71
+ const writeDestination = (
72
+ state: LinkPairsState,
73
+ pairKey: ScreenPairKey,
74
+ linkKey: LinkKey,
75
+ screenKey: ScreenKey,
76
+ bounds: MeasuredDimensions,
77
+ styles: StyleProps,
78
+ group?: GroupKey,
79
+ ) => {
80
+ "worklet";
81
+ const link = getPairLink(state, pairKey, linkKey);
82
+ if (!link) return;
83
+
84
+ const destination = createLinkSide(screenKey, bounds, styles);
85
+
86
+ link.group = group ?? link.group;
87
+ link.destination = destination;
88
+ link.initialDestination ??= destination;
89
+
90
+ writePairLink(state, pairKey, linkKey, link);
91
+
92
+ if (link.group) {
93
+ writeGroup(state, pairKey, link.group, linkKey);
94
+ }
95
+ };
96
+
97
+ const promotePendingSource = (
98
+ state: LinkPairsState,
99
+ pairKey: ScreenPairKey,
100
+ linkKey: LinkKey,
101
+ ) => {
102
+ "worklet";
103
+ if (getPairLink(state, pairKey, linkKey)) return;
104
+
105
+ const sourceScreenKey = getSourceScreenKeyFromPairKey(pairKey);
106
+ const pendingPairKey = createPendingPairKey(sourceScreenKey);
107
+ if (pendingPairKey === pairKey) return;
108
+
109
+ const pendingLink = getPairLink(state, pendingPairKey, linkKey);
110
+ if (!pendingLink) return;
111
+
112
+ writePairLink(state, pairKey, linkKey, pendingLink);
113
+
114
+ if (pendingLink.group) {
115
+ const pendingGroupState =
116
+ state[pendingPairKey]?.groups?.[pendingLink.group];
117
+
118
+ if (pendingGroupState) {
119
+ writeGroup(
120
+ state,
121
+ pairKey,
122
+ pendingLink.group,
123
+ pendingGroupState.activeId,
124
+ pendingGroupState.initialId,
125
+ );
126
+ }
127
+ }
128
+
129
+ removePairLink(state, pendingPairKey, linkKey);
130
+ };
16
131
 
17
132
  function setSource(
18
- mode: LinkSourceWriteMode,
133
+ pairKey: ScreenPairKey,
19
134
  tag: TagID,
20
135
  screenKey: ScreenKey,
21
136
  bounds: MeasuredDimensions,
22
137
  styles: StyleProps = {},
138
+ group?: GroupKey,
23
139
  ) {
24
140
  "worklet";
25
- registry.modify(<T extends RegistryState>(state: T): T => {
141
+ pairs.modify(<T extends LinkPairsState>(state: T): T => {
26
142
  "worklet";
27
- const source = {
28
- screenKey,
29
- bounds,
30
- styles,
31
- };
143
+ const linkKey = toLinkKey(tag);
144
+ const source = createLinkSide(screenKey, bounds, styles);
32
145
 
33
- if (mode === "capture") {
34
- const tagState = ensureTagState(state, tag);
35
- const stack = tagState.linkStack;
36
- const topIndex = stack.length - 1;
37
- const topLink = topIndex >= 0 ? stack[topIndex] : null;
38
-
39
- if (
40
- topLink &&
41
- topLink.destination === null &&
42
- isSameScreenFamily(topLink.source, source)
43
- ) {
44
- topLink.source = source;
45
- if (!topLink.initialSource) {
46
- topLink.initialSource = source;
47
- }
48
- return state;
49
- }
50
-
51
- stack.push({
146
+ const pairLinks = ensurePairLinks(state, pairKey);
147
+
148
+ const existingLink = pairLinks[linkKey];
149
+ const link =
150
+ existingLink ??
151
+ ({
152
+ group,
52
153
  source,
53
154
  destination: null,
54
155
  initialSource: source,
55
- });
56
-
57
- return state;
58
- }
156
+ } satisfies TagLink);
59
157
 
60
- const stack = state[tag]?.linkStack;
61
- if (!stack || stack.length === 0) return state;
62
- const targetIndex = selectSourceUpdateTargetIndex(stack, screenKey);
63
- if (targetIndex === -1) return state;
158
+ link.group = group ?? link.group;
159
+ link.source = source;
160
+ link.initialSource ??= source;
64
161
 
65
- const link = stack[targetIndex];
162
+ pairLinks[linkKey] = link;
66
163
 
67
- link.source = source;
68
- if (!link.initialSource) {
69
- link.initialSource = source;
164
+ const pendingPairKey = createPendingPairKey(screenKey);
165
+ if (pendingPairKey !== pairKey) {
166
+ removePairLink(state, pendingPairKey, linkKey);
70
167
  }
71
168
 
72
169
  return state;
@@ -74,98 +171,110 @@ function setSource(
74
171
  }
75
172
 
76
173
  function setDestination(
77
- mode: LinkDestinationWriteMode,
174
+ pairKey: ScreenPairKey,
78
175
  tag: TagID,
79
176
  screenKey: ScreenKey,
80
177
  bounds: MeasuredDimensions,
81
178
  styles: StyleProps = {},
82
- expectedSourceScreenKey?: ScreenKey,
179
+ group?: GroupKey,
83
180
  ) {
84
181
  "worklet";
85
- registry.modify(<T extends RegistryState>(state: T): T => {
182
+ pairs.modify(<T extends LinkPairsState>(state: T): T => {
86
183
  "worklet";
87
- const stack = state[tag]?.linkStack;
88
- if (!stack || stack.length === 0) return state;
89
-
90
- const targetIndex = findLinkIndexForDestinationWrite(
91
- stack,
92
- mode === "refresh" ? screenKey : undefined,
93
- expectedSourceScreenKey,
94
- );
95
-
96
- if (targetIndex === -1) return state;
97
-
98
- const link = stack[targetIndex];
99
- const destination = {
100
- screenKey,
101
- bounds,
102
- styles,
103
- };
184
+ const linkKey = toLinkKey(tag);
185
+ promotePendingSource(state, pairKey, linkKey);
186
+ writeDestination(state, pairKey, linkKey, screenKey, bounds, styles, group);
104
187
 
105
- link.destination = destination;
106
- if (!link.initialDestination) {
107
- link.initialDestination = destination;
108
- }
188
+ return state;
189
+ });
190
+ }
109
191
 
192
+ function setActiveGroupId(pairKey: ScreenPairKey, group: GroupKey, tag: TagID) {
193
+ "worklet";
194
+ pairs.modify(<T extends LinkPairsState>(state: T): T => {
195
+ "worklet";
196
+ writeGroup(state, pairKey, group, toLinkKey(tag));
110
197
  return state;
111
198
  });
112
199
  }
113
200
 
114
- function getMatchedLink(tag: TagID, screenKey?: ScreenKey): TagLink | null {
201
+ function getActiveGroupId(
202
+ pairKey: ScreenPairKey,
203
+ group: GroupKey,
204
+ ): LinkKey | null {
115
205
  "worklet";
116
- const tagState = registry.get()[tag];
117
- const stack = tagState?.linkStack;
118
- if (!stack || stack.length === 0) {
119
- return null;
120
- }
206
+ return getPairActiveGroupId(pairs.get(), pairKey, group);
207
+ }
208
+
209
+ function getLink(pairKey: ScreenPairKey, tag: TagID): TagLink | null {
210
+ "worklet";
211
+ return getPairLink(pairs.get(), pairKey, toLinkKey(tag));
212
+ }
213
+
214
+ const isCompletedLink = (link: TagLink | null): link is TagLink => {
215
+ "worklet";
216
+ return !!link?.destination;
217
+ };
121
218
 
122
- if (!screenKey) {
123
- const lastLink = stack[stack.length - 1];
124
- return lastLink ?? null;
219
+ function getResolvedLink(
220
+ pairKey: ScreenPairKey,
221
+ tag: TagID,
222
+ ): { tag: TagID; link: TagLink | null } {
223
+ "worklet";
224
+ const state = pairs.get();
225
+ const linkKey = toLinkKey(tag);
226
+ const group = getGroupKeyFromTag(tag);
227
+ const requestedLink = getPairLink(state, pairKey, linkKey);
228
+
229
+ // Group active ids can update before the new member has a full source/destination
230
+ // link, so unresolved grouped links fall back to the initial id's measurements.
231
+ if (!group || isCompletedLink(requestedLink)) {
232
+ return {
233
+ tag,
234
+ link: requestedLink,
235
+ };
125
236
  }
126
237
 
127
- for (let i = stack.length - 1; i >= 0; i--) {
128
- const link = stack[i];
129
- if (isCompletedLinkForScreenKey(link, screenKey)) {
130
- return link;
238
+ const initialId = state[pairKey]?.groups?.[group]?.initialId;
239
+ if (initialId) {
240
+ const initialLink = getPairLink(state, pairKey, initialId);
241
+ if (isCompletedLink(initialLink)) {
242
+ return {
243
+ tag: createGroupTag(group, initialId),
244
+ link: initialLink,
245
+ };
131
246
  }
132
247
  }
133
248
 
134
- return null;
249
+ return {
250
+ tag,
251
+ link: requestedLink,
252
+ };
135
253
  }
136
254
 
137
- function getPendingLink(
255
+ function getSource(
256
+ pairKey: ScreenPairKey,
138
257
  tag: TagID,
139
- sourceScreenKey?: ScreenKey,
140
- ): TagLink | null {
258
+ ): TagLink["source"] | null {
141
259
  "worklet";
142
- const tagState = registry.get()[tag];
143
- const stack = tagState?.linkStack;
144
- if (!stack || stack.length === 0) return null;
145
-
146
- const pendingSourceLinkIndex = findLatestPendingSourceLinkIndex(
147
- stack,
148
- sourceScreenKey,
149
- );
150
- if (pendingSourceLinkIndex === -1) return null;
151
- return stack[pendingSourceLinkIndex] ?? null;
260
+ return getPairSource(pairs.get(), pairKey, toLinkKey(tag));
152
261
  }
153
262
 
154
- function hasSourceLink(tag: TagID, screenKey: ScreenKey): boolean {
155
- "worklet";
156
- return hasLinkSide(registry.get()[tag]?.linkStack, screenKey, "source");
157
- }
158
-
159
- function hasDestinationLink(tag: TagID, screenKey: ScreenKey): boolean {
263
+ function getDestination(
264
+ pairKey: ScreenPairKey,
265
+ tag: TagID,
266
+ ): TagLink["destination"] | null {
160
267
  "worklet";
161
- return hasLinkSide(registry.get()[tag]?.linkStack, screenKey, "destination");
268
+ return getPairDestination(pairs.get(), pairKey, toLinkKey(tag));
162
269
  }
163
270
 
164
271
  export {
165
- getMatchedLink,
166
- getPendingLink,
167
- hasDestinationLink,
168
- hasSourceLink,
272
+ getActiveGroupId,
273
+ getDestination,
274
+ getLink,
275
+ getResolvedLink,
276
+ getSource,
277
+ setActiveGroupId,
169
278
  setDestination,
170
279
  setSource,
171
280
  };
@@ -1,77 +1,27 @@
1
- import { findLatest } from "../helpers/find-latest";
2
- import { matchesScreenKey } from "../helpers/matching";
1
+ import { createScreenPairKey } from "../helpers/link-pairs.helpers";
3
2
  import type {
4
3
  ResolvedTransitionPair,
5
4
  ResolveTransitionContext,
6
- ScreenKey,
5
+ ScreenPairKey,
7
6
  TagID,
8
- TagLink,
9
7
  } from "../types";
10
- import { registry } from "./state";
8
+ import { getResolvedLink } from "./links";
11
9
 
12
- function findCompletedLinkByDestination(
13
- stack: TagLink[],
14
- screenKey?: ScreenKey,
15
- ): TagLink | null {
16
- "worklet";
17
- if (!screenKey) return null;
18
-
19
- return findLatest(
20
- stack,
21
- (link) =>
22
- !!link.destination && matchesScreenKey(link.destination, screenKey),
23
- );
24
- }
25
-
26
- function findCompletedLinkBySource(
27
- stack: TagLink[],
28
- screenKey?: ScreenKey,
29
- ): TagLink | null {
30
- "worklet";
31
- if (!screenKey) return null;
32
-
33
- return findLatest(
34
- stack,
35
- (link) => !!link.destination && matchesScreenKey(link.source, screenKey),
36
- );
37
- }
38
-
39
- function findPendingLinkBySource(
40
- stack: TagLink[],
41
- screenKey?: ScreenKey,
42
- ): TagLink | null {
43
- "worklet";
44
- if (!screenKey) return null;
45
-
46
- return findLatest(
47
- stack,
48
- (link) =>
49
- link.destination === null && matchesScreenKey(link.source, screenKey),
50
- );
51
- }
52
-
53
- function findEnteringTransitionLink(
54
- stack: TagLink[],
10
+ function resolvePairKey(
55
11
  context: ResolveTransitionContext,
56
- ): TagLink | null {
12
+ ): ScreenPairKey | null {
57
13
  "worklet";
58
- return (
59
- findCompletedLinkByDestination(stack, context.currentScreenKey) ??
60
- findPendingLinkBySource(stack, context.previousScreenKey) ??
61
- findCompletedLinkBySource(stack, context.previousScreenKey)
62
- );
63
- }
64
14
 
65
- function findExitingTransitionLink(
66
- stack: TagLink[],
67
- context: ResolveTransitionContext,
68
- ): TagLink | null {
69
- "worklet";
70
- return (
71
- findCompletedLinkBySource(stack, context.currentScreenKey) ??
72
- findCompletedLinkByDestination(stack, context.nextScreenKey) ??
73
- findPendingLinkBySource(stack, context.currentScreenKey)
74
- );
15
+ if (context.entering) {
16
+ if (!context.previousScreenKey || !context.currentScreenKey) return null;
17
+ return createScreenPairKey(
18
+ context.previousScreenKey,
19
+ context.currentScreenKey,
20
+ );
21
+ }
22
+
23
+ if (!context.currentScreenKey || !context.nextScreenKey) return null;
24
+ return createScreenPairKey(context.currentScreenKey, context.nextScreenKey);
75
25
  }
76
26
 
77
27
  function resolveTransitionPair(
@@ -79,30 +29,16 @@ function resolveTransitionPair(
79
29
  context: ResolveTransitionContext,
80
30
  ): ResolvedTransitionPair {
81
31
  "worklet";
82
- const tagState = registry.get()[tag];
83
- const stack = tagState?.linkStack;
84
-
85
- const matchedLink =
86
- stack && stack.length > 0
87
- ? context.entering
88
- ? findEnteringTransitionLink(stack, context)
89
- : findExitingTransitionLink(stack, context)
90
- : null;
91
-
92
- const sourceBounds = matchedLink?.source?.bounds ?? null;
93
- const destinationBounds = matchedLink?.destination?.bounds ?? null;
94
- const sourceStyles = matchedLink?.source?.styles ?? null;
95
- const destinationStyles = matchedLink?.destination?.styles ?? null;
96
- const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
97
- const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
32
+ const pairKey = resolvePairKey(context);
33
+ const matchedLink = pairKey ? getResolvedLink(pairKey, tag).link : null;
98
34
 
99
35
  return {
100
- sourceBounds,
101
- destinationBounds,
102
- sourceStyles,
103
- destinationStyles,
104
- sourceScreenKey,
105
- destinationScreenKey,
36
+ sourceBounds: matchedLink?.source.bounds ?? null,
37
+ destinationBounds: matchedLink?.destination?.bounds ?? null,
38
+ sourceStyles: matchedLink?.source.styles ?? null,
39
+ destinationStyles: matchedLink?.destination?.styles ?? null,
40
+ sourceScreenKey: matchedLink?.source.screenKey ?? null,
41
+ destinationScreenKey: matchedLink?.destination?.screenKey ?? null,
106
42
  };
107
43
  }
108
44
 
@@ -1,8 +1,30 @@
1
1
  import { makeMutable } from "react-native-reanimated";
2
- import type { GroupState, TagID, TagState } from "../types";
2
+ import type { LinkPairsState, TagID, TagState } from "../types";
3
3
 
4
- export type RegistryState = Record<TagID, TagState>;
5
- export type GroupsState = Record<string, GroupState>;
4
+ export type BoundaryEntriesState = Record<TagID, TagState>;
6
5
 
7
- export const registry = makeMutable<RegistryState>({});
8
- export const groups = makeMutable<GroupsState>({});
6
+ export const boundaryRegistry = makeMutable<BoundaryEntriesState>({});
7
+
8
+ /**
9
+ * Transition links scoped per screen pair.
10
+ *
11
+ * Links used to live in a flat array that acted like a global history. To find
12
+ * the right link, we had to scan for the latest pending or completed entry that
13
+ * matched a screen, which made refreshes and rapid triggers tricky to handle.
14
+ *
15
+ * Keying by screen pair fixes that: each transition lives under its pair, and
16
+ * every shared boundary id maps to a single link in that pair. Refreshing the
17
+ * source or destination just overwrites the same slot instead of pushing a new
18
+ * history entry.
19
+ *
20
+ * Example:
21
+ *
22
+ * {
23
+ * "a<>b": {
24
+ * links: {
25
+ * "unique-tag-1": { source: ..., destination: ... },
26
+ * },
27
+ * },
28
+ * }
29
+ */
30
+ export const pairs = makeMutable<LinkPairsState>({});