export { A as AriaProps, a as announce, g as getAccessibleName } from './accessibility-Dv-wc-jy.js'; import { e as Theme } from './hooks-8sZQy3JB.js'; export { A as AsyncState, a as AutoThemeProvider, b as AutoThemeProviderProps, B as BorderTokens, C as ColorTokens, K as KeyBinding, M as MouseButton, c as MouseEvent, S as SpacingTokens, T as TerminalCapabilities, d as TerminalSize, f as ThemeProvider, g as TypographyTokens, h as createTheme, i as detectCapabilities, j as detectColorScheme, k as getCapabilities, l as getTerminalCapabilities, r as refreshCapabilities, m as resetCapabilitiesCache, u as useAnimation, n as useAsync, o as useClipboard, p as useFocus, q as useFocusManager, s as useInterval, t as useKeymap, v as useMouse, w as useResize, x as useTerminal, y as useTheme, z as useThemeUpdater } from './hooks-8sZQy3JB.js'; export { I as InputHandler, K as Key, u as useInput } from './useInput-D8eE1Kzb.js'; import * as React from 'react'; export { H as HandleInputResult, P as PttAction, a as PttState, b as PushToTalkOptions, c as PushToTalkResult, d as PushToTalkStatus, V as VoiceCapture, i as initialPttState, p as pttReducer, u as usePushToTalk } from './usePushToTalk-DgH3oQQf.js'; import 'react/jsx-runtime'; /** * ANSI escape code utilities for terminal output. * Covers: colors, styles, cursor movement, screen control. */ declare const reset = "\u001B[0m"; declare const bold = "\u001B[1m"; declare const dim = "\u001B[2m"; declare const italic = "\u001B[3m"; declare const underline = "\u001B[4m"; declare const blink = "\u001B[5m"; declare const inverse = "\u001B[7m"; declare const hidden = "\u001B[8m"; declare const strikethrough = "\u001B[9m"; declare const fg: { readonly black: "\u001B[30m"; readonly red: "\u001B[31m"; readonly green: "\u001B[32m"; readonly yellow: "\u001B[33m"; readonly blue: "\u001B[34m"; readonly magenta: "\u001B[35m"; readonly cyan: "\u001B[36m"; readonly white: "\u001B[37m"; readonly default: "\u001B[39m"; readonly brightBlack: "\u001B[90m"; readonly brightRed: "\u001B[91m"; readonly brightGreen: "\u001B[92m"; readonly brightYellow: "\u001B[93m"; readonly brightBlue: "\u001B[94m"; readonly brightMagenta: "\u001B[95m"; readonly brightCyan: "\u001B[96m"; readonly brightWhite: "\u001B[97m"; }; declare const bg: { readonly black: "\u001B[40m"; readonly red: "\u001B[41m"; readonly green: "\u001B[42m"; readonly yellow: "\u001B[43m"; readonly blue: "\u001B[44m"; readonly magenta: "\u001B[45m"; readonly cyan: "\u001B[46m"; readonly white: "\u001B[47m"; readonly default: "\u001B[49m"; readonly brightBlack: "\u001B[100m"; readonly brightRed: "\u001B[101m"; readonly brightGreen: "\u001B[102m"; readonly brightYellow: "\u001B[103m"; readonly brightBlue: "\u001B[104m"; readonly brightMagenta: "\u001B[105m"; readonly brightCyan: "\u001B[106m"; readonly brightWhite: "\u001B[107m"; }; /** 256-color foreground: \x1b[38;5;m */ declare function fg256(n: number): string; /** 256-color background: \x1b[48;5;m */ declare function bg256(n: number): string; /** True-color (24-bit) foreground: \x1b[38;2;;;m */ declare function fgRgb(r: number, g: number, b: number): string; /** True-color (24-bit) background: \x1b[48;2;;;m */ declare function bgRgb(r: number, g: number, b: number): string; /** Parse a hex color string (#RRGGBB or #RGB) into {r,g,b} */ declare function parseHex(hex: string): { r: number; g: number; b: number; }; /** Apply true-color foreground from a hex string */ declare function fgHex(hex: string): string; /** Apply true-color background from a hex string */ declare function bgHex(hex: string): string; declare const cursor: { readonly up: (n?: number) => string; readonly down: (n?: number) => string; readonly forward: (n?: number) => string; readonly back: (n?: number) => string; readonly nextLine: (n?: number) => string; readonly prevLine: (n?: number) => string; readonly column: (n?: number) => string; readonly position: (row: number, col: number) => string; readonly hide: "\u001B[?25l"; readonly show: "\u001B[?25h"; readonly save: "\u001B[s"; readonly restore: "\u001B[u"; }; declare const screen: { readonly clear: "\u001B[2J"; readonly clearToEnd: "\u001B[0J"; readonly clearToStart: "\u001B[1J"; readonly clearLine: "\u001B[2K"; readonly clearLineToEnd: "\u001B[0K"; readonly clearLineToStart: "\u001B[1K"; readonly alternateBuffer: "\u001B[?1049h"; readonly mainBuffer: "\u001B[?1049l"; }; declare const osc: { /** OSC 8 — hyperlink: \x1b]8;;url\x1b\\ text \x1b]8;;\x1b\\ */ readonly hyperlink: (url: string, text: string) => string; /** OSC 52 — clipboard write (base64-encoded) */ readonly clipboardWrite: (data: string) => string; /** OSC 0 — set window title */ readonly setTitle: (title: string) => string; }; /** Wrap text with a style and reset */ declare function style$1(code: string, text: string): string; declare function stripAnsi(str: string): string; /** Measure visible width of a string (strips ANSI first) */ declare function visibleWidth(str: string): number; type ColorDepth = 'truecolor' | '256' | '16' | 'none'; /** * Map an RGB triplet to the nearest xterm 256-color palette index (0–255). * * Uses: * - Indices 0–15: standard + bright ANSI colors * - Indices 16–231: 6×6×6 color cube (index = 16 + 36r + 6g + b, r/g/b ∈ [0,5]) * - Indices 232–255: 24-step grayscale ramp */ declare function nearestAnsi256(r: number, g: number, b: number): number; /** * Map an RGB triplet to the nearest 16-color ANSI palette index (0–15). * Used when the terminal reports `TERM=ansi` or only 16-color support. */ declare function nearestAnsi16(r: number, g: number, b: number): number; /** * Convert a hex color string to the appropriate ANSI foreground escape code * based on the given color depth. * * - `'truecolor'` — `\x1b[38;2;R;G;Bm` (24-bit, pass-through) * - `'256'` — `\x1b[38;5;Nm` (nearest xterm-256 index) * - `'16'` — `\x1b[3Nm` / `\x1b[9Nm` (nearest 16-color ANSI) * - `'none'` — empty string (no color) * * @param hex Color string in `#RRGGBB` or `#RGB` format. * @param depth Target color depth. */ declare function downsampleColor(hex: string, depth: ColorDepth): string; /** * Border character resolution with ASCII fallback for terminals * that don't support box-drawing characters. */ type BorderMode = 'unicode' | 'ascii' | 'auto'; interface BorderChars { topLeft: string; topRight: string; bottomLeft: string; bottomRight: string; horizontal: string; vertical: string; teeLeft: string; teeRight: string; teeTop: string; teeBottom: string; cross: string; } /** * Get the appropriate border characters based on terminal capabilities. * * @param mode - 'unicode' | 'ascii' | 'auto' (default: 'auto') */ declare function getBorderChars(mode?: BorderMode): BorderChars; /** * Resolve a border style string to its character representation. * When `ascii` mode is active, box-drawing characters are replaced. */ declare function resolveBoxBorder(inkBorderStyle: string, mode?: BorderMode): string; interface MotionContextValue { /** true when NO_MOTION=1 or CI=true, or reducedMotion prop is set */ reduced: boolean; } declare const MotionContext: React.Context; declare function isReducedMotion(): boolean; /** * Check if the user has requested reduced motion. * * Returns `{ reduced: boolean }`. When `reduced` is true, animated components * should show static alternatives (e.g. `[…]` instead of a spinning animation). * * `reduced` is true when: * - `NO_MOTION=1` environment variable is set * - `CI=true` environment variable is set (CI logs don't need animations) * - `ThemeProvider` was given `reducedMotion={true}` * * @returns `MotionContextValue` — `{ reduced: boolean }`. * * @example * ```tsx * function MyAnimation() { * const { reduced } = useMotion(); * if (reduced) return [loading…]; * return ; * } * ``` */ declare function useMotion(): MotionContextValue; interface UnicodeContextValue { /** Whether the terminal supports Unicode/box-drawing characters. */ unicode: boolean; } /** * Context that ThemeProvider populates with the detected unicode capability. * Defaults to `true` so components render correctly outside a ThemeProvider. */ declare const UnicodeContext: React.Context; /** * Returns `true` when unicode should be suppressed. * Checks `NO_UNICODE=1` env var and terminal capability detection. * Used by ThemeProvider to seed UnicodeContext. */ declare function isNoUnicode(): boolean; /** * Returns whether the current terminal supports Unicode symbols. * * Components use this to choose between rich Unicode glyphs and ASCII fallbacks. * Reads from `UnicodeContext` (set by `ThemeProvider`) so it honours both * auto-detection and `NO_UNICODE=1` / the `noUnicode` ThemeProvider prop. * * @example * ```tsx * function MySpinner() { * const unicode = useUnicode(); * const frame = unicode ? '⠋' : '|'; * return {frame}; * } * ``` */ declare function useUnicode(): boolean; /** * Chainable style builder for ANSI-styled strings. * * Usage: * style('Hello').bold().fg('#FF0000').build() * style('World').dim().underline().build() */ declare class StyleBuilder { private _text; private _codes; constructor(text: string); bold(): this; dim(): this; italic(): this; underline(): this; strikethrough(): this; fg(color: string): this; bg(color: string): this; /** Build the final ANSI-styled string */ build(): string; toString(): string; } /** Entry point: style('text').bold().fg('#fff').build() */ declare function style(text: string): StyleBuilder; /** * Calculate relative luminance of a hex color (WCAG 2.1 formula). * Returns a value between 0 (darkest) and 1 (lightest). */ declare function luminance(hex: string): number; /** * Calculate contrast ratio between two hex colors (WCAG 2.1). * Returns a value between 1 (no contrast) and 21 (max contrast). */ declare function contrastRatio(hex1: string, hex2: string): number; type ContrastLevel = 'fail' | 'AA-large' | 'AA' | 'AAA'; /** * Get WCAG contrast level for a foreground/background pair. * AAA >= 7:1, AA >= 4.5:1, AA-large >= 3:1, fail < 3:1 */ declare function wcagLevel(hex1: string, hex2: string): ContrastLevel; interface ContrastReport { pair: [string, string]; ratio: number; level: ContrastLevel; } /** * Validate all critical color pairs in a theme and return a report. * Checks: foreground/background, primary/background, error/background, etc. */ declare function validateThemeContrast(theme: Theme): ContrastReport[]; declare const defaultTheme: Theme; declare const draculaTheme: Theme; declare const nordTheme: Theme; declare const catppuccinTheme: Theme; declare const monokaiTheme: Theme; declare const solarizedTheme: Theme; declare const tokyoNightTheme: Theme; declare const oneDarkTheme: Theme; /** * WCAG AA high-contrast theme — dark variant (white text on black). * * All foreground/background pairs meet the 4.5:1 contrast ratio required by * WCAG 2.1 AA, with key status pairs at 7:1 for small text. * * Compatible with: dark (white-on-black) terminal mode. * For light (black-on-white) terminals use `highContrastLightTheme`. */ declare const highContrastTheme: Theme; /** * WCAG AA high-contrast theme — light variant (black text on white). * * Compatible with: light (black-on-white) terminal mode. * For dark terminals use `highContrastTheme`. */ declare const highContrastLightTheme: Theme; interface KeyboardNavigationOptions { /** Total number of items in the list. */ itemCount: number; /** Initially active index. Defaults to 0. */ defaultIndex?: number; /** Wrap around at the ends. Defaults to true. */ loop?: boolean; /** How many items to jump on Page Up / Page Down. Defaults to 10. */ pageSize?: number; /** Called when the user presses Enter or Space on the active item. */ onSelect?: (index: number) => void; /** Called when the user presses Escape. */ onDismiss?: () => void; /** Whether keyboard handling is active. Defaults to true. */ isActive?: boolean; } interface KeyboardNavigationResult { /** The currently highlighted index. */ activeIndex: number; /** Programmatically move focus to an index (clamped to valid range). */ setActiveIndex: (index: number) => void; } /** * Standard keyboard navigation for list-style interactive components. * * Handles: ↑↓ arrows, Home/End, Page Up/Down, Enter/Space to select, Escape to dismiss. * All interactive components (Select, Menu, Tabs, CommandPalette, etc.) should use * this hook to ensure consistent keyboard behaviour across the library. * * @example * ```tsx * function MyList({ items }: { items: string[] }) { * const { activeIndex } = useKeyboardNavigation({ * itemCount: items.length, * onSelect: (i) => console.log('selected', items[i]), * onDismiss: () => setOpen(false), * }); * return ( * * {items.map((item, i) => ( * {item} * ))} * * ); * } * ``` */ declare function useKeyboardNavigation(options: KeyboardNavigationOptions): KeyboardNavigationResult; interface FocusTrapOptions { /** * Ordered list of focus IDs to trap within. * Each ID must match the `id` passed to `useFocus({ id })` on the target component. */ focusableIds: string[]; /** * Whether the trap is currently active. Defaults to true. * Set to false when the container is closed/hidden to release focus. */ isActive?: boolean; } /** * Trap keyboard focus within a set of focusable components. * * When active, Tab cycles forward and Shift+Tab cycles backward through the * provided `focusableIds` list without escaping to the rest of the app. * Intended for Modal, Dialog, Drawer, CommandPalette, and similar overlay components. * * Each ID in `focusableIds` must be registered with `useFocus({ id: '...' })` on * the corresponding component. * * @example * ```tsx * function Modal({ isOpen, onClose }: { isOpen: boolean; onClose: () => void }) { * useFocusTrap({ * focusableIds: ['modal-confirm', 'modal-cancel'], * isActive: isOpen, * }); * * const { isFocused: confirmFocused } = useFocus({ id: 'modal-confirm' }); * const { isFocused: cancelFocused } = useFocus({ id: 'modal-cancel' }); * * useInput((_, key) => { if (key.escape) onClose(); }, { isActive: isOpen }); * * return ( * * Confirm action? * [Yes] * [No] * * ); * } * ``` */ declare function useFocusTrap(options: FocusTrapOptions): void; interface VirtualScrollOptions { /** Total number of items in the list. */ itemCount: number; /** Number of visible rows in the viewport. */ viewportSize: number; /** Number of rows per item. Defaults to 1. */ itemSize?: number; /** Initially focused index. Defaults to 0. */ defaultIndex?: number; /** Extra items rendered above/below viewport. Defaults to 2. */ overscan?: number; /** Whether keyboard events are handled. Defaults to true. */ isActive?: boolean; /** Wrap navigation at ends. Defaults to false. */ loop?: boolean; } interface VirtualScrollResult { /** First rendered item index (includes overscan). */ startIndex: number; /** Last rendered item index (includes overscan). */ endIndex: number; /** First truly visible item index. */ visibleStartIndex: number; /** Last truly visible item index. */ visibleEndIndex: number; /** Currently focused item index. */ focusedIndex: number; /** Current scroll position in rows. */ scrollOffset: number; /** Programmatically set focused index (scrolls into view). */ setFocusedIndex: (index: number) => void; /** Scroll to and focus the given index. */ scrollToIndex: (index: number) => void; /** Returns true if the index is within the truly visible range. */ isItemVisible: (index: number) => boolean; } /** * Virtual scrolling hook for efficient rendering of large terminal lists. * * Manages focus, scroll window, and overscan. Handles ↑/↓, PgUp/PgDn, Home/End. * * @example * ```tsx * function MyBigList({ items }: { items: string[] }) { * const { startIndex, endIndex, focusedIndex, isItemVisible } = useVirtualScroll({ * itemCount: items.length, * viewportSize: 10, * }); * return ( * * {items.slice(startIndex, endIndex + 1).map((item, offset) => { * const index = startIndex + offset; * return isItemVisible(index) ? ( * {item} * ) : null; * })} * * ); * } * ``` */ declare function useVirtualScroll(options: VirtualScrollOptions): VirtualScrollResult; declare function useRenderCount(): number; interface RenderTiming { /** Duration of the last render in milliseconds */ lastRenderMs: number; /** Total cumulative render time */ totalMs: number; /** Number of renders */ count: number; } declare function useRenderTime(): RenderTiming; type NotificationVariant = 'info' | 'success' | 'warning' | 'error'; interface Notification { id: string; title: string; body?: string; variant: NotificationVariant; timestamp: number; read: boolean; persistent?: boolean; duration?: number; } interface NotificationsContextValue { notifications: Notification[]; notify: (opts: Omit) => string; dismiss: (id: string) => void; markRead: (id: string) => void; clear: () => void; } declare const NotificationsContext: React.Context; /** * Consume the notifications context provided by a parent component that calls * `useNotificationsProvider()`. Use this hook anywhere in the tree below that * provider to read the current notification list or dispatch actions. * * @returns A `NotificationsContextValue` with: * - `notifications` — Array of active `Notification` objects. * - `notify(opts)` — Create a new notification. Accepts all `Notification` * fields except `id`, `timestamp`, and `read` (auto-generated). Returns the * generated `id` string so you can dismiss it later. * - `dismiss(id)` — Remove a notification from the list immediately. * - `markRead(id)` — Mark a notification as read without removing it. * - `clear()` — Remove all notifications at once. * * @example * ```tsx * function SaveButton() { * const { notify } = useNotifications(); * * const handleSave = () => { * notify({ title: 'Saved', variant: 'success', duration: 3000 }); * }; * * return ; * } * ``` */ declare function useNotifications(): NotificationsContextValue; /** * Create and own the notifications state for a subtree. Call this hook once in * a root or layout component and spread the returned value into * `NotificationsContext.Provider`. Child components then access the same state * via `useNotifications()`. * * The hook also writes the `notify`, `dismiss`, and `clear` callbacks to * module-level references so they can be called imperatively from outside React * (e.g. from async handlers) if needed. * * @returns A `NotificationsContextValue` containing the live `notifications` * array and the `notify`, `dismiss`, `markRead`, and `clear` action * callbacks. Pass this directly as the `value` prop of * `NotificationsContext.Provider`. * * @example * ```tsx * function RootLayout({ children }: { children: ReactNode }) { * const notificationsValue = useNotificationsProvider(); * * // Auto-dismiss non-persistent notifications after their duration expires * useEffect(() => { * const timers = notificationsValue.notifications * .filter((n) => !n.persistent) * .map((n) => * setTimeout( * () => notificationsValue.dismiss(n.id), * n.duration ?? 5000 * ) * ); * return () => timers.forEach(clearTimeout); * }, [notificationsValue.notifications]); * * return ( * * {children} * * * ); * } * ``` */ declare function useNotificationsProvider(): NotificationsContextValue; export { type BorderChars, type BorderMode, type ColorDepth, type ContrastLevel, type ContrastReport, type FocusTrapOptions, type KeyboardNavigationOptions, type KeyboardNavigationResult, MotionContext, type MotionContextValue, type Notification, type NotificationVariant, NotificationsContext, type NotificationsContextValue, type RenderTiming, StyleBuilder, Theme, UnicodeContext, type UnicodeContextValue, type VirtualScrollOptions, type VirtualScrollResult, style$1 as ansiStyle, bg, bg256, bgHex, bgRgb, blink, bold, catppuccinTheme, contrastRatio, cursor, defaultTheme, dim, downsampleColor, draculaTheme, fg, fg256, fgHex, fgRgb, getBorderChars, hidden, highContrastLightTheme, highContrastTheme, inverse, isNoUnicode, isReducedMotion, italic, luminance, monokaiTheme, nearestAnsi16, nearestAnsi256, nordTheme, oneDarkTheme, osc, parseHex, reset, resolveBoxBorder, screen, solarizedTheme, strikethrough, stripAnsi, style, tokyoNightTheme, underline, useFocusTrap, useKeyboardNavigation, useMotion, useNotifications, useNotificationsProvider, useRenderCount, useRenderTime, useUnicode, useVirtualScroll, validateThemeContrast, visibleWidth, wcagLevel };