ngx-dev-toolbar 1.0.4 → 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.
@@ -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
+ }