orcas-angular 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.
Files changed (43) hide show
  1. package/fesm2022/orcas-angular.mjs +1608 -0
  2. package/fesm2022/orcas-angular.mjs.map +1 -0
  3. package/package.json +39 -25
  4. package/types/orcas-angular.d.ts +460 -0
  5. package/async/README.md +0 -46
  6. package/async/async.ts +0 -16
  7. package/async/cancellation-token.ts +0 -90
  8. package/dev/README.md +0 -41
  9. package/dev/console-hook.ts +0 -25
  10. package/dev/debug.service.ts.example +0 -29
  11. package/framework/README.md +0 -34
  12. package/framework/services-init.ts +0 -25
  13. package/index.ts +0 -25
  14. package/localization/README.md +0 -73
  15. package/localization/localization.interface.ts +0 -18
  16. package/localization/localization.service.ts +0 -131
  17. package/localization/localize.pipe.ts +0 -30
  18. package/log/README.md +0 -275
  19. package/log/echo-provider.ts +0 -27
  20. package/log/echo.ts +0 -635
  21. package/log/index.ts +0 -6
  22. package/log/log-systems.ts +0 -20
  23. package/navigation/README.md +0 -47
  24. package/navigation/back-on-click.directive.ts +0 -19
  25. package/navigation/index.ts +0 -3
  26. package/navigation/navigation-stack.service.ts +0 -33
  27. package/storage/README.md +0 -75
  28. package/storage/capacitor-files.service.ts +0 -38
  29. package/storage/file-box.service.ts +0 -112
  30. package/storage/files.ts +0 -42
  31. package/storage/key-signals.ts +0 -49
  32. package/storage/local-storage-files.service.ts +0 -49
  33. package/storage/settings-signals.service.ts +0 -24
  34. package/storage/settings.service.ts +0 -24
  35. package/storage/tauri-files.service.ts +0 -69
  36. package/theme/README.md +0 -44
  37. package/theme/theme.service.ts +0 -33
  38. package/ui/README.md +0 -42
  39. package/ui/context-menu/context-button.component.ts +0 -55
  40. package/ui/context-menu/context-header.component.ts +0 -15
  41. package/ui/context-menu/context-menu-trigger.directive.ts +0 -26
  42. package/ui/context-menu/context-menu.component.ts +0 -95
  43. package/ui/context-menu/index.ts +0 -4
@@ -1,29 +0,0 @@
1
- import {inject, Injectable} from '@angular/core';
2
- import {ConsoleHook} from "@/lib/orcas-angular/dev/console-hook";
3
-
4
- @Injectable({
5
- providedIn: 'root'
6
- })
7
- class DebugService {
8
- private exampleService: ExampleService = inject(ExampleService);
9
-
10
- constructor() {
11
- ConsoleHook.register("example", this.getExample);
12
- ConsoleHook.register("nop", this.nop);
13
- }
14
-
15
- private getExample = async () => {
16
- return this.exampleService;
17
- };
18
-
19
- private nop() {
20
- console.log("nop");
21
- return "1";
22
- }
23
- }
24
-
25
- class ExampleService {
26
- async foo() {
27
- return "bar";
28
- }
29
- }
@@ -1,34 +0,0 @@
1
- # framework
2
-
3
- Angular framework utilities that help with application startup and service lifecycle management.
4
-
5
- ## Files
6
-
7
- ### `services-init.ts`
8
-
9
- `ServicesInit` is a root-level Angular service that provides a typed, async-aware way to retrieve and initialize other services during application bootstrap.
10
-
11
- **Why it exists:** Angular's DI container instantiates services lazily and synchronously. `ServicesInit` bridges the gap when a service needs async initialization (e.g. loading a file, fetching config) before the app is ready to use it.
12
-
13
- **Method:**
14
-
15
- ```typescript
16
- async init<T>(serviceClass: any, ...params: unknown[]): Promise<T>
17
- ```
18
-
19
- - Retrieves the service instance from the injector.
20
- - If the service has an `init(...params)` method, calls it and awaits completion.
21
- - If initialization parameters are provided to a service that has no `init` method, an error is thrown.
22
- - Returns the fully initialized service instance, typed as `T`.
23
-
24
- ## Usage
25
-
26
- ```typescript
27
- import { ServicesInit } from '@/lib/orcas-angular/framework/services-init';
28
-
29
- // In your app initialization (e.g. APP_INITIALIZER or main bootstrap):
30
- const servicesInit = injector.get(ServicesInit);
31
-
32
- await servicesInit.init(FileBoxService, 'app-data.json');
33
- await servicesInit.init(LocalizationService, 'assets/translations.json', 'en');
34
- ```
@@ -1,25 +0,0 @@
1
- import { Injectable, Injector, Type } from '@angular/core';
2
-
3
- @Injectable({ providedIn: 'root' })
4
- export class ServicesInit {
5
- constructor(private injector: Injector) {
6
- }
7
-
8
- async init<T>(serviceClass: any, ...params: unknown[]): Promise<T> {
9
- let className = `${serviceClass.name || 'unknown'}`;
10
- const instance = this.injector.get(serviceClass) as any;
11
-
12
- if (!instance)
13
- throw new Error(`Service not found: ${className}`);
14
-
15
- const hasInit = typeof instance.init === 'function';
16
-
17
- if (params.length > 0 && !hasInit)
18
- throw new Error(`Service ${className} has no init method but initialization parameters were provided.`);
19
-
20
- if (hasInit)
21
- await instance.init(...params);
22
-
23
- return instance as T;
24
- }
25
- }
package/index.ts DELETED
@@ -1,25 +0,0 @@
1
- export * from './async/async.ts';
2
- export * from './async/cancellation-token.ts';
3
- export * from './dev/console-hook.ts';
4
- export * from './framework/services-init.ts';
5
- export * from './localization/localization.service.ts';
6
- export * from './localization/localize.pipe.ts';
7
- export * from './localization/localization.interface.ts';
8
- export * from './log/echo.ts';
9
- export * from './log/log-systems.ts';
10
- export * from './log/echo-provider.ts';
11
- export * from './navigation/navigation-stack.service.ts';
12
- export * from './navigation/back-on-click.directive.ts';
13
- export * from './storage/files.ts';
14
- export * from './storage/file-box.service.ts';
15
- export * from './storage/key-signals.ts';
16
- export * from './storage/settings-signals.service.ts';
17
- export * from './storage/settings.service.ts';
18
- export * from './storage/tauri-files.service.ts';
19
- export * from './storage/capacitor-files.service.ts';
20
- export * from './storage/local-storage-files.service.ts';
21
- export * from './theme/theme.service.ts';
22
- export * from './ui/context-menu/context-menu.component.ts';
23
- export * from './ui/context-menu/context-header.component.ts';
24
- export * from './ui/context-menu/context-button.component.ts';
25
- export * from './ui/context-menu/context-menu-trigger.directive.ts';
@@ -1,73 +0,0 @@
1
- # localization
2
-
3
- > A README.md is also available in the `localization` folder.
4
-
5
- Angular service and pipe for loading and applying multi-language translations at runtime.
6
-
7
- ## Files
8
-
9
- ### `localization.interface.ts`
10
-
11
- `ILocalizationService` — interface defining the public contract that any localization service implementation must satisfy.
12
-
13
- ### `localization.service.ts`
14
-
15
- `LocalizationService` is the concrete implementation. It loads a JSON translation file over HTTP and exposes a reactive API based on Angular signals.
16
-
17
- **Key features:**
18
- - Loads translations from a configurable JSON file path (default: `assets/translations.json`).
19
- - Persists the active language in `localStorage` and restores it on startup.
20
- - Supports **nested keys** via dot notation (e.g. `"settings.title"`).
21
- - Supports **pluralization** via the `__1` suffix convention (e.g. a key named `"items__1"` is used when `params.count === 1`).
22
- - Supports **parameter substitution** using `{{index}}` (array) or `{{key}}` (object) placeholders.
23
- - Falls back to the default language if a key is missing for the active language.
24
-
25
- **Reactive signal:**
26
- - **`$currentLang`** — Computed signal that emits whenever the active language changes.
27
-
28
- **Methods:**
29
-
30
- | Method | Description |
31
- |---|---|
32
- | `init(jsonPath?, defaultLanguage?, storageKey?)` | Loads the translation file and configures defaults. Call during app bootstrap. |
33
- | `getLanguage()` | Returns the current language code. |
34
- | `getDefaultLanguage()` | Returns the default/fallback language code. |
35
- | `setActiveLanguage(lang)` | Switches the active language and persists it. |
36
- | `translate(key, params?, language?)` | Resolves a translation key with optional parameter substitution. |
37
-
38
- ### `localize.pipe.ts`
39
-
40
- `LocalizePipe` (`| localize`) is an impure standalone pipe that wraps `LocalizationService.translate()`. It re-evaluates only when the language, key, or params change, keeping re-render cost minimal.
41
-
42
- ## Translation file format
43
-
44
- ```json
45
- {
46
- "greeting": {
47
- "en": "Hello, {{name}}!",
48
- "es": "¡Hola, {{name}}!"
49
- },
50
- "items": {
51
- "en": "{{count}} items",
52
- "es": "{{count}} elementos"
53
- },
54
- "items__1": {
55
- "en": "1 item",
56
- "es": "1 elemento"
57
- }
58
- }
59
- ```
60
-
61
- ## Usage
62
-
63
- ```typescript
64
- // Bootstrap (e.g. in APP_INITIALIZER):
65
- await servicesInit.init(LocalizationService, 'assets/translations.json', 'en');
66
-
67
- // In a template:
68
- {{ 'greeting' | localize: { name: 'World' } }}
69
-
70
- // Programmatically:
71
- localizationService.translate('items', { count: 3 });
72
- localizationService.setActiveLanguage('es');
73
- ```
@@ -1,18 +0,0 @@
1
- import {Signal} from '@angular/core';
2
-
3
- export interface ILocalizationService {
4
- /** Emits the current language as a signal */
5
- $currentLang: Signal<string>;
6
-
7
- /** Gets the current active language code */
8
- getLanguage(): string;
9
-
10
- /** Gets the default language code */
11
- getDefaultLanguage(): string;
12
-
13
- /** Sets the current active language */
14
- setActiveLanguage(lang: string): void;
15
-
16
- /** Translates a key, possibly with params and for a specific language */
17
- translate(key: string, params?: any, language?: string): string;
18
- }
@@ -1,131 +0,0 @@
1
- import { computed, inject, Injectable, signal } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { ILocalizationService } from './localization.interface.ts';
4
-
5
- @Injectable({
6
- providedIn: 'root'
7
- })
8
- export class LocalizationService implements ILocalizationService {
9
- private defaultLanguage = 'en';
10
- private storageKey = 'orcas-language';
11
-
12
- private translations: any = {};
13
- private loaded = false;
14
-
15
- private $language: ReturnType<typeof signal<string>>;
16
- public $currentLang = computed(() => this.$language());
17
-
18
- private http = inject(HttpClient);
19
-
20
- constructor() {
21
- this.$language = signal(this.getStoredLanguage());
22
- }
23
-
24
- public async init(
25
- jsonPath: string = 'assets/translations.json',
26
- defaultLanguage: string = 'en',
27
- storageKey: string = 'orcas-language'
28
- ): Promise<void> {
29
- this.defaultLanguage = defaultLanguage;
30
- this.storageKey = storageKey;
31
- this.$language.set(this.getStoredLanguage());
32
-
33
- try {
34
- this.translations = await this.http.get(jsonPath).toPromise();
35
- this.loaded = true;
36
- }
37
- catch (err) {
38
- console.error('Failed to load translations:', err);
39
- }
40
- }
41
-
42
- getLanguage(): string {
43
- return this.$language();
44
- }
45
-
46
- getDefaultLanguage(): string {
47
- return this.defaultLanguage;
48
- }
49
-
50
- setActiveLanguage(lang: string): void {
51
- if (lang !== this.$language()) {
52
- localStorage.setItem(this.storageKey, lang);
53
- this.$language.set(lang);
54
- }
55
- }
56
-
57
- translate(key: string, params?: any, language?: string): string {
58
- const lang = language || this.getLanguage();
59
-
60
- if (!this.loaded) {
61
- console.error('Localization: Translations not loaded yet!');
62
- return key;
63
- }
64
-
65
- let translation = null;
66
-
67
- // Handle pluralization: try singular suffix __1 first if count is 1
68
- if (params && params.count === 1)
69
- translation = this.resolveKey(`${key}__1`);
70
-
71
- if (!translation)
72
- translation = this.resolveKey(key);
73
-
74
- if (!translation) {
75
- console.warn(`Localization: Key not found for "${key}".`);
76
- return key;
77
- }
78
-
79
- let translatedText = translation[lang];
80
-
81
- if (!translatedText) {
82
- console.warn(`Localization: Key "${key}" not found for language "${lang}". Falling back to default language.`);
83
- translatedText = translation[this.defaultLanguage];
84
- }
85
-
86
- if (!translatedText) {
87
- console.error(`Localization: Key "${key}" not found for default language "${this.defaultLanguage}".`);
88
- return key;
89
- }
90
-
91
- if (params) {
92
- if (Array.isArray(params))
93
- return this.replaceArrayParams(translatedText, params);
94
- else
95
- return this.replaceObjectParams(translatedText, params);
96
- }
97
-
98
- return translatedText;
99
- }
100
-
101
- private resolveKey(key: string): any {
102
- const keys = key.split('.');
103
- let translation = this.translations;
104
- for (const k of keys) {
105
- if (!translation[k])
106
- return null;
107
- translation = translation[k];
108
- }
109
- return translation;
110
- }
111
-
112
- private getStoredLanguage(): string {
113
- return localStorage.getItem(this.storageKey) || this.defaultLanguage;
114
- }
115
-
116
- private replaceArrayParams(text: string, params: any[]): string {
117
- let result = text;
118
- params.forEach((param, index) => {
119
- result = result.replace(new RegExp(`\\{\\{${index}\\}\\}`, 'g'), param.toString());
120
- });
121
- return result;
122
- }
123
-
124
- private replaceObjectParams(text: string, params: any): string {
125
- let result = text;
126
- Object.keys(params).forEach(key => {
127
- result = result.replace(new RegExp(`\\{\\{${key}\\}\\}`, 'g'), params[key].toString());
128
- });
129
- return result;
130
- }
131
- }
@@ -1,30 +0,0 @@
1
- import {Pipe, PipeTransform} from '@angular/core';
2
- import {LocalizationService} from './localization.service.ts';
3
-
4
- @Pipe({
5
- name: 'localize',
6
- standalone: true,
7
- pure: false
8
- })
9
- export class LocalizePipe implements PipeTransform {
10
- private lastLanguage: string = '';
11
- private lastKey: string = '';
12
- private lastParams: any;
13
- private lastResult: string = '';
14
-
15
- constructor(private localizationService: LocalizationService) {
16
- }
17
-
18
- transform(key: string, params?: any): string {
19
- if (this.localizationService.$currentLang() !== this.lastLanguage
20
- || key !== this.lastKey
21
- || params !== this.lastParams) {
22
- this.lastLanguage = this.localizationService.$currentLang();
23
- this.lastKey = key;
24
- this.lastParams = params;
25
- this.lastResult = this.localizationService.translate(key, params);
26
- }
27
-
28
- return this.lastResult;
29
- }
30
- }
package/log/README.md DELETED
@@ -1,275 +0,0 @@
1
- # Echo TypeScript
2
-
3
- TypeScript port of the Echo.cs logging library. This is a flexible and powerful logging library with support for log levels, system-based organization, and custom log writers.
4
-
5
- ## Features
6
-
7
- - Structured logging with system tags
8
- - Customizable log levels (per system or global)
9
- - String formatting with parameters (only formatted when log will be written)
10
- - Log-once functionality to prevent duplicate messages
11
- - Extensible with custom log writers
12
- - Console log writer with colors and timestamps included
13
- - TypeScript type safety
14
- - Performance optimized - no allocations when logs are filtered out
15
-
16
- ## Installation
17
-
18
- ```bash
19
- # Install dependencies
20
- npm install
21
-
22
- # Build the library
23
- npm run build
24
- ```
25
-
26
- The compiled JavaScript and type definitions will be in the `dist/` folder.
27
-
28
- ## Quick Start
29
-
30
- ```typescript
31
- import { EchoConsole, LogLevel } from './dist/echo';
32
-
33
- // Create an Echo instance with default console writer
34
- const echo = EchoConsole.new();
35
-
36
- // Get a logger
37
- const logger = echo.getLogger();
38
-
39
- // Log messages
40
- logger.debug("System", "Debug message");
41
- logger.info("System", "Info message");
42
- logger.warn("System", "Warning message");
43
- logger.error("System", "Error message");
44
- ```
45
-
46
- ## Usage Examples
47
-
48
- ### Basic Logging
49
-
50
- ```typescript
51
- import { EchoConsole } from './echo';
52
-
53
- const echo = EchoConsole.new();
54
- const logger = echo.getLogger();
55
-
56
- // Log with different levels
57
- logger.debug("GUI", "This is a debug message from the GUI system.");
58
- logger.info("Physics", "This is an info message from the Physics system.");
59
- logger.warn("AI", "This is a warning message from the AI system.");
60
- logger.error("Rendering", "This is an error message from the Rendering system.");
61
- ```
62
-
63
- ### System Logger
64
-
65
- ```typescript
66
- // Get a system-specific logger (cached per system)
67
- const animationLogger = echo.getSystemLogger("Animation");
68
-
69
- // No need to specify system in subsequent calls
70
- animationLogger.debug("This is a debug message from the Animation system.");
71
- animationLogger.info("This is an info message from the Animation system.");
72
- animationLogger.warn("This is a warning message from the Animation system.");
73
- animationLogger.error("This is an error message from the Animation system.");
74
- ```
75
-
76
- ### String Formatting
77
-
78
- ```typescript
79
- // Use formatted strings with parameters
80
- // Formatting is only done IF the log will be written (performance optimization)
81
- const playerName = "John";
82
- const playerHealth = 100;
83
- logger.info("General", "Player {0} has {1} health.", playerName, playerHealth);
84
- // Output: Player John has 100 health.
85
- ```
86
-
87
- ### Log Level Management
88
-
89
- ```typescript
90
- import { LogLevel } from './echo';
91
-
92
- // Set default log level (applies to all systems)
93
- echo.settings.setDefaultLevel(LogLevel.Warn); // Only Warn and Error will be logged
94
-
95
- // Set system-specific log level
96
- echo.settings.setSystemLevel("Physics", LogLevel.Debug); // Physics logs everything
97
-
98
- // Get current log level for a system
99
- const level = echo.settings.getSystemLevel("Physics");
100
-
101
- // Clear a system-specific level (reverts to default)
102
- echo.settings.clearSystemLevel("Physics");
103
-
104
- // Clear all system-specific levels
105
- echo.settings.clearSystemLevels();
106
- ```
107
-
108
- ### Log Once
109
-
110
- ```typescript
111
- // Log a message only once, even if called multiple times
112
- logger.debug1("System", "This will only appear once");
113
- logger.debug1("System", "This will only appear once"); // Won't be logged
114
- logger.debug1("System", "This will only appear once"); // Won't be logged
115
-
116
- // Also works with other log levels
117
- logger.info1("System", "Info once");
118
- logger.warn1("System", "Warn once");
119
- logger.error1("System", "Error once");
120
- ```
121
-
122
- ### Custom Configuration
123
-
124
- ```typescript
125
- import { LogWriterConfig, SystemColor } from './echo';
126
-
127
- const config = new LogWriterConfig();
128
- config.timestamp = true; // Include timestamps (default: true)
129
- config.levelLabels = true; // Include log level labels (default: true)
130
- config.levelColors = true; // Use colors for log levels (default: true)
131
- config.systemColor = SystemColor.LabelAndMessage; // Color both label and message
132
-
133
- const echo = EchoConsole.new(config);
134
- ```
135
-
136
- ### Custom Log Writer
137
-
138
- ```typescript
139
- import { Echo, EchoLogWriter, LogLevel } from './echo';
140
-
141
- class CustomLogWriter implements EchoLogWriter {
142
- writeLog(level: LogLevel, system: string, message: string): void {
143
- // Custom log writing logic here
144
- const timestamp = new Date().toISOString();
145
- console.log(`${timestamp} | ${level} | [${system}] ${message}`);
146
- }
147
- }
148
-
149
- // Use custom writer
150
- const customWriter = new CustomLogWriter();
151
- const echo = new Echo(customWriter);
152
- ```
153
-
154
- ## API Reference
155
-
156
- ### Echo Class
157
-
158
- Main entry point for the library.
159
-
160
- ```typescript
161
- constructor(writer: EchoLogWriter)
162
- ```
163
-
164
- - **getLogger()**: Returns the main logger instance (cached)
165
- - **getSystemLogger(system: string)**: Returns a system-specific logger (cached per system)
166
- - **settings**: Access to EchoSettings for configuration
167
-
168
- ### EchoLogger Class
169
-
170
- Main logger with system parameter required.
171
-
172
- **Methods** (all have the same signature pattern):
173
- - **debug(system: string, message: string, ...params: any[])**
174
- - **info(system: string, message: string, ...params: any[])**
175
- - **warn(system: string, message: string, ...params: any[])**
176
- - **error(system: string, message: string, ...params: any[])**
177
-
178
- **Log-once variants** (append `1` to method name):
179
- - **debug1, info1, warn1, error1** - Same signatures as above
180
-
181
- ### EchoSystemLogger Class
182
-
183
- System-specific logger (system is set at creation).
184
-
185
- **Methods** (no system parameter needed):
186
- - **debug(message: string, ...params: any[])**
187
- - **info(message: string, ...params: any[])**
188
- - **warn(message: string, ...params: any[])**
189
- - **error(message: string, ...params: any[])**
190
-
191
- **Log-once variants**:
192
- - **debug1, info1, warn1, error1** - Same signatures as above
193
-
194
- ### EchoSettings Class
195
-
196
- Configuration for log levels.
197
-
198
- - **defaultLevel**: Get/set the default log level
199
- - **setDefaultLevel(level: LogLevel)**: Set default log level for all systems
200
- - **setSystemLevel(system: string, level: LogLevel)**: Set log level for specific system
201
- - **getSystemLevel(system: string)**: Get log level for specific system
202
- - **clearSystemLevel(system: string)**: Remove system-specific level
203
- - **clearSystemLevels()**: Remove all system-specific levels
204
- - **getAllSystemLevels()**: Get all system-specific levels
205
- - **onUpdated(callback: () => void)**: Register callback for settings updates
206
-
207
- ### LogLevel Enum
208
-
209
- ```typescript
210
- enum LogLevel {
211
- None = 0, // No logging
212
- Error = 1, // Errors only
213
- Warn = 2, // Warnings and errors
214
- Info = 3, // Info, warnings, and errors
215
- Debug = 4 // All logs (most verbose)
216
- }
217
- ```
218
-
219
- ### LogWriterConfig Class
220
-
221
- Configuration for the console log writer.
222
-
223
- - **timestamp**: Include timestamps (default: true)
224
- - **levelLabels**: Include log level labels (default: true)
225
- - **levelColors**: Use colors for log levels (default: true)
226
- - **systemColor**: Control system color usage (default: SystemColor.LabelOnly)
227
-
228
- ### SystemColor Enum
229
-
230
- ```typescript
231
- enum SystemColor {
232
- None, // No color
233
- LabelOnly, // Color only the system label
234
- LabelAndMessage // Color both label and message
235
- }
236
- ```
237
-
238
- ### EchoConsole Helper
239
-
240
- Factory for creating Echo instances with console writer.
241
-
242
- ```typescript
243
- EchoConsole.new(config?: LogWriterConfig): Echo
244
- ```
245
-
246
- ## Differences from C# Version
247
-
248
- The TypeScript port maintains the same API signatures as the C# version with these differences:
249
-
250
- 1. **Case Convention**: TypeScript methods use camelCase (e.g., `getLogger()`) instead of PascalCase
251
- 2. **Generic Overloads**: Instead of C# generic type parameters, TypeScript uses rest parameters (`...params: any[]`)
252
- 3. **Events**: Instead of C# events, use `onUpdated(callback)` method to register callbacks
253
- 4. **Properties**: C# properties become TypeScript getters/setters
254
- 5. **No Unity**: This port excludes all Unity-specific features
255
-
256
- ## Running the Demo
257
-
258
- ```bash
259
- # Compile
260
- tsc echo.demo.ts
261
-
262
- # Run
263
- node echo.demo.js
264
- ```
265
-
266
- ## Running Tests
267
-
268
- ```bash
269
- # Compile and run tests
270
- tsc && node echo.test.js
271
- ```
272
-
273
- ## License
274
-
275
- Copyright © 2025 Racso
@@ -1,27 +0,0 @@
1
- /**
2
- * Echo provider for Angular dependency injection.
3
- * Provides a singleton Echo instance with console writer.
4
- */
5
- import { InjectionToken, Provider } from '@angular/core';
6
- import { Echo, EchoConsole } from './echo.ts';
7
-
8
- /**
9
- * Injection token for Echo logger instance
10
- */
11
- export const ECHO = new InjectionToken<Echo>('Echo Logger Instance');
12
-
13
- /**
14
- * Factory function to create Echo instance
15
- */
16
- export function echoFactory(): Echo {
17
- return EchoConsole.new();
18
- }
19
-
20
- /**
21
- * Provider for Echo logger
22
- * Use this in your module providers or inject it in services
23
- */
24
- export const ECHO_PROVIDER: Provider = {
25
- provide: ECHO,
26
- useFactory: echoFactory
27
- };