@ngxs/router-plugin 19.0.0 → 20.0.0-dev.master-5e7c96c

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.
@@ -1,10 +1,15 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
 
3
+ var NavigationActionTiming;
4
+ (function (NavigationActionTiming) {
5
+ NavigationActionTiming[NavigationActionTiming["PreActivation"] = 1] = "PreActivation";
6
+ NavigationActionTiming[NavigationActionTiming["PostActivation"] = 2] = "PostActivation";
7
+ })(NavigationActionTiming || (NavigationActionTiming = {}));
3
8
  const ɵUSER_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'USER_OPTIONS' : '', { providedIn: 'root', factory: () => undefined });
4
9
  const ɵNGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_ROUTER_PLUGIN_OPTIONS' : '', { providedIn: 'root', factory: () => ({}) });
5
10
  function ɵcreateRouterPluginOptions(options) {
6
11
  return {
7
- navigationActionTiming: (options && options.navigationActionTiming) || 1 /* NavigationActionTiming.PreActivation */
12
+ navigationActionTiming: options?.navigationActionTiming || NavigationActionTiming.PreActivation
8
13
  };
9
14
  }
10
15
 
@@ -12,5 +17,5 @@ function ɵcreateRouterPluginOptions(options) {
12
17
  * Generated bundle index. Do not edit.
13
18
  */
14
19
 
15
- export { ɵNGXS_ROUTER_PLUGIN_OPTIONS, ɵUSER_OPTIONS, ɵcreateRouterPluginOptions };
20
+ export { NavigationActionTiming, ɵNGXS_ROUTER_PLUGIN_OPTIONS, ɵUSER_OPTIONS, ɵcreateRouterPluginOptions };
16
21
  //# sourceMappingURL=ngxs-router-plugin-internals.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-router-plugin-internals.mjs","sources":["../../../packages/router-plugin/internals/src/symbols.ts","../../../packages/router-plugin/internals/src/ngxs-router-plugin-internals.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\ndeclare const ngDevMode: boolean;\n\nexport const enum NavigationActionTiming {\n PreActivation = 1,\n PostActivation = 2\n}\n\nexport interface NgxsRouterPluginOptions {\n navigationActionTiming?: NavigationActionTiming;\n}\n\nexport const ɵUSER_OPTIONS = new InjectionToken<NgxsRouterPluginOptions | undefined>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'USER_OPTIONS' : '',\n { providedIn: 'root', factory: () => undefined }\n);\n\nexport const ɵNGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken<NgxsRouterPluginOptions>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_ROUTER_PLUGIN_OPTIONS' : '',\n { providedIn: 'root', factory: () => ({}) }\n);\n\nexport function ɵcreateRouterPluginOptions(\n options: NgxsRouterPluginOptions | undefined\n): NgxsRouterPluginOptions {\n return {\n navigationActionTiming:\n (options && options.navigationActionTiming) || NavigationActionTiming.PreActivation\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAaO,MAAM,aAAa,GAAG,IAAI,cAAc,CAC7C,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,cAAc,GAAG,EAAE,EACnE,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE;AAGrC,MAAA,2BAA2B,GAAG,IAAI,cAAc,CAC3D,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,4BAA4B,GAAG,EAAE,EACjF,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAGvC,SAAU,0BAA0B,CACxC,OAA4C,EAAA;IAE5C,OAAO;QACL,sBAAsB,EACpB,CAAC,OAAO,IAAI,OAAO,CAAC,sBAAsB,KAAyC,CAAA;KACtF;AACH;;AC9BA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngxs-router-plugin-internals.mjs","sources":["../../../packages/router-plugin/internals/src/symbols.ts","../../../packages/router-plugin/internals/src/ngxs-router-plugin-internals.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\ndeclare const ngDevMode: boolean;\n\nexport enum NavigationActionTiming {\n PreActivation = 1,\n PostActivation = 2\n}\n\nexport interface NgxsRouterPluginOptions {\n navigationActionTiming?: NavigationActionTiming;\n}\n\nexport const ɵUSER_OPTIONS = new InjectionToken<NgxsRouterPluginOptions | undefined>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'USER_OPTIONS' : '',\n { providedIn: 'root', factory: () => undefined }\n);\n\nexport const ɵNGXS_ROUTER_PLUGIN_OPTIONS = new InjectionToken<NgxsRouterPluginOptions>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_ROUTER_PLUGIN_OPTIONS' : '',\n { providedIn: 'root', factory: () => ({}) }\n);\n\nexport function ɵcreateRouterPluginOptions(\n options: NgxsRouterPluginOptions | undefined\n): NgxsRouterPluginOptions {\n return {\n navigationActionTiming:\n options?.navigationActionTiming || NavigationActionTiming.PreActivation\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;IAIY;AAAZ,CAAA,UAAY,sBAAsB,EAAA;AAChC,IAAA,sBAAA,CAAA,sBAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAiB;AACjB,IAAA,sBAAA,CAAA,sBAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAkB;AACpB,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,GAGjC,EAAA,CAAA,CAAA;AAMM,MAAM,aAAa,GAAG,IAAI,cAAc,CAC7C,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,cAAc,GAAG,EAAE,EACnE,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE;AAGrC,MAAA,2BAA2B,GAAG,IAAI,cAAc,CAC3D,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,4BAA4B,GAAG,EAAE,EACjF,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAGvC,SAAU,0BAA0B,CACxC,OAA4C,EAAA;IAE5C,OAAO;AACL,QAAA,sBAAsB,EACpB,OAAO,EAAE,sBAAsB,IAAI,sBAAsB,CAAC;KAC7D;AACH;;AC9BA;;AAEG;;;;"}
@@ -1,18 +1,20 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, NgZone, Injectable, NgModule, makeEnvironmentProviders } from '@angular/core';
2
+ import { inject, NgZone, DestroyRef, Injectable, NgModule, makeEnvironmentProviders } from '@angular/core';
3
3
  import * as i1 from '@ngxs/store';
4
- import { StateToken, Store, Action, Selector, State, NgxsModule, provideStates } from '@ngxs/store';
5
- import { ɵNGXS_ROUTER_PLUGIN_OPTIONS as _NGXS_ROUTER_PLUGIN_OPTIONS, ɵUSER_OPTIONS as _USER_OPTIONS, ɵcreateRouterPluginOptions as _createRouterPluginOptions } from '@ngxs/router-plugin/internals';
6
- import { __decorate, __metadata } from 'tslib';
4
+ import { StateToken, Store, createSelector, Action, State, NgxsModule, provideStates } from '@ngxs/store';
5
+ import { ɵNGXS_ROUTER_PLUGIN_OPTIONS as _NGXS_ROUTER_PLUGIN_OPTIONS, NavigationActionTiming, ɵUSER_OPTIONS as _USER_OPTIONS, ɵcreateRouterPluginOptions as _createRouterPluginOptions } from '@ngxs/router-plugin/internals';
6
+ export { NavigationActionTiming } from '@ngxs/router-plugin/internals';
7
+ import { __decorate } from 'tslib';
7
8
  import { Router, NavigationStart, RoutesRecognized, ResolveEnd, NavigationCancel, NavigationError, NavigationEnd } from '@angular/router';
8
- import { ReplaySubject } from 'rxjs';
9
- import { takeUntil } from 'rxjs/operators';
10
9
 
11
10
  /**
12
11
  * Public event api of the router
13
12
  */
14
13
  class Navigate {
15
- static { this.type = '[Router] Navigate'; }
14
+ path;
15
+ queryParams;
16
+ extras;
17
+ static type = '[Router] Navigate';
16
18
  constructor(path, queryParams, extras) {
17
19
  this.path = path;
18
20
  this.queryParams = queryParams;
@@ -28,7 +30,10 @@ class Navigate {
28
30
  * An action dispatched when the router starts the navigation.
29
31
  */
30
32
  class RouterRequest {
31
- static { this.type = '[Router] RouterRequest'; }
33
+ routerState;
34
+ event;
35
+ trigger;
36
+ static type = '[Router] RouterRequest';
32
37
  constructor(routerState, event, trigger = 'none') {
33
38
  this.routerState = routerState;
34
39
  this.event = event;
@@ -39,7 +44,10 @@ class RouterRequest {
39
44
  * An action dispatched when the router navigates.
40
45
  */
41
46
  class RouterNavigation {
42
- static { this.type = '[Router] RouterNavigation'; }
47
+ routerState;
48
+ event;
49
+ trigger;
50
+ static type = '[Router] RouterNavigation';
43
51
  constructor(routerState, event, trigger = 'none') {
44
52
  this.routerState = routerState;
45
53
  this.event = event;
@@ -50,7 +58,11 @@ class RouterNavigation {
50
58
  * An action dispatched when the router cancel navigation.
51
59
  */
52
60
  class RouterCancel {
53
- static { this.type = '[Router] RouterCancel'; }
61
+ routerState;
62
+ storeState;
63
+ event;
64
+ trigger;
65
+ static type = '[Router] RouterCancel';
54
66
  constructor(routerState, storeState, event, trigger = 'none') {
55
67
  this.routerState = routerState;
56
68
  this.storeState = storeState;
@@ -62,7 +74,11 @@ class RouterCancel {
62
74
  * An action dispatched when the router errors.
63
75
  */
64
76
  class RouterError {
65
- static { this.type = '[Router] RouterError'; }
77
+ routerState;
78
+ storeState;
79
+ event;
80
+ trigger;
81
+ static type = '[Router] RouterError';
66
82
  constructor(routerState, storeState, event, trigger = 'none') {
67
83
  this.routerState = routerState;
68
84
  this.storeState = storeState;
@@ -74,7 +90,10 @@ class RouterError {
74
90
  * An action dispatched when the `ResolveEnd` event is triggered.
75
91
  */
76
92
  class RouterDataResolved {
77
- static { this.type = '[Router] RouterDataResolved'; }
93
+ routerState;
94
+ event;
95
+ trigger;
96
+ static type = '[Router] RouterDataResolved';
78
97
  constructor(routerState, event, trigger = 'none') {
79
98
  this.routerState = routerState;
80
99
  this.event = event;
@@ -85,7 +104,10 @@ class RouterDataResolved {
85
104
  * An action dispatched when the router navigation has been finished successfully.
86
105
  */
87
106
  class RouterNavigated {
88
- static { this.type = '[Router] RouterNavigated'; }
107
+ routerState;
108
+ event;
109
+ trigger;
110
+ static type = '[Router] RouterNavigated';
89
111
  constructor(routerState, event, trigger = 'none') {
90
112
  this.routerState = routerState;
91
113
  this.event = event;
@@ -131,40 +153,38 @@ class DefaultRouterStateSerializer {
131
153
  // the following state token must replace `RouterState`.
132
154
  const ROUTER_STATE_TOKEN = new StateToken('router');
133
155
  let RouterState = class RouterState {
134
- static state(state) {
135
- // The `state` is optional if the selector is invoked before the router
136
- // state is registered in NGXS.
137
- return state?.state;
138
- }
139
- static url(state) {
140
- return state?.state?.url;
156
+ _store = inject(Store);
157
+ _router = inject(Router);
158
+ _serializer = inject(RouterStateSerializer);
159
+ _ngZone = inject(NgZone);
160
+ /**
161
+ * Determines how navigation was performed by the `RouterState` itself
162
+ * or outside via `new Navigate(...)`
163
+ */
164
+ _trigger = 'none';
165
+ /**
166
+ * That's the serialized state from the `Router` class
167
+ */
168
+ _routerState = null;
169
+ /**
170
+ * That's the value of the `RouterState` state
171
+ */
172
+ _storeState = null;
173
+ _lastEvent = null;
174
+ _options = inject(_NGXS_ROUTER_PLUGIN_OPTIONS);
175
+ _subscription;
176
+ static state() {
177
+ return createSelector([ROUTER_STATE_TOKEN], (state) => {
178
+ // The `state` is optional if the selector is invoked before the router
179
+ // state is registered in NGXS.
180
+ return state?.state;
181
+ });
141
182
  }
183
+ static url = createSelector([ROUTER_STATE_TOKEN], state => state?.state?.url);
142
184
  constructor() {
143
- this._store = inject(Store);
144
- this._router = inject(Router);
145
- this._serializer = inject(RouterStateSerializer);
146
- this._ngZone = inject(NgZone);
147
- /**
148
- * Determines how navigation was performed by the `RouterState` itself
149
- * or outside via `new Navigate(...)`
150
- */
151
- this._trigger = 'none';
152
- /**
153
- * That's the serialized state from the `Router` class
154
- */
155
- this._routerState = null;
156
- /**
157
- * That's the value of the `RouterState` state
158
- */
159
- this._storeState = null;
160
- this._lastEvent = null;
161
- this._options = inject(_NGXS_ROUTER_PLUGIN_OPTIONS);
162
- this._destroy$ = new ReplaySubject(1);
163
185
  this._setUpStoreListener();
164
186
  this._setUpRouterEventsListener();
165
- }
166
- ngOnDestroy() {
167
- this._destroy$.next();
187
+ inject(DestroyRef).onDestroy(() => this._subscription.unsubscribe());
168
188
  }
169
189
  navigate(_, action) {
170
190
  return this._ngZone.run(() => this._router.navigate(action.path, {
@@ -180,15 +200,13 @@ let RouterState = class RouterState {
180
200
  });
181
201
  }
182
202
  _setUpStoreListener() {
183
- const routerState$ = this._store
184
- .select(ROUTER_STATE_TOKEN)
185
- .pipe(takeUntil(this._destroy$));
203
+ const routerState$ = this._store.select(ROUTER_STATE_TOKEN);
186
204
  routerState$.subscribe((state) => {
187
205
  this._navigateIfNeeded(state);
188
206
  });
189
207
  }
190
208
  _navigateIfNeeded(routerState) {
191
- if (routerState && routerState.trigger === 'devtools') {
209
+ if (routerState?.trigger === 'devtools') {
192
210
  this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);
193
211
  }
194
212
  const canSkipNavigation = !this._storeState ||
@@ -206,10 +224,9 @@ let RouterState = class RouterState {
206
224
  }
207
225
  _setUpRouterEventsListener() {
208
226
  const dispatchRouterNavigationLate = this._options != null &&
209
- this._options.navigationActionTiming === 2 /* NavigationActionTiming.PostActivation */;
227
+ this._options.navigationActionTiming === NavigationActionTiming.PostActivation;
210
228
  let lastRoutesRecognized;
211
- const events$ = this._router.events.pipe(takeUntil(this._destroy$));
212
- events$.subscribe(event => {
229
+ this._subscription = this._router.events.subscribe(event => {
213
230
  this._lastEvent = event;
214
231
  if (event instanceof NavigationStart) {
215
232
  this._navigationStart(event);
@@ -287,14 +304,11 @@ let RouterState = class RouterState {
287
304
  this._storeState = null;
288
305
  this._routerState = null;
289
306
  }
290
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RouterState, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
291
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RouterState }); }
307
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: RouterState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
308
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: RouterState });
292
309
  };
293
310
  __decorate([
294
- Action(Navigate),
295
- __metadata("design:type", Function),
296
- __metadata("design:paramtypes", [Object, Navigate]),
297
- __metadata("design:returntype", void 0)
311
+ Action(Navigate)
298
312
  ], RouterState.prototype, "navigate", null);
299
313
  __decorate([
300
314
  Action([
@@ -304,23 +318,8 @@ __decorate([
304
318
  (RouterCancel),
305
319
  (RouterDataResolved),
306
320
  (RouterNavigated)
307
- ]),
308
- __metadata("design:type", Function),
309
- __metadata("design:paramtypes", [Object, Object]),
310
- __metadata("design:returntype", void 0)
321
+ ])
311
322
  ], RouterState.prototype, "angularRouterAction", null);
312
- __decorate([
313
- Selector(),
314
- __metadata("design:type", Function),
315
- __metadata("design:paramtypes", [Object]),
316
- __metadata("design:returntype", void 0)
317
- ], RouterState, "state", null);
318
- __decorate([
319
- Selector(),
320
- __metadata("design:type", Function),
321
- __metadata("design:paramtypes", [Object]),
322
- __metadata("design:returntype", Object)
323
- ], RouterState, "url", null);
324
323
  RouterState = __decorate([
325
324
  State({
326
325
  name: ROUTER_STATE_TOKEN,
@@ -329,10 +328,9 @@ RouterState = __decorate([
329
328
  navigationId: undefined,
330
329
  trigger: 'none'
331
330
  }
332
- }),
333
- __metadata("design:paramtypes", [])
331
+ })
334
332
  ], RouterState);
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RouterState, decorators: [{
333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: RouterState, decorators: [{
336
334
  type: Injectable
337
335
  }], ctorParameters: () => [], propDecorators: { navigate: [], angularRouterAction: [] } });
338
336
 
@@ -351,11 +349,11 @@ class NgxsRouterPluginModule {
351
349
  ]
352
350
  };
353
351
  }
354
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsRouterPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
355
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: NgxsRouterPluginModule, imports: [i1.ɵNgxsFeatureModule] }); }
356
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsRouterPluginModule, imports: [NgxsModule.forFeature([RouterState])] }); }
352
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRouterPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
353
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsRouterPluginModule, imports: [i1.ɵNgxsFeatureModule] });
354
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRouterPluginModule, imports: [NgxsModule.forFeature([RouterState])] });
357
355
  }
358
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsRouterPluginModule, decorators: [{
356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRouterPluginModule, decorators: [{
359
357
  type: NgModule,
360
358
  args: [{
361
359
  imports: [NgxsModule.forFeature([RouterState])]
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-router-plugin.mjs","sources":["../../../packages/router-plugin/src/router.actions.ts","../../../packages/router-plugin/src/serializer.ts","../../../packages/router-plugin/src/router.state.ts","../../../packages/router-plugin/src/router.module.ts","../../../packages/router-plugin/index.ts","../../../packages/router-plugin/ngxs-router-plugin.ts"],"sourcesContent":["import {\n NavigationCancel,\n NavigationError,\n NavigationExtras,\n Params,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n NavigationStart,\n NavigationEnd\n} from '@angular/router';\n\nimport { RouterTrigger } from './router.state';\n\n/**\n * Public event api of the router\n */\nexport class Navigate {\n static readonly type = '[Router] Navigate';\n\n constructor(\n public path: any[],\n public queryParams?: Params,\n public extras?: NavigationExtras\n ) {}\n}\n\n/**\n *\n * Angular Routers internal state events\n *\n */\n\n/**\n * An action dispatched when the router starts the navigation.\n */\nexport class RouterRequest<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterRequest';\n\n constructor(\n public routerState: T,\n public event: NavigationStart,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router navigates.\n */\nexport class RouterNavigation<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterNavigation';\n\n constructor(\n public routerState: T,\n public event: RoutesRecognized,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router cancel navigation.\n */\nexport class RouterCancel<T, V = RouterStateSnapshot> {\n static readonly type = '[Router] RouterCancel';\n\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationCancel,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router errors.\n */\nexport class RouterError<T, V = RouterStateSnapshot> {\n static readonly type = '[Router] RouterError';\n\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationError,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the `ResolveEnd` event is triggered.\n */\nexport class RouterDataResolved<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterDataResolved';\n\n constructor(\n public routerState: T,\n public event: ResolveEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router navigation has been finished successfully.\n */\nexport class RouterNavigated<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterNavigated';\n\n constructor(\n public routerState: T,\n public event: NavigationEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An union type of router actions.\n */\nexport type RouterAction<T, V = RouterStateSnapshot> =\n | RouterRequest<V>\n | RouterNavigation<V>\n | RouterCancel<T, V>\n | RouterError<T, V>\n | RouterDataResolved<V>\n | RouterNavigated<V>;\n","import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\n\nexport abstract class RouterStateSerializer<T> {\n abstract serialize(routerState: RouterStateSnapshot): T;\n}\n\nexport interface SerializedRouterStateSnapshot {\n root: ActivatedRouteSnapshot;\n url: string;\n}\n\nexport class DefaultRouterStateSerializer\n implements RouterStateSerializer<SerializedRouterStateSnapshot>\n{\n serialize(routerState: RouterStateSnapshot): SerializedRouterStateSnapshot {\n return {\n root: this.serializeRoute(routerState.root),\n url: routerState.url\n };\n }\n\n private serializeRoute(route: ActivatedRouteSnapshot): ActivatedRouteSnapshot {\n const children = route.children.map(c => this.serializeRoute(c));\n return {\n url: route.url,\n title: route.title,\n params: route.params,\n queryParams: route.queryParams,\n fragment: route.fragment!,\n data: route.data,\n outlet: route.outlet,\n component: null,\n routeConfig: null,\n root: null as any,\n parent: null,\n firstChild: children[0],\n children: children,\n pathFromRoot: null as any,\n paramMap: route.paramMap,\n queryParamMap: route.queryParamMap,\n toString: route.toString\n };\n }\n}\n","import { NgZone, Injectable, OnDestroy, inject } from '@angular/core';\nimport {\n NavigationCancel,\n NavigationError,\n Router,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n NavigationStart,\n NavigationEnd,\n Event\n} from '@angular/router';\nimport { Action, Selector, State, StateContext, StateToken, Store } from '@ngxs/store';\nimport {\n NavigationActionTiming,\n ɵNGXS_ROUTER_PLUGIN_OPTIONS\n} from '@ngxs/router-plugin/internals';\nimport { ReplaySubject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport {\n Navigate,\n RouterAction,\n RouterCancel,\n RouterError,\n RouterNavigation,\n RouterDataResolved,\n RouterRequest,\n RouterNavigated\n} from './router.actions';\nimport { RouterStateSerializer } from './serializer';\n\nexport interface RouterStateModel<T = RouterStateSnapshot> {\n state?: T;\n navigationId?: number;\n trigger: RouterTrigger;\n}\n\nexport type RouterTrigger =\n | 'none'\n | 'router'\n | 'store'\n // The `devtools` trigger means that the state change has been triggered by Redux DevTools (e.g. when the time-traveling is used).\n | 'devtools';\n\n// NGXS doesn't permit untyped selectors, such as `select(RouterState)`,\n// as the `RouterState` class itself lacks type information. Therefore,\n// the following state token must replace `RouterState`.\nexport const ROUTER_STATE_TOKEN = new StateToken<RouterStateModel>('router');\n\n@State<RouterStateModel>({\n name: ROUTER_STATE_TOKEN,\n defaults: {\n state: undefined,\n navigationId: undefined,\n trigger: 'none'\n }\n})\n@Injectable()\nexport class RouterState implements OnDestroy {\n private _store = inject(Store);\n private _router = inject(Router);\n private _serializer: RouterStateSerializer<RouterStateSnapshot> =\n inject(RouterStateSerializer);\n private _ngZone = inject(NgZone);\n\n /**\n * Determines how navigation was performed by the `RouterState` itself\n * or outside via `new Navigate(...)`\n */\n private _trigger: RouterTrigger = 'none';\n\n /**\n * That's the serialized state from the `Router` class\n */\n private _routerState: RouterStateSnapshot | null = null;\n\n /**\n * That's the value of the `RouterState` state\n */\n private _storeState: RouterStateModel | null = null;\n\n private _lastEvent: Event | null = null;\n\n private _options = inject(ɵNGXS_ROUTER_PLUGIN_OPTIONS);\n\n private _destroy$ = new ReplaySubject<void>(1);\n\n @Selector()\n static state<T = RouterStateSnapshot>(state: RouterStateModel<T>) {\n // The `state` is optional if the selector is invoked before the router\n // state is registered in NGXS.\n return state?.state;\n }\n\n @Selector()\n static url(state: RouterStateModel): string | undefined {\n return state?.state?.url;\n }\n\n constructor() {\n this._setUpStoreListener();\n this._setUpRouterEventsListener();\n }\n\n ngOnDestroy(): void {\n this._destroy$.next();\n }\n\n @Action(Navigate)\n navigate(_: StateContext<RouterStateModel>, action: Navigate) {\n return this._ngZone.run(() =>\n this._router.navigate(action.path, {\n queryParams: action.queryParams,\n ...action.extras\n })\n );\n }\n\n @Action([\n RouterRequest<RouterStateSnapshot>,\n RouterNavigation<RouterStateSnapshot>,\n RouterError<RouterStateModel, RouterStateSnapshot>,\n RouterCancel<RouterStateModel, RouterStateSnapshot>,\n RouterDataResolved<RouterStateSnapshot>,\n RouterNavigated<RouterStateSnapshot>\n ])\n angularRouterAction(\n ctx: StateContext<RouterStateModel>,\n action: RouterAction<RouterStateModel, RouterStateSnapshot>\n ): void {\n ctx.setState({\n trigger: action.trigger,\n state: action.routerState,\n navigationId: action.event.id\n });\n }\n\n private _setUpStoreListener(): void {\n const routerState$ = this._store\n .select(ROUTER_STATE_TOKEN)\n .pipe(takeUntil(this._destroy$));\n routerState$.subscribe((state: RouterStateModel | undefined) => {\n this._navigateIfNeeded(state);\n });\n }\n\n private _navigateIfNeeded(routerState: RouterStateModel | undefined): void {\n if (routerState && routerState.trigger === 'devtools') {\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n }\n\n const canSkipNavigation =\n !this._storeState ||\n !this._storeState.state ||\n !routerState ||\n routerState.trigger === 'router' ||\n this._router.url === this._storeState.state.url ||\n this._lastEvent instanceof NavigationStart;\n\n if (canSkipNavigation) {\n return;\n }\n\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n this._trigger = 'store';\n this._ngZone.run(() => this._router.navigateByUrl(this._storeState!.state!.url));\n }\n\n private _setUpRouterEventsListener(): void {\n const dispatchRouterNavigationLate =\n this._options != null &&\n this._options.navigationActionTiming === NavigationActionTiming.PostActivation;\n\n let lastRoutesRecognized: RoutesRecognized;\n\n const events$ = this._router.events.pipe(takeUntil(this._destroy$));\n events$.subscribe(event => {\n this._lastEvent = event;\n\n if (event instanceof NavigationStart) {\n this._navigationStart(event);\n } else if (event instanceof RoutesRecognized) {\n lastRoutesRecognized = event;\n if (!dispatchRouterNavigationLate && this._trigger !== 'store') {\n this._dispatchRouterNavigation(lastRoutesRecognized);\n }\n } else if (event instanceof ResolveEnd) {\n this._dispatchRouterDataResolved(event);\n } else if (event instanceof NavigationCancel) {\n this._dispatchRouterCancel(event);\n this._reset();\n } else if (event instanceof NavigationError) {\n this._dispatchRouterError(event);\n this._reset();\n } else if (event instanceof NavigationEnd) {\n if (this._trigger !== 'store') {\n if (dispatchRouterNavigationLate) {\n this._dispatchRouterNavigation(lastRoutesRecognized);\n }\n this._dispatchRouterNavigated(event);\n }\n this._reset();\n }\n });\n }\n\n /** Reacts to `NavigationStart`. */\n private _navigationStart(event: NavigationStart): void {\n this._routerState = this._serializer.serialize(this._router.routerState.snapshot);\n\n if (this._trigger !== 'none') {\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n this._dispatchRouterAction(new RouterRequest(this._routerState, event, this._trigger));\n }\n }\n\n /** Reacts to `ResolveEnd`. */\n private _dispatchRouterDataResolved(event: ResolveEnd): void {\n const routerState = this._serializer.serialize(event.state);\n this._dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));\n }\n\n /** Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`. */\n private _dispatchRouterNavigation(lastRoutesRecognized: RoutesRecognized): void {\n const nextRouterState = this._serializer.serialize(lastRoutesRecognized.state);\n\n this._dispatchRouterAction(\n new RouterNavigation(\n nextRouterState,\n new RoutesRecognized(\n lastRoutesRecognized.id,\n lastRoutesRecognized.url,\n lastRoutesRecognized.urlAfterRedirects,\n nextRouterState\n ),\n this._trigger\n )\n );\n }\n\n /** Reacts to `NavigationCancel`. */\n private _dispatchRouterCancel(event: NavigationCancel): void {\n this._dispatchRouterAction(\n new RouterCancel(this._routerState!, this._storeState, event, this._trigger)\n );\n }\n\n /** Reacts to `NavigationEnd`. */\n private _dispatchRouterError(event: NavigationError): void {\n this._dispatchRouterAction(\n new RouterError(\n this._routerState!,\n this._storeState,\n new NavigationError(event.id, event.url, `${event}`),\n this._trigger\n )\n );\n }\n\n /** Reacts to `NavigationEnd`. */\n private _dispatchRouterNavigated(event: NavigationEnd): void {\n const routerState = this._serializer.serialize(this._router.routerState.snapshot);\n this._dispatchRouterAction(new RouterNavigated(routerState, event, this._trigger));\n }\n\n private _dispatchRouterAction<T>(action: RouterAction<T>): void {\n this._trigger = 'router';\n\n try {\n this._store.dispatch(action);\n } finally {\n this._trigger = 'none';\n }\n }\n\n private _reset(): void {\n this._trigger = 'none';\n this._storeState = null;\n this._routerState = null;\n }\n}\n","import {\n EnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n makeEnvironmentProviders\n} from '@angular/core';\nimport { NgxsModule, provideStates } from '@ngxs/store';\nimport {\n NgxsRouterPluginOptions,\n ɵcreateRouterPluginOptions,\n ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n ɵUSER_OPTIONS\n} from '@ngxs/router-plugin/internals';\n\nimport { RouterState } from './router.state';\nimport { DefaultRouterStateSerializer, RouterStateSerializer } from './serializer';\n\n@NgModule({\n imports: [NgxsModule.forFeature([RouterState])]\n})\nexport class NgxsRouterPluginModule {\n static forRoot(\n options?: NgxsRouterPluginOptions\n ): ModuleWithProviders<NgxsRouterPluginModule> {\n return {\n ngModule: NgxsRouterPluginModule,\n providers: [\n { provide: ɵUSER_OPTIONS, useValue: options },\n {\n provide: ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n useFactory: ɵcreateRouterPluginOptions,\n deps: [ɵUSER_OPTIONS]\n },\n { provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }\n ]\n };\n }\n}\n\nexport function withNgxsRouterPlugin(options?: NgxsRouterPluginOptions): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideStates([RouterState]),\n { provide: ɵUSER_OPTIONS, useValue: options },\n {\n provide: ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n useFactory: ɵcreateRouterPluginOptions,\n deps: [ɵUSER_OPTIONS]\n },\n { provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }\n ]);\n}\n","/**\n * The public api for consumers of @ngxs/router-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵNGXS_ROUTER_PLUGIN_OPTIONS","ɵUSER_OPTIONS","ɵcreateRouterPluginOptions"],"mappings":";;;;;;;;;;AAcA;;AAEG;MACU,QAAQ,CAAA;aACH,IAAI,CAAA,IAAA,GAAG,mBAAmB,CAAC;AAE3C,IAAA,WAAA,CACS,IAAW,EACX,WAAoB,EACpB,MAAyB,EAAA;QAFzB,IAAI,CAAA,IAAA,GAAJ,IAAI;QACJ,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAM,CAAA,MAAA,GAAN,MAAM;;;AAIjB;;;;AAIG;AAEH;;AAEG;MACU,aAAa,CAAA;aACR,IAAI,CAAA,IAAA,GAAG,wBAAwB,CAAC;AAEhD,IAAA,WAAA,CACS,WAAc,EACd,KAAsB,EACtB,UAAyB,MAAM,EAAA;QAF/B,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAK,CAAA,KAAA,GAAL,KAAK;QACL,IAAO,CAAA,OAAA,GAAP,OAAO;;;AAIlB;;AAEG;MACU,gBAAgB,CAAA;aACX,IAAI,CAAA,IAAA,GAAG,2BAA2B,CAAC;AAEnD,IAAA,WAAA,CACS,WAAc,EACd,KAAuB,EACvB,UAAyB,MAAM,EAAA;QAF/B,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAK,CAAA,KAAA,GAAL,KAAK;QACL,IAAO,CAAA,OAAA,GAAP,OAAO;;;AAIlB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U,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;;2FAEnC,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;AAC/C,iBAAA;;AAoBK,SAAU,oBAAoB,CAAC,OAAiC,EAAA;AACpE,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;AAC5B,QAAA,EAAE,OAAO,EAAEA,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC7C,QAAA;AACE,YAAA,OAAO,EAAED,2BAA2B;AACpC,YAAA,UAAU,EAAEE,0BAA0B;YACtC,IAAI,EAAE,CAACD,aAAa;AACrB,SAAA;AACD,QAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B;AACzE,KAAA,CAAC;AACJ;;AClDA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"ngxs-router-plugin.mjs","sources":["../../../packages/router-plugin/src/router.actions.ts","../../../packages/router-plugin/src/serializer.ts","../../../packages/router-plugin/src/router.state.ts","../../../packages/router-plugin/src/router.module.ts","../../../packages/router-plugin/index.ts","../../../packages/router-plugin/ngxs-router-plugin.ts"],"sourcesContent":["import {\n NavigationCancel,\n NavigationError,\n NavigationExtras,\n Params,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n NavigationStart,\n NavigationEnd\n} from '@angular/router';\n\nimport { RouterTrigger } from './router.state';\n\n/**\n * Public event api of the router\n */\nexport class Navigate {\n static readonly type = '[Router] Navigate';\n\n constructor(\n public path: any[],\n public queryParams?: Params,\n public extras?: NavigationExtras\n ) {}\n}\n\n/**\n *\n * Angular Routers internal state events\n *\n */\n\n/**\n * An action dispatched when the router starts the navigation.\n */\nexport class RouterRequest<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterRequest';\n\n constructor(\n public routerState: T,\n public event: NavigationStart,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router navigates.\n */\nexport class RouterNavigation<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterNavigation';\n\n constructor(\n public routerState: T,\n public event: RoutesRecognized,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router cancel navigation.\n */\nexport class RouterCancel<T, V = RouterStateSnapshot> {\n static readonly type = '[Router] RouterCancel';\n\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationCancel,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router errors.\n */\nexport class RouterError<T, V = RouterStateSnapshot> {\n static readonly type = '[Router] RouterError';\n\n constructor(\n public routerState: V,\n public storeState: T,\n public event: NavigationError,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the `ResolveEnd` event is triggered.\n */\nexport class RouterDataResolved<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterDataResolved';\n\n constructor(\n public routerState: T,\n public event: ResolveEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An action dispatched when the router navigation has been finished successfully.\n */\nexport class RouterNavigated<T = RouterStateSnapshot> {\n static readonly type = '[Router] RouterNavigated';\n\n constructor(\n public routerState: T,\n public event: NavigationEnd,\n public trigger: RouterTrigger = 'none'\n ) {}\n}\n\n/**\n * An union type of router actions.\n */\nexport type RouterAction<T, V = RouterStateSnapshot> =\n | RouterRequest<V>\n | RouterNavigation<V>\n | RouterCancel<T, V>\n | RouterError<T, V>\n | RouterDataResolved<V>\n | RouterNavigated<V>;\n","import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\n\nexport abstract class RouterStateSerializer<T> {\n abstract serialize(routerState: RouterStateSnapshot): T;\n}\n\nexport interface SerializedRouterStateSnapshot {\n root: ActivatedRouteSnapshot;\n url: string;\n}\n\nexport class DefaultRouterStateSerializer\n implements RouterStateSerializer<SerializedRouterStateSnapshot>\n{\n serialize(routerState: RouterStateSnapshot): SerializedRouterStateSnapshot {\n return {\n root: this.serializeRoute(routerState.root),\n url: routerState.url\n };\n }\n\n private serializeRoute(route: ActivatedRouteSnapshot): ActivatedRouteSnapshot {\n const children = route.children.map(c => this.serializeRoute(c));\n return {\n url: route.url,\n title: route.title,\n params: route.params,\n queryParams: route.queryParams,\n fragment: route.fragment!,\n data: route.data,\n outlet: route.outlet,\n component: null,\n routeConfig: null,\n root: null as any,\n parent: null,\n firstChild: children[0],\n children: children,\n pathFromRoot: null as any,\n paramMap: route.paramMap,\n queryParamMap: route.queryParamMap,\n toString: route.toString\n };\n }\n}\n","import { NgZone, Injectable, inject, DestroyRef } from '@angular/core';\nimport {\n NavigationCancel,\n NavigationError,\n Router,\n RouterStateSnapshot,\n RoutesRecognized,\n ResolveEnd,\n NavigationStart,\n NavigationEnd,\n Event\n} from '@angular/router';\nimport { Action, createSelector, State, StateContext, StateToken, Store } from '@ngxs/store';\nimport {\n NavigationActionTiming,\n ɵNGXS_ROUTER_PLUGIN_OPTIONS\n} from '@ngxs/router-plugin/internals';\nimport type { Subscription } from 'rxjs';\n\nimport {\n Navigate,\n RouterAction,\n RouterCancel,\n RouterError,\n RouterNavigation,\n RouterDataResolved,\n RouterRequest,\n RouterNavigated\n} from './router.actions';\nimport { RouterStateSerializer } from './serializer';\n\nexport interface RouterStateModel<T = RouterStateSnapshot> {\n state?: T;\n navigationId?: number;\n trigger: RouterTrigger;\n}\n\nexport type RouterTrigger =\n | 'none'\n | 'router'\n | 'store'\n // The `devtools` trigger means that the state change has been triggered by Redux DevTools (e.g. when the time-traveling is used).\n | 'devtools';\n\n// NGXS doesn't permit untyped selectors, such as `select(RouterState)`,\n// as the `RouterState` class itself lacks type information. Therefore,\n// the following state token must replace `RouterState`.\nexport const ROUTER_STATE_TOKEN = new StateToken<RouterStateModel>('router');\n\n@State<RouterStateModel>({\n name: ROUTER_STATE_TOKEN,\n defaults: {\n state: undefined,\n navigationId: undefined,\n trigger: 'none'\n }\n})\n@Injectable()\nexport class RouterState {\n private _store = inject(Store);\n private _router = inject(Router);\n private _serializer: RouterStateSerializer<RouterStateSnapshot> =\n inject(RouterStateSerializer);\n private _ngZone = inject(NgZone);\n\n /**\n * Determines how navigation was performed by the `RouterState` itself\n * or outside via `new Navigate(...)`\n */\n private _trigger: RouterTrigger = 'none';\n\n /**\n * That's the serialized state from the `Router` class\n */\n private _routerState: RouterStateSnapshot | null = null;\n\n /**\n * That's the value of the `RouterState` state\n */\n private _storeState: RouterStateModel | null = null;\n\n private _lastEvent: Event | null = null;\n\n private _options = inject(ɵNGXS_ROUTER_PLUGIN_OPTIONS);\n\n private _subscription!: Subscription;\n\n static state<T = RouterStateSnapshot>() {\n return createSelector([ROUTER_STATE_TOKEN], (state: RouterStateModel<T>) => {\n // The `state` is optional if the selector is invoked before the router\n // state is registered in NGXS.\n return state?.state;\n });\n }\n\n static url = createSelector([ROUTER_STATE_TOKEN], state => state?.state?.url);\n\n constructor() {\n this._setUpStoreListener();\n this._setUpRouterEventsListener();\n\n inject(DestroyRef).onDestroy(() => this._subscription.unsubscribe());\n }\n\n @Action(Navigate)\n navigate(_: StateContext<RouterStateModel>, action: Navigate) {\n return this._ngZone.run(() =>\n this._router.navigate(action.path, {\n queryParams: action.queryParams,\n ...action.extras\n })\n );\n }\n\n @Action([\n RouterRequest<RouterStateSnapshot>,\n RouterNavigation<RouterStateSnapshot>,\n RouterError<RouterStateModel, RouterStateSnapshot>,\n RouterCancel<RouterStateModel, RouterStateSnapshot>,\n RouterDataResolved<RouterStateSnapshot>,\n RouterNavigated<RouterStateSnapshot>\n ])\n angularRouterAction(\n ctx: StateContext<RouterStateModel>,\n action: RouterAction<RouterStateModel, RouterStateSnapshot>\n ): void {\n ctx.setState({\n trigger: action.trigger,\n state: action.routerState,\n navigationId: action.event.id\n });\n }\n\n private _setUpStoreListener(): void {\n const routerState$ = this._store.select(ROUTER_STATE_TOKEN);\n\n routerState$.subscribe((state: RouterStateModel | undefined) => {\n this._navigateIfNeeded(state);\n });\n }\n\n private _navigateIfNeeded(routerState: RouterStateModel | undefined): void {\n if (routerState?.trigger === 'devtools') {\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n }\n\n const canSkipNavigation =\n !this._storeState ||\n !this._storeState.state ||\n !routerState ||\n routerState.trigger === 'router' ||\n this._router.url === this._storeState.state.url ||\n this._lastEvent instanceof NavigationStart;\n\n if (canSkipNavigation) {\n return;\n }\n\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n this._trigger = 'store';\n this._ngZone.run(() => this._router.navigateByUrl(this._storeState!.state!.url));\n }\n\n private _setUpRouterEventsListener(): void {\n const dispatchRouterNavigationLate =\n this._options != null &&\n this._options.navigationActionTiming === NavigationActionTiming.PostActivation;\n\n let lastRoutesRecognized: RoutesRecognized;\n\n this._subscription = this._router.events.subscribe(event => {\n this._lastEvent = event;\n\n if (event instanceof NavigationStart) {\n this._navigationStart(event);\n } else if (event instanceof RoutesRecognized) {\n lastRoutesRecognized = event;\n if (!dispatchRouterNavigationLate && this._trigger !== 'store') {\n this._dispatchRouterNavigation(lastRoutesRecognized);\n }\n } else if (event instanceof ResolveEnd) {\n this._dispatchRouterDataResolved(event);\n } else if (event instanceof NavigationCancel) {\n this._dispatchRouterCancel(event);\n this._reset();\n } else if (event instanceof NavigationError) {\n this._dispatchRouterError(event);\n this._reset();\n } else if (event instanceof NavigationEnd) {\n if (this._trigger !== 'store') {\n if (dispatchRouterNavigationLate) {\n this._dispatchRouterNavigation(lastRoutesRecognized);\n }\n this._dispatchRouterNavigated(event);\n }\n this._reset();\n }\n });\n }\n\n /** Reacts to `NavigationStart`. */\n private _navigationStart(event: NavigationStart): void {\n this._routerState = this._serializer.serialize(this._router.routerState.snapshot);\n\n if (this._trigger !== 'none') {\n this._storeState = this._store.selectSnapshot(ROUTER_STATE_TOKEN);\n this._dispatchRouterAction(new RouterRequest(this._routerState, event, this._trigger));\n }\n }\n\n /** Reacts to `ResolveEnd`. */\n private _dispatchRouterDataResolved(event: ResolveEnd): void {\n const routerState = this._serializer.serialize(event.state);\n this._dispatchRouterAction(new RouterDataResolved(routerState, event, this._trigger));\n }\n\n /** Reacts to `RoutesRecognized` or `NavigationEnd`, depends on the `navigationActionTiming`. */\n private _dispatchRouterNavigation(lastRoutesRecognized: RoutesRecognized): void {\n const nextRouterState = this._serializer.serialize(lastRoutesRecognized.state);\n\n this._dispatchRouterAction(\n new RouterNavigation(\n nextRouterState,\n new RoutesRecognized(\n lastRoutesRecognized.id,\n lastRoutesRecognized.url,\n lastRoutesRecognized.urlAfterRedirects,\n nextRouterState\n ),\n this._trigger\n )\n );\n }\n\n /** Reacts to `NavigationCancel`. */\n private _dispatchRouterCancel(event: NavigationCancel): void {\n this._dispatchRouterAction(\n new RouterCancel(this._routerState!, this._storeState, event, this._trigger)\n );\n }\n\n /** Reacts to `NavigationEnd`. */\n private _dispatchRouterError(event: NavigationError): void {\n this._dispatchRouterAction(\n new RouterError(\n this._routerState!,\n this._storeState,\n new NavigationError(event.id, event.url, `${event}`),\n this._trigger\n )\n );\n }\n\n /** Reacts to `NavigationEnd`. */\n private _dispatchRouterNavigated(event: NavigationEnd): void {\n const routerState = this._serializer.serialize(this._router.routerState.snapshot);\n this._dispatchRouterAction(new RouterNavigated(routerState, event, this._trigger));\n }\n\n private _dispatchRouterAction<T>(action: RouterAction<T>): void {\n this._trigger = 'router';\n\n try {\n this._store.dispatch(action);\n } finally {\n this._trigger = 'none';\n }\n }\n\n private _reset(): void {\n this._trigger = 'none';\n this._storeState = null;\n this._routerState = null;\n }\n}\n","import {\n EnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n makeEnvironmentProviders\n} from '@angular/core';\nimport { NgxsModule, provideStates } from '@ngxs/store';\nimport {\n NgxsRouterPluginOptions,\n ɵcreateRouterPluginOptions,\n ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n ɵUSER_OPTIONS\n} from '@ngxs/router-plugin/internals';\n\nimport { RouterState } from './router.state';\nimport { DefaultRouterStateSerializer, RouterStateSerializer } from './serializer';\n\n@NgModule({\n imports: [NgxsModule.forFeature([RouterState])]\n})\nexport class NgxsRouterPluginModule {\n static forRoot(\n options?: NgxsRouterPluginOptions\n ): ModuleWithProviders<NgxsRouterPluginModule> {\n return {\n ngModule: NgxsRouterPluginModule,\n providers: [\n { provide: ɵUSER_OPTIONS, useValue: options },\n {\n provide: ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n useFactory: ɵcreateRouterPluginOptions,\n deps: [ɵUSER_OPTIONS]\n },\n { provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }\n ]\n };\n }\n}\n\nexport function withNgxsRouterPlugin(options?: NgxsRouterPluginOptions): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideStates([RouterState]),\n { provide: ɵUSER_OPTIONS, useValue: options },\n {\n provide: ɵNGXS_ROUTER_PLUGIN_OPTIONS,\n useFactory: ɵcreateRouterPluginOptions,\n deps: [ɵUSER_OPTIONS]\n },\n { provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }\n ]);\n}\n","/**\n * The public api for consumers of @ngxs/router-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵNGXS_ROUTER_PLUGIN_OPTIONS","ɵUSER_OPTIONS","ɵcreateRouterPluginOptions"],"mappings":";;;;;;;;;AAcA;;AAEG;MACU,QAAQ,CAAA;AAIV,IAAA,IAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AALT,IAAA,OAAgB,IAAI,GAAG,mBAAmB;AAE1C,IAAA,WAAA,CACS,IAAW,EACX,WAAoB,EACpB,MAAyB,EAAA;QAFzB,IAAI,CAAA,IAAA,GAAJ,IAAI;QACJ,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAM,CAAA,MAAA,GAAN,M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BAAA;AACE,oBAAA,OAAO,EAAED,2BAA2B;AACpC,oBAAA,UAAU,EAAEE,0BAA0B;oBACtC,IAAI,EAAE,CAACD,aAAa;AACrB,iBAAA;AACD,gBAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B;AACzE;SACF;;0HAfQ,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAtB,sBAAsB,EAAA,OAAA,EAAA,CAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,CAAA;2HAAtB,sBAAsB,EAAA,OAAA,EAAA,CAFvB,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA,EAAA,CAAA;;2FAEnC,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;AAC/C,iBAAA;;AAoBK,SAAU,oBAAoB,CAAC,OAAiC,EAAA;AACpE,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;AAC5B,QAAA,EAAE,OAAO,EAAEA,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC7C,QAAA;AACE,YAAA,OAAO,EAAED,2BAA2B;AACpC,YAAA,UAAU,EAAEE,0BAA0B;YACtC,IAAI,EAAE,CAACD,aAAa;AACrB,SAAA;AACD,QAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B;AACzE,KAAA,CAAC;AACJ;;AClDA;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ModuleWithProviders, EnvironmentProviders, OnDestroy } from '@angular/core';
2
+ import { ModuleWithProviders, EnvironmentProviders } from '@angular/core';
3
3
  import { NgxsRouterPluginOptions } from '@ngxs/router-plugin/internals';
4
4
  export { NavigationActionTiming, NgxsRouterPluginOptions } from '@ngxs/router-plugin/internals';
5
5
  import * as i1 from '@ngxs/store';
6
6
  import { StateToken, StateContext } from '@ngxs/store';
7
- import { Params, NavigationExtras, RouterStateSnapshot, NavigationStart, RoutesRecognized, NavigationCancel, NavigationError, ResolveEnd, NavigationEnd, ActivatedRouteSnapshot } from '@angular/router';
7
+ import { RouterStateSnapshot, ActivatedRouteSnapshot, Params, NavigationExtras, NavigationCancel, ResolveEnd, NavigationError, NavigationEnd, RoutesRecognized, NavigationStart } from '@angular/router';
8
8
 
9
9
  declare class NgxsRouterPluginModule {
10
10
  static forRoot(options?: NgxsRouterPluginOptions): ModuleWithProviders<NgxsRouterPluginModule>;
@@ -103,7 +103,7 @@ interface RouterStateModel<T = RouterStateSnapshot> {
103
103
  }
104
104
  type RouterTrigger = 'none' | 'router' | 'store' | 'devtools';
105
105
  declare const ROUTER_STATE_TOKEN: StateToken<RouterStateModel<RouterStateSnapshot>>;
106
- declare class RouterState implements OnDestroy {
106
+ declare class RouterState {
107
107
  private _store;
108
108
  private _router;
109
109
  private _serializer;
@@ -123,11 +123,10 @@ declare class RouterState implements OnDestroy {
123
123
  private _storeState;
124
124
  private _lastEvent;
125
125
  private _options;
126
- private _destroy$;
127
- static state<T = RouterStateSnapshot>(state: RouterStateModel<T>): T | undefined;
128
- static url(state: RouterStateModel): string | undefined;
126
+ private _subscription;
127
+ static state<T = RouterStateSnapshot>(): (state: RouterStateModel<T>) => T | undefined;
128
+ static url: (state: RouterStateModel<RouterStateSnapshot>) => string | undefined;
129
129
  constructor();
130
- ngOnDestroy(): void;
131
130
  navigate(_: StateContext<RouterStateModel>, action: Navigate): Promise<boolean>;
132
131
  angularRouterAction(ctx: StateContext<RouterStateModel>, action: RouterAction<RouterStateModel, RouterStateSnapshot>): void;
133
132
  private _setUpStoreListener;
@@ -163,4 +162,5 @@ declare class DefaultRouterStateSerializer implements RouterStateSerializer<Seri
163
162
  private serializeRoute;
164
163
  }
165
164
 
166
- export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, ROUTER_STATE_TOKEN, type RouterAction, RouterCancel, RouterDataResolved, RouterError, RouterNavigated, RouterNavigation, RouterRequest, RouterState, type RouterStateModel, RouterStateSerializer, type SerializedRouterStateSnapshot, withNgxsRouterPlugin };
165
+ export { DefaultRouterStateSerializer, Navigate, NgxsRouterPluginModule, ROUTER_STATE_TOKEN, RouterCancel, RouterDataResolved, RouterError, RouterNavigated, RouterNavigation, RouterRequest, RouterState, RouterStateSerializer, withNgxsRouterPlugin };
166
+ export type { RouterAction, RouterStateModel, SerializedRouterStateSnapshot };
@@ -1,6 +1,6 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
 
3
- declare const enum NavigationActionTiming {
3
+ declare enum NavigationActionTiming {
4
4
  PreActivation = 1,
5
5
  PostActivation = 2
6
6
  }
@@ -11,4 +11,5 @@ declare const ɵUSER_OPTIONS: InjectionToken<NgxsRouterPluginOptions | undefined
11
11
  declare const ɵNGXS_ROUTER_PLUGIN_OPTIONS: InjectionToken<NgxsRouterPluginOptions>;
12
12
  declare function ɵcreateRouterPluginOptions(options: NgxsRouterPluginOptions | undefined): NgxsRouterPluginOptions;
13
13
 
14
- export { NavigationActionTiming, type NgxsRouterPluginOptions, ɵNGXS_ROUTER_PLUGIN_OPTIONS, ɵUSER_OPTIONS, ɵcreateRouterPluginOptions };
14
+ export { NavigationActionTiming, ɵNGXS_ROUTER_PLUGIN_OPTIONS, ɵUSER_OPTIONS, ɵcreateRouterPluginOptions };
15
+ export type { NgxsRouterPluginOptions };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ngxs/router-plugin",
3
3
  "description": "router plugin for @ngxs/store",
4
- "version": "19.0.0",
4
+ "version": "20.0.0-dev.master-5e7c96c",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@ngxs/store": "^19.0.0 || ^19.0.0-dev",
8
- "@angular/core": ">=19.0.0 <20.0.0",
9
- "@angular/router": ">=19.0.0 <20.0.0",
10
- "rxjs": ">=6.5.5"
7
+ "@angular/core": ">=20.0.0 <21.0.0",
8
+ "@angular/router": ">=20.0.0 <21.0.0",
9
+ "@ngxs/store": "^20.0.0 || ^20.0.0-dev",
10
+ "rxjs": ">=7.0.0"
11
11
  },
12
12
  "module": "fesm2022/ngxs-router-plugin.mjs",
13
13
  "typings": "index.d.ts",
@@ -71,4 +71,4 @@
71
71
  "type": "opencollective",
72
72
  "url": "https://opencollective.com/ngxs"
73
73
  }
74
- }
74
+ }
@@ -1,3 +0,0 @@
1
- {
2
- "module": "../fesm2022/ngxs-router-plugin-internals.mjs"
3
- }