@camera.ui/browser 0.0.168 → 0.0.170
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/dist/index.d.ts +5 -5
- package/dist/index.js +31 -16
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1238,7 +1238,7 @@ export declare interface TerminalSessionInfo {
|
|
|
1238
1238
|
|
|
1239
1239
|
export declare function useAllSensors(): UseSensorsReturn;
|
|
1240
1240
|
|
|
1241
|
-
export declare function useAudioSensor(camera: CameraIdentifier): UseSensorTypedReturn<ReactiveAudioSensor>;
|
|
1241
|
+
export declare function useAudioSensor(camera: CameraIdentifier, preferredPluginId?: MaybeRefOrGetter<string | undefined>): UseSensorTypedReturn<ReactiveAudioSensor>;
|
|
1242
1242
|
|
|
1243
1243
|
export declare function useCameraById(cameraIdOrName: MaybeRefOrGetter<string>): UseCameraByIdReturn;
|
|
1244
1244
|
|
|
@@ -1290,11 +1290,11 @@ export declare interface UseCuiFullscreenReturn {
|
|
|
1290
1290
|
|
|
1291
1291
|
export declare function useDeviceManager(): ReactiveDeviceManager;
|
|
1292
1292
|
|
|
1293
|
-
export declare function useFaceSensor(camera: CameraIdentifier): UseSensorTypedReturn<ReactiveFaceSensor>;
|
|
1293
|
+
export declare function useFaceSensor(camera: CameraIdentifier, preferredPluginId?: MaybeRefOrGetter<string | undefined>): UseSensorTypedReturn<ReactiveFaceSensor>;
|
|
1294
1294
|
|
|
1295
|
-
export declare function useLicensePlateSensor(camera: CameraIdentifier): UseSensorTypedReturn<ReactiveLicensePlateSensor>;
|
|
1295
|
+
export declare function useLicensePlateSensor(camera: CameraIdentifier, preferredPluginId?: MaybeRefOrGetter<string | undefined>): UseSensorTypedReturn<ReactiveLicensePlateSensor>;
|
|
1296
1296
|
|
|
1297
|
-
export declare function useMotionSensor(camera: CameraIdentifier): UseSensorTypedReturn<ReactiveMotionSensor>;
|
|
1297
|
+
export declare function useMotionSensor(camera: CameraIdentifier, preferredPluginId?: MaybeRefOrGetter<string | undefined>): UseSensorTypedReturn<ReactiveMotionSensor>;
|
|
1298
1298
|
|
|
1299
1299
|
export declare function useOAuth(pluginName: string): UseOAuthReturn;
|
|
1300
1300
|
|
|
@@ -1308,7 +1308,7 @@ export declare interface UseOAuthReturn {
|
|
|
1308
1308
|
refresh(): Promise<void>;
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
|
-
export declare function useObjectSensor(camera: CameraIdentifier): UseSensorTypedReturn<ReactiveObjectSensor>;
|
|
1311
|
+
export declare function useObjectSensor(camera: CameraIdentifier, preferredPluginId?: MaybeRefOrGetter<string | undefined>): UseSensorTypedReturn<ReactiveObjectSensor>;
|
|
1312
1312
|
|
|
1313
1313
|
export declare function usePlugin(pluginName: MaybeRefOrGetter<string>): UsePluginReturn;
|
|
1314
1314
|
|
package/dist/index.js
CHANGED
|
@@ -1561,7 +1561,15 @@ function useAllSensors() {
|
|
|
1561
1561
|
error
|
|
1562
1562
|
};
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1564
|
+
function pickSensorOfType(sensors, sensorType, preferredPluginId) {
|
|
1565
|
+
const typed = sensors.filter((sensor) => sensor.type === sensorType);
|
|
1566
|
+
if (preferredPluginId) {
|
|
1567
|
+
const preferred = typed.find((sensor) => sensor.pluginId === preferredPluginId);
|
|
1568
|
+
if (preferred) return preferred;
|
|
1569
|
+
}
|
|
1570
|
+
return typed[0];
|
|
1571
|
+
}
|
|
1572
|
+
function useTypedSensor(camera, sensorType, preferredPluginId) {
|
|
1565
1573
|
const cameraUi = useCameraUi();
|
|
1566
1574
|
const { isConnected } = cameraUi;
|
|
1567
1575
|
const sensor = shallowRef();
|
|
@@ -1570,11 +1578,15 @@ function useTypedSensor(camera, sensorType) {
|
|
|
1570
1578
|
const initialLoadDone = ref(false);
|
|
1571
1579
|
const error = ref();
|
|
1572
1580
|
const state = createSensorComposableState();
|
|
1573
|
-
watch([
|
|
1581
|
+
watch([
|
|
1582
|
+
isConnected,
|
|
1583
|
+
() => extractCameraId(toValue(camera)),
|
|
1584
|
+
() => toValue(preferredPluginId)
|
|
1585
|
+
], async ([connected, camId, preferred]) => {
|
|
1574
1586
|
if (connected && camId) {
|
|
1575
1587
|
const manager = await ensureSensorManager(state, cameraUi, connected, _isLoading, error);
|
|
1576
1588
|
cachedManager.value = manager;
|
|
1577
|
-
sensor.value = manager ? sensorsForCamera(manager, camId)
|
|
1589
|
+
sensor.value = manager ? pickSensorOfType(sensorsForCamera(manager, camId), sensorType, preferred) : void 0;
|
|
1578
1590
|
initialLoadDone.value = true;
|
|
1579
1591
|
} else {
|
|
1580
1592
|
cleanupSensorComposable(state);
|
|
@@ -1585,11 +1597,11 @@ function useTypedSensor(camera, sensorType) {
|
|
|
1585
1597
|
if (!cachedManager.value) return void 0;
|
|
1586
1598
|
const camId = extractCameraId(toValue(camera));
|
|
1587
1599
|
if (!camId) return void 0;
|
|
1588
|
-
return sensorsForCamera(cachedManager.value, camId)
|
|
1600
|
+
return pickSensorOfType(sensorsForCamera(cachedManager.value, camId), sensorType, toValue(preferredPluginId))?.id;
|
|
1589
1601
|
}, () => {
|
|
1590
1602
|
if (cachedManager.value) {
|
|
1591
1603
|
const camId = extractCameraId(toValue(camera));
|
|
1592
|
-
sensor.value = camId ? sensorsForCamera(cachedManager.value, camId)
|
|
1604
|
+
sensor.value = camId ? pickSensorOfType(sensorsForCamera(cachedManager.value, camId), sensorType, toValue(preferredPluginId)) : void 0;
|
|
1593
1605
|
}
|
|
1594
1606
|
});
|
|
1595
1607
|
tryOnScopeDispose(() => {
|
|
@@ -1602,20 +1614,20 @@ function useTypedSensor(camera, sensorType) {
|
|
|
1602
1614
|
error
|
|
1603
1615
|
};
|
|
1604
1616
|
}
|
|
1605
|
-
function useMotionSensor(camera) {
|
|
1606
|
-
return useTypedSensor(camera, SensorType.Motion);
|
|
1617
|
+
function useMotionSensor(camera, preferredPluginId) {
|
|
1618
|
+
return useTypedSensor(camera, SensorType.Motion, preferredPluginId);
|
|
1607
1619
|
}
|
|
1608
|
-
function useObjectSensor(camera) {
|
|
1609
|
-
return useTypedSensor(camera, SensorType.Object);
|
|
1620
|
+
function useObjectSensor(camera, preferredPluginId) {
|
|
1621
|
+
return useTypedSensor(camera, SensorType.Object, preferredPluginId);
|
|
1610
1622
|
}
|
|
1611
|
-
function useFaceSensor(camera) {
|
|
1612
|
-
return useTypedSensor(camera, SensorType.Face);
|
|
1623
|
+
function useFaceSensor(camera, preferredPluginId) {
|
|
1624
|
+
return useTypedSensor(camera, SensorType.Face, preferredPluginId);
|
|
1613
1625
|
}
|
|
1614
|
-
function useLicensePlateSensor(camera) {
|
|
1615
|
-
return useTypedSensor(camera, SensorType.LicensePlate);
|
|
1626
|
+
function useLicensePlateSensor(camera, preferredPluginId) {
|
|
1627
|
+
return useTypedSensor(camera, SensorType.LicensePlate, preferredPluginId);
|
|
1616
1628
|
}
|
|
1617
|
-
function useAudioSensor(camera) {
|
|
1618
|
-
return useTypedSensor(camera, SensorType.Audio);
|
|
1629
|
+
function useAudioSensor(camera, preferredPluginId) {
|
|
1630
|
+
return useTypedSensor(camera, SensorType.Audio, preferredPluginId);
|
|
1619
1631
|
}
|
|
1620
1632
|
function usePTZControl(camera) {
|
|
1621
1633
|
return useTypedSensor(camera, SensorType.PTZ);
|
|
@@ -2081,6 +2093,7 @@ function makeContextFromTransport(input) {
|
|
|
2081
2093
|
let hasBeenConnected = natsTransport.getClient() !== null;
|
|
2082
2094
|
let lastClient = natsTransport.getClient();
|
|
2083
2095
|
let downTimer = null;
|
|
2096
|
+
let sawDrop = false;
|
|
2084
2097
|
const rpc = shallowRef(natsTransport.getClient() ?? void 0);
|
|
2085
2098
|
const isConnected = ref(natsTransport.getClient()?.isConnected ?? false);
|
|
2086
2099
|
const error = ref(void 0);
|
|
@@ -2128,8 +2141,10 @@ function makeContextFromTransport(input) {
|
|
|
2128
2141
|
refreshClientSubscriptions();
|
|
2129
2142
|
if (hasBeenConnected) emit("reconnected");
|
|
2130
2143
|
hasBeenConnected = true;
|
|
2131
|
-
}
|
|
2144
|
+
} else if (sawDrop && hasBeenConnected) emit("reconnected");
|
|
2145
|
+
sawDrop = false;
|
|
2132
2146
|
} else {
|
|
2147
|
+
sawDrop = true;
|
|
2133
2148
|
rpc.value = void 0;
|
|
2134
2149
|
if (downTimer !== null || !isConnected.value) return;
|
|
2135
2150
|
downTimer = setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.170",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@camera.ui/logger": "file:../../packages/logger",
|
|
41
|
-
"@camera.ui/rpc": "^1.0.
|
|
42
|
-
"@camera.ui/sdk": "~1.2.
|
|
41
|
+
"@camera.ui/rpc": "^1.0.11",
|
|
42
|
+
"@camera.ui/sdk": "~1.2.28",
|
|
43
43
|
"@camera.ui/transport": "file:../../packages/transport",
|
|
44
44
|
"@eneris/push-receiver": "^4.3.1",
|
|
45
45
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
50
50
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
51
51
|
"@vue/eslint-config-typescript": "^14.9.0",
|
|
52
|
-
"@vue/language-core": "^3.3.
|
|
52
|
+
"@vue/language-core": "^3.3.10",
|
|
53
53
|
"@vue/tsconfig": "^0.9.1",
|
|
54
54
|
"@vueuse/core": "^14.4.0",
|
|
55
55
|
"@webgpu/types": "^0.1.71",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"typescript": "5.9.3",
|
|
62
62
|
"typescript-eslint": "^8.67.0",
|
|
63
63
|
"unplugin-dts": "^1.0.3",
|
|
64
|
-
"updates": "^18.0.
|
|
64
|
+
"updates": "^18.0.1",
|
|
65
65
|
"vite": "^8.2.1",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"vue": "^3.5.41",
|
|
68
|
-
"vue-tsc": "^3.3.
|
|
68
|
+
"vue-tsc": "^3.3.10"
|
|
69
69
|
},
|
|
70
70
|
"overrides": {
|
|
71
71
|
"@vue/language-core": "$@vue/language-core"
|