@camstack/ui-library 1.1.17 → 1.1.18
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/device-item/children-accordion.d.ts +4 -1
- package/dist/composites/device-item/helpers.d.ts +27 -5
- package/dist/composites/device-item/index.d.ts +4 -4
- package/dist/composites/device-list/group.d.ts +10 -1
- package/dist/composites/device-meta.d.ts +11 -0
- package/dist/generated/system-hooks.d.ts +6 -0
- package/dist/index.cjs +4391 -4218
- package/dist/index.js +4383 -4219
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/resolve-sensor-display.d.ts +25 -0
- package/package.json +1 -1
|
@@ -6,6 +6,9 @@ interface ChildrenAccordionProps {
|
|
|
6
6
|
readonly accessoryChildren: readonly DeviceItemDevice[];
|
|
7
7
|
readonly adoptedChildren: readonly DeviceItemDevice[];
|
|
8
8
|
readonly onNavigate: (id: number) => void;
|
|
9
|
+
/** Parent row's name — used to strip the redundant baked-in prefix from each
|
|
10
|
+
* child's DISPLAY name (the underlying `child.name` is untouched). */
|
|
11
|
+
readonly parentName: string;
|
|
9
12
|
}
|
|
10
|
-
export declare function ChildrenAccordion({ trpc, accessoryChildren, adoptedChildren, onNavigate, }: ChildrenAccordionProps): ReactNode;
|
|
13
|
+
export declare function ChildrenAccordion({ trpc, accessoryChildren, adoptedChildren, onNavigate, parentName, }: ChildrenAccordionProps): ReactNode;
|
|
11
14
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChildLayout, DeviceDisplayOverride, SourceInfo } from '@camstack/types';
|
|
2
2
|
import { LucideIcon } from 'lucide-react';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
4
|
import { UseDeviceProxyTrpc } from '../../hooks/use-device-proxy';
|
|
5
5
|
/**
|
|
6
6
|
* Mirror of the canonical `DeviceInfo` wire shape (see
|
|
@@ -30,10 +30,16 @@ export interface DeviceItemDevice {
|
|
|
30
30
|
/** Upstream-system identity (dispatch key + system tag + optional uniqueId).
|
|
31
31
|
* Flows from `DeviceInfo.sourceInfo` via structural cast / parse;
|
|
32
32
|
* optional so rows from providers that pre-date SourceInfo still work.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Live rendering hints (unit, precision) come from the cap STATUS SLICE for
|
|
34
|
+
* generic numeric-sensor, or canonical constants in ROLE_DESCRIPTOR for typed
|
|
35
|
+
* roles; an operator's per-device customization rides `display` (below). */
|
|
36
36
|
readonly sourceInfo?: SourceInfo;
|
|
37
|
+
/** Operator-authored per-device display override (icon/label/unit/precision/
|
|
38
|
+
* hidden). Mirrors `DeviceInfo.display` so the wire row passes through. The
|
|
39
|
+
* renderers resolve it via `resolveSensorDisplay` (unit/precision, render-time
|
|
40
|
+
* conversion) + `displayRoleLabel` / `deviceLeadIcon` (label/icon); `hidden`
|
|
41
|
+
* filters the row out of list surfaces. Absent ⇒ role/slice defaults. */
|
|
42
|
+
readonly display?: DeviceDisplayOverride;
|
|
37
43
|
/** Soft-link to another device id. For a CONTAINER device this is the
|
|
38
44
|
* LEGACY picker-chosen primary child (numeric id); the row/hero resolve the
|
|
39
45
|
* primary child via `resolveContainerPrimary(children, linkDeviceId)`.
|
|
@@ -194,6 +200,22 @@ export interface VariantDefaults {
|
|
|
194
200
|
}
|
|
195
201
|
export declare function resolveFlags(props: DeviceItemProps): VariantDefaults;
|
|
196
202
|
export declare function deviceLeadIcon(device: DeviceItemDevice): LucideIcon;
|
|
203
|
+
/**
|
|
204
|
+
* Role label for a device row, honouring an operator's per-device `display.label`
|
|
205
|
+
* override (falls back to the `DEVICE_ROLE_META` label). NOT the device name —
|
|
206
|
+
* this is the small secondary role caption on accessory/sensor rows.
|
|
207
|
+
*/
|
|
208
|
+
export declare function displayRoleLabel(device: DeviceItemDevice): string;
|
|
209
|
+
export declare function stripParentNamePrefix(name: string, parentName: string): string;
|
|
210
|
+
/**
|
|
211
|
+
* Display name for a child device rendered UNDER its container/parent row.
|
|
212
|
+
* Precedence: an operator's explicit per-device `display.label` wins over the
|
|
213
|
+
* auto-strip (mirrors {@link displayRoleLabel}); otherwise the parent-name
|
|
214
|
+
* prefix is stripped via {@link stripParentNamePrefix}. Shared by the
|
|
215
|
+
* device-detail children list AND the devices list-table so both surfaces
|
|
216
|
+
* render the bare child label identically.
|
|
217
|
+
*/
|
|
218
|
+
export declare function childListName(child: Pick<DeviceItemDevice, 'name' | 'display'>, parentName: string): string;
|
|
197
219
|
/**
|
|
198
220
|
* Icon for each `DeviceFeature` advertised on a device row. Used by
|
|
199
221
|
* the features popover (`<DeviceItemFeatures>`) to render compact
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { DeviceItemProps } from './helpers';
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
3
|
+
export type { ChildLayoutSection, GroupedChildren } from './child-layout';
|
|
4
|
+
export { groupChildrenByLayout } from './child-layout';
|
|
5
5
|
export { ChildSectionAccordion } from './child-section-accordion';
|
|
6
6
|
export { ContainerChildrenProvider, useContainerChildren } from './container-children-context';
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
7
|
+
export type { DeviceItemDevice, DeviceItemKind, DeviceItemParent, DeviceItemProps, DeviceItemVariant, DeviceItemView, } from './helpers';
|
|
8
|
+
export { childListName, deriveDeviceKind, stripParentNamePrefix } from './helpers';
|
|
9
9
|
export declare function DeviceItem(props: DeviceItemProps): ReactNode;
|
|
@@ -22,4 +22,13 @@ export interface GroupedDevices {
|
|
|
22
22
|
readonly topLevel: readonly DeviceItemDevice[];
|
|
23
23
|
readonly accessoriesByParent: ReadonlyMap<number, readonly DeviceItemDevice[]>;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
/** Options for `groupTopLevelAndAccessories`. */
|
|
26
|
+
export interface GroupDevicesOptions {
|
|
27
|
+
/** Include devices carrying an operator `display.hidden` override. Default
|
|
28
|
+
* false — hidden devices are omitted from BOTH top-level and accessory
|
|
29
|
+
* lists. NOTE: distinct from the HA `accessories` cap `hiddenChildIds`
|
|
30
|
+
* mechanism (container-scoped, provider-persisted) — this is the device-level
|
|
31
|
+
* `display.hidden` flag. A future "show hidden" toggle flips this one prop. */
|
|
32
|
+
readonly includeHidden?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare function groupTopLevelAndAccessories(devices: readonly DeviceItemDevice[], options?: GroupDevicesOptions): GroupedDevices;
|
|
@@ -35,4 +35,15 @@ export declare function deviceRoleMeta(role: DeviceRole): DeviceRoleMeta;
|
|
|
35
35
|
export declare function deviceTypeMetaOf(type: string): DeviceTypeMeta;
|
|
36
36
|
/** Runtime-string-safe role lookup; unknown roles fall back to `GenericSensor`. */
|
|
37
37
|
export declare function deviceRoleMetaOf(role: string): DeviceRoleMeta;
|
|
38
|
+
/**
|
|
39
|
+
* Icons an operator may pick for a per-device `display.icon` override, keyed by
|
|
40
|
+
* a stable kebab-case name. Built ONLY from the lucide icons already imported by
|
|
41
|
+
* this module — no new imports, no dynamic indexing — so it stays bundle-size
|
|
42
|
+
* neutral and the picker offers a curated, sensor-relevant set. Unknown keys
|
|
43
|
+
* resolve to `undefined` (caller keeps the role/type default).
|
|
44
|
+
*/
|
|
45
|
+
export declare const DISPLAY_ICON_REGISTRY: Readonly<Record<string, LucideIcon>>;
|
|
46
|
+
/** Resolve a `display.icon` name to a lucide component, or `undefined` when the
|
|
47
|
+
* name is not in the curated `DISPLAY_ICON_REGISTRY`. */
|
|
48
|
+
export declare function resolveDisplayIcon(name: string): LucideIcon | undefined;
|
|
38
49
|
export declare function allDeviceTypeFilterOptions(): readonly MultiSelectOption[];
|
|
@@ -399,6 +399,12 @@ export declare const useDeviceManagerSetPrimaryChildEntityId: typeof trpc.device
|
|
|
399
399
|
export declare const useDeviceManagerSetChildLayout: typeof trpc.deviceManager.setChildLayout.useMutation;
|
|
400
400
|
/** Generated alias around `trpc.deviceManager.setDeviceLinks.useMutation`. */
|
|
401
401
|
export declare const useDeviceManagerSetDeviceLinks: typeof trpc.deviceManager.setDeviceLinks.useMutation;
|
|
402
|
+
/** Generated alias around `trpc.deviceManager.setDisplay.useMutation`. */
|
|
403
|
+
export declare const useDeviceManagerSetDisplay: typeof trpc.deviceManager.setDisplay.useMutation;
|
|
404
|
+
/** Generated alias around `trpc.deviceManager.getRoleDisplayDefaults.useQuery`. */
|
|
405
|
+
export declare const useDeviceManagerGetRoleDisplayDefaults: typeof trpc.deviceManager.getRoleDisplayDefaults.useQuery;
|
|
406
|
+
/** Generated alias around `trpc.deviceManager.setRoleDisplayDefaults.useMutation`. */
|
|
407
|
+
export declare const useDeviceManagerSetRoleDisplayDefaults: typeof trpc.deviceManager.setRoleDisplayDefaults.useMutation;
|
|
402
408
|
/** Generated alias around `trpc.deviceManager.getWireableFields.useQuery`. */
|
|
403
409
|
export declare const useDeviceManagerGetWireableFields: typeof trpc.deviceManager.getWireableFields.useQuery;
|
|
404
410
|
/** Generated alias around `trpc.deviceManager.setRole.useMutation`. */
|