@angular-helpers/browser-web-apis 21.11.0 → 21.12.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-helpers/browser-web-apis",
3
- "version": "21.11.0",
3
+ "version": "21.12.1",
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": {
@@ -49,7 +49,8 @@
49
49
  "default": "./fesm2022/angular-helpers-browser-web-apis-experimental.mjs"
50
50
  }
51
51
  },
52
+ "type": "module",
52
53
  "dependencies": {
53
54
  "tslib": "^2.3.0"
54
55
  }
55
- }
56
+ }
@@ -890,6 +890,7 @@ interface WakeLockStatus {
890
890
  }
891
891
  declare class ScreenWakeLockService extends BrowserApiBaseService {
892
892
  private sentinel;
893
+ private releaseRegistered;
893
894
  protected getApiName(): string;
894
895
  protected getCapabilityId(): BrowserCapabilityId;
895
896
  get isActive(): boolean;
@@ -1118,6 +1119,7 @@ interface AudioAnalyserData {
1118
1119
  declare class WebAudioService extends BrowserApiBaseService {
1119
1120
  protected getApiName(): string;
1120
1121
  private context;
1122
+ private destroyRegistered;
1121
1123
  protected getCapabilityId(): BrowserCapabilityId;
1122
1124
  getContext(): AudioContext;
1123
1125
  resume(): Promise<void>;
@@ -1159,6 +1161,59 @@ declare class GamepadService extends BrowserApiBaseService {
1159
1161
  static ɵprov: i0.ɵɵInjectableDeclaration<GamepadService>;
1160
1162
  }
1161
1163
 
1164
+ interface EyeDropperResult {
1165
+ sRGBHex: string;
1166
+ }
1167
+ declare class EyeDropperService extends BrowserApiBaseService {
1168
+ protected getApiName(): string;
1169
+ protected getCapabilityId(): BrowserCapabilityId;
1170
+ /** Override to also assert secure context (required by the spec). */
1171
+ isSupported(): boolean;
1172
+ protected ensureSupported(): void;
1173
+ /**
1174
+ * Opens the system eye dropper tool and returns the selected color.
1175
+ *
1176
+ * @param options Optional configuration including an AbortSignal to cancel the dropper.
1177
+ * @returns A promise that resolves with the selected color in sRGB Hex format (e.g., "#000000").
1178
+ * @throws DOMException if the user cancels the selection (AbortError).
1179
+ */
1180
+ open(options?: {
1181
+ signal?: AbortSignal;
1182
+ }): Promise<EyeDropperResult>;
1183
+ static ɵfac: i0.ɵɵFactoryDeclaration<EyeDropperService, never>;
1184
+ static ɵprov: i0.ɵɵInjectableDeclaration<EyeDropperService>;
1185
+ }
1186
+
1187
+ type UserIdleState = 'active' | 'idle';
1188
+ type ScreenIdleState = 'locked' | 'unlocked';
1189
+ interface IdleState {
1190
+ userState: UserIdleState | null;
1191
+ screenState: ScreenIdleState | null;
1192
+ }
1193
+ interface IdleDetectorOptions {
1194
+ /** The minimum number of milliseconds of inactivity before the user is considered idle. Must be at least 60000. */
1195
+ threshold: number;
1196
+ /** An AbortSignal to abort the idle detection. */
1197
+ signal?: AbortSignal;
1198
+ }
1199
+ declare class IdleDetectorService extends BrowserApiBaseService {
1200
+ protected getApiName(): string;
1201
+ protected getCapabilityId(): BrowserCapabilityId;
1202
+ isSupported(): boolean;
1203
+ protected ensureSupported(): void;
1204
+ requestPermission(): Promise<PermissionState>;
1205
+ /**
1206
+ * Starts tracking idle state. Emits the current state and subsequent changes.
1207
+ * Note: You must call requestPermission() and be granted access before starting.
1208
+ *
1209
+ * @param options Configuration for the idle detector, including the threshold (minimum 60000ms).
1210
+ * @returns An Observable of the IdleState.
1211
+ */
1212
+ watch(options: IdleDetectorOptions): Observable<IdleState>;
1213
+ static ɵfac: i0.ɵɵFactoryDeclaration<IdleDetectorService, never>;
1214
+ static ɵprov: i0.ɵɵInjectableDeclaration<IdleDetectorService>;
1215
+ }
1216
+
1162
1217
  interface LockOptionsLike {
1163
1218
  mode?: 'exclusive' | 'shared';
1164
1219
  ifAvailable?: boolean;
@@ -1486,6 +1541,29 @@ interface WakeLockRef {
1486
1541
  }
1487
1542
  declare function injectWakeLock(): WakeLockRef;
1488
1543
 
1544
+ interface EyeDropperRef {
1545
+ readonly isSupported: Signal<boolean>;
1546
+ readonly color: Signal<string | null>;
1547
+ readonly error: Signal<Error | null>;
1548
+ readonly isOpening: Signal<boolean>;
1549
+ open(options?: {
1550
+ signal?: AbortSignal;
1551
+ }): Promise<EyeDropperResult | null>;
1552
+ }
1553
+ declare function injectEyeDropper(): EyeDropperRef;
1554
+
1555
+ interface IdleDetectorRef {
1556
+ readonly isSupported: Signal<boolean>;
1557
+ readonly state: Signal<IdleState | null>;
1558
+ readonly error: Signal<Error | null>;
1559
+ readonly isTracking: Signal<boolean>;
1560
+ readonly isIdle: Signal<boolean>;
1561
+ start(options: IdleDetectorOptions): Promise<void>;
1562
+ stop(): void;
1563
+ requestPermission(): Promise<PermissionState>;
1564
+ }
1565
+ declare function injectIdleDetector(): IdleDetectorRef;
1566
+
1489
1567
  declare class BrowserSupportUtil {
1490
1568
  static isSupported(feature: string): boolean;
1491
1569
  static getUnsupportedFeatures(): string[];
@@ -1573,6 +1651,10 @@ declare function provideStorageManager(): EnvironmentProviders;
1573
1651
 
1574
1652
  declare function provideCompression(): EnvironmentProviders;
1575
1653
 
1654
+ declare function provideEyeDropper(): EnvironmentProviders;
1655
+
1656
+ declare function provideIdleDetector(): EnvironmentProviders;
1657
+
1576
1658
  declare function provideMediaApis(): EnvironmentProviders;
1577
1659
  declare function provideLocationApis(): EnvironmentProviders;
1578
1660
  declare function provideStorageApis(): EnvironmentProviders;
@@ -1619,11 +1701,13 @@ interface BrowserWebApisConfig extends BrowserWebApisCompositionConfig {
1619
1701
  enablePerformanceObserver?: boolean;
1620
1702
  enableWebAudio?: boolean;
1621
1703
  enableGamepad?: boolean;
1704
+ enableEyeDropper?: boolean;
1705
+ enableIdleDetector?: boolean;
1622
1706
  }
1623
1707
  declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
1624
1708
  declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
1625
1709
 
1626
1710
  declare const version = "0.1.0";
1627
1711
 
1628
- export { BROWSER_API_EXPERIMENTAL_SILENT, BROWSER_API_LOGGER, BROWSER_API_LOG_LEVEL, 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, provideBrowserApiLogLevel, 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, warnExperimental };
1629
- export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BatteryRef, BrowserApiLogLevel, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisCompositionConfig, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ClipboardRef, CompressionFormat, ConnectionType, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, ExperimentalWarnContext, 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 };
1712
+ export { BROWSER_API_EXPERIMENTAL_SILENT, BROWSER_API_LOGGER, BROWSER_API_LOG_LEVEL, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, CompressionService, ConnectionRegistryBaseService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, 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, injectEyeDropper, injectGamepad, injectGeolocation, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, injectWakeLock, permissionGuard, provideBattery, provideBroadcastChannel, provideBrowserApiLogLevel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCompression, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, 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, warnExperimental };
1713
+ export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BatteryRef, BrowserApiLogLevel, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisCompositionConfig, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ClipboardRef, CompressionFormat, ConnectionType, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, ExperimentalWarnContext, EyeDropperRef, EyeDropperResult, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationRef, GeolocationWatchOptions, IdleDetectorOptions, IdleDetectorRef, IdleState, 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, ScreenIdleState, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageNamespace, StorageOptions, StorageQuotaEstimate, StorageValue, UserIdleState, VibrationPattern, VibrationPreset, VisibilityState, WakeLockRef, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerRequestOptions, WorkerStatus, WorkerTask };