@react-motion-router/core 2.0.0-beta.sha-0daf7c7 → 2.0.0-beta.sha-b7e17f2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,5 @@ export declare abstract class NavigationBase<E extends RouterBaseEventMap = Rout
16
16
  get baseURL(): URL;
17
17
  get baseURLPattern(): URLPattern;
18
18
  getNavigatorById(routerId: string): NavigationBase<RouterBaseEventMap> | null;
19
- preloadRoute(path: string): Promise<boolean>;
20
19
  private get isInDocument();
21
20
  }
@@ -4,6 +4,7 @@ import { ScreenChild, RouterBaseEventMap, RouterHTMLElement } from './common/typ
4
4
  import { NestedRouterContext } from './RouterContext';
5
5
  import { Component } from 'react';
6
6
  import { ScreenBase, ScreenBaseConfig } from './ScreenBase';
7
+ type ScreenType<T> = T extends ScreenChild<infer S> | ScreenChild<infer S>[] ? S : never;
7
8
  export interface RouterBaseConfig {
8
9
  screenConfig?: ScreenBaseConfig;
9
10
  basePath?: string;
@@ -40,7 +41,11 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
40
41
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
41
42
  removeEventListener<K extends keyof E>(type: K, listener: (this: RouterHTMLElement<E>, ev: E[K]) => any, options?: boolean | EventListenerOptions | undefined): void;
42
43
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
43
- preloadRoute(pathname: string): Promise<boolean>;
44
+ protected screenChildFromPathname(pathname: string): {
45
+ child: ScreenChild<ScreenType<P["children"]>>;
46
+ matchInfo: import('./common/types').MatchedRoute;
47
+ } | null;
48
+ protected preloadScreen(screen: ScreenChild): Promise<void>;
44
49
  get id(): string;
45
50
  get isRoot(): boolean;
46
51
  get baseURL(): URL;
@@ -58,3 +63,4 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
58
63
  protected abstract get screens(): P["children"];
59
64
  render(): JSX.Element | undefined;
60
65
  }
66
+ export {};
@@ -8,9 +8,15 @@ export interface ScreenBaseComponentProps<R extends RoutePropBase = RoutePropBas
8
8
  route: R;
9
9
  navigation: N;
10
10
  }
11
- export interface LifecycleProps<R extends RoutePropBase, N extends NavigationBase = NavigationBase> extends ScreenBaseComponentProps<R, N> {
11
+ export type LifecycleProps<R extends RoutePropBase, N extends NavigationBase = NavigationBase> = ({
12
12
  signal: AbortSignal;
13
- }
13
+ preloading: false;
14
+ } & ScreenBaseComponentProps<R, N>) | ({
15
+ signal?: AbortSignal;
16
+ preloading: true;
17
+ } & Omit<ScreenBaseComponentProps<R, N>, 'route'> & {
18
+ route: Omit<ScreenBaseComponentProps<R, N>['route'], 'setParams' | 'setConfig'>;
19
+ });
14
20
  export interface ScreenBaseConfig<R extends RoutePropBase = RoutePropBase, N extends NavigationBase = NavigationBase> {
15
21
  header?: {
16
22
  fallback?: React.ReactNode;