@angular-helpers/browser-web-apis 21.3.0 → 21.5.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,67 +1,84 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import * as i0 from '@angular/core';
3
- import { DestroyRef, ElementRef, Signal, EnvironmentProviders } from '@angular/core';
3
+ import { DestroyRef, ElementRef, Signal, InjectionToken, EnvironmentProviders } from '@angular/core';
4
4
  import { CanActivateFn } from '@angular/router';
5
5
 
6
- type PermissionNameExt = PermissionName | 'clipboard-read' | 'clipboard-write';
7
- interface PermissionRequest {
8
- name: PermissionNameExt;
9
- state: PermissionState;
10
- }
11
- interface BrowserPermissions {
12
- query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
13
- isSupported(): boolean;
14
- }
15
-
16
- declare class PermissionsService implements BrowserPermissions {
17
- query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
18
- isSupported(): boolean;
19
- static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsService, never>;
20
- static ɵprov: i0.ɵɵInjectableDeclaration<PermissionsService>;
21
- }
22
-
23
6
  /**
24
- * Base class for all Browser Web API services
7
+ * Base class for all Browser Web API services.
25
8
  * Provides common functionality for:
26
- * - Support checking
27
- * - Permission management
28
- * - Error handling
9
+ * - Platform detection (browser vs server)
10
+ * - Support assertion via Template Method
11
+ * - Error creation with cause chaining
12
+ * - Structured logging via injectable BROWSER_API_LOGGER token
29
13
  * - Lifecycle management with destroyRef
30
- * - Logging
14
+ *
15
+ * Services that also need permission querying should extend
16
+ * `PermissionAwareBrowserApiBaseService` instead.
31
17
  */
32
18
  declare abstract class BrowserApiBaseService {
33
- protected permissionsService: PermissionsService;
34
19
  protected destroyRef: DestroyRef;
35
20
  protected platformId: Object;
21
+ private readonly logger;
36
22
  /**
37
- * Abstract method that must be implemented by child services
38
- * Returns the API name for support checking
23
+ * Abstract method that must be implemented by child services.
24
+ * Returns the API name used in log messages and error strings.
39
25
  */
40
26
  protected abstract getApiName(): string;
41
27
  /**
42
- * Check if running in browser environment using Angular's platform detection
28
+ * Check if running in browser environment using Angular's platform detection.
43
29
  */
44
30
  protected isBrowserEnvironment(): boolean;
45
31
  /**
46
- * Check if running in server environment using Angular's platform detection
32
+ * Check if running in server environment using Angular's platform detection.
47
33
  */
48
34
  protected isServerEnvironment(): boolean;
49
35
  /**
50
- * Request a permission
36
+ * Template Method: asserts the service can run in the current environment.
37
+ * Subclasses must call super.ensureSupported() and then add their own API check.
51
38
  */
52
- protected requestPermission(permission: PermissionNameExt): Promise<boolean>;
39
+ protected ensureSupported(): void;
53
40
  /**
54
- * Create an error with proper cause chaining
41
+ * Create an error with proper cause chaining.
55
42
  */
56
43
  protected createError(message: string, cause?: unknown): Error;
44
+ /**
45
+ * Log an error through the injected BROWSER_API_LOGGER (default: console).
46
+ */
47
+ protected logError(message: string, error?: unknown): void;
48
+ /**
49
+ * Log a warning through the injected BROWSER_API_LOGGER (default: console).
50
+ */
51
+ protected logWarn(message: string): void;
52
+ /**
53
+ * Log an informational message through the injected BROWSER_API_LOGGER (default: console).
54
+ */
55
+ protected logInfo(message: string): void;
57
56
  static ɵfac: i0.ɵɵFactoryDeclaration<BrowserApiBaseService, never>;
58
57
  static ɵprov: i0.ɵɵInjectableDeclaration<BrowserApiBaseService>;
59
58
  }
60
59
 
60
+ type PermissionNameExt = PermissionName | 'clipboard-read' | 'clipboard-write';
61
+ interface PermissionRequest {
62
+ name: PermissionNameExt;
63
+ state: PermissionState;
64
+ }
65
+ interface BrowserPermissions {
66
+ query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
67
+ isSupported(): boolean;
68
+ }
69
+
70
+ declare class PermissionsService extends BrowserApiBaseService implements BrowserPermissions {
71
+ protected getApiName(): string;
72
+ query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
73
+ isSupported(): boolean;
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsService, never>;
75
+ static ɵprov: i0.ɵɵInjectableDeclaration<PermissionsService>;
76
+ }
77
+
61
78
  declare class CameraService extends BrowserApiBaseService {
62
79
  private currentStream;
63
80
  protected getApiName(): string;
64
- private ensureCameraSupport;
81
+ protected ensureSupported(): void;
65
82
  startCamera(constraints?: MediaStreamConstraints): Promise<MediaStream>;
66
83
  stopCamera(): void;
67
84
  switchCamera(deviceId: string, constraints?: MediaStreamConstraints): Promise<MediaStream>;
@@ -76,7 +93,7 @@ declare class CameraService extends BrowserApiBaseService {
76
93
 
77
94
  declare class GeolocationService extends BrowserApiBaseService {
78
95
  protected getApiName(): string;
79
- private ensureGeolocationSupport;
96
+ protected ensureSupported(): void;
80
97
  getCurrentPosition(options?: PositionOptions): Promise<GeolocationPosition>;
81
98
  watchPosition(options?: PositionOptions): Observable<GeolocationPosition>;
82
99
  clearWatch(watchId: number): void;
@@ -91,7 +108,7 @@ interface DisplayMediaConstraints {
91
108
  }
92
109
  declare class MediaDevicesService extends BrowserApiBaseService {
93
110
  protected getApiName(): string;
94
- private ensureMediaDevicesSupport;
111
+ protected ensureSupported(): void;
95
112
  getDevices(): Promise<MediaDeviceInfo[]>;
96
113
  getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
97
114
  getDisplayMedia(constraints?: DisplayMediaConstraints): Promise<MediaStream>;
@@ -108,8 +125,8 @@ declare class MediaDevicesService extends BrowserApiBaseService {
108
125
 
109
126
  declare class NotificationService extends BrowserApiBaseService {
110
127
  protected getApiName(): string;
128
+ protected ensureSupported(): void;
111
129
  get permission(): NotificationPermission;
112
- isSupported(): boolean;
113
130
  requestNotificationPermission(): Promise<NotificationPermission>;
114
131
  showNotification(title: string, options?: NotificationOptions): Promise<Notification>;
115
132
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
@@ -118,10 +135,9 @@ declare class NotificationService extends BrowserApiBaseService {
118
135
 
119
136
  declare class ClipboardService extends BrowserApiBaseService {
120
137
  protected getApiName(): string;
121
- private ensureClipboardPermission;
138
+ protected ensureSupported(): void;
122
139
  writeText(text: string): Promise<void>;
123
140
  readText(): Promise<string>;
124
- writeTextSecure(text: string): Promise<void>;
125
141
  static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardService, never>;
126
142
  static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
127
143
  }
@@ -280,7 +296,7 @@ declare class BrowserCapabilityService {
280
296
  isSecureContext(): boolean;
281
297
  isSupported(capability: BrowserCapabilityId): boolean;
282
298
  getAllStatuses(): {
283
- 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" | "mutationObserver" | "performanceObserver" | "idleDetector" | "eyeDropper" | "barcodeDetector" | "webAudio" | "gamepad" | "webBluetooth" | "webUsb" | "webNfc" | "paymentRequest" | "credentialManagement";
299
+ id: "camera" | "geolocation" | "permissions" | "clipboard" | "notification" | "mediaDevices" | "webWorker" | "regexSecurity" | "webStorage" | "webShare" | "battery" | "webSocket" | "intersectionObserver" | "resizeObserver" | "pageVisibility" | "broadcastChannel" | "networkInformation" | "screenWakeLock" | "screenOrientation" | "fullscreen" | "fileSystemAccess" | "mediaRecorder" | "serverSentEvents" | "vibration" | "speechSynthesis" | "mutationObserver" | "performanceObserver" | "idleDetector" | "eyeDropper" | "barcodeDetector" | "webAudio" | "gamepad" | "webBluetooth" | "webUsb" | "webNfc" | "paymentRequest" | "credentialManagement";
284
300
  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" | "Mutation Observer" | "Performance Observer" | "Idle Detection API" | "EyeDropper API" | "Barcode Detection API" | "Web Audio API" | "Gamepad API" | "Web Bluetooth API" | "WebUSB API" | "Web NFC API" | "Payment Request API" | "Credential Management API";
285
301
  supported: boolean;
286
302
  secureContext: boolean;
@@ -320,11 +336,10 @@ declare global {
320
336
  declare class BatteryService extends BrowserApiBaseService {
321
337
  private batteryManager;
322
338
  protected getApiName(): string;
323
- private ensureBatterySupport;
339
+ protected ensureSupported(): void;
324
340
  initialize(): Promise<BatteryInfo>;
325
341
  getBatteryInfo(): BatteryInfo;
326
342
  watchBatteryInfo(): Observable<BatteryInfo>;
327
- private setupEventListeners;
328
343
  getNativeBatteryManager(): BatteryManager;
329
344
  isCharging(): boolean;
330
345
  getLevel(): number;
@@ -340,7 +355,7 @@ interface ShareResult {
340
355
  }
341
356
  declare class WebShareService extends BrowserApiBaseService {
342
357
  protected getApiName(): string;
343
- private ensureWebShareSupport;
358
+ protected ensureSupported(): void;
344
359
  share(data: ShareData): Promise<ShareResult>;
345
360
  canShare(): boolean;
346
361
  canShareFiles(): boolean;
@@ -368,21 +383,21 @@ interface StorageOptions {
368
383
  deserialize?: (value: string) => StorageValue;
369
384
  }
370
385
  interface StorageEvent {
371
- key: string;
386
+ key: string | null;
372
387
  newValue: StorageValue | null;
373
388
  oldValue: StorageValue | null;
374
389
  storageArea: 'localStorage' | 'sessionStorage';
375
390
  }
376
391
  declare class WebStorageService extends BrowserApiBaseService {
377
392
  private storageEvents;
378
- protected destroyRef: DestroyRef;
379
393
  constructor();
380
394
  protected getApiName(): string;
381
- private ensureStorageSupport;
395
+ protected ensureSupported(): void;
382
396
  private setupEventListeners;
383
397
  private serializeValue;
384
398
  private deserializeValue;
385
399
  private getKey;
400
+ private emitStorageChange;
386
401
  setLocalStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
387
402
  getLocalStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
388
403
  removeLocalStorage(key: string, options?: StorageOptions): boolean;
@@ -429,19 +444,20 @@ declare class WebSocketService extends BrowserApiBaseService {
429
444
  private reconnectAttempts;
430
445
  private reconnectTimer;
431
446
  private heartbeatTimer;
447
+ private readonly _cleanup;
432
448
  protected getApiName(): string;
433
- private ensureWebSocketSupport;
449
+ protected ensureSupported(): void;
434
450
  connect(config: WebSocketConfig): Observable<WebSocketStatus>;
435
451
  disconnect(): void;
436
452
  send<T>(message: WebSocketMessage<T>): void;
437
453
  sendRaw(data: string): void;
438
454
  getStatus(): Observable<WebSocketStatus>;
439
455
  getMessages<T = unknown>(): Observable<WebSocketMessage<T>>;
456
+ getMessagesByType<T = unknown>(type: string): Observable<WebSocketMessage<T>>;
440
457
  private setupWebSocketHandlers;
441
458
  private startHeartbeat;
442
459
  private attemptReconnect;
443
460
  private updateStatus;
444
- private getCurrentStatus;
445
461
  getNativeWebSocket(): WebSocket | null;
446
462
  isConnected(): boolean;
447
463
  getReadyState(): number;
@@ -468,13 +484,13 @@ interface WorkerTask<T = unknown> {
468
484
  transferable?: Transferable[];
469
485
  }
470
486
  declare class WebWorkerService extends BrowserApiBaseService {
471
- protected destroyRef: DestroyRef;
472
487
  private workers;
473
488
  private workerStatuses;
474
489
  private workerMessages;
475
490
  private currentWorkerStatuses;
491
+ private readonly _cleanup;
476
492
  protected getApiName(): string;
477
- private ensureWorkerSupport;
493
+ protected ensureSupported(): void;
478
494
  createWorker(name: string, scriptUrl: string): Observable<WorkerStatus>;
479
495
  terminateWorker(name: string): void;
480
496
  terminateAllWorkers(): void;
@@ -497,8 +513,8 @@ interface IntersectionObserverOptions {
497
513
  rootMargin?: string;
498
514
  threshold?: number | number[];
499
515
  }
500
- declare class IntersectionObserverService {
501
- private readonly platformId;
516
+ declare class IntersectionObserverService extends BrowserApiBaseService {
517
+ protected getApiName(): string;
502
518
  isSupported(): boolean;
503
519
  observe(element: Element, options?: IntersectionObserverOptions): Observable<IntersectionObserverEntry[]>;
504
520
  observeVisibility(element: Element, options?: IntersectionObserverOptions): Observable<boolean>;
@@ -515,8 +531,8 @@ interface ElementSize {
515
531
  inlineSize: number;
516
532
  blockSize: number;
517
533
  }
518
- declare class ResizeObserverService {
519
- private readonly platformId;
534
+ declare class ResizeObserverService extends BrowserApiBaseService {
535
+ protected getApiName(): string;
520
536
  isSupported(): boolean;
521
537
  observe(element: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]>;
522
538
  observeSize(element: Element, options?: ResizeObserverOptions): Observable<ElementSize>;
@@ -525,8 +541,8 @@ declare class ResizeObserverService {
525
541
  }
526
542
 
527
543
  type VisibilityState = 'visible' | 'hidden' | 'prerender';
528
- declare class PageVisibilityService {
529
- private readonly platformId;
544
+ declare class PageVisibilityService extends BrowserApiBaseService {
545
+ protected getApiName(): string;
530
546
  isSupported(): boolean;
531
547
  get isHidden(): boolean;
532
548
  get visibilityState(): VisibilityState;
@@ -536,12 +552,46 @@ declare class PageVisibilityService {
536
552
  static ɵprov: i0.ɵɵInjectableDeclaration<PageVisibilityService>;
537
553
  }
538
554
 
539
- declare class BroadcastChannelService {
540
- private readonly destroyRef;
541
- private readonly platformId;
542
- private channels;
555
+ /**
556
+ * Base class for services that manage a named registry of persistent
557
+ * connections (e.g. BroadcastChannel, EventSource, WebSocket pools).
558
+ *
559
+ * Implements the Template Method pattern: subclasses define how a single
560
+ * native connection is closed via `closeNativeConnection()`, while this
561
+ * class handles the Map lifecycle (remove, closeAll, getActiveKeys).
562
+ *
563
+ * Public-facing method names (`close`, `disconnect`, `getOpenChannels`, etc.)
564
+ * remain the responsibility of the concrete service to preserve the public API.
565
+ */
566
+ declare abstract class ConnectionRegistryBaseService<T> extends BrowserApiBaseService {
567
+ protected readonly connections: Map<string, T>;
568
+ /**
569
+ * Template Method: close a single native connection.
570
+ * Implemented by each concrete service.
571
+ */
572
+ protected abstract closeNativeConnection(connection: T): void;
573
+ /**
574
+ * Remove and close the connection registered under `key`.
575
+ * Safe to call even if the key does not exist.
576
+ */
577
+ protected removeConnection(key: string): void;
578
+ /**
579
+ * Close all registered connections and clear the registry.
580
+ */
581
+ protected closeAllConnections(): void;
582
+ /**
583
+ * Return the keys of all currently open connections.
584
+ */
585
+ protected getConnectionKeys(): string[];
586
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConnectionRegistryBaseService<any>, never>;
587
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConnectionRegistryBaseService<any>>;
588
+ }
589
+
590
+ declare class BroadcastChannelService extends ConnectionRegistryBaseService<BroadcastChannel> {
591
+ protected getApiName(): string;
592
+ protected closeNativeConnection(channel: BroadcastChannel): void;
543
593
  isSupported(): boolean;
544
- private ensureSupport;
594
+ private ensureBroadcastChannelSupported;
545
595
  open<T = unknown>(name: string): Observable<T>;
546
596
  post<T = unknown>(name: string, data: T): void;
547
597
  close(name: string): void;
@@ -562,8 +612,8 @@ interface NetworkInformation {
562
612
  saveData?: boolean;
563
613
  online: boolean;
564
614
  }
565
- declare class NetworkInformationService {
566
- private readonly platformId;
615
+ declare class NetworkInformationService extends BrowserApiBaseService {
616
+ protected getApiName(): string;
567
617
  isSupported(): boolean;
568
618
  getSnapshot(): NetworkInformation;
569
619
  watch(): Observable<NetworkInformation>;
@@ -596,8 +646,8 @@ interface OrientationInfo {
596
646
  type: OrientationType;
597
647
  angle: number;
598
648
  }
599
- declare class ScreenOrientationService {
600
- private readonly platformId;
649
+ declare class ScreenOrientationService extends BrowserApiBaseService {
650
+ protected getApiName(): string;
601
651
  isSupported(): boolean;
602
652
  getSnapshot(): OrientationInfo;
603
653
  get isPortrait(): boolean;
@@ -609,9 +659,8 @@ declare class ScreenOrientationService {
609
659
  static ɵprov: i0.ɵɵInjectableDeclaration<ScreenOrientationService>;
610
660
  }
611
661
 
612
- declare class FullscreenService {
613
- private readonly destroyRef;
614
- private readonly platformId;
662
+ declare class FullscreenService extends BrowserApiBaseService {
663
+ protected getApiName(): string;
615
664
  isSupported(): boolean;
616
665
  get isFullscreen(): boolean;
617
666
  get fullscreenElement(): Element | null;
@@ -643,7 +692,7 @@ declare class FileSystemAccessService extends BrowserApiBaseService {
643
692
  protected getApiName(): string;
644
693
  isSupported(): boolean;
645
694
  private get win();
646
- private ensureSupport;
695
+ protected ensureSupported(): void;
647
696
  openFile(options?: FileOpenOptions): Promise<File[]>;
648
697
  saveFile(content: string | Blob, options?: FileSaveOptions): Promise<void>;
649
698
  openDirectory(options?: {
@@ -703,12 +752,11 @@ interface SSEConfig {
703
752
  withCredentials?: boolean;
704
753
  eventTypes?: string[];
705
754
  }
706
- declare class ServerSentEventsService {
707
- private readonly destroyRef;
708
- private readonly platformId;
709
- private sources;
755
+ declare class ServerSentEventsService extends ConnectionRegistryBaseService<EventSource> {
756
+ protected getApiName(): string;
757
+ protected closeNativeConnection(source: EventSource): void;
710
758
  isSupported(): boolean;
711
- private ensureSupport;
759
+ private ensureSSESupported;
712
760
  connect<T = unknown>(url: string, config?: SSEConfig): Observable<SSEMessage<T>>;
713
761
  disconnect(url: string): void;
714
762
  disconnectAll(): void;
@@ -725,8 +773,8 @@ interface VibrationPreset {
725
773
  notification: VibrationPattern;
726
774
  doubleTap: VibrationPattern;
727
775
  }
728
- declare class VibrationService {
729
- private readonly platformId;
776
+ declare class VibrationService extends BrowserApiBaseService {
777
+ protected getApiName(): string;
730
778
  readonly presets: VibrationPreset;
731
779
  isSupported(): boolean;
732
780
  vibrate(pattern?: VibrationPattern): boolean;
@@ -747,11 +795,10 @@ interface SpeechOptions {
747
795
  rate?: number;
748
796
  pitch?: number;
749
797
  }
750
- declare class SpeechSynthesisService {
751
- private readonly destroyRef;
752
- private readonly platformId;
798
+ declare class SpeechSynthesisService extends BrowserApiBaseService {
799
+ protected getApiName(): string;
753
800
  isSupported(): boolean;
754
- private ensureSupport;
801
+ private ensureSpeechSynthesisSupported;
755
802
  get state(): SpeechState;
756
803
  get isPending(): boolean;
757
804
  getVoices(): SpeechSynthesisVoice[];
@@ -774,8 +821,8 @@ interface MutationObserverOptions {
774
821
  attributeFilter?: string[];
775
822
  }
776
823
 
777
- declare class MutationObserverService {
778
- private readonly platformId;
824
+ declare class MutationObserverService extends BrowserApiBaseService {
825
+ protected getApiName(): string;
779
826
  isSupported(): boolean;
780
827
  observe(target: Node, options?: MutationObserverOptions): Observable<MutationRecord[]>;
781
828
  static ɵfac: i0.ɵɵFactoryDeclaration<MutationObserverService, never>;
@@ -789,8 +836,8 @@ interface PerformanceObserverConfig {
789
836
  buffered?: boolean;
790
837
  }
791
838
 
792
- declare class PerformanceObserverService {
793
- private readonly platformId;
839
+ declare class PerformanceObserverService extends BrowserApiBaseService {
840
+ protected getApiName(): string;
794
841
  isSupported(): boolean;
795
842
  observe(config: PerformanceObserverConfig): Observable<PerformanceEntryList>;
796
843
  observeByType(type: PerformanceEntryType, buffered?: boolean): Observable<PerformanceEntryList>;
@@ -808,8 +855,8 @@ interface IdleState {
808
855
  interface IdleDetectorOptions {
809
856
  threshold?: number;
810
857
  }
811
- declare class IdleDetectorService {
812
- private readonly platformId;
858
+ declare class IdleDetectorService extends BrowserApiBaseService {
859
+ protected getApiName(): string;
813
860
  isSupported(): boolean;
814
861
  requestPermission(): Promise<PermissionState>;
815
862
  watch(options?: IdleDetectorOptions): Observable<IdleState>;
@@ -820,8 +867,8 @@ declare class IdleDetectorService {
820
867
  interface ColorSelectionResult {
821
868
  sRGBHex: string;
822
869
  }
823
- declare class EyeDropperService {
824
- private readonly platformId;
870
+ declare class EyeDropperService extends BrowserApiBaseService {
871
+ protected getApiName(): string;
825
872
  isSupported(): boolean;
826
873
  open(signal?: AbortSignal): Promise<ColorSelectionResult>;
827
874
  static ɵfac: i0.ɵɵFactoryDeclaration<EyeDropperService, never>;
@@ -838,8 +885,8 @@ interface DetectedBarcode {
838
885
  format: BarcodeFormat;
839
886
  rawValue: string;
840
887
  }
841
- declare class BarcodeDetectorService {
842
- private readonly platformId;
888
+ declare class BarcodeDetectorService extends BrowserApiBaseService {
889
+ protected getApiName(): string;
843
890
  isSupported(): boolean;
844
891
  getSupportedFormats(): Promise<BarcodeFormat[]>;
845
892
  detect(image: ImageBitmapSource, formats?: BarcodeFormat[]): Promise<DetectedBarcode[]>;
@@ -852,9 +899,8 @@ interface AudioAnalyserData {
852
899
  frequencyData: Uint8Array;
853
900
  timeDomainData: Uint8Array;
854
901
  }
855
- declare class WebAudioService {
856
- private readonly platformId;
857
- private readonly destroyRef;
902
+ declare class WebAudioService extends BrowserApiBaseService {
903
+ protected getApiName(): string;
858
904
  private context;
859
905
  isSupported(): boolean;
860
906
  getContext(): AudioContext;
@@ -883,8 +929,8 @@ interface GamepadState {
883
929
  timestamp: number;
884
930
  }
885
931
 
886
- declare class GamepadService {
887
- private readonly platformId;
932
+ declare class GamepadService extends BrowserApiBaseService {
933
+ protected getApiName(): string;
888
934
  isSupported(): boolean;
889
935
  getSnapshot(index: number): GamepadState | null;
890
936
  getConnectedGamepads(): GamepadState[];
@@ -980,8 +1026,8 @@ interface BluetoothDeviceInfo {
980
1026
  name: string | undefined;
981
1027
  connected: boolean;
982
1028
  }
983
- declare class WebBluetoothService {
984
- private readonly platformId;
1029
+ declare class WebBluetoothService extends BrowserApiBaseService {
1030
+ protected getApiName(): string;
985
1031
  isSupported(): boolean;
986
1032
  requestDevice(options?: BluetoothRequestDeviceOptions): Promise<BluetoothDeviceRef>;
987
1033
  connect(device: BluetoothDeviceRef): Promise<BluetoothRemoteGATTServer>;
@@ -1002,8 +1048,8 @@ interface UsbDeviceInfo {
1002
1048
  serialNumber: string | undefined;
1003
1049
  opened: boolean;
1004
1050
  }
1005
- declare class WebUsbService {
1006
- private readonly platformId;
1051
+ declare class WebUsbService extends BrowserApiBaseService {
1052
+ protected getApiName(): string;
1007
1053
  isSupported(): boolean;
1008
1054
  requestDevice(filters?: UsbDeviceFilterDef[]): Promise<UsbDeviceRef>;
1009
1055
  getDevices(): Promise<UsbDeviceRef[]>;
@@ -1023,8 +1069,8 @@ declare class WebUsbService {
1023
1069
  static ɵprov: i0.ɵɵInjectableDeclaration<WebUsbService>;
1024
1070
  }
1025
1071
 
1026
- declare class WebNfcService {
1027
- private readonly platformId;
1072
+ declare class WebNfcService extends BrowserApiBaseService {
1073
+ protected getApiName(): string;
1028
1074
  isSupported(): boolean;
1029
1075
  scan(): Observable<NdefReadingEvent>;
1030
1076
  write(message: NdefMessage | string, options?: NdefWriteOptions): Promise<void>;
@@ -1065,8 +1111,8 @@ interface PaymentResult {
1065
1111
  payerEmail: string | null;
1066
1112
  payerPhone: string | null;
1067
1113
  }
1068
- declare class PaymentRequestService {
1069
- private readonly platformId;
1114
+ declare class PaymentRequestService extends BrowserApiBaseService {
1115
+ protected getApiName(): string;
1070
1116
  isSupported(): boolean;
1071
1117
  canMakePayment(methods: PaymentMethodConfig[], details: PaymentDetailsInit): Promise<boolean>;
1072
1118
  show(methods: PaymentMethodConfig[], details: PaymentDetailsInit, options?: PaymentOptionsConfig): Promise<PaymentResult>;
@@ -1104,8 +1150,8 @@ interface CredentialResult {
1104
1150
  id: string;
1105
1151
  type: string;
1106
1152
  }
1107
- declare class CredentialManagementService {
1108
- private readonly platformId;
1153
+ declare class CredentialManagementService extends BrowserApiBaseService {
1154
+ protected getApiName(): string;
1109
1155
  isSupported(): boolean;
1110
1156
  isPublicKeySupported(): boolean;
1111
1157
  get(options?: CredentialRequestOptions): Promise<Credential | null>;
@@ -1118,6 +1164,13 @@ declare class CredentialManagementService {
1118
1164
  static ɵprov: i0.ɵɵInjectableDeclaration<CredentialManagementService>;
1119
1165
  }
1120
1166
 
1167
+ interface BrowserApiLogger {
1168
+ info(message: string): void;
1169
+ warn(message: string): void;
1170
+ error(message: string, error?: unknown): void;
1171
+ }
1172
+ declare const BROWSER_API_LOGGER: InjectionToken<BrowserApiLogger>;
1173
+
1121
1174
  interface MediaDevice {
1122
1175
  deviceId: string;
1123
1176
  groupId: string;
@@ -1309,6 +1362,83 @@ declare class BrowserSupportUtil {
1309
1362
  */
1310
1363
  declare const permissionGuard: (permission: PermissionNameExt) => CanActivateFn;
1311
1364
 
1365
+ declare function providePermissions(): EnvironmentProviders;
1366
+
1367
+ declare function provideCamera(): EnvironmentProviders;
1368
+
1369
+ declare function provideGeolocation(): EnvironmentProviders;
1370
+
1371
+ declare function provideNotifications(): EnvironmentProviders;
1372
+
1373
+ declare function provideClipboard(): EnvironmentProviders;
1374
+
1375
+ declare function provideMediaDevices(): EnvironmentProviders;
1376
+
1377
+ declare function provideScreenWakeLock(): EnvironmentProviders;
1378
+
1379
+ declare function provideFileSystemAccess(): EnvironmentProviders;
1380
+
1381
+ declare function provideMediaRecorder(): EnvironmentProviders;
1382
+
1383
+ declare function provideIdleDetector(): EnvironmentProviders;
1384
+
1385
+ declare function provideBattery(): EnvironmentProviders;
1386
+
1387
+ declare function provideWebShare(): EnvironmentProviders;
1388
+
1389
+ declare function provideWebStorage(): EnvironmentProviders;
1390
+
1391
+ declare function provideWebSocket(): EnvironmentProviders;
1392
+
1393
+ declare function provideWebWorker(): EnvironmentProviders;
1394
+
1395
+ declare function provideIntersectionObserver(): EnvironmentProviders;
1396
+
1397
+ declare function provideResizeObserver(): EnvironmentProviders;
1398
+
1399
+ declare function providePageVisibility(): EnvironmentProviders;
1400
+
1401
+ declare function provideBroadcastChannel(): EnvironmentProviders;
1402
+
1403
+ declare function provideNetworkInformation(): EnvironmentProviders;
1404
+
1405
+ declare function provideScreenOrientation(): EnvironmentProviders;
1406
+
1407
+ declare function provideFullscreen(): EnvironmentProviders;
1408
+
1409
+ declare function provideServerSentEvents(): EnvironmentProviders;
1410
+
1411
+ declare function provideVibration(): EnvironmentProviders;
1412
+
1413
+ declare function provideSpeechSynthesis(): EnvironmentProviders;
1414
+
1415
+ declare function provideMutationObserver(): EnvironmentProviders;
1416
+
1417
+ declare function providePerformanceObserver(): EnvironmentProviders;
1418
+
1419
+ declare function provideEyeDropper(): EnvironmentProviders;
1420
+
1421
+ declare function provideBarcodeDetector(): EnvironmentProviders;
1422
+
1423
+ declare function provideWebAudio(): EnvironmentProviders;
1424
+
1425
+ declare function provideGamepad(): EnvironmentProviders;
1426
+
1427
+ declare function provideWebBluetooth(): EnvironmentProviders;
1428
+
1429
+ declare function provideWebUsb(): EnvironmentProviders;
1430
+
1431
+ declare function provideWebNfc(): EnvironmentProviders;
1432
+
1433
+ declare function providePaymentRequest(): EnvironmentProviders;
1434
+
1435
+ declare function provideCredentialManagement(): EnvironmentProviders;
1436
+
1437
+ declare function provideMediaApis(): EnvironmentProviders;
1438
+ declare function provideLocationApis(): EnvironmentProviders;
1439
+ declare function provideStorageApis(): EnvironmentProviders;
1440
+ declare function provideCommunicationApis(): EnvironmentProviders;
1441
+
1312
1442
  interface BrowserWebApisConfig {
1313
1443
  enableCamera?: boolean;
1314
1444
  enableGeolocation?: boolean;
@@ -1348,48 +1478,8 @@ interface BrowserWebApisConfig {
1348
1478
  }
1349
1479
  declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
1350
1480
  declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
1351
- declare function provideCamera(): EnvironmentProviders;
1352
- declare function provideGeolocation(): EnvironmentProviders;
1353
- declare function provideNotifications(): EnvironmentProviders;
1354
- declare function provideClipboard(): EnvironmentProviders;
1355
- declare function provideMediaDevices(): EnvironmentProviders;
1356
- declare function provideBattery(): EnvironmentProviders;
1357
- declare function provideWebShare(): EnvironmentProviders;
1358
- declare function provideWebStorage(): EnvironmentProviders;
1359
- declare function provideWebSocket(): EnvironmentProviders;
1360
- declare function provideWebWorker(): EnvironmentProviders;
1361
- declare function providePermissions(): EnvironmentProviders;
1362
- declare function provideMediaApis(): EnvironmentProviders;
1363
- declare function provideLocationApis(): EnvironmentProviders;
1364
- declare function provideStorageApis(): EnvironmentProviders;
1365
- declare function provideCommunicationApis(): EnvironmentProviders;
1366
- declare function provideIntersectionObserver(): EnvironmentProviders;
1367
- declare function provideResizeObserver(): EnvironmentProviders;
1368
- declare function providePageVisibility(): EnvironmentProviders;
1369
- declare function provideBroadcastChannel(): EnvironmentProviders;
1370
- declare function provideNetworkInformation(): EnvironmentProviders;
1371
- declare function provideScreenWakeLock(): EnvironmentProviders;
1372
- declare function provideScreenOrientation(): EnvironmentProviders;
1373
- declare function provideFullscreen(): EnvironmentProviders;
1374
- declare function provideFileSystemAccess(): EnvironmentProviders;
1375
- declare function provideMediaRecorder(): EnvironmentProviders;
1376
- declare function provideServerSentEvents(): EnvironmentProviders;
1377
- declare function provideVibration(): EnvironmentProviders;
1378
- declare function provideSpeechSynthesis(): EnvironmentProviders;
1379
- declare function provideMutationObserver(): EnvironmentProviders;
1380
- declare function providePerformanceObserver(): EnvironmentProviders;
1381
- declare function provideIdleDetector(): EnvironmentProviders;
1382
- declare function provideEyeDropper(): EnvironmentProviders;
1383
- declare function provideBarcodeDetector(): EnvironmentProviders;
1384
- declare function provideWebAudio(): EnvironmentProviders;
1385
- declare function provideGamepad(): EnvironmentProviders;
1386
- declare function provideWebBluetooth(): EnvironmentProviders;
1387
- declare function provideWebUsb(): EnvironmentProviders;
1388
- declare function provideWebNfc(): EnvironmentProviders;
1389
- declare function providePaymentRequest(): EnvironmentProviders;
1390
- declare function provideCredentialManagement(): EnvironmentProviders;
1391
1481
 
1392
1482
  declare const version = "0.1.0";
1393
1483
 
1394
- export { BarcodeDetectorService, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, CredentialManagementService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PaymentRequestService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebBluetoothService, WebNfcService, WebShareService, WebSocketService, WebStorageService, WebUsbService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBarcodeDetector, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCredentialManagement, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePaymentRequest, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebBluetooth, provideWebNfc, provideWebShare, provideWebSocket, provideWebStorage, provideWebUsb, provideWebWorker, version };
1395
- export type { AudioAnalyserData, AudioContextState, BarcodeFormat, BatteryInfo, BatteryManager, BluetoothDeviceInfo, BluetoothDeviceRef, BluetoothRequestDeviceOptions, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ColorSelectionResult, ConnectionType, CredentialResult, DetectedBarcode, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IdleDetectorOptions, IdleDetectorRef, IdleState, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NdefMessage, NdefReadingEvent, NdefWriteOptions, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PasswordCredentialData, PaymentDetailsInit, PaymentMethodConfig, PaymentOptionsConfig, PaymentResult, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, PublicKeyCredentialOptions, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenIdleState, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageOptions, StorageValue, UsbDeviceFilterDef, UsbDeviceInfo, UsbDeviceRef, UserIdleState, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketConfig, WebSocketMessage, WebSocketStatus, WorkerMessage, WorkerStatus, WorkerTask };
1484
+ export { BROWSER_API_LOGGER, BarcodeDetectorService, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, ConnectionRegistryBaseService, CredentialManagementService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PaymentRequestService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebBluetoothService, WebNfcService, WebShareService, WebSocketService, WebStorageService, WebUsbService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBarcodeDetector, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCredentialManagement, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePaymentRequest, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebBluetooth, provideWebNfc, provideWebShare, provideWebSocket, provideWebStorage, provideWebUsb, provideWebWorker, version };
1485
+ export type { AudioAnalyserData, AudioContextState, BarcodeFormat, BatteryInfo, BatteryManager, BluetoothDeviceInfo, BluetoothDeviceRef, BluetoothRequestDeviceOptions, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ColorSelectionResult, ConnectionType, CredentialResult, DetectedBarcode, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IdleDetectorOptions, IdleDetectorRef, IdleState, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NdefMessage, NdefReadingEvent, NdefWriteOptions, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PasswordCredentialData, PaymentDetailsInit, PaymentMethodConfig, PaymentOptionsConfig, PaymentResult, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, PublicKeyCredentialOptions, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenIdleState, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageOptions, StorageValue, UsbDeviceFilterDef, UsbDeviceInfo, UsbDeviceRef, UserIdleState, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketConfig, WebSocketMessage, WebSocketStatus, WorkerMessage, WorkerStatus, WorkerTask };