@ngxs/devtools-plugin 3.7.3 → 3.7.4
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-devtools-plugin.umd.js +88 -24
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js +2 -2
- package/bundles/ngxs-devtools-plugin.umd.min.js.map +1 -1
- package/esm2015/src/devtools.plugin.js +82 -24
- package/esm2015/src/symbols.js +1 -1
- package/esm5/src/devtools.plugin.js +90 -26
- package/esm5/src/symbols.js +1 -1
- package/fesm2015/ngxs-devtools-plugin.js +81 -23
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/fesm5/ngxs-devtools-plugin.js +89 -25
- package/fesm5/ngxs-devtools-plugin.js.map +1 -1
- package/ngxs-devtools-plugin.metadata.json +1 -1
- package/package.json +3 -3
- package/src/devtools.plugin.d.ts +9 -5
- package/src/symbols.d.ts +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\nimport { Subscription } from 'rxjs';\r\n\r\n/**\r\n * Interface for the redux-devtools-extension API.\r\n */\r\nexport interface NgxsDevtoolsExtension {\r\n init(state: any): void;\r\n send(action: any, state?: any): void;\r\n subscribe(fn: (message: NgxsDevtoolsAction) => void): Subscription;\r\n}\r\n\r\nexport interface NgxsDevtoolsAction {\r\n type: string;\r\n payload: any;\r\n state: any;\r\n id: number;\r\n source: string;\r\n}\r\n\r\nexport interface NgxsDevtoolsOptions {\r\n /**\r\n * The name of the extension\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Whether the dev tools is enabled or note. Useful for setting during production.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Max number of entiries to keep.\r\n */\r\n maxAge?: number;\r\n\r\n /**\r\n * Reformat actions before sending to dev tools\r\n */\r\n actionSanitizer?: (action: any) => void;\r\n\r\n /**\r\n * Reformat state before sending to devtools\r\n */\r\n stateSanitizer?: (state: any) => void;\r\n}\r\n\r\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\r\n","import { Inject, Injectable, Injector } from '@angular/core';\r\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\r\nimport { tap, catchError } from 'rxjs/operators';\r\n\r\nimport {\r\n NGXS_DEVTOOLS_OPTIONS,\r\n NgxsDevtoolsAction,\r\n NgxsDevtoolsExtension,\r\n NgxsDevtoolsOptions\r\n} from './symbols';\r\n\r\n/**\r\n * Adds support for the Redux Devtools extension:\r\n * http://extension.remotedev.io/\r\n */\r\n@Injectable()\r\nexport class NgxsReduxDevtoolsPlugin implements NgxsPlugin {\r\n private readonly devtoolsExtension: NgxsDevtoolsExtension | null = null;\r\n private readonly windowObj: any = typeof window !== 'undefined' ? window : {};\r\n\r\n constructor(\r\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\r\n private _injector: Injector\r\n ) {\r\n const globalDevtools =\r\n this.windowObj['__REDUX_DEVTOOLS_EXTENSION__'] || this.windowObj['devToolsExtension'];\r\n if (globalDevtools) {\r\n this.devtoolsExtension = globalDevtools.connect(_options) as NgxsDevtoolsExtension;\r\n this.devtoolsExtension.subscribe(a => this.dispatched(a));\r\n }\r\n }\r\n\r\n /**\r\n * Lazy get the store for circular dependency issues\r\n */\r\n private get store(): Store {\r\n return this._injector.get<Store>(Store);\r\n }\r\n\r\n /**\r\n * Middleware handle function\r\n */\r\n handle(state: any, action: any, next: NgxsNextPluginFn) {\r\n const isDisabled = this._options && this._options.disabled;\r\n if (!this.devtoolsExtension || isDisabled) {\r\n return next(state, action);\r\n }\r\n\r\n return next(state, action).pipe(\r\n catchError(error => {\r\n const newState = this.store.snapshot();\r\n this.sendToDevTools(state, action, newState);\r\n throw error;\r\n }),\r\n tap(newState => {\r\n this.sendToDevTools(state, action, newState);\r\n })\r\n );\r\n }\r\n\r\n private sendToDevTools(state: any, action: any, newState: any) {\r\n const type = getActionTypeFromInstance(action);\r\n // if init action, send initial state to dev tools\r\n const isInitAction = type === '@@INIT';\r\n if (isInitAction) {\r\n this.devtoolsExtension!.init(state);\r\n } else {\r\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the action from the dev tools subscription\r\n */\r\n dispatched(action: NgxsDevtoolsAction) {\r\n if (action.type === 'DISPATCH') {\r\n if (\r\n action.payload.type === 'JUMP_TO_ACTION' ||\r\n action.payload.type === 'JUMP_TO_STATE'\r\n ) {\r\n const prevState = JSON.parse(action.state);\r\n this.store.reset(prevState);\r\n } else if (action.payload.type === 'TOGGLE_ACTION') {\r\n console.warn('Skip is not supported at this time.');\r\n } else if (action.payload.type === 'IMPORT_STATE') {\r\n const {\r\n actionsById,\r\n computedStates,\r\n currentStateIndex\r\n } = action.payload.nextLiftedState;\r\n this.devtoolsExtension!.init(computedStates[0].state);\r\n Object.keys(actionsById)\r\n .filter(actionId => actionId !== '0')\r\n .forEach(actionId =>\r\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\r\n );\r\n this.store.reset(computedStates[currentStateIndex].state);\r\n }\r\n } else if (action.type === 'ACTION') {\r\n const actionPayload = JSON.parse(action.payload);\r\n this.store.dispatch(actionPayload);\r\n }\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\r\nimport { NGXS_PLUGINS } from '@ngxs/store';\r\n\r\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\r\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\r\n\r\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\r\n return {\r\n name: 'NGXS',\r\n ...options\r\n };\r\n}\r\n\r\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\r\n\r\n@NgModule()\r\nexport class NgxsReduxDevtoolsPluginModule {\r\n static forRoot(\r\n options?: NgxsDevtoolsOptions\r\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\r\n return {\r\n ngModule: NgxsReduxDevtoolsPluginModule,\r\n providers: [\r\n {\r\n provide: NGXS_PLUGINS,\r\n useClass: NgxsReduxDevtoolsPlugin,\r\n multi: true\r\n },\r\n {\r\n provide: USER_OPTIONS,\r\n useValue: options\r\n },\r\n {\r\n provide: NGXS_DEVTOOLS_OPTIONS,\r\n useFactory: devtoolsOptionsFactory,\r\n deps: [USER_OPTIONS]\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAMA,oCAIC;;;;;;IAHC,4DAAuB;;;;;;IACvB,oEAAqC;;;;;IACrC,8DAAmE;;;;;AAGrE,iCAMC;;;IALC,kCAAa;;IACb,qCAAa;;IACb,mCAAW;;IACX,gCAAW;;IACX,oCAAe;;;;;AAGjB,kCAyBC;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,MAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;AC/ChF;;;;AAgBA,MAAa,uBAAuB;;;;;IAIlC,YACyC,QAA6B,EAC5D,SAAmB;QADY,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QALZ,sBAAiB,GAAiC,IAAI,CAAC;QACvD,cAAS,GAAQ,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAC;;cAMtE,cAAc,GAClB,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,mBAAmB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AAQ,EAAE;;kBAC7B,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YAChD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;SACpC;KACF;;;YAvFF,UAAU;;;;4CAMN,MAAM,SAAC,qBAAqB;YArBJ,QAAQ;;;;;;;IAiBnC,oDAAwE;;;;;IACxE,4CAA8E;;;;;IAG5E,2CAAoE;;;;;IACpE,4CAA2B;;;;;;;ACtB/B;;;;AAMA,SAAgB,sBAAsB,CAAC,OAA4B;IACjE,uBACE,IAAI,EAAE,MAAM,IACT,OAAO,EACV;CACH;;AAED,MAAa,YAAY,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC;AAG9D,MAAa,6BAA6B;;;;;IACxC,OAAO,OAAO,CACZ,OAA6B;QAE7B,OAAO;YACL,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,uBAAuB;oBACjC,KAAK,EAAE,IAAI;iBACZ;gBACD;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,UAAU,EAAE,sBAAsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Interface for the redux-devtools-extension API.\r\n */\r\nexport interface NgxsDevtoolsExtension {\r\n init(state: any): void;\r\n send(action: any, state?: any): void;\r\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\r\n}\r\n\r\nexport interface NgxsDevtoolsAction {\r\n type: string;\r\n payload: any;\r\n state: any;\r\n id: number;\r\n source: string;\r\n}\r\n\r\nexport interface NgxsDevtoolsOptions {\r\n /**\r\n * The name of the extension\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Whether the dev tools is enabled or note. Useful for setting during production.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Max number of entiries to keep.\r\n */\r\n maxAge?: number;\r\n\r\n /**\r\n * Reformat actions before sending to dev tools\r\n */\r\n actionSanitizer?: (action: any) => void;\r\n\r\n /**\r\n * Reformat state before sending to devtools\r\n */\r\n stateSanitizer?: (state: any) => void;\r\n}\r\n\r\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\r\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\r\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\r\nimport { tap, catchError } from 'rxjs/operators';\r\n\r\nimport {\r\n NGXS_DEVTOOLS_OPTIONS,\r\n NgxsDevtoolsAction,\r\n NgxsDevtoolsExtension,\r\n NgxsDevtoolsOptions\r\n} from './symbols';\r\n\r\nconst enum ReduxDevtoolsActionType {\r\n Dispatch = 'DISPATCH',\r\n Action = 'ACTION'\r\n}\r\n\r\nconst enum ReduxDevtoolsPayloadType {\r\n JumpToAction = 'JUMP_TO_ACTION',\r\n JumpToState = 'JUMP_TO_STATE',\r\n ToggleAction = 'TOGGLE_ACTION',\r\n ImportState = 'IMPORT_STATE'\r\n}\r\n\r\n/**\r\n * Adds support for the Redux Devtools extension:\r\n * http://extension.remotedev.io/\r\n */\r\n@Injectable()\r\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\r\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\r\n private readonly globalDevtools =\r\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\r\n\r\n private unsubscribe: VoidFunction | null = null;\r\n\r\n constructor(\r\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\r\n private _injector: Injector,\r\n private _ngZone: NgZone\r\n ) {\r\n this.connect();\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.unsubscribe !== null) {\r\n this.unsubscribe();\r\n }\r\n if (this.globalDevtools) {\r\n this.globalDevtools.disconnect();\r\n }\r\n }\r\n\r\n /**\r\n * Lazy get the store for circular dependency issues\r\n */\r\n private get store(): Store {\r\n return this._injector.get<Store>(Store);\r\n }\r\n\r\n /**\r\n * Middleware handle function\r\n */\r\n handle(state: any, action: any, next: NgxsNextPluginFn) {\r\n if (!this.devtoolsExtension || this._options.disabled) {\r\n return next(state, action);\r\n }\r\n\r\n return next(state, action).pipe(\r\n catchError(error => {\r\n const newState = this.store.snapshot();\r\n this.sendToDevTools(state, action, newState);\r\n throw error;\r\n }),\r\n tap(newState => {\r\n this.sendToDevTools(state, action, newState);\r\n })\r\n );\r\n }\r\n\r\n private sendToDevTools(state: any, action: any, newState: any) {\r\n const type = getActionTypeFromInstance(action);\r\n // if init action, send initial state to dev tools\r\n const isInitAction = type === '@@INIT';\r\n if (isInitAction) {\r\n this.devtoolsExtension!.init(state);\r\n } else {\r\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the action from the dev tools subscription\r\n */\r\n dispatched(action: NgxsDevtoolsAction) {\r\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\r\n if (\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\r\n ) {\r\n const prevState = JSON.parse(action.state);\r\n this.store.reset(prevState);\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\r\n console.warn('Skip is not supported at this time.');\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\r\n const {\r\n actionsById,\r\n computedStates,\r\n currentStateIndex\r\n } = action.payload.nextLiftedState;\r\n this.devtoolsExtension!.init(computedStates[0].state);\r\n Object.keys(actionsById)\r\n .filter(actionId => actionId !== '0')\r\n .forEach(actionId =>\r\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\r\n );\r\n this.store.reset(computedStates[currentStateIndex].state);\r\n }\r\n } else if (action.type === ReduxDevtoolsActionType.Action) {\r\n const actionPayload = JSON.parse(action.payload);\r\n this.store.dispatch(actionPayload);\r\n }\r\n }\r\n\r\n private connect(): void {\r\n if (!this.globalDevtools || this._options.disabled) {\r\n return;\r\n }\r\n\r\n // The `connect` method adds `message` event listener since it communicates\r\n // with an extension through `window.postMessage` and message events.\r\n // We handle only 2 events; thus, we don't want to run many change detections\r\n // because the extension sends events that we don't have to handle.\r\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\r\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\r\n );\r\n\r\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\r\n if (\r\n action.type === ReduxDevtoolsActionType.Dispatch ||\r\n action.type === ReduxDevtoolsActionType.Action\r\n ) {\r\n this._ngZone.run(() => {\r\n this.dispatched(action);\r\n });\r\n }\r\n });\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\r\nimport { NGXS_PLUGINS } from '@ngxs/store';\r\n\r\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\r\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\r\n\r\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\r\n return {\r\n name: 'NGXS',\r\n ...options\r\n };\r\n}\r\n\r\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\r\n\r\n@NgModule()\r\nexport class NgxsReduxDevtoolsPluginModule {\r\n static forRoot(\r\n options?: NgxsDevtoolsOptions\r\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\r\n return {\r\n ngModule: NgxsReduxDevtoolsPluginModule,\r\n providers: [\r\n {\r\n provide: NGXS_PLUGINS,\r\n useClass: NgxsReduxDevtoolsPlugin,\r\n multi: true\r\n },\r\n {\r\n provide: USER_OPTIONS,\r\n useValue: options\r\n },\r\n {\r\n provide: NGXS_DEVTOOLS_OPTIONS,\r\n useFactory: devtoolsOptionsFactory,\r\n deps: [USER_OPTIONS]\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAKA,oCAIC;;;;;;IAHC,4DAAuB;;;;;;IACvB,oEAAqC;;;;;IACrC,8DAAmE;;;;;AAGrE,iCAMC;;;IALC,kCAAa;;IACb,qCAAa;;IACb,mCAAW;;IACX,gCAAW;;IACX,oCAAe;;;;;AAGjB,kCAyBC;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,MAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;AC9ChF;;IAYE,UAAW,UAAU;IACrB,QAAS,QAAQ;;;;IAIjB,cAAe,gBAAgB;IAC/B,aAAc,eAAe;IAC7B,cAAe,eAAe;IAC9B,aAAc,cAAc;;;;;;AAQ9B,MAAa,uBAAuB;;;;;;IAOlC,YACyC,QAA6B,EAC5D,SAAmB,EACnB,OAAe;QAFgB,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAAQ;QATjB,sBAAiB,GAAiC,IAAI,CAAC;QAC9C,mBAAc,GAC7B,OAAO,CAAC,8BAA8B,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAElE,gBAAW,GAAwB,IAAI,CAAC;QAO9C,IAAI,CAAC,OAAO,EAAE,CAAC;KAChB;;;;IAED,WAAW;QACT,IAAI,IAAI,CAAC,WAAW,KA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;iBACrB;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import { InjectionToken, Injectable, Inject, Injector, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, ɵglobal, Injectable, Inject, Injector, NgZone, NgModule } from '@angular/core';
|
|
3
3
|
import { Store, getActionTypeFromInstance, NGXS_PLUGINS } from '@ngxs/store';
|
|
4
4
|
import { catchError, tap } from 'rxjs/operators';
|
|
5
5
|
|
|
@@ -84,28 +84,46 @@ var NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
|
84
84
|
* @fileoverview added by tsickle
|
|
85
85
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
86
86
|
*/
|
|
87
|
+
/** @enum {string} */
|
|
88
|
+
var ReduxDevtoolsActionType = {
|
|
89
|
+
Dispatch: 'DISPATCH',
|
|
90
|
+
Action: 'ACTION',
|
|
91
|
+
};
|
|
92
|
+
/** @enum {string} */
|
|
93
|
+
var ReduxDevtoolsPayloadType = {
|
|
94
|
+
JumpToAction: 'JUMP_TO_ACTION',
|
|
95
|
+
JumpToState: 'JUMP_TO_STATE',
|
|
96
|
+
ToggleAction: 'TOGGLE_ACTION',
|
|
97
|
+
ImportState: 'IMPORT_STATE',
|
|
98
|
+
};
|
|
87
99
|
/**
|
|
88
100
|
* Adds support for the Redux Devtools extension:
|
|
89
101
|
* http://extension.remotedev.io/
|
|
90
102
|
*/
|
|
91
103
|
var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
92
|
-
function NgxsReduxDevtoolsPlugin(_options, _injector) {
|
|
93
|
-
var _this = this;
|
|
104
|
+
function NgxsReduxDevtoolsPlugin(_options, _injector, _ngZone) {
|
|
94
105
|
this._options = _options;
|
|
95
106
|
this._injector = _injector;
|
|
107
|
+
this._ngZone = _ngZone;
|
|
96
108
|
this.devtoolsExtension = null;
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (globalDevtools) {
|
|
101
|
-
this.devtoolsExtension = (/** @type {?} */ (globalDevtools.connect(_options)));
|
|
102
|
-
this.devtoolsExtension.subscribe((/**
|
|
103
|
-
* @param {?} a
|
|
104
|
-
* @return {?}
|
|
105
|
-
*/
|
|
106
|
-
function (a) { return _this.dispatched(a); }));
|
|
107
|
-
}
|
|
109
|
+
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
110
|
+
this.unsubscribe = null;
|
|
111
|
+
this.connect();
|
|
108
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* @return {?}
|
|
115
|
+
*/
|
|
116
|
+
NgxsReduxDevtoolsPlugin.prototype.ngOnDestroy = /**
|
|
117
|
+
* @return {?}
|
|
118
|
+
*/
|
|
119
|
+
function () {
|
|
120
|
+
if (this.unsubscribe !== null) {
|
|
121
|
+
this.unsubscribe();
|
|
122
|
+
}
|
|
123
|
+
if (this.globalDevtools) {
|
|
124
|
+
this.globalDevtools.disconnect();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
109
127
|
Object.defineProperty(NgxsReduxDevtoolsPlugin.prototype, "store", {
|
|
110
128
|
/**
|
|
111
129
|
* Lazy get the store for circular dependency issues
|
|
@@ -140,9 +158,7 @@ var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
|
140
158
|
*/
|
|
141
159
|
function (state, action, next) {
|
|
142
160
|
var _this = this;
|
|
143
|
-
|
|
144
|
-
var isDisabled = this._options && this._options.disabled;
|
|
145
|
-
if (!this.devtoolsExtension || isDisabled) {
|
|
161
|
+
if (!this.devtoolsExtension || this._options.disabled) {
|
|
146
162
|
return next(state, action);
|
|
147
163
|
}
|
|
148
164
|
return next(state, action).pipe(catchError((/**
|
|
@@ -204,17 +220,17 @@ var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
|
204
220
|
*/
|
|
205
221
|
function (action) {
|
|
206
222
|
var _this = this;
|
|
207
|
-
if (action.type ===
|
|
208
|
-
if (action.payload.type ===
|
|
209
|
-
action.payload.type ===
|
|
223
|
+
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
224
|
+
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
225
|
+
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
210
226
|
/** @type {?} */
|
|
211
227
|
var prevState = JSON.parse(action.state);
|
|
212
228
|
this.store.reset(prevState);
|
|
213
229
|
}
|
|
214
|
-
else if (action.payload.type ===
|
|
230
|
+
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
215
231
|
console.warn('Skip is not supported at this time.');
|
|
216
232
|
}
|
|
217
|
-
else if (action.payload.type ===
|
|
233
|
+
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
218
234
|
var _a = action.payload.nextLiftedState, actionsById_1 = _a.actionsById, computedStates_1 = _a.computedStates, currentStateIndex = _a.currentStateIndex;
|
|
219
235
|
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates_1[0].state);
|
|
220
236
|
Object.keys(actionsById_1)
|
|
@@ -233,19 +249,57 @@ var NgxsReduxDevtoolsPlugin = /** @class */ (function () {
|
|
|
233
249
|
this.store.reset(computedStates_1[currentStateIndex].state);
|
|
234
250
|
}
|
|
235
251
|
}
|
|
236
|
-
else if (action.type ===
|
|
252
|
+
else if (action.type === "ACTION" /* Action */) {
|
|
237
253
|
/** @type {?} */
|
|
238
254
|
var actionPayload = JSON.parse(action.payload);
|
|
239
255
|
this.store.dispatch(actionPayload);
|
|
240
256
|
}
|
|
241
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
* @return {?}
|
|
261
|
+
*/
|
|
262
|
+
NgxsReduxDevtoolsPlugin.prototype.connect = /**
|
|
263
|
+
* @private
|
|
264
|
+
* @return {?}
|
|
265
|
+
*/
|
|
266
|
+
function () {
|
|
267
|
+
var _this = this;
|
|
268
|
+
if (!this.globalDevtools || this._options.disabled) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// The `connect` method adds `message` event listener since it communicates
|
|
272
|
+
// with an extension through `window.postMessage` and message events.
|
|
273
|
+
// We handle only 2 events; thus, we don't want to run many change detections
|
|
274
|
+
// because the extension sends events that we don't have to handle.
|
|
275
|
+
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
276
|
+
* @return {?}
|
|
277
|
+
*/
|
|
278
|
+
function () { return (/** @type {?} */ (_this.globalDevtools.connect(_this._options))); }));
|
|
279
|
+
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
280
|
+
* @param {?} action
|
|
281
|
+
* @return {?}
|
|
282
|
+
*/
|
|
283
|
+
function (action) {
|
|
284
|
+
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
285
|
+
action.type === "ACTION" /* Action */) {
|
|
286
|
+
_this._ngZone.run((/**
|
|
287
|
+
* @return {?}
|
|
288
|
+
*/
|
|
289
|
+
function () {
|
|
290
|
+
_this.dispatched(action);
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
}));
|
|
294
|
+
};
|
|
242
295
|
NgxsReduxDevtoolsPlugin.decorators = [
|
|
243
296
|
{ type: Injectable }
|
|
244
297
|
];
|
|
245
298
|
/** @nocollapse */
|
|
246
299
|
NgxsReduxDevtoolsPlugin.ctorParameters = function () { return [
|
|
247
300
|
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
248
|
-
{ type: Injector }
|
|
301
|
+
{ type: Injector },
|
|
302
|
+
{ type: NgZone }
|
|
249
303
|
]; };
|
|
250
304
|
return NgxsReduxDevtoolsPlugin;
|
|
251
305
|
}());
|
|
@@ -259,7 +313,12 @@ if (false) {
|
|
|
259
313
|
* @type {?}
|
|
260
314
|
* @private
|
|
261
315
|
*/
|
|
262
|
-
NgxsReduxDevtoolsPlugin.prototype.
|
|
316
|
+
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
317
|
+
/**
|
|
318
|
+
* @type {?}
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
263
322
|
/**
|
|
264
323
|
* @type {?}
|
|
265
324
|
* @private
|
|
@@ -270,6 +329,11 @@ if (false) {
|
|
|
270
329
|
* @private
|
|
271
330
|
*/
|
|
272
331
|
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
332
|
+
/**
|
|
333
|
+
* @type {?}
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
273
337
|
}
|
|
274
338
|
|
|
275
339
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\nimport { Subscription } from 'rxjs';\r\n\r\n/**\r\n * Interface for the redux-devtools-extension API.\r\n */\r\nexport interface NgxsDevtoolsExtension {\r\n init(state: any): void;\r\n send(action: any, state?: any): void;\r\n subscribe(fn: (message: NgxsDevtoolsAction) => void): Subscription;\r\n}\r\n\r\nexport interface NgxsDevtoolsAction {\r\n type: string;\r\n payload: any;\r\n state: any;\r\n id: number;\r\n source: string;\r\n}\r\n\r\nexport interface NgxsDevtoolsOptions {\r\n /**\r\n * The name of the extension\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Whether the dev tools is enabled or note. Useful for setting during production.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Max number of entiries to keep.\r\n */\r\n maxAge?: number;\r\n\r\n /**\r\n * Reformat actions before sending to dev tools\r\n */\r\n actionSanitizer?: (action: any) => void;\r\n\r\n /**\r\n * Reformat state before sending to devtools\r\n */\r\n stateSanitizer?: (state: any) => void;\r\n}\r\n\r\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\r\n","import { Inject, Injectable, Injector } from '@angular/core';\r\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\r\nimport { tap, catchError } from 'rxjs/operators';\r\n\r\nimport {\r\n NGXS_DEVTOOLS_OPTIONS,\r\n NgxsDevtoolsAction,\r\n NgxsDevtoolsExtension,\r\n NgxsDevtoolsOptions\r\n} from './symbols';\r\n\r\n/**\r\n * Adds support for the Redux Devtools extension:\r\n * http://extension.remotedev.io/\r\n */\r\n@Injectable()\r\nexport class NgxsReduxDevtoolsPlugin implements NgxsPlugin {\r\n private readonly devtoolsExtension: NgxsDevtoolsExtension | null = null;\r\n private readonly windowObj: any = typeof window !== 'undefined' ? window : {};\r\n\r\n constructor(\r\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\r\n private _injector: Injector\r\n ) {\r\n const globalDevtools =\r\n this.windowObj['__REDUX_DEVTOOLS_EXTENSION__'] || this.windowObj['devToolsExtension'];\r\n if (globalDevtools) {\r\n this.devtoolsExtension = globalDevtools.connect(_options) as NgxsDevtoolsExtension;\r\n this.devtoolsExtension.subscribe(a => this.dispatched(a));\r\n }\r\n }\r\n\r\n /**\r\n * Lazy get the store for circular dependency issues\r\n */\r\n private get store(): Store {\r\n return this._injector.get<Store>(Store);\r\n }\r\n\r\n /**\r\n * Middleware handle function\r\n */\r\n handle(state: any, action: any, next: NgxsNextPluginFn) {\r\n const isDisabled = this._options && this._options.disabled;\r\n if (!this.devtoolsExtension || isDisabled) {\r\n return next(state, action);\r\n }\r\n\r\n return next(state, action).pipe(\r\n catchError(error => {\r\n const newState = this.store.snapshot();\r\n this.sendToDevTools(state, action, newState);\r\n throw error;\r\n }),\r\n tap(newState => {\r\n this.sendToDevTools(state, action, newState);\r\n })\r\n );\r\n }\r\n\r\n private sendToDevTools(state: any, action: any, newState: any) {\r\n const type = getActionTypeFromInstance(action);\r\n // if init action, send initial state to dev tools\r\n const isInitAction = type === '@@INIT';\r\n if (isInitAction) {\r\n this.devtoolsExtension!.init(state);\r\n } else {\r\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the action from the dev tools subscription\r\n */\r\n dispatched(action: NgxsDevtoolsAction) {\r\n if (action.type === 'DISPATCH') {\r\n if (\r\n action.payload.type === 'JUMP_TO_ACTION' ||\r\n action.payload.type === 'JUMP_TO_STATE'\r\n ) {\r\n const prevState = JSON.parse(action.state);\r\n this.store.reset(prevState);\r\n } else if (action.payload.type === 'TOGGLE_ACTION') {\r\n console.warn('Skip is not supported at this time.');\r\n } else if (action.payload.type === 'IMPORT_STATE') {\r\n const {\r\n actionsById,\r\n computedStates,\r\n currentStateIndex\r\n } = action.payload.nextLiftedState;\r\n this.devtoolsExtension!.init(computedStates[0].state);\r\n Object.keys(actionsById)\r\n .filter(actionId => actionId !== '0')\r\n .forEach(actionId =>\r\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\r\n );\r\n this.store.reset(computedStates[currentStateIndex].state);\r\n }\r\n } else if (action.type === 'ACTION') {\r\n const actionPayload = JSON.parse(action.payload);\r\n this.store.dispatch(actionPayload);\r\n }\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\r\nimport { NGXS_PLUGINS } from '@ngxs/store';\r\n\r\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\r\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\r\n\r\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\r\n return {\r\n name: 'NGXS',\r\n ...options\r\n };\r\n}\r\n\r\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\r\n\r\n@NgModule()\r\nexport class NgxsReduxDevtoolsPluginModule {\r\n static forRoot(\r\n options?: NgxsDevtoolsOptions\r\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\r\n return {\r\n ngModule: NgxsReduxDevtoolsPluginModule,\r\n providers: [\r\n {\r\n provide: NGXS_PLUGINS,\r\n useClass: NgxsReduxDevtoolsPlugin,\r\n multi: true\r\n },\r\n {\r\n provide: USER_OPTIONS,\r\n useValue: options\r\n },\r\n {\r\n provide: NGXS_DEVTOOLS_OPTIONS,\r\n useFactory: devtoolsOptionsFactory,\r\n deps: [USER_OPTIONS]\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;AAMA,oCAIC;;;;;;IAHC,4DAAuB;;;;;;IACvB,oEAAqC;;;;;IACrC,8DAAmE;;;;;AAGrE,iCAMC;;;IALC,kCAAa;;IACb,qCAAa;;IACb,mCAAW;;IACX,gCAAW;;IACX,oCAAe;;;;;AAGjB,kCAyBC;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,IAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;;;;;AChChF;IAKE,iCACyC,QAA6B,EAC5D,SAAmB;QAF7B,iBAUC;QATwC,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QALZ,sBAAiB,GAAiC,IAAI,CAAC;QACvD,cAAS,GAAQ,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAC;;YAMtE,cAAc,GAClB,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;QACvF,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,iBAAiB,sBAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,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C,CAAC;aAC3D;SACF;aAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE;;gBAC7B,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YAChD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;SACpC;KACF;;gBAvFF,UAAU;;;;gDAMN,MAAM,SAAC,qBAAqB;gBArBJ,QAAQ;;IAuGrC,8BAAC;CAxFD,IAwFC;;;;;;IAtFC,oDAAwE;;;;;IACxE,4CAA8E;;;;;IAG5E,2CAAoE;;;;;IACpE,4CAA2B;;;;;;;;;;;AChB/B,SAAgB,sBAAsB,CAAC,OAA4B;IACjE,kBACE,IAAI,EAAE,MAAM,IACT,OAAO,EACV;CACH;;AAED,IAAa,YAAY,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC;AAE9D;IAAA;KAyBC;;;;;IAvBQ,qCAAO;;;;IAAd,UACE,OAA6B;QAE7B,OAAO;YACL,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,uBAAuB;oBACjC,KAAK,EAAE,IAAI;iBACZ;gBACD;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,UAAU,EAAE,sBAAsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;gBAxBF,QAAQ;;IAyBT,oCAAC;CAzBD;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Interface for the redux-devtools-extension API.\r\n */\r\nexport interface NgxsDevtoolsExtension {\r\n init(state: any): void;\r\n send(action: any, state?: any): void;\r\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\r\n}\r\n\r\nexport interface NgxsDevtoolsAction {\r\n type: string;\r\n payload: any;\r\n state: any;\r\n id: number;\r\n source: string;\r\n}\r\n\r\nexport interface NgxsDevtoolsOptions {\r\n /**\r\n * The name of the extension\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Whether the dev tools is enabled or note. Useful for setting during production.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Max number of entiries to keep.\r\n */\r\n maxAge?: number;\r\n\r\n /**\r\n * Reformat actions before sending to dev tools\r\n */\r\n actionSanitizer?: (action: any) => void;\r\n\r\n /**\r\n * Reformat state before sending to devtools\r\n */\r\n stateSanitizer?: (state: any) => void;\r\n}\r\n\r\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\r\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\r\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\r\nimport { tap, catchError } from 'rxjs/operators';\r\n\r\nimport {\r\n NGXS_DEVTOOLS_OPTIONS,\r\n NgxsDevtoolsAction,\r\n NgxsDevtoolsExtension,\r\n NgxsDevtoolsOptions\r\n} from './symbols';\r\n\r\nconst enum ReduxDevtoolsActionType {\r\n Dispatch = 'DISPATCH',\r\n Action = 'ACTION'\r\n}\r\n\r\nconst enum ReduxDevtoolsPayloadType {\r\n JumpToAction = 'JUMP_TO_ACTION',\r\n JumpToState = 'JUMP_TO_STATE',\r\n ToggleAction = 'TOGGLE_ACTION',\r\n ImportState = 'IMPORT_STATE'\r\n}\r\n\r\n/**\r\n * Adds support for the Redux Devtools extension:\r\n * http://extension.remotedev.io/\r\n */\r\n@Injectable()\r\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\r\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\r\n private readonly globalDevtools =\r\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\r\n\r\n private unsubscribe: VoidFunction | null = null;\r\n\r\n constructor(\r\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\r\n private _injector: Injector,\r\n private _ngZone: NgZone\r\n ) {\r\n this.connect();\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.unsubscribe !== null) {\r\n this.unsubscribe();\r\n }\r\n if (this.globalDevtools) {\r\n this.globalDevtools.disconnect();\r\n }\r\n }\r\n\r\n /**\r\n * Lazy get the store for circular dependency issues\r\n */\r\n private get store(): Store {\r\n return this._injector.get<Store>(Store);\r\n }\r\n\r\n /**\r\n * Middleware handle function\r\n */\r\n handle(state: any, action: any, next: NgxsNextPluginFn) {\r\n if (!this.devtoolsExtension || this._options.disabled) {\r\n return next(state, action);\r\n }\r\n\r\n return next(state, action).pipe(\r\n catchError(error => {\r\n const newState = this.store.snapshot();\r\n this.sendToDevTools(state, action, newState);\r\n throw error;\r\n }),\r\n tap(newState => {\r\n this.sendToDevTools(state, action, newState);\r\n })\r\n );\r\n }\r\n\r\n private sendToDevTools(state: any, action: any, newState: any) {\r\n const type = getActionTypeFromInstance(action);\r\n // if init action, send initial state to dev tools\r\n const isInitAction = type === '@@INIT';\r\n if (isInitAction) {\r\n this.devtoolsExtension!.init(state);\r\n } else {\r\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the action from the dev tools subscription\r\n */\r\n dispatched(action: NgxsDevtoolsAction) {\r\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\r\n if (\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\r\n ) {\r\n const prevState = JSON.parse(action.state);\r\n this.store.reset(prevState);\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\r\n console.warn('Skip is not supported at this time.');\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\r\n const {\r\n actionsById,\r\n computedStates,\r\n currentStateIndex\r\n } = action.payload.nextLiftedState;\r\n this.devtoolsExtension!.init(computedStates[0].state);\r\n Object.keys(actionsById)\r\n .filter(actionId => actionId !== '0')\r\n .forEach(actionId =>\r\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\r\n );\r\n this.store.reset(computedStates[currentStateIndex].state);\r\n }\r\n } else if (action.type === ReduxDevtoolsActionType.Action) {\r\n const actionPayload = JSON.parse(action.payload);\r\n this.store.dispatch(actionPayload);\r\n }\r\n }\r\n\r\n private connect(): void {\r\n if (!this.globalDevtools || this._options.disabled) {\r\n return;\r\n }\r\n\r\n // The `connect` method adds `message` event listener since it communicates\r\n // with an extension through `window.postMessage` and message events.\r\n // We handle only 2 events; thus, we don't want to run many change detections\r\n // because the extension sends events that we don't have to handle.\r\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\r\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\r\n );\r\n\r\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\r\n if (\r\n action.type === ReduxDevtoolsActionType.Dispatch ||\r\n action.type === ReduxDevtoolsActionType.Action\r\n ) {\r\n this._ngZone.run(() => {\r\n this.dispatched(action);\r\n });\r\n }\r\n });\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\r\nimport { NGXS_PLUGINS } from '@ngxs/store';\r\n\r\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\r\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\r\n\r\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\r\n return {\r\n name: 'NGXS',\r\n ...options\r\n };\r\n}\r\n\r\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\r\n\r\n@NgModule()\r\nexport class NgxsReduxDevtoolsPluginModule {\r\n static forRoot(\r\n options?: NgxsDevtoolsOptions\r\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\r\n return {\r\n ngModule: NgxsReduxDevtoolsPluginModule,\r\n providers: [\r\n {\r\n provide: NGXS_PLUGINS,\r\n useClass: NgxsReduxDevtoolsPlugin,\r\n multi: true\r\n },\r\n {\r\n provide: USER_OPTIONS,\r\n useValue: options\r\n },\r\n {\r\n provide: NGXS_DEVTOOLS_OPTIONS,\r\n useFactory: devtoolsOptionsFactory,\r\n deps: [USER_OPTIONS]\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;AAKA,oCAIC;;;;;;IAHC,4DAAuB;;;;;;IACvB,oEAAqC;;;;;IACrC,8DAAmE;;;;;AAGrE,iCAMC;;;IALC,kCAAa;;IACb,qCAAa;;IACb,mCAAW;;IACX,gCAAW;;IACX,oCAAe;;;;;AAGjB,kCAyBC;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,IAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;;;IClC9E,UAAW,UAAU;IACrB,QAAS,QAAQ;;;;IAIjB,cAAe,gBAAgB;IAC/B,aAAc,eAAe;IAC7B,cAAe,eAAe;IAC9B,aAAc,cAAc;;;;;;AAO9B;IAQE,iCACyC,QAA6B,EAC5D,SAAmB,EACnB,OAAe;QAFgB,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAAQ;QATjB,sBAAiB,GAAiC,IAAI,CAAC;QAC9C,mBAAc,GAC7B,OAAO,CAAC,8BAA8B,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAElE,gBAAW,GAAwB,IAAI,CAAC;QAO9C,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QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,uBAAuB;oBACjC,KAAK,EAAE,IAAI;iBACZ;gBACD;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,UAAU,EAAE,sBAAsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;gBAxBF,QAAQ;;IAyBT,oCAAC;CAzBD;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"function","parameters":["options"],"value":{"name":"NGXS"}},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":32},"arguments":["USER_OPTIONS"]},"NgxsReduxDevtoolsPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":15,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":24,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"reference","name":"options"}},{"provide":{"__symbolic":"reference","name":"NGXS_DEVTOOLS_OPTIONS"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","name":"ɵb"}]}]}}}},"NgxsReduxDevtoolsPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"function","parameters":["options"],"value":{"name":"NGXS"}},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":32},"arguments":["USER_OPTIONS"]},"NgxsReduxDevtoolsPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":15,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":24,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"reference","name":"options"}},{"provide":{"__symbolic":"reference","name":"NGXS_DEVTOOLS_OPTIONS"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","name":"ɵb"}]}]}}}},"NgxsReduxDevtoolsPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":27,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":36,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_DEVTOOLS_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"NgxsDevtoolsOptions"},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":37,"character":23},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":38,"character":21}]}],"ngOnDestroy":[{"__symbolic":"method"}],"handle":[{"__symbolic":"method"}],"sendToDevTools":[{"__symbolic":"method"}],"dispatched":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}]}},"NgxsDevtoolsExtension":{"__symbolic":"interface"},"NgxsDevtoolsAction":{"__symbolic":"interface"},"NgxsDevtoolsOptions":{"__symbolic":"interface"},"NGXS_DEVTOOLS_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":46,"character":41},"arguments":["NGXS_DEVTOOLS_OPTIONS"]}},"origins":{"ɵa":"./src/devtools.module","ɵb":"./src/devtools.module","NgxsReduxDevtoolsPluginModule":"./src/devtools.module","NgxsReduxDevtoolsPlugin":"./src/devtools.plugin","NgxsDevtoolsExtension":"./src/symbols","NgxsDevtoolsAction":"./src/symbols","NgxsDevtoolsOptions":"./src/symbols","NGXS_DEVTOOLS_OPTIONS":"./src/symbols"},"importAs":"@ngxs/devtools-plugin"}
|
package/package.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"$schema": "../../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@ngxs/devtools-plugin",
|
|
4
4
|
"description": "redux devtools plugin for @ngxs/store",
|
|
5
|
-
"version": "3.7.
|
|
5
|
+
"version": "3.7.4",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@ngxs/store": "^3.7.
|
|
9
|
-
"@angular/core": ">=6.1.0 <
|
|
8
|
+
"@ngxs/store": "^3.7.4 || ^3.7.4-dev",
|
|
9
|
+
"@angular/core": ">=6.1.0 <15.0.0",
|
|
10
10
|
"rxjs": ">=6.5.5"
|
|
11
11
|
},
|
|
12
12
|
"main": "bundles/ngxs-devtools-plugin.umd.js",
|
package/src/devtools.plugin.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { Injector } from '@angular/core';
|
|
1
|
+
import { Injector, NgZone, OnDestroy } from '@angular/core';
|
|
2
2
|
import { NgxsNextPluginFn, NgxsPlugin } from '@ngxs/store';
|
|
3
3
|
import { NgxsDevtoolsAction, NgxsDevtoolsOptions } from './symbols';
|
|
4
4
|
/**
|
|
5
5
|
* Adds support for the Redux Devtools extension:
|
|
6
6
|
* http://extension.remotedev.io/
|
|
7
7
|
*/
|
|
8
|
-
export declare class NgxsReduxDevtoolsPlugin implements NgxsPlugin {
|
|
8
|
+
export declare class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {
|
|
9
9
|
private _options;
|
|
10
10
|
private _injector;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
|
|
11
|
+
private _ngZone;
|
|
12
|
+
private devtoolsExtension;
|
|
13
|
+
private readonly globalDevtools;
|
|
14
|
+
private unsubscribe;
|
|
15
|
+
constructor(_options: NgxsDevtoolsOptions, _injector: Injector, _ngZone: NgZone);
|
|
16
|
+
ngOnDestroy(): void;
|
|
14
17
|
/**
|
|
15
18
|
* Lazy get the store for circular dependency issues
|
|
16
19
|
*/
|
|
@@ -24,4 +27,5 @@ export declare class NgxsReduxDevtoolsPlugin implements NgxsPlugin {
|
|
|
24
27
|
* Handle the action from the dev tools subscription
|
|
25
28
|
*/
|
|
26
29
|
dispatched(action: NgxsDevtoolsAction): void;
|
|
30
|
+
private connect;
|
|
27
31
|
}
|
package/src/symbols.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { Subscription } from 'rxjs';
|
|
3
2
|
/**
|
|
4
3
|
* Interface for the redux-devtools-extension API.
|
|
5
4
|
*/
|
|
6
5
|
export interface NgxsDevtoolsExtension {
|
|
7
6
|
init(state: any): void;
|
|
8
7
|
send(action: any, state?: any): void;
|
|
9
|
-
subscribe(fn: (message: NgxsDevtoolsAction) => void):
|
|
8
|
+
subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;
|
|
10
9
|
}
|
|
11
10
|
export interface NgxsDevtoolsAction {
|
|
12
11
|
type: string;
|