ccstatusline-zh 2.2.31 → 2.2.33
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 +15 -7
- package/dist/{ccstatusline-dry98q5v.js → ccstatusline-3tcnryv5.js} +9441 -9148
- package/dist/{ccstatusline-s1q4ap7d.js → ccstatusline-rdsx5ab1.js} +16 -12
- package/dist/ccstatusline.js +43 -26
- package/dist/{hooks-b93hd1qn.js → hooks-q322knq1.js} +2 -2
- package/dist/{index-yeg5hhcp.js → index-d0c2je2n.js} +760 -912
- package/package.json +3 -3
|
@@ -22,6 +22,12 @@ import {
|
|
|
22
22
|
getPackageVersion,
|
|
23
23
|
canDetectTerminalWidth,
|
|
24
24
|
getMatchSegments,
|
|
25
|
+
EDIT_LABEL_ACTION,
|
|
26
|
+
getLabel,
|
|
27
|
+
clearLabel,
|
|
28
|
+
setLabel,
|
|
29
|
+
getLabelKeybind,
|
|
30
|
+
getLabelModifierText,
|
|
25
31
|
EDIT_HIDE_STATES_ACTION,
|
|
26
32
|
MERGE_TARGET_HIDDEN_HIDEABLE_STATE,
|
|
27
33
|
getEnabledHideStates,
|
|
@@ -35,8 +41,10 @@ import {
|
|
|
35
41
|
Transform,
|
|
36
42
|
use_input_default,
|
|
37
43
|
use_app_default,
|
|
44
|
+
getPlainInput,
|
|
38
45
|
shouldInsertInput,
|
|
39
46
|
require_jsx_runtime,
|
|
47
|
+
useTextCursor,
|
|
40
48
|
CYCLE_NUMBER_STYLE_ACTION,
|
|
41
49
|
NUMBER_STYLE_LABELS,
|
|
42
50
|
getNumberFormatKeybind,
|
|
@@ -74,11 +82,12 @@ import {
|
|
|
74
82
|
validateImportFile,
|
|
75
83
|
applyImport,
|
|
76
84
|
saveInstallationMetadata
|
|
77
|
-
} from "./ccstatusline-
|
|
85
|
+
} from "./ccstatusline-3tcnryv5.js";
|
|
78
86
|
import {
|
|
87
|
+
assignPowerlineThemeSlots,
|
|
79
88
|
advanceGlobalPowerlineThemeIndex,
|
|
80
89
|
advanceGlobalSeparatorIndex
|
|
81
|
-
} from "./ccstatusline-
|
|
90
|
+
} from "./ccstatusline-rdsx5ab1.js";
|
|
82
91
|
import {
|
|
83
92
|
__toESM,
|
|
84
93
|
__commonJS
|
|
@@ -1323,333 +1332,6 @@ var require_tinygradient = __commonJS(function(exports, module) {
|
|
|
1323
1332
|
};
|
|
1324
1333
|
});
|
|
1325
1334
|
|
|
1326
|
-
// node_modules/pluralize/pluralize.js
|
|
1327
|
-
var require_pluralize = __commonJS(function(exports, module) {
|
|
1328
|
-
(function(root, pluralize) {
|
|
1329
|
-
if (typeof exports === "object" && typeof module === "object") {
|
|
1330
|
-
module.exports = pluralize();
|
|
1331
|
-
} else if (typeof define === "function" && define.amd) {
|
|
1332
|
-
define(function() {
|
|
1333
|
-
return pluralize();
|
|
1334
|
-
});
|
|
1335
|
-
} else {
|
|
1336
|
-
root.pluralize = pluralize();
|
|
1337
|
-
}
|
|
1338
|
-
})(exports, function() {
|
|
1339
|
-
var pluralRules = [];
|
|
1340
|
-
var singularRules = [];
|
|
1341
|
-
var uncountables = {};
|
|
1342
|
-
var irregularPlurals = {};
|
|
1343
|
-
var irregularSingles = {};
|
|
1344
|
-
function sanitizeRule(rule) {
|
|
1345
|
-
if (typeof rule === "string") {
|
|
1346
|
-
return new RegExp("^" + rule + "$", "i");
|
|
1347
|
-
}
|
|
1348
|
-
return rule;
|
|
1349
|
-
}
|
|
1350
|
-
function restoreCase(word, token) {
|
|
1351
|
-
if (word === token)
|
|
1352
|
-
return token;
|
|
1353
|
-
if (word === word.toLowerCase())
|
|
1354
|
-
return token.toLowerCase();
|
|
1355
|
-
if (word === word.toUpperCase())
|
|
1356
|
-
return token.toUpperCase();
|
|
1357
|
-
if (word[0] === word[0].toUpperCase()) {
|
|
1358
|
-
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
|
1359
|
-
}
|
|
1360
|
-
return token.toLowerCase();
|
|
1361
|
-
}
|
|
1362
|
-
function interpolate(str, args) {
|
|
1363
|
-
return str.replace(/\$(\d{1,2})/g, function(match, index) {
|
|
1364
|
-
return args[index] || "";
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
function replace(word, rule) {
|
|
1368
|
-
return word.replace(rule[0], function(match, index) {
|
|
1369
|
-
var result = interpolate(rule[1], arguments);
|
|
1370
|
-
if (match === "") {
|
|
1371
|
-
return restoreCase(word[index - 1], result);
|
|
1372
|
-
}
|
|
1373
|
-
return restoreCase(match, result);
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
|
-
function sanitizeWord(token, word, rules) {
|
|
1377
|
-
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
1378
|
-
return word;
|
|
1379
|
-
}
|
|
1380
|
-
var len = rules.length;
|
|
1381
|
-
while (len--) {
|
|
1382
|
-
var rule = rules[len];
|
|
1383
|
-
if (rule[0].test(word))
|
|
1384
|
-
return replace(word, rule);
|
|
1385
|
-
}
|
|
1386
|
-
return word;
|
|
1387
|
-
}
|
|
1388
|
-
function replaceWord(replaceMap, keepMap, rules) {
|
|
1389
|
-
return function(word) {
|
|
1390
|
-
var token = word.toLowerCase();
|
|
1391
|
-
if (keepMap.hasOwnProperty(token)) {
|
|
1392
|
-
return restoreCase(word, token);
|
|
1393
|
-
}
|
|
1394
|
-
if (replaceMap.hasOwnProperty(token)) {
|
|
1395
|
-
return restoreCase(word, replaceMap[token]);
|
|
1396
|
-
}
|
|
1397
|
-
return sanitizeWord(token, word, rules);
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
function checkWord(replaceMap, keepMap, rules, bool) {
|
|
1401
|
-
return function(word) {
|
|
1402
|
-
var token = word.toLowerCase();
|
|
1403
|
-
if (keepMap.hasOwnProperty(token))
|
|
1404
|
-
return true;
|
|
1405
|
-
if (replaceMap.hasOwnProperty(token))
|
|
1406
|
-
return false;
|
|
1407
|
-
return sanitizeWord(token, token, rules) === token;
|
|
1408
|
-
};
|
|
1409
|
-
}
|
|
1410
|
-
function pluralize(word, count, inclusive) {
|
|
1411
|
-
var pluralized = count === 1 ? pluralize.singular(word) : pluralize.plural(word);
|
|
1412
|
-
return (inclusive ? count + " " : "") + pluralized;
|
|
1413
|
-
}
|
|
1414
|
-
pluralize.plural = replaceWord(irregularSingles, irregularPlurals, pluralRules);
|
|
1415
|
-
pluralize.isPlural = checkWord(irregularSingles, irregularPlurals, pluralRules);
|
|
1416
|
-
pluralize.singular = replaceWord(irregularPlurals, irregularSingles, singularRules);
|
|
1417
|
-
pluralize.isSingular = checkWord(irregularPlurals, irregularSingles, singularRules);
|
|
1418
|
-
pluralize.addPluralRule = function(rule, replacement) {
|
|
1419
|
-
pluralRules.push([sanitizeRule(rule), replacement]);
|
|
1420
|
-
};
|
|
1421
|
-
pluralize.addSingularRule = function(rule, replacement) {
|
|
1422
|
-
singularRules.push([sanitizeRule(rule), replacement]);
|
|
1423
|
-
};
|
|
1424
|
-
pluralize.addUncountableRule = function(word) {
|
|
1425
|
-
if (typeof word === "string") {
|
|
1426
|
-
uncountables[word.toLowerCase()] = true;
|
|
1427
|
-
return;
|
|
1428
|
-
}
|
|
1429
|
-
pluralize.addPluralRule(word, "$0");
|
|
1430
|
-
pluralize.addSingularRule(word, "$0");
|
|
1431
|
-
};
|
|
1432
|
-
pluralize.addIrregularRule = function(single, plural) {
|
|
1433
|
-
plural = plural.toLowerCase();
|
|
1434
|
-
single = single.toLowerCase();
|
|
1435
|
-
irregularSingles[single] = plural;
|
|
1436
|
-
irregularPlurals[plural] = single;
|
|
1437
|
-
};
|
|
1438
|
-
[
|
|
1439
|
-
["I", "we"],
|
|
1440
|
-
["me", "us"],
|
|
1441
|
-
["he", "they"],
|
|
1442
|
-
["she", "they"],
|
|
1443
|
-
["them", "them"],
|
|
1444
|
-
["myself", "ourselves"],
|
|
1445
|
-
["yourself", "yourselves"],
|
|
1446
|
-
["itself", "themselves"],
|
|
1447
|
-
["herself", "themselves"],
|
|
1448
|
-
["himself", "themselves"],
|
|
1449
|
-
["themself", "themselves"],
|
|
1450
|
-
["is", "are"],
|
|
1451
|
-
["was", "were"],
|
|
1452
|
-
["has", "have"],
|
|
1453
|
-
["this", "these"],
|
|
1454
|
-
["that", "those"],
|
|
1455
|
-
["echo", "echoes"],
|
|
1456
|
-
["dingo", "dingoes"],
|
|
1457
|
-
["volcano", "volcanoes"],
|
|
1458
|
-
["tornado", "tornadoes"],
|
|
1459
|
-
["torpedo", "torpedoes"],
|
|
1460
|
-
["genus", "genera"],
|
|
1461
|
-
["viscus", "viscera"],
|
|
1462
|
-
["stigma", "stigmata"],
|
|
1463
|
-
["stoma", "stomata"],
|
|
1464
|
-
["dogma", "dogmata"],
|
|
1465
|
-
["lemma", "lemmata"],
|
|
1466
|
-
["schema", "schemata"],
|
|
1467
|
-
["anathema", "anathemata"],
|
|
1468
|
-
["ox", "oxen"],
|
|
1469
|
-
["axe", "axes"],
|
|
1470
|
-
["die", "dice"],
|
|
1471
|
-
["yes", "yeses"],
|
|
1472
|
-
["foot", "feet"],
|
|
1473
|
-
["eave", "eaves"],
|
|
1474
|
-
["goose", "geese"],
|
|
1475
|
-
["tooth", "teeth"],
|
|
1476
|
-
["quiz", "quizzes"],
|
|
1477
|
-
["human", "humans"],
|
|
1478
|
-
["proof", "proofs"],
|
|
1479
|
-
["carve", "carves"],
|
|
1480
|
-
["valve", "valves"],
|
|
1481
|
-
["looey", "looies"],
|
|
1482
|
-
["thief", "thieves"],
|
|
1483
|
-
["groove", "grooves"],
|
|
1484
|
-
["pickaxe", "pickaxes"],
|
|
1485
|
-
["passerby", "passersby"]
|
|
1486
|
-
].forEach(function(rule) {
|
|
1487
|
-
return pluralize.addIrregularRule(rule[0], rule[1]);
|
|
1488
|
-
});
|
|
1489
|
-
[
|
|
1490
|
-
[/s?$/i, "s"],
|
|
1491
|
-
[/[^\u0000-\u007F]$/i, "$0"],
|
|
1492
|
-
[/([^aeiou]ese)$/i, "$1"],
|
|
1493
|
-
[/(ax|test)is$/i, "$1es"],
|
|
1494
|
-
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
|
1495
|
-
[/(e[mn]u)s?$/i, "$1s"],
|
|
1496
|
-
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
|
1497
|
-
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
|
1498
|
-
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
|
1499
|
-
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
|
1500
|
-
[/(her|at|gr)o$/i, "$1oes"],
|
|
1501
|
-
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
|
1502
|
-
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
|
1503
|
-
[/sis$/i, "ses"],
|
|
1504
|
-
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
|
1505
|
-
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
|
1506
|
-
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
|
1507
|
-
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
|
1508
|
-
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
|
1509
|
-
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
|
1510
|
-
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
|
1511
|
-
[/(child)(?:ren)?$/i, "$1ren"],
|
|
1512
|
-
[/eaux$/i, "$0"],
|
|
1513
|
-
[/m[ae]n$/i, "men"],
|
|
1514
|
-
["thou", "you"]
|
|
1515
|
-
].forEach(function(rule) {
|
|
1516
|
-
return pluralize.addPluralRule(rule[0], rule[1]);
|
|
1517
|
-
});
|
|
1518
|
-
[
|
|
1519
|
-
[/s$/i, ""],
|
|
1520
|
-
[/(ss)$/i, "$1"],
|
|
1521
|
-
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
|
1522
|
-
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
|
1523
|
-
[/ies$/i, "y"],
|
|
1524
|
-
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
|
1525
|
-
[/\b(mon|smil)ies$/i, "$1ey"],
|
|
1526
|
-
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
|
1527
|
-
[/(seraph|cherub)im$/i, "$1"],
|
|
1528
|
-
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
|
1529
|
-
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
|
1530
|
-
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
|
1531
|
-
[/(test)(?:is|es)$/i, "$1is"],
|
|
1532
|
-
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
|
1533
|
-
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
|
1534
|
-
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
|
1535
|
-
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
|
1536
|
-
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
|
1537
|
-
[/(matr|append)ices$/i, "$1ix"],
|
|
1538
|
-
[/(pe)(rson|ople)$/i, "$1rson"],
|
|
1539
|
-
[/(child)ren$/i, "$1"],
|
|
1540
|
-
[/(eau)x?$/i, "$1"],
|
|
1541
|
-
[/men$/i, "man"]
|
|
1542
|
-
].forEach(function(rule) {
|
|
1543
|
-
return pluralize.addSingularRule(rule[0], rule[1]);
|
|
1544
|
-
});
|
|
1545
|
-
[
|
|
1546
|
-
"adulthood",
|
|
1547
|
-
"advice",
|
|
1548
|
-
"agenda",
|
|
1549
|
-
"aid",
|
|
1550
|
-
"aircraft",
|
|
1551
|
-
"alcohol",
|
|
1552
|
-
"ammo",
|
|
1553
|
-
"analytics",
|
|
1554
|
-
"anime",
|
|
1555
|
-
"athletics",
|
|
1556
|
-
"audio",
|
|
1557
|
-
"bison",
|
|
1558
|
-
"blood",
|
|
1559
|
-
"bream",
|
|
1560
|
-
"buffalo",
|
|
1561
|
-
"butter",
|
|
1562
|
-
"carp",
|
|
1563
|
-
"cash",
|
|
1564
|
-
"chassis",
|
|
1565
|
-
"chess",
|
|
1566
|
-
"clothing",
|
|
1567
|
-
"cod",
|
|
1568
|
-
"commerce",
|
|
1569
|
-
"cooperation",
|
|
1570
|
-
"corps",
|
|
1571
|
-
"debris",
|
|
1572
|
-
"diabetes",
|
|
1573
|
-
"digestion",
|
|
1574
|
-
"elk",
|
|
1575
|
-
"energy",
|
|
1576
|
-
"equipment",
|
|
1577
|
-
"excretion",
|
|
1578
|
-
"expertise",
|
|
1579
|
-
"firmware",
|
|
1580
|
-
"flounder",
|
|
1581
|
-
"fun",
|
|
1582
|
-
"gallows",
|
|
1583
|
-
"garbage",
|
|
1584
|
-
"graffiti",
|
|
1585
|
-
"hardware",
|
|
1586
|
-
"headquarters",
|
|
1587
|
-
"health",
|
|
1588
|
-
"herpes",
|
|
1589
|
-
"highjinks",
|
|
1590
|
-
"homework",
|
|
1591
|
-
"housework",
|
|
1592
|
-
"information",
|
|
1593
|
-
"jeans",
|
|
1594
|
-
"justice",
|
|
1595
|
-
"kudos",
|
|
1596
|
-
"labour",
|
|
1597
|
-
"literature",
|
|
1598
|
-
"machinery",
|
|
1599
|
-
"mackerel",
|
|
1600
|
-
"mail",
|
|
1601
|
-
"media",
|
|
1602
|
-
"mews",
|
|
1603
|
-
"moose",
|
|
1604
|
-
"music",
|
|
1605
|
-
"mud",
|
|
1606
|
-
"manga",
|
|
1607
|
-
"news",
|
|
1608
|
-
"only",
|
|
1609
|
-
"personnel",
|
|
1610
|
-
"pike",
|
|
1611
|
-
"plankton",
|
|
1612
|
-
"pliers",
|
|
1613
|
-
"police",
|
|
1614
|
-
"pollution",
|
|
1615
|
-
"premises",
|
|
1616
|
-
"rain",
|
|
1617
|
-
"research",
|
|
1618
|
-
"rice",
|
|
1619
|
-
"salmon",
|
|
1620
|
-
"scissors",
|
|
1621
|
-
"series",
|
|
1622
|
-
"sewage",
|
|
1623
|
-
"shambles",
|
|
1624
|
-
"shrimp",
|
|
1625
|
-
"software",
|
|
1626
|
-
"species",
|
|
1627
|
-
"staff",
|
|
1628
|
-
"swine",
|
|
1629
|
-
"tennis",
|
|
1630
|
-
"traffic",
|
|
1631
|
-
"transportation",
|
|
1632
|
-
"trout",
|
|
1633
|
-
"tuna",
|
|
1634
|
-
"wealth",
|
|
1635
|
-
"welfare",
|
|
1636
|
-
"whiting",
|
|
1637
|
-
"wildebeest",
|
|
1638
|
-
"wildlife",
|
|
1639
|
-
"you",
|
|
1640
|
-
/pok[eé]mon$/i,
|
|
1641
|
-
/[^aeiou]ese$/i,
|
|
1642
|
-
/deer$/i,
|
|
1643
|
-
/fish$/i,
|
|
1644
|
-
/measles$/i,
|
|
1645
|
-
/o[iu]s$/i,
|
|
1646
|
-
/pox$/i,
|
|
1647
|
-
/sheep$/i
|
|
1648
|
-
].forEach(pluralize.addUncountableRule);
|
|
1649
|
-
return pluralize;
|
|
1650
|
-
});
|
|
1651
|
-
});
|
|
1652
|
-
|
|
1653
1335
|
// node_modules/ink-gradient/dist/index.js
|
|
1654
1336
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
1655
1337
|
var import_react = __toESM(require_react(), 1);
|
|
@@ -2383,8 +2065,8 @@ function cloneSettings(settings) {
|
|
|
2383
2065
|
}
|
|
2384
2066
|
|
|
2385
2067
|
// src/utils/global-command-resolution.ts
|
|
2386
|
-
import { execFileSync } from "child_process";
|
|
2387
|
-
import * as path from "path";
|
|
2068
|
+
import { execFileSync } from "node:child_process";
|
|
2069
|
+
import * as path from "node:path";
|
|
2388
2070
|
|
|
2389
2071
|
// src/utils/package-manager-executable.ts
|
|
2390
2072
|
function getPackageManagerShellOptions(executable, platform = process.platform) {
|
|
@@ -2551,8 +2233,8 @@ function inspectGlobalCommandResolution(packageManager, options = {}) {
|
|
|
2551
2233
|
import {
|
|
2552
2234
|
execFile,
|
|
2553
2235
|
execFileSync as execFileSync2
|
|
2554
|
-
} from "child_process";
|
|
2555
|
-
import * as fs from "fs";
|
|
2236
|
+
} from "node:child_process";
|
|
2237
|
+
import * as fs from "node:fs";
|
|
2556
2238
|
var GLOBAL_PACKAGE_TIMEOUT_MS = 120000;
|
|
2557
2239
|
var VERSION_LOOKUP_TIMEOUT_MS = 5000;
|
|
2558
2240
|
var WINDOWS_SHIM_EXTENSIONS = [
|
|
@@ -2775,8 +2457,8 @@ function runGlobalPackageUninstall(packageManager, { platform = process.platform
|
|
|
2775
2457
|
}
|
|
2776
2458
|
|
|
2777
2459
|
// src/utils/open-url.ts
|
|
2778
|
-
import { spawnSync } from "child_process";
|
|
2779
|
-
import * as os2 from "os";
|
|
2460
|
+
import { spawnSync } from "node:child_process";
|
|
2461
|
+
import * as os2 from "node:os";
|
|
2780
2462
|
function runOpenCommand(command, args) {
|
|
2781
2463
|
const result = spawnSync(command, args, {
|
|
2782
2464
|
stdio: "ignore",
|
|
@@ -2862,10 +2544,13 @@ function openExternalUrl(url) {
|
|
|
2862
2544
|
}
|
|
2863
2545
|
|
|
2864
2546
|
// src/utils/powerline.ts
|
|
2865
|
-
import {
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2547
|
+
import {
|
|
2548
|
+
execFileSync as execFileSync3,
|
|
2549
|
+
execSync
|
|
2550
|
+
} from "node:child_process";
|
|
2551
|
+
import * as fs2 from "node:fs";
|
|
2552
|
+
import * as os3 from "node:os";
|
|
2553
|
+
import * as path2 from "node:path";
|
|
2869
2554
|
var fontsInstalledThisSession = false;
|
|
2870
2555
|
function checkPowerlineFonts() {
|
|
2871
2556
|
if (process.env.DEBUG_FONT_INSTALL === "1" && !fontsInstalledThisSession) {
|
|
@@ -2954,8 +2639,8 @@ async function checkPowerlineFontsAsync() {
|
|
|
2954
2639
|
const platform = os3.platform();
|
|
2955
2640
|
if (platform === "linux" || platform === "darwin") {
|
|
2956
2641
|
try {
|
|
2957
|
-
const { exec } = await import("child_process");
|
|
2958
|
-
const { promisify } = await import("util");
|
|
2642
|
+
const { exec } = await import("node:child_process");
|
|
2643
|
+
const { promisify } = await import("node:util");
|
|
2959
2644
|
const execAsync = promisify(exec);
|
|
2960
2645
|
const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", {
|
|
2961
2646
|
encoding: "utf8",
|
|
@@ -2994,12 +2679,9 @@ async function installPowerlineFonts() {
|
|
|
2994
2679
|
if (!fs2.existsSync(fontDir)) {
|
|
2995
2680
|
fs2.mkdirSync(fontDir, { recursive: true });
|
|
2996
2681
|
}
|
|
2997
|
-
const tempDir = path2.join(os3.tmpdir(),
|
|
2682
|
+
const tempDir = fs2.mkdtempSync(path2.join(os3.tmpdir(), "ccstatusline-powerline-fonts-"));
|
|
2998
2683
|
try {
|
|
2999
|
-
|
|
3000
|
-
fs2.rmSync(tempDir, { recursive: true, force: true });
|
|
3001
|
-
}
|
|
3002
|
-
execSync(`git clone --depth=1 https://github.com/powerline/fonts.git "${tempDir}"`, {
|
|
2684
|
+
execFileSync3("git", ["clone", "--depth=1", "https://github.com/powerline/fonts.git", tempDir], {
|
|
3003
2685
|
stdio: "pipe",
|
|
3004
2686
|
encoding: "utf8",
|
|
3005
2687
|
windowsHide: true
|
|
@@ -3008,10 +2690,10 @@ async function installPowerlineFonts() {
|
|
|
3008
2690
|
const installScript = path2.join(tempDir, "install.sh");
|
|
3009
2691
|
if (fs2.existsSync(installScript)) {
|
|
3010
2692
|
fs2.chmodSync(installScript, 493);
|
|
3011
|
-
|
|
2693
|
+
execFileSync3(installScript, [], {
|
|
2694
|
+
cwd: tempDir,
|
|
3012
2695
|
stdio: "pipe",
|
|
3013
2696
|
encoding: "utf8",
|
|
3014
|
-
shell: "/bin/bash",
|
|
3015
2697
|
windowsHide: true
|
|
3016
2698
|
});
|
|
3017
2699
|
if (platform === "linux") {
|
|
@@ -3095,14 +2777,18 @@ async function installPowerlineFonts() {
|
|
|
3095
2777
|
}
|
|
3096
2778
|
|
|
3097
2779
|
// src/utils/update-checker.ts
|
|
3098
|
-
import { execFile as execFile2 } from "child_process";
|
|
3099
|
-
import * as https from "https";
|
|
2780
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
2781
|
+
import * as https from "node:https";
|
|
3100
2782
|
var NPM_REGISTRY_LATEST_URL = "https://registry.npmjs.org/ccstatusline-zh/latest";
|
|
3101
2783
|
var DEFAULT_REGISTRY_TIMEOUT_MS = 5000;
|
|
3102
2784
|
var GLOBAL_UPDATE_TIMEOUT_MS = 120000;
|
|
2785
|
+
var RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
2786
|
+
function isReleaseVersion(version) {
|
|
2787
|
+
return RELEASE_VERSION.test(version);
|
|
2788
|
+
}
|
|
3103
2789
|
function parseVersion(version) {
|
|
3104
2790
|
return version.split(/[.-]/).map((part) => {
|
|
3105
|
-
const parsed = parseInt(part, 10);
|
|
2791
|
+
const parsed = Number.parseInt(part, 10);
|
|
3106
2792
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
3107
2793
|
});
|
|
3108
2794
|
}
|
|
@@ -3220,6 +2906,9 @@ async function checkForUpdates({
|
|
|
3220
2906
|
}) {
|
|
3221
2907
|
try {
|
|
3222
2908
|
const latestVersion = await latestVersionFetcher(timeoutMs);
|
|
2909
|
+
if (!isReleaseVersion(latestVersion)) {
|
|
2910
|
+
throw new Error("npm 仓库返回了无效的版本号");
|
|
2911
|
+
}
|
|
3223
2912
|
return buildUpdateCheckResult({
|
|
3224
2913
|
currentVersion,
|
|
3225
2914
|
latestVersion,
|
|
@@ -3275,6 +2964,9 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
|
|
|
3275
2964
|
});
|
|
3276
2965
|
}
|
|
3277
2966
|
function runGlobalPackageInstall(packageManager, version, { platform = process.platform } = {}) {
|
|
2967
|
+
if (!isReleaseVersion(version)) {
|
|
2968
|
+
return Promise.reject(new Error("不是有效的 ccstatusline-zh 发布版本"));
|
|
2969
|
+
}
|
|
3278
2970
|
const executable = getPackageManagerExecutable(packageManager, platform);
|
|
3279
2971
|
const args = packageManager === "npm" ? ["install", "-g", `ccstatusline-zh@${version}`] : ["add", "-g", `ccstatusline-zh@${version}`];
|
|
3280
2972
|
return new Promise((resolve, reject) => {
|
|
@@ -3851,9 +3543,9 @@ var CONFIRM_OPTIONS = [
|
|
|
3851
3543
|
value: false
|
|
3852
3544
|
}
|
|
3853
3545
|
];
|
|
3854
|
-
var ConfirmDialog = ({ message, onConfirm, onCancel, inline = false }) => {
|
|
3546
|
+
var ConfirmDialog = ({ message, onConfirm, onCancel, inline = false, busy = false }) => {
|
|
3855
3547
|
use_input_default((_, key) => {
|
|
3856
|
-
if (key.escape) {
|
|
3548
|
+
if (key.escape && !busy) {
|
|
3857
3549
|
onCancel();
|
|
3858
3550
|
}
|
|
3859
3551
|
});
|
|
@@ -3878,7 +3570,10 @@ var ConfirmDialog = ({ message, onConfirm, onCancel, inline = false }) => {
|
|
|
3878
3570
|
}),
|
|
3879
3571
|
/* @__PURE__ */ jsx_runtime2.jsx(Box_default, {
|
|
3880
3572
|
marginTop: 1,
|
|
3881
|
-
children: /* @__PURE__ */ jsx_runtime2.jsx(
|
|
3573
|
+
children: busy ? /* @__PURE__ */ jsx_runtime2.jsx(Text, {
|
|
3574
|
+
color: "yellow",
|
|
3575
|
+
children: "正在处理,请稍候..."
|
|
3576
|
+
}) : /* @__PURE__ */ jsx_runtime2.jsx(List, {
|
|
3882
3577
|
items: CONFIRM_OPTIONS,
|
|
3883
3578
|
onSelect: (confirmed) => {
|
|
3884
3579
|
if (confirmed) {
|
|
@@ -3943,7 +3638,6 @@ function resetWidgetStyling(widgets, widgetId) {
|
|
|
3943
3638
|
backgroundColor,
|
|
3944
3639
|
bold,
|
|
3945
3640
|
dim,
|
|
3946
|
-
numberFormat,
|
|
3947
3641
|
...restWidget
|
|
3948
3642
|
} = widget;
|
|
3949
3643
|
return restWidget;
|
|
@@ -3956,7 +3650,6 @@ function clearAllWidgetStyling(widgets) {
|
|
|
3956
3650
|
backgroundColor,
|
|
3957
3651
|
bold,
|
|
3958
3652
|
dim,
|
|
3959
|
-
numberFormat,
|
|
3960
3653
|
...restWidget
|
|
3961
3654
|
} = widget;
|
|
3962
3655
|
return restWidget;
|
|
@@ -4047,6 +3740,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4047
3740
|
const [editingBackground, setEditingBackground] = import_react5.useState(false);
|
|
4048
3741
|
const hasNoItems = colorableWidgets.length === 0;
|
|
4049
3742
|
use_input_default((input, key) => {
|
|
3743
|
+
const shortcut = getPlainInput(input, key);
|
|
4050
3744
|
if (hasNoItems) {
|
|
4051
3745
|
onBack();
|
|
4052
3746
|
return;
|
|
@@ -4090,8 +3784,8 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4090
3784
|
setAnsi256InputMode(false);
|
|
4091
3785
|
setAnsi256Input("");
|
|
4092
3786
|
} else if (key.return) {
|
|
4093
|
-
const code = parseInt(ansi256Input, 10);
|
|
4094
|
-
if (!isNaN(code) && code >= 0 && code <= 255) {
|
|
3787
|
+
const code = Number.parseInt(ansi256Input, 10);
|
|
3788
|
+
if (!Number.isNaN(code) && code >= 0 && code <= 255) {
|
|
4095
3789
|
const ansiColor = `ansi256:${code}`;
|
|
4096
3790
|
const selectedWidget = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
4097
3791
|
if (selectedWidget) {
|
|
@@ -4106,7 +3800,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4106
3800
|
} else if (shouldInsertInput(input, key) && ansi256Input.length < 3) {
|
|
4107
3801
|
if (/^[0-9]$/.test(input)) {
|
|
4108
3802
|
const newInput = ansi256Input + input;
|
|
4109
|
-
const code = parseInt(newInput, 10);
|
|
3803
|
+
const code = Number.parseInt(newInput, 10);
|
|
4110
3804
|
if (code <= 255) {
|
|
4111
3805
|
setAnsi256Input(newInput);
|
|
4112
3806
|
}
|
|
@@ -4179,17 +3873,21 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4179
3873
|
} else {
|
|
4180
3874
|
onBack();
|
|
4181
3875
|
}
|
|
4182
|
-
} else if (
|
|
3876
|
+
} else if (key.return) {
|
|
3877
|
+
if (highlightedItemId === "back") {
|
|
3878
|
+
onBack();
|
|
3879
|
+
}
|
|
3880
|
+
} else if (shortcut === "h" || shortcut === "H") {
|
|
4183
3881
|
if (highlightedItemId && highlightedItemId !== "back" && settings.colorLevel === 3) {
|
|
4184
3882
|
setHexInputMode(true);
|
|
4185
3883
|
setHexInput("");
|
|
4186
3884
|
}
|
|
4187
|
-
} else if (
|
|
3885
|
+
} else if (shortcut === "a" || shortcut === "A") {
|
|
4188
3886
|
if (highlightedItemId && highlightedItemId !== "back" && settings.colorLevel === 2) {
|
|
4189
3887
|
setAnsi256InputMode(true);
|
|
4190
3888
|
setAnsi256Input("");
|
|
4191
3889
|
}
|
|
4192
|
-
} else if (
|
|
3890
|
+
} else if (shortcut === "g" || shortcut === "G") {
|
|
4193
3891
|
if (highlightedItemId && highlightedItemId !== "back" && !editingBackground && settings.colorLevel >= 2) {
|
|
4194
3892
|
setGradientMode(true);
|
|
4195
3893
|
setGradientIndex(0);
|
|
@@ -4197,15 +3895,19 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4197
3895
|
setGradientStartHex("");
|
|
4198
3896
|
setGradientHexInput("");
|
|
4199
3897
|
}
|
|
4200
|
-
} else if (
|
|
3898
|
+
} else if (shortcut === "s" || shortcut === "S") {
|
|
4201
3899
|
if (!settings.powerline.enabled && !settings.defaultSeparator) {
|
|
4202
3900
|
setShowSeparators(!showSeparators);
|
|
3901
|
+
const highlightedWidget = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
3902
|
+
if (showSeparators && highlightedWidget?.type === "separator") {
|
|
3903
|
+
setHighlightedItemId(colorableWidgets.find((widget) => widget.type !== "separator")?.id ?? null);
|
|
3904
|
+
}
|
|
4203
3905
|
}
|
|
4204
|
-
} else if (
|
|
3906
|
+
} else if (shortcut === "f" || shortcut === "F") {
|
|
4205
3907
|
if (colorableWidgets.length > 0) {
|
|
4206
3908
|
setEditingBackground(!editingBackground);
|
|
4207
3909
|
}
|
|
4208
|
-
} else if (
|
|
3910
|
+
} else if (shortcut === "b" || shortcut === "B") {
|
|
4209
3911
|
if (highlightedItemId && highlightedItemId !== "back") {
|
|
4210
3912
|
const selectedWidget = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
4211
3913
|
if (selectedWidget) {
|
|
@@ -4213,7 +3915,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4213
3915
|
onUpdate(newItems);
|
|
4214
3916
|
}
|
|
4215
3917
|
}
|
|
4216
|
-
} else if (
|
|
3918
|
+
} else if (shortcut === "d" || shortcut === "D") {
|
|
4217
3919
|
if (highlightedItemId && highlightedItemId !== "back") {
|
|
4218
3920
|
const selectedWidget = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
4219
3921
|
if (selectedWidget) {
|
|
@@ -4221,7 +3923,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4221
3923
|
onUpdate(newItems);
|
|
4222
3924
|
}
|
|
4223
3925
|
}
|
|
4224
|
-
} else if (
|
|
3926
|
+
} else if (shortcut === "r" || shortcut === "R") {
|
|
4225
3927
|
if (highlightedItemId && highlightedItemId !== "back") {
|
|
4226
3928
|
const selectedWidget = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
4227
3929
|
if (selectedWidget) {
|
|
@@ -4229,7 +3931,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4229
3931
|
onUpdate(newItems);
|
|
4230
3932
|
}
|
|
4231
3933
|
}
|
|
4232
|
-
} else if (
|
|
3934
|
+
} else if (shortcut === "c" || shortcut === "C") {
|
|
4233
3935
|
setShowClearConfirm(true);
|
|
4234
3936
|
} else if (key.leftArrow || key.rightArrow) {
|
|
4235
3937
|
if (highlightedItemId && highlightedItemId !== "back") {
|
|
@@ -4310,12 +4012,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4310
4012
|
value: widget.id
|
|
4311
4013
|
};
|
|
4312
4014
|
});
|
|
4313
|
-
menuItems.push({ label: "←
|
|
4314
|
-
const handleSelect = (selected) => {
|
|
4315
|
-
if (selected.value === "back") {
|
|
4316
|
-
onBack();
|
|
4317
|
-
}
|
|
4318
|
-
};
|
|
4015
|
+
menuItems.push({ label: "← 返回", value: "back" });
|
|
4319
4016
|
const handleHighlight = (item) => {
|
|
4320
4017
|
setHighlightedItemId(item.value);
|
|
4321
4018
|
};
|
|
@@ -4349,7 +4046,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4349
4046
|
}
|
|
4350
4047
|
} else {
|
|
4351
4048
|
if (!currentColor || currentColor === "") {
|
|
4352
|
-
colorDisplay = source_default.gray("
|
|
4049
|
+
colorDisplay = source_default.gray("(默认)");
|
|
4353
4050
|
} else {
|
|
4354
4051
|
let displayName;
|
|
4355
4052
|
if (currentColor.startsWith("ansi256:")) {
|
|
@@ -4386,7 +4083,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4386
4083
|
/* @__PURE__ */ jsx_runtime3.jsxs(Text, {
|
|
4387
4084
|
bold: true,
|
|
4388
4085
|
children: [
|
|
4389
|
-
"
|
|
4086
|
+
"自定义渐变",
|
|
4390
4087
|
widgetName ? ` - ${widgetName}` : ""
|
|
4391
4088
|
]
|
|
4392
4089
|
}),
|
|
@@ -4395,12 +4092,12 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4395
4092
|
flexDirection: "column",
|
|
4396
4093
|
children: [
|
|
4397
4094
|
/* @__PURE__ */ jsx_runtime3.jsx(Text, {
|
|
4398
|
-
children: gradientCustomStep === "start" ? "
|
|
4095
|
+
children: gradientCustomStep === "start" ? "输入起始颜色的十六进制值(不含 #):" : "输入结束颜色的十六进制值(不含 #):"
|
|
4399
4096
|
}),
|
|
4400
4097
|
gradientCustomStep === "end" && /* @__PURE__ */ jsx_runtime3.jsxs(Text, {
|
|
4401
4098
|
dimColor: true,
|
|
4402
4099
|
children: [
|
|
4403
|
-
"
|
|
4100
|
+
"起始颜色:#",
|
|
4404
4101
|
gradientStartHex
|
|
4405
4102
|
]
|
|
4406
4103
|
}),
|
|
@@ -4419,7 +4116,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4419
4116
|
}),
|
|
4420
4117
|
/* @__PURE__ */ jsx_runtime3.jsx(Text, {
|
|
4421
4118
|
dimColor: true,
|
|
4422
|
-
children: "
|
|
4119
|
+
children: "按 Enter 确认,ESC 返回"
|
|
4423
4120
|
})
|
|
4424
4121
|
]
|
|
4425
4122
|
})
|
|
@@ -4432,7 +4129,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4432
4129
|
/* @__PURE__ */ jsx_runtime3.jsxs(Text, {
|
|
4433
4130
|
bold: true,
|
|
4434
4131
|
children: [
|
|
4435
|
-
"
|
|
4132
|
+
"选择渐变",
|
|
4436
4133
|
widgetName ? ` - ${widgetName}` : ""
|
|
4437
4134
|
]
|
|
4438
4135
|
}),
|
|
@@ -4440,7 +4137,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4440
4137
|
marginTop: 1,
|
|
4441
4138
|
children: /* @__PURE__ */ jsx_runtime3.jsx(Text, {
|
|
4442
4139
|
dimColor: true,
|
|
4443
|
-
children: "↑↓
|
|
4140
|
+
children: "↑↓ 选择,Enter 应用,ESC 取消"
|
|
4444
4141
|
})
|
|
4445
4142
|
}),
|
|
4446
4143
|
/* @__PURE__ */ jsx_runtime3.jsxs(Box_default, {
|
|
@@ -4456,7 +4153,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4456
4153
|
/* @__PURE__ */ jsx_runtime3.jsxs(Text, {
|
|
4457
4154
|
children: [
|
|
4458
4155
|
gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
|
|
4459
|
-
"
|
|
4156
|
+
"自定义(输入起止颜色的十六进制值)"
|
|
4460
4157
|
]
|
|
4461
4158
|
}, "custom")
|
|
4462
4159
|
]
|
|
@@ -4511,7 +4208,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4511
4208
|
}
|
|
4512
4209
|
const hasGlobalFgOverride = !!settings.overrideForegroundColor;
|
|
4513
4210
|
const hasGlobalBgOverride = !!settings.overrideBackgroundColor && !powerlineEnabled;
|
|
4514
|
-
const globalOverrideMessage = hasGlobalFgOverride && hasGlobalBgOverride ? "⚠ Global override for FG and BG active" : hasGlobalFgOverride ? "⚠
|
|
4211
|
+
const globalOverrideMessage = hasGlobalFgOverride && hasGlobalBgOverride ? "⚠ Global override for FG and BG active" : hasGlobalFgOverride ? "⚠ 前景色全局覆盖已激活" : hasGlobalBgOverride ? "⚠ Global override for BG active" : null;
|
|
4515
4212
|
return /* @__PURE__ */ jsx_runtime3.jsxs(Box_default, {
|
|
4516
4213
|
flexDirection: "column",
|
|
4517
4214
|
children: [
|
|
@@ -4642,7 +4339,6 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4642
4339
|
}, item.value))
|
|
4643
4340
|
}) : /* @__PURE__ */ jsx_runtime3.jsx(SelectInput_default, {
|
|
4644
4341
|
items: menuItems,
|
|
4645
|
-
onSelect: handleSelect,
|
|
4646
4342
|
onHighlight: handleHighlight,
|
|
4647
4343
|
initialIndex: Math.max(0, menuItems.findIndex((item) => item.value === highlightedItemId)),
|
|
4648
4344
|
indicatorComponent: ({ isSelected }) => /* @__PURE__ */ jsx_runtime3.jsx(Text, {
|
|
@@ -4673,8 +4369,8 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
4673
4369
|
};
|
|
4674
4370
|
// src/tui/components/ExportConfigDialog.tsx
|
|
4675
4371
|
var import_react6 = __toESM(require_react(), 1);
|
|
4676
|
-
import * as os4 from "os";
|
|
4677
|
-
import * as path3 from "path";
|
|
4372
|
+
import * as os4 from "node:os";
|
|
4373
|
+
import * as path3 from "node:path";
|
|
4678
4374
|
var jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
4679
4375
|
var DEFAULT_EXPORT_PATH = path3.join(os4.homedir(), "ccstatusline-zh-config.json");
|
|
4680
4376
|
function ExportConfigDialog({ onExport, onCancel }) {
|
|
@@ -4792,6 +4488,9 @@ function getImportPreviewKeys(current, imported) {
|
|
|
4792
4488
|
function getImportPreviewSettings(current, validation, mode) {
|
|
4793
4489
|
return applyImport(current, validation.data, mode, validation.presentKeys);
|
|
4794
4490
|
}
|
|
4491
|
+
function escapeControlCharacters(text) {
|
|
4492
|
+
return text.replace(/[\x00-\x1f\x7f-\x9f]/g, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
4493
|
+
}
|
|
4795
4494
|
function formatScalar(value) {
|
|
4796
4495
|
if (value === null || value === undefined) {
|
|
4797
4496
|
return "无";
|
|
@@ -4800,9 +4499,16 @@ function formatScalar(value) {
|
|
|
4800
4499
|
return String(value);
|
|
4801
4500
|
}
|
|
4802
4501
|
if (typeof value === "string") {
|
|
4803
|
-
return value || "(空)";
|
|
4502
|
+
return escapeControlCharacters(value) || "(空)";
|
|
4804
4503
|
}
|
|
4805
|
-
return JSON.stringify(value);
|
|
4504
|
+
return escapeControlCharacters(JSON.stringify(value));
|
|
4505
|
+
}
|
|
4506
|
+
function getCustomCommands(settings) {
|
|
4507
|
+
return settings.lines.flat().filter((widget) => widget.type === "custom-command" && widget.commandPath).map((widget) => widget.commandPath ?? "");
|
|
4508
|
+
}
|
|
4509
|
+
function getImportedCommands(current, preview) {
|
|
4510
|
+
const existing = new Set(getCustomCommands(current));
|
|
4511
|
+
return [...new Set(getCustomCommands(preview).filter((command) => !existing.has(command)))];
|
|
4806
4512
|
}
|
|
4807
4513
|
function diffObject(current, imported, prefix) {
|
|
4808
4514
|
const keys = new Set([...Object.keys(current), ...Object.keys(imported)]);
|
|
@@ -4867,8 +4573,10 @@ function ImportPreviewDialog({
|
|
|
4867
4573
|
onCancel
|
|
4868
4574
|
}) {
|
|
4869
4575
|
const [previewMode, setPreviewMode] = import_react8.useState("replace");
|
|
4576
|
+
const [pendingMode, setPendingMode] = import_react8.useState(null);
|
|
4870
4577
|
const previewSettings = getImportPreviewSettings(currentSettings, validation, previewMode);
|
|
4871
4578
|
const topLevelKeys = getImportPreviewKeys(currentSettings, previewSettings);
|
|
4579
|
+
const importedCommands = getImportedCommands(currentSettings, previewSettings);
|
|
4872
4580
|
const items = [
|
|
4873
4581
|
{ label: "全部替换", value: "replace", description: "使用导入的配置覆盖所有设置" },
|
|
4874
4582
|
{ label: "合并", value: "merge", description: "将导入的设置覆盖到当前设置之上" },
|
|
@@ -4878,9 +4586,51 @@ function ImportPreviewDialog({
|
|
|
4878
4586
|
function handleSelect(value) {
|
|
4879
4587
|
if (value === "cancel" || value === "back") {
|
|
4880
4588
|
onCancel();
|
|
4881
|
-
|
|
4882
|
-
onApply(value);
|
|
4589
|
+
return;
|
|
4883
4590
|
}
|
|
4591
|
+
const commands = getImportedCommands(currentSettings, getImportPreviewSettings(currentSettings, validation, value));
|
|
4592
|
+
if (commands.length > 0) {
|
|
4593
|
+
setPendingMode(value);
|
|
4594
|
+
return;
|
|
4595
|
+
}
|
|
4596
|
+
onApply(value);
|
|
4597
|
+
}
|
|
4598
|
+
if (pendingMode) {
|
|
4599
|
+
const commands = getImportedCommands(currentSettings, getImportPreviewSettings(currentSettings, validation, pendingMode));
|
|
4600
|
+
const confirmItems = [
|
|
4601
|
+
{ label: "取消", value: "cancel", description: "返回预览,不导入配置" },
|
|
4602
|
+
{ label: "应用并运行这些命令", value: "confirm", description: "导入配置,包括上述命令" }
|
|
4603
|
+
];
|
|
4604
|
+
return /* @__PURE__ */ jsx_runtime6.jsxs(Box_default, {
|
|
4605
|
+
flexDirection: "column",
|
|
4606
|
+
children: [
|
|
4607
|
+
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4608
|
+
bold: true,
|
|
4609
|
+
children: "导入预览"
|
|
4610
|
+
}),
|
|
4611
|
+
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4612
|
+
color: "yellow",
|
|
4613
|
+
children: `是否应用此次导入?它将新增 ${commands.length} 条 Shell 命令,每次渲染状态行时都会运行:`
|
|
4614
|
+
}),
|
|
4615
|
+
/* @__PURE__ */ jsx_runtime6.jsx(Box_default, {
|
|
4616
|
+
flexDirection: "column",
|
|
4617
|
+
marginLeft: 4,
|
|
4618
|
+
children: commands.map((command, index) => /* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4619
|
+
children: `$ ${escapeControlCharacters(command)}`
|
|
4620
|
+
}, index))
|
|
4621
|
+
}),
|
|
4622
|
+
/* @__PURE__ */ jsx_runtime6.jsx(List, {
|
|
4623
|
+
items: confirmItems,
|
|
4624
|
+
onSelect: (choice) => {
|
|
4625
|
+
if (choice === "confirm") {
|
|
4626
|
+
onApply(pendingMode);
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4629
|
+
setPendingMode(null);
|
|
4630
|
+
}
|
|
4631
|
+
})
|
|
4632
|
+
]
|
|
4633
|
+
});
|
|
4884
4634
|
}
|
|
4885
4635
|
function handleSelectionChange(value) {
|
|
4886
4636
|
if (value === "replace" || value === "merge") {
|
|
@@ -4913,7 +4663,7 @@ function ImportPreviewDialog({
|
|
|
4913
4663
|
marginLeft: 4,
|
|
4914
4664
|
children: [
|
|
4915
4665
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4916
|
-
children: `${e.path}: `
|
|
4666
|
+
children: `${escapeControlCharacters(e.path)}: `
|
|
4917
4667
|
}),
|
|
4918
4668
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4919
4669
|
color: "red",
|
|
@@ -4944,7 +4694,7 @@ function ImportPreviewDialog({
|
|
|
4944
4694
|
marginLeft: 4,
|
|
4945
4695
|
children: [
|
|
4946
4696
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4947
|
-
children: `${e.path}: `
|
|
4697
|
+
children: `${escapeControlCharacters(e.path)}: `
|
|
4948
4698
|
}),
|
|
4949
4699
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4950
4700
|
color: "red",
|
|
@@ -4966,7 +4716,7 @@ function ImportPreviewDialog({
|
|
|
4966
4716
|
diffRows.push(/* @__PURE__ */ jsx_runtime6.jsxs(Box_default, {
|
|
4967
4717
|
children: [
|
|
4968
4718
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4969
|
-
children: ` ${key}: `
|
|
4719
|
+
children: ` ${escapeControlCharacters(key)}: `
|
|
4970
4720
|
}),
|
|
4971
4721
|
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4972
4722
|
color: "red",
|
|
@@ -4997,6 +4747,23 @@ function ImportPreviewDialog({
|
|
|
4997
4747
|
flexDirection: "column",
|
|
4998
4748
|
children: diffRows
|
|
4999
4749
|
}),
|
|
4750
|
+
importedCommands.length > 0 && /* @__PURE__ */ jsx_runtime6.jsxs(Box_default, {
|
|
4751
|
+
flexDirection: "column",
|
|
4752
|
+
marginTop: 1,
|
|
4753
|
+
children: [
|
|
4754
|
+
/* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4755
|
+
color: "yellow",
|
|
4756
|
+
children: "此次导入新增的 Shell 命令将在每次渲染状态行时运行:"
|
|
4757
|
+
}),
|
|
4758
|
+
/* @__PURE__ */ jsx_runtime6.jsx(Box_default, {
|
|
4759
|
+
flexDirection: "column",
|
|
4760
|
+
marginLeft: 4,
|
|
4761
|
+
children: importedCommands.map((command, index) => /* @__PURE__ */ jsx_runtime6.jsx(Text, {
|
|
4762
|
+
children: `$ ${escapeControlCharacters(command)}`
|
|
4763
|
+
}, index))
|
|
4764
|
+
})
|
|
4765
|
+
]
|
|
4766
|
+
}),
|
|
5000
4767
|
/* @__PURE__ */ jsx_runtime6.jsx(List, {
|
|
5001
4768
|
items,
|
|
5002
4769
|
onSelect: handleSelect,
|
|
@@ -5055,6 +4822,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5055
4822
|
const currentBgIndex = bgColors.indexOf(settings.overrideBackgroundColor ?? "none");
|
|
5056
4823
|
const currentFgIndex = fgColors.indexOf(settings.overrideForegroundColor ?? "none");
|
|
5057
4824
|
use_input_default((input, key) => {
|
|
4825
|
+
const shortcut = getPlainInput(input, key);
|
|
5058
4826
|
if (editingPadding) {
|
|
5059
4827
|
if (key.return) {
|
|
5060
4828
|
const updatedSettings = {
|
|
@@ -5165,11 +4933,11 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5165
4933
|
} else {
|
|
5166
4934
|
if (key.escape) {
|
|
5167
4935
|
onBack();
|
|
5168
|
-
} else if (
|
|
4936
|
+
} else if (shortcut === "p" || shortcut === "P") {
|
|
5169
4937
|
setEditingPadding(true);
|
|
5170
|
-
} else if ((
|
|
4938
|
+
} else if ((shortcut === "s" || shortcut === "S") && !isPowerlineEnabled) {
|
|
5171
4939
|
setEditingSeparator(true);
|
|
5172
|
-
} else if ((
|
|
4940
|
+
} else if ((shortcut === "i" || shortcut === "I") && !isPowerlineEnabled) {
|
|
5173
4941
|
const newInheritColors = !inheritColors;
|
|
5174
4942
|
setInheritColors(newInheritColors);
|
|
5175
4943
|
const updatedSettings = {
|
|
@@ -5177,7 +4945,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5177
4945
|
inheritSeparatorColors: newInheritColors
|
|
5178
4946
|
};
|
|
5179
4947
|
onUpdate(updatedSettings);
|
|
5180
|
-
} else if ((
|
|
4948
|
+
} else if ((shortcut === "b" || shortcut === "B") && !isPowerlineEnabled) {
|
|
5181
4949
|
const nextIndex = (currentBgIndex + 1) % bgColors.length;
|
|
5182
4950
|
const nextBgColor = bgColors[nextIndex];
|
|
5183
4951
|
const updatedSettings = {
|
|
@@ -5185,13 +4953,13 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5185
4953
|
overrideBackgroundColor: nextBgColor === "none" ? undefined : nextBgColor
|
|
5186
4954
|
};
|
|
5187
4955
|
onUpdate(updatedSettings);
|
|
5188
|
-
} else if ((
|
|
4956
|
+
} else if ((shortcut === "c" || shortcut === "C") && !isPowerlineEnabled) {
|
|
5189
4957
|
const updatedSettings = {
|
|
5190
4958
|
...settings,
|
|
5191
4959
|
overrideBackgroundColor: undefined
|
|
5192
4960
|
};
|
|
5193
4961
|
onUpdate(updatedSettings);
|
|
5194
|
-
} else if (
|
|
4962
|
+
} else if (shortcut === "o" || shortcut === "O") {
|
|
5195
4963
|
const newGlobalBold = !globalBold;
|
|
5196
4964
|
setGlobalBold(newGlobalBold);
|
|
5197
4965
|
const updatedSettings = {
|
|
@@ -5199,7 +4967,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5199
4967
|
globalBold: newGlobalBold
|
|
5200
4968
|
};
|
|
5201
4969
|
onUpdate(updatedSettings);
|
|
5202
|
-
} else if (
|
|
4970
|
+
} else if (shortcut === "m" || shortcut === "M") {
|
|
5203
4971
|
const newMinimalistMode = !minimalistMode;
|
|
5204
4972
|
setMinimalistMode(newMinimalistMode);
|
|
5205
4973
|
const updatedSettings = {
|
|
@@ -5207,10 +4975,10 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5207
4975
|
minimalistMode: newMinimalistMode
|
|
5208
4976
|
};
|
|
5209
4977
|
onUpdate(updatedSettings);
|
|
5210
|
-
} else if (
|
|
4978
|
+
} else if (shortcut === "n" || shortcut === "N") {
|
|
5211
4979
|
setNumberFormatMode(true);
|
|
5212
4980
|
setNumberFormatKindIndex(0);
|
|
5213
|
-
} else if (
|
|
4981
|
+
} else if (shortcut === "f" || shortcut === "F") {
|
|
5214
4982
|
const nextIndex = (currentFgIndex + 1) % fgColors.length;
|
|
5215
4983
|
const nextFgColor = fgColors[nextIndex];
|
|
5216
4984
|
const updatedSettings = {
|
|
@@ -5218,19 +4986,19 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5218
4986
|
overrideForegroundColor: nextFgColor === "none" ? undefined : nextFgColor
|
|
5219
4987
|
};
|
|
5220
4988
|
onUpdate(updatedSettings);
|
|
5221
|
-
} else if (
|
|
4989
|
+
} else if (shortcut === "g" || shortcut === "G") {
|
|
5222
4990
|
setGradientMode(true);
|
|
5223
4991
|
setGradientIndex(0);
|
|
5224
4992
|
setGradientCustomStep(null);
|
|
5225
4993
|
setGradientStartHex("");
|
|
5226
4994
|
setGradientHexInput("");
|
|
5227
|
-
} else if (
|
|
4995
|
+
} else if (shortcut === "x" || shortcut === "X") {
|
|
5228
4996
|
const updatedSettings = {
|
|
5229
4997
|
...settings,
|
|
5230
4998
|
overrideForegroundColor: undefined
|
|
5231
4999
|
};
|
|
5232
5000
|
onUpdate(updatedSettings);
|
|
5233
|
-
} else if (
|
|
5001
|
+
} else if (shortcut === "d" || shortcut === "D") {
|
|
5234
5002
|
const paddingSides = DefaultPaddingSideSchema.options;
|
|
5235
5003
|
const currentIndex = paddingSides.indexOf(settings.defaultPaddingSide);
|
|
5236
5004
|
const nextSide = paddingSides[(currentIndex + 1) % paddingSides.length] ?? "both";
|
|
@@ -5298,19 +5066,19 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5298
5066
|
children: [
|
|
5299
5067
|
/* @__PURE__ */ jsx_runtime7.jsx(Text, {
|
|
5300
5068
|
bold: true,
|
|
5301
|
-
children: "
|
|
5069
|
+
children: "自定义渐变 - 覆盖前景色"
|
|
5302
5070
|
}),
|
|
5303
5071
|
/* @__PURE__ */ jsx_runtime7.jsxs(Box_default, {
|
|
5304
5072
|
marginTop: 1,
|
|
5305
5073
|
flexDirection: "column",
|
|
5306
5074
|
children: [
|
|
5307
5075
|
/* @__PURE__ */ jsx_runtime7.jsx(Text, {
|
|
5308
|
-
children: gradientCustomStep === "start" ? "
|
|
5076
|
+
children: gradientCustomStep === "start" ? "输入起始颜色的十六进制值(不含 #):" : "输入结束颜色的十六进制值(不含 #):"
|
|
5309
5077
|
}),
|
|
5310
5078
|
gradientCustomStep === "end" && /* @__PURE__ */ jsx_runtime7.jsxs(Text, {
|
|
5311
5079
|
dimColor: true,
|
|
5312
5080
|
children: [
|
|
5313
|
-
"
|
|
5081
|
+
"起始颜色:#",
|
|
5314
5082
|
gradientStartHex
|
|
5315
5083
|
]
|
|
5316
5084
|
}),
|
|
@@ -5329,7 +5097,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5329
5097
|
}),
|
|
5330
5098
|
/* @__PURE__ */ jsx_runtime7.jsx(Text, {
|
|
5331
5099
|
dimColor: true,
|
|
5332
|
-
children: "
|
|
5100
|
+
children: "按 Enter 确认,ESC 返回"
|
|
5333
5101
|
})
|
|
5334
5102
|
]
|
|
5335
5103
|
})
|
|
@@ -5341,13 +5109,13 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5341
5109
|
children: [
|
|
5342
5110
|
/* @__PURE__ */ jsx_runtime7.jsx(Text, {
|
|
5343
5111
|
bold: true,
|
|
5344
|
-
children: "
|
|
5112
|
+
children: "选择渐变 - 覆盖前景色"
|
|
5345
5113
|
}),
|
|
5346
5114
|
/* @__PURE__ */ jsx_runtime7.jsx(Box_default, {
|
|
5347
5115
|
marginTop: 1,
|
|
5348
5116
|
children: /* @__PURE__ */ jsx_runtime7.jsx(Text, {
|
|
5349
5117
|
dimColor: true,
|
|
5350
|
-
children: "↑↓
|
|
5118
|
+
children: "↑↓ 选择,Enter 应用,ESC 取消"
|
|
5351
5119
|
})
|
|
5352
5120
|
}),
|
|
5353
5121
|
/* @__PURE__ */ jsx_runtime7.jsxs(Box_default, {
|
|
@@ -5363,7 +5131,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
5363
5131
|
/* @__PURE__ */ jsx_runtime7.jsxs(Text, {
|
|
5364
5132
|
children: [
|
|
5365
5133
|
gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
|
|
5366
|
-
"
|
|
5134
|
+
"自定义(输入起止颜色的十六进制值)"
|
|
5367
5135
|
]
|
|
5368
5136
|
}, "custom")
|
|
5369
5137
|
]
|
|
@@ -5721,6 +5489,7 @@ var HideStatesEditor = ({ widget, states, onComplete, onCancel }) => {
|
|
|
5721
5489
|
const [selectedIndex, setSelectedIndex] = import_react10.useState(0);
|
|
5722
5490
|
const [enabledKeys, setEnabledKeys] = import_react10.useState(() => getEnabledHideStates(widget, states));
|
|
5723
5491
|
use_input_default((input, key) => {
|
|
5492
|
+
const shortcut = getPlainInput(input, key);
|
|
5724
5493
|
if (key.return) {
|
|
5725
5494
|
onComplete(setEnabledHideStates(widget, states, enabledKeys));
|
|
5726
5495
|
} else if (key.escape) {
|
|
@@ -5729,7 +5498,7 @@ var HideStatesEditor = ({ widget, states, onComplete, onCancel }) => {
|
|
|
5729
5498
|
setSelectedIndex(selectedIndex - 1 < 0 ? states.length - 1 : selectedIndex - 1);
|
|
5730
5499
|
} else if (key.downArrow && states.length > 0) {
|
|
5731
5500
|
setSelectedIndex(selectedIndex + 1 > states.length - 1 ? 0 : selectedIndex + 1);
|
|
5732
|
-
} else if (
|
|
5501
|
+
} else if (shortcut === " ") {
|
|
5733
5502
|
const state = states[selectedIndex];
|
|
5734
5503
|
if (state) {
|
|
5735
5504
|
setEnabledKeys(enabledKeys.includes(state.key) ? enabledKeys.filter((enabledKey) => enabledKey !== state.key) : [...enabledKeys, state.key]);
|
|
@@ -5967,6 +5736,58 @@ var InstallMenu = ({
|
|
|
5967
5736
|
// src/tui/components/ItemsEditor.tsx
|
|
5968
5737
|
var import_react12 = __toESM(require_react(), 1);
|
|
5969
5738
|
|
|
5739
|
+
// src/tui/components/LabelEditor.tsx
|
|
5740
|
+
var jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
5741
|
+
var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel }) => {
|
|
5742
|
+
const { getText, display, handleInput } = useTextCursor(getLabel(widget, defaultLabel));
|
|
5743
|
+
use_input_default((input, key) => {
|
|
5744
|
+
if (key.return) {
|
|
5745
|
+
onComplete(setLabel(widget, getText()));
|
|
5746
|
+
} else if (key.escape) {
|
|
5747
|
+
onCancel();
|
|
5748
|
+
} else if (key.tab) {
|
|
5749
|
+
onComplete(clearLabel(widget));
|
|
5750
|
+
} else {
|
|
5751
|
+
handleInput(input, key);
|
|
5752
|
+
}
|
|
5753
|
+
});
|
|
5754
|
+
return /* @__PURE__ */ jsx_runtime10.jsxs(Box_default, {
|
|
5755
|
+
flexDirection: "column",
|
|
5756
|
+
children: [
|
|
5757
|
+
/* @__PURE__ */ jsx_runtime10.jsx(Text, {
|
|
5758
|
+
bold: true,
|
|
5759
|
+
children: "文字前缀"
|
|
5760
|
+
}),
|
|
5761
|
+
/* @__PURE__ */ jsx_runtime10.jsx(Text, {
|
|
5762
|
+
dimColor: true,
|
|
5763
|
+
children: "←→ 移动光标,Ctrl+←→ 跳到开头/末尾,Tab 恢复默认,Enter 保存,ESC 取消"
|
|
5764
|
+
}),
|
|
5765
|
+
/* @__PURE__ */ jsx_runtime10.jsx(Box_default, {
|
|
5766
|
+
marginTop: 1,
|
|
5767
|
+
children: /* @__PURE__ */ jsx_runtime10.jsxs(Text, {
|
|
5768
|
+
children: [
|
|
5769
|
+
`"${display}"`,
|
|
5770
|
+
/* @__PURE__ */ jsx_runtime10.jsx(Text, {
|
|
5771
|
+
dimColor: true,
|
|
5772
|
+
children: ` (默认: ${JSON.stringify(defaultLabel)})`
|
|
5773
|
+
})
|
|
5774
|
+
]
|
|
5775
|
+
})
|
|
5776
|
+
})
|
|
5777
|
+
]
|
|
5778
|
+
});
|
|
5779
|
+
};
|
|
5780
|
+
|
|
5781
|
+
// src/utils/move-item.ts
|
|
5782
|
+
function moveItem(items, fromIndex, toIndex) {
|
|
5783
|
+
const moved = [...items];
|
|
5784
|
+
const [item] = moved.splice(fromIndex, 1);
|
|
5785
|
+
if (item !== undefined) {
|
|
5786
|
+
moved.splice(toIndex, 0, item);
|
|
5787
|
+
}
|
|
5788
|
+
return moved;
|
|
5789
|
+
}
|
|
5790
|
+
|
|
5970
5791
|
// src/tui/components/items-editor/input-handlers.ts
|
|
5971
5792
|
function setPickerState(setWidgetPicker, normalizeState, updater) {
|
|
5972
5793
|
setWidgetPicker((prev) => {
|
|
@@ -6150,24 +5971,12 @@ function handleMoveInputMode({
|
|
|
6150
5971
|
setMoveMode
|
|
6151
5972
|
}) {
|
|
6152
5973
|
if (key.upArrow && widgets.length > 1) {
|
|
6153
|
-
const newWidgets = [...widgets];
|
|
6154
5974
|
const targetIndex = selectedIndex - 1 < 0 ? widgets.length - 1 : selectedIndex - 1;
|
|
6155
|
-
|
|
6156
|
-
const prev = newWidgets[targetIndex];
|
|
6157
|
-
if (temp && prev) {
|
|
6158
|
-
[newWidgets[selectedIndex], newWidgets[targetIndex]] = [prev, temp];
|
|
6159
|
-
}
|
|
6160
|
-
onUpdate(newWidgets);
|
|
5975
|
+
onUpdate(moveItem(widgets, selectedIndex, targetIndex));
|
|
6161
5976
|
setSelectedIndex(targetIndex);
|
|
6162
5977
|
} else if (key.downArrow && widgets.length > 1) {
|
|
6163
|
-
const newWidgets = [...widgets];
|
|
6164
5978
|
const targetIndex = selectedIndex + 1 > widgets.length - 1 ? 0 : selectedIndex + 1;
|
|
6165
|
-
|
|
6166
|
-
const next = newWidgets[targetIndex];
|
|
6167
|
-
if (temp && next) {
|
|
6168
|
-
[newWidgets[selectedIndex], newWidgets[targetIndex]] = [next, temp];
|
|
6169
|
-
}
|
|
6170
|
-
onUpdate(newWidgets);
|
|
5979
|
+
onUpdate(moveItem(widgets, selectedIndex, targetIndex));
|
|
6171
5980
|
setSelectedIndex(targetIndex);
|
|
6172
5981
|
} else if (key.escape || key.return) {
|
|
6173
5982
|
setMoveMode(false);
|
|
@@ -6190,6 +5999,7 @@ function handleNormalInputMode({
|
|
|
6190
5999
|
setCustomEditorWidget,
|
|
6191
6000
|
getUniqueBackgroundColor
|
|
6192
6001
|
}) {
|
|
6002
|
+
const shortcut = getPlainInput(input, key);
|
|
6193
6003
|
if (key.upArrow && widgets.length > 0) {
|
|
6194
6004
|
setSelectedIndex(selectedIndex - 1 < 0 ? widgets.length - 1 : selectedIndex - 1);
|
|
6195
6005
|
} else if (key.downArrow && widgets.length > 0) {
|
|
@@ -6200,17 +6010,17 @@ function handleNormalInputMode({
|
|
|
6200
6010
|
openWidgetPicker("change");
|
|
6201
6011
|
} else if (key.return && widgets.length > 0) {
|
|
6202
6012
|
setMoveMode(true);
|
|
6203
|
-
} else if (
|
|
6013
|
+
} else if (shortcut === "a") {
|
|
6204
6014
|
openWidgetPicker("add");
|
|
6205
|
-
} else if (
|
|
6015
|
+
} else if (shortcut === "i") {
|
|
6206
6016
|
openWidgetPicker("insert");
|
|
6207
|
-
} else if (
|
|
6017
|
+
} else if (shortcut === "d" && widgets.length > 0) {
|
|
6208
6018
|
const newWidgets = widgets.filter((_, i) => i !== selectedIndex);
|
|
6209
6019
|
onUpdate(newWidgets);
|
|
6210
6020
|
if (selectedIndex >= newWidgets.length && selectedIndex > 0) {
|
|
6211
6021
|
setSelectedIndex(selectedIndex - 1);
|
|
6212
6022
|
}
|
|
6213
|
-
} else if (
|
|
6023
|
+
} else if (shortcut === "k" && widgets.length > 0) {
|
|
6214
6024
|
const source = widgets[selectedIndex];
|
|
6215
6025
|
if (!source) {
|
|
6216
6026
|
return;
|
|
@@ -6230,11 +6040,11 @@ function handleNormalInputMode({
|
|
|
6230
6040
|
];
|
|
6231
6041
|
onUpdate(newWidgets);
|
|
6232
6042
|
setSelectedIndex(insertIndex);
|
|
6233
|
-
} else if (
|
|
6043
|
+
} else if (shortcut === "c") {
|
|
6234
6044
|
if (widgets.length > 0) {
|
|
6235
6045
|
setShowClearConfirm(true);
|
|
6236
6046
|
}
|
|
6237
|
-
} else if (
|
|
6047
|
+
} else if (shortcut === " " && widgets.length > 0) {
|
|
6238
6048
|
const currentWidget = widgets[selectedIndex];
|
|
6239
6049
|
if (currentWidget?.type === "separator") {
|
|
6240
6050
|
const currentChar = currentWidget.character ?? "|";
|
|
@@ -6244,7 +6054,7 @@ function handleNormalInputMode({
|
|
|
6244
6054
|
newWidgets[selectedIndex] = { ...currentWidget, character: nextChar };
|
|
6245
6055
|
onUpdate(newWidgets);
|
|
6246
6056
|
}
|
|
6247
|
-
} else if (
|
|
6057
|
+
} else if (shortcut === "r" && widgets.length > 0) {
|
|
6248
6058
|
const currentWidget = widgets[selectedIndex];
|
|
6249
6059
|
if (currentWidget && currentWidget.type !== "separator" && currentWidget.type !== "flex-separator") {
|
|
6250
6060
|
const widgetImpl = getWidget(currentWidget.type);
|
|
@@ -6255,14 +6065,15 @@ function handleNormalInputMode({
|
|
|
6255
6065
|
newWidgets[selectedIndex] = { ...currentWidget, rawValue: !currentWidget.rawValue };
|
|
6256
6066
|
onUpdate(newWidgets);
|
|
6257
6067
|
}
|
|
6258
|
-
} else if (
|
|
6068
|
+
} else if (shortcut === "m" && widgets.length > 0) {
|
|
6259
6069
|
const currentWidget = widgets[selectedIndex];
|
|
6260
|
-
|
|
6070
|
+
const isLastWidget = selectedIndex === widgets.length - 1;
|
|
6071
|
+
if (currentWidget && (!isLastWidget || currentWidget.merge) && currentWidget.type !== "separator" && currentWidget.type !== "flex-separator") {
|
|
6261
6072
|
const newWidgets = [...widgets];
|
|
6262
6073
|
let nextMergeState;
|
|
6263
6074
|
if (currentWidget.merge === undefined) {
|
|
6264
6075
|
nextMergeState = true;
|
|
6265
|
-
} else if (currentWidget.merge === true) {
|
|
6076
|
+
} else if (currentWidget.merge === true && !isLastWidget) {
|
|
6266
6077
|
nextMergeState = "no-padding";
|
|
6267
6078
|
} else {
|
|
6268
6079
|
nextMergeState = undefined;
|
|
@@ -6275,7 +6086,7 @@ function handleNormalInputMode({
|
|
|
6275
6086
|
}
|
|
6276
6087
|
onUpdate(newWidgets);
|
|
6277
6088
|
}
|
|
6278
|
-
} else if (
|
|
6089
|
+
} else if (shortcut === "x" && widgets.length > 0) {
|
|
6279
6090
|
const currentWidget = widgets[selectedIndex];
|
|
6280
6091
|
if (canExcludeAlign && currentWidget && currentWidget.type !== "separator" && currentWidget.type !== "flex-separator") {
|
|
6281
6092
|
const newWidgets = [...widgets];
|
|
@@ -6297,9 +6108,9 @@ function handleNormalInputMode({
|
|
|
6297
6108
|
return;
|
|
6298
6109
|
}
|
|
6299
6110
|
const customKeybinds = getCustomKeybindsForWidget(widgetImpl, currentWidget);
|
|
6300
|
-
const matchedKeybind = customKeybinds.find((kb) => kb.key ===
|
|
6301
|
-
if (matchedKeybind
|
|
6302
|
-
if (matchedKeybind.action === EDIT_HIDE_STATES_ACTION) {
|
|
6111
|
+
const matchedKeybind = customKeybinds.find((kb) => kb.key === shortcut);
|
|
6112
|
+
if (matchedKeybind) {
|
|
6113
|
+
if (matchedKeybind.action === EDIT_HIDE_STATES_ACTION || matchedKeybind.action === EDIT_LABEL_ACTION) {
|
|
6303
6114
|
setCustomEditorWidget({ widget: currentWidget, impl: widgetImpl, action: matchedKeybind.action });
|
|
6304
6115
|
return;
|
|
6305
6116
|
}
|
|
@@ -6325,7 +6136,7 @@ function handleNormalInputMode({
|
|
|
6325
6136
|
}
|
|
6326
6137
|
|
|
6327
6138
|
// src/tui/components/ItemsEditor.tsx
|
|
6328
|
-
var
|
|
6139
|
+
var jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
6329
6140
|
function isMergedIntoPreviousWidget(widgets, index) {
|
|
6330
6141
|
if (index <= 0) {
|
|
6331
6142
|
return false;
|
|
@@ -6374,6 +6185,9 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6374
6185
|
if ((widgetImpl.getHideableStates?.().length ?? 0) > 0) {
|
|
6375
6186
|
keybinds.push(getHideKeybind());
|
|
6376
6187
|
}
|
|
6188
|
+
if (widgetImpl.getLabelPrefix && !widget.rawValue) {
|
|
6189
|
+
keybinds.push(getLabelKeybind());
|
|
6190
|
+
}
|
|
6377
6191
|
return keybinds;
|
|
6378
6192
|
};
|
|
6379
6193
|
const openWidgetPicker = (action) => {
|
|
@@ -6399,7 +6213,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6399
6213
|
const currentWidget = widgets[selectedIndex];
|
|
6400
6214
|
if (currentWidget) {
|
|
6401
6215
|
const newWidgets = [...widgets];
|
|
6402
|
-
newWidgets[selectedIndex] = { ...currentWidget, type: selectedType };
|
|
6216
|
+
newWidgets[selectedIndex] = currentWidget.type === selectedType ? currentWidget : { ...clearLabel(currentWidget), type: selectedType };
|
|
6403
6217
|
onUpdate(newWidgets);
|
|
6404
6218
|
}
|
|
6405
6219
|
} else {
|
|
@@ -6431,7 +6245,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6431
6245
|
canToggleRaw = false;
|
|
6432
6246
|
}
|
|
6433
6247
|
}
|
|
6434
|
-
const canMerge = currentWidget && selectedIndex < widgets.length - 1 && !isSeparator && !isFlexSeparator;
|
|
6248
|
+
const canMerge = currentWidget && (selectedIndex < widgets.length - 1 || Boolean(currentWidget.merge)) && !isSeparator && !isFlexSeparator;
|
|
6435
6249
|
const canExcludeAlign = Boolean(currentWidget) && !isSeparator && !isFlexSeparator && settings.powerline.enabled && settings.powerline.autoAlign && !isMergedIntoPreviousWidget(widgets, selectedIndex);
|
|
6436
6250
|
const hasWidgets = widgets.length > 0;
|
|
6437
6251
|
use_input_default((input, key) => {
|
|
@@ -6526,13 +6340,21 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6526
6340
|
const customKeybindsText = customKeybinds.map((kb) => kb.label).join(", ");
|
|
6527
6341
|
const pickerActionLabel = widgetPicker?.action === "add" ? "添加组件" : widgetPicker?.action === "insert" ? "插入组件" : "更改组件类型";
|
|
6528
6342
|
if (customEditorWidget?.action === EDIT_HIDE_STATES_ACTION) {
|
|
6529
|
-
return /* @__PURE__ */
|
|
6343
|
+
return /* @__PURE__ */ jsx_runtime11.jsx(HideStatesEditor, {
|
|
6530
6344
|
widget: customEditorWidget.widget,
|
|
6531
6345
|
states: customEditorWidget.impl.getHideableStates?.() ?? [],
|
|
6532
6346
|
onComplete: handleEditorComplete,
|
|
6533
6347
|
onCancel: handleEditorCancel
|
|
6534
6348
|
});
|
|
6535
6349
|
}
|
|
6350
|
+
if (customEditorWidget?.action === EDIT_LABEL_ACTION && customEditorWidget.impl.getLabelPrefix) {
|
|
6351
|
+
return /* @__PURE__ */ jsx_runtime11.jsx(LabelEditor, {
|
|
6352
|
+
widget: customEditorWidget.widget,
|
|
6353
|
+
defaultLabel: customEditorWidget.impl.getLabelPrefix(customEditorWidget.widget),
|
|
6354
|
+
onComplete: handleEditorComplete,
|
|
6355
|
+
onCancel: handleEditorCancel
|
|
6356
|
+
});
|
|
6357
|
+
}
|
|
6536
6358
|
if (customEditorWidget?.impl.renderEditor) {
|
|
6537
6359
|
return customEditorWidget.impl.renderEditor({
|
|
6538
6360
|
widget: customEditorWidget.widget,
|
|
@@ -6542,19 +6364,19 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6542
6364
|
});
|
|
6543
6365
|
}
|
|
6544
6366
|
if (showClearConfirm) {
|
|
6545
|
-
return /* @__PURE__ */
|
|
6367
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6546
6368
|
flexDirection: "column",
|
|
6547
6369
|
children: [
|
|
6548
|
-
/* @__PURE__ */
|
|
6370
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6549
6371
|
bold: true,
|
|
6550
6372
|
color: "yellow",
|
|
6551
6373
|
children: "⚠ 确认清空行"
|
|
6552
6374
|
}),
|
|
6553
|
-
/* @__PURE__ */
|
|
6375
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6554
6376
|
marginTop: 1,
|
|
6555
6377
|
flexDirection: "column",
|
|
6556
6378
|
children: [
|
|
6557
|
-
/* @__PURE__ */
|
|
6379
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6558
6380
|
children: [
|
|
6559
6381
|
"这将移除第",
|
|
6560
6382
|
" ",
|
|
@@ -6563,21 +6385,21 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6563
6385
|
"行的所有组件。"
|
|
6564
6386
|
]
|
|
6565
6387
|
}),
|
|
6566
|
-
/* @__PURE__ */
|
|
6388
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6567
6389
|
color: "red",
|
|
6568
6390
|
children: "此操作不可撤销!"
|
|
6569
6391
|
})
|
|
6570
6392
|
]
|
|
6571
6393
|
}),
|
|
6572
|
-
/* @__PURE__ */
|
|
6394
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6573
6395
|
marginTop: 2,
|
|
6574
|
-
children: /* @__PURE__ */
|
|
6396
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6575
6397
|
children: "继续?"
|
|
6576
6398
|
})
|
|
6577
6399
|
}),
|
|
6578
|
-
/* @__PURE__ */
|
|
6400
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6579
6401
|
marginTop: 1,
|
|
6580
|
-
children: /* @__PURE__ */
|
|
6402
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(ConfirmDialog, {
|
|
6581
6403
|
inline: true,
|
|
6582
6404
|
onConfirm: () => {
|
|
6583
6405
|
onUpdate([]);
|
|
@@ -6592,12 +6414,12 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6592
6414
|
]
|
|
6593
6415
|
});
|
|
6594
6416
|
}
|
|
6595
|
-
return /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6596
6418
|
flexDirection: "column",
|
|
6597
6419
|
children: [
|
|
6598
|
-
/* @__PURE__ */
|
|
6420
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6599
6421
|
children: [
|
|
6600
|
-
/* @__PURE__ */
|
|
6422
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6601
6423
|
bold: true,
|
|
6602
6424
|
children: [
|
|
6603
6425
|
"编辑行",
|
|
@@ -6606,17 +6428,17 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6606
6428
|
" "
|
|
6607
6429
|
]
|
|
6608
6430
|
}),
|
|
6609
|
-
moveMode && /* @__PURE__ */
|
|
6431
|
+
moveMode && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6610
6432
|
color: "blue",
|
|
6611
6433
|
children: "[移动模式]"
|
|
6612
6434
|
}),
|
|
6613
|
-
widgetPicker && /* @__PURE__ */
|
|
6435
|
+
widgetPicker && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6614
6436
|
color: "cyan",
|
|
6615
6437
|
children: `[${pickerActionLabel}]`
|
|
6616
6438
|
}),
|
|
6617
|
-
(settings.powerline.enabled || Boolean(settings.defaultSeparator)) && /* @__PURE__ */
|
|
6439
|
+
(settings.powerline.enabled || Boolean(settings.defaultSeparator)) && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6618
6440
|
marginLeft: 2,
|
|
6619
|
-
children: /* @__PURE__ */
|
|
6441
|
+
children: /* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6620
6442
|
color: "yellow",
|
|
6621
6443
|
children: [
|
|
6622
6444
|
"⚠",
|
|
@@ -6627,46 +6449,46 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6627
6449
|
})
|
|
6628
6450
|
]
|
|
6629
6451
|
}),
|
|
6630
|
-
moveMode ? /* @__PURE__ */
|
|
6452
|
+
moveMode ? /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6631
6453
|
flexDirection: "column",
|
|
6632
6454
|
marginBottom: 1,
|
|
6633
|
-
children: /* @__PURE__ */
|
|
6455
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6634
6456
|
dimColor: true,
|
|
6635
6457
|
children: "↑↓ 移动组件,ESC 或 Enter 退出移动模式"
|
|
6636
6458
|
})
|
|
6637
|
-
}) : widgetPicker ? /* @__PURE__ */
|
|
6459
|
+
}) : widgetPicker ? /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6638
6460
|
flexDirection: "column",
|
|
6639
|
-
children: widgetPicker.level === "category" ? /* @__PURE__ */
|
|
6461
|
+
children: widgetPicker.level === "category" ? /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6640
6462
|
children: [
|
|
6641
|
-
widgetPicker.categoryQuery.trim().length > 0 ? /* @__PURE__ */
|
|
6463
|
+
widgetPicker.categoryQuery.trim().length > 0 ? /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6642
6464
|
dimColor: true,
|
|
6643
6465
|
children: "↑↓ 选择匹配组件,Enter 确认,ESC 清除/取消"
|
|
6644
|
-
}) : /* @__PURE__ */
|
|
6466
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6645
6467
|
dimColor: true,
|
|
6646
6468
|
children: "↑↓ 选择分类,输入搜索所有组件,Enter 继续,ESC 取消"
|
|
6647
6469
|
}),
|
|
6648
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6649
6471
|
children: [
|
|
6650
|
-
/* @__PURE__ */
|
|
6472
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6651
6473
|
dimColor: true,
|
|
6652
6474
|
children: "搜索: "
|
|
6653
6475
|
}),
|
|
6654
|
-
/* @__PURE__ */
|
|
6476
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6655
6477
|
color: "cyan",
|
|
6656
6478
|
children: widgetPicker.categoryQuery || "(无)"
|
|
6657
6479
|
})
|
|
6658
6480
|
]
|
|
6659
6481
|
})
|
|
6660
6482
|
]
|
|
6661
|
-
}) : /* @__PURE__ */
|
|
6483
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6662
6484
|
children: [
|
|
6663
|
-
/* @__PURE__ */
|
|
6485
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6664
6486
|
dimColor: true,
|
|
6665
6487
|
children: "↑↓ 选择组件,输入搜索,Enter 确认,ESC 返回"
|
|
6666
6488
|
}),
|
|
6667
|
-
/* @__PURE__ */
|
|
6489
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6668
6490
|
children: [
|
|
6669
|
-
/* @__PURE__ */
|
|
6491
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6670
6492
|
dimColor: true,
|
|
6671
6493
|
children: [
|
|
6672
6494
|
"分类:",
|
|
@@ -6677,7 +6499,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6677
6499
|
" "
|
|
6678
6500
|
]
|
|
6679
6501
|
}),
|
|
6680
|
-
/* @__PURE__ */
|
|
6502
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6681
6503
|
color: "cyan",
|
|
6682
6504
|
children: widgetPicker.widgetQuery || "(无)"
|
|
6683
6505
|
})
|
|
@@ -6685,59 +6507,59 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6685
6507
|
})
|
|
6686
6508
|
]
|
|
6687
6509
|
})
|
|
6688
|
-
}) : /* @__PURE__ */
|
|
6510
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6689
6511
|
flexDirection: "column",
|
|
6690
6512
|
children: [
|
|
6691
|
-
/* @__PURE__ */
|
|
6513
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6692
6514
|
dimColor: true,
|
|
6693
6515
|
children: helpText
|
|
6694
6516
|
}),
|
|
6695
|
-
/* @__PURE__ */
|
|
6517
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6696
6518
|
dimColor: true,
|
|
6697
6519
|
children: customKeybindsText || " "
|
|
6698
6520
|
})
|
|
6699
6521
|
]
|
|
6700
6522
|
}),
|
|
6701
|
-
hasFlexSeparator && !widthDetectionAvailable && /* @__PURE__ */
|
|
6523
|
+
hasFlexSeparator && !widthDetectionAvailable && /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6702
6524
|
marginTop: 1,
|
|
6703
6525
|
children: [
|
|
6704
|
-
/* @__PURE__ */
|
|
6526
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6705
6527
|
color: "yellow",
|
|
6706
6528
|
children: "⚠ 注意:当前环境无法检测终端宽度。"
|
|
6707
6529
|
}),
|
|
6708
|
-
/* @__PURE__ */
|
|
6530
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6709
6531
|
dimColor: true,
|
|
6710
6532
|
children: " 在宽度检测可用前,弹性分隔符将作为普通分隔符使用。"
|
|
6711
6533
|
})
|
|
6712
6534
|
]
|
|
6713
6535
|
}),
|
|
6714
|
-
widgetPicker && /* @__PURE__ */
|
|
6536
|
+
widgetPicker && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6715
6537
|
marginTop: 1,
|
|
6716
6538
|
flexDirection: "column",
|
|
6717
|
-
children: widgetPicker.level === "category" ? widgetPicker.categoryQuery.trim().length > 0 ? topLevelSearchEntries.length === 0 ? /* @__PURE__ */
|
|
6539
|
+
children: widgetPicker.level === "category" ? widgetPicker.categoryQuery.trim().length > 0 ? topLevelSearchEntries.length === 0 ? /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6718
6540
|
dimColor: true,
|
|
6719
6541
|
children: "没有匹配的组件。"
|
|
6720
|
-
}) : /* @__PURE__ */
|
|
6542
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6721
6543
|
children: [
|
|
6722
6544
|
topLevelSearchEntries.map((entry, index) => {
|
|
6723
6545
|
const isSelected = entry.type === selectedTopLevelSearchEntry?.type;
|
|
6724
6546
|
const segments = getMatchSegments(entry.displayName, widgetPicker.categoryQuery);
|
|
6725
|
-
return /* @__PURE__ */
|
|
6547
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6726
6548
|
flexDirection: "row",
|
|
6727
6549
|
flexWrap: "nowrap",
|
|
6728
6550
|
children: [
|
|
6729
|
-
/* @__PURE__ */
|
|
6551
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6730
6552
|
width: 3,
|
|
6731
|
-
children: /* @__PURE__ */
|
|
6553
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6732
6554
|
color: isSelected ? "green" : undefined,
|
|
6733
6555
|
children: isSelected ? "▶ " : " "
|
|
6734
6556
|
})
|
|
6735
6557
|
}),
|
|
6736
|
-
/* @__PURE__ */
|
|
6558
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6737
6559
|
color: isSelected ? "green" : undefined,
|
|
6738
6560
|
children: `${index + 1}. `
|
|
6739
6561
|
}),
|
|
6740
|
-
segments.map((seg, i) => /* @__PURE__ */
|
|
6562
|
+
segments.map((seg, i) => /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6741
6563
|
color: isSelected ? "green" : seg.matched ? "yellowBright" : undefined,
|
|
6742
6564
|
bold: isSelected ? true : seg.matched,
|
|
6743
6565
|
children: seg.text
|
|
@@ -6745,73 +6567,73 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6745
6567
|
]
|
|
6746
6568
|
}, entry.type);
|
|
6747
6569
|
}),
|
|
6748
|
-
selectedTopLevelSearchEntry && /* @__PURE__ */
|
|
6570
|
+
selectedTopLevelSearchEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6749
6571
|
marginTop: 1,
|
|
6750
6572
|
paddingLeft: 2,
|
|
6751
|
-
children: /* @__PURE__ */
|
|
6573
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6752
6574
|
dimColor: true,
|
|
6753
6575
|
children: selectedTopLevelSearchEntry.description
|
|
6754
6576
|
})
|
|
6755
6577
|
})
|
|
6756
6578
|
]
|
|
6757
|
-
}) : pickerCategories.length === 0 ? /* @__PURE__ */
|
|
6579
|
+
}) : pickerCategories.length === 0 ? /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6758
6580
|
dimColor: true,
|
|
6759
6581
|
children: "没有可用的分类。"
|
|
6760
|
-
}) : /* @__PURE__ */
|
|
6582
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6761
6583
|
children: [
|
|
6762
6584
|
pickerCategories.map((category, index) => {
|
|
6763
6585
|
const isSelected = category === selectedPickerCategory;
|
|
6764
|
-
return /* @__PURE__ */
|
|
6586
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6765
6587
|
flexDirection: "row",
|
|
6766
6588
|
flexWrap: "nowrap",
|
|
6767
6589
|
children: [
|
|
6768
|
-
/* @__PURE__ */
|
|
6590
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6769
6591
|
width: 3,
|
|
6770
|
-
children: /* @__PURE__ */
|
|
6592
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6771
6593
|
color: isSelected ? "green" : undefined,
|
|
6772
6594
|
children: isSelected ? "▶ " : " "
|
|
6773
6595
|
})
|
|
6774
6596
|
}),
|
|
6775
|
-
/* @__PURE__ */
|
|
6597
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6776
6598
|
color: isSelected ? "green" : undefined,
|
|
6777
6599
|
children: `${index + 1}. ${category}`
|
|
6778
6600
|
})
|
|
6779
6601
|
]
|
|
6780
6602
|
}, category);
|
|
6781
6603
|
}),
|
|
6782
|
-
selectedPickerCategory === "全部" && /* @__PURE__ */
|
|
6604
|
+
selectedPickerCategory === "全部" && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6783
6605
|
marginTop: 1,
|
|
6784
6606
|
paddingLeft: 2,
|
|
6785
|
-
children: /* @__PURE__ */
|
|
6607
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6786
6608
|
dimColor: true,
|
|
6787
6609
|
children: "搜索所有组件分类。"
|
|
6788
6610
|
})
|
|
6789
6611
|
})
|
|
6790
6612
|
]
|
|
6791
|
-
}) : pickerEntries.length === 0 ? /* @__PURE__ */
|
|
6613
|
+
}) : pickerEntries.length === 0 ? /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6792
6614
|
dimColor: true,
|
|
6793
6615
|
children: "没有匹配当前分类/搜索的组件。"
|
|
6794
|
-
}) : /* @__PURE__ */
|
|
6616
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6795
6617
|
children: [
|
|
6796
6618
|
pickerEntries.map((entry, index) => {
|
|
6797
6619
|
const isSelected = entry.type === selectedPickerEntry?.type;
|
|
6798
6620
|
const segments = getMatchSegments(entry.displayName, widgetPicker.widgetQuery);
|
|
6799
|
-
return /* @__PURE__ */
|
|
6621
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6800
6622
|
flexDirection: "row",
|
|
6801
6623
|
flexWrap: "nowrap",
|
|
6802
6624
|
children: [
|
|
6803
|
-
/* @__PURE__ */
|
|
6625
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6804
6626
|
width: 3,
|
|
6805
|
-
children: /* @__PURE__ */
|
|
6627
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6806
6628
|
color: isSelected ? "green" : undefined,
|
|
6807
6629
|
children: isSelected ? "▶ " : " "
|
|
6808
6630
|
})
|
|
6809
6631
|
}),
|
|
6810
|
-
/* @__PURE__ */
|
|
6632
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6811
6633
|
color: isSelected ? "green" : undefined,
|
|
6812
6634
|
children: `${index + 1}. `
|
|
6813
6635
|
}),
|
|
6814
|
-
segments.map((seg, i) => /* @__PURE__ */
|
|
6636
|
+
segments.map((seg, i) => /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6815
6637
|
color: isSelected ? "green" : seg.matched ? "yellowBright" : undefined,
|
|
6816
6638
|
bold: seg.matched,
|
|
6817
6639
|
children: seg.text
|
|
@@ -6819,10 +6641,10 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6819
6641
|
]
|
|
6820
6642
|
}, entry.type);
|
|
6821
6643
|
}),
|
|
6822
|
-
selectedPickerEntry && /* @__PURE__ */
|
|
6644
|
+
selectedPickerEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6823
6645
|
marginTop: 1,
|
|
6824
6646
|
paddingLeft: 2,
|
|
6825
|
-
children: /* @__PURE__ */
|
|
6647
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6826
6648
|
dimColor: true,
|
|
6827
6649
|
children: selectedPickerEntry.description
|
|
6828
6650
|
})
|
|
@@ -6830,13 +6652,13 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6830
6652
|
]
|
|
6831
6653
|
})
|
|
6832
6654
|
}),
|
|
6833
|
-
!widgetPicker && /* @__PURE__ */
|
|
6655
|
+
!widgetPicker && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6834
6656
|
marginTop: 1,
|
|
6835
6657
|
flexDirection: "column",
|
|
6836
|
-
children: widgets.length === 0 ? /* @__PURE__ */
|
|
6658
|
+
children: widgets.length === 0 ? /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6837
6659
|
dimColor: true,
|
|
6838
6660
|
children: "暂无组件。按 'a' 添加。"
|
|
6839
|
-
}) : /* @__PURE__ */
|
|
6661
|
+
}) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
|
|
6840
6662
|
children: [
|
|
6841
6663
|
widgets.map((widget, index) => {
|
|
6842
6664
|
const isSelected = index === selectedIndex;
|
|
@@ -6845,65 +6667,73 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6845
6667
|
const supportsRawValue = widgetImpl?.supportsRawValue() ?? false;
|
|
6846
6668
|
const numberFormatModifierText = widgetImpl?.supportsNumberFormat?.() ? getNumberFormatModifierText(widget) : undefined;
|
|
6847
6669
|
const hideModifierText = widgetImpl ? getHideModifierText(widget, widgetImpl.getHideableStates?.() ?? []) : undefined;
|
|
6848
|
-
|
|
6670
|
+
const labelModifierText = widgetImpl?.getLabelPrefix && !widget.rawValue ? getLabelModifierText(widget) : undefined;
|
|
6671
|
+
return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
|
|
6849
6672
|
flexDirection: "row",
|
|
6850
6673
|
flexWrap: "nowrap",
|
|
6851
6674
|
children: [
|
|
6852
|
-
/* @__PURE__ */
|
|
6675
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6853
6676
|
width: 3,
|
|
6854
|
-
children: /* @__PURE__ */
|
|
6677
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6855
6678
|
color: isSelected ? moveMode ? "blue" : "green" : undefined,
|
|
6856
6679
|
children: isSelected ? moveMode ? "◆ " : "▶ " : " "
|
|
6857
6680
|
})
|
|
6858
6681
|
}),
|
|
6859
|
-
/* @__PURE__ */
|
|
6682
|
+
/* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6860
6683
|
color: isSelected ? moveMode ? "blue" : "green" : undefined,
|
|
6861
6684
|
children: `${index + 1}. ${displayText || getWidgetDisplay(widget)}`
|
|
6862
6685
|
}),
|
|
6863
|
-
modifierText && /* @__PURE__ */
|
|
6686
|
+
modifierText && /* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6864
6687
|
dimColor: true,
|
|
6865
6688
|
children: [
|
|
6866
6689
|
" ",
|
|
6867
6690
|
modifierText
|
|
6868
6691
|
]
|
|
6869
6692
|
}),
|
|
6870
|
-
numberFormatModifierText && /* @__PURE__ */
|
|
6693
|
+
numberFormatModifierText && /* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6871
6694
|
dimColor: true,
|
|
6872
6695
|
children: [
|
|
6873
6696
|
" ",
|
|
6874
6697
|
numberFormatModifierText
|
|
6875
6698
|
]
|
|
6876
6699
|
}),
|
|
6877
|
-
hideModifierText && /* @__PURE__ */
|
|
6700
|
+
hideModifierText && /* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6878
6701
|
dimColor: true,
|
|
6879
6702
|
children: [
|
|
6880
6703
|
" ",
|
|
6881
6704
|
hideModifierText
|
|
6882
6705
|
]
|
|
6883
6706
|
}),
|
|
6884
|
-
|
|
6707
|
+
labelModifierText && /* @__PURE__ */ jsx_runtime11.jsxs(Text, {
|
|
6708
|
+
dimColor: true,
|
|
6709
|
+
children: [
|
|
6710
|
+
" ",
|
|
6711
|
+
labelModifierText
|
|
6712
|
+
]
|
|
6713
|
+
}),
|
|
6714
|
+
supportsRawValue && widget.rawValue && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6885
6715
|
dimColor: true,
|
|
6886
6716
|
children: " (纯值)"
|
|
6887
6717
|
}),
|
|
6888
|
-
widget.merge === true && /* @__PURE__ */
|
|
6718
|
+
widget.merge === true && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6889
6719
|
dimColor: true,
|
|
6890
|
-
children: " (
|
|
6720
|
+
children: " (merged→)"
|
|
6891
6721
|
}),
|
|
6892
|
-
widget.merge === "no-padding" && /* @__PURE__ */
|
|
6722
|
+
widget.merge === "no-padding" && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6893
6723
|
dimColor: true,
|
|
6894
|
-
children: " (
|
|
6724
|
+
children: " (merged-no-pad→)"
|
|
6895
6725
|
}),
|
|
6896
|
-
widget.excludeFromAutoAlign && settings.powerline.enabled && settings.powerline.autoAlign && !isMergedIntoPreviousWidget(widgets, index) && /* @__PURE__ */
|
|
6726
|
+
widget.excludeFromAutoAlign && settings.powerline.enabled && settings.powerline.autoAlign && !isMergedIntoPreviousWidget(widgets, index) && /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6897
6727
|
dimColor: true,
|
|
6898
|
-
children: " (
|
|
6728
|
+
children: " (no-align)"
|
|
6899
6729
|
})
|
|
6900
6730
|
]
|
|
6901
6731
|
}, widget.id);
|
|
6902
6732
|
}),
|
|
6903
|
-
currentWidget && /* @__PURE__ */
|
|
6733
|
+
currentWidget && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
|
|
6904
6734
|
marginTop: 1,
|
|
6905
6735
|
paddingLeft: 2,
|
|
6906
|
-
children: /* @__PURE__ */
|
|
6736
|
+
children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
|
|
6907
6737
|
dimColor: true,
|
|
6908
6738
|
children: (() => {
|
|
6909
6739
|
if (currentWidget.type === "separator") {
|
|
@@ -6924,9 +6754,8 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
6924
6754
|
});
|
|
6925
6755
|
};
|
|
6926
6756
|
// src/tui/components/LineSelector.tsx
|
|
6927
|
-
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
6928
6757
|
var import_react13 = __toESM(require_react(), 1);
|
|
6929
|
-
var
|
|
6758
|
+
var jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
6930
6759
|
var LineSelector = ({
|
|
6931
6760
|
lines,
|
|
6932
6761
|
onSelect,
|
|
@@ -6968,6 +6797,7 @@ var LineSelector = ({
|
|
|
6968
6797
|
const powerlineTheme = settings ? settings.powerline.theme : undefined;
|
|
6969
6798
|
const isThemeManaged = blockIfPowerlineActive && powerlineEnabled && powerlineTheme && powerlineTheme !== "custom";
|
|
6970
6799
|
use_input_default((input, key) => {
|
|
6800
|
+
const shortcut = getPlainInput(input, key);
|
|
6971
6801
|
if (showDeleteDialog) {
|
|
6972
6802
|
return;
|
|
6973
6803
|
}
|
|
@@ -6977,24 +6807,14 @@ var LineSelector = ({
|
|
|
6977
6807
|
}
|
|
6978
6808
|
if (moveMode) {
|
|
6979
6809
|
if (key.upArrow && localLines.length > 1) {
|
|
6980
|
-
const newLines = [...localLines];
|
|
6981
6810
|
const targetIndex = selectedIndex - 1 < 0 ? localLines.length - 1 : selectedIndex - 1;
|
|
6982
|
-
const
|
|
6983
|
-
const prev = newLines[targetIndex];
|
|
6984
|
-
if (temp && prev) {
|
|
6985
|
-
[newLines[selectedIndex], newLines[targetIndex]] = [prev, temp];
|
|
6986
|
-
}
|
|
6811
|
+
const newLines = moveItem(localLines, selectedIndex, targetIndex);
|
|
6987
6812
|
setLocalLines(newLines);
|
|
6988
6813
|
onLinesUpdate(newLines);
|
|
6989
6814
|
setSelectedIndex(targetIndex);
|
|
6990
6815
|
} else if (key.downArrow && localLines.length > 1) {
|
|
6991
|
-
const newLines = [...localLines];
|
|
6992
6816
|
const targetIndex = selectedIndex + 1 > localLines.length - 1 ? 0 : selectedIndex + 1;
|
|
6993
|
-
const
|
|
6994
|
-
const next = newLines[targetIndex];
|
|
6995
|
-
if (temp && next) {
|
|
6996
|
-
[newLines[selectedIndex], newLines[targetIndex]] = [next, temp];
|
|
6997
|
-
}
|
|
6817
|
+
const newLines = moveItem(localLines, selectedIndex, targetIndex);
|
|
6998
6818
|
setLocalLines(newLines);
|
|
6999
6819
|
onLinesUpdate(newLines);
|
|
7000
6820
|
setSelectedIndex(targetIndex);
|
|
@@ -7003,7 +6823,7 @@ var LineSelector = ({
|
|
|
7003
6823
|
}
|
|
7004
6824
|
return;
|
|
7005
6825
|
}
|
|
7006
|
-
switch (
|
|
6826
|
+
switch (shortcut) {
|
|
7007
6827
|
case "a":
|
|
7008
6828
|
if (allowEditing) {
|
|
7009
6829
|
appendLine();
|
|
@@ -7025,16 +6845,16 @@ var LineSelector = ({
|
|
|
7025
6845
|
}
|
|
7026
6846
|
});
|
|
7027
6847
|
if (isThemeManaged) {
|
|
7028
|
-
return /* @__PURE__ */
|
|
6848
|
+
return /* @__PURE__ */ jsx_runtime12.jsxs(Box_default, {
|
|
7029
6849
|
flexDirection: "column",
|
|
7030
6850
|
children: [
|
|
7031
|
-
/* @__PURE__ */
|
|
6851
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7032
6852
|
bold: true,
|
|
7033
6853
|
children: title ?? "选择行"
|
|
7034
6854
|
}),
|
|
7035
|
-
/* @__PURE__ */
|
|
6855
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7036
6856
|
marginTop: 1,
|
|
7037
|
-
children: /* @__PURE__ */
|
|
6857
|
+
children: /* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7038
6858
|
color: "yellow",
|
|
7039
6859
|
children: [
|
|
7040
6860
|
"⚠ 颜色当前由 Powerline 主题管理:",
|
|
@@ -7042,30 +6862,30 @@ var LineSelector = ({
|
|
|
7042
6862
|
]
|
|
7043
6863
|
})
|
|
7044
6864
|
}),
|
|
7045
|
-
/* @__PURE__ */
|
|
6865
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7046
6866
|
marginTop: 1,
|
|
7047
|
-
children: /* @__PURE__ */
|
|
6867
|
+
children: /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7048
6868
|
dimColor: true,
|
|
7049
6869
|
children: "要自定义颜色,可以:"
|
|
7050
6870
|
})
|
|
7051
6871
|
}),
|
|
7052
|
-
/* @__PURE__ */
|
|
6872
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7053
6873
|
marginLeft: 2,
|
|
7054
|
-
children: /* @__PURE__ */
|
|
6874
|
+
children: /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7055
6875
|
dimColor: true,
|
|
7056
6876
|
children: '• 在 Powerline 配置 → 主题中切换到"自定义"主题'
|
|
7057
6877
|
})
|
|
7058
6878
|
}),
|
|
7059
|
-
/* @__PURE__ */
|
|
6879
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7060
6880
|
marginLeft: 2,
|
|
7061
|
-
children: /* @__PURE__ */
|
|
6881
|
+
children: /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7062
6882
|
dimColor: true,
|
|
7063
6883
|
children: "• 在 Powerline 配置中禁用 Powerline 模式"
|
|
7064
6884
|
})
|
|
7065
6885
|
}),
|
|
7066
|
-
/* @__PURE__ */
|
|
6886
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7067
6887
|
marginTop: 2,
|
|
7068
|
-
children: /* @__PURE__ */
|
|
6888
|
+
children: /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7069
6889
|
children: "按任意键返回..."
|
|
7070
6890
|
})
|
|
7071
6891
|
})
|
|
@@ -7074,25 +6894,22 @@ var LineSelector = ({
|
|
|
7074
6894
|
}
|
|
7075
6895
|
if (showDeleteDialog && selectedLine) {
|
|
7076
6896
|
const suffix = selectedLine.length > 0 ? `${selectedLine.length} 个组件` : "空";
|
|
7077
|
-
return /* @__PURE__ */
|
|
6897
|
+
return /* @__PURE__ */ jsx_runtime12.jsxs(Box_default, {
|
|
7078
6898
|
flexDirection: "column",
|
|
7079
6899
|
children: [
|
|
7080
|
-
/* @__PURE__ */
|
|
6900
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Box_default, {
|
|
7081
6901
|
flexDirection: "column",
|
|
7082
6902
|
gap: 1,
|
|
7083
6903
|
children: [
|
|
7084
|
-
/* @__PURE__ */
|
|
6904
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7085
6905
|
bold: true,
|
|
7086
|
-
children: /* @__PURE__ */
|
|
6906
|
+
children: /* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7087
6907
|
children: [
|
|
7088
|
-
/* @__PURE__ */
|
|
7089
|
-
children:
|
|
7090
|
-
"☰ 第",
|
|
7091
|
-
selectedIndex + 1
|
|
7092
|
-
]
|
|
6908
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
6909
|
+
children: `☰ 第 ${selectedIndex + 1} 行`
|
|
7093
6910
|
}),
|
|
7094
6911
|
" ",
|
|
7095
|
-
/* @__PURE__ */
|
|
6912
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7096
6913
|
dimColor: true,
|
|
7097
6914
|
children: [
|
|
7098
6915
|
"(",
|
|
@@ -7103,15 +6920,15 @@ var LineSelector = ({
|
|
|
7103
6920
|
]
|
|
7104
6921
|
})
|
|
7105
6922
|
}),
|
|
7106
|
-
/* @__PURE__ */
|
|
6923
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7107
6924
|
bold: true,
|
|
7108
6925
|
children: "确定要删除此行吗?"
|
|
7109
6926
|
})
|
|
7110
6927
|
]
|
|
7111
6928
|
}),
|
|
7112
|
-
/* @__PURE__ */
|
|
6929
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7113
6930
|
marginTop: 1,
|
|
7114
|
-
children: /* @__PURE__ */
|
|
6931
|
+
children: /* @__PURE__ */ jsx_runtime12.jsx(ConfirmDialog, {
|
|
7115
6932
|
inline: true,
|
|
7116
6933
|
onConfirm: () => {
|
|
7117
6934
|
deleteLine(selectedIndex);
|
|
@@ -7131,60 +6948,56 @@ var LineSelector = ({
|
|
|
7131
6948
|
sublabel: `(${line.length > 0 ? `${line.length} 个组件` : "空"})`,
|
|
7132
6949
|
value: index
|
|
7133
6950
|
}));
|
|
7134
|
-
return /* @__PURE__ */
|
|
7135
|
-
children: /* @__PURE__ */
|
|
6951
|
+
return /* @__PURE__ */ jsx_runtime12.jsx(jsx_runtime12.Fragment, {
|
|
6952
|
+
children: /* @__PURE__ */ jsx_runtime12.jsxs(Box_default, {
|
|
7136
6953
|
flexDirection: "column",
|
|
7137
6954
|
children: [
|
|
7138
|
-
/* @__PURE__ */
|
|
6955
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Box_default, {
|
|
7139
6956
|
children: [
|
|
7140
|
-
/* @__PURE__ */
|
|
6957
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7141
6958
|
bold: true,
|
|
7142
6959
|
children: [
|
|
7143
6960
|
title ?? "选择要编辑的行",
|
|
7144
6961
|
" "
|
|
7145
6962
|
]
|
|
7146
6963
|
}),
|
|
7147
|
-
moveMode && /* @__PURE__ */
|
|
6964
|
+
moveMode && /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7148
6965
|
color: "blue",
|
|
7149
6966
|
children: "[移动模式]"
|
|
7150
6967
|
})
|
|
7151
6968
|
]
|
|
7152
6969
|
}),
|
|
7153
|
-
/* @__PURE__ */
|
|
6970
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7154
6971
|
dimColor: true,
|
|
7155
6972
|
children: "选择要配置的状态栏行"
|
|
7156
6973
|
}),
|
|
7157
|
-
moveMode ? /* @__PURE__ */
|
|
6974
|
+
moveMode ? /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7158
6975
|
dimColor: true,
|
|
7159
6976
|
children: "↑↓ 移动行,ESC 或 Enter 退出移动模式"
|
|
7160
|
-
}) : /* @__PURE__ */
|
|
6977
|
+
}) : /* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7161
6978
|
dimColor: true,
|
|
7162
6979
|
children: allowEditing ? localLines.length > 1 ? "(a) 添加新行,(d) 删除行,(m) 移动行,ESC 返回" : "(a) 添加新行,ESC 返回" : "ESC 返回"
|
|
7163
6980
|
}),
|
|
7164
|
-
moveMode ? /* @__PURE__ */
|
|
6981
|
+
moveMode ? /* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
7165
6982
|
marginTop: 1,
|
|
7166
6983
|
flexDirection: "column",
|
|
7167
6984
|
children: localLines.map((line, index) => {
|
|
7168
6985
|
const isSelected = selectedIndex === index;
|
|
7169
|
-
const suffix = line.length ?
|
|
7170
|
-
return /* @__PURE__ */
|
|
7171
|
-
children: /* @__PURE__ */
|
|
6986
|
+
const suffix = line.length ? `${line.length} 个组件` : "空";
|
|
6987
|
+
return /* @__PURE__ */ jsx_runtime12.jsx(Box_default, {
|
|
6988
|
+
children: /* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7172
6989
|
color: isSelected ? "blue" : undefined,
|
|
7173
6990
|
children: [
|
|
7174
|
-
/* @__PURE__ */
|
|
6991
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
7175
6992
|
children: isSelected ? "◆ " : " "
|
|
7176
6993
|
}),
|
|
7177
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7178
6995
|
children: [
|
|
7179
|
-
/* @__PURE__ */
|
|
7180
|
-
children:
|
|
7181
|
-
"☰ 第",
|
|
7182
|
-
" ",
|
|
7183
|
-
index + 1
|
|
7184
|
-
]
|
|
6996
|
+
/* @__PURE__ */ jsx_runtime12.jsx(Text, {
|
|
6997
|
+
children: `☰ 第 ${index + 1} 行`
|
|
7185
6998
|
}),
|
|
7186
6999
|
" ",
|
|
7187
|
-
/* @__PURE__ */
|
|
7000
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(Text, {
|
|
7188
7001
|
dimColor: !isSelected,
|
|
7189
7002
|
children: [
|
|
7190
7003
|
"(",
|
|
@@ -7198,7 +7011,7 @@ var LineSelector = ({
|
|
|
7198
7011
|
})
|
|
7199
7012
|
}, index);
|
|
7200
7013
|
})
|
|
7201
|
-
}) : /* @__PURE__ */
|
|
7014
|
+
}) : /* @__PURE__ */ jsx_runtime12.jsx(List, {
|
|
7202
7015
|
marginTop: 1,
|
|
7203
7016
|
items: lineItems,
|
|
7204
7017
|
onSelect: (line) => {
|
|
@@ -7219,7 +7032,7 @@ var LineSelector = ({
|
|
|
7219
7032
|
});
|
|
7220
7033
|
};
|
|
7221
7034
|
// src/tui/components/MainMenu.tsx
|
|
7222
|
-
var
|
|
7035
|
+
var jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
7223
7036
|
function usesManageInstallation(installation) {
|
|
7224
7037
|
return installation?.method === "pinned" || installation?.method === "self-managed";
|
|
7225
7038
|
}
|
|
@@ -7351,21 +7164,21 @@ var MainMenu = ({
|
|
|
7351
7164
|
}) => {
|
|
7352
7165
|
const menuItems = buildMainMenuItems(isClaudeInstalled, hasChanges, installation);
|
|
7353
7166
|
const showTruncationWarning = previewIsTruncated && settings?.flexMode === "full-minus-40";
|
|
7354
|
-
return /* @__PURE__ */
|
|
7167
|
+
return /* @__PURE__ */ jsx_runtime13.jsxs(Box_default, {
|
|
7355
7168
|
flexDirection: "column",
|
|
7356
7169
|
children: [
|
|
7357
|
-
showTruncationWarning && /* @__PURE__ */
|
|
7170
|
+
showTruncationWarning && /* @__PURE__ */ jsx_runtime13.jsx(Box_default, {
|
|
7358
7171
|
marginBottom: 1,
|
|
7359
|
-
children: /* @__PURE__ */
|
|
7172
|
+
children: /* @__PURE__ */ jsx_runtime13.jsx(Text, {
|
|
7360
7173
|
color: "yellow",
|
|
7361
7174
|
children: "⚠ 部分行被截断,请查看 终端选项 → 终端宽度 了解详情"
|
|
7362
7175
|
})
|
|
7363
7176
|
}),
|
|
7364
|
-
/* @__PURE__ */
|
|
7177
|
+
/* @__PURE__ */ jsx_runtime13.jsx(Text, {
|
|
7365
7178
|
bold: true,
|
|
7366
7179
|
children: "主菜单"
|
|
7367
7180
|
}),
|
|
7368
|
-
/* @__PURE__ */
|
|
7181
|
+
/* @__PURE__ */ jsx_runtime13.jsx(List, {
|
|
7369
7182
|
items: menuItems,
|
|
7370
7183
|
marginTop: 1,
|
|
7371
7184
|
onSelect: (value, index) => {
|
|
@@ -7380,7 +7193,7 @@ var MainMenu = ({
|
|
|
7380
7193
|
});
|
|
7381
7194
|
};
|
|
7382
7195
|
// src/tui/components/ManageInstallationMenu.tsx
|
|
7383
|
-
var
|
|
7196
|
+
var jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
7384
7197
|
function getInstallationLabel(installation) {
|
|
7385
7198
|
if (installation.method === "pinned") {
|
|
7386
7199
|
const version = installation.installedVersion ? ` ${installation.installedVersion}` : "";
|
|
@@ -7459,16 +7272,16 @@ var ManageInstallationMenu = ({
|
|
|
7459
7272
|
onBack();
|
|
7460
7273
|
}
|
|
7461
7274
|
});
|
|
7462
|
-
return /* @__PURE__ */
|
|
7275
|
+
return /* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
7463
7276
|
flexDirection: "column",
|
|
7464
7277
|
children: [
|
|
7465
|
-
/* @__PURE__ */
|
|
7278
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7466
7279
|
bold: true,
|
|
7467
|
-
children: "
|
|
7280
|
+
children: "管理安装"
|
|
7468
7281
|
}),
|
|
7469
|
-
/* @__PURE__ */
|
|
7282
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Box_default, {
|
|
7470
7283
|
marginTop: 1,
|
|
7471
|
-
children: /* @__PURE__ */
|
|
7284
|
+
children: /* @__PURE__ */ jsx_runtime14.jsxs(Text, {
|
|
7472
7285
|
children: [
|
|
7473
7286
|
"当前:",
|
|
7474
7287
|
" ",
|
|
@@ -7476,21 +7289,21 @@ var ManageInstallationMenu = ({
|
|
|
7476
7289
|
]
|
|
7477
7290
|
})
|
|
7478
7291
|
}),
|
|
7479
|
-
activeCommandLabel && /* @__PURE__ */
|
|
7480
|
-
children: /* @__PURE__ */
|
|
7292
|
+
activeCommandLabel && /* @__PURE__ */ jsx_runtime14.jsx(Box_default, {
|
|
7293
|
+
children: /* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7481
7294
|
dimColor: true,
|
|
7482
7295
|
children: activeCommandLabel
|
|
7483
7296
|
})
|
|
7484
7297
|
}),
|
|
7485
|
-
activeCommand?.warning && /* @__PURE__ */
|
|
7298
|
+
activeCommand?.warning && /* @__PURE__ */ jsx_runtime14.jsx(Box_default, {
|
|
7486
7299
|
marginTop: 1,
|
|
7487
|
-
children: /* @__PURE__ */
|
|
7300
|
+
children: /* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7488
7301
|
color: "yellow",
|
|
7489
7302
|
wrap: "wrap",
|
|
7490
7303
|
children: activeCommand.warning
|
|
7491
7304
|
})
|
|
7492
7305
|
}),
|
|
7493
|
-
/* @__PURE__ */
|
|
7306
|
+
/* @__PURE__ */ jsx_runtime14.jsx(List, {
|
|
7494
7307
|
marginTop: 1,
|
|
7495
7308
|
items: buildManageInstallationItems(),
|
|
7496
7309
|
onSelect: (value) => {
|
|
@@ -7517,28 +7330,28 @@ var UninstallMenu = ({
|
|
|
7517
7330
|
onBack();
|
|
7518
7331
|
}
|
|
7519
7332
|
});
|
|
7520
|
-
return /* @__PURE__ */
|
|
7333
|
+
return /* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
7521
7334
|
flexDirection: "column",
|
|
7522
7335
|
children: [
|
|
7523
|
-
/* @__PURE__ */
|
|
7336
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7524
7337
|
bold: true,
|
|
7525
7338
|
children: "卸载 ccstatusline-zh"
|
|
7526
7339
|
}),
|
|
7527
|
-
/* @__PURE__ */
|
|
7340
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Box_default, {
|
|
7528
7341
|
marginTop: 1,
|
|
7529
|
-
children: /* @__PURE__ */
|
|
7342
|
+
children: /* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7530
7343
|
dimColor: true,
|
|
7531
7344
|
children: "请选择要从本机移除的内容。"
|
|
7532
7345
|
})
|
|
7533
7346
|
}),
|
|
7534
|
-
detectedManagers.length === 0 && /* @__PURE__ */
|
|
7347
|
+
detectedManagers.length === 0 && /* @__PURE__ */ jsx_runtime14.jsx(Box_default, {
|
|
7535
7348
|
marginTop: 1,
|
|
7536
|
-
children: /* @__PURE__ */
|
|
7349
|
+
children: /* @__PURE__ */ jsx_runtime14.jsx(Text, {
|
|
7537
7350
|
dimColor: true,
|
|
7538
7351
|
children: "未检测到全局 npm 或 bun ccstatusline-zh 包。"
|
|
7539
7352
|
})
|
|
7540
7353
|
}),
|
|
7541
|
-
/* @__PURE__ */
|
|
7354
|
+
/* @__PURE__ */ jsx_runtime14.jsx(List, {
|
|
7542
7355
|
marginTop: 1,
|
|
7543
7356
|
items,
|
|
7544
7357
|
onSelect: (value) => {
|
|
@@ -7555,7 +7368,7 @@ var UninstallMenu = ({
|
|
|
7555
7368
|
};
|
|
7556
7369
|
// src/tui/components/PowerlineSetup.tsx
|
|
7557
7370
|
var import_react16 = __toESM(require_react(), 1);
|
|
7558
|
-
import * as os5 from "os";
|
|
7371
|
+
import * as os5 from "node:os";
|
|
7559
7372
|
|
|
7560
7373
|
// src/utils/powerline-settings.ts
|
|
7561
7374
|
function resolveEnabledPowerlineTheme(theme) {
|
|
@@ -7583,7 +7396,7 @@ function buildEnabledPowerlineSettings(settings, removeManualSeparators) {
|
|
|
7583
7396
|
|
|
7584
7397
|
// src/tui/components/PowerlineSeparatorEditor.tsx
|
|
7585
7398
|
var import_react14 = __toESM(require_react(), 1);
|
|
7586
|
-
var
|
|
7399
|
+
var jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
|
|
7587
7400
|
var PowerlineSeparatorEditor = ({
|
|
7588
7401
|
settings,
|
|
7589
7402
|
mode,
|
|
@@ -7602,7 +7415,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7602
7415
|
}
|
|
7603
7416
|
};
|
|
7604
7417
|
const separators = getItems();
|
|
7605
|
-
const invertBgs = mode === "separator" ? powerlineConfig.separatorInvertBackground : [];
|
|
7418
|
+
const invertBgs = mode === "separator" ? separators.map((_, i) => powerlineConfig.separatorInvertBackground[i] ?? false) : [];
|
|
7606
7419
|
const [selectedIndex, setSelectedIndex] = import_react14.useState(0);
|
|
7607
7420
|
const [hexInputMode, setHexInputMode] = import_react14.useState(false);
|
|
7608
7421
|
const [hexInput, setHexInput] = import_react14.useState("");
|
|
@@ -7641,7 +7454,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7641
7454
|
}
|
|
7642
7455
|
const codePoint = char.codePointAt(0) ?? 0;
|
|
7643
7456
|
const hexCode = codePoint.toString(16).toUpperCase().padStart(4, "0");
|
|
7644
|
-
return `${char} -
|
|
7457
|
+
return `${char} - 自定义 (U+${hexCode})${invertBg ? " [反转]" : ""}`;
|
|
7645
7458
|
};
|
|
7646
7459
|
const updateSeparators = (newSeparators, newInvertBgs) => {
|
|
7647
7460
|
const updatedPowerline = { ...powerlineConfig };
|
|
@@ -7663,6 +7476,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7663
7476
|
});
|
|
7664
7477
|
};
|
|
7665
7478
|
use_input_default((input, key) => {
|
|
7479
|
+
const shortcut = getPlainInput(input, key);
|
|
7666
7480
|
if (hexInputMode) {
|
|
7667
7481
|
if (key.escape) {
|
|
7668
7482
|
setHexInputMode(false);
|
|
@@ -7670,7 +7484,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7670
7484
|
setCursorPos(0);
|
|
7671
7485
|
} else if (key.return) {
|
|
7672
7486
|
if (hexInput.length >= 4 && hexInput.length <= 6) {
|
|
7673
|
-
const codePoint = parseInt(hexInput, 16);
|
|
7487
|
+
const codePoint = Number.parseInt(hexInput, 16);
|
|
7674
7488
|
if (codePoint >= 0 && codePoint <= 1114111) {
|
|
7675
7489
|
const char = String.fromCodePoint(codePoint);
|
|
7676
7490
|
const newSeparators = [...separators];
|
|
@@ -7725,7 +7539,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7725
7539
|
newInvertBgs[selectedIndex] = isLeftFacing;
|
|
7726
7540
|
}
|
|
7727
7541
|
updateSeparators(newSeparators, mode === "separator" ? newInvertBgs : undefined);
|
|
7728
|
-
} else if (
|
|
7542
|
+
} else if (shortcut === "a" || shortcut === "A") {
|
|
7729
7543
|
const newSeparators = [...separators];
|
|
7730
7544
|
const newInvertBgs = mode === "separator" ? [...invertBgs] : [];
|
|
7731
7545
|
const defaultChar = presetSeparators[0]?.char ?? "";
|
|
@@ -7745,7 +7559,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7745
7559
|
updateSeparators(newSeparators, newInvertBgs);
|
|
7746
7560
|
setSelectedIndex(selectedIndex + 1);
|
|
7747
7561
|
}
|
|
7748
|
-
} else if (
|
|
7562
|
+
} else if (shortcut === "i" || shortcut === "I") {
|
|
7749
7563
|
const newSeparators = [...separators];
|
|
7750
7564
|
const newInvertBgs = mode === "separator" ? [...invertBgs] : [];
|
|
7751
7565
|
const defaultChar = presetSeparators[0]?.char ?? "";
|
|
@@ -7764,23 +7578,23 @@ var PowerlineSeparatorEditor = ({
|
|
|
7764
7578
|
}
|
|
7765
7579
|
updateSeparators(newSeparators, newInvertBgs);
|
|
7766
7580
|
}
|
|
7767
|
-
} else if ((
|
|
7581
|
+
} else if ((shortcut === "d" || shortcut === "D") && (mode !== "separator" || separators.length > 1)) {
|
|
7768
7582
|
const newSeparators = separators.filter((_, i) => i !== selectedIndex);
|
|
7769
7583
|
const newInvertBgs = mode === "separator" ? invertBgs.filter((_, i) => i !== selectedIndex) : [];
|
|
7770
7584
|
updateSeparators(newSeparators, newInvertBgs);
|
|
7771
7585
|
setSelectedIndex(Math.min(selectedIndex, Math.max(0, newSeparators.length - 1)));
|
|
7772
|
-
} else if (
|
|
7586
|
+
} else if (shortcut === "c" || shortcut === "C") {
|
|
7773
7587
|
if (mode === "separator") {
|
|
7774
7588
|
updateSeparators([""], [false]);
|
|
7775
7589
|
} else {
|
|
7776
7590
|
updateSeparators([]);
|
|
7777
7591
|
}
|
|
7778
7592
|
setSelectedIndex(0);
|
|
7779
|
-
} else if (
|
|
7593
|
+
} else if (shortcut === "h" || shortcut === "H") {
|
|
7780
7594
|
setHexInputMode(true);
|
|
7781
7595
|
setHexInput("");
|
|
7782
7596
|
setCursorPos(0);
|
|
7783
|
-
} else if ((
|
|
7597
|
+
} else if ((shortcut === "t" || shortcut === "T") && mode === "separator") {
|
|
7784
7598
|
const newInvertBgs = [...invertBgs];
|
|
7785
7599
|
newInvertBgs[selectedIndex] = !(newInvertBgs[selectedIndex] ?? false);
|
|
7786
7600
|
updateSeparators(separators, newInvertBgs);
|
|
@@ -7798,18 +7612,18 @@ var PowerlineSeparatorEditor = ({
|
|
|
7798
7612
|
}
|
|
7799
7613
|
};
|
|
7800
7614
|
const canDelete = mode !== "separator" || separators.length > 1;
|
|
7801
|
-
return /* @__PURE__ */
|
|
7615
|
+
return /* @__PURE__ */ jsx_runtime15.jsxs(Box_default, {
|
|
7802
7616
|
flexDirection: "column",
|
|
7803
7617
|
children: [
|
|
7804
|
-
/* @__PURE__ */
|
|
7618
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7805
7619
|
bold: true,
|
|
7806
7620
|
children: getTitle()
|
|
7807
7621
|
}),
|
|
7808
|
-
hexInputMode ? /* @__PURE__ */
|
|
7622
|
+
hexInputMode ? /* @__PURE__ */ jsx_runtime15.jsxs(Box_default, {
|
|
7809
7623
|
marginTop: 2,
|
|
7810
7624
|
flexDirection: "column",
|
|
7811
7625
|
children: [
|
|
7812
|
-
/* @__PURE__ */
|
|
7626
|
+
/* @__PURE__ */ jsx_runtime15.jsxs(Text, {
|
|
7813
7627
|
children: [
|
|
7814
7628
|
"输入十六进制代码(4-6 位)用于",
|
|
7815
7629
|
" ",
|
|
@@ -7818,51 +7632,51 @@ var PowerlineSeparatorEditor = ({
|
|
|
7818
7632
|
":"
|
|
7819
7633
|
]
|
|
7820
7634
|
}),
|
|
7821
|
-
/* @__PURE__ */
|
|
7635
|
+
/* @__PURE__ */ jsx_runtime15.jsxs(Text, {
|
|
7822
7636
|
children: [
|
|
7823
7637
|
"U+",
|
|
7824
7638
|
hexInput.slice(0, cursorPos),
|
|
7825
|
-
/* @__PURE__ */
|
|
7639
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7826
7640
|
backgroundColor: "gray",
|
|
7827
7641
|
color: "black",
|
|
7828
7642
|
children: hexInput[cursorPos] ?? "_"
|
|
7829
7643
|
}),
|
|
7830
7644
|
hexInput.slice(cursorPos + 1),
|
|
7831
|
-
hexInput.length < 6 && hexInput.length === cursorPos && /* @__PURE__ */
|
|
7645
|
+
hexInput.length < 6 && hexInput.length === cursorPos && /* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7832
7646
|
dimColor: true,
|
|
7833
7647
|
children: "_".repeat(6 - hexInput.length - 1)
|
|
7834
7648
|
})
|
|
7835
7649
|
]
|
|
7836
7650
|
}),
|
|
7837
|
-
/* @__PURE__ */
|
|
7651
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7838
7652
|
dimColor: true,
|
|
7839
7653
|
children: "输入 4-6 位十六进制数字(0-9, A-F)表示 Unicode 码点,然后按 Enter 确认。ESC 取消。"
|
|
7840
7654
|
}),
|
|
7841
|
-
/* @__PURE__ */
|
|
7655
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7842
7656
|
dimColor: true,
|
|
7843
7657
|
children: "示例:E0B0(Powerline)、1F984(\uD83E\uDD84)、2764(❤)"
|
|
7844
7658
|
})
|
|
7845
7659
|
]
|
|
7846
|
-
}) : /* @__PURE__ */
|
|
7660
|
+
}) : /* @__PURE__ */ jsx_runtime15.jsxs(jsx_runtime15.Fragment, {
|
|
7847
7661
|
children: [
|
|
7848
|
-
/* @__PURE__ */
|
|
7849
|
-
children: /* @__PURE__ */
|
|
7662
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Box_default, {
|
|
7663
|
+
children: /* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7850
7664
|
dimColor: true,
|
|
7851
7665
|
children: `↑↓ 选择,← → 切换,(a)添加,(i)插入${canDelete ? ",(d)删除" : ""},(c)清除,(h)十六进制${mode === "separator" ? ",(t)反转切换" : ""},ESC 返回`
|
|
7852
7666
|
})
|
|
7853
7667
|
}),
|
|
7854
|
-
/* @__PURE__ */
|
|
7668
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Box_default, {
|
|
7855
7669
|
marginTop: 2,
|
|
7856
7670
|
flexDirection: "column",
|
|
7857
|
-
children: separators.length > 0 ? separators.map((sep, index) => /* @__PURE__ */
|
|
7858
|
-
children: /* @__PURE__ */
|
|
7671
|
+
children: separators.length > 0 ? separators.map((sep, index) => /* @__PURE__ */ jsx_runtime15.jsx(Box_default, {
|
|
7672
|
+
children: /* @__PURE__ */ jsx_runtime15.jsxs(Text, {
|
|
7859
7673
|
color: index === selectedIndex ? "green" : undefined,
|
|
7860
7674
|
children: [
|
|
7861
7675
|
index === selectedIndex ? "▶ " : " ",
|
|
7862
7676
|
`${index + 1}: ${getSeparatorDisplay(sep, index)}`
|
|
7863
7677
|
]
|
|
7864
7678
|
})
|
|
7865
|
-
}, index)) : /* @__PURE__ */
|
|
7679
|
+
}, index)) : /* @__PURE__ */ jsx_runtime15.jsx(Text, {
|
|
7866
7680
|
dimColor: true,
|
|
7867
7681
|
children: "(未配置 - 按 'a' 添加)"
|
|
7868
7682
|
})
|
|
@@ -7875,7 +7689,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
7875
7689
|
|
|
7876
7690
|
// src/tui/components/PowerlineThemeSelector.tsx
|
|
7877
7691
|
var import_react15 = __toESM(require_react(), 1);
|
|
7878
|
-
var
|
|
7692
|
+
var jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
|
|
7879
7693
|
function buildPowerlineThemeItems(themes, originalTheme) {
|
|
7880
7694
|
return themes.map((themeName) => {
|
|
7881
7695
|
const theme = getPowerlineTheme(themeName);
|
|
@@ -7898,15 +7712,17 @@ function applyCustomPowerlineTheme(settings, themeName) {
|
|
|
7898
7712
|
if (!themeColors) {
|
|
7899
7713
|
return null;
|
|
7900
7714
|
}
|
|
7715
|
+
let nextLineSlot = 0;
|
|
7901
7716
|
const lines = settings.lines.map((line) => {
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7717
|
+
const { slots, nextSlot } = assignPowerlineThemeSlots(line, settings.powerline.continueThemeAcrossLines ? nextLineSlot : 0);
|
|
7718
|
+
nextLineSlot = nextSlot;
|
|
7719
|
+
return line.map((widget, index) => {
|
|
7720
|
+
const slot = slots[index];
|
|
7721
|
+
if (typeof slot !== "number") {
|
|
7905
7722
|
return widget;
|
|
7906
7723
|
}
|
|
7907
|
-
const fgColor = themeColors.fg[
|
|
7908
|
-
const bgColor = themeColors.bg[
|
|
7909
|
-
widgetColorIndex++;
|
|
7724
|
+
const fgColor = themeColors.fg[slot % themeColors.fg.length];
|
|
7725
|
+
const bgColor = themeColors.bg[slot % themeColors.bg.length];
|
|
7910
7726
|
return {
|
|
7911
7727
|
...widget,
|
|
7912
7728
|
color: fgColor,
|
|
@@ -7959,13 +7775,14 @@ var PowerlineThemeSelector = ({
|
|
|
7959
7775
|
});
|
|
7960
7776
|
}, [selectedIndex, themes]);
|
|
7961
7777
|
use_input_default((input, key) => {
|
|
7778
|
+
const shortcut = getPlainInput(input, key);
|
|
7962
7779
|
if (showCustomizeConfirm) {
|
|
7963
7780
|
return;
|
|
7964
7781
|
}
|
|
7965
7782
|
if (key.escape) {
|
|
7966
7783
|
onUpdate(originalSettingsRef.current);
|
|
7967
7784
|
onBack();
|
|
7968
|
-
} else if (
|
|
7785
|
+
} else if (shortcut === "c" || shortcut === "C") {
|
|
7969
7786
|
const currentThemeName = themes[selectedIndex];
|
|
7970
7787
|
if (currentThemeName && currentThemeName !== "custom") {
|
|
7971
7788
|
setShowCustomizeConfirm(true);
|
|
@@ -7975,39 +7792,39 @@ var PowerlineThemeSelector = ({
|
|
|
7975
7792
|
const selectedThemeName = themes[selectedIndex];
|
|
7976
7793
|
const themeItems = import_react15.useMemo(() => buildPowerlineThemeItems(themes, originalThemeRef.current), [themes]);
|
|
7977
7794
|
if (showCustomizeConfirm) {
|
|
7978
|
-
return /* @__PURE__ */
|
|
7795
|
+
return /* @__PURE__ */ jsx_runtime16.jsxs(Box_default, {
|
|
7979
7796
|
flexDirection: "column",
|
|
7980
7797
|
children: [
|
|
7981
|
-
/* @__PURE__ */
|
|
7798
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
7982
7799
|
bold: true,
|
|
7983
7800
|
color: "yellow",
|
|
7984
7801
|
children: "⚠ 确认自定义"
|
|
7985
7802
|
}),
|
|
7986
|
-
/* @__PURE__ */
|
|
7803
|
+
/* @__PURE__ */ jsx_runtime16.jsxs(Box_default, {
|
|
7987
7804
|
marginTop: 1,
|
|
7988
7805
|
flexDirection: "column",
|
|
7989
7806
|
children: [
|
|
7990
|
-
/* @__PURE__ */
|
|
7807
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
7991
7808
|
children: "这将把当前主题颜色复制到你的组件中"
|
|
7992
7809
|
}),
|
|
7993
|
-
/* @__PURE__ */
|
|
7810
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
7994
7811
|
children: "并切换到自定义主题模式。"
|
|
7995
7812
|
}),
|
|
7996
|
-
/* @__PURE__ */
|
|
7813
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
7997
7814
|
color: "red",
|
|
7998
7815
|
children: "这将覆盖所有现有的自定义颜色!"
|
|
7999
7816
|
})
|
|
8000
7817
|
]
|
|
8001
7818
|
}),
|
|
8002
|
-
/* @__PURE__ */
|
|
7819
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Box_default, {
|
|
8003
7820
|
marginTop: 2,
|
|
8004
|
-
children: /* @__PURE__ */
|
|
7821
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
8005
7822
|
children: "是否继续?"
|
|
8006
7823
|
})
|
|
8007
7824
|
}),
|
|
8008
|
-
/* @__PURE__ */
|
|
7825
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Box_default, {
|
|
8009
7826
|
marginTop: 1,
|
|
8010
|
-
children: /* @__PURE__ */
|
|
7827
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx(ConfirmDialog, {
|
|
8011
7828
|
inline: true,
|
|
8012
7829
|
onConfirm: () => {
|
|
8013
7830
|
if (selectedThemeName) {
|
|
@@ -8027,26 +7844,26 @@ var PowerlineThemeSelector = ({
|
|
|
8027
7844
|
]
|
|
8028
7845
|
});
|
|
8029
7846
|
}
|
|
8030
|
-
return /* @__PURE__ */
|
|
7847
|
+
return /* @__PURE__ */ jsx_runtime16.jsxs(Box_default, {
|
|
8031
7848
|
flexDirection: "column",
|
|
8032
7849
|
children: [
|
|
8033
|
-
/* @__PURE__ */
|
|
7850
|
+
/* @__PURE__ */ jsx_runtime16.jsxs(Text, {
|
|
8034
7851
|
bold: true,
|
|
8035
7852
|
children: [
|
|
8036
7853
|
`Powerline 主题选择 | `,
|
|
8037
|
-
/* @__PURE__ */
|
|
7854
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
8038
7855
|
dimColor: true,
|
|
8039
7856
|
children: `原始: ${originalThemeRef.current}`
|
|
8040
7857
|
})
|
|
8041
7858
|
]
|
|
8042
7859
|
}),
|
|
8043
|
-
/* @__PURE__ */
|
|
8044
|
-
children: /* @__PURE__ */
|
|
7860
|
+
/* @__PURE__ */ jsx_runtime16.jsx(Box_default, {
|
|
7861
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
8045
7862
|
dimColor: true,
|
|
8046
7863
|
children: `↑↓ 选择,Enter 应用${selectedThemeName && selectedThemeName !== "custom" ? ",(c)自定义主题" : ""},ESC 取消`
|
|
8047
7864
|
})
|
|
8048
7865
|
}),
|
|
8049
|
-
/* @__PURE__ */
|
|
7866
|
+
/* @__PURE__ */ jsx_runtime16.jsx(List, {
|
|
8050
7867
|
marginTop: 1,
|
|
8051
7868
|
items: themeItems,
|
|
8052
7869
|
onSelect: () => {
|
|
@@ -8060,16 +7877,16 @@ var PowerlineThemeSelector = ({
|
|
|
8060
7877
|
},
|
|
8061
7878
|
initialSelection: selectedIndex
|
|
8062
7879
|
}),
|
|
8063
|
-
selectedThemeName && selectedThemeName !== "custom" && /* @__PURE__ */
|
|
7880
|
+
selectedThemeName && selectedThemeName !== "custom" && /* @__PURE__ */ jsx_runtime16.jsx(Box_default, {
|
|
8064
7881
|
marginTop: 1,
|
|
8065
|
-
children: /* @__PURE__ */
|
|
7882
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
8066
7883
|
dimColor: true,
|
|
8067
7884
|
children: "按 (c) 自定义此主题 - 将颜色复制到组件"
|
|
8068
7885
|
})
|
|
8069
7886
|
}),
|
|
8070
|
-
settings.colorLevel === 1 && /* @__PURE__ */
|
|
7887
|
+
settings.colorLevel === 1 && /* @__PURE__ */ jsx_runtime16.jsx(Box_default, {
|
|
8071
7888
|
marginTop: 1,
|
|
8072
|
-
children: /* @__PURE__ */
|
|
7889
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx(Text, {
|
|
8073
7890
|
color: "yellow",
|
|
8074
7891
|
children: "⚠ 16 色模式的主题调色板非常有限,建议在终端选项中切换颜色级别"
|
|
8075
7892
|
})
|
|
@@ -8079,7 +7896,7 @@ var PowerlineThemeSelector = ({
|
|
|
8079
7896
|
};
|
|
8080
7897
|
|
|
8081
7898
|
// src/tui/components/PowerlineSetup.tsx
|
|
8082
|
-
var
|
|
7899
|
+
var jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
|
|
8083
7900
|
function formatPowerlineMenuLabel(label) {
|
|
8084
7901
|
const segmenter = new Intl.Segmenter;
|
|
8085
7902
|
const displayWidth = Array.from(segmenter.segment(label)).reduce((w, { segment: ch }) => w + ((ch.codePointAt(0) ?? 0) > 127 ? 2 : 1), 0);
|
|
@@ -8193,6 +8010,7 @@ var PowerlineSetup = ({
|
|
|
8193
8010
|
const hasGlobalFgOverride = Boolean(settings.overrideForegroundColor && settings.overrideForegroundColor !== "none");
|
|
8194
8011
|
const globalOverrideMessage = hasGlobalFgOverride ? "⚠ 前景色全局覆盖已激活" : null;
|
|
8195
8012
|
use_input_default((input, key) => {
|
|
8013
|
+
const shortcut = getPlainInput(input, key);
|
|
8196
8014
|
if (fontInstallMessage || installingFonts) {
|
|
8197
8015
|
if (fontInstallMessage && !key.escape) {
|
|
8198
8016
|
onClearMessage();
|
|
@@ -8205,7 +8023,7 @@ var PowerlineSetup = ({
|
|
|
8205
8023
|
if (screen === "menu") {
|
|
8206
8024
|
if (key.escape) {
|
|
8207
8025
|
onBack();
|
|
8208
|
-
} else if (
|
|
8026
|
+
} else if (shortcut === "t" || shortcut === "T") {
|
|
8209
8027
|
if (!powerlineConfig.enabled) {
|
|
8210
8028
|
if (hasManualSeparatorItems) {
|
|
8211
8029
|
setConfirmingEnable(true);
|
|
@@ -8221,9 +8039,9 @@ var PowerlineSetup = ({
|
|
|
8221
8039
|
}
|
|
8222
8040
|
});
|
|
8223
8041
|
}
|
|
8224
|
-
} else if (
|
|
8042
|
+
} else if (shortcut === "i" || shortcut === "I") {
|
|
8225
8043
|
setConfirmingFontInstall(true);
|
|
8226
|
-
} else if ((
|
|
8044
|
+
} else if ((shortcut === "a" || shortcut === "A") && powerlineConfig.enabled) {
|
|
8227
8045
|
onUpdate({
|
|
8228
8046
|
...settings,
|
|
8229
8047
|
powerline: {
|
|
@@ -8231,7 +8049,7 @@ var PowerlineSetup = ({
|
|
|
8231
8049
|
autoAlign: !powerlineConfig.autoAlign
|
|
8232
8050
|
}
|
|
8233
8051
|
});
|
|
8234
|
-
} else if ((
|
|
8052
|
+
} else if ((shortcut === "c" || shortcut === "C") && powerlineConfig.enabled) {
|
|
8235
8053
|
onUpdate({
|
|
8236
8054
|
...settings,
|
|
8237
8055
|
powerline: {
|
|
@@ -8243,7 +8061,7 @@ var PowerlineSetup = ({
|
|
|
8243
8061
|
}
|
|
8244
8062
|
});
|
|
8245
8063
|
if (screen === "separator") {
|
|
8246
|
-
return /* @__PURE__ */
|
|
8064
|
+
return /* @__PURE__ */ jsx_runtime17.jsx(PowerlineSeparatorEditor, {
|
|
8247
8065
|
settings,
|
|
8248
8066
|
mode: "separator",
|
|
8249
8067
|
onUpdate,
|
|
@@ -8253,7 +8071,7 @@ var PowerlineSetup = ({
|
|
|
8253
8071
|
});
|
|
8254
8072
|
}
|
|
8255
8073
|
if (screen === "startCap") {
|
|
8256
|
-
return /* @__PURE__ */
|
|
8074
|
+
return /* @__PURE__ */ jsx_runtime17.jsx(PowerlineSeparatorEditor, {
|
|
8257
8075
|
settings,
|
|
8258
8076
|
mode: "startCap",
|
|
8259
8077
|
onUpdate,
|
|
@@ -8263,7 +8081,7 @@ var PowerlineSetup = ({
|
|
|
8263
8081
|
});
|
|
8264
8082
|
}
|
|
8265
8083
|
if (screen === "endCap") {
|
|
8266
|
-
return /* @__PURE__ */
|
|
8084
|
+
return /* @__PURE__ */ jsx_runtime17.jsx(PowerlineSeparatorEditor, {
|
|
8267
8085
|
settings,
|
|
8268
8086
|
mode: "endCap",
|
|
8269
8087
|
onUpdate,
|
|
@@ -8273,7 +8091,7 @@ var PowerlineSetup = ({
|
|
|
8273
8091
|
});
|
|
8274
8092
|
}
|
|
8275
8093
|
if (screen === "themes") {
|
|
8276
|
-
return /* @__PURE__ */
|
|
8094
|
+
return /* @__PURE__ */ jsx_runtime17.jsx(PowerlineThemeSelector, {
|
|
8277
8095
|
settings,
|
|
8278
8096
|
onUpdate,
|
|
8279
8097
|
onBack: () => {
|
|
@@ -8281,16 +8099,16 @@ var PowerlineSetup = ({
|
|
|
8281
8099
|
}
|
|
8282
8100
|
});
|
|
8283
8101
|
}
|
|
8284
|
-
return /* @__PURE__ */
|
|
8102
|
+
return /* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8285
8103
|
flexDirection: "column",
|
|
8286
8104
|
children: [
|
|
8287
|
-
!confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */
|
|
8105
|
+
!confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8288
8106
|
children: [
|
|
8289
|
-
/* @__PURE__ */
|
|
8107
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8290
8108
|
bold: true,
|
|
8291
8109
|
children: "Powerline 设置"
|
|
8292
8110
|
}),
|
|
8293
|
-
globalOverrideMessage && /* @__PURE__ */
|
|
8111
|
+
globalOverrideMessage && /* @__PURE__ */ jsx_runtime17.jsxs(Text, {
|
|
8294
8112
|
color: "yellow",
|
|
8295
8113
|
dimColor: true,
|
|
8296
8114
|
children: [
|
|
@@ -8300,133 +8118,133 @@ var PowerlineSetup = ({
|
|
|
8300
8118
|
})
|
|
8301
8119
|
]
|
|
8302
8120
|
}),
|
|
8303
|
-
confirmingFontInstall ? /* @__PURE__ */
|
|
8121
|
+
confirmingFontInstall ? /* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8304
8122
|
flexDirection: "column",
|
|
8305
8123
|
children: [
|
|
8306
|
-
/* @__PURE__ */
|
|
8124
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8307
8125
|
marginBottom: 1,
|
|
8308
|
-
children: /* @__PURE__ */
|
|
8126
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8309
8127
|
color: "cyan",
|
|
8310
8128
|
bold: true,
|
|
8311
8129
|
children: "字体安装"
|
|
8312
8130
|
})
|
|
8313
8131
|
}),
|
|
8314
|
-
/* @__PURE__ */
|
|
8132
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8315
8133
|
marginBottom: 1,
|
|
8316
8134
|
flexDirection: "column",
|
|
8317
8135
|
children: [
|
|
8318
|
-
/* @__PURE__ */
|
|
8136
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8319
8137
|
bold: true,
|
|
8320
8138
|
children: "将会执行:"
|
|
8321
8139
|
}),
|
|
8322
|
-
/* @__PURE__ */
|
|
8140
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Text, {
|
|
8323
8141
|
children: [
|
|
8324
|
-
/* @__PURE__ */
|
|
8142
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8325
8143
|
dimColor: true,
|
|
8326
8144
|
children: "• 从以下地址克隆字体 "
|
|
8327
8145
|
}),
|
|
8328
|
-
/* @__PURE__ */
|
|
8146
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8329
8147
|
color: "blue",
|
|
8330
8148
|
children: "https://github.com/powerline/fonts"
|
|
8331
8149
|
})
|
|
8332
8150
|
]
|
|
8333
8151
|
}),
|
|
8334
|
-
os5.platform() === "darwin" && /* @__PURE__ */
|
|
8152
|
+
os5.platform() === "darwin" && /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8335
8153
|
children: [
|
|
8336
|
-
/* @__PURE__ */
|
|
8154
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8337
8155
|
dimColor: true,
|
|
8338
8156
|
children: "• 运行 install.sh 脚本:"
|
|
8339
8157
|
}),
|
|
8340
|
-
/* @__PURE__ */
|
|
8158
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8341
8159
|
dimColor: true,
|
|
8342
8160
|
children: " - 复制所有 .ttf/.otf 文件到 ~/Library/Fonts"
|
|
8343
8161
|
}),
|
|
8344
|
-
/* @__PURE__ */
|
|
8162
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8345
8163
|
dimColor: true,
|
|
8346
8164
|
children: " - 在 macOS 中注册字体"
|
|
8347
8165
|
})
|
|
8348
8166
|
]
|
|
8349
8167
|
}),
|
|
8350
|
-
os5.platform() === "linux" && /* @__PURE__ */
|
|
8168
|
+
os5.platform() === "linux" && /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8351
8169
|
children: [
|
|
8352
|
-
/* @__PURE__ */
|
|
8170
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8353
8171
|
dimColor: true,
|
|
8354
8172
|
children: "• 运行 install.sh 脚本:"
|
|
8355
8173
|
}),
|
|
8356
|
-
/* @__PURE__ */
|
|
8174
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8357
8175
|
dimColor: true,
|
|
8358
8176
|
children: " - 复制所有 .ttf/.otf 文件到 ~/.local/share/fonts"
|
|
8359
8177
|
}),
|
|
8360
|
-
/* @__PURE__ */
|
|
8178
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8361
8179
|
dimColor: true,
|
|
8362
8180
|
children: " - 运行 fc-cache 更新字体缓存"
|
|
8363
8181
|
})
|
|
8364
8182
|
]
|
|
8365
8183
|
}),
|
|
8366
|
-
os5.platform() === "win32" && /* @__PURE__ */
|
|
8184
|
+
os5.platform() === "win32" && /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8367
8185
|
children: [
|
|
8368
|
-
/* @__PURE__ */
|
|
8186
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8369
8187
|
dimColor: true,
|
|
8370
8188
|
children: "• 复制 Powerline .ttf/.otf 文件到:"
|
|
8371
8189
|
}),
|
|
8372
|
-
/* @__PURE__ */
|
|
8190
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8373
8191
|
dimColor: true,
|
|
8374
8192
|
children: " AppData\\Local\\Microsoft\\Windows\\Fonts"
|
|
8375
8193
|
})
|
|
8376
8194
|
]
|
|
8377
8195
|
}),
|
|
8378
|
-
/* @__PURE__ */
|
|
8196
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8379
8197
|
dimColor: true,
|
|
8380
8198
|
children: "• 清理临时文件"
|
|
8381
8199
|
})
|
|
8382
8200
|
]
|
|
8383
8201
|
}),
|
|
8384
|
-
/* @__PURE__ */
|
|
8202
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8385
8203
|
marginBottom: 1,
|
|
8386
8204
|
children: [
|
|
8387
|
-
/* @__PURE__ */
|
|
8205
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8388
8206
|
color: "yellow",
|
|
8389
8207
|
bold: true,
|
|
8390
8208
|
children: "前提条件:"
|
|
8391
8209
|
}),
|
|
8392
|
-
/* @__PURE__ */
|
|
8210
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8393
8211
|
dimColor: true,
|
|
8394
8212
|
children: "已安装 Git、网络连接、写入权限"
|
|
8395
8213
|
})
|
|
8396
8214
|
]
|
|
8397
8215
|
}),
|
|
8398
|
-
/* @__PURE__ */
|
|
8216
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8399
8217
|
marginBottom: 1,
|
|
8400
8218
|
flexDirection: "column",
|
|
8401
8219
|
children: [
|
|
8402
|
-
/* @__PURE__ */
|
|
8220
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8403
8221
|
color: "green",
|
|
8404
8222
|
bold: true,
|
|
8405
8223
|
children: "安装后:"
|
|
8406
8224
|
}),
|
|
8407
|
-
/* @__PURE__ */
|
|
8225
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8408
8226
|
dimColor: true,
|
|
8409
8227
|
children: "• 重启终端"
|
|
8410
8228
|
}),
|
|
8411
|
-
/* @__PURE__ */
|
|
8229
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8412
8230
|
dimColor: true,
|
|
8413
8231
|
children: "• 选择一个 Powerline 字体"
|
|
8414
8232
|
}),
|
|
8415
|
-
/* @__PURE__ */
|
|
8233
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8416
8234
|
dimColor: true,
|
|
8417
8235
|
children: ' (例如 "Meslo LG S for Powerline")'
|
|
8418
8236
|
})
|
|
8419
8237
|
]
|
|
8420
8238
|
}),
|
|
8421
|
-
/* @__PURE__ */
|
|
8239
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8422
8240
|
marginTop: 1,
|
|
8423
|
-
children: /* @__PURE__ */
|
|
8241
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8424
8242
|
children: "是否继续?"
|
|
8425
8243
|
})
|
|
8426
8244
|
}),
|
|
8427
|
-
/* @__PURE__ */
|
|
8245
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8428
8246
|
marginTop: 1,
|
|
8429
|
-
children: /* @__PURE__ */
|
|
8247
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(ConfirmDialog, {
|
|
8430
8248
|
inline: true,
|
|
8431
8249
|
onConfirm: () => {
|
|
8432
8250
|
setConfirmingFontInstall(false);
|
|
@@ -8438,36 +8256,36 @@ var PowerlineSetup = ({
|
|
|
8438
8256
|
})
|
|
8439
8257
|
})
|
|
8440
8258
|
]
|
|
8441
|
-
}) : confirmingEnable ? /* @__PURE__ */
|
|
8259
|
+
}) : confirmingEnable ? /* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8442
8260
|
flexDirection: "column",
|
|
8443
8261
|
marginTop: 1,
|
|
8444
8262
|
children: [
|
|
8445
|
-
hasManualSeparatorItems && /* @__PURE__ */
|
|
8263
|
+
hasManualSeparatorItems && /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8446
8264
|
children: [
|
|
8447
|
-
/* @__PURE__ */
|
|
8448
|
-
children: /* @__PURE__ */
|
|
8265
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8266
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8449
8267
|
color: "yellow",
|
|
8450
8268
|
children: "⚠ 警告:启用 Powerline 模式将移除状态栏中所有现有的分隔符和弹性分隔符。"
|
|
8451
8269
|
})
|
|
8452
8270
|
}),
|
|
8453
|
-
/* @__PURE__ */
|
|
8271
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8454
8272
|
marginBottom: 1,
|
|
8455
|
-
children: /* @__PURE__ */
|
|
8273
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8456
8274
|
dimColor: true,
|
|
8457
8275
|
children: "Powerline 模式使用自己的分隔符系统,与手动分隔符不兼容。"
|
|
8458
8276
|
})
|
|
8459
8277
|
})
|
|
8460
8278
|
]
|
|
8461
8279
|
}),
|
|
8462
|
-
/* @__PURE__ */
|
|
8280
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8463
8281
|
marginTop: hasManualSeparatorItems ? 1 : 0,
|
|
8464
|
-
children: /* @__PURE__ */
|
|
8282
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8465
8283
|
children: "是否要继续?"
|
|
8466
8284
|
})
|
|
8467
8285
|
}),
|
|
8468
|
-
/* @__PURE__ */
|
|
8286
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8469
8287
|
marginTop: 1,
|
|
8470
|
-
children: /* @__PURE__ */
|
|
8288
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(ConfirmDialog, {
|
|
8471
8289
|
inline: true,
|
|
8472
8290
|
onConfirm: () => {
|
|
8473
8291
|
onUpdate(buildEnabledPowerlineSettings(settings, true));
|
|
@@ -8479,51 +8297,51 @@ var PowerlineSetup = ({
|
|
|
8479
8297
|
})
|
|
8480
8298
|
})
|
|
8481
8299
|
]
|
|
8482
|
-
}) : installingFonts ? /* @__PURE__ */
|
|
8483
|
-
children: /* @__PURE__ */
|
|
8300
|
+
}) : installingFonts ? /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8301
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8484
8302
|
color: "yellow",
|
|
8485
8303
|
children: "正在安装 Powerline 字体... 这可能需要一些时间。"
|
|
8486
8304
|
})
|
|
8487
|
-
}) : fontInstallMessage ? /* @__PURE__ */
|
|
8305
|
+
}) : fontInstallMessage ? /* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8488
8306
|
flexDirection: "column",
|
|
8489
8307
|
children: [
|
|
8490
|
-
/* @__PURE__ */
|
|
8308
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8491
8309
|
color: fontInstallMessage.includes("success") ? "green" : "red",
|
|
8492
8310
|
children: fontInstallMessage
|
|
8493
8311
|
}),
|
|
8494
|
-
/* @__PURE__ */
|
|
8312
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8495
8313
|
marginTop: 1,
|
|
8496
|
-
children: /* @__PURE__ */
|
|
8314
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8497
8315
|
dimColor: true,
|
|
8498
8316
|
children: "按任意键继续..."
|
|
8499
8317
|
})
|
|
8500
8318
|
})
|
|
8501
8319
|
]
|
|
8502
|
-
}) : /* @__PURE__ */
|
|
8320
|
+
}) : /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8503
8321
|
children: [
|
|
8504
|
-
/* @__PURE__ */
|
|
8322
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8505
8323
|
flexDirection: "column",
|
|
8506
|
-
children: /* @__PURE__ */
|
|
8324
|
+
children: /* @__PURE__ */ jsx_runtime17.jsxs(Text, {
|
|
8507
8325
|
children: [
|
|
8508
8326
|
" 字体状态: ",
|
|
8509
|
-
powerlineFontStatus.installed ? /* @__PURE__ */
|
|
8327
|
+
powerlineFontStatus.installed ? /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8510
8328
|
children: [
|
|
8511
|
-
/* @__PURE__ */
|
|
8329
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8512
8330
|
color: "green",
|
|
8513
8331
|
children: "✓ 已安装"
|
|
8514
8332
|
}),
|
|
8515
|
-
/* @__PURE__ */
|
|
8333
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8516
8334
|
dimColor: true,
|
|
8517
8335
|
children: " - 请确保终端中已激活字体"
|
|
8518
8336
|
})
|
|
8519
8337
|
]
|
|
8520
|
-
}) : /* @__PURE__ */
|
|
8338
|
+
}) : /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8521
8339
|
children: [
|
|
8522
|
-
/* @__PURE__ */
|
|
8340
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8523
8341
|
color: "yellow",
|
|
8524
8342
|
children: "✗ 未安装"
|
|
8525
8343
|
}),
|
|
8526
|
-
/* @__PURE__ */
|
|
8344
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8527
8345
|
dimColor: true,
|
|
8528
8346
|
children: " - 按 (i) 安装 Powerline 字体"
|
|
8529
8347
|
})
|
|
@@ -8532,62 +8350,62 @@ var PowerlineSetup = ({
|
|
|
8532
8350
|
]
|
|
8533
8351
|
})
|
|
8534
8352
|
}),
|
|
8535
|
-
/* @__PURE__ */
|
|
8353
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8536
8354
|
children: [
|
|
8537
|
-
/* @__PURE__ */
|
|
8355
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8538
8356
|
children: " Powerline 模式:"
|
|
8539
8357
|
}),
|
|
8540
|
-
/* @__PURE__ */
|
|
8358
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8541
8359
|
color: powerlineConfig.enabled ? "green" : "red",
|
|
8542
8360
|
children: powerlineConfig.enabled ? "✓ 已启用 " : "✗ 已禁用 "
|
|
8543
8361
|
}),
|
|
8544
|
-
/* @__PURE__ */
|
|
8362
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8545
8363
|
dimColor: true,
|
|
8546
8364
|
children: " - 按 (t) 切换"
|
|
8547
8365
|
})
|
|
8548
8366
|
]
|
|
8549
8367
|
}),
|
|
8550
|
-
powerlineConfig.enabled && /* @__PURE__ */
|
|
8368
|
+
powerlineConfig.enabled && /* @__PURE__ */ jsx_runtime17.jsxs(jsx_runtime17.Fragment, {
|
|
8551
8369
|
children: [
|
|
8552
|
-
/* @__PURE__ */
|
|
8370
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8553
8371
|
children: [
|
|
8554
|
-
/* @__PURE__ */
|
|
8372
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8555
8373
|
children: " 对齐组件: "
|
|
8556
8374
|
}),
|
|
8557
|
-
/* @__PURE__ */
|
|
8375
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8558
8376
|
color: powerlineConfig.autoAlign ? "green" : "red",
|
|
8559
8377
|
children: powerlineConfig.autoAlign ? "✓ 已启用 " : "✗ 已禁用 "
|
|
8560
8378
|
}),
|
|
8561
|
-
/* @__PURE__ */
|
|
8379
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8562
8380
|
dimColor: true,
|
|
8563
8381
|
children: " - 按 (a) 切换"
|
|
8564
8382
|
})
|
|
8565
8383
|
]
|
|
8566
8384
|
}),
|
|
8567
|
-
/* @__PURE__ */
|
|
8385
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8568
8386
|
children: [
|
|
8569
|
-
/* @__PURE__ */
|
|
8387
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8570
8388
|
children: " 主题色延续: "
|
|
8571
8389
|
}),
|
|
8572
|
-
/* @__PURE__ */
|
|
8390
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8573
8391
|
color: powerlineConfig.continueThemeAcrossLines ? "green" : "red",
|
|
8574
8392
|
children: powerlineConfig.continueThemeAcrossLines ? "✓ 已启用 " : "✗ 已禁用 "
|
|
8575
8393
|
}),
|
|
8576
|
-
/* @__PURE__ */
|
|
8394
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8577
8395
|
dimColor: true,
|
|
8578
8396
|
children: " - 按 (c) 切换"
|
|
8579
8397
|
})
|
|
8580
8398
|
]
|
|
8581
8399
|
}),
|
|
8582
|
-
/* @__PURE__ */
|
|
8400
|
+
/* @__PURE__ */ jsx_runtime17.jsxs(Box_default, {
|
|
8583
8401
|
flexDirection: "column",
|
|
8584
8402
|
marginTop: 1,
|
|
8585
8403
|
children: [
|
|
8586
|
-
/* @__PURE__ */
|
|
8404
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8587
8405
|
dimColor: true,
|
|
8588
8406
|
children: "Powerline 模式使用独立的分隔符系统"
|
|
8589
8407
|
}),
|
|
8590
|
-
/* @__PURE__ */
|
|
8408
|
+
/* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8591
8409
|
dimColor: true,
|
|
8592
8410
|
children: "主题色延续:Powerline 颜色序列跨多行状态栏连续延续"
|
|
8593
8411
|
})
|
|
@@ -8595,14 +8413,14 @@ var PowerlineSetup = ({
|
|
|
8595
8413
|
})
|
|
8596
8414
|
]
|
|
8597
8415
|
}),
|
|
8598
|
-
!powerlineConfig.enabled && /* @__PURE__ */
|
|
8416
|
+
!powerlineConfig.enabled && /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
8599
8417
|
marginTop: 1,
|
|
8600
|
-
children: /* @__PURE__ */
|
|
8418
|
+
children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
|
|
8601
8419
|
dimColor: true,
|
|
8602
8420
|
children: "启用 Powerline 模式以配置分隔符、端帽和主题。"
|
|
8603
8421
|
})
|
|
8604
8422
|
}),
|
|
8605
|
-
/* @__PURE__ */
|
|
8423
|
+
/* @__PURE__ */ jsx_runtime17.jsx(List, {
|
|
8606
8424
|
marginTop: 1,
|
|
8607
8425
|
items: buildPowerlineSetupMenuItems(powerlineConfig),
|
|
8608
8426
|
onSelect: (value) => {
|
|
@@ -8625,7 +8443,7 @@ var PowerlineSetup = ({
|
|
|
8625
8443
|
};
|
|
8626
8444
|
// src/tui/components/RefreshIntervalMenu.tsx
|
|
8627
8445
|
var import_react17 = __toESM(require_react(), 1);
|
|
8628
|
-
var
|
|
8446
|
+
var jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
|
|
8629
8447
|
function getRefreshInputValue(interval) {
|
|
8630
8448
|
return interval === null ? "" : String(interval);
|
|
8631
8449
|
}
|
|
@@ -8680,8 +8498,8 @@ function validateRefreshIntervalInput(value) {
|
|
|
8680
8498
|
if (value === "") {
|
|
8681
8499
|
return null;
|
|
8682
8500
|
}
|
|
8683
|
-
const parsed = parseInt(value, 10);
|
|
8684
|
-
if (isNaN(parsed)) {
|
|
8501
|
+
const parsed = Number.parseInt(value, 10);
|
|
8502
|
+
if (Number.isNaN(parsed)) {
|
|
8685
8503
|
return "请输入有效数字";
|
|
8686
8504
|
}
|
|
8687
8505
|
if (parsed < 1) {
|
|
@@ -8693,8 +8511,8 @@ function validateRefreshIntervalInput(value) {
|
|
|
8693
8511
|
return null;
|
|
8694
8512
|
}
|
|
8695
8513
|
function validateTtlInput(value, label, maximum = 60) {
|
|
8696
|
-
const parsed = parseInt(value, 10);
|
|
8697
|
-
if (value === "" || isNaN(parsed)) {
|
|
8514
|
+
const parsed = Number.parseInt(value, 10);
|
|
8515
|
+
if (value === "" || Number.isNaN(parsed)) {
|
|
8698
8516
|
return "请输入有效数字";
|
|
8699
8517
|
}
|
|
8700
8518
|
if (parsed < 0) {
|
|
@@ -8773,7 +8591,7 @@ var RefreshIntervalMenu = ({
|
|
|
8773
8591
|
if (error) {
|
|
8774
8592
|
setValidationError(error);
|
|
8775
8593
|
} else {
|
|
8776
|
-
const value = parseInt(refreshInput, 10);
|
|
8594
|
+
const value = Number.parseInt(refreshInput, 10);
|
|
8777
8595
|
onUpdate(value);
|
|
8778
8596
|
setEditingRefreshInterval(false);
|
|
8779
8597
|
setValidationError(null);
|
|
@@ -8801,7 +8619,7 @@ var RefreshIntervalMenu = ({
|
|
|
8801
8619
|
if (error) {
|
|
8802
8620
|
setValidationError(error);
|
|
8803
8621
|
} else {
|
|
8804
|
-
const value = parseInt(ttlInput, 10);
|
|
8622
|
+
const value = Number.parseInt(ttlInput, 10);
|
|
8805
8623
|
field.onSave(value);
|
|
8806
8624
|
setEditingTtlField(null);
|
|
8807
8625
|
setValidationError(null);
|
|
@@ -8826,22 +8644,22 @@ var RefreshIntervalMenu = ({
|
|
|
8826
8644
|
onBack();
|
|
8827
8645
|
}
|
|
8828
8646
|
});
|
|
8829
|
-
return /* @__PURE__ */
|
|
8647
|
+
return /* @__PURE__ */ jsx_runtime18.jsxs(Box_default, {
|
|
8830
8648
|
flexDirection: "column",
|
|
8831
8649
|
children: [
|
|
8832
|
-
/* @__PURE__ */
|
|
8650
|
+
/* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8833
8651
|
bold: true,
|
|
8834
8652
|
children: "配置状态行"
|
|
8835
8653
|
}),
|
|
8836
|
-
/* @__PURE__ */
|
|
8654
|
+
/* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8837
8655
|
color: "white",
|
|
8838
8656
|
children: "配置 Claude Code 状态行设置"
|
|
8839
8657
|
}),
|
|
8840
|
-
editingRefreshInterval ? /* @__PURE__ */
|
|
8658
|
+
editingRefreshInterval ? /* @__PURE__ */ jsx_runtime18.jsxs(Box_default, {
|
|
8841
8659
|
marginTop: 1,
|
|
8842
8660
|
flexDirection: "column",
|
|
8843
8661
|
children: [
|
|
8844
|
-
/* @__PURE__ */
|
|
8662
|
+
/* @__PURE__ */ jsx_runtime18.jsxs(Text, {
|
|
8845
8663
|
children: [
|
|
8846
8664
|
"输入刷新间隔(秒,1-60):",
|
|
8847
8665
|
" ",
|
|
@@ -8849,19 +8667,19 @@ var RefreshIntervalMenu = ({
|
|
|
8849
8667
|
refreshInput.length > 0 ? " 秒" : ""
|
|
8850
8668
|
]
|
|
8851
8669
|
}),
|
|
8852
|
-
validationError ? /* @__PURE__ */
|
|
8670
|
+
validationError ? /* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8853
8671
|
color: "red",
|
|
8854
8672
|
children: validationError
|
|
8855
|
-
}) : /* @__PURE__ */
|
|
8673
|
+
}) : /* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8856
8674
|
dimColor: true,
|
|
8857
8675
|
children: "按 Enter 确认,ESC 取消。留空即移除。"
|
|
8858
8676
|
})
|
|
8859
8677
|
]
|
|
8860
|
-
}) : editingTtlField ? /* @__PURE__ */
|
|
8678
|
+
}) : editingTtlField ? /* @__PURE__ */ jsx_runtime18.jsxs(Box_default, {
|
|
8861
8679
|
marginTop: 1,
|
|
8862
8680
|
flexDirection: "column",
|
|
8863
8681
|
children: [
|
|
8864
|
-
/* @__PURE__ */
|
|
8682
|
+
/* @__PURE__ */ jsx_runtime18.jsxs(Text, {
|
|
8865
8683
|
children: [
|
|
8866
8684
|
ttlFields[editingTtlField].prompt,
|
|
8867
8685
|
" ",
|
|
@@ -8869,27 +8687,27 @@ var RefreshIntervalMenu = ({
|
|
|
8869
8687
|
ttlInput.length > 0 ? " 秒" : ""
|
|
8870
8688
|
]
|
|
8871
8689
|
}),
|
|
8872
|
-
/* @__PURE__ */
|
|
8690
|
+
/* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8873
8691
|
children: " "
|
|
8874
8692
|
}),
|
|
8875
|
-
/* @__PURE__ */
|
|
8693
|
+
/* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8876
8694
|
dimColor: true,
|
|
8877
8695
|
wrap: "wrap",
|
|
8878
8696
|
children: ttlFields[editingTtlField].helperText
|
|
8879
8697
|
}),
|
|
8880
|
-
validationError ? /* @__PURE__ */
|
|
8698
|
+
validationError ? /* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8881
8699
|
color: "red",
|
|
8882
8700
|
children: validationError
|
|
8883
|
-
}) : /* @__PURE__ */
|
|
8701
|
+
}) : /* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8884
8702
|
dimColor: true,
|
|
8885
8703
|
children: ttlFields[editingTtlField].hint
|
|
8886
8704
|
}),
|
|
8887
|
-
/* @__PURE__ */
|
|
8705
|
+
/* @__PURE__ */ jsx_runtime18.jsx(Text, {
|
|
8888
8706
|
dimColor: true,
|
|
8889
8707
|
children: "按 Enter 确认,ESC 取消。"
|
|
8890
8708
|
})
|
|
8891
8709
|
]
|
|
8892
|
-
}) : /* @__PURE__ */
|
|
8710
|
+
}) : /* @__PURE__ */ jsx_runtime18.jsx(List, {
|
|
8893
8711
|
marginTop: 1,
|
|
8894
8712
|
items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval, gitCacheTtlSeconds, customCommandCacheTtlSeconds, terminalWidthCacheTtlSeconds),
|
|
8895
8713
|
onSelect: (value) => {
|
|
@@ -8912,7 +8730,7 @@ var RefreshIntervalMenu = ({
|
|
|
8912
8730
|
};
|
|
8913
8731
|
// src/tui/components/StatusLinePreview.tsx
|
|
8914
8732
|
var import_react18 = __toESM(require_react(), 1);
|
|
8915
|
-
var
|
|
8733
|
+
var jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
8916
8734
|
var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSeparatorIndex, globalPowerlineThemeIndex, globalPowerlineStartCapIndex, preRenderedWidgets, preCalculatedMaxWidths) => {
|
|
8917
8735
|
const context = {
|
|
8918
8736
|
terminalWidth,
|
|
@@ -8973,26 +8791,26 @@ var StatusLinePreview = ({ lines, terminalWidth, settings, onTruncationChange })
|
|
|
8973
8791
|
import_react18.default.useEffect(() => {
|
|
8974
8792
|
onTruncationChange?.(anyTruncated);
|
|
8975
8793
|
}, [anyTruncated, onTruncationChange]);
|
|
8976
|
-
return /* @__PURE__ */
|
|
8794
|
+
return /* @__PURE__ */ jsx_runtime19.jsxs(Box_default, {
|
|
8977
8795
|
flexDirection: "column",
|
|
8978
8796
|
children: [
|
|
8979
|
-
/* @__PURE__ */
|
|
8797
|
+
/* @__PURE__ */ jsx_runtime19.jsx(Box_default, {
|
|
8980
8798
|
borderStyle: "round",
|
|
8981
8799
|
borderColor: "gray",
|
|
8982
8800
|
borderDimColor: true,
|
|
8983
8801
|
width: "100%",
|
|
8984
8802
|
paddingLeft: 1,
|
|
8985
|
-
children: /* @__PURE__ */
|
|
8803
|
+
children: /* @__PURE__ */ jsx_runtime19.jsxs(Text, {
|
|
8986
8804
|
children: [
|
|
8987
8805
|
">",
|
|
8988
|
-
/* @__PURE__ */
|
|
8806
|
+
/* @__PURE__ */ jsx_runtime19.jsx(Text, {
|
|
8989
8807
|
dimColor: true,
|
|
8990
8808
|
children: " 预览 (随时按 ctrl+s 保存配置)"
|
|
8991
8809
|
})
|
|
8992
8810
|
]
|
|
8993
8811
|
})
|
|
8994
8812
|
}),
|
|
8995
|
-
renderedLines.map((line, index) => /* @__PURE__ */
|
|
8813
|
+
renderedLines.map((line, index) => /* @__PURE__ */ jsx_runtime19.jsxs(Text, {
|
|
8996
8814
|
wrap: "truncate",
|
|
8997
8815
|
children: [
|
|
8998
8816
|
PREVIEW_LINE_INDENT,
|
|
@@ -9058,7 +8876,7 @@ function sanitizeLinesForColorLevel(lines, nextLevel) {
|
|
|
9058
8876
|
}
|
|
9059
8877
|
|
|
9060
8878
|
// src/tui/components/TerminalOptionsMenu.tsx
|
|
9061
|
-
var
|
|
8879
|
+
var jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
|
|
9062
8880
|
function getNextColorLevel(level) {
|
|
9063
8881
|
return (level + 1) % 4;
|
|
9064
8882
|
}
|
|
@@ -9141,27 +8959,27 @@ var TerminalOptionsMenu = ({
|
|
|
9141
8959
|
onBack();
|
|
9142
8960
|
}
|
|
9143
8961
|
});
|
|
9144
|
-
return /* @__PURE__ */
|
|
8962
|
+
return /* @__PURE__ */ jsx_runtime20.jsxs(Box_default, {
|
|
9145
8963
|
flexDirection: "column",
|
|
9146
8964
|
children: [
|
|
9147
|
-
/* @__PURE__ */
|
|
8965
|
+
/* @__PURE__ */ jsx_runtime20.jsx(Text, {
|
|
9148
8966
|
bold: true,
|
|
9149
8967
|
children: "终端选项"
|
|
9150
8968
|
}),
|
|
9151
|
-
showColorWarning ? /* @__PURE__ */
|
|
8969
|
+
showColorWarning ? /* @__PURE__ */ jsx_runtime20.jsxs(Box_default, {
|
|
9152
8970
|
flexDirection: "column",
|
|
9153
8971
|
marginTop: 1,
|
|
9154
8972
|
children: [
|
|
9155
|
-
/* @__PURE__ */
|
|
8973
|
+
/* @__PURE__ */ jsx_runtime20.jsx(Text, {
|
|
9156
8974
|
color: "yellow",
|
|
9157
8975
|
children: "⚠ 警告:检测到自定义颜色!"
|
|
9158
8976
|
}),
|
|
9159
|
-
/* @__PURE__ */
|
|
8977
|
+
/* @__PURE__ */ jsx_runtime20.jsx(Text, {
|
|
9160
8978
|
children: "切换颜色模式将会把自定义的 ansi256 或十六进制颜色重置为默认值。"
|
|
9161
8979
|
}),
|
|
9162
|
-
/* @__PURE__ */
|
|
8980
|
+
/* @__PURE__ */ jsx_runtime20.jsx(Box_default, {
|
|
9163
8981
|
marginTop: 1,
|
|
9164
|
-
children: /* @__PURE__ */
|
|
8982
|
+
children: /* @__PURE__ */ jsx_runtime20.jsx(ConfirmDialog, {
|
|
9165
8983
|
message: "继续?",
|
|
9166
8984
|
onConfirm: handleColorConfirm,
|
|
9167
8985
|
onCancel: handleColorCancel,
|
|
@@ -9169,13 +8987,13 @@ var TerminalOptionsMenu = ({
|
|
|
9169
8987
|
})
|
|
9170
8988
|
})
|
|
9171
8989
|
]
|
|
9172
|
-
}) : /* @__PURE__ */
|
|
8990
|
+
}) : /* @__PURE__ */ jsx_runtime20.jsxs(jsx_runtime20.Fragment, {
|
|
9173
8991
|
children: [
|
|
9174
|
-
/* @__PURE__ */
|
|
8992
|
+
/* @__PURE__ */ jsx_runtime20.jsx(Text, {
|
|
9175
8993
|
color: "white",
|
|
9176
8994
|
children: "配置终端特定设置以获得最佳显示效果"
|
|
9177
8995
|
}),
|
|
9178
|
-
/* @__PURE__ */
|
|
8996
|
+
/* @__PURE__ */ jsx_runtime20.jsx(List, {
|
|
9179
8997
|
marginTop: 1,
|
|
9180
8998
|
items: buildTerminalOptionsItems(settings.colorLevel),
|
|
9181
8999
|
onSelect: handleSelect,
|
|
@@ -9203,16 +9021,16 @@ var getColorLevelLabel = (level) => {
|
|
|
9203
9021
|
};
|
|
9204
9022
|
// src/tui/components/TerminalWidthMenu.tsx
|
|
9205
9023
|
var import_react20 = __toESM(require_react(), 1);
|
|
9206
|
-
var
|
|
9024
|
+
var jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
9207
9025
|
var TERMINAL_WIDTH_OPTIONS = ["full", "full-minus-40", "full-until-compact"];
|
|
9208
9026
|
function getTerminalWidthSelectionIndex(selectedOption) {
|
|
9209
9027
|
const selectedIndex = TERMINAL_WIDTH_OPTIONS.indexOf(selectedOption);
|
|
9210
9028
|
return selectedIndex >= 0 ? selectedIndex : 0;
|
|
9211
9029
|
}
|
|
9212
9030
|
function validateCompactThresholdInput(value) {
|
|
9213
|
-
const parsedValue = parseInt(value, 10);
|
|
9214
|
-
if (isNaN(parsedValue)) {
|
|
9215
|
-
return "
|
|
9031
|
+
const parsedValue = Number.parseInt(value, 10);
|
|
9032
|
+
if (Number.isNaN(parsedValue)) {
|
|
9033
|
+
return "请输入有效数字";
|
|
9216
9034
|
}
|
|
9217
9035
|
if (parsedValue < 1 || parsedValue > 99) {
|
|
9218
9036
|
return `Value must be between 1 and 99 (you entered ${parsedValue})`;
|
|
@@ -9262,7 +9080,7 @@ var TerminalWidthMenu = ({
|
|
|
9262
9080
|
if (error) {
|
|
9263
9081
|
setValidationError(error);
|
|
9264
9082
|
} else {
|
|
9265
|
-
const value = parseInt(thresholdInput, 10);
|
|
9083
|
+
const value = Number.parseInt(thresholdInput, 10);
|
|
9266
9084
|
setCompactThreshold(value);
|
|
9267
9085
|
const updatedSettings = {
|
|
9268
9086
|
...settings,
|
|
@@ -9293,27 +9111,27 @@ var TerminalWidthMenu = ({
|
|
|
9293
9111
|
onBack();
|
|
9294
9112
|
}
|
|
9295
9113
|
});
|
|
9296
|
-
return /* @__PURE__ */
|
|
9114
|
+
return /* @__PURE__ */ jsx_runtime21.jsxs(Box_default, {
|
|
9297
9115
|
flexDirection: "column",
|
|
9298
9116
|
children: [
|
|
9299
|
-
/* @__PURE__ */
|
|
9117
|
+
/* @__PURE__ */ jsx_runtime21.jsx(Text, {
|
|
9300
9118
|
bold: true,
|
|
9301
9119
|
children: "终端宽度"
|
|
9302
9120
|
}),
|
|
9303
|
-
/* @__PURE__ */
|
|
9121
|
+
/* @__PURE__ */ jsx_runtime21.jsx(Text, {
|
|
9304
9122
|
color: "white",
|
|
9305
9123
|
children: "这些设置影响长行的截断位置,以及使用弹性分隔符时的右对齐位置"
|
|
9306
9124
|
}),
|
|
9307
|
-
/* @__PURE__ */
|
|
9125
|
+
/* @__PURE__ */ jsx_runtime21.jsx(Text, {
|
|
9308
9126
|
dimColor: true,
|
|
9309
9127
|
wrap: "wrap",
|
|
9310
9128
|
children: "Claude Code 目前未提供状态栏可用宽度变量,IDE 集成、自动压缩通知等功能都可能导致状态栏换行(如果不进行截断)"
|
|
9311
9129
|
}),
|
|
9312
|
-
editingThreshold ? /* @__PURE__ */
|
|
9130
|
+
editingThreshold ? /* @__PURE__ */ jsx_runtime21.jsxs(Box_default, {
|
|
9313
9131
|
marginTop: 1,
|
|
9314
9132
|
flexDirection: "column",
|
|
9315
9133
|
children: [
|
|
9316
|
-
/* @__PURE__ */
|
|
9134
|
+
/* @__PURE__ */ jsx_runtime21.jsxs(Text, {
|
|
9317
9135
|
children: [
|
|
9318
9136
|
"输入压缩阈值(1-99):",
|
|
9319
9137
|
" ",
|
|
@@ -9321,15 +9139,15 @@ var TerminalWidthMenu = ({
|
|
|
9321
9139
|
"%"
|
|
9322
9140
|
]
|
|
9323
9141
|
}),
|
|
9324
|
-
validationError ? /* @__PURE__ */
|
|
9142
|
+
validationError ? /* @__PURE__ */ jsx_runtime21.jsx(Text, {
|
|
9325
9143
|
color: "red",
|
|
9326
9144
|
children: validationError
|
|
9327
|
-
}) : /* @__PURE__ */
|
|
9145
|
+
}) : /* @__PURE__ */ jsx_runtime21.jsx(Text, {
|
|
9328
9146
|
dimColor: true,
|
|
9329
9147
|
children: "按 Enter 确认,ESC 取消"
|
|
9330
9148
|
})
|
|
9331
9149
|
]
|
|
9332
|
-
}) : /* @__PURE__ */
|
|
9150
|
+
}) : /* @__PURE__ */ jsx_runtime21.jsx(List, {
|
|
9333
9151
|
marginTop: 1,
|
|
9334
9152
|
items: buildTerminalWidthItems(selectedOption, compactThreshold),
|
|
9335
9153
|
initialSelection: getTerminalWidthSelectionIndex(selectedOption),
|
|
@@ -9355,7 +9173,7 @@ var TerminalWidthMenu = ({
|
|
|
9355
9173
|
});
|
|
9356
9174
|
};
|
|
9357
9175
|
// src/tui/components/UpdateCheckerMenu.tsx
|
|
9358
|
-
var
|
|
9176
|
+
var jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
9359
9177
|
function getInstallationLabel2(result) {
|
|
9360
9178
|
const { installation } = result;
|
|
9361
9179
|
if (installation.method === "auto-update") {
|
|
@@ -9406,16 +9224,16 @@ var UpdateCheckerMenu = ({
|
|
|
9406
9224
|
}
|
|
9407
9225
|
});
|
|
9408
9226
|
if (state.status === "checking") {
|
|
9409
|
-
return /* @__PURE__ */
|
|
9227
|
+
return /* @__PURE__ */ jsx_runtime22.jsxs(Box_default, {
|
|
9410
9228
|
flexDirection: "column",
|
|
9411
9229
|
children: [
|
|
9412
|
-
/* @__PURE__ */
|
|
9230
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9413
9231
|
bold: true,
|
|
9414
9232
|
children: "检查更新"
|
|
9415
9233
|
}),
|
|
9416
|
-
/* @__PURE__ */
|
|
9234
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Box_default, {
|
|
9417
9235
|
marginTop: 1,
|
|
9418
|
-
children: /* @__PURE__ */
|
|
9236
|
+
children: /* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9419
9237
|
dimColor: true,
|
|
9420
9238
|
children: "正在查询 npm 仓库..."
|
|
9421
9239
|
})
|
|
@@ -9423,32 +9241,32 @@ var UpdateCheckerMenu = ({
|
|
|
9423
9241
|
]
|
|
9424
9242
|
});
|
|
9425
9243
|
}
|
|
9426
|
-
return /* @__PURE__ */
|
|
9244
|
+
return /* @__PURE__ */ jsx_runtime22.jsxs(Box_default, {
|
|
9427
9245
|
flexDirection: "column",
|
|
9428
9246
|
children: [
|
|
9429
|
-
/* @__PURE__ */
|
|
9247
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9430
9248
|
bold: true,
|
|
9431
9249
|
children: "检查更新"
|
|
9432
9250
|
}),
|
|
9433
|
-
/* @__PURE__ */
|
|
9251
|
+
/* @__PURE__ */ jsx_runtime22.jsxs(Box_default, {
|
|
9434
9252
|
marginTop: 1,
|
|
9435
9253
|
flexDirection: "column",
|
|
9436
9254
|
children: [
|
|
9437
|
-
/* @__PURE__ */
|
|
9255
|
+
/* @__PURE__ */ jsx_runtime22.jsxs(Text, {
|
|
9438
9256
|
children: [
|
|
9439
9257
|
"当前版本:",
|
|
9440
9258
|
" ",
|
|
9441
9259
|
state.currentVersion
|
|
9442
9260
|
]
|
|
9443
9261
|
}),
|
|
9444
|
-
state.status !== "registry-failure" && /* @__PURE__ */
|
|
9262
|
+
state.status !== "registry-failure" && /* @__PURE__ */ jsx_runtime22.jsxs(Text, {
|
|
9445
9263
|
children: [
|
|
9446
9264
|
"最新版本:",
|
|
9447
9265
|
" ",
|
|
9448
9266
|
state.latestVersion
|
|
9449
9267
|
]
|
|
9450
9268
|
}),
|
|
9451
|
-
/* @__PURE__ */
|
|
9269
|
+
/* @__PURE__ */ jsx_runtime22.jsxs(Text, {
|
|
9452
9270
|
children: [
|
|
9453
9271
|
"安装方式:",
|
|
9454
9272
|
" ",
|
|
@@ -9457,11 +9275,11 @@ var UpdateCheckerMenu = ({
|
|
|
9457
9275
|
})
|
|
9458
9276
|
]
|
|
9459
9277
|
}),
|
|
9460
|
-
state.status === "registry-failure" && /* @__PURE__ */
|
|
9278
|
+
state.status === "registry-failure" && /* @__PURE__ */ jsx_runtime22.jsxs(jsx_runtime22.Fragment, {
|
|
9461
9279
|
children: [
|
|
9462
|
-
/* @__PURE__ */
|
|
9280
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Box_default, {
|
|
9463
9281
|
marginTop: 1,
|
|
9464
|
-
children: /* @__PURE__ */
|
|
9282
|
+
children: /* @__PURE__ */ jsx_runtime22.jsxs(Text, {
|
|
9465
9283
|
color: "red",
|
|
9466
9284
|
children: [
|
|
9467
9285
|
"查询仓库失败:",
|
|
@@ -9470,7 +9288,7 @@ var UpdateCheckerMenu = ({
|
|
|
9470
9288
|
]
|
|
9471
9289
|
})
|
|
9472
9290
|
}),
|
|
9473
|
-
/* @__PURE__ */
|
|
9291
|
+
/* @__PURE__ */ jsx_runtime22.jsx(List, {
|
|
9474
9292
|
marginTop: 1,
|
|
9475
9293
|
items: [{ label: "重新检查", value: "refresh" }],
|
|
9476
9294
|
onSelect: (value) => {
|
|
@@ -9484,16 +9302,16 @@ var UpdateCheckerMenu = ({
|
|
|
9484
9302
|
})
|
|
9485
9303
|
]
|
|
9486
9304
|
}),
|
|
9487
|
-
state.status === "up-to-date" && /* @__PURE__ */
|
|
9305
|
+
state.status === "up-to-date" && /* @__PURE__ */ jsx_runtime22.jsxs(jsx_runtime22.Fragment, {
|
|
9488
9306
|
children: [
|
|
9489
|
-
/* @__PURE__ */
|
|
9307
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Box_default, {
|
|
9490
9308
|
marginTop: 1,
|
|
9491
|
-
children: /* @__PURE__ */
|
|
9309
|
+
children: /* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9492
9310
|
color: "green",
|
|
9493
9311
|
children: "ccstatusline-zh 已是最新版本。"
|
|
9494
9312
|
})
|
|
9495
9313
|
}),
|
|
9496
|
-
/* @__PURE__ */
|
|
9314
|
+
/* @__PURE__ */ jsx_runtime22.jsx(List, {
|
|
9497
9315
|
marginTop: 1,
|
|
9498
9316
|
items: [{ label: "重新检查", value: "refresh" }],
|
|
9499
9317
|
onSelect: (value) => {
|
|
@@ -9507,26 +9325,26 @@ var UpdateCheckerMenu = ({
|
|
|
9507
9325
|
})
|
|
9508
9326
|
]
|
|
9509
9327
|
}),
|
|
9510
|
-
state.status === "update-available" && /* @__PURE__ */
|
|
9328
|
+
state.status === "update-available" && /* @__PURE__ */ jsx_runtime22.jsxs(jsx_runtime22.Fragment, {
|
|
9511
9329
|
children: [
|
|
9512
|
-
/* @__PURE__ */
|
|
9330
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Box_default, {
|
|
9513
9331
|
marginTop: 1,
|
|
9514
|
-
children: /* @__PURE__ */
|
|
9332
|
+
children: /* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9515
9333
|
color: "yellow",
|
|
9516
9334
|
children: "检测到可用更新。"
|
|
9517
9335
|
})
|
|
9518
9336
|
}),
|
|
9519
|
-
state.installation.method === "auto-update" && /* @__PURE__ */
|
|
9337
|
+
state.installation.method === "auto-update" && /* @__PURE__ */ jsx_runtime22.jsxs(Box_default, {
|
|
9520
9338
|
marginTop: 1,
|
|
9521
9339
|
flexDirection: "column",
|
|
9522
9340
|
children: [
|
|
9523
|
-
/* @__PURE__ */
|
|
9341
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9524
9342
|
children: "无需手动修改 Claude 配置,因为已使用 @latest 自动跟随。"
|
|
9525
9343
|
}),
|
|
9526
|
-
/* @__PURE__ */
|
|
9344
|
+
/* @__PURE__ */ jsx_runtime22.jsx(Text, {
|
|
9527
9345
|
children: "下次调用 @latest 时会自动解析到最新版本。"
|
|
9528
9346
|
}),
|
|
9529
|
-
/* @__PURE__ */
|
|
9347
|
+
/* @__PURE__ */ jsx_runtime22.jsxs(Text, {
|
|
9530
9348
|
children: [
|
|
9531
9349
|
"启动新 TUI 的命令:",
|
|
9532
9350
|
" ",
|
|
@@ -9535,7 +9353,7 @@ var UpdateCheckerMenu = ({
|
|
|
9535
9353
|
})
|
|
9536
9354
|
]
|
|
9537
9355
|
}),
|
|
9538
|
-
state.actions.length > 0 && /* @__PURE__ */
|
|
9356
|
+
state.actions.length > 0 && /* @__PURE__ */ jsx_runtime22.jsx(List, {
|
|
9539
9357
|
marginTop: 1,
|
|
9540
9358
|
items: getActionItems(state.actions),
|
|
9541
9359
|
onSelect: (value) => {
|
|
@@ -9551,7 +9369,7 @@ var UpdateCheckerMenu = ({
|
|
|
9551
9369
|
},
|
|
9552
9370
|
showBackButton: true
|
|
9553
9371
|
}),
|
|
9554
|
-
state.actions.length === 0 && /* @__PURE__ */
|
|
9372
|
+
state.actions.length === 0 && /* @__PURE__ */ jsx_runtime22.jsx(List, {
|
|
9555
9373
|
marginTop: 1,
|
|
9556
9374
|
items: [{ label: "重新检查", value: "refresh" }],
|
|
9557
9375
|
onSelect: (value) => {
|
|
@@ -9569,7 +9387,7 @@ var UpdateCheckerMenu = ({
|
|
|
9569
9387
|
});
|
|
9570
9388
|
};
|
|
9571
9389
|
// src/tui/App.tsx
|
|
9572
|
-
var
|
|
9390
|
+
var jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
9573
9391
|
var GITHUB_REPO_URL = "https://github.com/huangguang1999/ccstatusline-zh";
|
|
9574
9392
|
var NOTICE_ITEMS = [
|
|
9575
9393
|
{
|
|
@@ -9588,22 +9406,22 @@ var FlowNotice = ({
|
|
|
9588
9406
|
onContinue();
|
|
9589
9407
|
}
|
|
9590
9408
|
});
|
|
9591
|
-
return /* @__PURE__ */
|
|
9409
|
+
return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
9592
9410
|
flexDirection: "column",
|
|
9593
9411
|
children: [
|
|
9594
|
-
/* @__PURE__ */
|
|
9412
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9595
9413
|
bold: true,
|
|
9596
9414
|
children: title
|
|
9597
9415
|
}),
|
|
9598
|
-
/* @__PURE__ */
|
|
9416
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Box_default, {
|
|
9599
9417
|
marginTop: 1,
|
|
9600
|
-
children: /* @__PURE__ */
|
|
9418
|
+
children: /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9601
9419
|
color,
|
|
9602
9420
|
wrap: "wrap",
|
|
9603
9421
|
children: message
|
|
9604
9422
|
})
|
|
9605
9423
|
}),
|
|
9606
|
-
/* @__PURE__ */
|
|
9424
|
+
/* @__PURE__ */ jsx_runtime23.jsx(List, {
|
|
9607
9425
|
marginTop: 1,
|
|
9608
9426
|
items: NOTICE_ITEMS,
|
|
9609
9427
|
onSelect: () => {
|
|
@@ -9635,54 +9453,61 @@ function getPinnedMismatchItems(mismatch, canRunPackageManager) {
|
|
|
9635
9453
|
var PinnedVersionMismatchScreen = ({
|
|
9636
9454
|
mismatch,
|
|
9637
9455
|
canRunPackageManager,
|
|
9456
|
+
updating,
|
|
9638
9457
|
onUpdate,
|
|
9639
9458
|
onExit
|
|
9640
9459
|
}) => {
|
|
9641
9460
|
use_input_default((_, key) => {
|
|
9642
|
-
if (key.escape) {
|
|
9461
|
+
if (key.escape && !updating) {
|
|
9643
9462
|
onExit();
|
|
9644
9463
|
}
|
|
9645
9464
|
});
|
|
9646
|
-
return /* @__PURE__ */
|
|
9465
|
+
return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
9647
9466
|
flexDirection: "column",
|
|
9648
9467
|
children: [
|
|
9649
|
-
/* @__PURE__ */
|
|
9468
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9650
9469
|
bold: true,
|
|
9651
|
-
children: "
|
|
9470
|
+
children: "固定安装版本不一致"
|
|
9652
9471
|
}),
|
|
9653
|
-
/* @__PURE__ */
|
|
9472
|
+
/* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
9654
9473
|
marginTop: 1,
|
|
9655
9474
|
flexDirection: "column",
|
|
9656
9475
|
children: [
|
|
9657
|
-
/* @__PURE__ */
|
|
9476
|
+
/* @__PURE__ */ jsx_runtime23.jsxs(Text, {
|
|
9658
9477
|
color: "yellow",
|
|
9659
9478
|
children: [
|
|
9660
|
-
"Claude Code
|
|
9479
|
+
"Claude Code 固定使用 ccstatusline-zh v",
|
|
9661
9480
|
mismatch.installedVersion,
|
|
9662
|
-
"
|
|
9481
|
+
",当前配置界面版本为 v",
|
|
9663
9482
|
mismatch.runningVersion,
|
|
9664
|
-
"
|
|
9483
|
+
"。"
|
|
9665
9484
|
]
|
|
9666
9485
|
}),
|
|
9667
|
-
/* @__PURE__ */
|
|
9486
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9668
9487
|
dimColor: true,
|
|
9669
9488
|
wrap: "wrap",
|
|
9670
|
-
children: "
|
|
9489
|
+
children: "为避免写入固定版本不支持的配置,请更新全局安装,或退出后重新启动固定版本。"
|
|
9671
9490
|
})
|
|
9672
9491
|
]
|
|
9673
9492
|
}),
|
|
9674
|
-
/* @__PURE__ */
|
|
9493
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Box_default, {
|
|
9675
9494
|
marginTop: 1,
|
|
9676
9495
|
flexDirection: "column",
|
|
9677
|
-
children: /* @__PURE__ */
|
|
9496
|
+
children: /* @__PURE__ */ jsx_runtime23.jsxs(Text, {
|
|
9678
9497
|
children: [
|
|
9679
|
-
"
|
|
9498
|
+
"当前固定版本:",
|
|
9680
9499
|
" ",
|
|
9681
9500
|
mismatch.relaunchCommand
|
|
9682
9501
|
]
|
|
9683
9502
|
})
|
|
9684
9503
|
}),
|
|
9685
|
-
/* @__PURE__ */
|
|
9504
|
+
updating ? /* @__PURE__ */ jsx_runtime23.jsx(Box_default, {
|
|
9505
|
+
marginTop: 1,
|
|
9506
|
+
children: /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
9507
|
+
color: "yellow",
|
|
9508
|
+
children: `正在将 ${mismatch.packageManager} 全局安装更新至 v${mismatch.runningVersion},请稍候...`
|
|
9509
|
+
})
|
|
9510
|
+
}) : /* @__PURE__ */ jsx_runtime23.jsx(List, {
|
|
9686
9511
|
marginTop: 1,
|
|
9687
9512
|
items: getPinnedMismatchItems(mismatch, canRunPackageManager),
|
|
9688
9513
|
onSelect: (value) => {
|
|
@@ -9748,8 +9573,8 @@ function getPinnedGlobalRelaunchCommand(packageManager) {
|
|
|
9748
9573
|
}
|
|
9749
9574
|
return "ccstatusline-zh";
|
|
9750
9575
|
}
|
|
9751
|
-
function getPinnedVersionMismatch(installation, runningVersion, relaunchCommand) {
|
|
9752
|
-
if (installation.method !== "pinned" || !installation.installedVersion || installation.packageManager === "unknown" || !runningVersion || installation.installedVersion === runningVersion) {
|
|
9576
|
+
function getPinnedVersionMismatch(installation, runningVersion, relaunchCommand, versionInstalledThisSession = null) {
|
|
9577
|
+
if (installation.method !== "pinned" || !installation.installedVersion || installation.packageManager === "unknown" || !runningVersion || installation.installedVersion === runningVersion || installation.installedVersion === versionInstalledThisSession) {
|
|
9753
9578
|
return null;
|
|
9754
9579
|
}
|
|
9755
9580
|
return {
|
|
@@ -9799,7 +9624,7 @@ function buildConfigLoadWarning(configLoadError) {
|
|
|
9799
9624
|
}
|
|
9800
9625
|
return `⚠ ${configLoadError}——当前显示默认配置;在此保存将覆盖原文件。`;
|
|
9801
9626
|
}
|
|
9802
|
-
function buildInvalidConfigSaveConfirm(configLoadError, onConfirm) {
|
|
9627
|
+
function buildInvalidConfigSaveConfirm(configLoadError, onConfirm, returnScreen = "main") {
|
|
9803
9628
|
if (!configLoadError) {
|
|
9804
9629
|
return null;
|
|
9805
9630
|
}
|
|
@@ -9809,7 +9634,7 @@ function buildInvalidConfigSaveConfirm(configLoadError, onConfirm) {
|
|
|
9809
9634
|
onConfirm();
|
|
9810
9635
|
return Promise.resolve();
|
|
9811
9636
|
},
|
|
9812
|
-
cancelScreen:
|
|
9637
|
+
cancelScreen: returnScreen
|
|
9813
9638
|
};
|
|
9814
9639
|
}
|
|
9815
9640
|
var App = () => {
|
|
@@ -9837,9 +9662,12 @@ var App = () => {
|
|
|
9837
9662
|
const [flowNotice, setFlowNotice] = import_react21.useState(null);
|
|
9838
9663
|
const [globalPackageInstallations, setGlobalPackageInstallations] = import_react21.useState([]);
|
|
9839
9664
|
const [updatesReturnScreen, setUpdatesReturnScreen] = import_react21.useState("main");
|
|
9665
|
+
const [versionInstalledThisSession, setVersionInstalledThisSession] = import_react21.useState(null);
|
|
9840
9666
|
const [hasLoadedClaudeStatus, setHasLoadedClaudeStatus] = import_react21.useState(false);
|
|
9841
9667
|
const [hasLoadedInstalledState, setHasLoadedInstalledState] = import_react21.useState(false);
|
|
9842
9668
|
const [importValidation, setImportValidation] = import_react21.useState(null);
|
|
9669
|
+
const [actionInFlight, setActionInFlight] = import_react21.useState(false);
|
|
9670
|
+
const actionInFlightRef = import_react21.useRef(false);
|
|
9843
9671
|
import_react21.useEffect(() => {
|
|
9844
9672
|
loadClaudeStatusLineState().then((statusLineState) => {
|
|
9845
9673
|
setExistingStatusLine(statusLineState.existingStatusLine);
|
|
@@ -9898,7 +9726,7 @@ var App = () => {
|
|
|
9898
9726
|
const installation = getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings);
|
|
9899
9727
|
const activeCommand = installation.method === "pinned" || installation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
|
|
9900
9728
|
const effectiveInstallation = getPathInferredInstallation(installation, activeCommand);
|
|
9901
|
-
const mismatch = getPinnedVersionMismatch(effectiveInstallation, getPackageVersion(), "ccstatusline-zh");
|
|
9729
|
+
const mismatch = getPinnedVersionMismatch(effectiveInstallation, getPackageVersion(), "ccstatusline-zh", versionInstalledThisSession);
|
|
9902
9730
|
if (mismatch) {
|
|
9903
9731
|
return;
|
|
9904
9732
|
}
|
|
@@ -9921,11 +9749,12 @@ var App = () => {
|
|
|
9921
9749
|
}
|
|
9922
9750
|
})();
|
|
9923
9751
|
};
|
|
9752
|
+
const returnScreen = screen;
|
|
9924
9753
|
const saveGuard = buildInvalidConfigSaveConfirm(configLoadError, () => {
|
|
9925
9754
|
setConfirmDialog(null);
|
|
9926
|
-
setScreen(
|
|
9755
|
+
setScreen(returnScreen);
|
|
9927
9756
|
performSave();
|
|
9928
|
-
});
|
|
9757
|
+
}, returnScreen);
|
|
9929
9758
|
if (saveGuard) {
|
|
9930
9759
|
setConfirmDialog(saveGuard);
|
|
9931
9760
|
setScreen("confirm");
|
|
@@ -10008,12 +9837,15 @@ ${resolutionWarning}`,
|
|
|
10008
9837
|
color: "green"
|
|
10009
9838
|
});
|
|
10010
9839
|
}
|
|
10011
|
-
} catch {
|
|
10012
|
-
setFlashMessage(
|
|
10013
|
-
|
|
10014
|
-
|
|
9840
|
+
} catch (err) {
|
|
9841
|
+
setFlashMessage(null);
|
|
9842
|
+
setFlowNotice({
|
|
9843
|
+
title: "安装失败",
|
|
9844
|
+
message: err instanceof Error ? err.message : String(err),
|
|
9845
|
+
color: "red",
|
|
9846
|
+
continueScreen: "install"
|
|
10015
9847
|
});
|
|
10016
|
-
setScreen("
|
|
9848
|
+
setScreen("flowNotice");
|
|
10017
9849
|
}
|
|
10018
9850
|
setConfirmDialog(null);
|
|
10019
9851
|
}
|
|
@@ -10049,6 +9881,7 @@ Claude 设置不会被修改。`,
|
|
|
10049
9881
|
action: async () => {
|
|
10050
9882
|
try {
|
|
10051
9883
|
await runGlobalUpdateAction(action);
|
|
9884
|
+
setVersionInstalledThisSession(action.version);
|
|
10052
9885
|
const installation = {
|
|
10053
9886
|
method: "pinned",
|
|
10054
9887
|
installedVersion: action.version
|
|
@@ -10134,7 +9967,7 @@ ${resolutionWarning}`,
|
|
|
10134
9967
|
setScreen("main");
|
|
10135
9968
|
}, [importValidation, settings]);
|
|
10136
9969
|
if (!settings || !hasLoadedClaudeStatus || !hasLoadedInstalledState) {
|
|
10137
|
-
return /* @__PURE__ */
|
|
9970
|
+
return /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10138
9971
|
children: "正在加载设置..."
|
|
10139
9972
|
});
|
|
10140
9973
|
}
|
|
@@ -10142,7 +9975,18 @@ ${resolutionWarning}`,
|
|
|
10142
9975
|
const currentInstallation = getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings);
|
|
10143
9976
|
const activeGlobalCommand = currentInstallation.method === "pinned" || currentInstallation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
|
|
10144
9977
|
const effectiveInstallation = getPathInferredInstallation(currentInstallation, activeGlobalCommand);
|
|
10145
|
-
const pinnedVersionMismatch = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager)) : null;
|
|
9978
|
+
const pinnedVersionMismatch = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager), versionInstalledThisSession) : null;
|
|
9979
|
+
const runActionOnce = (action) => {
|
|
9980
|
+
if (actionInFlightRef.current) {
|
|
9981
|
+
return;
|
|
9982
|
+
}
|
|
9983
|
+
actionInFlightRef.current = true;
|
|
9984
|
+
setActionInFlight(true);
|
|
9985
|
+
action().finally(() => {
|
|
9986
|
+
actionInFlightRef.current = false;
|
|
9987
|
+
setActionInFlight(false);
|
|
9988
|
+
});
|
|
9989
|
+
};
|
|
10146
9990
|
const handlePinnedVersionMismatchUpdate = async (mismatch) => {
|
|
10147
9991
|
try {
|
|
10148
9992
|
await runGlobalPackageInstall(mismatch.packageManager, mismatch.runningVersion);
|
|
@@ -10348,35 +10192,36 @@ ${GITHUB_REPO_URL}`,
|
|
|
10348
10192
|
}
|
|
10349
10193
|
};
|
|
10350
10194
|
if (pinnedVersionMismatch) {
|
|
10351
|
-
return /* @__PURE__ */
|
|
10195
|
+
return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
10352
10196
|
flexDirection: "column",
|
|
10353
10197
|
children: [
|
|
10354
|
-
/* @__PURE__ */
|
|
10198
|
+
/* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
10355
10199
|
marginBottom: 1,
|
|
10356
10200
|
children: [
|
|
10357
|
-
/* @__PURE__ */
|
|
10201
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10358
10202
|
bold: true,
|
|
10359
|
-
children: /* @__PURE__ */
|
|
10203
|
+
children: /* @__PURE__ */ jsx_runtime23.jsx(dist_default2, {
|
|
10360
10204
|
name: "retro",
|
|
10361
10205
|
children: "CCStatusline Configuration"
|
|
10362
10206
|
})
|
|
10363
10207
|
}),
|
|
10364
|
-
/* @__PURE__ */
|
|
10208
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10365
10209
|
bold: true,
|
|
10366
10210
|
children: ` | ${runningVersion && `v${runningVersion}`}`
|
|
10367
10211
|
}),
|
|
10368
|
-
flashMessage && /* @__PURE__ */
|
|
10212
|
+
flashMessage && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10369
10213
|
color: flashMessage.color,
|
|
10370
10214
|
bold: true,
|
|
10371
10215
|
children: ` ${flashMessage.text}`
|
|
10372
10216
|
})
|
|
10373
10217
|
]
|
|
10374
10218
|
}),
|
|
10375
|
-
/* @__PURE__ */
|
|
10219
|
+
/* @__PURE__ */ jsx_runtime23.jsx(PinnedVersionMismatchScreen, {
|
|
10376
10220
|
mismatch: pinnedVersionMismatch,
|
|
10377
10221
|
canRunPackageManager: commandAvailability[pinnedVersionMismatch.packageManager],
|
|
10222
|
+
updating: actionInFlight,
|
|
10378
10223
|
onUpdate: () => {
|
|
10379
|
-
handlePinnedVersionMismatchUpdate(pinnedVersionMismatch);
|
|
10224
|
+
runActionOnce(() => handlePinnedVersionMismatchUpdate(pinnedVersionMismatch));
|
|
10380
10225
|
},
|
|
10381
10226
|
onExit: exit
|
|
10382
10227
|
})
|
|
@@ -10396,49 +10241,49 @@ ${GITHUB_REPO_URL}`,
|
|
|
10396
10241
|
setScreen("items");
|
|
10397
10242
|
};
|
|
10398
10243
|
const configWarning = buildConfigLoadWarning(configLoadError);
|
|
10399
|
-
return /* @__PURE__ */
|
|
10244
|
+
return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
10400
10245
|
flexDirection: "column",
|
|
10401
10246
|
children: [
|
|
10402
|
-
/* @__PURE__ */
|
|
10247
|
+
/* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
10403
10248
|
marginBottom: 1,
|
|
10404
10249
|
children: [
|
|
10405
|
-
/* @__PURE__ */
|
|
10250
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10406
10251
|
bold: true,
|
|
10407
|
-
children: /* @__PURE__ */
|
|
10252
|
+
children: /* @__PURE__ */ jsx_runtime23.jsx(dist_default2, {
|
|
10408
10253
|
name: "retro",
|
|
10409
10254
|
children: "CCStatusline 配置"
|
|
10410
10255
|
})
|
|
10411
10256
|
}),
|
|
10412
|
-
/* @__PURE__ */
|
|
10257
|
+
/* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10413
10258
|
bold: true,
|
|
10414
10259
|
children: ` | ${runningVersion && `v${runningVersion}`}`
|
|
10415
10260
|
}),
|
|
10416
|
-
flashMessage && /* @__PURE__ */
|
|
10261
|
+
flashMessage && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10417
10262
|
color: flashMessage.color,
|
|
10418
10263
|
bold: true,
|
|
10419
10264
|
children: ` ${flashMessage.text}`
|
|
10420
10265
|
})
|
|
10421
10266
|
]
|
|
10422
10267
|
}),
|
|
10423
|
-
configWarning && /* @__PURE__ */
|
|
10268
|
+
configWarning && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10424
10269
|
color: "red",
|
|
10425
10270
|
wrap: "wrap",
|
|
10426
10271
|
children: configWarning
|
|
10427
10272
|
}),
|
|
10428
|
-
isCustomConfigPath() && /* @__PURE__ */
|
|
10273
|
+
isCustomConfigPath() && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
|
|
10429
10274
|
dimColor: true,
|
|
10430
10275
|
children: `配置文件:${getConfigPath()}`
|
|
10431
10276
|
}),
|
|
10432
|
-
/* @__PURE__ */
|
|
10277
|
+
/* @__PURE__ */ jsx_runtime23.jsx(StatusLinePreview, {
|
|
10433
10278
|
lines: settings.lines,
|
|
10434
10279
|
terminalWidth,
|
|
10435
10280
|
settings,
|
|
10436
10281
|
onTruncationChange: setPreviewIsTruncated
|
|
10437
10282
|
}),
|
|
10438
|
-
/* @__PURE__ */
|
|
10283
|
+
/* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
|
|
10439
10284
|
marginTop: 1,
|
|
10440
10285
|
children: [
|
|
10441
|
-
screen === "main" && /* @__PURE__ */
|
|
10286
|
+
screen === "main" && /* @__PURE__ */ jsx_runtime23.jsx(MainMenu, {
|
|
10442
10287
|
onSelect: (value, index) => {
|
|
10443
10288
|
if (value !== "save" && value !== "exit") {
|
|
10444
10289
|
setMenuSelections((prev) => ({ ...prev, main: index }));
|
|
@@ -10453,7 +10298,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10453
10298
|
installation: effectiveInstallation,
|
|
10454
10299
|
previewIsTruncated
|
|
10455
10300
|
}),
|
|
10456
|
-
screen === "lines" && /* @__PURE__ */
|
|
10301
|
+
screen === "lines" && /* @__PURE__ */ jsx_runtime23.jsx(LineSelector, {
|
|
10457
10302
|
lines: settings.lines,
|
|
10458
10303
|
onSelect: (line) => {
|
|
10459
10304
|
setMenuSelections((prev) => ({ ...prev, lines: line }));
|
|
@@ -10468,7 +10313,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10468
10313
|
title: "选择要编辑组件的行",
|
|
10469
10314
|
allowEditing: true
|
|
10470
10315
|
}),
|
|
10471
|
-
screen === "items" && /* @__PURE__ */
|
|
10316
|
+
screen === "items" && /* @__PURE__ */ jsx_runtime23.jsx(ItemsEditor, {
|
|
10472
10317
|
widgets: settings.lines[selectedLine] ?? [],
|
|
10473
10318
|
onUpdate: (widgets) => {
|
|
10474
10319
|
updateLine(selectedLine, widgets);
|
|
@@ -10480,7 +10325,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10480
10325
|
lineNumber: selectedLine + 1,
|
|
10481
10326
|
settings
|
|
10482
10327
|
}),
|
|
10483
|
-
screen === "colorLines" && /* @__PURE__ */
|
|
10328
|
+
screen === "colorLines" && /* @__PURE__ */ jsx_runtime23.jsx(LineSelector, {
|
|
10484
10329
|
lines: settings.lines,
|
|
10485
10330
|
onLinesUpdate: updateLines,
|
|
10486
10331
|
onSelect: (line) => {
|
|
@@ -10498,7 +10343,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10498
10343
|
settings,
|
|
10499
10344
|
allowEditing: false
|
|
10500
10345
|
}),
|
|
10501
|
-
screen === "colors" && /* @__PURE__ */
|
|
10346
|
+
screen === "colors" && /* @__PURE__ */ jsx_runtime23.jsx(ColorMenu, {
|
|
10502
10347
|
widgets: settings.lines[selectedLine] ?? [],
|
|
10503
10348
|
lineIndex: selectedLine,
|
|
10504
10349
|
settings,
|
|
@@ -10511,7 +10356,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10511
10356
|
setScreen("colorLines");
|
|
10512
10357
|
}
|
|
10513
10358
|
}),
|
|
10514
|
-
screen === "terminalConfig" && /* @__PURE__ */
|
|
10359
|
+
screen === "terminalConfig" && /* @__PURE__ */ jsx_runtime23.jsx(TerminalOptionsMenu, {
|
|
10515
10360
|
settings,
|
|
10516
10361
|
onUpdate: (updatedSettings) => {
|
|
10517
10362
|
setSettings(updatedSettings);
|
|
@@ -10525,7 +10370,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10525
10370
|
}
|
|
10526
10371
|
}
|
|
10527
10372
|
}),
|
|
10528
|
-
screen === "terminalWidth" && /* @__PURE__ */
|
|
10373
|
+
screen === "terminalWidth" && /* @__PURE__ */ jsx_runtime23.jsx(TerminalWidthMenu, {
|
|
10529
10374
|
settings,
|
|
10530
10375
|
onUpdate: (updatedSettings) => {
|
|
10531
10376
|
setSettings(updatedSettings);
|
|
@@ -10534,7 +10379,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10534
10379
|
setScreen("terminalConfig");
|
|
10535
10380
|
}
|
|
10536
10381
|
}),
|
|
10537
|
-
screen === "globalOverrides" && /* @__PURE__ */
|
|
10382
|
+
screen === "globalOverrides" && /* @__PURE__ */ jsx_runtime23.jsx(GlobalOverridesMenu, {
|
|
10538
10383
|
settings,
|
|
10539
10384
|
onUpdate: (updatedSettings) => {
|
|
10540
10385
|
setSettings(updatedSettings);
|
|
@@ -10544,22 +10389,25 @@ ${GITHUB_REPO_URL}`,
|
|
|
10544
10389
|
setScreen("main");
|
|
10545
10390
|
}
|
|
10546
10391
|
}),
|
|
10547
|
-
screen === "confirm" && confirmDialog && /* @__PURE__ */
|
|
10392
|
+
screen === "confirm" && confirmDialog && /* @__PURE__ */ jsx_runtime23.jsx(ConfirmDialog, {
|
|
10548
10393
|
message: confirmDialog.message,
|
|
10549
|
-
|
|
10394
|
+
busy: actionInFlight,
|
|
10395
|
+
onConfirm: () => {
|
|
10396
|
+
runActionOnce(confirmDialog.action);
|
|
10397
|
+
},
|
|
10550
10398
|
onCancel: () => {
|
|
10551
10399
|
setScreen(getConfirmCancelScreen(confirmDialog));
|
|
10552
10400
|
setConfirmDialog(null);
|
|
10553
10401
|
}
|
|
10554
10402
|
}),
|
|
10555
|
-
screen === "flowNotice" && flowNotice && /* @__PURE__ */
|
|
10403
|
+
screen === "flowNotice" && flowNotice && /* @__PURE__ */ jsx_runtime23.jsx(FlowNotice, {
|
|
10556
10404
|
...flowNotice,
|
|
10557
10405
|
onContinue: () => {
|
|
10558
10406
|
setScreen(flowNotice.continueScreen);
|
|
10559
10407
|
setFlowNotice(null);
|
|
10560
10408
|
}
|
|
10561
10409
|
}),
|
|
10562
|
-
screen === "install" && /* @__PURE__ */
|
|
10410
|
+
screen === "install" && /* @__PURE__ */ jsx_runtime23.jsx(InstallMenu, {
|
|
10563
10411
|
commandAvailability,
|
|
10564
10412
|
currentVersion: getPackageVersion(),
|
|
10565
10413
|
existingStatusLine,
|
|
@@ -10573,7 +10421,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10573
10421
|
onCancel: handleInstallMenuCancel,
|
|
10574
10422
|
initialPackageSelection: menuSelections.installPackage
|
|
10575
10423
|
}),
|
|
10576
|
-
screen === "manageInstallation" && /* @__PURE__ */
|
|
10424
|
+
screen === "manageInstallation" && /* @__PURE__ */ jsx_runtime23.jsx(ManageInstallationMenu, {
|
|
10577
10425
|
installation: effectiveInstallation,
|
|
10578
10426
|
activeCommand: activeGlobalCommand,
|
|
10579
10427
|
onSelect: handleManageInstallationSelect,
|
|
@@ -10585,7 +10433,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10585
10433
|
setScreen("main");
|
|
10586
10434
|
}
|
|
10587
10435
|
}),
|
|
10588
|
-
screen === "uninstallOptions" && /* @__PURE__ */
|
|
10436
|
+
screen === "uninstallOptions" && /* @__PURE__ */ jsx_runtime23.jsx(UninstallMenu, {
|
|
10589
10437
|
installations: globalPackageInstallations,
|
|
10590
10438
|
onSelect: (selection) => {
|
|
10591
10439
|
handleUninstallSelection(selection, "uninstallOptions");
|
|
@@ -10594,7 +10442,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10594
10442
|
setScreen("manageInstallation");
|
|
10595
10443
|
}
|
|
10596
10444
|
}),
|
|
10597
|
-
screen === "updates" && /* @__PURE__ */
|
|
10445
|
+
screen === "updates" && /* @__PURE__ */ jsx_runtime23.jsx(UpdateCheckerMenu, {
|
|
10598
10446
|
state: updateCheckerState,
|
|
10599
10447
|
onBack: () => {
|
|
10600
10448
|
setScreen(updatesReturnScreen);
|
|
@@ -10602,7 +10450,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10602
10450
|
onRefresh: handleUpdateCheck,
|
|
10603
10451
|
onRunAction: handleRunUpdateAction
|
|
10604
10452
|
}),
|
|
10605
|
-
screen === "refreshInterval" && /* @__PURE__ */
|
|
10453
|
+
screen === "refreshInterval" && /* @__PURE__ */ jsx_runtime23.jsx(RefreshIntervalMenu, {
|
|
10606
10454
|
currentInterval: currentRefreshInterval,
|
|
10607
10455
|
supportsRefreshInterval,
|
|
10608
10456
|
gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
|
|
@@ -10662,7 +10510,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10662
10510
|
setScreen("main");
|
|
10663
10511
|
}
|
|
10664
10512
|
}),
|
|
10665
|
-
screen === "powerline" && /* @__PURE__ */
|
|
10513
|
+
screen === "powerline" && /* @__PURE__ */ jsx_runtime23.jsx(PowerlineSetup, {
|
|
10666
10514
|
settings,
|
|
10667
10515
|
powerlineFontStatus,
|
|
10668
10516
|
onUpdate: (updatedSettings) => {
|
|
@@ -10689,7 +10537,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10689
10537
|
setFontInstallMessage(null);
|
|
10690
10538
|
}
|
|
10691
10539
|
}),
|
|
10692
|
-
screen === "exportConfig" && /* @__PURE__ */
|
|
10540
|
+
screen === "exportConfig" && /* @__PURE__ */ jsx_runtime23.jsx(ExportConfigDialog, {
|
|
10693
10541
|
onExport: (filePath) => {
|
|
10694
10542
|
handleExportConfig(filePath);
|
|
10695
10543
|
},
|
|
@@ -10697,7 +10545,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10697
10545
|
setScreen("main");
|
|
10698
10546
|
}
|
|
10699
10547
|
}),
|
|
10700
|
-
screen === "importConfig" && /* @__PURE__ */
|
|
10548
|
+
screen === "importConfig" && /* @__PURE__ */ jsx_runtime23.jsx(ImportConfigDialog, {
|
|
10701
10549
|
onFileChosen: (filePath) => {
|
|
10702
10550
|
handleImportFileChosen(filePath);
|
|
10703
10551
|
},
|
|
@@ -10705,7 +10553,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10705
10553
|
setScreen("main");
|
|
10706
10554
|
}
|
|
10707
10555
|
}),
|
|
10708
|
-
screen === "importPreview" && importValidation?.status === "valid" && /* @__PURE__ */
|
|
10556
|
+
screen === "importPreview" && importValidation?.status === "valid" && /* @__PURE__ */ jsx_runtime23.jsx(ImportPreviewDialog, {
|
|
10709
10557
|
validation: importValidation,
|
|
10710
10558
|
currentSettings: settings,
|
|
10711
10559
|
onApply: (mode) => {
|
|
@@ -10723,7 +10571,7 @@ ${GITHUB_REPO_URL}`,
|
|
|
10723
10571
|
};
|
|
10724
10572
|
function runTUI() {
|
|
10725
10573
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
10726
|
-
render_default(/* @__PURE__ */
|
|
10574
|
+
render_default(/* @__PURE__ */ jsx_runtime23.jsx(App, {}));
|
|
10727
10575
|
}
|
|
10728
10576
|
export {
|
|
10729
10577
|
runTUI
|