ngx-dev-toolbar 1.0.4 → 2.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.
- package/components/icons/bolt-icon.component.d.ts +6 -0
- package/components/icons/filter-icon.component.d.ts +6 -0
- package/components/icons/icon.models.d.ts +1 -1
- package/components/icons/lock-icon.component.d.ts +6 -0
- package/components/select/select.component.d.ts +1 -1
- package/components/window/window.component.d.ts +1 -1
- package/dev-toolbar-state.service.d.ts +1 -1
- package/dev-toolbar.component.d.ts +3 -2
- package/fesm2022/ngx-dev-toolbar.mjs +2074 -139
- package/fesm2022/ngx-dev-toolbar.mjs.map +1 -1
- package/index.d.ts +10 -0
- package/models/dev-toolbar-config.interface.d.ts +31 -0
- package/package.json +2 -2
- 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 +15 -0
- package/tools/language-tool/language-internal.service.d.ts +10 -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/tools/presets-tool/presets-internal.service.d.ts +57 -0
- package/tools/presets-tool/presets-tool.component.d.ts +33 -0
- package/tools/presets-tool/presets.models.d.ts +24 -0
- package/tools/presets-tool/presets.service.d.ts +51 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolsService } from '../../models/dev-tools.interface';
|
|
3
|
+
import { DevToolbarPermission, ForcedPermissionsState } from './permissions.models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Public service for integrating the Permissions Tool with your application.
|
|
7
|
+
* Use this service to:
|
|
8
|
+
* 1. Register your application's permissions with setAvailableOptions()
|
|
9
|
+
* 2. Listen for toolbar permission overrides with getForcedValues()
|
|
10
|
+
* 3. Apply preset permission states for testing with applyPreset()
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* constructor(private permissionsService: DevToolbarPermissionsService) {
|
|
15
|
+
* // Register permissions
|
|
16
|
+
* this.permissionsService.setAvailableOptions([
|
|
17
|
+
* { id: 'can-edit', name: 'Can Edit', isGranted: false, isForced: false }
|
|
18
|
+
* ]);
|
|
19
|
+
*
|
|
20
|
+
* // Listen for overrides
|
|
21
|
+
* this.permissionsService.getForcedValues().subscribe(forcedPermissions => {
|
|
22
|
+
* // Update your app's permission state
|
|
23
|
+
* });
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class DevToolbarPermissionsService implements DevToolsService<DevToolbarPermission> {
|
|
28
|
+
private internalService;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the available permissions that will be displayed in the toolbar tool.
|
|
31
|
+
* Call this in your app initialization to register permissions.
|
|
32
|
+
*
|
|
33
|
+
* @param permissions Array of permissions to display in the toolbar
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* this.permissionsService.setAvailableOptions([
|
|
38
|
+
* {
|
|
39
|
+
* id: 'can-edit-posts',
|
|
40
|
+
* name: 'Edit Posts',
|
|
41
|
+
* description: 'Can edit blog posts',
|
|
42
|
+
* isGranted: false,
|
|
43
|
+
* isForced: false
|
|
44
|
+
* }
|
|
45
|
+
* ]);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
setAvailableOptions(permissions: DevToolbarPermission[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* Gets an observable of permissions that were forced/overridden through the toolbar.
|
|
51
|
+
* Subscribe to this to update your application's permission state.
|
|
52
|
+
*
|
|
53
|
+
* @returns Observable emitting array of forced permissions whenever changes occur
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* this.permissionsService.getForcedValues().subscribe(forcedPermissions => {
|
|
58
|
+
* forcedPermissions.forEach(permission => {
|
|
59
|
+
* this.updatePermission(permission.id, permission.isGranted);
|
|
60
|
+
* });
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
getForcedValues(): Observable<DevToolbarPermission[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Apply a preset permission state. Useful for automated testing scenarios.
|
|
67
|
+
*
|
|
68
|
+
* @param state The forced permissions state to apply
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* this.permissionsService.applyPreset({
|
|
73
|
+
* granted: ['can-edit-posts'],
|
|
74
|
+
* denied: ['can-delete-posts']
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
applyPreset(state: ForcedPermissionsState): void;
|
|
79
|
+
/**
|
|
80
|
+
* Get the current forced permission state.
|
|
81
|
+
*
|
|
82
|
+
* @returns Current forced permissions state
|
|
83
|
+
*/
|
|
84
|
+
getCurrentState(): ForcedPermissionsState;
|
|
85
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarPermissionsService, never>;
|
|
86
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarPermissionsService>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolbarPreset } from './presets.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Internal service for managing presets state.
|
|
6
|
+
* Handles CRUD operations, captures current toolbar config, and applies presets.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DevToolbarInternalPresetsService {
|
|
9
|
+
private readonly STORAGE_KEY;
|
|
10
|
+
private storageService;
|
|
11
|
+
private featureFlagsService;
|
|
12
|
+
private languageService;
|
|
13
|
+
private permissionsService;
|
|
14
|
+
private appFeaturesService;
|
|
15
|
+
private presetsSubject;
|
|
16
|
+
presets$: Observable<DevToolbarPreset[]>;
|
|
17
|
+
presets: import("@angular/core").Signal<DevToolbarPreset[]>;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Capture current toolbar state as a new preset
|
|
21
|
+
*/
|
|
22
|
+
saveCurrentAsPreset(name: string, description?: string): DevToolbarPreset;
|
|
23
|
+
/**
|
|
24
|
+
* Apply a preset to all tools (THIS IS THE KEY METHOD)
|
|
25
|
+
*/
|
|
26
|
+
applyPreset(presetId: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Update an existing preset with current toolbar state
|
|
29
|
+
*/
|
|
30
|
+
updatePreset(presetId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Delete a preset
|
|
33
|
+
*/
|
|
34
|
+
deletePreset(presetId: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Add a preset (used for import)
|
|
37
|
+
*/
|
|
38
|
+
addPreset(preset: DevToolbarPreset): DevToolbarPreset;
|
|
39
|
+
/**
|
|
40
|
+
* Get a preset by ID
|
|
41
|
+
*/
|
|
42
|
+
getPresetById(presetId: string): DevToolbarPreset | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Capture current configuration from all tools
|
|
45
|
+
*/
|
|
46
|
+
private captureCurrentConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Load presets from localStorage
|
|
49
|
+
*/
|
|
50
|
+
private loadPresets;
|
|
51
|
+
/**
|
|
52
|
+
* Generate unique preset ID
|
|
53
|
+
*/
|
|
54
|
+
private generateId;
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalPresetsService, never>;
|
|
56
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalPresetsService>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DevToolbarPresetsToolComponent {
|
|
4
|
+
private readonly presetsService;
|
|
5
|
+
private readonly featureFlagsService;
|
|
6
|
+
private readonly permissionsService;
|
|
7
|
+
private readonly appFeaturesService;
|
|
8
|
+
private readonly languageService;
|
|
9
|
+
protected readonly viewMode: import("@angular/core").WritableSignal<"list" | "create">;
|
|
10
|
+
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
11
|
+
protected readonly presetName: import("@angular/core").WritableSignal<string>;
|
|
12
|
+
protected readonly presetDescription: import("@angular/core").WritableSignal<string>;
|
|
13
|
+
protected readonly presets: import("@angular/core").Signal<import("ngx-dev-toolbar").DevToolbarPreset[]>;
|
|
14
|
+
protected readonly filteredPresets: import("@angular/core").Signal<import("ngx-dev-toolbar").DevToolbarPreset[]>;
|
|
15
|
+
protected readonly hasNoPresets: import("@angular/core").Signal<boolean>;
|
|
16
|
+
protected readonly hasNoFilteredPresets: import("@angular/core").Signal<boolean>;
|
|
17
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
18
|
+
onSearchChange(query: string): void;
|
|
19
|
+
onSwitchToCreateMode(): void;
|
|
20
|
+
onSwitchToListMode(): void;
|
|
21
|
+
onSavePreset(event: Event): void;
|
|
22
|
+
onApplyPreset(presetId: string): void;
|
|
23
|
+
onUpdatePreset(presetId: string): void;
|
|
24
|
+
onExportPreset(presetId: string): void;
|
|
25
|
+
onDeletePreset(presetId: string): void;
|
|
26
|
+
protected getCurrentFlagsCount(): number;
|
|
27
|
+
protected getCurrentPermissionsCount(): number;
|
|
28
|
+
protected getCurrentAppFeaturesCount(): number;
|
|
29
|
+
protected getCurrentLanguage(): string;
|
|
30
|
+
protected formatDate(isoString: string): string;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarPresetsToolComponent, never>;
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarPresetsToolComponent, "ndt-presets-tool", never, {}, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface DevToolbarPreset {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
updatedAt: string;
|
|
7
|
+
config: DevToolbarPresetConfig;
|
|
8
|
+
}
|
|
9
|
+
export interface DevToolbarPresetConfig {
|
|
10
|
+
featureFlags: {
|
|
11
|
+
enabled: string[];
|
|
12
|
+
disabled: string[];
|
|
13
|
+
};
|
|
14
|
+
language: string | null;
|
|
15
|
+
permissions: {
|
|
16
|
+
granted: string[];
|
|
17
|
+
denied: string[];
|
|
18
|
+
};
|
|
19
|
+
appFeatures: {
|
|
20
|
+
enabled: string[];
|
|
21
|
+
disabled: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export type PresetFilter = 'all' | 'recent' | 'favorites';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolbarPreset } from './presets.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Public service for managing dev toolbar presets.
|
|
6
|
+
* Allows developers to programmatically save, load, and manage presets.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DevToolbarPresetsService {
|
|
9
|
+
private internalService;
|
|
10
|
+
/**
|
|
11
|
+
* Get all saved presets as an Observable
|
|
12
|
+
*/
|
|
13
|
+
getPresets(): Observable<DevToolbarPreset[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Save current toolbar state as a preset
|
|
16
|
+
* @param name - Name for the preset
|
|
17
|
+
* @param description - Optional description
|
|
18
|
+
* @returns The created preset
|
|
19
|
+
*/
|
|
20
|
+
savePreset(name: string, description?: string): DevToolbarPreset;
|
|
21
|
+
/**
|
|
22
|
+
* Apply a preset (load its configuration into all tools)
|
|
23
|
+
* @param presetId - ID of the preset to apply
|
|
24
|
+
*/
|
|
25
|
+
applyPreset(presetId: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Update a preset with current toolbar state
|
|
28
|
+
* @param presetId - ID of the preset to update
|
|
29
|
+
*/
|
|
30
|
+
updatePreset(presetId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Delete a preset
|
|
33
|
+
* @param presetId - ID of the preset to delete
|
|
34
|
+
*/
|
|
35
|
+
deletePreset(presetId: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Export a preset as JSON string
|
|
38
|
+
* @param presetId - ID of the preset to export
|
|
39
|
+
* @returns JSON string representation of the preset
|
|
40
|
+
*/
|
|
41
|
+
exportPreset(presetId: string): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Import a preset from JSON string
|
|
44
|
+
* @param json - JSON string representation of a preset
|
|
45
|
+
* @returns The imported preset
|
|
46
|
+
* @throws Error if JSON is invalid
|
|
47
|
+
*/
|
|
48
|
+
importPreset(json: string): DevToolbarPreset;
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarPresetsService, never>;
|
|
50
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarPresetsService>;
|
|
51
|
+
}
|