-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add route v1 compatibility type definitions (#895)
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
|
||
import type { MaybePromise } from './resolver/types'; | ||
import type { RouteContext, Route, ActionResult, ChildrenCallback, WebComponentInterface } from './types'; | ||
|
||
/** | ||
* Action result describing an HTML element to render. | ||
* | ||
* @deprecated Use `HTMLElement`. | ||
*/ | ||
export type ComponentResult = HTMLElement; | ||
|
||
/** | ||
* Route resolution context object, see {@link RouteContext}. | ||
* | ||
* @deprecated Use {@link RouteContext}. | ||
*/ | ||
export type Context = RouteContext; | ||
|
||
/** | ||
* Route action callback function, see {@link Route.action}. | ||
* | ||
* @deprecated Use `NonNullable<Route['action']>`. | ||
*/ | ||
export type ActionFn = ( | ||
this: Route, | ||
context: RouteContext, | ||
commands: Commands, | ||
) => MaybePromise<ActionResult | RouteContext>; | ||
|
||
/** | ||
* Route children callback function, see {@link ChildrenCallback}. | ||
* | ||
* @deprecated Use {@link ChildrenCallback}. | ||
*/ | ||
export type ChildrenFn = ChildrenCallback; | ||
|
||
/** | ||
* Web component route interface with {@link onBeforeEnter} callback. | ||
* | ||
* @deprecated Use {@link WebComponentInterface}. | ||
*/ | ||
export interface BeforeEnterObserver { | ||
/** | ||
* See {@link WebComponentInterface.onBeforeEnter} | ||
*/ | ||
onBeforeEnter: NonNullable<WebComponentInterface['onBeforeEnter']>; | ||
} | ||
|
||
/** | ||
* Web component route interface with {@link onBeforeLeave} callback. | ||
* | ||
* @deprecated Use {@link WebComponentInterface}. | ||
*/ | ||
export interface BeforeLeaveObserver { | ||
/** | ||
* See {@link WebComponentInterface.onBeforeLeave} | ||
*/ | ||
onBeforeLeave: NonNullable<WebComponentInterface['onBeforeLeave']>; | ||
} | ||
|
||
/** | ||
* Web component route interface with {@link onAfterEnter} callback. | ||
* | ||
* @deprecated Use {@link WebComponentInterface}. | ||
*/ | ||
export interface AfterEnterObserver { | ||
/** | ||
* See {@link WebComponentInterface.onAfterEnter} | ||
*/ | ||
onAfterEnter: NonNullable<WebComponentInterface['onAfterEnter']>; | ||
} | ||
|
||
/** | ||
* Web component route interface with {@link onAfterLeave} callback. | ||
* | ||
* @deprecated Use {@link WebComponentInterface}. | ||
*/ | ||
export interface AfterLeaveObserver { | ||
/** | ||
* See {@link WebComponentInterface.onAfterLeave} | ||
*/ | ||
onAfterLeave: NonNullable<WebComponentInterface['onAfterLeave']>; | ||
} |