spawn-term 3.0.4 → 3.0.5
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/cjs/components/App.js +10 -47
- package/dist/cjs/components/App.js.map +1 -1
- package/dist/cjs/components/ErrorFooter.js +120 -0
- package/dist/cjs/components/ErrorFooter.js.map +1 -0
- package/dist/cjs/components/ExpandedOutput.js +0 -2
- package/dist/cjs/components/ExpandedOutput.js.map +1 -1
- package/dist/cjs/components/StatusBar.js +22 -33
- package/dist/cjs/components/StatusBar.js.map +1 -1
- package/dist/cjs/src/components/ErrorFooter.d.ts +11 -0
- package/dist/cjs/src/state/processStore.d.ts +9 -6
- package/dist/cjs/state/processStore.js +23 -20
- package/dist/cjs/state/processStore.js.map +1 -1
- package/dist/esm/components/App.js +10 -47
- package/dist/esm/components/App.js.map +1 -1
- package/dist/esm/components/ErrorFooter.js +95 -0
- package/dist/esm/components/ErrorFooter.js.map +1 -0
- package/dist/esm/components/ExpandedOutput.js +0 -2
- package/dist/esm/components/ExpandedOutput.js.map +1 -1
- package/dist/esm/components/StatusBar.js +22 -33
- package/dist/esm/components/StatusBar.js.map +1 -1
- package/dist/esm/src/components/ErrorFooter.d.ts +11 -0
- package/dist/esm/src/state/processStore.d.ts +9 -6
- package/dist/esm/state/processStore.js +19 -18
- package/dist/esm/state/processStore.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/ErrorDetailModal.js +0 -115
- package/dist/cjs/components/ErrorDetailModal.js.map +0 -1
- package/dist/cjs/components/ErrorListModal.js +0 -135
- package/dist/cjs/components/ErrorListModal.js.map +0 -1
- package/dist/cjs/src/components/ErrorDetailModal.d.ts +0 -8
- package/dist/cjs/src/components/ErrorListModal.d.ts +0 -8
- package/dist/esm/components/ErrorDetailModal.js +0 -99
- package/dist/esm/components/ErrorDetailModal.js.map +0 -1
- package/dist/esm/components/ErrorListModal.js +0 -116
- package/dist/esm/components/ErrorListModal.js.map +0 -1
- package/dist/esm/src/components/ErrorDetailModal.d.ts +0 -8
- package/dist/esm/src/components/ErrorListModal.d.ts +0 -8
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useStdout } from 'ink';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import figures from '../lib/figures.js';
|
|
5
|
-
import { LineType } from '../types.js';
|
|
6
|
-
function truncate(str, maxLength) {
|
|
7
|
-
if (str.length <= maxLength) return str;
|
|
8
|
-
return `${str.slice(0, maxLength - 1)}…`;
|
|
9
|
-
}
|
|
10
|
-
function getErrorLineCount(process) {
|
|
11
|
-
return process.lines.filter((l)=>l.type === LineType.stderr).length;
|
|
12
|
-
}
|
|
13
|
-
export default /*#__PURE__*/ memo(function ErrorListModal({ errors, selectedIndex, totalErrorLines }) {
|
|
14
|
-
const { stdout } = useStdout();
|
|
15
|
-
const width = (stdout === null || stdout === void 0 ? void 0 : stdout.columns) || 80;
|
|
16
|
-
const innerWidth = width - 4; // 2 chars padding each side
|
|
17
|
-
const borderH = '─'.repeat(width - 2);
|
|
18
|
-
const title = ' Errors ';
|
|
19
|
-
const titleBorder = `┌${title}${borderH.slice(title.length + 1)}┐`;
|
|
20
|
-
return /*#__PURE__*/ _jsxs(Box, {
|
|
21
|
-
flexDirection: "column",
|
|
22
|
-
children: [
|
|
23
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
24
|
-
children: titleBorder
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
27
|
-
paddingX: 1,
|
|
28
|
-
children: /*#__PURE__*/ _jsxs(Text, {
|
|
29
|
-
children: [
|
|
30
|
-
errors.length,
|
|
31
|
-
" process",
|
|
32
|
-
errors.length !== 1 ? 'es' : '',
|
|
33
|
-
" failed (",
|
|
34
|
-
totalErrorLines,
|
|
35
|
-
" error line",
|
|
36
|
-
totalErrorLines !== 1 ? 's' : '',
|
|
37
|
-
" total)"
|
|
38
|
-
]
|
|
39
|
-
})
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
42
|
-
paddingX: 1,
|
|
43
|
-
children: /*#__PURE__*/ _jsx(Text, {
|
|
44
|
-
children: " "
|
|
45
|
-
})
|
|
46
|
-
}),
|
|
47
|
-
errors.map((error, index)=>{
|
|
48
|
-
const isSelected = index === selectedIndex;
|
|
49
|
-
const indicator = isSelected ? figures.pointer : ' ';
|
|
50
|
-
const name = error.group || error.title;
|
|
51
|
-
const lineCount = getErrorLineCount(error);
|
|
52
|
-
const lineText = `${lineCount} line${lineCount !== 1 ? 's' : ''}`;
|
|
53
|
-
// Calculate available space for name
|
|
54
|
-
const prefixLen = 3; // indicator + space + space
|
|
55
|
-
const suffixLen = lineText.length + 2; // space + lineText
|
|
56
|
-
const maxNameLen = innerWidth - prefixLen - suffixLen;
|
|
57
|
-
const truncatedName = truncate(name, maxNameLen);
|
|
58
|
-
return /*#__PURE__*/ _jsxs(Box, {
|
|
59
|
-
paddingX: 1,
|
|
60
|
-
children: [
|
|
61
|
-
/*#__PURE__*/ _jsxs(Text, {
|
|
62
|
-
color: isSelected ? 'cyan' : undefined,
|
|
63
|
-
bold: isSelected,
|
|
64
|
-
children: [
|
|
65
|
-
indicator,
|
|
66
|
-
" ",
|
|
67
|
-
truncatedName
|
|
68
|
-
]
|
|
69
|
-
}),
|
|
70
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
71
|
-
flexGrow: 1
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
74
|
-
dimColor: true,
|
|
75
|
-
children: lineText
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
}, error.id);
|
|
79
|
-
}),
|
|
80
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
81
|
-
paddingX: 1,
|
|
82
|
-
children: /*#__PURE__*/ _jsx(Text, {
|
|
83
|
-
children: " "
|
|
84
|
-
})
|
|
85
|
-
}),
|
|
86
|
-
/*#__PURE__*/ _jsxs(Text, {
|
|
87
|
-
children: [
|
|
88
|
-
"├",
|
|
89
|
-
borderH,
|
|
90
|
-
"┤"
|
|
91
|
-
]
|
|
92
|
-
}),
|
|
93
|
-
/*#__PURE__*/ _jsxs(Box, {
|
|
94
|
-
paddingX: 1,
|
|
95
|
-
justifyContent: "space-between",
|
|
96
|
-
children: [
|
|
97
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
98
|
-
dimColor: true,
|
|
99
|
-
children: "[↑↓] navigate [Enter] view details"
|
|
100
|
-
}),
|
|
101
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
102
|
-
dimColor: true,
|
|
103
|
-
children: "[Esc] close"
|
|
104
|
-
})
|
|
105
|
-
]
|
|
106
|
-
}),
|
|
107
|
-
/*#__PURE__*/ _jsxs(Text, {
|
|
108
|
-
children: [
|
|
109
|
-
"└",
|
|
110
|
-
borderH,
|
|
111
|
-
"┘"
|
|
112
|
-
]
|
|
113
|
-
})
|
|
114
|
-
]
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ErrorListModal.tsx"],"sourcesContent":["import { Box, Text, useStdout } from 'ink';\nimport { memo } from 'react';\nimport figures from '../lib/figures.ts';\nimport type { ChildProcess } from '../types.ts';\nimport { LineType } from '../types.ts';\n\ntype Props = {\n errors: ChildProcess[];\n selectedIndex: number;\n totalErrorLines: number;\n};\n\nfunction truncate(str: string, maxLength: number): string {\n if (str.length <= maxLength) return str;\n return `${str.slice(0, maxLength - 1)}…`;\n}\n\nfunction getErrorLineCount(process: ChildProcess): number {\n return process.lines.filter((l) => l.type === LineType.stderr).length;\n}\n\nexport default memo(function ErrorListModal({ errors, selectedIndex, totalErrorLines }: Props) {\n const { stdout } = useStdout();\n const width = stdout?.columns || 80;\n const innerWidth = width - 4; // 2 chars padding each side\n\n const borderH = '─'.repeat(width - 2);\n const title = ' Errors ';\n const titleBorder = `┌${title}${borderH.slice(title.length + 1)}┐`;\n\n return (\n <Box flexDirection=\"column\">\n {/* Top border with title */}\n <Text>{titleBorder}</Text>\n\n {/* Summary */}\n <Box paddingX={1}>\n <Text>\n {errors.length} process{errors.length !== 1 ? 'es' : ''} failed ({totalErrorLines} error line\n {totalErrorLines !== 1 ? 's' : ''} total)\n </Text>\n </Box>\n\n {/* Empty line */}\n <Box paddingX={1}>\n <Text> </Text>\n </Box>\n\n {/* Error list */}\n {errors.map((error, index) => {\n const isSelected = index === selectedIndex;\n const indicator = isSelected ? figures.pointer : ' ';\n const name = error.group || error.title;\n const lineCount = getErrorLineCount(error);\n const lineText = `${lineCount} line${lineCount !== 1 ? 's' : ''}`;\n\n // Calculate available space for name\n const prefixLen = 3; // indicator + space + space\n const suffixLen = lineText.length + 2; // space + lineText\n const maxNameLen = innerWidth - prefixLen - suffixLen;\n const truncatedName = truncate(name, maxNameLen);\n\n return (\n <Box key={error.id} paddingX={1}>\n <Text color={isSelected ? 'cyan' : undefined} bold={isSelected}>\n {indicator} {truncatedName}\n </Text>\n <Box flexGrow={1} />\n <Text dimColor>{lineText}</Text>\n </Box>\n );\n })}\n\n {/* Empty line for padding */}\n <Box paddingX={1}>\n <Text> </Text>\n </Box>\n\n {/* Bottom border with hints */}\n <Text>├{borderH}┤</Text>\n <Box paddingX={1} justifyContent=\"space-between\">\n <Text dimColor>[↑↓] navigate [Enter] view details</Text>\n <Text dimColor>[Esc] close</Text>\n </Box>\n <Text>└{borderH}┘</Text>\n </Box>\n );\n});\n"],"names":["Box","Text","useStdout","memo","figures","LineType","truncate","str","maxLength","length","slice","getErrorLineCount","process","lines","filter","l","type","stderr","ErrorListModal","errors","selectedIndex","totalErrorLines","stdout","width","columns","innerWidth","borderH","repeat","title","titleBorder","flexDirection","paddingX","map","error","index","isSelected","indicator","pointer","name","group","lineCount","lineText","prefixLen","suffixLen","maxNameLen","truncatedName","color","undefined","bold","flexGr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