@camstack/ui-library 0.1.52 → 0.1.53

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.
@@ -0,0 +1,5 @@
1
+ interface AutotrackSectionProps {
2
+ readonly deviceId: number;
3
+ }
4
+ export declare function AutotrackSection({ deviceId }: AutotrackSectionProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { MotionZoneOptions } from '@camstack/types';
2
+ export interface MotionGridCanvasProps {
3
+ /** Fixed lattice dimensions — from the cap's `getOptions`. */
4
+ readonly options: MotionZoneOptions;
5
+ /** Row-major active-cell grid, length === gridWidth*gridHeight. */
6
+ readonly cells: readonly boolean[];
7
+ readonly onCellsChange: (next: boolean[]) => void;
8
+ }
9
+ export declare function MotionGridCanvas({ options, cells, onCellsChange }: MotionGridCanvasProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { CapSettingsComponentProps } from './index';
2
+ export declare function MotionZonesSettings({ deviceId }: CapSettingsComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { CapSettingsComponentProps } from './index';
2
+ export declare function PtzPanel({ deviceId }: CapSettingsComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ export { PtzPanel } from './PtzPanel';
2
+ export { AutotrackSection } from './AutotrackSection';
3
+ export { MotionZonesSettings } from './MotionZonesSettings';
4
+ /**
5
+ * Props every cap-settings component receives.
6
+ *
7
+ * Components are resolved by `componentId` through the admin-ui
8
+ * `UI_COMPONENTS` registry (the cap-name-keyed `CAP_SETTINGS_COMPONENTS`
9
+ * registry has been retired). This shape mirrors the admin-ui
10
+ * `UiComponentProps` contract.
11
+ */
12
+ export interface CapSettingsComponentProps {
13
+ readonly deviceId: number;
14
+ }
@@ -108,3 +108,5 @@ export { WidgetSlot } from './widget-slot';
108
108
  export type { WidgetSlotProps } from './widget-slot';
109
109
  export { ScopePicker, validateScopes } from './scope-picker';
110
110
  export type { ScopeAccess } from './scope-picker';
111
+ export { PtzPanel, AutotrackSection, MotionZonesSettings } from './cap-settings';
112
+ export type { CapSettingsComponentProps } from './cap-settings';
@@ -1,30 +1,26 @@
1
1
  import { LiveBuffer } from '../hooks/use-live-buffer';
2
- interface StateChangeEntry {
3
- readonly id: string;
4
- readonly timestamp: string;
5
- readonly capName: string;
6
- readonly slice: Record<string, unknown>;
7
- }
8
2
  export interface StateValuesStreamProps {
9
- /** Device whose runtime-state changes we want to track. Required. */
3
+ /** Device whose runtime-state we want to render. Required. */
10
4
  readonly deviceId: number;
11
5
  /** Initial cap-name filter — empty = all caps visible. */
12
6
  readonly defaultCaps?: readonly string[];
13
- /** Max height CSS class. */
7
+ /** Max height CSS class for the scrollable tree body. */
14
8
  readonly maxHeight?: string;
15
- /** Initial number of historical entries to fetch. */
9
+ /**
10
+ * @deprecated The State panel no longer keeps a chronological log,
11
+ * so there is no historical fetch to size. Accepted but ignored;
12
+ * retained so existing callers don't break.
13
+ */
16
14
  readonly limit?: number;
17
15
  /**
18
- * Optional controlled live buffer. When provided the stream appends
19
- * to this external store instead of its own internal `useState`,
20
- * so the entries survive an unmount/remount of the component (used
21
- * by `DeviceActivityPanel` to keep tab content visible across
22
- * tab switches without leaving subscriptions alive in inactive
23
- * tabs).
16
+ * @deprecated The State panel now renders a live current-state tree
17
+ * sourced from `deviceState.getAllSnapshots` + the realtime
18
+ * subscription, so there is no append-buffer to host across
19
+ * tab switches. Accepted but ignored; retained so `DeviceActivityPanel`
20
+ * (which passes a buffer) keeps type-checking without a ripple edit.
24
21
  */
25
- readonly liveBuffer?: LiveBuffer<StateChangeEntry>;
22
+ readonly liveBuffer?: LiveBuffer<unknown>;
26
23
  readonly onClose?: () => void;
27
24
  readonly className?: string;
28
25
  }
29
- export declare function StateValuesStream({ deviceId, defaultCaps, maxHeight, limit, liveBuffer: externalBuffer, onClose, className, }: StateValuesStreamProps): import("react/jsx-runtime").JSX.Element;
30
- export {};
26
+ export declare function StateValuesStream({ deviceId, defaultCaps, maxHeight, onClose, className, }: StateValuesStreamProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
+ import { UiContributionRemote } from '@camstack/types';
2
3
  /** Standard props every addon-contributed widget receives. */
3
4
  export interface WidgetProps {
4
5
  /** Stable id of THIS widget instance (form-builder field key, dashboard slot UUID, etc.). */
@@ -22,6 +23,11 @@ export interface WidgetRegistry {
22
23
  * Returns the resolved widget component for `<addonId>/<stableId>`,
23
24
  * or `undefined` when the widget id is unknown to the registry, or
24
25
  * `null` while the bundle is still loading.
26
+ *
27
+ * @deprecated Unused by all render paths since the unified
28
+ * UI-contribution model (Task 10). Resolve remotes through
29
+ * `useRemoteComponent` / `<WidgetSlot>` instead. Kept for external
30
+ * addons that may still call it.
25
31
  */
26
32
  resolve(widgetId: string): ComponentType<WidgetProps> | null | undefined;
27
33
  /** Metadata lookup — used by `<WidgetSlot>` to validate `requires`. */
@@ -29,32 +35,71 @@ export interface WidgetRegistry {
29
35
  /** Every contributed widget. Used by host pickers (e.g. dashboard
30
36
  * add-widget modal) to enumerate the available widgets. */
31
37
  listAll(): readonly WidgetMetadataEntry[];
38
+ /**
39
+ * Resolve the versioned MF entry URL for a remote name — the
40
+ * aggregator-stamped `bundleUrl`. Used by the unified
41
+ * `ContributionRenderer` `kind:'remote'` path to load a remote it
42
+ * only knows by `remoteName`. `undefined` when no widget in the
43
+ * registry references that remote.
44
+ */
45
+ entryUrlFor(remoteName: string): string | undefined;
32
46
  }
33
- /** One enriched-aggregator entry exposed to consumers. */
47
+ /** Widget host kinds a widget can run on more than one host. */
48
+ export type WidgetHost = 'device-tab' | 'dashboard' | 'integration-detail';
49
+ /** Dashboard sizing hints. */
50
+ export type WidgetSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
51
+ /**
52
+ * One enriched-aggregator entry exposed to consumers.
53
+ *
54
+ * A widget declaration IS a `UiContribution` (`kind:'remote'`) plus
55
+ * widget-only metadata — this entry mirrors that shape with the
56
+ * aggregator-stamped `addonId` + `bundleUrl` added.
57
+ */
34
58
  export interface WidgetMetadataEntry {
35
59
  readonly widgetId: string;
36
60
  readonly addonId: string;
37
61
  readonly stableId: string;
62
+ readonly tab: string;
63
+ readonly subTab?: string;
38
64
  readonly label: string;
65
+ readonly order?: number;
66
+ readonly kind: 'remote';
67
+ readonly remote: UiContributionRemote;
39
68
  readonly description?: string;
40
69
  readonly icon?: string;
41
- readonly remoteName: string;
42
70
  readonly bundleUrl: string;
43
- readonly hosts: readonly ('device-tab' | 'dashboard' | 'integration-detail')[];
71
+ readonly hosts: readonly WidgetHost[];
44
72
  readonly requires: {
45
73
  readonly deviceContext: boolean;
46
74
  readonly integrationContext: boolean;
47
75
  };
48
- readonly defaultSize: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
49
- readonly allowedSizes: readonly ('xs' | 'sm' | 'md' | 'lg' | 'xl')[];
76
+ readonly defaultSize: WidgetSize;
77
+ readonly allowedSizes: readonly WidgetSize[];
50
78
  readonly defaultColumns: number;
51
79
  readonly defaultRows: number;
52
80
  }
81
+ /**
82
+ * Register the MF remote (idempotent) and load one of its exposed
83
+ * modules. Returns the resolved `Record<componentKey, Component>` map
84
+ * (the exposed module's `default` export).
85
+ *
86
+ * Exported so the unified `ContributionRenderer` `kind:'remote'` path
87
+ * can load an arbitrary `{ remoteName, exposedModule }` descriptor —
88
+ * the same path the `WidgetRegistry` uses internally for widgets.
89
+ */
90
+ export declare function loadRemoteBundle(remoteName: string, exposedModule: string, entryUrl: string): Promise<Record<string, ComponentType<WidgetProps>>>;
53
91
  export interface WidgetRegistryProviderProps {
54
92
  readonly children: ReactNode;
55
93
  }
56
94
  export declare function WidgetRegistryProvider({ children }: WidgetRegistryProviderProps): import("react/jsx-runtime").JSX.Element;
57
- /** Returns the registered widget component, `null` while loading, or `undefined` if unknown. */
95
+ /**
96
+ * Returns the registered widget component, `null` while loading, or
97
+ * `undefined` if unknown.
98
+ *
99
+ * @deprecated Unused by all render paths since the unified
100
+ * UI-contribution model (Task 10). Use `useRemoteComponent` /
101
+ * `<WidgetSlot>` instead. Kept for external addons that may import it.
102
+ */
58
103
  export declare function useWidget(widgetId: string): ComponentType<WidgetProps> | null | undefined;
59
104
  /** Returns the metadata entry for a widget, or `undefined` if unknown. */
60
105
  export declare function useWidgetMetadata(widgetId: string): WidgetMetadataEntry | undefined;
@@ -62,6 +107,22 @@ export declare function useWidgetMetadata(widgetId: string): WidgetMetadataEntry
62
107
  * add-widget modal, settings UI palette) consume this to enumerate
63
108
  * the registry. Filter on the call site by `metadata.hosts.includes()`. */
64
109
  export declare function useAllWidgets(): readonly WidgetMetadataEntry[];
110
+ /**
111
+ * Resolve a `kind:'remote'` `UiContributionRemote` descriptor to a
112
+ * React component. Drives the unified `ContributionRenderer`
113
+ * `kind:'remote'` path — both device-detail contributions and dashboard
114
+ * widgets resolve through the same MF `loadRemoteBundle` loader.
115
+ *
116
+ * Returns:
117
+ * - `undefined` — the remote couldn't be resolved (no entry URL known,
118
+ * or the remote exposed no component for `componentKey`),
119
+ * - `null` — the bundle is still loading,
120
+ * - the component otherwise.
121
+ *
122
+ * `entryUrl` may be passed explicitly; when omitted it's resolved from
123
+ * the registry's aggregator-stamped `bundleUrl` for `remote.remoteName`.
124
+ */
125
+ export declare function useRemoteComponent(remote: UiContributionRemote, entryUrl?: string): ComponentType<WidgetProps> | null | undefined;
65
126
  /** Read the registry instance — throws when no provider is mounted. */
66
127
  export declare function useWidgetRegistry(): WidgetRegistry;
67
128
  /** Variant returning `null` when no provider is mounted — for boot splash etc. */
@@ -181,6 +181,12 @@ export declare const useDecoderPushPacket: typeof trpc.decoder.pushPacket.useQue
181
181
  export declare const useDecoderOpenStream: typeof trpc.decoder.openStream.useQuery;
182
182
  /** Generated alias around `trpc.decoder.pullFrames.useQuery`. */
183
183
  export declare const useDecoderPullFrames: typeof trpc.decoder.pullFrames.useQuery;
184
+ /** Generated alias around `trpc.decoder.pullHandles.useQuery`. */
185
+ export declare const useDecoderPullHandles: typeof trpc.decoder.pullHandles.useQuery;
186
+ /** Generated alias around `trpc.decoder.getFrame.useQuery`. */
187
+ export declare const useDecoderGetFrame: typeof trpc.decoder.getFrame.useQuery;
188
+ /** Generated alias around `trpc.decoder.getShmStats.useQuery`. */
189
+ export declare const useDecoderGetShmStats: typeof trpc.decoder.getShmStats.useQuery;
184
190
  /** Generated alias around `trpc.decoder.updateConfig.useQuery`. */
185
191
  export declare const useDecoderUpdateConfig: typeof trpc.decoder.updateConfig.useQuery;
186
192
  /** Generated alias around `trpc.decoder.getStats.useQuery`. */
@@ -465,6 +471,12 @@ export declare const useMotionDetectionApplyDeviceSettingsPatch: typeof trpc.mot
465
471
  export declare const useMotionTriggerSetMotionTrigger: typeof trpc.motionTrigger.setMotionTrigger.useMutation;
466
472
  /** Generated alias around `trpc.motionTrigger.getStatus.useQuery`. */
467
473
  export declare const useMotionTriggerGetStatus: typeof trpc.motionTrigger.getStatus.useQuery;
474
+ /** Generated alias around `trpc.motionZones.getOptions.useQuery`. */
475
+ export declare const useMotionZonesGetOptions: typeof trpc.motionZones.getOptions.useQuery;
476
+ /** Generated alias around `trpc.motionZones.setZone.useMutation`. */
477
+ export declare const useMotionZonesSetZone: typeof trpc.motionZones.setZone.useMutation;
478
+ /** Generated alias around `trpc.motionZones.getStatus.useQuery`. */
479
+ export declare const useMotionZonesGetStatus: typeof trpc.motionZones.getStatus.useQuery;
468
480
  /** Generated alias around `trpc.mqttBroker.listBrokers.useQuery`. */
469
481
  export declare const useMqttBrokerListBrokers: typeof trpc.mqttBroker.listBrokers.useQuery;
470
482
  /** Generated alias around `trpc.mqttBroker.getBrokerConfig.useQuery`. */
@@ -517,6 +529,8 @@ export declare const useNodesShutdownNode: typeof trpc.nodes.shutdownNode.useMut
517
529
  export declare const useNodesRenameNode: typeof trpc.nodes.renameNode.useMutation;
518
530
  /** Generated alias around `trpc.nodes.clusterAddonStatus.useQuery`. */
519
531
  export declare const useNodesClusterAddonStatus: typeof trpc.nodes.clusterAddonStatus.useQuery;
532
+ /** Generated alias around `trpc.nodes.getCapUsageGraph.useQuery`. */
533
+ export declare const useNodesGetCapUsageGraph: typeof trpc.nodes.getCapUsageGraph.useQuery;
520
534
  /** Generated alias around `trpc.nodes.getNodeAddons.useQuery`. */
521
535
  export declare const useNodesGetNodeAddons: typeof trpc.nodes.getNodeAddons.useQuery;
522
536
  /** Generated alias around `trpc.nodes.setProcessLogLevel.useMutation`. */
@@ -735,10 +749,18 @@ export declare const usePtzStop: typeof trpc.ptz.stop.useMutation;
735
749
  export declare const usePtzGetPresets: typeof trpc.ptz.getPresets.useQuery;
736
750
  /** Generated alias around `trpc.ptz.goToPreset.useMutation`. */
737
751
  export declare const usePtzGoToPreset: typeof trpc.ptz.goToPreset.useMutation;
752
+ /** Generated alias around `trpc.ptz.savePreset.useMutation`. */
753
+ export declare const usePtzSavePreset: typeof trpc.ptz.savePreset.useMutation;
754
+ /** Generated alias around `trpc.ptz.deletePreset.useMutation`. */
755
+ export declare const usePtzDeletePreset: typeof trpc.ptz.deletePreset.useMutation;
756
+ /** Generated alias around `trpc.ptz.getOptions.useQuery`. */
757
+ export declare const usePtzGetOptions: typeof trpc.ptz.getOptions.useQuery;
738
758
  /** Generated alias around `trpc.ptz.goHome.useMutation`. */
739
759
  export declare const usePtzGoHome: typeof trpc.ptz.goHome.useMutation;
740
760
  /** Generated alias around `trpc.ptz.getPosition.useQuery`. */
741
761
  export declare const usePtzGetPosition: typeof trpc.ptz.getPosition.useQuery;
762
+ /** Generated alias around `trpc.ptz.setAutofocus.useMutation`. */
763
+ export declare const usePtzSetAutofocus: typeof trpc.ptz.setAutofocus.useMutation;
742
764
  /** Generated alias around `trpc.ptz.getStatus.useQuery`. */
743
765
  export declare const usePtzGetStatus: typeof trpc.ptz.getStatus.useQuery;
744
766
  /** Generated alias around `trpc.ptzAutotrack.getStatus.useQuery`. */
@@ -895,8 +917,18 @@ export declare const useStreamBrokerGetStreamUrl: typeof trpc.streamBroker.getSt
895
917
  export declare const useStreamBrokerGetStreamWithCodec: typeof trpc.streamBroker.getStreamWithCodec.useMutation;
896
918
  /** Generated alias around `trpc.streamBroker.releaseStreamWithCodec.useMutation`. */
897
919
  export declare const useStreamBrokerReleaseStreamWithCodec: typeof trpc.streamBroker.releaseStreamWithCodec.useMutation;
898
- /** Generated alias around `trpc.streamBroker.getBroker.useQuery`. */
899
- export declare const useStreamBrokerGetBroker: typeof trpc.streamBroker.getBroker.useQuery;
920
+ /** Generated alias around `trpc.streamBroker.subscribeAudioChunks.useMutation`. */
921
+ export declare const useStreamBrokerSubscribeAudioChunks: typeof trpc.streamBroker.subscribeAudioChunks.useMutation;
922
+ /** Generated alias around `trpc.streamBroker.pullAudioChunks.useQuery`. */
923
+ export declare const useStreamBrokerPullAudioChunks: typeof trpc.streamBroker.pullAudioChunks.useQuery;
924
+ /** Generated alias around `trpc.streamBroker.unsubscribeAudioChunks.useMutation`. */
925
+ export declare const useStreamBrokerUnsubscribeAudioChunks: typeof trpc.streamBroker.unsubscribeAudioChunks.useMutation;
926
+ /** Generated alias around `trpc.streamBroker.subscribeFrames.useMutation`. */
927
+ export declare const useStreamBrokerSubscribeFrames: typeof trpc.streamBroker.subscribeFrames.useMutation;
928
+ /** Generated alias around `trpc.streamBroker.pullFrameHandles.useQuery`. */
929
+ export declare const useStreamBrokerPullFrameHandles: typeof trpc.streamBroker.pullFrameHandles.useQuery;
930
+ /** Generated alias around `trpc.streamBroker.unsubscribeFrames.useMutation`. */
931
+ export declare const useStreamBrokerUnsubscribeFrames: typeof trpc.streamBroker.unsubscribeFrames.useMutation;
900
932
  /** Generated alias around `trpc.streamBroker.setPreBufferDuration.useMutation`. */
901
933
  export declare const useStreamBrokerSetPreBufferDuration: typeof trpc.streamBroker.setPreBufferDuration.useMutation;
902
934
  /** Generated alias around `trpc.streamBroker.getPreBufferInfo.useQuery`. */
@@ -919,6 +951,14 @@ export declare const useStreamBrokerGetDeviceSettingsContribution: typeof trpc.s
919
951
  export declare const useStreamBrokerGetDeviceLiveContribution: typeof trpc.streamBroker.getDeviceLiveContribution.useQuery;
920
952
  /** Generated alias around `trpc.streamBroker.applyDeviceSettingsPatch.useMutation`. */
921
953
  export declare const useStreamBrokerApplyDeviceSettingsPatch: typeof trpc.streamBroker.applyDeviceSettingsPatch.useMutation;
954
+ /** Generated alias around `trpc.streamParams.getOptions.useQuery`. */
955
+ export declare const useStreamParamsGetOptions: typeof trpc.streamParams.getOptions.useQuery;
956
+ /** Generated alias around `trpc.streamParams.setProfile.useMutation`. */
957
+ export declare const useStreamParamsSetProfile: typeof trpc.streamParams.setProfile.useMutation;
958
+ /** Generated alias around `trpc.streamParams.getConfigSchema.useQuery`. */
959
+ export declare const useStreamParamsGetConfigSchema: typeof trpc.streamParams.getConfigSchema.useQuery;
960
+ /** Generated alias around `trpc.streamParams.getStatus.useQuery`. */
961
+ export declare const useStreamParamsGetStatus: typeof trpc.streamParams.getStatus.useQuery;
922
962
  /** Generated alias around `trpc.switch.setState.useMutation`. */
923
963
  export declare const useSwitchSetState: typeof trpc.switch.setState.useMutation;
924
964
  /** Generated alias around `trpc.switch.getStatus.useQuery`. */
@@ -981,6 +1021,18 @@ export declare const useUserManagementDisableTotp: typeof trpc.userManagement.di
981
1021
  export declare const useUserManagementGetTotpStatus: typeof trpc.userManagement.getTotpStatus.useQuery;
982
1022
  /** Generated alias around `trpc.userManagement.verifyTotp.useMutation`. */
983
1023
  export declare const useUserManagementVerifyTotp: typeof trpc.userManagement.verifyTotp.useMutation;
1024
+ /** Generated alias around `trpc.userManagement.oauthIssueCode.useMutation`. */
1025
+ export declare const useUserManagementOauthIssueCode: typeof trpc.userManagement.oauthIssueCode.useMutation;
1026
+ /** Generated alias around `trpc.userManagement.oauthExchangeCode.useMutation`. */
1027
+ export declare const useUserManagementOauthExchangeCode: typeof trpc.userManagement.oauthExchangeCode.useMutation;
1028
+ /** Generated alias around `trpc.userManagement.oauthRefresh.useMutation`. */
1029
+ export declare const useUserManagementOauthRefresh: typeof trpc.userManagement.oauthRefresh.useMutation;
1030
+ /** Generated alias around `trpc.userManagement.oauthVerifyAccessToken.useQuery`. */
1031
+ export declare const useUserManagementOauthVerifyAccessToken: typeof trpc.userManagement.oauthVerifyAccessToken.useQuery;
1032
+ /** Generated alias around `trpc.userManagement.listOauthSessions.useQuery`. */
1033
+ export declare const useUserManagementListOauthSessions: typeof trpc.userManagement.listOauthSessions.useQuery;
1034
+ /** Generated alias around `trpc.userManagement.revokeOauthSession.useMutation`. */
1035
+ export declare const useUserManagementRevokeOauthSession: typeof trpc.userManagement.revokeOauthSession.useMutation;
984
1036
  /** Generated alias around `trpc.webrtcSession.listStreams.useQuery`. */
985
1037
  export declare const useWebrtcSessionListStreams: typeof trpc.webrtcSession.listStreams.useQuery;
986
1038
  /** Generated alias around `trpc.webrtcSession.createSession.useMutation`. */
@@ -3,6 +3,8 @@ export { useDeviceDetections } from './use-device-detections';
3
3
  export { useDeviceWebrtc } from './use-device-webrtc';
4
4
  export { usePTZ } from './use-ptz';
5
5
  export type { UsePTZResult, UsePTZOptions, PTZDirection, PTZTrpcProxy } from './use-ptz';
6
+ export { useDeviceAutotrack } from './use-device-autotrack';
7
+ export type { UseDeviceAutotrack } from './use-device-autotrack';
6
8
  export { useDeviceBattery } from './use-device-battery';
7
9
  export type { UseDeviceBatteryTrpc } from './use-device-battery';
8
10
  export { useDoorbellEvents } from './use-doorbell-events';
@@ -0,0 +1,10 @@
1
+ import { PtzAutotrackSettings, PtzAutotrackStatus } from '@camstack/types';
2
+ export interface UseDeviceAutotrack {
3
+ status: PtzAutotrackStatus | null;
4
+ isLoading: boolean;
5
+ isPending: boolean;
6
+ error: string | null;
7
+ setEnabled: (on: boolean) => Promise<void>;
8
+ setSettings: (patch: Partial<PtzAutotrackSettings>) => Promise<void>;
9
+ }
10
+ export declare function useDeviceAutotrack(deviceId: number | null): UseDeviceAutotrack;
@@ -9,6 +9,21 @@ interface PTZPreset {
9
9
  readonly id: string;
10
10
  readonly name: string;
11
11
  }
12
+ /**
13
+ * Per-camera PTZ availability descriptor returned by `ptz.getOptions`.
14
+ * Drives which controls the UI shows — preset save/delete is gated on
15
+ * `supportsPresets`, and the save button disables once `maxPresets`
16
+ * (when known) is reached.
17
+ */
18
+ export interface PTZOptions {
19
+ readonly hasPan: boolean;
20
+ readonly hasTilt: boolean;
21
+ readonly hasZoom: boolean;
22
+ readonly supportsPresets: boolean;
23
+ readonly maxPresets?: number;
24
+ /** Whether the camera exposes a controllable autofocus toggle. */
25
+ readonly hasAutofocus: boolean;
26
+ }
12
27
  /**
13
28
  * Backwards-compatible alias for the trpc shape — historically the
14
29
  * hook took its own narrow contract; the proxy generalisation
@@ -41,14 +56,27 @@ export interface UsePTZResult {
41
56
  readonly goHome: () => Promise<void>;
42
57
  /** Jump to a named preset. */
43
58
  readonly goToPreset: (presetId: string) => Promise<void>;
59
+ /**
60
+ * Save the camera's current position as a new preset. Picks the
61
+ * lowest unused numeric slot id, then refreshes the presets list.
62
+ * Resolves to the created preset id, or `undefined` on failure.
63
+ */
64
+ readonly savePreset: (name: string) => Promise<string | undefined>;
65
+ /** Delete a preset by id, then refresh the presets list. */
66
+ readonly deletePreset: (presetId: string) => Promise<void>;
44
67
  /** List of presets reported by the camera. Empty until first refresh. */
45
68
  readonly presets: readonly PTZPreset[];
46
69
  /** Force a refresh of the presets list. */
47
70
  readonly refreshPresets: () => Promise<void>;
71
+ /**
72
+ * Per-camera PTZ availability descriptor, or null until the first
73
+ * `getOptions` refresh resolves (or on cameras without the cap).
74
+ */
75
+ readonly options: PTZOptions | null;
48
76
  /** True while a control call is in flight (any path). */
49
77
  readonly busy: boolean;
50
78
  /** Last error message from any cap call, or null. */
51
79
  readonly error: string | null;
52
80
  }
53
- export declare function usePTZ(trpc: UseDeviceProxyTrpc, deviceId: number, options?: UsePTZOptions): UsePTZResult;
81
+ export declare function usePTZ(trpc: UseDeviceProxyTrpc, deviceId: number, hookOptions?: UsePTZOptions): UsePTZResult;
54
82
  export {};