@william_jin/autobrowse 0.8.27 → 0.8.29

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.
@@ -54,7 +54,8 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
54
54
  /* a leaving row or label: out of the flow, fading, while the rest slide up */
55
55
  #list>.gone{position:absolute;left:6px;right:6px;opacity:0;pointer-events:none;transition:opacity .15s}
56
56
  /* §Hub look: the glass is the wall at window size, offset to where each box sits, so a stuck head repaints the panel's own pixels and hides the rows under it; a head at rest stays clear */
57
- .sec{position:sticky;top:0;z-index:1;transition:opacity .15s,transform .2s cubic-bezier(.16,1,.3,1)}
57
+ .sec{position:sticky;top:0;z-index:1;transition:opacity .15s}
58
+ @starting-style{.sec{opacity:0}}
58
59
  .sh{width:100%;display:flex;align-items:center;gap:6px;padding:12px 8px 4px;font-size:11px;font-weight:600;color:var(--mut);border-radius:6px;transition:color .15s}
59
60
  .sh .n{font-weight:500;opacity:.75;font-variant-numeric:tabular-nums}
60
61
  .sh .ic{width:12px;height:12px;margin-left:auto;opacity:0;transition:opacity .15s,transform .15s cubic-bezier(.16,1,.3,1)}
@@ -62,7 +63,7 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
62
63
  .sh[aria-expanded=false] .ic{transform:rotate(-90deg)}
63
64
  .sh:not([aria-expanded]){pointer-events:none}
64
65
  .sh[aria-expanded]:hover{color:var(--fg)}
65
- .row{position:relative;display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:2px 10px;padding:7px 8px;margin-bottom:1px;border-radius:9px;transition:background-color .2s,opacity .15s,transform .2s cubic-bezier(.16,1,.3,1)}
66
+ .row{position:relative;display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:2px 10px;padding:7px 8px;margin-bottom:1px;border-radius:9px;transition:background-color .2s,opacity .15s,box-shadow .2s}
66
67
  /* --rowfill tints the glass; --rowbg is the same colour opaque, for rings cut into the icon */
67
68
  /* the entry fade on first style: a covered window runs no frame callback, and a row made there stayed clear */
68
69
  @starting-style{.row{opacity:0}}
@@ -191,21 +192,8 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
191
192
  #empty .h{font-size:15px;font-weight:600;color:var(--fg)}
192
193
  #empty .s{font-size:12px;max-width:300px;text-align:center;line-height:1.45}
193
194
  #empty code{font:12px ui-monospace,SFMono-Regular,Menlo,monospace;padding:1px 5px;border-radius:5px;background:var(--fill);color:var(--fg)}
194
- /* same sheet as the pane's (viewer.html #sheet) */
195
- #keys{position:absolute;inset:0;z-index:5;display:grid;grid-template-rows:minmax(0,1fr);place-items:start center;padding:56px 16px 16px;background:var(--scrim);opacity:0;pointer-events:none;transition:opacity .12s cubic-bezier(.16,1,.3,1)}
196
- #keys.on{opacity:1;pointer-events:auto;transition-duration:.16s}
197
- #keys .s{width:min(460px,100%);max-height:100%;overflow:auto;overscroll-behavior:contain;padding:18px 18px 16px;border-radius:14px;background:var(--paper);box-shadow:var(--raise),var(--lift);font-size:13px;transform:scale(.97) translateY(-4px);transition:transform .2s cubic-bezier(.16,1,.3,1)}
198
- #keys.on .s{transform:none}
199
- #keys .hd{display:flex;align-items:center;gap:10px;margin-bottom:6px;font-size:14px;font-weight:600}
200
- #keys .hd svg{width:22px;height:22px}
201
- #keys .cl{margin-left:auto;border-radius:6px}
202
- #keys .g{margin:12px 0 4px;color:var(--mut);font-size:11px;font-weight:600}
203
- #keys .r{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:30px}
204
- #keys .r+.r{border-top:1px solid var(--line)}
205
- #keys .k{display:flex;gap:4px;flex:none;align-items:center}
206
- #keys kbd{min-width:22px;height:22px;padding:0 6px;border-radius:6px;font-size:12px}
207
195
  /* biome-ignore lint/complexity/noImportantStyles: reduced motion beats every rule; fades stay, moves go (MO-27) */
208
- @media (prefers-reduced-motion:reduce){*,*::before,*::after{transition-property:opacity,background-color,color,box-shadow!important;animation:none!important}#keys .s{transform:none}}
196
+ @media (prefers-reduced-motion:reduce){*,*::before,*::after{transition-property:opacity,background-color,color,box-shadow!important;animation:none!important}}
209
197
  /* biome-ignore lint/complexity/noImportantStyles: hubMotion off beats every rule, fades too */
210
198
  .still *,.still *::before,.still *::after{transition:none!important;animation:none!important}
211
199
  /* §Sidebar collapse: overrides, after the base rules */
@@ -256,6 +244,99 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
256
244
  #list .row .meta,#list .row .title{transition:opacity .1s}
257
245
  .compacting .row :is(.meta,.job,.flow,.title,.tabs){opacity:0}
258
246
  .compact #list .row :is(.meta,.job,.flow,.title,.tabs){display:none}
247
+ /* Queues (WA-1520): macOS outline groups under the sessions. The disclosure chevron holds the marker column; the state is a capsule on the right, never a dot */
248
+ #list>.q{position:relative;margin-top:8px}
249
+ .q [hidden]{display:none}
250
+ .q .qb{padding:0 0 4px;transition:opacity .15s cubic-bezier(.16,1,.3,1)}
251
+ /* opens like a folded group's rows: a fade in place */
252
+ @starting-style{.q .qb{opacity:0}}
253
+ /* the words select as text (⌘C); heads, capsules and buttons do not */
254
+ .q .qbd{-webkit-user-select:text;user-select:text;cursor:auto}
255
+ :is(.q,.sheet) :is(button,.cap,.qh){-webkit-user-select:none;user-select:none}
256
+ .qf{padding:1px 0 4px}
257
+ .qhd{width:100%;display:grid;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:0 10px;min-height:28px;padding:4px 8px;border-radius:8px;text-align:left;transition:background-color .15s}
258
+ .qhd:hover{background:var(--rowh)}
259
+ .qhd .qcar{justify-self:center;width:12px;height:12px;color:var(--mut);transform:rotate(-90deg);transition:transform .2s cubic-bezier(.4,0,.2,1)}
260
+ .qhd[aria-expanded=true] .qcar{transform:none}
261
+ .qn{font-weight:600;min-width:0;overflow-wrap:anywhere;text-wrap:pretty}
262
+ /* a state capsule: tint and word, one meaning per colour (blue runs, amber waits, grey is old or plain data) */
263
+ .cap{display:inline-flex;align-items:center;justify-self:end;height:18px;padding:0 7px;border-radius:9px;background:var(--fill);color:var(--mut);font-size:11px;font-weight:600;line-height:1;white-space:nowrap;font-variant-numeric:tabular-nums;transition:background-color .2s,color .2s}
264
+ .cap:empty{display:none}
265
+ .cap.run{background:color-mix(in srgb,var(--brand) 14%,transparent);color:var(--brand)}
266
+ .cap.held{background:var(--heldt);color:var(--held)}
267
+ /* open and shut: the body's row track eases between 0fr and 1fr (Finder's outline), the words fade with it */
268
+ .qbw{display:grid;grid-template-rows:1fr;transition:grid-template-rows .22s cubic-bezier(.4,0,.2,1),opacity .18s}
269
+ .qbw.shut{grid-template-rows:0fr;opacity:0}
270
+ .qbw>.qbd{min-height:0;overflow:hidden;padding:0 8px 0 36px}
271
+ .qy{font-size:12px;overflow-wrap:anywhere;margin-top:1px}
272
+ .qy.mut,.qst{color:var(--mut)}
273
+ .qst{font-size:12px;margin-top:1px}
274
+ /* counts: words left, numbers right in one column, so 5 and 91 never run together */
275
+ .qc{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;margin:6px 0 0;font-size:12px}
276
+ .qc dt{color:var(--mut);min-width:0;overflow-wrap:anywhere}
277
+ .qc dd{margin:0;text-align:right;font-weight:500;font-variant-numeric:tabular-nums}
278
+ .qsub{color:var(--mut);font-size:11px;font-weight:600;margin-top:12px}
279
+ .qsub.none{font-size:12px;font-weight:400;margin-top:8px}
280
+ .qi{position:relative;list-style:none;margin:2px 0 0;padding:0}
281
+ .qr{position:relative;margin:0 -8px;padding:5px 8px;border-radius:7px;transition:opacity .15s cubic-bezier(.16,1,.3,1),background-color .15s,box-shadow .2s}
282
+ @starting-style{.qr{opacity:0}}
283
+ .qr.go:hover{background:var(--rowh)}
284
+ .qr.go:focus-visible{outline:2px solid var(--ring);outline-offset:-2px}
285
+ .qr .qt{font-size:12px;font-weight:500;overflow-wrap:anywhere;text-wrap:pretty}
286
+ .qr .qs{color:var(--mut);font-size:12px;overflow-wrap:anywhere}
287
+ .qr .qx{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
288
+ .qr .qx:empty{display:none}
289
+ .qr .qh{display:inline-block;padding:2px 7px;border-radius:9px;background:var(--heldt);color:var(--held);font-size:11px;font-weight:500;overflow-wrap:anywhere}
290
+ .qr .cd{font-variant-numeric:tabular-nums}
291
+ /* a queue row on its way out: out of the flow, fading, while the rest slide up */
292
+ .qr.gone{position:absolute;margin:0;opacity:0;pointer-events:none}
293
+ .qfoot{margin-top:6px}
294
+ .qm{height:24px;padding:0 10px;border-radius:7px;background:var(--btn);font-size:12px;font-weight:500;transition:background-color .15s}
295
+ .qm:hover{background:var(--btnh)}
296
+ /* stale: old data dims; the grey line says since when */
297
+ .qf.old .qbd>:not(.qst){opacity:.7}
298
+ .qf.old .cd{display:none}
299
+ .railrows #list .q .qb{display:none}
300
+ .compact #list .qr .qs{display:none}
301
+ /* a row in flight between sections, or a queue job flying into its run's row: it lifts over the rows it passes (a tile, not text over text) */
302
+ #list .lift{z-index:2;box-shadow:var(--raise)}
303
+ #list .lift:not(.needs){background:var(--paper)}
304
+ /* window sheets (⌘/ keys, the full queue): one per window, centred on both axes over everything (macOS sheet; Raycast's panel). Scrim + scale 0.97 → 1 */
305
+ .sheet{position:fixed;inset:0;z-index:30;display:grid;grid-template-rows:minmax(0,1fr);place-items:center;padding:24px;background:var(--scrim);opacity:0;pointer-events:none;transition:opacity .12s cubic-bezier(.16,1,.3,1)}
306
+ .sheet.on{opacity:1;pointer-events:auto;transition-duration:.16s}
307
+ .sheet>.sht{display:flex;flex-direction:column;width:min(460px,100%);max-height:min(760px,100%);overflow:hidden;border-radius:14px;background:var(--paper);box-shadow:var(--raise),var(--lift);font-size:13px;transform:scale(.97);transition:transform .2s cubic-bezier(.16,1,.3,1)}
308
+ .sheet.on>.sht{transform:none}
309
+ .sheet .sht:focus{outline:none}
310
+ .sheet .hd{display:flex;align-items:center;gap:10px;padding:16px 18px 6px;font-size:14px;font-weight:600}
311
+ .sheet .hd .hdm{width:22px;height:22px}
312
+ .sheet .cl{margin-left:auto;border-radius:6px}
313
+ .sheet .b{min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 18px 16px}
314
+ #keys>.sht{width:min(720px,100%)}
315
+ #keys .b{columns:2 280px;column-gap:28px}
316
+ #keys .grp{break-inside:avoid}
317
+ #keys .g{margin:12px 0 4px;color:var(--mut);font-size:11px;font-weight:600}
318
+ #keys .r{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:30px}
319
+ #keys .r+.r{border-top:1px solid var(--line)}
320
+ #keys .k{display:flex;gap:4px;flex:none;align-items:center;color:var(--mut);font-size:11px}
321
+ #keys kbd{min-width:22px;height:22px;padding:0 6px;border-radius:6px;font-size:12px;color:var(--fg)}
322
+ /* the full queue: name and totals, a filter, every job */
323
+ #qsheet>.sht{width:min(600px,100%);height:min(760px,100%)}
324
+ #qsheet .hd .sub{color:var(--mut);font-size:12px;font-weight:400}
325
+ #qsheet .qsum{display:flex;flex-wrap:wrap;gap:2px 14px;padding:0 18px;color:var(--mut);font-size:12px}
326
+ #qsheet .qsum b{color:var(--fg);font-weight:500;font-variant-numeric:tabular-nums}
327
+ #qsheet .fl{margin:10px 18px 6px;height:30px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:var(--fill);color:var(--fg);font:inherit;font-size:13px;outline:none;-webkit-user-select:text;user-select:text}
328
+ #qsheet .fl:focus-visible{outline:2px solid var(--ring);outline-offset:-1px}
329
+ #qsheet .b{padding:0 10px 10px}
330
+ #qsheet .qi{margin:0}
331
+ #qsheet .qi,#qsheet .qsum{-webkit-user-select:text;user-select:text;cursor:auto}
332
+ #qsheet .qr{margin:0;padding:7px 8px;content-visibility:auto;contain-intrinsic-size:auto 56px}
333
+ #qsheet .qr .qt{font-size:13px}
334
+ /* the sheet is wide: the hold sits right of the job, so rows keep one height and holds scan down one edge */
335
+ #qsheet .qr{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px}
336
+ #qsheet .qr :is(.qt,.qs){grid-column:1}
337
+ #qsheet .qr .qx{grid-column:2;grid-row:1/span 2;align-self:center;justify-content:flex-end;max-width:240px;margin-top:0}
338
+ #qsheet .none{padding:24px 8px;color:var(--mut);text-align:center}
339
+ @media (prefers-reduced-motion:reduce){.sheet>.sht{transform:none}}
259
340
  </style>
260
341
  </head>
261
342
  <body>
@@ -266,7 +347,7 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
266
347
  <span id="segs">
267
348
  <button type="button" class="nb" id="unmax" title="Restore the layout (⌘⇧↩)" tabindex="-1"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><path d="M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"/></svg>Restore</button>
268
349
  <fieldset id="seg" aria-label="Layout">
269
- <button type="button" data-l="focus" title="Focus: one run; ⌘-click rows for more (⌃⌘1)" aria-label="Focus: one run, ⌘-click rows for more" aria-pressed="true"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/></svg></button>
350
+ <button type="button" data-l="focus" title="Focus: one run, or the panes you pick; ⇧-click rows or pane bars for more (⌃⌘1)" aria-label="Focus: one run, or the panes you pick; ⇧-click rows or pane bars for more" aria-pressed="true"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/></svg></button>
270
351
  <button type="button" data-l="grid" title="Grid: up to 9 panes (⌃⌘2)" aria-label="Grid: up to 9 panes" aria-pressed="false"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M8 3v10M2 8h12"/></svg></button>
271
352
  </fieldset></span>
272
353
  <button type="button" class="nb" id="pauseall" title="Pause every agent (⌘⇧P)" disabled>Pause all</button>
@@ -280,10 +361,11 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
280
361
  </nav>
281
362
  <div id="stage" class="single">
282
363
  <div id="empty"><svg viewBox="0 0 100 100" aria-hidden="true"><use href="#mark"/></svg><div class="h">No sessions</div><div class="s"></div></div>
283
- <div id="keys"><div class="s" role="dialog" aria-label="Keyboard shortcuts"><div class="hd"><svg aria-hidden="true" viewBox="0 0 100 100"><use href="#mark"/></svg>Keyboard shortcuts<button type="button" class="cl" id="keysx" title="Close (Esc)" aria-label="Close (Esc)"><kbd>esc</kbd></button></div><div class="g">Hub</div></div></div>
284
364
  </div>
285
365
  </div>
286
366
  <div id="menu" popover role="menu" aria-label="Sidebar actions"></div>
367
+ <div id="keys" class="sheet"><div class="sht" role="dialog" aria-modal="true" aria-label="Keyboard shortcuts" tabindex="-1"><div class="hd"><svg class="hdm" aria-hidden="true" viewBox="0 0 100 100"><use href="#mark"/></svg>Keyboard shortcuts<button type="button" class="cl" id="keysx" title="Close (Esc)" aria-label="Close (Esc)"><kbd>esc</kbd></button></div><div class="b"></div></div></div>
368
+ <div id="qsheet" class="sheet"><div class="sht" role="dialog" aria-modal="true" aria-labelledby="qsheetn" tabindex="-1"><div class="hd"><span id="qsheetn" dir="auto"></span><span class="sub"></span><button type="button" class="cl" id="qsheetx" title="Close (Esc)" aria-label="Close (Esc)"><kbd>esc</kbd></button></div><div class="qsum"></div><input type="search" class="fl" id="qfilter" placeholder="Filter by company, role or reason" aria-label="Filter the queue" autocomplete="off" spellcheck="false"><div class="b"><ol class="qi"></ol><div class="none" hidden></div></div></div></div>
287
369
  <script>
288
370
  'use strict';
289
371
  const $ = (id) => document.getElementById(id);
@@ -320,7 +402,7 @@ const ICON = {
320
402
  const FILLED = new Set(['pause', 'play']);
321
403
  const icon = (n) => `<svg class="ic${FILLED.has(n) ? ' fill' : ''}" viewBox="0 0 16 16" aria-hidden="true">${ICON[n]}</svg>`;
322
404
  /** the hub's keys: this sheet, and a group in each pane's ⌘/ sheet */
323
- const HUB_KEYS = [['Sidebar: full or collapsed', ['⌘', '\\']], ['Focus, Grid', ['⌃', '⌘', '1–2']], ['Focus one more run, or one fewer', ['⌘', 'click']], ['Next pane', ['⌘', '⌥', '←→↑↓']], ['Maximize a pane', ['⌘', '⇧', '↩']], ['Session by row', ['⌘', '⌥', '1–9']], ['Sessions list', ['⌘', '⌥', '0']], ['Own window, dock back', ['⌘', '⇧', 'T']], ['Pause or resume all', ['⌘', '⇧', 'P']]];
405
+ const HUB_KEYS = [['Sidebar: full or collapsed', ['⌘', '\\']], ['Focus, Grid', ['⌃', '⌘', '1–2']], ['Focus one more run, or one fewer', ['⇧', 'click']], ['Pick panes for Focus', ['⇧', 'click a pane bar']], ['Next pane', ['⌘', '⌥', '←→↑↓']], ['Maximize a pane', ['⌘', '⇧', '↩']], ['Session by row', ['⌘', '⌥', '1–9']], ['Sessions list', ['⌘', '⌥', '0']], ['Own window, dock back', ['⌘', '⇧', 'T']], ['Pause or resume all', ['⌘', '⇧', 'P']]];
324
406
  /** the smallest page a pane sizes, CSS px: under it on either side the page keeps this, in the pane's shape, scaled down */
325
407
  const SIZE_MIN = { w: 480, h: 600 };
326
408
 
@@ -355,9 +437,14 @@ function takePrefs(p, first) {
355
437
  }
356
438
  /** into a layout; Focus from Grid keeps the pane in front, alone */
357
439
  function switchLayout(l) {
358
- if (l === 'focus' && layout !== 'focus' && cells[cur]) { cells = [cells[cur]]; cur = 0; }
440
+ if (l === 'focus' && layout !== 'focus' && cells[cur]) {
441
+ const keep = picked?.size ? cells.filter((k) => picked.has(k)) : [cells[cur]];
442
+ cur = Math.max(0, keep.indexOf(cells[cur])); cells = keep; picked = null;
443
+ }
359
444
  layout = l;
360
445
  }
446
+ /** ringed panes: null follows `cur`; a set is the person's pick (⇧/⌘-click a bar; a click on the desk clears it); Focus keeps it */
447
+ let picked = null;
361
448
  /** placed panes, by key (`id`, or `id#own` for a second view of one session) */
362
449
  let cells = [];
363
450
  let cur = 0, max = false, hubOn = false;
@@ -394,6 +481,7 @@ window.hub = {
394
481
  recv(m) {
395
482
  switch (m.t) {
396
483
  case 'all':
484
+ takeFeeds(m.feeds, true);
397
485
  takePrefs(m.prefs, true);
398
486
  paceAll = typeof m.pace === 'number' ? m.pace : null;
399
487
  for (const r of m.rows) put(r);
@@ -405,6 +493,7 @@ window.hub = {
405
493
  case 'show': show(m.id); break;
406
494
  case 'visible': hubOn = !!m.on; fill(); render(); break;
407
495
  case 'prefs': takePrefs(m.prefs, false); fill(); render(); break;
496
+ case 'feeds': takeFeeds(m.feeds, false); break;
408
497
  case 'pace': paceAll = typeof m.k === 'number' ? m.k : null; break;
409
498
  case 'clip': {
410
499
  const p = panes.get(cells[cur]);
@@ -685,7 +774,7 @@ function embedOf(key) {
685
774
  const w = panes.get(key)?.w ?? 0, owns = i >= 0 && !max && first && w > 0;
686
775
  const sizes = i >= 0 && (single || owns);
687
776
  // the viewer knows its stage: under SIZE_MIN on either side it zooms out (no phone layout, no cut form, no bands)
688
- return { t: 'embed', tile: !sizes, zoom: sizes ? SIZE_MIN : 0, bare: !single, on: hubOn && i >= 0 && (!max || i === cur), keys: HUB_KEYS };
777
+ return { t: 'embed', tile: !sizes, zoom: sizes ? SIZE_MIN : 0, bare: !single, on: hubOn && i >= 0 && (!max || i === cur) };
689
778
  }
690
779
 
691
780
  // --- panes -------------------------------------------------------------------------
@@ -707,8 +796,13 @@ function pane(key) {
707
796
  el.firstChild.append(frame);
708
797
  el.querySelector('.ph').addEventListener('click', (e) => {
709
798
  const a = e.target.closest('button')?.dataset.a;
710
- const i = cells.indexOf(key);
799
+ const i = cells.indexOf(key), ringed = cells[cur];
711
800
  if (i >= 0) cur = i;
801
+ // a pick starts from the pane ringed now
802
+ if (!a && (e.shiftKey || e.metaKey)) {
803
+ picked ??= new Set(ringed && ringed !== key ? [ringed] : []);
804
+ if (picked.has(key)) picked.delete(key); else picked.add(key);
805
+ } else picked = null;
712
806
  if (a === 'max') toggleMax();
713
807
  else if (a === 'tear') app({ t: 'tear', id: idOf(key) });
714
808
  else if (a === 'x') { cells = cells.filter((k) => k !== key); render(); }
@@ -733,6 +827,11 @@ function dragPane(el, key) {
733
827
  const ph = el.querySelector('.ph');
734
828
  ph.addEventListener('dragstart', (e) => { e.dataTransfer.setData('text/plain', key); e.dataTransfer.effectAllowed = 'move'; });
735
829
  }
830
+ // the desk between panes: no pane ringed
831
+ stage.addEventListener('pointerdown', (e) => {
832
+ if (e.button !== 0 || e.target.closest('.pane') || picked?.size === 0) return;
833
+ picked = new Set(); render();
834
+ });
736
835
  stage.addEventListener('dragover', (e) => {
737
836
  const t = target(e);
738
837
  for (const p of panes.values()) p.el.classList.toggle('drop', p.el === t?.el);
@@ -773,12 +872,60 @@ function attr(el, k, v) { if (el.getAttribute(k) !== v) el.setAttribute(k, v); }
773
872
  let renderRaf = 0;
774
873
  /** state lines come in bursts (url, title, icon per navigation, per run): one render a frame */
775
874
  function soon() { if (!renderRaf) renderRaf = requestAnimationFrame(() => { renderRaf = 0; render(); }); }
776
- /** each list item's place now, read before any write */
777
- const rowTops = () => new Map(live().map((el) => [el.dataset.k, { top: el.getBoundingClientRect().top, off: el.offsetTop }]));
875
+ // --- list motion (WA-1520): items are tiles; each slides from where it was seen to its new place (FLIP on the WAAPI)
876
+ const MOVE = { id: 'move', duration: 240, easing: 'cubic-bezier(.4,0,.2,1)' }, FAR = 56;
877
+ /** a running move's offset now; laid-out place = seen place − this */
878
+ const dyOf = (el) => (el.getAnimations().some((a) => a.id === 'move') ? new DOMMatrixReadOnly(getComputedStyle(el).transform).m42 : 0);
879
+ /** what moves: list items, and the Queues jobs (against their section, which moves on its own) */
880
+ function movers() {
881
+ const q = list.querySelector(':scope>.q:not(.gone)');
882
+ return [...slid(), ...(q ? q.querySelectorAll('.qr:not(.gone)') : [])];
883
+ }
884
+ /** each mover's place now, read before any write: seen (with its move) and laid out (without); queue jobs by id, for the flight to their run */
885
+ function places() {
886
+ const at = new Map(), refs = new Map();
887
+ for (const el of movers()) {
888
+ // not drawn (a shut section): no place to move from
889
+ if (!el.getClientRects().length) continue;
890
+ const top = el.getBoundingClientRect().top;
891
+ at.set(el, { top, lay: top - dyOf(el), off: el.offsetTop });
892
+ if (el.classList.contains('qr') && el.dataset.ref) refs.set(el.dataset.ref, top);
893
+ }
894
+ return { at, refs };
895
+ }
896
+ /** after the DOM change: each item moves from its seen place; a running move retargets only if its own layout changed; a far move lifts over the rest */
897
+ function settle(was) {
898
+ if (!was || !motionOn()) return;
899
+ const els = movers(), now = new Map(els.map((el) => [el, el.getBoundingClientRect().top - dyOf(el)]));
900
+ const q = list.querySelector(':scope>.q:not(.gone)'), q0 = q && was.at.get(q), qy = q && now.get(q);
901
+ const go = [];
902
+ for (const el of els) {
903
+ const w = was.at.get(el), qr = el.classList.contains('qr');
904
+ let d, lift = false;
905
+ if (w) {
906
+ if (qr && !q0) continue;
907
+ const lay = qr ? now.get(el) - qy : now.get(el), wLay = qr ? w.lay - q0.lay : w.lay;
908
+ if (Math.abs(lay - wLay) < 0.5) continue;
909
+ d = (qr ? w.top - q0.top : w.top) - lay;
910
+ } else if (el.dataset.ref && was.refs.has(el.dataset.ref)) {
911
+ d = was.refs.get(el.dataset.ref) - now.get(el); lift = true;
912
+ } else continue;
913
+ if (Math.abs(d) >= 0.5) go.push([el, d, lift || Math.abs(d) > FAR]);
914
+ }
915
+ // reduced motion: no travel; a moved tile fades in at its new place (MO-27)
916
+ if (reduceQ.matches) { for (const [el] of go) el.animate([{ opacity: 0.35 }, { opacity: 1 }], { duration: 150, easing: 'cubic-bezier(.16,1,.3,1)' }); return; }
917
+ for (const [el, d, lift] of go) {
918
+ for (const a of el.getAnimations()) if (a.id === 'move') a.cancel();
919
+ el.classList.toggle('lift', lift);
920
+ const a = el.animate([{ transform: `translateY(${d}px)` }, { transform: 'none' }], MOVE);
921
+ a.onfinish = a.oncancel = () => { if (!el.getAnimations().some((x) => x.id === 'move' && x.playState === 'running')) el.classList.remove('lift'); };
922
+ }
923
+ }
778
924
  function render() {
779
925
  if (renderRaf) { cancelAnimationFrame(renderRaf); renderRaf = 0; }
780
926
  // reads first: after a frame, layout is clean and they cost nothing
781
- const was = sweepFrom(), rowsWas = rowTops();
927
+ const was = sweepFrom(), rowsWas = places();
928
+ if (picked) for (const k of picked) if (!cells.includes(k)) picked.delete(k);
782
929
  applySide();
783
930
  roomFrom = null;
784
931
  for (const b of $('seg').children) attr(b, 'aria-pressed', String(b.dataset.l === layout));
@@ -821,7 +968,7 @@ function render() {
821
968
  txt(p.el.querySelector('.tt'), p.title || r.state?.title || '');
822
969
  // the bar is one line: the whole name and title on hover
823
970
  attr(p.el.querySelector('.ph'), 'title', `${r.site || 'session'} · ${p.title || r.state?.title || ''}`);
824
- p.el.classList.toggle('cur', i === cur && cells.length > 1);
971
+ p.el.classList.toggle('cur', (picked ? picked.has(cells[i]) : i === cur) && cells.length > 1);
825
972
  const off = p.el.classList.contains('off'), hidden = max && i !== cur, back = off && !hidden;
826
973
  p.el.classList.toggle('off', hidden);
827
974
  if (morph && (back || (hidden && !off))) fade(p, back);
@@ -999,6 +1146,9 @@ function fillRow(el, r, onIds) {
999
1146
  el.classList.toggle('needs', !!r.needs && !r.ended);
1000
1147
  el.classList.toggle('ended', !!r.ended);
1001
1148
  el.classList.toggle('on', onIds.has(r.id) && hubOn);
1149
+ // the queue job this run took (JOB_REF): its tile flies here
1150
+ const ref = typeof r.job?.ref === 'string' ? r.job.ref : '';
1151
+ if ((el.dataset.ref ?? '') !== ref) { if (ref) el.dataset.ref = ref; else delete el.dataset.ref; }
1002
1152
  cls(el.querySelector('.ico .dot'), `dot ${dot}`);
1003
1153
  txt(el.querySelector('.lt'), letterOf(r.site));
1004
1154
  const img = el.querySelector('img'), src = typeof r.state?.icon === 'string' ? r.state.icon : '';
@@ -1121,8 +1271,10 @@ function fillTabs(box, tabs, icons, site, rid) {
1121
1271
  attr(mb, 'aria-expanded', String(!cut));
1122
1272
  }
1123
1273
  /** the list's live items: rows and labels not on their way out */
1124
- const live = () => [...list.children].filter((el) => !el.classList.contains('gone'));
1125
- function renderRows(was = rowTops()) {
1274
+ const live = () => [...list.children].filter((el) => !el.classList.contains('gone') && !el.classList.contains('q'));
1275
+ /** what slides when rows come or go: the rows, and the Queues section under them */
1276
+ const slid = () => [...list.children].filter((el) => !el.classList.contains('gone'));
1277
+ function renderRows(was = places()) {
1126
1278
  const gl = groupList(), groups = new Map(gl.map((g) => [g.k, g.ids]));
1127
1279
  // the list as it should be: a label per non-empty group, then its rows unless folded
1128
1280
  const want = [];
@@ -1138,7 +1290,7 @@ function renderRows(was = rowTops()) {
1138
1290
  const r = rows.get(el.dataset.k);
1139
1291
  // a folded row, or one that already faded (ended): out at once; a label fades out of the flow
1140
1292
  if (el.classList.contains('row') && (el.classList.contains('out') || (r && folded(secOf(r), groups.get(secOf(r))?.length ?? 0)))) { el.remove(); continue; }
1141
- const top = was.get(el.dataset.k)?.off ?? 0;
1293
+ const top = was.at.get(el)?.off ?? 0;
1142
1294
  el.classList.add('gone'); el.style.top = `${top}px`;
1143
1295
  list.append(el);
1144
1296
  setTimeout(() => el.remove(), 150);
@@ -1158,18 +1310,9 @@ function renderRows(was = rowTops()) {
1158
1310
  if (fb) attr(fb, 'aria-expanded', String(!folded(w.sec, w.n)));
1159
1311
  }
1160
1312
  });
1161
- // all reads, then all writes: one layout, not one per moved row
1162
- const moved = [];
1163
- for (const el of live()) {
1164
- const t0 = was.get(el.dataset.k);
1165
- if (t0 === undefined) continue;
1166
- const d = t0.top - el.getBoundingClientRect().top;
1167
- if (d) moved.push([el, d]);
1168
- }
1169
- for (const [el, d] of moved) {
1170
- el.style.transition = 'none'; el.style.transform = `translateY(${d}px)`;
1171
- requestAnimationFrame(() => { el.style.transition = ''; el.style.transform = ''; });
1172
- }
1313
+ // a run that starts takes its job out of the queue: both in one move
1314
+ renderQueues();
1315
+ settle(was);
1173
1316
  $('bar').classList.toggle('off', !rows.size);
1174
1317
  bar();
1175
1318
  }
@@ -1186,7 +1329,7 @@ function bar() {
1186
1329
  list.addEventListener('focusin', bar);
1187
1330
  list.addEventListener('focusout', () => setTimeout(bar));
1188
1331
  list.addEventListener('keydown', (e) => {
1189
- if ((e.key !== 'ArrowDown' && e.key !== 'ArrowUp') || e.metaKey || e.altKey || e.ctrlKey) return;
1332
+ if ((e.key !== 'ArrowDown' && e.key !== 'ArrowUp') || e.metaKey || e.altKey || e.ctrlKey || e.target.closest('.q')) return;
1190
1333
  const all = shown(), at = all.indexOf(e.target.closest('.row'));
1191
1334
  const next = all[at < 0 ? 0 : at + (e.key === 'ArrowDown' ? 1 : -1)];
1192
1335
  e.preventDefault();
@@ -1219,6 +1362,230 @@ setInterval(() => {
1219
1362
  for (const x of list.querySelectorAll('.x[data-next]')) txt(x, `next ${until(Number(x.dataset.next))}`);
1220
1363
  }, 1000);
1221
1364
 
1365
+ // --- Queues (wren designs/2026-12-02-queue-feed.md §4; WA-1520) ---------------------------
1366
+ // Feeds by shape, never by name: `status.state` is a status line, `items` a queue, numbers in `status` or `runs` counts, `labels` their words.
1367
+ /** file stem → feed, as the app last sent it */
1368
+ const feeds = new Map();
1369
+ /** feed versions this page knows; the sidebar shows this many jobs */
1370
+ const FEED_V = 1, NEXT = 5;
1371
+ /** feeds a person shut (Finder's outline: per group, kept) */
1372
+ let qfold = {};
1373
+ try { qfold = JSON.parse(store.get('hub.qfold', '{}')) || {}; } catch {}
1374
+ const nf = new Intl.NumberFormat();
1375
+ /** the app sends every feed on `all`, and only the changed ones after (null = the file went) */
1376
+ function takeFeeds(m, whole) {
1377
+ if (whole) feeds.clear();
1378
+ for (const [k, v] of Object.entries(m && typeof m === 'object' ? m : {})) {
1379
+ if (v && typeof v === 'object') feeds.set(k, v); else feeds.delete(k);
1380
+ }
1381
+ const was = places();
1382
+ renderQueues();
1383
+ settle(was);
1384
+ fillQSheet();
1385
+ }
1386
+ const atOf = (f) => { const t = Date.parse(f.updatedAt); return Number.isFinite(t) ? t : NaN; };
1387
+ /** the hub's rule: stale past 3 × everySec with no write */
1388
+ function staleOf(f, now = Date.now()) {
1389
+ const at = atOf(f), every = Number(f.everySec);
1390
+ return !Number.isFinite(at) || !(every > 0) || now - at > 3 * every * 1000;
1391
+ }
1392
+ function clock(ms) {
1393
+ const d = new Date(ms), t = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' });
1394
+ return d.toDateString() === new Date().toDateString() ? t : `${d.toLocaleDateString([], { month: 'short', day: 'numeric' })} ${t}`;
1395
+ }
1396
+ const counts = (o) => Object.entries(o && typeof o === 'object' ? o : {}).filter(([, n]) => typeof n === 'number' && n > 0);
1397
+ const word = (s) => { const t = String(s ?? '').trim(); return t ? t[0].toLocaleUpperCase() + t.slice(1) : ''; };
1398
+ /** a count's words: the feed's `labels`, else its key */
1399
+ const labelOf = (f, k) => word(f.labels && typeof f.labels === 'object' && typeof f.labels[k] === 'string' && f.labels[k].trim() ? f.labels[k] : k);
1400
+ const nameOf = (f, k) => (typeof f.label === 'string' && f.label.trim() ? f.label.trim() : typeof f.source === 'string' && f.source ? f.source : k);
1401
+ const itemOf = (it) => (it && typeof it === 'object' ? it : { title: String(it) });
1402
+ const linkOf = (it) => (typeof it.url === 'string' && /^https?:\/\//i.test(it.url) ? it.url : '');
1403
+ /** queue item ids with a live run (the run's `JOB_REF`): those show in the sessions, not the queue */
1404
+ const runRefs = () => new Set([...rows.values()].filter((r) => !r.ended && typeof r.job?.ref === 'string').map((r) => r.job.ref));
1405
+ /** a job: name, role line, then its hold or a state worth a word ("queued" is the list itself) */
1406
+ function itemHtml(it, running) {
1407
+ const h = it.hold && typeof it.hold === 'object' ? it.hold : null;
1408
+ const until = h && Date.parse(h.until);
1409
+ const cd = Number.isFinite(until) ? `, <span class="cd" data-until="${until}">${esc(untilWord(until))}</span>` : '';
1410
+ const st = running ? 'running' : typeof it.state === 'string' && !['queued', 'held'].includes(it.state) ? it.state : '';
1411
+ const cap = h ? `<span class="qh">${esc(h.why || 'Held')}${cd}</span>` : st ? `<span class="cap${['running', 'submitting'].includes(st) ? ' run' : ''}">${esc(word(st))}</span>` : '';
1412
+ return `<div class="qt" dir="auto">${esc(it.title || it.id || 'Job')}</div>`
1413
+ + (it.sub ? `<div class="qs" dir="auto">${esc(it.sub)}</div>` : '')
1414
+ + (cap ? `<div class="qx">${cap}</div>` : '');
1415
+ }
1416
+ const untilWord = (ms) => until(ms);
1417
+ /** rows by id: a row that stays keeps its node, a new one fades in, a leaving one fades out of the flow (`still`: ids that leave at once, flying to their run's row) */
1418
+ function keyed(ol, list, still = new Set()) {
1419
+ const old = new Map([...ol.children].filter((el) => !el.classList.contains('gone')).map((el) => [el.dataset.k, el]));
1420
+ const keep = new Set(list.map((it) => it.k));
1421
+ // places first, then writes: a job made absolute shifts the ones under it
1422
+ const out = [...old].filter(([k]) => !keep.has(k)).map(([k, el]) => [k, el, el.offsetTop, el.offsetLeft, el.offsetWidth]);
1423
+ for (const [k, el, top, left, w] of out) {
1424
+ old.delete(k);
1425
+ if (still.has(el.dataset.ref) || !ol.closest('#list')) { el.remove(); continue; }
1426
+ el.classList.add('gone'); el.style.top = `${top}px`; el.style.left = `${left}px`; el.style.width = `${w}px`;
1427
+ setTimeout(() => el.remove(), 150);
1428
+ }
1429
+ const live = () => [...ol.children].filter((el) => !el.classList.contains('gone'));
1430
+ list.forEach((it, i) => {
1431
+ let el = old.get(it.k);
1432
+ if (!el) {
1433
+ el = document.createElement('li'); el.className = 'qr'; el.dataset.k = it.k;
1434
+ if (it.ref) el.dataset.ref = it.ref;
1435
+ }
1436
+ if (el.dataset.h !== it.html) { el.dataset.h = it.html; el.innerHTML = it.html; }
1437
+ el.classList.toggle('go', !!it.url);
1438
+ if (it.url) { el.dataset.url = it.url; attr(el, 'title', `Open the posting: ${it.url}`); el.tabIndex = 0; }
1439
+ else { delete el.dataset.url; el.removeAttribute('title'); el.removeAttribute('tabindex'); }
1440
+ const at = live()[i];
1441
+ if (at !== el) ol.insertBefore(el, at ?? null);
1442
+ });
1443
+ }
1444
+ /** list items for keyed(): ids repeat in a bad feed, so the nth copy gets #n */
1445
+ function itemRows(items, refs) {
1446
+ const seen = new Map();
1447
+ return items.map((raw) => {
1448
+ const o = itemOf(raw);
1449
+ const id = String(o.id ?? o.title ?? ''), n = seen.get(id) ?? 0;
1450
+ seen.set(id, n + 1);
1451
+ return { k: n ? `${id}#${n}` : id, ref: n ? '' : id, url: linkOf(o), html: itemHtml(o, refs.has(id)) };
1452
+ });
1453
+ }
1454
+ /** one feed's block; built once, then filled */
1455
+ function feedEl(k) {
1456
+ const el = document.createElement('div');
1457
+ el.className = 'qf'; el.dataset.f = k;
1458
+ const body = `qbd-${k.replace(/[^\w-]/g, '_')}`;
1459
+ el.innerHTML = `<button type="button" class="qhd" aria-expanded="true" aria-controls="${body}">${icon('caret').replace('class="ic', 'class="ic qcar')}<span class="qn" dir="auto"></span><span class="cap"></span></button>`
1460
+ + `<div class="qbw"><div class="qbd" id="${body}"><div class="qst"></div><div class="qy" dir="auto"></div><dl class="qc"></dl><div class="qsub"></div><ol class="qi"></ol><div class="qfoot"><button type="button" class="qm">View full queue</button></div></div></div>`;
1461
+ el.querySelector('.qhd').addEventListener('click', () => {
1462
+ if (qfold[k]) delete qfold[k]; else qfold[k] = true;
1463
+ store.set('hub.qfold', JSON.stringify(qfold));
1464
+ renderQueues();
1465
+ });
1466
+ el.querySelector('.qm').addEventListener('click', () => qsheet(k));
1467
+ return el;
1468
+ }
1469
+ const show1 = (el, on) => { if (el.hidden === on) el.hidden = !on; };
1470
+ /** the counts as words-and-number pairs */
1471
+ function countsHtml(f) {
1472
+ return [...counts(f.status), ...counts(f.runs)].map(([w, n]) => `<dt>${esc(labelOf(f, w))}</dt><dd>${nf.format(n)}</dd>`).join('');
1473
+ }
1474
+ function fillFeed(el, k, f, now, refs) {
1475
+ const $q = (c) => el.querySelector(c);
1476
+ const bad = typeof f.error === 'string' ? `Unreadable feed file (${f.error})` : f.v !== FEED_V ? `feed v${f.v ?? '?'}: update autobrowse` : '';
1477
+ txt($q('.qn'), typeof f.error === 'string' ? `${k}.json` : nameOf(f, k));
1478
+ const old = !bad && staleOf(f, now);
1479
+ el.classList.toggle('old', old);
1480
+ const st = f.status && typeof f.status === 'object' ? f.status : {};
1481
+ const state = !bad && typeof st.state === 'string' ? st.state : '';
1482
+ const items = !bad && Array.isArray(f.items) ? f.items : null;
1483
+ // the state in a capsule: blue runs, amber waits, grey when old; a queue shows its size
1484
+ const cap = $q('.qhd .cap');
1485
+ cls(cap, `cap${old ? '' : state === 'running' ? ' run' : state ? ' held' : ''}`);
1486
+ swapText(cap, bad ? '' : state ? word(state) : items?.length ? nf.format(items.length) : '');
1487
+ attr(cap, 'title', items && !state ? `${nf.format(items.length)} in the queue` : '');
1488
+ const at = atOf(f);
1489
+ txt($q('.qst'), old ? (Number.isFinite(at) ? `Stale since ${clock(at)}` : 'Stale: no update time') : '');
1490
+ show1($q('.qst'), old);
1491
+ // a status line's reason; a bad feed's one line
1492
+ const given = state && typeof st.why === 'string' ? st.why.trim() : '';
1493
+ const why = bad || given || (state && state !== 'running' ? 'No reason given' : '');
1494
+ txt($q('.qy'), why);
1495
+ $q('.qy').classList.toggle('mut', !!why && !given);
1496
+ show1($q('.qy'), !!why);
1497
+ const ch = bad ? '' : countsHtml(f);
1498
+ if ($q('.qc').dataset.h !== ch) { $q('.qc').dataset.h = ch; $q('.qc').innerHTML = ch; }
1499
+ show1($q('.qc'), !!ch);
1500
+ // next: jobs that can start (no hold), not running yet
1501
+ const next = (items ?? []).filter((it) => { const o = itemOf(it); return !(o.hold && typeof o.hold === 'object') && !refs.has(String(o.id ?? '')); }).slice(0, NEXT);
1502
+ txt($q('.qsub'), !items ? '' : !items.length ? 'The queue is empty' : next.length ? `Next ${next.length}` : 'No job can start now');
1503
+ show1($q('.qsub'), !!items);
1504
+ $q('.qsub').classList.toggle('none', !!items && !next.length);
1505
+ const ol = $q('.qi');
1506
+ keyed(ol, itemRows(next, new Set()), refs);
1507
+ show1(ol, next.length > 0);
1508
+ show1($q('.qfoot'), !!items?.length);
1509
+ const open = !qfold[k], hd = $q('.qhd'), bw = $q('.qbw');
1510
+ attr(hd, 'aria-expanded', String(open));
1511
+ bw.classList.toggle('shut', !open);
1512
+ bw.inert = !open;
1513
+ }
1514
+ /** the Queues section: last in the list, under the sessions; none with no feed */
1515
+ function renderQueues(now = Date.now()) {
1516
+ let q = list.querySelector(':scope>.q');
1517
+ if (!feeds.size) { q?.remove(); return; }
1518
+ if (!q) {
1519
+ q = document.createElement('li');
1520
+ q.className = 'q'; q.dataset.k = 'q';
1521
+ q.innerHTML = `<div class="sec"><button type="button" class="sh" aria-expanded="true"><span class="l">Queues</span><span class="n"></span>${icon('caret')}</button></div><div class="qb" role="region" aria-label="Queues"></div>`;
1522
+ stuckIO.observe(q.querySelector('.sec'));
1523
+ q.querySelector('.sh').addEventListener('click', () => { fold.queues = !fold.queues; store.set('hub.fold', JSON.stringify(fold)); const was = places(); renderQueues(); settle(was); });
1524
+ }
1525
+ if (q.nextElementSibling && !q.nextElementSibling.classList.contains('gone')) list.append(q);
1526
+ else if (!q.isConnected) list.append(q);
1527
+ const open = !fold.queues;
1528
+ attr(q.querySelector('.sh'), 'aria-expanded', String(open));
1529
+ const qb = q.querySelector('.qb');
1530
+ show1(qb, open);
1531
+ if (!open) return;
1532
+ // status lines first (the host), then queues; by name inside each
1533
+ const ks = [...feeds.keys()].sort((a, b) => (Array.isArray(feeds.get(a).items) ? 1 : 0) - (Array.isArray(feeds.get(b).items) ? 1 : 0) || a.localeCompare(b));
1534
+ const have = new Map([...qb.children].map((el) => [el.dataset.f, el]));
1535
+ const refs = runRefs();
1536
+ ks.forEach((k, i) => {
1537
+ const el = have.get(k) ?? feedEl(k);
1538
+ have.delete(k);
1539
+ fillFeed(el, k, feeds.get(k), now, refs);
1540
+ if (qb.children[i] !== el) qb.insertBefore(el, qb.children[i] ?? null);
1541
+ });
1542
+ for (const el of have.values()) el.remove();
1543
+ }
1544
+ // a job with a link opens its posting in the browser; a drag that selected words does not
1545
+ function openJob(e) {
1546
+ const el = e.target.closest('.qr.go');
1547
+ if (!el || (e.type === 'keydown' && (e.key !== 'Enter' || e.target !== el))) return;
1548
+ const sel = getSelection();
1549
+ if (e.type === 'click' && sel && !sel.isCollapsed && el.contains(sel.anchorNode)) return;
1550
+ app({ t: 'open-url', url: el.dataset.url });
1551
+ }
1552
+ for (const el of [list, $('qsheet')]) { el.addEventListener('click', openJob); el.addEventListener('keydown', openJob); }
1553
+ // --- the full queue: a window sheet (WA-1520) ---------------------------------------
1554
+ /** the feed the sheet shows; null = shut */
1555
+ let qsheetOf = null;
1556
+ const qfilterEl = $('qfilter');
1557
+ function qsheet(k) {
1558
+ const was = qsheetOf;
1559
+ qsheetOf = k && feeds.has(k) ? k : null;
1560
+ if (qsheetOf && qsheetOf !== was) qfilterEl.value = '';
1561
+ fillQSheet();
1562
+ showSheet('qsheet', !!qsheetOf, () => list.querySelector(`.qf[data-f="${CSS.escape(was ?? '')}"] .qm`)?.focus({ preventScroll: true }));
1563
+ if (qsheetOf) qfilterEl.focus({ preventScroll: true });
1564
+ }
1565
+ function fillQSheet() {
1566
+ if (!qsheetOf) return;
1567
+ const f = feeds.get(qsheetOf);
1568
+ if (!f || !Array.isArray(f.items)) { qsheet(null); return; }
1569
+ const sh = $('qsheet'), items = f.items, refs = runRefs();
1570
+ txt($('qsheetn'), nameOf(f, qsheetOf));
1571
+ const at = atOf(f), old = staleOf(f);
1572
+ txt(sh.querySelector('.hd .sub'), `${nf.format(items.length)} ${items.length === 1 ? 'job' : 'jobs'}, ${old ? 'stale since' : 'updated'} ${Number.isFinite(at) ? clock(at) : 'never'}`);
1573
+ const sum = counts(f.status).map(([w, n]) => `<span>${esc(labelOf(f, w))} <b>${nf.format(n)}</b></span>`).join('');
1574
+ if (sh.querySelector('.qsum').dataset.h !== sum) { sh.querySelector('.qsum').dataset.h = sum; sh.querySelector('.qsum').innerHTML = sum; }
1575
+ const q = qfilterEl.value.trim().toLocaleLowerCase();
1576
+ const hit = (it) => { const o = itemOf(it); return !q || [o.title, o.sub, o.hold?.why, o.state].some((x) => typeof x === 'string' && x.toLocaleLowerCase().includes(q)); };
1577
+ const shown = itemRows(items, refs).filter((_, i) => hit(items[i]));
1578
+ keyed(sh.querySelector('.qi'), shown);
1579
+ const none = sh.querySelector('.none');
1580
+ txt(none, !items.length ? 'The queue is empty' : `No job matches “${qfilterEl.value.trim()}”`);
1581
+ show1(none, !shown.length);
1582
+ }
1583
+ $('qsheetx').addEventListener('click', () => qsheet(null));
1584
+ qfilterEl.addEventListener('input', fillQSheet);
1585
+ // countdowns each second; stale on its own once-a-minute clock (no file change needed)
1586
+ setInterval(() => { for (const c of document.querySelectorAll('.cd[data-until]')) txt(c, untilWord(Number(c.dataset.until))); }, 1000);
1587
+ setInterval(() => { if (!feeds.size) return; const was = places(); renderQueues(); settle(was); fillQSheet(); }, 60_000);
1588
+
1222
1589
  // --- actions -------------------------------------------------------------------------
1223
1590
  const opening = new Set();
1224
1591
  /** asked with ⌘-click in Focus: placed beside the others when its view comes up */
@@ -1259,6 +1626,7 @@ function show(id, more = false) {
1259
1626
  } else if (at >= 0) cur = at;
1260
1627
  else if (cells.length < CAP[layout]) { cells.push(id); cur = cells.length - 1; }
1261
1628
  else cells[cur] = id;
1629
+ picked = null;
1262
1630
  if (max) max = cells[cur] === id;
1263
1631
  render();
1264
1632
  focusPane();
@@ -1282,7 +1650,7 @@ function move(code) {
1282
1650
  if (ok && d < bd) { bd = d; best = i; }
1283
1651
  });
1284
1652
  if (best < 0) return;
1285
- cur = best;
1653
+ cur = best; picked = null;
1286
1654
  if (max) render();
1287
1655
  render(); focusPane();
1288
1656
  }
@@ -1305,7 +1673,8 @@ addEventListener('keydown', (e) => {
1305
1673
  if (e.metaKey && key({ code: e.code, shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey })) e.preventDefault();
1306
1674
  else if (e.key === 'Escape') {
1307
1675
  if (sizing) endSize(false);
1308
- else if ($('keys').classList.contains('on')) keys(false);
1676
+ else if (sheetOn('keys')) keys(false);
1677
+ else if (sheetOn('qsheet')) qsheet(null);
1309
1678
  else if (peek || pin) { const inside = sidein.contains(document.activeElement); setPeek(false); if (inside) $('sidebtn').focus(); }
1310
1679
  }
1311
1680
  });
@@ -1316,7 +1685,7 @@ addEventListener('message', (e) => {
1316
1685
  const hit = [...panes.entries()].find(([, p]) => p.frame.contentWindow === e.source);
1317
1686
  if (!hit) return;
1318
1687
  const [k, p] = hit;
1319
- if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
1688
+ if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && (i !== cur || picked)) { cur = i; picked = null; render(); } }
1320
1689
  else if (m.t === 'title' && typeof m.text === 'string') { p.title = m.text; p.el.querySelector('.tt').textContent = m.text; const ph = p.el.querySelector('.ph'); ph.title = `${ph.title.split(' · ')[0]} · ${m.text}`; }
1321
1690
  else if (m.t === 'close') { cells = cells.filter((x) => x !== k); render(); }
1322
1691
  else if (m.t === 'page' && m.w > 0 && m.h > 0) {
@@ -1326,6 +1695,7 @@ addEventListener('message', (e) => {
1326
1695
  if (cells.includes(k)) render();
1327
1696
  }
1328
1697
  else if (m.t === 'key') key(m);
1698
+ else if (m.t === 'keys') { if (sheetOn('keys')) keys(false); else { keysFrom = k; keys(true, Array.isArray(m.groups) ? m.groups : []); } }
1329
1699
  });
1330
1700
 
1331
1701
  // --- chrome ----------------------------------------------------------------------------
@@ -1333,23 +1703,59 @@ $('sidebtn').addEventListener('click', () => key({ code: 'Backslash' }));
1333
1703
  for (const b of $('seg').children) b.addEventListener('click', () => setLayout(b.dataset.l));
1334
1704
  $('pauseall').addEventListener('click', () => app({ t: 'pause-all' }));
1335
1705
  $('unmax').addEventListener('click', () => { if (max) toggleMax(); });
1336
- for (const [label, combo] of HUB_KEYS) {
1337
- const r = document.createElement('div'); r.className = 'r';
1338
- const l = document.createElement('span'); l.textContent = label;
1339
- const k = document.createElement('span'); k.className = 'k';
1340
- for (const c of combo) { const b = document.createElement('kbd'); b.textContent = c; k.append(b); }
1341
- r.append(l, k); $('keys').firstElementChild.append(r);
1706
+ // --- window sheets: ⌘/ keys and the full queue, centred in the window (WA-1520) -------------
1707
+ /** the pane whose keys the sheet shows, to hand the keys back to on close */
1708
+ let keysFrom = null, keysWait = 0;
1709
+ /** groups: [[name, [[label, combo, combo…]]]] from the pane; the hub's own group last */
1710
+ function fillKeys(groups) {
1711
+ const b = $('keys').querySelector('.b');
1712
+ b.textContent = '';
1713
+ for (const [name, list] of [...groups, ['Hub', HUB_KEYS]]) {
1714
+ const grp = document.createElement('div'); grp.className = 'grp';
1715
+ const g = document.createElement('div'); g.className = 'g'; g.textContent = String(name); grp.append(g);
1716
+ for (const [label, ...combos] of Array.isArray(list) ? list : []) {
1717
+ const r = document.createElement('div'); r.className = 'r';
1718
+ const l = document.createElement('span'); l.textContent = String(label);
1719
+ const k = document.createElement('span'); k.className = 'k';
1720
+ combos.forEach((combo, i) => {
1721
+ if (i) k.append('or');
1722
+ for (const c of Array.isArray(combo) ? combo : []) { const kb = document.createElement('kbd'); kb.textContent = String(c); k.append(kb); }
1723
+ });
1724
+ r.append(l, k); grp.append(r);
1725
+ }
1726
+ b.append(grp);
1727
+ }
1342
1728
  }
1343
- $('keysx').addEventListener('click', () => keys(false));
1344
- $('keys').addEventListener('mousedown', (e) => { if (e.target === e.currentTarget) keys(false); });
1345
- function keys(on = !$('keys').classList.contains('on')) { $('keys').classList.toggle('on', on); $('keysbtn').setAttribute('aria-expanded', String(on)); }
1729
+ const sheetOn = (id) => $(id).classList.contains('on');
1730
+ /** a sheet takes the keys (Esc reaches the hub, not the page) and gives them back on close */
1731
+ function showSheet(id, on, back) {
1732
+ if (sheetOn(id) === on) return;
1733
+ $(id).classList.toggle('on', on);
1734
+ if (on) { $(id).firstElementChild.focus({ preventScroll: true }); return; }
1735
+ if (back) back();
1736
+ }
1737
+ function keys(on = !sheetOn('keys'), groups = []) {
1738
+ clearTimeout(keysWait); keysWait = 0;
1739
+ if (on) fillKeys(groups);
1740
+ const from = keysFrom;
1741
+ if (!on) keysFrom = null;
1742
+ $('keysbtn').setAttribute('aria-expanded', String(on));
1743
+ showSheet('keys', on, () => { const p = from && panes.get(from); if (p) p.frame.contentWindow?.postMessage({ hub: { t: 'focus' } }, '*'); });
1744
+ }
1745
+ /** one sheet: the current pane sends its groups (its ⌘/ comes here too); a pane that does not answer gets the hub's alone */
1346
1746
  function openKeys() {
1347
- const p = panes.get(cells[cur]);
1348
- // one sheet: the pane's lists its keys and the hub's
1349
- if (p) { keys(false); p.frame.contentWindow?.postMessage({ hub: { t: 'keys' } }, '*'); } else keys();
1747
+ if (sheetOn('keys')) { keys(false); return; }
1748
+ const k = cells[cur], p = panes.get(k);
1749
+ if (!p) { keys(true); return; }
1750
+ keysFrom = k;
1751
+ p.frame.contentWindow?.postMessage({ hub: { t: 'keys' } }, '*');
1752
+ clearTimeout(keysWait);
1753
+ keysWait = setTimeout(() => keys(true), 150);
1350
1754
  }
1755
+ $('keysx').addEventListener('click', () => keys(false));
1351
1756
  $('keysbtn').addEventListener('click', openKeys);
1352
1757
  $('barkeys').addEventListener('click', openKeys);
1758
+ for (const id of ['keys', 'qsheet']) $(id).addEventListener('mousedown', (e) => { if (e.target === e.currentTarget) { if (id === 'keys') keys(false); else qsheet(null); } });
1353
1759
  // the bar drags the window; a double click zooms it
1354
1760
  for (const el of [$('top'), $('drag')]) {
1355
1761
  el.addEventListener('mousedown', (e) => { if (e.target === e.currentTarget && e.button === 0 && e.detail === 1) app({ t: 'drag' }); });