@ngrx/signals 19.1.0 → 19.2.0
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/events/index.d.ts +1 -0
- package/events/src/case-reducer.d.ts +20 -0
- package/events/src/dispatcher.d.ts +33 -0
- package/events/src/event-creator-group.d.ts +33 -0
- package/events/src/event-creator.d.ts +9 -0
- package/events/src/event-instance.d.ts +8 -0
- package/events/src/events-service.d.ts +47 -0
- package/events/src/index.d.ts +9 -0
- package/events/src/inject-dispatch.d.ts +46 -0
- package/events/src/with-effects.d.ts +28 -0
- package/events/src/with-reducer.d.ts +30 -0
- package/fesm2022/ngrx-signals-events.mjs +320 -0
- package/fesm2022/ngrx-signals-events.mjs.map +1 -0
- package/package.json +5 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/index';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PartialStateUpdater } from '@ngrx/signals';
|
|
2
|
+
import { EventCreator } from './event-creator';
|
|
3
|
+
export type CaseReducerResult<State extends object, EventCreators extends EventCreator<string, any>[]> = {
|
|
4
|
+
reducer: CaseReducer<State, EventCreators>;
|
|
5
|
+
events: EventCreators;
|
|
6
|
+
};
|
|
7
|
+
type CaseReducer<State extends object, EventCreators extends EventCreator<string, any>[]> = (event: {
|
|
8
|
+
[K in keyof EventCreators]: ReturnType<EventCreators[K]>;
|
|
9
|
+
}[number]) => Partial<State> | PartialStateUpdater<State> | Array<Partial<State> | PartialStateUpdater<State>>;
|
|
10
|
+
/**
|
|
11
|
+
* @experimental
|
|
12
|
+
* @description
|
|
13
|
+
*
|
|
14
|
+
* Creates a case reducer that can be used with the `withReducer` feature.
|
|
15
|
+
*/
|
|
16
|
+
export declare function on<State extends object, EventCreators extends EventCreator<string, any>[]>(...args: [
|
|
17
|
+
...events: [...EventCreators],
|
|
18
|
+
reducer: CaseReducer<NoInfer<State>, NoInfer<EventCreators>>
|
|
19
|
+
]): CaseReducerResult<State, EventCreators>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EventInstance } from './event-instance';
|
|
2
|
+
import { Events, ReducerEvents } from './events-service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* @experimental
|
|
6
|
+
* @description
|
|
7
|
+
*
|
|
8
|
+
* Globally provided service for dispatching events.
|
|
9
|
+
*
|
|
10
|
+
* @usageNotes
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Dispatcher, event } from '@ngrx/signals/events';
|
|
14
|
+
*
|
|
15
|
+
* const increment = event('[Counter Page] Increment');
|
|
16
|
+
*
|
|
17
|
+
* \@Component({ \/* ... *\/ })
|
|
18
|
+
* class Counter {
|
|
19
|
+
* readonly #dispatcher = inject(Dispatcher);
|
|
20
|
+
*
|
|
21
|
+
* increment(): void {
|
|
22
|
+
* this.#dispatcher.dispatch(increment());
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class Dispatcher {
|
|
28
|
+
protected readonly reducerEvents: ReducerEvents;
|
|
29
|
+
protected readonly events: Events;
|
|
30
|
+
dispatch(event: EventInstance<string, unknown>): void;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Dispatcher, never>;
|
|
32
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Dispatcher>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Prettify } from '@ngrx/signals';
|
|
2
|
+
import { EventCreator } from './event-creator';
|
|
3
|
+
type EventType<Source extends string, EventName extends string> = `[${Source}] ${EventName}`;
|
|
4
|
+
type EventCreatorGroup<Source extends string, Events extends Record<string, any>> = {
|
|
5
|
+
[EventName in keyof Events]: EventName extends string ? EventCreator<EventType<Source, EventName>, Events[EventName]> : never;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @experimental
|
|
9
|
+
* @description
|
|
10
|
+
*
|
|
11
|
+
* Creates a group of event creators.
|
|
12
|
+
*
|
|
13
|
+
* @usageNotes
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { type } from '@ngrx/signals';
|
|
17
|
+
* import { eventGroup } from '@ngrx/signals/events';
|
|
18
|
+
*
|
|
19
|
+
* const counterPageEvents = eventGroup({
|
|
20
|
+
* source: 'Counter Page',
|
|
21
|
+
* events: {
|
|
22
|
+
* increment: type<void>(),
|
|
23
|
+
* decrement: type<void>(),
|
|
24
|
+
* set: type<number>(),
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function eventGroup<Source extends string, Events extends Record<string, unknown>>(config: {
|
|
30
|
+
source: Source;
|
|
31
|
+
events: Events;
|
|
32
|
+
}): Prettify<EventCreatorGroup<Source, Events>>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EventInstance } from './event-instance';
|
|
2
|
+
/**
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
|
+
export type EventCreator<Type extends string, Payload> = ((payload: Payload) => EventInstance<Type, Payload>) & {
|
|
6
|
+
type: Type;
|
|
7
|
+
};
|
|
8
|
+
export declare function event<Type extends string>(type: Type): EventCreator<Type, void>;
|
|
9
|
+
export declare function event<Type extends string, Payload>(type: Type, payload: Payload): EventCreator<Type, Payload>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { EventInstance } from './event-instance';
|
|
3
|
+
import { EventCreator } from './event-creator';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare const EVENTS: unique symbol;
|
|
6
|
+
export declare const SOURCE_TYPE: unique symbol;
|
|
7
|
+
declare abstract class BaseEvents {
|
|
8
|
+
on(): Observable<EventInstance<string, unknown>>;
|
|
9
|
+
on<EventCreators extends EventCreator<string, any>[]>(...events: [...EventCreators]): Observable<{
|
|
10
|
+
[K in keyof EventCreators]: ReturnType<EventCreators[K]>;
|
|
11
|
+
}[number]>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @experimental
|
|
15
|
+
* @description
|
|
16
|
+
*
|
|
17
|
+
* Globally provided service for listening to dispatched events.
|
|
18
|
+
*
|
|
19
|
+
* @usageNotes
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { event, Events } from '@ngrx/signals/events';
|
|
23
|
+
*
|
|
24
|
+
* const increment = event('[Counter Page] Increment');
|
|
25
|
+
*
|
|
26
|
+
* \@Component({ \/* ... *\/ })
|
|
27
|
+
* class Counter {
|
|
28
|
+
* readonly #events = inject(Events);
|
|
29
|
+
*
|
|
30
|
+
* constructor() {
|
|
31
|
+
* this.#events
|
|
32
|
+
* .on(increment)
|
|
33
|
+
* .pipe(takeUntilDestroyed())
|
|
34
|
+
* .subscribe(() => \/* handle increment event *\/);
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class Events extends BaseEvents {
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Events, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Events>;
|
|
42
|
+
}
|
|
43
|
+
export declare class ReducerEvents extends BaseEvents {
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReducerEvents, never>;
|
|
45
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ReducerEvents>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { on } from './case-reducer';
|
|
2
|
+
export { Dispatcher } from './dispatcher';
|
|
3
|
+
export { event, EventCreator } from './event-creator';
|
|
4
|
+
export { eventGroup } from './event-creator-group';
|
|
5
|
+
export { EventInstance } from './event-instance';
|
|
6
|
+
export { Events } from './events-service';
|
|
7
|
+
export { injectDispatch } from './inject-dispatch';
|
|
8
|
+
export { withEffects } from './with-effects';
|
|
9
|
+
export { withReducer } from './with-reducer';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { Prettify } from '@ngrx/signals';
|
|
3
|
+
import { EventCreator } from './event-creator';
|
|
4
|
+
type InjectDispatchResult<EventGroup extends Record<string, EventCreator<string, any>>> = {
|
|
5
|
+
[EventName in keyof EventGroup]: Parameters<EventGroup[EventName]> extends [
|
|
6
|
+
infer Payload
|
|
7
|
+
] ? (payload: Payload) => void : () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @experimental
|
|
11
|
+
* @description
|
|
12
|
+
*
|
|
13
|
+
* Creates self-dispatching events for a given event group.
|
|
14
|
+
*
|
|
15
|
+
* @usageNotes
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { type } from '@ngrx/signals';
|
|
19
|
+
* import { eventGroup, injectDispatch } from '@ngrx/signals/events';
|
|
20
|
+
*
|
|
21
|
+
* const counterPageEvents = eventGroup({
|
|
22
|
+
* source: 'Counter Page',
|
|
23
|
+
* events: {
|
|
24
|
+
* increment: type<void>(),
|
|
25
|
+
* decrement: type<void>(),
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* \@Component({ \/* ... *\/ })
|
|
30
|
+
* class Counter {
|
|
31
|
+
* readonly dispatch = injectDispatch(counterPageEvents);
|
|
32
|
+
*
|
|
33
|
+
* increment(): void {
|
|
34
|
+
* this.dispatch.increment();
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* decrement(): void {
|
|
38
|
+
* this.dispatch.decrement();
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function injectDispatch<EventGroup extends Record<string, EventCreator<string, any>>>(events: EventGroup, config?: {
|
|
44
|
+
injector?: Injector;
|
|
45
|
+
}): Prettify<InjectDispatchResult<EventGroup>>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { EmptyFeatureResult, Prettify, SignalStoreFeature, SignalStoreFeatureResult, StateSignals, WritableStateSource } from '@ngrx/signals';
|
|
3
|
+
/**
|
|
4
|
+
* @experimental
|
|
5
|
+
* @description
|
|
6
|
+
*
|
|
7
|
+
* SignalStore feature for defining side effects.
|
|
8
|
+
*
|
|
9
|
+
* @usageNotes
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { signalStore, withState } from '@ngrx/signals';
|
|
13
|
+
* import { event, Events, withEffects } from '@ngrx/signals/events';
|
|
14
|
+
*
|
|
15
|
+
* const increment = event('[Counter Page] Increment');
|
|
16
|
+
* const decrement = event('[Counter Page] Decrement');
|
|
17
|
+
*
|
|
18
|
+
* const CounterStore = signalStore(
|
|
19
|
+
* withState({ count: 0 }),
|
|
20
|
+
* withEffects(({ count }, events = inject(Events)) => ({
|
|
21
|
+
* logCount$: events.on(increment, decrement).pipe(
|
|
22
|
+
* tap(({ type }) => console.log(type, count())),
|
|
23
|
+
* ),
|
|
24
|
+
* })),
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function withEffects<Input extends SignalStoreFeatureResult>(effectsFactory: (store: Prettify<StateSignals<Input['state']> & Input['props'] & Input['methods'] & WritableStateSource<Prettify<Input['state']>>>) => Record<string, Observable<unknown>>): SignalStoreFeature<Input, EmptyFeatureResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EmptyFeatureResult, SignalStoreFeature } from '@ngrx/signals';
|
|
2
|
+
import { CaseReducerResult } from './case-reducer';
|
|
3
|
+
import { EventCreator } from './event-creator';
|
|
4
|
+
/**
|
|
5
|
+
* @experimental
|
|
6
|
+
* @description
|
|
7
|
+
*
|
|
8
|
+
* SignalStore feature for defining state changes based on dispatched events.
|
|
9
|
+
*
|
|
10
|
+
* @usageNotes
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { signalStore, type, withState } from '@ngrx/signals';
|
|
14
|
+
* import { event, on, withReducer } from '@ngrx/signals/events';
|
|
15
|
+
*
|
|
16
|
+
* const set = event('[Counter Page] Set', type<number>());
|
|
17
|
+
*
|
|
18
|
+
* const CounterStore = signalStore(
|
|
19
|
+
* withState({ count: 0 }),
|
|
20
|
+
* withReducer(
|
|
21
|
+
* on(set, ({ payload }) => ({ count: payload })),
|
|
22
|
+
* ),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function withReducer<State extends object>(...caseReducers: CaseReducerResult<State, EventCreator<string, any>[]>[]): SignalStoreFeature<{
|
|
27
|
+
state: State;
|
|
28
|
+
props: {};
|
|
29
|
+
methods: {};
|
|
30
|
+
}, EmptyFeatureResult>;
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject, assertInInjectionContext, Injector, untracked } from '@angular/core';
|
|
3
|
+
import { Subject, filter, map, tap, merge } from 'rxjs';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { signalStoreFeature, type, withHooks, patchState } from '@ngrx/signals';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @experimental
|
|
9
|
+
* @description
|
|
10
|
+
*
|
|
11
|
+
* Creates a case reducer that can be used with the `withReducer` feature.
|
|
12
|
+
*/
|
|
13
|
+
function on(...args) {
|
|
14
|
+
const reducer = args.pop();
|
|
15
|
+
const events = args;
|
|
16
|
+
return { reducer, events };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const EVENTS = Symbol();
|
|
20
|
+
const SOURCE_TYPE = Symbol();
|
|
21
|
+
class BaseEvents {
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
[EVENTS] = new Subject();
|
|
26
|
+
on(...events) {
|
|
27
|
+
return this[EVENTS].pipe(filterByType(events), withSourceType());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @experimental
|
|
32
|
+
* @description
|
|
33
|
+
*
|
|
34
|
+
* Globally provided service for listening to dispatched events.
|
|
35
|
+
*
|
|
36
|
+
* @usageNotes
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { event, Events } from '@ngrx/signals/events';
|
|
40
|
+
*
|
|
41
|
+
* const increment = event('[Counter Page] Increment');
|
|
42
|
+
*
|
|
43
|
+
* \@Component({ \/* ... *\/ })
|
|
44
|
+
* class Counter {
|
|
45
|
+
* readonly #events = inject(Events);
|
|
46
|
+
*
|
|
47
|
+
* constructor() {
|
|
48
|
+
* this.#events
|
|
49
|
+
* .on(increment)
|
|
50
|
+
* .pipe(takeUntilDestroyed())
|
|
51
|
+
* .subscribe(() => \/* handle increment event *\/);
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
class Events extends BaseEvents {
|
|
57
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Events, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
58
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Events, providedIn: 'root' });
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Events, decorators: [{
|
|
61
|
+
type: Injectable,
|
|
62
|
+
args: [{ providedIn: 'root' }]
|
|
63
|
+
}] });
|
|
64
|
+
class ReducerEvents extends BaseEvents {
|
|
65
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: ReducerEvents, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: ReducerEvents, providedIn: 'root' });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: ReducerEvents, decorators: [{
|
|
69
|
+
type: Injectable,
|
|
70
|
+
args: [{ providedIn: 'root' }]
|
|
71
|
+
}] });
|
|
72
|
+
function filterByType(events) {
|
|
73
|
+
if (events.length === 0) {
|
|
74
|
+
return (source$) => source$;
|
|
75
|
+
}
|
|
76
|
+
const eventMap = toEventCreatorMap(events);
|
|
77
|
+
return filter(({ type }) => !!eventMap[type]);
|
|
78
|
+
}
|
|
79
|
+
function toEventCreatorMap(events) {
|
|
80
|
+
return events.reduce((acc, event) => ({ ...acc, [event.type]: event }), {});
|
|
81
|
+
}
|
|
82
|
+
function withSourceType() {
|
|
83
|
+
return map(({ ...event }) => {
|
|
84
|
+
Object.defineProperty(event, SOURCE_TYPE, { value: event.type });
|
|
85
|
+
return event;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @experimental
|
|
91
|
+
* @description
|
|
92
|
+
*
|
|
93
|
+
* Globally provided service for dispatching events.
|
|
94
|
+
*
|
|
95
|
+
* @usageNotes
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { Dispatcher, event } from '@ngrx/signals/events';
|
|
99
|
+
*
|
|
100
|
+
* const increment = event('[Counter Page] Increment');
|
|
101
|
+
*
|
|
102
|
+
* \@Component({ \/* ... *\/ })
|
|
103
|
+
* class Counter {
|
|
104
|
+
* readonly #dispatcher = inject(Dispatcher);
|
|
105
|
+
*
|
|
106
|
+
* increment(): void {
|
|
107
|
+
* this.#dispatcher.dispatch(increment());
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
class Dispatcher {
|
|
113
|
+
reducerEvents = inject(ReducerEvents);
|
|
114
|
+
events = inject(Events);
|
|
115
|
+
dispatch(event) {
|
|
116
|
+
this.reducerEvents[EVENTS].next(event);
|
|
117
|
+
this.events[EVENTS].next(event);
|
|
118
|
+
}
|
|
119
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Dispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
120
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Dispatcher, providedIn: 'root' });
|
|
121
|
+
}
|
|
122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: Dispatcher, decorators: [{
|
|
123
|
+
type: Injectable,
|
|
124
|
+
args: [{ providedIn: 'root' }]
|
|
125
|
+
}] });
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @experimental
|
|
129
|
+
* @description
|
|
130
|
+
*
|
|
131
|
+
* Creates an event creator.
|
|
132
|
+
*
|
|
133
|
+
* @usageNotes
|
|
134
|
+
*
|
|
135
|
+
* ### Creating an event creator without payload
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* import { event } from '@ngrx/signals/events';
|
|
139
|
+
*
|
|
140
|
+
* const increment = event('[Counter Page] Increment');
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* ### Creating an event creator with payload
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { type } from '@ngrx/signals';
|
|
147
|
+
* import { event } from '@ngrx/signals/events';
|
|
148
|
+
*
|
|
149
|
+
* const set = event('[Counter Page] Set', type<number>());
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
function event(type) {
|
|
153
|
+
const creator = (payload) => ({ type, payload });
|
|
154
|
+
creator.type = type;
|
|
155
|
+
return creator;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @experimental
|
|
160
|
+
* @description
|
|
161
|
+
*
|
|
162
|
+
* Creates a group of event creators.
|
|
163
|
+
*
|
|
164
|
+
* @usageNotes
|
|
165
|
+
*
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { type } from '@ngrx/signals';
|
|
168
|
+
* import { eventGroup } from '@ngrx/signals/events';
|
|
169
|
+
*
|
|
170
|
+
* const counterPageEvents = eventGroup({
|
|
171
|
+
* source: 'Counter Page',
|
|
172
|
+
* events: {
|
|
173
|
+
* increment: type<void>(),
|
|
174
|
+
* decrement: type<void>(),
|
|
175
|
+
* set: type<number>(),
|
|
176
|
+
* },
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
function eventGroup(config) {
|
|
181
|
+
return Object.entries(config.events).reduce((acc, [eventName]) => {
|
|
182
|
+
const eventType = `[${config.source}] ${eventName}`;
|
|
183
|
+
return { ...acc, [eventName]: event(eventType) };
|
|
184
|
+
}, {});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @experimental
|
|
189
|
+
* @description
|
|
190
|
+
*
|
|
191
|
+
* Creates self-dispatching events for a given event group.
|
|
192
|
+
*
|
|
193
|
+
* @usageNotes
|
|
194
|
+
*
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { type } from '@ngrx/signals';
|
|
197
|
+
* import { eventGroup, injectDispatch } from '@ngrx/signals/events';
|
|
198
|
+
*
|
|
199
|
+
* const counterPageEvents = eventGroup({
|
|
200
|
+
* source: 'Counter Page',
|
|
201
|
+
* events: {
|
|
202
|
+
* increment: type<void>(),
|
|
203
|
+
* decrement: type<void>(),
|
|
204
|
+
* },
|
|
205
|
+
* });
|
|
206
|
+
*
|
|
207
|
+
* \@Component({ \/* ... *\/ })
|
|
208
|
+
* class Counter {
|
|
209
|
+
* readonly dispatch = injectDispatch(counterPageEvents);
|
|
210
|
+
*
|
|
211
|
+
* increment(): void {
|
|
212
|
+
* this.dispatch.increment();
|
|
213
|
+
* }
|
|
214
|
+
*
|
|
215
|
+
* decrement(): void {
|
|
216
|
+
* this.dispatch.decrement();
|
|
217
|
+
* }
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
function injectDispatch(events, config) {
|
|
222
|
+
if (!config?.injector) {
|
|
223
|
+
assertInInjectionContext(injectDispatch);
|
|
224
|
+
}
|
|
225
|
+
const injector = config?.injector ?? inject(Injector);
|
|
226
|
+
const dispatcher = injector.get(Dispatcher);
|
|
227
|
+
return Object.entries(events).reduce((acc, [eventName, eventCreator]) => ({
|
|
228
|
+
...acc,
|
|
229
|
+
[eventName]: (payload) => untracked(() => dispatcher.dispatch(eventCreator(payload))),
|
|
230
|
+
}), {});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function isEventInstance(value) {
|
|
234
|
+
return typeof value === 'object' && value !== null && 'type' in value;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @experimental
|
|
239
|
+
* @description
|
|
240
|
+
*
|
|
241
|
+
* SignalStore feature for defining side effects.
|
|
242
|
+
*
|
|
243
|
+
* @usageNotes
|
|
244
|
+
*
|
|
245
|
+
* ```ts
|
|
246
|
+
* import { signalStore, withState } from '@ngrx/signals';
|
|
247
|
+
* import { event, Events, withEffects } from '@ngrx/signals/events';
|
|
248
|
+
*
|
|
249
|
+
* const increment = event('[Counter Page] Increment');
|
|
250
|
+
* const decrement = event('[Counter Page] Decrement');
|
|
251
|
+
*
|
|
252
|
+
* const CounterStore = signalStore(
|
|
253
|
+
* withState({ count: 0 }),
|
|
254
|
+
* withEffects(({ count }, events = inject(Events)) => ({
|
|
255
|
+
* logCount$: events.on(increment, decrement).pipe(
|
|
256
|
+
* tap(({ type }) => console.log(type, count())),
|
|
257
|
+
* ),
|
|
258
|
+
* })),
|
|
259
|
+
* );
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
function withEffects(effectsFactory) {
|
|
263
|
+
return signalStoreFeature(type(), withHooks({
|
|
264
|
+
onInit(store, dispatcher = inject(Dispatcher)) {
|
|
265
|
+
const effectSources = effectsFactory(store);
|
|
266
|
+
const effects = Object.values(effectSources).map((effectSource$) => effectSource$.pipe(tap((value) => {
|
|
267
|
+
if (isEventInstance(value) && !(SOURCE_TYPE in value)) {
|
|
268
|
+
dispatcher.dispatch(value);
|
|
269
|
+
}
|
|
270
|
+
})));
|
|
271
|
+
merge(...effects)
|
|
272
|
+
.pipe(takeUntilDestroyed())
|
|
273
|
+
.subscribe();
|
|
274
|
+
},
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @experimental
|
|
280
|
+
* @description
|
|
281
|
+
*
|
|
282
|
+
* SignalStore feature for defining state changes based on dispatched events.
|
|
283
|
+
*
|
|
284
|
+
* @usageNotes
|
|
285
|
+
*
|
|
286
|
+
* ```ts
|
|
287
|
+
* import { signalStore, type, withState } from '@ngrx/signals';
|
|
288
|
+
* import { event, on, withReducer } from '@ngrx/signals/events';
|
|
289
|
+
*
|
|
290
|
+
* const set = event('[Counter Page] Set', type<number>());
|
|
291
|
+
*
|
|
292
|
+
* const CounterStore = signalStore(
|
|
293
|
+
* withState({ count: 0 }),
|
|
294
|
+
* withReducer(
|
|
295
|
+
* on(set, ({ payload }) => ({ count: payload })),
|
|
296
|
+
* ),
|
|
297
|
+
* );
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
function withReducer(...caseReducers) {
|
|
301
|
+
return signalStoreFeature({ state: type() }, withHooks({
|
|
302
|
+
onInit(store, events = inject(ReducerEvents)) {
|
|
303
|
+
const updates = caseReducers.map((caseReducer) => events.on(...caseReducer.events).pipe(tap((event) => {
|
|
304
|
+
const result = caseReducer.reducer(event);
|
|
305
|
+
const updaters = Array.isArray(result) ? result : [result];
|
|
306
|
+
patchState(store, ...updaters);
|
|
307
|
+
})));
|
|
308
|
+
merge(...updates)
|
|
309
|
+
.pipe(takeUntilDestroyed())
|
|
310
|
+
.subscribe();
|
|
311
|
+
},
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Generated bundle index. Do not edit.
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
export { Dispatcher, Events, event, eventGroup, injectDispatch, on, withEffects, withReducer };
|
|
320
|
+
//# sourceMappingURL=ngrx-signals-events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngrx-signals-events.mjs","sources":["../../../../modules/signals/events/src/case-reducer.ts","../../../../modules/signals/events/src/events-service.ts","../../../../modules/signals/events/src/dispatcher.ts","../../../../modules/signals/events/src/event-creator.ts","../../../../modules/signals/events/src/event-creator-group.ts","../../../../modules/signals/events/src/inject-dispatch.ts","../../../../modules/signals/events/src/event-instance.ts","../../../../modules/signals/events/src/with-effects.ts","../../../../modules/signals/events/src/with-reducer.ts","../../../../modules/signals/events/ngrx-signals-events.ts"],"sourcesContent":["import { PartialStateUpdater } from '@ngrx/signals';\nimport { EventCreator } from './event-creator';\n\nexport type CaseReducerResult<\n State extends object,\n EventCreators extends EventCreator<string, any>[]\n> = {\n reducer: CaseReducer<State, EventCreators>;\n events: EventCreators;\n};\n\ntype CaseReducer<\n State extends object,\n EventCreators extends EventCreator<string, any>[]\n> = (\n event: { [K in keyof EventCreators]: ReturnType<EventCreators[K]> }[number]\n) =>\n | Partial<State>\n | PartialStateUpdater<State>\n | Array<Partial<State> | PartialStateUpdater<State>>;\n\n/**\n * @experimental\n * @description\n *\n * Creates a case reducer that can be used with the `withReducer` feature.\n */\nexport function on<\n State extends object,\n EventCreators extends EventCreator<string, any>[]\n>(\n ...args: [\n ...events: [...EventCreators],\n reducer: CaseReducer<NoInfer<State>, NoInfer<EventCreators>>\n ]\n): CaseReducerResult<State, EventCreators> {\n const reducer = args.pop() as CaseReducer<State, EventCreators>;\n const events = args as unknown as EventCreators;\n\n return { reducer, events };\n}\n","import { Injectable } from '@angular/core';\nimport {\n filter,\n map,\n MonoTypeOperatorFunction,\n Observable,\n Subject,\n} from 'rxjs';\nimport { EventInstance } from './event-instance';\nimport { EventCreator } from './event-creator';\n\nexport const EVENTS = Symbol();\nexport const SOURCE_TYPE = Symbol();\n\nabstract class BaseEvents {\n /**\n * @internal\n */\n readonly [EVENTS] = new Subject<EventInstance<string, unknown>>();\n\n on(): Observable<EventInstance<string, unknown>>;\n on<EventCreators extends EventCreator<string, any>[]>(\n ...events: [...EventCreators]\n ): Observable<\n { [K in keyof EventCreators]: ReturnType<EventCreators[K]> }[number]\n >;\n on(\n ...events: EventCreator<string, unknown>[]\n ): Observable<EventInstance<string, unknown>> {\n return this[EVENTS].pipe(filterByType(events), withSourceType());\n }\n}\n\n/**\n * @experimental\n * @description\n *\n * Globally provided service for listening to dispatched events.\n *\n * @usageNotes\n *\n * ```ts\n * import { event, Events } from '@ngrx/signals/events';\n *\n * const increment = event('[Counter Page] Increment');\n *\n * \\@Component({ \\/* ... *\\/ })\n * class Counter {\n * readonly #events = inject(Events);\n *\n * constructor() {\n * this.#events\n * .on(increment)\n * .pipe(takeUntilDestroyed())\n * .subscribe(() => \\/* handle increment event *\\/);\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class Events extends BaseEvents {}\n\n@Injectable({ providedIn: 'root' })\nexport class ReducerEvents extends BaseEvents {}\n\nfunction filterByType<T extends EventInstance<string, unknown>>(\n events: EventCreator<string, unknown>[]\n): MonoTypeOperatorFunction<T> {\n if (events.length === 0) {\n return (source$) => source$;\n }\n\n const eventMap = toEventCreatorMap(events);\n return filter<T>(({ type }) => !!eventMap[type]);\n}\n\nfunction toEventCreatorMap(\n events: EventCreator<string, unknown>[]\n): Record<string, EventCreator<string, unknown>> {\n return events.reduce((acc, event) => ({ ...acc, [event.type]: event }), {});\n}\n\nfunction withSourceType<\n T extends EventInstance<string, unknown>\n>(): MonoTypeOperatorFunction<T> {\n return map(({ ...event }) => {\n Object.defineProperty(event, SOURCE_TYPE, { value: event.type });\n return event;\n });\n}\n","import { inject, Injectable } from '@angular/core';\nimport { EventInstance } from './event-instance';\nimport { Events, EVENTS, ReducerEvents } from './events-service';\n\n/**\n * @experimental\n * @description\n *\n * Globally provided service for dispatching events.\n *\n * @usageNotes\n *\n * ```ts\n * import { Dispatcher, event } from '@ngrx/signals/events';\n *\n * const increment = event('[Counter Page] Increment');\n *\n * \\@Component({ \\/* ... *\\/ })\n * class Counter {\n * readonly #dispatcher = inject(Dispatcher);\n *\n * increment(): void {\n * this.#dispatcher.dispatch(increment());\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class Dispatcher {\n protected readonly reducerEvents = inject(ReducerEvents);\n protected readonly events = inject(Events);\n\n dispatch(event: EventInstance<string, unknown>): void {\n this.reducerEvents[EVENTS].next(event);\n this.events[EVENTS].next(event);\n }\n}\n","import { EventInstance } from './event-instance';\n\n/**\n * @experimental\n */\nexport type EventCreator<Type extends string, Payload> = ((\n payload: Payload\n) => EventInstance<Type, Payload>) & { type: Type };\n\nexport function event<Type extends string>(\n type: Type\n): EventCreator<Type, void>;\nexport function event<Type extends string, Payload>(\n type: Type,\n payload: Payload\n): EventCreator<Type, Payload>;\n/**\n * @experimental\n * @description\n *\n * Creates an event creator.\n *\n * @usageNotes\n *\n * ### Creating an event creator without payload\n *\n * ```ts\n * import { event } from '@ngrx/signals/events';\n *\n * const increment = event('[Counter Page] Increment');\n * ```\n *\n * ### Creating an event creator with payload\n *\n * ```ts\n * import { type } from '@ngrx/signals';\n * import { event } from '@ngrx/signals/events';\n *\n * const set = event('[Counter Page] Set', type<number>());\n * ```\n */\nexport function event(type: string): EventCreator<string, any> {\n const creator = (payload?: unknown) => ({ type, payload });\n (creator as any).type = type;\n\n return creator as EventCreator<string, unknown>;\n}\n","import { Prettify } from '@ngrx/signals';\nimport { event, EventCreator } from './event-creator';\n\ntype EventType<\n Source extends string,\n EventName extends string\n> = `[${Source}] ${EventName}`;\n\ntype EventCreatorGroup<\n Source extends string,\n Events extends Record<string, any>\n> = {\n [EventName in keyof Events]: EventName extends string\n ? EventCreator<EventType<Source, EventName>, Events[EventName]>\n : never;\n};\n\n/**\n * @experimental\n * @description\n *\n * Creates a group of event creators.\n *\n * @usageNotes\n *\n * ```ts\n * import { type } from '@ngrx/signals';\n * import { eventGroup } from '@ngrx/signals/events';\n *\n * const counterPageEvents = eventGroup({\n * source: 'Counter Page',\n * events: {\n * increment: type<void>(),\n * decrement: type<void>(),\n * set: type<number>(),\n * },\n * });\n * ```\n */\nexport function eventGroup<\n Source extends string,\n Events extends Record<string, unknown>\n>(config: {\n source: Source;\n events: Events;\n}): Prettify<EventCreatorGroup<Source, Events>> {\n return Object.entries(config.events).reduce((acc, [eventName]) => {\n const eventType = `[${config.source}] ${eventName}`;\n return { ...acc, [eventName]: event(eventType) };\n }, {} as EventCreatorGroup<Source, Events>);\n}\n","import {\n assertInInjectionContext,\n inject,\n Injector,\n untracked,\n} from '@angular/core';\nimport { Prettify } from '@ngrx/signals';\nimport { Dispatcher } from './dispatcher';\nimport { EventCreator } from './event-creator';\n\ntype InjectDispatchResult<\n EventGroup extends Record<string, EventCreator<string, any>>\n> = {\n [EventName in keyof EventGroup]: Parameters<EventGroup[EventName]> extends [\n infer Payload\n ]\n ? (payload: Payload) => void\n : () => void;\n};\n\n/**\n * @experimental\n * @description\n *\n * Creates self-dispatching events for a given event group.\n *\n * @usageNotes\n *\n * ```ts\n * import { type } from '@ngrx/signals';\n * import { eventGroup, injectDispatch } from '@ngrx/signals/events';\n *\n * const counterPageEvents = eventGroup({\n * source: 'Counter Page',\n * events: {\n * increment: type<void>(),\n * decrement: type<void>(),\n * },\n * });\n *\n * \\@Component({ \\/* ... *\\/ })\n * class Counter {\n * readonly dispatch = injectDispatch(counterPageEvents);\n *\n * increment(): void {\n * this.dispatch.increment();\n * }\n *\n * decrement(): void {\n * this.dispatch.decrement();\n * }\n * }\n * ```\n */\nexport function injectDispatch<\n EventGroup extends Record<string, EventCreator<string, any>>\n>(\n events: EventGroup,\n config?: { injector?: Injector }\n): Prettify<InjectDispatchResult<EventGroup>> {\n if (!config?.injector) {\n assertInInjectionContext(injectDispatch);\n }\n\n const injector = config?.injector ?? inject(Injector);\n const dispatcher = injector.get(Dispatcher);\n\n return Object.entries(events).reduce(\n (acc, [eventName, eventCreator]) => ({\n ...acc,\n [eventName]: (payload?: unknown) =>\n untracked(() => dispatcher.dispatch(eventCreator(payload))),\n }),\n {} as InjectDispatchResult<EventGroup>\n );\n}\n","/**\n * @experimental\n */\nexport type EventInstance<Type extends string, Payload> = {\n type: Type;\n payload: Payload;\n};\n\nexport function isEventInstance(\n value: unknown\n): value is EventInstance<string, unknown> {\n return typeof value === 'object' && value !== null && 'type' in value;\n}\n","import { inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { merge, Observable, tap } from 'rxjs';\nimport {\n EmptyFeatureResult,\n Prettify,\n signalStoreFeature,\n SignalStoreFeature,\n SignalStoreFeatureResult,\n StateSignals,\n type,\n withHooks,\n WritableStateSource,\n} from '@ngrx/signals';\nimport { Dispatcher } from './dispatcher';\nimport { isEventInstance } from './event-instance';\nimport { SOURCE_TYPE } from './events-service';\n\n/**\n * @experimental\n * @description\n *\n * SignalStore feature for defining side effects.\n *\n * @usageNotes\n *\n * ```ts\n * import { signalStore, withState } from '@ngrx/signals';\n * import { event, Events, withEffects } from '@ngrx/signals/events';\n *\n * const increment = event('[Counter Page] Increment');\n * const decrement = event('[Counter Page] Decrement');\n *\n * const CounterStore = signalStore(\n * withState({ count: 0 }),\n * withEffects(({ count }, events = inject(Events)) => ({\n * logCount$: events.on(increment, decrement).pipe(\n * tap(({ type }) => console.log(type, count())),\n * ),\n * })),\n * );\n * ```\n */\nexport function withEffects<Input extends SignalStoreFeatureResult>(\n effectsFactory: (\n store: Prettify<\n StateSignals<Input['state']> &\n Input['props'] &\n Input['methods'] &\n WritableStateSource<Prettify<Input['state']>>\n >\n ) => Record<string, Observable<unknown>>\n): SignalStoreFeature<Input, EmptyFeatureResult> {\n return signalStoreFeature(\n type<Input>(),\n withHooks({\n onInit(store, dispatcher = inject(Dispatcher)) {\n const effectSources = effectsFactory(store);\n const effects = Object.values(effectSources).map((effectSource$) =>\n effectSource$.pipe(\n tap((value) => {\n if (isEventInstance(value) && !(SOURCE_TYPE in value)) {\n dispatcher.dispatch(value);\n }\n })\n )\n );\n\n merge(...effects)\n .pipe(takeUntilDestroyed())\n .subscribe();\n },\n })\n );\n}\n","import { inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { merge, tap } from 'rxjs';\nimport {\n EmptyFeatureResult,\n patchState,\n SignalStoreFeature,\n signalStoreFeature,\n type,\n withHooks,\n} from '@ngrx/signals';\nimport { CaseReducerResult } from './case-reducer';\nimport { EventCreator } from './event-creator';\nimport { ReducerEvents } from './events-service';\n\n/**\n * @experimental\n * @description\n *\n * SignalStore feature for defining state changes based on dispatched events.\n *\n * @usageNotes\n *\n * ```ts\n * import { signalStore, type, withState } from '@ngrx/signals';\n * import { event, on, withReducer } from '@ngrx/signals/events';\n *\n * const set = event('[Counter Page] Set', type<number>());\n *\n * const CounterStore = signalStore(\n * withState({ count: 0 }),\n * withReducer(\n * on(set, ({ payload }) => ({ count: payload })),\n * ),\n * );\n * ```\n */\nexport function withReducer<State extends object>(\n ...caseReducers: CaseReducerResult<State, EventCreator<string, any>[]>[]\n): SignalStoreFeature<\n { state: State; props: {}; methods: {} },\n EmptyFeatureResult\n> {\n return signalStoreFeature(\n { state: type<State>() },\n withHooks({\n onInit(store, events = inject(ReducerEvents)) {\n const updates = caseReducers.map((caseReducer) =>\n events.on(...caseReducer.events).pipe(\n tap((event) => {\n const result = caseReducer.reducer(event);\n const updaters = Array.isArray(result) ? result : [result];\n\n patchState(store, ...updaters);\n })\n )\n );\n\n merge(...updates)\n .pipe(takeUntilDestroyed())\n .subscribe();\n },\n })\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAqBA;;;;;AAKG;AACa,SAAA,EAAE,CAIhB,GAAG,IAGF,EAAA;AAED,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAuC;IAC/D,MAAM,MAAM,GAAG,IAAgC;AAE/C,IAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;AAC5B;;AC7BO,MAAM,MAAM,GAAG,MAAM,EAAE;AACvB,MAAM,WAAW,GAAG,MAAM,EAAE;AAEnC,MAAe,UAAU,CAAA;AACvB;;AAEG;AACM,IAAA,CAAC,MAAM,IAAI,IAAI,OAAO,EAAkC;IAQjE,EAAE,CACA,GAAG,MAAuC,EAAA;AAE1C,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;;AAEnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AAEG,MAAO,MAAO,SAAQ,UAAU,CAAA;0HAAzB,MAAM,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAN,uBAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAM,cADO,MAAM,EAAA,CAAA;;2FACnB,MAAM,EAAA,UAAA,EAAA,CAAA;kBADlB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAI5B,MAAO,aAAc,SAAQ,UAAU,CAAA;0HAAhC,aAAa,EAAA,IAAA,EAAA,I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WAAW,IAAI,KAAK,CAAC,EAAE;AACrD,oBAAA,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;;aAE7B,CAAC,CACH,CACF;YAED,KAAK,CAAC,GAAG,OAAO;iBACb,IAAI,CAAC,kBAAkB,EAAE;AACzB,iBAAA,SAAS,EAAE;SACf;AACF,KAAA,CAAC,CACH;AACH;;AC3DA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACa,SAAA,WAAW,CACzB,GAAG,YAAqE,EAAA;IAKxE,OAAO,kBAAkB,CACvB,EAAE,KAAK,EAAE,IAAI,EAAS,EAAE,EACxB,SAAS,CAAC;QACR,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,EAAA;AAC1C,YAAA,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,KAC3C,MAAM,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CACnC,GAAG,CAAC,CAAC,KAAK,KAAI;gBACZ,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;AACzC,gBAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;AAE1D,gBAAA,UAAU,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC;aAC/B,CAAC,CACH,CACF;YAED,KAAK,CAAC,GAAG,OAAO;iBACb,IAAI,CAAC,kBAAkB,EAAE;AACzB,iBAAA,SAAS,EAAE;SACf;AACF,KAAA,CAAC,CACH;AACH;;AChEA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrx/signals",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0",
|
|
4
4
|
"description": "Reactive Store and Set of Utilities for Angular Signals",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
"types": "./entities/index.d.ts",
|
|
67
67
|
"default": "./fesm2022/ngrx-signals-entities.mjs"
|
|
68
68
|
},
|
|
69
|
+
"./events": {
|
|
70
|
+
"types": "./events/index.d.ts",
|
|
71
|
+
"default": "./fesm2022/ngrx-signals-events.mjs"
|
|
72
|
+
},
|
|
69
73
|
"./rxjs-interop": {
|
|
70
74
|
"types": "./rxjs-interop/index.d.ts",
|
|
71
75
|
"default": "./fesm2022/ngrx-signals-rxjs-interop.mjs"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^19.
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^19.2.0';\n"]}
|