refactor(tui): extract standalone package (#31193)
This commit is contained in:
parent
7a2c49e762
commit
106f8e94d6
84 changed files with 1147 additions and 1918 deletions
|
|
@ -26,7 +26,7 @@ function wordmark(pad = "") {
|
|||
})
|
||||
}
|
||||
|
||||
export function sessionExitSummary(input: { title: string; sessionID?: string }) {
|
||||
export function sessionEpilogue(input: { title: string; sessionID?: string }) {
|
||||
const weak = (text: string) => `${dim}${text.padEnd(10, " ")}${reset}`
|
||||
return [
|
||||
...wordmark(" "),
|
||||
|
|
|
|||
6
packages/tui/src/util/renderer.ts
Normal file
6
packages/tui/src/util/renderer.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { CliRenderer } from "@opentui/core"
|
||||
|
||||
export function destroyRenderer(renderer: Pick<CliRenderer, "isDestroyed" | "setTerminalTitle" | "destroy">) {
|
||||
renderer.setTerminalTitle("")
|
||||
if (!renderer.isDestroyed) renderer.destroy()
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import type { TuiPlatform } from "../platform"
|
||||
import type { ClipboardService } from "../context/clipboard"
|
||||
|
||||
type Toast = {
|
||||
show: (input: { message: string; variant: "info" | "success" | "warning" | "error" }) => void
|
||||
|
|
@ -23,7 +23,7 @@ type SelectionKeyEvent = {
|
|||
stopPropagation: () => void
|
||||
}
|
||||
|
||||
export function copy(renderer: Renderer, toast: Toast, clipboard: TuiPlatform["clipboard"]): boolean {
|
||||
export function copy(renderer: Renderer, toast: Toast, clipboard: ClipboardService): boolean {
|
||||
const selection = renderer.getSelection()
|
||||
if (!selection) return false
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ export function handleSelectionKey(
|
|||
renderer: Renderer,
|
||||
toast: Toast,
|
||||
event: SelectionKeyEvent,
|
||||
clipboard: TuiPlatform["clipboard"],
|
||||
clipboard: ClipboardService,
|
||||
) {
|
||||
const selection = renderer.getSelection()
|
||||
if (!selection) return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue