@dominevo/ui-library 0.1.1 → 0.1.3
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/CHANGELOG.md +15 -0
- package/dist/composites/angle-range-arc/angle-range-arc.d.ts +22 -0
- package/dist/composites/angle-range-arc/angle-range.d.ts +35 -0
- package/dist/composites/angle-range-arc/index.d.ts +2 -0
- package/dist/composites/app-shell/index.d.ts +2 -0
- package/dist/composites/app-shell/sidebar-accent.d.ts +16 -0
- package/dist/composites/app-shell/sidebar-section.d.ts +16 -0
- package/dist/composites/device-card/__fixtures__/heat-pump.d.ts +1 -0
- package/dist/composites/device-card/parts/ButtonGroup.d.ts +10 -2
- package/dist/composites/device-card/scenes/fan/model.d.ts +2 -2
- package/dist/composites/device-card/scenes/heat-pump/HeatPumpCard.d.ts +4 -2
- package/dist/composites/device-card/scenes/heat-pump/model.d.ts +6 -0
- package/dist/composites/device-card/shell/DeviceCard.d.ts +17 -1
- package/dist/composites/index.d.ts +1 -0
- package/dist/composites/setting-row.d.ts +6 -1
- package/dist/generated/system-hooks.d.ts +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-collapsed-sections.d.ts +6 -0
- package/dist/index.cjs +893 -134
- package/dist/index.js +875 -134
- package/dist/lib/responsive.d.ts +10 -0
- package/dist/primitives/dropdown.d.ts +3 -1
- package/package.json +1 -1
- package/src/tailwind/dominevo-theme.css +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.3] - 2026-11-29
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Dropdown content can open above its trigger (side="top")
|
|
15
|
+
- Sidebar section accent tokens, a foldable SidebarSectionGroup and useCollapsedSections
|
|
16
|
+
|
|
17
|
+
## [0.1.2] - 2026-11-29
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- A setting row can keep its whole value visible (wrapValue); the HomeKit bridge setup code in the export dialog is no longer cut off
|
|
22
|
+
- Device cards can carry several swappable scenes with a switcher and a swipe; the heat-pump card shows Overview, Circuits, Hot water and System.
|
|
23
|
+
- The fan card's oscillation axes open an arc with two draggable handles, a span readout, symmetric / asymmetric editing and quick spans, snapped to the device's step and never below its minimum span
|
|
24
|
+
|
|
10
25
|
## [0.1.1] - 2026-11-28
|
|
11
26
|
|
|
12
27
|
### Changed
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type AngleBounds, type AngleRange } from "./angle-range";
|
|
3
|
+
export type AngleArcOrientation = "horizontal" | "vertical";
|
|
4
|
+
export interface AngleRangeArcProps extends AngleBounds {
|
|
5
|
+
readonly from: number;
|
|
6
|
+
readonly to: number;
|
|
7
|
+
/** `horizontal`: the arc opens downward from a pivot at the top. `vertical`: it opens to the right from a pivot at the left, positive angles up. */
|
|
8
|
+
readonly orientation?: AngleArcOrientation;
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
/** The range to send, once per gesture: on release, after a keyboard pause, on a preset. */
|
|
11
|
+
readonly onCommit: (range: AngleRange) => void;
|
|
12
|
+
/** Name of the arc for assistive technology ("Horizontal oscillation"). */
|
|
13
|
+
readonly ariaLabel: string;
|
|
14
|
+
readonly testId?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An angle range on an arc: two draggable handles, the span in the middle,
|
|
18
|
+
* symmetric / asymmetric editing and quick spans. Generic: the bounds, the
|
|
19
|
+
* step and the narrowest span come from the caller (a device's reported
|
|
20
|
+
* limits), never from here. Pointer and keyboard; one commit per gesture.
|
|
21
|
+
*/
|
|
22
|
+
export declare function AngleRangeArc({ from, to, min, max, step, minSpan, orientation, disabled, onCommit, ariaLabel, testId }: AngleRangeArcProps): ReactElement;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The bounds an angle range lives in, as the device reports them (degrees). */
|
|
2
|
+
export interface AngleBounds {
|
|
3
|
+
readonly min: number;
|
|
4
|
+
readonly max: number;
|
|
5
|
+
readonly step: number;
|
|
6
|
+
/** The narrowest span the device accepts; null when it states none. */
|
|
7
|
+
readonly minSpan: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface AngleRange {
|
|
10
|
+
readonly from: number;
|
|
11
|
+
readonly to: number;
|
|
12
|
+
}
|
|
13
|
+
export type AngleHandle = "from" | "to";
|
|
14
|
+
/** A value on the step grid anchored at `min`, inside the bounds. */
|
|
15
|
+
export declare function snapAngle(value: number, bounds: AngleBounds): number;
|
|
16
|
+
/** A range the device would accept: inside the bounds and at least minSpan wide. */
|
|
17
|
+
export declare function isValidRange(range: AngleRange, bounds: AngleBounds): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Moves one handle toward `target`. Asymmetric: the other end stays.
|
|
20
|
+
* Symmetric: both ends follow around the centre, snapped to the grid (an
|
|
21
|
+
* off-grid centre moves to the nearest half step, the nearest centre on which
|
|
22
|
+
* both ends can sit on the grid). Every exit returns a valid range or the
|
|
23
|
+
* range it was given, unchanged: a move that cannot be valid is refused, never
|
|
24
|
+
* clamped into an invalid one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function moveHandle(range: AngleRange, handle: AngleHandle, target: number, bounds: AngleBounds, symmetric: boolean): AngleRange;
|
|
27
|
+
/** True when both ends sit equally around zero. */
|
|
28
|
+
export declare function isSymmetric(range: AngleRange): boolean;
|
|
29
|
+
/** The quick-set spans the bounds and step allow. */
|
|
30
|
+
export declare function presetSpans(bounds: AngleBounds): readonly number[];
|
|
31
|
+
/** A range of `span` degrees on the current centre, shifted to fit the bounds; the range itself when none fits. */
|
|
32
|
+
export declare function applyPreset(range: AngleRange, span: number, bounds: AngleBounds): AngleRange;
|
|
33
|
+
/** A value as degrees of arc from the middle of the bounds (0 = straight ahead). */
|
|
34
|
+
export declare function valueToAngle(value: number, bounds: AngleBounds): number;
|
|
35
|
+
export declare function angleToValue(angle: number, bounds: AngleBounds): number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar section accents. The colours are theme tokens (`--color-section-*`
|
|
3
|
+
* in `dominevo-theme.css`); the class strings are spelled out in full so
|
|
4
|
+
* Tailwind sees them. Which section uses which accent is decided once, by
|
|
5
|
+
* the host (admin-ui `lib/nav-accent.ts`).
|
|
6
|
+
*/
|
|
7
|
+
export type SidebarAccent = "devices" | "detection" | "cluster" | "admin" | "addons";
|
|
8
|
+
export interface SidebarAccentClasses {
|
|
9
|
+
/** Tinted chip behind a section-header icon. */
|
|
10
|
+
readonly chip: string;
|
|
11
|
+
/** Icon tint of the active item. */
|
|
12
|
+
readonly icon: string;
|
|
13
|
+
/** Thin left bar of the active item (pseudo-element background). */
|
|
14
|
+
readonly bar: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const SIDEBAR_ACCENT_CLASSES: Readonly<Record<SidebarAccent, SidebarAccentClasses>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type JSX, type ReactNode } from "react";
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import { type SidebarAccent } from "./sidebar-accent";
|
|
4
|
+
export interface SidebarSectionGroupProps {
|
|
5
|
+
label: string;
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
accent: SidebarAccent;
|
|
8
|
+
/** The operator folded it. Ignored while `forcedOpen`. */
|
|
9
|
+
collapsed: boolean;
|
|
10
|
+
/** The current route lives here: always open, the header does not fold it. */
|
|
11
|
+
forcedOpen?: boolean;
|
|
12
|
+
onToggle: () => void;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A foldable sidebar section: tinted icon chip + label header, then its items. */
|
|
16
|
+
export declare function SidebarSectionGroup({ label, icon: Icon, accent, collapsed, forcedOpen, onToggle, children }: SidebarSectionGroupProps): JSX.Element;
|
|
@@ -8,6 +8,7 @@ export interface HeatPumpFixture {
|
|
|
8
8
|
readonly id: string;
|
|
9
9
|
readonly caption: string;
|
|
10
10
|
readonly orientation: CardOrientation;
|
|
11
|
+
readonly initialScene?: string;
|
|
11
12
|
readonly model: HeatPumpCardModel;
|
|
12
13
|
}
|
|
13
14
|
export declare function heatPumpFixtures(): readonly HeatPumpFixture[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
2
|
import type { CardGlyph } from "../icons";
|
|
3
3
|
export interface ButtonGroupOption {
|
|
4
4
|
readonly id: string;
|
|
@@ -21,6 +21,14 @@ export interface ButtonGroupProps {
|
|
|
21
21
|
* joined strip of commands, none pressed; `value` is ignored.
|
|
22
22
|
*/
|
|
23
23
|
readonly mode?: "choice" | "actions";
|
|
24
|
+
/**
|
|
25
|
+
* The radio pattern for a choice that swaps a view (a tab strip): one tab
|
|
26
|
+
* stop on the chosen chip, Left / Right / Home / End move and choose. Off by
|
|
27
|
+
* default: a settings choice keeps every chip tabbable.
|
|
28
|
+
*/
|
|
29
|
+
readonly roving?: boolean;
|
|
30
|
+
/** The id of the panel each chip controls (`aria-controls`), per option id. */
|
|
31
|
+
readonly panelId?: (optionId: string) => string;
|
|
24
32
|
}
|
|
25
33
|
/** A row of mutually exclusive chips (presets, heat / cool / auto). */
|
|
26
|
-
export declare function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates, testId, mode }: ButtonGroupProps): ReactElement;
|
|
34
|
+
export declare function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates, testId, mode, roving, panelId }: ButtonGroupProps): ReactElement;
|
|
@@ -15,6 +15,8 @@ export interface FanAxisModel {
|
|
|
15
15
|
readonly min: number;
|
|
16
16
|
readonly max: number;
|
|
17
17
|
readonly step: number;
|
|
18
|
+
/** The narrowest sweep the device accepts; null when it states none. */
|
|
19
|
+
readonly minSpan: number | null;
|
|
18
20
|
}
|
|
19
21
|
export interface FanAxisPatch {
|
|
20
22
|
readonly oscillating?: boolean;
|
|
@@ -71,7 +73,5 @@ export interface FanCardActions extends CardCommonActions, SwitchTimerActions {
|
|
|
71
73
|
readonly onOscillating: (oscillating: boolean) => void;
|
|
72
74
|
readonly onAxis: (axis: FanAxisName, patch: FanAxisPatch) => void;
|
|
73
75
|
}
|
|
74
|
-
/** The narrowest sweep the card lets an operator set, in degrees. */
|
|
75
|
-
export declare const FAN_MIN_SWEEP = 10;
|
|
76
76
|
/** "+45°", "-30°", "0°". */
|
|
77
77
|
export declare const signedDegrees: (v: number) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
2
|
import { type UiTextFn } from "../../../../contexts/ui-text";
|
|
3
3
|
import type { CardOrientation } from "../../shell/model";
|
|
4
4
|
import type { HeatPumpActivity, HeatPumpCardActions, HeatPumpCardModel } from "./model";
|
|
@@ -7,6 +7,8 @@ export interface HeatPumpCardProps {
|
|
|
7
7
|
readonly actions: HeatPumpCardActions;
|
|
8
8
|
readonly orientation?: CardOrientation;
|
|
9
9
|
readonly showName?: boolean;
|
|
10
|
+
/** The scene shown first: `overview` (default), `circuits`, `hotWater` or `system`. */
|
|
11
|
+
readonly initialScene?: string;
|
|
10
12
|
}
|
|
11
13
|
export declare function heatPumpStateLabel(activity: HeatPumpActivity, t: UiTextFn): string;
|
|
12
14
|
/**
|
|
@@ -16,4 +18,4 @@ export declare function heatPumpStateLabel(activity: HeatPumpActivity, t: UiText
|
|
|
16
18
|
* hot-water level) and the system modes the gateway declares. A value the
|
|
17
19
|
* gateway does not report is a dash, never a zero.
|
|
18
20
|
*/
|
|
19
|
-
export declare function HeatPumpCard({ model, actions, orientation, showName }: HeatPumpCardProps): ReactElement;
|
|
21
|
+
export declare function HeatPumpCard({ model, actions, orientation, showName, initialScene }: HeatPumpCardProps): ReactElement;
|
|
@@ -14,7 +14,13 @@ export interface HeatPumpCircuitPicker {
|
|
|
14
14
|
}
|
|
15
15
|
export interface HeatPumpCircuitView {
|
|
16
16
|
readonly id: string;
|
|
17
|
+
/** Hot water has its own scene; every other circuit is a heating / cooling one. */
|
|
18
|
+
readonly group: "heating" | "hotWater";
|
|
17
19
|
readonly label: string;
|
|
20
|
+
/** Measured temperature, already formatted; null when the gateway reports none. */
|
|
21
|
+
readonly current: string | null;
|
|
22
|
+
/** The setpoint in force, already formatted; null when the gateway reports none. */
|
|
23
|
+
readonly target: string | null;
|
|
18
24
|
/** What the circuit is doing, in words ("Heating", "53°"). */
|
|
19
25
|
readonly status: string;
|
|
20
26
|
/** The secondary detail ("21° · flow 30°", "Eco"); null when there is none. */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { CardCommon, CardCommonActions, CardFault, CardOrientation, CardState } from "./model";
|
|
3
3
|
import { type SceneZones } from "./SceneGrid";
|
|
4
|
+
/** One swappable scene of a multi-view card: the switcher chip and the zones it draws. */
|
|
5
|
+
export interface DeviceCardSceneView {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly scene: SceneZones;
|
|
9
|
+
}
|
|
4
10
|
export interface DeviceCardProps {
|
|
5
11
|
/** The device type the scene draws (`plug`, `climate`): a hook for specs and shots. */
|
|
6
12
|
readonly kind: string;
|
|
@@ -11,6 +17,16 @@ export interface DeviceCardProps {
|
|
|
11
17
|
/** What the device is doing, for the scene's colour and animation. */
|
|
12
18
|
readonly activity?: string;
|
|
13
19
|
readonly scene: SceneZones;
|
|
20
|
+
/**
|
|
21
|
+
* Several scenes on one card (heat pump: overview, circuits, hot water).
|
|
22
|
+
* With two or more, the card draws a switcher above the scene and a
|
|
23
|
+
* horizontal swipe on the scene moves to the next / previous one; `scene`
|
|
24
|
+
* is the fallback while fewer than two are given. One view is not a choice,
|
|
25
|
+
* so no switcher is drawn.
|
|
26
|
+
*/
|
|
27
|
+
readonly sceneViews?: readonly DeviceCardSceneView[];
|
|
28
|
+
/** The id of the scene shown first (default: the first of `sceneViews`). */
|
|
29
|
+
readonly initialSceneView?: string;
|
|
14
30
|
readonly className?: string;
|
|
15
31
|
/** Draw the device name (default true); false when the host already names the device. */
|
|
16
32
|
readonly showName?: boolean;
|
|
@@ -78,4 +94,4 @@ export declare function CardTop({ common }: {
|
|
|
78
94
|
* four corners, the bottom line, the history and remote views and the gating;
|
|
79
95
|
* a scene only fills the zones.
|
|
80
96
|
*/
|
|
81
|
-
export declare function DeviceCard({ kind, common, actions, orientation, state, activity, scene, className, showName, remoteExtra, initialView, frame, historyView }: DeviceCardProps): ReactElement;
|
|
97
|
+
export declare function DeviceCard({ kind, common, actions, orientation, state, activity, scene, sceneViews, initialSceneView, className, showName, remoteExtra, initialView, frame, historyView }: DeviceCardProps): ReactElement;
|
|
@@ -126,6 +126,7 @@ export type { ActivityTabId, DeviceActivityPanelProps } from "./device-activity-
|
|
|
126
126
|
export { DeviceActivityPanel } from "./device-activity-panel";
|
|
127
127
|
export * from "./device-summary-card";
|
|
128
128
|
export * from "./device-card";
|
|
129
|
+
export * from "./angle-range-arc";
|
|
129
130
|
export * from "./remote";
|
|
130
131
|
export * from "./device-controls";
|
|
131
132
|
export * from "./hero-scene";
|
|
@@ -38,5 +38,10 @@ export interface SettingRowProps {
|
|
|
38
38
|
readonly className?: string;
|
|
39
39
|
/** Extra classes on the value text (e.g. `font-mono`). */
|
|
40
40
|
readonly valueClassName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Keep the whole value visible at every width: it stays on one line instead of truncating, and the row
|
|
43
|
+
* stacks the value under the label when they do not fit side by side. For a value the operator must read or type in full (a pairing code, a key).
|
|
44
|
+
*/
|
|
45
|
+
readonly wrapValue?: boolean;
|
|
41
46
|
}
|
|
42
|
-
export declare function SettingRow({ label, children, actions, elements, className, valueClassName }: SettingRowProps): ReactNode;
|
|
47
|
+
export declare function SettingRow({ label, children, actions, elements, className, valueClassName, wrapValue }: SettingRowProps): ReactNode;
|
|
@@ -801,6 +801,14 @@ export declare const useDeviceMeshGetNodeDiagnostics: typeof trpc.deviceMesh.get
|
|
|
801
801
|
export declare const useDeviceMeshReadNow: typeof trpc.deviceMesh.readNow.useMutation;
|
|
802
802
|
/** Generated alias around `trpc.deviceMesh.refresh.useMutation`. */
|
|
803
803
|
export declare const useDeviceMeshRefresh: typeof trpc.deviceMesh.refresh.useMutation;
|
|
804
|
+
/** Generated alias around `trpc.deviceMesh.getFeatures.useQuery`. */
|
|
805
|
+
export declare const useDeviceMeshGetFeatures: typeof trpc.deviceMesh.getFeatures.useQuery;
|
|
806
|
+
/** Generated alias around `trpc.deviceMesh.openJoin.useMutation`. */
|
|
807
|
+
export declare const useDeviceMeshOpenJoin: typeof trpc.deviceMesh.openJoin.useMutation;
|
|
808
|
+
/** Generated alias around `trpc.deviceMesh.getJoinState.useQuery`. */
|
|
809
|
+
export declare const useDeviceMeshGetJoinState: typeof trpc.deviceMesh.getJoinState.useQuery;
|
|
810
|
+
/** Generated alias around `trpc.deviceMesh.removeNode.useMutation`. */
|
|
811
|
+
export declare const useDeviceMeshRemoveNode: typeof trpc.deviceMesh.removeNode.useMutation;
|
|
804
812
|
/** Generated alias around `trpc.deviceOps.getStreamSources.useQuery`. */
|
|
805
813
|
export declare const useDeviceOpsGetStreamSources: typeof trpc.deviceOps.getStreamSources.useQuery;
|
|
806
814
|
/** Generated alias around `trpc.deviceOps.getConfigEntries.useQuery`. */
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { useDoorbellEvents } from "./use-doorbell-events";
|
|
|
46
46
|
export { useEventInvalidation } from "./use-event-invalidation";
|
|
47
47
|
export { useEventStreamLatest, useEventStreamMap } from "./use-event-stream";
|
|
48
48
|
export { useIsMidWidth, useIsMobile, useIsPhone } from "./use-is-mobile";
|
|
49
|
+
export { useCollapsedSections, type CollapsedSections } from "./use-collapsed-sections";
|
|
49
50
|
export type { LiveBuffer } from "./use-live-buffer";
|
|
50
51
|
export { useLiveBuffer } from "./use-live-buffer";
|
|
51
52
|
export { type LiveEventCallback, useLiveEvent } from "./use-live-event";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface CollapsedSections {
|
|
2
|
+
isCollapsed: (id: string) => boolean;
|
|
3
|
+
toggle: (id: string) => void;
|
|
4
|
+
}
|
|
5
|
+
/** Which sections the operator folded, remembered per browser. Absent = open. */
|
|
6
|
+
export declare function useCollapsedSections(storageKey: string): CollapsedSections;
|