react-native-screen-transitions 3.2.0-beta.2 → 3.2.0-beta.3
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/README.md +108 -37
- package/lib/commonjs/blank-stack/components/stack-view.js +0 -2
- package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/blank-stack/components/stack-view.native.js +0 -2
- package/lib/commonjs/blank-stack/components/stack-view.native.js.map +1 -1
- package/lib/commonjs/component-stack/components/stack-view.js +16 -20
- package/lib/commonjs/component-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.native.js +3 -3
- package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +1 -6
- package/lib/commonjs/shared/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +16 -64
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js +5 -8
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle.js +153 -0
- package/lib/commonjs/shared/components/screen-lifecycle.js.map +1 -0
- package/lib/commonjs/shared/constants.js +3 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js +45 -0
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js.map +1 -0
- package/lib/commonjs/shared/hooks/use-stable-callback-value.js +0 -2
- package/lib/commonjs/shared/hooks/use-stable-callback-value.js.map +1 -1
- package/lib/commonjs/shared/index.js +7 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/keys.provider.js +0 -2
- package/lib/commonjs/shared/providers/screen/keys.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/screen-composer.js +3 -3
- package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js +1 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/types/index.js +3 -3
- package/lib/commonjs/shared/types/index.js.map +1 -1
- package/lib/commonjs/shared/types/stack.types.js +4 -0
- package/lib/commonjs/shared/types/stack.types.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/start-screen-transition.js +5 -5
- package/lib/commonjs/shared/utils/animation/start-screen-transition.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/blank-stack/components/stack-view.js +0 -2
- package/lib/module/blank-stack/components/stack-view.js.map +1 -1
- package/lib/module/blank-stack/components/stack-view.native.js +0 -2
- package/lib/module/blank-stack/components/stack-view.native.js.map +1 -1
- package/lib/module/component-stack/components/stack-view.js +16 -20
- package/lib/module/component-stack/components/stack-view.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.native.js +3 -3
- package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/float-overlay.js +1 -6
- package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/overlay-host.js +16 -64
- package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/screen-overlay.js +5 -8
- package/lib/module/shared/components/overlay/variations/screen-overlay.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle.js +147 -0
- package/lib/module/shared/components/screen-lifecycle.js.map +1 -0
- package/lib/module/shared/constants.js +2 -1
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-screen-state.js +41 -0
- package/lib/module/shared/hooks/navigation/use-screen-state.js.map +1 -0
- package/lib/module/shared/hooks/use-stable-callback-value.js +0 -3
- package/lib/module/shared/hooks/use-stable-callback-value.js.map +1 -1
- package/lib/module/shared/index.js +1 -0
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/screen/keys.provider.js +0 -2
- package/lib/module/shared/providers/screen/keys.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/screen-composer.js +3 -3
- package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/module/shared/providers/screen/styles.provider.js +1 -1
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/module/shared/types/index.js +1 -1
- package/lib/module/shared/types/index.js.map +1 -1
- package/lib/module/shared/types/stack.types.js +5 -0
- package/lib/module/shared/types/stack.types.js.map +1 -1
- package/lib/module/shared/utils/animation/start-screen-transition.js +1 -1
- package/lib/module/shared/utils/animation/start-screen-transition.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +4 -8
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/component-stack/types.d.ts +4 -8
- package/lib/typescript/component-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +2 -3
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +1 -6
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts +4 -0
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle.d.ts +9 -0
- package/lib/typescript/shared/components/screen-lifecycle.d.ts.map +1 -0
- package/lib/typescript/shared/constants.d.ts +2 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts +40 -0
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +21 -20
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/keys.provider.d.ts +2 -3
- package/lib/typescript/shared/providers/screen/keys.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts +1 -3
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +2 -6
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +2 -2
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/overlay.types.d.ts +21 -0
- package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +5 -4
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/stack.types.d.ts +9 -0
- package/lib/typescript/shared/types/stack.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blank-stack/components/stack-view.native.tsx +0 -2
- package/src/blank-stack/components/stack-view.tsx +0 -2
- package/src/blank-stack/types.ts +6 -8
- package/src/component-stack/components/stack-view.tsx +19 -23
- package/src/component-stack/types.ts +7 -8
- package/src/native-stack/types.ts +2 -3
- package/src/native-stack/views/NativeStackView.native.tsx +2 -3
- package/src/shared/components/overlay/variations/float-overlay.tsx +2 -8
- package/src/shared/components/overlay/variations/overlay-host.tsx +18 -84
- package/src/shared/components/overlay/variations/screen-overlay.tsx +6 -15
- package/src/shared/components/screen-lifecycle.tsx +168 -0
- package/src/shared/constants.ts +3 -1
- package/src/shared/hooks/animation/use-screen-animation.tsx +3 -3
- package/src/shared/hooks/gestures/use-build-gestures.tsx +0 -2
- package/src/shared/hooks/navigation/use-screen-state.tsx +99 -0
- package/src/shared/hooks/use-stable-callback-value.ts +0 -1
- package/src/shared/index.ts +4 -0
- package/src/shared/providers/screen/keys.provider.tsx +1 -9
- package/src/shared/providers/screen/screen-composer.tsx +3 -5
- package/src/shared/providers/screen/styles.provider.tsx +1 -1
- package/src/shared/types/animation.types.ts +2 -6
- package/src/shared/types/index.ts +2 -7
- package/src/shared/types/overlay.types.ts +23 -0
- package/src/shared/types/screen.types.ts +5 -4
- package/src/shared/types/stack.types.ts +16 -1
- package/src/shared/utils/animation/start-screen-transition.ts +1 -1
- package/src/shared/utils/bounds/index.ts +6 -1
- package/lib/commonjs/native-stack/controllers/native-stack-lifecycle.js +0 -90
- package/lib/commonjs/native-stack/controllers/native-stack-lifecycle.js.map +0 -1
- package/lib/commonjs/shared/controller/managed-lifecycle.js +0 -78
- package/lib/commonjs/shared/controller/managed-lifecycle.js.map +0 -1
- package/lib/commonjs/shared/types/state.types.js +0 -9
- package/lib/commonjs/shared/types/state.types.js.map +0 -1
- package/lib/module/native-stack/controllers/native-stack-lifecycle.js +0 -83
- package/lib/module/native-stack/controllers/native-stack-lifecycle.js.map +0 -1
- package/lib/module/shared/controller/managed-lifecycle.js +0 -72
- package/lib/module/shared/controller/managed-lifecycle.js.map +0 -1
- package/lib/module/shared/types/state.types.js +0 -5
- package/lib/module/shared/types/state.types.js.map +0 -1
- package/lib/typescript/native-stack/controllers/native-stack-lifecycle.d.ts +0 -8
- package/lib/typescript/native-stack/controllers/native-stack-lifecycle.d.ts.map +0 -1
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts +0 -9
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts.map +0 -1
- package/lib/typescript/shared/types/state.types.d.ts +0 -3
- package/lib/typescript/shared/types/state.types.d.ts.map +0 -1
- package/src/native-stack/controllers/native-stack-lifecycle.tsx +0 -96
- package/src/shared/controller/managed-lifecycle.tsx +0 -73
- package/src/shared/types/state.types.ts +0 -2
package/src/shared/constants.ts
CHANGED
|
@@ -71,8 +71,10 @@ export const FULLSCREEN_DIMENSIONS = (
|
|
|
71
71
|
*/
|
|
72
72
|
export const GESTURE_VELOCITY_IMPACT = 0.3;
|
|
73
73
|
export const DEFAULT_GESTURE_DIRECTION = "horizontal";
|
|
74
|
-
export const DEFAULT_GESTURE_ENABLED = false;
|
|
75
74
|
export const DEFAULT_GESTURE_DRIVES_PROGRESS = true;
|
|
76
75
|
export const DEFAULT_GESTURE_ACTIVATION_AREA: ActivationArea = "screen";
|
|
77
76
|
|
|
78
77
|
export const IS_WEB = Platform.OS === "web";
|
|
78
|
+
|
|
79
|
+
export const TRUE = 1;
|
|
80
|
+
export const FALSE = 0;
|
|
@@ -6,7 +6,6 @@ import type { NativeStackScreenTransitionConfig } from "../../../native-stack/ty
|
|
|
6
6
|
import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../constants";
|
|
7
7
|
import {
|
|
8
8
|
type BaseDescriptor,
|
|
9
|
-
type BaseRoute,
|
|
10
9
|
useKeys,
|
|
11
10
|
} from "../../providers/screen/keys.provider";
|
|
12
11
|
import { AnimationStore } from "../../stores/animation.store";
|
|
@@ -16,6 +15,7 @@ import type {
|
|
|
16
15
|
ScreenTransitionState,
|
|
17
16
|
} from "../../types/animation.types";
|
|
18
17
|
import type { ScreenTransitionConfig } from "../../types/screen.types";
|
|
18
|
+
import type { BaseStackRoute } from "../../types/stack.types";
|
|
19
19
|
import { derivations } from "../../utils/animation/derivations";
|
|
20
20
|
import { createBounds } from "../../utils/bounds";
|
|
21
21
|
import { useStack } from "../navigation/use-stack";
|
|
@@ -25,13 +25,13 @@ type BuiltState = {
|
|
|
25
25
|
closing: SharedValue<number>;
|
|
26
26
|
animating: SharedValue<number>;
|
|
27
27
|
gesture: GestureStoreMap;
|
|
28
|
-
route:
|
|
28
|
+
route: BaseStackRoute;
|
|
29
29
|
meta?: Record<string, unknown>;
|
|
30
30
|
unwrapped: ScreenTransitionState;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const createScreenTransitionState = (
|
|
34
|
-
route:
|
|
34
|
+
route: BaseStackRoute,
|
|
35
35
|
meta?: Record<string, unknown>,
|
|
36
36
|
): ScreenTransitionState => ({
|
|
37
37
|
progress: 0,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
DEFAULT_GESTURE_ACTIVATION_AREA,
|
|
16
16
|
DEFAULT_GESTURE_DIRECTION,
|
|
17
17
|
DEFAULT_GESTURE_DRIVES_PROGRESS,
|
|
18
|
-
DEFAULT_GESTURE_ENABLED,
|
|
19
18
|
GESTURE_VELOCITY_IMPACT,
|
|
20
19
|
} from "../../constants";
|
|
21
20
|
import type {
|
|
@@ -35,7 +34,6 @@ import { determineDismissal } from "../../utils/gesture/determine-dismissal";
|
|
|
35
34
|
import { mapGestureToProgress } from "../../utils/gesture/map-gesture-to-progress";
|
|
36
35
|
import { resetGestureValues } from "../../utils/gesture/reset-gesture-values";
|
|
37
36
|
import { velocity } from "../../utils/gesture/velocity";
|
|
38
|
-
import { useStack } from "../navigation/use-stack";
|
|
39
37
|
import useStableCallbackValue from "../use-stable-callback-value";
|
|
40
38
|
|
|
41
39
|
interface BuildGesturesHookProps {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Route } from "@react-navigation/native";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
4
|
+
import {
|
|
5
|
+
type BaseDescriptor,
|
|
6
|
+
useKeys,
|
|
7
|
+
} from "../../providers/screen/keys.provider";
|
|
8
|
+
import type { ScreenTransitionConfig } from "../../types/screen.types";
|
|
9
|
+
import type { BaseStackNavigation } from "../../types/stack.types";
|
|
10
|
+
import { useSharedValueState } from "../reanimated/use-shared-value-state";
|
|
11
|
+
import { type StackContextValue, useStack } from "./use-stack";
|
|
12
|
+
|
|
13
|
+
export interface ScreenState<
|
|
14
|
+
TNavigation extends BaseStackNavigation = BaseStackNavigation,
|
|
15
|
+
> {
|
|
16
|
+
/**
|
|
17
|
+
* The index of this screen in the stack.
|
|
18
|
+
*/
|
|
19
|
+
index: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Screen options for the currently focused screen.
|
|
23
|
+
*/
|
|
24
|
+
options: ScreenTransitionConfig;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* All routes currently in the stack.
|
|
28
|
+
*/
|
|
29
|
+
routes: Route<string>[];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Route of the currently focused screen in the stack.
|
|
33
|
+
*/
|
|
34
|
+
focusedRoute: Route<string>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Index of the focused route in the stack.
|
|
38
|
+
*/
|
|
39
|
+
focusedIndex: number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Custom metadata from the focused screen's options.
|
|
43
|
+
*/
|
|
44
|
+
meta?: Record<string, unknown>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Navigation object for this screen.
|
|
48
|
+
*/
|
|
49
|
+
navigation: TNavigation;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Hook to access screen state information.
|
|
54
|
+
*
|
|
55
|
+
* Use this hook to get navigation state and screen information.
|
|
56
|
+
*/
|
|
57
|
+
export function useScreenState<
|
|
58
|
+
TNavigation extends BaseStackNavigation = BaseStackNavigation,
|
|
59
|
+
>(): ScreenState<TNavigation> {
|
|
60
|
+
const { routes, scenes, routeKeys, optimisticFocusedIndex } =
|
|
61
|
+
useStack<StackContextValue>();
|
|
62
|
+
const { current } = useKeys<BaseDescriptor>();
|
|
63
|
+
|
|
64
|
+
const index = useMemo(
|
|
65
|
+
() => routeKeys.indexOf(current.route.key),
|
|
66
|
+
[routeKeys, current.route.key],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const focusedIndex = useSharedValueState(
|
|
70
|
+
useDerivedValue(() => {
|
|
71
|
+
const globalIndex = optimisticFocusedIndex.get();
|
|
72
|
+
return Math.max(0, Math.min(globalIndex, routeKeys.length - 1));
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const focusedScene = useMemo(() => {
|
|
77
|
+
return scenes[focusedIndex] ?? scenes[scenes.length - 1];
|
|
78
|
+
}, [scenes, focusedIndex]);
|
|
79
|
+
|
|
80
|
+
return useMemo(
|
|
81
|
+
() => ({
|
|
82
|
+
index,
|
|
83
|
+
options: focusedScene?.descriptor?.options ?? {},
|
|
84
|
+
routes,
|
|
85
|
+
focusedRoute: focusedScene?.route ?? current.route,
|
|
86
|
+
focusedIndex,
|
|
87
|
+
meta: focusedScene?.descriptor?.options?.meta,
|
|
88
|
+
navigation: current.navigation as TNavigation,
|
|
89
|
+
}),
|
|
90
|
+
[
|
|
91
|
+
index,
|
|
92
|
+
focusedScene,
|
|
93
|
+
routes,
|
|
94
|
+
focusedIndex,
|
|
95
|
+
current.navigation,
|
|
96
|
+
current.route,
|
|
97
|
+
],
|
|
98
|
+
);
|
|
99
|
+
}
|
package/src/shared/index.ts
CHANGED
|
@@ -20,6 +20,10 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
export { useScreenAnimation } from "./hooks/animation/use-screen-animation";
|
|
22
22
|
export { useScreenGesture } from "./hooks/gestures/use-screen-gesture";
|
|
23
|
+
export {
|
|
24
|
+
type ScreenState,
|
|
25
|
+
useScreenState,
|
|
26
|
+
} from "./hooks/navigation/use-screen-state";
|
|
23
27
|
|
|
24
28
|
export type {
|
|
25
29
|
AnimationConfig,
|
|
@@ -6,15 +6,7 @@ import type {
|
|
|
6
6
|
} from "@react-navigation/native";
|
|
7
7
|
import { createContext, useContext, useMemo } from "react";
|
|
8
8
|
import type { ScreenTransitionConfig } from "../../types/screen.types";
|
|
9
|
-
import type {
|
|
10
|
-
BaseStackDescriptor,
|
|
11
|
-
BaseStackNavigation,
|
|
12
|
-
BaseStackRoute,
|
|
13
|
-
} from "../../types/stack.types";
|
|
14
|
-
|
|
15
|
-
// Re-export for backward compatibility
|
|
16
|
-
export type { BaseStackNavigation as BaseNavigation };
|
|
17
|
-
export type { BaseStackRoute as BaseRoute };
|
|
9
|
+
import type { BaseStackDescriptor } from "../../types/stack.types";
|
|
18
10
|
|
|
19
11
|
/**
|
|
20
12
|
* Base descriptor interface - minimal contract for all stack types.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type { ComponentType } from "react";
|
|
3
2
|
import { RootTransitionAware } from "../../components/root-transition-aware";
|
|
3
|
+
import { ScreenLifecycle } from "../../components/screen-lifecycle";
|
|
4
4
|
import { ScreenGestureProvider } from "../gestures.provider";
|
|
5
5
|
import { type BaseDescriptor, KeysProvider } from "./keys.provider";
|
|
6
6
|
import { ScreenStylesProvider } from "./styles.provider";
|
|
@@ -10,7 +10,6 @@ type Props<TDescriptor extends BaseDescriptor> = {
|
|
|
10
10
|
current: TDescriptor;
|
|
11
11
|
next?: TDescriptor;
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
-
LifecycleController: ComponentType<any>;
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export function ScreenComposer<TDescriptor extends BaseDescriptor>({
|
|
@@ -18,7 +17,6 @@ export function ScreenComposer<TDescriptor extends BaseDescriptor>({
|
|
|
18
17
|
current,
|
|
19
18
|
next,
|
|
20
19
|
children,
|
|
21
|
-
LifecycleController,
|
|
22
20
|
}: Props<TDescriptor>) {
|
|
23
21
|
return (
|
|
24
22
|
<KeysProvider<TDescriptor>
|
|
@@ -27,11 +25,11 @@ export function ScreenComposer<TDescriptor extends BaseDescriptor>({
|
|
|
27
25
|
next={next}
|
|
28
26
|
>
|
|
29
27
|
<ScreenGestureProvider>
|
|
30
|
-
<
|
|
28
|
+
<ScreenLifecycle>
|
|
31
29
|
<ScreenStylesProvider>
|
|
32
30
|
<RootTransitionAware>{children}</RootTransitionAware>
|
|
33
31
|
</ScreenStylesProvider>
|
|
34
|
-
</
|
|
32
|
+
</ScreenLifecycle>
|
|
35
33
|
</ScreenGestureProvider>
|
|
36
34
|
</KeysProvider>
|
|
37
35
|
);
|
|
@@ -113,7 +113,7 @@ export function useScreenStyles() {
|
|
|
113
113
|
const ctx = useContext(ScreenStylesContext);
|
|
114
114
|
if (!ctx) {
|
|
115
115
|
throw new Error(
|
|
116
|
-
"
|
|
116
|
+
"useScreenStyles must be used within a ScreenStylesProvider",
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
return ctx;
|
|
@@ -4,10 +4,10 @@ import type {
|
|
|
4
4
|
WithTimingConfig,
|
|
5
5
|
} from "react-native-reanimated";
|
|
6
6
|
import type { EdgeInsets } from "react-native-safe-area-context";
|
|
7
|
-
import type { BaseRoute } from "../providers/screen/keys.provider";
|
|
8
7
|
import type { BoundsAccessor } from "./bounds.types";
|
|
9
8
|
import type { GestureValues } from "./gesture.types";
|
|
10
9
|
import type { Layout } from "./screen.types";
|
|
10
|
+
import type { BaseStackRoute } from "./stack.types";
|
|
11
11
|
|
|
12
12
|
export interface OverlayInterpolationProps {
|
|
13
13
|
progress: number;
|
|
@@ -69,12 +69,8 @@ export type ScreenTransitionState = {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* The route object for this screen.
|
|
72
|
-
*
|
|
73
|
-
* @deprecated Use `meta` instead for conditional animation logic.
|
|
74
|
-
* Pass route params via options: `options={({ route }) => ({ meta: { id: route.params.id } })}`
|
|
75
|
-
* This field may be removed in a future version.
|
|
76
72
|
*/
|
|
77
|
-
route:
|
|
73
|
+
route: BaseStackRoute;
|
|
78
74
|
};
|
|
79
75
|
|
|
80
76
|
export interface ScreenInterpolationProps {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { FALSE, TRUE } from "../constants";
|
|
1
2
|
export type {
|
|
2
3
|
AnimationConfig,
|
|
3
4
|
OverlayInterpolationProps,
|
|
@@ -7,14 +8,12 @@ export type {
|
|
|
7
8
|
TransitionInterpolatedStyle,
|
|
8
9
|
TransitionSpec,
|
|
9
10
|
} from "./animation.types";
|
|
10
|
-
|
|
11
11
|
export type {
|
|
12
12
|
BoundEntry,
|
|
13
13
|
BoundsAccessor,
|
|
14
14
|
BoundsLink,
|
|
15
15
|
BoundsMethod,
|
|
16
16
|
} from "./bounds.types";
|
|
17
|
-
|
|
18
17
|
export type {
|
|
19
18
|
ActivationArea,
|
|
20
19
|
GestureActivationArea,
|
|
@@ -22,25 +21,21 @@ export type {
|
|
|
22
21
|
GestureValues,
|
|
23
22
|
SideActivation,
|
|
24
23
|
} from "./gesture.types";
|
|
25
|
-
|
|
26
24
|
export type {
|
|
27
25
|
OverlayMode,
|
|
28
26
|
OverlayProps,
|
|
29
27
|
} from "./overlay.types";
|
|
30
|
-
|
|
31
28
|
export type {
|
|
32
29
|
Layout,
|
|
33
30
|
ScreenKey,
|
|
34
31
|
ScreenTransitionConfig,
|
|
35
32
|
TransitionAwareProps,
|
|
36
33
|
} from "./screen.types";
|
|
37
|
-
|
|
38
34
|
export type {
|
|
39
35
|
BaseStackDescriptor,
|
|
40
36
|
BaseStackNavigation,
|
|
41
37
|
BaseStackRoute,
|
|
42
38
|
BaseStackScene,
|
|
43
39
|
BaseStackState,
|
|
40
|
+
DescriptorMap,
|
|
44
41
|
} from "./stack.types";
|
|
45
|
-
|
|
46
|
-
export { FALSE, TRUE } from "./state.types";
|
|
@@ -4,7 +4,13 @@ import type {
|
|
|
4
4
|
OverlayInterpolationProps,
|
|
5
5
|
ScreenInterpolationProps,
|
|
6
6
|
} from "./animation.types";
|
|
7
|
+
import type { ScreenTransitionConfig } from "./screen.types";
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Overlay mode is no longer needed. Overlays now always render as "float" mode.
|
|
11
|
+
* For per-screen overlays, render an absolute-positioned view directly in your screen component
|
|
12
|
+
* and use `useScreenAnimation()` to access animation values.
|
|
13
|
+
*/
|
|
8
14
|
export type OverlayMode = "float" | "screen";
|
|
9
15
|
|
|
10
16
|
/**
|
|
@@ -37,13 +43,30 @@ export type OverlayProps<TNavigation = unknown> = {
|
|
|
37
43
|
*/
|
|
38
44
|
navigation: TNavigation;
|
|
39
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Screen options for the currently focused screen.
|
|
48
|
+
*/
|
|
49
|
+
options: ScreenTransitionConfig;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Stack progress relative to the overlay's position.
|
|
53
|
+
* This is equivalent to `useScreenAnimation().stackProgress`.
|
|
54
|
+
*/
|
|
55
|
+
progress: DerivedValue<number>;
|
|
56
|
+
|
|
40
57
|
/**
|
|
41
58
|
* Animation values for the overlay.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated Use `progress` prop or `useScreenAnimation()` instead.
|
|
61
|
+
* This prop will be removed in a future version.
|
|
42
62
|
*/
|
|
43
63
|
overlayAnimation: DerivedValue<OverlayInterpolationProps>;
|
|
44
64
|
|
|
45
65
|
/**
|
|
46
66
|
* Animation values for the screen.
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Use `useScreenAnimation()` hook directly instead.
|
|
69
|
+
* This prop will be removed in a future version.
|
|
47
70
|
*/
|
|
48
71
|
screenAnimation: DerivedValue<ScreenInterpolationProps>;
|
|
49
72
|
};
|
|
@@ -111,10 +111,11 @@ export type ScreenTransitionConfig = {
|
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* How the overlay is positioned relative to screens.
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
114
|
+
*
|
|
115
|
+
* @deprecated This option is no longer needed. Overlays now always render as "float" mode
|
|
116
|
+
* (single persistent overlay above all screens). For per-screen overlays, render an
|
|
117
|
+
* absolute-positioned view directly in your screen component and use `useScreenAnimation()`
|
|
118
|
+
* to access animation values.
|
|
118
119
|
*/
|
|
119
120
|
overlayMode?: OverlayMode;
|
|
120
121
|
|
|
@@ -15,8 +15,13 @@ export interface BaseStackRoute {
|
|
|
15
15
|
* Both React Navigation helpers and ComponentNavigation satisfy this.
|
|
16
16
|
*/
|
|
17
17
|
export interface BaseStackNavigation {
|
|
18
|
-
getState: () => {
|
|
18
|
+
getState: () => {
|
|
19
|
+
routes: Array<{ key: string }>;
|
|
20
|
+
key: string;
|
|
21
|
+
index: number;
|
|
22
|
+
};
|
|
19
23
|
dispatch: (action: any) => void;
|
|
24
|
+
addListener?: (event: any, callback: any) => () => void;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -57,6 +62,16 @@ export interface BaseStackState<
|
|
|
57
62
|
key: string;
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Generic descriptor map - keyed by route key.
|
|
67
|
+
* Use this instead of defining stack-specific DescriptorMap types.
|
|
68
|
+
*/
|
|
69
|
+
export type DescriptorMap<
|
|
70
|
+
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
71
|
+
> = {
|
|
72
|
+
[key: string]: TDescriptor;
|
|
73
|
+
};
|
|
74
|
+
|
|
60
75
|
export enum StackType {
|
|
61
76
|
NATIVE = "native",
|
|
62
77
|
BLANK = "blank",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runOnJS } from "react-native-reanimated";
|
|
2
|
+
import { FALSE, TRUE } from "../../constants";
|
|
2
3
|
import type { AnimationStoreMap } from "../../stores/animation.store";
|
|
3
4
|
import type { TransitionSpec } from "../../types/animation.types";
|
|
4
|
-
import { FALSE, TRUE } from "../../types/state.types";
|
|
5
5
|
import { animate } from "./animate";
|
|
6
6
|
|
|
7
7
|
interface StartScreenTransitionProps {
|
|
@@ -240,7 +240,12 @@ export const createBounds = (
|
|
|
240
240
|
const sourceValue = link?.source?.bounds?.[property] ?? fallback ?? 0;
|
|
241
241
|
const destValue = link?.destination?.bounds?.[property] ?? fallback ?? 0;
|
|
242
242
|
|
|
243
|
-
return interpolate(
|
|
243
|
+
return interpolate(
|
|
244
|
+
props.progress,
|
|
245
|
+
range,
|
|
246
|
+
[sourceValue, destValue],
|
|
247
|
+
"clamp",
|
|
248
|
+
);
|
|
244
249
|
};
|
|
245
250
|
|
|
246
251
|
return Object.assign(boundsFunction, {
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NativeStackScreenLifecycleController = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
-
var _useHighRefreshRate = require("../../shared/hooks/animation/use-high-refresh-rate");
|
|
10
|
-
var _useSharedValueState = require("../../shared/hooks/reanimated/use-shared-value-state");
|
|
11
|
-
var _useStableCallback = _interopRequireDefault(require("../../shared/hooks/use-stable-callback"));
|
|
12
|
-
var _gestures = require("../../shared/providers/gestures.provider");
|
|
13
|
-
var _keys = require("../../shared/providers/screen/keys.provider");
|
|
14
|
-
var _animation = require("../../shared/stores/animation.store");
|
|
15
|
-
var _state = require("../../shared/types/state.types");
|
|
16
|
-
var _startScreenTransition = require("../../shared/utils/animation/start-screen-transition");
|
|
17
|
-
var _resetStoresForScreen = require("../../shared/utils/reset-stores-for-screen");
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
/** biome-ignore-all lint/style/noNonNullAssertion: <Lifecycles are rendered right under the gesture provider> */
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Lifecycle controller built out for Native Stack implementation.
|
|
23
|
-
*/
|
|
24
|
-
const NativeStackScreenLifecycleController = ({
|
|
25
|
-
children
|
|
26
|
-
}) => {
|
|
27
|
-
const {
|
|
28
|
-
current
|
|
29
|
-
} = (0, _keys.useKeys)();
|
|
30
|
-
const {
|
|
31
|
-
ancestorContext
|
|
32
|
-
} = (0, _gestures.useGestureContext)();
|
|
33
|
-
const isAncestorDismissingViaGesture = (0, _useSharedValueState.useSharedValueState)((0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
34
|
-
"worklet";
|
|
35
|
-
|
|
36
|
-
return ancestorContext?.gestureAnimationValues.isDismissing?.value ?? false;
|
|
37
|
-
}));
|
|
38
|
-
const animations = _animation.AnimationStore.getAll(current.route.key);
|
|
39
|
-
const {
|
|
40
|
-
deactivateHighRefreshRate,
|
|
41
|
-
activateHighRefreshRate
|
|
42
|
-
} = (0, _useHighRefreshRate.useHighRefreshRate)(current);
|
|
43
|
-
const handleBeforeRemove = (0, _useStableCallback.default)(e => {
|
|
44
|
-
const isEnabled = current.options.enableTransitions;
|
|
45
|
-
const isFirstScreen = current.navigation.getState().index === 0;
|
|
46
|
-
|
|
47
|
-
// If transitions are disabled, or an ancestor is dismissing via gesture, or this is the first screen of the stack, reset the stores
|
|
48
|
-
if (!isEnabled || isAncestorDismissingViaGesture || isFirstScreen) {
|
|
49
|
-
animations.closing.set(_state.TRUE);
|
|
50
|
-
(0, _resetStoresForScreen.resetStoresForScreen)(current);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
activateHighRefreshRate();
|
|
55
|
-
const onAnimationFinish = finished => {
|
|
56
|
-
deactivateHighRefreshRate();
|
|
57
|
-
if (finished) {
|
|
58
|
-
current.navigation.dispatch(e.data.action);
|
|
59
|
-
|
|
60
|
-
// we'll ensure the dispatch is complete before resetting stores
|
|
61
|
-
requestAnimationFrame(() => {
|
|
62
|
-
(0, _resetStoresForScreen.resetStoresForScreen)(current);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
(0, _startScreenTransition.startScreenTransition)({
|
|
67
|
-
target: "close",
|
|
68
|
-
spec: current.options.transitionSpec,
|
|
69
|
-
onAnimationFinish,
|
|
70
|
-
animations
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
const handleInitialize = (0, _useStableCallback.default)(() => {
|
|
74
|
-
activateHighRefreshRate();
|
|
75
|
-
(0, _startScreenTransition.startScreenTransition)({
|
|
76
|
-
target: "open",
|
|
77
|
-
spec: current.options.transitionSpec,
|
|
78
|
-
animations,
|
|
79
|
-
onAnimationFinish: deactivateHighRefreshRate
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
(0, _react.useEffect)(() => {
|
|
83
|
-
const unsubscribe = current.navigation.addListener("beforeRemove", handleBeforeRemove);
|
|
84
|
-
return unsubscribe;
|
|
85
|
-
}, [current.navigation, handleBeforeRemove]);
|
|
86
|
-
(0, _react.useLayoutEffect)(handleInitialize, []);
|
|
87
|
-
return children;
|
|
88
|
-
};
|
|
89
|
-
exports.NativeStackScreenLifecycleController = NativeStackScreenLifecycleController;
|
|
90
|
-
//# sourceMappingURL=native-stack-lifecycle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeReanimated","_useHighRefreshRate","_useSharedValueState","_useStableCallback","_interopRequireDefault","_gestures","_keys","_animation","_state","_startScreenTransition","_resetStoresForScreen","e","__esModule","default","NativeStackScreenLifecycleController","children","current","useKeys","ancestorContext","useGestureContext","isAncestorDismissingViaGesture","useSharedValueState","useDerivedValue","gestureAnimationValues","isDismissing","value","animations","AnimationStore","getAll","route","key","deactivateHighRefreshRate","activateHighRefreshRate","useHighRefreshRate","handleBeforeRemove","useStableCallback","isEnabled","options","enableTransitions","isFirstScreen","navigation","getState","index","closing","set","TRUE","resetStoresForScreen","preventDefault","onAnimationFinish","finished","dispatch","data","action","requestAnimationFrame","startScreenTransition","target","spec","transitionSpec","handleInitialize","useEffect","unsubscribe","addListener","useLayoutEffect","exports"],"sourceRoot":"../../../../src","sources":["native-stack/controllers/native-stack-lifecycle.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ManagedLifecycle = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
-
var _useHighRefreshRate = require("../hooks/animation/use-high-refresh-rate");
|
|
10
|
-
var _useStableCallback = _interopRequireDefault(require("../hooks/use-stable-callback"));
|
|
11
|
-
var _keys = require("../providers/screen/keys.provider");
|
|
12
|
-
var _managed = require("../providers/stack/managed.provider");
|
|
13
|
-
var _animation = require("../stores/animation.store");
|
|
14
|
-
var _startScreenTransition = require("../utils/animation/start-screen-transition");
|
|
15
|
-
var _resetStoresForScreen = require("../utils/reset-stores-for-screen");
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
/**
|
|
18
|
-
* Lifecycle controller built out for Blank Stack implementation.
|
|
19
|
-
*/
|
|
20
|
-
const ManagedLifecycle = ({
|
|
21
|
-
children
|
|
22
|
-
}) => {
|
|
23
|
-
const {
|
|
24
|
-
current
|
|
25
|
-
} = (0, _keys.useKeys)();
|
|
26
|
-
const {
|
|
27
|
-
handleCloseRoute,
|
|
28
|
-
closingRouteKeysShared
|
|
29
|
-
} = (0, _managed.useManagedStackContext)();
|
|
30
|
-
const animations = _animation.AnimationStore.getAll(current.route.key);
|
|
31
|
-
const {
|
|
32
|
-
deactivateHighRefreshRate,
|
|
33
|
-
activateHighRefreshRate
|
|
34
|
-
} = (0, _useHighRefreshRate.useHighRefreshRate)(current);
|
|
35
|
-
const handleInitialize = (0, _useStableCallback.default)(() => {
|
|
36
|
-
activateHighRefreshRate();
|
|
37
|
-
(0, _startScreenTransition.startScreenTransition)({
|
|
38
|
-
target: "open",
|
|
39
|
-
spec: current.options.transitionSpec,
|
|
40
|
-
animations,
|
|
41
|
-
onAnimationFinish: deactivateHighRefreshRate
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
const handleCloseEnd = (0, _useStableCallback.default)(finished => {
|
|
45
|
-
if (!finished) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
handleCloseRoute({
|
|
49
|
-
route: current.route
|
|
50
|
-
});
|
|
51
|
-
requestAnimationFrame(() => {
|
|
52
|
-
deactivateHighRefreshRate();
|
|
53
|
-
(0, _resetStoresForScreen.resetStoresForScreen)(current);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(() => ({
|
|
57
|
-
keys: closingRouteKeysShared.value
|
|
58
|
-
}), ({
|
|
59
|
-
keys
|
|
60
|
-
}) => {
|
|
61
|
-
if (!keys.includes(current.route.key)) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
(0, _reactNativeReanimated.runOnJS)(activateHighRefreshRate)();
|
|
65
|
-
(0, _startScreenTransition.startScreenTransition)({
|
|
66
|
-
target: "close",
|
|
67
|
-
spec: current.options.transitionSpec,
|
|
68
|
-
animations,
|
|
69
|
-
onAnimationFinish: handleCloseEnd
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
(0, _react.useLayoutEffect)(() => {
|
|
73
|
-
handleInitialize();
|
|
74
|
-
}, [handleInitialize]);
|
|
75
|
-
return children;
|
|
76
|
-
};
|
|
77
|
-
exports.ManagedLifecycle = ManagedLifecycle;
|
|
78
|
-
//# sourceMappingURL=managed-lifecycle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeReanimated","_useHighRefreshRate","_useStableCallback","_interopRequireDefault","_keys","_managed","_animation","_startScreenTransition","_resetStoresForScreen","e","__esModule","default","ManagedLifecycle","children","current","useKeys","handleCloseRoute","closingRouteKeysShared","useManagedStackContext","animations","AnimationStore","getAll","route","key","deactivateHighRefreshRate","activateHighRefreshRate","useHighRefreshRate","handleInitialize","useStableCallback","startScreenTransition","target","spec","options","transitionSpec","onAnimationFinish","handleCloseEnd","finished","requestAnimationFrame","resetStoresForScreen","useAnimatedReaction","keys","value","includes","runOnJS","useLayoutEffect","exports"],"sourceRoot":"../../../../src","sources":["shared/controller/managed-lifecycle.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AAAwE,SAAAI,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMxE;AACA;AACA;AACO,MAAMG,gBAAgB,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAAK;EACxD,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,aAAO,EAAuB,CAAC;EACnD,MAAM;IAAEC,gBAAgB;IAAEC;EAAuB,CAAC,GAAG,IAAAC,+BAAsB,EAAC,CAAC;EAE7E,MAAMC,UAAU,GAAGC,yBAAc,CAACC,MAAM,CAACP,OAAO,CAACQ,KAAK,CAACC,GAAG,CAAC;EAE3D,MAAM;IAAEC,yBAAyB;IAAEC;EAAwB,CAAC,GAC3D,IAAAC,sCAAkB,EAACZ,OAAO,CAAC;EAE5B,MAAMa,gBAAgB,GAAG,IAAAC,0BAAiB,EAAC,MAAM;IAChDH,uBAAuB,CAAC,CAAC;IACzB,IAAAI,4CAAqB,EAAC;MACrBC,MAAM,EAAE,MAAM;MACdC,IAAI,EAAEjB,OAAO,CAACkB,OAAO,CAACC,cAAc;MACpCd,UAAU;MACVe,iBAAiB,EAAEV;IACpB,CAAC,CAAC;EACH,CAAC,CAAC;EAEF,MAAMW,cAAc,GAAG,IAAAP,0BAAiB,EAAEQ,QAAiB,IAAK;IAC/D,IAAI,CAACA,QAAQ,EAAE;MACd;IACD;IACApB,gBAAgB,CAAC;MAAEM,KAAK,EAAER,OAAO,CAACQ;IAAM,CAAC,CAAC;IAC1Ce,qBAAqB,CAAC,MAAM;MAC3Bb,yBAAyB,CAAC,CAAC;MAC3B,IAAAc,0CAAoB,EAACxB,OAAO,CAAC;IAC9B,CAAC,CAAC;EACH,CAAC,CAAC;EAEF,IAAAyB,0CAAmB,EAClB,OAAO;IACNC,IAAI,EAAEvB,sBAAsB,CAACwB;EAC9B,CAAC,CAAC,EACF,CAAC;IAAED;EAAK,CAAC,KAAK;IACb,IAAI,CAACA,IAAI,CAACE,QAAQ,CAAC5B,OAAO,CAACQ,KAAK,CAACC,GAAG,CAAC,EAAE;MACtC;IACD;IAEA,IAAAoB,8BAAO,EAAClB,uBAAuB,CAAC,CAAC,CAAC;IAClC,IAAAI,4CAAqB,EAAC;MACrBC,MAAM,EAAE,OAAO;MACfC,IAAI,EAAEjB,OAAO,CAACkB,OAAO,CAACC,cAAc;MACpCd,UAAU;MACVe,iBAAiB,EAAEC;IACpB,CAAC,CAAC;EACH,CACD,CAAC;EAED,IAAAS,sBAAe,EAAC,MAAM;IACrBjB,gBAAgB,CAAC,CAAC;EACnB,CAAC,EAAE,CAACA,gBAAgB,CAAC,CAAC;EAEtB,OAAOd,QAAQ;AAChB,CAAC;AAACgC,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TRUE","exports","FALSE"],"sourceRoot":"../../../../src","sources":["shared/types/state.types.ts"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,CAAC;AACd,MAAME,KAAK,GAAAD,OAAA,CAAAC,KAAA,GAAG,CAAC","ignoreList":[]}
|