@ngxs/store 19.0.0-dev.master-c739a26 → 19.0.0-dev.master-d3dad28
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/fesm2022/ngxs-store-internals-testing.mjs +21 -22
- package/fesm2022/ngxs-store-internals-testing.mjs.map +1 -1
- package/fesm2022/ngxs-store-internals.mjs +24 -25
- package/fesm2022/ngxs-store-internals.mjs.map +1 -1
- package/fesm2022/ngxs-store-operators.mjs.map +1 -1
- package/fesm2022/ngxs-store-plugins.mjs +3 -2
- package/fesm2022/ngxs-store-plugins.mjs.map +1 -1
- package/fesm2022/ngxs-store.mjs +185 -189
- package/fesm2022/ngxs-store.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/testing/index.d.ts +1 -1
- package/package.json +9 -9
package/fesm2022/ngxs-store.mjs
CHANGED
|
@@ -8,15 +8,15 @@ export { InitState, NGXS_PLUGINS, UpdateState, actionMatcher, getActionTypeFromI
|
|
|
8
8
|
import { isStateOperator } from '@ngxs/store/operators';
|
|
9
9
|
|
|
10
10
|
class PluginManager {
|
|
11
|
+
plugins = [];
|
|
12
|
+
_parentManager = inject(PluginManager, {
|
|
13
|
+
optional: true,
|
|
14
|
+
skipSelf: true
|
|
15
|
+
});
|
|
16
|
+
_pluginHandlers = inject(NGXS_PLUGINS, {
|
|
17
|
+
optional: true
|
|
18
|
+
});
|
|
11
19
|
constructor() {
|
|
12
|
-
this.plugins = [];
|
|
13
|
-
this._parentManager = inject(PluginManager, {
|
|
14
|
-
optional: true,
|
|
15
|
-
skipSelf: true
|
|
16
|
-
});
|
|
17
|
-
this._pluginHandlers = inject(NGXS_PLUGINS, {
|
|
18
|
-
optional: true
|
|
19
|
-
});
|
|
20
20
|
this.registerHandlers();
|
|
21
21
|
}
|
|
22
22
|
get _rootPlugins() {
|
|
@@ -30,10 +30,10 @@ class PluginManager {
|
|
|
30
30
|
const handlers = this._pluginHandlers || [];
|
|
31
31
|
return handlers.map((plugin) => (plugin.handle ? plugin.handle.bind(plugin) : plugin));
|
|
32
32
|
}
|
|
33
|
-
/** @nocollapse */ static
|
|
34
|
-
/** @nocollapse */ static
|
|
33
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PluginManager, providedIn: 'root' });
|
|
35
35
|
}
|
|
36
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: PluginManager, decorators: [{
|
|
37
37
|
type: Injectable,
|
|
38
38
|
args: [{ providedIn: 'root' }]
|
|
39
39
|
}], ctorParameters: () => [] });
|
|
@@ -132,18 +132,16 @@ class InternalDispatchedActionResults extends Subject {
|
|
|
132
132
|
// any actions after the application is destroyed.
|
|
133
133
|
inject(DestroyRef).onDestroy(() => this.complete());
|
|
134
134
|
}
|
|
135
|
-
/** @nocollapse */ static
|
|
136
|
-
/** @nocollapse */ static
|
|
135
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatchedActionResults, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
136
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatchedActionResults, providedIn: 'root' });
|
|
137
137
|
}
|
|
138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatchedActionResults, decorators: [{
|
|
139
139
|
type: Injectable,
|
|
140
140
|
args: [{ providedIn: 'root' }]
|
|
141
141
|
}], ctorParameters: () => [] });
|
|
142
142
|
|
|
143
143
|
class InternalNgxsExecutionStrategy {
|
|
144
|
-
|
|
145
|
-
this._ngZone = inject(NgZone);
|
|
146
|
-
}
|
|
144
|
+
_ngZone = inject(NgZone);
|
|
147
145
|
enter(func) {
|
|
148
146
|
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
|
|
149
147
|
return this._runInsideAngular(func);
|
|
@@ -165,10 +163,10 @@ class InternalNgxsExecutionStrategy {
|
|
|
165
163
|
}
|
|
166
164
|
return func();
|
|
167
165
|
}
|
|
168
|
-
/** @nocollapse */ static
|
|
169
|
-
/** @nocollapse */ static
|
|
166
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
167
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalNgxsExecutionStrategy, providedIn: 'root' });
|
|
170
168
|
}
|
|
171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalNgxsExecutionStrategy, decorators: [{
|
|
172
170
|
type: Injectable,
|
|
173
171
|
args: [{ providedIn: 'root' }]
|
|
174
172
|
}] });
|
|
@@ -187,11 +185,11 @@ var ActionStatus;
|
|
|
187
185
|
* Internal Action stream that is emitted anytime an action is dispatched.
|
|
188
186
|
*/
|
|
189
187
|
class InternalActions extends _OrderedSubject {
|
|
188
|
+
// This subject will be the first to know about the dispatched action, its purpose is for
|
|
189
|
+
// any logic that must be executed before action handlers are invoked (i.e., cancelation).
|
|
190
|
+
dispatched$ = new Subject();
|
|
190
191
|
constructor() {
|
|
191
192
|
super();
|
|
192
|
-
// This subject will be the first to know about the dispatched action, its purpose is for
|
|
193
|
-
// any logic that must be executed before action handlers are invoked (i.e., cancelation).
|
|
194
|
-
this.dispatched$ = new Subject();
|
|
195
193
|
this.subscribe(ctx => {
|
|
196
194
|
if (ctx.status === ActionStatus.Dispatched) {
|
|
197
195
|
this.dispatched$.next(ctx);
|
|
@@ -206,10 +204,10 @@ class InternalActions extends _OrderedSubject {
|
|
|
206
204
|
this.dispatched$.complete();
|
|
207
205
|
});
|
|
208
206
|
}
|
|
209
|
-
/** @nocollapse */ static
|
|
210
|
-
/** @nocollapse */ static
|
|
207
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
208
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActions, providedIn: 'root' });
|
|
211
209
|
}
|
|
212
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActions, decorators: [{
|
|
213
211
|
type: Injectable,
|
|
214
212
|
args: [{ providedIn: 'root' }]
|
|
215
213
|
}], ctorParameters: () => [] });
|
|
@@ -239,24 +237,22 @@ class Actions extends Observable {
|
|
|
239
237
|
observer.add(childSubscription);
|
|
240
238
|
});
|
|
241
239
|
}
|
|
242
|
-
/** @nocollapse */ static
|
|
243
|
-
/** @nocollapse */ static
|
|
240
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Actions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
241
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Actions, providedIn: 'root' });
|
|
244
242
|
}
|
|
245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Actions, decorators: [{
|
|
246
244
|
type: Injectable,
|
|
247
245
|
args: [{ providedIn: 'root' }]
|
|
248
246
|
}], ctorParameters: () => [] });
|
|
249
247
|
|
|
250
248
|
class InternalDispatcher {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this._injector = inject(Injector);
|
|
259
|
-
}
|
|
249
|
+
_ngZone = inject(NgZone);
|
|
250
|
+
_actions = inject(InternalActions);
|
|
251
|
+
_actionResults = inject(InternalDispatchedActionResults);
|
|
252
|
+
_pluginManager = inject(PluginManager);
|
|
253
|
+
_stateStream = inject(_StateStream);
|
|
254
|
+
_ngxsExecutionStrategy = inject(InternalNgxsExecutionStrategy);
|
|
255
|
+
_injector = inject(Injector);
|
|
260
256
|
/**
|
|
261
257
|
* Dispatches event(s).
|
|
262
258
|
*/
|
|
@@ -316,10 +312,10 @@ class InternalDispatcher {
|
|
|
316
312
|
}
|
|
317
313
|
}), shareReplay());
|
|
318
314
|
}
|
|
319
|
-
/** @nocollapse */ static
|
|
320
|
-
/** @nocollapse */ static
|
|
315
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
316
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatcher, providedIn: 'root' });
|
|
321
317
|
}
|
|
322
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalDispatcher, decorators: [{
|
|
323
319
|
type: Injectable,
|
|
324
320
|
args: [{ providedIn: 'root' }]
|
|
325
321
|
}] });
|
|
@@ -362,20 +358,28 @@ const NGXS_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDe
|
|
|
362
358
|
* The NGXS config settings.
|
|
363
359
|
*/
|
|
364
360
|
class NgxsConfig {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
/**
|
|
361
|
+
/**
|
|
362
|
+
* Run in development mode. This will add additional debugging features:
|
|
363
|
+
* - Object.freeze on the state and actions to guarantee immutability
|
|
364
|
+
* (default: false)
|
|
365
|
+
*
|
|
366
|
+
* Note: this property will be accounted only in development mode.
|
|
367
|
+
* It makes sense to use it only during development to ensure there're no state mutations.
|
|
368
|
+
* When building for production, the `Object.freeze` will be tree-shaken away.
|
|
369
|
+
*/
|
|
370
|
+
developmentMode;
|
|
371
|
+
compatibility = {
|
|
372
|
+
strictContentSecurityPolicy: false
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Defining shared selector options
|
|
376
|
+
*/
|
|
377
|
+
selectorOptions = {
|
|
378
|
+
injectContainerState: false,
|
|
379
|
+
suppressErrors: false
|
|
380
|
+
};
|
|
381
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
382
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => {
|
|
379
383
|
const defaultConfig = new NgxsConfig();
|
|
380
384
|
const config = inject(NGXS_OPTIONS);
|
|
381
385
|
return {
|
|
@@ -386,9 +390,9 @@ class NgxsConfig {
|
|
|
386
390
|
...config.selectorOptions
|
|
387
391
|
}
|
|
388
392
|
};
|
|
389
|
-
} });
|
|
393
|
+
} });
|
|
390
394
|
}
|
|
391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
395
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsConfig, decorators: [{
|
|
392
396
|
type: Injectable,
|
|
393
397
|
args: [{
|
|
394
398
|
providedIn: 'root',
|
|
@@ -411,6 +415,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
411
415
|
* Passed as a value in a NgxsSimpleChanges object to the ngxsOnChanges hook.
|
|
412
416
|
*/
|
|
413
417
|
class NgxsSimpleChange {
|
|
418
|
+
previousValue;
|
|
419
|
+
currentValue;
|
|
420
|
+
firstChange;
|
|
414
421
|
constructor(previousValue, currentValue, firstChange) {
|
|
415
422
|
this.previousValue = previousValue;
|
|
416
423
|
this.currentValue = currentValue;
|
|
@@ -441,11 +448,9 @@ const deepFreeze = (o) => {
|
|
|
441
448
|
* @ignore
|
|
442
449
|
*/
|
|
443
450
|
class InternalStateOperations {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this._config = inject(NgxsConfig);
|
|
448
|
-
}
|
|
451
|
+
_stateStream = inject(_StateStream);
|
|
452
|
+
_dispatcher = inject(InternalDispatcher);
|
|
453
|
+
_config = inject(NgxsConfig);
|
|
449
454
|
/**
|
|
450
455
|
* Returns the root state operators.
|
|
451
456
|
*/
|
|
@@ -471,10 +476,10 @@ class InternalStateOperations {
|
|
|
471
476
|
// Set the state to the current + new
|
|
472
477
|
stateOperations.setState({ ...currentState, ...results.defaults });
|
|
473
478
|
}
|
|
474
|
-
/** @nocollapse */ static
|
|
475
|
-
/** @nocollapse */ static
|
|
479
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalStateOperations, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
480
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalStateOperations, providedIn: 'root' });
|
|
476
481
|
}
|
|
477
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalStateOperations, decorators: [{
|
|
478
483
|
type: Injectable,
|
|
479
484
|
args: [{ providedIn: 'root' }]
|
|
480
485
|
}] });
|
|
@@ -856,12 +861,12 @@ const NGXS_DEVELOPMENT_OPTIONS =
|
|
|
856
861
|
});
|
|
857
862
|
|
|
858
863
|
class NgxsUnhandledActionsLogger {
|
|
864
|
+
/**
|
|
865
|
+
* These actions should be ignored by default; the user can increase this
|
|
866
|
+
* list in the future via the `ignoreActions` method.
|
|
867
|
+
*/
|
|
868
|
+
_ignoredActions = new Set([InitState.type, UpdateState.type]);
|
|
859
869
|
constructor() {
|
|
860
|
-
/**
|
|
861
|
-
* These actions should be ignored by default; the user can increase this
|
|
862
|
-
* list in the future via the `ignoreActions` method.
|
|
863
|
-
*/
|
|
864
|
-
this._ignoredActions = new Set([InitState.type, UpdateState.type]);
|
|
865
870
|
const options = inject(NGXS_DEVELOPMENT_OPTIONS);
|
|
866
871
|
if (typeof options.warnOnUnhandledActions === 'object') {
|
|
867
872
|
this.ignoreActions(...options.warnOnUnhandledActions.ignore);
|
|
@@ -887,18 +892,16 @@ class NgxsUnhandledActionsLogger {
|
|
|
887
892
|
: action.type;
|
|
888
893
|
console.warn(`The ${action} action has been dispatched but hasn't been handled. This may happen if the state with an action handler for this action is not registered.`);
|
|
889
894
|
}
|
|
890
|
-
/** @nocollapse */ static
|
|
891
|
-
/** @nocollapse */ static
|
|
895
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledActionsLogger, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
896
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledActionsLogger });
|
|
892
897
|
}
|
|
893
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
898
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledActionsLogger, decorators: [{
|
|
894
899
|
type: Injectable
|
|
895
900
|
}], ctorParameters: () => [] });
|
|
896
901
|
|
|
897
902
|
class NgxsUnhandledErrorHandler {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
this._errorHandler = inject(ErrorHandler);
|
|
901
|
-
}
|
|
903
|
+
_ngZone = inject(NgZone);
|
|
904
|
+
_errorHandler = inject(ErrorHandler);
|
|
902
905
|
/**
|
|
903
906
|
* The `_unhandledErrorContext` is left unused internally since we do not
|
|
904
907
|
* require it for internal operations. However, developers who wish to provide
|
|
@@ -913,10 +916,10 @@ class NgxsUnhandledErrorHandler {
|
|
|
913
916
|
// `handleError` (see `_callAndReportToErrorHandler`).
|
|
914
917
|
this._ngZone.runOutsideAngular(() => this._errorHandler.handleError(error));
|
|
915
918
|
}
|
|
916
|
-
/** @nocollapse */ static
|
|
917
|
-
/** @nocollapse */ static
|
|
919
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
920
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledErrorHandler, providedIn: 'root' });
|
|
918
921
|
}
|
|
919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsUnhandledErrorHandler, decorators: [{
|
|
920
923
|
type: Injectable,
|
|
921
924
|
args: [{ providedIn: 'root' }]
|
|
922
925
|
}] });
|
|
@@ -1047,9 +1050,7 @@ function simplePatch(value) {
|
|
|
1047
1050
|
* @ignore
|
|
1048
1051
|
*/
|
|
1049
1052
|
class StateContextFactory {
|
|
1050
|
-
|
|
1051
|
-
this._internalStateOperations = inject(InternalStateOperations);
|
|
1052
|
-
}
|
|
1053
|
+
_internalStateOperations = inject(InternalStateOperations);
|
|
1053
1054
|
/**
|
|
1054
1055
|
* Create the state context
|
|
1055
1056
|
*/
|
|
@@ -1079,10 +1080,10 @@ class StateContextFactory {
|
|
|
1079
1080
|
}
|
|
1080
1081
|
};
|
|
1081
1082
|
}
|
|
1082
|
-
/** @nocollapse */ static
|
|
1083
|
-
/** @nocollapse */ static
|
|
1083
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateContextFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1084
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateContextFactory, providedIn: 'root' });
|
|
1084
1085
|
}
|
|
1085
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateContextFactory, decorators: [{
|
|
1086
1087
|
type: Injectable,
|
|
1087
1088
|
args: [{ providedIn: 'root' }]
|
|
1088
1089
|
}] });
|
|
@@ -1107,10 +1108,8 @@ function getState(currentAppState, path) {
|
|
|
1107
1108
|
}
|
|
1108
1109
|
|
|
1109
1110
|
class InternalActionHandlerFactory {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
this._stateContextFactory = inject(StateContextFactory);
|
|
1113
|
-
}
|
|
1111
|
+
_actions = inject(InternalActions);
|
|
1112
|
+
_stateContextFactory = inject(StateContextFactory);
|
|
1114
1113
|
createActionHandler(path, handlerFn, options) {
|
|
1115
1114
|
const { dispatched$ } = this._actions;
|
|
1116
1115
|
return (action) => {
|
|
@@ -1169,10 +1168,10 @@ class InternalActionHandlerFactory {
|
|
|
1169
1168
|
return result;
|
|
1170
1169
|
};
|
|
1171
1170
|
}
|
|
1172
|
-
/** @nocollapse */ static
|
|
1173
|
-
/** @nocollapse */ static
|
|
1171
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActionHandlerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1172
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActionHandlerFactory, providedIn: 'root' });
|
|
1174
1173
|
}
|
|
1175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: InternalActionHandlerFactory, decorators: [{
|
|
1176
1175
|
type: Injectable,
|
|
1177
1176
|
args: [{ providedIn: 'root' }]
|
|
1178
1177
|
}] });
|
|
@@ -1205,54 +1204,54 @@ function cloneDefaults(defaults) {
|
|
|
1205
1204
|
* @ignore
|
|
1206
1205
|
*/
|
|
1207
1206
|
class StateFactory {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
return getter;
|
|
1237
|
-
}
|
|
1238
|
-
return (...args) => {
|
|
1239
|
-
// Late loaded getter
|
|
1240
|
-
if (!getter) {
|
|
1241
|
-
getter = /*@__INLINE__*/ resolveGetter(key);
|
|
1242
|
-
}
|
|
1243
|
-
return getter ? getter(...args) : undefined;
|
|
1244
|
-
};
|
|
1245
|
-
},
|
|
1246
|
-
getSelectorOptions(localOptions) {
|
|
1247
|
-
const globalSelectorOptions = stateFactory._config.selectorOptions;
|
|
1248
|
-
return {
|
|
1249
|
-
...globalSelectorOptions,
|
|
1250
|
-
...(localOptions || {})
|
|
1251
|
-
};
|
|
1207
|
+
_injector = inject(Injector);
|
|
1208
|
+
_config = inject(NgxsConfig);
|
|
1209
|
+
_actionHandlerFactory = inject(InternalActionHandlerFactory);
|
|
1210
|
+
_actions = inject(InternalActions);
|
|
1211
|
+
_actionResults = inject(InternalDispatchedActionResults);
|
|
1212
|
+
_initialState = inject(_INITIAL_STATE_TOKEN, { optional: true });
|
|
1213
|
+
_actionRegistry = inject(_NgxsActionRegistry);
|
|
1214
|
+
_propGetter = inject(ɵPROP_GETTER);
|
|
1215
|
+
_actionsSubscription = null;
|
|
1216
|
+
_ngxsUnhandledErrorHandler = null;
|
|
1217
|
+
_states = [];
|
|
1218
|
+
_statesByName = {};
|
|
1219
|
+
_statePaths = {};
|
|
1220
|
+
getRuntimeSelectorContext = _memoize(() => {
|
|
1221
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1222
|
+
const stateFactory = this;
|
|
1223
|
+
const propGetter = stateFactory._propGetter;
|
|
1224
|
+
function resolveGetter(key) {
|
|
1225
|
+
const path = stateFactory._statePaths[key];
|
|
1226
|
+
return path ? propGetter(path.split('.')) : null;
|
|
1227
|
+
}
|
|
1228
|
+
const context = {
|
|
1229
|
+
getStateGetter(key) {
|
|
1230
|
+
// Use `@__INLINE__` annotation to forcely inline `resolveGetter`.
|
|
1231
|
+
// This is a Terser annotation, which will function only in the production mode.
|
|
1232
|
+
let getter = /*@__INLINE__*/ resolveGetter(key);
|
|
1233
|
+
if (getter) {
|
|
1234
|
+
return getter;
|
|
1252
1235
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1236
|
+
return (...args) => {
|
|
1237
|
+
// Late loaded getter
|
|
1238
|
+
if (!getter) {
|
|
1239
|
+
getter = /*@__INLINE__*/ resolveGetter(key);
|
|
1240
|
+
}
|
|
1241
|
+
return getter ? getter(...args) : undefined;
|
|
1242
|
+
};
|
|
1243
|
+
},
|
|
1244
|
+
getSelectorOptions(localOptions) {
|
|
1245
|
+
const globalSelectorOptions = stateFactory._config.selectorOptions;
|
|
1246
|
+
return {
|
|
1247
|
+
...globalSelectorOptions,
|
|
1248
|
+
...(localOptions || {})
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
return context;
|
|
1253
|
+
});
|
|
1254
|
+
constructor() {
|
|
1256
1255
|
inject(DestroyRef).onDestroy(() => this._actionsSubscription?.unsubscribe());
|
|
1257
1256
|
}
|
|
1258
1257
|
/**
|
|
@@ -1400,27 +1399,27 @@ class StateFactory {
|
|
|
1400
1399
|
}
|
|
1401
1400
|
}
|
|
1402
1401
|
}
|
|
1403
|
-
/** @nocollapse */ static
|
|
1404
|
-
/** @nocollapse */ static
|
|
1402
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1403
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateFactory, providedIn: 'root' });
|
|
1405
1404
|
}
|
|
1406
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1405
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: StateFactory, decorators: [{
|
|
1407
1406
|
type: Injectable,
|
|
1408
1407
|
args: [{ providedIn: 'root' }]
|
|
1409
1408
|
}], ctorParameters: () => [] });
|
|
1410
1409
|
|
|
1411
1410
|
class Store {
|
|
1411
|
+
_stateStream = inject(_StateStream);
|
|
1412
|
+
_internalStateOperations = inject(InternalStateOperations);
|
|
1413
|
+
_config = inject(NgxsConfig);
|
|
1414
|
+
_internalExecutionStrategy = inject(InternalNgxsExecutionStrategy);
|
|
1415
|
+
_stateFactory = inject(StateFactory);
|
|
1416
|
+
/**
|
|
1417
|
+
* This is a derived state stream that leaves NGXS execution strategy to emit state changes within the Angular zone,
|
|
1418
|
+
* because state is being changed actually within the `<root>` zone, see `InternalDispatcher#dispatchSingle`.
|
|
1419
|
+
* All selects would use this stream, and it would call leave only once for any state change across all active selectors.
|
|
1420
|
+
*/
|
|
1421
|
+
_selectableStateStream = this._stateStream.pipe(leaveNgxs(this._internalExecutionStrategy), shareReplay({ bufferSize: 1, refCount: true }));
|
|
1412
1422
|
constructor() {
|
|
1413
|
-
this._stateStream = inject(_StateStream);
|
|
1414
|
-
this._internalStateOperations = inject(InternalStateOperations);
|
|
1415
|
-
this._config = inject(NgxsConfig);
|
|
1416
|
-
this._internalExecutionStrategy = inject(InternalNgxsExecutionStrategy);
|
|
1417
|
-
this._stateFactory = inject(StateFactory);
|
|
1418
|
-
/**
|
|
1419
|
-
* This is a derived state stream that leaves NGXS execution strategy to emit state changes within the Angular zone,
|
|
1420
|
-
* because state is being changed actually within the `<root>` zone, see `InternalDispatcher#dispatchSingle`.
|
|
1421
|
-
* All selects would use this stream, and it would call leave only once for any state change across all active selectors.
|
|
1422
|
-
*/
|
|
1423
|
-
this._selectableStateStream = this._stateStream.pipe(leaveNgxs(this._internalExecutionStrategy), shareReplay({ bufferSize: 1, refCount: true }));
|
|
1424
1423
|
this.initStateStream();
|
|
1425
1424
|
}
|
|
1426
1425
|
/**
|
|
@@ -1507,10 +1506,10 @@ class Store {
|
|
|
1507
1506
|
this._stateStream.next(initialStateValue);
|
|
1508
1507
|
}
|
|
1509
1508
|
}
|
|
1510
|
-
/** @nocollapse */ static
|
|
1511
|
-
/** @nocollapse */ static
|
|
1509
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Store, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1510
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Store, providedIn: 'root' });
|
|
1512
1511
|
}
|
|
1513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: Store, decorators: [{
|
|
1514
1513
|
type: Injectable,
|
|
1515
1514
|
args: [{ providedIn: 'root' }]
|
|
1516
1515
|
}], ctorParameters: () => [] });
|
|
@@ -1558,12 +1557,11 @@ function assertRootStoreNotInitialized() {
|
|
|
1558
1557
|
}
|
|
1559
1558
|
|
|
1560
1559
|
class LifecycleStateManager {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1560
|
+
_store = inject(Store);
|
|
1561
|
+
_internalStateOperations = inject(InternalStateOperations);
|
|
1562
|
+
_stateContextFactory = inject(StateContextFactory);
|
|
1563
|
+
_appBootstrappedState = inject(_NgxsAppBootstrappedState);
|
|
1564
|
+
_initStateHasBeenDispatched;
|
|
1567
1565
|
ngxsBootstrap(action, results) {
|
|
1568
1566
|
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1569
1567
|
if (action instanceof InitState) {
|
|
@@ -1639,10 +1637,10 @@ class LifecycleStateManager {
|
|
|
1639
1637
|
_getStateContext(mappedStore) {
|
|
1640
1638
|
return this._stateContextFactory.createStateContext(mappedStore.path);
|
|
1641
1639
|
}
|
|
1642
|
-
/** @nocollapse */ static
|
|
1643
|
-
/** @nocollapse */ static
|
|
1640
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: LifecycleStateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1641
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: LifecycleStateManager, providedIn: 'root' });
|
|
1644
1642
|
}
|
|
1645
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: LifecycleStateManager, decorators: [{
|
|
1646
1644
|
type: Injectable,
|
|
1647
1645
|
args: [{ providedIn: 'root' }]
|
|
1648
1646
|
}] });
|
|
@@ -1728,11 +1726,11 @@ class NgxsRootModule {
|
|
|
1728
1726
|
constructor() {
|
|
1729
1727
|
rootStoreInitializer();
|
|
1730
1728
|
}
|
|
1731
|
-
/** @nocollapse */ static
|
|
1732
|
-
/** @nocollapse */ static
|
|
1733
|
-
/** @nocollapse */ static
|
|
1729
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1730
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsRootModule });
|
|
1731
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRootModule });
|
|
1734
1732
|
}
|
|
1735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsRootModule, decorators: [{
|
|
1736
1734
|
type: NgModule
|
|
1737
1735
|
}], ctorParameters: () => [] });
|
|
1738
1736
|
|
|
@@ -1743,11 +1741,11 @@ class NgxsFeatureModule {
|
|
|
1743
1741
|
constructor() {
|
|
1744
1742
|
featureStatesInitializer();
|
|
1745
1743
|
}
|
|
1746
|
-
/** @nocollapse */ static
|
|
1747
|
-
/** @nocollapse */ static
|
|
1748
|
-
/** @nocollapse */ static
|
|
1744
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1745
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsFeatureModule });
|
|
1746
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFeatureModule });
|
|
1749
1747
|
}
|
|
1750
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFeatureModule, decorators: [{
|
|
1751
1749
|
type: NgModule
|
|
1752
1750
|
}], ctorParameters: () => [] });
|
|
1753
1751
|
|
|
@@ -1806,11 +1804,11 @@ class NgxsModule {
|
|
|
1806
1804
|
providers: getFeatureProviders(states)
|
|
1807
1805
|
};
|
|
1808
1806
|
}
|
|
1809
|
-
/** @nocollapse */ static
|
|
1810
|
-
/** @nocollapse */ static
|
|
1811
|
-
/** @nocollapse */ static
|
|
1807
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1808
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsModule });
|
|
1809
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsModule });
|
|
1812
1810
|
}
|
|
1813
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1811
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsModule, decorators: [{
|
|
1814
1812
|
type: NgModule
|
|
1815
1813
|
}] });
|
|
1816
1814
|
|
|
@@ -1962,18 +1960,16 @@ function Selector(selectors) {
|
|
|
1962
1960
|
}
|
|
1963
1961
|
|
|
1964
1962
|
class ActionDirector {
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
this._actionHandlerFactory = inject(InternalActionHandlerFactory);
|
|
1968
|
-
}
|
|
1963
|
+
_registry = inject(_NgxsActionRegistry);
|
|
1964
|
+
_actionHandlerFactory = inject(InternalActionHandlerFactory);
|
|
1969
1965
|
attachAction(stateToken, Action, handlerFn, options = {}) {
|
|
1970
1966
|
const actionHandler = this._actionHandlerFactory.createActionHandler(stateToken.getName(), handlerFn, options);
|
|
1971
1967
|
this._registry.register(Action.type, actionHandler);
|
|
1972
1968
|
}
|
|
1973
|
-
/** @nocollapse */ static
|
|
1974
|
-
/** @nocollapse */ static
|
|
1969
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ActionDirector, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1970
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ActionDirector, providedIn: 'root' });
|
|
1975
1971
|
}
|
|
1976
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1972
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: ActionDirector, decorators: [{
|
|
1977
1973
|
type: Injectable,
|
|
1978
1974
|
args: [{ providedIn: 'root' }]
|
|
1979
1975
|
}] });
|
|
@@ -1988,11 +1984,11 @@ class NgxsDevelopmentModule {
|
|
|
1988
1984
|
]
|
|
1989
1985
|
};
|
|
1990
1986
|
}
|
|
1991
|
-
/** @nocollapse */ static
|
|
1992
|
-
/** @nocollapse */ static
|
|
1993
|
-
/** @nocollapse */ static
|
|
1987
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsDevelopmentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1988
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsDevelopmentModule });
|
|
1989
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsDevelopmentModule });
|
|
1994
1990
|
}
|
|
1995
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1991
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsDevelopmentModule, decorators: [{
|
|
1996
1992
|
type: NgModule
|
|
1997
1993
|
}] });
|
|
1998
1994
|
function withNgxsDevelopmentOptions(options) {
|