orcas-angular 1.0.4 → 1.0.6

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 (37) hide show
  1. package/fesm2022/orcas-angular.mjs +1608 -0
  2. package/fesm2022/orcas-angular.mjs.map +1 -0
  3. package/package.json +39 -36
  4. package/types/orcas-angular.d.ts +460 -0
  5. package/.claude/settings.local.json +0 -8
  6. package/async/async.ts +0 -16
  7. package/async/cancellation-token.ts +0 -90
  8. package/dev/console-hook.ts +0 -25
  9. package/dev/debug.service.ts.example +0 -29
  10. package/framework/services-init.ts +0 -25
  11. package/index.ts +0 -25
  12. package/localization/localization.interface.ts +0 -18
  13. package/localization/localization.service.ts +0 -131
  14. package/localization/localize.pipe.ts +0 -30
  15. package/log/echo-provider.ts +0 -27
  16. package/log/echo.ts +0 -635
  17. package/log/index.ts +0 -6
  18. package/log/log-systems.ts +0 -20
  19. package/navigation/back-on-click.directive.ts +0 -19
  20. package/navigation/index.ts +0 -3
  21. package/navigation/navigation-stack.service.ts +0 -33
  22. package/ng-package.json +0 -7
  23. package/storage/capacitor-files.service.ts +0 -38
  24. package/storage/file-box.service.ts +0 -112
  25. package/storage/files.ts +0 -42
  26. package/storage/key-signals.ts +0 -49
  27. package/storage/local-storage-files.service.ts +0 -49
  28. package/storage/settings-signals.service.ts +0 -24
  29. package/storage/settings.service.ts +0 -24
  30. package/storage/tauri-files.service.ts +0 -69
  31. package/theme/theme.service.ts +0 -33
  32. package/tsconfig.lib.json +0 -11
  33. package/ui/context-menu/context-button.component.ts +0 -55
  34. package/ui/context-menu/context-header.component.ts +0 -15
  35. package/ui/context-menu/context-menu-trigger.directive.ts +0 -26
  36. package/ui/context-menu/context-menu.component.ts +0 -95
  37. package/ui/context-menu/index.ts +0 -4
@@ -0,0 +1,460 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injector, Signal, PipeTransform, InjectionToken, Provider, ElementRef } from '@angular/core';
3
+ import { Location } from '@angular/common';
4
+ import { Router } from '@angular/router';
5
+
6
+ declare class Async {
7
+ static delay(ms: number): Promise<void>;
8
+ static until(check: () => boolean, timeoutMs?: number, frequencyMs?: number): Promise<void>;
9
+ }
10
+
11
+ interface CancellationToken {
12
+ isCancelled(): boolean;
13
+ throwIfCancelled(): void;
14
+ }
15
+ /**
16
+ * Error thrown when an operation is cancelled
17
+ */
18
+ declare class CancellationError extends Error {
19
+ constructor(message?: string);
20
+ }
21
+ /**
22
+ * Source for creating and managing cancellation tokens
23
+ */
24
+ declare class CancellationTokenSource {
25
+ private _token;
26
+ /**
27
+ * Gets the token currently associated with this source
28
+ */
29
+ get token(): CancellationToken;
30
+ /**
31
+ * Cancels the current token and creates a new one
32
+ */
33
+ newUnique(timeoutMs?: number): CancellationToken;
34
+ /**
35
+ * Cancels the current token
36
+ */
37
+ cancel(): void;
38
+ }
39
+
40
+ declare class ConsoleHook {
41
+ private static commands;
42
+ static initialize(): void;
43
+ static register(commandName: string, method: Function): void;
44
+ static run(input: string, ...additionalParams: any[]): any;
45
+ }
46
+
47
+ declare class ServicesInit {
48
+ private injector;
49
+ constructor(injector: Injector);
50
+ init<T>(serviceClass: any, ...params: unknown[]): Promise<T>;
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<ServicesInit, never>;
52
+ static ɵprov: i0.ɵɵInjectableDeclaration<ServicesInit>;
53
+ }
54
+
55
+ interface ILocalizationService {
56
+ /** Emits the current language as a signal */
57
+ $currentLang: Signal<string>;
58
+ /** Gets the current active language code */
59
+ getLanguage(): string;
60
+ /** Gets the default language code */
61
+ getDefaultLanguage(): string;
62
+ /** Sets the current active language */
63
+ setActiveLanguage(lang: string): void;
64
+ /** Translates a key, possibly with params and for a specific language */
65
+ translate(key: string, params?: any, language?: string): string;
66
+ }
67
+
68
+ declare class LocalizationService implements ILocalizationService {
69
+ private defaultLanguage;
70
+ private storageKey;
71
+ private translations;
72
+ private loaded;
73
+ private $language;
74
+ $currentLang: i0.Signal<string>;
75
+ private http;
76
+ constructor();
77
+ init(jsonPath?: string, defaultLanguage?: string, storageKey?: string): Promise<void>;
78
+ getLanguage(): string;
79
+ getDefaultLanguage(): string;
80
+ setActiveLanguage(lang: string): void;
81
+ translate(key: string, params?: any, language?: string): string;
82
+ private resolveKey;
83
+ private getStoredLanguage;
84
+ private replaceArrayParams;
85
+ private replaceObjectParams;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationService, never>;
87
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocalizationService>;
88
+ }
89
+
90
+ declare class LocalizePipe implements PipeTransform {
91
+ private localizationService;
92
+ private lastLanguage;
93
+ private lastKey;
94
+ private lastParams;
95
+ private lastResult;
96
+ constructor(localizationService: LocalizationService);
97
+ transform(key: string, params?: any): string;
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalizePipe, never>;
99
+ static ɵpipe: i0.ɵɵPipeDeclaration<LocalizePipe, "localize", true>;
100
+ }
101
+
102
+ /**
103
+ * Echo - A flexible logging library
104
+ * TypeScript port of Echo.cs core functionality (excluding Unity-specific features)
105
+ */
106
+ declare enum LogLevel {
107
+ None = 0,
108
+ Error = 1,
109
+ Warn = 2,
110
+ Info = 3,
111
+ Debug = 4
112
+ }
113
+ declare enum LogMode {
114
+ Always = 0,
115
+ Once = 1
116
+ }
117
+ declare enum SystemColor {
118
+ None = 0,
119
+ LabelOnly = 1,
120
+ LabelAndMessage = 2
121
+ }
122
+ interface EchoLogWriter {
123
+ writeLog(level: LogLevel, system: string, message: string): void;
124
+ }
125
+ declare class LogWriterConfig {
126
+ timestamp: boolean;
127
+ levelLabels: boolean;
128
+ levelColors: boolean;
129
+ systemColor: SystemColor;
130
+ }
131
+ declare class HashesManager {
132
+ private hashes;
133
+ tryAdd(system: string, message: string): boolean;
134
+ clear(): void;
135
+ }
136
+ declare class LoggerCore {
137
+ private readonly logWriter;
138
+ private readonly echoSettings;
139
+ private readonly hashes;
140
+ constructor(config: EchoSettings, hashes: HashesManager, logger: EchoLogWriter);
141
+ private isEnabled;
142
+ private shouldLogOnce;
143
+ clearHashes(): void;
144
+ private write;
145
+ writeIfEnabled(level: LogLevel, mode: LogMode, system: string, message: string): void;
146
+ writeIfEnabled1<T1>(level: LogLevel, mode: LogMode, system: string, format: string, param1: T1): void;
147
+ writeIfEnabled2<T1, T2>(level: LogLevel, mode: LogMode, system: string, format: string, param1: T1, param2: T2): void;
148
+ writeIfEnabled3<T1, T2, T3>(level: LogLevel, mode: LogMode, system: string, format: string, param1: T1, param2: T2, param3: T3): void;
149
+ writeIfEnabled4<T1, T2, T3, T4>(level: LogLevel, mode: LogMode, system: string, format: string, param1: T1, param2: T2, param3: T3, param4: T4): void;
150
+ private formatString1;
151
+ private formatString2;
152
+ private formatString3;
153
+ private formatString4;
154
+ }
155
+ declare class EchoSettings {
156
+ private systemLevels;
157
+ private _defaultLevel;
158
+ private updateCallbacks;
159
+ get defaultLevel(): LogLevel;
160
+ onUpdated(callback: () => void): void;
161
+ private triggerUpdate;
162
+ setSystemLevel(system: string, level: LogLevel): void;
163
+ clearSystemLevel(system: string): void;
164
+ getSystemLevel(system: string): LogLevel;
165
+ tryGetSystemLevel(system: string): {
166
+ success: boolean;
167
+ level?: LogLevel;
168
+ };
169
+ clearSystemLevels(): void;
170
+ setDefaultLevel(level: LogLevel): void;
171
+ getAllSystemLevels(): ReadonlyMap<string, LogLevel>;
172
+ private throwIfInvalidSystem;
173
+ }
174
+ declare class EchoLogger {
175
+ private readonly loggerCore;
176
+ constructor(loggerCore: LoggerCore);
177
+ debug(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
178
+ debug1(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
179
+ info(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
180
+ info1(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
181
+ warn(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
182
+ warn1(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
183
+ error(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
184
+ error1(system: string, formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
185
+ }
186
+ declare class EchoSystemLogger {
187
+ private readonly loggerCore;
188
+ private readonly system;
189
+ constructor(loggerCore: LoggerCore, system: string);
190
+ debug(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
191
+ debug1(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
192
+ info(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
193
+ info1(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
194
+ warn(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
195
+ warn1(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
196
+ error(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
197
+ error1(formatOrMessage: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
198
+ }
199
+ declare class Echo {
200
+ private readonly loggerCore;
201
+ private readonly loggers;
202
+ private readonly _settings;
203
+ constructor(writer: EchoLogWriter);
204
+ getLogger(): EchoLogger;
205
+ getSystemLogger(system: string): EchoSystemLogger;
206
+ get settings(): EchoSettings;
207
+ }
208
+ declare class EchoConsole {
209
+ static new(config?: LogWriterConfig): Echo;
210
+ }
211
+
212
+ /**
213
+ * Constants for Echo logging system names.
214
+ * Using constants ensures consistency and prevents typos.
215
+ */
216
+ declare class LogSystems {
217
+ /** System for profiling and performance measurements */
218
+ static readonly PROFILING = "Profiling";
219
+ /** System for general application logs */
220
+ static readonly GENERAL = "General";
221
+ /** System for Git-related operations */
222
+ static readonly GIT = "Git";
223
+ /** System for UI and visual operations */
224
+ static readonly UI = "UI";
225
+ /** System for repository operations */
226
+ static readonly REPOSITORY = "Repository";
227
+ }
228
+
229
+ /**
230
+ * Echo provider for Angular dependency injection.
231
+ * Provides a singleton Echo instance with console writer.
232
+ */
233
+
234
+ /**
235
+ * Injection token for Echo logger instance
236
+ */
237
+ declare const ECHO: InjectionToken<Echo>;
238
+ /**
239
+ * Factory function to create Echo instance
240
+ */
241
+ declare function echoFactory(): Echo;
242
+ /**
243
+ * Provider for Echo logger
244
+ * Use this in your module providers or inject it in services
245
+ */
246
+ declare const ECHO_PROVIDER: Provider;
247
+
248
+ declare class NavigationStackService {
249
+ private router;
250
+ private location;
251
+ private history;
252
+ constructor(router: Router, location: Location);
253
+ goBack(): void;
254
+ getBack(): string;
255
+ static ɵfac: i0.ɵɵFactoryDeclaration<NavigationStackService, never>;
256
+ static ɵprov: i0.ɵɵInjectableDeclaration<NavigationStackService>;
257
+ }
258
+
259
+ declare class BackOnClickDirective {
260
+ private navigationStack;
261
+ constructor(navigationStack: NavigationStackService);
262
+ onClick(event: Event): void;
263
+ static ɵfac: i0.ɵɵFactoryDeclaration<BackOnClickDirective, never>;
264
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BackOnClickDirective, "[back-on-click]", never, {}, {}, never, never, true, never>;
265
+ }
266
+
267
+ declare abstract class FilesService {
268
+ /**
269
+ * Initializes the service.
270
+ * This should handle any setup required by the specific implementation.
271
+ */
272
+ abstract init(...args: any[]): Promise<void>;
273
+ /**
274
+ * Joins a filename with the storage base directory to get a full path.
275
+ * Returns a string or a Promise of a string depending on implementation.
276
+ * In some platforms, this may return null if paths are not supported.
277
+ */
278
+ abstract joinStoragePath(filePath: string): Promise<string | null>;
279
+ /**
280
+ * Checks if a file exists in the platform-specific storage.
281
+ */
282
+ abstract hasInStorage(filePath: string): Promise<boolean>;
283
+ /**
284
+ * Reads a file from the platform-specific storage.
285
+ */
286
+ abstract readFromStorage(filePath: string): Promise<string>;
287
+ /**
288
+ * Writes data to a file in the platform-specific storage.
289
+ */
290
+ abstract writeToStorage(filePath: string, data: string): Promise<void>;
291
+ /**
292
+ * Checks if a file exists in the project's assets/resources.
293
+ */
294
+ abstract hasInProject(filePath: string): Promise<boolean>;
295
+ /**
296
+ * Reads a file from the project's assets/resources.
297
+ */
298
+ abstract readFromProject(filePath: string): Promise<string>;
299
+ static ɵfac: i0.ɵɵFactoryDeclaration<FilesService, never>;
300
+ static ɵprov: i0.ɵɵInjectableDeclaration<FilesService>;
301
+ }
302
+
303
+ interface BoxData {
304
+ [key: string]: any;
305
+ }
306
+ declare class FileBoxService {
307
+ private files;
308
+ private status;
309
+ private path;
310
+ private saveEnqueued;
311
+ private $dataWritable;
312
+ $data: i0.Signal<BoxData>;
313
+ init(path: string): Promise<void>;
314
+ has(key: string): boolean;
315
+ set(key: string, value: any): void;
316
+ setAll(data: BoxData): void;
317
+ remove(key: string): void;
318
+ private checkType;
319
+ save(): Promise<void>;
320
+ static ɵfac: i0.ɵɵFactoryDeclaration<FileBoxService, never>;
321
+ static ɵprov: i0.ɵɵInjectableDeclaration<FileBoxService>;
322
+ }
323
+
324
+ declare abstract class KeySignals {
325
+ protected abstract $data(): Record<string, any>;
326
+ protected abstract setRawValue(key: string, value: any): Promise<void>;
327
+ protected abstract setMultipleRawValues(values: Record<string, any>): Promise<void>;
328
+ protected readonly SEPARATOR = "|";
329
+ getCanonicalKey(path: string[]): string;
330
+ getNewSignal<T>(defaultValue: T, ...path: string[]): Signal<T>;
331
+ getValue<T>(defaultValue: T, ...path: string[]): T;
332
+ set(value: any, ...path: string[]): Promise<void>;
333
+ /**
334
+ * Clears all keys that start with the given prefix.
335
+ */
336
+ clearByPrefix(...pathPrefix: string[]): Promise<void>;
337
+ }
338
+
339
+ declare class SettingsSignalsService extends KeySignals {
340
+ private filebox;
341
+ protected $data(): Record<string, any>;
342
+ protected setRawValue(key: string, value: any): Promise<void>;
343
+ protected setMultipleRawValues(values: Record<string, any>): Promise<void>;
344
+ static ɵfac: i0.ɵɵFactoryDeclaration<SettingsSignalsService, never>;
345
+ static ɵprov: i0.ɵɵInjectableDeclaration<SettingsSignalsService>;
346
+ }
347
+
348
+ declare class SettingsService {
349
+ private fileboxService;
350
+ private sss;
351
+ private readonly SETTINGS_KEY;
352
+ getNewSignal<T>(defaultValue: T, ...path: string[]): Signal<T>;
353
+ set(value: any, ...path: string[]): Promise<void>;
354
+ save(): Promise<void>;
355
+ static ɵfac: i0.ɵɵFactoryDeclaration<SettingsService, never>;
356
+ static ɵprov: i0.ɵɵInjectableDeclaration<SettingsService>;
357
+ }
358
+
359
+ declare class TauriFilesService extends FilesService {
360
+ private static _isTauri;
361
+ static isSupported(): boolean;
362
+ init(): Promise<void>;
363
+ joinStoragePath(filePath: string): Promise<string | null>;
364
+ hasInStorage(filePath: string): Promise<boolean>;
365
+ readFromStorage(filePath: string): Promise<string>;
366
+ writeToStorage(filePath: string, data: string): Promise<void>;
367
+ hasInProject(filePath: string): Promise<boolean>;
368
+ readFromProject(filePath: string): Promise<string>;
369
+ static ɵfac: i0.ɵɵFactoryDeclaration<TauriFilesService, never>;
370
+ static ɵprov: i0.ɵɵInjectableDeclaration<TauriFilesService>;
371
+ }
372
+
373
+ declare class CapacitorFilesService extends FilesService {
374
+ static isSupported(): boolean;
375
+ init(): Promise<void>;
376
+ joinStoragePath(filePath: string): Promise<string | null>;
377
+ hasInStorage(filePath: string): Promise<boolean>;
378
+ readFromStorage(filePath: string): Promise<string>;
379
+ writeToStorage(filePath: string, data: string): Promise<void>;
380
+ hasInProject(filePath: string): Promise<boolean>;
381
+ readFromProject(filePath: string): Promise<string>;
382
+ static ɵfac: i0.ɵɵFactoryDeclaration<CapacitorFilesService, never>;
383
+ static ɵprov: i0.ɵɵInjectableDeclaration<CapacitorFilesService>;
384
+ }
385
+
386
+ declare class LocalStorageFilesService extends FilesService {
387
+ private http;
388
+ static isSupported(): boolean;
389
+ init(): Promise<void>;
390
+ joinStoragePath(filePath: string): Promise<string | null>;
391
+ hasInStorage(filePath: string): Promise<boolean>;
392
+ readFromStorage(filePath: string): Promise<string>;
393
+ writeToStorage(filePath: string, data: string): Promise<void>;
394
+ hasInProject(filePath: string): Promise<boolean>;
395
+ readFromProject(filePath: string): Promise<string>;
396
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageFilesService, never>;
397
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageFilesService>;
398
+ }
399
+
400
+ declare enum ThemeType {
401
+ Unset = "",
402
+ Light = "light",
403
+ Dark = "dark"
404
+ }
405
+ declare class ThemeService {
406
+ private settings;
407
+ $theme: i0.Signal<ThemeType>;
408
+ $darkMode: i0.Signal<boolean>;
409
+ private effectSetDarkMode;
410
+ setTheme(theme: ThemeType): Promise<void>;
411
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
412
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
413
+ }
414
+
415
+ declare class ContextMenuComponent {
416
+ private elementRef;
417
+ $isSubmenu: i0.InputSignalWithTransform<boolean, unknown>;
418
+ $isVisible: i0.WritableSignal<boolean>;
419
+ $isMeasuring: i0.WritableSignal<boolean>;
420
+ $x: i0.WritableSignal<number>;
421
+ $y: i0.WritableSignal<number>;
422
+ container?: ElementRef<HTMLDivElement>;
423
+ close: i0.OutputEmitterRef<void>;
424
+ constructor(elementRef: ElementRef);
425
+ onDocumentClick(event: MouseEvent): void;
426
+ show(x: number, y: number): void;
427
+ hide(): void;
428
+ private closeMenu;
429
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuComponent, never>;
430
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuComponent, "context-menu", never, { "$isSubmenu": { "alias": "$isSubmenu"; "required": false; "isSignal": true; }; }, { "close": "close"; }, never, ["*"], true, never>;
431
+ }
432
+
433
+ declare class ContextHeaderComponent {
434
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextHeaderComponent, never>;
435
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextHeaderComponent, "context-header", never, {}, {}, never, ["*"], true, never>;
436
+ }
437
+
438
+ declare class ContextButtonComponent {
439
+ danger: i0.InputSignalWithTransform<boolean, unknown>;
440
+ disabled: i0.InputSignalWithTransform<boolean, unknown>;
441
+ hasSubmenu: i0.InputSignalWithTransform<boolean, unknown>;
442
+ $showSubmenu: i0.WritableSignal<boolean>;
443
+ onMouseEnter(): void;
444
+ onMouseLeave(): void;
445
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextButtonComponent, never>;
446
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextButtonComponent, "context-button", never, { "danger": { "alias": "danger"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "hasSubmenu": { "alias": "hasSubmenu"; "required": false; "isSignal": true; }; }, {}, never, ["[icon]", "*", "context-menu"], true, never>;
447
+ }
448
+
449
+ declare class ContextMenuTriggerDirective {
450
+ private elementRef;
451
+ appContextMenu: i0.InputSignal<ContextMenuComponent>;
452
+ beforeOpen: i0.OutputEmitterRef<void>;
453
+ constructor(elementRef: ElementRef);
454
+ onContextMenu(event: MouseEvent): void;
455
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTriggerDirective, never>;
456
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuTriggerDirective, "[appContextMenu]", never, { "appContextMenu": { "alias": "appContextMenu"; "required": true; "isSignal": true; }; }, { "beforeOpen": "beforeOpen"; }, never, never, true, never>;
457
+ }
458
+
459
+ export { Async, BackOnClickDirective, CancellationError, CancellationTokenSource, CapacitorFilesService, ConsoleHook, ContextButtonComponent, ContextHeaderComponent, ContextMenuComponent, ContextMenuTriggerDirective, ECHO, ECHO_PROVIDER, Echo, EchoConsole, EchoLogger, EchoSettings, EchoSystemLogger, FileBoxService, FilesService, KeySignals, LocalStorageFilesService, LocalizationService, LocalizePipe, LogLevel, LogSystems, LogWriterConfig, NavigationStackService, ServicesInit, SettingsService, SettingsSignalsService, SystemColor, TauriFilesService, ThemeService, ThemeType, echoFactory };
460
+ export type { CancellationToken, EchoLogWriter, ILocalizationService };
@@ -1,8 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run:*)",
5
- "Bash(npm:*)"
6
- ]
7
- }
8
- }
package/async/async.ts DELETED
@@ -1,16 +0,0 @@
1
- export class Async {
2
- static async delay(ms: number): Promise<void> {
3
- return new Promise(resolve => setTimeout(resolve, ms));
4
- }
5
-
6
- static async until(check: () => boolean, timeoutMs: number = 10000, frequencyMs: number = 100): Promise<void> {
7
- let timePassed = 0;
8
- while (!check() && timePassed < timeoutMs) {
9
- await Async.delay(frequencyMs);
10
- timePassed += frequencyMs;
11
-
12
- if (timePassed >= timeoutMs)
13
- throw new Error('Timeout while waiting for condition');
14
- }
15
- }
16
- }
@@ -1,90 +0,0 @@
1
- export interface CancellationToken {
2
- isCancelled(): boolean;
3
-
4
- throwIfCancelled(): void;
5
- }
6
-
7
- class CancellationTokenInternal implements CancellationToken {
8
- private _isCancelled: boolean = false;
9
-
10
- constructor(isCancelled: boolean = false) {
11
- this._isCancelled = isCancelled;
12
- }
13
-
14
- /**
15
- * Gets whether cancellation has been requested
16
- */
17
- public isCancelled(): boolean {
18
- return this._isCancelled;
19
- }
20
-
21
- /**
22
- * Throws an error if cancellation has been requested
23
- */
24
- public throwIfCancelled(): void {
25
- if (this._isCancelled) {
26
- throw new CancellationError('Operation was cancelled');
27
- }
28
- }
29
-
30
- /**
31
- * Internal method to cancel the token
32
- */
33
- cancel(): void {
34
- this._isCancelled = true;
35
- }
36
-
37
- /**
38
- * A token that is never cancelled
39
- */
40
- public static readonly None: CancellationToken = new CancellationTokenInternal(false);
41
-
42
- /**
43
- * A token that is already cancelled
44
- */
45
- public static readonly Cancelled: CancellationToken = new CancellationTokenInternal(true);
46
- }
47
-
48
- /**
49
- * Error thrown when an operation is cancelled
50
- */
51
- export class CancellationError extends Error {
52
- constructor(message: string = 'Operation was cancelled') {
53
- super(message);
54
- this.name = 'CancellationError';
55
- }
56
- }
57
-
58
- /**
59
- * Source for creating and managing cancellation tokens
60
- */
61
- export class CancellationTokenSource {
62
- private _token: CancellationTokenInternal = new CancellationTokenInternal();
63
-
64
- /**
65
- * Gets the token currently associated with this source
66
- */
67
- public get token(): CancellationToken {
68
- return this._token;
69
- }
70
-
71
- /**
72
- * Cancels the current token and creates a new one
73
- */
74
- public newUnique(timeoutMs: number = -1): CancellationToken {
75
- this._token.cancel();
76
- this._token = new CancellationTokenInternal();
77
-
78
- if (timeoutMs != -1)
79
- setTimeout(() => this._token.cancel(), timeoutMs);
80
-
81
- return this._token;
82
- }
83
-
84
- /**
85
- * Cancels the current token
86
- */
87
- public cancel(): void {
88
- this._token.cancel();
89
- }
90
- }
@@ -1,25 +0,0 @@
1
- export class ConsoleHook {
2
- private static commands: { [key: string]: Function } = {};
3
-
4
- static initialize() {
5
- if (!(window as any).r)
6
- (window as any).r = ConsoleHook.run.bind(ConsoleHook);
7
- }
8
-
9
- static register(commandName: string, method: Function) {
10
- ConsoleHook.initialize();
11
- ConsoleHook.commands[commandName] = method;
12
- }
13
-
14
- static run(input: string, ...additionalParams: any[]) {
15
- const [commandName, ...params] = input.split(' ');
16
- const command = ConsoleHook.commands[commandName];
17
-
18
- if (command) {
19
- return command(...params, ...additionalParams);
20
- }
21
- else {
22
- console.error(`Custom command "${commandName}" not found.`);
23
- }
24
- }
25
- }
@@ -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,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';
2
- export * from './async/cancellation-token';
3
- export * from './dev/console-hook';
4
- export * from './framework/services-init';
5
- export * from './localization/localization.service';
6
- export * from './localization/localize.pipe';
7
- export * from './localization/localization.interface';
8
- export * from './log/echo';
9
- export * from './log/log-systems';
10
- export * from './log/echo-provider';
11
- export * from './navigation/navigation-stack.service';
12
- export * from './navigation/back-on-click.directive';
13
- export * from './storage/files';
14
- export * from './storage/file-box.service';
15
- export * from './storage/key-signals';
16
- export * from './storage/settings-signals.service';
17
- export * from './storage/settings.service';
18
- export * from './storage/tauri-files.service';
19
- export * from './storage/capacitor-files.service';
20
- export * from './storage/local-storage-files.service';
21
- export * from './theme/theme.service';
22
- export * from './ui/context-menu/context-menu.component';
23
- export * from './ui/context-menu/context-header.component';
24
- export * from './ui/context-menu/context-button.component';
25
- export * from './ui/context-menu/context-menu-trigger.directive';