@angular-helpers/browser-web-apis 21.3.0 → 21.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +68 -4
- package/README.md +64 -5
- package/fesm2022/angular-helpers-browser-web-apis.mjs +618 -477
- package/package.json +10 -2
- package/types/angular-helpers-browser-web-apis.d.ts +235 -145
package/README.es.md
CHANGED
|
@@ -8,12 +8,13 @@ Paquete de servicios Angular para acceder de forma estructurada y segura a Brows
|
|
|
8
8
|
|
|
9
9
|
## Caracteristicas
|
|
10
10
|
|
|
11
|
-
- Seguridad integrada con prevencion de ReDoS usando Web Workers
|
|
12
11
|
- Acceso unificado a APIs del navegador mediante servicios tipados
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- **Tree-shaking real** — cada `provideX()` vive en su propio modulo e importa solo lo que necesita
|
|
13
|
+
- `provideBrowserWebApis()` para configuracion rapida cuando el tamano del bundle no es critico
|
|
15
14
|
- APIs reactivas con signals y observables
|
|
16
|
-
- Integracion segura con el ciclo de vida
|
|
15
|
+
- Integracion segura con el ciclo de vida via `DestroyRef` (cleanup automatico)
|
|
16
|
+
- Logging y manejo de errores centralizado en `BrowserApiBaseService`
|
|
17
|
+
- Validacion de contexto seguro y deteccion de soporte del navegador incorporados
|
|
17
18
|
|
|
18
19
|
## Servicios disponibles
|
|
19
20
|
|
|
@@ -29,6 +30,8 @@ Paquete de servicios Angular para acceder de forma estructurada y segura a Brows
|
|
|
29
30
|
|
|
30
31
|
- `IntersectionObserverService` - Detectar cuando elementos entran/salen del viewport
|
|
31
32
|
- `ResizeObserverService` - Observar cambios de tamano de elementos
|
|
33
|
+
- `MutationObserverService` - Observar mutaciones en el DOM
|
|
34
|
+
- `PerformanceObserverService` - Monitorear entradas de rendimiento (LCP, CLS, etc.)
|
|
32
35
|
|
|
33
36
|
### APIs de sistema
|
|
34
37
|
|
|
@@ -39,6 +42,9 @@ Paquete de servicios Angular para acceder de forma estructurada y segura a Brows
|
|
|
39
42
|
- `FullscreenService` - Alternar modo pantalla completa para elementos
|
|
40
43
|
- `VibrationService` - Activar patrones de retroalimentacion tactil
|
|
41
44
|
- `SpeechSynthesisService` - Texto a voz con seleccion de voz
|
|
45
|
+
- `IdleDetectorService` - Detectar estado idle del usuario y bloqueo de pantalla
|
|
46
|
+
- `GamepadService` - Polling de entrada de controladores de juego
|
|
47
|
+
- `WebAudioService` - Contexto de audio, osciladores y analizadores
|
|
42
48
|
|
|
43
49
|
### APIs de red
|
|
44
50
|
|
|
@@ -75,6 +81,8 @@ npm install @angular-helpers/browser-web-apis
|
|
|
75
81
|
|
|
76
82
|
## Configuracion rapida
|
|
77
83
|
|
|
84
|
+
### Todo en uno (sin preocupacion por el bundle)
|
|
85
|
+
|
|
78
86
|
```typescript
|
|
79
87
|
import { provideBrowserWebApis } from '@angular-helpers/browser-web-apis';
|
|
80
88
|
|
|
@@ -89,6 +97,62 @@ bootstrapApplication(AppComponent, {
|
|
|
89
97
|
});
|
|
90
98
|
```
|
|
91
99
|
|
|
100
|
+
### Configuracion granular (recomendada para produccion)
|
|
101
|
+
|
|
102
|
+
Cada `provideX()` vive en su propio modulo e importa solo su servicio. Los bundlers (webpack, Rollup, Vite) eliminan todo lo que no uses.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import {
|
|
106
|
+
provideCamera,
|
|
107
|
+
provideGeolocation,
|
|
108
|
+
provideWebStorage,
|
|
109
|
+
} from '@angular-helpers/browser-web-apis';
|
|
110
|
+
|
|
111
|
+
bootstrapApplication(AppComponent, {
|
|
112
|
+
providers: [
|
|
113
|
+
provideCamera(), // → solo CameraService + PermissionsService
|
|
114
|
+
provideGeolocation(), // → solo GeolocationService + PermissionsService
|
|
115
|
+
provideWebStorage(), // → solo WebStorageService
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Cada servicio tiene su propio `provideX()`:
|
|
121
|
+
|
|
122
|
+
| Funcion | Servicios incluidos |
|
|
123
|
+
| ------------------------------- | ------------------------------------------- |
|
|
124
|
+
| `provideCamera()` | `PermissionsService`, `CameraService` |
|
|
125
|
+
| `provideGeolocation()` | `PermissionsService`, `GeolocationService` |
|
|
126
|
+
| `provideNotifications()` | `PermissionsService`, `NotificationService` |
|
|
127
|
+
| `provideClipboard()` | `PermissionsService`, `ClipboardService` |
|
|
128
|
+
| `provideMediaDevices()` | `PermissionsService`, `MediaDevicesService` |
|
|
129
|
+
| `provideWebStorage()` | `WebStorageService` |
|
|
130
|
+
| `provideWebSocket()` | `WebSocketService` |
|
|
131
|
+
| `provideWebWorker()` | `WebWorkerService` |
|
|
132
|
+
| `provideBattery()` | `BatteryService` |
|
|
133
|
+
| `provideIntersectionObserver()` | `IntersectionObserverService` |
|
|
134
|
+
| `provideResizeObserver()` | `ResizeObserverService` |
|
|
135
|
+
| `provideMutationObserver()` | `MutationObserverService` |
|
|
136
|
+
| `providePerformanceObserver()` | `PerformanceObserverService` |
|
|
137
|
+
| `providePageVisibility()` | `PageVisibilityService` |
|
|
138
|
+
| `provideNetworkInformation()` | `NetworkInformationService` |
|
|
139
|
+
| …y 22 mas | Ver `src/providers/` |
|
|
140
|
+
|
|
141
|
+
### Providers combinados
|
|
142
|
+
|
|
143
|
+
Funciones de conveniencia que agrupan servicios relacionados:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { provideMediaApis, provideStorageApis } from '@angular-helpers/browser-web-apis';
|
|
147
|
+
|
|
148
|
+
bootstrapApplication(AppComponent, {
|
|
149
|
+
providers: [
|
|
150
|
+
provideMediaApis(), // Camera + MediaDevices + Permissions
|
|
151
|
+
provideStorageApis(), // Clipboard + WebStorage + Permissions
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
92
156
|
## Uso por servicio
|
|
93
157
|
|
|
94
158
|
### CameraService
|
package/README.md
CHANGED
|
@@ -8,12 +8,13 @@ Angular services package for a structured and secure access layer over browser W
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- Integrated security with ReDoS prevention using Web Workers
|
|
12
11
|
- Unified browser API access through strongly typed services
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- Reactive APIs
|
|
16
|
-
- Lifecycle-safe integration with `
|
|
12
|
+
- **True tree-shaking** — individual `provideX()` functions import only their own service
|
|
13
|
+
- All-in-one `provideBrowserWebApis()` for quick setup when bundle size is not a concern
|
|
14
|
+
- Reactive APIs using signals and observables
|
|
15
|
+
- Lifecycle-safe integration with `DestroyRef` (automatic cleanup)
|
|
16
|
+
- Centralized logging and error handling via `BrowserApiBaseService`
|
|
17
|
+
- Secure context validation and browser support detection built in
|
|
17
18
|
|
|
18
19
|
## Available Services
|
|
19
20
|
|
|
@@ -96,6 +97,8 @@ npm install @angular-helpers/browser-web-apis
|
|
|
96
97
|
|
|
97
98
|
## Quick Setup
|
|
98
99
|
|
|
100
|
+
### All-in-one (zero bundle budget concern)
|
|
101
|
+
|
|
99
102
|
```typescript
|
|
100
103
|
import { provideBrowserWebApis } from '@angular-helpers/browser-web-apis';
|
|
101
104
|
|
|
@@ -110,6 +113,62 @@ bootstrapApplication(AppComponent, {
|
|
|
110
113
|
});
|
|
111
114
|
```
|
|
112
115
|
|
|
116
|
+
### Granular setup (recommended for production)
|
|
117
|
+
|
|
118
|
+
Each `provideX()` lives in its own module and imports only the service it needs. Bundlers (webpack, Rollup, Vite) will tree-shake anything you don't include.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import {
|
|
122
|
+
provideCamera,
|
|
123
|
+
provideGeolocation,
|
|
124
|
+
provideWebStorage,
|
|
125
|
+
} from '@angular-helpers/browser-web-apis';
|
|
126
|
+
|
|
127
|
+
bootstrapApplication(AppComponent, {
|
|
128
|
+
providers: [
|
|
129
|
+
provideCamera(), // → only CameraService + PermissionsService
|
|
130
|
+
provideGeolocation(), // → only GeolocationService + PermissionsService
|
|
131
|
+
provideWebStorage(), // → only WebStorageService
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Every service has a matching `provideX()` function:
|
|
137
|
+
|
|
138
|
+
| Function | Services included |
|
|
139
|
+
| ------------------------------- | ------------------------------------------- |
|
|
140
|
+
| `provideCamera()` | `PermissionsService`, `CameraService` |
|
|
141
|
+
| `provideGeolocation()` | `PermissionsService`, `GeolocationService` |
|
|
142
|
+
| `provideNotifications()` | `PermissionsService`, `NotificationService` |
|
|
143
|
+
| `provideClipboard()` | `PermissionsService`, `ClipboardService` |
|
|
144
|
+
| `provideMediaDevices()` | `PermissionsService`, `MediaDevicesService` |
|
|
145
|
+
| `provideWebStorage()` | `WebStorageService` |
|
|
146
|
+
| `provideWebSocket()` | `WebSocketService` |
|
|
147
|
+
| `provideWebWorker()` | `WebWorkerService` |
|
|
148
|
+
| `provideBattery()` | `BatteryService` |
|
|
149
|
+
| `provideIntersectionObserver()` | `IntersectionObserverService` |
|
|
150
|
+
| `provideResizeObserver()` | `ResizeObserverService` |
|
|
151
|
+
| `provideMutationObserver()` | `MutationObserverService` |
|
|
152
|
+
| `providePerformanceObserver()` | `PerformanceObserverService` |
|
|
153
|
+
| `providePageVisibility()` | `PageVisibilityService` |
|
|
154
|
+
| `provideNetworkInformation()` | `NetworkInformationService` |
|
|
155
|
+
| …and 22 more | See `src/providers/` |
|
|
156
|
+
|
|
157
|
+
### Combo providers
|
|
158
|
+
|
|
159
|
+
Convenience functions that bundle related services:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { provideMediaApis, provideStorageApis } from '@angular-helpers/browser-web-apis';
|
|
163
|
+
|
|
164
|
+
bootstrapApplication(AppComponent, {
|
|
165
|
+
providers: [
|
|
166
|
+
provideMediaApis(), // Camera + MediaDevices + Permissions
|
|
167
|
+
provideStorageApis(), // Clipboard + WebStorage + Permissions
|
|
168
|
+
],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
113
172
|
## Usage by Service
|
|
114
173
|
|
|
115
174
|
### CameraService
|