@react-motion-router/core 2.0.0-beta.sha-20ff5ff → 2.0.0-beta.sha-4c84f16
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 +35 -0
- package/build/MetaData.d.ts +5 -5
- package/build/NavigationBase.d.ts +33 -14
- package/build/RouterBase.d.ts +12 -10
- package/build/RouterContext.d.ts +1 -1
- package/build/ScreenBase.d.ts +7 -7
- package/build/ScreenTransitionLayer.d.ts +2 -2
- package/build/ScreenTransitionProvider.d.ts +4 -4
- package/build/SharedElement.d.ts +4 -6
- package/build/SharedElementTransitionLayer.d.ts +2 -2
- package/build/__tests__/Anchor/index.test.d.ts +1 -0
- package/build/__tests__/Anchor/push.test.d.ts +1 -0
- package/build/__tests__/Anchor/reload.test.d.ts +1 -0
- package/build/__tests__/Anchor/replace.test.d.ts +1 -0
- package/build/__tests__/Anchor/traverse.test.d.ts +1 -0
- package/build/__tests__/RouterBase/get-router-by-id.test.d.ts +1 -0
- package/build/__tests__/RouterBase/index.test.d.ts +1 -0
- package/build/__tests__/RouterBase/preload-screen.test.d.ts +1 -0
- package/build/__tests__/RouterBase/screen-child-from-pathname.test.d.ts +1 -0
- package/build/__tests__/common/utils.d.ts +33 -0
- package/build/__tests__/lazy.test.d.ts +1 -0
- package/build/__tests__/load-event.test.d.ts +1 -0
- package/build/__tests__/meta-data.test.d.ts +1 -0
- package/build/__tests__/screen.test.d.ts +1 -0
- package/build/common/constants.d.ts +4 -0
- package/build/common/events.d.ts +5 -18
- package/build/common/promise-wrapper.d.ts +8 -0
- package/build/common/test-utils.d.ts +12 -0
- package/build/common/types.d.ts +17 -15
- package/build/common/utils.d.ts +4 -3
- package/build/index.d.ts +5 -0
- package/build/index.js +1141 -702
- package/build/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React, RefObject } from 'react';
|
|
2
|
+
type AnchorState = {
|
|
3
|
+
href?: string | null;
|
|
4
|
+
};
|
|
5
|
+
interface AnchorBaseProps extends Omit<AnchorProps, 'ref'> {
|
|
6
|
+
ref?: RefObject<AnchorBase | null>;
|
|
7
|
+
}
|
|
8
|
+
export declare class AnchorBase extends React.Component<AnchorBaseProps, AnchorState> {
|
|
9
|
+
constructor(props: AnchorBaseProps);
|
|
10
|
+
readonly anchorRef: React.RefObject<HTMLAnchorElement | null>;
|
|
11
|
+
private static directionFromRel;
|
|
12
|
+
private static findClosestEntryByHref;
|
|
13
|
+
private static findClosestEntry;
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
componentWillUnmount(): void;
|
|
16
|
+
private readonly onNavigate;
|
|
17
|
+
private get href();
|
|
18
|
+
private get search();
|
|
19
|
+
private readonly handleClick;
|
|
20
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export interface AnchorProps extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
23
|
+
href?: string;
|
|
24
|
+
rel?: string;
|
|
25
|
+
historyEntryKey?: string;
|
|
26
|
+
navigateInfo?: unknown;
|
|
27
|
+
navigateState?: unknown;
|
|
28
|
+
reload?: boolean;
|
|
29
|
+
replace?: boolean;
|
|
30
|
+
traverse?: boolean;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
search?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function Anchor({ ref: forwardedRef, ...props }: AnchorProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export {};
|
package/build/MetaData.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { MetaType } from './common/types';
|
|
2
2
|
export declare class MetaData {
|
|
3
3
|
#private;
|
|
4
|
-
private mutationObserver;
|
|
4
|
+
private readonly mutationObserver;
|
|
5
5
|
constructor();
|
|
6
6
|
get(key: string | MetaType): string | [string, string][] | undefined;
|
|
7
7
|
set(key: string | MetaType, content?: string | [string, string][]): void;
|
|
8
8
|
has(key: string | MetaType): boolean;
|
|
9
9
|
delete(key: string | MetaType): void;
|
|
10
10
|
clear(): void;
|
|
11
|
-
entries(): MapIterator<[
|
|
12
|
-
[Symbol.iterator](): MapIterator<[
|
|
11
|
+
entries(): MapIterator<[`${string}=${string}`, string | undefined]>;
|
|
12
|
+
[Symbol.iterator](): MapIterator<[`${string}=${string}`, string | undefined]>;
|
|
13
13
|
get size(): number;
|
|
14
14
|
private observeMutations;
|
|
15
15
|
private metaDataFromNode;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
16
|
+
private formatMetaKey;
|
|
17
|
+
private formatMetaContent;
|
|
18
18
|
private updateMetaElement;
|
|
19
19
|
}
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RouterBaseHTMLElement } from './common/types';
|
|
2
2
|
import { MetaData } from './MetaData';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
protected abstract readonly router: RouterBase;
|
|
6
|
-
private static rootNavigatorRef;
|
|
7
|
-
readonly metaData: MetaData;
|
|
8
|
-
constructor();
|
|
9
|
-
addEventListener<K extends keyof E>(type: K, listener: (this: RouterHTMLElement<E>, ev: E[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
|
|
3
|
+
export interface NavigationBaseConfig {
|
|
4
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
10
5
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
11
|
-
|
|
6
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
7
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
8
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
12
9
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
13
10
|
dispatchEvent(event: Event): Promise<boolean>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getNavigatorById(routerId: string): NavigationBase
|
|
11
|
+
parent: NavigationBase | null;
|
|
12
|
+
routerId: string;
|
|
13
|
+
baseURL: URL;
|
|
14
|
+
baseURLPattern: URLPattern;
|
|
15
|
+
getNavigatorById(routerId: string): NavigationBase | null;
|
|
16
|
+
}
|
|
17
|
+
export declare abstract class NavigationBase {
|
|
18
|
+
private static rootNavigatorRef;
|
|
19
|
+
readonly metaData: MetaData;
|
|
20
|
+
readonly addEventListener: {
|
|
21
|
+
<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
22
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
23
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
24
|
+
};
|
|
25
|
+
readonly removeEventListener: {
|
|
26
|
+
<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
27
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
28
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
29
|
+
};
|
|
30
|
+
readonly dispatchEvent: (event: Event) => Promise<boolean>;
|
|
31
|
+
readonly parent: NavigationBase | null;
|
|
32
|
+
readonly routerId: string;
|
|
33
|
+
readonly baseURL: URL;
|
|
34
|
+
readonly baseURLPattern: URLPattern;
|
|
35
|
+
readonly getNavigatorById: (routerId: string) => NavigationBase | null;
|
|
36
|
+
constructor(config: NavigationBaseConfig);
|
|
37
|
+
protected preload(route: string, state?: unknown): NavigationResult;
|
|
19
38
|
private get isInDocument();
|
|
20
39
|
}
|
package/build/RouterBase.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigationBase } from './NavigationBase';
|
|
2
2
|
import { ScreenTransitionLayer } from './ScreenTransitionLayer';
|
|
3
|
-
import { ScreenChild,
|
|
3
|
+
import { ScreenChild, RouterBaseHTMLElement, EventHandler } from './common/types';
|
|
4
4
|
import { NestedRouterContext } from './RouterContext';
|
|
5
5
|
import { Component } from 'react';
|
|
6
6
|
import { ScreenBase, ScreenBaseConfig } from './ScreenBase';
|
|
@@ -14,12 +14,11 @@ export interface RouterBaseProps<S extends ScreenBase = ScreenBase> {
|
|
|
14
14
|
config?: RouterBaseConfig;
|
|
15
15
|
children: ScreenChild<S> | ScreenChild<S>[];
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseProps, S extends RouterBaseState = RouterBaseState, E extends RouterBaseEventMap = RouterBaseEventMap> extends Component<P, S> {
|
|
17
|
+
export type RouterBaseState = object;
|
|
18
|
+
export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseProps, S extends RouterBaseState = RouterBaseState> extends Component<P, S> implements EventHandler {
|
|
20
19
|
#private;
|
|
21
|
-
protected readonly ref: import('react').RefObject<
|
|
22
|
-
protected screenTransitionLayer: import('react').RefObject<ScreenTransitionLayer>;
|
|
20
|
+
protected readonly ref: import('react').RefObject<RouterBaseHTMLElement | null>;
|
|
21
|
+
protected screenTransitionLayer: import('react').RefObject<ScreenTransitionLayer | null>;
|
|
23
22
|
abstract readonly navigation: NavigationBase;
|
|
24
23
|
readonly parent: RouterBase | null;
|
|
25
24
|
private loadDispatched;
|
|
@@ -32,20 +31,23 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
|
|
|
32
31
|
} | null>;
|
|
33
32
|
context: React.ContextType<typeof NestedRouterContext>;
|
|
34
33
|
constructor(props: P, context: React.ContextType<typeof NestedRouterContext>);
|
|
34
|
+
private static get events();
|
|
35
35
|
componentDidMount(): void;
|
|
36
36
|
componentWillUnmount(): void;
|
|
37
|
-
|
|
37
|
+
onnavigate(e: NavigateEvent): void;
|
|
38
38
|
getRouterById(routerId: string, target?: RouterBase): RouterBase | null;
|
|
39
39
|
dispatchEvent(event: Event): Promise<boolean>;
|
|
40
|
-
addEventListener<K extends keyof
|
|
40
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
41
41
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
42
|
-
removeEventListener<K extends keyof
|
|
42
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: RouterBaseHTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
43
43
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
44
|
+
handleEvent(e: Event): void;
|
|
44
45
|
protected screenChildFromPathname(pathname: string): {
|
|
45
46
|
child: ScreenChild<ScreenType<P["children"]>>;
|
|
46
47
|
matchInfo: import('./common/types').MatchedRoute;
|
|
47
48
|
} | null;
|
|
48
49
|
protected preloadScreen(screen: ScreenChild): Promise<void>;
|
|
50
|
+
includesRoute(pathname: string, baseURLPattern?: string): boolean;
|
|
49
51
|
get id(): string;
|
|
50
52
|
get isRoot(): boolean;
|
|
51
53
|
get baseURL(): URL;
|
|
@@ -61,6 +63,6 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
|
|
|
61
63
|
protected abstract shouldIntercept(navigateEvent: NavigateEvent): boolean;
|
|
62
64
|
protected abstract intercept(navigateEvent: NavigateEvent): void;
|
|
63
65
|
protected abstract get screens(): P['children'];
|
|
64
|
-
render(): JSX.Element | undefined;
|
|
66
|
+
render(): import("react/jsx-runtime").JSX.Element | undefined;
|
|
65
67
|
}
|
|
66
68
|
export {};
|
package/build/RouterContext.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare const NestedRouterContext: import('react').Context<{
|
|
|
4
4
|
parentRouter: RouterBase;
|
|
5
5
|
parentScreen: ScreenBase;
|
|
6
6
|
} | null>;
|
|
7
|
-
export declare const RouterContext: import('react').Context<RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<import('./ScreenBase').ScreenBaseProps, import('./ScreenBase').ScreenBaseState<import('./ScreenBase').ScreenBaseConfig<import('.').RoutePropBase<{}, import('.').PlainObject<any>>, import('./NavigationBase').NavigationBase
|
|
7
|
+
export declare const RouterContext: import('react').Context<RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<import('./ScreenBase').ScreenBaseProps, import('./ScreenBase').ScreenBaseState<import('./ScreenBase').ScreenBaseConfig<import('.').RoutePropBase<{}, import('.').PlainObject<any>>, import('./NavigationBase').NavigationBase> | undefined, import('.').PlainObject>, import('.').RoutePropBase<import('./ScreenBase').ScreenBaseConfig<import('.').RoutePropBase<{}, import('.').PlainObject<any>>, import('./NavigationBase').NavigationBase> | undefined, import('.').PlainObject<any>>>>, object>>;
|
package/build/ScreenBase.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { RouterContext } from './RouterContext';
|
|
|
5
5
|
import { NavigationBase } from './NavigationBase';
|
|
6
6
|
import { SharedElementScene } from './SharedElementScene';
|
|
7
7
|
export interface ScreenBaseComponentProps<R extends RoutePropBase = RoutePropBase, N extends NavigationBase = NavigationBase> {
|
|
8
|
-
route: R;
|
|
9
|
-
navigation: N;
|
|
8
|
+
readonly route: R;
|
|
9
|
+
readonly navigation: N;
|
|
10
10
|
}
|
|
11
11
|
export type LifecycleProps<R extends RoutePropBase, N extends NavigationBase = NavigationBase> = ({
|
|
12
12
|
signal: AbortSignal;
|
|
@@ -51,12 +51,12 @@ export interface ScreenBaseState<C extends ScreenBaseProps['config'] = ScreenBas
|
|
|
51
51
|
export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseProps, S extends ScreenBaseState<P['config']> = ScreenBaseState<P['config']>, R extends RoutePropBase<P['config']> = RoutePropBase<P['config']>> extends Component<P, S> {
|
|
52
52
|
#private;
|
|
53
53
|
readonly sharedElementScene: SharedElementScene;
|
|
54
|
-
protected readonly ref: import('react').RefObject<HTMLDivElement>;
|
|
54
|
+
protected readonly ref: import('react').RefObject<HTMLDivElement | null>;
|
|
55
55
|
protected readonly nestedRouterData: {
|
|
56
56
|
parentScreen: ScreenBase;
|
|
57
|
-
parentRouter: import('./RouterBase').RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase
|
|
57
|
+
parentRouter: import('./RouterBase').RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase> | undefined, PlainObject>, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase> | undefined, PlainObject<any>>>>, object>;
|
|
58
58
|
};
|
|
59
|
-
static readonly contextType: import('react').Context<import('./RouterBase').RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase
|
|
59
|
+
static readonly contextType: import('react').Context<import('./RouterBase').RouterBase<import('./RouterBase').RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase> | undefined, PlainObject>, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase> | undefined, PlainObject<any>>>>, object>>;
|
|
60
60
|
context: React.ContextType<typeof RouterContext>;
|
|
61
61
|
state: S;
|
|
62
62
|
constructor(props: P, context: React.ContextType<typeof RouterContext>);
|
|
@@ -79,6 +79,6 @@ export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseP
|
|
|
79
79
|
onEnter(signal: AbortSignal): Promise<void>;
|
|
80
80
|
onEntered(signal: AbortSignal): Promise<void>;
|
|
81
81
|
get path(): P["path"];
|
|
82
|
-
get transitionProvider(): import('react').RefObject<ScreenTransitionProvider>;
|
|
83
|
-
render(): JSX.Element;
|
|
82
|
+
get transitionProvider(): import('react').RefObject<ScreenTransitionProvider | null>;
|
|
83
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
84
84
|
}
|
|
@@ -15,7 +15,7 @@ interface ScreenTransitionLayerState {
|
|
|
15
15
|
}
|
|
16
16
|
export declare class ScreenTransitionLayer extends Component<ScreenTransitionLayerProps, ScreenTransitionLayerState> {
|
|
17
17
|
#private;
|
|
18
|
-
readonly sharedElementTransitionLayer: RefObject<SharedElementTransitionLayer>;
|
|
18
|
+
readonly sharedElementTransitionLayer: RefObject<SharedElementTransitionLayer | null>;
|
|
19
19
|
readonly animation: Animation;
|
|
20
20
|
state: ScreenTransitionLayerState;
|
|
21
21
|
private onTransitionCancel;
|
|
@@ -27,6 +27,6 @@ export declare class ScreenTransitionLayer extends Component<ScreenTransitionLay
|
|
|
27
27
|
get direction(): PlaybackDirection;
|
|
28
28
|
get hasUAVisualTransition(): boolean;
|
|
29
29
|
transition(): Animation;
|
|
30
|
-
render(): JSX.Element;
|
|
30
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
}
|
|
32
32
|
export {};
|
|
@@ -14,18 +14,18 @@ interface ScreenTransitionProviderState {
|
|
|
14
14
|
zIndex: React.CSSProperties['zIndex'];
|
|
15
15
|
}
|
|
16
16
|
export declare class ScreenTransitionProvider extends Component<ScreenTransitionProviderProps, ScreenTransitionProviderState> {
|
|
17
|
-
readonly ref: import('react').RefObject<HTMLElement>;
|
|
17
|
+
readonly ref: import('react').RefObject<HTMLElement | null>;
|
|
18
18
|
static readonly contextType: import('react').Context<import('./ScreenTransitionLayer').ScreenTransitionLayer>;
|
|
19
19
|
context: React.ContextType<typeof ScreenTransitionLayerContext>;
|
|
20
20
|
index: number;
|
|
21
21
|
exiting: boolean;
|
|
22
22
|
state: ScreenTransitionProviderState;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
23
|
+
private onroutertransitionend;
|
|
24
|
+
private onroutertransitionstart;
|
|
25
25
|
componentDidMount(): void;
|
|
26
26
|
componentWillUnmount(): void;
|
|
27
27
|
get animationEffect(): AnimationEffect | null;
|
|
28
28
|
setZIndex(zIndex: React.CSSProperties['zIndex']): Promise<void>;
|
|
29
|
-
render(): JSX.Element;
|
|
29
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
package/build/SharedElement.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { SharedElementTransitionType, StyleKeyList } from './common/types';
|
|
|
3
3
|
import { SharedElementSceneContext } from './SharedElementSceneContext';
|
|
4
4
|
interface SharedElementConfig extends OptionalEffectTiming {
|
|
5
5
|
type?: SharedElementTransitionType;
|
|
6
|
-
transformOrigin?: React.CSSProperties[
|
|
6
|
+
transformOrigin?: React.CSSProperties['transformOrigin'];
|
|
7
7
|
styles?: StyleKeyList;
|
|
8
8
|
deepClone?: boolean;
|
|
9
9
|
}
|
|
@@ -13,10 +13,8 @@ interface SharedElementProps {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
config?: SharedElementConfig;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare class SharedElement extends Component<SharedElementProps, SharedElementState> {
|
|
19
|
-
readonly ref: import('react').RefObject<HTMLDivElement>;
|
|
16
|
+
export declare class SharedElement extends Component<SharedElementProps> {
|
|
17
|
+
readonly ref: import('react').RefObject<HTMLDivElement | null>;
|
|
20
18
|
static readonly contextType: import('react').Context<import('./SharedElementScene').SharedElementScene>;
|
|
21
19
|
context: React.ContextType<typeof SharedElementSceneContext>;
|
|
22
20
|
componentDidMount(): void;
|
|
@@ -31,6 +29,6 @@ export declare class SharedElement extends Component<SharedElementProps, SharedE
|
|
|
31
29
|
clone(): HTMLElement | null;
|
|
32
30
|
hide(): void;
|
|
33
31
|
unhide(): void;
|
|
34
|
-
render(): JSX.Element;
|
|
32
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
35
33
|
}
|
|
36
34
|
export {};
|
|
@@ -12,7 +12,7 @@ interface SharedElementTransitionLayerState {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class SharedElementTransitionLayer extends Component<SharedElementTransitionLayerProps, SharedElementTransitionLayerState> {
|
|
14
14
|
#private;
|
|
15
|
-
readonly ref: RefObject<HTMLDialogElement>;
|
|
15
|
+
readonly ref: RefObject<HTMLDialogElement | null>;
|
|
16
16
|
state: SharedElementTransitionLayerState;
|
|
17
17
|
set outgoingScreen(outgoingScreen: RefObject<ScreenBase> | null);
|
|
18
18
|
set incomingScreen(incomingScreen: RefObject<ScreenBase> | null);
|
|
@@ -26,6 +26,6 @@ export declare class SharedElementTransitionLayer extends Component<SharedElemen
|
|
|
26
26
|
rect: DOMRect;
|
|
27
27
|
}>(start: T, end: T): ParallelEffect;
|
|
28
28
|
get animationEffect(): ParallelEffect | null;
|
|
29
|
-
render(): JSX.Element;
|
|
29
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NavigationBase } from '../../NavigationBase';
|
|
3
|
+
import { RouterBase, RouterBaseProps } from '../../RouterBase';
|
|
4
|
+
import { NestedRouterContext } from '../../RouterContext';
|
|
5
|
+
import { ScreenBase } from '../../ScreenBase';
|
|
6
|
+
export declare class TestNavigation extends NavigationBase {
|
|
7
|
+
}
|
|
8
|
+
export declare class TestRouter extends RouterBase {
|
|
9
|
+
navigation: TestNavigation;
|
|
10
|
+
state: {
|
|
11
|
+
screens: RouterBase["screens"];
|
|
12
|
+
};
|
|
13
|
+
constructor(props: RouterBaseProps, context: React.ContextType<typeof NestedRouterContext>);
|
|
14
|
+
protected canIntercept(): boolean;
|
|
15
|
+
protected shouldIntercept(): boolean;
|
|
16
|
+
protected get screens(): React.CElement<import('../../ScreenBase').ScreenBaseProps, ScreenBase<import('../../ScreenBase').ScreenBaseProps, import('../../ScreenBase').ScreenBaseState<import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject>, import('../..').RoutePropBase<import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject<any>>>> | React.CElement<import('../../ScreenBase').ScreenBaseProps, ScreenBase<import('../../ScreenBase').ScreenBaseProps, import('../../ScreenBase').ScreenBaseState<import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject>, import('../..').RoutePropBase<import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject<any>>>>[];
|
|
17
|
+
protected intercept(e: NavigateEvent): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class TestScreen extends ScreenBase {
|
|
20
|
+
get id(): string;
|
|
21
|
+
get params(): import('../..').PlainObject;
|
|
22
|
+
get config(): import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase>;
|
|
23
|
+
get resolvedPathname(): string;
|
|
24
|
+
protected get routeProp(): {
|
|
25
|
+
config: import('../../ScreenBase').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase>;
|
|
26
|
+
params: import('../..').PlainObject;
|
|
27
|
+
focused: boolean;
|
|
28
|
+
path: string;
|
|
29
|
+
resolvedPathname: string;
|
|
30
|
+
setConfig(): void;
|
|
31
|
+
setParams(): void;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,3 +3,7 @@ export declare const MAX_PROGRESS = 100;
|
|
|
3
3
|
export declare const MIN_PROGRESS = 0;
|
|
4
4
|
export declare const MIN_NORM_PROGRESS = 0;
|
|
5
5
|
export declare const MAX_NORM_PROGRESS = 1;
|
|
6
|
+
export declare const LAST_INDEX = -1;
|
|
7
|
+
export declare const FIRST_INDEX = 0;
|
|
8
|
+
export declare const SINGLE_ELEMENT_LENGTH = 1;
|
|
9
|
+
export declare const EMPTY_COLLECTION_LENGTH = 0;
|
package/build/common/events.d.ts
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
import { LoadNavigationTransition } from './types';
|
|
2
|
-
export declare class TransitionStartEvent extends Event {
|
|
3
|
-
constructor();
|
|
4
|
-
}
|
|
5
|
-
export declare class TransitionCancelEvent extends Event {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
8
|
-
export declare class TransitionEndEvent extends Event {
|
|
9
|
-
constructor();
|
|
10
|
-
}
|
|
11
|
-
export declare class MotionProgressStartEvent extends Event {
|
|
12
|
-
constructor();
|
|
13
|
-
}
|
|
14
|
-
export declare class MotionProgressEndEvent extends Event {
|
|
15
|
-
constructor();
|
|
16
|
-
}
|
|
17
2
|
export declare class LoadEvent extends Event implements Omit<NavigateEvent, 'navigationType' | 'commit'> {
|
|
18
3
|
#private;
|
|
19
4
|
readonly hasUAVisualTransition = false;
|
|
20
|
-
constructor(
|
|
5
|
+
constructor(navigationType: 'load' | 'preload', loadEventInitDict?: {
|
|
6
|
+
destination?: NavigationDestination | null;
|
|
7
|
+
});
|
|
21
8
|
intercept(options?: NavigationInterceptOptions | undefined): void;
|
|
22
9
|
scroll(): void;
|
|
23
|
-
get transition(): LoadNavigationTransition
|
|
24
|
-
get navigationType(): "load";
|
|
10
|
+
get transition(): LoadNavigationTransition;
|
|
11
|
+
get navigationType(): "load" | "preload";
|
|
25
12
|
get userInitiated(): boolean;
|
|
26
13
|
get canIntercept(): boolean;
|
|
27
14
|
get hashChange(): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function useRerender(): CSSNumberish | null;
|
|
2
|
+
export declare function useRerenderCallback<T extends () => unknown>(callback: T): void;
|
|
3
|
+
export declare function triggerRerender(): void;
|
|
4
|
+
export declare function createHistoryEntry(url: string, index: number): NavigationHistoryEntry;
|
|
5
|
+
export declare function assertNavigationAvailable(): void;
|
|
6
|
+
export declare function waitForNavigateSuccess(): Promise<void>;
|
|
7
|
+
export declare function navTo(url: string): Promise<void>;
|
|
8
|
+
export declare function traverseTo(key: string): Promise<void>;
|
|
9
|
+
export declare function traverseToStart(): Promise<void>;
|
|
10
|
+
export declare function seedHistory(): Promise<void>;
|
|
11
|
+
export declare function installInterceptor(): Promise<void>;
|
|
12
|
+
export declare function uninstallInterceptor(): Promise<void>;
|
package/build/common/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ScreenBase, ScreenBaseProps } from '../ScreenBase';
|
|
2
|
-
import { MotionProgressEndEvent, MotionProgressEvent, MotionProgressStartEvent, TransitionCancelEvent, TransitionEndEvent, TransitionStartEvent } from './events';
|
|
3
2
|
import { SharedElement } from '../SharedElement';
|
|
4
3
|
import { StandardPropertiesHyphen } from 'csstype';
|
|
5
4
|
export type ScreenChild<E extends ScreenBase = ScreenBase> = E extends ScreenBase<infer P> ? React.CElement<P, E> : never;
|
|
@@ -14,9 +13,8 @@ export interface AnimationEffectFactoryProps<R extends HTMLElement = HTMLElement
|
|
|
14
13
|
hasUAVisualTransition: boolean;
|
|
15
14
|
}
|
|
16
15
|
export type AnimationEffectFactory<R extends HTMLElement = HTMLElement> = (props: AnimationEffectFactoryProps<R>) => AnimationEffect;
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type MetaKey = `${MetaTypeKey}=${string}`;
|
|
16
|
+
export type MetaType = [string, string];
|
|
17
|
+
export type MetaKey = `${string}=${string}`;
|
|
20
18
|
export interface LazyExoticComponent<T extends React.ComponentType<any>> extends React.LazyExoticComponent<T> {
|
|
21
19
|
load: () => Promise<{
|
|
22
20
|
default: T;
|
|
@@ -39,18 +37,22 @@ export declare function isValidScreenChild<S extends ScreenBase>(value: any): va
|
|
|
39
37
|
export type PlainObject<T = any> = {
|
|
40
38
|
[key: string]: T;
|
|
41
39
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'motion-progress-end': MotionProgressEndEvent;
|
|
40
|
+
declare global {
|
|
41
|
+
interface HTMLElementEventMap {
|
|
42
|
+
'routertransitionstart': TransitionEvent;
|
|
43
|
+
'routertransitioncancel': TransitionEvent;
|
|
44
|
+
'routertransitionend': TransitionEvent;
|
|
45
|
+
}
|
|
49
46
|
}
|
|
50
|
-
export type
|
|
51
|
-
|
|
47
|
+
export type EventHandler = {
|
|
48
|
+
[K in keyof HTMLElementEventMap as `on${K}`]?: (e: HTMLElementEventMap[K]) => void;
|
|
49
|
+
} & {
|
|
50
|
+
handleEvent: (e: Event) => void;
|
|
51
|
+
};
|
|
52
|
+
export type RouterBaseHTMLElement<T extends HTMLElement = HTMLDivElement> = T & {
|
|
53
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
52
54
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
53
|
-
removeEventListener<K extends keyof
|
|
55
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
54
56
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
55
57
|
};
|
|
56
58
|
export type CustomElementType = `${string}-${string}`;
|
|
@@ -83,7 +85,7 @@ export type StylableElement = Element & {
|
|
|
83
85
|
};
|
|
84
86
|
export declare function isStylableElement(element: any): element is StylableElement;
|
|
85
87
|
export interface LoadNavigationTransition extends Omit<NavigationTransition, 'navigationType'> {
|
|
86
|
-
navigationType: 'load';
|
|
88
|
+
navigationType: 'load' | 'preload';
|
|
87
89
|
}
|
|
88
90
|
declare global {
|
|
89
91
|
interface NavigateEvent extends Event {
|
package/build/common/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ClonedElementType, ElementPropType, LazyExoticComponent, MatchedRoute
|
|
1
|
+
import { ClonedElementType, ElementPropType, LazyExoticComponent, MatchedRoute } from './types';
|
|
2
2
|
export declare function resolveBaseURLFromPattern(pattern: string, pathname: string): URL | null;
|
|
3
3
|
export declare function matchRoute(pathnamePattern: string, pathname: string, baseURLPattern?: string, caseSensitive?: boolean): MatchedRoute | null;
|
|
4
|
-
export declare function includesRoute(pathnamePatterns: PathPattern[], pathname: string, baseURL?: string): boolean;
|
|
5
4
|
export declare function dispatchEvent<T>(event: CustomEvent<T> | Event, target?: HTMLElement | EventTarget): Promise<boolean>;
|
|
6
5
|
export declare function lazy<T extends React.ComponentType<any>>(factory: () => Promise<{
|
|
7
6
|
default: T;
|
|
@@ -10,6 +9,8 @@ export declare function isNavigationSupported(): boolean;
|
|
|
10
9
|
export declare function isURLPatternSupported(): boolean;
|
|
11
10
|
export declare function polyfillURLPattern(): Promise<void>;
|
|
12
11
|
export declare function polyfillNavigation(): Promise<void>;
|
|
13
|
-
export declare function
|
|
12
|
+
export declare function PromiseAllSequential<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
|
|
14
13
|
export declare function toCamelCase(value: string): string;
|
|
15
14
|
export declare function cloneAndInject<C extends React.CElement<any, any>, IP extends Partial<ElementPropType<C>>>(element: C, injectProps: IP): ClonedElementType<C, IP>;
|
|
15
|
+
export declare function omit<T extends object, K extends readonly (keyof T)[]>(obj: T, keys: K): Omit<T, K[number]>;
|
|
16
|
+
export declare function historyEntryFromDestination(destination: NavigationDestination): NavigationHistoryEntry;
|
package/build/index.d.ts
CHANGED
|
@@ -7,4 +7,9 @@ export * from './common/hooks';
|
|
|
7
7
|
export * from './common/types';
|
|
8
8
|
export * from './common/events';
|
|
9
9
|
export * from './common/utils';
|
|
10
|
+
export * from './common/test-utils';
|
|
11
|
+
export * from './common/promise-wrapper';
|
|
10
12
|
export * from './common/constants';
|
|
13
|
+
export * from './Anchor';
|
|
14
|
+
export * from './RouterContext';
|
|
15
|
+
export * from './RoutePropContext';
|