project-compass 1.0.2 → 1.0.4
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/package.json +1 -1
- package/src/cli.js +23 -9
- package/project-compass-1.0.2.tgz +0 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -772,6 +772,7 @@ const ACTION_MAP = {
|
|
|
772
772
|
const ART_CHARS = ['▁', '▃', '▄', '▅', '▇'];
|
|
773
773
|
const ART_COLORS = ['magenta', 'blue', 'cyan', 'yellow', 'red'];
|
|
774
774
|
const OUTPUT_WINDOW_SIZE = 10;
|
|
775
|
+
const OUTPUT_WINDOW_HEIGHT = OUTPUT_WINDOW_SIZE + 2;
|
|
775
776
|
const RECENT_RUN_LIMIT = 5;
|
|
776
777
|
|
|
777
778
|
function useScanner(rootPath) {
|
|
@@ -972,14 +973,20 @@ function Compass({rootPath}) {
|
|
|
972
973
|
return;
|
|
973
974
|
}
|
|
974
975
|
|
|
976
|
+
const scrollLogs = (delta) => {
|
|
977
|
+
setLogOffset((prev) => {
|
|
978
|
+
const maxScroll = Math.max(0, logLines.length - OUTPUT_WINDOW_SIZE);
|
|
979
|
+
return Math.max(0, Math.min(maxScroll, prev + delta));
|
|
980
|
+
});
|
|
981
|
+
};
|
|
982
|
+
|
|
975
983
|
if (key.mouse) {
|
|
976
984
|
if (key.mouse === 'left' && projects.length > 0) {
|
|
977
985
|
setSelectedIndex((prev) => (prev + 1) % projects.length);
|
|
978
|
-
} else if (key.mouse === 'scrollUp') {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
setLogOffset((prev) => Math.max(0, prev - 1));
|
|
986
|
+
} else if (key.mouse === 'scrollUp' || key.mouse === 'wheelUp') {
|
|
987
|
+
scrollLogs(1);
|
|
988
|
+
} else if (key.mouse === 'scrollDown' || key.mouse === 'wheelDown') {
|
|
989
|
+
scrollLogs(-1);
|
|
983
990
|
}
|
|
984
991
|
return;
|
|
985
992
|
}
|
|
@@ -1311,10 +1318,12 @@ function Compass({rootPath}) {
|
|
|
1311
1318
|
Box,
|
|
1312
1319
|
{
|
|
1313
1320
|
flex: 1,
|
|
1321
|
+
flexBasis: 0,
|
|
1314
1322
|
marginRight: 1,
|
|
1315
1323
|
borderStyle: 'round',
|
|
1316
1324
|
borderColor: 'magenta',
|
|
1317
|
-
padding: 1
|
|
1325
|
+
padding: 1,
|
|
1326
|
+
minWidth: 0
|
|
1318
1327
|
},
|
|
1319
1328
|
create(Text, {bold: true, color: 'magenta'}, 'Projects'),
|
|
1320
1329
|
create(Box, {flexDirection: 'column', marginTop: 1}, ...projectRows)
|
|
@@ -1323,9 +1332,11 @@ function Compass({rootPath}) {
|
|
|
1323
1332
|
Box,
|
|
1324
1333
|
{
|
|
1325
1334
|
flex: 1,
|
|
1335
|
+
flexBasis: 0,
|
|
1326
1336
|
borderStyle: 'round',
|
|
1327
1337
|
borderColor: 'cyan',
|
|
1328
|
-
padding: 1
|
|
1338
|
+
padding: 1,
|
|
1339
|
+
minWidth: 0
|
|
1329
1340
|
},
|
|
1330
1341
|
create(Text, {bold: true, color: 'cyan'}, 'Details'),
|
|
1331
1342
|
...detailContent
|
|
@@ -1347,8 +1358,11 @@ function Compass({rootPath}) {
|
|
|
1347
1358
|
borderStyle: 'round',
|
|
1348
1359
|
borderColor: 'yellow',
|
|
1349
1360
|
padding: 1,
|
|
1350
|
-
minHeight:
|
|
1351
|
-
|
|
1361
|
+
minHeight: OUTPUT_WINDOW_HEIGHT,
|
|
1362
|
+
maxHeight: OUTPUT_WINDOW_HEIGHT,
|
|
1363
|
+
height: OUTPUT_WINDOW_HEIGHT,
|
|
1364
|
+
overflow: 'hidden',
|
|
1365
|
+
flexShrink: 0
|
|
1352
1366
|
},
|
|
1353
1367
|
...logNodes
|
|
1354
1368
|
),
|
|
Binary file
|