Skip to content

Releases: vaadin/router

v2.0.0

08 Nov 09:35
7e87b3b
Compare
Choose a tag to compare

API documentation

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 the action 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 the RouteContext generic type.
    • The ComponentResult type is replaced with the standard HTMLElement type.
    • The AfterEnterObserver, AfterLeaveObserver, BeforeEnterObserver, BeforeLeaveObserver interfaces were combined into the single generic WebComponentInterface with multiple optional user callbacks.
    • The ActionFn function type has no direct alternative yet. Use the key of the Route type: NonNullable<Route["action"]>.

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 the ErrorOptions 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

New Contributors

Full Changelog: v1.7.5...v2.0.0

v2.0.0-rc4

15 Oct 07:57
Compare
Choose a tag to compare
v2.0.0-rc4 Pre-release
Pre-release

What's Changed

Full Changelog: v2.0.0-rc3...v2.0.0-rc4

v2.0.0-rc3

15 Oct 07:58
Compare
Choose a tag to compare
v2.0.0-rc3 Pre-release
Pre-release

What's Changed

Full Changelog: v2.0.0-rc2...v2.0.0-rc3

v2.0.0-rc2

09 Oct 06:21
Compare
Choose a tag to compare
v2.0.0-rc2 Pre-release
Pre-release

Live Demo →
API Documentation →

What's Changed

Full Changelog: v2.0.0-rc1...v2.0.0-rc2

v1.7.5

21 Mar 20:25
Compare
Choose a tag to compare

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

12 Mar 09:45
Compare
Choose a tag to compare

Live Demo →
API Documentation →

Changes Since v1.7.3:

v1.7.3

29 Jan 11:33
Compare
Choose a tag to compare

Live Demo →
API Documentation →

Bug fixes

  • c110761 Add missing type definition for the location-changed event (#512)

  • 1e4a4b1 Add missing type definition RouteWithAnimation (#478)

  • Dependency updates

v1.7.2

30 Apr 08:01
Compare
Choose a tag to compare

Live Demo →
API Documentation →

Bug fixes

v1.7.1

26 Feb 13:18
Compare
Choose a tag to compare

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

  • c040547 chore: regenerate /docs

  • cee8143 test: fix Safari errors in CI (#440)

    • test: fix DOM assertion in a test for Safari 9

    • test: fix pushState throttler for iOS 12

v1.7.0

19 Feb 16:40
Compare
Choose a tag to compare

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

Other fixes

  • c41583a fix: add a mass-ignore example to the docs

    Follow-up on #421, related to #325

  • 6c1eca9 chore(docs): regenerate /docs