ccstatusline-zh 2.2.34 → 2.2.35
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 +18 -7
- package/dist/{ccstatusline-rdsx5ab1.js → ccstatusline-71188a0p.js} +23 -25
- package/dist/ccstatusline-88bs860s.js +6063 -0
- package/dist/{ccstatusline-jp52tswn.js → ccstatusline-98magj3t.js} +1578 -6733
- package/dist/ccstatusline-j1gdxtq4.js +180 -0
- package/dist/ccstatusline.js +390 -15
- package/dist/dev-reload-egdx2kp5.js +23 -0
- package/dist/{hooks-0wev7tf6.js → hooks-zr7bxw3x.js} +23 -14
- package/dist/{index-pzts8765.js → index-7sf5nvak.js} +302 -81
- package/package.json +3 -3
|
@@ -14,9 +14,6 @@ import {
|
|
|
14
14
|
getPowerlineThemes,
|
|
15
15
|
getPowerlineTheme,
|
|
16
16
|
getDefaultPowerlineTheme,
|
|
17
|
-
getColorLevelString,
|
|
18
|
-
NUMBER_KINDS,
|
|
19
|
-
DefaultPaddingSideSchema,
|
|
20
17
|
generateGuid,
|
|
21
18
|
getPackageVersion,
|
|
22
19
|
canDetectTerminalWidth,
|
|
@@ -41,6 +38,7 @@ import {
|
|
|
41
38
|
Transform,
|
|
42
39
|
use_input_default,
|
|
43
40
|
use_app_default,
|
|
41
|
+
use_stdout_default,
|
|
44
42
|
getPlainInput,
|
|
45
43
|
shouldInsertInput,
|
|
46
44
|
require_jsx_runtime,
|
|
@@ -83,12 +81,27 @@ import {
|
|
|
83
81
|
validateImportFile,
|
|
84
82
|
applyImport,
|
|
85
83
|
saveInstallationMetadata
|
|
86
|
-
} from "./ccstatusline-
|
|
84
|
+
} from "./ccstatusline-98magj3t.js";
|
|
85
|
+
import {
|
|
86
|
+
getColorLevelString,
|
|
87
|
+
NUMBER_KINDS,
|
|
88
|
+
DefaultPaddingSideSchema,
|
|
89
|
+
DEFAULT_SETTINGS
|
|
90
|
+
} from "./ccstatusline-88bs860s.js";
|
|
91
|
+
import {
|
|
92
|
+
DEV_RELOAD_EXIT_CODE2,
|
|
93
|
+
getDevReloadStateFile2,
|
|
94
|
+
writeDevReloadSnapshot2,
|
|
95
|
+
discardDevReloadSnapshot2,
|
|
96
|
+
readDevReloadSnapshot2,
|
|
97
|
+
requestDevReload2,
|
|
98
|
+
isDevReloadRequested2
|
|
99
|
+
} from "./ccstatusline-j1gdxtq4.js";
|
|
87
100
|
import {
|
|
88
101
|
assignPowerlineThemeSlots,
|
|
89
102
|
advanceGlobalPowerlineThemeIndex,
|
|
90
103
|
advanceGlobalSeparatorIndex
|
|
91
|
-
} from "./ccstatusline-
|
|
104
|
+
} from "./ccstatusline-71188a0p.js";
|
|
92
105
|
import {
|
|
93
106
|
__toESM,
|
|
94
107
|
__commonJS
|
|
@@ -2092,12 +2105,16 @@ function splitCommandOutput(output) {
|
|
|
2092
2105
|
}
|
|
2093
2106
|
return paths;
|
|
2094
2107
|
}
|
|
2095
|
-
|
|
2108
|
+
var TRANSIENT_STATUS_LINE_PATH_PATTERNS = [
|
|
2109
|
+
/(?:^|\/)bunx-[^/]*ccstatusline-zh@[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i,
|
|
2110
|
+
/(?:^|\/)_npx\/[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i
|
|
2111
|
+
];
|
|
2112
|
+
function isTransientStatusLinePath(filePath) {
|
|
2096
2113
|
const normalized = filePath.replace(/\\/g, "/");
|
|
2097
|
-
return
|
|
2114
|
+
return TRANSIENT_STATUS_LINE_PATH_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
2098
2115
|
}
|
|
2099
2116
|
function getPersistentCommandResolutionPaths(paths) {
|
|
2100
|
-
return paths.filter((path) => !
|
|
2117
|
+
return paths.filter((path) => !isTransientStatusLinePath(path));
|
|
2101
2118
|
}
|
|
2102
2119
|
function getCommandResolutionPaths(command, { platform = process.platform } = {}) {
|
|
2103
2120
|
try {
|
|
@@ -2295,7 +2312,8 @@ function getDirectoryName2(filePath) {
|
|
|
2295
2312
|
return lastSlashIndex === -1 ? "" : normalized.slice(0, lastSlashIndex);
|
|
2296
2313
|
}
|
|
2297
2314
|
function getComparablePath(filePath) {
|
|
2298
|
-
|
|
2315
|
+
const normalized = filePath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
2316
|
+
return isWindowsStylePath(normalized) || normalized.startsWith("/mnt/") ? normalized.toLowerCase() : normalized;
|
|
2299
2317
|
}
|
|
2300
2318
|
function getUniqueResolvedDirs2(resolvedPaths) {
|
|
2301
2319
|
const seen = new Set;
|
|
@@ -6140,6 +6158,73 @@ function handleNormalInputMode({
|
|
|
6140
6158
|
}
|
|
6141
6159
|
}
|
|
6142
6160
|
|
|
6161
|
+
// src/tui/components/items-editor/list-window.ts
|
|
6162
|
+
var PICKER_RESERVED_ROWS = 16;
|
|
6163
|
+
var MIN_VISIBLE_ENTRIES = 3;
|
|
6164
|
+
var DEFAULT_VISIBLE_ENTRIES = 10;
|
|
6165
|
+
function getListWindow(total, selectedIndex, maxVisible) {
|
|
6166
|
+
if (total <= maxVisible) {
|
|
6167
|
+
return { start: 0, end: total, hiddenAbove: 0, hiddenBelow: 0 };
|
|
6168
|
+
}
|
|
6169
|
+
const start = Math.min(Math.max(0, selectedIndex - Math.floor(maxVisible / 2)), total - maxVisible);
|
|
6170
|
+
const end = start + maxVisible;
|
|
6171
|
+
return { start, end, hiddenAbove: start, hiddenBelow: total - end };
|
|
6172
|
+
}
|
|
6173
|
+
function getPickerMaxVisible(terminalRows, statusLineCount, descriptionRows = 1) {
|
|
6174
|
+
if (!terminalRows) {
|
|
6175
|
+
return DEFAULT_VISIBLE_ENTRIES;
|
|
6176
|
+
}
|
|
6177
|
+
return Math.max(MIN_VISIBLE_ENTRIES, terminalRows - PICKER_RESERVED_ROWS - statusLineCount - (descriptionRows - 1));
|
|
6178
|
+
}
|
|
6179
|
+
function getWrappedRows(line, width) {
|
|
6180
|
+
let rows = 1;
|
|
6181
|
+
let used = 0;
|
|
6182
|
+
for (const word of line.split(" ")) {
|
|
6183
|
+
const wordWidth = getVisibleWidth(word);
|
|
6184
|
+
if (used > 0 && used + 1 + wordWidth <= width) {
|
|
6185
|
+
used += 1 + wordWidth;
|
|
6186
|
+
continue;
|
|
6187
|
+
}
|
|
6188
|
+
if (used > 0) {
|
|
6189
|
+
rows++;
|
|
6190
|
+
}
|
|
6191
|
+
rows += Math.floor(Math.max(0, wordWidth - 1) / width);
|
|
6192
|
+
used = wordWidth === 0 ? 0 : (wordWidth - 1) % width + 1;
|
|
6193
|
+
}
|
|
6194
|
+
return rows;
|
|
6195
|
+
}
|
|
6196
|
+
function getDescriptionRows(description, width) {
|
|
6197
|
+
const lines = description.split(`
|
|
6198
|
+
`);
|
|
6199
|
+
if (!width || width < 1) {
|
|
6200
|
+
return lines.length;
|
|
6201
|
+
}
|
|
6202
|
+
return lines.reduce((rows, line) => rows + getWrappedRows(line, width), 0);
|
|
6203
|
+
}
|
|
6204
|
+
|
|
6205
|
+
// src/tui/components/items-editor/picker-selection.ts
|
|
6206
|
+
function getPickerInsertIndex(action, widgetCount, selectedIndex) {
|
|
6207
|
+
if (action === "add") {
|
|
6208
|
+
return widgetCount > 0 ? selectedIndex + 1 : 0;
|
|
6209
|
+
}
|
|
6210
|
+
return selectedIndex;
|
|
6211
|
+
}
|
|
6212
|
+
function placePickerSelection(widgets, action, selectedIndex, selectedType, newWidget) {
|
|
6213
|
+
if (action === "change") {
|
|
6214
|
+
const currentWidget = widgets[selectedIndex];
|
|
6215
|
+
if (!currentWidget) {
|
|
6216
|
+
return { widgets, selectedIndex };
|
|
6217
|
+
}
|
|
6218
|
+
const newWidgets = [...widgets];
|
|
6219
|
+
newWidgets[selectedIndex] = currentWidget.type === selectedType ? currentWidget : { ...clearLabel(currentWidget), type: selectedType };
|
|
6220
|
+
return { widgets: newWidgets, selectedIndex };
|
|
6221
|
+
}
|
|
6222
|
+
const insertIndex = getPickerInsertIndex(action, widgets.length, selectedIndex);
|
|
6223
|
+
const newWidgets = [...widgets];
|
|
6224
|
+
newWidgets.splice(insertIndex, 0, { ...newWidget, type: selectedType });
|
|
6225
|
+
return { widgets: newWidgets, selectedIndex: insertIndex };
|
|
6226
|
+
}
|
|
6227
|
+
|
|
6143
6228
|
// src/tui/components/ItemsEditor.tsx
|
|
6144
6229
|
var jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
6145
6230
|
function isMergedIntoPreviousWidget(widgets, index) {
|
|
@@ -6148,12 +6233,48 @@ function isMergedIntoPreviousWidget(widgets, index) {
|
|
|
6148
6233
|
}
|
|
6149
6234
|
return Boolean(widgets[index - 1]?.merge);
|
|
6150
6235
|
}
|
|
6151
|
-
var
|
|
6152
|
-
|
|
6236
|
+
var DESCRIPTION_INDENT = 2;
|
|
6237
|
+
var HiddenEntriesMarker = ({ arrow, count }) => /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6238
|
+
paddingLeft: 3,
|
|
6239
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6240
|
+
dimColor: true,
|
|
6241
|
+
children: count > 0 ? `${arrow} 另有 ${count} 项` : " "
|
|
6242
|
+
})
|
|
6243
|
+
});
|
|
6244
|
+
function renderWindowedList(items, selectedIndex, maxVisible, renderItem) {
|
|
6245
|
+
const visible = getListWindow(items.length, Math.max(0, selectedIndex), maxVisible);
|
|
6246
|
+
const isWindowed = items.length > maxVisible;
|
|
6247
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6248
|
+
children: [
|
|
6249
|
+
isWindowed && /* @__PURE__ */ jsx_runtime11.jsx(HiddenEntriesMarker, {
|
|
6250
|
+
arrow: "↑",
|
|
6251
|
+
count: visible.hiddenAbove
|
|
6252
|
+
}),
|
|
6253
|
+
items.slice(visible.start, visible.end).map((item, offset) => renderItem(item, visible.start + offset)),
|
|
6254
|
+
isWindowed && /* @__PURE__ */ jsx_runtime11.jsx(HiddenEntriesMarker, {
|
|
6255
|
+
arrow: "↓",
|
|
6256
|
+
count: visible.hiddenBelow
|
|
6257
|
+
})
|
|
6258
|
+
]
|
|
6259
|
+
});
|
|
6260
|
+
}
|
|
6261
|
+
var ItemsEditor = ({
|
|
6262
|
+
widgets,
|
|
6263
|
+
onUpdate,
|
|
6264
|
+
onPreviewChange,
|
|
6265
|
+
onBack,
|
|
6266
|
+
initialSelectedIndex = 0,
|
|
6267
|
+
onSelectedIndexChange,
|
|
6268
|
+
lineNumber,
|
|
6269
|
+
settings
|
|
6270
|
+
}) => {
|
|
6271
|
+
const [selectedIndex, setSelectedIndex] = import_react12.useState(() => Math.min(initialSelectedIndex, Math.max(0, widgets.length - 1)));
|
|
6153
6272
|
const [moveMode, setMoveMode] = import_react12.useState(false);
|
|
6154
6273
|
const [customEditorWidget, setCustomEditorWidget] = import_react12.useState(null);
|
|
6155
6274
|
const [widgetPicker, setWidgetPicker] = import_react12.useState(null);
|
|
6275
|
+
const [pickerNewWidget, setPickerNewWidget] = import_react12.useState(null);
|
|
6156
6276
|
const [showClearConfirm, setShowClearConfirm] = import_react12.useState(false);
|
|
6277
|
+
const { stdout } = use_stdout_default();
|
|
6157
6278
|
const separatorChars = ["|", "-", ",", " "];
|
|
6158
6279
|
import_react12.useEffect(() => () => {
|
|
6159
6280
|
onPreviewChange?.(null);
|
|
@@ -6195,7 +6316,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6195
6316
|
if ((widgetImpl.getHideableStates?.().length ?? 0) > 0) {
|
|
6196
6317
|
keybinds.push(getHideKeybind());
|
|
6197
6318
|
}
|
|
6198
|
-
if (
|
|
6319
|
+
if (!widget.rawValue && widgetImpl.getLabelPrefix?.(widget) !== undefined) {
|
|
6199
6320
|
keybinds.push(getLabelKeybind());
|
|
6200
6321
|
}
|
|
6201
6322
|
return keybinds;
|
|
@@ -6206,6 +6327,11 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6206
6327
|
}
|
|
6207
6328
|
const currentType = widgets[selectedIndex]?.type;
|
|
6208
6329
|
const selectedType = action === "change" ? currentType ?? null : null;
|
|
6330
|
+
const backgroundColor = action === "change" ? undefined : getUniqueBackgroundColor(getPickerInsertIndex(action, widgets.length, selectedIndex));
|
|
6331
|
+
setPickerNewWidget({
|
|
6332
|
+
id: generateGuid(),
|
|
6333
|
+
...backgroundColor && { backgroundColor }
|
|
6334
|
+
});
|
|
6209
6335
|
setWidgetPicker(normalizePickerState({
|
|
6210
6336
|
action,
|
|
6211
6337
|
level: "category",
|
|
@@ -6219,25 +6345,10 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6219
6345
|
if (!widgetPicker) {
|
|
6220
6346
|
return;
|
|
6221
6347
|
}
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
newWidgets[selectedIndex] = currentWidget.type === selectedType ? currentWidget : { ...clearLabel(currentWidget), type: selectedType };
|
|
6227
|
-
onUpdate(newWidgets);
|
|
6228
|
-
}
|
|
6229
|
-
} else {
|
|
6230
|
-
const insertIndex = widgetPicker.action === "add" ? widgets.length > 0 ? selectedIndex + 1 : 0 : selectedIndex;
|
|
6231
|
-
const backgroundColor = getUniqueBackgroundColor(insertIndex);
|
|
6232
|
-
const newWidget = {
|
|
6233
|
-
id: generateGuid(),
|
|
6234
|
-
type: selectedType,
|
|
6235
|
-
...backgroundColor && { backgroundColor }
|
|
6236
|
-
};
|
|
6237
|
-
const newWidgets = [...widgets];
|
|
6238
|
-
newWidgets.splice(insertIndex, 0, newWidget);
|
|
6239
|
-
onUpdate(newWidgets);
|
|
6240
|
-
setSelectedIndex(insertIndex);
|
|
6348
|
+
const placement = placePickerSelection(widgets, widgetPicker.action, selectedIndex, selectedType, pickerNewWidget ?? { id: generateGuid() });
|
|
6349
|
+
if (placement.widgets !== widgets) {
|
|
6350
|
+
onUpdate(placement.widgets);
|
|
6351
|
+
setSelectedIndex(placement.selectedIndex);
|
|
6241
6352
|
}
|
|
6242
6353
|
setWidgetPicker(null);
|
|
6243
6354
|
};
|
|
@@ -6330,6 +6441,24 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6330
6441
|
const selectedTopLevelSearchEntry = widgetPicker ? topLevelSearchEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? topLevelSearchEntries[0] : null;
|
|
6331
6442
|
const pickerEntries = widgetPicker ? filterWidgetCatalog(widgetCatalog, selectedPickerCategory ?? "全部", widgetPicker.widgetQuery) : [];
|
|
6332
6443
|
const selectedPickerEntry = widgetPicker ? pickerEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? pickerEntries[0] : null;
|
|
6444
|
+
const browsedEntries = widgetPicker?.level === "widget" ? pickerEntries : topLevelSearchEntries;
|
|
6445
|
+
const descriptionWidth = stdout.columns ? stdout.columns - DESCRIPTION_INDENT : undefined;
|
|
6446
|
+
const pickerMaxVisible = getPickerMaxVisible(stdout.rows, settings.lines.filter((line) => line.length > 0).length, Math.max(1, ...browsedEntries.map((entry) => getDescriptionRows(entry.description, descriptionWidth))));
|
|
6447
|
+
const searchResultType = widgetPicker && widgetPicker.categoryQuery.trim().length > 0 ? selectedTopLevelSearchEntry?.type : undefined;
|
|
6448
|
+
const highlightedPickerType = widgetPicker?.level === "widget" ? selectedPickerEntry?.type : searchResultType;
|
|
6449
|
+
const pickerAction = widgetPicker?.action;
|
|
6450
|
+
const previewWidgets = import_react12.useMemo(() => {
|
|
6451
|
+
if (!pickerAction || !highlightedPickerType || !pickerNewWidget) {
|
|
6452
|
+
return null;
|
|
6453
|
+
}
|
|
6454
|
+
return placePickerSelection(widgets, pickerAction, selectedIndex, highlightedPickerType, pickerNewWidget).widgets;
|
|
6455
|
+
}, [widgets, pickerAction, selectedIndex, highlightedPickerType, pickerNewWidget]);
|
|
6456
|
+
import_react12.useEffect(() => {
|
|
6457
|
+
onPreviewChange?.(previewWidgets);
|
|
6458
|
+
}, [onPreviewChange, previewWidgets]);
|
|
6459
|
+
import_react12.useEffect(() => {
|
|
6460
|
+
onSelectedIndexChange?.(selectedIndex);
|
|
6461
|
+
}, [onSelectedIndexChange, selectedIndex]);
|
|
6333
6462
|
let helpText = hasWidgets ? "↑↓ 选择, ←→ 打开类型选择器" : "(a)添加, (i)插入";
|
|
6334
6463
|
if (isSeparator) {
|
|
6335
6464
|
helpText += ", 空格编辑分隔符";
|
|
@@ -6357,10 +6486,11 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6357
6486
|
onCancel: handleEditorCancel
|
|
6358
6487
|
});
|
|
6359
6488
|
}
|
|
6360
|
-
|
|
6489
|
+
const editorLabel = customEditorWidget?.impl.getLabelPrefix?.(customEditorWidget.widget);
|
|
6490
|
+
if (customEditorWidget?.action === EDIT_LABEL_ACTION && editorLabel !== undefined) {
|
|
6361
6491
|
return /* @__PURE__ */ jsx_runtime11.jsx(LabelEditor, {
|
|
6362
6492
|
widget: customEditorWidget.widget,
|
|
6363
|
-
defaultLabel:
|
|
6493
|
+
defaultLabel: editorLabel,
|
|
6364
6494
|
onComplete: handleEditorComplete,
|
|
6365
6495
|
onCancel: handleEditorCancel,
|
|
6366
6496
|
onPreview: (updatedWidget) => {
|
|
@@ -6556,7 +6686,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6556
6686
|
children: "没有匹配的组件。"
|
|
6557
6687
|
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6558
6688
|
children: [
|
|
6559
|
-
topLevelSearchEntries.
|
|
6689
|
+
renderWindowedList(topLevelSearchEntries, topLevelSearchEntries.findIndex((entry) => entry.type === selectedTopLevelSearchEntry?.type), pickerMaxVisible, (entry, index) => {
|
|
6560
6690
|
const isSelected = entry.type === selectedTopLevelSearchEntry?.type;
|
|
6561
6691
|
const segments = getMatchSegments(entry.displayName, widgetPicker.categoryQuery);
|
|
6562
6692
|
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
@@ -6584,7 +6714,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6584
6714
|
}),
|
|
6585
6715
|
selectedTopLevelSearchEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6586
6716
|
marginTop: 1,
|
|
6587
|
-
paddingLeft:
|
|
6717
|
+
paddingLeft: DESCRIPTION_INDENT,
|
|
6588
6718
|
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6589
6719
|
dimColor: true,
|
|
6590
6720
|
children: selectedTopLevelSearchEntry.description
|
|
@@ -6596,7 +6726,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6596
6726
|
children: "没有可用的分类。"
|
|
6597
6727
|
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6598
6728
|
children: [
|
|
6599
|
-
pickerCategories.
|
|
6729
|
+
renderWindowedList(pickerCategories, selectedPickerCategory === null ? -1 : pickerCategories.indexOf(selectedPickerCategory), pickerMaxVisible, (category, index) => {
|
|
6600
6730
|
const isSelected = category === selectedPickerCategory;
|
|
6601
6731
|
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6602
6732
|
flexDirection: "row",
|
|
@@ -6630,7 +6760,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6630
6760
|
children: "没有匹配当前分类/搜索的组件。"
|
|
6631
6761
|
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6632
6762
|
children: [
|
|
6633
|
-
pickerEntries.
|
|
6763
|
+
renderWindowedList(pickerEntries, pickerEntries.findIndex((entry) => entry.type === selectedPickerEntry?.type), pickerMaxVisible, (entry, index) => {
|
|
6634
6764
|
const isSelected = entry.type === selectedPickerEntry?.type;
|
|
6635
6765
|
const segments = getMatchSegments(entry.displayName, widgetPicker.widgetQuery);
|
|
6636
6766
|
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
@@ -6658,7 +6788,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6658
6788
|
}),
|
|
6659
6789
|
selectedPickerEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6660
6790
|
marginTop: 1,
|
|
6661
|
-
paddingLeft:
|
|
6791
|
+
paddingLeft: DESCRIPTION_INDENT,
|
|
6662
6792
|
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6663
6793
|
dimColor: true,
|
|
6664
6794
|
children: selectedPickerEntry.description
|
|
@@ -6682,7 +6812,7 @@ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, set
|
|
|
6682
6812
|
const supportsRawValue = widgetImpl?.supportsRawValue() ?? false;
|
|
6683
6813
|
const numberFormatModifierText = widgetImpl?.supportsNumberFormat?.() ? getNumberFormatModifierText(widget) : undefined;
|
|
6684
6814
|
const hideModifierText = widgetImpl ? getHideModifierText(widget, widgetImpl.getHideableStates?.() ?? []) : undefined;
|
|
6685
|
-
const labelModifierText = widgetImpl?.getLabelPrefix
|
|
6815
|
+
const labelModifierText = !widget.rawValue && widgetImpl?.getLabelPrefix?.(widget) !== undefined ? getLabelModifierText(widget) : undefined;
|
|
6686
6816
|
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6687
6817
|
flexDirection: "row",
|
|
6688
6818
|
flexWrap: "nowrap",
|
|
@@ -6777,6 +6907,7 @@ var LineSelector = ({
|
|
|
6777
6907
|
onBack,
|
|
6778
6908
|
onLinesUpdate,
|
|
6779
6909
|
initialSelection = 0,
|
|
6910
|
+
onSelectionChange,
|
|
6780
6911
|
title,
|
|
6781
6912
|
blockIfPowerlineActive = false,
|
|
6782
6913
|
settings,
|
|
@@ -6792,6 +6923,9 @@ var LineSelector = ({
|
|
|
6792
6923
|
import_react13.useEffect(() => {
|
|
6793
6924
|
setSelectedIndex(initialSelection);
|
|
6794
6925
|
}, [initialSelection]);
|
|
6926
|
+
import_react13.useEffect(() => {
|
|
6927
|
+
onSelectionChange?.(selectedIndex);
|
|
6928
|
+
}, [onSelectionChange, selectedIndex]);
|
|
6795
6929
|
const selectedLine = import_react13.useMemo(() => localLines[selectedIndex], [localLines, selectedIndex]);
|
|
6796
6930
|
const appendLine = () => {
|
|
6797
6931
|
const newLines = [...localLines, []];
|
|
@@ -7172,6 +7306,7 @@ var MainMenu = ({
|
|
|
7172
7306
|
isClaudeInstalled,
|
|
7173
7307
|
hasChanges,
|
|
7174
7308
|
initialSelection = 0,
|
|
7309
|
+
onSelectionChange,
|
|
7175
7310
|
powerlineFontStatus,
|
|
7176
7311
|
settings,
|
|
7177
7312
|
installation,
|
|
@@ -7202,7 +7337,8 @@ var MainMenu = ({
|
|
|
7202
7337
|
}
|
|
7203
7338
|
onSelect(value, index);
|
|
7204
7339
|
},
|
|
7205
|
-
initialSelection
|
|
7340
|
+
initialSelection,
|
|
7341
|
+
onSelectionChange: (_, index) => onSelectionChange?.(index)
|
|
7206
7342
|
})
|
|
7207
7343
|
]
|
|
7208
7344
|
});
|
|
@@ -7392,9 +7528,8 @@ function resolveEnabledPowerlineTheme(theme) {
|
|
|
7392
7528
|
}
|
|
7393
7529
|
return theme;
|
|
7394
7530
|
}
|
|
7395
|
-
function buildEnabledPowerlineSettings(settings
|
|
7531
|
+
function buildEnabledPowerlineSettings(settings) {
|
|
7396
7532
|
const powerlineConfig = settings.powerline;
|
|
7397
|
-
const lines = removeManualSeparators ? settings.lines.map((line) => line.filter((item) => item.type !== "separator")) : settings.lines;
|
|
7398
7533
|
return {
|
|
7399
7534
|
...settings,
|
|
7400
7535
|
powerline: {
|
|
@@ -7404,8 +7539,7 @@ function buildEnabledPowerlineSettings(settings, removeManualSeparators) {
|
|
|
7404
7539
|
separators: powerlineConfig.separators,
|
|
7405
7540
|
separatorInvertBackground: powerlineConfig.separatorInvertBackground
|
|
7406
7541
|
},
|
|
7407
|
-
defaultPadding: " "
|
|
7408
|
-
lines
|
|
7542
|
+
defaultPadding: " "
|
|
7409
7543
|
};
|
|
7410
7544
|
}
|
|
7411
7545
|
|
|
@@ -8041,7 +8175,7 @@ var PowerlineSetup = ({
|
|
|
8041
8175
|
if (hasManualSeparatorItems) {
|
|
8042
8176
|
setConfirmingEnable(true);
|
|
8043
8177
|
} else {
|
|
8044
|
-
onUpdate(buildEnabledPowerlineSettings(settings
|
|
8178
|
+
onUpdate(buildEnabledPowerlineSettings(settings));
|
|
8045
8179
|
}
|
|
8046
8180
|
} else {
|
|
8047
8181
|
onUpdate({
|
|
@@ -8278,14 +8412,14 @@ var PowerlineSetup = ({
|
|
|
8278
8412
|
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8279
8413
|
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8280
8414
|
color: "yellow",
|
|
8281
|
-
children: "⚠
|
|
8415
|
+
children: "⚠ Powerline 模式使用自己的分隔符系统。"
|
|
8282
8416
|
})
|
|
8283
8417
|
}),
|
|
8284
8418
|
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8285
8419
|
marginBottom: 1,
|
|
8286
8420
|
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8287
8421
|
dimColor: true,
|
|
8288
|
-
children: "Powerline
|
|
8422
|
+
children: "现有手动分隔符会保留在配置中,但在启用 Powerline 时不显示。"
|
|
8289
8423
|
})
|
|
8290
8424
|
})
|
|
8291
8425
|
]
|
|
@@ -8301,7 +8435,7 @@ var PowerlineSetup = ({
|
|
|
8301
8435
|
children: /* @__PURE__ */ jsx_runtime17.jsx(ConfirmDialog, {
|
|
8302
8436
|
inline: true,
|
|
8303
8437
|
onConfirm: () => {
|
|
8304
|
-
onUpdate(buildEnabledPowerlineSettings(settings
|
|
8438
|
+
onUpdate(buildEnabledPowerlineSettings(settings));
|
|
8305
8439
|
setConfirmingEnable(false);
|
|
8306
8440
|
},
|
|
8307
8441
|
onCancel: () => {
|
|
@@ -9051,19 +9185,25 @@ function validateCompactThresholdInput(value) {
|
|
|
9051
9185
|
return null;
|
|
9052
9186
|
}
|
|
9053
9187
|
function buildTerminalWidthItems(selectedOption, compactThreshold) {
|
|
9188
|
+
const getSublabel = (option) => {
|
|
9189
|
+
if (option === selectedOption) {
|
|
9190
|
+
return "(当前)";
|
|
9191
|
+
}
|
|
9192
|
+
return option === DEFAULT_SETTINGS.flexMode ? "(默认)" : undefined;
|
|
9193
|
+
};
|
|
9054
9194
|
return [
|
|
9055
9195
|
{
|
|
9056
9196
|
value: "full",
|
|
9057
9197
|
label: "始终全宽",
|
|
9058
|
-
sublabel:
|
|
9059
|
-
description: `使用完整终端宽度减去
|
|
9198
|
+
sublabel: getSublabel("full"),
|
|
9199
|
+
description: `使用完整终端宽度减去 6 个字符的终端内边距。如果出现自动压缩消息,可能导致行换行。
|
|
9060
9200
|
|
|
9061
9201
|
注意:如果启用了 /ide 集成,不建议使用此模式。`
|
|
9062
9202
|
},
|
|
9063
9203
|
{
|
|
9064
9204
|
value: "full-minus-40",
|
|
9065
9205
|
label: "全宽减 40",
|
|
9066
|
-
sublabel:
|
|
9206
|
+
sublabel: getSublabel("full-minus-40"),
|
|
9067
9207
|
description: "在状态栏右侧留出空间以容纳自动压缩消息。这可以防止换行但可能留下未使用的空间。此限制存在是因为我们无法检测消息何时出现。"
|
|
9068
9208
|
},
|
|
9069
9209
|
{
|
|
@@ -9449,17 +9589,17 @@ function getPinnedMismatchItems(mismatch, canRunPackageManager) {
|
|
|
9449
9589
|
const items = [];
|
|
9450
9590
|
if (mismatch.canUpdateToRunningVersion) {
|
|
9451
9591
|
items.push({
|
|
9452
|
-
label:
|
|
9592
|
+
label: `更新 ${mismatch.packageManager} 全局安装至 v${mismatch.runningVersion}`,
|
|
9453
9593
|
value: "update",
|
|
9454
9594
|
disabled: !canRunPackageManager,
|
|
9455
|
-
sublabel: canRunPackageManager ? undefined :
|
|
9456
|
-
description:
|
|
9595
|
+
sublabel: canRunPackageManager ? undefined : `(未检测到 ${mismatch.packageManager})`,
|
|
9596
|
+
description: `运行 ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline-zh@${mismatch.runningVersion}` : `bun add -g ccstatusline-zh@${mismatch.runningVersion}`}`
|
|
9457
9597
|
});
|
|
9458
9598
|
}
|
|
9459
9599
|
items.push({
|
|
9460
|
-
label: "
|
|
9600
|
+
label: "退出",
|
|
9461
9601
|
value: "exit",
|
|
9462
|
-
description:
|
|
9602
|
+
description: `请使用 ${mismatch.relaunchCommand} 手动重新启动`
|
|
9463
9603
|
});
|
|
9464
9604
|
return items;
|
|
9465
9605
|
}
|
|
@@ -9553,6 +9693,18 @@ ${commands}
|
|
|
9553
9693
|
|
|
9554
9694
|
继续?`;
|
|
9555
9695
|
}
|
|
9696
|
+
function buildSkippedHooksNotice(skipped, continueScreen) {
|
|
9697
|
+
return {
|
|
9698
|
+
title: "配置已保存",
|
|
9699
|
+
message: `未添加 ${skipped.widgetNames.join("、")} 所需的 Claude Code Hook:状态行命令不包含 "ccstatusline",可能属于其他工具。
|
|
9700
|
+
|
|
9701
|
+
${skipped.statusCommand}
|
|
9702
|
+
|
|
9703
|
+
如果这是运行 ccstatusline-zh 的包装脚本,请在脚本名称中加入 "ccstatusline"(例如 ~/.claude/ccstatusline-zh-wrapper.sh),通过 ccstatusline-zh "$@" 传递参数,然后重新保存。`,
|
|
9704
|
+
color: "yellow",
|
|
9705
|
+
continueScreen
|
|
9706
|
+
};
|
|
9707
|
+
}
|
|
9556
9708
|
function clearInstallationMetadata(settings) {
|
|
9557
9709
|
if (!settings) {
|
|
9558
9710
|
return settings;
|
|
@@ -9560,8 +9712,8 @@ function clearInstallationMetadata(settings) {
|
|
|
9560
9712
|
const { installation, ...next } = settings;
|
|
9561
9713
|
return next;
|
|
9562
9714
|
}
|
|
9563
|
-
function
|
|
9564
|
-
return
|
|
9715
|
+
function classifyInstalledStatusLine(existingStatusLine, savedInstallation) {
|
|
9716
|
+
return !existingStatusLine && savedInstallation ? savedInstallation : classifyInstallation(existingStatusLine, savedInstallation);
|
|
9565
9717
|
}
|
|
9566
9718
|
function trimTrailingSeparators2(filePath) {
|
|
9567
9719
|
return filePath.replace(/[\\/]+$/, "");
|
|
@@ -9652,14 +9804,20 @@ function buildInvalidConfigSaveConfirm(configLoadError, onConfirm, returnScreen
|
|
|
9652
9804
|
}
|
|
9653
9805
|
var App = () => {
|
|
9654
9806
|
const { exit } = use_app_default();
|
|
9807
|
+
const [devReloadStateFile] = import_react21.useState(() => getDevReloadStateFile2(process.env));
|
|
9808
|
+
const [restored] = import_react21.useState(() => devReloadStateFile ? readDevReloadSnapshot2(devReloadStateFile) : null);
|
|
9655
9809
|
const [settings, setSettings] = import_react21.useState(null);
|
|
9656
9810
|
const [originalSettings, setOriginalSettings] = import_react21.useState(null);
|
|
9657
9811
|
const [hasChanges, setHasChanges] = import_react21.useState(false);
|
|
9658
9812
|
const [configLoadError, setConfigLoadError] = import_react21.useState(null);
|
|
9659
|
-
const [screen, setScreen] = import_react21.useState("main");
|
|
9660
|
-
const [selectedLine, setSelectedLine] = import_react21.useState(0);
|
|
9813
|
+
const [screen, setScreen] = import_react21.useState(restored?.screen ?? "main");
|
|
9814
|
+
const [selectedLine, setSelectedLine] = import_react21.useState(restored?.selectedLine ?? 0);
|
|
9661
9815
|
const [previewWidgets, setPreviewWidgets] = import_react21.useState(null);
|
|
9662
|
-
const [menuSelections, setMenuSelections] = import_react21.useState({});
|
|
9816
|
+
const [menuSelections, setMenuSelections] = import_react21.useState(restored?.menuSelections ?? {});
|
|
9817
|
+
const handleLineSelectionChange = import_react21.useCallback((index) => {
|
|
9818
|
+
setMenuSelections((prev) => ({ ...prev, lines: index }));
|
|
9819
|
+
}, []);
|
|
9820
|
+
const [itemsCursor, setItemsCursor] = import_react21.useState(restored?.itemsCursor ?? 0);
|
|
9663
9821
|
const [confirmDialog, setConfirmDialog] = import_react21.useState(null);
|
|
9664
9822
|
const [isClaudeInstalled, setIsClaudeInstalled] = import_react21.useState(false);
|
|
9665
9823
|
const [terminalWidth, setTerminalWidth] = import_react21.useState(process.stdout.columns || 80);
|
|
@@ -9693,9 +9851,10 @@ var App = () => {
|
|
|
9693
9851
|
setHasLoadedClaudeStatus(true);
|
|
9694
9852
|
});
|
|
9695
9853
|
loadSettings().then((loadedSettings) => {
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9854
|
+
const initialSettings = restored?.settings ?? loadedSettings;
|
|
9855
|
+
source_default.level = initialSettings.colorLevel;
|
|
9856
|
+
setSettings(initialSettings);
|
|
9857
|
+
setOriginalSettings(cloneSettings(restored?.originalSettings ?? loadedSettings));
|
|
9699
9858
|
setConfigLoadError(getConfigLoadError());
|
|
9700
9859
|
});
|
|
9701
9860
|
isInstalled().then(setIsClaudeInstalled).catch(() => {
|
|
@@ -9715,13 +9874,24 @@ var App = () => {
|
|
|
9715
9874
|
return () => {
|
|
9716
9875
|
process.stdout.off("resize", handleResize);
|
|
9717
9876
|
};
|
|
9718
|
-
}, []);
|
|
9877
|
+
}, [restored]);
|
|
9719
9878
|
import_react21.useEffect(() => {
|
|
9720
9879
|
if (originalSettings) {
|
|
9721
9880
|
const hasAnyChanges = JSON.stringify(settings) !== JSON.stringify(originalSettings);
|
|
9722
9881
|
setHasChanges(hasAnyChanges);
|
|
9723
9882
|
}
|
|
9724
9883
|
}, [settings, originalSettings]);
|
|
9884
|
+
const loadedOriginalSettings = import_react21.useRef(null);
|
|
9885
|
+
import_react21.useEffect(() => {
|
|
9886
|
+
if (!devReloadStateFile || !originalSettings) {
|
|
9887
|
+
return;
|
|
9888
|
+
}
|
|
9889
|
+
if (!loadedOriginalSettings.current) {
|
|
9890
|
+
loadedOriginalSettings.current = originalSettings;
|
|
9891
|
+
} else if (originalSettings !== loadedOriginalSettings.current) {
|
|
9892
|
+
discardDevReloadSnapshot2(devReloadStateFile);
|
|
9893
|
+
}
|
|
9894
|
+
}, [devReloadStateFile, originalSettings]);
|
|
9725
9895
|
import_react21.useEffect(() => {
|
|
9726
9896
|
if (flashMessage) {
|
|
9727
9897
|
const timer = setTimeout(() => {
|
|
@@ -9736,8 +9906,17 @@ var App = () => {
|
|
|
9736
9906
|
if (key.ctrl && input === "c") {
|
|
9737
9907
|
exit();
|
|
9738
9908
|
}
|
|
9909
|
+
if (devReloadStateFile && key.ctrl && input === "r" && settings && originalSettings) {
|
|
9910
|
+
if (actionInFlightRef.current) {
|
|
9911
|
+
return;
|
|
9912
|
+
}
|
|
9913
|
+
writeDevReloadSnapshot2(devReloadStateFile, { settings, originalSettings, screen, selectedLine, menuSelections, itemsCursor });
|
|
9914
|
+
requestDevReload2();
|
|
9915
|
+
exit();
|
|
9916
|
+
return;
|
|
9917
|
+
}
|
|
9739
9918
|
if (key.ctrl && input === "s" && settings && screen !== "confirm") {
|
|
9740
|
-
const installation =
|
|
9919
|
+
const installation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, settings.installation) : classifyInstallation(existingStatusLine, settings.installation);
|
|
9741
9920
|
const activeCommand = installation.method === "pinned" || installation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
|
|
9742
9921
|
const effectiveInstallation = getPathInferredInstallation(installation, activeCommand);
|
|
9743
9922
|
const mismatch = getPinnedVersionMismatch(effectiveInstallation, getPackageVersion(), "ccstatusline-zh", versionInstalledThisSession);
|
|
@@ -9747,14 +9926,20 @@ var App = () => {
|
|
|
9747
9926
|
const performSave = () => {
|
|
9748
9927
|
(async () => {
|
|
9749
9928
|
try {
|
|
9750
|
-
await saveSettings(settings);
|
|
9929
|
+
const skippedHooks = await saveSettings(settings);
|
|
9751
9930
|
setOriginalSettings(cloneSettings(settings));
|
|
9752
9931
|
setHasChanges(false);
|
|
9753
9932
|
setConfigLoadError(null);
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9933
|
+
if (skippedHooks) {
|
|
9934
|
+
setFlashMessage(null);
|
|
9935
|
+
setFlowNotice(buildSkippedHooksNotice(skippedHooks, screen === "flowNotice" ? "main" : screen));
|
|
9936
|
+
setScreen("flowNotice");
|
|
9937
|
+
} else {
|
|
9938
|
+
setFlashMessage({
|
|
9939
|
+
text: "✓ 配置已保存",
|
|
9940
|
+
color: "green"
|
|
9941
|
+
});
|
|
9942
|
+
}
|
|
9758
9943
|
} catch {
|
|
9759
9944
|
setFlashMessage({
|
|
9760
9945
|
text: "✗ 无法保存配置",
|
|
@@ -9873,7 +10058,7 @@ ${resolutionWarning}`,
|
|
|
9873
10058
|
}, []);
|
|
9874
10059
|
const handleUpdateCheck = import_react21.useCallback(() => {
|
|
9875
10060
|
setUpdateCheckerState({ status: "checking" });
|
|
9876
|
-
const installation =
|
|
10061
|
+
const installation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, settings?.installation) : classifyInstallation(existingStatusLine, settings?.installation);
|
|
9877
10062
|
const activeCommand = installation.method === "pinned" || installation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
|
|
9878
10063
|
const effectiveUpdateInstallation = getPathInferredInstallation(installation, activeCommand);
|
|
9879
10064
|
const currentUpdateVersion = effectiveUpdateInstallation.method === "pinned" && effectiveUpdateInstallation.installedVersion ? effectiveUpdateInstallation.installedVersion : getPackageVersion();
|
|
@@ -9980,16 +10165,26 @@ ${resolutionWarning}`,
|
|
|
9980
10165
|
setFlashMessage({ text: "配置已导入,请检查后保存", color: "green" });
|
|
9981
10166
|
setScreen("main");
|
|
9982
10167
|
}, [importValidation, settings]);
|
|
9983
|
-
|
|
10168
|
+
const savedInstallation = settings?.installation;
|
|
10169
|
+
const hasLoaded = settings !== null && hasLoadedClaudeStatus && hasLoadedInstalledState;
|
|
10170
|
+
const installationState = import_react21.useMemo(() => {
|
|
10171
|
+
if (!hasLoaded) {
|
|
10172
|
+
return null;
|
|
10173
|
+
}
|
|
10174
|
+
const currentInstallation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, savedInstallation) : classifyInstallation(existingStatusLine, savedInstallation);
|
|
10175
|
+
const activeGlobalCommand = currentInstallation.method === "pinned" || currentInstallation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
|
|
10176
|
+
const effectiveInstallation = getPathInferredInstallation(currentInstallation, activeGlobalCommand);
|
|
10177
|
+
const pinnedRelaunchCommand = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager) : null;
|
|
10178
|
+
return { activeGlobalCommand, effectiveInstallation, pinnedRelaunchCommand };
|
|
10179
|
+
}, [commandAvailability, existingStatusLine, hasLoaded, isClaudeInstalled, savedInstallation]);
|
|
10180
|
+
if (!settings || !installationState) {
|
|
9984
10181
|
return /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9985
10182
|
children: "正在加载设置..."
|
|
9986
10183
|
});
|
|
9987
10184
|
}
|
|
9988
10185
|
const runningVersion = getPackageVersion();
|
|
9989
|
-
const
|
|
9990
|
-
const
|
|
9991
|
-
const effectiveInstallation = getPathInferredInstallation(currentInstallation, activeGlobalCommand);
|
|
9992
|
-
const pinnedVersionMismatch = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager), versionInstalledThisSession) : null;
|
|
10186
|
+
const { activeGlobalCommand, effectiveInstallation, pinnedRelaunchCommand } = installationState;
|
|
10187
|
+
const pinnedVersionMismatch = pinnedRelaunchCommand ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, pinnedRelaunchCommand, versionInstalledThisSession) : null;
|
|
9993
10188
|
const runActionOnce = (action) => {
|
|
9994
10189
|
if (actionInFlightRef.current) {
|
|
9995
10190
|
return;
|
|
@@ -10176,10 +10371,15 @@ ${GITHUB_REPO_URL}`,
|
|
|
10176
10371
|
case "save": {
|
|
10177
10372
|
const saveAndExit = async () => {
|
|
10178
10373
|
try {
|
|
10179
|
-
await saveSettings(settings);
|
|
10374
|
+
const skippedHooks = await saveSettings(settings);
|
|
10180
10375
|
setOriginalSettings(cloneSettings(settings));
|
|
10181
10376
|
setHasChanges(false);
|
|
10182
|
-
|
|
10377
|
+
if (skippedHooks) {
|
|
10378
|
+
setFlowNotice(buildSkippedHooksNotice(skippedHooks, "exit"));
|
|
10379
|
+
setScreen("flowNotice");
|
|
10380
|
+
} else {
|
|
10381
|
+
exit();
|
|
10382
|
+
}
|
|
10183
10383
|
} catch {
|
|
10184
10384
|
setFlashMessage({
|
|
10185
10385
|
text: "✗ 无法保存配置",
|
|
@@ -10216,7 +10416,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10216
10416
|
bold: true,
|
|
10217
10417
|
children: /* @__PURE__ */ jsx_runtime23.jsx(dist_default2, {
|
|
10218
10418
|
name: "retro",
|
|
10219
|
-
children: "CCStatusline
|
|
10419
|
+
children: "CCStatusline 配置"
|
|
10220
10420
|
})
|
|
10221
10421
|
}),
|
|
10222
10422
|
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
@@ -10252,6 +10452,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10252
10452
|
};
|
|
10253
10453
|
const handleLineSelect = (lineIndex) => {
|
|
10254
10454
|
setSelectedLine(lineIndex);
|
|
10455
|
+
setItemsCursor(0);
|
|
10255
10456
|
setScreen("items");
|
|
10256
10457
|
};
|
|
10257
10458
|
const configWarning = buildConfigLoadWarning(configLoadError);
|
|
@@ -10273,6 +10474,10 @@ ${GITHUB_REPO_URL}`,
|
|
|
10273
10474
|
bold: true,
|
|
10274
10475
|
children: ` | ${runningVersion && `v${runningVersion}`}`
|
|
10275
10476
|
}),
|
|
10477
|
+
devReloadStateFile && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10478
|
+
dimColor: true,
|
|
10479
|
+
children: " 开发重载: Ctrl+R"
|
|
10480
|
+
}),
|
|
10276
10481
|
flashMessage && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10277
10482
|
color: flashMessage.color,
|
|
10278
10483
|
bold: true,
|
|
@@ -10308,6 +10513,9 @@ ${GITHUB_REPO_URL}`,
|
|
|
10308
10513
|
isClaudeInstalled,
|
|
10309
10514
|
hasChanges,
|
|
10310
10515
|
initialSelection: menuSelections.main,
|
|
10516
|
+
onSelectionChange: (index) => {
|
|
10517
|
+
setMenuSelections((prev) => ({ ...prev, main: index }));
|
|
10518
|
+
},
|
|
10311
10519
|
powerlineFontStatus,
|
|
10312
10520
|
settings,
|
|
10313
10521
|
installation: effectiveInstallation,
|
|
@@ -10325,6 +10533,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10325
10533
|
setScreen("main");
|
|
10326
10534
|
},
|
|
10327
10535
|
initialSelection: menuSelections.lines,
|
|
10536
|
+
onSelectionChange: handleLineSelectionChange,
|
|
10328
10537
|
title: "选择要编辑组件的行",
|
|
10329
10538
|
allowEditing: true
|
|
10330
10539
|
}),
|
|
@@ -10334,6 +10543,8 @@ ${GITHUB_REPO_URL}`,
|
|
|
10334
10543
|
updateLine(selectedLine, widgets);
|
|
10335
10544
|
},
|
|
10336
10545
|
onPreviewChange: setPreviewWidgets,
|
|
10546
|
+
initialSelectedIndex: itemsCursor,
|
|
10547
|
+
onSelectedIndexChange: setItemsCursor,
|
|
10337
10548
|
onBack: () => {
|
|
10338
10549
|
setMenuSelections((prev) => ({ ...prev, lines: selectedLine }));
|
|
10339
10550
|
setScreen("lines");
|
|
@@ -10354,6 +10565,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10354
10565
|
setScreen("main");
|
|
10355
10566
|
},
|
|
10356
10567
|
initialSelection: menuSelections.lines,
|
|
10568
|
+
onSelectionChange: handleLineSelectionChange,
|
|
10357
10569
|
title: "选择要编辑颜色的行",
|
|
10358
10570
|
blockIfPowerlineActive: true,
|
|
10359
10571
|
settings,
|
|
@@ -10419,6 +10631,10 @@ ${GITHUB_REPO_URL}`,
|
|
|
10419
10631
|
screen === "flowNotice" && flowNotice && /* @__PURE__ */ jsx_runtime23.jsx(FlowNotice, {
|
|
10420
10632
|
...flowNotice,
|
|
10421
10633
|
onContinue: () => {
|
|
10634
|
+
if (flowNotice.continueScreen === "exit") {
|
|
10635
|
+
exit();
|
|
10636
|
+
return;
|
|
10637
|
+
}
|
|
10422
10638
|
setScreen(flowNotice.continueScreen);
|
|
10423
10639
|
setFlowNotice(null);
|
|
10424
10640
|
}
|
|
@@ -10587,7 +10803,12 @@ ${GITHUB_REPO_URL}`,
|
|
|
10587
10803
|
};
|
|
10588
10804
|
function runTUI() {
|
|
10589
10805
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
10590
|
-
render_default(/* @__PURE__ */ jsx_runtime23.jsx(App, {}));
|
|
10806
|
+
const instance = render_default(/* @__PURE__ */ jsx_runtime23.jsx(App, {}));
|
|
10807
|
+
instance.waitUntilExit().finally(() => {
|
|
10808
|
+
if (isDevReloadRequested2()) {
|
|
10809
|
+
process.exit(DEV_RELOAD_EXIT_CODE2);
|
|
10810
|
+
}
|
|
10811
|
+
});
|
|
10591
10812
|
}
|
|
10592
10813
|
export {
|
|
10593
10814
|
runTUI
|