@camstack/ui-library 1.2.324 → 1.2.326
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/binary-battery.d.ts +8 -0
- package/dist/composites/device-controls/control-panel.d.ts +0 -2
- package/dist/composites/device-controls/sensor-value-atom.d.ts +6 -14
- package/dist/composites/index.d.ts +1 -0
- package/dist/index.cjs +211 -121
- package/dist/index.js +209 -123
- package/dist/lib/resolve-sensor-display.d.ts +22 -24
- package/package.json +10 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary battery copy lives with the badge. A binary source has no real
|
|
3
|
+
* percentage: normal is the full stand-in, low is anything under the threshold.
|
|
4
|
+
*/
|
|
5
|
+
export declare const BINARY_BATTERY_LOW_BELOW: number;
|
|
6
|
+
export declare const BATTERY_BADGE_LOW_KEY: "uiLibrary.batteryBadge.low";
|
|
7
|
+
export declare const BATTERY_BADGE_NORMAL_KEY: "uiLibrary.batteryBadge.normal";
|
|
8
|
+
export declare function binaryBatteryIsLow(percentage: number): boolean;
|
|
@@ -4,7 +4,5 @@ import type { ControlPanelProps } from "./types.js";
|
|
|
4
4
|
export declare function toDateInput(value: string): string;
|
|
5
5
|
/** Trim an HA time value ('HH:MM:SS') to the `<input type=time>` shape ('HH:MM'). */
|
|
6
6
|
export declare function toTimeInput(value: string): string;
|
|
7
|
-
/** Trim an HA datetime value to the `<input type=datetime-local>` shape
|
|
8
|
-
* ('YYYY-MM-DDTHH:MM'). Accepts both 'T'- and space-separated forms. */
|
|
9
7
|
export declare function toDateTimeInput(value: string): string;
|
|
10
8
|
export declare function ControlPanel({ trpc, deviceId, features: _features, layout, optimistic }: ControlPanelProps): ReactNode;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* at the call site; narrowing occurs after `useDeviceStateSlice`.
|
|
21
21
|
*/
|
|
22
22
|
import type { ReactNode } from "react";
|
|
23
|
-
import type { DeviceProxy, SliceHandle } from "@camstack/types";
|
|
23
|
+
import type { DeviceProxy, ReadingQuantity, SliceHandle } from "@camstack/types";
|
|
24
24
|
import { type UseDeviceProxyTrpc } from "../../hooks/use-device-proxy";
|
|
25
25
|
import { type ControlDateTimeFormat } from "../../lib/format-control-datetime";
|
|
26
26
|
import type { DeviceItemDevice } from "../device-item/helpers";
|
|
@@ -28,12 +28,8 @@ interface NumericDescriptor {
|
|
|
28
28
|
readonly kind: "numeric";
|
|
29
29
|
/** Field in the slice that holds the numeric value. */
|
|
30
30
|
readonly field: string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
* directly WITHOUT consulting the slice or sourceInfo.
|
|
34
|
-
* For the generic `numeric-sensor` role this is `undefined` — the unit is
|
|
35
|
-
* read live from the slice (`slice.unit`). */
|
|
36
|
-
readonly canonicalUnit?: string;
|
|
31
|
+
/** Quantity of the stored number. `device` reads `sourceInfo.quantity`. */
|
|
32
|
+
readonly quantity?: ReadingQuantity;
|
|
37
33
|
/** Accessor into DeviceProxy['state'] — returns a typed slice handle. */
|
|
38
34
|
readonly getSliceHandle: (state: DeviceProxy["state"]) => SliceHandle<unknown>;
|
|
39
35
|
}
|
|
@@ -99,13 +95,9 @@ export declare function hasBatteryNumericValue(slice: unknown, field: string): b
|
|
|
99
95
|
* avoids dynamic string indexing — each one is a concrete property
|
|
100
96
|
* access on the typed `DeviceProxy['state']` shape.
|
|
101
97
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* so no per-device lookup is needed.
|
|
106
|
-
* - Generic `numeric-sensor` has no `canonicalUnit`. The unit is read live
|
|
107
|
-
* from the slice (`slice.unit`) as populated by the provider from the
|
|
108
|
-
* upstream source on every state push.
|
|
98
|
+
* The unit comes from the descriptor's quantity through `resolveSensorDisplay`.
|
|
99
|
+
* A generic numeric sensor uses quantity `device` and the device's
|
|
100
|
+
* `sourceInfo.quantity`.
|
|
109
101
|
*/
|
|
110
102
|
export declare const ROLE_DESCRIPTOR: Record<string, SensorDescriptor>;
|
|
111
103
|
export interface StringSliceValue {
|
|
@@ -14,6 +14,7 @@ export type { AudioWaveformProps } from "./audio-waveform";
|
|
|
14
14
|
export { AudioWaveform } from "./audio-waveform";
|
|
15
15
|
export type { BatteryBadgeProps, BatteryStatusLike } from "./battery-badge";
|
|
16
16
|
export { BatteryBadge } from "./battery-badge";
|
|
17
|
+
export { BATTERY_BADGE_LOW_KEY, BATTERY_BADGE_NORMAL_KEY, BINARY_BATTERY_LOW_BELOW, binaryBatteryIsLow } from "./binary-battery";
|
|
17
18
|
export type { RunningBadgeProps, RunningStatusLineProps } from "./running-badge";
|
|
18
19
|
export { RunningBadge, RunningStatusLine } from "./running-badge";
|
|
19
20
|
export { runningDurationSince, runningStatusParts } from "./running-status";
|