@william_jin/autobrowse 0.8.26 → 0.8.28
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 +71 -36
- package/assets/live-view/viewer.html +292 -21
- 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/cli-record.js +17 -6
- package/dist/app/cli-record.js.map +1 -1
- package/dist/app/cli-task.d.ts +25 -0
- package/dist/app/cli-task.js +156 -0
- package/dist/app/cli-task.js.map +1 -0
- package/dist/app/config.d.ts +0 -1
- package/dist/app/config.js +1 -1
- package/dist/app/config.js.map +1 -1
- package/dist/app/help.js +1 -0
- package/dist/app/help.js.map +1 -1
- package/dist/app/task.d.ts +182 -0
- package/dist/app/task.js +382 -0
- package/dist/app/task.js.map +1 -0
- package/dist/auth/sign-in-kit.d.ts +2 -0
- package/dist/auth/sign-in-kit.js +52 -13
- package/dist/auth/sign-in-kit.js.map +1 -1
- package/dist/browser/flow-api.d.ts +2 -0
- package/dist/browser/flow-api.js.map +1 -1
- package/dist/browser/flow.js +3 -1
- package/dist/browser/flow.js.map +1 -1
- package/dist/browser/live-term.d.ts +78 -0
- package/dist/browser/live-term.js +341 -0
- package/dist/browser/live-term.js.map +1 -0
- package/dist/browser/live-view.d.ts +3 -0
- package/dist/browser/live-view.js +44 -2
- package/dist/browser/live-view.js.map +1 -1
- package/dist/explore/commands.d.ts +11 -8
- package/dist/explore/commands.js +3 -0
- package/dist/explore/commands.js.map +1 -1
- package/dist/explore/server.d.ts +8 -0
- package/dist/explore/server.js +23 -3
- package/dist/explore/server.js.map +1 -1
- package/dist/llms.txt +2 -1
- package/package.json +7 -2
|
@@ -170,7 +170,7 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
|
|
|
170
170
|
/* the entry fade on first style, not on a frame callback: a covered window runs none, and a pane made there stayed clear */
|
|
171
171
|
@starting-style{.pane.in{opacity:0}}
|
|
172
172
|
.pane.off{visibility:hidden;pointer-events:none}
|
|
173
|
-
/* §Hub windows: each run
|
|
173
|
+
/* §Hub windows: each run among others is a window: frame, shadow, a raised title bar over the darker desk */
|
|
174
174
|
.grid .pane,.single .pane.hug{border-radius:var(--win-r);box-shadow:var(--frame)}
|
|
175
175
|
.pane::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 1.5px var(--ring);pointer-events:none;opacity:0;transition:opacity .15s}
|
|
176
176
|
.pane.cur::after{opacity:1}
|
|
@@ -266,9 +266,8 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
|
|
|
266
266
|
<span id="segs">
|
|
267
267
|
<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
268
|
<fieldset id="seg" aria-label="Layout">
|
|
269
|
-
<button type="button" data-l="focus" title="Focus: one pane (⌃⌘1)" aria-label="Focus: one pane" 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
|
-
<button type="button" data-l="
|
|
271
|
-
<button type="button" data-l="grid" title="Grid: up to 9 panes (⌃⌘3)" 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>
|
|
269
|
+
<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
|
+
<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>
|
|
272
271
|
</fieldset></span>
|
|
273
272
|
<button type="button" class="nb" id="pauseall" title="Pause every agent (⌘⇧P)" disabled>Pause all</button>
|
|
274
273
|
<button type="button" class="nb" id="keysbtn" title="Keys" aria-label="Keys" aria-expanded="false"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="1.5" y="4" width="13" height="8.5" rx="1.8"/><path d="M4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 10h6"/></svg></button>
|
|
@@ -298,7 +297,8 @@ const stuckIO = new IntersectionObserver((es) => {
|
|
|
298
297
|
}, { root: list, rootMargin: '-3px 0px 0px 0px', threshold: [1] });
|
|
299
298
|
const app = (m) => { try { window.webkit.messageHandlers.ipc.postMessage(JSON.stringify(m)); } catch {} };
|
|
300
299
|
const store = { get(k, d) { try { return localStorage.getItem(k) ?? d; } catch { return d; } }, set(k, v) { try { localStorage.setItem(k, v); } catch {} } };
|
|
301
|
-
|
|
300
|
+
/** most panes: Grid fills them all; Focus holds only the runs picked (one by default, ⌘-click adds) */
|
|
301
|
+
const CAP = { focus: 9, grid: 9 };
|
|
302
302
|
const ICON = {
|
|
303
303
|
pause: '<rect x="4.25" y="3.25" width="2.6" height="9.5" rx=".9"/><rect x="9.15" y="3.25" width="2.6" height="9.5" rx=".9"/>',
|
|
304
304
|
play: '<path d="M5 3.3v9.4a.7.7 0 0 0 1.07.6l7.3-4.7a.7.7 0 0 0 0-1.2L6.07 2.7A.7.7 0 0 0 5 3.3z"/>',
|
|
@@ -320,9 +320,9 @@ const ICON = {
|
|
|
320
320
|
const FILLED = new Set(['pause', 'play']);
|
|
321
321
|
const icon = (n) => `<svg class="ic${FILLED.has(n) ? ' fill' : ''}" viewBox="0 0 16 16" aria-hidden="true">${ICON[n]}</svg>`;
|
|
322
322
|
/** the hub's keys: this sheet, and a group in each pane's ⌘/ sheet */
|
|
323
|
-
const HUB_KEYS = [['Sidebar: full or collapsed', ['⌘', '\\']], ['Focus,
|
|
324
|
-
/** a pane
|
|
325
|
-
const SIZE_MIN = 480;
|
|
323
|
+
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
|
+
/** 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
|
+
const SIZE_MIN = { w: 480, h: 600 };
|
|
326
326
|
|
|
327
327
|
// --- state ------------------------------------------------------------------------
|
|
328
328
|
/** id → row from the app; plus `ended` (ms) once the session left */
|
|
@@ -340,19 +340,29 @@ const paceNext = (k) => PACES[(PACES.indexOf(k) + 1) % PACES.length] ?? 1;
|
|
|
340
340
|
const isOff = (v) => v === false || /^(false|0|no|off)$/i.test(String(v ?? ''));
|
|
341
341
|
const autoOn = () => !isOff(prefs.hubAutoOpen);
|
|
342
342
|
const motionOn = () => !isOff(prefs.hubMotion);
|
|
343
|
-
/** the file's layout wins at launch and when it changes;
|
|
343
|
+
/** the file's layout wins at launch and when it changes; ⌃⌘1–2 lasts until then */
|
|
344
344
|
function takePrefs(p, first) {
|
|
345
345
|
const was = prefs.hubLayout;
|
|
346
346
|
prefs = p && typeof p === 'object' ? p : {};
|
|
347
347
|
const n = Math.round(Number(prefs.hubMaxPanes));
|
|
348
348
|
const most = n >= 1 && n <= 9 ? n : 9;
|
|
349
|
-
CAP.grid = most; CAP.
|
|
349
|
+
CAP.grid = most; CAP.focus = most;
|
|
350
350
|
const g = document.querySelector('#seg [data-l=grid]');
|
|
351
|
-
if (g) { g.title = `Grid: up to ${most} panes (⌃⌘
|
|
351
|
+
if (g) { g.title = `Grid: up to ${most} panes (⌃⌘2)`; g.setAttribute('aria-label', `Grid: up to ${most} panes`); }
|
|
352
352
|
document.documentElement.classList.toggle('still', !motionOn());
|
|
353
353
|
const l = prefs.hubLayout;
|
|
354
|
-
if (CAP[l] && (first || l !== was)) {
|
|
354
|
+
if (CAP[l] && (first || l !== was)) { switchLayout(l); max = false; }
|
|
355
355
|
}
|
|
356
|
+
/** into a layout; Focus from Grid keeps the pane in front, alone */
|
|
357
|
+
function switchLayout(l) {
|
|
358
|
+
if (l === 'focus' && layout !== 'focus' && cells[cur]) {
|
|
359
|
+
const keep = picked?.size ? cells.filter((k) => picked.has(k)) : [cells[cur]];
|
|
360
|
+
cur = Math.max(0, keep.indexOf(cells[cur])); cells = keep; picked = null;
|
|
361
|
+
}
|
|
362
|
+
layout = l;
|
|
363
|
+
}
|
|
364
|
+
/** 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 */
|
|
365
|
+
let picked = null;
|
|
356
366
|
/** placed panes, by key (`id`, or `id#own` for a second view of one session) */
|
|
357
367
|
let cells = [];
|
|
358
368
|
let cur = 0, max = false, hubOn = false;
|
|
@@ -419,7 +429,7 @@ function put(r) {
|
|
|
419
429
|
if (r.url || r.ended || was?.ended) { auto.delete(r.id); askedAt.delete(r.id); }
|
|
420
430
|
if (was?.ended) opening.delete(r.id);
|
|
421
431
|
// a lazy run's live view just came up because a person opened it: show it
|
|
422
|
-
if (was && !was.url && r.url && opening.has(r.id)) { opening.delete(r.id); show(r.id); }
|
|
432
|
+
if (was && !was.url && r.url && opening.has(r.id)) { opening.delete(r.id); show(r.id, adding.delete(r.id)); }
|
|
423
433
|
// a session's viewer moved: its panes reload on the new address
|
|
424
434
|
if (was?.url && r.url && was.url !== r.url) for (const [k, p] of panes) if (idOf(k) === r.id) drop(k);
|
|
425
435
|
if (!placeable(r.id)) cells = cells.filter((k) => idOf(k) !== r.id);
|
|
@@ -444,25 +454,25 @@ function end(id) {
|
|
|
444
454
|
}
|
|
445
455
|
|
|
446
456
|
// --- layout --------------------------------------------------------------------------
|
|
447
|
-
/** fill free cells with sessions not on screen, in row order */
|
|
457
|
+
/** fill free cells with sessions not on screen, in row order: Grid every pane, Focus one when none is picked */
|
|
448
458
|
function fill() {
|
|
449
459
|
cells = cells.filter((k) => placeable(idOf(k)));
|
|
450
|
-
const cap = CAP[layout];
|
|
460
|
+
const cap = CAP[layout], want = layout === 'focus' ? 1 : cap;
|
|
451
461
|
if (cells.length > cap) cells = cells.slice(0, cap);
|
|
452
462
|
for (const id of sorted()) {
|
|
453
|
-
if (cells.length >=
|
|
463
|
+
if (cells.length >= want) break;
|
|
454
464
|
if (placeable(id) && !cells.some((k) => idOf(k) === id)) cells.push(id);
|
|
455
465
|
}
|
|
456
466
|
cur = Math.min(cur, Math.max(0, cells.length - 1));
|
|
457
467
|
if (max && !cells[cur]) max = false;
|
|
458
|
-
autoOpen(
|
|
468
|
+
autoOpen(want);
|
|
459
469
|
}
|
|
460
470
|
/** lazy runs asked to watch by themselves; on arrival fill places them, never taking cur or focus */
|
|
461
471
|
const auto = new Set();
|
|
462
472
|
/** when each ask went out. An ask is asked once: the run holds it and answers with its `url` when its
|
|
463
473
|
* view is up, however late (a busy page). No re-ask, no poll. */
|
|
464
474
|
const askedAt = new Map();
|
|
465
|
-
/** an ask this old stops holding a pane: the next run may take it (a silent run never starves Focus
|
|
475
|
+
/** an ask this old stops holding a pane: the next run may take it (a silent run never starves Focus) */
|
|
466
476
|
const AUTO_MS = 20_000;
|
|
467
477
|
function ask(id) {
|
|
468
478
|
askedAt.set(id, Date.now());
|
|
@@ -486,7 +496,7 @@ function autoOpen(cap) {
|
|
|
486
496
|
}
|
|
487
497
|
function setLayout(l) {
|
|
488
498
|
if (!CAP[l]) return;
|
|
489
|
-
|
|
499
|
+
switchLayout(l); max = false; store.set('hub.layout', l);
|
|
490
500
|
fill(); render();
|
|
491
501
|
}
|
|
492
502
|
/** bento cells, in fractions of the stage */
|
|
@@ -541,7 +551,7 @@ function pageArea([, , w, h], pg) {
|
|
|
541
551
|
const s = fitScale(w, rh, pg);
|
|
542
552
|
return s * s * pg.w * pg.h;
|
|
543
553
|
}
|
|
544
|
-
/** the arrangements to weigh:
|
|
554
|
+
/** the arrangements to weigh: the bento, its stacked twin, 1 to 5 columns (two panes: side by side or stacked) */
|
|
545
555
|
function arrangements(n) {
|
|
546
556
|
const out = [];
|
|
547
557
|
if (n === 3) out.push(['bento', [[0, 0, .6, 1], [.6, 0, .4, .5], [.6, .5, .4, .5]]], ['bento-stack', [[0, 0, 1, .6], [0, .6, .5, .4], [.5, .6, .5, .4]]]);
|
|
@@ -672,16 +682,15 @@ function packRows(items, gap) {
|
|
|
672
682
|
}
|
|
673
683
|
return items;
|
|
674
684
|
}
|
|
675
|
-
/** what a pane's viewer needs: tiles scale frames; one full pane
|
|
685
|
+
/** what a pane's viewer needs: tiles scale frames; one full pane or a session's first pane sets the viewport, never under SIZE_MIN */
|
|
676
686
|
function embedOf(key) {
|
|
677
687
|
const i = cells.indexOf(key), single = max ? i === cur : cells.length === 1 && layout === 'focus';
|
|
678
|
-
// a session's first pane
|
|
688
|
+
// a session's first pane sizes its page as a split browser does; a second view of it only scales
|
|
679
689
|
const first = !key.includes('#') && cells.findIndex((k) => idOf(k) === idOf(key)) === i;
|
|
680
690
|
const w = panes.get(key)?.w ?? 0, owns = i >= 0 && !max && first && w > 0;
|
|
681
|
-
const sizes = i >= 0 && (single ||
|
|
682
|
-
//
|
|
683
|
-
|
|
684
|
-
return { t: 'embed', tile: !sizes, zoom, bare: !single, on: hubOn && i >= 0 && (!max || i === cur), keys: HUB_KEYS };
|
|
691
|
+
const sizes = i >= 0 && (single || owns);
|
|
692
|
+
// 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), keys: HUB_KEYS };
|
|
685
694
|
}
|
|
686
695
|
|
|
687
696
|
// --- panes -------------------------------------------------------------------------
|
|
@@ -703,8 +712,13 @@ function pane(key) {
|
|
|
703
712
|
el.firstChild.append(frame);
|
|
704
713
|
el.querySelector('.ph').addEventListener('click', (e) => {
|
|
705
714
|
const a = e.target.closest('button')?.dataset.a;
|
|
706
|
-
const i = cells.indexOf(key);
|
|
715
|
+
const i = cells.indexOf(key), ringed = cells[cur];
|
|
707
716
|
if (i >= 0) cur = i;
|
|
717
|
+
// a pick starts from the pane ringed now
|
|
718
|
+
if (!a && (e.shiftKey || e.metaKey)) {
|
|
719
|
+
picked ??= new Set(ringed && ringed !== key ? [ringed] : []);
|
|
720
|
+
if (picked.has(key)) picked.delete(key); else picked.add(key);
|
|
721
|
+
} else picked = null;
|
|
708
722
|
if (a === 'max') toggleMax();
|
|
709
723
|
else if (a === 'tear') app({ t: 'tear', id: idOf(key) });
|
|
710
724
|
else if (a === 'x') { cells = cells.filter((k) => k !== key); render(); }
|
|
@@ -729,6 +743,11 @@ function dragPane(el, key) {
|
|
|
729
743
|
const ph = el.querySelector('.ph');
|
|
730
744
|
ph.addEventListener('dragstart', (e) => { e.dataTransfer.setData('text/plain', key); e.dataTransfer.effectAllowed = 'move'; });
|
|
731
745
|
}
|
|
746
|
+
// the desk between panes: no pane ringed
|
|
747
|
+
stage.addEventListener('pointerdown', (e) => {
|
|
748
|
+
if (e.button !== 0 || e.target.closest('.pane') || picked?.size === 0) return;
|
|
749
|
+
picked = new Set(); render();
|
|
750
|
+
});
|
|
732
751
|
stage.addEventListener('dragover', (e) => {
|
|
733
752
|
const t = target(e);
|
|
734
753
|
for (const p of panes.values()) p.el.classList.toggle('drop', p.el === t?.el);
|
|
@@ -775,6 +794,7 @@ function render() {
|
|
|
775
794
|
if (renderRaf) { cancelAnimationFrame(renderRaf); renderRaf = 0; }
|
|
776
795
|
// reads first: after a frame, layout is clean and they cost nothing
|
|
777
796
|
const was = sweepFrom(), rowsWas = rowTops();
|
|
797
|
+
if (picked) for (const k of picked) if (!cells.includes(k)) picked.delete(k);
|
|
778
798
|
applySide();
|
|
779
799
|
roomFrom = null;
|
|
780
800
|
for (const b of $('seg').children) attr(b, 'aria-pressed', String(b.dataset.l === layout));
|
|
@@ -817,7 +837,7 @@ function render() {
|
|
|
817
837
|
txt(p.el.querySelector('.tt'), p.title || r.state?.title || '');
|
|
818
838
|
// the bar is one line: the whole name and title on hover
|
|
819
839
|
attr(p.el.querySelector('.ph'), 'title', `${r.site || 'session'} · ${p.title || r.state?.title || ''}`);
|
|
820
|
-
p.el.classList.toggle('cur', i === cur && cells.length > 1);
|
|
840
|
+
p.el.classList.toggle('cur', (picked ? picked.has(cells[i]) : i === cur) && cells.length > 1);
|
|
821
841
|
const off = p.el.classList.contains('off'), hidden = max && i !== cur, back = off && !hidden;
|
|
822
842
|
p.el.classList.toggle('off', hidden);
|
|
823
843
|
if (morph && (back || (hidden && !off))) fade(p, back);
|
|
@@ -972,7 +992,7 @@ function rowEl(id) {
|
|
|
972
992
|
const b = e.target.closest('button');
|
|
973
993
|
if (b?.dataset.more) { if (allTabs.has(id)) allTabs.delete(id); else allTabs.add(id); renderRows(); return; }
|
|
974
994
|
if (b?.dataset.tab) { show(id); app({ t: 'tab', id, tab: Number(b.dataset.tab) }); return; }
|
|
975
|
-
if (b?.dataset.a) act(id, b.dataset.a, b.dataset); else show(id);
|
|
995
|
+
if (b?.dataset.a) act(id, b.dataset.a, b.dataset); else show(id, e.metaKey || e.shiftKey);
|
|
976
996
|
});
|
|
977
997
|
el.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target === el) enter(id); });
|
|
978
998
|
el.addEventListener('dragstart', (e) => { e.dataTransfer.setData('text/plain', `row:${id}`); e.dataTransfer.effectAllowed = 'move'; });
|
|
@@ -1217,6 +1237,8 @@ setInterval(() => {
|
|
|
1217
1237
|
|
|
1218
1238
|
// --- actions -------------------------------------------------------------------------
|
|
1219
1239
|
const opening = new Set();
|
|
1240
|
+
/** asked with ⌘-click in Focus: placed beside the others when its view comes up */
|
|
1241
|
+
const adding = new Set();
|
|
1220
1242
|
function act(id, a, d = {}) {
|
|
1221
1243
|
const r = rows.get(id);
|
|
1222
1244
|
if (!r) return;
|
|
@@ -1232,17 +1254,28 @@ function act(id, a, d = {}) {
|
|
|
1232
1254
|
else if (a === 'pause') app({ t: 'pause', id, held: !r.state?.held });
|
|
1233
1255
|
else if (a === 'back') app({ t: 'back', id });
|
|
1234
1256
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
|
|
1257
|
+
/**
|
|
1258
|
+
* put a session in front: its torn window, its pane, or a pane it takes over. Focus: that run alone;
|
|
1259
|
+
* `more` (⌘- or ⇧-click) adds it beside the others, or drops it when it is already there
|
|
1260
|
+
*/
|
|
1261
|
+
function show(id, more = false) {
|
|
1237
1262
|
const r = rows.get(id);
|
|
1238
1263
|
if (!r || r.ended) return;
|
|
1239
1264
|
if (r.torn) return app({ t: 'tear', id });
|
|
1240
|
-
if (r.lazy && !r.url) return act(id, 'watch');
|
|
1265
|
+
if (r.lazy && !r.url) { if (more) adding.add(id); else adding.delete(id); return act(id, 'watch'); }
|
|
1241
1266
|
if (!placeable(id)) return;
|
|
1242
1267
|
const at = cells.findIndex((k) => idOf(k) === id);
|
|
1243
|
-
if (
|
|
1268
|
+
if (layout === 'focus' && !more) { cells = cells.filter((k) => idOf(k) === id); if (!cells.length) cells = [id]; cur = 0; }
|
|
1269
|
+
else if (layout === 'focus' && at >= 0 && cells.length > 1) {
|
|
1270
|
+
cells = cells.filter((k) => idOf(k) !== id);
|
|
1271
|
+
cur = Math.min(cur, cells.length - 1);
|
|
1272
|
+
max = false;
|
|
1273
|
+
render();
|
|
1274
|
+
return focusPane();
|
|
1275
|
+
} else if (at >= 0) cur = at;
|
|
1244
1276
|
else if (cells.length < CAP[layout]) { cells.push(id); cur = cells.length - 1; }
|
|
1245
1277
|
else cells[cur] = id;
|
|
1278
|
+
picked = null;
|
|
1246
1279
|
if (max) max = cells[cur] === id;
|
|
1247
1280
|
render();
|
|
1248
1281
|
focusPane();
|
|
@@ -1266,14 +1299,14 @@ function move(code) {
|
|
|
1266
1299
|
if (ok && d < bd) { bd = d; best = i; }
|
|
1267
1300
|
});
|
|
1268
1301
|
if (best < 0) return;
|
|
1269
|
-
cur = best;
|
|
1302
|
+
cur = best; picked = null;
|
|
1270
1303
|
if (max) render();
|
|
1271
1304
|
render(); focusPane();
|
|
1272
1305
|
}
|
|
1273
1306
|
function key(k) {
|
|
1274
1307
|
const { code, shift, alt, ctrl } = k;
|
|
1275
1308
|
if (!shift && !alt && !ctrl && code === 'Backslash') { toggleSide(); return true; }
|
|
1276
|
-
if (ctrl && !alt && !shift && /^Digit[
|
|
1309
|
+
if (ctrl && !alt && !shift && /^Digit[12]$/.test(code)) { setLayout(['focus', 'grid'][Number(code.slice(5)) - 1]); return true; }
|
|
1277
1310
|
if (alt && !ctrl && !shift && /^Arrow/.test(code)) { move(code); return true; }
|
|
1278
1311
|
if (alt && !ctrl && !shift && code === 'Digit0') { focusList(); return true; }
|
|
1279
1312
|
if (alt && !ctrl && !shift && /^Digit[1-9]$/.test(code)) { const id = shown()[Number(code.slice(5)) - 1]?.dataset.id; if (id) show(id); return true; }
|
|
@@ -1281,6 +1314,8 @@ function key(k) {
|
|
|
1281
1314
|
if (shift && !alt && !ctrl && code === 'Enter') { toggleMax(); return true; }
|
|
1282
1315
|
if (shift && !alt && !ctrl && code === 'KeyT') { const id = cells[cur] && idOf(cells[cur]); if (id) app({ t: 'tear', id }); return true; }
|
|
1283
1316
|
if (shift && !alt && !ctrl && code === 'KeyP') { app({ t: 'pause-all' }); return true; }
|
|
1317
|
+
// ⌘J from the hub's own chrome: the current pane's Claude terminal
|
|
1318
|
+
if (!shift && !alt && !ctrl && code === 'KeyJ') { const p = panes.get(cells[cur]); p?.frame.contentWindow?.postMessage({ hub: { t: 'term' } }, '*'); return !!p; }
|
|
1284
1319
|
return false;
|
|
1285
1320
|
}
|
|
1286
1321
|
addEventListener('keydown', (e) => {
|
|
@@ -1298,7 +1333,7 @@ addEventListener('message', (e) => {
|
|
|
1298
1333
|
const hit = [...panes.entries()].find(([, p]) => p.frame.contentWindow === e.source);
|
|
1299
1334
|
if (!hit) return;
|
|
1300
1335
|
const [k, p] = hit;
|
|
1301
|
-
if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
|
|
1336
|
+
if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && (i !== cur || picked)) { cur = i; picked = null; render(); } }
|
|
1302
1337
|
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}`; }
|
|
1303
1338
|
else if (m.t === 'close') { cells = cells.filter((x) => x !== k); render(); }
|
|
1304
1339
|
else if (m.t === 'page' && m.w > 0 && m.h > 0) {
|