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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DevToolbarLanguageToolComponent {
|
|
4
|
+
private readonly languageService;
|
|
5
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
6
|
+
activeLanguage: import("@angular/core").WritableSignal<string>;
|
|
7
|
+
languageOptions: import("@angular/core").Signal<{
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
onLanguageChange(language: string): Promise<void>;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarLanguageToolComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarLanguageToolComponent, "ndt-language-tool", never, {}, {}, never, never, true, never>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolsService } from '../../models/dev-tools.interface';
|
|
3
|
+
import { Language } from './language.models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class DevToolbarLanguageService implements DevToolsService<Language> {
|
|
6
|
+
private internalService;
|
|
7
|
+
/**
|
|
8
|
+
* Sets the available languages that will be displayed in the tool on the dev toolbar
|
|
9
|
+
* @param languages The languages to be displayed
|
|
10
|
+
*/
|
|
11
|
+
setAvailableOptions(languages: Language[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the languages that were forced/modified through the tool on the dev toolbar
|
|
14
|
+
* @returns Observable of forced languages array
|
|
15
|
+
*/
|
|
16
|
+
getForcedValues(): Observable<Language[]>;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarLanguageService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarLanguageService>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DevToolbarNetworkMockerToolComponent {
|
|
4
|
+
private readonly networkMockerService;
|
|
5
|
+
protected readonly newMockUrl: import("@angular/core").WritableSignal<string>;
|
|
6
|
+
protected readonly newMockMethod: import("@angular/core").WritableSignal<string>;
|
|
7
|
+
protected readonly newMockStatus: import("@angular/core").WritableSignal<string>;
|
|
8
|
+
protected readonly newMockResponse: import("@angular/core").WritableSignal<string>;
|
|
9
|
+
protected readonly mockRequests: import("@angular/core").Signal<import("./network-mocker.models").MockRequest[]>;
|
|
10
|
+
protected readonly isMockingEnabled: import("@angular/core").Signal<boolean>;
|
|
11
|
+
protected readonly hasNoMocks: import("@angular/core").Signal<boolean>;
|
|
12
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
13
|
+
protected readonly httpMethods: {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
protected onAddMock(): void;
|
|
18
|
+
protected onToggleMocking(): void;
|
|
19
|
+
protected onToggleMock(mockId: string): void;
|
|
20
|
+
protected onRemoveMock(mockId: string): void;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarNetworkMockerToolComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarNetworkMockerToolComponent, "ndt-network-mocker-tool", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface MockRequest {
|
|
2
|
+
id: string;
|
|
3
|
+
url: string;
|
|
4
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
5
|
+
status: number;
|
|
6
|
+
response: any;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
}
|
|
10
|
+
export interface MockRequestConfig {
|
|
11
|
+
url: string;
|
|
12
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
13
|
+
status?: number;
|
|
14
|
+
response?: any;
|
|
15
|
+
delay?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MockRequest, MockRequestConfig } from './network-mocker.models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DevToolbarNetworkMockerService {
|
|
4
|
+
private readonly mockRequests;
|
|
5
|
+
private readonly isMockingEnabled;
|
|
6
|
+
getMockRequests(): import("@angular/core").Signal<MockRequest[]>;
|
|
7
|
+
getIsMockingEnabled(): import("@angular/core").Signal<boolean>;
|
|
8
|
+
addMockRequest(config: MockRequestConfig): void;
|
|
9
|
+
removeMockRequest(id: string): void;
|
|
10
|
+
toggleMockRequest(id: string): void;
|
|
11
|
+
enableMocking(): void;
|
|
12
|
+
disableMocking(): void;
|
|
13
|
+
clearAllMocks(): void;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarNetworkMockerService, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarNetworkMockerService>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DevToolbarPermission, ForcedPermissionsState } from './permissions.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarInternalPermissionsService {
|
|
5
|
+
private readonly STORAGE_KEY;
|
|
6
|
+
private storageService;
|
|
7
|
+
private appPermissions$;
|
|
8
|
+
private forcedStateSubject;
|
|
9
|
+
private readonly forcedState$;
|
|
10
|
+
permissions$: Observable<DevToolbarPermission[]>;
|
|
11
|
+
permissions: import("@angular/core").Signal<DevToolbarPermission[]>;
|
|
12
|
+
constructor();
|
|
13
|
+
setAppPermissions(permissions: DevToolbarPermission[]): void;
|
|
14
|
+
setPermission(id: string, granted: boolean): void;
|
|
15
|
+
removePermissionOverride(id: string): void;
|
|
16
|
+
getForcedPermissions(): Observable<DevToolbarPermission[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Apply a preset permissions state, replacing the current forced state.
|
|
19
|
+
* Useful for automated testing or restoring saved configurations.
|
|
20
|
+
* @param state The preset forced permissions state to apply
|
|
21
|
+
*/
|
|
22
|
+
applyPresetPermissions(state: ForcedPermissionsState): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the current forced permissions state.
|
|
25
|
+
* Returns a deep copy to prevent external mutations.
|
|
26
|
+
* @returns Current forced permissions state
|
|
27
|
+
*/
|
|
28
|
+
getCurrentForcedState(): ForcedPermissionsState;
|
|
29
|
+
private loadForcedState;
|
|
30
|
+
private isValidForcedState;
|
|
31
|
+
private validateAndCleanForcedState;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalPermissionsService, never>;
|
|
33
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalPermissionsService>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DevToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { DevToolbarPermission, PermissionFilter } from './permissions.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DevToolbarPermissionsToolComponent {
|
|
5
|
+
private readonly permissionsService;
|
|
6
|
+
protected readonly activeFilter: import("@angular/core").WritableSignal<PermissionFilter>;
|
|
7
|
+
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
8
|
+
protected readonly permissions: import("@angular/core").Signal<DevToolbarPermission[]>;
|
|
9
|
+
protected readonly hasNoPermissions: import("@angular/core").Signal<boolean>;
|
|
10
|
+
protected readonly filteredPermissions: import("@angular/core").Signal<DevToolbarPermission[]>;
|
|
11
|
+
protected readonly hasNoFilteredPermissions: import("@angular/core").Signal<boolean>;
|
|
12
|
+
protected readonly options: DevToolbarWindowOptions;
|
|
13
|
+
protected readonly filterOptions: {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
protected readonly permissionValueOptions: {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
onFilterChange(value: string | undefined): void;
|
|
22
|
+
onPermissionChange(id: string, value: string): void;
|
|
23
|
+
onSearchChange(query: string): void;
|
|
24
|
+
protected getPermissionValue(permission: DevToolbarPermission): string;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarPermissionsToolComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarPermissionsToolComponent, "ndt-permissions-tool", never, {}, {}, never, never, true, never>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a permission in the developer toolbar.
|
|
3
|
+
* Used to configure and override application permissions for testing.
|
|
4
|
+
*/
|
|
5
|
+
export interface DevToolbarPermission {
|
|
6
|
+
/** Unique identifier for the permission */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Human-readable name displayed in the UI */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Optional description explaining the permission's purpose */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Whether the permission is currently granted */
|
|
13
|
+
isGranted: boolean;
|
|
14
|
+
/** Whether the permission's value has been overridden through the toolbar */
|
|
15
|
+
isForced: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal state representing forced permission overrides.
|
|
19
|
+
* Persisted to localStorage for session continuity.
|
|
20
|
+
*/
|
|
21
|
+
export interface ForcedPermissionsState {
|
|
22
|
+
/** Array of permission IDs that are forced to granted */
|
|
23
|
+
granted: string[];
|
|
24
|
+
/** Array of permission IDs that are forced to denied */
|
|
25
|
+
denied: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Filter options for displaying permissions in the tool.
|
|
29
|
+
*/
|
|
30
|
+
export type PermissionFilter = 'all' | 'forced' | 'granted' | 'denied';
|
|
31
|
+
/**
|
|
32
|
+
* Permission value options for the dropdown control.
|
|
33
|
+
*/
|
|
34
|
+
export type PermissionValue = 'not-forced' | 'granted' | 'denied';
|
|
@@ -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,18 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class DevToolsStorageService {
|
|
3
|
+
private readonly PREFIX;
|
|
4
|
+
private readonly TOOLS_KEY;
|
|
5
|
+
private readonly SETTINGS_KEY;
|
|
6
|
+
set<T>(key: string, value: T): void;
|
|
7
|
+
get<T>(key: string): T | null;
|
|
8
|
+
remove(key: string): void;
|
|
9
|
+
getAllSettings(): Record<string, unknown>;
|
|
10
|
+
setAllSettings(settings: Record<string, unknown>): void;
|
|
11
|
+
clearAllSettings(): void;
|
|
12
|
+
getToolKeys(): string[];
|
|
13
|
+
private addToolKey;
|
|
14
|
+
private removeToolKey;
|
|
15
|
+
private getToolKey;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolsStorageService, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolsStorageService>;
|
|
18
|
+
}
|
package/eslint.config.cjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const nx = require('@nx/eslint-plugin');
|
|
2
|
-
const baseConfig = require('../../eslint.config.cjs');
|
|
3
|
-
|
|
4
|
-
module.exports = [
|
|
5
|
-
...baseConfig,
|
|
6
|
-
{
|
|
7
|
-
files: ['**/*.json'],
|
|
8
|
-
rules: {
|
|
9
|
-
'@nx/dependency-checks': 'off',
|
|
10
|
-
},
|
|
11
|
-
ignores: ['**/eslint.config.cjs'],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
files: ['**/*.json'],
|
|
15
|
-
languageOptions: {
|
|
16
|
-
parser: require('jsonc-eslint-parser'),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
...nx.configs['flat/angular'],
|
|
20
|
-
...nx.configs['flat/angular-template'],
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.ts'],
|
|
23
|
-
rules: {
|
|
24
|
-
'@angular-eslint/directive-selector': [
|
|
25
|
-
'error',
|
|
26
|
-
{
|
|
27
|
-
type: 'attribute',
|
|
28
|
-
prefix: 'ndt',
|
|
29
|
-
style: 'camelCase',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
'@angular-eslint/component-selector': [
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
type: 'element',
|
|
36
|
-
prefix: 'ndt',
|
|
37
|
-
style: 'kebab-case',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
files: ['**/*.html'],
|
|
44
|
-
// Override or add rules here
|
|
45
|
-
rules: {},
|
|
46
|
-
},
|
|
47
|
-
];
|
package/ng-package.json
DELETED
package/project.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ngx-dev-toolbar",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/ngx-dev-toolbar/src",
|
|
5
|
-
"prefix": "ndt",
|
|
6
|
-
"projectType": "library",
|
|
7
|
-
"tags": [],
|
|
8
|
-
"targets": {
|
|
9
|
-
"build": {
|
|
10
|
-
"executor": "@nx/angular:package",
|
|
11
|
-
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
12
|
-
"options": {
|
|
13
|
-
"project": "libs/ngx-dev-toolbar/ng-package.json"
|
|
14
|
-
},
|
|
15
|
-
"configurations": {
|
|
16
|
-
"production": {
|
|
17
|
-
"tsConfig": "libs/ngx-dev-toolbar/tsconfig.lib.prod.json"
|
|
18
|
-
},
|
|
19
|
-
"development": {
|
|
20
|
-
"tsConfig": "libs/ngx-dev-toolbar/tsconfig.lib.json"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"defaultConfiguration": "production"
|
|
24
|
-
},
|
|
25
|
-
"test": {
|
|
26
|
-
"executor": "@nx/vite:test",
|
|
27
|
-
"outputs": ["{options.reportsDirectory}"],
|
|
28
|
-
"options": {
|
|
29
|
-
"reportsDirectory": "../../coverage/libs/ngx-dev-toolbar"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"lint": {
|
|
33
|
-
"executor": "@nx/eslint:lint"
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
@use '../../styles' as devtools;
|
|
2
|
-
|
|
3
|
-
.button {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: var(--ndt-spacing-xs);
|
|
7
|
-
padding: var(--ndt-spacing-xs) var(--ndt-spacing-sm);
|
|
8
|
-
border: 1px solid var(--ndt-border-primary);
|
|
9
|
-
border-radius: var(--ndt-border-radius-medium);
|
|
10
|
-
background: var(--ndt-bg-primary);
|
|
11
|
-
color: var(--ndt-text-primary);
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
transition: var(--ndt-transition-default);
|
|
14
|
-
outline: none;
|
|
15
|
-
font-family: inherit;
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
background: var(--ndt-hover-bg);
|
|
19
|
-
border-color: var(--ndt-primary);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:focus-visible {
|
|
23
|
-
outline: none;
|
|
24
|
-
background: var(--ndt-hover-bg);
|
|
25
|
-
box-shadow: 0 0 0 2px rgba(var(--ndt-primary-rgb), 0.2);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.primary {
|
|
29
|
-
background: var(--ndt-primary);
|
|
30
|
-
color: var(--ndt-text-on-primary);
|
|
31
|
-
border-color: var(--ndt-primary);
|
|
32
|
-
|
|
33
|
-
&:hover {
|
|
34
|
-
background: var(--ndt-primary);
|
|
35
|
-
border-color: var(--ndt-primary);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.icon-only {
|
|
40
|
-
padding: var(--ndt-spacing-xs);
|
|
41
|
-
width: 32px;
|
|
42
|
-
height: 32px;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.small {
|
|
47
|
-
font-size: var(--ndt-font-size-sm);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
-
import { DevToolbarIconComponent } from '../icons/icon.component';
|
|
3
|
-
import { IconName } from '../icons/icon.models';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'ndt-button',
|
|
7
|
-
standalone: true,
|
|
8
|
-
imports: [DevToolbarIconComponent],
|
|
9
|
-
template: `
|
|
10
|
-
<button
|
|
11
|
-
class="button"
|
|
12
|
-
[attr.aria-label]="ariaLabel()"
|
|
13
|
-
[type]="type()"
|
|
14
|
-
[class.button--active]="isActive()"
|
|
15
|
-
[class.button--icon]="variant() === 'icon'"
|
|
16
|
-
>
|
|
17
|
-
@if (icon()) {
|
|
18
|
-
<ndt-icon [name]="icon() || 'star'" />
|
|
19
|
-
}
|
|
20
|
-
@if (label()) {
|
|
21
|
-
<span class="button__label">{{ label() }}</span>
|
|
22
|
-
}
|
|
23
|
-
<ng-content />
|
|
24
|
-
</button>
|
|
25
|
-
`,
|
|
26
|
-
styleUrls: ['./button.component.scss'],
|
|
27
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
-
})
|
|
29
|
-
export class DevToolbarButtonComponent {
|
|
30
|
-
readonly type = input<'button' | 'submit' | 'reset'>('button');
|
|
31
|
-
readonly variant = input<'default' | 'icon'>('default');
|
|
32
|
-
readonly icon = input<IconName>();
|
|
33
|
-
readonly label = input<string>();
|
|
34
|
-
readonly ariaLabel = input<string>();
|
|
35
|
-
readonly isActive = input<boolean>(false);
|
|
36
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.card {
|
|
2
|
-
background: var(--ndt-bg-primary);
|
|
3
|
-
border-radius: var(--ndt-border-radius-large);
|
|
4
|
-
padding: var(--ndt-spacing-md);
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
transition: var(--ndt-transition-default);
|
|
7
|
-
border: 1px solid var(--ndt-border-subtle);
|
|
8
|
-
position: relative;
|
|
9
|
-
flex: 1;
|
|
10
|
-
height: 120px;
|
|
11
|
-
display: flex;
|
|
12
|
-
|
|
13
|
-
&:hover {
|
|
14
|
-
background: var(--ndt-hover-bg);
|
|
15
|
-
border-color: var(--ndt-primary);
|
|
16
|
-
box-shadow: 0 0 0 1px rgba(var(--ndt-primary-rgb), 0.3);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Component, signal } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'ndt-card',
|
|
5
|
-
standalone: true,
|
|
6
|
-
template: `
|
|
7
|
-
<div
|
|
8
|
-
class="card"
|
|
9
|
-
role="button"
|
|
10
|
-
tabindex="0"
|
|
11
|
-
(click)="onClick()"
|
|
12
|
-
(keydown.enter)="onClick()"
|
|
13
|
-
(keydown.space)="onClick()"
|
|
14
|
-
[class.card--hover]="isHovered()"
|
|
15
|
-
(mouseenter)="isHovered.set(true)"
|
|
16
|
-
(mouseleave)="isHovered.set(false)"
|
|
17
|
-
>
|
|
18
|
-
<ng-content></ng-content>
|
|
19
|
-
</div>
|
|
20
|
-
`,
|
|
21
|
-
styleUrls: ['./card.component.scss'],
|
|
22
|
-
})
|
|
23
|
-
export class DevToolbarCardComponent {
|
|
24
|
-
readonly click = signal<void>(undefined);
|
|
25
|
-
protected readonly isHovered = signal(false);
|
|
26
|
-
|
|
27
|
-
onClick(): void {
|
|
28
|
-
this.click.set();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.clickable-card {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: var(--ndt-spacing-sm);
|
|
5
|
-
height: 100%;
|
|
6
|
-
|
|
7
|
-
&__icon {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
width: 32px;
|
|
12
|
-
height: 32px;
|
|
13
|
-
border-radius: var(--ndt-border-radius-medium);
|
|
14
|
-
background: var(--ndt-hover-bg);
|
|
15
|
-
color: var(--ndt-text-primary);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&__content {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
gap: var(--ndt-spacing-xs);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&__title {
|
|
25
|
-
color: var(--ndt-text-primary);
|
|
26
|
-
font-size: var(--ndt-font-size-sm);
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&__subtitle {
|
|
31
|
-
color: var(--ndt-text-muted);
|
|
32
|
-
font-size: var(--ndt-font-size-xs);
|
|
33
|
-
line-height: 1.4;
|
|
34
|
-
display: -webkit-box;
|
|
35
|
-
-webkit-line-clamp: 2;
|
|
36
|
-
-webkit-box-orient: vertical;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Component, input, signal } from '@angular/core';
|
|
2
|
-
import { DevToolbarCardComponent } from '../card/card.component';
|
|
3
|
-
import { DevToolbarIconComponent } from '../icons/icon.component';
|
|
4
|
-
import { IconName } from '../icons/icon.models';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'ndt-clickable-card',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [DevToolbarCardComponent, DevToolbarIconComponent],
|
|
10
|
-
template: `
|
|
11
|
-
<ndt-card (clicked)="onClick()">
|
|
12
|
-
<div class="clickable-card">
|
|
13
|
-
<div class="clickable-card__icon">
|
|
14
|
-
<ndt-icon [name]="icon()" />
|
|
15
|
-
</div>
|
|
16
|
-
<div class="clickable-card__content">
|
|
17
|
-
<div class="clickable-card__title">{{ title() }}</div>
|
|
18
|
-
<div class="clickable-card__subtitle">{{ subtitle() }}</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</ndt-card>
|
|
22
|
-
`,
|
|
23
|
-
styleUrls: ['./clickable-card.component.scss'],
|
|
24
|
-
})
|
|
25
|
-
export class DevToolbarClickableCardComponent {
|
|
26
|
-
readonly icon = input.required<IconName>();
|
|
27
|
-
readonly title = input.required<string>();
|
|
28
|
-
readonly subtitle = input.required<string>();
|
|
29
|
-
readonly click = signal<void>(undefined);
|
|
30
|
-
|
|
31
|
-
onClick(): void {
|
|
32
|
-
this.click.set();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'ndt-angular-icon',
|
|
5
|
-
standalone: true,
|
|
6
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7
|
-
template: `
|
|
8
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9
|
-
<defs>
|
|
10
|
-
<linearGradient
|
|
11
|
-
id="angular-gradient"
|
|
12
|
-
x1="6"
|
|
13
|
-
x2="18"
|
|
14
|
-
y1="20"
|
|
15
|
-
y2="4"
|
|
16
|
-
gradientUnits="userSpaceOnUse"
|
|
17
|
-
>
|
|
18
|
-
<stop offset="0" stop-color="#E40035" />
|
|
19
|
-
<stop offset=".24" stop-color="#F60A48" />
|
|
20
|
-
<stop offset=".352" stop-color="#F20755" />
|
|
21
|
-
<stop offset=".494" stop-color="#DC087D" />
|
|
22
|
-
<stop offset=".745" stop-color="#9717E7" />
|
|
23
|
-
<stop offset="1" stop-color="#6C00F5" />
|
|
24
|
-
</linearGradient>
|
|
25
|
-
</defs>
|
|
26
|
-
<g fill="url(#angular-gradient)">
|
|
27
|
-
<polygon points="14.1,2.7 20.1,15.7 20.7,5.8" />
|
|
28
|
-
<polygon points="15.6,16.4 8.4,16.4 7.4,18.6 12,21.2 16.6,18.6" />
|
|
29
|
-
<polygon points="9.6,13.5 14.4,13.5 12,7.7" />
|
|
30
|
-
<polygon points="9.9,2.7 3.3,5.8 3.9,15.7" />
|
|
31
|
-
</g>
|
|
32
|
-
</svg>
|
|
33
|
-
`,
|
|
34
|
-
})
|
|
35
|
-
export class AngularIconComponent {}
|