@camstack/ui-library 0.1.39 → 0.1.40
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/composites/addon-global-settings-form.d.ts +60 -0
- package/dist/composites/addon-page-props.d.ts +12 -0
- package/dist/composites/agent-step-editor.d.ts +15 -0
- package/dist/composites/app-shell/app-shell.d.ts +19 -0
- package/dist/composites/app-shell/index.d.ts +3 -0
- package/dist/composites/app-shell/sidebar-item.d.ts +10 -0
- package/dist/composites/app-shell/sidebar.d.ts +14 -0
- package/dist/composites/audio-classification-list.d.ts +20 -0
- package/dist/composites/audio-level-waveform.d.ts +35 -0
- package/dist/composites/audio-waveform.d.ts +20 -0
- package/dist/composites/battery-badge.d.ts +12 -0
- package/dist/composites/breadcrumb.d.ts +25 -0
- package/dist/composites/camera-stream-player.d.ts +87 -0
- package/dist/composites/code-block.d.ts +6 -0
- package/dist/composites/config-form-builder.d.ts +18 -0
- package/dist/composites/config-form-field.d.ts +70 -0
- package/dist/composites/confirm-action-button.d.ts +41 -0
- package/dist/composites/confirm-dialog.d.ts +13 -0
- package/dist/composites/data-table/data-table-header.d.ts +10 -0
- package/dist/composites/data-table/data-table-pagination.d.ts +9 -0
- package/dist/composites/data-table/data-table-row.d.ts +10 -0
- package/dist/composites/data-table/data-table.d.ts +2 -0
- package/dist/composites/data-table/index.d.ts +2 -0
- package/dist/composites/data-table/types.d.ts +34 -0
- package/dist/composites/data-table.d.ts +37 -0
- package/dist/composites/detection-canvas.d.ts +29 -0
- package/dist/composites/detection-colors.d.ts +15 -0
- package/dist/composites/detection-overlay.d.ts +9 -0
- package/dist/composites/detection-result-tree.d.ts +11 -0
- package/dist/composites/dev-shell.d.ts +20 -0
- package/dist/composites/device-activity-panel.d.ts +29 -0
- package/dist/composites/device-card.d.ts +38 -0
- package/dist/composites/device-grid.d.ts +12 -0
- package/dist/composites/device-item/actions.d.ts +9 -0
- package/dist/composites/device-item/children-accordion.d.ts +11 -0
- package/dist/composites/device-item/features.d.ts +17 -0
- package/dist/composites/device-item/header.d.ts +14 -0
- package/dist/composites/device-item/helpers.d.ts +147 -0
- package/dist/composites/device-item/index.d.ts +5 -0
- package/dist/composites/device-item/preview.d.ts +23 -0
- package/dist/composites/device-item/status-dot.d.ts +5 -0
- package/dist/composites/device-list/empty-state.d.ts +6 -0
- package/dist/composites/device-list/filter-chips.d.ts +19 -0
- package/dist/composites/device-list/group.d.ts +6 -0
- package/dist/composites/device-list/index.d.ts +31 -0
- package/dist/composites/device-list/pagination.d.ts +18 -0
- package/dist/composites/device-list/url-state.d.ts +24 -0
- package/dist/composites/discovery-panel.d.ts +26 -0
- package/dist/composites/doorbell-recent-panel.d.ts +10 -0
- package/dist/composites/empty-state.d.ts +10 -0
- package/dist/composites/event-stream.d.ts +48 -0
- package/dist/composites/filter-bar.d.ts +28 -0
- package/dist/composites/form-field.d.ts +11 -0
- package/dist/composites/image-selector.d.ts +25 -0
- package/dist/composites/index.d.ts +99 -0
- package/dist/composites/inference-config-selector.d.ts +44 -0
- package/dist/composites/kebab-menu.d.ts +39 -0
- package/dist/composites/key-value-list.d.ts +9 -0
- package/dist/composites/log-stream.d.ts +61 -0
- package/dist/composites/login-form.d.ts +8 -0
- package/dist/composites/mount-addon-page.d.ts +16 -0
- package/dist/composites/node-picker.d.ts +15 -0
- package/dist/composites/page-header.d.ts +8 -0
- package/dist/composites/phase-icon.d.ts +5 -0
- package/dist/composites/pipeline-builder.d.ts +43 -0
- package/dist/composites/pipeline-runtime-selector.d.ts +16 -0
- package/dist/composites/pipeline-step.d.ts +65 -0
- package/dist/composites/pipeline-tree-matrix.d.ts +31 -0
- package/dist/composites/provider-badge.d.ts +7 -0
- package/dist/composites/ptz-overlay.d.ts +20 -0
- package/dist/composites/response-log.d.ts +9 -0
- package/dist/composites/slide-over-panel.d.ts +11 -0
- package/dist/composites/snapshot-button.d.ts +25 -0
- package/dist/composites/stat-card.d.ts +10 -0
- package/dist/composites/state-values-stream.d.ts +30 -0
- package/dist/composites/status-badge.d.ts +10 -0
- package/dist/composites/step-timings.d.ts +9 -0
- package/dist/composites/step-tree-master.d.ts +28 -0
- package/dist/composites/stream-panel.d.ts +143 -0
- package/dist/composites/version-badge.d.ts +24 -0
- package/dist/composites/widget-slot.d.ts +20 -0
- package/dist/contexts/custom-field-renderers.d.ts +26 -0
- package/dist/contexts/device-context.d.ts +20 -0
- package/dist/contexts/player-overlays.d.ts +56 -0
- package/dist/contexts/system-context.d.ts +19 -0
- package/dist/contexts/widget-registry.d.ts +68 -0
- package/dist/contexts/zone-editing.d.ts +59 -0
- package/dist/generated/system-hooks.d.ts +933 -0
- package/dist/hooks/index.d.ts +27 -0
- package/dist/hooks/use-cluster-nodes.d.ts +17 -0
- package/dist/hooks/use-debounced-string.d.ts +1 -0
- package/dist/hooks/use-device-battery.d.ts +14 -0
- package/dist/hooks/use-device-capability.d.ts +17 -0
- package/dist/hooks/use-device-detections.d.ts +50 -0
- package/dist/hooks/use-device-features.d.ts +25 -0
- package/dist/hooks/use-device-proxy.d.ts +106 -0
- package/dist/hooks/use-device-snapshot.d.ts +10 -0
- package/dist/hooks/use-device-webrtc.d.ts +108 -0
- package/dist/hooks/use-devices.d.ts +13 -0
- package/dist/hooks/use-doorbell-events.d.ts +20 -0
- package/dist/hooks/use-event-invalidation.d.ts +1 -0
- package/dist/hooks/use-event-stream.d.ts +5 -0
- package/dist/hooks/use-is-mobile.d.ts +8 -0
- package/dist/hooks/use-live-buffer.d.ts +8 -0
- package/dist/hooks/use-live-event.d.ts +3 -0
- package/dist/hooks/use-ptz.d.ts +54 -0
- package/dist/hooks/use-system-query.d.ts +12 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/provider-icons.d.ts +3 -0
- package/dist/icons/status-icons.d.ts +3 -0
- package/dist/index.cjs +23484 -14252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -3787
- package/dist/index.js +22810 -13741
- package/dist/index.js.map +1 -1
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/mf-runtime-init.d.ts +1 -0
- package/dist/lib/phase-config.d.ts +16 -0
- package/dist/lib/pipeline-mirror.d.ts +23 -0
- package/dist/lib/responsive.d.ts +81 -0
- package/dist/lib/shared-context.d.ts +5 -0
- package/dist/lib/validate-template.d.ts +2 -0
- package/dist/primitives/badge.d.ts +11 -0
- package/dist/primitives/bottom-sheet.d.ts +9 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/card.d.ts +9 -0
- package/dist/primitives/checkbox.d.ts +4 -0
- package/dist/primitives/collapsible-card.d.ts +15 -0
- package/dist/primitives/dialog.d.ts +20 -0
- package/dist/primitives/dropdown.d.ts +19 -0
- package/dist/primitives/floating-panel.d.ts +22 -0
- package/dist/primitives/icon-button.d.ts +13 -0
- package/dist/primitives/index.d.ts +21 -0
- package/dist/primitives/input.d.ts +11 -0
- package/dist/primitives/label.d.ts +4 -0
- package/dist/primitives/mobile-drawer.d.ts +10 -0
- package/dist/primitives/popover.d.ts +10 -0
- package/dist/primitives/scroll-area.d.ts +4 -0
- package/dist/primitives/select.d.ts +9 -0
- package/dist/primitives/separator.d.ts +9 -0
- package/dist/primitives/skeleton.d.ts +4 -0
- package/dist/primitives/switch.d.ts +7 -0
- package/dist/primitives/tabs.d.ts +17 -0
- package/dist/primitives/tooltip.d.ts +6 -0
- package/dist/theme/create-theme.d.ts +2 -0
- package/dist/theme/defaults.d.ts +4 -0
- package/dist/theme/index.cjs +228 -248
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.ts +6 -128
- package/dist/theme/index.js +212 -214
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/theme-provider.d.ts +10 -0
- package/dist/theme/theme-to-css.d.ts +2 -0
- package/dist/theme/{index.d.cts → types.d.ts} +5 -27
- package/dist/theme/use-theme-mode.d.ts +2 -0
- package/dist/trpc-react.d.ts +7 -0
- package/package.json +5 -3
- package/dist/index.d.cts +0 -3787
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PipelineSchema, PipelineSlot } from '@camstack/types';
|
|
2
|
+
export type StepDotState = 'inherit' | 'on' | 'off' | 'na';
|
|
3
|
+
export interface StepTreeNode {
|
|
4
|
+
readonly addonId: string;
|
|
5
|
+
readonly addonName: string;
|
|
6
|
+
readonly slot: PipelineSlot;
|
|
7
|
+
readonly inputClasses: readonly string[];
|
|
8
|
+
readonly outputClasses: readonly string[];
|
|
9
|
+
readonly children: readonly StepTreeNode[];
|
|
10
|
+
}
|
|
11
|
+
export interface StepTreeMasterProps {
|
|
12
|
+
readonly tree: readonly StepTreeNode[];
|
|
13
|
+
readonly selectedAddonId: string | null;
|
|
14
|
+
readonly onSelect: (addonId: string) => void;
|
|
15
|
+
readonly agentDots?: Readonly<Record<string, readonly {
|
|
16
|
+
readonly agentNodeId: string;
|
|
17
|
+
readonly state: StepDotState;
|
|
18
|
+
}[]>>;
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function StepTreeMaster({ tree, selectedAddonId, onSelect, agentDots, className, }: StepTreeMasterProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Helper: build a StepTreeNode[] from a `PipelineSchema` by chaining on
|
|
24
|
+
* `inputClasses` ⇔ `outputClasses` compatibility. Mirrors the orchestrator
|
|
25
|
+
* resolver's `buildTreeFromAddons` logic but yields names only (display
|
|
26
|
+
* layer). Addons in the audio-classifier slot become separate roots.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildStepTreeFromSchema(schema: PipelineSchema): readonly StepTreeNode[];
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SignalingResult, ClientStreamHints } from './camera-stream-player';
|
|
3
|
+
import { DeviceDetections } from '../hooks/use-device-detections';
|
|
4
|
+
/**
|
|
5
|
+
* Discriminated WebRTC target — same shape as the backend cap. Kept
|
|
6
|
+
* locally on the StreamChoice so consumers don't need to import from
|
|
7
|
+
* `@camstack/types` to render a panel.
|
|
8
|
+
*/
|
|
9
|
+
export type StreamChoiceTarget = {
|
|
10
|
+
readonly kind: 'adaptive';
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'profile';
|
|
13
|
+
readonly profile: 'high' | 'mid' | 'low';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'cam-stream';
|
|
16
|
+
readonly camStreamId: string;
|
|
17
|
+
};
|
|
18
|
+
export interface StreamChoice {
|
|
19
|
+
/**
|
|
20
|
+
* Stable identifier for React keys, dropdown values, and the
|
|
21
|
+
* player's `streamKey` prop. Opaque to the panel — typical values:
|
|
22
|
+
* `'adaptive'`, `'profile:high'`, `'stream:native:main'`.
|
|
23
|
+
*/
|
|
24
|
+
readonly id: string;
|
|
25
|
+
/** Display label (e.g. "Adaptive", "HIGH (3840×2160)", "Native main"). */
|
|
26
|
+
readonly label: string;
|
|
27
|
+
/** Structured WebRTC target — passed verbatim to `createSession`. */
|
|
28
|
+
readonly target: StreamChoiceTarget;
|
|
29
|
+
/** Live broker status (null if unavailable). */
|
|
30
|
+
readonly status?: string | null;
|
|
31
|
+
/** Input FPS from camera (null if unavailable). */
|
|
32
|
+
readonly inputFps?: number | null;
|
|
33
|
+
/** Decoded FPS (null if unavailable). */
|
|
34
|
+
readonly decodeFps?: number | null;
|
|
35
|
+
/** Bitrate in kbps (null if unavailable). */
|
|
36
|
+
readonly bitrateKbps?: number | null;
|
|
37
|
+
}
|
|
38
|
+
export interface StreamStats {
|
|
39
|
+
readonly status: string;
|
|
40
|
+
readonly inputFps: number;
|
|
41
|
+
readonly decodeFps: number;
|
|
42
|
+
readonly uptimeMs: number;
|
|
43
|
+
}
|
|
44
|
+
export interface StreamPanelProps {
|
|
45
|
+
readonly serverUrl: string;
|
|
46
|
+
readonly createSession: (target: StreamChoiceTarget, hints?: ClientStreamHints) => Promise<SignalingResult>;
|
|
47
|
+
readonly sendAnswer: (sessionId: string, sdpAnswer: string) => Promise<void>;
|
|
48
|
+
readonly closeSession?: (sessionId: string) => Promise<void>;
|
|
49
|
+
/** Available streams. If omitted or single entry, no dropdown shown. */
|
|
50
|
+
readonly streams?: readonly StreamChoice[];
|
|
51
|
+
/** Currently active StreamChoice id. Defaults to first stream. */
|
|
52
|
+
readonly activeStreamId?: string;
|
|
53
|
+
/** Called when user selects a different stream (StreamChoice id). */
|
|
54
|
+
readonly onStreamChange?: (id: string) => void;
|
|
55
|
+
readonly deviceName?: string;
|
|
56
|
+
/** Pipeline phase from useDeviceDetections (e.g. "active", "watching") */
|
|
57
|
+
readonly phase?: string;
|
|
58
|
+
/** Pipeline metrics from useDeviceWebrtc. If provided, overrides phase and adds detection fps. */
|
|
59
|
+
readonly pipelineMetrics?: {
|
|
60
|
+
phase: string;
|
|
61
|
+
detectionFps: number;
|
|
62
|
+
avgInferenceMs: number;
|
|
63
|
+
} | null;
|
|
64
|
+
/** Detection data from useDeviceDetections hook. If omitted, no overlays. */
|
|
65
|
+
readonly detections?: DeviceDetections;
|
|
66
|
+
/** Initial state for detection overlay (default: true) */
|
|
67
|
+
readonly defaultShowDetections?: boolean;
|
|
68
|
+
/** Initial state for motion overlay (default: false) */
|
|
69
|
+
readonly defaultShowMotion?: boolean;
|
|
70
|
+
readonly streamStats?: StreamStats;
|
|
71
|
+
/** Auto-play on mount (default: true) */
|
|
72
|
+
readonly autoPlay?: boolean;
|
|
73
|
+
/** Show play/stop toggle + snapshot preview when stopped (default: false) */
|
|
74
|
+
readonly showPlayStop?: boolean;
|
|
75
|
+
/** Snapshot source URL (data: URI). Only used when showPlayStop=true. */
|
|
76
|
+
readonly snapshotSrc?: string | null;
|
|
77
|
+
/** Whether snapshot is currently loading */
|
|
78
|
+
readonly snapshotLoading?: boolean;
|
|
79
|
+
/** Callback to refresh snapshot */
|
|
80
|
+
readonly onRefreshSnapshot?: () => void;
|
|
81
|
+
/** Show stream stats in header (fps, uptime) (default: false) */
|
|
82
|
+
readonly showStreamStats?: boolean;
|
|
83
|
+
readonly children?: ReactNode;
|
|
84
|
+
/**
|
|
85
|
+
* Extra overlay node composited on top of the video, alongside the
|
|
86
|
+
* built-in detection overlay. Used by callers to layer device-scoped
|
|
87
|
+
* controls (PTZOverlay, AudioPTT, ...) without forking the panel.
|
|
88
|
+
*/
|
|
89
|
+
readonly extraOverlay?: ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the device supports PTZ. When true, the header shows a
|
|
92
|
+
* "PTZ" toggle next to detect/motion.
|
|
93
|
+
*/
|
|
94
|
+
readonly ptzAvailable?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Controlled visibility of the PTZ overlay. Drives both the
|
|
97
|
+
* header button highlight and (combined with `ptzOverlay`) overlay
|
|
98
|
+
* rendering. Caller computes the final value (e.g. OR with an
|
|
99
|
+
* external "force on" surface like a floating PTZ panel) and
|
|
100
|
+
* passes it down here.
|
|
101
|
+
*/
|
|
102
|
+
readonly ptzShown?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Overlay rendered ON the live video when `ptzShown` is true.
|
|
105
|
+
* Typically a `<PTZOverlay controls={...} mode="overlay" />` from
|
|
106
|
+
* ui-library. Combined with `extraOverlay` in the player overlay
|
|
107
|
+
* slot — both render together when active.
|
|
108
|
+
*/
|
|
109
|
+
readonly ptzOverlay?: ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Notified when the user clicks the in-header PTZ toggle. The
|
|
112
|
+
* caller updates its source of truth for `ptzShown`. No-op if
|
|
113
|
+
* omitted (button stays inert).
|
|
114
|
+
*/
|
|
115
|
+
readonly onPtzToggle?: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* Whether the device supports two-way audio (intercom). When true,
|
|
118
|
+
* the header shows an "Intercom" toggle next to detect/motion that
|
|
119
|
+
* lets the operator open the floating intercom panel without leaving
|
|
120
|
+
* the stream view.
|
|
121
|
+
*/
|
|
122
|
+
readonly intercomAvailable?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Controlled visibility of the intercom panel — drives the button's
|
|
125
|
+
* highlight state. The caller (which owns the floating-panel state)
|
|
126
|
+
* passes `true` while its intercom panel is open.
|
|
127
|
+
*/
|
|
128
|
+
readonly intercomShown?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Notified when the user clicks the in-header intercom toggle. The
|
|
131
|
+
* caller flips its panel state. No-op if omitted (button inert).
|
|
132
|
+
*/
|
|
133
|
+
readonly onIntercomToggle?: () => void;
|
|
134
|
+
/**
|
|
135
|
+
* When true, drops the panel's outer rounded card chrome (border,
|
|
136
|
+
* rounded corners, background). Use when embedding into another
|
|
137
|
+
* surface that already provides framing — e.g. the device-detail
|
|
138
|
+
* left-column hero where the panel is one row of a larger card.
|
|
139
|
+
*/
|
|
140
|
+
readonly chromeless?: boolean;
|
|
141
|
+
readonly className?: string;
|
|
142
|
+
}
|
|
143
|
+
export declare function StreamPanel({ serverUrl, createSession, sendAnswer, closeSession, streams, activeStreamId: controlledStreamId, onStreamChange, deviceName, phase, pipelineMetrics, detections, defaultShowDetections, defaultShowMotion, streamStats, autoPlay, showPlayStop, snapshotSrc, snapshotLoading, onRefreshSnapshot, showStreamStats, children, extraOverlay, ptzAvailable, ptzShown, ptzOverlay, onPtzToggle, intercomAvailable, intercomShown, onIntercomToggle, chromeless, className, }: StreamPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type SemanticBadgeVariant = 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
3
|
+
export interface SemanticBadgeProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
variant?: SemanticBadgeVariant;
|
|
6
|
+
/** Use monospace font (good for versions, codes) */
|
|
7
|
+
mono?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* General-purpose badge with semantic color variants.
|
|
12
|
+
* Solid background with dark text for maximum contrast.
|
|
13
|
+
*/
|
|
14
|
+
export declare function SemanticBadge({ children, variant, mono, className }: SemanticBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface VersionBadgeProps {
|
|
16
|
+
version: string;
|
|
17
|
+
preRelease?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Version badge — auto-detects pre-release versions.
|
|
22
|
+
* Stable = success (green), Pre-release = warning (amber).
|
|
23
|
+
*/
|
|
24
|
+
export declare function VersionBadge({ version, preRelease, className }: VersionBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { WidgetProps } from '../contexts/widget-registry.js';
|
|
3
|
+
export interface WidgetSlotProps {
|
|
4
|
+
/** `<addonId>/<stableId>` — the public widget identifier. */
|
|
5
|
+
readonly widgetId: string;
|
|
6
|
+
/** Host context — picked up by metadata `requires` validation. Defaults to `'device-tab'`. */
|
|
7
|
+
readonly host?: WidgetProps['host'];
|
|
8
|
+
/** Forwarded to widget. */
|
|
9
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
10
|
+
/** Forwarded to widget. */
|
|
11
|
+
readonly deviceId?: number;
|
|
12
|
+
readonly integrationId?: string;
|
|
13
|
+
/** Stable instance id — defaults to `widgetId` for non-dashboard hosts (single mount per page). */
|
|
14
|
+
readonly instanceId?: string;
|
|
15
|
+
/** Dashboard sizing — placeholder for v1. */
|
|
16
|
+
readonly size?: WidgetProps['size'];
|
|
17
|
+
readonly columns?: number;
|
|
18
|
+
readonly rows?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function WidgetSlot(props: WidgetSlotProps): ReactNode;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { ConfigField } from '@camstack/types';
|
|
3
|
+
/**
|
|
4
|
+
* Props shape every custom renderer receives. Keep it congruent with
|
|
5
|
+
* the built-in `case` branches so the dispatcher in `config-form-field`
|
|
6
|
+
* can pass arguments uniformly.
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomFieldRendererProps {
|
|
9
|
+
readonly field: ConfigField;
|
|
10
|
+
readonly value: unknown;
|
|
11
|
+
readonly onChange: (value: unknown) => void;
|
|
12
|
+
readonly disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type CustomFieldRenderer = ComponentType<CustomFieldRendererProps>;
|
|
15
|
+
export type CustomFieldRendererMap = Readonly<Record<string, CustomFieldRenderer>>;
|
|
16
|
+
export interface CustomFieldRenderersProviderProps {
|
|
17
|
+
readonly renderers: CustomFieldRendererMap;
|
|
18
|
+
readonly children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare function CustomFieldRenderersProvider({ renderers, children, }: CustomFieldRenderersProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Look up a registered renderer by `field.type`. Returns null when no
|
|
23
|
+
* renderer is registered — caller falls back to its built-in handling
|
|
24
|
+
* (or renders nothing).
|
|
25
|
+
*/
|
|
26
|
+
export declare function useCustomFieldRenderer(type: string): CustomFieldRenderer | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Cached device snapshot. Loose-typed (`Record<string, unknown>`) at
|
|
4
|
+
* the boundary because the wire shape lives in different places
|
|
5
|
+
* depending on the caller — DeviceDetail reads from
|
|
6
|
+
* `deviceManager.list`, `addon-admin-ui` from a hand-loaded subset.
|
|
7
|
+
* Renderers narrow the fields they actually need.
|
|
8
|
+
*/
|
|
9
|
+
export type DeviceSnapshot = Readonly<Record<string, unknown>>;
|
|
10
|
+
export interface DeviceContextProviderProps {
|
|
11
|
+
readonly deviceId: number;
|
|
12
|
+
/** Optional cached device snapshot — readers narrow the fields they need. */
|
|
13
|
+
readonly device?: DeviceSnapshot;
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function DeviceContextProvider({ deviceId, device, children }: DeviceContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** @returns the device id of the current page subtree, or null if outside any provider. */
|
|
18
|
+
export declare function useDeviceId(): number | null;
|
|
19
|
+
/** @returns the cached device snapshot, or null when no snapshot is provided. */
|
|
20
|
+
export declare function useDeviceSnapshot(): DeviceSnapshot | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PlayerOverlayLayer {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
/** Lower = bottom. Built-in layers (PTZ overlay, detection overlay)
|
|
5
|
+
* are drawn at order 0; addon-contributed layers should pick a
|
|
6
|
+
* higher value (e.g. 100) to land on top. */
|
|
7
|
+
readonly order: number;
|
|
8
|
+
readonly node: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface PlayerToolbarButton {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
/** Lower = leftmost in the toolbar cluster. */
|
|
13
|
+
readonly order: number;
|
|
14
|
+
/** Icon node — typically a `<svg>` or lucide-react icon. The host
|
|
15
|
+
* renders it inside a button shell; the icon component is
|
|
16
|
+
* responsible for its own sizing (h-3 w-3 by convention). */
|
|
17
|
+
readonly icon: ReactNode;
|
|
18
|
+
/** Visible label on wider breakpoints; collapses to icon-only on
|
|
19
|
+
* narrow widths. */
|
|
20
|
+
readonly label: string;
|
|
21
|
+
/** Title/tooltip for the rendered button. Defaults to `label`. */
|
|
22
|
+
readonly title?: string;
|
|
23
|
+
/** Controlled active state — drives the highlight (primary tint). */
|
|
24
|
+
readonly active: boolean;
|
|
25
|
+
/** Tone variant for the inactive state. `'primary'` reads as a
|
|
26
|
+
* call-to-action (e.g. "Snapshot"); `'default'` is a neutral
|
|
27
|
+
* toggle. */
|
|
28
|
+
readonly tone?: 'default' | 'primary';
|
|
29
|
+
/** Disable the button when the host is mid-transition. */
|
|
30
|
+
readonly disabled?: boolean;
|
|
31
|
+
readonly onClick: () => void;
|
|
32
|
+
}
|
|
33
|
+
export interface PlayerOverlaysProviderProps {
|
|
34
|
+
readonly children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare function PlayerOverlaysProvider({ children }: PlayerOverlaysProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/** Snapshot of registered layers ordered by `order` (asc, ties resolved
|
|
38
|
+
* by insertion order of the underlying Map). Returns `[]` outside a
|
|
39
|
+
* provider. */
|
|
40
|
+
export declare function usePlayerOverlayLayers(): readonly PlayerOverlayLayer[];
|
|
41
|
+
/** Snapshot of registered toolbar buttons, ordered by `order` (asc). */
|
|
42
|
+
export declare function usePlayerToolbarButtons(): readonly PlayerToolbarButton[];
|
|
43
|
+
/**
|
|
44
|
+
* Register an overlay layer for the lifetime of the calling component.
|
|
45
|
+
* Re-registers on every render with the latest spec; auto-unregisters
|
|
46
|
+
* on unmount. Pass `null` to skip registration when the layer is
|
|
47
|
+
* conditionally enabled (the hook still runs every render — keeps
|
|
48
|
+
* react-hook order stable across spec === null toggles).
|
|
49
|
+
*
|
|
50
|
+
* Callers that build the spec inline should memoise it (`useMemo`)
|
|
51
|
+
* to avoid re-registering on every parent render — context-write
|
|
52
|
+
* effects depend on referential equality of the spec object.
|
|
53
|
+
*/
|
|
54
|
+
export declare function usePlayerOverlayLayer(spec: PlayerOverlayLayer | null): void;
|
|
55
|
+
/** Same shape as `usePlayerOverlayLayer`, scoped to toolbar buttons. */
|
|
56
|
+
export declare function usePlayerToolbarButton(spec: PlayerToolbarButton | null): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { System } from '@camstack/sdk';
|
|
3
|
+
export interface SystemProviderProps {
|
|
4
|
+
readonly system: System;
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function SystemProvider({ system, children }: SystemProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Read the active `System` instance from the surrounding `<SystemProvider>`.
|
|
10
|
+
* Throws when no provider is mounted — every hook in this directory
|
|
11
|
+
* relies on the system, so a clear error beats a silent null.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSystem(): System;
|
|
14
|
+
/**
|
|
15
|
+
* Variant that returns `null` instead of throwing — useful for
|
|
16
|
+
* components that need to render before the provider is set up
|
|
17
|
+
* (boot-time splash screens etc.).
|
|
18
|
+
*/
|
|
19
|
+
export declare function useOptionalSystem(): System | null;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
/** Standard props every addon-contributed widget receives. */
|
|
3
|
+
export interface WidgetProps {
|
|
4
|
+
/** Stable id of THIS widget instance (form-builder field key, dashboard slot UUID, etc.). */
|
|
5
|
+
readonly instanceId: string;
|
|
6
|
+
/** Host where this widget is rendered. */
|
|
7
|
+
readonly host: 'device-tab' | 'dashboard' | 'integration-detail';
|
|
8
|
+
/** Form/dashboard-supplied props. Shape depends on the widget. */
|
|
9
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
10
|
+
/** Provided when host has a device context. */
|
|
11
|
+
readonly deviceId?: number;
|
|
12
|
+
/** Provided when host has an integration context. */
|
|
13
|
+
readonly integrationId?: string;
|
|
14
|
+
/** Dashboard sizing hints (placeholder for v1 — widget can ignore). */
|
|
15
|
+
readonly size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
16
|
+
readonly columns?: number;
|
|
17
|
+
readonly rows?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Public registry surface. */
|
|
20
|
+
export interface WidgetRegistry {
|
|
21
|
+
/**
|
|
22
|
+
* Returns the resolved widget component for `<addonId>/<stableId>`,
|
|
23
|
+
* or `undefined` when the widget id is unknown to the registry, or
|
|
24
|
+
* `null` while the bundle is still loading.
|
|
25
|
+
*/
|
|
26
|
+
resolve(widgetId: string): ComponentType<WidgetProps> | null | undefined;
|
|
27
|
+
/** Metadata lookup — used by `<WidgetSlot>` to validate `requires`. */
|
|
28
|
+
metadata(widgetId: string): WidgetMetadataEntry | undefined;
|
|
29
|
+
/** Every contributed widget. Used by host pickers (e.g. dashboard
|
|
30
|
+
* add-widget modal) to enumerate the available widgets. */
|
|
31
|
+
listAll(): readonly WidgetMetadataEntry[];
|
|
32
|
+
}
|
|
33
|
+
/** One enriched-aggregator entry exposed to consumers. */
|
|
34
|
+
export interface WidgetMetadataEntry {
|
|
35
|
+
readonly widgetId: string;
|
|
36
|
+
readonly addonId: string;
|
|
37
|
+
readonly stableId: string;
|
|
38
|
+
readonly label: string;
|
|
39
|
+
readonly description?: string;
|
|
40
|
+
readonly icon?: string;
|
|
41
|
+
readonly remoteName: string;
|
|
42
|
+
readonly bundleUrl: string;
|
|
43
|
+
readonly hosts: readonly ('device-tab' | 'dashboard' | 'integration-detail')[];
|
|
44
|
+
readonly requires: {
|
|
45
|
+
readonly deviceContext: boolean;
|
|
46
|
+
readonly integrationContext: boolean;
|
|
47
|
+
};
|
|
48
|
+
readonly defaultSize: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
49
|
+
readonly allowedSizes: readonly ('xs' | 'sm' | 'md' | 'lg' | 'xl')[];
|
|
50
|
+
readonly defaultColumns: number;
|
|
51
|
+
readonly defaultRows: number;
|
|
52
|
+
}
|
|
53
|
+
export interface WidgetRegistryProviderProps {
|
|
54
|
+
readonly children: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
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. */
|
|
58
|
+
export declare function useWidget(widgetId: string): ComponentType<WidgetProps> | null | undefined;
|
|
59
|
+
/** Returns the metadata entry for a widget, or `undefined` if unknown. */
|
|
60
|
+
export declare function useWidgetMetadata(widgetId: string): WidgetMetadataEntry | undefined;
|
|
61
|
+
/** Returns every contributed widget — host pickers (dashboard
|
|
62
|
+
* add-widget modal, settings UI palette) consume this to enumerate
|
|
63
|
+
* the registry. Filter on the call site by `metadata.hosts.includes()`. */
|
|
64
|
+
export declare function useAllWidgets(): readonly WidgetMetadataEntry[];
|
|
65
|
+
/** Read the registry instance — throws when no provider is mounted. */
|
|
66
|
+
export declare function useWidgetRegistry(): WidgetRegistry;
|
|
67
|
+
/** Variant returning `null` when no provider is mounted — for boot splash etc. */
|
|
68
|
+
export declare function useOptionalWidgetRegistry(): WidgetRegistry | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ZoneDrawingKind = 'polygon' | 'tripwire';
|
|
3
|
+
export interface ZoneDraftPoint {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ZoneDraft {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly kind: ZoneDrawingKind;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly color: string;
|
|
12
|
+
readonly points: ReadonlyArray<ZoneDraftPoint>;
|
|
13
|
+
}
|
|
14
|
+
export interface ZoneEditingState {
|
|
15
|
+
/** Whether the zone editor overlay is active. When `true` the
|
|
16
|
+
* Konva Stage intercepts clicks; when `false` clicks pass
|
|
17
|
+
* through to the underlying player. */
|
|
18
|
+
readonly editing: boolean;
|
|
19
|
+
/** Active drawing kind. `null` means "select / drag existing
|
|
20
|
+
* zones". Setting a non-null value triggers a fresh polygon /
|
|
21
|
+
* tripwire creation on the next click. */
|
|
22
|
+
readonly drawingKind: ZoneDrawingKind | null;
|
|
23
|
+
/** Currently-selected zone id (for highlight + ZoneForm). */
|
|
24
|
+
readonly selectedZoneId: string | null;
|
|
25
|
+
/** In-flight draft snapshot of the zone being edited. `null` while
|
|
26
|
+
* no edit session is active — read-only browse mode. */
|
|
27
|
+
readonly editingDraft: ZoneDraft | null;
|
|
28
|
+
}
|
|
29
|
+
export interface ZoneEditingActions {
|
|
30
|
+
setEditing(editing: boolean): void;
|
|
31
|
+
setDrawingKind(kind: ZoneDrawingKind | null): void;
|
|
32
|
+
setSelectedZoneId(id: string | null): void;
|
|
33
|
+
/** Start a new polygon/tripwire — convenience for "Add zone"
|
|
34
|
+
* buttons that should both unlock the overlay AND select the
|
|
35
|
+
* shape kind in one click. */
|
|
36
|
+
startDrawing(kind: ZoneDrawingKind): void;
|
|
37
|
+
/** Exit edit mode — clears the drawing kind + selection + any
|
|
38
|
+
* in-flight draft. Called when the Detection tab is torn down. */
|
|
39
|
+
exitEditing(): void;
|
|
40
|
+
/** Snapshot a zone into the draft and enter unified edit mode.
|
|
41
|
+
* If a different draft is already active it is discarded. */
|
|
42
|
+
enterDraft(draft: ZoneDraft): void;
|
|
43
|
+
/** Patch the active draft. No-op when no draft is active. */
|
|
44
|
+
updateDraft(patch: Partial<Omit<ZoneDraft, 'id' | 'kind'>>): void;
|
|
45
|
+
/** Throw the draft away. Caller is expected to refresh from
|
|
46
|
+
* upstream zone state (operator chose Discard or navigated away). */
|
|
47
|
+
discardDraft(): void;
|
|
48
|
+
}
|
|
49
|
+
interface ZoneEditingContextValue extends ZoneEditingState, ZoneEditingActions {
|
|
50
|
+
}
|
|
51
|
+
export interface ZoneEditingProviderProps {
|
|
52
|
+
readonly children: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
export declare function ZoneEditingProvider({ children }: ZoneEditingProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
/** Read + drive the zone-editing state. Returns `null` outside a
|
|
56
|
+
* provider so callers that mount in pages without zones (e.g. a
|
|
57
|
+
* shared hero on a non-camera device) can no-op gracefully. */
|
|
58
|
+
export declare function useZoneEditing(): ZoneEditingContextValue | null;
|
|
59
|
+
export {};
|