15aca4502d
Port input handling fixtures from Ink to vue-tui: - use-input.tsx: multi-mode fixture (30+ input modes via process.argv[2]) - use-input-ctrl-c.tsx: Ctrl+C with exitOnCtrlC=false - use-input-multiple.tsx: active/inactive useInput hooks - use-input-many.tsx: 11 useInput hooks without MaxListenersExceededWarning - use-input-discrete-priority.tsx: rapid input with deferred state sync - use-paste.tsx: bracketed paste with multiple modes - tsconfig.json: add "types": ["node"] to fix TS2591 in fixtures Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
659 B
TypeScript
29 lines
659 B
TypeScript
import process from "node:process";
|
|
import { createApp, Text, useInput, useExit } from "@vue-tui/runtime";
|
|
import { defineComponent, h, onMounted, shallowRef } from "vue";
|
|
|
|
const App = defineComponent(() => {
|
|
const exit = useExit();
|
|
const input = shallowRef("");
|
|
|
|
const handleInput = (char: string) => {
|
|
input.value = input.value + char;
|
|
};
|
|
|
|
useInput(handleInput);
|
|
useInput(handleInput, { isActive: false });
|
|
|
|
onMounted(() => {
|
|
process.stdout.write("__READY__");
|
|
|
|
setTimeout(exit, 100);
|
|
});
|
|
|
|
return () => h(Text, null, input.value);
|
|
});
|
|
|
|
const app = createApp(App);
|
|
app.mount();
|
|
await app.waitUntilExit();
|
|
console.log("exited");
|