@camstack/ui-library 0.1.56 → 0.1.58

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.
Files changed (126) hide show
  1. package/dist/composites/battery-badge.d.ts +3 -0
  2. package/dist/composites/camera-stream-player.d.ts +101 -1
  3. package/dist/composites/cap-settings/ConsumablesPanel.d.ts +2 -0
  4. package/dist/composites/cap-settings/CoverageTrack.d.ts +12 -0
  5. package/dist/composites/cap-settings/EventBucketStrip.d.ts +25 -0
  6. package/dist/composites/cap-settings/EventHeatmap.d.ts +10 -0
  7. package/dist/composites/cap-settings/MaskShapeCanvas.d.ts +48 -0
  8. package/dist/composites/cap-settings/MotionZonesSettings.d.ts +1 -1
  9. package/dist/composites/cap-settings/PrivacyMaskSettings.d.ts +2 -0
  10. package/dist/composites/cap-settings/RecordingPanel.d.ts +2 -0
  11. package/dist/composites/cap-settings/RecordingRulesEditor.d.ts +7 -0
  12. package/dist/composites/cap-settings/RecordingSettings.d.ts +8 -0
  13. package/dist/composites/cap-settings/RecordingTimeline.d.ts +5 -0
  14. package/dist/composites/cap-settings/TimelineControls.d.ts +21 -0
  15. package/dist/composites/cap-settings/event-thumb.d.ts +11 -0
  16. package/dist/composites/cap-settings/index.d.ts +7 -0
  17. package/dist/composites/cap-settings/recording-config-form.d.ts +5 -0
  18. package/dist/composites/cap-settings/recording-spans.d.ts +22 -0
  19. package/dist/composites/cap-settings/recording-timeline-model.d.ts +84 -0
  20. package/dist/composites/device-activity-panel.d.ts +5 -1
  21. package/dist/composites/device-controls/alarm-hero-card.d.ts +24 -0
  22. package/dist/composites/device-controls/atoms.d.ts +81 -0
  23. package/dist/composites/device-controls/brightness-panel.d.ts +3 -0
  24. package/dist/composites/device-controls/button-control.d.ts +18 -0
  25. package/dist/composites/device-controls/climate-panel.d.ts +16 -0
  26. package/dist/composites/device-controls/container-primary-hero.d.ts +24 -0
  27. package/dist/composites/device-controls/container-primary.d.ts +46 -0
  28. package/dist/composites/device-controls/control-panel.d.ts +10 -0
  29. package/dist/composites/device-controls/control-registry.d.ts +74 -0
  30. package/dist/composites/device-controls/cover-hero-card.d.ts +27 -0
  31. package/dist/composites/device-controls/cover-inline.d.ts +27 -0
  32. package/dist/composites/device-controls/cover-panel.d.ts +3 -0
  33. package/dist/composites/device-controls/dummy-hero-card.d.ts +6 -0
  34. package/dist/composites/device-controls/fan-hero-card.d.ts +21 -0
  35. package/dist/composites/device-controls/fan-panel.d.ts +3 -0
  36. package/dist/composites/device-controls/humidifier-control.d.ts +37 -0
  37. package/dist/composites/device-controls/image-control.d.ts +24 -0
  38. package/dist/composites/device-controls/index.d.ts +33 -0
  39. package/dist/composites/device-controls/lawn-mower-control.d.ts +24 -0
  40. package/dist/composites/device-controls/light-hero-card.d.ts +16 -0
  41. package/dist/composites/device-controls/lock-hero-card.d.ts +15 -0
  42. package/dist/composites/device-controls/lock-panel.d.ts +3 -0
  43. package/dist/composites/device-controls/media-player-hero-card.d.ts +17 -0
  44. package/dist/composites/device-controls/media-player-panel.d.ts +9 -0
  45. package/dist/composites/device-controls/offline-badge.d.ts +11 -0
  46. package/dist/composites/device-controls/panel-controls.d.ts +17 -0
  47. package/dist/composites/device-controls/popover-row-action.d.ts +9 -0
  48. package/dist/composites/device-controls/primary-child.d.ts +18 -0
  49. package/dist/composites/device-controls/radial-gauge.d.ts +20 -0
  50. package/dist/composites/device-controls/sensor-hero-card.d.ts +10 -0
  51. package/dist/composites/device-controls/sensor-inline-control.d.ts +11 -0
  52. package/dist/composites/device-controls/sensor-value-atom.d.ts +106 -0
  53. package/dist/composites/device-controls/switch-hero-card.d.ts +13 -0
  54. package/dist/composites/device-controls/switch-panel.d.ts +3 -0
  55. package/dist/composites/device-controls/tap-toggle.d.ts +17 -0
  56. package/dist/composites/device-controls/thermostat-hero-card.d.ts +17 -0
  57. package/dist/composites/device-controls/types.d.ts +17 -0
  58. package/dist/composites/device-controls/update-control.d.ts +11 -0
  59. package/dist/composites/device-controls/vacuum-control.d.ts +36 -0
  60. package/dist/composites/device-controls/valve-control.d.ts +46 -0
  61. package/dist/composites/device-controls/water-heater-control.d.ts +41 -0
  62. package/dist/composites/device-controls/weather-control.d.ts +41 -0
  63. package/dist/composites/device-export-panel.d.ts +8 -1
  64. package/dist/composites/device-item/actions.d.ts +12 -1
  65. package/dist/composites/device-item/child-layout.d.ts +32 -0
  66. package/dist/composites/device-item/child-section-accordion.d.ts +9 -0
  67. package/dist/composites/device-item/container-children-context.d.ts +15 -0
  68. package/dist/composites/device-item/device-delete-action.d.ts +8 -0
  69. package/dist/composites/device-item/header.d.ts +8 -1
  70. package/dist/composites/device-item/helpers.d.ts +117 -2
  71. package/dist/composites/device-item/index.d.ts +4 -0
  72. package/dist/composites/device-item/preview.d.ts +3 -3
  73. package/dist/composites/device-item/reboot-quick-action.d.ts +9 -0
  74. package/dist/composites/device-item/status-dot.d.ts +4 -1
  75. package/dist/composites/device-list/batch-actions-bar.d.ts +15 -0
  76. package/dist/composites/device-list/batch-toolbar.d.ts +15 -0
  77. package/dist/composites/device-list/cards-layout.d.ts +18 -0
  78. package/dist/composites/device-list/columns.d.ts +68 -0
  79. package/dist/composites/device-list/device-mode.d.ts +115 -0
  80. package/dist/composites/device-list/filter-chips.d.ts +24 -13
  81. package/dist/composites/device-list/fuzzy-match.d.ts +27 -0
  82. package/dist/composites/device-list/generic-mode.d.ts +81 -0
  83. package/dist/composites/device-list/group.d.ts +19 -0
  84. package/dist/composites/device-list/hardware-cell.d.ts +7 -0
  85. package/dist/composites/device-list/hardware.d.ts +26 -0
  86. package/dist/composites/device-list/icon-action.d.ts +17 -0
  87. package/dist/composites/device-list/index.d.ts +23 -30
  88. package/dist/composites/device-list/multi-select.d.ts +22 -0
  89. package/dist/composites/device-list/sort.d.ts +18 -0
  90. package/dist/composites/device-list/sortable-header.d.ts +10 -0
  91. package/dist/composites/device-list/table-layout.d.ts +25 -0
  92. package/dist/composites/device-list/type-filter.d.ts +19 -0
  93. package/dist/composites/device-list/url-state.d.ts +14 -4
  94. package/dist/composites/device-meta.d.ts +38 -0
  95. package/dist/composites/discovery-panel.d.ts +3 -3
  96. package/dist/composites/hls-quality.d.ts +35 -0
  97. package/dist/composites/hls-video.d.ts +26 -0
  98. package/dist/composites/hover-zoom-image.d.ts +18 -0
  99. package/dist/composites/index.d.ts +13 -2
  100. package/dist/composites/log-stream-scroll.d.ts +32 -0
  101. package/dist/composites/log-stream.d.ts +8 -1
  102. package/dist/composites/stream-panel.d.ts +60 -9
  103. package/dist/composites/timezone-selector.d.ts +18 -0
  104. package/dist/composites/widget-panel.d.ts +28 -0
  105. package/dist/contexts/vod-playback.d.ts +17 -0
  106. package/dist/generated/system-hooks.d.ts +358 -56
  107. package/dist/hooks/index.d.ts +6 -0
  108. package/dist/hooks/use-device-cap-slice.d.ts +19 -0
  109. package/dist/hooks/use-device-capability.d.ts +12 -0
  110. package/dist/hooks/use-device-list-page-size.d.ts +14 -0
  111. package/dist/hooks/use-device-webrtc.d.ts +101 -4
  112. package/dist/hooks/use-optimistic-slice.d.ts +11 -0
  113. package/dist/index.cjs +53123 -9819
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.ts +1 -0
  116. package/dist/index.js +52791 -9767
  117. package/dist/index.js.map +1 -1
  118. package/dist/lib/cap-error.d.ts +41 -0
  119. package/dist/lib/format-control-datetime.d.ts +18 -0
  120. package/dist/lib/format-last-seen.d.ts +12 -0
  121. package/dist/lib/format-numeric.d.ts +9 -0
  122. package/dist/lib/index.d.ts +4 -0
  123. package/dist/primitives/dialog.d.ts +13 -0
  124. package/dist/primitives/tooltip.d.ts +9 -3
  125. package/package.json +3 -1
  126. package/dist/composites/cap-settings/MotionGridCanvas.d.ts +0 -9
@@ -27,3 +27,9 @@ export { useDevices, useDevice } from './use-devices';
27
27
  export { useSystemQuery, useSystemMutation, type SystemQuerySelector, type SystemMutationSelector, } from './use-system-query';
28
28
  export { useLiveEvent, type LiveEventCallback } from './use-live-event';
29
29
  export { useEventInvalidation } from './use-event-invalidation';
30
+ export { useOptimisticSlice } from './use-optimistic-slice';
31
+ export type { UseOptimisticSliceOptions, UseOptimisticSliceResult } from './use-optimistic-slice';
32
+ export { useDeviceCapSlice } from './use-device-cap-slice';
33
+ export type { UseDeviceCapSliceTrpc } from './use-device-cap-slice';
34
+ export { useDeviceListPageSize, DEVICE_LIST_PAGE_SIZE_OPTIONS, DEVICE_LIST_PAGE_SIZE_KEY, } from './use-device-list-page-size';
35
+ export type { SetDeviceListPageSize } from './use-device-list-page-size';
@@ -0,0 +1,19 @@
1
+ import { SliceHandleApi } from '@camstack/types';
2
+ /**
3
+ * The tRPC shape required by this hook — a superset of `UseDeviceProxyTrpc`
4
+ * that also exposes `deviceState.getCapSlice` and `deviceState.setCapSlice`
5
+ * so the lazy source can bootstrap a per-cap subscription.
6
+ *
7
+ * `System.trpcClient` satisfies this structurally.
8
+ */
9
+ export type UseDeviceCapSliceTrpc = SliceHandleApi;
10
+ /**
11
+ * Read an arbitrary cap's runtime-state slice by its raw kebab-case name.
12
+ *
13
+ * Returns `unknown | undefined`:
14
+ * - `undefined` while the slice hasn't been seeded yet (cold-start)
15
+ * - the raw slice record once the kernel has published at least one push
16
+ *
17
+ * Pass `null` for `deviceId` to suppress all fetches (renders `undefined`).
18
+ */
19
+ export declare function useDeviceCapSlice(trpc: UseDeviceCapSliceTrpc, deviceId: number | null, capName: string): unknown | undefined;
@@ -13,5 +13,17 @@ export interface UseDeviceCapabilityResult<TCap, TSlice> {
13
13
  readonly cap: TCap | undefined;
14
14
  readonly slice: TSlice | undefined;
15
15
  readonly available: boolean;
16
+ /**
17
+ * Resolved device liveness from the auto-registered `device-status`
18
+ * cap slice. Defaults to `true` until the slice lands so initial load
19
+ * never false-disables a control. Drives `available` (offline = no
20
+ * control).
21
+ */
22
+ readonly online: boolean;
23
+ /**
24
+ * Ms epoch of the last `online` transition when the device is
25
+ * currently offline, else `null`. Lets a badge render "offline since".
26
+ */
27
+ readonly offlineSince: number | null;
16
28
  }
17
29
  export declare function useDeviceCapability<TCap, TSlice>(options: UseDeviceCapabilityOptions<TCap, TSlice>): UseDeviceCapabilityResult<TCap, TSlice>;
@@ -0,0 +1,14 @@
1
+ /** Selectable per-page sizes. The table default (50) is intentionally one of them. */
2
+ export declare const DEVICE_LIST_PAGE_SIZE_OPTIONS: readonly number[];
3
+ /** Canonical default — used whenever a caller's `defaultSize` is itself invalid. */
4
+ export declare const DEVICE_LIST_PAGE_SIZE_DEFAULT = 50;
5
+ /** Single global key shared across every device-list surface. */
6
+ export declare const DEVICE_LIST_PAGE_SIZE_KEY = "camstack.device-list.pageSize";
7
+ export type SetDeviceListPageSize = (next: number) => void;
8
+ /**
9
+ * @param defaultSize fallback when nothing valid is stored. If it is not itself
10
+ * a member of {@link DEVICE_LIST_PAGE_SIZE_OPTIONS}, it is replaced by
11
+ * {@link DEVICE_LIST_PAGE_SIZE_DEFAULT} so it can never seed a phantom value.
12
+ * @returns `[size, setSize]` — `setSize` ignores values outside the allowed set.
13
+ */
14
+ export declare function useDeviceListPageSize(defaultSize: number): readonly [number, SetDeviceListPageSize];
@@ -1,15 +1,16 @@
1
+ import { CamProfile } from '@camstack/types';
1
2
  import { StreamChoice } from '../composites/stream-panel';
2
- import { ClientStreamHints, SignalingResult } from '../composites/camera-stream-player';
3
+ import { ClientStreamHints, SignalingResult, ClientOfferResult } from '../composites/camera-stream-player';
3
4
  /**
4
5
  * Discriminated WebRTC target — same shape as `WebrtcStreamTarget` on
5
- * the backend cap. Repeated locally to keep the hook self-contained
6
- * (no cross-package import from `@camstack/types`).
6
+ * the backend cap. The `profile` tier uses the canonical `CamProfile`
7
+ * enum so an invalid tier is a compile error.
7
8
  */
8
9
  export type WebrtcTarget = {
9
10
  readonly kind: 'adaptive';
10
11
  } | {
11
12
  readonly kind: 'profile';
12
- readonly profile: 'high' | 'mid' | 'low';
13
+ readonly profile: CamProfile;
13
14
  } | {
14
15
  readonly kind: 'cam-stream';
15
16
  readonly camStreamId: string;
@@ -54,15 +55,64 @@ export interface UseDeviceWebrtcTrpc {
54
55
  sessionId: string;
55
56
  sdpOffer: string;
56
57
  }>;
58
+ /**
59
+ * Client-offer signaling: the browser builds the SDP offer (advertising
60
+ * its native decode caps) and the server answers. The dual of
61
+ * `createSession`; lets iOS pass H.264 High/Main through untouched.
62
+ */
63
+ handleOffer: MutateFn<{
64
+ deviceId: number;
65
+ target: WebrtcTarget;
66
+ sdpOffer: string;
67
+ sessionId?: string;
68
+ }, {
69
+ sessionId: string;
70
+ sdpAnswer: string;
71
+ }>;
57
72
  handleAnswer: MutateFn<{
58
73
  deviceId: number;
59
74
  sessionId: string;
60
75
  sdpAnswer: string;
61
76
  }, void>;
77
+ /** Trickle ICE — push a client candidate to the server. */
78
+ addIceCandidate: MutateFn<{
79
+ deviceId: number;
80
+ sessionId: string;
81
+ candidate: string;
82
+ sdpMid?: string | null;
83
+ sdpMLineIndex?: number | null;
84
+ }, void>;
85
+ /** Trickle ICE — poll the server's gathered candidates. */
86
+ getIceCandidates: QueryFn<{
87
+ deviceId: number;
88
+ sessionId: string;
89
+ }, {
90
+ candidates: {
91
+ candidate: string;
92
+ sdpMid: string | null;
93
+ sdpMLineIndex: number | null;
94
+ }[];
95
+ done: boolean;
96
+ }>;
62
97
  closeSession: MutateFn<{
63
98
  deviceId: number;
64
99
  sessionId: string;
65
100
  }, void>;
101
+ /**
102
+ * Poll the live signaling state of a session. `pendingRenegotiation`
103
+ * is non-null after the server swaps the broker source to a different
104
+ * tier (adaptive downgrade) — the client must re-offer on the same
105
+ * `sessionId`; `epoch` guards against acting on a stale poll twice.
106
+ */
107
+ getSessionState: QueryFn<{
108
+ deviceId: number;
109
+ sessionId: string;
110
+ }, {
111
+ pendingRenegotiation: {
112
+ target: WebrtcTarget;
113
+ epoch: number;
114
+ } | null;
115
+ }>;
66
116
  };
67
117
  pipelineOrchestrator?: {
68
118
  getCameraMetrics: QueryFn<{
@@ -75,6 +125,16 @@ export interface UseDeviceWebrtcTrpc {
75
125
  configuredFps: number;
76
126
  } | null>;
77
127
  };
128
+ /** Optional: aggregated STUN/TURN servers (e.g. cloudflare-turn). When
129
+ * present, the client uses them so it can gather a reachable relay
130
+ * candidate for remote (CGNAT/mobile) viewing. */
131
+ turnProvider?: {
132
+ getTurnServers: QueryFn<void, readonly {
133
+ urls: string | readonly string[];
134
+ username?: string;
135
+ credential?: string;
136
+ }[]>;
137
+ };
78
138
  }
79
139
  /** Pipeline detection metrics for a device. */
80
140
  export interface DevicePipelineMetrics {
@@ -94,8 +154,45 @@ export interface DeviceWebrtcResult {
94
154
  readonly createSession: (target: WebrtcTarget, hints?: ClientStreamHints) => Promise<SignalingResult>;
95
155
  /** Server-offer signaling: send the client's SDP answer. */
96
156
  readonly sendAnswer: (sessionId: string, sdpAnswer: string) => Promise<void>;
157
+ /**
158
+ * Client-offer signaling (preferred for browsers): post a browser-built
159
+ * SDP offer and get the server's answer. The browser advertises its full
160
+ * H.264 decode caps in the offer, so a Main/High (incl. 4K) source passes
161
+ * through with no transcode — the only path that lets iOS decode High.
162
+ */
163
+ readonly handleOffer: (target: WebrtcTarget, sdpOffer: string, sessionId?: string) => Promise<ClientOfferResult>;
164
+ /**
165
+ * Fetch the browser-side ICE servers (STUN + TURN from the `turn-provider`
166
+ * cap). Needed for client-offer mode, where the PeerConnection must be
167
+ * built with TURN BEFORE the offer is created so a remote/CGNAT viewer can
168
+ * gather a relay candidate. Best-effort — resolves `undefined` on failure
169
+ * (the player falls back to public STUN).
170
+ */
171
+ readonly getIceServers: () => Promise<readonly RTCIceServer[] | undefined>;
172
+ /** Trickle ICE — push a client-gathered candidate to the server. */
173
+ readonly addIceCandidate: (sessionId: string, candidate: RTCIceCandidateInit) => Promise<void>;
174
+ /** Trickle ICE — poll the server's gathered candidates for a session. */
175
+ readonly getIceCandidates: (sessionId: string) => Promise<{
176
+ candidates: RTCIceCandidateInit[];
177
+ done: boolean;
178
+ }>;
97
179
  /** Close a WebRTC session on the server. */
98
180
  readonly closeSession: (sessionId: string) => Promise<void>;
181
+ /**
182
+ * Poll the live signaling state of a session. After an adaptive tier
183
+ * switch the server returns a non-null `pendingRenegotiation` (the new
184
+ * target + a monotonic `epoch`); the player re-offers on the SAME
185
+ * `sessionId` so the session re-negotiates against the new tier. Returns
186
+ * `{ pendingRenegotiation: null }` for non-adaptive / steady sessions.
187
+ */
188
+ readonly getSessionState: (sessionId: string) => Promise<SessionRenegotiationState>;
189
+ }
190
+ /** Live signaling state for a session — the adaptive re-offer signal. */
191
+ export interface SessionRenegotiationState {
192
+ readonly pendingRenegotiation: {
193
+ readonly target: WebrtcTarget;
194
+ readonly epoch: number;
195
+ } | null;
99
196
  }
100
197
  /**
101
198
  * Hook that provides WebRTC signaling callbacks and stream choices for a device.
@@ -0,0 +1,11 @@
1
+ export interface UseOptimisticSliceOptions {
2
+ readonly enabled?: boolean;
3
+ readonly timeoutMs?: number;
4
+ }
5
+ export interface UseOptimisticSliceResult<T> {
6
+ /** The slice to RENDER: the optimistic override if active, else the real slice. */
7
+ readonly display: T | undefined;
8
+ /** Apply an optimistic patch (merged onto the current display) after issuing a command. */
9
+ readonly applyOptimistic: (patch: Partial<T>) => void;
10
+ }
11
+ export declare function useOptimisticSlice<T extends object>(realSlice: T | undefined, opts?: UseOptimisticSliceOptions): UseOptimisticSliceResult<T>;