ngx-dev-toolbar 4.0.0 → 4.2.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/README.md +5 -5
- package/components/icon-button/icon-button.component.d.ts +13 -0
- package/components/icons/globe-icon.component.d.ts +6 -0
- package/components/icons/icon.models.d.ts +1 -1
- package/components/icons/pin-icon.component.d.ts +6 -0
- package/components/list-item/list-item.component.d.ts +24 -1
- package/components/select/select.component.d.ts +1 -1
- package/components/tool-button/tool-button.component.d.ts +6 -5
- package/components/toolbar-tool/toolbar-tool.component.d.ts +6 -11
- package/components/window/window.component.d.ts +1 -1
- package/fesm2022/ngx-dev-toolbar.mjs +2229 -698
- package/fesm2022/ngx-dev-toolbar.mjs.map +1 -1
- package/index.d.ts +7 -3
- package/models/tool-view-state.models.d.ts +2 -0
- package/models/toolbar-config.interface.d.ts +32 -2
- package/models/toolbar-position.model.d.ts +3 -0
- package/models/toolbar.interface.d.ts +19 -0
- package/package.json +6 -7
- package/tokens.d.ts +0 -18
- package/toolbar-state.service.d.ts +10 -9
- package/toolbar.component.d.ts +1 -0
- package/tools/app-features-tool/app-features-internal.service.d.ts +6 -0
- package/tools/app-features-tool/app-features-tool.component.d.ts +5 -0
- package/tools/app-features-tool/app-features.service.d.ts +7 -0
- package/tools/feature-flags-tool/feature-flags-internal.service.d.ts +6 -0
- package/tools/feature-flags-tool/feature-flags-tool.component.d.ts +5 -0
- package/tools/feature-flags-tool/feature-flags.service.d.ts +7 -0
- package/tools/home-tool/home-tool.component.d.ts +3 -0
- package/tools/home-tool/settings.models.d.ts +3 -0
- package/tools/i18n-tool/i18n-formatting.utils.d.ts +10 -0
- package/tools/i18n-tool/i18n-internal.service.d.ts +86 -0
- package/tools/i18n-tool/i18n-tool.component.d.ts +66 -0
- package/tools/i18n-tool/i18n.models.d.ts +55 -0
- package/tools/i18n-tool/i18n.service.d.ts +70 -0
- package/tools/permissions-tool/permissions-internal.service.d.ts +6 -0
- package/tools/permissions-tool/permissions-tool.component.d.ts +5 -0
- package/tools/permissions-tool/permissions.service.d.ts +7 -0
- package/tools/presets-tool/presets-internal.service.d.ts +1 -1
- package/tools/presets-tool/presets-tool.component.d.ts +5 -5
- package/tools/presets-tool/presets.models.d.ts +10 -3
- package/tools/language-tool/language-internal.service.d.ts +0 -30
- package/tools/language-tool/language-tool.component.d.ts +0 -14
- package/tools/language-tool/language.models.d.ts +0 -4
- package/tools/language-tool/language.service.d.ts +0 -26
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { TOOLBAR_CONFIG, TOOLBAR_FEATURE_FLAGS, TOOLBAR_PERMISSIONS,
|
|
1
|
+
export { TOOLBAR_CONFIG, TOOLBAR_FEATURE_FLAGS, TOOLBAR_PERMISSIONS, TOOLBAR_APP_FEATURES, } from './tokens';
|
|
2
2
|
export { provideToolbar } from './provide-toolbar';
|
|
3
3
|
export * from './components/icons/icon.component';
|
|
4
4
|
export * from './components/icons/icon.models';
|
|
@@ -7,6 +7,7 @@ export * from './components/list-item/list-item.component';
|
|
|
7
7
|
export * from './components/toolbar-tool/toolbar-tool.component';
|
|
8
8
|
export * from './components/toolbar-tool/toolbar-tool.models';
|
|
9
9
|
export * from './components/button/button.component';
|
|
10
|
+
export * from './components/icon-button/icon-button.component';
|
|
10
11
|
export * from './components/input/input.component';
|
|
11
12
|
export * from './components/select/select.component';
|
|
12
13
|
export * from './components/card/card.component';
|
|
@@ -17,11 +18,14 @@ export * from './components/step-view/step-view.directive';
|
|
|
17
18
|
export * from './toolbar.component';
|
|
18
19
|
export * from './models/toolbar.interface';
|
|
19
20
|
export * from './models/toolbar-config.interface';
|
|
21
|
+
export * from './models/toolbar-position.model';
|
|
20
22
|
export * from './models/tool-view-state.models';
|
|
21
23
|
export * from './tools/feature-flags-tool/feature-flags.models';
|
|
22
24
|
export * from './tools/feature-flags-tool/feature-flags.service';
|
|
23
|
-
export * from './tools/
|
|
24
|
-
export * from './tools/
|
|
25
|
+
export * from './tools/i18n-tool/i18n.models';
|
|
26
|
+
export * from './tools/i18n-tool/i18n.service';
|
|
27
|
+
export * from './tools/i18n-tool/i18n-formatting.utils';
|
|
28
|
+
export * from './tools/i18n-tool/i18n-tool.component';
|
|
25
29
|
export * from './tools/app-features-tool/app-features.models';
|
|
26
30
|
export * from './tools/app-features-tool/app-features.service';
|
|
27
31
|
export * from './tools/app-features-tool/app-features-tool.component';
|
|
@@ -9,4 +9,6 @@ export interface ToolViewState {
|
|
|
9
9
|
filter: string;
|
|
10
10
|
/** Sort order for list items (currently only 'asc' supported, reserved for future use) */
|
|
11
11
|
sortOrder: 'asc' | 'desc';
|
|
12
|
+
/** IDs of pinned items that should appear at the top of the list */
|
|
13
|
+
pinnedIds?: string[];
|
|
12
14
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { ToolbarPosition } from './toolbar-position.model';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration options for the Angular Toolbar component.
|
|
3
4
|
* All tool flags are optional and default to true if not specified.
|
|
4
5
|
*/
|
|
5
6
|
export interface ToolbarConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Position of the toolbar on the viewport edge.
|
|
9
|
+
* @default 'bottom'
|
|
10
|
+
*/
|
|
11
|
+
position?: ToolbarPosition;
|
|
6
12
|
/**
|
|
7
13
|
* Master switch to enable/disable the entire toolbar.
|
|
8
14
|
* When disabled:
|
|
@@ -13,10 +19,10 @@ export interface ToolbarConfig {
|
|
|
13
19
|
*/
|
|
14
20
|
enabled?: boolean;
|
|
15
21
|
/**
|
|
16
|
-
* Show/hide the
|
|
22
|
+
* Show/hide the i18n tool (locale, timezone, currency, pseudo-localization, RTL)
|
|
17
23
|
* @default true
|
|
18
24
|
*/
|
|
19
|
-
|
|
25
|
+
showI18nTool?: boolean;
|
|
20
26
|
/**
|
|
21
27
|
* Show/hide the Feature Flags tool
|
|
22
28
|
* @default true
|
|
@@ -37,4 +43,28 @@ export interface ToolbarConfig {
|
|
|
37
43
|
* @default true
|
|
38
44
|
*/
|
|
39
45
|
showPresetsTool?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Callback to persist a forced feature flag value to the actual source.
|
|
48
|
+
* When provided, an "Apply to source" button appears on each forced flag.
|
|
49
|
+
* @param flagId - The ID of the feature flag
|
|
50
|
+
* @param value - The current forced boolean value
|
|
51
|
+
* @deprecated Use `ToolbarFeatureFlagService.setApplyToSource()` instead. Config callbacks will be removed in v5.
|
|
52
|
+
*/
|
|
53
|
+
onApplyFeatureFlag?: (flagId: string, value: boolean) => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Callback to persist a forced permission value to the actual source.
|
|
56
|
+
* When provided, an "Apply to source" button appears on each forced permission.
|
|
57
|
+
* @param permissionId - The ID of the permission
|
|
58
|
+
* @param value - The current forced boolean value (granted = true, denied = false)
|
|
59
|
+
* @deprecated Use `ToolbarPermissionsService.setApplyToSource()` instead. Config callbacks will be removed in v5.
|
|
60
|
+
*/
|
|
61
|
+
onApplyPermission?: (permissionId: string, value: boolean) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Callback to persist a forced app feature value to the actual source.
|
|
64
|
+
* When provided, an "Apply to source" button appears on each forced feature.
|
|
65
|
+
* @param featureId - The ID of the app feature
|
|
66
|
+
* @param value - The current forced boolean value
|
|
67
|
+
* @deprecated Use `ToolbarAppFeaturesService.setApplyToSource()` instead. Config callbacks will be removed in v5.
|
|
68
|
+
*/
|
|
69
|
+
onApplyAppFeature?: (featureId: string, value: boolean) => Promise<void>;
|
|
40
70
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* State of an apply-to-source operation for a single item.
|
|
4
|
+
*/
|
|
5
|
+
export type ApplyToSourceState = 'idle' | 'loading' | 'success' | 'error';
|
|
2
6
|
/**
|
|
3
7
|
* Interface that should be implemented by any tool service that is used in the dev toolbar
|
|
4
8
|
*/
|
|
@@ -36,4 +40,19 @@ export interface ToolbarService<OptionType> {
|
|
|
36
40
|
* ```
|
|
37
41
|
*/
|
|
38
42
|
getValues(): Observable<OptionType[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Registers a callback to persist a forced value back to the actual data source.
|
|
45
|
+
* When set, an "apply to source" button appears on each forced item in the toolbar UI.
|
|
46
|
+
*
|
|
47
|
+
* @param callback - Async function that receives the item ID and its forced boolean value.
|
|
48
|
+
* Should persist the value (e.g., via API call) and throw on failure.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* this.toolbarService.setApplyToSource(async (id, value) => {
|
|
53
|
+
* await this.api.updateFlag(id, value);
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
setApplyToSource?(callback: (id: string, value: boolean) => Promise<void>): void;
|
|
39
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-dev-toolbar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"devtools",
|
|
6
6
|
"development-toolbar",
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
"signals"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@angular/core": ">=
|
|
15
|
-
"@angular/common": ">=
|
|
16
|
-
"@angular/forms": ">=
|
|
17
|
-
"@angular/
|
|
18
|
-
"
|
|
19
|
-
"rxjs": "^6.0.0 || ^7.0.0"
|
|
14
|
+
"@angular/core": ">=19.0.0",
|
|
15
|
+
"@angular/common": ">=19.0.0",
|
|
16
|
+
"@angular/forms": ">=19.0.0",
|
|
17
|
+
"@angular/cdk": ">=19.0.0",
|
|
18
|
+
"rxjs": ">=7.8.0"
|
|
20
19
|
},
|
|
21
20
|
"sideEffects": false,
|
|
22
21
|
"module": "fesm2022/ngx-dev-toolbar.mjs",
|
package/tokens.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ToolbarConfig } from './models/toolbar-config.interface';
|
|
|
3
3
|
import { ToolbarService } from './models/toolbar.interface';
|
|
4
4
|
import { ToolbarAppFeature } from './tools/app-features-tool/app-features.models';
|
|
5
5
|
import { ToolbarFlag } from './tools/feature-flags-tool/feature-flags.models';
|
|
6
|
-
import { Language } from './tools/language-tool/language.models';
|
|
7
6
|
import { ToolbarPermission } from './tools/permissions-tool/permissions.models';
|
|
8
7
|
/**
|
|
9
8
|
* InjectionToken for the Toolbar configuration.
|
|
@@ -46,23 +45,6 @@ export declare const TOOLBAR_FEATURE_FLAGS: InjectionToken<ToolbarService<Toolba
|
|
|
46
45
|
* ```
|
|
47
46
|
*/
|
|
48
47
|
export declare const TOOLBAR_PERMISSIONS: InjectionToken<ToolbarService<ToolbarPermission>>;
|
|
49
|
-
/**
|
|
50
|
-
* InjectionToken for the Language service.
|
|
51
|
-
*
|
|
52
|
-
* Use this token for tree-shakeable injection of the language service.
|
|
53
|
-
* When using dynamic imports, this token enables complete tree-shaking of
|
|
54
|
-
* the toolbar in production builds.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // In your service
|
|
59
|
-
* private devToolbar = inject(TOOLBAR_LANGUAGE, { optional: true });
|
|
60
|
-
*
|
|
61
|
-
* // Safe to call - no-op if toolbar is not provided
|
|
62
|
-
* this.devToolbar?.setAvailableOptions(languages);
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare const TOOLBAR_LANGUAGE: InjectionToken<ToolbarService<Language>>;
|
|
66
48
|
/**
|
|
67
49
|
* InjectionToken for the App Features service.
|
|
68
50
|
*
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { ToolbarConfig } from './models/toolbar-config.interface';
|
|
2
|
+
import { ToolbarPosition } from './models/toolbar-position.model';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class ToolbarStateService {
|
|
5
|
+
private storageService;
|
|
4
6
|
private state;
|
|
5
7
|
readonly isVisible: import("@angular/core").Signal<boolean>;
|
|
6
8
|
readonly isDarkTheme: import("@angular/core").Signal<boolean>;
|
|
7
9
|
readonly activeToolId: import("@angular/core").Signal<string | null>;
|
|
8
10
|
readonly hasActiveTool: import("@angular/core").Signal<boolean>;
|
|
9
11
|
readonly error: import("@angular/core").Signal<string | null>;
|
|
10
|
-
readonly theme: import("@angular/core").Signal<"
|
|
11
|
-
/**
|
|
12
|
-
* The delay to hide the toolbar
|
|
13
|
-
*/
|
|
12
|
+
readonly theme: import("@angular/core").Signal<"light" | "dark">;
|
|
14
13
|
readonly delay: import("@angular/core").Signal<number>;
|
|
15
14
|
readonly config: import("@angular/core").Signal<ToolbarConfig>;
|
|
16
|
-
/**
|
|
17
|
-
* Indicates if the toolbar is enabled based on config.
|
|
18
|
-
* When disabled, toolbar UI won't render and services won't return forced values.
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
15
|
readonly isEnabled: import("@angular/core").Signal<boolean>;
|
|
16
|
+
readonly position: import("@angular/core").Signal<ToolbarPosition>;
|
|
17
|
+
readonly isCompletelyHidden: import("@angular/core").Signal<boolean>;
|
|
18
|
+
constructor();
|
|
22
19
|
setVisibility(isVisible: boolean): void;
|
|
23
20
|
setTheme(theme: 'light' | 'dark'): void;
|
|
24
21
|
setActiveTool(toolId: string | null): void;
|
|
25
22
|
toggleTool(toolId: string | null): void;
|
|
26
23
|
toggleVisibility(): void;
|
|
27
24
|
setConfig(config: ToolbarConfig): void;
|
|
25
|
+
setPosition(position: ToolbarPosition): void;
|
|
26
|
+
toggleCompletelyHidden(): void;
|
|
27
|
+
private loadPersistedState;
|
|
28
|
+
private persistState;
|
|
28
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarStateService, never>;
|
|
29
30
|
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarStateService>;
|
|
30
31
|
}
|
package/toolbar.component.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class ToolbarComponent implements OnInit, OnDestroy {
|
|
|
11
11
|
config: import("@angular/core").InputSignal<ToolbarConfig>;
|
|
12
12
|
private globalStyleElement?;
|
|
13
13
|
private keyboardShortcut;
|
|
14
|
+
private hideShortcut;
|
|
14
15
|
private mouseLeave;
|
|
15
16
|
constructor();
|
|
16
17
|
ngOnInit(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { ApplyToSourceState } from '../../models/toolbar.interface';
|
|
2
3
|
import { ToolbarAppFeature, ForcedAppFeaturesState } from './app-features.models';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
/**
|
|
@@ -73,6 +74,11 @@ export declare class ToolbarInternalAppFeaturesService {
|
|
|
73
74
|
* @returns Current forced features state
|
|
74
75
|
*/
|
|
75
76
|
getCurrentForcedState(): ForcedAppFeaturesState;
|
|
77
|
+
readonly applyCallback: import("@angular/core").WritableSignal<((id: string, value: boolean) => Promise<void>) | null>;
|
|
78
|
+
readonly applyStates: import("@angular/core").WritableSignal<Record<string, ApplyToSourceState>>;
|
|
79
|
+
readonly hasApplyCallback: import("@angular/core").Signal<boolean>;
|
|
80
|
+
setApplyToSource(callback: (id: string, value: boolean) => Promise<void>): void;
|
|
81
|
+
applyToSource(id: string, value: boolean): Promise<void>;
|
|
76
82
|
/**
|
|
77
83
|
* Merge natural app features with forced state.
|
|
78
84
|
*
|
|
@@ -21,6 +21,7 @@ export declare class ToolbarAppFeaturesToolComponent {
|
|
|
21
21
|
private readonly VIEW_STATE_KEY;
|
|
22
22
|
protected readonly activeFilter: import("@angular/core").WritableSignal<AppFeatureFilter>;
|
|
23
23
|
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
24
|
+
protected readonly pinnedIds: import("@angular/core").WritableSignal<Set<string>>;
|
|
24
25
|
constructor();
|
|
25
26
|
private loadViewState;
|
|
26
27
|
protected readonly features: import("@angular/core").Signal<ToolbarAppFeature[]>;
|
|
@@ -37,6 +38,9 @@ export declare class ToolbarAppFeaturesToolComponent {
|
|
|
37
38
|
value: string;
|
|
38
39
|
label: string;
|
|
39
40
|
}[];
|
|
41
|
+
protected readonly hasApplyCallback: import("@angular/core").Signal<boolean>;
|
|
42
|
+
protected getApplyState(featureId: string): 'idle' | 'loading' | 'success' | 'error';
|
|
43
|
+
protected onApplyToSource(featureId: string, value: boolean): void;
|
|
40
44
|
/**
|
|
41
45
|
* Handle filter dropdown change.
|
|
42
46
|
* Updates the active filter to show all/forced/enabled/disabled features.
|
|
@@ -54,6 +58,7 @@ export declare class ToolbarAppFeaturesToolComponent {
|
|
|
54
58
|
* Updates the search query to filter features by name/description.
|
|
55
59
|
*/
|
|
56
60
|
onSearchChange(query: string): void;
|
|
61
|
+
togglePin(featureId: string): void;
|
|
57
62
|
/**
|
|
58
63
|
* Get the dropdown value for a feature's current state.
|
|
59
64
|
* - Returns empty string if not forced (natural state)
|
|
@@ -170,6 +170,13 @@ export declare class ToolbarAppFeaturesService implements ToolbarService<Toolbar
|
|
|
170
170
|
* ```
|
|
171
171
|
*/
|
|
172
172
|
getCurrentForcedState(): ForcedAppFeaturesState;
|
|
173
|
+
/**
|
|
174
|
+
* Registers a callback to persist a forced app feature value back to the actual data source.
|
|
175
|
+
* When set, an "apply to source" button appears on each forced feature in the toolbar UI.
|
|
176
|
+
*
|
|
177
|
+
* @param callback - Async function that receives the feature ID and its forced boolean value
|
|
178
|
+
*/
|
|
179
|
+
setApplyToSource(callback: (id: string, value: boolean) => Promise<void>): void;
|
|
173
180
|
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarAppFeaturesService, never>;
|
|
174
181
|
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarAppFeaturesService>;
|
|
175
182
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { ApplyToSourceState } from '../../models/toolbar.interface';
|
|
2
3
|
import { ToolbarFlag } from './feature-flags.models';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
interface ForcedFlagsState {
|
|
@@ -31,6 +32,11 @@ export declare class ToolbarInternalFeatureFlagService {
|
|
|
31
32
|
* Returns the raw state of enabled and disabled flag IDs
|
|
32
33
|
*/
|
|
33
34
|
getCurrentForcedState(): ForcedFlagsState;
|
|
35
|
+
readonly applyCallback: import("@angular/core").WritableSignal<((id: string, value: boolean) => Promise<void>) | null>;
|
|
36
|
+
readonly applyStates: import("@angular/core").WritableSignal<Record<string, ApplyToSourceState>>;
|
|
37
|
+
readonly hasApplyCallback: import("@angular/core").Signal<boolean>;
|
|
38
|
+
setApplyToSource(callback: (id: string, value: boolean) => Promise<void>): void;
|
|
39
|
+
applyToSource(id: string, value: boolean): Promise<void>;
|
|
34
40
|
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarInternalFeatureFlagService, never>;
|
|
35
41
|
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarInternalFeatureFlagService>;
|
|
36
42
|
}
|
|
@@ -7,6 +7,7 @@ export declare class ToolbarFeatureFlagsToolComponent {
|
|
|
7
7
|
private readonly VIEW_STATE_KEY;
|
|
8
8
|
protected readonly activeFilter: import("@angular/core").WritableSignal<FeatureFlagFilter>;
|
|
9
9
|
protected readonly searchQuery: import("@angular/core").WritableSignal<string>;
|
|
10
|
+
protected readonly pinnedIds: import("@angular/core").WritableSignal<Set<string>>;
|
|
10
11
|
constructor();
|
|
11
12
|
private loadViewState;
|
|
12
13
|
protected readonly flags: import("@angular/core").Signal<ToolbarFlag[]>;
|
|
@@ -23,9 +24,13 @@ export declare class ToolbarFeatureFlagsToolComponent {
|
|
|
23
24
|
value: string;
|
|
24
25
|
label: string;
|
|
25
26
|
}[];
|
|
27
|
+
protected readonly hasApplyCallback: import("@angular/core").Signal<boolean>;
|
|
28
|
+
protected getApplyState(flagId: string): 'idle' | 'loading' | 'success' | 'error';
|
|
29
|
+
protected onApplyToSource(flagId: string, value: boolean): void;
|
|
26
30
|
onFilterChange(value: string | undefined): void;
|
|
27
31
|
onFlagChange(flagId: string, value: string): void;
|
|
28
32
|
onSearchChange(query: string): void;
|
|
33
|
+
togglePin(flagId: string): void;
|
|
29
34
|
protected getFlagValue(flag: ToolbarFlag): string;
|
|
30
35
|
protected getFlagPlaceholder(flag: ToolbarFlag): string;
|
|
31
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarFeatureFlagsToolComponent, never>;
|
|
@@ -38,6 +38,13 @@ export declare class ToolbarFeatureFlagService implements ToolbarService<Toolbar
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
getValues(): Observable<ToolbarFlag[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Registers a callback to persist a forced flag value back to the actual data source.
|
|
43
|
+
* When set, an "apply to source" button appears on each forced flag in the toolbar UI.
|
|
44
|
+
*
|
|
45
|
+
* @param callback - Async function that receives the flag ID and its forced boolean value
|
|
46
|
+
*/
|
|
47
|
+
setApplyToSource(callback: (id: string, value: boolean) => Promise<void>): void;
|
|
41
48
|
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarFeatureFlagService, never>;
|
|
42
49
|
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarFeatureFlagService>;
|
|
43
50
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { ToolbarPosition } from '../../models/toolbar-position.model';
|
|
2
3
|
import { ToolbarStateService } from '../../toolbar-state.service';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class ToolbarHomeToolComponent {
|
|
@@ -7,6 +8,7 @@ export declare class ToolbarHomeToolComponent {
|
|
|
7
8
|
private readonly storageService;
|
|
8
9
|
readonly badge: import("@angular/core").InputSignal<string | number | undefined>;
|
|
9
10
|
readonly title = "Angular Toolbar";
|
|
11
|
+
readonly positions: readonly ToolbarPosition[];
|
|
10
12
|
readonly options: ToolbarWindowOptions;
|
|
11
13
|
readonly links: readonly [{
|
|
12
14
|
readonly icon: "bug";
|
|
@@ -29,6 +31,7 @@ export declare class ToolbarHomeToolComponent {
|
|
|
29
31
|
readonly url: "https://discord.com/invite/angular";
|
|
30
32
|
readonly label: "Community";
|
|
31
33
|
}];
|
|
34
|
+
onPositionChange(position: ToolbarPosition): void;
|
|
32
35
|
onExportSettings(): void;
|
|
33
36
|
onImportSettings(): void;
|
|
34
37
|
onResetSettings(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function formatNumber(locale: string, value: number): string;
|
|
2
|
+
export declare function formatDate(locale: string, timezone: string, date: Date): string;
|
|
3
|
+
export declare function formatTime(locale: string, timezone: string, date: Date): string;
|
|
4
|
+
export declare function formatCurrency(locale: string, currency: string, value: number): string;
|
|
5
|
+
export declare function pseudoLocalize(text: string): string;
|
|
6
|
+
export type I18nDateFormatType = 'locale-default' | 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD';
|
|
7
|
+
export type I18nNumberFormatType = 'locale-default' | 'period-comma' | 'comma-period' | 'space-comma';
|
|
8
|
+
export declare function formatCustomDate(date: Date, format: I18nDateFormatType, locale: string, timezone: string): string;
|
|
9
|
+
export declare function formatCustomNumber(value: number, format: I18nNumberFormatType, locale: string): string;
|
|
10
|
+
export declare function expandText(text: string, factor?: number): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { I18nCurrency, I18nDateFormat, I18nFirstDayOfWeek, I18nLocale, I18nNumberFormat, I18nPresetConfig, I18nState, I18nTimezone, I18nToolConfig, I18nUnitSystem } from './i18n.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ToolbarInternalI18nService {
|
|
5
|
+
private readonly STORAGE_LOCALE;
|
|
6
|
+
private readonly STORAGE_TIMEZONE;
|
|
7
|
+
private readonly STORAGE_CURRENCY;
|
|
8
|
+
private readonly STORAGE_UNIT_SYSTEM;
|
|
9
|
+
private readonly STORAGE_DATE_FORMAT;
|
|
10
|
+
private readonly STORAGE_FIRST_DAY;
|
|
11
|
+
private readonly STORAGE_NUMBER_FORMAT;
|
|
12
|
+
private readonly STORAGE_PSEUDO_LOC;
|
|
13
|
+
private readonly STORAGE_RTL;
|
|
14
|
+
private readonly OLD_LANGUAGE_KEY;
|
|
15
|
+
private readonly storageService;
|
|
16
|
+
private readonly stateService;
|
|
17
|
+
private readonly document;
|
|
18
|
+
private locales$;
|
|
19
|
+
private timezones$;
|
|
20
|
+
private currencies$;
|
|
21
|
+
private forcedLocale$;
|
|
22
|
+
private forcedTimezone$;
|
|
23
|
+
private forcedCurrency$;
|
|
24
|
+
private forcedUnitSystem$;
|
|
25
|
+
private forcedDateFormat$;
|
|
26
|
+
private forcedFirstDayOfWeek$;
|
|
27
|
+
private forcedNumberFormat$;
|
|
28
|
+
private toolConfig$;
|
|
29
|
+
private pseudoLocEnabled$;
|
|
30
|
+
private rtlEnabled$;
|
|
31
|
+
locales: import("@angular/core").Signal<I18nLocale[]>;
|
|
32
|
+
timezones: import("@angular/core").Signal<I18nTimezone[]>;
|
|
33
|
+
availableCurrencies: import("@angular/core").Signal<I18nCurrency[]>;
|
|
34
|
+
forcedLocale: import("@angular/core").Signal<I18nLocale | null>;
|
|
35
|
+
forcedTimezone: import("@angular/core").Signal<I18nTimezone | null>;
|
|
36
|
+
forcedCurrency: import("@angular/core").Signal<I18nCurrency | null>;
|
|
37
|
+
forcedUnitSystem: import("@angular/core").Signal<I18nUnitSystem | null>;
|
|
38
|
+
forcedDateFormat: import("@angular/core").Signal<I18nDateFormat | null>;
|
|
39
|
+
forcedFirstDayOfWeek: import("@angular/core").Signal<I18nFirstDayOfWeek | null>;
|
|
40
|
+
forcedNumberFormat: import("@angular/core").Signal<I18nNumberFormat | null>;
|
|
41
|
+
toolConfig: import("@angular/core").Signal<I18nToolConfig | {}>;
|
|
42
|
+
pseudoLocEnabled: import("@angular/core").Signal<boolean>;
|
|
43
|
+
rtlEnabled: import("@angular/core").Signal<boolean>;
|
|
44
|
+
constructor();
|
|
45
|
+
setAvailableLocales(locales: I18nLocale[]): void;
|
|
46
|
+
getAvailableLocales(): Observable<I18nLocale[]>;
|
|
47
|
+
setForcedLocale(locale: I18nLocale): void;
|
|
48
|
+
getForcedLocale(): Observable<I18nLocale[]>;
|
|
49
|
+
removeForcedLocale(): void;
|
|
50
|
+
setAvailableTimezones(timezones: I18nTimezone[]): void;
|
|
51
|
+
getAvailableTimezones(): Observable<I18nTimezone[]>;
|
|
52
|
+
setForcedTimezone(timezone: I18nTimezone): void;
|
|
53
|
+
getForcedTimezone(): Observable<I18nTimezone | null>;
|
|
54
|
+
removeForcedTimezone(): void;
|
|
55
|
+
setAvailableCurrencies(currencies: I18nCurrency[]): void;
|
|
56
|
+
getAvailableCurrencies(): Observable<I18nCurrency[]>;
|
|
57
|
+
setForcedCurrency(currency: I18nCurrency): void;
|
|
58
|
+
getForcedCurrency(): Observable<I18nCurrency | null>;
|
|
59
|
+
removeForcedCurrency(): void;
|
|
60
|
+
setForcedUnitSystem(unitSystem: I18nUnitSystem): void;
|
|
61
|
+
getForcedUnitSystem(): Observable<I18nUnitSystem | null>;
|
|
62
|
+
removeForcedUnitSystem(): void;
|
|
63
|
+
setForcedDateFormat(dateFormat: I18nDateFormat): void;
|
|
64
|
+
getForcedDateFormat(): Observable<I18nDateFormat | null>;
|
|
65
|
+
removeForcedDateFormat(): void;
|
|
66
|
+
setForcedFirstDayOfWeek(firstDay: I18nFirstDayOfWeek): void;
|
|
67
|
+
getForcedFirstDayOfWeek(): Observable<I18nFirstDayOfWeek | null>;
|
|
68
|
+
removeForcedFirstDayOfWeek(): void;
|
|
69
|
+
setForcedNumberFormat(numberFormat: I18nNumberFormat): void;
|
|
70
|
+
getForcedNumberFormat(): Observable<I18nNumberFormat | null>;
|
|
71
|
+
removeForcedNumberFormat(): void;
|
|
72
|
+
setToolConfig(config: I18nToolConfig): void;
|
|
73
|
+
setPseudoLocEnabled(enabled: boolean): void;
|
|
74
|
+
getPseudoLocEnabled(): Observable<boolean>;
|
|
75
|
+
setRtlEnabled(enabled: boolean): void;
|
|
76
|
+
getRtlEnabled(): Observable<boolean>;
|
|
77
|
+
applyPresetLocale(localeId: string | null): Promise<void>;
|
|
78
|
+
applyPresetI18n(config: I18nPresetConfig | undefined): void;
|
|
79
|
+
getCurrentI18nState(): I18nState;
|
|
80
|
+
getCurrentForcedLocaleId(): string | null;
|
|
81
|
+
private loadFromStorage;
|
|
82
|
+
private migrateOldLanguageKey;
|
|
83
|
+
private applyRtl;
|
|
84
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarInternalI18nService, never>;
|
|
85
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarInternalI18nService>;
|
|
86
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ToolbarWindowOptions } from '../../components/toolbar-tool/toolbar-tool.models';
|
|
2
|
+
import { I18nToolConfig } from './i18n.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ToolbarI18nToolComponent {
|
|
5
|
+
private readonly i18nService;
|
|
6
|
+
protected readonly options: ToolbarWindowOptions;
|
|
7
|
+
readonly unitSystemOptions: {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
readonly dateFormatOptions: {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
readonly firstDayOptions: {
|
|
16
|
+
value: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}[];
|
|
19
|
+
readonly numberFormatOptions: {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}[];
|
|
23
|
+
activeLocale: import("@angular/core").WritableSignal<string>;
|
|
24
|
+
activeTimezone: import("@angular/core").WritableSignal<string>;
|
|
25
|
+
activeCurrency: import("@angular/core").WritableSignal<string>;
|
|
26
|
+
activeUnitSystem: import("@angular/core").WritableSignal<string>;
|
|
27
|
+
activeDateFormat: import("@angular/core").WritableSignal<string>;
|
|
28
|
+
activeFirstDayOfWeek: import("@angular/core").WritableSignal<string>;
|
|
29
|
+
activeNumberFormat: import("@angular/core").WritableSignal<string>;
|
|
30
|
+
pseudoLocEnabled: import("@angular/core").Signal<boolean>;
|
|
31
|
+
rtlEnabled: import("@angular/core").Signal<boolean>;
|
|
32
|
+
toolConfig: import("@angular/core").Signal<I18nToolConfig>;
|
|
33
|
+
localeOptions: import("@angular/core").Signal<{
|
|
34
|
+
value: string;
|
|
35
|
+
label: string;
|
|
36
|
+
}[]>;
|
|
37
|
+
timezoneOptions: import("@angular/core").Signal<{
|
|
38
|
+
value: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}[]>;
|
|
41
|
+
currencyOptions: import("@angular/core").Signal<{
|
|
42
|
+
value: string;
|
|
43
|
+
label: string;
|
|
44
|
+
}[]>;
|
|
45
|
+
private currentLocaleCode;
|
|
46
|
+
private currentTimezone;
|
|
47
|
+
private currentCurrencyCode;
|
|
48
|
+
private readonly previewDate_;
|
|
49
|
+
previewNumber: import("@angular/core").Signal<string>;
|
|
50
|
+
previewDate: import("@angular/core").Signal<string>;
|
|
51
|
+
previewTime: import("@angular/core").Signal<string>;
|
|
52
|
+
previewCurrencyValue: import("@angular/core").Signal<string>;
|
|
53
|
+
pseudoPreview: import("@angular/core").Signal<string>;
|
|
54
|
+
constructor();
|
|
55
|
+
onLocaleChange(localeId: string): void;
|
|
56
|
+
onTimezoneChange(timezoneId: string): void;
|
|
57
|
+
onCurrencyChange(currencyCode: string): void;
|
|
58
|
+
onUnitSystemChange(unitSystem: string): void;
|
|
59
|
+
onPseudoLocToggle(event: Event): void;
|
|
60
|
+
onRtlToggle(event: Event): void;
|
|
61
|
+
onDateFormatChange(value: string): void;
|
|
62
|
+
onFirstDayOfWeekChange(value: string): void;
|
|
63
|
+
onNumberFormatChange(value: string): void;
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarI18nToolComponent, never>;
|
|
65
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarI18nToolComponent, "ndt-i18n-tool", never, {}, {}, never, never, true, never>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface I18nLocale {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
export interface I18nTimezone {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
offset: string;
|
|
10
|
+
}
|
|
11
|
+
export interface I18nCurrency {
|
|
12
|
+
code: string;
|
|
13
|
+
name: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
}
|
|
16
|
+
export type I18nUnitSystem = 'metric' | 'imperial';
|
|
17
|
+
export type I18nDateFormat = 'locale-default' | 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD';
|
|
18
|
+
export type I18nFirstDayOfWeek = 'locale-default' | 'sunday' | 'monday' | 'saturday';
|
|
19
|
+
export type I18nNumberFormat = 'locale-default' | 'period-comma' | 'comma-period' | 'space-comma';
|
|
20
|
+
export interface I18nState {
|
|
21
|
+
locale: I18nLocale | null;
|
|
22
|
+
timezone: I18nTimezone | null;
|
|
23
|
+
currency: I18nCurrency | null;
|
|
24
|
+
unitSystem: I18nUnitSystem | null;
|
|
25
|
+
dateFormat: I18nDateFormat | null;
|
|
26
|
+
firstDayOfWeek: I18nFirstDayOfWeek | null;
|
|
27
|
+
numberFormat: I18nNumberFormat | null;
|
|
28
|
+
pseudoLocEnabled: boolean;
|
|
29
|
+
rtlEnabled: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface I18nPresetConfig {
|
|
32
|
+
locale?: string | null;
|
|
33
|
+
timezone?: string | null;
|
|
34
|
+
currency?: string | null;
|
|
35
|
+
unitSystem?: string | null;
|
|
36
|
+
dateFormat?: string | null;
|
|
37
|
+
firstDayOfWeek?: string | null;
|
|
38
|
+
numberFormat?: string | null;
|
|
39
|
+
pseudoLocEnabled?: boolean;
|
|
40
|
+
rtlEnabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface I18nToolConfig {
|
|
43
|
+
showLocale?: boolean;
|
|
44
|
+
showTimezone?: boolean;
|
|
45
|
+
showCurrency?: boolean;
|
|
46
|
+
showUnits?: boolean;
|
|
47
|
+
showDateFormat?: boolean;
|
|
48
|
+
showFirstDayOfWeek?: boolean;
|
|
49
|
+
showNumberFormat?: boolean;
|
|
50
|
+
showFormattingPreview?: boolean;
|
|
51
|
+
showStressTesting?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const DEFAULT_TIMEZONES: I18nTimezone[];
|
|
54
|
+
export declare const DEFAULT_CURRENCIES: I18nCurrency[];
|
|
55
|
+
export declare const CURRENCY_SYMBOLS: Record<string, string>;
|