@camstack/ui-library 1.1.41 → 1.1.42
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/detection-colors.d.ts +6 -7
- package/dist/composites/device-select-field.d.ts +16 -0
- package/dist/composites/device-select-filter.d.ts +53 -0
- package/dist/composites/event-kind-visuals.d.ts +26 -0
- package/dist/composites/index.d.ts +5 -0
- package/dist/index.cjs +800 -21
- package/dist/index.js +791 -23
- package/package.json +1 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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 = "#
|
|
8
|
+
export declare const DEFAULT_COLOR = "#22ff55";
|
|
11
9
|
/**
|
|
12
10
|
* Get the color for a detection class name.
|
|
13
|
-
*
|
|
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';
|