import { t as PublicComponent } from "./with-children-BX8-sFPH.mjs"; import { g as ColorProfile, n as TuiApp, r as createApp, t as MountOptions } from "./render-Bfq_buOu.mjs"; import { Component, ComponentPublicInstance, ExtractPublicPropTypes, MaybeRef, MaybeRefOrGetter, PropType, Ref } from "vue"; import { Readable } from "node:stream"; //#region src/components/color.d.ts type NamedColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright"; /** * A terminal color accepted by Runtime. * * Hex colors are checked at runtime and must contain exactly six hexadecimal * digits. TypeScript cannot express that finite grammar without constructing a * prohibitively large union, so the template-literal arm deliberately narrows * only the leading `#`. */ type Color = NamedColor | `#${string}`; //#endregion //#region src/components/text-props.d.ts type TextColor = Color | "default"; type TextAlign = "left" | "center" | "right"; type WrapMode = "wrap" | "hard" | "truncate" | "truncate-middle" | "truncate-start"; declare const textProps: { color: PropType; backgroundColor: PropType; dimColor: { type: PropType; default: undefined; }; bold: { type: PropType; default: undefined; }; italic: { type: PropType; default: undefined; }; underline: { type: PropType; default: undefined; }; strikethrough: { type: PropType; default: undefined; }; inverse: { type: PropType; default: undefined; }; textAlign: { type: PropType; default: string; }; wrap: { type: PropType; default: string; }; }; /** Props accepted by the public `` primitive. */ type TextProps = ExtractPublicPropTypes; //#endregion //#region src/render-to-string.d.ts interface RenderToStringOptions { /** * Modeled root layout width in terminal cells. * * @default 80 */ readonly width?: number; /** * Modeled root layout height in terminal cells. Use `Infinity` for no vertical bound. * * @default 24 */ readonly height?: number; /** * Select terminal styling for the returned string. Omission and `false` * produce plain output. `true` automatically detects process stdout, while a * named profile forces that capability. The policy also constrains SGR * already present in rendered text. * * @default false */ readonly color?: boolean | ColorProfile; } /** * Render a component to a string synchronously, with no terminal session. * * - Writes nothing and installs no listeners; input, focus, and stream * composables get inert services and `useApp().exit()` is a no-op. * - `` output is prepended to the dynamic output. * - Models 80x24 by default; pass `height: Infinity` for an unbounded document. * * @example Snapshot a component in a test * ```ts * expect(renderToString(Summary)).toContain("2 passed"); * ``` * * @example Render an unbounded document * ```ts * const report = renderToString(Report, { height: Infinity }); * ``` */ declare function renderToString(component: Component, options?: RenderToStringOptions): string; //#endregion //#region src/components/box-props.d.ts type Percentage = `${number}%`; type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse"; type FlexWrap = "nowrap" | "wrap" | "wrap-reverse"; type AlignItems = "flex-start" | "center" | "flex-end" | "stretch"; type AlignSelf = "auto" | AlignItems; type JustifyContent = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly"; type AlignContent = "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly"; /** The named frames `cli-boxes` ships. */ type BorderStyleName = "single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic" | "arrow"; /** * A caller-supplied frame. Every corner and edge is required so a custom frame * cannot silently lose a side; each value is one string, not a width. */ interface BorderCharacters { readonly topLeft: string; readonly top: string; readonly topRight: string; readonly right: string; readonly bottomRight: string; readonly bottom: string; readonly bottomLeft: string; readonly left: string; } type BorderStyle = BorderStyleName | BorderCharacters; type Overflow = "visible" | "hidden"; declare const boxProps: { flexDirection: PropType; flexWrap: PropType; flexGrow: NumberConstructor; flexShrink: NumberConstructor; flexBasis: PropType; alignItems: PropType; alignSelf: PropType; alignContent: PropType; justifyContent: PropType; gap: NumberConstructor; rowGap: NumberConstructor; columnGap: NumberConstructor; width: PropType; height: NumberConstructor; minWidth: NumberConstructor; minHeight: NumberConstructor; maxWidth: NumberConstructor; maxHeight: NumberConstructor; aspectRatio: NumberConstructor; position: PropType<"relative" | "absolute" | "static">; top: PropType; right: PropType; bottom: PropType; left: PropType; margin: NumberConstructor; marginX: NumberConstructor; marginY: NumberConstructor; marginTop: NumberConstructor; marginRight: NumberConstructor; marginBottom: NumberConstructor; marginLeft: NumberConstructor; padding: NumberConstructor; paddingX: NumberConstructor; paddingY: NumberConstructor; paddingTop: NumberConstructor; paddingRight: NumberConstructor; paddingBottom: NumberConstructor; paddingLeft: NumberConstructor; borderStyle: PropType; borderTop: { type: PropType; default: undefined; }; borderRight: { type: PropType; default: undefined; }; borderBottom: { type: PropType; default: undefined; }; borderLeft: { type: PropType; default: undefined; }; borderColor: PropType; borderTopColor: PropType; borderRightColor: PropType; borderBottomColor: PropType; borderLeftColor: PropType; borderDimColor: { type: PropType; default: undefined; }; borderTopDimColor: { type: PropType; default: undefined; }; borderRightDimColor: { type: PropType; default: undefined; }; borderBottomDimColor: { type: PropType; default: undefined; }; borderLeftDimColor: { type: PropType; default: undefined; }; borderBackgroundColor: PropType; borderTopBackgroundColor: PropType; borderRightBackgroundColor: PropType; borderBottomBackgroundColor: PropType; borderLeftBackgroundColor: PropType; backgroundColor: PropType; overflow: PropType; overflowX: PropType; overflowY: PropType; }; /** Props accepted by the public `` primitive. */ type BoxProps = ExtractPublicPropTypes; //#endregion //#region src/components/public-box.d.ts declare const boxInstanceBrand: unique symbol; interface BoxInstanceBrand { readonly [boxInstanceBrand]: true; } /** The nominal public instance produced by the exported Box component. */ type PublicBoxInstance = ComponentPublicInstance & BoxInstanceBrand; /** * Terminal layout container: the flexbox primitive every layout is built from. * * - Yoga flexbox, so `flexDirection` defaults to `"row"`, not CSS block flow. * - 62 closed props. Unknown props, misspellings, and listeners like `@click` * throw rather than pass through. * - No `display` prop: `v-if` to own creation, Box-rooted `v-show` to hide a * mounted subtree. * - `borderStyle` takes one of eight frame names or a complete custom frame; * per-edge color props override the shared one. * * @example A bordered column * ```tsx * * Title * Body * * ``` * * @example Push content apart with a growing spacer * ```tsx * * left * * right * * ``` */ declare const Box: PublicComponent; //#endregion //#region src/composables/useApp.d.ts /** The public app-lifecycle surface returned by {@link useApp}. Mirrors Ink's `useApp()`. */ interface UseAppReturn { readonly exit: (error?: Error) => void; } /** * Access app-level lifecycle controls from inside the render tree. * * - `exit()` ends the app; passing an `Error` rejects `app.waitUntilExit()` with * it after the host is restored. * - Deliberately narrow — the `waitUntilExit()` and `waitUntilRenderFlush()` * barriers stay on the `createApp()` owner. * * @example Quit when the user presses Escape * ```tsx * const { exit } = useApp(); * useInput((event) => { * if (event.key?.name === "escape") exit(); * }); * ``` * * @example End the run as a failure * ```ts * const { exit } = useApp(); * exit(new Error("config file missing")); // app.waitUntilExit() rejects with it * ``` */ declare function useApp(): UseAppReturn; //#endregion //#region src/composables/useFocus.d.ts /** * A Vue ref whose component boundary controls this focus handle's rendered * availability. * * The target is not the focus identity and does not define input routing or * navigation. If the boundary becomes unavailable or its rendered ancestry is * hidden or detached, this handle loses focus. Later availability does not * restore focus. */ type FocusTarget = Readonly>; interface UseFocusReturn { readonly isFocused: Readonly>; focus(): void; blur(): void; } /** * Create one explicit focus identity for this component. * * - Each call is a distinct identity; `focus()` replaces the current owner * synchronously. One owner per app. * - `isFocused` composes directly with * `useInput(handler, { isActive: focus.isFocused })`. * - No target ties validity to the Vue scope; a component ref also clears focus * on removal or hidden ancestry. * - Operations on a disposed handle are inert. There is no focus manager, Tab * handling, or restoration. * * @example Focus-gated input * ```tsx * const focus = useFocus(); * useInput((event) => handle(event), { isActive: focus.isFocused }); * ``` * * @example Bind the identity to a rendered Box * ```tsx * const panel = shallowRef | null>(null); * const focus = useFocus(panel); // focus clears if the Box unmounts * ``` */ declare function useFocus(): UseFocusReturn; declare function useFocus(target: FocusTarget): UseFocusReturn; //#endregion //#region src/io/public-input.d.ts /** * Stable semantic key names emitted by Runtime. * * The listed names are editor suggestions, not a closed world: newer terminal * protocols may add other normalized lower-kebab-case names. */ type TuiKeyName = "backspace" | "tab" | "enter" | "escape" | "insert" | "delete" | "up" | "down" | "left" | "right" | "home" | "end" | "page-up" | "page-down" | "f1" | "f2" | "f3" | "f4" | "f5" | "f6" | "f7" | "f8" | "f9" | "f10" | "f11" | "f12" | (string & {}); interface TuiKeyModifiers { readonly shift: boolean; readonly alt: boolean; readonly ctrl: boolean; readonly meta: boolean; readonly super: boolean; readonly hyper: boolean; } /** One complete logical key identity and its command modifiers. */ type TuiKey = TuiKeyModifiers & ({ readonly name: TuiKeyName; readonly character?: never; } | { readonly character: string; readonly name?: never; }); /** * Normalized application input. * * Text is insertion-ready and non-empty. A text event includes `key` only when * the terminal also supplied reliable logical-key identity. Paste always * contains one complete decoded bracketed-paste payload, including an empty * payload. Key events contain no insertion text. */ type TuiInputEvent = { readonly type: "text"; readonly text: string; readonly key?: TuiKey; } | { readonly type: "key"; readonly key: TuiKey; readonly text?: never; } | { readonly type: "paste"; readonly text: string; readonly key?: never; }; //#endregion //#region src/composables/useInput.d.ts type InputHandler = (event: TuiInputEvent) => void; /** * Subscribe to normalized text, key, and paste input for the current app. * * - Every active subscription receives every event; return values never consume * one or affect peers. * - Only `type: "key"` guarantees `event.key`; text carries one only when the * terminal supplied it. * - `isActive` owns managed-input demand, so an inactive subscription holds no * input listener or optional terminal resources. * - A handler ref is resolved per event, so handlers swap without resubscribing. * * @example Handle typed text and a named key * ```tsx * useInput((event) => { * if (event.type === "text") append(event.text); * else if (event.type === "key" && event.key.name === "enter") submit(); * }); * ``` * * @example Listen only while this component owns focus * ```tsx * const focus = useFocus(); * useInput(handler, { isActive: focus.isFocused }); * ``` */ declare function useInput(handler: MaybeRef, options?: { readonly isActive?: MaybeRefOrGetter; }): void; //#endregion //#region src/composables/useStdin.d.ts /** The raw stdin escape hatch returned by {@link useStdin}. */ interface UseStdinReturn { /** * The actual stdin stream selected for the current mount. Bytes read from this raw * escape hatch have no vue-tui event semantics and are not guaranteed to compose * safely with framework-managed input routing. */ readonly stdin: Readable; /** * Whether Runtime can coordinate raw mode for the mounted stream. A raw-mode * operation can still fail when the host itself rejects the transition. */ readonly isRawModeSupported: boolean; /** * Acquire or release this hook call's own idempotent logical raw-mode hold. * Vue scope disposal releases a surviving hold automatically. */ readonly setRawMode: (enabled: boolean) => void; } /** * Access the mounted stdin plus an independently owned raw-mode hold. * * - An escape hatch: no normalized parser, encoding, or Kitty/paste negotiation. * Direct listeners and their cleanup are yours. * - Each call owns one idempotent hold. `false` releases only this call's, and * scope disposal releases it without disturbing `useInput()`. * - A stream without an exposed raw-mode API stays observable with * `isRawModeSupported` false. * * @example Inspect raw bytes and clean up with the scope * ```ts * const { stdin, isRawModeSupported, setRawMode } = useStdin(); * if (isRawModeSupported) setRawMode(true); * const onData = (chunk: Buffer) => inspect(chunk); * stdin.on("data", onData); * onScopeDispose(() => stdin.off("data", onData)); * ``` */ declare function useStdin(): UseStdinReturn; //#endregion //#region src/composables/use-layout-size.d.ts /** Readonly reactive root-layout dimensions from one accepted snapshot. */ interface UseLayoutSizeReturn { readonly width: Readonly>; readonly height: Readonly>; } /** * Read the terminal-cell width and height Runtime gives the root layout. * * - One accepted layout snapshot — not physical terminal columns and rows, and * not a measured rectangle. * - `height === Infinity` means no vertical bound. * * @example Draw a rule across the full width * ```tsx * const { width } = useLayoutSize(); * return () => {"-".repeat(width.value)}; * ``` */ declare function useLayoutSize(): UseLayoutSizeReturn; //#endregion //#region src/composables/use-box-metrics.d.ts /** Readonly reactive parent-relative layout rectangle for one direct Box. */ interface UseBoxMetricsReturn { readonly width: Readonly>; readonly height: Readonly>; readonly left: Readonly>; readonly top: Readonly>; readonly hasMeasured: Readonly>; } /** * Observe the last accepted layout rectangle of one directly referenced Box. * * - Zero with `hasMeasured` false before the first measurement and while the * target is detached, unmounted, retargeted, or hidden by `v-show`. A real * zero-sized Box reports zero with `hasMeasured` true. * - A pending repaint keeps the last accepted values. * - The ref must bind directly to `` in the current app; anything else throws. * * @example Render only once the panel has been measured * ```tsx * const panel = shallowRef | null>(null); * const { width, hasMeasured } = useBoxMetrics(panel); * return () => ( * * {hasMeasured.value ? `${width.value} cols` : "measuring..."} * * ); * ``` */ declare function useBoxMetrics(target: Readonly>): UseBoxMetricsReturn; //#endregion //#region src/index.d.ts /** * Terminal text: the only component that renders characters. * * - All text must sit inside a ``; a bare string in a `` is not * renderable. * - Nested spans inherit per channel; `color="default"` resets only that channel. * - The six modifiers are three-state: omitted inherits, `true` on, `false` off. * - The outermost `textAlign` and `wrap` govern composed content; alignment is * applied to every physical line after wrapping or truncation. * * @example Compose styled spans * ```tsx * * Count: {count} * (↑/↓ to change) * * ``` * * @example Truncate a long path to one line * ```tsx * {longPath} * ``` */ declare const Text: PublicComponent; //#endregion export { Box, type BoxProps, type Color, type ColorProfile, type FocusTarget, type MountOptions, type RenderToStringOptions, Text, type TextProps, type TuiApp, type TuiInputEvent, type TuiKey, type TuiKeyName, type UseAppReturn, type UseBoxMetricsReturn, type UseFocusReturn, type UseLayoutSizeReturn, type UseStdinReturn, createApp, renderToString, useApp, useBoxMetrics, useFocus, useInput, useLayoutSize, useStdin };