Skip to content

Commit

Permalink
Merge branch 'main' into chore/fix-dts
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin authored Nov 4, 2024
2 parents 41906c6 + 7a889a9 commit ce3bfcf
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 60 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

# Vaadin Router

[Demo](https://vaadin.github.io/router/vaadin-router/demo)
·
[API documentation](https://vaadin.github.io/router/vaadin-router/)
[API documentation](https://vaadin.github.io/router/)

Vaadin Router is a small and powerful client-side router JS library. It uses the widely adopted express.js syntax for routes (`/users/:id`) to map URLs to Web Component views. All features one might expect from a modern router are supported: async route resolution, animated transitions, navigation guards, redirects, and more. It is framework-agnostic and works equally well with all Web Components regardless of how they are created (Polymer / SkateJS / Stencil / Angular / Vue / etc).

Expand Down
87 changes: 31 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"prettier": "^3.1.0",
"sinon": "^19.0.2",
"sinon-chai": "^4.0.0",
"stylelint": "^16.9.0",
"stylelint": "^16.10.0",
"tsx": "^4.19.1",
"typedoc": "^0.26.8",
"typedoc-plugin-missing-exports": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './router.js';
export type * from './types.t.js';
export type * from './v1-compat.js';
export {
processNewChildren,
amend,
Expand Down
84 changes: 84 additions & 0 deletions src/v1-compat.d.ts
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']>;
}

0 comments on commit ce3bfcf

Please sign in to comment.