@angular-helpers/browser-web-apis 21.3.0 → 21.4.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.
|
@@ -30,48 +30,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
30
30
|
}] });
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Base class for all Browser Web API services
|
|
33
|
+
* Base class for all Browser Web API services.
|
|
34
34
|
* Provides common functionality for:
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
37
|
-
* - Error
|
|
35
|
+
* - Platform detection (browser vs server)
|
|
36
|
+
* - Support assertion via Template Method
|
|
37
|
+
* - Error creation with cause chaining
|
|
38
|
+
* - Structured logging
|
|
38
39
|
* - Lifecycle management with destroyRef
|
|
39
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* Services that also need permission querying should extend
|
|
42
|
+
* `PermissionAwareBrowserApiBaseService` instead.
|
|
40
43
|
*/
|
|
41
44
|
class BrowserApiBaseService {
|
|
42
|
-
permissionsService = inject(PermissionsService);
|
|
43
45
|
destroyRef = inject(DestroyRef);
|
|
44
46
|
platformId = inject(PLATFORM_ID);
|
|
45
47
|
/**
|
|
46
|
-
* Check if running in browser environment using Angular's platform detection
|
|
48
|
+
* Check if running in browser environment using Angular's platform detection.
|
|
47
49
|
*/
|
|
48
50
|
isBrowserEnvironment() {
|
|
49
51
|
return isPlatformBrowser(this.platformId);
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
|
-
* Check if running in server environment using Angular's platform detection
|
|
54
|
+
* Check if running in server environment using Angular's platform detection.
|
|
53
55
|
*/
|
|
54
56
|
isServerEnvironment() {
|
|
55
57
|
return isPlatformServer(this.platformId);
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
|
-
*
|
|
60
|
+
* Template Method: throws a standard error when the API is not available.
|
|
61
|
+
* Uses getApiName() to produce consistent error messages.
|
|
59
62
|
*/
|
|
60
|
-
|
|
61
|
-
if (this.
|
|
63
|
+
ensureSupported() {
|
|
64
|
+
if (!this.isBrowserEnvironment()) {
|
|
62
65
|
throw new Error(`${this.getApiName()} API not available in server environment`);
|
|
63
66
|
}
|
|
64
|
-
try {
|
|
65
|
-
const status = await this.permissionsService.query({ name: permission });
|
|
66
|
-
return status.state === 'granted';
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
console.error(`[${this.getApiName()}] Error requesting permission for ${permission}:`, error);
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
67
|
}
|
|
73
68
|
/**
|
|
74
|
-
* Create an error with proper cause chaining
|
|
69
|
+
* Create an error with proper cause chaining.
|
|
75
70
|
*/
|
|
76
71
|
createError(message, cause) {
|
|
77
72
|
const error = new Error(message);
|
|
@@ -80,6 +75,18 @@ class BrowserApiBaseService {
|
|
|
80
75
|
}
|
|
81
76
|
return error;
|
|
82
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Log an error with the service name as prefix.
|
|
80
|
+
*/
|
|
81
|
+
logError(message, error) {
|
|
82
|
+
console.error(`[${this.getApiName()}] ${message}`, error);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Log an informational message with the service name as prefix.
|
|
86
|
+
*/
|
|
87
|
+
logInfo(message) {
|
|
88
|
+
console.info(`[${this.getApiName()}] ${message}`);
|
|
89
|
+
}
|
|
83
90
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BrowserApiBaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
84
91
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BrowserApiBaseService });
|
|
85
92
|
}
|
|
@@ -87,7 +94,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
87
94
|
type: Injectable
|
|
88
95
|
}] });
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Extension of `BrowserApiBaseService` for services that need to query
|
|
99
|
+
* browser permissions via the Permissions API.
|
|
100
|
+
*
|
|
101
|
+
* Only services that actively call `requestPermission()` should extend this
|
|
102
|
+
* class. All other services should extend `BrowserApiBaseService` directly
|
|
103
|
+
* to avoid carrying an unnecessary PermissionsService dependency.
|
|
104
|
+
*/
|
|
105
|
+
class PermissionAwareBrowserApiBaseService extends BrowserApiBaseService {
|
|
106
|
+
permissionsService = inject(PermissionsService);
|
|
107
|
+
/**
|
|
108
|
+
* Query the Permissions API for the given permission name.
|
|
109
|
+
* Returns `true` if the permission state is `'granted'`.
|
|
110
|
+
*/
|
|
111
|
+
async requestPermission(permission) {
|
|
112
|
+
if (this.isServerEnvironment()) {
|
|
113
|
+
throw new Error(`${this.getApiName()} API not available in server environment`);
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const status = await this.permissionsService.query({ name: permission });
|
|
117
|
+
return status.state === 'granted';
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
this.logError(`Error requesting permission for ${permission}:`, error);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PermissionAwareBrowserApiBaseService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
125
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PermissionAwareBrowserApiBaseService });
|
|
126
|
+
}
|
|
127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PermissionAwareBrowserApiBaseService, decorators: [{
|
|
128
|
+
type: Injectable
|
|
129
|
+
}] });
|
|
130
|
+
|
|
131
|
+
class CameraService extends PermissionAwareBrowserApiBaseService {
|
|
91
132
|
currentStream = null;
|
|
92
133
|
getApiName() {
|
|
93
134
|
return 'camera';
|
|
@@ -218,7 +259,7 @@ class GeolocationService extends BrowserApiBaseService {
|
|
|
218
259
|
this.ensureGeolocationSupport();
|
|
219
260
|
return new Promise((resolve, reject) => {
|
|
220
261
|
navigator.geolocation.getCurrentPosition((position) => resolve(position), (error) => {
|
|
221
|
-
|
|
262
|
+
this.logError('Error getting position:', error);
|
|
222
263
|
reject(error);
|
|
223
264
|
}, options);
|
|
224
265
|
});
|
|
@@ -227,7 +268,7 @@ class GeolocationService extends BrowserApiBaseService {
|
|
|
227
268
|
this.ensureGeolocationSupport();
|
|
228
269
|
return new Observable((observer) => {
|
|
229
270
|
const watchId = navigator.geolocation.watchPosition((position) => observer.next(position), (error) => {
|
|
230
|
-
|
|
271
|
+
this.logError('Error watching position:', error);
|
|
231
272
|
observer.error(error);
|
|
232
273
|
}, options);
|
|
233
274
|
return () => {
|
|
@@ -385,7 +426,7 @@ class NotificationService extends BrowserApiBaseService {
|
|
|
385
426
|
return Notification.permission;
|
|
386
427
|
}
|
|
387
428
|
isSupported() {
|
|
388
|
-
return 'Notification' in window;
|
|
429
|
+
return this.isBrowserEnvironment() && 'Notification' in window;
|
|
389
430
|
}
|
|
390
431
|
async requestNotificationPermission() {
|
|
391
432
|
if (!this.isSupported()) {
|
|
@@ -404,7 +445,7 @@ class NotificationService extends BrowserApiBaseService {
|
|
|
404
445
|
return new Notification(title, options);
|
|
405
446
|
}
|
|
406
447
|
catch (error) {
|
|
407
|
-
|
|
448
|
+
this.logError('Error showing notification:', error);
|
|
408
449
|
throw error;
|
|
409
450
|
}
|
|
410
451
|
}
|
|
@@ -415,7 +456,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
415
456
|
type: Injectable
|
|
416
457
|
}] });
|
|
417
458
|
|
|
418
|
-
class ClipboardService extends
|
|
459
|
+
class ClipboardService extends PermissionAwareBrowserApiBaseService {
|
|
419
460
|
getApiName() {
|
|
420
461
|
return 'clipboard';
|
|
421
462
|
}
|
|
@@ -450,16 +491,6 @@ class ClipboardService extends BrowserApiBaseService {
|
|
|
450
491
|
throw error;
|
|
451
492
|
}
|
|
452
493
|
}
|
|
453
|
-
async writeTextSecure(text) {
|
|
454
|
-
await this.ensureClipboardPermission('write');
|
|
455
|
-
try {
|
|
456
|
-
await navigator.clipboard.writeText(text);
|
|
457
|
-
}
|
|
458
|
-
catch (error) {
|
|
459
|
-
console.error('[ClipboardService] Error writing to clipboard:', error);
|
|
460
|
-
throw error;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
494
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ClipboardService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
464
495
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ClipboardService });
|
|
465
496
|
}
|
|
@@ -640,7 +671,6 @@ class BatteryService extends BrowserApiBaseService {
|
|
|
640
671
|
const nav = navigator;
|
|
641
672
|
this.batteryManager = await nav.getBattery();
|
|
642
673
|
const batteryInfo = this.getBatteryInfo();
|
|
643
|
-
this.setupEventListeners();
|
|
644
674
|
return batteryInfo;
|
|
645
675
|
}
|
|
646
676
|
catch (error) {
|
|
@@ -683,16 +713,6 @@ class BatteryService extends BrowserApiBaseService {
|
|
|
683
713
|
};
|
|
684
714
|
});
|
|
685
715
|
}
|
|
686
|
-
setupEventListeners() {
|
|
687
|
-
if (!this.batteryManager)
|
|
688
|
-
return;
|
|
689
|
-
this.batteryManager.addEventListener('chargingchange', () => {
|
|
690
|
-
console.log('[BatteryService] Charging status changed:', this.batteryManager.charging);
|
|
691
|
-
});
|
|
692
|
-
this.batteryManager.addEventListener('levelchange', () => {
|
|
693
|
-
console.log('[BatteryService] Battery level changed:', this.batteryManager.level);
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
716
|
// Direct access to native battery API
|
|
697
717
|
getNativeBatteryManager() {
|
|
698
718
|
if (!this.batteryManager) {
|
|
@@ -1394,10 +1414,12 @@ function intersectionObserverEntriesStream(element, options = {}) {
|
|
|
1394
1414
|
});
|
|
1395
1415
|
}
|
|
1396
1416
|
|
|
1397
|
-
class IntersectionObserverService {
|
|
1398
|
-
|
|
1417
|
+
class IntersectionObserverService extends BrowserApiBaseService {
|
|
1418
|
+
getApiName() {
|
|
1419
|
+
return 'intersection-observer';
|
|
1420
|
+
}
|
|
1399
1421
|
isSupported() {
|
|
1400
|
-
return
|
|
1422
|
+
return this.isBrowserEnvironment() && 'IntersectionObserver' in window;
|
|
1401
1423
|
}
|
|
1402
1424
|
observe(element, options = {}) {
|
|
1403
1425
|
if (!this.isSupported()) {
|
|
@@ -1411,7 +1433,7 @@ class IntersectionObserverService {
|
|
|
1411
1433
|
}
|
|
1412
1434
|
return intersectionObserverStream(element, options);
|
|
1413
1435
|
}
|
|
1414
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IntersectionObserverService, deps:
|
|
1436
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IntersectionObserverService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1415
1437
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IntersectionObserverService });
|
|
1416
1438
|
}
|
|
1417
1439
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IntersectionObserverService, decorators: [{
|
|
@@ -1452,10 +1474,12 @@ function resizeObserverEntriesStream(element, options = {}) {
|
|
|
1452
1474
|
});
|
|
1453
1475
|
}
|
|
1454
1476
|
|
|
1455
|
-
class ResizeObserverService {
|
|
1456
|
-
|
|
1477
|
+
class ResizeObserverService extends BrowserApiBaseService {
|
|
1478
|
+
getApiName() {
|
|
1479
|
+
return 'resize-observer';
|
|
1480
|
+
}
|
|
1457
1481
|
isSupported() {
|
|
1458
|
-
return
|
|
1482
|
+
return this.isBrowserEnvironment() && 'ResizeObserver' in window;
|
|
1459
1483
|
}
|
|
1460
1484
|
observe(element, options = {}) {
|
|
1461
1485
|
if (!this.isSupported()) {
|
|
@@ -1469,7 +1493,7 @@ class ResizeObserverService {
|
|
|
1469
1493
|
}
|
|
1470
1494
|
return resizeObserverStream(element, options);
|
|
1471
1495
|
}
|
|
1472
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ResizeObserverService, deps:
|
|
1496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ResizeObserverService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1473
1497
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ResizeObserverService });
|
|
1474
1498
|
}
|
|
1475
1499
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ResizeObserverService, decorators: [{
|
|
@@ -1491,10 +1515,12 @@ function pageVisibilityStream() {
|
|
|
1491
1515
|
});
|
|
1492
1516
|
}
|
|
1493
1517
|
|
|
1494
|
-
class PageVisibilityService {
|
|
1495
|
-
|
|
1518
|
+
class PageVisibilityService extends BrowserApiBaseService {
|
|
1519
|
+
getApiName() {
|
|
1520
|
+
return 'page-visibility';
|
|
1521
|
+
}
|
|
1496
1522
|
isSupported() {
|
|
1497
|
-
return
|
|
1523
|
+
return this.isBrowserEnvironment() && 'hidden' in document;
|
|
1498
1524
|
}
|
|
1499
1525
|
get isHidden() {
|
|
1500
1526
|
if (!this.isSupported())
|
|
@@ -1512,32 +1538,79 @@ class PageVisibilityService {
|
|
|
1512
1538
|
watchVisibility() {
|
|
1513
1539
|
return pageVisibilityStream().pipe(map$1((s) => s === 'visible'));
|
|
1514
1540
|
}
|
|
1515
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PageVisibilityService, deps:
|
|
1541
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PageVisibilityService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1516
1542
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PageVisibilityService });
|
|
1517
1543
|
}
|
|
1518
1544
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PageVisibilityService, decorators: [{
|
|
1519
1545
|
type: Injectable
|
|
1520
1546
|
}] });
|
|
1521
1547
|
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* Base class for services that manage a named registry of persistent
|
|
1550
|
+
* connections (e.g. BroadcastChannel, EventSource, WebSocket pools).
|
|
1551
|
+
*
|
|
1552
|
+
* Implements the Template Method pattern: subclasses define how a single
|
|
1553
|
+
* native connection is closed via `closeNativeConnection()`, while this
|
|
1554
|
+
* class handles the Map lifecycle (remove, closeAll, getActiveKeys).
|
|
1555
|
+
*
|
|
1556
|
+
* Public-facing method names (`close`, `disconnect`, `getOpenChannels`, etc.)
|
|
1557
|
+
* remain the responsibility of the concrete service to preserve the public API.
|
|
1558
|
+
*/
|
|
1559
|
+
class ConnectionRegistryBaseService extends BrowserApiBaseService {
|
|
1560
|
+
connections = new Map();
|
|
1561
|
+
/**
|
|
1562
|
+
* Remove and close the connection registered under `key`.
|
|
1563
|
+
* Safe to call even if the key does not exist.
|
|
1564
|
+
*/
|
|
1565
|
+
removeConnection(key) {
|
|
1566
|
+
const connection = this.connections.get(key);
|
|
1567
|
+
if (connection) {
|
|
1568
|
+
this.closeNativeConnection(connection);
|
|
1569
|
+
this.connections.delete(key);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Close all registered connections and clear the registry.
|
|
1574
|
+
*/
|
|
1575
|
+
closeAllConnections() {
|
|
1576
|
+
this.connections.forEach((connection) => this.closeNativeConnection(connection));
|
|
1577
|
+
this.connections.clear();
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Return the keys of all currently open connections.
|
|
1581
|
+
*/
|
|
1582
|
+
getConnectionKeys() {
|
|
1583
|
+
return Array.from(this.connections.keys());
|
|
1584
|
+
}
|
|
1585
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ConnectionRegistryBaseService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1586
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ConnectionRegistryBaseService });
|
|
1587
|
+
}
|
|
1588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ConnectionRegistryBaseService, decorators: [{
|
|
1589
|
+
type: Injectable
|
|
1590
|
+
}] });
|
|
1591
|
+
|
|
1592
|
+
class BroadcastChannelService extends ConnectionRegistryBaseService {
|
|
1593
|
+
getApiName() {
|
|
1594
|
+
return 'broadcast-channel';
|
|
1595
|
+
}
|
|
1596
|
+
closeNativeConnection(channel) {
|
|
1597
|
+
channel.close();
|
|
1598
|
+
}
|
|
1526
1599
|
isSupported() {
|
|
1527
|
-
return
|
|
1600
|
+
return this.isBrowserEnvironment() && 'BroadcastChannel' in window;
|
|
1528
1601
|
}
|
|
1529
|
-
|
|
1602
|
+
ensureBroadcastChannelSupported() {
|
|
1530
1603
|
if (!this.isSupported()) {
|
|
1531
1604
|
throw new Error('BroadcastChannel API not supported in this environment');
|
|
1532
1605
|
}
|
|
1533
1606
|
}
|
|
1534
1607
|
open(name) {
|
|
1535
|
-
this.
|
|
1608
|
+
this.ensureBroadcastChannelSupported();
|
|
1536
1609
|
return new Observable((observer) => {
|
|
1537
|
-
let channel = this.
|
|
1610
|
+
let channel = this.connections.get(name);
|
|
1538
1611
|
if (!channel) {
|
|
1539
1612
|
channel = new BroadcastChannel(name);
|
|
1540
|
-
this.
|
|
1613
|
+
this.connections.set(name, channel);
|
|
1541
1614
|
}
|
|
1542
1615
|
const handler = (event) => observer.next(event.data);
|
|
1543
1616
|
const errorHandler = () => observer.error(new Error(`BroadcastChannel "${name}" error`));
|
|
@@ -1552,30 +1625,25 @@ class BroadcastChannelService {
|
|
|
1552
1625
|
});
|
|
1553
1626
|
}
|
|
1554
1627
|
post(name, data) {
|
|
1555
|
-
this.
|
|
1556
|
-
let channel = this.
|
|
1628
|
+
this.ensureBroadcastChannelSupported();
|
|
1629
|
+
let channel = this.connections.get(name);
|
|
1557
1630
|
if (!channel) {
|
|
1558
1631
|
channel = new BroadcastChannel(name);
|
|
1559
|
-
this.
|
|
1632
|
+
this.connections.set(name, channel);
|
|
1560
1633
|
this.destroyRef.onDestroy(() => this.close(name));
|
|
1561
1634
|
}
|
|
1562
1635
|
channel.postMessage(data);
|
|
1563
1636
|
}
|
|
1564
1637
|
close(name) {
|
|
1565
|
-
|
|
1566
|
-
if (channel) {
|
|
1567
|
-
channel.close();
|
|
1568
|
-
this.channels.delete(name);
|
|
1569
|
-
}
|
|
1638
|
+
this.removeConnection(name);
|
|
1570
1639
|
}
|
|
1571
1640
|
closeAll() {
|
|
1572
|
-
this.
|
|
1573
|
-
this.channels.clear();
|
|
1641
|
+
this.closeAllConnections();
|
|
1574
1642
|
}
|
|
1575
1643
|
getOpenChannels() {
|
|
1576
|
-
return
|
|
1644
|
+
return this.getConnectionKeys();
|
|
1577
1645
|
}
|
|
1578
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BroadcastChannelService, deps:
|
|
1646
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BroadcastChannelService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1579
1647
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BroadcastChannelService });
|
|
1580
1648
|
}
|
|
1581
1649
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BroadcastChannelService, decorators: [{
|
|
@@ -1627,21 +1695,23 @@ function networkInformationStream() {
|
|
|
1627
1695
|
});
|
|
1628
1696
|
}
|
|
1629
1697
|
|
|
1630
|
-
class NetworkInformationService {
|
|
1631
|
-
|
|
1698
|
+
class NetworkInformationService extends BrowserApiBaseService {
|
|
1699
|
+
getApiName() {
|
|
1700
|
+
return 'network-information';
|
|
1701
|
+
}
|
|
1632
1702
|
isSupported() {
|
|
1633
|
-
return
|
|
1703
|
+
return this.isBrowserEnvironment() && isNetworkInformationSupported();
|
|
1634
1704
|
}
|
|
1635
1705
|
getSnapshot() {
|
|
1636
|
-
return
|
|
1706
|
+
return this.isBrowserEnvironment() ? getNetworkSnapshot() : { online: true };
|
|
1637
1707
|
}
|
|
1638
1708
|
watch() {
|
|
1639
1709
|
return networkInformationStream();
|
|
1640
1710
|
}
|
|
1641
1711
|
get isOnline() {
|
|
1642
|
-
return
|
|
1712
|
+
return this.isBrowserEnvironment() ? navigator.onLine : true;
|
|
1643
1713
|
}
|
|
1644
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NetworkInformationService, deps:
|
|
1714
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NetworkInformationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1645
1715
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NetworkInformationService });
|
|
1646
1716
|
}
|
|
1647
1717
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: NetworkInformationService, decorators: [{
|
|
@@ -1744,13 +1814,15 @@ function screenOrientationStream() {
|
|
|
1744
1814
|
});
|
|
1745
1815
|
}
|
|
1746
1816
|
|
|
1747
|
-
class ScreenOrientationService {
|
|
1748
|
-
|
|
1817
|
+
class ScreenOrientationService extends BrowserApiBaseService {
|
|
1818
|
+
getApiName() {
|
|
1819
|
+
return 'screen-orientation';
|
|
1820
|
+
}
|
|
1749
1821
|
isSupported() {
|
|
1750
|
-
return
|
|
1822
|
+
return this.isBrowserEnvironment() && 'screen' in window && 'orientation' in screen;
|
|
1751
1823
|
}
|
|
1752
1824
|
getSnapshot() {
|
|
1753
|
-
return
|
|
1825
|
+
return this.isBrowserEnvironment()
|
|
1754
1826
|
? getOrientationSnapshot()
|
|
1755
1827
|
: { type: 'portrait-primary', angle: 0 };
|
|
1756
1828
|
}
|
|
@@ -1771,7 +1843,7 @@ class ScreenOrientationService {
|
|
|
1771
1843
|
await screen.orientation.lock(orientation);
|
|
1772
1844
|
}
|
|
1773
1845
|
catch (error) {
|
|
1774
|
-
|
|
1846
|
+
this.logError('Failed to lock orientation:', error);
|
|
1775
1847
|
throw error;
|
|
1776
1848
|
}
|
|
1777
1849
|
}
|
|
@@ -1780,30 +1852,31 @@ class ScreenOrientationService {
|
|
|
1780
1852
|
screen.orientation.unlock();
|
|
1781
1853
|
}
|
|
1782
1854
|
}
|
|
1783
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ScreenOrientationService, deps:
|
|
1855
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ScreenOrientationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1784
1856
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ScreenOrientationService });
|
|
1785
1857
|
}
|
|
1786
1858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ScreenOrientationService, decorators: [{
|
|
1787
1859
|
type: Injectable
|
|
1788
1860
|
}] });
|
|
1789
1861
|
|
|
1790
|
-
class FullscreenService {
|
|
1791
|
-
|
|
1792
|
-
|
|
1862
|
+
class FullscreenService extends BrowserApiBaseService {
|
|
1863
|
+
getApiName() {
|
|
1864
|
+
return 'fullscreen';
|
|
1865
|
+
}
|
|
1793
1866
|
isSupported() {
|
|
1794
|
-
if (!
|
|
1867
|
+
if (!this.isBrowserEnvironment())
|
|
1795
1868
|
return false;
|
|
1796
1869
|
return !!(document.fullscreenEnabled ??
|
|
1797
1870
|
document.webkitFullscreenEnabled);
|
|
1798
1871
|
}
|
|
1799
1872
|
get isFullscreen() {
|
|
1800
|
-
if (!
|
|
1873
|
+
if (!this.isBrowserEnvironment())
|
|
1801
1874
|
return false;
|
|
1802
1875
|
return !!(document.fullscreenElement ??
|
|
1803
1876
|
document.webkitFullscreenElement);
|
|
1804
1877
|
}
|
|
1805
1878
|
get fullscreenElement() {
|
|
1806
|
-
if (!
|
|
1879
|
+
if (!this.isBrowserEnvironment())
|
|
1807
1880
|
return null;
|
|
1808
1881
|
return (document.fullscreenElement ??
|
|
1809
1882
|
document.webkitFullscreenElement ??
|
|
@@ -1823,7 +1896,7 @@ class FullscreenService {
|
|
|
1823
1896
|
}
|
|
1824
1897
|
}
|
|
1825
1898
|
catch (error) {
|
|
1826
|
-
|
|
1899
|
+
this.logError('Failed to enter fullscreen:', error);
|
|
1827
1900
|
throw error;
|
|
1828
1901
|
}
|
|
1829
1902
|
}
|
|
@@ -1840,7 +1913,7 @@ class FullscreenService {
|
|
|
1840
1913
|
}
|
|
1841
1914
|
}
|
|
1842
1915
|
catch (error) {
|
|
1843
|
-
|
|
1916
|
+
this.logError('Failed to exit fullscreen:', error);
|
|
1844
1917
|
throw error;
|
|
1845
1918
|
}
|
|
1846
1919
|
}
|
|
@@ -1854,7 +1927,7 @@ class FullscreenService {
|
|
|
1854
1927
|
}
|
|
1855
1928
|
watch() {
|
|
1856
1929
|
return new Observable((observer) => {
|
|
1857
|
-
if (!
|
|
1930
|
+
if (!this.isBrowserEnvironment()) {
|
|
1858
1931
|
observer.next(false);
|
|
1859
1932
|
observer.complete();
|
|
1860
1933
|
return undefined;
|
|
@@ -1871,7 +1944,7 @@ class FullscreenService {
|
|
|
1871
1944
|
return cleanup;
|
|
1872
1945
|
});
|
|
1873
1946
|
}
|
|
1874
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FullscreenService, deps:
|
|
1947
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FullscreenService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1875
1948
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FullscreenService });
|
|
1876
1949
|
}
|
|
1877
1950
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FullscreenService, decorators: [{
|
|
@@ -2054,23 +2127,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2054
2127
|
type: Injectable
|
|
2055
2128
|
}] });
|
|
2056
2129
|
|
|
2057
|
-
class ServerSentEventsService {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2130
|
+
class ServerSentEventsService extends ConnectionRegistryBaseService {
|
|
2131
|
+
getApiName() {
|
|
2132
|
+
return 'server-sent-events';
|
|
2133
|
+
}
|
|
2134
|
+
closeNativeConnection(source) {
|
|
2135
|
+
source.close();
|
|
2136
|
+
}
|
|
2061
2137
|
isSupported() {
|
|
2062
|
-
return
|
|
2138
|
+
return this.isBrowserEnvironment() && 'EventSource' in window;
|
|
2063
2139
|
}
|
|
2064
|
-
|
|
2140
|
+
ensureSSESupported() {
|
|
2065
2141
|
if (!this.isSupported()) {
|
|
2066
2142
|
throw new Error('Server-Sent Events (EventSource) not supported in this environment');
|
|
2067
2143
|
}
|
|
2068
2144
|
}
|
|
2069
2145
|
connect(url, config = {}) {
|
|
2070
|
-
this.
|
|
2146
|
+
this.ensureSSESupported();
|
|
2071
2147
|
return new Observable((observer) => {
|
|
2072
2148
|
const source = new EventSource(url, { withCredentials: config.withCredentials ?? false });
|
|
2073
|
-
this.
|
|
2149
|
+
this.connections.set(url, source);
|
|
2074
2150
|
const messageHandler = (event) => {
|
|
2075
2151
|
try {
|
|
2076
2152
|
observer.next({
|
|
@@ -2094,7 +2170,7 @@ class ServerSentEventsService {
|
|
|
2094
2170
|
observer.error(new Error('SSE connection closed unexpectedly'));
|
|
2095
2171
|
}
|
|
2096
2172
|
else {
|
|
2097
|
-
console.warn(
|
|
2173
|
+
console.warn(`[${this.getApiName()}] SSE connection error, reconnecting...`, event);
|
|
2098
2174
|
}
|
|
2099
2175
|
};
|
|
2100
2176
|
source.addEventListener('message', messageHandler);
|
|
@@ -2112,35 +2188,32 @@ class ServerSentEventsService {
|
|
|
2112
2188
|
});
|
|
2113
2189
|
}
|
|
2114
2190
|
disconnect(url) {
|
|
2115
|
-
|
|
2116
|
-
if (source) {
|
|
2117
|
-
source.close();
|
|
2118
|
-
this.sources.delete(url);
|
|
2119
|
-
}
|
|
2191
|
+
this.removeConnection(url);
|
|
2120
2192
|
}
|
|
2121
2193
|
disconnectAll() {
|
|
2122
|
-
this.
|
|
2123
|
-
this.sources.clear();
|
|
2194
|
+
this.closeAllConnections();
|
|
2124
2195
|
}
|
|
2125
2196
|
getState(url) {
|
|
2126
|
-
const source = this.
|
|
2197
|
+
const source = this.connections.get(url);
|
|
2127
2198
|
if (!source)
|
|
2128
2199
|
return 'closed';
|
|
2129
2200
|
const states = ['connecting', 'open', 'closed'];
|
|
2130
2201
|
return states[source.readyState] ?? 'closed';
|
|
2131
2202
|
}
|
|
2132
2203
|
getActiveConnections() {
|
|
2133
|
-
return
|
|
2204
|
+
return this.getConnectionKeys();
|
|
2134
2205
|
}
|
|
2135
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ServerSentEventsService, deps:
|
|
2206
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ServerSentEventsService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2136
2207
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ServerSentEventsService });
|
|
2137
2208
|
}
|
|
2138
2209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ServerSentEventsService, decorators: [{
|
|
2139
2210
|
type: Injectable
|
|
2140
2211
|
}] });
|
|
2141
2212
|
|
|
2142
|
-
class VibrationService {
|
|
2143
|
-
|
|
2213
|
+
class VibrationService extends BrowserApiBaseService {
|
|
2214
|
+
getApiName() {
|
|
2215
|
+
return 'vibration';
|
|
2216
|
+
}
|
|
2144
2217
|
presets = {
|
|
2145
2218
|
success: [50, 30, 50],
|
|
2146
2219
|
error: [100, 50, 100, 50, 100],
|
|
@@ -2148,7 +2221,7 @@ class VibrationService {
|
|
|
2148
2221
|
doubleTap: [50, 100, 50],
|
|
2149
2222
|
};
|
|
2150
2223
|
isSupported() {
|
|
2151
|
-
return
|
|
2224
|
+
return this.isBrowserEnvironment() && 'vibrate' in navigator;
|
|
2152
2225
|
}
|
|
2153
2226
|
vibrate(pattern = 200) {
|
|
2154
2227
|
if (!this.isSupported())
|
|
@@ -2170,20 +2243,21 @@ class VibrationService {
|
|
|
2170
2243
|
stop() {
|
|
2171
2244
|
return this.vibrate(0);
|
|
2172
2245
|
}
|
|
2173
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: VibrationService, deps:
|
|
2246
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: VibrationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2174
2247
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: VibrationService });
|
|
2175
2248
|
}
|
|
2176
2249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: VibrationService, decorators: [{
|
|
2177
2250
|
type: Injectable
|
|
2178
2251
|
}] });
|
|
2179
2252
|
|
|
2180
|
-
class SpeechSynthesisService {
|
|
2181
|
-
|
|
2182
|
-
|
|
2253
|
+
class SpeechSynthesisService extends BrowserApiBaseService {
|
|
2254
|
+
getApiName() {
|
|
2255
|
+
return 'speech-synthesis';
|
|
2256
|
+
}
|
|
2183
2257
|
isSupported() {
|
|
2184
|
-
return
|
|
2258
|
+
return this.isBrowserEnvironment() && 'speechSynthesis' in window;
|
|
2185
2259
|
}
|
|
2186
|
-
|
|
2260
|
+
ensureSpeechSynthesisSupported() {
|
|
2187
2261
|
if (!this.isSupported()) {
|
|
2188
2262
|
throw new Error('Speech Synthesis API not supported in this browser');
|
|
2189
2263
|
}
|
|
@@ -2222,7 +2296,7 @@ class SpeechSynthesisService {
|
|
|
2222
2296
|
}
|
|
2223
2297
|
speak(text, options = {}) {
|
|
2224
2298
|
return new Observable((observer) => {
|
|
2225
|
-
this.
|
|
2299
|
+
this.ensureSpeechSynthesisSupported();
|
|
2226
2300
|
const utterance = new SpeechSynthesisUtterance(text);
|
|
2227
2301
|
if (options.lang)
|
|
2228
2302
|
utterance.lang = options.lang;
|
|
@@ -2266,7 +2340,7 @@ class SpeechSynthesisService {
|
|
|
2266
2340
|
if (this.isSupported())
|
|
2267
2341
|
speechSynthesis.cancel();
|
|
2268
2342
|
}
|
|
2269
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SpeechSynthesisService, deps:
|
|
2343
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SpeechSynthesisService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2270
2344
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SpeechSynthesisService });
|
|
2271
2345
|
}
|
|
2272
2346
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SpeechSynthesisService, decorators: [{
|
|
@@ -2292,10 +2366,12 @@ function mutationObserverStream(element, options = DEFAULT_OPTIONS) {
|
|
|
2292
2366
|
});
|
|
2293
2367
|
}
|
|
2294
2368
|
|
|
2295
|
-
class MutationObserverService {
|
|
2296
|
-
|
|
2369
|
+
class MutationObserverService extends BrowserApiBaseService {
|
|
2370
|
+
getApiName() {
|
|
2371
|
+
return 'mutation-observer';
|
|
2372
|
+
}
|
|
2297
2373
|
isSupported() {
|
|
2298
|
-
return
|
|
2374
|
+
return this.isBrowserEnvironment() && isMutationObserverSupported();
|
|
2299
2375
|
}
|
|
2300
2376
|
observe(target, options) {
|
|
2301
2377
|
if (!this.isSupported()) {
|
|
@@ -2303,7 +2379,7 @@ class MutationObserverService {
|
|
|
2303
2379
|
}
|
|
2304
2380
|
return mutationObserverStream(target, options);
|
|
2305
2381
|
}
|
|
2306
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: MutationObserverService, deps:
|
|
2382
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: MutationObserverService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2307
2383
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: MutationObserverService });
|
|
2308
2384
|
}
|
|
2309
2385
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: MutationObserverService, decorators: [{
|
|
@@ -2328,10 +2404,12 @@ function performanceObserverStream(config) {
|
|
|
2328
2404
|
});
|
|
2329
2405
|
}
|
|
2330
2406
|
|
|
2331
|
-
class PerformanceObserverService {
|
|
2332
|
-
|
|
2407
|
+
class PerformanceObserverService extends BrowserApiBaseService {
|
|
2408
|
+
getApiName() {
|
|
2409
|
+
return 'performance-observer';
|
|
2410
|
+
}
|
|
2333
2411
|
isSupported() {
|
|
2334
|
-
return
|
|
2412
|
+
return this.isBrowserEnvironment() && isPerformanceObserverSupported();
|
|
2335
2413
|
}
|
|
2336
2414
|
observe(config) {
|
|
2337
2415
|
if (!this.isSupported()) {
|
|
@@ -2347,7 +2425,7 @@ class PerformanceObserverService {
|
|
|
2347
2425
|
return [];
|
|
2348
2426
|
return (PerformanceObserver.supportedEntryTypes ?? []);
|
|
2349
2427
|
}
|
|
2350
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PerformanceObserverService, deps:
|
|
2428
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PerformanceObserverService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2351
2429
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PerformanceObserverService });
|
|
2352
2430
|
}
|
|
2353
2431
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PerformanceObserverService, decorators: [{
|
|
@@ -2357,10 +2435,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2357
2435
|
function getIdleDetectorClass$1() {
|
|
2358
2436
|
return window.IdleDetector;
|
|
2359
2437
|
}
|
|
2360
|
-
class IdleDetectorService {
|
|
2361
|
-
|
|
2438
|
+
class IdleDetectorService extends BrowserApiBaseService {
|
|
2439
|
+
getApiName() {
|
|
2440
|
+
return 'idle-detector';
|
|
2441
|
+
}
|
|
2362
2442
|
isSupported() {
|
|
2363
|
-
return
|
|
2443
|
+
return this.isBrowserEnvironment() && 'IdleDetector' in window;
|
|
2364
2444
|
}
|
|
2365
2445
|
async requestPermission() {
|
|
2366
2446
|
if (!this.isSupported()) {
|
|
@@ -2390,7 +2470,7 @@ class IdleDetectorService {
|
|
|
2390
2470
|
return () => abortController.abort();
|
|
2391
2471
|
});
|
|
2392
2472
|
}
|
|
2393
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IdleDetectorService, deps:
|
|
2473
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IdleDetectorService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2394
2474
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IdleDetectorService });
|
|
2395
2475
|
}
|
|
2396
2476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: IdleDetectorService, decorators: [{
|
|
@@ -2400,10 +2480,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2400
2480
|
function getEyeDropperClass() {
|
|
2401
2481
|
return window.EyeDropper;
|
|
2402
2482
|
}
|
|
2403
|
-
class EyeDropperService {
|
|
2404
|
-
|
|
2483
|
+
class EyeDropperService extends BrowserApiBaseService {
|
|
2484
|
+
getApiName() {
|
|
2485
|
+
return 'eye-dropper';
|
|
2486
|
+
}
|
|
2405
2487
|
isSupported() {
|
|
2406
|
-
return
|
|
2488
|
+
return this.isBrowserEnvironment() && 'EyeDropper' in window;
|
|
2407
2489
|
}
|
|
2408
2490
|
async open(signal) {
|
|
2409
2491
|
if (!this.isSupported()) {
|
|
@@ -2412,7 +2494,7 @@ class EyeDropperService {
|
|
|
2412
2494
|
const dropper = new (getEyeDropperClass())();
|
|
2413
2495
|
return dropper.open(signal ? { signal } : undefined);
|
|
2414
2496
|
}
|
|
2415
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: EyeDropperService, deps:
|
|
2497
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: EyeDropperService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2416
2498
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: EyeDropperService });
|
|
2417
2499
|
}
|
|
2418
2500
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: EyeDropperService, decorators: [{
|
|
@@ -2422,10 +2504,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2422
2504
|
function getBarcodeDetectorClass() {
|
|
2423
2505
|
return window.BarcodeDetector;
|
|
2424
2506
|
}
|
|
2425
|
-
class BarcodeDetectorService {
|
|
2426
|
-
|
|
2507
|
+
class BarcodeDetectorService extends BrowserApiBaseService {
|
|
2508
|
+
getApiName() {
|
|
2509
|
+
return 'barcode-detector';
|
|
2510
|
+
}
|
|
2427
2511
|
isSupported() {
|
|
2428
|
-
return
|
|
2512
|
+
return this.isBrowserEnvironment() && 'BarcodeDetector' in window;
|
|
2429
2513
|
}
|
|
2430
2514
|
async getSupportedFormats() {
|
|
2431
2515
|
if (!this.isSupported())
|
|
@@ -2441,19 +2525,20 @@ class BarcodeDetectorService {
|
|
|
2441
2525
|
: new (getBarcodeDetectorClass())();
|
|
2442
2526
|
return detector.detect(image);
|
|
2443
2527
|
}
|
|
2444
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BarcodeDetectorService, deps:
|
|
2528
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BarcodeDetectorService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2445
2529
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BarcodeDetectorService });
|
|
2446
2530
|
}
|
|
2447
2531
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: BarcodeDetectorService, decorators: [{
|
|
2448
2532
|
type: Injectable
|
|
2449
2533
|
}] });
|
|
2450
2534
|
|
|
2451
|
-
class WebAudioService {
|
|
2452
|
-
|
|
2453
|
-
|
|
2535
|
+
class WebAudioService extends BrowserApiBaseService {
|
|
2536
|
+
getApiName() {
|
|
2537
|
+
return 'web-audio';
|
|
2538
|
+
}
|
|
2454
2539
|
context = null;
|
|
2455
2540
|
isSupported() {
|
|
2456
|
-
return
|
|
2541
|
+
return this.isBrowserEnvironment() && 'AudioContext' in window;
|
|
2457
2542
|
}
|
|
2458
2543
|
getContext() {
|
|
2459
2544
|
if (!this.isSupported()) {
|
|
@@ -2527,7 +2612,7 @@ class WebAudioService {
|
|
|
2527
2612
|
source.start(0);
|
|
2528
2613
|
return source;
|
|
2529
2614
|
}
|
|
2530
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebAudioService, deps:
|
|
2615
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebAudioService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2531
2616
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebAudioService });
|
|
2532
2617
|
}
|
|
2533
2618
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebAudioService, decorators: [{
|
|
@@ -2610,10 +2695,12 @@ function gamepadPollStream(index, intervalMs = 16) {
|
|
|
2610
2695
|
});
|
|
2611
2696
|
}
|
|
2612
2697
|
|
|
2613
|
-
class GamepadService {
|
|
2614
|
-
|
|
2698
|
+
class GamepadService extends BrowserApiBaseService {
|
|
2699
|
+
getApiName() {
|
|
2700
|
+
return 'gamepad';
|
|
2701
|
+
}
|
|
2615
2702
|
isSupported() {
|
|
2616
|
-
return
|
|
2703
|
+
return this.isBrowserEnvironment() && isGamepadSupported();
|
|
2617
2704
|
}
|
|
2618
2705
|
getSnapshot(index) {
|
|
2619
2706
|
if (!this.isSupported())
|
|
@@ -2647,7 +2734,7 @@ class GamepadService {
|
|
|
2647
2734
|
}
|
|
2648
2735
|
return gamepadPollStream(index, intervalMs);
|
|
2649
2736
|
}
|
|
2650
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: GamepadService, deps:
|
|
2737
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: GamepadService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2651
2738
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: GamepadService });
|
|
2652
2739
|
}
|
|
2653
2740
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: GamepadService, decorators: [{
|
|
@@ -2657,10 +2744,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2657
2744
|
function getBluetooth() {
|
|
2658
2745
|
return navigator.bluetooth;
|
|
2659
2746
|
}
|
|
2660
|
-
class WebBluetoothService {
|
|
2661
|
-
|
|
2747
|
+
class WebBluetoothService extends BrowserApiBaseService {
|
|
2748
|
+
getApiName() {
|
|
2749
|
+
return 'web-bluetooth';
|
|
2750
|
+
}
|
|
2662
2751
|
isSupported() {
|
|
2663
|
-
return
|
|
2752
|
+
return this.isBrowserEnvironment() && !!getBluetooth();
|
|
2664
2753
|
}
|
|
2665
2754
|
async requestDevice(options = { acceptAllDevices: true }) {
|
|
2666
2755
|
if (!this.isSupported()) {
|
|
@@ -2716,7 +2805,7 @@ class WebBluetoothService {
|
|
|
2716
2805
|
};
|
|
2717
2806
|
});
|
|
2718
2807
|
}
|
|
2719
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebBluetoothService, deps:
|
|
2808
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebBluetoothService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2720
2809
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebBluetoothService });
|
|
2721
2810
|
}
|
|
2722
2811
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebBluetoothService, decorators: [{
|
|
@@ -2726,10 +2815,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2726
2815
|
function getUsb() {
|
|
2727
2816
|
return navigator.usb;
|
|
2728
2817
|
}
|
|
2729
|
-
class WebUsbService {
|
|
2730
|
-
|
|
2818
|
+
class WebUsbService extends BrowserApiBaseService {
|
|
2819
|
+
getApiName() {
|
|
2820
|
+
return 'web-usb';
|
|
2821
|
+
}
|
|
2731
2822
|
isSupported() {
|
|
2732
|
-
return
|
|
2823
|
+
return this.isBrowserEnvironment() && !!getUsb();
|
|
2733
2824
|
}
|
|
2734
2825
|
async requestDevice(filters = []) {
|
|
2735
2826
|
if (!this.isSupported()) {
|
|
@@ -2789,7 +2880,7 @@ class WebUsbService {
|
|
|
2789
2880
|
opened: device.opened,
|
|
2790
2881
|
};
|
|
2791
2882
|
}
|
|
2792
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebUsbService, deps:
|
|
2883
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebUsbService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2793
2884
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebUsbService });
|
|
2794
2885
|
}
|
|
2795
2886
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebUsbService, decorators: [{
|
|
@@ -2799,10 +2890,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2799
2890
|
function getNdefReaderClass() {
|
|
2800
2891
|
return window.NDEFReader;
|
|
2801
2892
|
}
|
|
2802
|
-
class WebNfcService {
|
|
2803
|
-
|
|
2893
|
+
class WebNfcService extends BrowserApiBaseService {
|
|
2894
|
+
getApiName() {
|
|
2895
|
+
return 'web-nfc';
|
|
2896
|
+
}
|
|
2804
2897
|
isSupported() {
|
|
2805
|
-
return
|
|
2898
|
+
return this.isBrowserEnvironment() && 'NDEFReader' in window;
|
|
2806
2899
|
}
|
|
2807
2900
|
scan() {
|
|
2808
2901
|
if (!this.isSupported()) {
|
|
@@ -2836,17 +2929,19 @@ class WebNfcService {
|
|
|
2836
2929
|
const reader = new (getNdefReaderClass())();
|
|
2837
2930
|
await reader.write(message, options);
|
|
2838
2931
|
}
|
|
2839
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebNfcService, deps:
|
|
2932
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebNfcService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2840
2933
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebNfcService });
|
|
2841
2934
|
}
|
|
2842
2935
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: WebNfcService, decorators: [{
|
|
2843
2936
|
type: Injectable
|
|
2844
2937
|
}] });
|
|
2845
2938
|
|
|
2846
|
-
class PaymentRequestService {
|
|
2847
|
-
|
|
2939
|
+
class PaymentRequestService extends BrowserApiBaseService {
|
|
2940
|
+
getApiName() {
|
|
2941
|
+
return 'payment-request';
|
|
2942
|
+
}
|
|
2848
2943
|
isSupported() {
|
|
2849
|
-
return
|
|
2944
|
+
return this.isBrowserEnvironment() && 'PaymentRequest' in window;
|
|
2850
2945
|
}
|
|
2851
2946
|
async canMakePayment(methods, details) {
|
|
2852
2947
|
if (!this.isSupported())
|
|
@@ -2876,17 +2971,19 @@ class PaymentRequestService {
|
|
|
2876
2971
|
const request = new PaymentRequest(methods, details);
|
|
2877
2972
|
await request.abort();
|
|
2878
2973
|
}
|
|
2879
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PaymentRequestService, deps:
|
|
2974
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PaymentRequestService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2880
2975
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PaymentRequestService });
|
|
2881
2976
|
}
|
|
2882
2977
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PaymentRequestService, decorators: [{
|
|
2883
2978
|
type: Injectable
|
|
2884
2979
|
}] });
|
|
2885
2980
|
|
|
2886
|
-
class CredentialManagementService {
|
|
2887
|
-
|
|
2981
|
+
class CredentialManagementService extends BrowserApiBaseService {
|
|
2982
|
+
getApiName() {
|
|
2983
|
+
return 'credential-management';
|
|
2984
|
+
}
|
|
2888
2985
|
isSupported() {
|
|
2889
|
-
return
|
|
2986
|
+
return this.isBrowserEnvironment() && 'credentials' in navigator;
|
|
2890
2987
|
}
|
|
2891
2988
|
isPublicKeySupported() {
|
|
2892
2989
|
return this.isSupported() && 'PublicKeyCredential' in window;
|
|
@@ -2932,7 +3029,7 @@ class CredentialManagementService {
|
|
|
2932
3029
|
}
|
|
2933
3030
|
return false;
|
|
2934
3031
|
}
|
|
2935
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CredentialManagementService, deps:
|
|
3032
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CredentialManagementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
2936
3033
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CredentialManagementService });
|
|
2937
3034
|
}
|
|
2938
3035
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CredentialManagementService, decorators: [{
|
|
@@ -3488,4 +3585,4 @@ const version = '0.1.0';
|
|
|
3488
3585
|
* Generated bundle index. Do not edit.
|
|
3489
3586
|
*/
|
|
3490
3587
|
|
|
3491
|
-
export { BarcodeDetectorService, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, CredentialManagementService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PaymentRequestService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebBluetoothService, WebNfcService, WebShareService, WebSocketService, WebStorageService, WebUsbService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBarcodeDetector, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCredentialManagement, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePaymentRequest, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebBluetooth, provideWebNfc, provideWebShare, provideWebSocket, provideWebStorage, provideWebUsb, provideWebWorker, version };
|
|
3588
|
+
export { BarcodeDetectorService, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, ConnectionRegistryBaseService, CredentialManagementService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PaymentRequestService, PerformanceObserverService, PermissionAwareBrowserApiBaseService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebBluetoothService, WebNfcService, WebShareService, WebSocketService, WebStorageService, WebUsbService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBarcodeDetector, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCredentialManagement, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePaymentRequest, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebBluetooth, provideWebNfc, provideWebShare, provideWebSocket, provideWebStorage, provideWebUsb, provideWebWorker, version };
|