@react-motion-router/core 1.10.0 → 2.0.0-beta.081390b
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/LICENSE +20 -20
- package/package.json +66 -60
- package/build/Anchor.d.ts +0 -17
- package/build/AnimationLayer.d.ts +0 -59
- package/build/AnimationLayerData.d.ts +0 -54
- package/build/AnimationProvider.d.ts +0 -56
- package/build/Animations.d.ts +0 -77
- package/build/GestureRegion.d.ts +0 -6
- package/build/GhostLayer.d.ts +0 -38
- package/build/HistoryBase.d.ts +0 -30
- package/build/MetaData.d.ts +0 -19
- package/build/MotionEvents.d.ts +0 -19
- package/build/NavigationBase.d.ts +0 -59
- package/build/RouteData.d.ts +0 -4
- package/build/RouterBase.d.ts +0 -80
- package/build/RouterData.d.ts +0 -64
- package/build/ScreenBase.d.ts +0 -70
- package/build/ScrollRestoration.d.ts +0 -25
- package/build/ScrollRestorationData.d.ts +0 -6
- package/build/SharedElement.d.ts +0 -138
- package/build/common/hooks.d.ts +0 -5
- package/build/common/types.d.ts +0 -94
- package/build/common/utils.d.ts +0 -43
- package/build/common/utils.js +0 -1
- package/build/index.d.ts +0 -38
- package/build/index.js +0 -2
- package/build/index.js.LICENSE.txt +0 -9
package/build/RouterBase.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import NavigationBase, { NavigateEvent, BackEvent } from './NavigationBase';
|
|
2
|
-
import { AnimationConfig, AnimationKeyframeEffectConfig, ReducedAnimationConfigSet, SwipeDirection, ScreenChild, PlainObject, RouterEventMap } from './common/types';
|
|
3
|
-
import RouterData, { RoutesData } from './RouterData';
|
|
4
|
-
import AnimationLayerData from './AnimationLayerData';
|
|
5
|
-
import { PageAnimationEndEvent } from './MotionEvents';
|
|
6
|
-
import { Component } from 'react';
|
|
7
|
-
interface Config {
|
|
8
|
-
animation?: ReducedAnimationConfigSet | AnimationConfig | AnimationKeyframeEffectConfig;
|
|
9
|
-
defaultRoute?: string;
|
|
10
|
-
swipeAreaWidth?: number;
|
|
11
|
-
minFlingVelocity?: number;
|
|
12
|
-
hysteresis?: number;
|
|
13
|
-
basePathname?: string;
|
|
14
|
-
disableDiscovery?: boolean;
|
|
15
|
-
swipeDirection?: SwipeDirection;
|
|
16
|
-
disableBrowserRouting?: boolean;
|
|
17
|
-
paramsSerializer?(params: PlainObject): string;
|
|
18
|
-
paramsDeserializer?(queryString: string): PlainObject;
|
|
19
|
-
}
|
|
20
|
-
export interface RouterBaseProps {
|
|
21
|
-
id?: string;
|
|
22
|
-
config: Config;
|
|
23
|
-
children: ScreenChild | ScreenChild[];
|
|
24
|
-
}
|
|
25
|
-
export interface RouterBaseState {
|
|
26
|
-
currentPath: string;
|
|
27
|
-
backNavigating: boolean;
|
|
28
|
-
gestureNavigating: boolean;
|
|
29
|
-
routesData: RoutesData;
|
|
30
|
-
implicitBack: boolean;
|
|
31
|
-
defaultDocumentTitle: string;
|
|
32
|
-
}
|
|
33
|
-
export default abstract class RouterBase<P extends RouterBaseProps = RouterBaseProps, S extends RouterBaseState = RouterBaseState> extends Component<P, S> {
|
|
34
|
-
private readonly _id;
|
|
35
|
-
protected readonly animationLayerData: AnimationLayerData;
|
|
36
|
-
protected ref: HTMLElement | null;
|
|
37
|
-
protected abstract _routerData: RouterData;
|
|
38
|
-
protected config: Config;
|
|
39
|
-
protected dispatchEvent: ((event: Event) => Promise<boolean>) | null;
|
|
40
|
-
protected addEventListener: (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined) => void) | null;
|
|
41
|
-
protected removeEventListener: (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined) => void) | null;
|
|
42
|
-
static defaultProps: {
|
|
43
|
-
config: {
|
|
44
|
-
animation: {
|
|
45
|
-
readonly in: {
|
|
46
|
-
readonly type: "none";
|
|
47
|
-
readonly duration: 0;
|
|
48
|
-
};
|
|
49
|
-
readonly out: {
|
|
50
|
-
readonly type: "none";
|
|
51
|
-
readonly duration: 0;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
constructor(props: RouterBaseProps);
|
|
57
|
-
state: S;
|
|
58
|
-
componentDidMount(): void;
|
|
59
|
-
componentWillUnmount(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Initialises current path and routes data from URL search params.
|
|
62
|
-
*/
|
|
63
|
-
protected initialise(navigation: NavigationBase): void;
|
|
64
|
-
get id(): string;
|
|
65
|
-
protected get parentRouterData(): RouterData<NavigationBase> | null;
|
|
66
|
-
protected get baseURL(): URL;
|
|
67
|
-
protected abstract get navigation(): NavigationBase;
|
|
68
|
-
abstract onAnimationEnd: (e: PageAnimationEndEvent) => void;
|
|
69
|
-
abstract onGestureNavigationStart: () => void;
|
|
70
|
-
abstract onGestureNavigationEnd: () => void;
|
|
71
|
-
protected onPopStateListener(e: Event): void;
|
|
72
|
-
abstract onBackListener: (e: BackEvent) => void;
|
|
73
|
-
abstract onNavigateListener: (e: NavigateEvent) => void;
|
|
74
|
-
onDocumentTitleChange: (title: string | null) => void;
|
|
75
|
-
addNavigationEventListeners(ref: HTMLElement): void;
|
|
76
|
-
removeNavigationEventListeners(ref: HTMLElement): void;
|
|
77
|
-
private setRef;
|
|
78
|
-
render(): JSX.Element;
|
|
79
|
-
}
|
|
80
|
-
export {};
|
package/build/RouterData.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ScreenBase, ScreenBaseProps } from '.';
|
|
3
|
-
import { AnimationConfigSet, PlainObject, RouteProp, RouterEventMap } from './common/types';
|
|
4
|
-
import GhostLayer from './GhostLayer';
|
|
5
|
-
import NavigationBase from './NavigationBase';
|
|
6
|
-
import RouterBase from './RouterBase';
|
|
7
|
-
import { ScrollRestorationData } from './ScrollRestorationData';
|
|
8
|
-
export type RoutesData = Map<string | undefined, RouteProp<ScreenBaseProps, PlainObject>>;
|
|
9
|
-
export default class RouterData<N extends NavigationBase = NavigationBase> {
|
|
10
|
-
private routerInstance;
|
|
11
|
-
private _parentRouterData;
|
|
12
|
-
private _childRouterData;
|
|
13
|
-
private _dispatchEvent;
|
|
14
|
-
private _addEventListener;
|
|
15
|
-
private _removeEventListener;
|
|
16
|
-
private _currentPath;
|
|
17
|
-
private _routesData;
|
|
18
|
-
private static _scrollRestorationData;
|
|
19
|
-
private _navigation?;
|
|
20
|
-
private _backNavigating;
|
|
21
|
-
private _gestureNavigating;
|
|
22
|
-
private _paramsSerializer?;
|
|
23
|
-
private _paramsDeserializer?;
|
|
24
|
-
private _mountedScreen;
|
|
25
|
-
private _animation;
|
|
26
|
-
private _ghostLayer;
|
|
27
|
-
constructor(routerInstance: RouterBase, navigation?: N);
|
|
28
|
-
destructor(): void;
|
|
29
|
-
prefetchRoute(path: string): Promise<boolean>;
|
|
30
|
-
set parentRouterData(parentRouterData: RouterData<NavigationBase> | null);
|
|
31
|
-
set childRouterData(childRouterData: RouterData<NavigationBase> | null);
|
|
32
|
-
set dispatchEvent(_dispatchEvent: ((event: Event) => Promise<boolean>) | null);
|
|
33
|
-
set addEventListener(_addEventListener: (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined) => void) | null);
|
|
34
|
-
set removeEventListener(_removeEventListener: (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined) => void) | null);
|
|
35
|
-
set currentPath(_currentPath: string);
|
|
36
|
-
set routesData(_routesData: RoutesData);
|
|
37
|
-
set navigation(_navigation: N);
|
|
38
|
-
set animation(_animation: AnimationConfigSet);
|
|
39
|
-
set ghostLayer(_ghostLayer: GhostLayer | null);
|
|
40
|
-
set backNavigating(_backNavigating: boolean);
|
|
41
|
-
set gestureNavigating(_gestureNavigating: boolean);
|
|
42
|
-
set paramsSerializer(_paramsSerializer: ((params: PlainObject) => string) | undefined);
|
|
43
|
-
set paramsDeserializer(_paramsDeserializer: ((queryString: string) => PlainObject) | undefined);
|
|
44
|
-
set mountedScreen(_mountedScreen: ScreenBase | null);
|
|
45
|
-
get mountedScreen(): ScreenBase | null;
|
|
46
|
-
get routerId(): string;
|
|
47
|
-
get routes(): import(".").ScreenChild<ScreenBaseProps, typeof ScreenBase> | import(".").ScreenChild<ScreenBaseProps, typeof ScreenBase>[];
|
|
48
|
-
get parentRouterData(): RouterData<NavigationBase> | null;
|
|
49
|
-
get childRouterData(): RouterData<NavigationBase> | null;
|
|
50
|
-
get dispatchEvent(): ((event: Event) => Promise<boolean>) | null;
|
|
51
|
-
get addEventListener(): (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined) => void) | null;
|
|
52
|
-
get removeEventListener(): (<K extends keyof RouterEventMap>(type: K, listener: (this: HTMLElement, ev: RouterEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined) => void) | null;
|
|
53
|
-
get currentPath(): string;
|
|
54
|
-
get routesData(): RoutesData;
|
|
55
|
-
get scrollRestorationData(): ScrollRestorationData;
|
|
56
|
-
get navigation(): N;
|
|
57
|
-
get animation(): AnimationConfigSet;
|
|
58
|
-
get ghostLayer(): GhostLayer | null;
|
|
59
|
-
get backNavigating(): boolean;
|
|
60
|
-
get gestureNavigating(): boolean;
|
|
61
|
-
get paramsSerializer(): ((params: PlainObject) => string) | undefined;
|
|
62
|
-
get paramsDeserializer(): ((queryString: string) => PlainObject) | undefined;
|
|
63
|
-
}
|
|
64
|
-
export declare const RouterDataContext: import("react").Context<RouterData<NavigationBase> | null>;
|
package/build/ScreenBase.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Component, ElementType } from "react";
|
|
2
|
-
import { AnimationConfig, AnimationConfigFactory, AnimationConfigSet, AnimationKeyframeEffectConfig, LazyExoticComponent, PlainObject, ReducedAnimationConfigSet, RouteProp, SwipeDirection } from "./common/types";
|
|
3
|
-
import { RouterDataContext } from "./RouterData";
|
|
4
|
-
import { SharedElementScene } from "./SharedElement";
|
|
5
|
-
import { NavigationBase } from ".";
|
|
6
|
-
export interface ScreenBaseProps {
|
|
7
|
-
out?: boolean;
|
|
8
|
-
in?: boolean;
|
|
9
|
-
component: React.JSXElementConstructor<any> | LazyExoticComponent<any>;
|
|
10
|
-
fallback?: React.ReactNode;
|
|
11
|
-
path?: string;
|
|
12
|
-
resolvedPathname?: string;
|
|
13
|
-
defaultParams?: PlainObject;
|
|
14
|
-
name?: string;
|
|
15
|
-
config?: {
|
|
16
|
-
header?: {
|
|
17
|
-
fallback?: React.ReactNode;
|
|
18
|
-
component: React.JSXElementConstructor<any> | LazyExoticComponent<any>;
|
|
19
|
-
};
|
|
20
|
-
footer?: {
|
|
21
|
-
fallback?: React.ReactNode;
|
|
22
|
-
component: React.JSXElementConstructor<any> | LazyExoticComponent<any>;
|
|
23
|
-
};
|
|
24
|
-
animation?: ReducedAnimationConfigSet | AnimationConfig | AnimationKeyframeEffectConfig | AnimationConfigFactory;
|
|
25
|
-
pseudoElement?: {
|
|
26
|
-
selector: string;
|
|
27
|
-
animation?: ReducedAnimationConfigSet | AnimationConfig | AnimationKeyframeEffectConfig | AnimationConfigFactory;
|
|
28
|
-
};
|
|
29
|
-
keepAlive?: boolean;
|
|
30
|
-
swipeDirection?: SwipeDirection;
|
|
31
|
-
swipeAreaWidth?: number;
|
|
32
|
-
minFlingVelocity?: number;
|
|
33
|
-
hysteresis?: number;
|
|
34
|
-
disableDiscovery?: boolean;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface ScreenBaseState {
|
|
38
|
-
shouldKeepAlive: boolean;
|
|
39
|
-
}
|
|
40
|
-
export default abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseProps, S extends ScreenBaseState = ScreenBaseState> extends Component<P, S> {
|
|
41
|
-
protected name: string;
|
|
42
|
-
protected sharedElementScene: SharedElementScene;
|
|
43
|
-
protected ref: HTMLElement | null;
|
|
44
|
-
private onRef;
|
|
45
|
-
private animation;
|
|
46
|
-
private pseudoElementAnimation;
|
|
47
|
-
protected elementType: ElementType | string;
|
|
48
|
-
protected animationProviderRef: HTMLElement | null;
|
|
49
|
-
protected _routeData: RouteProp<P, PlainObject>;
|
|
50
|
-
static contextType: import("react").Context<import("./RouterData").default<NavigationBase> | null>;
|
|
51
|
-
context: React.ContextType<typeof RouterDataContext>;
|
|
52
|
-
state: S;
|
|
53
|
-
componentDidMount(): void;
|
|
54
|
-
shouldComponentUpdate(nextProps: P): boolean;
|
|
55
|
-
protected setParams(params: PlainObject): void;
|
|
56
|
-
protected setConfig(config: P['config']): void;
|
|
57
|
-
protected get routeData(): RouteProp<P, PlainObject<any>>;
|
|
58
|
-
setupAnimation(animation?: ReducedAnimationConfigSet | AnimationConfig | AnimationKeyframeEffectConfig | AnimationConfigFactory): (() => AnimationConfigSet) | {
|
|
59
|
-
in: (AnimationConfig | AnimationKeyframeEffectConfig | undefined) & (AnimationConfig | AnimationKeyframeEffectConfig);
|
|
60
|
-
out: (AnimationConfig | AnimationKeyframeEffectConfig | undefined) & (AnimationConfig | AnimationKeyframeEffectConfig);
|
|
61
|
-
} | null;
|
|
62
|
-
animationFactory(animation?: AnimationKeyframeEffectConfig | AnimationConfig | ReducedAnimationConfigSet | AnimationConfigFactory): AnimationConfigSet;
|
|
63
|
-
onExited(): void;
|
|
64
|
-
onExit(): void;
|
|
65
|
-
onEnter(): void;
|
|
66
|
-
onEntered(): void;
|
|
67
|
-
private setRef;
|
|
68
|
-
get resolvedPathname(): P["resolvedPathname"] | undefined;
|
|
69
|
-
render(): JSX.Element;
|
|
70
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
2
|
-
interface ScrollRestorationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
id: string;
|
|
4
|
-
children: JSX.Element;
|
|
5
|
-
hashScrollConfig?: ScrollIntoViewOptions;
|
|
6
|
-
shouldRestore?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export default class ScrollRestoration extends Component<ScrollRestorationProps> {
|
|
9
|
-
private ref;
|
|
10
|
-
private scrollPos;
|
|
11
|
-
private routerData;
|
|
12
|
-
private _mounted;
|
|
13
|
-
constructor(props: ScrollRestorationProps);
|
|
14
|
-
componentDidMount(): void;
|
|
15
|
-
componentWillUnmount(): void;
|
|
16
|
-
onPageAnimationEnd: () => void;
|
|
17
|
-
onHashChange: () => void;
|
|
18
|
-
setRef: (ref: HTMLElement | null) => void;
|
|
19
|
-
get scrollTop(): number;
|
|
20
|
-
get scrollLeft(): number;
|
|
21
|
-
get scrollWidth(): number;
|
|
22
|
-
get scrollHeight(): number;
|
|
23
|
-
render(): JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
package/build/SharedElement.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
import { EasingFunction, PlainObject, Vec2 } from './common/types';
|
|
3
|
-
declare enum TransformOriginKeywordEnum {
|
|
4
|
-
center = 0,
|
|
5
|
-
top = 1,
|
|
6
|
-
bottom = 2,
|
|
7
|
-
left = 3,
|
|
8
|
-
right = 4
|
|
9
|
-
}
|
|
10
|
-
declare enum TransformOriginLengthUnitEnum {
|
|
11
|
-
cap = 0,
|
|
12
|
-
ch = 1,
|
|
13
|
-
em = 2,
|
|
14
|
-
ex = 3,
|
|
15
|
-
ic = 4,
|
|
16
|
-
lh = 5,
|
|
17
|
-
rem = 6,
|
|
18
|
-
rlh = 7,
|
|
19
|
-
vh = 8,
|
|
20
|
-
vw = 9,
|
|
21
|
-
vi = 10,
|
|
22
|
-
vb = 11,
|
|
23
|
-
vmin = 12,
|
|
24
|
-
vmax = 13,
|
|
25
|
-
px = 14,
|
|
26
|
-
cm = 15,
|
|
27
|
-
mm = 16,
|
|
28
|
-
Q = 17,
|
|
29
|
-
in = 18,
|
|
30
|
-
pc = 19,
|
|
31
|
-
pt = 20,
|
|
32
|
-
'%' = 21
|
|
33
|
-
}
|
|
34
|
-
declare enum TransformOriginGlobalEnum {
|
|
35
|
-
inital = 0,
|
|
36
|
-
inherit = 1,
|
|
37
|
-
revert = 2,
|
|
38
|
-
unset = 3
|
|
39
|
-
}
|
|
40
|
-
declare enum TransitionAnimationEnum {
|
|
41
|
-
"morph" = 0,
|
|
42
|
-
"fade-through" = 1,
|
|
43
|
-
"fade" = 2,
|
|
44
|
-
"cross-fade" = 3
|
|
45
|
-
}
|
|
46
|
-
type TransitionAnimation = keyof typeof TransitionAnimationEnum;
|
|
47
|
-
type TransformOriginGlobal = keyof typeof TransformOriginGlobalEnum;
|
|
48
|
-
type TransformOriginLengthUnit = keyof typeof TransformOriginLengthUnitEnum;
|
|
49
|
-
type TransformOriginLength = `${number}${TransformOriginLengthUnit}` | 0;
|
|
50
|
-
type TransformOriginKeyword = keyof typeof TransformOriginKeywordEnum;
|
|
51
|
-
type OneValueTransformOrigin = TransformOriginKeyword | TransformOriginLength;
|
|
52
|
-
type TwoValueTransformOrigin = `${OneValueTransformOrigin} ${OneValueTransformOrigin}`;
|
|
53
|
-
type ThreeValueTransformOrigin = `${OneValueTransformOrigin} ${OneValueTransformOrigin} ${TransformOriginLength}`;
|
|
54
|
-
type TransformOrigin = TransformOriginGlobal | OneValueTransformOrigin | TwoValueTransformOrigin | ThreeValueTransformOrigin;
|
|
55
|
-
export interface SharedElementNode {
|
|
56
|
-
id: string;
|
|
57
|
-
instance: SharedElement;
|
|
58
|
-
}
|
|
59
|
-
export type SharedElementNodeMap = Map<string, SharedElementNode>;
|
|
60
|
-
export declare class SharedElementScene {
|
|
61
|
-
private _nodes;
|
|
62
|
-
private _name;
|
|
63
|
-
private _scrollPos;
|
|
64
|
-
private _getScreenRect;
|
|
65
|
-
private _keepAlive;
|
|
66
|
-
constructor(name: string);
|
|
67
|
-
addNode(node: SharedElementNode | null): void;
|
|
68
|
-
removeNode(_id: string): void;
|
|
69
|
-
get xRatio(): number;
|
|
70
|
-
get yRatio(): number;
|
|
71
|
-
get nodes(): SharedElementNodeMap;
|
|
72
|
-
get name(): string;
|
|
73
|
-
get scrollPos(): Vec2;
|
|
74
|
-
get x(): number;
|
|
75
|
-
get y(): number;
|
|
76
|
-
get keepAlive(): boolean;
|
|
77
|
-
set scrollPos(_scrollPos: Vec2);
|
|
78
|
-
set getScreenRect(_getScreenRect: () => DOMRect);
|
|
79
|
-
set keepAlive(_keepAlive: boolean);
|
|
80
|
-
isEmpty(): boolean;
|
|
81
|
-
}
|
|
82
|
-
export declare const SharedElementSceneContext: import("react").Context<SharedElementScene | null>;
|
|
83
|
-
interface SharedElementConfig {
|
|
84
|
-
type?: TransitionAnimation;
|
|
85
|
-
transformOrigin?: TransformOrigin;
|
|
86
|
-
easingFunction?: EasingFunction;
|
|
87
|
-
duration?: number;
|
|
88
|
-
delay?: number;
|
|
89
|
-
x?: {
|
|
90
|
-
delay?: number;
|
|
91
|
-
duration?: number;
|
|
92
|
-
easingFunction?: EasingFunction;
|
|
93
|
-
};
|
|
94
|
-
y?: {
|
|
95
|
-
delay?: number;
|
|
96
|
-
duration?: number;
|
|
97
|
-
easingFunction?: EasingFunction;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
interface SharedElementProps {
|
|
101
|
-
id: string | number;
|
|
102
|
-
children: React.ReactChild;
|
|
103
|
-
disabled?: boolean;
|
|
104
|
-
config?: SharedElementConfig;
|
|
105
|
-
}
|
|
106
|
-
interface SharedElementState {
|
|
107
|
-
hidden: boolean;
|
|
108
|
-
keepAlive: boolean;
|
|
109
|
-
}
|
|
110
|
-
export declare class SharedElement extends Component<SharedElementProps, SharedElementState> {
|
|
111
|
-
private _id;
|
|
112
|
-
private _ref;
|
|
113
|
-
private _scene;
|
|
114
|
-
private _mutationObserver;
|
|
115
|
-
private _callbackID;
|
|
116
|
-
private _computedStyle;
|
|
117
|
-
private _isMounted;
|
|
118
|
-
private onRef;
|
|
119
|
-
state: SharedElementState;
|
|
120
|
-
get scene(): SharedElementScene | null;
|
|
121
|
-
get node(): HTMLElement | null;
|
|
122
|
-
get clientRect(): DOMRect;
|
|
123
|
-
get CSSData(): [string, PlainObject<string>];
|
|
124
|
-
get CSSText(): string;
|
|
125
|
-
get id(): string;
|
|
126
|
-
get transitionType(): "fade" | "morph" | "fade-through" | "cross-fade" | undefined;
|
|
127
|
-
onCloneAppended: (e: HTMLElement) => void;
|
|
128
|
-
onCloneRemove: (e: HTMLElement) => void;
|
|
129
|
-
keepAlive(_keepAlive: boolean): Promise<void>;
|
|
130
|
-
hidden(_hidden: boolean): Promise<void>;
|
|
131
|
-
private setRef;
|
|
132
|
-
updateScene(): void;
|
|
133
|
-
componentDidMount(): void;
|
|
134
|
-
componentDidUpdate(prevProps: SharedElementProps): void;
|
|
135
|
-
componentWillUnmount(): void;
|
|
136
|
-
render(): JSX.Element;
|
|
137
|
-
}
|
|
138
|
-
export {};
|
package/build/common/hooks.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { NavigationBase, PlainObject, RouteProp, ScreenBaseProps } from "..";
|
|
2
|
-
export declare function useReducedMotion(): boolean;
|
|
3
|
-
export declare function useNavigation<T extends NavigationBase = NavigationBase>(): NavigationBase;
|
|
4
|
-
export declare function useMotion(): number;
|
|
5
|
-
export declare function useRoute<P extends ScreenBaseProps, T extends PlainObject>(): RouteProp<P, T>;
|
package/build/common/types.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import NavigationBase from '../NavigationBase';
|
|
3
|
-
import ScreenBase, { ScreenBaseProps } from '../ScreenBase';
|
|
4
|
-
export type ScreenChild<P extends ScreenBaseProps = ScreenBaseProps, E extends typeof ScreenBase = typeof ScreenBase> = React.ReactElement<P, React.JSXElementConstructor<E>>;
|
|
5
|
-
declare enum AnimationDirectionEnum {
|
|
6
|
-
up = 0,
|
|
7
|
-
down = 1,
|
|
8
|
-
left = 2,
|
|
9
|
-
right = 3,
|
|
10
|
-
in = 4,
|
|
11
|
-
out = 5
|
|
12
|
-
}
|
|
13
|
-
declare enum AnimationTypeEnum {
|
|
14
|
-
slide = 0,
|
|
15
|
-
fade = 1,
|
|
16
|
-
zoom = 2,
|
|
17
|
-
none = 3
|
|
18
|
-
}
|
|
19
|
-
declare enum EasingFunctionKeywordEnum {
|
|
20
|
-
"ease" = 0,
|
|
21
|
-
"ease-in" = 1,
|
|
22
|
-
"ease-in-out" = 2,
|
|
23
|
-
"ease-out" = 3,
|
|
24
|
-
"linear" = 4
|
|
25
|
-
}
|
|
26
|
-
export type EasingFunctionKeyword = keyof typeof EasingFunctionKeywordEnum;
|
|
27
|
-
export type EasingFunction = EasingFunctionKeyword | `cubic-bezier(${number},${' ' | ''}${number},${' ' | ''}${number},${' ' | ''}${number})`;
|
|
28
|
-
export type ParamsSerializer = (params: PlainObject) => string;
|
|
29
|
-
export type ParamsDeserializer = (queryString: string) => PlainObject;
|
|
30
|
-
export type AnimationType = keyof typeof AnimationTypeEnum;
|
|
31
|
-
export type AnimationDirection = keyof typeof AnimationDirectionEnum;
|
|
32
|
-
export interface AnimationConfig {
|
|
33
|
-
type: AnimationType;
|
|
34
|
-
direction?: AnimationDirection;
|
|
35
|
-
duration: number;
|
|
36
|
-
easingFunction?: EasingFunction;
|
|
37
|
-
}
|
|
38
|
-
export interface AnimationKeyframeEffectConfig {
|
|
39
|
-
keyframes: Keyframe[] | PropertyIndexedKeyframes | null;
|
|
40
|
-
options?: number | KeyframeEffectOptions;
|
|
41
|
-
}
|
|
42
|
-
export interface AnimationConfigSet {
|
|
43
|
-
in: AnimationConfig | AnimationKeyframeEffectConfig;
|
|
44
|
-
out: AnimationConfig | AnimationKeyframeEffectConfig;
|
|
45
|
-
}
|
|
46
|
-
export type ReducedAnimationConfigSet = Partial<AnimationConfigSet> & Pick<AnimationConfigSet, 'in'>;
|
|
47
|
-
export type AnimationConfigFactory = (currentPath: string, nextPath: string, gestureNavigating: boolean) => AnimationConfig | AnimationKeyframeEffectConfig | ReducedAnimationConfigSet;
|
|
48
|
-
export interface Vec2 {
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
}
|
|
52
|
-
export type SwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
53
|
-
export type Without<T, U> = {
|
|
54
|
-
[P in Exclude<keyof T, keyof U>]?: never;
|
|
55
|
-
};
|
|
56
|
-
export type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
57
|
-
export type MetaTypeKey = 'http-equiv' | 'name' | 'itemprop' | 'property' | 'charset';
|
|
58
|
-
export type MetaType = [MetaTypeKey, string];
|
|
59
|
-
export type MetaKey = `${MetaTypeKey}=${string}`;
|
|
60
|
-
export type SearchParamsDeserializer = (queryString: string) => PlainObject;
|
|
61
|
-
export type SearchParamsSerializer = (params: PlainObject) => string;
|
|
62
|
-
export interface LazyExoticComponent<T extends React.ComponentType<any>> extends React.LazyExoticComponent<T> {
|
|
63
|
-
preload: () => Promise<{
|
|
64
|
-
default: T;
|
|
65
|
-
}>;
|
|
66
|
-
preloaded: T | undefined;
|
|
67
|
-
}
|
|
68
|
-
export interface RouteProp<P extends ScreenBaseProps, T extends PlainObject> {
|
|
69
|
-
path?: string;
|
|
70
|
-
config: NonNullable<P["config"]>;
|
|
71
|
-
focused: boolean;
|
|
72
|
-
params: T;
|
|
73
|
-
preloaded: boolean;
|
|
74
|
-
setParams(params: Partial<T>): void;
|
|
75
|
-
setConfig(config: P["config"]): void;
|
|
76
|
-
}
|
|
77
|
-
export interface ScreenComponentBaseProps<P extends ScreenBaseProps = ScreenBaseProps, T extends PlainObject = {}, N extends NavigationBase = NavigationBase> {
|
|
78
|
-
route: RouteProp<P, T>;
|
|
79
|
-
navigation: N;
|
|
80
|
-
orientation: ScreenOrientation;
|
|
81
|
-
}
|
|
82
|
-
export declare function isValidComponentConstructor(value: any): value is React.ComponentType<any>;
|
|
83
|
-
export type PlainObject<T = any> = {
|
|
84
|
-
[key: string]: T;
|
|
85
|
-
};
|
|
86
|
-
export type RouterEventMap = Pick<HTMLElementEventMap, "navigate" | "go-back" | "motion-progress" | "motion-progress-start" | "motion-progress-end" | "page-animation-start" | "page-animation-end" | "page-animation-cancel">;
|
|
87
|
-
export type NodeAppendedEvent = CustomEvent<{
|
|
88
|
-
node: Node;
|
|
89
|
-
}>;
|
|
90
|
-
export type NodeRemovedEvent = CustomEvent<{
|
|
91
|
-
node: Node;
|
|
92
|
-
}>;
|
|
93
|
-
export type CustomElementType = string;
|
|
94
|
-
export {};
|
package/build/common/utils.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import RouterData from "../RouterData";
|
|
3
|
-
import { LazyExoticComponent, PlainObject, SearchParamsDeserializer, SearchParamsSerializer } from "./types";
|
|
4
|
-
export declare function getCSSData(styles: CSSStyleDeclaration, exclude?: string[], object?: boolean): [string, PlainObject<string>];
|
|
5
|
-
export declare function getStyleObject(styles: CSSStyleDeclaration, exclude?: string[]): PlainObject<string>;
|
|
6
|
-
export declare function clamp(num: number, min: number, max?: number): number;
|
|
7
|
-
export interface MatchedRoute {
|
|
8
|
-
matchedPathname?: string;
|
|
9
|
-
rest?: string;
|
|
10
|
-
exact: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function matchRoute(routeTest: string | undefined, route: string | undefined, baseURL?: string): MatchedRoute | null;
|
|
13
|
-
export declare function includesRoute(routeString: string | undefined, routeTests: (string | undefined)[], baseURL?: string): boolean;
|
|
14
|
-
export declare function dispatchEvent<T>(event: CustomEvent<T> | Event, target?: HTMLElement | EventTarget): Promise<boolean>;
|
|
15
|
-
export declare function concatenateURL(path: string | URL, base: string | URL): URL;
|
|
16
|
-
export declare function defaultSearchParamsToObject(searchPart: string): PlainObject<string> | undefined;
|
|
17
|
-
export declare function searchParamsToObject(searchPart: string, paramsDeserializer: SearchParamsDeserializer | null): PlainObject<any>;
|
|
18
|
-
export declare function searchParamsFromObject(params: {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}, paramsSerializer: SearchParamsSerializer | null): string;
|
|
21
|
-
export declare function lazy<T extends React.ComponentType<any>>(factory: () => Promise<{
|
|
22
|
-
default: T;
|
|
23
|
-
}>): LazyExoticComponent<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Searches router data tree for matching screen. Once the screen is found
|
|
26
|
-
* its component is preloaded.
|
|
27
|
-
* @param path
|
|
28
|
-
* @param routerData
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare function prefetchRoute(path: string, routerData: RouterData): Promise<boolean>;
|
|
32
|
-
export declare function getAnimationDuration(animation: Animation | null, defaultDuration?: number): number;
|
|
33
|
-
export declare const DEFAULT_ANIMATION: {
|
|
34
|
-
readonly in: {
|
|
35
|
-
readonly type: "none";
|
|
36
|
-
readonly duration: 0;
|
|
37
|
-
};
|
|
38
|
-
readonly out: {
|
|
39
|
-
readonly type: "none";
|
|
40
|
-
readonly duration: 0;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export declare const MAX_Z_INDEX = 2147483647;
|
package/build/common/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";var n={810:(n,o,t)=>{n.exports=(e=>{var n={};return t.d(n,e),n})({Children:()=>e.Children,isValidElement:()=>e.isValidElement,lazy:()=>e.lazy})}},o={};function t(e){var r=o[e];if(void 0!==r)return r.exports;var a=o[e]={exports:{}};return n[e](a,a.exports,t),a.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var r={};(()=>{t.d(r,{Nu:()=>c,PV:()=>l,Po:()=>p,QN:()=>i,V_:()=>h,Vo:()=>f,cT:()=>o,dw:()=>g,e1:()=>s,fJ:()=>d,hR:()=>n,kI:()=>v,r2:()=>m,rL:()=>u,uZ:()=>a});var e=t(810);function n(e,n=[],o=!0){let t="";const r={};let a=0;for(let i in e)if(!n.includes(i)){if(a<e.length){const n=e[i];let o=e.getPropertyValue(n);if("visibility"===n)o="visible";t+=`${n}:${o};`}else{if(!o)break;let n=i,t=e[n];if("string"==typeof t&&"cssText"!==n&&!n.includes("webkit")&&!n.includes("grid")){switch(n){case"offset":n="cssOffset";break;case"float":n="cssFloat";break;case"visibility":t="visible"}r[n]=t}}a++}return[t,r]}function o(e,n=[]){const o={};for(const t in e)if(e[t]&&e[t].length&&"function"!=typeof e[t]){if(/^\d+$/.test(t))continue;if("offset"===t)continue;if(n.includes(t))continue;o[t]=e[t]}return o}function a(e,n,o){return e<n?n:o&&e>o?o:e}function i(e,n,o=window.location.origin){if(void 0===e||void 0===n)return e===n?{exact:!0,matchedPathname:n}:null;const t=new URLPattern(e,o),r=new URL(n,o),a=t.exec(r);let i="",s="";for(let e=0;e<t.pathname.length;e++){if(t.pathname[e]!==r.pathname[e]){s=r.pathname.substring(e);break}i+=t.pathname[e]}return a?{exact:e===n,matchedPathname:i,rest:s}:null}function s(e,n,o=window.location.origin){return n.some((n=>i(n,e,o)))}function c(e,n=window){return new Promise((o=>{queueMicrotask((()=>o(n.dispatchEvent(e))))}))}function l(e,n){return"string"==typeof n&&(n=new URL(n)),"string"!=typeof e&&(e=e.pathname),e=e.replace(/^\//,""),n.pathname.endsWith("/")||(n=new URL(n.href+"/")),new URL(e,n)}function u(e){const n=new URLSearchParams(decodeURI(e)).entries(),o={};for(const[e,t]of n){let n="";try{n=JSON.parse(t)}catch(e){console.warn("Non JSON serialisable value was passed as URL route param."),n=t}o[e]=n}return Object.keys(o).length?o:void 0}function d(e,n){return(n||u)(e)||{}}function p(e,n){try{return(n||function(e){return new URLSearchParams(e).toString()})(e)}catch(e){console.error(e),console.warn("Non JSON serialisable value was passed as route param to Anchor.")}return""}function f(n){const o=(0,e.lazy)(n);return o.preload=()=>{const e=n();return e.then((e=>o.preloaded=e.default)).catch(console.error),e},o}function v(n,o){let t=o;return new Promise(((r,a)=>{let s=!1;for(;t;){const c=t.routes;if(e.Children.forEach(c,(o=>{if(s)return;if(!(0,e.isValidElement)(o))return;i(o.props.path,n)&&(s=!0,queueMicrotask((async()=>{var e,n,t,i,c,l,u,d,p,f,v,h;const m=[];"preload"in o.props.component&&m.push(o.props.component.preload()),(null===(n=null===(e=o.props.config)||void 0===e?void 0:e.header)||void 0===n?void 0:n.component)&&"preload"in(null===(i=null===(t=o.props.config)||void 0===t?void 0:t.header)||void 0===i?void 0:i.component)&&m.push(null===(l=null===(c=o.props.config)||void 0===c?void 0:c.header)||void 0===l?void 0:l.component.preload()),(null===(d=null===(u=o.props.config)||void 0===u?void 0:u.footer)||void 0===d?void 0:d.component)&&"preload"in(null===(f=null===(p=o.props.config)||void 0===p?void 0:p.footer)||void 0===f?void 0:f.component)&&m.push(null===(h=null===(v=o.props.config)||void 0===v?void 0:v.footer)||void 0===h?void 0:h.component.preload());try{await Promise.all(m),r(s)}catch(e){a(e)}})))})),s)break;t=o.parentRouterData}s||r(!1)}))}function h(e,n=0){var o;const t=null===(o=null==e?void 0:e.effect)||void 0===o?void 0:o.getTiming().duration;return Number(t)||n}const m={in:{type:"none",duration:0},out:{type:"none",duration:0}},g=2147483647})();var a=r.r2,i=r.dw,s=r.uZ,c=r.PV,l=r.rL,u=r.Nu,d=r.V_,p=r.hR,f=r.cT,v=r.e1,h=r.Vo,m=r.QN,g=r.kI,w=r.Po,b=r.fJ;export{a as DEFAULT_ANIMATION,i as MAX_Z_INDEX,s as clamp,c as concatenateURL,l as defaultSearchParamsToObject,u as dispatchEvent,d as getAnimationDuration,p as getCSSData,f as getStyleObject,v as includesRoute,h as lazy,m as matchRoute,g as prefetchRoute,w as searchParamsFromObject,b as searchParamsToObject};
|
package/build/index.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ScreenChild, AnimationConfig, AnimationConfigFactory, NodeAppendedEvent, NodeRemovedEvent } from './common/types';
|
|
2
|
-
import RouterData from './RouterData';
|
|
3
|
-
import NavigationBase from './NavigationBase';
|
|
4
|
-
import type { BackEvent, BackEventDetail, NavigateEvent, NavigateEventDetail, NavigateOptions, NavigationOptions, GoBackOptions } from './NavigationBase';
|
|
5
|
-
import RouterBase, { RouterBaseProps, RouterBaseState } from './RouterBase';
|
|
6
|
-
import ScreenBase, { ScreenBaseProps, ScreenBaseState } from './ScreenBase';
|
|
7
|
-
import HistoryBase from './HistoryBase';
|
|
8
|
-
import Anchor from './Anchor';
|
|
9
|
-
import { Motion } from './AnimationLayer';
|
|
10
|
-
import type AnimationLayerData from './AnimationLayerData';
|
|
11
|
-
import GestureRegion from './GestureRegion';
|
|
12
|
-
import 'web-gesture-events';
|
|
13
|
-
import { MotionProgressEndEvent, MotionProgressEvent, MotionProgressStartEvent, PageAnimationCancelEvent, PageAnimationEndEvent, PageAnimationStartEvent } from './MotionEvents';
|
|
14
|
-
import ScrollRestoration from './ScrollRestoration';
|
|
15
|
-
import { SharedElement } from './SharedElement';
|
|
16
|
-
interface MotionEventsMap {
|
|
17
|
-
"page-animation-start": PageAnimationStartEvent;
|
|
18
|
-
"page-animation-cancel": PageAnimationCancelEvent;
|
|
19
|
-
"page-animation-end": PageAnimationEndEvent;
|
|
20
|
-
"motion-progress-start": MotionProgressStartEvent;
|
|
21
|
-
"motion-progress": MotionProgressEvent;
|
|
22
|
-
"motion-progress-end": MotionProgressEndEvent;
|
|
23
|
-
"go-back": BackEvent;
|
|
24
|
-
"navigate": NavigateEvent;
|
|
25
|
-
"node-appended": NodeAppendedEvent;
|
|
26
|
-
"node-removed": NodeRemovedEvent;
|
|
27
|
-
}
|
|
28
|
-
declare global {
|
|
29
|
-
interface GlobalEventHandlersEventMap extends MotionEventsMap {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export type { AnimationConfig, AnimationConfigFactory, ScreenChild, RouterBaseProps, RouterBaseState, ScreenBaseProps, ScreenBaseState };
|
|
33
|
-
export { SharedElement, Anchor, Motion, GestureRegion, ScrollRestoration };
|
|
34
|
-
export { NavigationBase, HistoryBase, RouterBase, RouterData, ScreenBase };
|
|
35
|
-
export type { MotionProgressEndEvent, MotionProgressEvent, MotionProgressStartEvent, BackEvent, BackEventDetail, NavigateEvent, NavigateEventDetail, NavigateOptions, NavigationOptions, GoBackOptions, AnimationLayerData };
|
|
36
|
-
export * from './common/hooks';
|
|
37
|
-
export * from './common/types';
|
|
38
|
-
export * from './common/utils';
|