ngx-dev-toolbar 1.0.3 → 1.0.5
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/components/button/button.component.d.ts +12 -0
- package/components/card/card.component.d.ts +8 -0
- package/components/clickable-card/clickable-card.component.d.ts +11 -0
- package/components/icons/angular-icon.component.d.ts +5 -0
- package/components/icons/bolt-icon.component.d.ts +6 -0
- package/components/icons/bug-icon.component.d.ts +6 -0
- package/components/icons/code-icon.component.d.ts +6 -0
- package/components/icons/database-icon.component.d.ts +6 -0
- package/components/icons/discord-icon.component.d.ts +6 -0
- package/components/icons/docs-icon.component.d.ts +6 -0
- package/components/icons/export-icon.component.d.ts +6 -0
- package/components/icons/filter-icon.component.d.ts +6 -0
- package/components/icons/gauge-icon.component.d.ts +6 -0
- package/components/icons/gear-icon.component.d.ts +6 -0
- package/components/icons/git-branch-icon.component.d.ts +6 -0
- package/components/icons/icon.component.d.ts +9 -0
- package/components/icons/icon.models.d.ts +1 -0
- package/components/icons/import-icon.component.d.ts +6 -0
- package/components/icons/layout-icon.component.d.ts +6 -0
- package/components/icons/lightbulb-icon.component.d.ts +6 -0
- package/components/icons/lighting-icon.component.d.ts +6 -0
- package/components/icons/lock-icon.component.d.ts +6 -0
- package/components/icons/moon-icon.component.d.ts +6 -0
- package/components/icons/network-icon.component.d.ts +6 -0
- package/components/icons/puzzle-icon.component.d.ts +6 -0
- package/components/icons/refresh-icon.component.d.ts +6 -0
- package/components/icons/star-icon.component.d.ts +6 -0
- package/components/icons/sun-icon.component.d.ts +6 -0
- package/components/icons/terminal-icon.component.d.ts +6 -0
- package/components/icons/toggle-left-icon.component.d.ts +6 -0
- package/components/icons/translate-icon.component.d.ts +6 -0
- package/components/icons/trash-icon.component.d.ts +6 -0
- package/components/icons/users-icon.component.d.ts +6 -0
- package/components/input/input.component.d.ts +10 -0
- package/components/link-button/link-button.component.d.ts +8 -0
- package/components/select/select.component.d.ts +25 -0
- package/components/tool-button/tool-button.component.d.ts +23 -0
- package/components/toolbar-tool/toolbar-tool.component.d.ts +30 -0
- package/components/toolbar-tool/toolbar-tool.models.d.ts +25 -0
- package/components/window/window.component.d.ts +16 -0
- package/dev-toolbar-state.service.d.ts +21 -0
- package/dev-toolbar.component.d.ts +18 -0
- package/fesm2022/ngx-dev-toolbar.mjs +4570 -0
- package/fesm2022/ngx-dev-toolbar.mjs.map +1 -0
- package/index.d.ts +19 -0
- package/models/dev-tools.interface.d.ts +17 -0
- package/package.json +31 -8
- package/tools/app-features-tool/app-features-internal.service.d.ts +102 -0
- package/tools/app-features-tool/app-features-tool.component.d.ts +61 -0
- package/tools/app-features-tool/app-features.models.d.ts +109 -0
- package/tools/app-features-tool/app-features.service.d.ts +151 -0
- package/tools/feature-flags-tool/feature-flags-internal.service.d.ts +21 -0
- package/tools/feature-flags-tool/feature-flags-tool.component.d.ts +27 -0
- package/tools/feature-flags-tool/feature-flags.models.d.ts +9 -0
- package/tools/feature-flags-tool/feature-flags.service.d.ts +19 -0
- package/tools/home-tool/home-tool.component.d.ts +38 -0
- package/{src/tools/home-tool/settings.models.ts → tools/home-tool/settings.models.d.ts} +1 -1
- package/tools/home-tool/settings.service.d.ts +10 -0
- package/tools/language-tool/language-internal.service.d.ts +19 -0
- package/tools/language-tool/language-tool.component.d.ts +14 -0
- package/tools/language-tool/language.models.d.ts +4 -0
- package/tools/language-tool/language.service.d.ts +19 -0
- package/tools/network-mocker-tool/network-mocker-tool.component.d.ts +23 -0
- package/tools/network-mocker-tool/network-mocker.models.d.ts +16 -0
- package/tools/network-mocker-tool/network-mocker.service.d.ts +16 -0
- package/tools/permissions-tool/permissions-internal.service.d.ts +34 -0
- package/tools/permissions-tool/permissions-tool.component.d.ts +27 -0
- package/tools/permissions-tool/permissions.models.d.ts +34 -0
- package/tools/permissions-tool/permissions.service.d.ts +87 -0
- package/utils/storage.service.d.ts +18 -0
- package/eslint.config.cjs +0 -47
- package/ng-package.json +0 -7
- package/project.json +0 -37
- package/src/components/button/button.component.scss +0 -49
- package/src/components/button/button.component.ts +0 -36
- package/src/components/card/card.component.scss +0 -18
- package/src/components/card/card.component.ts +0 -30
- package/src/components/clickable-card/clickable-card.component.scss +0 -39
- package/src/components/clickable-card/clickable-card.component.ts +0 -34
- package/src/components/icons/angular-icon.component.ts +0 -35
- package/src/components/icons/bug-icon.component.ts +0 -23
- package/src/components/icons/code-icon.component.ts +0 -24
- package/src/components/icons/database-icon.component.ts +0 -27
- package/src/components/icons/discord-icon.component.ts +0 -23
- package/src/components/icons/docs-icon.component.ts +0 -23
- package/src/components/icons/export-icon.component.ts +0 -23
- package/src/components/icons/gauge-icon.component.ts +0 -27
- package/src/components/icons/gear-icon.component.ts +0 -27
- package/src/components/icons/git-branch-icon.component.ts +0 -27
- package/src/components/icons/icon.component.ts +0 -129
- package/src/components/icons/icon.models.ts +0 -27
- package/src/components/icons/import-icon.component.ts +0 -23
- package/src/components/icons/layout-icon.component.ts +0 -24
- package/src/components/icons/lightbulb-icon.component.ts +0 -23
- package/src/components/icons/lighting-icon.component.ts +0 -24
- package/src/components/icons/moon-icon.component.ts +0 -27
- package/src/components/icons/network-icon.component.ts +0 -27
- package/src/components/icons/puzzle-icon.component.ts +0 -27
- package/src/components/icons/refresh-icon.component.ts +0 -27
- package/src/components/icons/star-icon.component.ts +0 -27
- package/src/components/icons/sun-icon.component.ts +0 -27
- package/src/components/icons/terminal-icon.component.ts +0 -27
- package/src/components/icons/toggle-left-icon.component.ts +0 -27
- package/src/components/icons/translate-icon.component.ts +0 -23
- package/src/components/icons/trash-icon.component.ts +0 -23
- package/src/components/icons/users-icon.component.ts +0 -27
- package/src/components/input/input.component.ts +0 -67
- package/src/components/link-button/link-button.component.scss +0 -36
- package/src/components/link-button/link-button.component.ts +0 -29
- package/src/components/select/select.component.scss +0 -162
- package/src/components/select/select.component.ts +0 -127
- package/src/components/tool-button/tool-button.component.scss +0 -67
- package/src/components/tool-button/tool-button.component.ts +0 -126
- package/src/components/toolbar-tool/toolbar-tool.component.scss +0 -9
- package/src/components/toolbar-tool/toolbar-tool.component.ts +0 -169
- package/src/components/toolbar-tool/toolbar-tool.models.ts +0 -33
- package/src/components/window/window.component.scss +0 -95
- package/src/components/window/window.component.ts +0 -69
- package/src/dev-toolbar-state.service.ts +0 -89
- package/src/dev-toolbar.component.scss +0 -22
- package/src/dev-toolbar.component.ts +0 -105
- package/src/index.ts +0 -10
- package/src/models/dev-tools.interface.ts +0 -19
- package/src/styles.scss +0 -342
- package/src/test-setup.ts +0 -12
- package/src/tools/feature-flags-tool/feature-flags-internal.service.ts +0 -96
- package/src/tools/feature-flags-tool/feature-flags-tool.component.ts +0 -261
- package/src/tools/feature-flags-tool/feature-flags.models.ts +0 -10
- package/src/tools/feature-flags-tool/feature-flags.service.ts +0 -28
- package/src/tools/home-tool/home-tool.component.scss +0 -67
- package/src/tools/home-tool/home-tool.component.ts +0 -197
- package/src/tools/home-tool/settings.service.spec.ts +0 -59
- package/src/tools/home-tool/settings.service.ts +0 -21
- package/src/tools/language-tool/language-internal.service.ts +0 -51
- package/src/tools/language-tool/language-tool.component.scss +0 -7
- package/src/tools/language-tool/language-tool.component.ts +0 -71
- package/src/tools/language-tool/language.models.ts +0 -4
- package/src/tools/language-tool/language.service.ts +0 -26
- package/src/utils/storage.service.spec.ts +0 -179
- package/src/utils/storage.service.ts +0 -80
- package/tsconfig.json +0 -28
- package/tsconfig.lib.json +0 -28
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -29
- package/vite.config.mts +0 -27
package/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './components/icons/icon.component';
|
|
2
|
+
export * from './components/icons/icon.models';
|
|
3
|
+
export * from './components/toolbar-tool/toolbar-tool.component';
|
|
4
|
+
export * from './components/toolbar-tool/toolbar-tool.models';
|
|
5
|
+
export * from './dev-toolbar.component';
|
|
6
|
+
export * from './models/dev-tools.interface';
|
|
7
|
+
export * from './tools/feature-flags-tool/feature-flags.models';
|
|
8
|
+
export * from './tools/feature-flags-tool/feature-flags.service';
|
|
9
|
+
export * from './tools/language-tool/language.models';
|
|
10
|
+
export * from './tools/language-tool/language.service';
|
|
11
|
+
export * from './tools/network-mocker-tool/network-mocker-tool.component';
|
|
12
|
+
export * from './tools/network-mocker-tool/network-mocker.models';
|
|
13
|
+
export * from './tools/network-mocker-tool/network-mocker.service';
|
|
14
|
+
export * from './tools/app-features-tool/app-features.models';
|
|
15
|
+
export * from './tools/app-features-tool/app-features.service';
|
|
16
|
+
export * from './tools/app-features-tool/app-features-tool.component';
|
|
17
|
+
export * from './tools/permissions-tool/permissions.models';
|
|
18
|
+
export * from './tools/permissions-tool/permissions.service';
|
|
19
|
+
export * from './tools/permissions-tool/permissions-tool.component';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Interface that should be implemented by any tool service that is used in the dev toolbar
|
|
4
|
+
*/
|
|
5
|
+
export interface DevToolsService<OptionType> {
|
|
6
|
+
/**
|
|
7
|
+
* Sets the available options that will be displayed in the tool on the dev toolbar
|
|
8
|
+
* @param options The options to be displayed
|
|
9
|
+
*/
|
|
10
|
+
setAvailableOptions(options: OptionType[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the values that were forced/modified through the tool on the dev toolbar.
|
|
13
|
+
* If the tool only supports a single option, the returned array will have a single element.
|
|
14
|
+
* @returns Observable of forced values array
|
|
15
|
+
*/
|
|
16
|
+
getForcedValues(): Observable<OptionType[]>;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-dev-toolbar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"devtools",
|
|
6
|
+
"development-toolbar",
|
|
7
|
+
"dev-toolbar",
|
|
8
|
+
"angular",
|
|
9
|
+
"typescript",
|
|
10
|
+
"rxjs",
|
|
11
|
+
"signals"
|
|
12
|
+
],
|
|
4
13
|
"peerDependencies": {
|
|
5
|
-
"@angular/core": "
|
|
6
|
-
"@angular/common": "
|
|
7
|
-
"@angular/forms": "
|
|
8
|
-
"@angular/animations": "
|
|
9
|
-
"@angular/cdk": "
|
|
10
|
-
"rxjs": "
|
|
14
|
+
"@angular/core": ">=18.0.0 ",
|
|
15
|
+
"@angular/common": ">=18.0.0",
|
|
16
|
+
"@angular/forms": ">=18.0.0",
|
|
17
|
+
"@angular/animations": ">=18.0.0",
|
|
18
|
+
"@angular/cdk": ">=18.0.0",
|
|
19
|
+
"rxjs": "^6.0.0 || ^7.0.0"
|
|
11
20
|
},
|
|
12
|
-
"sideEffects": false
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"module": "fesm2022/ngx-dev-toolbar.mjs",
|
|
23
|
+
"typings": "index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./package.json": {
|
|
26
|
+
"default": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./index.d.ts",
|
|
30
|
+
"default": "./fesm2022/ngx-dev-toolbar.mjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"tslib": "^2.3.0"
|
|
35
|
+
}
|
|
13
36
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolbarAppFeature, ForcedAppFeaturesState } from './app-features.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Internal service for managing app features state and forced overrides.
|
|
6
|
+
*
|
|
7
|
+
* This service handles:
|
|
8
|
+
* - Feature configuration storage
|
|
9
|
+
* - Forced feature state management
|
|
10
|
+
* - localStorage persistence
|
|
11
|
+
* - State validation and cleanup
|
|
12
|
+
*
|
|
13
|
+
* @internal This service is for internal toolbar use only. Consumers should use DevToolbarAppFeaturesService.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DevToolbarInternalAppFeaturesService {
|
|
16
|
+
private readonly STORAGE_KEY;
|
|
17
|
+
private storageService;
|
|
18
|
+
private appFeaturesSubject;
|
|
19
|
+
private forcedFeaturesSubject;
|
|
20
|
+
private readonly forcedFeatures$;
|
|
21
|
+
/**
|
|
22
|
+
* Observable stream of all features with merged forced state
|
|
23
|
+
*/
|
|
24
|
+
features$: Observable<DevToolbarAppFeature[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Signal containing current features with merged forced state
|
|
27
|
+
*/
|
|
28
|
+
features: import("@angular/core").Signal<DevToolbarAppFeature[]>;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Set available app features for the application.
|
|
32
|
+
* Validates features, trims whitespace, and triggers validation of forced state.
|
|
33
|
+
*
|
|
34
|
+
* @param features - Array of app features to configure
|
|
35
|
+
* @throws Error if duplicate feature IDs or empty IDs are detected
|
|
36
|
+
*/
|
|
37
|
+
setAppFeatures(features: DevToolbarAppFeature[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get observable stream of app features (natural state, no forced state merged)
|
|
40
|
+
*/
|
|
41
|
+
getAppFeatures(): Observable<DevToolbarAppFeature[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get observable stream of features that have forced overrides
|
|
44
|
+
*/
|
|
45
|
+
getForcedFeatures(): Observable<DevToolbarAppFeature[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Force a feature to enabled or disabled state.
|
|
48
|
+
* Persists the forced state to localStorage.
|
|
49
|
+
*
|
|
50
|
+
* @param featureId - ID of the feature to force
|
|
51
|
+
* @param isEnabled - Whether to force feature to enabled (true) or disabled (false)
|
|
52
|
+
*/
|
|
53
|
+
setFeature(featureId: string, isEnabled: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Remove forced override for a feature, returning it to natural state.
|
|
56
|
+
* Persists the change to localStorage.
|
|
57
|
+
*
|
|
58
|
+
* @param featureId - ID of the feature to unforce
|
|
59
|
+
*/
|
|
60
|
+
removeFeatureOverride(featureId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Apply a preset forced state (for preset integration).
|
|
63
|
+
* Validates and cleans invalid feature IDs before applying.
|
|
64
|
+
*
|
|
65
|
+
* @param state - Forced features state from preset
|
|
66
|
+
*/
|
|
67
|
+
applyForcedState(state: ForcedAppFeaturesState): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get current forced state as a snapshot (defensive copy).
|
|
70
|
+
* Useful for preset exports and debugging.
|
|
71
|
+
*
|
|
72
|
+
* @returns Current forced features state
|
|
73
|
+
*/
|
|
74
|
+
getCurrentForcedState(): ForcedAppFeaturesState;
|
|
75
|
+
/**
|
|
76
|
+
* Merge natural app features with forced state.
|
|
77
|
+
*
|
|
78
|
+
* @param appFeatures - Natural feature configuration
|
|
79
|
+
* @param forcedState - Forced overrides from localStorage/toolbar
|
|
80
|
+
* @returns Features with merged forced state
|
|
81
|
+
*/
|
|
82
|
+
private mergeForcedState;
|
|
83
|
+
/**
|
|
84
|
+
* Load forced features state from localStorage on initialization.
|
|
85
|
+
* Handles missing or corrupted data gracefully.
|
|
86
|
+
*/
|
|
87
|
+
private loadForcedFeatures;
|
|
88
|
+
/**
|
|
89
|
+
* Persist forced features state to localStorage.
|
|
90
|
+
* Handles quota exceeded errors gracefully.
|
|
91
|
+
*
|
|
92
|
+
* @param state - Forced state to persist
|
|
93
|
+
*/
|
|
94
|
+
private saveForcedFeatures;
|
|
95
|
+
/**
|
|
96
|
+
* Validate forced feature IDs against configured features and clean up invalid ones.
|
|
97
|
+
* Called after setAppFeatures() to ensure forced state references valid features.
|
|
98
|
+
*/
|
|
99
|
+
private validateAndCleanForcedState;
|
|
100
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalAppFeaturesService, never>;
|
|
101
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalAppFeaturesService>;
|
|
102
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { AppFeatureFilter, DevToolbarAppFeature } from './app-features.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Component for managing app features in the dev toolbar.
|
|
6
|
+
*
|
|
7
|
+
* Provides UI for:
|
|
8
|
+
* - Searching features by name and description
|
|
9
|
+
* - Filtering features by state (all/forced/enabled/disabled)
|
|
10
|
+
* - Forcing features to enabled/disabled state via 3-state dropdown
|
|
11
|
+
* - Viewing feature descriptions and current state
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <ndt-app-features-tool />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class DevToolbarAppFeaturesToolComponent {
|
|
19
|
+
private readonly appFeaturesService;
|
|
20
|
+
protected readonly activeFilter: import("@angular/core").WritableSignal<AppFeatureFilter>;
|
|
21
|
+
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
22
|
+
protected readonly features: import("@angular/core").Signal<DevToolbarAppFeature[]>;
|
|
23
|
+
protected readonly hasNoFeatures: import("@angular/core").Signal<boolean>;
|
|
24
|
+
protected readonly filteredFeatures: import("@angular/core").Signal<DevToolbarAppFeature[]>;
|
|
25
|
+
protected readonly hasNoFilteredFeatures: import("@angular/core").Signal<boolean>;
|
|
26
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
27
|
+
protected readonly filterOptions: {
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}[];
|
|
31
|
+
protected readonly featureValueOptions: {
|
|
32
|
+
value: string;
|
|
33
|
+
label: string;
|
|
34
|
+
}[];
|
|
35
|
+
/**
|
|
36
|
+
* Handle filter dropdown change.
|
|
37
|
+
* Updates the active filter to show all/forced/enabled/disabled features.
|
|
38
|
+
*/
|
|
39
|
+
onFilterChange(value: string | undefined): void;
|
|
40
|
+
/**
|
|
41
|
+
* Handle feature value change from 3-state dropdown.
|
|
42
|
+
* - 'not-forced' (empty string): Remove forced override
|
|
43
|
+
* - 'on': Force feature to enabled
|
|
44
|
+
* - 'off': Force feature to disabled
|
|
45
|
+
*/
|
|
46
|
+
onFeatureChange(featureId: string, value: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Handle search input change.
|
|
49
|
+
* Updates the search query to filter features by name/description.
|
|
50
|
+
*/
|
|
51
|
+
onSearchChange(query: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Get the dropdown value for a feature's current state.
|
|
54
|
+
* - Returns empty string if not forced (natural state)
|
|
55
|
+
* - Returns 'on' if forced to enabled
|
|
56
|
+
* - Returns 'off' if forced to disabled
|
|
57
|
+
*/
|
|
58
|
+
protected getFeatureValue(feature: DevToolbarAppFeature): string;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarAppFeaturesToolComponent, never>;
|
|
60
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarAppFeaturesToolComponent, "ndt-app-features-tool", never, {}, {}, never, never, true, never>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a product-level application feature that can be enabled/disabled
|
|
3
|
+
* based on license tier, deployment configuration, or environment flags.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const feature: DevToolbarAppFeature = {
|
|
8
|
+
* id: 'advanced-analytics',
|
|
9
|
+
* name: 'Advanced Analytics Dashboard',
|
|
10
|
+
* description: 'Access advanced reporting and data visualization tools',
|
|
11
|
+
* isEnabled: false, // Not available in current tier
|
|
12
|
+
* isForced: false // Natural state, not overridden
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export interface DevToolbarAppFeature {
|
|
17
|
+
/**
|
|
18
|
+
* Unique identifier for the feature
|
|
19
|
+
* @example 'advanced-analytics', 'multi-user-support', 'white-label-branding'
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* Display name shown in the toolbar UI
|
|
24
|
+
* @example 'Advanced Analytics Dashboard', 'Multi-User Support'
|
|
25
|
+
*/
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional description explaining the feature's purpose and capabilities
|
|
29
|
+
* Displayed below the feature name in the UI
|
|
30
|
+
* @example 'Access advanced reporting and data visualization tools'
|
|
31
|
+
*/
|
|
32
|
+
description?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Current enabled state of the feature
|
|
35
|
+
* - true: Feature is available to the user (may be natural state or forced)
|
|
36
|
+
* - false: Feature is not available (may be natural state or forced)
|
|
37
|
+
*/
|
|
38
|
+
isEnabled: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the feature state is forced via the dev toolbar
|
|
41
|
+
* - true: State is overridden by developer, ignoring natural application state
|
|
42
|
+
* - false: State reflects the natural application configuration
|
|
43
|
+
*/
|
|
44
|
+
isForced: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Filter options for displaying features in the toolbar UI.
|
|
48
|
+
*
|
|
49
|
+
* - `'all'`: Show all configured features
|
|
50
|
+
* - `'forced'`: Show only features with isForced = true
|
|
51
|
+
* - `'enabled'`: Show only features with isEnabled = true (regardless of forced state)
|
|
52
|
+
* - `'disabled'`: Show only features with isEnabled = false (regardless of forced state)
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // Show only forced overrides
|
|
57
|
+
* const filter: AppFeatureFilter = 'forced';
|
|
58
|
+
*
|
|
59
|
+
* // Show all enabled features (natural or forced)
|
|
60
|
+
* const filter: AppFeatureFilter = 'enabled';
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export type AppFeatureFilter = 'all' | 'forced' | 'enabled' | 'disabled';
|
|
64
|
+
/**
|
|
65
|
+
* Internal storage format for persisted forced feature overrides in localStorage.
|
|
66
|
+
*
|
|
67
|
+
* **Storage Rules**:
|
|
68
|
+
* - Feature ID MUST NOT appear in both `enabled` and `disabled` arrays simultaneously
|
|
69
|
+
* - If feature forced to enabled, ID MUST be in `enabled` array and NOT in `disabled` array
|
|
70
|
+
* - If feature forced to disabled, ID MUST be in `disabled` array and NOT in `enabled` array
|
|
71
|
+
* - If feature not forced, ID MUST NOT be in either array
|
|
72
|
+
*
|
|
73
|
+
* **localStorage Key**: `AngularDevTools.app-features`
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* // Testing Enterprise tier (force premium features enabled)
|
|
78
|
+
* const enterpriseState: ForcedAppFeaturesState = {
|
|
79
|
+
* enabled: ['analytics', 'multi-user', 'white-label', 'sso-integration'],
|
|
80
|
+
* disabled: []
|
|
81
|
+
* };
|
|
82
|
+
*
|
|
83
|
+
* // Testing Basic tier (force premium features disabled)
|
|
84
|
+
* const basicState: ForcedAppFeaturesState = {
|
|
85
|
+
* enabled: [],
|
|
86
|
+
* disabled: ['analytics', 'multi-user', 'white-label', 'sso-integration']
|
|
87
|
+
* };
|
|
88
|
+
*
|
|
89
|
+
* // Mixed scenario
|
|
90
|
+
* const mixedState: ForcedAppFeaturesState = {
|
|
91
|
+
* enabled: ['analytics'], // Test analytics feature
|
|
92
|
+
* disabled: ['white-label'] // Ensure branding is off
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export interface ForcedAppFeaturesState {
|
|
97
|
+
/**
|
|
98
|
+
* Array of feature IDs forced to enabled state
|
|
99
|
+
* Features in this array will have isEnabled = true regardless of natural state
|
|
100
|
+
* @example ['advanced-analytics', 'white-label-branding']
|
|
101
|
+
*/
|
|
102
|
+
enabled: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Array of feature IDs forced to disabled state
|
|
105
|
+
* Features in this array will have isEnabled = false regardless of natural state
|
|
106
|
+
* @example ['basic-support', 'community-forums']
|
|
107
|
+
*/
|
|
108
|
+
disabled: string[];
|
|
109
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolsService } from '../../models/dev-tools.interface';
|
|
3
|
+
import { DevToolbarAppFeature, ForcedAppFeaturesState } from './app-features.models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Public service for managing app features in the dev toolbar.
|
|
7
|
+
*
|
|
8
|
+
* This service implements the DevToolsService interface and provides methods for:
|
|
9
|
+
* - Configuring available product features
|
|
10
|
+
* - Retrieving forced feature overrides
|
|
11
|
+
* - Applying preset feature configurations
|
|
12
|
+
* - Exporting current forced state for presets
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { DevToolbarAppFeaturesService } from 'ngx-dev-toolbar';
|
|
17
|
+
*
|
|
18
|
+
* @Component({...})
|
|
19
|
+
* export class AppComponent implements OnInit {
|
|
20
|
+
* private appFeaturesService = inject(DevToolbarAppFeaturesService);
|
|
21
|
+
*
|
|
22
|
+
* ngOnInit() {
|
|
23
|
+
* // Configure available features based on current tier
|
|
24
|
+
* const features: DevToolbarAppFeature[] = [
|
|
25
|
+
* { id: 'analytics', name: 'Analytics Dashboard', isEnabled: true, isForced: false },
|
|
26
|
+
* { id: 'multi-user', name: 'Multi-User Support', isEnabled: false, isForced: false }
|
|
27
|
+
* ];
|
|
28
|
+
* this.appFeaturesService.setAvailableOptions(features);
|
|
29
|
+
*
|
|
30
|
+
* // Subscribe to forced overrides
|
|
31
|
+
* this.appFeaturesService.getForcedValues().subscribe(forcedFeatures => {
|
|
32
|
+
* forcedFeatures.forEach(feature => {
|
|
33
|
+
* // Apply forced feature state to application logic
|
|
34
|
+
* this.applyFeatureState(feature.id, feature.isEnabled);
|
|
35
|
+
* });
|
|
36
|
+
* });
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class DevToolbarAppFeaturesService implements DevToolsService<DevToolbarAppFeature> {
|
|
42
|
+
private internalService;
|
|
43
|
+
/**
|
|
44
|
+
* Set available app features for the application.
|
|
45
|
+
*
|
|
46
|
+
* Configures the list of product features that can be toggled in the dev toolbar.
|
|
47
|
+
* Features should represent product-level capabilities like license tiers,
|
|
48
|
+
* deployment configurations, or environment flags.
|
|
49
|
+
*
|
|
50
|
+
* @param features - Array of app features to display in the toolbar
|
|
51
|
+
* @throws Error if duplicate feature IDs or empty IDs are detected
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const features: DevToolbarAppFeature[] = [
|
|
56
|
+
* {
|
|
57
|
+
* id: 'advanced-analytics',
|
|
58
|
+
* name: 'Advanced Analytics Dashboard',
|
|
59
|
+
* description: 'Access premium reporting and data visualization',
|
|
60
|
+
* isEnabled: false, // Not available in current tier
|
|
61
|
+
* isForced: false
|
|
62
|
+
* },
|
|
63
|
+
* {
|
|
64
|
+
* id: 'multi-user-support',
|
|
65
|
+
* name: 'Multi-User Collaboration',
|
|
66
|
+
* description: 'Enable team features and user management',
|
|
67
|
+
* isEnabled: true, // Available in current tier
|
|
68
|
+
* isForced: false
|
|
69
|
+
* }
|
|
70
|
+
* ];
|
|
71
|
+
* this.appFeaturesService.setAvailableOptions(features);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
setAvailableOptions(features: DevToolbarAppFeature[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get observable stream of features that have forced overrides.
|
|
77
|
+
*
|
|
78
|
+
* Emits an array of features that have been forced via the dev toolbar.
|
|
79
|
+
* Only features with `isForced = true` are included in the emissions.
|
|
80
|
+
* Use this to react to feature override changes and update application behavior.
|
|
81
|
+
*
|
|
82
|
+
* @returns Observable that emits array of forced features whenever state changes
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* this.appFeaturesService.getForcedValues()
|
|
87
|
+
* .pipe(takeUntilDestroyed())
|
|
88
|
+
* .subscribe(forcedFeatures => {
|
|
89
|
+
* forcedFeatures.forEach(feature => {
|
|
90
|
+
* if (feature.isEnabled) {
|
|
91
|
+
* this.enableFeature(feature.id);
|
|
92
|
+
* } else {
|
|
93
|
+
* this.disableFeature(feature.id);
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
getForcedValues(): Observable<DevToolbarAppFeature[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Apply a preset feature configuration (for preset tool integration).
|
|
102
|
+
*
|
|
103
|
+
* Accepts a forced features state object and applies it to the current configuration.
|
|
104
|
+
* Invalid feature IDs (not in configured features) are filtered out with a warning.
|
|
105
|
+
*
|
|
106
|
+
* @param state - Forced features state containing enabled/disabled arrays
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* // Apply "Enterprise Tier" preset
|
|
111
|
+
* const enterprisePreset: ForcedAppFeaturesState = {
|
|
112
|
+
* enabled: ['analytics', 'multi-user', 'white-label', 'sso'],
|
|
113
|
+
* disabled: []
|
|
114
|
+
* };
|
|
115
|
+
* this.appFeaturesService.applyPresetFeatures(enterprisePreset);
|
|
116
|
+
*
|
|
117
|
+
* // Apply "Basic Tier" preset
|
|
118
|
+
* const basicPreset: ForcedAppFeaturesState = {
|
|
119
|
+
* enabled: [],
|
|
120
|
+
* disabled: ['analytics', 'multi-user', 'white-label', 'sso']
|
|
121
|
+
* };
|
|
122
|
+
* this.appFeaturesService.applyPresetFeatures(basicPreset);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
applyPresetFeatures(state: ForcedAppFeaturesState): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get current forced feature state as a snapshot (for preset export).
|
|
128
|
+
*
|
|
129
|
+
* Returns the current forced features state with enabled/disabled arrays.
|
|
130
|
+
* Useful for exporting toolbar state to save as a preset or for debugging.
|
|
131
|
+
* Returns a defensive copy - mutations will not affect internal state.
|
|
132
|
+
*
|
|
133
|
+
* @returns Current forced features state
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* // Export current toolbar state to save as preset
|
|
138
|
+
* const currentState = this.appFeaturesService.getCurrentForcedState();
|
|
139
|
+
* this.presetsService.savePreset('my-config', {
|
|
140
|
+
* appFeatures: currentState,
|
|
141
|
+
* // ... other tool states
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* console.log(currentState);
|
|
145
|
+
* // { enabled: ['analytics'], disabled: ['white-label'] }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
getCurrentForcedState(): ForcedAppFeaturesState;
|
|
149
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarAppFeaturesService, never>;
|
|
150
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarAppFeaturesService>;
|
|
151
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolbarFlag } from './feature-flags.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarInternalFeatureFlagService {
|
|
5
|
+
private readonly STORAGE_KEY;
|
|
6
|
+
private storageService;
|
|
7
|
+
private appFlags$;
|
|
8
|
+
private forcedFlagsSubject;
|
|
9
|
+
private readonly forcedFlags$;
|
|
10
|
+
flags$: Observable<DevToolbarFlag[]>;
|
|
11
|
+
flags: import("@angular/core").Signal<DevToolbarFlag[]>;
|
|
12
|
+
constructor();
|
|
13
|
+
setAppFlags(flags: DevToolbarFlag[]): void;
|
|
14
|
+
getAppFlags(): Observable<DevToolbarFlag[]>;
|
|
15
|
+
getForcedFlags(): Observable<DevToolbarFlag[]>;
|
|
16
|
+
setFlag(flagId: string, isEnabled: boolean): void;
|
|
17
|
+
removeFlagOverride(flagId: string): void;
|
|
18
|
+
private loadForcedFlags;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalFeatureFlagService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalFeatureFlagService>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { DevToolbarFlag, FeatureFlagFilter } from './feature-flags.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarFeatureFlagsToolComponent {
|
|
5
|
+
private readonly featureFlags;
|
|
6
|
+
protected readonly activeFilter: import("@angular/core").WritableSignal<FeatureFlagFilter>;
|
|
7
|
+
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
8
|
+
protected readonly flags: import("@angular/core").Signal<DevToolbarFlag[]>;
|
|
9
|
+
protected readonly hasNoFlags: import("@angular/core").Signal<boolean>;
|
|
10
|
+
protected readonly filteredFlags: import("@angular/core").Signal<DevToolbarFlag[]>;
|
|
11
|
+
protected readonly hasNoFilteredFlags: import("@angular/core").Signal<boolean>;
|
|
12
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
13
|
+
protected readonly filterOptions: {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
protected readonly flagValueOptions: {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
onFilterChange(value: string | undefined): void;
|
|
22
|
+
onFlagChange(flagId: string, value: string): void;
|
|
23
|
+
onSearchChange(query: string): void;
|
|
24
|
+
protected getFlagValue(flag: DevToolbarFlag): string;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarFeatureFlagsToolComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarFeatureFlagsToolComponent, "ndt-feature-flags-tool", never, {}, {}, never, never, true, never>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolsService } from '../../models/dev-tools.interface';
|
|
3
|
+
import { DevToolbarFlag } from './feature-flags.models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class DevToolbarFeatureFlagService implements DevToolsService<DevToolbarFlag> {
|
|
6
|
+
private internalService;
|
|
7
|
+
/**
|
|
8
|
+
* Sets the available flags that will be displayed in the tool on the dev toolbar
|
|
9
|
+
* @param flags The flags to be displayed
|
|
10
|
+
*/
|
|
11
|
+
setAvailableOptions(flags: DevToolbarFlag[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the flags that were forced/modified through the tool on the dev toolbar
|
|
14
|
+
* @returns Observable of forced flags array
|
|
15
|
+
*/
|
|
16
|
+
getForcedValues(): Observable<DevToolbarFlag[]>;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarFeatureFlagService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarFeatureFlagService>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { DevToolbarStateService } from '../../dev-toolbar-state.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarHomeToolComponent {
|
|
5
|
+
protected readonly state: DevToolbarStateService;
|
|
6
|
+
private readonly settingsService;
|
|
7
|
+
private readonly storageService;
|
|
8
|
+
readonly badge: import("@angular/core").InputSignal<string | number | undefined>;
|
|
9
|
+
readonly title = "Angular Dev Toolbar";
|
|
10
|
+
readonly options: DevToolbarWindowOptions;
|
|
11
|
+
readonly links: readonly [{
|
|
12
|
+
readonly icon: "bug";
|
|
13
|
+
readonly url: "https://github.com/alfredoperez/ngx-dev-toolbar/issues";
|
|
14
|
+
readonly label: "Bug report";
|
|
15
|
+
}, {
|
|
16
|
+
readonly icon: "lightbulb";
|
|
17
|
+
readonly url: "https://github.com/alfredoperez/ngx-dev-toolbar/discussions";
|
|
18
|
+
readonly label: "Suggestions";
|
|
19
|
+
}, {
|
|
20
|
+
readonly icon: "docs";
|
|
21
|
+
readonly url: "https://alfredoperez.github.io/ngx-dev-toolbar/";
|
|
22
|
+
readonly label: "Docs";
|
|
23
|
+
}, {
|
|
24
|
+
readonly icon: "star";
|
|
25
|
+
readonly url: "https://github.com/alfredoperez/ngx-dev-toolbar";
|
|
26
|
+
readonly label: "Star on GitHub";
|
|
27
|
+
}, {
|
|
28
|
+
readonly icon: "discord";
|
|
29
|
+
readonly url: "https://discord.com/invite/angular";
|
|
30
|
+
readonly label: "Community";
|
|
31
|
+
}];
|
|
32
|
+
onToggleTheme(): void;
|
|
33
|
+
onExportSettings(): void;
|
|
34
|
+
onImportSettings(): void;
|
|
35
|
+
onResetSettings(): void;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarHomeToolComponent, never>;
|
|
37
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarHomeToolComponent, "ndt-home-tool", never, { "badge": { "alias": "badge"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Settings } from './settings.models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SettingsService {
|
|
4
|
+
private readonly STORAGE_KEY;
|
|
5
|
+
private readonly storageService;
|
|
6
|
+
getSettings(): Settings;
|
|
7
|
+
setSettings(settings: Settings): void;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SettingsService, never>;
|
|
9
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SettingsService>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Language } from './language.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarInternalLanguageService {
|
|
5
|
+
private readonly STORAGE_KEY;
|
|
6
|
+
private readonly storageService;
|
|
7
|
+
private languages$;
|
|
8
|
+
private forcedLanguage$;
|
|
9
|
+
languages: import("@angular/core").Signal<Language[]>;
|
|
10
|
+
constructor();
|
|
11
|
+
setAppLanguages(languages: Language[]): void;
|
|
12
|
+
getAppLanguages(): Observable<Language[]>;
|
|
13
|
+
setForcedLanguage(language: Language): void;
|
|
14
|
+
getForcedLanguage(): Observable<Language[]>;
|
|
15
|
+
removeForcedLanguage(): void;
|
|
16
|
+
private loadForcedLanguage;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalLanguageService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalLanguageService>;
|
|
19
|
+
}
|