@floless/app 0.113.7 → 0.114.0

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.
@@ -54472,7 +54472,7 @@ function appVersion() {
54472
54472
  return resolveVersion({
54473
54473
  isSea: isSea2(),
54474
54474
  sqVersionXml: readSqVersionXml(),
54475
- define: true ? "0.113.7" : void 0,
54475
+ define: true ? "0.114.0" : void 0,
54476
54476
  pkgVersion: readPkgVersion()
54477
54477
  });
54478
54478
  }
@@ -54488,7 +54488,7 @@ function resolveChannel(s) {
54488
54488
  function appChannel() {
54489
54489
  return resolveChannel({
54490
54490
  isSea: isSea2(),
54491
- define: true ? "0.113.7" : void 0,
54491
+ define: true ? "0.114.0" : void 0,
54492
54492
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
54493
54493
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
54494
54494
  modulePath: process.argv[1]
@@ -74634,29 +74634,37 @@ foreach ($row in [AwareHostRects]::Collect()) {
74634
74634
  }
74635
74635
  [Console]::Out.Write((ConvertTo-Json -Compress @($out)))
74636
74636
  `.trim();
74637
- async function runningKnownHosts(deps = DEFAULT_DEPS2) {
74638
- if (deps.platform !== "win32") return [];
74637
+ async function scanRunningKnownHosts(deps = DEFAULT_DEPS2) {
74638
+ if (deps.platform !== "win32") return { scanned: false, hosts: [] };
74639
74639
  let stdout;
74640
74640
  try {
74641
74641
  stdout = await deps.runPowerShell(
74642
- "[Console]::Out.Write((Get-Process -ErrorAction SilentlyContinue | Select-Object -ExpandProperty ProcessName | ConvertTo-Json -Compress))"
74642
+ "$ErrorActionPreference='Stop'; $n = @(Get-Process | Select-Object -ExpandProperty ProcessName); [Console]::Out.Write((ConvertTo-Json -Compress -InputObject @{ ok = $true; names = $n }))"
74643
74643
  );
74644
74644
  } catch {
74645
- return [];
74645
+ return { scanned: false, hosts: [] };
74646
74646
  }
74647
- let names;
74647
+ let envelope;
74648
74648
  try {
74649
- names = JSON.parse(stdout.trim() || "[]");
74649
+ envelope = JSON.parse(stdout.trim() || "null");
74650
74650
  } catch {
74651
- return [];
74651
+ return { scanned: false, hosts: [] };
74652
74652
  }
74653
- const list = Array.isArray(names) ? names : typeof names === "string" ? [names] : [];
74653
+ if (!envelope || typeof envelope !== "object" || envelope.ok !== true) {
74654
+ return { scanned: false, hosts: [] };
74655
+ }
74656
+ const names = envelope.names;
74657
+ if (!Array.isArray(names) && typeof names !== "string") return { scanned: false, hosts: [] };
74658
+ const list = Array.isArray(names) ? names : [names];
74654
74659
  const found = /* @__PURE__ */ new Set();
74655
74660
  for (const raw of list) {
74656
74661
  const host = hostForProcessName(typeof raw === "string" ? raw : null);
74657
74662
  if (host) found.add(host);
74658
74663
  }
74659
- return [...found];
74664
+ return { scanned: true, hosts: [...found] };
74665
+ }
74666
+ async function runningKnownHosts(deps = DEFAULT_DEPS2) {
74667
+ return (await scanRunningKnownHosts(deps)).hosts;
74660
74668
  }
74661
74669
  async function resolveHostAtPoint(cssX, cssY, dpr, probe) {
74662
74670
  let hit = { probed: false, host: null, processName: null, pid: null };
@@ -76170,6 +76178,12 @@ var AWARE_ROUTES = [
76170
76178
  "/api/run",
76171
76179
  "/api/debug",
76172
76180
  "/api/tekla-readiness",
76181
+ // Mirrors /api/tekla-readiness for Revit/SketchUp/Rhino — `hostReadiness` shells the host's
76182
+ // sidecar `list-instances` through the AWARE lifecycle gate, so a half-installed runtime must
76183
+ // stop it here. NB the sibling `/api/hosts/running` is deliberately NOT listed: it only reads the
76184
+ // OS process table, spawns nothing, and stays answerable during bootstrap. The two paths do not
76185
+ // prefix-collide ("/api/hosts/running" does not start with "/api/host-readiness").
76186
+ "/api/host-readiness",
76173
76187
  // Mirrors /api/tekla-readiness. `/api/render/readiness` shells `aware agent list` and fires
76174
76188
  // automatically on every Exports-tab open — not only on a deliberate click — and
76175
76189
  // `/api/render/install-agent` shells `aware agent install`. Both must wait for bootstrap.
@@ -80625,6 +80639,29 @@ async function startServer() {
80625
80639
  return reply.status(502).send({ ok: false, error: error instanceof Error ? error.message : "could not install the Tekla bridge" });
80626
80640
  }
80627
80641
  });
80642
+ app.get("/api/hosts/running", async () => ({ ok: true, ...await scanRunningKnownHosts() }));
80643
+ app.get("/api/host-readiness/:host", async (req, reply) => {
80644
+ const { host } = req.params;
80645
+ if (!isGenericBakeHost(host)) {
80646
+ return reply.status(404).send({ ok: false, error: `no bake target called "${host}"` });
80647
+ }
80648
+ return { ok: true, readiness: await hostReadiness(host) };
80649
+ });
80650
+ app.post("/api/host-readiness/:host/setup", async (req, reply) => {
80651
+ const { host } = req.params;
80652
+ if (!isGenericBakeHost(host)) {
80653
+ return reply.status(404).send({ ok: false, error: `no bake target called "${host}"` });
80654
+ }
80655
+ try {
80656
+ await aware.sidecarInstall(host);
80657
+ return { ok: true, readiness: await hostReadiness(host) };
80658
+ } catch (error) {
80659
+ return reply.status(502).send({
80660
+ ok: false,
80661
+ error: error instanceof Error ? error.message : `could not install the ${host} bridge`
80662
+ });
80663
+ }
80664
+ });
80628
80665
  app.get("/api/aisc-shapes", async () => ({ ok: true, shapes: Object.keys(aisc_shapes_default), bf: aisc_shapes_default, sections: SECTION_DIMS_IN }));
80629
80666
  app.get("/api/workflows/updates", async () => {
80630
80667
  const apps = await aware.list();
package/dist/web/app.css CHANGED
@@ -1346,6 +1346,47 @@
1346
1346
  .fm-note::-webkit-scrollbar { width:9px; height:9px; }
1347
1347
  .fm-note::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:5px; }
1348
1348
  .fm-note::-webkit-scrollbar-track { background:transparent; }
1349
+ /* ── formModal `type:'checklist'` — rows that each carry their own state ──────────────────
1350
+ Names a SET of checkboxes, so it is a group label rather than a <label for>; styled to match
1351
+ .modal-field label exactly so the two read as one vocabulary. */
1352
+ .fm-group-label {
1353
+ display:block; margin-bottom:6px; color:var(--text-muted); font-size:10px;
1354
+ text-transform:uppercase; letter-spacing:0.14em;
1355
+ }
1356
+ .fm-checklist { display:flex; flex-direction:column; gap:8px; }
1357
+ /* `compact`: every row is one line (no status, no fix button), so they flow in columns rather
1358
+ than one tall stack — seven render viewpoints become four rows instead of seven. auto-fill
1359
+ rather than a fixed count so the same field still reads on a narrow window. */
1360
+ .fm-checklist.compact { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:6px; }
1361
+ .fm-checklist.compact .fm-check-row { align-items:center; padding:7px 10px; }
1362
+ .fm-check-row {
1363
+ display:grid; grid-template-columns:auto 1fr; gap:2px 9px; align-items:start;
1364
+ background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:9px 11px;
1365
+ }
1366
+ .fm-check-row.on { border-color:var(--accent-dim); }
1367
+ .fm-check-row input[type="checkbox"] { width:13px; height:13px; margin:2px 0 0; accent-color:var(--accent); }
1368
+ /* Dimmed, but NOT natively disabled — the row stays tabbable so the reason beside it is
1369
+ reachable. Opacity is on the box alone; the reason text must keep its full contrast. */
1370
+ .fm-check-row.off input[type="checkbox"] { opacity:.4; cursor:not-allowed; }
1371
+ /* Beats `.modal-field label`, which is the uppercase field-caption treatment — this is a
1372
+ control's own name and must read as ordinary text. */
1373
+ .modal-field .fm-check-name {
1374
+ display:block; margin:0; font:600 12px/1.35 var(--ui); color:var(--text);
1375
+ text-transform:none; letter-spacing:normal; cursor:pointer;
1376
+ }
1377
+ .modal-field .fm-check-row.off .fm-check-name { color:var(--text-muted); }
1378
+ .fm-check-why { grid-column:2; display:block; font-size:11px; line-height:1.45; }
1379
+ .fm-check-why.ready { color:var(--ok); }
1380
+ .fm-check-why.blocked { color:var(--warn); }
1381
+ .fm-check-why.checking { color:var(--text-muted); display:flex; align-items:center; gap:6px; }
1382
+ .fm-check-why .rtn-spinner { width:10px; height:10px; flex:none; }
1383
+ .fm-check-act { grid-column:2; margin-top:5px; }
1384
+ .fm-check-act .e-recovery {
1385
+ padding:3px 7px; border-radius:4px; cursor:pointer; background:transparent;
1386
+ border:1px solid var(--border-strong); color:var(--text-muted); font:500 10.5px/1.3 var(--ui);
1387
+ }
1388
+ .fm-check-act .e-recovery:hover:not(:disabled) { color:var(--text); border-color:var(--accent-dim); background:var(--surface-3); }
1389
+ .fm-check-act .e-recovery:disabled { opacity:.55; cursor:default; }
1349
1390
  .modal.library {
1350
1391
  width: 720px;
1351
1392
  max-height: 82vh;
@@ -3933,7 +3974,10 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
3933
3974
  .ecard .e-fmt { font-size:10.5px; color:var(--text-dim); font-family:var(--mono); }
3934
3975
  .ecard .e-meta { font-size:11px; color:var(--text-muted); display:flex; align-items:center;
3935
3976
  justify-content:space-between; gap:8px; min-height:16px; }
3936
- .ecard .e-meta.e-meta-tekla { align-items:flex-start; flex-direction:column; justify-content:flex-start; }
3977
+ /* Cards that report their own state (CAD send, share link, render) stack their meta rather than
3978
+ spreading it left/right: their content is a status line plus, often, a recovery button or a list
3979
+ of results. Named for the shape, not for Tekla — it serves every self-reporting card now. */
3980
+ .ecard .e-meta.e-meta-stacked { align-items:flex-start; flex-direction:column; justify-content:flex-start; }
3937
3981
  .ecard .e-status { color:var(--text-dim); }
3938
3982
  .ecard .e-readiness { display:inline-flex; align-items:center; gap:6px; line-height:1.45; }
3939
3983
  .ecard .e-readiness.ready { color:var(--ok); }
@@ -3981,6 +4025,16 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
3981
4025
  /* One line per artifact: name left, links right. Two lines each (the previous stacking) doubled a
3982
4026
  list that is already the tallest thing on the card. */
3983
4027
  .ecard .e-render-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
4028
+ /* One entry in that list: the ✓ line, and — only when the send left gaps — what the application
4029
+ could not take, under it. Tighter than the 6px BETWEEN entries, so a receipt reads as belonging
4030
+ to the row above it rather than as another entry. */
4031
+ .ecard .e-render-entry { display:flex; flex-direction:column; gap:4px; }
4032
+ /* A destination that reports gaps is ~77px (tick line, wrapped counts, its own Details button), so
4033
+ two of them already blow past the render list's ~4.5-single-row cap. Raised to hold the common
4034
+ cases — one or two destinations — without hiding a receipt behind a scroll. Three or four still
4035
+ scroll rather than stretching every sibling card in the grid; markScrollable gives the list a tab
4036
+ stop exactly when it does. */
4037
+ .ecard .e-renders.e-sent-list { max-height:166px; }
3984
4038
  /* The render preview. Mirrors the .fm-thumb / .req-thumb frame recipe (1px strong border, dark
3985
4039
  inset, object-fit cover) rather than inventing a treatment — this is the first arbitrary-coloured
3986
4040
  imagery in this UI, so the token palette must still own every pixel of chrome around it. No glow,
package/dist/web/aware.js CHANGED
@@ -3066,6 +3066,63 @@
3066
3066
  // END of setup (not here) so a synchronous setup error can't latch it shut for the whole
3067
3067
  // session; done() clears it on every close.
3068
3068
  let _formModalOpen = false;
3069
+
3070
+ /**
3071
+ * Above how many options a themed combo grows a search box. Seven or fewer fit on screen and are
3072
+ * read at a glance; past that, scanning starts to cost more than typing.
3073
+ */
3074
+ const SELECT_SEARCH_MIN = 7;
3075
+
3076
+ /**
3077
+ * Render one `type: 'checklist'` field — a tick-list whose rows each carry their own state.
3078
+ *
3079
+ * An option is `{ value, label, status?: {tone, text}, action?: {label}, pickable? }`:
3080
+ * • `status.tone` — 'ready' | 'blocked' | 'checking'; reuses the .e-readiness colour vocabulary
3081
+ * so a destination row and an Exports card say the same thing in the same green/amber.
3082
+ * • `action` — the one thing that would UNBLOCK this row ("Install the Revit bridge").
3083
+ * • `pickable:false` — cannot be ticked. Rendered `aria-disabled`, never `disabled`, so it
3084
+ * keeps its place in the tab order and `aria-describedby` can hand the reason to a screen
3085
+ * reader. A natively disabled row is one a keyboard user cannot reach OR interrogate.
3086
+ *
3087
+ * The VALUE is a comma-joined list in a hidden [data-fm] input, exactly like `select multiple`,
3088
+ * so collect() and onChange() read it identically to every other field.
3089
+ */
3090
+ function checklistHtml(id, f, val) {
3091
+ const opts = Array.isArray(f.options) ? f.options : [];
3092
+ const wanted = String(val || '').split(',').map((s) => s.trim()).filter(Boolean);
3093
+ // Only a pickable row can start ticked. A remembered choice whose host has since gone down
3094
+ // must not come back pre-selected — that is how a "Send" lands on something unreachable.
3095
+ const on = new Set(opts.filter((o) => o.pickable !== false && wanted.includes(String(o.value))).map((o) => String(o.value)));
3096
+ const rows = opts.map((o) => {
3097
+ const v = String(o.value);
3098
+ const rid = `${id}-${v.replace(/[^a-zA-Z0-9_-]/g, '')}`;
3099
+ const pickable = o.pickable !== false;
3100
+ const ticked = on.has(v);
3101
+ const st = o.status || null;
3102
+ const tone = st ? (st.tone === 'ready' ? 'ready' : st.tone === 'checking' ? 'checking' : 'blocked') : '';
3103
+ const why = st
3104
+ ? `<span class="fm-check-why ${tone}" id="${rid}-why">` +
3105
+ (tone === 'checking' ? '<span class="rtn-spinner" aria-hidden="true"></span>' : '') +
3106
+ `${escapeHtml(st.text)}</span>`
3107
+ : '';
3108
+ const act = o.action
3109
+ ? `<span class="fm-check-act"><button type="button" class="e-recovery" data-cl-act="${escapeAttr(v)}">${escapeHtml(o.action.label)}</button></span>`
3110
+ : '';
3111
+ return `<div class="fm-check-row${ticked ? ' on' : ''}${pickable ? '' : ' off'}" data-cl-row="${escapeAttr(v)}">` +
3112
+ `<input type="checkbox" id="${rid}" data-cl="${escapeAttr(v)}"${ticked ? ' checked' : ''}` +
3113
+ (pickable ? '' : ` aria-disabled="true"${st ? ` aria-describedby="${rid}-why"` : ''}`) + `>` +
3114
+ `<label class="fm-check-name" for="${rid}">${escapeHtml(o.label)}</label>` +
3115
+ why + act +
3116
+ `</div>`;
3117
+ }).join('');
3118
+ // `compact`: rows that carry no status and no fix action are a single line each, so they flow
3119
+ // in columns instead of one tall stack. Seven render viewpoints fit in four rows that way.
3120
+ return `<div class="fm-checklist${f.compact ? ' compact' : ''}" data-fm-checklist="${escapeAttr(f.name)}" role="group" aria-labelledby="${id}-label">` +
3121
+ `<input type="hidden" data-fm="${escapeHtml(f.name)}" value="${escapeAttr([...on].join(','))}">` +
3122
+ rows +
3123
+ `</div>`;
3124
+ }
3125
+
3069
3126
  // `onChange(values) -> string` makes the dialog able to answer a question no static label can:
3070
3127
  // one whose answer DEPENDS on the choices (five viewpoints cost five times one). Its return value
3071
3128
  // becomes the footnote line under the fields. Optional — dialogs that don't pass it are unchanged.
@@ -3094,6 +3151,20 @@
3094
3151
  if (f.type === 'checkbox') {
3095
3152
  return `<label class="modal-check" for="${id}"><input type="checkbox" id="${id}" data-fm-check="${escapeHtml(f.name)}"${f.value ? ' checked' : ''}><span>${escapeHtml(f.label || f.name)}</span></label>`;
3096
3153
  }
3154
+ // A tick-list where each row carries its OWN state and, when it is not pickable, its own
3155
+ // way out. `select multiple` cannot do this: its rows are `role=option`, which may hold no
3156
+ // focusable descendant, so a per-row "Install the bridge" button would be invalid there.
3157
+ //
3158
+ // A row that cannot be picked is `aria-disabled`, NOT `disabled` — a natively disabled
3159
+ // control leaves the tab order, so a keyboard or screen-reader user never reaches it and
3160
+ // never learns WHY it is out. Here they land on it and hear the reason, because the reason
3161
+ // is real text on the row and `aria-describedby` binds the two.
3162
+ if (f.type === 'checklist') {
3163
+ // A group label, not a <label> — it names a set of checkboxes rather than one control,
3164
+ // and an orphan <label for> nothing is exactly the sloppiness a screen reader trips on.
3165
+ return `<div class="modal-field"><div class="fm-group-label" id="${id}-label">${escapeHtml(f.label || f.name)}</div>` +
3166
+ checklistHtml(id, f, val) + `</div>`;
3167
+ }
3097
3168
  if (f.type === 'note') {
3098
3169
  return `<div class="modal-field"><div class="fm-note-label" id="${id}-label">${escapeHtml(f.label || f.name)}</div><pre class="fm-note" id="${id}" role="region" tabindex="0" aria-labelledby="${id}-label">${escapeHtml(val)}</pre></div>`;
3099
3170
  }
@@ -3136,35 +3207,33 @@
3136
3207
  // lives in a hidden [data-fm] input so collect() reads it like any other field;
3137
3208
  // the combo just displays a friendly label and updates that input. Popover flows
3138
3209
  // in-line (not absolute) so it can't be clipped by the modal body's scroll.
3210
+ // Picks exactly ONE. A field that takes several answers is `type:'checklist'` — see the
3211
+ // note there. This control deliberately no longer has a multi mode: it had exactly one
3212
+ // caller (render viewpoints), and keeping a second way to express "pick several" is how
3213
+ // two dialogs in the same app end up looking like two different products.
3139
3214
  const opts = Array.isArray(f.options) ? f.options : [];
3140
- // `multiple` keeps the SAME control — the value is just a comma-joined list, and the
3141
- // popover toggles instead of replacing. Picking several viewpoints in one pass is the
3142
- // reason it exists: rendering them one at a time meant reopening this dialog per angle.
3143
- const multi = !!f.multiple;
3144
- const chosen = multi ? val.split(',').map((s) => s.trim()).filter(Boolean) : [];
3145
- const isOn = (o) => (multi ? chosen.includes(String(o.value)) : String(o.value) === val);
3215
+ const isOn = (o) => String(o.value) === val;
3146
3216
  const sel = opts.find(isOn);
3147
3217
  const disabled = !opts.length;
3148
- const summarise = () => {
3149
- const on = opts.filter(isOn);
3150
- if (!on.length) return f.placeholder || 'Select…';
3151
- if (on.length <= 2) return on.map((o) => o.label).join(', ');
3152
- return `${on.length} selected`;
3153
- };
3218
+ // A search box only earns its place once the list is too long to scan. Offering one over
3219
+ // two choices ("Still image" / "Turntable video") reads as clutter and makes a two-item
3220
+ // decision look like a database lookup. Count-based rather than a per-caller flag, so
3221
+ // every combo gets it right without the caller thinking about it: the one genuinely long
3222
+ // list here (approved projects, unbounded) crosses the threshold on its own.
3223
+ const searchable = opts.length > SELECT_SEARCH_MIN;
3154
3224
  const trigLabel = disabled ? (f.disabledLabel || 'None available')
3155
- : multi ? summarise()
3156
3225
  : sel ? sel.label + (sel.meta ? ` (${sel.meta})` : '') : (f.placeholder || 'Select…');
3157
3226
  const rows = opts.map((o) =>
3158
3227
  `<div class="wf-option${isOn(o) ? ' selected' : ''}" role="option" data-id="${escapeAttr(String(o.value))}" data-search="${escapeAttr(String(o.search || o.label).toLowerCase())}" tabindex="-1" aria-selected="${isOn(o) ? 'true' : 'false'}"><span class="wf-option-name">${escapeHtml(o.label)}</span>${o.meta ? `<span class="wf-option-meta">${escapeHtml(o.meta)}</span>` : ''}</div>`).join('');
3159
- ctl = `<div class="wf-combo fm-select${multi ? ' fm-select-multi' : ''}" data-fm-select="${escapeAttr(f.name)}"${multi ? ' data-multi="1"' : ''}${f.placeholder ? ` data-placeholder="${escapeAttr(f.placeholder)}"` : ''}>
3228
+ ctl = `<div class="wf-combo fm-select" data-fm-select="${escapeAttr(f.name)}"${f.placeholder ? ` data-placeholder="${escapeAttr(f.placeholder)}"` : ''}>
3160
3229
  <input type="hidden" data-fm="${escapeHtml(f.name)}" value="${escapeAttr(val)}">
3161
- <button type="button" class="wf-trigger fm-select-trigger" aria-haspopup="listbox" aria-expanded="false"${multi ? ' aria-multiselectable="true"' : ''}${disabled ? ' disabled' : ''}>
3230
+ <button type="button" class="wf-trigger fm-select-trigger" aria-haspopup="listbox" aria-expanded="false"${disabled ? ' disabled' : ''}>
3162
3231
  <span class="wf-trigger-label fm-select-label"${sel ? '' : ' data-empty="1"'}>${escapeHtml(trigLabel)}</span>
3163
3232
  <svg class="wf-caret" width="10" height="6" viewBox="0 0 10 6" aria-hidden="true"><path fill="currentColor" d="M0 0l5 6 5-6z"/></svg>
3164
3233
  </button>
3165
3234
  <div class="wf-popover fm-select-popover" role="listbox" aria-label="${escapeAttr(f.label || f.name)}" hidden>
3166
- <div class="wf-search-wrap"><input class="wf-search fm-select-search" type="text" placeholder="Search…" autocomplete="off" aria-label="Search"></div>
3167
- <div class="wf-list fm-select-list">${rows}<div class="wf-empty-search" hidden>No matches</div></div>
3235
+ ${searchable ? '<div class="wf-search-wrap"><input class="wf-search fm-select-search" type="text" placeholder="Search…" autocomplete="off" aria-label="Search"></div>' : ''}
3236
+ <div class="wf-list fm-select-list">${rows}${searchable ? '<div class="wf-empty-search" hidden>No matches</div>' : ''}</div>
3168
3237
  </div>${disabled && f.emptyNote ? `<div class="fm-select-note">${f.emptyNote}</div>` : ''}
3169
3238
  </div>`;
3170
3239
  } else {
@@ -3380,6 +3449,85 @@
3380
3449
  // Assigned once collect() exists (below); the combo handlers below only ever CALL it, and
3381
3450
  // they can't run before then because a click is needed to reach them.
3382
3451
  let fireChange = () => {};
3452
+
3453
+ // ── checklist field setup ──────────────────────────────────────────────────────────────
3454
+ // Re-bound after every redraw, because a row's `action` (re-check a host, install a bridge)
3455
+ // replaces the rows it just changed.
3456
+ $body.querySelectorAll('.fm-checklist').forEach((box) => {
3457
+ const f = fields.find((x) => x.name === box.dataset.fmChecklist);
3458
+ if (!f) return;
3459
+ const id = `fm-${f.name}`;
3460
+ const sync = () => {
3461
+ const hidden = box.querySelector('input[type="hidden"][data-fm]');
3462
+ const on = Array.from(box.querySelectorAll('input[data-cl]'))
3463
+ .filter((el) => el.checked && el.getAttribute('aria-disabled') !== 'true')
3464
+ .map((el) => el.dataset.cl);
3465
+ if (hidden) hidden.value = on.join(',');
3466
+ box.querySelectorAll('[data-cl-row]').forEach((row) => {
3467
+ const el = row.querySelector('input[data-cl]');
3468
+ row.classList.toggle('on', !!(el && el.checked));
3469
+ });
3470
+ fireChange();
3471
+ };
3472
+ const bind = () => {
3473
+ box.querySelectorAll('input[data-cl]').forEach((el) => {
3474
+ el.onclick = (e) => {
3475
+ // Refuse the tick, then send the user to the thing that would actually fix it.
3476
+ // Doing nothing at all is the failure this row was built to prevent: the reason is
3477
+ // already on screen (and bound by aria-describedby), so all that is left is to put
3478
+ // focus somewhere useful.
3479
+ if (el.getAttribute('aria-disabled') === 'true') {
3480
+ e.preventDefault();
3481
+ const fix = el.closest('[data-cl-row]').querySelector('[data-cl-act]');
3482
+ if (fix) fix.focus();
3483
+ }
3484
+ };
3485
+ el.onchange = sync;
3486
+ });
3487
+ box.querySelectorAll('[data-cl-act]').forEach((btn) => {
3488
+ btn.onclick = async () => {
3489
+ if (typeof f.onAction !== 'function') return;
3490
+ const value = btn.dataset.clAct;
3491
+ const restore = btn.textContent;
3492
+ btn.disabled = true;
3493
+ btn.textContent = 'Checking…';
3494
+ let next = null;
3495
+ try {
3496
+ next = await f.onAction(value);
3497
+ } catch (err) {
3498
+ console.warn('checklist: onAction failed', err);
3499
+ }
3500
+ // Installing a bridge takes a while, and Esc / Cancel / the backdrop stay live the
3501
+ // whole time. Closing does not DETACH anything — hideModal only drops a class — so the
3502
+ // hazard is subtler than a dead node: `$body` is a shared singleton, so once the next
3503
+ // formModal has rebuilt it, the re-query below binds to a different dialog's checklist
3504
+ // (or finds none and throws), and `sync()` fires an already-resolved dialog's
3505
+ // onChange. Same guard the async file reads use.
3506
+ if (modalClosed) return;
3507
+ // A handler that returns nothing leaves the rows exactly as they were — better than
3508
+ // blanking a list because a probe failed. Only a real answer redraws.
3509
+ if (!Array.isArray(next)) {
3510
+ btn.disabled = false;
3511
+ btn.textContent = restore;
3512
+ return;
3513
+ }
3514
+ f.options = next;
3515
+ const keep = box.querySelector('input[type="hidden"][data-fm]');
3516
+ box.outerHTML = checklistHtml(id, f, keep ? keep.value : '');
3517
+ box = $body.querySelector(`.fm-checklist[data-fm-checklist="${CSS.escape(f.name)}"]`);
3518
+ bind();
3519
+ sync();
3520
+ // The row that was just acted on is where the user's attention is — put focus back
3521
+ // on its equivalent control rather than dumping them at the top of the dialog.
3522
+ const again = box.querySelector(`[data-cl-row="${CSS.escape(value)}"]`);
3523
+ const target = again && (again.querySelector('[data-cl-act]') || again.querySelector('input[data-cl]'));
3524
+ if (target) target.focus();
3525
+ };
3526
+ });
3527
+ };
3528
+ bind();
3529
+ });
3530
+
3383
3531
  $body.querySelectorAll('.fm-select').forEach((box) => {
3384
3532
  const hidden = box.querySelector('input[type="hidden"][data-fm]');
3385
3533
  const trigger = box.querySelector('.fm-select-trigger');
@@ -3407,28 +3555,8 @@
3407
3555
  };
3408
3556
  const open = () => { popover.hidden = false; trigger.classList.add('open'); trigger.setAttribute('aria-expanded', 'true'); if (search) { search.value = ''; filter(''); setTimeout(() => search.focus(), 0); } };
3409
3557
  const close = (focusTrig) => { popover.hidden = true; trigger.classList.remove('open'); trigger.setAttribute('aria-expanded', 'false'); clearHi(); if (focusTrig) trigger.focus(); };
3410
- const multi = box.dataset.multi === '1';
3411
3558
  const nameOf = (o) => { const n = o.querySelector('.wf-option-name'); return n ? n.textContent : o.dataset.id; };
3412
3559
  const choose = (opt) => {
3413
- if (multi) {
3414
- // Toggle, and deliberately DO NOT close — picking three viewpoints should be three
3415
- // clicks, not three round trips through the trigger.
3416
- const on = !opt.classList.contains('selected');
3417
- opt.classList.toggle('selected', on);
3418
- opt.setAttribute('aria-selected', on ? 'true' : 'false');
3419
- const picked = opts().filter((o) => o.classList.contains('selected'));
3420
- if (hidden) hidden.value = picked.map((o) => o.dataset.id).join(',');
3421
- if (label) {
3422
- // The field's own placeholder, not a hardcoded 'Select…' — emptying a multi-select
3423
- // used to replace "Pick one or more" with generic filler the caller never asked for.
3424
- label.textContent = !picked.length ? (box.dataset.placeholder || 'Select…')
3425
- : picked.length <= 2 ? picked.map(nameOf).join(', ')
3426
- : `${picked.length} selected`;
3427
- if (picked.length) label.removeAttribute('data-empty'); else label.setAttribute('data-empty', '1');
3428
- }
3429
- fireChange();
3430
- return;
3431
- }
3432
3560
  if (hidden) hidden.value = opt.dataset.id;
3433
3561
  opts().forEach((o) => { const s = o === opt; o.classList.toggle('selected', s); o.setAttribute('aria-selected', s ? 'true' : 'false'); });
3434
3562
  const mt = opt.querySelector('.wf-option-meta');
@@ -3603,7 +3731,17 @@
3603
3731
  e.preventDefault(); firstFocusable.focus();
3604
3732
  }
3605
3733
  }
3606
- else if (e.key === 'Enter' && !danger && e.target.tagName !== 'TEXTAREA' && !$ok.disabled) { e.preventDefault(); done(collect()); }
3734
+ // Enter commits the form — but ONLY from a control that has no Enter behaviour of its own.
3735
+ // A button's activation IS the default action of this keydown, so preventing it here on the
3736
+ // way up cancels the click: a keyboard user who tabbed to a blocked row's "Install the
3737
+ // bridge" button and pressed Enter did not install anything — they submitted the dialog and
3738
+ // sent the model. Cancel had the same problem, and answered Save. Buttons and checkboxes
3739
+ // handle their own keys; let them.
3740
+ else if (e.key === 'Enter' && !danger && !$ok.disabled
3741
+ && e.target.tagName !== 'TEXTAREA'
3742
+ && e.target.tagName !== 'BUTTON'
3743
+ && e.target.getAttribute('role') !== 'button'
3744
+ && !(e.target.tagName === 'INPUT' && e.target.type === 'checkbox')) { e.preventDefault(); done(collect()); }
3607
3745
  };
3608
3746
  // Setup succeeded and the modal is shown — mark it open now. Setting it here (not
3609
3747
  // before the synchronous setup above) means a setup throw can't latch the guard for