@ngxs/store 18.1.5-dev.master-14021c0 → 18.1.5-dev.master-e14b71b
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/esm2022/internals/initial-state.mjs +2 -3
- package/esm2022/internals/internal-tokens.mjs +3 -4
- package/esm2022/plugins/symbols.mjs +2 -3
- package/esm2022/src/dev-features/symbols.mjs +2 -3
- package/esm2022/src/execution/symbols.mjs +3 -4
- package/esm2022/src/internal/internals.mjs +4 -5
- package/esm2022/src/internal/lifecycle-state-manager.mjs +2 -3
- package/esm2022/src/internal/state-factory.mjs +5 -6
- package/esm2022/src/selectors/selector-utils.mjs +2 -3
- package/esm2022/src/standalone-features/initializers.mjs +3 -4
- package/esm2022/src/standalone-features/preboot.mjs +2 -3
- package/esm2022/src/store.mjs +2 -3
- package/esm2022/src/symbols.mjs +4 -5
- package/fesm2022/ngxs-store-internals.mjs +3 -5
- package/fesm2022/ngxs-store-internals.mjs.map +1 -1
- package/fesm2022/ngxs-store-plugins.mjs +1 -2
- package/fesm2022/ngxs-store-plugins.mjs.map +1 -1
- package/fesm2022/ngxs-store.mjs +19 -29
- package/fesm2022/ngxs-store.mjs.map +1 -1
- package/package.json +7 -7
package/fesm2022/ngxs-store.mjs
CHANGED
|
@@ -120,18 +120,17 @@ function verifyZoneIsNotNooped(ngZone) {
|
|
|
120
120
|
console.warn(getZoneWarningMessage());
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const NG_DEV_MODE$9 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
124
123
|
/**
|
|
125
124
|
* Consumers have the option to utilize the execution strategy provided by
|
|
126
125
|
* `NgxsModule.forRoot({executionStrategy})` or `provideStore([], {executionStrategy})`.
|
|
127
126
|
*/
|
|
128
|
-
const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(
|
|
127
|
+
const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'CUSTOM_NGXS_EXECUTION_STRATEGY' : '');
|
|
129
128
|
/**
|
|
130
129
|
* The injection token is used internally to resolve an instance of the execution
|
|
131
130
|
* strategy. It checks whether consumers have provided their own `executionStrategy`
|
|
132
131
|
* and also verifies if we are operating in a zone-aware environment.
|
|
133
132
|
*/
|
|
134
|
-
const NGXS_EXECUTION_STRATEGY = new InjectionToken(
|
|
133
|
+
const NGXS_EXECUTION_STRATEGY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_EXECUTION_STRATEGY' : '', {
|
|
135
134
|
providedIn: 'root',
|
|
136
135
|
factory: () => {
|
|
137
136
|
const ngZone = inject(NgZone);
|
|
@@ -436,18 +435,17 @@ const compose = (injector, funcs) => (...args) => {
|
|
|
436
435
|
return runInInjectionContext(injector, () => curr(...args, (...nextArgs) => compose(injector, funcs)(...nextArgs)));
|
|
437
436
|
};
|
|
438
437
|
|
|
439
|
-
const NG_DEV_MODE$8 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
440
438
|
// The injection token is used to resolve a list of states provided at
|
|
441
439
|
// the root level through either `NgxsModule.forRoot` or `provideStore`.
|
|
442
|
-
const ROOT_STATE_TOKEN = new InjectionToken(
|
|
440
|
+
const ROOT_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ROOT_STATE_TOKEN' : '');
|
|
443
441
|
// The injection token is used to resolve a list of states provided at
|
|
444
442
|
// the feature level through either `NgxsModule.forFeature` or `provideStates`.
|
|
445
443
|
// The Array<Array> is used to overload the resolved value of the token because
|
|
446
444
|
// it is a multi-provider token.
|
|
447
|
-
const FEATURE_STATE_TOKEN = new InjectionToken(
|
|
445
|
+
const FEATURE_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'FEATURE_STATE_TOKEN' : '');
|
|
448
446
|
// The injection token is used to resolve to options provided at the root
|
|
449
447
|
// level through either `NgxsModule.forRoot` or `provideStore`.
|
|
450
|
-
const NGXS_OPTIONS = new InjectionToken(
|
|
448
|
+
const NGXS_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_OPTIONS' : '');
|
|
451
449
|
/**
|
|
452
450
|
* The NGXS config settings.
|
|
453
451
|
*/
|
|
@@ -594,7 +592,6 @@ function ensureStateAndActionsAreImmutable(root) {
|
|
|
594
592
|
};
|
|
595
593
|
}
|
|
596
594
|
|
|
597
|
-
const NG_DEV_MODE$7 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
598
595
|
function createRootSelectorFactory(selectorMetaData, selectors, memoizedSelectorFn) {
|
|
599
596
|
return (context) => {
|
|
600
597
|
const { argumentSelectorFunctions, selectorOptions } = getRuntimeSelectorInfo(context, selectorMetaData, selectors);
|
|
@@ -615,7 +612,7 @@ function createRootSelectorFactory(selectorMetaData, selectors, memoizedSelector
|
|
|
615
612
|
// We're logging an error in this function because it may be used by `select`,
|
|
616
613
|
// `selectSignal`, and `selectSnapshot`. Therefore, there's no need to catch
|
|
617
614
|
// exceptions there to log errors.
|
|
618
|
-
if (
|
|
615
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
619
616
|
const message = 'The selector below has thrown an error upon invocation. ' +
|
|
620
617
|
'Please check for any unsafe property access that may result in null ' +
|
|
621
618
|
'or undefined values.';
|
|
@@ -689,7 +686,6 @@ function getRootSelectorFactory(selector) {
|
|
|
689
686
|
return (metadata && metadata.makeRootSelector) || (() => selector);
|
|
690
687
|
}
|
|
691
688
|
|
|
692
|
-
const NG_DEV_MODE$6 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
693
689
|
/**
|
|
694
690
|
* Get a deeply nested value. Example:
|
|
695
691
|
*
|
|
@@ -754,7 +750,7 @@ function propGetter(paths, config) {
|
|
|
754
750
|
// `createSelectorFn`, which, in turn, is solely used by the `Select` decorator.
|
|
755
751
|
// We've been trying to deprecate the `Select` decorator because it's unstable with
|
|
756
752
|
// server-side rendering and micro-frontend applications.
|
|
757
|
-
const ɵPROP_GETTER = new InjectionToken(
|
|
753
|
+
const ɵPROP_GETTER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'PROP_GETTER' : '', {
|
|
758
754
|
providedIn: 'root',
|
|
759
755
|
factory: () => inject(NgxsConfig).compatibility?.strictContentSecurityPolicy
|
|
760
756
|
? compliantPropGetter
|
|
@@ -781,7 +777,7 @@ const ɵPROP_GETTER = new InjectionToken(NG_DEV_MODE$6 ? 'PROP_GETTER' : '', {
|
|
|
781
777
|
function buildGraph(stateClasses) {
|
|
782
778
|
const findName = (stateClass) => {
|
|
783
779
|
const meta = stateClasses.find(g => g === stateClass);
|
|
784
|
-
if (
|
|
780
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode && !meta) {
|
|
785
781
|
throw new Error(`Child state not found: ${stateClass}. \r\nYou may have forgotten to add states to module`);
|
|
786
782
|
}
|
|
787
783
|
return meta[_META_KEY].name;
|
|
@@ -876,7 +872,7 @@ function topologicalSort(graph) {
|
|
|
876
872
|
ancestors.push(name);
|
|
877
873
|
visited[name] = true;
|
|
878
874
|
graph[name].forEach((dep) => {
|
|
879
|
-
if (
|
|
875
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode && ancestors.indexOf(dep) >= 0) {
|
|
880
876
|
throw new Error(`Circular dependency '${dep}' is required by '${name}': ${ancestors.join(' -> ')}`);
|
|
881
877
|
}
|
|
882
878
|
if (visited[dep]) {
|
|
@@ -971,8 +967,7 @@ function jit_hasInjectableAnnotation(stateClass) {
|
|
|
971
967
|
return annotations.some((annotation) => annotation?.ngMetadataName === 'Injectable');
|
|
972
968
|
}
|
|
973
969
|
|
|
974
|
-
const
|
|
975
|
-
const NGXS_DEVELOPMENT_OPTIONS = new InjectionToken(NG_DEV_MODE$5 ? 'NGXS_DEVELOPMENT_OPTIONS' : '', {
|
|
970
|
+
const NGXS_DEVELOPMENT_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_DEVELOPMENT_OPTIONS' : '', {
|
|
976
971
|
providedIn: 'root',
|
|
977
972
|
factory: () => ({ warnOnUnhandledActions: true })
|
|
978
973
|
});
|
|
@@ -1228,7 +1223,6 @@ function createAllowedStatusesMap(statuses) {
|
|
|
1228
1223
|
}, {});
|
|
1229
1224
|
}
|
|
1230
1225
|
|
|
1231
|
-
const NG_DEV_MODE$4 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
1232
1226
|
function cloneDefaults(defaults) {
|
|
1233
1227
|
let value = defaults === undefined ? {} : defaults;
|
|
1234
1228
|
if (defaults) {
|
|
@@ -1323,7 +1317,7 @@ class StateFactory {
|
|
|
1323
1317
|
* Add a new state to the global defs.
|
|
1324
1318
|
*/
|
|
1325
1319
|
add(stateClasses) {
|
|
1326
|
-
if (
|
|
1320
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1327
1321
|
ensureStatesAreDecorated(stateClasses);
|
|
1328
1322
|
}
|
|
1329
1323
|
const { newStates } = this.addToStatesMap(stateClasses);
|
|
@@ -1343,7 +1337,7 @@ class StateFactory {
|
|
|
1343
1337
|
// `State` decorator. This check is moved here because the `ɵprov` property
|
|
1344
1338
|
// will not exist on the class in JIT mode (because it's set asynchronously
|
|
1345
1339
|
// during JIT compilation through `Object.defineProperty`).
|
|
1346
|
-
if (
|
|
1340
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1347
1341
|
ensureStateClassIsInjectable(stateClass);
|
|
1348
1342
|
}
|
|
1349
1343
|
const stateMap = {
|
|
@@ -1422,7 +1416,7 @@ class StateFactory {
|
|
|
1422
1416
|
}
|
|
1423
1417
|
// The `NgxsUnhandledActionsLogger` is a tree-shakable class which functions
|
|
1424
1418
|
// only during development.
|
|
1425
|
-
if (
|
|
1419
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode && !actionHasBeenHandled) {
|
|
1426
1420
|
const unhandledActionsLogger = this._injector.get(NgxsUnhandledActionsLogger, null);
|
|
1427
1421
|
// The `NgxsUnhandledActionsLogger` will not be resolved by the injector if the
|
|
1428
1422
|
// `NgxsDevelopmentModule` is not provided. It's enough to check whether the `injector.get`
|
|
@@ -1439,7 +1433,7 @@ class StateFactory {
|
|
|
1439
1433
|
const statesMap = this.statesByName;
|
|
1440
1434
|
for (const stateClass of stateClasses) {
|
|
1441
1435
|
const stateName = _getStoreMetadata(stateClass).name;
|
|
1442
|
-
if (
|
|
1436
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1443
1437
|
ensureStateNameIsUnique(stateName, stateClass, statesMap);
|
|
1444
1438
|
}
|
|
1445
1439
|
const unmountedState = !statesMap[stateName];
|
|
@@ -1542,7 +1536,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
1542
1536
|
// to the state context.
|
|
1543
1537
|
function noop() { }
|
|
1544
1538
|
|
|
1545
|
-
const NG_DEV_MODE$3 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
1546
1539
|
class Store {
|
|
1547
1540
|
constructor() {
|
|
1548
1541
|
this._stateStream = inject(_StateStream);
|
|
@@ -1562,7 +1555,7 @@ class Store {
|
|
|
1562
1555
|
* Dispatches action(s).
|
|
1563
1556
|
*/
|
|
1564
1557
|
dispatch(actionOrActions) {
|
|
1565
|
-
if (
|
|
1558
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1566
1559
|
if (
|
|
1567
1560
|
// If a single action is dispatched and it's nullable.
|
|
1568
1561
|
actionOrActions == null ||
|
|
@@ -1650,11 +1643,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
1650
1643
|
args: [{ providedIn: 'root' }]
|
|
1651
1644
|
}], ctorParameters: () => [] });
|
|
1652
1645
|
|
|
1653
|
-
const NG_DEV_MODE$2 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
1654
1646
|
/**
|
|
1655
1647
|
* InjectionToken that registers preboot functions (called before the root initializer).
|
|
1656
1648
|
*/
|
|
1657
|
-
const NGXS_PREBOOT_FNS = new InjectionToken(
|
|
1649
|
+
const NGXS_PREBOOT_FNS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_PREBOOT_FNS' : '');
|
|
1658
1650
|
/**
|
|
1659
1651
|
* This function registers a preboot function which will be called before the root
|
|
1660
1652
|
* store initializer is run, but after all of the NGXS features are provided and
|
|
@@ -1704,7 +1696,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
1704
1696
|
args: [{ providedIn: 'root' }]
|
|
1705
1697
|
}], ctorParameters: () => [{ type: Store }, { type: NgxsConfig }] });
|
|
1706
1698
|
|
|
1707
|
-
const NG_DEV_MODE$1 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
1708
1699
|
class LifecycleStateManager {
|
|
1709
1700
|
constructor() {
|
|
1710
1701
|
this._store = inject(Store);
|
|
@@ -1717,7 +1708,7 @@ class LifecycleStateManager {
|
|
|
1717
1708
|
this._destroy$.next();
|
|
1718
1709
|
}
|
|
1719
1710
|
ngxsBootstrap(action, results) {
|
|
1720
|
-
if (
|
|
1711
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1721
1712
|
if (action instanceof InitState) {
|
|
1722
1713
|
this._initStateHasBeenDispatched = true;
|
|
1723
1714
|
}
|
|
@@ -1775,7 +1766,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
1775
1766
|
args: [{ providedIn: 'root' }]
|
|
1776
1767
|
}] });
|
|
1777
1768
|
|
|
1778
|
-
const NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
1779
1769
|
/**
|
|
1780
1770
|
* This function is shared by both NgModule and standalone features.
|
|
1781
1771
|
* When using `NgxsModule.forRoot` and `provideStore`, we can depend on the
|
|
@@ -1823,11 +1813,11 @@ function featureStatesInitializer() {
|
|
|
1823
1813
|
/**
|
|
1824
1814
|
* InjectionToken that registers the global Store.
|
|
1825
1815
|
*/
|
|
1826
|
-
const NGXS_ROOT_STORE_INITIALIZER = new InjectionToken(
|
|
1816
|
+
const NGXS_ROOT_STORE_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_ROOT_STORE_INITIALIZER' : '');
|
|
1827
1817
|
/**
|
|
1828
1818
|
* InjectionToken that registers feature states.
|
|
1829
1819
|
*/
|
|
1830
|
-
const NGXS_FEATURE_STORE_INITIALIZER = new InjectionToken(
|
|
1820
|
+
const NGXS_FEATURE_STORE_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_FEATURE_STORE_INITIALIZER' : '');
|
|
1831
1821
|
const NGXS_ROOT_ENVIRONMENT_INITIALIZER = [
|
|
1832
1822
|
{ provide: NGXS_ROOT_STORE_INITIALIZER, useFactory: rootStoreInitializer },
|
|
1833
1823
|
{
|