Socket
Socket
Sign inDemoInstall

@ngxs/router-plugin

Package Overview
Dependencies
Maintainers
2
Versions
1011
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngxs/router-plugin - npm Package Compare versions

Comparing version 3.0.0-dev.master-5555b7d to 3.0.0-dev.master-6337a19

esm2015/index.js

495

bundles/ngxs-router-plugin.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/router'), require('@ngxs/store'), require('rxjs/observable/of'), require('@angular/core')) :
typeof define === 'function' && define.amd ? define('@ngxs/router-plugin', ['exports', '@angular/router', '@ngxs/store', 'rxjs/observable/of', '@angular/core'], factory) :
(factory((global.ngxs = global.ngxs || {}, global.ngxs['router-plugin'] = {}),global.ng.router,global['ngxs-store'],global.Rx.Observable,global.ng.core));
}(this, (function (exports,router,store,of,core) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@angular/router'), require('@ngxs/store'), require('rxjs'), require('@angular/core')) :
typeof define === 'function' && define.amd ? define('@ngxs/router-plugin', ['exports', 'tslib', '@angular/router', '@ngxs/store', 'rxjs', '@angular/core'], factory) :
(factory((global.ngxs = global.ngxs || {}, global.ngxs['router-plugin'] = {}),global.tslib,global.ng.router,global['ngxs-store'],global.rxjs,global.ng.core));
}(this, (function (exports,tslib,router,store,rxjs,core) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
var RouterStateSerializer = /** @class */ (function () {
function RouterStateSerializer() {
}
return RouterStateSerializer;
}());
var DefaultRouterStateSerializer = /** @class */ (function () {
function DefaultRouterStateSerializer() {
}
DefaultRouterStateSerializer.prototype.serialize = function (routerState) {
return {
root: this.serializeRoute(routerState.root),
url: routerState.url
var RouterStateSerializer = (function () {
function RouterStateSerializer() {
}
return RouterStateSerializer;
}());
var DefaultRouterStateSerializer = (function () {
function DefaultRouterStateSerializer() {
}
DefaultRouterStateSerializer.prototype.serialize = function (routerState) {
return {
root: this.serializeRoute(routerState.root),
url: routerState.url
};
};
};
DefaultRouterStateSerializer.prototype.serializeRoute = function (route) {
var _this = this;
var children = route.children.map(function (c) { return _this.serializeRoute(c); });
return {
url: route.url,
params: route.params,
queryParams: route.queryParams,
fragment: route.fragment,
data: route.data,
outlet: route.outlet,
component: route.routeConfig ? route.routeConfig.component : undefined,
routeConfig: null,
root: undefined,
parent: undefined,
firstChild: children[0],
children: children,
pathFromRoot: undefined,
paramMap: route.paramMap,
queryParamMap: route.queryParamMap,
toString: route.toString
DefaultRouterStateSerializer.prototype.serializeRoute = function (route) {
var _this = this;
var children = route.children.map(function (c) { return _this.serializeRoute(c); });
return {
url: route.url,
params: route.params,
queryParams: route.queryParams,
fragment: route.fragment,
data: route.data,
outlet: route.outlet,
component: route.routeConfig ? route.routeConfig.component : undefined,
routeConfig: null,
root: undefined,
parent: undefined,
firstChild: children[0],
children: children,
pathFromRoot: undefined,
paramMap: route.paramMap,
queryParamMap: route.queryParamMap,
toString: route.toString
};
};
};
return DefaultRouterStateSerializer;
}());
var Navigate = /** @class */ (function () {
function Navigate(path, queryParams, extras) {
this.path = path;
this.queryParams = queryParams;
this.extras = extras;
}
return Navigate;
}());
Navigate.type = '[Router] Navigate';
var RouterNavigation = /** @class */ (function () {
function RouterNavigation(routerState, event) {
this.routerState = routerState;
this.event = event;
}
return RouterNavigation;
}());
RouterNavigation.type = '[Router] RouterNavigation';
var RouterCancel = /** @class */ (function () {
function RouterCancel(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
return RouterCancel;
}());
RouterCancel.type = '[Router] RouterCancel';
var RouterError = /** @class */ (function () {
function RouterError(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
return RouterError;
}());
RouterError.type = '[Router] RouterError';
exports.RouterState = RouterState_1 = /** @class */ (function () {
function RouterState(store$$1, router$$1, serializer) {
this.store = store$$1;
this.router = router$$1;
this.serializer = serializer;
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
this.setUpRouterHook();
this.setUpStoreListener();
this.setUpStateRollbackEvents();
}
RouterState.state = function (state) {
return state && state.state;
};
RouterState.url = function (state) {
return state && state.state && state.state.url;
};
RouterState.prototype.setUpRouterHook = function () {
var _this = this;
this.router.hooks.beforePreactivation = function (routerStateSnapshot) {
_this.routerStateSnapshot = _this.serializer.serialize(routerStateSnapshot);
if (_this.shouldDispatchRouterNavigation())
_this.dispatchRouterNavigation();
return of.of(true);
};
};
RouterState.prototype.setUpStoreListener = function () {
var _this = this;
this.store.select(RouterState_1).subscribe(function (s) {
_this.routerState = s;
});
this.store.select(RouterState_1.state).subscribe(function () {
_this.navigateIfNeeded();
});
};
RouterState.prototype.setUpStateRollbackEvents = function () {
var _this = this;
this.router.events.subscribe(function (e) {
if (e instanceof router.RoutesRecognized) {
_this.lastRoutesRecognized = e;
}
else if (e instanceof router.NavigationCancel) {
_this.dispatchRouterCancel(e);
}
else if (e instanceof router.NavigationError) {
_this.dispatchRouterError(e);
}
});
};
RouterState.prototype.navigate = function (ctx, action) {
this.router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras));
};
RouterState.prototype.angularRouterAction = function (ctx, action) {
ctx.setState(Object.assign({}, ctx.getState(), { state: action.routerState, navigationId: action.event.id }));
};
RouterState.prototype.shouldDispatchRouterNavigation = function () {
if (!this.routerState)
return true;
return !this.navigationTriggeredByDispatch;
};
RouterState.prototype.navigateIfNeeded = function () {
if (!this.routerState || !this.routerState.state) {
return;
return DefaultRouterStateSerializer;
}());
/**
* Public event api of the router
*/
var Navigate = (function () {
function Navigate(path, queryParams, extras) {
this.path = path;
this.queryParams = queryParams;
this.extras = extras;
}
if (this.dispatchTriggeredByRouter)
return;
if (this.router.url !== this.routerState.state.url) {
this.navigationTriggeredByDispatch = true;
this.router.navigateByUrl(this.routerState.state.url);
return Navigate;
}());
Navigate.type = '[Router] Navigate';
/**
*
* Angular Routers internal state events
*
*/
/**
* An action dispatched when the router navigates.
*/
var RouterNavigation = (function () {
function RouterNavigation(routerState, event) {
this.routerState = routerState;
this.event = event;
}
};
RouterState.prototype.dispatchRouterNavigation = function () {
this.dispatchRouterAction(new RouterNavigation(this.routerStateSnapshot, new router.RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerStateSnapshot)));
};
RouterState.prototype.dispatchRouterCancel = function (event) {
this.dispatchRouterAction(new RouterCancel(this.routerStateSnapshot, this.routerState, event));
};
RouterState.prototype.dispatchRouterError = function (event) {
this.dispatchRouterAction(new RouterError(this.routerStateSnapshot, this.routerState, new router.NavigationError(event.id, event.url, "" + event)));
};
RouterState.prototype.dispatchRouterAction = function (action) {
this.dispatchTriggeredByRouter = true;
try {
this.store.dispatch(action);
return RouterNavigation;
}());
RouterNavigation.type = '[Router] RouterNavigation';
/**
* An action dispatched when the router cancel navigation.
*/
var RouterCancel = (function () {
function RouterCancel(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
finally {
return RouterCancel;
}());
RouterCancel.type = '[Router] RouterCancel';
/**
* An action dispatched when the router errors.
*/
var RouterError = (function () {
function RouterError(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
return RouterError;
}());
RouterError.type = '[Router] RouterError';
exports.RouterState = RouterState_1 = /** @class */ (function () {
function RouterState(store$$1, router$$1, serializer) {
this.store = store$$1;
this.router = router$$1;
this.serializer = serializer;
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
this.setUpRouterHook();
this.setUpStoreListener();
this.setUpStateRollbackEvents();
}
};
return RouterState;
}());
__decorate([
store.Action(Navigate),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Navigate]),
__metadata("design:returntype", void 0)
], exports.RouterState.prototype, "navigate", null);
__decorate([
store.Action([RouterNavigation, RouterError, RouterCancel]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", void 0)
], exports.RouterState.prototype, "angularRouterAction", null);
__decorate([
store.Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], exports.RouterState, "state", null);
__decorate([
store.Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", String)
], exports.RouterState, "url", null);
exports.RouterState = RouterState_1 = __decorate([
store.State({
name: 'router',
defaults: {
state: null,
navigationId: null
/**
* Selectors
*/
RouterState.state = function (state) {
return state && state.state;
};
RouterState.url = function (state) {
return state && state.state && state.state.url;
};
/**
* Hook into the angular router before each navigation action is performed
* since the route tree can be large, we serialize it into something more manageable
*/
RouterState.prototype.setUpRouterHook = function () {
var _this = this;
this.router.hooks.beforePreactivation = function (routerStateSnapshot) {
_this.routerStateSnapshot = _this.serializer.serialize(routerStateSnapshot);
if (_this.shouldDispatchRouterNavigation())
_this.dispatchRouterNavigation();
return rxjs.of(true);
};
};
RouterState.prototype.setUpStoreListener = function () {
var _this = this;
this.store.select(RouterState_1).subscribe(function (s) {
_this.routerState = s;
});
this.store.select(RouterState_1.state).subscribe(function () {
_this.navigateIfNeeded();
});
};
RouterState.prototype.setUpStateRollbackEvents = function () {
var _this = this;
this.router.events.subscribe(function (e) {
if (e instanceof router.RoutesRecognized) {
_this.lastRoutesRecognized = e;
}
else if (e instanceof router.NavigationCancel) {
_this.dispatchRouterCancel(e);
}
else if (e instanceof router.NavigationError) {
_this.dispatchRouterError(e);
}
});
};
RouterState.prototype.navigate = function (ctx, action) {
this.router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras));
};
RouterState.prototype.angularRouterAction = function (ctx, action) {
ctx.setState(Object.assign({}, ctx.getState(), { state: action.routerState, navigationId: action.event.id }));
};
RouterState.prototype.shouldDispatchRouterNavigation = function () {
if (!this.routerState)
return true;
return !this.navigationTriggeredByDispatch;
};
RouterState.prototype.navigateIfNeeded = function () {
if (!this.routerState || !this.routerState.state) {
return;
}
if (this.dispatchTriggeredByRouter)
return;
if (this.router.url !== this.routerState.state.url) {
this.navigationTriggeredByDispatch = true;
this.router.navigateByUrl(this.routerState.state.url);
}
};
RouterState.prototype.dispatchRouterNavigation = function () {
this.dispatchRouterAction(new RouterNavigation(this.routerStateSnapshot, new router.RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerStateSnapshot)));
};
RouterState.prototype.dispatchRouterCancel = function (event) {
this.dispatchRouterAction(new RouterCancel(this.routerStateSnapshot, this.routerState, event));
};
RouterState.prototype.dispatchRouterError = function (event) {
this.dispatchRouterAction(new RouterError(this.routerStateSnapshot, this.routerState, new router.NavigationError(event.id, event.url, "" + event)));
};
RouterState.prototype.dispatchRouterAction = function (action) {
this.dispatchTriggeredByRouter = true;
try {
this.store.dispatch(action);
}
finally {
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
}
};
return RouterState;
}());
tslib.__decorate([
store.Action(Navigate),
tslib.__metadata("design:type", Function),
tslib.__metadata("design:paramtypes", [Object, Navigate]),
tslib.__metadata("design:returntype", void 0)
], exports.RouterState.prototype, "navigate", null);
tslib.__decorate([
store.Action([RouterNavigation, RouterError, RouterCancel]),
tslib.__metadata("design:type", Function),
tslib.__metadata("design:paramtypes", [Object, Object]),
tslib.__metadata("design:returntype", void 0)
], exports.RouterState.prototype, "angularRouterAction", null);
tslib.__decorate([
store.Selector(),
tslib.__metadata("design:type", Function),
tslib.__metadata("design:paramtypes", [Object]),
tslib.__metadata("design:returntype", void 0)
], exports.RouterState, "state", null);
tslib.__decorate([
store.Selector(),
tslib.__metadata("design:type", Function),
tslib.__metadata("design:paramtypes", [Object]),
tslib.__metadata("design:returntype", String)
], exports.RouterState, "url", null);
exports.RouterState = RouterState_1 = tslib.__decorate([
store.State({
name: 'router',
defaults: {
state: null,
navigationId: null
}
}),
tslib.__metadata("design:paramtypes", [store.Store,
router.Router,
RouterStateSerializer])
], exports.RouterState);
var RouterState_1;
var routerFeatureModule = store.NgxsModule.forFeature([exports.RouterState]);
var NgxsRouterPluginModule = (function () {
function NgxsRouterPluginModule() {
}
}),
__metadata("design:paramtypes", [store.Store,
router.Router,
RouterStateSerializer])
], exports.RouterState);
var RouterState_1;
var routerFeatureModule = store.NgxsModule.forFeature([exports.RouterState]);
var NgxsRouterPluginModule = /** @class */ (function () {
function NgxsRouterPluginModule() {
}
NgxsRouterPluginModule.forRoot = function () {
return {
ngModule: NgxsRouterPluginModule,
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
NgxsRouterPluginModule.forRoot = function () {
return {
ngModule: NgxsRouterPluginModule,
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
};
};
};
return NgxsRouterPluginModule;
}());
NgxsRouterPluginModule.decorators = [
{ type: core.NgModule, args: [{
imports: [routerFeatureModule]
},] },
];
return NgxsRouterPluginModule;
}());
NgxsRouterPluginModule.decorators = [
{ type: core.NgModule, args: [{
imports: [routerFeatureModule]
},] },
];
exports.ɵa = routerFeatureModule;
exports.ɵc = DefaultRouterStateSerializer;
exports.ɵb = RouterStateSerializer;
exports.NgxsRouterPluginModule = NgxsRouterPluginModule;
exports.Navigate = Navigate;
exports.RouterNavigation = RouterNavigation;
exports.RouterCancel = RouterCancel;
exports.RouterError = RouterError;
exports.ɵa = routerFeatureModule;
exports.ɵc = DefaultRouterStateSerializer;
exports.ɵb = RouterStateSerializer;
exports.NgxsRouterPluginModule = NgxsRouterPluginModule;
exports.Navigate = Navigate;
exports.RouterNavigation = RouterNavigation;
exports.RouterCancel = RouterCancel;
exports.RouterError = RouterError;
Object.defineProperty(exports, '__esModule', { value: true });
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=ngxs-router-plugin.umd.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/router"),require("@ngxs/store"),require("rxjs/observable/of"),require("@angular/core")):"function"==typeof define&&define.amd?define("@ngxs/router-plugin",["exports","@angular/router","@ngxs/store","rxjs/observable/of","@angular/core"],e):e((t.ngxs=t.ngxs||{},t.ngxs["router-plugin"]={}),t.ng.router,t["ngxs-store"],t.Rx.Observable,t.ng.core)}(this,function(t,r,e,o,i){"use strict";function n(t,e,r,o){var i,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(n<3?i(a):3<n?i(e,r,a):i(e,r))||a);return 3<n&&a&&Object.defineProperty(e,r,a),a}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s=function(){},u=function(){function t(){}return t.prototype.serialize=function(t){return{root:this.serializeRoute(t.root),url:t.url}},t.prototype.serializeRoute=function(t){var e=this,r=t.children.map(function(t){return e.serializeRoute(t)});return{url:t.url,params:t.params,queryParams:t.queryParams,fragment:t.fragment,data:t.data,outlet:t.outlet,component:t.routeConfig?t.routeConfig.component:undefined,routeConfig:null,root:undefined,parent:undefined,firstChild:r[0],children:r,pathFromRoot:undefined,paramMap:t.paramMap,queryParamMap:t.queryParamMap,toString:t.toString}},t}(),c=function(t,e,r){this.path=t,this.queryParams=e,this.extras=r};c.type="[Router] Navigate";var p=function(t,e){this.routerState=t,this.event=e};p.type="[Router] RouterNavigation";var g=function(t,e,r){this.routerState=t,this.storeState=e,this.event=r};g.type="[Router] RouterCancel";var h,l=function(t,e,r){this.routerState=t,this.storeState=e,this.event=r};l.type="[Router] RouterError",t.RouterState=h=function(){function t(t,e,r){this.store=t,this.router=e,this.serializer=r,this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1,this.setUpRouterHook(),this.setUpStoreListener(),this.setUpStateRollbackEvents()}return t.state=function(t){return t&&t.state},t.url=function(t){return t&&t.state&&t.state.url},t.prototype.setUpRouterHook=function(){var e=this;this.router.hooks.beforePreactivation=function(t){return e.routerStateSnapshot=e.serializer.serialize(t),e.shouldDispatchRouterNavigation()&&e.dispatchRouterNavigation(),o.of(!0)}},t.prototype.setUpStoreListener=function(){var e=this;this.store.select(h).subscribe(function(t){e.routerState=t}),this.store.select(h.state).subscribe(function(){e.navigateIfNeeded()})},t.prototype.setUpStateRollbackEvents=function(){var e=this;this.router.events.subscribe(function(t){t instanceof r.RoutesRecognized?e.lastRoutesRecognized=t:t instanceof r.NavigationCancel?e.dispatchRouterCancel(t):t instanceof r.NavigationError&&e.dispatchRouterError(t)})},t.prototype.navigate=function(t,e){this.router.navigate(e.path,Object.assign({queryParams:e.queryParams},e.extras))},t.prototype.angularRouterAction=function(t,e){t.setState(Object.assign({},t.getState(),{state:e.routerState,navigationId:e.event.id}))},t.prototype.shouldDispatchRouterNavigation=function(){return!this.routerState||!this.navigationTriggeredByDispatch},t.prototype.navigateIfNeeded=function(){this.routerState&&this.routerState.state&&(this.dispatchTriggeredByRouter||this.router.url!==this.routerState.state.url&&(this.navigationTriggeredByDispatch=!0,this.router.navigateByUrl(this.routerState.state.url)))},t.prototype.dispatchRouterNavigation=function(){this.dispatchRouterAction(new p(this.routerStateSnapshot,new r.RoutesRecognized(this.lastRoutesRecognized.id,this.lastRoutesRecognized.url,this.lastRoutesRecognized.urlAfterRedirects,this.routerStateSnapshot)))},t.prototype.dispatchRouterCancel=function(t){this.dispatchRouterAction(new g(this.routerStateSnapshot,this.routerState,t))},t.prototype.dispatchRouterError=function(t){this.dispatchRouterAction(new l(this.routerStateSnapshot,this.routerState,new r.NavigationError(t.id,t.url,""+t)))},t.prototype.dispatchRouterAction=function(t){this.dispatchTriggeredByRouter=!0;try{this.store.dispatch(t)}finally{this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1}},t}(),n([e.Action(c),a("design:type",Function),a("design:paramtypes",[Object,c]),a("design:returntype",void 0)],t.RouterState.prototype,"navigate",null),n([e.Action([p,l,g]),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",void 0)],t.RouterState.prototype,"angularRouterAction",null),n([e.Selector(),a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.RouterState,"state",null),n([e.Selector(),a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",String)],t.RouterState,"url",null),t.RouterState=h=n([e.State({name:"router",defaults:{state:null,navigationId:null}}),a("design:paramtypes",[e.Store,r.Router,s])],t.RouterState);var d=e.NgxsModule.forFeature([t.RouterState]),f=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[{provide:s,useClass:u}]}},t}();f.decorators=[{type:i.NgModule,args:[{imports:[d]}]}],t.ɵa=d,t.ɵc=u,t.ɵb=s,t.NgxsRouterPluginModule=f,t.Navigate=c,t.RouterNavigation=p,t.RouterCancel=g,t.RouterError=l,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/router"),require("@ngxs/store"),require("rxjs"),require("@angular/core")):"function"==typeof define&&define.amd?define("@ngxs/router-plugin",["exports","tslib","@angular/router","@ngxs/store","rxjs","@angular/core"],e):e((t.ngxs=t.ngxs||{},t.ngxs["router-plugin"]={}),t.tslib,t.ng.router,t["ngxs-store"],t.rxjs,t.ng.core)}(this,function(t,e,r,o,a,i){"use strict";var n=function(){},s=function(){function t(){}return t.prototype.serialize=function(t){return{root:this.serializeRoute(t.root),url:t.url}},t.prototype.serializeRoute=function(t){var e=this,r=t.children.map(function(t){return e.serializeRoute(t)});return{url:t.url,params:t.params,queryParams:t.queryParams,fragment:t.fragment,data:t.data,outlet:t.outlet,component:t.routeConfig?t.routeConfig.component:undefined,routeConfig:null,root:undefined,parent:undefined,firstChild:r[0],children:r,pathFromRoot:undefined,paramMap:t.paramMap,queryParamMap:t.queryParamMap,toString:t.toString}},t}(),u=function(t,e,r){this.path=t,this.queryParams=e,this.extras=r};u.type="[Router] Navigate";var c=function(t,e){this.routerState=t,this.event=e};c.type="[Router] RouterNavigation";var p=function(t,e,r){this.routerState=t,this.storeState=e,this.event=r};p.type="[Router] RouterCancel";var d,g=function(t,e,r){this.routerState=t,this.storeState=e,this.event=r};g.type="[Router] RouterError",t.RouterState=d=function(){function t(t,e,r){this.store=t,this.router=e,this.serializer=r,this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1,this.setUpRouterHook(),this.setUpStoreListener(),this.setUpStateRollbackEvents()}return t.state=function(t){return t&&t.state},t.url=function(t){return t&&t.state&&t.state.url},t.prototype.setUpRouterHook=function(){var e=this;this.router.hooks.beforePreactivation=function(t){return e.routerStateSnapshot=e.serializer.serialize(t),e.shouldDispatchRouterNavigation()&&e.dispatchRouterNavigation(),a.of(!0)}},t.prototype.setUpStoreListener=function(){var e=this;this.store.select(d).subscribe(function(t){e.routerState=t}),this.store.select(d.state).subscribe(function(){e.navigateIfNeeded()})},t.prototype.setUpStateRollbackEvents=function(){var e=this;this.router.events.subscribe(function(t){t instanceof r.RoutesRecognized?e.lastRoutesRecognized=t:t instanceof r.NavigationCancel?e.dispatchRouterCancel(t):t instanceof r.NavigationError&&e.dispatchRouterError(t)})},t.prototype.navigate=function(t,e){this.router.navigate(e.path,Object.assign({queryParams:e.queryParams},e.extras))},t.prototype.angularRouterAction=function(t,e){t.setState(Object.assign({},t.getState(),{state:e.routerState,navigationId:e.event.id}))},t.prototype.shouldDispatchRouterNavigation=function(){return!this.routerState||!this.navigationTriggeredByDispatch},t.prototype.navigateIfNeeded=function(){this.routerState&&this.routerState.state&&(this.dispatchTriggeredByRouter||this.router.url!==this.routerState.state.url&&(this.navigationTriggeredByDispatch=!0,this.router.navigateByUrl(this.routerState.state.url)))},t.prototype.dispatchRouterNavigation=function(){this.dispatchRouterAction(new c(this.routerStateSnapshot,new r.RoutesRecognized(this.lastRoutesRecognized.id,this.lastRoutesRecognized.url,this.lastRoutesRecognized.urlAfterRedirects,this.routerStateSnapshot)))},t.prototype.dispatchRouterCancel=function(t){this.dispatchRouterAction(new p(this.routerStateSnapshot,this.routerState,t))},t.prototype.dispatchRouterError=function(t){this.dispatchRouterAction(new g(this.routerStateSnapshot,this.routerState,new r.NavigationError(t.id,t.url,""+t)))},t.prototype.dispatchRouterAction=function(t){this.dispatchTriggeredByRouter=!0;try{this.store.dispatch(t)}finally{this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1}},t}(),e.__decorate([o.Action(u),e.__metadata("design:type",Function),e.__metadata("design:paramtypes",[Object,u]),e.__metadata("design:returntype",void 0)],t.RouterState.prototype,"navigate",null),e.__decorate([o.Action([c,g,p]),e.__metadata("design:type",Function),e.__metadata("design:paramtypes",[Object,Object]),e.__metadata("design:returntype",void 0)],t.RouterState.prototype,"angularRouterAction",null),e.__decorate([o.Selector(),e.__metadata("design:type",Function),e.__metadata("design:paramtypes",[Object]),e.__metadata("design:returntype",void 0)],t.RouterState,"state",null),e.__decorate([o.Selector(),e.__metadata("design:type",Function),e.__metadata("design:paramtypes",[Object]),e.__metadata("design:returntype",String)],t.RouterState,"url",null),t.RouterState=d=e.__decorate([o.State({name:"router",defaults:{state:null,navigationId:null}}),e.__metadata("design:paramtypes",[o.Store,r.Router,n])],t.RouterState);var h=o.NgxsModule.forFeature([t.RouterState]),l=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[{provide:n,useClass:s}]}},t}();l.decorators=[{type:i.NgModule,args:[{imports:[h]}]}],t.ɵa=h,t.ɵc=s,t.ɵb=n,t.NgxsRouterPluginModule=l,t.Navigate=u,t.RouterNavigation=c,t.RouterCancel=p,t.RouterError=g,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngxs-router-plugin.umd.min.js.map

@@ -1,241 +0,7 @@

import { __decorate, __metadata } from 'tslib';
import { NavigationCancel, NavigationError, Router, RoutesRecognized } from '@angular/router';
import { Action, Selector, State, Store, NgxsModule } from '@ngxs/store';
import { of } from 'rxjs/observable/of';
import { NgModule } from '@angular/core';
class RouterStateSerializer {
}
class DefaultRouterStateSerializer {
serialize(routerState) {
return {
root: this.serializeRoute(routerState.root),
url: routerState.url
};
}
serializeRoute(route) {
const children = route.children.map(c => this.serializeRoute(c));
return {
url: route.url,
params: route.params,
queryParams: route.queryParams,
fragment: route.fragment,
data: route.data,
outlet: route.outlet,
component: route.routeConfig ? route.routeConfig.component : undefined,
routeConfig: null,
root: undefined,
parent: undefined,
firstChild: children[0],
children: children,
pathFromRoot: undefined,
paramMap: route.paramMap,
queryParamMap: route.queryParamMap,
toString: route.toString
};
}
}
/**
* Public event api of the router
*/
class Navigate {
constructor(path, queryParams, extras) {
this.path = path;
this.queryParams = queryParams;
this.extras = extras;
}
}
Navigate.type = '[Router] Navigate';
/**
*
* Angular Routers internal state events
*
*/
/**
* An action dispatched when the router navigates.
*/
class RouterNavigation {
constructor(routerState, event) {
this.routerState = routerState;
this.event = event;
}
}
RouterNavigation.type = '[Router] RouterNavigation';
/**
* An action dispatched when the router cancel navigation.
*/
class RouterCancel {
constructor(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
}
RouterCancel.type = '[Router] RouterCancel';
/**
* An action dispatched when the router errors.
*/
class RouterError {
constructor(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
}
RouterError.type = '[Router] RouterError';
let RouterState = RouterState_1 = class RouterState {
constructor(store, router, serializer) {
this.store = store;
this.router = router;
this.serializer = serializer;
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
this.setUpRouterHook();
this.setUpStoreListener();
this.setUpStateRollbackEvents();
}
/**
* Selectors
*/
static state(state) {
return state && state.state;
}
static url(state) {
return state && state.state && state.state.url;
}
/**
* Hook into the angular router before each navigation action is performed
* since the route tree can be large, we serialize it into something more manageable
*/
setUpRouterHook() {
this.router.hooks.beforePreactivation = (routerStateSnapshot) => {
this.routerStateSnapshot = this.serializer.serialize(routerStateSnapshot);
if (this.shouldDispatchRouterNavigation())
this.dispatchRouterNavigation();
return of(true);
};
}
setUpStoreListener() {
this.store.select(RouterState_1).subscribe(s => {
this.routerState = s;
});
this.store.select(RouterState_1.state).subscribe(() => {
this.navigateIfNeeded();
});
}
setUpStateRollbackEvents() {
this.router.events.subscribe(e => {
if (e instanceof RoutesRecognized) {
this.lastRoutesRecognized = e;
}
else if (e instanceof NavigationCancel) {
this.dispatchRouterCancel(e);
}
else if (e instanceof NavigationError) {
this.dispatchRouterError(e);
}
});
}
navigate(ctx, action) {
this.router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras));
}
angularRouterAction(ctx, action) {
ctx.setState(Object.assign({}, ctx.getState(), { state: action.routerState, navigationId: action.event.id }));
}
shouldDispatchRouterNavigation() {
if (!this.routerState)
return true;
return !this.navigationTriggeredByDispatch;
}
navigateIfNeeded() {
if (!this.routerState || !this.routerState.state) {
return;
}
if (this.dispatchTriggeredByRouter)
return;
if (this.router.url !== this.routerState.state.url) {
this.navigationTriggeredByDispatch = true;
this.router.navigateByUrl(this.routerState.state.url);
}
}
dispatchRouterNavigation() {
this.dispatchRouterAction(new RouterNavigation(this.routerStateSnapshot, new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerStateSnapshot)));
}
dispatchRouterCancel(event) {
this.dispatchRouterAction(new RouterCancel(this.routerStateSnapshot, this.routerState, event));
}
dispatchRouterError(event) {
this.dispatchRouterAction(new RouterError(this.routerStateSnapshot, this.routerState, new NavigationError(event.id, event.url, `${event}`)));
}
dispatchRouterAction(action) {
this.dispatchTriggeredByRouter = true;
try {
this.store.dispatch(action);
}
finally {
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
}
}
};
__decorate([
Action(Navigate),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Navigate]),
__metadata("design:returntype", void 0)
], RouterState.prototype, "navigate", null);
__decorate([
Action([RouterNavigation, RouterError, RouterCancel]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", void 0)
], RouterState.prototype, "angularRouterAction", null);
__decorate([
Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], RouterState, "state", null);
__decorate([
Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", String)
], RouterState, "url", null);
RouterState = RouterState_1 = __decorate([
State({
name: 'router',
defaults: {
state: null,
navigationId: null
}
}),
__metadata("design:paramtypes", [Store,
Router,
RouterStateSerializer])
], RouterState);
var RouterState_1;
const routerFeatureModule = NgxsModule.forFeature([RouterState]);
class NgxsRouterPluginModule {
static forRoot() {
return {
ngModule: NgxsRouterPluginModule,
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
};
}
}
NgxsRouterPluginModule.decorators = [
{ type: NgModule, args: [{
imports: [routerFeatureModule]
},] },
];
/**
* Generated bundle index. Do not edit.
*/
export { routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb, NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError };
export * from './index';
export { routerFeatureModule as ɵa } from './src/router.module';
export { DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb } from './src/serializer';
//# sourceMappingURL=ngxs-router-plugin.js.map

@@ -1,228 +0,7 @@

import { __decorate, __metadata } from 'tslib';
import { NavigationCancel, NavigationError, Router, RoutesRecognized } from '@angular/router';
import { Action, Selector, State, Store, NgxsModule } from '@ngxs/store';
import { of } from 'rxjs/observable/of';
import { NgModule } from '@angular/core';
var RouterStateSerializer = /** @class */ (function () {
function RouterStateSerializer() {
}
return RouterStateSerializer;
}());
var DefaultRouterStateSerializer = /** @class */ (function () {
function DefaultRouterStateSerializer() {
}
DefaultRouterStateSerializer.prototype.serialize = function (routerState) {
return {
root: this.serializeRoute(routerState.root),
url: routerState.url
};
};
DefaultRouterStateSerializer.prototype.serializeRoute = function (route) {
var _this = this;
var children = route.children.map(function (c) { return _this.serializeRoute(c); });
return {
url: route.url,
params: route.params,
queryParams: route.queryParams,
fragment: route.fragment,
data: route.data,
outlet: route.outlet,
component: route.routeConfig ? route.routeConfig.component : undefined,
routeConfig: null,
root: undefined,
parent: undefined,
firstChild: children[0],
children: children,
pathFromRoot: undefined,
paramMap: route.paramMap,
queryParamMap: route.queryParamMap,
toString: route.toString
};
};
return DefaultRouterStateSerializer;
}());
var Navigate = /** @class */ (function () {
function Navigate(path, queryParams, extras) {
this.path = path;
this.queryParams = queryParams;
this.extras = extras;
}
return Navigate;
}());
Navigate.type = '[Router] Navigate';
var RouterNavigation = /** @class */ (function () {
function RouterNavigation(routerState, event) {
this.routerState = routerState;
this.event = event;
}
return RouterNavigation;
}());
RouterNavigation.type = '[Router] RouterNavigation';
var RouterCancel = /** @class */ (function () {
function RouterCancel(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
return RouterCancel;
}());
RouterCancel.type = '[Router] RouterCancel';
var RouterError = /** @class */ (function () {
function RouterError(routerState, storeState, event) {
this.routerState = routerState;
this.storeState = storeState;
this.event = event;
}
return RouterError;
}());
RouterError.type = '[Router] RouterError';
var RouterState = RouterState_1 = /** @class */ (function () {
function RouterState(store, router, serializer) {
this.store = store;
this.router = router;
this.serializer = serializer;
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
this.setUpRouterHook();
this.setUpStoreListener();
this.setUpStateRollbackEvents();
}
RouterState.state = function (state) {
return state && state.state;
};
RouterState.url = function (state) {
return state && state.state && state.state.url;
};
RouterState.prototype.setUpRouterHook = function () {
var _this = this;
this.router.hooks.beforePreactivation = function (routerStateSnapshot) {
_this.routerStateSnapshot = _this.serializer.serialize(routerStateSnapshot);
if (_this.shouldDispatchRouterNavigation())
_this.dispatchRouterNavigation();
return of(true);
};
};
RouterState.prototype.setUpStoreListener = function () {
var _this = this;
this.store.select(RouterState_1).subscribe(function (s) {
_this.routerState = s;
});
this.store.select(RouterState_1.state).subscribe(function () {
_this.navigateIfNeeded();
});
};
RouterState.prototype.setUpStateRollbackEvents = function () {
var _this = this;
this.router.events.subscribe(function (e) {
if (e instanceof RoutesRecognized) {
_this.lastRoutesRecognized = e;
}
else if (e instanceof NavigationCancel) {
_this.dispatchRouterCancel(e);
}
else if (e instanceof NavigationError) {
_this.dispatchRouterError(e);
}
});
};
RouterState.prototype.navigate = function (ctx, action) {
this.router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras));
};
RouterState.prototype.angularRouterAction = function (ctx, action) {
ctx.setState(Object.assign({}, ctx.getState(), { state: action.routerState, navigationId: action.event.id }));
};
RouterState.prototype.shouldDispatchRouterNavigation = function () {
if (!this.routerState)
return true;
return !this.navigationTriggeredByDispatch;
};
RouterState.prototype.navigateIfNeeded = function () {
if (!this.routerState || !this.routerState.state) {
return;
}
if (this.dispatchTriggeredByRouter)
return;
if (this.router.url !== this.routerState.state.url) {
this.navigationTriggeredByDispatch = true;
this.router.navigateByUrl(this.routerState.state.url);
}
};
RouterState.prototype.dispatchRouterNavigation = function () {
this.dispatchRouterAction(new RouterNavigation(this.routerStateSnapshot, new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerStateSnapshot)));
};
RouterState.prototype.dispatchRouterCancel = function (event) {
this.dispatchRouterAction(new RouterCancel(this.routerStateSnapshot, this.routerState, event));
};
RouterState.prototype.dispatchRouterError = function (event) {
this.dispatchRouterAction(new RouterError(this.routerStateSnapshot, this.routerState, new NavigationError(event.id, event.url, "" + event)));
};
RouterState.prototype.dispatchRouterAction = function (action) {
this.dispatchTriggeredByRouter = true;
try {
this.store.dispatch(action);
}
finally {
this.dispatchTriggeredByRouter = false;
this.navigationTriggeredByDispatch = false;
}
};
return RouterState;
}());
__decorate([
Action(Navigate),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Navigate]),
__metadata("design:returntype", void 0)
], RouterState.prototype, "navigate", null);
__decorate([
Action([RouterNavigation, RouterError, RouterCancel]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", void 0)
], RouterState.prototype, "angularRouterAction", null);
__decorate([
Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], RouterState, "state", null);
__decorate([
Selector(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", String)
], RouterState, "url", null);
RouterState = RouterState_1 = __decorate([
State({
name: 'router',
defaults: {
state: null,
navigationId: null
}
}),
__metadata("design:paramtypes", [Store,
Router,
RouterStateSerializer])
], RouterState);
var RouterState_1;
var routerFeatureModule = NgxsModule.forFeature([RouterState]);
var NgxsRouterPluginModule = /** @class */ (function () {
function NgxsRouterPluginModule() {
}
NgxsRouterPluginModule.forRoot = function () {
return {
ngModule: NgxsRouterPluginModule,
providers: [{ provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }]
};
};
return NgxsRouterPluginModule;
}());
NgxsRouterPluginModule.decorators = [
{ type: NgModule, args: [{
imports: [routerFeatureModule]
},] },
];
export { routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb, NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError };
/**
* Generated bundle index. Do not edit.
*/
export * from './index';
export { routerFeatureModule as ɵa } from './src/router.module';
export { DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb } from './src/serializer';
//# sourceMappingURL=ngxs-router-plugin.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":5,"character":35},"member":"forFeature"},"arguments":[[{"__symbolic":"reference","name":"RouterState"}]]},"NgxsRouterPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsRouterPluginModule"},"providers":[{"provide":{"__symbolic":"reference","name":"ɵb"},"useClass":{"__symbolic":"reference","name":"ɵc"}}]}}}},"RouterState":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"State","line":11,"character":1},"arguments":[{"name":"router","defaults":{"state":null,"navigationId":null}}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":40,"character":19},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":41,"character":20},{"__symbolic":"reference","name":"ɵb"}]}],"setUpRouterHook":[{"__symbolic":"method"}],"setUpStoreListener":[{"__symbolic":"method"}],"setUpStateRollbackEvents":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":82,"character":3},"arguments":[{"__symbolic":"reference","name":"Navigate"}]}]}],"angularRouterAction":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":90,"character":3},"arguments":[[{"__symbolic":"reference","name":"RouterNavigation"},{"__symbolic":"reference","name":"RouterError"},{"__symbolic":"reference","name":"RouterCancel"}]]}]}],"shouldDispatchRouterNavigation":[{"__symbolic":"method"}],"navigateIfNeeded":[{"__symbolic":"method"}],"dispatchRouterNavigation":[{"__symbolic":"method"}],"dispatchRouterCancel":[{"__symbolic":"method"}],"dispatchRouterError":[{"__symbolic":"method"}],"dispatchRouterAction":[{"__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"}}}}},"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":14,"character":55},{"__symbolic":"reference","module":"@angular/router","name":"NavigationExtras","line":14,"character":79}]}]},"statics":{"type":"[Router] Navigate"}},"RouterNavigation":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":28,"character":34,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"RoutesRecognized","line":28,"character":51}]}]},"statics":{"type":"[Router] RouterNavigation"}},"RouterCancel":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":36,"character":34,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":36,"character":56,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationCancel","line":36,"character":73}]}]},"statics":{"type":"[Router] RouterCancel"}},"RouterError":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":44,"character":34,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":44,"character":56,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationError","line":44,"character":73}]}]},"statics":{"type":"[Router] RouterError"}},"RouterAction":{"__symbolic":"interface"},"ɵb":{"__symbolic":"class","arity":1,"members":{"serialize":[{"__symbolic":"method"}]}},"ɵc":{"__symbolic":"class","members":{"serialize":[{"__symbolic":"method"}],"serializeRoute":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/router.module","NgxsRouterPluginModule":"./src/router.module","RouterState":"./src/router.state","Navigate":"./src/router.actions","RouterNavigation":"./src/router.actions","RouterCancel":"./src/router.actions","RouterError":"./src/router.actions","RouterAction":"./src/router.actions","ɵb":"./src/serializer","ɵc":"./src/serializer"},"importAs":"@ngxs/router-plugin"}
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":5,"character":35},"member":"forFeature"},"arguments":[[{"__symbolic":"reference","name":"RouterState"}]]},"NgxsRouterPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsRouterPluginModule"},"providers":[{"provide":{"__symbolic":"reference","name":"ɵb"},"useClass":{"__symbolic":"reference","name":"ɵc"}}]}}}},"RouterState":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"State","line":12,"character":1},"arguments":[{"name":"router","defaults":{"state":null,"navigationId":null}}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":41,"character":19},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":42,"character":20},{"__symbolic":"reference","name":"ɵb"}]}],"setUpRouterHook":[{"__symbolic":"method"}],"setUpStoreListener":[{"__symbolic":"method"}],"setUpStateRollbackEvents":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":83,"character":3},"arguments":[{"__symbolic":"reference","name":"Navigate"}]}]}],"angularRouterAction":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@ngxs/store","name":"Action","line":91,"character":3},"arguments":[[{"__symbolic":"reference","name":"RouterNavigation"},{"__symbolic":"reference","name":"RouterError"},{"__symbolic":"reference","name":"RouterCancel"}]]}]}],"shouldDispatchRouterNavigation":[{"__symbolic":"method"}],"navigateIfNeeded":[{"__symbolic":"method"}],"dispatchRouterNavigation":[{"__symbolic":"method"}],"dispatchRouterCancel":[{"__symbolic":"method"}],"dispatchRouterError":[{"__symbolic":"method"}],"dispatchRouterAction":[{"__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"}}}}},"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":14,"character":55},{"__symbolic":"reference","module":"@angular/router","name":"NavigationExtras","line":14,"character":79}]}]},"statics":{"type":"[Router] Navigate"}},"RouterNavigation":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":28,"character":34,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"RoutesRecognized","line":28,"character":51}]}]},"statics":{"type":"[Router] RouterNavigation"}},"RouterCancel":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":36,"character":34,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":36,"character":56,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationCancel","line":36,"character":73}]}]},"statics":{"type":"[Router] RouterCancel"}},"RouterError":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":44,"character":34,"context":{"typeName":"V"},"module":"./src/router.actions"},{"__symbolic":"error","message":"Could not resolve type","line":44,"character":56,"context":{"typeName":"T"},"module":"./src/router.actions"},{"__symbolic":"reference","module":"@angular/router","name":"NavigationError","line":44,"character":73}]}]},"statics":{"type":"[Router] RouterError"}},"RouterAction":{"__symbolic":"interface"},"ɵb":{"__symbolic":"class","arity":1,"members":{"serialize":[{"__symbolic":"method"}]}},"ɵc":{"__symbolic":"class","members":{"serialize":[{"__symbolic":"method"}],"serializeRoute":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/router.module","NgxsRouterPluginModule":"./src/router.module","RouterState":"./src/router.state","Navigate":"./src/router.actions","RouterNavigation":"./src/router.actions","RouterCancel":"./src/router.actions","RouterError":"./src/router.actions","RouterAction":"./src/router.actions","ɵb":"./src/serializer","ɵc":"./src/serializer"},"importAs":"@ngxs/router-plugin"}
{
"name": "@ngxs/router-plugin",
"description": "router plugin for @ngxs/store",
"version": "3.0.0-dev.master-5555b7d",
"version": "3.0.0-dev.master-6337a19",
"peerDependencies": {
"@angular/core": ">=5.0.0 <7.0.0 || >6.0.0-rc <7.0.0",
"@angular/router": ">=5.0.0 <7.0.0 || >6.0.0-rc <7.0.0",
"@ngxs/store": "3.0.0-rc.1"
"@ngxs/store": "3.0.0-rc.2",
"rxjs": ">=6.0.0 || ^5.6.0-forward-compat.4"
},
"main": "bundles/ngxs-router-plugin.umd.js",
"module": "esm5/ngxs-router-plugin.js",
"es2015": "esm2015/ngxs-router-plugin.js",
"module": "fesm5/ngxs-router-plugin.js",
"es2015": "fesm2015/ngxs-router-plugin.js",
"esm5": "esm5/ngxs-router-plugin.js",
"esm2015": "esm2015/ngxs-router-plugin.js",
"fesm5": "fesm5/ngxs-router-plugin.js",
"fesm2015": "fesm2015/ngxs-router-plugin.js",
"typings": "ngxs-router-plugin.d.ts",
"metadata": "ngxs-router-plugin.metadata.json",
"sideEffects": false,
"dependencies": {

@@ -16,0 +22,0 @@ "tslib": "^1.9.0"

# @ngxs/router-plugin
inspired by @ngrx/router-store and modified to use the @ngxs/store
Router plugin for NGXS. See [repo](https://github.com/ngxs/store) for more info.
Inspired by @ngrx/router-store and modified to use the @ngxs/store

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc