react-native-screen-transitions 3.11.0 → 3.11.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 (157) hide show
  1. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +27 -15
  2. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  3. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
  4. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
  5. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
  6. package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  7. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +5 -4
  8. package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  9. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -1
  10. package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
  11. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
  12. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  13. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
  14. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  15. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
  16. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  17. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +1 -1
  18. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  19. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  20. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  21. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js +8 -4
  22. package/lib/commonjs/shared/components/boundary/utils/destination-signals.js.map +1 -1
  23. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +2 -4
  24. package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -1
  25. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js +3 -7
  26. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  27. package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
  28. package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  29. package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -20
  30. package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  31. package/lib/commonjs/shared/providers/screen/styles/helpers/create-interpolator-scope.js +40 -0
  32. package/lib/commonjs/shared/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
  33. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
  34. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
  35. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +22 -27
  36. package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  37. package/lib/commonjs/shared/stores/bounds/internals/entries.js +27 -0
  38. package/lib/commonjs/shared/stores/bounds/internals/entries.js.map +1 -1
  39. package/lib/commonjs/shared/stores/bounds/internals/links.js +25 -0
  40. package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
  41. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +2 -12
  42. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  43. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js +2 -2
  44. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  45. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +30 -18
  46. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  47. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
  48. package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
  49. package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
  50. package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  51. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +5 -4
  52. package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  53. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -1
  54. package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
  55. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
  56. package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  57. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
  58. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  59. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
  60. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  61. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +2 -2
  62. package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  63. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  64. package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  65. package/lib/module/shared/components/boundary/utils/destination-signals.js +8 -4
  66. package/lib/module/shared/components/boundary/utils/destination-signals.js.map +1 -1
  67. package/lib/module/shared/components/boundary/utils/refresh-signals.js +2 -4
  68. package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -1
  69. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js +4 -8
  70. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  71. package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
  72. package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
  73. package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -19
  74. package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
  75. package/lib/module/shared/providers/screen/styles/helpers/create-interpolator-scope.js +35 -0
  76. package/lib/module/shared/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
  77. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
  78. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
  79. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +22 -27
  80. package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  81. package/lib/module/shared/stores/bounds/internals/entries.js +27 -1
  82. package/lib/module/shared/stores/bounds/internals/entries.js.map +1 -1
  83. package/lib/module/shared/stores/bounds/internals/links.js +25 -2
  84. package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
  85. package/lib/module/shared/stores/bounds/internals/resolver.js +3 -13
  86. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  87. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js +3 -3
  88. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  89. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
  90. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.d.ts.map +1 -1
  91. package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
  92. package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
  93. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
  94. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +1 -5
  95. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -1
  96. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  97. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -1
  98. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +0 -2
  99. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
  100. package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts +2 -3
  101. package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts.map +1 -1
  102. package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts +0 -2
  103. package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -1
  104. package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
  105. package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts +1 -3
  106. package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts.map +1 -1
  107. package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts +0 -8
  108. package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts.map +1 -1
  109. package/lib/typescript/shared/providers/screen/styles/helpers/create-interpolator-scope.d.ts +9 -0
  110. package/lib/typescript/shared/providers/screen/styles/helpers/create-interpolator-scope.d.ts.map +1 -0
  111. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts +1 -3
  112. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts.map +1 -1
  113. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +4 -4
  114. package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  115. package/lib/typescript/shared/stores/bounds/internals/entries.d.ts +2 -1
  116. package/lib/typescript/shared/stores/bounds/internals/entries.d.ts.map +1 -1
  117. package/lib/typescript/shared/stores/bounds/internals/links.d.ts +3 -1
  118. package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
  119. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  120. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/src/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +67 -24
  123. package/src/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.ts +6 -1
  124. package/src/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +8 -9
  125. package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +5 -4
  126. package/src/shared/components/boundary/portal/components/boundary-content-portal/components/host.tsx +1 -1
  127. package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +4 -20
  128. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +27 -37
  129. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +10 -57
  130. package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +1 -8
  131. package/src/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +0 -3
  132. package/src/shared/components/boundary/utils/destination-signals.ts +8 -8
  133. package/src/shared/components/boundary/utils/refresh-signals.ts +2 -10
  134. package/src/shared/providers/screen/descriptors/descriptors.provider.tsx +4 -11
  135. package/src/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.ts +0 -4
  136. package/src/shared/providers/screen/descriptors/helpers/get-ancestor-keys.ts +3 -30
  137. package/src/shared/providers/screen/styles/helpers/create-interpolator-scope.ts +45 -0
  138. package/src/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.ts +16 -16
  139. package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +28 -35
  140. package/src/shared/stores/bounds/internals/entries.ts +38 -1
  141. package/src/shared/stores/bounds/internals/links.ts +36 -0
  142. package/src/shared/stores/bounds/internals/resolver.ts +7 -21
  143. package/src/shared/utils/bounds/helpers/create-link-accessor.ts +9 -3
  144. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -18
  145. package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
  146. package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -21
  147. package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
  148. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -13
  149. package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
  150. package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -16
  151. package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
  152. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts +0 -3
  153. package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts.map +0 -1
  154. package/lib/typescript/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts +0 -2
  155. package/lib/typescript/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts.map +0 -1
  156. package/src/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts +0 -16
  157. package/src/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx +0 -15
@@ -18,7 +18,6 @@ import type {
18
18
  } from "../../../../types/animation.types";
19
19
  import { logger } from "../../../../utils/logger";
20
20
  import { useScreenAnimationStore } from "../../animation";
21
- import { useBuildBoundsAccessor } from "../../animation/helpers/accessors/use-build-bounds-accessor";
22
21
  import { useBuildTransitionAccessor } from "../../animation/helpers/accessors/use-build-transition-accessor";
23
22
  import type { ScreenInterpolatorFrame } from "../../animation/helpers/pipeline";
24
23
  import { readScreenAnimationRevisions } from "../../animation/helpers/read-screen-animation-revisions";
@@ -29,6 +28,7 @@ import {
29
28
  useScreenOptionsStore,
30
29
  } from "../../options";
31
30
  import { collectInterpolatorSharedValues } from "../helpers/collect-interpolator-shared-values";
31
+ import { createInterpolatorScope } from "../helpers/create-interpolator-scope";
32
32
  import { normalizeSlots } from "../helpers/normalize-slots";
33
33
  import { resolveInterpolatorStyleHandoff } from "../helpers/resolve-interpolator-style-handoff";
34
34
  import type { LocalStyleLayers } from "../helpers/resolve-slot-styles";
@@ -54,7 +54,6 @@ type RunInterpolatorParams = {
54
54
  interpolator: ScreenStyleInterpolator | undefined;
55
55
  props: ScreenInterpolatorFrame;
56
56
  selectedFrame: SelectedInterpolatorFrame;
57
- bounds: Parameters<ScreenStyleInterpolator>[0]["bounds"];
58
57
  transition: Parameters<ScreenStyleInterpolator>[0]["transition"];
59
58
  };
60
59
 
@@ -76,7 +75,6 @@ const runInterpolator = ({
76
75
  interpolator,
77
76
  props,
78
77
  selectedFrame,
79
- bounds,
80
78
  transition,
81
79
  }: RunInterpolatorParams): InterpolatorResult | undefined => {
82
80
  "worklet";
@@ -86,12 +84,13 @@ const runInterpolator = ({
86
84
  }
87
85
 
88
86
  try {
89
- const raw = interpolator({
90
- ...props,
91
- ...selectedFrame,
92
- bounds,
93
- transition,
94
- });
87
+ const raw = interpolator(
88
+ createInterpolatorScope({
89
+ frame: props,
90
+ selectedFrame,
91
+ transition,
92
+ }),
93
+ );
95
94
 
96
95
  const rawStyleMap: TransitionInterpolatedStyle | undefined =
97
96
  typeof raw === "object" && raw != null ? raw : undefined;
@@ -125,10 +124,10 @@ const runInterpolator = ({
125
124
  * normal interpolator selection once the gesture-driven close is no longer in
126
125
  * play.
127
126
  *
128
- * At an ownership handoff, the last current-owner styles are frozen. The next
129
- * owner replaces matching scalar keys and composes its live transforms after
130
- * the frozen transforms. The previous interpolator is not evaluated again until
131
- * it regains ownership.
127
+ * At an ownership handoff, the current interpolator remains live but is
128
+ * evaluated without the next-screen relationship. The next owner replaces
129
+ * matching scalar keys and composes its live transforms after the current
130
+ * screen's self-owned transforms.
132
131
  */
133
132
  export const useInterpolatedStylesMap = ({
134
133
  enabled,
@@ -154,7 +153,6 @@ export const useInterpolatedStylesMap = ({
154
153
  ancestorScreenAnimationSources,
155
154
  descendantScreenAnimationSources,
156
155
  } = useScreenAnimationStore();
157
- const boundsAccessor = useBuildBoundsAccessor();
158
156
  const transition = useBuildTransitionAccessor();
159
157
  const nextInterpolatorReady = useSharedValue(0);
160
158
 
@@ -177,8 +175,6 @@ export const useInterpolatedStylesMap = ({
177
175
 
178
176
  const isGesturingDuringCloseAnimation = useSharedValue(false);
179
177
  const initialDestinationStylesReady = useSharedValue(0);
180
- const frozenCurrentStylesMap =
181
- useSharedValue<NormalizedTransitionInterpolatedStyle>(NO_STYLES);
182
178
  const shouldPrepareInitialDestinationStyles =
183
179
  enabled && !!destinationPairKey && !nextScreenKey && !!currentInterpolator;
184
180
 
@@ -261,17 +257,20 @@ export const useInterpolatedStylesMap = ({
261
257
  ? "current"
262
258
  : "next";
263
259
 
264
- const selectedFrame = selectInterpolatorFrame(props, isInGestureMode);
265
-
266
- const currentResult = currentOwnsInterpolator
267
- ? runInterpolator({
268
- interpolator: currentInterpolator,
269
- props,
270
- selectedFrame,
271
- bounds: boundsAccessor,
272
- transition,
273
- })
274
- : undefined;
260
+ // Once the next interpolator owns the relationship, the current
261
+ // interpolator remains responsible only for its own live presentation.
262
+ // This preserves snap-point transforms without letting current-screen
263
+ // unfocus rules compete with the next screen's outgoing transition.
264
+ const currentSelectedFrame = selectInterpolatorFrame(
265
+ props,
266
+ isInGestureMode || !!nextInterpolator,
267
+ );
268
+ const currentResult = runInterpolator({
269
+ interpolator: currentInterpolator,
270
+ props,
271
+ selectedFrame: currentSelectedFrame,
272
+ transition,
273
+ });
275
274
 
276
275
  const initialDestinationStyleGate = resolveInitialDestinationStyleGate({
277
276
  shouldPrepareStyles: shouldPrepareInitialDestinationStyles,
@@ -295,23 +294,18 @@ export const useInterpolatedStylesMap = ({
295
294
  currentOwnsInterpolator: true,
296
295
  currentStylesMap: currentResult?.stylesMap,
297
296
  nextStylesMap: undefined,
298
- frozenCurrentStylesMap: frozenCurrentStylesMap.get(),
299
297
  });
300
298
 
301
- if (handoff.nextFrozenCurrentStylesMap !== frozenCurrentStylesMap.get()) {
302
- frozenCurrentStylesMap.set(handoff.nextFrozenCurrentStylesMap);
303
- }
304
-
305
299
  return handoff.localStylesMaps.length
306
300
  ? handoff.localStylesMaps
307
301
  : NO_STYLE_LAYERS;
308
302
  }
309
303
 
304
+ const nextSelectedFrame = selectInterpolatorFrame(props, false);
310
305
  const nextResult = runInterpolator({
311
306
  interpolator: nextInterpolator,
312
307
  props,
313
- selectedFrame,
314
- bounds: boundsAccessor,
308
+ selectedFrame: nextSelectedFrame,
315
309
  transition,
316
310
  });
317
311
 
@@ -326,7 +320,6 @@ export const useInterpolatedStylesMap = ({
326
320
  currentOwnsInterpolator: false,
327
321
  currentStylesMap: currentResult?.stylesMap,
328
322
  nextStylesMap: nextResult?.stylesMap,
329
- frozenCurrentStylesMap: frozenCurrentStylesMap.get(),
330
323
  });
331
324
 
332
325
  return handoff.localStylesMaps.length
@@ -62,6 +62,43 @@ function getEntry(tag: TagID, key: ScreenKey): Entry | null {
62
62
  return boundaryRegistry.get()[tag]?.screens[key] ?? null;
63
63
  }
64
64
 
65
+ function getMatchingSourceScreenKey(
66
+ tag: TagID,
67
+ destinationScreenKey: ScreenKey,
68
+ preferredScreenKey?: ScreenKey,
69
+ excludedScreenKeys?: readonly ScreenKey[],
70
+ ): ScreenKey | null {
71
+ "worklet";
72
+ const screens = boundaryRegistry.get()[tag]?.screens;
73
+ if (!screens) return null;
74
+ const isExcluded = (screenKey: ScreenKey) => {
75
+ "worklet";
76
+ for (let index = 0; index < (excludedScreenKeys?.length ?? 0); index++) {
77
+ if (excludedScreenKeys?.[index] === screenKey) {
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ };
83
+ if (
84
+ preferredScreenKey &&
85
+ preferredScreenKey !== destinationScreenKey &&
86
+ !isExcluded(preferredScreenKey) &&
87
+ screens[preferredScreenKey]
88
+ ) {
89
+ return preferredScreenKey;
90
+ }
91
+
92
+ let latestScreenKey: ScreenKey | null = null;
93
+ for (const screenKey in screens) {
94
+ if (screenKey !== destinationScreenKey && !isExcluded(screenKey)) {
95
+ latestScreenKey = screenKey;
96
+ }
97
+ }
98
+
99
+ return latestScreenKey;
100
+ }
101
+
65
102
  function setEntry(tag: TagID, screenKey: ScreenKey, patch: EntryPatch) {
66
103
  "worklet";
67
104
  boundaryRegistry.modify(<T extends BoundaryEntriesState>(state: T): T => {
@@ -90,4 +127,4 @@ function removeEntry(tag: TagID, screenKey: ScreenKey) {
90
127
  });
91
128
  }
92
129
 
93
- export { getEntry, removeEntry, setEntry };
130
+ export { getEntry, getMatchingSourceScreenKey, removeEntry, setEntry };
@@ -4,12 +4,14 @@ import {
4
4
  ensurePairGroups,
5
5
  ensurePairLinks,
6
6
  ensurePairSourceRequests,
7
+ getDestinationScreenKeyFromPairKey,
7
8
  getGroupKeyFromTag,
8
9
  getLinkKeyFromTag,
9
10
  getActiveGroupId as getPairActiveGroupId,
10
11
  getDestination as getPairDestination,
11
12
  getLink as getPairLink,
12
13
  getSource as getPairSource,
14
+ getSourceScreenKeyFromPairKey,
13
15
  } from "../helpers/link-pairs.helpers";
14
16
  import type {
15
17
  BoundaryRuntimeFlags,
@@ -402,6 +404,38 @@ function getResolvedLink(
402
404
  };
403
405
  }
404
406
 
407
+ function getPairKeyForSource(
408
+ tag: TagID,
409
+ screenKey: ScreenKey,
410
+ ): ScreenPairKey | null {
411
+ "worklet";
412
+ const state = pairs.get();
413
+ const linkKey = getLinkKeyFromTag(tag);
414
+ for (const pairKey in state) {
415
+ if (getSourceScreenKeyFromPairKey(pairKey) !== screenKey) continue;
416
+ if (
417
+ getResolvedLink(pairKey, tag).link?.destination ||
418
+ state[pairKey]?.sourceRequests?.[linkKey]
419
+ ) {
420
+ return pairKey;
421
+ }
422
+ }
423
+ return null;
424
+ }
425
+
426
+ function getPairKeyForDestination(
427
+ tag: TagID,
428
+ screenKey: ScreenKey,
429
+ ): ScreenPairKey | null {
430
+ "worklet";
431
+ const state = pairs.get();
432
+ for (const pairKey in state) {
433
+ if (getDestinationScreenKeyFromPairKey(pairKey) !== screenKey) continue;
434
+ if (getResolvedLink(pairKey, tag).link) return pairKey;
435
+ }
436
+ return null;
437
+ }
438
+
405
439
  function getSource(
406
440
  pairKey: ScreenPairKey,
407
441
  tag: TagID,
@@ -422,6 +456,8 @@ export {
422
456
  getActiveGroupId,
423
457
  getDestination,
424
458
  getLink,
459
+ getPairKeyForDestination,
460
+ getPairKeyForSource,
425
461
  getResolvedLink,
426
462
  getSource,
427
463
  requestSourceMeasure,
@@ -1,35 +1,21 @@
1
- import { createScreenPairKey } from "../helpers/link-pairs.helpers";
2
1
  import type {
3
2
  ResolvedTransitionPair,
4
3
  ResolveTransitionContext,
5
- ScreenPairKey,
6
4
  TagID,
7
5
  } from "../types";
8
- import { getResolvedLink } from "./links";
9
-
10
- function resolvePairKey(
11
- context: ResolveTransitionContext,
12
- ): ScreenPairKey | null {
13
- "worklet";
14
-
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);
25
- }
6
+ import { getPairKeyForDestination, getResolvedLink } from "./links";
26
7
 
27
8
  function resolveTransitionPair(
28
9
  tag: TagID,
29
10
  context: ResolveTransitionContext,
30
11
  ): ResolvedTransitionPair {
31
12
  "worklet";
32
- const pairKey = resolvePairKey(context);
13
+ const destinationScreenKey = context.entering
14
+ ? context.currentScreenKey
15
+ : context.nextScreenKey;
16
+ const pairKey = destinationScreenKey
17
+ ? getPairKeyForDestination(tag, destinationScreenKey)
18
+ : null;
33
19
  const matchedLink = pairKey ? getResolvedLink(pairKey, tag).link : null;
34
20
 
35
21
  return {
@@ -1,10 +1,12 @@
1
- import { getResolvedLink } from "../../../stores/bounds/internals/links";
1
+ import {
2
+ getPairKeyForDestination,
3
+ getResolvedLink,
4
+ } from "../../../stores/bounds/internals/links";
2
5
  import type {
3
6
  BoundsInterpolationProps,
4
7
  BoundsLink,
5
8
  } from "../../../types/bounds.types";
6
9
  import type { BoundId } from "../types/options";
7
- import { resolveBoundsPairKey } from "./resolve-bounds-pair-key";
8
10
 
9
11
  type GetProps = () => BoundsInterpolationProps;
10
12
 
@@ -19,7 +21,11 @@ export const createLinkAccessor = (getProps: GetProps): LinkAccessor => {
19
21
  "worklet";
20
22
  const props = getProps();
21
23
  const stringTag = String(tag);
22
- const pairKey = resolveBoundsPairKey(props);
24
+ const destinationScreenKey =
25
+ props.next?.route.key ?? props.current?.route.key;
26
+ const pairKey = destinationScreenKey
27
+ ? getPairKeyForDestination(stringTag, destinationScreenKey)
28
+ : null;
23
29
  if (!pairKey) return null;
24
30
 
25
31
  const resolved = getResolvedLink(pairKey, stringTag);
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasLocalSlot = void 0;
7
- const hasLocalSlot = (localStylesMaps, slotId) => {
8
- "worklet";
9
-
10
- for (let index = 0; index < localStylesMaps.length; index++) {
11
- if (localStylesMaps[index]?.[slotId] !== undefined) {
12
- return true;
13
- }
14
- }
15
- return false;
16
- };
17
- exports.hasLocalSlot = hasLocalSlot;
18
- //# sourceMappingURL=has-local-slot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["hasLocalSlot","localStylesMaps","slotId","index","length","undefined","exports"],"sourceRoot":"../../../../../../../../../src","sources":["shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGA,CAC3BC,eAAiC,EACjCC,MAAc,KACV;EACJ,SAAS;;EAET,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,eAAe,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;IAC5D,IAAIF,eAAe,CAACE,KAAK,CAAC,GAAGD,MAAM,CAAC,KAAKG,SAAS,EAAE;MACnD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb,CAAC;AAACC,OAAA,CAAAN,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useBuildBoundsAccessor = void 0;
7
- var _react = require("react");
8
- var _bounds = require("../../../../../utils/bounds");
9
- var _animation = require("../../animation.provider");
10
- const useBuildBoundsAccessor = () => {
11
- const screenInterpolatorProps = (0, _animation.useScreenAnimationStore)(store => store.screenInterpolatorProps);
12
- return (0, _react.useMemo)(() => {
13
- return (0, _bounds.createBoundsAccessor)(() => {
14
- "worklet";
15
-
16
- return screenInterpolatorProps.get();
17
- });
18
- }, [screenInterpolatorProps]);
19
- };
20
- exports.useBuildBoundsAccessor = useBuildBoundsAccessor;
21
- //# sourceMappingURL=use-build-bounds-accessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_bounds","_animation","useBuildBoundsAccessor","screenInterpolatorProps","useScreenAnimationStore","store","useMemo","createBoundsAccessor","get","exports"],"sourceRoot":"../../../../../../../../src","sources":["shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,MAAMG,sBAAsB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,uBAAuB,GAAG,IAAAC,kCAAuB,EACrDC,KAAK,IAAKA,KAAK,CAACF,uBAClB,CAAC;EACD,OAAO,IAAAG,cAAO,EAAC,MAAM;IACpB,OAAO,IAAAC,4BAAoB,EAAC,MAAM;MACjC,SAAS;;MACT,OAAOJ,uBAAuB,CAACK,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC;EACH,CAAC,EAAE,CAACL,uBAAuB,CAAC,CAAC;AAC9B,CAAC;AAACM,OAAA,CAAAP,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- export const hasLocalSlot = (localStylesMaps, slotId) => {
4
- "worklet";
5
-
6
- for (let index = 0; index < localStylesMaps.length; index++) {
7
- if (localStylesMaps[index]?.[slotId] !== undefined) {
8
- return true;
9
- }
10
- }
11
- return false;
12
- };
13
- //# sourceMappingURL=has-local-slot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["hasLocalSlot","localStylesMaps","slotId","index","length","undefined"],"sourceRoot":"../../../../../../../../../src","sources":["shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"mappings":";;AAEA,OAAO,MAAMA,YAAY,GAAGA,CAC3BC,eAAiC,EACjCC,MAAc,KACV;EACJ,SAAS;;EAET,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,eAAe,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;IAC5D,IAAIF,eAAe,CAACE,KAAK,CAAC,GAAGD,MAAM,CAAC,KAAKG,SAAS,EAAE;MACnD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb,CAAC","ignoreList":[]}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- import { useMemo } from "react";
4
- import { createBoundsAccessor } from "../../../../../utils/bounds";
5
- import { useScreenAnimationStore } from "../../animation.provider";
6
- export const useBuildBoundsAccessor = () => {
7
- const screenInterpolatorProps = useScreenAnimationStore(store => store.screenInterpolatorProps);
8
- return useMemo(() => {
9
- return createBoundsAccessor(() => {
10
- "worklet";
11
-
12
- return screenInterpolatorProps.get();
13
- });
14
- }, [screenInterpolatorProps]);
15
- };
16
- //# sourceMappingURL=use-build-bounds-accessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useMemo","createBoundsAccessor","useScreenAnimationStore","useBuildBoundsAccessor","screenInterpolatorProps","store","get"],"sourceRoot":"../../../../../../../../src","sources":["shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,uBAAuB,QAAQ,0BAA0B;AAElE,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,uBAAuB,GAAGF,uBAAuB,CACrDG,KAAK,IAAKA,KAAK,CAACD,uBAClB,CAAC;EACD,OAAOJ,OAAO,CAAC,MAAM;IACpB,OAAOC,oBAAoB,CAAC,MAAM;MACjC,SAAS;;MACT,OAAOG,uBAAuB,CAACE,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC;EACH,CAAC,EAAE,CAACF,uBAAuB,CAAC,CAAC;AAC9B,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { LocalStyleLayers } from "../../../../../../providers/screen/styles/helpers/resolve-slot-styles";
2
- export declare const hasLocalSlot: (localStylesMaps: LocalStyleLayers, slotId: string) => boolean;
3
- //# sourceMappingURL=has-local-slot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has-local-slot.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uEAAuE,CAAC;AAE9G,eAAO,MAAM,YAAY,GACxB,iBAAiB,gBAAgB,EACjC,QAAQ,MAAM,YAWd,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const useBuildBoundsAccessor: () => import("../../../../../types").BoundsAccessor;
2
- //# sourceMappingURL=use-build-bounds-accessor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-build-bounds-accessor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,qDAUlC,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { LocalStyleLayers } from "../../../../../../providers/screen/styles/helpers/resolve-slot-styles";
2
-
3
- export const hasLocalSlot = (
4
- localStylesMaps: LocalStyleLayers,
5
- slotId: string,
6
- ) => {
7
- "worklet";
8
-
9
- for (let index = 0; index < localStylesMaps.length; index++) {
10
- if (localStylesMaps[index]?.[slotId] !== undefined) {
11
- return true;
12
- }
13
- }
14
-
15
- return false;
16
- };
@@ -1,15 +0,0 @@
1
- import { useMemo } from "react";
2
- import { createBoundsAccessor } from "../../../../../utils/bounds";
3
- import { useScreenAnimationStore } from "../../animation.provider";
4
-
5
- export const useBuildBoundsAccessor = () => {
6
- const screenInterpolatorProps = useScreenAnimationStore(
7
- (store) => store.screenInterpolatorProps,
8
- );
9
- return useMemo(() => {
10
- return createBoundsAccessor(() => {
11
- "worklet";
12
- return screenInterpolatorProps.get();
13
- });
14
- }, [screenInterpolatorProps]);
15
- };