boring-router
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -6,2 +6,3 @@ export * from './schema'; | ||
export * from './link'; | ||
export * from './nav-link'; | ||
export * from './redirect'; |
@@ -9,3 +9,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./link"), exports); | ||
tslib_1.__exportStar(require("./nav-link"), exports); | ||
tslib_1.__exportStar(require("./redirect"), exports); | ||
//# sourceMappingURL=index.js.map |
# Changelog | ||
## [0.2.1] - 2018-9-5 | ||
### Changes | ||
- Added `<NavLink>` component. | ||
## [0.2.0] - 2018-9-2 | ||
@@ -7,11 +13,12 @@ | ||
- `<Link>` component now do `history.push()` by default. A new boolean parameter `replace` is added to override the behavior with `history.replace()`. | ||
- `<Redirect>` component now do `history.replace()` by default. A new boolean parameter `push` is added to override the behavior with `history.push()`. | ||
- `<Link>` component now does `history.push()` by default. A new boolean parameter `replace` is added to override the behavior with `history.replace()`. | ||
- `<Redirect>` component now does `history.replace()` by default. A new boolean parameter `push` is added to override the behavior with `history.push()`. | ||
### Breaking Changes | ||
- `<Link>` and `<Redirect>` component now support only `RouteMatch` as value of `to` parameter, and `<HistoryProvider>` is now removed. | ||
- `<Link>` and `<Redirect>` component now supports only `RouteMatch` as value of `to` parameter, and `<HistoryProvider>` is now removed. | ||
- `$navigate` method of `RouteMatch` is now removed in favor of `$push` and `$replace`. | ||
- `<Redirect>` component no longer accept `match` parameter with type boolean. | ||
- `<Redirect>` component no longer accepts `match` parameter with type boolean. | ||
[0.2.1]: https://github.com/makeflow/boring-router/releases/tag/v0.2.1 | ||
[0.2.0]: https://github.com/makeflow/boring-router/releases/tag/v0.2.0 |
{ | ||
"name": "boring-router", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A light-weight, type-safe, yet reactive router service using MobX.", | ||
@@ -35,2 +35,3 @@ "repository": { | ||
"@magicspace/configs": "^0.1.28", | ||
"@types/classnames": "^2.2.6", | ||
"@types/history": "^4.7.0", | ||
@@ -55,2 +56,3 @@ "@types/react": "^16.4.12", | ||
"@types/jest": "^23.3.1", | ||
"classnames": "^2.2.6", | ||
"hyphenate": "^0.2.4", | ||
@@ -57,0 +59,0 @@ "tslang": "^0.1.7" |
@@ -80,3 +80,3 @@ [](https://www.npmjs.com/package/boring-router) | ||
Two pre-defined `$match` regular expression is available as `RouteMatch.fragment` (`/[^/]+/`) and `RouteMatch.rest` (`/.+/`). | ||
Two pre-defined `$match` regular expressions are available as `RouteMatch.fragment` (`/[^/]+/`) and `RouteMatch.rest` (`/.+/`). | ||
@@ -100,5 +100,5 @@ A `schema` wrapper function is available to make TypeScript intellisense happier for separated schema definition: | ||
$ref(params?: Partial<TParamDict>, preserveQuery?: boolean): string; | ||
$push(params?: Partial<TParamDict>, preserveQuery?: boolean): string; | ||
$replace(params?: Partial<TParamDict>, preserveQuery?: boolean): string; | ||
$action(action: RouteMatchAction, exact?: boolean): string; | ||
$push(params?: Partial<TParamDict>, preserveQuery?: boolean): void; | ||
$replace(params?: Partial<TParamDict>, preserveQuery?: boolean): void; | ||
$action(action: RouteMatchAction, exact?: boolean): void; | ||
} | ||
@@ -171,2 +171,10 @@ ``` | ||
- [NavLink](examples/nav-link/main.tsx) | ||
Like `<Link>` but will add a class name if `to` matches. | ||
```tsx | ||
<NavLink to={router.account}>Account</NavLink> | ||
``` | ||
- [Function as Child](examples/function-as-child/main.tsx) | ||
@@ -207,2 +215,12 @@ | ||
- [Action](examples/action/main.tsx) | ||
Take an action on route match. | ||
```tsx | ||
router.account.$action(() => { | ||
router.about.$replace({source: 'action'}); | ||
}); | ||
``` | ||
### Run an example | ||
@@ -209,0 +227,0 @@ |
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
30927
22
0
553
236
8
18
+ Addedclassnames@^2.2.6
+ Addedclassnames@2.5.1(transitive)