Releases: vaadin/router
v2.0.0
With the v2 major release, Vaadin Router was entirely ported to TypeScript. We removed outdated code and features targeting MSIE 11, bower, and HTML imports, and updated the libraries and build tools we use. In addition, we introduced generic parameters on the router core types, which facilitates extendibility of the route definition on the user end.
New Features
- Generic route type support. The
Router
class supports route object extensions provided with a generic argument. This allows adding custom metadata directly on the route object with keeping consistent types:/** * Custom route metadata. */ type RouteMeta = Readonly<{ title: string; }>; const router = new Router<RouteMeta>(document.body); router.setRoutes([ { path: '', component: 'page-index', title: 'Index page', }, ]);
Breaking Changes
- Removing support for MS Internet Explorer.
- Support for
bundle
route key was removed. Now that using ES modules is common, for lazy loading of views use dynamic import from theaction
callback. - The
Router
namespace export was removed. For referencing router types, either refer to exports directly, or use ES module namespace import:import type * as RouterTypes from '@vaadin/router';
- The
path-to-regexp
library was updated to v6.3.0. This update brought some behavior altering changes affecting route parameter parsing and matching. See to the library README for the supported patterns. - Some TypeScript interfaces of the router library were changed with introducing generic support:
- The
Context
type was replaced with theRouteContext
generic type. - The
ComponentResult
type is replaced with the standardHTMLElement
type. - The
AfterEnterObserver
,AfterLeaveObserver
,BeforeEnterObserver
,BeforeLeaveObserver
interfaces were combined into the single genericWebComponentInterface
with multiple optional user callbacks. - The
ActionFn
function type has no direct alternative yet. Use the key of theRoute
type:NonNullable<Route["action"]>
.
- The
Known Limitations
The following known issues of the router v2.0.0 release will be addressed in the next v2.0.1 release:
- Type compatibility with the Router v1 is lacking due to missing type definitions for Router v1 types:
Context
,ComponentResult
,AfterEnterObserver
,AfterLeaveObserver
,BeforeEnterObserver
,BeforeLeaveObserver
observer interfaces. - The Router requires
ES2022
target setting in TypeScript due to relying on theErrorOptions
type, see #897
In addition, the live router demos are not available yet. We're currently working on porting them from HTML imports and Polymer toolset to ES modules, TypeScript and Vite.
Notable Changes since v1.7.5
- fix: move version output from preversion to version script by @platosha in #546
- chore!: update path-to-regexp by @abdonrd in #351
- feat!: Drop support for route.bundle by @abdonrd in #464
- fix: failing tests after path-to-regexp 6.2.0 update by @vlukashov in #549
- fix: scroll to top on click event by @haijian-vaadin in #547
- fix: avoid URL-confusing default pathname in baseUrl by @platosha in #565
- fix: removeDomNodes with HTMLCollection by @joheriks in #583
- fix: skip undefined base argument in URL constructor by @platosha in #584
- feat: add searchParams for RouterLocation by @haijian-vaadin in #582
- fix: npm install with npm 7 by @Haprog in #592
- docs: fix demo and API docs links in readme by @Haprog in #606
- chore: set type to module in package.json by @vursen in #721
- docs: typo in URL Generation demo by @pdurbin in #800
- chore: fix build for "type": "module" by @platosha in #833
- refactor!: move Router fully to TypeScript by @Lodin in #886
- chore: bump version by @platosha in #887
- fix: support WCs with result property by @platosha in #889
- fix: Router#resolve typings by @Lodin in #891
New Contributors
- @Haprog made their first contribution in #548
- @joheriks made their first contribution in #583
- @vursen made their first contribution in #721
- @pdurbin made their first contribution in #800
- @Lodin made their first contribution in #886
Full Changelog: v1.7.5...v2.0.0
v2.0.0-rc4
What's Changed
Full Changelog: v2.0.0-rc3...v2.0.0-rc4
v2.0.0-rc3
What's Changed
Full Changelog: v2.0.0-rc2...v2.0.0-rc3
v2.0.0-rc2
v1.7.5
Live Demo →
API Documentation →
Changes Since v1.7.4:
- 88b49ba chore: update docs
- 239b162 chore: update yarn.loc
- 8b4f9fe chore: fix build for "type": "module" (#833)
- a9476d2 chore(deps): bump y18n from 3.2.1 to 3.2.2 (#605)
- e96180e chore(deps): bump handlebars from 4.7.6 to 4.7.7 (#619)
- 4c30ced chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#620)
- 4cea7a8 chore(deps): bump ws from 7.4.2 to 7.4.6 (#631)
- 1c11c65 chore(deps): bump path-parse from 1.0.6 to 1.0.7 (#669)
- d6564ac chore(deps): bump shelljs from 0.8.3 to 0.8.5 (#714)
- 743eb3f chore(deps): bump color-string from 1.5.3 to 1.9.0 (#722)
- 185096e chore(deps): bump postcss from 7.0.35 to 7.0.39 (#724)
- 3dd1f7a chore(deps): bump ua-parser-js from 0.7.22 to 0.7.31 (#731)
- 4e34bb4 chore(deps): bump follow-redirects from 1.9.0 to 1.14.8 (#733)
- 0a61120 chore(deps-dev): bump @rollup/plugin-node-resolve from 9.0.0 to 15.0.1 (#815)
- 47b2bdd chore(deps-dev): bump @babel/core from 7.11.6 to 7.20.12 (#826)
- 302e1b8 chore(deps): bump shell-quote from 1.7.2 to 1.7.3 (#784)
- 906fe91 chore(deps-dev): bump rollup from 2.35.1 to 2.79.1 (#807)
- 299394f chore(deps): bump socket.io-parser from 3.3.0 to 3.3.3 (#817)
- 8c3aafb chore(deps): bump mout from 1.2.2 to 1.2.4 (#831)
- bdbafe4 chore(deps-dev): bump browserslist from 4.16.3 to 4.21.5 (#832)
- e923ee5 chore(deps-dev): bump @rollup/plugin-babel from 5.2.1 to 6.0.3 (#819)
- 155a9a2 chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#821)
- 23d6547 chore(deps): bump node-fetch from 2.6.1 to 2.6.9 (#829)
- 23088d1 chore(deps-dev): bump typescript from 4.1.5 to 4.9.4 (#823)
- 5930e18 chore(deps): bump express from 4.17.1 to 4.18.2 (#824)
- 3a78bc9 chore(deps-dev): bump @babel/core from 7.11.6 to 7.20.12 (#826)
- 0624161 chore(deps): bump json5 from 2.2.0 to 2.2.3 (#827)
- 6662304 typo (#800)
Full Changelog: v1.7.4...v1.7.5
v1.7.4
Live Demo →
API Documentation →
Changes Since v1.7.3:
v1.7.3
Live Demo →
API Documentation →
Bug fixes
v1.7.2
Live Demo →
API Documentation →
Bug fixes
v1.7.1
Live Demo →
API Documentation →
Bug fixes
-
c68243b fix: update location when reusing parents (#439)
Fixes #428
-
a382bab test(router): matching child not under first parent (#438)
- test(router): matching child not under first parent
Fixes #307
Other changes
v1.7.0
Live Demo →
API Documentation →
New features
-
feat(typescript): add NavigationTrigger and lifecycle types (#427)
Fixes #422
-
dd5e4ea feat(typescript): extract type definitions from Router namespace (#427)
-
4c13710 docs(typescript): add examples of TypeScript location and lifecycle interfaces (#432)
Fixes #423