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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  2. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +22 -60
  4. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +56 -41
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +111 -2
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +69 -0
  16. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  17. package/lib/commonjs/shared/components/create-boundary-component/index.js +10 -5
  18. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  19. package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -32
  20. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  21. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  22. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  23. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +7 -5
  24. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  25. package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
  26. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  27. package/lib/commonjs/shared/constants.js +17 -3
  28. package/lib/commonjs/shared/constants.js.map +1 -1
  29. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
  30. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  31. package/lib/commonjs/shared/index.js +6 -0
  32. package/lib/commonjs/shared/index.js.map +1 -1
  33. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
  34. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  35. package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
  36. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  38. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  40. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  41. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +1 -11
  42. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  43. package/lib/commonjs/shared/stores/animation.store.js +9 -3
  44. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  45. package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
  46. package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
  47. package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
  48. package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
  49. package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -7
  50. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  51. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -51
  52. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  53. package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
  54. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  55. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
  56. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  57. package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
  58. package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
  59. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  60. package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
  61. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  62. package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  63. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  64. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
  65. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  66. package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  67. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  68. package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +14 -20
  69. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  70. package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  71. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  72. package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  73. package/lib/commonjs/shared/utils/bounds/index.js +16 -44
  74. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  75. package/lib/commonjs/shared/utils/bounds/zoom/build.js +234 -50
  76. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  77. package/lib/commonjs/shared/utils/bounds/zoom/config.js +10 -1
  78. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  79. package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
  80. package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
  81. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  82. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  83. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +23 -61
  84. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  85. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  86. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  87. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +54 -39
  88. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  89. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  90. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  91. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  92. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  93. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +114 -4
  94. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  95. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +64 -0
  96. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  97. package/lib/module/shared/components/create-boundary-component/index.js +10 -5
  98. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  99. package/lib/module/shared/components/create-transition-aware-component.js +10 -34
  100. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  101. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  102. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  103. package/lib/module/shared/components/screen-container/layers/backdrop.js +7 -5
  104. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  105. package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
  106. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  107. package/lib/module/shared/constants.js +16 -2
  108. package/lib/module/shared/constants.js.map +1 -1
  109. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
  110. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  111. package/lib/module/shared/index.js +1 -1
  112. package/lib/module/shared/index.js.map +1 -1
  113. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
  114. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  115. package/lib/module/shared/providers/register-bounds.provider.js +9 -1
  116. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  117. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  118. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  119. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  120. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  121. package/lib/module/shared/providers/screen/styles/styles.provider.js +1 -11
  122. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  123. package/lib/module/shared/stores/animation.store.js +9 -3
  124. package/lib/module/shared/stores/animation.store.js.map +1 -1
  125. package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
  126. package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
  127. package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
  128. package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
  129. package/lib/module/shared/stores/bounds/internals/registry.js +19 -8
  130. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  131. package/lib/module/shared/stores/bounds/internals/resolver.js +8 -52
  132. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  133. package/lib/module/shared/stores/bounds/internals/state.js +0 -78
  134. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  135. package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
  136. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  137. package/lib/module/shared/utils/bounds/constants.js.map +1 -0
  138. package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
  139. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  140. package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
  141. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  142. package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  143. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  144. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
  145. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  146. package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  147. package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  148. package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +12 -18
  149. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  150. package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  151. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  152. package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  153. package/lib/module/shared/utils/bounds/index.js +14 -42
  154. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  155. package/lib/module/shared/utils/bounds/zoom/build.js +238 -54
  156. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  157. package/lib/module/shared/utils/bounds/zoom/config.js +9 -0
  158. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  159. package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
  160. package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
  161. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
  162. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  163. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  164. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +17 -11
  165. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  166. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
  167. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
  168. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +1 -2
  169. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  170. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +20 -1
  171. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  172. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts +12 -0
  173. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
  174. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +10 -4
  175. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  176. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
  177. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  178. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  179. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  180. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  181. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  182. package/lib/typescript/shared/constants.d.ts +33 -1
  183. package/lib/typescript/shared/constants.d.ts.map +1 -1
  184. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
  185. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
  186. package/lib/typescript/shared/index.d.ts +3 -3
  187. package/lib/typescript/shared/index.d.ts.map +1 -1
  188. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  189. package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
  190. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  191. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
  192. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
  193. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
  194. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  195. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
  196. package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
  197. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  198. package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
  199. package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
  200. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  201. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  202. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
  203. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  204. package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
  205. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  206. package/lib/typescript/shared/types/animation.types.d.ts +11 -0
  207. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  208. package/lib/typescript/shared/types/bounds.types.d.ts +106 -1
  209. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  210. package/lib/typescript/shared/types/index.d.ts +1 -1
  211. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  212. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
  213. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  214. package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
  215. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
  216. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
  217. package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
  218. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
  219. package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
  220. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
  221. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
  222. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
  223. package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
  224. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
  225. package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
  226. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
  227. package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
  228. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
  229. package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
  230. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  231. package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
  232. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  233. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  234. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +9 -0
  235. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  236. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
  237. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
  238. package/package.json +1 -1
  239. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +6 -4
  240. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +28 -60
  241. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
  242. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +72 -53
  243. package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
  244. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +5 -34
  245. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +180 -6
  246. package/src/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.ts +110 -0
  247. package/src/shared/components/create-boundary-component/index.tsx +10 -5
  248. package/src/shared/components/create-boundary-component/types.ts +1 -2
  249. package/src/shared/components/create-transition-aware-component.tsx +10 -47
  250. package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
  251. package/src/shared/components/screen-container/layers/backdrop.tsx +6 -9
  252. package/src/shared/components/screen-lifecycle/index.tsx +1 -4
  253. package/src/shared/constants.ts +11 -1
  254. package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
  255. package/src/shared/index.ts +3 -0
  256. package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
  257. package/src/shared/providers/register-bounds.provider.tsx +8 -1
  258. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
  259. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
  260. package/src/shared/providers/screen/styles/styles.provider.tsx +1 -12
  261. package/src/shared/stores/animation.store.ts +11 -2
  262. package/src/shared/stores/bounds/internals/clear.ts +47 -220
  263. package/src/shared/stores/bounds/internals/presence.ts +1 -4
  264. package/src/shared/stores/bounds/internals/registry.ts +25 -14
  265. package/src/shared/stores/bounds/internals/resolver.ts +7 -84
  266. package/src/shared/stores/bounds/internals/state.ts +0 -98
  267. package/src/shared/stores/bounds/types.ts +0 -2
  268. package/src/shared/types/animation.types.ts +13 -0
  269. package/src/shared/types/bounds.types.ts +108 -1
  270. package/src/shared/types/index.ts +2 -0
  271. package/src/shared/utils/animation/animate-to-progress.ts +11 -1
  272. package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
  273. package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
  274. package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
  275. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
  276. package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
  277. package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +10 -20
  278. package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
  279. package/src/shared/utils/bounds/index.ts +13 -53
  280. package/src/shared/utils/bounds/types/options.ts +3 -2
  281. package/src/shared/utils/bounds/zoom/build.ts +316 -95
  282. package/src/shared/utils/bounds/zoom/config.ts +11 -0
  283. package/src/shared/utils/bounds/zoom/math.ts +57 -0
  284. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
  285. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  286. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
  287. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  288. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
  289. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  290. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
  291. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  292. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -58
  293. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  294. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
  295. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  296. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
  297. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  298. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  299. package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
  300. package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  301. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
  302. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  303. package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  304. package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  305. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  306. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  307. package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
  308. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
  309. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  310. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
  311. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  312. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
  313. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  314. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
  315. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  316. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -53
  317. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  318. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
  319. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  320. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
  321. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  322. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  323. package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
  324. package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  325. package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
  326. package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  327. package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  328. package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  329. package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  330. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  331. package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
  332. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
  333. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
  334. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
  335. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
  336. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
  337. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
  338. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
  339. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
  340. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -11
  341. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
  342. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
  343. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
  344. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
  345. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
  346. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
  347. package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
  348. package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
  349. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
  350. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
  351. package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
  352. package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
  353. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
  354. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
  355. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
  356. package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
  357. package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
  358. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
  359. package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
  360. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
  361. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -87
  362. package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
  363. package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
  364. package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
  365. /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  366. /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  367. /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  368. /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  369. /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
  370. /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
  371. /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
  372. /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
@@ -1,18 +1,13 @@
1
1
  import { matchesNavigatorKey, matchesScreenKey } from "../helpers/matching";
2
2
  import type {
3
3
  NavigatorKey,
4
+ PresenceEntry,
4
5
  PresenceState,
5
6
  ScreenKey,
6
7
  SnapshotEntry,
7
8
  TagLink,
8
9
  } from "../types";
9
- import {
10
- debugClearLog,
11
- debugStoreSizeLog,
12
- presence,
13
- type RegistryState,
14
- registry,
15
- } from "./state";
10
+ import { presence, type RegistryState, registry } from "./state";
16
11
 
17
12
  const hasAnyKeys = (record: Record<string, unknown>) => {
18
13
  "worklet";
@@ -22,128 +17,23 @@ const hasAnyKeys = (record: Record<string, unknown>) => {
22
17
  return false;
23
18
  };
24
19
 
25
- const countRegistryMatches = (
20
+ type SnapshotPredicate = (
26
21
  screenKey: ScreenKey,
27
- matchByAncestor: boolean,
28
- ): { snapshots: number; links: number } => {
29
- "worklet";
30
- const currentRegistry = registry.value;
31
- let snapshots = 0;
32
- let links = 0;
33
-
34
- for (const tag in currentRegistry) {
35
- const tagState = currentRegistry[tag];
36
-
37
- for (const snapshotKey in tagState.snapshots) {
38
- const snapshot = tagState.snapshots[snapshotKey];
39
- const matched = matchByAncestor
40
- ? snapshotKey === screenKey ||
41
- (snapshot.ancestorKeys?.includes(screenKey) ?? false)
42
- : snapshotKey === screenKey;
43
- if (matched) snapshots++;
44
- }
45
-
46
- for (let i = 0; i < tagState.linkStack.length; i++) {
47
- const link = tagState.linkStack[i];
48
- if (
49
- matchesScreenKey(link.source, screenKey) ||
50
- matchesScreenKey(link.destination, screenKey)
51
- ) {
52
- links++;
53
- }
54
- }
55
- }
56
-
57
- return { snapshots, links };
58
- };
59
-
60
- const countRegistryMatchesByBranch = (
61
- branchNavigatorKey: NavigatorKey,
62
- ): { snapshots: number; links: number } => {
63
- "worklet";
64
- const currentRegistry = registry.value;
65
- let snapshots = 0;
66
- let links = 0;
67
-
68
- for (const tag in currentRegistry) {
69
- const tagState = currentRegistry[tag];
70
-
71
- for (const snapshotKey in tagState.snapshots) {
72
- const snapshot = tagState.snapshots[snapshotKey];
73
- const matched =
74
- snapshot.navigatorKey === branchNavigatorKey ||
75
- (snapshot.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
76
- if (matched) snapshots++;
77
- }
78
-
79
- for (let i = 0; i < tagState.linkStack.length; i++) {
80
- const link = tagState.linkStack[i];
81
- if (
82
- matchesNavigatorKey(link.source, branchNavigatorKey) ||
83
- matchesNavigatorKey(link.destination, branchNavigatorKey)
84
- ) {
85
- links++;
86
- }
87
- }
88
- }
22
+ snapshot: SnapshotEntry,
23
+ ) => boolean;
89
24
 
90
- return { snapshots, links };
91
- };
25
+ type LinkPredicate = (link: TagLink) => boolean;
92
26
 
93
- const countPresenceMatches = (
27
+ type PresencePredicate = (
94
28
  screenKey: ScreenKey,
95
- matchByAncestor: boolean,
96
- ): number => {
97
- "worklet";
98
- const currentPresence = presence.value;
99
- let matches = 0;
100
-
101
- for (const tag in currentPresence) {
102
- const tagEntries = currentPresence[tag];
103
- for (const entryScreenKey in tagEntries) {
104
- const entry = tagEntries[entryScreenKey];
105
- const matched = matchByAncestor
106
- ? entryScreenKey === screenKey ||
107
- (entry.ancestorKeys?.includes(screenKey) ?? false)
108
- : entryScreenKey === screenKey;
109
- if (matched) matches++;
110
- }
111
- }
112
-
113
- return matches;
114
- };
115
-
116
- const countPresenceMatchesByBranch = (
117
- branchNavigatorKey: NavigatorKey,
118
- ): number => {
119
- "worklet";
120
- const currentPresence = presence.value;
121
- let matches = 0;
122
-
123
- for (const tag in currentPresence) {
124
- const tagEntries = currentPresence[tag];
125
- for (const entryScreenKey in tagEntries) {
126
- const entry = tagEntries[entryScreenKey];
127
- const matched =
128
- entry.navigatorKey === branchNavigatorKey ||
129
- (entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
130
- if (matched) matches++;
131
- }
132
- }
133
-
134
- return matches;
135
- };
29
+ entry: PresenceEntry,
30
+ ) => boolean;
136
31
 
137
- const clearRegistry = (params: {
138
- shouldRemoveSnapshot: (
139
- screenKey: ScreenKey,
140
- snapshot: SnapshotEntry,
141
- ) => boolean;
142
- shouldRemoveLink: (link: TagLink) => boolean;
143
- }) => {
32
+ const clearRegistry = (
33
+ shouldClearSnapshot: SnapshotPredicate,
34
+ shouldClearLink: LinkPredicate,
35
+ ) => {
144
36
  "worklet";
145
- const { shouldRemoveSnapshot, shouldRemoveLink } = params;
146
-
147
37
  registry.modify(<T extends RegistryState>(state: T): T => {
148
38
  "worklet";
149
39
  for (const tag in state) {
@@ -151,14 +41,14 @@ const clearRegistry = (params: {
151
41
 
152
42
  for (const snapshotKey in tagState.snapshots) {
153
43
  const snapshot = tagState.snapshots[snapshotKey];
154
- if (shouldRemoveSnapshot(snapshotKey, snapshot)) {
44
+ if (shouldClearSnapshot(snapshotKey, snapshot)) {
155
45
  delete tagState.snapshots[snapshotKey];
156
46
  }
157
47
  }
158
48
 
159
49
  for (let i = tagState.linkStack.length - 1; i >= 0; i--) {
160
50
  const link = tagState.linkStack[i];
161
- if (shouldRemoveLink(link)) {
51
+ if (shouldClearLink(link)) {
162
52
  tagState.linkStack.splice(i, 1);
163
53
  }
164
54
  }
@@ -172,25 +62,7 @@ const clearRegistry = (params: {
172
62
  });
173
63
  };
174
64
 
175
- const clearPresenceDirect = (screenKey: ScreenKey) => {
176
- "worklet";
177
- presence.modify(<T extends PresenceState>(state: T): T => {
178
- "worklet";
179
- for (const tag in state) {
180
- const tagEntries = state[tag];
181
- if (!tagEntries[screenKey]) continue;
182
-
183
- delete tagEntries[screenKey];
184
-
185
- if (!hasAnyKeys(tagEntries)) {
186
- delete state[tag];
187
- }
188
- }
189
- return state;
190
- });
191
- };
192
-
193
- const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
65
+ const clearPresence = (shouldClearPresence: PresencePredicate) => {
194
66
  "worklet";
195
67
  presence.modify(<T extends PresenceState>(state: T): T => {
196
68
  "worklet";
@@ -199,10 +71,7 @@ const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
199
71
 
200
72
  for (const entryScreenKey in tagEntries) {
201
73
  const entry = tagEntries[entryScreenKey];
202
- const shouldRemove =
203
- entryScreenKey === ancestorKey ||
204
- (entry.ancestorKeys?.includes(ancestorKey) ?? false);
205
- if (shouldRemove) {
74
+ if (shouldClearPresence(entryScreenKey, entry)) {
206
75
  delete tagEntries[entryScreenKey];
207
76
  }
208
77
  }
@@ -211,125 +80,83 @@ const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
211
80
  delete state[tag];
212
81
  }
213
82
  }
83
+
214
84
  return state;
215
85
  });
216
86
  };
217
87
 
218
- const clearPresenceByBranch = (branchNavigatorKey: NavigatorKey) => {
88
+ const performClear = (
89
+ shouldClearSnapshot: SnapshotPredicate,
90
+ shouldClearLink: LinkPredicate,
91
+ shouldClearPresence: PresencePredicate,
92
+ ) => {
219
93
  "worklet";
220
- presence.modify(<T extends PresenceState>(state: T): T => {
221
- "worklet";
222
- for (const tag in state) {
223
- const tagEntries = state[tag];
224
-
225
- for (const entryScreenKey in tagEntries) {
226
- const entry = tagEntries[entryScreenKey];
227
- const shouldRemove =
228
- entry.navigatorKey === branchNavigatorKey ||
229
- (entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
230
-
231
- if (shouldRemove) {
232
- delete tagEntries[entryScreenKey];
233
- }
234
- }
235
-
236
- if (!hasAnyKeys(tagEntries)) {
237
- delete state[tag];
238
- }
239
- }
240
- return state;
241
- });
94
+ clearRegistry(shouldClearSnapshot, shouldClearLink);
95
+ clearPresence(shouldClearPresence);
242
96
  };
243
97
 
244
98
  function clear(screenKey: ScreenKey) {
245
99
  "worklet";
246
- const beforeMatches = countRegistryMatches(screenKey, false);
247
- const beforePresenceMatches = countPresenceMatches(screenKey, false);
248
-
249
- clearRegistry({
250
- shouldRemoveSnapshot: (snapshotKey) => snapshotKey === screenKey,
251
- shouldRemoveLink: (link) => {
100
+ performClear(
101
+ (snapshotKey) => snapshotKey === screenKey,
102
+ (link) => {
252
103
  return (
253
104
  matchesScreenKey(link.source, screenKey) ||
254
105
  matchesScreenKey(link.destination, screenKey)
255
106
  );
256
107
  },
257
- });
258
-
259
- clearPresenceDirect(screenKey);
260
-
261
- const afterMatches = countRegistryMatches(screenKey, false);
262
- const afterPresenceMatches = countPresenceMatches(screenKey, false);
263
-
264
- debugClearLog(
265
- `clear(${screenKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
108
+ (entryScreenKey) => entryScreenKey === screenKey,
266
109
  );
267
- debugStoreSizeLog(`clear(${screenKey})`);
268
110
  }
269
111
 
270
112
  function clearByAncestor(ancestorKey: ScreenKey) {
271
113
  "worklet";
272
- const beforeMatches = countRegistryMatches(ancestorKey, true);
273
- const beforePresenceMatches = countPresenceMatches(ancestorKey, true);
274
-
275
- clearRegistry({
276
- shouldRemoveSnapshot: (snapshotKey, snapshot) => {
114
+ performClear(
115
+ (snapshotKey, snapshot) => {
277
116
  return (
278
117
  snapshotKey === ancestorKey ||
279
118
  (snapshot.ancestorKeys?.includes(ancestorKey) ?? false)
280
119
  );
281
120
  },
282
- shouldRemoveLink: (link) => {
121
+ (link) => {
283
122
  return (
284
123
  matchesScreenKey(link.source, ancestorKey) ||
285
124
  matchesScreenKey(link.destination, ancestorKey)
286
125
  );
287
126
  },
288
- });
289
-
290
- clearPresenceByAncestor(ancestorKey);
291
-
292
- const afterMatches = countRegistryMatches(ancestorKey, true);
293
- const afterPresenceMatches = countPresenceMatches(ancestorKey, true);
294
-
295
- debugClearLog(
296
- `clearByAncestor(${ancestorKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
127
+ (entryScreenKey, entry) => {
128
+ return (
129
+ entryScreenKey === ancestorKey ||
130
+ (entry.ancestorKeys?.includes(ancestorKey) ?? false)
131
+ );
132
+ },
297
133
  );
298
- debugStoreSizeLog(`clearByAncestor(${ancestorKey})`);
299
134
  }
300
135
 
301
136
  function clearByBranch(branchNavigatorKey: NavigatorKey) {
302
137
  "worklet";
303
138
  if (!branchNavigatorKey) return;
304
139
 
305
- const beforeMatches = countRegistryMatchesByBranch(branchNavigatorKey);
306
- const beforePresenceMatches =
307
- countPresenceMatchesByBranch(branchNavigatorKey);
308
-
309
- clearRegistry({
310
- shouldRemoveSnapshot: (_snapshotKey, snapshot) => {
140
+ performClear(
141
+ (_snapshotKey, snapshot) => {
311
142
  return (
312
143
  snapshot.navigatorKey === branchNavigatorKey ||
313
144
  (snapshot.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false)
314
145
  );
315
146
  },
316
- shouldRemoveLink: (link) => {
147
+ (link) => {
317
148
  return (
318
149
  matchesNavigatorKey(link.source, branchNavigatorKey) ||
319
150
  matchesNavigatorKey(link.destination, branchNavigatorKey)
320
151
  );
321
152
  },
322
- });
323
-
324
- clearPresenceByBranch(branchNavigatorKey);
325
-
326
- const afterMatches = countRegistryMatchesByBranch(branchNavigatorKey);
327
- const afterPresenceMatches = countPresenceMatchesByBranch(branchNavigatorKey);
328
-
329
- debugClearLog(
330
- `clearByBranch(${branchNavigatorKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
153
+ (_entryScreenKey, entry) => {
154
+ return (
155
+ entry.navigatorKey === branchNavigatorKey ||
156
+ (entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false)
157
+ );
158
+ },
331
159
  );
332
- debugStoreSizeLog(`clearByBranch(${branchNavigatorKey})`);
333
160
  }
334
161
 
335
162
  export { clear, clearByAncestor, clearByBranch };
@@ -1,5 +1,5 @@
1
1
  import type { BoundaryConfig, PresenceState, ScreenKey, TagID } from "../types";
2
- import { debugStoreSizeLog, type GroupsState, groups, presence } from "./state";
2
+ import { type GroupsState, groups, presence } from "./state";
3
3
 
4
4
  function registerBoundaryPresence(
5
5
  tag: TagID,
@@ -31,7 +31,6 @@ function registerBoundaryPresence(
31
31
 
32
32
  return state;
33
33
  });
34
- debugStoreSizeLog(`registerBoundaryPresence(${tag},${screenKey})`);
35
34
  }
36
35
 
37
36
  function unregisterBoundaryPresence(tag: TagID, screenKey: ScreenKey) {
@@ -63,7 +62,6 @@ function unregisterBoundaryPresence(tag: TagID, screenKey: ScreenKey) {
63
62
  delete state[tag];
64
63
  return state;
65
64
  });
66
- debugStoreSizeLog(`unregisterBoundaryPresence(${tag},${screenKey})`);
67
65
  }
68
66
 
69
67
  function hasBoundaryPresence(tag: TagID, screenKey: ScreenKey): boolean {
@@ -123,7 +121,6 @@ function setGroupActiveId(group: string, id: string) {
123
121
  };
124
122
  return state;
125
123
  });
126
- debugStoreSizeLog(`setGroupActiveId(${group},${id})`);
127
124
  }
128
125
 
129
126
  function getGroupActiveId(group: string): string | null {
@@ -8,12 +8,7 @@ import type {
8
8
  TagLink,
9
9
  TagState,
10
10
  } from "../types";
11
- import {
12
- createEmptyTagState,
13
- debugStoreSizeLog,
14
- type RegistryState,
15
- registry,
16
- } from "./state";
11
+ import { createEmptyTagState, type RegistryState, registry } from "./state";
17
12
 
18
13
  const LINK_HISTORY_LIMIT = 3;
19
14
 
@@ -86,7 +81,6 @@ function registerSnapshot(
86
81
  };
87
82
  return state;
88
83
  });
89
- debugStoreSizeLog(`registerSnapshot(${tag},${screenKey})`);
90
84
  }
91
85
 
92
86
  function setLinkSource(
@@ -129,7 +123,6 @@ function setLinkSource(
129
123
 
130
124
  return state;
131
125
  });
132
- debugStoreSizeLog(`setLinkSource(${tag},${screenKey})`);
133
126
  }
134
127
 
135
128
  function updateLinkSource(
@@ -182,7 +175,6 @@ function updateLinkSource(
182
175
 
183
176
  return state;
184
177
  });
185
- debugStoreSizeLog(`updateLinkSource(${tag},${screenKey})`);
186
178
  }
187
179
 
188
180
  const findLatestPendingIndex = (
@@ -204,6 +196,22 @@ const findLatestPendingIndex = (
204
196
  return -1;
205
197
  };
206
198
 
199
+ const findLatestSourceIndex = (
200
+ stack: TagLink[],
201
+ expectedSourceScreenKey?: ScreenKey,
202
+ ): number => {
203
+ "worklet";
204
+ if (!expectedSourceScreenKey) return -1;
205
+
206
+ for (let i = stack.length - 1; i >= 0; i--) {
207
+ if (matchesScreenKey(stack[i].source, expectedSourceScreenKey)) {
208
+ return i;
209
+ }
210
+ }
211
+
212
+ return -1;
213
+ };
214
+
207
215
  function setLinkDestination(
208
216
  tag: TagID,
209
217
  screenKey: ScreenKey,
@@ -221,12 +229,13 @@ function setLinkDestination(
221
229
  const stack = tagState?.linkStack;
222
230
  if (!stack || stack.length === 0) return state;
223
231
 
224
- const targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
232
+ let targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
233
+ if (targetIndex === -1) {
234
+ targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
235
+ }
225
236
  if (targetIndex === -1) return state;
226
237
 
227
238
  const targetLink = stack[targetIndex];
228
- if (targetLink.destination !== null) return state;
229
-
230
239
  targetLink.destination = {
231
240
  screenKey,
232
241
  ancestorKeys,
@@ -238,7 +247,6 @@ function setLinkDestination(
238
247
 
239
248
  return state;
240
249
  });
241
- debugStoreSizeLog(`setLinkDestination(${tag},${screenKey})`);
242
250
  }
243
251
 
244
252
  function updateLinkDestination(
@@ -272,6 +280,10 @@ function updateLinkDestination(
272
280
  targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
273
281
  }
274
282
 
283
+ if (targetIndex === -1) {
284
+ targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
285
+ }
286
+
275
287
  if (targetIndex === -1) {
276
288
  return state;
277
289
  }
@@ -287,7 +299,6 @@ function updateLinkDestination(
287
299
 
288
300
  return state;
289
301
  });
290
- debugStoreSizeLog(`updateLinkDestination(${tag},${screenKey})`);
291
302
  }
292
303
 
293
304
  function getActiveLink(tag: TagID, screenKey?: ScreenKey): TagLink | null {
@@ -1,4 +1,3 @@
1
- import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
1
  import { matchesScreenKey } from "../helpers/matching";
3
2
  import type {
4
3
  ResolvedTransitionPair,
@@ -8,8 +7,7 @@ import type {
8
7
  TagLink,
9
8
  TagState,
10
9
  } from "../types";
11
- import { getSnapshot } from "./registry";
12
- import { debugResolverLog, registry } from "./state";
10
+ import { registry } from "./state";
13
11
 
14
12
  const findLatestLink = (
15
13
  tagState: TagState,
@@ -67,30 +65,6 @@ function findPendingLinkBySource(
67
65
  );
68
66
  }
69
67
 
70
- function getSnapshotBoundsByPriority(
71
- tag: TagID,
72
- keys: (ScreenKey | undefined)[],
73
- ): {
74
- bounds: MeasuredDimensions;
75
- styles: StyleProps;
76
- screenKey: ScreenKey;
77
- } | null {
78
- "worklet";
79
- for (let i = 0; i < keys.length; i++) {
80
- const key = keys[i];
81
- if (!key) continue;
82
- const snapshot = getSnapshot(tag, key);
83
- if (!snapshot) continue;
84
- return {
85
- bounds: snapshot.bounds,
86
- styles: snapshot.styles,
87
- screenKey: key,
88
- };
89
- }
90
-
91
- return null;
92
- }
93
-
94
68
  function resolveTransitionPair(
95
69
  tag: TagID,
96
70
  context: ResolveTransitionContext,
@@ -153,61 +127,12 @@ function resolveTransitionPair(
153
127
  }
154
128
  }
155
129
 
156
- let sourceBounds = matchedLink?.source?.bounds ?? null;
157
- let destinationBounds = matchedLink?.destination?.bounds ?? null;
158
- let sourceStyles = matchedLink?.source?.styles ?? null;
159
- let destinationStyles = matchedLink?.destination?.styles ?? null;
160
- let sourceScreenKey = matchedLink?.source?.screenKey ?? null;
161
- let destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
162
- let usedSnapshotSource = false;
163
- let usedSnapshotDestination = false;
164
-
165
- const sourceFallbackKeys = context.entering
166
- ? [
167
- context.previousScreenKey,
168
- context.currentScreenKey,
169
- context.nextScreenKey,
170
- ]
171
- : [
172
- context.currentScreenKey,
173
- context.previousScreenKey,
174
- context.nextScreenKey,
175
- ];
176
-
177
- const destinationFallbackKeys = context.entering
178
- ? [context.currentScreenKey, context.nextScreenKey]
179
- : [context.nextScreenKey, context.currentScreenKey];
180
-
181
- if (!sourceBounds) {
182
- const sourceSnapshot = getSnapshotBoundsByPriority(tag, sourceFallbackKeys);
183
- if (sourceSnapshot) {
184
- sourceBounds = sourceSnapshot.bounds;
185
- sourceStyles = sourceSnapshot.styles;
186
- sourceScreenKey = sourceSnapshot.screenKey;
187
- usedSnapshotSource = true;
188
- }
189
- }
190
-
191
- if (!destinationBounds) {
192
- const destinationSnapshot = getSnapshotBoundsByPriority(
193
- tag,
194
- destinationFallbackKeys,
195
- );
196
- if (destinationSnapshot) {
197
- destinationBounds = destinationSnapshot.bounds;
198
- destinationStyles = destinationSnapshot.styles;
199
- destinationScreenKey = destinationSnapshot.screenKey;
200
- usedSnapshotDestination = true;
201
- }
202
- }
203
-
204
- if (!sourceBounds || !destinationBounds) {
205
- debugResolverLog(
206
- `unresolved tag=${tag} entering=${context.entering ? 1 : 0} source=${
207
- sourceBounds ? 1 : 0
208
- } destination=${destinationBounds ? 1 : 0} pending=${usedPending ? 1 : 0}`,
209
- );
210
- }
130
+ const sourceBounds = matchedLink?.source?.bounds ?? null;
131
+ const destinationBounds = matchedLink?.destination?.bounds ?? null;
132
+ const sourceStyles = matchedLink?.source?.styles ?? null;
133
+ const destinationStyles = matchedLink?.destination?.styles ?? null;
134
+ const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
135
+ const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
211
136
 
212
137
  return {
213
138
  sourceBounds,
@@ -217,8 +142,6 @@ function resolveTransitionPair(
217
142
  sourceScreenKey,
218
143
  destinationScreenKey,
219
144
  usedPending,
220
- usedSnapshotSource,
221
- usedSnapshotDestination,
222
145
  };
223
146
  }
224
147