@angular-helpers/browser-web-apis 21.7.0 → 21.10.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.
|
@@ -3,146 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { DestroyRef, ElementRef, Signal, InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
4
4
|
import { CanActivateFn } from '@angular/router';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Base class for all Browser Web API services.
|
|
8
|
-
* Provides common functionality for:
|
|
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
|
|
13
|
-
* - Lifecycle management with destroyRef
|
|
14
|
-
*
|
|
15
|
-
* Services that also need permission querying should extend
|
|
16
|
-
* `PermissionAwareBrowserApiBaseService` instead.
|
|
17
|
-
*/
|
|
18
|
-
declare abstract class BrowserApiBaseService {
|
|
19
|
-
protected destroyRef: DestroyRef;
|
|
20
|
-
protected platformId: Object;
|
|
21
|
-
private readonly logger;
|
|
22
|
-
/**
|
|
23
|
-
* Abstract method that must be implemented by child services.
|
|
24
|
-
* Returns the API name used in log messages and error strings.
|
|
25
|
-
*/
|
|
26
|
-
protected abstract getApiName(): string;
|
|
27
|
-
/**
|
|
28
|
-
* Check if running in browser environment using Angular's platform detection.
|
|
29
|
-
*/
|
|
30
|
-
protected isBrowserEnvironment(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Check if running in server environment using Angular's platform detection.
|
|
33
|
-
*/
|
|
34
|
-
protected isServerEnvironment(): boolean;
|
|
35
|
-
/**
|
|
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.
|
|
38
|
-
*/
|
|
39
|
-
protected ensureSupported(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Create an error with proper cause chaining.
|
|
42
|
-
*/
|
|
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;
|
|
56
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserApiBaseService, never>;
|
|
57
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserApiBaseService>;
|
|
58
|
-
}
|
|
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
|
-
|
|
78
|
-
declare class CameraService extends BrowserApiBaseService {
|
|
79
|
-
private currentStream;
|
|
80
|
-
protected getApiName(): string;
|
|
81
|
-
protected ensureSupported(): void;
|
|
82
|
-
startCamera(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
83
|
-
stopCamera(): void;
|
|
84
|
-
switchCamera(deviceId: string, constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
85
|
-
getCameraCapabilities(deviceId: string): Promise<MediaTrackCapabilities | null>;
|
|
86
|
-
getCurrentStream(): MediaStream | null;
|
|
87
|
-
isStreaming(): boolean;
|
|
88
|
-
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
89
|
-
getNativeMediaDevices(): MediaDevices;
|
|
90
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CameraService, never>;
|
|
91
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<CameraService>;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare class GeolocationService extends BrowserApiBaseService {
|
|
95
|
-
protected getApiName(): string;
|
|
96
|
-
protected ensureSupported(): void;
|
|
97
|
-
getCurrentPosition(options?: PositionOptions): Promise<GeolocationPosition>;
|
|
98
|
-
watchPosition(options?: PositionOptions): Observable<GeolocationPosition>;
|
|
99
|
-
clearWatch(watchId: number): void;
|
|
100
|
-
getNativeGeolocation(): Geolocation;
|
|
101
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GeolocationService, never>;
|
|
102
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<GeolocationService>;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
interface DisplayMediaConstraints {
|
|
106
|
-
video?: boolean | MediaTrackConstraints;
|
|
107
|
-
audio?: boolean | MediaTrackConstraints;
|
|
108
|
-
}
|
|
109
|
-
declare class MediaDevicesService extends BrowserApiBaseService {
|
|
110
|
-
protected getApiName(): string;
|
|
111
|
-
protected ensureSupported(): void;
|
|
112
|
-
getDevices(): Promise<MediaDeviceInfo[]>;
|
|
113
|
-
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
114
|
-
getDisplayMedia(constraints?: DisplayMediaConstraints): Promise<MediaStream>;
|
|
115
|
-
watchDeviceChanges(): Observable<MediaDeviceInfo[]>;
|
|
116
|
-
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
117
|
-
getAudioInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
118
|
-
getAudioOutputDevices(): Promise<MediaDeviceInfo[]>;
|
|
119
|
-
private getDevicesByKind;
|
|
120
|
-
private handleMediaError;
|
|
121
|
-
getNativeMediaDevices(): MediaDevices;
|
|
122
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MediaDevicesService, never>;
|
|
123
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MediaDevicesService>;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
declare class NotificationService extends BrowserApiBaseService {
|
|
127
|
-
protected getApiName(): string;
|
|
128
|
-
protected ensureSupported(): void;
|
|
129
|
-
get permission(): NotificationPermission;
|
|
130
|
-
requestNotificationPermission(): Promise<NotificationPermission>;
|
|
131
|
-
showNotification(title: string, options?: NotificationOptions): Promise<Notification>;
|
|
132
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
|
|
133
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
declare class ClipboardService extends BrowserApiBaseService {
|
|
137
|
-
protected getApiName(): string;
|
|
138
|
-
protected ensureSupported(): void;
|
|
139
|
-
writeText(text: string): Promise<void>;
|
|
140
|
-
readText(): Promise<string>;
|
|
141
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardService, never>;
|
|
142
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
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' | 'mutationObserver' | 'performanceObserver' | 'idleDetector' | 'eyeDropper' | 'barcodeDetector' | 'webAudio' | 'gamepad' | 'webBluetooth' | 'webUsb' | 'webNfc' | 'paymentRequest' | 'credentialManagement';
|
|
6
|
+
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' | 'mutationObserver' | 'performanceObserver' | 'idleDetector' | 'eyeDropper' | 'barcodeDetector' | 'webAudio' | 'gamepad' | 'webBluetooth' | 'webUsb' | 'webNfc' | 'paymentRequest' | 'credentialManagement' | 'webLocks' | 'storageManager' | 'compressionStreams';
|
|
146
7
|
declare class BrowserCapabilityService {
|
|
147
8
|
getCapabilities(): readonly [{
|
|
148
9
|
readonly id: "permissions";
|
|
@@ -292,12 +153,24 @@ declare class BrowserCapabilityService {
|
|
|
292
153
|
readonly id: "credentialManagement";
|
|
293
154
|
readonly label: "Credential Management API";
|
|
294
155
|
readonly requiresSecureContext: true;
|
|
156
|
+
}, {
|
|
157
|
+
readonly id: "webLocks";
|
|
158
|
+
readonly label: "Web Locks API";
|
|
159
|
+
readonly requiresSecureContext: true;
|
|
160
|
+
}, {
|
|
161
|
+
readonly id: "storageManager";
|
|
162
|
+
readonly label: "Storage Manager API";
|
|
163
|
+
readonly requiresSecureContext: true;
|
|
164
|
+
}, {
|
|
165
|
+
readonly id: "compressionStreams";
|
|
166
|
+
readonly label: "Compression Streams API";
|
|
167
|
+
readonly requiresSecureContext: false;
|
|
295
168
|
}];
|
|
296
169
|
isSecureContext(): boolean;
|
|
297
170
|
isSupported(capability: BrowserCapabilityId): boolean;
|
|
298
171
|
getAllStatuses(): {
|
|
299
|
-
id: "
|
|
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";
|
|
172
|
+
id: "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" | "mutationObserver" | "performanceObserver" | "idleDetector" | "eyeDropper" | "barcodeDetector" | "webAudio" | "gamepad" | "webBluetooth" | "webUsb" | "webNfc" | "paymentRequest" | "credentialManagement" | "webLocks" | "storageManager" | "compressionStreams";
|
|
173
|
+
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" | "Web Locks API" | "Storage Manager API" | "Compression Streams API";
|
|
301
174
|
supported: boolean;
|
|
302
175
|
secureContext: boolean;
|
|
303
176
|
requiresSecureContext: boolean;
|
|
@@ -307,7 +180,149 @@ declare class BrowserCapabilityService {
|
|
|
307
180
|
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserCapabilityService>;
|
|
308
181
|
}
|
|
309
182
|
|
|
310
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Base class for all Browser Web API services.
|
|
185
|
+
*
|
|
186
|
+
* ## Support detection contract
|
|
187
|
+
*
|
|
188
|
+
* Services follow ONE pattern (do not invent variants):
|
|
189
|
+
*
|
|
190
|
+
* - `isSupported(): boolean` — public, side-effect free, SSR-safe. Default
|
|
191
|
+
* implementation delegates to {@link BrowserCapabilityService} when the subclass
|
|
192
|
+
* overrides {@link getCapabilityId} (recommended).
|
|
193
|
+
* - `ensureSupported(): void` — internal Template Method. Throws when called outside
|
|
194
|
+
* browser or when the underlying API is missing.
|
|
195
|
+
*
|
|
196
|
+
* ## Error surfacing contract
|
|
197
|
+
*
|
|
198
|
+
* - **Imperative methods** MUST call `ensureSupported()` and throw synchronously.
|
|
199
|
+
* - **Stream-returning methods** MUST guard with `isSupported()` and surface
|
|
200
|
+
* unsupported state as `Observable.error(...)` (NOT throw inline).
|
|
201
|
+
*
|
|
202
|
+
* Services that also need permission querying should extend
|
|
203
|
+
* `PermissionAwareBrowserApiBaseService` instead.
|
|
204
|
+
*/
|
|
205
|
+
declare abstract class BrowserApiBaseService {
|
|
206
|
+
protected destroyRef: DestroyRef;
|
|
207
|
+
protected platformId: Object;
|
|
208
|
+
private readonly logger;
|
|
209
|
+
private readonly capabilities;
|
|
210
|
+
/** API name used in log messages and error strings. */
|
|
211
|
+
protected abstract getApiName(): string;
|
|
212
|
+
/**
|
|
213
|
+
* Optional hook for subclasses to delegate feature detection to
|
|
214
|
+
* {@link BrowserCapabilityService}. Returning a capability id removes the need to
|
|
215
|
+
* implement `isSupported()` manually and avoids drift between per-service checks
|
|
216
|
+
* and the centralized capability registry.
|
|
217
|
+
*/
|
|
218
|
+
protected getCapabilityId(): BrowserCapabilityId | null;
|
|
219
|
+
/** Public, SSR-safe support check. Override only if you need extra constraints. */
|
|
220
|
+
isSupported(): boolean;
|
|
221
|
+
protected isBrowserEnvironment(): boolean;
|
|
222
|
+
protected isServerEnvironment(): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Template Method: asserts the service can run in the current environment. Subclasses
|
|
225
|
+
* that need extra checks beyond capability detection MUST call `super.ensureSupported()`
|
|
226
|
+
* first, then add their own check.
|
|
227
|
+
*/
|
|
228
|
+
protected ensureSupported(): void;
|
|
229
|
+
protected createError(message: string, cause?: unknown): Error;
|
|
230
|
+
protected logError(message: string, error?: unknown): void;
|
|
231
|
+
protected logWarn(message: string): void;
|
|
232
|
+
protected logInfo(message: string): void;
|
|
233
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserApiBaseService, never>;
|
|
234
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserApiBaseService>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
type PermissionNameExt = PermissionName | 'clipboard-read' | 'clipboard-write';
|
|
238
|
+
interface PermissionRequest {
|
|
239
|
+
name: PermissionNameExt;
|
|
240
|
+
state: PermissionState;
|
|
241
|
+
}
|
|
242
|
+
interface BrowserPermissions {
|
|
243
|
+
query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
|
|
244
|
+
isSupported(): boolean;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare class PermissionsService extends BrowserApiBaseService implements BrowserPermissions {
|
|
248
|
+
protected getApiName(): string;
|
|
249
|
+
query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
|
|
250
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
251
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsService, never>;
|
|
252
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PermissionsService>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare class CameraService extends BrowserApiBaseService {
|
|
256
|
+
private currentStream;
|
|
257
|
+
protected getApiName(): string;
|
|
258
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
259
|
+
protected ensureSupported(): void;
|
|
260
|
+
startCamera(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
261
|
+
stopCamera(): void;
|
|
262
|
+
switchCamera(deviceId: string, constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
263
|
+
getCameraCapabilities(deviceId: string): Promise<MediaTrackCapabilities | null>;
|
|
264
|
+
getCurrentStream(): MediaStream | null;
|
|
265
|
+
isStreaming(): boolean;
|
|
266
|
+
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
267
|
+
getNativeMediaDevices(): MediaDevices;
|
|
268
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CameraService, never>;
|
|
269
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CameraService>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
declare class GeolocationService extends BrowserApiBaseService {
|
|
273
|
+
protected getApiName(): string;
|
|
274
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
275
|
+
getCurrentPosition(options?: PositionOptions): Promise<GeolocationPosition>;
|
|
276
|
+
watchPosition(options?: PositionOptions): Observable<GeolocationPosition>;
|
|
277
|
+
clearWatch(watchId: number): void;
|
|
278
|
+
getNativeGeolocation(): Geolocation;
|
|
279
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeolocationService, never>;
|
|
280
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GeolocationService>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface DisplayMediaConstraints {
|
|
284
|
+
video?: boolean | MediaTrackConstraints;
|
|
285
|
+
audio?: boolean | MediaTrackConstraints;
|
|
286
|
+
}
|
|
287
|
+
declare class MediaDevicesService extends BrowserApiBaseService {
|
|
288
|
+
protected getApiName(): string;
|
|
289
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
290
|
+
protected ensureSupported(): void;
|
|
291
|
+
getDevices(): Promise<MediaDeviceInfo[]>;
|
|
292
|
+
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
293
|
+
getDisplayMedia(constraints?: DisplayMediaConstraints): Promise<MediaStream>;
|
|
294
|
+
watchDeviceChanges(): Observable<MediaDeviceInfo[]>;
|
|
295
|
+
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
296
|
+
getAudioInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
297
|
+
getAudioOutputDevices(): Promise<MediaDeviceInfo[]>;
|
|
298
|
+
private getDevicesByKind;
|
|
299
|
+
private handleMediaError;
|
|
300
|
+
getNativeMediaDevices(): MediaDevices;
|
|
301
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MediaDevicesService, never>;
|
|
302
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MediaDevicesService>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare class NotificationService extends BrowserApiBaseService {
|
|
306
|
+
protected getApiName(): string;
|
|
307
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
308
|
+
get permission(): NotificationPermission;
|
|
309
|
+
requestNotificationPermission(): Promise<NotificationPermission>;
|
|
310
|
+
showNotification(title: string, options?: NotificationOptions): Promise<Notification>;
|
|
311
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
|
|
312
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare class ClipboardService extends BrowserApiBaseService {
|
|
316
|
+
protected getApiName(): string;
|
|
317
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
318
|
+
protected ensureSupported(): void;
|
|
319
|
+
writeText(text: string): Promise<void>;
|
|
320
|
+
readText(): Promise<string>;
|
|
321
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardService, never>;
|
|
322
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
interface BatteryInfo$1 {
|
|
311
326
|
charging: boolean;
|
|
312
327
|
chargingTime: number;
|
|
313
328
|
dischargingTime: number;
|
|
@@ -336,10 +351,10 @@ declare global {
|
|
|
336
351
|
declare class BatteryService extends BrowserApiBaseService {
|
|
337
352
|
private batteryManager;
|
|
338
353
|
protected getApiName(): string;
|
|
339
|
-
protected
|
|
340
|
-
initialize(): Promise<BatteryInfo>;
|
|
341
|
-
getBatteryInfo(): BatteryInfo;
|
|
342
|
-
watchBatteryInfo(): Observable<BatteryInfo>;
|
|
354
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
355
|
+
initialize(): Promise<BatteryInfo$1>;
|
|
356
|
+
getBatteryInfo(): BatteryInfo$1;
|
|
357
|
+
watchBatteryInfo(): Observable<BatteryInfo$1>;
|
|
343
358
|
getNativeBatteryManager(): BatteryManager;
|
|
344
359
|
isCharging(): boolean;
|
|
345
360
|
getLevel(): number;
|
|
@@ -355,7 +370,7 @@ interface ShareResult {
|
|
|
355
370
|
}
|
|
356
371
|
declare class WebShareService extends BrowserApiBaseService {
|
|
357
372
|
protected getApiName(): string;
|
|
358
|
-
protected
|
|
373
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
359
374
|
share(data: ShareData): Promise<ShareResult>;
|
|
360
375
|
canShare(): boolean;
|
|
361
376
|
canShareFiles(): boolean;
|
|
@@ -436,7 +451,7 @@ declare class WebStorageService extends BrowserApiBaseService {
|
|
|
436
451
|
readonly session: StorageNamespace;
|
|
437
452
|
constructor();
|
|
438
453
|
protected getApiName(): string;
|
|
439
|
-
protected
|
|
454
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
440
455
|
/** Returns true if either local or session storage is usable. */
|
|
441
456
|
isSupported(): boolean;
|
|
442
457
|
/** Stream of every storage mutation observed in this tab or other tabs. */
|
|
@@ -611,7 +626,7 @@ declare class WebSocketService extends BrowserApiBaseService {
|
|
|
611
626
|
/** Legacy single-connection holder used by deprecated `connect()`/`send()` API. */
|
|
612
627
|
private legacyClient;
|
|
613
628
|
protected getApiName(): string;
|
|
614
|
-
protected
|
|
629
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
615
630
|
/**
|
|
616
631
|
* Create a new WebSocket client. The client owns one connection and is the recommended
|
|
617
632
|
* surface for all interactions (status signal, request/response, reconnect, etc.).
|
|
@@ -655,6 +670,8 @@ interface WorkerMessage<T = unknown> {
|
|
|
655
670
|
type: string;
|
|
656
671
|
data: T;
|
|
657
672
|
timestamp: number;
|
|
673
|
+
/** Set on responses to correlate with a `request()` call. */
|
|
674
|
+
correlationId?: string;
|
|
658
675
|
}
|
|
659
676
|
interface WorkerStatus {
|
|
660
677
|
initialized: boolean;
|
|
@@ -663,32 +680,77 @@ interface WorkerStatus {
|
|
|
663
680
|
messageCount: number;
|
|
664
681
|
}
|
|
665
682
|
interface WorkerTask<T = unknown> {
|
|
666
|
-
id
|
|
683
|
+
id?: string;
|
|
667
684
|
type: string;
|
|
668
685
|
data: T;
|
|
669
686
|
transferable?: Transferable[];
|
|
670
687
|
}
|
|
688
|
+
interface WorkerRequestOptions {
|
|
689
|
+
/** Timeout in milliseconds. Defaults to `30_000`. */
|
|
690
|
+
timeout?: number;
|
|
691
|
+
/** Transferable list forwarded to `postMessage`. */
|
|
692
|
+
transferable?: Transferable[];
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Service for creating and managing Web Workers with first-class support for
|
|
696
|
+
* request/response over `postMessage` (id correlation, timeout, transferables).
|
|
697
|
+
*
|
|
698
|
+
* Status is exposed both as a `Signal<WorkerStatus>` (preferred via
|
|
699
|
+
* {@link getStatusSignal}) and as an `Observable<WorkerStatus>` for backward
|
|
700
|
+
* compatibility ({@link createWorker}, {@link getStatus}).
|
|
701
|
+
*
|
|
702
|
+
* The service registers a single `DestroyRef.onDestroy` in its constructor that
|
|
703
|
+
* terminates every registered worker; per-worker handlers do not register their
|
|
704
|
+
* own cleanup callbacks (avoids accumulating callbacks per `setupWorker` call,
|
|
705
|
+
* a previous leak source).
|
|
706
|
+
*/
|
|
671
707
|
declare class WebWorkerService extends BrowserApiBaseService {
|
|
672
|
-
private
|
|
673
|
-
private
|
|
674
|
-
private workerMessages;
|
|
675
|
-
private currentWorkerStatuses;
|
|
708
|
+
private readonly workerLogger;
|
|
709
|
+
private readonly entries;
|
|
676
710
|
private readonly _cleanup;
|
|
677
711
|
protected getApiName(): string;
|
|
678
|
-
protected
|
|
712
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
713
|
+
/**
|
|
714
|
+
* Create a worker. Idempotent: calling twice with the same name returns the
|
|
715
|
+
* existing entry without recreating the worker.
|
|
716
|
+
*
|
|
717
|
+
* Returns an `Observable<WorkerStatus>` for backward compatibility. Prefer
|
|
718
|
+
* {@link createWorkerSignal} for new code.
|
|
719
|
+
*/
|
|
679
720
|
createWorker(name: string, scriptUrl: string): Observable<WorkerStatus>;
|
|
721
|
+
/**
|
|
722
|
+
* Create a worker (signal-first). Returns the status signal; status is also
|
|
723
|
+
* accessible later via {@link getStatusSignal}.
|
|
724
|
+
*/
|
|
725
|
+
createWorkerSignal(name: string, scriptUrl: string): Signal<WorkerStatus>;
|
|
680
726
|
terminateWorker(name: string): void;
|
|
681
727
|
terminateAllWorkers(): void;
|
|
728
|
+
/** Send a fire-and-forget message. Use {@link request} when you need a reply. */
|
|
682
729
|
postMessage(workerName: string, task: WorkerTask): void;
|
|
683
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Send a message and await a correlated response. The worker MUST send back a
|
|
732
|
+
* message containing `correlationId` matching the request id.
|
|
733
|
+
*
|
|
734
|
+
* ```ts
|
|
735
|
+
* const result = await ws.request<{ ok: boolean }>('worker', 'compute', { n: 1 });
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
738
|
+
request<TRes = unknown, TReq = unknown>(workerName: string, type: string, data: TReq, opts?: WorkerRequestOptions): Promise<TRes>;
|
|
739
|
+
getMessages<T = unknown>(workerName: string): Observable<WorkerMessage<T>>;
|
|
740
|
+
getMessagesByType<T = unknown>(workerName: string, type: string): Observable<WorkerMessage<T>>;
|
|
741
|
+
/** @deprecated Use {@link getStatusSignal}. Kept as Observable for backward compat. */
|
|
684
742
|
getStatus(workerName: string): Observable<WorkerStatus>;
|
|
743
|
+
getStatusSignal(workerName: string): Signal<WorkerStatus>;
|
|
685
744
|
getCurrentStatus(workerName: string): WorkerStatus | undefined;
|
|
686
745
|
getAllStatuses(): Map<string, WorkerStatus>;
|
|
687
746
|
isWorkerRunning(workerName: string): boolean;
|
|
688
|
-
private setupWorker;
|
|
689
|
-
private updateWorkerStatus;
|
|
690
747
|
getNativeWorker(name: string): Worker | undefined;
|
|
691
748
|
getAllWorkers(): Map<string, Worker>;
|
|
749
|
+
private attachHandlers;
|
|
750
|
+
private rejectPending;
|
|
751
|
+
private bumpMessageCount;
|
|
752
|
+
private ensureEntry;
|
|
753
|
+
private generateId;
|
|
692
754
|
static ɵfac: i0.ɵɵFactoryDeclaration<WebWorkerService, never>;
|
|
693
755
|
static ɵprov: i0.ɵɵInjectableDeclaration<WebWorkerService>;
|
|
694
756
|
}
|
|
@@ -700,7 +762,7 @@ interface IntersectionObserverOptions {
|
|
|
700
762
|
}
|
|
701
763
|
declare class IntersectionObserverService extends BrowserApiBaseService {
|
|
702
764
|
protected getApiName(): string;
|
|
703
|
-
|
|
765
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
704
766
|
observe(element: Element, options?: IntersectionObserverOptions): Observable<IntersectionObserverEntry[]>;
|
|
705
767
|
observeVisibility(element: Element, options?: IntersectionObserverOptions): Observable<boolean>;
|
|
706
768
|
static ɵfac: i0.ɵɵFactoryDeclaration<IntersectionObserverService, never>;
|
|
@@ -718,7 +780,7 @@ interface ElementSize {
|
|
|
718
780
|
}
|
|
719
781
|
declare class ResizeObserverService extends BrowserApiBaseService {
|
|
720
782
|
protected getApiName(): string;
|
|
721
|
-
|
|
783
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
722
784
|
observe(element: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]>;
|
|
723
785
|
observeSize(element: Element, options?: ResizeObserverOptions): Observable<ElementSize>;
|
|
724
786
|
static ɵfac: i0.ɵɵFactoryDeclaration<ResizeObserverService, never>;
|
|
@@ -728,7 +790,7 @@ declare class ResizeObserverService extends BrowserApiBaseService {
|
|
|
728
790
|
type VisibilityState = 'visible' | 'hidden' | 'prerender';
|
|
729
791
|
declare class PageVisibilityService extends BrowserApiBaseService {
|
|
730
792
|
protected getApiName(): string;
|
|
731
|
-
|
|
793
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
732
794
|
get isHidden(): boolean;
|
|
733
795
|
get visibilityState(): VisibilityState;
|
|
734
796
|
watch(): Observable<VisibilityState>;
|
|
@@ -775,7 +837,7 @@ declare abstract class ConnectionRegistryBaseService<T> extends BrowserApiBaseSe
|
|
|
775
837
|
declare class BroadcastChannelService extends ConnectionRegistryBaseService<BroadcastChannel> {
|
|
776
838
|
protected getApiName(): string;
|
|
777
839
|
protected closeNativeConnection(channel: BroadcastChannel): void;
|
|
778
|
-
|
|
840
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
779
841
|
private ensureBroadcastChannelSupported;
|
|
780
842
|
open<T = unknown>(name: string): Observable<T>;
|
|
781
843
|
post<T = unknown>(name: string, data: T): void;
|
|
@@ -799,7 +861,7 @@ interface NetworkInformation {
|
|
|
799
861
|
}
|
|
800
862
|
declare class NetworkInformationService extends BrowserApiBaseService {
|
|
801
863
|
protected getApiName(): string;
|
|
802
|
-
|
|
864
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
803
865
|
getSnapshot(): NetworkInformation;
|
|
804
866
|
watch(): Observable<NetworkInformation>;
|
|
805
867
|
get isOnline(): boolean;
|
|
@@ -816,7 +878,7 @@ interface WakeLockStatus {
|
|
|
816
878
|
declare class ScreenWakeLockService extends BrowserApiBaseService {
|
|
817
879
|
private sentinel;
|
|
818
880
|
protected getApiName(): string;
|
|
819
|
-
|
|
881
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
820
882
|
get isActive(): boolean;
|
|
821
883
|
request(type?: WakeLockType): Promise<WakeLockStatus>;
|
|
822
884
|
release(): Promise<void>;
|
|
@@ -833,7 +895,7 @@ interface OrientationInfo {
|
|
|
833
895
|
}
|
|
834
896
|
declare class ScreenOrientationService extends BrowserApiBaseService {
|
|
835
897
|
protected getApiName(): string;
|
|
836
|
-
|
|
898
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
837
899
|
getSnapshot(): OrientationInfo;
|
|
838
900
|
get isPortrait(): boolean;
|
|
839
901
|
get isLandscape(): boolean;
|
|
@@ -846,6 +908,8 @@ declare class ScreenOrientationService extends BrowserApiBaseService {
|
|
|
846
908
|
|
|
847
909
|
declare class FullscreenService extends BrowserApiBaseService {
|
|
848
910
|
protected getApiName(): string;
|
|
911
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
912
|
+
/** Override to also check the *enabled* flag (browser may have disabled fullscreen). */
|
|
849
913
|
isSupported(): boolean;
|
|
850
914
|
get isFullscreen(): boolean;
|
|
851
915
|
get fullscreenElement(): Element | null;
|
|
@@ -875,6 +939,8 @@ interface FileSaveOptions {
|
|
|
875
939
|
}
|
|
876
940
|
declare class FileSystemAccessService extends BrowserApiBaseService {
|
|
877
941
|
protected getApiName(): string;
|
|
942
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
943
|
+
/** Override to also assert secure context (required by the spec). */
|
|
878
944
|
isSupported(): boolean;
|
|
879
945
|
private get win();
|
|
880
946
|
protected ensureSupported(): void;
|
|
@@ -912,7 +978,7 @@ declare class MediaRecorderService extends BrowserApiBaseService {
|
|
|
912
978
|
private readonly dataSubject;
|
|
913
979
|
private readonly stateSubject;
|
|
914
980
|
protected getApiName(): string;
|
|
915
|
-
|
|
981
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
916
982
|
get state(): RecordingState;
|
|
917
983
|
static isTypeSupported(mimeType: string): boolean;
|
|
918
984
|
watchState(): Observable<RecordingState>;
|
|
@@ -940,7 +1006,7 @@ interface SSEConfig {
|
|
|
940
1006
|
declare class ServerSentEventsService extends ConnectionRegistryBaseService<EventSource> {
|
|
941
1007
|
protected getApiName(): string;
|
|
942
1008
|
protected closeNativeConnection(source: EventSource): void;
|
|
943
|
-
|
|
1009
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
944
1010
|
private ensureSSESupported;
|
|
945
1011
|
connect<T = unknown>(url: string, config?: SSEConfig): Observable<SSEMessage<T>>;
|
|
946
1012
|
disconnect(url: string): void;
|
|
@@ -961,7 +1027,7 @@ interface VibrationPreset {
|
|
|
961
1027
|
declare class VibrationService extends BrowserApiBaseService {
|
|
962
1028
|
protected getApiName(): string;
|
|
963
1029
|
readonly presets: VibrationPreset;
|
|
964
|
-
|
|
1030
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
965
1031
|
vibrate(pattern?: VibrationPattern): boolean;
|
|
966
1032
|
success(): boolean;
|
|
967
1033
|
error(): boolean;
|
|
@@ -982,7 +1048,7 @@ interface SpeechOptions {
|
|
|
982
1048
|
}
|
|
983
1049
|
declare class SpeechSynthesisService extends BrowserApiBaseService {
|
|
984
1050
|
protected getApiName(): string;
|
|
985
|
-
|
|
1051
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
986
1052
|
private ensureSpeechSynthesisSupported;
|
|
987
1053
|
get state(): SpeechState;
|
|
988
1054
|
get isPending(): boolean;
|
|
@@ -1008,7 +1074,7 @@ interface MutationObserverOptions {
|
|
|
1008
1074
|
|
|
1009
1075
|
declare class MutationObserverService extends BrowserApiBaseService {
|
|
1010
1076
|
protected getApiName(): string;
|
|
1011
|
-
|
|
1077
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
1012
1078
|
observe(target: Node, options?: MutationObserverOptions): Observable<MutationRecord[]>;
|
|
1013
1079
|
static ɵfac: i0.ɵɵFactoryDeclaration<MutationObserverService, never>;
|
|
1014
1080
|
static ɵprov: i0.ɵɵInjectableDeclaration<MutationObserverService>;
|
|
@@ -1023,7 +1089,7 @@ interface PerformanceObserverConfig {
|
|
|
1023
1089
|
|
|
1024
1090
|
declare class PerformanceObserverService extends BrowserApiBaseService {
|
|
1025
1091
|
protected getApiName(): string;
|
|
1026
|
-
|
|
1092
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
1027
1093
|
observe(config: PerformanceObserverConfig): Observable<PerformanceEntryList>;
|
|
1028
1094
|
observeByType(type: PerformanceEntryType, buffered?: boolean): Observable<PerformanceEntryList>;
|
|
1029
1095
|
getSupportedEntryTypes(): PerformanceEntryType[];
|
|
@@ -1039,7 +1105,7 @@ interface AudioAnalyserData {
|
|
|
1039
1105
|
declare class WebAudioService extends BrowserApiBaseService {
|
|
1040
1106
|
protected getApiName(): string;
|
|
1041
1107
|
private context;
|
|
1042
|
-
|
|
1108
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
1043
1109
|
getContext(): AudioContext;
|
|
1044
1110
|
resume(): Promise<void>;
|
|
1045
1111
|
close(): Promise<void>;
|
|
@@ -1068,7 +1134,7 @@ interface GamepadState {
|
|
|
1068
1134
|
|
|
1069
1135
|
declare class GamepadService extends BrowserApiBaseService {
|
|
1070
1136
|
protected getApiName(): string;
|
|
1071
|
-
|
|
1137
|
+
protected getCapabilityId(): BrowserCapabilityId;
|
|
1072
1138
|
getSnapshot(index: number): GamepadState | null;
|
|
1073
1139
|
getConnectedGamepads(): GamepadState[];
|
|
1074
1140
|
watchConnections(): Observable<{
|
|
@@ -1080,6 +1146,102 @@ declare class GamepadService extends BrowserApiBaseService {
|
|
|
1080
1146
|
static ɵprov: i0.ɵɵInjectableDeclaration<GamepadService>;
|
|
1081
1147
|
}
|
|
1082
1148
|
|
|
1149
|
+
interface LockOptionsLike {
|
|
1150
|
+
mode?: 'exclusive' | 'shared';
|
|
1151
|
+
ifAvailable?: boolean;
|
|
1152
|
+
steal?: boolean;
|
|
1153
|
+
signal?: AbortSignal;
|
|
1154
|
+
}
|
|
1155
|
+
interface LockInfoLike {
|
|
1156
|
+
name: string;
|
|
1157
|
+
mode: 'exclusive' | 'shared';
|
|
1158
|
+
clientId: string;
|
|
1159
|
+
}
|
|
1160
|
+
interface LockManagerSnapshot {
|
|
1161
|
+
held: LockInfoLike[];
|
|
1162
|
+
pending: LockInfoLike[];
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Service wrapping `navigator.locks` (Web Locks API). Coordinates exclusive or
|
|
1166
|
+
* shared access to a named resource across tabs and workers.
|
|
1167
|
+
*
|
|
1168
|
+
* ```ts
|
|
1169
|
+
* const locks = inject(WebLocksService);
|
|
1170
|
+
* await locks.acquire('user-cache', async () => {
|
|
1171
|
+
* // critical section — no other tab is in this block at the same time
|
|
1172
|
+
* });
|
|
1173
|
+
* ```
|
|
1174
|
+
*/
|
|
1175
|
+
declare class WebLocksService extends BrowserApiBaseService {
|
|
1176
|
+
protected getApiName(): string;
|
|
1177
|
+
isSupported(): boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* Acquire a lock and run the callback while holding it. The lock is released
|
|
1180
|
+
* automatically when the callback resolves or rejects.
|
|
1181
|
+
*/
|
|
1182
|
+
acquire<T>(name: string, callback: () => Promise<T> | T, options?: LockOptionsLike): Promise<T>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Query the current lock state. Useful for diagnostics and tests; do not gate
|
|
1185
|
+
* critical-section logic on this — it's a snapshot, not a reservation.
|
|
1186
|
+
*/
|
|
1187
|
+
query(): Promise<LockManagerSnapshot>;
|
|
1188
|
+
protected ensureSupported(): void;
|
|
1189
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebLocksService, never>;
|
|
1190
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebLocksService>;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
interface StorageQuotaEstimate {
|
|
1194
|
+
/** Bytes currently used by the origin (best-effort). */
|
|
1195
|
+
usage: number;
|
|
1196
|
+
/** Maximum bytes the origin may use (best-effort). */
|
|
1197
|
+
quota: number;
|
|
1198
|
+
/** Per-storage-type breakdown, when the browser provides it. */
|
|
1199
|
+
usageDetails?: Record<string, number>;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Service wrapping `navigator.storage` (StorageManager API). Exposes:
|
|
1203
|
+
* - `estimate()`: how much origin storage is in use vs available
|
|
1204
|
+
* - `persist()`: ask the browser to make storage persistent (eviction-protected)
|
|
1205
|
+
* - `persisted()`: check whether storage is currently persistent
|
|
1206
|
+
*/
|
|
1207
|
+
declare class StorageManagerService extends BrowserApiBaseService {
|
|
1208
|
+
protected getApiName(): string;
|
|
1209
|
+
isSupported(): boolean;
|
|
1210
|
+
estimate(): Promise<StorageQuotaEstimate>;
|
|
1211
|
+
persist(): Promise<boolean>;
|
|
1212
|
+
persisted(): Promise<boolean>;
|
|
1213
|
+
protected ensureSupported(): void;
|
|
1214
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StorageManagerService, never>;
|
|
1215
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StorageManagerService>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
type CompressionFormat = 'gzip' | 'deflate' | 'deflate-raw';
|
|
1219
|
+
/**
|
|
1220
|
+
* Service wrapping `CompressionStream` and `DecompressionStream`.
|
|
1221
|
+
*
|
|
1222
|
+
* ```ts
|
|
1223
|
+
* const cmp = inject(CompressionService);
|
|
1224
|
+
* const compressed = await cmp.compress(jsonBytes, 'gzip');
|
|
1225
|
+
* const original = await cmp.decompress(compressed, 'gzip');
|
|
1226
|
+
* ```
|
|
1227
|
+
*/
|
|
1228
|
+
declare class CompressionService extends BrowserApiBaseService {
|
|
1229
|
+
protected getApiName(): string;
|
|
1230
|
+
isSupported(): boolean;
|
|
1231
|
+
/** Compress a `Uint8Array`/`ArrayBuffer` using the given format. */
|
|
1232
|
+
compress(data: Uint8Array | ArrayBuffer, format?: CompressionFormat): Promise<Uint8Array>;
|
|
1233
|
+
/** Decompress a `Uint8Array`/`ArrayBuffer` using the given format. */
|
|
1234
|
+
decompress(data: Uint8Array | ArrayBuffer, format?: CompressionFormat): Promise<Uint8Array>;
|
|
1235
|
+
/** Convenience: compress a UTF-8 string and return the compressed bytes. */
|
|
1236
|
+
compressString(value: string, format?: CompressionFormat): Promise<Uint8Array>;
|
|
1237
|
+
/** Convenience: decompress bytes into a UTF-8 string. */
|
|
1238
|
+
decompressString(data: Uint8Array | ArrayBuffer, format?: CompressionFormat): Promise<string>;
|
|
1239
|
+
protected ensureSupported(): void;
|
|
1240
|
+
private runStream;
|
|
1241
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CompressionService, never>;
|
|
1242
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CompressionService>;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1083
1245
|
interface MediaDevice {
|
|
1084
1246
|
deviceId: string;
|
|
1085
1247
|
groupId: string;
|
|
@@ -1153,7 +1315,7 @@ interface GeolocationCoordinates {
|
|
|
1153
1315
|
heading: number | null;
|
|
1154
1316
|
speed: number | null;
|
|
1155
1317
|
}
|
|
1156
|
-
interface GeolocationOptions {
|
|
1318
|
+
interface GeolocationOptions$1 {
|
|
1157
1319
|
enableHighAccuracy?: boolean;
|
|
1158
1320
|
timeout?: number;
|
|
1159
1321
|
maximumAge?: number;
|
|
@@ -1165,7 +1327,7 @@ interface GeolocationError {
|
|
|
1165
1327
|
POSITION_UNAVAILABLE: number;
|
|
1166
1328
|
TIMEOUT: number;
|
|
1167
1329
|
}
|
|
1168
|
-
interface GeolocationWatchOptions extends GeolocationOptions {
|
|
1330
|
+
interface GeolocationWatchOptions extends GeolocationOptions$1 {
|
|
1169
1331
|
maximumAge?: number;
|
|
1170
1332
|
}
|
|
1171
1333
|
|
|
@@ -1237,6 +1399,62 @@ interface GamepadRef {
|
|
|
1237
1399
|
}
|
|
1238
1400
|
declare function injectGamepad(index: number, intervalMs?: number): GamepadRef;
|
|
1239
1401
|
|
|
1402
|
+
interface ClipboardRef {
|
|
1403
|
+
/** Last text successfully read from the clipboard, or `null`. */
|
|
1404
|
+
readonly text: Signal<string | null>;
|
|
1405
|
+
/** Last error message from a read/write attempt, or `null`. */
|
|
1406
|
+
readonly error: Signal<string | null>;
|
|
1407
|
+
/** True when a read/write is in flight. */
|
|
1408
|
+
readonly busy: Signal<boolean>;
|
|
1409
|
+
/** True when the Clipboard API is available in the current environment. */
|
|
1410
|
+
readonly isSupported: Signal<boolean>;
|
|
1411
|
+
writeText(value: string): Promise<boolean>;
|
|
1412
|
+
readText(): Promise<string | null>;
|
|
1413
|
+
}
|
|
1414
|
+
declare function injectClipboard(): ClipboardRef;
|
|
1415
|
+
|
|
1416
|
+
interface GeolocationOptions extends PositionOptions {
|
|
1417
|
+
/** Start watching immediately. Defaults to `false`. */
|
|
1418
|
+
watch?: boolean;
|
|
1419
|
+
}
|
|
1420
|
+
interface GeolocationRef {
|
|
1421
|
+
readonly position: Signal<GeolocationPosition | null>;
|
|
1422
|
+
readonly error: Signal<GeolocationPositionError | null>;
|
|
1423
|
+
readonly watching: Signal<boolean>;
|
|
1424
|
+
readonly isSupported: Signal<boolean>;
|
|
1425
|
+
/** Start watching position. Idempotent — safe to call when already watching. */
|
|
1426
|
+
watch(opts?: PositionOptions): void;
|
|
1427
|
+
/** Stop watching. Idempotent. */
|
|
1428
|
+
stop(): void;
|
|
1429
|
+
/** One-shot read of the current position. */
|
|
1430
|
+
getCurrent(opts?: PositionOptions): Promise<GeolocationPosition>;
|
|
1431
|
+
}
|
|
1432
|
+
declare function injectGeolocation(opts?: GeolocationOptions): GeolocationRef;
|
|
1433
|
+
|
|
1434
|
+
interface BatteryInfo {
|
|
1435
|
+
charging: boolean;
|
|
1436
|
+
level: number;
|
|
1437
|
+
chargingTime: number;
|
|
1438
|
+
dischargingTime: number;
|
|
1439
|
+
}
|
|
1440
|
+
interface BatteryRef {
|
|
1441
|
+
readonly info: Signal<BatteryInfo | null>;
|
|
1442
|
+
readonly error: Signal<string | null>;
|
|
1443
|
+
readonly isSupported: Signal<boolean>;
|
|
1444
|
+
/** Force a one-shot refresh of the battery snapshot. */
|
|
1445
|
+
refresh(): Promise<void>;
|
|
1446
|
+
}
|
|
1447
|
+
declare function injectBattery(): BatteryRef;
|
|
1448
|
+
|
|
1449
|
+
interface WakeLockRef {
|
|
1450
|
+
readonly active: Signal<boolean>;
|
|
1451
|
+
readonly error: Signal<string | null>;
|
|
1452
|
+
readonly isSupported: Signal<boolean>;
|
|
1453
|
+
request(): Promise<boolean>;
|
|
1454
|
+
release(): Promise<void>;
|
|
1455
|
+
}
|
|
1456
|
+
declare function injectWakeLock(): WakeLockRef;
|
|
1457
|
+
|
|
1240
1458
|
declare class BrowserSupportUtil {
|
|
1241
1459
|
static isSupported(feature: string): boolean;
|
|
1242
1460
|
static getUnsupportedFeatures(): string[];
|
|
@@ -1318,6 +1536,12 @@ declare function provideWebAudio(): EnvironmentProviders;
|
|
|
1318
1536
|
|
|
1319
1537
|
declare function provideGamepad(): EnvironmentProviders;
|
|
1320
1538
|
|
|
1539
|
+
declare function provideWebLocks(): EnvironmentProviders;
|
|
1540
|
+
|
|
1541
|
+
declare function provideStorageManager(): EnvironmentProviders;
|
|
1542
|
+
|
|
1543
|
+
declare function provideCompression(): EnvironmentProviders;
|
|
1544
|
+
|
|
1321
1545
|
declare function provideMediaApis(): EnvironmentProviders;
|
|
1322
1546
|
declare function provideLocationApis(): EnvironmentProviders;
|
|
1323
1547
|
declare function provideStorageApis(): EnvironmentProviders;
|
|
@@ -1357,5 +1581,5 @@ declare function provideBrowserWebApis(config?: BrowserWebApisConfig): Environme
|
|
|
1357
1581
|
|
|
1358
1582
|
declare const version = "0.1.0";
|
|
1359
1583
|
|
|
1360
|
-
export { BROWSER_API_LOGGER, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, ConnectionRegistryBaseService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebShareService, WebSocketClient, WebSocketService, WebStorageService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebShare, provideWebSocket, provideWebStorage, provideWebWorker, version };
|
|
1361
|
-
export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ConnectionType, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageNamespace, StorageOptions, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerStatus, WorkerTask };
|
|
1584
|
+
export { BROWSER_API_LOGGER, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, CompressionService, ConnectionRegistryBaseService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, StorageManagerService, VibrationService, WebAudioService, WebLocksService, WebShareService, WebSocketClient, WebSocketService, WebStorageService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectBattery, injectClipboard, injectGamepad, injectGeolocation, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, injectWakeLock, permissionGuard, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCompression, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideStorageManager, provideVibration, provideWebAudio, provideWebLocks, provideWebShare, provideWebSocket, provideWebStorage, provideWebWorker, version };
|
|
1585
|
+
export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BatteryRef, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ClipboardRef, CompressionFormat, ConnectionType, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationRef, GeolocationWatchOptions, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageNamespace, StorageOptions, StorageQuotaEstimate, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockRef, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerRequestOptions, WorkerStatus, WorkerTask };
|