@react-motion-router/core 2.0.0-beta.sha-8be3578 → 2.0.0-beta.sha-7188e1e
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 +8 -6
- package/build/NavigationBase.d.ts +4 -5
- package/build/RoutePropContext.d.ts +1 -1
- package/build/RouterBase.d.ts +11 -8
- package/build/ScreenBase.d.ts +7 -6
- package/build/ScreenTransitionLayer.d.ts +0 -1
- package/build/ScreenTransitionProvider.d.ts +12 -27
- package/build/ViewTransitionSharedElement.d.ts +15 -0
- package/build/__tests__/Anchor/common/constants.d.ts +1 -0
- package/build/__tests__/common/utils.d.ts +8 -3
- package/build/common/events.d.ts +1 -1
- package/build/common/test-utils.d.ts +4 -2
- package/build/common/types.d.ts +9 -11
- package/build/common/utils.d.ts +1 -1
- package/build/index.js +609 -674
- package/build/index.js.map +1 -1
- package/package.json +3 -3
package/build/Anchor.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { default as React, RefObject } from 'react';
|
|
2
|
+
import { EventHandler } from './common/types';
|
|
2
3
|
type AnchorState = {
|
|
3
4
|
href?: string | null;
|
|
4
5
|
};
|
|
5
6
|
interface AnchorBaseProps extends Omit<AnchorProps, 'ref'> {
|
|
6
7
|
ref?: RefObject<AnchorBase | null>;
|
|
7
8
|
}
|
|
8
|
-
export declare class AnchorBase extends React.Component<AnchorBaseProps, AnchorState> {
|
|
9
|
+
export declare class AnchorBase extends React.Component<AnchorBaseProps, AnchorState> implements EventHandler {
|
|
9
10
|
constructor(props: AnchorBaseProps);
|
|
10
11
|
readonly anchorRef: React.RefObject<HTMLAnchorElement | null>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
static directionFromRel(rel: string | undefined): "next" | "prev";
|
|
13
|
+
static findClosestEntryByHref(href: string, rel: string | undefined, entries: NavigationHistoryEntry[], index: number): NavigationHistoryEntry | undefined;
|
|
14
|
+
static findClosestEntry(rel: string | undefined, entries: NavigationHistoryEntry[], index: number): NavigationHistoryEntry;
|
|
14
15
|
componentDidMount(): void;
|
|
15
16
|
componentWillUnmount(): void;
|
|
16
|
-
|
|
17
|
+
handleEvent(e: Event): void;
|
|
18
|
+
onnavigatesuccess(): void;
|
|
19
|
+
onclick(event: MouseEvent): void;
|
|
17
20
|
private get href();
|
|
18
21
|
private get search();
|
|
19
|
-
private readonly handleClick;
|
|
20
22
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
}
|
|
22
24
|
export interface AnchorProps extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { RouterBaseHTMLElement } from './common/types';
|
|
2
1
|
import { MetaData } from './MetaData';
|
|
3
2
|
export interface NavigationBaseConfig {
|
|
4
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
3
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
5
4
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
6
5
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
7
|
-
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
6
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
8
7
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
9
8
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
10
9
|
dispatchEvent(event: Event): Promise<boolean>;
|
|
@@ -18,12 +17,12 @@ export declare abstract class NavigationBase {
|
|
|
18
17
|
private static rootNavigatorRef;
|
|
19
18
|
readonly metaData: MetaData;
|
|
20
19
|
readonly addEventListener: {
|
|
21
|
-
<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
20
|
+
<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
22
21
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
23
22
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
24
23
|
};
|
|
25
24
|
readonly removeEventListener: {
|
|
26
|
-
<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
25
|
+
<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
27
26
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
28
27
|
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
29
28
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RoutePropBase } from './common/types';
|
|
2
|
-
export declare const RoutePropContext: import('react').Context<RoutePropBase<{}, import('
|
|
2
|
+
export declare const RoutePropContext: import('react').Context<RoutePropBase<{}, import('.').PlainObject<any>>>;
|
package/build/RouterBase.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { NavigationBase } from './NavigationBase';
|
|
2
2
|
import { ScreenTransitionLayer } from './ScreenTransitionLayer';
|
|
3
|
-
import { ScreenChild,
|
|
3
|
+
import { ScreenChild, EventHandler } from './common/types';
|
|
4
4
|
import { NestedRouterContext } from './RouterContext';
|
|
5
|
-
import { Component } from 'react';
|
|
5
|
+
import { Component, RefObject } from 'react';
|
|
6
6
|
import { ScreenBase, ScreenBaseConfig } from './ScreenBase';
|
|
7
|
+
import { LoadEvent } from './common/events';
|
|
7
8
|
type ScreenType<T> = T extends ScreenChild<infer S> | ScreenChild<infer S>[] ? S : never;
|
|
8
9
|
export interface RouterBaseConfig {
|
|
9
10
|
screenConfig?: ScreenBaseConfig;
|
|
@@ -17,12 +18,11 @@ export interface RouterBaseProps<S extends ScreenBase = ScreenBase> {
|
|
|
17
18
|
export type RouterBaseState = object;
|
|
18
19
|
export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseProps, S extends RouterBaseState = RouterBaseState> extends Component<P, S> implements EventHandler {
|
|
19
20
|
#private;
|
|
20
|
-
protected readonly ref:
|
|
21
|
-
protected screenTransitionLayer:
|
|
21
|
+
protected abstract readonly ref: RefObject<HTMLElement | null>;
|
|
22
|
+
protected screenTransitionLayer: RefObject<ScreenTransitionLayer | null>;
|
|
22
23
|
abstract readonly navigation: NavigationBase;
|
|
23
24
|
readonly parent: RouterBase | null;
|
|
24
25
|
private loadDispatched;
|
|
25
|
-
private hasUAVisualTransition;
|
|
26
26
|
readonly parentScreen: ScreenBase | null;
|
|
27
27
|
private static rootRouterRef;
|
|
28
28
|
static readonly contextType: import('react').Context<{
|
|
@@ -34,20 +34,23 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
|
|
|
34
34
|
private static get events();
|
|
35
35
|
componentDidMount(): void;
|
|
36
36
|
componentWillUnmount(): void;
|
|
37
|
+
interceptHandler: () => Promise<void>;
|
|
37
38
|
onnavigate(e: NavigateEvent): void;
|
|
38
39
|
getRouterById(routerId: string, target?: RouterBase): RouterBase | null;
|
|
39
40
|
dispatchEvent(event: Event): Promise<boolean>;
|
|
40
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
41
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
41
42
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
42
|
-
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this:
|
|
43
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
43
44
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
44
45
|
handleEvent(e: Event): void;
|
|
45
46
|
protected screenChildFromPathname(pathname: string): {
|
|
46
47
|
child: ScreenChild<ScreenType<P["children"]>>;
|
|
47
|
-
matchInfo: import('
|
|
48
|
+
matchInfo: import('.').MatchedRoute;
|
|
48
49
|
} | null;
|
|
49
50
|
protected preloadScreen(screen: ScreenChild): Promise<void>;
|
|
50
51
|
includesRoute(pathname: string, baseURLPattern?: string): boolean;
|
|
52
|
+
get activeEvent(): LoadEvent | NavigateEvent | null;
|
|
53
|
+
get hasUAVisualTransition(): boolean;
|
|
51
54
|
get id(): string;
|
|
52
55
|
get isRoot(): boolean;
|
|
53
56
|
get baseURL(): URL;
|
package/build/ScreenBase.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, RefObject } from 'react';
|
|
2
2
|
import { ScreenTransitionProvider } from './ScreenTransitionProvider';
|
|
3
|
-
import { AnimationEffectFactory, LazyExoticComponent, PlainObject, RoutePropBase } from './common/types';
|
|
3
|
+
import { AnimationEffectFactory, EventHandler, LazyExoticComponent, PlainObject, RoutePropBase } from './common/types';
|
|
4
4
|
import { RouterContext } from './RouterContext';
|
|
5
5
|
import { NavigationBase } from './NavigationBase';
|
|
6
6
|
import { SharedElementScene } from './SharedElementScene';
|
|
@@ -46,12 +46,11 @@ export interface ScreenBaseState<C extends ScreenBaseProps['config'] = ScreenBas
|
|
|
46
46
|
focused: boolean;
|
|
47
47
|
config: C;
|
|
48
48
|
params: P;
|
|
49
|
-
elementType: ElementType;
|
|
50
49
|
}
|
|
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> {
|
|
50
|
+
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> implements EventHandler {
|
|
52
51
|
#private;
|
|
53
52
|
readonly sharedElementScene: SharedElementScene;
|
|
54
|
-
protected readonly ref:
|
|
53
|
+
protected abstract readonly ref: RefObject<HTMLElement | null>;
|
|
55
54
|
protected readonly nestedRouterData: {
|
|
56
55
|
parentScreen: ScreenBase;
|
|
57
56
|
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>;
|
|
@@ -60,6 +59,7 @@ export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseP
|
|
|
60
59
|
context: React.ContextType<typeof RouterContext>;
|
|
61
60
|
state: S;
|
|
62
61
|
constructor(props: P, context: React.ContextType<typeof RouterContext>);
|
|
62
|
+
handleEvent(e: Event): void;
|
|
63
63
|
protected setParams(newParams: PlainObject): void;
|
|
64
64
|
protected setConfig(newConfig: R['config']): void;
|
|
65
65
|
get focused(): boolean;
|
|
@@ -74,11 +74,12 @@ export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseP
|
|
|
74
74
|
abstract get params(): R['params'];
|
|
75
75
|
abstract get resolvedPathname(): string;
|
|
76
76
|
abstract get id(): string;
|
|
77
|
+
abstract get viewTransitionName(): string;
|
|
77
78
|
onExited(signal: AbortSignal): Promise<void>;
|
|
78
79
|
onExit(signal: AbortSignal): Promise<void>;
|
|
79
80
|
onEnter(signal: AbortSignal): Promise<void>;
|
|
80
81
|
onEntered(signal: AbortSignal): Promise<void>;
|
|
81
82
|
get path(): P["path"];
|
|
82
|
-
get transitionProvider():
|
|
83
|
+
get transitionProvider(): RefObject<ScreenTransitionProvider | null>;
|
|
83
84
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
84
85
|
}
|
|
@@ -5,7 +5,6 @@ import { ScreenChild } from './common/types';
|
|
|
5
5
|
import { NavigationBase } from './NavigationBase';
|
|
6
6
|
import { ScreenBase } from './ScreenBase';
|
|
7
7
|
interface ScreenTransitionLayerProps {
|
|
8
|
-
id: string;
|
|
9
8
|
children: ScreenChild | ScreenChild[];
|
|
10
9
|
navigation: NavigationBase;
|
|
11
10
|
hasUAVisualTransition: boolean;
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import { ScreenTransitionLayerContext } from './ScreenTransitionLayerContext';
|
|
2
1
|
import { AnimationEffectFactory } from './common/types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
interface ScreenTransitionProviderProps {
|
|
6
|
-
id: string;
|
|
7
|
-
animation?: AnimationEffectFactory;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
navigation: NavigationBase;
|
|
10
|
-
renderAs: ElementType;
|
|
11
|
-
focused: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface ScreenTransitionProviderState {
|
|
14
|
-
zIndex: React.CSSProperties['zIndex'];
|
|
15
|
-
}
|
|
16
|
-
export declare class ScreenTransitionProvider extends Component<ScreenTransitionProviderProps, ScreenTransitionProviderState> {
|
|
17
|
-
readonly ref: import('react').RefObject<HTMLElement | null>;
|
|
18
|
-
static readonly contextType: import('react').Context<import('./ScreenTransitionLayer').ScreenTransitionLayer>;
|
|
19
|
-
context: React.ContextType<typeof ScreenTransitionLayerContext>;
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
export interface ScreenTransitionProvider {
|
|
20
4
|
index: number;
|
|
21
5
|
exiting: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
readonly animationEffect: AnimationEffect | null;
|
|
7
|
+
readonly screenElementRef: RefObject<HTMLElement | null>;
|
|
8
|
+
}
|
|
9
|
+
export interface ScreenTransitionProviderProps {
|
|
10
|
+
viewTransitionName: string;
|
|
11
|
+
animation?: AnimationEffectFactory;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
screenElementRef: RefObject<HTMLElement | null>;
|
|
14
|
+
ref?: RefObject<ScreenTransitionProvider | null>;
|
|
30
15
|
}
|
|
31
|
-
export
|
|
16
|
+
export declare function ScreenTransitionProvider(props: ScreenTransitionProviderProps): import('react').ReactNode;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SharedElementTransitionType } from './common/types';
|
|
3
|
+
type SharedElement = {
|
|
4
|
+
[T in keyof React.JSX.IntrinsicElements]: ReturnType<typeof createSharedElement<T>>;
|
|
5
|
+
};
|
|
6
|
+
interface SharedElementConfig extends OptionalEffectTiming {
|
|
7
|
+
type?: SharedElementTransitionType;
|
|
8
|
+
}
|
|
9
|
+
interface SharedElementProps {
|
|
10
|
+
id: string;
|
|
11
|
+
config?: SharedElementConfig;
|
|
12
|
+
}
|
|
13
|
+
export declare const createSharedElement: <T extends keyof React.JSX.IntrinsicElements>(tag: T) => ({ ref: forwardedRef, ...props }: React.JSX.IntrinsicElements[T] & SharedElementProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const SharedElement: SharedElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SECOND_INDEX = 1;
|
|
@@ -6,6 +6,7 @@ import { ScreenBase } from '../../ScreenBase';
|
|
|
6
6
|
export declare class TestNavigation extends NavigationBase {
|
|
7
7
|
}
|
|
8
8
|
export declare class TestRouter extends RouterBase {
|
|
9
|
+
protected ref: React.RefObject<HTMLDivElement | null>;
|
|
9
10
|
navigation: TestNavigation;
|
|
10
11
|
state: {
|
|
11
12
|
screens: RouterBase["screens"];
|
|
@@ -13,16 +14,19 @@ export declare class TestRouter extends RouterBase {
|
|
|
13
14
|
constructor(props: RouterBaseProps, context: React.ContextType<typeof NestedRouterContext>);
|
|
14
15
|
protected canIntercept(): boolean;
|
|
15
16
|
protected shouldIntercept(): boolean;
|
|
16
|
-
protected get screens(): React.CElement<import('
|
|
17
|
+
protected get screens(): React.CElement<import('../..').ScreenBaseProps, ScreenBase<import('../..').ScreenBaseProps, import('../..').ScreenBaseState<import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject>, import('../..').RoutePropBase<import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject<any>>>> | React.CElement<import('../..').ScreenBaseProps, ScreenBase<import('../..').ScreenBaseProps, import('../..').ScreenBaseState<import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject>, import('../..').RoutePropBase<import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase> | undefined, import('../..').PlainObject<any>>>>[];
|
|
17
18
|
protected intercept(e: NavigateEvent): void;
|
|
19
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
}
|
|
19
21
|
export declare class TestScreen extends ScreenBase {
|
|
22
|
+
protected ref: React.RefObject<HTMLDivElement | null>;
|
|
20
23
|
get id(): string;
|
|
21
24
|
get params(): import('../..').PlainObject;
|
|
22
|
-
get config(): import('
|
|
25
|
+
get config(): import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase>;
|
|
23
26
|
get resolvedPathname(): string;
|
|
27
|
+
get viewTransitionName(): string;
|
|
24
28
|
protected get routeProp(): {
|
|
25
|
-
config: import('
|
|
29
|
+
config: import('../..').ScreenBaseConfig<import('../..').RoutePropBase<{}, import('../..').PlainObject<any>>, NavigationBase>;
|
|
26
30
|
params: import('../..').PlainObject;
|
|
27
31
|
focused: boolean;
|
|
28
32
|
path: string;
|
|
@@ -30,4 +34,5 @@ export declare class TestScreen extends ScreenBase {
|
|
|
30
34
|
setConfig(): void;
|
|
31
35
|
setParams(): void;
|
|
32
36
|
};
|
|
37
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
33
38
|
}
|
package/build/common/events.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoadNavigationTransition } from './types';
|
|
2
|
-
export declare class LoadEvent extends Event implements Omit<NavigateEvent, 'navigationType'
|
|
2
|
+
export declare class LoadEvent extends Event implements Omit<NavigateEvent, 'navigationType'> {
|
|
3
3
|
#private;
|
|
4
4
|
readonly hasUAVisualTransition = false;
|
|
5
5
|
constructor(navigationType: 'load' | 'preload', loadEventInitDict?: {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { LoadEvent } from './events';
|
|
1
2
|
export declare function useRerender(): CSSNumberish | null;
|
|
2
3
|
export declare function useRerenderCallback<T extends () => unknown>(callback: T): void;
|
|
3
4
|
export declare function triggerRerender(): void;
|
|
4
5
|
export declare function createHistoryEntry(url: string, index: number): NavigationHistoryEntry;
|
|
5
6
|
export declare function assertNavigationAvailable(): void;
|
|
6
|
-
export declare function waitForNavigateSuccess(): Promise<
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function waitForNavigateSuccess(): Promise<unknown>;
|
|
8
|
+
export declare function waitForNavigation(type: NavigateEvent['navigationType'] | LoadEvent['navigationType']): Promise<unknown>;
|
|
9
|
+
export declare function navTo(url: string, history?: NavigationNavigateOptions['history']): Promise<NavigationHistoryEntry>;
|
|
8
10
|
export declare function traverseTo(key: string): Promise<void>;
|
|
9
11
|
export declare function traverseToStart(): Promise<void>;
|
|
10
12
|
export declare function seedHistory(): Promise<void>;
|
package/build/common/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { StandardPropertiesHyphen } from 'csstype';
|
|
|
4
4
|
export type ScreenChild<E extends ScreenBase = ScreenBase> = E extends ScreenBase<infer P> ? React.CElement<P, E> : never;
|
|
5
5
|
export interface AnimationEffectFactoryProps<R extends HTMLElement = HTMLElement> {
|
|
6
6
|
ref: R | null;
|
|
7
|
+
viewTransitionName: string;
|
|
7
8
|
index: number;
|
|
8
9
|
screens: string[];
|
|
9
10
|
exiting: boolean;
|
|
@@ -43,18 +44,19 @@ declare global {
|
|
|
43
44
|
'routertransitioncancel': TransitionEvent;
|
|
44
45
|
'routertransitionend': TransitionEvent;
|
|
45
46
|
}
|
|
47
|
+
interface NavigationPrecommitController {
|
|
48
|
+
redirect(url: string, options?: NavigationNavigateOptions): void;
|
|
49
|
+
addHandler(handler: NavigationInterceptOptions['handler']): void;
|
|
50
|
+
}
|
|
51
|
+
interface NavigationInterceptOptions {
|
|
52
|
+
precommitHandler?(controller: NavigationPrecommitController): Promise<void>;
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
export type EventHandler = {
|
|
48
56
|
[K in keyof HTMLElementEventMap as `on${K}`]?: (e: HTMLElementEventMap[K]) => void;
|
|
49
57
|
} & {
|
|
50
58
|
handleEvent: (e: Event) => void;
|
|
51
59
|
};
|
|
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;
|
|
54
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
55
|
-
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
56
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
57
|
-
};
|
|
58
60
|
export type CustomElementType = `${string}-${string}`;
|
|
59
61
|
export interface MatchedRoute {
|
|
60
62
|
params: PlainObject<string | undefined>;
|
|
@@ -87,11 +89,7 @@ export declare function isStylableElement(element: any): element is StylableElem
|
|
|
87
89
|
export interface LoadNavigationTransition extends Omit<NavigationTransition, 'navigationType'> {
|
|
88
90
|
navigationType: 'load' | 'preload';
|
|
89
91
|
}
|
|
90
|
-
declare global {
|
|
91
|
-
interface NavigateEvent extends Event {
|
|
92
|
-
commit?(): void;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
92
|
export type ElementPropType<C> = C extends React.CElement<infer P, infer T> ? P & React.ClassAttributes<T> : never;
|
|
96
93
|
export type ClonedElementType<C, IP extends Partial<ElementPropType<C>>> = C extends React.CElement<infer P, infer T> ? React.CElement<P & Partial<IP>, T & React.Component<P & IP>> : never;
|
|
94
|
+
export type ElementForTag<T extends keyof JSX.IntrinsicElements> = T extends keyof (HTMLElementTagNameMap & SVGElementTagNameMap) ? (HTMLElementTagNameMap & SVGElementTagNameMap)[T] : HTMLElement;
|
|
97
95
|
export {};
|
package/build/common/utils.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export declare function PromiseAllSequential<T>(values: Iterable<T | PromiseLike
|
|
|
13
13
|
export declare function toCamelCase(value: string): string;
|
|
14
14
|
export declare function cloneAndInject<C extends React.CElement<any, any>, IP extends Partial<ElementPropType<C>>>(element: C, injectProps: IP): ClonedElementType<C, IP>;
|
|
15
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;
|
|
16
|
+
export declare function historyEntryFromDestination(destination: NavigationDestination, index?: number): NavigationHistoryEntry;
|