@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/dist/index.cjs
CHANGED
|
@@ -13178,6 +13178,14 @@ var useDeviceMeshGetNodeDiagnostics = /*#__PURE__*/ alias(() => trpc.deviceMesh.
|
|
|
13178
13178
|
var useDeviceMeshReadNow = /*#__PURE__*/ alias(() => trpc.deviceMesh.readNow.useMutation);
|
|
13179
13179
|
/** Generated alias around `trpc.deviceMesh.refresh.useMutation`. */
|
|
13180
13180
|
var useDeviceMeshRefresh = /*#__PURE__*/ alias(() => trpc.deviceMesh.refresh.useMutation);
|
|
13181
|
+
/** Generated alias around `trpc.deviceMesh.getFeatures.useQuery`. */
|
|
13182
|
+
var useDeviceMeshGetFeatures = /*#__PURE__*/ alias(() => trpc.deviceMesh.getFeatures.useQuery);
|
|
13183
|
+
/** Generated alias around `trpc.deviceMesh.openJoin.useMutation`. */
|
|
13184
|
+
var useDeviceMeshOpenJoin = /*#__PURE__*/ alias(() => trpc.deviceMesh.openJoin.useMutation);
|
|
13185
|
+
/** Generated alias around `trpc.deviceMesh.getJoinState.useQuery`. */
|
|
13186
|
+
var useDeviceMeshGetJoinState = /*#__PURE__*/ alias(() => trpc.deviceMesh.getJoinState.useQuery);
|
|
13187
|
+
/** Generated alias around `trpc.deviceMesh.removeNode.useMutation`. */
|
|
13188
|
+
var useDeviceMeshRemoveNode = /*#__PURE__*/ alias(() => trpc.deviceMesh.removeNode.useMutation);
|
|
13181
13189
|
/** Generated alias around `trpc.deviceOps.getStreamSources.useQuery`. */
|
|
13182
13190
|
var useDeviceOpsGetStreamSources = /*#__PURE__*/ alias(() => trpc.deviceOps.getStreamSources.useQuery);
|
|
13183
13191
|
/** Generated alias around `trpc.deviceOps.getConfigEntries.useQuery`. */
|
|
@@ -39273,6 +39281,16 @@ var SETTING_ROW_VALUE = "flex w-full min-w-0 items-center gap-1 sm:flex-1";
|
|
|
39273
39281
|
* rather than data loss.
|
|
39274
39282
|
*/
|
|
39275
39283
|
var SETTING_ROW_VALUE_TEXT = "min-w-0 break-all text-xs text-foreground sm:truncate";
|
|
39284
|
+
/**
|
|
39285
|
+
* The value text of a row whose value must be read in full (a pairing code): one line, never cut
|
|
39286
|
+
* mid-character. When it does not fit beside the label the row stacks (`SETTING_ROW_WRAP`), and
|
|
39287
|
+
* a value longer than the whole row scrolls sideways instead of losing characters.
|
|
39288
|
+
*/
|
|
39289
|
+
var SETTING_ROW_VALUE_TEXT_WRAP = "min-w-0 max-w-full overflow-x-auto whitespace-nowrap text-xs text-foreground";
|
|
39290
|
+
/** Outer-row additions for a non-truncating value: the value lane drops under the label. */
|
|
39291
|
+
var SETTING_ROW_WRAP = "sm:flex-wrap";
|
|
39292
|
+
/** Value-lane additions for a non-truncating value: sized by its content, so it can wrap down. */
|
|
39293
|
+
var SETTING_ROW_VALUE_WRAP = "sm:w-auto sm:flex-auto";
|
|
39276
39294
|
/** Section header label (uppercase tracking-wider). */
|
|
39277
39295
|
var TEXT_SECTION_LABEL = "text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider";
|
|
39278
39296
|
/** Field label inside a row. */
|
|
@@ -40216,7 +40234,7 @@ function DropdownTrigger({ children, ...props }) {
|
|
|
40216
40234
|
children
|
|
40217
40235
|
});
|
|
40218
40236
|
}
|
|
40219
|
-
function DropdownContent({ className, children, align = "start", offset = 4, ...props }) {
|
|
40237
|
+
function DropdownContent({ className, children, align = "start", offset = 4, side = "bottom", ...props }) {
|
|
40220
40238
|
const { open, setOpen, contentId, triggerId, triggerRef } = useDropdownContext();
|
|
40221
40239
|
const ref = (0, react$1.useRef)(null);
|
|
40222
40240
|
const [coords, setCoords] = (0, react$1.useState)(null);
|
|
@@ -40232,6 +40250,7 @@ function DropdownContent({ className, children, align = "start", offset = 4, ...
|
|
|
40232
40250
|
const left = align === "end" ? rect.right : rect.left;
|
|
40233
40251
|
setCoords({
|
|
40234
40252
|
top: rect.bottom + offset,
|
|
40253
|
+
bottom: window.innerHeight - rect.top + offset,
|
|
40235
40254
|
left,
|
|
40236
40255
|
minWidth: rect.width
|
|
40237
40256
|
});
|
|
@@ -40284,7 +40303,7 @@ function DropdownContent({ className, children, align = "start", offset = 4, ...
|
|
|
40284
40303
|
"aria-labelledby": triggerId,
|
|
40285
40304
|
style: {
|
|
40286
40305
|
position: "fixed",
|
|
40287
|
-
top: coords.top,
|
|
40306
|
+
...side === "top" ? { bottom: coords.bottom } : { top: coords.top },
|
|
40288
40307
|
...align === "end" ? { right: window.innerWidth - coords.left } : { left: coords.left },
|
|
40289
40308
|
minWidth: coords.minWidth
|
|
40290
40309
|
},
|
|
@@ -41075,6 +41094,71 @@ function AppShell({ sidebar, header, mobileLogo, mobileActions, children, classN
|
|
|
41075
41094
|
});
|
|
41076
41095
|
}
|
|
41077
41096
|
//#endregion
|
|
41097
|
+
//#region src/composites/app-shell/sidebar-accent.ts
|
|
41098
|
+
var SIDEBAR_ACCENT_CLASSES = {
|
|
41099
|
+
devices: {
|
|
41100
|
+
chip: "bg-section-devices/15 text-section-devices",
|
|
41101
|
+
icon: "text-section-devices",
|
|
41102
|
+
bar: "before:bg-section-devices"
|
|
41103
|
+
},
|
|
41104
|
+
detection: {
|
|
41105
|
+
chip: "bg-section-detection/15 text-section-detection",
|
|
41106
|
+
icon: "text-section-detection",
|
|
41107
|
+
bar: "before:bg-section-detection"
|
|
41108
|
+
},
|
|
41109
|
+
cluster: {
|
|
41110
|
+
chip: "bg-section-cluster/15 text-section-cluster",
|
|
41111
|
+
icon: "text-section-cluster",
|
|
41112
|
+
bar: "before:bg-section-cluster"
|
|
41113
|
+
},
|
|
41114
|
+
admin: {
|
|
41115
|
+
chip: "bg-section-admin/15 text-section-admin",
|
|
41116
|
+
icon: "text-section-admin",
|
|
41117
|
+
bar: "before:bg-section-admin"
|
|
41118
|
+
},
|
|
41119
|
+
addons: {
|
|
41120
|
+
chip: "bg-section-addons/15 text-section-addons",
|
|
41121
|
+
icon: "text-section-addons",
|
|
41122
|
+
bar: "before:bg-section-addons"
|
|
41123
|
+
}
|
|
41124
|
+
};
|
|
41125
|
+
//#endregion
|
|
41126
|
+
//#region src/composites/app-shell/sidebar-section.tsx
|
|
41127
|
+
/** A foldable sidebar section: tinted icon chip + label header, then its items. */
|
|
41128
|
+
function SidebarSectionGroup({ label, icon: Icon, accent, collapsed, forcedOpen = false, onToggle, children }) {
|
|
41129
|
+
const bodyId = (0, react$1.useId)();
|
|
41130
|
+
const open = forcedOpen || !collapsed;
|
|
41131
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
41132
|
+
className: "pt-3",
|
|
41133
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
41134
|
+
variant: "unstyled",
|
|
41135
|
+
"aria-expanded": open,
|
|
41136
|
+
"aria-controls": bodyId,
|
|
41137
|
+
"aria-disabled": forcedOpen || void 0,
|
|
41138
|
+
onClick: () => {
|
|
41139
|
+
if (!forcedOpen) onToggle();
|
|
41140
|
+
},
|
|
41141
|
+
className: "flex w-full items-center gap-2 rounded-md px-2.5 py-1 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
41142
|
+
children: [
|
|
41143
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
41144
|
+
className: cn("flex h-5 w-5 shrink-0 items-center justify-center rounded-md", SIDEBAR_ACCENT_CLASSES[accent].chip),
|
|
41145
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "h-3 w-3" })
|
|
41146
|
+
}),
|
|
41147
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
41148
|
+
className: "flex-1 truncate text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle",
|
|
41149
|
+
children: label
|
|
41150
|
+
}),
|
|
41151
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chevron_down.ChevronDown, { className: cn("h-3 w-3 shrink-0 text-foreground-subtle transition-transform", !open && "-rotate-90", forcedOpen && "opacity-30") })
|
|
41152
|
+
]
|
|
41153
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
41154
|
+
id: bodyId,
|
|
41155
|
+
hidden: !open,
|
|
41156
|
+
className: "mt-1 space-y-0.5",
|
|
41157
|
+
children
|
|
41158
|
+
})]
|
|
41159
|
+
});
|
|
41160
|
+
}
|
|
41161
|
+
//#endregion
|
|
41078
41162
|
//#region src/composites/audio-classification-list.tsx
|
|
41079
41163
|
function scoreColor(score) {
|
|
41080
41164
|
if (score >= .8) return "bg-emerald-500";
|
|
@@ -45390,22 +45474,22 @@ function DataTable({ columns, rows, rowKey, onRowClick, sheetOpenLabel, sheetTit
|
|
|
45390
45474
|
}
|
|
45391
45475
|
//#endregion
|
|
45392
45476
|
//#region src/composites/setting-row.tsx
|
|
45393
|
-
function SettingRow({ label, children, actions, elements = "plain", className, valueClassName }) {
|
|
45477
|
+
function SettingRow({ label, children, actions, elements = "plain", className, valueClassName, wrapValue = false }) {
|
|
45394
45478
|
const LabelTag = elements === "description" ? "dt" : "span";
|
|
45395
45479
|
const ValueTag = elements === "description" ? "dd" : "div";
|
|
45396
45480
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
45397
45481
|
"data-setting-row": "",
|
|
45398
|
-
className: cn(SETTING_ROW, className),
|
|
45482
|
+
className: cn(SETTING_ROW, wrapValue && "sm:flex-wrap", className),
|
|
45399
45483
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LabelTag, {
|
|
45400
45484
|
"data-setting-row-label": "",
|
|
45401
45485
|
className: SETTING_ROW_LABEL,
|
|
45402
45486
|
children: label
|
|
45403
45487
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ValueTag, {
|
|
45404
45488
|
"data-setting-row-value": "",
|
|
45405
|
-
className: SETTING_ROW_VALUE,
|
|
45489
|
+
className: cn(SETTING_ROW_VALUE, wrapValue && "sm:w-auto sm:flex-auto"),
|
|
45406
45490
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
45407
45491
|
"data-setting-row-value-text": "",
|
|
45408
|
-
className: cn(SETTING_ROW_VALUE_TEXT, valueClassName),
|
|
45492
|
+
className: cn(wrapValue ? SETTING_ROW_VALUE_TEXT_WRAP : SETTING_ROW_VALUE_TEXT, valueClassName),
|
|
45409
45493
|
children
|
|
45410
45494
|
}), actions !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
45411
45495
|
className: "flex shrink-0 items-center gap-0.5",
|
|
@@ -50934,21 +51018,21 @@ function visibleLogColumns(input) {
|
|
|
50934
51018
|
//#endregion
|
|
50935
51019
|
//#region src/hooks/use-log-stream-columns.ts
|
|
50936
51020
|
var STORAGE_KEY = "dominevo.logStream.columns";
|
|
50937
|
-
function readStored$
|
|
51021
|
+
function readStored$2() {
|
|
50938
51022
|
try {
|
|
50939
51023
|
return parseStoredLogColumns(localStorage.getItem(STORAGE_KEY));
|
|
50940
51024
|
} catch {
|
|
50941
51025
|
return {};
|
|
50942
51026
|
}
|
|
50943
51027
|
}
|
|
50944
|
-
function writeStored$
|
|
51028
|
+
function writeStored$2(value) {
|
|
50945
51029
|
try {
|
|
50946
51030
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
50947
51031
|
} catch {}
|
|
50948
51032
|
}
|
|
50949
51033
|
/** The table's optional columns: what the code offers, what the viewer switched on or off. */
|
|
50950
51034
|
function useLogStreamColumns(scope, config) {
|
|
50951
|
-
const [stored, setStored] = (0, react$1.useState)(readStored$
|
|
51035
|
+
const [stored, setStored] = (0, react$1.useState)(readStored$2);
|
|
50952
51036
|
const available = (0, react$1.useMemo)(() => availableLogColumns(scope, config), [
|
|
50953
51037
|
scope.addonId,
|
|
50954
51038
|
scope.deviceId,
|
|
@@ -50971,7 +51055,7 @@ function useLogStreamColumns(scope, config) {
|
|
|
50971
51055
|
...prev,
|
|
50972
51056
|
[id]: shown
|
|
50973
51057
|
};
|
|
50974
|
-
writeStored$
|
|
51058
|
+
writeStored$2(next);
|
|
50975
51059
|
return next;
|
|
50976
51060
|
});
|
|
50977
51061
|
}, [])
|
|
@@ -54804,19 +54888,6 @@ var DEVICE_CARD_CSS = `
|
|
|
54804
54888
|
@media (prefers-reduced-motion:reduce){.dc-fx *,.dc-fx{animation:none!important}.dc-fx-p,.dc-fx-air,.dc-fx-wisps,.dc-fx-draft,.dc-fx-breeze{display:none}.dc-poe *,.dc-fan *,.dc-fan,.dc-heater *,.dc-appl *,.dc-robot *,.dc-hp *,.dc-tank *,.dc-energy *,.dc-station *,.dc-station{animation:none!important}.dc-station-vane{transition:none}}
|
|
54805
54889
|
`;
|
|
54806
54890
|
//#endregion
|
|
54807
|
-
//#region src/composites/device-card/parts/ValueChip.tsx
|
|
54808
|
-
/** A small read-only pill (integration name, an offline note, a reading). */
|
|
54809
|
-
function ValueChip({ glyph, children, tone = "default", className, "data-testid": testId }) {
|
|
54810
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
54811
|
-
"data-testid": testId,
|
|
54812
|
-
className: cn("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs", tone === "danger" && "bg-danger/10 text-danger", tone === "warning" && "bg-warning/10 text-warning", tone === "default" && "bg-surface-hover text-foreground-muted", className),
|
|
54813
|
-
children: [glyph === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardIcon, {
|
|
54814
|
-
glyph,
|
|
54815
|
-
className: "h-3 w-3"
|
|
54816
|
-
}), children]
|
|
54817
|
-
});
|
|
54818
|
-
}
|
|
54819
|
-
//#endregion
|
|
54820
54891
|
//#region src/composites/device-card/shell/gating.tsx
|
|
54821
54892
|
/**
|
|
54822
54893
|
* Why a card cannot be commanded, decided ONCE by the shell (offline, or the
|
|
@@ -54839,7 +54910,8 @@ function useCardGating() {
|
|
|
54839
54910
|
//#endregion
|
|
54840
54911
|
//#region src/composites/device-card/parts/ButtonGroup.tsx
|
|
54841
54912
|
/** A row of mutually exclusive chips (presets, heat / cool / auto). */
|
|
54842
|
-
function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates = true, testId, mode = "choice" }) {
|
|
54913
|
+
function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates = true, testId, mode = "choice", roving = false, panelId }) {
|
|
54914
|
+
const groupRef = (0, react$1.useRef)(null);
|
|
54843
54915
|
const shell = useCardGating();
|
|
54844
54916
|
const gating = actuates ? shell : {
|
|
54845
54917
|
blocked: false,
|
|
@@ -54864,16 +54936,32 @@ function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates =
|
|
|
54864
54936
|
}), o.label]
|
|
54865
54937
|
}, o.id))
|
|
54866
54938
|
});
|
|
54939
|
+
const current = options.findIndex((o) => o.id === value);
|
|
54940
|
+
const tabStop = current >= 0 ? current : 0;
|
|
54941
|
+
const onKeyDown = (e) => {
|
|
54942
|
+
if (!roving || off || options.length === 0) return;
|
|
54943
|
+
const from = current >= 0 ? current : 0;
|
|
54944
|
+
const to = e.key === "ArrowRight" || e.key === "ArrowDown" ? (from + 1) % options.length : e.key === "ArrowLeft" || e.key === "ArrowUp" ? (from - 1 + options.length) % options.length : e.key === "Home" ? 0 : e.key === "End" ? options.length - 1 : -1;
|
|
54945
|
+
const next = options[to];
|
|
54946
|
+
if (next === void 0) return;
|
|
54947
|
+
e.preventDefault();
|
|
54948
|
+
onChange(next.id);
|
|
54949
|
+
groupRef.current?.querySelectorAll("[role=\"radio\"]")[to]?.focus();
|
|
54950
|
+
};
|
|
54867
54951
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
54952
|
+
ref: groupRef,
|
|
54868
54953
|
role: "radiogroup",
|
|
54869
54954
|
"aria-label": ariaLabel,
|
|
54955
|
+
onKeyDown,
|
|
54870
54956
|
"data-testid": testId,
|
|
54871
54957
|
className: cn("flex flex-wrap justify-center gap-1.5", gating.blocked && "dc-gated"),
|
|
54872
|
-
children: options.map((o) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
54958
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
54873
54959
|
type: "button",
|
|
54874
54960
|
variant: "unstyled",
|
|
54875
54961
|
role: "radio",
|
|
54876
54962
|
"aria-checked": o.id === value,
|
|
54963
|
+
...roving ? { tabIndex: i === tabStop ? 0 : -1 } : {},
|
|
54964
|
+
...panelId === void 0 ? {} : { "aria-controls": panelId(o.id) },
|
|
54877
54965
|
disabled: off,
|
|
54878
54966
|
title: gating.blocked ? gating.reason ?? void 0 : void 0,
|
|
54879
54967
|
onClick: () => onChange(o.id),
|
|
@@ -54883,6 +54971,19 @@ function ButtonGroup({ options, value, onChange, ariaLabel, disabled, actuates =
|
|
|
54883
54971
|
});
|
|
54884
54972
|
}
|
|
54885
54973
|
//#endregion
|
|
54974
|
+
//#region src/composites/device-card/parts/ValueChip.tsx
|
|
54975
|
+
/** A small read-only pill (integration name, an offline note, a reading). */
|
|
54976
|
+
function ValueChip({ glyph, children, tone = "default", className, "data-testid": testId }) {
|
|
54977
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
54978
|
+
"data-testid": testId,
|
|
54979
|
+
className: cn("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs", tone === "danger" && "bg-danger/10 text-danger", tone === "warning" && "bg-warning/10 text-warning", tone === "default" && "bg-surface-hover text-foreground-muted", className),
|
|
54980
|
+
children: [glyph === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardIcon, {
|
|
54981
|
+
glyph,
|
|
54982
|
+
className: "h-3 w-3"
|
|
54983
|
+
}), children]
|
|
54984
|
+
});
|
|
54985
|
+
}
|
|
54986
|
+
//#endregion
|
|
54886
54987
|
//#region src/composites/device-card/parts/CardButton.tsx
|
|
54887
54988
|
var TONE$16 = {
|
|
54888
54989
|
default: "border-border bg-surface text-foreground hover:bg-surface-hover",
|
|
@@ -58018,6 +58119,19 @@ function SceneGrid(props) {
|
|
|
58018
58119
|
}
|
|
58019
58120
|
//#endregion
|
|
58020
58121
|
//#region src/composites/device-card/shell/DeviceCard.tsx
|
|
58122
|
+
/** Horizontal travel, in px, that a swipe needs to change the scene. */
|
|
58123
|
+
var SWIPE_MIN_PX = 48;
|
|
58124
|
+
/** A touch that starts in a horizontally scrolling element scrolls it; it is not a scene swipe. */
|
|
58125
|
+
function startsInHorizontalScroller(target, boundary) {
|
|
58126
|
+
for (let el = target instanceof Element ? target : null; el !== null; el = el.parentElement) {
|
|
58127
|
+
if (el instanceof HTMLElement && el.scrollWidth > el.clientWidth) {
|
|
58128
|
+
const overflow = getComputedStyle(el).overflowX;
|
|
58129
|
+
if (overflow === "auto" || overflow === "scroll") return true;
|
|
58130
|
+
}
|
|
58131
|
+
if (el === boundary) return false;
|
|
58132
|
+
}
|
|
58133
|
+
return false;
|
|
58134
|
+
}
|
|
58021
58135
|
var DeviceCardFrameContext = (0, react$1.createContext)("card");
|
|
58022
58136
|
var DeviceCardFillContext = (0, react$1.createContext)(false);
|
|
58023
58137
|
var DeviceCardHistoryViewContext = (0, react$1.createContext)(true);
|
|
@@ -58115,11 +58229,12 @@ function useGating(common) {
|
|
|
58115
58229
|
* four corners, the bottom line, the history and remote views and the gating;
|
|
58116
58230
|
* a scene only fills the zones.
|
|
58117
58231
|
*/
|
|
58118
|
-
function DeviceCard({ kind, common, actions, orientation = "vertical", state, activity, scene, className, showName = true, remoteExtra = null, initialView = "scene", frame, historyView }) {
|
|
58232
|
+
function DeviceCard({ kind, common, actions, orientation = "vertical", state, activity, scene, sceneViews, initialSceneView, className, showName = true, remoteExtra = null, initialView = "scene", frame, historyView }) {
|
|
58119
58233
|
const hostFrame = (0, react$1.useContext)(DeviceCardFrameContext);
|
|
58120
58234
|
const hostHistoryView = useDeviceCardHistoryView();
|
|
58121
58235
|
const historyOffered = historyView ?? hostHistoryView;
|
|
58122
58236
|
const bare = (frame ?? hostFrame) === "bare";
|
|
58237
|
+
const t = useUiText();
|
|
58123
58238
|
const gating = useGating(common);
|
|
58124
58239
|
const fill = (0, react$1.useContext)(DeviceCardFillContext);
|
|
58125
58240
|
const [view, setView] = (0, react$1.useState)(initialView);
|
|
@@ -58130,6 +58245,18 @@ function DeviceCard({ kind, common, actions, orientation = "vertical", state, ac
|
|
|
58130
58245
|
if (measured > 0) setSceneHeight(measured);
|
|
58131
58246
|
setView(next);
|
|
58132
58247
|
};
|
|
58248
|
+
const views = sceneViews !== void 0 && sceneViews.length > 1 ? sceneViews : null;
|
|
58249
|
+
const [sceneId, setSceneId] = (0, react$1.useState)(initialSceneView ?? null);
|
|
58250
|
+
const panelBase = (0, react$1.useId)();
|
|
58251
|
+
const panelIdOf = (id) => `${panelBase}-${id}`;
|
|
58252
|
+
const swipeFrom = (0, react$1.useRef)(null);
|
|
58253
|
+
const activeIndex = views === null ? 0 : Math.max(0, views.findIndex((v) => v.id === sceneId));
|
|
58254
|
+
const activeScene = views === null ? scene : views[activeIndex]?.scene ?? scene;
|
|
58255
|
+
const stepScene = (delta) => {
|
|
58256
|
+
if (views === null) return;
|
|
58257
|
+
const next = views[activeIndex + delta];
|
|
58258
|
+
if (next !== void 0) setSceneId(next.id);
|
|
58259
|
+
};
|
|
58133
58260
|
const history = common.history;
|
|
58134
58261
|
const motion = common.motionTrigger ?? null;
|
|
58135
58262
|
const hasHistory = historyOffered && history !== null && (history.charts !== null || history.events !== null || common.deviceId !== void 0);
|
|
@@ -58138,7 +58265,7 @@ function DeviceCard({ kind, common, actions, orientation = "vertical", state, ac
|
|
|
58138
58265
|
const remotePending = common.remoteLayoutPending === true;
|
|
58139
58266
|
const hasRemote = remoteKeys.length > 0 || remotePanel !== null || remotePending || remoteExtra != null;
|
|
58140
58267
|
const hasBottomLine = gating.reason !== null || common.notice !== null || common.supply !== null || common.consumables !== null || common.consumablesLoading === true;
|
|
58141
|
-
const wide =
|
|
58268
|
+
const wide = activeScene.wide === true;
|
|
58142
58269
|
const corners = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
58143
58270
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StateCorner, {
|
|
58144
58271
|
state,
|
|
@@ -58199,19 +58326,64 @@ function DeviceCard({ kind, common, actions, orientation = "vertical", state, ac
|
|
|
58199
58326
|
ref: sceneRef,
|
|
58200
58327
|
"data-testid": "dc-scene-box",
|
|
58201
58328
|
className: wide ? "flex flex-col gap-2" : void 0,
|
|
58202
|
-
children: [
|
|
58203
|
-
|
|
58204
|
-
|
|
58205
|
-
|
|
58206
|
-
|
|
58207
|
-
|
|
58329
|
+
children: [
|
|
58330
|
+
views === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
58331
|
+
className: "mb-2 overflow-x-auto",
|
|
58332
|
+
"data-testid": "dc-scene-switcher",
|
|
58333
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGroup, {
|
|
58334
|
+
ariaLabel: t("uiLibrary.deviceCard.sceneSwitcher", "View"),
|
|
58335
|
+
options: views.map((v) => ({
|
|
58336
|
+
id: v.id,
|
|
58337
|
+
label: v.label
|
|
58338
|
+
})),
|
|
58339
|
+
value: views[activeIndex]?.id ?? null,
|
|
58340
|
+
onChange: setSceneId,
|
|
58341
|
+
actuates: false,
|
|
58342
|
+
roving: true,
|
|
58343
|
+
panelId: panelIdOf,
|
|
58344
|
+
testId: "dc-scene-switcher-group"
|
|
58345
|
+
})
|
|
58346
|
+
}),
|
|
58347
|
+
wide ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
58348
|
+
"data-testid": "dc-frame-row",
|
|
58349
|
+
className: "relative flex flex-wrap items-center gap-2",
|
|
58350
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CornerLayoutProvider, {
|
|
58351
|
+
value: "frame",
|
|
58352
|
+
children: corners
|
|
58353
|
+
})
|
|
58354
|
+
}) : null,
|
|
58355
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
58356
|
+
"data-testid": "dc-scene-swipe",
|
|
58357
|
+
...views === null || views[activeIndex] === void 0 ? {} : { id: panelIdOf(views[activeIndex].id) },
|
|
58358
|
+
"data-scene-view": views?.[activeIndex]?.id,
|
|
58359
|
+
onTouchStart: (e) => {
|
|
58360
|
+
const touch = e.touches[0];
|
|
58361
|
+
swipeFrom.current = touch === void 0 || startsInHorizontalScroller(e.target, e.currentTarget) ? null : {
|
|
58362
|
+
x: touch.clientX,
|
|
58363
|
+
y: touch.clientY
|
|
58364
|
+
};
|
|
58365
|
+
},
|
|
58366
|
+
onTouchCancel: () => {
|
|
58367
|
+
swipeFrom.current = null;
|
|
58368
|
+
},
|
|
58369
|
+
onTouchEnd: (e) => {
|
|
58370
|
+
const from = swipeFrom.current;
|
|
58371
|
+
const touch = e.changedTouches[0];
|
|
58372
|
+
swipeFrom.current = null;
|
|
58373
|
+
if (from === null || touch === void 0) return;
|
|
58374
|
+
const dx = touch.clientX - from.x;
|
|
58375
|
+
const dy = touch.clientY - from.y;
|
|
58376
|
+
if (Math.abs(dx) < SWIPE_MIN_PX || Math.abs(dx) < Math.abs(dy) * 1.5) return;
|
|
58377
|
+
stepScene(dx < 0 ? 1 : -1);
|
|
58378
|
+
},
|
|
58379
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SceneGrid, {
|
|
58380
|
+
...activeScene,
|
|
58381
|
+
activity,
|
|
58382
|
+
bottomCorners: !wide && (common.battery !== null || hasRemote || motion !== null),
|
|
58383
|
+
corners: wide ? null : corners
|
|
58384
|
+
})
|
|
58208
58385
|
})
|
|
58209
|
-
|
|
58210
|
-
...scene,
|
|
58211
|
-
activity,
|
|
58212
|
-
bottomCorners: !wide && (common.battery !== null || hasRemote || motion !== null),
|
|
58213
|
-
corners: wide ? null : corners
|
|
58214
|
-
})]
|
|
58386
|
+
]
|
|
58215
58387
|
})
|
|
58216
58388
|
}),
|
|
58217
58389
|
hasBottomLine ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -64900,7 +65072,7 @@ function ClimateRoleGlyph({ role, className }) {
|
|
|
64900
65072
|
//#region src/composites/device-card/parts/Dial.tsx
|
|
64901
65073
|
var SIZE = 150;
|
|
64902
65074
|
var CENTER$1 = 75;
|
|
64903
|
-
var RADIUS = 58;
|
|
65075
|
+
var RADIUS$1 = 58;
|
|
64904
65076
|
/** 270 degrees of a circle of radius 58. */
|
|
64905
65077
|
var ARC = 273.3;
|
|
64906
65078
|
var START_DEG = 135;
|
|
@@ -64909,7 +65081,7 @@ var SWEEP_DEG = 270;
|
|
|
64909
65081
|
var DIAL_GEOMETRY = {
|
|
64910
65082
|
size: SIZE,
|
|
64911
65083
|
center: CENTER$1,
|
|
64912
|
-
radius: RADIUS,
|
|
65084
|
+
radius: RADIUS$1,
|
|
64913
65085
|
arc: ARC,
|
|
64914
65086
|
startDeg: START_DEG,
|
|
64915
65087
|
sweepDeg: SWEEP_DEG
|
|
@@ -65016,7 +65188,7 @@ function Dial({ value, min, max, step, tone, ariaLabel, enabled = true, onInput,
|
|
|
65016
65188
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
65017
65189
|
cx: CENTER$1,
|
|
65018
65190
|
cy: CENTER$1,
|
|
65019
|
-
r: RADIUS,
|
|
65191
|
+
r: RADIUS$1,
|
|
65020
65192
|
strokeWidth: 10,
|
|
65021
65193
|
className: "text-border",
|
|
65022
65194
|
stroke: "currentColor",
|
|
@@ -65026,7 +65198,7 @@ function Dial({ value, min, max, step, tone, ariaLabel, enabled = true, onInput,
|
|
|
65026
65198
|
gauge === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
65027
65199
|
cx: CENTER$1,
|
|
65028
65200
|
cy: CENTER$1,
|
|
65029
|
-
r: RADIUS,
|
|
65201
|
+
r: RADIUS$1,
|
|
65030
65202
|
strokeWidth: 10,
|
|
65031
65203
|
className: "dc-arc",
|
|
65032
65204
|
stroke: "currentColor",
|
|
@@ -65036,7 +65208,7 @@ function Dial({ value, min, max, step, tone, ariaLabel, enabled = true, onInput,
|
|
|
65036
65208
|
bandSpan === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
65037
65209
|
cx: CENTER$1,
|
|
65038
65210
|
cy: CENTER$1,
|
|
65039
|
-
r: RADIUS,
|
|
65211
|
+
r: RADIUS$1,
|
|
65040
65212
|
strokeWidth: 10,
|
|
65041
65213
|
className: "dc-arc",
|
|
65042
65214
|
stroke: "currentColor",
|
|
@@ -65046,8 +65218,8 @@ function Dial({ value, min, max, step, tone, ariaLabel, enabled = true, onInput,
|
|
|
65046
65218
|
"data-testid": testId === void 0 ? void 0 : `${testId}-band`
|
|
65047
65219
|
}),
|
|
65048
65220
|
markerAngle === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
65049
|
-
cx: CENTER$1 + RADIUS * Math.cos(markerAngle),
|
|
65050
|
-
cy: CENTER$1 + RADIUS * Math.sin(markerAngle),
|
|
65221
|
+
cx: CENTER$1 + RADIUS$1 * Math.cos(markerAngle),
|
|
65222
|
+
cy: CENTER$1 + RADIUS$1 * Math.sin(markerAngle),
|
|
65051
65223
|
r: 5,
|
|
65052
65224
|
strokeWidth: 2.5,
|
|
65053
65225
|
className: "fill-transparent text-foreground",
|
|
@@ -65055,8 +65227,8 @@ function Dial({ value, min, max, step, tone, ariaLabel, enabled = true, onInput,
|
|
|
65055
65227
|
"data-testid": testId === void 0 ? void 0 : `${testId}-marker`
|
|
65056
65228
|
}),
|
|
65057
65229
|
enabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
65058
|
-
cx: CENTER$1 + RADIUS * Math.cos(angle),
|
|
65059
|
-
cy: CENTER$1 + RADIUS * Math.sin(angle),
|
|
65230
|
+
cx: CENTER$1 + RADIUS$1 * Math.cos(angle),
|
|
65231
|
+
cy: CENTER$1 + RADIUS$1 * Math.sin(angle),
|
|
65060
65232
|
r: dragging ? 11 : 9,
|
|
65061
65233
|
strokeWidth: 3,
|
|
65062
65234
|
className: "fill-surface text-foreground",
|
|
@@ -66681,7 +66853,7 @@ function ConnectedControlCard({ deviceId, canActuate = true, orientation, showNa
|
|
|
66681
66853
|
var W = 120;
|
|
66682
66854
|
var H = 176;
|
|
66683
66855
|
var KEY_STEP = 5;
|
|
66684
|
-
var clamp = (v) => Math.max(0, Math.min(100, Math.round(v)));
|
|
66856
|
+
var clamp$1 = (v) => Math.max(0, Math.min(100, Math.round(v)));
|
|
66685
66857
|
var FRAME = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
66686
66858
|
x: 4,
|
|
66687
66859
|
y: 4,
|
|
@@ -67046,17 +67218,17 @@ function valueAt$1(drawing, drag, px, py) {
|
|
|
67046
67218
|
*/
|
|
67047
67219
|
function CoverIllustration({ drawing, value, drag, ariaLabel, gripLabel = "Drag", interactive = true, onDrag, onDragEnd, className }) {
|
|
67048
67220
|
const dragging = (0, react$1.useRef)(null);
|
|
67049
|
-
const drawn = DRAW[drawing](clamp(value));
|
|
67221
|
+
const drawn = DRAW[drawing](clamp$1(value));
|
|
67050
67222
|
const canDrag = drag !== "none" && interactive && drawn.grip !== null;
|
|
67051
67223
|
const pointValue = (e) => {
|
|
67052
67224
|
const box = e.currentTarget.getBoundingClientRect();
|
|
67053
|
-
return clamp(valueAt$1(drawing, drag, box.width === 0 ? 0 : (e.clientX - box.left) * W / box.width, box.height === 0 ? 0 : (e.clientY - box.top) * H / box.height));
|
|
67225
|
+
return clamp$1(valueAt$1(drawing, drag, box.width === 0 ? 0 : (e.clientX - box.left) * W / box.width, box.height === 0 ? 0 : (e.clientY - box.top) * H / box.height));
|
|
67054
67226
|
};
|
|
67055
67227
|
const onPointerDown = (e) => {
|
|
67056
67228
|
if (!canDrag || !(e.target instanceof Element) || e.target.closest("[data-grip]") === null) return;
|
|
67057
67229
|
e.preventDefault();
|
|
67058
67230
|
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
67059
|
-
dragging.current = clamp(value);
|
|
67231
|
+
dragging.current = clamp$1(value);
|
|
67060
67232
|
};
|
|
67061
67233
|
const onPointerMove = (e) => {
|
|
67062
67234
|
if (dragging.current === null) return;
|
|
@@ -67075,7 +67247,7 @@ function CoverIllustration({ drawing, value, drag, ariaLabel, gripLabel = "Drag"
|
|
|
67075
67247
|
const step = e.key === "ArrowDown" || e.key === "ArrowRight" ? KEY_STEP : e.key === "ArrowUp" || e.key === "ArrowLeft" ? -5 : 0;
|
|
67076
67248
|
if (step === 0) return;
|
|
67077
67249
|
e.preventDefault();
|
|
67078
|
-
const next = clamp(value + step);
|
|
67250
|
+
const next = clamp$1(value + step);
|
|
67079
67251
|
onDrag?.(next);
|
|
67080
67252
|
onDragEnd?.(next);
|
|
67081
67253
|
};
|
|
@@ -67095,7 +67267,7 @@ function CoverIllustration({ drawing, value, drag, ariaLabel, gripLabel = "Drag"
|
|
|
67095
67267
|
y: drawn.grip.y,
|
|
67096
67268
|
horizontal: drawn.grip.horizontal,
|
|
67097
67269
|
label: gripLabel,
|
|
67098
|
-
value: clamp(value)
|
|
67270
|
+
value: clamp$1(value)
|
|
67099
67271
|
}) : null]
|
|
67100
67272
|
});
|
|
67101
67273
|
}
|
|
@@ -67742,6 +67914,428 @@ function ConnectedEventCard({ deviceId, canActuate = true, orientation, showName
|
|
|
67742
67914
|
});
|
|
67743
67915
|
}
|
|
67744
67916
|
//#endregion
|
|
67917
|
+
//#region src/composites/angle-range-arc/angle-range.ts
|
|
67918
|
+
/** The quick-set spans, before the bounds filter them. */
|
|
67919
|
+
var PRESET_CANDIDATES = [
|
|
67920
|
+
30,
|
|
67921
|
+
60,
|
|
67922
|
+
90,
|
|
67923
|
+
120
|
|
67924
|
+
];
|
|
67925
|
+
/** The widest arc drawn, in degrees: a wider range is scaled down into it. */
|
|
67926
|
+
var MAX_DRAWN_SPAN = 180;
|
|
67927
|
+
var EPSILON = 1e-9;
|
|
67928
|
+
var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
67929
|
+
var stepOf = (bounds) => bounds.step > 0 ? bounds.step : 1;
|
|
67930
|
+
var spanFloor = (bounds) => bounds.minSpan ?? 0;
|
|
67931
|
+
/** How many whole steps fit between min and max. */
|
|
67932
|
+
var stepCount = (bounds) => Math.max(0, Math.floor((bounds.max - bounds.min) / stepOf(bounds) + EPSILON));
|
|
67933
|
+
/** The last grid point inside the bounds: below max when the step does not divide the range. */
|
|
67934
|
+
var gridMax = (bounds) => bounds.min + stepCount(bounds) * stepOf(bounds);
|
|
67935
|
+
/** A value on the step grid anchored at `min`, inside the bounds. */
|
|
67936
|
+
function snapAngle(value, bounds) {
|
|
67937
|
+
const step = stepOf(bounds);
|
|
67938
|
+
const index = clamp(Math.round((value - bounds.min) / step), 0, stepCount(bounds));
|
|
67939
|
+
return bounds.min + index * step;
|
|
67940
|
+
}
|
|
67941
|
+
/** A range the device would accept: inside the bounds and at least minSpan wide. */
|
|
67942
|
+
function isValidRange(range, bounds) {
|
|
67943
|
+
return range.from >= bounds.min - EPSILON && range.to <= bounds.max + EPSILON && range.to - range.from >= spanFloor(bounds) - EPSILON;
|
|
67944
|
+
}
|
|
67945
|
+
var parityOf = (n) => (n % 2 + 2) % 2;
|
|
67946
|
+
/**
|
|
67947
|
+
* Moves one handle toward `target`. Asymmetric: the other end stays.
|
|
67948
|
+
* Symmetric: both ends follow around the centre, snapped to the grid (an
|
|
67949
|
+
* off-grid centre moves to the nearest half step, the nearest centre on which
|
|
67950
|
+
* both ends can sit on the grid). Every exit returns a valid range or the
|
|
67951
|
+
* range it was given, unchanged: a move that cannot be valid is refused, never
|
|
67952
|
+
* clamped into an invalid one.
|
|
67953
|
+
*/
|
|
67954
|
+
function moveHandle(range, handle, target, bounds, symmetric) {
|
|
67955
|
+
const step = stepOf(bounds);
|
|
67956
|
+
const floor = spanFloor(bounds);
|
|
67957
|
+
const keep = (next) => isValidRange(next, bounds) ? next : range;
|
|
67958
|
+
if (symmetric) {
|
|
67959
|
+
const steps = stepCount(bounds);
|
|
67960
|
+
const halfSteps = clamp(Math.round(((range.from + range.to) / 2 - bounds.min) / (step / 2)), 0, 2 * steps);
|
|
67961
|
+
const centre = bounds.min + halfSteps * step / 2;
|
|
67962
|
+
const parity = parityOf(halfSteps);
|
|
67963
|
+
const smallest = Math.ceil(floor / step - EPSILON);
|
|
67964
|
+
const lowest = smallest + parityOf(smallest - halfSteps);
|
|
67965
|
+
const largest = Math.min(halfSteps, 2 * steps - halfSteps);
|
|
67966
|
+
const highest = largest - parityOf(largest - halfSteps);
|
|
67967
|
+
if (lowest > highest) return range;
|
|
67968
|
+
const wanted = 2 * Math.abs(target - centre) / step;
|
|
67969
|
+
const n = clamp(Math.round((wanted - parity) / 2) * 2 + parity, lowest, highest);
|
|
67970
|
+
return keep({
|
|
67971
|
+
from: bounds.min + (halfSteps - n) / 2 * step,
|
|
67972
|
+
to: bounds.min + (halfSteps + n) / 2 * step
|
|
67973
|
+
});
|
|
67974
|
+
}
|
|
67975
|
+
if (handle === "from") {
|
|
67976
|
+
const limit = bounds.min + Math.floor((range.to - floor - bounds.min) / step + EPSILON) * step;
|
|
67977
|
+
return keep({
|
|
67978
|
+
from: Math.min(snapAngle(target, bounds), limit),
|
|
67979
|
+
to: range.to
|
|
67980
|
+
});
|
|
67981
|
+
}
|
|
67982
|
+
const limit = bounds.min + Math.ceil((range.from + floor - bounds.min) / step - EPSILON) * step;
|
|
67983
|
+
return keep({
|
|
67984
|
+
from: range.from,
|
|
67985
|
+
to: Math.max(snapAngle(target, bounds), limit)
|
|
67986
|
+
});
|
|
67987
|
+
}
|
|
67988
|
+
/** True when both ends sit equally around zero. */
|
|
67989
|
+
function isSymmetric(range) {
|
|
67990
|
+
return range.from === -range.to;
|
|
67991
|
+
}
|
|
67992
|
+
/** The quick-set spans the bounds and step allow. */
|
|
67993
|
+
function presetSpans(bounds) {
|
|
67994
|
+
const width = gridMax(bounds) - bounds.min;
|
|
67995
|
+
const step = stepOf(bounds);
|
|
67996
|
+
return PRESET_CANDIDATES.filter((s) => s >= spanFloor(bounds) && s <= width + EPSILON && s % step === 0);
|
|
67997
|
+
}
|
|
67998
|
+
/** A range of `span` degrees on the current centre, shifted to fit the bounds; the range itself when none fits. */
|
|
67999
|
+
function applyPreset(range, span, bounds) {
|
|
68000
|
+
const highest = gridMax(bounds) - span;
|
|
68001
|
+
if (highest < bounds.min - EPSILON) return range;
|
|
68002
|
+
const from = clamp(snapAngle((range.from + range.to) / 2 - span / 2, bounds), bounds.min, highest);
|
|
68003
|
+
const next = {
|
|
68004
|
+
from,
|
|
68005
|
+
to: from + span
|
|
68006
|
+
};
|
|
68007
|
+
return isValidRange(next, bounds) ? next : range;
|
|
68008
|
+
}
|
|
68009
|
+
/** The drawn scale: one degree of value is this many degrees of arc. */
|
|
68010
|
+
var scaleOf = (bounds) => {
|
|
68011
|
+
const width = bounds.max - bounds.min;
|
|
68012
|
+
return width > MAX_DRAWN_SPAN ? MAX_DRAWN_SPAN / width : 1;
|
|
68013
|
+
};
|
|
68014
|
+
var midOf = (bounds) => (bounds.min + bounds.max) / 2;
|
|
68015
|
+
/** A value as degrees of arc from the middle of the bounds (0 = straight ahead). */
|
|
68016
|
+
function valueToAngle(value, bounds) {
|
|
68017
|
+
return (value - midOf(bounds)) * scaleOf(bounds);
|
|
68018
|
+
}
|
|
68019
|
+
function angleToValue(angle, bounds) {
|
|
68020
|
+
return angle / scaleOf(bounds) + midOf(bounds);
|
|
68021
|
+
}
|
|
68022
|
+
//#endregion
|
|
68023
|
+
//#region src/composites/angle-range-arc/angle-range-arc.tsx
|
|
68024
|
+
var SHORT = 140;
|
|
68025
|
+
var LONG = 240;
|
|
68026
|
+
var PIVOT = 16;
|
|
68027
|
+
var RADIUS = 110;
|
|
68028
|
+
var HANDLE_R = 11;
|
|
68029
|
+
var KEY_COMMIT_MS = 400;
|
|
68030
|
+
/** How long a committed range waits for the server's value before the draft goes back to it. */
|
|
68031
|
+
var SETTLE_MS = 4e3;
|
|
68032
|
+
/** PageUp / PageDown move a handle this many steps. */
|
|
68033
|
+
var PAGE_STEPS = 6;
|
|
68034
|
+
var toRad = (deg) => deg * Math.PI / 180;
|
|
68035
|
+
/** Everything that differs between the two orientations. */
|
|
68036
|
+
function geometry(orientation) {
|
|
68037
|
+
if (orientation === "horizontal") {
|
|
68038
|
+
const pivot = {
|
|
68039
|
+
x: LONG / 2,
|
|
68040
|
+
y: PIVOT
|
|
68041
|
+
};
|
|
68042
|
+
return {
|
|
68043
|
+
width: LONG,
|
|
68044
|
+
height: SHORT,
|
|
68045
|
+
pivot,
|
|
68046
|
+
at: (a, r) => ({
|
|
68047
|
+
x: pivot.x + r * Math.sin(toRad(a)),
|
|
68048
|
+
y: pivot.y + r * Math.cos(toRad(a))
|
|
68049
|
+
}),
|
|
68050
|
+
angleOf: (dx, dy) => Math.atan2(dx, dy) * 180 / Math.PI
|
|
68051
|
+
};
|
|
68052
|
+
}
|
|
68053
|
+
const pivot = {
|
|
68054
|
+
x: PIVOT,
|
|
68055
|
+
y: LONG / 2
|
|
68056
|
+
};
|
|
68057
|
+
return {
|
|
68058
|
+
width: SHORT,
|
|
68059
|
+
height: LONG,
|
|
68060
|
+
pivot,
|
|
68061
|
+
at: (a, r) => ({
|
|
68062
|
+
x: pivot.x + r * Math.cos(toRad(a)),
|
|
68063
|
+
y: pivot.y - r * Math.sin(toRad(a))
|
|
68064
|
+
}),
|
|
68065
|
+
angleOf: (dx, dy) => Math.atan2(-dy, dx) * 180 / Math.PI
|
|
68066
|
+
};
|
|
68067
|
+
}
|
|
68068
|
+
var fmt = (p) => `${p.x.toFixed(2)} ${p.y.toFixed(2)}`;
|
|
68069
|
+
/**
|
|
68070
|
+
* An angle range on an arc: two draggable handles, the span in the middle,
|
|
68071
|
+
* symmetric / asymmetric editing and quick spans. Generic: the bounds, the
|
|
68072
|
+
* step and the narrowest span come from the caller (a device's reported
|
|
68073
|
+
* limits), never from here. Pointer and keyboard; one commit per gesture.
|
|
68074
|
+
*/
|
|
68075
|
+
function AngleRangeArc({ from, to, min, max, step, minSpan, orientation = "horizontal", disabled = false, onCommit, ariaLabel, testId }) {
|
|
68076
|
+
const t = useUiText();
|
|
68077
|
+
const bounds = {
|
|
68078
|
+
min,
|
|
68079
|
+
max,
|
|
68080
|
+
step,
|
|
68081
|
+
minSpan
|
|
68082
|
+
};
|
|
68083
|
+
const [draft, setDraft] = (0, react$1.useState)({
|
|
68084
|
+
from,
|
|
68085
|
+
to
|
|
68086
|
+
});
|
|
68087
|
+
const [symmetric, setSymmetric] = (0, react$1.useState)(isSymmetric({
|
|
68088
|
+
from,
|
|
68089
|
+
to
|
|
68090
|
+
}));
|
|
68091
|
+
const [dragging, setDragging] = (0, react$1.useState)(null);
|
|
68092
|
+
const [focused, setFocused] = (0, react$1.useState)(null);
|
|
68093
|
+
const latest = (0, react$1.useRef)(draft);
|
|
68094
|
+
const timer = (0, react$1.useRef)(null);
|
|
68095
|
+
const settle = (0, react$1.useRef)(null);
|
|
68096
|
+
const draggingRef = (0, react$1.useRef)(null);
|
|
68097
|
+
const served = (0, react$1.useRef)({
|
|
68098
|
+
from,
|
|
68099
|
+
to
|
|
68100
|
+
});
|
|
68101
|
+
served.current = {
|
|
68102
|
+
from,
|
|
68103
|
+
to
|
|
68104
|
+
};
|
|
68105
|
+
const geo = geometry(orientation);
|
|
68106
|
+
(0, react$1.useEffect)(() => {
|
|
68107
|
+
if (draggingRef.current !== null || timer.current !== null) return;
|
|
68108
|
+
if (settle.current !== null) clearTimeout(settle.current);
|
|
68109
|
+
settle.current = null;
|
|
68110
|
+
const next = {
|
|
68111
|
+
from,
|
|
68112
|
+
to
|
|
68113
|
+
};
|
|
68114
|
+
latest.current = next;
|
|
68115
|
+
setDraft(next);
|
|
68116
|
+
}, [from, to]);
|
|
68117
|
+
(0, react$1.useEffect)(() => () => {
|
|
68118
|
+
if (timer.current !== null) clearTimeout(timer.current);
|
|
68119
|
+
if (settle.current !== null) clearTimeout(settle.current);
|
|
68120
|
+
}, []);
|
|
68121
|
+
const apply = (range) => {
|
|
68122
|
+
latest.current = range;
|
|
68123
|
+
setDraft(range);
|
|
68124
|
+
};
|
|
68125
|
+
const commit = (range) => {
|
|
68126
|
+
if (range.from === from && range.to === to) return;
|
|
68127
|
+
onCommit(range);
|
|
68128
|
+
if (settle.current !== null) clearTimeout(settle.current);
|
|
68129
|
+
settle.current = setTimeout(() => {
|
|
68130
|
+
settle.current = null;
|
|
68131
|
+
if (draggingRef.current === null && timer.current === null) apply(served.current);
|
|
68132
|
+
}, SETTLE_MS);
|
|
68133
|
+
};
|
|
68134
|
+
const valueAt = (e) => {
|
|
68135
|
+
const box = e.currentTarget.getBoundingClientRect();
|
|
68136
|
+
const k = geo.width / box.width;
|
|
68137
|
+
const angle = geo.angleOf((e.clientX - box.left) * k - geo.pivot.x, (e.clientY - box.top) * k - geo.pivot.y);
|
|
68138
|
+
return angleToValue(Math.max(-90, Math.min(90, angle)), bounds);
|
|
68139
|
+
};
|
|
68140
|
+
const onDown = (e) => {
|
|
68141
|
+
if (disabled) return;
|
|
68142
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
68143
|
+
const v = valueAt(e);
|
|
68144
|
+
const handle = Math.abs(v - draft.from) === Math.abs(v - draft.to) ? v > draft.to ? "to" : "from" : Math.abs(v - draft.from) < Math.abs(v - draft.to) ? "from" : "to";
|
|
68145
|
+
draggingRef.current = handle;
|
|
68146
|
+
setDragging(handle);
|
|
68147
|
+
apply(moveHandle(draft, handle, v, bounds, symmetric));
|
|
68148
|
+
};
|
|
68149
|
+
const onMove = (e) => {
|
|
68150
|
+
if (dragging !== null) apply(moveHandle(latest.current, dragging, valueAt(e), bounds, symmetric));
|
|
68151
|
+
};
|
|
68152
|
+
const onUp = () => {
|
|
68153
|
+
if (dragging === null) return;
|
|
68154
|
+
draggingRef.current = null;
|
|
68155
|
+
setDragging(null);
|
|
68156
|
+
commit(latest.current);
|
|
68157
|
+
};
|
|
68158
|
+
const onKey = (handle) => (e) => {
|
|
68159
|
+
if (disabled) return;
|
|
68160
|
+
const current = latest.current;
|
|
68161
|
+
const base = handle === "from" ? current.from : current.to;
|
|
68162
|
+
const target = keyTarget(e.key, handle, base, (current.from + current.to) / 2);
|
|
68163
|
+
if (target === null) return;
|
|
68164
|
+
e.preventDefault();
|
|
68165
|
+
apply(moveHandle(current, handle, target, bounds, symmetric));
|
|
68166
|
+
if (timer.current !== null) clearTimeout(timer.current);
|
|
68167
|
+
timer.current = setTimeout(() => {
|
|
68168
|
+
timer.current = null;
|
|
68169
|
+
commit(latest.current);
|
|
68170
|
+
}, KEY_COMMIT_MS);
|
|
68171
|
+
};
|
|
68172
|
+
/** Where a key sends a handle; null for a key that is not ours. */
|
|
68173
|
+
function keyTarget(key, handle, base, centre) {
|
|
68174
|
+
if (key === "ArrowRight" || key === "ArrowUp") return snapAngle(base + step, bounds);
|
|
68175
|
+
if (key === "ArrowLeft" || key === "ArrowDown") return snapAngle(base - step, bounds);
|
|
68176
|
+
if (key === "PageUp") return snapAngle(base + PAGE_STEPS * step, bounds);
|
|
68177
|
+
if (key === "PageDown") return snapAngle(base - PAGE_STEPS * step, bounds);
|
|
68178
|
+
if (key !== "Home" && key !== "End") return null;
|
|
68179
|
+
if (symmetric && handle === "to" === (key === "Home")) return centre;
|
|
68180
|
+
return key === "Home" ? min : max;
|
|
68181
|
+
}
|
|
68182
|
+
const span = draft.to - draft.from;
|
|
68183
|
+
const a1 = valueToAngle(draft.from, bounds);
|
|
68184
|
+
const a2 = valueToAngle(draft.to, bounds);
|
|
68185
|
+
const p1 = geo.at(a1, RADIUS);
|
|
68186
|
+
const p2 = geo.at(a2, RADIUS);
|
|
68187
|
+
const lo = geo.at(valueToAngle(min, bounds), RADIUS);
|
|
68188
|
+
const hi = geo.at(valueToAngle(max, bounds), RADIUS);
|
|
68189
|
+
const arcTo = (b) => `A ${String(RADIUS)} ${String(RADIUS)} 0 0 0 ${fmt(b)}`;
|
|
68190
|
+
const spans = presetSpans(bounds);
|
|
68191
|
+
const word = (id) => id === "from" ? t("uiLibrary.angleArc.from", "From") : t("uiLibrary.angleArc.to", "To");
|
|
68192
|
+
const handle = (id, value, p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
68193
|
+
cx: p.x,
|
|
68194
|
+
cy: p.y,
|
|
68195
|
+
r: dragging === id ? 13 : HANDLE_R,
|
|
68196
|
+
strokeWidth: 3,
|
|
68197
|
+
stroke: "currentColor",
|
|
68198
|
+
className: "fill-surface text-primary outline-none",
|
|
68199
|
+
role: "slider",
|
|
68200
|
+
tabIndex: disabled ? -1 : 0,
|
|
68201
|
+
"aria-label": `${ariaLabel}: ${word(id)}`,
|
|
68202
|
+
"aria-valuemin": id === "from" ? min : draft.from,
|
|
68203
|
+
"aria-valuemax": id === "from" ? draft.to : max,
|
|
68204
|
+
"aria-valuenow": value,
|
|
68205
|
+
"aria-valuetext": `${String(value)}°`,
|
|
68206
|
+
"aria-disabled": disabled,
|
|
68207
|
+
"data-testid": testId === void 0 ? void 0 : `${testId}-${id}`,
|
|
68208
|
+
onKeyDown: onKey(id),
|
|
68209
|
+
onFocus: () => setFocused(id),
|
|
68210
|
+
onBlur: () => setFocused(null)
|
|
68211
|
+
});
|
|
68212
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68213
|
+
className: cn("flex flex-col gap-3", disabled && "opacity-60"),
|
|
68214
|
+
"data-testid": testId,
|
|
68215
|
+
"data-symmetric": symmetric,
|
|
68216
|
+
children: [
|
|
68217
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
68218
|
+
className: "flex gap-1",
|
|
68219
|
+
role: "group",
|
|
68220
|
+
"aria-label": t("uiLibrary.angleArc.mode", "Editing mode"),
|
|
68221
|
+
children: [true, false].map((sym) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
68222
|
+
size: "xs",
|
|
68223
|
+
variant: symmetric === sym ? "primary" : "outline",
|
|
68224
|
+
"aria-pressed": symmetric === sym,
|
|
68225
|
+
disabled,
|
|
68226
|
+
"data-testid": testId === void 0 ? void 0 : `${testId}-${sym ? "sym" : "asym"}`,
|
|
68227
|
+
onClick: () => setSymmetric(sym),
|
|
68228
|
+
children: sym ? t("uiLibrary.angleArc.symmetric", "Symmetric") : t("uiLibrary.angleArc.asymmetric", "Asymmetric")
|
|
68229
|
+
}, String(sym)))
|
|
68230
|
+
}),
|
|
68231
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
68232
|
+
viewBox: `0 0 ${String(geo.width)} ${String(geo.height)}`,
|
|
68233
|
+
className: cn("mx-auto h-auto touch-none select-none", orientation === "horizontal" ? "w-full max-w-72" : "w-28"),
|
|
68234
|
+
role: "group",
|
|
68235
|
+
"aria-label": ariaLabel,
|
|
68236
|
+
onPointerDown: onDown,
|
|
68237
|
+
onPointerMove: dragging === null ? void 0 : onMove,
|
|
68238
|
+
onPointerUp: onUp,
|
|
68239
|
+
onPointerCancel: onUp,
|
|
68240
|
+
children: [
|
|
68241
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
68242
|
+
d: `M ${fmt(geo.pivot)} L ${fmt(lo)} ${arcTo(hi)} Z`,
|
|
68243
|
+
className: "fill-foreground/5 stroke-border",
|
|
68244
|
+
strokeDasharray: "3 3",
|
|
68245
|
+
strokeWidth: 1
|
|
68246
|
+
}),
|
|
68247
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
68248
|
+
d: `M ${fmt(geo.pivot)} L ${fmt(p1)} ${arcTo(p2)} Z`,
|
|
68249
|
+
className: "fill-primary/15"
|
|
68250
|
+
}),
|
|
68251
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
68252
|
+
d: `M ${fmt(p1)} ${arcTo(p2)}`,
|
|
68253
|
+
fill: "none",
|
|
68254
|
+
strokeWidth: 6,
|
|
68255
|
+
strokeLinecap: "round",
|
|
68256
|
+
className: "stroke-primary"
|
|
68257
|
+
}),
|
|
68258
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
68259
|
+
x1: geo.pivot.x,
|
|
68260
|
+
y1: geo.pivot.y,
|
|
68261
|
+
x2: p1.x,
|
|
68262
|
+
y2: p1.y,
|
|
68263
|
+
className: "stroke-primary/50",
|
|
68264
|
+
strokeWidth: 1
|
|
68265
|
+
}),
|
|
68266
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
68267
|
+
x1: geo.pivot.x,
|
|
68268
|
+
y1: geo.pivot.y,
|
|
68269
|
+
x2: p2.x,
|
|
68270
|
+
y2: p2.y,
|
|
68271
|
+
className: "stroke-primary/50",
|
|
68272
|
+
strokeWidth: 1
|
|
68273
|
+
}),
|
|
68274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
68275
|
+
cx: geo.pivot.x,
|
|
68276
|
+
cy: geo.pivot.y,
|
|
68277
|
+
r: 4,
|
|
68278
|
+
className: "fill-foreground-muted"
|
|
68279
|
+
}),
|
|
68280
|
+
focused === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
68281
|
+
cx: (focused === "from" ? p1 : p2).x,
|
|
68282
|
+
cy: (focused === "from" ? p1 : p2).y,
|
|
68283
|
+
r: 16,
|
|
68284
|
+
fill: "none",
|
|
68285
|
+
strokeWidth: 2,
|
|
68286
|
+
className: "stroke-foreground pointer-events-none",
|
|
68287
|
+
"data-testid": testId === void 0 ? void 0 : `${testId}-focus`
|
|
68288
|
+
}),
|
|
68289
|
+
handle("from", draft.from, p1),
|
|
68290
|
+
handle("to", draft.to, p2)
|
|
68291
|
+
]
|
|
68292
|
+
}),
|
|
68293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68294
|
+
className: "text-center",
|
|
68295
|
+
"aria-live": "polite",
|
|
68296
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68297
|
+
className: "text-2xl font-semibold tabular-nums",
|
|
68298
|
+
"data-testid": testId === void 0 ? void 0 : `${testId}-span`,
|
|
68299
|
+
children: [span, "°"]
|
|
68300
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68301
|
+
className: "text-xs text-foreground-muted tabular-nums",
|
|
68302
|
+
children: [
|
|
68303
|
+
draft.from,
|
|
68304
|
+
"° … ",
|
|
68305
|
+
draft.to,
|
|
68306
|
+
"°"
|
|
68307
|
+
]
|
|
68308
|
+
})]
|
|
68309
|
+
}),
|
|
68310
|
+
minSpan !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
68311
|
+
className: "text-xs text-foreground-muted",
|
|
68312
|
+
children: t("uiLibrary.angleArc.minSpan", "The narrowest span you can set is {{span}}°.", { span: minSpan })
|
|
68313
|
+
}) : null,
|
|
68314
|
+
spans.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68315
|
+
className: "flex flex-col gap-1",
|
|
68316
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68317
|
+
className: "text-xs font-medium text-foreground-muted",
|
|
68318
|
+
children: t("uiLibrary.angleArc.quick", "Quick setup")
|
|
68319
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
68320
|
+
className: "flex flex-wrap gap-1",
|
|
68321
|
+
children: spans.map((s) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
68322
|
+
size: "xs",
|
|
68323
|
+
variant: span === s ? "primary" : "outline",
|
|
68324
|
+
disabled,
|
|
68325
|
+
"data-testid": testId === void 0 ? void 0 : `${testId}-preset-${String(s)}`,
|
|
68326
|
+
onClick: () => {
|
|
68327
|
+
const next = applyPreset(draft, s, bounds);
|
|
68328
|
+
apply(next);
|
|
68329
|
+
commit(next);
|
|
68330
|
+
},
|
|
68331
|
+
children: [s, "°"]
|
|
68332
|
+
}, s))
|
|
68333
|
+
})]
|
|
68334
|
+
}) : null
|
|
68335
|
+
]
|
|
68336
|
+
});
|
|
68337
|
+
}
|
|
68338
|
+
//#endregion
|
|
67745
68339
|
//#region src/composites/device-card/illustrations/FanIllustration.tsx
|
|
67746
68340
|
var BLADE$1 = "M60 60c-6-16-2-38 12-42 12 2 8 24-12 42z";
|
|
67747
68341
|
var DEFAULT_SPEED = 60;
|
|
@@ -67821,8 +68415,6 @@ function FanIllustration({ on, speed, reverse, sway, axes, className }) {
|
|
|
67821
68415
|
}
|
|
67822
68416
|
//#endregion
|
|
67823
68417
|
//#region src/composites/device-card/scenes/fan/model.ts
|
|
67824
|
-
/** The narrowest sweep the card lets an operator set, in degrees. */
|
|
67825
|
-
var FAN_MIN_SWEEP = 10;
|
|
67826
68418
|
/** "+45°", "-30°", "0°". */
|
|
67827
68419
|
var signedDegrees = (v) => `${v > 0 ? "+" : ""}${v}°`;
|
|
67828
68420
|
//#endregion
|
|
@@ -67855,7 +68447,7 @@ function readoutRows(readings, open) {
|
|
|
67855
68447
|
function AxisButton({ name, axis, disabled, onAxis }) {
|
|
67856
68448
|
const t = useUiText();
|
|
67857
68449
|
const title = name === "horizontal" ? t("uiLibrary.deviceCard.fan.horizontal", "Horizontal") : t("uiLibrary.deviceCard.fan.vertical", "Vertical");
|
|
67858
|
-
const summary = axis.oscillating ? `${
|
|
68450
|
+
const summary = axis.oscillating ? `${String(axis.sweepTo - axis.sweepFrom)}°` : t("uiLibrary.deviceCard.fan.fixedAt", "fixed {{angle}}", { angle: signedDegrees(axis.angle) });
|
|
67859
68451
|
const range = {
|
|
67860
68452
|
min: axis.min,
|
|
67861
68453
|
max: axis.max,
|
|
@@ -67883,19 +68475,22 @@ function AxisButton({ name, axis, disabled, onAxis }) {
|
|
|
67883
68475
|
onChange: (e) => onAxis(name, { oscillating: e.currentTarget.checked }),
|
|
67884
68476
|
"data-testid": `dc-fan-axis-${name}-osc`
|
|
67885
68477
|
}), name === "horizontal" ? t("uiLibrary.deviceCard.fan.oscillateHorizontal", "Oscillate horizontally") : t("uiLibrary.deviceCard.fan.oscillateVertical", "Oscillate vertically")]
|
|
67886
|
-
}), axis.oscillating ? /* @__PURE__ */ (0, react_jsx_runtime.
|
|
67887
|
-
|
|
67888
|
-
|
|
67889
|
-
|
|
67890
|
-
|
|
67891
|
-
|
|
67892
|
-
|
|
67893
|
-
|
|
67894
|
-
|
|
67895
|
-
ariaLabel: t("uiLibrary.deviceCard.fan.
|
|
67896
|
-
|
|
67897
|
-
onCommit: (
|
|
67898
|
-
|
|
68478
|
+
}), axis.oscillating ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AngleRangeArc, {
|
|
68479
|
+
from: axis.sweepFrom,
|
|
68480
|
+
to: axis.sweepTo,
|
|
68481
|
+
min: axis.min,
|
|
68482
|
+
max: axis.max,
|
|
68483
|
+
step: axis.step,
|
|
68484
|
+
minSpan: axis.minSpan,
|
|
68485
|
+
orientation: name,
|
|
68486
|
+
disabled,
|
|
68487
|
+
ariaLabel: name === "horizontal" ? t("uiLibrary.deviceCard.fan.oscillateHorizontal", "Oscillate horizontally") : t("uiLibrary.deviceCard.fan.oscillateVertical", "Oscillate vertically"),
|
|
68488
|
+
testId: `dc-fan-axis-${name}-arc`,
|
|
68489
|
+
onCommit: (r) => onAxis(name, {
|
|
68490
|
+
sweepFrom: r.from,
|
|
68491
|
+
sweepTo: r.to
|
|
68492
|
+
})
|
|
68493
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HorizontalSlider, {
|
|
67899
68494
|
...range,
|
|
67900
68495
|
label: t("uiLibrary.deviceCard.fan.fixed", "Fixed"),
|
|
67901
68496
|
ariaLabel: t("uiLibrary.deviceCard.fan.fixed", "Fixed"),
|
|
@@ -68080,7 +68675,8 @@ function fanAxisOf(axis) {
|
|
|
68080
68675
|
angle: axis.angle ?? 0,
|
|
68081
68676
|
min,
|
|
68082
68677
|
max,
|
|
68083
|
-
step: axis.step ?? AXIS_DEFAULT_STEP
|
|
68678
|
+
step: axis.step ?? AXIS_DEFAULT_STEP,
|
|
68679
|
+
minSpan: axis.minSpan
|
|
68084
68680
|
};
|
|
68085
68681
|
}
|
|
68086
68682
|
/** What the fan card draws from the slices; a field the device cannot command is not drawn. */
|
|
@@ -71160,6 +71756,71 @@ function reading(id, label, value) {
|
|
|
71160
71756
|
testId: `dc-hp-${id}`
|
|
71161
71757
|
});
|
|
71162
71758
|
}
|
|
71759
|
+
/** The reading and its setpoint ("20.5° → 21°"), else the circuit's own detail. */
|
|
71760
|
+
function circuitSummary(circuit) {
|
|
71761
|
+
return circuit.current !== null && circuit.target !== null ? `${circuit.current} → ${circuit.target}` : circuit.detail;
|
|
71762
|
+
}
|
|
71763
|
+
/** Past this many circuits the editor shows one at a time, picked with sub-chips. */
|
|
71764
|
+
var CIRCUITS_AS_ROWS = 3;
|
|
71765
|
+
function CircuitPicker({ circuit, onPick, t }) {
|
|
71766
|
+
const picker = circuit.picker;
|
|
71767
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71768
|
+
"data-testid": `dc-hp-edit-${circuit.id}`,
|
|
71769
|
+
className: "grid w-full justify-items-center gap-1 border-b border-border-subtle pb-2 last:border-b-0",
|
|
71770
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71771
|
+
className: "text-sm font-semibold",
|
|
71772
|
+
children: [circuit.label, circuitSummary(circuit) === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
71773
|
+
className: "ml-1 font-normal text-foreground-muted",
|
|
71774
|
+
children: circuitSummary(circuit)
|
|
71775
|
+
})]
|
|
71776
|
+
}), picker === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGroup, {
|
|
71777
|
+
testId: `dc-hp-circuit-${circuit.id}-${picker.kind}`,
|
|
71778
|
+
ariaLabel: picker.kind === "level" ? t("uiLibrary.deviceCard.heatPump.level", "Level") : t("uiLibrary.deviceCard.heatPump.mode", "Mode"),
|
|
71779
|
+
options: picker.options,
|
|
71780
|
+
value: picker.value,
|
|
71781
|
+
onChange: (value) => onPick(circuit.id, picker.kind, value)
|
|
71782
|
+
})]
|
|
71783
|
+
});
|
|
71784
|
+
}
|
|
71785
|
+
/**
|
|
71786
|
+
* Every circuit of a group with its selector, applied at once. Up to three
|
|
71787
|
+
* are rows; more are picked one at a time with sub-chips.
|
|
71788
|
+
*/
|
|
71789
|
+
function CircuitEditor({ circuits, onPick, t }) {
|
|
71790
|
+
const [chosen, setChosen] = (0, react$1.useState)(null);
|
|
71791
|
+
if (circuits.length <= CIRCUITS_AS_ROWS) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
71792
|
+
className: "grid w-full gap-2",
|
|
71793
|
+
"data-testid": "dc-hp-editor",
|
|
71794
|
+
children: circuits.map((c) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CircuitPicker, {
|
|
71795
|
+
circuit: c,
|
|
71796
|
+
onPick,
|
|
71797
|
+
t
|
|
71798
|
+
}, c.id))
|
|
71799
|
+
});
|
|
71800
|
+
const shown = circuits.find((c) => c.id === chosen) ?? circuits[0];
|
|
71801
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71802
|
+
className: "grid w-full justify-items-center gap-2",
|
|
71803
|
+
"data-testid": "dc-hp-editor",
|
|
71804
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
71805
|
+
className: "max-w-full overflow-x-auto",
|
|
71806
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonGroup, {
|
|
71807
|
+
testId: "dc-hp-circuit-chips",
|
|
71808
|
+
ariaLabel: t("uiLibrary.deviceCard.heatPump.circuit", "Circuit"),
|
|
71809
|
+
options: circuits.map((c) => ({
|
|
71810
|
+
id: c.id,
|
|
71811
|
+
label: c.label
|
|
71812
|
+
})),
|
|
71813
|
+
value: shown?.id ?? null,
|
|
71814
|
+
onChange: setChosen,
|
|
71815
|
+
actuates: false
|
|
71816
|
+
})
|
|
71817
|
+
}), shown === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CircuitPicker, {
|
|
71818
|
+
circuit: shown,
|
|
71819
|
+
onPick,
|
|
71820
|
+
t
|
|
71821
|
+
})]
|
|
71822
|
+
});
|
|
71823
|
+
}
|
|
71163
71824
|
function CircuitButton({ circuit, onPick, t }) {
|
|
71164
71825
|
const picker = circuit.picker;
|
|
71165
71826
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverButton, {
|
|
@@ -71167,9 +71828,9 @@ function CircuitButton({ circuit, onPick, t }) {
|
|
|
71167
71828
|
ariaLabel: t("uiLibrary.deviceCard.heatPump.openCircuit", "Open {{name}}", { name: circuit.label }),
|
|
71168
71829
|
label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
71169
71830
|
className: "truncate",
|
|
71170
|
-
children: [`${circuit.label} · ${circuit.status}`, circuit
|
|
71831
|
+
children: [`${circuit.label} · ${circuit.status}`, circuitSummary(circuit) === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
71171
71832
|
className: "ml-1 text-foreground-muted",
|
|
71172
|
-
children: circuit
|
|
71833
|
+
children: circuitSummary(circuit)
|
|
71173
71834
|
})]
|
|
71174
71835
|
}),
|
|
71175
71836
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -71214,22 +71875,33 @@ function SystemMode({ mode, onChange, t }) {
|
|
|
71214
71875
|
onChange: (value) => onChange(mode.id, value)
|
|
71215
71876
|
});
|
|
71216
71877
|
}
|
|
71217
|
-
|
|
71218
|
-
|
|
71219
|
-
|
|
71220
|
-
|
|
71878
|
+
/** The lower area of the overview: one summary row per circuit (reading and setpoint). */
|
|
71879
|
+
function summaryRows(model, actions, t) {
|
|
71880
|
+
return model.circuits.map((c) => rowButtons(`circuit-${c.id}`, {
|
|
71881
|
+
testId: `dc-hp-circuit-row-${c.id}`,
|
|
71882
|
+
buttons: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CircuitButton, {
|
|
71221
71883
|
circuit: c,
|
|
71222
71884
|
onPick: actions.onCircuit,
|
|
71223
71885
|
t
|
|
71224
|
-
}, c.id)
|
|
71225
|
-
})
|
|
71886
|
+
}, c.id)]
|
|
71887
|
+
}));
|
|
71888
|
+
}
|
|
71889
|
+
function editorRow(key, circuits, actions, t) {
|
|
71890
|
+
return circuits.length === 0 ? [] : [rowButtons(key, { buttons: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CircuitEditor, {
|
|
71891
|
+
circuits,
|
|
71892
|
+
onPick: actions.onCircuit,
|
|
71893
|
+
t
|
|
71894
|
+
}, key)] })];
|
|
71895
|
+
}
|
|
71896
|
+
function systemRows(model, actions, t) {
|
|
71897
|
+
return model.system.length === 0 ? [] : [rowButtons("system", {
|
|
71226
71898
|
testId: "dc-hp-system",
|
|
71227
71899
|
buttons: model.system.map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemMode, {
|
|
71228
71900
|
mode: m,
|
|
71229
71901
|
onChange: actions.onSystemMode,
|
|
71230
71902
|
t
|
|
71231
71903
|
}, m.id))
|
|
71232
|
-
})]
|
|
71904
|
+
})];
|
|
71233
71905
|
}
|
|
71234
71906
|
/**
|
|
71235
71907
|
* A heat pump: the outdoor unit whose fan turns with the compressor, the loop
|
|
@@ -71238,10 +71910,74 @@ function bottomRows$2(model, actions, t) {
|
|
|
71238
71910
|
* hot-water level) and the system modes the gateway declares. A value the
|
|
71239
71911
|
* gateway does not report is a dash, never a zero.
|
|
71240
71912
|
*/
|
|
71241
|
-
function HeatPumpCard({ model, actions, orientation = "vertical", showName = true }) {
|
|
71913
|
+
function HeatPumpCard({ model, actions, orientation = "vertical", showName = true, initialScene }) {
|
|
71242
71914
|
const t = useUiText();
|
|
71243
71915
|
const cold = model.activity === "cool" || model.activity === "defrost";
|
|
71244
71916
|
const comp = model.compressorPct;
|
|
71917
|
+
const overview = {
|
|
71918
|
+
fx: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AmbientFx, {
|
|
71919
|
+
role: "heat-pump",
|
|
71920
|
+
activity: model.activity === "idle" ? "idle" : cold ? "cool" : "heat",
|
|
71921
|
+
swing: false
|
|
71922
|
+
}),
|
|
71923
|
+
columns: {
|
|
71924
|
+
left: [
|
|
71925
|
+
reading("outdoor", t("uiLibrary.deviceCard.heatPump.outdoor", "Outdoor"), degrees$1(model.temperatures.outdoor, model.common.precision)),
|
|
71926
|
+
reading("supply", t("uiLibrary.deviceCard.heatPump.supply", "Flow"), degrees$1(model.temperatures.supply, model.common.precision)),
|
|
71927
|
+
reading("return", t("uiLibrary.deviceCard.heatPump.return", "Return"), degrees$1(model.temperatures.return, model.common.precision)),
|
|
71928
|
+
reading("pressure", t("uiLibrary.deviceCard.heatPump.pressure", "Pressure"), model.pressureBar === null ? null : `${model.pressureBar} bar`)
|
|
71929
|
+
],
|
|
71930
|
+
right: [
|
|
71931
|
+
reading("thermal", t("uiLibrary.deviceCard.heatPump.thermal", "Thermal"), kilowatts(model.thermalW, model.common.precision)),
|
|
71932
|
+
reading("electrical", t("uiLibrary.deviceCard.heatPump.electrical", "Electrical"), kilowatts(model.electricalW, model.common.precision)),
|
|
71933
|
+
reading("cop", t("uiLibrary.deviceCard.heatPump.cop", "COP"), model.cop === null ? null : formatNumeric(model.cop, model.common.precision))
|
|
71934
|
+
]
|
|
71935
|
+
},
|
|
71936
|
+
image: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71937
|
+
className: "grid w-full min-w-26 max-w-52 justify-items-center gap-1.5",
|
|
71938
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatPumpIllustration, {
|
|
71939
|
+
compressorPct: comp,
|
|
71940
|
+
cold,
|
|
71941
|
+
className: "h-auto w-full"
|
|
71942
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71943
|
+
"data-testid": "dc-hp-compressor",
|
|
71944
|
+
className: "grid w-full gap-1 text-center text-xs text-foreground-muted",
|
|
71945
|
+
children: [t("uiLibrary.deviceCard.heatPump.compressor", "Compressor {{value}}", { value: comp === null ? "—" : `${Math.round(comp)}%` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LevelBar, {
|
|
71946
|
+
percent: comp ?? 0,
|
|
71947
|
+
ariaLabel: t("uiLibrary.deviceCard.heatPump.compressorBar", "Compressor speed")
|
|
71948
|
+
})]
|
|
71949
|
+
})]
|
|
71950
|
+
}),
|
|
71951
|
+
bottom: summaryRows(model, actions, t)
|
|
71952
|
+
};
|
|
71953
|
+
const heating = model.circuits.filter((c) => c.group === "heating");
|
|
71954
|
+
const hotWater = model.circuits.filter((c) => c.group === "hotWater");
|
|
71955
|
+
const sub = (bottom) => ({
|
|
71956
|
+
image: null,
|
|
71957
|
+
bottom
|
|
71958
|
+
});
|
|
71959
|
+
const views = [
|
|
71960
|
+
{
|
|
71961
|
+
id: "overview",
|
|
71962
|
+
label: t("uiLibrary.deviceCard.heatPump.sceneOverview", "Overview"),
|
|
71963
|
+
scene: overview
|
|
71964
|
+
},
|
|
71965
|
+
...heating.length === 0 ? [] : [{
|
|
71966
|
+
id: "circuits",
|
|
71967
|
+
label: t("uiLibrary.deviceCard.heatPump.sceneCircuits", "Circuits"),
|
|
71968
|
+
scene: sub(editorRow("edit-heating", heating, actions, t))
|
|
71969
|
+
}],
|
|
71970
|
+
...hotWater.length === 0 ? [] : [{
|
|
71971
|
+
id: "hotWater",
|
|
71972
|
+
label: t("uiLibrary.deviceCard.heatPump.hotWater", "Hot water"),
|
|
71973
|
+
scene: sub(editorRow("edit-hotwater", hotWater, actions, t))
|
|
71974
|
+
}],
|
|
71975
|
+
...model.system.length === 0 ? [] : [{
|
|
71976
|
+
id: "system",
|
|
71977
|
+
label: t("uiLibrary.deviceCard.heatPump.sceneSystem", "System"),
|
|
71978
|
+
scene: sub(systemRows(model, actions, t))
|
|
71979
|
+
}]
|
|
71980
|
+
];
|
|
71245
71981
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeviceCard, {
|
|
71246
71982
|
kind: "heat-pump",
|
|
71247
71983
|
common: model.common,
|
|
@@ -71254,42 +71990,9 @@ function HeatPumpCard({ model, actions, orientation = "vertical", showName = tru
|
|
|
71254
71990
|
since: model.since,
|
|
71255
71991
|
tone: TONE$9[model.activity]
|
|
71256
71992
|
},
|
|
71257
|
-
scene:
|
|
71258
|
-
|
|
71259
|
-
|
|
71260
|
-
activity: model.activity === "idle" ? "idle" : cold ? "cool" : "heat",
|
|
71261
|
-
swing: false
|
|
71262
|
-
}),
|
|
71263
|
-
columns: {
|
|
71264
|
-
left: [
|
|
71265
|
-
reading("outdoor", t("uiLibrary.deviceCard.heatPump.outdoor", "Outdoor"), degrees$1(model.temperatures.outdoor, model.common.precision)),
|
|
71266
|
-
reading("supply", t("uiLibrary.deviceCard.heatPump.supply", "Flow"), degrees$1(model.temperatures.supply, model.common.precision)),
|
|
71267
|
-
reading("return", t("uiLibrary.deviceCard.heatPump.return", "Return"), degrees$1(model.temperatures.return, model.common.precision)),
|
|
71268
|
-
reading("pressure", t("uiLibrary.deviceCard.heatPump.pressure", "Pressure"), model.pressureBar === null ? null : `${model.pressureBar} bar`)
|
|
71269
|
-
],
|
|
71270
|
-
right: [
|
|
71271
|
-
reading("thermal", t("uiLibrary.deviceCard.heatPump.thermal", "Thermal"), kilowatts(model.thermalW, model.common.precision)),
|
|
71272
|
-
reading("electrical", t("uiLibrary.deviceCard.heatPump.electrical", "Electrical"), kilowatts(model.electricalW, model.common.precision)),
|
|
71273
|
-
reading("cop", t("uiLibrary.deviceCard.heatPump.cop", "COP"), model.cop === null ? null : formatNumeric(model.cop, model.common.precision))
|
|
71274
|
-
]
|
|
71275
|
-
},
|
|
71276
|
-
image: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71277
|
-
className: "grid w-full min-w-26 max-w-52 justify-items-center gap-1.5",
|
|
71278
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatPumpIllustration, {
|
|
71279
|
-
compressorPct: comp,
|
|
71280
|
-
cold,
|
|
71281
|
-
className: "h-auto w-full"
|
|
71282
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71283
|
-
"data-testid": "dc-hp-compressor",
|
|
71284
|
-
className: "grid w-full gap-1 text-center text-xs text-foreground-muted",
|
|
71285
|
-
children: [t("uiLibrary.deviceCard.heatPump.compressor", "Compressor {{value}}", { value: comp === null ? "—" : `${Math.round(comp)}%` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LevelBar, {
|
|
71286
|
-
percent: comp ?? 0,
|
|
71287
|
-
ariaLabel: t("uiLibrary.deviceCard.heatPump.compressorBar", "Compressor speed")
|
|
71288
|
-
})]
|
|
71289
|
-
})]
|
|
71290
|
-
}),
|
|
71291
|
-
bottom: bottomRows$2(model, actions, t)
|
|
71292
|
-
}
|
|
71993
|
+
scene: overview,
|
|
71994
|
+
sceneViews: views,
|
|
71995
|
+
...initialScene === void 0 ? {} : { initialSceneView: initialScene }
|
|
71293
71996
|
});
|
|
71294
71997
|
}
|
|
71295
71998
|
//#endregion
|
|
@@ -71353,21 +72056,25 @@ var degrees = (value, precision) => value === null ? null : `${formatNumeric(val
|
|
|
71353
72056
|
function heatPumpCircuitView(circuit, t, precision) {
|
|
71354
72057
|
const picker = heatPumpCircuitPicker(circuit, t);
|
|
71355
72058
|
const chosen = picker === null || picker.value === null ? null : heatPumpValueLabel(picker.value, t);
|
|
71356
|
-
|
|
71357
|
-
|
|
71358
|
-
|
|
71359
|
-
|
|
71360
|
-
|
|
71361
|
-
|
|
71362
|
-
|
|
71363
|
-
|
|
71364
|
-
|
|
71365
|
-
}
|
|
71366
|
-
|
|
72059
|
+
const target = degrees(circuit.targetTemp, precision);
|
|
72060
|
+
const current = degrees(circuit.currentTemp, precision);
|
|
72061
|
+
if (circuit.kind === "dhw") return {
|
|
72062
|
+
id: circuit.id,
|
|
72063
|
+
group: "hotWater",
|
|
72064
|
+
label: circuit.label,
|
|
72065
|
+
current,
|
|
72066
|
+
target,
|
|
72067
|
+
status: circuit.active === true ? t("uiLibrary.deviceCard.heatPump.charging", "Charging") : current ?? chosen ?? "—",
|
|
72068
|
+
detail: circuit.active === true && current !== null && target !== null ? `${current} → ${target}` : chosen,
|
|
72069
|
+
picker
|
|
72070
|
+
};
|
|
71367
72071
|
const working = circuit.kind === "cooling" ? t("uiLibrary.deviceCard.heatPump.cooling", "Cooling") : t("uiLibrary.deviceCard.heatPump.heating", "Heating");
|
|
71368
72072
|
return {
|
|
71369
72073
|
id: circuit.id,
|
|
72074
|
+
group: "heating",
|
|
71370
72075
|
label: circuit.label,
|
|
72076
|
+
current,
|
|
72077
|
+
target,
|
|
71371
72078
|
status: circuit.active === true ? working : chosen ?? "—",
|
|
71372
72079
|
detail: degrees(circuit.targetTemp, precision),
|
|
71373
72080
|
picker
|
|
@@ -87613,7 +88320,7 @@ function DeviceBatchActionsBar(props) {
|
|
|
87613
88320
|
*/
|
|
87614
88321
|
/** The "All" option — one page holding every row. */
|
|
87615
88322
|
var PAGE_SIZE_ALL = 0;
|
|
87616
|
-
function readStored(key, options, fallback) {
|
|
88323
|
+
function readStored$1(key, options, fallback) {
|
|
87617
88324
|
if (key === null || typeof window === "undefined") return fallback;
|
|
87618
88325
|
try {
|
|
87619
88326
|
const raw = window.localStorage.getItem(key);
|
|
@@ -87624,7 +88331,7 @@ function readStored(key, options, fallback) {
|
|
|
87624
88331
|
return fallback;
|
|
87625
88332
|
}
|
|
87626
88333
|
}
|
|
87627
|
-
function writeStored(key, value) {
|
|
88334
|
+
function writeStored$1(key, value) {
|
|
87628
88335
|
if (key === null || typeof window === "undefined") return;
|
|
87629
88336
|
try {
|
|
87630
88337
|
window.localStorage.setItem(key, String(value));
|
|
@@ -87633,11 +88340,11 @@ function writeStored(key, value) {
|
|
|
87633
88340
|
/** @returns `[size, setSize]`; `setSize` ignores a size that is not an option. */
|
|
87634
88341
|
function usePersistedPageSize({ storageKey, options, defaultSize }) {
|
|
87635
88342
|
const seed = options.includes(defaultSize) ? defaultSize : options[0] ?? defaultSize;
|
|
87636
|
-
const [size, setSize] = (0, react$1.useState)(() => readStored(storageKey, options, seed));
|
|
88343
|
+
const [size, setSize] = (0, react$1.useState)(() => readStored$1(storageKey, options, seed));
|
|
87637
88344
|
return [size, (0, react$1.useCallback)((next) => {
|
|
87638
88345
|
if (!options.includes(next)) return;
|
|
87639
88346
|
setSize(next);
|
|
87640
|
-
writeStored(storageKey, next);
|
|
88347
|
+
writeStored$1(storageKey, next);
|
|
87641
88348
|
}, [options, storageKey])];
|
|
87642
88349
|
}
|
|
87643
88350
|
/**
|
|
@@ -92700,6 +93407,7 @@ function SetupFieldRow({ field }) {
|
|
|
92700
93407
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
92701
93408
|
label: field.label,
|
|
92702
93409
|
valueClassName: "font-mono",
|
|
93410
|
+
wrapValue: true,
|
|
92703
93411
|
actions: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [isSecret && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
92704
93412
|
size: "sm",
|
|
92705
93413
|
variant: "ghost",
|
|
@@ -103962,7 +104670,7 @@ function TaggedDataTable({ section, rows, columns, getTags, searchText, searchLa
|
|
|
103962
104670
|
}
|
|
103963
104671
|
//#endregion
|
|
103964
104672
|
//#region src/ui-library-version.ts
|
|
103965
|
-
var uiLibraryVersion = "0.1.
|
|
104673
|
+
var uiLibraryVersion = "0.1.3";
|
|
103966
104674
|
//#endregion
|
|
103967
104675
|
//#region src/hooks/use-account-unit-preferences.ts
|
|
103968
104676
|
/**
|
|
@@ -104736,6 +105444,39 @@ function useEventInvalidation(queryKey, categories) {
|
|
|
104736
105444
|
]);
|
|
104737
105445
|
}
|
|
104738
105446
|
//#endregion
|
|
105447
|
+
//#region src/hooks/use-collapsed-sections.ts
|
|
105448
|
+
function readStored(storageKey) {
|
|
105449
|
+
try {
|
|
105450
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
105451
|
+
if (raw === null) return /* @__PURE__ */ new Set();
|
|
105452
|
+
const parsed = JSON.parse(raw);
|
|
105453
|
+
return Array.isArray(parsed) ? new Set(parsed.filter((k) => typeof k === "string")) : /* @__PURE__ */ new Set();
|
|
105454
|
+
} catch {
|
|
105455
|
+
return /* @__PURE__ */ new Set();
|
|
105456
|
+
}
|
|
105457
|
+
}
|
|
105458
|
+
function writeStored(storageKey, ids) {
|
|
105459
|
+
try {
|
|
105460
|
+
window.localStorage.setItem(storageKey, JSON.stringify([...ids]));
|
|
105461
|
+
} catch {}
|
|
105462
|
+
}
|
|
105463
|
+
/** Which sections the operator folded, remembered per browser. Absent = open. */
|
|
105464
|
+
function useCollapsedSections(storageKey) {
|
|
105465
|
+
const [collapsed, setCollapsed] = (0, react$1.useState)(() => readStored(storageKey));
|
|
105466
|
+
return {
|
|
105467
|
+
isCollapsed: (0, react$1.useCallback)((id) => collapsed.has(id), [collapsed]),
|
|
105468
|
+
toggle: (0, react$1.useCallback)((id) => {
|
|
105469
|
+
setCollapsed((prev) => {
|
|
105470
|
+
const next = new Set(prev);
|
|
105471
|
+
if (next.has(id)) next.delete(id);
|
|
105472
|
+
else next.add(id);
|
|
105473
|
+
writeStored(storageKey, next);
|
|
105474
|
+
return next;
|
|
105475
|
+
});
|
|
105476
|
+
}, [storageKey])
|
|
105477
|
+
};
|
|
105478
|
+
}
|
|
105479
|
+
//#endregion
|
|
104739
105480
|
//#region src/hooks/use-system-query.ts
|
|
104740
105481
|
/**
|
|
104741
105482
|
* useSystemQuery / useSystemMutation — generic escape hatches over the
|
|
@@ -105101,6 +105842,7 @@ exports.AlarmIllustration = AlarmIllustration;
|
|
|
105101
105842
|
exports.AlarmPanelInlineControl = AlarmInlineControl;
|
|
105102
105843
|
exports.AlarmSmoke = AlarmSmoke;
|
|
105103
105844
|
exports.AmbientFx = AmbientFx;
|
|
105845
|
+
exports.AngleRangeArc = AngleRangeArc;
|
|
105104
105846
|
exports.AppBrandGlyph = AppBrandGlyph;
|
|
105105
105847
|
exports.AppShell = AppShell;
|
|
105106
105848
|
exports.AppWindow = AppWindow;
|
|
@@ -105458,7 +106200,6 @@ exports.ExternalLink = ExternalLink;
|
|
|
105458
106200
|
exports.Eye = Eye;
|
|
105459
106201
|
exports.EyeOff = EyeOff;
|
|
105460
106202
|
exports.FALLBACK_SCOPE = FALLBACK_SCOPE;
|
|
105461
|
-
exports.FAN_MIN_SWEEP = FAN_MIN_SWEEP;
|
|
105462
106203
|
exports.FAST_ICON_GLYPHS = FAST_ICON_GLYPHS;
|
|
105463
106204
|
exports.FILL = FILL;
|
|
105464
106205
|
exports.FLEET_LIST_GC_TIME_MS = FLEET_LIST_GC_TIME_MS;
|
|
@@ -105791,6 +106532,10 @@ exports.SETTING_ROW_LABEL = SETTING_ROW_LABEL;
|
|
|
105791
106532
|
exports.SETTING_ROW_STACK_BREAKPOINT = SETTING_ROW_STACK_BREAKPOINT;
|
|
105792
106533
|
exports.SETTING_ROW_VALUE = SETTING_ROW_VALUE;
|
|
105793
106534
|
exports.SETTING_ROW_VALUE_TEXT = SETTING_ROW_VALUE_TEXT;
|
|
106535
|
+
exports.SETTING_ROW_VALUE_TEXT_WRAP = SETTING_ROW_VALUE_TEXT_WRAP;
|
|
106536
|
+
exports.SETTING_ROW_VALUE_WRAP = SETTING_ROW_VALUE_WRAP;
|
|
106537
|
+
exports.SETTING_ROW_WRAP = SETTING_ROW_WRAP;
|
|
106538
|
+
exports.SIDEBAR_ACCENT_CLASSES = SIDEBAR_ACCENT_CLASSES;
|
|
105794
106539
|
exports.SNAPSHOT_MEDIA_PATH = SNAPSHOT_MEDIA_PATH;
|
|
105795
106540
|
exports.SPLIT_PANEL_OUTER = SPLIT_PANEL_OUTER;
|
|
105796
106541
|
exports.SPLIT_PANEL_SIDE = SPLIT_PANEL_SIDE;
|
|
@@ -105861,6 +106606,7 @@ exports.Ship = Ship;
|
|
|
105861
106606
|
exports.Shirt = Shirt;
|
|
105862
106607
|
exports.Sidebar = Sidebar;
|
|
105863
106608
|
exports.SidebarItem = SidebarItem;
|
|
106609
|
+
exports.SidebarSectionGroup = SidebarSectionGroup;
|
|
105864
106610
|
exports.Sigma = Sigma;
|
|
105865
106611
|
exports.Siren = Siren$1;
|
|
105866
106612
|
exports.SirenCard = SirenCard;
|
|
@@ -106050,11 +106796,13 @@ exports.ambientLayers = ambientLayers;
|
|
|
106050
106796
|
exports.ambientPace = ambientPace;
|
|
106051
106797
|
exports.anchorNow = anchorNow;
|
|
106052
106798
|
exports.anemometerSpinRate = anemometerSpinRate;
|
|
106799
|
+
exports.angleToValue = angleToValue;
|
|
106053
106800
|
exports.appIconKey = appIconKey;
|
|
106054
106801
|
exports.applianceKindOf = applianceKindOf;
|
|
106055
106802
|
exports.appliancePhaseLabel = appliancePhaseLabel;
|
|
106056
106803
|
exports.applyFleetQueryDefaults = applyFleetQueryDefaults;
|
|
106057
106804
|
exports.applyPickerFilters = applyPickerFilters;
|
|
106805
|
+
exports.applyPreset = applyPreset;
|
|
106058
106806
|
exports.applySuggestion = applySuggestion;
|
|
106059
106807
|
exports.ariaSortForColumn = ariaSortForColumn;
|
|
106060
106808
|
exports.assignNodeColorId = _dominevo_types.assignNodeColorId;
|
|
@@ -106347,6 +107095,8 @@ exports.isRefusal = isRefusal;
|
|
|
106347
107095
|
exports.isRoutingRole = isRoutingRole;
|
|
106348
107096
|
exports.isSecretField = isSecretField;
|
|
106349
107097
|
exports.isSlimDivider = isSlimDivider;
|
|
107098
|
+
exports.isSymmetric = isSymmetric;
|
|
107099
|
+
exports.isValidRange = isValidRange;
|
|
106350
107100
|
exports.isValueField = isValueField;
|
|
106351
107101
|
exports.joinDuration = joinDuration;
|
|
106352
107102
|
exports.kelvinRgb = kelvinRgb;
|
|
@@ -106393,6 +107143,7 @@ exports.mountAddonPage = mountAddonPage;
|
|
|
106393
107143
|
exports.mountPath = mountPath;
|
|
106394
107144
|
exports.moveButton = moveButton;
|
|
106395
107145
|
exports.moveGroup = moveGroup;
|
|
107146
|
+
exports.moveHandle = moveHandle;
|
|
106396
107147
|
exports.moveRangeHandle = moveRangeHandle;
|
|
106397
107148
|
exports.mowerActivityOf = mowerActivityOf;
|
|
106398
107149
|
exports.ncWindowOfTimeWindow = ncWindowOfTimeWindow;
|
|
@@ -106471,6 +107222,7 @@ exports.plugAppliancePhase = plugAppliancePhase;
|
|
|
106471
107222
|
exports.positionOf = positionOf;
|
|
106472
107223
|
exports.preferenceForQuantity = preferenceForQuantity;
|
|
106473
107224
|
exports.presentCommand = presentCommand;
|
|
107225
|
+
exports.presetSpans = presetSpans;
|
|
106474
107226
|
exports.previousWindow = previousWindow;
|
|
106475
107227
|
exports.programDisplayLabel = programDisplayLabel;
|
|
106476
107228
|
exports.programNamesFromOptions = programNamesFromOptions;
|
|
@@ -106591,6 +107343,7 @@ exports.sirenCountdownOf = sirenCountdownOf;
|
|
|
106591
107343
|
exports.sirenRunOf = sirenRunOf;
|
|
106592
107344
|
exports.sirenTriggerInputOf = sirenTriggerInputOf;
|
|
106593
107345
|
exports.slimRowsOf = slimRowsOf;
|
|
107346
|
+
exports.snapAngle = snapAngle;
|
|
106594
107347
|
exports.snapMinute = snapMinute;
|
|
106595
107348
|
exports.sortRows = sortRows;
|
|
106596
107349
|
exports.sortRowsByColumn = sortRowsByColumn;
|
|
@@ -106843,6 +107596,7 @@ exports.useClusterTopology = useClusterTopology;
|
|
|
106843
107596
|
exports.useClusterUpdateGetClusterUpdateJob = useClusterUpdateGetClusterUpdateJob;
|
|
106844
107597
|
exports.useClusterUpdatePreviewClusterUpdate = useClusterUpdatePreviewClusterUpdate;
|
|
106845
107598
|
exports.useClusterUpdateStartClusterUpdate = useClusterUpdateStartClusterUpdate;
|
|
107599
|
+
exports.useCollapsedSections = useCollapsedSections;
|
|
106846
107600
|
exports.useColorGetStatus = useColorGetStatus;
|
|
106847
107601
|
exports.useColorSetColor = useColorSetColor;
|
|
106848
107602
|
exports.useCommandNotice = useCommandNotice;
|
|
@@ -107092,10 +107846,14 @@ exports.useDeviceManagerUpdateConfig = useDeviceManagerUpdateConfig;
|
|
|
107092
107846
|
exports.useDeviceManagerUpdateDeviceField = useDeviceManagerUpdateDeviceField;
|
|
107093
107847
|
exports.useDeviceManagerUpdateDeviceFieldsBatch = useDeviceManagerUpdateDeviceFieldsBatch;
|
|
107094
107848
|
exports.useDeviceManagerUpdateRoom = useDeviceManagerUpdateRoom;
|
|
107849
|
+
exports.useDeviceMeshGetFeatures = useDeviceMeshGetFeatures;
|
|
107850
|
+
exports.useDeviceMeshGetJoinState = useDeviceMeshGetJoinState;
|
|
107095
107851
|
exports.useDeviceMeshGetNodeDiagnostics = useDeviceMeshGetNodeDiagnostics;
|
|
107096
107852
|
exports.useDeviceMeshGetTopology = useDeviceMeshGetTopology;
|
|
107853
|
+
exports.useDeviceMeshOpenJoin = useDeviceMeshOpenJoin;
|
|
107097
107854
|
exports.useDeviceMeshReadNow = useDeviceMeshReadNow;
|
|
107098
107855
|
exports.useDeviceMeshRefresh = useDeviceMeshRefresh;
|
|
107856
|
+
exports.useDeviceMeshRemoveNode = useDeviceMeshRemoveNode;
|
|
107099
107857
|
exports.useDeviceNameIndex = useDeviceNameIndex;
|
|
107100
107858
|
exports.useDeviceNameNouns = useDeviceNameNouns;
|
|
107101
107859
|
exports.useDeviceNetworkLink = useDeviceNetworkLink;
|
|
@@ -108196,6 +108954,7 @@ exports.useZonesRemoveZone = useZonesRemoveZone;
|
|
|
108196
108954
|
exports.useZonesUpdateZone = useZonesUpdateZone;
|
|
108197
108955
|
exports.vacuumActivityOf = vacuumActivityOf;
|
|
108198
108956
|
exports.validateScopes = validateScopes;
|
|
108957
|
+
exports.valueToAngle = valueToAngle;
|
|
108199
108958
|
exports.valveOpenness = valveOpenness;
|
|
108200
108959
|
exports.valveStateLabel = valveStateLabel;
|
|
108201
108960
|
exports.valveStateMeta = valveStateMeta;
|