ccstatusline-zh 2.2.27 → 2.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/ccstatusline.js +97 -266
  2. package/package.json +1 -1
@@ -53365,7 +53365,7 @@ function getTerminalWidth() {
53365
53365
  function canDetectTerminalWidth() {
53366
53366
  return probeTerminalWidth() !== null;
53367
53367
  }
53368
- var __dirname = "/home/runner/work/ccstatusline-zh/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.27";
53368
+ var __dirname = "/home/runner/work/ccstatusline-zh/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.28";
53369
53369
  var init_terminal = () => {};
53370
53370
 
53371
53371
  // src/utils/fuzzy.ts
@@ -54161,6 +54161,40 @@ function removeMetadataKeys(item, keys2) {
54161
54161
  metadata: Object.keys(nextMetadata).length > 0 ? nextMetadata : undefined
54162
54162
  };
54163
54163
  }
54164
+ function removeNerdFont(item) {
54165
+ return removeMetadataKeys(item, [NERD_FONT_METADATA_KEY]);
54166
+ }
54167
+ function isNerdFontEnabled(item, formats) {
54168
+ return formats.canUseNerdFont(item) && isMetadataFlagEnabled(item, NERD_FONT_METADATA_KEY);
54169
+ }
54170
+ function setNerdFontFormat(item, format, formats) {
54171
+ let updatedItem;
54172
+ if (format === formats.defaultFormat) {
54173
+ updatedItem = removeMetadataKeys(item, [FORMAT_METADATA_KEY]);
54174
+ } else {
54175
+ updatedItem = {
54176
+ ...item,
54177
+ metadata: {
54178
+ ...item.metadata,
54179
+ [FORMAT_METADATA_KEY]: format
54180
+ }
54181
+ };
54182
+ }
54183
+ return formats.canUseNerdFont(updatedItem) ? updatedItem : removeNerdFont(updatedItem);
54184
+ }
54185
+ function toggleNerdFont(item, formats) {
54186
+ if (isNerdFontEnabled(item, formats) || !formats.canUseNerdFont(item)) {
54187
+ return removeNerdFont(item);
54188
+ }
54189
+ return {
54190
+ ...item,
54191
+ metadata: {
54192
+ ...item.metadata,
54193
+ [NERD_FONT_METADATA_KEY]: "true"
54194
+ }
54195
+ };
54196
+ }
54197
+ var FORMAT_METADATA_KEY = "format", NERD_FONT_METADATA_KEY = "nerdFont";
54164
54198
 
54165
54199
  // src/widgets/shared/git-no-git.ts
54166
54200
  function isHideNoGitEnabled(item) {
@@ -68203,50 +68237,6 @@ function canUseNerdFont(item) {
68203
68237
  const format = getFormat(item);
68204
68238
  return format === "icon" || format === "icon-text" && !item.rawValue;
68205
68239
  }
68206
- function removeNerdFont(item) {
68207
- const { [NERD_FONT_METADATA_KEY]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
68208
- return {
68209
- ...item,
68210
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68211
- };
68212
- }
68213
- function setFormat(item, format) {
68214
- let updatedItem;
68215
- if (format === DEFAULT_FORMAT) {
68216
- const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
68217
- updatedItem = {
68218
- ...item,
68219
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68220
- };
68221
- } else {
68222
- updatedItem = {
68223
- ...item,
68224
- metadata: {
68225
- ...item.metadata ?? {},
68226
- format
68227
- }
68228
- };
68229
- }
68230
- return canUseNerdFont(updatedItem) ? updatedItem : removeNerdFont(updatedItem);
68231
- }
68232
- function isNerdFontEnabled(item) {
68233
- return canUseNerdFont(item) && item.metadata?.[NERD_FONT_METADATA_KEY] === "true";
68234
- }
68235
- function toggleNerdFont(item) {
68236
- if (!canUseNerdFont(item)) {
68237
- return removeNerdFont(item);
68238
- }
68239
- if (!isNerdFontEnabled(item)) {
68240
- return {
68241
- ...item,
68242
- metadata: {
68243
- ...item.metadata ?? {},
68244
- [NERD_FONT_METADATA_KEY]: "true"
68245
- }
68246
- };
68247
- }
68248
- return removeNerdFont(item);
68249
- }
68250
68240
  function formatStatus(enabled, format, nerdFont, rawValue) {
68251
68241
  const stateText = rawValue ? enabled ? "on" : "off" : enabled ? "启用" : "关闭";
68252
68242
  const stateDot = enabled ? STATE_DOT_ON : STATE_DOT_OFF;
@@ -68262,14 +68252,6 @@ function formatStatus(enabled, format, nerdFont, rawValue) {
68262
68252
  return rawValue ? stateText : `语音 ${stateText}`;
68263
68253
  }
68264
68254
  }
68265
- function resolveVoiceConfigCwd(context) {
68266
- const candidates = [
68267
- context.data?.workspace?.project_dir,
68268
- context.data?.cwd,
68269
- context.data?.workspace?.current_dir
68270
- ];
68271
- return candidates.find((candidate) => typeof candidate === "string" && candidate.trim().length > 0);
68272
- }
68273
68255
 
68274
68256
  class VoiceStatusWidget {
68275
68257
  getDefaultColor() {
@@ -68286,7 +68268,7 @@ class VoiceStatusWidget {
68286
68268
  }
68287
68269
  getEditorDisplay(item) {
68288
68270
  const modifiers = [getFormat(item)];
68289
- if (isNerdFontEnabled(item)) {
68271
+ if (isNerdFontEnabled(item, NERD_FONT_FORMATS)) {
68290
68272
  modifiers.push("Nerd 字体");
68291
68273
  }
68292
68274
  return {
@@ -68298,20 +68280,20 @@ class VoiceStatusWidget {
68298
68280
  if (action === CYCLE_FORMAT_ACTION) {
68299
68281
  const currentFormat = getFormat(item);
68300
68282
  const nextFormat = FORMATS[(FORMATS.indexOf(currentFormat) + 1) % FORMATS.length] ?? DEFAULT_FORMAT;
68301
- return setFormat(item, nextFormat);
68283
+ return setNerdFontFormat(item, nextFormat, NERD_FONT_FORMATS);
68302
68284
  }
68303
68285
  if (action === TOGGLE_NERD_FONT_ACTION) {
68304
- return toggleNerdFont(item);
68286
+ return toggleNerdFont(item, NERD_FONT_FORMATS);
68305
68287
  }
68306
68288
  return null;
68307
68289
  }
68308
68290
  render(item, context, _settings) {
68309
68291
  const format = getFormat(item);
68310
- const nerdFont = isNerdFontEnabled(item);
68292
+ const nerdFont = isNerdFontEnabled(item, NERD_FONT_FORMATS);
68311
68293
  if (context.isPreview) {
68312
68294
  return formatStatus(true, format, nerdFont, item.rawValue ?? false);
68313
68295
  }
68314
- const config2 = getVoiceConfig(resolveVoiceConfigCwd(context));
68296
+ const config2 = getVoiceConfig(resolveClaudeConfigCwd(context));
68315
68297
  if (config2 === null) {
68316
68298
  return null;
68317
68299
  }
@@ -68333,10 +68315,14 @@ class VoiceStatusWidget {
68333
68315
  return true;
68334
68316
  }
68335
68317
  }
68336
- var MIC_EMOJI = "\uD83C\uDFA4", MIC_NERD_FONT = "", MIC_SLASH_NERD_FONT = "", STATE_DOT_OFF = "○", STATE_DOT_ON = "◉", FORMATS, DEFAULT_FORMAT = "icon", CYCLE_FORMAT_ACTION = "cycle-format", TOGGLE_NERD_FONT_ACTION = "toggle-nerd-font", NERD_FONT_METADATA_KEY = "nerdFont";
68318
+ var MIC_EMOJI = "\uD83C\uDFA4", MIC_NERD_FONT = "", MIC_SLASH_NERD_FONT = "", STATE_DOT_OFF = "○", STATE_DOT_ON = "◉", FORMATS, DEFAULT_FORMAT = "icon", CYCLE_FORMAT_ACTION = "cycle-format", TOGGLE_NERD_FONT_ACTION = "toggle-nerd-font", NERD_FONT_FORMATS;
68337
68319
  var init_VoiceStatus = __esm(async () => {
68338
68320
  await init_claude_settings();
68339
68321
  FORMATS = ["icon", "icon-text", "text", "word"];
68322
+ NERD_FONT_FORMATS = {
68323
+ defaultFormat: DEFAULT_FORMAT,
68324
+ canUseNerdFont
68325
+ };
68340
68326
  });
68341
68327
 
68342
68328
  // src/widgets/FableWeeklyUsage.ts
@@ -69776,50 +69762,6 @@ function canUseNerdFont2(item) {
69776
69762
  const format = getFormat2(item);
69777
69763
  return format === "icon-dash-letter" || format === "icon-letter" || format === "icon";
69778
69764
  }
69779
- function removeNerdFont2(item) {
69780
- const { [NERD_FONT_METADATA_KEY2]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
69781
- return {
69782
- ...item,
69783
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
69784
- };
69785
- }
69786
- function setFormat2(item, format) {
69787
- let updatedItem;
69788
- if (format === DEFAULT_FORMAT2) {
69789
- const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
69790
- updatedItem = {
69791
- ...item,
69792
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
69793
- };
69794
- } else {
69795
- updatedItem = {
69796
- ...item,
69797
- metadata: {
69798
- ...item.metadata ?? {},
69799
- format
69800
- }
69801
- };
69802
- }
69803
- return canUseNerdFont2(updatedItem) ? updatedItem : removeNerdFont2(updatedItem);
69804
- }
69805
- function isNerdFontEnabled2(item) {
69806
- return canUseNerdFont2(item) && item.metadata?.[NERD_FONT_METADATA_KEY2] === "true";
69807
- }
69808
- function toggleNerdFont2(item) {
69809
- if (!canUseNerdFont2(item)) {
69810
- return removeNerdFont2(item);
69811
- }
69812
- if (!isNerdFontEnabled2(item)) {
69813
- return {
69814
- ...item,
69815
- metadata: {
69816
- ...item.metadata ?? {},
69817
- [NERD_FONT_METADATA_KEY2]: "true"
69818
- }
69819
- };
69820
- }
69821
- return removeNerdFont2(item);
69822
- }
69823
69765
  function formatMode(mode, format, icon) {
69824
69766
  const letter = mode === "NORMAL" ? "N" : mode === "INSERT" ? "I" : mode[0] ?? mode;
69825
69767
  switch (format) {
@@ -69851,7 +69793,7 @@ class VimModeWidget {
69851
69793
  }
69852
69794
  getEditorDisplay(item) {
69853
69795
  const modifiers = [getFormat2(item)];
69854
- if (isNerdFontEnabled2(item)) {
69796
+ if (isNerdFontEnabled(item, NERD_FONT_FORMATS2)) {
69855
69797
  modifiers.push("Nerd 字体");
69856
69798
  }
69857
69799
  return {
@@ -69863,16 +69805,16 @@ class VimModeWidget {
69863
69805
  if (action === CYCLE_FORMAT_ACTION2) {
69864
69806
  const currentFormat = getFormat2(item);
69865
69807
  const nextFormat = FORMATS2[(FORMATS2.indexOf(currentFormat) + 1) % FORMATS2.length] ?? DEFAULT_FORMAT2;
69866
- return setFormat2(item, nextFormat);
69808
+ return setNerdFontFormat(item, nextFormat, NERD_FONT_FORMATS2);
69867
69809
  }
69868
69810
  if (action === TOGGLE_NERD_FONT_ACTION2) {
69869
- return toggleNerdFont2(item);
69811
+ return toggleNerdFont(item, NERD_FONT_FORMATS2);
69870
69812
  }
69871
69813
  return null;
69872
69814
  }
69873
69815
  render(item, context, _settings) {
69874
69816
  const format = getFormat2(item);
69875
- const icon = isNerdFontEnabled2(item) ? VIM_NERD_FONT_ICON : VIM_ICON;
69817
+ const icon = isNerdFontEnabled(item, NERD_FONT_FORMATS2) ? VIM_NERD_FONT_ICON : VIM_ICON;
69876
69818
  if (context.isPreview)
69877
69819
  return formatMode("NORMAL", format, icon);
69878
69820
  const mode = context.data?.vim?.mode;
@@ -69896,9 +69838,13 @@ class VimModeWidget {
69896
69838
  return true;
69897
69839
  }
69898
69840
  }
69899
- var VIM_ICON = "v", VIM_NERD_FONT_ICON = "", FORMATS2, DEFAULT_FORMAT2 = "icon-dash-letter", CYCLE_FORMAT_ACTION2 = "cycle-format", TOGGLE_NERD_FONT_ACTION2 = "toggle-nerd-font", NERD_FONT_METADATA_KEY2 = "nerdFont";
69841
+ var VIM_ICON = "v", VIM_NERD_FONT_ICON = "", FORMATS2, DEFAULT_FORMAT2 = "icon-dash-letter", CYCLE_FORMAT_ACTION2 = "cycle-format", TOGGLE_NERD_FONT_ACTION2 = "toggle-nerd-font", NERD_FONT_FORMATS2;
69900
69842
  var init_VimMode = __esm(() => {
69901
69843
  FORMATS2 = ["icon-dash-letter", "icon-letter", "icon", "letter", "word"];
69844
+ NERD_FONT_FORMATS2 = {
69845
+ defaultFormat: DEFAULT_FORMAT2,
69846
+ canUseNerdFont: canUseNerdFont2
69847
+ };
69902
69848
  });
69903
69849
 
69904
69850
  // src/widgets/GitWorktreeMode.ts
@@ -70049,32 +69995,8 @@ function getFormat3(item) {
70049
69995
  const format = item.metadata?.format;
70050
69996
  return FORMATS3.includes(format ?? "") ? format : DEFAULT_FORMAT3;
70051
69997
  }
70052
- function removeNerdFont3(item) {
70053
- const { [NERD_FONT_METADATA_KEY3]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
70054
- return {
70055
- ...item,
70056
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
70057
- };
70058
- }
70059
- function setFormat3(item, format) {
70060
- if (format === DEFAULT_FORMAT3) {
70061
- const { format: removedFormat, ...restMetadata2 } = item.metadata ?? {};
70062
- return {
70063
- ...item,
70064
- metadata: Object.keys(restMetadata2).length > 0 ? restMetadata2 : undefined
70065
- };
70066
- }
70067
- const { [NERD_FONT_METADATA_KEY3]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
70068
- return {
70069
- ...item,
70070
- metadata: {
70071
- ...restMetadata,
70072
- format
70073
- }
70074
- };
70075
- }
70076
- function isNerdFontEnabled3(item) {
70077
- return item.metadata?.[NERD_FONT_METADATA_KEY3] === "true" && getFormat3(item) === DEFAULT_FORMAT3;
69998
+ function canUseNerdFont3(item) {
69999
+ return getFormat3(item) === DEFAULT_FORMAT3;
70078
70000
  }
70079
70001
  function isHideZeroEnabled(item) {
70080
70002
  return item.metadata?.[HIDE_ZERO_METADATA_KEY] === "true";
@@ -70152,21 +70074,6 @@ function formatStats(data, item, icon) {
70152
70074
  }
70153
70075
  return out;
70154
70076
  }
70155
- function toggleNerdFont3(item) {
70156
- if (getFormat3(item) !== DEFAULT_FORMAT3) {
70157
- return removeNerdFont3(item);
70158
- }
70159
- if (!isNerdFontEnabled3(item)) {
70160
- return {
70161
- ...item,
70162
- metadata: {
70163
- ...item.metadata ?? {},
70164
- [NERD_FONT_METADATA_KEY3]: "true"
70165
- }
70166
- };
70167
- }
70168
- return removeNerdFont3(item);
70169
- }
70170
70077
  function formatCount(count, format, icon) {
70171
70078
  switch (format) {
70172
70079
  case "icon-space-number":
@@ -70198,7 +70105,7 @@ class CompactionCounterWidget {
70198
70105
  modifiers.push(`${METRIC_LABELS[metric]}值`);
70199
70106
  } else {
70200
70107
  modifiers.push(getFormat3(item));
70201
- if (isNerdFontEnabled3(item)) {
70108
+ if (isNerdFontEnabled(item, NERD_FONT_FORMATS3)) {
70202
70109
  modifiers.push("Nerd 字体");
70203
70110
  }
70204
70111
  if (isMetadataFlagEnabled(item, SHOW_TRIGGERS_METADATA_KEY)) {
@@ -70225,13 +70132,13 @@ class CompactionCounterWidget {
70225
70132
  if (action === CYCLE_FORMAT_ACTION3) {
70226
70133
  const currentFormat = getFormat3(item);
70227
70134
  const nextFormat = FORMATS3[(FORMATS3.indexOf(currentFormat) + 1) % FORMATS3.length] ?? DEFAULT_FORMAT3;
70228
- return setFormat3(item, nextFormat);
70135
+ return setNerdFontFormat(item, nextFormat, NERD_FONT_FORMATS3);
70229
70136
  }
70230
70137
  if (action === TOGGLE_HIDE_ZERO_ACTION) {
70231
70138
  return toggleHideZero(item);
70232
70139
  }
70233
70140
  if (action === TOGGLE_NERD_FONT_ACTION3) {
70234
- return toggleNerdFont3(item);
70141
+ return toggleNerdFont(item, NERD_FONT_FORMATS3);
70235
70142
  }
70236
70143
  if (action === TOGGLE_TRIGGERS_ACTION) {
70237
70144
  return toggleMetadataFlag(item, SHOW_TRIGGERS_METADATA_KEY);
@@ -70254,7 +70161,7 @@ class CompactionCounterWidget {
70254
70161
  if (data.count === 0 && isHideZeroEnabled(item) && !context.isPreview) {
70255
70162
  return null;
70256
70163
  }
70257
- const icon = isNerdFontEnabled3(item) ? COMPACTION_NERD_FONT_ICON : COMPACTION_ICON;
70164
+ const icon = isNerdFontEnabled(item, NERD_FONT_FORMATS3) ? COMPACTION_NERD_FONT_ICON : COMPACTION_ICON;
70258
70165
  return formatStats(data, item, icon);
70259
70166
  }
70260
70167
  getCustomKeybinds(item) {
@@ -70266,7 +70173,7 @@ class CompactionCounterWidget {
70266
70173
  return keybinds;
70267
70174
  }
70268
70175
  keybinds.push({ key: "f", label: "(f)格式切换", action: CYCLE_FORMAT_ACTION3 });
70269
- if (item === undefined || getFormat3(item) === DEFAULT_FORMAT3) {
70176
+ if (item === undefined || canUseNerdFont3(item)) {
70270
70177
  keybinds.push({ key: "n", label: "(n)Nerd 字体", action: TOGGLE_NERD_FONT_ACTION3 });
70271
70178
  }
70272
70179
  keybinds.push({ key: "s", label: "(s)触发器分类", action: TOGGLE_TRIGGERS_ACTION });
@@ -70285,7 +70192,7 @@ class CompactionCounterWidget {
70285
70192
  return true;
70286
70193
  }
70287
70194
  }
70288
- var COMPACTION_ICON = "↻", COMPACTION_NERD_FONT_ICON = "", FORMATS3, DEFAULT_FORMAT3 = "icon-space-number", CYCLE_FORMAT_ACTION3 = "cycle-format", TOGGLE_HIDE_ZERO_ACTION = "toggle-hide-zero", TOGGLE_NERD_FONT_ACTION3 = "toggle-nerd-font", HIDE_ZERO_METADATA_KEY = "hideZero", NERD_FONT_METADATA_KEY3 = "nerdFont", TOGGLE_TRIGGERS_ACTION = "toggle-triggers", SHOW_TRIGGERS_METADATA_KEY = "showTriggers", TOGGLE_RECLAIMED_ACTION = "toggle-reclaimed", SHOW_RECLAIMED_METADATA_KEY = "showReclaimed", METRICS, DEFAULT_METRIC = "count", METRIC_METADATA_KEY = "metric", CYCLE_METRIC_ACTION = "cycle-metric", METRIC_LABELS, RECLAIMED_SLOT, SAMPLE_STATS;
70195
+ var COMPACTION_ICON = "↻", COMPACTION_NERD_FONT_ICON = "", FORMATS3, DEFAULT_FORMAT3 = "icon-space-number", CYCLE_FORMAT_ACTION3 = "cycle-format", TOGGLE_HIDE_ZERO_ACTION = "toggle-hide-zero", TOGGLE_NERD_FONT_ACTION3 = "toggle-nerd-font", HIDE_ZERO_METADATA_KEY = "hideZero", TOGGLE_TRIGGERS_ACTION = "toggle-triggers", SHOW_TRIGGERS_METADATA_KEY = "showTriggers", TOGGLE_RECLAIMED_ACTION = "toggle-reclaimed", SHOW_RECLAIMED_METADATA_KEY = "showReclaimed", METRICS, DEFAULT_METRIC = "count", METRIC_METADATA_KEY = "metric", CYCLE_METRIC_ACTION = "cycle-metric", METRIC_LABELS, RECLAIMED_SLOT, SAMPLE_STATS, NERD_FONT_FORMATS3;
70289
70196
  var init_CompactionCounter = __esm(async () => {
70290
70197
  init_compaction();
70291
70198
  await init_symbol_override();
@@ -70304,6 +70211,10 @@ var init_CompactionCounter = __esm(async () => {
70304
70211
  byTrigger: Object.freeze({ auto: 1, manual: 1, unknown: 0 }),
70305
70212
  tokensReclaimed: 120000
70306
70213
  });
70214
+ NERD_FONT_FORMATS3 = {
70215
+ defaultFormat: DEFAULT_FORMAT3,
70216
+ canUseNerdFont: canUseNerdFont3
70217
+ };
70307
70218
  });
70308
70219
 
70309
70220
  // src/widgets/SandboxStatus.ts
@@ -70311,53 +70222,9 @@ function getFormat4(item) {
70311
70222
  const f = item.metadata?.format;
70312
70223
  return FORMATS4.includes(f ?? "") ? f : DEFAULT_FORMAT4;
70313
70224
  }
70314
- function canUseNerdFont3(item) {
70225
+ function canUseNerdFont4(item) {
70315
70226
  return getFormat4(item) === "glyph";
70316
70227
  }
70317
- function removeNerdFont4(item) {
70318
- const { [NERD_FONT_METADATA_KEY4]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
70319
- return {
70320
- ...item,
70321
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
70322
- };
70323
- }
70324
- function setFormat4(item, format) {
70325
- let updatedItem;
70326
- if (format === DEFAULT_FORMAT4) {
70327
- const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
70328
- updatedItem = {
70329
- ...item,
70330
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
70331
- };
70332
- } else {
70333
- updatedItem = {
70334
- ...item,
70335
- metadata: {
70336
- ...item.metadata ?? {},
70337
- format
70338
- }
70339
- };
70340
- }
70341
- return canUseNerdFont3(updatedItem) ? updatedItem : removeNerdFont4(updatedItem);
70342
- }
70343
- function isNerdFontEnabled4(item) {
70344
- return canUseNerdFont3(item) && item.metadata?.[NERD_FONT_METADATA_KEY4] === "true";
70345
- }
70346
- function toggleNerdFont4(item) {
70347
- if (!canUseNerdFont3(item)) {
70348
- return removeNerdFont4(item);
70349
- }
70350
- if (!isNerdFontEnabled4(item)) {
70351
- return {
70352
- ...item,
70353
- metadata: {
70354
- ...item.metadata ?? {},
70355
- [NERD_FONT_METADATA_KEY4]: "true"
70356
- }
70357
- };
70358
- }
70359
- return removeNerdFont4(item);
70360
- }
70361
70228
  function formatStatus2(enabled, format, nerdFont, rawValue) {
70362
70229
  const rawStateText = enabled ? "ON" : "OFF";
70363
70230
  const displayStateText = enabled ? "启用" : "关闭";
@@ -70371,14 +70238,6 @@ function formatStatus2(enabled, format, nerdFont, rawValue) {
70371
70238
  return rawValue ? rawStateText : `沙箱: ${displayStateText}`;
70372
70239
  }
70373
70240
  }
70374
- function resolveSandboxConfigCwd(context) {
70375
- const candidates = [
70376
- context.data?.workspace?.project_dir,
70377
- context.data?.cwd,
70378
- context.data?.workspace?.current_dir
70379
- ];
70380
- return candidates.find((candidate) => typeof candidate === "string" && candidate.trim().length > 0);
70381
- }
70382
70241
 
70383
70242
  class SandboxStatusWidget {
70384
70243
  getDefaultColor() {
@@ -70399,7 +70258,7 @@ class SandboxStatusWidget {
70399
70258
  }
70400
70259
  getEditorDisplay(item) {
70401
70260
  const modifiers = [getFormat4(item)];
70402
- if (isNerdFontEnabled4(item)) {
70261
+ if (isNerdFontEnabled(item, NERD_FONT_FORMATS4)) {
70403
70262
  modifiers.push("Nerd 字体");
70404
70263
  }
70405
70264
  return {
@@ -70411,20 +70270,20 @@ class SandboxStatusWidget {
70411
70270
  if (action === CYCLE_FORMAT_ACTION4) {
70412
70271
  const currentFormat = getFormat4(item);
70413
70272
  const nextFormat = FORMATS4[(FORMATS4.indexOf(currentFormat) + 1) % FORMATS4.length] ?? DEFAULT_FORMAT4;
70414
- return setFormat4(item, nextFormat);
70273
+ return setNerdFontFormat(item, nextFormat, NERD_FONT_FORMATS4);
70415
70274
  }
70416
70275
  if (action === TOGGLE_NERD_FONT_ACTION4) {
70417
- return toggleNerdFont4(item);
70276
+ return toggleNerdFont(item, NERD_FONT_FORMATS4);
70418
70277
  }
70419
70278
  return null;
70420
70279
  }
70421
70280
  render(item, context, _settings) {
70422
70281
  const format = getFormat4(item);
70423
- const nerdFont = isNerdFontEnabled4(item);
70282
+ const nerdFont = isNerdFontEnabled(item, NERD_FONT_FORMATS4);
70424
70283
  if (context.isPreview) {
70425
70284
  return formatStatus2(true, format, nerdFont, item.rawValue ?? false);
70426
70285
  }
70427
- const config2 = getSandboxConfig(resolveSandboxConfigCwd(context));
70286
+ const config2 = getSandboxConfig(resolveClaudeConfigCwd(context));
70428
70287
  if (config2 === null) {
70429
70288
  return null;
70430
70289
  }
@@ -70434,7 +70293,7 @@ class SandboxStatusWidget {
70434
70293
  const keybinds = [
70435
70294
  { key: "f", label: "(f)显示格式", action: CYCLE_FORMAT_ACTION4 }
70436
70295
  ];
70437
- if (item === undefined || canUseNerdFont3(item)) {
70296
+ if (item === undefined || canUseNerdFont4(item)) {
70438
70297
  keybinds.push({ key: "n", label: "(n)Nerd 字体", action: TOGGLE_NERD_FONT_ACTION4 });
70439
70298
  }
70440
70299
  return keybinds;
@@ -70446,10 +70305,14 @@ class SandboxStatusWidget {
70446
70305
  return true;
70447
70306
  }
70448
70307
  }
70449
- var DOT_ON = "●", DOT_OFF = "○", LOCK_NERD_FONT = "", UNLOCK_NERD_FONT = "", FORMATS4, DEFAULT_FORMAT4 = "glyph", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_METADATA_KEY4 = "nerdFont";
70308
+ var DOT_ON = "●", DOT_OFF = "○", LOCK_NERD_FONT = "", UNLOCK_NERD_FONT = "", FORMATS4, DEFAULT_FORMAT4 = "glyph", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_FORMATS4;
70450
70309
  var init_SandboxStatus = __esm(async () => {
70451
70310
  await init_claude_settings();
70452
70311
  FORMATS4 = ["glyph", "text", "word"];
70312
+ NERD_FONT_FORMATS4 = {
70313
+ defaultFormat: DEFAULT_FORMAT4,
70314
+ canUseNerdFont: canUseNerdFont4
70315
+ };
70453
70316
  });
70454
70317
 
70455
70318
  // src/widgets/RemoteControlStatus.ts
@@ -70457,54 +70320,10 @@ function getFormat5(item) {
70457
70320
  const f = item.metadata?.format;
70458
70321
  return FORMATS5.includes(f ?? "") ? f : DEFAULT_FORMAT5;
70459
70322
  }
70460
- function canUseNerdFont4(item) {
70323
+ function canUseNerdFont5(item) {
70461
70324
  const format = getFormat5(item);
70462
70325
  return format === "icon" || format === "icon-text" && !item.rawValue;
70463
70326
  }
70464
- function removeNerdFont5(item) {
70465
- const { [NERD_FONT_METADATA_KEY5]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
70466
- return {
70467
- ...item,
70468
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
70469
- };
70470
- }
70471
- function setFormat5(item, format) {
70472
- let updatedItem;
70473
- if (format === DEFAULT_FORMAT5) {
70474
- const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
70475
- updatedItem = {
70476
- ...item,
70477
- metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
70478
- };
70479
- } else {
70480
- updatedItem = {
70481
- ...item,
70482
- metadata: {
70483
- ...item.metadata ?? {},
70484
- format
70485
- }
70486
- };
70487
- }
70488
- return canUseNerdFont4(updatedItem) ? updatedItem : removeNerdFont5(updatedItem);
70489
- }
70490
- function isNerdFontEnabled5(item) {
70491
- return canUseNerdFont4(item) && item.metadata?.[NERD_FONT_METADATA_KEY5] === "true";
70492
- }
70493
- function toggleNerdFont5(item) {
70494
- if (!canUseNerdFont4(item)) {
70495
- return removeNerdFont5(item);
70496
- }
70497
- if (!isNerdFontEnabled5(item)) {
70498
- return {
70499
- ...item,
70500
- metadata: {
70501
- ...item.metadata ?? {},
70502
- [NERD_FONT_METADATA_KEY5]: "true"
70503
- }
70504
- };
70505
- }
70506
- return removeNerdFont5(item);
70507
- }
70508
70327
  function formatStatus3(enabled, format, nerdFont, rawValue) {
70509
70328
  const stateText = rawValue ? enabled ? "on" : "off" : enabled ? "启用" : "关闭";
70510
70329
  const stateDot = enabled ? STATE_DOT_ON2 : STATE_DOT_OFF2;
@@ -70540,7 +70359,7 @@ class RemoteControlStatusWidget {
70540
70359
  }
70541
70360
  getEditorDisplay(item) {
70542
70361
  const modifiers = [getFormat5(item)];
70543
- if (isNerdFontEnabled5(item)) {
70362
+ if (isNerdFontEnabled(item, NERD_FONT_FORMATS5)) {
70544
70363
  modifiers.push("Nerd 字体");
70545
70364
  }
70546
70365
  return {
@@ -70552,16 +70371,16 @@ class RemoteControlStatusWidget {
70552
70371
  if (action === CYCLE_FORMAT_ACTION5) {
70553
70372
  const currentFormat = getFormat5(item);
70554
70373
  const nextFormat = FORMATS5[(FORMATS5.indexOf(currentFormat) + 1) % FORMATS5.length] ?? DEFAULT_FORMAT5;
70555
- return setFormat5(item, nextFormat);
70374
+ return setNerdFontFormat(item, nextFormat, NERD_FONT_FORMATS5);
70556
70375
  }
70557
70376
  if (action === TOGGLE_NERD_FONT_ACTION5) {
70558
- return toggleNerdFont5(item);
70377
+ return toggleNerdFont(item, NERD_FONT_FORMATS5);
70559
70378
  }
70560
70379
  return null;
70561
70380
  }
70562
70381
  render(item, context, _settings) {
70563
70382
  const format = getFormat5(item);
70564
- const nerdFont = isNerdFontEnabled5(item);
70383
+ const nerdFont = isNerdFontEnabled(item, NERD_FONT_FORMATS5);
70565
70384
  if (context.isPreview) {
70566
70385
  return formatStatus3(true, format, nerdFont, item.rawValue ?? false);
70567
70386
  }
@@ -70575,7 +70394,7 @@ class RemoteControlStatusWidget {
70575
70394
  const keybinds = [
70576
70395
  { key: "f", label: "(f)显示格式", action: CYCLE_FORMAT_ACTION5 }
70577
70396
  ];
70578
- if (item === undefined || canUseNerdFont4(item)) {
70397
+ if (item === undefined || canUseNerdFont5(item)) {
70579
70398
  keybinds.push({ key: "n", label: "(n)Nerd 字体", action: TOGGLE_NERD_FONT_ACTION5 });
70580
70399
  }
70581
70400
  return keybinds;
@@ -70587,10 +70406,14 @@ class RemoteControlStatusWidget {
70587
70406
  return true;
70588
70407
  }
70589
70408
  }
70590
- var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS5, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT5 = "icon", CYCLE_FORMAT_ACTION5 = "cycle-format", TOGGLE_NERD_FONT_ACTION5 = "toggle-nerd-font", NERD_FONT_METADATA_KEY5 = "nerdFont";
70409
+ var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS5, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT5 = "icon", CYCLE_FORMAT_ACTION5 = "cycle-format", TOGGLE_NERD_FONT_ACTION5 = "toggle-nerd-font", NERD_FONT_FORMATS5;
70591
70410
  var init_RemoteControlStatus = __esm(async () => {
70592
70411
  await init_claude_settings();
70593
70412
  FORMATS5 = ["icon", "icon-text", "text", "word", "label-check", "label-mark"];
70413
+ NERD_FONT_FORMATS5 = {
70414
+ defaultFormat: DEFAULT_FORMAT5,
70415
+ canUseNerdFont: canUseNerdFont5
70416
+ };
70594
70417
  });
70595
70418
 
70596
70419
  // src/widgets/CacheTimer.ts
@@ -71787,6 +71610,14 @@ function getLayeredSettingsCandidatePathsByPriority(cwd2) {
71787
71610
  ];
71788
71611
  return Array.from(new Set(candidates));
71789
71612
  }
71613
+ function resolveClaudeConfigCwd(context) {
71614
+ const candidates = [
71615
+ context.data?.workspace?.project_dir,
71616
+ context.data?.cwd,
71617
+ context.data?.workspace?.current_dir
71618
+ ];
71619
+ return candidates.find((candidate) => typeof candidate === "string" && candidate.trim().length > 0);
71620
+ }
71790
71621
  function tryReadVoiceLayer(filePath) {
71791
71622
  let content;
71792
71623
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-zh",
3
- "version": "2.2.27",
3
+ "version": "2.2.28",
4
4
  "bugs": {
5
5
  "url": "https://github.com/huangguang1999/ccstatusline-zh/issues"
6
6
  },