ideacode 1.3.4 → 1.3.6
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/dist/repl.js +19 -8
- package/dist/ui/theme.js +14 -1
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -208,6 +208,17 @@ function wrapLine(line, width) {
|
|
|
208
208
|
}
|
|
209
209
|
return out.length > 0 ? out : [""];
|
|
210
210
|
}
|
|
211
|
+
const BlinkingCaret = React.memo(function BlinkingCaret({ char, onColor, onBold, offColor, offBold, }) {
|
|
212
|
+
const [on, setOn] = useState(true);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
const t = setInterval(() => setOn((v) => !v), 530);
|
|
215
|
+
return () => clearInterval(t);
|
|
216
|
+
}, []);
|
|
217
|
+
if (on) {
|
|
218
|
+
return (_jsx(Text, { inverse: true, color: onColor, bold: onBold, children: char }));
|
|
219
|
+
}
|
|
220
|
+
return (_jsx(Text, { color: offColor, bold: offBold ?? onBold, children: char }));
|
|
221
|
+
});
|
|
211
222
|
function replayMessagesToLogLines(messages) {
|
|
212
223
|
const sanitizePrompt = (value) => value
|
|
213
224
|
.replace(/\x1b\[[0-9;]*m/g, "")
|
|
@@ -420,9 +431,9 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
420
431
|
const typingFreezeTimerRef = useRef(null);
|
|
421
432
|
useEffect(() => {
|
|
422
433
|
// Enable SGR mouse + basic tracking so trackpad wheel scrolling works.
|
|
423
|
-
process.stdout.write("\x1b[?1006h\x1b[?1000h");
|
|
434
|
+
process.stdout.write("\x1b[?1006h\x1b[?1000h\x1b[?12h");
|
|
424
435
|
return () => {
|
|
425
|
-
process.stdout.write("\x1b[?1006l\x1b[?1000l");
|
|
436
|
+
process.stdout.write("\x1b[?1006l\x1b[?1000l\x1b[?12l");
|
|
426
437
|
};
|
|
427
438
|
}, []);
|
|
428
439
|
useEffect(() => {
|
|
@@ -1312,7 +1323,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1312
1323
|
}).map((_, idx) => (_jsx(Text, { children: "\u00A0" }, `slash-pad-${idx}`))), _jsx(Text, { color: inkColors.textSecondary, children: " Commands (\u2191/\u2193 select, Enter run, Esc clear) " })] })), cursorInAtSegment && !showSlashSuggestions && (_jsxs(Box, { flexDirection: "column", marginBottom: 0, paddingLeft: 2, borderStyle: "single", borderColor: inkColors.textDisabled, children: [filteredFilePaths.length === 0 ? (_jsxs(Text, { color: inkColors.textSecondary, children: [" ", hasCharsAfterAt ? "No match" : "Type to search files", " "] })) : ([...filteredFilePaths].reverse().map((p, rev) => {
|
|
1313
1324
|
const i = filteredFilePaths.length - 1 - rev;
|
|
1314
1325
|
return (_jsxs(Text, { color: i === clampedAtFileIndex ? inkColors.primary : undefined, children: [i === clampedAtFileIndex ? "› " : " ", p] }, p));
|
|
1315
|
-
})), _jsx(Box, { flexDirection: "row", marginTop: 1, children: _jsx(Text, { color: inkColors.textSecondary, children: " Files (\u2191/\u2193 select, Enter/Tab complete, Esc clear) " }) })] })), _jsxs(Box, { flexDirection: "row", marginTop: 0, children: [_jsxs(Text, { color: inkColors.footerHint, children: [" ", icons.tool, " ", tokenDisplay] }), _jsx(Text, { color: inkColors.footerHint, children: ` · / ! @ trackpad/↑/↓ scroll Ctrl+J newline Tab queue Esc Esc edit` })] }), _jsx(Box, { flexDirection: "column", marginTop: 0, children: inputValue.length === 0 ? (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: inkColors.primary, children: [icons.prompt, " "] }), cursorBlinkOn ? (_jsx(
|
|
1326
|
+
})), _jsx(Box, { flexDirection: "row", marginTop: 1, children: _jsx(Text, { color: inkColors.textSecondary, children: " Files (\u2191/\u2193 select, Enter/Tab complete, Esc clear) " }) })] })), _jsxs(Box, { flexDirection: "row", marginTop: 0, children: [_jsxs(Text, { color: inkColors.footerHint, children: [" ", icons.tool, " ", tokenDisplay] }), _jsx(Text, { color: inkColors.footerHint, children: ` · / ! @ trackpad/↑/↓ scroll Ctrl+J newline Tab queue Esc Esc edit` })] }), _jsx(Box, { flexDirection: "column", marginTop: 0, children: inputValue.length === 0 ? (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: inkColors.primary, children: [icons.prompt, " "] }), cursorBlinkOn ? (_jsx(BlinkingCaret, { char: "\u00A0", onColor: inkColors.primary, offColor: inkColors.primary })) : (_jsx(Text, { color: inkColors.primary, children: " " })), _jsx(Text, { color: inkColors.textSecondary, children: "Message or / for commands, @ for files, ! for shell, ? for help..." })] })) : ((() => {
|
|
1316
1327
|
const lines = inputValue.split("\n");
|
|
1317
1328
|
let lineStart = 0;
|
|
1318
1329
|
return (_jsx(_Fragment, { children: lines.flatMap((lineText, lineIdx) => {
|
|
@@ -1341,7 +1352,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1341
1352
|
const rowNodes = [];
|
|
1342
1353
|
if (lineText === "" && v === 0 && cursorOnThisLine) {
|
|
1343
1354
|
rowNodes.push(cursorBlinkOn
|
|
1344
|
-
? (_jsx(
|
|
1355
|
+
? (_jsx(BlinkingCaret, { char: "\u00A0", onColor: inkColors.primary, offColor: inkColors.primary }, "cursor-empty-on"))
|
|
1345
1356
|
: (_jsx(Text, { color: inkColors.primary, children: "\u00A0" }, "cursor-empty-off")));
|
|
1346
1357
|
}
|
|
1347
1358
|
else if (cursorPosInVisual >= 0) {
|
|
@@ -1354,7 +1365,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1354
1365
|
: "";
|
|
1355
1366
|
rowNodes.push(_jsx(Text, { children: before }, "plain-before"));
|
|
1356
1367
|
rowNodes.push(cursorBlinkOn
|
|
1357
|
-
? (_jsx(
|
|
1368
|
+
? (_jsx(BlinkingCaret, { char: curChar, onColor: inkColors.primary }, "plain-caret-on"))
|
|
1358
1369
|
: (_jsx(Text, { children: curChar }, "plain-caret-off")));
|
|
1359
1370
|
rowNodes.push(_jsx(Text, { children: after }, "plain-after"));
|
|
1360
1371
|
}
|
|
@@ -1428,7 +1439,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1428
1439
|
const lineNodes = [];
|
|
1429
1440
|
if (lineText === "" && v === 0 && cursorOnThisLine) {
|
|
1430
1441
|
lineNodes.push(cursorBlinkOn
|
|
1431
|
-
? (_jsx(
|
|
1442
|
+
? (_jsx(BlinkingCaret, { char: "\u00A0", onColor: inkColors.primary, offColor: inkColors.primary }, "cursor-on"))
|
|
1432
1443
|
: (_jsx(Text, { color: inkColors.primary, children: "\u00A0" }, "cursor-off")));
|
|
1433
1444
|
}
|
|
1434
1445
|
else {
|
|
@@ -1450,7 +1461,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1450
1461
|
const usePath = "color" in seg.style && !!seg.style.color;
|
|
1451
1462
|
lineNodes.push(_jsx(Text, { ...seg.style, children: before }, `${segIdx}-a`));
|
|
1452
1463
|
if (cursorBlinkOn) {
|
|
1453
|
-
lineNodes.push(_jsx(
|
|
1464
|
+
lineNodes.push(_jsx(BlinkingCaret, { char: curChar, onColor: usePath ? inkColors.path : inkColors.primary, onBold: "bold" in seg.style && !!seg.style.bold, offColor: "color" in seg.style ? seg.style.color : undefined, offBold: "bold" in seg.style ? !!seg.style.bold : undefined }, `${segIdx}-b-on`));
|
|
1454
1465
|
}
|
|
1455
1466
|
else {
|
|
1456
1467
|
lineNodes.push(_jsx(Text, { ...seg.style, children: curChar }, `${segIdx}-b-off`));
|
|
@@ -1468,7 +1479,7 @@ export function Repl({ apiKey, cwd, onQuit }) {
|
|
|
1468
1479
|
});
|
|
1469
1480
|
if (cursorPosInVisual >= 0 && !cursorRendered) {
|
|
1470
1481
|
lineNodes.push(cursorBlinkOn
|
|
1471
|
-
? (_jsx(
|
|
1482
|
+
? (_jsx(BlinkingCaret, { char: "\u00A0", onColor: inkColors.primary, offColor: inkColors.primary }, "cursor-end-on"))
|
|
1472
1483
|
: (_jsx(Text, { color: inkColors.primary, children: "\u00A0" }, "cursor-end-off")));
|
|
1473
1484
|
}
|
|
1474
1485
|
}
|
package/dist/ui/theme.js
CHANGED
|
@@ -83,6 +83,19 @@ function isDarkMode() {
|
|
|
83
83
|
return true;
|
|
84
84
|
return n <= 7;
|
|
85
85
|
}
|
|
86
|
+
function hasTrueColor() {
|
|
87
|
+
const colorterm = (process.env.COLORTERM ?? "").toLowerCase();
|
|
88
|
+
if (colorterm.includes("truecolor") || colorterm.includes("24bit"))
|
|
89
|
+
return true;
|
|
90
|
+
const term = (process.env.TERM ?? "").toLowerCase();
|
|
91
|
+
return term.includes("direct");
|
|
92
|
+
}
|
|
93
|
+
function resolveFooterHintColor(base) {
|
|
94
|
+
const inTmux = Boolean(process.env.TMUX);
|
|
95
|
+
if (inTmux && !hasTrueColor())
|
|
96
|
+
return "#5a5a5a";
|
|
97
|
+
return base;
|
|
98
|
+
}
|
|
86
99
|
const theme = isDarkMode() ? THEME_DARK : THEME_LIGHT;
|
|
87
100
|
export { theme };
|
|
88
101
|
export const colors = {
|
|
@@ -125,6 +138,6 @@ export const inkColors = {
|
|
|
125
138
|
textPrimary: theme.colors.text.primary,
|
|
126
139
|
textSecondary: theme.colors.text.secondary,
|
|
127
140
|
textDisabled: theme.colors.text.disabled,
|
|
128
|
-
footerHint: theme.colors.text.footerHint,
|
|
141
|
+
footerHint: resolveFooterHintColor(theme.colors.text.footerHint),
|
|
129
142
|
};
|
|
130
143
|
export const icons = theme.icons;
|