iskills 0.2.41 → 0.2.46
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/README.md +124 -26
- package/README.zh-CN.md +146 -0
- package/bin/iskills.js +85 -3
- package/bin/opentui-register.mjs +10 -0
- package/bin/opentui-resolve-hook.mjs +12 -0
- package/bin/patch-react-reconciler.mjs +71 -0
- package/dist/src/cli.js +22 -9
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/browser-actions.js +76 -65
- package/dist/src/commands/browser-actions.js.map +1 -1
- package/dist/src/commands/config.d.ts +5 -0
- package/dist/src/commands/config.js +22 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/create.d.ts +1 -0
- package/dist/src/commands/create.js +37 -0
- package/dist/src/commands/create.js.map +1 -0
- package/dist/src/commands/index.d.ts +2 -0
- package/dist/src/commands/index.js +30 -70
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/library.js +59 -67
- package/dist/src/commands/library.js.map +1 -1
- package/dist/src/commands/search.js +15 -10
- package/dist/src/commands/search.js.map +1 -1
- package/dist/src/domain/collection-write.d.ts +2 -0
- package/dist/src/domain/collection-write.js +83 -33
- package/dist/src/domain/collection-write.js.map +1 -1
- package/dist/src/domain/core.d.ts +29 -1
- package/dist/src/domain/core.js +134 -12
- package/dist/src/domain/core.js.map +1 -1
- package/dist/src/domain/git.js +15 -14
- package/dist/src/domain/git.js.map +1 -1
- package/dist/src/domain/types.d.ts +2 -0
- package/dist/src/domain/user-config.d.ts +12 -0
- package/dist/src/domain/user-config.js +55 -0
- package/dist/src/domain/user-config.js.map +1 -0
- package/dist/src/i18n/en.d.ts +5 -0
- package/dist/src/i18n/en.js +419 -0
- package/dist/src/i18n/en.js.map +1 -0
- package/dist/src/i18n/index.d.ts +47 -0
- package/dist/src/i18n/index.js +129 -0
- package/dist/src/i18n/index.js.map +1 -0
- package/dist/src/i18n/zh.d.ts +404 -0
- package/dist/src/i18n/zh.js +419 -0
- package/dist/src/i18n/zh.js.map +1 -0
- package/dist/src/ui/browser/browser.d.ts +2 -1
- package/dist/src/ui/browser/browser.js +295 -77
- package/dist/src/ui/browser/browser.js.map +1 -1
- package/dist/src/ui/browser/detail.d.ts +1 -1
- package/dist/src/ui/browser/detail.js +4 -3
- package/dist/src/ui/browser/detail.js.map +1 -1
- package/dist/src/ui/browser/footer.js +20 -3
- package/dist/src/ui/browser/footer.js.map +1 -1
- package/dist/src/ui/browser/format.d.ts +21 -9
- package/dist/src/ui/browser/format.js +99 -73
- package/dist/src/ui/browser/format.js.map +1 -1
- package/dist/src/ui/browser/index.js +11 -10
- package/dist/src/ui/browser/index.js.map +1 -1
- package/dist/src/ui/browser/layout.d.ts +1 -1
- package/dist/src/ui/browser/layout.js +1 -1
- package/dist/src/ui/browser/shortcut-help.d.ts +2 -0
- package/dist/src/ui/browser/shortcut-help.js +34 -13
- package/dist/src/ui/browser/shortcut-help.js.map +1 -1
- package/dist/src/ui/browser/types.d.ts +14 -5
- package/dist/src/ui/collection-match.d.ts +1 -1
- package/dist/src/ui/collection-match.js +9 -6
- package/dist/src/ui/collection-match.js.map +1 -1
- package/dist/src/ui/components/colors.d.ts +55 -5
- package/dist/src/ui/components/colors.js +58 -6
- package/dist/src/ui/components/colors.js.map +1 -1
- package/dist/src/ui/components/confirm.js +2 -2
- package/dist/src/ui/components/confirm.js.map +1 -1
- package/dist/src/ui/components/framed-panel.d.ts +3 -3
- package/dist/src/ui/components/framed-panel.js +30 -11
- package/dist/src/ui/components/framed-panel.js.map +1 -1
- package/dist/src/ui/components/link.js +13 -8
- package/dist/src/ui/components/link.js.map +1 -1
- package/dist/src/ui/components/modal-panel.d.ts +12 -0
- package/dist/src/ui/components/modal-panel.js +14 -0
- package/dist/src/ui/components/modal-panel.js.map +1 -0
- package/dist/src/ui/components/modal.js +3 -3
- package/dist/src/ui/components/modal.js.map +1 -1
- package/dist/src/ui/components/mouse/bounds.d.ts +1 -6
- package/dist/src/ui/components/mouse/bounds.js +1 -22
- package/dist/src/ui/components/mouse/bounds.js.map +1 -1
- package/dist/src/ui/components/mouse/clickable.d.ts +6 -4
- package/dist/src/ui/components/mouse/clickable.js +26 -10
- package/dist/src/ui/components/mouse/clickable.js.map +1 -1
- package/dist/src/ui/components/mouse/index.d.ts +2 -2
- package/dist/src/ui/components/mouse/index.js +2 -2
- package/dist/src/ui/components/mouse/index.js.map +1 -1
- package/dist/src/ui/components/mouse/parse.d.ts +1 -1
- package/dist/src/ui/components/mouse/parse.js +3 -3
- package/dist/src/ui/components/mouse/parse.js.map +1 -1
- package/dist/src/ui/components/mouse/provider.d.ts +17 -15
- package/dist/src/ui/components/mouse/provider.js +29 -85
- package/dist/src/ui/components/mouse/provider.js.map +1 -1
- package/dist/src/ui/components/multi-select.js +24 -7
- package/dist/src/ui/components/multi-select.js.map +1 -1
- package/dist/src/ui/components/options.d.ts +2 -1
- package/dist/src/ui/components/options.js +2 -1
- package/dist/src/ui/components/options.js.map +1 -1
- package/dist/src/ui/components/select.d.ts +4 -0
- package/dist/src/ui/components/select.js +32 -34
- package/dist/src/ui/components/select.js.map +1 -1
- package/dist/src/ui/components/spinner.d.ts +16 -0
- package/dist/src/ui/components/spinner.js +45 -0
- package/dist/src/ui/components/spinner.js.map +1 -0
- package/dist/src/ui/components/tabs.js +10 -6
- package/dist/src/ui/components/tabs.js.map +1 -1
- package/dist/src/ui/components/tag-editor.d.ts +1 -2
- package/dist/src/ui/components/tag-editor.js +12 -7
- package/dist/src/ui/components/tag-editor.js.map +1 -1
- package/dist/src/ui/components/termcn.d.ts +3 -1
- package/dist/src/ui/components/termcn.js +5 -3
- package/dist/src/ui/components/termcn.js.map +1 -1
- package/dist/src/ui/components/text-input.d.ts +4 -0
- package/dist/src/ui/components/text-input.js +29 -69
- package/dist/src/ui/components/text-input.js.map +1 -1
- package/dist/src/ui/components/use-input.d.ts +21 -7
- package/dist/src/ui/components/use-input.js +61 -9
- package/dist/src/ui/components/use-input.js.map +1 -1
- package/dist/src/ui/config/index.d.ts +11 -0
- package/dist/src/ui/config/index.js +22 -0
- package/dist/src/ui/config/index.js.map +1 -0
- package/dist/src/ui/config/settings.d.ts +17 -0
- package/dist/src/ui/config/settings.js +126 -0
- package/dist/src/ui/config/settings.js.map +1 -0
- package/dist/src/ui/footer/resolve-footer.js +48 -35
- package/dist/src/ui/footer/resolve-footer.js.map +1 -1
- package/dist/src/ui/footer/types.d.ts +6 -2
- package/dist/src/ui/import/review.js +16 -9
- package/dist/src/ui/import/review.js.map +1 -1
- package/dist/src/ui/import/skill-select.js +48 -16
- package/dist/src/ui/import/skill-select.js.map +1 -1
- package/dist/src/ui/import/types.d.ts +1 -1
- package/dist/src/ui/install/review.js +22 -16
- package/dist/src/ui/install/review.js.map +1 -1
- package/dist/src/ui/install/types.d.ts +4 -6
- package/dist/src/ui/install/types.js +1 -1
- package/dist/src/ui/overlay/bridge.js +4 -0
- package/dist/src/ui/overlay/bridge.js.map +1 -1
- package/dist/src/ui/overlay/dialogs.js +1 -1
- package/dist/src/ui/overlay/host.js +4 -4
- package/dist/src/ui/overlay/host.js.map +1 -1
- package/dist/src/ui/prompts/present.d.ts +5 -3
- package/dist/src/ui/prompts/present.js +10 -7
- package/dist/src/ui/prompts/present.js.map +1 -1
- package/dist/src/ui/search/index.js +11 -9
- package/dist/src/ui/search/index.js.map +1 -1
- package/dist/src/ui/shell/app-shell.d.ts +1 -1
- package/dist/src/ui/shell/app-shell.js +4 -6
- package/dist/src/ui/shell/app-shell.js.map +1 -1
- package/dist/src/ui/shell/footer.js +5 -8
- package/dist/src/ui/shell/footer.js.map +1 -1
- package/dist/src/ui/shell/lifecycle.d.ts +12 -0
- package/dist/src/ui/shell/lifecycle.js +30 -0
- package/dist/src/ui/shell/lifecycle.js.map +1 -0
- package/dist/src/ui/shell/run.d.ts +35 -10
- package/dist/src/ui/shell/run.js +175 -88
- package/dist/src/ui/shell/run.js.map +1 -1
- package/dist/src/ui/shell/terminal.d.ts +0 -1
- package/dist/src/ui/shell/terminal.js +3 -2
- package/dist/src/ui/shell/terminal.js.map +1 -1
- package/dist/src/ui/skill-labels.d.ts +9 -9
- package/dist/src/ui/skill-labels.js +13 -10
- package/dist/src/ui/skill-labels.js.map +1 -1
- package/dist/src/ui/tui/hooks.d.ts +45 -0
- package/dist/src/ui/tui/hooks.js +79 -0
- package/dist/src/ui/tui/hooks.js.map +1 -0
- package/dist/src/ui/tui/index.d.ts +2 -0
- package/dist/src/ui/tui/index.js +3 -0
- package/dist/src/ui/tui/index.js.map +1 -0
- package/dist/src/ui/tui/primitives.d.ts +12 -0
- package/dist/src/ui/tui/primitives.js +56 -0
- package/dist/src/ui/tui/primitives.js.map +1 -0
- package/dist/src/util/open-path.d.ts +2 -0
- package/dist/src/util/open-path.js +27 -0
- package/dist/src/util/open-path.js.map +1 -0
- package/package.json +11 -7
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { Text, useStdout } from '../tui/index.js';
|
|
3
3
|
import { useInput } from '../components/use-input.js';
|
|
4
4
|
import { useAtom, useAtomValue, useStore } from 'jotai';
|
|
5
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
6
6
|
import { browserFilterAtom, browserGroupJumpAtom, browserNavigationAtom, browserSelectionAtom, browserUpdateCheckAtom, } from './store.js';
|
|
7
7
|
import { browserFrameDimensions, masterDetailLayout, masterDetailSeparator, masterDetailViewportHeight, masterDetailWidths, } from './layout.js';
|
|
8
|
-
import { TAG_FILTER_ALL, browseDetailRows, collectionCategoryLines, collectionListColumnLines,
|
|
8
|
+
import { TAG_FILTER_ALL, browseDetailRows, collectionCategoryLines, collectionListColumnLines, detailEditableFields, detailLabelWidth, flatRows, focusAfterDownFromAgents, focusAfterDownFromTabs, focusAfterUpFromList, focusAfterUpFromTags, groupedRows, listSkillSummary, moreActionModalContent, nextAgent, nextMainTab, selectableSkills, skillsForTagFilter, tagFilterOptions, visibleAgentGroups, } from './format.js';
|
|
9
|
+
import { t } from '../../i18n/index.js';
|
|
9
10
|
import { useModal, useOverlayBusy } from '../overlay/host.js';
|
|
10
11
|
import { FramedPanel } from '../components/framed-panel.js';
|
|
11
|
-
import { Select, Tabs, termcnColors, } from '../components/termcn.js';
|
|
12
|
+
import { Select, Tabs, termcnColors, WorkingSpinner, useSpinnerFrame, } from '../components/termcn.js';
|
|
13
|
+
import { Clickable } from '../components/mouse/clickable.js';
|
|
12
14
|
import { padColumns, sliceColumns } from '../components/terminal-layout.js';
|
|
13
15
|
import { ShortcutHelpPanel } from './shortcut-help.js';
|
|
14
16
|
/** Framed more-actions panel for absolute modal overlay (list shows through). */
|
|
15
17
|
function MoreActionsPanel({ scope, onConfirm, onCancel, }) {
|
|
16
|
-
return (_jsx(FramedPanel, { title:
|
|
18
|
+
return (_jsx(FramedPanel, { title: t('browser.moreActionsTitle'), content: [...moreActionModalContent(scope), t('browser.moreActionsFooter')], width: 64, muteLastContent: true, onEscape: onCancel, onKey: (input, key) => {
|
|
17
19
|
if (key.return || input.includes('\r') || input.includes('\n'))
|
|
18
20
|
onConfirm();
|
|
19
21
|
} }));
|
|
20
22
|
}
|
|
21
23
|
function masterDetailBlankRow(tagWidth, listWidth, peekWidth) {
|
|
22
24
|
const divider = '│';
|
|
23
|
-
return (_jsxs(
|
|
25
|
+
return (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', tagWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsxs("box", { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', listWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsx("box", { flexDirection: "row", width: peekWidth, children: _jsx(Text, { wrap: "truncate-end", children: padColumns('', peekWidth) }) })] }));
|
|
24
26
|
}
|
|
25
|
-
function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false, layout = 'default', columnWidth, showPagination = true, showSource = false, showReferences = false, showGroup = false, updates = new Set(), updatingSkillName, viewportHeight, }) {
|
|
27
|
+
function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false, layout = 'default', columnWidth, showPagination = true, showSource = false, showReferences = false, showGroup = false, updates = new Set(), updatingSkillName, viewportHeight, onRowClick, onCursorDelta, }) {
|
|
26
28
|
const { stdout } = useStdout();
|
|
27
29
|
const selected = useAtomValue(browserSelectionAtom);
|
|
28
30
|
const paneHeight = viewportHeight ?? Math.max(3, (stdout.rows ?? 24) - 8);
|
|
@@ -32,12 +34,26 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
|
|
|
32
34
|
const visible = rows.slice(offset, offset + height);
|
|
33
35
|
const paneWidth = columnWidth ?? Math.max(20, (stdout.columns ?? 80) - 4);
|
|
34
36
|
const summaryWidth = Math.max(8, paneWidth - 4);
|
|
37
|
+
const onMouseScroll = useCallback((event) => {
|
|
38
|
+
const info = event.scroll;
|
|
39
|
+
if (!info || !onCursorDelta)
|
|
40
|
+
return;
|
|
41
|
+
const steps = Math.max(1, Math.abs(info.delta) || 1);
|
|
42
|
+
if (info.direction === 'up')
|
|
43
|
+
onCursorDelta(-steps);
|
|
44
|
+
else if (info.direction === 'down')
|
|
45
|
+
onCursorDelta(steps);
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
}, [onCursorDelta]);
|
|
35
48
|
const renderRow = (row, index) => {
|
|
36
49
|
if (row.type === 'group') {
|
|
37
50
|
const groupSkills = row.skills;
|
|
38
51
|
const count = groupSkills.filter((skill) => selected.has(skill.path)).length;
|
|
39
52
|
const marker = count === 0 ? '○' : count === groupSkills.length && groupSkills.length ? '●' : '◐';
|
|
40
|
-
|
|
53
|
+
const body = (_jsx(Text, { bold: true, ...(isActive && index === active ? { color: termcnColors.primary } : {}), children: `${isActive && index === active ? '›' : ' '} ${marker} ${row.name} (${row.skills.length})` }));
|
|
54
|
+
if (!onRowClick)
|
|
55
|
+
return _jsx("box", { flexDirection: "row", children: body }, `group:${row.name}:${index}`);
|
|
56
|
+
return (_jsx(Clickable, { onClick: () => onRowClick(index), children: body }, `group:${row.name}:${index}`));
|
|
41
57
|
}
|
|
42
58
|
const skill = row.skill;
|
|
43
59
|
const current = isActive && index === active;
|
|
@@ -46,56 +62,117 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
|
|
|
46
62
|
: listSkillSummary(skill, preferNote, summaryWidth);
|
|
47
63
|
const inlineSummary = summary;
|
|
48
64
|
const selectionMarker = selected.has(skill.path) ? '●' : '○';
|
|
49
|
-
const nameLine = (_jsxs(_Fragment, { children: [` ${current ? '›' : ' '} ${selectionMarker} `, showGroup && row.group && (_jsxs(Text, { color: termcnColors.muted, children: [row.group, " / "] })), showReferences && skill.isReference ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: termcnColors.muted, children:
|
|
50
|
-
|
|
65
|
+
const nameLine = (_jsxs(_Fragment, { children: [` ${current ? '›' : ' '} ${selectionMarker} `, showGroup && row.group && (_jsxs(Text, { color: termcnColors.muted, children: [row.group, " / "] })), showReferences && skill.isReference ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: termcnColors.muted, children: t('browser.referencePrefix') }), _jsx(Text, { bold: current, children: skill.name })] })) : showSource && !skill.fromCollection ? (t('browser.localSkill', { name: skill.name })) : (_jsx(Text, { bold: current, children: skill.name })), updatingSkillName === skill.name ? (_jsx(WorkingSpinner, {})) : updates.has(skill.name) ? (_jsx(Text, { color: termcnColors.primary, children: " \u2191" })) : null, inlineSummary && (_jsxs(Text, { color: termcnColors.muted, children: [" \u2014 ", inlineSummary] }))] }));
|
|
66
|
+
const body = (_jsx(Text, { wrap: "truncate-end", ...(current
|
|
67
|
+
? {
|
|
68
|
+
color: termcnColors.selectionFg,
|
|
69
|
+
backgroundColor: termcnColors.selectionBg,
|
|
70
|
+
bold: true,
|
|
71
|
+
}
|
|
72
|
+
: {}), children: nameLine }));
|
|
73
|
+
if (!onRowClick) {
|
|
74
|
+
return (_jsx("box", { flexDirection: "row", children: body }, `${row.group}:${skill.path}:${index}`));
|
|
75
|
+
}
|
|
76
|
+
return (_jsx(Clickable, { onClick: () => onRowClick(index), children: body }, `${row.group}:${skill.path}:${index}`));
|
|
51
77
|
};
|
|
52
|
-
return (_jsxs(
|
|
78
|
+
return (_jsxs("box", { flexDirection: "column", minHeight: 3, onMouseScroll: onMouseScroll, children: [rows.length ? (visible.map((row, visibleIndex) => renderRow(row, offset + visibleIndex))) : (_jsx(Text, { color: termcnColors.muted, children: t('browser.noMatchingSkills') })), showPagination && rows.length > height && (_jsxs(Text, { color: termcnColors.muted, children: [offset + 1, "\u2013", Math.min(offset + height, rows.length), " / ", rows.length] }))] }));
|
|
53
79
|
}
|
|
54
|
-
function AgentTabs({ groups, agent, focused, }) {
|
|
55
|
-
return (_jsx(
|
|
80
|
+
function AgentTabs({ groups, agent, focused, onSelect, }) {
|
|
81
|
+
return (_jsx("box", { flexDirection: "row", paddingLeft: 1, gap: 2, children: groups.map((group) => {
|
|
56
82
|
const active = group.agent === agent;
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
const
|
|
61
|
-
return (_jsx(
|
|
83
|
+
// Current agent always uses primary (visible after mouse click without
|
|
84
|
+
// forcing keyboard focus onto the agents row). Keyboard-on-agents adds
|
|
85
|
+
// selection chrome so the focus ladder is still obvious.
|
|
86
|
+
const keyboardHere = focused && active;
|
|
87
|
+
return (_jsx(Clickable, { onClick: () => onSelect(group.agent), children: _jsx(Text, { color: keyboardHere
|
|
88
|
+
? termcnColors.selectionFg
|
|
89
|
+
: active
|
|
90
|
+
? termcnColors.primary
|
|
91
|
+
: termcnColors.muted, ...(keyboardHere
|
|
92
|
+
? { backgroundColor: termcnColors.selectionBg, bold: true }
|
|
93
|
+
: active
|
|
94
|
+
? { bold: true, underline: true }
|
|
95
|
+
: {}), children: `${group.agent} ${group.skills.length}` }) }, group.agent));
|
|
62
96
|
}) }));
|
|
63
97
|
}
|
|
64
98
|
function masterDetailColumnText(line, width, options = {}) {
|
|
65
99
|
const padded = padColumns(sliceColumns(line, 0, width), width);
|
|
66
|
-
|
|
100
|
+
if (options.selected) {
|
|
101
|
+
return (_jsx(Text, { wrap: "truncate-end", color: termcnColors.selectionFg, backgroundColor: termcnColors.selectionBg, bold: true, children: padded }));
|
|
102
|
+
}
|
|
103
|
+
return (_jsx(Text, { wrap: "truncate-end", ...(options.muted
|
|
104
|
+
? { color: termcnColors.muted }
|
|
105
|
+
: options.color
|
|
106
|
+
? { color: options.color }
|
|
107
|
+
: {}), ...(options.bold ? { bold: true } : {}), children: padded }));
|
|
67
108
|
}
|
|
68
109
|
/** Right-pane detail row: muted labels, normal/muted values, optional bold title. */
|
|
69
|
-
function DetailColumnRow({ row, width, }) {
|
|
110
|
+
function DetailColumnRow({ row, width, selected = false, }) {
|
|
111
|
+
if (selected) {
|
|
112
|
+
return (_jsx(Text, { wrap: "truncate-end", color: termcnColors.selectionFg, backgroundColor: termcnColors.selectionBg, bold: true, children: padColumns(sliceColumns(row.label !== undefined
|
|
113
|
+
? `${padColumns(row.label, detailLabelWidth())}${row.text}`
|
|
114
|
+
: row.text, 0, width), width) }));
|
|
115
|
+
}
|
|
70
116
|
if (row.label !== undefined) {
|
|
71
|
-
const valueWidth = Math.max(1, width -
|
|
72
|
-
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: termcnColors.muted, children: padColumns(row.label,
|
|
117
|
+
const valueWidth = Math.max(1, width - detailLabelWidth());
|
|
118
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: termcnColors.muted, children: padColumns(row.label, detailLabelWidth()) }), _jsx(Text, { ...(row.muted ? { color: termcnColors.muted } : {}), ...(row.bold ? { bold: true } : {}), ...(row.primary ? { color: termcnColors.primary } : {}), children: padColumns(sliceColumns(row.text, 0, valueWidth), valueWidth) })] }));
|
|
73
119
|
}
|
|
74
120
|
return (_jsx(Text, { wrap: "truncate-end", ...(row.primary ? { color: termcnColors.primary } : {}), ...(row.muted ? { color: termcnColors.muted } : {}), ...(row.bold ? { bold: true } : {}), children: padColumns(sliceColumns(row.text, 0, width), width) }));
|
|
75
121
|
}
|
|
76
|
-
function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, }) {
|
|
122
|
+
function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, detailActive = false, detailActiveField, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, onTagLineClick, onListLineClick, onDetailLineClick, onListScroll, }) {
|
|
77
123
|
const rows = Math.max(tagLines.length, listLines.length, peekLines.length, detailRows?.length ?? 0);
|
|
78
124
|
const divided = collectionHome;
|
|
79
125
|
const divider = divided ? '│' : '';
|
|
80
126
|
const tagColumnWidth = tagWidth + (divider ? 1 : 0);
|
|
81
127
|
const listColumnWidth = listWidth + (divider ? 1 : 0);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
128
|
+
// Only the skill column (2nd) owns list wheel scrolling. Detail (3rd) must not
|
|
129
|
+
// move the list when the pointer is over it — attach scroll handler only there.
|
|
130
|
+
const onListColumnScroll = useCallback((event) => {
|
|
131
|
+
const info = event.scroll;
|
|
132
|
+
if (!info || !onListScroll)
|
|
133
|
+
return;
|
|
134
|
+
const steps = Math.max(1, Math.abs(info.delta) || 1);
|
|
135
|
+
if (info.direction === 'up')
|
|
136
|
+
onListScroll(-steps);
|
|
137
|
+
else if (info.direction === 'down')
|
|
138
|
+
onListScroll(steps);
|
|
139
|
+
event.stopPropagation();
|
|
140
|
+
}, [onListScroll]);
|
|
141
|
+
const swallowScroll = useCallback((event) => {
|
|
142
|
+
// Keep wheel over detail/tag from bubbling to a parent list scroller.
|
|
143
|
+
if (event.scroll)
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
}, []);
|
|
146
|
+
return (_jsx("box", { flexDirection: "column", children: Array.from({ length: rows }, (_, index) => {
|
|
147
|
+
const tagCell = masterDetailColumnText(tagLines[index] ?? '', tagWidth, {
|
|
148
|
+
...(tagActive && tagLines[index]?.startsWith('›')
|
|
149
|
+
? collectionHome
|
|
150
|
+
? { selected: true }
|
|
151
|
+
: { color: termcnColors.primary, bold: true }
|
|
152
|
+
: {}),
|
|
153
|
+
});
|
|
154
|
+
const listCell = masterDetailColumnText(listLines[index] ?? '', listWidth, {
|
|
155
|
+
...(listActiveLineIndexes?.has(index)
|
|
156
|
+
? { selected: true }
|
|
157
|
+
: listSelectedLineIndexes?.has(index)
|
|
158
|
+
? { color: termcnColors.primary, bold: true }
|
|
159
|
+
: listActive && listLines[index]?.startsWith('›')
|
|
160
|
+
? { color: termcnColors.primary, bold: true }
|
|
161
|
+
: index % 2 === 1 && listLines[index]?.trim()
|
|
162
|
+
? { muted: true }
|
|
87
163
|
: {}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})
|
|
164
|
+
});
|
|
165
|
+
const tagInteractive = onTagLineClick && (tagLines[index] ?? '').trim().length > 0;
|
|
166
|
+
const listInteractive = onListLineClick && (listLines[index] ?? '').trim().length > 0;
|
|
167
|
+
return (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagColumnWidth, flexDirection: "row", onMouseScroll: swallowScroll, children: [tagInteractive ? (_jsx(Clickable, { onClick: () => onTagLineClick(index), children: tagCell })) : (tagCell), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsxs("box", { width: listColumnWidth, flexDirection: "row", onMouseScroll: onListColumnScroll, children: [listInteractive ? (_jsx(Clickable, { onClick: () => onListLineClick(index), children: listCell })) : (listCell), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsx("box", { flexDirection: "row", width: peekWidth, onMouseScroll: swallowScroll, children: detailRows?.[index] ? ((() => {
|
|
168
|
+
const detailRow = detailRows[index];
|
|
169
|
+
const fieldSelected = detailActive &&
|
|
170
|
+
detailRow.field !== undefined &&
|
|
171
|
+
detailRow.field === detailActiveField;
|
|
172
|
+
const cell = (_jsx(DetailColumnRow, { row: detailRow, width: peekWidth, selected: fieldSelected }));
|
|
173
|
+
return onDetailLineClick && detailRow.field ? (_jsx(Clickable, { onClick: () => onDetailLineClick(index), children: cell })) : (cell);
|
|
174
|
+
})()) : (_jsx(Text, { wrap: "truncate-end", color: index === 0 && peekLines[index] !== t('browser.selectSkillToView') ? termcnColors.primary : termcnColors.muted, bold: index === 0 && peekLines[index] !== t('browser.selectSkillToView'), children: padColumns(sliceColumns(peekLines[index] ?? '', 0, peekWidth), peekWidth) })) })] }, `master-detail-row:${index}`));
|
|
175
|
+
}) }));
|
|
99
176
|
}
|
|
100
177
|
/**
|
|
101
178
|
* Browser list view. Navigation/selection live in the parent Jotai Provider
|
|
@@ -106,6 +183,8 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
106
183
|
const modal = useModal();
|
|
107
184
|
const shellBusy = useOverlayBusy();
|
|
108
185
|
const store = useStore();
|
|
186
|
+
// Local braille spinner only while a skill is updating (not a global busy overlay).
|
|
187
|
+
const updatingFrame = useSpinnerFrame(Boolean(updatingSkillName));
|
|
109
188
|
const [navigation, setNavigationState] = useAtom(browserNavigationAtom);
|
|
110
189
|
const [selected, setSelected] = useAtom(browserSelectionAtom);
|
|
111
190
|
const navigationRef = useRef(navigation);
|
|
@@ -197,6 +276,10 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
197
276
|
const [tagCursor, setTagCursor] = useState(0);
|
|
198
277
|
const tagCursorRef = useRef(tagCursor);
|
|
199
278
|
tagCursorRef.current = tagCursor;
|
|
279
|
+
/** Index into detailEditableFields(collection) while focus === 'detail'. */
|
|
280
|
+
const [detailFieldIndex, setDetailFieldIndex] = useState(0);
|
|
281
|
+
const detailFieldIndexRef = useRef(detailFieldIndex);
|
|
282
|
+
detailFieldIndexRef.current = detailFieldIndex;
|
|
200
283
|
const masterDetailSkills = useMemo(() => skillsForTagFilter(tabSkills, tagFilter), [tabSkills, tagFilter]);
|
|
201
284
|
const masterDetailRows = useMemo(() => flatRows(masterDetailSkills, query), [masterDetailSkills, query]);
|
|
202
285
|
const listRows = useMasterDetail ? masterDetailRows : rows;
|
|
@@ -299,11 +382,26 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
299
382
|
const masterListOffset = useMasterDetail
|
|
300
383
|
? Math.max(0, Math.min(cursor - Math.floor(masterListVisibleHeight / 2), Math.max(0, listRows.length - masterListVisibleHeight)))
|
|
301
384
|
: 0;
|
|
302
|
-
const peekSkill = focus === 'list' && currentRow?.type === 'skill'
|
|
385
|
+
const peekSkill = (focus === 'list' || focus === 'detail') && currentRow?.type === 'skill'
|
|
386
|
+
? currentRow.skill
|
|
387
|
+
: undefined;
|
|
388
|
+
const detailFields = detailEditableFields(tab === 'collection');
|
|
389
|
+
const activeDetailField = focus === 'detail' && detailFields.length
|
|
390
|
+
? detailFields[Math.max(0, Math.min(detailFieldIndex, detailFields.length - 1))]
|
|
391
|
+
: undefined;
|
|
303
392
|
useEffect(() => {
|
|
304
|
-
if (focus === 'tags' && !useMasterDetail)
|
|
393
|
+
if ((focus === 'detail' || focus === 'tags') && !useMasterDetail)
|
|
305
394
|
setFocus('list');
|
|
306
395
|
}, [focus, useMasterDetail, setFocus]);
|
|
396
|
+
useEffect(() => {
|
|
397
|
+
if (focus === 'detail' && currentRow?.type !== 'skill')
|
|
398
|
+
setFocus('list');
|
|
399
|
+
}, [focus, currentRow, setFocus]);
|
|
400
|
+
useEffect(() => {
|
|
401
|
+
if (detailFieldIndex >= detailFields.length && detailFields.length > 0) {
|
|
402
|
+
setDetailFieldIndex(detailFields.length - 1);
|
|
403
|
+
}
|
|
404
|
+
}, [detailFieldIndex, detailFields.length]);
|
|
307
405
|
useInput((input, key) => {
|
|
308
406
|
const live = navigationRef.current;
|
|
309
407
|
const liveFocus = live?.focus ?? 'tabs';
|
|
@@ -311,9 +409,9 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
311
409
|
if (input === '?') {
|
|
312
410
|
void modal.open({
|
|
313
411
|
footerItems: [
|
|
314
|
-
{ key: '↑↓', label: '
|
|
315
|
-
{ key: 'e', label: '
|
|
316
|
-
{ key: 'Esc', label: '
|
|
412
|
+
{ key: '↑↓', label: t('common.move') },
|
|
413
|
+
{ key: 'e', label: t('common.expand') },
|
|
414
|
+
{ key: 'Esc', label: t('common.close') },
|
|
317
415
|
],
|
|
318
416
|
content: (close) => (_jsx(ShortcutHelpPanel, { onClose: () => close(undefined), maxBodyRows: 14 })),
|
|
319
417
|
});
|
|
@@ -443,19 +541,55 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
443
541
|
}
|
|
444
542
|
return;
|
|
445
543
|
}
|
|
544
|
+
// Right column: move among editable fields (标签 / 备注); Enter opens editor.
|
|
545
|
+
if (liveFocus === 'detail' || focus === 'detail') {
|
|
546
|
+
const detailRow = listRows[cursorRef.current];
|
|
547
|
+
const skill = detailRow?.type === 'skill' ? detailRow.skill : undefined;
|
|
548
|
+
const fields = detailEditableFields(tab === 'collection');
|
|
549
|
+
if (key.leftArrow)
|
|
550
|
+
return setFocus('list');
|
|
551
|
+
if (key.upArrow) {
|
|
552
|
+
if (!fields.length)
|
|
553
|
+
return;
|
|
554
|
+
setDetailFieldIndex((index) => Math.max(0, index - 1));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (key.downArrow) {
|
|
558
|
+
if (!fields.length)
|
|
559
|
+
return;
|
|
560
|
+
setDetailFieldIndex((index) => Math.min(fields.length - 1, index + 1));
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (key.rightArrow)
|
|
564
|
+
return;
|
|
565
|
+
const field = fields[detailFieldIndexRef.current] ?? fields[0];
|
|
566
|
+
if (skill && field && (key.return || input.includes('\r') || input.includes('\n'))) {
|
|
567
|
+
if (field === 'tags')
|
|
568
|
+
return finish({ type: 'editTags', skill });
|
|
569
|
+
if (field === 'note')
|
|
570
|
+
return finish({ type: 'editNote', skill });
|
|
571
|
+
}
|
|
572
|
+
if (skill && tab === 'collection') {
|
|
573
|
+
if (input === 't')
|
|
574
|
+
return finish({ type: 'editTags', skill });
|
|
575
|
+
if (input === 'n')
|
|
576
|
+
return finish({ type: 'editNote', skill });
|
|
577
|
+
}
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
446
580
|
if ((navigationRef.current?.focus ?? focus) !== 'list')
|
|
447
581
|
return;
|
|
448
582
|
const row = listRows[cursorRef.current];
|
|
449
583
|
if (input === 'm' && canOpenActions) {
|
|
450
584
|
const skills = actionSkills;
|
|
451
585
|
const scope = selectedProject.length
|
|
452
|
-
?
|
|
453
|
-
:
|
|
586
|
+
? t('browser.selectedSkills', { count: skills.length })
|
|
587
|
+
: t('browser.skillLine', { names: skills[0]?.name ?? '' });
|
|
454
588
|
void modal
|
|
455
589
|
.open({
|
|
456
590
|
footerItems: [
|
|
457
|
-
{ key: 'Enter', label: '
|
|
458
|
-
{ key: 'Esc', label: '
|
|
591
|
+
{ key: 'Enter', label: t('common.confirm') },
|
|
592
|
+
{ key: 'Esc', label: t('common.cancel') },
|
|
459
593
|
],
|
|
460
594
|
content: (close) => (_jsx(MoreActionsPanel, { scope: scope, onConfirm: () => close(true), onCancel: () => close(false) })),
|
|
461
595
|
})
|
|
@@ -502,12 +636,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
502
636
|
const skills = removableCollection;
|
|
503
637
|
void modal
|
|
504
638
|
.confirm({
|
|
505
|
-
title: '
|
|
639
|
+
title: t('browser.removeCollectionTitle'),
|
|
506
640
|
message: skills.length === 1
|
|
507
|
-
?
|
|
508
|
-
:
|
|
641
|
+
? t('browser.removeCollectionOne', { name: skills[0]?.name ?? '' })
|
|
642
|
+
: t('browser.removeCollectionMany', { count: skills.length }),
|
|
509
643
|
...(skills.length > 1
|
|
510
|
-
? { details: [
|
|
644
|
+
? { details: [t('browser.skillLine', { names: skills.map((skill) => skill.name).join(', ') })] }
|
|
511
645
|
: {}),
|
|
512
646
|
})
|
|
513
647
|
.then((ok) => {
|
|
@@ -520,12 +654,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
520
654
|
const skills = removableLocations;
|
|
521
655
|
void modal
|
|
522
656
|
.confirm({
|
|
523
|
-
title: '
|
|
657
|
+
title: t('browser.removeLocationsTitle'),
|
|
524
658
|
message: skills.length === 1
|
|
525
|
-
?
|
|
526
|
-
:
|
|
659
|
+
? t('browser.removeLocationOne', { name: skills[0]?.name ?? '' })
|
|
660
|
+
: t('browser.removeLocationsMany', { count: skills.length }),
|
|
527
661
|
details: [
|
|
528
|
-
'
|
|
662
|
+
t('browser.removeLocationsHint'),
|
|
529
663
|
...skills.map((skill) => skill.path),
|
|
530
664
|
],
|
|
531
665
|
})
|
|
@@ -562,13 +696,19 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
562
696
|
return next;
|
|
563
697
|
});
|
|
564
698
|
}
|
|
565
|
-
// 3-column
|
|
566
|
-
//
|
|
567
|
-
if (key.rightArrow && row?.type === 'skill'
|
|
568
|
-
if (
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
699
|
+
// Wide 3-column: → moves focus into the right detail column (editable fields).
|
|
700
|
+
// Narrow layout keeps → as fullscreen detail for collection / collected skills.
|
|
701
|
+
if (key.rightArrow && row?.type === 'skill') {
|
|
702
|
+
if (useMasterDetail) {
|
|
703
|
+
setDetailFieldIndex(0);
|
|
704
|
+
return setFocus('detail');
|
|
705
|
+
}
|
|
706
|
+
if (!useBrowseHome) {
|
|
707
|
+
if (tab === 'collection')
|
|
708
|
+
return openDetail(row.skill, true);
|
|
709
|
+
if (row.skill.fromCollection)
|
|
710
|
+
return openDetail(row.skill, true);
|
|
711
|
+
}
|
|
572
712
|
}
|
|
573
713
|
if (key.return || input.includes('\r') || input.includes('\n')) {
|
|
574
714
|
if (tab === 'collection' && selectedCollection.length) {
|
|
@@ -614,19 +754,94 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
614
754
|
if (useBrowseHome) {
|
|
615
755
|
const { tagWidth, listWidth, peekWidth } = masterDetailColumns;
|
|
616
756
|
const selectedPaths = selected;
|
|
757
|
+
const tagActiveIndex = Math.max(0, Math.min(tagCursor, tagOptions.length - 1));
|
|
758
|
+
const tagOffset = Math.max(0, Math.min(tagActiveIndex - Math.floor(viewportHeight / 2), Math.max(0, tagOptions.length - viewportHeight)));
|
|
617
759
|
const tagLines = collectionCategoryLines(tagOptions, tagCursor, focus === 'tags', tagWidth, viewportHeight);
|
|
618
|
-
const { lines: listLines, activeLineIndexes: listActiveLineIndexes, selectedLineIndexes: listSelectedLineIndexes, } = collectionListColumnLines(paneRows, cursor, focus === 'list', options.preferNote ?? false, listWidth, viewportHeight, selectedPaths, options.updates ?? new Set(), options.updatingSkillName);
|
|
619
|
-
const detailRows = browseDetailRows(peekSkill, peekWidth, viewportHeight, options.collection ?? false, options.updates ?? new Set(), options.updatingSkillName);
|
|
620
|
-
const headerLine = (left, middle, right) => (_jsxs(
|
|
621
|
-
return (_jsxs(
|
|
760
|
+
const { lines: listLines, skillOffset, activeLineIndexes: listActiveLineIndexes, selectedLineIndexes: listSelectedLineIndexes, } = collectionListColumnLines(paneRows, cursor, focus === 'list', options.preferNote ?? false, listWidth, viewportHeight, selectedPaths, options.updates ?? new Set(), options.updatingSkillName, updatingFrame);
|
|
761
|
+
const detailRows = browseDetailRows(peekSkill, peekWidth, viewportHeight, options.collection ?? false, options.updates ?? new Set(), options.updatingSkillName, updatingFrame);
|
|
762
|
+
const headerLine = (left, middle, right) => (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(left, tagWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsxs("box", { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(middle, listWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsx("box", { flexDirection: "row", width: peekWidth, children: _jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(right, peekWidth) }) })] }));
|
|
763
|
+
return (_jsxs("box", { flexDirection: "column", children: [_jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'top', true) }), headerLine(t('common.tags'), t('common.skill'), t('common.detail')), masterDetailBlankRow(tagWidth, listWidth, peekWidth), _jsx(MasterDetailBody, { tagLines: tagLines, listLines: listLines, peekLines: [], tagWidth: tagWidth, listWidth: listWidth, peekWidth: peekWidth, tagActive: focus === 'tags', listActive: focus === 'list', detailActive: focus === 'detail', ...(activeDetailField ? { detailActiveField: activeDetailField } : {}), collectionHome: true, ...(listActiveLineIndexes ? { listActiveLineIndexes } : {}), ...(listSelectedLineIndexes ? { listSelectedLineIndexes } : {}), detailRows: detailRows, onTagLineClick: (visibleIndex) => {
|
|
764
|
+
const absolute = tagOffset + visibleIndex;
|
|
765
|
+
if (absolute < 0 || absolute >= tagOptions.length)
|
|
766
|
+
return;
|
|
767
|
+
const option = tagOptions[absolute];
|
|
768
|
+
if (!option)
|
|
769
|
+
return;
|
|
770
|
+
setTagFilter(option.key);
|
|
771
|
+
setTagCursor(absolute);
|
|
772
|
+
setCursor(0);
|
|
773
|
+
setFocus('tags');
|
|
774
|
+
}, onListLineClick: (visibleIndex) => {
|
|
775
|
+
// Paired name/summary lines → skill index.
|
|
776
|
+
const skillIndex = skillOffset + Math.floor(visibleIndex / 2);
|
|
777
|
+
if (skillIndex < 0 || skillIndex >= paneRows.length)
|
|
778
|
+
return;
|
|
779
|
+
setCursor(skillIndex);
|
|
780
|
+
setFocus('list');
|
|
781
|
+
const row = paneRows[skillIndex];
|
|
782
|
+
if (!row)
|
|
783
|
+
return;
|
|
784
|
+
const paths = selectableSkills(row).map((skill) => skill.path);
|
|
785
|
+
if (!paths.length)
|
|
786
|
+
return;
|
|
787
|
+
setSelected((previous) => {
|
|
788
|
+
const next = new Set(previous);
|
|
789
|
+
const allSelected = paths.every((path) => previous.has(path));
|
|
790
|
+
for (const path of paths) {
|
|
791
|
+
if (allSelected)
|
|
792
|
+
next.delete(path);
|
|
793
|
+
else
|
|
794
|
+
next.add(path);
|
|
795
|
+
}
|
|
796
|
+
return next;
|
|
797
|
+
});
|
|
798
|
+
}, onDetailLineClick: (visibleIndex) => {
|
|
799
|
+
const row = detailRows[visibleIndex];
|
|
800
|
+
if (!row?.field)
|
|
801
|
+
return;
|
|
802
|
+
const index = detailFields.indexOf(row.field);
|
|
803
|
+
if (index < 0)
|
|
804
|
+
return;
|
|
805
|
+
setDetailFieldIndex(index);
|
|
806
|
+
setFocus('detail');
|
|
807
|
+
}, onListScroll: (delta) => {
|
|
808
|
+
setFocus('list');
|
|
809
|
+
setCursor((index) => Math.max(0, Math.min(Math.max(0, paneRows.length - 1), index + delta)));
|
|
810
|
+
} }), _jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'bottom', true) })] }));
|
|
622
811
|
}
|
|
623
|
-
return (_jsx(SkillPane, { rows: paneRows, cursor: cursor, isActive: focus === 'list', viewportHeight: viewportHeight,
|
|
812
|
+
return (_jsx(SkillPane, { rows: paneRows, cursor: cursor, isActive: focus === 'list', viewportHeight: viewportHeight, onRowClick: (index) => {
|
|
813
|
+
setCursor(index);
|
|
814
|
+
setFocus('list');
|
|
815
|
+
const row = paneRows[index];
|
|
816
|
+
if (!row)
|
|
817
|
+
return;
|
|
818
|
+
const paths = selectableSkills(row).map((skill) => skill.path);
|
|
819
|
+
if (!paths.length)
|
|
820
|
+
return;
|
|
821
|
+
setSelected((previous) => {
|
|
822
|
+
const next = new Set(previous);
|
|
823
|
+
const allSelected = paths.every((path) => previous.has(path));
|
|
824
|
+
for (const path of paths) {
|
|
825
|
+
if (allSelected)
|
|
826
|
+
next.delete(path);
|
|
827
|
+
else
|
|
828
|
+
next.add(path);
|
|
829
|
+
}
|
|
830
|
+
return next;
|
|
831
|
+
});
|
|
832
|
+
}, onCursorDelta: (delta) => {
|
|
833
|
+
setFocus('list');
|
|
834
|
+
setCursor((index) => Math.max(0, Math.min(Math.max(0, paneRows.length - 1), index + delta)));
|
|
835
|
+
}, ...options }));
|
|
624
836
|
};
|
|
625
837
|
const tabs = [
|
|
626
838
|
{
|
|
627
839
|
key: 'project',
|
|
628
|
-
label:
|
|
629
|
-
content: (_jsxs(
|
|
840
|
+
label: t('browser.tabProject', { count: project.length }),
|
|
841
|
+
content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleProjectGroups, agent: activeProjectAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
|
|
842
|
+
setAgent(name);
|
|
843
|
+
setCursor(0);
|
|
844
|
+
} }), renderBrowsePane(listRows, browseViewportHeight(true), {
|
|
630
845
|
showSource: true,
|
|
631
846
|
showReferences: true,
|
|
632
847
|
showGroup: Boolean(query.trim()),
|
|
@@ -634,16 +849,19 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
634
849
|
},
|
|
635
850
|
{
|
|
636
851
|
key: 'global',
|
|
637
|
-
label:
|
|
638
|
-
content: (_jsxs(
|
|
852
|
+
label: t('browser.tabGlobal', { count: globalGroups.reduce((count, group) => count + group.skills.length, 0) }),
|
|
853
|
+
content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleGlobalGroups, agent: activeGlobalAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
|
|
854
|
+
setAgent(name);
|
|
855
|
+
setCursor(0);
|
|
856
|
+
} }), renderBrowsePane(listRows, browseViewportHeight(true), {
|
|
639
857
|
showSource: true,
|
|
640
858
|
showGroup: Boolean(query.trim()),
|
|
641
859
|
})] })),
|
|
642
860
|
},
|
|
643
861
|
{
|
|
644
862
|
key: 'collection',
|
|
645
|
-
label:
|
|
646
|
-
content: (_jsx(
|
|
863
|
+
label: t('browser.tabCollection', { count: collection.length }),
|
|
864
|
+
content: (_jsx("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: renderBrowsePane(listRows, browseViewportHeight(false), {
|
|
647
865
|
preferNote: true,
|
|
648
866
|
collection: true,
|
|
649
867
|
showGroup: Boolean(query.trim()),
|
|
@@ -653,7 +871,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
653
871
|
},
|
|
654
872
|
];
|
|
655
873
|
if (choosingGroup) {
|
|
656
|
-
return (_jsx(Select, { label:
|
|
874
|
+
return (_jsx(Select, { label: t('browser.jumpToGroup'), numbered: true, options: groups.map((group) => ({
|
|
657
875
|
label: `${group.name} (${group.skills.length})`,
|
|
658
876
|
value: group.name,
|
|
659
877
|
})), onSubmit: (name) => {
|
|
@@ -672,6 +890,6 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
|
|
|
672
890
|
setChoosingGroup(false);
|
|
673
891
|
} }));
|
|
674
892
|
}
|
|
675
|
-
return (_jsx(
|
|
893
|
+
return (_jsx("box", { flexDirection: "column", children: _jsx(Tabs, { tabs: tabs, activeTab: tab, onTabChange: (key) => setTab(key), isActive: !shellBusy && !searching && focus === 'tabs', enableArrowNav: false, focused: !shellBusy && !searching && focus === 'tabs', width: frame.frameWidth, bordered: false, chip: useBrowseHome }) }));
|
|
676
894
|
}
|
|
677
895
|
//# sourceMappingURL=browser.js.map
|