ngssm-store 20.3.10 → 21.0.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.
@@ -95,10 +95,10 @@ class NgssmCachedItemSetter {
95
95
  }
96
96
  return this;
97
97
  }
98
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmCachedItemSetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
99
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmCachedItemSetter }); }
98
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmCachedItemSetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
99
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmCachedItemSetter }); }
100
100
  }
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmCachedItemSetter, decorators: [{
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmCachedItemSetter, decorators: [{
102
102
  type: Injectable
103
103
  }] });
104
104
  const ngssmCachedItemSetter = () => TestBed.inject(NgssmCachedItemSetter);
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store-caching-testing.mjs","sources":["../../../projects/ngssm-store/caching/testing/src/ngssm-cached-item-setter.ts","../../../projects/ngssm-store/caching/testing/src/provide-ngssm-caching-testing.ts","../../../projects/ngssm-store/caching/testing/ngssm-store-caching-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\n\nimport { Store } from 'ngssm-store';\nimport { CachedItemStatus, selectNgssmCachedItem, SetCachedItemAction, updateNgssmCachingState } from 'ngssm-store/caching';\nimport { StoreMock } from 'ngssm-store/testing';\n\n/**\n * Utility service for setting and updating cached items in the StoreMock during tests.\n * Provides methods to apply a SetCachedItemAction, set the status, or set the value of a cached item.\n */\n@Injectable()\nexport class NgssmCachedItemSetter {\n public readonly store = inject(Store) as unknown as StoreMock;\n\n /**\n * Applies a SetCachedItemAction to the StoreMock, updating the cache state.\n * @param action The SetCachedItemAction to apply.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public apply<T = unknown>(action: SetCachedItemAction<T>): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [action.cachedItemKey]: {\n $set: {\n status: action.status,\n item: action.cachedItem,\n error: action.error\n }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the status of a cached item in the StoreMock.\n * If the key does not exist in cache, it is created with an undefined value.\n *\n * @param cachedItemKey The key of the cached item.\n * @param status The new status to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCachedItemStatus(cachedItemKey: string, status: CachedItemStatus): NgssmCachedItemSetter {\n if (selectNgssmCachedItem(this.store.stateValue, cachedItemKey)) {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n status: { $set: status }\n }\n }\n });\n } else {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n $set: {\n status\n }\n }\n }\n });\n }\n\n return this;\n }\n\n /**\n * Sets the value of a cached item in the StoreMock.\n * If the key does not exist in cache, it is created with the status CachedItemStatus.notSet.\n *\n * @param cachedItemKey The key of the cached item.\n * @param value The value to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCachedItemValue<T>(cachedItemKey: string, value?: T): NgssmCachedItemSetter {\n if (selectNgssmCachedItem(this.store.stateValue, cachedItemKey)) {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n item: { $set: value }\n }\n }\n });\n } else {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n $set: {\n status: CachedItemStatus.notSet,\n item: value\n }\n }\n }\n });\n }\n\n return this;\n }\n}\n\nexport const ngssmCachedItemSetter = () => TestBed.inject(NgssmCachedItemSetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { NgssmCachingStateSpecification } from 'ngssm-store/caching';\n\nimport { NgssmCachedItemSetter } from './ngssm-cached-item-setter';\n\n/**\n * App initializer that sets up the NgssmCaching state in the StoreMock for testing purposes.\n * Throws an error if StoreMock is not registered.\n */\nexport const ngssmCachingStateInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-caching-testing] Initialization of state');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmCachingStateSpecification.featureStateKey]: NgssmCachingStateSpecification.initialState\n };\n};\n\n/**\n * Provides environment providers for NgssmCaching testing, including the state initializer.\n */\nexport const provideNgssmCachingTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmCachingStateInitializer), NgssmCachedItemSetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAOA;;;AAGG;MAEU,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;AAEkB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAyB;AAuF9D,IAAA;AArFC;;;;AAIG;AACI,IAAA,KAAK,CAAc,MAA8B,EAAA;AACtD,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACrE,YAAA,MAAM,EAAE;AACN,gBAAA,CAAC,MAAM,CAAC,aAAa,GAAG;A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C,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACrE,gBAAA,MAAM,EAAE;oBACN,CAAC,aAAa,GAAG;AACf,wBAAA,IAAI,EAAE;4BACJ,MAAM,EAAE,gBAAgB,CAAC,MAAM;AAC/B,4BAAA,IAAI,EAAE;AACP;AACF;AACF;AACF,aAAA,CAAC;QACJ;AAEA,QAAA,OAAO,IAAI;IACb;+GAvFW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;mHAArB,qBAAqB,EAAA,CAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC;;AA2FM,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,qBAAqB;;AC9F/E;;;AAGG;AACI,MAAM,4BAA4B,GAAG,MAAK;AAC/C,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,CAAC,WAAW,CAAC,iDAAiD,CAAC;AACrE,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,IAAI,EAAE,KAAK,YAAY,SAAS,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;IACjD;IAEA,KAAK,CAAC,UAAU,GAAG;QACjB,GAAG,KAAK,CAAC,UAAU;AACnB,QAAA,CAAC,8BAA8B,CAAC,eAAe,GAAG,8BAA8B,CAAC;KAClF;AACH;AAEA;;AAEG;AACI,MAAM,0BAA0B,GAAG,MAA2B;IACnE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,4BAA4B,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAC/G;;AC/BA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store-caching-testing.mjs","sources":["../../../projects/ngssm-store/caching/testing/src/ngssm-cached-item-setter.ts","../../../projects/ngssm-store/caching/testing/src/provide-ngssm-caching-testing.ts","../../../projects/ngssm-store/caching/testing/ngssm-store-caching-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\n\nimport { Store } from 'ngssm-store';\nimport { CachedItemStatus, selectNgssmCachedItem, SetCachedItemAction, updateNgssmCachingState } from 'ngssm-store/caching';\nimport { StoreMock } from 'ngssm-store/testing';\n\n/**\n * Utility service for setting and updating cached items in the StoreMock during tests.\n * Provides methods to apply a SetCachedItemAction, set the status, or set the value of a cached item.\n */\n@Injectable()\nexport class NgssmCachedItemSetter {\n public readonly store = inject(Store) as unknown as StoreMock;\n\n /**\n * Applies a SetCachedItemAction to the StoreMock, updating the cache state.\n * @param action The SetCachedItemAction to apply.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public apply<T = unknown>(action: SetCachedItemAction<T>): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [action.cachedItemKey]: {\n $set: {\n status: action.status,\n item: action.cachedItem,\n error: action.error\n }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the status of a cached item in the StoreMock.\n * If the key does not exist in cache, it is created with an undefined value.\n *\n * @param cachedItemKey The key of the cached item.\n * @param status The new status to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCachedItemStatus(cachedItemKey: string, status: CachedItemStatus): NgssmCachedItemSetter {\n if (selectNgssmCachedItem(this.store.stateValue, cachedItemKey)) {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n status: { $set: status }\n }\n }\n });\n } else {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n $set: {\n status\n }\n }\n }\n });\n }\n\n return this;\n }\n\n /**\n * Sets the value of a cached item in the StoreMock.\n * If the key does not exist in cache, it is created with the status CachedItemStatus.notSet.\n *\n * @param cachedItemKey The key of the cached item.\n * @param value The value to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCachedItemValue<T>(cachedItemKey: string, value?: T): NgssmCachedItemSetter {\n if (selectNgssmCachedItem(this.store.stateValue, cachedItemKey)) {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n item: { $set: value }\n }\n }\n });\n } else {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cachedItemKey]: {\n $set: {\n status: CachedItemStatus.notSet,\n item: value\n }\n }\n }\n });\n }\n\n return this;\n }\n}\n\nexport const ngssmCachedItemSetter = () => TestBed.inject(NgssmCachedItemSetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { NgssmCachingStateSpecification } from 'ngssm-store/caching';\n\nimport { NgssmCachedItemSetter } from './ngssm-cached-item-setter';\n\n/**\n * App initializer that sets up the NgssmCaching state in the StoreMock for testing purposes.\n * Throws an error if StoreMock is not registered.\n */\nexport const ngssmCachingStateInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-caching-testing] Initialization of state');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmCachingStateSpecification.featureStateKey]: NgssmCachingStateSpecification.initialState\n };\n};\n\n/**\n * Provides environment providers for NgssmCaching testing, including the state initializer.\n */\nexport const provideNgssmCachingTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmCachingStateInitializer), NgssmCachedItemSetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAOA;;;AAGG;MAEU,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;AAEkB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAA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G;AACI,MAAM,0BAA0B,GAAG,MAA2B;IACnE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,4BAA4B,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAC/G;;AC/BA;;AAEG;;;;"}
@@ -100,10 +100,10 @@ class CachedItemReducer {
100
100
  }
101
101
  return state;
102
102
  }
103
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CachedItemReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
104
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CachedItemReducer }); }
103
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CachedItemReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
104
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CachedItemReducer }); }
105
105
  }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CachedItemReducer, decorators: [{
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: CachedItemReducer, decorators: [{
107
107
  type: Injectable
108
108
  }] });
109
109
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store-caching.mjs","sources":["../../../projects/ngssm-store/caching/src/actions/ngssm-caching-action-type.ts","../../../projects/ngssm-store/caching/src/model/cached-item-status.ts","../../../projects/ngssm-store/caching/src/actions/set-cached-item.action.ts","../../../projects/ngssm-store/caching/src/actions/unset-cached-item.action.ts","../../../projects/ngssm-store/caching/src/state/ngssm-caching.state.ts","../../../projects/ngssm-store/caching/src/state/selectors.ts","../../../projects/ngssm-store/caching/src/reducers/cached-item.reducer.ts","../../../projects/ngssm-store/caching/src/provide-ngssm-caching.ts","../../../projects/ngssm-store/caching/ngssm-store-caching.ts"],"sourcesContent":["export enum NgssmCachingActionType {\n setCachedItem = '[NgssmCachingActionType] setCachedItem',\n unsetCachedItem = '[NgssmCachingActionType] unsetCachedItem'\n}\n","export enum CachedItemStatus {\n notSet = 'Not Set',\n loading = 'Loading',\n set = 'Set',\n error = 'Error'\n}\n","import { Action } from 'ngssm-store';\n\nimport { NgssmCachingActionType } from './ngssm-caching-action-type';\nimport { CachedItemStatus } from '../model';\n\n/**\n * Represents an action to set a cached item in the state. If key is already set in the state, the value is replaced by the new one.\n *\n * @template TData The type of the cached item's data.\n * @implements {Action}\n *\n * @property {string} cachedItemKey - The unique key identifying the cached item.\n * @property {TData} cachedItem - The data to be cached.\n * @property {CachedItemStatus} [status=CachedItemStatus.set] - The status of the cached item operation.\n * @property {string} [error] - An optional error message if the caching operation failed.\n *\n * @remarks\n * This action is dispatched to update the cache with a new or modified item, along with its status and any error information.\n */\nexport class SetCachedItemAction<TData = unknown> implements Action {\n public readonly type: string = NgssmCachingActionType.setCachedItem;\n\n constructor(\n public readonly cachedItemKey: string,\n public readonly cachedItem: TData,\n public readonly status = CachedItemStatus.set,\n public readonly error?: string\n ) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmCachingActionType } from './ngssm-caching-action-type';\n\nexport class UnsetCachedItemAction implements Action {\n public readonly type: string = NgssmCachingActionType.unsetCachedItem;\n\n constructor(public readonly cachedItemKey: string) {}\n}\n","import update, { CustomCommands, Spec } from 'immutability-helper';\n\nimport { NgSsmFeatureState, State } from 'ngssm-store';\nimport { CachedItem } from '../model';\n\nexport const selectNgssmCachingState = (state: State): NgssmCachingState =>\n state[NgssmCachingStateSpecification.featureStateKey] as NgssmCachingState;\n\nexport const updateNgssmCachingState = <T extends CustomCommands<object> = never>(\n state: State,\n command: Spec<NgssmCachingState, T>\n): State =>\n update(state, {\n [NgssmCachingStateSpecification.featureStateKey]: command\n });\n\nexport interface NgssmCachingState {\n caches: Record<string, CachedItem>;\n}\n\n@NgSsmFeatureState({\n featureStateKey: NgssmCachingStateSpecification.featureStateKey,\n initialState: NgssmCachingStateSpecification.initialState\n})\nexport class NgssmCachingStateSpecification {\n public static readonly featureStateKey = 'ngssm-caching-state';\n public static readonly initialState: NgssmCachingState = {\n caches: {}\n };\n}\n","import { State } from 'ngssm-store';\nimport { CachedItem } from '../model';\nimport { selectNgssmCachingState } from './ngssm-caching.state';\n\nexport const selectNgssmCachedItem = <T = unknown>(state: State, key: string): CachedItem<T> | undefined =>\n selectNgssmCachingState(state).caches[key] as CachedItem<T>;\n","import { Injectable } from '@angular/core';\n\nimport { Reducer, State, Action } from 'ngssm-store';\n\nimport { NgssmCachingActionType, SetCachedItemAction, UnsetCachedItemAction } from '../actions';\nimport { selectNgssmCachedItem, updateNgssmCachingState } from '../state';\n\n@Injectable()\nexport class CachedItemReducer implements Reducer {\n public readonly processedActions: string[] = [NgssmCachingActionType.setCachedItem, NgssmCachingActionType.unsetCachedItem];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmCachingActionType.setCachedItem: {\n const setCachedItemAction = action as SetCachedItemAction;\n\n return updateNgssmCachingState(state, {\n caches: {\n [setCachedItemAction.cachedItemKey]: {\n $set: {\n status: setCachedItemAction.status,\n error: setCachedItemAction.error,\n item: setCachedItemAction.cachedItem\n }\n }\n }\n });\n }\n\n case NgssmCachingActionType.unsetCachedItem: {\n const unsetCachedItemAction = action as UnsetCachedItemAction;\n if (selectNgssmCachedItem(state, unsetCachedItemAction.cachedItemKey) === undefined) {\n return state;\n }\n\n return updateNgssmCachingState(state, {\n caches: { $unset: [unsetCachedItemAction.cachedItemKey] }\n });\n }\n }\n\n return state;\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { provideReducers } from 'ngssm-store';\nimport { CachedItemReducer } from './reducers';\n\nexport const provideNgssmCaching = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(CachedItemReducer)]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */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CAAC,KAAK,EAAE,qBAAqB,CAAC,aAAa,CAAC,KAAK,SAAS,EAAE;AACnF,oBAAA,OAAO,KAAK;gBACd;gBAEA,OAAO,uBAAuB,CAAC,KAAK,EAAE;oBACpC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC;AACxD,iBAAA,CAAC;YACJ;;AAGF,QAAA,OAAO,KAAK;IACd;+GAlCW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;mHAAjB,iBAAiB,EAAA,CAAA,CAAA;;4FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAD7B;;;ACHM,MAAM,mBAAmB,GAAG,MAA2B;IAC5D,OAAO,wBAAwB,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACvE;;ACNA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store-caching.mjs","sources":["../../../projects/ngssm-store/caching/src/actions/ngssm-caching-action-type.ts","../../../projects/ngssm-store/caching/src/model/cached-item-status.ts","../../../projects/ngssm-store/caching/src/actions/set-cached-item.action.ts","../../../projects/ngssm-store/caching/src/actions/unset-cached-item.action.ts","../../../projects/ngssm-store/caching/src/state/ngssm-caching.state.ts","../../../projects/ngssm-store/caching/src/state/selectors.ts","../../../projects/ngssm-store/caching/src/reducers/cached-item.reducer.ts","../../../projects/ngssm-store/caching/src/provide-ngssm-caching.ts","../../../projects/ngssm-store/caching/ngssm-store-caching.ts"],"sourcesContent":["export enum NgssmCachingActionType {\n setCachedItem = '[NgssmCachingActionType] setCachedItem',\n unsetCachedItem = '[NgssmCachingActionType] unsetCachedItem'\n}\n","export enum CachedItemStatus {\n notSet = 'Not Set',\n loading = 'Loading',\n set = 'Set',\n error = 'Error'\n}\n","import { Action } from 'ngssm-store';\n\nimport { NgssmCachingActionType } from './ngssm-caching-action-type';\nimport { CachedItemStatus } from '../model';\n\n/**\n * Represents an action to set a cached item in the state. If key is already set in the state, the value is replaced by the new one.\n *\n * @template TData The type of the cached item's data.\n * @implements {Action}\n *\n * @property {string} cachedItemKey - The unique key identifying the cached item.\n * @property {TData} cachedItem - The data to be cached.\n * @property {CachedItemStatus} [status=CachedItemStatus.set] - The status of the cached item operation.\n * @property {string} [error] - An optional error message if the caching operation failed.\n *\n * @remarks\n * This action is dispatched to update the cache with a new or modified item, along with its status and any error information.\n */\nexport class SetCachedItemAction<TData = unknown> implements Action {\n public readonly type: string = NgssmCachingActionType.setCachedItem;\n\n constructor(\n public readonly cachedItemKey: string,\n public readonly cachedItem: TData,\n public readonly status = CachedItemStatus.set,\n public readonly error?: string\n ) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmCachingActionType } from './ngssm-caching-action-type';\n\nexport class UnsetCachedItemAction implements Action {\n public readonly type: string = NgssmCachingActionType.unsetCachedItem;\n\n constructor(public readonly cachedItemKey: string) {}\n}\n","import update, { CustomCommands, Spec } from 'immutability-helper';\n\nimport { NgSsmFeatureState, State } from 'ngssm-store';\nimport { CachedItem } from '../model';\n\nexport const selectNgssmCachingState = (state: State): NgssmCachingState =>\n state[NgssmCachingStateSpecification.featureStateKey] as NgssmCachingState;\n\nexport const updateNgssmCachingState = <T extends CustomCommands<object> = never>(\n state: State,\n command: Spec<NgssmCachingState, T>\n): State =>\n update(state, {\n [NgssmCachingStateSpecification.featureStateKey]: command\n });\n\nexport interface NgssmCachingState {\n caches: Record<string, CachedItem>;\n}\n\n@NgSsmFeatureState({\n featureStateKey: NgssmCachingStateSpecification.featureStateKey,\n initialState: NgssmCachingStateSpecification.initialState\n})\nexport class NgssmCachingStateSpecification {\n public static readonly featureStateKey = 'ngssm-caching-state';\n public static readonly initialState: NgssmCachingState = {\n caches: {}\n };\n}\n","import { State } from 'ngssm-store';\nimport { CachedItem } from '../model';\nimport { selectNgssmCachingState } from './ngssm-caching.state';\n\nexport const selectNgssmCachedItem = <T = unknown>(state: State, key: string): CachedItem<T> | undefined =>\n selectNgssmCachingState(state).caches[key] as CachedItem<T>;\n","import { Injectable } from '@angular/core';\n\nimport { Reducer, State, Action } from 'ngssm-store';\n\nimport { NgssmCachingActionType, SetCachedItemAction, UnsetCachedItemAction } from '../actions';\nimport { selectNgssmCachedItem, updateNgssmCachingState } from '../state';\n\n@Injectable()\nexport class CachedItemReducer implements Reducer {\n public readonly processedActions: string[] = [NgssmCachingActionType.setCachedItem, NgssmCachingActionType.unsetCachedItem];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmCachingActionType.setCachedItem: {\n const setCachedItemAction = action as SetCachedItemAction;\n\n return updateNgssmCachingState(state, {\n caches: {\n [setCachedItemAction.cachedItemKey]: {\n $set: {\n status: setCachedItemAction.status,\n error: setCachedItemAction.error,\n item: setCachedItemAction.cachedItem\n }\n }\n }\n });\n }\n\n case NgssmCachingActionType.unsetCachedItem: {\n const unsetCachedItemAction = action as UnsetCachedItemAction;\n if (selectNgssmCachedItem(state, unsetCachedItemAction.cachedItemKey) === undefined) {\n return state;\n }\n\n return updateNgssmCachingState(state, {\n caches: { $unset: [unsetCachedItemAction.cachedItemKey] }\n });\n }\n }\n\n return state;\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { provideReducers } from 'ngssm-store';\nimport { CachedItemReducer } from './reducers';\n\nexport const provideNgssmCaching = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(CachedItemReducer)]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;IAAY;AAAZ,CAAA,UAAY,sBAAsB,EAAA;AAChC,IAAA,sBAAA,CAAA,eAAA,CAAA,GAAA,wCAAwD;AACxD,IAAA,sBAAA,CAAA,iBAAA,CAAA,GAAA,0CAA4D;AAC9D,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,GAAA,EAAA,CAAA,CAAA;;ICAtB;AAAZ,CAAA,UAAY,g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,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAjB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAD7B;;;ACHM,MAAM,mBAAmB,GAAG,MAA2B;IAC5D,OAAO,wBAAwB,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACvE;;ACNA;;AAEG;;;;"}
@@ -4,21 +4,21 @@ import { Store } from 'ngssm-store';
4
4
 
5
5
  class StoreMock {
6
6
  constructor(initialState) {
7
+ this.logsEnabled = false;
8
+ this.processedAction = signal({ type: '' }, ...(ngDevMode ? [{ debugName: "processedAction" }] : []));
7
9
  this._stateValue = {};
8
10
  this.state$ = new BehaviorSubject(this._stateValue);
9
11
  this.state = signal(this._stateValue, ...(ngDevMode ? [{ debugName: "state" }] : []));
10
- this.logsEnabled = false;
11
- this.processedAction = signal({ type: '' }, ...(ngDevMode ? [{ debugName: "processedAction" }] : []));
12
12
  this.stateValue = initialState;
13
13
  }
14
+ get stateValue() {
15
+ return this._stateValue;
16
+ }
14
17
  set stateValue(value) {
15
18
  this._stateValue = value;
16
19
  this.state$.next(value);
17
20
  this.state.set(value);
18
21
  }
19
- get stateValue() {
20
- return this._stateValue;
21
- }
22
22
  dispatchAction(action) {
23
23
  if (this.logsEnabled) {
24
24
  console.log('[StoreMock - dispatchAction]', action);
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store-testing.mjs","sources":["../../../projects/ngssm-store/testing/src/store-mock.ts","../../../projects/ngssm-store/testing/src/provide-ngssm-store-testing.ts","../../../projects/ngssm-store/testing/ngssm-store-testing.ts"],"sourcesContent":["import { signal } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { Action, ActionDispatcher, State } from 'ngssm-store';\n\nexport class StoreMock implements ActionDispatcher {\n private _stateValue: State = {};\n public state$ = new BehaviorSubject<State>(this._stateValue);\n public state = signal<State>(this._stateValue);\n public logsEnabled = false;\n public processedAction = signal<Action>({ type: '' });\n\n constructor(initialState: State) {\n this.stateValue = initialState;\n }\n\n public set stateValue(value: State) {\n this._stateValue = value;\n this.state$.next(value);\n this.state.set(value);\n }\n\n public get stateValue(): State {\n return this._stateValue;\n }\n\n public dispatchAction(action: Action): void {\n if (this.logsEnabled) {\n console.log('[StoreMock - dispatchAction]', action);\n }\n }\n\n public dispatchActionType(type: string): void {\n if (this.logsEnabled) {\n console.log('[StoreMock - dispatchActionType]', type);\n }\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { StoreMock } from './store-mock';\n\n/**\n * Provides a testing environment provider for the `Store` service using a mock implementation.\n *\n * This function returns Angular environment providers that replace the actual `Store` service\n * with a `StoreMock` instance, allowing for isolated and controlled testing of components or services\n * that depend on the `Store`.\n *\n * @param action Optional callback function that receives the mock `Store` instance. Can be used to configure\n * or manipulate the mock store before it is provided to the testing environment.\n * @returns The environment providers configured with the `StoreMock`.\n */\nexport const provideNgssmStoreTesting = (action?: (store: Store) => void): EnvironmentProviders => {\n const store = new StoreMock({});\n if (action) {\n action(store as unknown as Store);\n }\n return makeEnvironmentProviders([{ provide: Store, useValue: store }]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAKa,SAAS,CAAA;AAOpB,IAAA,WAAA,CAAY,YAAmB,EAAA;QANvB,IAAA,CAAA,WAAW,GAAU,EAAE;QACxB,IAAA,CAAA,MAAM,GAAG,IAAI,eAAe,CAAQ,IAAI,CAAC,WAAW,CAAC;AACrD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAQ,IAAI,CAAC,WAAW,iDAAC;QACvC,IAAA,CAAA,WAAW,GAAG,KAAK;QACnB,IAAA,CAAA,eAAe,GAAG,MAAM,CAAS,EAAE,IAAI,EAAE,EAAE,EAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;AAGnD,QAAA,IAAI,CAAC,UAAU,GAAG,YAAY;IAChC;IAEA,IAAW,UAAU,CAAC,KAAY,EAAA;AAChC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK;AACxB,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;IACvB;AAEA,IAAA,IAAW,UAAU,GAAA;QACnB,OAAO,IAAI,CAAC,WAAW;IACzB;AAEO,IAAA,cAAc,CAAC,MAAc,EAAA;AAClC,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,MAAM,CAAC;QACrD;IACF;AAEO,IAAA,kBAAkB,CAAC,IAAY,EAAA;AACpC,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,IAAI,CAAC;QACvD;IACF;AACD;;AC/BD;;;;;;;;;;AAUG;AACI,MAAM,wBAAwB,GAAG,CAAC,MAA+B,KAA0B;AAChG,IAAA,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,EAAE,CAAC;IAC/B,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,KAAyB,CAAC;IACnC;AACA,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AACxE;;ACvBA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store-testing.mjs","sources":["../../../projects/ngssm-store/testing/src/store-mock.ts","../../../projects/ngssm-store/testing/src/provide-ngssm-store-testing.ts","../../../projects/ngssm-store/testing/ngssm-store-testing.ts"],"sourcesContent":["import { WritableSignal, signal } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { Action, ActionDispatcher, State } from 'ngssm-store';\n\nexport class StoreMock implements ActionDispatcher {\n public readonly state$: BehaviorSubject<State>;\n public readonly state: WritableSignal<State>;\n public logsEnabled = false;\n public processedAction = signal<Action>({ type: '' });\n\n private _stateValue: State = {};\n\n constructor(initialState: State) {\n this.state$ = new BehaviorSubject<State>(this._stateValue);\n this.state = signal<State>(this._stateValue);\n this.stateValue = initialState;\n }\n\n public get stateValue(): State {\n return this._stateValue;\n }\n\n public set stateValue(value: State) {\n this._stateValue = value;\n this.state$.next(value);\n this.state.set(value);\n }\n\n public dispatchAction(action: Action): void {\n if (this.logsEnabled) {\n console.log('[StoreMock - dispatchAction]', action);\n }\n }\n\n public dispatchActionType(type: string): void {\n if (this.logsEnabled) {\n console.log('[StoreMock - dispatchActionType]', type);\n }\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { StoreMock } from './store-mock';\n\n/**\n * Provides a testing environment provider for the `Store` service using a mock implementation.\n *\n * This function returns Angular environment providers that replace the actual `Store` service\n * with a `StoreMock` instance, allowing for isolated and controlled testing of components or services\n * that depend on the `Store`.\n *\n * @param action Optional callback function that receives the mock `Store` instance. Can be used to configure\n * or manipulate the mock store before it is provided to the testing environment.\n * @returns The environment providers configured with the `StoreMock`.\n */\nexport const provideNgssmStoreTesting = (action?: (store: Store) => void): EnvironmentProviders => {\n const store = new StoreMock({});\n if (action) {\n action(store as unknown as Store);\n }\n return makeEnvironmentProviders([{ provide: Store, useValue: store }]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAKa,SAAS,CAAA;AAQpB,IAAA,WAAA,CAAY,YAAmB,EAAA;QALxB,IAAA,CAAA,WAAW,GAAG,KAAK;QACnB,IAAA,CAAA,eAAe,GAAG,MAAM,CAAS,EAAE,IAAI,EAAE,EAAE,EAAE,EAAA,IAAA,SAAA,GAA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AAE,KAAK,EAAE,CAAC,CAAC;AACxE;;ACvBA;;AAEG;;;;"}
@@ -11,8 +11,8 @@ import { TestBed } from '@angular/core/testing';
11
11
  */
12
12
  class NgssmVisibilitySetter {
13
13
  constructor() {
14
- this.reducer = new VisibilityReducer();
15
14
  this.store = inject(Store);
15
+ this.reducer = new VisibilityReducer();
16
16
  }
17
17
  /**
18
18
  * Sets the specified element as visible in the StoreMock.
@@ -41,10 +41,10 @@ class NgssmVisibilitySetter {
41
41
  this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ToggleElementVisibilityAction(elementKey));
42
42
  return this;
43
43
  }
44
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmVisibilitySetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
45
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmVisibilitySetter }); }
44
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmVisibilitySetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
45
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmVisibilitySetter }); }
46
46
  }
47
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgssmVisibilitySetter, decorators: [{
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmVisibilitySetter, decorators: [{
48
48
  type: Injectable
49
49
  }] });
50
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store-visibility-testing.mjs","sources":["../../../projects/ngssm-store/visibility/testing/src/ngssm-visibility-setter.ts","../../../projects/ngssm-store/visibility/testing/src/provide-ngssm-visibility-testing.ts","../../../projects/ngssm-store/visibility/testing/ngssm-store-visibility-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\n\nimport { Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { HideElementAction, ShowElementAction, ToggleElementVisibilityAction, VisibilityReducer } from 'ngssm-store/visibility';\n\n/**\n * Utility service for manipulating element visibility state in the StoreMock during tests.\n * Provides methods to show, hide, or toggle the visibility of an element.\n */\n@Injectable()\nexport class NgssmVisibilitySetter {\n private readonly reducer = new VisibilityReducer();\n public readonly store = inject(Store) as unknown as StoreMock;\n\n /**\n * Sets the specified element as visible in the StoreMock.\n * @param elementKey The key of the element to show.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public showElement(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ShowElementAction(elementKey));\n return this;\n }\n\n /**\n * Sets the specified element as hidden in the StoreMock.\n * @param elementKey The key of the element to hide.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public hideElement(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new HideElementAction(elementKey));\n return this;\n }\n\n /**\n * Toggles the visibility of the specified element in the StoreMock.\n * @param elementKey The key of the element to toggle.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public toggleElementVisibility(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ToggleElementVisibilityAction(elementKey));\n return this;\n }\n}\n\n/**\n * Helper function to retrieve the NgssmVisibilitySetter instance from the TestBed.\n */\nexport const ngssmVisibilitySetter = () => TestBed.inject(NgssmVisibilitySetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { NgssmVisibilityStateSpecification } from 'ngssm-store/visibility';\n\nimport { NgssmVisibilitySetter } from './ngssm-visibility-setter';\n\n/**\n * App initializer that sets up the ngssm state visibility in the StoreMock for testing purposes.\n * Throws an error if StoreMock is not registered.\n */\nexport const ngssmVisibilityStateInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-visibility-testing] Initialization of state');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmVisibilityStateSpecification.featureStateKey]: NgssmVisibilityStateSpecification.initialState\n };\n};\n\n/**\n * Provides environment providers for ngssm visibility testing, including the state initializer.\n */\nexport const provideNgssmVisibilityTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmVisibilityStateInitializer), NgssmVisibilitySetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAOA;;;AAGG;MAEU,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,iBAAiB,EAAE;AAClC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAyB;AA+B9D,IAAA;AA7BC;;;;AAIG;AACI,IAAA,WAAW,CAAC,UAAkB,EAAA;QACnC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC1G,QAAA,OAAO,IAAI;IACb;AAEA;;;;AAIG;AACI,IAAA,WAAW,CAAC,UAAkB,EAAA;QACnC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC1G,QAAA,OAAO,IAAI;IACb;AAEA;;;;AAIG;AACI,IAAA,uBAAuB,CAAC,UAAkB,EAAA;QAC/C,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,6BAA6B,CAAC,UAAU,CAAC,CAAC;AACtH,QAAA,OAAO,IAAI;IACb;+GAhCW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;mHAArB,qBAAqB,EAAA,CAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC;;AAoCD;;AAEG;AACI,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,qBAAqB;;AC1C/E;;;AAGG;AACI,MAAM,+BAA+B,GAAG,MAAK;AAClD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,CAAC,WAAW,CAAC,oDAAoD,CAAC;AACxE,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,IAAI,EAAE,KAAK,YAAY,SAAS,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;IACjD;IAEA,KAAK,CAAC,UAAU,GAAG;QACjB,GAAG,KAAK,CAAC,UAAU;AACnB,QAAA,CAAC,iCAAiC,CAAC,eAAe,GAAG,iCAAiC,CAAC;KACxF;AACH;AAEA;;AAEG;AACI,MAAM,6BAA6B,GAAG,MAA2B;IACtE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,+BAA+B,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAClH;;AC/BA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store-visibility-testing.mjs","sources":["../../../projects/ngssm-store/visibility/testing/src/ngssm-visibility-setter.ts","../../../projects/ngssm-store/visibility/testing/src/provide-ngssm-visibility-testing.ts","../../../projects/ngssm-store/visibility/testing/ngssm-store-visibility-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\n\nimport { Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { HideElementAction, ShowElementAction, ToggleElementVisibilityAction, VisibilityReducer } from 'ngssm-store/visibility';\n\n/**\n * Utility service for manipulating element visibility state in the StoreMock during tests.\n * Provides methods to show, hide, or toggle the visibility of an element.\n */\n@Injectable()\nexport class NgssmVisibilitySetter {\n public readonly store = inject(Store) as unknown as StoreMock;\n\n private readonly reducer = new VisibilityReducer();\n\n /**\n * Sets the specified element as visible in the StoreMock.\n * @param elementKey The key of the element to show.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public showElement(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ShowElementAction(elementKey));\n return this;\n }\n\n /**\n * Sets the specified element as hidden in the StoreMock.\n * @param elementKey The key of the element to hide.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public hideElement(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new HideElementAction(elementKey));\n return this;\n }\n\n /**\n * Toggles the visibility of the specified element in the StoreMock.\n * @param elementKey The key of the element to toggle.\n * @returns The NgssmVisibilitySetter instance for chaining.\n */\n public toggleElementVisibility(elementKey: string): NgssmVisibilitySetter {\n this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ToggleElementVisibilityAction(elementKey));\n return this;\n }\n}\n\n/**\n * Helper function to retrieve the NgssmVisibilitySetter instance from the TestBed.\n */\nexport const ngssmVisibilitySetter = () => TestBed.inject(NgssmVisibilitySetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\nimport { NgssmVisibilityStateSpecification } from 'ngssm-store/visibility';\n\nimport { NgssmVisibilitySetter } from './ngssm-visibility-setter';\n\n/**\n * App initializer that sets up the ngssm state visibility in the StoreMock for testing purposes.\n * Throws an error if StoreMock is not registered.\n */\nexport const ngssmVisibilityStateInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-visibility-testing] Initialization of state');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmVisibilityStateSpecification.featureStateKey]: NgssmVisibilityStateSpecification.initialState\n };\n};\n\n/**\n * Provides environment providers for ngssm visibility testing, including the state initializer.\n */\nexport const provideNgssmVisibilityTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmVisibilityStateInitializer), NgssmVisibilitySetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAOA;;;AAGG;MAEU,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;AAEkB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAyB;AAE5C,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,iBAAiB,EAAE;AA+BnD,IAAA;AA7BC;;;;AAIG;AACI,IAAA,WAAW,CAAC,UAAkB,EAAA;QACnC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC1G,QAAA,OAAO,IAAI;IACb;AAEA;;;;AAIG;AACI,IAAA,WAAW,CAAC,UAAkB,EAAA;QACnC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC1G,QAAA,OAAO,IAAI;IACb;AAEA;;;;AAIG;AACI,IAAA,uBAAuB,CAAC,UAAkB,EAAA;QAC/C,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,6BAA6B,CAAC,UAAU,CAAC,CAAC;AACtH,QAAA,OAAO,IAAI;IACb;8GAjCW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAArB,qBAAqB,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC;;AAqCD;;AAEG;AACI,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,qBAAqB;;AC3C/E;;;AAGG;AACI,MAAM,+BAA+B,GAAG,MAAK;AAClD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,CAAC,WAAW,CAAC,oDAAoD,CAAC;AACxE,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,IAAI,EAAE,KAAK,YAAY,SAAS,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;IACjD;IAEA,KAAK,CAAC,UAAU,GAAG;QACjB,GAAG,KAAK,CAAC,UAAU;AACnB,QAAA,CAAC,iCAAiC,CAAC,eAAe,GAAG,iCAAiC,CAAC;KACxF;AACH;AAEA;;AAEG;AACI,MAAM,6BAA6B,GAAG,MAA2B;IACtE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,+BAA+B,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAClH;;AC/BA;;AAEG;;;;"}
@@ -1,11 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, makeEnvironmentProviders, inject, HostListener, Input, Directive, Pipe, input, booleanAttribute, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { Injectable, makeEnvironmentProviders, Pipe, input, inject, Directive, booleanAttribute, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { NgSsmFeatureState, provideReducers, Store, createSignal } from 'ngssm-store';
4
4
  import { __decorate } from 'tslib';
5
5
  import update from 'immutability-helper';
6
- import { CommonModule } from '@angular/common';
7
- import * as i1 from '@angular/material/button-toggle';
8
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
6
+ import { MatButtonToggleGroup, MatButtonToggle } from '@angular/material/button-toggle';
9
7
 
10
8
  var NgssmVisibilityActionType;
11
9
  (function (NgssmVisibilityActionType) {
@@ -133,10 +131,10 @@ class VisibilityReducer {
133
131
  elements: elementsCommand
134
132
  });
135
133
  }
136
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: VisibilityReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
137
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: VisibilityReducer }); }
134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: VisibilityReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
135
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: VisibilityReducer }); }
138
136
  }
139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: VisibilityReducer, decorators: [{
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: VisibilityReducer, decorators: [{
140
138
  type: Injectable
141
139
  }] });
142
140
 
@@ -144,116 +142,104 @@ const provideNgssmVisibility = () => {
144
142
  return makeEnvironmentProviders([provideReducers(VisibilityReducer)]);
145
143
  };
146
144
 
147
- class ToggleElementVisibilityDirective {
148
- constructor() {
149
- this.store = inject(Store);
150
- this.key = '';
151
- }
152
- toggleElementvisibility() {
153
- const elementKey = this.key;
154
- if (elementKey) {
155
- this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));
156
- }
157
- }
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ToggleElementVisibilityDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
159
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: ToggleElementVisibilityDirective, isStandalone: true, selector: "[toggleElementVisibility]", inputs: { key: ["toggleElementVisibility", "key"] }, host: { listeners: { "click": "toggleElementvisibility($event)" } }, ngImport: i0 }); }
160
- }
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ToggleElementVisibilityDirective, decorators: [{
162
- type: Directive,
163
- args: [{
164
- // eslint-disable-next-line @angular-eslint/directive-selector
165
- selector: '[toggleElementVisibility]'
166
- }]
167
- }], propDecorators: { key: [{
168
- type: Input,
169
- args: ['toggleElementVisibility']
170
- }], toggleElementvisibility: [{
171
- type: HostListener,
172
- args: ['click', ['$event']]
173
- }] } });
174
-
175
- class IsElementVisiblePipe {
145
+ class NgssmIsElementVisiblePipe {
176
146
  transform(value, ...args) {
177
147
  return selectNgssmVisibilityState(value).elements[args[0]] === true;
178
148
  }
179
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: IsElementVisiblePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
180
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: IsElementVisiblePipe, isStandalone: true, name: "isElementVisible" }); }
149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmIsElementVisiblePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
150
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: NgssmIsElementVisiblePipe, isStandalone: true, name: "ngssmIsElementVisible" }); }
181
151
  }
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: IsElementVisiblePipe, decorators: [{
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmIsElementVisiblePipe, decorators: [{
183
153
  type: Pipe,
184
154
  args: [{
185
- name: 'isElementVisible'
155
+ name: 'ngssmIsElementVisible'
186
156
  }]
187
157
  }] });
188
158
 
189
- class ShowElementDirective {
159
+ class NgssmShowElement {
190
160
  constructor() {
161
+ this.ngssmShowElement = input(undefined, ...(ngDevMode ? [{ debugName: "ngssmShowElement" }] : []));
191
162
  this.store = inject(Store);
192
- this.key = '';
193
163
  }
194
- toggleElementvisibility() {
195
- const elementKey = this.key;
164
+ showElement() {
165
+ const elementKey = this.ngssmShowElement();
196
166
  if (elementKey) {
197
167
  this.store.dispatchAction(new ShowElementAction(elementKey));
198
168
  }
199
169
  }
200
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ShowElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
201
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: ShowElementDirective, isStandalone: true, selector: "[showElement]", inputs: { key: ["showElement", "key"] }, host: { listeners: { "click": "toggleElementvisibility($event)" } }, ngImport: i0 }); }
170
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmShowElement, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
171
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: NgssmShowElement, isStandalone: true, selector: "[ngssmShowElement]", inputs: { ngssmShowElement: { classPropertyName: "ngssmShowElement", publicName: "ngssmShowElement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "showElement()" } }, ngImport: i0 }); }
202
172
  }
203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ShowElementDirective, decorators: [{
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmShowElement, decorators: [{
204
174
  type: Directive,
205
175
  args: [{
206
- // eslint-disable-next-line @angular-eslint/directive-selector
207
- selector: '[showElement]'
176
+ selector: '[ngssmShowElement]',
177
+ host: {
178
+ '(click)': 'showElement()'
179
+ }
208
180
  }]
209
- }], propDecorators: { key: [{
210
- type: Input,
211
- args: ['showElement']
212
- }], toggleElementvisibility: [{
213
- type: HostListener,
214
- args: ['click', ['$event']]
215
- }] } });
181
+ }], propDecorators: { ngssmShowElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmShowElement", required: false }] }] } });
216
182
 
217
- class HideElementDirective {
183
+ class NgssmHideElement {
218
184
  constructor() {
185
+ this.ngssmHideElement = input(undefined, ...(ngDevMode ? [{ debugName: "ngssmHideElement" }] : []));
219
186
  this.store = inject(Store);
220
- this.key = '';
221
187
  }
222
- toggleElementvisibility() {
223
- const elementKey = this.key;
188
+ hideElement() {
189
+ const elementKey = this.ngssmHideElement();
224
190
  if (elementKey) {
225
191
  this.store.dispatchAction(new HideElementAction(elementKey));
226
192
  }
227
193
  }
228
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: HideElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
229
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: HideElementDirective, isStandalone: true, selector: "[hideElement]", inputs: { key: ["hideElement", "key"] }, host: { listeners: { "click": "toggleElementvisibility($event)" } }, ngImport: i0 }); }
194
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmHideElement, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
195
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: NgssmHideElement, isStandalone: true, selector: "[ngssmHideElement]", inputs: { ngssmHideElement: { classPropertyName: "ngssmHideElement", publicName: "ngssmHideElement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "hideElement()" } }, ngImport: i0 }); }
230
196
  }
231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: HideElementDirective, decorators: [{
197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmHideElement, decorators: [{
232
198
  type: Directive,
233
199
  args: [{
234
- // eslint-disable-next-line @angular-eslint/directive-selector
235
- selector: '[hideElement]'
200
+ selector: '[ngssmHideElement]',
201
+ host: {
202
+ '(click)': 'hideElement()'
203
+ }
236
204
  }]
237
- }], propDecorators: { key: [{
238
- type: Input,
239
- args: ['hideElement']
240
- }], toggleElementvisibility: [{
241
- type: HostListener,
242
- args: ['click', ['$event']]
243
- }] } });
205
+ }], propDecorators: { ngssmHideElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmHideElement", required: false }] }] } });
244
206
 
245
- class VisibilityToggleGroupComponent {
207
+ class NgssmToggleElementVisibility {
246
208
  constructor() {
209
+ this.ngssmToggleElementVisibility = input(undefined, ...(ngDevMode ? [{ debugName: "ngssmToggleElementVisibility" }] : []));
247
210
  this.store = inject(Store);
211
+ }
212
+ toggleElementVisibility() {
213
+ const elementKey = this.ngssmToggleElementVisibility();
214
+ if (elementKey) {
215
+ this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));
216
+ }
217
+ }
218
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmToggleElementVisibility, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
219
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: NgssmToggleElementVisibility, isStandalone: true, selector: "[ngssmToggleElementVisibility]", inputs: { ngssmToggleElementVisibility: { classPropertyName: "ngssmToggleElementVisibility", publicName: "ngssmToggleElementVisibility", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggleElementVisibility()" } }, ngImport: i0 }); }
220
+ }
221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmToggleElementVisibility, decorators: [{
222
+ type: Directive,
223
+ args: [{
224
+ selector: '[ngssmToggleElementVisibility]',
225
+ host: {
226
+ '(click)': 'toggleElementVisibility()'
227
+ }
228
+ }]
229
+ }], propDecorators: { ngssmToggleElementVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmToggleElementVisibility", required: false }] }] } });
230
+
231
+ class NgssmVisibilityToggleGroup {
232
+ constructor() {
248
233
  this.items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
249
234
  this.hideMultipleSelectionIndicator = input(false, ...(ngDevMode ? [{ debugName: "hideMultipleSelectionIndicator", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
235
+ this.store = inject(Store);
250
236
  }
251
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: VisibilityToggleGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
252
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: VisibilityToggleGroupComponent, isStandalone: true, selector: "ngssm-visibility-toggle-group", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideMultipleSelectionIndicator: { classPropertyName: "hideMultipleSelectionIndicator", publicName: "hideMultipleSelectionIndicator", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle [toggleElementVisibility]=\"item.key\" [checked]=\"store.state() | isElementVisible: item.key\" [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "directive", type: ToggleElementVisibilityDirective, selector: "[toggleElementVisibility]", inputs: ["toggleElementVisibility"] }, { kind: "pipe", type: IsElementVisiblePipe, name: "isElementVisible" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
237
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmVisibilityToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
238
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: NgssmVisibilityToggleGroup, isStandalone: true, selector: "ngssm-visibility-toggle-group", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideMultipleSelectionIndicator: { classPropertyName: "hideMultipleSelectionIndicator", publicName: "hideMultipleSelectionIndicator", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "directive", type: MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "directive", type: NgssmToggleElementVisibility, selector: "[ngssmToggleElementVisibility]", inputs: ["ngssmToggleElementVisibility"] }, { kind: "pipe", type: NgssmIsElementVisiblePipe, name: "ngssmIsElementVisible" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
253
239
  }
254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: VisibilityToggleGroupComponent, decorators: [{
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgssmVisibilityToggleGroup, decorators: [{
255
241
  type: Component,
256
- args: [{ selector: 'ngssm-visibility-toggle-group', imports: [CommonModule, MatButtonToggleModule, ToggleElementVisibilityDirective, IsElementVisiblePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle [toggleElementVisibility]=\"item.key\" [checked]=\"store.state() | isElementVisible: item.key\" [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n" }]
242
+ args: [{ selector: 'ngssm-visibility-toggle-group', imports: [MatButtonToggleGroup, MatButtonToggle, NgssmToggleElementVisibility, NgssmIsElementVisiblePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n" }]
257
243
  }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], hideMultipleSelectionIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideMultipleSelectionIndicator", required: false }] }] } });
258
244
 
259
245
  // Creates a signal allowing to listen to changes in element visibility.
@@ -266,5 +252,5 @@ const isElementVisible = (elementKey) => ({
266
252
  * Generated bundle index. Do not edit.
267
253
  */
268
254
 
269
- export { DefineElementsGroupAction, HideElementAction, HideElementDirective, IsElementVisiblePipe, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, ShowElementAction, ShowElementDirective, ToggleElementVisibilityAction, ToggleElementVisibilityDirective, VisibilityReducer, VisibilityToggleGroupComponent, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
255
+ export { DefineElementsGroupAction, HideElementAction, NgssmHideElement, NgssmIsElementVisiblePipe, NgssmShowElement, NgssmToggleElementVisibility, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, NgssmVisibilityToggleGroup, ShowElementAction, ToggleElementVisibilityAction, VisibilityReducer, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
270
256
  //# sourceMappingURL=ngssm-store-visibility.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store-visibility.mjs","sources":["../../../projects/ngssm-store/visibility/src/actions/ngssm-visibility-action-type.ts","../../../projects/ngssm-store/visibility/src/actions/toggle-element-visibility.action.ts","../../../projects/ngssm-store/visibility/src/actions/show-element.action.ts","../../../projects/ngssm-store/visibility/src/actions/hide-element.action.ts","../../../projects/ngssm-store/visibility/src/actions/define-elements-group.action.ts","../../../projects/ngssm-store/visibility/src/state/ngssm-visibility.state.ts","../../../projects/ngssm-store/visibility/src/reducers/visibility.reducer.ts","../../../projects/ngssm-store/visibility/src/provide-ngssm-visibility.ts","../../../projects/ngssm-store/visibility/src/components/toggle-element-visibility.directive.ts","../../../projects/ngssm-store/visibility/src/components/is-element-visible.pipe.ts","../../../projects/ngssm-store/visibility/src/components/show-element.directive.ts","../../../projects/ngssm-store/visibility/src/components/hide-element.directive.ts","../../../projects/ngssm-store/visibility/src/components/visibility-toggle-group/visibility-toggle-group.component.ts","../../../projects/ngssm-store/visibility/src/components/visibility-toggle-group/visibility-toggle-group.component.html","../../../projects/ngssm-store/visibility/src/signal-helpers.ts","../../../projects/ngssm-store/visibility/ngssm-store-visibility.ts"],"sourcesContent":["export enum NgssmVisibilityActionType {\n defineElementsGroup = '[NgssmVisibilityActionType] defineElementsGroup',\n toggleElementVisibility = '[NgssmVisibilityActionType] toggleElementVisibility',\n hideElement = '[NgssmVisibilityActionType] hideElement',\n showElement = '[NgssmVisibilityActionType] showElement'\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class ToggleElementVisibilityAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.toggleElementVisibility;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class ShowElementAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.showElement;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class HideElementAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.hideElement;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class DefineElementsGroupAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.defineElementsGroup;\n\n constructor(public readonly elementKeys: string[]) {}\n}\n","import update, { Spec } from 'immutability-helper';\n\nimport { NgSsmFeatureState, State } from 'ngssm-store';\n\nexport const selectNgssmVisibilityState = (state: State): NgssmVisibilityState =>\n state[NgssmVisibilityStateSpecification.featureStateKey] as NgssmVisibilityState;\n\nexport const updateNgssmVisibilityState = (state: State, command: Spec<NgssmVisibilityState, never>): State =>\n update(state, {\n [NgssmVisibilityStateSpecification.featureStateKey]: command\n });\n\nexport interface NgssmVisibilityState {\n elements: Record<string, boolean>;\n elementsGroups: string[][];\n}\n\n@NgSsmFeatureState({\n featureStateKey: NgssmVisibilityStateSpecification.featureStateKey,\n initialState: NgssmVisibilityStateSpecification.initialState\n})\nexport class NgssmVisibilityStateSpecification {\n public static readonly featureStateKey = 'ngssm-visibility-state';\n public static readonly initialState: NgssmVisibilityState = {\n elements: {},\n elementsGroups: []\n };\n}\n","import { Injectable } from '@angular/core';\n\nimport { Spec } from 'immutability-helper';\n\nimport { Reducer, State, Action } from 'ngssm-store';\n\nimport {\n DefineElementsGroupAction,\n HideElementAction,\n NgssmVisibilityActionType,\n ShowElementAction,\n ToggleElementVisibilityAction\n} from '../actions';\nimport { selectNgssmVisibilityState, updateNgssmVisibilityState } from '../state';\n\n@Injectable()\nexport class VisibilityReducer implements Reducer {\n public readonly processedActions: string[] = [\n NgssmVisibilityActionType.toggleElementVisibility,\n NgssmVisibilityActionType.showElement,\n NgssmVisibilityActionType.hideElement,\n NgssmVisibilityActionType.defineElementsGroup\n ];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmVisibilityActionType.toggleElementVisibility: {\n const toggleVisibilityAction = action as ToggleElementVisibilityAction;\n if (selectNgssmVisibilityState(state).elements[toggleVisibilityAction.elementKey] === true) {\n return updateNgssmVisibilityState(state, {\n elements: {\n [toggleVisibilityAction.elementKey]: { $set: false }\n }\n });\n }\n\n return this.setElementVisible(state, toggleVisibilityAction.elementKey);\n }\n\n case NgssmVisibilityActionType.showElement: {\n const showAction = action as ShowElementAction;\n return this.setElementVisible(state, showAction.elementKey);\n }\n\n case NgssmVisibilityActionType.hideElement: {\n const hideAction = action as HideElementAction;\n return updateNgssmVisibilityState(state, {\n elements: {\n [hideAction.elementKey]: { $set: false }\n }\n });\n }\n\n case NgssmVisibilityActionType.defineElementsGroup: {\n const defineElementsGroupAction = action as DefineElementsGroupAction;\n const keys = [...defineElementsGroupAction.elementKeys];\n keys.sort();\n if (this.groupExists(keys, selectNgssmVisibilityState(state).elementsGroups)) {\n break;\n }\n\n return updateNgssmVisibilityState(state, {\n elementsGroups: { $push: [keys] }\n });\n }\n }\n\n return state;\n }\n\n private groupExists(keys: string[], groups: string[][]): boolean {\n const index = groups.findIndex((group) => {\n return group.length === keys.length && group.findIndex((k, i) => k !== keys[i]) === -1;\n });\n return index !== -1;\n }\n\n private getElementsKeysGroupedWith(key: string, groups: string[][]): string[] {\n const keys = groups.filter((g) => g.includes(key)).flatMap((g) => g);\n const distinctKeys = new Set<string>(keys);\n distinctKeys.delete(key);\n return [...distinctKeys];\n }\n\n private setElementVisible(state: State, key: string): State {\n const elementsCommand: Spec<Record<string, boolean>, never> = {\n [key]: { $set: true }\n };\n\n const associatedElements = this.getElementsKeysGroupedWith(key, selectNgssmVisibilityState(state).elementsGroups);\n associatedElements.forEach((el) => {\n elementsCommand[el] = { $set: false };\n });\n\n return updateNgssmVisibilityState(state, {\n elements: elementsCommand\n });\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { provideReducers } from 'ngssm-store';\nimport { VisibilityReducer } from './reducers';\n\nexport const provideNgssmVisibility = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(VisibilityReducer)]);\n};\n","import { Directive, HostListener, inject, Input } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { ToggleElementVisibilityAction } from '../actions';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[toggleElementVisibility]'\n})\nexport class ToggleElementVisibilityDirective {\n private readonly store = inject(Store);\n\n @Input('toggleElementVisibility') public key: string | undefined | null = '';\n\n @HostListener('click', ['$event'])\n public toggleElementvisibility(): void {\n const elementKey = this.key;\n if (elementKey) {\n this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { State } from 'ngssm-store';\nimport { selectNgssmVisibilityState } from '../state';\n\n@Pipe({\n name: 'isElementVisible'\n})\nexport class IsElementVisiblePipe implements PipeTransform {\n public transform(value: State, ...args: string[]): boolean {\n return selectNgssmVisibilityState(value).elements[args[0]] === true;\n }\n}\n","import { Directive, HostListener, inject, Input } from '@angular/core';\nimport { Store } from 'ngssm-store';\nimport { ShowElementAction } from '../actions';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[showElement]'\n})\nexport class ShowElementDirective {\n private readonly store = inject(Store);\n\n @Input('showElement') public key: string | undefined | null = '';\n\n @HostListener('click', ['$event'])\n public toggleElementvisibility(): void {\n const elementKey = this.key;\n if (elementKey) {\n this.store.dispatchAction(new ShowElementAction(elementKey));\n }\n }\n}\n","import { Directive, HostListener, inject, Input } from '@angular/core';\nimport { Store } from 'ngssm-store';\nimport { HideElementAction } from '../actions';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[hideElement]'\n})\nexport class HideElementDirective {\n private readonly store = inject(Store);\n\n @Input('hideElement') public key: string | undefined | null = '';\n\n @HostListener('click', ['$event'])\n public toggleElementvisibility(): void {\n const elementKey = this.key;\n if (elementKey) {\n this.store.dispatchAction(new HideElementAction(elementKey));\n }\n }\n}\n","import { Component, ChangeDetectionStrategy, booleanAttribute, input, inject } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\n\nimport { Store } from 'ngssm-store';\n\nimport { ToggleElementVisibilityDirective } from '../toggle-element-visibility.directive';\nimport { IsElementVisiblePipe } from '../is-element-visible.pipe';\n\n@Component({\n selector: 'ngssm-visibility-toggle-group',\n imports: [CommonModule, MatButtonToggleModule, ToggleElementVisibilityDirective, IsElementVisiblePipe],\n templateUrl: './visibility-toggle-group.component.html',\n styleUrls: [],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class VisibilityToggleGroupComponent {\n public readonly store = inject(Store);\n\n public readonly items = input<{ label: string; key: string }[]>([]);\n public readonly hideMultipleSelectionIndicator = input<boolean, boolean>(false, { transform: booleanAttribute });\n}\n","<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle [toggleElementVisibility]=\"item.key\" [checked]=\"store.state() | isElementVisible: item.key\" [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n","import { Signal } from '@angular/core';\n\nimport { createSignal } from 'ngssm-store';\n\nimport { selectNgssmVisibilityState } from './state';\n\n/**\n * Represents the visibility state of a specific element.\n * - key: The unique identifier for the element.\n * - visible: A signal that emits the visibility status (true if visible, false otherwise).\n */\nexport interface ElementVisibility {\n key: string;\n visible: Signal<boolean>;\n}\n\n// Creates a signal allowing to listen to changes in element visibility.\nexport const isElementVisible = (elementKey: string): ElementVisibility => ({\n key: elementKey,\n visible: createSignal((state) => selectNgssmVisibilityState(state).elements[elementKey] === true)\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;IAAY;AAAZ,CAAA,UAAY,yBAAyB,EAAA;AACnC,IAAA,yBAAA,CAAA,qB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AAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,+BAA+B,EAAA,OAAA,EAChC,CAAC,YAAY,EAAE,qBAAqB,EAAE,gCAAgC,EAAE,oBAAoB,CAAC,EAAA,eAAA,EAGrF,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,iYAAA,EAAA;;;AEEjD;MACa,gBAAgB,GAAG,CAAC,UAAkB,MAAyB;AAC1E,IAAA,GAAG,EAAE,UAAU;AACf,IAAA,OAAO,EAAE,YAAY,CAAC,CAAC,KAAK,KAAK,0BAA0B,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI;AACjG,CAAA;;ACpBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store-visibility.mjs","sources":["../../../projects/ngssm-store/visibility/src/actions/ngssm-visibility-action-type.ts","../../../projects/ngssm-store/visibility/src/actions/toggle-element-visibility.action.ts","../../../projects/ngssm-store/visibility/src/actions/show-element.action.ts","../../../projects/ngssm-store/visibility/src/actions/hide-element.action.ts","../../../projects/ngssm-store/visibility/src/actions/define-elements-group.action.ts","../../../projects/ngssm-store/visibility/src/state/ngssm-visibility.state.ts","../../../projects/ngssm-store/visibility/src/reducers/visibility.reducer.ts","../../../projects/ngssm-store/visibility/src/provide-ngssm-visibility.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-is-element-visible.pipe.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-show-element.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-hide-element.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-toggle-element-visibility.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-visibility-toggle-group/ngssm-visibility-toggle-group.ts","../../../projects/ngssm-store/visibility/src/components/ngssm-visibility-toggle-group/ngssm-visibility-toggle-group.html","../../../projects/ngssm-store/visibility/src/signal-helpers.ts","../../../projects/ngssm-store/visibility/ngssm-store-visibility.ts"],"sourcesContent":["export enum NgssmVisibilityActionType {\n defineElementsGroup = '[NgssmVisibilityActionType] defineElementsGroup',\n toggleElementVisibility = '[NgssmVisibilityActionType] toggleElementVisibility',\n hideElement = '[NgssmVisibilityActionType] hideElement',\n showElement = '[NgssmVisibilityActionType] showElement'\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class ToggleElementVisibilityAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.toggleElementVisibility;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class ShowElementAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.showElement;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class HideElementAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.hideElement;\n\n constructor(public readonly elementKey: string) {}\n}\n","import { Action } from 'ngssm-store';\nimport { NgssmVisibilityActionType } from './ngssm-visibility-action-type';\n\nexport class DefineElementsGroupAction implements Action {\n public readonly type: string = NgssmVisibilityActionType.defineElementsGroup;\n\n constructor(public readonly elementKeys: string[]) {}\n}\n","import update, { Spec } from 'immutability-helper';\n\nimport { NgSsmFeatureState, State } from 'ngssm-store';\n\nexport const selectNgssmVisibilityState = (state: State): NgssmVisibilityState =>\n state[NgssmVisibilityStateSpecification.featureStateKey] as NgssmVisibilityState;\n\nexport const updateNgssmVisibilityState = (state: State, command: Spec<NgssmVisibilityState, never>): State =>\n update(state, {\n [NgssmVisibilityStateSpecification.featureStateKey]: command\n });\n\nexport interface NgssmVisibilityState {\n elements: Record<string, boolean>;\n elementsGroups: string[][];\n}\n\n@NgSsmFeatureState({\n featureStateKey: NgssmVisibilityStateSpecification.featureStateKey,\n initialState: NgssmVisibilityStateSpecification.initialState\n})\nexport class NgssmVisibilityStateSpecification {\n public static readonly featureStateKey = 'ngssm-visibility-state';\n public static readonly initialState: NgssmVisibilityState = {\n elements: {},\n elementsGroups: []\n };\n}\n","import { Injectable } from '@angular/core';\n\nimport { Spec } from 'immutability-helper';\n\nimport { Reducer, State, Action } from 'ngssm-store';\n\nimport {\n DefineElementsGroupAction,\n HideElementAction,\n NgssmVisibilityActionType,\n ShowElementAction,\n ToggleElementVisibilityAction\n} from '../actions';\nimport { selectNgssmVisibilityState, updateNgssmVisibilityState } from '../state';\n\n@Injectable()\nexport class VisibilityReducer implements Reducer {\n public readonly processedActions: string[] = [\n NgssmVisibilityActionType.toggleElementVisibility,\n NgssmVisibilityActionType.showElement,\n NgssmVisibilityActionType.hideElement,\n NgssmVisibilityActionType.defineElementsGroup\n ];\n\n public updateState(state: State, action: Action): State {\n switch (action.type) {\n case NgssmVisibilityActionType.toggleElementVisibility: {\n const toggleVisibilityAction = action as ToggleElementVisibilityAction;\n if (selectNgssmVisibilityState(state).elements[toggleVisibilityAction.elementKey] === true) {\n return updateNgssmVisibilityState(state, {\n elements: {\n [toggleVisibilityAction.elementKey]: { $set: false }\n }\n });\n }\n\n return this.setElementVisible(state, toggleVisibilityAction.elementKey);\n }\n\n case NgssmVisibilityActionType.showElement: {\n const showAction = action as ShowElementAction;\n return this.setElementVisible(state, showAction.elementKey);\n }\n\n case NgssmVisibilityActionType.hideElement: {\n const hideAction = action as HideElementAction;\n return updateNgssmVisibilityState(state, {\n elements: {\n [hideAction.elementKey]: { $set: false }\n }\n });\n }\n\n case NgssmVisibilityActionType.defineElementsGroup: {\n const defineElementsGroupAction = action as DefineElementsGroupAction;\n const keys = [...defineElementsGroupAction.elementKeys];\n keys.sort();\n if (this.groupExists(keys, selectNgssmVisibilityState(state).elementsGroups)) {\n break;\n }\n\n return updateNgssmVisibilityState(state, {\n elementsGroups: { $push: [keys] }\n });\n }\n }\n\n return state;\n }\n\n private groupExists(keys: string[], groups: string[][]): boolean {\n const index = groups.findIndex((group) => {\n return group.length === keys.length && group.findIndex((k, i) => k !== keys[i]) === -1;\n });\n return index !== -1;\n }\n\n private getElementsKeysGroupedWith(key: string, groups: string[][]): string[] {\n const keys = groups.filter((g) => g.includes(key)).flatMap((g) => g);\n const distinctKeys = new Set<string>(keys);\n distinctKeys.delete(key);\n return [...distinctKeys];\n }\n\n private setElementVisible(state: State, key: string): State {\n const elementsCommand: Spec<Record<string, boolean>, never> = {\n [key]: { $set: true }\n };\n\n const associatedElements = this.getElementsKeysGroupedWith(key, selectNgssmVisibilityState(state).elementsGroups);\n associatedElements.forEach((el) => {\n elementsCommand[el] = { $set: false };\n });\n\n return updateNgssmVisibilityState(state, {\n elements: elementsCommand\n });\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { provideReducers } from 'ngssm-store';\nimport { VisibilityReducer } from './reducers';\n\nexport const provideNgssmVisibility = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideReducers(VisibilityReducer)]);\n};\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { State } from 'ngssm-store';\nimport { selectNgssmVisibilityState } from '../state';\n\n@Pipe({\n name: 'ngssmIsElementVisible'\n})\nexport class NgssmIsElementVisiblePipe implements PipeTransform {\n public transform(value: State, ...args: string[]): boolean {\n return selectNgssmVisibilityState(value).elements[args[0]] === true;\n }\n}\n","import { Directive, inject, input } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { ShowElementAction } from '../actions';\n\n@Directive({\n selector: '[ngssmShowElement]',\n host: {\n '(click)': 'showElement()'\n }\n})\nexport class NgssmShowElement {\n public readonly ngssmShowElement = input<string | undefined | null>(undefined);\n\n private readonly store = inject(Store);\n\n public showElement(): void {\n const elementKey = this.ngssmShowElement();\n if (elementKey) {\n this.store.dispatchAction(new ShowElementAction(elementKey));\n }\n }\n}\n","import { Directive, inject, input } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { HideElementAction } from '../actions';\n\n@Directive({\n selector: '[ngssmHideElement]',\n host: {\n '(click)': 'hideElement()'\n }\n})\nexport class NgssmHideElement {\n public readonly ngssmHideElement = input<string | undefined | null>(undefined);\n\n private readonly store = inject(Store);\n\n public hideElement(): void {\n const elementKey = this.ngssmHideElement();\n if (elementKey) {\n this.store.dispatchAction(new HideElementAction(elementKey));\n }\n }\n}\n","import { Directive, inject, input } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\n\nimport { ToggleElementVisibilityAction } from '../actions';\n\n@Directive({\n selector: '[ngssmToggleElementVisibility]',\n host: {\n '(click)': 'toggleElementVisibility()'\n }\n})\nexport class NgssmToggleElementVisibility {\n public readonly ngssmToggleElementVisibility = input<string | undefined | null>(undefined);\n\n private readonly store = inject(Store);\n\n public toggleElementVisibility(): void {\n const elementKey = this.ngssmToggleElementVisibility();\n if (elementKey) {\n this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));\n }\n }\n}\n","import { Component, ChangeDetectionStrategy, booleanAttribute, input, inject } from '@angular/core';\nimport { MatButtonToggle, MatButtonToggleGroup } from '@angular/material/button-toggle';\n\nimport { Store } from 'ngssm-store';\n\nimport { NgssmIsElementVisiblePipe } from '../ngssm-is-element-visible.pipe';\nimport { NgssmToggleElementVisibility } from '../ngssm-toggle-element-visibility';\n\n@Component({\n selector: 'ngssm-visibility-toggle-group',\n imports: [MatButtonToggleGroup, MatButtonToggle, NgssmToggleElementVisibility, NgssmIsElementVisiblePipe],\n templateUrl: './ngssm-visibility-toggle-group.html',\n styleUrls: [],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NgssmVisibilityToggleGroup {\n public readonly items = input<{ label: string; key: string }[]>([]);\n public readonly hideMultipleSelectionIndicator = input<boolean, boolean>(false, { transform: booleanAttribute });\n\n protected readonly store = inject(Store);\n}\n","<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n","import { Signal } from '@angular/core';\n\nimport { createSignal } from 'ngssm-store';\n\nimport { selectNgssmVisibilityState } from './state';\n\n/**\n * Represents the visibility state of a specific element.\n * - key: The unique identifier for the element.\n * - visible: A signal that emits the visibility status (true if visible, false otherwise).\n */\nexport interface ElementVisibility {\n key: string;\n visible: Signal<boolean>;\n}\n\n// Creates a signal allowing to listen to changes in element visibility.\nexport const isElementVisible = (elementKey: string): ElementVisibility => ({\n key: elementKey,\n visible: createSignal((state) => selectNgssmVisibilityState(state).elements[elementKey] === true)\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,yBAAyB,EAAA;AACnC,IAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,iDAAuE;AACvE,IAAA,yBAAA,CAAA,yBAAA,CAAA,GAAA,qDAA+E;AAC/E,IAAA,yBAAA,CAAA,aAAA,CAAA,GAAA,yCAAuD;AACvD,IAAA,yBAAA,CAAA,aAAA,CAAA,GAAA,yCAAuD;AACzD,CAAC,EALW,yBAAyB,KAAzB,yBAAyB,GAAA,EAAA,CAAA,CAAA;;MCGxB,6BAA6B,CAAA;AAGxC,IAAA,WAAA,CAA4B,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;AAFtB,QAAA,IAAA,CAAA,IAAI,GAAW,yBAAyB,CAAC,uBAAuB;IAE/B;AAClD;;MCJY,iBAAiB,CAAA;AAG5B,IAAA,WAAA,CAA4B,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;AAFtB,QAAA,IAAA,CAAA,IAAI,GAAW,yBAAyB,CAAC,WAAW;IAEnB;AAClD;;MCJY,iBAAiB,CAAA;AAG5B,IAAA,WAAA,CAA4B,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;AAFtB,QAAA,IAAA,CAAA,IAA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AAA,eAAA,EAAA,YAAA,EAAA,SAAA,EAAA,UAAA,EAAA,qBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,4BAA4B,EAAA,QAAA,EAAA,gCAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAE,yBAAyB,EAAA,IAAA,EAAA,uBAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAK7F,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,+BAA+B,EAAA,OAAA,EAChC,CAAC,oBAAoB,EAAE,eAAe,EAAE,4BAA4B,EAAE,yBAAyB,CAAC,EAAA,eAAA,EAGxF,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,gaAAA,EAAA;;;AEGjD;MACa,gBAAgB,GAAG,CAAC,UAAkB,MAAyB;AAC1E,IAAA,GAAG,EAAE,UAAU;AACf,IAAA,OAAO,EAAE,YAAY,CAAC,CAAC,KAAK,KAAK,0BAA0B,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI;AACjG,CAAA;;ACpBD;;AAEG;;;;"}
@@ -67,10 +67,10 @@ class Logger {
67
67
  payload
68
68
  });
69
69
  }
70
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Logger, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
71
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Logger, providedIn: 'root' }); }
70
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Logger, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
71
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Logger, providedIn: 'root' }); }
72
72
  }
73
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Logger, decorators: [{
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Logger, decorators: [{
74
74
  type: Injectable,
75
75
  args: [{
76
76
  providedIn: 'root'
@@ -106,10 +106,10 @@ class ConsoleAppender {
106
106
  stop() {
107
107
  this.stopEvent$.next(true);
108
108
  }
109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ConsoleAppender, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
110
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ConsoleAppender, providedIn: 'root' }); }
109
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ConsoleAppender, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
110
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ConsoleAppender, providedIn: 'root' }); }
111
111
  }
112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ConsoleAppender, decorators: [{
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ConsoleAppender, decorators: [{
113
113
  type: Injectable,
114
114
  args: [{
115
115
  providedIn: 'root'
@@ -163,6 +163,10 @@ class Store {
163
163
  * Also sets up the initial state and registers reducers and effects.
164
164
  */
165
165
  constructor() {
166
+ // If true, an action is processed in a macro-task by using setTimoeout. Otherwise, Promise.resolve() is used
167
+ // When using micro task, an issue can occur with angular root effects that want to process state or action signals.
168
+ // They can be executed after a list of actions is processed. In that case, some actions are never processed by the effects.
169
+ this.useMacroTasks = true;
166
170
  // Logger service for debugging and monitoring.
167
171
  this.logger = inject(Logger);
168
172
  // Array of reducers to process state updates.
@@ -187,10 +191,6 @@ class Store {
187
191
  this._processedAction = signal({ type: '' }, ...(ngDevMode ? [{ debugName: "_processedAction" }] : []));
188
192
  // The most recently action processed by reducers, managed as an observable.
189
193
  this._processedAction$ = new BehaviorSubject({ type: '' });
190
- // If true, an action is processed in a macro-task by using setTimoeout. Otherwise, Promise.resolve() is used
191
- // When using micro task, an issue can occur with angular root effects that want to process state or action signals.
192
- // They can be executed after a list of actions is processed. In that case, some actions are never processed by the effects.
193
- this.useMacroTasks = true;
194
194
  // Synchronize the RxJS state with the Angular signal state.
195
195
  this._state$.subscribe((value) => this._stateSignal.set(value));
196
196
  this.logger.information('[Store] ---> state initialization...');
@@ -369,10 +369,10 @@ class Store {
369
369
  Promise.resolve().then(() => this.processNextAction());
370
370
  }
371
371
  }
372
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Store, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
373
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Store, providedIn: 'root' }); }
372
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Store, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
373
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Store, providedIn: 'root' }); }
374
374
  }
375
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: Store, decorators: [{
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: Store, decorators: [{
376
376
  type: Injectable,
377
377
  args: [{
378
378
  providedIn: 'root'
@@ -425,10 +425,10 @@ class ProvideNgssmFeatureStateDirective {
425
425
  ngOnDestroy() {
426
426
  this.store.dispatchAction(new NgssmUnregisterFeatureStateAction(this.component.featureStateKey));
427
427
  }
428
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ProvideNgssmFeatureStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
429
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: ProvideNgssmFeatureStateDirective, isStandalone: true, selector: "[provideNgssmFeatureState]", ngImport: i0 }); }
428
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ProvideNgssmFeatureStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
429
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0", type: ProvideNgssmFeatureStateDirective, isStandalone: true, selector: "[provideNgssmFeatureState]", ngImport: i0 }); }
430
430
  }
431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ProvideNgssmFeatureStateDirective, decorators: [{
431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: ProvideNgssmFeatureStateDirective, decorators: [{
432
432
  type: Directive,
433
433
  args: [{
434
434
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -457,10 +457,10 @@ class FeatureStateReducer {
457
457
  }
458
458
  return state;
459
459
  }
460
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FeatureStateReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
461
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FeatureStateReducer }); }
460
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: FeatureStateReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
461
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: FeatureStateReducer }); }
462
462
  }
463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FeatureStateReducer, decorators: [{
463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: FeatureStateReducer, decorators: [{
464
464
  type: Injectable
465
465
  }] });
466
466
 
@@ -485,10 +485,10 @@ class NgSsmComponent {
485
485
  dispatchActionType(actionType) {
486
486
  this.store.dispatchActionType(actionType);
487
487
  }
488
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSsmComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
489
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: NgSsmComponent, isStandalone: true, ngImport: i0 }); }
488
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgSsmComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
489
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0", type: NgSsmComponent, isStandalone: true, ngImport: i0 }); }
490
490
  }
491
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: NgSsmComponent, decorators: [{
491
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NgSsmComponent, decorators: [{
492
492
  type: Directive,
493
493
  args: [{}]
494
494
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-store.mjs","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/ngssm-component.ts","../../../projects/ngssm-store/src/lib/provide-ngssm-store.ts","../../../projects/ngssm-store/src/lib/signal-helpers.ts","../../../projects/ngssm-store/src/public-api.ts","../../../projects/ngssm-store/src/ngssm-store.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 interface Effect {\n processedActions: string[];\n processAction(actiondispatcher: ActionDispatcher, state: State, action: Action): void;\n isFunc?: boolean;\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 type EffectFunc = (state: State, action: Action) => void;\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 { EnvironmentInjector, Injectable, Signal, inject, runInInjectionContext, signal } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\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 integrates both RxJS (`BehaviorSubject`) and Angular signals for reactive state management.\n *\n * ### Features:\n * - Centralized state management with support for reducers and effects.\n * - Reactive state updates using both RxJS and 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 * - Subscribe to state updates using `state$` (RxJS) or `state` (Angular signal).\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class Store implements ActionDispatcher {\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 injector = inject(EnvironmentInjector);\n\n // The current state of the application, managed as a BehaviorSubject for RxJS compatibility.\n private readonly _state$ = new BehaviorSubject<State>({});\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 for signal-based reactivity.\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 // The most recently action processed by reducers, managed as an observable.\n private readonly _processedAction$ = new BehaviorSubject<Action>({ type: '' });\n\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 /**\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 // Synchronize the RxJS state with the Angular signal state.\n this._state$.subscribe((value) => this._stateSignal.set(value));\n\n this.logger.information('[Store] ---> state initialization...');\n let state = this._state$.getValue();\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._state$.next(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 current state as an RxJS observable.\n * Useful for subscribing to state changes in a reactive manner.\n */\n public get state$(): Observable<State> {\n return this._state$.asObservable();\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 most recently action processed by reducers as an observale.\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$(): Observable<Action> {\n return this._processedAction$.asObservable();\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 // 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._state$.getValue();\n const updatedState = reducers.reduce((p, c) => c.updateState(p, nextAction), currentState);\n\n if (updatedState !== currentState) {\n this._state$.next(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 this._processedAction$.next(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 { Directive, inject, OnDestroy } from '@angular/core';\nimport { map, Observable, Subject, distinctUntilChanged, takeUntil } from 'rxjs';\n\nimport { Action } from './action';\nimport { State } from './state';\nimport { Store } from './store';\n\n@Directive({})\nexport class NgSsmComponent implements OnDestroy {\n protected store = inject(Store);\n\n private readonly _unsubscribeAll$ = new Subject<void>();\n\n protected get unsubscribeAll$(): Observable<void> {\n return this._unsubscribeAll$.asObservable();\n }\n\n public ngOnDestroy(): void {\n this._unsubscribeAll$.next();\n this._unsubscribeAll$.complete();\n }\n\n public watch<T>(selector: (state: State) => T): Observable<T> {\n return this.store.state$.pipe(\n map((state) => selector(state)),\n distinctUntilChanged(),\n takeUntil(this.unsubscribeAll$)\n );\n }\n\n public dispatchAction(action: Action): void {\n this.store.dispatchAction(action);\n }\n\n public dispatchActionType(actionType: string): void {\n this.store.dispatchActionType(actionType);\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","/*\n * Public API Surface of ngssm-store\n */\n\nexport * from './lib/store';\nexport * from './lib/state';\nexport * from './lib/action';\nexport * from './lib/reducer';\nexport * from './lib/effect';\nexport * from './lib/feature-state';\nexport * from './lib/ngssm-component';\nexport * from './lib/state-initializer';\nexport * from './lib/logging';\nexport * from './lib/actions';\nexport * from './lib/provide-ngssm-store';\nexport * from './lib/signal-helpers';\nexport * from './lib/action-dispatcher';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,aAAa,GAAG,IAAI,cAAc,CAAU,eAAe;AAEjE,MAAM,cAAc,GAAG,CAAC,OAAsB,KAA0B;AAC7E,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE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AA,iBAAiB,GAAG,IAAI,cAAc,CAAmB,mBAAmB;AAElF,MAAM,iBAAiB,GAAG,MAA2B;AAC1D,IAAA,OAAO,wBAAwB,CAAC,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7H;;ACPO,MAAM,YAAY,GAAG,CAAc,QAA6B,KAAe;AACpF,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,OAAO,QAAQ,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;AAChD;;ACPA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-store.mjs","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/ngssm-component.ts","../../../projects/ngssm-store/src/lib/provide-ngssm-store.ts","../../../projects/ngssm-store/src/lib/signal-helpers.ts","../../../projects/ngssm-store/src/public-api.ts","../../../projects/ngssm-store/src/ngssm-store.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 = (state: State, action: Action) => 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 { EnvironmentInjector, Injectable, Signal, inject, runInInjectionContext, signal } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\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 integrates both RxJS (`BehaviorSubject`) and Angular signals for reactive state management.\n *\n * ### Features:\n * - Centralized state management with support for reducers and effects.\n * - Reactive state updates using both RxJS and 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 * - Subscribe to state updates using `state$` (RxJS) or `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 // 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 injector = inject(EnvironmentInjector);\n\n // The current state of the application, managed as a BehaviorSubject for RxJS compatibility.\n private readonly _state$ = new BehaviorSubject<State>({});\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 for signal-based reactivity.\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 // The most recently action processed by reducers, managed as an observable.\n private readonly _processedAction$ = new BehaviorSubject<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 // Synchronize the RxJS state with the Angular signal state.\n this._state$.subscribe((value) => this._stateSignal.set(value));\n\n this.logger.information('[Store] ---> state initialization...');\n let state = this._state$.getValue();\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._state$.next(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 current state as an RxJS observable.\n * Useful for subscribing to state changes in a reactive manner.\n */\n public get state$(): Observable<State> {\n return this._state$.asObservable();\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 most recently action processed by reducers as an observale.\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$(): Observable<Action> {\n return this._processedAction$.asObservable();\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 // 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._state$.getValue();\n const updatedState = reducers.reduce((p, c) => c.updateState(p, nextAction), currentState);\n\n if (updatedState !== currentState) {\n this._state$.next(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 this._processedAction$.next(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 { Directive, inject, OnDestroy } from '@angular/core';\nimport { map, Observable, Subject, distinctUntilChanged, takeUntil } from 'rxjs';\n\nimport { Action } from './action';\nimport { State } from './state';\nimport { Store } from './store';\n\n@Directive({})\nexport class NgSsmComponent implements OnDestroy {\n protected store = inject(Store);\n\n private readonly _unsubscribeAll$ = new Subject<void>();\n\n protected get unsubscribeAll$(): Observable<void> {\n return this._unsubscribeAll$.asObservable();\n }\n\n public ngOnDestroy(): void {\n this._unsubscribeAll$.next();\n this._unsubscribeAll$.complete();\n }\n\n public watch<T>(selector: (state: State) => T): Observable<T> {\n return this.store.state$.pipe(\n map((state) => selector(state)),\n distinctUntilChanged(),\n takeUntil(this.unsubscribeAll$)\n );\n }\n\n public dispatchAction(action: Action): void {\n this.store.dispatchAction(action);\n }\n\n public dispatchActionType(actionType: string): void {\n this.store.dispatchActionType(actionType);\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","/*\n * Public API Surface of ngssm-store\n */\n\nexport * from './lib/store';\nexport * from './lib/state';\nexport * from './lib/action';\nexport * from './lib/reducer';\nexport * from './lib/effect';\nexport * from './lib/feature-state';\nexport * from './lib/ngssm-component';\nexport * from './lib/state-initializer';\nexport * from './lib/logging';\nexport * from './lib/actions';\nexport * from './lib/provide-ngssm-store';\nexport * from './lib/signal-helpers';\nexport * from './lib/action-dispatcher';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,aAAa,GAAG,IAAI,cAAc,CAAU,eAAe;AAEjE,MAAM,cAAc,GAAG,CAAC,OAAsB,KAA0B;AAC7E,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/F;MAEa,eAAe,GAAG,CAAC,GAAG,QAAyB,KAA0B;AACpF,IAAA,OAAO,wBAAwB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1H;;MCJa,YAAY,GAAG,IAAI,cAAc,CAAS,cAAc;AAE9D,MAAM,aAAa,GAAG,CAAC,MAAqB,KAA0B;AAC3E,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7F;MAEa,cAAc,GAAG,CAAC,GAAG,OAAwB,KAA0B;AAClF,IAAA,OAAO,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtH;MAEa,iBAAiB,GAAG,CAAC,UAAkB,EAAE,UAAsB,KAA0B;AACpG,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;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AC,cAAc,CAAC,MAAM,CAAC;IACnC;AAEO,IAAA,kBAAkB,CAAC,UAAkB,EAAA;AAC1C,QAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,UAAU,CAAC;IAC3C;8GA5BW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,SAAS;mBAAC,EAAE;;;MCAA,iBAAiB,GAAG,IAAI,cAAc,CAAmB,mBAAmB;AAElF,MAAM,iBAAiB,GAAG,MAA2B;AAC1D,IAAA,OAAO,wBAAwB,CAAC,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7H;;ACPO,MAAM,YAAY,GAAG,CAAc,QAA6B,KAAe;AACpF,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,IAAA,OAAO,QAAQ,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;AAChD;;ACPA;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngssm-store",
3
- "version": "20.3.10",
3
+ "version": "21.0.0",
4
4
  "description": "NgSsm - Simple state management implementation.",
5
5
  "author": "Lion Marc",
6
6
  "license": "MIT",
@@ -18,33 +18,33 @@
18
18
  "directory": "projects/ngssm-store"
19
19
  },
20
20
  "module": "fesm2022/ngssm-store.mjs",
21
- "typings": "index.d.ts",
21
+ "typings": "types/ngssm-store.d.ts",
22
22
  "exports": {
23
23
  "./package.json": {
24
24
  "default": "./package.json"
25
25
  },
26
26
  ".": {
27
- "types": "./index.d.ts",
27
+ "types": "./types/ngssm-store.d.ts",
28
28
  "default": "./fesm2022/ngssm-store.mjs"
29
29
  },
30
30
  "./caching": {
31
- "types": "./caching/index.d.ts",
31
+ "types": "./types/ngssm-store-caching.d.ts",
32
32
  "default": "./fesm2022/ngssm-store-caching.mjs"
33
33
  },
34
34
  "./caching/testing": {
35
- "types": "./caching/testing/index.d.ts",
35
+ "types": "./types/ngssm-store-caching-testing.d.ts",
36
36
  "default": "./fesm2022/ngssm-store-caching-testing.mjs"
37
37
  },
38
38
  "./testing": {
39
- "types": "./testing/index.d.ts",
39
+ "types": "./types/ngssm-store-testing.d.ts",
40
40
  "default": "./fesm2022/ngssm-store-testing.mjs"
41
41
  },
42
42
  "./visibility": {
43
- "types": "./visibility/index.d.ts",
43
+ "types": "./types/ngssm-store-visibility.d.ts",
44
44
  "default": "./fesm2022/ngssm-store-visibility.mjs"
45
45
  },
46
46
  "./visibility/testing": {
47
- "types": "./visibility/testing/index.d.ts",
47
+ "types": "./types/ngssm-store-visibility-testing.d.ts",
48
48
  "default": "./fesm2022/ngssm-store-visibility-testing.mjs"
49
49
  }
50
50
  },
@@ -1,17 +1,16 @@
1
- import * as _angular_core from '@angular/core';
2
- import { EnvironmentProviders } from '@angular/core';
1
+ import { WritableSignal, EnvironmentProviders } from '@angular/core';
3
2
  import { BehaviorSubject } from 'rxjs';
4
3
  import { ActionDispatcher, State, Action, Store } from 'ngssm-store';
5
4
 
6
5
  declare class StoreMock implements ActionDispatcher {
7
- private _stateValue;
8
- state$: BehaviorSubject<State>;
9
- state: _angular_core.WritableSignal<State>;
6
+ readonly state$: BehaviorSubject<State>;
7
+ readonly state: WritableSignal<State>;
10
8
  logsEnabled: boolean;
11
- processedAction: _angular_core.WritableSignal<Action>;
9
+ processedAction: WritableSignal<Action>;
10
+ private _stateValue;
12
11
  constructor(initialState: State);
13
- set stateValue(value: State);
14
12
  get stateValue(): State;
13
+ set stateValue(value: State);
15
14
  dispatchAction(action: Action): void;
16
15
  dispatchActionType(type: string): void;
17
16
  }
@@ -36,45 +36,45 @@ declare class DefineElementsGroupAction implements Action {
36
36
  constructor(elementKeys: string[]);
37
37
  }
38
38
 
39
- declare class ToggleElementVisibilityDirective {
40
- private readonly store;
41
- key: string | undefined | null;
42
- toggleElementvisibility(): void;
43
- static ɵfac: i0.ɵɵFactoryDeclaration<ToggleElementVisibilityDirective, never>;
44
- static ɵdir: i0.ɵɵDirectiveDeclaration<ToggleElementVisibilityDirective, "[toggleElementVisibility]", never, { "key": { "alias": "toggleElementVisibility"; "required": false; }; }, {}, never, never, true, never>;
39
+ declare class NgssmIsElementVisiblePipe implements PipeTransform {
40
+ transform(value: State, ...args: string[]): boolean;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgssmIsElementVisiblePipe, never>;
42
+ static ɵpipe: i0.ɵɵPipeDeclaration<NgssmIsElementVisiblePipe, "ngssmIsElementVisible", true>;
45
43
  }
46
44
 
47
- declare class IsElementVisiblePipe implements PipeTransform {
48
- transform(value: State, ...args: string[]): boolean;
49
- static ɵfac: i0.ɵɵFactoryDeclaration<IsElementVisiblePipe, never>;
50
- static ɵpipe: i0.ɵɵPipeDeclaration<IsElementVisiblePipe, "isElementVisible", true>;
45
+ declare class NgssmShowElement {
46
+ readonly ngssmShowElement: i0.InputSignal<string | null | undefined>;
47
+ private readonly store;
48
+ showElement(): void;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgssmShowElement, never>;
50
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgssmShowElement, "[ngssmShowElement]", never, { "ngssmShowElement": { "alias": "ngssmShowElement"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
51
51
  }
52
52
 
53
- declare class ShowElementDirective {
53
+ declare class NgssmHideElement {
54
+ readonly ngssmHideElement: i0.InputSignal<string | null | undefined>;
54
55
  private readonly store;
55
- key: string | undefined | null;
56
- toggleElementvisibility(): void;
57
- static ɵfac: i0.ɵɵFactoryDeclaration<ShowElementDirective, never>;
58
- static ɵdir: i0.ɵɵDirectiveDeclaration<ShowElementDirective, "[showElement]", never, { "key": { "alias": "showElement"; "required": false; }; }, {}, never, never, true, never>;
56
+ hideElement(): void;
57
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgssmHideElement, never>;
58
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgssmHideElement, "[ngssmHideElement]", never, { "ngssmHideElement": { "alias": "ngssmHideElement"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
59
59
  }
60
60
 
61
- declare class HideElementDirective {
61
+ declare class NgssmToggleElementVisibility {
62
+ readonly ngssmToggleElementVisibility: i0.InputSignal<string | null | undefined>;
62
63
  private readonly store;
63
- key: string | undefined | null;
64
- toggleElementvisibility(): void;
65
- static ɵfac: i0.ɵɵFactoryDeclaration<HideElementDirective, never>;
66
- static ɵdir: i0.ɵɵDirectiveDeclaration<HideElementDirective, "[hideElement]", never, { "key": { "alias": "hideElement"; "required": false; }; }, {}, never, never, true, never>;
64
+ toggleElementVisibility(): void;
65
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgssmToggleElementVisibility, never>;
66
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgssmToggleElementVisibility, "[ngssmToggleElementVisibility]", never, { "ngssmToggleElementVisibility": { "alias": "ngssmToggleElementVisibility"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
67
67
  }
68
68
 
69
- declare class VisibilityToggleGroupComponent {
70
- readonly store: Store;
69
+ declare class NgssmVisibilityToggleGroup {
71
70
  readonly items: i0.InputSignal<{
72
71
  label: string;
73
72
  key: string;
74
73
  }[]>;
75
74
  readonly hideMultipleSelectionIndicator: i0.InputSignalWithTransform<boolean, boolean>;
76
- static ɵfac: i0.ɵɵFactoryDeclaration<VisibilityToggleGroupComponent, never>;
77
- static ɵcmp: i0.ɵɵComponentDeclaration<VisibilityToggleGroupComponent, "ngssm-visibility-toggle-group", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "hideMultipleSelectionIndicator": { "alias": "hideMultipleSelectionIndicator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
75
+ protected readonly store: Store;
76
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgssmVisibilityToggleGroup, never>;
77
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgssmVisibilityToggleGroup, "ngssm-visibility-toggle-group", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "hideMultipleSelectionIndicator": { "alias": "hideMultipleSelectionIndicator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
78
78
  }
79
79
 
80
80
  declare const selectNgssmVisibilityState: (state: State) => NgssmVisibilityState;
@@ -109,5 +109,5 @@ declare class VisibilityReducer implements Reducer {
109
109
  static ɵprov: i0.ɵɵInjectableDeclaration<VisibilityReducer>;
110
110
  }
111
111
 
112
- export { DefineElementsGroupAction, HideElementAction, HideElementDirective, IsElementVisiblePipe, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, ShowElementAction, ShowElementDirective, ToggleElementVisibilityAction, ToggleElementVisibilityDirective, VisibilityReducer, VisibilityToggleGroupComponent, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
112
+ export { DefineElementsGroupAction, HideElementAction, NgssmHideElement, NgssmIsElementVisiblePipe, NgssmShowElement, NgssmToggleElementVisibility, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, NgssmVisibilityToggleGroup, ShowElementAction, ToggleElementVisibilityAction, VisibilityReducer, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
113
113
  export type { ElementVisibility, NgssmVisibilityState };
@@ -17,8 +17,8 @@ declare const provideNgssmVisibilityTesting: () => EnvironmentProviders;
17
17
  * Provides methods to show, hide, or toggle the visibility of an element.
18
18
  */
19
19
  declare class NgssmVisibilitySetter {
20
- private readonly reducer;
21
20
  readonly store: StoreMock;
21
+ private readonly reducer;
22
22
  /**
23
23
  * Sets the specified element as visible in the StoreMock.
24
24
  * @param elementKey The key of the element to show.
@@ -63,6 +63,7 @@ declare const NgSsmFeatureState: (specification: FeatureStateSpecification) => (
63
63
  * - Subscribe to state updates using `state$` (RxJS) or `state` (Angular signal).
64
64
  */
65
65
  declare class Store implements ActionDispatcher {
66
+ useMacroTasks: boolean;
66
67
  private readonly logger;
67
68
  private readonly reducers;
68
69
  private readonly effects;
@@ -75,7 +76,6 @@ declare class Store implements ActionDispatcher {
75
76
  private readonly _stateSignal;
76
77
  private readonly _processedAction;
77
78
  private readonly _processedAction$;
78
- useMacroTasks: boolean;
79
79
  /**
80
80
  * Initializes the `Store` with reducers, effects, and state initializers.
81
81
  * Also sets up the initial state and registers reducers and effects.
@@ -152,15 +152,15 @@ declare class Store implements ActionDispatcher {
152
152
  static ɵprov: i0.ɵɵInjectableDeclaration<Store>;
153
153
  }
154
154
 
155
+ type EffectFunc = (state: State, action: Action) => void;
155
156
  interface Effect {
157
+ isFunc?: boolean;
156
158
  processedActions: string[];
157
159
  processAction(actiondispatcher: ActionDispatcher, state: State, action: Action): void;
158
- isFunc?: boolean;
159
160
  }
160
161
  declare const NGSSM_EFFECT: InjectionToken<Effect>;
161
162
  declare const provideEffect: (effect: Type<unknown>) => EnvironmentProviders;
162
163
  declare const provideEffects: (...effects: Type<unknown>[]) => EnvironmentProviders;
163
- type EffectFunc = (state: State, action: Action) => void;
164
164
  declare const provideEffectFunc: (actionType: string, effectFunc: EffectFunc) => EnvironmentProviders;
165
165
 
166
166
  declare class NgSsmComponent implements OnDestroy {