ngssm-store 20.1.1 → 20.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/caching/testing/index.d.ts +2 -1
- package/fesm2022/ngssm-store-caching-testing.mjs +3 -1
- package/fesm2022/ngssm-store-caching-testing.mjs.map +1 -1
- package/fesm2022/ngssm-store-visibility-testing.mjs +83 -0
- package/fesm2022/ngssm-store-visibility-testing.mjs.map +1 -0
- package/fesm2022/ngssm-store-visibility.mjs +1 -1
- package/package.json +5 -1
- package/visibility/index.d.ts +12 -2
- package/visibility/testing/index.d.ts +48 -0
|
@@ -42,5 +42,6 @@ declare class NgssmCachedItemSetter {
|
|
|
42
42
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgssmCachedItemSetter, never>;
|
|
43
43
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgssmCachedItemSetter>;
|
|
44
44
|
}
|
|
45
|
+
declare const ngssmCachedItemSetter: () => NgssmCachedItemSetter;
|
|
45
46
|
|
|
46
|
-
export { NgssmCachedItemSetter, ngssmCachingStateInitializer, provideNgssmCachingTesting };
|
|
47
|
+
export { NgssmCachedItemSetter, ngssmCachedItemSetter, ngssmCachingStateInitializer, provideNgssmCachingTesting };
|
|
@@ -3,6 +3,7 @@ import { inject, Injectable, makeEnvironmentProviders, provideAppInitializer } f
|
|
|
3
3
|
import { Store, Logger } from 'ngssm-store';
|
|
4
4
|
import { StoreMock } from 'ngssm-store/testing';
|
|
5
5
|
import { updateNgssmCachingState, NgssmCachingStateSpecification } from 'ngssm-store/caching';
|
|
6
|
+
import { TestBed } from '@angular/core/testing';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Utility service for setting and updating cached items in the StoreMock during tests.
|
|
@@ -69,6 +70,7 @@ class NgssmCachedItemSetter {
|
|
|
69
70
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgssmCachedItemSetter, decorators: [{
|
|
70
71
|
type: Injectable
|
|
71
72
|
}] });
|
|
73
|
+
const ngssmCachedItemSetter = () => TestBed.inject(NgssmCachedItemSetter);
|
|
72
74
|
|
|
73
75
|
/**
|
|
74
76
|
* App initializer that sets up the NgssmCaching state in the StoreMock for testing purposes.
|
|
@@ -97,5 +99,5 @@ const provideNgssmCachingTesting = () => {
|
|
|
97
99
|
* Generated bundle index. Do not edit.
|
|
98
100
|
*/
|
|
99
101
|
|
|
100
|
-
export { NgssmCachedItemSetter, ngssmCachingStateInitializer, provideNgssmCachingTesting };
|
|
102
|
+
export { NgssmCachedItemSetter, ngssmCachedItemSetter, ngssmCachingStateInitializer, provideNgssmCachingTesting };
|
|
101
103
|
//# sourceMappingURL=ngssm-store-caching-testing.mjs.map
|
|
@@ -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';\n\nimport { Store } from 'ngssm-store';\nimport { CachedItemStatus, 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 * @param cacheItemKey The key of the cached item.\n * @param status The new status to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCacheItemStatus(cacheItemKey: string, status: CachedItemStatus): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cacheItemKey]: {\n status: { $set: status }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the value of a cached item in the StoreMock.\n * @param cacheItemKey The key of the cached item.\n * @param value The value to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCacheItemValue<T>(cacheItemKey: string, value?: T): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cacheItemKey]: {\n item: { $set: value }\n }\n }\n });\n\n return this;\n }\n}\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":"
|
|
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, 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 * @param cacheItemKey The key of the cached item.\n * @param status The new status to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCacheItemStatus(cacheItemKey: string, status: CachedItemStatus): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cacheItemKey]: {\n status: { $set: status }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the value of a cached item in the StoreMock.\n * @param cacheItemKey The key of the cached item.\n * @param value The value to set.\n * @returns The NgssmCachedItemSetter instance for chaining.\n */\n public setCacheItemValue<T>(cacheItemKey: string, value?: T): NgssmCachedItemSetter {\n this.store.stateValue = updateNgssmCachingState(this.store.stateValue, {\n caches: {\n [cacheItemKey]: {\n item: { $set: value }\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;AA0D9D;AAxDC;;;;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;AACtB,oBAAA,IAAI,EAAE;wBACJ,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,IAAI,EAAE,MAAM,CAAC,UAAU;wBACvB,KAAK,EAAE,MAAM,CAAC;AACf;AACF;AACF;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,IAAI;;AAGb;;;;;AAKG;IACI,kBAAkB,CAAC,YAAoB,EAAE,MAAwB,EAAA;AACtE,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACrE,YAAA,MAAM,EAAE;gBACN,CAAC,YAAY,GAAG;AACd,oBAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM;AACvB;AACF;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,IAAI;;AAGb;;;;;AAKG;IACI,iBAAiB,CAAI,YAAoB,EAAE,KAAS,EAAA;AACzD,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACrE,YAAA,MAAM,EAAE;gBACN,CAAC,YAAY,GAAG;AACd,oBAAA,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK;AACpB;AACF;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,IAAI;;8GAzDF,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;;AA8DM,MAAM,qBAAqB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,qBAAqB;;ACjE/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;;IAGjD,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;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
|
|
3
|
+
import { Store, Logger } from 'ngssm-store';
|
|
4
|
+
import { StoreMock } from 'ngssm-store/testing';
|
|
5
|
+
import { VisibilityReducer, ShowElementAction, HideElementAction, ToggleElementVisibilityAction, NgssmVisibilityStateSpecification } from 'ngssm-store/visibility';
|
|
6
|
+
import { TestBed } from '@angular/core/testing';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Utility service for manipulating element visibility state in the StoreMock during tests.
|
|
10
|
+
* Provides methods to show, hide, or toggle the visibility of an element.
|
|
11
|
+
*/
|
|
12
|
+
class NgssmVisibilitySetter {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.reducer = new VisibilityReducer();
|
|
15
|
+
this.store = inject(Store);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sets the specified element as visible in the StoreMock.
|
|
19
|
+
* @param elementKey The key of the element to show.
|
|
20
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
21
|
+
*/
|
|
22
|
+
showElement(elementKey) {
|
|
23
|
+
this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ShowElementAction(elementKey));
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets the specified element as hidden in the StoreMock.
|
|
28
|
+
* @param elementKey The key of the element to hide.
|
|
29
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
30
|
+
*/
|
|
31
|
+
hideElement(elementKey) {
|
|
32
|
+
this.store.stateValue = this.reducer.updateState(this.store.stateValue, new HideElementAction(elementKey));
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Toggles the visibility of the specified element in the StoreMock.
|
|
37
|
+
* @param elementKey The key of the element to toggle.
|
|
38
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
39
|
+
*/
|
|
40
|
+
toggleElementVisibility(elementKey) {
|
|
41
|
+
this.store.stateValue = this.reducer.updateState(this.store.stateValue, new ToggleElementVisibilityAction(elementKey));
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgssmVisibilitySetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
45
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgssmVisibilitySetter }); }
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgssmVisibilitySetter, decorators: [{
|
|
48
|
+
type: Injectable
|
|
49
|
+
}] });
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to retrieve the NgssmVisibilitySetter instance from the TestBed.
|
|
52
|
+
*/
|
|
53
|
+
const ngssmVisibilitySetter = () => TestBed.inject(NgssmVisibilitySetter);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* App initializer that sets up the ngssm state visibility in the StoreMock for testing purposes.
|
|
57
|
+
* Throws an error if StoreMock is not registered.
|
|
58
|
+
*/
|
|
59
|
+
const ngssmVisibilityStateInitializer = () => {
|
|
60
|
+
const logger = inject(Logger);
|
|
61
|
+
logger.information('[ngssm-visibility-testing] Initialization of state');
|
|
62
|
+
const store = inject(Store);
|
|
63
|
+
if (!(store instanceof StoreMock)) {
|
|
64
|
+
throw new Error('StoreMock is not registered.');
|
|
65
|
+
}
|
|
66
|
+
store.stateValue = {
|
|
67
|
+
...store.stateValue,
|
|
68
|
+
[NgssmVisibilityStateSpecification.featureStateKey]: NgssmVisibilityStateSpecification.initialState
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Provides environment providers for ngssm visibility testing, including the state initializer.
|
|
73
|
+
*/
|
|
74
|
+
const provideNgssmVisibilityTesting = () => {
|
|
75
|
+
return makeEnvironmentProviders([provideAppInitializer(ngssmVisibilityStateInitializer), NgssmVisibilitySetter]);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Generated bundle index. Do not edit.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export { NgssmVisibilitySetter, ngssmVisibilitySetter, ngssmVisibilityStateInitializer, provideNgssmVisibilityTesting };
|
|
83
|
+
//# sourceMappingURL=ngssm-store-visibility-testing.mjs.map
|
|
@@ -0,0 +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;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;;AAGb;;;;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;;AAGb;;;;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;;8GA/BF,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;;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;;IAGjD,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;;;;"}
|
|
@@ -270,5 +270,5 @@ const isElementVisible = (elementKey) => ({
|
|
|
270
270
|
* Generated bundle index. Do not edit.
|
|
271
271
|
*/
|
|
272
272
|
|
|
273
|
-
export { DefineElementsGroupAction, HideElementAction, HideElementDirective, IsElementVisiblePipe, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, ShowElementAction, ShowElementDirective, ToggleElementVisibilityAction, ToggleElementVisibilityDirective, VisibilityToggleGroupComponent, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
|
|
273
|
+
export { DefineElementsGroupAction, HideElementAction, HideElementDirective, IsElementVisiblePipe, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, ShowElementAction, ShowElementDirective, ToggleElementVisibilityAction, ToggleElementVisibilityDirective, VisibilityReducer, VisibilityToggleGroupComponent, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
|
|
274
274
|
//# sourceMappingURL=ngssm-store-visibility.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngssm-store",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.2",
|
|
4
4
|
"description": "NgSsm - Simple state management implementation.",
|
|
5
5
|
"author": "Lion Marc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"./caching/testing": {
|
|
43
43
|
"types": "./caching/testing/index.d.ts",
|
|
44
44
|
"default": "./fesm2022/ngssm-store-caching-testing.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./visibility/testing": {
|
|
47
|
+
"types": "./visibility/testing/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/ngssm-store-visibility-testing.mjs"
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
"sideEffects": false
|
package/visibility/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { EnvironmentProviders, PipeTransform, Signal } from '@angular/core';
|
|
3
|
-
import { Action, State, Store } from 'ngssm-store';
|
|
3
|
+
import { Action, State, Store, Reducer } from 'ngssm-store';
|
|
4
4
|
import { Spec } from 'immutability-helper';
|
|
5
5
|
|
|
6
6
|
declare const provideNgssmVisibility: () => EnvironmentProviders;
|
|
@@ -99,5 +99,15 @@ interface ElementVisibility {
|
|
|
99
99
|
}
|
|
100
100
|
declare const isElementVisible: (elementKey: string) => ElementVisibility;
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
declare class VisibilityReducer implements Reducer {
|
|
103
|
+
readonly processedActions: string[];
|
|
104
|
+
updateState(state: State, action: Action): State;
|
|
105
|
+
private groupExists;
|
|
106
|
+
private getElementsKeysGroupedWith;
|
|
107
|
+
private setElementVisible;
|
|
108
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VisibilityReducer, never>;
|
|
109
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<VisibilityReducer>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { DefineElementsGroupAction, HideElementAction, HideElementDirective, IsElementVisiblePipe, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, ShowElementAction, ShowElementDirective, ToggleElementVisibilityAction, ToggleElementVisibilityDirective, VisibilityReducer, VisibilityToggleGroupComponent, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
|
|
103
113
|
export type { ElementVisibility, NgssmVisibilityState };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { StoreMock } from 'ngssm-store/testing';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* App initializer that sets up the ngssm state visibility in the StoreMock for testing purposes.
|
|
7
|
+
* Throws an error if StoreMock is not registered.
|
|
8
|
+
*/
|
|
9
|
+
declare const ngssmVisibilityStateInitializer: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Provides environment providers for ngssm visibility testing, including the state initializer.
|
|
12
|
+
*/
|
|
13
|
+
declare const provideNgssmVisibilityTesting: () => EnvironmentProviders;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Utility service for manipulating element visibility state in the StoreMock during tests.
|
|
17
|
+
* Provides methods to show, hide, or toggle the visibility of an element.
|
|
18
|
+
*/
|
|
19
|
+
declare class NgssmVisibilitySetter {
|
|
20
|
+
private readonly reducer;
|
|
21
|
+
readonly store: StoreMock;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the specified element as visible in the StoreMock.
|
|
24
|
+
* @param elementKey The key of the element to show.
|
|
25
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
26
|
+
*/
|
|
27
|
+
showElement(elementKey: string): NgssmVisibilitySetter;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the specified element as hidden in the StoreMock.
|
|
30
|
+
* @param elementKey The key of the element to hide.
|
|
31
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
32
|
+
*/
|
|
33
|
+
hideElement(elementKey: string): NgssmVisibilitySetter;
|
|
34
|
+
/**
|
|
35
|
+
* Toggles the visibility of the specified element in the StoreMock.
|
|
36
|
+
* @param elementKey The key of the element to toggle.
|
|
37
|
+
* @returns The NgssmVisibilitySetter instance for chaining.
|
|
38
|
+
*/
|
|
39
|
+
toggleElementVisibility(elementKey: string): NgssmVisibilitySetter;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgssmVisibilitySetter, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgssmVisibilitySetter>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Helper function to retrieve the NgssmVisibilitySetter instance from the TestBed.
|
|
45
|
+
*/
|
|
46
|
+
declare const ngssmVisibilitySetter: () => NgssmVisibilitySetter;
|
|
47
|
+
|
|
48
|
+
export { NgssmVisibilitySetter, ngssmVisibilitySetter, ngssmVisibilityStateInitializer, provideNgssmVisibilityTesting };
|