@ngxs/store 21.0.0-dev.master-f3cf7bf → 21.0.0-dev.master-7e1451e
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/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { ModuleWithProviders, Signal, EnvironmentProviders, Type } from '@angular/core';
|
|
3
3
|
import { ɵActionOptions as _ActionOptions, StateToken, ɵSharedSelectorOptions as _SharedSelectorOptions, ɵStateClass as _StateClass, ɵStoreOptions as _StoreOptions } from '@ngxs/store/internals';
|
|
4
4
|
export { ɵActionOptions as ActionOptions, StateToken } from '@ngxs/store/internals';
|
|
5
|
-
import * as rxjs from 'rxjs';
|
|
6
5
|
import { Observable, Subscription, OperatorFunction } from 'rxjs';
|
|
7
6
|
import { StateOperator } from '@ngxs/store/operators';
|
|
8
7
|
export { StateOperator } from '@ngxs/store/operators';
|
|
@@ -176,10 +175,7 @@ type MappedResult<TSelectorMap> = {
|
|
|
176
175
|
};
|
|
177
176
|
declare function createModelSelector<T extends SelectorMap$1>(selectorMap: T): ModelSelector<T>;
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
[Index in keyof Keys]: Keys[Index] extends keyof T ? T[Keys[Index]] : never;
|
|
181
|
-
};
|
|
182
|
-
declare function createPickSelector<TModel, Keys extends (keyof TModel)[]>(selector: TypedSelector<TModel>, keys: [...Keys]): (...props: KeysToValues<TModel, Keys>) => Pick<TModel, Keys[number]>;
|
|
178
|
+
declare function createPickSelector<TModel, Keys extends (keyof TModel)[]>(selector: TypedSelector<TModel>, keys: [...Keys]): (...props: (NonNullable<TModel>[Keys[number]] | undefined)[]) => Pick<TModel, Keys[number]>;
|
|
183
179
|
|
|
184
180
|
type PropertySelectors<TModel> = {
|
|
185
181
|
[P in keyof NonNullable<TModel>]-?: (model: TModel) => TModel extends null | undefined ? undefined : NonNullable<TModel>[P];
|
|
@@ -199,15 +195,9 @@ type SelectorArg = ɵSelectorDef<any>;
|
|
|
199
195
|
* @param originalFn The original function being made into a selector
|
|
200
196
|
* @param creationMetadata
|
|
201
197
|
*/
|
|
202
|
-
declare function createSelector<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
declare function createSelector<S1 extends SelectorArg, S2 extends SelectorArg, S3 extends SelectorArg, S4 extends SelectorArg, TProjector extends (s1: ɵSelectorReturnType<S1>, s2: ɵSelectorReturnType<S2>, s3: ɵSelectorReturnType<S3>, s4: ɵSelectorReturnType<S4>) => any>(selectors: [S1, S2, S3, S4], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
206
|
-
declare function createSelector<S1 extends SelectorArg, S2 extends SelectorArg, S3 extends SelectorArg, S4 extends SelectorArg, S5 extends SelectorArg, TProjector extends (s1: ɵSelectorReturnType<S1>, s2: ɵSelectorReturnType<S2>, s3: ɵSelectorReturnType<S3>, s4: ɵSelectorReturnType<S4>, s5: ɵSelectorReturnType<S5>) => any>(selectors: [S1, S2, S3, S4, S5], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
207
|
-
declare function createSelector<S1 extends SelectorArg, S2 extends SelectorArg, S3 extends SelectorArg, S4 extends SelectorArg, S5 extends SelectorArg, S6 extends SelectorArg, TProjector extends (s1: ɵSelectorReturnType<S1>, s2: ɵSelectorReturnType<S2>, s3: ɵSelectorReturnType<S3>, s4: ɵSelectorReturnType<S4>, s5: ɵSelectorReturnType<S5>, s6: ɵSelectorReturnType<S6>) => any>(selectors: [S1, S2, S3, S4, S5, S6], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
208
|
-
declare function createSelector<S1 extends SelectorArg, S2 extends SelectorArg, S3 extends SelectorArg, S4 extends SelectorArg, S5 extends SelectorArg, S6 extends SelectorArg, S7 extends SelectorArg, TProjector extends (s1: ɵSelectorReturnType<S1>, s2: ɵSelectorReturnType<S2>, s3: ɵSelectorReturnType<S3>, s4: ɵSelectorReturnType<S4>, s5: ɵSelectorReturnType<S5>, s6: ɵSelectorReturnType<S6>, s7: ɵSelectorReturnType<S7>) => any>(selectors: [S1, S2, S3, S4, S5, S6, S7], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
209
|
-
declare function createSelector<S1 extends SelectorArg, S2 extends SelectorArg, S3 extends SelectorArg, S4 extends SelectorArg, S5 extends SelectorArg, S6 extends SelectorArg, S7 extends SelectorArg, S8 extends SelectorArg, TProjector extends (s1: ɵSelectorReturnType<S1>, s2: ɵSelectorReturnType<S2>, s3: ɵSelectorReturnType<S3>, s4: ɵSelectorReturnType<S4>, s5: ɵSelectorReturnType<S5>, s6: ɵSelectorReturnType<S6>, s7: ɵSelectorReturnType<S7>, s8: ɵSelectorReturnType<S8>) => any>(selectors: [S1, S2, S3, S4, S5, S6, S7, S8], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
210
|
-
declare function createSelector<T extends (...args: any[]) => any>(selectors: SelectorArg[] | undefined, projector: T, creationMetadata?: Partial<CreationMetadata>): T;
|
|
198
|
+
declare function createSelector<Selectors extends SelectorArg[], TProjector extends (...selectorResult: {
|
|
199
|
+
[K in keyof Selectors]: ɵSelectorReturnType<Selectors[K]>;
|
|
200
|
+
}) => any>(selectors: [...Selectors], projector: TProjector, creationMetadata?: Partial<CreationMetadata>): TProjector;
|
|
211
201
|
|
|
212
202
|
type ActionOrArrayOfActions<T> = T extends (infer U)[] ? NonNullable<U>[] : NonNullable<T>;
|
|
213
203
|
declare class Store {
|
|
@@ -609,7 +599,12 @@ declare function withNgxsPreboot(prebootFn: VoidFunction): i0.EnvironmentProvide
|
|
|
609
599
|
*/
|
|
610
600
|
declare function select<T>(selector: TypedSelector<T>): Signal<T>;
|
|
611
601
|
|
|
612
|
-
declare
|
|
602
|
+
declare class AsyncReturnType<T> extends Observable<T> implements PromiseLike<void> {
|
|
603
|
+
private dispatchResult$;
|
|
604
|
+
constructor(dispatchResult$: Observable<T>);
|
|
605
|
+
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
606
|
+
}
|
|
607
|
+
declare function dispatch<TArgs extends any[]>(ActionType: ActionDef<TArgs>): (...args: TArgs) => AsyncReturnType<void>;
|
|
613
608
|
|
|
614
609
|
type SelectorMap = Record<string, TypedSelector<unknown>>;
|
|
615
610
|
declare function createSelectMap<T extends SelectorMap>(selectorMap: T): { readonly [K in keyof T]: Signal<ɵSelectorReturnType<T[K]>>; };
|
|
@@ -650,7 +645,78 @@ interface DefaultExport<T> {
|
|
|
650
645
|
*/
|
|
651
646
|
declare function lazyProvider(factory: () => Promise<EnvironmentProviders | DefaultExport<EnvironmentProviders>>): () => Promise<boolean>;
|
|
652
647
|
|
|
648
|
+
/**
|
|
649
|
+
* Dynamically registers an NGXS plugin in the current injection context.
|
|
650
|
+
*
|
|
651
|
+
* This function allows you to register NGXS plugins at runtime, creating an isolated
|
|
652
|
+
* environment injector for the plugin. The plugin is automatically cleaned up when
|
|
653
|
+
* the injection context is destroyed. In development mode, the function validates
|
|
654
|
+
* that the same plugin is not registered multiple times.
|
|
655
|
+
*
|
|
656
|
+
* @param plugin - The NGXS plugin to register. Can be either a class type implementing
|
|
657
|
+
* `NgxsPlugin` or a plugin function (`NgxsPluginFn`).
|
|
658
|
+
*
|
|
659
|
+
* @throws {Error} Throws an error if called outside of an injection context.
|
|
660
|
+
* @throws {Error} In development mode, throws an error if the plugin has already been registered.
|
|
661
|
+
*
|
|
662
|
+
* @remarks
|
|
663
|
+
* - Must be called within an injection context (e.g., constructor, field initializer, or `runInInjectionContext`).
|
|
664
|
+
* - The created environment injector is automatically destroyed when the parent context is destroyed.
|
|
665
|
+
* - Duplicate plugin registration is only checked in development mode for performance reasons.
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```ts
|
|
669
|
+
* // Register a plugin class
|
|
670
|
+
* import { MyThirdPartyIntegrationPlugin } from './plugins/third-party.plugin';
|
|
671
|
+
*
|
|
672
|
+
* @Component({
|
|
673
|
+
* selector: 'app-root',
|
|
674
|
+
* template: '...'
|
|
675
|
+
* })
|
|
676
|
+
* export class AppComponent {
|
|
677
|
+
* constructor() {
|
|
678
|
+
* registerNgxsPlugin(MyThirdPartyIntegrationPlugin);
|
|
679
|
+
* }
|
|
680
|
+
* }
|
|
681
|
+
* ```
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```ts
|
|
685
|
+
* // Register a plugin function
|
|
686
|
+
* import { myThirdPartyIntegrationPluginFn } from './plugins/third-party.plugin';
|
|
687
|
+
*
|
|
688
|
+
* @Component({
|
|
689
|
+
* selector: 'app-feature',
|
|
690
|
+
* template: '...'
|
|
691
|
+
* })
|
|
692
|
+
* export class FeatureComponent {
|
|
693
|
+
* constructor() {
|
|
694
|
+
* registerNgxsPlugin(myThirdPartyIntegrationPluginFn);
|
|
695
|
+
* }
|
|
696
|
+
* }
|
|
697
|
+
* ```
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* // Register conditionally based on environment
|
|
702
|
+
* import { MyDevtoolsPlugin } from './plugins/devtools.plugin';
|
|
703
|
+
*
|
|
704
|
+
* @Component({
|
|
705
|
+
* selector: 'app-root',
|
|
706
|
+
* template: '...'
|
|
707
|
+
* })
|
|
708
|
+
* export class AppComponent {
|
|
709
|
+
* constructor() {
|
|
710
|
+
* if (ngDevMode) {
|
|
711
|
+
* registerNgxsPlugin(MyDevtoolsPlugin);
|
|
712
|
+
* }
|
|
713
|
+
* }
|
|
714
|
+
* }
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
declare function registerNgxsPlugin(plugin: Type<NgxsPlugin> | NgxsPluginFn): void;
|
|
718
|
+
|
|
653
719
|
declare function ɵprovideNgxsInternalStateTokens(): i0.EnvironmentProviders;
|
|
654
720
|
|
|
655
|
-
export { Action, ActionDirector, ActionStatus, Actions, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, lazyProvider, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsNoopExecutionStrategy, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
|
|
721
|
+
export { Action, ActionDirector, ActionStatus, Actions, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, lazyProvider, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, registerNgxsPlugin, select, withNgxsDevelopmentOptions, withNgxsNoopExecutionStrategy, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
|
|
656
722
|
export type { ActionCompletion, ActionContext, ActionDef, ActionMap, ActionType, NgxsAfterBootstrap, NgxsDevelopmentOptions, NgxsModuleOptions, NgxsOnChanges, NgxsOnInit, NgxsUnhandledErrorContext, PropertySelectors, SelectorMap, StateContext, TypedSelector, ɵSelectorDef, ɵSelectorFunc, ɵSelectorReturnType, ɵStateSelector };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngxs/store",
|
|
3
|
-
"version": "21.0.0-dev.master-
|
|
3
|
+
"version": "21.0.0-dev.master-7e1451e",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./fesm2022/ngxs-store.mjs"
|
|
20
20
|
},
|
|
21
|
-
"./experimental": {
|
|
22
|
-
"types": "./experimental/index.d.ts",
|
|
23
|
-
"default": "./fesm2022/ngxs-store-experimental.mjs"
|
|
24
|
-
},
|
|
25
21
|
"./internals": {
|
|
26
22
|
"types": "./internals/index.d.ts",
|
|
27
23
|
"default": "./fesm2022/ngxs-store-internals.mjs"
|
|
28
24
|
},
|
|
25
|
+
"./experimental": {
|
|
26
|
+
"types": "./experimental/index.d.ts",
|
|
27
|
+
"default": "./fesm2022/ngxs-store-experimental.mjs"
|
|
28
|
+
},
|
|
29
29
|
"./operators": {
|
|
30
30
|
"types": "./operators/index.d.ts",
|
|
31
31
|
"default": "./fesm2022/ngxs-store-operators.mjs"
|