ngssm-store 22.2.0 → 22.2.2

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/README.md CHANGED
@@ -393,7 +393,7 @@ export class Store {
393
393
 
394
394
  ### Helper Functions
395
395
 
396
- - `createSignal<T>(selector: (state: State) => T): Signal<T>` - Create a derived signal from state
396
+ - `createSignal<T>(selector: (state: State) => T, options?: CreateComputedOptions<T>): Signal<T>` - Create a derived signal from state. `options` are passed to Angular's `computed` function, allowing options such as a custom `equal` comparison function.
397
397
  - `provideNgssmStore()` - Initialize the store
398
398
  - `provideReducer(reducer)` - Register a single reducer
399
399
  - `provideReducers(...reducers)` - Register multiple reducers
@@ -29,7 +29,7 @@ var NgssmCachedItemSetter = class NgssmCachedItemSetter {
29
29
  }
30
30
  static ɵfac = i0.ɵɵngDeclareFactory({
31
31
  minVersion: "12.0.0",
32
- version: "22.2.0",
32
+ version: "22.2.3",
33
33
  ngImport: i0,
34
34
  type: NgssmCachedItemSetter,
35
35
  deps: [],
@@ -37,14 +37,14 @@ var NgssmCachedItemSetter = class NgssmCachedItemSetter {
37
37
  });
38
38
  static ɵprov = i0.ɵɵngDeclareInjectable({
39
39
  minVersion: "12.0.0",
40
- version: "22.2.0",
40
+ version: "22.2.3",
41
41
  ngImport: i0,
42
42
  type: NgssmCachedItemSetter
43
43
  });
44
44
  };
45
45
  i0.ɵɵngDeclareClassMetadata({
46
46
  minVersion: "12.0.0",
47
- version: "22.2.0",
47
+ version: "22.2.3",
48
48
  ngImport: i0,
49
49
  type: NgssmCachedItemSetter,
50
50
  decorators: [{ type: Injectable }]
@@ -68,7 +68,7 @@ var CachedItemReducer = class CachedItemReducer {
68
68
  }
69
69
  static ɵfac = i0.ɵɵngDeclareFactory({
70
70
  minVersion: "12.0.0",
71
- version: "22.2.0",
71
+ version: "22.2.3",
72
72
  ngImport: i0,
73
73
  type: CachedItemReducer,
74
74
  deps: [],
@@ -76,14 +76,14 @@ var CachedItemReducer = class CachedItemReducer {
76
76
  });
77
77
  static ɵprov = i0.ɵɵngDeclareInjectable({
78
78
  minVersion: "12.0.0",
79
- version: "22.2.0",
79
+ version: "22.2.3",
80
80
  ngImport: i0,
81
81
  type: CachedItemReducer
82
82
  });
83
83
  };
84
84
  i0.ɵɵngDeclareClassMetadata({
85
85
  minVersion: "12.0.0",
86
- version: "22.2.0",
86
+ version: "22.2.3",
87
87
  ngImport: i0,
88
88
  type: CachedItemReducer,
89
89
  decorators: [{ type: Injectable }]
@@ -21,7 +21,7 @@ var NgssmVisibilitySetter = class NgssmVisibilitySetter {
21
21
  }
22
22
  static ɵfac = i0.ɵɵngDeclareFactory({
23
23
  minVersion: "12.0.0",
24
- version: "22.2.0",
24
+ version: "22.2.3",
25
25
  ngImport: i0,
26
26
  type: NgssmVisibilitySetter,
27
27
  deps: [],
@@ -29,14 +29,14 @@ var NgssmVisibilitySetter = class NgssmVisibilitySetter {
29
29
  });
30
30
  static ɵprov = i0.ɵɵngDeclareInjectable({
31
31
  minVersion: "12.0.0",
32
- version: "22.2.0",
32
+ version: "22.2.3",
33
33
  ngImport: i0,
34
34
  type: NgssmVisibilitySetter
35
35
  });
36
36
  };
37
37
  i0.ɵɵngDeclareClassMetadata({
38
38
  minVersion: "12.0.0",
39
- version: "22.2.0",
39
+ version: "22.2.3",
40
40
  ngImport: i0,
41
41
  type: NgssmVisibilitySetter,
42
42
  decorators: [{ type: Injectable }]
@@ -100,7 +100,7 @@ var VisibilityReducer = class VisibilityReducer {
100
100
  }
101
101
  static ɵfac = i0.ɵɵngDeclareFactory({
102
102
  minVersion: "12.0.0",
103
- version: "22.2.0",
103
+ version: "22.2.3",
104
104
  ngImport: i0,
105
105
  type: VisibilityReducer,
106
106
  deps: [],
@@ -108,14 +108,14 @@ var VisibilityReducer = class VisibilityReducer {
108
108
  });
109
109
  static ɵprov = i0.ɵɵngDeclareInjectable({
110
110
  minVersion: "12.0.0",
111
- version: "22.2.0",
111
+ version: "22.2.3",
112
112
  ngImport: i0,
113
113
  type: VisibilityReducer
114
114
  });
115
115
  };
116
116
  i0.ɵɵngDeclareClassMetadata({
117
117
  minVersion: "12.0.0",
118
- version: "22.2.0",
118
+ version: "22.2.3",
119
119
  ngImport: i0,
120
120
  type: VisibilityReducer,
121
121
  decorators: [{ type: Injectable }]
@@ -129,7 +129,7 @@ var NgssmIsElementVisiblePipe = class NgssmIsElementVisiblePipe {
129
129
  }
130
130
  static ɵfac = i0.ɵɵngDeclareFactory({
131
131
  minVersion: "12.0.0",
132
- version: "22.2.0",
132
+ version: "22.2.3",
133
133
  ngImport: i0,
134
134
  type: NgssmIsElementVisiblePipe,
135
135
  deps: [],
@@ -137,7 +137,7 @@ var NgssmIsElementVisiblePipe = class NgssmIsElementVisiblePipe {
137
137
  });
138
138
  static ɵpipe = i0.ɵɵngDeclarePipe({
139
139
  minVersion: "14.0.0",
140
- version: "22.2.0",
140
+ version: "22.2.3",
141
141
  ngImport: i0,
142
142
  type: NgssmIsElementVisiblePipe,
143
143
  isStandalone: true,
@@ -146,7 +146,7 @@ var NgssmIsElementVisiblePipe = class NgssmIsElementVisiblePipe {
146
146
  };
147
147
  i0.ɵɵngDeclareClassMetadata({
148
148
  minVersion: "12.0.0",
149
- version: "22.2.0",
149
+ version: "22.2.3",
150
150
  ngImport: i0,
151
151
  type: NgssmIsElementVisiblePipe,
152
152
  decorators: [{
@@ -163,7 +163,7 @@ var NgssmShowElement = class NgssmShowElement {
163
163
  }
164
164
  static ɵfac = i0.ɵɵngDeclareFactory({
165
165
  minVersion: "12.0.0",
166
- version: "22.2.0",
166
+ version: "22.2.3",
167
167
  ngImport: i0,
168
168
  type: NgssmShowElement,
169
169
  deps: [],
@@ -171,7 +171,7 @@ var NgssmShowElement = class NgssmShowElement {
171
171
  });
172
172
  static ɵdir = i0.ɵɵngDeclareDirective({
173
173
  minVersion: "17.1.0",
174
- version: "22.2.0",
174
+ version: "22.2.3",
175
175
  type: NgssmShowElement,
176
176
  isStandalone: true,
177
177
  selector: "[ngssmShowElement]",
@@ -188,7 +188,7 @@ var NgssmShowElement = class NgssmShowElement {
188
188
  };
189
189
  i0.ɵɵngDeclareClassMetadata({
190
190
  minVersion: "12.0.0",
191
- version: "22.2.0",
191
+ version: "22.2.3",
192
192
  ngImport: i0,
193
193
  type: NgssmShowElement,
194
194
  decorators: [{
@@ -216,7 +216,7 @@ var NgssmHideElement = class NgssmHideElement {
216
216
  }
217
217
  static ɵfac = i0.ɵɵngDeclareFactory({
218
218
  minVersion: "12.0.0",
219
- version: "22.2.0",
219
+ version: "22.2.3",
220
220
  ngImport: i0,
221
221
  type: NgssmHideElement,
222
222
  deps: [],
@@ -224,7 +224,7 @@ var NgssmHideElement = class NgssmHideElement {
224
224
  });
225
225
  static ɵdir = i0.ɵɵngDeclareDirective({
226
226
  minVersion: "17.1.0",
227
- version: "22.2.0",
227
+ version: "22.2.3",
228
228
  type: NgssmHideElement,
229
229
  isStandalone: true,
230
230
  selector: "[ngssmHideElement]",
@@ -241,7 +241,7 @@ var NgssmHideElement = class NgssmHideElement {
241
241
  };
242
242
  i0.ɵɵngDeclareClassMetadata({
243
243
  minVersion: "12.0.0",
244
- version: "22.2.0",
244
+ version: "22.2.3",
245
245
  ngImport: i0,
246
246
  type: NgssmHideElement,
247
247
  decorators: [{
@@ -269,7 +269,7 @@ var NgssmToggleElementVisibility = class NgssmToggleElementVisibility {
269
269
  }
270
270
  static ɵfac = i0.ɵɵngDeclareFactory({
271
271
  minVersion: "12.0.0",
272
- version: "22.2.0",
272
+ version: "22.2.3",
273
273
  ngImport: i0,
274
274
  type: NgssmToggleElementVisibility,
275
275
  deps: [],
@@ -277,7 +277,7 @@ var NgssmToggleElementVisibility = class NgssmToggleElementVisibility {
277
277
  });
278
278
  static ɵdir = i0.ɵɵngDeclareDirective({
279
279
  minVersion: "17.1.0",
280
- version: "22.2.0",
280
+ version: "22.2.3",
281
281
  type: NgssmToggleElementVisibility,
282
282
  isStandalone: true,
283
283
  selector: "[ngssmToggleElementVisibility]",
@@ -294,7 +294,7 @@ var NgssmToggleElementVisibility = class NgssmToggleElementVisibility {
294
294
  };
295
295
  i0.ɵɵngDeclareClassMetadata({
296
296
  minVersion: "12.0.0",
297
- version: "22.2.0",
297
+ version: "22.2.3",
298
298
  ngImport: i0,
299
299
  type: NgssmToggleElementVisibility,
300
300
  decorators: [{
@@ -322,7 +322,7 @@ var NgssmVisibilityToggleGroup = class NgssmVisibilityToggleGroup {
322
322
  store = inject(Store);
323
323
  static ɵfac = i0.ɵɵngDeclareFactory({
324
324
  minVersion: "12.0.0",
325
- version: "22.2.0",
325
+ version: "22.2.3",
326
326
  ngImport: i0,
327
327
  type: NgssmVisibilityToggleGroup,
328
328
  deps: [],
@@ -330,7 +330,7 @@ var NgssmVisibilityToggleGroup = class NgssmVisibilityToggleGroup {
330
330
  });
331
331
  static ɵcmp = i0.ɵɵngDeclareComponent({
332
332
  minVersion: "17.0.0",
333
- version: "22.2.0",
333
+ version: "22.2.3",
334
334
  type: NgssmVisibilityToggleGroup,
335
335
  isStandalone: true,
336
336
  selector: "ngssm-visibility-toggle-group",
@@ -407,7 +407,7 @@ var NgssmVisibilityToggleGroup = class NgssmVisibilityToggleGroup {
407
407
  };
408
408
  i0.ɵɵngDeclareClassMetadata({
409
409
  minVersion: "12.0.0",
410
- version: "22.2.0",
410
+ version: "22.2.3",
411
411
  ngImport: i0,
412
412
  type: NgssmVisibilityToggleGroup,
413
413
  decorators: [{
@@ -75,7 +75,7 @@ var Logger = class Logger {
75
75
  }
76
76
  static ɵfac = i0.ɵɵngDeclareFactory({
77
77
  minVersion: "12.0.0",
78
- version: "22.2.0",
78
+ version: "22.2.3",
79
79
  ngImport: i0,
80
80
  type: Logger,
81
81
  deps: [],
@@ -83,7 +83,7 @@ var Logger = class Logger {
83
83
  });
84
84
  static ɵprov = i0.ɵɵngDeclareInjectable({
85
85
  minVersion: "12.0.0",
86
- version: "22.2.0",
86
+ version: "22.2.3",
87
87
  ngImport: i0,
88
88
  type: Logger,
89
89
  providedIn: "root"
@@ -91,7 +91,7 @@ var Logger = class Logger {
91
91
  };
92
92
  i0.ɵɵngDeclareClassMetadata({
93
93
  minVersion: "12.0.0",
94
- version: "22.2.0",
94
+ version: "22.2.3",
95
95
  ngImport: i0,
96
96
  type: Logger,
97
97
  decorators: [{
@@ -122,7 +122,7 @@ var ConsoleAppender = class ConsoleAppender {
122
122
  }
123
123
  static ɵfac = i0.ɵɵngDeclareFactory({
124
124
  minVersion: "12.0.0",
125
- version: "22.2.0",
125
+ version: "22.2.3",
126
126
  ngImport: i0,
127
127
  type: ConsoleAppender,
128
128
  deps: [],
@@ -130,7 +130,7 @@ var ConsoleAppender = class ConsoleAppender {
130
130
  });
131
131
  static ɵprov = i0.ɵɵngDeclareInjectable({
132
132
  minVersion: "12.0.0",
133
- version: "22.2.0",
133
+ version: "22.2.3",
134
134
  ngImport: i0,
135
135
  type: ConsoleAppender,
136
136
  providedIn: "root"
@@ -138,7 +138,7 @@ var ConsoleAppender = class ConsoleAppender {
138
138
  };
139
139
  i0.ɵɵngDeclareClassMetadata({
140
140
  minVersion: "12.0.0",
141
- version: "22.2.0",
141
+ version: "22.2.3",
142
142
  ngImport: i0,
143
143
  type: ConsoleAppender,
144
144
  decorators: [{
@@ -273,7 +273,7 @@ var Store = class Store {
273
273
  }
274
274
  static ɵfac = i0.ɵɵngDeclareFactory({
275
275
  minVersion: "12.0.0",
276
- version: "22.2.0",
276
+ version: "22.2.3",
277
277
  ngImport: i0,
278
278
  type: Store,
279
279
  deps: [],
@@ -281,7 +281,7 @@ var Store = class Store {
281
281
  });
282
282
  static ɵprov = i0.ɵɵngDeclareInjectable({
283
283
  minVersion: "12.0.0",
284
- version: "22.2.0",
284
+ version: "22.2.3",
285
285
  ngImport: i0,
286
286
  type: Store,
287
287
  providedIn: "root"
@@ -289,7 +289,7 @@ var Store = class Store {
289
289
  };
290
290
  i0.ɵɵngDeclareClassMetadata({
291
291
  minVersion: "12.0.0",
292
- version: "22.2.0",
292
+ version: "22.2.3",
293
293
  ngImport: i0,
294
294
  type: Store,
295
295
  decorators: [{
@@ -339,7 +339,7 @@ var ProvideNgssmFeatureStateDirective = class ProvideNgssmFeatureStateDirective
339
339
  }
340
340
  static ɵfac = i0.ɵɵngDeclareFactory({
341
341
  minVersion: "12.0.0",
342
- version: "22.2.0",
342
+ version: "22.2.3",
343
343
  ngImport: i0,
344
344
  type: ProvideNgssmFeatureStateDirective,
345
345
  deps: [],
@@ -347,7 +347,7 @@ var ProvideNgssmFeatureStateDirective = class ProvideNgssmFeatureStateDirective
347
347
  });
348
348
  static ɵdir = i0.ɵɵngDeclareDirective({
349
349
  minVersion: "14.0.0",
350
- version: "22.2.0",
350
+ version: "22.2.3",
351
351
  type: ProvideNgssmFeatureStateDirective,
352
352
  isStandalone: true,
353
353
  selector: "[provideNgssmFeatureState]",
@@ -356,7 +356,7 @@ var ProvideNgssmFeatureStateDirective = class ProvideNgssmFeatureStateDirective
356
356
  };
357
357
  i0.ɵɵngDeclareClassMetadata({
358
358
  minVersion: "12.0.0",
359
- version: "22.2.0",
359
+ version: "22.2.3",
360
360
  ngImport: i0,
361
361
  type: ProvideNgssmFeatureStateDirective,
362
362
  decorators: [{
@@ -379,7 +379,7 @@ var FeatureStateReducer = class FeatureStateReducer {
379
379
  }
380
380
  static ɵfac = i0.ɵɵngDeclareFactory({
381
381
  minVersion: "12.0.0",
382
- version: "22.2.0",
382
+ version: "22.2.3",
383
383
  ngImport: i0,
384
384
  type: FeatureStateReducer,
385
385
  deps: [],
@@ -387,14 +387,14 @@ var FeatureStateReducer = class FeatureStateReducer {
387
387
  });
388
388
  static ɵprov = i0.ɵɵngDeclareInjectable({
389
389
  minVersion: "12.0.0",
390
- version: "22.2.0",
390
+ version: "22.2.3",
391
391
  ngImport: i0,
392
392
  type: FeatureStateReducer
393
393
  });
394
394
  };
395
395
  i0.ɵɵngDeclareClassMetadata({
396
396
  minVersion: "12.0.0",
397
- version: "22.2.0",
397
+ version: "22.2.3",
398
398
  ngImport: i0,
399
399
  type: FeatureStateReducer,
400
400
  decorators: [{ type: Injectable }]
@@ -406,9 +406,9 @@ const provideNgssmStore = () => {
406
406
  useExisting: Store
407
407
  }]);
408
408
  };
409
- const createSignal = (selector) => {
409
+ const createSignal = (selector, options) => {
410
410
  const store = inject(Store);
411
- return computed(() => selector(store.state()));
411
+ return computed(() => selector(store.state()), options);
412
412
  };
413
413
  export { ACTION_DISPATCHER, ConsoleAppender, FeatureStateReducer, LogLevel, Logger, NGSSM_COMPONENT_WITH_FEATURE_STATE, NGSSM_CONSOLE_APPENDER_NAME, NGSSM_EFFECT, NGSSM_REDUCER, NGSSM_STATE_INITIALIZER, NgSsmFeatureState, NgssmRegisterFeatureStateAction, NgssmStoreActionType, NgssmUnregisterFeatureStateAction, ProvideNgssmFeatureStateDirective, Store, createSignal, provideConsoleAppender, provideEffect, provideEffectFunc, provideEffects, provideNgssmFeatureState, provideNgssmStore, provideReducer, provideReducers, startConsoleAppenderFactory };
414
414
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store.mjs","names":[],"sources":["../../../projects/ngssm-store/src/lib/reducer.ts","../../../projects/ngssm-store/src/lib/effect.ts","../../../projects/ngssm-store/src/lib/state-initializer.ts","../../../projects/ngssm-store/src/lib/logging/log-level.ts","../../../projects/ngssm-store/src/lib/logging/logger.ts","../../../projects/ngssm-store/src/lib/logging/console-appender.ts","../../../projects/ngssm-store/src/lib/logging/provide-console-appender.ts","../../../projects/ngssm-store/src/lib/store.ts","../../../projects/ngssm-store/src/lib/feature-state/feature-state-specification.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-store-action-type.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-register-feature-state.action.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-unregister-feature-state.action.ts","../../../projects/ngssm-store/src/lib/feature-state/provide-feature-state.ts","../../../projects/ngssm-store/src/lib/feature-state/provide-ngssm-feature-state.directive.ts","../../../projects/ngssm-store/src/lib/feature-state/feature-state.reducer.ts","../../../projects/ngssm-store/src/lib/provide-ngssm-store.ts","../../../projects/ngssm-store/src/lib/signal-helpers.ts"],"sourcesContent":["import { EnvironmentProviders, InjectionToken, Type, makeEnvironmentProviders } from '@angular/core';\n\nimport { Action } from './action';\nimport { State } from './state';\n\nexport interface Reducer {\n processedActions: string[];\n updateState(state: State, action: Action): State;\n}\n\nexport const NGSSM_REDUCER = new InjectionToken<Reducer>('NGSSM_REDUCER');\n\nexport const provideReducer = (reducer: Type<unknown>): EnvironmentProviders => {\n return makeEnvironmentProviders([{ provide: NGSSM_REDUCER, useClass: reducer, multi: true }]);\n};\n\nexport const provideReducers = (...reducers: Type<unknown>[]): EnvironmentProviders => {\n return makeEnvironmentProviders(reducers.map((reducer) => ({ provide: NGSSM_REDUCER, useClass: reducer, multi: true })));\n};\n","import { EnvironmentProviders, InjectionToken, Type, makeEnvironmentProviders } from '@angular/core';\n\nimport { Action } from './action';\nimport { State } from './state';\nimport { ActionDispatcher } from './action-dispatcher';\n\nexport type EffectFunc<TActionType extends Action = Action> = (state: State, action: TActionType) => void;\n\nexport interface Effect {\n isFunc?: boolean;\n processedActions: string[];\n processAction(actiondispatcher: ActionDispatcher, state: State, action: Action): void;\n}\n\nexport const NGSSM_EFFECT = new InjectionToken<Effect>('NGSSM_EFFECT');\n\nexport const provideEffect = (effect: Type<unknown>): EnvironmentProviders => {\n return makeEnvironmentProviders([{ provide: NGSSM_EFFECT, useClass: effect, multi: true }]);\n};\n\nexport const provideEffects = (...effects: Type<unknown>[]): EnvironmentProviders => {\n return makeEnvironmentProviders(effects.map((effect) => ({ provide: NGSSM_EFFECT, useClass: effect, multi: true })));\n};\n\nexport const provideEffectFunc = (actionType: string, effectFunc: EffectFunc): EnvironmentProviders => {\n return makeEnvironmentProviders([\n {\n provide: NGSSM_EFFECT,\n useFactory: () => {\n const effect: Effect = {\n processedActions: [actionType],\n processAction: (_, state, action) => effectFunc(state, action),\n isFunc: true\n };\n return effect;\n },\n multi: true\n }\n ]);\n};\n","import { InjectionToken } from '@angular/core';\nimport { State } from './state';\n\nexport interface StateInitializer {\n initializeState(state: State): State;\n}\n\nexport const NGSSM_STATE_INITIALIZER = new InjectionToken<StateInitializer>('NGSSM_STATE_INITIALIZER');\n","export enum LogLevel {\n debug = 'Debug',\n information = 'Information',\n error = 'Error'\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\n\nimport { LogEvent } from './log-event';\nimport { LogLevel } from './log-level';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Logger {\n private readonly _logEvents$ = new Subject<LogEvent>();\n\n public get logEvents$(): Observable<LogEvent> {\n return this._logEvents$.asObservable();\n }\n\n public debug(message: string, payload?: unknown): void {\n this.log(LogLevel.debug, message, payload);\n }\n\n public information(message: string, payload?: unknown): void {\n this.log(LogLevel.information, message, payload);\n }\n\n public error(message: string, payload?: unknown): void {\n this.log(LogLevel.error, message, payload);\n }\n\n public log(level: LogLevel, message: string, payload?: unknown): void {\n this._logEvents$.next({\n level,\n message,\n payload\n });\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { Logger } from './logger';\nimport { LogLevel } from './log-level';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConsoleAppender {\n private logger = inject(Logger);\n\n private readonly stopEvent$ = new Subject<boolean>();\n\n public start(contextName?: string): void {\n this.logger.logEvents$.pipe(takeUntil(this.stopEvent$)).subscribe((logEvent) => {\n let logFunction: (...data: unknown[]) => void;\n switch (logEvent.level) {\n case LogLevel.error:\n logFunction = console.error;\n break;\n\n default:\n logFunction = console.log;\n break;\n }\n\n const now = new Date().toLocaleString();\n const prefix = contextName ? `[${contextName}] ` : '';\n\n if (logEvent.payload) {\n logFunction(`${prefix}[${now}] [${logEvent.level}] ${logEvent.message}`, logEvent.payload);\n } else {\n logFunction(`${prefix}[${now}] [${logEvent.level}] ${logEvent.message}`);\n }\n });\n }\n\n public stop(): void {\n this.stopEvent$.next(true);\n }\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders, inject, provideAppInitializer } from '@angular/core';\nimport { ConsoleAppender } from './console-appender';\n\nexport const NGSSM_CONSOLE_APPENDER_NAME = new InjectionToken<string>('NGSSM_CONSOLE_APPENDER_NAME');\n\nexport const startConsoleAppenderFactory = (): (() => void) => {\n return () => {\n const name = inject(NGSSM_CONSOLE_APPENDER_NAME);\n const consoleAppender = inject(ConsoleAppender);\n consoleAppender.start(name);\n };\n};\n\nexport const provideConsoleAppender = (name: string): EnvironmentProviders => {\n return makeEnvironmentProviders([\n {\n provide: NGSSM_CONSOLE_APPENDER_NAME,\n useValue: name\n },\n provideAppInitializer(startConsoleAppenderFactory())\n ]);\n};\n","import { ApplicationRef, EnvironmentInjector, Injectable, Signal, inject, runInInjectionContext, signal } from '@angular/core';\n\nimport update from 'immutability-helper';\n\nimport { FeatureStateSpecification } from './feature-state';\nimport { State } from './state';\nimport { Action } from './action';\nimport { NGSSM_REDUCER, Reducer } from './reducer';\nimport { Effect, NGSSM_EFFECT } from './effect';\nimport { NGSSM_STATE_INITIALIZER, StateInitializer } from './state-initializer';\nimport { Logger } from './logging';\nimport { ActionDispatcher } from './action-dispatcher';\n\nconst featureStateSpecifications: FeatureStateSpecification[] = [];\nexport const NgSsmFeatureState = (specification: FeatureStateSpecification) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return (target: object) => {\n featureStateSpecifications.push(specification);\n };\n};\n\n/**\n * The `Store` class is a centralized state management system for Angular applications.\n * It manages the application state, processes actions using reducers, and handles side effects using effects.\n * The class exposes Angular signals for reactive state management.\n *\n * ### Features:\n * - Centralized state management with support for reducers and effects.\n * - Reactive state updates using Angular signals.\n * - Modular initialization of feature states, reducers, and effects.\n * - Sequential action processing with an action queue.\n * - Logging for debugging and monitoring state changes and action processing.\n *\n * ### Usage:\n * - Dispatch actions using `dispatchAction` or `dispatchActionType`.\n * - Read state updates using `state` (Angular signal).\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class Store implements ActionDispatcher {\n // If true, an action is processed in a macro-task by using setTimoeout. Otherwise, Promise.resolve() is used\n // When using micro task, an issue can occur with angular root effects that want to process state or action signals.\n // They can be executed after a list of actions is processed. In that case, some actions are never processed by the effects.\n public useMacroTasks = true;\n\n // If true, a call to ApplicationRef.tick is made after an action is processed and the state is updated.\n public forceChangeDetectionAfterActionProcessed = false;\n\n // Logger service for debugging and monitoring.\n private readonly logger = inject(Logger);\n // Array of reducers to process state updates.\n private readonly reducers: Reducer[] | null = inject(NGSSM_REDUCER, { optional: true }) as unknown as Reducer[];\n // Array of effects to handle side effects.\n private readonly effects: Effect[] | null = inject(NGSSM_EFFECT, { optional: true }) as unknown as Effect[];\n // Array of state initializers to set up the initial state.\n private readonly initializers: StateInitializer[] = inject(NGSSM_STATE_INITIALIZER, { optional: true }) as unknown as StateInitializer[];\n // Angular's `EnvironmentInjector` for running effects in the correct context.\n private readonly injector = inject(EnvironmentInjector);\n private readonly applicationRef = inject(ApplicationRef);\n\n // A queue to ensure actions are processed sequentially.\n private readonly actionQueue: Action[] = [];\n\n // Maps action types to their corresponding reducers.\n private readonly reducersPerActionType = new Map<string, Reducer[]>();\n\n // Maps action types to their corresponding effects.\n private readonly effectsPerActionType = new Map<string, Effect[]>();\n\n // The current state of the application, managed as an Angular signal.\n private readonly _stateSignal = signal<State>({});\n\n // The most recently action processed by reducers, managed as an Angular signal.\n private readonly _processedAction = signal<Action>({ type: '' });\n\n /**\n * Initializes the `Store` with reducers, effects, and state initializers.\n * Also sets up the initial state and registers reducers and effects.\n */\n constructor() {\n this.logger.information('[Store] ---> state initialization...');\n let state = this._stateSignal();\n\n // Initialize feature states.\n state = featureStateSpecifications.reduce((p, c) => update(p, { [c.featureStateKey]: { $set: c.initialState } }), state);\n\n // Apply state initializers.\n (this.initializers ?? []).forEach((initializer) => {\n this.logger.information('[Store] ------> calling initializer', initializer);\n state = initializer.initializeState(state);\n });\n\n // Update the state with the initialized values.\n this._stateSignal.set(state);\n\n // Register reducers and effects.\n this.logger.information(`[Store] ---> initialization of ${(this.reducers ?? []).length} reducers...`);\n this.initializeProcessors(this.reducers ?? [], this.reducersPerActionType, (r) => r.processedActions);\n this.logger.information(`[Store] ---> initialization of ${(this.effects ?? []).length} effects...`);\n this.initializeProcessors(this.effects ?? [], this.effectsPerActionType, (e) => e.processedActions);\n }\n\n /**\n * Returns the most recently action processed by reducers as an Angular signal.\n * Useful for accessing the last processed action in a reactive manner.\n * This signal is updated before processing the effects.\n */\n public get processedAction(): Signal<Action> {\n return this._processedAction.asReadonly();\n }\n\n /**\n * Returns the current state as an Angular signal.\n * Useful for signal-based reactivity in Angular components.\n */\n public get state(): Signal<State> {\n return this._stateSignal.asReadonly();\n }\n\n /**\n * Dispatches an action to the store.\n * The action is added to the action queue and processed sequentially.\n *\n * @param action - The action to dispatch.\n */\n public dispatchAction(action: Action): void {\n this.actionQueue.push(action);\n this.logger.debug(`Action of type '${action.type}' added to the queue => ${this.actionQueue.length} pending actions`, action);\n\n this.addTaskForNextAction();\n }\n\n /**\n * Dispatches an action by its type.\n * This is a shorthand for dispatching actions without additional payload.\n *\n * @param type - The type of the action to dispatch.\n */\n public dispatchActionType(type: string): void {\n this.dispatchAction({ type });\n }\n\n /**\n * Processes the next action in the action queue.\n * Applies reducers to update the state and executes effects for side effects.\n */\n private processNextAction(): void {\n const nextAction = this.actionQueue.shift();\n if (!nextAction) {\n this.logger.debug('[processNextAction] No action to process');\n return;\n }\n\n this.logger.information(`[processNextAction] Start processing action '${nextAction.type}...`, nextAction);\n\n try {\n // Apply reducers to update the state.\n const updatedState = this.applyReducers(nextAction);\n\n if (this.forceChangeDetectionAfterActionProcessed) {\n this.applicationRef.tick();\n }\n\n // Execute effects for the action.\n const effects = this.effectsPerActionType.get(nextAction.type) ?? [];\n this.logger.debug(`[Store] ${effects.length} effects found to process the action ${nextAction.type}`, effects);\n effects.forEach((effect) => {\n if (effect.isFunc === true) {\n runInInjectionContext(this.injector, () => this.runEffect(effect, updatedState, nextAction));\n } else {\n this.runEffect(effect, updatedState, nextAction);\n }\n });\n } catch (error) {\n this.logger.error(`Error when processing action ${nextAction.type}`, {\n error,\n action: nextAction\n });\n } finally {\n this.logger.information(`[processNextAction] action '${nextAction.type} processed.`, nextAction);\n\n // Process the next action asynchronously\n this.addTaskForNextAction();\n }\n }\n\n /**\n * Applies reducers to the current state based on the dispatched action.\n * Updates the state if there are changes and sets the processed action signal.\n *\n * @param nextAction - The action being processed.\n * @returns The updated state after applying reducers.\n */\n private applyReducers(nextAction: Action): State {\n try {\n const reducers = this.reducersPerActionType.get(nextAction.type) ?? [];\n this.logger.debug(`[Store] ${reducers.length} reducers found to process the action ${nextAction.type}`, reducers);\n const currentState = this._stateSignal();\n const updatedState = reducers.reduce((p, c) => c.updateState(p, nextAction), currentState);\n\n if (updatedState !== currentState) {\n this._stateSignal.set(updatedState);\n }\n\n return updatedState;\n } finally {\n this.logger.debug(`[Store] Notify action ${nextAction.type} as processed`);\n this._processedAction.set(nextAction);\n }\n }\n\n /**\n * Executes an effect for a given action.\n * Handles any errors that occur during effect execution.\n *\n * @param effect - The effect to execute.\n * @param updatedState - The updated state after reducers have been applied.\n * @param nextAction - The action being processed.\n */\n private runEffect(effect: Effect, updatedState: State, nextAction: Action): void {\n try {\n effect.processAction(this, updatedState, nextAction);\n } catch (error) {\n this.logger.error(`Unable to process action ${nextAction.type} by effect ${effect}`, {\n error,\n action: nextAction,\n processor: effect\n });\n }\n }\n\n /**\n * Initializes reducers or effects and maps them to their corresponding action types.\n *\n * @param processors - The array of reducers or effects to initialize.\n * @param processorMap - The map to store processors by action type.\n * @param getProcessedActions - A function to retrieve the action types processed by a processor.\n */\n private initializeProcessors<T>(processors: T[], processorMap: Map<string, T[]>, getProcessedActions: (processor: T) => string[]): void {\n processors.forEach((processor) => {\n this.logger.information('[Store] ------> initialization of ', processor);\n getProcessedActions(processor).forEach((actionType) => {\n const storedProcessors = processorMap.get(actionType) ?? [];\n if (storedProcessors.length === 0) {\n processorMap.set(actionType, storedProcessors);\n }\n storedProcessors.push(processor);\n });\n });\n }\n\n private addTaskForNextAction(): void {\n if (this.useMacroTasks) {\n setTimeout(() => this.processNextAction());\n } else {\n Promise.resolve().then(() => this.processNextAction());\n }\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport interface FeatureStateSpecification {\n readonly featureStateKey: string;\n readonly initialState: object;\n}\n\nexport const NGSSM_COMPONENT_WITH_FEATURE_STATE = new InjectionToken<FeatureStateSpecification>('NGSSM_COMPONENT_WITH_FEATURE_STATE');\n","export enum NgssmStoreActionType {\n registerFeatureState = '[NgssmStoreActionType] registerFeatureState',\n unregisterFeatureState = '[NgssmStoreActionType] unregisterFeatureState'\n}\n","import { Action } from '../action';\nimport { NgssmStoreActionType } from './ngssm-store-action-type';\n\nexport class NgssmRegisterFeatureStateAction implements Action {\n public readonly type: string = NgssmStoreActionType.registerFeatureState;\n\n constructor(\n public readonly featureStateKey: string,\n public readonly initialValue: object\n ) {}\n}\n","import { Action } from '../action';\nimport { NgssmStoreActionType } from './ngssm-store-action-type';\n\nexport class NgssmUnregisterFeatureStateAction implements Action {\n public readonly type: string = NgssmStoreActionType.unregisterFeatureState;\n\n constructor(public readonly featureStateKey: string) {}\n}\n","import { EnvironmentProviders, makeEnvironmentProviders, inject, provideAppInitializer } from '@angular/core';\nimport { Store } from '../store';\nimport { NgssmRegisterFeatureStateAction } from '../actions';\n\nconst registerFeatureState = (featureStateKey: string, initialValue: object) => {\n return () => {\n inject(Store).dispatchAction(new NgssmRegisterFeatureStateAction(featureStateKey, initialValue));\n };\n};\n\nexport const provideNgssmFeatureState = (featureStateKey: string, initialValue: object): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(registerFeatureState(featureStateKey, initialValue))]);\n};\n","import { Directive, inject, OnDestroy } from '@angular/core';\n\nimport { Store } from '../store';\nimport { NgssmRegisterFeatureStateAction, NgssmUnregisterFeatureStateAction } from '../actions';\nimport { FeatureStateSpecification, NGSSM_COMPONENT_WITH_FEATURE_STATE } from './feature-state-specification';\n\n// export interface ComponentWithFeatureState {\n// featureStateKey: string;\n// initialValue: object;\n// }\n\n// export const NGSSM_COMPONENT_WITH_FEATURE_STATE = new InjectionToken<ComponentWithFeatureState>('NGSSM_COMPONENT_WITH_FEATURE_STATE');\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[provideNgssmFeatureState]'\n})\nexport class ProvideNgssmFeatureStateDirective implements OnDestroy {\n private readonly component: FeatureStateSpecification = inject(NGSSM_COMPONENT_WITH_FEATURE_STATE);\n private store = inject(Store);\n\n constructor() {\n this.store.dispatchAction(new NgssmRegisterFeatureStateAction(this.component.featureStateKey, this.component.initialState));\n }\n\n public ngOnDestroy(): void {\n this.store.dispatchAction(new NgssmUnregisterFeatureStateAction(this.component.featureStateKey));\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport update from 'immutability-helper';\n\nimport { Reducer } from '../reducer';\nimport { NgssmRegisterFeatureStateAction, NgssmStoreActionType, NgssmUnregisterFeatureStateAction } from '../actions';\nimport { State } from '../state';\nimport { Action } from '../action';\n\n@Injectable()\nexport class FeatureStateReducer implements Reducer {\n public readonly processedActions: string[] = [NgssmStoreActionType.registerFeatureState, NgssmStoreActionType.unregisterFeatureState];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmStoreActionType.registerFeatureState: {\n const registerFeatureStateAction = action as NgssmRegisterFeatureStateAction;\n return update(state, {\n [registerFeatureStateAction.featureStateKey]: { $set: registerFeatureStateAction.initialValue }\n });\n }\n\n case NgssmStoreActionType.unregisterFeatureState: {\n const unregisterFeatureStateAction = action as NgssmUnregisterFeatureStateAction;\n return update(state, {\n $unset: [unregisterFeatureStateAction.featureStateKey]\n });\n }\n }\n\n return state;\n }\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport { provideReducers } from './reducer';\nimport { ActionDispatcher } from './action-dispatcher';\nimport { FeatureStateReducer } from './feature-state';\nimport { Store } from './store';\n\nexport const ACTION_DISPATCHER = new InjectionToken<ActionDispatcher>('ACTION_DISPATCHER');\n\nexport const provideNgssmStore = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(FeatureStateReducer), { provide: ACTION_DISPATCHER, useExisting: Store }]);\n};\n","import { computed, inject, Signal } from '@angular/core';\nimport { State } from './state';\nimport { Store } from './store';\n\nexport const createSignal = <T = unknown>(selector: (state: State) => T): Signal<T> => {\n const store = inject(Store);\n return computed(() => selector(store.state()));\n};\n"],"mappings":";;;;AAUA,MAAa,gBAAgB,IAAI,eAAwB,eAAe;AAExE,MAAa,kBAAkB,YAAgD;CAC7E,OAAO,yBAAyB,CAAC;EAAE,SAAS;EAAe,UAAU;EAAS,OAAO;CAAI,CAAE,CAAC;AAC9F;AAEA,MAAa,mBAAmB,GAAG,aAAmD;CACpF,OAAO,yBAAyB,SAAS,KAAK,aAAa;EAAE,SAAS;EAAe,UAAU;EAAS,OAAO;CAAI,EAAG,CAAC;AACzH;ACJA,MAAa,eAAe,IAAI,eAAuB,cAAc;AAErE,MAAa,iBAAiB,WAA+C;CAC3E,OAAO,yBAAyB,CAAC;EAAE,SAAS;EAAc,UAAU;EAAQ,OAAO;CAAI,CAAE,CAAC;AAC5F;AAEA,MAAa,kBAAkB,GAAG,YAAkD;CAClF,OAAO,yBAAyB,QAAQ,KAAK,YAAY;EAAE,SAAS;EAAc,UAAU;EAAQ,OAAO;CAAI,EAAG,CAAC;AACrH;AAEA,MAAa,qBAAqB,YAAoB,eAAgD;CACpG,OAAO,yBAAyB,CAC9B;EACE,SAAS;EACT,kBAAiB;GAMf,OAAO;IAJL,kBAAkB,CAAC,UAAU;IAC7B,gBAAgB,GAAG,OAAO,WAAW,WAAW,OAAO,MAAM;IAC7D,QAAQ;GAEH;EACT;EACA,OAAO;CACR,CACF,CAAA;AACH;AChCA,MAAa,0BAA0B,IAAI,eAAiC,yBAAyB;ACPrG,IAAY;CAAZ,SAAY,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projects/ngssm-store/src/lib/state-initializer.ts","../../../projects/ngssm-store/src/lib/logging/log-level.ts","../../../projects/ngssm-store/src/lib/logging/logger.ts","../../../projects/ngssm-store/src/lib/logging/console-appender.ts","../../../projects/ngssm-store/src/lib/logging/provide-console-appender.ts","../../../projects/ngssm-store/src/lib/store.ts","../../../projects/ngssm-store/src/lib/feature-state/feature-state-specification.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-store-action-type.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-register-feature-state.action.ts","../../../projects/ngssm-store/src/lib/actions/ngssm-unregister-feature-state.action.ts","../../../projects/ngssm-store/src/lib/feature-state/provide-feature-state.ts","../../../projects/ngssm-store/src/lib/feature-state/provide-ngssm-feature-state.directive.ts","../../../projects/ngssm-store/src/lib/feature-state/feature-state.reducer.ts","../../../projects/ngssm-store/src/lib/provide-ngssm-store.ts","../../../projects/ngssm-store/src/lib/signal-helpers.ts"],"sourcesContent":["import { EnvironmentProviders, InjectionToken, Type, makeEnvironmentProviders } from '@angular/core';\n\nimport { Action } from './action';\nimport { State } from './state';\n\nexport interface Reducer {\n processedActions: string[];\n updateState(state: State, action: Action): State;\n}\n\nexport const NGSSM_REDUCER = new InjectionToken<Reducer>('NGSSM_REDUCER');\n\nexport const provideReducer = (reducer: Type<unknown>): EnvironmentProviders => {\n return makeEnvironmentProviders([{ provide: NGSSM_REDUCER, useClass: reducer, multi: true }]);\n};\n\nexport const provideReducers = (...reducers: Type<unknown>[]): EnvironmentProviders => {\n return makeEnvironmentProviders(reducers.map((reducer) => ({ provide: NGSSM_REDUCER, useClass: reducer, multi: true })));\n};\n","import { EnvironmentProviders, InjectionToken, Type, makeEnvironmentProviders } from '@angular/core';\n\nimport { Action } from './action';\nimport { State } from './state';\nimport { ActionDispatcher } from './action-dispatcher';\n\nexport type EffectFunc<TActionType extends Action = Action> = (state: State, action: TActionType) => void;\n\nexport interface Effect {\n isFunc?: boolean;\n processedActions: string[];\n processAction(actiondispatcher: ActionDispatcher, state: State, action: Action): void;\n}\n\nexport const NGSSM_EFFECT = new InjectionToken<Effect>('NGSSM_EFFECT');\n\nexport const provideEffect = (effect: Type<unknown>): EnvironmentProviders => {\n return makeEnvironmentProviders([{ provide: NGSSM_EFFECT, useClass: effect, multi: true }]);\n};\n\nexport const provideEffects = (...effects: Type<unknown>[]): EnvironmentProviders => {\n return makeEnvironmentProviders(effects.map((effect) => ({ provide: NGSSM_EFFECT, useClass: effect, multi: true })));\n};\n\nexport const provideEffectFunc = <TActionType extends Action = Action>(\n actionType: string,\n effectFunc: EffectFunc<TActionType>\n): EnvironmentProviders => {\n return makeEnvironmentProviders([\n {\n provide: NGSSM_EFFECT,\n useFactory: () => {\n const effect: Effect = {\n processedActions: [actionType],\n processAction: (_, state, action) => effectFunc(state, action as TActionType),\n isFunc: true\n };\n return effect;\n },\n multi: true\n }\n ]);\n};\n","import { InjectionToken } from '@angular/core';\nimport { State } from './state';\n\nexport interface StateInitializer {\n initializeState(state: State): State;\n}\n\nexport const NGSSM_STATE_INITIALIZER = new InjectionToken<StateInitializer>('NGSSM_STATE_INITIALIZER');\n","export enum LogLevel {\n debug = 'Debug',\n information = 'Information',\n error = 'Error'\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\n\nimport { LogEvent } from './log-event';\nimport { LogLevel } from './log-level';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class Logger {\n private readonly _logEvents$ = new Subject<LogEvent>();\n\n public get logEvents$(): Observable<LogEvent> {\n return this._logEvents$.asObservable();\n }\n\n public debug(message: string, payload?: unknown): void {\n this.log(LogLevel.debug, message, payload);\n }\n\n public information(message: string, payload?: unknown): void {\n this.log(LogLevel.information, message, payload);\n }\n\n public error(message: string, payload?: unknown): void {\n this.log(LogLevel.error, message, payload);\n }\n\n public log(level: LogLevel, message: string, payload?: unknown): void {\n this._logEvents$.next({\n level,\n message,\n payload\n });\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { Logger } from './logger';\nimport { LogLevel } from './log-level';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConsoleAppender {\n private logger = inject(Logger);\n\n private readonly stopEvent$ = new Subject<boolean>();\n\n public start(contextName?: string): void {\n this.logger.logEvents$.pipe(takeUntil(this.stopEvent$)).subscribe((logEvent) => {\n let logFunction: (...data: unknown[]) => void;\n switch (logEvent.level) {\n case LogLevel.error:\n logFunction = console.error;\n break;\n\n default:\n logFunction = console.log;\n break;\n }\n\n const now = new Date().toLocaleString();\n const prefix = contextName ? `[${contextName}] ` : '';\n\n if (logEvent.payload) {\n logFunction(`${prefix}[${now}] [${logEvent.level}] ${logEvent.message}`, logEvent.payload);\n } else {\n logFunction(`${prefix}[${now}] [${logEvent.level}] ${logEvent.message}`);\n }\n });\n }\n\n public stop(): void {\n this.stopEvent$.next(true);\n }\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders, inject, provideAppInitializer } from '@angular/core';\nimport { ConsoleAppender } from './console-appender';\n\nexport const NGSSM_CONSOLE_APPENDER_NAME = new InjectionToken<string>('NGSSM_CONSOLE_APPENDER_NAME');\n\nexport const startConsoleAppenderFactory = (): (() => void) => {\n return () => {\n const name = inject(NGSSM_CONSOLE_APPENDER_NAME);\n const consoleAppender = inject(ConsoleAppender);\n consoleAppender.start(name);\n };\n};\n\nexport const provideConsoleAppender = (name: string): EnvironmentProviders => {\n return makeEnvironmentProviders([\n {\n provide: NGSSM_CONSOLE_APPENDER_NAME,\n useValue: name\n },\n provideAppInitializer(startConsoleAppenderFactory())\n ]);\n};\n","import { ApplicationRef, EnvironmentInjector, Injectable, Signal, inject, runInInjectionContext, signal } from '@angular/core';\n\nimport update from 'immutability-helper';\n\nimport { FeatureStateSpecification } from './feature-state';\nimport { State } from './state';\nimport { Action } from './action';\nimport { NGSSM_REDUCER, Reducer } from './reducer';\nimport { Effect, NGSSM_EFFECT } from './effect';\nimport { NGSSM_STATE_INITIALIZER, StateInitializer } from './state-initializer';\nimport { Logger } from './logging';\nimport { ActionDispatcher } from './action-dispatcher';\n\nconst featureStateSpecifications: FeatureStateSpecification[] = [];\nexport const NgSsmFeatureState = (specification: FeatureStateSpecification) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return (target: object) => {\n featureStateSpecifications.push(specification);\n };\n};\n\n/**\n * The `Store` class is a centralized state management system for Angular applications.\n * It manages the application state, processes actions using reducers, and handles side effects using effects.\n * The class exposes Angular signals for reactive state management.\n *\n * ### Features:\n * - Centralized state management with support for reducers and effects.\n * - Reactive state updates using Angular signals.\n * - Modular initialization of feature states, reducers, and effects.\n * - Sequential action processing with an action queue.\n * - Logging for debugging and monitoring state changes and action processing.\n *\n * ### Usage:\n * - Dispatch actions using `dispatchAction` or `dispatchActionType`.\n * - Read state updates using `state` (Angular signal).\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class Store implements ActionDispatcher {\n // If true, an action is processed in a macro-task by using setTimoeout. Otherwise, Promise.resolve() is used\n // When using micro task, an issue can occur with angular root effects that want to process state or action signals.\n // They can be executed after a list of actions is processed. In that case, some actions are never processed by the effects.\n public useMacroTasks = true;\n\n // If true, a call to ApplicationRef.tick is made after an action is processed and the state is updated.\n public forceChangeDetectionAfterActionProcessed = false;\n\n // Logger service for debugging and monitoring.\n private readonly logger = inject(Logger);\n // Array of reducers to process state updates.\n private readonly reducers: Reducer[] | null = inject(NGSSM_REDUCER, { optional: true }) as unknown as Reducer[];\n // Array of effects to handle side effects.\n private readonly effects: Effect[] | null = inject(NGSSM_EFFECT, { optional: true }) as unknown as Effect[];\n // Array of state initializers to set up the initial state.\n private readonly initializers: StateInitializer[] = inject(NGSSM_STATE_INITIALIZER, { optional: true }) as unknown as StateInitializer[];\n // Angular's `EnvironmentInjector` for running effects in the correct context.\n private readonly injector = inject(EnvironmentInjector);\n private readonly applicationRef = inject(ApplicationRef);\n\n // A queue to ensure actions are processed sequentially.\n private readonly actionQueue: Action[] = [];\n\n // Maps action types to their corresponding reducers.\n private readonly reducersPerActionType = new Map<string, Reducer[]>();\n\n // Maps action types to their corresponding effects.\n private readonly effectsPerActionType = new Map<string, Effect[]>();\n\n // The current state of the application, managed as an Angular signal.\n private readonly _stateSignal = signal<State>({});\n\n // The most recently action processed by reducers, managed as an Angular signal.\n private readonly _processedAction = signal<Action>({ type: '' });\n\n /**\n * Initializes the `Store` with reducers, effects, and state initializers.\n * Also sets up the initial state and registers reducers and effects.\n */\n constructor() {\n this.logger.information('[Store] ---> state initialization...');\n let state = this._stateSignal();\n\n // Initialize feature states.\n state = featureStateSpecifications.reduce((p, c) => update(p, { [c.featureStateKey]: { $set: c.initialState } }), state);\n\n // Apply state initializers.\n (this.initializers ?? []).forEach((initializer) => {\n this.logger.information('[Store] ------> calling initializer', initializer);\n state = initializer.initializeState(state);\n });\n\n // Update the state with the initialized values.\n this._stateSignal.set(state);\n\n // Register reducers and effects.\n this.logger.information(`[Store] ---> initialization of ${(this.reducers ?? []).length} reducers...`);\n this.initializeProcessors(this.reducers ?? [], this.reducersPerActionType, (r) => r.processedActions);\n this.logger.information(`[Store] ---> initialization of ${(this.effects ?? []).length} effects...`);\n this.initializeProcessors(this.effects ?? [], this.effectsPerActionType, (e) => e.processedActions);\n }\n\n /**\n * Returns the most recently action processed by reducers as an Angular signal.\n * Useful for accessing the last processed action in a reactive manner.\n * This signal is updated before processing the effects.\n */\n public get processedAction(): Signal<Action> {\n return this._processedAction.asReadonly();\n }\n\n /**\n * Returns the current state as an Angular signal.\n * Useful for signal-based reactivity in Angular components.\n */\n public get state(): Signal<State> {\n return this._stateSignal.asReadonly();\n }\n\n /**\n * Dispatches an action to the store.\n * The action is added to the action queue and processed sequentially.\n *\n * @param action - The action to dispatch.\n */\n public dispatchAction(action: Action): void {\n this.actionQueue.push(action);\n this.logger.debug(`Action of type '${action.type}' added to the queue => ${this.actionQueue.length} pending actions`, action);\n\n this.addTaskForNextAction();\n }\n\n /**\n * Dispatches an action by its type.\n * This is a shorthand for dispatching actions without additional payload.\n *\n * @param type - The type of the action to dispatch.\n */\n public dispatchActionType(type: string): void {\n this.dispatchAction({ type });\n }\n\n /**\n * Processes the next action in the action queue.\n * Applies reducers to update the state and executes effects for side effects.\n */\n private processNextAction(): void {\n const nextAction = this.actionQueue.shift();\n if (!nextAction) {\n this.logger.debug('[processNextAction] No action to process');\n return;\n }\n\n this.logger.information(`[processNextAction] Start processing action '${nextAction.type}...`, nextAction);\n\n try {\n // Apply reducers to update the state.\n const updatedState = this.applyReducers(nextAction);\n\n if (this.forceChangeDetectionAfterActionProcessed) {\n this.applicationRef.tick();\n }\n\n // Execute effects for the action.\n const effects = this.effectsPerActionType.get(nextAction.type) ?? [];\n this.logger.debug(`[Store] ${effects.length} effects found to process the action ${nextAction.type}`, effects);\n effects.forEach((effect) => {\n if (effect.isFunc === true) {\n runInInjectionContext(this.injector, () => this.runEffect(effect, updatedState, nextAction));\n } else {\n this.runEffect(effect, updatedState, nextAction);\n }\n });\n } catch (error) {\n this.logger.error(`Error when processing action ${nextAction.type}`, {\n error,\n action: nextAction\n });\n } finally {\n this.logger.information(`[processNextAction] action '${nextAction.type} processed.`, nextAction);\n\n // Process the next action asynchronously\n this.addTaskForNextAction();\n }\n }\n\n /**\n * Applies reducers to the current state based on the dispatched action.\n * Updates the state if there are changes and sets the processed action signal.\n *\n * @param nextAction - The action being processed.\n * @returns The updated state after applying reducers.\n */\n private applyReducers(nextAction: Action): State {\n try {\n const reducers = this.reducersPerActionType.get(nextAction.type) ?? [];\n this.logger.debug(`[Store] ${reducers.length} reducers found to process the action ${nextAction.type}`, reducers);\n const currentState = this._stateSignal();\n const updatedState = reducers.reduce((p, c) => c.updateState(p, nextAction), currentState);\n\n if (updatedState !== currentState) {\n this._stateSignal.set(updatedState);\n }\n\n return updatedState;\n } finally {\n this.logger.debug(`[Store] Notify action ${nextAction.type} as processed`);\n this._processedAction.set(nextAction);\n }\n }\n\n /**\n * Executes an effect for a given action.\n * Handles any errors that occur during effect execution.\n *\n * @param effect - The effect to execute.\n * @param updatedState - The updated state after reducers have been applied.\n * @param nextAction - The action being processed.\n */\n private runEffect(effect: Effect, updatedState: State, nextAction: Action): void {\n try {\n effect.processAction(this, updatedState, nextAction);\n } catch (error) {\n this.logger.error(`Unable to process action ${nextAction.type} by effect ${effect}`, {\n error,\n action: nextAction,\n processor: effect\n });\n }\n }\n\n /**\n * Initializes reducers or effects and maps them to their corresponding action types.\n *\n * @param processors - The array of reducers or effects to initialize.\n * @param processorMap - The map to store processors by action type.\n * @param getProcessedActions - A function to retrieve the action types processed by a processor.\n */\n private initializeProcessors<T>(processors: T[], processorMap: Map<string, T[]>, getProcessedActions: (processor: T) => string[]): void {\n processors.forEach((processor) => {\n this.logger.information('[Store] ------> initialization of ', processor);\n getProcessedActions(processor).forEach((actionType) => {\n const storedProcessors = processorMap.get(actionType) ?? [];\n if (storedProcessors.length === 0) {\n processorMap.set(actionType, storedProcessors);\n }\n storedProcessors.push(processor);\n });\n });\n }\n\n private addTaskForNextAction(): void {\n if (this.useMacroTasks) {\n setTimeout(() => this.processNextAction());\n } else {\n Promise.resolve().then(() => this.processNextAction());\n }\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport interface FeatureStateSpecification {\n readonly featureStateKey: string;\n readonly initialState: object;\n}\n\nexport const NGSSM_COMPONENT_WITH_FEATURE_STATE = new InjectionToken<FeatureStateSpecification>('NGSSM_COMPONENT_WITH_FEATURE_STATE');\n","export enum NgssmStoreActionType {\n registerFeatureState = '[NgssmStoreActionType] registerFeatureState',\n unregisterFeatureState = '[NgssmStoreActionType] unregisterFeatureState'\n}\n","import { Action } from '../action';\nimport { NgssmStoreActionType } from './ngssm-store-action-type';\n\nexport class NgssmRegisterFeatureStateAction implements Action {\n public readonly type: string = NgssmStoreActionType.registerFeatureState;\n\n constructor(\n public readonly featureStateKey: string,\n public readonly initialValue: object\n ) {}\n}\n","import { Action } from '../action';\nimport { NgssmStoreActionType } from './ngssm-store-action-type';\n\nexport class NgssmUnregisterFeatureStateAction implements Action {\n public readonly type: string = NgssmStoreActionType.unregisterFeatureState;\n\n constructor(public readonly featureStateKey: string) {}\n}\n","import { EnvironmentProviders, makeEnvironmentProviders, inject, provideAppInitializer } from '@angular/core';\nimport { Store } from '../store';\nimport { NgssmRegisterFeatureStateAction } from '../actions';\n\nconst registerFeatureState = (featureStateKey: string, initialValue: object) => {\n return () => {\n inject(Store).dispatchAction(new NgssmRegisterFeatureStateAction(featureStateKey, initialValue));\n };\n};\n\nexport const provideNgssmFeatureState = (featureStateKey: string, initialValue: object): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(registerFeatureState(featureStateKey, initialValue))]);\n};\n","import { Directive, inject, OnDestroy } from '@angular/core';\n\nimport { Store } from '../store';\nimport { NgssmRegisterFeatureStateAction, NgssmUnregisterFeatureStateAction } from '../actions';\nimport { FeatureStateSpecification, NGSSM_COMPONENT_WITH_FEATURE_STATE } from './feature-state-specification';\n\n// export interface ComponentWithFeatureState {\n// featureStateKey: string;\n// initialValue: object;\n// }\n\n// export const NGSSM_COMPONENT_WITH_FEATURE_STATE = new InjectionToken<ComponentWithFeatureState>('NGSSM_COMPONENT_WITH_FEATURE_STATE');\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[provideNgssmFeatureState]'\n})\nexport class ProvideNgssmFeatureStateDirective implements OnDestroy {\n private readonly component: FeatureStateSpecification = inject(NGSSM_COMPONENT_WITH_FEATURE_STATE);\n private store = inject(Store);\n\n constructor() {\n this.store.dispatchAction(new NgssmRegisterFeatureStateAction(this.component.featureStateKey, this.component.initialState));\n }\n\n public ngOnDestroy(): void {\n this.store.dispatchAction(new NgssmUnregisterFeatureStateAction(this.component.featureStateKey));\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport update from 'immutability-helper';\n\nimport { Reducer } from '../reducer';\nimport { NgssmRegisterFeatureStateAction, NgssmStoreActionType, NgssmUnregisterFeatureStateAction } from '../actions';\nimport { State } from '../state';\nimport { Action } from '../action';\n\n@Injectable()\nexport class FeatureStateReducer implements Reducer {\n public readonly processedActions: string[] = [NgssmStoreActionType.registerFeatureState, NgssmStoreActionType.unregisterFeatureState];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmStoreActionType.registerFeatureState: {\n const registerFeatureStateAction = action as NgssmRegisterFeatureStateAction;\n return update(state, {\n [registerFeatureStateAction.featureStateKey]: { $set: registerFeatureStateAction.initialValue }\n });\n }\n\n case NgssmStoreActionType.unregisterFeatureState: {\n const unregisterFeatureStateAction = action as NgssmUnregisterFeatureStateAction;\n return update(state, {\n $unset: [unregisterFeatureStateAction.featureStateKey]\n });\n }\n }\n\n return state;\n }\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport { provideReducers } from './reducer';\nimport { ActionDispatcher } from './action-dispatcher';\nimport { FeatureStateReducer } from './feature-state';\nimport { Store } from './store';\n\nexport const ACTION_DISPATCHER = new InjectionToken<ActionDispatcher>('ACTION_DISPATCHER');\n\nexport const provideNgssmStore = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(FeatureStateReducer), { provide: ACTION_DISPATCHER, useExisting: Store }]);\n};\n","import { computed, CreateComputedOptions, inject, Signal } from '@angular/core';\nimport { State } from './state';\nimport { Store } from './store';\n\n/**\n * Creates a computed signal from the store state using the provided selector.\n * @param selector Selects a value from the current store state.\n * @param options Options passed to Angular's computed signal.\n */\nexport const createSignal = <T = unknown>(selector: (state: State) => T, options?: CreateComputedOptions<T>): Signal<T> => {\n const store = inject(Store);\n return computed(() => selector(store.state()), options);\n};\n"],"mappings":";;;;AAUA,MAAa,gBAAgB,IAAI,eAAwB,eAAe;AAExE,MAAa,kBAAkB,YAAgD;CAC7E,OAAO,yBAAyB,CAAC;EAAE,SAAS;EAAe,UAAU;EAAS,OAAO;CAAI,CAAE,CAAC;AAC9F;AAEA,MAAa,mBAAmB,GAAG,aAAmD;CACpF,OAAO,yBAAyB,SAAS,KAAK,aAAa;EAAE,SAAS;E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A;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAnB,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAmB,CAAA;;AAAnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA,EAD/B,MAAA,WAAA,CAAA;;ACFD,MAAa,oBAAoB,IAAI,eAAiC,mBAAmB;AAEzF,MAAa,0BAA+C;CAC1D,OAAO,yBAAyB,CAAC,gBAAgB,mBAAmB,GAAG;EAAE,SAAS;EAAmB,aAAa;CAAK,CAAE,CAAC;AAC5H;ACFA,MAAa,gBAA6B,UAA+B,YAAiD;CACxH,MAAM,QAAQ,OAAO,KAAK;CAC1B,OAAO,eAAe,SAAS,MAAM,MAAK,CAAE,GAAG,OAAO;AACxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngssm-store",
3
- "version": "22.2.0",
3
+ "version": "22.2.2",
4
4
  "description": "NgSsm - Simple state management implementation.",
5
5
  "author": "Lion Marc",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { EnvironmentProviders, InjectionToken, OnDestroy, Signal, Type } from "@angular/core";
2
+ import { CreateComputedOptions, EnvironmentProviders, InjectionToken, OnDestroy, Signal, Type } from "@angular/core";
3
3
  import { Observable } from "rxjs";
4
4
  export interface FeatureStateSpecification {
5
5
  readonly featureStateKey: string;
@@ -140,7 +140,7 @@ export interface Effect {
140
140
  export declare const NGSSM_EFFECT: InjectionToken<Effect>;
141
141
  export declare const provideEffect: (effect: Type<unknown>) => EnvironmentProviders;
142
142
  export declare const provideEffects: (...effects: Type<unknown>[]) => EnvironmentProviders;
143
- export declare const provideEffectFunc: (actionType: string, effectFunc: EffectFunc) => EnvironmentProviders;
143
+ export declare const provideEffectFunc: <TActionType extends Action = Action>(actionType: string, effectFunc: EffectFunc<TActionType>) => EnvironmentProviders;
144
144
  export interface StateInitializer {
145
145
  initializeState(state: State): State;
146
146
  }
@@ -193,4 +193,9 @@ export declare class NgssmUnregisterFeatureStateAction implements Action {
193
193
  }
194
194
  export declare const ACTION_DISPATCHER: InjectionToken<ActionDispatcher>;
195
195
  export declare const provideNgssmStore: () => EnvironmentProviders;
196
- export declare const createSignal: <T = unknown>(selector: (state: State) => T) => Signal<T>;
196
+ /**
197
+ * Creates a computed signal from the store state using the provided selector.
198
+ * @param selector Selects a value from the current store state.
199
+ * @param options Options passed to Angular's computed signal.
200
+ */
201
+ export declare const createSignal: <T = unknown>(selector: (state: State) => T, options?: CreateComputedOptions<T>) => Signal<T>;