@pablozaiden/terminatui 0.3.0 → 0.4.1
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/__tests__/adapterNoSharedUi.test.ts +34 -0
- package/src/__tests__/schemaToFields.test.ts +0 -4
- package/src/__tests__/tuiRootNoCoupling.test.ts +25 -0
- package/src/index.ts +2 -2
- package/src/tui/TuiApplication.tsx +0 -4
- package/src/tui/TuiRoot.tsx +58 -102
- package/src/tui/actions.ts +4 -0
- package/src/tui/adapters/ink/InkRenderer.tsx +191 -45
- package/src/tui/adapters/ink/SemanticInkRenderer.tsx +210 -0
- package/src/tui/adapters/ink/components/Button.tsx +10 -2
- package/src/tui/adapters/ink/components/Overlay.tsx +8 -2
- package/src/tui/adapters/ink/components/Panel.tsx +26 -5
- package/src/tui/adapters/ink/components/ScrollView.tsx +44 -3
- package/src/tui/adapters/ink/components/Spinner.tsx +8 -2
- package/src/tui/adapters/ink/keyboard.ts +0 -3
- package/src/tui/adapters/ink/ui/CommandSelector.tsx +56 -0
- package/src/tui/adapters/ink/ui/ConfigForm.tsx +77 -0
- package/src/tui/adapters/ink/ui/Header.tsx +25 -0
- package/src/tui/adapters/ink/ui/JsonHighlight.tsx +21 -0
- package/src/tui/adapters/ink/ui/ResultsPanel.tsx +57 -0
- package/src/tui/adapters/opentui/OpenTuiRenderer.tsx +190 -43
- package/src/tui/adapters/opentui/SemanticOpenTuiRenderer.tsx +192 -0
- package/src/tui/adapters/opentui/components/Label.tsx +2 -2
- package/src/tui/adapters/opentui/components/Overlay.tsx +12 -3
- package/src/tui/adapters/opentui/components/Panel.tsx +11 -1
- package/src/tui/adapters/opentui/components/ScrollView.tsx +1 -8
- package/src/tui/adapters/opentui/components/Spinner.tsx +1 -1
- package/src/tui/adapters/opentui/keyboard.ts +0 -3
- package/src/tui/adapters/opentui/ui/CommandSelector.tsx +55 -0
- package/src/tui/adapters/opentui/ui/ConfigForm.tsx +74 -0
- package/src/tui/adapters/opentui/ui/Header.tsx +24 -0
- package/src/tui/adapters/opentui/ui/JsonHighlight.tsx +20 -0
- package/src/tui/adapters/opentui/ui/LogsPanel.tsx +44 -0
- package/src/tui/adapters/opentui/ui/ResultsPanel.tsx +62 -0
- package/src/tui/adapters/shared/TerminalClipboard.ts +65 -0
- package/src/tui/adapters/{opentui/hooks → shared}/useSpinner.ts +5 -1
- package/src/tui/adapters/types.ts +25 -46
- package/src/tui/components/JsonHighlight.tsx +41 -111
- package/src/tui/context/ActionContext.tsx +51 -0
- package/src/tui/context/ExecutorContext.tsx +7 -1
- package/src/tui/context/NavigationContext.tsx +20 -4
- package/src/tui/controllers/CommandBrowserController.tsx +100 -0
- package/src/tui/controllers/ConfigController.tsx +183 -0
- package/src/tui/controllers/EditorController.tsx +169 -0
- package/src/tui/controllers/LogsController.tsx +48 -0
- package/src/tui/controllers/OutcomeController.tsx +110 -0
- package/src/tui/driver/TuiDriver.tsx +148 -0
- package/src/tui/driver/context/TuiDriverContext.tsx +44 -0
- package/src/tui/driver/types.ts +72 -0
- package/src/tui/semantic/AppShell.tsx +30 -0
- package/src/tui/semantic/CommandBrowserScreen.tsx +16 -0
- package/src/tui/semantic/ConfigScreen.tsx +23 -0
- package/src/tui/semantic/EditorScreen.tsx +20 -0
- package/src/tui/semantic/LogsScreen.tsx +9 -0
- package/src/tui/semantic/RunningScreen.tsx +17 -0
- package/src/tui/semantic/layoutTypes.ts +72 -0
- package/src/tui/semantic/render.tsx +44 -0
- package/src/tui/semantic/types.ts +31 -98
- package/src/tui/utils/jsonTokenizer.ts +98 -0
- package/src/tui/utils/schemaToFields.ts +1 -25
- package/src/tui/adapters/ink/components/Code.tsx +0 -6
- package/src/tui/adapters/ink/components/Container.tsx +0 -5
- package/src/tui/adapters/ink/components/Spacer.tsx +0 -15
- package/src/tui/adapters/ink/components/Value.tsx +0 -7
- package/src/tui/adapters/opentui/components/Code.tsx +0 -12
- package/src/tui/adapters/opentui/components/Container.tsx +0 -56
- package/src/tui/adapters/opentui/components/Spacer.tsx +0 -5
- package/src/tui/adapters/opentui/components/Value.tsx +0 -13
- package/src/tui/components/ActionButton.tsx +0 -0
- package/src/tui/components/CommandSelector.tsx +0 -119
- package/src/tui/components/ConfigForm.tsx +0 -174
- package/src/tui/components/FieldRow.tsx +0 -0
- package/src/tui/components/Header.tsx +0 -32
- package/src/tui/components/ModalBase.tsx +0 -38
- package/src/tui/components/ResultsPanel.tsx +0 -84
- package/src/tui/components/StatusBar.tsx +0 -44
- package/src/tui/components/logColors.ts +0 -12
- package/src/tui/components/types.ts +0 -30
- package/src/tui/context/ClipboardContext.tsx +0 -87
- package/src/tui/context/KeyboardContext.tsx +0 -132
- package/src/tui/hooks/useActiveKeyHandler.ts +0 -75
- package/src/tui/hooks/useClipboard.ts +0 -81
- package/src/tui/hooks/useClipboardProvider.ts +0 -42
- package/src/tui/hooks/useGlobalKeyHandler.ts +0 -54
- package/src/tui/modals/CliModal.tsx +0 -82
- package/src/tui/modals/EditorModal.tsx +0 -207
- package/src/tui/modals/LogsModal.tsx +0 -98
- package/src/tui/registry.ts +0 -102
- package/src/tui/screens/CommandSelectScreen.tsx +0 -162
- package/src/tui/screens/ConfigScreen.tsx +0 -165
- package/src/tui/screens/ErrorScreen.tsx +0 -58
- package/src/tui/screens/ResultsScreen.tsx +0 -68
- package/src/tui/screens/RunningScreen.tsx +0 -72
- package/src/tui/screens/ScreenBase.ts +0 -6
- package/src/tui/semantic/Button.tsx +0 -7
- package/src/tui/semantic/Code.tsx +0 -7
- package/src/tui/semantic/CodeHighlight.tsx +0 -7
- package/src/tui/semantic/Container.tsx +0 -7
- package/src/tui/semantic/Field.tsx +0 -7
- package/src/tui/semantic/Label.tsx +0 -7
- package/src/tui/semantic/MenuButton.tsx +0 -7
- package/src/tui/semantic/MenuItem.tsx +0 -7
- package/src/tui/semantic/Overlay.tsx +0 -7
- package/src/tui/semantic/Panel.tsx +0 -7
- package/src/tui/semantic/ScrollView.tsx +0 -9
- package/src/tui/semantic/Select.tsx +0 -7
- package/src/tui/semantic/Spacer.tsx +0 -7
- package/src/tui/semantic/Spinner.tsx +0 -7
- package/src/tui/semantic/TextInput.tsx +0 -7
- package/src/tui/semantic/Value.tsx +0 -7
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from "react";
|
|
2
|
-
import type { AnyCommand } from "../../core/command.ts";
|
|
3
|
-
import type { FieldConfig } from "../components/types.ts";
|
|
4
|
-
import { ConfigForm } from "../components/ConfigForm.tsx";
|
|
5
|
-
import { Container } from "../semantic/Container.tsx";
|
|
6
|
-
import { MenuButton } from "../semantic/MenuButton.tsx";
|
|
7
|
-
import { schemaToFieldConfigs } from "../utils/schemaToFields.ts";
|
|
8
|
-
import { useClipboardProvider } from "../hooks/useClipboardProvider.ts";
|
|
9
|
-
import { buildCliCommand } from "../utils/buildCliCommand.ts";
|
|
10
|
-
import { useTuiApp } from "../context/TuiAppContext.tsx";
|
|
11
|
-
import { useNavigation } from "../context/NavigationContext.tsx";
|
|
12
|
-
import { useExecutor } from "../context/ExecutorContext.tsx";
|
|
13
|
-
import type { ScreenComponent } from "../registry.ts";
|
|
14
|
-
import { savePersistedParameters } from "../utils/parameterPersistence.ts";
|
|
15
|
-
import type { OptionSchema, OptionValues } from "../../types/command.ts";
|
|
16
|
-
import { ScreenBase } from "./ScreenBase.ts";
|
|
17
|
-
import type { EditorModalParams } from "../modals/EditorModal.tsx";
|
|
18
|
-
import type { CliModalParams } from "../modals/CliModal.tsx";
|
|
19
|
-
import { RunningScreen, type RunningParams } from "./RunningScreen.tsx";
|
|
20
|
-
import { type ErrorParams, ErrorScreen } from "./ErrorScreen.tsx";
|
|
21
|
-
import { type ResultsParams, ResultsScreen } from "./ResultsScreen.tsx";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Screen state stored in navigation params.
|
|
25
|
-
*/
|
|
26
|
-
export interface ConfigParams {
|
|
27
|
-
command: AnyCommand;
|
|
28
|
-
commandPath: string[];
|
|
29
|
-
values: Record<string, unknown>;
|
|
30
|
-
fieldConfigs: FieldConfig[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Config screen for editing command options before execution.
|
|
35
|
-
* Fully self-contained - gets all data from context and handles its own transitions.
|
|
36
|
-
*/
|
|
37
|
-
export class ConfigScreen extends ScreenBase {
|
|
38
|
-
static readonly Id = "config";
|
|
39
|
-
getRoute(): string {
|
|
40
|
-
return ConfigScreen.Id;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override component(): ScreenComponent {
|
|
44
|
-
return function ConfigScreenComponent() {
|
|
45
|
-
const { name: appName } = useTuiApp();
|
|
46
|
-
const navigation = useNavigation();
|
|
47
|
-
const executor = useExecutor();
|
|
48
|
-
|
|
49
|
-
// Get params from navigation
|
|
50
|
-
const params = navigation.current.params as ConfigParams | undefined;
|
|
51
|
-
if (!params) return null;
|
|
52
|
-
|
|
53
|
-
const { command, commandPath, values, fieldConfigs } = params;
|
|
54
|
-
|
|
55
|
-
// Local selection state for the form
|
|
56
|
-
const [selectedFieldIndex, setSelectedFieldIndex] = useState(0);
|
|
57
|
-
|
|
58
|
-
// Derive field configs (in case they weren't passed)
|
|
59
|
-
const derivedFieldConfigs = useMemo(
|
|
60
|
-
() => fieldConfigs ?? schemaToFieldConfigs(command.options),
|
|
61
|
-
[fieldConfigs, command.options]
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
// Register clipboard provider for this screen
|
|
65
|
-
useClipboardProvider(
|
|
66
|
-
useCallback(() => ({
|
|
67
|
-
content: JSON.stringify(values, null, 2),
|
|
68
|
-
label: "Config",
|
|
69
|
-
}), [values])
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
// Handle running the command
|
|
73
|
-
const handleRun = useCallback(async () => {
|
|
74
|
-
// Save parameters for next time
|
|
75
|
-
savePersistedParameters(appName, command.name, values);
|
|
76
|
-
|
|
77
|
-
// Push to running screen
|
|
78
|
-
navigation.push<RunningParams>(RunningScreen.Id, {
|
|
79
|
-
command,
|
|
80
|
-
commandPath,
|
|
81
|
-
values,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Execute the command
|
|
85
|
-
const outcome = await executor.execute(command, values);
|
|
86
|
-
|
|
87
|
-
if (outcome.cancelled) {
|
|
88
|
-
// If cancelled, pop back to config
|
|
89
|
-
navigation.pop();
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (outcome.success) {
|
|
94
|
-
// Replace running with results
|
|
95
|
-
navigation.replace<ResultsParams>(ResultsScreen.Id, {
|
|
96
|
-
command,
|
|
97
|
-
commandPath,
|
|
98
|
-
values,
|
|
99
|
-
result: outcome.result ?? null,
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
// Replace running with error
|
|
103
|
-
navigation.replace<ErrorParams>(ErrorScreen.Id, {
|
|
104
|
-
command,
|
|
105
|
-
commandPath,
|
|
106
|
-
values,
|
|
107
|
-
error: outcome.error ?? new Error("Unknown error"),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}, [appName, command, commandPath, values, navigation, executor]);
|
|
111
|
-
|
|
112
|
-
// Handle editing a field - open property editor modal
|
|
113
|
-
const handleEditField = useCallback((fieldKey: string) => {
|
|
114
|
-
navigation.openModal<EditorModalParams>("property-editor", {
|
|
115
|
-
fieldKey,
|
|
116
|
-
currentValue: values[fieldKey],
|
|
117
|
-
fieldConfigs: derivedFieldConfigs,
|
|
118
|
-
onSubmit: (value: unknown) => {
|
|
119
|
-
let nextValues = { ...values, [fieldKey]: value };
|
|
120
|
-
const updates = command.onConfigChange?.(fieldKey, value, nextValues);
|
|
121
|
-
if (updates) {
|
|
122
|
-
nextValues = { ...nextValues, ...updates };
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
navigation.replace<ConfigParams>(ConfigScreen.Id, { ...params, values: nextValues });
|
|
126
|
-
navigation.closeModal();
|
|
127
|
-
},
|
|
128
|
-
onCancel: () => navigation.closeModal(),
|
|
129
|
-
});
|
|
130
|
-
}, [navigation, values, derivedFieldConfigs, params]);
|
|
131
|
-
|
|
132
|
-
// Handle opening the CLI Args modal
|
|
133
|
-
const handleShowCliArgs = useCallback(() => {
|
|
134
|
-
const cli = buildCliCommand(appName, commandPath, command.options, values as OptionValues<OptionSchema>);
|
|
135
|
-
navigation.openModal<CliModalParams>("cli", { command: cli });
|
|
136
|
-
}, [appName, commandPath, command.options, values, navigation]);
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<Container flexDirection="column" flex={1}>
|
|
140
|
-
<ConfigForm
|
|
141
|
-
title={`Configure: ${command.displayName ?? command.name}`}
|
|
142
|
-
fieldConfigs={derivedFieldConfigs}
|
|
143
|
-
values={values}
|
|
144
|
-
selectedIndex={selectedFieldIndex}
|
|
145
|
-
focused={true}
|
|
146
|
-
onSelectionChange={setSelectedFieldIndex}
|
|
147
|
-
onEditField={handleEditField}
|
|
148
|
-
onAction={handleRun}
|
|
149
|
-
additionalButtons={
|
|
150
|
-
command.supportsCli()
|
|
151
|
-
? [{ label: "CLI Command", onPress: handleShowCliArgs }]
|
|
152
|
-
: []
|
|
153
|
-
}
|
|
154
|
-
actionButton={
|
|
155
|
-
<MenuButton
|
|
156
|
-
label={command.actionLabel ?? "Run"}
|
|
157
|
-
selected={selectedFieldIndex === derivedFieldConfigs.length + 1}
|
|
158
|
-
/>
|
|
159
|
-
}
|
|
160
|
-
/>
|
|
161
|
-
</Container>
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import type { AnyCommand } from "../../core/command.ts";
|
|
3
|
-
import { useNavigation } from "../context/NavigationContext.tsx";
|
|
4
|
-
import { ResultsPanel } from "../components/ResultsPanel.tsx";
|
|
5
|
-
import { useClipboardProvider } from "../hooks/useClipboardProvider.ts";
|
|
6
|
-
import type { ScreenComponent } from "../registry.ts";
|
|
7
|
-
import { ScreenBase } from "./ScreenBase.ts";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Screen state stored in navigation params.
|
|
11
|
-
*/
|
|
12
|
-
export interface ErrorParams {
|
|
13
|
-
command: AnyCommand;
|
|
14
|
-
commandPath: string[];
|
|
15
|
-
values: Record<string, unknown>;
|
|
16
|
-
error: Error;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Error screen - shows command execution errors.
|
|
21
|
-
* Fully self-contained - gets all data from context and handles its own transitions.
|
|
22
|
-
*/
|
|
23
|
-
export class ErrorScreen extends ScreenBase {
|
|
24
|
-
static readonly Id = "error";
|
|
25
|
-
|
|
26
|
-
getRoute(): string {
|
|
27
|
-
return ErrorScreen.Id;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override component(): ScreenComponent {
|
|
31
|
-
return function ErrorScreenComponent() {
|
|
32
|
-
const navigation = useNavigation();
|
|
33
|
-
|
|
34
|
-
// Get params from navigation
|
|
35
|
-
const params = navigation.current.params as ErrorParams | undefined;
|
|
36
|
-
if (!params) return null;
|
|
37
|
-
|
|
38
|
-
const { error, command } = params;
|
|
39
|
-
|
|
40
|
-
// Register clipboard provider for this screen
|
|
41
|
-
useClipboardProvider(
|
|
42
|
-
useCallback(() => ({
|
|
43
|
-
content: error.message,
|
|
44
|
-
label: "Error",
|
|
45
|
-
}), [error])
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<ResultsPanel
|
|
50
|
-
result={null}
|
|
51
|
-
error={error}
|
|
52
|
-
focused={true}
|
|
53
|
-
renderResult={command.renderResult}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import type { AnyCommand, CommandResult } from "../../core/command.ts";
|
|
3
|
-
import { useNavigation } from "../context/NavigationContext.tsx";
|
|
4
|
-
import { ResultsPanel } from "../components/ResultsPanel.tsx";
|
|
5
|
-
import { useClipboardProvider } from "../hooks/useClipboardProvider.ts";
|
|
6
|
-
import { type ScreenComponent } from "../registry.ts";
|
|
7
|
-
import { ScreenBase } from "./ScreenBase.ts";
|
|
8
|
-
import { useRenderer } from "../context/RendererContext.tsx";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Screen state stored in navigation params.
|
|
12
|
-
*/
|
|
13
|
-
export interface ResultsParams {
|
|
14
|
-
command: AnyCommand;
|
|
15
|
-
commandPath: string[];
|
|
16
|
-
values: Record<string, unknown>;
|
|
17
|
-
result: unknown;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class ResultsScreen extends ScreenBase {
|
|
21
|
-
static readonly Id = "results";
|
|
22
|
-
|
|
23
|
-
getRoute(): string {
|
|
24
|
-
return ResultsScreen.Id;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Results screen - shows command execution results.
|
|
28
|
-
* Fully self-contained - gets all data from context and handles its own transitions.
|
|
29
|
-
*/
|
|
30
|
-
override component(): ScreenComponent {
|
|
31
|
-
return function ResultsScreenComponent() {
|
|
32
|
-
const navigation = useNavigation();
|
|
33
|
-
|
|
34
|
-
// Get params from navigation
|
|
35
|
-
const params = navigation.current.params as ResultsParams | undefined;
|
|
36
|
-
if (!params) return null;
|
|
37
|
-
|
|
38
|
-
const { result, command } = params;
|
|
39
|
-
|
|
40
|
-
const renderer = useRenderer();
|
|
41
|
-
|
|
42
|
-
let renderFunction = undefined;
|
|
43
|
-
if (renderer.supportCustomRendering()) {
|
|
44
|
-
renderFunction = command.renderResult;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Register clipboard provider for this screen
|
|
48
|
-
useClipboardProvider(
|
|
49
|
-
useCallback(() => {
|
|
50
|
-
if (command.getClipboardContent) {
|
|
51
|
-
const custom = command.getClipboardContent(result as CommandResult);
|
|
52
|
-
if (custom) return { content: custom, label: "Results" };
|
|
53
|
-
}
|
|
54
|
-
return { content: JSON.stringify(result, null, 2), label: "Results" };
|
|
55
|
-
}, [result, command])
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<ResultsPanel
|
|
60
|
-
result={result as CommandResult | null}
|
|
61
|
-
error={null}
|
|
62
|
-
focused={true}
|
|
63
|
-
renderResult={renderFunction}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import type { AnyCommand } from "../../core/command.ts";
|
|
3
|
-
import { useNavigation } from "../context/NavigationContext.tsx";
|
|
4
|
-
import { useExecutor } from "../context/ExecutorContext.tsx";
|
|
5
|
-
import { useBackHandler } from "../hooks/useBackHandler.ts";
|
|
6
|
-
import type { ScreenComponent } from "../registry.ts";
|
|
7
|
-
import { ScreenBase } from "./ScreenBase.ts";
|
|
8
|
-
import { Container } from "../semantic/Container.tsx";
|
|
9
|
-
import { Label } from "../semantic/Label.tsx";
|
|
10
|
-
import { Panel } from "../semantic/Panel.tsx";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Screen state stored in navigation params.
|
|
14
|
-
*/
|
|
15
|
-
export interface RunningParams {
|
|
16
|
-
command: AnyCommand;
|
|
17
|
-
commandPath: string[];
|
|
18
|
-
values: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Running screen - shows while a command is executing.
|
|
23
|
-
* Fully self-contained - gets all data from context and handles its own transitions.
|
|
24
|
-
*/
|
|
25
|
-
export class RunningScreen extends ScreenBase {
|
|
26
|
-
static readonly Id = "running";
|
|
27
|
-
getRoute(): string {
|
|
28
|
-
return RunningScreen.Id;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override component(): ScreenComponent {
|
|
32
|
-
return function RunningScreenComponent() {
|
|
33
|
-
const navigation = useNavigation();
|
|
34
|
-
const executor = useExecutor();
|
|
35
|
-
|
|
36
|
-
// Get params from navigation
|
|
37
|
-
const params = navigation.current.params as RunningParams | undefined;
|
|
38
|
-
if (!params) return null;
|
|
39
|
-
|
|
40
|
-
const { command } = params;
|
|
41
|
-
|
|
42
|
-
// Register back handler - cancel execution on back
|
|
43
|
-
useBackHandler(useCallback(() => {
|
|
44
|
-
if (executor.isExecuting) {
|
|
45
|
-
executor.cancel();
|
|
46
|
-
executor.reset();
|
|
47
|
-
// Pop back to config screen
|
|
48
|
-
navigation.pop();
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
}, [executor, navigation]));
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Panel
|
|
56
|
-
flexDirection="column"
|
|
57
|
-
flex={1}
|
|
58
|
-
title={`${command.displayName ?? command.name}`}
|
|
59
|
-
padding={1}
|
|
60
|
-
focused
|
|
61
|
-
>
|
|
62
|
-
<Container flexDirection="column" flex={1} gap={1}>
|
|
63
|
-
<Label color="mutedText">
|
|
64
|
-
Check logs for progress.
|
|
65
|
-
</Label>
|
|
66
|
-
<Label color="mutedText">Press Esc to cancel.</Label>
|
|
67
|
-
</Container>
|
|
68
|
-
</Panel>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CodeHighlightProps } from "./types.ts";
|
|
2
|
-
import { useRenderer } from "../context/RendererContext.tsx";
|
|
3
|
-
|
|
4
|
-
export function CodeHighlight(props: CodeHighlightProps) {
|
|
5
|
-
const renderer = useRenderer();
|
|
6
|
-
return renderer.components.CodeHighlight(props);
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ScrollViewProps, ScrollViewRef } from "./types.ts";
|
|
2
|
-
import { useRenderer } from "../context/RendererContext.tsx";
|
|
3
|
-
|
|
4
|
-
export function ScrollView(props: ScrollViewProps) {
|
|
5
|
-
const renderer = useRenderer();
|
|
6
|
-
return renderer.components.ScrollView(props);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type { ScrollViewRef };
|