react-native-screen-transitions 3.6.0-alpha.3 → 3.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/shared/components/screen-container/layers/content.js +1 -11
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/constants.js +2 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +10 -3
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +7 -2
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js +25 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js +13 -4
- package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/options/helpers.js +9 -4
- package/lib/commonjs/shared/providers/screen/options/helpers.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +94 -13
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +4 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/types.js +4 -0
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +85 -28
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +5 -4
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +2 -2
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -3
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js +2 -12
- package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/managed.provider.js +1 -3
- package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +5 -3
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/links.js +18 -3
- package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +0 -2
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +5 -2
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +3 -13
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/constants.js +1 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +10 -3
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +7 -2
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js +20 -0
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/shared/policy.js +14 -5
- package/lib/module/shared/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/module/shared/providers/screen/options/helpers.js +10 -5
- package/lib/module/shared/providers/screen/options/helpers.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +95 -14
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +4 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/types.js +2 -0
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +84 -28
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +5 -4
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/styles.provider.js +2 -2
- package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +1 -3
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-stack-derived.js +2 -12
- package/lib/module/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
- package/lib/module/shared/providers/stack/managed.provider.js +1 -3
- package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +5 -3
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/links.js +18 -3
- package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/module/shared/types/animation.types.js +2 -1
- package/lib/module/shared/types/animation.types.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js +0 -2
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js +5 -2
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +2 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +0 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +12 -12
- package/lib/typescript/shared/providers/screen/animation/helpers/build-screen-transition-options.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts +2 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/selected-interpolator-options.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts +3 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts +4 -4
- package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/options/helpers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/options/types.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/options/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts +4 -4
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/types.d.ts +2 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +6 -6
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts +3 -2
- package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts +5 -5
- package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +4 -3
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +4 -3
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +9 -12
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/screen-container/layers/content.tsx +2 -21
- package/src/shared/constants.ts +6 -1
- package/src/shared/hooks/navigation/use-stack.tsx +0 -1
- package/src/shared/providers/screen/animation/helpers/build-screen-transition-options.ts +1 -2
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +16 -8
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.ts +2 -1
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts +1 -0
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +19 -5
- package/src/shared/providers/screen/animation/helpers/selected-interpolator-options.ts +0 -3
- package/src/shared/providers/screen/animation/helpers/stack-progress.ts +29 -0
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +2 -0
- package/src/shared/providers/screen/gestures/shared/policy.ts +20 -7
- package/src/shared/providers/screen/options/helpers.ts +17 -13
- package/src/shared/providers/screen/options/types.ts +1 -1
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +140 -19
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.ts +5 -1
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/types.ts +4 -0
- package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +132 -44
- package/src/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.tsx +7 -5
- package/src/shared/providers/screen/styles/styles.provider.tsx +2 -2
- package/src/shared/providers/stack/direct.provider.tsx +2 -12
- package/src/shared/providers/stack/helpers/use-stack-derived.ts +6 -15
- package/src/shared/providers/stack/managed.provider.tsx +1 -5
- package/src/shared/stores/animation.store.ts +6 -3
- package/src/shared/stores/bounds/internals/links.ts +27 -3
- package/src/shared/types/animation.types.ts +7 -3
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/screen.types.ts +9 -12
- package/src/shared/utils/bounds/navigation/reveal/build.ts +0 -2
- package/src/shared/utils/bounds/navigation/zoom/build.ts +6 -2
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
LOGICAL_SETTLE_PROGRESS_THRESHOLD,
|
|
4
4
|
LOGICAL_SETTLE_REQUIRED_FRAMES,
|
|
5
5
|
} from "../../../../../constants";
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
ScreenTransitionOptions,
|
|
8
|
+
TransitionInterpolatorOptions,
|
|
9
|
+
} from "../../../../../types/animation.types";
|
|
7
10
|
import type { Layout } from "../../../../../types/screen.types";
|
|
8
11
|
import { resolveGestureDrivenProgress } from "./gesture-progress";
|
|
9
12
|
import {
|
|
@@ -23,7 +26,7 @@ const LOGICAL_SETTLE_STICKY_PROGRESS_THRESHOLD =
|
|
|
23
26
|
|
|
24
27
|
const mergeTransitionOptions = (
|
|
25
28
|
base: ScreenTransitionOptions,
|
|
26
|
-
effective:
|
|
29
|
+
effective: TransitionInterpolatorOptions | undefined,
|
|
27
30
|
slot: ScreenTransitionOptions,
|
|
28
31
|
): ScreenTransitionOptions => {
|
|
29
32
|
"worklet";
|
|
@@ -31,12 +34,9 @@ const mergeTransitionOptions = (
|
|
|
31
34
|
return base;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
slot.navigationMaskEnabled =
|
|
35
|
-
effective.navigationMaskEnabled ?? base.navigationMaskEnabled;
|
|
37
|
+
slot.navigationMaskEnabled = base.navigationMaskEnabled;
|
|
36
38
|
slot.gestureEnabled = effective.gestureEnabled ?? base.gestureEnabled;
|
|
37
|
-
slot.
|
|
38
|
-
effective.experimental_allowDisabledGestureTracking ??
|
|
39
|
-
base.experimental_allowDisabledGestureTracking;
|
|
39
|
+
slot.gestureTracking = base.gestureTracking;
|
|
40
40
|
slot.gestureDirection = effective.gestureDirection ?? base.gestureDirection;
|
|
41
41
|
slot.gestureSensitivity =
|
|
42
42
|
effective.gestureSensitivity ?? base.gestureSensitivity;
|
|
@@ -66,7 +66,7 @@ const mergeTransitionOptions = (
|
|
|
66
66
|
export const hydrateTransitionState = (
|
|
67
67
|
s: BuiltState,
|
|
68
68
|
dimensions: Layout,
|
|
69
|
-
effectiveOptions?:
|
|
69
|
+
effectiveOptions?: TransitionInterpolatorOptions,
|
|
70
70
|
) => {
|
|
71
71
|
"worklet";
|
|
72
72
|
const out = s.unwrapped;
|
|
@@ -76,6 +76,7 @@ export const hydrateTransitionState = (
|
|
|
76
76
|
effectiveOptions,
|
|
77
77
|
s.optionsSlot,
|
|
78
78
|
);
|
|
79
|
+
const canDismiss = options.gestureEnabled !== false;
|
|
79
80
|
out.willAnimate = s.willAnimate.get();
|
|
80
81
|
out.closing = s.closing.get();
|
|
81
82
|
out.entering = s.entering.get();
|
|
@@ -107,9 +108,16 @@ export const hydrateTransitionState = (
|
|
|
107
108
|
getResolvedSnapBounds(
|
|
108
109
|
s.sortedNumericSnapPoints,
|
|
109
110
|
s.hasAutoSnapPoint ? s.resolvedAutoSnapPoint.get() : null,
|
|
111
|
+
canDismiss,
|
|
110
112
|
),
|
|
111
113
|
);
|
|
112
114
|
|
|
115
|
+
// Unsure where else to place this if im being honest.
|
|
116
|
+
// I think for here is fine
|
|
117
|
+
if (s.effectiveProgress.get() !== out.progress) {
|
|
118
|
+
s.effectiveProgress.set(out.progress);
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
const hasResidualGestureValues =
|
|
114
122
|
Math.abs(out.gesture.normX) > EPSILON ||
|
|
115
123
|
Math.abs(out.gesture.normY) > EPSILON ||
|
package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.ts
CHANGED
|
@@ -48,6 +48,7 @@ const getResolvedSnapPointAt = (
|
|
|
48
48
|
export const getResolvedSnapBounds = (
|
|
49
49
|
snapPoints: number[],
|
|
50
50
|
resolvedAutoSnap: number | null,
|
|
51
|
+
canDismiss = true,
|
|
51
52
|
): SnapBounds | null => {
|
|
52
53
|
"worklet";
|
|
53
54
|
const snapPointCount = getResolvedSnapPointCount(
|
|
@@ -77,7 +78,7 @@ export const getResolvedSnapBounds = (
|
|
|
77
78
|
);
|
|
78
79
|
|
|
79
80
|
return {
|
|
80
|
-
min: Math.min(0, firstSnapPoint),
|
|
81
|
+
min: canDismiss ? Math.min(0, firstSnapPoint) : firstSnapPoint,
|
|
81
82
|
max: lastSnapPoint,
|
|
82
83
|
};
|
|
83
84
|
};
|
|
@@ -9,6 +9,7 @@ import type { BaseStackRoute } from "../../../../../types/stack.types";
|
|
|
9
9
|
|
|
10
10
|
export type BuiltState = {
|
|
11
11
|
progress: SharedValue<number>;
|
|
12
|
+
effectiveProgress: SharedValue<number>;
|
|
12
13
|
willAnimate: SharedValue<number>;
|
|
13
14
|
closing: SharedValue<number>;
|
|
14
15
|
progressAnimating: SharedValue<number>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
1
2
|
import { useWindowDimensions } from "react-native";
|
|
2
3
|
import {
|
|
3
4
|
type DerivedValue,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
9
10
|
import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../../../constants";
|
|
10
11
|
import { useStack } from "../../../../hooks/navigation/use-stack";
|
|
12
|
+
import { AnimationStore } from "../../../../stores/animation.store";
|
|
11
13
|
import type {
|
|
12
14
|
ScreenInterpolationProps,
|
|
13
15
|
ScreenStyleInterpolator,
|
|
@@ -18,6 +20,7 @@ import { updateDerivations } from "./derivations";
|
|
|
18
20
|
import { hasTransitionsEnabled } from "./has-transitions-enabled";
|
|
19
21
|
import { hydrateTransitionState } from "./hydrate-transition-state";
|
|
20
22
|
import type { SelectedInterpolatorOptions } from "./selected-interpolator-options";
|
|
23
|
+
import { deriveStackProgress } from "./stack-progress";
|
|
21
24
|
import { useBuildTransitionState } from "./use-build-transition-state";
|
|
22
25
|
|
|
23
26
|
export type ScreenInterpolatorFrame = Omit<ScreenInterpolationProps, "bounds">;
|
|
@@ -55,7 +58,7 @@ const createInitialBaseInterpolatorProps = (
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
58
|
-
const { flags,
|
|
61
|
+
const { flags, routeKeys } = useStack();
|
|
59
62
|
const dimensions = useWindowDimensions();
|
|
60
63
|
const insets = useSafeAreaInsets();
|
|
61
64
|
const transitionsAlwaysOn = flags.TRANSITIONS_ALWAYS_ON;
|
|
@@ -72,6 +75,11 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
72
75
|
|
|
73
76
|
const currentRouteKey = currDescriptor?.route?.key;
|
|
74
77
|
const currentIndex = routeKeys.indexOf(currentRouteKey);
|
|
78
|
+
const effectiveProgressValues = useMemo(() => {
|
|
79
|
+
return routeKeys.map((routeKey) =>
|
|
80
|
+
AnimationStore.getValue(routeKey, "effectiveProgress"),
|
|
81
|
+
);
|
|
82
|
+
}, [routeKeys]);
|
|
75
83
|
|
|
76
84
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
77
85
|
const nextHasTransitions =
|
|
@@ -130,10 +138,16 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
130
138
|
|
|
131
139
|
updateDerivations(frame);
|
|
132
140
|
|
|
133
|
-
frame.stackProgress =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
frame.stackProgress = deriveStackProgress(
|
|
142
|
+
routeKeys,
|
|
143
|
+
effectiveProgressValues,
|
|
144
|
+
currentIndex,
|
|
145
|
+
frame.progress,
|
|
146
|
+
currentRouteKey,
|
|
147
|
+
frame.current.progress,
|
|
148
|
+
nextRouteKey,
|
|
149
|
+
frame.next?.progress,
|
|
150
|
+
);
|
|
137
151
|
frame.logicallySettled = frame.active.logicallySettled;
|
|
138
152
|
|
|
139
153
|
return frame;
|
|
@@ -59,10 +59,7 @@ const areInterpolatorOptionsEqual = (
|
|
|
59
59
|
if (!left || !right) return false;
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
left.navigationMaskEnabled === right.navigationMaskEnabled &&
|
|
63
62
|
left.gestureEnabled === right.gestureEnabled &&
|
|
64
|
-
left.experimental_allowDisabledGestureTracking ===
|
|
65
|
-
right.experimental_allowDisabledGestureTracking &&
|
|
66
63
|
areGestureDirectionsEqual(left.gestureDirection, right.gestureDirection) &&
|
|
67
64
|
left.gestureSensitivity === right.gestureSensitivity &&
|
|
68
65
|
left.gestureVelocityImpact === right.gestureVelocityImpact &&
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
|
|
3
|
+
export const deriveStackProgress = (
|
|
4
|
+
routeKeys: string[],
|
|
5
|
+
effectiveProgressValues: SharedValue<number>[],
|
|
6
|
+
currentIndex: number,
|
|
7
|
+
fallbackProgress: number,
|
|
8
|
+
currentRouteKey: string | undefined,
|
|
9
|
+
currentProgress: number,
|
|
10
|
+
nextRouteKey: string | undefined,
|
|
11
|
+
nextProgress: number | undefined,
|
|
12
|
+
) => {
|
|
13
|
+
"worklet";
|
|
14
|
+
if (currentIndex < 0) return fallbackProgress;
|
|
15
|
+
|
|
16
|
+
let total = 0;
|
|
17
|
+
for (let i = currentIndex; i < effectiveProgressValues.length; i++) {
|
|
18
|
+
const routeKey = routeKeys[i];
|
|
19
|
+
if (routeKey === currentRouteKey) {
|
|
20
|
+
total += currentProgress;
|
|
21
|
+
} else if (routeKey === nextRouteKey && nextProgress !== undefined) {
|
|
22
|
+
total += nextProgress;
|
|
23
|
+
} else {
|
|
24
|
+
total += effectiveProgressValues[i].get();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return total;
|
|
29
|
+
};
|
|
@@ -19,6 +19,7 @@ import { toPlainRoute, toPlainValue } from "./worklet";
|
|
|
19
19
|
|
|
20
20
|
type BuiltState = {
|
|
21
21
|
progress: SharedValue<number>;
|
|
22
|
+
effectiveProgress: SharedValue<number>;
|
|
22
23
|
willAnimate: SharedValue<number>;
|
|
23
24
|
closing: SharedValue<number>;
|
|
24
25
|
progressAnimating: SharedValue<number>;
|
|
@@ -62,6 +63,7 @@ export const useBuildTransitionState = (
|
|
|
62
63
|
|
|
63
64
|
return {
|
|
64
65
|
progress: AnimationStore.getValue(key, "progress"),
|
|
66
|
+
effectiveProgress: AnimationStore.getValue(key, "effectiveProgress"),
|
|
65
67
|
willAnimate: AnimationStore.getValue(key, "willAnimate"),
|
|
66
68
|
closing: AnimationStore.getValue(key, "closing"),
|
|
67
69
|
entering: AnimationStore.getValue(key, "entering"),
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_GESTURE_SENSITIVITY,
|
|
7
7
|
DEFAULT_GESTURE_SNAP_LOCKED,
|
|
8
8
|
DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT,
|
|
9
|
+
DEFAULT_GESTURE_TRACKING,
|
|
9
10
|
DEFAULT_GESTURE_VELOCITY_IMPACT,
|
|
10
11
|
DEFAULT_SHEET_SCROLL_GESTURE_BEHAVIOR,
|
|
11
12
|
} from "../../../../constants";
|
|
@@ -15,6 +16,7 @@ import type {
|
|
|
15
16
|
GestureProgressMode,
|
|
16
17
|
} from "../../../../types/gesture.types";
|
|
17
18
|
import type {
|
|
19
|
+
GestureTracking,
|
|
18
20
|
ScreenTransitionConfig,
|
|
19
21
|
SheetScrollGestureBehavior,
|
|
20
22
|
SnapPoint,
|
|
@@ -39,13 +41,13 @@ import {
|
|
|
39
41
|
import { validateSnapPoints } from "./snap-points";
|
|
40
42
|
|
|
41
43
|
export type GesturePolicyOptions = {
|
|
42
|
-
experimental_allowDisabledGestureTracking?: boolean;
|
|
43
44
|
expandViaScrollView?: boolean;
|
|
44
45
|
gestureActivationArea?: GestureActivationArea;
|
|
45
46
|
gestureDirection?: GestureDirection | GestureDirection[];
|
|
46
47
|
gestureDrivesProgress?: boolean;
|
|
47
48
|
gestureEnabled?: boolean;
|
|
48
49
|
gestureProgressMode?: GestureProgressMode;
|
|
50
|
+
gestureTracking?: GestureTracking;
|
|
49
51
|
gestureReleaseVelocityScale?: number;
|
|
50
52
|
gestureResponseDistance?: number;
|
|
51
53
|
gestureSensitivity?: number;
|
|
@@ -144,18 +146,26 @@ export const resolveGestureCanTrack = ({
|
|
|
144
146
|
isFirstKey,
|
|
145
147
|
canDismiss,
|
|
146
148
|
hasSnapPoints,
|
|
147
|
-
|
|
149
|
+
gestureTracking = DEFAULT_GESTURE_TRACKING,
|
|
148
150
|
}: {
|
|
149
151
|
isFirstKey: boolean;
|
|
150
152
|
canDismiss: boolean;
|
|
151
153
|
hasSnapPoints: boolean;
|
|
152
|
-
|
|
154
|
+
gestureTracking?: GestureTracking;
|
|
153
155
|
}) => {
|
|
154
156
|
"worklet";
|
|
155
157
|
if (isFirstKey) {
|
|
156
158
|
return false;
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
if (gestureTracking === "never") {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (gestureTracking === "always") {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
if (canDismiss) {
|
|
160
170
|
return true;
|
|
161
171
|
}
|
|
@@ -164,7 +174,7 @@ export const resolveGestureCanTrack = ({
|
|
|
164
174
|
return true;
|
|
165
175
|
}
|
|
166
176
|
|
|
167
|
-
return
|
|
177
|
+
return false;
|
|
168
178
|
};
|
|
169
179
|
|
|
170
180
|
export const resolvePanPolicy = (
|
|
@@ -234,8 +244,7 @@ const resolveGestureParticipation = ({
|
|
|
234
244
|
isFirstKey,
|
|
235
245
|
canDismiss,
|
|
236
246
|
hasSnapPoints: effectiveSnapPoints.hasSnapPoints,
|
|
237
|
-
|
|
238
|
-
options.experimental_allowDisabledGestureTracking,
|
|
247
|
+
gestureTracking: options.gestureTracking,
|
|
239
248
|
});
|
|
240
249
|
const claimedDirections = computeClaimedDirections(
|
|
241
250
|
canTrackGesture,
|
|
@@ -309,7 +318,11 @@ function resolveRuntimeCanTrackGesture(
|
|
|
309
318
|
return false;
|
|
310
319
|
}
|
|
311
320
|
|
|
312
|
-
if (options.
|
|
321
|
+
if (options.gestureTracking === "never") {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (options.gestureTracking === "always") {
|
|
313
326
|
return true;
|
|
314
327
|
}
|
|
315
328
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_GESTURE_SENSITIVITY,
|
|
7
7
|
DEFAULT_GESTURE_SNAP_LOCKED,
|
|
8
8
|
DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT,
|
|
9
|
+
DEFAULT_GESTURE_TRACKING,
|
|
9
10
|
DEFAULT_GESTURE_VELOCITY_IMPACT,
|
|
10
11
|
DEFAULT_SHEET_SCROLL_GESTURE_BEHAVIOR,
|
|
11
12
|
} from "../../../constants";
|
|
@@ -126,6 +127,16 @@ const resolveSheetScrollGestureBehaviorOption = (
|
|
|
126
127
|
: fallback;
|
|
127
128
|
};
|
|
128
129
|
|
|
130
|
+
const resolveGestureTrackingOption = (
|
|
131
|
+
value: unknown,
|
|
132
|
+
fallback: RequiredScreenOption<"gestureTracking">,
|
|
133
|
+
): RequiredScreenOption<"gestureTracking"> => {
|
|
134
|
+
"worklet";
|
|
135
|
+
return value === "auto" || value === "never" || value === "always"
|
|
136
|
+
? value
|
|
137
|
+
: fallback;
|
|
138
|
+
};
|
|
139
|
+
|
|
129
140
|
const resolveBackdropBehaviorOption = (
|
|
130
141
|
value: unknown,
|
|
131
142
|
fallback: BackdropBehavior | undefined,
|
|
@@ -208,8 +219,7 @@ const areScreenOptionsEqual = (
|
|
|
208
219
|
return (
|
|
209
220
|
left.navigationMaskEnabled === right.navigationMaskEnabled &&
|
|
210
221
|
left.gestureEnabled === right.gestureEnabled &&
|
|
211
|
-
left.
|
|
212
|
-
right.experimental_allowDisabledGestureTracking &&
|
|
222
|
+
left.gestureTracking === right.gestureTracking &&
|
|
213
223
|
areGestureDirectionsEqual(left.gestureDirection, right.gestureDirection) &&
|
|
214
224
|
left.gestureSensitivity === right.gestureSensitivity &&
|
|
215
225
|
left.gestureVelocityImpact === right.gestureVelocityImpact &&
|
|
@@ -244,9 +254,9 @@ export const resolveBaseScreenOptions = (
|
|
|
244
254
|
undefined,
|
|
245
255
|
),
|
|
246
256
|
gestureEnabled: resolveBooleanOption(options.gestureEnabled, undefined),
|
|
247
|
-
|
|
248
|
-
options.
|
|
249
|
-
|
|
257
|
+
gestureTracking: resolveGestureTrackingOption(
|
|
258
|
+
options.gestureTracking,
|
|
259
|
+
DEFAULT_GESTURE_TRACKING,
|
|
250
260
|
),
|
|
251
261
|
gestureDirection: resolveGestureDirectionOption(
|
|
252
262
|
options.gestureDirection,
|
|
@@ -327,18 +337,12 @@ export const syncScreenOptionsOverrides = (
|
|
|
327
337
|
);
|
|
328
338
|
|
|
329
339
|
const next: ScreenOptionsState = {
|
|
330
|
-
navigationMaskEnabled:
|
|
331
|
-
options?.navigationMaskEnabled,
|
|
332
|
-
base.navigationMaskEnabled,
|
|
333
|
-
),
|
|
340
|
+
navigationMaskEnabled: base.navigationMaskEnabled,
|
|
334
341
|
gestureEnabled: resolveBooleanOption(
|
|
335
342
|
options?.gestureEnabled,
|
|
336
343
|
base.gestureEnabled,
|
|
337
344
|
),
|
|
338
|
-
|
|
339
|
-
options?.experimental_allowDisabledGestureTracking,
|
|
340
|
-
base.experimental_allowDisabledGestureTracking,
|
|
341
|
-
),
|
|
345
|
+
gestureTracking: base.gestureTracking,
|
|
342
346
|
gestureDirection: resolveGestureDirectionOption(
|
|
343
347
|
options?.gestureDirection,
|
|
344
348
|
base.gestureDirection,
|
|
@@ -11,7 +11,7 @@ export type OptionalScreenOption<K extends keyof ScreenTransitionOptions> =
|
|
|
11
11
|
export type ScreenOptionsSnapshot = {
|
|
12
12
|
navigationMaskEnabled: OptionalScreenOption<"navigationMaskEnabled">;
|
|
13
13
|
gestureEnabled: OptionalScreenOption<"gestureEnabled">;
|
|
14
|
-
|
|
14
|
+
gestureTracking: RequiredScreenOption<"gestureTracking">;
|
|
15
15
|
gestureDirection: RequiredScreenOption<"gestureDirection">;
|
|
16
16
|
gestureSensitivity: RequiredScreenOption<"gestureSensitivity">;
|
|
17
17
|
gestureVelocityImpact: RequiredScreenOption<"gestureVelocityImpact">;
|
|
@@ -4,16 +4,17 @@ import type {
|
|
|
4
4
|
} from "../../../../../types/animation.types";
|
|
5
5
|
import { shouldSlotInherit } from "../../constants";
|
|
6
6
|
import { materializeResolvedSlot } from "./materialize-slot";
|
|
7
|
-
import { getResolvedSlotState
|
|
7
|
+
import { getResolvedSlotState } from "./slot-state";
|
|
8
8
|
import type {
|
|
9
|
+
LocalStyleLayers,
|
|
9
10
|
ResettableStyleState,
|
|
10
11
|
ResettableStyleStatesBySlot,
|
|
11
12
|
} from "./types";
|
|
12
13
|
|
|
13
|
-
export type { ResettableStyleStatesBySlot } from "./types";
|
|
14
|
+
export type { LocalStyleLayers, ResettableStyleStatesBySlot } from "./types";
|
|
14
15
|
|
|
15
16
|
type ResolveSlotStylesContext = {
|
|
16
|
-
|
|
17
|
+
localStylesMaps: LocalStyleLayers;
|
|
17
18
|
ancestorStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
18
19
|
previousStyleStatesBySlot: ResettableStyleStatesBySlot;
|
|
19
20
|
deferLocalSlotResets: boolean;
|
|
@@ -42,6 +43,35 @@ const hasEitherResetPatch = (
|
|
|
42
43
|
return hasStyleResetPatch || hasPropResetPatch;
|
|
43
44
|
};
|
|
44
45
|
|
|
46
|
+
const hasDefinedBucketValue = (value: unknown) => {
|
|
47
|
+
"worklet";
|
|
48
|
+
return value !== undefined && value !== null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const hasResettableDisappearedKeys = (
|
|
52
|
+
previousKeys: Record<string, true> | undefined,
|
|
53
|
+
previousResetValues: Record<string, unknown> | undefined,
|
|
54
|
+
currentKeys: Record<string, true> | undefined,
|
|
55
|
+
) => {
|
|
56
|
+
"worklet";
|
|
57
|
+
|
|
58
|
+
if (!previousKeys || !previousResetValues) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const key in previousKeys) {
|
|
63
|
+
if (currentKeys !== undefined && currentKeys[key] === true) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (previousResetValues[key] !== undefined) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
|
|
45
75
|
const getResolvedSlotOutput = ({
|
|
46
76
|
slot,
|
|
47
77
|
previousState,
|
|
@@ -58,10 +88,18 @@ const getResolvedSlotOutput = ({
|
|
|
58
88
|
|
|
59
89
|
const hasStyleResetPatch =
|
|
60
90
|
resetDroppedKeys &&
|
|
61
|
-
|
|
91
|
+
hasResettableDisappearedKeys(
|
|
92
|
+
previousState?.styleKeys,
|
|
93
|
+
previousState?.styleResetValues,
|
|
94
|
+
state.styleKeys,
|
|
95
|
+
);
|
|
62
96
|
const hasPropResetPatch =
|
|
63
97
|
resetDroppedKeys &&
|
|
64
|
-
|
|
98
|
+
hasResettableDisappearedKeys(
|
|
99
|
+
previousState?.propKeys,
|
|
100
|
+
previousState?.propResetValues,
|
|
101
|
+
state.propKeys,
|
|
102
|
+
);
|
|
65
103
|
const hasResetPatch = hasEitherResetPatch(
|
|
66
104
|
hasStyleResetPatch,
|
|
67
105
|
hasPropResetPatch,
|
|
@@ -92,30 +130,105 @@ const getResolvedSlotOutput = ({
|
|
|
92
130
|
};
|
|
93
131
|
};
|
|
94
132
|
|
|
133
|
+
const hasLocalStyleSource = (context: ResolveSlotStylesContext) => {
|
|
134
|
+
"worklet";
|
|
135
|
+
return context.localStylesMaps.length > 0;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const hasLocalSlot = (context: ResolveSlotStylesContext, slotId: string) => {
|
|
139
|
+
"worklet";
|
|
140
|
+
|
|
141
|
+
for (let index = 0; index < context.localStylesMaps.length; index++) {
|
|
142
|
+
if (context.localStylesMaps[index]?.[slotId] !== undefined) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return false;
|
|
148
|
+
};
|
|
149
|
+
|
|
95
150
|
const shouldDeferMissingLocalSlotReset = (
|
|
96
151
|
context: ResolveSlotStylesContext,
|
|
97
152
|
slotId: string,
|
|
98
153
|
) => {
|
|
99
154
|
"worklet";
|
|
100
155
|
const canInherit = shouldSlotInherit(slotId);
|
|
101
|
-
const
|
|
156
|
+
const localSlotExists = hasLocalSlot(context, slotId);
|
|
102
157
|
const hasInheritedSlot =
|
|
103
158
|
canInherit && context.ancestorStylesMap[slotId] !== undefined;
|
|
104
159
|
|
|
105
160
|
return (
|
|
106
161
|
context.deferLocalSlotResets &&
|
|
162
|
+
!hasLocalStyleSource(context) &&
|
|
107
163
|
!canInherit &&
|
|
108
|
-
!
|
|
164
|
+
!localSlotExists &&
|
|
109
165
|
!hasInheritedSlot
|
|
110
166
|
);
|
|
111
167
|
};
|
|
112
168
|
|
|
169
|
+
const mergeBucket = (
|
|
170
|
+
resolvedBucket: Record<string, unknown> | undefined,
|
|
171
|
+
source: Record<string, unknown> | undefined,
|
|
172
|
+
) => {
|
|
173
|
+
"worklet";
|
|
174
|
+
|
|
175
|
+
if (!source) {
|
|
176
|
+
return resolvedBucket;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
let nextBucket = resolvedBucket;
|
|
180
|
+
|
|
181
|
+
for (const key in source) {
|
|
182
|
+
const value = source[key];
|
|
183
|
+
|
|
184
|
+
if (!hasDefinedBucketValue(value)) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
nextBucket = nextBucket ?? {};
|
|
189
|
+
nextBucket[key] = value;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return nextBucket;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const getMergedLocalSlot = (
|
|
196
|
+
context: ResolveSlotStylesContext,
|
|
197
|
+
slotId: string,
|
|
198
|
+
) => {
|
|
199
|
+
"worklet";
|
|
200
|
+
let mergedStyle: Record<string, unknown> | undefined;
|
|
201
|
+
let mergedProps: Record<string, unknown> | undefined;
|
|
202
|
+
|
|
203
|
+
for (let index = 0; index < context.localStylesMaps.length; index++) {
|
|
204
|
+
const slot = context.localStylesMaps[index]?.[slotId];
|
|
205
|
+
|
|
206
|
+
if (slot === undefined) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
mergedStyle = mergeBucket(
|
|
211
|
+
mergedStyle,
|
|
212
|
+
slot.style as Record<string, unknown> | undefined,
|
|
213
|
+
);
|
|
214
|
+
mergedProps = mergeBucket(mergedProps, slot.props);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!mergedStyle && !mergedProps) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
style: mergedStyle,
|
|
223
|
+
props: mergedProps,
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
|
|
113
227
|
const getSlotForId = (context: ResolveSlotStylesContext, slotId: string) => {
|
|
114
228
|
"worklet";
|
|
115
|
-
const currentSlot = context.currentStylesMap[slotId];
|
|
116
229
|
|
|
117
|
-
if (
|
|
118
|
-
return
|
|
230
|
+
if (hasLocalSlot(context, slotId)) {
|
|
231
|
+
return getMergedLocalSlot(context, slotId);
|
|
119
232
|
}
|
|
120
233
|
|
|
121
234
|
if (shouldSlotInherit(slotId)) {
|
|
@@ -326,9 +439,19 @@ const appendResolvedSlot = (
|
|
|
326
439
|
|
|
327
440
|
const appendCurrentSlots = (context: ResolveSlotStylesContext) => {
|
|
328
441
|
"worklet";
|
|
442
|
+
const appendedSlotIds: Record<string, true> = {};
|
|
443
|
+
|
|
444
|
+
for (let index = 0; index < context.localStylesMaps.length; index++) {
|
|
445
|
+
const stylesMap = context.localStylesMaps[index];
|
|
446
|
+
|
|
447
|
+
for (const slotId in stylesMap) {
|
|
448
|
+
if (stylesMap[slotId] === undefined || appendedSlotIds[slotId]) {
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
329
451
|
|
|
330
|
-
|
|
331
|
-
|
|
452
|
+
appendedSlotIds[slotId] = true;
|
|
453
|
+
appendResolvedSlot(context, slotId);
|
|
454
|
+
}
|
|
332
455
|
}
|
|
333
456
|
};
|
|
334
457
|
|
|
@@ -337,9 +460,7 @@ const shouldAppendInheritedSlot = (
|
|
|
337
460
|
slotId: string,
|
|
338
461
|
) => {
|
|
339
462
|
"worklet";
|
|
340
|
-
return (
|
|
341
|
-
shouldSlotInherit(slotId) && context.currentStylesMap[slotId] === undefined
|
|
342
|
-
);
|
|
463
|
+
return shouldSlotInherit(slotId) && !hasLocalSlot(context, slotId);
|
|
343
464
|
};
|
|
344
465
|
|
|
345
466
|
const appendInheritedSlots = (context: ResolveSlotStylesContext) => {
|
|
@@ -361,7 +482,7 @@ const shouldAppendPreviousSlot = (
|
|
|
361
482
|
shouldSlotInherit(slotId) &&
|
|
362
483
|
context.ancestorStylesMap[slotId] !== undefined;
|
|
363
484
|
|
|
364
|
-
return context
|
|
485
|
+
return !hasLocalSlot(context, slotId) && !inheritedSlotExists;
|
|
365
486
|
};
|
|
366
487
|
|
|
367
488
|
const appendPreviousSlots = (context: ResolveSlotStylesContext) => {
|
|
@@ -381,12 +502,12 @@ const appendPreviousSlots = (context: ResolveSlotStylesContext) => {
|
|
|
381
502
|
* concrete identity values.
|
|
382
503
|
*/
|
|
383
504
|
export const resolveSlotStyles = ({
|
|
384
|
-
|
|
505
|
+
localStylesMaps,
|
|
385
506
|
ancestorStylesMap,
|
|
386
507
|
previousStyleStatesBySlot,
|
|
387
508
|
deferLocalSlotResets = false,
|
|
388
509
|
}: {
|
|
389
|
-
|
|
510
|
+
localStylesMaps: LocalStyleLayers;
|
|
390
511
|
ancestorStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
391
512
|
previousStyleStatesBySlot: ResettableStyleStatesBySlot;
|
|
392
513
|
deferLocalSlotResets?: boolean;
|
|
@@ -395,7 +516,7 @@ export const resolveSlotStyles = ({
|
|
|
395
516
|
const resolvedStylesMap: NormalizedTransitionInterpolatedStyle = {};
|
|
396
517
|
const nextPreviousStyleStatesBySlot: ResettableStyleStatesBySlot = {};
|
|
397
518
|
const context = {
|
|
398
|
-
|
|
519
|
+
localStylesMaps,
|
|
399
520
|
ancestorStylesMap,
|
|
400
521
|
previousStyleStatesBySlot,
|
|
401
522
|
deferLocalSlotResets,
|
|
@@ -35,10 +35,14 @@ const materializeResolvedBucket = ({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const previousResetValue = previousResetValues?.[key];
|
|
38
|
-
|
|
38
|
+
const resetValue =
|
|
39
39
|
previousResetValue !== undefined
|
|
40
40
|
? previousResetValue
|
|
41
41
|
: resetValues?.[key];
|
|
42
|
+
|
|
43
|
+
if (resetValue !== undefined) {
|
|
44
|
+
resolvedBucket[key] = resetValue;
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
if (source) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { NormalizedTransitionInterpolatedStyle } from "../../../../../types/animation.types";
|
|
2
|
+
|
|
3
|
+
export type LocalStyleLayers = NormalizedTransitionInterpolatedStyle[];
|
|
4
|
+
|
|
1
5
|
export type ResettableStyleState = {
|
|
2
6
|
styleKeys?: Record<string, true>;
|
|
3
7
|
styleResetValues?: Record<string, unknown>;
|