ngx-dev-toolbar 1.0.5 → 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/icon.component.d.ts +1 -1
- package/dev-toolbar.component.d.ts +3 -2
- package/fesm2022/ngx-dev-toolbar.mjs +758 -354
- package/fesm2022/ngx-dev-toolbar.mjs.map +1 -1
- package/index.d.ts +4 -3
- package/models/dev-toolbar-config.interface.d.ts +31 -0
- package/package.json +1 -1
- 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/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
- package/tools/network-mocker-tool/network-mocker-tool.component.d.ts +0 -23
- package/tools/network-mocker-tool/network-mocker.models.d.ts +0 -16
- package/tools/network-mocker-tool/network-mocker.service.d.ts +0 -16
package/index.d.ts
CHANGED
|
@@ -4,16 +4,17 @@ export * from './components/toolbar-tool/toolbar-tool.component';
|
|
|
4
4
|
export * from './components/toolbar-tool/toolbar-tool.models';
|
|
5
5
|
export * from './dev-toolbar.component';
|
|
6
6
|
export * from './models/dev-tools.interface';
|
|
7
|
+
export * from './models/dev-toolbar-config.interface';
|
|
7
8
|
export * from './tools/feature-flags-tool/feature-flags.models';
|
|
8
9
|
export * from './tools/feature-flags-tool/feature-flags.service';
|
|
9
10
|
export * from './tools/language-tool/language.models';
|
|
10
11
|
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
12
|
export * from './tools/app-features-tool/app-features.models';
|
|
15
13
|
export * from './tools/app-features-tool/app-features.service';
|
|
16
14
|
export * from './tools/app-features-tool/app-features-tool.component';
|
|
17
15
|
export * from './tools/permissions-tool/permissions.models';
|
|
18
16
|
export * from './tools/permissions-tool/permissions.service';
|
|
19
17
|
export * from './tools/permissions-tool/permissions-tool.component';
|
|
18
|
+
export * from './tools/presets-tool/presets.models';
|
|
19
|
+
export * from './tools/presets-tool/presets.service';
|
|
20
|
+
export * from './tools/presets-tool/presets-tool.component';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for the Dev Toolbar component.
|
|
3
|
+
* All tool flags are optional and default to true if not specified.
|
|
4
|
+
*/
|
|
5
|
+
export interface DevToolbarConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Show/hide the Language tool
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
showLanguageTool?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Show/hide the Feature Flags tool
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
showFeatureFlagsTool?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Show/hide the App Features tool
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
showAppFeaturesTool?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Show/hide the Permissions tool
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
showPermissionsTool?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Show/hide the Presets tool
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showPresetsTool?: boolean;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DevToolbarFlag } from './feature-flags.models';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
interface ForcedFlagsState {
|
|
5
|
+
enabled: string[];
|
|
6
|
+
disabled: string[];
|
|
7
|
+
}
|
|
4
8
|
export declare class DevToolbarInternalFeatureFlagService {
|
|
5
9
|
private readonly STORAGE_KEY;
|
|
6
10
|
private storageService;
|
|
@@ -16,6 +20,17 @@ export declare class DevToolbarInternalFeatureFlagService {
|
|
|
16
20
|
setFlag(flagId: string, isEnabled: boolean): void;
|
|
17
21
|
removeFlagOverride(flagId: string): void;
|
|
18
22
|
private loadForcedFlags;
|
|
23
|
+
/**
|
|
24
|
+
* Apply feature flags from a preset (used by Presets Tool)
|
|
25
|
+
* This method directly sets the forced flags state without user interaction
|
|
26
|
+
*/
|
|
27
|
+
applyPresetFlags(presetState: ForcedFlagsState): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get current forced state for saving to preset
|
|
30
|
+
* Returns the raw state of enabled and disabled flag IDs
|
|
31
|
+
*/
|
|
32
|
+
getCurrentForcedState(): ForcedFlagsState;
|
|
19
33
|
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalFeatureFlagService, never>;
|
|
20
34
|
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalFeatureFlagService>;
|
|
21
35
|
}
|
|
36
|
+
export {};
|
|
@@ -14,6 +14,16 @@ export declare class DevToolbarInternalLanguageService {
|
|
|
14
14
|
getForcedLanguage(): Observable<Language[]>;
|
|
15
15
|
removeForcedLanguage(): void;
|
|
16
16
|
private loadForcedLanguage;
|
|
17
|
+
/**
|
|
18
|
+
* Apply language from a preset (used by Presets Tool)
|
|
19
|
+
* Accepts a language ID and finds the corresponding Language object from available languages
|
|
20
|
+
*/
|
|
21
|
+
applyPresetLanguage(languageId: string | null): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Get current forced language ID for saving to preset
|
|
24
|
+
* Returns the language ID or null if no language is forced
|
|
25
|
+
*/
|
|
26
|
+
getCurrentForcedLanguage(): string | null;
|
|
17
27
|
static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarInternalLanguageService, never>;
|
|
18
28
|
static ɵprov: i0.ɵɵInjectableDeclaration<DevToolbarInternalLanguageService>;
|
|
19
29
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|