spawn-term 3.2.2 → 3.2.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.
|
@@ -17,6 +17,7 @@ var ENTER_ALT_SCREEN = '\x1b[?1049h';
|
|
|
17
17
|
var EXIT_ALT_SCREEN = '\x1b[?1049l';
|
|
18
18
|
var CLEAR_SCREEN = '\x1b[2J';
|
|
19
19
|
var CURSOR_HOME = '\x1b[H';
|
|
20
|
+
var HIDE_CURSOR = '\x1b[?25l';
|
|
20
21
|
var _default = /*#__PURE__*/ (0, _react.memo)(function FullscreenOverlay(param) {
|
|
21
22
|
var title = param.title, lines = param.lines, scrollOffset = param.scrollOffset;
|
|
22
23
|
var stdout = (0, _ink.useStdout)().stdout;
|
|
@@ -26,9 +27,10 @@ var _default = /*#__PURE__*/ (0, _react.memo)(function FullscreenOverlay(param)
|
|
|
26
27
|
var footerLines = 1;
|
|
27
28
|
var maxVisible = Math.max(1, terminalHeight - headerLines - footerLines);
|
|
28
29
|
// Enter alternate screen on mount, exit on unmount
|
|
29
|
-
|
|
30
|
+
// useLayoutEffect ensures cleanup runs synchronously before ink re-renders
|
|
31
|
+
(0, _react.useLayoutEffect)(function() {
|
|
30
32
|
if (stdout) {
|
|
31
|
-
stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME);
|
|
33
|
+
stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME + HIDE_CURSOR);
|
|
32
34
|
}
|
|
33
35
|
return function() {
|
|
34
36
|
if (stdout) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/FullscreenOverlay.tsx"],"sourcesContent":["import { Box, Text, useStdout } from 'ink';\nimport { memo,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/FullscreenOverlay.tsx"],"sourcesContent":["import { Box, Text, useStdout } from 'ink';\nimport { memo, useLayoutEffect } from 'react';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\n// ANSI escape codes for alternate screen buffer\nconst ENTER_ALT_SCREEN = '\\x1b[?1049h';\nconst EXIT_ALT_SCREEN = '\\x1b[?1049l';\nconst CLEAR_SCREEN = '\\x1b[2J';\nconst CURSOR_HOME = '\\x1b[H';\nconst HIDE_CURSOR = '\\x1b[?25l';\n\ntype Props = {\n title: string;\n lines: Line[];\n scrollOffset: number;\n onExit: () => void;\n};\n\nexport default memo(function FullscreenOverlay({ title, lines, scrollOffset }: Props) {\n const { stdout } = useStdout();\n const terminalHeight = stdout?.rows || 24;\n\n // Reserve lines for header (title + divider) and footer (scroll hint)\n const headerLines = 2;\n const footerLines = 1;\n const maxVisible = Math.max(1, terminalHeight - headerLines - footerLines);\n\n // Enter alternate screen on mount, exit on unmount\n // useLayoutEffect ensures cleanup runs synchronously before ink re-renders\n useLayoutEffect(() => {\n if (stdout) {\n stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME + HIDE_CURSOR);\n }\n return () => {\n if (stdout) {\n stdout.write(EXIT_ALT_SCREEN);\n }\n };\n }, [stdout]);\n\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const totalLines = lines.length;\n const currentLine = scrollOffset + 1;\n const endLine = Math.min(scrollOffset + maxVisible, totalLines);\n\n return (\n <Box flexDirection=\"column\" height={terminalHeight}>\n {/* Header */}\n <Text bold color=\"cyan\">\n {title}\n </Text>\n <Text dimColor>{'─'.repeat(Math.min(80, stdout?.columns || 80))}</Text>\n\n {/* Content */}\n <Box flexDirection=\"column\" flexGrow={1}>\n {lines.length === 0 ? (\n <Text dimColor>(no output)</Text>\n ) : (\n visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>{line.text}</Text>\n ))\n )}\n </Box>\n\n {/* Footer */}\n <Text dimColor>\n Lines {currentLine}-{endLine} of {totalLines} | j/k scroll | Tab/⇧Tab page | {isMac ? '⌥↑/↓' : 'g/G'} top/bottom | ↵/q exit\n </Text>\n </Box>\n );\n});\n"],"names":["isMac","process","platform","ENTER_ALT_SCREEN","EXIT_ALT_SCREEN","CLEAR_SCREEN","CURSOR_HOME","HIDE_CURSOR","memo","FullscreenOverlay","title","lines","scrollOffset","stdout","useStdout","terminalHeight","rows","headerLines","footerLines","maxVisible","Math","max","useLayoutEffect","write","visibleLines","slice","totalLines","length","currentLine","endLine","min","Box","flexDirection","height","Text","bold","color","dimColor","repeat","columns","flexGrow","map","line","i","text"],"mappings":";;;;+BAoBA;;;eAAA;;;;mBApBqC;qBACC;AAGtC,IAAMA,QAAQC,QAAQC,QAAQ,KAAK;AAEnC,gDAAgD;AAChD,IAAMC,mBAAmB;AACzB,IAAMC,kBAAkB;AACxB,IAAMC,eAAe;AACrB,IAAMC,cAAc;AACpB,IAAMC,cAAc;IASpB,yBAAeC,IAAAA,WAAI,EAAC,SAASC,kBAAkB,KAAqC;QAAnCC,QAAF,MAAEA,OAAOC,QAAT,MAASA,OAAOC,eAAhB,MAAgBA;IAC7D,IAAM,AAAEC,SAAWC,IAAAA,cAAS,IAApBD;IACR,IAAME,iBAAiBF,CAAAA,mBAAAA,6BAAAA,OAAQG,IAAI,KAAI;IAEvC,sEAAsE;IACtE,IAAMC,cAAc;IACpB,IAAMC,cAAc;IACpB,IAAMC,aAAaC,KAAKC,GAAG,CAAC,GAAGN,iBAAiBE,cAAcC;IAE9D,mDAAmD;IACnD,2EAA2E;IAC3EI,IAAAA,sBAAe,EAAC;QACd,IAAIT,QAAQ;YACVA,OAAOU,KAAK,CAACpB,mBAAmBE,eAAeC,cAAcC;QAC/D;QACA,OAAO;YACL,IAAIM,QAAQ;gBACVA,OAAOU,KAAK,CAACnB;YACf;QACF;IACF,GAAG;QAACS;KAAO;IAEX,IAAMW,eAAeb,MAAMc,KAAK,CAACb,cAAcA,eAAeO;IAC9D,IAAMO,aAAaf,MAAMgB,MAAM;IAC/B,IAAMC,cAAchB,eAAe;IACnC,IAAMiB,UAAUT,KAAKU,GAAG,CAAClB,eAAeO,YAAYO;IAEpD,qBACE,sBAACK,QAAG;QAACC,eAAc;QAASC,QAAQlB;;0BAElC,qBAACmB,SAAI;gBAACC,IAAI;gBAACC,OAAM;0BACd1B;;0BAEH,qBAACwB,SAAI;gBAACG,QAAQ;0BAAE,IAAIC,MAAM,CAAClB,KAAKU,GAAG,CAAC,IAAIjB,CAAAA,mBAAAA,6BAAAA,OAAQ0B,OAAO,KAAI;;0BAG3D,qBAACR,QAAG;gBAACC,eAAc;gBAASQ,UAAU;0BACnC7B,MAAMgB,MAAM,KAAK,kBAChB,qBAACO,SAAI;oBAACG,QAAQ;8BAAC;qBAEfb,aAAaiB,GAAG,CAAC,SAACC,MAAMC;2BACtB,iHAAiH;kCACjH,qBAACT,SAAI;kCAAyBQ,KAAKE,IAAI;uBAA5BhC,eAAe+B;;;0BAMhC,sBAACT,SAAI;gBAACG,QAAQ;;oBAAC;oBACNT;oBAAY;oBAAEC;oBAAQ;oBAAKH;oBAAW;oBAAiC1B,QAAQ,SAAS;oBAAM;;;;;AAI7G"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text, useStdout } from 'ink';
|
|
3
|
-
import { memo,
|
|
3
|
+
import { memo, useLayoutEffect } from 'react';
|
|
4
4
|
const isMac = process.platform === 'darwin';
|
|
5
5
|
// ANSI escape codes for alternate screen buffer
|
|
6
6
|
const ENTER_ALT_SCREEN = '\x1b[?1049h';
|
|
7
7
|
const EXIT_ALT_SCREEN = '\x1b[?1049l';
|
|
8
8
|
const CLEAR_SCREEN = '\x1b[2J';
|
|
9
9
|
const CURSOR_HOME = '\x1b[H';
|
|
10
|
+
const HIDE_CURSOR = '\x1b[?25l';
|
|
10
11
|
export default /*#__PURE__*/ memo(function FullscreenOverlay({ title, lines, scrollOffset }) {
|
|
11
12
|
const { stdout } = useStdout();
|
|
12
13
|
const terminalHeight = (stdout === null || stdout === void 0 ? void 0 : stdout.rows) || 24;
|
|
@@ -15,9 +16,10 @@ export default /*#__PURE__*/ memo(function FullscreenOverlay({ title, lines, scr
|
|
|
15
16
|
const footerLines = 1;
|
|
16
17
|
const maxVisible = Math.max(1, terminalHeight - headerLines - footerLines);
|
|
17
18
|
// Enter alternate screen on mount, exit on unmount
|
|
18
|
-
|
|
19
|
+
// useLayoutEffect ensures cleanup runs synchronously before ink re-renders
|
|
20
|
+
useLayoutEffect(()=>{
|
|
19
21
|
if (stdout) {
|
|
20
|
-
stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME);
|
|
22
|
+
stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME + HIDE_CURSOR);
|
|
21
23
|
}
|
|
22
24
|
return ()=>{
|
|
23
25
|
if (stdout) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/FullscreenOverlay.tsx"],"sourcesContent":["import { Box, Text, useStdout } from 'ink';\nimport { memo,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/FullscreenOverlay.tsx"],"sourcesContent":["import { Box, Text, useStdout } from 'ink';\nimport { memo, useLayoutEffect } from 'react';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\n// ANSI escape codes for alternate screen buffer\nconst ENTER_ALT_SCREEN = '\\x1b[?1049h';\nconst EXIT_ALT_SCREEN = '\\x1b[?1049l';\nconst CLEAR_SCREEN = '\\x1b[2J';\nconst CURSOR_HOME = '\\x1b[H';\nconst HIDE_CURSOR = '\\x1b[?25l';\n\ntype Props = {\n title: string;\n lines: Line[];\n scrollOffset: number;\n onExit: () => void;\n};\n\nexport default memo(function FullscreenOverlay({ title, lines, scrollOffset }: Props) {\n const { stdout } = useStdout();\n const terminalHeight = stdout?.rows || 24;\n\n // Reserve lines for header (title + divider) and footer (scroll hint)\n const headerLines = 2;\n const footerLines = 1;\n const maxVisible = Math.max(1, terminalHeight - headerLines - footerLines);\n\n // Enter alternate screen on mount, exit on unmount\n // useLayoutEffect ensures cleanup runs synchronously before ink re-renders\n useLayoutEffect(() => {\n if (stdout) {\n stdout.write(ENTER_ALT_SCREEN + CLEAR_SCREEN + CURSOR_HOME + HIDE_CURSOR);\n }\n return () => {\n if (stdout) {\n stdout.write(EXIT_ALT_SCREEN);\n }\n };\n }, [stdout]);\n\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const totalLines = lines.length;\n const currentLine = scrollOffset + 1;\n const endLine = Math.min(scrollOffset + maxVisible, totalLines);\n\n return (\n <Box flexDirection=\"column\" height={terminalHeight}>\n {/* Header */}\n <Text bold color=\"cyan\">\n {title}\n </Text>\n <Text dimColor>{'─'.repeat(Math.min(80, stdout?.columns || 80))}</Text>\n\n {/* Content */}\n <Box flexDirection=\"column\" flexGrow={1}>\n {lines.length === 0 ? (\n <Text dimColor>(no output)</Text>\n ) : (\n visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>{line.text}</Text>\n ))\n )}\n </Box>\n\n {/* Footer */}\n <Text dimColor>\n Lines {currentLine}-{endLine} of {totalLines} | j/k scroll | Tab/⇧Tab page | {isMac ? '⌥↑/↓' : 'g/G'} top/bottom | ↵/q exit\n </Text>\n </Box>\n );\n});\n"],"names":["Box","Text","useStdout","memo","useLayoutEffect","isMac","process","platform","ENTER_ALT_SCREEN","EXIT_ALT_SCREEN","CLEAR_SCREEN","CURSOR_HOME","HIDE_CURSOR","FullscreenOverlay","title","lines","scrollOffset","stdout","terminalHeight","rows","headerLines","footerLines","maxVisible","Math","max","write","visibleLines","slice","totalLines","length","currentLine","endLine","min","flexDirection","height","bold","color","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