@camstack/ui-library 1.1.41 → 1.1.43

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.
@@ -168,7 +168,7 @@ export interface CameraStreamPlayerProps {
168
168
  * Main/High (incl. 4K) source pass through with NO transcode — the only
169
169
  * path that lets iOS decode High. The caller closes over the target.
170
170
  */
171
- handleOffer?: (sdpOffer: string, sessionId?: string) => Promise<ClientOfferResult>;
171
+ handleOffer?: (sdpOffer: string, sessionId?: string, hints?: ClientStreamHints) => Promise<ClientOfferResult>;
172
172
  /**
173
173
  * Fetch the browser-side ICE servers (STUN + TURN) for client-offer mode.
174
174
  * Called BEFORE the offer is built so a remote/CGNAT viewer can gather a
@@ -205,7 +205,7 @@ export interface CameraStreamPlayerProps {
205
205
  * the server-chosen downgrade target instead. Required (alongside
206
206
  * `getSessionState`) for adaptive re-offer to run.
207
207
  */
208
- reoffer?: (sessionId: string, sdpOffer: string, target: PlayerWebrtcTarget) => Promise<ClientOfferResult>;
208
+ reoffer?: (sessionId: string, sdpOffer: string, target: PlayerWebrtcTarget, hints?: ClientStreamHints) => Promise<ClientOfferResult>;
209
209
  /**
210
210
  * Optional poster image (snapshot data-URL) shown by the <video> before
211
211
  * the FIRST-EVER frame is decoded. Only a cold-start fallback — once a
@@ -1,15 +1,14 @@
1
1
  /**
2
- * Detection class colors — single source of truth.
3
- *
4
- * Used by: DetectionCanvas (UI), result-annotator (server-side SVG),
5
- * admin-ui event viewer, and any other place that visualizes detections.
2
+ * Fixed colors for known detection classes derived from the taxonomy
3
+ * (every detection/motion kind) plus the UI-only face/plate classes. Kept as
4
+ * a named export for back-compat with existing consumers.
6
5
  */
7
- /** Fixed colors for known detection classes */
8
6
  export declare const CLASS_COLORS: Readonly<Record<string, string>>;
9
7
  /** Primary/default color when nothing else matches */
10
- export declare const DEFAULT_COLOR = "#f59e42";
8
+ export declare const DEFAULT_COLOR = "#22ff55";
11
9
  /**
12
10
  * Get the color for a detection class name.
13
- * Returns a fixed color for known classes, or a deterministic hash-based color for unknown ones.
11
+ * Resolves: custom override taxonomy/UI-only fixed color deterministic
12
+ * hash-based color for unknown classes.
14
13
  */
15
14
  export declare function getClassColor(className: string, customColors?: Readonly<Record<string, string>>): string;
@@ -0,0 +1,16 @@
1
+ import { ConfigDeviceSelectField, ConfigDeviceMultiSelectField } from '@camstack/types';
2
+ import { TranslationFn } from './config-form-builder';
3
+ export declare function DeviceSelectField({ field, value, onChange, disabled, translationFn, }: {
4
+ field: ConfigDeviceSelectField;
5
+ value: unknown;
6
+ onChange: (v: unknown) => void;
7
+ disabled?: boolean;
8
+ translationFn?: TranslationFn;
9
+ }): import("react").JSX.Element;
10
+ export declare function DeviceMultiSelectField({ field, value, onChange, disabled, translationFn, }: {
11
+ field: ConfigDeviceMultiSelectField;
12
+ value: unknown;
13
+ onChange: (v: unknown) => void;
14
+ disabled?: boolean;
15
+ translationFn?: TranslationFn;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { ConfigOption, DeviceSelectFilter } from '@camstack/types';
2
+ /**
3
+ * Pure, render-free helpers backing the `device-select` / `device-multiselect`
4
+ * form fields. The field declares only a {@link DeviceSelectFilter}; the
5
+ * renderer fetches EVERY system device via `deviceManager.listAll` and narrows
6
+ * the list CLIENT-SIDE with these functions — there is no server-computed
7
+ * option list.
8
+ *
9
+ * Kept separate from the React component so the match/label/search logic is
10
+ * unit-testable without mounting a tree or mocking tRPC.
11
+ */
12
+ /**
13
+ * The minimal projection of a `deviceManager.listAll` row these helpers read.
14
+ * A structural subset of `DeviceInfo` so a stubbed device (in a test) or the
15
+ * full wire shape both satisfy it.
16
+ */
17
+ export interface DeviceSelectCandidate {
18
+ readonly id: number;
19
+ readonly type: string;
20
+ readonly name: string;
21
+ readonly location?: string | null;
22
+ readonly features?: readonly string[];
23
+ }
24
+ /**
25
+ * Does a device satisfy the filter?
26
+ *
27
+ * Union match: with an empty/absent filter every device passes; otherwise the
28
+ * device passes when ANY provided clause matches — its `features` intersect
29
+ * `caps`, OR its `type` is in `types`. `excludeDeviceId` is subtracted last
30
+ * (it always drops the device regardless of the other clauses).
31
+ */
32
+ export declare function deviceMatchesFilter(device: DeviceSelectCandidate, filter?: DeviceSelectFilter): boolean;
33
+ /** Human label for a device option: `Name (Location)` when a location is set. */
34
+ export declare function deviceOptionLabel(device: DeviceSelectCandidate): string;
35
+ /**
36
+ * Filter a device list and project it into sorted `{ value, label }` options
37
+ * (value = the device id as a string). Sorted case-insensitively by label so
38
+ * the picker order is stable.
39
+ */
40
+ export declare function devicesToOptions(devices: readonly DeviceSelectCandidate[], filter?: DeviceSelectFilter): ConfigOption[];
41
+ /**
42
+ * Free-text option filter — case-insensitive AND over whitespace tokens, each
43
+ * matched against the option's `value` + `label` (so a device is found by name,
44
+ * id, or location). An empty query returns every option in order.
45
+ */
46
+ export declare function filterDeviceOptions(options: readonly ConfigOption[], query: string): ConfigOption[];
47
+ /**
48
+ * Resolve the currently-selected values into options IN SELECTION ORDER (so
49
+ * chips stay stable while searching). A selected value with no matching option
50
+ * becomes a synthetic `{ value, label: value }` — a stale id still shows as a
51
+ * removable chip rather than silently vanishing.
52
+ */
53
+ export declare function selectedDeviceOptions(options: readonly ConfigOption[], selected: readonly string[]): ConfigOption[];
@@ -0,0 +1,26 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+ import { EventKindDescriptor } from '@camstack/types';
3
+ import { TranslationFn } from './config-form-builder';
4
+ /**
5
+ * `iconId` → lucide component. Built ONLY from statically-imported icons
6
+ * (bundle-safe). Unknown ids resolve to the neutral `Tag` fallback.
7
+ */
8
+ export declare const EVENT_KIND_ICONS: Readonly<Record<string, LucideIcon>>;
9
+ /** Resolve an `iconId` to a lucide component (falls back to `Tag`). */
10
+ export declare function resolveEventKindIcon(iconId: string): LucideIcon;
11
+ /**
12
+ * Translated label for an event kind — `t(labelKey)` when a translation
13
+ * exists, else the English `label` fallback. Robust to a missing key: an
14
+ * i18n backend that echoes the key unchanged (react-i18next default) is
15
+ * treated as "no translation" and the fallback label is returned, so the UI
16
+ * never renders a raw `eventKind.*` key.
17
+ */
18
+ export declare function eventKindLabel(descriptor: Pick<EventKindDescriptor, 'labelKey' | 'label'>, t?: TranslationFn): string;
19
+ export interface EventKindGlyphProps {
20
+ readonly iconId: string;
21
+ readonly size?: number;
22
+ readonly color?: string;
23
+ readonly className?: string;
24
+ }
25
+ /** Small convenience component: renders the lucide glyph for an `iconId`. */
26
+ export declare function EventKindGlyph({ iconId, size, color, className }: EventKindGlyphProps): import('react').FunctionComponentElement<Omit<import('lucide-react').LucideProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
@@ -40,6 +40,8 @@ export type { PipelineRuntimeOption } from './pipeline-runtime-selector';
40
40
  export { PipelineBuilder } from './pipeline-builder';
41
41
  export type { PipelineBuilderProps } from './pipeline-builder';
42
42
  export { CLASS_COLORS, DEFAULT_COLOR, getClassColor } from './detection-colors';
43
+ export { EVENT_KIND_ICONS, resolveEventKindIcon, eventKindLabel, EventKindGlyph, } from './event-kind-visuals';
44
+ export type { EventKindGlyphProps } from './event-kind-visuals';
43
45
  export { DetectionCanvas } from './detection-canvas';
44
46
  export type { Detection, DetectionCanvasProps } from './detection-canvas';
45
47
  export { DetectionResultTree } from './detection-result-tree';
@@ -56,6 +58,9 @@ export type { MountAddonPageOptions } from './mount-addon-page';
56
58
  export { ConfigFormBuilder } from './config-form-builder';
57
59
  export type { TranslationFn } from './config-form-builder';
58
60
  export { ConfigFormField, NodeSelectField, NodeMultiSelectField, isFieldVisible, } from './config-form-field';
61
+ export { DeviceSelectField, DeviceMultiSelectField } from './device-select-field';
62
+ export { deviceMatchesFilter, deviceOptionLabel, devicesToOptions, filterDeviceOptions, selectedDeviceOptions, } from './device-select-filter';
63
+ export type { DeviceSelectCandidate } from './device-select-filter';
59
64
  export { TimezoneSelector, TIMEZONES, findTimezone } from './timezone-selector';
60
65
  export type { TimezoneSelectorProps, Timezone, TimezoneDstRule, Weekday } from './timezone-selector';
61
66
  export { AddonGlobalSettingsForm } from './addon-global-settings-form';
@@ -43,8 +43,6 @@ export declare const useAddonsListFrameworkPackages: typeof trpc.addons.listFram
43
43
  export declare const useAddonsListCapabilityProviders: typeof trpc.addons.listCapabilityProviders.useQuery;
44
44
  /** Generated alias around `trpc.addons.setCapabilityProviderEnabled.useMutation`. */
45
45
  export declare const useAddonsSetCapabilityProviderEnabled: typeof trpc.addons.setCapabilityProviderEnabled.useMutation;
46
- /** Generated alias around `trpc.addons.updateFrameworkPackage.useMutation`. */
47
- export declare const useAddonsUpdateFrameworkPackage: typeof trpc.addons.updateFrameworkPackage.useMutation;
48
46
  /** Generated alias around `trpc.addons.getVersions.useQuery`. */
49
47
  export declare const useAddonsGetVersions: typeof trpc.addons.getVersions.useQuery;
50
48
  /** Generated alias around `trpc.addons.restartAddon.useMutation`. */
@@ -65,6 +65,7 @@ export interface UseDeviceWebrtcTrpc {
65
65
  target: WebrtcTarget;
66
66
  sdpOffer: string;
67
67
  sessionId?: string;
68
+ hints?: ClientStreamHints;
68
69
  }, {
69
70
  sessionId: string;
70
71
  sdpAnswer: string;
@@ -160,7 +161,7 @@ export interface DeviceWebrtcResult {
160
161
  * H.264 decode caps in the offer, so a Main/High (incl. 4K) source passes
161
162
  * through with no transcode — the only path that lets iOS decode High.
162
163
  */
163
- readonly handleOffer: (target: WebrtcTarget, sdpOffer: string, sessionId?: string) => Promise<ClientOfferResult>;
164
+ readonly handleOffer: (target: WebrtcTarget, sdpOffer: string, sessionId?: string, hints?: ClientStreamHints) => Promise<ClientOfferResult>;
164
165
  /**
165
166
  * Fetch the browser-side ICE servers (STUN + TURN from the `turn-provider`
166
167
  * cap). Needed for client-offer mode, where the PeerConnection must be