Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vaadin/router
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4389d564e281d335b741773e8fa9a8a266220262
Choose a base ref
...
head repository: vaadin/router
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 167efd6b3258955debc0a4b2600ef6db95a59c58
Choose a head ref
Loading
Showing with 24,708 additions and 26,308 deletions.
  1. +18 −19 .eslintrc.json
  2. +34 −0 .github/workflows/validation.yml
  3. +0 −1 .gitignore
  4. +0 −1 .npmrc
  5. +7 −0 .prettierrc.json
  6. +10 −0 .run/All tests.run.xml
  7. +10 −0 .run/Template Karma.run.xml
  8. +0 −3 .stylelintrc
  9. +93 −0 .stylelintrc.json
  10. +0 −29 .travis.yml
  11. +23 −11 README.md
  12. +162 −125 analysis.json
  13. +0 −26 bower.json
  14. +0 −14 bs-config.js
  15. +4 −4 demo/demo-shell.html
  16. +1 −0 demo/element-demo.html
  17. +46 −104 demo/vaadin-router-code-splitting-demos.html
  18. +2 −6 demo/vaadin-router-route-parameters-demos.html
  19. +1 −5 demo/vaadin-router-url-generation-demos.html
  20. +406 −434 docs/iron-component-page/iron-component-page.html
  21. +162 −125 docs/vaadin-router/analysis.json
  22. +1 −1 docs/vaadin-router/demo/demo-elements/user.bundle.html
  23. +1 −1 docs/vaadin-router/demo/demo-elements/user.bundle.js
  24. +716 −788 docs/vaadin-router/demo/demo-shell.html
  25. +1 −1 docs/vaadin-router/demo/vaadin-router-animated-transitions-demos.html
  26. +47 −105 docs/vaadin-router/demo/vaadin-router-code-splitting-demos.html
  27. +1 −1 docs/vaadin-router/demo/vaadin-router-getting-started-demos.html
  28. +1 −1 docs/vaadin-router/demo/vaadin-router-lifecycle-callbacks-demos.html
  29. +1 −1 docs/vaadin-router/demo/vaadin-router-navigation-trigger-demos.html
  30. +1 −1 docs/vaadin-router/demo/vaadin-router-redirect-demos.html
  31. +1 −1 docs/vaadin-router/demo/vaadin-router-route-actions-demos.html
  32. +3 −7 docs/vaadin-router/demo/vaadin-router-route-parameters-demos.html
  33. +2 −6 docs/vaadin-router/demo/vaadin-router-url-generation-demos.html
  34. +0 −27 gen-tsd.json
  35. +0 −123 gulpfile.js
  36. +0 −2 index.js
  37. +0 −72 index.polyfilled.js
  38. +0 −306 interfaces.d.ts
  39. +59 −0 karma.config.cjs
  40. +11,347 −0 package-lock.json
  41. +72 −69 package.json
  42. +0 −112 rollup.config.js
  43. +29 −0 scripts/build.ts
  44. +17 −0 scripts/copy-dts.ts
  45. +7 −0 scripts/register.js
  46. +0 −134 src/documentation/location.js
  47. +0 −4 src/documentation/namespace.js
  48. +0 −203 src/documentation/web-component-interface.js
  49. +13 −0 src/index.ts
  50. +5 −0 src/mod.d.ts
  51. +0 −116 src/resolver/generateUrls.js
  52. +147 −0 src/resolver/generateUrls.ts
  53. +0 −72 src/resolver/matchPath.js
  54. +100 −0 src/resolver/matchPath.ts
  55. +44 −21 src/resolver/{matchRoute.js → matchRoute.ts}
  56. +0 −1 src/resolver/path-to-regexp.js
  57. +0 −19 src/resolver/resolveRoute.js
  58. +21 −0 src/resolver/resolveRoute.ts
  59. +0 −254 src/resolver/resolver.js
  60. +336 −0 src/resolver/resolver.ts
  61. +93 −0 src/resolver/types.d.ts
  62. +57 −0 src/resolver/utils.ts
  63. +0 −6 src/router-config.js
  64. +1 −0 src/router-config.ts
  65. +0 −11 src/router-meta.js
  66. +7 −0 src/router-meta.ts
  67. +0 −1,020 src/router.js
  68. +1,008 −0 src/router.ts
  69. +4 −4 src/transitions/{animate.js → animate.ts}
  70. +41 −24 src/triggers/{click.js → click.ts}
  71. +20 −0 src/triggers/navigation.ts
  72. +0 −43 src/triggers/popstate.js
  73. +26 −0 src/triggers/popstate.ts
  74. +0 −17 src/triggers/setNavigationTriggers.js
  75. +493 −0 src/types.d.ts
  76. +0 −160 src/utils.js
  77. +216 −0 src/utils.ts
  78. +0 −19 test/.eslintrc.json
  79. +0 −47 test/index.coverage.html
  80. +0 −39 test/index.html
  81. +0 −248 test/resolver/generateUrls.spec.js
  82. +242 −0 test/resolver/generateUrls.spec.ts
  83. +0 −397 test/resolver/matchPath.spec.js
  84. +345 −0 test/resolver/matchPath.spec.ts
  85. +0 −874 test/resolver/matchRoute.spec.js
  86. +792 −0 test/resolver/matchRoute.spec.ts
  87. +0 −860 test/resolver/resolver.spec.js
  88. +875 −0 test/resolver/resolver.spec.ts
  89. +0 −172 test/router/dynamic-redirect.spec.html
  90. +117 −0 test/router/dynamic-redirect.spec.ts
  91. +0 −2,282 test/router/lifecycle-events.spec.html
  92. +2,408 −0 test/router/lifecycle-events.spec.ts
  93. +490 −0 test/router/parent-layout.spec.ts
  94. +0 −425 test/router/parent-layouts.spec.html
  95. +0 −2,389 test/router/router.spec.html
  96. +2,385 −0 test/router/router.spec.ts
  97. +0 −62 test/router/test-utils.js
  98. +67 −0 test/router/test-utils.ts
  99. +0 −281 test/router/url-for.spec.html
  100. +282 −0 test/router/url-for.spec.ts
  101. +5 −0 test/setup.ts
  102. +0 −144 test/test-pushstate-throttler.html
  103. +0 −20 test/test-suites.js
  104. +0 −76 test/transitions/animate.spec.html
  105. +62 −0 test/transitions/animate.spec.ts
  106. +0 −390 test/triggers/click.spec.html
  107. +419 −0 test/triggers/click.spec.ts
  108. +0 −56 test/triggers/popstate.spec.js
  109. +64 −0 test/triggers/popstate.spec.ts
  110. +0 −40 test/triggers/setNavigationTriggers.spec.js
  111. +43 −0 test/triggers/setNavigationTriggers.spec.ts
  112. +97 −148 test/typescript/compile_fixture.ts
  113. +12 −0 tsconfig.build.json
  114. +18 −21 tsconfig.json
  115. +52 −0 vite.config.ts
  116. +15 −23 wct.conf.js → wct.conf.cjs
  117. +0 −12,654 yarn.lock
37 changes: 18 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{
"extends": "vaadin",
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": [
"html"
"extends": [
"vaadin/typescript-requiring-type-checking",
"vaadin/imports-typescript",
"vaadin/prettier",
"vaadin/testing",
"plugin:oxlint/recommended"
],
"globals": {
"Polymer": false,
"Vaadin": false
},
"parserOptions": {
"sourceType": "module"
"project": "./tsconfig.json"
},
"plugins": ["tsdoc"],
"rules": {
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-useless-template-literals": "off",
"import/no-unassigned-import": "off",
"max-params": "off",
"sort-keys": "off",
"tsdoc/syntax": "error",
"import/prefer-default-export": "off"
},
"overrides": [{
"files": ["gulpfile.js"],
"parserOptions": {
"ecmaVersion": 2017
}
}]
"ignorePatterns": ["*.cjs"]
}
34 changes: 34 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validation

on:
push:
branches:
- 'master'
pull_request:
permissions:
contents: read

jobs:
test:
name: Validation
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Install dependencies and build
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Check TypeScript
run: npm run typecheck
- name: Test
run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
bower_components
node_modules
build
package-lock.json
dist
coverage

1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": true,
"printWidth": 120,
"trailingComma": "all",
"tabWidth": 2,
"singleQuote": true
}
10 changes: 10 additions & 0 deletions .run/All tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All tests" type="JavaScriptTestRunnerKarma">
<config-file value="$PROJECT_DIR$/karma.config.cjs" />
<karma-package-dir value="$PROJECT_DIR$/node_modules/karma" />
<working-directory value="$PROJECT_DIR$" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
10 changes: 10 additions & 0 deletions .run/Template Karma.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="true" type="JavaScriptTestRunnerKarma">
<config-file value="$PROJECT_DIR$/karma.config.cjs" />
<karma-package-dir value="$PROJECT_DIR$/node_modules/karma" />
<working-directory value="$PROJECT_DIR$" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
3 changes: 0 additions & 3 deletions .stylelintrc

This file was deleted.

93 changes: 93 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"rules": {
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-empty-line-before": "never",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-length": "short",
"color-no-invalid-hex": true,
"comment-no-empty": true,
"comment-whitespace-inside": "always",
"custom-property-empty-line-before": "never",
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": [ true, {
"ignore": ["consecutive-duplicates-with-different-values"]
} ],
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-whitespace-after": "always",
"indentation": null,
"keyframe-declaration-no-important": true,
"length-zero-no-unit": true,
"max-empty-lines": 1,
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-case": "lower",
"media-feature-name-no-unknown": true,
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-eol-whitespace": true,
"no-invalid-double-slash-comments": true,
"number-no-trailing-zeros": true,
"property-case": "lower",
"property-no-unknown": true,
"rule-empty-line-before": [ "always-multi-line", {
"except": ["first-nested"],
"ignore": ["after-comment"]
} ],
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-descendant-combinator-no-non-space": true,
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"shorthand-property-no-redundant-values": true,
"string-no-newline": true,
"unit-case": "lower",
"unit-no-unknown": true,
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
"value-list-max-empty-lines": 0
}
}
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
[![NPM version](https://img.shields.io/npm/v/@vaadin/router.svg)](https://www.npmjs.com/package/@vaadin/router)
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@vaadin/router.svg)](https://bundlephobia.com/result?p=@vaadin/router)
[![Build Status](https://travis-ci.org/vaadin/vaadin-router.svg?branch=master)](https://travis-ci.org/vaadin/vaadin-router)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vaadin/web-components?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

# Vaadin Router

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

<p align="center">
<img width="120" alt="router hero banner" src="https://user-images.githubusercontent.com/22416150/42952145-74cead64-8b80-11e8-9dfd-09b01f904972.png">
<h2 align="center">A client-side router for Web Components</h2>
</p>
[Demo](https://vaadin.github.io/router/vaadin-router/demo)
·
[API documentation](https://vaadin.github.io/router/vaadin-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).

@@ -33,6 +26,25 @@ router.setRoutes([
```

## Browser support

A specific version of Vaadin Router supports the same browsers as the Vaadin platform major version which includes that version of Vaadin Router.
See [Vaadin platform release notes](https://github.com/vaadin/platform/releases) for details on included Vaadin Router version and supported technologies.
The Supported Technologies section is typically listed in the release notes of the first publicly available release of a Vaadin platform major version
(for example [Vaadin 18.0.1](https://github.com/vaadin/platform/releases/tag/18.0.1) since 18.0.0 was skipped).

### Desktop browsers

Evergreen versions of the following browsers
- Chrome, Firefox, Firefox ESR, Safari and Edge (Chromium)

### Mobile browsers

Built-in browsers in the following mobile operating systems:
- Safari starting from iOS 13 (Safari 13 or newer)
- Google Chrome evergreen on Android (requiring Android 4.4 or newer)

### Sauce Labs test status

[![Sauce Test Status](https://saucelabs.com/browser-matrix/vaadin-router.svg)](https://saucelabs.com/u/vaadin-router)

### Big Thanks
@@ -54,7 +66,7 @@ Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs](https

- [http://127.0.0.1:8000/components/vaadin-router/demo](http://127.0.0.1:8000/components/vaadin-router/demo)
- Public API tests: [http://127.0.0.1:8000/components/vaadin-router/test](http://127.0.0.1:8000/components/vaadin-router/test)
- Unit tests: [http://127.0.0.1:8000/components/vaadin-router/test/index.coverage.html](http://127.0.0.1:8000/components/vaadin-router/test/index.coverage.html)
- Unit tests: [http://127.0.0.1:8000/components/vaadin-router/test/index.html](http://127.0.0.1:8000/components/vaadin-router/test/index.html)


## Running tests from the command line
Loading