@william_jin/autobrowse 0.8.28 → 0.8.30
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/assets/live-view/hub.html +445 -51
- package/assets/live-view/viewer.html +12 -6
- package/assets/overlay/bin/darwin-arm64/overlay-host +0 -0
- package/assets/overlay/bin/darwin-x64/overlay-host +0 -0
- package/assets/overlay/bin/win32-arm64/overlay-host.exe +0 -0
- package/assets/overlay/bin/win32-x64/overlay-host.exe +0 -0
- package/dist/app/services-state.d.ts +0 -4
- package/dist/app/services-state.js +7 -1
- package/dist/app/services-state.js.map +1 -1
- package/dist/browser/human/index.js +10 -1
- package/dist/browser/human/index.js.map +1 -1
- package/dist/browser/live-hub.d.ts +2 -0
- package/dist/browser/live-hub.js +2 -0
- package/dist/browser/live-hub.js.map +1 -1
- package/dist/llms.txt +1 -1
- package/dist/share/presidio.d.ts +4 -2
- package/dist/share/presidio.js +13 -6
- package/dist/share/presidio.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
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,
|
|
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}
|
|
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>
|
|
@@ -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);
|
|
@@ -399,6 +481,7 @@ window.hub = {
|
|
|
399
481
|
recv(m) {
|
|
400
482
|
switch (m.t) {
|
|
401
483
|
case 'all':
|
|
484
|
+
takeFeeds(m.feeds, true);
|
|
402
485
|
takePrefs(m.prefs, true);
|
|
403
486
|
paceAll = typeof m.pace === 'number' ? m.pace : null;
|
|
404
487
|
for (const r of m.rows) put(r);
|
|
@@ -410,6 +493,7 @@ window.hub = {
|
|
|
410
493
|
case 'show': show(m.id); break;
|
|
411
494
|
case 'visible': hubOn = !!m.on; fill(); render(); break;
|
|
412
495
|
case 'prefs': takePrefs(m.prefs, false); fill(); render(); break;
|
|
496
|
+
case 'feeds': takeFeeds(m.feeds, false); break;
|
|
413
497
|
case 'pace': paceAll = typeof m.k === 'number' ? m.k : null; break;
|
|
414
498
|
case 'clip': {
|
|
415
499
|
const p = panes.get(cells[cur]);
|
|
@@ -690,7 +774,7 @@ function embedOf(key) {
|
|
|
690
774
|
const w = panes.get(key)?.w ?? 0, owns = i >= 0 && !max && first && w > 0;
|
|
691
775
|
const sizes = i >= 0 && (single || owns);
|
|
692
776
|
// the viewer knows its stage: under SIZE_MIN on either side it zooms out (no phone layout, no cut form, no bands)
|
|
693
|
-
return { t: 'embed', tile: !sizes, zoom: sizes ? SIZE_MIN : 0, bare: !single, on: hubOn && i >= 0 && (!max || i === cur)
|
|
777
|
+
return { t: 'embed', tile: !sizes, zoom: sizes ? SIZE_MIN : 0, bare: !single, on: hubOn && i >= 0 && (!max || i === cur) };
|
|
694
778
|
}
|
|
695
779
|
|
|
696
780
|
// --- panes -------------------------------------------------------------------------
|
|
@@ -788,12 +872,59 @@ function attr(el, k, v) { if (el.getAttribute(k) !== v) el.setAttribute(k, v); }
|
|
|
788
872
|
let renderRaf = 0;
|
|
789
873
|
/** state lines come in bursts (url, title, icon per navigation, per run): one render a frame */
|
|
790
874
|
function soon() { if (!renderRaf) renderRaf = requestAnimationFrame(() => { renderRaf = 0; render(); }); }
|
|
791
|
-
|
|
792
|
-
const
|
|
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
|
+
}
|
|
793
924
|
function render() {
|
|
794
925
|
if (renderRaf) { cancelAnimationFrame(renderRaf); renderRaf = 0; }
|
|
795
926
|
// reads first: after a frame, layout is clean and they cost nothing
|
|
796
|
-
const was = sweepFrom(), rowsWas =
|
|
927
|
+
const was = sweepFrom(), rowsWas = places();
|
|
797
928
|
if (picked) for (const k of picked) if (!cells.includes(k)) picked.delete(k);
|
|
798
929
|
applySide();
|
|
799
930
|
roomFrom = null;
|
|
@@ -1015,6 +1146,9 @@ function fillRow(el, r, onIds) {
|
|
|
1015
1146
|
el.classList.toggle('needs', !!r.needs && !r.ended);
|
|
1016
1147
|
el.classList.toggle('ended', !!r.ended);
|
|
1017
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; }
|
|
1018
1152
|
cls(el.querySelector('.ico .dot'), `dot ${dot}`);
|
|
1019
1153
|
txt(el.querySelector('.lt'), letterOf(r.site));
|
|
1020
1154
|
const img = el.querySelector('img'), src = typeof r.state?.icon === 'string' ? r.state.icon : '';
|
|
@@ -1054,7 +1188,9 @@ function fillRow(el, r, onIds) {
|
|
|
1054
1188
|
if (fl.dataset.k !== fk) fl.dataset.k = fk;
|
|
1055
1189
|
txt(el.querySelector('.why'), r.needs && !r.ended ? r.needs : '');
|
|
1056
1190
|
const tl = !r.ended && !r.moved && Array.isArray(r.state?.tabs) && r.state.tabs.length > 1 ? r.state.tabs : [];
|
|
1057
|
-
|
|
1191
|
+
// the job it took (company · role · board) beats the page title
|
|
1192
|
+
const it = ref ? byRef.get(ref) : null, jt = it ? [it.title, it.sub].filter((x) => typeof x === 'string' && x.trim()).join(' · ') : '';
|
|
1193
|
+
txt(el.querySelector('.title'), tl.length ? '' : jt || r.state?.title || '');
|
|
1058
1194
|
fillTabs(el.querySelector('.tabs'), tl, Array.isArray(r.state?.icons) ? r.state.icons : [], r.site, r.id);
|
|
1059
1195
|
const acts = el.querySelector('.acts');
|
|
1060
1196
|
let html = '';
|
|
@@ -1137,8 +1273,10 @@ function fillTabs(box, tabs, icons, site, rid) {
|
|
|
1137
1273
|
attr(mb, 'aria-expanded', String(!cut));
|
|
1138
1274
|
}
|
|
1139
1275
|
/** the list's live items: rows and labels not on their way out */
|
|
1140
|
-
const live = () => [...list.children].filter((el) => !el.classList.contains('gone'));
|
|
1141
|
-
|
|
1276
|
+
const live = () => [...list.children].filter((el) => !el.classList.contains('gone') && !el.classList.contains('q'));
|
|
1277
|
+
/** what slides when rows come or go: the rows, and the Queues section under them */
|
|
1278
|
+
const slid = () => [...list.children].filter((el) => !el.classList.contains('gone'));
|
|
1279
|
+
function renderRows(was = places()) {
|
|
1142
1280
|
const gl = groupList(), groups = new Map(gl.map((g) => [g.k, g.ids]));
|
|
1143
1281
|
// the list as it should be: a label per non-empty group, then its rows unless folded
|
|
1144
1282
|
const want = [];
|
|
@@ -1154,7 +1292,7 @@ function renderRows(was = rowTops()) {
|
|
|
1154
1292
|
const r = rows.get(el.dataset.k);
|
|
1155
1293
|
// a folded row, or one that already faded (ended): out at once; a label fades out of the flow
|
|
1156
1294
|
if (el.classList.contains('row') && (el.classList.contains('out') || (r && folded(secOf(r), groups.get(secOf(r))?.length ?? 0)))) { el.remove(); continue; }
|
|
1157
|
-
const top = was.get(el
|
|
1295
|
+
const top = was.at.get(el)?.off ?? 0;
|
|
1158
1296
|
el.classList.add('gone'); el.style.top = `${top}px`;
|
|
1159
1297
|
list.append(el);
|
|
1160
1298
|
setTimeout(() => el.remove(), 150);
|
|
@@ -1174,18 +1312,9 @@ function renderRows(was = rowTops()) {
|
|
|
1174
1312
|
if (fb) attr(fb, 'aria-expanded', String(!folded(w.sec, w.n)));
|
|
1175
1313
|
}
|
|
1176
1314
|
});
|
|
1177
|
-
//
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
const t0 = was.get(el.dataset.k);
|
|
1181
|
-
if (t0 === undefined) continue;
|
|
1182
|
-
const d = t0.top - el.getBoundingClientRect().top;
|
|
1183
|
-
if (d) moved.push([el, d]);
|
|
1184
|
-
}
|
|
1185
|
-
for (const [el, d] of moved) {
|
|
1186
|
-
el.style.transition = 'none'; el.style.transform = `translateY(${d}px)`;
|
|
1187
|
-
requestAnimationFrame(() => { el.style.transition = ''; el.style.transform = ''; });
|
|
1188
|
-
}
|
|
1315
|
+
// a run that starts takes its job out of the queue: both in one move
|
|
1316
|
+
renderQueues();
|
|
1317
|
+
settle(was);
|
|
1189
1318
|
$('bar').classList.toggle('off', !rows.size);
|
|
1190
1319
|
bar();
|
|
1191
1320
|
}
|
|
@@ -1202,7 +1331,7 @@ function bar() {
|
|
|
1202
1331
|
list.addEventListener('focusin', bar);
|
|
1203
1332
|
list.addEventListener('focusout', () => setTimeout(bar));
|
|
1204
1333
|
list.addEventListener('keydown', (e) => {
|
|
1205
|
-
if ((e.key !== 'ArrowDown' && e.key !== 'ArrowUp') || e.metaKey || e.altKey || e.ctrlKey) return;
|
|
1334
|
+
if ((e.key !== 'ArrowDown' && e.key !== 'ArrowUp') || e.metaKey || e.altKey || e.ctrlKey || e.target.closest('.q')) return;
|
|
1206
1335
|
const all = shown(), at = all.indexOf(e.target.closest('.row'));
|
|
1207
1336
|
const next = all[at < 0 ? 0 : at + (e.key === 'ArrowDown' ? 1 : -1)];
|
|
1208
1337
|
e.preventDefault();
|
|
@@ -1235,6 +1364,233 @@ setInterval(() => {
|
|
|
1235
1364
|
for (const x of list.querySelectorAll('.x[data-next]')) txt(x, `next ${until(Number(x.dataset.next))}`);
|
|
1236
1365
|
}, 1000);
|
|
1237
1366
|
|
|
1367
|
+
// --- Queues (wren designs/2026-12-02-queue-feed.md §4; WA-1520) ---------------------------
|
|
1368
|
+
// Feeds by shape, never by name: `status.state` is a status line, `items` a queue, numbers in `status` or `runs` counts, `labels` their words.
|
|
1369
|
+
/** file stem → feed, as the app last sent it */
|
|
1370
|
+
const feeds = new Map();
|
|
1371
|
+
/** queue item id → item, every feed: a run row names the job it took */
|
|
1372
|
+
const byRef = new Map();
|
|
1373
|
+
/** feed versions this page knows; the sidebar shows this many jobs */
|
|
1374
|
+
const FEED_V = 1, NEXT = 5;
|
|
1375
|
+
/** feeds a person shut (Finder's outline: per group, kept) */
|
|
1376
|
+
let qfold = {};
|
|
1377
|
+
try { qfold = JSON.parse(store.get('hub.qfold', '{}')) || {}; } catch {}
|
|
1378
|
+
const nf = new Intl.NumberFormat();
|
|
1379
|
+
/** the app sends every feed on `all`, and only the changed ones after (null = the file went) */
|
|
1380
|
+
function takeFeeds(m, whole) {
|
|
1381
|
+
if (whole) feeds.clear();
|
|
1382
|
+
for (const [k, v] of Object.entries(m && typeof m === 'object' ? m : {})) {
|
|
1383
|
+
if (v && typeof v === 'object') feeds.set(k, v); else feeds.delete(k);
|
|
1384
|
+
}
|
|
1385
|
+
byRef.clear();
|
|
1386
|
+
for (const f of feeds.values()) for (const it of Array.isArray(f.items) ? f.items : []) if (it && typeof it.id === 'string') byRef.set(it.id, it);
|
|
1387
|
+
// rows too: a run's title comes from its item
|
|
1388
|
+
renderRows();
|
|
1389
|
+
fillQSheet();
|
|
1390
|
+
}
|
|
1391
|
+
const atOf = (f) => { const t = Date.parse(f.updatedAt); return Number.isFinite(t) ? t : NaN; };
|
|
1392
|
+
/** the hub's rule: stale past 3 × everySec with no write */
|
|
1393
|
+
function staleOf(f, now = Date.now()) {
|
|
1394
|
+
const at = atOf(f), every = Number(f.everySec);
|
|
1395
|
+
return !Number.isFinite(at) || !(every > 0) || now - at > 3 * every * 1000;
|
|
1396
|
+
}
|
|
1397
|
+
function clock(ms) {
|
|
1398
|
+
const d = new Date(ms), t = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' });
|
|
1399
|
+
return d.toDateString() === new Date().toDateString() ? t : `${d.toLocaleDateString([], { month: 'short', day: 'numeric' })} ${t}`;
|
|
1400
|
+
}
|
|
1401
|
+
const counts = (o) => Object.entries(o && typeof o === 'object' ? o : {}).filter(([, n]) => typeof n === 'number' && n > 0);
|
|
1402
|
+
const word = (s) => { const t = String(s ?? '').trim(); return t ? t[0].toLocaleUpperCase() + t.slice(1) : ''; };
|
|
1403
|
+
/** a count's words: the feed's `labels`, else its key */
|
|
1404
|
+
const labelOf = (f, k) => word(f.labels && typeof f.labels === 'object' && typeof f.labels[k] === 'string' && f.labels[k].trim() ? f.labels[k] : k);
|
|
1405
|
+
const nameOf = (f, k) => (typeof f.label === 'string' && f.label.trim() ? f.label.trim() : typeof f.source === 'string' && f.source ? f.source : k);
|
|
1406
|
+
const itemOf = (it) => (it && typeof it === 'object' ? it : { title: String(it) });
|
|
1407
|
+
const linkOf = (it) => (typeof it.url === 'string' && /^https?:\/\//i.test(it.url) ? it.url : '');
|
|
1408
|
+
/** queue item ids with a live run (the run's `JOB_REF`): those show in the sessions, not the queue */
|
|
1409
|
+
const runRefs = () => new Set([...rows.values()].filter((r) => !r.ended && typeof r.job?.ref === 'string').map((r) => r.job.ref));
|
|
1410
|
+
/** a job: name, role line, then its hold or a state worth a word ("queued" is the list itself) */
|
|
1411
|
+
function itemHtml(it, running) {
|
|
1412
|
+
const h = it.hold && typeof it.hold === 'object' ? it.hold : null;
|
|
1413
|
+
const until = h && Date.parse(h.until);
|
|
1414
|
+
const cd = Number.isFinite(until) ? `, <span class="cd" data-until="${until}">${esc(untilWord(until))}</span>` : '';
|
|
1415
|
+
const st = running ? 'running' : typeof it.state === 'string' && !['queued', 'held'].includes(it.state) ? it.state : '';
|
|
1416
|
+
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>` : '';
|
|
1417
|
+
return `<div class="qt" dir="auto">${esc(it.title || it.id || 'Job')}</div>`
|
|
1418
|
+
+ (it.sub ? `<div class="qs" dir="auto">${esc(it.sub)}</div>` : '')
|
|
1419
|
+
+ (cap ? `<div class="qx">${cap}</div>` : '');
|
|
1420
|
+
}
|
|
1421
|
+
const untilWord = (ms) => until(ms);
|
|
1422
|
+
/** 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) */
|
|
1423
|
+
function keyed(ol, list, still = new Set()) {
|
|
1424
|
+
const old = new Map([...ol.children].filter((el) => !el.classList.contains('gone')).map((el) => [el.dataset.k, el]));
|
|
1425
|
+
const keep = new Set(list.map((it) => it.k));
|
|
1426
|
+
// places first, then writes: a job made absolute shifts the ones under it
|
|
1427
|
+
const out = [...old].filter(([k]) => !keep.has(k)).map(([k, el]) => [k, el, el.offsetTop, el.offsetLeft, el.offsetWidth]);
|
|
1428
|
+
for (const [k, el, top, left, w] of out) {
|
|
1429
|
+
old.delete(k);
|
|
1430
|
+
if (still.has(el.dataset.ref) || !ol.closest('#list')) { el.remove(); continue; }
|
|
1431
|
+
el.classList.add('gone'); el.style.top = `${top}px`; el.style.left = `${left}px`; el.style.width = `${w}px`;
|
|
1432
|
+
setTimeout(() => el.remove(), 150);
|
|
1433
|
+
}
|
|
1434
|
+
const live = () => [...ol.children].filter((el) => !el.classList.contains('gone'));
|
|
1435
|
+
list.forEach((it, i) => {
|
|
1436
|
+
let el = old.get(it.k);
|
|
1437
|
+
if (!el) {
|
|
1438
|
+
el = document.createElement('li'); el.className = 'qr'; el.dataset.k = it.k;
|
|
1439
|
+
if (it.ref) el.dataset.ref = it.ref;
|
|
1440
|
+
}
|
|
1441
|
+
if (el.dataset.h !== it.html) { el.dataset.h = it.html; el.innerHTML = it.html; }
|
|
1442
|
+
el.classList.toggle('go', !!it.url);
|
|
1443
|
+
if (it.url) { el.dataset.url = it.url; attr(el, 'title', `Open the posting: ${it.url}`); el.tabIndex = 0; }
|
|
1444
|
+
else { delete el.dataset.url; el.removeAttribute('title'); el.removeAttribute('tabindex'); }
|
|
1445
|
+
const at = live()[i];
|
|
1446
|
+
if (at !== el) ol.insertBefore(el, at ?? null);
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
/** list items for keyed(): ids repeat in a bad feed, so the nth copy gets #n */
|
|
1450
|
+
function itemRows(items, refs) {
|
|
1451
|
+
const seen = new Map();
|
|
1452
|
+
return items.map((raw) => {
|
|
1453
|
+
const o = itemOf(raw);
|
|
1454
|
+
const id = String(o.id ?? o.title ?? ''), n = seen.get(id) ?? 0;
|
|
1455
|
+
seen.set(id, n + 1);
|
|
1456
|
+
return { k: n ? `${id}#${n}` : id, ref: n ? '' : id, url: linkOf(o), html: itemHtml(o, refs.has(id)) };
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
/** one feed's block; built once, then filled */
|
|
1460
|
+
function feedEl(k) {
|
|
1461
|
+
const el = document.createElement('div');
|
|
1462
|
+
el.className = 'qf'; el.dataset.f = k;
|
|
1463
|
+
const body = `qbd-${k.replace(/[^\w-]/g, '_')}`;
|
|
1464
|
+
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>`
|
|
1465
|
+
+ `<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>`;
|
|
1466
|
+
el.querySelector('.qhd').addEventListener('click', () => {
|
|
1467
|
+
if (qfold[k]) delete qfold[k]; else qfold[k] = true;
|
|
1468
|
+
store.set('hub.qfold', JSON.stringify(qfold));
|
|
1469
|
+
renderQueues();
|
|
1470
|
+
});
|
|
1471
|
+
el.querySelector('.qm').addEventListener('click', () => qsheet(k));
|
|
1472
|
+
return el;
|
|
1473
|
+
}
|
|
1474
|
+
const show1 = (el, on) => { if (el.hidden === on) el.hidden = !on; };
|
|
1475
|
+
/** the counts as words-and-number pairs */
|
|
1476
|
+
function countsHtml(f) {
|
|
1477
|
+
return [...counts(f.status), ...counts(f.runs)].map(([w, n]) => `<dt>${esc(labelOf(f, w))}</dt><dd>${nf.format(n)}</dd>`).join('');
|
|
1478
|
+
}
|
|
1479
|
+
function fillFeed(el, k, f, now, refs) {
|
|
1480
|
+
const $q = (c) => el.querySelector(c);
|
|
1481
|
+
const bad = typeof f.error === 'string' ? `Unreadable feed file (${f.error})` : f.v !== FEED_V ? `feed v${f.v ?? '?'}: update autobrowse` : '';
|
|
1482
|
+
txt($q('.qn'), typeof f.error === 'string' ? `${k}.json` : nameOf(f, k));
|
|
1483
|
+
const old = !bad && staleOf(f, now);
|
|
1484
|
+
el.classList.toggle('old', old);
|
|
1485
|
+
const st = f.status && typeof f.status === 'object' ? f.status : {};
|
|
1486
|
+
const state = !bad && typeof st.state === 'string' ? st.state : '';
|
|
1487
|
+
const items = !bad && Array.isArray(f.items) ? f.items : null;
|
|
1488
|
+
// the state in a capsule: blue runs, amber waits, grey when old; a queue shows its size
|
|
1489
|
+
const cap = $q('.qhd .cap');
|
|
1490
|
+
cls(cap, `cap${old ? '' : state === 'running' ? ' run' : state ? ' held' : ''}`);
|
|
1491
|
+
swapText(cap, bad ? '' : state ? word(state) : items?.length ? nf.format(items.length) : '');
|
|
1492
|
+
attr(cap, 'title', items && !state ? `${nf.format(items.length)} in the queue` : '');
|
|
1493
|
+
const at = atOf(f);
|
|
1494
|
+
txt($q('.qst'), old ? (Number.isFinite(at) ? `Stale since ${clock(at)}` : 'Stale: no update time') : '');
|
|
1495
|
+
show1($q('.qst'), old);
|
|
1496
|
+
// a status line's reason; a bad feed's one line
|
|
1497
|
+
const given = state && typeof st.why === 'string' ? st.why.trim() : '';
|
|
1498
|
+
const why = bad || given || (state && state !== 'running' ? 'No reason given' : '');
|
|
1499
|
+
txt($q('.qy'), why);
|
|
1500
|
+
$q('.qy').classList.toggle('mut', !!why && !given);
|
|
1501
|
+
show1($q('.qy'), !!why);
|
|
1502
|
+
const ch = bad ? '' : countsHtml(f);
|
|
1503
|
+
if ($q('.qc').dataset.h !== ch) { $q('.qc').dataset.h = ch; $q('.qc').innerHTML = ch; }
|
|
1504
|
+
show1($q('.qc'), !!ch);
|
|
1505
|
+
// next: jobs that can start (no hold), not running yet
|
|
1506
|
+
const next = (items ?? []).filter((it) => { const o = itemOf(it); return !(o.hold && typeof o.hold === 'object') && !refs.has(String(o.id ?? '')); }).slice(0, NEXT);
|
|
1507
|
+
txt($q('.qsub'), !items ? '' : !items.length ? 'The queue is empty' : next.length ? `Next ${next.length}` : 'No job can start now');
|
|
1508
|
+
show1($q('.qsub'), !!items);
|
|
1509
|
+
$q('.qsub').classList.toggle('none', !!items && !next.length);
|
|
1510
|
+
const ol = $q('.qi');
|
|
1511
|
+
keyed(ol, itemRows(next, new Set()), refs);
|
|
1512
|
+
show1(ol, next.length > 0);
|
|
1513
|
+
show1($q('.qfoot'), !!items?.length);
|
|
1514
|
+
const open = !qfold[k], hd = $q('.qhd'), bw = $q('.qbw');
|
|
1515
|
+
attr(hd, 'aria-expanded', String(open));
|
|
1516
|
+
bw.classList.toggle('shut', !open);
|
|
1517
|
+
bw.inert = !open;
|
|
1518
|
+
}
|
|
1519
|
+
/** the Queues section: last in the list, under the sessions; none with no feed */
|
|
1520
|
+
function renderQueues(now = Date.now()) {
|
|
1521
|
+
let q = list.querySelector(':scope>.q');
|
|
1522
|
+
if (!feeds.size) { q?.remove(); return; }
|
|
1523
|
+
if (!q) {
|
|
1524
|
+
q = document.createElement('li');
|
|
1525
|
+
q.className = 'q'; q.dataset.k = 'q';
|
|
1526
|
+
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>`;
|
|
1527
|
+
stuckIO.observe(q.querySelector('.sec'));
|
|
1528
|
+
q.querySelector('.sh').addEventListener('click', () => { fold.queues = !fold.queues; store.set('hub.fold', JSON.stringify(fold)); const was = places(); renderQueues(); settle(was); });
|
|
1529
|
+
}
|
|
1530
|
+
if (q.nextElementSibling && !q.nextElementSibling.classList.contains('gone')) list.append(q);
|
|
1531
|
+
else if (!q.isConnected) list.append(q);
|
|
1532
|
+
const open = !fold.queues;
|
|
1533
|
+
attr(q.querySelector('.sh'), 'aria-expanded', String(open));
|
|
1534
|
+
const qb = q.querySelector('.qb');
|
|
1535
|
+
show1(qb, open);
|
|
1536
|
+
if (!open) return;
|
|
1537
|
+
// status lines first (the host), then queues; by name inside each
|
|
1538
|
+
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));
|
|
1539
|
+
const have = new Map([...qb.children].map((el) => [el.dataset.f, el]));
|
|
1540
|
+
const refs = runRefs();
|
|
1541
|
+
ks.forEach((k, i) => {
|
|
1542
|
+
const el = have.get(k) ?? feedEl(k);
|
|
1543
|
+
have.delete(k);
|
|
1544
|
+
fillFeed(el, k, feeds.get(k), now, refs);
|
|
1545
|
+
if (qb.children[i] !== el) qb.insertBefore(el, qb.children[i] ?? null);
|
|
1546
|
+
});
|
|
1547
|
+
for (const el of have.values()) el.remove();
|
|
1548
|
+
}
|
|
1549
|
+
// a job with a link opens its posting in the browser; a drag that selected words does not
|
|
1550
|
+
function openJob(e) {
|
|
1551
|
+
const el = e.target.closest('.qr.go');
|
|
1552
|
+
if (!el || (e.type === 'keydown' && (e.key !== 'Enter' || e.target !== el))) return;
|
|
1553
|
+
const sel = getSelection();
|
|
1554
|
+
if (e.type === 'click' && sel && !sel.isCollapsed && el.contains(sel.anchorNode)) return;
|
|
1555
|
+
app({ t: 'open-url', url: el.dataset.url });
|
|
1556
|
+
}
|
|
1557
|
+
for (const el of [list, $('qsheet')]) { el.addEventListener('click', openJob); el.addEventListener('keydown', openJob); }
|
|
1558
|
+
// --- the full queue: a window sheet (WA-1520) ---------------------------------------
|
|
1559
|
+
/** the feed the sheet shows; null = shut */
|
|
1560
|
+
let qsheetOf = null;
|
|
1561
|
+
const qfilterEl = $('qfilter');
|
|
1562
|
+
function qsheet(k) {
|
|
1563
|
+
const was = qsheetOf;
|
|
1564
|
+
qsheetOf = k && feeds.has(k) ? k : null;
|
|
1565
|
+
if (qsheetOf && qsheetOf !== was) qfilterEl.value = '';
|
|
1566
|
+
fillQSheet();
|
|
1567
|
+
showSheet('qsheet', !!qsheetOf, () => list.querySelector(`.qf[data-f="${CSS.escape(was ?? '')}"] .qm`)?.focus({ preventScroll: true }));
|
|
1568
|
+
if (qsheetOf) qfilterEl.focus({ preventScroll: true });
|
|
1569
|
+
}
|
|
1570
|
+
function fillQSheet() {
|
|
1571
|
+
if (!qsheetOf) return;
|
|
1572
|
+
const f = feeds.get(qsheetOf);
|
|
1573
|
+
if (!f || !Array.isArray(f.items)) { qsheet(null); return; }
|
|
1574
|
+
const sh = $('qsheet'), items = f.items, refs = runRefs();
|
|
1575
|
+
txt($('qsheetn'), nameOf(f, qsheetOf));
|
|
1576
|
+
const at = atOf(f), old = staleOf(f);
|
|
1577
|
+
txt(sh.querySelector('.hd .sub'), `${nf.format(items.length)} ${items.length === 1 ? 'job' : 'jobs'}, ${old ? 'stale since' : 'updated'} ${Number.isFinite(at) ? clock(at) : 'never'}`);
|
|
1578
|
+
const sum = counts(f.status).map(([w, n]) => `<span>${esc(labelOf(f, w))} <b>${nf.format(n)}</b></span>`).join('');
|
|
1579
|
+
if (sh.querySelector('.qsum').dataset.h !== sum) { sh.querySelector('.qsum').dataset.h = sum; sh.querySelector('.qsum').innerHTML = sum; }
|
|
1580
|
+
const q = qfilterEl.value.trim().toLocaleLowerCase();
|
|
1581
|
+
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)); };
|
|
1582
|
+
const shown = itemRows(items, refs).filter((_, i) => hit(items[i]));
|
|
1583
|
+
keyed(sh.querySelector('.qi'), shown);
|
|
1584
|
+
const none = sh.querySelector('.none');
|
|
1585
|
+
txt(none, !items.length ? 'The queue is empty' : `No job matches “${qfilterEl.value.trim()}”`);
|
|
1586
|
+
show1(none, !shown.length);
|
|
1587
|
+
}
|
|
1588
|
+
$('qsheetx').addEventListener('click', () => qsheet(null));
|
|
1589
|
+
qfilterEl.addEventListener('input', fillQSheet);
|
|
1590
|
+
// countdowns each second; stale on its own once-a-minute clock (no file change needed)
|
|
1591
|
+
setInterval(() => { for (const c of document.querySelectorAll('.cd[data-until]')) txt(c, untilWord(Number(c.dataset.until))); }, 1000);
|
|
1592
|
+
setInterval(() => { if (!feeds.size) return; const was = places(); renderQueues(); settle(was); fillQSheet(); }, 60_000);
|
|
1593
|
+
|
|
1238
1594
|
// --- actions -------------------------------------------------------------------------
|
|
1239
1595
|
const opening = new Set();
|
|
1240
1596
|
/** asked with ⌘-click in Focus: placed beside the others when its view comes up */
|
|
@@ -1322,7 +1678,8 @@ addEventListener('keydown', (e) => {
|
|
|
1322
1678
|
if (e.metaKey && key({ code: e.code, shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey })) e.preventDefault();
|
|
1323
1679
|
else if (e.key === 'Escape') {
|
|
1324
1680
|
if (sizing) endSize(false);
|
|
1325
|
-
else if (
|
|
1681
|
+
else if (sheetOn('keys')) keys(false);
|
|
1682
|
+
else if (sheetOn('qsheet')) qsheet(null);
|
|
1326
1683
|
else if (peek || pin) { const inside = sidein.contains(document.activeElement); setPeek(false); if (inside) $('sidebtn').focus(); }
|
|
1327
1684
|
}
|
|
1328
1685
|
});
|
|
@@ -1343,6 +1700,7 @@ addEventListener('message', (e) => {
|
|
|
1343
1700
|
if (cells.includes(k)) render();
|
|
1344
1701
|
}
|
|
1345
1702
|
else if (m.t === 'key') key(m);
|
|
1703
|
+
else if (m.t === 'keys') { if (sheetOn('keys')) keys(false); else { keysFrom = k; keys(true, Array.isArray(m.groups) ? m.groups : []); } }
|
|
1346
1704
|
});
|
|
1347
1705
|
|
|
1348
1706
|
// --- chrome ----------------------------------------------------------------------------
|
|
@@ -1350,23 +1708,59 @@ $('sidebtn').addEventListener('click', () => key({ code: 'Backslash' }));
|
|
|
1350
1708
|
for (const b of $('seg').children) b.addEventListener('click', () => setLayout(b.dataset.l));
|
|
1351
1709
|
$('pauseall').addEventListener('click', () => app({ t: 'pause-all' }));
|
|
1352
1710
|
$('unmax').addEventListener('click', () => { if (max) toggleMax(); });
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1711
|
+
// --- window sheets: ⌘/ keys and the full queue, centred in the window (WA-1520) -------------
|
|
1712
|
+
/** the pane whose keys the sheet shows, to hand the keys back to on close */
|
|
1713
|
+
let keysFrom = null, keysWait = 0;
|
|
1714
|
+
/** groups: [[name, [[label, combo, combo…]]]] from the pane; the hub's own group last */
|
|
1715
|
+
function fillKeys(groups) {
|
|
1716
|
+
const b = $('keys').querySelector('.b');
|
|
1717
|
+
b.textContent = '';
|
|
1718
|
+
for (const [name, list] of [...groups, ['Hub', HUB_KEYS]]) {
|
|
1719
|
+
const grp = document.createElement('div'); grp.className = 'grp';
|
|
1720
|
+
const g = document.createElement('div'); g.className = 'g'; g.textContent = String(name); grp.append(g);
|
|
1721
|
+
for (const [label, ...combos] of Array.isArray(list) ? list : []) {
|
|
1722
|
+
const r = document.createElement('div'); r.className = 'r';
|
|
1723
|
+
const l = document.createElement('span'); l.textContent = String(label);
|
|
1724
|
+
const k = document.createElement('span'); k.className = 'k';
|
|
1725
|
+
combos.forEach((combo, i) => {
|
|
1726
|
+
if (i) k.append('or');
|
|
1727
|
+
for (const c of Array.isArray(combo) ? combo : []) { const kb = document.createElement('kbd'); kb.textContent = String(c); k.append(kb); }
|
|
1728
|
+
});
|
|
1729
|
+
r.append(l, k); grp.append(r);
|
|
1730
|
+
}
|
|
1731
|
+
b.append(grp);
|
|
1732
|
+
}
|
|
1359
1733
|
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
function
|
|
1734
|
+
const sheetOn = (id) => $(id).classList.contains('on');
|
|
1735
|
+
/** a sheet takes the keys (Esc reaches the hub, not the page) and gives them back on close */
|
|
1736
|
+
function showSheet(id, on, back) {
|
|
1737
|
+
if (sheetOn(id) === on) return;
|
|
1738
|
+
$(id).classList.toggle('on', on);
|
|
1739
|
+
if (on) { $(id).firstElementChild.focus({ preventScroll: true }); return; }
|
|
1740
|
+
if (back) back();
|
|
1741
|
+
}
|
|
1742
|
+
function keys(on = !sheetOn('keys'), groups = []) {
|
|
1743
|
+
clearTimeout(keysWait); keysWait = 0;
|
|
1744
|
+
if (on) fillKeys(groups);
|
|
1745
|
+
const from = keysFrom;
|
|
1746
|
+
if (!on) keysFrom = null;
|
|
1747
|
+
$('keysbtn').setAttribute('aria-expanded', String(on));
|
|
1748
|
+
showSheet('keys', on, () => { const p = from && panes.get(from); if (p) p.frame.contentWindow?.postMessage({ hub: { t: 'focus' } }, '*'); });
|
|
1749
|
+
}
|
|
1750
|
+
/** one sheet: the current pane sends its groups (its ⌘/ comes here too); a pane that does not answer gets the hub's alone */
|
|
1363
1751
|
function openKeys() {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
if (p) { keys(
|
|
1752
|
+
if (sheetOn('keys')) { keys(false); return; }
|
|
1753
|
+
const k = cells[cur], p = panes.get(k);
|
|
1754
|
+
if (!p) { keys(true); return; }
|
|
1755
|
+
keysFrom = k;
|
|
1756
|
+
p.frame.contentWindow?.postMessage({ hub: { t: 'keys' } }, '*');
|
|
1757
|
+
clearTimeout(keysWait);
|
|
1758
|
+
keysWait = setTimeout(() => keys(true), 150);
|
|
1367
1759
|
}
|
|
1760
|
+
$('keysx').addEventListener('click', () => keys(false));
|
|
1368
1761
|
$('keysbtn').addEventListener('click', openKeys);
|
|
1369
1762
|
$('barkeys').addEventListener('click', openKeys);
|
|
1763
|
+
for (const id of ['keys', 'qsheet']) $(id).addEventListener('mousedown', (e) => { if (e.target === e.currentTarget) { if (id === 'keys') keys(false); else qsheet(null); } });
|
|
1370
1764
|
// the bar drags the window; a double click zooms it
|
|
1371
1765
|
for (const el of [$('top'), $('drag')]) {
|
|
1372
1766
|
el.addEventListener('mousedown', (e) => { if (e.target === e.currentTarget && e.button === 0 && e.detail === 1) app({ t: 'drag' }); });
|