UNPKG

@react-motion-router/core

Version:

Declarative routing library for ReactJS ⚛ with animations baked in ⏮

44 lines (43 loc) 2.28 kB
/// <reference types="react" /> import RouterData from "../RouterData"; import { LazyExoticComponent, PlainObject, SearchParamsDeserializer, SearchParamsSerializer } from "./types"; export declare function getCSSData(styles: CSSStyleDeclaration, exclude?: string[], object?: boolean): [string, PlainObject<string>]; export declare function getStyleObject(styles: CSSStyleDeclaration, exclude?: string[]): PlainObject<string>; export declare function clamp(num: number, min: number, max?: number): number; export interface MatchedRoute { matchedPathname?: string; rest?: string; exact: boolean; } export declare function matchRoute(routeTest: string | undefined, route: string | undefined, baseURL?: string): MatchedRoute | null; export declare function includesRoute(routeString: string | undefined, routeTests: (string | undefined)[], baseURL?: string): boolean; export declare function dispatchEvent<T>(event: CustomEvent<T> | Event, target?: HTMLElement | EventTarget): Promise<boolean>; export declare function concatenateURL(path: string | URL, base: string | URL): URL; export declare function defaultSearchParamsToObject(searchPart: string): PlainObject<string> | undefined; export declare function searchParamsToObject(searchPart: string, paramsDeserializer: SearchParamsDeserializer | null): PlainObject<any>; export declare function searchParamsFromObject(params: { [key: string]: any; }, paramsSerializer: SearchParamsSerializer | null): string; export declare function lazy<T extends React.ComponentType<any>>(factory: () => Promise<{ default: T; }>): LazyExoticComponent<T>; /** * Searches router data tree for matching screen. Once the screen is found * its component is preloaded. * @param path * @param routerData * @returns */ export declare function prefetchRoute(path: string, routerData: RouterData): Promise<boolean>; export declare function getAnimationDuration(animation: Animation | null, defaultDuration?: number): number; export declare const DEFAULT_ANIMATION: { readonly in: { readonly type: "none"; readonly duration: 0; }; readonly out: { readonly type: "none"; readonly duration: 0; }; }; export declare const MAX_Z_INDEX = 2147483647;