UNPKG

research-cli

Version:

AI-powered research assistant with web search capabilities and beautiful terminal UI

141 lines 3.51 kB
import boxen from "boxen"; /** * Predefined box styles for consistent branding */ export const BoxStyles = { /** Clean single border box */ default: { borderStyle: "single", padding: 1, margin: 0, }, /** Emphasized double border box */ emphasized: { borderStyle: "double", padding: 1, margin: { top: 1, bottom: 1, left: 0, right: 0 }, }, /** Rounded modern box */ modern: { borderStyle: "round", padding: 1, margin: 0, }, /** Minimal box with no border */ minimal: { borderStyle: "none", padding: 1, margin: 0, }, /** Error/warning box with bold border */ alert: { borderStyle: "bold", padding: 1, margin: { top: 1, bottom: 1, left: 0, right: 0 }, borderColor: "red", }, /** Success box with green border */ success: { borderStyle: "single", padding: 1, margin: { top: 1, bottom: 1, left: 0, right: 0 }, borderColor: "green", }, /** Info box with blue border */ info: { borderStyle: "single", padding: 1, margin: 0, borderColor: "blue", }, }; /** * Color palette for consistent theming */ export const BoxColors = { primary: "blue", success: "green", warning: "yellow", error: "red", info: "cyan", muted: "gray", accent: "magenta", }; /** * Create a box with specified content and configuration */ export function createBox(content, config = {}) { const { content: _, ...boxenOptions } = { content, ...config }; return boxen(content, boxenOptions); } /** * Create a styled box using predefined styles */ export function createStyledBox(content, style, overrides = {}) { const styleConfig = BoxStyles[style]; const mergedConfig = { ...styleConfig, ...overrides }; return boxen(content, mergedConfig); } /** * Create a titled box with consistent title styling */ export function createTitledBox(title, content, config = {}) { const boxConfig = { title, titleAlignment: "center", borderStyle: "single", padding: 1, ...config, }; return boxen(content, boxConfig); } /** * Create a centered box that spans available terminal width */ export function createCenteredBox(content, config = {}) { const boxConfig = { float: "center", borderStyle: "round", padding: 1, margin: { top: 1, bottom: 1, left: 0, right: 0 }, ...config, }; return boxen(content, boxConfig); } /** * Create a full-width box that spans the terminal */ export function createFullWidthBox(content, config = {}) { const boxConfig = { fullscreen: true, padding: 1, margin: 0, ...config, }; return boxen(content, boxConfig); } /** * Create a compact inline box with minimal spacing */ export function createCompactBox(content, config = {}) { const boxConfig = { borderStyle: "single", padding: 0, margin: 0, ...config, }; return boxen(content, boxConfig); } /** * Create a box with dynamic width based on content */ export function createAutoWidthBox(content, maxWidth, config = {}) { const boxConfig = { width: Math.min(content.length + 4, maxWidth), borderStyle: "single", padding: 1, ...config, }; return boxen(content, boxConfig); } //# sourceMappingURL=boxes.js.map