@react-motion-router/stack 2.0.0-beta.sha-0daf7c7 → 2.0.0-beta.sha-b7e17f2
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/build/Anchor.d.ts +17 -2
- package/build/Navigation.d.ts +1 -0
- package/build/Router.d.ts +12 -13
- package/build/Screen.d.ts +2 -2
- package/build/common/constants.d.ts +1 -0
- package/build/index.js +871 -688
- package/build/index.js.map +1 -1
- package/package.json +2 -2
package/build/Anchor.d.ts
CHANGED
|
@@ -5,15 +5,30 @@ interface BaseAnchorProps extends React.DetailedHTMLProps<React.AnchorHTMLAttrib
|
|
|
5
5
|
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
6
6
|
navigation?: Navigation | null;
|
|
7
7
|
}
|
|
8
|
+
interface OnSightPreloadBehaviour extends UseIntersectionOptions {
|
|
9
|
+
type: 'onsight';
|
|
10
|
+
}
|
|
11
|
+
interface OnHoverPreloadBehaviour {
|
|
12
|
+
type: 'onhover';
|
|
13
|
+
forceThreshold?: number;
|
|
14
|
+
}
|
|
8
15
|
interface ForwardAnchorProps extends BaseAnchorProps {
|
|
9
16
|
params?: PlainObject<string | boolean | number>;
|
|
10
17
|
href: string;
|
|
11
|
-
type?: NavigateOptions[
|
|
18
|
+
type?: NavigateOptions['type'];
|
|
12
19
|
preload?: boolean;
|
|
20
|
+
preloadBehaviour?: OnSightPreloadBehaviour | OnHoverPreloadBehaviour | {
|
|
21
|
+
type: 'force';
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
interface BackAnchorProps extends BaseAnchorProps {
|
|
15
25
|
goBack: boolean;
|
|
16
26
|
}
|
|
17
27
|
type AnchorProps = XOR<ForwardAnchorProps, BackAnchorProps>;
|
|
18
|
-
|
|
28
|
+
interface UseIntersectionOptions {
|
|
29
|
+
root?: Element | null;
|
|
30
|
+
rootMargin?: string;
|
|
31
|
+
threshold?: number | number[];
|
|
32
|
+
}
|
|
33
|
+
export declare function Anchor({ preload, goBack, params, type, href: hrefProp, navigation: navigationProp, onClick: onClickProp, preloadBehaviour, children, ...aProps }: AnchorProps): JSX.Element;
|
|
19
34
|
export {};
|
package/build/Navigation.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Router } from './Router';
|
|
|
5
5
|
export declare class Navigation extends NavigationBase<RouterEventMap> {
|
|
6
6
|
protected readonly router: Router;
|
|
7
7
|
constructor(router: Router);
|
|
8
|
+
preload(route: string, props?: NavigationProps, options?: NavigationBaseOptions): Promise<boolean>;
|
|
8
9
|
replace(route: string, props?: NavigationProps, options?: NavigationBaseOptions): NavigationResult;
|
|
9
10
|
push(route: string, props?: NavigationProps, options?: NavigationBaseOptions): NavigationResult;
|
|
10
11
|
reload(props?: NavigationProps): NavigationResult;
|
package/build/Router.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RouterBase, ClonedElementType, LoadEvent, NestedRouterContext, RouterBaseConfig, RouterBaseProps, RouterBaseState, ScreenChild } from '../../core/build';
|
|
2
2
|
import { Navigation } from './Navigation';
|
|
3
3
|
import { ScreenProps, Screen, ScreenConfig } from './Screen';
|
|
4
|
-
import { RouterEventMap, ScreenInternalProps, SwipeDirection } from './common/types';
|
|
4
|
+
import { NavigationBaseOptions, NavigationProps, RouterEventMap, ScreenInternalProps, SwipeDirection } from './common/types';
|
|
5
5
|
export interface RouterConfig extends RouterBaseConfig {
|
|
6
6
|
screenConfig?: ScreenConfig;
|
|
7
7
|
disableBrowserRouting?: boolean;
|
|
@@ -12,9 +12,9 @@ export interface RouterConfig extends RouterBaseConfig {
|
|
|
12
12
|
export interface RouterProps extends RouterBaseProps<Screen> {
|
|
13
13
|
config?: RouterConfig;
|
|
14
14
|
}
|
|
15
|
-
type InjectedScreenProps = Pick<ScreenProps,
|
|
15
|
+
type InjectedScreenProps = Pick<ScreenProps, 'config' | 'defaultParams'> & ScreenInternalProps;
|
|
16
16
|
export interface RouterState extends RouterBaseState {
|
|
17
|
-
transition: NavigationTransition | LoadEvent[
|
|
17
|
+
transition: NavigationTransition | LoadEvent['transition'] | null;
|
|
18
18
|
screenStack: ClonedElementType<ScreenChild<Screen>, InjectedScreenProps>[];
|
|
19
19
|
gestureDirection: SwipeDirection;
|
|
20
20
|
gestureAreaWidth: number;
|
|
@@ -30,7 +30,6 @@ export declare class Router extends RouterBase<RouterProps, RouterState, RouterE
|
|
|
30
30
|
#private;
|
|
31
31
|
readonly navigation: Navigation;
|
|
32
32
|
constructor(props: RouterProps, context: React.ContextType<typeof NestedRouterContext>);
|
|
33
|
-
static readonly defaultProps: Partial<RouterProps>;
|
|
34
33
|
static getDerivedStateFromProps(_: RouterProps, state: RouterState): {
|
|
35
34
|
gestureDirection: SwipeDirection;
|
|
36
35
|
gestureAreaWidth: number;
|
|
@@ -42,19 +41,19 @@ export declare class Router extends RouterBase<RouterProps, RouterState, RouterE
|
|
|
42
41
|
componentDidMount(): void;
|
|
43
42
|
shouldComponentUpdate(nextProps: Readonly<RouterProps>, nextState: Readonly<RouterState>): boolean;
|
|
44
43
|
componentWillUnmount(): void;
|
|
45
|
-
private onNavigate;
|
|
46
|
-
private onCurrentEntryChange;
|
|
47
|
-
private onNavigateSuccess;
|
|
48
|
-
private onNavigateError;
|
|
49
|
-
private onGestureCancel;
|
|
44
|
+
private readonly onNavigate;
|
|
45
|
+
private readonly onCurrentEntryChange;
|
|
46
|
+
private readonly onNavigateSuccess;
|
|
47
|
+
private readonly onNavigateError;
|
|
48
|
+
private readonly onGestureCancel;
|
|
50
49
|
private canGestureNavigate;
|
|
51
|
-
private onSwipeStart;
|
|
52
|
-
private onSwipeEnd;
|
|
50
|
+
private readonly onSwipeStart;
|
|
51
|
+
private readonly onSwipeEnd;
|
|
53
52
|
get committed(): Promise<NavigationHistoryEntry> | null;
|
|
54
53
|
private get backNavigating();
|
|
55
54
|
protected get screens(): import('react').CElement<ScreenProps & Partial<InjectedScreenProps>, Screen & import('react').Component<ScreenProps & Pick<ScreenProps, "config" | "defaultParams"> & ScreenInternalProps, {}, any>>[];
|
|
56
|
-
|
|
57
|
-
private
|
|
55
|
+
preload(pathname: string, props?: NavigationProps, options?: NavigationBaseOptions): Promise<boolean>;
|
|
56
|
+
private cloneScreenChildFromPathname;
|
|
58
57
|
private getScreenRefByKey;
|
|
59
58
|
protected canIntercept(e: NavigateEvent): boolean;
|
|
60
59
|
protected shouldIntercept(e: NavigateEvent): boolean;
|
package/build/Screen.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScreenBase, PlainObject,
|
|
1
|
+
import { ScreenBase, PlainObject, ScreenBaseProps, ScreenBaseState, ScreenBaseComponentProps, ScreenBaseConfig } from '../../core/build';
|
|
2
2
|
import { Navigation } from './Navigation';
|
|
3
3
|
import { HistoryEntryState, RouteProp, ScreenInternalProps, SwipeDirection } from './common/types';
|
|
4
4
|
import { Router } from './Router';
|
|
@@ -21,7 +21,7 @@ export interface ScreenState extends ScreenBaseState {
|
|
|
21
21
|
}
|
|
22
22
|
export declare class Screen extends ScreenBase<ScreenProps, ScreenState, RouteProp> {
|
|
23
23
|
#private;
|
|
24
|
-
constructor(props: ScreenProps,
|
|
24
|
+
constructor(props: ScreenProps, router: Router);
|
|
25
25
|
static getDerivedStateFromProps(props: ScreenProps): {
|
|
26
26
|
elementType: string;
|
|
27
27
|
};
|