claude-code-kanban 7.31.0 → 7.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/app.js +235 -37
- package/public/index.html +18 -3
- package/public/style.css +91 -17
- package/public/vendor/claude-hub-sdk.js +54 -10
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -4151,10 +4151,65 @@ function showNoSession() {
|
|
|
4151
4151
|
updateUrl();
|
|
4152
4152
|
sessionView.classList.remove('visible');
|
|
4153
4153
|
noSession.style.display = '';
|
|
4154
|
+
renderHomeKeys();
|
|
4154
4155
|
renderSessions();
|
|
4155
4156
|
renderActivityChip();
|
|
4156
4157
|
}
|
|
4157
4158
|
|
|
4159
|
+
// The home view: no session open. Each row runs its action on a click too.
|
|
4160
|
+
const HOME_ROWS = [
|
|
4161
|
+
{
|
|
4162
|
+
keys: ['Ctrl', 'Alt', 'N'],
|
|
4163
|
+
combo: true,
|
|
4164
|
+
hubMod: true,
|
|
4165
|
+
label: 'New session',
|
|
4166
|
+
run: openNewSession,
|
|
4167
|
+
when: terminalAvailable,
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
keys: ['Ctrl', 'Shift', 'K'],
|
|
4171
|
+
combo: true,
|
|
4172
|
+
label: 'Ask Kanbot',
|
|
4173
|
+
run: () => toggleKanbot(true, 'docked'),
|
|
4174
|
+
when: kanbotAvailable,
|
|
4175
|
+
},
|
|
4176
|
+
{ keys: ['Ctrl', '`'], combo: true, label: 'Show / hide terminal', run: toggleTerminal, when: terminalAvailable },
|
|
4177
|
+
{ keys: ['Ctrl', 'Shift', 'P'], combo: true, label: 'Find a session', run: openSessionPicker },
|
|
4178
|
+
{
|
|
4179
|
+
keys: ['Ctrl', 'Alt', 'Shift', 'S'],
|
|
4180
|
+
combo: true,
|
|
4181
|
+
hubMod: true,
|
|
4182
|
+
label: 'Next session that needs you',
|
|
4183
|
+
run: nextNeedsYou,
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
keys: ['Ctrl', 'Alt', 'S'],
|
|
4187
|
+
combo: true,
|
|
4188
|
+
hubMod: true,
|
|
4189
|
+
label: 'Back to the last session',
|
|
4190
|
+
run: swapToPreviousSession,
|
|
4191
|
+
},
|
|
4192
|
+
{ keys: ['?'], label: 'All shortcuts', run: showHelpModal },
|
|
4193
|
+
];
|
|
4194
|
+
|
|
4195
|
+
function renderHomeKeys() {
|
|
4196
|
+
const list = document.getElementById('home-keys');
|
|
4197
|
+
const rows = HOME_ROWS.filter((r) => (!r.when || r.when()) && helpKeys(r).length);
|
|
4198
|
+
list.innerHTML = rows
|
|
4199
|
+
.map(
|
|
4200
|
+
(row) =>
|
|
4201
|
+
`<button type="button" class="home-key"><span>${escapeHtml(row.label)}</span><span class="home-key-kbd">${keyChipsHtml(row)}</span></button>`,
|
|
4202
|
+
)
|
|
4203
|
+
.join('');
|
|
4204
|
+
list.querySelectorAll('.home-key').forEach((btn, i) => {
|
|
4205
|
+
btn.addEventListener('click', () => rows[i].run());
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
function goHome() {
|
|
4210
|
+
if (viewMode !== 'none') showNoSession();
|
|
4211
|
+
}
|
|
4212
|
+
|
|
4158
4213
|
// Filter pipeline: active filter → force-include revealed/current (non-pinned) sessions →
|
|
4159
4214
|
// project filter → search filter → ensure pinned/sticky sessions are always included.
|
|
4160
4215
|
// Pure over module state, so the session picker can ask for the same list without a render.
|
|
@@ -7105,6 +7160,7 @@ const SHORTCUT_TABS = [
|
|
|
7105
7160
|
{
|
|
7106
7161
|
title: 'View',
|
|
7107
7162
|
rows: [
|
|
7163
|
+
{ keys: ['H'], label: 'Home: close the session' },
|
|
7108
7164
|
{ keys: ['\\'], label: 'Toggle sidebar' },
|
|
7109
7165
|
{ keys: ['T'], label: 'Toggle theme' },
|
|
7110
7166
|
{ keys: ['Shift', 'S'], combo: true, label: 'Storage manager' },
|
|
@@ -7147,11 +7203,11 @@ const SHORTCUT_TABS = [
|
|
|
7147
7203
|
{
|
|
7148
7204
|
title: 'Sessions',
|
|
7149
7205
|
rows: [
|
|
7150
|
-
{ keys: ['Ctrl', 'Alt', 'N'], combo: true, hubMod: true, label: 'New session' },
|
|
7206
|
+
{ keys: ['Ctrl', 'Alt', 'N'], combo: true, hubMod: true, label: 'New session', cmd: 'session.new' },
|
|
7151
7207
|
{ keys: ['Ctrl', 'Alt', 'R'], combo: true, hubMod: true, label: 'Resume session (claude -r)' },
|
|
7152
7208
|
{ keys: ['Ctrl', 'Alt', 'S'], combo: true, hubMod: true, label: 'Swap to previous session' },
|
|
7153
7209
|
{ keys: ['Ctrl', 'Alt', 'Shift', 'S'], combo: true, hubMod: true, label: 'Next session that needs you' },
|
|
7154
|
-
{ keys: ['Shift', 'C'], combo: true, label: 'Copy session id' },
|
|
7210
|
+
{ keys: ['Shift', 'C'], combo: true, label: 'Copy session id', cmd: 'session.copyId' },
|
|
7155
7211
|
{ keys: ['Ctrl', 'Shift', 'C'], combo: true, label: 'Copy session name (SendMessage address)' },
|
|
7156
7212
|
],
|
|
7157
7213
|
},
|
|
@@ -7164,10 +7220,10 @@ const SHORTCUT_TABS = [
|
|
|
7164
7220
|
title: 'Terminal',
|
|
7165
7221
|
rows: [
|
|
7166
7222
|
{ keys: ['Ctrl', '`'], combo: true, label: 'Show / hide terminal' },
|
|
7167
|
-
{ keys: ['Alt', '`'], combo: true, label: 'Focus terminal / page' },
|
|
7223
|
+
{ keys: ['Alt', '`'], combo: true, label: 'Focus terminal / page; from a shell pane, sidebar and back' },
|
|
7168
7224
|
{ keys: ['Ctrl', 'Alt', '`'], combo: true, hubMod: true, label: 'Focus terminal / show card' },
|
|
7169
7225
|
{ keys: ['Alt', 'Shift', '`'], combo: true, label: 'End terminal' },
|
|
7170
|
-
{ keys: ['Ctrl', 'Shift', '`'], combo: true, label: 'All terminals' },
|
|
7226
|
+
{ keys: ['Ctrl', 'Shift', '`'], combo: true, label: 'All terminals', cmd: 'terminal.manager' },
|
|
7171
7227
|
{ keys: ['Ctrl', '+/−/0'], combo: true, label: 'Terminal text size' },
|
|
7172
7228
|
],
|
|
7173
7229
|
},
|
|
@@ -7246,6 +7302,12 @@ function termKbd() {
|
|
|
7246
7302
|
// The keys of a help row as they read on this system. The hub's modifier is Ctrl+Alt, and on
|
|
7247
7303
|
// macOS Control+Option for the tab numbers too (Windows and Linux use bare Alt for those). A hub
|
|
7248
7304
|
// row shows the keys the hub reports, which the user can change; row.keys until it answers.
|
|
7305
|
+
function keyChipsHtml(row, parts) {
|
|
7306
|
+
parts ??= helpKeys(row);
|
|
7307
|
+
const sep = row.combo ? '<span class="sc-plus">+</span>' : '<span class="sc-or">/</span>';
|
|
7308
|
+
return parts.map((k) => `<kbd>${escapeHtml(k)}</kbd>`).join(sep);
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7249
7311
|
function helpKeys(row, mac = IS_MAC, keyLabel = hub.keyLabel) {
|
|
7250
7312
|
const live = row.action && keyLabel(row.action);
|
|
7251
7313
|
if (live) return live;
|
|
@@ -7279,8 +7341,7 @@ function buildHelpShortcuts(groups) {
|
|
|
7279
7341
|
}
|
|
7280
7342
|
const parts = row && helpKeys(row);
|
|
7281
7343
|
if (!parts?.length) continue;
|
|
7282
|
-
const
|
|
7283
|
-
const keys = parts.map((k) => `<kbd>${escapeHtml(k)}</kbd>`).join(sep);
|
|
7344
|
+
const keys = keyChipsHtml(row, parts);
|
|
7284
7345
|
const label = escapeHtml(row.label);
|
|
7285
7346
|
cells.push(`<dt class="${escapeHtml(side)}">${keys}</dt><dd class="${escapeHtml(side)}">${label}</dd>`);
|
|
7286
7347
|
}
|
|
@@ -8289,6 +8350,12 @@ function shiftOnly(e, code) {
|
|
|
8289
8350
|
return e.code === code && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey;
|
|
8290
8351
|
}
|
|
8291
8352
|
|
|
8353
|
+
// The combo of a press as the hub names it: the character on a Latin layout, the US key in the same
|
|
8354
|
+
// place on any other, so a letter key works whatever the input language.
|
|
8355
|
+
function comboIs(e, ...combos) {
|
|
8356
|
+
return combos.includes(ClaudeHub.comboOf(e));
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8292
8359
|
// xterm runs in another process, so blur() in the board leaves it focused and the modal's arrow keys go
|
|
8293
8360
|
// to it. Focusing a board element takes the focus.
|
|
8294
8361
|
function toggleLastMessage() {
|
|
@@ -8823,6 +8890,11 @@ document.addEventListener('keydown', (e) => {
|
|
|
8823
8890
|
});
|
|
8824
8891
|
return;
|
|
8825
8892
|
}
|
|
8893
|
+
if (matchKey(e, 'KeyH')) {
|
|
8894
|
+
e.preventDefault();
|
|
8895
|
+
goHome();
|
|
8896
|
+
return;
|
|
8897
|
+
}
|
|
8826
8898
|
if (matchKey(e, 'KeyT')) {
|
|
8827
8899
|
e.preventDefault();
|
|
8828
8900
|
toggleTheme();
|
|
@@ -9489,7 +9561,7 @@ function onReviewOfferKey(e) {
|
|
|
9489
9561
|
sendReview();
|
|
9490
9562
|
return;
|
|
9491
9563
|
}
|
|
9492
|
-
if (reviewPopMode !== 'offer' || !
|
|
9564
|
+
if (reviewPopMode !== 'offer' || !comboIs(e, 'c')) return;
|
|
9493
9565
|
e.preventDefault();
|
|
9494
9566
|
e.stopImmediatePropagation();
|
|
9495
9567
|
reviewPopEl().querySelector('.review-offer-btn').click();
|
|
@@ -13196,6 +13268,56 @@ const spPeekCache = new Map();
|
|
|
13196
13268
|
let spScope = 'board';
|
|
13197
13269
|
let spRecent = { rows: [], limit: 0, hasMore: true, loading: false };
|
|
13198
13270
|
let spRowEls = [];
|
|
13271
|
+
// A query that starts with '>' lists commands in place of sessions. A command runs on the session
|
|
13272
|
+
// that was current when the picker opened; `when` hides it when that session cannot run it.
|
|
13273
|
+
// A command's key comes from the shortcut help row whose `opens` or `cmd` is the command's id.
|
|
13274
|
+
let spCommandMode = false;
|
|
13275
|
+
let spTarget = null;
|
|
13276
|
+
const SP_COMMANDS = [
|
|
13277
|
+
{
|
|
13278
|
+
id: 'session.openInEditor',
|
|
13279
|
+
title: 'Open project in editor',
|
|
13280
|
+
when: (s) => !!s?.project,
|
|
13281
|
+
run: (s) => openFolderInEditor(s.project),
|
|
13282
|
+
},
|
|
13283
|
+
{
|
|
13284
|
+
id: 'session.copyId',
|
|
13285
|
+
title: 'Copy session ID',
|
|
13286
|
+
when: (s) => !!s,
|
|
13287
|
+
run: (s) => copyText(s.id, 'session id', `Copied session id: ${s.id.slice(0, 8)}`),
|
|
13288
|
+
},
|
|
13289
|
+
{
|
|
13290
|
+
id: 'session.cost',
|
|
13291
|
+
title: 'Show session cost',
|
|
13292
|
+
when: (s) => !!s && hub.can('session.cost'),
|
|
13293
|
+
run: (s) => openCost(s.id),
|
|
13294
|
+
},
|
|
13295
|
+
{
|
|
13296
|
+
id: 'project.plugins',
|
|
13297
|
+
title: 'Show project plugins',
|
|
13298
|
+
when: (s) => !!s?.project && hub.can('project.plugins'),
|
|
13299
|
+
run: (s) => openMarketplace(s.id),
|
|
13300
|
+
},
|
|
13301
|
+
{
|
|
13302
|
+
id: 'project.memory',
|
|
13303
|
+
title: 'Show project memory',
|
|
13304
|
+
when: (s) => !!s?.project && hub.can('project.memory'),
|
|
13305
|
+
run: (s) => openMemory(s.id),
|
|
13306
|
+
},
|
|
13307
|
+
{ id: 'session.new', title: 'New session', when: terminalAvailable, run: (s) => openNewSession(s?.project ?? null) },
|
|
13308
|
+
{
|
|
13309
|
+
id: 'session.shell',
|
|
13310
|
+
title: 'New terminal shell',
|
|
13311
|
+
when: (s) => !!s && terminalAvailable() && !!getSessionBaseDir(s.id),
|
|
13312
|
+
run: (s) => openShellForSession(s.id),
|
|
13313
|
+
},
|
|
13314
|
+
{ id: 'terminal.manager', title: 'Open terminal manager', when: terminalAvailable, run: openTerminalManager },
|
|
13315
|
+
];
|
|
13316
|
+
const SP_COMMAND_KEYS = new Map(
|
|
13317
|
+
SHORTCUT_TABS.flatMap((t) => t.groups.flatMap((g) => g.rows))
|
|
13318
|
+
.filter((r) => r.opens || r.cmd)
|
|
13319
|
+
.map((r) => [r.opens || r.cmd, r]),
|
|
13320
|
+
);
|
|
13199
13321
|
const SP_RECENT_PAGE = 50;
|
|
13200
13322
|
const SP_RECENT_TAIL = 5;
|
|
13201
13323
|
|
|
@@ -13235,7 +13357,8 @@ function spSetScope(scope) {
|
|
|
13235
13357
|
|
|
13236
13358
|
// Also run after each load: a page too short to scroll gives no scroll event.
|
|
13237
13359
|
function spLoadMoreNearEnd() {
|
|
13238
|
-
if (spScope === 'all')
|
|
13360
|
+
if (!spCommandMode && spScope === 'all')
|
|
13361
|
+
loadMoreIfNearEnd(document.getElementById('session-picker-list'), spLoadRecent);
|
|
13239
13362
|
}
|
|
13240
13363
|
|
|
13241
13364
|
const spSearch = sessionSearch(() => {
|
|
@@ -13248,6 +13371,7 @@ function openSessionPicker({ query = '', ranked = null } = {}) {
|
|
|
13248
13371
|
input.value = query;
|
|
13249
13372
|
spRanked = ranked;
|
|
13250
13373
|
spSource = getFilteredSessions().sort((a, b) => Date.parse(b.modifiedAt) - Date.parse(a.modifiedAt));
|
|
13374
|
+
spTarget = sessions.find((s) => s.id === currentSessionId) ?? null;
|
|
13251
13375
|
spPeekCache.clear();
|
|
13252
13376
|
spRenderedQuery = null;
|
|
13253
13377
|
spRecent = { rows: [], limit: 0, hasMore: true, loading: false };
|
|
@@ -13367,9 +13491,45 @@ function spPinHtml(session) {
|
|
|
13367
13491
|
return '<span class="sp-pin"></span>';
|
|
13368
13492
|
}
|
|
13369
13493
|
|
|
13494
|
+
function renderPickerCommands(list, query) {
|
|
13495
|
+
const selectedId = spRows[spIdx]?.id;
|
|
13496
|
+
spRows = SP_COMMANDS.filter((c) => c.when(spTarget) && fuzzyMatch(c.title, query));
|
|
13497
|
+
const target = spTarget
|
|
13498
|
+
? `<div class="sp-target">Session: <b>${escapeHtml(sessionDisplayName(spTarget))}</b>${spTarget.project ? ` · ${escapeHtml(pathBasename(spTarget.project))}` : ''}</div>`
|
|
13499
|
+
: '<div class="sp-target">No current session</div>';
|
|
13500
|
+
const rows = spRows
|
|
13501
|
+
.map((c, i) => {
|
|
13502
|
+
const keyRow = SP_COMMAND_KEYS.get(c.id);
|
|
13503
|
+
const keys = keyRow ? `<span class="sp-keys">${keyChipsHtml(keyRow)}</span>` : '';
|
|
13504
|
+
return `<button class="sp-row" data-idx="${i}"><span class="sp-name">${escapeHtml(c.title)}</span>${keys}</button>`;
|
|
13505
|
+
})
|
|
13506
|
+
.join('');
|
|
13507
|
+
list.innerHTML = target + (rows || '<div class="sp-empty">No command matches</div>');
|
|
13508
|
+
spRowEls = list.querySelectorAll('.sp-row');
|
|
13509
|
+
spIdx = -1;
|
|
13510
|
+
spSelect(
|
|
13511
|
+
Math.max(
|
|
13512
|
+
0,
|
|
13513
|
+
spRows.findIndex((c) => c.id === selectedId),
|
|
13514
|
+
),
|
|
13515
|
+
);
|
|
13516
|
+
}
|
|
13517
|
+
|
|
13370
13518
|
function renderSessionPicker() {
|
|
13371
13519
|
const list = document.getElementById('session-picker-list');
|
|
13372
|
-
const
|
|
13520
|
+
const raw = document.getElementById('session-picker-input').value.trimStart();
|
|
13521
|
+
const commandMode = raw.startsWith('>');
|
|
13522
|
+
if (commandMode !== spCommandMode) {
|
|
13523
|
+
spCommandMode = commandMode;
|
|
13524
|
+
if (commandMode) spSetPeeking(false);
|
|
13525
|
+
_modalEl('session-picker-modal').classList.toggle('commands', commandMode);
|
|
13526
|
+
}
|
|
13527
|
+
if (commandMode) {
|
|
13528
|
+
spRenderedQuery = null;
|
|
13529
|
+
renderPickerCommands(list, raw.slice(1).trim());
|
|
13530
|
+
return;
|
|
13531
|
+
}
|
|
13532
|
+
const query = raw.trim();
|
|
13373
13533
|
// Rows that arrive for the same query and scope append below, so the cursor stays on its row.
|
|
13374
13534
|
const renderKey = `${spScope}\n${query}`;
|
|
13375
13535
|
const selectedId = renderKey === spRenderedQuery ? spRows[spIdx]?.id : null;
|
|
@@ -13427,10 +13587,17 @@ function spSelect(idx) {
|
|
|
13427
13587
|
row?.classList.add('selected');
|
|
13428
13588
|
row?.scrollIntoView({ block: 'nearest' });
|
|
13429
13589
|
spSchedulePeek();
|
|
13430
|
-
if (spScope === 'all' && spIdx >= spRows.length - 5) spLoadRecent();
|
|
13590
|
+
if (!spCommandMode && spScope === 'all' && spIdx >= spRows.length - 5) spLoadRecent();
|
|
13431
13591
|
}
|
|
13432
13592
|
|
|
13433
13593
|
async function spOpen(idx) {
|
|
13594
|
+
if (spCommandMode) {
|
|
13595
|
+
const command = spRows[idx];
|
|
13596
|
+
if (!command) return;
|
|
13597
|
+
closeSessionPicker();
|
|
13598
|
+
command.run(spTarget);
|
|
13599
|
+
return;
|
|
13600
|
+
}
|
|
13434
13601
|
const session = spRows[idx];
|
|
13435
13602
|
if (!session) return;
|
|
13436
13603
|
closeSessionPicker({ refocus: false });
|
|
@@ -13447,12 +13614,14 @@ function initSessionPicker() {
|
|
|
13447
13614
|
// Bound on the input: the global handler returns early on INPUT targets.
|
|
13448
13615
|
input.addEventListener('keydown', (e) => {
|
|
13449
13616
|
if (e.key === 'Escape') closeSessionPicker();
|
|
13450
|
-
else if (matchKey(e, 'ArrowDown') || (e
|
|
13451
|
-
else if (matchKey(e, 'ArrowUp') || (e
|
|
13617
|
+
else if (matchKey(e, 'ArrowDown') || comboIs(e, 'ctrl+n', 'ctrl+shift+n')) spSelect(spIdx + 1);
|
|
13618
|
+
else if (matchKey(e, 'ArrowUp') || comboIs(e, 'ctrl+p')) spSelect(spIdx - 1);
|
|
13452
13619
|
else if (e.key === 'Enter') spOpen(spIdx);
|
|
13453
|
-
else if (e.ctrlKey && e.code === 'Space')
|
|
13454
|
-
|
|
13455
|
-
else
|
|
13620
|
+
else if (e.ctrlKey && e.code === 'Space') {
|
|
13621
|
+
if (!spCommandMode) spSetPeeking(!spIsPeeking());
|
|
13622
|
+
} else if (e.key === 'Tab' && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
|
13623
|
+
if (!spCommandMode) spSetScope(spScope === 'all' ? 'board' : 'all');
|
|
13624
|
+
} else return;
|
|
13456
13625
|
e.preventDefault();
|
|
13457
13626
|
e.stopPropagation();
|
|
13458
13627
|
});
|
|
@@ -13569,8 +13738,8 @@ function initProjectPicker() {
|
|
|
13569
13738
|
input.addEventListener('input', renderProjectPicker);
|
|
13570
13739
|
input.addEventListener('keydown', (e) => {
|
|
13571
13740
|
if (e.key === 'Escape') closeProjectPicker();
|
|
13572
|
-
else if (matchKey(e, 'ArrowDown') || (e
|
|
13573
|
-
else if (matchKey(e, 'ArrowUp') || (e
|
|
13741
|
+
else if (matchKey(e, 'ArrowDown') || comboIs(e, 'ctrl+n', 'ctrl+shift+n')) ppSelect(ppIdx + 1);
|
|
13742
|
+
else if (matchKey(e, 'ArrowUp') || comboIs(e, 'ctrl+p')) ppSelect(ppIdx - 1);
|
|
13574
13743
|
else if (e.key === 'Enter') ppApply(ppIdx);
|
|
13575
13744
|
else if (e.altKey && !e.ctrlKey && !e.metaKey && e.code === 'KeyR') {
|
|
13576
13745
|
if (!e.repeat) ppToggleRecentOnly();
|
|
@@ -13969,7 +14138,6 @@ function openPlanInEditor() {
|
|
|
13969
14138
|
postAndToast(apiPath`/api/sessions/${_planSessionId}/plan/open`, {}, 'in editor');
|
|
13970
14139
|
}
|
|
13971
14140
|
|
|
13972
|
-
// biome-ignore lint/correctness/noUnusedVariables: used in HTML
|
|
13973
14141
|
function openFolderInEditor(folder, file) {
|
|
13974
14142
|
const body = {};
|
|
13975
14143
|
if (folder) body.folder = folder;
|
|
@@ -16219,8 +16387,23 @@ async function swapToPreviousSession() {
|
|
|
16219
16387
|
await revealSession(target);
|
|
16220
16388
|
}
|
|
16221
16389
|
|
|
16390
|
+
// A shell types the keys that reach the sidebar, so Alt+` takes a shell pane there and back.
|
|
16391
|
+
let shellLeftForSidebar = null;
|
|
16392
|
+
|
|
16222
16393
|
// Esc belongs to Claude, so leaving the terminal without hiding it needs its own key.
|
|
16223
16394
|
function toggleTerminalFocus() {
|
|
16395
|
+
const active = document.activeElement;
|
|
16396
|
+
if (shellFrames.has(active)) {
|
|
16397
|
+
leaveTerminalPane();
|
|
16398
|
+
shellLeftForSidebar = active;
|
|
16399
|
+
return;
|
|
16400
|
+
}
|
|
16401
|
+
const shell = shellLeftForSidebar;
|
|
16402
|
+
shellLeftForSidebar = null;
|
|
16403
|
+
if (shell && focusZone === 'sidebar' && paneFocusTarget(activePaneView()) === shell) {
|
|
16404
|
+
focusActivePane();
|
|
16405
|
+
return;
|
|
16406
|
+
}
|
|
16224
16407
|
if (!wantsTerminal()) {
|
|
16225
16408
|
toggleTerminal();
|
|
16226
16409
|
return;
|
|
@@ -16862,11 +17045,13 @@ function restoreTerminalFocus(zone, sessionId) {
|
|
|
16862
17045
|
|
|
16863
17046
|
// The terminal stands in for the board, so it takes the board zone however focus arrives
|
|
16864
17047
|
// (Tab, Alt+`, a click); leaveTerminalPane hands it back to the sidebar.
|
|
16865
|
-
|
|
17048
|
+
function takeBoardZone() {
|
|
16866
17049
|
if (focusZone !== 'sidebar') return;
|
|
16867
17050
|
clearKbSelection();
|
|
16868
17051
|
focusZone = 'board';
|
|
16869
|
-
}
|
|
17052
|
+
}
|
|
17053
|
+
document.getElementById('terminal-pane').addEventListener('focusin', takeBoardZone);
|
|
17054
|
+
paneViews.addEventListener('focusin', takeBoardZone);
|
|
16870
17055
|
|
|
16871
17056
|
function detachTerminal() {
|
|
16872
17057
|
const had = termState.socket;
|
|
@@ -17286,7 +17471,7 @@ function ensureKanbotPopover() {
|
|
|
17286
17471
|
return el;
|
|
17287
17472
|
}
|
|
17288
17473
|
|
|
17289
|
-
function setKanbotLayout(layout) {
|
|
17474
|
+
function setKanbotLayout(layout, save = true) {
|
|
17290
17475
|
const el = kanbotState.el;
|
|
17291
17476
|
const docked = layout === 'docked';
|
|
17292
17477
|
const expanded = layout === 'expanded';
|
|
@@ -17301,7 +17486,7 @@ function setKanbotLayout(layout) {
|
|
|
17301
17486
|
expand.innerHTML = showIcon(expanded ? 'restore' : 'expand');
|
|
17302
17487
|
expand.title = expanded ? 'Restore' : 'Expand';
|
|
17303
17488
|
expand.setAttribute('aria-label', expand.title);
|
|
17304
|
-
store.setItem(KANBOT_LAYOUT_KEY, layout);
|
|
17489
|
+
if (save) store.setItem(KANBOT_LAYOUT_KEY, layout);
|
|
17305
17490
|
postToKanbotFrame('focus');
|
|
17306
17491
|
}
|
|
17307
17492
|
|
|
@@ -17329,8 +17514,10 @@ function setKanbotAttached(on) {
|
|
|
17329
17514
|
syncCloseGuard();
|
|
17330
17515
|
}
|
|
17331
17516
|
|
|
17332
|
-
|
|
17517
|
+
// `layout` applies for this page only; the saved layout comes back on reload.
|
|
17518
|
+
function toggleKanbot(force, layout) {
|
|
17333
17519
|
const el = ensureKanbotPopover();
|
|
17520
|
+
if (layout) setKanbotLayout(layout, false);
|
|
17334
17521
|
const show = typeof force === 'boolean' ? force : !el.classList.contains('visible');
|
|
17335
17522
|
const wasShown = el.classList.contains('visible');
|
|
17336
17523
|
el.classList.toggle('visible', show);
|
|
@@ -17815,6 +18002,8 @@ const SHOW_ICONS = {
|
|
|
17815
18002
|
dock: '<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM15 3v18"/>',
|
|
17816
18003
|
clear: '<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/>',
|
|
17817
18004
|
close: '<path d="M18 6L6 18M6 6l12 12"/>',
|
|
18005
|
+
alert: '<circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16h.01"/>',
|
|
18006
|
+
upgrade: '<circle cx="12" cy="12" r="9"/><path d="M12 16V8M8.5 11.5 12 8l3.5 3.5"/>',
|
|
17818
18007
|
pane: '<use href="#icon-pane"/>',
|
|
17819
18008
|
card: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M13 4v7h8"/>',
|
|
17820
18009
|
external: '<path d="M15 3h6v6M10 14L21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
|
|
@@ -19397,15 +19586,14 @@ function renderFolderList() {
|
|
|
19397
19586
|
const query = input.value.trim();
|
|
19398
19587
|
const all = knownFolders();
|
|
19399
19588
|
ns.matches = (query && query !== ns.folder ? rankFolders(all, query) : all).slice(0, NS_MAX_MATCHES);
|
|
19589
|
+
if (!ns.matches.length) return closeFolderList();
|
|
19400
19590
|
if (ns.idx >= ns.matches.length) ns.idx = ns.matches.length - 1;
|
|
19401
|
-
list.innerHTML = ns.matches
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
.join('')
|
|
19408
|
-
: '<div class="ns-empty"><span>No project matches</span><button type="button" class="btn btn-secondary ns-browse" data-browse>Browse…</button></div>';
|
|
19591
|
+
list.innerHTML = ns.matches
|
|
19592
|
+
.map(
|
|
19593
|
+
(p, i) =>
|
|
19594
|
+
`<div class="ns-option${i === ns.idx ? ' active' : ''}" role="option" data-idx="${i}" aria-selected="${i === ns.idx}"><span class="ns-option-name">${escapeHtml(pathBasename(p))}</span><span class="ns-option-path">${escapeHtml(p)}</span></div>`,
|
|
19595
|
+
)
|
|
19596
|
+
.join('');
|
|
19409
19597
|
list.hidden = false;
|
|
19410
19598
|
input.setAttribute('aria-expanded', 'true');
|
|
19411
19599
|
}
|
|
@@ -19502,6 +19690,7 @@ function setNewSessionBusy(on) {
|
|
|
19502
19690
|
renderNewSessionForm();
|
|
19503
19691
|
}
|
|
19504
19692
|
|
|
19693
|
+
// biome-ignore lint/correctness/noUnusedVariables: used in HTML
|
|
19505
19694
|
async function browseNewSessionFolder() {
|
|
19506
19695
|
if (ns.busy) return;
|
|
19507
19696
|
closeFolderList();
|
|
@@ -19700,7 +19889,6 @@ function initNewSession() {
|
|
|
19700
19889
|
// mousedown, not click: the input's blur would close the list before a click lands.
|
|
19701
19890
|
list.addEventListener('mousedown', (e) => {
|
|
19702
19891
|
e.preventDefault();
|
|
19703
|
-
if (e.target.closest('[data-browse]')) return browseNewSessionFolder();
|
|
19704
19892
|
const row = e.target.closest('.ns-option');
|
|
19705
19893
|
if (row) pickFolderOption(Number(row.dataset.idx));
|
|
19706
19894
|
});
|
|
@@ -19978,18 +20166,25 @@ function pluginWarning(plugin) {
|
|
|
19978
20166
|
mismatch: `Plugin ${plugin.installed} is installed, this board ships ${plugin.bundled}`,
|
|
19979
20167
|
}[plugin.state];
|
|
19980
20168
|
if (!problem) return null;
|
|
19981
|
-
|
|
19982
|
-
|
|
19983
|
-
|
|
20169
|
+
let fix = 'Enable it with /plugin in Claude Code.';
|
|
20170
|
+
if (plugin.state !== 'disabled')
|
|
20171
|
+
fix = hub.can('hub.updates')
|
|
20172
|
+
? 'Click to update the plugins.'
|
|
19984
20173
|
: `Click to copy: ${plugin.installCommand}\nThen restart open sessions, they keep the old hooks.`;
|
|
19985
20174
|
const btn = document.createElement('button');
|
|
19986
20175
|
btn.type = 'button';
|
|
19987
20176
|
btn.className = 'footer-plugin-warning';
|
|
19988
|
-
btn.
|
|
20177
|
+
btn.dataset.state = plugin.state;
|
|
20178
|
+
const [icon, word] = { missing: ['upgrade', 'install'], disabled: ['alert', 'off'], mismatch: ['upgrade', 'update'] }[
|
|
20179
|
+
plugin.state
|
|
20180
|
+
];
|
|
20181
|
+
btn.innerHTML = showIcon(icon) + word;
|
|
19989
20182
|
btn.title = `${problem} (${plugin.configDir}).\n${fix}`;
|
|
19990
20183
|
btn.setAttribute('aria-label', problem);
|
|
19991
20184
|
if (plugin.state !== 'disabled') {
|
|
19992
|
-
btn.addEventListener('click', () =>
|
|
20185
|
+
btn.addEventListener('click', () =>
|
|
20186
|
+
hub.can('hub.updates') ? hub.invoke('hub.updates') : copyText(plugin.installCommand, 'install command'),
|
|
20187
|
+
);
|
|
19993
20188
|
}
|
|
19994
20189
|
return btn;
|
|
19995
20190
|
}
|
|
@@ -20058,6 +20253,7 @@ getJson('/api/config')
|
|
|
20058
20253
|
.then((c) => {
|
|
20059
20254
|
if (c) appConfig = c;
|
|
20060
20255
|
syncTerminalHost();
|
|
20256
|
+
renderHomeKeys();
|
|
20061
20257
|
if (appConfig.kanbot && footerState.version) renderSidebarFooter(footerState.rl);
|
|
20062
20258
|
})
|
|
20063
20259
|
.then(restorePendingSessions)
|
|
@@ -20153,6 +20349,8 @@ hub.onActive((active) => {
|
|
|
20153
20349
|
pushTerminalClaims();
|
|
20154
20350
|
});
|
|
20155
20351
|
hub.onStatus(pushTerminalClaims);
|
|
20352
|
+
// A hub before SDK 1.12 has no onKeys.
|
|
20353
|
+
hub.onKeys?.(pushTerminalClaims);
|
|
20156
20354
|
hub.onSettings(applyHubSettings);
|
|
20157
20355
|
hub.handle('session.open', (p) => p.session && openSessionFromOutside(p.session));
|
|
20158
20356
|
hub.handle('session.find', (p) => findSessionFromHub(p));
|
package/public/index.html
CHANGED
|
@@ -82,6 +82,19 @@
|
|
|
82
82
|
<span class="section-header-label">Sessions</span>
|
|
83
83
|
<span id="filter-summary" class="filter-summary" title=""></span>
|
|
84
84
|
<span class="section-header-actions">
|
|
85
|
+
<button
|
|
86
|
+
id="home-btn"
|
|
87
|
+
class="icon-btn section-btn"
|
|
88
|
+
onclick="event.stopPropagation(); goHome()"
|
|
89
|
+
title="Home: close the session (H)"
|
|
90
|
+
aria-label="Home: close the session"
|
|
91
|
+
>
|
|
92
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
93
|
+
<path d="M3 11l9-8 9 8"/>
|
|
94
|
+
<path d="M5 10v10h14V10"/>
|
|
95
|
+
<path d="M10 20v-6h4v6"/>
|
|
96
|
+
</svg>
|
|
97
|
+
</button>
|
|
85
98
|
<button
|
|
86
99
|
id="zen-mode-btn"
|
|
87
100
|
class="icon-btn section-btn"
|
|
@@ -227,8 +240,9 @@
|
|
|
227
240
|
<div class="idle-clawd" data-hub-part="idle-mascot" aria-hidden="true">
|
|
228
241
|
<svg class="clawd" viewBox="1 0 16 10" shape-rendering="crispEdges"><use href="#clawd-shape"/></svg>
|
|
229
242
|
</div>
|
|
230
|
-
<p class="idle-title">
|
|
231
|
-
<div
|
|
243
|
+
<p class="idle-title">No session open</p>
|
|
244
|
+
<div id="home-keys" class="home-keys"></div>
|
|
245
|
+
<div class="idle-hint sp-hint"><kbd>↑</kbd><kbd>↓</kbd> move <span>·</span> <kbd>Enter</kbd> open</div>
|
|
232
246
|
</div>
|
|
233
247
|
</div>
|
|
234
248
|
|
|
@@ -1002,7 +1016,8 @@
|
|
|
1002
1016
|
<div id="session-picker-list" class="sp-list"></div>
|
|
1003
1017
|
<div id="session-picker-peek" class="sp-peek"></div>
|
|
1004
1018
|
</div>
|
|
1005
|
-
<div class="sp-hint"><kbd>↑</kbd><kbd>↓</kbd> move · <kbd>Enter</kbd> open · <kbd>Tab</kbd> board / all · <kbd>Ctrl</kbd><kbd>Space</kbd> peek · <kbd>Esc</kbd> close</div>
|
|
1019
|
+
<div class="sp-hint sp-hint-sessions"><kbd>↑</kbd><kbd>↓</kbd> move · <kbd>Enter</kbd> open · <kbd>Tab</kbd> board / all · <kbd>Ctrl</kbd><kbd>Space</kbd> peek · <kbd>></kbd> commands · <kbd>Esc</kbd> close</div>
|
|
1020
|
+
<div class="sp-hint sp-hint-commands"><kbd>↑</kbd><kbd>↓</kbd> move · <kbd>Enter</kbd> run · <kbd>Backspace</kbd> on <kbd>></kbd> back to sessions · <kbd>Esc</kbd> close</div>
|
|
1006
1021
|
</div>
|
|
1007
1022
|
</div>
|
|
1008
1023
|
|
package/public/style.css
CHANGED
|
@@ -1689,19 +1689,33 @@ body.booting .boot-splash {
|
|
|
1689
1689
|
/* #endregion */
|
|
1690
1690
|
|
|
1691
1691
|
.sidebar-footer .footer-plugin-warning {
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1692
|
+
display: inline-flex;
|
|
1693
|
+
align-items: center;
|
|
1694
|
+
gap: 3px;
|
|
1695
|
+
padding: 2px 7px 2px 5px;
|
|
1696
|
+
border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
|
|
1697
|
+
border-radius: 999px;
|
|
1698
|
+
background: var(--warning-dim);
|
|
1695
1699
|
font: inherit;
|
|
1696
|
-
font-size:
|
|
1700
|
+
font-size: 10.5px;
|
|
1697
1701
|
line-height: 1;
|
|
1698
1702
|
color: var(--warning);
|
|
1699
1703
|
cursor: pointer;
|
|
1700
1704
|
}
|
|
1701
1705
|
|
|
1702
|
-
.sidebar-footer .footer-plugin-warning
|
|
1706
|
+
.sidebar-footer .footer-plugin-warning svg {
|
|
1707
|
+
width: 11px;
|
|
1708
|
+
height: 11px;
|
|
1709
|
+
flex-shrink: 0;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
.sidebar-footer .footer-plugin-warning[data-state='disabled'] {
|
|
1713
|
+
cursor: default;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
.sidebar-footer .footer-plugin-warning:not([data-state='disabled']):hover,
|
|
1703
1717
|
.sidebar-footer .footer-plugin-warning:focus-visible {
|
|
1704
|
-
|
|
1718
|
+
background: color-mix(in srgb, var(--warning) 28%, transparent);
|
|
1705
1719
|
}
|
|
1706
1720
|
|
|
1707
1721
|
.sidebar.collapsed {
|
|
@@ -1874,6 +1888,44 @@ body.booting .boot-splash {
|
|
|
1874
1888
|
opacity: 0.5;
|
|
1875
1889
|
}
|
|
1876
1890
|
|
|
1891
|
+
.home-keys {
|
|
1892
|
+
display: grid;
|
|
1893
|
+
gap: 2px;
|
|
1894
|
+
width: min(420px, 90%);
|
|
1895
|
+
margin: 6px 0 4px;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
.home-key {
|
|
1899
|
+
display: flex;
|
|
1900
|
+
align-items: center;
|
|
1901
|
+
justify-content: space-between;
|
|
1902
|
+
gap: 16px;
|
|
1903
|
+
padding: 6px 10px;
|
|
1904
|
+
border: none;
|
|
1905
|
+
border-radius: 6px;
|
|
1906
|
+
background: none;
|
|
1907
|
+
color: var(--text-secondary);
|
|
1908
|
+
font: inherit;
|
|
1909
|
+
font-size: 13px;
|
|
1910
|
+
text-align: left;
|
|
1911
|
+
white-space: nowrap;
|
|
1912
|
+
cursor: pointer;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
.home-key:hover,
|
|
1916
|
+
.home-key:focus-visible {
|
|
1917
|
+
background: var(--bg-hover);
|
|
1918
|
+
color: var(--text-primary);
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.home-key-kbd {
|
|
1922
|
+
display: inline-flex;
|
|
1923
|
+
align-items: center;
|
|
1924
|
+
gap: 3px;
|
|
1925
|
+
color: var(--text-muted);
|
|
1926
|
+
font-size: 11px;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1877
1929
|
@media (prefers-reduced-motion: reduce) {
|
|
1878
1930
|
.idle-glow span,
|
|
1879
1931
|
.idle-clawd .clawd,
|
|
@@ -9161,6 +9213,8 @@ body.light .msg-assistant .msg-text {
|
|
|
9161
9213
|
|
|
9162
9214
|
/* keycap chips: elevated fill + thicker bottom border reads as a key */
|
|
9163
9215
|
.sp-hint kbd,
|
|
9216
|
+
.sp-keys kbd,
|
|
9217
|
+
.home-keys kbd,
|
|
9164
9218
|
.shortcuts kbd,
|
|
9165
9219
|
.terminal-boot-slow kbd,
|
|
9166
9220
|
.review-offer-btn kbd {
|
|
@@ -9187,7 +9241,11 @@ body.light .msg-assistant .msg-text {
|
|
|
9187
9241
|
}
|
|
9188
9242
|
|
|
9189
9243
|
.shortcuts .sc-plus,
|
|
9190
|
-
.shortcuts .sc-or
|
|
9244
|
+
.shortcuts .sc-or,
|
|
9245
|
+
.home-keys .sc-plus,
|
|
9246
|
+
.home-keys .sc-or,
|
|
9247
|
+
.sp-keys .sc-plus,
|
|
9248
|
+
.sp-keys .sc-or {
|
|
9191
9249
|
color: var(--text-muted);
|
|
9192
9250
|
font-size: 11px;
|
|
9193
9251
|
}
|
|
@@ -9948,6 +10006,32 @@ select.form-input option:checked {
|
|
|
9948
10006
|
font-size: 11px;
|
|
9949
10007
|
}
|
|
9950
10008
|
|
|
10009
|
+
.modal.session-picker.commands .sp-scope,
|
|
10010
|
+
.modal.session-picker.commands .sp-peek,
|
|
10011
|
+
.modal.session-picker.commands .sp-hint-sessions,
|
|
10012
|
+
.modal.session-picker:not(.commands) .sp-hint-commands {
|
|
10013
|
+
display: none;
|
|
10014
|
+
}
|
|
10015
|
+
|
|
10016
|
+
.sp-target {
|
|
10017
|
+
padding: 2px 8px 4px;
|
|
10018
|
+
color: var(--text-muted);
|
|
10019
|
+
font-family: var(--mono);
|
|
10020
|
+
font-size: 11.5px;
|
|
10021
|
+
}
|
|
10022
|
+
|
|
10023
|
+
.sp-keys {
|
|
10024
|
+
margin-left: auto;
|
|
10025
|
+
display: flex;
|
|
10026
|
+
align-items: center;
|
|
10027
|
+
gap: 3px;
|
|
10028
|
+
}
|
|
10029
|
+
|
|
10030
|
+
.sp-target b {
|
|
10031
|
+
color: var(--text-primary);
|
|
10032
|
+
font-weight: 500;
|
|
10033
|
+
}
|
|
10034
|
+
|
|
9951
10035
|
.pp-chips {
|
|
9952
10036
|
display: flex;
|
|
9953
10037
|
gap: 6px;
|
|
@@ -10122,16 +10206,6 @@ select.form-input option:checked {
|
|
|
10122
10206
|
color: var(--text-muted);
|
|
10123
10207
|
}
|
|
10124
10208
|
|
|
10125
|
-
.ns-empty {
|
|
10126
|
-
display: flex;
|
|
10127
|
-
align-items: center;
|
|
10128
|
-
justify-content: space-between;
|
|
10129
|
-
gap: 8px;
|
|
10130
|
-
padding: 6px 8px;
|
|
10131
|
-
font-size: 12px;
|
|
10132
|
-
color: var(--text-muted);
|
|
10133
|
-
}
|
|
10134
|
-
|
|
10135
10209
|
.ns-check {
|
|
10136
10210
|
display: inline-flex;
|
|
10137
10211
|
flex: none;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// claude-hub-sdk 1.
|
|
1
|
+
// claude-hub-sdk 1.12.0 (sha256 6fb679e4d801). Copied by npm run sdk:sync in claude-code-hub. Do not edit.
|
|
2
2
|
// Claude Code Hub SDK: the one rule that names a key press, shared by the hub page, client.js and
|
|
3
3
|
// stub.js. The hub serves it to its page as /sdk/keys.js; mount() and sdk:sync put it in front of
|
|
4
4
|
// client.js and stub.js, so an app still loads one file.
|
|
@@ -10,19 +10,62 @@ var ClaudeHubKeys = (() => {
|
|
|
10
10
|
// Modifiers in ctrl, alt, shift, meta order, joined by '+' to the key. macOS composes
|
|
11
11
|
// Option+<key> into a character (Option+1 is '¡', Option+P is 'π') and holding Control does not
|
|
12
12
|
// undo it, so e.key alone cannot name these presses there. e.code is the physical key, which is
|
|
13
|
-
// wrong for non-US layouts, hence only as a fallback.
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
13
|
+
// wrong for non-US layouts, hence only as a fallback. A letter or punctuation key falls back to its
|
|
14
|
+
// US character only when e.key is not ASCII (a non-Latin layout, or Option on macOS), so AZERTY's
|
|
15
|
+
// ',' on the M key stays ','. The digit row always falls back, so AZERTY's '&' key is 1, as Windows
|
|
16
|
+
// and VS Code treat it. No fallback under AltGraph: Chromium sets it when AltGr types a character, and that
|
|
17
|
+
// press is text. Takes a real KeyboardEvent or a forwarded {key, code} payload; a payload without
|
|
18
|
+
// code degrades to key. A payload needs no AltGraph: the SDK forwards only a press whose key
|
|
19
|
+
// already names a bound combo.
|
|
20
|
+
// Self-contained on purpose, the table too: cck puts its source text into a sandboxed frame.
|
|
21
|
+
// codeOf() lists the same keys the other way round.
|
|
18
22
|
function comboOf(e) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
23
|
+
const raw = typeof e.key === 'string' ? e.key : '';
|
|
24
|
+
const lower = raw.toLowerCase();
|
|
25
|
+
const code = e.getModifierState?.('AltGraph') ? '' : e.code || '';
|
|
26
|
+
const latin = !/[^\x20-\x7e]/.test(raw);
|
|
27
|
+
const digit = /^Digit([0-9])$/.exec(code)?.[1];
|
|
28
|
+
const us =
|
|
29
|
+
!latin &&
|
|
30
|
+
(/^Key([A-Z])$/.exec(code)?.[1].toLowerCase() ||
|
|
31
|
+
{
|
|
32
|
+
Minus: '-',
|
|
33
|
+
Equal: '=',
|
|
34
|
+
BracketLeft: '[',
|
|
35
|
+
BracketRight: ']',
|
|
36
|
+
Backslash: '\\',
|
|
37
|
+
Semicolon: ';',
|
|
38
|
+
Quote: "'",
|
|
39
|
+
Backquote: '`',
|
|
40
|
+
Comma: ',',
|
|
41
|
+
Period: '.',
|
|
42
|
+
Slash: '/',
|
|
43
|
+
}[code]);
|
|
44
|
+
const key = /^[a-z0-9]$/.test(lower) ? lower : digit || us || (e.key === ' ' ? 'Space' : e.key);
|
|
22
45
|
const mods = [e.ctrlKey && 'ctrl', e.altKey && 'alt', e.shiftKey && 'shift', e.metaKey && 'meta'];
|
|
23
46
|
return [...mods, key].filter(Boolean).join('+');
|
|
24
47
|
}
|
|
25
48
|
|
|
49
|
+
// The physical key (e.code) that types a combo's key on a US layout, or null for a named key.
|
|
50
|
+
function codeOf(key) {
|
|
51
|
+
if (/^[a-z]$/.test(key)) return `Key${key.toUpperCase()}`;
|
|
52
|
+
if (/^[0-9]$/.test(key)) return `Digit${key}`;
|
|
53
|
+
const codes = {
|
|
54
|
+
'-': 'Minus',
|
|
55
|
+
'=': 'Equal',
|
|
56
|
+
'[': 'BracketLeft',
|
|
57
|
+
']': 'BracketRight',
|
|
58
|
+
'\\': 'Backslash',
|
|
59
|
+
';': 'Semicolon',
|
|
60
|
+
"'": 'Quote',
|
|
61
|
+
'`': 'Backquote',
|
|
62
|
+
',': 'Comma',
|
|
63
|
+
'.': 'Period',
|
|
64
|
+
'/': 'Slash',
|
|
65
|
+
};
|
|
66
|
+
return codes[key] ?? null;
|
|
67
|
+
}
|
|
68
|
+
|
|
26
69
|
// The keys of a combo as a help row shows them: ['Ctrl', 'Alt', 'P'], or ['⌃', '⌥', 'P'] on macOS.
|
|
27
70
|
// The {n} of a numbered combo reads 1…9.
|
|
28
71
|
function keyParts(combo, mac) {
|
|
@@ -47,7 +90,7 @@ var ClaudeHubKeys = (() => {
|
|
|
47
90
|
].filter(Boolean);
|
|
48
91
|
}
|
|
49
92
|
|
|
50
|
-
return { comboOf, keyParts, keySigs };
|
|
93
|
+
return { comboOf, codeOf, keyParts, keySigs };
|
|
51
94
|
})();
|
|
52
95
|
|
|
53
96
|
if (typeof module === 'object' && module.exports) module.exports = ClaudeHubKeys;
|
|
@@ -93,6 +136,7 @@ if (typeof module === 'object' && module.exports) module.exports = ClaudeHubKeys
|
|
|
93
136
|
can: (action) => !!standaloneFn(action),
|
|
94
137
|
forwards: () => false,
|
|
95
138
|
forwardCombos: () => [],
|
|
139
|
+
onKeys: () => off,
|
|
96
140
|
keyLabel: () => null,
|
|
97
141
|
voiceCommands: () => [],
|
|
98
142
|
closeGuard() {},
|