@angular-helpers/browser-web-apis 21.0.2 → 21.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.
@@ -1,7 +1,7 @@
1
- import * as i0 from '@angular/core';
2
- import { DestroyRef } from '@angular/core';
3
1
  import { Observable } from 'rxjs';
4
- import { CanActivate, Router, ActivatedRouteSnapshot } from '@angular/router';
2
+ import * as i0 from '@angular/core';
3
+ import { DestroyRef, Signal, ElementRef, EnvironmentProviders } from '@angular/core';
4
+ import { CanActivateFn } from '@angular/router';
5
5
 
6
6
  type PermissionNameExt = PermissionName | 'clipboard-read' | 'clipboard-write';
7
7
  interface PermissionRequest {
@@ -50,13 +50,16 @@ declare abstract class BrowserApiBaseService {
50
50
  * Request a permission
51
51
  */
52
52
  protected requestPermission(permission: PermissionNameExt): Promise<boolean>;
53
+ /**
54
+ * Create an error with proper cause chaining
55
+ */
56
+ protected createError(message: string, cause?: unknown): Error;
53
57
  static ɵfac: i0.ɵɵFactoryDeclaration<BrowserApiBaseService, never>;
54
58
  static ɵprov: i0.ɵɵInjectableDeclaration<BrowserApiBaseService>;
55
59
  }
56
60
 
57
61
  declare class CameraService extends BrowserApiBaseService {
58
62
  private currentStream;
59
- private createError;
60
63
  protected getApiName(): string;
61
64
  private ensureCameraSupport;
62
65
  startCamera(constraints?: MediaStreamConstraints): Promise<MediaStream>;
@@ -87,7 +90,6 @@ interface DisplayMediaConstraints {
87
90
  audio?: boolean | MediaTrackConstraints;
88
91
  }
89
92
  declare class MediaDevicesService extends BrowserApiBaseService {
90
- private createError;
91
93
  protected getApiName(): string;
92
94
  private ensureMediaDevicesSupport;
93
95
  getDevices(): Promise<MediaDeviceInfo[]>;
@@ -106,6 +108,9 @@ declare class MediaDevicesService extends BrowserApiBaseService {
106
108
 
107
109
  declare class NotificationService extends BrowserApiBaseService {
108
110
  protected getApiName(): string;
111
+ get permission(): NotificationPermission;
112
+ isSupported(): boolean;
113
+ requestNotificationPermission(): Promise<NotificationPermission>;
109
114
  showNotification(title: string, options?: NotificationOptions): Promise<Notification>;
110
115
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
111
116
  static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
@@ -121,7 +126,7 @@ declare class ClipboardService extends BrowserApiBaseService {
121
126
  static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
122
127
  }
123
128
 
124
- type BrowserCapabilityId = 'permissions' | 'geolocation' | 'clipboard' | 'notification' | 'mediaDevices' | 'camera' | 'webWorker' | 'regexSecurity' | 'webStorage' | 'webShare' | 'battery' | 'webSocket';
129
+ type BrowserCapabilityId = 'permissions' | 'geolocation' | 'clipboard' | 'notification' | 'mediaDevices' | 'camera' | 'webWorker' | 'regexSecurity' | 'webStorage' | 'webShare' | 'battery' | 'webSocket' | 'intersectionObserver' | 'resizeObserver' | 'pageVisibility' | 'broadcastChannel' | 'networkInformation' | 'screenWakeLock' | 'screenOrientation' | 'fullscreen' | 'fileSystemAccess' | 'mediaRecorder' | 'serverSentEvents' | 'vibration' | 'speechSynthesis';
125
130
  declare class BrowserCapabilityService {
126
131
  getCapabilities(): readonly [{
127
132
  readonly id: "permissions";
@@ -171,12 +176,64 @@ declare class BrowserCapabilityService {
171
176
  readonly id: "webSocket";
172
177
  readonly label: "WebSocket API";
173
178
  readonly requiresSecureContext: false;
179
+ }, {
180
+ readonly id: "intersectionObserver";
181
+ readonly label: "Intersection Observer";
182
+ readonly requiresSecureContext: false;
183
+ }, {
184
+ readonly id: "resizeObserver";
185
+ readonly label: "Resize Observer";
186
+ readonly requiresSecureContext: false;
187
+ }, {
188
+ readonly id: "pageVisibility";
189
+ readonly label: "Page Visibility API";
190
+ readonly requiresSecureContext: false;
191
+ }, {
192
+ readonly id: "broadcastChannel";
193
+ readonly label: "Broadcast Channel API";
194
+ readonly requiresSecureContext: false;
195
+ }, {
196
+ readonly id: "networkInformation";
197
+ readonly label: "Network Information API";
198
+ readonly requiresSecureContext: false;
199
+ }, {
200
+ readonly id: "screenWakeLock";
201
+ readonly label: "Screen Wake Lock API";
202
+ readonly requiresSecureContext: true;
203
+ }, {
204
+ readonly id: "screenOrientation";
205
+ readonly label: "Screen Orientation API";
206
+ readonly requiresSecureContext: false;
207
+ }, {
208
+ readonly id: "fullscreen";
209
+ readonly label: "Fullscreen API";
210
+ readonly requiresSecureContext: false;
211
+ }, {
212
+ readonly id: "fileSystemAccess";
213
+ readonly label: "File System Access API";
214
+ readonly requiresSecureContext: true;
215
+ }, {
216
+ readonly id: "mediaRecorder";
217
+ readonly label: "MediaRecorder API";
218
+ readonly requiresSecureContext: true;
219
+ }, {
220
+ readonly id: "serverSentEvents";
221
+ readonly label: "Server-Sent Events";
222
+ readonly requiresSecureContext: false;
223
+ }, {
224
+ readonly id: "vibration";
225
+ readonly label: "Vibration API";
226
+ readonly requiresSecureContext: false;
227
+ }, {
228
+ readonly id: "speechSynthesis";
229
+ readonly label: "Speech Synthesis API";
230
+ readonly requiresSecureContext: false;
174
231
  }];
175
232
  isSecureContext(): boolean;
176
233
  isSupported(capability: BrowserCapabilityId): boolean;
177
234
  getAllStatuses(): {
178
- id: "camera" | "geolocation" | "permissions" | "mediaDevices" | "clipboard" | "notification" | "webWorker" | "regexSecurity" | "webStorage" | "webShare" | "battery" | "webSocket";
179
- label: "Permissions API" | "Geolocation API" | "Clipboard API" | "Notification API" | "MediaDevices API" | "Camera API" | "Web Worker API" | "Regex Security" | "Web Storage" | "Web Share" | "Battery API" | "WebSocket API";
235
+ id: "camera" | "geolocation" | "permissions" | "mediaDevices" | "clipboard" | "notification" | "webWorker" | "regexSecurity" | "webStorage" | "webShare" | "battery" | "webSocket" | "intersectionObserver" | "resizeObserver" | "pageVisibility" | "broadcastChannel" | "networkInformation" | "screenWakeLock" | "screenOrientation" | "fullscreen" | "fileSystemAccess" | "mediaRecorder" | "serverSentEvents" | "vibration" | "speechSynthesis";
236
+ label: "Permissions API" | "Geolocation API" | "Clipboard API" | "Notification API" | "MediaDevices API" | "Camera API" | "Web Worker API" | "Regex Security" | "Web Storage" | "Web Share" | "Battery API" | "WebSocket API" | "Intersection Observer" | "Resize Observer" | "Page Visibility API" | "Broadcast Channel API" | "Network Information API" | "Screen Wake Lock API" | "Screen Orientation API" | "Fullscreen API" | "File System Access API" | "MediaRecorder API" | "Server-Sent Events" | "Vibration API" | "Speech Synthesis API";
180
237
  supported: boolean;
181
238
  secureContext: boolean;
182
239
  requiresSecureContext: boolean;
@@ -186,6 +243,474 @@ declare class BrowserCapabilityService {
186
243
  static ɵprov: i0.ɵɵInjectableDeclaration<BrowserCapabilityService>;
187
244
  }
188
245
 
246
+ interface BatteryInfo {
247
+ charging: boolean;
248
+ chargingTime: number;
249
+ dischargingTime: number;
250
+ level: number;
251
+ }
252
+ interface BatteryManager extends EventTarget {
253
+ readonly charging: boolean;
254
+ readonly chargingTime: number;
255
+ readonly dischargingTime: number;
256
+ readonly level: number;
257
+ addEventListener(type: 'chargingchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
258
+ addEventListener(type: 'levelchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
259
+ addEventListener(type: 'chargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
260
+ addEventListener(type: 'dischargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
261
+ removeEventListener(type: 'chargingchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
262
+ removeEventListener(type: 'levelchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
263
+ removeEventListener(type: 'chargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
264
+ removeEventListener(type: 'dischargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
265
+ }
266
+ declare global {
267
+ interface Navigator {
268
+ getBattery?: () => Promise<BatteryManager>;
269
+ }
270
+ }
271
+
272
+ declare class BatteryService extends BrowserApiBaseService {
273
+ private batteryManager;
274
+ protected getApiName(): string;
275
+ private ensureBatterySupport;
276
+ initialize(): Promise<BatteryInfo>;
277
+ getBatteryInfo(): BatteryInfo;
278
+ watchBatteryInfo(): Observable<BatteryInfo>;
279
+ private setupEventListeners;
280
+ getNativeBatteryManager(): BatteryManager;
281
+ isCharging(): boolean;
282
+ getLevel(): number;
283
+ getChargingTime(): number;
284
+ getDischargingTime(): number;
285
+ static ɵfac: i0.ɵɵFactoryDeclaration<BatteryService, never>;
286
+ static ɵprov: i0.ɵɵInjectableDeclaration<BatteryService>;
287
+ }
288
+
289
+ interface ShareResult {
290
+ shared: boolean;
291
+ error?: string;
292
+ }
293
+ declare class WebShareService extends BrowserApiBaseService {
294
+ protected getApiName(): string;
295
+ private ensureWebShareSupport;
296
+ share(data: ShareData): Promise<ShareResult>;
297
+ canShare(): boolean;
298
+ canShareFiles(): boolean;
299
+ getNativeShare(): typeof navigator.share;
300
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebShareService, never>;
301
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebShareService>;
302
+ }
303
+
304
+ type BrowserError = Error & {
305
+ name?: string;
306
+ message?: string;
307
+ };
308
+ type EventHandler<T = Event> = (event: T) => void;
309
+ type StorageValue = string | number | boolean | object | null;
310
+ type ErrorCallback = (error: BrowserError) => void;
311
+
312
+ interface StorageOptions {
313
+ prefix?: string;
314
+ serialize?: (value: StorageValue) => string;
315
+ deserialize?: (value: string) => StorageValue;
316
+ }
317
+ interface StorageEvent {
318
+ key: string;
319
+ newValue: StorageValue | null;
320
+ oldValue: StorageValue | null;
321
+ storageArea: 'localStorage' | 'sessionStorage';
322
+ }
323
+ declare class WebStorageService extends BrowserApiBaseService {
324
+ private storageEvents;
325
+ protected destroyRef: DestroyRef;
326
+ constructor();
327
+ protected getApiName(): string;
328
+ private ensureStorageSupport;
329
+ private setupEventListeners;
330
+ private serializeValue;
331
+ private deserializeValue;
332
+ private getKey;
333
+ setLocalStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
334
+ getLocalStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
335
+ removeLocalStorage(key: string, options?: StorageOptions): boolean;
336
+ clearLocalStorage(options?: StorageOptions): boolean;
337
+ setSessionStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
338
+ getSessionStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
339
+ removeSessionStorage(key: string, options?: StorageOptions): boolean;
340
+ clearSessionStorage(options?: StorageOptions): boolean;
341
+ getLocalStorageSize(options?: StorageOptions): number;
342
+ getSessionStorageSize(options?: StorageOptions): number;
343
+ getStorageEvents(): Observable<StorageEvent>;
344
+ watchLocalStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
345
+ watchSessionStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
346
+ getNativeLocalStorage(): Storage;
347
+ getNativeSessionStorage(): Storage;
348
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebStorageService, never>;
349
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebStorageService>;
350
+ }
351
+
352
+ interface WebSocketConfig {
353
+ url: string;
354
+ protocols?: string | string[];
355
+ reconnectInterval?: number;
356
+ maxReconnectAttempts?: number;
357
+ heartbeatInterval?: number;
358
+ heartbeatMessage?: unknown;
359
+ }
360
+ interface WebSocketMessage<T = unknown> {
361
+ type: string;
362
+ data: T;
363
+ timestamp?: number;
364
+ }
365
+ interface WebSocketStatus {
366
+ connected: boolean;
367
+ connecting: boolean;
368
+ reconnecting: boolean;
369
+ error?: string;
370
+ reconnectAttempts: number;
371
+ }
372
+ declare class WebSocketService extends BrowserApiBaseService {
373
+ private webSocket;
374
+ private statusSubject;
375
+ private messageSubject;
376
+ private reconnectAttempts;
377
+ private reconnectTimer;
378
+ private heartbeatTimer;
379
+ protected getApiName(): string;
380
+ private ensureWebSocketSupport;
381
+ connect(config: WebSocketConfig): Observable<WebSocketStatus>;
382
+ disconnect(): void;
383
+ send<T>(message: WebSocketMessage<T>): void;
384
+ sendRaw(data: string): void;
385
+ getStatus(): Observable<WebSocketStatus>;
386
+ getMessages<T = unknown>(): Observable<WebSocketMessage<T>>;
387
+ private setupWebSocketHandlers;
388
+ private startHeartbeat;
389
+ private attemptReconnect;
390
+ private updateStatus;
391
+ private getCurrentStatus;
392
+ getNativeWebSocket(): WebSocket | null;
393
+ isConnected(): boolean;
394
+ getReadyState(): number;
395
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketService, never>;
396
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketService>;
397
+ }
398
+
399
+ interface WorkerMessage<T = unknown> {
400
+ id: string;
401
+ type: string;
402
+ data: T;
403
+ timestamp: number;
404
+ }
405
+ interface WorkerStatus {
406
+ initialized: boolean;
407
+ running: boolean;
408
+ error?: string;
409
+ messageCount: number;
410
+ }
411
+ interface WorkerTask<T = unknown> {
412
+ id: string;
413
+ type: string;
414
+ data: T;
415
+ transferable?: Transferable[];
416
+ }
417
+ declare class WebWorkerService extends BrowserApiBaseService {
418
+ protected destroyRef: DestroyRef;
419
+ private workers;
420
+ private workerStatuses;
421
+ private workerMessages;
422
+ private currentWorkerStatuses;
423
+ protected getApiName(): string;
424
+ private ensureWorkerSupport;
425
+ createWorker(name: string, scriptUrl: string): Observable<WorkerStatus>;
426
+ terminateWorker(name: string): void;
427
+ terminateAllWorkers(): void;
428
+ postMessage(workerName: string, task: WorkerTask): void;
429
+ getMessages(workerName: string): Observable<WorkerMessage>;
430
+ getStatus(workerName: string): Observable<WorkerStatus>;
431
+ getCurrentStatus(workerName: string): WorkerStatus | undefined;
432
+ getAllStatuses(): Map<string, WorkerStatus>;
433
+ isWorkerRunning(workerName: string): boolean;
434
+ private setupWorker;
435
+ private updateWorkerStatus;
436
+ getNativeWorker(name: string): Worker | undefined;
437
+ getAllWorkers(): Map<string, Worker>;
438
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebWorkerService, never>;
439
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebWorkerService>;
440
+ }
441
+
442
+ interface IntersectionObserverOptions {
443
+ root?: Element | Document | null;
444
+ rootMargin?: string;
445
+ threshold?: number | number[];
446
+ }
447
+ declare class IntersectionObserverService {
448
+ private readonly platformId;
449
+ isSupported(): boolean;
450
+ observe(element: Element, options?: IntersectionObserverOptions): Observable<IntersectionObserverEntry[]>;
451
+ observeVisibility(element: Element, options?: IntersectionObserverOptions): Observable<boolean>;
452
+ static ɵfac: i0.ɵɵFactoryDeclaration<IntersectionObserverService, never>;
453
+ static ɵprov: i0.ɵɵInjectableDeclaration<IntersectionObserverService>;
454
+ }
455
+
456
+ interface ResizeObserverOptions {
457
+ box?: ResizeObserverBoxOptions;
458
+ }
459
+ interface ElementSize {
460
+ width: number;
461
+ height: number;
462
+ inlineSize: number;
463
+ blockSize: number;
464
+ }
465
+ declare class ResizeObserverService {
466
+ private readonly platformId;
467
+ isSupported(): boolean;
468
+ observe(element: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]>;
469
+ observeSize(element: Element, options?: ResizeObserverOptions): Observable<ElementSize>;
470
+ static ɵfac: i0.ɵɵFactoryDeclaration<ResizeObserverService, never>;
471
+ static ɵprov: i0.ɵɵInjectableDeclaration<ResizeObserverService>;
472
+ }
473
+
474
+ type VisibilityState = 'visible' | 'hidden' | 'prerender';
475
+ declare class PageVisibilityService {
476
+ private readonly platformId;
477
+ isSupported(): boolean;
478
+ get isHidden(): boolean;
479
+ get visibilityState(): VisibilityState;
480
+ watch(): Observable<VisibilityState>;
481
+ watchVisibility(): Observable<boolean>;
482
+ static ɵfac: i0.ɵɵFactoryDeclaration<PageVisibilityService, never>;
483
+ static ɵprov: i0.ɵɵInjectableDeclaration<PageVisibilityService>;
484
+ }
485
+
486
+ declare class BroadcastChannelService {
487
+ private readonly destroyRef;
488
+ private readonly platformId;
489
+ private channels;
490
+ isSupported(): boolean;
491
+ private ensureSupport;
492
+ open<T = unknown>(name: string): Observable<T>;
493
+ post<T = unknown>(name: string, data: T): void;
494
+ close(name: string): void;
495
+ closeAll(): void;
496
+ getOpenChannels(): string[];
497
+ static ɵfac: i0.ɵɵFactoryDeclaration<BroadcastChannelService, never>;
498
+ static ɵprov: i0.ɵɵInjectableDeclaration<BroadcastChannelService>;
499
+ }
500
+
501
+ type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
502
+ type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g';
503
+ interface NetworkInformation {
504
+ type?: ConnectionType;
505
+ effectiveType?: EffectiveConnectionType;
506
+ downlink?: number;
507
+ downlinkMax?: number;
508
+ rtt?: number;
509
+ saveData?: boolean;
510
+ online: boolean;
511
+ }
512
+ declare class NetworkInformationService {
513
+ private readonly platformId;
514
+ isSupported(): boolean;
515
+ getSnapshot(): NetworkInformation;
516
+ watch(): Observable<NetworkInformation>;
517
+ get isOnline(): boolean;
518
+ static ɵfac: i0.ɵɵFactoryDeclaration<NetworkInformationService, never>;
519
+ static ɵprov: i0.ɵɵInjectableDeclaration<NetworkInformationService>;
520
+ }
521
+
522
+ type WakeLockType = 'screen';
523
+ interface WakeLockStatus {
524
+ active: boolean;
525
+ type?: WakeLockType;
526
+ released?: boolean;
527
+ }
528
+ declare class ScreenWakeLockService extends BrowserApiBaseService {
529
+ private sentinel;
530
+ protected getApiName(): string;
531
+ isSupported(): boolean;
532
+ get isActive(): boolean;
533
+ request(type?: WakeLockType): Promise<WakeLockStatus>;
534
+ release(): Promise<void>;
535
+ watchStatus(): Observable<WakeLockStatus>;
536
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScreenWakeLockService, never>;
537
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScreenWakeLockService>;
538
+ }
539
+
540
+ type OrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
541
+ type OrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
542
+ interface OrientationInfo {
543
+ type: OrientationType;
544
+ angle: number;
545
+ }
546
+ declare class ScreenOrientationService {
547
+ private readonly platformId;
548
+ isSupported(): boolean;
549
+ getSnapshot(): OrientationInfo;
550
+ get isPortrait(): boolean;
551
+ get isLandscape(): boolean;
552
+ watch(): Observable<OrientationInfo>;
553
+ lock(orientation: OrientationLockType): Promise<void>;
554
+ unlock(): void;
555
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScreenOrientationService, never>;
556
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScreenOrientationService>;
557
+ }
558
+
559
+ declare class FullscreenService {
560
+ private readonly destroyRef;
561
+ private readonly platformId;
562
+ isSupported(): boolean;
563
+ get isFullscreen(): boolean;
564
+ get fullscreenElement(): Element | null;
565
+ request(element?: Element): Promise<void>;
566
+ exit(): Promise<void>;
567
+ toggle(element?: Element): Promise<void>;
568
+ watch(): Observable<boolean>;
569
+ static ɵfac: i0.ɵɵFactoryDeclaration<FullscreenService, never>;
570
+ static ɵprov: i0.ɵɵInjectableDeclaration<FullscreenService>;
571
+ }
572
+
573
+ interface FileOpenOptions {
574
+ multiple?: boolean;
575
+ excludeAcceptAllOption?: boolean;
576
+ types?: Array<{
577
+ description?: string;
578
+ accept: Record<string, string[]>;
579
+ }>;
580
+ }
581
+ interface FileSaveOptions {
582
+ suggestedName?: string;
583
+ excludeAcceptAllOption?: boolean;
584
+ types?: Array<{
585
+ description?: string;
586
+ accept: Record<string, string[]>;
587
+ }>;
588
+ }
589
+ declare class FileSystemAccessService extends BrowserApiBaseService {
590
+ protected getApiName(): string;
591
+ isSupported(): boolean;
592
+ private get win();
593
+ private ensureSupport;
594
+ openFile(options?: FileOpenOptions): Promise<File[]>;
595
+ saveFile(content: string | Blob, options?: FileSaveOptions): Promise<void>;
596
+ openDirectory(options?: {
597
+ id?: string;
598
+ mode?: 'read' | 'readwrite';
599
+ startIn?: string;
600
+ }): Promise<FileSystemDirectoryHandle | null>;
601
+ readFileAsText(file: File): Promise<string>;
602
+ readFileAsArrayBuffer(file: File): Promise<ArrayBuffer>;
603
+ static ɵfac: i0.ɵɵFactoryDeclaration<FileSystemAccessService, never>;
604
+ static ɵprov: i0.ɵɵInjectableDeclaration<FileSystemAccessService>;
605
+ }
606
+
607
+ type RecordingState = 'inactive' | 'recording' | 'paused';
608
+ interface RecordingOptions {
609
+ mimeType?: string;
610
+ audioBitsPerSecond?: number;
611
+ videoBitsPerSecond?: number;
612
+ bitsPerSecond?: number;
613
+ timeslice?: number;
614
+ }
615
+ interface RecordingResult {
616
+ blob: Blob;
617
+ url: string;
618
+ mimeType: string;
619
+ duration: number;
620
+ }
621
+ declare class MediaRecorderService extends BrowserApiBaseService {
622
+ private recorder;
623
+ private chunks;
624
+ private startTime;
625
+ private readonly dataSubject;
626
+ private readonly stateSubject;
627
+ protected getApiName(): string;
628
+ isSupported(): boolean;
629
+ get state(): RecordingState;
630
+ static isTypeSupported(mimeType: string): boolean;
631
+ watchState(): Observable<RecordingState>;
632
+ watchData(): Observable<Blob>;
633
+ start(stream: MediaStream, options?: RecordingOptions): Promise<void>;
634
+ pause(): void;
635
+ resume(): void;
636
+ stop(): RecordingResult | null;
637
+ getResult(): RecordingResult | null;
638
+ static ɵfac: i0.ɵɵFactoryDeclaration<MediaRecorderService, never>;
639
+ static ɵprov: i0.ɵɵInjectableDeclaration<MediaRecorderService>;
640
+ }
641
+
642
+ type SSEConnectionState = 'connecting' | 'open' | 'closed';
643
+ interface SSEMessage<T = unknown> {
644
+ data: T;
645
+ type: string;
646
+ lastEventId: string;
647
+ origin: string;
648
+ }
649
+ interface SSEConfig {
650
+ withCredentials?: boolean;
651
+ eventTypes?: string[];
652
+ }
653
+ declare class ServerSentEventsService {
654
+ private readonly destroyRef;
655
+ private readonly platformId;
656
+ private sources;
657
+ isSupported(): boolean;
658
+ private ensureSupport;
659
+ connect<T = unknown>(url: string, config?: SSEConfig): Observable<SSEMessage<T>>;
660
+ disconnect(url: string): void;
661
+ disconnectAll(): void;
662
+ getState(url: string): SSEConnectionState;
663
+ getActiveConnections(): string[];
664
+ static ɵfac: i0.ɵɵFactoryDeclaration<ServerSentEventsService, never>;
665
+ static ɵprov: i0.ɵɵInjectableDeclaration<ServerSentEventsService>;
666
+ }
667
+
668
+ type VibrationPattern = number | number[];
669
+ interface VibrationPreset {
670
+ success: VibrationPattern;
671
+ error: VibrationPattern;
672
+ notification: VibrationPattern;
673
+ doubleTap: VibrationPattern;
674
+ }
675
+ declare class VibrationService {
676
+ private readonly platformId;
677
+ readonly presets: VibrationPreset;
678
+ isSupported(): boolean;
679
+ vibrate(pattern?: VibrationPattern): boolean;
680
+ success(): boolean;
681
+ error(): boolean;
682
+ notification(): boolean;
683
+ doubleTap(): boolean;
684
+ stop(): boolean;
685
+ static ɵfac: i0.ɵɵFactoryDeclaration<VibrationService, never>;
686
+ static ɵprov: i0.ɵɵInjectableDeclaration<VibrationService>;
687
+ }
688
+
689
+ type SpeechState = 'idle' | 'speaking' | 'paused';
690
+ interface SpeechOptions {
691
+ lang?: string;
692
+ voice?: SpeechSynthesisVoice;
693
+ volume?: number;
694
+ rate?: number;
695
+ pitch?: number;
696
+ }
697
+ declare class SpeechSynthesisService {
698
+ private readonly destroyRef;
699
+ private readonly platformId;
700
+ isSupported(): boolean;
701
+ private ensureSupport;
702
+ get state(): SpeechState;
703
+ get isPending(): boolean;
704
+ getVoices(): SpeechSynthesisVoice[];
705
+ watchVoices(): Observable<SpeechSynthesisVoice[]>;
706
+ speak(text: string, options?: SpeechOptions): Observable<SpeechState>;
707
+ pause(): void;
708
+ resume(): void;
709
+ cancel(): void;
710
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpeechSynthesisService, never>;
711
+ static ɵprov: i0.ɵɵInjectableDeclaration<SpeechSynthesisService>;
712
+ }
713
+
189
714
  interface MediaDevice {
190
715
  deviceId: string;
191
716
  groupId: string;
@@ -275,6 +800,50 @@ interface GeolocationWatchOptions extends GeolocationOptions {
275
800
  maximumAge?: number;
276
801
  }
277
802
 
803
+ interface PageVisibilityRef {
804
+ readonly state: Signal<VisibilityState>;
805
+ readonly isVisible: Signal<boolean>;
806
+ readonly isHidden: Signal<boolean>;
807
+ }
808
+ declare function injectPageVisibility(): PageVisibilityRef;
809
+
810
+ interface ResizeRef {
811
+ readonly size: Signal<ElementSize | null>;
812
+ readonly width: Signal<number>;
813
+ readonly height: Signal<number>;
814
+ readonly inlineSize: Signal<number>;
815
+ readonly blockSize: Signal<number>;
816
+ }
817
+ declare function injectResizeObserver(elementOrRef: Element | ElementRef<Element>, options?: ResizeObserverOptions): ResizeRef;
818
+
819
+ interface IntersectionRef {
820
+ readonly isIntersecting: Signal<boolean>;
821
+ readonly isVisible: Signal<boolean>;
822
+ }
823
+ declare function injectIntersectionObserver(elementOrRef: Element | ElementRef<Element>, options?: IntersectionObserverOptions): IntersectionRef;
824
+
825
+ interface NetworkInformationRef {
826
+ readonly snapshot: Signal<NetworkInformation>;
827
+ readonly online: Signal<boolean>;
828
+ readonly effectiveType: Signal<EffectiveConnectionType | undefined>;
829
+ readonly downlink: Signal<number | undefined>;
830
+ readonly rtt: Signal<number | undefined>;
831
+ readonly type: Signal<ConnectionType | undefined>;
832
+ readonly saveData: Signal<boolean | undefined>;
833
+ }
834
+ declare function injectNetworkInformation(): NetworkInformationRef;
835
+
836
+ interface ScreenOrientationRef {
837
+ readonly orientation: Signal<OrientationInfo>;
838
+ readonly type: Signal<OrientationType>;
839
+ readonly angle: Signal<number>;
840
+ readonly isPortrait: Signal<boolean>;
841
+ readonly isLandscape: Signal<boolean>;
842
+ lock(orientation: OrientationLockType): Promise<void>;
843
+ unlock(): void;
844
+ }
845
+ declare function injectScreenOrientation(): ScreenOrientationRef;
846
+
278
847
  declare class BrowserSupportUtil {
279
848
  static isSupported(feature: string): boolean;
280
849
  static getUnsupportedFeatures(): string[];
@@ -294,21 +863,69 @@ declare class BrowserSupportUtil {
294
863
  private static getBrowserVersion;
295
864
  }
296
865
 
297
- declare class PermissionGuard implements CanActivate {
298
- private permissionsService;
299
- private router;
300
- constructor(permissionsService: PermissionsService, router: Router);
301
- canActivate(route: ActivatedRouteSnapshot): Promise<boolean>;
302
- private checkPermission;
866
+ /**
867
+ * Functional guard that checks if the user has the required permission.
868
+ * Usage in routes: { canActivate: [permissionGuard('camera')] }
869
+ */
870
+ declare const permissionGuard: (permission: PermissionNameExt) => CanActivateFn;
871
+
872
+ interface BrowserWebApisConfig {
873
+ enableCamera?: boolean;
874
+ enableGeolocation?: boolean;
875
+ enableNotifications?: boolean;
876
+ enableClipboard?: boolean;
877
+ enableMediaDevices?: boolean;
878
+ enableBattery?: boolean;
879
+ enableWebShare?: boolean;
880
+ enableWebStorage?: boolean;
881
+ enableWebSocket?: boolean;
882
+ enableWebWorker?: boolean;
883
+ enableIntersectionObserver?: boolean;
884
+ enableResizeObserver?: boolean;
885
+ enablePageVisibility?: boolean;
886
+ enableBroadcastChannel?: boolean;
887
+ enableNetworkInformation?: boolean;
888
+ enableScreenWakeLock?: boolean;
889
+ enableScreenOrientation?: boolean;
890
+ enableFullscreen?: boolean;
891
+ enableFileSystemAccess?: boolean;
892
+ enableMediaRecorder?: boolean;
893
+ enableServerSentEvents?: boolean;
894
+ enableVibration?: boolean;
895
+ enableSpeechSynthesis?: boolean;
303
896
  }
304
- declare function createPermissionGuard(permission: PermissionNameExt): {
305
- canActivate: (typeof PermissionGuard)[];
306
- data: {
307
- permission: PermissionNameExt;
308
- };
309
- };
897
+ declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
898
+ declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
899
+ declare function provideCamera(): EnvironmentProviders;
900
+ declare function provideGeolocation(): EnvironmentProviders;
901
+ declare function provideNotifications(): EnvironmentProviders;
902
+ declare function provideClipboard(): EnvironmentProviders;
903
+ declare function provideMediaDevices(): EnvironmentProviders;
904
+ declare function provideBattery(): EnvironmentProviders;
905
+ declare function provideWebShare(): EnvironmentProviders;
906
+ declare function provideWebStorage(): EnvironmentProviders;
907
+ declare function provideWebSocket(): EnvironmentProviders;
908
+ declare function provideWebWorker(): EnvironmentProviders;
909
+ declare function providePermissions(): EnvironmentProviders;
910
+ declare function provideMediaApis(): EnvironmentProviders;
911
+ declare function provideLocationApis(): EnvironmentProviders;
912
+ declare function provideStorageApis(): EnvironmentProviders;
913
+ declare function provideCommunicationApis(): EnvironmentProviders;
914
+ declare function provideIntersectionObserver(): EnvironmentProviders;
915
+ declare function provideResizeObserver(): EnvironmentProviders;
916
+ declare function providePageVisibility(): EnvironmentProviders;
917
+ declare function provideBroadcastChannel(): EnvironmentProviders;
918
+ declare function provideNetworkInformation(): EnvironmentProviders;
919
+ declare function provideScreenWakeLock(): EnvironmentProviders;
920
+ declare function provideScreenOrientation(): EnvironmentProviders;
921
+ declare function provideFullscreen(): EnvironmentProviders;
922
+ declare function provideFileSystemAccess(): EnvironmentProviders;
923
+ declare function provideMediaRecorder(): EnvironmentProviders;
924
+ declare function provideServerSentEvents(): EnvironmentProviders;
925
+ declare function provideVibration(): EnvironmentProviders;
926
+ declare function provideSpeechSynthesis(): EnvironmentProviders;
310
927
 
311
928
  declare const version = "0.1.0";
312
929
 
313
- export { BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, GeolocationService, MediaDevicesService, NotificationService, PermissionGuard, PermissionsService, createPermissionGuard, version };
314
- export type { BrowserCapabilityId, BrowserPermissions, CameraCapabilities, CameraInfo, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, PermissionNameExt, PermissionRequest };
930
+ export { BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, FileSystemAccessService, FullscreenService, GeolocationService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, NetworkInformationService, NotificationService, PageVisibilityService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebShareService, WebSocketService, WebStorageService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectIntersectionObserver, injectNetworkInformation, injectPageVisibility, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideFileSystemAccess, provideFullscreen, provideGeolocation, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideNetworkInformation, provideNotifications, providePageVisibility, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebShare, provideWebSocket, provideWebStorage, provideWebWorker, version };
931
+ export type { BatteryInfo, BatteryManager, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ConnectionType, EffectiveConnectionType, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PermissionNameExt, PermissionRequest, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageOptions, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketConfig, WebSocketMessage, WebSocketStatus, WorkerMessage, WorkerStatus, WorkerTask };