ccstatusline-zh 2.2.33 → 2.2.34

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.
@@ -3,7 +3,7 @@ import {
3
3
  saveClaudeSettings,
4
4
  getExistingStatusLine,
5
5
  getWidget
6
- } from "./ccstatusline-3tcnryv5.js";
6
+ } from "./ccstatusline-jp52tswn.js";
7
7
 
8
8
  // src/utils/hooks.ts
9
9
  var HOOK_TAG = "ccstatusline-managed";
@@ -2,7 +2,6 @@ import {
2
2
  source_default,
3
3
  stripAnsi,
4
4
  GRADIENT_PRESET_NAMES,
5
- stripOscCodes,
6
5
  getVisibleWidth,
7
6
  truncateStyledText,
8
7
  COLOR_MAP,
@@ -34,6 +33,7 @@ import {
34
33
  setEnabledHideStates,
35
34
  getHideKeybind,
36
35
  getHideModifierText,
36
+ sanitizeTerminalText,
37
37
  require_react,
38
38
  Box_default,
39
39
  Text,
@@ -44,6 +44,7 @@ import {
44
44
  getPlainInput,
45
45
  shouldInsertInput,
46
46
  require_jsx_runtime,
47
+ BlinkingCursor,
47
48
  useTextCursor,
48
49
  CYCLE_NUMBER_STYLE_ACTION,
49
50
  NUMBER_STYLE_LABELS,
@@ -82,7 +83,7 @@ import {
82
83
  validateImportFile,
83
84
  applyImport,
84
85
  saveInstallationMetadata
85
- } from "./ccstatusline-3tcnryv5.js";
86
+ } from "./ccstatusline-jp52tswn.js";
86
87
  import {
87
88
  assignPowerlineThemeSlots,
88
89
  advanceGlobalPowerlineThemeIndex,
@@ -4406,7 +4407,7 @@ function ExportConfigDialog({ onExport, onCancel }) {
4406
4407
  /* @__PURE__ */ jsx_runtime4.jsx(Text, {
4407
4408
  children: inputValue
4408
4409
  }),
4409
- /* @__PURE__ */ jsx_runtime4.jsx(Text, {
4410
+ /* @__PURE__ */ jsx_runtime4.jsx(BlinkingCursor, {
4410
4411
  inverse: true,
4411
4412
  children: " "
4412
4413
  })
@@ -4458,7 +4459,7 @@ function ImportConfigDialog({ onFileChosen, onCancel }) {
4458
4459
  /* @__PURE__ */ jsx_runtime5.jsx(Text, {
4459
4460
  children: inputValue
4460
4461
  }),
4461
- /* @__PURE__ */ jsx_runtime5.jsx(Text, {
4462
+ /* @__PURE__ */ jsx_runtime5.jsx(BlinkingCursor, {
4462
4463
  inverse: true,
4463
4464
  children: " "
4464
4465
  })
@@ -5738,7 +5739,7 @@ var import_react12 = __toESM(require_react(), 1);
5738
5739
 
5739
5740
  // src/tui/components/LabelEditor.tsx
5740
5741
  var jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
5741
- var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel }) => {
5742
+ var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel, onPreview }) => {
5742
5743
  const { getText, display, handleInput } = useTextCursor(getLabel(widget, defaultLabel));
5743
5744
  use_input_default((input, key) => {
5744
5745
  if (key.return) {
@@ -5748,7 +5749,11 @@ var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel }) => {
5748
5749
  } else if (key.tab) {
5749
5750
  onComplete(clearLabel(widget));
5750
5751
  } else {
5752
+ const previousText = getText();
5751
5753
  handleInput(input, key);
5754
+ if (getText() !== previousText) {
5755
+ onPreview?.(setLabel(widget, getText()));
5756
+ }
5752
5757
  }
5753
5758
  });
5754
5759
  return /* @__PURE__ */ jsx_runtime10.jsxs(Box_default, {
@@ -6143,13 +6148,16 @@ function isMergedIntoPreviousWidget(widgets, index) {
6143
6148
  }
6144
6149
  return Boolean(widgets[index - 1]?.merge);
6145
6150
  }
6146
- var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6151
+ var ItemsEditor = ({ widgets, onUpdate, onPreviewChange, onBack, lineNumber, settings }) => {
6147
6152
  const [selectedIndex, setSelectedIndex] = import_react12.useState(0);
6148
6153
  const [moveMode, setMoveMode] = import_react12.useState(false);
6149
6154
  const [customEditorWidget, setCustomEditorWidget] = import_react12.useState(null);
6150
6155
  const [widgetPicker, setWidgetPicker] = import_react12.useState(null);
6151
6156
  const [showClearConfirm, setShowClearConfirm] = import_react12.useState(false);
6152
6157
  const separatorChars = ["|", "-", ",", " "];
6158
+ import_react12.useEffect(() => () => {
6159
+ onPreviewChange?.(null);
6160
+ }, [onPreviewChange]);
6153
6161
  const widgetCatalog = getWidgetCatalog(settings);
6154
6162
  const widgetCategories = ["全部", ...getWidgetCatalogCategories(widgetCatalog)];
6155
6163
  const getUniqueBackgroundColor = (insertIndex) => {
@@ -6172,9 +6180,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6172
6180
  const newWidgets = [...widgets];
6173
6181
  newWidgets[selectedIndex] = updatedWidget;
6174
6182
  onUpdate(newWidgets);
6183
+ onPreviewChange?.(null);
6175
6184
  setCustomEditorWidget(null);
6176
6185
  };
6177
6186
  const handleEditorCancel = () => {
6187
+ onPreviewChange?.(null);
6178
6188
  setCustomEditorWidget(null);
6179
6189
  };
6180
6190
  const getCustomKeybindsForWidget = (widgetImpl, widget) => {
@@ -6352,7 +6362,12 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6352
6362
  widget: customEditorWidget.widget,
6353
6363
  defaultLabel: customEditorWidget.impl.getLabelPrefix(customEditorWidget.widget),
6354
6364
  onComplete: handleEditorComplete,
6355
- onCancel: handleEditorCancel
6365
+ onCancel: handleEditorCancel,
6366
+ onPreview: (updatedWidget) => {
6367
+ const previewWidgets = [...widgets];
6368
+ previewWidgets[selectedIndex] = updatedWidget;
6369
+ onPreviewChange?.(previewWidgets);
6370
+ }
6356
6371
  });
6357
6372
  }
6358
6373
  if (customEditorWidget?.impl.renderEditor) {
@@ -7636,9 +7651,7 @@ var PowerlineSeparatorEditor = ({
7636
7651
  children: [
7637
7652
  "U+",
7638
7653
  hexInput.slice(0, cursorPos),
7639
- /* @__PURE__ */ jsx_runtime15.jsx(Text, {
7640
- backgroundColor: "gray",
7641
- color: "black",
7654
+ /* @__PURE__ */ jsx_runtime15.jsx(BlinkingCursor, {
7642
7655
  children: hexInput[cursorPos] ?? "_"
7643
7656
  }),
7644
7657
  hexInput.slice(cursorPos + 1),
@@ -8747,7 +8760,7 @@ var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSepar
8747
8760
  };
8748
8761
  var PREVIEW_LINE_INDENT = " ";
8749
8762
  function preparePreviewLineForTerminal(line, terminalWidth) {
8750
- const printableLine = stripOscCodes(line);
8763
+ const printableLine = sanitizeTerminalText(line).replace(/\x1b\\/g, "\x07");
8751
8764
  const availableWidth = Math.max(0, terminalWidth - getVisibleWidth(PREVIEW_LINE_INDENT));
8752
8765
  return truncateStyledText(printableLine, availableWidth, { ellipsis: true });
8753
8766
  }
@@ -9645,6 +9658,7 @@ var App = () => {
9645
9658
  const [configLoadError, setConfigLoadError] = import_react21.useState(null);
9646
9659
  const [screen, setScreen] = import_react21.useState("main");
9647
9660
  const [selectedLine, setSelectedLine] = import_react21.useState(0);
9661
+ const [previewWidgets, setPreviewWidgets] = import_react21.useState(null);
9648
9662
  const [menuSelections, setMenuSelections] = import_react21.useState({});
9649
9663
  const [confirmDialog, setConfirmDialog] = import_react21.useState(null);
9650
9664
  const [isClaudeInstalled, setIsClaudeInstalled] = import_react21.useState(false);
@@ -10241,6 +10255,7 @@ ${GITHUB_REPO_URL}`,
10241
10255
  setScreen("items");
10242
10256
  };
10243
10257
  const configWarning = buildConfigLoadWarning(configLoadError);
10258
+ const previewLines = screen === "items" && previewWidgets ? settings.lines.map((line, index) => index === selectedLine ? previewWidgets : line) : settings.lines;
10244
10259
  return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
10245
10260
  flexDirection: "column",
10246
10261
  children: [
@@ -10275,7 +10290,7 @@ ${GITHUB_REPO_URL}`,
10275
10290
  children: `配置文件:${getConfigPath()}`
10276
10291
  }),
10277
10292
  /* @__PURE__ */ jsx_runtime23.jsx(StatusLinePreview, {
10278
- lines: settings.lines,
10293
+ lines: previewLines,
10279
10294
  terminalWidth,
10280
10295
  settings,
10281
10296
  onTruncationChange: setPreviewIsTruncated
@@ -10318,6 +10333,7 @@ ${GITHUB_REPO_URL}`,
10318
10333
  onUpdate: (widgets) => {
10319
10334
  updateLine(selectedLine, widgets);
10320
10335
  },
10336
+ onPreviewChange: setPreviewWidgets,
10321
10337
  onBack: () => {
10322
10338
  setMenuSelections((prev) => ({ ...prev, lines: selectedLine }));
10323
10339
  setScreen("lines");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-zh",
3
- "version": "2.2.33",
3
+ "version": "2.2.34",
4
4
  "bugs": {
5
5
  "url": "https://github.com/huangguang1999/ccstatusline-zh/issues"
6
6
  },
@@ -59,7 +59,7 @@
59
59
  "ink-select-input": "^6.2.0",
60
60
  "pluralize": "^8.0.0",
61
61
  "react": "19.3.0",
62
- "react-devtools-core": "^7.0.1",
62
+ "react-devtools-core": "^8.0.0",
63
63
  "react-dom": "19.3.0",
64
64
  "remotion": "^4.0.459",
65
65
  "strip-ansi": "^7.1.0",
@@ -67,7 +67,7 @@
67
67
  "typedoc": "^0.28.12",
68
68
  "typescript": "npm:@typescript/typescript6@^6.0.2",
69
69
  "typescript-eslint": "^8.39.1",
70
- "vitest": "^4.0.18",
70
+ "vitest": "^5.0.0",
71
71
  "zod": "^4.0.17"
72
72
  },
73
73
  "keywords": [