Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit 49e21db

Browse files
Merge pull request #405 from maktarsis/release-4.2.0
Release 4.2.0
2 parents 7dbef9b + 7210035 commit 49e21db

32 files changed

+6380
-5248
lines changed

browserslist .browserslistrc

File renamed without changes.

.lintstagedrc.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"prettier --write",
44
"tslint",
55
"git add"
6-
],
7-
".*{rc,json}": "jsonlint"
6+
]
87
}
98

CHANGELOG.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 4.2.0 2020-07-02
2+
3+
- Added compatibility with Angular 10
4+
- Updated documentation documentation
5+
- Updated dependencies
6+
- Refactored internal utilities
7+
18
# 4.1.1 2020-04-04
29

310
- Updated dependencies
@@ -40,7 +47,6 @@
4047
- added contributors board
4148
- added test commit check
4249

43-
4450
# 3.0.0 2019-06-21
4551

4652
- changed a way of slice connection [BREAKING CHANGE]
@@ -50,26 +56,22 @@
5056
- raised the test cover
5157
- updated documentation
5258

53-
5459
# 2.1.3 2019-06-21
5560

5661
- insignificant api changes
5762
- fixed issues with typing of getter functions
5863
- covered with tests all api
5964

60-
6165
# 2.1.2 2019-06-17
6266

6367
- improved documentation
6468
- refactored code
6569

66-
6770
# 2.1.1 2019-06-16
6871

6972
- added new getSlice function (as an alternative to @Sliced decorator)
7073
- refactored code
7174

72-
7375
# 2.1.0 2019-06-14
7476

7577
- added new @Sliced decorator
@@ -78,7 +80,6 @@
7880
- slightly refactored pattern
7981
- updated documentation
8082

81-
8283
# 2.0.0 2019-06-09
8384

8485
- reduced the amount of required boilerplate code
@@ -91,7 +92,6 @@
9192
- finish hub management pattern and improved semantics
9293
- updated dependencies
9394

94-
9595
# 1.3.0 2019-05-08
9696

9797
- added new navLinkActive directive
@@ -100,7 +100,6 @@
100100
- updated documentation
101101
- updated dependencies
102102

103-
104103
# 1.2.0 2019-05-01
105104

106105
- added few navigation directives
@@ -110,7 +109,6 @@
110109
- updated documentation
111110
- updated dependencies
112111

113-
114112
# 1.1.1 2019-03-09
115113

116114
- improved reliability and typing
@@ -126,7 +124,6 @@
126124
- updated and fixed readme
127125
- refactored and made functionality clearer
128126

129-
130127
# 1.0.0 2019-02-09
131128

132129
- initial release

README.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
A **route manager** and pattern for **[Angular]**
66

7-
* **Manager.** Introduces a new route management experience leading to better application control.
8-
* **Navigation.** Provides declarative experience of navigation.
7+
* **Manager.** Introduces a new route management experience that leads to better application control.
8+
* **Navigation.** It provides declarative navigation experience.
99
* **Fast.** In addition to speeding up development, it works as fast as it does without it.
10-
* **Pluggable.** Engineered as a plug-in. Designed to be added at any time during the development process.
11-
* **Pattern.** Provides a unified approach managing the routing of the entire application.
12-
* **Small.** ~3.5kB (minified + gzipped). It uses [Angular] and [rxjs] as peerDependencies.
10+
* **Pluggable.** Engineered as a plug-in and designed to be added at any time during the development process.
11+
* **Pattern.** It provides a unified approach managing the routing of the entire application.
12+
* **Small.** ~3.5 kB (minified + gzipped). It uses [Angular] and [rxjs] as peerDependencies.
1313

14-
In short, this is an add-on to the **@angular/router** which provides state based routing for medium to large-size applications.
14+
In short, this is an add-on to the **@angular/router**, which provides state-based routing for medium to large-size applications.
1515

1616
Read more about Routeshub on the [docs site](https://routeshub.gitbook.io)
1717

1818
<br/>
1919

2020
## Install
21-
To get started, you need install the package from npm
21+
To get started, you need to install the package from npm
2222
```sh
2323
npm install routeshub
2424
```
@@ -74,17 +74,17 @@ import { aboutUnit } from '../views/about/hub/about.hub';
7474
createRoot<AppNotes>(routes, { key: APP_NOTES_KEY });
7575

7676
/**
77-
* connects features which have attached relation to parent module
77+
* connects features which have attached relating to the parent module
7878
*
79-
* about module has its own routes which we wanna connect
79+
* about module has its routes which we want to connect
8080
*/
8181
connectFeatures<AppNotes>(APP_NOTES_KEY, {
8282
about: aboutUnit
8383
});
8484

8585
/**
8686
* Routing module contains its configuration
87-
* and providers (resolvers, guard, interceptors etc)
87+
* and providers (resolvers, guard, interceptors, etc.)
8888
*
8989
* Exports RouterModule
9090
* and NavigationModule for navLink directives
@@ -120,7 +120,7 @@ export class HeaderComponent {
120120

121121
//or
122122

123-
// getting unit by name
123+
// getting the unit by name
124124
@Secluded('app')
125125
public app: Unit<AppNotes>;
126126

@@ -142,10 +142,10 @@ You can find a more complex example in this [repo](https://github.com/maktarsis/
142142
Routeshub offers an approach (pattern) to structure routing in the application. You can explore it in this [repo](https://github.com/maktarsis/routeshub/tree/master/example-app).
143143

144144
**Guideline**:
145-
- Each module in application has a hub directory
146-
- hub directory contains three files that configure routing of the current module
147-
1. hub - sets routing configuration, exports RoutingModule and NavigationModule, connects feature units.
148-
2. notes - place for interfaces and unique key of the unit.
145+
- Each module in the application has a hub directory
146+
- hub directory contains three files that configure the routing of the current module.
147+
1. hub - sets routing configuration; exports RoutingModule and NavigationModule; connects feature units.
148+
2. notes - it is a place for interfaces and the unique key of the unit.
149149
3. routes - simple routes file as is without any changes.
150150

151151
![diagram](http://i.piccy.info/i9/baf248d94b1260e13d5bff6acb6e6727/1569138770/128577/1338898/2019_09_22_10_51_00.jpg)
@@ -165,10 +165,10 @@ There are two ways to create the `unit`:
165165

166166
Each creator takes the `routes: Routes` and an object of options
167167
- key - unit identifier and accepts string or symbol
168-
- routeName - accepts an object with optional custom names for wildcard ('**') and root ('') paths
169-
- nearby - accepts lazy units (**connectors**) which are outputs of **feature creator**. Nearby option should be used when one or more connected features are eager modules with their own routes files.
168+
- routeName - accepts an object with optional custom names for a wildcard ('**') and root ('') paths
169+
- nearby - accepts lazy units (**connectors**), which are outputs of **feature creator**. A nearby option should use when one or more connected features are eager modules with their own routes files.
170170

171-
**Root** creator invokes only once to initialize the hub in the application. `createRoot` takes initial `appNotes`
171+
**Root** creator invokes only once to initialize the hub in the application. `createRoot` takes initial `appNotes`.
172172

173173
**Usage example**:
174174
```typescript
@@ -179,7 +179,7 @@ Each creator takes the `routes: Routes` and an object of options
179179
});
180180
```
181181

182-
In turn, the **feature** creator is responsible for creating lazy units (**connectors**) which should be connected to the parent unit
182+
In turn, the **feature** creator is responsible for creating lazy units (**connectors**), which should connect to the parent unit.
183183

184184
```typescript
185185
export const routes: Routes = [
@@ -200,13 +200,13 @@ export const aboutConnector: Connector<AboutNotes> = createFeature<AboutNotes>(a
200200
<br/>
201201

202202
## Note
203-
You need understand how routeshub transforms routes into the keys. Actually, all notes related things routeshub handles internally.
203+
You need to understand how routeshub transforms routes into the keys. All notes related things routeshub handles internally.
204204

205205
The `Note` is input to reproduce the unit. Each `Note` represents one route.
206206

207207
**In short, it assigns the names to the 'spots'**
208208

209-
The example below shows capabilities and illustrates how this actually works. Unnecessary route information is shortened.
209+
The example below shows capabilities and illustrates how this works. Unnecessary route information shortened.
210210

211211
```typescript
212212
export const routes: Routes = [
@@ -237,7 +237,7 @@ export interface AppChildNotes extends Root {
237237
*/
238238

239239
/**
240-
* btw, this shorthand provides opportunity to describe root children interface through generics
240+
* btw, this shorthand provides an opportunity to describe root children interface through generics
241241
*/
242242
export interface AppNotes extends Root<AppChildNotes> {
243243
firstName: Note;
@@ -263,7 +263,7 @@ export const appUnit = createRoot<AppNotes, AppChildNotes>(routes, { routeName:
263263
<br/>
264264

265265
## Get Unit
266-
Essentially, you need the unit to pass it into directive/decorator for navigation purposes.
266+
Essentially, you need the unit to pass it into a directive/decorator for navigation purposes.
267267
There are several ways to get a unit:
268268

269269
- **@United decorator**. Apply this decorator on the component's prop. You should pass the key or unit name.
@@ -282,7 +282,7 @@ export class HeaderComponent {
282282
}
283283
```
284284

285-
- **getUnit** - This is a function that works as decorator. Essentially, it is created as an alternative to @Secluded decorator.
285+
- **get unit** - This is a function that works as a decorator. Primarily, it created as an alternative to @Secluded decorator.
286286
```typescript
287287
@Component({
288288
...
@@ -312,7 +312,7 @@ export class HeaderComponent {
312312
**Routeshub** provides directives and functions to make your experience with navigation better.
313313

314314
Before you start, don't forget to import **NavigationModule**.
315-
It's a good practice importing NavigationModule into the **[module]**.hub.ts file
315+
It's a good practice importing NavigationModule into the **[module]**.hub.ts file.
316316

317317

318318
### navLink
@@ -339,7 +339,7 @@ It's a good practice importing NavigationModule into the **[module]**.hub.ts fil
339339
```
340340

341341
### forwardParams
342-
A function that inserts parameters into route's state and outputs a ready-made dynamic state.
342+
A function that inserts parameters into the route's state and outputs a ready-made dynamic state.
343343

344344
```typescript
345345
...
@@ -382,7 +382,7 @@ If you made a PR, make sure to update tests as appropriate and keep the examples
382382

383383
## Contributors ✨
384384

385-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
385+
Thanks go to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
386386

387387
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
388388
<!-- prettier-ignore -->

example-app/app/core/components/header/header.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
} from 'routeshub';
1212

1313
import { Hub } from '../../../hub/app.hub';
14-
import { APP_NOTES_KEY, AppChildNotes, AppNotes } from '../../../hub/app.notes';
14+
import { AppChildNotes, AppNotes, APP_NOTES_KEY } from '../../../hub/app.notes';
1515
import { AboutNotes } from '../../../views/about/hub/about.notes';
16-
import { CAR_NOTES_KEY, CarNotes } from '../../../views/car/hub/car.notes';
16+
import { CarNotes, CAR_NOTES_KEY } from '../../../views/car/hub/car.notes';
1717

1818
@Component({
1919
selector: 'app-header',

example-app/app/hub/app.hub.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { RouterModule } from '@angular/router';
55
import { connectFeatures, createRoot, NavigationModule } from 'routeshub';
66

77
import { routes } from './app.routes';
8-
import { APP_NOTES_KEY, AppChildNotes, AppNotes } from './app.notes';
8+
import { AppChildNotes, AppNotes, APP_NOTES_KEY } from './app.notes';
99
import { aboutConnector } from '../views/about/hub/about.hub';
1010
import { carConnector } from '../views/car/hub/car.hub';
1111
import { homeConnector } from '../views/home/hub/home.hub';
@@ -58,12 +58,15 @@ export interface Hub {
5858
/**
5959
* Routing configuration
6060
*/
61-
export const routing: ModuleWithProviders = RouterModule.forRoot(routes, {
62-
enableTracing: false,
63-
initialNavigation: 'enabled',
64-
onSameUrlNavigation: 'reload',
65-
scrollPositionRestoration: 'top'
66-
});
61+
export const routing: ModuleWithProviders<AppHub> = RouterModule.forRoot(
62+
routes,
63+
{
64+
enableTracing: false,
65+
initialNavigation: 'enabled',
66+
onSameUrlNavigation: 'reload',
67+
scrollPositionRestoration: 'top'
68+
}
69+
);
6770

6871
/**
6972
* Routing module contains its configuration

example-app/app/views/about/hub/about.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { createFeature } from 'routeshub';
4-
import { ABOUT_NOTES_KEY, AboutNotes } from './about.notes';
4+
import { AboutNotes, ABOUT_NOTES_KEY } from './about.notes';
55
import { aboutRoutes } from './about.routes';
66

77
export const aboutConnector = createFeature<AboutNotes>(aboutRoutes, {

example-app/app/views/about/hub/about.routes.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Routes } from '@angular/router';
2-
import { createFeature } from 'routeshub';
32
import { AboutComponent } from '../components/about.component';
4-
import { ABOUT_NOTES_KEY, AboutNotes } from './about.notes';
53

64
/**
75
* Declares routes on AboutModule level

example-app/app/views/car/hub/car.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { createFeature } from 'routeshub';
4-
import { CAR_NOTES_KEY, CarNotes } from './car.notes';
4+
import { CarNotes, CAR_NOTES_KEY } from './car.notes';
55
import { carRoutes } from './car.routes';
66
import { detailsUnit } from '../../details/hub/details.hub';
77

example-app/app/views/details/hub/details.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { connectFeatures, createFeature } from 'routeshub';
4-
import { DETAILS_NOTES_KEY, DetailsNotes } from './details.notes';
4+
import { DetailsNotes, DETAILS_NOTES_KEY } from './details.notes';
55
import { infoConnector } from '../../info/hub/info.hub';
66
import { detailsRoutes } from './details.routes';
77

example-app/app/views/home/hub/home.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { createFeature } from 'routeshub';
4-
import { HOME_NOTES_KEY, HomeNotes } from './home.notes';
4+
import { HomeNotes, HOME_NOTES_KEY } from './home.notes';
55
import { homeRoutes } from './home.routes';
66

77
export const homeConnector = createFeature<HomeNotes>(homeRoutes, {

example-app/app/views/info/hub/info.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { createFeature } from 'routeshub';
4-
import { INFO_NOTES_KEY, InfoNotes } from './info.notes';
4+
import { InfoNotes, INFO_NOTES_KEY } from './info.notes';
55
import { infoRoutes } from './info.routes';
66

77
export const infoConnector = createFeature<InfoNotes>(infoRoutes, {

example-app/app/views/users/hub/users.hub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { createFeature, NavigationModule } from 'routeshub';
4-
import { USERS_NOTES_KEY, UsersChildNotes, UsersNotes } from './users.notes';
4+
import { UsersChildNotes, UsersNotes, USERS_NOTES_KEY } from './users.notes';
55
import { usersRoutes } from './users.routes';
66

77
export const usersConnector = createFeature<UsersNotes, UsersChildNotes>(

example-app/tsconfig.app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/app",
55
"types": []

0 commit comments

Comments
 (0)