ngx-dev-toolbar 1.0.5 → 2.0.1

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.
Files changed (30) hide show
  1. package/README.md +108 -0
  2. package/components/icons/icon.component.d.ts +1 -1
  3. package/components/list/list.component.d.ts +48 -0
  4. package/components/list-item/list-item.component.d.ts +54 -0
  5. package/components/select/select.component.d.ts +1 -1
  6. package/components/window/window.component.d.ts +3 -3
  7. package/dev-toolbar-state.service.d.ts +1 -1
  8. package/dev-toolbar.component.d.ts +3 -2
  9. package/fesm2022/ngx-dev-toolbar.mjs +1457 -771
  10. package/fesm2022/ngx-dev-toolbar.mjs.map +1 -1
  11. package/index.d.ts +6 -3
  12. package/models/dev-toolbar-config.interface.d.ts +31 -0
  13. package/models/dev-tools.interface.d.ts +22 -0
  14. package/package.json +1 -1
  15. package/tools/app-features-tool/app-features.models.d.ts +5 -0
  16. package/tools/app-features-tool/app-features.service.d.ts +24 -0
  17. package/tools/feature-flags-tool/feature-flags-internal.service.d.ts +15 -0
  18. package/tools/feature-flags-tool/feature-flags.models.d.ts +1 -0
  19. package/tools/feature-flags-tool/feature-flags.service.d.ts +24 -0
  20. package/tools/language-tool/language-internal.service.d.ts +10 -0
  21. package/tools/language-tool/language.service.d.ts +7 -0
  22. package/tools/permissions-tool/permissions.models.d.ts +2 -0
  23. package/tools/permissions-tool/permissions.service.d.ts +24 -0
  24. package/tools/presets-tool/presets-internal.service.d.ts +57 -0
  25. package/tools/presets-tool/presets-tool.component.d.ts +33 -0
  26. package/tools/presets-tool/presets.models.d.ts +24 -0
  27. package/tools/presets-tool/presets.service.d.ts +51 -0
  28. package/tools/network-mocker-tool/network-mocker-tool.component.d.ts +0 -23
  29. package/tools/network-mocker-tool/network-mocker.models.d.ts +0 -16
  30. package/tools/network-mocker-tool/network-mocker.service.d.ts +0 -16
package/README.md CHANGED
@@ -138,6 +138,43 @@ Once it is added you should see them in the Feature Flags tool in the Angular De
138
138
 
139
139
  #### Usage
140
140
 
141
+ The toolbar provides two methods for retrieving feature flag values:
142
+
143
+ ##### Option 1: Using `getValues()` (Recommended ✨)
144
+
145
+ The `getValues()` method returns ALL feature flags with overrides already applied, simplifying integration:
146
+
147
+ ```typescript
148
+ @Component({
149
+ // ... component decorator
150
+ })
151
+ export class FeatureComponent {
152
+ private featureFlagsService = inject(DevToolbarFeatureFlagService);
153
+
154
+ ngOnInit() {
155
+ // Get all flags with overrides applied
156
+ this.featureFlagsService.getValues().pipe(
157
+ map(flags => flags.find(f => f.id === 'darkMode')),
158
+ map(flag => flag?.isEnabled ?? false)
159
+ ).subscribe(isDarkMode => {
160
+ if (isDarkMode) {
161
+ // Apply dark mode logic
162
+ }
163
+ });
164
+ }
165
+ }
166
+ ```
167
+
168
+ **Benefits:**
169
+ - ✅ No manual merging with `combineLatest` needed
170
+ - ✅ 60-80% less integration code
171
+ - ✅ Includes `isForced` property to identify overridden flags
172
+ - ✅ Returns all flags (both overridden and natural state)
173
+
174
+ ##### Option 2: Using `getForcedValues()` (Legacy)
175
+
176
+ The `getForcedValues()` method returns only flags that have been overridden:
177
+
141
178
  ```typescript
142
179
  @Component({
143
180
  // ... component decorator
@@ -154,6 +191,8 @@ export class FeatureComponent {
154
191
  }
155
192
  ```
156
193
 
194
+ > **Note:** This method only returns overridden flags. You need to manually merge with your base flags for complete state.
195
+
157
196
  #### Dev Toolbar Interface
158
197
 
159
198
  [Screenshot placeholder showing the feature flags interface in the dev toolbar]
@@ -202,6 +241,75 @@ export class TranslatedComponent {
202
241
  }
203
242
  ```
204
243
 
244
+ ## 🔄 Migration Guide
245
+
246
+ ### Upgrading to v2.x (getValues() API)
247
+
248
+ If you're using the legacy `getForcedValues()` with manual `combineLatest` merging, you can simplify your code significantly:
249
+
250
+ #### Before (Manual Merging):
251
+
252
+ ```typescript
253
+ @Injectable()
254
+ export class FeatureFlagService {
255
+ private store = inject(Store);
256
+ private devToolbar = inject(DevToolbarFeatureFlagService);
257
+
258
+ getFlag(flagId: string): Observable<boolean> {
259
+ return combineLatest([
260
+ this.store.select(state => state.flags[flagId]),
261
+ this.devToolbar.getForcedValues().pipe(startWith([]))
262
+ ]).pipe(
263
+ map(([baseValue, overrides]) => {
264
+ const override = overrides.find(o => o.id === flagId);
265
+ return override ? override.isEnabled : baseValue;
266
+ })
267
+ );
268
+ }
269
+ }
270
+ ```
271
+
272
+ #### After (Using getValues()):
273
+
274
+ ```typescript
275
+ @Injectable()
276
+ export class FeatureFlagService {
277
+ private store = inject(Store);
278
+ private devToolbar = inject(DevToolbarFeatureFlagService);
279
+
280
+ getFlag(flagId: string): Observable<boolean> {
281
+ return this.devToolbar.getValues().pipe(
282
+ map(flags => flags.find(f => f.id === flagId)),
283
+ map(flag => flag?.isEnabled ?? this.getBaseValue(flagId))
284
+ );
285
+ }
286
+
287
+ private getBaseValue(flagId: string): boolean {
288
+ return this.store.selectSnapshot(state => state.flags[flagId]);
289
+ }
290
+ }
291
+ ```
292
+
293
+ **What changed:**
294
+ - ❌ Removed `combineLatest` complexity
295
+ - ❌ Removed manual override merging logic
296
+ - ✅ Single observable with merged state
297
+ - ✅ ~60% less code
298
+
299
+ ### Available for All Tools
300
+
301
+ The `getValues()` method is available for:
302
+ - ✅ **DevToolbarFeatureFlagService** - Feature flags with overrides
303
+ - ✅ **DevToolbarPermissionsService** - Permissions with overrides
304
+ - ✅ **DevToolbarAppFeaturesService** - App features with overrides
305
+ - ℹ️ **DevToolbarLanguageService** - Returns forced language (same as `getForcedValues()`)
306
+
307
+ ### Breaking Changes
308
+
309
+ **None!** This is a non-breaking change. Both APIs work:
310
+ - `getValues()` - New, recommended method
311
+ - `getForcedValues()` - Legacy method, still supported
312
+
205
313
  ## Contributing
206
314
 
207
315
  We welcome contributions! Please see our [contributing guidelines](https://github.com/alfredoperez/ngx-dev-toolbar/blob/main/CONTRIBUTING.md) for details.
@@ -3,7 +3,7 @@ import * as i0 from "@angular/core";
3
3
  export declare class DevToolbarIconComponent {
4
4
  private readonly stateService;
5
5
  name: import("@angular/core").InputSignal<IconName>;
6
- fill: import("@angular/core").Signal<"#FFFFFF" | "#000000">;
6
+ fill: import("@angular/core").Signal<"#000000" | "#FFFFFF">;
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarIconComponent, never>;
8
8
  static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarIconComponent, "ndt-icon", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
9
9
  }
@@ -0,0 +1,48 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Container component for displaying lists of items with consistent scrolling,
4
+ * empty states, and layout across all tools.
5
+ *
6
+ * @example
7
+ * ```html
8
+ * <ndt-list
9
+ * [hasItems]="items().length > 0"
10
+ * [hasResults]="filteredItems().length > 0"
11
+ * emptyMessage="No items found"
12
+ * noResultsMessage="No items match your filter"
13
+ * >
14
+ * @for (item of filteredItems(); track item.id) {
15
+ * <ndt-list-item ... />
16
+ * }
17
+ * </ndt-list>
18
+ * ```
19
+ */
20
+ export declare class DevToolbarListComponent {
21
+ /**
22
+ * Whether the list has any items at all (before filtering).
23
+ * When false, shows the emptyMessage.
24
+ */
25
+ hasItems: import("@angular/core").InputSignal<boolean>;
26
+ /**
27
+ * Whether the list has any results after filtering.
28
+ * When false (but hasItems is true), shows the noResultsMessage.
29
+ */
30
+ hasResults: import("@angular/core").InputSignal<boolean>;
31
+ /**
32
+ * Message to display when there are no items at all.
33
+ * @example "No feature flags found"
34
+ */
35
+ emptyMessage: import("@angular/core").InputSignal<string>;
36
+ /**
37
+ * Optional hint text to display below the empty message.
38
+ * @example "Call setAvailableOptions() to configure features"
39
+ */
40
+ emptyHint: import("@angular/core").InputSignal<string | undefined>;
41
+ /**
42
+ * Message to display when items exist but none match the current filter.
43
+ * @example "No flags match your filter"
44
+ */
45
+ noResultsMessage: import("@angular/core").InputSignal<string>;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarListComponent, never>;
47
+ static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarListComponent, "ndt-list", never, { "hasItems": { "alias": "hasItems"; "required": false; "isSignal": true; }; "hasResults": { "alias": "hasResults"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "emptyHint": { "alias": "emptyHint"; "required": false; "isSignal": true; }; "noResultsMessage": { "alias": "noResultsMessage"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
48
+ }
@@ -0,0 +1,54 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * List item component with consistent layout, dot badge indicator,
4
+ * and forced state highlighting.
5
+ *
6
+ * @example
7
+ * ```html
8
+ * <ndt-list-item
9
+ * title="Analytics Dashboard"
10
+ * description="Advanced reporting tools"
11
+ * [isForced]="false"
12
+ * [currentValue]="true"
13
+ * [originalValue]="undefined"
14
+ * >
15
+ * <ndt-select ... />
16
+ * </ndt-list-item>
17
+ * ```
18
+ */
19
+ export declare class DevToolbarListItemComponent {
20
+ /**
21
+ * Display title for the list item
22
+ * @example "Analytics Dashboard"
23
+ */
24
+ title: import("@angular/core").InputSignal<string>;
25
+ /**
26
+ * Optional description text
27
+ * @example "Advanced reporting and data visualization tools"
28
+ */
29
+ description: import("@angular/core").InputSignal<string | undefined>;
30
+ /**
31
+ * Whether this item's state is forced via the dev toolbar
32
+ */
33
+ isForced: import("@angular/core").InputSignal<boolean>;
34
+ /**
35
+ * Current enabled/granted state of the item
36
+ */
37
+ currentValue: import("@angular/core").InputSignal<boolean>;
38
+ /**
39
+ * Original value before forcing (only present when isForced is true)
40
+ */
41
+ originalValue: import("@angular/core").InputSignal<boolean | undefined>;
42
+ /**
43
+ * Value to display in the dot indicator.
44
+ * For forced items: shows originalValue
45
+ * For non-forced items: shows currentValue
46
+ */
47
+ protected displayValue: import("@angular/core").Signal<boolean>;
48
+ /**
49
+ * Tooltip text explaining the indicator state
50
+ */
51
+ protected tooltipText: import("@angular/core").Signal<string>;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarListItemComponent, never>;
53
+ static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarListItemComponent, "ndt-list-item", never, { "title": { "alias": "title"; "required": true; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "isForced": { "alias": "isForced"; "required": false; "isSignal": true; }; "currentValue": { "alias": "currentValue"; "required": true; "isSignal": true; }; "originalValue": { "alias": "originalValue"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
54
+ }
@@ -12,7 +12,7 @@ export declare class DevToolbarSelectComponent {
12
12
  ariaLabel: import("@angular/core").InputSignal<string>;
13
13
  label: import("@angular/core").InputSignal<string>;
14
14
  size: import("@angular/core").InputSignal<"small" | "medium">;
15
- readonly theme: import("@angular/core").Signal<"dark" | "light">;
15
+ readonly theme: import("@angular/core").Signal<"light" | "dark">;
16
16
  protected readonly selectMenuId: string;
17
17
  isOpen: import("@angular/core").WritableSignal<boolean>;
18
18
  selectedLabel: import("@angular/core").Signal<string>;
@@ -4,13 +4,13 @@ import * as i0 from "@angular/core";
4
4
  export declare class DevToolbarWindowComponent {
5
5
  readonly devToolbarStateService: DevToolbarStateService;
6
6
  readonly config: import("@angular/core").InputSignal<DevToolbarWindowOptions>;
7
- readonly close: import("@angular/core").OutputEmitterRef<void>;
7
+ readonly closed: import("@angular/core").OutputEmitterRef<void>;
8
8
  readonly maximize: import("@angular/core").OutputEmitterRef<void>;
9
9
  readonly minimize: import("@angular/core").OutputEmitterRef<void>;
10
- readonly theme: import("@angular/core").Signal<"dark" | "light">;
10
+ readonly theme: import("@angular/core").Signal<"light" | "dark">;
11
11
  protected onClose(): void;
12
12
  protected onMaximize(): void;
13
13
  protected onMinimize(): void;
14
14
  static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarWindowComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarWindowComponent, "ndt-window", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "close": "close"; "maximize": "maximize"; "minimize": "minimize"; }, never, ["*"], true, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarWindowComponent, "ndt-window", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "closed": "closed"; "maximize": "maximize"; "minimize": "minimize"; }, never, ["*"], true, never>;
16
16
  }
@@ -6,7 +6,7 @@ export declare class DevToolbarStateService {
6
6
  readonly activeToolId: import("@angular/core").Signal<string | null>;
7
7
  readonly hasActiveTool: import("@angular/core").Signal<boolean>;
8
8
  readonly error: import("@angular/core").Signal<string | null>;
9
- readonly theme: import("@angular/core").Signal<"dark" | "light">;
9
+ readonly theme: import("@angular/core").Signal<"light" | "dark">;
10
10
  /**
11
11
  * The delay to hide the toolbar
12
12
  */
@@ -1,12 +1,13 @@
1
1
  import { DestroyRef, OnInit } from '@angular/core';
2
2
  import { DevToolbarStateService } from './dev-toolbar-state.service';
3
+ import { DevToolbarConfig } from './models/dev-toolbar-config.interface';
3
4
  import { SettingsService } from './tools/home-tool/settings.service';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class DevToolbarComponent implements OnInit {
6
7
  state: DevToolbarStateService;
7
8
  destroyRef: DestroyRef;
8
9
  settingsService: SettingsService;
9
- isDevMode: boolean;
10
+ config: import("@angular/core").InputSignal<DevToolbarConfig>;
10
11
  private keyboardShortcut;
11
12
  private mouseLeave;
12
13
  ngOnInit(): void;
@@ -14,5 +15,5 @@ export declare class DevToolbarComponent implements OnInit {
14
15
  onMouseLeave(): void;
15
16
  private toggleDevTools;
16
17
  static ɵfac: i0.ɵɵFactoryDeclaration<DevToolbarComponent, never>;
17
- static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarComponent, "ndt-toolbar", never, {}, {}, never, ["*"], true, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<DevToolbarComponent, "ndt-toolbar", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
18
19
  }