@angular-helpers/browser-web-apis 21.9.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.
|
@@ -56,6 +56,9 @@ const BROWSER_CAPABILITIES = [
|
|
|
56
56
|
{ id: 'webNfc', label: 'Web NFC API', requiresSecureContext: true },
|
|
57
57
|
{ id: 'paymentRequest', label: 'Payment Request API', requiresSecureContext: true },
|
|
58
58
|
{ id: 'credentialManagement', label: 'Credential Management API', requiresSecureContext: true },
|
|
59
|
+
{ id: 'webLocks', label: 'Web Locks API', requiresSecureContext: true },
|
|
60
|
+
{ id: 'storageManager', label: 'Storage Manager API', requiresSecureContext: true },
|
|
61
|
+
{ id: 'compressionStreams', label: 'Compression Streams API', requiresSecureContext: false },
|
|
59
62
|
];
|
|
60
63
|
class BrowserCapabilityService {
|
|
61
64
|
getCapabilities() {
|
|
@@ -140,6 +143,14 @@ class BrowserCapabilityService {
|
|
|
140
143
|
return typeof window !== 'undefined' && 'PaymentRequest' in window;
|
|
141
144
|
case 'credentialManagement':
|
|
142
145
|
return typeof navigator !== 'undefined' && 'credentials' in navigator;
|
|
146
|
+
case 'webLocks':
|
|
147
|
+
return typeof navigator !== 'undefined' && 'locks' in navigator;
|
|
148
|
+
case 'storageManager':
|
|
149
|
+
return (typeof navigator !== 'undefined' &&
|
|
150
|
+
'storage' in navigator &&
|
|
151
|
+
typeof navigator.storage.estimate === 'function');
|
|
152
|
+
case 'compressionStreams':
|
|
153
|
+
return (typeof CompressionStream !== 'undefined' && typeof DecompressionStream !== 'undefined');
|
|
143
154
|
default:
|
|
144
155
|
return false;
|
|
145
156
|
}
|
|
@@ -3087,6 +3098,193 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3087
3098
|
type: Injectable
|
|
3088
3099
|
}] });
|
|
3089
3100
|
|
|
3101
|
+
/**
|
|
3102
|
+
* Service wrapping `navigator.locks` (Web Locks API). Coordinates exclusive or
|
|
3103
|
+
* shared access to a named resource across tabs and workers.
|
|
3104
|
+
*
|
|
3105
|
+
* ```ts
|
|
3106
|
+
* const locks = inject(WebLocksService);
|
|
3107
|
+
* await locks.acquire('user-cache', async () => {
|
|
3108
|
+
* // critical section — no other tab is in this block at the same time
|
|
3109
|
+
* });
|
|
3110
|
+
* ```
|
|
3111
|
+
*/
|
|
3112
|
+
class WebLocksService extends BrowserApiBaseService {
|
|
3113
|
+
getApiName() {
|
|
3114
|
+
return 'web-locks';
|
|
3115
|
+
}
|
|
3116
|
+
isSupported() {
|
|
3117
|
+
if (!this.isBrowserEnvironment())
|
|
3118
|
+
return false;
|
|
3119
|
+
return !!navigator.locks;
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* Acquire a lock and run the callback while holding it. The lock is released
|
|
3123
|
+
* automatically when the callback resolves or rejects.
|
|
3124
|
+
*/
|
|
3125
|
+
acquire(name, callback, options = {}) {
|
|
3126
|
+
this.ensureSupported();
|
|
3127
|
+
const nav = navigator;
|
|
3128
|
+
if (Object.keys(options).length === 0) {
|
|
3129
|
+
return nav.locks.request(name, () => callback());
|
|
3130
|
+
}
|
|
3131
|
+
return nav.locks.request(name, options, () => callback());
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Query the current lock state. Useful for diagnostics and tests; do not gate
|
|
3135
|
+
* critical-section logic on this — it's a snapshot, not a reservation.
|
|
3136
|
+
*/
|
|
3137
|
+
query() {
|
|
3138
|
+
this.ensureSupported();
|
|
3139
|
+
return navigator.locks.query();
|
|
3140
|
+
}
|
|
3141
|
+
ensureSupported() {
|
|
3142
|
+
super.ensureSupported();
|
|
3143
|
+
if (!this.isSupported()) {
|
|
3144
|
+
throw new Error('Web Locks API not supported in this browser');
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebLocksService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
3148
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebLocksService });
|
|
3149
|
+
}
|
|
3150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebLocksService, decorators: [{
|
|
3151
|
+
type: Injectable
|
|
3152
|
+
}] });
|
|
3153
|
+
|
|
3154
|
+
/**
|
|
3155
|
+
* Service wrapping `navigator.storage` (StorageManager API). Exposes:
|
|
3156
|
+
* - `estimate()`: how much origin storage is in use vs available
|
|
3157
|
+
* - `persist()`: ask the browser to make storage persistent (eviction-protected)
|
|
3158
|
+
* - `persisted()`: check whether storage is currently persistent
|
|
3159
|
+
*/
|
|
3160
|
+
class StorageManagerService extends BrowserApiBaseService {
|
|
3161
|
+
getApiName() {
|
|
3162
|
+
return 'storage-manager';
|
|
3163
|
+
}
|
|
3164
|
+
isSupported() {
|
|
3165
|
+
if (!this.isBrowserEnvironment())
|
|
3166
|
+
return false;
|
|
3167
|
+
const sm = navigator.storage;
|
|
3168
|
+
return !!sm && typeof sm.estimate === 'function';
|
|
3169
|
+
}
|
|
3170
|
+
async estimate() {
|
|
3171
|
+
this.ensureSupported();
|
|
3172
|
+
const sm = navigator.storage;
|
|
3173
|
+
const result = await sm.estimate();
|
|
3174
|
+
return {
|
|
3175
|
+
usage: result.usage ?? 0,
|
|
3176
|
+
quota: result.quota ?? 0,
|
|
3177
|
+
usageDetails: result
|
|
3178
|
+
.usageDetails,
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
async persist() {
|
|
3182
|
+
this.ensureSupported();
|
|
3183
|
+
const sm = navigator.storage;
|
|
3184
|
+
if (typeof sm.persist !== 'function')
|
|
3185
|
+
return false;
|
|
3186
|
+
return sm.persist();
|
|
3187
|
+
}
|
|
3188
|
+
async persisted() {
|
|
3189
|
+
this.ensureSupported();
|
|
3190
|
+
const sm = navigator.storage;
|
|
3191
|
+
if (typeof sm.persisted !== 'function')
|
|
3192
|
+
return false;
|
|
3193
|
+
return sm.persisted();
|
|
3194
|
+
}
|
|
3195
|
+
ensureSupported() {
|
|
3196
|
+
super.ensureSupported();
|
|
3197
|
+
if (!this.isSupported()) {
|
|
3198
|
+
throw new Error('StorageManager API not supported in this browser');
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: StorageManagerService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
3202
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: StorageManagerService });
|
|
3203
|
+
}
|
|
3204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: StorageManagerService, decorators: [{
|
|
3205
|
+
type: Injectable
|
|
3206
|
+
}] });
|
|
3207
|
+
|
|
3208
|
+
/**
|
|
3209
|
+
* Service wrapping `CompressionStream` and `DecompressionStream`.
|
|
3210
|
+
*
|
|
3211
|
+
* ```ts
|
|
3212
|
+
* const cmp = inject(CompressionService);
|
|
3213
|
+
* const compressed = await cmp.compress(jsonBytes, 'gzip');
|
|
3214
|
+
* const original = await cmp.decompress(compressed, 'gzip');
|
|
3215
|
+
* ```
|
|
3216
|
+
*/
|
|
3217
|
+
class CompressionService extends BrowserApiBaseService {
|
|
3218
|
+
getApiName() {
|
|
3219
|
+
return 'compression-streams';
|
|
3220
|
+
}
|
|
3221
|
+
isSupported() {
|
|
3222
|
+
if (!this.isBrowserEnvironment())
|
|
3223
|
+
return false;
|
|
3224
|
+
const g = globalThis;
|
|
3225
|
+
return typeof g.CompressionStream === 'function' && typeof g.DecompressionStream === 'function';
|
|
3226
|
+
}
|
|
3227
|
+
/** Compress a `Uint8Array`/`ArrayBuffer` using the given format. */
|
|
3228
|
+
async compress(data, format = 'gzip') {
|
|
3229
|
+
this.ensureSupported();
|
|
3230
|
+
const g = globalThis;
|
|
3231
|
+
const stream = new g.CompressionStream(format);
|
|
3232
|
+
return this.runStream(data, stream);
|
|
3233
|
+
}
|
|
3234
|
+
/** Decompress a `Uint8Array`/`ArrayBuffer` using the given format. */
|
|
3235
|
+
async decompress(data, format = 'gzip') {
|
|
3236
|
+
this.ensureSupported();
|
|
3237
|
+
const g = globalThis;
|
|
3238
|
+
const stream = new g.DecompressionStream(format);
|
|
3239
|
+
return this.runStream(data, stream);
|
|
3240
|
+
}
|
|
3241
|
+
/** Convenience: compress a UTF-8 string and return the compressed bytes. */
|
|
3242
|
+
async compressString(value, format = 'gzip') {
|
|
3243
|
+
return this.compress(new TextEncoder().encode(value), format);
|
|
3244
|
+
}
|
|
3245
|
+
/** Convenience: decompress bytes into a UTF-8 string. */
|
|
3246
|
+
async decompressString(data, format = 'gzip') {
|
|
3247
|
+
const bytes = await this.decompress(data, format);
|
|
3248
|
+
return new TextDecoder().decode(bytes);
|
|
3249
|
+
}
|
|
3250
|
+
ensureSupported() {
|
|
3251
|
+
super.ensureSupported();
|
|
3252
|
+
if (!this.isSupported()) {
|
|
3253
|
+
throw new Error('Compression Streams API not supported in this browser');
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
async runStream(data, stream) {
|
|
3257
|
+
const writer = stream.writable.getWriter();
|
|
3258
|
+
const writePromise = writer.write(data instanceof Uint8Array ? data : new Uint8Array(data));
|
|
3259
|
+
const closePromise = writer.close();
|
|
3260
|
+
const reader = stream.readable.getReader();
|
|
3261
|
+
const chunks = [];
|
|
3262
|
+
let total = 0;
|
|
3263
|
+
while (true) {
|
|
3264
|
+
const { done, value } = await reader.read();
|
|
3265
|
+
if (done)
|
|
3266
|
+
break;
|
|
3267
|
+
const chunk = value;
|
|
3268
|
+
chunks.push(chunk);
|
|
3269
|
+
total += chunk.byteLength;
|
|
3270
|
+
}
|
|
3271
|
+
await writePromise;
|
|
3272
|
+
await closePromise;
|
|
3273
|
+
const result = new Uint8Array(total);
|
|
3274
|
+
let offset = 0;
|
|
3275
|
+
for (const chunk of chunks) {
|
|
3276
|
+
result.set(chunk, offset);
|
|
3277
|
+
offset += chunk.byteLength;
|
|
3278
|
+
}
|
|
3279
|
+
return result;
|
|
3280
|
+
}
|
|
3281
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CompressionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
3282
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CompressionService });
|
|
3283
|
+
}
|
|
3284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CompressionService, decorators: [{
|
|
3285
|
+
type: Injectable
|
|
3286
|
+
}] });
|
|
3287
|
+
|
|
3090
3288
|
// Common types for browser APIs
|
|
3091
3289
|
|
|
3092
3290
|
function injectPageVisibility() {
|
|
@@ -3743,6 +3941,18 @@ function provideGamepad() {
|
|
|
3743
3941
|
return makeEnvironmentProviders([GamepadService]);
|
|
3744
3942
|
}
|
|
3745
3943
|
|
|
3944
|
+
function provideWebLocks() {
|
|
3945
|
+
return makeEnvironmentProviders([WebLocksService]);
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
function provideStorageManager() {
|
|
3949
|
+
return makeEnvironmentProviders([StorageManagerService]);
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
function provideCompression() {
|
|
3953
|
+
return makeEnvironmentProviders([CompressionService]);
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3746
3956
|
function provideMediaApis() {
|
|
3747
3957
|
return makeEnvironmentProviders([PermissionsService, CameraService, MediaDevicesService]);
|
|
3748
3958
|
}
|
|
@@ -3838,4 +4048,4 @@ const version = '0.1.0';
|
|
|
3838
4048
|
* Generated bundle index. Do not edit.
|
|
3839
4049
|
*/
|
|
3840
4050
|
|
|
3841
|
-
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, injectBattery, injectClipboard, injectGamepad, injectGeolocation, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, injectWakeLock, 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 };
|
|
4051
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-helpers/browser-web-apis",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.10.0",
|
|
4
4
|
"description": "Sistema de servicios Angular para acceso formalizado a Browser Web APIs (cámara, permisos, geolocalización, etc.)",
|
|
5
5
|
"homepage": "https://gaspar1992.github.io/angular-helpers/docs/browser-web-apis",
|
|
6
6
|
"repository": {
|
|
@@ -3,7 +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
|
-
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';
|
|
7
7
|
declare class BrowserCapabilityService {
|
|
8
8
|
getCapabilities(): readonly [{
|
|
9
9
|
readonly id: "permissions";
|
|
@@ -153,12 +153,24 @@ declare class BrowserCapabilityService {
|
|
|
153
153
|
readonly id: "credentialManagement";
|
|
154
154
|
readonly label: "Credential Management API";
|
|
155
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;
|
|
156
168
|
}];
|
|
157
169
|
isSecureContext(): boolean;
|
|
158
170
|
isSupported(capability: BrowserCapabilityId): boolean;
|
|
159
171
|
getAllStatuses(): {
|
|
160
|
-
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";
|
|
161
|
-
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";
|
|
162
174
|
supported: boolean;
|
|
163
175
|
secureContext: boolean;
|
|
164
176
|
requiresSecureContext: boolean;
|
|
@@ -1134,6 +1146,102 @@ declare class GamepadService extends BrowserApiBaseService {
|
|
|
1134
1146
|
static ɵprov: i0.ɵɵInjectableDeclaration<GamepadService>;
|
|
1135
1147
|
}
|
|
1136
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
|
+
|
|
1137
1245
|
interface MediaDevice {
|
|
1138
1246
|
deviceId: string;
|
|
1139
1247
|
groupId: string;
|
|
@@ -1428,6 +1536,12 @@ declare function provideWebAudio(): EnvironmentProviders;
|
|
|
1428
1536
|
|
|
1429
1537
|
declare function provideGamepad(): EnvironmentProviders;
|
|
1430
1538
|
|
|
1539
|
+
declare function provideWebLocks(): EnvironmentProviders;
|
|
1540
|
+
|
|
1541
|
+
declare function provideStorageManager(): EnvironmentProviders;
|
|
1542
|
+
|
|
1543
|
+
declare function provideCompression(): EnvironmentProviders;
|
|
1544
|
+
|
|
1431
1545
|
declare function provideMediaApis(): EnvironmentProviders;
|
|
1432
1546
|
declare function provideLocationApis(): EnvironmentProviders;
|
|
1433
1547
|
declare function provideStorageApis(): EnvironmentProviders;
|
|
@@ -1467,5 +1581,5 @@ declare function provideBrowserWebApis(config?: BrowserWebApisConfig): Environme
|
|
|
1467
1581
|
|
|
1468
1582
|
declare const version = "0.1.0";
|
|
1469
1583
|
|
|
1470
|
-
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, injectBattery, injectClipboard, injectGamepad, injectGeolocation, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, injectWakeLock, 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 };
|
|
1471
|
-
export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BatteryRef, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ClipboardRef, 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, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockRef, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerRequestOptions, 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 };
|