@dominevo/ui-library 0.1.5 → 0.1.7
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 +12 -0
- package/dist/composites/config-form-builder.d.ts +0 -11
- package/dist/composites/index.d.ts +2 -2
- package/dist/composites/setting-row.d.ts +18 -0
- package/dist/hooks/capability-provider-events.d.ts +22 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.cjs +496 -294
- package/dist/index.js +481 -295
- package/dist/lib/form-grid.d.ts +66 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/primitives/dialog.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11471,6 +11471,112 @@ function sanitizeInfoHtml(html) {
|
|
|
11471
11471
|
return root.innerHTML;
|
|
11472
11472
|
}
|
|
11473
11473
|
//#endregion
|
|
11474
|
+
//#region src/lib/form-grid.ts
|
|
11475
|
+
/**
|
|
11476
|
+
* form-grid — the ONE place a form's column grid and field spans are decided.
|
|
11477
|
+
*
|
|
11478
|
+
* Both schema renderers (ui-library `ConfigFormBuilder` and admin-ui
|
|
11479
|
+
* `FormBuilder`) and every span site in `config-form-field.tsx` call this
|
|
11480
|
+
* module, so a change to the tiers lands everywhere at once.
|
|
11481
|
+
*
|
|
11482
|
+
* The grid follows the width of its own container (`@container` on each
|
|
11483
|
+
* section), never the viewport: the same schema is drawn in a full page, a
|
|
11484
|
+
* split device pane and a dialog. A section's `columns` is a MAXIMUM; unset
|
|
11485
|
+
* means "as many tracks as the width earns":
|
|
11486
|
+
*
|
|
11487
|
+
* container width <480 480-879 880-1319 >=1320
|
|
11488
|
+
* unset 1 2 3 4
|
|
11489
|
+
* columns: 2 1 2 2 2
|
|
11490
|
+
* columns: 3 1 2 3 3
|
|
11491
|
+
* columns: 4 1 2 2 (to 1139) 4 from 1140
|
|
11492
|
+
* columns: 1 1 1 1 1 (capped at max-w-3xl)
|
|
11493
|
+
*
|
|
11494
|
+
* Class strings stay LITERAL in this file: the Tailwind scan
|
|
11495
|
+
* (`@source "../../ui-library/src"`) only emits classes it can read.
|
|
11496
|
+
*/
|
|
11497
|
+
/** Container widths (px) where an automatic grid gains a track. */
|
|
11498
|
+
var FORM_GRID_TIERS = [
|
|
11499
|
+
480,
|
|
11500
|
+
880,
|
|
11501
|
+
1320
|
|
11502
|
+
];
|
|
11503
|
+
/** Gap between fields — shared so both renderers agree. */
|
|
11504
|
+
var FORM_GRID_GAP = "gap-x-3 gap-y-2.5";
|
|
11505
|
+
/** Vertical rhythm between the sections of one form. */
|
|
11506
|
+
var FORM_SECTIONS_GAP = "space-y-4";
|
|
11507
|
+
/** Section/field helper text: a readable measure, never the full line. */
|
|
11508
|
+
var FORM_DESCRIPTION_MEASURE = "max-w-prose";
|
|
11509
|
+
/**
|
|
11510
|
+
* Tracks the grid has at a container width. Mirrors {@link formGridClass}
|
|
11511
|
+
* exactly; the spec parses the classes and checks both agree.
|
|
11512
|
+
*/
|
|
11513
|
+
function formTracks(columns, containerWidth) {
|
|
11514
|
+
if (columns === 1 || containerWidth < 480) return 1;
|
|
11515
|
+
if (columns === 2) return 2;
|
|
11516
|
+
if (columns === 3) return containerWidth >= 880 ? 3 : 2;
|
|
11517
|
+
if (columns === 4) return containerWidth >= 1140 ? 4 : 2;
|
|
11518
|
+
if (containerWidth >= 1320) return 4;
|
|
11519
|
+
return containerWidth >= 880 ? 3 : 2;
|
|
11520
|
+
}
|
|
11521
|
+
/**
|
|
11522
|
+
* The section grid's column classes. A one-column grid also gets
|
|
11523
|
+
* `max-w-3xl` so a lone column never stretches inputs across a wide page.
|
|
11524
|
+
*/
|
|
11525
|
+
function formGridClass(columns) {
|
|
11526
|
+
if (columns === 1) return "grid-cols-1 max-w-3xl";
|
|
11527
|
+
if (columns === 2) return "grid-cols-1 @[480px]:grid-cols-2";
|
|
11528
|
+
if (columns === 3) return "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3";
|
|
11529
|
+
if (columns === 4) return "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4";
|
|
11530
|
+
return "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3 @[1320px]:grid-cols-4";
|
|
11531
|
+
}
|
|
11532
|
+
/** Grid + gap, the full className of a section's field grid. */
|
|
11533
|
+
function formGridClassWithGap(columns) {
|
|
11534
|
+
return `grid ${formGridClass(columns)} ${FORM_GRID_GAP}`;
|
|
11535
|
+
}
|
|
11536
|
+
/**
|
|
11537
|
+
* A field's column span, clamped to the tracks its grid really has at each
|
|
11538
|
+
* tier. Below 480px the grid is one column and every span is `col-span-1`: a
|
|
11539
|
+
* raw `col-span-2` there forces an implicit auto-sized column that siblings
|
|
11540
|
+
* collapse into. `span >= 4` means "the whole row" at every tier.
|
|
11541
|
+
*/
|
|
11542
|
+
function formSpanClass(span, columns) {
|
|
11543
|
+
if (span === void 0 || span <= 1 || columns === 1) return "col-span-1";
|
|
11544
|
+
if (span >= 4) return "col-span-full";
|
|
11545
|
+
if (columns === 2) return "col-span-1 @[480px]:col-span-2";
|
|
11546
|
+
if (columns === 3) return span === 2 ? "col-span-1 @[480px]:col-span-2" : "col-span-1 @[480px]:col-span-2 @[880px]:col-span-3";
|
|
11547
|
+
if (columns === 4) return span === 2 ? "col-span-1 @[480px]:col-span-2" : "col-span-1 @[480px]:col-span-2 @[1140px]:col-span-3";
|
|
11548
|
+
return span === 2 ? "col-span-1 @[480px]:col-span-2" : "col-span-1 @[480px]:col-span-2 @[880px]:col-span-3";
|
|
11549
|
+
}
|
|
11550
|
+
/** Field kinds that need the whole row (content is wide or self-framed). */
|
|
11551
|
+
var FULL_ROW_TYPES = new Set([
|
|
11552
|
+
"textarea",
|
|
11553
|
+
"tags",
|
|
11554
|
+
"multiselect",
|
|
11555
|
+
"device-multiselect",
|
|
11556
|
+
"node-multiselect",
|
|
11557
|
+
"notification-target-multiselect",
|
|
11558
|
+
"time-window",
|
|
11559
|
+
"widget",
|
|
11560
|
+
"group",
|
|
11561
|
+
"sub-tabs"
|
|
11562
|
+
]);
|
|
11563
|
+
/**
|
|
11564
|
+
* The span a field gets: its own `span` when set (an explicit `1` on a
|
|
11565
|
+
* textarea wins), else the whole row for a full-row kind, else one track.
|
|
11566
|
+
*/
|
|
11567
|
+
function fieldSpan(field) {
|
|
11568
|
+
if (field.span !== void 0) return field.span;
|
|
11569
|
+
return FULL_ROW_TYPES.has(field.type) ? 4 : void 0;
|
|
11570
|
+
}
|
|
11571
|
+
/**
|
|
11572
|
+
* The enclosing section's `columns`, so a field's span is clamped to its own
|
|
11573
|
+
* grid. Provided by each renderer around the section grid.
|
|
11574
|
+
*/
|
|
11575
|
+
var FormColumnsContext = (0, react$1.createContext)(void 0);
|
|
11576
|
+
function useFormColumns() {
|
|
11577
|
+
return (0, react$1.useContext)(FormColumnsContext);
|
|
11578
|
+
}
|
|
11579
|
+
//#endregion
|
|
11474
11580
|
//#region ../../node_modules/class-variance-authority/dist/index.mjs
|
|
11475
11581
|
/**
|
|
11476
11582
|
* Copyright 2022 Joe Bell. All rights reserved.
|
|
@@ -17939,6 +18045,241 @@ function DeviceMultiSelectFormField(props) {
|
|
|
17939
18045
|
});
|
|
17940
18046
|
}
|
|
17941
18047
|
//#endregion
|
|
18048
|
+
//#region src/hooks/capability-provider-events.ts
|
|
18049
|
+
/**
|
|
18050
|
+
* The events after which `addons.listCapabilityProviders` / `addons.list` can
|
|
18051
|
+
* answer differently: an addon came, went, crashed or was stopped, its runner
|
|
18052
|
+
* died (terminally, or to be respawned) or its node went away or came back, or a
|
|
18053
|
+
* capability was bound to another provider. They only make the provider lists
|
|
18054
|
+
* faster than their 5 s poll: a capability registering with the hub
|
|
18055
|
+
* (`registerNode`) announces nothing on the bus, so the poll stays.
|
|
18056
|
+
*/
|
|
18057
|
+
var CAPABILITY_PROVIDER_EVENTS = [
|
|
18058
|
+
_dominevo_types.EventCategory.AddonStarted,
|
|
18059
|
+
_dominevo_types.EventCategory.AddonStopped,
|
|
18060
|
+
_dominevo_types.EventCategory.AddonRestarted,
|
|
18061
|
+
_dominevo_types.EventCategory.AddonUpdated,
|
|
18062
|
+
_dominevo_types.EventCategory.AddonInstalled,
|
|
18063
|
+
_dominevo_types.EventCategory.AddonUninstalled,
|
|
18064
|
+
_dominevo_types.EventCategory.AddonCrashed,
|
|
18065
|
+
_dominevo_types.EventCategory.AddonRunnerFailed,
|
|
18066
|
+
_dominevo_types.EventCategory.AddonLoadFailed,
|
|
18067
|
+
_dominevo_types.EventCategory.AddonLoadRecovered,
|
|
18068
|
+
_dominevo_types.EventCategory.ProcessCrashed,
|
|
18069
|
+
_dominevo_types.EventCategory.WorkerOffline,
|
|
18070
|
+
_dominevo_types.EventCategory.WorkerOnline,
|
|
18071
|
+
_dominevo_types.EventCategory.CapabilityBindingChanged,
|
|
18072
|
+
_dominevo_types.EventCategory.SystemAddonsReady
|
|
18073
|
+
];
|
|
18074
|
+
/**
|
|
18075
|
+
* What makes the instance list of an addon's `integration-instances` holder
|
|
18076
|
+
* move through the hub: an instance created, deleted or updated, or switched.
|
|
18077
|
+
* It is NOT every change of the list: an instance's `status` follows the
|
|
18078
|
+
* addon's own probes, which announce nothing, so a holder's list keeps a poll
|
|
18079
|
+
* and follows these only to be faster than it.
|
|
18080
|
+
*/
|
|
18081
|
+
var INSTANCE_LIST_EVENTS = [
|
|
18082
|
+
_dominevo_types.EventCategory.IntegrationInstancesChanged,
|
|
18083
|
+
_dominevo_types.EventCategory.IntegrationEnabled,
|
|
18084
|
+
_dominevo_types.EventCategory.IntegrationDisabled,
|
|
18085
|
+
_dominevo_types.EventCategory.IntegrationDeleted
|
|
18086
|
+
];
|
|
18087
|
+
/** `addons.listCapabilityProviders`, as a procedure path. */
|
|
18088
|
+
var LIST_CAPABILITY_PROVIDERS_PATH = ["addons", "listCapabilityProviders"];
|
|
18089
|
+
/** `addons.list`, as a procedure path. */
|
|
18090
|
+
var ADDONS_LIST_PATH = ["addons", "list"];
|
|
18091
|
+
//#endregion
|
|
18092
|
+
//#region src/hooks/use-event-invalidation.ts
|
|
18093
|
+
/**
|
|
18094
|
+
* useEventInvalidation — subscribe to one or more EventBus categories
|
|
18095
|
+
* over the unified `System.subscribeEvent` push channel and invalidate
|
|
18096
|
+
* a React Query cache prefix when any of them fires.
|
|
18097
|
+
*
|
|
18098
|
+
* Lets callers drop their `refetchInterval` polling: the cache is kept
|
|
18099
|
+
* fresh by server-pushed events instead of timer-driven refetches. The
|
|
18100
|
+
* hook is a no-op when the WebSocket isn't available (e.g. during
|
|
18101
|
+
* initial reconnection) — the caller is free to keep a long
|
|
18102
|
+
* `staleTime` so React Query still serves the last good snapshot.
|
|
18103
|
+
*
|
|
18104
|
+
* Input shape — pass the tRPC procedure path directly:
|
|
18105
|
+
* ✔ `['integrations']` → invalidates every `integrations.*`
|
|
18106
|
+
* ✔ `['deviceManager', 'listAll']` → invalidates that one query
|
|
18107
|
+
*
|
|
18108
|
+
* The hook wraps the path into the `[[...path], ...]` form that
|
|
18109
|
+
* @tanstack/react-query + @trpc/react-query use under the hood —
|
|
18110
|
+
* passing a flat `['integrations']` to `invalidateQueries` directly
|
|
18111
|
+
* would never match the actual tRPC key
|
|
18112
|
+
* `[['integrations', 'list'], { input, type }]`. Caller doesn't have
|
|
18113
|
+
* to know about the wrap.
|
|
18114
|
+
*
|
|
18115
|
+
* Reconnect resilience: when `System.reconnect()` rebuilds the
|
|
18116
|
+
* underlying wsClient + tRPC client, the System reference doesn't
|
|
18117
|
+
* change — but `connectionVersion` bumps. We listen via
|
|
18118
|
+
* `subscribeConnectionEvents` so the subscription effect re-runs
|
|
18119
|
+
* against the freshly-rebuilt tRPC client.
|
|
18120
|
+
*
|
|
18121
|
+
* Lives in `@dominevo/ui-library` (not in admin-ui's hooks folder)
|
|
18122
|
+
* because addon widget bundles reach for it through the shared library.
|
|
18123
|
+
*
|
|
18124
|
+
* ## Replacing a poll
|
|
18125
|
+
*
|
|
18126
|
+
* The third argument carries what a caller needs to DROP its
|
|
18127
|
+
* `refetchInterval`:
|
|
18128
|
+
*
|
|
18129
|
+
* - `deviceId` — an event that names another device is ignored. One that
|
|
18130
|
+
* names no device at all still invalidates.
|
|
18131
|
+
* - `input` — narrow the invalidation to the query called with that input.
|
|
18132
|
+
* - `debounceMs` — the trailing window (default 1 s).
|
|
18133
|
+
* - `safetyNetMs` — events are telemetry and may be dropped, so a caller
|
|
18134
|
+
* with no poll of its own asks for a slow periodic invalidation
|
|
18135
|
+
* ({@link LIVE_REFRESH_SAFETY_NET_MS}).
|
|
18136
|
+
* - `enabled` — false does nothing at all (no id yet, a tab not shown).
|
|
18137
|
+
* - `paused` — the caller holds refreshes back (an open draft, a list being
|
|
18138
|
+
* read); `pending` says one is owed, and it is paid on resume or by
|
|
18139
|
+
* `refreshNow()`.
|
|
18140
|
+
*
|
|
18141
|
+
* And for every caller: a hidden document fetches nothing. Whatever arrived
|
|
18142
|
+
* meanwhile is paid as ONE invalidation when the document is visible again.
|
|
18143
|
+
*/
|
|
18144
|
+
/** Trailing coalesce for event-driven invalidation — see the comment inside. */
|
|
18145
|
+
var EVENT_INVALIDATION_COALESCE_MS = 1e3;
|
|
18146
|
+
/**
|
|
18147
|
+
* The slow periodic invalidation of a query that is otherwise kept fresh by
|
|
18148
|
+
* events. An event may be dropped, so "never" is not an option; this bounds
|
|
18149
|
+
* how long a missed one can leave the page stale.
|
|
18150
|
+
*/
|
|
18151
|
+
var LIVE_REFRESH_SAFETY_NET_MS = 6e4;
|
|
18152
|
+
function numericDeviceId(holder, key) {
|
|
18153
|
+
if (typeof holder !== "object" || holder === null || !(key in holder)) return void 0;
|
|
18154
|
+
const value = Reflect.get(holder, key);
|
|
18155
|
+
return typeof value === "number" ? value : void 0;
|
|
18156
|
+
}
|
|
18157
|
+
/**
|
|
18158
|
+
* The device an event is about: its payload's `deviceId`, else a `device`
|
|
18159
|
+
* source's id. `undefined` when it names none.
|
|
18160
|
+
*/
|
|
18161
|
+
function eventDeviceId(event) {
|
|
18162
|
+
if (typeof event !== "object" || event === null) return void 0;
|
|
18163
|
+
const fromData = "data" in event ? numericDeviceId(event.data, "deviceId") : void 0;
|
|
18164
|
+
if (fromData !== void 0) return fromData;
|
|
18165
|
+
if (!("source" in event)) return void 0;
|
|
18166
|
+
const source = event.source;
|
|
18167
|
+
if (typeof source !== "object" || source === null || !("type" in source)) return void 0;
|
|
18168
|
+
return source.type === "device" ? numericDeviceId(source, "id") : void 0;
|
|
18169
|
+
}
|
|
18170
|
+
function isDocumentHidden() {
|
|
18171
|
+
return typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
18172
|
+
}
|
|
18173
|
+
function buildQueryKey(keyJson, inputJson, keyShape) {
|
|
18174
|
+
const raw = JSON.parse(keyJson);
|
|
18175
|
+
const path = Array.isArray(raw) ? raw : [];
|
|
18176
|
+
if (keyShape === "raw") return path;
|
|
18177
|
+
const wrapped = path.length === 1 && Array.isArray(path[0]) ? path : [path];
|
|
18178
|
+
if (inputJson === void 0) return wrapped;
|
|
18179
|
+
const input = JSON.parse(inputJson);
|
|
18180
|
+
return [...wrapped, { input }];
|
|
18181
|
+
}
|
|
18182
|
+
function useEventInvalidation(queryKey, categories, options) {
|
|
18183
|
+
const system = useSystem();
|
|
18184
|
+
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
18185
|
+
const deviceId = options?.deviceId;
|
|
18186
|
+
const debounceMs = options?.debounceMs ?? EVENT_INVALIDATION_COALESCE_MS;
|
|
18187
|
+
const safetyNetMs = options?.safetyNetMs;
|
|
18188
|
+
const initial = options?.initial !== false;
|
|
18189
|
+
const keyShape = options?.keyShape ?? "trpc";
|
|
18190
|
+
const paused = options?.paused === true;
|
|
18191
|
+
const enabled = options?.enabled !== false;
|
|
18192
|
+
const [tick, setTick] = (0, react$1.useState)(system.connectionVersion);
|
|
18193
|
+
(0, react$1.useEffect)(() => {
|
|
18194
|
+
return system.subscribeConnectionEvents((state, version) => {
|
|
18195
|
+
if (state === "connected") setTick(version);
|
|
18196
|
+
});
|
|
18197
|
+
}, [system]);
|
|
18198
|
+
const key = categories.join("|");
|
|
18199
|
+
const keyJson = JSON.stringify(queryKey);
|
|
18200
|
+
const inputJson = options?.input === void 0 ? void 0 : JSON.stringify(options.input);
|
|
18201
|
+
const pausedRef = (0, react$1.useRef)(paused);
|
|
18202
|
+
pausedRef.current = paused;
|
|
18203
|
+
const owedRef = (0, react$1.useRef)(false);
|
|
18204
|
+
const [pending, setPending] = (0, react$1.useState)(false);
|
|
18205
|
+
const invalidateNow = (0, react$1.useCallback)(() => {
|
|
18206
|
+
owedRef.current = false;
|
|
18207
|
+
setPending(false);
|
|
18208
|
+
queryClient.invalidateQueries({ queryKey: buildQueryKey(keyJson, inputJson, keyShape) });
|
|
18209
|
+
}, [
|
|
18210
|
+
queryClient,
|
|
18211
|
+
keyJson,
|
|
18212
|
+
inputJson,
|
|
18213
|
+
keyShape
|
|
18214
|
+
]);
|
|
18215
|
+
/** Invalidate, unless nobody is looking or the caller asked to wait. */
|
|
18216
|
+
const apply = (0, react$1.useCallback)(() => {
|
|
18217
|
+
if (isDocumentHidden()) {
|
|
18218
|
+
owedRef.current = true;
|
|
18219
|
+
return;
|
|
18220
|
+
}
|
|
18221
|
+
if (pausedRef.current) {
|
|
18222
|
+
owedRef.current = true;
|
|
18223
|
+
setPending(true);
|
|
18224
|
+
return;
|
|
18225
|
+
}
|
|
18226
|
+
invalidateNow();
|
|
18227
|
+
}, [invalidateNow]);
|
|
18228
|
+
(0, react$1.useEffect)(() => {
|
|
18229
|
+
if (!enabled) return void 0;
|
|
18230
|
+
const subs = [];
|
|
18231
|
+
let openWindow = null;
|
|
18232
|
+
const onEvent = (event) => {
|
|
18233
|
+
if (deviceId !== void 0) {
|
|
18234
|
+
const about = eventDeviceId(event);
|
|
18235
|
+
if (about !== void 0 && about !== deviceId) return;
|
|
18236
|
+
}
|
|
18237
|
+
if (openWindow !== null) return;
|
|
18238
|
+
openWindow = setTimeout(() => {
|
|
18239
|
+
openWindow = null;
|
|
18240
|
+
apply();
|
|
18241
|
+
}, debounceMs);
|
|
18242
|
+
};
|
|
18243
|
+
if (initial) invalidateNow();
|
|
18244
|
+
for (const category of key.split("|")) {
|
|
18245
|
+
if (!category) continue;
|
|
18246
|
+
try {
|
|
18247
|
+
subs.push(system.subscribeEvent(category, onEvent));
|
|
18248
|
+
} catch {}
|
|
18249
|
+
}
|
|
18250
|
+
const safetyNet = safetyNetMs !== void 0 && safetyNetMs > 0 ? setInterval(apply, safetyNetMs) : null;
|
|
18251
|
+
const onVisibility = () => {
|
|
18252
|
+
if (!isDocumentHidden() && owedRef.current) apply();
|
|
18253
|
+
};
|
|
18254
|
+
const visibilityTarget = typeof document === "undefined" ? null : document;
|
|
18255
|
+
visibilityTarget?.addEventListener("visibilitychange", onVisibility);
|
|
18256
|
+
return () => {
|
|
18257
|
+
if (openWindow !== null) clearTimeout(openWindow);
|
|
18258
|
+
if (safetyNet !== null) clearInterval(safetyNet);
|
|
18259
|
+
visibilityTarget?.removeEventListener("visibilitychange", onVisibility);
|
|
18260
|
+
for (const unsub of subs) unsub();
|
|
18261
|
+
};
|
|
18262
|
+
}, [
|
|
18263
|
+
system,
|
|
18264
|
+
key,
|
|
18265
|
+
tick,
|
|
18266
|
+
deviceId,
|
|
18267
|
+
debounceMs,
|
|
18268
|
+
safetyNetMs,
|
|
18269
|
+
initial,
|
|
18270
|
+
enabled,
|
|
18271
|
+
apply,
|
|
18272
|
+
invalidateNow
|
|
18273
|
+
]);
|
|
18274
|
+
(0, react$1.useEffect)(() => {
|
|
18275
|
+
if (!paused && owedRef.current) apply();
|
|
18276
|
+
}, [paused, apply]);
|
|
18277
|
+
return {
|
|
18278
|
+
pending,
|
|
18279
|
+
refreshNow: invalidateNow
|
|
18280
|
+
};
|
|
18281
|
+
}
|
|
18282
|
+
//#endregion
|
|
17942
18283
|
//#region src/hooks/use-instances-of-cap.ts
|
|
17943
18284
|
/**
|
|
17944
18285
|
* The instances an operator can link to, read from the ONE instance model (D1013 rule 5): every
|
|
@@ -17992,6 +18333,15 @@ function useInstancesOfCap(filter, opts = {}) {
|
|
|
17992
18333
|
refetchInterval: POLL_INTERVAL_MS$2,
|
|
17993
18334
|
enabled
|
|
17994
18335
|
});
|
|
18336
|
+
useEventInvalidation(LIST_CAPABILITY_PROVIDERS_PATH, CAPABILITY_PROVIDER_EVENTS, {
|
|
18337
|
+
initial: false,
|
|
18338
|
+
enabled
|
|
18339
|
+
});
|
|
18340
|
+
useEventInvalidation([CAP_INSTANCES_QUERY_KEY], INSTANCE_LIST_EVENTS, {
|
|
18341
|
+
initial: false,
|
|
18342
|
+
keyShape: "raw",
|
|
18343
|
+
enabled
|
|
18344
|
+
});
|
|
17995
18345
|
const queries = (0, _tanstack_react_query.useQueries)({ queries: (0, react$1.useMemo)(() => {
|
|
17996
18346
|
const holding = new Set((holders.data ?? []).map((p) => p.addonId));
|
|
17997
18347
|
return (capProviders.data ?? []).map((p) => p.addonId).filter((id) => holding.has(id));
|
|
@@ -33332,6 +33682,8 @@ var contentVariants = cva("relative fixed left-1/2 top-1/2 -translate-x-1/2 -tra
|
|
|
33332
33682
|
sm: "max-w-sm",
|
|
33333
33683
|
md: "max-w-md",
|
|
33334
33684
|
lg: "max-w-lg",
|
|
33685
|
+
/** Form dialogs (ItemFormDialog): wide enough for a two-column form grid (672px). */
|
|
33686
|
+
form: "max-w-2xl",
|
|
33335
33687
|
/** Wide editors (scripts, long forms). */
|
|
33336
33688
|
xl: "max-w-4xl",
|
|
33337
33689
|
/** Full page: the dialog fills the viewport (picker modals over a long list). */
|
|
@@ -33382,6 +33734,11 @@ var contentVariants = cva("relative fixed left-1/2 top-1/2 -translate-x-1/2 -tra
|
|
|
33382
33734
|
width: "lg",
|
|
33383
33735
|
class: "md:w-[calc(100vw-2rem)] md:max-w-lg"
|
|
33384
33736
|
},
|
|
33737
|
+
{
|
|
33738
|
+
placement: "sheet-on-mobile",
|
|
33739
|
+
width: "form",
|
|
33740
|
+
class: "md:w-[calc(100vw-2rem)] md:max-w-2xl"
|
|
33741
|
+
},
|
|
33385
33742
|
{
|
|
33386
33743
|
placement: "sheet-on-mobile",
|
|
33387
33744
|
width: "xl",
|
|
@@ -36328,9 +36685,9 @@ function discoveryStatus(t, ready, settled, query, canType = true) {
|
|
|
36328
36685
|
//#region src/composites/config-form-field.tsx
|
|
36329
36686
|
var INPUT_CLASS = "w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none disabled:opacity-50 disabled:cursor-not-allowed";
|
|
36330
36687
|
var LABEL_CLASS$1 = "block text-[11px] font-medium text-foreground mb-1 break-words";
|
|
36331
|
-
var DESC_CLASS =
|
|
36688
|
+
var DESC_CLASS = `text-[10px] text-foreground-subtle mt-0.5 break-words ${FORM_DESCRIPTION_MEASURE}`;
|
|
36332
36689
|
function FieldWrapper({ label, description, required, span, htmlFor, children, translationFn }) {
|
|
36333
|
-
const colSpanClass = span
|
|
36690
|
+
const colSpanClass = formSpanClass(span, useFormColumns());
|
|
36334
36691
|
const resolvedLabel = resolveLabel(label, translationFn);
|
|
36335
36692
|
const resolvedDescription = resolveLabel(description, translationFn);
|
|
36336
36693
|
const hasLabel = resolvedLabel !== void 0 && resolvedLabel !== "";
|
|
@@ -36371,7 +36728,7 @@ function KeychainOr({ field, value, onChange, disabled, translationFn, multiline
|
|
|
36371
36728
|
label: "label" in field ? field.label : void 0,
|
|
36372
36729
|
description: "description" in field ? field.description : void 0,
|
|
36373
36730
|
required: "required" in field ? field.required : void 0,
|
|
36374
|
-
span:
|
|
36731
|
+
span: fieldSpan(field),
|
|
36375
36732
|
translationFn,
|
|
36376
36733
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SecretFieldControl, {
|
|
36377
36734
|
field,
|
|
@@ -36387,7 +36744,7 @@ function TextField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36387
36744
|
label: field.label,
|
|
36388
36745
|
description: field.description,
|
|
36389
36746
|
required: field.required,
|
|
36390
|
-
span: field
|
|
36747
|
+
span: fieldSpan(field),
|
|
36391
36748
|
translationFn,
|
|
36392
36749
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
36393
36750
|
type: field.inputType ?? "text",
|
|
@@ -36422,7 +36779,7 @@ function NumberField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36422
36779
|
label: field.label,
|
|
36423
36780
|
description: field.description,
|
|
36424
36781
|
required: field.required,
|
|
36425
|
-
span: field
|
|
36782
|
+
span: fieldSpan(field),
|
|
36426
36783
|
translationFn,
|
|
36427
36784
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36428
36785
|
className: "flex items-center gap-1",
|
|
@@ -36456,7 +36813,7 @@ function BooleanField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36456
36813
|
label: void 0,
|
|
36457
36814
|
description: field.description,
|
|
36458
36815
|
required: field.required,
|
|
36459
|
-
span: field
|
|
36816
|
+
span: fieldSpan(field),
|
|
36460
36817
|
translationFn,
|
|
36461
36818
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
36462
36819
|
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
@@ -36482,7 +36839,7 @@ function BooleanField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36482
36839
|
label: void 0,
|
|
36483
36840
|
description: field.description,
|
|
36484
36841
|
required: field.required,
|
|
36485
|
-
span: field
|
|
36842
|
+
span: fieldSpan(field),
|
|
36486
36843
|
translationFn,
|
|
36487
36844
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36488
36845
|
className: "flex items-center justify-between",
|
|
@@ -36534,7 +36891,7 @@ function SelectField({ field, values, value, onChange, disabled, translationFn }
|
|
|
36534
36891
|
label: field.label,
|
|
36535
36892
|
description: field.description,
|
|
36536
36893
|
required: field.required,
|
|
36537
|
-
span: field
|
|
36894
|
+
span: fieldSpan(field),
|
|
36538
36895
|
htmlFor: controlId,
|
|
36539
36896
|
translationFn,
|
|
36540
36897
|
children: field.discoverOptions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfigDiscoveredSelectControl, {
|
|
@@ -36558,7 +36915,7 @@ function InstanceSelectField({ field, value, onChange, disabled, translationFn }
|
|
|
36558
36915
|
label: field.label,
|
|
36559
36916
|
description: field.description,
|
|
36560
36917
|
required: field.required,
|
|
36561
|
-
span: field
|
|
36918
|
+
span: fieldSpan(field),
|
|
36562
36919
|
translationFn,
|
|
36563
36920
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfigInstanceSelectControl, {
|
|
36564
36921
|
field,
|
|
@@ -36574,7 +36931,7 @@ function TimezoneField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36574
36931
|
label: field.label,
|
|
36575
36932
|
description: field.description,
|
|
36576
36933
|
required: field.required,
|
|
36577
|
-
span: field
|
|
36934
|
+
span: fieldSpan(field),
|
|
36578
36935
|
translationFn,
|
|
36579
36936
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimezoneSelector, {
|
|
36580
36937
|
value: typeof value === "string" ? value : "",
|
|
@@ -36588,7 +36945,7 @@ function DateTimeField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36588
36945
|
label: field.label,
|
|
36589
36946
|
description: field.description,
|
|
36590
36947
|
required: field.required,
|
|
36591
|
-
span: field
|
|
36948
|
+
span: fieldSpan(field),
|
|
36592
36949
|
translationFn,
|
|
36593
36950
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
36594
36951
|
type: "datetime-local",
|
|
@@ -36606,7 +36963,7 @@ function DurationField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36606
36963
|
label: field.label,
|
|
36607
36964
|
description: field.description,
|
|
36608
36965
|
required: field.required,
|
|
36609
|
-
span: field
|
|
36966
|
+
span: fieldSpan(field),
|
|
36610
36967
|
translationFn,
|
|
36611
36968
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DurationInput, {
|
|
36612
36969
|
value: stored,
|
|
@@ -36629,7 +36986,7 @@ function TimeWindowField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36629
36986
|
label: field.label,
|
|
36630
36987
|
description: field.description,
|
|
36631
36988
|
required: field.required,
|
|
36632
|
-
span: field
|
|
36989
|
+
span: fieldSpan(field),
|
|
36633
36990
|
translationFn,
|
|
36634
36991
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeWindowInput, {
|
|
36635
36992
|
value: current,
|
|
@@ -36654,7 +37011,7 @@ function MultiSelectField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36654
37011
|
label: field.label,
|
|
36655
37012
|
description: field.description,
|
|
36656
37013
|
required: field.required,
|
|
36657
|
-
span: field
|
|
37014
|
+
span: fieldSpan(field),
|
|
36658
37015
|
translationFn,
|
|
36659
37016
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
36660
37017
|
className: "flex flex-wrap gap-2",
|
|
@@ -36691,7 +37048,7 @@ function PasswordField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36691
37048
|
label: field.label,
|
|
36692
37049
|
description: field.description,
|
|
36693
37050
|
required: field.required,
|
|
36694
|
-
span: field
|
|
37051
|
+
span: fieldSpan(field),
|
|
36695
37052
|
translationFn,
|
|
36696
37053
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordInput, {
|
|
36697
37054
|
"aria-label": field.label,
|
|
@@ -36713,7 +37070,7 @@ function TextAreaField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36713
37070
|
label: field.label,
|
|
36714
37071
|
description: field.description,
|
|
36715
37072
|
required: field.required,
|
|
36716
|
-
span: field
|
|
37073
|
+
span: fieldSpan(field),
|
|
36717
37074
|
translationFn,
|
|
36718
37075
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
36719
37076
|
className: "w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none disabled:opacity-50 disabled:cursor-not-allowed resize-y min-h-[60px]",
|
|
@@ -36743,7 +37100,7 @@ function SliderField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36743
37100
|
label: field.label,
|
|
36744
37101
|
description: field.description,
|
|
36745
37102
|
required: field.required,
|
|
36746
|
-
span: field
|
|
37103
|
+
span: fieldSpan(field),
|
|
36747
37104
|
translationFn,
|
|
36748
37105
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
36749
37106
|
className: "w-full rounded-lg border border-dashed border-border px-3 py-2 text-xs text-foreground-subtle hover:border-primary/40 hover:text-primary transition-colors text-left",
|
|
@@ -36764,7 +37121,7 @@ function SliderField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36764
37121
|
label: field.label,
|
|
36765
37122
|
description: field.description,
|
|
36766
37123
|
required: field.required,
|
|
36767
|
-
span: field
|
|
37124
|
+
span: fieldSpan(field),
|
|
36768
37125
|
translationFn,
|
|
36769
37126
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36770
37127
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
@@ -36859,7 +37216,7 @@ function TagsField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36859
37216
|
label: field.label,
|
|
36860
37217
|
description: field.description,
|
|
36861
37218
|
required: field.required,
|
|
36862
|
-
span: field
|
|
37219
|
+
span: fieldSpan(field),
|
|
36863
37220
|
translationFn,
|
|
36864
37221
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionSelect, {
|
|
36865
37222
|
mode: "multi",
|
|
@@ -36907,7 +37264,7 @@ function NodeSelectBody({ field, value, onChange, disabled, translationFn, lacks
|
|
|
36907
37264
|
label: field.label,
|
|
36908
37265
|
description: field.description,
|
|
36909
37266
|
required: field.required,
|
|
36910
|
-
span: field
|
|
37267
|
+
span: fieldSpan(field),
|
|
36911
37268
|
translationFn,
|
|
36912
37269
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Select, {
|
|
36913
37270
|
className: "w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground focus:outline-none focus:border-primary/50 disabled:opacity-50",
|
|
@@ -36939,7 +37296,7 @@ function NodeMultiSelectField({ field, value, onChange, disabled, translationFn
|
|
|
36939
37296
|
label: field.label,
|
|
36940
37297
|
description: field.description,
|
|
36941
37298
|
required: field.required,
|
|
36942
|
-
span: field
|
|
37299
|
+
span: fieldSpan(field),
|
|
36943
37300
|
translationFn,
|
|
36944
37301
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
36945
37302
|
className: "flex flex-wrap gap-1.5",
|
|
@@ -36962,7 +37319,7 @@ function ColorField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36962
37319
|
label: field.label,
|
|
36963
37320
|
description: field.description,
|
|
36964
37321
|
required: field.required,
|
|
36965
|
-
span: field
|
|
37322
|
+
span: fieldSpan(field),
|
|
36966
37323
|
translationFn,
|
|
36967
37324
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36968
37325
|
className: "flex items-center gap-2",
|
|
@@ -36999,7 +37356,7 @@ function IconField({ field, value, onChange, disabled, translationFn }) {
|
|
|
36999
37356
|
label: field.label,
|
|
37000
37357
|
description: field.description,
|
|
37001
37358
|
required: field.required,
|
|
37002
|
-
span: field
|
|
37359
|
+
span: fieldSpan(field),
|
|
37003
37360
|
translationFn,
|
|
37004
37361
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfigIconFieldControl, {
|
|
37005
37362
|
label: resolveLabel(field.label, translationFn) ?? field.label,
|
|
@@ -37049,7 +37406,7 @@ function ProbeField({ field, value, onChange, disabled, translationFn, onTestFie
|
|
|
37049
37406
|
label: field.label,
|
|
37050
37407
|
description: field.description,
|
|
37051
37408
|
required: field.required,
|
|
37052
|
-
span: field
|
|
37409
|
+
span: fieldSpan(field),
|
|
37053
37410
|
translationFn,
|
|
37054
37411
|
children: [
|
|
37055
37412
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -37098,11 +37455,11 @@ function ProbeField({ field, value, onChange, disabled, translationFn, onTestFie
|
|
|
37098
37455
|
function GroupField({ field, values, onChange, onChangeMany, disabled, translationFn, onTestField, onAction }) {
|
|
37099
37456
|
const [collapsed, setCollapsed] = (0, react$1.useState)(field.defaultCollapsed ?? false);
|
|
37100
37457
|
const isAccordion = field.style === "accordion";
|
|
37458
|
+
const columns = useFormColumns();
|
|
37101
37459
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37102
|
-
className: `${field
|
|
37460
|
+
className: `${formSpanClass(fieldSpan(field), columns)} min-w-0`,
|
|
37103
37461
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37104
37462
|
className: "@container rounded-lg border border-border bg-surface/50 overflow-hidden",
|
|
37105
|
-
style: { containerType: "inline-size" },
|
|
37106
37463
|
children: [isAccordion ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
37107
37464
|
type: "button",
|
|
37108
37465
|
"aria-expanded": !collapsed,
|
|
@@ -37122,7 +37479,7 @@ function GroupField({ field, values, onChange, onChangeMany, disabled, translati
|
|
|
37122
37479
|
children: resolveLabel(field.label, translationFn)
|
|
37123
37480
|
})
|
|
37124
37481
|
}), !collapsed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37125
|
-
className:
|
|
37482
|
+
className: `px-3 pb-3 ${formGridClassWithGap(columns)}`,
|
|
37126
37483
|
children: field.fields.map((subField) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
37127
37484
|
field: subField,
|
|
37128
37485
|
values,
|
|
@@ -37139,7 +37496,8 @@ function GroupField({ field, values, onChange, onChangeMany, disabled, translati
|
|
|
37139
37496
|
}
|
|
37140
37497
|
function SubTabsField({ field, values, onChange, disabled, translationFn, onTestField, onAction }) {
|
|
37141
37498
|
const [active, setActive] = (0, react$1.useState)(field.tabs[0]?.id ?? "");
|
|
37142
|
-
const
|
|
37499
|
+
const columns = useFormColumns();
|
|
37500
|
+
const colSpanClass = formSpanClass(fieldSpan(field), columns);
|
|
37143
37501
|
if (field.tabs.length === 0) return null;
|
|
37144
37502
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37145
37503
|
className: `${colSpanClass} min-w-0`,
|
|
@@ -37148,7 +37506,6 @@ function SubTabsField({ field, values, onChange, disabled, translationFn, onTest
|
|
|
37148
37506
|
children: resolveLabel(field.label, translationFn)
|
|
37149
37507
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37150
37508
|
className: "@container rounded-lg border border-border-subtle bg-surface-hover/40 overflow-hidden",
|
|
37151
|
-
style: { containerType: "inline-size" },
|
|
37152
37509
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37153
37510
|
className: "flex flex-wrap gap-1 p-1.5 border-b border-border-subtle bg-surface/40",
|
|
37154
37511
|
role: "tablist",
|
|
@@ -37170,7 +37527,7 @@ function SubTabsField({ field, values, onChange, disabled, translationFn, onTest
|
|
|
37170
37527
|
if (t.id !== active) return null;
|
|
37171
37528
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37172
37529
|
role: "tabpanel",
|
|
37173
|
-
className:
|
|
37530
|
+
className: `px-3 pb-3 pt-2 ${formGridClassWithGap(columns)}`,
|
|
37174
37531
|
children: t.fields.map((subField, idx) => {
|
|
37175
37532
|
const stableKey = "key" in subField && typeof subField.key === "string" ? subField.key : `__${t.id}__${idx}`;
|
|
37176
37533
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
@@ -37190,7 +37547,7 @@ function SubTabsField({ field, values, onChange, disabled, translationFn, onTest
|
|
|
37190
37547
|
}
|
|
37191
37548
|
function SeparatorField({ span }) {
|
|
37192
37549
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37193
|
-
className: span ===
|
|
37550
|
+
className: span === void 0 ? "col-span-full" : formSpanClass(span, useFormColumns()),
|
|
37194
37551
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: "border-border" })
|
|
37195
37552
|
});
|
|
37196
37553
|
}
|
|
@@ -37443,18 +37800,21 @@ function EditableArrayField({ field, value, onChange, disabled, translationFn, o
|
|
|
37443
37800
|
}, { count: minRows }) : t("uiLibrary.configFormField.removeRow", "Remove this row"),
|
|
37444
37801
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minus, { className: "h-3 w-3" }), t("uiLibrary.configFormField.remove", "Remove")]
|
|
37445
37802
|
})]
|
|
37446
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
37447
|
-
|
|
37448
|
-
children:
|
|
37449
|
-
|
|
37450
|
-
|
|
37451
|
-
|
|
37452
|
-
|
|
37453
|
-
|
|
37454
|
-
|
|
37455
|
-
|
|
37456
|
-
|
|
37457
|
-
|
|
37803
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormColumnsContext.Provider, {
|
|
37804
|
+
value: 2,
|
|
37805
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37806
|
+
className: `${formGridClassWithGap(2)} p-3`,
|
|
37807
|
+
children: field.itemFields.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
37808
|
+
field: sub,
|
|
37809
|
+
values: row,
|
|
37810
|
+
onChange: (k, v) => updateRow(idx, k, v),
|
|
37811
|
+
disabled,
|
|
37812
|
+
translationFn,
|
|
37813
|
+
onTestField,
|
|
37814
|
+
allFields: field.itemFields,
|
|
37815
|
+
onAction
|
|
37816
|
+
}, sub.key))
|
|
37817
|
+
})
|
|
37458
37818
|
})]
|
|
37459
37819
|
}, rowReactKey(row, idx)))
|
|
37460
37820
|
}),
|
|
@@ -37501,7 +37861,7 @@ function ButtonField({ field, disabled, onAction }) {
|
|
|
37501
37861
|
label: field.label,
|
|
37502
37862
|
description: field.description,
|
|
37503
37863
|
required: field.required,
|
|
37504
|
-
span: field
|
|
37864
|
+
span: fieldSpan(field),
|
|
37505
37865
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
37506
37866
|
onClick: handleClick,
|
|
37507
37867
|
disabled: disabled || loading,
|
|
@@ -37591,7 +37951,7 @@ function AddonActionSelectField({ field, value, values, onChange, disabled, onAc
|
|
|
37591
37951
|
label: field.label,
|
|
37592
37952
|
description: field.description,
|
|
37593
37953
|
required: field.required,
|
|
37594
|
-
span: field
|
|
37954
|
+
span: fieldSpan(field),
|
|
37595
37955
|
children: missingParam ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37596
37956
|
className: "text-[11px] text-foreground-subtle italic",
|
|
37597
37957
|
children: field.emptyParamsMessage ?? t("uiLibrary.configFormField.fillPrerequisites", "Fill the prerequisite fields above first.")
|
|
@@ -37703,7 +38063,7 @@ function AddonActionButtonField({ field, values, disabled, onAction, onChange, o
|
|
|
37703
38063
|
label: field.label,
|
|
37704
38064
|
description: field.description,
|
|
37705
38065
|
required: field.required,
|
|
37706
|
-
span: field
|
|
38066
|
+
span: fieldSpan(field),
|
|
37707
38067
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37708
38068
|
className: "flex flex-col gap-1.5",
|
|
37709
38069
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -37764,7 +38124,7 @@ function DeviceActionButtonField({ field, values, disabled, onAction }) {
|
|
|
37764
38124
|
label: field.label,
|
|
37765
38125
|
description: field.description,
|
|
37766
38126
|
required: field.required,
|
|
37767
|
-
span: field
|
|
38127
|
+
span: fieldSpan(field),
|
|
37768
38128
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37769
38129
|
className: "flex flex-col gap-1.5",
|
|
37770
38130
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -37784,7 +38144,7 @@ function WidgetField({ field }) {
|
|
|
37784
38144
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
37785
38145
|
label: void 0,
|
|
37786
38146
|
description: void 0,
|
|
37787
|
-
span: field
|
|
38147
|
+
span: fieldSpan(field),
|
|
37788
38148
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WidgetSlot, {
|
|
37789
38149
|
widgetId: field.widgetId,
|
|
37790
38150
|
host: "device-tab",
|
|
@@ -37940,7 +38300,7 @@ function MultipleFieldWrapper({ field, values, onChange, disabled, translationFn
|
|
|
37940
38300
|
label: field.label,
|
|
37941
38301
|
description: field.description,
|
|
37942
38302
|
required: min > 0 ? field.required : false,
|
|
37943
|
-
span: field
|
|
38303
|
+
span: fieldSpan(field),
|
|
37944
38304
|
translationFn,
|
|
37945
38305
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37946
38306
|
className: "space-y-2",
|
|
@@ -38332,23 +38692,6 @@ function resolveLabel(value, t) {
|
|
|
38332
38692
|
return value;
|
|
38333
38693
|
}
|
|
38334
38694
|
/**
|
|
38335
|
-
* Container-query driven responsive grid. Each section is its own
|
|
38336
|
-
* `@container` so the column count adapts to the SECTION's width
|
|
38337
|
-
* (not the viewport) — important inside narrow hosts like the
|
|
38338
|
-
* device-detail right column / ItemFormDialog. Behavior:
|
|
38339
|
-
* columns=1 → always 1 col
|
|
38340
|
-
* columns=2 (default) → 1 col below 480px container, 2 cols above
|
|
38341
|
-
* columns=3 → 1 → 2 → 3 col at 480px / 880px
|
|
38342
|
-
* columns=4 → 1 → 2 → 4 col at 480px / 1140px
|
|
38343
|
-
*/
|
|
38344
|
-
function sectionGridClass(columns) {
|
|
38345
|
-
const cols = columns ?? 2;
|
|
38346
|
-
if (cols === 1) return "grid-cols-1";
|
|
38347
|
-
if (cols === 3) return "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3";
|
|
38348
|
-
if (cols === 4) return "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4";
|
|
38349
|
-
return "grid-cols-1 @[480px]:grid-cols-2";
|
|
38350
|
-
}
|
|
38351
|
-
/**
|
|
38352
38695
|
* The sections worth drawing for these values: a section whose every field is hidden by its
|
|
38353
38696
|
* `showWhen` (a provider's section while another provider is selected) would be a bare header, so
|
|
38354
38697
|
* it is left out. A section declared with no fields at all is the author's choice and stays.
|
|
@@ -38359,10 +38702,9 @@ function visibleSections(allFields, schema, values) {
|
|
|
38359
38702
|
function SectionCard$1({ section, allFields, values, onChange, disabled, translationFn, onTestField, probeResults, onAction, onChangeMany }) {
|
|
38360
38703
|
const [collapsed, setCollapsed] = (0, react$1.useState)(section.defaultCollapsed ?? false);
|
|
38361
38704
|
const isAccordion = section.style === "accordion";
|
|
38362
|
-
const gridClass =
|
|
38705
|
+
const gridClass = formGridClassWithGap(section.columns);
|
|
38363
38706
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
38364
38707
|
className: "@container rounded-lg border border-border bg-surface p-3",
|
|
38365
|
-
style: { containerType: "inline-size" },
|
|
38366
38708
|
children: [isAccordion ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
38367
38709
|
type: "button",
|
|
38368
38710
|
"aria-expanded": !collapsed,
|
|
@@ -38372,7 +38714,7 @@ function SectionCard$1({ section, allFields, values, onChange, disabled, transla
|
|
|
38372
38714
|
className: "text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
38373
38715
|
children: resolveLabel(section.title, translationFn)
|
|
38374
38716
|
}), section.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
38375
|
-
className:
|
|
38717
|
+
className: `text-[10px] text-foreground-subtle mt-0.5 max-w-prose`,
|
|
38376
38718
|
children: resolveLabel(section.description, translationFn)
|
|
38377
38719
|
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DisclosureChevron, {
|
|
38378
38720
|
expanded: !collapsed,
|
|
@@ -38384,23 +38726,26 @@ function SectionCard$1({ section, allFields, values, onChange, disabled, transla
|
|
|
38384
38726
|
className: "text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
38385
38727
|
children: resolveLabel(section.title, translationFn)
|
|
38386
38728
|
}), section.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
38387
|
-
className:
|
|
38729
|
+
className: `text-[10px] text-foreground-subtle mt-0.5 max-w-prose`,
|
|
38388
38730
|
children: resolveLabel(section.description, translationFn)
|
|
38389
38731
|
})] })
|
|
38390
|
-
}), !collapsed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
38391
|
-
|
|
38392
|
-
children:
|
|
38393
|
-
|
|
38394
|
-
|
|
38395
|
-
|
|
38396
|
-
|
|
38397
|
-
|
|
38398
|
-
|
|
38399
|
-
|
|
38400
|
-
|
|
38401
|
-
|
|
38402
|
-
|
|
38403
|
-
|
|
38732
|
+
}), !collapsed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormColumnsContext.Provider, {
|
|
38733
|
+
value: section.columns,
|
|
38734
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38735
|
+
className: gridClass,
|
|
38736
|
+
children: section.fields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
38737
|
+
field,
|
|
38738
|
+
allFields,
|
|
38739
|
+
values,
|
|
38740
|
+
onChange,
|
|
38741
|
+
disabled,
|
|
38742
|
+
translationFn,
|
|
38743
|
+
onTestField,
|
|
38744
|
+
externalProbe: probeResults?.[field.key],
|
|
38745
|
+
onAction,
|
|
38746
|
+
onChangeMany
|
|
38747
|
+
}, field.key))
|
|
38748
|
+
})
|
|
38404
38749
|
})]
|
|
38405
38750
|
});
|
|
38406
38751
|
}
|
|
@@ -38423,29 +38768,31 @@ function ConfigFormBuilder({ schema, values, onChange, disabled, translationFn,
|
|
|
38423
38768
|
};
|
|
38424
38769
|
const allFields = schema.sections.flatMap((section) => section.fields);
|
|
38425
38770
|
if (bare) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38426
|
-
className:
|
|
38771
|
+
className: FORM_SECTIONS_GAP,
|
|
38427
38772
|
children: visibleSections(allFields, schema, values).map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38428
38773
|
className: "@container",
|
|
38429
|
-
|
|
38430
|
-
|
|
38431
|
-
|
|
38432
|
-
|
|
38433
|
-
field,
|
|
38434
|
-
|
|
38435
|
-
|
|
38436
|
-
|
|
38437
|
-
|
|
38438
|
-
|
|
38439
|
-
|
|
38440
|
-
|
|
38441
|
-
|
|
38442
|
-
|
|
38443
|
-
|
|
38774
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormColumnsContext.Provider, {
|
|
38775
|
+
value: section.columns,
|
|
38776
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38777
|
+
className: formGridClassWithGap(section.columns),
|
|
38778
|
+
children: section.fields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
38779
|
+
field,
|
|
38780
|
+
allFields,
|
|
38781
|
+
values,
|
|
38782
|
+
onChange: handleFieldChange,
|
|
38783
|
+
disabled,
|
|
38784
|
+
translationFn,
|
|
38785
|
+
onTestField,
|
|
38786
|
+
externalProbe: probeResults?.[field.key],
|
|
38787
|
+
onAction,
|
|
38788
|
+
onChangeMany: handleChangeMany
|
|
38789
|
+
}, field.key))
|
|
38790
|
+
})
|
|
38444
38791
|
})
|
|
38445
38792
|
}, section.id))
|
|
38446
38793
|
});
|
|
38447
38794
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38448
|
-
className:
|
|
38795
|
+
className: FORM_SECTIONS_GAP,
|
|
38449
38796
|
children: visibleSections(allFields, schema, values).map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionCard$1, {
|
|
38450
38797
|
section,
|
|
38451
38798
|
allFields,
|
|
@@ -45498,6 +45845,27 @@ function SettingRow({ label, children, actions, elements = "plain", className, v
|
|
|
45498
45845
|
})]
|
|
45499
45846
|
});
|
|
45500
45847
|
}
|
|
45848
|
+
/**
|
|
45849
|
+
* A group of independent `SettingRow`s that uses the width it is given.
|
|
45850
|
+
*
|
|
45851
|
+
* One column in a narrow card; from an 880px container the rows flow into two
|
|
45852
|
+
* label/value columns, so a settings card on a wide window is not a narrow
|
|
45853
|
+
* column hugging the left edge. The track count follows the CONTAINER, not the
|
|
45854
|
+
* viewport, like the schema form grid (`lib/form-grid.ts`).
|
|
45855
|
+
*
|
|
45856
|
+
* Only group rows that do not depend on each other: a chain (source -> sensor
|
|
45857
|
+
* -> thresholds) reads top to bottom and stays a plain stack. A row that must
|
|
45858
|
+
* take the whole line passes `className="@[880px]:col-span-2"`.
|
|
45859
|
+
*/
|
|
45860
|
+
function SettingRows({ children, className }) {
|
|
45861
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
45862
|
+
className: "@container",
|
|
45863
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
45864
|
+
className: cn("grid grid-cols-1 gap-x-10 @[880px]:grid-cols-2", className),
|
|
45865
|
+
children
|
|
45866
|
+
})
|
|
45867
|
+
});
|
|
45868
|
+
}
|
|
45501
45869
|
//#endregion
|
|
45502
45870
|
//#region src/composites/key-value-list.tsx
|
|
45503
45871
|
/**
|
|
@@ -96917,7 +97285,7 @@ function SectionToolbar({ start, end, className, testId }) {
|
|
|
96917
97285
|
}
|
|
96918
97286
|
//#endregion
|
|
96919
97287
|
//#region src/composites/item-form-dialog.tsx
|
|
96920
|
-
function ItemFormDialog({ open, onClose, title, icon: Icon, error, width = "
|
|
97288
|
+
function ItemFormDialog({ open, onClose, title, icon: Icon, error, width = "form", children, beforeBody, footer, testId, fill = false }) {
|
|
96921
97289
|
if (!open) return null;
|
|
96922
97290
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog, {
|
|
96923
97291
|
open: true,
|
|
@@ -104670,7 +105038,7 @@ function TaggedDataTable({ section, rows, columns, getTags, searchText, searchLa
|
|
|
104670
105038
|
}
|
|
104671
105039
|
//#endregion
|
|
104672
105040
|
//#region src/ui-library-version.ts
|
|
104673
|
-
var uiLibraryVersion = "0.1.
|
|
105041
|
+
var uiLibraryVersion = "0.1.7";
|
|
104674
105042
|
//#endregion
|
|
104675
105043
|
//#region src/hooks/use-account-unit-preferences.ts
|
|
104676
105044
|
/**
|
|
@@ -105362,197 +105730,6 @@ function useDoorbellEvents(options) {
|
|
|
105362
105730
|
};
|
|
105363
105731
|
}
|
|
105364
105732
|
//#endregion
|
|
105365
|
-
//#region src/hooks/use-event-invalidation.ts
|
|
105366
|
-
/**
|
|
105367
|
-
* useEventInvalidation — subscribe to one or more EventBus categories
|
|
105368
|
-
* over the unified `System.subscribeEvent` push channel and invalidate
|
|
105369
|
-
* a React Query cache prefix when any of them fires.
|
|
105370
|
-
*
|
|
105371
|
-
* Lets callers drop their `refetchInterval` polling: the cache is kept
|
|
105372
|
-
* fresh by server-pushed events instead of timer-driven refetches. The
|
|
105373
|
-
* hook is a no-op when the WebSocket isn't available (e.g. during
|
|
105374
|
-
* initial reconnection) — the caller is free to keep a long
|
|
105375
|
-
* `staleTime` so React Query still serves the last good snapshot.
|
|
105376
|
-
*
|
|
105377
|
-
* Input shape — pass the tRPC procedure path directly:
|
|
105378
|
-
* ✔ `['integrations']` → invalidates every `integrations.*`
|
|
105379
|
-
* ✔ `['deviceManager', 'listAll']` → invalidates that one query
|
|
105380
|
-
*
|
|
105381
|
-
* The hook wraps the path into the `[[...path], ...]` form that
|
|
105382
|
-
* @tanstack/react-query + @trpc/react-query use under the hood —
|
|
105383
|
-
* passing a flat `['integrations']` to `invalidateQueries` directly
|
|
105384
|
-
* would never match the actual tRPC key
|
|
105385
|
-
* `[['integrations', 'list'], { input, type }]`. Caller doesn't have
|
|
105386
|
-
* to know about the wrap.
|
|
105387
|
-
*
|
|
105388
|
-
* Reconnect resilience: when `System.reconnect()` rebuilds the
|
|
105389
|
-
* underlying wsClient + tRPC client, the System reference doesn't
|
|
105390
|
-
* change — but `connectionVersion` bumps. We listen via
|
|
105391
|
-
* `subscribeConnectionEvents` so the subscription effect re-runs
|
|
105392
|
-
* against the freshly-rebuilt tRPC client.
|
|
105393
|
-
*
|
|
105394
|
-
* Lives in `@dominevo/ui-library` (not in admin-ui's hooks folder)
|
|
105395
|
-
* because addon widget bundles reach for it through the shared library.
|
|
105396
|
-
*
|
|
105397
|
-
* ## Replacing a poll
|
|
105398
|
-
*
|
|
105399
|
-
* The third argument carries what a caller needs to DROP its
|
|
105400
|
-
* `refetchInterval`:
|
|
105401
|
-
*
|
|
105402
|
-
* - `deviceId` — an event that names another device is ignored. One that
|
|
105403
|
-
* names no device at all still invalidates.
|
|
105404
|
-
* - `input` — narrow the invalidation to the query called with that input.
|
|
105405
|
-
* - `debounceMs` — the trailing window (default 1 s).
|
|
105406
|
-
* - `safetyNetMs` — events are telemetry and may be dropped, so a caller
|
|
105407
|
-
* with no poll of its own asks for a slow periodic invalidation
|
|
105408
|
-
* ({@link LIVE_REFRESH_SAFETY_NET_MS}).
|
|
105409
|
-
* - `enabled` — false does nothing at all (no id yet, a tab not shown).
|
|
105410
|
-
* - `paused` — the caller holds refreshes back (an open draft, a list being
|
|
105411
|
-
* read); `pending` says one is owed, and it is paid on resume or by
|
|
105412
|
-
* `refreshNow()`.
|
|
105413
|
-
*
|
|
105414
|
-
* And for every caller: a hidden document fetches nothing. Whatever arrived
|
|
105415
|
-
* meanwhile is paid as ONE invalidation when the document is visible again.
|
|
105416
|
-
*/
|
|
105417
|
-
/** Trailing coalesce for event-driven invalidation — see the comment inside. */
|
|
105418
|
-
var EVENT_INVALIDATION_COALESCE_MS = 1e3;
|
|
105419
|
-
/**
|
|
105420
|
-
* The slow periodic invalidation of a query that is otherwise kept fresh by
|
|
105421
|
-
* events. An event may be dropped, so "never" is not an option; this bounds
|
|
105422
|
-
* how long a missed one can leave the page stale.
|
|
105423
|
-
*/
|
|
105424
|
-
var LIVE_REFRESH_SAFETY_NET_MS = 6e4;
|
|
105425
|
-
function numericDeviceId(holder, key) {
|
|
105426
|
-
if (typeof holder !== "object" || holder === null || !(key in holder)) return void 0;
|
|
105427
|
-
const value = Reflect.get(holder, key);
|
|
105428
|
-
return typeof value === "number" ? value : void 0;
|
|
105429
|
-
}
|
|
105430
|
-
/**
|
|
105431
|
-
* The device an event is about: its payload's `deviceId`, else a `device`
|
|
105432
|
-
* source's id. `undefined` when it names none.
|
|
105433
|
-
*/
|
|
105434
|
-
function eventDeviceId(event) {
|
|
105435
|
-
if (typeof event !== "object" || event === null) return void 0;
|
|
105436
|
-
const fromData = "data" in event ? numericDeviceId(event.data, "deviceId") : void 0;
|
|
105437
|
-
if (fromData !== void 0) return fromData;
|
|
105438
|
-
if (!("source" in event)) return void 0;
|
|
105439
|
-
const source = event.source;
|
|
105440
|
-
if (typeof source !== "object" || source === null || !("type" in source)) return void 0;
|
|
105441
|
-
return source.type === "device" ? numericDeviceId(source, "id") : void 0;
|
|
105442
|
-
}
|
|
105443
|
-
function isDocumentHidden() {
|
|
105444
|
-
return typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
105445
|
-
}
|
|
105446
|
-
function buildQueryKey(keyJson, inputJson, keyShape) {
|
|
105447
|
-
const raw = JSON.parse(keyJson);
|
|
105448
|
-
const path = Array.isArray(raw) ? raw : [];
|
|
105449
|
-
if (keyShape === "raw") return path;
|
|
105450
|
-
const wrapped = path.length === 1 && Array.isArray(path[0]) ? path : [path];
|
|
105451
|
-
if (inputJson === void 0) return wrapped;
|
|
105452
|
-
const input = JSON.parse(inputJson);
|
|
105453
|
-
return [...wrapped, { input }];
|
|
105454
|
-
}
|
|
105455
|
-
function useEventInvalidation(queryKey, categories, options) {
|
|
105456
|
-
const system = useSystem();
|
|
105457
|
-
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
105458
|
-
const deviceId = options?.deviceId;
|
|
105459
|
-
const debounceMs = options?.debounceMs ?? EVENT_INVALIDATION_COALESCE_MS;
|
|
105460
|
-
const safetyNetMs = options?.safetyNetMs;
|
|
105461
|
-
const initial = options?.initial !== false;
|
|
105462
|
-
const keyShape = options?.keyShape ?? "trpc";
|
|
105463
|
-
const paused = options?.paused === true;
|
|
105464
|
-
const enabled = options?.enabled !== false;
|
|
105465
|
-
const [tick, setTick] = (0, react$1.useState)(system.connectionVersion);
|
|
105466
|
-
(0, react$1.useEffect)(() => {
|
|
105467
|
-
return system.subscribeConnectionEvents((state, version) => {
|
|
105468
|
-
if (state === "connected") setTick(version);
|
|
105469
|
-
});
|
|
105470
|
-
}, [system]);
|
|
105471
|
-
const key = categories.join("|");
|
|
105472
|
-
const keyJson = JSON.stringify(queryKey);
|
|
105473
|
-
const inputJson = options?.input === void 0 ? void 0 : JSON.stringify(options.input);
|
|
105474
|
-
const pausedRef = (0, react$1.useRef)(paused);
|
|
105475
|
-
pausedRef.current = paused;
|
|
105476
|
-
const owedRef = (0, react$1.useRef)(false);
|
|
105477
|
-
const [pending, setPending] = (0, react$1.useState)(false);
|
|
105478
|
-
const invalidateNow = (0, react$1.useCallback)(() => {
|
|
105479
|
-
owedRef.current = false;
|
|
105480
|
-
setPending(false);
|
|
105481
|
-
queryClient.invalidateQueries({ queryKey: buildQueryKey(keyJson, inputJson, keyShape) });
|
|
105482
|
-
}, [
|
|
105483
|
-
queryClient,
|
|
105484
|
-
keyJson,
|
|
105485
|
-
inputJson,
|
|
105486
|
-
keyShape
|
|
105487
|
-
]);
|
|
105488
|
-
/** Invalidate, unless nobody is looking or the caller asked to wait. */
|
|
105489
|
-
const apply = (0, react$1.useCallback)(() => {
|
|
105490
|
-
if (isDocumentHidden()) {
|
|
105491
|
-
owedRef.current = true;
|
|
105492
|
-
return;
|
|
105493
|
-
}
|
|
105494
|
-
if (pausedRef.current) {
|
|
105495
|
-
owedRef.current = true;
|
|
105496
|
-
setPending(true);
|
|
105497
|
-
return;
|
|
105498
|
-
}
|
|
105499
|
-
invalidateNow();
|
|
105500
|
-
}, [invalidateNow]);
|
|
105501
|
-
(0, react$1.useEffect)(() => {
|
|
105502
|
-
if (!enabled) return void 0;
|
|
105503
|
-
const subs = [];
|
|
105504
|
-
let openWindow = null;
|
|
105505
|
-
const onEvent = (event) => {
|
|
105506
|
-
if (deviceId !== void 0) {
|
|
105507
|
-
const about = eventDeviceId(event);
|
|
105508
|
-
if (about !== void 0 && about !== deviceId) return;
|
|
105509
|
-
}
|
|
105510
|
-
if (openWindow !== null) return;
|
|
105511
|
-
openWindow = setTimeout(() => {
|
|
105512
|
-
openWindow = null;
|
|
105513
|
-
apply();
|
|
105514
|
-
}, debounceMs);
|
|
105515
|
-
};
|
|
105516
|
-
if (initial) invalidateNow();
|
|
105517
|
-
for (const category of key.split("|")) {
|
|
105518
|
-
if (!category) continue;
|
|
105519
|
-
try {
|
|
105520
|
-
subs.push(system.subscribeEvent(category, onEvent));
|
|
105521
|
-
} catch {}
|
|
105522
|
-
}
|
|
105523
|
-
const safetyNet = safetyNetMs !== void 0 && safetyNetMs > 0 ? setInterval(apply, safetyNetMs) : null;
|
|
105524
|
-
const onVisibility = () => {
|
|
105525
|
-
if (!isDocumentHidden() && owedRef.current) apply();
|
|
105526
|
-
};
|
|
105527
|
-
const visibilityTarget = typeof document === "undefined" ? null : document;
|
|
105528
|
-
visibilityTarget?.addEventListener("visibilitychange", onVisibility);
|
|
105529
|
-
return () => {
|
|
105530
|
-
if (openWindow !== null) clearTimeout(openWindow);
|
|
105531
|
-
if (safetyNet !== null) clearInterval(safetyNet);
|
|
105532
|
-
visibilityTarget?.removeEventListener("visibilitychange", onVisibility);
|
|
105533
|
-
for (const unsub of subs) unsub();
|
|
105534
|
-
};
|
|
105535
|
-
}, [
|
|
105536
|
-
system,
|
|
105537
|
-
key,
|
|
105538
|
-
tick,
|
|
105539
|
-
deviceId,
|
|
105540
|
-
debounceMs,
|
|
105541
|
-
safetyNetMs,
|
|
105542
|
-
initial,
|
|
105543
|
-
enabled,
|
|
105544
|
-
apply,
|
|
105545
|
-
invalidateNow
|
|
105546
|
-
]);
|
|
105547
|
-
(0, react$1.useEffect)(() => {
|
|
105548
|
-
if (!paused && owedRef.current) apply();
|
|
105549
|
-
}, [paused, apply]);
|
|
105550
|
-
return {
|
|
105551
|
-
pending,
|
|
105552
|
-
refreshNow: invalidateNow
|
|
105553
|
-
};
|
|
105554
|
-
}
|
|
105555
|
-
//#endregion
|
|
105556
105733
|
//#region src/hooks/use-collapsed-sections.ts
|
|
105557
105734
|
function readStored(storageKey) {
|
|
105558
105735
|
try {
|
|
@@ -105675,6 +105852,15 @@ function useBrokerInstances(filter = {}, opts = {}) {
|
|
|
105675
105852
|
refetchInterval: POLL_INTERVAL_MS,
|
|
105676
105853
|
enabled
|
|
105677
105854
|
});
|
|
105855
|
+
useEventInvalidation(LIST_CAPABILITY_PROVIDERS_PATH, CAPABILITY_PROVIDER_EVENTS, {
|
|
105856
|
+
initial: false,
|
|
105857
|
+
enabled
|
|
105858
|
+
});
|
|
105859
|
+
useEventInvalidation([BROKER_INSTANCES_QUERY_KEY], INSTANCE_LIST_EVENTS, {
|
|
105860
|
+
initial: false,
|
|
105861
|
+
keyShape: "raw",
|
|
105862
|
+
enabled
|
|
105863
|
+
});
|
|
105678
105864
|
const queries = (0, _tanstack_react_query.useQueries)({ queries: (0, react$1.useMemo)(() => {
|
|
105679
105865
|
const holding = new Set((holders.data ?? []).map((p) => p.addonId));
|
|
105680
105866
|
return (brokerProviders.data ?? []).map((p) => p.addonId).filter((id) => holding.has(id));
|
|
@@ -105931,6 +106117,7 @@ var SceneMonitorEditor = (0, react$1.lazy)(() => Promise.resolve().then(() => re
|
|
|
105931
106117
|
/** Lazy-wrapped `PrivacyMaskSettings` — code-split off the main bundle. */
|
|
105932
106118
|
var PrivacyMaskSettings = (0, react$1.lazy)(() => Promise.resolve().then(() => require("./PrivacyMaskSettings-BLM8OfT5.cjs")).then((m) => ({ default: m.PrivacyMaskSettings })));
|
|
105933
106119
|
//#endregion
|
|
106120
|
+
exports.ADDONS_LIST_PATH = ADDONS_LIST_PATH;
|
|
105934
106121
|
exports.ALARM_DISARMED = ALARM_DISARMED;
|
|
105935
106122
|
exports.AMBIENT_LAYERS = AMBIENT_LAYERS;
|
|
105936
106123
|
exports.ANEMOMETER_REVS_PER_MPS = ANEMOMETER_REVS_PER_MPS;
|
|
@@ -106023,6 +106210,7 @@ exports.Button = Button;
|
|
|
106023
106210
|
exports.ButtonCard = ButtonCard;
|
|
106024
106211
|
exports.ButtonGroup = ButtonGroup;
|
|
106025
106212
|
exports.ButtonHeroCard = ButtonHeroCard;
|
|
106213
|
+
exports.CAPABILITY_PROVIDER_EVENTS = CAPABILITY_PROVIDER_EVENTS;
|
|
106026
106214
|
exports.CAP_INSTANCES_QUERY_KEY = CAP_INSTANCES_QUERY_KEY;
|
|
106027
106215
|
exports.CARD_GLYPHS = CARD_GLYPHS;
|
|
106028
106216
|
exports.CARD_ICONS = CARD_ICONS;
|
|
@@ -106314,7 +106502,11 @@ exports.FILL = FILL;
|
|
|
106314
106502
|
exports.FLEET_LIST_GC_TIME_MS = FLEET_LIST_GC_TIME_MS;
|
|
106315
106503
|
exports.FLEET_LIST_QUERY_KEY = FLEET_LIST_QUERY_KEY;
|
|
106316
106504
|
exports.FLEET_LIST_STALE_TIME_MS = FLEET_LIST_STALE_TIME_MS;
|
|
106505
|
+
exports.FORM_DESCRIPTION_MEASURE = FORM_DESCRIPTION_MEASURE;
|
|
106506
|
+
exports.FORM_GRID_GAP = FORM_GRID_GAP;
|
|
106507
|
+
exports.FORM_GRID_TIERS = FORM_GRID_TIERS;
|
|
106317
106508
|
exports.FORM_OPEN_ROUTER_STATE = FORM_OPEN_ROUTER_STATE;
|
|
106509
|
+
exports.FORM_SECTIONS_GAP = FORM_SECTIONS_GAP;
|
|
106318
106510
|
exports.FOUNTAIN_LOW_PERCENT = FOUNTAIN_LOW_PERCENT;
|
|
106319
106511
|
exports.Fan = Fan;
|
|
106320
106512
|
exports.FanCard = FanCard;
|
|
@@ -106332,6 +106524,7 @@ exports.FloatingEventStream = FloatingEventStream;
|
|
|
106332
106524
|
exports.FloatingLogStream = FloatingLogStream;
|
|
106333
106525
|
exports.FloatingPanel = FloatingPanel;
|
|
106334
106526
|
exports.Footprints = Footprints;
|
|
106527
|
+
exports.FormColumnsContext = FormColumnsContext;
|
|
106335
106528
|
exports.FormField = FormField$1;
|
|
106336
106529
|
exports.FormSaveBar = FormSaveBar;
|
|
106337
106530
|
exports.Funnel = Funnel;
|
|
@@ -106395,6 +106588,7 @@ exports.HumidifierHeroCard = HumidifierHeroCard;
|
|
|
106395
106588
|
exports.HumidifierInlineControl = HumidifierInlineControl;
|
|
106396
106589
|
exports.INPUT_COMPACT = INPUT_COMPACT;
|
|
106397
106590
|
exports.INPUT_SHELL = INPUT_SHELL;
|
|
106591
|
+
exports.INSTANCE_LIST_EVENTS = INSTANCE_LIST_EVENTS;
|
|
106398
106592
|
exports.IR_PROBE_IDLE = IR_PROBE_IDLE;
|
|
106399
106593
|
exports.IR_UNKNOWN = IR_UNKNOWN;
|
|
106400
106594
|
exports.IconAction = IconAction;
|
|
@@ -106423,6 +106617,7 @@ exports.LIGHT_PALETTE = LIGHT_PALETTE;
|
|
|
106423
106617
|
exports.LIGHT_WHITE_MAX_K = LIGHT_WHITE_MAX_K;
|
|
106424
106618
|
exports.LIGHT_WHITE_MIN_K = LIGHT_WHITE_MIN_K;
|
|
106425
106619
|
exports.LIGHT_WHITE_STEP_K = LIGHT_WHITE_STEP_K;
|
|
106620
|
+
exports.LIST_CAPABILITY_PROVIDERS_PATH = LIST_CAPABILITY_PROVIDERS_PATH;
|
|
106426
106621
|
exports.LIST_ROW = LIST_ROW;
|
|
106427
106622
|
exports.LIVE_REFRESH_SAFETY_NET_MS = LIVE_REFRESH_SAFETY_NET_MS;
|
|
106428
106623
|
exports.LQI_TONE_STROKE = LQI_TONE_STROKE;
|
|
@@ -106705,6 +106900,7 @@ exports.SensorValueAtom = SensorValueAtom;
|
|
|
106705
106900
|
exports.Separator = Separator;
|
|
106706
106901
|
exports.Server = Server;
|
|
106707
106902
|
exports.SettingRow = SettingRow;
|
|
106903
|
+
exports.SettingRows = SettingRows;
|
|
106708
106904
|
exports.Settings = Settings;
|
|
106709
106905
|
exports.Settings2 = Settings2;
|
|
106710
106906
|
exports.Share2 = Share2;
|
|
@@ -107093,6 +107289,7 @@ exports.fanPresetChoice = fanPresetChoice;
|
|
|
107093
107289
|
exports.fanPresetFailure = fanPresetFailure;
|
|
107094
107290
|
exports.fanSliceModel = fanSliceModel;
|
|
107095
107291
|
exports.fieldAccepts = fieldAccepts;
|
|
107292
|
+
exports.fieldSpan = fieldSpan;
|
|
107096
107293
|
exports.filterByTags = filterByTags;
|
|
107097
107294
|
exports.filterDataTableRows = filterDataTableRows;
|
|
107098
107295
|
exports.filterDeviceOptions = filterDeviceOptions;
|
|
@@ -107108,6 +107305,10 @@ exports.flattenPickerRows = flattenPickerRows;
|
|
|
107108
107305
|
exports.fleetViewOf = fleetViewOf;
|
|
107109
107306
|
exports.foldDeviceName = foldDeviceName;
|
|
107110
107307
|
exports.followTagRename = followTagRename;
|
|
107308
|
+
exports.formGridClass = formGridClass;
|
|
107309
|
+
exports.formGridClassWithGap = formGridClassWithGap;
|
|
107310
|
+
exports.formSpanClass = formSpanClass;
|
|
107311
|
+
exports.formTracks = formTracks;
|
|
107111
107312
|
exports.formatChartBytes = formatChartBytes;
|
|
107112
107313
|
exports.formatChartNumber = formatChartNumber;
|
|
107113
107314
|
exports.formatChartValue = formatChartValue;
|
|
@@ -108090,6 +108291,7 @@ exports.useFanPresetsGetPresets = useFanPresetsGetPresets;
|
|
|
108090
108291
|
exports.useFanPresetsSetPresets = useFanPresetsSetPresets;
|
|
108091
108292
|
exports.useFeatureProbeGetStatus = useFeatureProbeGetStatus;
|
|
108092
108293
|
exports.useFloodGetStatus = useFloodGetStatus;
|
|
108294
|
+
exports.useFormColumns = useFormColumns;
|
|
108093
108295
|
exports.useGasGetStatus = useGasGetStatus;
|
|
108094
108296
|
exports.useGroupActiveGetStatus = useGroupActiveGetStatus;
|
|
108095
108297
|
exports.useGroupCommandsGetStatus = useGroupCommandsGetStatus;
|