@dominevo/ui-library 0.1.0 → 0.1.1
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 +8 -0
- package/dist/{SceneMonitorEditor-CU24Au1r.cjs → SceneMonitorEditor-Bres0ZEA.cjs} +1 -1
- package/dist/{SceneMonitorEditor-Bj_BN2Ar.js → SceneMonitorEditor-grGP7vRI.js} +1 -1
- package/dist/composites/adaptive-downlink.d.ts +1 -1
- package/dist/composites/camera-stream-player.d.ts +1 -1
- package/dist/composites/charts/StateTimeline.d.ts +3 -1
- package/dist/composites/charts/TimeSeriesChart.d.ts +3 -1
- package/dist/composites/charts/chart-frame.d.ts +3 -1
- package/dist/composites/charts/chart-palette.d.ts +1 -1
- package/dist/composites/clips/ClipBandBar.d.ts +1 -1
- package/dist/composites/clips/ClipTile.d.ts +1 -1
- package/dist/composites/clips/ClipsSection.d.ts +1 -1
- package/dist/composites/clips/clip-tile-media.d.ts +2 -2
- package/dist/composites/device-card/connected/MeasuredPieCard.d.ts +1 -11
- package/dist/composites/device-card/connected/ReadingHistory.d.ts +20 -0
- package/dist/composites/device-card/scenes/sensor/ReadingTile.d.ts +1 -1
- package/dist/composites/device-card/scenes/sensor/SensorPieCard.d.ts +9 -7
- package/dist/composites/device-card/scenes/sensor/pie-css.d.ts +4 -4
- package/dist/composites/device-card/scenes/sensor/pie-model.d.ts +5 -0
- package/dist/composites/device-card/scenes/sensor/reading-colour.d.ts +32 -0
- package/dist/composites/device-export-panel.d.ts +1 -1
- package/dist/composites/device-list/url-state.d.ts +1 -1
- package/dist/composites/device-picker/device-picker-grouping.d.ts +1 -1
- package/dist/composites/device-picker/device-selection.d.ts +1 -1
- package/dist/contexts/recorded-playback.d.ts +2 -2
- package/dist/contexts/widget-registry.d.ts +1 -1
- package/dist/hooks/use-capability-presence.d.ts +21 -0
- package/dist/hooks/use-device-list-page-size.d.ts +2 -2
- package/dist/hooks/use-url-query.d.ts +2 -2
- package/dist/index.cjs +740 -656
- package/dist/index.js +741 -657
- package/dist/lib/recorded-control-protocol.d.ts +1 -1
- package/dist/lib/shared-context.d.ts +1 -1
- package/dist/theme/create-theme.d.ts +2 -2
- package/dist/theme/defaults.d.ts +4 -4
- package/dist/theme/index.cjs +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/theme-to-css.d.ts +2 -2
- package/dist/theme/theme-to-root-css.d.ts +2 -2
- package/dist/theme/tokens.d.ts +1 -1
- package/dist/theme/types.d.ts +4 -4
- package/dist/trpc-react.d.ts +3 -3
- package/package.json +7 -7
- /package/src/tailwind/{camstack-theme.css → dominevo-theme.css} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -9441,7 +9441,7 @@ var ZoomOut = require_chevron_down.createLucideIcon("zoom-out", [
|
|
|
9441
9441
|
/**
|
|
9442
9442
|
* Shared typed React Query proxy for the backend AppRouter.
|
|
9443
9443
|
*
|
|
9444
|
-
* The proxy is exposed on `window.
|
|
9444
|
+
* The proxy is exposed on `window.__dominevoTrpcReact` so addon-page
|
|
9445
9445
|
* bundles (which load AFTER the host admin-ui sets the global) reuse
|
|
9446
9446
|
* the host's `createTRPCReact` instance instead of creating a separate
|
|
9447
9447
|
* one. Sharing the instance is mandatory because the typed React-Query
|
|
@@ -9451,16 +9451,16 @@ var ZoomOut = require_chevron_down.createLucideIcon("zoom-out", [
|
|
|
9451
9451
|
*
|
|
9452
9452
|
* Boot order:
|
|
9453
9453
|
* 1. admin-ui's `main.tsx` is the first script to evaluate this
|
|
9454
|
-
* module, sees `window.
|
|
9454
|
+
* module, sees `window.__dominevoTrpcReact === undefined`,
|
|
9455
9455
|
* creates the proxy, stashes it on the window.
|
|
9456
9456
|
* 2. Addon bundles are loaded later by `AddonPageLoader` — when
|
|
9457
9457
|
* their entrypoint evaluates this same module (resolved through
|
|
9458
9458
|
* Vite alias to ui-library/src), the global is already set, so
|
|
9459
9459
|
* they pick up the host instance and skip the second create.
|
|
9460
9460
|
*/
|
|
9461
|
-
var existing = typeof globalThis !== "undefined" ? globalThis.
|
|
9461
|
+
var existing = typeof globalThis !== "undefined" ? globalThis.__dominevoTrpcReact : void 0;
|
|
9462
9462
|
var trpc = existing ?? (0, _trpc_react_query.createTRPCReact)();
|
|
9463
|
-
if (typeof globalThis !== "undefined" && !existing) globalThis.
|
|
9463
|
+
if (typeof globalThis !== "undefined" && !existing) globalThis.__dominevoTrpcReact = trpc;
|
|
9464
9464
|
//#endregion
|
|
9465
9465
|
//#region src/lib/shared-context.ts
|
|
9466
9466
|
/**
|
|
@@ -9490,9 +9490,9 @@ if (typeof globalThis !== "undefined" && !existing) globalThis.__camstackTrpcRea
|
|
|
9490
9490
|
*/
|
|
9491
9491
|
function createSharedContext(name, defaultValue) {
|
|
9492
9492
|
if (typeof globalThis === "undefined") return (0, react$1.createContext)(defaultValue);
|
|
9493
|
-
const existingMap = globalThis.
|
|
9493
|
+
const existingMap = globalThis.__dominevoSharedContexts;
|
|
9494
9494
|
const map = existingMap ?? /* @__PURE__ */ new Map();
|
|
9495
|
-
if (!existingMap) globalThis.
|
|
9495
|
+
if (!existingMap) globalThis.__dominevoSharedContexts = map;
|
|
9496
9496
|
const existing = map.get(name);
|
|
9497
9497
|
if (existing) return existing;
|
|
9498
9498
|
const ctx = (0, react$1.createContext)(defaultValue);
|
|
@@ -9523,7 +9523,7 @@ function createSharedContext(name, defaultValue) {
|
|
|
9523
9523
|
* `createContext()` produces a fresh instance that never matches the
|
|
9524
9524
|
* host's `<SystemProvider>`.
|
|
9525
9525
|
*/
|
|
9526
|
-
var SystemContext = createSharedContext("
|
|
9526
|
+
var SystemContext = createSharedContext("dominevo:system", null);
|
|
9527
9527
|
function SystemProvider({ system, children }) {
|
|
9528
9528
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemContext.Provider, {
|
|
9529
9529
|
value: system,
|
|
@@ -9726,6 +9726,22 @@ function useCapabilityPresence(capabilityName) {
|
|
|
9726
9726
|
return classifyCapability(query.data);
|
|
9727
9727
|
}
|
|
9728
9728
|
/**
|
|
9729
|
+
* Presence of a DEVICE-NATIVE capability, from a device search that requires it.
|
|
9730
|
+
*
|
|
9731
|
+
* A device-native capability has no addon-level provider: providers register it
|
|
9732
|
+
* on the devices they own, so the registry row (`getCapability`) answers
|
|
9733
|
+
* `providers: []` forever and `useCapabilityPresence` would say `absent` while
|
|
9734
|
+
* the cluster has the capability on many devices. The authority is the device
|
|
9735
|
+
* search: `present` when at least one compatible device carries it, `absent`
|
|
9736
|
+
* only when the search ANSWERED with none, `pending` until it answers,
|
|
9737
|
+
* `unknown` when it failed (D315).
|
|
9738
|
+
*/
|
|
9739
|
+
function classifyDeviceNativePresence(answer) {
|
|
9740
|
+
if (answer.status === "pending") return "pending";
|
|
9741
|
+
if (answer.status === "error") return "unknown";
|
|
9742
|
+
return (answer.data?.items ?? []).some((item) => item.compatible) ? "present" : "absent";
|
|
9743
|
+
}
|
|
9744
|
+
/**
|
|
9729
9745
|
* Classify ONE node from the registry's answer — the per-node form of
|
|
9730
9746
|
* `useCapabilityPresence`, for a picker that offers only the nodes running a
|
|
9731
9747
|
* provider.
|
|
@@ -12065,7 +12081,7 @@ var SECRET_REVEAL_MS = 1e4;
|
|
|
12065
12081
|
var SECRET_MASK_PLACEHOLDER = "••••••••";
|
|
12066
12082
|
/** How long a refused reveal's reason stays on the eye. */
|
|
12067
12083
|
var REVEAL_ERROR_MS = 5e3;
|
|
12068
|
-
var SecretRevealContext = createSharedContext("
|
|
12084
|
+
var SecretRevealContext = createSharedContext("dominevo:secret-reveal", null);
|
|
12069
12085
|
function SecretRevealProvider({ reveal, children }) {
|
|
12070
12086
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SecretRevealContext.Provider, {
|
|
12071
12087
|
value: reveal,
|
|
@@ -17573,7 +17589,7 @@ function DeviceValuePanel(props) {
|
|
|
17573
17589
|
}
|
|
17574
17590
|
//#endregion
|
|
17575
17591
|
//#region src/composites/device-value-picker/use-recent-devices.ts
|
|
17576
|
-
var STORAGE_PREFIX$1 = "
|
|
17592
|
+
var STORAGE_PREFIX$1 = "dominevo.deviceValuePicker.recent.";
|
|
17577
17593
|
function read$1(key) {
|
|
17578
17594
|
try {
|
|
17579
17595
|
const raw = JSON.parse(window.localStorage.getItem(STORAGE_PREFIX$1 + key) ?? "[]");
|
|
@@ -18744,7 +18760,7 @@ function ConfigNotificationTargetSelectFieldView({ field, value, onChange, disab
|
|
|
18744
18760
|
* dynamic dispatch, so the implementation must validate / cast).
|
|
18745
18761
|
* - `value`, `onChange`, `disabled` — same as built-in fields.
|
|
18746
18762
|
*/
|
|
18747
|
-
var CustomFieldRenderersContext = createSharedContext("
|
|
18763
|
+
var CustomFieldRenderersContext = createSharedContext("dominevo:custom-field-renderers", {});
|
|
18748
18764
|
function CustomFieldRenderersProvider({ renderers, children }) {
|
|
18749
18765
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomFieldRenderersContext.Provider, {
|
|
18750
18766
|
value: renderers,
|
|
@@ -19082,7 +19098,7 @@ function SecretPresenceField({ field, values }) {
|
|
|
19082
19098
|
* stopping there keeps the event from reaching the `window` Escape listener
|
|
19083
19099
|
* of whatever modal is underneath: one Escape closes ONE dialog.
|
|
19084
19100
|
*/
|
|
19085
|
-
var ConfirmContext = createSharedContext("
|
|
19101
|
+
var ConfirmContext = createSharedContext("dominevo:confirm-dialog", null);
|
|
19086
19102
|
function useDialogContext$1() {
|
|
19087
19103
|
const ctx = (0, react$1.useContext)(ConfirmContext);
|
|
19088
19104
|
if (!ctx) throw new Error("useConfirm must be used within ConfirmDialogProvider");
|
|
@@ -19288,7 +19304,7 @@ function DialogSurface({ state, onClose }) {
|
|
|
19288
19304
|
accept();
|
|
19289
19305
|
}, [accept]);
|
|
19290
19306
|
const style = VARIANT_STYLES$1[variantOf(state)];
|
|
19291
|
-
const titleId = "
|
|
19307
|
+
const titleId = "dominevo-dialog-title";
|
|
19292
19308
|
const body = state.kind === "prompt" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PromptBody, {
|
|
19293
19309
|
options: state.options,
|
|
19294
19310
|
value,
|
|
@@ -19361,7 +19377,7 @@ function DialogSurface({ state, onClose }) {
|
|
|
19361
19377
|
function PromptBody({ options, value, error, inputRef, onChange }) {
|
|
19362
19378
|
const readOnly = options.readOnly === true;
|
|
19363
19379
|
const isPassword = !readOnly && options.inputType === "password";
|
|
19364
|
-
const inputId = "
|
|
19380
|
+
const inputId = "dominevo-dialog-input";
|
|
19365
19381
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
19366
19382
|
options.message !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
19367
19383
|
className: "mt-2 max-h-48 overflow-y-auto text-xs text-foreground-subtle leading-relaxed whitespace-pre-line",
|
|
@@ -19415,7 +19431,7 @@ function PromptBody({ options, value, error, inputRef, onChange }) {
|
|
|
19415
19431
|
* mounted in subtrees that don't carry the snapshot — they fall back
|
|
19416
19432
|
* to their own query in that case.
|
|
19417
19433
|
*/
|
|
19418
|
-
var DeviceContext = createSharedContext("
|
|
19434
|
+
var DeviceContext = createSharedContext("dominevo:device-context", null);
|
|
19419
19435
|
function DeviceContextProvider({ deviceId, device, children }) {
|
|
19420
19436
|
const value = {
|
|
19421
19437
|
deviceId,
|
|
@@ -23217,7 +23233,7 @@ setGlobalFederationConstructor(ModuleFederation);
|
|
|
23217
23233
|
* - npm packages (react, react-dom, @tanstack/react-query, @trpc/*)
|
|
23218
23234
|
* are read off the bundler's import graph via namespace imports.
|
|
23219
23235
|
* - workspace packages (`@dominevo/{ui-library,sdk,types}`) come off
|
|
23220
|
-
* `window.
|
|
23236
|
+
* `window.__dominevo{UiLibrary,Sdk,Types}` globals set by
|
|
23221
23237
|
* `addon-admin-ui/src/main.tsx` to avoid double-bundling them here.
|
|
23222
23238
|
*
|
|
23223
23239
|
* The runtime `init({ shared: ... })` call is still required so that
|
|
@@ -23269,9 +23285,9 @@ function populateShareCache() {
|
|
|
23269
23285
|
cache.share["@tanstack/react-query"] ??= _tanstack_react_query;
|
|
23270
23286
|
cache.share["@trpc/client"] ??= _trpc_client;
|
|
23271
23287
|
cache.share["@trpc/react-query"] ??= _trpc_react_query;
|
|
23272
|
-
cache.share["@dominevo/ui-library"] ??= readHostGlobal("
|
|
23273
|
-
cache.share["@dominevo/sdk"] ??= readHostGlobal("
|
|
23274
|
-
cache.share["@dominevo/types"] ??= readHostGlobal("
|
|
23288
|
+
cache.share["@dominevo/ui-library"] ??= readHostGlobal("__dominevoUiLibrary");
|
|
23289
|
+
cache.share["@dominevo/sdk"] ??= readHostGlobal("__dominevoSdk");
|
|
23290
|
+
cache.share["@dominevo/types"] ??= readHostGlobal("__dominevoTypes");
|
|
23275
23291
|
}
|
|
23276
23292
|
var lazyNpmShared = (importFn) => ({
|
|
23277
23293
|
version: "0.0.0",
|
|
@@ -23305,9 +23321,9 @@ function ensureMfHostInit() {
|
|
|
23305
23321
|
"@trpc/react-query": npmShared(() => _trpc_react_query),
|
|
23306
23322
|
"react-konva": lazyNpmShared(() => import("react-konva")),
|
|
23307
23323
|
konva: lazyNpmShared(() => import("konva")),
|
|
23308
|
-
"@dominevo/ui-library": npmShared(() => readHostGlobal("
|
|
23309
|
-
"@dominevo/sdk": npmShared(() => readHostGlobal("
|
|
23310
|
-
"@dominevo/types": npmShared(() => readHostGlobal("
|
|
23324
|
+
"@dominevo/ui-library": npmShared(() => readHostGlobal("__dominevoUiLibrary")),
|
|
23325
|
+
"@dominevo/sdk": npmShared(() => readHostGlobal("__dominevoSdk")),
|
|
23326
|
+
"@dominevo/types": npmShared(() => readHostGlobal("__dominevoTypes"))
|
|
23311
23327
|
}
|
|
23312
23328
|
});
|
|
23313
23329
|
}
|
|
@@ -23317,13 +23333,13 @@ function ensureMfHostInit() {
|
|
|
23317
23333
|
* Where the hub is, from inside a page the hub served.
|
|
23318
23334
|
*
|
|
23319
23335
|
* The admin UI is not always at the hub's root. The Home Assistant component
|
|
23320
|
-
* frames it through a same-origin relay — `https://<ha>/api/
|
|
23336
|
+
* frames it through a same-origin relay — `https://<ha>/api/dominevo/p/<grant>/…`
|
|
23321
23337
|
* → `https://<hub>:4443/…` — so the browser never has to trust the hub's
|
|
23322
23338
|
* local certificate. The relay sends `X-Forwarded-Prefix` and the hub
|
|
23323
23339
|
* injects two things into the shell it serves for that request:
|
|
23324
23340
|
*
|
|
23325
23341
|
* <base href="<prefix>/">
|
|
23326
|
-
* <meta name="
|
|
23342
|
+
* <meta name="dominevo-mount" content="<prefix>/">
|
|
23327
23343
|
*
|
|
23328
23344
|
* This module is the ONE reader of that fact. Every URL the page composes
|
|
23329
23345
|
* toward the hub — tRPC HTTP and WS, `/api/webrtc`, `/addon/…` data planes,
|
|
@@ -23347,7 +23363,7 @@ function ensureMfHostInit() {
|
|
|
23347
23363
|
* `scripts/check-hub-paths-through-mount.ts` keeps every other module from
|
|
23348
23364
|
* spelling a hub path directly.
|
|
23349
23365
|
*/
|
|
23350
|
-
var MOUNT_META_NAME = "
|
|
23366
|
+
var MOUNT_META_NAME = "dominevo-mount";
|
|
23351
23367
|
/** A clean absolute path: no scheme, no `//`, no `..`, no query. */
|
|
23352
23368
|
var MOUNT_PATH_RE = /^\/(?:[A-Za-z0-9_\-.]+\/)*$/;
|
|
23353
23369
|
var resolvedMount = null;
|
|
@@ -23441,7 +23457,7 @@ function resetHubMountForTests() {
|
|
|
23441
23457
|
* Why MF instead of raw ESM:
|
|
23442
23458
|
* - automatic dedup of shared deps (react/react-dom/@tanstack/etc.)
|
|
23443
23459
|
* against the host's instances — no more hand-rolled vendor stubs +
|
|
23444
|
-
* importmap shims pointing at `window.
|
|
23460
|
+
* importmap shims pointing at `window.__dominevo*` globals.
|
|
23445
23461
|
* - version negotiation (we pin `singleton: true` everywhere; the host
|
|
23446
23462
|
* wins by default).
|
|
23447
23463
|
* - cross-bundle context invariant preserved automatically: every
|
|
@@ -23455,7 +23471,7 @@ function resetHubMountForTests() {
|
|
|
23455
23471
|
* Cache resilience — same `staleTime: 0` + `refetchOnMount` + boot-
|
|
23456
23472
|
* window poll fallback as `AppLayout`'s addon-pages query.
|
|
23457
23473
|
*/
|
|
23458
|
-
var WidgetRegistryContext = createSharedContext("
|
|
23474
|
+
var WidgetRegistryContext = createSharedContext("dominevo:widget-registry", null);
|
|
23459
23475
|
/**
|
|
23460
23476
|
* Process-global cache for resolved remote bundles, keyed by
|
|
23461
23477
|
* `<remoteName>::<exposedModule>`. Each cached value is the exposed
|
|
@@ -24541,7 +24557,7 @@ function useDevice(deviceId) {
|
|
|
24541
24557
|
*
|
|
24542
24558
|
* Returns the same URL the viewer uses: `/addon/snapshot/media/<id>.jpg?w=<n>`,
|
|
24543
24559
|
* served by the wrapper over the HTTP data plane. Relative and same-origin, so
|
|
24544
|
-
* the admin UI's `
|
|
24560
|
+
* the admin UI's `dominevo_session` cookie authenticates it — the endpoint is
|
|
24545
24561
|
* `access: 'authenticated'`, which accepts either a Bearer header or that
|
|
24546
24562
|
* cookie, and a bare `<img>` can only send the cookie. This is the same
|
|
24547
24563
|
* mechanism the native `<video>` fallback in `hls-video.tsx` already relies on.
|
|
@@ -25890,7 +25906,7 @@ function EmptyState({ icon: Icon, title, description, action, className }) {
|
|
|
25890
25906
|
* The chart family's colours — theme tokens only.
|
|
25891
25907
|
*
|
|
25892
25908
|
* Categorical identity comes from the eight `--color-chart-series-*` tokens in
|
|
25893
|
-
* `tailwind/
|
|
25909
|
+
* `tailwind/dominevo-theme.css`, in FIXED order (a blue, b magenta, c yellow,
|
|
25894
25910
|
* d aqua, e orange, f violet, g green, h red). A series keeps its slot for as
|
|
25895
25911
|
* long as it is on screen: the caller assigns the index, never the rank, so a
|
|
25896
25912
|
* filter that hides one series does not repaint the others.
|
|
@@ -25982,7 +25998,7 @@ function withAlpha(color, alpha) {
|
|
|
25982
25998
|
}
|
|
25983
25999
|
//#endregion
|
|
25984
26000
|
//#region src/composites/charts/chart-frame.tsx
|
|
25985
|
-
function ChartFrame({ title, actions, readoutTime, legend, summary, footer, placeholder, controls, className, children }) {
|
|
26001
|
+
function ChartFrame({ title, hideTitle = false, actions, readoutTime, legend, summary, footer, placeholder, controls, className, children }) {
|
|
25986
26002
|
const single = legend.length === 1 ? legend[0] : void 0;
|
|
25987
26003
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("figure", {
|
|
25988
26004
|
className: cn("min-w-0 m-0", className),
|
|
@@ -25991,7 +26007,7 @@ function ChartFrame({ title, actions, readoutTime, legend, summary, footer, plac
|
|
|
25991
26007
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25992
26008
|
className: "flex items-baseline justify-between gap-2 mb-1 min-w-0",
|
|
25993
26009
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("figcaption", {
|
|
25994
|
-
className: cn("text-[10px] tracking-wider text-foreground-subtle truncate min-w-0", (0, _dominevo_types.unitDimension)(title) === void 0 ? "uppercase" : "normal-case"),
|
|
26010
|
+
className: cn("text-[10px] tracking-wider text-foreground-subtle truncate min-w-0", hideTitle && "sr-only", (0, _dominevo_types.unitDimension)(title) === void 0 ? "uppercase" : "normal-case"),
|
|
25995
26011
|
children: title
|
|
25996
26012
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25997
26013
|
className: "flex items-center gap-2 shrink-0",
|
|
@@ -28002,7 +28018,7 @@ function zoomLabel(spanMs) {
|
|
|
28002
28018
|
* ## What it does NOT take from the recording timeline
|
|
28003
28019
|
*
|
|
28004
28020
|
* `CoverageTrack` stays behind. There it is the seek surface — a click drives
|
|
28005
|
-
* the hero player through the `
|
|
28021
|
+
* the hero player through the `dominevo-control` channel or an HLS VOD
|
|
28006
28022
|
* request. A copy here would either be a dead bar or a SECOND thing claiming
|
|
28007
28023
|
* to move the playhead, and two components holding two ideas of the same
|
|
28008
28024
|
* position is the defect this repo keeps paying for. The clips section plays a
|
|
@@ -28092,7 +28108,7 @@ function ClipBandBar({ day, onDayChange, view, dayBounds, onViewChange, buckets,
|
|
|
28092
28108
|
* outside a provider get the inert default (no-op), so a StreamPanel mounted
|
|
28093
28109
|
* on a page without the Recording widget stays live-only without crashing.
|
|
28094
28110
|
*/
|
|
28095
|
-
var VodPlaybackContext = createSharedContext("
|
|
28111
|
+
var VodPlaybackContext = createSharedContext("dominevo:vod-playback", {
|
|
28096
28112
|
request: null,
|
|
28097
28113
|
play: () => {},
|
|
28098
28114
|
clear: () => {}
|
|
@@ -28340,9 +28356,9 @@ function describeRefusal(headers, t = defaultUiText) {
|
|
|
28340
28356
|
*
|
|
28341
28357
|
* ## Three headers, one of which decides everything (D563)
|
|
28342
28358
|
*
|
|
28343
|
-
* `x-
|
|
28344
|
-
* `x-
|
|
28345
|
-
* `x-
|
|
28359
|
+
* `x-dominevo-reason-code` is the token the tile keys its words on,
|
|
28360
|
+
* `x-dominevo-reason` is the camera's own prose, and
|
|
28361
|
+
* `x-dominevo-disposition` says whether to come back. This module reads them;
|
|
28346
28362
|
* it does not classify them. A response with no disposition — every
|
|
28347
28363
|
* provider-reolink build before D563 — is FINAL, which is precisely the
|
|
28348
28364
|
* behaviour that shipped.
|
|
@@ -28420,7 +28436,7 @@ function planStillRetry(input) {
|
|
|
28420
28436
|
*
|
|
28421
28437
|
* The picture is resolved by `resolveTileMedia` — vouched JPEG, an offer, or
|
|
28422
28438
|
* the reason there is none (D549 decision 5). An offer is fetched rather than
|
|
28423
|
-
* dropped into an `<img src>`, because the route's **204 + x-
|
|
28439
|
+
* dropped into an `<img src>`, because the route's **204 + x-dominevo-reason**
|
|
28424
28440
|
* is invisible to an `<img>`: it fires `onerror` with nothing to say. The
|
|
28425
28441
|
* refusal is LATCHED for the life of the tile and never retried behind the
|
|
28426
28442
|
* operator's back.
|
|
@@ -28925,7 +28941,7 @@ function resolveClipsView(input, t = defaultUiText) {
|
|
|
28925
28941
|
* configuration that lives somewhere else. The operator put it exactly:
|
|
28926
28942
|
* *"non è affatto necessario lo stato di abilitato o meno delle sources. Loro
|
|
28927
28943
|
* vivono lì, ad esempio hksv c'è se la camera è esportata su homekit, reolink
|
|
28928
|
-
* la dà di suo così come il
|
|
28944
|
+
* la dà di suo così come il dominevo."* [the enabled-or-not state of the sources is not necessary at all. They live there, for example hksv is there if the camera is exported to homekit, reolink provides it on its own, as does dominevo.] HKSV is there if the camera is
|
|
28929
28945
|
* exported to HomeKit; the Reolink source is there because Reolink is that
|
|
28930
28946
|
* camera's provider; Dominevo's is always there. None of that is a decision to
|
|
28931
28947
|
* make in a clips list, so this surface offers no switch and writes no
|
|
@@ -32919,7 +32935,7 @@ function parseRecordedServerMessage(raw) {
|
|
|
32919
32935
|
//#region src/contexts/recorded-playback.tsx
|
|
32920
32936
|
/**
|
|
32921
32937
|
* RecordedPlayback — shared context wiring the hero player's
|
|
32922
|
-
* `
|
|
32938
|
+
* `dominevo-control` RTCDataChannel to the Recording timeline (R9).
|
|
32923
32939
|
*
|
|
32924
32940
|
* The hero `StreamPanel` (host side) BINDS the channel that
|
|
32925
32941
|
* `CameraStreamPlayer` opens on the live WebRTC session; the Recording
|
|
@@ -32930,7 +32946,7 @@ function parseRecordedServerMessage(raw) {
|
|
|
32930
32946
|
* server's playback state + ~1 Hz position reports.
|
|
32931
32947
|
*
|
|
32932
32948
|
* This is the admin-ui port of the shipped viewer's default recorded path
|
|
32933
|
-
* (srcV2 → embed → `
|
|
32949
|
+
* (srcV2 → embed → `dominevo-control`), replacing "manifest-window HLS only".
|
|
32934
32950
|
* The HLS VOD path (VodPlayback context) remains available as a fallback.
|
|
32935
32951
|
*
|
|
32936
32952
|
* Built on `createSharedContext` (NOT a plain `createContext`) so it crosses
|
|
@@ -32939,7 +32955,7 @@ function parseRecordedServerMessage(raw) {
|
|
|
32939
32955
|
* is null (StreamPanel then opens NO datachannel — plain live player) and
|
|
32940
32956
|
* `channelOpen` is false (RecordingTimeline stays on the HLS path).
|
|
32941
32957
|
*/
|
|
32942
|
-
var RecordedPlaybackContext = createSharedContext("
|
|
32958
|
+
var RecordedPlaybackContext = createSharedContext("dominevo:recorded-playback", {
|
|
32943
32959
|
bindControlChannel: null,
|
|
32944
32960
|
channelOpen: false,
|
|
32945
32961
|
mode: "live",
|
|
@@ -33017,7 +33033,7 @@ function useRecordedPlayback() {
|
|
|
33017
33033
|
* Ported from the proven srcV2 viewer implementation
|
|
33018
33034
|
* (camstack/srcV2/recording/scrub-controller.ts): the same throttle,
|
|
33019
33035
|
* commit-dedupe, and live→recorded-bypass semantics, now driving the
|
|
33020
|
-
* admin-ui `RecordingTimeline` through the `
|
|
33036
|
+
* admin-ui `RecordingTimeline` through the `dominevo-control` datachannel.
|
|
33021
33037
|
*
|
|
33022
33038
|
* Two layers:
|
|
33023
33039
|
* 1. Pure reducer + helpers (unit-tested, no React deps):
|
|
@@ -34111,7 +34127,7 @@ function RecordingTimeline({ deviceId, seekTo, onExportRange, onViewChange, dens
|
|
|
34111
34127
|
const bucketMs = bucketMsForSpan(view.toMs - view.fromMs);
|
|
34112
34128
|
const availabilityQuery = useRecordingGetAvailability({
|
|
34113
34129
|
deviceId,
|
|
34114
|
-
provider: _dominevo_types.
|
|
34130
|
+
provider: _dominevo_types.RECORDING_SOURCE_DOMINEVO_ADDON,
|
|
34115
34131
|
fromMs: view.fromMs,
|
|
34116
34132
|
toMs: view.toMs
|
|
34117
34133
|
});
|
|
@@ -34130,7 +34146,7 @@ function RecordingTimeline({ deviceId, seekTo, onExportRange, onViewChange, dens
|
|
|
34130
34146
|
const [nowForCalendar] = (0, react$1.useState)(() => Date.now());
|
|
34131
34147
|
const daysQuery = useRecordingGetDaysWithRecordings({
|
|
34132
34148
|
deviceId,
|
|
34133
|
-
provider: _dominevo_types.
|
|
34149
|
+
provider: _dominevo_types.RECORDING_SOURCE_DOMINEVO_ADDON,
|
|
34134
34150
|
fromMs: nowForCalendar - LATEST_LOOKBACK_MS,
|
|
34135
34151
|
toMs: nowForCalendar,
|
|
34136
34152
|
tzOffsetMinutes: -new Date(nowForCalendar).getTimezoneOffset()
|
|
@@ -34140,7 +34156,7 @@ function RecordingTimeline({ deviceId, seekTo, onExportRange, onViewChange, dens
|
|
|
34140
34156
|
const latestDayWindow = (0, react$1.useMemo)(() => latestDayMs === null ? null : dayWindow(new Date(latestDayMs), latestDayMs + DAY_MS$4), [latestDayMs]);
|
|
34141
34157
|
const latestAvailability = useRecordingGetAvailability({
|
|
34142
34158
|
deviceId,
|
|
34143
|
-
provider: _dominevo_types.
|
|
34159
|
+
provider: _dominevo_types.RECORDING_SOURCE_DOMINEVO_ADDON,
|
|
34144
34160
|
fromMs: latestDayWindow?.fromMs ?? 0,
|
|
34145
34161
|
toMs: latestDayWindow?.toMs ?? 0
|
|
34146
34162
|
}, { enabled: latestDayWindow !== null });
|
|
@@ -34228,7 +34244,7 @@ function RecordingTimeline({ deviceId, seekTo, onExportRange, onViewChange, dens
|
|
|
34228
34244
|
try {
|
|
34229
34245
|
const playback = await system.trpcClient.recording.getPlayback.query({
|
|
34230
34246
|
deviceId,
|
|
34231
|
-
provider: _dominevo_types.
|
|
34247
|
+
provider: _dominevo_types.RECORDING_SOURCE_DOMINEVO_ADDON,
|
|
34232
34248
|
fromMs,
|
|
34233
34249
|
toMs
|
|
34234
34250
|
});
|
|
@@ -34533,7 +34549,7 @@ function RecordingPanel({ deviceId }) {
|
|
|
34533
34549
|
const toMs = (0, react$1.useMemo)(() => Date.now(), []);
|
|
34534
34550
|
const availabilityQuery = useRecordingGetAvailability({
|
|
34535
34551
|
deviceId,
|
|
34536
|
-
provider: _dominevo_types.
|
|
34552
|
+
provider: _dominevo_types.RECORDING_SOURCE_DOMINEVO_ADDON,
|
|
34537
34553
|
fromMs: toMs - DAY_MS$3,
|
|
34538
34554
|
toMs
|
|
34539
34555
|
});
|
|
@@ -35996,7 +36012,7 @@ function TimezoneSelector({ value, onChange, disabled }) {
|
|
|
35996
36012
|
* host supplies the picker here. Without one, `instance-select` still lists the existing instances
|
|
35997
36013
|
* and lets the operator choose; it just cannot create.
|
|
35998
36014
|
*/
|
|
35999
|
-
var InstancePickerSlotContext = createSharedContext("
|
|
36015
|
+
var InstancePickerSlotContext = createSharedContext("dominevo:instance-picker-slot", null);
|
|
36000
36016
|
function InstancePickerSlotProvider({ picker, children }) {
|
|
36001
36017
|
return (0, react$1.createElement)(InstancePickerSlotContext.Provider, { value: picker }, children);
|
|
36002
36018
|
}
|
|
@@ -38928,13 +38944,13 @@ function GroupedModelSelector({ catalog, value, onChange, disabled }) {
|
|
|
38928
38944
|
//#endregion
|
|
38929
38945
|
//#region src/composites/model-picker.tsx
|
|
38930
38946
|
var PROVIDER_LABEL = {
|
|
38931
|
-
|
|
38947
|
+
dominevo: "Dominevo",
|
|
38932
38948
|
frigate: "plus catalog",
|
|
38933
38949
|
scrypted: "plugin catalog",
|
|
38934
38950
|
custom: "Custom"
|
|
38935
38951
|
};
|
|
38936
38952
|
function providerOf(model) {
|
|
38937
|
-
return model.provider ?? "
|
|
38953
|
+
return model.provider ?? "dominevo";
|
|
38938
38954
|
}
|
|
38939
38955
|
/**
|
|
38940
38956
|
* Shared model picker — the ONE model-selection control across the app.
|
|
@@ -38962,7 +38978,7 @@ function ModelPicker({ models, value, onChange, disabled, defaultModelId }) {
|
|
|
38962
38978
|
const defaultProvider = (0, react$1.useMemo)(() => {
|
|
38963
38979
|
const pinned = models.find((m) => m.id === value);
|
|
38964
38980
|
return pinned ? providerOf(pinned) : void 0;
|
|
38965
|
-
}, [models, value]) ?? (presentProviders.includes("
|
|
38981
|
+
}, [models, value]) ?? (presentProviders.includes("dominevo") ? "dominevo" : presentProviders[0] ?? "dominevo");
|
|
38966
38982
|
const [provider, setProvider] = (0, react$1.useState)(defaultProvider);
|
|
38967
38983
|
(0, react$1.useEffect)(() => {
|
|
38968
38984
|
setProvider(defaultProvider);
|
|
@@ -40762,7 +40778,7 @@ var SWIPE_OPEN_FRACTION = .35;
|
|
|
40762
40778
|
var SWIPE_HINT_DELAY_MS = 600;
|
|
40763
40779
|
var SWIPE_HINT_HOLD_MS = 700;
|
|
40764
40780
|
/** Set once the hint has played in this browser. */
|
|
40765
|
-
var SWIPE_HINT_STORAGE_KEY = "
|
|
40781
|
+
var SWIPE_HINT_STORAGE_KEY = "dominevo.swipe-actions.hint-seen";
|
|
40766
40782
|
/** Storage can be blocked or absent; then the hint simply does not play. */
|
|
40767
40783
|
function claimSwipeHint() {
|
|
40768
40784
|
try {
|
|
@@ -42113,7 +42129,7 @@ function shouldUpgradeAfterProbe(mbps) {
|
|
|
42113
42129
|
/**
|
|
42114
42130
|
* An http(s) base — origin plus any path prefix, no trailing slash — or null
|
|
42115
42131
|
* for anything that cannot serve the probe. The prefix is kept because a hub
|
|
42116
|
-
* reached through a path-mounted relay (`https://<ha>/api/
|
|
42132
|
+
* reached through a path-mounted relay (`https://<ha>/api/dominevo/p/<g>`)
|
|
42117
42133
|
* serves `/adaptive-probe` UNDER that prefix; the bare origin is the relay.
|
|
42118
42134
|
*/
|
|
42119
42135
|
function httpOrigin(value) {
|
|
@@ -42134,7 +42150,7 @@ function httpOrigin(value) {
|
|
|
42134
42150
|
* `adaptive-probe.routes.ts`) and it is only true for the web viewer and the
|
|
42135
42151
|
* iframe embed, both served by the hub. The NATIVE viewer loads this same
|
|
42136
42152
|
* player from an asset bundled with the app (`useNativeEmbedSource` resolves
|
|
42137
|
-
* `assets/embed/
|
|
42153
|
+
* `assets/embed/dominevo-embed.html` through `Image.resolveAssetSource`), so
|
|
42138
42154
|
* inside the WKWebView `window.location.origin` is `file://` — and
|
|
42139
42155
|
* `file:///adaptive-probe` is not a request any hub can answer. The probe
|
|
42140
42156
|
* therefore returned null on EVERY native connect, `downlinkMbps` was never
|
|
@@ -43740,7 +43756,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
43740
43756
|
pc.addTransceiver("video", { direction: "recvonly" });
|
|
43741
43757
|
pc.addTransceiver("audio", { direction: "recvonly" });
|
|
43742
43758
|
if (onControlChannelRef.current) {
|
|
43743
|
-
const control = pc.createDataChannel("
|
|
43759
|
+
const control = pc.createDataChannel("dominevo-control");
|
|
43744
43760
|
control.addEventListener("message", (ev) => {
|
|
43745
43761
|
if (isLandMessage(ev.data)) markLandRef.current();
|
|
43746
43762
|
});
|
|
@@ -43922,7 +43938,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
43922
43938
|
pc.addTransceiver("video", { direction: "recvonly" });
|
|
43923
43939
|
pc.addTransceiver("audio", { direction: "recvonly" });
|
|
43924
43940
|
if (onControlChannelRef.current) {
|
|
43925
|
-
const control = pc.createDataChannel("
|
|
43941
|
+
const control = pc.createDataChannel("dominevo-control");
|
|
43926
43942
|
control.addEventListener("message", (ev) => {
|
|
43927
43943
|
if (isLandMessage(ev.data)) markLandRef.current();
|
|
43928
43944
|
});
|
|
@@ -46295,7 +46311,7 @@ function EndpointTestCard({ loadServers }) {
|
|
|
46295
46311
|
var DEFAULT_FRESH_TTL_MS = 5 * 6e4;
|
|
46296
46312
|
/** Half of the shortest provider credential lifetime in the fleet (24 h). */
|
|
46297
46313
|
var DEFAULT_STALE_CAP_MS = 720 * 6e4;
|
|
46298
|
-
var DEFAULT_STORAGE_KEY = "
|
|
46314
|
+
var DEFAULT_STORAGE_KEY = "dominevo:turn-servers:v1";
|
|
46299
46315
|
function defaultStorage() {
|
|
46300
46316
|
const g = globalThis;
|
|
46301
46317
|
try {
|
|
@@ -48808,7 +48824,7 @@ function useDataTableFilter(rows, config, initialState = EMPTY_DATA_TABLE_FILTER
|
|
|
48808
48824
|
* A mounted {@link DisplayPaletteProvider} paints the cluster's effective
|
|
48809
48825
|
* palette instead. There is no second hex table here.
|
|
48810
48826
|
*/
|
|
48811
|
-
var BUNDLED$1 = (0, _dominevo_types.
|
|
48827
|
+
var BUNDLED$1 = (0, _dominevo_types.bundledDominevo)();
|
|
48812
48828
|
/** Marks that are palette entries and not detection classes. */
|
|
48813
48829
|
var MARK_IDS = new Set([
|
|
48814
48830
|
"live",
|
|
@@ -48848,7 +48864,7 @@ function getClassColor(className, customColors, palette) {
|
|
|
48848
48864
|
* Dominevo preset. Only `ready` replaces it. Callers that must say the
|
|
48849
48865
|
* store was unreadable read {@link useDisplayPaletteView}.
|
|
48850
48866
|
*/
|
|
48851
|
-
var BUNDLED = (0, _dominevo_types.
|
|
48867
|
+
var BUNDLED = (0, _dominevo_types.bundledDominevo)();
|
|
48852
48868
|
var DisplayPaletteContext = (0, react$1.createContext)({ status: "absent" });
|
|
48853
48869
|
function DisplayPaletteProvider({ value, children }) {
|
|
48854
48870
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DisplayPaletteContext.Provider, {
|
|
@@ -50400,7 +50416,7 @@ function LoginForm({ onLogin, serverUrl, logoSrc, error: externalError, classNam
|
|
|
50400
50416
|
}
|
|
50401
50417
|
//#endregion
|
|
50402
50418
|
//#region src/composites/dev-shell.tsx
|
|
50403
|
-
var STORAGE_KEY$1 = "
|
|
50419
|
+
var STORAGE_KEY$1 = "dominevo_dev_token";
|
|
50404
50420
|
var DevShellContext = (0, react$1.createContext)(null);
|
|
50405
50421
|
function useDevShell() {
|
|
50406
50422
|
const ctx = (0, react$1.useContext)(DevShellContext);
|
|
@@ -50917,7 +50933,7 @@ function visibleLogColumns(input) {
|
|
|
50917
50933
|
}
|
|
50918
50934
|
//#endregion
|
|
50919
50935
|
//#region src/hooks/use-log-stream-columns.ts
|
|
50920
|
-
var STORAGE_KEY = "
|
|
50936
|
+
var STORAGE_KEY = "dominevo.logStream.columns";
|
|
50921
50937
|
function readStored$1() {
|
|
50922
50938
|
try {
|
|
50923
50939
|
return parseStoredLogColumns(localStorage.getItem(STORAGE_KEY));
|
|
@@ -50995,7 +51011,7 @@ function logExportQuery(selection, now) {
|
|
|
50995
51011
|
return query.length > 0 ? `?${query}` : "";
|
|
50996
51012
|
}
|
|
50997
51013
|
function logExportFileName(now, zip = false) {
|
|
50998
|
-
return `
|
|
51014
|
+
return `dominevo-logs-${new Date(now).toISOString().replace(/[:.]/g, "-")}.${zip ? "zip" : "ndjson"}`;
|
|
50999
51015
|
}
|
|
51000
51016
|
/** The stream's lock becomes the export's filters; an open level exports everything. */
|
|
51001
51017
|
function logExportScopeOf(input) {
|
|
@@ -51053,7 +51069,7 @@ function initialExportSource(wanted, sources) {
|
|
|
51053
51069
|
* the dialog says so.
|
|
51054
51070
|
*/
|
|
51055
51071
|
/** The host's session token, as every admin-side data-plane fetch reads it. */
|
|
51056
|
-
var ADMIN_TOKEN_STORAGE_KEY = "
|
|
51072
|
+
var ADMIN_TOKEN_STORAGE_KEY = "dominevo_admin_token";
|
|
51057
51073
|
async function defaultFetchBlob(url) {
|
|
51058
51074
|
let token = null;
|
|
51059
51075
|
try {
|
|
@@ -58795,7 +58811,7 @@ function useDeviceProviderLabelsWith(trpcClient, enabled) {
|
|
|
58795
58811
|
* area pill updates `?section=` while the Notifications header still shows
|
|
58796
58812
|
* "New rule" from a stale snapshot.
|
|
58797
58813
|
*/
|
|
58798
|
-
var URL_QUERY_EVENT = "
|
|
58814
|
+
var URL_QUERY_EVENT = "dominevo:url-query";
|
|
58799
58815
|
function readParam(key) {
|
|
58800
58816
|
return new URLSearchParams(window.location.search).get(key);
|
|
58801
58817
|
}
|
|
@@ -58811,7 +58827,7 @@ function writeParam(key, value) {
|
|
|
58811
58827
|
window.history.replaceState(null, "", url);
|
|
58812
58828
|
}
|
|
58813
58829
|
/** Router-made entries keep their `state` option under `usr`. */
|
|
58814
|
-
var FORM_OPEN_ROUTER_STATE = {
|
|
58830
|
+
var FORM_OPEN_ROUTER_STATE = { dominevoFormOpen: true };
|
|
58815
58831
|
function isRecord$4(value) {
|
|
58816
58832
|
return typeof value === "object" && value !== null;
|
|
58817
58833
|
}
|
|
@@ -58819,9 +58835,9 @@ function isRecord$4(value) {
|
|
|
58819
58835
|
function isFormOpenEntry() {
|
|
58820
58836
|
const state = window.history.state;
|
|
58821
58837
|
if (!isRecord$4(state)) return false;
|
|
58822
|
-
if (state["
|
|
58838
|
+
if (state["dominevoFormOpen"] === true) return true;
|
|
58823
58839
|
const usr = state["usr"];
|
|
58824
|
-
return isRecord$4(usr) && usr["
|
|
58840
|
+
return isRecord$4(usr) && usr["dominevoFormOpen"] === true;
|
|
58825
58841
|
}
|
|
58826
58842
|
/**
|
|
58827
58843
|
* Several params in ONE history write. `push` adds an entry (marked as an
|
|
@@ -58923,7 +58939,7 @@ function stateStyle(row, state) {
|
|
|
58923
58939
|
if (row.kind === "boolean") return state === row.states[1] ? { token: chartSeriesStyle(base).token } : { token: "border" };
|
|
58924
58940
|
return { token: chartSeriesStyle(base + Math.max(0, row.states.indexOf(state))).token };
|
|
58925
58941
|
}
|
|
58926
|
-
function StateTimeline({ title, rows, range, syncKey, reserveRightAxis, pending = false, emptyMessage, actions, className }) {
|
|
58942
|
+
function StateTimeline({ title, hideTitle = false, rows, range, syncKey, reserveRightAxis, pending = false, emptyMessage, actions, className }) {
|
|
58927
58943
|
const t = useUiText();
|
|
58928
58944
|
const [cursorT, setCursorT] = (0, react$1.useState)(null);
|
|
58929
58945
|
const rowsRef = (0, react$1.useRef)(rows);
|
|
@@ -59019,7 +59035,7 @@ function StateTimeline({ title, rows, range, syncKey, reserveRightAxis, pending
|
|
|
59019
59035
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
59020
59036
|
className: "flex items-baseline justify-between gap-2 mb-1 min-w-0",
|
|
59021
59037
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("figcaption", {
|
|
59022
|
-
className: "text-[10px] uppercase tracking-wider text-foreground-subtle truncate min-w-0",
|
|
59038
|
+
className: cn("text-[10px] uppercase tracking-wider text-foreground-subtle truncate min-w-0", hideTitle && "sr-only"),
|
|
59023
59039
|
children: title
|
|
59024
59040
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
59025
59041
|
className: "flex items-center gap-2 shrink-0",
|
|
@@ -59197,7 +59213,7 @@ function seriesTooltip(input) {
|
|
|
59197
59213
|
onDataX: input.onDataX
|
|
59198
59214
|
};
|
|
59199
59215
|
}
|
|
59200
|
-
function TimeSeriesChart({ title, series, bands = NO_BANDS, range, height = DEFAULT_HEIGHT, stacked = false, area = false, syncKey, reserveRightAxis, formatValue, displayPreference, axisFor, emptyMessage, pending = false, actions, footer, windowToggle, className }) {
|
|
59216
|
+
function TimeSeriesChart({ title, hideTitle = false, series, bands = NO_BANDS, range, height = DEFAULT_HEIGHT, stacked = false, area = false, syncKey, reserveRightAxis, formatValue, displayPreference, axisFor, emptyMessage, pending = false, actions, footer, windowToggle, className }) {
|
|
59201
59217
|
const t = useUiText();
|
|
59202
59218
|
const model = (0, react$1.useMemo)(() => buildTimeSeriesModel(series, stacked), [series, stacked]);
|
|
59203
59219
|
const [cursorIdx, setCursorIdx] = (0, react$1.useState)(null);
|
|
@@ -59404,6 +59420,7 @@ function TimeSeriesChart({ title, series, bands = NO_BANDS, range, height = DEFA
|
|
|
59404
59420
|
const sizeClass = height <= 64 ? "sm" : height <= 120 ? "md" : "lg";
|
|
59405
59421
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChartFrame, {
|
|
59406
59422
|
title,
|
|
59423
|
+
hideTitle,
|
|
59407
59424
|
actions: toolbar,
|
|
59408
59425
|
readoutTime,
|
|
59409
59426
|
legend,
|
|
@@ -68367,468 +68384,242 @@ function quantityLabel(t, quantity) {
|
|
|
68367
68384
|
case "aqi": return t("uiLibrary.sensorPie.quantity.aqi", "Air quality");
|
|
68368
68385
|
}
|
|
68369
68386
|
}
|
|
68370
|
-
|
|
68371
|
-
|
|
68372
|
-
|
|
68373
|
-
|
|
68374
|
-
|
|
68375
|
-
|
|
68376
|
-
|
|
68377
|
-
|
|
68378
|
-
|
|
68379
|
-
|
|
68380
|
-
|
|
68381
|
-
|
|
68382
|
-
|
|
68383
|
-
|
|
68384
|
-
|
|
68385
|
-
|
|
68386
|
-
|
|
68387
|
-
|
|
68388
|
-
|
|
68387
|
+
//#endregion
|
|
68388
|
+
//#region src/composites/device-card/scenes/sensor/reading-colour.ts
|
|
68389
|
+
var PREFERRED_SLOT = {
|
|
68390
|
+
humidity: 0,
|
|
68391
|
+
voc: 1,
|
|
68392
|
+
illuminance: 2,
|
|
68393
|
+
co2: 3,
|
|
68394
|
+
temperature: 4,
|
|
68395
|
+
motion: 5,
|
|
68396
|
+
pm25: 6,
|
|
68397
|
+
pm10: 7,
|
|
68398
|
+
aqi: 6,
|
|
68399
|
+
power: 7,
|
|
68400
|
+
contact: 3,
|
|
68401
|
+
text: 5
|
|
68402
|
+
};
|
|
68403
|
+
/** The slot of each reading of a card, in order; all different while the palette lasts. */
|
|
68404
|
+
function assignReadingSlots(quantities) {
|
|
68405
|
+
const size = CHART_SERIES_TOKENS.length;
|
|
68406
|
+
const taken = /* @__PURE__ */ new Set();
|
|
68407
|
+
return quantities.map((quantity) => {
|
|
68408
|
+
let slot = PREFERRED_SLOT[quantity];
|
|
68409
|
+
for (let tried = 0; tried < size && taken.has(slot); tried += 1) slot = (slot + 1) % size;
|
|
68410
|
+
taken.add(slot);
|
|
68411
|
+
if (taken.size >= size) taken.clear();
|
|
68412
|
+
return slot;
|
|
68413
|
+
});
|
|
68414
|
+
}
|
|
68415
|
+
var SLOT_A = {
|
|
68416
|
+
wedge: "fill-chart-series-a/25 stroke-chart-series-a/60",
|
|
68417
|
+
wedgeSelected: "fill-chart-series-a/45 stroke-chart-series-a",
|
|
68418
|
+
tile: "bg-chart-series-a/10 border-chart-series-a/40",
|
|
68419
|
+
tileSelected: "bg-chart-series-a/25 border-chart-series-a"
|
|
68420
|
+
};
|
|
68421
|
+
/** Spelled out so Tailwind finds every class. */
|
|
68422
|
+
var SLOT_CLASSES = [
|
|
68423
|
+
SLOT_A,
|
|
68424
|
+
{
|
|
68425
|
+
wedge: "fill-chart-series-b/25 stroke-chart-series-b/60",
|
|
68426
|
+
wedgeSelected: "fill-chart-series-b/45 stroke-chart-series-b",
|
|
68427
|
+
tile: "bg-chart-series-b/10 border-chart-series-b/40",
|
|
68428
|
+
tileSelected: "bg-chart-series-b/25 border-chart-series-b"
|
|
68429
|
+
},
|
|
68430
|
+
{
|
|
68431
|
+
wedge: "fill-chart-series-c/25 stroke-chart-series-c/60",
|
|
68432
|
+
wedgeSelected: "fill-chart-series-c/45 stroke-chart-series-c",
|
|
68433
|
+
tile: "bg-chart-series-c/10 border-chart-series-c/40",
|
|
68434
|
+
tileSelected: "bg-chart-series-c/25 border-chart-series-c"
|
|
68435
|
+
},
|
|
68436
|
+
{
|
|
68437
|
+
wedge: "fill-chart-series-d/25 stroke-chart-series-d/60",
|
|
68438
|
+
wedgeSelected: "fill-chart-series-d/45 stroke-chart-series-d",
|
|
68439
|
+
tile: "bg-chart-series-d/10 border-chart-series-d/40",
|
|
68440
|
+
tileSelected: "bg-chart-series-d/25 border-chart-series-d"
|
|
68441
|
+
},
|
|
68442
|
+
{
|
|
68443
|
+
wedge: "fill-chart-series-e/25 stroke-chart-series-e/60",
|
|
68444
|
+
wedgeSelected: "fill-chart-series-e/45 stroke-chart-series-e",
|
|
68445
|
+
tile: "bg-chart-series-e/10 border-chart-series-e/40",
|
|
68446
|
+
tileSelected: "bg-chart-series-e/25 border-chart-series-e"
|
|
68447
|
+
},
|
|
68448
|
+
{
|
|
68449
|
+
wedge: "fill-chart-series-f/25 stroke-chart-series-f/60",
|
|
68450
|
+
wedgeSelected: "fill-chart-series-f/45 stroke-chart-series-f",
|
|
68451
|
+
tile: "bg-chart-series-f/10 border-chart-series-f/40",
|
|
68452
|
+
tileSelected: "bg-chart-series-f/25 border-chart-series-f"
|
|
68453
|
+
},
|
|
68454
|
+
{
|
|
68455
|
+
wedge: "fill-chart-series-g/25 stroke-chart-series-g/60",
|
|
68456
|
+
wedgeSelected: "fill-chart-series-g/45 stroke-chart-series-g",
|
|
68457
|
+
tile: "bg-chart-series-g/10 border-chart-series-g/40",
|
|
68458
|
+
tileSelected: "bg-chart-series-g/25 border-chart-series-g"
|
|
68459
|
+
},
|
|
68460
|
+
{
|
|
68461
|
+
wedge: "fill-chart-series-h/25 stroke-chart-series-h/60",
|
|
68462
|
+
wedgeSelected: "fill-chart-series-h/45 stroke-chart-series-h",
|
|
68463
|
+
tile: "bg-chart-series-h/10 border-chart-series-h/40",
|
|
68464
|
+
tileSelected: "bg-chart-series-h/25 border-chart-series-h"
|
|
68465
|
+
}
|
|
68466
|
+
];
|
|
68467
|
+
/** The slot a reading wears: the card-assigned one, else its quantity's preferred one. */
|
|
68468
|
+
function readingSlot(reading) {
|
|
68469
|
+
return (reading.slot ?? PREFERRED_SLOT[reading.quantity]) % SLOT_CLASSES.length;
|
|
68389
68470
|
}
|
|
68390
|
-
|
|
68391
|
-
|
|
68392
|
-
"warning",
|
|
68393
|
-
"danger"
|
|
68394
|
-
]);
|
|
68395
|
-
function readingStateOf(m) {
|
|
68396
|
-
if (!(m.reading !== null || !(0, _dominevo_types.isNotReported)(m.value))) return "empty";
|
|
68397
|
-
return ACTIVE_TONES.has(m.tone) ? "active" : "idle";
|
|
68471
|
+
function readingClasses(reading) {
|
|
68472
|
+
return SLOT_CLASSES[readingSlot(reading)] ?? SLOT_A;
|
|
68398
68473
|
}
|
|
68399
|
-
|
|
68400
|
-
|
|
68401
|
-
|
|
68402
|
-
|
|
68474
|
+
//#endregion
|
|
68475
|
+
//#region src/composites/device-card/connected/ReadingHistory.tsx
|
|
68476
|
+
/** The state series of a reading that is on/off rather than a number (no trend line). */
|
|
68477
|
+
var STATE_READING_HISTORY_KEY = {
|
|
68478
|
+
motion: "cap:motion.detected",
|
|
68479
|
+
contact: "cap:contact.entryOpen"
|
|
68480
|
+
};
|
|
68481
|
+
var CHART_HEIGHT = 120;
|
|
68482
|
+
/** One reading's last day, read through the device history. */
|
|
68483
|
+
function useReadingSeries(deviceId, seriesKey) {
|
|
68484
|
+
const { presence, list } = useDeviceSeriesList(deviceId);
|
|
68485
|
+
const info = list.status === "ok" ? list.data.find((s) => s.key === seriesKey && s.scope === "") : void 0;
|
|
68486
|
+
const to = anchorNow(Date.now(), HISTORY_WINDOW_MS["24h"]);
|
|
68487
|
+
const window = (0, react$1.useMemo)(() => ({
|
|
68488
|
+
from: to - HISTORY_WINDOW_MS["24h"],
|
|
68489
|
+
to
|
|
68490
|
+
}), [to]);
|
|
68491
|
+
const reads = useHistoryReads((0, react$1.useMemo)(() => [{
|
|
68492
|
+
deviceId,
|
|
68493
|
+
key: seriesKey
|
|
68494
|
+
}], [deviceId, seriesKey]), window, false, presence === "present" && info !== void 0);
|
|
68495
|
+
const entry = reads.status === "ok" ? reads.data.current.get(readItemId({
|
|
68496
|
+
deviceId,
|
|
68497
|
+
key: seriesKey
|
|
68498
|
+
})) : void 0;
|
|
68403
68499
|
return {
|
|
68404
|
-
|
|
68405
|
-
|
|
68500
|
+
info,
|
|
68501
|
+
result: entry?.ok === true ? entry.result : void 0,
|
|
68502
|
+
window,
|
|
68503
|
+
phase: presence === "absent" || list.status === "ok" && info === void 0 ? "absent" : list.status === "error" || reads.status === "error" ? "error" : list.status === "pending" || reads.status === "pending" || presence !== "present" ? "pending" : "ok"
|
|
68406
68504
|
};
|
|
68407
|
-
}
|
|
68408
|
-
|
|
68409
|
-
|
|
68410
|
-
|
|
68411
|
-
|
|
68412
|
-
|
|
68413
|
-
const endDeg = (index + 1) * step;
|
|
68414
|
-
const from = point(startDeg, 96);
|
|
68415
|
-
const to = point(endDeg, 96);
|
|
68416
|
-
const large = step > 180 ? 1 : 0;
|
|
68417
|
-
return {
|
|
68418
|
-
index,
|
|
68419
|
-
startDeg,
|
|
68420
|
-
endDeg,
|
|
68421
|
-
path: `M100 100 L${from.x} ${from.y} A96 96 0 ${large} 1 ${to.x} ${to.y} Z`,
|
|
68422
|
-
centroid: point((startDeg + endDeg) / 2, 96 * LABEL_RADIUS_SHARE)
|
|
68423
|
-
};
|
|
68505
|
+
}
|
|
68506
|
+
function NoHistory() {
|
|
68507
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68508
|
+
className: "text-xs text-foreground-muted",
|
|
68509
|
+
"data-testid": "dc-pie-no-history",
|
|
68510
|
+
children: useUiText()("uiLibrary.sensorPie.noHistory", "No history is kept for this reading.")
|
|
68424
68511
|
});
|
|
68425
68512
|
}
|
|
68426
|
-
|
|
68427
|
-
|
|
68428
|
-
|
|
68429
|
-
|
|
68430
|
-
|
|
68431
|
-
humidity: "bg-info/10 border-info/40",
|
|
68432
|
-
illuminance: "bg-warning/10 border-warning/40",
|
|
68433
|
-
power: "bg-primary/10 border-primary/40",
|
|
68434
|
-
motion: "bg-chart-series-f/10 border-chart-series-f/40",
|
|
68435
|
-
contact: "bg-success/10 border-success/40",
|
|
68436
|
-
text: "bg-foreground-muted/10 border-foreground-muted/40",
|
|
68437
|
-
co2: "bg-chart-series-a/10 border-chart-series-a/40",
|
|
68438
|
-
voc: "bg-chart-series-b/10 border-chart-series-b/40",
|
|
68439
|
-
pm25: "bg-chart-series-c/10 border-chart-series-c/40",
|
|
68440
|
-
pm10: "bg-chart-series-e/10 border-chart-series-e/40",
|
|
68441
|
-
aqi: "bg-chart-series-d/10 border-chart-series-d/40"
|
|
68442
|
-
};
|
|
68443
|
-
/** The selected tile: a stronger tint and a full-colour edge. */
|
|
68444
|
-
var TILE_SELECTED = {
|
|
68445
|
-
temperature: "bg-danger/25 border-danger",
|
|
68446
|
-
humidity: "bg-info/25 border-info",
|
|
68447
|
-
illuminance: "bg-warning/25 border-warning",
|
|
68448
|
-
power: "bg-primary/25 border-primary",
|
|
68449
|
-
motion: "bg-chart-series-f/25 border-chart-series-f",
|
|
68450
|
-
contact: "bg-success/25 border-success",
|
|
68451
|
-
text: "bg-foreground-muted/25 border-foreground-muted",
|
|
68452
|
-
co2: "bg-chart-series-a/25 border-chart-series-a",
|
|
68453
|
-
voc: "bg-chart-series-b/25 border-chart-series-b",
|
|
68454
|
-
pm25: "bg-chart-series-c/25 border-chart-series-c",
|
|
68455
|
-
pm10: "bg-chart-series-e/25 border-chart-series-e",
|
|
68456
|
-
aqi: "bg-chart-series-d/25 border-chart-series-d"
|
|
68457
|
-
};
|
|
68458
|
-
/**
|
|
68459
|
-
* One reading as a tile: its quantity's tint, value and unit big, the short name above,
|
|
68460
|
-
* the single-reading card's own motion behind it and its last-day trend under it. A
|
|
68461
|
-
* reading with no data is a dashed tile with a "—". The grid and the pie's legend draw it.
|
|
68462
|
-
*/
|
|
68463
|
-
function ReadingTile({ reading, selected, dimmed, onSelect, testId }) {
|
|
68464
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
68465
|
-
type: "button",
|
|
68466
|
-
"data-testid": testId,
|
|
68467
|
-
"data-quantity": reading.quantity,
|
|
68468
|
-
"data-state": reading.state,
|
|
68469
|
-
"data-selected": selected ? "true" : void 0,
|
|
68470
|
-
"aria-pressed": selected,
|
|
68471
|
-
"aria-label": `${reading.label} ${reading.value}${reading.unit === null ? "" : ` ${reading.unit}`}`,
|
|
68472
|
-
onClick: () => onSelect?.(reading.id),
|
|
68473
|
-
className: cn("relative isolate flex w-full min-w-0 cursor-pointer flex-col items-start gap-0.5 overflow-hidden rounded-lg border px-2.5 py-2 text-left transition-opacity", reading.state === "empty" ? "border-dashed border-foreground-subtle bg-surface" : selected ? TILE_SELECTED[reading.quantity] : TILE_TONE[reading.quantity], dimmed && "opacity-40"),
|
|
68474
|
-
children: [
|
|
68475
|
-
reading.visual == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MeasurementFx, { visual: reading.visual }),
|
|
68476
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68477
|
-
className: "max-w-full truncate text-xs text-foreground-muted",
|
|
68478
|
-
children: reading.label
|
|
68479
|
-
}),
|
|
68480
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
68481
|
-
className: cn("max-w-full truncate text-lg font-semibold tabular-nums", reading.state === "empty" ? "text-foreground-muted" : "text-foreground"),
|
|
68482
|
-
children: [reading.value, reading.unit === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68483
|
-
className: "ml-1 text-xs font-normal text-foreground-muted",
|
|
68484
|
-
children: reading.unit
|
|
68485
|
-
})]
|
|
68486
|
-
}),
|
|
68487
|
-
reading.trend ?? null
|
|
68488
|
-
]
|
|
68513
|
+
function HistoryError() {
|
|
68514
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
68515
|
+
className: "text-xs text-danger",
|
|
68516
|
+
"data-testid": "dc-pie-history-error",
|
|
68517
|
+
children: useUiText()("uiLibrary.deviceCard.energy.day.error", "The history could not be read.")
|
|
68489
68518
|
});
|
|
68490
68519
|
}
|
|
68491
|
-
/** The columns a row of reading tiles holds: as many as the card's width fits (two on a phone). */
|
|
68492
|
-
var READING_TILES_GRID = "grid w-full grid-cols-[repeat(auto-fit,minmax(6.5rem,1fr))] gap-2";
|
|
68493
|
-
//#endregion
|
|
68494
|
-
//#region src/composites/device-card/scenes/sensor/SensorGridCard.tsx
|
|
68495
68520
|
/**
|
|
68496
|
-
*
|
|
68497
|
-
*
|
|
68498
|
-
*
|
|
68499
|
-
* unit big, the short name under it; a reading with no data is a dashed tile with
|
|
68500
|
-
* a "—". Tapping a tile highlights it (the others dim) and draws its history below
|
|
68501
|
-
* the grid.
|
|
68521
|
+
* The compact "express" chart of the energy system card (`TimeSeriesChart`, one line,
|
|
68522
|
+
* no title) over one reading's last day, on the reading's own palette colour and in
|
|
68523
|
+
* the unit the card shows.
|
|
68502
68524
|
*/
|
|
68503
|
-
function
|
|
68504
|
-
const
|
|
68505
|
-
|
|
68506
|
-
|
|
68507
|
-
|
|
68508
|
-
|
|
68509
|
-
|
|
68510
|
-
|
|
68511
|
-
|
|
68512
|
-
|
|
68513
|
-
|
|
68514
|
-
|
|
68515
|
-
|
|
68516
|
-
|
|
68517
|
-
|
|
68518
|
-
|
|
68519
|
-
|
|
68520
|
-
|
|
68521
|
-
|
|
68522
|
-
|
|
68523
|
-
|
|
68524
|
-
|
|
68525
|
-
|
|
68526
|
-
|
|
68527
|
-
|
|
68528
|
-
|
|
68529
|
-
|
|
68530
|
-
|
|
68531
|
-
|
|
68532
|
-
|
|
68533
|
-
|
|
68534
|
-
|
|
68535
|
-
|
|
68536
|
-
|
|
68537
|
-
|
|
68538
|
-
|
|
68539
|
-
|
|
68540
|
-
"data-testid": "dc-grid-detail",
|
|
68541
|
-
className: "flex w-full flex-col items-center gap-3",
|
|
68542
|
-
children: detail
|
|
68543
|
-
})
|
|
68544
|
-
]
|
|
68545
|
-
})
|
|
68546
|
-
}
|
|
68525
|
+
function ReadingChart({ deviceId, seriesKey, label, unit, slot }) {
|
|
68526
|
+
const t = useUiText();
|
|
68527
|
+
const { info, result, window, phase } = useReadingSeries(deviceId, seriesKey);
|
|
68528
|
+
const series = (0, react$1.useMemo)(() => {
|
|
68529
|
+
if (info === void 0) return [];
|
|
68530
|
+
const shaped = linePoints(info, result, window.from, Math.min(window.to, Date.now()));
|
|
68531
|
+
const base = info.unit;
|
|
68532
|
+
const shown = base !== null && unit !== null && chartUnitChoices(base).includes(unit) ? unit : base;
|
|
68533
|
+
return [{
|
|
68534
|
+
id: seriesKey,
|
|
68535
|
+
label,
|
|
68536
|
+
unit: shown,
|
|
68537
|
+
points: base !== null && shown !== null ? convertPoints(shaped.points, base, shown) : shaped.points,
|
|
68538
|
+
colorIndex: slot,
|
|
68539
|
+
gapMs: shaped.gapMs,
|
|
68540
|
+
interpolation: shaped.held ? "step" : "linear"
|
|
68541
|
+
}];
|
|
68542
|
+
}, [
|
|
68543
|
+
info,
|
|
68544
|
+
result,
|
|
68545
|
+
window,
|
|
68546
|
+
seriesKey,
|
|
68547
|
+
unit,
|
|
68548
|
+
label,
|
|
68549
|
+
slot
|
|
68550
|
+
]);
|
|
68551
|
+
if (phase === "absent") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoHistory, {});
|
|
68552
|
+
if (phase === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HistoryError, {});
|
|
68553
|
+
if (phase === "pending") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, { className: "h-28 w-full" });
|
|
68554
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeSeriesChart, {
|
|
68555
|
+
title: label,
|
|
68556
|
+
hideTitle: true,
|
|
68557
|
+
series,
|
|
68558
|
+
range: window,
|
|
68559
|
+
height: CHART_HEIGHT,
|
|
68560
|
+
className: "w-full",
|
|
68561
|
+
emptyMessage: t("uiLibrary.sensorPie.noHistory", "No history is kept for this reading.")
|
|
68547
68562
|
});
|
|
68548
68563
|
}
|
|
68549
|
-
//#endregion
|
|
68550
|
-
//#region src/composites/device-card/scenes/sensor/pie-css.ts
|
|
68551
68564
|
/**
|
|
68552
|
-
*
|
|
68553
|
-
*
|
|
68554
|
-
* token classes on the elements; under `prefers-reduced-motion` nothing moves.
|
|
68565
|
+
* A state reading (motion, contact) as the library's one state band, in the reading's
|
|
68566
|
+
* own colour and with no title: the highlighted wedge or tile names it.
|
|
68555
68567
|
*/
|
|
68556
|
-
|
|
68557
|
-
|
|
68558
|
-
|
|
68559
|
-
.
|
|
68560
|
-
|
|
68561
|
-
@
|
|
68562
|
-
.
|
|
68563
|
-
|
|
68564
|
-
|
|
68565
|
-
|
|
68566
|
-
|
|
68567
|
-
|
|
68568
|
-
|
|
68569
|
-
|
|
68570
|
-
|
|
68571
|
-
|
|
68572
|
-
|
|
68573
|
-
|
|
68574
|
-
|
|
68575
|
-
|
|
68576
|
-
|
|
68577
|
-
|
|
68578
|
-
|
|
68579
|
-
|
|
68580
|
-
* pair that remains (power, illuminance) rarely sits on one sensor.
|
|
68581
|
-
*/
|
|
68582
|
-
var WEDGE_FILL = {
|
|
68583
|
-
temperature: "fill-danger/25 stroke-danger/60",
|
|
68584
|
-
humidity: "fill-info/25 stroke-info/60",
|
|
68585
|
-
illuminance: "fill-warning/25 stroke-warning/60",
|
|
68586
|
-
power: "fill-primary/25 stroke-primary/60",
|
|
68587
|
-
motion: "fill-chart-series-f/25 stroke-chart-series-f/60",
|
|
68588
|
-
contact: "fill-success/25 stroke-success/60",
|
|
68589
|
-
text: "fill-foreground-muted/25 stroke-foreground-muted/60",
|
|
68590
|
-
co2: "fill-chart-series-a/25 stroke-chart-series-a/60",
|
|
68591
|
-
voc: "fill-chart-series-b/25 stroke-chart-series-b/60",
|
|
68592
|
-
pm25: "fill-chart-series-c/25 stroke-chart-series-c/60",
|
|
68593
|
-
pm10: "fill-chart-series-e/25 stroke-chart-series-e/60",
|
|
68594
|
-
aqi: "fill-chart-series-d/25 stroke-chart-series-d/60"
|
|
68595
|
-
};
|
|
68596
|
-
/** The selected wedge: a stronger tint and a full-colour edge, still its own quantity's. */
|
|
68597
|
-
var WEDGE_FILL_SELECTED = {
|
|
68598
|
-
temperature: "fill-danger/45 stroke-danger",
|
|
68599
|
-
humidity: "fill-info/45 stroke-info",
|
|
68600
|
-
illuminance: "fill-warning/45 stroke-warning",
|
|
68601
|
-
power: "fill-primary/45 stroke-primary",
|
|
68602
|
-
motion: "fill-chart-series-f/45 stroke-chart-series-f",
|
|
68603
|
-
contact: "fill-success/45 stroke-success",
|
|
68604
|
-
text: "fill-foreground-muted/45 stroke-foreground-muted",
|
|
68605
|
-
co2: "fill-chart-series-a/45 stroke-chart-series-a",
|
|
68606
|
-
voc: "fill-chart-series-b/45 stroke-chart-series-b",
|
|
68607
|
-
pm25: "fill-chart-series-c/45 stroke-chart-series-c",
|
|
68608
|
-
pm10: "fill-chart-series-e/45 stroke-chart-series-e",
|
|
68609
|
-
aqi: "fill-chart-series-d/45 stroke-chart-series-d"
|
|
68610
|
-
};
|
|
68611
|
-
/** Colours the quantity's motion (it draws in `currentColor`). */
|
|
68612
|
-
var WEDGE_FX_TEXT = {
|
|
68613
|
-
temperature: "text-danger",
|
|
68614
|
-
humidity: "text-info",
|
|
68615
|
-
illuminance: "text-warning",
|
|
68616
|
-
power: "text-primary",
|
|
68617
|
-
motion: "text-chart-series-f",
|
|
68618
|
-
contact: "text-success",
|
|
68619
|
-
text: "text-foreground-muted",
|
|
68620
|
-
co2: "text-chart-series-a",
|
|
68621
|
-
voc: "text-chart-series-b",
|
|
68622
|
-
pm25: "text-chart-series-c",
|
|
68623
|
-
pm10: "text-chart-series-e",
|
|
68624
|
-
aqi: "text-chart-series-d"
|
|
68625
|
-
};
|
|
68626
|
-
/** The size of the value, so a word and a long number stay inside the wedge. */
|
|
68627
|
-
function valueSizeClass(n, value) {
|
|
68628
|
-
if (value.length > 6) return "text-[9px]";
|
|
68629
|
-
if (n >= 5 || value.length > 4) return "text-[12px]";
|
|
68630
|
-
return n >= 3 ? "text-[16px]" : "text-[20px]";
|
|
68631
|
-
}
|
|
68632
|
-
function onKey(handler) {
|
|
68633
|
-
return (e) => {
|
|
68634
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
68635
|
-
e.preventDefault();
|
|
68636
|
-
handler();
|
|
68637
|
-
}
|
|
68638
|
-
};
|
|
68639
|
-
}
|
|
68640
|
-
/** The quantity's motion, drawn inside the clipped wedge. */
|
|
68641
|
-
function WedgeFx({ quantity, at }) {
|
|
68642
|
-
switch (quantity) {
|
|
68643
|
-
case "motion": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
68644
|
-
"data-fx": "rings",
|
|
68645
|
-
className: "dc-pie-fx",
|
|
68646
|
-
children: [
|
|
68647
|
-
0,
|
|
68648
|
-
1,
|
|
68649
|
-
2
|
|
68650
|
-
].map((i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
68651
|
-
cx: at.x,
|
|
68652
|
-
cy: at.y,
|
|
68653
|
-
r: 8,
|
|
68654
|
-
className: cn("dc-pie-ring fill-none stroke-current", `dc-pie-step-${String(i)}`)
|
|
68655
|
-
}, i))
|
|
68656
|
-
});
|
|
68657
|
-
case "humidity": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
68658
|
-
"data-fx": "drops",
|
|
68659
|
-
className: "dc-pie-fx",
|
|
68660
|
-
children: [
|
|
68661
|
-
-14,
|
|
68662
|
-
0,
|
|
68663
|
-
14
|
|
68664
|
-
].map((dx, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ellipse", {
|
|
68665
|
-
cx: at.x + dx,
|
|
68666
|
-
cy: at.y - 26,
|
|
68667
|
-
rx: 1.6,
|
|
68668
|
-
ry: 3.2,
|
|
68669
|
-
className: cn("dc-pie-drop fill-current", `dc-pie-step-${String(i)}`)
|
|
68670
|
-
}, dx))
|
|
68671
|
-
});
|
|
68672
|
-
case "temperature": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
68673
|
-
"data-fx": "wisps",
|
|
68674
|
-
className: "dc-pie-fx",
|
|
68675
|
-
children: [
|
|
68676
|
-
-12,
|
|
68677
|
-
0,
|
|
68678
|
-
12
|
|
68679
|
-
].map((dx, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
68680
|
-
d: `M${String(at.x + dx)} ${String(at.y + 24)} q4 -6 0 -12`,
|
|
68681
|
-
className: cn("dc-pie-wisp fill-none stroke-current", `dc-pie-step-${String(i)}`)
|
|
68682
|
-
}, dx))
|
|
68683
|
-
});
|
|
68684
|
-
case "power": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
68685
|
-
"data-fx": "flow",
|
|
68686
|
-
className: "dc-pie-fx",
|
|
68687
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
68688
|
-
x1: 100,
|
|
68689
|
-
y1: 100,
|
|
68690
|
-
x2: at.x,
|
|
68691
|
-
y2: at.y,
|
|
68692
|
-
className: "dc-pie-flow stroke-current"
|
|
68693
|
-
})
|
|
68694
|
-
});
|
|
68695
|
-
default: return null;
|
|
68696
|
-
}
|
|
68697
|
-
}
|
|
68698
|
-
function Wedge({ wedge, count, reading, clipId, selected, dimmed, onSelect }) {
|
|
68699
|
-
const { centroid: at } = wedge;
|
|
68700
|
-
const tap = () => onSelect?.(reading.id);
|
|
68701
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
68702
|
-
"data-testid": "dc-pie-wedge",
|
|
68703
|
-
"data-quantity": reading.quantity,
|
|
68704
|
-
"data-state": reading.state,
|
|
68705
|
-
"data-selected": selected ? "true" : void 0,
|
|
68706
|
-
role: "button",
|
|
68707
|
-
"aria-pressed": selected,
|
|
68708
|
-
tabIndex: 0,
|
|
68709
|
-
"aria-label": `${reading.label} ${reading.value}${reading.unit === null ? "" : ` ${reading.unit}`}`,
|
|
68710
|
-
className: cn("dc-pie-wedge cursor-pointer transition-opacity", WEDGE_FX_TEXT[reading.quantity], dimmed && "opacity-40"),
|
|
68711
|
-
onClick: tap,
|
|
68712
|
-
onKeyDown: onKey(tap),
|
|
68713
|
-
children: [
|
|
68714
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("clipPath", {
|
|
68715
|
-
id: clipId,
|
|
68716
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: wedge.path })
|
|
68717
|
-
}),
|
|
68718
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
68719
|
-
d: wedge.path,
|
|
68720
|
-
className: cn(reading.state === "empty" ? "fill-surface stroke-foreground-subtle dc-pie-empty" : selected ? WEDGE_FILL_SELECTED[reading.quantity] : WEDGE_FILL[reading.quantity], reading.state === "active" && "dc-pie-breathe"),
|
|
68721
|
-
strokeWidth: selected ? 3 : 1.5
|
|
68722
|
-
}),
|
|
68723
|
-
reading.state === "active" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
68724
|
-
clipPath: `url(#${clipId})`,
|
|
68725
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WedgeFx, {
|
|
68726
|
-
quantity: reading.quantity,
|
|
68727
|
-
at
|
|
68728
|
-
})
|
|
68729
|
-
}) : null,
|
|
68730
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("text", {
|
|
68731
|
-
x: at.x,
|
|
68732
|
-
y: at.y - 2,
|
|
68733
|
-
textAnchor: "middle",
|
|
68734
|
-
className: cn("font-semibold tabular-nums", reading.state === "empty" ? "fill-foreground-muted" : "fill-foreground", valueSizeClass(count, reading.value)),
|
|
68735
|
-
children: [reading.value, reading.unit === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tspan", {
|
|
68736
|
-
dx: 1.5,
|
|
68737
|
-
className: "fill-foreground-muted text-[8px] font-normal",
|
|
68738
|
-
children: reading.unit
|
|
68739
|
-
})]
|
|
68740
|
-
}),
|
|
68741
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
68742
|
-
x: at.x,
|
|
68743
|
-
y: at.y + 10,
|
|
68744
|
-
textAnchor: "middle",
|
|
68745
|
-
className: "fill-foreground-muted text-[8px]",
|
|
68746
|
-
children: reading.label
|
|
68747
|
-
})
|
|
68748
|
-
]
|
|
68568
|
+
function ReadingStateChart({ deviceId, seriesKey, label, slot }) {
|
|
68569
|
+
const t = useUiText();
|
|
68570
|
+
const { info, result, window, phase } = useReadingSeries(deviceId, seriesKey);
|
|
68571
|
+
if (phase === "pending") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, { className: "h-16 w-full" });
|
|
68572
|
+
if (phase === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HistoryError, {});
|
|
68573
|
+
if (phase === "absent" || info === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoHistory, {});
|
|
68574
|
+
const row = stateRow(info, result, window.from, window.to);
|
|
68575
|
+
const labels = booleanLabels(seriesKey, t);
|
|
68576
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StateTimeline, {
|
|
68577
|
+
title: label,
|
|
68578
|
+
hideTitle: true,
|
|
68579
|
+
range: window,
|
|
68580
|
+
className: "w-full",
|
|
68581
|
+
emptyMessage: t("uiLibrary.sensorPie.noHistory", "No history is kept for this reading."),
|
|
68582
|
+
rows: [{
|
|
68583
|
+
id: seriesKey,
|
|
68584
|
+
label,
|
|
68585
|
+
kind: info.kind === "boolean" ? "boolean" : "enum",
|
|
68586
|
+
states: row.states,
|
|
68587
|
+
segments: row.segments,
|
|
68588
|
+
totals: row.totals,
|
|
68589
|
+
colorIndex: slot,
|
|
68590
|
+
stateLabel: info.kind === "boolean" ? (s) => s === "true" ? labels.on : labels.off : void 0
|
|
68591
|
+
}]
|
|
68749
68592
|
});
|
|
68750
68593
|
}
|
|
68751
68594
|
/**
|
|
68752
|
-
*
|
|
68753
|
-
*
|
|
68754
|
-
*
|
|
68755
|
-
*
|
|
68756
|
-
* reading is also a `ReadingTile` (its motion and trend, as in the grid). Tapping a
|
|
68757
|
-
* wedge or a tile highlights it (the others dim) and draws its history below the pie. Seven or more readings are `SensorGridCard`.
|
|
68595
|
+
* One reading's last day, under the card: no title (the highlighted wedge or tile
|
|
68596
|
+
* names it), the axis in the unit the reading is shown in, the line in the reading's
|
|
68597
|
+
* own colour. A state reading (motion, contact) is one state band of ITS
|
|
68598
|
+
* series, never the device's whole History.
|
|
68758
68599
|
*/
|
|
68759
|
-
function
|
|
68760
|
-
const
|
|
68761
|
-
const
|
|
68762
|
-
const
|
|
68763
|
-
const
|
|
68764
|
-
|
|
68765
|
-
|
|
68766
|
-
|
|
68767
|
-
|
|
68768
|
-
|
|
68769
|
-
|
|
68770
|
-
|
|
68771
|
-
|
|
68772
|
-
|
|
68773
|
-
|
|
68774
|
-
|
|
68775
|
-
|
|
68776
|
-
|
|
68777
|
-
|
|
68778
|
-
|
|
68779
|
-
|
|
68780
|
-
|
|
68781
|
-
|
|
68782
|
-
"data-testid": "dc-pie-updated",
|
|
68783
|
-
className: "absolute left-0 top-0 text-xs text-foreground-muted",
|
|
68784
|
-
children: model.updated
|
|
68785
|
-
}),
|
|
68786
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
68787
|
-
viewBox: "0 0 200 200",
|
|
68788
|
-
role: "group",
|
|
68789
|
-
"aria-label": model.common.name,
|
|
68790
|
-
className: "aspect-square w-full max-w-72",
|
|
68791
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
68792
|
-
cx: 100,
|
|
68793
|
-
cy: 100,
|
|
68794
|
-
r: 98,
|
|
68795
|
-
className: "fill-surface stroke-border",
|
|
68796
|
-
strokeWidth: 1
|
|
68797
|
-
}), model.readings.map((reading, i) => {
|
|
68798
|
-
const wedge = wedges[i];
|
|
68799
|
-
return wedge === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Wedge, {
|
|
68800
|
-
wedge,
|
|
68801
|
-
count,
|
|
68802
|
-
reading,
|
|
68803
|
-
clipId: `${uid}-w${String(i)}`,
|
|
68804
|
-
selected: reading.id === selectedId,
|
|
68805
|
-
dimmed: selectedId !== null && reading.id !== selectedId,
|
|
68806
|
-
onSelect
|
|
68807
|
-
}, reading.id);
|
|
68808
|
-
})]
|
|
68809
|
-
}),
|
|
68810
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
68811
|
-
className: READING_TILES_GRID,
|
|
68812
|
-
"data-testid": "dc-pie-legend",
|
|
68813
|
-
children: model.readings.map((reading) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
68814
|
-
className: "min-w-0",
|
|
68815
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingTile, {
|
|
68816
|
-
reading,
|
|
68817
|
-
selected: reading.id === selectedId,
|
|
68818
|
-
dimmed: selectedId !== null && reading.id !== selectedId,
|
|
68819
|
-
onSelect,
|
|
68820
|
-
testId: "dc-pie-tile"
|
|
68821
|
-
})
|
|
68822
|
-
}, reading.id))
|
|
68823
|
-
}),
|
|
68824
|
-
detail === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
68825
|
-
"data-testid": "dc-pie-detail",
|
|
68826
|
-
className: "flex w-full flex-col items-center gap-3",
|
|
68827
|
-
children: detail
|
|
68828
|
-
})
|
|
68829
|
-
]
|
|
68830
|
-
})
|
|
68831
|
-
}
|
|
68600
|
+
function ReadingHistory({ deviceId, measurement, since, unit = null, slot }) {
|
|
68601
|
+
const label = quantityLabel(useUiText(), measurement.quantity);
|
|
68602
|
+
const stateKey = STATE_READING_HISTORY_KEY[measurement.quantity];
|
|
68603
|
+
const colour = slot ?? readingSlot(measurement);
|
|
68604
|
+
const body = measurement.historyKey !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingChart, {
|
|
68605
|
+
deviceId,
|
|
68606
|
+
seriesKey: measurement.historyKey,
|
|
68607
|
+
label,
|
|
68608
|
+
unit,
|
|
68609
|
+
slot: colour
|
|
68610
|
+
}) : stateKey !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingStateChart, {
|
|
68611
|
+
deviceId,
|
|
68612
|
+
seriesKey: stateKey,
|
|
68613
|
+
label,
|
|
68614
|
+
slot: colour
|
|
68615
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoHistory, {});
|
|
68616
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68617
|
+
className: "flex w-full flex-col items-center gap-2",
|
|
68618
|
+
"data-testid": "dc-pie-history",
|
|
68619
|
+
children: [since === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68620
|
+
className: "text-xs text-foreground-muted",
|
|
68621
|
+
children: since
|
|
68622
|
+
}), body]
|
|
68832
68623
|
});
|
|
68833
68624
|
}
|
|
68834
68625
|
//#endregion
|
|
@@ -68869,125 +68660,6 @@ function SensorTrend({ deviceId, historyKey, label, reading, subject, compact =
|
|
|
68869
68660
|
});
|
|
68870
68661
|
}
|
|
68871
68662
|
//#endregion
|
|
68872
|
-
//#region src/composites/device-card/connected/MeasuredPieCard.tsx
|
|
68873
|
-
/** Two readings of one quantity would share a key: the index keeps them apart. */
|
|
68874
|
-
var idOf = (m, index) => `${m.quantity}-${String(index)}`;
|
|
68875
|
-
/** The newest moment any reading was observed; `null` = none was. */
|
|
68876
|
-
function latestSince(all) {
|
|
68877
|
-
const moments = all.flatMap((m) => m.since === null ? [] : [m.since]);
|
|
68878
|
-
return moments.length === 0 ? null : Math.max(...moments);
|
|
68879
|
-
}
|
|
68880
|
-
/** A sensor with several readings: the pie (or, past six, the grid), and the history behind each reading. */
|
|
68881
|
-
function MeasuredPieCard({ deviceId, canActuate, shown, grid = false, orientation, showName, onDrawn }) {
|
|
68882
|
-
(0, react$1.useEffect)(() => {
|
|
68883
|
-
onDrawn?.(true);
|
|
68884
|
-
}, [onDrawn]);
|
|
68885
|
-
const t = useUiText();
|
|
68886
|
-
const lang = useHeroLang();
|
|
68887
|
-
const unitPreferences = useUnitPreferences();
|
|
68888
|
-
const roleDefaults = useRoleDisplayDefaults();
|
|
68889
|
-
const card = useCardCommon({
|
|
68890
|
-
deviceId,
|
|
68891
|
-
canActuate
|
|
68892
|
-
});
|
|
68893
|
-
const device = useDeviceManagerGetDevice({ deviceId }, { staleTime: 6e4 });
|
|
68894
|
-
const subject = device.data === void 0 || device.data === null ? null : {
|
|
68895
|
-
role: device.data.role ?? null,
|
|
68896
|
-
...device.data.display === void 0 ? {} : { display: device.data.display }
|
|
68897
|
-
};
|
|
68898
|
-
const [selected, setSelected] = (0, react$1.useState)(null);
|
|
68899
|
-
const textOf = (m) => measurementText({
|
|
68900
|
-
measurement: m,
|
|
68901
|
-
lang,
|
|
68902
|
-
subject,
|
|
68903
|
-
unitPreferences,
|
|
68904
|
-
roleDefaults
|
|
68905
|
-
});
|
|
68906
|
-
const readingOf = (m, index) => {
|
|
68907
|
-
const text = textOf(m);
|
|
68908
|
-
return {
|
|
68909
|
-
id: idOf(m, index),
|
|
68910
|
-
quantity: m.quantity,
|
|
68911
|
-
value: text.value,
|
|
68912
|
-
unit: text.unit,
|
|
68913
|
-
label: quantityLabel(t, m.quantity),
|
|
68914
|
-
state: readingStateOf(m),
|
|
68915
|
-
visual: measurementVisual(m),
|
|
68916
|
-
trend: m.historyKey === null || m.reading === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorTrend, {
|
|
68917
|
-
deviceId,
|
|
68918
|
-
historyKey: m.historyKey,
|
|
68919
|
-
label: text.value,
|
|
68920
|
-
reading: m.reading,
|
|
68921
|
-
subject,
|
|
68922
|
-
compact: true
|
|
68923
|
-
})
|
|
68924
|
-
};
|
|
68925
|
-
};
|
|
68926
|
-
const lead = shown[0];
|
|
68927
|
-
const ago = formatLastSeen(latestSince(shown), t);
|
|
68928
|
-
const picked = shown.findIndex((m, i) => idOf(m, i) === selected);
|
|
68929
|
-
const pickedMeasurement = picked < 0 ? void 0 : shown[picked];
|
|
68930
|
-
const model = {
|
|
68931
|
-
common: card.common,
|
|
68932
|
-
state: {
|
|
68933
|
-
label: lead === void 0 ? "" : pickText(lead.word, lang),
|
|
68934
|
-
since: null,
|
|
68935
|
-
tone: lead === void 0 ? "muted" : lead.tone
|
|
68936
|
-
},
|
|
68937
|
-
readings: shown.map(readingOf),
|
|
68938
|
-
updated: ago === null ? null : t("uiLibrary.sensorPie.updated", "Updated · {{ago}}", { ago })
|
|
68939
|
-
};
|
|
68940
|
-
const detail = pickedMeasurement === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingHistory, {
|
|
68941
|
-
deviceId,
|
|
68942
|
-
measurement: pickedMeasurement,
|
|
68943
|
-
since: measurementSinceText(pickedMeasurement, t)
|
|
68944
|
-
});
|
|
68945
|
-
const common = {
|
|
68946
|
-
model,
|
|
68947
|
-
actions: card.actions,
|
|
68948
|
-
showName,
|
|
68949
|
-
selectedId: pickedMeasurement === void 0 ? null : selected,
|
|
68950
|
-
onSelect: (id) => setSelected((current) => current === id ? null : id),
|
|
68951
|
-
detail,
|
|
68952
|
-
...orientation === void 0 ? {} : { orientation }
|
|
68953
|
-
};
|
|
68954
|
-
return grid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorGridCard, { ...common }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorPieCard, { ...common });
|
|
68955
|
-
}
|
|
68956
|
-
/** The state series of a reading that is on/off rather than a number (no trend line). */
|
|
68957
|
-
var STATE_READING_HISTORY_KEY = {
|
|
68958
|
-
motion: "cap:motion.detected",
|
|
68959
|
-
contact: "cap:contact.entryOpen"
|
|
68960
|
-
};
|
|
68961
|
-
/** One reading's value and the last day of it; a state reading shows ITS series only, never the device's whole History. */
|
|
68962
|
-
function ReadingHistory({ deviceId, measurement, since }) {
|
|
68963
|
-
const t = useUiText();
|
|
68964
|
-
const seriesKey = measurement.historyKey ?? STATE_READING_HISTORY_KEY[measurement.quantity];
|
|
68965
|
-
const chart = seriesKey === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeviceHistoryView, {
|
|
68966
|
-
deviceId,
|
|
68967
|
-
seriesKeys: [seriesKey],
|
|
68968
|
-
fixedWindow: "24h"
|
|
68969
|
-
});
|
|
68970
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68971
|
-
className: "flex w-full flex-col items-center gap-2",
|
|
68972
|
-
"data-testid": "dc-pie-history",
|
|
68973
|
-
children: [
|
|
68974
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68975
|
-
className: "text-sm font-medium text-foreground",
|
|
68976
|
-
children: quantityLabel(t, measurement.quantity)
|
|
68977
|
-
}),
|
|
68978
|
-
since === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68979
|
-
className: "text-xs text-foreground-muted",
|
|
68980
|
-
children: since
|
|
68981
|
-
}),
|
|
68982
|
-
chart ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
68983
|
-
className: "text-xs text-foreground-muted",
|
|
68984
|
-
"data-testid": "dc-pie-no-history",
|
|
68985
|
-
children: t("uiLibrary.sensorPie.noHistory", "No history is kept for this reading.")
|
|
68986
|
-
})
|
|
68987
|
-
]
|
|
68988
|
-
});
|
|
68989
|
-
}
|
|
68990
|
-
//#endregion
|
|
68991
68663
|
//#region src/composites/device-card/connected/use-measurement-readings.tsx
|
|
68992
68664
|
var NONE$1 = [];
|
|
68993
68665
|
/**
|
|
@@ -69011,23 +68683,30 @@ function useMeasurementReadings(deviceId) {
|
|
|
69011
68683
|
const idOf = (m, index) => `${m.quantity}-${String(index)}`;
|
|
69012
68684
|
const pickedIndex = (measurements ?? []).findIndex((m, i) => idOf(m, i) === selectedId);
|
|
69013
68685
|
const picked = pickedIndex < 0 ? void 0 : measurements?.[pickedIndex];
|
|
68686
|
+
const subject = device.data === void 0 || device.data === null ? null : {
|
|
68687
|
+
role: device.data.role ?? null,
|
|
68688
|
+
...device.data.display === void 0 ? {} : { display: device.data.display }
|
|
68689
|
+
};
|
|
69014
68690
|
const open = {
|
|
69015
68691
|
selectedId: picked === void 0 ? null : selectedId,
|
|
69016
68692
|
onSelect: (id) => setSelectedId((current) => current === id ? null : id),
|
|
69017
68693
|
detail: picked === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingHistory, {
|
|
69018
68694
|
deviceId,
|
|
69019
68695
|
measurement: picked,
|
|
69020
|
-
since: measurementSinceText(picked, t)
|
|
68696
|
+
since: measurementSinceText(picked, t),
|
|
68697
|
+
unit: measurementText({
|
|
68698
|
+
measurement: picked,
|
|
68699
|
+
lang,
|
|
68700
|
+
subject,
|
|
68701
|
+
unitPreferences,
|
|
68702
|
+
roleDefaults
|
|
68703
|
+
}).unit
|
|
69021
68704
|
})
|
|
69022
68705
|
};
|
|
69023
68706
|
if (measurements === void 0) return {
|
|
69024
68707
|
readings: NONE$1,
|
|
69025
68708
|
open
|
|
69026
68709
|
};
|
|
69027
|
-
const subject = device.data === void 0 || device.data === null ? null : {
|
|
69028
|
-
role: device.data.role ?? null,
|
|
69029
|
-
...device.data.display === void 0 ? {} : { display: device.data.display }
|
|
69030
|
-
};
|
|
69031
68710
|
return {
|
|
69032
68711
|
readings: measurements.map((m, index) => {
|
|
69033
68712
|
const text = measurementText({
|
|
@@ -69347,7 +69026,7 @@ function ConnectedGatewayCard({ deviceId, canActuate = true, orientation, showNa
|
|
|
69347
69026
|
* never wire it themselves; without a provider (unit tests, embeds that do
|
|
69348
69027
|
* not host the modal) a row click navigates to the device page.
|
|
69349
69028
|
*/
|
|
69350
|
-
var DeviceQuickDetailContext = createSharedContext("
|
|
69029
|
+
var DeviceQuickDetailContext = createSharedContext("dominevo:device-quick-detail", null);
|
|
69351
69030
|
function DeviceQuickDetailProvider({ open, children }) {
|
|
69352
69031
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeviceQuickDetailContext.Provider, {
|
|
69353
69032
|
value: open,
|
|
@@ -77900,6 +77579,409 @@ function SensorCard({ model, actions, orientation = "vertical", showName = true,
|
|
|
77900
77579
|
}
|
|
77901
77580
|
});
|
|
77902
77581
|
}
|
|
77582
|
+
/**
|
|
77583
|
+
* The layout of a sensor, or `null` when it is not drawn as a sensor card: no
|
|
77584
|
+
* reading, or a row the operator can still set (a sensor with controls keeps the
|
|
77585
|
+
* full hero card, which draws them).
|
|
77586
|
+
*/
|
|
77587
|
+
function sensorLayoutOf(model) {
|
|
77588
|
+
const gated = new Set(model.gated);
|
|
77589
|
+
if (model.rows.some((row) => !gated.has(row.id) && row.controls.length > 0)) return null;
|
|
77590
|
+
const all = model.measurements ?? (model.measurement === void 0 ? [] : [model.measurement]);
|
|
77591
|
+
const [only, ...rest] = all;
|
|
77592
|
+
if (only === void 0) return null;
|
|
77593
|
+
if (rest.length === 0) return {
|
|
77594
|
+
kind: "single",
|
|
77595
|
+
measurement: only
|
|
77596
|
+
};
|
|
77597
|
+
return {
|
|
77598
|
+
kind: all.length <= 6 ? "pie" : "grid",
|
|
77599
|
+
shown: all
|
|
77600
|
+
};
|
|
77601
|
+
}
|
|
77602
|
+
var ACTIVE_TONES = new Set([
|
|
77603
|
+
"primary",
|
|
77604
|
+
"warning",
|
|
77605
|
+
"danger"
|
|
77606
|
+
]);
|
|
77607
|
+
function readingStateOf(m) {
|
|
77608
|
+
if (!(m.reading !== null || !(0, _dominevo_types.isNotReported)(m.value))) return "empty";
|
|
77609
|
+
return ACTIVE_TONES.has(m.tone) ? "active" : "idle";
|
|
77610
|
+
}
|
|
77611
|
+
/** How far from the centre a wedge's label sits, as a share of the radius. */
|
|
77612
|
+
var LABEL_RADIUS_SHARE = .62;
|
|
77613
|
+
var point = (deg, radius) => {
|
|
77614
|
+
const rad = deg * Math.PI / 180;
|
|
77615
|
+
return {
|
|
77616
|
+
x: Number((100 + radius * Math.sin(rad)).toFixed(2)),
|
|
77617
|
+
y: Number((100 - radius * Math.cos(rad)).toFixed(2))
|
|
77618
|
+
};
|
|
77619
|
+
};
|
|
77620
|
+
/** `count` equal wedges starting at 12 o'clock, clockwise. */
|
|
77621
|
+
function pieGeometry(count) {
|
|
77622
|
+
const step = 360 / count;
|
|
77623
|
+
return Array.from({ length: count }, (_, index) => {
|
|
77624
|
+
const startDeg = index * step;
|
|
77625
|
+
const endDeg = (index + 1) * step;
|
|
77626
|
+
const from = point(startDeg, 96);
|
|
77627
|
+
const to = point(endDeg, 96);
|
|
77628
|
+
const large = step > 180 ? 1 : 0;
|
|
77629
|
+
return {
|
|
77630
|
+
index,
|
|
77631
|
+
startDeg,
|
|
77632
|
+
endDeg,
|
|
77633
|
+
path: `M100 100 L${from.x} ${from.y} A96 96 0 ${large} 1 ${to.x} ${to.y} Z`,
|
|
77634
|
+
centroid: point((startDeg + endDeg) / 2, 96 * LABEL_RADIUS_SHARE)
|
|
77635
|
+
};
|
|
77636
|
+
});
|
|
77637
|
+
}
|
|
77638
|
+
/** Degrees between two points of a wedge's arc in the clip outline. */
|
|
77639
|
+
var CLIP_ARC_STEP_DEG = 4;
|
|
77640
|
+
/**
|
|
77641
|
+
* The CSS `polygon()` of a wedge as percentages of the pie's square (so it scales with
|
|
77642
|
+
* it): the centre, then the arc from its start to its end.
|
|
77643
|
+
*/
|
|
77644
|
+
function wedgeClipPolygon(wedge) {
|
|
77645
|
+
const radiusPct = 96 / 200 * 100;
|
|
77646
|
+
const pct = (deg) => {
|
|
77647
|
+
const rad = deg * Math.PI / 180;
|
|
77648
|
+
const x = 50 + radiusPct * Math.sin(rad);
|
|
77649
|
+
const y = 50 - radiusPct * Math.cos(rad);
|
|
77650
|
+
return `${x.toFixed(2)}% ${y.toFixed(2)}%`;
|
|
77651
|
+
};
|
|
77652
|
+
const steps = Math.max(1, Math.ceil((wedge.endDeg - wedge.startDeg) / CLIP_ARC_STEP_DEG));
|
|
77653
|
+
return `polygon(50% 50%, ${Array.from({ length: steps + 1 }, (_, i) => pct(wedge.startDeg + (wedge.endDeg - wedge.startDeg) * i / steps)).join(", ")})`;
|
|
77654
|
+
}
|
|
77655
|
+
//#endregion
|
|
77656
|
+
//#region src/composites/device-card/scenes/sensor/ReadingTile.tsx
|
|
77657
|
+
/**
|
|
77658
|
+
* One reading as a tile: its quantity's tint, value and unit big, the short name above,
|
|
77659
|
+
* the single-reading card's own motion behind it and its last-day trend under it. A
|
|
77660
|
+
* reading with no data is a dashed tile with a "—". The grid draws it.
|
|
77661
|
+
*/
|
|
77662
|
+
function ReadingTile({ reading, selected, dimmed, onSelect, testId }) {
|
|
77663
|
+
const classes = readingClasses(reading);
|
|
77664
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
77665
|
+
type: "button",
|
|
77666
|
+
"data-testid": testId,
|
|
77667
|
+
"data-quantity": reading.quantity,
|
|
77668
|
+
"data-state": reading.state,
|
|
77669
|
+
"data-selected": selected ? "true" : void 0,
|
|
77670
|
+
"aria-pressed": selected,
|
|
77671
|
+
"aria-label": `${reading.label} ${reading.value}${reading.unit === null ? "" : ` ${reading.unit}`}`,
|
|
77672
|
+
onClick: () => onSelect?.(reading.id),
|
|
77673
|
+
className: cn("relative isolate flex w-full min-w-0 cursor-pointer flex-col items-start gap-0.5 overflow-hidden rounded-lg border px-2.5 py-2 text-left transition-opacity", reading.state === "empty" ? "border-dashed border-foreground-subtle bg-surface" : selected ? classes.tileSelected : classes.tile, dimmed && "opacity-40"),
|
|
77674
|
+
children: [
|
|
77675
|
+
reading.visual == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MeasurementFx, { visual: reading.visual }),
|
|
77676
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77677
|
+
className: "max-w-full truncate text-xs text-foreground-muted",
|
|
77678
|
+
children: reading.label
|
|
77679
|
+
}),
|
|
77680
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
77681
|
+
className: cn("max-w-full truncate text-lg font-semibold tabular-nums", reading.state === "empty" ? "text-foreground-muted" : "text-foreground"),
|
|
77682
|
+
children: [reading.value, reading.unit === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77683
|
+
className: "ml-1 text-xs font-normal text-foreground-muted",
|
|
77684
|
+
children: reading.unit
|
|
77685
|
+
})]
|
|
77686
|
+
}),
|
|
77687
|
+
reading.trend ?? null
|
|
77688
|
+
]
|
|
77689
|
+
});
|
|
77690
|
+
}
|
|
77691
|
+
/** The columns a row of reading tiles holds: as many as the card's width fits (two on a phone). */
|
|
77692
|
+
var READING_TILES_GRID = "grid w-full grid-cols-[repeat(auto-fit,minmax(6.5rem,1fr))] gap-2";
|
|
77693
|
+
//#endregion
|
|
77694
|
+
//#region src/composites/device-card/scenes/sensor/SensorGridCard.tsx
|
|
77695
|
+
/**
|
|
77696
|
+
* A sensor with many readings (seven or more, past what a pie shows legibly): a
|
|
77697
|
+
* grid of tiles, one per reading, as many columns as the card's width holds (two
|
|
77698
|
+
* on a phone). Each tile is tinted by its quantity like a pie wedge: value and
|
|
77699
|
+
* unit big, the short name under it; a reading with no data is a dashed tile with
|
|
77700
|
+
* a "—". Tapping a tile highlights it (the others dim) and draws its history below
|
|
77701
|
+
* the grid.
|
|
77702
|
+
*/
|
|
77703
|
+
function SensorGridCard({ model, actions, orientation = "vertical", showName = true, onSelect, selectedId = null, detail = null }) {
|
|
77704
|
+
const lead = model.readings[0];
|
|
77705
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeviceCard, {
|
|
77706
|
+
kind: "sensor",
|
|
77707
|
+
common: model.common,
|
|
77708
|
+
orientation,
|
|
77709
|
+
showName,
|
|
77710
|
+
state: model.state,
|
|
77711
|
+
activity: lead?.quantity ?? "sensor",
|
|
77712
|
+
...actions === void 0 ? {} : { actions },
|
|
77713
|
+
scene: {
|
|
77714
|
+
fx: null,
|
|
77715
|
+
columns: {},
|
|
77716
|
+
image: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
77717
|
+
"data-testid": "dc-sensor-grid",
|
|
77718
|
+
"data-tiles": model.readings.length,
|
|
77719
|
+
className: "flex w-full flex-col gap-3",
|
|
77720
|
+
children: [
|
|
77721
|
+
model.updated === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77722
|
+
"data-testid": "dc-grid-updated",
|
|
77723
|
+
className: "text-xs text-foreground-muted",
|
|
77724
|
+
children: model.updated
|
|
77725
|
+
}),
|
|
77726
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
77727
|
+
className: READING_TILES_GRID,
|
|
77728
|
+
children: model.readings.map((reading) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
77729
|
+
className: "min-w-0",
|
|
77730
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingTile, {
|
|
77731
|
+
reading,
|
|
77732
|
+
selected: reading.id === selectedId,
|
|
77733
|
+
dimmed: selectedId !== null && reading.id !== selectedId,
|
|
77734
|
+
onSelect,
|
|
77735
|
+
testId: "dc-grid-tile"
|
|
77736
|
+
})
|
|
77737
|
+
}, reading.id))
|
|
77738
|
+
}),
|
|
77739
|
+
detail === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
77740
|
+
"data-testid": "dc-grid-detail",
|
|
77741
|
+
className: "flex w-full flex-col items-center gap-3",
|
|
77742
|
+
children: detail
|
|
77743
|
+
})
|
|
77744
|
+
]
|
|
77745
|
+
})
|
|
77746
|
+
}
|
|
77747
|
+
});
|
|
77748
|
+
}
|
|
77749
|
+
//#endregion
|
|
77750
|
+
//#region src/composites/device-card/scenes/sensor/pie-css.ts
|
|
77751
|
+
/**
|
|
77752
|
+
* The pie's own motion: a breathing fill on an active wedge. The reading's backdrop
|
|
77753
|
+
* motion is the single-reading card's (`MeasurementFx`), clipped to the wedge. Under
|
|
77754
|
+
* `prefers-reduced-motion` nothing moves.
|
|
77755
|
+
*/
|
|
77756
|
+
var SENSOR_PIE_CSS = `
|
|
77757
|
+
.dc-pie-wedge{outline:none}
|
|
77758
|
+
.dc-pie-wedge:focus-visible>path{stroke-width:3}
|
|
77759
|
+
.dc-pie-empty{stroke-dasharray:4 4}
|
|
77760
|
+
.dc-pie-breathe{animation:dc-pie-breathe 2.8s ease-in-out infinite}
|
|
77761
|
+
@keyframes dc-pie-breathe{0%,100%{fill-opacity:.55}50%{fill-opacity:1}}
|
|
77762
|
+
@media (prefers-reduced-motion:reduce){.dc-pie-breathe{animation:none!important}}
|
|
77763
|
+
`;
|
|
77764
|
+
//#endregion
|
|
77765
|
+
//#region src/composites/device-card/scenes/sensor/SensorPieCard.tsx
|
|
77766
|
+
/** The size of the value, so a word and a long number stay inside the wedge. */
|
|
77767
|
+
function valueSizeClass(n, value) {
|
|
77768
|
+
if (value.length > 6) return "text-[9px]";
|
|
77769
|
+
if (n >= 5 || value.length > 4) return "text-[12px]";
|
|
77770
|
+
return n >= 3 ? "text-[16px]" : "text-[20px]";
|
|
77771
|
+
}
|
|
77772
|
+
function onKey(handler) {
|
|
77773
|
+
return (e) => {
|
|
77774
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
77775
|
+
e.preventDefault();
|
|
77776
|
+
handler();
|
|
77777
|
+
}
|
|
77778
|
+
};
|
|
77779
|
+
}
|
|
77780
|
+
function Wedge({ wedge, count, reading, selected, dimmed, onSelect }) {
|
|
77781
|
+
const { centroid: at } = wedge;
|
|
77782
|
+
const classes = readingClasses(reading);
|
|
77783
|
+
const tap = () => onSelect?.(reading.id);
|
|
77784
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
77785
|
+
"data-testid": "dc-pie-wedge",
|
|
77786
|
+
"data-quantity": reading.quantity,
|
|
77787
|
+
"data-state": reading.state,
|
|
77788
|
+
"data-selected": selected ? "true" : void 0,
|
|
77789
|
+
role: "button",
|
|
77790
|
+
"aria-pressed": selected,
|
|
77791
|
+
tabIndex: 0,
|
|
77792
|
+
"aria-label": `${reading.label} ${reading.value}${reading.unit === null ? "" : ` ${reading.unit}`}`,
|
|
77793
|
+
className: cn("dc-pie-wedge cursor-pointer transition-opacity", dimmed && "opacity-40"),
|
|
77794
|
+
onClick: tap,
|
|
77795
|
+
onKeyDown: onKey(tap),
|
|
77796
|
+
children: [
|
|
77797
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
77798
|
+
d: wedge.path,
|
|
77799
|
+
className: cn(reading.state === "empty" ? "fill-surface stroke-foreground-subtle dc-pie-empty" : selected ? classes.wedgeSelected : classes.wedge, reading.state === "active" && "dc-pie-breathe"),
|
|
77800
|
+
strokeWidth: selected ? 3 : 1.5
|
|
77801
|
+
}),
|
|
77802
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("text", {
|
|
77803
|
+
x: at.x,
|
|
77804
|
+
y: at.y - 2,
|
|
77805
|
+
textAnchor: "middle",
|
|
77806
|
+
className: cn("font-semibold tabular-nums", reading.state === "empty" ? "fill-foreground-muted" : "fill-foreground", valueSizeClass(count, reading.value)),
|
|
77807
|
+
children: [reading.value, reading.unit === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tspan", {
|
|
77808
|
+
dx: 1.5,
|
|
77809
|
+
className: "fill-foreground-muted text-[8px] font-normal",
|
|
77810
|
+
children: reading.unit
|
|
77811
|
+
})]
|
|
77812
|
+
}),
|
|
77813
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
77814
|
+
x: at.x,
|
|
77815
|
+
y: at.y + 10,
|
|
77816
|
+
textAnchor: "middle",
|
|
77817
|
+
className: "fill-foreground-muted text-[8px]",
|
|
77818
|
+
children: reading.label
|
|
77819
|
+
})
|
|
77820
|
+
]
|
|
77821
|
+
});
|
|
77822
|
+
}
|
|
77823
|
+
/**
|
|
77824
|
+
* A sensor with two to six readings: a pie of equal wedges from 12 o'clock, each in
|
|
77825
|
+
* its own chart-palette colour, its value, unit and short name at the wedge's centre.
|
|
77826
|
+
* Each wedge that has a value carries its reading's own motion (the single-reading card's
|
|
77827
|
+
* backdrop), clipped to the wedge; a reading with no data is a still, dashed wedge with a "—". Tapping
|
|
77828
|
+
* a wedge highlights it (the others dim) and draws its history below the pie. This is
|
|
77829
|
+
* the ONLY layout of such a card: seven or more readings are `SensorGridCard`.
|
|
77830
|
+
*/
|
|
77831
|
+
function SensorPieCard({ model, actions, orientation = "vertical", showName = true, onSelect, selectedId = null, detail = null }) {
|
|
77832
|
+
const count = model.readings.length;
|
|
77833
|
+
const wedges = pieGeometry(count);
|
|
77834
|
+
const lead = model.readings[0];
|
|
77835
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeviceCard, {
|
|
77836
|
+
kind: "sensor",
|
|
77837
|
+
common: model.common,
|
|
77838
|
+
orientation,
|
|
77839
|
+
showName,
|
|
77840
|
+
state: model.state,
|
|
77841
|
+
activity: lead?.quantity ?? "sensor",
|
|
77842
|
+
...actions === void 0 ? {} : { actions },
|
|
77843
|
+
scene: {
|
|
77844
|
+
fx: null,
|
|
77845
|
+
columns: {},
|
|
77846
|
+
image: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
77847
|
+
"data-testid": "dc-sensor-pie",
|
|
77848
|
+
"data-wedges": count,
|
|
77849
|
+
className: "relative flex w-full flex-col items-center justify-center gap-3",
|
|
77850
|
+
children: [
|
|
77851
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SENSOR_PIE_CSS }),
|
|
77852
|
+
model.updated === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
77853
|
+
"data-testid": "dc-pie-updated",
|
|
77854
|
+
className: "absolute left-0 top-0 text-xs text-foreground-muted",
|
|
77855
|
+
children: model.updated
|
|
77856
|
+
}),
|
|
77857
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
77858
|
+
className: "relative isolate aspect-square w-full max-w-72 overflow-hidden rounded-full border border-border bg-surface",
|
|
77859
|
+
children: [model.readings.map((reading, i) => {
|
|
77860
|
+
const wedge = wedges[i];
|
|
77861
|
+
return wedge === void 0 || reading.visual == null || reading.state === "empty" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
77862
|
+
"data-testid": "dc-pie-fx",
|
|
77863
|
+
"data-quantity": reading.quantity,
|
|
77864
|
+
className: cn("pointer-events-none absolute inset-0 transition-opacity", selectedId !== null && reading.id !== selectedId && "opacity-40"),
|
|
77865
|
+
style: { clipPath: wedgeClipPolygon(wedge) },
|
|
77866
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MeasurementFx, { visual: reading.visual })
|
|
77867
|
+
}, reading.id);
|
|
77868
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
77869
|
+
viewBox: "0 0 200 200",
|
|
77870
|
+
role: "group",
|
|
77871
|
+
"aria-label": model.common.name,
|
|
77872
|
+
className: "absolute inset-0 size-full",
|
|
77873
|
+
children: model.readings.map((reading, i) => {
|
|
77874
|
+
const wedge = wedges[i];
|
|
77875
|
+
return wedge === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Wedge, {
|
|
77876
|
+
wedge,
|
|
77877
|
+
count,
|
|
77878
|
+
reading,
|
|
77879
|
+
selected: reading.id === selectedId,
|
|
77880
|
+
dimmed: selectedId !== null && reading.id !== selectedId,
|
|
77881
|
+
onSelect
|
|
77882
|
+
}, reading.id);
|
|
77883
|
+
})
|
|
77884
|
+
})]
|
|
77885
|
+
}),
|
|
77886
|
+
detail === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
77887
|
+
"data-testid": "dc-pie-detail",
|
|
77888
|
+
className: "flex w-full flex-col items-center gap-3",
|
|
77889
|
+
children: detail
|
|
77890
|
+
})
|
|
77891
|
+
]
|
|
77892
|
+
})
|
|
77893
|
+
}
|
|
77894
|
+
});
|
|
77895
|
+
}
|
|
77896
|
+
//#endregion
|
|
77897
|
+
//#region src/composites/device-card/connected/MeasuredPieCard.tsx
|
|
77898
|
+
/** Two readings of one quantity would share a key: the index keeps them apart. */
|
|
77899
|
+
var idOf = (m, index) => `${m.quantity}-${String(index)}`;
|
|
77900
|
+
/** The newest moment any reading was observed; `null` = none was. */
|
|
77901
|
+
function latestSince(all) {
|
|
77902
|
+
const moments = all.flatMap((m) => m.since === null ? [] : [m.since]);
|
|
77903
|
+
return moments.length === 0 ? null : Math.max(...moments);
|
|
77904
|
+
}
|
|
77905
|
+
/** A sensor with several readings: the pie (or, past six, the grid), and the history behind each reading. */
|
|
77906
|
+
function MeasuredPieCard({ deviceId, canActuate, shown, grid = false, orientation, showName, onDrawn }) {
|
|
77907
|
+
(0, react$1.useEffect)(() => {
|
|
77908
|
+
onDrawn?.(true);
|
|
77909
|
+
}, [onDrawn]);
|
|
77910
|
+
const t = useUiText();
|
|
77911
|
+
const lang = useHeroLang();
|
|
77912
|
+
const unitPreferences = useUnitPreferences();
|
|
77913
|
+
const roleDefaults = useRoleDisplayDefaults();
|
|
77914
|
+
const card = useCardCommon({
|
|
77915
|
+
deviceId,
|
|
77916
|
+
canActuate
|
|
77917
|
+
});
|
|
77918
|
+
const device = useDeviceManagerGetDevice({ deviceId }, { staleTime: 6e4 });
|
|
77919
|
+
const subject = device.data === void 0 || device.data === null ? null : {
|
|
77920
|
+
role: device.data.role ?? null,
|
|
77921
|
+
...device.data.display === void 0 ? {} : { display: device.data.display }
|
|
77922
|
+
};
|
|
77923
|
+
const [selected, setSelected] = (0, react$1.useState)(null);
|
|
77924
|
+
const textOf = (m) => measurementText({
|
|
77925
|
+
measurement: m,
|
|
77926
|
+
lang,
|
|
77927
|
+
subject,
|
|
77928
|
+
unitPreferences,
|
|
77929
|
+
roleDefaults
|
|
77930
|
+
});
|
|
77931
|
+
const slots = assignReadingSlots(shown.map((m) => m.quantity));
|
|
77932
|
+
const readingOf = (m, index) => {
|
|
77933
|
+
const text = textOf(m);
|
|
77934
|
+
return {
|
|
77935
|
+
id: idOf(m, index),
|
|
77936
|
+
slot: slots[index] ?? 0,
|
|
77937
|
+
quantity: m.quantity,
|
|
77938
|
+
value: text.value,
|
|
77939
|
+
unit: text.unit,
|
|
77940
|
+
label: quantityLabel(t, m.quantity),
|
|
77941
|
+
state: readingStateOf(m),
|
|
77942
|
+
visual: measurementVisual(m),
|
|
77943
|
+
trend: m.historyKey === null || m.reading === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorTrend, {
|
|
77944
|
+
deviceId,
|
|
77945
|
+
historyKey: m.historyKey,
|
|
77946
|
+
label: text.value,
|
|
77947
|
+
reading: m.reading,
|
|
77948
|
+
subject,
|
|
77949
|
+
compact: true
|
|
77950
|
+
})
|
|
77951
|
+
};
|
|
77952
|
+
};
|
|
77953
|
+
const lead = shown[0];
|
|
77954
|
+
const ago = formatLastSeen(latestSince(shown), t);
|
|
77955
|
+
const picked = shown.findIndex((m, i) => idOf(m, i) === selected);
|
|
77956
|
+
const pickedMeasurement = picked < 0 ? void 0 : shown[picked];
|
|
77957
|
+
const model = {
|
|
77958
|
+
common: card.common,
|
|
77959
|
+
state: {
|
|
77960
|
+
label: lead === void 0 ? "" : pickText(lead.word, lang),
|
|
77961
|
+
since: null,
|
|
77962
|
+
tone: lead === void 0 ? "muted" : lead.tone
|
|
77963
|
+
},
|
|
77964
|
+
readings: shown.map(readingOf),
|
|
77965
|
+
updated: ago === null ? null : t("uiLibrary.sensorPie.updated", "Updated · {{ago}}", { ago })
|
|
77966
|
+
};
|
|
77967
|
+
const detail = pickedMeasurement === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReadingHistory, {
|
|
77968
|
+
deviceId,
|
|
77969
|
+
measurement: pickedMeasurement,
|
|
77970
|
+
since: measurementSinceText(pickedMeasurement, t),
|
|
77971
|
+
unit: textOf(pickedMeasurement).unit,
|
|
77972
|
+
slot: slots[picked] ?? 0
|
|
77973
|
+
});
|
|
77974
|
+
const common = {
|
|
77975
|
+
model,
|
|
77976
|
+
actions: card.actions,
|
|
77977
|
+
showName,
|
|
77978
|
+
selectedId: pickedMeasurement === void 0 ? null : selected,
|
|
77979
|
+
onSelect: (id) => setSelected((current) => current === id ? null : id),
|
|
77980
|
+
detail,
|
|
77981
|
+
...orientation === void 0 ? {} : { orientation }
|
|
77982
|
+
};
|
|
77983
|
+
return grid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorGridCard, { ...common }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SensorPieCard, { ...common });
|
|
77984
|
+
}
|
|
77903
77985
|
//#endregion
|
|
77904
77986
|
//#region src/composites/hero-model/use-hero-live-refresh.ts
|
|
77905
77987
|
var COALESCE_MS = 250;
|
|
@@ -87571,7 +87653,7 @@ function effectivePageSize(size, totalItems) {
|
|
|
87571
87653
|
* useDeviceListPageSize — global page-size preference for the device-list
|
|
87572
87654
|
* surfaces (Devices, Integrations, integration detail).
|
|
87573
87655
|
*
|
|
87574
|
-
* ONE shared localStorage key (`
|
|
87656
|
+
* ONE shared localStorage key (`dominevo.device-list.pageSize`) so changing
|
|
87575
87657
|
* the per-page size on any device-list page applies everywhere. The stored
|
|
87576
87658
|
* value is validated against {@link DEVICE_LIST_PAGE_SIZE_OPTIONS}; any
|
|
87577
87659
|
* garbage / out-of-range value falls back to the provided default.
|
|
@@ -87588,7 +87670,7 @@ var DEVICE_LIST_PAGE_SIZE_OPTIONS = [
|
|
|
87588
87670
|
200
|
|
87589
87671
|
];
|
|
87590
87672
|
/** Single global key shared across every device-list surface. */
|
|
87591
|
-
var DEVICE_LIST_PAGE_SIZE_KEY = "
|
|
87673
|
+
var DEVICE_LIST_PAGE_SIZE_KEY = "dominevo.device-list.pageSize";
|
|
87592
87674
|
/**
|
|
87593
87675
|
* @param defaultSize fallback when nothing valid is stored. If it is not itself
|
|
87594
87676
|
* a member of {@link DEVICE_LIST_PAGE_SIZE_OPTIONS}, it is replaced by
|
|
@@ -89956,7 +90038,7 @@ function addTag(current, raw) {
|
|
|
89956
90038
|
}
|
|
89957
90039
|
/** The `localStorage` key of one section's view mode. */
|
|
89958
90040
|
function tagViewStorageKey(section) {
|
|
89959
|
-
return `
|
|
90041
|
+
return `dominevo.tags.view.${section}`;
|
|
89960
90042
|
}
|
|
89961
90043
|
/** The remembered view mode; `flat` when nothing (readable) is stored. */
|
|
89962
90044
|
function readTagViewMode(key) {
|
|
@@ -90997,7 +91079,7 @@ function paramKey(scope, base) {
|
|
|
90997
91079
|
}
|
|
90998
91080
|
function readFromLS(lsKey) {
|
|
90999
91081
|
try {
|
|
91000
|
-
const raw = localStorage.getItem(`
|
|
91082
|
+
const raw = localStorage.getItem(`dominevo:${lsKey}:lastFilters`);
|
|
91001
91083
|
if (!raw) return {};
|
|
91002
91084
|
const parsed = JSON.parse(raw);
|
|
91003
91085
|
if (typeof parsed !== "object" || parsed === null) return {};
|
|
@@ -91008,7 +91090,7 @@ function readFromLS(lsKey) {
|
|
|
91008
91090
|
}
|
|
91009
91091
|
function writeToLS(lsKey, filters) {
|
|
91010
91092
|
try {
|
|
91011
|
-
localStorage.setItem(`
|
|
91093
|
+
localStorage.setItem(`dominevo:${lsKey}:lastFilters`, JSON.stringify(filters));
|
|
91012
91094
|
} catch {}
|
|
91013
91095
|
}
|
|
91014
91096
|
function readUrlState(scope, ls) {
|
|
@@ -92564,7 +92646,7 @@ var IntegrationRowsSchema = zod.z.array(zod.z.object({
|
|
|
92564
92646
|
var SupportedKindsSchema = zod.z.array(zod.z.string());
|
|
92565
92647
|
var STATUS_POLL_INTERVAL_MS = 1e4;
|
|
92566
92648
|
/** Where the viewer's "rows per page" choice for this table is remembered. */
|
|
92567
|
-
var DEVICE_EXPORT_PAGE_SIZE_KEY = "
|
|
92649
|
+
var DEVICE_EXPORT_PAGE_SIZE_KEY = "dominevo.device-export.pageSize";
|
|
92568
92650
|
/**
|
|
92569
92651
|
* The exposed-devices table's page sizes. Its own key and options, not the
|
|
92570
92652
|
* Devices page's (25/50/100/200, default 50): the operator asked for a short
|
|
@@ -95198,16 +95280,18 @@ var SEARCH_LIMIT = 200;
|
|
|
95198
95280
|
/** A topology older than this is re-read on window focus. */
|
|
95199
95281
|
var TOPOLOGY_STALE_MS = 15e3;
|
|
95200
95282
|
function useMeshNetworks() {
|
|
95201
|
-
const presence = useCapabilityPresence(DEVICE_MESH_CAP);
|
|
95202
95283
|
const utils = trpc.useUtils();
|
|
95203
95284
|
const search = trpc.deviceManager.search.useQuery({
|
|
95204
95285
|
requires: { caps: [DEVICE_MESH_CAP] },
|
|
95205
95286
|
limit: SEARCH_LIMIT
|
|
95206
95287
|
}, {
|
|
95207
|
-
enabled: presence === "present",
|
|
95208
95288
|
staleTime: TOPOLOGY_STALE_MS,
|
|
95209
95289
|
refetchOnWindowFocus: true
|
|
95210
95290
|
});
|
|
95291
|
+
const presence = classifyDeviceNativePresence({
|
|
95292
|
+
status: search.status,
|
|
95293
|
+
data: search.data
|
|
95294
|
+
});
|
|
95211
95295
|
const deviceIds = (search.data?.items ?? []).filter((i) => i.compatible).map((i) => i.id);
|
|
95212
95296
|
const networks = (0, _tanstack_react_query.useQuery)({
|
|
95213
95297
|
queryKey: [
|
|
@@ -98927,8 +99011,8 @@ function StreamBrokerSelector({ deviceId, value, onChange, disabled, label, clas
|
|
|
98927
99011
|
* provider per `deviceId`; switching device IDs unmounts the
|
|
98928
99012
|
* provider naturally.
|
|
98929
99013
|
*/
|
|
98930
|
-
var PlayerOverlaysStateContext = createSharedContext("
|
|
98931
|
-
var PlayerOverlaysActionsContext = createSharedContext("
|
|
99014
|
+
var PlayerOverlaysStateContext = createSharedContext("dominevo:player-overlays-state", null);
|
|
99015
|
+
var PlayerOverlaysActionsContext = createSharedContext("dominevo:player-overlays-actions", null);
|
|
98932
99016
|
function PlayerOverlaysProvider({ children }) {
|
|
98933
99017
|
const [layers, setLayers] = (0, react$1.useState)(() => /* @__PURE__ */ new Map());
|
|
98934
99018
|
const [buttons, setButtons] = (0, react$1.useState)(() => /* @__PURE__ */ new Map());
|
|
@@ -100467,7 +100551,7 @@ function withResolvedParentDetail(devices) {
|
|
|
100467
100551
|
* from a read that did not answer (D315). The model then groups by
|
|
100468
100552
|
* location and the panel says why.
|
|
100469
100553
|
*/
|
|
100470
|
-
var DEVICE_PICKER_GROUP_STORAGE_KEY = "
|
|
100554
|
+
var DEVICE_PICKER_GROUP_STORAGE_KEY = "dominevo.admin.device-picker.group-by";
|
|
100471
100555
|
/**
|
|
100472
100556
|
* Under `listSiteZones`'s own prefix, so the Locations page's invalidation of
|
|
100473
100557
|
* `[['deviceManager', 'listSiteZones']]` refreshes it too.
|
|
@@ -100477,7 +100561,7 @@ var PICKER_ZONES_STALE_MS = 6e4;
|
|
|
100477
100561
|
/** The stored choice; the default when storage is absent, throws or is unreadable. */
|
|
100478
100562
|
function readStoredGroupBy() {
|
|
100479
100563
|
try {
|
|
100480
|
-
const raw = globalThis.localStorage?.getItem("
|
|
100564
|
+
const raw = globalThis.localStorage?.getItem("dominevo.admin.device-picker.group-by") ?? null;
|
|
100481
100565
|
return raw === null ? PICKER_DEFAULT_GROUP_BY : parsePickerGroupBy(raw);
|
|
100482
100566
|
} catch {
|
|
100483
100567
|
return PICKER_DEFAULT_GROUP_BY;
|
|
@@ -101520,7 +101604,7 @@ function resizeSplit(sizes, index, deltaPct, minPct = 10) {
|
|
|
101520
101604
|
});
|
|
101521
101605
|
}
|
|
101522
101606
|
function storageName(key, count) {
|
|
101523
|
-
return `
|
|
101607
|
+
return `dominevo.columns.${key}.${String(count)}`;
|
|
101524
101608
|
}
|
|
101525
101609
|
function isValidSplit(value, count, minPct) {
|
|
101526
101610
|
if (!Array.isArray(value) || value.length !== count) return false;
|
|
@@ -102099,7 +102183,7 @@ function rememberRecentKind(recent, picked) {
|
|
|
102099
102183
|
}
|
|
102100
102184
|
//#endregion
|
|
102101
102185
|
//#region src/composites/condition-kind-picker/use-recent-kinds.ts
|
|
102102
|
-
var STORAGE_PREFIX = "
|
|
102186
|
+
var STORAGE_PREFIX = "dominevo.conditionKindPicker.recent.";
|
|
102103
102187
|
function isKind(value) {
|
|
102104
102188
|
return _dominevo_types.AUTOMATION_LEAF_KINDS.some((kind) => kind === value);
|
|
102105
102189
|
}
|
|
@@ -103162,7 +103246,7 @@ function DeviceTemplateSuggest(props) {
|
|
|
103162
103246
|
}
|
|
103163
103247
|
//#endregion
|
|
103164
103248
|
//#region src/composites/device-template-field/DeviceTemplateField.tsx
|
|
103165
|
-
var DEVICE_TEMPLATE_DOCS_URL = "https://
|
|
103249
|
+
var DEVICE_TEMPLATE_DOCS_URL = "https://dominevo.app/docs/day-to-day/device-templates";
|
|
103166
103250
|
function isSuggestKey(event) {
|
|
103167
103251
|
return event.ctrlKey && !event.metaKey && !event.altKey && event.code === "Space";
|
|
103168
103252
|
}
|
|
@@ -103878,7 +103962,7 @@ function TaggedDataTable({ section, rows, columns, getTags, searchText, searchLa
|
|
|
103878
103962
|
}
|
|
103879
103963
|
//#endregion
|
|
103880
103964
|
//#region src/ui-library-version.ts
|
|
103881
|
-
var uiLibraryVersion = "0.1.
|
|
103965
|
+
var uiLibraryVersion = "0.1.1";
|
|
103882
103966
|
//#endregion
|
|
103883
103967
|
//#region src/hooks/use-account-unit-preferences.ts
|
|
103884
103968
|
/**
|
|
@@ -103982,7 +104066,7 @@ function UnitPreferencesFromServer({ children }) {
|
|
|
103982
104066
|
* write — operators saw 8-character zone renames cycle the
|
|
103983
104067
|
* pipeline 8 times.
|
|
103984
104068
|
*/
|
|
103985
|
-
var ZoneEditingContext = createSharedContext("
|
|
104069
|
+
var ZoneEditingContext = createSharedContext("dominevo:zone-editing", null);
|
|
103986
104070
|
function ZoneEditingProvider({ children }) {
|
|
103987
104071
|
const [editing, setEditingRaw] = (0, react$1.useState)(false);
|
|
103988
104072
|
const [drawingKind, setDrawingKindRaw] = (0, react$1.useState)(null);
|
|
@@ -104993,7 +105077,7 @@ var MotionZonesSettings = (0, react$1.lazy)(() => Promise.resolve().then(() => r
|
|
|
104993
105077
|
/** Lazy-wrapped `SceneMonitorEditor` — code-split off the main bundle for the
|
|
104994
105078
|
* same reason: it mounts `MaskShapeCanvas`, which chains react-konva. Render
|
|
104995
105079
|
* inside `<Suspense>`; the admin-ui `/scenes` dialog is its only caller. */
|
|
104996
|
-
var SceneMonitorEditor = (0, react$1.lazy)(() => Promise.resolve().then(() => require("./SceneMonitorEditor-
|
|
105080
|
+
var SceneMonitorEditor = (0, react$1.lazy)(() => Promise.resolve().then(() => require("./SceneMonitorEditor-Bres0ZEA.cjs")).then((m) => ({ default: m.SceneMonitorEditor })));
|
|
104997
105081
|
/** Lazy-wrapped `PrivacyMaskSettings` — code-split off the main bundle. */
|
|
104998
105082
|
var PrivacyMaskSettings = (0, react$1.lazy)(() => Promise.resolve().then(() => require("./PrivacyMaskSettings-BLM8OfT5.cjs")).then((m) => ({ default: m.PrivacyMaskSettings })));
|
|
104999
105083
|
//#endregion
|