Socket
Socket
Sign inDemoInstall

@ngxs/router-plugin

Package Overview
Dependencies
Maintainers
2
Versions
1021
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-0306402 to 3.0.0-dev.master-242c8fa

src/router.module.ngfactory.d.ts

8

bundles/ngxs-router-plugin.umd.js

@@ -126,3 +126,3 @@ (function (global, factory) {

var _this = this;
((this.router)).hooks.beforePreactivation = function (routerStateSnapshot) {
this.router.hooks.beforePreactivation = function (routerStateSnapshot) {
_this.routerStateSnapshot = _this.serializer.serialize(routerStateSnapshot);

@@ -255,2 +255,5 @@ if (_this.shouldDispatchRouterNavigation())

exports.ɵa = routerFeatureModule;
exports.ɵc = DefaultRouterStateSerializer;
exports.ɵb = RouterStateSerializer;
exports.NgxsRouterPluginModule = NgxsRouterPluginModule;

@@ -261,5 +264,2 @@ exports.Navigate = Navigate;

exports.RouterError = RouterError;
exports.ɵa = routerFeatureModule;
exports.ɵc = DefaultRouterStateSerializer;
exports.ɵb = RouterStateSerializer;

@@ -266,0 +266,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -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.NgxsRouterPluginModule=f,t.Navigate=c,t.RouterNavigation=p,t.RouterCancel=g,t.RouterError=l,t.ɵa=d,t.ɵc=u,t.ɵb=s,Object.defineProperty(t,"__esModule",{value:!0})});
!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})});
//# sourceMappingURL=ngxs-router-plugin.umd.min.js.map

@@ -7,21 +7,5 @@ import { __decorate, __metadata } from 'tslib';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @abstract
* @template T
*/
class RouterStateSerializer {
}
/**
* @record
*/
class DefaultRouterStateSerializer {
/**
* @param {?} routerState
* @return {?}
*/
serialize(routerState) {

@@ -33,8 +17,4 @@ return {

}
/**
* @param {?} route
* @return {?}
*/
serializeRoute(route) {
const /** @type {?} */ children = route.children.map(c => this.serializeRoute(c));
const children = route.children.map(c => this.serializeRoute(c));
return {

@@ -62,14 +42,5 @@ url: route.url,

/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Public event api of the router
*/
class Navigate {
/**
* @param {?} path
* @param {?=} queryParams
* @param {?=} extras
*/
constructor(path, queryParams, extras) {

@@ -83,10 +54,10 @@ this.path = path;

/**
*
* Angular Routers internal state events
*
*/
/**
* An action dispatched when the router navigates.
* @template T
*/
class RouterNavigation {
/**
* @param {?} routerState
* @param {?} event
*/
constructor(routerState, event) {

@@ -100,10 +71,4 @@ this.routerState = routerState;

* An action dispatched when the router cancel navigation.
* @template T, V
*/
class RouterCancel {
/**
* @param {?} routerState
* @param {?} storeState
* @param {?} event
*/
constructor(routerState, storeState, event) {

@@ -118,10 +83,4 @@ this.routerState = routerState;

* An action dispatched when the router errors.
* @template T, V
*/
class RouterError {
/**
* @param {?} routerState
* @param {?} storeState
* @param {?} event
*/
constructor(routerState, storeState, event) {

@@ -135,12 +94,3 @@ this.routerState = routerState;

/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
let RouterState = RouterState_1 = class RouterState {
/**
* @param {?} store
* @param {?} router
* @param {?} serializer
*/
constructor(store, router, serializer) {

@@ -157,13 +107,7 @@ this.store = store;

/**
* Selectors
* @param {?} state
* @return {?}
*/
* Selectors
*/
static state(state) {
return state && state.state;
}
/**
* @param {?} state
* @return {?}
*/
static url(state) {

@@ -173,8 +117,7 @@ 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
* @return {?}
*/
* 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() {
(/** @type {?} */ (this.router)).hooks.beforePreactivation = (routerStateSnapshot) => {
this.router.hooks.beforePreactivation = (routerStateSnapshot) => {
this.routerStateSnapshot = this.serializer.serialize(routerStateSnapshot);

@@ -186,5 +129,2 @@ if (this.shouldDispatchRouterNavigation())

}
/**
* @return {?}
*/
setUpStoreListener() {

@@ -198,5 +138,2 @@ this.store.select(RouterState_1).subscribe(s => {

}
/**
* @return {?}
*/
setUpStateRollbackEvents() {

@@ -215,21 +152,8 @@ this.router.events.subscribe(e => {

}
/**
* @param {?} ctx
* @param {?} action
* @return {?}
*/
navigate(ctx, action) {
this.router.navigate(action.path, Object.assign({ queryParams: action.queryParams }, action.extras));
}
/**
* @param {?} ctx
* @param {?} action
* @return {?}
*/
angularRouterAction(ctx, action) {
ctx.setState(Object.assign({}, ctx.getState(), { state: action.routerState, navigationId: action.event.id }));
}
/**
* @return {?}
*/
shouldDispatchRouterNavigation() {

@@ -240,5 +164,2 @@ if (!this.routerState)

}
/**
* @return {?}
*/
navigateIfNeeded() {

@@ -255,27 +176,11 @@ if (!this.routerState || !this.routerState.state) {

}
/**
* @return {?}
*/
dispatchRouterNavigation() {
this.dispatchRouterAction(new RouterNavigation(this.routerStateSnapshot, new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerStateSnapshot)));
}
/**
* @param {?} event
* @return {?}
*/
dispatchRouterCancel(event) {
this.dispatchRouterAction(new RouterCancel(this.routerStateSnapshot, this.routerState, event));
}
/**
* @param {?} event
* @return {?}
*/
dispatchRouterError(event) {
this.dispatchRouterAction(new RouterError(this.routerStateSnapshot, this.routerState, new NavigationError(event.id, event.url, `${event}`)));
}
/**
* @template T
* @param {?} action
* @return {?}
*/
dispatchRouterAction(action) {

@@ -330,11 +235,4 @@ this.dispatchTriggeredByRouter = true;

/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
const routerFeatureModule = NgxsModule.forFeature([RouterState]);
class NgxsRouterPluginModule {
/**
* @return {?}
*/
static forRoot() {

@@ -354,15 +252,6 @@ return {

/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
export { NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError, routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb };
export { routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb, NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError };
//# sourceMappingURL=ngxs-router-plugin.js.map

@@ -99,3 +99,3 @@ import { __decorate, __metadata } from 'tslib';

var _this = this;
((this.router)).hooks.beforePreactivation = function (routerStateSnapshot) {
this.router.hooks.beforePreactivation = function (routerStateSnapshot) {
_this.routerStateSnapshot = _this.serializer.serialize(routerStateSnapshot);

@@ -228,3 +228,3 @@ if (_this.shouldDispatchRouterNavigation())

export { NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError, routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb };
export { routerFeatureModule as ɵa, DefaultRouterStateSerializer as ɵc, RouterStateSerializer as ɵb, NgxsRouterPluginModule, RouterState, Navigate, RouterNavigation, RouterCancel, RouterError };
//# sourceMappingURL=ngxs-router-plugin.js.map
{
"name": "@ngxs/router-plugin",
"description": "router plugin for @ngxs/store",
"version": "3.0.0-dev.master-0306402",
"version": "3.0.0-dev.master-242c8fa",
"peerDependencies": {

@@ -6,0 +6,0 @@ "@angular/core": ">=5.0.0 <7.0.0 || >6.0.0-rc <7.0.0",

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