@ngxs/router-plugin 3.7.4-dev.master-e8bc76f → 3.7.4-dev.master-79cbc2a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ngxs-router-plugin.umd.js +8 -114
- package/bundles/ngxs-router-plugin.umd.js.map +1 -1
- package/bundles/ngxs-router-plugin.umd.min.js +2 -2
- package/bundles/ngxs-router-plugin.umd.min.js.map +1 -1
- package/esm2015/src/router.state.js +6 -104
- package/esm5/src/router.state.js +6 -115
- package/fesm2015/ngxs-router-plugin.js +5 -103
- package/fesm2015/ngxs-router-plugin.js.map +1 -1
- package/fesm5/ngxs-router-plugin.js +5 -114
- package/fesm5/ngxs-router-plugin.js.map +1 -1
- package/ngxs-router-plugin.metadata.json +1 -1
- package/package.json +1 -1
- package/src/router.state.d.ts +2 -12
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { NgZone, Injectable, NgModule } from '@angular/core';
|
|
2
2
|
import { Store, Action, Selector, State, NgxsModule } from '@ngxs/store';
|
|
3
3
|
import { __assign, __decorate, __metadata } from 'tslib';
|
|
4
|
-
import { NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd, Router
|
|
5
|
-
import { LocationStrategy, Location } from '@angular/common';
|
|
6
|
-
import { isAngularInTestMode } from '@ngxs/store/internals';
|
|
4
|
+
import { NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd, Router } from '@angular/router';
|
|
7
5
|
import { Subscription } from 'rxjs';
|
|
8
|
-
import { first } from 'rxjs/operators';
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
8
|
* @fileoverview added by tsickle
|
|
@@ -315,14 +312,11 @@ if (false) {
|
|
|
315
312
|
RouterStateModel.prototype.trigger;
|
|
316
313
|
}
|
|
317
314
|
var RouterState = /** @class */ (function () {
|
|
318
|
-
function RouterState(_store, _router, _serializer, _ngZone
|
|
315
|
+
function RouterState(_store, _router, _serializer, _ngZone) {
|
|
319
316
|
this._store = _store;
|
|
320
317
|
this._router = _router;
|
|
321
318
|
this._serializer = _serializer;
|
|
322
319
|
this._ngZone = _ngZone;
|
|
323
|
-
this._urlSerializer = _urlSerializer;
|
|
324
|
-
this._locationStrategy = _locationStrategy;
|
|
325
|
-
this._location = _location;
|
|
326
320
|
/**
|
|
327
321
|
* Determines how navigation was performed by the `RouterState` itself
|
|
328
322
|
* or outside via `new Navigate(...)`
|
|
@@ -340,7 +334,6 @@ var RouterState = /** @class */ (function () {
|
|
|
340
334
|
this._subscription = new Subscription();
|
|
341
335
|
this.setUpStoreListener();
|
|
342
336
|
this.setUpRouterEventsListener();
|
|
343
|
-
this.checkInitialNavigationOnce();
|
|
344
337
|
}
|
|
345
338
|
RouterState_1 = RouterState;
|
|
346
339
|
/**
|
|
@@ -630,93 +623,12 @@ var RouterState = /** @class */ (function () {
|
|
|
630
623
|
this._storeState = null;
|
|
631
624
|
this._routerState = null;
|
|
632
625
|
};
|
|
633
|
-
/**
|
|
634
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
635
|
-
* to perform this check only once and unsubscribe after the first event
|
|
636
|
-
* is triggered
|
|
637
|
-
*/
|
|
638
|
-
/**
|
|
639
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
640
|
-
* to perform this check only once and unsubscribe after the first event
|
|
641
|
-
* is triggered
|
|
642
|
-
* @private
|
|
643
|
-
* @return {?}
|
|
644
|
-
*/
|
|
645
|
-
RouterState.prototype.checkInitialNavigationOnce = /**
|
|
646
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
647
|
-
* to perform this check only once and unsubscribe after the first event
|
|
648
|
-
* is triggered
|
|
649
|
-
* @private
|
|
650
|
-
* @return {?}
|
|
651
|
-
*/
|
|
652
|
-
function () {
|
|
653
|
-
var _this = this;
|
|
654
|
-
// Caretaker note: we have still left the `typeof` condition in order to avoid
|
|
655
|
-
// creating a breaking change for projects that still use the View Engine.
|
|
656
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
657
|
-
// Angular is running tests in development mode thus we can be sure that this method will be
|
|
658
|
-
// skipped in tests.
|
|
659
|
-
isAngularInTestMode()) {
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
/** @type {?} */
|
|
663
|
-
var subscription = this._router.events
|
|
664
|
-
.pipe(first((/**
|
|
665
|
-
* @param {?} event
|
|
666
|
-
* @return {?}
|
|
667
|
-
*/
|
|
668
|
-
function (event) { return event instanceof RoutesRecognized; })))
|
|
669
|
-
.subscribe((/**
|
|
670
|
-
* @param {?} __0
|
|
671
|
-
* @return {?}
|
|
672
|
-
*/
|
|
673
|
-
function (_a) {
|
|
674
|
-
// `location.pathname` always equals manually entered URL in the address bar
|
|
675
|
-
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
676
|
-
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
677
|
-
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
678
|
-
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
679
|
-
var url = _a.url;
|
|
680
|
-
// `location.pathname` always equals manually entered URL in the address bar
|
|
681
|
-
// e.g. `location.pathname === '/foo'`, but the `router` state has been initialized
|
|
682
|
-
// with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the
|
|
683
|
-
// `RouterNavigation` action will be dispatched and the user will be redirected to the
|
|
684
|
-
// previously saved URL. We want to prevent such behavior, so we perform this check
|
|
685
|
-
// `url` is a recognized URL by the Angular's router, while `currentUrl` is an actual URL
|
|
686
|
-
// entered in the browser's address bar
|
|
687
|
-
// `PathLocationStrategy.prototype.path()` returns a concatenation of
|
|
688
|
-
// `PlatformLocation.pathname` and normalized `PlatformLocation.search`.
|
|
689
|
-
// `Location.prototype.normalize` strips base href from the URL,
|
|
690
|
-
// if `baseHref` (declared in angular.json) for example is `/en`
|
|
691
|
-
// and the URL is `/test#anchor` - then `_locationStrategy.path(true)` will return `/en/test#anchor`,
|
|
692
|
-
// but `/en/test#anchor` is not known to the Angular's router, so we have to strip `/en`
|
|
693
|
-
// from the URL
|
|
694
|
-
/** @type {?} */
|
|
695
|
-
var currentUrl = _this._location.normalize(_this._locationStrategy.path(true));
|
|
696
|
-
/** @type {?} */
|
|
697
|
-
var currentUrlTree = _this._urlSerializer.parse(currentUrl);
|
|
698
|
-
// We need to serialize the URL because in that example `/test/?redirect=https://google.com/`
|
|
699
|
-
// Angular will recognize it as `/test?redirect=https:%2F%2Fwww.google.com%2F`
|
|
700
|
-
// so we have to run the `currentUrl` via the `UrlSerializer` that will encode characters
|
|
701
|
-
/** @type {?} */
|
|
702
|
-
var currentSerializedUrl = _this._urlSerializer.serialize(currentUrlTree);
|
|
703
|
-
// If URLs differ from each other - we've got to perform a redirect to the manually entered URL
|
|
704
|
-
// in the address bar, as it must have a priority
|
|
705
|
-
if (currentSerializedUrl !== url) {
|
|
706
|
-
_this._router.navigateByUrl(currentUrl);
|
|
707
|
-
}
|
|
708
|
-
}));
|
|
709
|
-
this._subscription.add(subscription);
|
|
710
|
-
};
|
|
711
626
|
var RouterState_1;
|
|
712
627
|
RouterState.ctorParameters = function () { return [
|
|
713
628
|
{ type: Store },
|
|
714
629
|
{ type: Router },
|
|
715
630
|
{ type: RouterStateSerializer },
|
|
716
|
-
{ type: NgZone }
|
|
717
|
-
{ type: UrlSerializer },
|
|
718
|
-
{ type: LocationStrategy },
|
|
719
|
-
{ type: Location }
|
|
631
|
+
{ type: NgZone }
|
|
720
632
|
]; };
|
|
721
633
|
RouterState.decorators = [
|
|
722
634
|
{ type: Injectable }
|
|
@@ -726,10 +638,7 @@ var RouterState = /** @class */ (function () {
|
|
|
726
638
|
{ type: Store },
|
|
727
639
|
{ type: Router },
|
|
728
640
|
{ type: RouterStateSerializer },
|
|
729
|
-
{ type: NgZone }
|
|
730
|
-
{ type: UrlSerializer },
|
|
731
|
-
{ type: LocationStrategy },
|
|
732
|
-
{ type: Location }
|
|
641
|
+
{ type: NgZone }
|
|
733
642
|
]; };
|
|
734
643
|
__decorate([
|
|
735
644
|
Action(Navigate),
|
|
@@ -767,10 +676,7 @@ var RouterState = /** @class */ (function () {
|
|
|
767
676
|
__metadata("design:paramtypes", [Store,
|
|
768
677
|
Router,
|
|
769
678
|
RouterStateSerializer,
|
|
770
|
-
NgZone
|
|
771
|
-
UrlSerializer,
|
|
772
|
-
LocationStrategy,
|
|
773
|
-
Location])
|
|
679
|
+
NgZone])
|
|
774
680
|
], RouterState);
|
|
775
681
|
return RouterState;
|
|
776
682
|
}());
|
|
@@ -824,21 +730,6 @@ if (false) {
|
|
|
824
730
|
* @private
|
|
825
731
|
*/
|
|
826
732
|
RouterState.prototype._ngZone;
|
|
827
|
-
/**
|
|
828
|
-
* @type {?}
|
|
829
|
-
* @private
|
|
830
|
-
*/
|
|
831
|
-
RouterState.prototype._urlSerializer;
|
|
832
|
-
/**
|
|
833
|
-
* @type {?}
|
|
834
|
-
* @private
|
|
835
|
-
*/
|
|
836
|
-
RouterState.prototype._locationStrategy;
|
|
837
|
-
/**
|
|
838
|
-
* @type {?}
|
|
839
|
-
* @private
|
|
840
|
-
*/
|
|
841
|
-
RouterState.prototype._location;
|
|
842
733
|
}
|
|
843
734
|
|
|
844
735
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-router-plugin.js","sources":["ng://@ngxs/router-plugin/src/router.actions.ts","ng://@ngxs/router-plugin/src/serializer.ts","ng://@ngxs/router-plugin/src/router.state.ts","ng://@ngxs/router-plugin/src/router.module.ts"],"sourcesContent":["import {\n NavigationCancel,\n NavigationError,\n NavigationExtras,\n Params,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd\n} from '@angular/router';\n\nimport { RouterTrigger } from './router.state';\n\n/**\n * Public event api of the router\n */\nexport class Navigate {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] Navigate';\n }\n constructor(\n public path: any[],\n public queryParams?: Params,\n public extras?: NavigationExtras\n ) {}\n}\n\n/**\n *\n * Angular Routers internal state events\n *\n */\n\n/**\n * An action dispatched when the router navigates.\n */\nexport class RouterNavigation<T = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterNavigation';\n }\n constructor(\n public routerState: T,\n public event: RoutesRecognized,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router cancel navigation.\n */\nexport class RouterCancel<T, V = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterCancel';\n }\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationCancel,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router errors.\n */\nexport class RouterError<T, V = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterError';\n }\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationError,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the `ResolveEnd` event is triggered.\n */\nexport class RouterDataResolved<T = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterDataResolved';\n }\n constructor(\n public routerState: T,\n public event: ResolveEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An union type of router actions.\n */\nexport type RouterAction<T, V = RouterStateSnapshot> =\n | RouterNavigation<V>\n | RouterCancel<T, V>\n | RouterError<T, V>\n | RouterDataResolved<V>;\n","import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\n\nexport abstract class RouterStateSerializer<T> {\n abstract serialize(routerState: RouterStateSnapshot): T;\n}\n\nexport interface SerializedRouterStateSnapshot {\n root: ActivatedRouteSnapshot;\n url: string;\n}\n\nexport class DefaultRouterStateSerializer\n implements RouterStateSerializer<SerializedRouterStateSnapshot> {\n serialize(routerState: RouterStateSnapshot): SerializedRouterStateSnapshot {\n return {\n root: this.serializeRoute(routerState.root),\n url: routerState.url\n };\n }\n\n private serializeRoute(route: ActivatedRouteSnapshot): ActivatedRouteSnapshot {\n const children = route.children.map(c => this.serializeRoute(c));\n return {\n url: route.url,\n params: route.params,\n queryParams: route.queryParams,\n fragment: route.fragment,\n data: route.data,\n outlet: route.outlet,\n component: null,\n routeConfig: null,\n root: null as any,\n parent: null,\n firstChild: children[0],\n children: children,\n pathFromRoot: null as any,\n paramMap: route.paramMap,\n queryParamMap: route.queryParamMap,\n toString: route.toString\n };\n }\n}\n","import { NgZone, Injectable, OnDestroy } from '@angular/core';\nimport {\n NavigationCancel,\n NavigationError,\n Router,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n UrlSerializer,\n NavigationStart,\n NavigationEnd\n} from '@angular/router';\nimport { LocationStrategy, Location } from '@angular/common';\nimport { Action, Selector, State, StateContext, Store } from '@ngxs/store';\nimport { isAngularInTestMode } from '@ngxs/store/internals';\nimport { Subscription } from 'rxjs';\nimport { first } from 'rxjs/operators';\n\nimport {\n Navigate,\n RouterAction,\n RouterCancel,\n RouterError,\n RouterNavigation,\n RouterDataResolved\n} from './router.actions';\nimport { RouterStateSerializer } from './serializer';\n\nexport interface RouterStateModel<T = RouterStateSnapshot> {\n state?: T;\n navigationId?: number;\n trigger: RouterTrigger;\n}\n\nexport type RouterTrigger =\n | 'none'\n | 'router'\n | 'store'\n // The `devtools` trigger means that the state change has been triggered by Redux DevTools (e.g. when the time-traveling is used).\n | 'devtools';\n\n/**\n * @description Will be provided through Terser global definitions by Angular CLI\n * during the production build. This is how Angular does tree-shaking internally.\n */\ndeclare const ngDevMode: boolean;\n\n@State<RouterStateModel>({\n name: 'router',\n defaults: {\n state: undefined,\n navigationId: undefined,\n trigger: 'none'\n }\n})\n@Injectable()\nexport class RouterState implements OnDestroy {\n /**\n * Determines how navigation was performed by the `RouterState` itself\n * or outside via `new Navigate(...)`\n */\n private _trigger: RouterTrigger = 'none';\n\n /**\n * That's the serialized state from the `Router` class\n */\n private _routerState: RouterStateSnapshot | null = null;\n\n /**\n * That's the value of the `RouterState` state\n */\n private _storeState: RouterStateModel | null = null;\n\n private _lastRoutesRecognized: RoutesRecognized = null!;\n\n private _subscription = new Subscription();\n\n @Selector()\n static state<T = RouterStateSnapshot>(state: RouterStateModel<T>) {\n return state && state.state;\n }\n\n @Selector()\n static url(state: RouterStateModel): string | undefined {\n return state && state.state && state.state.url;\n }\n\n constructor(\n private _store: Store,\n private _router: Router,\n private _serializer: RouterStateSerializer<RouterStateSnapshot>,\n private _ngZone: NgZone,\n private _urlSerializer: UrlSerializer,\n private _locationStrategy: LocationStrategy,\n private _location: Location\n ) {\n this.setUpStoreListener();\n this.setUpRouterEventsListener();\n this.checkInitialNavigationOnce();\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n @Action(Navigate)\n navigate(_: StateContext<RouterStateModel>, action: Navigate) {\n return this._ngZone.run(() =>\n this._router.navigate(action.path, {\n queryParams: action.queryParams,\n ...action.extras\n })\n );\n }\n\n @Action([RouterNavigation, RouterError, RouterCancel, RouterDataResolved])\n angularRouterAction(\n ctx: StateContext<RouterStateModel>,\n action: RouterAction<RouterStateModel, RouterStateSnapshot>\n ): void {\n ctx.setState({\n ...ctx.getState(),\n trigger: action.trigger,\n state: action.routerState,\n navigationId: action.event.id\n });\n }\n\n private setUpStoreListener(): void {\n const subscription = this._store\n .select(RouterState)\n .subscribe((state: RouterStateModel | undefined) => {\n this.navigateIfNeeded(state);\n });\n\n this._subscription.add(subscription);\n }\n\n private setUpRouterEventsListener(): void {\n const subscription = this._router.events.subscribe(event => {\n if (event instanceof NavigationStart) {\n this.navigationStart();\n } else if (event instanceof RoutesRecognized) {\n this._lastRoutesRecognized = event;\n } else if (event instanceof ResolveEnd) {\n this.dispatchRouterDataResolved(event);\n } else if (event instanceof NavigationCancel) {\n this.dispatchRouterCancel(event);\n this.reset();\n } else if (event instanceof NavigationError) {\n this.dispatchRouterError(event);\n this.reset();\n } else if (event instanceof NavigationEnd) {\n this.navigationEnd();\n this.reset();\n }\n });\n\n this._subscription.add(subscription);\n }\n\n private navigationStart(): void {\n this._routerState = this._serializer.serialize(this._router.routerState.snapshot);\n\n if (this._trigger !== 'none') {\n this._storeState = this._store.selectSnapshot(RouterState);\n }\n }\n\n private navigationEnd(): void {\n if (this.shouldDispatchRouterNavigation()) {\n this.dispatchRouterNavigation();\n }\n }\n\n private shouldDispatchRouterNavigation(): boolean {\n if (!this._storeState) return true;\n return this._trigger !== 'store';\n }\n\n private navigateIfNeeded(state: RouterStateModel | undefined): void {\n if (state && state.trigger === 'devtools') {\n this._storeState = this._store.selectSnapshot(RouterState);\n }\n\n const canSkipNavigation =\n !this._storeState ||\n !this._storeState.state ||\n !state ||\n state.trigger === 'router' ||\n this._router.url === this._storeState.state.url;\n\n if (canSkipNavigation) {\n return;\n }\n\n this._trigger = 'store';\n this._ngZone.run(() => {\n this._router.navigateByUrl(this._storeState!.state!.url);\n });\n }\n\n private dispatchRouterNavigation(): void {\n const nextRouterState = this._serializer.serialize(this._lastRoutesRecognized.state);\n\n this.dispatchRouterAction(\n new RouterNavigation(\n nextRouterState,\n new RoutesRecognized(\n this._lastRoutesRecognized.id,\n this._lastRoutesRecognized.url,\n this._lastRoutesRecognized.urlAfterRedirects,\n nextRouterState\n ),\n this._trigger\n )\n );\n }\n\n private dispatchRouterCancel(event: NavigationCancel): void {\n this.dispatchRouterAction(\n new RouterCancel(this._routerState!, this._storeState, event, this._trigger)\n );\n }\n\n private dispatchRouterError(event: NavigationError): void {\n this.dispatchRouterAction(\n new RouterError(\n this._routerState!,\n this._storeState,\n new NavigationError(event.id, event.url, `${event}`),\n this._trigger\n )\n );\n }\n\n private dispatchRouterAction<T>(action: RouterAction<T>): void {\n this._trigger = 'router';\n\n try {\n this._store.dispatch(action);\n } finally {\n this._trigger = 'none';\n }\n }\n\n private dispatchRouterDataResolved(event: ResolveEnd): void {\n const routerState = this._serializer.serialize(event.state);\n this.dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));\n }\n\n private reset(): void {\n this._trigger = 'none';\n this._storeState = null;\n this._routerState = null;\n }\n\n /**\n * No sense to mess up the `setUpRouterEventsListener` method as we have\n * to perform this check only once and unsubscribe after the first event\n * is triggered\n */\n private checkInitialNavigationOnce(): void {\n // Caretaker note: we have still left the `typeof` condition in order to avoid\n // creating a breaking change for projects that still use the View Engine.\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n // Angular is running tests in development mode thus we can be sure that this method will be\n // skipped in tests.\n isAngularInTestMode()\n ) {\n return;\n }\n\n const subscription = this._router.events\n .pipe(first((event): event is RoutesRecognized => event instanceof RoutesRecognized))\n .subscribe(({ url }) => {\n // `location.pathname` always equals manually entered URL in the address bar\n // e.g. `location.pathname === '/foo'`, but the `router` state has been initialized\n // with another URL (e.g. used in combination with `NgxsStoragePlugin`), thus the\n // `RouterNavigation` action will be dispatched and the user will be redirected to the\n // previously saved URL. We want to prevent such behavior, so we perform this check\n\n // `url` is a recognized URL by the Angular's router, while `currentUrl` is an actual URL\n // entered in the browser's address bar\n // `PathLocationStrategy.prototype.path()` returns a concatenation of\n // `PlatformLocation.pathname` and normalized `PlatformLocation.search`.\n\n // `Location.prototype.normalize` strips base href from the URL,\n // if `baseHref` (declared in angular.json) for example is `/en`\n // and the URL is `/test#anchor` - then `_locationStrategy.path(true)` will return `/en/test#anchor`,\n // but `/en/test#anchor` is not known to the Angular's router, so we have to strip `/en`\n // from the URL\n const currentUrl = this._location.normalize(this._locationStrategy.path(true));\n const currentUrlTree = this._urlSerializer.parse(currentUrl);\n // We need to serialize the URL because in that example `/test/?redirect=https://google.com/`\n // Angular will recognize it as `/test?redirect=https:%2F%2Fwww.google.com%2F`\n // so we have to run the `currentUrl` via the `UrlSerializer` that will encode characters\n const currentSerializedUrl = this._urlSerializer.serialize(currentUrlTree);\n\n // If URLs differ from each other - we've got to perform a redirect to the manually entered URL\n // in the address bar, as it must have a priority\n if (currentSerializedUrl !== url) {\n this._router.navigateByUrl(currentUrl);\n }\n });\n\n this._subscription.add(subscription);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NgxsModule } from '@ngxs/store';\n\nimport { RouterState } from './router.state';\nimport { DefaultRouterStateSerializer, RouterStateSerializer } from './serializer';\n\n@NgModule({\n imports: [NgxsModule.forFeature([RouterState])]\n})\nexport class NgxsRouterPluginModule {\n static forRoot(): ModuleWithProviders<NgxsRouterPluginModule> {\n return {\n ngModule: NgxsRouterPluginModule,\n providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]\n };\n }\n}\n"],"names":["tslib_1.__decorate"],"mappings":";;;;;;;;;;;;;;;;AAeA;;;;IAKE,kBACS,IAAW,EACX,WAAoB,EACpB,MAAyB;QAFzB,SAAI,GAAJ,IAAI,CAAO;QACX,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAmB;KAC9B;IARJ,sBAAW,gBAAI;;;;QAAf;;YAEE,OAAO,mBAAmB,CAAC;SAC5B;;;OAAA;IAMH,eAAC;CAAA,IAAA;;;IAJG,wBAAkB;;IAClB,+BAA2B;;IAC3B,0BAAgC;;;;;;;;;;;AAapC;;;;;;;;;;IAKE,0BACS,WAAc,EACd,KAAuB,EACvB,OAA+B;QAA/B,wBAAA,EAAA,gBAA+B;QAF/B,gBAAW,GAAX,WAAW,CAAG;QACd,UAAK,GAAL,KAAK,CAAkB;QACvB,YAAO,GAAP,OAAO,CAAwB;KACpC;IARJ,sBAAW,wBAAI;;;;QAAf;;YAEE,OAAO,2BAA2B,CAAC;SACpC;;;OAAA;IAMH,uBAAC;CAAA,IAAA;;;IAJG,uCAAq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WAAW,CAAC,CAAC,CAAC;iBAChD;;IAQD,6BAAC;CAVD;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-router-plugin.js","sources":["ng://@ngxs/router-plugin/src/router.actions.ts","ng://@ngxs/router-plugin/src/serializer.ts","ng://@ngxs/router-plugin/src/router.state.ts","ng://@ngxs/router-plugin/src/router.module.ts"],"sourcesContent":["import {\n NavigationCancel,\n NavigationError,\n NavigationExtras,\n Params,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd\n} from '@angular/router';\n\nimport { RouterTrigger } from './router.state';\n\n/**\n * Public event api of the router\n */\nexport class Navigate {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] Navigate';\n }\n constructor(\n public path: any[],\n public queryParams?: Params,\n public extras?: NavigationExtras\n ) {}\n}\n\n/**\n *\n * Angular Routers internal state events\n *\n */\n\n/**\n * An action dispatched when the router navigates.\n */\nexport class RouterNavigation<T = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterNavigation';\n }\n constructor(\n public routerState: T,\n public event: RoutesRecognized,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router cancel navigation.\n */\nexport class RouterCancel<T, V = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterCancel';\n }\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationCancel,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router errors.\n */\nexport class RouterError<T, V = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterError';\n }\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationError,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the `ResolveEnd` event is triggered.\n */\nexport class RouterDataResolved<T = RouterStateSnapshot> {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Router] RouterDataResolved';\n }\n constructor(\n public routerState: T,\n public event: ResolveEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An union type of router actions.\n */\nexport type RouterAction<T, V = RouterStateSnapshot> =\n | RouterNavigation<V>\n | RouterCancel<T, V>\n | RouterError<T, V>\n | RouterDataResolved<V>;\n","import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\n\nexport abstract class RouterStateSerializer<T> {\n abstract serialize(routerState: RouterStateSnapshot): T;\n}\n\nexport interface SerializedRouterStateSnapshot {\n root: ActivatedRouteSnapshot;\n url: string;\n}\n\nexport class DefaultRouterStateSerializer\n implements RouterStateSerializer<SerializedRouterStateSnapshot> {\n serialize(routerState: RouterStateSnapshot): SerializedRouterStateSnapshot {\n return {\n root: this.serializeRoute(routerState.root),\n url: routerState.url\n };\n }\n\n private serializeRoute(route: ActivatedRouteSnapshot): ActivatedRouteSnapshot {\n const children = route.children.map(c => this.serializeRoute(c));\n return {\n url: route.url,\n params: route.params,\n queryParams: route.queryParams,\n fragment: route.fragment,\n data: route.data,\n outlet: route.outlet,\n component: null,\n routeConfig: null,\n root: null as any,\n parent: null,\n firstChild: children[0],\n children: children,\n pathFromRoot: null as any,\n paramMap: route.paramMap,\n queryParamMap: route.queryParamMap,\n toString: route.toString\n };\n }\n}\n","import { NgZone, Injectable, OnDestroy } from '@angular/core';\nimport {\n NavigationCancel,\n NavigationError,\n Router,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n NavigationStart,\n NavigationEnd\n} from '@angular/router';\nimport { Action, Selector, State, StateContext, Store } from '@ngxs/store';\nimport { Subscription } from 'rxjs';\n\nimport {\n Navigate,\n RouterAction,\n RouterCancel,\n RouterError,\n RouterNavigation,\n RouterDataResolved\n} from './router.actions';\nimport { RouterStateSerializer } from './serializer';\n\nexport interface RouterStateModel<T = RouterStateSnapshot> {\n state?: T;\n navigationId?: number;\n trigger: RouterTrigger;\n}\n\nexport type RouterTrigger =\n | 'none'\n | 'router'\n | 'store'\n // The `devtools` trigger means that the state change has been triggered by Redux DevTools (e.g. when the time-traveling is used).\n | 'devtools';\n\n@State<RouterStateModel>({\n name: 'router',\n defaults: {\n state: undefined,\n navigationId: undefined,\n trigger: 'none'\n }\n})\n@Injectable()\nexport class RouterState implements OnDestroy {\n /**\n * Determines how navigation was performed by the `RouterState` itself\n * or outside via `new Navigate(...)`\n */\n private _trigger: RouterTrigger = 'none';\n\n /**\n * That's the serialized state from the `Router` class\n */\n private _routerState: RouterStateSnapshot | null = null;\n\n /**\n * That's the value of the `RouterState` state\n */\n private _storeState: RouterStateModel | null = null;\n\n private _lastRoutesRecognized: RoutesRecognized = null!;\n\n private _subscription = new Subscription();\n\n @Selector()\n static state<T = RouterStateSnapshot>(state: RouterStateModel<T>) {\n return state && state.state;\n }\n\n @Selector()\n static url(state: RouterStateModel): string | undefined {\n return state && state.state && state.state.url;\n }\n\n constructor(\n private _store: Store,\n private _router: Router,\n private _serializer: RouterStateSerializer<RouterStateSnapshot>,\n private _ngZone: NgZone\n ) {\n this.setUpStoreListener();\n this.setUpRouterEventsListener();\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n @Action(Navigate)\n navigate(_: StateContext<RouterStateModel>, action: Navigate) {\n return this._ngZone.run(() =>\n this._router.navigate(action.path, {\n queryParams: action.queryParams,\n ...action.extras\n })\n );\n }\n\n @Action([RouterNavigation, RouterError, RouterCancel, RouterDataResolved])\n angularRouterAction(\n ctx: StateContext<RouterStateModel>,\n action: RouterAction<RouterStateModel, RouterStateSnapshot>\n ): void {\n ctx.setState({\n ...ctx.getState(),\n trigger: action.trigger,\n state: action.routerState,\n navigationId: action.event.id\n });\n }\n\n private setUpStoreListener(): void {\n const subscription = this._store\n .select(RouterState)\n .subscribe((state: RouterStateModel | undefined) => {\n this.navigateIfNeeded(state);\n });\n\n this._subscription.add(subscription);\n }\n\n private setUpRouterEventsListener(): void {\n const subscription = this._router.events.subscribe(event => {\n if (event instanceof NavigationStart) {\n this.navigationStart();\n } else if (event instanceof RoutesRecognized) {\n this._lastRoutesRecognized = event;\n } else if (event instanceof ResolveEnd) {\n this.dispatchRouterDataResolved(event);\n } else if (event instanceof NavigationCancel) {\n this.dispatchRouterCancel(event);\n this.reset();\n } else if (event instanceof NavigationError) {\n this.dispatchRouterError(event);\n this.reset();\n } else if (event instanceof NavigationEnd) {\n this.navigationEnd();\n this.reset();\n }\n });\n\n this._subscription.add(subscription);\n }\n\n private navigationStart(): void {\n this._routerState = this._serializer.serialize(this._router.routerState.snapshot);\n\n if (this._trigger !== 'none') {\n this._storeState = this._store.selectSnapshot(RouterState);\n }\n }\n\n private navigationEnd(): void {\n if (this.shouldDispatchRouterNavigation()) {\n this.dispatchRouterNavigation();\n }\n }\n\n private shouldDispatchRouterNavigation(): boolean {\n if (!this._storeState) return true;\n return this._trigger !== 'store';\n }\n\n private navigateIfNeeded(state: RouterStateModel | undefined): void {\n if (state && state.trigger === 'devtools') {\n this._storeState = this._store.selectSnapshot(RouterState);\n }\n\n const canSkipNavigation =\n !this._storeState ||\n !this._storeState.state ||\n !state ||\n state.trigger === 'router' ||\n this._router.url === this._storeState.state.url;\n\n if (canSkipNavigation) {\n return;\n }\n\n this._trigger = 'store';\n this._ngZone.run(() => {\n this._router.navigateByUrl(this._storeState!.state!.url);\n });\n }\n\n private dispatchRouterNavigation(): void {\n const nextRouterState = this._serializer.serialize(this._lastRoutesRecognized.state);\n\n this.dispatchRouterAction(\n new RouterNavigation(\n nextRouterState,\n new RoutesRecognized(\n this._lastRoutesRecognized.id,\n this._lastRoutesRecognized.url,\n this._lastRoutesRecognized.urlAfterRedirects,\n nextRouterState\n ),\n this._trigger\n )\n );\n }\n\n private dispatchRouterCancel(event: NavigationCancel): void {\n this.dispatchRouterAction(\n new RouterCancel(this._routerState!, this._storeState, event, this._trigger)\n );\n }\n\n private dispatchRouterError(event: NavigationError): void {\n this.dispatchRouterAction(\n new RouterError(\n this._routerState!,\n this._storeState,\n new NavigationError(event.id, event.url, `${event}`),\n this._trigger\n )\n );\n }\n\n private dispatchRouterAction<T>(action: RouterAction<T>): void {\n this._trigger = 'router';\n\n try {\n this._store.dispatch(action);\n } finally {\n this._trigger = 'none';\n }\n }\n\n private dispatchRouterDataResolved(event: ResolveEnd): void {\n const routerState = this._serializer.serialize(event.state);\n this.dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));\n }\n\n private reset(): void {\n this._trigger = 'none';\n this._storeState = null;\n this._routerState = null;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NgxsModule } from '@ngxs/store';\n\nimport { RouterState } from './router.state';\nimport { DefaultRouterStateSerializer, RouterStateSerializer } from './serializer';\n\n@NgModule({\n imports: [NgxsModule.forFeature([RouterState])]\n})\nexport class NgxsRouterPluginModule {\n static forRoot(): ModuleWithProviders<NgxsRouterPluginModule> {\n return {\n ngModule: NgxsRouterPluginModule,\n providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]\n };\n }\n}\n"],"names":["tslib_1.__decorate"],"mappings":";;;;;;;;;;;;;AAeA;;;;IAKE,kBACS,IAAW,EACX,WAAoB,EACpB,MAAyB;QAFzB,SAAI,GAAJ,IAAI,CAAO;QACX,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAmB;KAC9B;IARJ,sBAAW,gBAAI;;;;QAAf;;YAEE,OAAO,mBAAmB,CAAC;SAC5B;;;OAAA;IAMH,eAAC;CAAA,IAAA;;;IAJG,wBAAkB;;IAClB,+BAA2B;;IAC3B,0BAAgC;;;;;;;;;;;AAapC;;;;;;;;;;IAKE,0BACS,WAAc,EAC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B;;;;;IACvB,kCAA+D;;;;;IAC/D,8BAAuB;;;;;;;ACjF3B;IAMA;KAUC;;;;IANQ,8BAAO;;;IAAd;QACE,OAAO;YACL,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,EAAE,CAAC;SACxF,CAAC;KACH;;gBATF,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;iBAChD;;IAQD,6BAAC;CAVD;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"interface"},"NgxsRouterPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":7,"character":12},"member":"forFeature"},"arguments":[[{"__symbolic":"reference","name":"RouterState"}]]}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsRouterPluginModule"},"providers":[{"provide":{"__symbolic":"reference","name":"RouterStateSerializer"},"useClass":{"__symbolic":"reference","name":"DefaultRouterStateSerializer"}}]}}}},"RouterState":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"State","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"interface"},"NgxsRouterPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":7,"character":12},"member":"forFeature"},"arguments":[[{"__symbolic":"reference","name":"RouterState"}]]}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsRouterPluginModule"},"providers":[{"provide":{"__symbolic":"reference","name":"RouterStateSerializer"},"useClass":{"__symbolic":"reference","name":"DefaultRouterStateSerializer"}}]}}}},"RouterState":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"State","line":37,"character":1},"arguments":[{"name":"router","defaults":{"state":{"__symbolic":"reference","name":"undefined"},"navigationId":{"__symbolic":"reference","name":"undefined"},"trigger":"none"}}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":45,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":78,"character":20},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":79,"character":21},{"__symbolic":"reference","name":"RouterStateSerializer"},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":81,"character":21}]}],"ngOnDestroy":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":91,"character":3},"arguments":[{"__symbolic":"reference","name":"Navigate"}]}]}],"angularRouterAction":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":101,"character":3},"arguments":[[{"__symbolic":"reference","name":"RouterNavigation"},{"__symbolic":"reference","name":"RouterError"},{"__symbolic":"reference","name":"RouterCancel"},{"__symbolic":"reference","name":"RouterDataResolved"}]]}]}],"setUpStoreListener":[{"__symbolic":"method"}],"setUpRouterEventsListener":[{"__symbolic":"method"}],"navigationStart":[{"__symbolic":"method"}],"navigationEnd":[{"__symbolic":"method"}],"shouldDispatchRouterNavigation":[{"__symbolic":"method"}],"navigateIfNeeded":[{"__symbolic":"method"}],"dispatchRouterNavigation":[{"__symbolic":"method"}],"dispatchRouterCancel":[{"__symbolic":"method"}],"dispatchRouterError":[{"__symbolic":"method"}],"dispatchRouterAction":[{"__symbolic":"method"}],"dispatchRouterDataResolved":[{"__symbolic":"method"}],"reset":[{"__symbolic":"method"}]},"statics":{"state":{"__symbolic":"function","parameters":["state"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"reference","name":"state"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"state"},"member":"state"}}},"url":{"__symbolic":"function","parameters":["state"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"reference","name":"state"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"state"},"member":"state"}},"right":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"state"},"member":"state"},"member":"url"}}}}},"RouterStateModel":{"__symbolic":"interface"},"RouterStateSerializer":{"__symbolic":"class","arity":1,"members":{"serialize":[{"__symbolic":"method"}]}},"DefaultRouterStateSerializer":{"__symbolic":"class","members":{"serialize":[{"__symbolic":"method"}],"serializeRoute":[{"__symbolic":"method"}]}},"SerializedRouterStateSnapshot":{"__symbolic":"interface"},"Navigate":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/router","name":"Params","line":22,"character":25},{"__symbolic":"reference","module":"@angular/router","name":"NavigationExtras","line":23,"character":20}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":13}}},"RouterNavigation":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":42,"character":24,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"RoutesRecognized","line":43,"character":18},{"__symbolic":"reference","name":"ɵa"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":37,"character":13}}},"RouterCancel":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":57,"character":24,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":58,"character":23,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationCancel","line":59,"character":18},{"__symbolic":"reference","name":"ɵa"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":52,"character":13}}},"RouterError":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":73,"character":24,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":74,"character":23,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationError","line":75,"character":18},{"__symbolic":"reference","name":"ɵa"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":68,"character":13}}},"RouterDataResolved":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":89,"character":24,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"ResolveEnd","line":90,"character":18},{"__symbolic":"reference","name":"ɵa"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":84,"character":13}}},"RouterAction":{"__symbolic":"interface"}},"origins":{"ɵa":"./src/router.state","NgxsRouterPluginModule":"./src/router.module","RouterState":"./src/router.state","RouterStateModel":"./src/router.state","RouterStateSerializer":"./src/serializer","DefaultRouterStateSerializer":"./src/serializer","SerializedRouterStateSnapshot":"./src/serializer","Navigate":"./src/router.actions","RouterNavigation":"./src/router.actions","RouterCancel":"./src/router.actions","RouterError":"./src/router.actions","RouterDataResolved":"./src/router.actions","RouterAction":"./src/router.actions"},"importAs":"@ngxs/router-plugin"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "../../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@ngxs/router-plugin",
|
|
4
4
|
"description": "router plugin for @ngxs/store",
|
|
5
|
-
"version": "3.7.4-dev.master-
|
|
5
|
+
"version": "3.7.4-dev.master-79cbc2a",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/core": ">=6.1.0 <15.0.0",
|
package/src/router.state.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NgZone, OnDestroy } from '@angular/core';
|
|
2
|
-
import { Router, RouterStateSnapshot
|
|
3
|
-
import { LocationStrategy, Location } from '@angular/common';
|
|
2
|
+
import { Router, RouterStateSnapshot } from '@angular/router';
|
|
4
3
|
import { StateContext, Store } from '@ngxs/store';
|
|
5
4
|
import { Navigate, RouterAction } from './router.actions';
|
|
6
5
|
import { RouterStateSerializer } from './serializer';
|
|
@@ -15,9 +14,6 @@ export declare class RouterState implements OnDestroy {
|
|
|
15
14
|
private _router;
|
|
16
15
|
private _serializer;
|
|
17
16
|
private _ngZone;
|
|
18
|
-
private _urlSerializer;
|
|
19
|
-
private _locationStrategy;
|
|
20
|
-
private _location;
|
|
21
17
|
/**
|
|
22
18
|
* Determines how navigation was performed by the `RouterState` itself
|
|
23
19
|
* or outside via `new Navigate(...)`
|
|
@@ -35,7 +31,7 @@ export declare class RouterState implements OnDestroy {
|
|
|
35
31
|
private _subscription;
|
|
36
32
|
static state<T = RouterStateSnapshot>(state: RouterStateModel<T>): T | undefined;
|
|
37
33
|
static url(state: RouterStateModel): string | undefined;
|
|
38
|
-
constructor(_store: Store, _router: Router, _serializer: RouterStateSerializer<RouterStateSnapshot>, _ngZone: NgZone
|
|
34
|
+
constructor(_store: Store, _router: Router, _serializer: RouterStateSerializer<RouterStateSnapshot>, _ngZone: NgZone);
|
|
39
35
|
ngOnDestroy(): void;
|
|
40
36
|
navigate(_: StateContext<RouterStateModel>, action: Navigate): Promise<boolean>;
|
|
41
37
|
angularRouterAction(ctx: StateContext<RouterStateModel>, action: RouterAction<RouterStateModel, RouterStateSnapshot>): void;
|
|
@@ -51,10 +47,4 @@ export declare class RouterState implements OnDestroy {
|
|
|
51
47
|
private dispatchRouterAction;
|
|
52
48
|
private dispatchRouterDataResolved;
|
|
53
49
|
private reset;
|
|
54
|
-
/**
|
|
55
|
-
* No sense to mess up the `setUpRouterEventsListener` method as we have
|
|
56
|
-
* to perform this check only once and unsubscribe after the first event
|
|
57
|
-
* is triggered
|
|
58
|
-
*/
|
|
59
|
-
private checkInitialNavigationOnce;
|
|
60
50
|
}
|